@qlairoslabs/acp-client 0.12.0 → 0.13.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (467) hide show
  1. package/CHANGELOG-consumer-fixes.md +17 -3
  2. package/CHANGELOG-controller-interface.md +258 -0
  3. package/CHANGELOG-metering.md +29 -0
  4. package/CHANGELOG-operation-lifecycle.md +15 -1
  5. package/CONSUMER_GUIDE.md +847 -7
  6. package/MIGRATION-0.10-to-0.12.md +4 -1
  7. package/MIGRATION-0.12-to-0.13.md +275 -0
  8. package/README.md +17 -16
  9. package/package.json +4 -2
  10. package/src/acp-client-handlers.ts +48 -0
  11. package/src/activity.ts +3 -0
  12. package/src/adapters.ts +30 -0
  13. package/src/agent/adoption/provider-attachment.ts +33 -0
  14. package/src/agent/adoption/provider-session-delete.ts +1 -1
  15. package/src/agent/adoption/provider-sessions.ts +3 -2
  16. package/src/agent/append-assistant-message.ts +91 -0
  17. package/src/agent/config.ts +54 -6
  18. package/src/agent/conversation-manager.ts +94 -158
  19. package/src/agent/manager-settings.ts +1 -0
  20. package/src/agent/native-channel-lifecycle.ts +111 -0
  21. package/src/agent/persisted-lifecycle.ts +44 -4
  22. package/src/agent/persistence-policy/context.ts +13 -0
  23. package/src/agent/persistence-policy/resolver.ts +7 -0
  24. package/src/agent/persistence-policy/types.ts +1 -0
  25. package/src/agent/record-capture.ts +1 -0
  26. package/src/agent-adapter-registry.ts +33 -7
  27. package/src/agent-conversation-contracts.ts +14 -1
  28. package/src/agent-conversation-errors.ts +8 -0
  29. package/src/agent-conversation-owner.ts +9 -4
  30. package/src/agent-session-config.ts +135 -0
  31. package/src/agent-session.ts +439 -934
  32. package/src/agent.ts +73 -0
  33. package/src/capabilities.ts +2 -0
  34. package/src/checkpointing/recovery.ts +10 -0
  35. package/src/cli/index.ts +3 -3
  36. package/src/cli/managed.ts +2 -2
  37. package/src/client.ts +68 -98
  38. package/src/connection-attempt.ts +95 -0
  39. package/src/controller-connection.ts +114 -0
  40. package/src/controller.ts +156 -148
  41. package/src/conversation-controller/capabilities.ts +88 -0
  42. package/src/conversation-controller/contracts.ts +208 -0
  43. package/src/conversation-controller/factory.ts +39 -0
  44. package/src/conversation-controller/guards.ts +98 -0
  45. package/src/conversation-controller/index.ts +20 -0
  46. package/src/conversation-startup.ts +35 -0
  47. package/src/conversation-turns/backend-turns.ts +373 -0
  48. package/src/conversation-turns/clear-operations.ts +37 -0
  49. package/src/conversation-turns/context.ts +135 -0
  50. package/src/conversation-turns/index.ts +4 -0
  51. package/src/conversation-turns/record-helpers.ts +75 -0
  52. package/src/conversation-turns/recording.ts +235 -0
  53. package/src/conversation-turns/run-turn.ts +367 -0
  54. package/src/conversation-turns/turn-run.ts +57 -0
  55. package/src/errors.ts +41 -0
  56. package/src/handoff-options.ts +81 -0
  57. package/src/identity/checkpoint-backed.ts +1 -1
  58. package/src/index.ts +58 -3
  59. package/src/internal-inference/coordination/manager.ts +11 -0
  60. package/src/internal-inference/runtime/harness-runtime.ts +4 -4
  61. package/src/launcher.ts +35 -2
  62. package/src/media/parts.ts +5 -0
  63. package/src/message-status.ts +83 -0
  64. package/src/metering/engine.ts +39 -64
  65. package/src/metering/measurement-provenance.ts +36 -0
  66. package/src/metering/native/durability.ts +115 -0
  67. package/src/metering/native/ledger.ts +104 -0
  68. package/src/metering/native/operation.ts +85 -0
  69. package/src/metering/native/projection.ts +114 -0
  70. package/src/metering/native/proof.ts +51 -0
  71. package/src/metering/native/requirements.ts +10 -0
  72. package/src/metering/native/retirement.ts +92 -0
  73. package/src/metering/native/source.ts +90 -0
  74. package/src/metering/record.ts +38 -1
  75. package/src/metering/state.ts +13 -3
  76. package/src/native/approvals.ts +169 -0
  77. package/src/native/capabilities.ts +17 -0
  78. package/src/native/channel-changes.ts +211 -0
  79. package/src/native/connection.ts +56 -0
  80. package/src/native/controller.ts +591 -0
  81. package/src/native/delegation-sender.ts +26 -0
  82. package/src/native/errors.ts +35 -0
  83. package/src/native/functions.ts +156 -0
  84. package/src/native/host-config.ts +59 -0
  85. package/src/native/host.ts +909 -0
  86. package/src/native/item-receipts.ts +15 -0
  87. package/src/native/metering.ts +12 -0
  88. package/src/native/records.ts +166 -0
  89. package/src/native/recovery.ts +186 -0
  90. package/src/native/reminders/fixtures/schema21.sqlite.gz +0 -0
  91. package/src/native/reminders/idle.ts +70 -0
  92. package/src/native/reminders/limits.ts +19 -0
  93. package/src/native/reminders/notifications.ts +29 -0
  94. package/src/native/reminders/reminders.test.ts +553 -0
  95. package/src/native/reminders/routine-config.typecheck.ts +13 -0
  96. package/src/native/reminders/routine-guard.ts +66 -0
  97. package/src/native/reminders/routine-schedule.ts +25 -0
  98. package/src/native/reminders/routine-wire.ts +21 -0
  99. package/src/native/reminders/schedule.ts +97 -0
  100. package/src/native/reminders/service.ts +280 -0
  101. package/src/native/reminders/supervisor.ts +91 -0
  102. package/src/native/reminders/sync.ts +301 -0
  103. package/src/native/reminders/wire.ts +197 -0
  104. package/src/native/reminders/wire.typecheck.ts +13 -0
  105. package/src/native/submission-withdrawal.ts +65 -0
  106. package/src/native/usage.ts +15 -0
  107. package/src/native/worker-delivery.ts +61 -0
  108. package/src/native-harness/.res/README.md +1 -0
  109. package/src/native-harness/.res/architecture/README.md +21 -0
  110. package/src/native-harness/.res/architecture/context-and-data.md +31 -0
  111. package/src/native-harness/.res/architecture/execution.md +42 -0
  112. package/src/native-harness/.res/architecture/overview.md +44 -0
  113. package/src/native-harness/.res/architecture/persistence.md +56 -0
  114. package/src/native-harness/.res/architecture/suspend-and-resume.md +45 -0
  115. package/src/native-harness/.res/architecture/technical-architecture.md +50 -0
  116. package/src/native-harness/.res/decisions/0001-basic-loop.md +11 -0
  117. package/src/native-harness/.res/decisions/0002-channel-input.md +17 -0
  118. package/src/native-harness/.res/decisions/0003-inference-inspection.md +14 -0
  119. package/src/native-harness/.res/decisions/0004-shared-context.md +21 -0
  120. package/src/native-harness/.res/decisions/0005-notice-inbox.md +20 -0
  121. package/src/native-harness/.res/decisions/0006-explicit-notices.md +12 -0
  122. package/src/native-harness/.res/decisions/0007-channel-output.md +12 -0
  123. package/src/native-harness/.res/decisions/0008-browser-client.md +16 -0
  124. package/src/native-harness/.res/decisions/0009-scripted-model.md +18 -0
  125. package/src/native-harness/.res/decisions/0010-inprocess-protocol.md +19 -0
  126. package/src/native-harness/.res/decisions/0011-stdio-transport.md +21 -0
  127. package/src/native-harness/.res/decisions/0012-session-storage-contract.md +37 -0
  128. package/src/native-harness/.res/decisions/0013-durable-delivery-contract.md +64 -0
  129. package/src/native-harness/.res/decisions/0014-channel-controls-contract.md +73 -0
  130. package/src/native-harness/.res/decisions/0015-session-file-contract.md +72 -0
  131. package/src/native-harness/.res/decisions/0016-configuration-permissions.md +159 -0
  132. package/src/native-harness/.res/decisions/0017-openrouter-managed-config.md +69 -0
  133. package/src/native-harness/.res/decisions/0018-tool-dispatch-evidence.md +78 -0
  134. package/src/native-harness/.res/decisions/0019-model-execution.md +188 -0
  135. package/src/native-harness/.res/decisions/0020-startup-channel-changes.md +71 -0
  136. package/src/native-harness/.res/decisions/0021-tools-and-host-callbacks.md +100 -0
  137. package/src/native-harness/.res/decisions/0022-operator-controls.md +115 -0
  138. package/src/native-harness/.res/decisions/0023-long-running-mock.md +82 -0
  139. package/src/native-harness/.res/decisions/0024-callback-policy-names.md +46 -0
  140. package/src/native-harness/.res/decisions/0025-external-notices.md +364 -0
  141. package/src/native-harness/.res/decisions/0026-bounded-context.md +81 -0
  142. package/src/native-harness/.res/decisions/0027-development-instructions.md +22 -0
  143. package/src/native-harness/.res/decisions/0028-debug-tools.md +16 -0
  144. package/src/native-harness/.res/decisions/0029-bounded-model-call-pages.md +37 -0
  145. package/src/native-harness/.res/decisions/0030-timeline-retrieval.md +145 -0
  146. package/src/native-harness/.res/decisions/0031-one-off-reminders.md +173 -0
  147. package/src/native-harness/.res/docs/11-15.md +148 -0
  148. package/src/native-harness/.res/docs/BUSINESS_RULES.md +111 -0
  149. package/src/native-harness/.res/docs/WORK.md +65 -0
  150. package/src/native-harness/.res/docs/_/11-16-persistence/LOG.md +312 -0
  151. package/src/native-harness/.res/docs/_/11-16-persistence/PLAN.md +77 -0
  152. package/src/native-harness/.res/docs/_/11-16-persistence/SPEC.md +313 -0
  153. package/src/native-harness/.res/docs/_/11-19-channel-controls/LOG.md +160 -0
  154. package/src/native-harness/.res/docs/_/11-19-channel-controls/PLAN.md +89 -0
  155. package/src/native-harness/.res/docs/_/11-19-channel-controls/SPEC.md +135 -0
  156. package/src/native-harness/.res/docs/_/11-19-config-permissions/LOG.md +143 -0
  157. package/src/native-harness/.res/docs/_/11-19-config-permissions/PLAN.md +93 -0
  158. package/src/native-harness/.res/docs/_/11-19-config-permissions/SPEC.md +181 -0
  159. package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/11-20-LOG.md +433 -0
  160. package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/PLAN.md +60 -0
  161. package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/PROTOCOL.md +141 -0
  162. package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/SPEC.md +168 -0
  163. package/src/native-harness/.res/docs/attachments/0001-DESIGN/SPEC.md +111 -0
  164. package/src/native-harness/.res/docs/bounded-context/0001-DESIGN/PLAN.md +129 -0
  165. package/src/native-harness/.res/docs/bounded-context/0001-DESIGN/SPEC.md +135 -0
  166. package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/LOG.md +437 -0
  167. package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/PLAN.md +127 -0
  168. package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/SPEC.md +203 -0
  169. package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/LOG.md +292 -0
  170. package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/PLAN.md +91 -0
  171. package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/SPEC.md +187 -0
  172. package/src/native-harness/.res/docs/model-execution/0001-DESIGN/LOG.md +148 -0
  173. package/src/native-harness/.res/docs/model-execution/0001-DESIGN/PLAN.md +95 -0
  174. package/src/native-harness/.res/docs/model-execution/0001-DESIGN/SPEC.md +200 -0
  175. package/src/native-harness/.res/docs/model-execution/0002-AMENDMENT-accounting/SPEC.md +80 -0
  176. package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/LOG.md +206 -0
  177. package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/PLAN.md +106 -0
  178. package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/SPEC.md +297 -0
  179. package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/LOG.md +41 -0
  180. package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/PLAN.md +36 -0
  181. package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/SPEC.md +84 -0
  182. package/src/native-harness/.res/docs/shell-execution/0001-DESIGN/SPEC.md +147 -0
  183. package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/LOG.md +15 -0
  184. package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/PLAN.md +107 -0
  185. package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/SPEC.md +114 -0
  186. package/src/native-harness/.res/docs/todos/11-19-TODO-auto_review-approve.md +24 -0
  187. package/src/native-harness/.res/docs/todos/11-20-TODO-user-entered-tool-code.md +23 -0
  188. package/src/native-harness/.res/docs/todos/11-21-TODO-node-resource-coordination.md +103 -0
  189. package/src/native-harness/.res/docs/todos/11-22-TODO-harness-m1-sequence.md +50 -0
  190. package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/LOG.md +337 -0
  191. package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/PLAN.md +76 -0
  192. package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/SPEC.md +204 -0
  193. package/src/native-harness/.res/docs/tools-and-callbacks/0002-AMENDMENT-callback-policy/LOG.md +73 -0
  194. package/src/native-harness/.res/docs/tools-and-callbacks/0002-AMENDMENT-callback-policy/SPEC.md +64 -0
  195. package/src/native-harness/.res/docs/tools-and-callbacks/0003-DESIGN-attachment-tools/SPEC.md +58 -0
  196. package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/LOG.md +45 -0
  197. package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/PLAN.md +108 -0
  198. package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/SPEC.md +169 -0
  199. package/src/native-harness/.res/docs/web-tools/0001-DESIGN/SPEC.md +128 -0
  200. package/src/native-harness/.res/marketing-draft.md +22 -0
  201. package/src/native-harness/.res/sandbox/1-simple-harness/README.md +285 -0
  202. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-1.md +19 -0
  203. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-10.md +138 -0
  204. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-11.md +148 -0
  205. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-12.md +172 -0
  206. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-13.md +194 -0
  207. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-14.md +233 -0
  208. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-15.md +249 -0
  209. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-16.md +265 -0
  210. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-17.md +279 -0
  211. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-18.md +293 -0
  212. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-19.md +307 -0
  213. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-2.md +29 -0
  214. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-20.md +317 -0
  215. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-21.md +327 -0
  216. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-3.md +40 -0
  217. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-4.md +59 -0
  218. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-5.md +69 -0
  219. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-6.md +79 -0
  220. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-7.md +89 -0
  221. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-8.md +102 -0
  222. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-9.md +116 -0
  223. package/src/native-harness/.res/sandbox/1-simple-harness/conversation.jsonl +49 -0
  224. package/src/native-harness/.res/sandbox/1-simple-harness/doc.md +87 -0
  225. package/src/native-harness/.res/sandbox/1-simple-harness/harness.py +289 -0
  226. package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy 2.py +221 -0
  227. package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy 3.py +287 -0
  228. package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy.py +165 -0
  229. package/src/native-harness/.res/sandbox/1-simple-harness/state.json +22 -0
  230. package/src/native-harness/.res/sandbox/1-simple-harness/system-prompt.md +2 -0
  231. package/src/native-harness/AGENTS.md +70 -0
  232. package/src/native-harness/ARCHITECTURE.md +249 -0
  233. package/src/native-harness/README.md +726 -0
  234. package/src/native-harness/bun.lock +26 -0
  235. package/src/native-harness/package.json +24 -0
  236. package/src/native-harness/src/capabilities/context/build.ts +59 -0
  237. package/src/native-harness/src/capabilities/context/instructions/agent-demo.md +11 -0
  238. package/src/native-harness/src/capabilities/context/instructions/agent.md +5 -0
  239. package/src/native-harness/src/capabilities/context/instructions/harness.md +7 -0
  240. package/src/native-harness/src/capabilities/context/load-instructions.ts +22 -0
  241. package/src/native-harness/src/capabilities/context/session.ts +92 -0
  242. package/src/native-harness/src/capabilities/model/attempt.ts +27 -0
  243. package/src/native-harness/src/capabilities/model/openrouter-stream.ts +72 -0
  244. package/src/native-harness/src/capabilities/model/openrouter.ts +62 -0
  245. package/src/native-harness/src/capabilities/model/runner.ts +116 -0
  246. package/src/native-harness/src/capabilities/model/scenario-attempt.ts +50 -0
  247. package/src/native-harness/src/capabilities/model/scenario-file.ts +125 -0
  248. package/src/native-harness/src/capabilities/model/scripted-error.ts +6 -0
  249. package/src/native-harness/src/capabilities/model/scripted.ts +81 -0
  250. package/src/native-harness/src/capabilities/model/usage.ts +15 -0
  251. package/src/native-harness/src/capabilities/tools/builtin/current-time.ts +28 -0
  252. package/src/native-harness/src/capabilities/tools/builtin/notify-channel.ts +17 -0
  253. package/src/native-harness/src/capabilities/tools/debug/index.ts +13 -0
  254. package/src/native-harness/src/capabilities/tools/debug/result.ts +12 -0
  255. package/src/native-harness/src/capabilities/tools/debug/test-echo.ts +16 -0
  256. package/src/native-harness/src/capabilities/tools/debug/test-fail.ts +14 -0
  257. package/src/native-harness/src/capabilities/tools/debug/test-wait.ts +19 -0
  258. package/src/native-harness/src/capabilities/tools/reminders/index.ts +75 -0
  259. package/src/native-harness/src/capabilities/tools/runtime/catalog.ts +103 -0
  260. package/src/native-harness/src/capabilities/tools/runtime/functions.ts +130 -0
  261. package/src/native-harness/src/capabilities/tools/runtime/invocations.ts +48 -0
  262. package/src/native-harness/src/capabilities/tools/testing/echo.ts +18 -0
  263. package/src/native-harness/src/capabilities/tools/testing/record.ts +47 -0
  264. package/src/native-harness/src/capabilities/tools/timeline/index.ts +41 -0
  265. package/src/native-harness/src/client.ts +18 -0
  266. package/src/native-harness/src/contracts/agent.ts +105 -0
  267. package/src/native-harness/src/contracts/config-permissions.ts +47 -0
  268. package/src/native-harness/src/contracts/context.ts +112 -0
  269. package/src/native-harness/src/contracts/events.ts +47 -0
  270. package/src/native-harness/src/contracts/input-limits.ts +7 -0
  271. package/src/native-harness/src/contracts/inspection.ts +22 -0
  272. package/src/native-harness/src/contracts/loop.ts +31 -0
  273. package/src/native-harness/src/contracts/model-execution.ts +83 -0
  274. package/src/native-harness/src/contracts/operator-controls.ts +106 -0
  275. package/src/native-harness/src/contracts/output.ts +13 -0
  276. package/src/native-harness/src/contracts/protocol.ts +320 -0
  277. package/src/native-harness/src/contracts/reminders.ts +132 -0
  278. package/src/native-harness/src/contracts/scenario.ts +42 -0
  279. package/src/native-harness/src/contracts/session-file.ts +19 -0
  280. package/src/native-harness/src/contracts/session.ts +184 -0
  281. package/src/native-harness/src/contracts/storage.ts +596 -0
  282. package/src/native-harness/src/contracts/timeline-retrieval.ts +40 -0
  283. package/src/native-harness/src/contracts/tools.ts +133 -0
  284. package/src/native-harness/src/governance/permissions/gate.ts +129 -0
  285. package/src/native-harness/src/governance/policy/resolve.ts +32 -0
  286. package/src/native-harness/src/index.ts +318 -0
  287. package/src/native-harness/src/interfaces/cli/chat.ts +83 -0
  288. package/src/native-harness/src/interfaces/cli/development.ts +145 -0
  289. package/src/native-harness/src/interfaces/cli/format-reply.ts +27 -0
  290. package/src/native-harness/src/interfaces/cli/listeners.ts +74 -0
  291. package/src/native-harness/src/interfaces/cli/main.ts +47 -0
  292. package/src/native-harness/src/interfaces/cli/scenario.ts +37 -0
  293. package/src/native-harness/src/interfaces/cli/serve.ts +21 -0
  294. package/src/native-harness/src/interfaces/cli/start.ts +106 -0
  295. package/src/native-harness/src/interfaces/client.ts +225 -0
  296. package/src/native-harness/src/interfaces/inspector/index.html +283 -0
  297. package/src/native-harness/src/interfaces/inspector/observe.ts +35 -0
  298. package/src/native-harness/src/interfaces/inspector/server.ts +56 -0
  299. package/src/native-harness/src/interfaces/inspector/state.ts +92 -0
  300. package/src/native-harness/src/interfaces/protocol/channel-changes.ts +153 -0
  301. package/src/native-harness/src/interfaces/protocol/framing.ts +47 -0
  302. package/src/native-harness/src/interfaces/protocol/functions.ts +87 -0
  303. package/src/native-harness/src/interfaces/protocol/in-process.ts +67 -0
  304. package/src/native-harness/src/interfaces/protocol/live-queue.ts +55 -0
  305. package/src/native-harness/src/interfaces/protocol/load.ts +60 -0
  306. package/src/native-harness/src/interfaces/protocol/local.ts +120 -0
  307. package/src/native-harness/src/interfaces/protocol/operator.ts +120 -0
  308. package/src/native-harness/src/interfaces/protocol/output.ts +59 -0
  309. package/src/native-harness/src/interfaces/protocol/server.ts +517 -0
  310. package/src/native-harness/src/interfaces/protocol/stdio-client.ts +119 -0
  311. package/src/native-harness/src/interfaces/protocol/stdio-server.ts +82 -0
  312. package/src/native-harness/src/interfaces/protocol/subscribe.ts +41 -0
  313. package/src/native-harness/src/interfaces/protocol/transfers.ts +146 -0
  314. package/src/native-harness/src/interfaces/web-chat/index.html +94 -0
  315. package/src/native-harness/src/interfaces/web-chat/server.ts +34 -0
  316. package/src/native-harness/src/kernel/channels.ts +405 -0
  317. package/src/native-harness/src/kernel/loop.ts +45 -0
  318. package/src/native-harness/src/runtime/config/development.ts +23 -0
  319. package/src/native-harness/src/runtime/config/managed.ts +2 -0
  320. package/src/native-harness/src/runtime/config/paths.ts +27 -0
  321. package/src/native-harness/src/runtime/reminder-timer.ts +42 -0
  322. package/src/native-harness/src/runtime/reminder-validation.ts +104 -0
  323. package/src/native-harness/src/runtime/reminders.ts +66 -0
  324. package/src/native-harness/src/state/storage/archive.ts +239 -0
  325. package/src/native-harness/src/state/storage/engine.ts +1013 -0
  326. package/src/native-harness/src/state/storage/inference.ts +124 -0
  327. package/src/native-harness/src/state/storage/memory-reminders.ts +78 -0
  328. package/src/native-harness/src/state/storage/memory.ts +341 -0
  329. package/src/native-harness/src/state/storage/policy-metadata.ts +32 -0
  330. package/src/native-harness/src/state/storage/reminder-archive.ts +63 -0
  331. package/src/native-harness/src/state/storage/reminder-change.ts +92 -0
  332. package/src/native-harness/src/state/storage/reminder-tables.ts +27 -0
  333. package/src/native-harness/src/state/storage/retrieval.ts +122 -0
  334. package/src/native-harness/src/state/storage/script-identity.ts +7 -0
  335. package/src/native-harness/src/state/storage/session-file.ts +85 -0
  336. package/src/native-harness/src/state/storage/sqlite-reminders.ts +134 -0
  337. package/src/native-harness/src/state/storage/sqlite.ts +625 -0
  338. package/src/native-harness/src/testing.ts +190 -0
  339. package/src/native-harness/src/util/config.ts +58 -0
  340. package/src/native-harness/src/util/json.ts +41 -0
  341. package/src/native-harness/src/util/message-position.ts +3 -0
  342. package/src/native-harness/src/util/reminder-schedule.ts +44 -0
  343. package/src/native-harness/src/util/schema.ts +40 -0
  344. package/src/native-harness/src/util/timeline-text.ts +72 -0
  345. package/src/native-harness/src/util/timeline-tool-names.ts +3 -0
  346. package/src/native-harness/test/agent.test.ts +130 -0
  347. package/src/native-harness/test/approval-gate.test.ts +255 -0
  348. package/src/native-harness/test/approval-protocol.test.ts +94 -0
  349. package/src/native-harness/test/boundaries.test.ts +18 -0
  350. package/src/native-harness/test/channel-controls.test.ts +322 -0
  351. package/src/native-harness/test/client-abort.test.ts +136 -0
  352. package/src/native-harness/test/config-policy.test.ts +301 -0
  353. package/src/native-harness/test/conformance/storage.ts +1141 -0
  354. package/src/native-harness/test/context.test.ts +177 -0
  355. package/src/native-harness/test/crash.test.ts +187 -0
  356. package/src/native-harness/test/debug-tools.test.ts +67 -0
  357. package/src/native-harness/test/development-cli.test.ts +67 -0
  358. package/src/native-harness/test/development.test.ts +171 -0
  359. package/src/native-harness/test/dispatch-evidence.test.ts +58 -0
  360. package/src/native-harness/test/e2e.test.ts +186 -0
  361. package/src/native-harness/test/external-notices.test.ts +101 -0
  362. package/src/native-harness/test/fixtures/approval-e2e.jsonl +4 -0
  363. package/src/native-harness/test/fixtures/crash-scenario.jsonl +5 -0
  364. package/src/native-harness/test/fixtures/development-lifecycle.jsonl +10 -0
  365. package/src/native-harness/test/fixtures/echo-scenario.jsonl +3 -0
  366. package/src/native-harness/test/fixtures/format2-schema.ts +27 -0
  367. package/src/native-harness/test/fixtures/format3-schema.ts +16 -0
  368. package/src/native-harness/test/fixtures/hold-scenario.jsonl +4 -0
  369. package/src/native-harness/test/fixtures/model-e2e.jsonl +3 -0
  370. package/src/native-harness/test/fixtures/storage-owner.ts +20 -0
  371. package/src/native-harness/test/format-reply.test.ts +10 -0
  372. package/src/native-harness/test/helpers/operator-view.ts +41 -0
  373. package/src/native-harness/test/helpers/scenario.ts +9 -0
  374. package/src/native-harness/test/helpers/session.ts +38 -0
  375. package/src/native-harness/test/helpers/stdio.ts +46 -0
  376. package/src/native-harness/test/inspector.test.ts +77 -0
  377. package/src/native-harness/test/listeners.test.ts +49 -0
  378. package/src/native-harness/test/loop.test.ts +88 -0
  379. package/src/native-harness/test/model-channel-double.test.ts +87 -0
  380. package/src/native-harness/test/model-crash.test.ts +62 -0
  381. package/src/native-harness/test/model-delivery-regressions.test.ts +55 -0
  382. package/src/native-harness/test/model-e2e.test.ts +71 -0
  383. package/src/native-harness/test/model-final-filter.test.ts +30 -0
  384. package/src/native-harness/test/model-large-reply.test.ts +28 -0
  385. package/src/native-harness/test/model-live-queue.test.ts +33 -0
  386. package/src/native-harness/test/model-runner.test.ts +117 -0
  387. package/src/native-harness/test/model-storage.test.ts +99 -0
  388. package/src/native-harness/test/model-stream-adapter.test.ts +26 -0
  389. package/src/native-harness/test/model-stream-public.test.ts +77 -0
  390. package/src/native-harness/test/notices.test.ts +64 -0
  391. package/src/native-harness/test/openrouter-config.test.ts +218 -0
  392. package/src/native-harness/test/operator-controls.test.ts +132 -0
  393. package/src/native-harness/test/output.test.ts +44 -0
  394. package/src/native-harness/test/owner-config.test.ts +64 -0
  395. package/src/native-harness/test/permissions-e2e.test.ts +68 -0
  396. package/src/native-harness/test/persistence.test.ts +236 -0
  397. package/src/native-harness/test/portability.test.ts +337 -0
  398. package/src/native-harness/test/protocol.test.ts +160 -0
  399. package/src/native-harness/test/reminder-clock.test.ts +61 -0
  400. package/src/native-harness/test/reminder-stdio.test.ts +140 -0
  401. package/src/native-harness/test/reminder-storage.test.ts +124 -0
  402. package/src/native-harness/test/scenario-jsonl.test.ts +112 -0
  403. package/src/native-harness/test/scripted.test.ts +92 -0
  404. package/src/native-harness/test/session-file.test.ts +51 -0
  405. package/src/native-harness/test/startup-channel-changes.test.ts +256 -0
  406. package/src/native-harness/test/stdio.test.ts +132 -0
  407. package/src/native-harness/test/storage-memory.test.ts +4 -0
  408. package/src/native-harness/test/storage-sqlite.test.ts +420 -0
  409. package/src/native-harness/test/suspension.test.ts +430 -0
  410. package/src/native-harness/test/timeline-retrieval.test.ts +211 -0
  411. package/src/native-harness/test/tools-catalog.test.ts +468 -0
  412. package/src/native-harness/test/tools-protocol.test.ts +418 -0
  413. package/src/native-harness/test/transfers.test.ts +94 -0
  414. package/src/native-harness/test/web-chat.test.ts +35 -0
  415. package/src/native-harness/tsconfig.json +20 -0
  416. package/src/observation/agent-event-bus.ts +44 -18
  417. package/src/observation/index.ts +1 -0
  418. package/src/operations/contracts.ts +11 -3
  419. package/src/operations/errors.ts +5 -0
  420. package/src/operations/stale-policy.ts +1 -1
  421. package/src/operations/supervisor.ts +34 -10
  422. package/src/orchestrator/acp-delivery.ts +68 -0
  423. package/src/orchestrator/assignments.ts +27 -0
  424. package/src/orchestrator/busy.ts +15 -0
  425. package/src/orchestrator/config.ts +41 -0
  426. package/src/orchestrator/consumer-api.ts +24 -0
  427. package/src/orchestrator/contracts.ts +71 -0
  428. package/src/orchestrator/durable-assignments.ts +111 -0
  429. package/src/orchestrator/native-delegation.ts +103 -0
  430. package/src/orchestrator/orchestrator.ts +318 -0
  431. package/src/orchestrator/permissions.ts +25 -0
  432. package/src/orchestrator/policy.ts +44 -0
  433. package/src/orchestrator/pool.ts +123 -0
  434. package/src/orchestrator/tool-descriptions.ts +11 -0
  435. package/src/permissions/acp.ts +18 -0
  436. package/src/permissions/arrival.ts +13 -0
  437. package/src/permissions/consumer-config.ts +19 -0
  438. package/src/permissions/conversation.ts +280 -0
  439. package/src/permissions/matcher.ts +85 -0
  440. package/src/permissions/outcome.ts +15 -0
  441. package/src/permissions/policy.ts +81 -0
  442. package/src/permissions/request.ts +26 -0
  443. package/src/persistence/activity-projection.ts +1 -0
  444. package/src/persistence/backend.ts +34 -1
  445. package/src/persistence/channels.ts +23 -0
  446. package/src/persistence/index.ts +4 -0
  447. package/src/persistence/protocol-method.ts +5 -0
  448. package/src/persistence/reminder-wake.ts +49 -0
  449. package/src/persistence/reminders.ts +385 -0
  450. package/src/persistence/sqlite-backend.ts +84 -6
  451. package/src/persistence/sqlite-channels.ts +65 -0
  452. package/src/persistence/sqlite-reminders.ts +85 -0
  453. package/src/persistence/sqlite-schema.ts +108 -3
  454. package/src/persistence/sqlite-worker-delivery.ts +374 -0
  455. package/src/persistence/sqlite-workers.ts +59 -0
  456. package/src/persistence/worker-delivery-contract.ts +104 -0
  457. package/src/persistence/worker-terminal-reason.ts +29 -0
  458. package/src/persistence/workers.ts +19 -0
  459. package/src/provider-notices.ts +137 -0
  460. package/src/repl/commands.ts +2 -2
  461. package/src/steering/combine.ts +3 -1
  462. package/src/steering/contracts.ts +11 -2
  463. package/src/steering/controller.ts +3 -2
  464. package/src/transport/acp-transport.ts +24 -14
  465. package/src/types.ts +15 -12
  466. package/src/updates.ts +14 -2
  467. package/src/wire-log.ts +1 -1
