@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,80 @@
|
|
|
1
|
+
# Native harness accounting
|
|
2
|
+
|
|
3
|
+
Status: draft for review. Amends [model execution](../0001-DESIGN/SPEC.md).
|
|
4
|
+
|
|
5
|
+
R5 compares acp-client's in-turn metering against the model-call records the
|
|
6
|
+
harness already exposes. Billing-grade accounting additionally needs evidence
|
|
7
|
+
that the ledger is complete and that each reported quantity can be interpreted
|
|
8
|
+
and attributed. Native `billing_required` remains refused until the harness
|
|
9
|
+
contract and acp-client certification pass their respective gates.
|
|
10
|
+
|
|
11
|
+
The starting point is the R5 grounding and review on `integration-r456`.
|
|
12
|
+
Pin the final R5 revision at contract review and reconcile any changes to its
|
|
13
|
+
consumer requirements.
|
|
14
|
+
|
|
15
|
+
## Attempt evidence
|
|
16
|
+
|
|
17
|
+
Retain stable logical call and attempt IDs and the terminal outcome of each.
|
|
18
|
+
Record the provider and model identity for the route that actually ran. A
|
|
19
|
+
session-wide identity is sufficient only if it is guaranteed for every
|
|
20
|
+
attempt. Record an extensible purpose for each call.
|
|
21
|
+
|
|
22
|
+
Define input, output, total, and cache categories explicitly, including whether
|
|
23
|
+
cache reads and writes are included in input totals and how consumers can
|
|
24
|
+
price them without double counting. A missing field means unknown. Zero
|
|
25
|
+
requires explicit evidence. Preserve provider-reported cost and its currency
|
|
26
|
+
when supplied, separately from consumer-calculated pricing. Failed, aborted
|
|
27
|
+
and retried attempts can incur usage. Preserve independently known evidence
|
|
28
|
+
even when the aggregate is incomplete.
|
|
29
|
+
|
|
30
|
+
## Sealed turn accounting
|
|
31
|
+
|
|
32
|
+
Expose an additive, versioned accounting capability during initialization.
|
|
33
|
+
The contract decision must define the durable seal, the bounded reads, and
|
|
34
|
+
their ordering with turn finalization and recovery. A terminal turn event
|
|
35
|
+
alone is insufficient evidence of a seal.
|
|
36
|
+
|
|
37
|
+
The seal identifies the exact set of committed logical calls and attempts
|
|
38
|
+
belonging to a channel and turn, including failed and aborted attempts. Use
|
|
39
|
+
an ID manifest or a durable read fence with scoped pagination and equivalent
|
|
40
|
+
coverage evidence. Verify that every page belongs to the same seal and that
|
|
41
|
+
the consumer can detect missing, duplicated or incomplete rows. A sealed turn
|
|
42
|
+
with zero attempts is distinguishable from a turn whose accounting is
|
|
43
|
+
unavailable. A complete ledger can still have unknown usage or price for
|
|
44
|
+
individual attempts.
|
|
45
|
+
|
|
46
|
+
## Between-turn work and strict admission
|
|
47
|
+
|
|
48
|
+
When the harness gains a producer for between-turn model calls, associate
|
|
49
|
+
each call with a channel, a nullable turn ID, and a stable accounting ID.
|
|
50
|
+
Define a bounded pull and idle trigger so the consumer can settle that work
|
|
51
|
+
without another prompt. Keep agent-wide work without a channel separate.
|
|
52
|
+
Support for between-turn accounting requires a producer and an end-to-end
|
|
53
|
+
verification gate.
|
|
54
|
+
|
|
55
|
+
Before enabling strict billing, define how the host confirms the accounting
|
|
56
|
+
capability before open or resume can admit work, including pending input and
|
|
57
|
+
work started by the harness. If accounting becomes unavailable, preserve
|
|
58
|
+
already produced output and known evidence. Refuse further work for the
|
|
59
|
+
affected strict channel until reconciliation. The harness owns the accounting
|
|
60
|
+
evidence and admission controls. acp-client owns pricing, accounting commits,
|
|
61
|
+
and certification of its integration.
|
|
62
|
+
|
|
63
|
+
## Acceptance
|
|
64
|
+
|
|
65
|
+
1. Use scripted per-attempt values as independent ground truth. Verify exact
|
|
66
|
+
IDs, token presence and values, cache category semantics, route identity,
|
|
67
|
+
purpose, and cost/currency where supplied, including retries and failed or
|
|
68
|
+
aborted attempts.
|
|
69
|
+
2. Interleave channels and page one sealed turn. Detect an omitted row or
|
|
70
|
+
torn read. Verify a sealed empty turn and unavailable evidence have
|
|
71
|
+
different outcomes. Reopen after a crash and verify known usage remains
|
|
72
|
+
recoverable without double counting.
|
|
73
|
+
3. Verify incompatible startup, missing evidence, and incomplete or unpriced
|
|
74
|
+
usage in the acp-client integration. Check that strict admission closes on
|
|
75
|
+
the affected channel while preserving results already produced.
|
|
76
|
+
4. When between-turn work is introduced, verify scoped retrieval and durable
|
|
77
|
+
accounting after idle and restart without a subsequent prompt.
|
|
78
|
+
|
|
79
|
+
Record public types, storage and wire guarantees, compatibility, and shared
|
|
80
|
+
conformance requirements in a decision before dependent implementation.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Operator controls work log
|
|
2
|
+
|
|
3
|
+
Branch aiagent/cod1a-operator-controls starts at 3585cf3 with alpha 9d1964d,
|
|
4
|
+
ACP integration 7133c5c and callbacks f4eff94 with closure c1c3e88.
|
|
5
|
+
Gate 1 is contract and decision only. Clad independently reviews each named
|
|
6
|
+
gate before dependent implementation begins.
|
|
7
|
+
|
|
8
|
+
Both package typechecks passed. The proposed method and storage read types
|
|
9
|
+
are separate from the active dispatch map until implementation.
|
|
10
|
+
|
|
11
|
+
Clad requested changes at 89fe68c. The follow-up specifies approval closure
|
|
12
|
+
on the event union, observe response ordering including ephemeral events,
|
|
13
|
+
participant identity and live positions, session lifecycle in observation,
|
|
14
|
+
indexed range bounds, and explicit wire replacement and validation behavior.
|
|
15
|
+
Both package typechecks passed again. Gate 2 awaits independent approval.
|
|
16
|
+
|
|
17
|
+
Clad approved Gate 1 at 6f04767fbdd240f6f685a70ff3fb47d41d839916
|
|
18
|
+
after independently passing both package typechecks.
|
|
19
|
+
|
|
20
|
+
Gate 2 in progress. The first shared adapter conformance case passed on
|
|
21
|
+
memory and SQLite (2 tests, 16 assertions), and harness typecheck passed.
|
|
22
|
+
SQLite uses partial indexes over existing entry columns and JSON expressions
|
|
23
|
+
to preserve the previous revision's positional INSERT. Index installation
|
|
24
|
+
runs in the open transaction. Protocol replacement, live position and
|
|
25
|
+
approval publication, and the remaining tests are still pending.
|
|
26
|
+
|
|
27
|
+
Gate 2 checkpoint. The endpoint now advertises and serves focused open,
|
|
28
|
+
observe, reconcile and history and refuses legacy load and messages. Focused
|
|
29
|
+
wire/storage checks passed on both transports and both adapters (4 tests,
|
|
30
|
+
42 assertions). Both package typechecks passed. The previous broad harness
|
|
31
|
+
run was before the cutover and reported 319 pass and 10 fail. Several
|
|
32
|
+
catalog and event expectation fixes passed in the focused 24-test run.
|
|
33
|
+
|
|
34
|
+
The runtime cutover exposes a gate sequencing dependency. The current native
|
|
35
|
+
host still requires session/load and pages session/messages. Fifteen harness
|
|
36
|
+
test files also call the old methods. The old typed methods are still present
|
|
37
|
+
for those callers. This checkpoint is not submitted as a passing Gate 2.
|
|
38
|
+
|
|
39
|
+
The coordinator approved moving the minimal native host cutover from Gate 3
|
|
40
|
+
into Gate 2 because supported open and recovery depend on the replacement
|
|
41
|
+
wire methods. The host now opens, observes channel state, and reconciles
|
|
42
|
+
tracked IDs without draining history pages. Harness fixtures were migrated
|
|
43
|
+
off the removed wire methods. Host controls, responder routing, attachment
|
|
44
|
+
handling, recovery extraction, and explicit history and catch-up stay in
|
|
45
|
+
Gate 3.
|
|
46
|
+
|
|
47
|
+
The guarded open test prohibits full snapshots during startup channel changes,
|
|
48
|
+
observation, and reconciliation. SQLite EXPLAIN QUERY PLAN for the range
|
|
49
|
+
predicates reports `entries_conversation` for channel conversation pages,
|
|
50
|
+
`entries_replies` for turn replies, and the integer primary key for global
|
|
51
|
+
timeline pages. Public tests cover both transports, oversized records,
|
|
52
|
+
position scope and identity, approval observation and closure, and real stdio
|
|
53
|
+
notice delivery to an unattached channel. The 10,000-record public checkpoint
|
|
54
|
+
remains in Gate 4.
|
|
55
|
+
|
|
56
|
+
Gate 2 submission is the revision containing this entry, based on checkpoint
|
|
57
|
+
`cf90755d2ad84db118ddfe1b8324fa627f49b2d7`. Serial verification passed
|
|
58
|
+
`bun run typecheck --pretty false` in both packages, harness
|
|
59
|
+
`bun test ./test --timeout 30000` (331 pass, 0 fail, 3574 assertions, 45
|
|
60
|
+
files), and root `bun test ./test/native` (67 pass, 0 fail, 6423 assertions,
|
|
61
|
+
6 files). The harness run used a 30-second test runner budget. Runtime
|
|
62
|
+
protocol deadlines are unchanged. Independent review is pending.
|
|
63
|
+
|
|
64
|
+
Clad declined Gate 2 at `07fa2d1e32f8313de98c69d8aa87089d8d87a976`.
|
|
65
|
+
Both typechecks, 331 harness tests, and 67 native tests passed independently.
|
|
66
|
+
The review found that focused reads still transferred the model metadata
|
|
67
|
+
blob, that reply identity used a per-row lookup into that blob, and that
|
|
68
|
+
tracked turns lost their linked items. It also requested a committed query
|
|
69
|
+
plan regression.
|
|
70
|
+
|
|
71
|
+
The follow-up limits the SQLite scalar metadata query to explicit keys and
|
|
72
|
+
joins reserved reply IDs by their indexed entry sequence. The side table is
|
|
73
|
+
populated transactionally on response commit and import. Open backfills it
|
|
74
|
+
on upgrade or after an older writer changes the original model record. The
|
|
75
|
+
schema version and positional entries INSERT are unchanged. Clean reopen
|
|
76
|
+
skips the model blob when there is no abandoned running turn. Recovery of an
|
|
77
|
+
abandoned running turn still loads the model record to close its attempts.
|
|
78
|
+
|
|
79
|
+
A SQLite regression observes the actual range SQL and query plans after
|
|
80
|
+
seeding 10,000 model-call records, and verifies that clean reopen, observation,
|
|
81
|
+
reconciliation and paging do not select the model blob. Shared adapter
|
|
82
|
+
conformance now checks tracked turns' linked inputs. The host falls back to
|
|
83
|
+
the status revision for channels it did not observe, and live and paged
|
|
84
|
+
positions share one encoder. The submission store deletes settled entries,
|
|
85
|
+
so startup batches cover outstanding submissions. The mixed workload scale
|
|
86
|
+
checkpoint remains in Gate 4. Tests also check that policy deny prevents
|
|
87
|
+
notify_channel dispatch and that the built-in name cannot be shadowed.
|
|
88
|
+
|
|
89
|
+
The first broad fix run passed 333 tests with one failure. Fresh SQLite create
|
|
90
|
+
left an owner journal because the reply-ID projection was initialized after
|
|
91
|
+
publication. Initialization now finishes in the draft transaction. Both the
|
|
92
|
+
journal regression and the bounded-read regression passed in isolation.
|
|
93
|
+
|
|
94
|
+
The Gate 2 follow-up containing this entry passed both package typechecks.
|
|
95
|
+
Serial harness verification (`bun test ./test --timeout 30000`) passed
|
|
96
|
+
334 tests with 3595 assertions across 45 files. Root `bun test ./test/native`
|
|
97
|
+
passed 67 tests with 6423 assertions across 6 files. Both suites had zero
|
|
98
|
+
failures. Independent re-review is pending.
|
|
99
|
+
|
|
100
|
+
Clad approved Gate 2 at `47a0c1802d2d5aadc63586ad48ab7e26d3aa797e`.
|
|
101
|
+
Independent verification passed both typechecks, 334 harness tests, and 67
|
|
102
|
+
native tests. A clean SQLite reopen skips the model metadata. Repair after
|
|
103
|
+
an abandoned running turn still loads the metadata once in its recovery
|
|
104
|
+
transaction to close running attempts. The mixed workload checkpoint remains
|
|
105
|
+
for Gate 4.
|
|
106
|
+
|
|
107
|
+
Gate 3 begins from the approved revision.
|
|
108
|
+
|
|
109
|
+
Gate 3 shares observation and targeted recovery between process reopen and
|
|
110
|
+
attachment. The host exposes lifecycle commands, negotiated capabilities,
|
|
111
|
+
status freshness, a working-channel count, and partial usage. Attachment
|
|
112
|
+
disposal leaves backend work in place. The configured host responder keeps
|
|
113
|
+
answer authority across detach and deduplicates pending requests; the
|
|
114
|
+
conversation handler remains the fallback. Restart composes confirmed
|
|
115
|
+
exact-turn interruption and start, and fails before start on an unconfirmed
|
|
116
|
+
stop. Existing acp-client transcript reads stay on their existing path.
|
|
117
|
+
Harness history and catch-up are explicit. The catch-up consumer commits
|
|
118
|
+
each page with its position and owns the durable transaction. The real stdio
|
|
119
|
+
operator checkpoint and mixed workload proof remain in Gate 4.
|
|
120
|
+
|
|
121
|
+
The Gate 3 submission containing this entry passed both package typechecks.
|
|
122
|
+
The combined native and persisted transcript reader gate
|
|
123
|
+
(`bun test ./test/native test/persistence-transcript-reader.test.ts`) passed
|
|
124
|
+
79 tests with zero failures and 6497 assertions across seven files.
|
|
125
|
+
Independent review is pending.
|
|
126
|
+
|
|
127
|
+
Clad approved Gate 3 at `d107412cebc90380a5e8a43638ce1e5a1c1bf113`.
|
|
128
|
+
Independent verification passed both typechecks, 334 harness tests, 79
|
|
129
|
+
native and transcript tests, and 1405 root tests. Explicit usage requests
|
|
130
|
+
page the whole model-call history even when filtering by channel. This
|
|
131
|
+
remains a known limit, along with the model record read during abandoned-turn
|
|
132
|
+
recovery.
|
|
133
|
+
|
|
134
|
+
Gate 4 extends the real-stdio checkpoint with the shared Agent rig and scripted
|
|
135
|
+
SQLite child. The cases cover a completion while Alice reattaches and Bob
|
|
136
|
+
keeps receiving events, notice delivery to unattached Alice, pending approval
|
|
137
|
+
recovery without a second responder, and Restart losing its connection before
|
|
138
|
+
confirmation. The callback checkpoint covers responsive status and stop
|
|
139
|
+
during suspension, clean replacement, and explicit resume with Bob still
|
|
140
|
+
individually suspended. Tests distinguish attachment connectivity, channel
|
|
141
|
+
lifecycle, session lifecycle, and process state, and verify two working
|
|
142
|
+
channels while both have running turns.
|
|
143
|
+
|
|
144
|
+
The scale fixture has 10,000 assistant and tool timeline records and 5,000
|
|
145
|
+
turns whose legacy projection exceeds one frame. Under held inference, clean
|
|
146
|
+
open, attachment, and tracked reconciliation add no storage snapshots and
|
|
147
|
+
issue no history requests. Model context assembly itself still reads storage.
|
|
148
|
+
Explicit history pages stay channel-scoped and tool activity stays in the
|
|
149
|
+
timeline. Paging advances past an omitted oversized result. The loss fixture
|
|
150
|
+
kills the child after a reply commits, interrupts catch-up between pages,
|
|
151
|
+
and retries from the consumer's persisted position while live delivery
|
|
152
|
+
continues. The consumer owns its page transaction and message-ID deduplication.
|
|
153
|
+
|
|
154
|
+
The CLI snapshot counter is opt-in for the offline test. It leaves the
|
|
155
|
+
production storage path unchanged when the test environment variable is
|
|
156
|
+
absent. The checkpoint file retains the shared Agent rig and control
|
|
157
|
+
barriers used by the prior real-process cases.
|
|
158
|
+
|
|
159
|
+
The Gate 4 submission containing this entry passed both package typechecks.
|
|
160
|
+
Serial harness verification (`bun test ./test --timeout 30000`) passed 334
|
|
161
|
+
tests and 3595 assertions across 45 files. Full root `bun test ./test` passed
|
|
162
|
+
1411 tests, 12054 assertions and 35 snapshots across 131 files, including all
|
|
163
|
+
six new real-stdio operator cases. Both suites had zero failures.
|
|
164
|
+
Independent review is pending.
|
|
165
|
+
|
|
166
|
+
## Closure and retrospective
|
|
167
|
+
|
|
168
|
+
Clad approved Gate 4 and the operator controls slice at
|
|
169
|
+
`95670a277aa1f2461e37e3fe3cb798edb0952f0d`. The independent clean-checkout
|
|
170
|
+
gate passed both typechecks, all 334 harness tests with
|
|
171
|
+
`bun test ./test --timeout 30000`, and all 1,411 root tests with
|
|
172
|
+
`bun test ./test`. The root run included all six real-stdio operator
|
|
173
|
+
checkpoints. The reviewer confirmed that the snapshot counter measures actual
|
|
174
|
+
successful storage snapshot calls.
|
|
175
|
+
|
|
176
|
+
The accepted chain starts at base `3585cf3`. Gate 1 approved the contract at
|
|
177
|
+
`6f04767fbdd240f6f685a70ff3fb47d41d839916`. Gate 2 approved the focused
|
|
178
|
+
protocol and SQLite reads at `47a0c1802d2d5aadc63586ad48ab7e26d3aa797e`.
|
|
179
|
+
Gate 3 approved host controls and attachment at
|
|
180
|
+
`d107412cebc90380a5e8a43638ce1e5a1c1bf113`. Gate 4 is the accepted behavior
|
|
181
|
+
revision. This closure records that approval without changing behavior.
|
|
182
|
+
|
|
183
|
+
Moving the minimal host cutover into Gate 2 kept the wire replacement and
|
|
184
|
+
its existing consumers on the same verification gate. Review found that
|
|
185
|
+
indexed entry ranges still depended on parsing the large model metadata
|
|
186
|
+
record. The scalar metadata query, sequence-keyed reply ID projection, and
|
|
187
|
+
committed query-plan regression closed that gap. Real stdio barriers then
|
|
188
|
+
verified observation and recovery while another channel could continue,
|
|
189
|
+
as well as durable catch-up after losing a stream.
|
|
190
|
+
|
|
191
|
+
Accepted limits and coverage caveats
|
|
192
|
+
|
|
193
|
+
- Explicit usage reads scan every model-call page, including when scoped to
|
|
194
|
+
a channel.
|
|
195
|
+
- Repair of an abandoned running turn reads the full model metadata record
|
|
196
|
+
once during recovery. Clean reopen skips that record.
|
|
197
|
+
- Inference context assembly reads a full snapshot per inference, with a cost
|
|
198
|
+
that grows with history. The 10,000-record gate measured open, observe,
|
|
199
|
+
paging, and targeted recovery separately from that inference work.
|
|
200
|
+
- Catch-up callers own the durable commit of each page and its position, and
|
|
201
|
+
use stable message IDs to deduplicate.
|
|
202
|
+
- The 10,000-record fixture pages backward after the held turn is
|
|
203
|
+
interrupted. The reattachment and catch-up tests cover the overlap with
|
|
204
|
+
live delivery.
|
|
205
|
+
- The unconfirmed Restart checkpoint exercises connection loss before
|
|
206
|
+
interruption confirmation.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Operator and consumer controls implementation plan
|
|
2
|
+
|
|
3
|
+
Date: 2026-11-20.
|
|
4
|
+
Status: proposed for review.
|
|
5
|
+
|
|
6
|
+
## Scope and base
|
|
7
|
+
|
|
8
|
+
Implement [SPEC.md](SPEC.md) across the harness and acp-client. Record the
|
|
9
|
+
accepted integration and callbacks revisions at handoff. Gate 1 checks the
|
|
10
|
+
public API on that base, especially callback phase reporting and recovery of
|
|
11
|
+
turns started by the agent.
|
|
12
|
+
|
|
13
|
+
The harness owns lifecycle and durable outcomes. acp-client owns process
|
|
14
|
+
orchestration, attachments, and consumer-facing status. Follow the harness
|
|
15
|
+
[architecture](../../../../ARCHITECTURE.md) and
|
|
16
|
+
[contribution rules](../../../../AGENTS.md). acp-client imports only public
|
|
17
|
+
harness exports. The kernel depends on contracts. Record any contract changes
|
|
18
|
+
in a harness decision before implementation builds on them.
|
|
19
|
+
|
|
20
|
+
## Code ownership
|
|
21
|
+
|
|
22
|
+
| Area | Existing code | Work |
|
|
23
|
+
| --- | --- | --- |
|
|
24
|
+
| Harness lifecycle | `src/native-harness/src/kernel/channels.ts` and `src/native-harness/src/state/storage/` | Reuse admission, suspend, resume, stop, interrupt, and recovery. If phase information is missing, expose it from the execution boundary that owns it. Use the existing records for durable outcomes. |
|
|
25
|
+
| Harness built-in notices | `src/native-harness/src/capabilities/tools/`, session composition in `src/native-harness/src/index.ts`, and the scripted server in `src/native-harness/src/testing.ts` | Promote the existing `notify_channel` to the default tool composition. Reuse the current notice handling and permission gate, reserve the name, and remove duplicate development registration. Exercise the ordinary session path over scripted stdio. |
|
|
26
|
+
| Harness storage reads | `src/native-harness/src/contracts/storage.ts` and `src/native-harness/src/state/storage/` | Add bounded, indexed sequence-range reads for conversation and timeline pages. Add focused reads for current channel state and tracked input or turn IDs. Give memory and SQLite the same read contract. |
|
|
27
|
+
| Harness public protocol | `src/native-harness/src/contracts/protocol.ts`, `src/native-harness/src/interfaces/protocol/`, and public `src/native-harness/src/client.ts` | Replace full load and forward replay with the operations in the spec. Expose pending approvals from the existing harness approval service through `channel/observe`. Keep the lifecycle, model-call, and approval response methods. Validate cursors and enforce frame budgets at the protocol boundary. |
|
|
28
|
+
| acp-client host | `src/native/host.ts` | Own the shared connection and child lifecycle. Compose agent controls from existing harness requests. Keep status and interrupt available while suspend waits. Route approval events to the configured application responder before conversation delivery. The responder remains available across detach. |
|
|
29
|
+
| acp-client recovery | Extract from `src/native/host.ts` into one focused module under `src/native/` | Share channel observation, targeted reads, and snapshot/live reconciliation between process reopen and channel reattachment. Keep startup channel changes and submission retry orchestration with the host. Keep application submission records in `src/native/records.ts`. |
|
|
30
|
+
| acp-client history | Existing transcript pagination in `src/persistence/transcript-reader.ts` and the native adapter under `src/native/` | Retain consumer-facing cursor pagination. Resolve the conversation ID to a channel ID. Support explicitly requested backward history and forward catch-up. Persist the catch-up position with committed messages, and skip harness history reads when the consumer does not request them. |
|
|
31
|
+
| acp-client controller | `src/native/controller.ts` | Own the conversation attachment and adapt harness turns to the existing supervisor. Add attachment disposal separately from interrupt-and-detach `stop()`. Await targeted interruption for confirmed stop. Reconcile live agent-started turns without requiring a submission record. Use the existing conversation approval handler when no host responder is configured. |
|
|
32
|
+
| Shared controller | `src/conversation-controller/` | Keep the common start and stop contract and use the capability surface for attach-only where supported. If Restart is exposed, compose stop then start once at the shared call site. Keep native protocol types inside `src/native/`. |
|
|
33
|
+
|
|
34
|
+
The harness reports channel lifecycle, running turns, and execution phase.
|
|
35
|
+
The host combines that with process health and derives the working-channel
|
|
36
|
+
count. The attachment owns connected or disconnected state. Use the public
|
|
37
|
+
`aggregateUsage` helper over model-attempt records, and carry separate
|
|
38
|
+
completeness information for missing provider fields.
|
|
39
|
+
|
|
40
|
+
For reattachment, register delivery before taking a revisioned channel view.
|
|
41
|
+
Reconcile tracked work, then merge buffered live events. Several events can
|
|
42
|
+
share one revision. Use the snapshot boundary and stable IDs for reconciliation.
|
|
43
|
+
Keep the boundary local to the reattaching channel so other channels keep
|
|
44
|
+
receiving events. History paging is a separate read. Remove acp-client's
|
|
45
|
+
startup loop that exhausts every message page on the new open path.
|
|
46
|
+
|
|
47
|
+
## Implementation gates
|
|
48
|
+
|
|
49
|
+
| Gate | Work and evidence |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| **1. Contract** | Pin the reviewed base. Define the replacement operation types, bounds, cursors, message positions, and commit ordering. Record the storage contract decision. Define the optional host responder, its single answer path, fallback to the conversation handler, and how views learn a pending request closed. Confirm command completion, status ownership, and blocking-tool observation. Typecheck the contracts. |
|
|
52
|
+
| **2. Harness control and observation** | Implement focused reads in both adapters under shared conformance. Verify SQLite uses indexed ranges and the public reads avoid full history snapshots. Expose live pending approvals in `channel/observe` under their existing deadlines and cancellation rules. Compose and test the default notice tool. Check oversized events, status and interrupt during suspend, stale interrupts, and independent channel suspension. Exercise both transports. |
|
|
53
|
+
| **3. acp-client host and controller** | Switch startup to the replacement protocol. Add host controls, central approval routing, and attachment disposal. Verify host responder ownership, legacy handler fallback, and pending request reconciliation by ID. Share reopen and reattach recovery. Verify confirmed stop before Restart, idempotent reattachment, and recovery of live agent-started turns. Exercise both transcript sources, targeted recovery, forward catch-up, and controller conformance. |
|
|
54
|
+
| **4. Public stdio checkpoint** | Extend `test/native/checkpoint.test.ts` and run the scenarios below through acp-client with a real scripted harness child. Check config validation, negotiated capabilities, and partial usage. Run both packages' typechecks and test suites. Update architecture and usage docs for the accepted behavior. |
|
|
55
|
+
|
|
56
|
+
## End-to-end acceptance
|
|
57
|
+
|
|
58
|
+
1. Detach Alice while her turn runs and let it finish. Have Bob's scripted
|
|
59
|
+
model call the built-in `notify_channel` to wake Alice's active channel.
|
|
60
|
+
Wait for the notice-driven reply to commit before reattaching. Request the
|
|
61
|
+
newest page, recover each committed reply once, and receive later events.
|
|
62
|
+
Bob's work and subscription continue throughout. Exercise an event
|
|
63
|
+
arriving during reattachment.
|
|
64
|
+
2. Suspend a session during a controlled host callback. Observe the blocking
|
|
65
|
+
invocation, let it settle, and wait for the committed suspension. Replace
|
|
66
|
+
the child, reload the same session, and explicitly resume. Verify the
|
|
67
|
+
callback effect happened once and an individually suspended channel stays
|
|
68
|
+
suspended until explicitly resumed.
|
|
69
|
+
3. In a separate run, stop during suspension. Verify the stop remains
|
|
70
|
+
responsive, the host does not automatically reopen, and explicit reopen
|
|
71
|
+
reconciles the interrupted outcome and any uncertain tool effect.
|
|
72
|
+
4. With at least 10,000 timeline records and a full-load view over the frame
|
|
73
|
+
limit, verify agent open and channel attachment issue zero history requests
|
|
74
|
+
when acp-client uses its transcript. Hold inference and verify the harness
|
|
75
|
+
avoids full history reads for open, attach, and targeted recovery. Reconcile
|
|
76
|
+
a tracked turn by ID. Then request Alice's newest page and walk older
|
|
77
|
+
pages during live delivery. Check channel scope, actor attribution, and
|
|
78
|
+
stable cursors. Verify tool records stay outside the conversation count and
|
|
79
|
+
remain available in the independently paged timeline. Verify SQLite serves
|
|
80
|
+
page reads through a bounded range query without materializing the timeline.
|
|
81
|
+
5. With a configured host responder, detach the last observer while an
|
|
82
|
+
approval is pending. Answer through the host and verify the tool runs once.
|
|
83
|
+
Request a separate approval with nobody attached, then reattach and recover
|
|
84
|
+
it by ID. Verify an observer without authority cannot answer, expiry or
|
|
85
|
+
connection loss closes the request, and a late or duplicate answer cannot
|
|
86
|
+
dispatch the tool. Run the same approval path with no host responder and
|
|
87
|
+
verify the existing conversation handler still answers.
|
|
88
|
+
6. Verify shared Restart waits for confirmed interruption and leaves the next
|
|
89
|
+
turn untouched. Lose the connection before confirmation and verify shared
|
|
90
|
+
Restart reports the unconfirmed stop and does not start the conversation.
|
|
91
|
+
7. Page across an oversized timeline record. Explicitly catch up an untracked
|
|
92
|
+
reply after stream loss without duplicating live output. Interrupt catch-up
|
|
93
|
+
between pages and verify retry uses the last persisted position.
|
|
94
|
+
|
|
95
|
+
Use scripted inference and controlled barriers. Put focused harness checks in
|
|
96
|
+
the harness test suite and host, attachment, and controller checks in
|
|
97
|
+
`test/native/`. Run `bun run typecheck` in both packages, `bun test ./test/native`
|
|
98
|
+
from the repository root for the focused integration gate, and `bun test ./test`
|
|
99
|
+
from both packages for the final gate.
|
|
100
|
+
|
|
101
|
+
## Handoff and closure
|
|
102
|
+
|
|
103
|
+
Use one implementer and one independent reviewer. Record the base, exact
|
|
104
|
+
stage revisions, review outcomes, and verification in `LOG.md` once work
|
|
105
|
+
starts. The reviewer approves each gate before work builds on it. Record the
|
|
106
|
+
accepted revision, known limits, and a short retrospective at closure.
|