@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
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
# Consumer fixes (from the 2026-10-13 agents-core requirements)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
0.12.0 and 0.12.1. Upgrading from 0.10.x: see `MIGRATION-0.10-to-0.12.md`.
|
|
4
|
+
|
|
5
|
+
## 0.12.1
|
|
6
|
+
|
|
7
|
+
- **Longer stale limits by default.** A turn, internal inference or recap now counts as stalled
|
|
8
|
+
after 600 s (10 minutes) with no output at all, or 900 s (15 minutes) after its last output,
|
|
9
|
+
instead of 120 s and 180 s: slow but working agents were being cancelled. Set
|
|
10
|
+
`operationLifecycle` to choose other limits.
|
|
11
|
+
- **Grok Build preset.** `ADAPTERS.grok` launches xAI's Grok Build over ACP
|
|
12
|
+
(`grok --no-auto-update agent stdio`). A Grok session that no longer exists is recognised as
|
|
13
|
+
missing, so checkpoint recovery applies to it.
|
|
14
|
+
- **Additional directories only when advertised.** The client sends `additionalDirectories` only to an
|
|
15
|
+
agent that advertises `sessionCapabilities.additionalDirectories`, as ACP requires; otherwise they
|
|
16
|
+
are left out with a warning (`additional_directories_unsupported`). Grok refused session requests
|
|
17
|
+
that carried them.
|
|
18
|
+
|
|
19
|
+
## 0.12.0
|
|
4
20
|
|
|
5
21
|
- **Messages made of parts.** Ordered text, named paste, image, audio and file inputs; copy/link
|
|
6
22
|
modes, capability checks and configurable automatic thresholds. Structured media output,
|
|
@@ -11,15 +27,6 @@ Released in 0.12.0. Upgrading from 0.10.x: see `MIGRATION-0.10-to-0.12.md`.
|
|
|
11
27
|
session creation/loading. Out-of-band media waits in memory until delivered (unkept bytes are
|
|
12
28
|
never written), and media an agent cannot take, or whose bytes are gone, is named instead of
|
|
13
29
|
failing the turn. See the consumer guide for store and out-of-band delivery contracts.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- **Grok Build preset.** `ADAPTERS.grok` launches xAI's Grok Build over ACP
|
|
17
|
-
(`grok --no-auto-update agent stdio`). A Grok session that no longer exists is recognised as
|
|
18
|
-
missing, so checkpoint recovery applies to it.
|
|
19
|
-
- **Additional directories only when advertised.** The client sends `additionalDirectories` only to an
|
|
20
|
-
agent that advertises `sessionCapabilities.additionalDirectories`, as ACP requires; otherwise they
|
|
21
|
-
are left out with a warning (`additional_directories_unsupported`). Grok refused session requests
|
|
22
|
-
that carried them.
|
|
23
30
|
- **Message boundaries.** A new tool call now ends the assistant message before it, also when the
|
|
24
31
|
agent sends no message ids (before, message → tool → message was one message). Tool updates
|
|
25
32
|
do not split. Applies to the live `result.messages` and to stored messages.
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# Controller interface
|
|
2
|
+
|
|
3
|
+
## Native reminders
|
|
4
|
+
|
|
5
|
+
- Agent-owned native conversations expose `conversation.reminders`, and
|
|
6
|
+
`agent.reminders.list()` pages reminder views. New events report local
|
|
7
|
+
intent outcomes and live harness changes.
|
|
8
|
+
- A 0032-compatible peer supports interval and timezone-aware cron routines
|
|
9
|
+
after an executable open confirms the configured unattended-turn guard.
|
|
10
|
+
Routine rows expose remaining count, missed-run and overlap policies, and
|
|
11
|
+
timezone migration state. Consumers can subscribe to `routine_disposition`
|
|
12
|
+
and `routine_migration_blocked`.
|
|
13
|
+
- SQLite schema 22 adds the offline intent journal, last-confirmed cache
|
|
14
|
+
and wake index. The file-backed SQLite owner can wake a stopped harness
|
|
15
|
+
while the Agent is running. Optional idle stop respects near-due work
|
|
16
|
+
through the harness's atomic stop check.
|
|
17
|
+
|
|
18
|
+
## ACP startup
|
|
19
|
+
|
|
20
|
+
- An explicit stop or superseding ACP connection attempt rejects with `ConnectionCancelledError`
|
|
21
|
+
and code `connection_cancelled`. Direct session factories accept a startup `signal`.
|
|
22
|
+
- Superseding a fresh-session start on an existing ACP connection intentionally closes that
|
|
23
|
+
connection before starting its replacement. The cancelled session creation cannot finish on
|
|
24
|
+
the old connection.
|
|
25
|
+
- Agent-owned normal ACP conversations default to `providerStart: "on_open"`. Set
|
|
26
|
+
`conversationDefaults.providerStart` or override it with `runtime.providerStart: "on_first_use"`
|
|
27
|
+
on creation or reopen to connect on the first provider-bound operation. Before first use,
|
|
28
|
+
provider settings and commands are empty and ACP-only capabilities are unavailable.
|
|
29
|
+
- A failed session creation on deferred first use closes that connection and reports the
|
|
30
|
+
provider error. Use eager startup when the connection must remain available for authentication.
|
|
31
|
+
- `OpenOwnedAgentConversationResult.providerSession` includes `"deferred"` for an open that has
|
|
32
|
+
yet to connect. Consumers with exhaustive switches over this field can handle the new status.
|
|
33
|
+
The startup policy is runtime configuration and can be selected anew on each reopen.
|
|
34
|
+
First-use recovery is visible through recovery progress, the `provider_reconnected` event and
|
|
35
|
+
persisted recovery records after the deferred open has returned.
|
|
36
|
+
|
|
37
|
+
## Worker observation
|
|
38
|
+
|
|
39
|
+
- `AgentEvent` includes worker lifecycle facts. Subscribe with `agent.events.subscribeWorkers` for
|
|
40
|
+
worker events. Existing committed-record subscriptions retain their record payloads.
|
|
41
|
+
|
|
42
|
+
## Worker shutdown
|
|
43
|
+
|
|
44
|
+
- `agent.workers.delete(handle)` returns a `DeleteConversationResult` with the provider cleanup outcome.
|
|
45
|
+
- `orchestrator.workers.idleStopMs` defaults to ten minutes and accepts `false` to keep idle
|
|
46
|
+
providers connected. An idle stop emits `worker_stopped` with reason `idle`; the next send reloads the worker.
|
|
47
|
+
|
|
48
|
+
## ACP worker results
|
|
49
|
+
|
|
50
|
+
- Worker assignments reserve their dispatch identity before the provider runs. ACP destinations receive
|
|
51
|
+
the saved worker reply or failure in an out-of-band message with a stable delivery ID and worker
|
|
52
|
+
metadata. The next prompt carries the message to the destination's provider.
|
|
53
|
+
- `agent.workers.check` and `list` include the latest staged outcome, including when its destination
|
|
54
|
+
was deleted. A steer refused after enqueue emits `worker_failed` with reason `refused`, its cause and
|
|
55
|
+
the conversation that sent the steer.
|
|
56
|
+
- A start refused before provider dispatch also notifies its sender. When a refusal is the latest
|
|
57
|
+
outcome, `check` and `list` include the last successful result as `latestResult` if one exists.
|
|
58
|
+
- Native destinations receive durable worker notices through the harness. Opening the harness
|
|
59
|
+
retries eligible notices and recovers prior assignments by ID without redispatching work.
|
|
60
|
+
- Worker `check` and `list` report `deliveryState` for the latest staged assignment. Consumers
|
|
61
|
+
can call `agent.workers.retryDelivery(handle)` to retry the worker's newest policy-blocked notice
|
|
62
|
+
explicitly. It rejects when the worker has no policy-blocked delivery.
|
|
63
|
+
|
|
64
|
+
## Worker permission forwarding
|
|
65
|
+
|
|
66
|
+
- A forwarded `permission_requested` event carries a `source` with the worker handle and conversation ID.
|
|
67
|
+
`turnId` is optional only on a request with a worker source. Ordinary requests require it. The public `WorkerPermissionSource` type describes the source, and the giving
|
|
68
|
+
conversation answers through its existing `answerPermission` method.
|
|
69
|
+
- Forwarded asks shown to a non-owner hide `allow_always` and reject it as an answer.
|
|
70
|
+
- Consumer-opened workers use `orchestrator.defaults.workerPermissions`. An unattended ask is refused.
|
|
71
|
+
|
|
72
|
+
## Conversation permission events
|
|
73
|
+
|
|
74
|
+
- ACP and native conversations emit `permission_requested` for a request and exactly one
|
|
75
|
+
`permission_resolved` with its outcome and source. Sources are `handler`, `consumer`, `default`,
|
|
76
|
+
`timeout`, and `turn_ended`. The last means the turn's lifecycle closed the request, including
|
|
77
|
+
force stop or conversation stop. `permission_resolved` is delivered in a microtask after the
|
|
78
|
+
request closes, so all request listeners see the request first. Native host responder decisions
|
|
79
|
+
are reported as `handler`.
|
|
80
|
+
Agent-owned permission records keep their existing format.
|
|
81
|
+
- Set `answersPermissions: true` on a conversation or in `conversationDefaults` to answer an
|
|
82
|
+
open ask with `await conversation.answerPermission(id, optionId)`. The result contains
|
|
83
|
+
`accepted`. Closed, expired, unknown, handler-owned, and invalid-option answers return false.
|
|
84
|
+
Native answers use the offered `allow_once` or `deny` options.
|
|
85
|
+
- `permissionTimeoutMs` defaults to five minutes and applies only to consumer waits. Those requests
|
|
86
|
+
include `expiresAt` as epoch milliseconds. Set a positive integer below 600,000 ms to override it.
|
|
87
|
+
Time starts at ACP client or native host receipt.
|
|
88
|
+
A native request recovered by observation uses the first time that host sees it, and replay
|
|
89
|
+
preserves that timestamp. Expiry refuses the request. The native harness still has its own
|
|
90
|
+
ten-minute timeout. A local detach, force stop, or stop sends a denial for an open
|
|
91
|
+
conversation-owned approval. A host responder retains authority if only its observer detaches.
|
|
92
|
+
- Final policy levels resolve immediately. For ask, a prompt handler takes precedence, then a
|
|
93
|
+
declared consumer can answer, and an unattended ask is refused. Prompt handlers retain their
|
|
94
|
+
existing lifetime. The permission rule callback receives the neutral native tool name and the
|
|
95
|
+
original argument string and validates its return level at runtime.
|
|
96
|
+
|
|
97
|
+
## Breaking permission configuration
|
|
98
|
+
|
|
99
|
+
- `permissions: { default, rules? }` replaces `defaultPermission`. Migrate `"cancel"` to
|
|
100
|
+
`{ default: "ask" }` and `"approve"` to `{ default: "allow" }`. Omitting the setting defaults to ask.
|
|
101
|
+
Raw clients and direct sessions accept it alongside Agent settings. For Agent conversations, the
|
|
102
|
+
Agent setting is overridden by `conversationDefaults`, then the conversation setting, then its
|
|
103
|
+
`runtime` setting. Each setting replaces the whole previous object, including its rule map.
|
|
104
|
+
- `permissionRule(request)` can return a level before rule matching. Among matching rules, the most
|
|
105
|
+
restrictive level wins, so a `command:` allow cannot override a stricter `kind:` rule. Invalid keys and
|
|
106
|
+
levels throw when configuring the client or conversation.
|
|
107
|
+
- Allow and deny are final. A prompt handler is called only for ask, so an unmatched request with
|
|
108
|
+
default allow skips the handler. ACP refusal selects `reject_once` when offered, and cancels otherwise.
|
|
109
|
+
- Callback requests include `tool` when the producer supplies tool data. Native asks use only
|
|
110
|
+
`permissionRule` and the configured default. In particular, default allow approves native asks.
|
|
111
|
+
The prompt handler answers native ask when present, and native refusal sends harness `deny`.
|
|
112
|
+
|
|
113
|
+
A refactor with no new behaviour for ACP conversations, in any of the three persistence modes (Agent-owned,
|
|
114
|
+
managed, detached). It separates a message going in from a turn running, puts the session on a turn-based
|
|
115
|
+
`ConversationController` interface, and makes ACP-only features optional or capability-gated, so a second
|
|
116
|
+
backend can be plugged in later. Spec: `.res/somelogs.md/11-11+/library/11-11-SPEC-controller-interface.md`.
|
|
117
|
+
|
|
118
|
+
## Renames (the old names keep working)
|
|
119
|
+
|
|
120
|
+
- `AgentController` is now **`HarnessController`**. `AgentController` stays exported, as a deprecated alias (a value
|
|
121
|
+
and a type); both names are the same class.
|
|
122
|
+
- `AgentControllerStartEvent` is now **`ControllerStartEvent`**. The old name stays as a deprecated alias.
|
|
123
|
+
- `AgentControllerConfig` keeps its name. Error messages keep "AgentController is not started — call start() first".
|
|
124
|
+
|
|
125
|
+
## Added
|
|
126
|
+
|
|
127
|
+
- **Durable channel intents:** Agent backends can expose the optional `channels` repository
|
|
128
|
+
(`ChannelPersistence`) and advertise it through `capabilities.channels`. SQLite persists each channel's
|
|
129
|
+
latest intent and version. Native conversation deletion commits the retirement intent with the conversation
|
|
130
|
+
deletion.
|
|
131
|
+
- **Native host records:** With a durable channel backend, the channel methods on `host.records` throw.
|
|
132
|
+
Use the async `host.pendingChannelChanges()` to read pending intents. Submission methods continue to
|
|
133
|
+
use the configured host records.
|
|
134
|
+
- **Native operator errors:** `HarnessUnavailableError` exposes a readonly `code` of `not_running`,
|
|
135
|
+
`failed`, `stopped`, `open_timeout`, `start_failed`, or `reopen_failed`. The async operator
|
|
136
|
+
`suspendChannel()` and `resumeChannel()` methods reject with `not_running` while offline.
|
|
137
|
+
`resumeChannel()` also rejects with `channel_retired` while a retirement is pending.
|
|
138
|
+
- **Stored controller kind:** Agent conversation rows record `controller_kind` as `acp` or `native`. The SQLite
|
|
139
|
+
schema 16 to 17 migration leaves older rows unset. Native deletion uses the stored kind to retire channels,
|
|
140
|
+
including conversations that never completed a prompt. Switches and handoffs across controller kinds reject
|
|
141
|
+
with `UnsupportedError` before transition events or records.
|
|
142
|
+
- **`beforeDispatch` prompt option:** session-scheduled turns await this hook after durable prompt preparation
|
|
143
|
+
and before provider dispatch. Each hook receives its own message ID. Combined steer messages run their hooks
|
|
144
|
+
in message order. A rejection fails the whole ACP run, calls `abandonTurn` and emits `turn_failed`. The owned
|
|
145
|
+
failure callback and an error metering record still run for that undispatched operation. Native awaits every
|
|
146
|
+
hook before the first push, so rejection fails the send before the harness creates a turn.
|
|
147
|
+
- **Owned turn finalization:** `afterPrompt` receives the turn's `messageIds` with every returned terminal status,
|
|
148
|
+
including cancellation and error. `promptFailed` also receives those IDs for rejected turns. The IDs include native
|
|
149
|
+
inputs folded into a running turn. The operation ID still identifies the turn.
|
|
150
|
+
- **`cause` on `turn_started`:** `{ messageIds?, items? }`, at least one present: the messages the turn carries (a
|
|
151
|
+
combined steer run lists each original message) and/or the backend items it took (a turn nobody prompted; a native
|
|
152
|
+
backend often takes a worker reply and a user message into one turn, so a cause can hold both). Record and
|
|
153
|
+
presentation ids are unchanged: a run's turn id is its first message's id.
|
|
154
|
+
- **`TurnRun.messages`:** `send` receives the messages themselves (`{ id, text, messageParts?, attachments?,
|
|
155
|
+
participantId?, consumerMetadata? }`, the objects the queue holds, in `messageIds` order; a combined steer run lists each
|
|
156
|
+
original message), so a backend-scheduled controller gets what the user wrote without reaching into the session. ACP
|
|
157
|
+
controllers ignore it: the session builds their content and passes it in `prepareTurn`.
|
|
158
|
+
- **`harnessConnection()`** on `AgentSession` / `AgentConversation`: the live controller as a `HarnessController`, or
|
|
159
|
+
`null` for a backend that isn't an external harness.
|
|
160
|
+
- **`conversationCapabilities`** on `HarnessController` and `AgentSession`: what the backend offers in neutral terms
|
|
161
|
+
(`nativeSteering`, `backend: BackendCapabilities | null`; `backend` is `null` before the agent's `initialize` and in
|
|
162
|
+
PTY mode). Safe to read before connecting.
|
|
163
|
+
- **New types and exports:** `ConversationController`, `TurnRun`, `TurnContent`, `PreparedTurn`, `TurnStarted`,
|
|
164
|
+
`TurnTook`, `TurnEvent`, `TurnCause`, `ItemRef`, `StartResult`, `UsageListener`, `ConversationCapabilities`,
|
|
165
|
+
`BackendCapabilities` and `UnsupportedError` (package entry). The factory `createController` and `fromAcp` are
|
|
166
|
+
internal (`src/conversation-controller`).
|
|
167
|
+
- **`UnsupportedError`:** thrown by a controller or session asked for something its backend can't do (an optional member
|
|
168
|
+
it doesn't have). Callers guard first, so it signals a bug.
|
|
169
|
+
|
|
170
|
+
## Changed
|
|
171
|
+
|
|
172
|
+
- **`AgentSession.connection`** is now typed `ConversationController` (it was `AgentController`). Code that needs the
|
|
173
|
+
ACP controller uses `harnessConnection()`. The raw ACP `capabilities` on controllers, sessions and conversations keeps
|
|
174
|
+
its shape and throws in the same cases (before the agent connects; in PTY mode).
|
|
175
|
+
- **The controller turn path:** `send`, `subscribeTurns`, `prepareTurn`, `prepareInternalPrompt` and `abandonTurn` on
|
|
176
|
+
`HarnessController`. The session runs every turn the same way, from the controller's `turn_started`; completion
|
|
177
|
+
(`turn_completed` / `turn_failed`) stays the session's, after metering, the transcript and `afterPrompt`.
|
|
178
|
+
- **Internal readers of ACP capabilities** (media in prompts, session listing) read the neutral `backend` capabilities.
|
|
179
|
+
|
|
180
|
+
## Backend-scheduled controllers (including the native backend)
|
|
181
|
+
|
|
182
|
+
- A reported `turn_started` with `sentBySession: false` joins the conversation's operation queue and runs in order
|
|
183
|
+
(no user record, no ACP input; supervised and metered like any turn).
|
|
184
|
+
- `turn_took` extends a turn's cause (messages and items both kept); a message the session sent settles with the turn that
|
|
185
|
+
takes it. A controller with `nativeSteering` receives each message separately (never combined, no cancel-to-steer), the
|
|
186
|
+
queue operation ends when `send` resolves, and a `steer` message sent while a backend turn runs is handed over at once.
|
|
187
|
+
- **The wait after acceptance** (a message a backend-scheduled controller accepted and no turn has taken) is cancellable:
|
|
188
|
+
`stop` drops it as cancelled, `handle.withdraw()` withdraws it locally (resolves cancelled; the backend is not told), and
|
|
189
|
+
`interrupt({ clearQueue: true })` drops it like a queued message. A later turn that names a withdrawn message still runs;
|
|
190
|
+
the session ignores that message ID for settlement. The wait has no
|
|
191
|
+
time limit: it is the normal case (a message accepted while a long turn runs waits for the next turn). A backend that never
|
|
192
|
+
starts a turn is a backend bug.
|
|
193
|
+
- A prepared turn that isn't `live` (replaying output the backend already produced) isn't stalled while it replays; the
|
|
194
|
+
supervisor re-reads `live` each stall interval, so a turn that becomes live and goes silent is stalled no later than its
|
|
195
|
+
limit after the change, and possibly up to one limit earlier. Accepted behaviour (owner, 2026-11-15): stall limits are
|
|
196
|
+
minutes long, so an explicit "now live" signal would add an interface member for no practical gain. It applies only when a
|
|
197
|
+
stall limit is enabled and no permission exemption applies.
|
|
198
|
+
- **Cancel grace:** `ConversationController.cancelGraceMs` is `number | undefined`; the supervisor defaults an undefined value
|
|
199
|
+
to 30 s (the code was right; the spec text said `number`).
|
|
200
|
+
|
|
201
|
+
## Behaviour notes (unchanged for ACP unless stated)
|
|
202
|
+
|
|
203
|
+
- `AgentSession.listSessions()` before the agent connects still throws `NotConnectedError`.
|
|
204
|
+
- A controller without `reconnect`, such as NativeController, is handled as a provider that lost the session: the conversation's
|
|
205
|
+
continuation rule decides (`ProviderSessionReloadUnsupportedError`, an `UnsupportedError`).
|
|
206
|
+
- Native prompts with unsupported media parts or attachments reject with `UnsupportedError` before any message in
|
|
207
|
+
the run is submitted. This applies to queued and steered prompts.
|
|
208
|
+
- A same-adapter handoff on a native conversation rejects directly with `UnsupportedError` when fresh contexts are
|
|
209
|
+
unsupported, before any handoff events or reset records are created.
|
|
210
|
+
- Test-only: the A1 characterization snapshots are unchanged except `cause`, plus a reviewed ordering exception for the
|
|
211
|
+
two non-contractual orders (metering vs presentation events / the last in-progress assistant snapshot).
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
## Native input withdrawal
|
|
215
|
+
|
|
216
|
+
- `PromptHandle.withdrawAsync()` and `AgentSession.withdrawAsync(id)` request confirmed
|
|
217
|
+
withdrawal of submitted native input. Synchronous withdrawal is local for native.
|
|
218
|
+
A `taken` result leaves the prompt following its turn. An unresolved reply can reject.
|
|
219
|
+
- Native submission recovery suppresses push replay while a withdrawal is pending.
|
|
220
|
+
The default submission store is memory. An Agent backed by SQLite alone has no
|
|
221
|
+
local submission state to replay or withdraw after close. The file store retains
|
|
222
|
+
the intent across Agent reopen. Custom host records can implement `markWithdrawing`
|
|
223
|
+
and clear the flag on `markAccepted(id, true)` to support withdrawal of submitted input.
|
|
224
|
+
- Native `interrupt({ clearQueue: true })` clears local inputs and leaves submitted
|
|
225
|
+
input to the harness. Stop and close give withdrawal of submitted, unclaimed
|
|
226
|
+
native inputs up to one second before interrupting the active turn. Only submitted
|
|
227
|
+
inputs that were never taken reject with `NativeInputStoppedError`.
|
|
228
|
+
A stopped turn with a completed reply now returns that partial text and a
|
|
229
|
+
metering record with outcome `cancelled`. Previously the caller received
|
|
230
|
+
empty text and no metering record. Stopping during the first streamed message
|
|
231
|
+
still returns a cancelled result with empty text while that message's
|
|
232
|
+
completion is outstanding. That result now also includes a cancelled
|
|
233
|
+
metering record. During stop, the Agent reads any missed committed replies
|
|
234
|
+
for the exact turn and stores them once by harness message ID. A late
|
|
235
|
+
completion does not re-enter the live output. With a silent host, withdrawal
|
|
236
|
+
and reply recovery can add about six seconds to native stop or close,
|
|
237
|
+
one second for withdrawal and five for recovery. Other shutdown requests
|
|
238
|
+
keep their own deadlines. Inputs can still incur spend if take has won or
|
|
239
|
+
the host is unavailable or silent.
|
|
240
|
+
`TurnEvent` now includes the controller's `input_withdrawn` confirmation.
|
|
241
|
+
- Stop-time reply recovery needs a prepared turn. If the only take evidence
|
|
242
|
+
arrived in the withdrawal response, a committed reply can be missing locally
|
|
243
|
+
after stop and a same-Agent reopen. A new Agent can recover the reply from
|
|
244
|
+
the harness's persisted session.
|
|
245
|
+
|
|
246
|
+
## Native item receipts
|
|
247
|
+
|
|
248
|
+
- `AgentSessionEvent` and `TurnEvent` now include the exported `ItemsReceipt` variant.
|
|
249
|
+
It reports the session turn ID and the harness item IDs whose live `delivered`
|
|
250
|
+
or `seen` milestone advanced. Update exhaustive switches to handle the new kind.
|
|
251
|
+
Receipt events carry no historical replay or transcript record.
|
|
252
|
+
|
|
253
|
+
The native conversation event union includes the local reminder journal events
|
|
254
|
+
`reminder_intent_recorded`, `reminder_intent_confirmed`,
|
|
255
|
+
`reminder_intent_blocked`, and `reminder_intent_discarded`. Harness events use
|
|
256
|
+
`reminder_changed`, `reminder_fired`, `reminder_cancelled`, and
|
|
257
|
+
`reminder_expired`. A fired event indicates that the harness queued the
|
|
258
|
+
notice. Update exhaustive event switches to handle the new kinds.
|
package/CHANGELOG-metering.md
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
3
3
|
Pre-1.0 changes introduced by the `AgentSession` metering feature
|
|
4
4
|
(`.res/somelogs.md/9-5+/9-6-SPEC-metering.md` §21). Fold this into the release notes.
|
|
5
5
|
|
|
6
|
+
## Native harness usage
|
|
7
|
+
|
|
8
|
+
- Agent-owned native turn metering is on by default (`best_effort`). A consumer-supplied
|
|
9
|
+
`inferenceSource` and pricing policy are ignored. Measured usage has `native_ledger` provenance,
|
|
10
|
+
unknown routing, partial attribution and no certification ID, even when every attempt was
|
|
11
|
+
measured. Without provider or model identity, measured usage reports `pricing_unavailable`.
|
|
12
|
+
- `nativeUsage` carries observed call and attempt evidence. `usage.reason` explains partial
|
|
13
|
+
measurement. Empty scans, an unavailable host, and undispatched turns with a metering record report
|
|
14
|
+
unavailable usage.
|
|
15
|
+
A prompt cancelled in the queue may have no metering record. Neither case establishes zero usage.
|
|
16
|
+
- A failed final save replays under its original operation ID if the write-ahead record was staged.
|
|
17
|
+
If both writes fail, a later close can recover sealed calls as unaccounted usage of an earlier turn.
|
|
18
|
+
The evidence is on that record in `nativeUsage.unaccountedEarlierCalls`, and its measured tokens
|
|
19
|
+
accrue once to `state.unallocatedUsage`. These additions cover earlier-turn usage. Between-turn
|
|
20
|
+
usage remains unsupported. `nativeUsage.earlierEvidencePending` flags earlier evidence still awaiting confirmation that its turn ended. Read attributed totals in `record.nextState.totals` or from the state returned
|
|
21
|
+
by `persistence.metering.state(id)` for the conversation.
|
|
22
|
+
- SQLite schema 21 stores the per-channel cursor in metering state and bounded proof on the
|
|
23
|
+
operation index row. The proof survives pruning of operation detail. The upgrade is one-way.
|
|
24
|
+
Older code refuses a schema 21 database. If only truncated proof survives, later-sealed
|
|
25
|
+
attempts outside the retained proof cannot be recovered as tokens and show as unmeasured.
|
|
26
|
+
An already-counted attempt omitted from proof can also show as unmeasured in later evidence.
|
|
27
|
+
That count cannot be summed as lost spend.
|
|
28
|
+
- Records written by the intermediate native metering implementation at `4bbefcb` are not backfilled.
|
|
29
|
+
- Native `billing_required` throws `MeteringPreflightError` until the harness can attest
|
|
30
|
+
`native-harness@1` sealed per-turn accounting. Certification needs provider and model identity,
|
|
31
|
+
normalized cache categories, reported cost and currency when available, attempt purpose, and a
|
|
32
|
+
sealed turn manifest that can attest zero. Between-turn billing needs a harness producer for calls
|
|
33
|
+
without turn ownership and bounded collection while idle.
|
|
34
|
+
|
|
6
35
|
## 1. `Usage` → `TokenUsage`, with corrected field names
|
|
7
36
|
|
|
8
37
|
The old type was wrong in three ways: it used non-ACP field names, omitted the required
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Operation lifecycle
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Unreleased (0.13)
|
|
4
|
+
|
|
5
|
+
- `PromptHandle.status` and the `message_status` conversation event report live
|
|
6
|
+
delivery progress per user message. Native uses harness milestones. ACP
|
|
7
|
+
infers progress from send and first output. Statuses are not restored after
|
|
8
|
+
restart.
|
|
9
|
+
- The ACP client advertises JetBrains AIR session-failure support. AIR and
|
|
10
|
+
Codex fallback notices surface as `provider_notice` activities. Stalls during
|
|
11
|
+
reported retries carry the provider cause. Unmodeled session-info metadata
|
|
12
|
+
and usage metadata remain available as `meta` on their activity events.
|
|
13
|
+
|
|
14
|
+
## 0.12.0
|
|
15
|
+
|
|
16
|
+
The operation lifecycle changes landed on `beta` while the package version
|
|
17
|
+
still read 0.11.2.
|
|
4
18
|
|
|
5
19
|
Provider turns, internal inference and adoption recaps now expose their current operation stage and
|
|
6
20
|
last output time. Silent inference requests fail with `OperationStalledError` (`code: stalled`), carrying
|