@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
package/CONSUMER_GUIDE.md
CHANGED
|
@@ -1064,8 +1064,16 @@ export async function openApprovalDemo(adapter: AgentAdapter, path: string) {
|
|
|
1064
1064
|
|
|
1065
1065
|
Allow and deny resolve immediately. Ask first uses a per-prompt
|
|
1066
1066
|
`onPermissionRequest` handler. Without one, it waits for a consumer only if
|
|
1067
|
-
`answersPermissions` is true.
|
|
1068
|
-
|
|
1067
|
+
`answersPermissions` is true. An ask with neither responder uses `permissions.unanswered`. The default,
|
|
1068
|
+
`"reject"`, refuses the tool and lets the turn continue. ACP selects
|
|
1069
|
+
`reject_once` when offered and sends cancellation otherwise. Native responds
|
|
1070
|
+
with `deny`. Use `permissions: { default: "ask", unanswered: "cancel" }`
|
|
1071
|
+
to send ACP's cancelled permission response or interrupt the requesting
|
|
1072
|
+
native turn. The setting applies only to an unanswered ask. It leaves
|
|
1073
|
+
explicit deny, handler responses and consumer timeout behavior unchanged.
|
|
1074
|
+
A forwarded ask uses the giving conversation's setting when it is
|
|
1075
|
+
available. Without a giving conversation, an applicable worker policy with
|
|
1076
|
+
`unanswered: "cancel"` cancels an otherwise unanswered ask. The consumer wait defaults to five minutes, starts at request ingress, and expires
|
|
1069
1077
|
to a refusal. Supply a positive integer below 600,000 to override it.
|
|
1070
1078
|
`expiresAt` is epoch milliseconds and is present only for a consumer wait.
|
|
1071
1079
|
Check `answerPermission()`'s `{ accepted }` result. Unknown, expired,
|
|
@@ -1083,6 +1091,22 @@ and `deny`. The harness also has a ten-minute approval limit. A configured
|
|
|
1083
1091
|
including while detached. Await `answer("allow_once")` or `answer("deny")`
|
|
1084
1092
|
to learn whether the harness accepted the decision.
|
|
1085
1093
|
|
|
1094
|
+
## Built-in ACP terminal environments
|
|
1095
|
+
|
|
1096
|
+
Set `terminalEnv` on the client, controller or conversation runtime, or
|
|
1097
|
+
return it from `launcher.prepare()`. The prepared value takes precedence.
|
|
1098
|
+
For example, `terminalEnv: { PATH: "/usr/bin:/bin", LANG: "C.UTF-8" }`
|
|
1099
|
+
passes exactly those environment variables to built-in terminals. Use an
|
|
1100
|
+
empty object to pass none. In this mode ACP terminal request environment
|
|
1101
|
+
entries cannot add to or override the host's environment.
|
|
1102
|
+
|
|
1103
|
+
When no exact environment is configured, the built-in ACP terminal uses the
|
|
1104
|
+
variables supplied in the terminal request. The hub's process environment,
|
|
1105
|
+
client spawn settings and the launcher's `spawnEnv` are separate.
|
|
1106
|
+
`TerminalRegistry` also accepts `terminalEnv` in its options and in a direct
|
|
1107
|
+
`create()` call. A direct per-terminal setting wins. Custom terminal
|
|
1108
|
+
handlers are responsible for their own environment isolation.
|
|
1109
|
+
|
|
1086
1110
|
## Cancellable ACP startup and deferred connections
|
|
1087
1111
|
|
|
1088
1112
|
Agent-owned normal ACP conversations connect on open by default. Use
|
|
@@ -1166,7 +1190,14 @@ export async function openNative(
|
|
|
1166
1190
|
}
|
|
1167
1191
|
```
|
|
1168
1192
|
|
|
1169
|
-
Use a supported OpenRouter model ID configured for your account.
|
|
1193
|
+
Use a supported OpenRouter model ID configured for your account. `harness.config.model` is typed from the harness SDK
|
|
1194
|
+
and passed through unchanged on every open. Besides `scripted` and `openrouter`, the SDK defines an inference-source arm,
|
|
1195
|
+
`{ protocol: "openai-compatible", providerId, model, baseUrl, apiKeyEnv? }` (decision 0034): an OpenAI-compatible Chat
|
|
1196
|
+
Completions endpoint chosen by the consumer. `baseUrl` is HTTPS or a literal loopback address over HTTP (`127.x` or `::1`,
|
|
1197
|
+
not `localhost`) with no credentials, query or fragment; the harness appends the Chat Completions path and follows no
|
|
1198
|
+
redirects; `apiKeyEnv` names a variable in the harness's environment, is optional for keyless endpoints and is read only
|
|
1199
|
+
when the session opens. The library accepts and forwards this arm today (compile-time and open-request tests); the harness
|
|
1200
|
+
runtime that executes it is still being implemented, so an open with this arm is not yet usable end to end. For an offline
|
|
1170
1201
|
equivalent, pass `{ protocol: "scripted", script: "/path/to/scenario.jsonl" }`
|
|
1171
1202
|
as the second argument. Function parameters are JSON Schema. Functions return
|
|
1172
1203
|
JSON values and receive a context with invocation identity and an abort signal.
|
|
@@ -1543,6 +1574,66 @@ The harness can refuse with `busy` or `next_due_soon`. A refusal leaves
|
|
|
1543
1574
|
the session running. Work that arrives after a successful idle stop can
|
|
1544
1575
|
start it again.
|
|
1545
1576
|
|
|
1577
|
+
### Restart the native agent and apply live settings
|
|
1578
|
+
|
|
1579
|
+
Use `await agent.previewNativeRestart()` to get `conversationCount` and
|
|
1580
|
+
`conversationIds` for a confirmation dialog. The preview includes active
|
|
1581
|
+
native conversation records, including ones whose harness channel is created
|
|
1582
|
+
on first use. ACP conversations are outside its scope.
|
|
1583
|
+
|
|
1584
|
+
```ts
|
|
1585
|
+
const preview = await agent.previewNativeRestart();
|
|
1586
|
+
const result = await agent.restartNative({ when: "idle", config: nextHarnessConfig });
|
|
1587
|
+
```
|
|
1588
|
+
|
|
1589
|
+
`when: "idle"` waits for active turns, approvals and queued native input
|
|
1590
|
+
across the agent, then uses the harness's atomic idle stop. Use
|
|
1591
|
+
`waitForNativeIdle({ signal })` to wait without restarting. An idle wait is
|
|
1592
|
+
a snapshot and new input can arrive after it resolves. Suspended work
|
|
1593
|
+
with queued input can keep the wait pending. Supply an abort signal when
|
|
1594
|
+
the user can cancel the wait. `when: "now"` requests interruption of
|
|
1595
|
+
running turns and restarts the shared native process. The harness retains
|
|
1596
|
+
its durable queue and reminder wake. Closing the Agent cancels idle waits.
|
|
1597
|
+
|
|
1598
|
+
The executable open takes the replacement `config` and optional
|
|
1599
|
+
`functions` catalog. Omit either to keep the Agent's current setting.
|
|
1600
|
+
Pass `functions: null` to clear application-supplied functions.
|
|
1601
|
+
The harness applies its normal configuration precedence and compatibility
|
|
1602
|
+
checks, including a managed configuration sidecar when present. The
|
|
1603
|
+
Agent uses the new settings for subsequent opens in the same process.
|
|
1604
|
+
Persist application configuration separately if future Agent instances
|
|
1605
|
+
need to supply it.
|
|
1606
|
+
|
|
1607
|
+
`subscribeNativeRestart(listener)` returns an unsubscribe function.
|
|
1608
|
+
The listener receives the same `restarted` or `restart_failed` result
|
|
1609
|
+
as the caller, with interrupted harness turn IDs and per-conversation
|
|
1610
|
+
outcomes. A `reconnected` channel was reconciled by the replacement
|
|
1611
|
+
open. A `deferred` conversation has no channel in that open and can
|
|
1612
|
+
materialize on use. On failure the result includes the error. Native
|
|
1613
|
+
conversation handles retain their identity and subscriptions.
|
|
1614
|
+
|
|
1615
|
+
Read `agent.channelSettingsLive` for channel-scoped edits, session-wide
|
|
1616
|
+
tool controls and settings to defer to an executable open.
|
|
1617
|
+
|
|
1618
|
+
- `applyNativeChannelSettings(id, { displayName, policy, lifecycle })`
|
|
1619
|
+
uses the ordered channel change path. A running harness applies it
|
|
1620
|
+
live. A stopped harness stores it for its next open. `policy` selects
|
|
1621
|
+
an existing named policy. A policy-only change keeps the channel
|
|
1622
|
+
name. Pass `null` to clear a name or policy. The lifecycle values
|
|
1623
|
+
`"suspended"`, `"open"` and `"retired"` map to suspend, resume and
|
|
1624
|
+
delete. To delete the local conversation and its records as well,
|
|
1625
|
+
use `agent.conversations.delete(id)`.
|
|
1626
|
+
- `applyNativeToolSetting(name, operation)` enables or removes runtime
|
|
1627
|
+
tools, or revokes or restores revocable tools. It requires a running
|
|
1628
|
+
harness. The operations affect the whole session. Per-channel access
|
|
1629
|
+
can be restricted by the channel's named policy.
|
|
1630
|
+
- Named policy definitions, the default policy, model, system prompt and
|
|
1631
|
+
tool catalog take effect on executable open. The native wire has no
|
|
1632
|
+
participant-roster edit for an existing channel. An open alone cannot
|
|
1633
|
+
replace that roster, so hold or refuse that edit. Unsupported
|
|
1634
|
+
channel fields return `channel_settings_not_live` with the field
|
|
1635
|
+
names, without applying any part of the patch.
|
|
1636
|
+
|
|
1546
1637
|
### Native turn metering
|
|
1547
1638
|
|
|
1548
1639
|
Agent-owned native conversations meter turns by default (`best_effort`). The
|
|
@@ -1613,10 +1704,19 @@ manual barriers and process replacement in code.
|
|
|
1613
1704
|
|
|
1614
1705
|
### Functions the model can call
|
|
1615
1706
|
|
|
1616
|
-
Register functions in `harness.functions
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1707
|
+
Register functions in `harness.functions.tools` before the Agent starts.
|
|
1708
|
+
The host declares the handler names during initialize and sends the tool
|
|
1709
|
+
catalog on every executable session open or create. Set `defaultPolicy` and
|
|
1710
|
+
`policies` under `harness.config`. The harness uses those policies to decide
|
|
1711
|
+
which tools to offer and whether a call needs approval. It validates the
|
|
1712
|
+
arguments against `parameters` before calling the handler in this process.
|
|
1713
|
+
|
|
1714
|
+
`harness.config.system` supplies the complete consumer system text. At the
|
|
1715
|
+
next executable open, changing it replaces that text for subsequent model
|
|
1716
|
+
requests in the same saved session. The harness still appends its own
|
|
1717
|
+
instructions and retains the conversation history. To apply a different
|
|
1718
|
+
configuration, close the Agent and open it with the new configuration and
|
|
1719
|
+
the same persisted Agent and harness home.
|
|
1620
1720
|
|
|
1621
1721
|
```ts
|
|
1622
1722
|
harness: {
|
|
@@ -1644,7 +1744,10 @@ harness: {
|
|
|
1644
1744
|
- **Why a tool cannot run.** `agent.nativeHarness.tools()` lists each tool
|
|
1645
1745
|
with `available` and a reason (`revoked`, `not_enabled`, `handler_missing`).
|
|
1646
1746
|
Policy is separate: a tool the conversation's policy denies is not offered.
|
|
1647
|
-
- **Handlers.**
|
|
1747
|
+
- **Handlers.** The second argument contains `invocationId`, `channel`,
|
|
1748
|
+
`turnId`, `tool`, `policyNames` and `signal`. `policyNames` comes from
|
|
1749
|
+
the harness authorization snapshot. The names have no precedence by order.
|
|
1750
|
+
Return a JSON value as the tool result. Throw `FunctionError(code, message)` for
|
|
1648
1751
|
a failure the model should see. `signal` aborts when the harness stops
|
|
1649
1752
|
waiting: the tool's deadline passed, the turn was interrupted, or the harness
|
|
1650
1753
|
stopped. A value returned after that is ignored.
|
|
@@ -1666,6 +1769,76 @@ harness: {
|
|
|
1666
1769
|
but has no recorded result (crash, lost connection, interrupt) is
|
|
1667
1770
|
`interrupted` with `effect: "unknown"`. It is never run again automatically.
|
|
1668
1771
|
|
|
1772
|
+
#### Native MCP servers
|
|
1773
|
+
|
|
1774
|
+
Configure native servers in `harness.config.mcpServers`. The harness
|
|
1775
|
+
supports stdio and Streamable HTTPS. `agent.nativeMcpStatus()` reports
|
|
1776
|
+
negotiated transports and per-server state. Restart results include
|
|
1777
|
+
the same MCP status snapshot. A stopped host reports its last snapshot
|
|
1778
|
+
as stale.
|
|
1779
|
+
|
|
1780
|
+
The npm package installs the MCP SDK and Undici as optional dependencies.
|
|
1781
|
+
If an install omits them, the configured MCP entries report
|
|
1782
|
+
`state: "unavailable"`, with `reason: "discovery"` for stdio or
|
|
1783
|
+
`reason: "connect"` for HTTPS. These statuses describe the failed stage
|
|
1784
|
+
without exposing credential values. Install the optional dependencies to
|
|
1785
|
+
use MCP. Other native features still work without them.
|
|
1786
|
+
A failing MCP server leaves the harness running. A plain HTTP 500 on discovery marks that entry unavailable, and on a tool
|
|
1787
|
+
call the model sees one sanitized `mcp_uncertain` result with no replay. Other channels and servers keep working.
|
|
1788
|
+
|
|
1789
|
+
```ts
|
|
1790
|
+
import type { AgentHarnessConfig } from "@qlairoslabs/acp-client";
|
|
1791
|
+
|
|
1792
|
+
export function withNativeMcp(
|
|
1793
|
+
config: AgentHarnessConfig["config"],
|
|
1794
|
+
getAuthorization: () => Promise<string>,
|
|
1795
|
+
) {
|
|
1796
|
+
return {
|
|
1797
|
+
config: {
|
|
1798
|
+
...config,
|
|
1799
|
+
defaultPolicy: "guest",
|
|
1800
|
+
policies: {
|
|
1801
|
+
owner: { fallback: "allow", tools: {}, mcp: "allow" },
|
|
1802
|
+
guest: { fallback: "allow", tools: {}, mcp: "deny" },
|
|
1803
|
+
},
|
|
1804
|
+
mcpServers: {
|
|
1805
|
+
docs: { transport: "stdio", command: "/app/bin/docs-mcp", args: [] },
|
|
1806
|
+
account: { transport: "http", endpoint: "https://example.com/mcp",
|
|
1807
|
+
headers: { Authorization: { runtime: true } } },
|
|
1808
|
+
},
|
|
1809
|
+
limits: { ...config.limits, mcpCallTimeoutMs: 5_000 },
|
|
1810
|
+
},
|
|
1811
|
+
mcpRuntimeHeaders: async () => ({ account: { Authorization: await getAuthorization() } }),
|
|
1812
|
+
} satisfies Pick<AgentHarnessConfig, "config" | "mcpRuntimeHeaders">;
|
|
1813
|
+
}
|
|
1814
|
+
```
|
|
1815
|
+
|
|
1816
|
+
Merge those fields into the Agent's `harness` settings. Only the trusted
|
|
1817
|
+
owner supplies `mcpRuntimeHeaders`. The callback runs for every
|
|
1818
|
+
executable open or create request, including retry, reconnect and restart.
|
|
1819
|
+
It can resolve refreshed credentials. Header names are case-insensitive.
|
|
1820
|
+
The encoded runtime headers are limited to 8 KiB total and 2 KiB per value.
|
|
1821
|
+
Larger material fails locally with `mcp_runtime_headers_too_large`.
|
|
1822
|
+
Missing or empty material disables that server entry before it connects,
|
|
1823
|
+
while other servers can still start. Keep credentials out of configuration,
|
|
1824
|
+
prompt content and metadata. Runtime header values are never persisted.
|
|
1825
|
+
|
|
1826
|
+
On an attributed prompt, the trusted caller can select an existing policy
|
|
1827
|
+
for that input with `conversation.promptFrom({ participantId, text,
|
|
1828
|
+
nativePolicy: "guest" })`. Object-form `prompt` accepts `nativePolicy` too.
|
|
1829
|
+
When the caller omits it, the harness uses the channel's selected policy,
|
|
1830
|
+
then the session default. Omitting `nativePolicy` denies MCP only when that
|
|
1831
|
+
fallback policy has no MCP grant. An owner channel still needs an explicit guest
|
|
1832
|
+
policy on guest input. Participant kind, sender ID, display name and text
|
|
1833
|
+
never grant MCP access. Do not populate `nativePolicy` from participant input.
|
|
1834
|
+
|
|
1835
|
+
The `mcp` grant covers all `mcp__` tools for that named policy. Every
|
|
1836
|
+
taken or inherited contributing policy must explicitly allow MCP. A
|
|
1837
|
+
mixed owner and guest turn, or a policy with no `mcp` value, denies it.
|
|
1838
|
+
The local deterministic fixtures verify this transport and policy wiring.
|
|
1839
|
+
Approval behavior in deployments using agents-tools or door integrations
|
|
1840
|
+
requires separate acceptance.
|
|
1841
|
+
|
|
1669
1842
|
Tool changes need a running harness: `revokeTool` and the others fail with
|
|
1670
1843
|
`HarnessUnavailableError` while it is stopped.
|
|
1671
1844
|
|
|
@@ -4,8 +4,8 @@ For consumers of the published `@qlairoslabs/acp-client` 0.12.1, including
|
|
|
4
4
|
`~agents` (`libs/agents/agents-core`). See the [consumer guide](CONSUMER_GUIDE.md)
|
|
5
5
|
for complete examples.
|
|
6
6
|
|
|
7
|
-
**Status.**
|
|
8
|
-
|
|
7
|
+
**Status.** Version `0.13.0-alpha.1` is published under the `alpha` tag.
|
|
8
|
+
This note also covers subsequent changes on `alpha`. For a local trial, point a disposable
|
|
9
9
|
consumer checkout at a local archive of the target code and use a copy of the
|
|
10
10
|
database. For example, use a `file:/absolute/path/to/acp-client-archive`
|
|
11
11
|
dependency in the trial checkout or replace its local package link. Make the
|
|
@@ -40,10 +40,11 @@ entry has 924 exports, including nine new reminder names.
|
|
|
40
40
|
|
|
41
41
|
| What changed | What to do |
|
|
42
42
|
| --- | --- |
|
|
43
|
-
| `defaultPermission` was removed. | Replace `"approve"` with `permissions: { default: "allow" }` and `"cancel"` with `permissions: { default: "ask" }
|
|
43
|
+
| `defaultPermission` was removed. | Replace `"approve"` with `permissions: { default: "allow" }` and `"cancel"` with `permissions: { default: "ask", unanswered: "cancel" }` to keep cancellation on an unattended ask. Omitting the setting means ask and reject the tool if nobody answers. |
|
|
44
44
|
| Permission defaults and rules can settle requests before the prompt handler. | Install a handler or declare a consumer for asks. Update ACP refusal handling for `reject_once` where offered and cancellation otherwise. |
|
|
45
45
|
| `AgentController` and `AgentControllerStartEvent` have new names. | Use `HarnessController` and `ControllerStartEvent`. The deprecated aliases still work. |
|
|
46
46
|
| `conversation.connection` is a `ConversationController`. | Use the shared interface where possible and use `conversation.harnessConnection()` for ACP-specific members. Handle its null return. |
|
|
47
|
+
| Built-in ACP terminals no longer inherit the hub or spawned process environment. | Supply exact variables via `terminalEnv` in client/runtime config, prepared launch or direct terminal creation. |
|
|
47
48
|
| Launcher kind includes `"native-harness"`. | Handle the new kind in custom launcher unions and switches. Route it explicitly or reject it if unsupported. |
|
|
48
49
|
| Custom persistence backends must supply `capabilities.channels: boolean`. | Use `channels: false` without a durable channel repository. The repository itself is optional. |
|
|
49
50
|
| Adapter registration now accepts `AgentAdapter` (`Adapter \| NativeAdapter`). | Narrow `AgentAdapterRegistration.adapter`, entries in `AgentConfig.adapters`, and arguments to `AgentAdapterRegistry.register` before reading ACP fields such as `command`. `list()` still returns entries with an `Adapter`. |
|
|
@@ -143,7 +144,10 @@ Rules use `kind:` and exact `command:` keys. The stricter match wins. Native ask
|
|
|
143
144
|
use the callback and default, while the harness itself grants or denies tools
|
|
144
145
|
by name. Allow and deny are final. In particular, default allow can skip a
|
|
145
146
|
prompt handler that previously ran. An ask with no handler and no eligible
|
|
146
|
-
consumer
|
|
147
|
+
consumer uses `permissions.unanswered`. The default `"reject"` refuses
|
|
148
|
+
the tool using `reject_once` where ACP offers it or `deny` on native.
|
|
149
|
+
`"cancel"` sends ACP's cancelled response or interrupts the requesting
|
|
150
|
+
native turn. Use `answersPermissions`, `permissionTimeoutMs` and
|
|
147
151
|
`answerPermission` to implement a conversation approval UI. See
|
|
148
152
|
[permission configuration and events](CONSUMER_GUIDE.md#permissions-and-approval-ui).
|
|
149
153
|
|
|
@@ -230,6 +234,15 @@ destination receives an out-of-band message. A native destination receives a
|
|
|
230
234
|
durable notice. Eligible notices can be retried without redispatching worker
|
|
231
235
|
work. See the [orchestrator guide](CONSUMER_GUIDE.md#orchestrator-and-worker-delivery-experimental).
|
|
232
236
|
|
|
237
|
+
## Native tools and system instructions
|
|
238
|
+
|
|
239
|
+
Provide host callbacks in `harness.functions.tools` and tool policies
|
|
240
|
+
in `harness.config`. Native conversations cannot attach ACP MCP servers.
|
|
241
|
+
Wrap an MCP call in a native function if needed. A new executable open uses
|
|
242
|
+
the supplied `harness.config.system` in place of the previous consumer
|
|
243
|
+
system text and keeps the harness's own instructions. See
|
|
244
|
+
[Functions the model can call](CONSUMER_GUIDE.md#functions-the-model-can-call).
|
|
245
|
+
|
|
233
246
|
## Other native harness changes
|
|
234
247
|
|
|
235
248
|
The standalone native harness managed session config can opt into `timelineTools: true` to make
|
|
@@ -247,9 +260,9 @@ errors. The archive adds 13 diagnostics across the following four groups.
|
|
|
247
260
|
|
|
248
261
|
| Location under `src/` | Exact edit |
|
|
249
262
|
| --- | --- |
|
|
250
|
-
| `agent/chat/session.ts` | Keep the app's `default_permission` and CLI option names. Import `PermissionSettings` from the package and make it the return type of `libraryPermission`, returning `
|
|
251
|
-
| `agent/chat/sqlite-session.ts` | In `conversationDefaults`
|
|
252
|
-
| `__tests__/integration/docker-image-candidate-acp.test.ts`, `__tests__/integration/opencode-model-catalog.test.ts`, `gateway/docker-delivery.test.ts` | Replace the library-level `defaultPermission: "cancel"` with `permissions: { default: "ask" }`. |
|
|
263
|
+
| `agent/chat/session.ts` | Keep the app's `default_permission` and CLI option names. Import `PermissionSettings` from the package and make it the return type of `libraryPermission`, returning `policy === "approve" ? { default: "allow" } : { default: "ask", unanswered: "cancel" }`. Set `permissions: libraryPermission(defaultPermission ?? agentCfg.default_permission)` on the session config. Pass `permissions: config.permissions` to both `loadAgentSession` and `createAgentSession`. |
|
|
264
|
+
| `agent/chat/sqlite-session.ts` | In `conversationDefaults` apply the same mapping to `canonical ? canonical.input.permission.policy : opts.defaultPermission ?? agentCfg!.default_permission`. Update the comment in `hub/index.ts` about the prompt handler. It runs for ask only, and an unattended ask fails closed. |
|
|
265
|
+
| `__tests__/integration/docker-image-candidate-acp.test.ts`, `__tests__/integration/opencode-model-catalog.test.ts`, `gateway/docker-delivery.test.ts` | Replace the library-level `defaultPermission: "cancel"` with `permissions: { default: "ask", unanswered: "cancel" }`. |
|
|
253
266
|
| `agent/chat/launcher.ts` | For the current ACP-only launcher add `if (kind === "native-harness") throw new Error("Native harness launch is unsupported by this runtime");` before passing `kind` to `prepareProcessLaunch`. To enable native launches later, extend `RuntimeProcessKind` and its runtime handlers to route the new kind explicitly. |
|
|
254
267
|
| `hub/index.ts` | Keep the degraded PTY special case. Replace `session.connection.currentClient.isConnected` with `session.harnessConnection()?.currentClient.isConnected ?? false` inside the existing try/catch. Update session test doubles used by that branch to supply `harnessConnection()` with the expected client state. |
|
|
255
268
|
| `configuration/recording/acp-contract.test.ts` | Remove the public-package import of `ConversationPersistenceContext` from this fixture. Type `context` as `Parameters<ConversationSettingsResolver["settingsFor"]>[0]` using the fixture's existing resolver import. The error in the linked archive is a split branded type identity from mixing relative package internals with a public package type. The resolver contract test can stay on its test-only internal import path. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qlairoslabs/acp-client",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2-alpha.1",
|
|
4
4
|
"description": "Embeddable Agent Client Protocol (ACP) client library with degraded PTY fallback.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "src/index.ts",
|
|
@@ -40,7 +40,14 @@
|
|
|
40
40
|
"CHANGELOG-consumer-fixes.md",
|
|
41
41
|
"CHANGELOG-controller-interface.md",
|
|
42
42
|
"MIGRATION-0.10-to-0.12.md",
|
|
43
|
-
"MIGRATION-0.12-to-0.13.md"
|
|
43
|
+
"MIGRATION-0.12-to-0.13.md",
|
|
44
|
+
"!src/native-harness/test",
|
|
45
|
+
"!src/native-harness/.res",
|
|
46
|
+
"!src/native-harness/AGENTS.md",
|
|
47
|
+
"!src/native-harness/ARCHITECTURE.md",
|
|
48
|
+
"!src/native-harness/bun.lock",
|
|
49
|
+
"!src/**/*.test.ts",
|
|
50
|
+
"!src/**/*.typecheck.ts"
|
|
44
51
|
],
|
|
45
52
|
"exports": {
|
|
46
53
|
".": "./src/index.ts",
|
|
@@ -74,6 +81,10 @@
|
|
|
74
81
|
"@agentclientprotocol/sdk": "0.25.1",
|
|
75
82
|
"@xterm/headless": "^6.0.0"
|
|
76
83
|
},
|
|
84
|
+
"optionalDependencies": {
|
|
85
|
+
"@modelcontextprotocol/sdk": "1.31.0",
|
|
86
|
+
"undici": "7.29.0"
|
|
87
|
+
},
|
|
77
88
|
"devDependencies": {
|
|
78
89
|
"@types/bun": "latest",
|
|
79
90
|
"typescript": "^5"
|
package/src/agent/config.ts
CHANGED
|
@@ -116,6 +116,8 @@ export interface AgentHarnessConfig {
|
|
|
116
116
|
readonly idleStopWindowMs?: number;
|
|
117
117
|
/** The harness configuration, sent on every open. */
|
|
118
118
|
readonly config: import("../native/reminders/routine-wire.ts").RoutineConfigInput;
|
|
119
|
+
/** Fresh secret material for each executable native harness open. */
|
|
120
|
+
readonly mcpRuntimeHeaders?: import("../native/mcp.ts").McpRuntimeHeadersProvider;
|
|
119
121
|
/** The harness home, a path in the harness's environment. It must survive process restarts. */
|
|
120
122
|
readonly home: string;
|
|
121
123
|
/** How to start the harness server. Defaults to this package's harness in `serve --stdio` mode. */
|
|
@@ -577,6 +577,7 @@ export class DefaultAgentConversationManager implements AgentConversationManager
|
|
|
577
577
|
...(defaults.launcher ? { launcher: defaults.launcher } : {}),
|
|
578
578
|
...(defaults.execPrefix ? { execPrefix: defaults.execPrefix } : {}),
|
|
579
579
|
...(defaults.env ? { env: defaults.env } : {}),
|
|
580
|
+
...(defaults.terminalEnv ? { terminalEnv: defaults.terminalEnv } : {}),
|
|
580
581
|
...(defaults.cwd ? { cwd: defaults.cwd } : {}),
|
|
581
582
|
...(defaults.clientInfo ? { clientInfo: defaults.clientInfo } : {}),
|
|
582
583
|
...(defaults.logger ? { logger: defaults.logger } : {}),
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AgentConversationId } from "../agent-ids.ts";
|
|
2
|
+
import type { ChannelChangeOutcome } from "../native/channel-changes.ts";
|
|
3
|
+
import type { AgentHarnessConfig } from "./config.ts";
|
|
4
|
+
|
|
5
|
+
export const channelSettingsLive = {
|
|
6
|
+
channel: ["displayName", "policy", "lifecycle"],
|
|
7
|
+
channelOperations: ["create", "edit", "suspend", "resume", "delete"],
|
|
8
|
+
sessionTools: ["enable", "remove", "revoke", "restore"],
|
|
9
|
+
restartRequired: ["policies", "defaultPolicy", "model", "system", "toolCatalog", "participants"],
|
|
10
|
+
} as const;
|
|
11
|
+
export type NativeToolSetting = typeof channelSettingsLive.sessionTools[number];
|
|
12
|
+
export type NativeChannelSettings = Readonly<Record<string, unknown>> & {
|
|
13
|
+
readonly displayName?: string | null;
|
|
14
|
+
readonly policy?: string | null;
|
|
15
|
+
readonly lifecycle?: "open" | "suspended" | "retired";
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type NativeChannelSettingsResult = ChannelChangeOutcome
|
|
19
|
+
| { readonly state: "unsupported"; readonly code: "channel_settings_not_live"; readonly fields: readonly string[] }
|
|
20
|
+
| { readonly state: "unsupported"; readonly code: "invalid_channel_settings" | "not_native_conversation" };
|
|
21
|
+
|
|
22
|
+
export interface NativeRestartOptions {
|
|
23
|
+
readonly when?: "idle" | "now";
|
|
24
|
+
readonly signal?: AbortSignal;
|
|
25
|
+
readonly config?: AgentHarnessConfig["config"];
|
|
26
|
+
readonly functions?: AgentHarnessConfig["functions"] | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface NativeRestartPreview {
|
|
30
|
+
readonly conversationCount: number;
|
|
31
|
+
readonly conversationIds: readonly AgentConversationId[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type NativeRestartResult = NativeRestartPreview & {
|
|
35
|
+
readonly kind: "restarted" | "restart_failed";
|
|
36
|
+
readonly interruptedTurns: readonly { channel: string; turnId: string }[];
|
|
37
|
+
readonly conversations: readonly { id: AgentConversationId; outcome: "reconnected" | "deferred" | "failed" }[];
|
|
38
|
+
readonly error?: unknown;
|
|
39
|
+
readonly mcp?: import("../native/mcp.ts").NativeMcpStatus;
|
|
40
|
+
};
|
|
@@ -42,6 +42,8 @@ export interface AgentSessionConfig extends ConversationPermissionConfig {
|
|
|
42
42
|
execPrefix?: string[];
|
|
43
43
|
/** @deprecated Use launcher and its exact spawnEnv. */
|
|
44
44
|
env?: Record<string, string>;
|
|
45
|
+
/** Exact environment for built-in ACP terminals. */
|
|
46
|
+
terminalEnv?: Record<string, string>;
|
|
45
47
|
cwd?: string;
|
|
46
48
|
/** Additional absolute directories declared to the provider. */
|
|
47
49
|
additionalDirectories?: string[];
|
package/src/agent-session.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { NativeController } from "./native/controller.ts";
|
|
2
|
+
import type { NativeInputPolicy } from "./native/mcp.ts";
|
|
1
3
|
import { protocolMethod } from "./persistence/protocol-method.ts";
|
|
2
4
|
import { ReminderError } from "./native/reminders/schedule.ts";
|
|
3
5
|
// AgentConversation — one durable conversation and the library's compatibility front
|
|
@@ -262,6 +264,8 @@ export interface AgentConversationPromptInput {
|
|
|
262
264
|
readonly delivery?: PromptDelivery;
|
|
263
265
|
/** Awaited before dispatch with this prompt's message ID. A rejection prevents dispatch. */
|
|
264
266
|
readonly beforeDispatch?: (messageId: string) => Promise<void>;
|
|
267
|
+
/** Existing native policy selected by the trusted caller for this input. */
|
|
268
|
+
readonly nativePolicy?: NativeInputPolicy;
|
|
265
269
|
}
|
|
266
270
|
|
|
267
271
|
export interface AgentConversationAttributedPromptInput extends AgentConversationPromptInput {
|
|
@@ -588,6 +592,7 @@ export class AgentConversation implements AgentClient, Bridgeable {
|
|
|
588
592
|
launcher: config.launcher,
|
|
589
593
|
execPrefix: config.execPrefix,
|
|
590
594
|
env: config.env,
|
|
595
|
+
terminalEnv: config.terminalEnv,
|
|
591
596
|
cwd: config.cwd,
|
|
592
597
|
additionalDirectories: config.additionalDirectories,
|
|
593
598
|
mcpServers: config.mcpServers,
|
|
@@ -1876,7 +1881,7 @@ export class AgentConversation implements AgentClient, Bridgeable {
|
|
|
1876
1881
|
? this.enqueuePrompt(input, "prompt", handlers, attachments)
|
|
1877
1882
|
: this.enqueuePrompt(
|
|
1878
1883
|
promptInputText(input), "prompt", input.handlers, input.attachments,
|
|
1879
|
-
undefined, input.consumerMetadata, input.delivery, promptParts(input), input.beforeDispatch,
|
|
1884
|
+
undefined, input.consumerMetadata, input.delivery, promptParts(input), input.beforeDispatch, input.nativePolicy,
|
|
1880
1885
|
);
|
|
1881
1886
|
}
|
|
1882
1887
|
|
|
@@ -1914,7 +1919,7 @@ export class AgentConversation implements AgentClient, Bridgeable {
|
|
|
1914
1919
|
if (!input.participantId.trim()) return this.rejectedPrompt(new Error("participant id cannot be blank"));
|
|
1915
1920
|
return this.enqueuePrompt(
|
|
1916
1921
|
promptInputText(input), "prompt", input.handlers, input.attachments,
|
|
1917
|
-
input.participantId.trim(), input.consumerMetadata, input.delivery, promptParts(input), input.beforeDispatch,
|
|
1922
|
+
input.participantId.trim(), input.consumerMetadata, input.delivery, promptParts(input), input.beforeDispatch, input.nativePolicy,
|
|
1918
1923
|
);
|
|
1919
1924
|
}
|
|
1920
1925
|
const participantId = input;
|
|
@@ -1938,6 +1943,7 @@ export class AgentConversation implements AgentClient, Bridgeable {
|
|
|
1938
1943
|
delivery?: PromptDelivery,
|
|
1939
1944
|
messageParts?: readonly MessagePart[],
|
|
1940
1945
|
beforeDispatch?: AgentConversationPromptInput["beforeDispatch"],
|
|
1946
|
+
nativePolicy?: NativeInputPolicy,
|
|
1941
1947
|
): PromptHandle {
|
|
1942
1948
|
const id = this.mintTurnId();
|
|
1943
1949
|
const promise = new Promise<AgentSessionPromptResult>((resolve, reject) => {
|
|
@@ -1948,6 +1954,9 @@ export class AgentConversation implements AgentClient, Bridgeable {
|
|
|
1948
1954
|
let stableConsumerMetadata: PersistenceJsonValue | undefined;
|
|
1949
1955
|
try {
|
|
1950
1956
|
this.assertPromptable();
|
|
1957
|
+
if (nativePolicy !== undefined && !(this.controller instanceof NativeController)) {
|
|
1958
|
+
throw new Error("nativePolicy requires a native conversation");
|
|
1959
|
+
}
|
|
1951
1960
|
stableConsumerMetadata = snapshotConsumerMetadata(consumerMetadata, Boolean(this.ownerLifecycle));
|
|
1952
1961
|
} catch (error) {
|
|
1953
1962
|
reject(error);
|
|
@@ -1968,6 +1977,7 @@ export class AgentConversation implements AgentClient, Bridgeable {
|
|
|
1968
1977
|
attachments,
|
|
1969
1978
|
messageParts,
|
|
1970
1979
|
beforeDispatch,
|
|
1980
|
+
...(nativePolicy === undefined ? {} : { nativePolicy }),
|
|
1971
1981
|
resolve: (result) => {
|
|
1972
1982
|
this.acceptedMessages.delete(id);
|
|
1973
1983
|
// Settled as cancelled before any turn took it: withdrawn (the tracker ignores it once taken).
|
package/src/agent.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { channelSettingsLive, type NativeChannelSettings, type NativeChannelSettingsResult, type NativeRestartOptions, type NativeRestartPreview, type NativeRestartResult, type NativeToolSetting } from "./agent/native-operations.ts";
|
|
1
2
|
import { createAgentReminderService, type ReminderService } from "./native/reminders/service.ts";
|
|
2
3
|
import { resolveProviderStart } from "./conversation-startup.ts";
|
|
3
4
|
import { withDelegationTools } from "./orchestrator/native-delegation.ts";
|
|
@@ -160,13 +161,15 @@ export class Agent {
|
|
|
160
161
|
if (config.orchestrator) validateOrchestrator(config.orchestrator, persistence, resolveConversationRecordCapture(config.capture).message);
|
|
161
162
|
this.persistence = persistence;
|
|
162
163
|
this.adapters = adapters;
|
|
164
|
+
const orchestration = config.orchestrator;
|
|
165
|
+
if (orchestration) this.wrapNativeFunctions = functions => withDelegationTools(functions, orchestration,
|
|
166
|
+
() => this.orchestrator!, () => this.conversations);
|
|
163
167
|
const channels = config.harness ? protectedChannels(persistence) : undefined;
|
|
164
168
|
this.nativeHarness = config.harness
|
|
165
169
|
? new NativeHarnessHost({
|
|
166
170
|
sessionId: id,
|
|
167
171
|
...config.harness,
|
|
168
|
-
...(
|
|
169
|
-
() => this.orchestrator!, () => this.conversations) } : {}),
|
|
172
|
+
...(this.wrapNativeFunctions ? { functions: this.wrapNativeFunctions(config.harness.functions) } : {}),
|
|
170
173
|
...(config.harness.launcher ?? config.conversationDefaults?.launcher
|
|
171
174
|
? { launcher: config.harness.launcher ?? config.conversationDefaults!.launcher }
|
|
172
175
|
: {}),
|
|
@@ -470,9 +473,104 @@ export class Agent {
|
|
|
470
473
|
this.eventBus.publish(records);
|
|
471
474
|
}
|
|
472
475
|
|
|
476
|
+
private nativeOperationHost(): NativeHarnessHost {
|
|
477
|
+
if (this.closed) throw new Error("Agent is closed");
|
|
478
|
+
if (!this.nativeHarness) throw new Error("Agent has no native harness");
|
|
479
|
+
return this.nativeHarness;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
async previewNativeRestart(): Promise<NativeRestartPreview> {
|
|
483
|
+
this.nativeOperationHost();
|
|
484
|
+
const conversationIds: AgentConversationId[] = [];
|
|
485
|
+
let cursor: string | undefined;
|
|
486
|
+
do {
|
|
487
|
+
const page = await this.conversations.list({ cursor });
|
|
488
|
+
for (const conversation of page.conversations) {
|
|
489
|
+
if (!conversation.deletedAt && conversation.controllerKind === "native") conversationIds.push(conversation.agentConversationId);
|
|
490
|
+
}
|
|
491
|
+
cursor = page.nextCursor;
|
|
492
|
+
} while (cursor !== undefined);
|
|
493
|
+
return { conversationIds, conversationCount: conversationIds.length };
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
private readonly nativeOperationsLifetime = new AbortController();
|
|
497
|
+
|
|
498
|
+
waitForNativeIdle(options: { signal?: AbortSignal } = {}): Promise<void> {
|
|
499
|
+
return this.nativeOperationHost().waitForIdle(options.signal ? AbortSignal.any([options.signal, this.nativeOperationsLifetime.signal]) : this.nativeOperationsLifetime.signal);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
private readonly wrapNativeFunctions?: (functions: NonNullable<AgentConfig["harness"]>["functions"]) => NonNullable<AgentConfig["harness"]>["functions"];
|
|
503
|
+
private nativeRestart?: Promise<NativeRestartResult>;
|
|
504
|
+
private readonly nativeRestartListeners = new Set<(result: NativeRestartResult) => void>();
|
|
505
|
+
|
|
506
|
+
subscribeNativeRestart(listener: (result: NativeRestartResult) => void): () => void {
|
|
507
|
+
this.nativeRestartListeners.add(listener);
|
|
508
|
+
return () => { this.nativeRestartListeners.delete(listener); };
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
restartNative(options: NativeRestartOptions = {}): Promise<NativeRestartResult> {
|
|
512
|
+
if (this.nativeRestart) return this.nativeRestart;
|
|
513
|
+
const host = this.nativeOperationHost();
|
|
514
|
+
return this.nativeRestart = (async () => {
|
|
515
|
+
const preview = await this.previewNativeRestart();
|
|
516
|
+
const interruptedTurns: { channel: string; turnId: string }[] = [];
|
|
517
|
+
let result: NativeRestartResult;
|
|
518
|
+
try {
|
|
519
|
+
const signal = options.signal ? AbortSignal.any([options.signal, this.nativeOperationsLifetime.signal]) : this.nativeOperationsLifetime.signal;
|
|
520
|
+
const functions = options.functions !== undefined && this.wrapNativeFunctions
|
|
521
|
+
? this.wrapNativeFunctions(options.functions ?? undefined) : options.functions;
|
|
522
|
+
await host.restartForAgent({ ...options, signal, functions }, interruptedTurns);
|
|
523
|
+
const mcp = host.mcpSnapshot();
|
|
524
|
+
result = { ...preview, kind: "restarted", interruptedTurns, mcp, conversations: preview.conversationIds.map(id =>
|
|
525
|
+
({ id, outcome: host.channel(id) ? "reconnected" : "deferred" })) };
|
|
526
|
+
} catch (error) {
|
|
527
|
+
result = { ...preview, kind: "restart_failed", interruptedTurns, error,
|
|
528
|
+
conversations: preview.conversationIds.map(id => ({ id, outcome: "failed" })) };
|
|
529
|
+
}
|
|
530
|
+
for (const listener of this.nativeRestartListeners) {
|
|
531
|
+
try { listener(result); } catch { /* Observers cannot change the restart outcome. */ }
|
|
532
|
+
}
|
|
533
|
+
return result;
|
|
534
|
+
})().finally(() => { this.nativeRestart = undefined; });
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
nativeMcpStatus() { return this.nativeOperationHost().mcpStatus(); }
|
|
538
|
+
|
|
539
|
+
readonly channelSettingsLive = channelSettingsLive;
|
|
540
|
+
|
|
541
|
+
async applyNativeChannelSettings(id: AgentConversationId, settings: NativeChannelSettings): Promise<NativeChannelSettingsResult> {
|
|
542
|
+
const host = this.nativeOperationHost();
|
|
543
|
+
const conversation = await this.conversations.get(id);
|
|
544
|
+
if (!conversation || conversation.deletedAt || conversation.controllerKind !== "native") {
|
|
545
|
+
return { state: "unsupported", code: "not_native_conversation" } as const;
|
|
546
|
+
}
|
|
547
|
+
const unsupported = Object.keys(settings).filter(key => !channelSettingsLive.channel.some(field => field === key));
|
|
548
|
+
if (unsupported.length) return { state: "unsupported", code: "channel_settings_not_live", fields: unsupported } as const;
|
|
549
|
+
const { displayName, policy, lifecycle } = settings;
|
|
550
|
+
if ([displayName, policy].some(value => value !== undefined && value !== null && typeof value !== "string")
|
|
551
|
+
|| (lifecycle !== undefined && !["open", "suspended", "retired"].includes(lifecycle))) {
|
|
552
|
+
return { state: "unsupported", code: "invalid_channel_settings" } as const;
|
|
553
|
+
}
|
|
554
|
+
if (displayName === undefined && policy === undefined && lifecycle === undefined) return { state: "applied" } as const;
|
|
555
|
+
return host.changeChannel(id, { ...(displayName === undefined ? {} : { displayName }),
|
|
556
|
+
...(policy === undefined ? {} : { policy }), ...(lifecycle === undefined ? {} : { lifecycle }) });
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
applyNativeToolSetting(name: string, setting: NativeToolSetting) {
|
|
560
|
+
const host = this.nativeOperationHost();
|
|
561
|
+
switch (setting) {
|
|
562
|
+
case "enable": return host.enableTool(name);
|
|
563
|
+
case "remove": return host.removeTool(name);
|
|
564
|
+
case "revoke": return host.revokeTool(name);
|
|
565
|
+
case "restore": return host.restoreTool(name);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
473
569
|
async close(): Promise<void> {
|
|
474
570
|
if (this.closed) return;
|
|
475
571
|
this.closed = true;
|
|
572
|
+
this.nativeOperationsLifetime.abort(new Error("Agent is closed"));
|
|
573
|
+
await this.nativeRestart;
|
|
476
574
|
this.nativeHarness?.closeReminderSupervisors();
|
|
477
575
|
this.manager.cancelStarts();
|
|
478
576
|
let shutdownError: unknown;
|
package/src/client.ts
CHANGED
|
@@ -62,6 +62,8 @@ export interface AcpClientConfig extends PermissionPolicyConfig {
|
|
|
62
62
|
execPrefix?: string[];
|
|
63
63
|
/** @deprecated Use launcher and its exact spawnEnv. */
|
|
64
64
|
env?: Record<string, string>;
|
|
65
|
+
/** Exact environment for built-in ACP terminals. */
|
|
66
|
+
terminalEnv?: Record<string, string>;
|
|
65
67
|
/** Workspace visible to the ACP target and sent in session requests. */
|
|
66
68
|
cwd?: string;
|
|
67
69
|
/** Additional workspace roots passed to ACP session creation and loading. */
|
|
@@ -331,7 +333,7 @@ export class AcpClient implements AgentClient {
|
|
|
331
333
|
this.terminals = this.handlers.terminal === "builtin"
|
|
332
334
|
? new TerminalRegistry({
|
|
333
335
|
cwd: this.config.cwd,
|
|
334
|
-
|
|
336
|
+
terminalEnv: launch.terminalEnv ?? this.config.terminalEnv,
|
|
335
337
|
logger: this.config.logger,
|
|
336
338
|
})
|
|
337
339
|
: null;
|
|
@@ -728,7 +730,7 @@ export class AcpClient implements AgentClient {
|
|
|
728
730
|
private terminalHandlers(registry: TerminalRegistry) {
|
|
729
731
|
return {
|
|
730
732
|
create: async (p: schema.CreateTerminalRequest) => ({
|
|
731
|
-
terminalId: registry.create(p
|
|
733
|
+
terminalId: registry.create({ command: p.command, args: p.args, cwd: p.cwd, env: p.env, outputByteLimit: p.outputByteLimit }),
|
|
732
734
|
}),
|
|
733
735
|
output: async (p: schema.TerminalOutputRequest) => {
|
|
734
736
|
const { output, truncated, exitStatus } = registry.output(p.terminalId);
|
|
@@ -983,7 +985,7 @@ export class AcpClient implements AgentClient {
|
|
|
983
985
|
if (abort.signal.aborted) return { outcome: "cancelled" as const };
|
|
984
986
|
if (handler && recordingPermissionHandlers.has(handler)) return handler(request, abort.signal);
|
|
985
987
|
return answerPermissionLevel(permissionLevel(request, this.config), request,
|
|
986
|
-
handler && (() => handler(request, abort.signal)));
|
|
988
|
+
handler && (() => handler(request, abort.signal)), this.config.permissions?.unanswered);
|
|
987
989
|
}),
|
|
988
990
|
]);
|
|
989
991
|
} finally {
|