@qlairoslabs/acp-client 0.12.0 → 0.13.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-consumer-fixes.md +17 -3
- package/CHANGELOG-controller-interface.md +258 -0
- package/CHANGELOG-metering.md +29 -0
- package/CHANGELOG-operation-lifecycle.md +15 -1
- package/CONSUMER_GUIDE.md +847 -7
- package/MIGRATION-0.10-to-0.12.md +4 -1
- package/MIGRATION-0.12-to-0.13.md +275 -0
- package/README.md +17 -16
- package/package.json +4 -2
- package/src/acp-client-handlers.ts +48 -0
- package/src/activity.ts +3 -0
- package/src/adapters.ts +30 -0
- package/src/agent/adoption/provider-attachment.ts +33 -0
- package/src/agent/adoption/provider-session-delete.ts +1 -1
- package/src/agent/adoption/provider-sessions.ts +3 -2
- package/src/agent/append-assistant-message.ts +91 -0
- package/src/agent/config.ts +54 -6
- package/src/agent/conversation-manager.ts +94 -158
- package/src/agent/manager-settings.ts +1 -0
- package/src/agent/native-channel-lifecycle.ts +111 -0
- package/src/agent/persisted-lifecycle.ts +44 -4
- package/src/agent/persistence-policy/context.ts +13 -0
- package/src/agent/persistence-policy/resolver.ts +7 -0
- package/src/agent/persistence-policy/types.ts +1 -0
- package/src/agent/record-capture.ts +1 -0
- package/src/agent-adapter-registry.ts +33 -7
- package/src/agent-conversation-contracts.ts +14 -1
- package/src/agent-conversation-errors.ts +8 -0
- package/src/agent-conversation-owner.ts +9 -4
- package/src/agent-session-config.ts +135 -0
- package/src/agent-session.ts +439 -934
- package/src/agent.ts +73 -0
- package/src/capabilities.ts +2 -0
- package/src/checkpointing/recovery.ts +10 -0
- package/src/cli/index.ts +3 -3
- package/src/cli/managed.ts +2 -2
- package/src/client.ts +68 -98
- package/src/connection-attempt.ts +95 -0
- package/src/controller-connection.ts +114 -0
- package/src/controller.ts +156 -148
- package/src/conversation-controller/capabilities.ts +88 -0
- package/src/conversation-controller/contracts.ts +208 -0
- package/src/conversation-controller/factory.ts +39 -0
- package/src/conversation-controller/guards.ts +98 -0
- package/src/conversation-controller/index.ts +20 -0
- package/src/conversation-startup.ts +35 -0
- package/src/conversation-turns/backend-turns.ts +373 -0
- package/src/conversation-turns/clear-operations.ts +37 -0
- package/src/conversation-turns/context.ts +135 -0
- package/src/conversation-turns/index.ts +4 -0
- package/src/conversation-turns/record-helpers.ts +75 -0
- package/src/conversation-turns/recording.ts +235 -0
- package/src/conversation-turns/run-turn.ts +367 -0
- package/src/conversation-turns/turn-run.ts +57 -0
- package/src/errors.ts +41 -0
- package/src/handoff-options.ts +81 -0
- package/src/identity/checkpoint-backed.ts +1 -1
- package/src/index.ts +58 -3
- package/src/internal-inference/coordination/manager.ts +11 -0
- package/src/internal-inference/runtime/harness-runtime.ts +4 -4
- package/src/launcher.ts +35 -2
- package/src/media/parts.ts +5 -0
- package/src/message-status.ts +83 -0
- package/src/metering/engine.ts +39 -64
- package/src/metering/measurement-provenance.ts +36 -0
- package/src/metering/native/durability.ts +115 -0
- package/src/metering/native/ledger.ts +104 -0
- package/src/metering/native/operation.ts +85 -0
- package/src/metering/native/projection.ts +114 -0
- package/src/metering/native/proof.ts +51 -0
- package/src/metering/native/requirements.ts +10 -0
- package/src/metering/native/retirement.ts +92 -0
- package/src/metering/native/source.ts +90 -0
- package/src/metering/record.ts +38 -1
- package/src/metering/state.ts +13 -3
- package/src/native/approvals.ts +169 -0
- package/src/native/capabilities.ts +17 -0
- package/src/native/channel-changes.ts +211 -0
- package/src/native/connection.ts +56 -0
- package/src/native/controller.ts +591 -0
- package/src/native/delegation-sender.ts +26 -0
- package/src/native/errors.ts +35 -0
- package/src/native/functions.ts +156 -0
- package/src/native/host-config.ts +59 -0
- package/src/native/host.ts +909 -0
- package/src/native/item-receipts.ts +15 -0
- package/src/native/metering.ts +12 -0
- package/src/native/records.ts +166 -0
- package/src/native/recovery.ts +186 -0
- package/src/native/reminders/fixtures/schema21.sqlite.gz +0 -0
- package/src/native/reminders/idle.ts +70 -0
- package/src/native/reminders/limits.ts +19 -0
- package/src/native/reminders/notifications.ts +29 -0
- package/src/native/reminders/reminders.test.ts +553 -0
- package/src/native/reminders/routine-config.typecheck.ts +13 -0
- package/src/native/reminders/routine-guard.ts +66 -0
- package/src/native/reminders/routine-schedule.ts +25 -0
- package/src/native/reminders/routine-wire.ts +21 -0
- package/src/native/reminders/schedule.ts +97 -0
- package/src/native/reminders/service.ts +280 -0
- package/src/native/reminders/supervisor.ts +91 -0
- package/src/native/reminders/sync.ts +301 -0
- package/src/native/reminders/wire.ts +197 -0
- package/src/native/reminders/wire.typecheck.ts +13 -0
- package/src/native/submission-withdrawal.ts +65 -0
- package/src/native/usage.ts +15 -0
- package/src/native/worker-delivery.ts +61 -0
- package/src/native-harness/.res/README.md +1 -0
- package/src/native-harness/.res/architecture/README.md +21 -0
- package/src/native-harness/.res/architecture/context-and-data.md +31 -0
- package/src/native-harness/.res/architecture/execution.md +42 -0
- package/src/native-harness/.res/architecture/overview.md +44 -0
- package/src/native-harness/.res/architecture/persistence.md +56 -0
- package/src/native-harness/.res/architecture/suspend-and-resume.md +45 -0
- package/src/native-harness/.res/architecture/technical-architecture.md +50 -0
- package/src/native-harness/.res/decisions/0001-basic-loop.md +11 -0
- package/src/native-harness/.res/decisions/0002-channel-input.md +17 -0
- package/src/native-harness/.res/decisions/0003-inference-inspection.md +14 -0
- package/src/native-harness/.res/decisions/0004-shared-context.md +21 -0
- package/src/native-harness/.res/decisions/0005-notice-inbox.md +20 -0
- package/src/native-harness/.res/decisions/0006-explicit-notices.md +12 -0
- package/src/native-harness/.res/decisions/0007-channel-output.md +12 -0
- package/src/native-harness/.res/decisions/0008-browser-client.md +16 -0
- package/src/native-harness/.res/decisions/0009-scripted-model.md +18 -0
- package/src/native-harness/.res/decisions/0010-inprocess-protocol.md +19 -0
- package/src/native-harness/.res/decisions/0011-stdio-transport.md +21 -0
- package/src/native-harness/.res/decisions/0012-session-storage-contract.md +37 -0
- package/src/native-harness/.res/decisions/0013-durable-delivery-contract.md +64 -0
- package/src/native-harness/.res/decisions/0014-channel-controls-contract.md +73 -0
- package/src/native-harness/.res/decisions/0015-session-file-contract.md +72 -0
- package/src/native-harness/.res/decisions/0016-configuration-permissions.md +159 -0
- package/src/native-harness/.res/decisions/0017-openrouter-managed-config.md +69 -0
- package/src/native-harness/.res/decisions/0018-tool-dispatch-evidence.md +78 -0
- package/src/native-harness/.res/decisions/0019-model-execution.md +188 -0
- package/src/native-harness/.res/decisions/0020-startup-channel-changes.md +71 -0
- package/src/native-harness/.res/decisions/0021-tools-and-host-callbacks.md +100 -0
- package/src/native-harness/.res/decisions/0022-operator-controls.md +115 -0
- package/src/native-harness/.res/decisions/0023-long-running-mock.md +82 -0
- package/src/native-harness/.res/decisions/0024-callback-policy-names.md +46 -0
- package/src/native-harness/.res/decisions/0025-external-notices.md +364 -0
- package/src/native-harness/.res/decisions/0026-bounded-context.md +81 -0
- package/src/native-harness/.res/decisions/0027-development-instructions.md +22 -0
- package/src/native-harness/.res/decisions/0028-debug-tools.md +16 -0
- package/src/native-harness/.res/decisions/0029-bounded-model-call-pages.md +37 -0
- package/src/native-harness/.res/decisions/0030-timeline-retrieval.md +145 -0
- package/src/native-harness/.res/decisions/0031-one-off-reminders.md +173 -0
- package/src/native-harness/.res/docs/11-15.md +148 -0
- package/src/native-harness/.res/docs/BUSINESS_RULES.md +111 -0
- package/src/native-harness/.res/docs/WORK.md +65 -0
- package/src/native-harness/.res/docs/_/11-16-persistence/LOG.md +312 -0
- package/src/native-harness/.res/docs/_/11-16-persistence/PLAN.md +77 -0
- package/src/native-harness/.res/docs/_/11-16-persistence/SPEC.md +313 -0
- package/src/native-harness/.res/docs/_/11-19-channel-controls/LOG.md +160 -0
- package/src/native-harness/.res/docs/_/11-19-channel-controls/PLAN.md +89 -0
- package/src/native-harness/.res/docs/_/11-19-channel-controls/SPEC.md +135 -0
- package/src/native-harness/.res/docs/_/11-19-config-permissions/LOG.md +143 -0
- package/src/native-harness/.res/docs/_/11-19-config-permissions/PLAN.md +93 -0
- package/src/native-harness/.res/docs/_/11-19-config-permissions/SPEC.md +181 -0
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/11-20-LOG.md +433 -0
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/PLAN.md +60 -0
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/PROTOCOL.md +141 -0
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/SPEC.md +168 -0
- package/src/native-harness/.res/docs/attachments/0001-DESIGN/SPEC.md +111 -0
- package/src/native-harness/.res/docs/bounded-context/0001-DESIGN/PLAN.md +129 -0
- package/src/native-harness/.res/docs/bounded-context/0001-DESIGN/SPEC.md +135 -0
- package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/LOG.md +437 -0
- package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/PLAN.md +127 -0
- package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/SPEC.md +203 -0
- package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/LOG.md +292 -0
- package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/PLAN.md +91 -0
- package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/SPEC.md +187 -0
- package/src/native-harness/.res/docs/model-execution/0001-DESIGN/LOG.md +148 -0
- package/src/native-harness/.res/docs/model-execution/0001-DESIGN/PLAN.md +95 -0
- package/src/native-harness/.res/docs/model-execution/0001-DESIGN/SPEC.md +200 -0
- package/src/native-harness/.res/docs/model-execution/0002-AMENDMENT-accounting/SPEC.md +80 -0
- package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/LOG.md +206 -0
- package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/PLAN.md +106 -0
- package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/SPEC.md +297 -0
- package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/LOG.md +41 -0
- package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/PLAN.md +36 -0
- package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/SPEC.md +84 -0
- package/src/native-harness/.res/docs/shell-execution/0001-DESIGN/SPEC.md +147 -0
- package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/LOG.md +15 -0
- package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/PLAN.md +107 -0
- package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/SPEC.md +114 -0
- package/src/native-harness/.res/docs/todos/11-19-TODO-auto_review-approve.md +24 -0
- package/src/native-harness/.res/docs/todos/11-20-TODO-user-entered-tool-code.md +23 -0
- package/src/native-harness/.res/docs/todos/11-21-TODO-node-resource-coordination.md +103 -0
- package/src/native-harness/.res/docs/todos/11-22-TODO-harness-m1-sequence.md +50 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/LOG.md +337 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/PLAN.md +76 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/SPEC.md +204 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0002-AMENDMENT-callback-policy/LOG.md +73 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0002-AMENDMENT-callback-policy/SPEC.md +64 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0003-DESIGN-attachment-tools/SPEC.md +58 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/LOG.md +45 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/PLAN.md +108 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/SPEC.md +169 -0
- package/src/native-harness/.res/docs/web-tools/0001-DESIGN/SPEC.md +128 -0
- package/src/native-harness/.res/marketing-draft.md +22 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/README.md +285 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-1.md +19 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-10.md +138 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-11.md +148 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-12.md +172 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-13.md +194 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-14.md +233 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-15.md +249 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-16.md +265 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-17.md +279 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-18.md +293 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-19.md +307 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-2.md +29 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-20.md +317 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-21.md +327 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-3.md +40 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-4.md +59 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-5.md +69 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-6.md +79 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-7.md +89 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-8.md +102 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-9.md +116 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation.jsonl +49 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/doc.md +87 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/harness.py +289 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy 2.py +221 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy 3.py +287 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy.py +165 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/state.json +22 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/system-prompt.md +2 -0
- package/src/native-harness/AGENTS.md +70 -0
- package/src/native-harness/ARCHITECTURE.md +249 -0
- package/src/native-harness/README.md +726 -0
- package/src/native-harness/bun.lock +26 -0
- package/src/native-harness/package.json +24 -0
- package/src/native-harness/src/capabilities/context/build.ts +59 -0
- package/src/native-harness/src/capabilities/context/instructions/agent-demo.md +11 -0
- package/src/native-harness/src/capabilities/context/instructions/agent.md +5 -0
- package/src/native-harness/src/capabilities/context/instructions/harness.md +7 -0
- package/src/native-harness/src/capabilities/context/load-instructions.ts +22 -0
- package/src/native-harness/src/capabilities/context/session.ts +92 -0
- package/src/native-harness/src/capabilities/model/attempt.ts +27 -0
- package/src/native-harness/src/capabilities/model/openrouter-stream.ts +72 -0
- package/src/native-harness/src/capabilities/model/openrouter.ts +62 -0
- package/src/native-harness/src/capabilities/model/runner.ts +116 -0
- package/src/native-harness/src/capabilities/model/scenario-attempt.ts +50 -0
- package/src/native-harness/src/capabilities/model/scenario-file.ts +125 -0
- package/src/native-harness/src/capabilities/model/scripted-error.ts +6 -0
- package/src/native-harness/src/capabilities/model/scripted.ts +81 -0
- package/src/native-harness/src/capabilities/model/usage.ts +15 -0
- package/src/native-harness/src/capabilities/tools/builtin/current-time.ts +28 -0
- package/src/native-harness/src/capabilities/tools/builtin/notify-channel.ts +17 -0
- package/src/native-harness/src/capabilities/tools/debug/index.ts +13 -0
- package/src/native-harness/src/capabilities/tools/debug/result.ts +12 -0
- package/src/native-harness/src/capabilities/tools/debug/test-echo.ts +16 -0
- package/src/native-harness/src/capabilities/tools/debug/test-fail.ts +14 -0
- package/src/native-harness/src/capabilities/tools/debug/test-wait.ts +19 -0
- package/src/native-harness/src/capabilities/tools/reminders/index.ts +75 -0
- package/src/native-harness/src/capabilities/tools/runtime/catalog.ts +103 -0
- package/src/native-harness/src/capabilities/tools/runtime/functions.ts +130 -0
- package/src/native-harness/src/capabilities/tools/runtime/invocations.ts +48 -0
- package/src/native-harness/src/capabilities/tools/testing/echo.ts +18 -0
- package/src/native-harness/src/capabilities/tools/testing/record.ts +47 -0
- package/src/native-harness/src/capabilities/tools/timeline/index.ts +41 -0
- package/src/native-harness/src/client.ts +18 -0
- package/src/native-harness/src/contracts/agent.ts +105 -0
- package/src/native-harness/src/contracts/config-permissions.ts +47 -0
- package/src/native-harness/src/contracts/context.ts +112 -0
- package/src/native-harness/src/contracts/events.ts +47 -0
- package/src/native-harness/src/contracts/input-limits.ts +7 -0
- package/src/native-harness/src/contracts/inspection.ts +22 -0
- package/src/native-harness/src/contracts/loop.ts +31 -0
- package/src/native-harness/src/contracts/model-execution.ts +83 -0
- package/src/native-harness/src/contracts/operator-controls.ts +106 -0
- package/src/native-harness/src/contracts/output.ts +13 -0
- package/src/native-harness/src/contracts/protocol.ts +320 -0
- package/src/native-harness/src/contracts/reminders.ts +132 -0
- package/src/native-harness/src/contracts/scenario.ts +42 -0
- package/src/native-harness/src/contracts/session-file.ts +19 -0
- package/src/native-harness/src/contracts/session.ts +184 -0
- package/src/native-harness/src/contracts/storage.ts +596 -0
- package/src/native-harness/src/contracts/timeline-retrieval.ts +40 -0
- package/src/native-harness/src/contracts/tools.ts +133 -0
- package/src/native-harness/src/governance/permissions/gate.ts +129 -0
- package/src/native-harness/src/governance/policy/resolve.ts +32 -0
- package/src/native-harness/src/index.ts +318 -0
- package/src/native-harness/src/interfaces/cli/chat.ts +83 -0
- package/src/native-harness/src/interfaces/cli/development.ts +145 -0
- package/src/native-harness/src/interfaces/cli/format-reply.ts +27 -0
- package/src/native-harness/src/interfaces/cli/listeners.ts +74 -0
- package/src/native-harness/src/interfaces/cli/main.ts +47 -0
- package/src/native-harness/src/interfaces/cli/scenario.ts +37 -0
- package/src/native-harness/src/interfaces/cli/serve.ts +21 -0
- package/src/native-harness/src/interfaces/cli/start.ts +106 -0
- package/src/native-harness/src/interfaces/client.ts +225 -0
- package/src/native-harness/src/interfaces/inspector/index.html +283 -0
- package/src/native-harness/src/interfaces/inspector/observe.ts +35 -0
- package/src/native-harness/src/interfaces/inspector/server.ts +56 -0
- package/src/native-harness/src/interfaces/inspector/state.ts +92 -0
- package/src/native-harness/src/interfaces/protocol/channel-changes.ts +153 -0
- package/src/native-harness/src/interfaces/protocol/framing.ts +47 -0
- package/src/native-harness/src/interfaces/protocol/functions.ts +87 -0
- package/src/native-harness/src/interfaces/protocol/in-process.ts +67 -0
- package/src/native-harness/src/interfaces/protocol/live-queue.ts +55 -0
- package/src/native-harness/src/interfaces/protocol/load.ts +60 -0
- package/src/native-harness/src/interfaces/protocol/local.ts +120 -0
- package/src/native-harness/src/interfaces/protocol/operator.ts +120 -0
- package/src/native-harness/src/interfaces/protocol/output.ts +59 -0
- package/src/native-harness/src/interfaces/protocol/server.ts +517 -0
- package/src/native-harness/src/interfaces/protocol/stdio-client.ts +119 -0
- package/src/native-harness/src/interfaces/protocol/stdio-server.ts +82 -0
- package/src/native-harness/src/interfaces/protocol/subscribe.ts +41 -0
- package/src/native-harness/src/interfaces/protocol/transfers.ts +146 -0
- package/src/native-harness/src/interfaces/web-chat/index.html +94 -0
- package/src/native-harness/src/interfaces/web-chat/server.ts +34 -0
- package/src/native-harness/src/kernel/channels.ts +405 -0
- package/src/native-harness/src/kernel/loop.ts +45 -0
- package/src/native-harness/src/runtime/config/development.ts +23 -0
- package/src/native-harness/src/runtime/config/managed.ts +2 -0
- package/src/native-harness/src/runtime/config/paths.ts +27 -0
- package/src/native-harness/src/runtime/reminder-timer.ts +42 -0
- package/src/native-harness/src/runtime/reminder-validation.ts +104 -0
- package/src/native-harness/src/runtime/reminders.ts +66 -0
- package/src/native-harness/src/state/storage/archive.ts +239 -0
- package/src/native-harness/src/state/storage/engine.ts +1013 -0
- package/src/native-harness/src/state/storage/inference.ts +124 -0
- package/src/native-harness/src/state/storage/memory-reminders.ts +78 -0
- package/src/native-harness/src/state/storage/memory.ts +341 -0
- package/src/native-harness/src/state/storage/policy-metadata.ts +32 -0
- package/src/native-harness/src/state/storage/reminder-archive.ts +63 -0
- package/src/native-harness/src/state/storage/reminder-change.ts +92 -0
- package/src/native-harness/src/state/storage/reminder-tables.ts +27 -0
- package/src/native-harness/src/state/storage/retrieval.ts +122 -0
- package/src/native-harness/src/state/storage/script-identity.ts +7 -0
- package/src/native-harness/src/state/storage/session-file.ts +85 -0
- package/src/native-harness/src/state/storage/sqlite-reminders.ts +134 -0
- package/src/native-harness/src/state/storage/sqlite.ts +625 -0
- package/src/native-harness/src/testing.ts +190 -0
- package/src/native-harness/src/util/config.ts +58 -0
- package/src/native-harness/src/util/json.ts +41 -0
- package/src/native-harness/src/util/message-position.ts +3 -0
- package/src/native-harness/src/util/reminder-schedule.ts +44 -0
- package/src/native-harness/src/util/schema.ts +40 -0
- package/src/native-harness/src/util/timeline-text.ts +72 -0
- package/src/native-harness/src/util/timeline-tool-names.ts +3 -0
- package/src/native-harness/test/agent.test.ts +130 -0
- package/src/native-harness/test/approval-gate.test.ts +255 -0
- package/src/native-harness/test/approval-protocol.test.ts +94 -0
- package/src/native-harness/test/boundaries.test.ts +18 -0
- package/src/native-harness/test/channel-controls.test.ts +322 -0
- package/src/native-harness/test/client-abort.test.ts +136 -0
- package/src/native-harness/test/config-policy.test.ts +301 -0
- package/src/native-harness/test/conformance/storage.ts +1141 -0
- package/src/native-harness/test/context.test.ts +177 -0
- package/src/native-harness/test/crash.test.ts +187 -0
- package/src/native-harness/test/debug-tools.test.ts +67 -0
- package/src/native-harness/test/development-cli.test.ts +67 -0
- package/src/native-harness/test/development.test.ts +171 -0
- package/src/native-harness/test/dispatch-evidence.test.ts +58 -0
- package/src/native-harness/test/e2e.test.ts +186 -0
- package/src/native-harness/test/external-notices.test.ts +101 -0
- package/src/native-harness/test/fixtures/approval-e2e.jsonl +4 -0
- package/src/native-harness/test/fixtures/crash-scenario.jsonl +5 -0
- package/src/native-harness/test/fixtures/development-lifecycle.jsonl +10 -0
- package/src/native-harness/test/fixtures/echo-scenario.jsonl +3 -0
- package/src/native-harness/test/fixtures/format2-schema.ts +27 -0
- package/src/native-harness/test/fixtures/format3-schema.ts +16 -0
- package/src/native-harness/test/fixtures/hold-scenario.jsonl +4 -0
- package/src/native-harness/test/fixtures/model-e2e.jsonl +3 -0
- package/src/native-harness/test/fixtures/storage-owner.ts +20 -0
- package/src/native-harness/test/format-reply.test.ts +10 -0
- package/src/native-harness/test/helpers/operator-view.ts +41 -0
- package/src/native-harness/test/helpers/scenario.ts +9 -0
- package/src/native-harness/test/helpers/session.ts +38 -0
- package/src/native-harness/test/helpers/stdio.ts +46 -0
- package/src/native-harness/test/inspector.test.ts +77 -0
- package/src/native-harness/test/listeners.test.ts +49 -0
- package/src/native-harness/test/loop.test.ts +88 -0
- package/src/native-harness/test/model-channel-double.test.ts +87 -0
- package/src/native-harness/test/model-crash.test.ts +62 -0
- package/src/native-harness/test/model-delivery-regressions.test.ts +55 -0
- package/src/native-harness/test/model-e2e.test.ts +71 -0
- package/src/native-harness/test/model-final-filter.test.ts +30 -0
- package/src/native-harness/test/model-large-reply.test.ts +28 -0
- package/src/native-harness/test/model-live-queue.test.ts +33 -0
- package/src/native-harness/test/model-runner.test.ts +117 -0
- package/src/native-harness/test/model-storage.test.ts +99 -0
- package/src/native-harness/test/model-stream-adapter.test.ts +26 -0
- package/src/native-harness/test/model-stream-public.test.ts +77 -0
- package/src/native-harness/test/notices.test.ts +64 -0
- package/src/native-harness/test/openrouter-config.test.ts +218 -0
- package/src/native-harness/test/operator-controls.test.ts +132 -0
- package/src/native-harness/test/output.test.ts +44 -0
- package/src/native-harness/test/owner-config.test.ts +64 -0
- package/src/native-harness/test/permissions-e2e.test.ts +68 -0
- package/src/native-harness/test/persistence.test.ts +236 -0
- package/src/native-harness/test/portability.test.ts +337 -0
- package/src/native-harness/test/protocol.test.ts +160 -0
- package/src/native-harness/test/reminder-clock.test.ts +61 -0
- package/src/native-harness/test/reminder-stdio.test.ts +140 -0
- package/src/native-harness/test/reminder-storage.test.ts +124 -0
- package/src/native-harness/test/scenario-jsonl.test.ts +112 -0
- package/src/native-harness/test/scripted.test.ts +92 -0
- package/src/native-harness/test/session-file.test.ts +51 -0
- package/src/native-harness/test/startup-channel-changes.test.ts +256 -0
- package/src/native-harness/test/stdio.test.ts +132 -0
- package/src/native-harness/test/storage-memory.test.ts +4 -0
- package/src/native-harness/test/storage-sqlite.test.ts +420 -0
- package/src/native-harness/test/suspension.test.ts +430 -0
- package/src/native-harness/test/timeline-retrieval.test.ts +211 -0
- package/src/native-harness/test/tools-catalog.test.ts +468 -0
- package/src/native-harness/test/tools-protocol.test.ts +418 -0
- package/src/native-harness/test/transfers.test.ts +94 -0
- package/src/native-harness/test/web-chat.test.ts +35 -0
- package/src/native-harness/tsconfig.json +20 -0
- package/src/observation/agent-event-bus.ts +44 -18
- package/src/observation/index.ts +1 -0
- package/src/operations/contracts.ts +11 -3
- package/src/operations/errors.ts +5 -0
- package/src/operations/stale-policy.ts +1 -1
- package/src/operations/supervisor.ts +34 -10
- package/src/orchestrator/acp-delivery.ts +68 -0
- package/src/orchestrator/assignments.ts +27 -0
- package/src/orchestrator/busy.ts +15 -0
- package/src/orchestrator/config.ts +41 -0
- package/src/orchestrator/consumer-api.ts +24 -0
- package/src/orchestrator/contracts.ts +71 -0
- package/src/orchestrator/durable-assignments.ts +111 -0
- package/src/orchestrator/native-delegation.ts +103 -0
- package/src/orchestrator/orchestrator.ts +318 -0
- package/src/orchestrator/permissions.ts +25 -0
- package/src/orchestrator/policy.ts +44 -0
- package/src/orchestrator/pool.ts +123 -0
- package/src/orchestrator/tool-descriptions.ts +11 -0
- package/src/permissions/acp.ts +18 -0
- package/src/permissions/arrival.ts +13 -0
- package/src/permissions/consumer-config.ts +19 -0
- package/src/permissions/conversation.ts +280 -0
- package/src/permissions/matcher.ts +85 -0
- package/src/permissions/outcome.ts +15 -0
- package/src/permissions/policy.ts +81 -0
- package/src/permissions/request.ts +26 -0
- package/src/persistence/activity-projection.ts +1 -0
- package/src/persistence/backend.ts +34 -1
- package/src/persistence/channels.ts +23 -0
- package/src/persistence/index.ts +4 -0
- package/src/persistence/protocol-method.ts +5 -0
- package/src/persistence/reminder-wake.ts +49 -0
- package/src/persistence/reminders.ts +385 -0
- package/src/persistence/sqlite-backend.ts +84 -6
- package/src/persistence/sqlite-channels.ts +65 -0
- package/src/persistence/sqlite-reminders.ts +85 -0
- package/src/persistence/sqlite-schema.ts +108 -3
- package/src/persistence/sqlite-worker-delivery.ts +374 -0
- package/src/persistence/sqlite-workers.ts +59 -0
- package/src/persistence/worker-delivery-contract.ts +104 -0
- package/src/persistence/worker-terminal-reason.ts +29 -0
- package/src/persistence/workers.ts +19 -0
- package/src/provider-notices.ts +137 -0
- package/src/repl/commands.ts +2 -2
- package/src/steering/combine.ts +3 -1
- package/src/steering/contracts.ts +11 -2
- package/src/steering/controller.ts +3 -2
- package/src/transport/acp-transport.ts +24 -14
- package/src/types.ts +15 -12
- package/src/updates.ts +14 -2
- package/src/wire-log.ts +1 -1
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# Persistence implementation specification
|
|
2
|
+
|
|
3
|
+
Status: design for review. See [PLAN.md](PLAN.md) for implementation stages and
|
|
4
|
+
[LOG.md](LOG.md) for decisions and results.
|
|
5
|
+
|
|
6
|
+
## Goal
|
|
7
|
+
|
|
8
|
+
Deliver one complete persistence slice that can be tested through real process
|
|
9
|
+
restarts. A consumer can run the harness with a SQLite database, use multiple
|
|
10
|
+
channels, suspend execution, close the process, reopen the session and explicitly
|
|
11
|
+
resume accepted work. The timeline, pending inputs and internal notices
|
|
12
|
+
survive. The inspector displays restored shared context immediately.
|
|
13
|
+
|
|
14
|
+
This is the persistence group of work. Context selection, sophisticated memory
|
|
15
|
+
and facts recall, policy enforcement, and consumer-owned coding workers remain
|
|
16
|
+
separate groups. Persistence initially retains the current full-history context
|
|
17
|
+
rendering.
|
|
18
|
+
|
|
19
|
+
## Current foundation
|
|
20
|
+
|
|
21
|
+
The existing harness has an in-memory shared history, sequential execution within
|
|
22
|
+
each channel, concurrency across channels, explicit internal notices, and separate
|
|
23
|
+
context rendering. Development startup and the experimental scripted protocol
|
|
24
|
+
share session execution. In-process and stdio transports already exist.
|
|
25
|
+
|
|
26
|
+
The type-only [storage contract](../../../src/contracts/storage.ts) and
|
|
27
|
+
[decision 0012](../../decisions/0012-session-storage-contract.md) cover initial history
|
|
28
|
+
restoration. They are not implemented or connected to execution. Extend that
|
|
29
|
+
contract for durable inboxes and suspension checkpoints before adapter work.
|
|
30
|
+
Revise the contract to distinguish pending inbox items from taken inputs, and
|
|
31
|
+
to end interrupted turns while keeping their channels usable.
|
|
32
|
+
|
|
33
|
+
## Required architecture
|
|
34
|
+
|
|
35
|
+
Keep three responsibilities separate:
|
|
36
|
+
|
|
37
|
+
| Responsibility | Required behavior |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| Storage | Own durable records, ordering, identity allocation and atomic transitions |
|
|
40
|
+
| Queries | Return timeline entries and execution metadata |
|
|
41
|
+
| Context building | Build the shared history view from timeline entries and render it with current configuration for inference |
|
|
42
|
+
|
|
43
|
+
SQLite belongs behind contracts in `src/state/storage/`. Kernel code coordinates
|
|
44
|
+
through contracts and must not import SQLite or execute SQL. Assembly chooses
|
|
45
|
+
implementations. Maintain an in-memory adapter with matching execution semantics
|
|
46
|
+
and shared conformance checks.
|
|
47
|
+
|
|
48
|
+
Use `bun:sqlite`, one database for one session, and one owning process. Different
|
|
49
|
+
channels retain concurrent asynchronous inference/tool execution. Database
|
|
50
|
+
transactions are short; no transaction remains open across inference or tools.
|
|
51
|
+
PostgreSQL and multi-server scheduling are not requirements for this slice.
|
|
52
|
+
|
|
53
|
+
## Durable information
|
|
54
|
+
|
|
55
|
+
Persist at least:
|
|
56
|
+
|
|
57
|
+
- Session identity, data/schema versions, configuration compatibility metadata
|
|
58
|
+
and lifecycle state.
|
|
59
|
+
- Stable channel and participant IDs for routing and attribution. Derive who has
|
|
60
|
+
spoken in a channel from its timeline entries. Membership and access rules are
|
|
61
|
+
separate configuration.
|
|
62
|
+
- Stable turn identities, original inputs, channel ordering and execution status.
|
|
63
|
+
- A session-wide timeline of user messages, assistant responses, internal
|
|
64
|
+
notices, tool calls and paired tool results. Entries record their sequence,
|
|
65
|
+
timestamp, channel, sender and turn where applicable.
|
|
66
|
+
- Accepted input IDs and payload signatures for restart-safe deduplication.
|
|
67
|
+
- Pending inbox items and notices, source/target attribution, turn links once
|
|
68
|
+
taken, and confirmed inference receipts.
|
|
69
|
+
- Resumable turn checkpoints, including the next execution step and references
|
|
70
|
+
to recorded messages and pending work.
|
|
71
|
+
|
|
72
|
+
Use stable IDs and a global committed sequence; timestamps do not determine
|
|
73
|
+
order. Preserve structured payloads rather than only rendered prompt text.
|
|
74
|
+
Validate serialization and preserve supported opaque provider state unchanged.
|
|
75
|
+
Credentials, functions, connections and process handles are supplied at runtime,
|
|
76
|
+
not serialized as execution state.
|
|
77
|
+
|
|
78
|
+
## Acceptance, recording and ordering
|
|
79
|
+
|
|
80
|
+
The harness delivers every accepted message as soon as the channel can use it.
|
|
81
|
+
When a turn is active and accepting input, it takes pending items at its next
|
|
82
|
+
inference boundary, after the current inference and its requested tools finish.
|
|
83
|
+
This is steering. If the channel is idle or the turn has closed admission, the
|
|
84
|
+
input starts a new turn when the channel can run it. The send API has one
|
|
85
|
+
delivery behavior. Internal notices use the same delivery rule and retain their
|
|
86
|
+
source-channel attribution.
|
|
87
|
+
|
|
88
|
+
Acceptance first commits the item to the durable inbox with its stable ID,
|
|
89
|
+
payload signature, channel and sender. The same ID and payload return the
|
|
90
|
+
original acceptance, including across restart and while suspended. The same ID
|
|
91
|
+
with a different payload returns a conflict. New external inputs are subject to
|
|
92
|
+
the session's admission state.
|
|
93
|
+
|
|
94
|
+
Taking input removes it from the pending inbox, adds it to the timeline and
|
|
95
|
+
links it to its turn in one transaction. Retain its ID for deduplication. Take
|
|
96
|
+
pending items in acceptance order within the channel. The inspector can show
|
|
97
|
+
pending input from the inbox. Input becomes eligible for model context at take.
|
|
98
|
+
The finish decision and the pending input check are atomic with respect to
|
|
99
|
+
acceptance. A concurrent send either keeps the current turn open or starts a
|
|
100
|
+
later one, with each input taken once.
|
|
101
|
+
|
|
102
|
+
Record assistant responses and tool requests before execution. Record each tool
|
|
103
|
+
result with its call identity afterward. Publish corresponding completed-message
|
|
104
|
+
and result events only after recording succeeds. Lifecycle events similarly
|
|
105
|
+
follow their durable transitions. Do not claim that persistence guarantees client
|
|
106
|
+
receipt or provides durable output replay.
|
|
107
|
+
|
|
108
|
+
Maintain sequential execution per channel and concurrency across channels.
|
|
109
|
+
Timeline queries must preserve attribution and active-turn tool pairing. The
|
|
110
|
+
builder reads fresh committed information before every inference, without
|
|
111
|
+
changing a request already in flight.
|
|
112
|
+
|
|
113
|
+
### Message milestones
|
|
114
|
+
|
|
115
|
+
| Milestone | Evidence |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| Sent | The client submitted the message and is awaiting acknowledgment. |
|
|
118
|
+
| Received | The harness committed the message to the durable inbox and can acknowledge acceptance. |
|
|
119
|
+
| Taken | The harness committed the message to the timeline and linked it to the turn that took it. |
|
|
120
|
+
| Delivered | The provider confirmed that its inference engine accepted a request containing the message. |
|
|
121
|
+
| Seen | The harness received model output from that request. The exact evidence depends on the adapter. |
|
|
122
|
+
|
|
123
|
+
Delivered and Seen refer to a request in the target turn that took the message.
|
|
124
|
+
Inclusion in another channel's shared history does not advance these receipts.
|
|
125
|
+
Record receipts only when supported by provider evidence. A valid model
|
|
126
|
+
response can confirm both at once with the current non-streaming adapter.
|
|
127
|
+
An outbound request, transport headers alone, or a rejected call does not
|
|
128
|
+
establish a model receipt. Commit confirmed receipts before publishing them.
|
|
129
|
+
|
|
130
|
+
Failure is reported with a reason and preserves the last confirmed milestone.
|
|
131
|
+
A missing acknowledgment leaves acceptance unknown to the client. Retrying
|
|
132
|
+
the same ID resolves whether the harness received the input. An interrupted
|
|
133
|
+
turn retains its taken items and any confirmed receipts.
|
|
134
|
+
|
|
135
|
+
Working describes turn activity. Several messages may link to the same working
|
|
136
|
+
turn. A client may show Sent, Received and Seen as separate ticks, fold Delivered
|
|
137
|
+
into Seen, and show the Taken turn link in message details.
|
|
138
|
+
|
|
139
|
+
## Lifecycle and suspension
|
|
140
|
+
|
|
141
|
+
Expose session lifecycle `running → suspending → suspended`. Explicit resume
|
|
142
|
+
returns a compatible suspended session to running. Opening a session and resuming
|
|
143
|
+
execution are separate actions. A suspended session may remain open for inspection.
|
|
144
|
+
|
|
145
|
+
When suspension begins:
|
|
146
|
+
|
|
147
|
+
1. Reject new external work with an explicit lifecycle error. Preserve accepted
|
|
148
|
+
inputs that have yet to be taken. Stop starting turns and new iterations.
|
|
149
|
+
2. Let in-flight inference finish. Record its response, execute its requested
|
|
150
|
+
tools and record their results. If tools are already running, finish that
|
|
151
|
+
iteration's remaining calls.
|
|
152
|
+
3. Continue durably accepting valid internal notices from finishing work, but
|
|
153
|
+
do not start additional execution to deliver them while suspending.
|
|
154
|
+
4. At the iteration boundary, complete naturally finished turns or save a
|
|
155
|
+
suspended checkpoint when another inference is required.
|
|
156
|
+
5. Commit session suspended only after every active turn has settled and all
|
|
157
|
+
accepted work/checkpoints are durable; then report suspension complete.
|
|
158
|
+
|
|
159
|
+
A tool-free response with no pending input completes normally. Pending inputs
|
|
160
|
+
remain durable without forcing an extra inference during suspension. Repeated suspend requests
|
|
161
|
+
observe the same transition; suspension of an already suspended session is
|
|
162
|
+
harmless. Notice admission and final checkpoint transitions must leave no gap
|
|
163
|
+
where acknowledged work can disappear.
|
|
164
|
+
|
|
165
|
+
Closing releases resources and ownership; it does not itself suspend execution.
|
|
166
|
+
Stop, including stdin EOF, closes admission and requests cancellation of active
|
|
167
|
+
inference and tools immediately. It starts no further work and does not wait
|
|
168
|
+
for the current iteration or drain the inbox. Record active turns as interrupted
|
|
169
|
+
and leave untaken inputs pending. Fence off late results so stopped work cannot
|
|
170
|
+
advance execution. A tool already in flight may have an uncertain outcome.
|
|
171
|
+
The host waits for successful suspension before a clean update or relocation.
|
|
172
|
+
Resume reconstructs model and tool services, continues suspended turns on
|
|
173
|
+
their original channels, and delivers pending input under the usual steering
|
|
174
|
+
rule. Other channels can resume independently.
|
|
175
|
+
|
|
176
|
+
## Crash recovery and compatibility
|
|
177
|
+
|
|
178
|
+
An unexpected exit is distinct from successful suspension. A tool can have an
|
|
179
|
+
external effect before its result commits. End active turns as interrupted and
|
|
180
|
+
keep the channel usable. Inputs already taken stay attached to that turn. Untaken
|
|
181
|
+
inputs remain pending and become eligible for delivery on normal reopen. Preserve
|
|
182
|
+
committed tool results and report uncertain outcomes in the turn record and
|
|
183
|
+
subsequent context. The scheduler never automatically repeats a call from an
|
|
184
|
+
interrupted turn. An external effect and its recorded result cannot generally
|
|
185
|
+
commit together.
|
|
186
|
+
|
|
187
|
+
Clean suspension preserves pending input and checkpoints for explicit resume.
|
|
188
|
+
If the process exits before the session commits clean suspension, end unfinished
|
|
189
|
+
turns as interrupted, including turns that individually checkpointed during that
|
|
190
|
+
attempt. Preserve their committed records. Any still-untaken items remain eligible
|
|
191
|
+
on normal reopen.
|
|
192
|
+
|
|
193
|
+
Use explicit create/open and exclusive ownership. Check storage format and schema
|
|
194
|
+
readability before recovery writes. A second owner or unsupported format fails
|
|
195
|
+
clearly. Check execution compatibility before starting work. A readable session
|
|
196
|
+
can be opened for inspection and exported even if its supplied services cannot
|
|
197
|
+
continue a checkpoint. Pending inputs that have never started a turn use the
|
|
198
|
+
configuration in effect when they run. Continuing a suspended turn requires
|
|
199
|
+
compatible model, provider state and tool implementations. Report incompatibility
|
|
200
|
+
without consuming pending input or advancing a checkpoint.
|
|
201
|
+
|
|
202
|
+
A host may force termination after a shutdown deadline, but expiry is interruption,
|
|
203
|
+
not successful suspension. Suspension itself may wait for a long-running tool.
|
|
204
|
+
|
|
205
|
+
## Export and import
|
|
206
|
+
|
|
207
|
+
The [session-file amendment](../persistence/0002-AMENDMENT-session-file/SPEC.md)
|
|
208
|
+
tracks the proposed binary encoding separately from the accepted baseline.
|
|
209
|
+
|
|
210
|
+
Export a single versioned `.harness` archive containing a manifest and a logical
|
|
211
|
+
session snapshot. Export is available when the session is idle with no active
|
|
212
|
+
or pending work, or when it is cleanly suspended. Export leaves the lifecycle
|
|
213
|
+
unchanged. Take one consistent snapshot so a concurrent send cannot leave an
|
|
214
|
+
export with only part of an accepted input.
|
|
215
|
+
|
|
216
|
+
Include session metadata, portable configuration and compatibility metadata,
|
|
217
|
+
channels and participants, timeline entries, turn outcomes, pending inbox items,
|
|
218
|
+
deduplication records, clean checkpoints and ID allocation state. The destination
|
|
219
|
+
supplies credentials, tool implementations and environment-specific resources.
|
|
220
|
+
The bundle format is versioned independently from SQLite's internal schema.
|
|
221
|
+
|
|
222
|
+
Validate the full archive and publish the imported session atomically into a
|
|
223
|
+
fresh destination. Permit a new session ID while preserving IDs within the
|
|
224
|
+
session. Reject an existing destination. An imported suspended session requires
|
|
225
|
+
explicit resume. Import creates a copy. For relocation, stop the source before
|
|
226
|
+
resuming the destination so the same pending work cannot run in both copies.
|
|
227
|
+
|
|
228
|
+
Support a file path when the caller and harness share a filesystem, and bounded
|
|
229
|
+
file transfer over stdio for callers that do not. A session archive can exceed
|
|
230
|
+
the size of a single protocol frame. The contract should specify transfer limits
|
|
231
|
+
and cleanup for interrupted transfers.
|
|
232
|
+
|
|
233
|
+
## Consumer and development interfaces
|
|
234
|
+
|
|
235
|
+
Provide public session lifecycle/storage APIs and typed client/protocol operations
|
|
236
|
+
for create/load, status, suspend, resume, export and import. Specify concrete
|
|
237
|
+
operation names and errors in the contract decision. Preserve transport-independent execution.
|
|
238
|
+
Status must distinguish idle, suspended and unresolved interrupted work.
|
|
239
|
+
|
|
240
|
+
Load returns a consistent view of lifecycle, channels, turn outcomes, taken and
|
|
241
|
+
pending input IDs with confirmed receipts, and committed assistant messages with stable IDs. Use a
|
|
242
|
+
storage revision to identify the snapshot. On the same connection, deliver the
|
|
243
|
+
load response before publishing live events for recovered work. If paged, keep
|
|
244
|
+
load results anchored to that revision. Configure execution before making pending
|
|
245
|
+
input eligible. Callers decide how to reconcile their own records.
|
|
246
|
+
|
|
247
|
+
Provide development startup controls for database selection, create/open and
|
|
248
|
+
resume. Restore live context in the inspector without requiring a new message,
|
|
249
|
+
and display lifecycle/channel status. Do not make read-only inspection resume work.
|
|
250
|
+
|
|
251
|
+
The development assembly with real inference and the scripted stdio server must
|
|
252
|
+
use the same persistence implementation. Offline checks require no provider key.
|
|
253
|
+
Update protocol capability descriptions to reflect only implemented guarantees.
|
|
254
|
+
|
|
255
|
+
## Acceptance criteria
|
|
256
|
+
|
|
257
|
+
Use scripted models, controlled tools and real child-process restarts to verify:
|
|
258
|
+
|
|
259
|
+
1. Two completed channels survive restart; live context is restored immediately,
|
|
260
|
+
subsequent captured inference includes both conversations, and IDs do not collide.
|
|
261
|
+
2. Identical accepted-input retries create no duplicate work after restart;
|
|
262
|
+
conflicting payloads return a stable conflict error.
|
|
263
|
+
3. Pending messages and notices survive suspension and reopening. A message
|
|
264
|
+
arriving at turn completion reaches exactly one turn, including when it
|
|
265
|
+
arrives during inference or tool execution.
|
|
266
|
+
4. Suspension during inference/tools finishes the iteration and resumes at the
|
|
267
|
+
next inference without repeating completed calls. Per-channel ordering holds.
|
|
268
|
+
5. A notice accepted as another channel checkpoints remains deliverable after
|
|
269
|
+
resume without starting extra inference during suspension.
|
|
270
|
+
6. A naturally completed turn stays completed through suspension and reopening.
|
|
271
|
+
7. Exit before input take leaves it pending. Exit after input take leaves it
|
|
272
|
+
attached to an interrupted turn. Exit after a tool request or external effect
|
|
273
|
+
with no committed result reports uncertainty without tool replay. The same
|
|
274
|
+
channel accepts fresh input after reopening.
|
|
275
|
+
8. Concurrent ownership, incompatible format/configuration, serialization failures
|
|
276
|
+
and illegal transitions fail clearly without partial domain writes.
|
|
277
|
+
9. Typed client operations work through in-process and stdio transports; existing
|
|
278
|
+
execution scenarios continue to pass.
|
|
279
|
+
10. Load recovers a committed assistant message missed by the client and delivers
|
|
280
|
+
its snapshot boundary before live events for recovered work.
|
|
281
|
+
11. Export and import preserve a cleanly suspended session, including pending
|
|
282
|
+
input and deduplication. A bundle larger than one stdio frame transfers
|
|
283
|
+
successfully. Invalid bundles and existing destinations leave no partial import.
|
|
284
|
+
12. Inspect and export a readable session with an incompatible checkpoint. Resume
|
|
285
|
+
fails clearly and preserves the checkpoint and pending inputs.
|
|
286
|
+
13. A received message stays outside the timeline until take. A provider
|
|
287
|
+
rejection or an inference on another channel never advances Delivered or
|
|
288
|
+
Seen. Confirmed receipts remain visible after reopening.
|
|
289
|
+
14. Stop during a controlled tool call requests cancellation without waiting for
|
|
290
|
+
the iteration, preserves pending input, and reports the active turn as
|
|
291
|
+
interrupted. A late tool result cannot restart execution.
|
|
292
|
+
|
|
293
|
+
### End-to-end scenarios
|
|
294
|
+
|
|
295
|
+
**Clean relocation.** Use the public client with a scripted child process. Start
|
|
296
|
+
two channels. While a controlled tool is running, accept a message or notice and
|
|
297
|
+
request suspension. Finish the iteration, export the suspended session, and
|
|
298
|
+
close the source. Import into a fresh home and load. Verify the timeline, turn
|
|
299
|
+
IDs and pending input before resuming. After explicit resume, the input reaches
|
|
300
|
+
exactly one turn and the completed tool call runs only once across both processes.
|
|
301
|
+
|
|
302
|
+
**Crash recovery.** Kill the process on each side of the durable input-take
|
|
303
|
+
boundary. On reopen, verify the input is pending or attached to exactly one
|
|
304
|
+
interrupted turn as appropriate. Exercise a tool effect with no committed result
|
|
305
|
+
and a committed assistant reply the client missed. Verify load reports both,
|
|
306
|
+
the affected channel accepts a fresh message, and the prior tool call is never
|
|
307
|
+
replayed automatically.
|
|
308
|
+
|
|
309
|
+
Complete a manual development test with multiple channels and the inspector:
|
|
310
|
+
start work, exchange a notice, suspend, close, reopen and resume. Record what was
|
|
311
|
+
verified and any remaining limitations. Historical inspector request snapshots,
|
|
312
|
+
durable output replay, advanced recall/compaction, and automatic reconciliation of
|
|
313
|
+
uncertain external effects are outside this scope.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Channel controls log
|
|
2
|
+
|
|
3
|
+
Branch `aiagent/native-channel-controls`. Base: persistence closure `3a236ac`
|
|
4
|
+
(approved behavior `9d9de35`). Spec and plan cherry-picked from `326ab17` as
|
|
5
|
+
`640ece1`. Implementer: this branch; reviewer: gro1a-o; coordinator: haurness-l.
|
|
6
|
+
|
|
7
|
+
## Stage 1: contract and decision
|
|
8
|
+
|
|
9
|
+
Decision `0014-channel-controls-contract.md`; type-only edits to
|
|
10
|
+
`src/contracts/{storage,agent,session,events,protocol}.ts`. No implementation.
|
|
11
|
+
|
|
12
|
+
Gate: the contracts compile alone (`tsc --strict` over `src/contracts/*.ts`).
|
|
13
|
+
`bun run typecheck` for the whole package fails only in the files that implement
|
|
14
|
+
or consume the changed contracts, as AGENTS.md expects of a contract-first
|
|
15
|
+
change: `state/storage/{engine,archive}.ts`, `kernel/channels.ts`, `index.ts`,
|
|
16
|
+
`interfaces/protocol/load.ts`, and tests that read event fields or build
|
|
17
|
+
`StoredChannel`. Stages 2 to 4 clear them; each stage gate returns to a green
|
|
18
|
+
typecheck.
|
|
19
|
+
|
|
20
|
+
### Contract-level traces (storage transactions are totally ordered)
|
|
21
|
+
|
|
22
|
+
| Race | Commit order A first | Commit order B first |
|
|
23
|
+
| --- | --- | --- |
|
|
24
|
+
| Suspend vs take | `takePending` first: items join the running turn; `beginChannelSuspend` then sets `suspending`; the turn checkpoints with them. | `beginChannelSuspend` first: `takePending`/`beginTurn` fail `channel_suspended`, items stay pending; the turn checkpoints or completes (completion refused while pending, so it checkpoints). |
|
|
25
|
+
| Interrupt vs result commit | `appendMessage` first: result recorded, then interrupt ends the turn; only calls still unanswered are uncertain. | `interruptTurn` first: turn interrupted, `appendMessage`/`confirmReceipts` refused `invalid_state`; the call is uncertain and never replayed. |
|
|
26
|
+
| Interrupt vs checkpoint (channel `suspending`) | `checkpointTurn` first: channel `suspended` with checkpoint; interrupt returns `interrupted: false`, checkpoint intact. | `interruptTurn` first: turn interrupted, channel `suspended` without checkpoint, pending kept; `checkpointTurn` fails `invalid_state`. |
|
|
27
|
+
| Withdraw vs take | `withdrawItem` first: `withdrawn`, never taken, a retry via `acceptItem` returns it withdrawn. | take first: `withdrawItem` returns `taken` with turn ID, item stays on the timeline. |
|
|
28
|
+
| Delete vs send | `acceptItem` first: item pending, `deleteChannel` fails `channel_busy`. | `deleteChannel` first: `retired`; `acceptItem` fails `channel_retired`. |
|
|
29
|
+
| Session resume around a suspended channel | `resume()` skips turns of `suspended` channels and does not check their key. Channel stays suspended, checkpoint intact. | `resumeChannel` while session suspended: clears channel suspension only; checkpoint stays under the session suspension; the later `resume()` continues it. |
|
|
30
|
+
|
|
31
|
+
Other compositions: a crash before channel suspension commits leaves `suspending`
|
|
32
|
+
(returned to `open` on open) with the running turn interrupted and pending
|
|
33
|
+
items kept; a crash during session suspension interrupts checkpoints of non-
|
|
34
|
+
`suspended` channels only, so an earlier committed channel checkpoint survives;
|
|
35
|
+
checkpoint survival is derived (session `suspended` or channel `suspended`), so
|
|
36
|
+
no owner marker has to be kept consistent.
|
|
37
|
+
|
|
38
|
+
### Compatibility (written before implementation)
|
|
39
|
+
|
|
40
|
+
Format 2 databases open and are upgraded in the recovery transaction; archive
|
|
41
|
+
version 1 imports; existing channels are `open` with no individual suspension;
|
|
42
|
+
session-wide suspension and its checkpoints resume as before. See decision 0014.
|
|
43
|
+
|
|
44
|
+
### Stage 1 review round 1 (gro1a-o, `1f90c97` not approved)
|
|
45
|
+
|
|
46
|
+
Fixed in the next commit: withdraw covers notices; snapshot items include withdrawn
|
|
47
|
+
items; retired channels' turns are rejected on import and never resumed
|
|
48
|
+
(`resume()`, `resumeChannel`); wire export and stop comments match storage; omitted
|
|
49
|
+
interrupt reason is `"interrupted by request"`. The red full typecheck is accepted
|
|
50
|
+
until Stage 4's gate.
|
|
51
|
+
|
|
52
|
+
## Stage 2: storage and recovery
|
|
53
|
+
|
|
54
|
+
Both adapters (memory, SQLite) implement revision 3 through the shared engine
|
|
55
|
+
(`engine.ts`, `archive.ts`); SQLite adds format 3 tables and the in-place format 2
|
|
56
|
+
upgrade, which runs inside the recovery transaction (statements are prepared
|
|
57
|
+
lazily so a format 2 file can be read before the upgrade).
|
|
58
|
+
|
|
59
|
+
Choices the contract left open, all inside what 0014 and the review accepted:
|
|
60
|
+
- `beginTurn` on an unknown channel is now `not_found` (the contract text); it was
|
|
61
|
+
`null`. One existing conformance expectation changed for that.
|
|
62
|
+
- Channel `participantIds` view and `StoredChannel` carry `displayName` only when set.
|
|
63
|
+
- Create stores the trimmed name. Interrupt and withdraw take their channel ID and
|
|
64
|
+
answer `not_found` for a mismatch.
|
|
65
|
+
- `engine.ts` is 501 lines: every rule of the contract lives there by design (one
|
|
66
|
+
engine for both backends); splitting it is deferred to avoid churn mid-review.
|
|
67
|
+
|
|
68
|
+
Gate: `bun run typecheck` has errors only in `index.ts`, `kernel/channels.ts`,
|
|
69
|
+
`interfaces/protocol/load.ts`, `test/agent.test.ts` (Stage 3 and 4 own them).
|
|
70
|
+
`bun test ./test`: 164 pass, 0 fail (134 before; 30 new storage cases).
|
|
71
|
+
New conformance (memory and SQLite, SQLite reopens the real file): suspension and
|
|
72
|
+
admission, checkpoint survival, idle suspend, interrupt vs checkpoint/finish/late
|
|
73
|
+
results, stale interrupt, withdraw (message, notice, take-first, retry, reopen),
|
|
74
|
+
create/edit/delete/retired IDs, session resume skipping a suspended channel
|
|
75
|
+
(including an incompatible key), channel resume during session suspension, stop
|
|
76
|
+
and crash recovery, interrupted channel suspend, export rules, archive round trip
|
|
77
|
+
of the new records, archive v1 import, invalid archives. SQLite only: format 2
|
|
78
|
+
fixture built from the verbatim old schema (suspended and unclean), failed
|
|
79
|
+
upgrade leaves the file byte-identical, retired channel holding a checkpoint is
|
|
80
|
+
left by `resume()`.
|
|
81
|
+
|
|
82
|
+
## Stage 3: scheduler
|
|
83
|
+
|
|
84
|
+
`kernel/channels.ts` gains `ChannelControls` (create, edit, suspend, resume,
|
|
85
|
+
delete, withdraw, interrupt) and `index.ts` exposes it as `session.channels`.
|
|
86
|
+
Storage still decides every race; the scheduler only reacts to commits.
|
|
87
|
+
- A channel suspension is a pending promise per channel, settled by the commit that
|
|
88
|
+
checkpoints, completes, fails or interrupts its turn (`settleChannel`), which is
|
|
89
|
+
also when `channel_state` is published. `checkpoint()` now stops a turn at its
|
|
90
|
+
boundary for either suspension.
|
|
91
|
+
- Interrupt commits first, then aborts the turn's signal and frees its slot, so the
|
|
92
|
+
channel's pending input can start the next turn while the old tool is still
|
|
93
|
+
running; the old turn's late result is refused by storage (`invalid_state`) and
|
|
94
|
+
unwinds. A stale interrupt is a storage no-op.
|
|
95
|
+
- Session `resume()` re-reads the pending set from open channels only; an
|
|
96
|
+
individually suspended channel keeps its checkpoint and backlog and does not keep
|
|
97
|
+
the session from reporting idle. `resumeChannel` starts a returned checkpoint
|
|
98
|
+
turn even before `start()` (storage already marked it running).
|
|
99
|
+
- `stop` returns an uncommitted channel suspension to `open` and answers its caller
|
|
100
|
+
`stopped`.
|
|
101
|
+
- Status adds `lifecycle`, `displayName`, `waitingForResume`; a backlog on a
|
|
102
|
+
suspended channel does not make `execution` `working`.
|
|
103
|
+
|
|
104
|
+
Gate: `test/channel-controls.test.ts` (8 tests, 8 clean repeats): Alice suspends
|
|
105
|
+
with Bob running, rejects input and notices, survives a reopen and takes her
|
|
106
|
+
backlog once with the recorded tool not rerun; interrupt with a late-returning
|
|
107
|
+
tool and stale retries; interrupt vs checkpoint on both sides during suspension;
|
|
108
|
+
session suspend/resume around a suspended channel and channel resume during
|
|
109
|
+
session suspension; withdraw vs take; create/edit/suspend/delete and retired IDs
|
|
110
|
+
across reopen; stop during channel suspension. `bun test ./test`: 172 pass, 0
|
|
111
|
+
fail. Typecheck errors remain only in `interfaces/protocol/load.ts`,
|
|
112
|
+
`test/agent.test.ts`, `test/e2e.test.ts` (Stage 4).
|
|
113
|
+
|
|
114
|
+
### Stage 3 review (gro1a-o, `9cc6892`, not approved)
|
|
115
|
+
|
|
116
|
+
Gro found that resuming a checkpoint before `start()` incorrectly set the global
|
|
117
|
+
started flag, enabling other channels and preventing `start()` from pumping their
|
|
118
|
+
backlog. The follow-up keeps the resumed turn's executor without setting that
|
|
119
|
+
flag. A reopen regression checks existing and newly accepted inputs remain
|
|
120
|
+
untaken until `start()`, then run exactly once. Implementer handoff: cod1a-m on
|
|
121
|
+
branch `aiagent/cod1a-native-channel-controls`, based on `9cc6892`.
|
|
122
|
+
|
|
123
|
+
Gro approved Stage 3 at `b7894f0`: independent full suite 173 pass, 0 fail;
|
|
124
|
+
the three Stage 4 type errors remained as agreed.
|
|
125
|
+
|
|
126
|
+
## Stage 4: protocol and client
|
|
127
|
+
|
|
128
|
+
The typed client and both transports expose all seven controls and channel
|
|
129
|
+
state. The stdio decoder accepts the two new turn-less event types. The server
|
|
130
|
+
validates requests and translates storage outcomes and IDs; lifecycle decisions
|
|
131
|
+
remain in the scheduler and storage. README and architecture describe the API.
|
|
132
|
+
The shared storage conformance and scheduler tests cover transaction order,
|
|
133
|
+
compatibility and session composition. Public-client tests exercise controls,
|
|
134
|
+
durable reopen, interruption, another channel continuing, and individual
|
|
135
|
+
suspension crash recovery through SQLite stdio as well as in-process parity.
|
|
136
|
+
The scripted public server does not provide a notice tool or a deliberately
|
|
137
|
+
late-returning tool: those cases are covered by the scheduler's controlled rig.
|
|
138
|
+
Existing fault hooks and storage conformance exercise commit boundaries; the
|
|
139
|
+
public tests do not add separate process barriers for every ordering.
|
|
140
|
+
|
|
141
|
+
Gate submitted for independent review: `bun run typecheck` passes; `bun test
|
|
142
|
+
./test` passes 178 tests, 0 failures, 2569 assertions (22 files, 48.50s), with
|
|
143
|
+
local IPC access for child processes.
|
|
144
|
+
|
|
145
|
+
### Closure
|
|
146
|
+
|
|
147
|
+
Gro approved Stage 4 at `4d58629` without findings. Their independent gate:
|
|
148
|
+
`bun run typecheck` passed; `bun test ./test` passed 178 tests, 0 failures,
|
|
149
|
+
2569 assertions across 22 files (48.70s). They accepted the coverage split
|
|
150
|
+
above: scheduler tests exercise notice rejection and abort-ignoring late
|
|
151
|
+
results, and storage and scheduler tests exercise the race orderings, session
|
|
152
|
+
composition, and persistence compatibility. The accepted implementation is
|
|
153
|
+
`4d58629`; this closure note follows it without another implementation review.
|
|
154
|
+
|
|
155
|
+
Retrospective: contract-first staging and explicit independent gates isolated
|
|
156
|
+
storage, scheduler, and transport behavior. Review caught an early-resume
|
|
157
|
+
scheduling regression before client work began. The stdio event decoder also
|
|
158
|
+
needed updating for turn-less events; transport-parity tests exposed it. Future
|
|
159
|
+
work should plan public test tools and process barriers alongside the acceptance
|
|
160
|
+
scenarios so coverage differences are visible earlier.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Channel controls implementation plan
|
|
2
|
+
|
|
3
|
+
Status: proposed for review.
|
|
4
|
+
|
|
5
|
+
## Scope and module map
|
|
6
|
+
|
|
7
|
+
Implement [SPEC.md](SPEC.md) on a base containing the accepted persistence
|
|
8
|
+
revision `9d9de35`. The persistence branch includes the closure notes at
|
|
9
|
+
`3a236ac`. Record the actual base and implementation branch when assigning the
|
|
10
|
+
work.
|
|
11
|
+
|
|
12
|
+
Preserve durable send acknowledgment, a single message delivery behavior, and
|
|
13
|
+
concurrent execution across channels. Add channel create, suspend, resume, edit,
|
|
14
|
+
and delete, plus withdrawal of untaken input and interruption of a named turn.
|
|
15
|
+
|
|
16
|
+
| Area | Existing code | Responsibility |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| Contracts | `src/contracts/{agent,session,storage,events,protocol}.ts` | Define channel state, command results, status, and event correlation. Record the decision before changing implementations. |
|
|
19
|
+
| Durable transitions | `src/state/storage/{engine,memory,sqlite}.ts` | Keep shared transition rules in the storage engine. Persist channel state, withdrawn receipts and retired IDs. Make admission and state changes atomic. |
|
|
20
|
+
| Restart and portability | `src/state/storage/{engine,sqlite,archive}.ts` | Preserve individual suspension and checkpoints through restart and export/import. Define how an existing persistence database or archive opens after the change. |
|
|
21
|
+
| Scheduling | `src/kernel/{channels,loop}.ts` | Reuse iteration boundaries and cancellation. Combine session and channel lifecycle checks before starting or taking work. Fence late results by turn ID. |
|
|
22
|
+
| Assembly and API | `src/index.ts`, `src/client.ts`, `src/interfaces/{client.ts,protocol/}` | Wire the commands and expose outcomes and state through the typed client, in-process and over stdio. Keep lifecycle rules in the kernel and storage. |
|
|
23
|
+
| Verification | `src/testing.ts`, `test/conformance/storage.ts`, and existing protocol, crash, suspension, and end-to-end tests | Use controlled model and tool barriers to exercise exact commit boundaries and verify the public API with real child processes. |
|
|
24
|
+
|
|
25
|
+
The accepted persistence engine currently treats suspended turns as belonging
|
|
26
|
+
to a session-wide suspension. Channel suspension needs its own durable state.
|
|
27
|
+
Recovery and session resume must distinguish a committed individual checkpoint
|
|
28
|
+
from one created during an incomplete session suspension. Reuse the existing
|
|
29
|
+
storage and scheduler modules for this distinction.
|
|
30
|
+
|
|
31
|
+
## Implementation stages and acceptance gates
|
|
32
|
+
|
|
33
|
+
| Stage | Work and dependencies | Acceptance gate |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| **1. Contracts** | Define effective admission and execution from both lifecycle states. Specify command outcomes, duplicate and stale requests, create versus first-send behavior for unknown IDs, and the result of overlapping channel and session lifecycle operations. Record database and archive compatibility and land contract changes ahead of implementation, following the repository rules. | Typecheck. The reviewer can trace suspend versus take, interrupt versus result commit, withdraw versus take, delete versus send, and session resume around an individually suspended channel. |
|
|
36
|
+
| **2. Storage and recovery** | Extend the shared engine and both adapters for channel state, withdrawal, targeted interruption and retirement. Update snapshot and archive records where needed. | Both adapters pass the same transition conformance tests. Real SQLite reopen preserves a committed suspension, a withdrawn receipt and a retired ID. An interrupted suspend recovers the work described by the spec. Test the agreed compatibility behavior against persistence fixtures and round-trip the new records through an archive. |
|
|
37
|
+
| **3. Scheduler** | Apply the effective gates to admission, take and scheduling. Finish an iteration for suspend, and request immediate cancellation for interrupt. Coordinate with session suspend, resume and stop. | Deterministic two-channel tests show Bob continues while Alice suspends or is interrupted. Alice's pending input is taken once after resume. A late tool result or stale interrupt cannot affect the next turn. Session resume preserves Alice's individual suspension. |
|
|
38
|
+
| **4. Client and end-to-end verification** | Expose commands and state through the typed client. Add real stdio process scenarios and update architecture and usage docs. | Run all acceptance cases in the spec through the appropriate storage, scheduler and public-interface tests. Run typecheck and the full harness suite. Independently review the final revision and record the results. |
|
|
39
|
+
|
|
40
|
+
### End-to-end gate
|
|
41
|
+
|
|
42
|
+
Run two channels through the public client against a scripted stdio child
|
|
43
|
+
with SQLite. While Alice is in a controlled tool, accept another input and
|
|
44
|
+
request her channel suspension. Verify new sends and notices are rejected for
|
|
45
|
+
Alice while Bob completes a turn. Let Alice reach her checkpoint, restart the
|
|
46
|
+
harness, and check that she stays suspended. Resume her channel and verify
|
|
47
|
+
the pending item is taken once and the completed tool is not repeated.
|
|
48
|
+
|
|
49
|
+
Run interruption separately against a tool that returns late. Verify the
|
|
50
|
+
interrupted turn cannot continue and a stale interrupt cannot affect the next
|
|
51
|
+
turn. Use explicit barriers around input take, tool-result commit, and checkpoint
|
|
52
|
+
commit for the withdrawal, deletion, and crash cases in the spec.
|
|
53
|
+
|
|
54
|
+
## How we work
|
|
55
|
+
|
|
56
|
+
### Shared rules
|
|
57
|
+
|
|
58
|
+
- Follow [AGENTS.md](../../../AGENTS.md) and [ARCHITECTURE.md](../../../ARCHITECTURE.md).
|
|
59
|
+
Keep the kernel dependent on contracts and SQLite inside storage.
|
|
60
|
+
- Use one implementation branch. Record its base, stage revisions, test
|
|
61
|
+
commands, results, and disputed decisions in `LOG.md` once work starts.
|
|
62
|
+
- Use scripted models for automated checks. Identify the exact revision in
|
|
63
|
+
each review handoff.
|
|
64
|
+
|
|
65
|
+
### Coordinator
|
|
66
|
+
|
|
67
|
+
Assign one implementer and one independent reviewer once the scope is approved.
|
|
68
|
+
Confirm the persistence base and resolve questions that change behavior or
|
|
69
|
+
contracts. Check final acceptance against the spec.
|
|
70
|
+
|
|
71
|
+
### Implementer
|
|
72
|
+
|
|
73
|
+
Own branch edits. For each stage, run its gate and send the reviewer the exact
|
|
74
|
+
revision and evidence. Address findings directly and send the new revision
|
|
75
|
+
back for review.
|
|
76
|
+
|
|
77
|
+
### Reviewer
|
|
78
|
+
|
|
79
|
+
Review each revision independently and send findings directly to the implementer.
|
|
80
|
+
Check storage atomicity, independence of channel and session suspension, and
|
|
81
|
+
turn cancellation when tool results arrive late. Approve each gate explicitly
|
|
82
|
+
after fixes. Bring scope changes or disputed blockers to the coordinator.
|
|
83
|
+
An approved stage can proceed to the next one.
|
|
84
|
+
|
|
85
|
+
## Closure
|
|
86
|
+
|
|
87
|
+
Record the accepted revision, independent review outcome, gate results, and
|
|
88
|
+
remaining limitations in `LOG.md`. Include a short retrospective on what
|
|
89
|
+
helped, where work stalled or had to be redone, and what to change next time.
|