@qlairoslabs/acp-client 0.12.1 → 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 -10
- package/CHANGELOG-controller-interface.md +258 -0
- package/CHANGELOG-metering.md +29 -0
- package/CHANGELOG-operation-lifecycle.md +15 -1
- package/CONSUMER_GUIDE.md +845 -6
- 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 +25 -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 +3 -0
- package/src/cli/index.ts +3 -3
- package/src/cli/managed.ts +2 -2
- package/src/client.ts +52 -94
- 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,71 @@
|
|
|
1
|
+
# 0020: Channel changes applied at session open
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
|
|
5
|
+
A host edits, suspends or deletes channels while the harness is stopped. Those
|
|
6
|
+
changes must take effect before work recovered by the next open can run.
|
|
7
|
+
The live channel API (0014) only exists after open, when recovered work may
|
|
8
|
+
already be eligible. See the
|
|
9
|
+
[acp-client integration protocol](../docs/acp-client-integration/0001-DESIGN/PROTOCOL.md).
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
(a) Have the host open, then call the live channel API, and delay `start` with a
|
|
14
|
+
separate "ready" request. (b) Carry one coalesced batch on `session/create` and
|
|
15
|
+
`session/load` and apply it before the session starts. (c) A new storage
|
|
16
|
+
transaction for the whole batch, or (d) compose the existing per-channel
|
|
17
|
+
storage transitions before start.
|
|
18
|
+
|
|
19
|
+
## Choice
|
|
20
|
+
|
|
21
|
+
(b) with (d). `session/create` and `session/load` accept an optional
|
|
22
|
+
`channelChanges: PendingChannelChange[]` and return `channelChanges:
|
|
23
|
+
ChannelChangeResult[]`, one result per entry in request order. The field is
|
|
24
|
+
present in a result only when a batch was sent or recorded. A server advertises
|
|
25
|
+
the feature as `capabilities.startupChannelChanges: true`.
|
|
26
|
+
|
|
27
|
+
- **Entry.** `{ channel, changeId, displayName?, policy?, lifecycle? }`. A
|
|
28
|
+
missing field leaves the value alone; `null` clears a name or policy.
|
|
29
|
+
`lifecycle` is `open`, `suspended` or `retired`. `changeId` is opaque to the
|
|
30
|
+
harness and echoed back; the host uses it to match its own version.
|
|
31
|
+
- **Validation.** The whole batch is rejected with `invalid_params` (or
|
|
32
|
+
`invalid_policy` for an unknown policy name), before any channel changes and
|
|
33
|
+
before the session is started, when an entry is malformed, has an unknown
|
|
34
|
+
field, repeats a channel, or names a policy the open's configuration lacks.
|
|
35
|
+
- **Application.** Each entry reuses the 0014 transitions through
|
|
36
|
+
`PersistentSession.channels`; no storage contract changes. An unknown channel
|
|
37
|
+
is created. The lifecycle step is decided first and the name and policy are
|
|
38
|
+
written only if it is not blocked, so a blocked entry changes nothing except
|
|
39
|
+
as stated below. Entries are independent: one blocked entry never stops the
|
|
40
|
+
others or the open.
|
|
41
|
+
- **Outcomes.** `applied`, or `blocked` with a reason:
|
|
42
|
+
`channel_busy` — retirement found pending input or a running or checkpointed
|
|
43
|
+
turn; the channel is durably suspended instead and its work kept.
|
|
44
|
+
`channel_retired` — the ID is retired and the entry asks for anything but
|
|
45
|
+
retirement (a repeated retirement is `applied`).
|
|
46
|
+
`incompatible` — resuming would continue a checkpoint or policy reference the
|
|
47
|
+
current configuration cannot run; the channel stays suspended.
|
|
48
|
+
- **Ordering.** The batch is applied after recovery and before `start`. The
|
|
49
|
+
load view is read after the batch, so it shows the resulting channel state,
|
|
50
|
+
and events from recovered or resumed work follow the response as in 0013.
|
|
51
|
+
Resumes are applied last and synchronously with the view, because resuming a
|
|
52
|
+
checkpoint makes that turn run. An open never resumes a suspended session.
|
|
53
|
+
- **Retry.** The endpoint records the batch and its results. A repeated
|
|
54
|
+
`session/load` on the same connection with the same batch, or with none,
|
|
55
|
+
returns a fresh view and the recorded results without applying anything. A
|
|
56
|
+
different batch on an open connection fails `invalid_state`; later changes use
|
|
57
|
+
the live channel API. On a new connection the host resends its newest desired
|
|
58
|
+
state: every transition is idempotent, so an already-applied entry applies to
|
|
59
|
+
the same effect and a blocked entry is re-evaluated. No durable ledger of
|
|
60
|
+
change IDs is kept, which assumes one managing host per session.
|
|
61
|
+
- **Atomicity.** An entry is several storage transactions, not one. Nothing can
|
|
62
|
+
interleave because the session has not started and the endpoint admits no
|
|
63
|
+
other request for the session until the open is answered. A crash mid-batch
|
|
64
|
+
leaves a prefix applied; the host has no confirmation and resends.
|
|
65
|
+
|
|
66
|
+
## Compatibility
|
|
67
|
+
|
|
68
|
+
Additive and optional on the wire. Old hosts send no batch and see no new
|
|
69
|
+
field. A host must check the capability before relying on the ordering
|
|
70
|
+
guarantee: an older server rejects the unknown `channelChanges` field with
|
|
71
|
+
`invalid_params`. No storage format or archive change.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# 0021: Tool catalog, invocation lifecycle and host callbacks
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
|
|
5
|
+
A consumer needs to register functions the model can call. Today tools are
|
|
6
|
+
fixed by session assembly, a call has only the provider's ID, a skipped or
|
|
7
|
+
timed-out call is indistinguishable in storage from a success, and the protocol
|
|
8
|
+
carries requests in one direction only. See the
|
|
9
|
+
[spec](../docs/tools-and-callbacks/0001-DESIGN/SPEC.md).
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
Catalog in the managed config, or supplied with each open. Invocation records
|
|
14
|
+
in a new table, or derived from the evidence storage already keeps. Callback as
|
|
15
|
+
a host-polled queue, or a request from harness to host on the same connection.
|
|
16
|
+
Large results stored by the harness, or by whoever produced them.
|
|
17
|
+
|
|
18
|
+
## Choice
|
|
19
|
+
|
|
20
|
+
**Catalog.** `session/create` and `session/load` take `tools: { catalog,
|
|
21
|
+
enabled?, defaultDeadlineMs? }`. Each entry is `{ name, description,
|
|
22
|
+
parameters, handler, group, deadlineMs? }`; `group` is `fixed`, `revocable` or
|
|
23
|
+
`runtime`. Definitions are supplied on every open and are not stored. Names are
|
|
24
|
+
unique across the catalog and the built-ins; a duplicate, a malformed entry or
|
|
25
|
+
an `enabled` name that is not a `runtime` entry rejects the open with nothing
|
|
26
|
+
opened. A repeated load must repeat the same `tools` or omit it
|
|
27
|
+
(`invalid_state` otherwise). `tool/revoke` and `tool/restore` act on
|
|
28
|
+
`revocable` entries and are durable; `tool/enable` and `tool/remove` act on
|
|
29
|
+
`runtime` entries and live in memory; any of them on another group is
|
|
30
|
+
`invalid_state`, an unknown name `not_found`. `session/tools` lists every
|
|
31
|
+
entry with `available` and, when false, one `reason`: `revoked`,
|
|
32
|
+
`not_enabled` or `handler_missing`. Availability says nothing about policy.
|
|
33
|
+
|
|
34
|
+
**Handlers.** `initialize` accepts `callbacks: ["functions/call"]` and
|
|
35
|
+
`functions: string[]`, the handler names this connection serves. A tool whose
|
|
36
|
+
handler is not served is unavailable. A server advertises
|
|
37
|
+
`capabilities.functions: true`.
|
|
38
|
+
|
|
39
|
+
**Offered tools.** Each inference offers the built-ins and the available
|
|
40
|
+
catalog entries that the turn's policy does not deny, fixed group first, then
|
|
41
|
+
by name. `ModelRequest.fixedToolCount` marks the stable prefix. The request is
|
|
42
|
+
frozen for the call, so a retry offers the same list. The set offered by the
|
|
43
|
+
latest inference is what dispatch checks against.
|
|
44
|
+
|
|
45
|
+
**Dispatch order**, at the existing gate: policy (`deny` gives
|
|
46
|
+
`policy_denied`, as before); for a catalog tool, offered in this request and
|
|
47
|
+
still available (`tool_unavailable`); arguments valid against the definition
|
|
48
|
+
(`invalid_arguments`); approval when policy says `ask`; availability again
|
|
49
|
+
after the approval (`tool_unavailable`); then dispatch evidence and the
|
|
50
|
+
executor. A pending approval is closed when its tool becomes unavailable. Every
|
|
51
|
+
skip commits the one paired result and dispatches nothing.
|
|
52
|
+
|
|
53
|
+
**Invocation.** The invocation ID is `<turnId>:<toolCallId>`; storage already
|
|
54
|
+
refuses a repeated call ID within a turn. A tool result may carry `outcome:
|
|
55
|
+
{ status, code?, reference? }`, `status` one of `succeeded`, `failed`,
|
|
56
|
+
`skipped`, `interrupted`; a result without it is a legacy success. The record
|
|
57
|
+
is derived, with no new table: `requested` (call committed, nothing else),
|
|
58
|
+
`waiting_for_approval` (live only), `started` (dispatch evidence, no result),
|
|
59
|
+
the stored `outcome`, or `interrupted` with `effect: "unknown"` when the turn
|
|
60
|
+
ended with evidence and no result. `tool_call` events carry `invocationId` and
|
|
61
|
+
gain `skipped` and `interrupted`. `session/tool-invocation` returns one record
|
|
62
|
+
by ID; `session/tool-invocations` lists a turn's.
|
|
63
|
+
|
|
64
|
+
**Callback.** After evidence commits, the harness sends a request
|
|
65
|
+
`functions/call` `{ invocationId, sessionId, channel, turnId, tool, handler,
|
|
66
|
+
arguments }` with its own numeric ID; IDs are per connection and per
|
|
67
|
+
direction. The host answers `{ output }`, `{ preview, reference }` or an error
|
|
68
|
+
`{ code, message }`. `functions/cancel { invocationId, reason }` is a
|
|
69
|
+
notification. A response is matched by request ID to an outstanding wait; one
|
|
70
|
+
for a closed wait is ignored. Handlers run off the read loop.
|
|
71
|
+
|
|
72
|
+
**Deadlines.** `deadlineMs` per tool, else `defaultDeadlineMs`, else none.
|
|
73
|
+
The clock starts at dispatch. On expiry with the turn live: cancel, commit one
|
|
74
|
+
paired result `tool_timeout` (`interrupted`, effect unknown), continue. An
|
|
75
|
+
interrupt or stop cancels and ends the turn under 0014 and 0018. A lost
|
|
76
|
+
connection fails the wait; the call stays dispatched without a result, so it
|
|
77
|
+
is uncertain and never repeated.
|
|
78
|
+
|
|
79
|
+
**Phase.** `activeTurn.phase` is `{ kind: "model" | "approval" | "tool", since,
|
|
80
|
+
id? }` with the model call, approval request or invocation ID. In memory.
|
|
81
|
+
|
|
82
|
+
**Large results.** The inline limit is 16384 bytes of serialized output. A
|
|
83
|
+
producer with more stores the bytes itself and returns `{ preview, reference:
|
|
84
|
+
{ resultId, bytes, retention, expiresAt? } }`. The reference is kept in the
|
|
85
|
+
tool result's `outcome`. The built-in `read_tool_result { result_id, offset?,
|
|
86
|
+
length? }` is offered while a catalog exists; the harness resolves the ID
|
|
87
|
+
against the references recorded for the requesting channel only, then sends
|
|
88
|
+
`results/read { resultId, invocationId, channel, offset, length }` to the
|
|
89
|
+
host. Unknown IDs and paths are `result_not_found`, another channel
|
|
90
|
+
`result_forbidden`, an expired result `result_expired`. An inline output over
|
|
91
|
+
the limit that reaches the harness fails `result_too_large`.
|
|
92
|
+
|
|
93
|
+
## Compatibility
|
|
94
|
+
|
|
95
|
+
Wire additions are optional. An old client sends no `functions` and receives
|
|
96
|
+
no callback. `tool_call` gains two statuses that only catalog tools produce.
|
|
97
|
+
Storage: `revokedTools` joins the snapshot and archive as an optional field,
|
|
98
|
+
and a tool result accepts `outcome`; SQLite format stays 5 and the archive 4,
|
|
99
|
+
as 0018 did for dispatch evidence. A file written here opens on the previous
|
|
100
|
+
revision except for results carrying `outcome`.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# 0022: Focused operator reads and attachment ownership
|
|
2
|
+
|
|
3
|
+
Full load couples readiness to history size. Keep lifecycle mutations in the
|
|
4
|
+
harness and replace wire load and message listing with focused open, observation,
|
|
5
|
+
tracked reconciliation and explicit history reads. Keep stored formats and
|
|
6
|
+
startup batch semantics. Open and create return identity, lifecycle, revision
|
|
7
|
+
and startup results before recovered work can publish events. Active model,
|
|
8
|
+
approval and callback phases retain their start timestamp and correlation ID.
|
|
9
|
+
|
|
10
|
+
The operator method map is in contracts/operator-controls.ts. Observe returns
|
|
11
|
+
current channel state, pending count, live or parked turn and outstanding
|
|
12
|
+
approvals at a revision boundary. Register delivery first, then reconcile and
|
|
13
|
+
drain buffered events in order. Revisions are boundaries rather than event IDs.
|
|
14
|
+
Reconcile accepts at most 100 unique IDs combined, scoped to the channel.
|
|
15
|
+
Foreign IDs appear unknown. Replies are metadata only and page independently
|
|
16
|
+
of item and turn dispositions. A continuation carries the original query and
|
|
17
|
+
revision and returns only further reply metadata. Open, observe and tracked
|
|
18
|
+
reads use focused storage operations on both adapters. SQLite uses indexes on
|
|
19
|
+
channel and sequence or the requested identities, without reading full history.
|
|
20
|
+
|
|
21
|
+
History pages default to 50 and accept limits 1–100. Bound complete wire
|
|
22
|
+
responses to the existing frame maximum. Cursor scope includes session, view,
|
|
23
|
+
channel when applicable, direction, initial revision and exclusive sequence
|
|
24
|
+
boundary. Invalid scope, direction, bounds or malformed cursor fails
|
|
25
|
+
invalid_params. Cursors survive reconnect and carry no authority. Backward
|
|
26
|
+
pages return the newest eligible records in chronological order and continue
|
|
27
|
+
before their oldest record. Forward pages advance after the saved position
|
|
28
|
+
through the inclusive observed revision. Save progress only after transcript
|
|
29
|
+
commit, and keep it before any unresolved gap. Live completion and history
|
|
30
|
+
share stable message IDs and channel-scoped positions. Use assistant text
|
|
31
|
+
references for large messages. Other oversized payloads retain attribution,
|
|
32
|
+
identity and an omitted marker. A scoped tool result reference is retained
|
|
33
|
+
when it fits. Every such entry advances the cursor. Conversation pages count
|
|
34
|
+
participant and assistant text only. Timeline pages include tool activity and
|
|
35
|
+
notices with source attribution.
|
|
36
|
+
|
|
37
|
+
The host owns one configured approval responder for all channels and routes
|
|
38
|
+
requests before conversation delivery. That responder alone answers when
|
|
39
|
+
configured. Otherwise preserve conversation handler behavior. Observe supplies
|
|
40
|
+
still-pending requests. Publish a closure notification keyed by request ID
|
|
41
|
+
when the approval becomes unavailable, including dispatch, denial, expiry and
|
|
42
|
+
cancellation. Disconnect invalidates the local pending view. Harness answers
|
|
43
|
+
remain authoritative for races. Attachment disposal affects observation only.
|
|
44
|
+
Controller stop confirms exact-turn interruption or that it already ceased,
|
|
45
|
+
then detaches. Loss before confirmation fails stop and prevents shared Restart
|
|
46
|
+
from starting. Agent stop suppresses reopen. Suspend waits for a committed
|
|
47
|
+
checkpoint while status and interrupts remain available. Intentional process
|
|
48
|
+
replacement preserves committed suspension until explicit resume.
|
|
49
|
+
|
|
50
|
+
The responder receives the exact request and an answer function returning the
|
|
51
|
+
harness acceptance outcome. Observers receive request data without that
|
|
52
|
+
function. The host deduplicates delivery by connection generation and request
|
|
53
|
+
ID, including during observation. Closure removes that ID from pending
|
|
54
|
+
presentation without changing the authority of an already in-flight answer.
|
|
55
|
+
Working counts include only running turns, regardless of attachments. A lost
|
|
56
|
+
observer marks its last agent status stale until the host can confirm it.
|
|
57
|
+
|
|
58
|
+
## Options and compatibility
|
|
59
|
+
|
|
60
|
+
Keep the full-load path with paging, or replace it with focused reads. Choose
|
|
61
|
+
focused reads so readiness and attachment never require transcript recovery.
|
|
62
|
+
Gate 2 removes session/load and session/messages from DurableMethods and
|
|
63
|
+
capabilities.methods. session/create returns OpenResult. There is no legacy
|
|
64
|
+
wire compatibility or wire migration. Stored formats remain unchanged.
|
|
65
|
+
|
|
66
|
+
## Binding details
|
|
67
|
+
|
|
68
|
+
On one connection, observe publishes events whose commits are included in the
|
|
69
|
+
observation revision before the response, and publishes later events after it.
|
|
70
|
+
Serialize no-revision notifications with that response too. Approval events
|
|
71
|
+
before the response are reflected in approvals. After taking the view, drop
|
|
72
|
+
buffered committed events at or below its revision for state reconciliation.
|
|
73
|
+
Deduplicate committed messages by ID when merging with separately read history.
|
|
74
|
+
For ephemeral events use the response's wire-order boundary: discard earlier
|
|
75
|
+
buffered notifications, apply subsequent ones in delivery order. Earlier drafts
|
|
76
|
+
and tool notifications are live-only and have no recovery guarantee. Seed the
|
|
77
|
+
approval set from observation, then apply subsequent request and closure events
|
|
78
|
+
by request ID. Keep this buffer and boundary local to the observed channel.
|
|
79
|
+
Observation includes session lifecycle and waitingForResume at the same revision.
|
|
80
|
+
|
|
81
|
+
Publish approval_closed exactly once after approval_requested for each request
|
|
82
|
+
leaving pending. Use the existing ApprovalCloseReason, or dispatched when
|
|
83
|
+
allow_once reaches dispatch. A grant awaiting dispatch remains tracked until
|
|
84
|
+
dispatch or cancellation. Disconnect closes the internal request even when
|
|
85
|
+
there is no remaining connection to deliver its event. Only approval-capable
|
|
86
|
+
connections receive actionable approvals and their lifecycle notifications.
|
|
87
|
+
approval/respond returns accepted true when its answer wins. Late, duplicate
|
|
88
|
+
and unknown IDs return not_found. A connection that did not declare approval
|
|
89
|
+
gets invalid_state.
|
|
90
|
+
|
|
91
|
+
Assistant message IDs use the reserved ID, with the existing numeric sequence
|
|
92
|
+
fallback for legacy entries. Participant messages use item:<itemId> and also
|
|
93
|
+
expose the original itemId. Their parts contain the original participant text,
|
|
94
|
+
without the model-context attribution prefix. Each live take reports these
|
|
95
|
+
message identities and positions alongside its item IDs. Both live completion
|
|
96
|
+
and paging use the same position derived from the committed sequence, encoded
|
|
97
|
+
with its session and channel scope. The Gate 1 event fields are optional for
|
|
98
|
+
existing producers until Gate 2 populates them on every eligible wire event.
|
|
99
|
+
Notice actors are agents attributed to their source channel. Timeline entries
|
|
100
|
+
preserve bounded typed message payloads, including assistant tool-call data.
|
|
101
|
+
|
|
102
|
+
Use a partial SQLite index on (channel_id, seq) for conversation-eligible
|
|
103
|
+
entries and a partial index on (turn_id, seq) for committed assistant text
|
|
104
|
+
reply lookup. Persist indexed eligibility projections, backfilled once for
|
|
105
|
+
existing SQLite sessions without bumping the format. Global timeline uses the
|
|
106
|
+
sequence primary key, and turn-reply results merge bounded indexed ranges for
|
|
107
|
+
the requested turns. Memory maintains corresponding ordered indexes. Each
|
|
108
|
+
range reads at most limit plus one eligible entry. Gate 2 covers these adapter
|
|
109
|
+
contracts in test/conformance/storage.ts on both adapters. The protocol owns
|
|
110
|
+
wire byte budgeting and projection, not storage.
|
|
111
|
+
|
|
112
|
+
A malformed turn ID (anything outside canonical positive safe-integer strings),
|
|
113
|
+
duplicate IDs within either ID list, more than 100 combined IDs, or an after
|
|
114
|
+
position from another session or channel returns invalid_params. Syntactically
|
|
115
|
+
valid unknown or foreign tracked IDs stay unknown.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# 0023 Long-running mock scenarios
|
|
2
|
+
|
|
3
|
+
## Problem and options
|
|
4
|
+
|
|
5
|
+
Short fixtures use several JSON wrappers and long rehearsals need schedules.
|
|
6
|
+
Separate file formats or a file-driven command language would split validation
|
|
7
|
+
and duplicate lifecycle behavior. Use one JSONL script and keep barriers and
|
|
8
|
+
control commands in the consumer's test code.
|
|
9
|
+
|
|
10
|
+
## Record and attempt contract
|
|
11
|
+
|
|
12
|
+
Use UTF-8 JSONL without BOM. Accept LF or CRLF and an optional final newline.
|
|
13
|
+
Reject blank records, duplicate keys (including nested duplicates), unknown
|
|
14
|
+
fields, invalid UTF-8, unsupported versions and invalid types. Diagnostics
|
|
15
|
+
identify the file and one-based line. The first record is exactly
|
|
16
|
+
`{type:"scenario",version:1,name}`. IDs, names and failure messages are nonblank
|
|
17
|
+
strings. Require at least one model record. Sends have nonblank text and
|
|
18
|
+
globally unique input IDs. Delays and offsets are nonnegative safe integer
|
|
19
|
+
milliseconds. Usage counts obey decision 0019. Calls take nonblank IDs and
|
|
20
|
+
names and an arguments object, with unique IDs within the attempt.
|
|
21
|
+
|
|
22
|
+
A model has exactly one terminal form: `content` with optional `calls`,
|
|
23
|
+
`failure:{kind,message}` using existing neutral failure kinds, or
|
|
24
|
+
`wait:"cancel"`. Optional `delayMs`, `usage` and ordered
|
|
25
|
+
`chunks:[{afterMs,text}]` apply to all forms. After the initial delay emit
|
|
26
|
+
accepted and any usage, then nonempty chunks at relative delays. On success
|
|
27
|
+
their concatenation must equal content. Null content permits only empty or
|
|
28
|
+
absent chunks. For a response with calls, emit chunks before tool_calls. A failure follows its chunks. A wait
|
|
29
|
+
has no terminal until the runner cancels it. Delays and waits honor abort.
|
|
30
|
+
Success without chunks emits only the complete response. A response with calls
|
|
31
|
+
uses tool_calls; all others use complete. Calls use ordinary dispatch.
|
|
32
|
+
Selection is the exact channel sequence if one exists, otherwise the default
|
|
33
|
+
sequence. Exhaustion emits nonretryable failure kind provider with message
|
|
34
|
+
script_exhausted. The attempt records provider_failure and the turn’s failure
|
|
35
|
+
reason identifies script_exhausted. Each durable
|
|
36
|
+
attempt reserves its channel's next index. A retry and an abandoned reservation
|
|
37
|
+
each consume one record. Request capture is opt-in. A lightweight attempt
|
|
38
|
+
observer reports channel, reservation, and frozen taken input IDs independently
|
|
39
|
+
of capture. The runner supplies boundary-local IDs in take order and the attempt
|
|
40
|
+
ordinal to the observer. The first boundary reports the initial group. Later
|
|
41
|
+
ones report only IDs taken since the preceding boundary, including across
|
|
42
|
+
checkpoint resume. Retries share the same frozen list. This is independent
|
|
43
|
+
of the existing receipt set. Provider clients omit takenItemIds from their
|
|
44
|
+
wire requests. Gate 2 pins this in a golden provider request. Neither observation nor scheduling can select a response.
|
|
45
|
+
|
|
46
|
+
## Identity and compatibility
|
|
47
|
+
|
|
48
|
+
The model digest is lowercase SHA-256 of canonical JSON of the default
|
|
49
|
+
sequence and sorted channel/sequence pairs. Keep per-sequence order and call
|
|
50
|
+
order, sort object keys recursively, omit discriminator and channel fields
|
|
51
|
+
inside sequences, and normalize omitted delays, chunks and calls to zero or
|
|
52
|
+
empty. Omitted usage stays absent. An explicit reported zero changes the
|
|
53
|
+
digest. Exclude the header name, send records and formatting. The separate
|
|
54
|
+
file digest hashes the original bytes. Parse and validate once per open.
|
|
55
|
+
|
|
56
|
+
Persist the digest in the existing session compatibility key
|
|
57
|
+
`scripted-jsonl-v1:<digest>:<sha256 of JSON.stringify(system)>`. Pass
|
|
58
|
+
`requiredScriptDigest` for scripted owners. Both segments are lowercase 64-character hexadecimal SHA-256.
|
|
59
|
+
Both adapters compare the digest segment exactly under ownership before a
|
|
60
|
+
format upgrade, recovery, attempt repair, reservation, or other writes.
|
|
61
|
+
Untagged and malformed keys also fail the opt-in check.
|
|
62
|
+
A missing digest or mismatch returns incompatible, including after crashes
|
|
63
|
+
with pending inputs and no checkpoint. The existing checkpoint comparison uses the entire key. A matching digest
|
|
64
|
+
with a changed system permits open and blocks checkpoint resume. The format
|
|
65
|
+
versions and archives remain unchanged. Existing scripted sessions without a
|
|
66
|
+
digest require fresh sessions. OpenRouter and other storage callers keep
|
|
67
|
+
their existing behavior. The previous on-disk JSON wrapper is unsupported.
|
|
68
|
+
|
|
69
|
+
## Completion
|
|
70
|
+
|
|
71
|
+
The driver issues sends by monotonic offset with ties in file order. It keeps
|
|
72
|
+
its action position in memory across child replacements. Resolve accepted
|
|
73
|
+
inputs by ID to terminal turns and retain their grouping. Then require no
|
|
74
|
+
unexpected running, pending or checkpointed work on any channel, including
|
|
75
|
+
notice targets. Idle alone is insufficient. Use session/status plus targeted
|
|
76
|
+
reconcile and bounded history. Capture the settled status revision, page
|
|
77
|
+
delivery within the expected channel windows, and verify the same revision
|
|
78
|
+
and settled state again. If they changed, discard that comparison and retry
|
|
79
|
+
within the deadline. Model-attempt and receipt commits can advance the revision
|
|
80
|
+
while work is active. No such advances are legal for settled turns. No additional public wire method is needed. On deadline
|
|
81
|
+
report blockers before bounded child cleanup. Report unused model records
|
|
82
|
+
separately. Compare expected committed assistant IDs against consumer records.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 0024 Callback policy names
|
|
2
|
+
|
|
3
|
+
## Problem and options
|
|
4
|
+
|
|
5
|
+
The callback consumer needs the policy names that authorized the invocation
|
|
6
|
+
to apply its own rules. Model arguments are untrusted. Re-reading policy
|
|
7
|
+
inputs after an approval can give the callback a different answer from
|
|
8
|
+
the authorization gate. Carry the authorization snapshot as required wire
|
|
9
|
+
metadata.
|
|
10
|
+
|
|
11
|
+
## Choice
|
|
12
|
+
|
|
13
|
+
After structural tool checks and before deciding allow, ask, or deny,
|
|
14
|
+
collect one deduplicated snapshot from the stored resolved and inherited
|
|
15
|
+
policy names of inputs already taken by the turn. Notices contribute their
|
|
16
|
+
transitive inherited names. Pending inputs contribute when taken, and channel
|
|
17
|
+
policy edits affect later admissions under the existing policy rules.
|
|
18
|
+
Evaluate the tool decision using that snapshot and the open configuration.
|
|
19
|
+
Retain it across approval and use it to build the callback at dispatch.
|
|
20
|
+
Neither approval nor dispatch re-reads the contributors for this invocation.
|
|
21
|
+
Existing denial, cancellation, and one-time dispatch rules still apply.
|
|
22
|
+
|
|
23
|
+
The callback carries the same set with the internal `__legacy_allow`
|
|
24
|
+
fallback omitted. The fallback still participates in authorization as
|
|
25
|
+
before. Empty explicitly means no configured policy contributed. Names
|
|
26
|
+
retain their exact spelling and are sorted lexically for reproducible
|
|
27
|
+
output. Order grants no precedence. The harness
|
|
28
|
+
sets the field independently of model arguments, including any argument
|
|
29
|
+
that happens to be named policyNames.
|
|
30
|
+
|
|
31
|
+
Both stdio and in-process validate the required top-level field before
|
|
32
|
+
invoking a handler. It must be an array of unique nonblank strings. A
|
|
33
|
+
missing field, wrong type, duplicate, or leaked legacy sentinel is
|
|
34
|
+
`invalid_params`. The harness records one paired failed tool result
|
|
35
|
+
through the existing callback error path, without retrying. Expose the received names as read-only metadata in
|
|
36
|
+
`NativeFunctionContext`. The orchestrator owns name lookup against the
|
|
37
|
+
mapping bound at open, refusal of unknown names, default worker rules for
|
|
38
|
+
the empty list, and retaining resolved assignment rules. These are separate
|
|
39
|
+
orchestrator acceptance cases.
|
|
40
|
+
|
|
41
|
+
## Compatibility
|
|
42
|
+
|
|
43
|
+
Update the native harness and acp-client together. Older callbacks with the
|
|
44
|
+
field absent are incompatible with this boundary and are refused. An
|
|
45
|
+
explicit empty list is valid. There is no new capability, storage change,
|
|
46
|
+
archive version, or migration.
|