@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.
Files changed (343) hide show
  1. package/CONSUMER_GUIDE.md +181 -8
  2. package/MIGRATION-0.12-to-0.13.md +20 -7
  3. package/package.json +13 -2
  4. package/src/agent/config.ts +2 -0
  5. package/src/agent/conversation-manager.ts +1 -0
  6. package/src/agent/native-operations.ts +40 -0
  7. package/src/agent-session-config.ts +2 -0
  8. package/src/agent-session.ts +12 -2
  9. package/src/agent.ts +100 -2
  10. package/src/client.ts +5 -3
  11. package/src/controller-connection.ts +1 -0
  12. package/src/controller.ts +2 -0
  13. package/src/index.ts +3 -0
  14. package/src/launcher.ts +2 -0
  15. package/src/native/approvals.ts +20 -3
  16. package/src/native/capabilities.ts +2 -2
  17. package/src/native/connection.ts +1 -1
  18. package/src/native/controller.ts +5 -3
  19. package/src/native/host-config.ts +2 -0
  20. package/src/native/host.ts +83 -4
  21. package/src/native/mcp.ts +47 -0
  22. package/src/native/recovery.ts +8 -7
  23. package/src/native/reminders/routine-guard.ts +4 -3
  24. package/src/native/reminders/routine-wire.ts +1 -1
  25. package/src/native-harness/README.md +58 -1
  26. package/src/native-harness/package.json +4 -0
  27. package/src/native-harness/scripts/build-routine-zones.py +47 -0
  28. package/src/native-harness/src/capabilities/attachments/admission.ts +42 -0
  29. package/src/native-harness/src/capabilities/attachments/image-validation.ts +98 -0
  30. package/src/native-harness/src/capabilities/attachments/input.ts +1 -0
  31. package/src/native-harness/src/capabilities/attachments/read.ts +76 -0
  32. package/src/native-harness/src/capabilities/attachments/recovery.ts +26 -0
  33. package/src/native-harness/src/capabilities/attachments/selection.ts +37 -0
  34. package/src/native-harness/src/capabilities/attachments/service.ts +75 -0
  35. package/src/native-harness/src/capabilities/attachments/upload.ts +164 -0
  36. package/src/native-harness/src/capabilities/attachments/vision.ts +45 -0
  37. package/src/native-harness/src/capabilities/context/build.ts +5 -0
  38. package/src/native-harness/src/capabilities/context/session.ts +2 -1
  39. package/src/native-harness/src/capabilities/model/openrouter-stream.ts +80 -17
  40. package/src/native-harness/src/capabilities/model/runner.ts +6 -3
  41. package/src/native-harness/src/capabilities/reminders/cron-calendar.ts +50 -0
  42. package/src/native-harness/src/capabilities/reminders/cron-fields.ts +46 -0
  43. package/src/native-harness/src/capabilities/reminders/cron-proof.ts +32 -0
  44. package/src/native-harness/src/capabilities/reminders/cron-zone.ts +53 -0
  45. package/src/native-harness/src/capabilities/reminders/iana-zones.json.gz +0 -0
  46. package/src/native-harness/src/capabilities/reminders/iana-zones.ts +34 -0
  47. package/src/native-harness/src/capabilities/reminders/interval.ts +30 -0
  48. package/src/native-harness/src/capabilities/reminders/routine-advance.ts +47 -0
  49. package/src/native-harness/src/capabilities/reminders/routine-backlog.ts +47 -0
  50. package/src/native-harness/src/capabilities/reminders/routine-expiry.ts +15 -0
  51. package/src/native-harness/src/capabilities/reminders/routine-occurrence.ts +65 -0
  52. package/src/native-harness/src/capabilities/reminders/routine-schedule.ts +70 -0
  53. package/src/native-harness/src/capabilities/reminders/unattended.ts +8 -0
  54. package/src/native-harness/src/capabilities/tools/mcp/client.ts +97 -0
  55. package/src/native-harness/src/capabilities/tools/mcp/http.ts +183 -0
  56. package/src/native-harness/src/capabilities/tools/mcp/registry.ts +62 -0
  57. package/src/native-harness/src/capabilities/tools/mcp/result.ts +33 -0
  58. package/src/native-harness/src/capabilities/tools/mcp/schema.ts +77 -0
  59. package/src/native-harness/src/capabilities/tools/mcp/secrets.ts +28 -0
  60. package/src/native-harness/src/capabilities/tools/mcp/stdio.ts +105 -0
  61. package/src/native-harness/src/capabilities/tools/reminders/index.ts +27 -5
  62. package/src/native-harness/src/capabilities/tools/runtime/invocations.ts +4 -1
  63. package/src/native-harness/src/capabilities/tools/web/config.ts +1 -0
  64. package/src/native-harness/src/capabilities/tools/web/definitions.ts +18 -0
  65. package/src/native-harness/src/capabilities/tools/web/direct-address.ts +56 -0
  66. package/src/native-harness/src/capabilities/tools/web/direct-transport.ts +235 -0
  67. package/src/native-harness/src/capabilities/tools/web/direct.ts +149 -0
  68. package/src/native-harness/src/capabilities/tools/web/exa-transport.ts +41 -0
  69. package/src/native-harness/src/capabilities/tools/web/exa.ts +71 -0
  70. package/src/native-harness/src/capabilities/tools/web/preview.ts +44 -0
  71. package/src/native-harness/src/capabilities/tools/web/registry.ts +47 -0
  72. package/src/native-harness/src/capabilities/tools/web/usage.ts +1 -0
  73. package/src/native-harness/src/contracts/agent.ts +3 -1
  74. package/src/native-harness/src/contracts/attachments.ts +62 -0
  75. package/src/native-harness/src/contracts/config-permissions.ts +14 -3
  76. package/src/native-harness/src/contracts/context.ts +1 -1
  77. package/src/native-harness/src/contracts/events.ts +2 -2
  78. package/src/native-harness/src/contracts/loop.ts +3 -3
  79. package/src/native-harness/src/contracts/mcp.ts +22 -0
  80. package/src/native-harness/src/contracts/model-execution.ts +2 -1
  81. package/src/native-harness/src/contracts/operator-controls.ts +8 -1
  82. package/src/native-harness/src/contracts/protocol.ts +21 -5
  83. package/src/native-harness/src/contracts/reminders.ts +4 -2
  84. package/src/native-harness/src/contracts/routines.ts +20 -0
  85. package/src/native-harness/src/contracts/session-file.ts +2 -0
  86. package/src/native-harness/src/contracts/session.ts +8 -3
  87. package/src/native-harness/src/contracts/storage.ts +32 -13
  88. package/src/native-harness/src/contracts/tools.ts +2 -0
  89. package/src/native-harness/src/contracts/web.ts +16 -0
  90. package/src/native-harness/src/governance/permissions/gate.ts +9 -2
  91. package/src/native-harness/src/governance/policy/resolve.ts +6 -1
  92. package/src/native-harness/src/index.ts +48 -12
  93. package/src/native-harness/src/interfaces/cli/development.ts +108 -53
  94. package/src/native-harness/src/interfaces/cli/serve.ts +2 -2
  95. package/src/native-harness/src/interfaces/cli/start.ts +22 -13
  96. package/src/native-harness/src/interfaces/client.ts +8 -2
  97. package/src/native-harness/src/interfaces/inspector/index.html +7 -1
  98. package/src/native-harness/src/interfaces/inspector/state.ts +6 -2
  99. package/src/native-harness/src/interfaces/protocol/load.ts +3 -1
  100. package/src/native-harness/src/interfaces/protocol/local.ts +13 -4
  101. package/src/native-harness/src/interfaces/protocol/operator.ts +8 -2
  102. package/src/native-harness/src/interfaces/protocol/server.ts +102 -36
  103. package/src/native-harness/src/interfaces/protocol/stdio-client.ts +8 -0
  104. package/src/native-harness/src/interfaces/web-chat/index.html +65 -12
  105. package/src/native-harness/src/interfaces/web-chat/server.ts +30 -3
  106. package/src/native-harness/src/kernel/channels.ts +27 -15
  107. package/src/native-harness/src/kernel/loop.ts +1 -1
  108. package/src/native-harness/src/runtime/config/inference-key.ts +7 -0
  109. package/src/native-harness/src/runtime/config/managed.ts +1 -1
  110. package/src/native-harness/src/runtime/config/paths.ts +8 -1
  111. package/src/native-harness/src/runtime/execution/mcp-stdio.ts +31 -0
  112. package/src/native-harness/src/runtime/reminder-validation.ts +31 -10
  113. package/src/native-harness/src/runtime/reminders.ts +2 -2
  114. package/src/native-harness/src/state/storage/archive.ts +113 -12
  115. package/src/native-harness/src/state/storage/attachment-files.ts +58 -0
  116. package/src/native-harness/src/state/storage/attachment-import.ts +106 -0
  117. package/src/native-harness/src/state/storage/attachment-tables.ts +123 -0
  118. package/src/native-harness/src/state/storage/engine.ts +396 -45
  119. package/src/native-harness/src/state/storage/inference.ts +30 -2
  120. package/src/native-harness/src/state/storage/memory-attachments.ts +56 -0
  121. package/src/native-harness/src/state/storage/memory-reminders.ts +31 -6
  122. package/src/native-harness/src/state/storage/memory.ts +32 -4
  123. package/src/native-harness/src/state/storage/reminder-archive.ts +53 -12
  124. package/src/native-harness/src/state/storage/reminder-change.ts +60 -14
  125. package/src/native-harness/src/state/storage/reminder-tables.ts +11 -3
  126. package/src/native-harness/src/state/storage/routine-row.ts +25 -0
  127. package/src/native-harness/src/state/storage/session-file.ts +22 -9
  128. package/src/native-harness/src/state/storage/sqlite-reminders.ts +48 -8
  129. package/src/native-harness/src/state/storage/sqlite.ts +59 -11
  130. package/src/native-harness/src/state/storage/web-tables.ts +47 -0
  131. package/src/native-harness/src/testing.ts +151 -56
  132. package/src/native-harness/src/util/attachment-input.ts +42 -0
  133. package/src/native-harness/src/util/config.ts +64 -9
  134. package/src/native-harness/src/util/intake.ts +7 -0
  135. package/src/native-harness/src/util/mcp-config.ts +102 -0
  136. package/src/native-harness/src/util/web-config.ts +34 -0
  137. package/src/native-harness/src/util/web-usage.ts +33 -0
  138. package/src/orchestrator/permissions.ts +6 -3
  139. package/src/permissions/conversation.ts +13 -5
  140. package/src/permissions/matcher.ts +2 -0
  141. package/src/permissions/outcome.ts +12 -1
  142. package/src/permissions/policy.ts +13 -8
  143. package/src/steering/combine.ts +1 -0
  144. package/src/steering/contracts.ts +3 -0
  145. package/src/terminals.ts +9 -6
  146. package/src/native/reminders/reminders.test.ts +0 -553
  147. package/src/native/reminders/routine-config.typecheck.ts +0 -13
  148. package/src/native/reminders/wire.typecheck.ts +0 -13
  149. package/src/native-harness/.res/README.md +0 -1
  150. package/src/native-harness/.res/architecture/README.md +0 -21
  151. package/src/native-harness/.res/architecture/context-and-data.md +0 -31
  152. package/src/native-harness/.res/architecture/execution.md +0 -42
  153. package/src/native-harness/.res/architecture/overview.md +0 -44
  154. package/src/native-harness/.res/architecture/persistence.md +0 -56
  155. package/src/native-harness/.res/architecture/suspend-and-resume.md +0 -45
  156. package/src/native-harness/.res/architecture/technical-architecture.md +0 -50
  157. package/src/native-harness/.res/decisions/0001-basic-loop.md +0 -11
  158. package/src/native-harness/.res/decisions/0002-channel-input.md +0 -17
  159. package/src/native-harness/.res/decisions/0003-inference-inspection.md +0 -14
  160. package/src/native-harness/.res/decisions/0004-shared-context.md +0 -21
  161. package/src/native-harness/.res/decisions/0005-notice-inbox.md +0 -20
  162. package/src/native-harness/.res/decisions/0006-explicit-notices.md +0 -12
  163. package/src/native-harness/.res/decisions/0007-channel-output.md +0 -12
  164. package/src/native-harness/.res/decisions/0008-browser-client.md +0 -16
  165. package/src/native-harness/.res/decisions/0009-scripted-model.md +0 -18
  166. package/src/native-harness/.res/decisions/0010-inprocess-protocol.md +0 -19
  167. package/src/native-harness/.res/decisions/0011-stdio-transport.md +0 -21
  168. package/src/native-harness/.res/decisions/0012-session-storage-contract.md +0 -37
  169. package/src/native-harness/.res/decisions/0013-durable-delivery-contract.md +0 -64
  170. package/src/native-harness/.res/decisions/0014-channel-controls-contract.md +0 -73
  171. package/src/native-harness/.res/decisions/0015-session-file-contract.md +0 -72
  172. package/src/native-harness/.res/decisions/0016-configuration-permissions.md +0 -159
  173. package/src/native-harness/.res/decisions/0017-openrouter-managed-config.md +0 -69
  174. package/src/native-harness/.res/decisions/0018-tool-dispatch-evidence.md +0 -78
  175. package/src/native-harness/.res/decisions/0019-model-execution.md +0 -188
  176. package/src/native-harness/.res/decisions/0020-startup-channel-changes.md +0 -71
  177. package/src/native-harness/.res/decisions/0021-tools-and-host-callbacks.md +0 -100
  178. package/src/native-harness/.res/decisions/0022-operator-controls.md +0 -115
  179. package/src/native-harness/.res/decisions/0023-long-running-mock.md +0 -82
  180. package/src/native-harness/.res/decisions/0024-callback-policy-names.md +0 -46
  181. package/src/native-harness/.res/decisions/0025-external-notices.md +0 -364
  182. package/src/native-harness/.res/decisions/0026-bounded-context.md +0 -81
  183. package/src/native-harness/.res/decisions/0027-development-instructions.md +0 -22
  184. package/src/native-harness/.res/decisions/0028-debug-tools.md +0 -16
  185. package/src/native-harness/.res/decisions/0029-bounded-model-call-pages.md +0 -37
  186. package/src/native-harness/.res/decisions/0030-timeline-retrieval.md +0 -145
  187. package/src/native-harness/.res/decisions/0031-one-off-reminders.md +0 -173
  188. package/src/native-harness/.res/docs/11-15.md +0 -148
  189. package/src/native-harness/.res/docs/BUSINESS_RULES.md +0 -111
  190. package/src/native-harness/.res/docs/WORK.md +0 -65
  191. package/src/native-harness/.res/docs/_/11-16-persistence/LOG.md +0 -312
  192. package/src/native-harness/.res/docs/_/11-16-persistence/PLAN.md +0 -77
  193. package/src/native-harness/.res/docs/_/11-16-persistence/SPEC.md +0 -313
  194. package/src/native-harness/.res/docs/_/11-19-channel-controls/LOG.md +0 -160
  195. package/src/native-harness/.res/docs/_/11-19-channel-controls/PLAN.md +0 -89
  196. package/src/native-harness/.res/docs/_/11-19-channel-controls/SPEC.md +0 -135
  197. package/src/native-harness/.res/docs/_/11-19-config-permissions/LOG.md +0 -143
  198. package/src/native-harness/.res/docs/_/11-19-config-permissions/PLAN.md +0 -93
  199. package/src/native-harness/.res/docs/_/11-19-config-permissions/SPEC.md +0 -181
  200. package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/11-20-LOG.md +0 -433
  201. package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/PLAN.md +0 -60
  202. package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/PROTOCOL.md +0 -141
  203. package/src/native-harness/.res/docs/acp-client-integration/0001-DESIGN/SPEC.md +0 -168
  204. package/src/native-harness/.res/docs/attachments/0001-DESIGN/SPEC.md +0 -111
  205. package/src/native-harness/.res/docs/bounded-context/0001-DESIGN/PLAN.md +0 -129
  206. package/src/native-harness/.res/docs/bounded-context/0001-DESIGN/SPEC.md +0 -135
  207. package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/LOG.md +0 -437
  208. package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/PLAN.md +0 -127
  209. package/src/native-harness/.res/docs/channel-messaging/0001-DESIGN-external-notices/SPEC.md +0 -203
  210. package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/LOG.md +0 -292
  211. package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/PLAN.md +0 -91
  212. package/src/native-harness/.res/docs/long-running-mock/0001-DESIGN/SPEC.md +0 -187
  213. package/src/native-harness/.res/docs/model-execution/0001-DESIGN/LOG.md +0 -148
  214. package/src/native-harness/.res/docs/model-execution/0001-DESIGN/PLAN.md +0 -95
  215. package/src/native-harness/.res/docs/model-execution/0001-DESIGN/SPEC.md +0 -200
  216. package/src/native-harness/.res/docs/model-execution/0002-AMENDMENT-accounting/SPEC.md +0 -80
  217. package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/LOG.md +0 -206
  218. package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/PLAN.md +0 -106
  219. package/src/native-harness/.res/docs/operator-controls/0001-DESIGN/SPEC.md +0 -297
  220. package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/LOG.md +0 -41
  221. package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/PLAN.md +0 -36
  222. package/src/native-harness/.res/docs/persistence/0002-AMENDMENT-session-file/SPEC.md +0 -84
  223. package/src/native-harness/.res/docs/shell-execution/0001-DESIGN/SPEC.md +0 -147
  224. package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/LOG.md +0 -15
  225. package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/PLAN.md +0 -107
  226. package/src/native-harness/.res/docs/timeline-retrieval/0001-DESIGN/SPEC.md +0 -114
  227. package/src/native-harness/.res/docs/todos/11-19-TODO-auto_review-approve.md +0 -24
  228. package/src/native-harness/.res/docs/todos/11-20-TODO-user-entered-tool-code.md +0 -23
  229. package/src/native-harness/.res/docs/todos/11-21-TODO-node-resource-coordination.md +0 -103
  230. package/src/native-harness/.res/docs/todos/11-22-TODO-harness-m1-sequence.md +0 -50
  231. package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/LOG.md +0 -337
  232. package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/PLAN.md +0 -76
  233. package/src/native-harness/.res/docs/tools-and-callbacks/0001-DESIGN/SPEC.md +0 -204
  234. package/src/native-harness/.res/docs/tools-and-callbacks/0002-AMENDMENT-callback-policy/LOG.md +0 -73
  235. package/src/native-harness/.res/docs/tools-and-callbacks/0002-AMENDMENT-callback-policy/SPEC.md +0 -64
  236. package/src/native-harness/.res/docs/tools-and-callbacks/0003-DESIGN-attachment-tools/SPEC.md +0 -58
  237. package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/LOG.md +0 -45
  238. package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/PLAN.md +0 -108
  239. package/src/native-harness/.res/docs/tools-and-callbacks/0004-DESIGN-reminder-tools/SPEC.md +0 -169
  240. package/src/native-harness/.res/docs/web-tools/0001-DESIGN/SPEC.md +0 -128
  241. package/src/native-harness/.res/marketing-draft.md +0 -22
  242. package/src/native-harness/.res/sandbox/1-simple-harness/README.md +0 -285
  243. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-1.md +0 -19
  244. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-10.md +0 -138
  245. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-11.md +0 -148
  246. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-12.md +0 -172
  247. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-13.md +0 -194
  248. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-14.md +0 -233
  249. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-15.md +0 -249
  250. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-16.md +0 -265
  251. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-17.md +0 -279
  252. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-18.md +0 -293
  253. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-19.md +0 -307
  254. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-2.md +0 -29
  255. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-20.md +0 -317
  256. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-21.md +0 -327
  257. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-3.md +0 -40
  258. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-4.md +0 -59
  259. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-5.md +0 -69
  260. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-6.md +0 -79
  261. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-7.md +0 -89
  262. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-8.md +0 -102
  263. package/src/native-harness/.res/sandbox/1-simple-harness/conversation/context-9.md +0 -116
  264. package/src/native-harness/.res/sandbox/1-simple-harness/conversation.jsonl +0 -49
  265. package/src/native-harness/.res/sandbox/1-simple-harness/doc.md +0 -87
  266. package/src/native-harness/.res/sandbox/1-simple-harness/harness.py +0 -289
  267. package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy 2.py +0 -221
  268. package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy 3.py +0 -287
  269. package/src/native-harness/.res/sandbox/1-simple-harness/local/harness copy.py +0 -165
  270. package/src/native-harness/.res/sandbox/1-simple-harness/state.json +0 -22
  271. package/src/native-harness/.res/sandbox/1-simple-harness/system-prompt.md +0 -2
  272. package/src/native-harness/AGENTS.md +0 -70
  273. package/src/native-harness/ARCHITECTURE.md +0 -249
  274. package/src/native-harness/bun.lock +0 -26
  275. package/src/native-harness/test/agent.test.ts +0 -130
  276. package/src/native-harness/test/approval-gate.test.ts +0 -255
  277. package/src/native-harness/test/approval-protocol.test.ts +0 -94
  278. package/src/native-harness/test/boundaries.test.ts +0 -18
  279. package/src/native-harness/test/channel-controls.test.ts +0 -322
  280. package/src/native-harness/test/client-abort.test.ts +0 -136
  281. package/src/native-harness/test/config-policy.test.ts +0 -301
  282. package/src/native-harness/test/conformance/storage.ts +0 -1141
  283. package/src/native-harness/test/context.test.ts +0 -177
  284. package/src/native-harness/test/crash.test.ts +0 -187
  285. package/src/native-harness/test/debug-tools.test.ts +0 -67
  286. package/src/native-harness/test/development-cli.test.ts +0 -67
  287. package/src/native-harness/test/development.test.ts +0 -171
  288. package/src/native-harness/test/dispatch-evidence.test.ts +0 -58
  289. package/src/native-harness/test/e2e.test.ts +0 -186
  290. package/src/native-harness/test/external-notices.test.ts +0 -101
  291. package/src/native-harness/test/fixtures/approval-e2e.jsonl +0 -4
  292. package/src/native-harness/test/fixtures/crash-scenario.jsonl +0 -5
  293. package/src/native-harness/test/fixtures/development-lifecycle.jsonl +0 -10
  294. package/src/native-harness/test/fixtures/echo-scenario.jsonl +0 -3
  295. package/src/native-harness/test/fixtures/format2-schema.ts +0 -27
  296. package/src/native-harness/test/fixtures/format3-schema.ts +0 -16
  297. package/src/native-harness/test/fixtures/hold-scenario.jsonl +0 -4
  298. package/src/native-harness/test/fixtures/model-e2e.jsonl +0 -3
  299. package/src/native-harness/test/fixtures/storage-owner.ts +0 -20
  300. package/src/native-harness/test/format-reply.test.ts +0 -10
  301. package/src/native-harness/test/helpers/operator-view.ts +0 -41
  302. package/src/native-harness/test/helpers/scenario.ts +0 -9
  303. package/src/native-harness/test/helpers/session.ts +0 -38
  304. package/src/native-harness/test/helpers/stdio.ts +0 -46
  305. package/src/native-harness/test/inspector.test.ts +0 -77
  306. package/src/native-harness/test/listeners.test.ts +0 -49
  307. package/src/native-harness/test/loop.test.ts +0 -88
  308. package/src/native-harness/test/model-channel-double.test.ts +0 -87
  309. package/src/native-harness/test/model-crash.test.ts +0 -62
  310. package/src/native-harness/test/model-delivery-regressions.test.ts +0 -55
  311. package/src/native-harness/test/model-e2e.test.ts +0 -71
  312. package/src/native-harness/test/model-final-filter.test.ts +0 -30
  313. package/src/native-harness/test/model-large-reply.test.ts +0 -28
  314. package/src/native-harness/test/model-live-queue.test.ts +0 -33
  315. package/src/native-harness/test/model-runner.test.ts +0 -117
  316. package/src/native-harness/test/model-storage.test.ts +0 -99
  317. package/src/native-harness/test/model-stream-adapter.test.ts +0 -26
  318. package/src/native-harness/test/model-stream-public.test.ts +0 -77
  319. package/src/native-harness/test/notices.test.ts +0 -64
  320. package/src/native-harness/test/openrouter-config.test.ts +0 -218
  321. package/src/native-harness/test/operator-controls.test.ts +0 -132
  322. package/src/native-harness/test/output.test.ts +0 -44
  323. package/src/native-harness/test/owner-config.test.ts +0 -64
  324. package/src/native-harness/test/permissions-e2e.test.ts +0 -68
  325. package/src/native-harness/test/persistence.test.ts +0 -236
  326. package/src/native-harness/test/portability.test.ts +0 -337
  327. package/src/native-harness/test/protocol.test.ts +0 -160
  328. package/src/native-harness/test/reminder-clock.test.ts +0 -61
  329. package/src/native-harness/test/reminder-stdio.test.ts +0 -140
  330. package/src/native-harness/test/reminder-storage.test.ts +0 -124
  331. package/src/native-harness/test/scenario-jsonl.test.ts +0 -112
  332. package/src/native-harness/test/scripted.test.ts +0 -92
  333. package/src/native-harness/test/session-file.test.ts +0 -51
  334. package/src/native-harness/test/startup-channel-changes.test.ts +0 -256
  335. package/src/native-harness/test/stdio.test.ts +0 -132
  336. package/src/native-harness/test/storage-memory.test.ts +0 -4
  337. package/src/native-harness/test/storage-sqlite.test.ts +0 -420
  338. package/src/native-harness/test/suspension.test.ts +0 -430
  339. package/src/native-harness/test/timeline-retrieval.test.ts +0 -211
  340. package/src/native-harness/test/tools-catalog.test.ts +0 -468
  341. package/src/native-harness/test/tools-protocol.test.ts +0 -418
  342. package/src/native-harness/test/transfers.test.ts +0 -94
  343. package/src/native-harness/test/web-chat.test.ts +0 -35
