kiokuko-dsh 0.2.8 → 0.2.9

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 (430) hide show
  1. package/PERMISSIONS.md +1 -1
  2. package/README.ja.md +35 -10
  3. package/README.ko.md +30 -3
  4. package/README.md +36 -12
  5. package/README.zh-CN.md +30 -3
  6. package/THIRD_PARTY_NOTICES.md +4 -0
  7. package/dist/db/transaction.d.ts +2 -1
  8. package/dist/db/transaction.d.ts.map +1 -1
  9. package/dist/db/transaction.js +44 -7
  10. package/dist/db/transaction.js.map +1 -1
  11. package/dist/deep-planning-config.d.ts +32 -0
  12. package/dist/deep-planning-config.d.ts.map +1 -0
  13. package/dist/deep-planning-config.js +20 -0
  14. package/dist/deep-planning-config.js.map +1 -0
  15. package/dist/deep-thinker/core/contracts.d.ts +1 -29
  16. package/dist/deep-thinker/core/contracts.d.ts.map +1 -1
  17. package/dist/deep-thinker/core/contracts.js +2 -17
  18. package/dist/deep-thinker/core/contracts.js.map +1 -1
  19. package/dist/deep-thinker/memory-finalizer.d.ts.map +1 -1
  20. package/dist/deep-thinker/memory-finalizer.js +1 -114
  21. package/dist/deep-thinker/memory-finalizer.js.map +1 -1
  22. package/dist/deep-thinker/native-executor.d.ts.map +1 -1
  23. package/dist/deep-thinker/native-executor.js +3 -4
  24. package/dist/deep-thinker/native-executor.js.map +1 -1
  25. package/dist/deep-thinker/store.js +1 -2
  26. package/dist/deep-thinker/store.js.map +1 -1
  27. package/dist/dsh/agenticreplay-event-mapper.d.ts +1 -1
  28. package/dist/dsh/agenticreplay-event-mapper.d.ts.map +1 -1
  29. package/dist/dsh/agenticreplay-event-mapper.js +5 -1
  30. package/dist/dsh/agenticreplay-event-mapper.js.map +1 -1
  31. package/dist/dsh/agenticreplay-files.d.ts +1 -0
  32. package/dist/dsh/agenticreplay-files.d.ts.map +1 -1
  33. package/dist/dsh/agenticreplay-files.js +19 -2
  34. package/dist/dsh/agenticreplay-files.js.map +1 -1
  35. package/dist/dsh/agenticreplay-host.js +3 -3
  36. package/dist/dsh/agenticreplay-host.js.map +1 -1
  37. package/dist/dsh/agenticreplay-read-service.d.ts +14 -0
  38. package/dist/dsh/agenticreplay-read-service.d.ts.map +1 -1
  39. package/dist/dsh/agenticreplay-read-service.js +17 -0
  40. package/dist/dsh/agenticreplay-read-service.js.map +1 -1
  41. package/dist/dsh/agenticreplay-recorder.d.ts.map +1 -1
  42. package/dist/dsh/agenticreplay-recorder.js +5 -2
  43. package/dist/dsh/agenticreplay-recorder.js.map +1 -1
  44. package/dist/dsh/answer-review/coordinator.js +2 -1
  45. package/dist/dsh/answer-review/coordinator.js.map +1 -1
  46. package/dist/dsh/auto-memory-review.d.ts.map +1 -1
  47. package/dist/dsh/auto-memory-review.js +10 -193
  48. package/dist/dsh/auto-memory-review.js.map +1 -1
  49. package/dist/dsh/coding-workflow/contracts.d.ts +2 -0
  50. package/dist/dsh/coding-workflow/contracts.d.ts.map +1 -1
  51. package/dist/dsh/coding-workflow/contracts.js.map +1 -1
  52. package/dist/dsh/coding-workflow/intent.d.ts.map +1 -1
  53. package/dist/dsh/coding-workflow/intent.js +5 -2
  54. package/dist/dsh/coding-workflow/intent.js.map +1 -1
  55. package/dist/dsh/coding-workflow/service.d.ts +10 -81
  56. package/dist/dsh/coding-workflow/service.d.ts.map +1 -1
  57. package/dist/dsh/coding-workflow/service.js +52 -1
  58. package/dist/dsh/coding-workflow/service.js.map +1 -1
  59. package/dist/dsh/completion-verifiers.d.ts +6 -0
  60. package/dist/dsh/completion-verifiers.d.ts.map +1 -1
  61. package/dist/dsh/completion-verifiers.js.map +1 -1
  62. package/dist/dsh/composition.d.ts +2 -0
  63. package/dist/dsh/composition.d.ts.map +1 -1
  64. package/dist/dsh/composition.js +3 -0
  65. package/dist/dsh/composition.js.map +1 -1
  66. package/dist/dsh/config.d.ts +1 -1
  67. package/dist/dsh/config.d.ts.map +1 -1
  68. package/dist/dsh/config.js +3 -3
  69. package/dist/dsh/config.js.map +1 -1
  70. package/dist/dsh/core/host.d.ts.map +1 -1
  71. package/dist/dsh/core/host.js +151 -33
  72. package/dist/dsh/core/host.js.map +1 -1
  73. package/dist/dsh/core/tasks.d.ts +5 -2
  74. package/dist/dsh/core/tasks.d.ts.map +1 -1
  75. package/dist/dsh/core/tasks.js +124 -93
  76. package/dist/dsh/core/tasks.js.map +1 -1
  77. package/dist/dsh/decisions/request-intent.d.ts +101 -1
  78. package/dist/dsh/decisions/request-intent.d.ts.map +1 -1
  79. package/dist/dsh/decisions/request-intent.js +77 -15
  80. package/dist/dsh/decisions/request-intent.js.map +1 -1
  81. package/dist/dsh/execution-result.d.ts +1 -0
  82. package/dist/dsh/execution-result.d.ts.map +1 -1
  83. package/dist/dsh/execution-support.d.ts +2 -0
  84. package/dist/dsh/execution-support.d.ts.map +1 -1
  85. package/dist/dsh/execution-support.js +39 -4
  86. package/dist/dsh/execution-support.js.map +1 -1
  87. package/dist/dsh/existing-task-intake.d.ts +22 -0
  88. package/dist/dsh/existing-task-intake.d.ts.map +1 -0
  89. package/dist/dsh/existing-task-intake.js +46 -0
  90. package/dist/dsh/existing-task-intake.js.map +1 -0
  91. package/dist/dsh/finalization-request.d.ts +1 -1
  92. package/dist/dsh/finalization-request.d.ts.map +1 -1
  93. package/dist/dsh/finalization-request.js +1 -1
  94. package/dist/dsh/finalization-request.js.map +1 -1
  95. package/dist/dsh/guardrail/contracts.d.ts +85 -0
  96. package/dist/dsh/guardrail/contracts.d.ts.map +1 -0
  97. package/dist/dsh/guardrail/contracts.js +10 -0
  98. package/dist/dsh/guardrail/contracts.js.map +1 -0
  99. package/dist/dsh/guardrail/engine.d.ts +19 -0
  100. package/dist/dsh/guardrail/engine.d.ts.map +1 -0
  101. package/dist/dsh/guardrail/engine.js +178 -0
  102. package/dist/dsh/guardrail/engine.js.map +1 -0
  103. package/dist/dsh/guardrail/evidence.d.ts +16 -0
  104. package/dist/dsh/guardrail/evidence.d.ts.map +1 -0
  105. package/dist/dsh/guardrail/evidence.js +101 -0
  106. package/dist/dsh/guardrail/evidence.js.map +1 -0
  107. package/dist/dsh/guardrail/service.d.ts +27 -0
  108. package/dist/dsh/guardrail/service.d.ts.map +1 -0
  109. package/dist/dsh/guardrail/service.js +253 -0
  110. package/dist/dsh/guardrail/service.js.map +1 -0
  111. package/dist/dsh/host-adapter/admission.d.ts.map +1 -1
  112. package/dist/dsh/host-adapter/admission.js +143 -144
  113. package/dist/dsh/host-adapter/admission.js.map +1 -1
  114. package/dist/dsh/host-adapter/lifecycle.d.ts.map +1 -1
  115. package/dist/dsh/host-adapter/lifecycle.js +104 -90
  116. package/dist/dsh/host-adapter/lifecycle.js.map +1 -1
  117. package/dist/dsh/host-adapter/routing.d.ts.map +1 -1
  118. package/dist/dsh/host-adapter/routing.js +4 -4
  119. package/dist/dsh/host-adapter/routing.js.map +1 -1
  120. package/dist/dsh/host-adapter/turn-state.d.ts +4 -2
  121. package/dist/dsh/host-adapter/turn-state.d.ts.map +1 -1
  122. package/dist/dsh/host-adapter/turn-state.js +14 -7
  123. package/dist/dsh/host-adapter/turn-state.js.map +1 -1
  124. package/dist/dsh/host-adapter.d.ts.map +1 -1
  125. package/dist/dsh/host-adapter.js +115 -24
  126. package/dist/dsh/host-adapter.js.map +1 -1
  127. package/dist/dsh/intake-clarification.js +2 -2
  128. package/dist/dsh/intake-clarification.js.map +1 -1
  129. package/dist/dsh/intake-gate.js +6 -7
  130. package/dist/dsh/intake-gate.js.map +1 -1
  131. package/dist/dsh/legacy-session-codecs.d.ts +1 -0
  132. package/dist/dsh/legacy-session-codecs.d.ts.map +1 -1
  133. package/dist/dsh/legacy-session-codecs.js +831 -127
  134. package/dist/dsh/legacy-session-codecs.js.map +4 -4
  135. package/dist/dsh/lifecycle-memory.d.ts +30 -29
  136. package/dist/dsh/lifecycle-memory.d.ts.map +1 -1
  137. package/dist/dsh/lifecycle-memory.js +309 -431
  138. package/dist/dsh/lifecycle-memory.js.map +1 -1
  139. package/dist/dsh/lisp/candidate.d.ts +2 -2
  140. package/dist/dsh/lisp/ci.d.ts +2 -1
  141. package/dist/dsh/lisp/ci.d.ts.map +1 -1
  142. package/dist/dsh/lisp/ci.js +15 -2
  143. package/dist/dsh/lisp/ci.js.map +1 -1
  144. package/dist/dsh/lisp/contracts.d.ts +1 -18
  145. package/dist/dsh/lisp/contracts.d.ts.map +1 -1
  146. package/dist/dsh/lisp/contracts.js +1 -10
  147. package/dist/dsh/lisp/contracts.js.map +1 -1
  148. package/dist/dsh/lisp/files.d.ts +1 -1
  149. package/dist/dsh/lisp/files.d.ts.map +1 -1
  150. package/dist/dsh/lisp/files.js +17 -4
  151. package/dist/dsh/lisp/files.js.map +1 -1
  152. package/dist/dsh/lisp/hot-store.d.ts.map +1 -1
  153. package/dist/dsh/lisp/hot-store.js +4 -0
  154. package/dist/dsh/lisp/hot-store.js.map +1 -1
  155. package/dist/dsh/lisp/hot-tools.d.ts +2 -0
  156. package/dist/dsh/lisp/hot-tools.d.ts.map +1 -1
  157. package/dist/dsh/lisp/hot-tools.js +10 -0
  158. package/dist/dsh/lisp/hot-tools.js.map +1 -1
  159. package/dist/dsh/lisp/manager.d.ts +14 -1
  160. package/dist/dsh/lisp/manager.d.ts.map +1 -1
  161. package/dist/dsh/lisp/manager.js +238 -37
  162. package/dist/dsh/lisp/manager.js.map +1 -1
  163. package/dist/dsh/lisp/memory-verification.d.ts +5 -2
  164. package/dist/dsh/lisp/memory-verification.d.ts.map +1 -1
  165. package/dist/dsh/lisp/memory-verification.js +5 -1
  166. package/dist/dsh/lisp/memory-verification.js.map +1 -1
  167. package/dist/dsh/lisp/package-manager.d.ts +1 -1
  168. package/dist/dsh/lisp/package-manager.d.ts.map +1 -1
  169. package/dist/dsh/lisp/package-manager.js +10 -1
  170. package/dist/dsh/lisp/package-manager.js.map +1 -1
  171. package/dist/dsh/lisp/packages.d.ts +1 -1
  172. package/dist/dsh/lisp/packages.d.ts.map +1 -1
  173. package/dist/dsh/lisp/packages.js +15 -5
  174. package/dist/dsh/lisp/packages.js.map +1 -1
  175. package/dist/dsh/lisp/proposal-batch.d.ts +2 -0
  176. package/dist/dsh/lisp/proposal-batch.d.ts.map +1 -1
  177. package/dist/dsh/lisp/proposal-batch.js +17 -3
  178. package/dist/dsh/lisp/proposal-batch.js.map +1 -1
  179. package/dist/dsh/lisp/request-surface.d.ts +12 -0
  180. package/dist/dsh/lisp/request-surface.d.ts.map +1 -1
  181. package/dist/dsh/lisp/store.d.ts +2 -1
  182. package/dist/dsh/lisp/store.d.ts.map +1 -1
  183. package/dist/dsh/lisp/store.js +5 -1
  184. package/dist/dsh/lisp/store.js.map +1 -1
  185. package/dist/dsh/lisp/surface.d.ts.map +1 -1
  186. package/dist/dsh/lisp/surface.js +107 -13
  187. package/dist/dsh/lisp/surface.js.map +1 -1
  188. package/dist/dsh/lisp/task-authority.d.ts +29 -0
  189. package/dist/dsh/lisp/task-authority.d.ts.map +1 -0
  190. package/dist/dsh/lisp/task-authority.js +87 -0
  191. package/dist/dsh/lisp/task-authority.js.map +1 -0
  192. package/dist/dsh/lisp/worker.d.ts +3 -1
  193. package/dist/dsh/lisp/worker.d.ts.map +1 -1
  194. package/dist/dsh/lisp/worker.js +26 -4
  195. package/dist/dsh/lisp/worker.js.map +1 -1
  196. package/dist/dsh/lisp-config.d.ts +21 -0
  197. package/dist/dsh/lisp-config.d.ts.map +1 -0
  198. package/dist/dsh/lisp-config.js +13 -0
  199. package/dist/dsh/lisp-config.js.map +1 -0
  200. package/dist/dsh/memory-application.d.ts +3 -2
  201. package/dist/dsh/memory-application.d.ts.map +1 -1
  202. package/dist/dsh/memory-application.js +31 -22
  203. package/dist/dsh/memory-application.js.map +1 -1
  204. package/dist/dsh/model-handoff.d.ts.map +1 -1
  205. package/dist/dsh/model-handoff.js +2 -1
  206. package/dist/dsh/model-handoff.js.map +1 -1
  207. package/dist/dsh/models/service.d.ts.map +1 -1
  208. package/dist/dsh/models/service.js +13 -2
  209. package/dist/dsh/models/service.js.map +1 -1
  210. package/dist/dsh/native-cancellation-observer.d.ts +13 -0
  211. package/dist/dsh/native-cancellation-observer.d.ts.map +1 -0
  212. package/dist/dsh/native-cancellation-observer.js +54 -0
  213. package/dist/dsh/native-cancellation-observer.js.map +1 -0
  214. package/dist/dsh/native-execution-ownership.d.ts +6 -0
  215. package/dist/dsh/native-execution-ownership.d.ts.map +1 -0
  216. package/dist/dsh/native-execution-ownership.js +34 -0
  217. package/dist/dsh/native-execution-ownership.js.map +1 -0
  218. package/dist/dsh/native-subagent.d.ts +2 -2
  219. package/dist/dsh/native-subagent.d.ts.map +1 -1
  220. package/dist/dsh/native-subagent.js +2 -3
  221. package/dist/dsh/native-subagent.js.map +1 -1
  222. package/dist/dsh/native-task-authority.d.ts +66 -0
  223. package/dist/dsh/native-task-authority.d.ts.map +1 -0
  224. package/dist/dsh/native-task-authority.js +220 -0
  225. package/dist/dsh/native-task-authority.js.map +1 -0
  226. package/dist/dsh/on-demand-intake.d.ts +23 -1
  227. package/dist/dsh/on-demand-intake.d.ts.map +1 -1
  228. package/dist/dsh/on-demand-intake.js +171 -10
  229. package/dist/dsh/on-demand-intake.js.map +1 -1
  230. package/dist/dsh/orchestration/execution-owner.js +1 -1
  231. package/dist/dsh/orchestration/execution-owner.js.map +1 -1
  232. package/dist/dsh/orchestration/managed-agent-executor.d.ts +12 -1
  233. package/dist/dsh/orchestration/managed-agent-executor.d.ts.map +1 -1
  234. package/dist/dsh/orchestration/managed-agent-executor.js +28 -2
  235. package/dist/dsh/orchestration/managed-agent-executor.js.map +1 -1
  236. package/dist/dsh/owned-completion-evidence.d.ts +11 -0
  237. package/dist/dsh/owned-completion-evidence.d.ts.map +1 -0
  238. package/dist/dsh/owned-completion-evidence.js +59 -0
  239. package/dist/dsh/owned-completion-evidence.js.map +1 -0
  240. package/dist/dsh/owned-execution.d.ts +28 -1
  241. package/dist/dsh/owned-execution.d.ts.map +1 -1
  242. package/dist/dsh/owned-execution.js +325 -101
  243. package/dist/dsh/owned-execution.js.map +1 -1
  244. package/dist/dsh/owned-read-owner.d.ts +6 -0
  245. package/dist/dsh/owned-read-owner.d.ts.map +1 -0
  246. package/dist/dsh/owned-read-owner.js +22 -0
  247. package/dist/dsh/owned-read-owner.js.map +1 -0
  248. package/dist/dsh/replay-memory-extract.d.ts +36 -0
  249. package/dist/dsh/replay-memory-extract.d.ts.map +1 -0
  250. package/dist/dsh/replay-memory-extract.js +192 -0
  251. package/dist/dsh/replay-memory-extract.js.map +1 -0
  252. package/dist/dsh/semantic-compaction/coordinator.d.ts.map +1 -1
  253. package/dist/dsh/semantic-compaction/coordinator.js +2 -1
  254. package/dist/dsh/semantic-compaction/coordinator.js.map +1 -1
  255. package/dist/dsh/session-bridge.d.ts +3 -0
  256. package/dist/dsh/session-bridge.d.ts.map +1 -1
  257. package/dist/dsh/session-bridge.js +22 -25
  258. package/dist/dsh/session-bridge.js.map +1 -1
  259. package/dist/dsh/session-history-compatibility.d.ts.map +1 -1
  260. package/dist/dsh/session-history-compatibility.js +15 -1
  261. package/dist/dsh/session-history-compatibility.js.map +1 -1
  262. package/dist/dsh/session-history-lookup.d.ts +1 -1
  263. package/dist/dsh/session-history-lookup.d.ts.map +1 -1
  264. package/dist/dsh/session-history-lookup.js +4 -3
  265. package/dist/dsh/session-history-lookup.js.map +1 -1
  266. package/dist/dsh/session-memory-finalizer.d.ts.map +1 -1
  267. package/dist/dsh/session-memory-finalizer.js +129 -117
  268. package/dist/dsh/session-memory-finalizer.js.map +1 -1
  269. package/dist/dsh/setup.d.ts +1 -1
  270. package/dist/dsh/setup.d.ts.map +1 -1
  271. package/dist/dsh/setup.js +1 -1
  272. package/dist/dsh/skill-prompts.json +1 -1
  273. package/dist/dsh/task-authority-context.d.ts +8 -0
  274. package/dist/dsh/task-authority-context.d.ts.map +1 -0
  275. package/dist/dsh/task-authority-context.js +28 -0
  276. package/dist/dsh/task-authority-context.js.map +1 -0
  277. package/dist/dsh/task-completion-host.d.ts +2 -1
  278. package/dist/dsh/task-completion-host.d.ts.map +1 -1
  279. package/dist/dsh/task-completion-host.js +17 -5
  280. package/dist/dsh/task-completion-host.js.map +1 -1
  281. package/dist/dsh/task-completion.d.ts +13 -0
  282. package/dist/dsh/task-completion.d.ts.map +1 -1
  283. package/dist/dsh/task-completion.js +23 -6
  284. package/dist/dsh/task-completion.js.map +1 -1
  285. package/dist/dsh/task-intake.d.ts.map +1 -1
  286. package/dist/dsh/task-intake.js +7 -16
  287. package/dist/dsh/task-intake.js.map +1 -1
  288. package/dist/dsh/task-source-history.d.ts +33 -0
  289. package/dist/dsh/task-source-history.d.ts.map +1 -0
  290. package/dist/dsh/task-source-history.js +62 -0
  291. package/dist/dsh/task-source-history.js.map +1 -0
  292. package/dist/dsh/task-state-host.d.ts +124 -0
  293. package/dist/dsh/task-state-host.d.ts.map +1 -0
  294. package/dist/dsh/task-state-host.js +403 -0
  295. package/dist/dsh/task-state-host.js.map +1 -0
  296. package/dist/dsh/task-state-surface.d.ts +8 -0
  297. package/dist/dsh/task-state-surface.d.ts.map +1 -0
  298. package/dist/dsh/task-state-surface.js +113 -0
  299. package/dist/dsh/task-state-surface.js.map +1 -0
  300. package/dist/dsh/task-state.d.ts +217 -0
  301. package/dist/dsh/task-state.d.ts.map +1 -0
  302. package/dist/dsh/task-state.js +315 -0
  303. package/dist/dsh/task-state.js.map +1 -0
  304. package/dist/dsh/tool-exposure-config.d.ts +12 -0
  305. package/dist/dsh/tool-exposure-config.d.ts.map +1 -0
  306. package/dist/dsh/tool-exposure-config.js +4 -0
  307. package/dist/dsh/tool-exposure-config.js.map +1 -0
  308. package/dist/dsh/tool-exposure.d.ts +2 -11
  309. package/dist/dsh/tool-exposure.d.ts.map +1 -1
  310. package/dist/dsh/tool-exposure.js +2 -2
  311. package/dist/dsh/tool-exposure.js.map +1 -1
  312. package/dist/dsh/tools.d.ts +2 -2
  313. package/dist/dsh/tools.d.ts.map +1 -1
  314. package/dist/dsh/tools.js +3 -2
  315. package/dist/dsh/tools.js.map +1 -1
  316. package/dist/enno-oduno/memory-verification.d.ts +2 -1
  317. package/dist/enno-oduno/memory-verification.d.ts.map +1 -1
  318. package/dist/enno-oduno/memory-verification.js +42 -30
  319. package/dist/enno-oduno/memory-verification.js.map +1 -1
  320. package/dist/enno-oduno/schemas.d.ts +1 -1
  321. package/dist/enno-oduno/store.d.ts +7 -0
  322. package/dist/enno-oduno/store.d.ts.map +1 -1
  323. package/dist/enno-oduno/store.js +42 -0
  324. package/dist/enno-oduno/store.js.map +1 -1
  325. package/dist/ledger/store.d.ts.map +1 -1
  326. package/dist/ledger/store.js +0 -5
  327. package/dist/ledger/store.js.map +1 -1
  328. package/dist/locale/en.json +1 -1
  329. package/dist/locale/ja.json +1 -1
  330. package/dist/locale/ko.json +1 -1
  331. package/dist/locale/zh-CN.json +1 -1
  332. package/dist/memory/auto-globalization.d.ts.map +1 -1
  333. package/dist/memory/auto-globalization.js +4 -82
  334. package/dist/memory/auto-globalization.js.map +1 -1
  335. package/dist/memory/evolution/contracts.d.ts +3 -1
  336. package/dist/memory/evolution/contracts.d.ts.map +1 -1
  337. package/dist/memory/evolution/contracts.js +1 -1
  338. package/dist/memory/evolution/contracts.js.map +1 -1
  339. package/dist/memory/evolution/store.d.ts +2 -1
  340. package/dist/memory/evolution/store.d.ts.map +1 -1
  341. package/dist/memory/evolution/store.js +75 -34
  342. package/dist/memory/evolution/store.js.map +1 -1
  343. package/dist/memory/evolution/worker.d.ts +1 -0
  344. package/dist/memory/evolution/worker.d.ts.map +1 -1
  345. package/dist/memory/evolution/worker.js +6 -18
  346. package/dist/memory/evolution/worker.js.map +1 -1
  347. package/dist/memory/explain.d.ts.map +1 -1
  348. package/dist/memory/explain.js +2 -2
  349. package/dist/memory/explain.js.map +1 -1
  350. package/dist/memory/forget.d.ts.map +1 -1
  351. package/dist/memory/forget.js +12 -3
  352. package/dist/memory/forget.js.map +1 -1
  353. package/dist/memory/index-reasoning/service.d.ts.map +1 -1
  354. package/dist/memory/index-reasoning/service.js +5 -43
  355. package/dist/memory/index-reasoning/service.js.map +1 -1
  356. package/dist/memory/index-reasoning/worker.d.ts.map +1 -1
  357. package/dist/memory/index-reasoning/worker.js +1 -15
  358. package/dist/memory/index-reasoning/worker.js.map +1 -1
  359. package/dist/memory/lifecycle.d.ts +1 -1
  360. package/dist/memory/lifecycle.d.ts.map +1 -1
  361. package/dist/memory/lifecycle.js +4 -79
  362. package/dist/memory/lifecycle.js.map +1 -1
  363. package/dist/memory/replay-review.d.ts +90 -0
  364. package/dist/memory/replay-review.d.ts.map +1 -0
  365. package/dist/memory/replay-review.js +82 -0
  366. package/dist/memory/replay-review.js.map +1 -0
  367. package/dist/memory/replay-store.d.ts +14 -0
  368. package/dist/memory/replay-store.d.ts.map +1 -0
  369. package/dist/memory/replay-store.js +117 -0
  370. package/dist/memory/replay-store.js.map +1 -0
  371. package/dist/memory/review/adoption.d.ts.map +1 -1
  372. package/dist/memory/review/adoption.js +2 -106
  373. package/dist/memory/review/adoption.js.map +1 -1
  374. package/dist/memory/review/store.d.ts.map +1 -1
  375. package/dist/memory/review/store.js +9 -5
  376. package/dist/memory/review/store.js.map +1 -1
  377. package/dist/memory/review/worker.d.ts.map +1 -1
  378. package/dist/memory/review/worker.js +1 -7
  379. package/dist/memory/review/worker.js.map +1 -1
  380. package/dist/memory/scoped-memory.js +1 -1
  381. package/dist/memory/scoped-memory.js.map +1 -1
  382. package/dist/model-tools/contracts.d.ts +2 -2
  383. package/dist/model-tools/contracts.d.ts.map +1 -1
  384. package/dist/model-tools/contracts.js +1 -11
  385. package/dist/model-tools/contracts.js.map +1 -1
  386. package/dist/model-tools/names.d.ts +4 -0
  387. package/dist/model-tools/names.d.ts.map +1 -0
  388. package/dist/model-tools/names.js +13 -0
  389. package/dist/model-tools/names.js.map +1 -0
  390. package/docs/code-intelligence.md +54 -119
  391. package/docs/dsh-plugin.md +86 -9
  392. package/docs/getting-started.md +10 -0
  393. package/docs/guardrail-licenses/Apache-2.0.txt +73 -0
  394. package/docs/guardrail-licenses/BSD-2-Clause.txt +9 -0
  395. package/docs/guardrail-licenses/COPYRIGHT-Rust.txt +34 -0
  396. package/docs/guardrail-licenses/COPYRIGHT-library.html +29357 -0
  397. package/docs/guardrail-licenses/ISC.txt +7 -0
  398. package/docs/guardrail-licenses/LICENSE-APACHE +176 -0
  399. package/docs/guardrail-licenses/LICENSE-MIT +25 -0
  400. package/docs/guardrail-licenses/LLVM-exception.txt +15 -0
  401. package/docs/guardrail-licenses/MIT.txt +9 -0
  402. package/docs/guardrail-licenses/NCSA.txt +29 -0
  403. package/docs/guardrail-licenses/README.md +7 -0
  404. package/docs/guardrail-licenses/Unicode-3.0.txt +39 -0
  405. package/docs/guardrail-licenses/libunwind-LICENSE.txt +311 -0
  406. package/docs/guardrail-licenses/manifest.json +71 -0
  407. package/docs/guardrail-licenses/musl-COPYRIGHT.txt +193 -0
  408. package/docs/guardrail.md +33 -0
  409. package/docs/lisp.md +33 -9
  410. package/docs/memory-evolution.md +6 -6
  411. package/docs/replay-memory-review.md +26 -0
  412. package/guardrail/aarch64-apple-darwin/kiokuko-guardrail +0 -0
  413. package/guardrail/aarch64-apple-darwin/manifest.json +71 -0
  414. package/guardrail/aarch64-unknown-linux-musl/kiokuko-guardrail +0 -0
  415. package/guardrail/aarch64-unknown-linux-musl/manifest.json +69 -0
  416. package/guardrail/manifest.json +204 -0
  417. package/guardrail/node-runner.mjs +37 -0
  418. package/guardrail/protocols/coding-routine.lisp +33 -0
  419. package/guardrail/x86_64-apple-darwin/kiokuko-guardrail +0 -0
  420. package/guardrail/x86_64-apple-darwin/manifest.json +71 -0
  421. package/guardrail/x86_64-unknown-linux-musl/kiokuko-guardrail +0 -0
  422. package/guardrail/x86_64-unknown-linux-musl/manifest.json +68 -0
  423. package/migrations/040_task_state.sql +45 -0
  424. package/migrations/041_task_source_history.sql +88 -0
  425. package/migrations/042_evolution_source_epochs.sql +148 -0
  426. package/package.json +45 -27
  427. package/scripts/guardrail-artifacts.d.mts +13 -0
  428. package/scripts/guardrail-artifacts.mjs +136 -0
  429. package/skills/kiokuko-lisp/SKILL.md +1 -1
  430. package/skills/kiokuko-soul/SKILL.md +6 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-task-authority.js","sourceRoot":"","sources":["../../src/dsh/native-task-authority.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAA+C,MAAM,iBAAiB,CAAA;AACjH,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAa1F,MAAM,KAAK,GAAG,IAAI,OAAO,EAA4C,CAAA;AACrE,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,OAAuB,EAAE,IAA2C,EAAE,MAAoB;IACrI,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACxG,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAA,EAAE,CAAA,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAA;IAC/C,OAAO,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,kFAAkF,CAAC;SAC9H,GAAG,CAAwB,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClD,MAAM,OAAO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AAE,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAA;IACnH,CAAC;CACF"}