@@ -0,0 +1,145 @@
1
+ # 0030 — Timeline retrieval contract
2
+
3
+ ## Problem
4
+
5
+ Bounded inference needs a way to recover attributed conversation messages without
6
+ loading a session snapshot. Both storage adapters and both native entry points
7
+ must agree on results, admission, and the lifetime of retrieval exchanges.
8
+
9
+ ## Options
10
+
11
+ SQLite's native tokenizer and relevance ranking are convenient but differ from
12
+ JavaScript on Unicode and produce adapter-specific ordering. Full timeline scans
13
+ would avoid index synchronization but make SQLite retrieval history-sized. A
14
+ shared application tokenizer with a conservative derived index gives a common
15
+ contract and bounded verification; ranking work in the index is still potentially
16
+ history-sized.
17
+
18
+ ## Choice
19
+
20
+ ### Admission and scope
21
+
22
+ Reserve `search_timeline` and `read_message` even when disabled. Register local
23
+ handlers with definitions, strict argument validation and availability through
24
+ one checked native dispatch path. Check current offer, availability, and arguments
25
+ before policy/approval or execution. An invalid, unavailable, or unoffered call
26
+ produces one paired rejection without approval or execution; denial and abort
27
+ never start a handler. Existing host callbacks, result reader, debug and notice
28
+ behavior retain their contracts. Caller identity and channel come from the turn,
29
+ never model arguments; the optional channel only narrows shared session scope.
30
+
31
+ Eligible text is exactly the operator conversation projection: committed
32
+ participant messages and assistant replies with nonempty text, with the operator's
33
+ participant attribution prefix removed. Exclude notices, tool results and
34
+ textless assistant calls. Share the projection and its ID encoder, preserving
35
+ channel, sender and available timestamp; do not fabricate a timestamp where the
36
+ source lacks one. Direct reads and neighbors apply the same eligibility and
37
+ visibility checks as search.
38
+
39
+ ### Search semantics and bounds
40
+
41
+ A word is a maximal run of Unicode Letter, Mark or Number code points. Normalize
42
+ text to NFC before tokenizing. Normalize each token to NFC again after Unicode
43
+ `toLowerCase()` for case-insensitive comparison; case-sensitive comparison uses
44
+ the NFC token without case conversion. Diacritics are significant, punctuation
45
+ and whitespace separate words, and matches are whole tokens. Keywords require
46
+ all query tokens; phrase requires consecutive tokens in order. Duplicates are
47
+ significant for phrase and redundant for keyword matching. These rules are not
48
+ locale-sensitive and do not promise full Unicode case folding. Validate fixtures
49
+ for composed/decomposed accents, non-Latin letters, case, punctuation and empty
50
+ or punctuation-only queries.
51
+
52
+ Arguments: query at most 1024 UTF-8 bytes and 32 tokens, each normalized and folded token
53
+ at most 256 UTF-8 bytes; `match` is `keywords` (default) or `phrase`, and
54
+ `case_sensitive` defaults false. Reject unknown fields and wrong types. Limit
55
+ channel and ID strings to the existing input limits. Return at most 20 hits,
56
+ each with an excerpt of at most 512 UTF-8 bytes around the first qualifying match,
57
+ cut only on Unicode scalar boundaries. The complete JSON result is limited to
58
+ 32 KiB; stop before exceeding it and set `partial` if a hit is omitted.
59
+
60
+ Generate candidate entries containing all distinct lowercased query tokens, in
61
+ descending sequence order. Verify no more than 1000 candidates, including those
62
+ that fail exact-case or phrase verification; probe one extra to establish whether
63
+ work remains. Verify at most 2 MiB of original projected UTF-8 text in
64
+ total. Check size before reading bodies, and stop at the first candidate
65
+ that would exceed the remaining budget, including a single oversized
66
+ candidate. Rank keywords by the sum of occurrences of distinct query
67
+ tokens and phrases by the number of consecutive phrase occurrences,
68
+ capped at 255, then sequence descending. Both adapters use the same
69
+ score. Set partial if candidates remain unverified or serialized bytes
70
+ omit a selected hit. A partial result describes the best of those checked.
71
+ Result count alone does not imply partial: continue verification up to the cap
72
+ so ranking is meaningful. A common token can still require substantial index
73
+ matching/sorting before candidate verification; measure this separately.
74
+
75
+ SQLite FTS5 indexes each normalized lowercase token as `x` followed by the
76
+ hexadecimal UTF-8 bytes, separated by spaces, using the ASCII tokenizer. Query
77
+ with internally constructed, parameterized AND terms; never expose FTS syntax.
78
+ Use timeline sequence as FTS rowid, and select by rowid descending with the
79
+ cap plus one. Index only folded tokens within the supported query token
80
+ size, so oversized document tokens cannot exceed FTS token limits.
81
+ This reversible encoding prevents FTS Unicode tokenization or diacritic folding
82
+ from dropping a candidate. Verify phrase and casing against original projected
83
+ text. Memory uses the identical candidate predicate, ordering, cap and scoring.
84
+
85
+ ### Point reads and windows
86
+
87
+ Resolve `item:<id>`, stored model message IDs and canonical decimal sequence
88
+ fallback by indexed point lookup, then confirm the encoded ID, session, eligibility
89
+ and visibility. Unknown, malformed, inaccessible and ineligible IDs are not found.
90
+ Do not scan entries or take a snapshot to resolve IDs. On first read freeze the
91
+ committed timeline revision, resolve the target, and select up to `before` and
92
+ `after` eligible messages in the same channel at or below that revision, each
93
+ count 0–20. Return them in ascending sequence with the target identified.
94
+
95
+ A versioned opaque cursor binds the session, target ID and sequence, channel,
96
+ revision, requested counts, fixed selected window endpoints and next sequence and
97
+ UTF-8 byte offset. Validate all fields and the requested target/window on each
98
+ page, recheck visibility and target identity, and reject malformed or mismatched
99
+ cursors. Appends cannot change the frozen window. Pages contain at most 20 message
100
+ fragments and 32 KiB of JSON; split long text only on scalar boundaries, advancing
101
+ the offset without dropping or repeating bytes. An individually unrepresentable
102
+ identity returns a bounded transfer error rather than a non-advancing cursor.
103
+ A continuation is the explicit indication of an incomplete read.
104
+
105
+ ### Index lifecycle and projection
106
+
107
+ The timeline remains canonical. Add a versioned derived SQLite index and point
108
+ lookup indexes under the exclusive owner transaction; backfill existing files,
109
+ update index rows in the same transaction as timeline writes, and rebuild on
110
+ archive import. Mark dirty via triggers for writes from older compatible writers;
111
+ on open, atomically rebuild a missing, dirty or incompatible projection before
112
+ reads, leaving canonical data intact on failure. Check the dirty marker
113
+ inside the read transaction and fail closed if it was dirtied during the
114
+ session. Never serve stale projected results. Archive only canonical records;
115
+ IDs and index contents are reconstructed. Keep existing format compatibility and
116
+ ensure interrupted rebuilds retry. FTS5 availability was checked on Bun 1.3.14;
117
+ the supported minimum Bun environment must also be exercised in CI before release.
118
+
119
+ Keep retrieval calls and results paired in the active turn and canonical trace.
120
+ Before historical candidate and byte budgeting, remove completed retrieval calls
121
+ and their matching results together. For mixed assistant entries retain text,
122
+ provider state where valid, and unrelated calls/results; do not drop whole
123
+ messages merely because one call is retrieval. Do not create dangling calls or
124
+ results, including after cancellation. Operator inspection retains original
125
+ records. Current visibility is checked for every retrieval page.
126
+
127
+ ## Compatibility and verification
128
+
129
+ No existing operator IDs or archive data change. Older strict configuration
130
+ readers reject saved configurations containing the new `timelineTools` key.
131
+ Tool names become reserved;
132
+ explicit enablement and policy determine offers. No cross-channel privacy is
133
+ introduced. Conformance covers both adapters with matching, ranking, caps and
134
+ Unicode; point reads, frozen window paging, reopen, migration and archive;
135
+ checked dispatch, cancellation and mixed historical exchanges; and a 10,000-entry
136
+ SQLite fixture asserting no snapshot or intervening-message scan for ID lookup.
137
+ A real-stdio scripted phase must prove search, read and attributed reply through
138
+ the production tool path. The contract is subject to independent approval before
139
+ runtime implementation.
140
+
141
+ Phrase occurrences overlap: "a a" matches twice in "a a a". A
142
+ candidate exactly equal to the remaining original-text budget is
143
+ verified. The trusted model-tool adapter requests an 8 KiB page under
144
+ the storage cap so complete serialized cursors fit the active inference
145
+ budget. Model arguments cannot raise that limit.
@@ -0,0 +1,173 @@
1
+ # 0031 — One-off reminder wire and commit rules
2
+
3
+ ## Problem and choice
4
+
5
+ A running harness needs one timer to queue durable work. A stopped harness
6
+ needs an authoritative deadline for its optional host supervisor. Reuse the
7
+ external-notice inbox and startup fence. Polling or a separate wake RPC would
8
+ start empty containers and could race offline cancellation. Routines and their
9
+ unattended guard have a separate gate.
10
+
11
+ ## Requests and records
12
+
13
+ Initialize advertises `capabilities.reminders: true` and `reminderLimits` in
14
+ the description: `{ minLeadMs:120000, minIntervalMs:600000,
15
+ maxActiveRoutinesPerChannel:0, minExpiryGraceMs:300000,
16
+ maxExpiryGraceMs:86400000, expiryMultiplier:2 }`. Zero disables routines.
17
+
18
+ Executable `session/create` and `session/open` accept `reminderChanges`.
19
+ Each entry is `{ reminderId, changeId, op, payload }`, with a positive safe
20
+ integer changeId. Strict payloads:
21
+
22
+ - create: `{ channel, schedule:{ at }, text, acceptedAt, policyNames?,
23
+ expiresAfter? }`.
24
+ - update: a nonempty patch of `text`, `state:"active"|"paused"`,
25
+ `schedule:{at}`, and `expiresAfter`; `acceptedAt` is required exactly when
26
+ schedule is supplied. Destination and original policies are immutable.
27
+ A grace-only edit uses the stored lead anchor.
28
+ - cancel: `{}`.
29
+
30
+ Host live writes use the same entries with `reminder/change`. Host reads use
31
+ `reminder/get { id }` and `reminder/list { channel?, after?, limit? }`.
32
+ Get returns `{ reminder }` or not_found; list returns `{ reminders, next? }`.
33
+ The open response includes `reminderChanges` outcomes and the same bounded
34
+ first list page under `reminders` and optional `remindersNext`. Inspect-only
35
+ open can list saved rows but supplies no wake authority. Lists order by
36
+ immutable creation sequence, default 50 and maximum 100. Cursors bind
37
+ session, optional channel, last sequence and reminder listing revision.
38
+ Any committed reminder row mutation invalidates prior cursors
39
+ (`invalid_cursor`); unrelated turns and identical replays do not.
40
+
41
+ A reminder has `id, channel, createdBy:"agent"|"host", creatorId?, policyNames,
42
+ schedule:{at}, text, state, nextRunAt, acceptedAt, expiresAfter, expiresAt`
43
+ and optional `lastRunAt, lastOccurrenceId, noticeId, blockedReason`.
44
+ States are active, paused, blocked, done, cancelled and expired. Only
45
+ active rows have nextRunAt. Absolute instants are UTC ISO strings and
46
+ stored as canonical millisecond ISO. The owning host supplies the original
47
+ acceptedAt for its delayed intent. Reject anchors more than 30 seconds
48
+ ahead of the harness clock. Allow historical anchors. Require at least
49
+ 120000 ms lead relative to that anchor, including on schedule edits.
50
+ Do not rebase on open or replay. Agent acceptance uses the harness clock.
51
+ Expiry is at plus expiresAfter (milliseconds); absent grace is twice lead,
52
+ clamped to 300000–86400000 ms, explicit grace is integral in that range,
53
+ and null means no expiry. At expiry equality the occurrence expires.
54
+ Pause or suspension holds the occurrence without extending expiry.
55
+
56
+ Agent tools reserve `schedule_reminder({schedule,text,expiresAfter?})`,
57
+ `list_reminders({after?,limit?})`, and `cancel_reminder({id})`. The schedule
58
+ is strictly `{at}` or `{in}` with a positive integer plus m/h/d. Convert
59
+ relative input once. Derive channel, creator and taken policy names.
60
+ Agent list and cancel are scoped to the calling channel. List cursors bind
61
+ that channel. An ID on another channel behaves like an unknown ID.
62
+ Creation returns `{id,nextRunAt}` and deduplicates by creating invocation
63
+ before resolving the relative time. Cancel returns `{id,alreadyQueued}`.
64
+ Use checked offered-tool admission and the ordinary permission gate.
65
+
66
+ ## Startup, replay and delivery
67
+
68
+ Each result is `{ reminderId, changeId, outcome:"applied"|"blocked",
69
+ reason?, reminder?, alreadyQueued? }`. Applied includes current row as of
70
+ that receipt. Block reasons are invalid_policy, channel_missing,
71
+ channel_retired, invalid_schedule, limit_exceeded, conflict, not_found,
72
+ stale and invalid_state. Validate both startup batch shapes before either
73
+ mutates. Cap reminder batches at 100. Compare the normalized request with
74
+ the receipt indexed by (reminderId, changeId) before checking high water.
75
+ Replay exact receipts, including blocked ones; changed arguments conflict.
76
+ An unseen lower version is stale. Retain receipts and high water for the
77
+ session lifetime. A new higher create with identical original definition
78
+ is applied; changed definition conflicts. Cancel of a terminal known row
79
+ is applied without changing its terminal state. Update of a terminal row
80
+ is blocked. A blocked invalid-policy reminder rechecks on explicit update
81
+ or resume against the active configuration.
82
+
83
+ Recover, apply channel changes, apply reminder changes in order, process
84
+ due work, return the open response, then release scheduling. The inspection
85
+ fence permits no writes or firing. A one-off commits its notice acceptance
86
+ and terminal advancement in one transaction; cancellation and firing order
87
+ by those commits. IDs are `reminder:<id>:<canonical-at>` for the occurrence
88
+ and `reminder-notice:<id>:<canonical-at>` for the external notice. Reuse
89
+ that pair after restart. Attribute the notice to the reminder and retain
90
+ origin policies. Unknown policy blocks; retirement cancels; suspension
91
+ holds. Expiry queues no notice. Startup takes one indexed batch of at most
92
+ 100 due rows, counting expired and blocked rows toward the same cap.
93
+ Open reports the earliest remaining eligible deadline even if already past
94
+ due, with its committed revision. Process subsequent batches after the open
95
+ fence releases, yielding between batches and re-arming when work remains.
96
+
97
+ Publish after commit: channel `reminder_changed { reminder }`,
98
+ `reminder_fired { reminderId, occurrenceId, scheduledAt, firedAt, noticeId }`,
99
+ `reminder_cancelled { reminderId, by:"host"|"agent"|"channel_retired" }`,
100
+ and `reminder_expired { reminderId, occurrenceId, scheduledAt, expiredAt }`.
101
+ A fired event means queued. Reconcile through saved rows and ordinary
102
+ inbox/turn reads rather than replaying historical events.
103
+
104
+ ## Deadline and stop
105
+
106
+ Executable open returns `nextDueAt: string|null` and
107
+ `reminderRevision: number`. Session event
108
+ `reminders_due { nextDueAt, revision }` uses the same wake revision.
109
+ Start at zero/null. Persist value and increment only when the earliest
110
+ eligible instant changes, in the same owner transaction as its cause.
111
+ Reconcile on recovery before returning executable open. Equal revision
112
+ with a different instant is a conflict; ignore older revisions. Only a
113
+ replacement session identity resets the fence. Paused, blocked and
114
+ suspended work has no wake deadline. Standalone owns one live timer and
115
+ has no automatic idle stop or cold wake. Derive delays from the current wall
116
+ clock. Clamp each timer wait to at most 60 seconds so long delays are chunked
117
+ below the platform limit and forward clock jumps are noticed on the next wake.
118
+ On every wake, recheck due eligibility against the current wall clock before
119
+ committing. An early wake or backward jump re-arms without firing. Cancel or
120
+ replace a previous timer on lifecycle or earliest-deadline changes. Test early
121
+ wakes, long waits and forward/backward jumps with an injected clock and timer.
122
+
123
+ `session/stop { ifIdle:true, unlessDueWithinMs? }` defaults the window
124
+ to zero (nonnegative safe milliseconds). It returns
125
+ `{stopped:true}` or `{stopped:false,reason:"busy"|"next_due_soon"}`.
126
+ Busy means running turns, runnable waiting inputs or pending approval.
127
+ An eligible deadline at or before now plus the window blocks stop.
128
+ Check and commit the stop fence synchronously under the same owner as
129
+ admission and reminder firing, then release the timer and notify.
130
+ An admission ordered first can prevent the stop; an admission ordered
131
+ after a successful stop cannot run. Empty params preserve unconditional
132
+ stop and its existing response.
133
+
134
+ ## Compatibility and verification
135
+
136
+ Keep SQLite format 6 until the first commit of reminder-specific durable
137
+ state, including a blocked change receipt. Open and read-only operations
138
+ leave the reminder format unchanged. Create reminder storage and set format 7
139
+ in the first-write transaction. Roll back both on failure, leaving no durable
140
+ reminder state. Earlier supported formats follow their existing upgrades to
141
+ format 6. Once activated, retain format 7 and receipts across reopen and
142
+ terminal outcomes. Older binaries reject format 7.
143
+
144
+ Keep the envelope unchanged. Use logical archive 5 for sessions without
145
+ reminder state or receipts. Archive 6 carries reminder records, receipts,
146
+ high water, and wake and list revisions. Validate before publication. Import
147
+ archive 5 into a fresh destination without activating format 7. Import archive
148
+ 6 atomically into a fresh format-7 destination. Refuse occupied destinations
149
+ and rebuild indexes from committed rows. Test first-write rollback, ordinary
150
+ format-6 reopen, blocked-receipt activation and both archive round trips. Verify memory/SQLite parity,
151
+ timer and cancellation races, atomic crash boundaries, bounded reads,
152
+ archive round trip, startup order, replay and revision conflicts, and
153
+ real stdio cold-wake acceptance per the plan. R-H3 covers the host
154
+ supervisor and its accepted missed-deadline crash window.
155
+
156
+ ## R8 coordination clarifications
157
+
158
+ Persist grace provenance internally. If a schedule edit omits expiresAfter,
159
+ recompute a previously defaulted grace and retain a previously explicit
160
+ duration or explicit null. A submitted override applies to the edited
161
+ schedule, or uses the saved lead anchor when only grace changes. Text and
162
+ state edits leave expiry intact. The public record shape is unchanged.
163
+
164
+ A receipt is the immutable observation made when the command committed.
165
+ Get and list are authoritative for current rows. The host may seed its
166
+ cache once from an applied receipt if this cannot overwrite a newer
167
+ observation. Correct a blocked create with a new reminder ID; discard
168
+ the old local pending entry. Updating a never-created ID is not_found.
169
+
170
+ Wire sessionId identifies the wake fence. A new ID or confirmed fresh
171
+ create after confirmed absence establishes replacement, even if the latter
172
+ reuses an ID. A lower revision or ambiguous acknowledgement is insufficient.
173
+ There is no separate incarnation field for an out-of-band same-ID replacement.
@@ -0,0 +1,148 @@
1
+ **We’re free to rewrite storage, contracts, or the loop.** My earlier statement described the benefit of separating responsibilities, not a restriction on changing them.
2
+
3
+ For now, I wouldn’t introduce a database: the in-memory store is enough to explore the context model. But its schema and operations are provisional. This is a good moment to revise them if the model calls for it.
4
+
5
+ Here’s the implementation as it stands.
6
+
7
+ **1. `start`: creates and runs the agent**
8
+
9
+ ```sh
10
+ bun run start
11
+ ```
12
+
13
+ `src/interfaces/cli/main.ts` dispatches to `start.ts`, which assembles:
14
+
15
+ - Configuration: system prompt, provider credentials, model, socket path.
16
+ - One `SharedContextStore`.
17
+ - One agent with per-channel execution queues.
18
+ - The model client and configured tools.
19
+ - The Unix-socket listener.
20
+ - The browser inspector.
21
+
22
+ `start.ts` owns the process-level assembly and shutdown.
23
+
24
+ **2. `chat`: connects a terminal client**
25
+
26
+ ```sh
27
+ bun run chat channel1 alice
28
+ ```
29
+
30
+ `chat.ts` reads terminal input and calls `sendLocal()`. Each request carries:
31
+
32
+ ```ts
33
+ { channelId, participantId, text }
34
+ ```
35
+
36
+ HTTP over the Unix socket delivers it to `serveLocal()`, which calls `agent.send()`.
37
+
38
+ The client doesn’t own conversation state. It can disconnect and reconnect while the agent stays alive.
39
+
40
+ **3. `createAgent`: accepts and schedules inputs**
41
+
42
+ `kernel/agent.ts`:
43
+
44
+ - Assigns a turn ID.
45
+ - Appends the incoming message to the shared store immediately.
46
+ - Queues execution within its channel.
47
+ - Allows different channels to execute concurrently.
48
+
49
+ Channels currently own scheduling state—not independent context arrays.
50
+
51
+ **4. `SharedContextStore`: owns the recorded information**
52
+
53
+ `state/storage/shared-context.ts` holds an append-only array of entries:
54
+
55
+ ```ts
56
+ {
57
+ seq,
58
+ at,
59
+ channelId,
60
+ turnId,
61
+ from,
62
+ message
63
+ }
64
+ ```
65
+
66
+ It provides `append()`, `snapshot()`, and `subscribe()`. Entries and snapshots are deep-copied. There is no database or persistence yet.
67
+
68
+ **5. `runTurn`: coordinates inference and tools**
69
+
70
+ Before every model call, `kernel/loop.ts` invokes `context.build()`.
71
+
72
+ The composition supplies two operations:
73
+
74
+ ```ts
75
+ context.build() // snapshot store and construct model messages
76
+ context.append(message) // record a response or tool result
77
+ ```
78
+
79
+ The loop continues through tool requests until the model returns no tool calls. Notices are not implemented yet.
80
+
81
+ **6. `buildContext`: constructs the inference view**
82
+
83
+ `capabilities/context/build.ts` currently produces:
84
+
85
+ ```text
86
+ System prompt, unchanged
87
+
88
+ Current channel and participant
89
+ Shared history from all other turns, as attributed JSON
90
+
91
+ Active turn’s messages, in native conversation format
92
+ ```
93
+
94
+ Tool definitions are supplied separately to the model client.
95
+
96
+ That presentation is intentionally basic. **There is one shared source of information, but a distinct rendered request for each active turn.** The builder currently moves other turns into a shared-history block rather than presenting one globally interleaved native conversation.
97
+
98
+ **7. Model, tools, and inspection**
99
+
100
+ - `openRouter()` translates neutral messages into the provider request.
101
+ - `executeCurrentTime()` implements the only configured tool.
102
+ - Inspection wrappers capture request bodies and execution status.
103
+ - The inspector derives channel histories from the store and streams updates through SSE.
104
+
105
+ So the overall flow is:
106
+
107
+ ```text
108
+ chat → local HTTP → agent.send → shared store → channel queue
109
+ ↓
110
+ buildContext ← store snapshot
111
+ ↓
112
+ model → tools
113
+ ↓
114
+ shared store
115
+ ```
116
+
117
+ **The main thing to evaluate next is the information model and its rendering—not which database to use.** Once those are right, we can decide whether the store needs different operations or a different implementation.
118
+
119
+
120
+
121
+
122
+
123
+ # instrucytion
124
+
125
+
126
+ ## process killing
127
+
128
+
129
+ Find the process using the socket:
130
+
131
+ ```sh
132
+ lsof -nP /tmp/native-harness-1000/agent.sock
133
+ ```
134
+
135
+ Then stop it using the PID shown:
136
+
137
+ ```sh
138
+ kill <PID>
139
+ ```
140
+
141
+ If no process is using it, it may be a stale socket file. Remove it and restart:
142
+
143
+ ```sh
144
+ rm /tmp/native-harness-1000/agent.sock
145
+ bun run start
146
+ ```
147
+
148
+ Avoid removing the socket while its process is still running.
@@ -0,0 +1,111 @@
1
+ # Native harness business rules
2
+
3
+ Updated: 2026-11-19.
4
+
5
+ This index records choices we might want to revisit, such as a default limit or
6
+ what to show a user when an operation is interrupted. Each entry links to the
7
+ spec that owns the behavior. Add the code location when the rule ships.
8
+
9
+ Keep adjustable values together in a named configuration or defaults module.
10
+ Give a behavioral choice a named decision at the boundary where it applies.
11
+ For example, retry eligibility belongs in the retry policy and the partial
12
+ reply rule belongs in stream finalization. A named decision can be changed and
13
+ tested independently. Expose a public setting when a consumer needs to choose.
14
+
15
+ ## Model execution
16
+
17
+ These rules are implemented from the
18
+ [model execution spec](model-execution/0001-DESIGN/SPEC.md).
19
+
20
+ | Rule | Current proposal | Why |
21
+ | --- | --- | --- |
22
+ | Retry budget | One automatic retry for a transient provider failure. | Recover from a brief failure while bounding additional latency and usage. |
23
+ | Retry after output | Close the retry window when the runner accepts its first nonempty text delta for publication or commits a response. Apply the same cutoff in both delivery modes. Privately buffered tool fragments can still establish Seen. | Prevent duplicate partial answers and keep execution independent of who subscribes. |
24
+ | Call timeout | 120 seconds for the model call, including the complete stream, retry wait, and retry. Tool execution and approval waits use separate limits. | Bound the wait for one call while letting a turn keep working across many iterations. |
25
+ | Retry delay | Wait one second before the single eligible retry, within the original deadline. | Give transient failures a brief recovery window without resetting the deadline. |
26
+ | Partial reply | Keep it visible locally as incomplete if the reply ends before commit. On reconnect, a committed reply with the same ID replaces the draft. | Preserve what the user saw and recover an answer committed before the connection failed. |
27
+ | Default text delivery | Send completed messages by default. Interactive clients can opt in to deltas. | Reduce event traffic for consumers that display whole messages. |
28
+ | Slow reader | Coalesce live deltas within a bounded buffer. Fall back to the committed reply when the reader falls behind. | Keep inference independent of live rendering speed. |
29
+ | Provider output limit | End the turn with `output_limit`, mark any streamed reply incomplete, and skip all tool requests in that response. | Avoid acting on a truncated response. |
30
+ | Retry during suspension | An eligible retry can finish the current call within its original deadline. | Let suspension finish the current iteration with a bounded wait. |
31
+
32
+ Implementation locations: retry budget, deadline and cutoff are in
33
+ `src/capabilities/model/runner.ts`; stream publication and reference decisions
34
+ are in `src/interfaces/protocol/server.ts` and `live-queue.ts`; durable call,
35
+ receipt and script-reservation transactions are in `src/state/storage/engine.ts`.
36
+ The stdio and in-process transports share the bounded live queue.
37
+
38
+ The spec owns execution contracts and invariants. Commit-before-dispatch, tool
39
+ result pairing, and fencing output after interruption stay defined there.
40
+
41
+ ## Tools and host callbacks
42
+
43
+ These rules are proposed in the
44
+ [tools and callbacks spec](tools-and-callbacks/0001-DESIGN/SPEC.md).
45
+
46
+ | Rule | Current proposal | Why |
47
+ | --- | --- | --- |
48
+ | Tool execution deadline | Use a per-tool deadline or an optional session default. When both are unset, there is no harness wall-clock deadline. | Tools have different durations, and approval and model waits already have separate boundaries. |
49
+ | Suspension during a tool call | Wait for the dispatched tool and show which call is holding suspension open. An operator can interrupt it. | Preserve the iteration checkpoint while keeping the wait visible and cancellable. |
50
+ | Large results | The producing process saves the full result and returns a preview and opaque ID. A scoped reader returns bounded portions to the producing channel. | Keep callback frames and model context bounded while preserving access to successful results across sandbox boundaries. |
51
+ | Tool visibility | Offer available tools whose effective policy is allow or ask. Omit denied and unavailable tools. Keep the offered list across retries of the same inference. | Keep the model's choices relevant and its retries consistent. |
52
+ | Runtime tool lifetime | Keep runtime selections in memory. The consumer supplies them on reconnect before execution starts. Preserve configured grant revocations across reopen and export/import. | Let the consumer restore temporary selections explicitly and preserve lasting access decisions. |
53
+ | Quiet callbacks | Show the active tool and phase start time. Use `session/status` to probe the connection. Native turn supervision leaves a quiet callback running under its own execution deadline and cancellation rules. | A responsive connection and a silent handler provide different information. |
54
+ | Temporary result retention | The producer owns retention and declares how long it can serve the bytes, including any restart or relocation guarantees. Report expiry explicitly and keep the original outcome. Choose inline and per-read bounds at the contract gate using the wire and model-context budgets. | Keep temporary storage and retrieval limits visible to consumers. |
55
+
56
+ ## Bounded context
57
+
58
+ Starting values for [decision 0026](../decisions/0026-bounded-context.md). Tune
59
+ them with captured requests and the long-session fixture.
60
+
61
+ | Rule | Initial default | Why |
62
+ | --- | --- | --- |
63
+ | Input admission | 8 KiB of normalized UTF-8 text per message or notice. | Gives clients an exact check and bounds one new input. |
64
+ | Input take | 8 KiB of text and 16 items per inference boundary. | Several messages can steer the same turn while keeping the next batch small. |
65
+ | Context storage read | 256 KiB of serialized records and 64 records. Scan at most 128 recent candidates for shared history. | Bound how much the builder loads even when the session is long. |
66
+ | Text request estimate | Default to a 16,384-token context target, clamped to a lower configured model ceiling. Reserve 2,048 tokens for output and 1,024 for estimation error. Estimate one token per UTF-8 byte of serialized model-visible text and tool definitions for the initial text-only build. | Keeps the starting estimator simple and deliberately conservative. Tune with observed usage before adding image accounting. |
67
+ | History allocation | Start with two thirds of the remaining budget for local history and one third for shared history. Either slice can use spare capacity from the other. | Preserve local conversation continuity on a busy shared session. |
68
+
69
+ Store adjustable defaults together in the context module at implementation.
70
+ Validate that one admitted item fits an empty intake batch and that the two
71
+ reserves leave a positive request input budget.
72
+
73
+ ## Operator and consumer controls
74
+
75
+ These defaults are proposed for the
76
+ [operator controls spec](operator-controls/0001-DESIGN/SPEC.md).
77
+
78
+ | Rule | Current proposal | Why |
79
+ | --- | --- | --- |
80
+ | Transcript history on open | Harness history fetching is opt-in. Opening the agent or attaching to a channel fetches no transcript pages unless the consumer requests them. A chat UI can request the newest page automatically when the harness is its transcript source. A consumer using its own transcript can skip the history request. | Keep startup independent of transcript size and avoid retrieving a second copy of history. |
81
+ | Conversation page size | Default to 50 committed chat messages when a consumer requests a conversation page. Accept a caller-supplied limit within wire bounds. Tool activity does not consume the message count. | Match acp-client's existing conversation page default and keep pages useful in tool-heavy conversations. |
82
+
83
+ Forward catch-up is an explicit history request. Live subscription and
84
+ targeted reconciliation for tracked inputs or turns are independent of it.
85
+
86
+ ## Tools and host callbacks
87
+
88
+ These rules are implemented from the
89
+ [tools and callbacks spec](tools-and-callbacks/0001-DESIGN/SPEC.md) and
90
+ [decision 0021](../decisions/0021-tools-and-host-callbacks.md).
91
+
92
+ | Rule | Current choice | Why | Code |
93
+ | --- | --- | --- | --- |
94
+ | Tool execution deadline | None unless the tool (`deadlineMs`) or the session (`defaultDeadlineMs`) sets one. The tool's value wins. | A host function can legitimately run for a long time. A consumer that wants a bound says so. | `runFunction` in `src/capabilities/tools/functions.ts` |
95
+ | Deadline expiry | Cancel, commit one paired `tool_timeout` result with unknown effect, continue the turn. | The model can react. The effect is not assumed either way. | Same |
96
+ | Inline result limit | 16384 bytes of serialized output. More must come as a preview and a reference. Inline bytes over the limit fail as `result_too_large`. | Keeps a callback response well inside one frame and the context small. | `TOOL_LIMITS.inlineBytes` |
97
+ | Preview size | At most 1024 bytes, cut by the harness if longer. | Enough to judge whether to read more. | `TOOL_LIMITS.previewBytes` |
98
+ | Result read size | At most 16384 bytes per `read_tool_result` call. | Same bound as an inline result. | `TOOL_LIMITS.readBytes` |
99
+ | Result access | Only the channel that produced a result can read it. | A result ID seen in shared history must not grant access. | `readResult` |
100
+ | Offered order | Built-ins, fixed entries by name, `read_tool_result`, then changeable entries by name. | A stable prefix for providers that cache it. | `offer` in `src/index.ts` |
101
+ | Skipped built-in calls | Emit no `tool_call` event, as before. Catalog tools emit `skipped`. | Existing consumers see no new event for existing tools. | `recordSkip` in `src/index.ts` |
102
+
103
+ ### Timeline retrieval limits
104
+
105
+ A search accepts 1024 query bytes, 32 tokens and 256 bytes per exact or
106
+ folded token. It verifies up to 1000 candidates and 2 MiB of source text.
107
+ The hit cap is 20 and excerpts use at most 512 UTF-8 bytes. A point read
108
+ accepts up to 20 neighbors on each side and returns at most 20 fragments
109
+ per page. Storage output is capped at 32 KiB of JSON. The model-tool
110
+ adapter requests at most 8 KiB so paged JSON and its cursor can fit in
111
+ active inference without the generic tool-result string shortening.
@@ -0,0 +1,65 @@
1
+ # Native harness work
2
+
3
+ Updated: 2026-11-20.
4
+
5
+ The coordinator updates this index when a work item's status, dependency, or next
6
+ action changes. Implementers and reviewers record revisions, findings, and test
7
+ results in the work item's log. An accepted design keeps its own row when a later
8
+ amendment is proposed.
9
+
10
+ | Work item | Status | Dependency and next action |
11
+ | --- | --- | --- |
12
+ | [Persistence baseline](11-16-persistence/SPEC.md) | Accepted | Behavior approved at `9d9de35`, with [closure notes](11-16-persistence/LOG.md) at `3a236ac` on `aiagent/native-persistence`. |
13
+ | [Persistence 0002 · Session-file amendment](persistence/0002-AMENDMENT-session-file/SPEC.md) | Accepted | Behavior approved at `7e49bd5` on `aiagent/cod1a-session-file`. Managed reopen is part of configuration and permissions. |
14
+ | [Channel controls](11-19-channel-controls/SPEC.md) | Accepted | Behavior approved at `4d58629`, with closure and documentation at `3428258` on `aiagent/cod1a-native-channel-controls`. |
15
+ | [Configuration and permissions](11-19-config-permissions/SPEC.md) | Accepted | Behavior approved at `626783e`, with closure at `28c6faf` on `aiagent/cod1a-config-permissions`. |
16
+ | [Model execution](model-execution/0001-DESIGN/SPEC.md) | Accepted | Behavior approved at `02c96de`, with closure at `49f2974` on `aiagent/cod1a-model-execution`. |
17
+ | [Model execution 0002 · Accounting](model-execution/0002-AMENDMENT-accounting/SPEC.md) | Draft for review | Ground against the final R5 revision before contract approval. Cod1a and Clad1a are the proposed draft and review owners when scheduled. |
18
+ | [acp-client integration contract](acp-client-integration/0001-DESIGN/SPEC.md) | Accepted | Behavior approved at `7133c5c`; `acp-client-integration` includes the corrected [closure log](acp-client-integration/0001-DESIGN/11-20-LOG.md) at `b9a96b8`. |
19
+ | [Tools and host callbacks](tools-and-callbacks/0001-DESIGN/SPEC.md) | Accepted | Behavior approved at `f4eff94`, with the [closure log](tools-and-callbacks/0001-DESIGN/LOG.md) at `c1c3e88` on `tools-and-callbacks`. |
20
+ | [Tools and callbacks 0002 · Callback policy names](tools-and-callbacks/0002-AMENDMENT-callback-policy/SPEC.md) | Accepted | Behavior approved at `aca1fe5`, closure at `4056d79`, integrated into `aiagent/haurness-l`. Orchestrator worker-rule acceptance remains separate. |
21
+ | [Operator and consumer controls](operator-controls/0001-DESIGN/SPEC.md) | Accepted | Behavior approved at `95670a2`, closure at `8f2a139`, merged into `aiagent/haurness-l` at `da59a6c`. |
22
+ | [Long-running mock mode](long-running-mock/0001-DESIGN/SPEC.md) | Accepted | Behavior approved at `e13b405`, closure at `448521f`, integrated into `aiagent/haurness-l`. |
23
+ | [Channel messaging 0001 · External notices](channel-messaging/0001-DESIGN-external-notices/SPEC.md) | Generic Gate 2 accepted | Generic behavior approved at `f522072`, closure at `713a76a`. Worker delivery must prove recovery from a committed final ACP worker record and the uncertainty fallback. |
24
+ | [Web tools 0001 · Search and page fetching](web-tools/0001-DESIGN/SPEC.md) | Proposed for M2 | Define the rest of the initial tool set before starting implementation. |
25
+ | [Shell execution 0001 · Shell tool](shell-execution/0001-DESIGN/SPEC.md) | Proposed for M2 | Define the rest of the initial tool set first. Foreground execution precedes runner-managed background jobs. |
26
+ | [Timeline retrieval 0001 · Search and read](timeline-retrieval/0001-DESIGN/SPEC.md) | Proposed for M2 | Build alongside bounded context with shared visibility across native channels in v1. |
27
+ | [Bounded context 0001 · Inference context](bounded-context/0001-DESIGN/SPEC.md) | Gate 1 drafted | Review [decision 0026](../decisions/0026-bounded-context.md) before bounded storage reads in Gate 2. |
28
+ | [Attachments 0001 · Files and image input](attachments/0001-DESIGN/SPEC.md) | Proposed for v1 | Start with managed files and image input. Add the consumer-managed adapter on the same contract. |
29
+ | [Tools and callbacks 0003 · Attachment tools](tools-and-callbacks/0003-DESIGN-attachment-tools/SPEC.md) | Proposed for v1 | `copy_attachment` and `share_attachment` build on the attachment store, tool lifecycle, and shell runner. |
30
+
31
+ ## Priorities
32
+
33
+ First, give acp-client a harness it can develop and test against offline:
34
+
35
+ The [M1 implementation sequence](todos/11-22-TODO-harness-m1-sequence.md) records
36
+ the serial handoff order, including the orchestrator-facing amendments.
37
+
38
+ 1. Prove final-record recovery and the uncertainty fallback for [external notices](channel-messaging/0001-DESIGN-external-notices/PLAN.md) Gates 3/4.
39
+
40
+ The integration checkpoint is a real stdio run from acp-client with two
41
+ conversations on one session, a host tool callback, an approval, interruption
42
+ isolated to one channel, and recovery after restart. A short scripted test
43
+ can start before the long-running mock mode is complete.
44
+
45
+ The orchestrator needs the callback policy amendment and external notices.
46
+ External notices are the first channel-messaging slice.
47
+
48
+ After the checkpoint, build bounded context and image input, and test whether
49
+ the existing cross-channel notice path meets v1 needs. V1 offers no
50
+ cross-channel privacy guarantee. Shared identity for external conversations
51
+ is deferred.
52
+ Skills, MCP, and the broader standalone CLI follow the integration work.
53
+ Skills are the preferred first follow-up among those three.
54
+
55
+ [Node-level resource coordination](todos/11-21-TODO-node-resource-coordination.md)
56
+ is a deferred optimization after the usable-harness milestone and profiling.
57
+
58
+ New work is organized by concern. Use the next visible number in that concern
59
+ for a `DESIGN`, `AMENDMENT`, or small `MODIFICATIONS` item. Keep dates in
60
+ document headers and timestamps in log entries. Existing dated work folders
61
+ can move at a clean handoff.
62
+
63
+ [Deferred ideas](todos/) can stay there until they become numbered work items.
64
+ [Business rules](BUSINESS_RULES.md) track adjustable defaults and behavioral
65
+ tradeoffs alongside the specs that own them.