@@ -1,312 +0,0 @@
1
- # Persistence work log
2
-
3
- See [SPEC.md](SPEC.md) for the behavior and [PLAN.md](PLAN.md) for the work and
4
- acceptance gates.
5
-
6
- ## Entries
7
-
8
- - **Planning.** Consolidated the spec, implementation plan and work log in one
9
- folder. Branch and agent assignments are pending.
10
-
11
- - **Assignment (coordinator haurness-l).** Implementer clad1a-n owns branch
12
- `aiagent/native-persistence` from base `93939c3` (stdio `bb615e0`). Reviewer
13
- gro1a-o reviews each named stage revision directly. Base: typecheck clean,
14
- 44 tests pass.
15
- - **Stage 1, contracts (implementer).** Decision
16
- [0013](../../decisions/0013-durable-delivery-contract.md); contracts revised in
17
- `src/contracts/{storage,agent,session,events,protocol,context,loop}.ts`. No
18
- kernel, adapter or interface code changed. Gate: `bun run typecheck` clean;
19
- `bun test ./test` 44 pass. Contract-level account of the three review cases:
20
- - *Message at the finish boundary.* Storage calls are synchronous, single-owner
21
- transactions, so `acceptItem` and `finishTurn(completed)` commit in one
22
- order. Accept first: finish sees the pending item, leaves the turn running
23
- and returns `finished: false`; the loop calls `takePending` and infers again,
24
- so the item joins this turn. Finish first: the turn is completed, the item is
25
- pending on a channel with no live turn, and the scheduler's post-accept
26
- `beginTurn` starts the next turn with it. `beginTurn` returns null while a
27
- turn is live, and take moves an item out of pending in the same transaction
28
- that links it, so it reaches exactly one turn. While suspending the same
29
- check applies but nothing is taken: accept first means finish returns
30
- `finished: false`, the turn is checkpointed with the item still pending, and
31
- after resume that same turn takes it before its first inference. Finish
32
- first means the turn is completed and the item waits for a `beginTurn` after
33
- resume. A turn with a final tool-free response and nothing pending completes
34
- and cannot be checkpointed.
35
- - *Crash before take.* The item is committed pending and nothing else changed.
36
- Reopen keeps it pending with no turn link. If the acknowledgment was lost,
37
- resending the same ID returns the original item. It becomes eligible when
38
- the host starts execution after load.
39
- - *Crash after take.* Take committed item, timeline entry, turn link and (for
40
- `beginTurn`) the running turn together. Reopen marks that turn interrupted;
41
- the item stays `taken` on it and is never pending again. Recorded calls
42
- without results are listed as uncertain and not re-executed. The channel
43
- begins a new turn for fresh input. A crash inside the transaction lands on
44
- one of the two sides.
45
- - *Load then live events.* `session/load` reads one snapshot at revision R and
46
- execution is started only after the response is written, so events for
47
- recovered work follow it. Events carry their commit revision: those at or
48
- below R are already in the view and are not sent after the response; those
49
- above R follow it.
50
- - **Stage 1 review (reviewer gro1a-o), `9ca6bd4`: not approved.** Accepted the
51
- parallel old/new types, shared turns, immediate stop on EOF and the account
52
- above. Nine findings, all addressed in the next revision: suspension finish
53
- boundary; `confirmReceipts`/`takePending` refused unless the turn is running;
54
- `interruptActive` for stop during suspension; open never writes the
55
- compatibility key; exact signature and `auto:<n>` item IDs; `session/event`
56
- delivery; `transfer_limit` for oversized load views and archives; revision 2
57
- conformance list and the 0011 note; `participantIds` wording and ignored push
58
- `delivery`/`wake`. One deviation from the wording of finding 6: widening the
59
- existing notification union breaks `src/interfaces/client.ts` at typecheck,
60
- which a contract-only stage may not edit, so `session/event` is delivered
61
- through a `subscribeSession` member on the transport and endpoint contracts.
62
- - **Stage 1 re-review (reviewer gro1a-o), `5514934`: not approved, one finding.**
63
- The eight other fixes and the `subscribeSession` deviation were accepted.
64
- Fixed next: `exportArchive` is `busy` for the whole `suspending` state, and
65
- `importArchive` rejects a `suspending` archive as `invalid_archive`.
66
- - **Stage 1 approved (reviewer gro1a-o): `6fddbe6`.** Export is limited to an
67
- idle or cleanly suspended session; import rejects a `suspending` archive or
68
- one holding a running turn.
69
- - **Stage 2, storage (implementer).** `src/state/storage/{engine,memory,sqlite,archive}.ts`,
70
- shared suite `test/conformance/storage.ts`, `test/storage-{memory,sqlite}.test.ts`.
71
- One engine implements the contract over a small row interface, so both
72
- adapters share every rule; SQLite adds the schema, the exclusive file lock
73
- and publish-by-hard-link for create and import. Not connected to execution.
74
- Gate: `bun run typecheck` clean; `bun test ./test` 86 pass, 0 fail (44
75
- existing, 18 conformance per adapter, 6 SQLite-only). SQLite-only checks:
76
- another process's live owner is refused and SIGKILL releases it; SIGKILL
77
- while running and while suspending leaves taken input on an interrupted
78
- turn with its uncertain call, untaken input pending, retries deduplicated
79
- and the channel able to begin turn 2; junk, foreign and future-format files
80
- are refused byte-for-byte unchanged; failed creates/imports leave no files;
81
- an injected mid-transaction failure rolls back the whole take. Deviations:
82
- none from the contract. Note: the SQLite tests take about 9 s because every
83
- commit is fsynced.
84
- - **Stage 2 approved (reviewer gro1a-o): `f2e7873`.**
85
- - **Stage 3, delivery and recovery (implementer).** The scheduler
86
- (`src/kernel/channels.ts`), loop and session assembly now run on storage; the
87
- memory-only `Agent`/`TurnRunner`/`HarnessSession` types and
88
- `shared-context.ts` are removed. The local chat adapter holds each request by
89
- following events to the turn that took its item. The protocol server adds
90
- `session/load`, `session/messages`, `session/status`, durable push
91
- acknowledgments and `subscribeSession`; the scripted server takes
92
- `--home <directory>` for SQLite sessions. Later context states unfinished
93
- turns and their uncertain calls. Gate: `bun run typecheck` clean;
94
- `bun test ./test` 104 pass, 0 fail, run four times. Real child processes,
95
- each killed with SIGKILL from inside immediately after a named commit
96
- (`test/crash.test.ts`): before take the input is pending and runs once after
97
- reopen; after take it stays on one interrupted turn and is not run again; a
98
- tool effect with no committed result is reported uncertain and the effect log
99
- still has one line after fresh work; a committed reply the client never
100
- received is returned by load; the load response precedes live events, which
101
- all carry later revisions; a second process is refused. A message racing
102
- completion is swept across 40 interleavings twice (`test/persistence.test.ts`):
103
- each item reaches exactly one turn, and all three outcomes occur. Deviations
104
- and limits: `suspend`, `resume` and `stop` exist on the session but are not
105
- reachable from the protocol and have no end-to-end test until Stage 4; stdin
106
- EOF still drains; `bun run start` still uses memory storage until Stage 6.
107
- Events are not durable: a killed process may not have flushed events it
108
- published, which is why load is the recovery path.
109
- - **Stage 3 review (reviewer gro1a-o), `1191c4c`: not approved, two findings.**
110
- Fixed next. The loop now records the assistant message, publishes it, then
111
- confirms Seen, so a crash between the two commits leaves the reply durable
112
- and the receipt unadvanced (new child-process test at `appendMessage:1`).
113
- Message paging fails only when the first record of a request cannot fit a
114
- frame; a fitting page before an oversized message is returned whole.
115
- - **Stage 3 approved (reviewer gro1a-o): `44fd9d5`.**
116
- - **Stage 4, suspension (implementer).** `session/suspend`, `session/resume`
117
- and `session/stop` on the protocol server and client, lifecycle
118
- notifications through `subscribeSession`, and a `hold` scenario tool that a
119
- test can keep running. The kernel paths were written in Stage 3; this stage
120
- exposes and tests them. Gate: `bun run typecheck` clean; `bun test ./test`
121
- 115 pass, 0 fail, run six times. `test/suspension.test.ts`, on both
122
- transports unless noted: two channels with running tools suspend only after
123
- the tools finish, each checkpoints without inferring, and the hold log shows
124
- each tool once; after reopen nothing runs or is published for 150 ms and
125
- pushes are refused until resume; on resume the pending message joins its
126
- channel's resumed turn (one `turn_took`, one turn), no tool call repeats and
127
- fresh work runs. A checkpoint under another system prompt loads but fails
128
- resume as `incompatible` with the load view byte-identical before and after.
129
- Stop during a running tool answers at once, reports the turn interrupted
130
- with its uncertain call, keeps pending input, and a late release changes
131
- nothing. In-process: stop during suspension resolves the suspend as
132
- `stopped` and interrupts the checkpointed turn; suspension during inference
133
- completes a tool-free answer and checkpoints a tool-requesting one; a notice
134
- accepted during suspension starts no inference until resume. Stdio only: a
135
- child killed after a checkpoint commit and before suspension commits reopens
136
- as running with that turn interrupted. One correction during the stage: the
137
- loop no longer publishes a failed tool event for a turn that stop already
138
- ended. Stdin EOF still drains, as agreed with the reviewer.
139
- - **Stage 4 approved (reviewer gro1a-o): `5c61d7b`.** Archive bytes decided by
140
- the reviewer for Stage 5: one UTF-8 JSON document of the SessionArchive with
141
- nothing in front of it; length and SHA-256 are those of the file bytes.
142
- - **Stage 5, portability (implementer).** `session/export`, `session/import`
143
- and `transfer/{open,write,read,close}` on the server
144
- (`src/interfaces/protocol/transfers.ts`), `exportTo`, `importFrom`,
145
- `exportArchive` and `importArchive` on the client. `validateArchive` now also
146
- rejects a duplicate `acceptedSeq`, with a shared conformance case. Gate:
147
- `bun run typecheck` clean; `bun test ./test` 123 pass, 0 fail, run three
148
- times. `test/portability.test.ts`, on both transports unless noted: a
149
- suspended session with a checkpoint and five 300 KB pending messages exports
150
- as a 1.5 MB archive (more than one frame), imports into a fresh home, loads
151
- identically to the source, keeps deduplication, and after resume the pending
152
- input joins turn 1 while the hold log still shows the tool once; a second
153
- import is `already_exists`; a path import under a new session ID keeps the
154
- inner IDs. Truncated, non-JSON, non-UTF-8, edited, `suspending`,
155
- duplicate-`acceptedSeq` and wrong-version archives, a missing or junk path,
156
- an incomplete upload and a wrong hash are each refused with the destination
157
- directory listing unchanged and the session still `not_found`. Transfer
158
- rules: second open, offset gap, oversize chunk, overrun, repeat offset and
159
- size over the limit are `transfer_limit` and write nothing. Export is `busy`
160
- with active or pending work and for the whole `suspending` state, and an
161
- existing export path is `already_exists` with the file untouched.
162
- In-process only (small injected limits): an over-limit export leaves no
163
- file; an idle transfer and one open at connection end are removed. Stdio
164
- only: a transfer file left by a killed process is removed when the next
165
- process starts. Transfer files are named with the owning PID and only files
166
- of dead processes are cleaned at startup, because two servers can share a home.
167
- - **Stage 5 review (reviewer gro1a-o), `35912c3`: not approved, two findings.**
168
- Fixed next, with `test/transfers.test.ts`: a transfer whose temp file cannot
169
- be created or appended to is closed instead of holding the connection's one
170
- slot or leaving a half-written offset; a download returns only the bytes
171
- read and reports the end only at the announced length; startup cleanup
172
- removes a transfer file only when its process does not exist (ESRCH), not
173
- when it cannot be signalled (EPERM).
174
- - **Stage 5 re-review (reviewer gro1a-o), `9068698`: not approved, one finding.**
175
- Fixed next: `exportArchive` fails `invalid_archive` when a read returns no
176
- bytes without reaching the end (or more bytes than announced) instead of
177
- repeating the offset, and closing a transfer frees its slot before removing
178
- its file.
179
- - **Stage 5 approved (reviewer gro1a-o): `291abf8`.**
180
- - **Stage 6, development integration (implementer).** Stdin EOF is now stop,
181
- as decision 0013 records, in its own commit (`7a355ea`) with a real-process
182
- test. `src/interfaces/cli/development.ts` is the development session that
183
- `bun run start` runs: `--db <file>` with `--create`, `--resume`, and
184
- `--script <file>` for offline runs; `bun run status|suspend|resume` control
185
- the running agent over its Unix socket only. The inspector reads storage at
186
- attach and after every commit: lifecycle and storage in the header, and per
187
- channel the active or checkpointed turn, pending input, and an unresolved
188
- failed or interrupted turn with its uncertain calls. The local chat adapter
189
- now answers a request whose turn is checkpointed by suspension instead of
190
- holding it open (found when a server could not shut down in a test).
191
- Gate: `bun run typecheck` clean; `bun test ./test` 134 pass, 0 fail, run
192
- three times. Restored timeline before a new message:
193
- `test/development.test.ts` reopens a SQLite session and compares the
194
- inspector's entries, rendered base, channel messages and served `/state`
195
- with the first process before anything is sent. End-to-end scenarios,
196
- public client to real child processes (`test/e2e.test.ts`): clean relocation
197
- (two channels, input accepted mid-tool, suspend, export, stop source, import
198
- into a fresh home, load equals the source view, resume; the input reaches
199
- one turn and the hold log shows each tool once) and crash recovery (five
200
- process lifetimes killed after accept, after a tool effect, after a reply
201
- commit and after take; load reports the pending item, the uncertain call,
202
- the missed reply and the interrupted turns; one effect line at the end).
203
- - **Manual development exercise (implementer, 2026-11-19).** Two real
204
- `bun run start` processes on one database, driven from a terminal with
205
- `--script test/fixtures/development-scenario.json` and no provider key;
206
- messages sent with curl to the agent's Unix socket, inspector read through
207
- its `/state` endpoint on `127.0.0.1`. Observed:
208
- 1. `start --db dev.sqlite --create` printed the storage path and inspector URL.
209
- 2. Bob on channel2 got "Hello Bob."; Alice on channel1 asked to tell Bob and
210
- got "Bob's channel has been notified."; channel2 answered the notice.
211
- Inspector: lifecycle running, execution idle, 8 timeline entries,
212
- channel2 participants `bob` and `channel:channel1`.
213
- 3. Alice started a dashboard step (8 s tool). `status` showed channel1 turn 4
214
- running. `suspend` returned after 7 s with lifecycle suspended and turn 4
215
- suspended; the held chat request was answered with the suspension notice.
216
- Inspector: lifecycle suspended, channel1 turn suspended, 11 entries, the
217
- last one the dashboard tool result.
218
- 4. SIGINT; exit code 0.
219
- 5. `start --db dev.sqlite` (no `--resume`) printed "Session is suspended and
220
- paused". Before any message the inspector showed the same revision (29),
221
- 11 entries, both channels with their messages, channel1 turn suspended,
222
- the shared base containing the notice text, and zero inference requests
223
- in this process. The page itself was served.
224
- 6. A message to channel2 was refused ("Session is suspended; new work is not
225
- admitted") and the revision did not change.
226
- 7. `resume` returned lifecycle running. channel1 finished with "One
227
- dashboard step is finished." after one inference; `dashboard_work` appears
228
- once, in the first process's log only. A new message on channel2 was
229
- answered.
230
- 8. SIGINT; exit code 0. `--create` on the existing file failed with
231
- `already_exists`.
232
- Limits of this exercise: the inspector was checked through its JSON state
233
- and by fetching the page, not by looking at it in a browser; no run used a
234
- live provider; the terminal chat client and the LAN web chat were not used
235
- (their adapters are covered by automated tests).
236
-
237
- ## Closure and retrospective
238
-
239
- **Accepted behavior revision: `9d9de35417ea43d79387dd272dbc1576ac766868` on
240
- `aiagent/native-persistence`** (base `93939c3`; parents `7a355ea`, then
241
- `291abf8`). The closure commit that records this changes only this file.
242
-
243
- **Review outcome.** Independent reviewer gro1a-o approved every stage:
244
-
245
- | Stage | Approved | Review rounds |
246
- | --- | --- | --- |
247
- | 1 contracts | `6fddbe6` | 3 (nine findings, then export/import preconditions) |
248
- | 2 storage | `f2e7873` | 1 |
249
- | 3 delivery and recovery | `44fd9d5` | 2 (receipt ordering, message paging) |
250
- | 4 suspension | `5c61d7b` | 1 |
251
- | 5 portability | `291abf8` | 3 (transfer failure paths, stalled download) |
252
- | 6 development integration | `9d9de35` | 1 |
253
-
254
- At Stage 6 the reviewer re-ran the gate, not the implementer's claim:
255
- `bun run typecheck` clean; `bun test ./test` 134 pass, 0 fail, 2020 `expect()`
256
- calls, 21 files, 31.95 s; checked against SPEC criteria 1 to 14 and both named
257
- end-to-end scenarios.
258
-
259
- **Verification.** All automated checks run offline with scripted models and
260
- controlled tools, no provider key. Process-level checks use real children
261
- (`serve --stdio --home`) killed with SIGKILL at exact commit boundaries.
262
- `test/e2e.test.ts` runs the spec's clean relocation and crash recovery
263
- scenarios through the public client. The manual inspector exercise is recorded
264
- above under "Manual development exercise".
265
-
266
- **Known limits and follow-ups.**
267
- - The manual exercise read the inspector through its JSON state and a page
268
- fetch, not in a browser; no run used a live provider; the terminal chat and
269
- LAN web chat were exercised only by automated tests.
270
- - Events are not durable and there is no output replay. After a crash, load is
271
- the recovery path for committed replies the client missed.
272
- - A model or tool call in flight at a crash has an uncertain outcome. It is
273
- reported, never retried, and never reconciled automatically.
274
- - Ctrl+C and SIGTERM on `bun run start` are stop, not suspend: running turns
275
- are recorded interrupted. Suspension is explicit.
276
- - The simulated dashboard job is process state and restarts with each process.
277
- - `session/load` returns turns and items unpaged and fails `transfer_limit`
278
- when they exceed one 1 MiB frame; only messages are paged. Archives are
279
- capped at 256 MiB.
280
- - One local owner per session file; no PostgreSQL or multi-server scheduling.
281
- Archive import makes a copy, so a host relocating a session must stop the
282
- source before resuming the destination.
283
- - Item signatures cover joined message text, not part boundaries. Participant
284
- roles and access rules remain outside persistence.
285
- - Not in scope and unchanged: historical inspector request snapshots, advanced
286
- recall and compaction, policy enforcement, consumer-owned workers.
287
-
288
- **Retrospective.**
289
- - *What helped.* Deciding the contract first (0013) and getting it reviewed
290
- alone meant Stages 2 to 6 never reopened a contract question. One storage
291
- engine over a small row interface kept the memory and SQLite adapters
292
- identical, so one conformance suite found real bugs once. Tests that kill a
293
- real process after a named commit made the three crash windows concrete
294
- instead of argued. A reviewer who re-ran the gate and probed failure paths
295
- (late receipts, stop during suspension, a stalled download) caught defects
296
- tests I wrote around the happy path had missed.
297
- - *Where work stalled or was redone.* Stage 1 took three rounds because the
298
- suspension and export rules were stated in prose before they were decidable;
299
- the finish-boundary rule changed the loop, the port and two storage methods.
300
- Stage 3 recorded Seen before the reply, a window the reviewer found. Stage 5
301
- took three rounds on error paths in the transfer file: each fix opened the
302
- next hole (an exact read, then a loop on an empty read), because failure
303
- handling was added without a test per failure. Two tests raced suspend
304
- against releasing a tool and failed once in six runs; repeated full-suite
305
- runs found it, not a single green run.
306
- - *Next cycle.* Write the failure-path test list from the contract before
307
- implementing each stage, including "what ends or frees this resource when
308
- the operation throws". Run the full suite repeatedly before submitting any
309
- process-level stage. State ordering guarantees (reply before receipt, commit
310
- before event) as testable assertions in the decision record. Ask for the
311
- reviewer's reading of ambiguous contract text before building on it, as was
312
- done for the archive bytes.
@@ -1,77 +0,0 @@
1
- # Persistence implementation plan
2
-
3
- Status: proposed for implementation review.
4
-
5
- ## Scope and module map
6
-
7
- Deliver the SQLite persistence flow in [SPEC.md](SPEC.md), from durable message
8
- delivery through restart, suspension and file export/import. Preserve sequential
9
- execution within a channel and concurrent execution across channels. Messages
10
- have a single delivery behavior, including when a message reaches an active turn.
11
-
12
- Paths in this table are relative to the native harness package.
13
-
14
- | Area | Existing or proposed code | Responsibility |
15
- | --- | --- | --- |
16
- | Contracts | Existing `src/contracts/{storage,agent,session,events,protocol}.ts` | Define atomic storage operations, acceptance and completion, lifecycle, load results and transport guarantees. |
17
- | Storage | Existing `src/state/storage/`, with new SQLite and memory adapters | Own the timeline, durable inbox, stable IDs, transitions and exclusive ownership. Fold `shared-context.ts` into the memory adapter or retain it as a projection of the same timeline. |
18
- | Portability | New archive implementation under `src/state/storage/` | Encode and validate the logical session snapshot. Publish imports atomically. |
19
- | Scheduling and execution | Existing `src/kernel/channels.ts` and `loop.ts` | Schedule one live turn per channel. Coordinate delivery, completion and suspension at the iteration boundary through contracts. |
20
- | Assembly and context | Existing `src/index.ts` and `src/capabilities/context/build.ts` | Inject storage and lifecycle services. Render timeline data, with interruption and uncertain tool outcomes visible where relevant. |
21
- | Public interfaces | Existing `src/client.ts` and `src/interfaces/{client.ts,protocol/}` | Expose acceptance, lifecycle, load and archive operations. Enforce load response ordering and bounded transfer on the wire. |
22
- | Development and verification | Existing `src/interfaces/{cli,inspector}/`, `src/testing.ts` and `test/` | Select storage, inspect restored state and exercise the same execution with scripted models through the public interface. |
23
-
24
- ## Implementation stages and acceptance gates
25
-
26
- | Stage | Work and dependencies | Gate |
27
- | --- | --- | --- |
28
- | 1. Contracts | Revise the storage and wire contracts and record the decisions. Define atomic accept/take/finish, acceptance versus turn completion, checkpoint data, load snapshot ordering, and archive transfer limits. Resolve how local chat awaits a shared turn when multiple inputs steer it. | Typecheck and review a message arriving at the finish boundary, a crash on either side of take, and a load followed by live events. |
29
- | 2. Storage | Implement the memory and SQLite adapters against the agreed storage contract. | Shared conformance passes for both. SQLite reopens with stable IDs and deduplication, enforces exclusive ownership, and rejects invalid or partial transitions. |
30
- | 3. Delivery and recovery | Connect the scheduler, timeline and scripted stdio load path to storage. | Run real child-process crashes before and after input take. Verify a missed committed reply is recoverable, the same channel can accept fresh work, and an uncertain tool call is never replayed automatically. Test a message racing turn completion. |
31
- | 4. Suspension | Wire checkpoints and suspend/status/resume through session assembly and the client. | Suspend two active channels. Reopen and verify execution stays paused until resume. Pending items reach exactly one turn and completed calls run once. |
32
- | 5. Portability | Add `.harness` export/import and bounded stdio transfer. | Round-trip a suspended session into a fresh home. Transfer an archive larger than one frame. Invalid archives and occupied destinations leave no partial import. |
33
- | 6. Development integration | Wire startup and inspector, then verify the complete public flow. | Restored timeline is visible before a new message. Run the spec’s end-to-end scenarios and existing harness checks. Record the manual inspector exercise and review the complete revision. |
34
-
35
- Use scripted models and controlled tools for automated checks, with no provider
36
- credentials. Exercise transport behavior through the public client. Keep the
37
- clean relocation and forced-crash scenarios separate, as defined in the spec.
38
-
39
- ## How we work
40
-
41
- ### Shared rules
42
-
43
- - Use one implementation branch for the slice. Record the base and branch in
44
- [LOG.md](LOG.md) once assigned. Identify the exact revision in review handoffs.
45
- - Follow [AGENTS.md](../../../AGENTS.md) and [ARCHITECTURE.md](../../../ARCHITECTURE.md).
46
- Land contract changes separately, before dependent implementation. Keep SQLite
47
- in storage and the kernel dependent on contracts.
48
- - Use direct communication for reviews and fixes. Record durable decisions,
49
- handoffs, blockers and gate results in one chronological log. Include the
50
- role and revision where they help identify what was tested or reviewed.
51
-
52
- ### Coordinator
53
-
54
- Assign one implementer and one independent reviewer after scope approval.
55
- Agree on branch ownership and resolve questions that change the spec or contracts.
56
- Check the final revision against the acceptance scenarios and record closure.
57
-
58
- ### Implementer
59
-
60
- Own the branch edits. Run each gate as its stage becomes runnable and record the
61
- commands, results, and deviations. Ask the reviewer directly to review a named
62
- revision. Address findings and send the revised revision back for review.
63
-
64
- ### Reviewer
65
-
66
- Review the named revision independently. Check the spec and gates, then inspect
67
- transaction boundaries, failure paths, channel concurrency, and the public API.
68
- Send concrete findings directly to the implementer. Repeat the review after fixes
69
- until the revision is approved. Bring scope or contract changes and disputed
70
- blockers to the coordinator.
71
-
72
- ## Closure
73
-
74
- Record the accepted revision, independent review outcome, gate results, relevant
75
- test commands, manual verification and follow-ups in [LOG.md](LOG.md). Add a
76
- short retrospective there covering what helped, where work stalled or had to be
77
- redone, and what to change in the next implementation and review cycle.