@@ -3,11 +3,12 @@ import type { DshLogEvent } from './session-memory-finalizer.js';
3
3
  import { z } from 'zod';
4
4
  import { type TaskType } from '../akinator/types.js';
5
5
  import type { AkinatorTaskClassification } from './decisions/akinator-classification.js';
6
+ import type { TaskSnapshot } from './task-state.js';
6
7
  import { type RequestIntentContext, type RequestIntentDecision, type RequestIntentInterpretation } from './decisions/request-intent.js';
7
8
  import { type MemoryOwnerKind } from './memory-owner.js';
8
9
  export type { IntakeMode } from './intake-mode.js';
9
10
  export declare const TASK_PREPARE_TOOL = "prepare_requested_work";
10
- export declare const ON_DEMAND_GUIDANCE = "The original user request may be answered now without selecting a task category. No execution task has been prepared yet. Preserve the original utterance, every requested action, negation, quotation, target uncertainty, and current-session references; never replace it with a model rewrite. Use only the supplied active Goal and proposal references from this exact native session, never another chat. Classify relation as new, same_scope_continuation, scope_change, or unknown, and action as answer, research, verify, change, operate, or unknown; do not infer either from a fixed phrase or tool name. \u201CCheck how it behaves\u201D is verification/research even when the next tool is Bash. This interpretation grants no native permission. When the decision provider is unavailable, abstains, or returns unknown, interpret the same context in the main model; ask the user only if the action or referenced target remains unclear, and preserve active work while waiting. Native read, glob, grep, web_search and web_fetch demands can gather evidence without preparation. Do not call prepare_requested_work merely to read a plan or inspect files. prepare_requested_work accepts either the legacy taskType alone or a requestIntent with exact evidenceRefs from the supplied context; it never accepts a rewritten task or target and never changes native permissions. Installed Skill reads need no preparation and do not activate execution. Do not prepare work merely to load a skill. Plan, Goal, cancellation, memory-owner and execution ownership still apply. If only run_code is exposed, use the exact preparation-only carrier returned by this tool contract; the host intercepts it without evaluating code.";
11
+ export declare const ON_DEMAND_GUIDANCE = "The original user request may be answered now without selecting a task category. Ordinary native Bash needs no memory, Goal or prepare_requested_work round trip when the host confirms there is no owned task; native permissions and human Stop remain authoritative. Owned or explicitly enrolled work retains its authority checks. Preserve the original utterance, every requested action, negation, quotation, target uncertainty, and current-session references; never replace it with a model rewrite. Use only the supplied active Goal and proposal references from this exact native session, never another chat. Classify relation as new, same_scope_continuation, scope_change, or unknown, and action as answer, research, verify, change, operate, or unknown; do not infer either from a fixed phrase or tool name. \u201CCheck how it behaves\u201D is verification/research even when the next tool is Bash. This interpretation grants no native permission. When the decision provider is unavailable, abstains, or returns unknown, interpret the same context in the main model; ask the user only if the action or referenced target remains unclear, and preserve active work while waiting. Native read, glob, grep, web_search and web_fetch demands can gather evidence without preparation. Do not call prepare_requested_work merely to read a plan or inspect files. prepare_requested_work accepts either the legacy taskType alone or a requestIntent with exact evidenceRefs from the supplied context; it never accepts a rewritten task or target and never changes native permissions. Installed Skill reads need no preparation and do not activate execution. Do not prepare work merely to load a skill. Plan, Goal, cancellation, memory-owner and execution ownership still apply. If only run_code is exposed, use the exact preparation-only carrier returned by this tool contract; the host intercepts it without evaluating code.";
11
12
  declare const preparationFieldsSchema: z.ZodObject<{
12
13
  taskType: z.ZodOptional<z.ZodEnum<{
13
14
  build: "build";
@@ -39,6 +40,13 @@ declare const preparationFieldsSchema: z.ZodObject<{
39
40
  implementation: "implementation";
40
41
  document: "document";
41
42
  }>>;
43
+ taskOperation: z.ZodOptional<z.ZodEnum<{
44
+ start: "start";
45
+ complete: "complete";
46
+ ignore: "ignore";
47
+ resume: "resume";
48
+ wait: "wait";
49
+ }>>;
42
50
  evidenceRefs: z.ZodArray<z.ZodString>;
43
51
  }, z.core.$strict>>;
44
52
  }, z.core.$strict>;
