caelum0x 9bfde48b0a feat(openfang): event-bus publish hook + native-workflow driver consumer
Activate the workflow consumer + the one real event hook of the openfang
deep-module fusion (design §8.4, §4c/§4e), no rewrite:

- NEW conductor/ports/agent-event.port.ts — a thin CONSUMER-owned outbound
  event-bus port (`publish(event)`), backed structurally by the engines facet's
  `publishEvent` at the composition root. Degrade law: never throws; an
  absent/boot-failed engine resolves an empty fired list (no fabricated dispatch).
- completion-hook.adapter.ts (ADDITIVE): the terminal-completion path — already
  the token emitter — now ALSO publishes `{type:'workspace.completed',
  workspaceId,taskId,outcome}` onto the kernel bus so kernel triggers can fire
  background Hands. Fire-and-forget + degrade-safe: a publish fault NEVER stalls
  or rejects the terminal-event path; absent port ⇒ truthful no-op.
- packages/agent-workflows: NEW consumer-owned `WorkflowEnginePort` +
  `createNativeWorkflowHandler` — a native-openfang-workflow `tool` handler
  (register_workflow/run_workflow inside the kernel `.node`), narrowing the
  degrade-safe union (available:false⇒skipped, ok:false⇒failed, ok⇒completed).
  Registered on the agent-os default `AgentOsWorkflowRunnerDriver` via its
  existing `executeTool` port, backed by `createOpenfangWorkflowDriver()` wired
  from bootstrap — the driver's FIRST real product consumer. The broad
  recoder.workflow.* binder is NOT force-migrated.
- FUSION-STATUS openfang row: token accounting + continueRun marked shipped
  (Wave 3–4), provenance gate wired on BOTH surfaces, workflow driver consumed;
  the kernel cron/Hands scheduler + channel adapters documented as
  kernel-export-blocked (no napi export) — honestly dark, not faked.

conductor-module.ts is untouched (the setRunSink late-bind stays verbatim); the
event port's live injection rides the next single-writer conductor-module
dep-passthrough (the completion sink is constructed there).

Verified:
- backend `pnpm exec tsc --noEmit` → exit 0
- backend `pnpm exec vitest run src/domains/engines/openfang-workflow.test.ts
  src/domains/engines/agent-engine
  src/domains/conductor/adapters/completion-hook.adapter.test.ts` → 3 files, 45 passed
- agent-os regression `vitest run src/domains/agent-os` → 19 files, 158 passed
- `@recoder/agent-workflows` native-workflow.test.ts → 5 passed
2026-07-21 02:59:39 +03:00
..