@qlairoslabs/acp-client 0.13.0-alpha.1 → 0.13.2-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/CONSUMER_GUIDE.md +181 -8
- package/MIGRATION-0.12-to-0.13.md +20 -7
- package/package.json +13 -2
- package/src/agent/config.ts +2 -0
- package/src/agent/conversation-manager.ts +1 -0
- package/src/agent/native-operations.ts +40 -0
- package/src/agent-session-config.ts +2 -0
- package/src/agent-session.ts +12 -2
- package/src/agent.ts +100 -2
- package/src/client.ts +5 -3
- package/src/controller-connection.ts +1 -0
- package/src/controller.ts +2 -0
- package/src/index.ts +3 -0
- package/src/launcher.ts +2 -0
- package/src/native/approvals.ts +20 -3
- package/src/native/capabilities.ts +2 -2
- package/src/native/connection.ts +1 -1
- package/src/native/controller.ts +5 -3
- package/src/native/host-config.ts +2 -0
- package/src/native/host.ts +83 -4
- package/src/native/mcp.ts +47 -0
- package/src/native/recovery.ts +8 -7
- package/src/native/reminders/routine-guard.ts +4 -3
- package/src/native/reminders/routine-wire.ts +1 -1
- package/src/native-harness/README.md +58 -1
- package/src/native-harness/package.json +4 -0
- package/src/native-harness/scripts/build-routine-zones.py +47 -0
- package/src/native-harness/src/capabilities/attachments/admission.ts +42 -0
- package/src/native-harness/src/capabilities/attachments/image-validation.ts +98 -0
- package/src/native-harness/src/capabilities/attachments/input.ts +1 -0
- package/src/native-harness/src/capabilities/attachments/read.ts +76 -0
- package/src/native-harness/src/capabilities/attachments/recovery.ts +26 -0
- package/src/native-harness/src/capabilities/attachments/selection.ts +37 -0
- package/src/native-harness/src/capabilities/attachments/service.ts +75 -0
- package/src/native-harness/src/capabilities/attachments/upload.ts +164 -0
- package/src/native-harness/src/capabilities/attachments/vision.ts +45 -0
- package/src/native-harness/src/capabilities/context/build.ts +5 -0
- package/src/native-harness/src/capabilities/context/session.ts +2 -1
- package/src/native-harness/src/capabilities/model/openrouter-stream.ts +80 -17
- package/src/native-harness/src/capabilities/model/runner.ts +6 -3
- package/src/native-harness/src/capabilities/reminders/cron-calendar.ts +50 -0
- package/src/native-harness/src/capabilities/reminders/cron-fields.ts +46 -0
- package/src/native-harness/src/capabilities/reminders/cron-proof.ts +32 -0
- package/src/native-harness/src/capabilities/reminders/cron-zone.ts +53 -0
- package/src/native-harness/src/capabilities/reminders/iana-zones.json.gz +0 -0
- package/src/native-harness/src/capabilities/reminders/iana-zones.ts +34 -0
- package/src/native-harness/src/capabilities/reminders/interval.ts +30 -0
- package/src/native-harness/src/capabilities/reminders/routine-advance.ts +47 -0
- package/src/native-harness/src/capabilities/reminders/routine-backlog.ts +47 -0
- package/src/native-harness/src/capabilities/reminders/routine-expiry.ts +15 -0
- package/src/native-harness/src/capabilities/reminders/routine-occurrence.ts +65 -0
- package/src/native-harness/src/capabilities/reminders/routine-schedule.ts +70 -0
- package/src/native-harness/src/capabilities/reminders/unattended.ts +8 -0
- package/src/native-harness/src/capabilities/tools/mcp/client.ts +97 -0
- package/src/native-harness/src/capabilities/tools/mcp/http.ts +183 -0
- package/src/native-harness/src/capabilities/tools/mcp/registry.ts +62 -0
- package/src/native-harness/src/capabilities/tools/mcp/result.ts +33 -0
- package/src/native-harness/src/capabilities/tools/mcp/schema.ts +77 -0
- package/src/native-harness/src/capabilities/tools/mcp/secrets.ts +28 -0
- package/src/native-harness/src/capabilities/tools/mcp/stdio.ts +105 -0
- package/src/native-harness/src/capabilities/tools/reminders/index.ts +27 -5
- package/src/native-harness/src/capabilities/tools/runtime/invocations.ts +4 -1
- package/src/native-harness/src/capabilities/tools/web/config.ts +1 -0
- package/src/native-harness/src/capabilities/tools/web/definitions.ts +18 -0
- package/src/native-harness/src/capabilities/tools/web/direct-address.ts +56 -0
- package/src/native-harness/src/capabilities/tools/web/direct-transport.ts +235 -0
- package/src/native-harness/src/capabilities/tools/web/direct.ts +149 -0
- package/src/native-harness/src/capabilities/tools/web/exa-transport.ts +41 -0
- package/src/native-harness/src/capabilities/tools/web/exa.ts +71 -0
- package/src/native-harness/src/capabilities/tools/web/preview.ts +44 -0
- package/src/native-harness/src/capabilities/tools/web/registry.ts +47 -0
- package/src/native-harness/src/capabilities/tools/web/usage.ts +1 -0
- package/src/native-harness/src/contracts/agent.ts +3 -1
- package/src/native-harness/src/contracts/attachments.ts +62 -0
- package/src/native-harness/src/contracts/config-permissions.ts +14 -3
- package/src/native-harness/src/contracts/context.ts +1 -1
- package/src/native-harness/src/contracts/events.ts +2 -2
- package/src/native-harness/src/contracts/loop.ts +3 -3
- package/src/native-harness/src/contracts/mcp.ts +22 -0
- package/src/native-harness/src/contracts/model-execution.ts +2 -1
- package/src/native-harness/src/contracts/operator-controls.ts +8 -1
- package/src/native-harness/src/contracts/protocol.ts +21 -5
- package/src/native-harness/src/contracts/reminders.ts +4 -2
- package/src/native-harness/src/contracts/routines.ts +20 -0
- package/src/native-harness/src/contracts/session-file.ts +2 -0
- package/src/native-harness/src/contracts/session.ts +8 -3
- package/src/native-harness/src/contracts/storage.ts +32 -13
- package/src/native-harness/src/contracts/tools.ts +2 -0
- package/src/native-harness/src/contracts/web.ts +16 -0
- package/src/native-harness/src/governance/permissions/gate.ts +9 -2
- package/src/native-harness/src/governance/policy/resolve.ts +6 -1
- package/src/native-harness/src/index.ts +48 -12
- package/src/native-harness/src/interfaces/cli/development.ts +108 -53
- package/src/native-harness/src/interfaces/cli/serve.ts +2 -2
- package/src/native-harness/src/interfaces/cli/start.ts +22 -13
- package/src/native-harness/src/interfaces/client.ts +8 -2
- package/src/native-harness/src/interfaces/inspector/index.html +7 -1
- package/src/native-harness/src/interfaces/inspector/state.ts +6 -2
- package/src/native-harness/src/interfaces/protocol/load.ts +3 -1
- package/src/native-harness/src/interfaces/protocol/local.ts +13 -4
- package/src/native-harness/src/interfaces/protocol/operator.ts +8 -2
- package/src/native-harness/src/interfaces/protocol/server.ts +102 -36
- package/src/native-harness/src/interfaces/protocol/stdio-client.ts +8 -0
- package/src/native-harness/src/interfaces/web-chat/index.html +65 -12
- package/src/native-harness/src/interfaces/web-chat/server.ts +30 -3
- package/src/native-harness/src/kernel/channels.ts +27 -15
- package/src/native-harness/src/kernel/loop.ts +1 -1
- package/src/native-harness/src/runtime/config/inference-key.ts +7 -0
- package/src/native-harness/src/runtime/config/managed.ts +1 -1
- package/src/native-harness/src/runtime/config/paths.ts +8 -1
- package/src/native-harness/src/runtime/execution/mcp-stdio.ts +31 -0
- package/src/native-harness/src/runtime/reminder-validation.ts +31 -10
- package/src/native-harness/src/runtime/reminders.ts +2 -2
- package/src/native-harness/src/state/storage/archive.ts +113 -12
- package/src/native-harness/src/state/storage/attachment-files.ts +58 -0
- package/src/native-harness/src/state/storage/attachment-import.ts +106 -0
- package/src/native-harness/src/state/storage/attachment-tables.ts +123 -0
- package/src/native-harness/src/state/storage/engine.ts +396 -45
- package/src/native-harness/src/state/storage/inference.ts +30 -2
- package/src/native-harness/src/state/storage/memory-attachments.ts +56 -0
- package/src/native-harness/src/state/storage/memory-reminders.ts +31 -6
- package/src/native-harness/src/state/storage/memory.ts +32 -4
- package/src/native-harness/src/state/storage/reminder-archive.ts +53 -12
- package/src/native-harness/src/state/storage/reminder-change.ts +60 -14
- package/src/native-harness/src/state/storage/reminder-tables.ts +11 -3
- package/src/native-harness/src/state/storage/routine-row.ts +25 -0
- package/src/native-harness/src/state/storage/session-file.ts +22 -9
- package/src/native-harness/src/state/storage/sqlite-reminders.ts +48 -8
- package/src/native-harness/src/state/storage/sqlite.ts +59 -11
- package/src/native-harness/src/state/storage/web-tables.ts +47 -0
- package/src/native-harness/src/testing.ts +151 -56
- package/src/native-harness/src/util/attachment-input.ts +42 -0
- package/src/native-harness/src/util/config.ts +64 -9
- package/src/native-harness/src/util/intake.ts +7 -0
- package/src/native-harness/src/util/mcp-config.ts +102 -0
- package/src/native-harness/src/util/web-config.ts +34 -0
- package/src/native-harness/src/util/web-usage.ts +33 -0
- package/src/orchestrator/permissions.ts +6 -3
- package/src/permissions/conversation.ts +13 -5
- package/src/permissions/matcher.ts +2 -0
- package/src/permissions/outcome.ts +12 -1
- package/src/permissions/policy.ts +13 -8
- package/src/steering/combine.ts +1 -0
- package/src/steering/contracts.ts +3 -0
- package/src/terminals.ts +9 -6
- package/src/native/reminders/reminders.test.ts +0 -553
- package/src/native/reminders/routine-config.typecheck.ts +0 -13
- package/src/native/reminders/wire.typecheck.ts +0 -13
- package/src/native-harness/.res/README.md +0 -1
- package/src/native-harness/.res/architecture/README.md +0 -21
- package/src/native-harness/.res/architecture/context-and-data.md +0 -31
- package/src/native-harness/.res/architecture/execution.md +0 -42
- package/src/native-harness/.res/architecture/overview.md +0 -44
- package/src/native-harness/.res/architecture/persistence.md +0 -56
- package/src/native-harness/.res/architecture/suspend-and-resume.md +0 -45
- package/src/native-harness/.res/architecture/technical-architecture.md +0 -50
- package/src/native-harness/.res/decisions/0001-basic-loop.md +0 -11
- package/src/native-harness/.res/decisions/0002-channel-input.md +0 -17
- package/src/native-harness/.res/decisions/0003-inference-inspection.md +0 -14
- package/src/native-harness/.res/decisions/0004-shared-context.md +0 -21
- package/src/native-harness/.res/decisions/0005-notice-inbox.md +0 -20
- package/src/native-harness/.res/decisions/0006-explicit-notices.md +0 -12
- package/src/native-harness/.res/decisions/0007-channel-output.md +0 -12
- package/src/native-harness/.res/decisions/0008-browser-client.md +0 -16
- package/src/native-harness/.res/decisions/0009-scripted-model.md +0 -18
- package/src/native-harness/.res/decisions/0010-inprocess-protocol.md +0 -19
- package/src/native-harness/.res/decisions/0011-stdio-transport.md +0 -21
- package/src/native-harness/.res/decisions/0012-session-storage-contract.md +0 -37
- package/src/native-harness/.res/decisions/0013-durable-delivery-contract.md +0 -64
- package/src/native-harness/.res/decisions/0014-channel-controls-contract.md +0 -73
- package/src/native-harness/.res/decisions/0015-session-file-contract.md +0 -72
- package/src/native-harness/.res/decisions/0016-configuration-permissions.md +0 -159
- package/src/native-harness/.res/decisions/0017-openrouter-managed-config.md +0 -69
- package/src/native-harness/.res/decisions/0018-tool-dispatch-evidence.md +0 -78
- package/src/native-harness/.res/decisions/0019-model-execution.md +0 -188
- package/src/native-harness/.res/decisions/0020-startup-channel-changes.md +0 -71
- package/src/native-harness/.res/decisions/0021-tools-and-host-callbacks.md +0 -100
- package/src/native-harness/.res/decisions/0022-operator-controls.md +0 -115
- package/src/native-harness/.res/decisions/0023-long-running-mock.md +0 -82
- package/src/native-harness/.res/decisions/0024-callback-policy-names.md +0 -46
- package/src/native-harness/.res/decisions/0025-external-notices.md +0 -364
- package/src/native-harness/.res/decisions/0026-bounded-context.md +0 -81
- package/src/native-harness/.res/decisions/0027-development-instructions.md +0 -22
- package/src/native-harness/.res/decisions/0028-debug-tools.md +0 -16
- package/src/native-harness/.res/decisions/0029-bounded-model-call-pages.md +0 -37
- package/src/native-harness/.res/decisions/0030-timeline-retrieval.md +0 -145
- package/src/native-harness/.res/decisions/0031-one-off-reminders.md +0 -173
- package/src/native-harness/.res/docs/11-15.md +0 -148
- package/src/native-harness/.res/docs/BUSINESS_RULES.md +0 -111
- package/src/native-harness/.res/docs/WORK.md +0 -65
- package/src/native-harness/.res/docs/_/11-16-persistence/LOG.md +0 -312
- package/src/native-harness/.res/docs/_/11-16-persistence/PLAN.md +0 -77
- package/src/native-harness/.res/docs/_/11-16-persistence/SPEC.md +0 -313
- package/src/native-harness/.res/docs/_/11-19-channel-controls/LOG.md +0 -160
- package/src/native-harness/.res/docs/_/11-19-channel-controls/PLAN.md +0 -89
- package/src/native-harness/.res/docs/_/11-19-channel-controls/SPEC.md +0 -135
- package/src/native-harness/.res/docs/_/11-19-config-permissions/LOG.md +0 -143
- package/src/native-harness/.res/docs/_/11-19-config-permissions/PLAN.md +0 -93
- package/src/native-harness/.res/docs/_/11-19-config-permissions/SPEC.md +0 -181
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/11-20-LOG.md +0 -433
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/PLAN.md +0 -60
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/PROTOCOL.md +0 -141
- package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/SPEC.md +0 -168
- package/src/native-harness/.res/docs/attachments/0001-DESIGN/SPEC.md +0 -111
- package/src/native-harness/.res/docs/bounded-context/0001-DESIGN/PLAN.md +0 -129
- package/src/native-harness/.res/docs/bounded-context/0001-DESIGN/SPEC.md +0 -135
- package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/LOG.md +0 -437
- package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/PLAN.md +0 -127
- package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/SPEC.md +0 -203
- package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/LOG.md +0 -292
- package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/PLAN.md +0 -91
- package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/SPEC.md +0 -187
- package/src/native-harness/.res/docs/model-execution/0001-DESIGN/LOG.md +0 -148
- package/src/native-harness/.res/docs/model-execution/0001-DESIGN/PLAN.md +0 -95
- package/src/native-harness/.res/docs/model-execution/0001-DESIGN/SPEC.md +0 -200
- package/src/native-harness/.res/docs/model-execution/0002-AMENDMENT-accounting/SPEC.md +0 -80
- package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/LOG.md +0 -206
- package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/PLAN.md +0 -106
- package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/SPEC.md +0 -297
- package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/LOG.md +0 -41
- package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/PLAN.md +0 -36
- package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/SPEC.md +0 -84
- package/src/native-harness/.res/docs/shell-execution/0001-DESIGN/SPEC.md +0 -147
- package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/LOG.md +0 -15
- package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/PLAN.md +0 -107
- package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/SPEC.md +0 -114
- package/src/native-harness/.res/docs/todos/11-19-TODO-auto_review-approve.md +0 -24
- package/src/native-harness/.res/docs/todos/11-20-TODO-user-entered-tool-code.md +0 -23
- package/src/native-harness/.res/docs/todos/11-21-TODO-node-resource-coordination.md +0 -103
- package/src/native-harness/.res/docs/todos/11-22-TODO-harness-m1-sequence.md +0 -50
- package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/LOG.md +0 -337
- package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/PLAN.md +0 -76
- package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/SPEC.md +0 -204
- package/src/native-harness/.res/docs/tools-and-callbacks/0002-AMENDMENT-callback-policy/LOG.md +0 -73
- package/src/native-harness/.res/docs/tools-and-callbacks/0002-AMENDMENT-callback-policy/SPEC.md +0 -64
- package/src/native-harness/.res/docs/tools-and-callbacks/0003-DESIGN-attachment-tools/SPEC.md +0 -58
- package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/LOG.md +0 -45
- package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/PLAN.md +0 -108
- package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/SPEC.md +0 -169
- package/src/native-harness/.res/docs/web-tools/0001-DESIGN/SPEC.md +0 -128
- package/src/native-harness/.res/marketing-draft.md +0 -22
- package/src/native-harness/.res/sandbox/1-simple-harness/README.md +0 -285
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-1.md +0 -19
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-10.md +0 -138
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-11.md +0 -148
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-12.md +0 -172
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-13.md +0 -194
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-14.md +0 -233
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-15.md +0 -249
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-16.md +0 -265
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-17.md +0 -279
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-18.md +0 -293
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-19.md +0 -307
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-2.md +0 -29
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-20.md +0 -317
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-21.md +0 -327
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-3.md +0 -40
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-4.md +0 -59
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-5.md +0 -69
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-6.md +0 -79
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-7.md +0 -89
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-8.md +0 -102
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-9.md +0 -116
- package/src/native-harness/.res/sandbox/1-simple-harness/conversation.jsonl +0 -49
- package/src/native-harness/.res/sandbox/1-simple-harness/doc.md +0 -87
- package/src/native-harness/.res/sandbox/1-simple-harness/harness.py +0 -289
- package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy 2.py +0 -221
- package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy 3.py +0 -287
- package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy.py +0 -165
- package/src/native-harness/.res/sandbox/1-simple-harness/state.json +0 -22
- package/src/native-harness/.res/sandbox/1-simple-harness/system-prompt.md +0 -2
- package/src/native-harness/AGENTS.md +0 -70
- package/src/native-harness/ARCHITECTURE.md +0 -249
- package/src/native-harness/bun.lock +0 -26
- package/src/native-harness/test/agent.test.ts +0 -130
- package/src/native-harness/test/approval-gate.test.ts +0 -255
- package/src/native-harness/test/approval-protocol.test.ts +0 -94
- package/src/native-harness/test/boundaries.test.ts +0 -18
- package/src/native-harness/test/channel-controls.test.ts +0 -322
- package/src/native-harness/test/client-abort.test.ts +0 -136
- package/src/native-harness/test/config-policy.test.ts +0 -301
- package/src/native-harness/test/conformance/storage.ts +0 -1141
- package/src/native-harness/test/context.test.ts +0 -177
- package/src/native-harness/test/crash.test.ts +0 -187
- package/src/native-harness/test/debug-tools.test.ts +0 -67
- package/src/native-harness/test/development-cli.test.ts +0 -67
- package/src/native-harness/test/development.test.ts +0 -171
- package/src/native-harness/test/dispatch-evidence.test.ts +0 -58
- package/src/native-harness/test/e2e.test.ts +0 -186
- package/src/native-harness/test/external-notices.test.ts +0 -101
- package/src/native-harness/test/fixtures/approval-e2e.jsonl +0 -4
- package/src/native-harness/test/fixtures/crash-scenario.jsonl +0 -5
- package/src/native-harness/test/fixtures/development-lifecycle.jsonl +0 -10
- package/src/native-harness/test/fixtures/echo-scenario.jsonl +0 -3
- package/src/native-harness/test/fixtures/format2-schema.ts +0 -27
- package/src/native-harness/test/fixtures/format3-schema.ts +0 -16
- package/src/native-harness/test/fixtures/hold-scenario.jsonl +0 -4
- package/src/native-harness/test/fixtures/model-e2e.jsonl +0 -3
- package/src/native-harness/test/fixtures/storage-owner.ts +0 -20
- package/src/native-harness/test/format-reply.test.ts +0 -10
- package/src/native-harness/test/helpers/operator-view.ts +0 -41
- package/src/native-harness/test/helpers/scenario.ts +0 -9
- package/src/native-harness/test/helpers/session.ts +0 -38
- package/src/native-harness/test/helpers/stdio.ts +0 -46
- package/src/native-harness/test/inspector.test.ts +0 -77
- package/src/native-harness/test/listeners.test.ts +0 -49
- package/src/native-harness/test/loop.test.ts +0 -88
- package/src/native-harness/test/model-channel-double.test.ts +0 -87
- package/src/native-harness/test/model-crash.test.ts +0 -62
- package/src/native-harness/test/model-delivery-regressions.test.ts +0 -55
- package/src/native-harness/test/model-e2e.test.ts +0 -71
- package/src/native-harness/test/model-final-filter.test.ts +0 -30
- package/src/native-harness/test/model-large-reply.test.ts +0 -28
- package/src/native-harness/test/model-live-queue.test.ts +0 -33
- package/src/native-harness/test/model-runner.test.ts +0 -117
- package/src/native-harness/test/model-storage.test.ts +0 -99
- package/src/native-harness/test/model-stream-adapter.test.ts +0 -26
- package/src/native-harness/test/model-stream-public.test.ts +0 -77
- package/src/native-harness/test/notices.test.ts +0 -64
- package/src/native-harness/test/openrouter-config.test.ts +0 -218
- package/src/native-harness/test/operator-controls.test.ts +0 -132
- package/src/native-harness/test/output.test.ts +0 -44
- package/src/native-harness/test/owner-config.test.ts +0 -64
- package/src/native-harness/test/permissions-e2e.test.ts +0 -68
- package/src/native-harness/test/persistence.test.ts +0 -236
- package/src/native-harness/test/portability.test.ts +0 -337
- package/src/native-harness/test/protocol.test.ts +0 -160
- package/src/native-harness/test/reminder-clock.test.ts +0 -61
- package/src/native-harness/test/reminder-stdio.test.ts +0 -140
- package/src/native-harness/test/reminder-storage.test.ts +0 -124
- package/src/native-harness/test/scenario-jsonl.test.ts +0 -112
- package/src/native-harness/test/scripted.test.ts +0 -92
- package/src/native-harness/test/session-file.test.ts +0 -51
- package/src/native-harness/test/startup-channel-changes.test.ts +0 -256
- package/src/native-harness/test/stdio.test.ts +0 -132
- package/src/native-harness/test/storage-memory.test.ts +0 -4
- package/src/native-harness/test/storage-sqlite.test.ts +0 -420
- package/src/native-harness/test/suspension.test.ts +0 -430
- package/src/native-harness/test/timeline-retrieval.test.ts +0 -211
- package/src/native-harness/test/tools-catalog.test.ts +0 -468
- package/src/native-harness/test/tools-protocol.test.ts +0 -418
- package/src/native-harness/test/transfers.test.ts +0 -94
- package/src/native-harness/test/web-chat.test.ts +0 -35
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
# Long-running mock mode
|
|
2
|
-
|
|
3
|
-
Date: 2026-11-21.
|
|
4
|
-
Status: proposed for review. See [PLAN.md](PLAN.md) for module ownership,
|
|
5
|
-
implementation gates, and the final driven rehearsal.
|
|
6
|
-
|
|
7
|
-
## Goal
|
|
8
|
-
|
|
9
|
-
Run repeatable offline rehearsals with the real native harness and acp-client.
|
|
10
|
-
Use the same scenario file format for short deterministic tests and workloads
|
|
11
|
-
lasting minutes or hours. The rehearsal can simulate model output and tool
|
|
12
|
-
effects while exercising real channel scheduling, inference boundaries,
|
|
13
|
-
permissions, callbacks, persistence, and control operations.
|
|
14
|
-
|
|
15
|
-
Build on the [acp-client integration](../../acp-client-integration/0001-DESIGN/SPEC.md),
|
|
16
|
-
[host callbacks](../../tools-and-callbacks/0001-DESIGN/SPEC.md), and
|
|
17
|
-
[operator controls](../../operator-controls/0001-DESIGN/SPEC.md). Use the
|
|
18
|
-
existing scripted model, model-attempt reservation, and public stdio client.
|
|
19
|
-
|
|
20
|
-
## Ownership
|
|
21
|
-
|
|
22
|
-
| Component | Responsibility |
|
|
23
|
-
| --- | --- |
|
|
24
|
-
| Scenario file | Describe simulated model attempts and scheduled participant messages. |
|
|
25
|
-
| Harness scripted model | Emit the prescribed provider-neutral events in response to a real inference request. |
|
|
26
|
-
| Harness session | Own admission, context, model execution, permission checks, tool dispatch, notices, and durable records. |
|
|
27
|
-
| Rehearsal driver | Run scheduled inputs through acp-client, observe outcomes, and control the child process when tests require it. |
|
|
28
|
-
| Test tool handlers | Simulate controlled delays, holds, failures, and observable effects through the normal tool paths. |
|
|
29
|
-
|
|
30
|
-
The driver lives outside the harness child and can replace it while the same
|
|
31
|
-
run continues. It sends inputs and controls through the consumer APIs. Short
|
|
32
|
-
tests can provide their own input and controls in code while using the same
|
|
33
|
-
model file format.
|
|
34
|
-
|
|
35
|
-
## JSONL file
|
|
36
|
-
|
|
37
|
-
A local UTF-8 JSONL file contains one JSON object per record. The first record
|
|
38
|
-
declares the format version. Model and send records can be interleaved. The
|
|
39
|
-
loader validates the file before execution and reports malformed or unsupported
|
|
40
|
-
records with their line numbers. Convert the existing short JSON fixtures so
|
|
41
|
-
there is one supported on-disk script format.
|
|
42
|
-
|
|
43
|
-
Parse and validate the scenario once per open and reuse the validated sequences
|
|
44
|
-
across channels and attempts. Each channel has its own attempt position.
|
|
45
|
-
|
|
46
|
-
| Record | Fields and behavior |
|
|
47
|
-
| --- | --- |
|
|
48
|
-
| `scenario` | `version` and a scenario name. Required first record. |
|
|
49
|
-
| `model` | Optional channel ID, optional initial delay, and the simulated attempt behavior. Supports text, timed text chunks, tool requests, synthetic usage, a typed provider failure, or a wait that ends on cancellation. A tool request contains the existing call ID, name, and arguments. |
|
|
50
|
-
| `send` | Elapsed time from the start in milliseconds, channel ID, participant ID, stable input ID, and text. |
|
|
51
|
-
|
|
52
|
-
Example of a model-only script for a test that provides its own prompt:
|
|
53
|
-
|
|
54
|
-
```jsonl
|
|
55
|
-
{"type":"scenario","version":1,"name":"clock"}
|
|
56
|
-
{"type":"model","channelId":"alice","content":"I’ll check the time.","calls":[{"id":"time-1","name":"current_time","arguments":{}}]}
|
|
57
|
-
{"type":"model","channelId":"alice","content":"I checked the time."}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
One model record describes one attempt. Requesting tools leaves execution to
|
|
61
|
-
the harness. Its next attempt consumes another record and receives the real
|
|
62
|
-
tool results in context. A prewritten follow-up alone cannot establish that
|
|
63
|
-
the tool ran or its result reached the model. Tests use recorded effects and,
|
|
64
|
-
when needed, captured requests to verify those boundaries.
|
|
65
|
-
|
|
66
|
-
## Selection, timing, and recovery
|
|
67
|
-
|
|
68
|
-
Model records for a channel are consumed in file order for that channel.
|
|
69
|
-
Channel-specific sequences take precedence. Model records with no channel ID
|
|
70
|
-
form a reusable default sequence for channels that lack a specific sequence.
|
|
71
|
-
Each such channel has its own position, preserving the existing short-fixture
|
|
72
|
-
behavior. Exhausting the selected sequence reports `script_exhausted`.
|
|
73
|
-
|
|
74
|
-
In a durable session, reuse the existing per-channel model-attempt reservation.
|
|
75
|
-
A retry consumes another record. A crash after reservation leaves that record
|
|
76
|
-
consumed. Persist a digest of the validated model sequences when the scripted
|
|
77
|
-
session is created. Check it on every reopen before enabling execution or
|
|
78
|
-
reserving another attempt, including after a crash with no checkpoint. Return
|
|
79
|
-
`incompatible` if the sequences changed. Formatting and scheduled sends are
|
|
80
|
-
outside the model digest. An older scripted store without a digest requires a
|
|
81
|
-
fresh test session. The driver records the whole-file digest for reproducibility
|
|
82
|
-
and retains its scheduled-action position across a child restart. Persisting
|
|
83
|
-
and restarting the driver itself is outside this slice.
|
|
84
|
-
|
|
85
|
-
Scheduled sends use elapsed time from a monotonic run clock. Sends with the
|
|
86
|
-
same timestamp are issued in file order. Independent channels can overlap, so
|
|
87
|
-
issuing a send does not wait for that turn to complete. Record actual execution
|
|
88
|
-
order and input grouping for diagnosis. Deterministic tests can assert which
|
|
89
|
-
input IDs were included at a particular inference boundary. Use existing
|
|
90
|
-
attempt and turn evidence where it identifies that boundary precisely. Add a
|
|
91
|
-
focused test observation if needed. These assertions do not select responses.
|
|
92
|
-
Timed runs enforce input grouping only when the test declares an expectation.
|
|
93
|
-
Model delays and fixture waits honor cancellation and exercise the configured
|
|
94
|
-
model, approval, and tool deadlines.
|
|
95
|
-
|
|
96
|
-
CI uses barriers in test code. For example, a hold handler signals entry and
|
|
97
|
-
waits for release. The test sends Bob's input after that signal, waits for Bob's
|
|
98
|
-
turn to finish, then releases Alice's handler. Detach, approval, interruption,
|
|
99
|
-
suspension, and restart can also be scripted in test code through the existing
|
|
100
|
-
APIs. The file format in this slice schedules sends. General event triggers and
|
|
101
|
-
file-driven control commands can follow later.
|
|
102
|
-
|
|
103
|
-
## Tools and notices
|
|
104
|
-
|
|
105
|
-
Reuse the default `notify_channel` built-in from
|
|
106
|
-
[operator controls](../../operator-controls/0001-DESIGN/SPEC.md).
|
|
107
|
-
The harness provides its definition and handler through normal session
|
|
108
|
-
composition and reserves the name against consumer registration. It derives
|
|
109
|
-
the source channel and turn from the invocation and uses the existing
|
|
110
|
-
permission and channel admission paths. A model record can request it and the
|
|
111
|
-
target consumes its next model response if the notice wakes a turn. A driver
|
|
112
|
-
notification command is outside this slice. The mock exercises channel
|
|
113
|
-
notices. Topic notices can follow when the built-in capability is available.
|
|
114
|
-
|
|
115
|
-
Reuse controlled test tools and add a small set of fixture handlers for quiet
|
|
116
|
-
callbacks, delayed results, failures, and observable effects. The fixture owns
|
|
117
|
-
its effects. The harness owns approval, cancellation, pairing results with
|
|
118
|
-
calls, and crash recovery. Uncertain effects follow the existing no-replay rule.
|
|
119
|
-
|
|
120
|
-
The timed rehearsal command supplies a documented set of test handlers and a
|
|
121
|
-
dedicated tool policy. The checked-in timed fixture uses bounded handlers and
|
|
122
|
-
explicitly allows any built-in notices it requests. It runs unattended. Keep
|
|
123
|
-
approval waits, manual holds, and deliberate stalls in deterministic tests,
|
|
124
|
-
where test code controls the responder and release. Both modes use the same
|
|
125
|
-
permission gate and report unexpected tool failures in the run results.
|
|
126
|
-
|
|
127
|
-
## Run results
|
|
128
|
-
|
|
129
|
-
Run against a fresh test session by default. A restart case deliberately reopens
|
|
130
|
-
that same session. After all scheduled sends are issued, allow expected work to
|
|
131
|
-
settle within a configured run deadline. Track each scheduled send by input ID
|
|
132
|
-
and resolve each accepted input to an outcome. Several accepted inputs can
|
|
133
|
-
share one turn. Completion also checks the session for work started by notices,
|
|
134
|
-
including on channels with no scheduled sends. Running turns, pending inputs,
|
|
135
|
-
and checkpoints count as unfinished unless the test explicitly expects that
|
|
136
|
-
state. An idle indication alone does not establish completion. Once work
|
|
137
|
-
settles, capture a consistent final revision for delivery verification. If
|
|
138
|
-
the run reaches its deadline, record the blocking work available through
|
|
139
|
-
status, then stop and reap the child within the cleanup budget.
|
|
140
|
-
|
|
141
|
-
Fail on unexpected rejection or turn failure, unfinished work at the deadline,
|
|
142
|
-
or missing or duplicate committed replies where delivery was expected. A test
|
|
143
|
-
can explicitly expect interruption, failure, or timeout. Report unused model
|
|
144
|
-
records separately. Unused records fail a test only when it requires exact
|
|
145
|
-
consumption.
|
|
146
|
-
|
|
147
|
-
Record a compact event log and summary with run duration, sent inputs, turn
|
|
148
|
-
outcomes, and observable callback effects. Compare replies recorded by the
|
|
149
|
-
consumer with bounded harness history reads by committed message ID through the
|
|
150
|
-
final revision. Scope the comparison to the tested channels and expected
|
|
151
|
-
delivery windows. For detached channels, check expected replies after explicit
|
|
152
|
-
recovery. Full inference-request capture is opt-in at the scripted adapter.
|
|
153
|
-
With capture disabled, skip diagnostic cloning, retention, and file writes of
|
|
154
|
-
full requests. Lightweight attempt observations can still report channel,
|
|
155
|
-
ordinal, and input IDs. Generate synthetic fixtures before running them.
|
|
156
|
-
Fixture authors can use real timing and event patterns as a guide.
|
|
157
|
-
|
|
158
|
-
## Acceptance
|
|
159
|
-
|
|
160
|
-
1. Convert existing fixture coverage to JSONL and verify a model-only script
|
|
161
|
-
works through the scripted harness. Reject malformed records, report a
|
|
162
|
-
missing response explicitly, and verify independent channel positions.
|
|
163
|
-
After a crash with pending input and no checkpoint, reject a changed model
|
|
164
|
-
sequence before any new attempt is reserved. Verify capture-off skips full
|
|
165
|
-
request copying and several attempts reuse one validated scenario.
|
|
166
|
-
2. Run a deterministic acp-client test with a real stdio child. Alice streams
|
|
167
|
-
text and waits on a controlled callback while Bob completes. Exercise
|
|
168
|
-
approval through the normal gate, then verify targeted interruption leaves
|
|
169
|
-
Bob unaffected. Assert the callback and committed results from observed
|
|
170
|
-
evidence. Exercise steering and verify the expected input IDs at the next
|
|
171
|
-
inference boundary.
|
|
172
|
-
3. Detach a conversation, let a built-in channel notice start work there, and
|
|
173
|
-
recover the committed reply exactly once after reattachment. Suspend with
|
|
174
|
-
work in progress, replace the child, and resume from the checkpoint without
|
|
175
|
-
repeating a committed effect. Exercise abrupt interruption separately and
|
|
176
|
-
verify a reserved attempt and an uncertain effect are not replayed.
|
|
177
|
-
4. Run a multi-minute timed fixture with bursts, idle gaps, concurrent
|
|
178
|
-
channels, and short and tool-heavy turns. Verify the driver finishes within
|
|
179
|
-
the configured run deadline, accounts for accepted inputs and expected
|
|
180
|
-
committed replies by ID through the final revision, and leaves no child
|
|
181
|
-
process running. Verify the driver waits for a notice-driven turn after the
|
|
182
|
-
last scheduled input settles. Exercise deadline diagnostics and cleanup
|
|
183
|
-
separately. The same driver accepts hour-scale fixtures. All runs work
|
|
184
|
-
without contacting a model provider.
|
|
185
|
-
5. In an ordinary session, verify `notify_channel` is offered once when
|
|
186
|
-
policy allows it and runs without consumer registration. Verify policy
|
|
187
|
-
denial prevents dispatch and consumer registration cannot shadow it.
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
# Model execution work log
|
|
2
|
-
|
|
3
|
-
Implementation branch `aiagent/cod1a-model-execution` starts from accepted
|
|
4
|
-
configuration/permissions closure `28c6faf7faf3d4d48333498a61ea74f92273cc25`.
|
|
5
|
-
Scope commit `0590af9` was cherry-picked as `aeac966`. Stage 1 defines the
|
|
6
|
-
contract and decision before runner, adapter, storage, or protocol behavior.
|
|
7
|
-
Each stage requires its own gate and Gro's review of the named revision before
|
|
8
|
-
continuing. The final gate includes scripted SQLite over real stdio, in-process
|
|
9
|
-
parity, full typecheck and the complete offline harness suite.
|
|
10
|
-
|
|
11
|
-
Stage 1 contract gate: `bun run typecheck --pretty false` passed. Decision
|
|
12
|
-
0019 traces retry in both subscriptions, interruption, slow delivery, and the
|
|
13
|
-
crash boundaries, including durable receipts, usage and script reservation.
|
|
14
|
-
Independent contract review is pending; no dependent implementation is included.
|
|
15
|
-
|
|
16
|
-
Gro did not approve `741cdff`; the requested contract locks include the existing
|
|
17
|
-
wire event, turn outcomes, deadline start, scripted counter, dispatch fence,
|
|
18
|
-
receipt/usage validation, transactional migration and bounded delivery. The
|
|
19
|
-
revised contract includes those locks and wires the new types into the actual
|
|
20
|
-
protocol, events and storage contracts. Standalone contract `tsc` passes. Full
|
|
21
|
-
`bun run typecheck --pretty false` is expected to fail until implementations
|
|
22
|
-
handle reference messages, storage format 5/archive 4 and model-call methods;
|
|
23
|
-
no implementation changes are included in this revision. Gro's re-review is
|
|
24
|
-
required before Stage 2.
|
|
25
|
-
|
|
26
|
-
Gro approved Stage 1 at `a9b5f84f4d165409bc7d9e81ecf15009b484714c`.
|
|
27
|
-
Standalone contract typecheck passed independently; the full typecheck's 27
|
|
28
|
-
errors were accepted as pending storage and reference-consumer implementation.
|
|
29
|
-
|
|
30
|
-
## Stage 2: call execution
|
|
31
|
-
|
|
32
|
-
The logical-call runner, scripted reservation adapter, OpenRouter streaming
|
|
33
|
-
translation and turn's commit-before-dispatch path are implemented. The gate
|
|
34
|
-
uses a call-store double: `bun test test/model-channel-double.test.ts
|
|
35
|
-
test/model-runner.test.ts test/model-stream-adapter.test.ts test/loop.test.ts`
|
|
36
|
-
passed 21 tests, 0 failures and 66 assertions. It covers the same-channel
|
|
37
|
-
scheduler after interruption, stop and late response, the permission gate after
|
|
38
|
-
commit, retry and deadline, both text-delivery cutoff paths, malformed calls,
|
|
39
|
-
and both adapters through the runner.
|
|
40
|
-
|
|
41
|
-
Full `bun run typecheck --pretty false` remains red on the 27 already identified
|
|
42
|
-
storage format and reference-consumer errors. The real `test/scripted.test.ts`
|
|
43
|
-
scheduler case fails at missing `startCall` because the memory and SQLite
|
|
44
|
-
call-store implementations belong to Stage 3; the other four cases pass. Stage 3
|
|
45
|
-
must repeat channel usability and the scripted test on both real adapters, along
|
|
46
|
-
with persistence and crash gates. No Stage 3 storage work is included here.
|
|
47
|
-
Independent Stage 2 review is pending.
|
|
48
|
-
|
|
49
|
-
Gro did not approve `c02868b`: final subscriptions received ephemeral text
|
|
50
|
-
notifications that the current stdio parser rejects. The protocol publication
|
|
51
|
-
filter now drops text_delta, text_gap and text_incomplete for final mode, after
|
|
52
|
-
the runner's independent retry cutoff. A protocol regression test verifies
|
|
53
|
-
receipts, message_completed, tool and turn events still pass. The expanded gate
|
|
54
|
-
(`bun test test/model-final-filter.test.ts test/model-channel-double.test.ts
|
|
55
|
-
test/model-runner.test.ts test/model-stream-adapter.test.ts test/loop.test.ts`)
|
|
56
|
-
passed 22 tests, 0 failures, 68 assertions. Full typecheck remains at the same
|
|
57
|
-
27 deferred storage/reference errors; the real scripted scheduler remains
|
|
58
|
-
blocked on Stage 3's call store. Independent re-review is pending.
|
|
59
|
-
|
|
60
|
-
Gro approved Stage 2 at `aeb81af68d9dcdbd3619fdeb71608e2165bc5e08`;
|
|
61
|
-
their independent focused gate passed 22 tests, 0 failures, 68 assertions.
|
|
62
|
-
|
|
63
|
-
## Stage 3: storage and streaming
|
|
64
|
-
|
|
65
|
-
Memory and SQLite use the shared call-store transactions; format 2/3/4 recovery
|
|
66
|
-
and migration publish format 5, and logical archive 4 retains call summaries,
|
|
67
|
-
script positions and message identity. The stdio parser accepts stream events
|
|
68
|
-
and reference completions. A bounded live queue drops deltas with a gap or fails
|
|
69
|
-
a blocked connection; oversized committed text is available in bounded byte
|
|
70
|
-
pages. The public client exposes message and model-call reads and usage summing.
|
|
71
|
-
|
|
72
|
-
Both real adapters pass interruption followed by new work, receipt and usage
|
|
73
|
-
reopen, script reservation and archive identity tests. SQLite SIGKILL tests on
|
|
74
|
-
both sides of response commit check call outcome, timeline identity and the next
|
|
75
|
-
reserved script step. Other checks cover final/stream message IDs and ordering,
|
|
76
|
-
a slow reader while another channel commits, blocked-queue shutdown, large
|
|
77
|
-
UTF-8 reads on both transports, and a storage failure after a streamed draft.
|
|
78
|
-
The test using usage reports across reopen uses a clean handle close to simulate
|
|
79
|
-
recovery; the SIGKILL fixtures do not themselves report provider usage.
|
|
80
|
-
|
|
81
|
-
Gate: `bun run typecheck --pretty false` passed; `bun test ./test` passed 282
|
|
82
|
-
tests, 0 failures, 3103 assertions across 39 files (57.84s), with local IPC
|
|
83
|
-
access. The shared storage engine remains over 400 lines because it owns the
|
|
84
|
-
transactional lifecycle and model-call rules for both adapters. Model metadata is
|
|
85
|
-
currently serialized as one state record, so updates copy and rewrite that record
|
|
86
|
-
as call history grows; performance at large call counts has not been benchmarked.
|
|
87
|
-
Independent Stage 3 review is pending. Stage 4 still requires the real scripted
|
|
88
|
-
stdio stall/deadline scenario, documentation and final independent review.
|
|
89
|
-
|
|
90
|
-
Gro did not approve Stage 3 at `2ed06ec`: summary pagination discarded earlier
|
|
91
|
-
records when a later summary exceeded a frame, and in-process delivery lacked
|
|
92
|
-
the bounded live queue. The fix returns a continuation after earlier whole
|
|
93
|
-
summaries and fails only when an oversized summary is first on its page. The
|
|
94
|
-
in-process transport now uses the same bounded queue as stdio; nondroppable
|
|
95
|
-
overflow closes the connection and stops the session. Regression tests cover
|
|
96
|
-
both paging orders, delta drop and gap, and connection failure. No Stage 4 work
|
|
97
|
-
is included. Re-review gate: `bun run typecheck --pretty false` passed;
|
|
98
|
-
`bun test ./test` passed 285 tests, 0 failures, 3113 assertions across 40 files
|
|
99
|
-
(51.79s), with local IPC access. Independent re-review is pending.
|
|
100
|
-
|
|
101
|
-
Gro approved Stage 3 at `19c189e22ff8ccab2fb5a11d5becf00731482a31`;
|
|
102
|
-
their independent typecheck passed and the full suite passed 285 tests, 0
|
|
103
|
-
failures, 3113 assertions across 40 files (58.46s). The accepted limitations
|
|
104
|
-
remain: usage recovery was checked across clean reopen, not SIGKILL; the crash
|
|
105
|
-
fixtures do not report usage; and model metadata is one rewritten state record.
|
|
106
|
-
|
|
107
|
-
## Stage 4: public flow and final gate
|
|
108
|
-
|
|
109
|
-
A real scripted SQLite stdio child uses opt-in test hooks for a partial reply,
|
|
110
|
-
stall, reported usage and a 1.5-second model deadline. Alice times out with an
|
|
111
|
-
incomplete draft and one attempt after Bob finishes; no response or tool effect
|
|
112
|
-
is committed for her timed-out call. Alice completes fresh work, then reopen
|
|
113
|
-
retains the timeout, usage and Seen receipt. Separate public cases exercise a
|
|
114
|
-
text-and-tool response followed by a later reply in final and stream modes over
|
|
115
|
-
both in-process and stdio, checking message IDs and completion-before-dispatch.
|
|
116
|
-
The development inspector displays durable call summaries and attempts after
|
|
117
|
-
reopen. README, architecture and business rules document the implementation.
|
|
118
|
-
|
|
119
|
-
Final implementation gate: `bun run typecheck --pretty false` passed;
|
|
120
|
-
`bun test ./test` passed 290 tests, 0 failures, 3149 assertions across 41 files
|
|
121
|
-
(69.67s), with local IPC access. Gro approved the behavior revision
|
|
122
|
-
`02c96de2ee9b70cad2081e744b67737dc1b58844`; their independent typecheck
|
|
123
|
-
passed and the full suite passed 290 tests, 0 failures, 3149 assertions across
|
|
124
|
-
41 files (68.33s). The test stall and stream behavior is supplied by opt-in
|
|
125
|
-
`HARNESS_TEST_*` hooks around the scripted adapter; ordinary scripted files
|
|
126
|
-
remain complete-response scripts.
|
|
127
|
-
|
|
128
|
-
## Closure and retrospective
|
|
129
|
-
|
|
130
|
-
The accepted chain is configuration/permissions closure `28c6faf`, model scope
|
|
131
|
-
`aeac966`, Stage 1 contract `a9b5f84`, Stage 2 `aeb81af`, Stage 3 `19c189e`,
|
|
132
|
-
and Stage 4 behavior `02c96de`. The envelope remains version 1; the durable
|
|
133
|
-
storage format is 5 and logical archive is 4. The default model deadline remains
|
|
134
|
-
120 seconds, while the final stdio test used 1.5 seconds.
|
|
135
|
-
|
|
136
|
-
Contract review clarified the existing wire completion, recovery ordering and
|
|
137
|
-
attempt reservation before implementation. Independent stage reviews caught a
|
|
138
|
-
final-mode publication error, then a pagination and in-process buffering gap;
|
|
139
|
-
each was fixed and re-reviewed before the next stage. The public gate verified
|
|
140
|
-
timeout and fresh work with a real SQLite stdio child, plus both text modes and
|
|
141
|
-
transports; the inspector was checked across reopen.
|
|
142
|
-
|
|
143
|
-
Accepted limits: usage recovery was tested across a clean close, not SIGKILL;
|
|
144
|
-
the SIGKILL fixtures do not emit usage. Model metadata is stored as one rewritten
|
|
145
|
-
record and its performance at large call counts has not been benchmarked. The
|
|
146
|
-
shared storage engine exceeds 400 lines because it owns both adapters' common
|
|
147
|
-
transactions. The test-only stall and delta hooks do not extend the ordinary
|
|
148
|
-
script-file format. No merge was requested.
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Model execution implementation plan
|
|
2
|
-
|
|
3
|
-
Date: 2026-11-19.
|
|
4
|
-
Status: ready for implementation. Start with the contract gate after the base is accepted.
|
|
5
|
-
|
|
6
|
-
## Scope and module map
|
|
7
|
-
|
|
8
|
-
Implement [SPEC.md](SPEC.md) on a base containing the accepted configuration
|
|
9
|
-
and permissions slice. Record the actual base at assignment. Preserve the
|
|
10
|
-
permission gate and dispatch events. Add a model call runner, streaming
|
|
11
|
-
adapters, and durable call summaries. Topic notices and image input have
|
|
12
|
-
their own work items.
|
|
13
|
-
|
|
14
|
-
Paths below are relative to the native harness package.
|
|
15
|
-
|
|
16
|
-
| Area | Existing or proposed code | Ownership |
|
|
17
|
-
| --- | --- | --- |
|
|
18
|
-
| Contracts | `src/contracts/{loop,events,session,storage,protocol}.ts` and a model contract file if needed | Define adapter attempt events, call and attempt outcomes, receipt evidence, reply IDs, and summary retrieval. |
|
|
19
|
-
| Model execution | New call runner and retry policy in `src/capabilities/model/` | Run one logical call, classify retries, apply a shared deadline, and fence late output. Keep the 120-second deadline, one-second delay, and single retry budget in named defaults. |
|
|
20
|
-
| Model adapters | Existing `src/capabilities/model/{openrouter,scripted}.ts` | Report one attempt using neutral events. Assemble provider tool-call fragments and handle terminal response and usage translation at the edge. Preserve complete-response support. |
|
|
21
|
-
| Kernel and assembly | `src/kernel/{loop,channels}.ts` and `src/index.ts` | Connect the call runner and lifecycle signals through contracts. Commit responses before tool dispatch. Finish iterations and take input at existing boundaries. |
|
|
22
|
-
| State | `src/state/storage/{engine,memory,sqlite,archive}.ts` as needed | Persist summaries, receipts, and scripted attempt position. Commit successful calls and their responses atomically. Recover unfinished calls as interrupted. Settle export/import treatment in the storage contract. |
|
|
23
|
-
| Consumer interfaces | `src/contracts/protocol.ts`, the typed client, and `src/interfaces/{protocol,inspector}/` | Expose both subscription modes, bounded live delivery, completion by ID, reconnect reconciliation, and summary reads. |
|
|
24
|
-
| Verification | `src/testing.ts` and `test/` | Use scripted streams, controlled timing, and local provider fixtures. Verify the same contract through in-process and real stdio clients. |
|
|
25
|
-
|
|
26
|
-
Keep retry and provider details out of the kernel. Permission and tool timeouts
|
|
27
|
-
remain at their own boundaries. Update
|
|
28
|
-
[BUSINESS_RULES.md](../../BUSINESS_RULES.md) with the implementation locations
|
|
29
|
-
for the defaults and behavioral choices once they ship.
|
|
30
|
-
|
|
31
|
-
## Implementation stages and acceptance gates
|
|
32
|
-
|
|
33
|
-
| Stage | Work and dependencies | Acceptance gate |
|
|
34
|
-
| --- | --- | --- |
|
|
35
|
-
| **1. Contracts** | Define adapter outcomes, receipt evidence, stable reply IDs, atomic success commit, and durable script reservation. Settle usage ordering, storage and archive compatibility, bounded buffering, and reads of large replies. Record decisions before dependent changes. | Typecheck. Trace retry in both subscription modes, interruption, slow delivery, and crashes before and after response commit. Each trace identifies which records commit and what the consumer can recover. |
|
|
36
|
-
| **2. Call execution** | Implement the model call runner and named defaults. Adapt OpenRouter and scripted inference. Apply the retry cutoff before subscription filtering. Wire cancellation and the permission gate. | A transient failure can retry the identical request once within its deadline. Partial text closes retry in both modes. Interrupt cancels an attempt or retry wait, fences late output, and leaves the channel usable. Invalid tool fragments never dispatch. |
|
|
37
|
-
| **3. Streaming and storage** | Correlate drafts, terminal outcomes and committed replies. Implement the atomic success commit, scripted attempt position, durable receipt and usage retrieval, and bounded live delivery. | Verify both sides of the crash boundary and reconnect by message ID. Slow delta readers cannot stall another channel's execution. Oversized replies remain retrievable by ID. Known usage survives reopen without duplicate counts. |
|
|
38
|
-
| **4. End to end and review** | Connect the public API and inspector. Run the scripted process checks, update usage and architecture docs, and run the full harness suite. | Typecheck and the full offline suite pass. Run the public flow below. Independently review the exact revision and record the evidence. |
|
|
39
|
-
|
|
40
|
-
### End-to-end gate
|
|
41
|
-
|
|
42
|
-
Run a SQLite session through the public client against a real scripted stdio
|
|
43
|
-
child. Alice streams part of a reply, then the script stalls. Bob completes a
|
|
44
|
-
turn on another channel. Trigger Alice's model deadline with a short test
|
|
45
|
-
setting. Verify Alice's live reply ends as incomplete, the call does not
|
|
46
|
-
retry, no tool runs from that stream, and the timeline has no completed reply
|
|
47
|
-
for it. Verify Alice accepts fresh work. Reopen and confirm the recorded call
|
|
48
|
-
outcome and any confirmed receipts remain available.
|
|
49
|
-
|
|
50
|
-
Use focused tests with controlled timing for retry before output, expiry
|
|
51
|
-
during retry wait, and interruption versus a late terminal response. Exercise
|
|
52
|
-
suspension at the iteration boundary with a completed response and tool
|
|
53
|
-
result. The runtime deadline stays at its documented default for ordinary use.
|
|
54
|
-
|
|
55
|
-
Verify both subscription modes with a text-and-tool response followed by a
|
|
56
|
-
later assistant reply. Messages mode delivers complete messages and tool
|
|
57
|
-
events. Streaming uses the same message IDs for deltas and completion.
|
|
58
|
-
Exercise a slow reader and verify that Bob's work commits and is recoverable
|
|
59
|
-
even if his events are delayed. Test dropping deltas separately from failing
|
|
60
|
-
a fully blocked connection, which follows the existing stop rules.
|
|
61
|
-
|
|
62
|
-
## How we work
|
|
63
|
-
|
|
64
|
-
### Shared rules
|
|
65
|
-
|
|
66
|
-
- Follow [AGENTS.md](../../../../AGENTS.md) and [ARCHITECTURE.md](../../../../ARCHITECTURE.md).
|
|
67
|
-
Land contract changes and their decision record ahead of dependent changes.
|
|
68
|
-
- Use one implementation branch and record its base, decisions, and gate
|
|
69
|
-
results in `LOG.md` when work starts.
|
|
70
|
-
- Use offline checks with scripted models and local fixtures. Identify the
|
|
71
|
-
exact revision in each review handoff.
|
|
72
|
-
|
|
73
|
-
### Coordinator
|
|
74
|
-
|
|
75
|
-
Assign one implementer and one independent reviewer once the scope is approved.
|
|
76
|
-
Confirm the accepted base, settle changes to scope or contracts, and check final
|
|
77
|
-
evidence against the spec.
|
|
78
|
-
|
|
79
|
-
### Implementer
|
|
80
|
-
|
|
81
|
-
Own branch edits. Run each gate and send the reviewer the exact revision and
|
|
82
|
-
evidence. Address findings directly and send the revised revision back.
|
|
83
|
-
|
|
84
|
-
### Reviewer
|
|
85
|
-
|
|
86
|
-
Review each revision independently and send findings directly to the implementer.
|
|
87
|
-
Check that retries cannot duplicate visible output or tool effects, late
|
|
88
|
-
results cannot advance a stopped turn, and usage remains attributable to the
|
|
89
|
-
right attempt. Approve each gate explicitly. Bring disputed blockers or changes
|
|
90
|
-
to the spec back to the coordinator.
|
|
91
|
-
|
|
92
|
-
## Closure
|
|
93
|
-
|
|
94
|
-
Record the accepted revision, review outcome, gate results, remaining
|
|
95
|
-
limitations, and a short retrospective in `LOG.md`.
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
# Native harness model execution
|
|
2
|
-
|
|
3
|
-
Date: 2026-11-19.
|
|
4
|
-
Status: ready for implementation on the accepted configuration and permissions base.
|
|
5
|
-
|
|
6
|
-
## Scope
|
|
7
|
-
|
|
8
|
-
Support streaming model responses, bounded retries and timeouts, and durable
|
|
9
|
-
call summaries. Use the existing OpenRouter and scripted model paths. Build on
|
|
10
|
-
the session lifecycle and the tool dispatch gate defined in the
|
|
11
|
-
[configuration and permissions spec](../../11-19-config-permissions/SPEC.md).
|
|
12
|
-
The [business rules](../../BUSINESS_RULES.md) list choices whose values or
|
|
13
|
-
behavior can be revisited independently.
|
|
14
|
-
|
|
15
|
-
Topic subscriptions and media input have separate designs. The execution loop
|
|
16
|
-
continues to take input through the inbox. A future topic notice can wake a
|
|
17
|
-
subscribed channel and use that same path.
|
|
18
|
-
|
|
19
|
-
## Execution units
|
|
20
|
-
|
|
21
|
-
- A **turn** runs on one channel and can span any number of iterations.
|
|
22
|
-
Different channels run in parallel.
|
|
23
|
-
- An **iteration** takes pending input, builds a model request, runs one logical
|
|
24
|
-
model call, then handles the tools returned by that call through the
|
|
25
|
-
permission gate. The end of the iteration is a suspension boundary.
|
|
26
|
-
- A **model call** uses one fixed request and one deadline. An **attempt** is
|
|
27
|
-
one execution of that request by the adapter. A call can retry with a new
|
|
28
|
-
attempt while keeping its ID, original request, and deadline.
|
|
29
|
-
|
|
30
|
-
Input accepted while a call is in flight can steer the turn at the next
|
|
31
|
-
inference boundary. It does not change that call or a retry of it. After
|
|
32
|
-
handling a response, continue if tool results require another inference or
|
|
33
|
-
pending input is eligible for take. Otherwise, close the turn through the
|
|
34
|
-
existing atomic inbox check. Input accepted after the turn closes can wake a
|
|
35
|
-
new one.
|
|
36
|
-
|
|
37
|
-
## Model adapter and stream
|
|
38
|
-
|
|
39
|
-
The adapter runs one attempt and honors cancellation. It reports ordered text
|
|
40
|
-
deltas, provider usage when available, and an explicit terminal outcome.
|
|
41
|
-
When the provider confirms a request reached inference before generating
|
|
42
|
-
output, the adapter may report that evidence separately.
|
|
43
|
-
|
|
44
|
-
A successful terminal response contains the complete assistant message, any
|
|
45
|
-
complete tool requests, and a stop reason. The adapter assembles tool-call
|
|
46
|
-
fragments internally. A non-streaming or scripted adapter may return a complete
|
|
47
|
-
response without deltas. A stream that ends without a valid terminal response
|
|
48
|
-
is incomplete. An explicit provider output limit ends the turn with the
|
|
49
|
-
`output_limit` reason. Keep any streamed text visible as incomplete and
|
|
50
|
-
skip tool dispatch for that response. Define the normalized response shapes
|
|
51
|
-
and stop reasons in the contract decision.
|
|
52
|
-
|
|
53
|
-
Publish text deltas under a stable assistant message ID so the client can
|
|
54
|
-
assemble one live reply. A committed completion uses the same ID. Commit the
|
|
55
|
-
successful model-call outcome and complete assistant response, including its
|
|
56
|
-
tool requests, in one transaction. Publish completion and dispatch tools only
|
|
57
|
-
after that transaction commits.
|
|
58
|
-
Only complete tool requests from a validated response reach the permission
|
|
59
|
-
gate. Keep the existing tool result pairing and dispatch event rules.
|
|
60
|
-
|
|
61
|
-
Every published draft has a terminal outcome. On failure, timeout, interrupt,
|
|
62
|
-
or stop before commit, mark the live reply incomplete with a reason if the
|
|
63
|
-
connection can still deliver the event. The turn separately reports its failed
|
|
64
|
-
or interrupted outcome. Clients can keep partial text visible locally.
|
|
65
|
-
|
|
66
|
-
If the connection dies before a terminal event, the client stops presenting
|
|
67
|
-
the draft as live and reconciles by message ID on reconnect. A committed reply
|
|
68
|
-
replaces the draft if found. Otherwise the draft stays incomplete. Timeline
|
|
69
|
-
reads return committed responses. Live deltas and incomplete text have no
|
|
70
|
-
durable replay guarantee and stay out of inference history.
|
|
71
|
-
|
|
72
|
-
### Consumer delivery modes
|
|
73
|
-
|
|
74
|
-
Consumers choose a text delivery mode on their event subscription. Both
|
|
75
|
-
modes use the same inference, tool execution, and committed history.
|
|
76
|
-
|
|
77
|
-
| Mode | Consumer receives |
|
|
78
|
-
| --- | --- |
|
|
79
|
-
| Messages (default) | One completed assistant message per model response that contains text, along with tool and turn events. |
|
|
80
|
-
| Streaming | Text deltas followed by completion for the same message ID, along with tool and turn events. |
|
|
81
|
-
|
|
82
|
-
The completed model response defines the message boundary. Paragraphs within
|
|
83
|
-
that response stay together. A response containing text and tool requests
|
|
84
|
-
publishes its completed text before dispatching the tools. A tool-only
|
|
85
|
-
response emits no empty text message. A later inference can emit another
|
|
86
|
-
assistant message in the same turn.
|
|
87
|
-
|
|
88
|
-
Streaming is opt-in for consumers such as the interactive terminal and web
|
|
89
|
-
chat. Messages mode filters out text deltas and incomplete reply events.
|
|
90
|
-
Consumers in that mode still receive the turn outcome. Subscription mode
|
|
91
|
-
does not change the retry policy or what commits to history.
|
|
92
|
-
|
|
93
|
-
Both modes respect bounded transport frames. Coalesce deltas within a bounded
|
|
94
|
-
buffer per connection without waiting for the reader in the execution loop.
|
|
95
|
-
If a reader falls behind, stop live delta delivery for that message. The
|
|
96
|
-
completion gives the consumer the authoritative reply. Deliver ordinary
|
|
97
|
-
completions inline. For a reply too large for one frame, send a completion
|
|
98
|
-
reference with the same message ID and allow bounded reads of its committed
|
|
99
|
-
text by ID. Enqueue completion before tool events for that response.
|
|
100
|
-
|
|
101
|
-
A blocked shared stdio connection can delay events from every channel. If
|
|
102
|
-
terminal events cannot be delivered within the connection bounds, fail the
|
|
103
|
-
connection explicitly and apply existing stop and recovery rules. Results
|
|
104
|
-
already committed remain recoverable. Define the buffer limits, fallback
|
|
105
|
-
signal, and bounded read format in the contract decision.
|
|
106
|
-
|
|
107
|
-
## Receipts
|
|
108
|
-
|
|
109
|
-
Update receipts only for messages already taken into the target turn and
|
|
110
|
-
actually included in that inference request. Evidence from another channel's
|
|
111
|
-
shared history does not advance them.
|
|
112
|
-
|
|
113
|
-
Provider confirmation that inference accepted the request can establish
|
|
114
|
-
Delivered. Meaningful model output, such as generated text or a tool-call
|
|
115
|
-
delta, can establish Seen before completion. If the adapter only has evidence
|
|
116
|
-
from output, it can confirm both together. A valid non-streaming response can
|
|
117
|
-
also confirm both. Commit confirmed receipts before publishing them. An attempt
|
|
118
|
-
can establish Seen and later fail. Its failure leaves the confirmed receipt
|
|
119
|
-
intact.
|
|
120
|
-
|
|
121
|
-
## Retry, timeout, and lifecycle
|
|
122
|
-
|
|
123
|
-
Allow at most one automatic retry for a transient provider failure while
|
|
124
|
-
the deadline still permits it. Close the retry window when the runner first
|
|
125
|
-
accepts a nonempty text delta for publication, before filtering by subscription
|
|
126
|
-
or handling transport backpressure. Committing a response also closes that
|
|
127
|
-
window. Privately buffered tool fragments can establish Seen without closing
|
|
128
|
-
it. Retry classification distinguishes transient provider errors from
|
|
129
|
-
cancellation, invalid configuration, and invalid requests. No model retry
|
|
130
|
-
replays a tool.
|
|
131
|
-
|
|
132
|
-
The default model call deadline is 120 seconds from the start of the first
|
|
133
|
-
attempt. It includes waiting for the provider, receiving the full stream, and
|
|
134
|
-
the one-second delay and attempt for any retry. The retry uses only the time
|
|
135
|
-
remaining on that deadline. Tool execution, approval waits, and inbox time
|
|
136
|
-
are outside this deadline. Timing out cancels the active attempt and fences
|
|
137
|
-
late output. End an exhausted or expired call with an explicit outcome and
|
|
138
|
-
leave the channel usable. A turn has no overall iteration limit in this slice.
|
|
139
|
-
|
|
140
|
-
Interrupt and stop cancel the current attempt or retry wait immediately and
|
|
141
|
-
fence late output. Preserve already committed responses and receipts. Suspend
|
|
142
|
-
lets the current logical call settle within its existing deadline, including an
|
|
143
|
-
eligible retry. Finish handling the complete response and its tools under the
|
|
144
|
-
existing suspension and approval rules. Checkpoint before the next model call
|
|
145
|
-
when the turn still needs one.
|
|
146
|
-
|
|
147
|
-
## Call records and usage
|
|
148
|
-
|
|
149
|
-
The [accounting amendment](../0002-AMENDMENT-accounting/SPEC.md) proposes the
|
|
150
|
-
additional evidence required for native billing-grade accounting.
|
|
151
|
-
|
|
152
|
-
Persist one summary per model call, linked to its turn, with one attempt
|
|
153
|
-
summary per provider attempt. Include stable IDs, timing, outcomes, retry
|
|
154
|
-
reason, provider request ID when available, and provider-reported usage.
|
|
155
|
-
Attribute reported usage to the attempt that incurred it, including failed or
|
|
156
|
-
cancelled attempts. Missing usage remains unknown. Aggregate reported usage
|
|
157
|
-
without counting an attempt twice.
|
|
158
|
-
|
|
159
|
-
Keep summaries available through the harness after restart, separate from the
|
|
160
|
-
conversation timeline. Reopening after a process crash reports unfinished
|
|
161
|
-
calls as interrupted and retains the summaries and usage already recorded.
|
|
162
|
-
If the successful model call committed before the crash, its outcome and
|
|
163
|
-
response remain successful even if its enclosing turn is interrupted.
|
|
164
|
-
|
|
165
|
-
The scripted adapter reserves its next step as part of the durable attempt
|
|
166
|
-
start for that channel. Every attempt advances the script once. A crash after
|
|
167
|
-
reservation consumes the step even if the adapter did not run it. Reopening
|
|
168
|
-
does not derive the script position from completed assistant replies.
|
|
169
|
-
Exact wire events, stored fields, and retrieval are part of the contract gate.
|
|
170
|
-
|
|
171
|
-
## Acceptance
|
|
172
|
-
|
|
173
|
-
Use scripted attempts and deterministic barriers to verify the following:
|
|
174
|
-
|
|
175
|
-
1. Streaming emits deltas under one ID and commits one completed reply with
|
|
176
|
-
that ID. Fragmented tool arguments reach the executor only as a complete,
|
|
177
|
-
permission-checked call. Scripted and non-streaming responses still work.
|
|
178
|
-
Messages mode emits no deltas and publishes completed text before any
|
|
179
|
-
tool dispatch from the same response.
|
|
180
|
-
2. A transient failure before output can retry once using the same request.
|
|
181
|
-
Both attempts appear under one call. The shared deadline bounds the retry.
|
|
182
|
-
3. A late failure after streamed text marks the reply incomplete, leaves no
|
|
183
|
-
completed timeline message for it, and does not retry or execute partial
|
|
184
|
-
tool calls. Both subscription modes make the same retry decision. An
|
|
185
|
-
explicit output limit has its own recorded reason.
|
|
186
|
-
4. Interrupt cancels a stalled attempt or retry wait and fences late output.
|
|
187
|
-
Suspend lets the current iteration settle and resumes from its checkpoint.
|
|
188
|
-
A second channel can finish a turn while the first is waiting.
|
|
189
|
-
5. Confirmed receipts and call summaries survive restart. Usage reported by a
|
|
190
|
-
failed attempt is counted once. Missing usage remains unknown.
|
|
191
|
-
6. Crash on either side of the atomic success commit. Verify the call outcome
|
|
192
|
-
and timeline agree, the streaming client reconciles using the message ID,
|
|
193
|
-
and the scripted adapter continues from its reserved attempt position.
|
|
194
|
-
7. With a slow reader, verify deltas are coalesced or dropped within bounds
|
|
195
|
-
while another channel can complete and commit. Recover dropped text from
|
|
196
|
-
completion. Fetch an oversized reply by ID in bounded reads in both modes.
|
|
197
|
-
Verify a fully blocked connection follows stop and recovery behavior.
|
|
198
|
-
|
|
199
|
-
Record the adapter and client event contracts, call summaries, and operational
|
|
200
|
-
defaults in a decision record before dependent code changes.
|