@@ -79,6 +87,8 @@ interface Dependencies {
79
87
  readonly answerContext?: DshAnswerContext | undefined;
80
88
  readonly nativeChild?: (agent: DemandAgent) => boolean;
81
89
  readonly validate: (input: DemandInput) => Promise<void>;
90
+ /** Positive host authority lookup; unavailable storage must reject, never mean absent. */
91
+ readonly nativeOwnership?: (input: DemandInput) => Promise<'unowned' | 'owned'>;
82
92
  /** Exact idempotent request replay; never accepts a new turn as continuation. */
83
93
  readonly replay?: (input: DemandInput) => Promise<boolean>;
84
94
  /** Finalize or preserve the prior native turn only after its matching boundary is observed. */
@@ -109,6 +119,9 @@ interface Turn {
109
119
  captureError?: unknown;
110
120
  preparation?: Promise<void>;
111
121
  selectionPending?: boolean;
122
+ nativeUnowned?: boolean;
123
+ /** Only project context actually produced for this exact captured turn. */
124
+ answerContextReady?: boolean;
112
125
  readonly preparationCalls: Set<string>;
113
126
  readonly controller: AbortController;
114
127
  }
@@ -122,6 +135,11 @@ export declare class OnDemandIntake {
122
135
  constructor(host: Dependencies, options?: {
123
136
  onlyWhenDeferred?: boolean;
124
137
  });
138
+ /** Exact host-owned implementations, never a name-only execution bypass. */
139
+ registerControlTool(definition: Definition): () => void;
140
+ isControl(execution: Execution): boolean;
141
+ controlTask(execution: Execution): string | undefined;
142
+ private controlCall;
125
143
  private watch;
126
144
  private existingTurn;
127
145
  private acknowledgeExisting;
@@ -149,7 +167,11 @@ export declare class OnDemandIntake {
149
167
  requestIntent?: RequestIntentDecision;
150
168
  memoryOwner: MemoryOwnerKind;
151
169
  } | undefined;
170
+ /** Refresh only authority facts after a committed control operation; retain the exact human request. */
171
+ taskStateChanged(task: TaskSnapshot): void;
152
172
  /** A current host-validated control call, never arbitrary code or a name-based exemption. */
173
+ /** Exact registered native-tool proof, never a model flag or a generic task-control bypass. */
174
+ unownedNative(execution: Execution): boolean;
153
175
  preparationOnly(execution: Execution): boolean;
154
176
  pending(agent: DemandAgent): boolean;
155
177
  /** An admitted host continuation still needs capture to retire the previous turn's receipt. */
@@ -1 +1 @@
1
- {"version":3,"file":"on-demand-intake.d.ts","sourceRoot":"","sources":["../../src/dsh/on-demand-intake.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAEhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAc,KAAK,QAAQ,E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O,CAAC,IAAI,CAAC;IACtB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAC/B"}
@@ -5,11 +5,12 @@ import { z } from 'zod';
5
5
  import { TASK_TYPES } from '../akinator/types.js';
6
6
  import { canonicalContentHash } from '../serialization/validate.js';
7
7
  import { KIOKUKO_DSH_SOURCE_KIND } from './plugin-source.js';
8
- import { bindMainModelRequestIntent, requestIntentReferenceIds, requestIntentTaskType, RequestIntentSubmissionSchema } from './decisions/request-intent.js';
8
+ import { createRequestIntentContext, unresolvedRequestIntent, validateMainModelRequestIntent, requestIntentReferenceIds, requestIntentMessageRefs, requestIntentTaskType, RequestIntentSubmissionSchema } from './decisions/request-intent.js';
9
9
  import { memoryOwnerKind } from './memory-owner.js';
10
10
  export const TASK_PREPARE_TOOL = 'prepare_requested_work';
11
- export const ON_DEMAND_GUIDANCE = 'The original user request may be answered now without selecting a task category. No execution task has been prepared yet. Preserve the original utterance, every requested action, negation, quotation, target uncertainty, and current-session references; never replace it with a model rewrite. Use only the supplied active Goal and proposal references from this exact native session, never another chat. Classify relation as new, same_scope_continuation, scope_change, or unknown, and action as answer, research, verify, change, operate, or unknown; do not infer either from a fixed phrase or tool name. “Check how it behaves” is verification/research even when the next tool is Bash. This interpretation grants no native permission. When the decision provider is unavailable, abstains, or returns unknown, interpret the same context in the main model; ask the user only if the action or referenced target remains unclear, and preserve active work while waiting. Native read, glob, grep, web_search and web_fetch demands can gather evidence without preparation. Do not call prepare_requested_work merely to read a plan or inspect files. prepare_requested_work accepts either the legacy taskType alone or a requestIntent with exact evidenceRefs from the supplied context; it never accepts a rewritten task or target and never changes native permissions. Installed Skill reads need no preparation and do not activate execution. Do not prepare work merely to load a skill. Plan, Goal, cancellation, memory-owner and execution ownership still apply. If only run_code is exposed, use the exact preparation-only carrier returned by this tool contract; the host intercepts it without evaluating code.';
11
+ export const ON_DEMAND_GUIDANCE = 'The original user request may be answered now without selecting a task category. Ordinary native Bash needs no memory, Goal or prepare_requested_work round trip when the host confirms there is no owned task; native permissions and human Stop remain authoritative. Owned or explicitly enrolled work retains its authority checks. Preserve the original utterance, every requested action, negation, quotation, target uncertainty, and current-session references; never replace it with a model rewrite. Use only the supplied active Goal and proposal references from this exact native session, never another chat. Classify relation as new, same_scope_continuation, scope_change, or unknown, and action as answer, research, verify, change, operate, or unknown; do not infer either from a fixed phrase or tool name. “Check how it behaves” is verification/research even when the next tool is Bash. This interpretation grants no native permission. When the decision provider is unavailable, abstains, or returns unknown, interpret the same context in the main model; ask the user only if the action or referenced target remains unclear, and preserve active work while waiting. Native read, glob, grep, web_search and web_fetch demands can gather evidence without preparation. Do not call prepare_requested_work merely to read a plan or inspect files. prepare_requested_work accepts either the legacy taskType alone or a requestIntent with exact evidenceRefs from the supplied context; it never accepts a rewritten task or target and never changes native permissions. Installed Skill reads need no preparation and do not activate execution. Do not prepare work merely to load a skill. Plan, Goal, cancellation, memory-owner and execution ownership still apply. If only run_code is exposed, use the exact preparation-only carrier returned by this tool contract; the host intercepts it without evaluating code.';
12
12
  const ACTION_TYPES = TASK_TYPES.filter(type => type !== 'chat');
13
+ const NO_ACTIVE_GOAL_GUIDANCE = 'The current context has no active Goal. same_scope_continuation may refer to the exact current-session conversation without a formal Goal; it grants no execution permission. scope_change requires an active Goal or task. If the original request clearly specifies a self-contained task, use relation=new and the action it requests (verify for verification), with the exact current evidenceRefs. Otherwise clarify the intended target with the user. Preserve the original scope, constraints and native permissions.';
13
14
  const preparationFieldsSchema = z.object({
14
15
  taskType: z.enum(ACTION_TYPES).optional(),
15
16
  requestIntent: RequestIntentSubmissionSchema.optional(),
@@ -46,6 +47,7 @@ function automaticPreparationType(intent, requestIntent, name) {
46
47
  return intent.taskType;
47
48
  return ['read', 'glob', 'grep', 'web_search', 'web_fetch'].includes(name) ? 'research' : undefined;
48
49
  }
50
+ const UNOWNED_NATIVE_TOOLS = new Set(['bash', 'read', 'glob', 'grep', 'web_search', 'web_fetch', 'skill']);
49
51
  function denied(reason) { return { kind: 'deny', reason }; }
50
52
  /** A protocol carrier, not JavaScript evaluation. Only this exact JSON-literal call is recognized. */
51
53
  export function preparationCarrier(value) {
@@ -78,6 +80,8 @@ export class OnDemandIntake {
78
80
  #executions = new WeakMap();
79
81
  #disposers = [];
80
82
  #pending = new Set();
83
+ #controlTools = new Map();
84
+ #controlExecutions = new WeakMap();
81
85
  #lifecycle = new AbortController();
82
86
  #tools;
83
87
  #startupSkillReader;
@@ -87,6 +91,48 @@ export class OnDemandIntake {
87
91
  this.host = host;
88
92
  this.options = options;
89
93
  }
94
+ /** Exact host-owned implementations, never a name-only execution bypass. */
95
+ registerControlTool(definition) {
96
+ this.#controlTools.set(definition.name, definition.execute);
97
+ return () => { if (this.#controlTools.get(definition.name) === definition.execute)
98
+ this.#controlTools.delete(definition.name); };
99
+ }
100
+ isControl(execution) {
101
+ const proof = this.#controlExecutions.get(execution);
102
+ return !this.#stopped && !execution.signal.aborted && !!proof
103
+ && (!proof.turn || this.bound(execution) === proof.turn && !proof.turn.input.signal.aborted && !['closed', 'stale'].includes(proof.turn.status))
104
+ && this.definition(execution)?.execute === proof.execute && canonicalContentHash(execution.arguments) === proof.digest
105
+ && (proof.invoke ? [...this.#controlTools].some(([name, invoke]) => invoke === proof.invoke
106
+ && this.#tools?.get(name, execution.agent)?.execute === invoke) : this.#controlTools.get(execution.name) === proof.execute);
107
+ }
108
+ controlTask(execution) {
109
+ return this.isControl(execution) ? this.#controlExecutions.get(execution)?.turn?.task : undefined;
110
+ }
111
+ controlCall(execution, actual) {
112
+ if (this.#controlTools.get(execution.name) === actual.execute)
113
+ return { execute: actual.execute, digest: canonicalContentHash(execution.arguments) };
114
+ if (execution.name !== 'run_code' || !execution.arguments || typeof execution.arguments !== 'object' || Array.isArray(execution.arguments))
115
+ return undefined;
116
+ const value = execution.arguments;
117
+ if (Object.keys(value).sort().join(',') !== 'code,description' || typeof value.code !== 'string' || value.code.length > 8192
118
+ || typeof value.description !== 'string' || !value.description.trim())
119
+ return undefined;
120
+ const code = value.code.trim().replace(/;$/u, '');
121
+ for (const [name, invoke] of this.#controlTools) {
122
+ if (this.#tools?.get(name, execution.agent)?.execute !== invoke)
123
+ continue;
124
+ const prefix = `return await tools.${name}(`;
125
+ if (!code.startsWith(prefix) || !code.endsWith(')'))
126
+ continue;
127
+ try {
128
+ const args = JSON.parse(code.slice(prefix.length, -1));
129
+ if (code === prefix + JSON.stringify(args) + ')')
130
+ return { execute: actual.execute, digest: canonicalContentHash(execution.arguments), invoke, args };
131
+ }
132
+ catch { /* Nonliteral programs keep ordinary execution admission. */ }
133
+ }
134
+ return undefined;
135
+ }
90
136
  watch(promise) {
91
137
  this.#pending.add(promise);
92
138
  void promise.then(() => this.#pending.delete(promise), () => this.#pending.delete(promise));
@@ -176,6 +222,20 @@ export class OnDemandIntake {
176
222
  this.#skillReaders.set(input.agent, this.#startupSkillReader ?? this.#tools?.get('skill', input.agent)?.execute);
177
223
  if (!humanMessages(input.messages).length)
178
224
  throw new Error('Original human input is required before on-demand intake');
225
+ // Native authority is independent of optional memory, Skills and model
226
+ // classification. Never manufacture an owned task merely to run Bash.
227
+ if (!this.options.onlyWhenDeferred && await this.host.nativeOwnership?.(state.input) === 'unowned') {
228
+ this.assertCurrent(state);
229
+ state.nativeUnowned = true;
230
+ const context = createRequestIntentContext({ task: state.task, messageRefs: requestIntentMessageRefs(state.input.messages, state.task) });
231
+ if (context) {
232
+ state.requestIntentContext = context;
233
+ state.requestIntentContextDigest = canonicalContentHash(context);
234
+ state.requestIntent = unresolvedRequestIntent(context, 'native_unowned_request');
235
+ }
236
+ state.status = 'answer';
237
+ return true;
238
+ }
179
239
  try {
180
240
  state.intent = await this.host.classify(input, state.task);
181
241
  }
@@ -252,6 +312,7 @@ export class OnDemandIntake {
252
312
  // Provisional intent cannot select a different run's memory validator.
253
313
  state.memoryOwner = 'conversation';
254
314
  await this.host.answerContext?.prepare(state.input, state.task, state.intent.taskType ?? null, state.memoryOwner);
315
+ state.answerContextReady = this.host.answerContext !== undefined;
255
316
  this.assertCurrent(state);
256
317
  state.status = 'answer';
257
318
  return true;
@@ -329,6 +390,7 @@ export class OnDemandIntake {
329
390
  this.assertCurrent(state);
330
391
  return;
331
392
  }
393
+ state.nativeUnowned = false;
332
394
  state.status = 'preparing';
333
395
  state.taskType = taskType;
334
396
  const operation = (async () => {
@@ -355,7 +417,13 @@ export class OnDemandIntake {
355
417
  // A declined selection preserves this request for a conversational acknowledgement.
356
418
  // It is not admission: preparation remains consumed and tools still need a ready host.
357
419
  state.selectionPending = error instanceof ExecutionSelectionPending && !state.input.signal.aborted && !signal.aborted;
358
- state.status = state.selectionPending ? 'answer' : 'stale';
420
+ // Preparation failure is not a change of human authority. Keep the
421
+ // captured request retryable, but never revive Stop/cancellation. A
422
+ // new call must pass host admission and native permission checks again.
423
+ state.status = state.input.signal.aborted || signal.aborted || this.#stopped ? 'stale' : 'answer';
424
+ delete state.preparedIntentDigest;
425
+ delete state.taskType;
426
+ state.memoryOwner = 'none';
359
427
  }
360
428
  throw error;
361
429
  }
@@ -369,9 +437,18 @@ export class OnDemandIntake {
369
437
  if (!state.requestIntentContext || state.requestIntentContextDigest !== canonicalContentHash(state.requestIntentContext)) {
370
438
  throw new Error('Request interpretation context is stale');
371
439
  }
372
- const bound = bindMainModelRequestIntent(submission, state.requestIntentContext);
373
- if (!bound)
374
- throw new Error('Request interpretation references another request, stale revision, or unknown proposal');
440
+ const result = validateMainModelRequestIntent(submission, state.requestIntentContext);
441
+ if (!result.ok) {
442
+ switch (result.reason) {
443
+ case 'no_active_goal': throw new Error(`Request relation ${submission.relation} cannot be used without an active Goal. ${NO_ACTIVE_GOAL_GUIDANCE}`);
444
+ case 'missing_reference': throw new Error('Request interpretation is missing required current message or active Goal references. Use the exact current evidenceRefs from the supplied context.');
445
+ case 'unknown_reference': throw new Error('Request interpretation references another request, stale revision, or unknown proposal. Use only the exact current evidenceRefs from the supplied context.');
446
+ case 'unresolved_intent': throw new Error('Request relation or action is unresolved. Interpret the original request and current context; clarify with the user if its action or target remains unclear.');
447
+ case 'invalid_submission': throw new Error('Invalid request interpretation. Supply a relation, action and unique exact current evidenceRefs.');
448
+ case 'invalid_task_operation': throw new Error('The proposed task operation is not allowed for the current SQLite task state and revision. Use task_operation or /kioku-task with an allowed explicit operation; native permissions and required evidence remain unchanged.');
449
+ }
450
+ }
451
+ const bound = result.decision;
375
452
  const prior = state.requestIntent;
376
453
  if (prior?.source === 'decision-provider' && prior.relation !== 'unknown' && prior.action !== 'unknown') {
377
454
  if (prior.relation !== bound.relation || prior.action !== bound.action) {
@@ -387,19 +464,19 @@ export class OnDemandIntake {
387
464
  // Project the immutable human batch captured before that waterfall.
388
465
  if (state?.input.turn === input.turn && state.input.agent !== input.agent)
389
466
  throw new Error('Answer projection native agent changed');
390
- const projected = state?.input.turn === input.turn && !state.confirmationResume && this.host.answerContext
467
+ const projected = state?.input.turn === input.turn && !state.nativeUnowned && state.answerContextReady && !state.confirmationResume && this.host.answerContext
391
468
  ? await this.host.answerContext.project(state.input, messages, this.ownerIdentity(state)) : messages;
392
469
  return this.guidance(projected, state?.input.turn === input.turn ? state : undefined);
393
470
  }
394
471
  async beforeRequest(agent) {
395
472
  const state = agent.session && this.#turns.get(agent.session.id);
396
- if (state && state.input.agent === agent && state.status === 'answer' && this.pending(agent)) {
473
+ if (state && !state.nativeUnowned && state.answerContextReady && state.input.agent === agent && state.status === 'answer' && this.pending(agent)) {
397
474
  await this.host.answerContext?.beforeRequest(state.input, this.ownerIdentity(state));
398
475
  }
399
476
  }
400
477
  async fence(agent, request) {
401
478
  const state = agent.session && this.#turns.get(agent.session.id);
402
- if (state && state.input.agent === agent && state.status === 'answer' && this.pending(agent)) {
479
+ if (state && !state.nativeUnowned && state.answerContextReady && state.input.agent === agent && state.status === 'answer' && this.pending(agent)) {
403
480
  await this.host.answerContext?.fence(state.input, request, this.ownerIdentity(state));
404
481
  }
405
482
  }
@@ -409,11 +486,12 @@ export class OnDemandIntake {
409
486
  const intentText = context ? `\n\nCurrent request references and same-session work (host-bound, advisory only):\n${JSON.stringify({
410
487
  references: requestIntentReferenceIds(context),
411
488
  activeGoal: context.activeGoal ?? null,
489
+ activeTask: context.activeTask ?? null,
412
490
  proposals: context.proposals.map(({ id, revision, digest, text }) => ({ id, revision, digest, text })),
413
491
  decision: interpretation ? { relation: interpretation.relation, action: interpretation.action, source: interpretation.source,
414
492
  policyVersion: interpretation.policyVersion, evidence: interpretation.evidence, unresolvedReason: interpretation.unresolvedReason ?? null } : null,
415
493
  })}\nUse only these exact references in requestIntent.evidenceRefs. The original human message remains unchanged.` : '';
416
- const text = ON_DEMAND_GUIDANCE + intentText;
494
+ const text = ON_DEMAND_GUIDANCE + intentText + (context && !context.activeGoal && !context.activeTask ? `\n${NO_ACTIVE_GOAL_GUIDANCE}` : '');
417
495
  return [...messages, { id: randomUUID(), role: 'user', content: [{ type: 'text', text }],
418
496
  source: { kind: KIOKUKO_DSH_SOURCE_KIND, form: 'snapshot', sections: [{ name: 'on-demand-intake', text }] } }];
419
497
  }
@@ -422,8 +500,39 @@ export class OnDemandIntake {
422
500
  return state && { task: state.task, taskType: state.taskType ?? state.intent.taskType ?? null, status: state.status, turn: state.input.turn,
423
501
  ...(state.requestIntent ? { requestIntent: structuredClone(state.requestIntent) } : {}), memoryOwner: state.memoryOwner };
424
502
  }
503
+ /** Refresh only authority facts after a committed control operation; retain the exact human request. */
504
+ taskStateChanged(task) {
505
+ const state = this.#turns.get(task.sessionId);
506
+ if (!state || ['closed', 'stale'].includes(state.status) || state.input.signal.aborted || !state.requestIntentContext)
507
+ return;
508
+ state.nativeUnowned = false;
509
+ const previous = state.requestIntentContext.activeTask;
510
+ if (previous?.taskId === task.taskId && previous.revision === task.revision && previous.generation === task.generation)
511
+ return;
512
+ const context = createRequestIntentContext({ ...state.requestIntentContext, activeTask: task,
513
+ ...(state.requestIntentContext.activeGoal?.runId === task.runId ? {} : { activeGoal: undefined }) });
514
+ if (!context)
515
+ return;
516
+ state.requestIntentContext = context;
517
+ state.requestIntentContextDigest = canonicalContentHash(context);
518
+ state.requestIntent = unresolvedRequestIntent(context, 'task_state_changed');
519
+ state.status = 'answer';
520
+ state.existing = false;
521
+ state.memoryOwner = 'none';
522
+ delete state.preparedIntentDigest;
523
+ }
425
524
  /** A current host-validated control call, never arbitrary code or a name-based exemption. */
525
+ /** Exact registered native-tool proof, never a model flag or a generic task-control bypass. */
526
+ unownedNative(execution) {
527
+ const state = this.bound(execution), proof = this.#executions.get(execution);
528
+ return !this.#stopped && !execution.signal.aborted && UNOWNED_NATIVE_TOOLS.has(execution.name) && execution.parent === undefined
529
+ && !!state && state.nativeUnowned === true && state.status === 'answer' && !state.input.signal.aborted
530
+ && !!proof && proof.turn === state && proof.execute === this.definition(execution)?.execute
531
+ && proof.nativeUnownedDigest === canonicalContentHash(execution.arguments);
532
+ }
426
533
  preparationOnly(execution) {
534
+ if (this.isControl(execution))
535
+ return true;
427
536
  const state = this.bound(execution), proof = this.#executions.get(execution);
428
537
  if (this.#stopped || execution.signal.aborted || execution.parent !== undefined || !state || state.input.signal.aborted
429
538
  || !proof || proof.turn !== state || this.definition(execution)?.execute !== proof.execute
@@ -529,6 +638,23 @@ export class OnDemandIntake {
529
638
  const actual = this.definition(execution);
530
639
  if (!actual || typeof actual.execute !== 'function')
531
640
  return denied('Unknown native tool definition');
641
+ const control = this.controlCall(execution, actual);
642
+ if (control) {
643
+ const turn = this.bound(execution);
644
+ if (execution.agent?.session && this.#turns.has(execution.agent.session.id) && !turn)
645
+ return denied('Stale task control request');
646
+ if (turn) {
647
+ try {
648
+ this.assertCurrent(turn);
649
+ }
650
+ catch {
651
+ return denied('Stale task control request');
652
+ }
653
+ }
654
+ this.#controlExecutions.set(execution, { ...control, ...(turn ? { turn } : {}) });
655
+ const decision = await next();
656
+ return decision?.kind === 'cancel' ? denied('Native tool policy cancelled this call') : decision;
657
+ }
532
658
  const state = this.bound(execution);
533
659
  if (!state) {
534
660
  if (execution.agent?.session && this.#turns.has(execution.agent.session.id))
@@ -543,6 +669,18 @@ export class OnDemandIntake {
543
669
  this.assertCurrent(state);
544
670
  if (state.confirmationResume && execution.name !== TASK_PREPARE_TOOL && this.host.ready(state.input.agent, state.input.turn))
545
671
  this.acknowledgeExisting(state);
672
+ if (state.nativeUnowned && UNOWNED_NATIVE_TOOLS.has(execution.name) && execution.parent === undefined) {
673
+ if (await this.host.nativeOwnership?.(state.input) !== 'unowned') {
674
+ state.nativeUnowned = false;
675
+ return denied('Native execution acquired a Kiokuko owner; its current authority is required');
676
+ }
677
+ this.assertCurrent(state);
678
+ if (this.definition(execution)?.execute !== actual.execute)
679
+ return denied('Native tool definition changed');
680
+ this.#executions.set(execution, { turn: state, execute: actual.execute, nativeUnownedDigest: canonicalContentHash(execution.arguments) });
681
+ const decision = await next();
682
+ return decision?.kind === 'cancel' ? denied('Native tool policy cancelled this call') : decision;
683
+ }
546
684
  const skillReader = this.#skillReaders.get(state.input.agent);
547
685
  const skillRead = execution.name === 'skill' && skillReader !== undefined && actual.execute === skillReader && state.status === 'answer';
548
686
  const carrier = execution.name === 'run_code' ? preparationCarrier(execution.arguments) : undefined;
@@ -586,6 +724,17 @@ export class OnDemandIntake {
586
724
  this.#disposers.push(context.on('tools/execute', async (execution, next) => {
587
725
  if (execution.agent && this.host.nativeChild?.(execution.agent))
588
726
  return next();
727
+ const control = this.#controlExecutions.get(execution);
728
+ if (control) {
729
+ if (!this.isControl(execution))
730
+ throw new Error('Task control identity or arguments changed');
731
+ execution.signal = AbortSignal.any([execution.signal, this.#lifecycle.signal, ...(control.turn ? [control.turn.input.signal] : [])]);
732
+ if (!control.invoke)
733
+ return next();
734
+ const result = await control.invoke(control.args, execution);
735
+ return { isError: false, value: { logs: ['Host task operation. No program was evaluated.'], result },
736
+ content: [{ type: 'text', text: JSON.stringify(result) }] };
737
+ }
589
738
  const proof = this.#executions.get(execution);
590
739
  if (!proof)
591
740
  return next(); // Existing independently admitted runs keep their original path.
@@ -594,6 +743,14 @@ export class OnDemandIntake {
594
743
  throw new Error('On-demand dispatch identity changed');
595
744
  this.assertCurrent(state);
596
745
  execution.signal = AbortSignal.any([execution.signal, state.input.signal, this.#lifecycle.signal]);
746
+ if (proof.nativeUnownedDigest !== undefined) {
747
+ if (!this.unownedNative(execution) || await this.host.nativeOwnership?.(state.input) !== 'unowned') {
748
+ state.nativeUnowned = false;
749
+ throw new Error('Native unowned authority changed or became unavailable');
750
+ }
751
+ this.assertCurrent(state);
752
+ return next();
753
+ }
597
754
  if (!proof.carrier)
598
755
  return next();
599
756
  const carrier = preparationCarrier(execution.arguments);
@@ -629,6 +786,8 @@ export class OnDemandIntake {
629
786
  return 'On-demand intake is stopped or cancelled';
630
787
  if (execution.agent && this.host.nativeChild?.(execution.agent))
631
788
  return undefined;
789
+ if (this.isControl(execution))
790
+ return undefined;
632
791
  const state = this.bound(execution), actual = this.definition(execution);
633
792
  if (!actual)
634
793
  return 'Unknown native tool definition';
@@ -641,6 +800,8 @@ export class OnDemandIntake {
641
800
  const proof = this.#executions.get(execution);
642
801
  if (!proof || proof.turn !== state || proof.execute !== actual.execute || ['closed', 'stale', 'capturing'].includes(state.status))
643
802
  return 'Tool execution has no current on-demand preparation';
803
+ if (proof.nativeUnownedDigest !== undefined)
804
+ return this.unownedNative(execution) ? undefined : 'Native unowned execution proof changed';
644
805
  if (proof.carrier)
645
806
  return (state.status === 'answer' || state.status === 'prepared' && this.host.ready(state.input.agent, state.input.turn))
646
807
  && canonicalContentHash(preparationCarrier(execution.arguments) ?? null) === proof.carrierDigest ? undefined : 'Preparation carrier is not current';