Skip to content

feat(runtime): expose stateful provider run control without bypassing Runtime #733

Description

@drewstone

Reproduced package gap

Against the current published cohort:

  • @tangle-network/agent-runtime@0.126.0
  • @tangle-network/agent-provider-cli-bridge@0.3.4
  • @tangle-network/agent-interface@0.43.0

The CLI Bridge provider reports live streaming, replay, turn idempotency, and session continuation. Its concrete environment streams with sessionId and lastEventId, and its destroy path calls the bridge cancel route.

Runtime currently gives a product shell two public choices:

  1. streamAgentTurn() with an executor backend: documented as a fresh one-shot factory that is torn down after the turn.
  2. RuntimeRunHandle: cost and terminal-row persistence only; it has no provider status, reconnect, replay, cancel, interaction-response, or retained environment/session control.

A product such as Braid therefore cannot expose the published provider capabilities through Runtime without either losing them or directly owning provider environments and recreating a second execution lifecycle outside Runtime.

Required contract

Expose one provider-neutral, runtime-owned stateful run controller that:

  • admits an exact AgentProfile and returns the downstream materialization acknowledgment from fix(runtime): require bridge materialization acknowledgment #731;
  • starts a turn with stable runtime/run/session identity;
  • streams canonical events with stable event id, sequence, and cursor;
  • reconnects or replays after a cursor through a new client/process when the provider reports support;
  • reports provider status and terminal state;
  • explicitly cancels and returns an acknowledgment distinct from local stream abort;
  • responds to typed interactions when the provider reports that capability;
  • preserves session continuation without resending hidden or duplicate history;
  • exposes capability truth from the selected provider rather than one static snapshot;
  • remains the sole owner of environment creation, retention, and cleanup.

Every unsupported operation must remain typed unavailable rather than be approximated.

Completion proof

  • CLI Bridge live stream, cancel, replay, and second-turn continuation execute through this Runtime contract.
  • A fresh controller reconstructs a retained run and resumes from the last cursor without duplicate events.
  • Provider capability disablement removes each corresponding method/action.
  • Local abort without provider acknowledgment remains unknown, never cancelled.
  • The same contract works for Tangle provider environments without product-specific branches.
  • Package API, restart, mismatch, and cleanup tests pass against packed current providers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions