[codex] Export node invocation helpers

Merged
WI
5mo ago
+387-82

What changed

  • Added drainNodeInvocations(db, registry, workspaceId, nodeId) and sweepTimedOutInvocations(db, registry, opts) to the public engine surface.
  • Added @relaycast/engine/node-invocations as a dedicated adapter import path.
  • Moved the Node adapter drain path onto the shared DB-backed helper.
  • Preserved queued spawn capacity reservation/backstop behavior and fixed drained/retried spawn action frames to use the v5 spawn:<cli> capability name.
  • Added conformance coverage for draining a pending handler-agent invocation with agent_id and agent_name in the action.invoke frame.

Why

DO-based adapters should delegate invocation drain and timeout retry behavior to the engine instead of reimplementing placement and frame construction. The shared drain now covers both node handlers and handler agents currently located on the node, so worker drains do not miss agent-hosted actions or emit incomplete v5 frames.

Validation

  • ../../node_modules/.bin/vitest run src/__tests__/conformance/node.test.ts
  • ../../node_modules/.bin/tsc --noEmit
  • ../../node_modules/.bin/eslint src/
  • ../../node_modules/.bin/tsc