@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,433 @@
|
|
|
1
|
+
# acp-client integration log
|
|
2
|
+
|
|
3
|
+
Work on [SPEC.md](SPEC.md), [PROTOCOL.md](PROTOCOL.md) and [PLAN.md](PLAN.md).
|
|
4
|
+
Branch `acp-client-integration`, started from `aiagent/haurness-l` at `c96b1c4`.
|
|
5
|
+
Entries are in order. Each records what was done, how it was checked, what the
|
|
6
|
+
checks do not cover, regressions, and any drift from the design.
|
|
7
|
+
|
|
8
|
+
## Step 0 · Integration base (2026-11-20)
|
|
9
|
+
|
|
10
|
+
Commit `06ae6f2`.
|
|
11
|
+
|
|
12
|
+
**Done.** Created `acp-client-integration` from `aiagent/haurness-l` (`c96b1c4`,
|
|
13
|
+
docs only) and merged the accepted model-execution stack at its closure
|
|
14
|
+
`49f2974` (behavior `02c96de`). This is the Gate 1 base. The reviewed
|
|
15
|
+
`controller-interface` revision (`9668cf7` at the time of writing) is not merged
|
|
16
|
+
yet; the plan combines it before Gate 2.
|
|
17
|
+
|
|
18
|
+
**Checked.** In `src/native-harness`: `bun run typecheck` clean, `bun run test`
|
|
19
|
+
290 pass, 0 fail (41 files). This is the baseline for regression comparisons.
|
|
20
|
+
|
|
21
|
+
**Gaps.** Only the harness suite ran. The acp-client checks at the repository
|
|
22
|
+
root were not run at this step; the merge touched only `src/native-harness/`.
|
|
23
|
+
|
|
24
|
+
**Regressions.** None.
|
|
25
|
+
|
|
26
|
+
**Drift.** One merge conflict, in `.res/docs/BUSINESS_RULES.md`: both sides
|
|
27
|
+
edited the model-execution section. Took the model-execution side, which says
|
|
28
|
+
the rules are implemented and lists where.
|
|
29
|
+
|
|
30
|
+
## Step 1 · Gate 1 contract: startup channel changes (2026-11-20)
|
|
31
|
+
|
|
32
|
+
Commit `83c2d0f`.
|
|
33
|
+
|
|
34
|
+
**Done.** Recorded
|
|
35
|
+
[decision 0020](../../../decisions/0020-startup-channel-changes.md) and added
|
|
36
|
+
the contract types to `src/contracts/protocol.ts`: `PendingChannelChange`,
|
|
37
|
+
`ChannelChangeResult`, optional `channelChanges` on `session/create` and
|
|
38
|
+
`session/load` params and results, and `capabilities.startupChannelChanges`.
|
|
39
|
+
Exported the batch and load-view types from the public `client.ts`. Types only,
|
|
40
|
+
landed before the implementation as AGENTS.md requires.
|
|
41
|
+
|
|
42
|
+
**Checked.** `bun run typecheck`.
|
|
43
|
+
|
|
44
|
+
**Gaps.** No behavior yet at this commit.
|
|
45
|
+
|
|
46
|
+
**Regressions.** None.
|
|
47
|
+
|
|
48
|
+
**Decisions and drift.** This closes the SPEC's open item "finalize the
|
|
49
|
+
pending-change result shape":
|
|
50
|
+
|
|
51
|
+
- Names are the ones PROTOCOL.md proposed. The request and result field is
|
|
52
|
+
`channelChanges` on both create and load.
|
|
53
|
+
- A different batch on an already-open connection fails `invalid_state`.
|
|
54
|
+
PROTOCOL.md says "rejected" without naming a code.
|
|
55
|
+
- An unknown policy name fails `invalid_policy`; other malformed batches fail
|
|
56
|
+
`invalid_params`.
|
|
57
|
+
- **Atomicity drift.** PROTOCOL.md says to "resolve each channel change
|
|
58
|
+
atomically with its channel state". The implementation composes the existing
|
|
59
|
+
channel transitions (create, edit, suspend, resume, delete), so one entry is
|
|
60
|
+
several storage transactions. Nothing can interleave: the session is not
|
|
61
|
+
started and the endpoint admits no other request until the open is answered.
|
|
62
|
+
A crash mid-entry leaves a prefix applied with no confirmation, and the host
|
|
63
|
+
resends. This avoided a storage-contract change and a new conformance suite.
|
|
64
|
+
A single-transaction storage operation remains possible later.
|
|
65
|
+
- To keep a blocked entry from half-applying, the lifecycle step is decided
|
|
66
|
+
before the name and policy are written. A blocked entry writes neither.
|
|
67
|
+
- A retirement of a channel the harness has never seen creates it and retires
|
|
68
|
+
it, so the ID is reserved like any other retired ID.
|
|
69
|
+
|
|
70
|
+
## Step 2 · Gate 1 implementation: batch applied at open (2026-11-20)
|
|
71
|
+
|
|
72
|
+
Commit `f564290`.
|
|
73
|
+
|
|
74
|
+
**Done.**
|
|
75
|
+
|
|
76
|
+
- `src/interfaces/protocol/channel-changes.ts` (new): whole-batch validation,
|
|
77
|
+
policy check, batch comparison, and application in two phases. Suspensions,
|
|
78
|
+
edits, creations and retirements run first. Resumes run last in a synchronous
|
|
79
|
+
step shared with the load view, because resuming a checkpoint makes its turn
|
|
80
|
+
run on the next microtask.
|
|
81
|
+
- `src/interfaces/protocol/server.ts`: `session/create` and `session/load`
|
|
82
|
+
parse the batch before opening, apply it after recovery and before `start`,
|
|
83
|
+
record the batch and its results on the endpoint, and return them. A repeated
|
|
84
|
+
load with the same batch or none returns the recorded results.
|
|
85
|
+
- `README.md`: describes the behavior.
|
|
86
|
+
|
|
87
|
+
**Gate 1 evidence** (`test/startup-channel-changes.test.ts`, 8 tests, real
|
|
88
|
+
`serve --stdio` child processes on SQLite unless noted):
|
|
89
|
+
|
|
90
|
+
| Required evidence | Test |
|
|
91
|
+
| --- | --- |
|
|
92
|
+
| Offline suspension prevents early execution | Session killed with `a2` accepted and untaken. Reopen with `a: suspended`: view shows `a` suspended with `a2` pending, channel `b` runs a turn, `a` starts nothing, and a live resume takes `a2` once. |
|
|
93
|
+
| Invalid batches leave channel state untouched | Seven invalid batches (duplicate channel, unknown policy, missing `changeId`, bad lifecycle, unknown field, empty name, non-array), each with a valid first entry. All rejected, no events, and a following plain load shows `a` open and unnamed and no new channel. |
|
|
94
|
+
| Blocked delete suspends the target and preserves accepted work while another channel remains usable | Reopen with `a: retired`: `blocked`/`channel_busy`, `a` suspended with `a2` still `received`, the name in the blocked entry not written, `b` renamed and runs. After withdrawing `a2`, the same batch applies. |
|
|
95
|
+
| Lost open response is safe to retry on the same connection | Second load with the same batch and with no batch returns equal results and an equal status (same revision). A different batch fails `invalid_state`. |
|
|
96
|
+
| ...and after reconnect | Fault injection kills the process right after the suspension commits, before the response. A new process given the same batch reports `applied`; one turn, two items, nothing started on `a`. |
|
|
97
|
+
|
|
98
|
+
Also covered: a repeated retirement is `applied`; reopening a retired ID is
|
|
99
|
+
`blocked`/`channel_retired`; retiring an unknown ID reserves it; a batch resume
|
|
100
|
+
continues a checkpoint with all of its work events after the open response; an
|
|
101
|
+
incompatible checkpoint is `blocked`/`incompatible` and stays suspended;
|
|
102
|
+
`session/create` applies a batch on an in-memory server.
|
|
103
|
+
|
|
104
|
+
**Checked.** `bun run typecheck` clean. `bun run test`: 298 pass, 0 fail
|
|
105
|
+
(42 files) — the 290 baseline plus the 8 new tests.
|
|
106
|
+
|
|
107
|
+
**Gaps.**
|
|
108
|
+
|
|
109
|
+
- Crash points inside a batch are exercised at one boundary only (after
|
|
110
|
+
`beginChannelSuspend`). A crash between a blocked retirement's check and its
|
|
111
|
+
suspension, or between a create and its edit, is argued idempotent but not
|
|
112
|
+
tested.
|
|
113
|
+
- A storage failure in the middle of a batch fails the open and leaves a prefix
|
|
114
|
+
applied. Not tested.
|
|
115
|
+
- `session/create` with a batch whose policy is only known from a saved or
|
|
116
|
+
sidecar configuration is validated after the session is created. A rejection
|
|
117
|
+
then leaves the created session on disk without its config committed. With
|
|
118
|
+
an inline config (what acp-client sends) the check runs before creation.
|
|
119
|
+
- A load view too large for one frame fails after the batch was applied.
|
|
120
|
+
- Session-level suspension combined with a batch is covered only by reasoning
|
|
121
|
+
(channel controls are allowed in every session lifecycle).
|
|
122
|
+
- Events emitted while the batch applies (`channel_state`) are published before
|
|
123
|
+
the open response, with revisions at or below the view's. That matches the
|
|
124
|
+
load contract but a host must tolerate them; the adapter tests in Gate 2
|
|
125
|
+
cover the host side.
|
|
126
|
+
|
|
127
|
+
**Regressions.** None found. Two behavior changes to existing paths, both
|
|
128
|
+
reviewed: the endpoint's "one open at a time" guard now stays set from the
|
|
129
|
+
storage open until the session is published, closing a small window in which a
|
|
130
|
+
second open could start; and an open that fails after a batch was applied stops
|
|
131
|
+
the session before releasing it.
|
|
132
|
+
|
|
133
|
+
**Drift.** As listed in step 1. `server.ts` is now 400 lines, at the AGENTS.md
|
|
134
|
+
review threshold; the batch logic was placed in its own module for that reason.
|
|
135
|
+
|
|
136
|
+
## Step 3 · Integration base for the adapter (2026-11-20)
|
|
137
|
+
|
|
138
|
+
Commit `004cc7f`.
|
|
139
|
+
|
|
140
|
+
**Done.** Merged the reviewed `controller-interface` revision `9668cf7`
|
|
141
|
+
(provides `ConversationController`) into the Gate 1 revision `f564290`, as the
|
|
142
|
+
plan requires before Gate 2. The merge was clean.
|
|
143
|
+
|
|
144
|
+
The integration base is therefore: `aiagent/haurness-l` `c96b1c4` +
|
|
145
|
+
model-execution `49f2974` + Gate 1 `f564290` + controller-interface `9668cf7`.
|
|
146
|
+
|
|
147
|
+
**Checked.** From the repository root: `bun run typecheck` clean; `bun test
|
|
148
|
+
./test` 1335 pass, 0 fail (125 files). This is the acp-client baseline.
|
|
149
|
+
|
|
150
|
+
**Gaps.** `bun test` with no path would also pick up the harness tests and the
|
|
151
|
+
smoke tests; the baseline uses `./test` (acp-client) and the harness's own
|
|
152
|
+
`bun run test` separately.
|
|
153
|
+
|
|
154
|
+
**Regressions.** None.
|
|
155
|
+
|
|
156
|
+
**Drift.** None.
|
|
157
|
+
|
|
158
|
+
## Step 4 · Gate 2: the acp-client adapter (2026-11-20)
|
|
159
|
+
|
|
160
|
+
Commit `58860fd`.
|
|
161
|
+
|
|
162
|
+
**Done.**
|
|
163
|
+
|
|
164
|
+
- `src/native/records.ts`: what the host remembers across a harness restart.
|
|
165
|
+
Each channel's newest unconfirmed desired state, with a version that is the
|
|
166
|
+
wire `changeId`, and each input with its exact payload and a state (`saved`,
|
|
167
|
+
`unknown`, `accepted`). In memory by default; `createFileHostRecords` keeps
|
|
168
|
+
the same data in one JSON file.
|
|
169
|
+
- `src/native/host.ts`, `NativeHarnessHost`: one per Agent. Lazy single start
|
|
170
|
+
through the host launcher (new launch kind `native-harness`), the open
|
|
171
|
+
sequence (handlers, `initialize`, capability check, `session/load` or
|
|
172
|
+
`session/create` on `not_found`, with the pending batch), reconciliation,
|
|
173
|
+
per-channel ordering of live edits and inputs, reopen after a loss, and
|
|
174
|
+
process shutdown.
|
|
175
|
+
- `src/native/controller.ts`, `NativeController`: implements
|
|
176
|
+
`ConversationController` for one channel. Holds each reported turn's events
|
|
177
|
+
and outcome until the prepared turn's `prompt()` attaches. `forceStop()` is a
|
|
178
|
+
targeted `channel/interrupt` plus local settlement. `startFresh()` throws
|
|
179
|
+
`UnsupportedError`.
|
|
180
|
+
- Wiring, all opt-in: `NativeAdapter` (`{ kind: "native" }`),
|
|
181
|
+
`AgentConfig.harness`, `agent.nativeHarness`, a `native` binding on the
|
|
182
|
+
session config, and the branch in `conversation-controller/factory.ts`.
|
|
183
|
+
Creating a conversation with a title records the channel name; deleting one
|
|
184
|
+
records its retirement. Neither starts the process.
|
|
185
|
+
- `conversationCapabilities.freshContext?: false` and the guard
|
|
186
|
+
`requireFreshContext`, used by `restartProviderFresh` before it tears
|
|
187
|
+
anything down.
|
|
188
|
+
|
|
189
|
+
**Gate 2 evidence.**
|
|
190
|
+
|
|
191
|
+
| Required evidence | Where |
|
|
192
|
+
| --- | --- |
|
|
193
|
+
| Controller conformance | `test/native/conformance.test.ts`: the shared suite (`test/conversation-controller/conformance.ts`), 9 cases, on the native controller over a real stdio harness. Three assertions differ for a backend-scheduled controller; see drift. |
|
|
194
|
+
| Existing ACP checks | Root `bun test ./test`: the 1335 baseline tests still pass. |
|
|
195
|
+
| Early output and terminal outcomes settle the prepared turn once | `controller.test.ts`: output and `turn_ended` received before `prepareTurn` are replayed once, in order; `live` is false; a second end changes nothing. A running turn streams and settles at `turn_ended`. |
|
|
196
|
+
| Concurrent first sends launch one process | `host.test.ts` (three concurrent uses, one launch) and checkpoint step 1 (two conversations, one `native-harness` launch). |
|
|
197
|
+
| Take before push acknowledgment still correlates | `controller.test.ts`: `turn_started` naming the id arrives while the push is unanswered and is reported with that message id. |
|
|
198
|
+
| An old acknowledgment cannot clear a newer edit | `host.test.ts`: an edit made while the open is in flight keeps its version pending and is sent through the live API before the waiting input. Also the records unit test. |
|
|
199
|
+
| An ambiguous push uses its saved ID and payload | `host.test.ts`: response lost on a live connection (resent, byte-equal, one input), and lost with the connection (found in the reopened view, or resent). |
|
|
200
|
+
| `startFresh()` leaves the timeline intact | `controller.test.ts` and the Agent-level test in `checkpoint.test.ts`: the harness status, including its revision, is equal before and after, and the script continues. |
|
|
201
|
+
| Persist input before push | `host.test.ts`: the saved record is read at the moment the push is written. |
|
|
202
|
+
| Post-cutoff edits flush before fresh input | `host.test.ts`: call order `createSession` < `editChannel` < `push`. |
|
|
203
|
+
|
|
204
|
+
**Checked.** Root: `bun run typecheck` clean; `bun test ./test` 1389 pass,
|
|
205
|
+
0 fail (129 files; 1335 baseline + 54 native at this commit). Harness: typecheck
|
|
206
|
+
clean, 298 pass, 0 fail. `bun test ./test/native` ran three times in a row
|
|
207
|
+
without a failure.
|
|
208
|
+
|
|
209
|
+
**Gaps.**
|
|
210
|
+
|
|
211
|
+
- **Host records are not in acp-client's persistence.** The spec says to use
|
|
212
|
+
the host's prompt record. The records are behind an interface with a memory
|
|
213
|
+
and a file implementation; the Agent uses memory unless given another. They
|
|
214
|
+
survive a harness restart, which is what the checkpoint needs, but not an
|
|
215
|
+
acp-client restart unless the file store is configured. The original
|
|
216
|
+
design's `channels?` repository is not built.
|
|
217
|
+
- **Reconciliation after an acp-client restart is partial.** A fresh controller
|
|
218
|
+
only settles turns it was following and turns that own one of its unsettled
|
|
219
|
+
inputs. Turns that ended while no acp-client process existed are not
|
|
220
|
+
recorded: that needs the durable watermark of the original design.
|
|
221
|
+
- **Events for a channel with no open conversation** are held in memory (2000
|
|
222
|
+
per channel, oldest dropped) until one attaches. The conversation is not
|
|
223
|
+
loaded from persistence to record them.
|
|
224
|
+
- **Not forwarded yet:** usage (metering records say "harness reported no
|
|
225
|
+
usage"), `items_receipt` beyond a per-controller lookup (`receiptOf`), and
|
|
226
|
+
`channel/withdraw` (the host has `withdraw`, but the session's local withdraw
|
|
227
|
+
does not call it; this is the reviewed base's documented behaviour).
|
|
228
|
+
- **Stall detection is not paused** while the host reopens.
|
|
229
|
+
- **A request to the running harness times out after 30 s** (configurable).
|
|
230
|
+
`channel/suspend` waits for a running tool, so a long tool can time it out;
|
|
231
|
+
the change then stays pending and goes with the next open.
|
|
232
|
+
- `text: "stream"` is implemented in the controller and unit-tested, but the
|
|
233
|
+
real-process tests use `final`.
|
|
234
|
+
- Restart limits (3 within 60 s) are tested with the in-process harness only.
|
|
235
|
+
|
|
236
|
+
**Regressions.** None found in the two suites. Behaviour changes to existing
|
|
237
|
+
code, all additive:
|
|
238
|
+
|
|
239
|
+
- `LaunchKind` gained `"native-harness"`. A consumer launcher that switches
|
|
240
|
+
exhaustively on the kind will see a new value, only when a harness is
|
|
241
|
+
configured.
|
|
242
|
+
- `AgentAdapterRegistration.adapter` and `AgentConfig.adapters` now accept a
|
|
243
|
+
native adapter. `AgentAdapterRegistry.require/get/list` still return the
|
|
244
|
+
`Adapter` shape; a native adapter appears there with the placeholder command
|
|
245
|
+
`["native-harness"]`. Code that spawns that command for a native adapter id
|
|
246
|
+
(internal inference on the harness runtime, adoption, a handoff target)
|
|
247
|
+
would fail to spawn. None of those paths is supported for native yet.
|
|
248
|
+
- `agent.conversations.delete` reads the active provider session when a
|
|
249
|
+
harness is configured, to learn whether the conversation is native. One
|
|
250
|
+
extra read, only for Agents with `harness`.
|
|
251
|
+
|
|
252
|
+
**Decisions and drift.**
|
|
253
|
+
|
|
254
|
+
- **Open decisions from the spec, as implemented.** Launcher contract: the
|
|
255
|
+
existing `AcpLauncher.prepare`, with kind `native-harness`; without a
|
|
256
|
+
launcher the process inherits the environment plus `harness.env`. Startup
|
|
257
|
+
deadline: 30 s from spawn to the open response, configurable; on expiry the
|
|
258
|
+
process is killed. Retry of a failed launch: none automatic. A failed start
|
|
259
|
+
rejects the operation that needed it and the next use tries again. Only an
|
|
260
|
+
unexpected loss with work outstanding (a waiting input, or a conversation
|
|
261
|
+
with a turn) is reopened by the host, at most 3 times in 60 s; then the host
|
|
262
|
+
is `failed` until `restart()`.
|
|
263
|
+
- **Change to the reviewed session base (flagged for review).**
|
|
264
|
+
`conversation-turns/backend-turns.ts`, `context.ts` and `run-turn.ts`: a
|
|
265
|
+
turn the backend started now runs with the handlers of the first message it
|
|
266
|
+
took that brought any. Before, such a turn had no consumer handlers, so a
|
|
267
|
+
permission request could only be answered by `defaultPermission`, and the
|
|
268
|
+
spec's "route the approval through the consumer" was not reachable from the
|
|
269
|
+
public conversation interface. A turn that took no message, or whose
|
|
270
|
+
messages brought no handlers, behaves as before. The 238 controller and
|
|
271
|
+
turn-path tests pass unchanged.
|
|
272
|
+
- **Change to the shared conformance suite.** `Subject.backendScheduled`
|
|
273
|
+
relaxes three assertions for the native subject, each following from the
|
|
274
|
+
reviewed base's rules for backend-started turns: no `<turn>:user` record,
|
|
275
|
+
no `endedBy`, and no `turn_failed` for a message the backend never accepted
|
|
276
|
+
(no turn existed). The other subjects are unaffected.
|
|
277
|
+
- **Known consequences of the base for native conversations**, not changed
|
|
278
|
+
here: a prompt's text is not written as a user record, and `endedBy` is not
|
|
279
|
+
reported.
|
|
280
|
+
- **`abandonTurn` does not interrupt.** The original native design said it
|
|
281
|
+
interrupts a running turn; the controller contract says it never stops
|
|
282
|
+
provider work. The contract was followed.
|
|
283
|
+
- **`stop()` of a conversation interrupts its own turn** (original design).
|
|
284
|
+
- **A prompt to a suspended channel is refused** (`channel_suspended`) rather
|
|
285
|
+
than held by the host.
|
|
286
|
+
- **A prompt whose start failed is never executed later.** A submission is
|
|
287
|
+
`saved` until a push for it is written; a `saved` one is dropped when its
|
|
288
|
+
caller is told the start failed. The spec's "retry unresolved submissions"
|
|
289
|
+
applies to `unknown` ones.
|
|
290
|
+
- **A blocked change is not resent while running.** It stays pending and is
|
|
291
|
+
re-evaluated by the next open, or sooner if the consumer changes it.
|
|
292
|
+
- **`freshContext` is optional and only ever `false`.** Making it required
|
|
293
|
+
would have broken existing exact-equality assertions on the capability
|
|
294
|
+
object.
|
|
295
|
+
- Turn ids reported to the session are `native-turn-<harness turn id>`.
|
|
296
|
+
|
|
297
|
+
## Step 5 · Gate 3: the real stdio checkpoint (2026-11-20)
|
|
298
|
+
|
|
299
|
+
Commit `acd749b`.
|
|
300
|
+
|
|
301
|
+
**Done.** `test/native/checkpoint.test.ts`: the six steps of the spec's first
|
|
302
|
+
end-to-end checkpoint through `Agent`, `agent.conversations` and
|
|
303
|
+
`conversation.prompt`, against a real `serve --stdio` child process with a
|
|
304
|
+
SQLite session in a temporary home. Documentation: `CONSUMER_GUIDE.md` (new
|
|
305
|
+
section), the harness `README.md`, and the row in `WORK.md`.
|
|
306
|
+
|
|
307
|
+
**Gate 3 evidence.**
|
|
308
|
+
|
|
309
|
+
| Checkpoint step | Test and what it shows |
|
|
310
|
+
| --- | --- |
|
|
311
|
+
| 1. Two conversations, concurrent sends, one process and session | "1-3": nothing launched at creation; two concurrent prompts cause one launch of kind `native-harness`; `status.sessionId` is the Agent id with one channel per conversation. |
|
|
312
|
+
| 2. Input while a channel works is accepted, then correlated; the other channel finishes independently | "1-3": Bob's turn completes while Alice's waits for approval. A steer message to Alice appears in the harness's pending list, then resolves with the same `operationId` as her first prompt. |
|
|
313
|
+
| 3. One approval dispatches one call | "1-3": the request (`rec-1`, tool `record`) reaches the prompt's handler; the effect log has one line per approved call, two in total. |
|
|
314
|
+
| 4. `forceStop()` isolates the interrupt; fresh input after | "4": Alice's prompt fails; the harness shows her turn interrupted with the conversation's reason and Bob's still running in the same process; Bob completes; only Bob's tool finishes; Alice then completes a new prompt. |
|
|
315
|
+
| 5. Loss after a reply commits; suspension recorded while down | "5": fault `commitResponse:2` kills the process right after Alice's reply commits. A suspension for Bob is recorded when the host sees the process down. After the reopen: Alice's reply is recorded once and her prompt fails as interrupted; Bob's prompt fails with `uncertainCalls: ["hold-k"]`; Bob's channel is suspended with his accepted input still pending and unsettled; the pending change is confirmed. Then Alice takes new input, Bob is resumed and his input runs once; each reply is recorded once; the held tool never ran again; two launches. |
|
|
316
|
+
| 6. Lost push response; lost open response | "6a": fault `acceptItem:1`; the reopen finds the input by its saved id; one turn, one reply, script position advanced once. "6b": fault `beginChannelSuspend:1` inside the open; the pending change is unchanged, the failed prompt is not kept; the next prompt reopens, the change is confirmed, and the channels are as desired with nothing duplicated. |
|
|
317
|
+
|
|
318
|
+
Also covered there: a native adapter without `harness` is refused; ACP
|
|
319
|
+
adapters in the same Agent keep their shape; `startFresh` at the Agent level;
|
|
320
|
+
deleting a conversation while stopped retires its channel at the next open
|
|
321
|
+
without a launch; a second Agent process over the same persistence and home
|
|
322
|
+
reopens the conversation on the same session; `agent.close()` stops the
|
|
323
|
+
process.
|
|
324
|
+
|
|
325
|
+
**Checked.** At `acd749b`, host and harness checks on the same revision — see
|
|
326
|
+
the closing entry for the numbers.
|
|
327
|
+
|
|
328
|
+
**Gaps.**
|
|
329
|
+
|
|
330
|
+
- Step 5 loses the harness process. A lost connection with a live process (a
|
|
331
|
+
broken pipe) is exercised only with the in-process harness.
|
|
332
|
+
- Step 6b's retry is the consumer's next prompt, because a failed start is not
|
|
333
|
+
retried automatically. The same-connection repeat of a load is covered by the
|
|
334
|
+
harness test in step 2 and by the host's timeout retry in code, which has no
|
|
335
|
+
dedicated test.
|
|
336
|
+
- The broader checkpoint (a consumer-registered callback, a long-running mock)
|
|
337
|
+
is out of scope, as the spec says. Bounded recovery (paged views) is not
|
|
338
|
+
built; the host pages messages only.
|
|
339
|
+
- The harness in these tests is the scripted server from the harness's
|
|
340
|
+
`testing.ts`, the only server mode that exists.
|
|
341
|
+
|
|
342
|
+
**Regressions.** None.
|
|
343
|
+
|
|
344
|
+
**Drift.** Step 5's suspension is recorded from a host state listener, at the
|
|
345
|
+
moment the process is found down, because the host reopens at once when work
|
|
346
|
+
is outstanding. A consumer that wants a longer window stops the host first.
|
|
347
|
+
|
|
348
|
+
## Closing · Checks at the final code revision (2026-11-20)
|
|
349
|
+
|
|
350
|
+
Code revision `acd749b`; host and harness checks ran against that same
|
|
351
|
+
revision.
|
|
352
|
+
|
|
353
|
+
| Check | Result |
|
|
354
|
+
| --- | --- |
|
|
355
|
+
| Root `bun run typecheck` (includes `src/native` and the harness sources) | clean |
|
|
356
|
+
| Root `bun test ./test` | 1390 pass, 0 fail, 129 files (1335 baseline + 55 native) |
|
|
357
|
+
| Harness `bun run typecheck` | clean |
|
|
358
|
+
| Harness `bun run test` | 298 pass, 0 fail, 42 files (290 baseline + 8 for Gate 1) |
|
|
359
|
+
|
|
360
|
+
**Status against the plan.** Gates 1, 2 and 3 are implemented with the
|
|
361
|
+
evidence listed in steps 2, 4 and 5. No regression was found and none is left
|
|
362
|
+
unfixed. Each gate still needs the independent review the plan asks for; the
|
|
363
|
+
implementer's own review is what this log records.
|
|
364
|
+
|
|
365
|
+
**For the reviewer, in order of weight.**
|
|
366
|
+
|
|
367
|
+
1. The change to the reviewed session base: consumer handlers for a
|
|
368
|
+
backend-started turn (step 4, drift).
|
|
369
|
+
2. The atomicity drift of the startup batch (step 1): composed transitions
|
|
370
|
+
instead of one storage transaction.
|
|
371
|
+
3. Host records outside acp-client's persistence, and partial reconciliation
|
|
372
|
+
after an acp-client restart (step 4, gaps).
|
|
373
|
+
4. The retry policy chosen for the spec's open decisions (step 4).
|
|
374
|
+
5. The three relaxed conformance assertions for a backend-scheduled controller.
|
|
375
|
+
|
|
376
|
+
**Follow-up boundary, unchanged from the plan.** Bounded recovery for turns
|
|
377
|
+
and inputs, consumer-registered tool callbacks, broader operator controls, the
|
|
378
|
+
long-running mock, and context reset each need their own design.
|
|
379
|
+
|
|
380
|
+
## Independent review follow-up
|
|
381
|
+
|
|
382
|
+
Fix branch `aiagent/cod1a-acp-client-integration` starts from docs revision
|
|
383
|
+
`c17d525` and behavior revision `acd749b`. Gro is reviewing via inbox.
|
|
384
|
+
|
|
385
|
+
A startup regression reproduced a connection arriving after the deadline.
|
|
386
|
+
The abandoned connection still initialized and was never killed. Startup now
|
|
387
|
+
kills a connection returned after the deadline and checks the deadline before
|
|
388
|
+
continuing asynchronous open and recovery steps. Root typecheck and both
|
|
389
|
+
focused startup deadline tests passed.
|
|
390
|
+
|
|
391
|
+
## Independent approval and closure
|
|
392
|
+
|
|
393
|
+
Gro approved behavior revision `7133c5c651122d1736f25ca358c6f34b49a9ff10`
|
|
394
|
+
on a clean tree, covering Gates 1–3. The accepted chain includes startup contract
|
|
395
|
+
`83c2d0f`, harness implementation `f564290`, controller integration base
|
|
396
|
+
`004cc7f`, native adapter `58860fd`, real stdio checkpoint `acd749b`,
|
|
397
|
+
and docs baseline `c17d525`.
|
|
398
|
+
|
|
399
|
+
Both independent typechecks passed. Root `bun test ./test` passed 1391 tests
|
|
400
|
+
with 5868 assertions across 129 files (197.78s), including the nine native
|
|
401
|
+
conformance cases and the late-connection regression. The real SQLite stdio
|
|
402
|
+
checkpoint verified shared startup, steering and approval, isolated force stop,
|
|
403
|
+
missed-reply reconciliation, lost push and open responses, and Agent reopen and
|
|
404
|
+
shutdown. The harness suite passed 297 tests and had one stdio timeout on
|
|
405
|
+
`session/create` in the incompatible-checkpoint case (42 files, 149.11s).
|
|
406
|
+
Its in-process twin passed, and the isolated suspension suite passed all 15
|
|
407
|
+
tests with 196 assertions (7.42s). The reviewer accepted the rerun and retained
|
|
408
|
+
the existing client timeout. Local exploratory suites overlapped with each other
|
|
409
|
+
and with edits, so the clean-revision independent runs are the acceptance evidence.
|
|
410
|
+
|
|
411
|
+
The review reproduced a launcher timing gap beyond the existing initialize
|
|
412
|
+
timeout coverage. The regression isolated the late connection, and the fix
|
|
413
|
+
fenced subsequent startup work as well. A late connection still increments
|
|
414
|
+
the launch count before being closed.
|
|
415
|
+
|
|
416
|
+
Accepted limitations include composed startup channel transitions under decision
|
|
417
|
+
0020. A crash can leave a prefix applied, and the host resends the newest
|
|
418
|
+
unconfirmed desired state. Repeated loads on the same connection return the
|
|
419
|
+
recorded results. Default host records live in the acp-client process. They
|
|
420
|
+
survive a native-harness process restart while acp-client stays up, as exercised
|
|
421
|
+
in checkpoints 5, 6a, and 6b. Retaining those records across an acp-client restart
|
|
422
|
+
requires a supplied file store. Restoring in-flight work after acp-client process
|
|
423
|
+
death is outside this checkpoint. Failed-start
|
|
424
|
+
saved submissions are dropped. Unknown submissions are retried after reopen,
|
|
425
|
+
and an ambiguous push is repeated once. Unavailable or stale approval answers
|
|
426
|
+
return false without retry.
|
|
427
|
+
|
|
428
|
+
Usage is not forwarded, session-local withdrawal does not reach host withdrawal,
|
|
429
|
+
and receipt updates are available only through receiptOf. Backend-scheduled
|
|
430
|
+
conformance allows no user record, no endedBy, and no turn_failed if the backend
|
|
431
|
+
never accepted the message. The handler wiring for backend-started turns was
|
|
432
|
+
accepted. The real child checkpoint uses final text mode. Recovery pages messages,
|
|
433
|
+
with bounded turn and input recovery deferred.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# acp-client integration implementation plan
|
|
2
|
+
|
|
3
|
+
Date: 2026-11-20.
|
|
4
|
+
Status: proposed for review.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
Deliver the first scripted stdio checkpoint in [SPEC.md](SPEC.md) using the
|
|
9
|
+
[protocol profile](PROTOCOL.md). Start from a branch that contains the accepted
|
|
10
|
+
model-execution stack. Gate 1 can run on that base. Before Gate 2, combine the
|
|
11
|
+
Gate 1 revision with the reviewed `controller-interface` revision that provides
|
|
12
|
+
`ConversationController`. Record both revisions and the integration base in the
|
|
13
|
+
work log.
|
|
14
|
+
|
|
15
|
+
Keep the harness portable. Its code lives under `src/native-harness/`.
|
|
16
|
+
Production integration lives under acp-client's `src/native/` and imports
|
|
17
|
+
only the public harness entry points. Reuse the host launcher, conversation
|
|
18
|
+
records, and permission presentation where they fit. Keep the native adapter
|
|
19
|
+
opt-in and verify existing ACP conversations still behave as before.
|
|
20
|
+
|
|
21
|
+
## Code ownership
|
|
22
|
+
|
|
23
|
+
| Area | Code seam | Responsibility |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| Harness contracts and protocol | `src/native-harness/src/contracts/protocol.ts`, `src/native-harness/src/interfaces/protocol/server.ts`, and the public `HarnessClient` | Validate the create/load request, call the session operations through contracts, and return the applied batch before recovered work starts. |
|
|
26
|
+
| Harness state and lifecycle | `src/native-harness/src/state/storage/engine.ts`, storage contracts, and session assembly | Reuse the channel edit, suspend, and delete transitions. Keep durable state and conflict handling in storage and execution eligibility in the harness lifecycle. |
|
|
27
|
+
| acp-client host | New shared host under `src/native/`, with the launcher contract in `src/launcher.ts` | Own one process per agent, startup, reconnect, and process shutdown. Add the native launcher kind through the host launcher. |
|
|
28
|
+
| acp-client conversation adapter | New native controller under `src/native/`, wired through `src/conversation-controller/factory.ts` on the reviewed controller-interface base | Map harness events to the existing controller contract. Reuse host prompt records, supervisor attachment, and conversation finalization. |
|
|
29
|
+
|
|
30
|
+
The harness kernel depends on contracts. The host imports the public harness
|
|
31
|
+
client and transport entry points. Neither the protocol layer nor acp-client
|
|
32
|
+
duplicates channel state transitions.
|
|
33
|
+
|
|
34
|
+
## Implementation gates
|
|
35
|
+
|
|
36
|
+
| Gate | Owner and work | Evidence required |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| **1. Harness protocol** | Finalize the pending channel-change batch and outcomes. Record the contract decision before wiring create/load, storage transitions, and the typed client. Apply the startup batch before recovered work starts. | Offline suspension prevents early execution. Invalid batches leave channel state untouched. A blocked delete suspends the target and preserves accepted work while another channel remains usable. A lost open response is safe to retry, both on the same connection and after reconnect. |
|
|
39
|
+
| **2. acp-client adapter** | Implement `ConversationController` with the shared native host. Persist input before push and flush post-cutoff edits before fresh input. Buffer early turn output until the prepared prompt attaches. Map conversation `forceStop()` to targeted interruption and expose native `startFresh()` as unsupported. | Run controller conformance and existing ACP checks. Verify early output and terminal outcomes settle the prepared turn once. Concurrent first sends launch one process. Take before push acknowledgment still correlates. An old acknowledgment cannot clear a newer edit. An ambiguous push uses its saved ID and payload. Verify `startFresh()` leaves the timeline intact. |
|
|
40
|
+
| **3. Real stdio checkpoint** | Drive the scripted harness through acp-client's public conversation interface and a real child process. Run the host and harness checks against the same revision. | Two conversations share one durable session. Input steers an active turn, one approval dispatches one call, and conversation `forceStop()` leaves the shared child and the other channel running. Lose a push response and an open response at their commit boundaries. Restart also recovers a missed committed reply without duplicating work or records. |
|
|
41
|
+
|
|
42
|
+
Use deterministic barriers for the startup and recovery cases. For the missed
|
|
43
|
+
reply check, stop the child after the reply commit and before the host records
|
|
44
|
+
it. Run the harness typecheck and offline suite, the acp-client checks relevant
|
|
45
|
+
to the adapter, and the public stdio checkpoint.
|
|
46
|
+
|
|
47
|
+
## Follow-up boundary
|
|
48
|
+
|
|
49
|
+
Use the current small-session recovery view for this checkpoint. Add bounded
|
|
50
|
+
recovery for turns and inputs before relying on long-running mock sessions.
|
|
51
|
+
Consumer-registered tool callbacks, broader operator controls, and the
|
|
52
|
+
long-running mock each have their own designs. Context reset is deferred.
|
|
53
|
+
|
|
54
|
+
## Handoff and review
|
|
55
|
+
|
|
56
|
+
Follow [AGENTS.md](../../../../AGENTS.md). Assign an implementer and an
|
|
57
|
+
independent reviewer for the checkpoint. Record the base, test evidence,
|
|
58
|
+
findings, and exact revisions in `LOG.md` when work starts. Review each gate
|
|
59
|
+
before building on it, with particular attention to the load-to-execution
|
|
60
|
+
ordering and to host records after a disconnect.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# acp-client integration protocol
|
|
2
|
+
|
|
3
|
+
Date: 2026-11-20.
|
|
4
|
+
Status: proposed for review.
|
|
5
|
+
|
|
6
|
+
Companion to the [integration spec](SPEC.md). Use the typed public
|
|
7
|
+
`HarnessClient` over stdio. This document defines the acp-client integration
|
|
8
|
+
profile and the additions it needs on top of the reviewed model-execution
|
|
9
|
+
stack. The
|
|
10
|
+
[original protocol](../../../../../../.res/somelogs.md/11-11+/11-12-SPEC-harness-protocol.md)
|
|
11
|
+
already specifies applying pending channel changes at open. Preserve that
|
|
12
|
+
ordering with the current channel controls.
|
|
13
|
+
|
|
14
|
+
## Open and apply pending changes
|
|
15
|
+
|
|
16
|
+
Attach event handlers before `initialize`. Check that the server supports
|
|
17
|
+
durable sessions, channel controls, and the approval flow. Use
|
|
18
|
+
`session/load` first and `session/create` on a confirmed `not_found`. Load
|
|
19
|
+
uses the current rules for resolving inline, file, and saved config.
|
|
20
|
+
|
|
21
|
+
Extend create and load with an optional batch of coalesced channel changes.
|
|
22
|
+
The names below are proposed for the contract gate.
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
type PendingChannelChange = {
|
|
26
|
+
channel: string
|
|
27
|
+
changeId: string
|
|
28
|
+
displayName?: string | null
|
|
29
|
+
policy?: string | null
|
|
30
|
+
lifecycle?: "open" | "suspended" | "retired"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type ChannelChangeResult = {
|
|
34
|
+
channel: string
|
|
35
|
+
changeId: string
|
|
36
|
+
outcome: "applied" | "blocked"
|
|
37
|
+
reason?: "channel_busy" | "channel_retired" | "incompatible"
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`changeId` identifies the host's version of the change. Missing fields leave
|
|
42
|
+
existing values alone. Null clears a name or policy. The first batch supports
|
|
43
|
+
creation, name and policy edits, explicit suspension and resume, and retirement.
|
|
44
|
+
`open` clears an individual suspension, with execution still subject to the
|
|
45
|
+
session's lifecycle. New channels can be provisioned by the batch. A retired ID
|
|
46
|
+
cannot be reopened. A repeated retirement of that same ID is already applied.
|
|
47
|
+
|
|
48
|
+
Reject the whole batch before applying any channel changes if an entry is
|
|
49
|
+
malformed, a channel appears twice, or a policy name is unknown. For a valid
|
|
50
|
+
batch, resolve each channel change atomically with its channel state:
|
|
51
|
+
|
|
52
|
+
- Apply successful changes before making recovered work eligible. Return the
|
|
53
|
+
result for each change in the open response.
|
|
54
|
+
- If retirement is blocked by pending input or a checkpoint, durably suspend
|
|
55
|
+
that channel and return `blocked` with `channel_busy`. Preserve its pending
|
|
56
|
+
input and checkpoint. Continue opening the rest of the session.
|
|
57
|
+
- A request to reopen a retired ID returns `blocked` with `channel_retired`
|
|
58
|
+
and leaves the ID retired. A resume against an incompatible checkpoint
|
|
59
|
+
returns `blocked` with `incompatible` and leaves the checkpoint suspended.
|
|
60
|
+
Independent channel changes can still apply.
|
|
61
|
+
- An open or load response does not resume a suspended session. Apply ordinary
|
|
62
|
+
checkpoint compatibility checks before resuming an individual channel.
|
|
63
|
+
- A changed policy applies to future acceptance. Previously accepted inputs
|
|
64
|
+
keep their resolved policies.
|
|
65
|
+
|
|
66
|
+
The load view includes the resulting channel state and is sent before events
|
|
67
|
+
from recovered work. The before-execution guarantee covers the batch sent
|
|
68
|
+
with open. Later edits go through the live channel API.
|
|
69
|
+
|
|
70
|
+
acp-client clears a local pending change only after receiving an applied result
|
|
71
|
+
with the matching `changeId`. Pending deletion stays pending until confirmed.
|
|
72
|
+
On the same open connection, a repeated load returns a fresh recovery view
|
|
73
|
+
with the recorded startup results, without applying the batch again. A
|
|
74
|
+
different batch on an already-open connection is rejected. Use the live
|
|
75
|
+
channel API for newer changes.
|
|
76
|
+
|
|
77
|
+
On a new connection, send only the newest pending desired state per channel.
|
|
78
|
+
An already-applied change can be applied to the same effect, including a delete
|
|
79
|
+
that finds its ID already retired. A blocked change can be re-evaluated after
|
|
80
|
+
its obstacle is resolved. This assumes one managing host per session. The
|
|
81
|
+
protocol does not retain a durable ledger of startup commands or arbitrate
|
|
82
|
+
conflicting intents from independent hosts.
|
|
83
|
+
|
|
84
|
+
## Input, turn, and approval mapping
|
|
85
|
+
|
|
86
|
+
| Wire operation or event | Host interpretation |
|
|
87
|
+
| --- | --- |
|
|
88
|
+
| `channel/push` | Save the stable input ID and exact payload on the host before sending. Success acknowledges durable receipt. Recover an ambiguous submission by reconciliation or retry with the same ID and payload. |
|
|
89
|
+
| `turn_started`, `turn_took` | Associate the listed input IDs with the turn. A message folded into a running turn settles with that turn. |
|
|
90
|
+
| `items_receipt` | Update Delivered or Seen for the named inputs. Take and model receipts represent different milestones. |
|
|
91
|
+
| `message_completed` | Upsert the committed reply by message ID. Resolve a reference through `session/message/read`. Fold live deltas into the same message ID when streaming. |
|
|
92
|
+
| `approval_requested`, `approval/respond` | Route a specific call to the consumer and answer once. Without an approval handler, leave the call unapproved and resolve promptly. Keep late answers closed. |
|
|
93
|
+
| `channel/withdraw` | Settle a waiting prompt as withdrawn when confirmed. If already taken, keep its association with the reported turn. |
|
|
94
|
+
| `channel/interrupt`, `turn_ended` | Interrupt the named turn only. Settle its associated prompts from the terminal event or recovered outcome. |
|
|
95
|
+
|
|
96
|
+
Use the existing `final` and `stream` subscriptions. Host-side queueing
|
|
97
|
+
controls when acp-client submits an input. The harness has one take behavior.
|
|
98
|
+
The profile has no agent-wide or channel context reset operation. Opening a new
|
|
99
|
+
channel preserves the session identity and timeline.
|
|
100
|
+
|
|
101
|
+
## Recovery view
|
|
102
|
+
|
|
103
|
+
Use the current revisioned `session/load` view for the first small scripted
|
|
104
|
+
integration. Reconcile channel states, turns, inputs, and committed messages
|
|
105
|
+
by stable IDs. Buffer events arriving after the load response while applying
|
|
106
|
+
the view, then apply them in delivery order. Several events can share a
|
|
107
|
+
revision. A revision identifies the snapshot boundary rather than one event.
|
|
108
|
+
|
|
109
|
+
Before long-running mock sessions depend on reopen, add a bounded recovery view.
|
|
110
|
+
The open response supplies a revision and initial pages or cursors for channel,
|
|
111
|
+
turn, input, and message records. Read further pages against the same view so
|
|
112
|
+
later updates cannot alter its contents halfway through reconciliation. Use
|
|
113
|
+
opaque cursors and bound each page by encoded bytes. An oversized reply uses a
|
|
114
|
+
message reference and the existing bounded text reads. The contract gate
|
|
115
|
+
defines cursor lifetime, cleanup, and how to recover when a view expires.
|
|
116
|
+
|
|
117
|
+
If the process dies after committing a reply but before publishing it, reopen
|
|
118
|
+
finds the reply by its original ID. If a turn was interrupted, acp-client
|
|
119
|
+
settles the inputs it took with that outcome. An untaken accepted input is
|
|
120
|
+
still pending. Preserve reported uncertain tool outcomes. Reopen never
|
|
121
|
+
replays an interrupted tool call or restores an old approval grant.
|
|
122
|
+
|
|
123
|
+
## Contract checks
|
|
124
|
+
|
|
125
|
+
- Reopen with a suspension made while stopped. Verify no recovered turn
|
|
126
|
+
starts on that channel and another channel can run.
|
|
127
|
+
- Reopen with a delete blocked by pending work. Verify the target is suspended,
|
|
128
|
+
its work is intact, and the host leaves the change pending.
|
|
129
|
+
- Simulate a newer local edit while an earlier change is in flight. Verify the
|
|
130
|
+
earlier acknowledgment cannot clear the newer edit, and that fresh host
|
|
131
|
+
input waits for the live edit to apply.
|
|
132
|
+
- Reject an invalid batch without changing any channels. Confirm other
|
|
133
|
+
channels can open when a valid batch contains a state conflict.
|
|
134
|
+
- Lose a push response after durable acceptance. Reconcile or retry using
|
|
135
|
+
the host's saved submission and verify that only one input exists.
|
|
136
|
+
- Lose the open response after the batch commits. Verify a repeated load
|
|
137
|
+
on the same connection reports the original results without reapplying
|
|
138
|
+
changes. Reconnect and verify that retrying desired state is safe.
|
|
139
|
+
- Recover a missed committed reply and pending and interrupted inputs. Before
|
|
140
|
+
the long-running mock gate, exercise a recovery view larger than one frame
|
|
141
|
+
while live events continue beyond its revision.
|