@qlairoslabs/acp-client 0.12.0 → 0.13.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-consumer-fixes.md +17 -3
- package/CHANGELOG-controller-interface.md +258 -0
- package/CHANGELOG-metering.md +29 -0
- package/CHANGELOG-operation-lifecycle.md +15 -1
- package/CONSUMER_GUIDE.md +847 -7
- package/MIGRATION-0.10-to-0.12.md +4 -1
- package/MIGRATION-0.12-to-0.13.md +275 -0
- package/README.md +17 -16
- package/package.json +4 -2
- package/src/acp-client-handlers.ts +48 -0
- package/src/activity.ts +3 -0
- package/src/adapters.ts +30 -0
- package/src/agent/adoption/provider-attachment.ts +33 -0
- package/src/agent/adoption/provider-session-delete.ts +1 -1
- package/src/agent/adoption/provider-sessions.ts +3 -2
- package/src/agent/append-assistant-message.ts +91 -0
- package/src/agent/config.ts +54 -6
- package/src/agent/conversation-manager.ts +94 -158
- package/src/agent/manager-settings.ts +1 -0
- package/src/agent/native-channel-lifecycle.ts +111 -0
- package/src/agent/persisted-lifecycle.ts +44 -4
- package/src/agent/persistence-policy/context.ts +13 -0
- package/src/agent/persistence-policy/resolver.ts +7 -0
- package/src/agent/persistence-policy/types.ts +1 -0
- package/src/agent/record-capture.ts +1 -0
- package/src/agent-adapter-registry.ts +33 -7
- package/src/agent-conversation-contracts.ts +14 -1
- package/src/agent-conversation-errors.ts +8 -0
- package/src/agent-conversation-owner.ts +9 -4
- package/src/agent-session-config.ts +135 -0
- package/src/agent-session.ts +439 -934
- package/src/agent.ts +73 -0
- package/src/capabilities.ts +2 -0
- package/src/checkpointing/recovery.ts +10 -0
- package/src/cli/index.ts +3 -3
- package/src/cli/managed.ts +2 -2
- package/src/client.ts +68 -98
- package/src/connection-attempt.ts +95 -0
- package/src/controller-connection.ts +114 -0
- package/src/controller.ts +156 -148
- package/src/conversation-controller/capabilities.ts +88 -0
- package/src/conversation-controller/contracts.ts +208 -0
- package/src/conversation-controller/factory.ts +39 -0
- package/src/conversation-controller/guards.ts +98 -0
- package/src/conversation-controller/index.ts +20 -0
- package/src/conversation-startup.ts +35 -0
- package/src/conversation-turns/backend-turns.ts +373 -0
- package/src/conversation-turns/clear-operations.ts +37 -0
- package/src/conversation-turns/context.ts +135 -0
- package/src/conversation-turns/index.ts +4 -0
- package/src/conversation-turns/record-helpers.ts +75 -0
- package/src/conversation-turns/recording.ts +235 -0
- package/src/conversation-turns/run-turn.ts +367 -0
- package/src/conversation-turns/turn-run.ts +57 -0
- package/src/errors.ts +41 -0
- package/src/handoff-options.ts +81 -0
- package/src/identity/checkpoint-backed.ts +1 -1
- package/src/index.ts +58 -3
- package/src/internal-inference/coordination/manager.ts +11 -0
- package/src/internal-inference/runtime/harness-runtime.ts +4 -4
- package/src/launcher.ts +35 -2
- package/src/media/parts.ts +5 -0
- package/src/message-status.ts +83 -0
- package/src/metering/engine.ts +39 -64
- package/src/metering/measurement-provenance.ts +36 -0
- package/src/metering/native/durability.ts +115 -0
- package/src/metering/native/ledger.ts +104 -0
- package/src/metering/native/operation.ts +85 -0
- package/src/metering/native/projection.ts +114 -0
- package/src/metering/native/proof.ts +51 -0
- package/src/metering/native/requirements.ts +10 -0
- package/src/metering/native/retirement.ts +92 -0
- package/src/metering/native/source.ts +90 -0
- package/src/metering/record.ts +38 -1
- package/src/metering/state.ts +13 -3
- package/src/native/approvals.ts +169 -0
- package/src/native/capabilities.ts +17 -0
- package/src/native/channel-changes.ts +211 -0
- package/src/native/connection.ts +56 -0
- package/src/native/controller.ts +591 -0
- package/src/native/delegation-sender.ts +26 -0
- package/src/native/errors.ts +35 -0
- package/src/native/functions.ts +156 -0
- package/src/native/host-config.ts +59 -0
- package/src/native/host.ts +909 -0
- package/src/native/item-receipts.ts +15 -0
- package/src/native/metering.ts +12 -0
- package/src/native/records.ts +166 -0
- package/src/native/recovery.ts +186 -0
- package/src/native/reminders/fixtures/schema21.sqlite.gz +0 -0
- package/src/native/reminders/idle.ts +70 -0
- package/src/native/reminders/limits.ts +19 -0
- package/src/native/reminders/notifications.ts +29 -0
- package/src/native/reminders/reminders.test.ts +553 -0
- package/src/native/reminders/routine-config.typecheck.ts +13 -0
- package/src/native/reminders/routine-guard.ts +66 -0
- package/src/native/reminders/routine-schedule.ts +25 -0
- package/src/native/reminders/routine-wire.ts +21 -0
- package/src/native/reminders/schedule.ts +97 -0
- package/src/native/reminders/service.ts +280 -0
- package/src/native/reminders/supervisor.ts +91 -0
- package/src/native/reminders/sync.ts +301 -0
- package/src/native/reminders/wire.ts +197 -0
- package/src/native/reminders/wire.typecheck.ts +13 -0
- package/src/native/submission-withdrawal.ts +65 -0
- package/src/native/usage.ts +15 -0
- package/src/native/worker-delivery.ts +61 -0
- package/src/native-harness/.res/README.md +1 -0
- package/src/native-harness/.res/architecture/README.md +21 -0
- package/src/native-harness/.res/architecture/context-and-data.md +31 -0
- package/src/native-harness/.res/architecture/execution.md +42 -0
- package/src/native-harness/.res/architecture/overview.md +44 -0
- package/src/native-harness/.res/architecture/persistence.md +56 -0
- package/src/native-harness/.res/architecture/suspend-and-resume.md +45 -0
- package/src/native-harness/.res/architecture/technical-architecture.md +50 -0
- package/src/native-harness/.res/decisions/0001-basic-loop.md +11 -0
- package/src/native-harness/.res/decisions/0002-channel-input.md +17 -0
- package/src/native-harness/.res/decisions/0003-inference-inspection.md +14 -0
- package/src/native-harness/.res/decisions/0004-shared-context.md +21 -0
- package/src/native-harness/.res/decisions/0005-notice-inbox.md +20 -0
- package/src/native-harness/.res/decisions/0006-explicit-notices.md +12 -0
- package/src/native-harness/.res/decisions/0007-channel-output.md +12 -0
- package/src/native-harness/.res/decisions/0008-browser-client.md +16 -0
- package/src/native-harness/.res/decisions/0009-scripted-model.md +18 -0
- package/src/native-harness/.res/decisions/0010-inprocess-protocol.md +19 -0
- package/src/native-harness/.res/decisions/0011-stdio-transport.md +21 -0
- package/src/native-harness/.res/decisions/0012-session-storage-contract.md +37 -0
- package/src/native-harness/.res/decisions/0013-durable-delivery-contract.md +64 -0
- package/src/native-harness/.res/decisions/0014-channel-controls-contract.md +73 -0
- package/src/native-harness/.res/decisions/0015-session-file-contract.md +72 -0
- package/src/native-harness/.res/decisions/0016-configuration-permissions.md +159 -0
- package/src/native-harness/.res/decisions/0017-openrouter-managed-config.md +69 -0
- package/src/native-harness/.res/decisions/0018-tool-dispatch-evidence.md +78 -0
- package/src/native-harness/.res/decisions/0019-model-execution.md +188 -0
- package/src/native-harness/.res/decisions/0020-startup-channel-changes.md +71 -0
- package/src/native-harness/.res/decisions/0021-tools-and-host-callbacks.md +100 -0
- package/src/native-harness/.res/decisions/0022-operator-controls.md +115 -0
- package/src/native-harness/.res/decisions/0023-long-running-mock.md +82 -0
- package/src/native-harness/.res/decisions/0024-callback-policy-names.md +46 -0
- package/src/native-harness/.res/decisions/0025-external-notices.md +364 -0
- package/src/native-harness/.res/decisions/0026-bounded-context.md +81 -0
- package/src/native-harness/.res/decisions/0027-development-instructions.md +22 -0
- package/src/native-harness/.res/decisions/0028-debug-tools.md +16 -0
- package/src/native-harness/.res/decisions/0029-bounded-model-call-pages.md +37 -0
- package/src/native-harness/.res/decisions/0030-timeline-retrieval.md +145 -0
- package/src/native-harness/.res/decisions/0031-one-off-reminders.md +173 -0
- package/src/native-harness/.res/docs/11-15.md +148 -0
- package/src/native-harness/.res/docs/BUSINESS_RULES.md +111 -0
- package/src/native-harness/.res/docs/WORK.md +65 -0
- package/src/native-harness/.res/docs/_/11-16-persistence/LOG.md +312 -0
- package/src/native-harness/.res/docs/_/11-16-persistence/PLAN.md +77 -0
- package/src/native-harness/.res/docs/_/11-16-persistence/SPEC.md +313 -0
- package/src/native-harness/.res/docs/_/11-19-channel-controls/LOG.md +160 -0
- package/src/native-harness/.res/docs/_/11-19-channel-controls/PLAN.md +89 -0
- package/src/native-harness/.res/docs/_/11-19-channel-controls/SPEC.md +135 -0
- package/src/native-harness/.res/docs/_/11-19-config-permissions/LOG.md +143 -0
- package/src/native-harness/.res/docs/_/11-19-config-permissions/PLAN.md +93 -0
- package/src/native-harness/.res/docs/_/11-19-config-permissions/SPEC.md +181 -0
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/11-20-LOG.md +433 -0
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/PLAN.md +60 -0
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/PROTOCOL.md +141 -0
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/SPEC.md +168 -0
- package/src/native-harness/.res/docs/attachments/0001-DESIGN/SPEC.md +111 -0
- package/src/native-harness/.res/docs/bounded-context/0001-DESIGN/PLAN.md +129 -0
- package/src/native-harness/.res/docs/bounded-context/0001-DESIGN/SPEC.md +135 -0
- package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/LOG.md +437 -0
- package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/PLAN.md +127 -0
- package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/SPEC.md +203 -0
- package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/LOG.md +292 -0
- package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/PLAN.md +91 -0
- package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/SPEC.md +187 -0
- package/src/native-harness/.res/docs/model-execution/0001-DESIGN/LOG.md +148 -0
- package/src/native-harness/.res/docs/model-execution/0001-DESIGN/PLAN.md +95 -0
- package/src/native-harness/.res/docs/model-execution/0001-DESIGN/SPEC.md +200 -0
- package/src/native-harness/.res/docs/model-execution/0002-AMENDMENT-accounting/SPEC.md +80 -0
- package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/LOG.md +206 -0
- package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/PLAN.md +106 -0
- package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/SPEC.md +297 -0
- package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/LOG.md +41 -0
- package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/PLAN.md +36 -0
- package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/SPEC.md +84 -0
- package/src/native-harness/.res/docs/shell-execution/0001-DESIGN/SPEC.md +147 -0
- package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/LOG.md +15 -0
- package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/PLAN.md +107 -0
- package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/SPEC.md +114 -0
- package/src/native-harness/.res/docs/todos/11-19-TODO-auto_review-approve.md +24 -0
- package/src/native-harness/.res/docs/todos/11-20-TODO-user-entered-tool-code.md +23 -0
- package/src/native-harness/.res/docs/todos/11-21-TODO-node-resource-coordination.md +103 -0
- package/src/native-harness/.res/docs/todos/11-22-TODO-harness-m1-sequence.md +50 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/LOG.md +337 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/PLAN.md +76 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/SPEC.md +204 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0002-AMENDMENT-callback-policy/LOG.md +73 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0002-AMENDMENT-callback-policy/SPEC.md +64 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0003-DESIGN-attachment-tools/SPEC.md +58 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/LOG.md +45 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/PLAN.md +108 -0
- package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/SPEC.md +169 -0
- package/src/native-harness/.res/docs/web-tools/0001-DESIGN/SPEC.md +128 -0
- package/src/native-harness/.res/marketing-draft.md +22 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/README.md +285 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-1.md +19 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-10.md +138 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-11.md +148 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-12.md +172 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-13.md +194 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-14.md +233 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-15.md +249 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-16.md +265 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-17.md +279 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-18.md +293 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-19.md +307 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-2.md +29 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-20.md +317 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-21.md +327 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-3.md +40 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-4.md +59 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-5.md +69 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-6.md +79 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-7.md +89 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-8.md +102 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-9.md +116 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation.jsonl +49 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/doc.md +87 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/harness.py +289 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy 2.py +221 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy 3.py +287 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy.py +165 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/state.json +22 -0
- package/src/native-harness/.res/sandbox/1-simple-harness/system-prompt.md +2 -0
- package/src/native-harness/AGENTS.md +70 -0
- package/src/native-harness/ARCHITECTURE.md +249 -0
- package/src/native-harness/README.md +726 -0
- package/src/native-harness/bun.lock +26 -0
- package/src/native-harness/package.json +24 -0
- package/src/native-harness/src/capabilities/context/build.ts +59 -0
- package/src/native-harness/src/capabilities/context/instructions/agent-demo.md +11 -0
- package/src/native-harness/src/capabilities/context/instructions/agent.md +5 -0
- package/src/native-harness/src/capabilities/context/instructions/harness.md +7 -0
- package/src/native-harness/src/capabilities/context/load-instructions.ts +22 -0
- package/src/native-harness/src/capabilities/context/session.ts +92 -0
- package/src/native-harness/src/capabilities/model/attempt.ts +27 -0
- package/src/native-harness/src/capabilities/model/openrouter-stream.ts +72 -0
- package/src/native-harness/src/capabilities/model/openrouter.ts +62 -0
- package/src/native-harness/src/capabilities/model/runner.ts +116 -0
- package/src/native-harness/src/capabilities/model/scenario-attempt.ts +50 -0
- package/src/native-harness/src/capabilities/model/scenario-file.ts +125 -0
- package/src/native-harness/src/capabilities/model/scripted-error.ts +6 -0
- package/src/native-harness/src/capabilities/model/scripted.ts +81 -0
- package/src/native-harness/src/capabilities/model/usage.ts +15 -0
- package/src/native-harness/src/capabilities/tools/builtin/current-time.ts +28 -0
- package/src/native-harness/src/capabilities/tools/builtin/notify-channel.ts +17 -0
- package/src/native-harness/src/capabilities/tools/debug/index.ts +13 -0
- package/src/native-harness/src/capabilities/tools/debug/result.ts +12 -0
- package/src/native-harness/src/capabilities/tools/debug/test-echo.ts +16 -0
- package/src/native-harness/src/capabilities/tools/debug/test-fail.ts +14 -0
- package/src/native-harness/src/capabilities/tools/debug/test-wait.ts +19 -0
- package/src/native-harness/src/capabilities/tools/reminders/index.ts +75 -0
- package/src/native-harness/src/capabilities/tools/runtime/catalog.ts +103 -0
- package/src/native-harness/src/capabilities/tools/runtime/functions.ts +130 -0
- package/src/native-harness/src/capabilities/tools/runtime/invocations.ts +48 -0
- package/src/native-harness/src/capabilities/tools/testing/echo.ts +18 -0
- package/src/native-harness/src/capabilities/tools/testing/record.ts +47 -0
- package/src/native-harness/src/capabilities/tools/timeline/index.ts +41 -0
- package/src/native-harness/src/client.ts +18 -0
- package/src/native-harness/src/contracts/agent.ts +105 -0
- package/src/native-harness/src/contracts/config-permissions.ts +47 -0
- package/src/native-harness/src/contracts/context.ts +112 -0
- package/src/native-harness/src/contracts/events.ts +47 -0
- package/src/native-harness/src/contracts/input-limits.ts +7 -0
- package/src/native-harness/src/contracts/inspection.ts +22 -0
- package/src/native-harness/src/contracts/loop.ts +31 -0
- package/src/native-harness/src/contracts/model-execution.ts +83 -0
- package/src/native-harness/src/contracts/operator-controls.ts +106 -0
- package/src/native-harness/src/contracts/output.ts +13 -0
- package/src/native-harness/src/contracts/protocol.ts +320 -0
- package/src/native-harness/src/contracts/reminders.ts +132 -0
- package/src/native-harness/src/contracts/scenario.ts +42 -0
- package/src/native-harness/src/contracts/session-file.ts +19 -0
- package/src/native-harness/src/contracts/session.ts +184 -0
- package/src/native-harness/src/contracts/storage.ts +596 -0
- package/src/native-harness/src/contracts/timeline-retrieval.ts +40 -0
- package/src/native-harness/src/contracts/tools.ts +133 -0
- package/src/native-harness/src/governance/permissions/gate.ts +129 -0
- package/src/native-harness/src/governance/policy/resolve.ts +32 -0
- package/src/native-harness/src/index.ts +318 -0
- package/src/native-harness/src/interfaces/cli/chat.ts +83 -0
- package/src/native-harness/src/interfaces/cli/development.ts +145 -0
- package/src/native-harness/src/interfaces/cli/format-reply.ts +27 -0
- package/src/native-harness/src/interfaces/cli/listeners.ts +74 -0
- package/src/native-harness/src/interfaces/cli/main.ts +47 -0
- package/src/native-harness/src/interfaces/cli/scenario.ts +37 -0
- package/src/native-harness/src/interfaces/cli/serve.ts +21 -0
- package/src/native-harness/src/interfaces/cli/start.ts +106 -0
- package/src/native-harness/src/interfaces/client.ts +225 -0
- package/src/native-harness/src/interfaces/inspector/index.html +283 -0
- package/src/native-harness/src/interfaces/inspector/observe.ts +35 -0
- package/src/native-harness/src/interfaces/inspector/server.ts +56 -0
- package/src/native-harness/src/interfaces/inspector/state.ts +92 -0
- package/src/native-harness/src/interfaces/protocol/channel-changes.ts +153 -0
- package/src/native-harness/src/interfaces/protocol/framing.ts +47 -0
- package/src/native-harness/src/interfaces/protocol/functions.ts +87 -0
- package/src/native-harness/src/interfaces/protocol/in-process.ts +67 -0
- package/src/native-harness/src/interfaces/protocol/live-queue.ts +55 -0
- package/src/native-harness/src/interfaces/protocol/load.ts +60 -0
- package/src/native-harness/src/interfaces/protocol/local.ts +120 -0
- package/src/native-harness/src/interfaces/protocol/operator.ts +120 -0
- package/src/native-harness/src/interfaces/protocol/output.ts +59 -0
- package/src/native-harness/src/interfaces/protocol/server.ts +517 -0
- package/src/native-harness/src/interfaces/protocol/stdio-client.ts +119 -0
- package/src/native-harness/src/interfaces/protocol/stdio-server.ts +82 -0
- package/src/native-harness/src/interfaces/protocol/subscribe.ts +41 -0
- package/src/native-harness/src/interfaces/protocol/transfers.ts +146 -0
- package/src/native-harness/src/interfaces/web-chat/index.html +94 -0
- package/src/native-harness/src/interfaces/web-chat/server.ts +34 -0
- package/src/native-harness/src/kernel/channels.ts +405 -0
- package/src/native-harness/src/kernel/loop.ts +45 -0
- package/src/native-harness/src/runtime/config/development.ts +23 -0
- package/src/native-harness/src/runtime/config/managed.ts +2 -0
- package/src/native-harness/src/runtime/config/paths.ts +27 -0
- package/src/native-harness/src/runtime/reminder-timer.ts +42 -0
- package/src/native-harness/src/runtime/reminder-validation.ts +104 -0
- package/src/native-harness/src/runtime/reminders.ts +66 -0
- package/src/native-harness/src/state/storage/archive.ts +239 -0
- package/src/native-harness/src/state/storage/engine.ts +1013 -0
- package/src/native-harness/src/state/storage/inference.ts +124 -0
- package/src/native-harness/src/state/storage/memory-reminders.ts +78 -0
- package/src/native-harness/src/state/storage/memory.ts +341 -0
- package/src/native-harness/src/state/storage/policy-metadata.ts +32 -0
- package/src/native-harness/src/state/storage/reminder-archive.ts +63 -0
- package/src/native-harness/src/state/storage/reminder-change.ts +92 -0
- package/src/native-harness/src/state/storage/reminder-tables.ts +27 -0
- package/src/native-harness/src/state/storage/retrieval.ts +122 -0
- package/src/native-harness/src/state/storage/script-identity.ts +7 -0
- package/src/native-harness/src/state/storage/session-file.ts +85 -0
- package/src/native-harness/src/state/storage/sqlite-reminders.ts +134 -0
- package/src/native-harness/src/state/storage/sqlite.ts +625 -0
- package/src/native-harness/src/testing.ts +190 -0
- package/src/native-harness/src/util/config.ts +58 -0
- package/src/native-harness/src/util/json.ts +41 -0
- package/src/native-harness/src/util/message-position.ts +3 -0
- package/src/native-harness/src/util/reminder-schedule.ts +44 -0
- package/src/native-harness/src/util/schema.ts +40 -0
- package/src/native-harness/src/util/timeline-text.ts +72 -0
- package/src/native-harness/src/util/timeline-tool-names.ts +3 -0
- package/src/native-harness/test/agent.test.ts +130 -0
- package/src/native-harness/test/approval-gate.test.ts +255 -0
- package/src/native-harness/test/approval-protocol.test.ts +94 -0
- package/src/native-harness/test/boundaries.test.ts +18 -0
- package/src/native-harness/test/channel-controls.test.ts +322 -0
- package/src/native-harness/test/client-abort.test.ts +136 -0
- package/src/native-harness/test/config-policy.test.ts +301 -0
- package/src/native-harness/test/conformance/storage.ts +1141 -0
- package/src/native-harness/test/context.test.ts +177 -0
- package/src/native-harness/test/crash.test.ts +187 -0
- package/src/native-harness/test/debug-tools.test.ts +67 -0
- package/src/native-harness/test/development-cli.test.ts +67 -0
- package/src/native-harness/test/development.test.ts +171 -0
- package/src/native-harness/test/dispatch-evidence.test.ts +58 -0
- package/src/native-harness/test/e2e.test.ts +186 -0
- package/src/native-harness/test/external-notices.test.ts +101 -0
- package/src/native-harness/test/fixtures/approval-e2e.jsonl +4 -0
- package/src/native-harness/test/fixtures/crash-scenario.jsonl +5 -0
- package/src/native-harness/test/fixtures/development-lifecycle.jsonl +10 -0
- package/src/native-harness/test/fixtures/echo-scenario.jsonl +3 -0
- package/src/native-harness/test/fixtures/format2-schema.ts +27 -0
- package/src/native-harness/test/fixtures/format3-schema.ts +16 -0
- package/src/native-harness/test/fixtures/hold-scenario.jsonl +4 -0
- package/src/native-harness/test/fixtures/model-e2e.jsonl +3 -0
- package/src/native-harness/test/fixtures/storage-owner.ts +20 -0
- package/src/native-harness/test/format-reply.test.ts +10 -0
- package/src/native-harness/test/helpers/operator-view.ts +41 -0
- package/src/native-harness/test/helpers/scenario.ts +9 -0
- package/src/native-harness/test/helpers/session.ts +38 -0
- package/src/native-harness/test/helpers/stdio.ts +46 -0
- package/src/native-harness/test/inspector.test.ts +77 -0
- package/src/native-harness/test/listeners.test.ts +49 -0
- package/src/native-harness/test/loop.test.ts +88 -0
- package/src/native-harness/test/model-channel-double.test.ts +87 -0
- package/src/native-harness/test/model-crash.test.ts +62 -0
- package/src/native-harness/test/model-delivery-regressions.test.ts +55 -0
- package/src/native-harness/test/model-e2e.test.ts +71 -0
- package/src/native-harness/test/model-final-filter.test.ts +30 -0
- package/src/native-harness/test/model-large-reply.test.ts +28 -0
- package/src/native-harness/test/model-live-queue.test.ts +33 -0
- package/src/native-harness/test/model-runner.test.ts +117 -0
- package/src/native-harness/test/model-storage.test.ts +99 -0
- package/src/native-harness/test/model-stream-adapter.test.ts +26 -0
- package/src/native-harness/test/model-stream-public.test.ts +77 -0
- package/src/native-harness/test/notices.test.ts +64 -0
- package/src/native-harness/test/openrouter-config.test.ts +218 -0
- package/src/native-harness/test/operator-controls.test.ts +132 -0
- package/src/native-harness/test/output.test.ts +44 -0
- package/src/native-harness/test/owner-config.test.ts +64 -0
- package/src/native-harness/test/permissions-e2e.test.ts +68 -0
- package/src/native-harness/test/persistence.test.ts +236 -0
- package/src/native-harness/test/portability.test.ts +337 -0
- package/src/native-harness/test/protocol.test.ts +160 -0
- package/src/native-harness/test/reminder-clock.test.ts +61 -0
- package/src/native-harness/test/reminder-stdio.test.ts +140 -0
- package/src/native-harness/test/reminder-storage.test.ts +124 -0
- package/src/native-harness/test/scenario-jsonl.test.ts +112 -0
- package/src/native-harness/test/scripted.test.ts +92 -0
- package/src/native-harness/test/session-file.test.ts +51 -0
- package/src/native-harness/test/startup-channel-changes.test.ts +256 -0
- package/src/native-harness/test/stdio.test.ts +132 -0
- package/src/native-harness/test/storage-memory.test.ts +4 -0
- package/src/native-harness/test/storage-sqlite.test.ts +420 -0
- package/src/native-harness/test/suspension.test.ts +430 -0
- package/src/native-harness/test/timeline-retrieval.test.ts +211 -0
- package/src/native-harness/test/tools-catalog.test.ts +468 -0
- package/src/native-harness/test/tools-protocol.test.ts +418 -0
- package/src/native-harness/test/transfers.test.ts +94 -0
- package/src/native-harness/test/web-chat.test.ts +35 -0
- package/src/native-harness/tsconfig.json +20 -0
- package/src/observation/agent-event-bus.ts +44 -18
- package/src/observation/index.ts +1 -0
- package/src/operations/contracts.ts +11 -3
- package/src/operations/errors.ts +5 -0
- package/src/operations/stale-policy.ts +1 -1
- package/src/operations/supervisor.ts +34 -10
- package/src/orchestrator/acp-delivery.ts +68 -0
- package/src/orchestrator/assignments.ts +27 -0
- package/src/orchestrator/busy.ts +15 -0
- package/src/orchestrator/config.ts +41 -0
- package/src/orchestrator/consumer-api.ts +24 -0
- package/src/orchestrator/contracts.ts +71 -0
- package/src/orchestrator/durable-assignments.ts +111 -0
- package/src/orchestrator/native-delegation.ts +103 -0
- package/src/orchestrator/orchestrator.ts +318 -0
- package/src/orchestrator/permissions.ts +25 -0
- package/src/orchestrator/policy.ts +44 -0
- package/src/orchestrator/pool.ts +123 -0
- package/src/orchestrator/tool-descriptions.ts +11 -0
- package/src/permissions/acp.ts +18 -0
- package/src/permissions/arrival.ts +13 -0
- package/src/permissions/consumer-config.ts +19 -0
- package/src/permissions/conversation.ts +280 -0
- package/src/permissions/matcher.ts +85 -0
- package/src/permissions/outcome.ts +15 -0
- package/src/permissions/policy.ts +81 -0
- package/src/permissions/request.ts +26 -0
- package/src/persistence/activity-projection.ts +1 -0
- package/src/persistence/backend.ts +34 -1
- package/src/persistence/channels.ts +23 -0
- package/src/persistence/index.ts +4 -0
- package/src/persistence/protocol-method.ts +5 -0
- package/src/persistence/reminder-wake.ts +49 -0
- package/src/persistence/reminders.ts +385 -0
- package/src/persistence/sqlite-backend.ts +84 -6
- package/src/persistence/sqlite-channels.ts +65 -0
- package/src/persistence/sqlite-reminders.ts +85 -0
- package/src/persistence/sqlite-schema.ts +108 -3
- package/src/persistence/sqlite-worker-delivery.ts +374 -0
- package/src/persistence/sqlite-workers.ts +59 -0
- package/src/persistence/worker-delivery-contract.ts +104 -0
- package/src/persistence/worker-terminal-reason.ts +29 -0
- package/src/persistence/workers.ts +19 -0
- package/src/provider-notices.ts +137 -0
- package/src/repl/commands.ts +2 -2
- package/src/steering/combine.ts +3 -1
- package/src/steering/contracts.ts +11 -2
- package/src/steering/controller.ts +3 -2
- package/src/transport/acp-transport.ts +24 -14
- package/src/types.ts +15 -12
- package/src/updates.ts +14 -2
- package/src/wire-log.ts +1 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Timeline retrieval implementation plan
|
|
2
|
+
|
|
3
|
+
Date: 2026-11-24
|
|
4
|
+
|
|
5
|
+
Status: Ready for contract review. Base: integrated `alpha` at `7fde493`.
|
|
6
|
+
|
|
7
|
+
The first tools gate delivers `search_timeline` and `read_message` through
|
|
8
|
+
the same native registration and dispatch path in development chat and stdio.
|
|
9
|
+
A scripted model searches a second channel's old decision, opens the source
|
|
10
|
+
with neighbors, and answers with the original attribution.
|
|
11
|
+
[Timeline retrieval spec](SPEC.md)
|
|
12
|
+
|
|
13
|
+
## Findings from the current code
|
|
14
|
+
|
|
15
|
+
- `src/index.ts` assembles tool offers and dispatch. Host catalog entries
|
|
16
|
+
already check the current offer, availability and arguments before approval.
|
|
17
|
+
Direct built-ins and supplied executors currently follow a different branch.
|
|
18
|
+
Extract the small checked native registration behavior for the two new tools,
|
|
19
|
+
with local handlers. Reserve their names even when disabled. Keep existing
|
|
20
|
+
host callbacks, the result reader, and debug and notice behavior compatible.
|
|
21
|
+
- `OperatorStorageReads.readTimeline` already supports channel and sequence
|
|
22
|
+
ranges. Operator message projection has eligibility and ID rules. Reuse
|
|
23
|
+
those rules for search, lookup and neighbors. Add focused lookup for each
|
|
24
|
+
supported message ID where the current storage port lacks it.
|
|
25
|
+
- The bounded context pipeline currently puts completed tool exchanges into
|
|
26
|
+
historical projections. Retrieval exchanges need to remain paired in the
|
|
27
|
+
active turn and inspector, then be excluded as complete exchanges from
|
|
28
|
+
later inference. A mixed assistant message may contain other calls or
|
|
29
|
+
assistant text that must survive the projection.
|
|
30
|
+
- `start --script` swaps the model and can assemble configured tools.
|
|
31
|
+
`test:scenario` currently wires an echo-only executor. The root rehearsal
|
|
32
|
+
already drives a real acp-client host over stdio. Reuse those paths as
|
|
33
|
+
described below.
|
|
34
|
+
|
|
35
|
+
## G1a · Contract review
|
|
36
|
+
|
|
37
|
+
Record checked native registration, focused reads, and retrieval projection
|
|
38
|
+
semantics before runtime changes. Pin text eligibility, token normalization
|
|
39
|
+
and case rules, deterministic candidate ordering and tie-breaks, and the
|
|
40
|
+
ranking guarantees shared by memory and SQLite. Define query, candidate,
|
|
41
|
+
neighbor and response byte limits, and when a partial result is reported.
|
|
42
|
+
Ensure index tokenization produces a conservative candidate set for the
|
|
43
|
+
specified tokenizer. Explicitly cover Unicode, diacritics, punctuation and
|
|
44
|
+
case validation in fixtures. Keep FTS expressions internal.
|
|
45
|
+
|
|
46
|
+
Define point ID lookup and window cursors that carry a fixed timeline revision
|
|
47
|
+
and verify the target and window on every page. Use the existing operator IDs.
|
|
48
|
+
Pin the SQLite migration, recovery and archive strategy for a derived index.
|
|
49
|
+
Check FTS5 on the supported Bun environment. The reviewer signs off on the
|
|
50
|
+
contract revision before dependent work.
|
|
51
|
+
|
|
52
|
+
## G1b · Implement and verify
|
|
53
|
+
|
|
54
|
+
| Area | Files and expected changes |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| Tool assembly | `src/index.ts`, `src/contracts/tools.ts`, and `src/capabilities/tools/runtime/` for checked registration and local dispatch. Use a small `timeline/` directory under `capabilities/tools/` for definitions, validators and handlers. |
|
|
57
|
+
| Storage | `src/contracts/storage.ts`, existing operator read/projection helpers, and `src/state/storage/{engine,memory,sqlite}.ts`. Index eligible committed text in the same transaction as the timeline write. Rebuild only where migration, recovery or import requires it. |
|
|
58
|
+
| Context | `src/capabilities/context/` and the focused inference read projection as needed. Filter retrieval calls and results together before historical window budgeting. Keep the canonical trace and active exchange. |
|
|
59
|
+
| Entry points | `src/interfaces/cli/` and stdio session assembly. Run checked tools through the same configuration and admission path with live or scripted models. |
|
|
60
|
+
| Verification | Harness storage conformance and focused tool/context tests. Root native rehearsal for the real-stdio consumer run. |
|
|
61
|
+
|
|
62
|
+
Acceptance covers both adapters on a common corpus and includes matched and
|
|
63
|
+
unmatched cases, case-sensitive search, attribution, ranking and equal-score
|
|
64
|
+
ordering, partial results, eligible text only, long messages and paged
|
|
65
|
+
neighbors. Concurrent appends cannot move an existing read window. Reopen,
|
|
66
|
+
migration and archive round-trip preserve IDs and retrieval. On a 10,000-entry
|
|
67
|
+
SQLite timeline no retrieval call takes a session snapshot or scans intervening
|
|
68
|
+
messages to resolve an ID. Report common-term ranking cost separately from
|
|
69
|
+
the cap on verifying candidates.
|
|
70
|
+
|
|
71
|
+
Under an ask policy a malformed or disabled invocation creates one paired
|
|
72
|
+
rejection and no approval or execution. Policy denial prevents execution.
|
|
73
|
+
Test normal dispatch and cancellation, including a subsequent turn that retains
|
|
74
|
+
the original messages but omits the retrieval exchange. Inspect the stored
|
|
75
|
+
call and result to confirm the exchange remains available to operators.
|
|
76
|
+
|
|
77
|
+
## G1c · Growing end-to-end script
|
|
78
|
+
|
|
79
|
+
Add one cumulative fixture under `test/native/fixtures/` and run it through
|
|
80
|
+
the existing rehearsal harness over real stdio. Keep the time-based load
|
|
81
|
+
rehearsal and the focused echo smoke test usable. The cumulative scenario
|
|
82
|
+
uses completion barriers between phases and exact model record consumption.
|
|
83
|
+
The script supplies model decisions. Real tool dispatch, storage, policies,
|
|
84
|
+
events, and result pairing still run. Later phases may use fixture provider
|
|
85
|
+
endpoints, runner workspaces, or a controlled clock at the edge.
|
|
86
|
+
|
|
87
|
+
For the first phase, send a decision and a correction on channel A, then on
|
|
88
|
+
channel B script a real search, a real read with neighbors, and a sourced reply.
|
|
89
|
+
Use stable fixture input IDs for the scripted read. Assert that search returned
|
|
90
|
+
that ID and the expected channel, and that the real read result was visible to
|
|
91
|
+
the next inference. Avoid fixture interpolation or a new scenario language for
|
|
92
|
+
this gate. If assertions need access to an attempt, attach them to the existing
|
|
93
|
+
scenario observation or durable tool trace.
|
|
94
|
+
|
|
95
|
+
Make the reusable script-mode assembly offer the normal configured tool
|
|
96
|
+
catalog, with optional tools enabled by the fixture's safe config. Verify the
|
|
97
|
+
first phase over stdio and document how to try it in development chat. Future
|
|
98
|
+
gates extend this fixture when their tools land. Each addition must assert an
|
|
99
|
+
observable real tool result or effect and exact consumption. Focused tests
|
|
100
|
+
continue to cover edge cases.
|
|
101
|
+
|
|
102
|
+
## Submission
|
|
103
|
+
|
|
104
|
+
Submit the contract SHA first and the runtime SHA after approval. Include
|
|
105
|
+
both typechecks, focused storage, tool and context results, the cumulative
|
|
106
|
+
real-stdio run, and full harness and root results. The reviewer reruns the
|
|
107
|
+
key checks on the exact runtime revision. Integration follows review.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Timeline retrieval
|
|
2
|
+
|
|
3
|
+
Date: 2026-11-22
|
|
4
|
+
|
|
5
|
+
Status: Proposed for M2. Shared visibility applies across native channels in v1.
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Let the agent retrieve older conversation messages on demand as the context
|
|
10
|
+
builder starts limiting what goes into each inference. The timeline remains the
|
|
11
|
+
source of the original messages. How much recent history to include automatically
|
|
12
|
+
is a bounded-context design decision.
|
|
13
|
+
|
|
14
|
+
## Search the timeline
|
|
15
|
+
|
|
16
|
+
`search_timeline({ query, channel?, match?, case_sensitive? })` returns a bounded
|
|
17
|
+
list of hits. Each hit carries a stable `message_id`, the original channel,
|
|
18
|
+
sender, timestamp, and a short excerpt around the matching text. Sort by
|
|
19
|
+
relevance, then by descending timeline sequence for ties. Include `partial`
|
|
20
|
+
when a work limit prevents the search from establishing its result. The hits
|
|
21
|
+
then describe the best qualifying matches checked so far. An empty partial
|
|
22
|
+
result leaves open whether more candidates would match.
|
|
23
|
+
|
|
24
|
+
- `query` is a non-empty string with at least one searchable word. Default
|
|
25
|
+
`match` is `keywords`. Every query word must occur as a whole token in the
|
|
26
|
+
same message, in any order. With `match: "phrase"`, the words must appear
|
|
27
|
+
consecutively and in order. Phrase matching is based on tokens.
|
|
28
|
+
- Matching is case-insensitive by default. With `case_sensitive: true`, check
|
|
29
|
+
the original text for the requested token casing. `TODO` then matches `TODO`
|
|
30
|
+
and skips `todo` and `TODOS`. Check casing and visibility before applying the
|
|
31
|
+
result limit. Generate excerpts around qualifying matches.
|
|
32
|
+
- Omitting `channel` searches the shared scope. Supplying it narrows the search
|
|
33
|
+
to that channel. Use the existing conversation-message eligibility rule for
|
|
34
|
+
search, direct reads, and neighbor windows. Eligible entries are committed
|
|
35
|
+
participant messages and assistant replies with text. Internal and external
|
|
36
|
+
notices, raw tool results, and empty tool-only replies are outside v1 retrieval.
|
|
37
|
+
|
|
38
|
+
Translate the tool query into a parameterized search expression with application
|
|
39
|
+
defined keyword and phrase semantics. Keep raw FTS query syntax internal.
|
|
40
|
+
|
|
41
|
+
## Read a message
|
|
42
|
+
|
|
43
|
+
`read_message({ message_id, before?, after?, cursor? })` resolves the reference
|
|
44
|
+
within the current session. Return the original attributed message in full
|
|
45
|
+
when it fits and offer a continuation for larger text. Share the existing
|
|
46
|
+
operator message ID encoder. Participant entries with item IDs use `item:<id>`,
|
|
47
|
+
model replies use their stored ID, and other eligible entries use the sequence
|
|
48
|
+
fallback. Resolve each supported form with a point lookup. The ID stays stable
|
|
49
|
+
across reopen and session-file export and import.
|
|
50
|
+
|
|
51
|
+
`before` and `after` are optional counts of neighboring conversation messages
|
|
52
|
+
in the same channel. Both default to zero. Return the window in timeline order
|
|
53
|
+
with the target identified. Enforce both a message count and an output byte
|
|
54
|
+
limit. Freeze the window at the first read's timeline revision. The cursor
|
|
55
|
+
binds the target and window to that revision and carries the next position and
|
|
56
|
+
any offset within a split message. Check current visibility on every page.
|
|
57
|
+
|
|
58
|
+
For example, the agent searches for `launch Friday`, opens a matching message
|
|
59
|
+
with `before: 2, after: 3`, and reads the exchange to see whether the date was
|
|
60
|
+
agreed or only proposed. The retrieved text enters the active turn as a normal
|
|
61
|
+
paired tool result. Preserve the retrieval exchange in the stored tool trace.
|
|
62
|
+
Render it only in the active turn, keeping the call and result paired. Omit
|
|
63
|
+
the retrieval exchange from later shared context. The agent can retrieve the
|
|
64
|
+
source messages again when needed.
|
|
65
|
+
|
|
66
|
+
## Storage and execution
|
|
67
|
+
|
|
68
|
+
Expose retrieval through the storage read interface and compose the tools through
|
|
69
|
+
the existing tool registry and permission gate. Implement SQLite search with an
|
|
70
|
+
FTS5 index keyed by timeline sequence. Index committed text in the same transaction
|
|
71
|
+
as the source entry. The index is a derived projection that can be rebuilt on
|
|
72
|
+
upgrade or import from the timeline. Use the index to narrow candidates and check
|
|
73
|
+
the original text when case sensitivity is requested. Start with one index and
|
|
74
|
+
cap candidate verification. The cap bounds original-text checks. SQLite may
|
|
75
|
+
still do substantial matching and ranking work, so measure that separately on
|
|
76
|
+
common terms. Revisit a case-aware index if measurements justify it.
|
|
77
|
+
[SQLite FTS5](https://sqlite.org/fts5.html)
|
|
78
|
+
|
|
79
|
+
Use a point lookup and the existing channel-and-sequence range reads for the
|
|
80
|
+
message and its neighbors. Keep FTS syntax and index details inside the SQLite
|
|
81
|
+
adapter. The in-memory adapter uses the same token and phrase rules, scope, and
|
|
82
|
+
bound semantics. Define candidate, result, input, and window limits with the
|
|
83
|
+
implementation plan and record adjustable defaults in [Business rules](../../BUSINESS_RULES.md).
|
|
84
|
+
|
|
85
|
+
## Visibility now and in v1
|
|
86
|
+
|
|
87
|
+
Reuse timeline `channelId` and `from` for origin channel and sender attribution.
|
|
88
|
+
Keep any existing source attribution intact. M2 preserves shared visibility
|
|
89
|
+
across channels within the session. The harness supplies the actual calling
|
|
90
|
+
channel and any trusted participant identity available to the turn. The model's
|
|
91
|
+
channel argument only narrows the search.
|
|
92
|
+
|
|
93
|
+
Keep origin metadata and caller context available to search, direct reads, and
|
|
94
|
+
[live context construction](../../bounded-context/0001-DESIGN/SPEC.md). V1
|
|
95
|
+
offers no cross-channel privacy guarantee. Future visibility policy can build
|
|
96
|
+
on that boundary and account for derived material, including summaries and
|
|
97
|
+
earlier retrieval results.
|
|
98
|
+
|
|
99
|
+
## Acceptance
|
|
100
|
+
|
|
101
|
+
1. Exercise keyword and phrase matching, punctuation, Unicode, `todo` versus
|
|
102
|
+
`TODO`, channel filters, result ranking and limits, and an empty result on
|
|
103
|
+
both adapters. Verify the partial flag when common lowercase hits consume
|
|
104
|
+
the candidate budget before later exact-case hits are checked.
|
|
105
|
+
2. Open a hit by ID and read a bounded window without selecting messages from
|
|
106
|
+
other channels. Verify large messages can be read through continuations,
|
|
107
|
+
and appending messages between pages leaves the original window stable.
|
|
108
|
+
3. Recover an older decision and a later correction from another channel when
|
|
109
|
+
both are outside the live context. Verify that the results retain attribution.
|
|
110
|
+
4. Verify indexed SQLite search and bounded message reads on a long timeline.
|
|
111
|
+
Check transactional index updates and rebuild from imported timeline data.
|
|
112
|
+
5. Retrieve a message from another native channel. Verify the result keeps
|
|
113
|
+
the original attribution and the saved retrieval exchange is omitted from
|
|
114
|
+
later shared context.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# TODO: Automatic tool approval review
|
|
2
|
+
|
|
3
|
+
Status: deferred. Revisit after consumer approval works end to end.
|
|
4
|
+
|
|
5
|
+
Add an optional automatic reviewer behind the tool approval interface. The
|
|
6
|
+
policy gate resolves each call to allow, deny, or ask. An ask can go to an
|
|
7
|
+
automatic reviewer or the consumer. A policy denial is final.
|
|
8
|
+
|
|
9
|
+
The reviewer judges whether the exact call is authorized and within scope.
|
|
10
|
+
Give it the tool name and arguments, the relevant user request, the channel
|
|
11
|
+
and turn, and the rule that triggered review. Provide more context only when
|
|
12
|
+
needed. Treat conversation text and tool output as evidence.
|
|
13
|
+
|
|
14
|
+
The reviewer can approve the exact call once, deny with a reason, or escalate
|
|
15
|
+
to the consumer. If nobody can answer an escalation, leave the tool unexecuted.
|
|
16
|
+
Record the outcome and reason against the original approval request.
|
|
17
|
+
|
|
18
|
+
Use the same request lifecycle as consumer approval. On suspension, close the
|
|
19
|
+
request and record why the tool did not run. A resumed turn can request fresh
|
|
20
|
+
approval if the action is still needed. Ignore late responses to closed
|
|
21
|
+
requests.
|
|
22
|
+
|
|
23
|
+
Before implementing, decide how consumers opt in, what context the reviewer may
|
|
24
|
+
access, and which actions always require human approval.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# TODO: User-entered code for tools
|
|
2
|
+
|
|
3
|
+
Date: 2026-11-20.
|
|
4
|
+
Status: deferred until consumer-registered callbacks work end to end.
|
|
5
|
+
|
|
6
|
+
Explore an optional executor for tools whose implementation is written by a
|
|
7
|
+
user. The current callback design uses implementations registered by the
|
|
8
|
+
consumer. User-entered code needs a separate execution environment because a
|
|
9
|
+
normal callback can inherit the host's access to files, credentials, and
|
|
10
|
+
network resources.
|
|
11
|
+
|
|
12
|
+
Before designing an implementation, decide:
|
|
13
|
+
|
|
14
|
+
- Who can create, edit, and enable a code-backed tool.
|
|
15
|
+
- Which language and runtime are supported, and which resources the executor
|
|
16
|
+
can access. Start with explicit grants for files, network, and credentials.
|
|
17
|
+
- How to bound time, memory, and output, and how cancellation and uncertain
|
|
18
|
+
effects are reported through the existing tool-call lifecycle.
|
|
19
|
+
- Whether code and its version travel in a session export. Define what the
|
|
20
|
+
destination must approve before imported code can run.
|
|
21
|
+
|
|
22
|
+
Reuse the existing tool schema, policy gate, and call records. The gate
|
|
23
|
+
authorizes dispatch. The executor enforces the limits on what the code can do.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# TODO: Node-level coordination for native harnesses
|
|
2
|
+
|
|
3
|
+
Date: 2026-11-21.
|
|
4
|
+
Status: deferred until after the second milestone makes the harness usable.
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
The first milestone gives acp-client an offline integration path. The second
|
|
9
|
+
adds bounded context and the user-facing capabilities that make the shared
|
|
10
|
+
agent useful. Measure the resulting harness before optimizing how multiple
|
|
11
|
+
instances share a Node. Context assembly, storage reads, and model request
|
|
12
|
+
size can change substantially during that milestone.
|
|
13
|
+
|
|
14
|
+
The capacity question is how a Node can keep roughly 50 agents available on
|
|
15
|
+
modest hardware. Each agent has its own harness process and can serve several
|
|
16
|
+
channels. A turn alternates between local work and waiting on a model or remote
|
|
17
|
+
tool. Many processes can wait concurrently. If they all start together, or if
|
|
18
|
+
many responses arrive together and trigger expensive local work, they can
|
|
19
|
+
compete for CPU and memory. A Node scheduler could spread those bursts and
|
|
20
|
+
keep warm the agents most likely to receive work. The agent count is a workload
|
|
21
|
+
to measure, with capacity determined by the observed resource use and latency.
|
|
22
|
+
|
|
23
|
+
## Proposed shape
|
|
24
|
+
|
|
25
|
+
Use two independent connections. The Hub runs conversations through acp-client
|
|
26
|
+
and the existing runtime bridge. Today the native harness uses its own stdio
|
|
27
|
+
protocol behind acp-client. ACP can remain the conversation transport where the
|
|
28
|
+
Hub uses it. The harness initiates a separate outbound connection to a
|
|
29
|
+
Node-owned control socket, so each process needs no additional listener.
|
|
30
|
+
|
|
31
|
+
The Node owns launch, allocation, and eviction decisions. The harness owns
|
|
32
|
+
its channels, tool execution, and session lifecycle. Wire the optional control
|
|
33
|
+
adapter at the harness runtime edge, using existing lifecycle and observation
|
|
34
|
+
operations. Standalone harnesses continue to run independently. Control
|
|
35
|
+
messages carry process identity, readiness, aggregate activity, and lifecycle
|
|
36
|
+
results. Conversation content, tool arguments, and model output stay on the
|
|
37
|
+
conversation path.
|
|
38
|
+
|
|
39
|
+
| Control | Proposed behavior |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| Cold start and wake | The Node limits concurrent launches and prefers interactive work over background starts. The host can request a wake when work arrives for a stopped process. The harness reports readiness after it can serve work. |
|
|
42
|
+
| Warm retention | Use observed working-set memory and recent activity to choose idle candidates for eviction. Leave headroom for running work to finish. |
|
|
43
|
+
| Drain | Request suspension through the existing lifecycle boundary. Confirm the checkpoint before closing the child and releasing storage ownership. |
|
|
44
|
+
| Local resource permits | If profiles show repeated CPU bursts, gate specific expensive operations through asynchronous Node permits. Context assembly and genuinely local tool work are candidates to measure. |
|
|
45
|
+
| Fairness | Give Hubs a fair share before scheduling among their agents. Keep interactive starts responsive during background bursts. |
|
|
46
|
+
| Provider capacity | If needed, govern model-request concurrency separately from local CPU. A model wait must release its local CPU permit. |
|
|
47
|
+
|
|
48
|
+
## Drain, wake, and failure boundaries
|
|
49
|
+
|
|
50
|
+
Idle is a hint for choosing an eviction candidate. A channel may have pending
|
|
51
|
+
input or a checkpoint while nothing is running, and new work can race an idle
|
|
52
|
+
notification. Request a drain, close new admission through the harness's
|
|
53
|
+
suspension path, and wait for confirmation from that process. A callback that
|
|
54
|
+
holds the drain open remains visible. If the host explicitly interrupts it,
|
|
55
|
+
preserve the existing rules for uncertain tool effects. A forced process exit
|
|
56
|
+
uses crash recovery. See [suspend, stop, and resume](../../architecture/suspend-and-resume.md).
|
|
57
|
+
|
|
58
|
+
On wake, reopen the same stored session and explicitly resume a scheduler-
|
|
59
|
+
initiated suspension. Preserve operator-requested suspension and individually
|
|
60
|
+
suspended channels. The Node must know which suspension it initiated before
|
|
61
|
+
resuming it. Define how the host handles a new wake request during drain or
|
|
62
|
+
eviction so work arriving at that boundary receives a clear outcome and uses
|
|
63
|
+
the existing durable receipt rules.
|
|
64
|
+
|
|
65
|
+
After control connection loss, keep local session semantics and treat the
|
|
66
|
+
Node's last activity view as stale. A drain without confirmation cannot be used
|
|
67
|
+
as a clean eviction. Correlate commands and replies with the process instance
|
|
68
|
+
so a late acknowledgment from an old process cannot authorize stopping its
|
|
69
|
+
replacement. Before implementation, confirm how the container reaches the
|
|
70
|
+
Node socket and how the Node authenticates that connection and binds it to the
|
|
71
|
+
launched instance.
|
|
72
|
+
|
|
73
|
+
If permits are added, acquire them before expensive work and outside storage
|
|
74
|
+
transactions. Release them on completion, cancellation, and before waiting
|
|
75
|
+
on a model or remote tool. Decide how permits expire or are reclaimed when a
|
|
76
|
+
process exits and what a connected harness does while its scheduler is
|
|
77
|
+
unavailable. Use Node resource limits for hard ceilings. Permits coordinate
|
|
78
|
+
when cooperating processes begin work.
|
|
79
|
+
|
|
80
|
+
## Order and evidence
|
|
81
|
+
|
|
82
|
+
1. **Measure the usable harness.** Profile cold start, readiness, memory per
|
|
83
|
+
process and channel, context assembly, tool execution, and time spent
|
|
84
|
+
waiting. Use the target container runtime and representative active and
|
|
85
|
+
idle mixes. Treat coding harness profiles as comparison points.
|
|
86
|
+
2. **Try startup scheduling and idle/drain first.** Add only the activity and
|
|
87
|
+
lifecycle signals those paths need. Test a startup burst, a new interactive
|
|
88
|
+
request during the burst, eviction and wake, and loss of the control
|
|
89
|
+
connection while a drain is in flight.
|
|
90
|
+
3. **Add warm retention or permits where data warrants them.** Measure the
|
|
91
|
+
effect of each change. A burst in provider waits, local CPU, or memory calls
|
|
92
|
+
for a different control. Keep per-chunk and ordinary cheap operations off
|
|
93
|
+
the control path.
|
|
94
|
+
|
|
95
|
+
Reuse and extend the [long-running mock](../long-running-mock/0001-DESIGN/SPEC.md)
|
|
96
|
+
to drive the same multi-process workload with coordination disabled and
|
|
97
|
+
enabled. Run both startup bursts and steady traffic with synchronized response
|
|
98
|
+
bursts. Compare startup queue time, time to first reply, p95 reply latency,
|
|
99
|
+
CPU saturation, resident memory, and progress by Hub. Verify that a new turn
|
|
100
|
+
can make progress under load and that eviction preserves accepted work and
|
|
101
|
+
does not replay uncertain effects. Keep Node scheduling and socket design out
|
|
102
|
+
of the current harness milestones until the baseline shows where coordination
|
|
103
|
+
would help.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# TODO: Harness M1 implementation sequence
|
|
2
|
+
|
|
3
|
+
Date: 2026-11-22.
|
|
4
|
+
Status: ready to start operator controls Gate 1.
|
|
5
|
+
|
|
6
|
+
## Starting point
|
|
7
|
+
|
|
8
|
+
Start work from `aiagent/haurness-l`. It contains the accepted acp-client
|
|
9
|
+
integration (`7133c5c`) and tools and host callbacks (`f4eff94`, closure
|
|
10
|
+
`c1c3e88`). The reviewed callbacks also landed on `alpha`. Pin the worktree
|
|
11
|
+
base and the spec and plan revisions in the first handoff.
|
|
12
|
+
|
|
13
|
+
## Work in order
|
|
14
|
+
|
|
15
|
+
1. **Operator and consumer controls.** Start with Gate 1 on the accepted
|
|
16
|
+
callbacks base. Review the replacement wire contract, bounded storage reads,
|
|
17
|
+
and the host-level approval responder before implementing either side.
|
|
18
|
+
Finish the real stdio checkpoint for independent attachment, recovery,
|
|
19
|
+
approvals, and opt-in history. The short checkpoint can run as soon as
|
|
20
|
+
operator controls is ready. [Spec and implementation gates](../operator-controls/0001-DESIGN/PLAN.md)
|
|
21
|
+
2. **Long-running mock mode.** Start from the accepted operator-controls base.
|
|
22
|
+
Use the JSONL adapter and acp-client driver to run the deterministic CI
|
|
23
|
+
scenario and the multi-minute rehearsal. Record the fixture, command, and
|
|
24
|
+
result. [Spec and implementation gates](../long-running-mock/0001-DESIGN/PLAN.md)
|
|
25
|
+
3. **Callback policy names amendment.** Carry the policies that authorized the
|
|
26
|
+
invocation through `functions/call` and the acp-client handler context.
|
|
27
|
+
Verify mixed policy, approval, and the explicit policy-free case. The
|
|
28
|
+
orchestrator owns rule lookup and application. [Amendment](../tools-and-callbacks/0002-AMENDMENT-callback-policy/SPEC.md)
|
|
29
|
+
4. **External notices.** Implement `channel/notify` over the durable inbox,
|
|
30
|
+
then connect acp-client's durable worker handoff. Gate 1 verifies that the
|
|
31
|
+
first supported worker backend can recover a completion after acp-client
|
|
32
|
+
exits. The generic harness path can proceed once its contract passes review.
|
|
33
|
+
Keep full worker-delivery acceptance open until a supported backend passes
|
|
34
|
+
the crash cases. [Spec and implementation gates](../channel-messaging/0001-DESIGN-external-notices/PLAN.md)
|
|
35
|
+
|
|
36
|
+
The short stdio checkpoint establishes the native integration path. The timed
|
|
37
|
+
rehearsal exercises it under load. The policy amendment and external notices
|
|
38
|
+
then complete the harness path needed for durable worker delivery. The usable
|
|
39
|
+
harness milestone follows, beginning with bounded model context.
|
|
40
|
+
|
|
41
|
+
## Review process
|
|
42
|
+
|
|
43
|
+
Use one implementer and one independent reviewer. The coordinator pins the
|
|
44
|
+
base and records the exact revision and evidence at each gate. The implementer
|
|
45
|
+
grounds the gate in the current code and sends the revision for review. The
|
|
46
|
+
reviewer checks it against the spec and independently verifies the gate. They
|
|
47
|
+
can resolve findings directly, with scope decisions brought back to the
|
|
48
|
+
coordinator. Start each next slice from the accepted revision of its base.
|
|
49
|
+
|
|
50
|
+
For current status, see the [work index](../WORK.md).
|