kiokuko-dsh 0.2.1 → 0.2.3

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 (353) hide show
  1. package/PERMISSIONS.md +21 -28
  2. package/README.ja.md +8 -6
  3. package/README.md +12 -6
  4. package/THIRD_PARTY_NOTICES.md +8 -0
  5. package/dist/client.cjs +2248 -1383
  6. package/dist/client.d.ts +3 -1
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/context/continuity-view.d.ts +1 -1
  9. package/dist/deep-thinker/configuration.d.ts.map +1 -1
  10. package/dist/deep-thinker/configuration.js +8 -5
  11. package/dist/deep-thinker/configuration.js.map +1 -1
  12. package/dist/deep-thinker/core/contracts.d.ts +107 -13
  13. package/dist/deep-thinker/core/contracts.d.ts.map +1 -1
  14. package/dist/deep-thinker/core/contracts.js +4 -2
  15. package/dist/deep-thinker/core/contracts.js.map +1 -1
  16. package/dist/deep-thinker/memory-finalizer.d.ts +10 -10
  17. package/dist/deep-thinker/memory-finalizer.js +2 -2
  18. package/dist/deep-thinker/memory-finalizer.js.map +1 -1
  19. package/dist/deep-thinker/report.d.ts +1 -1
  20. package/dist/deep-thinker/store.d.ts +10 -10
  21. package/dist/deep-thinker/store.d.ts.map +1 -1
  22. package/dist/deep-thinker/store.js +2 -2
  23. package/dist/deep-thinker/store.js.map +1 -1
  24. package/dist/dsh/coding-workflow/contracts.d.ts +120 -0
  25. package/dist/dsh/coding-workflow/contracts.d.ts.map +1 -0
  26. package/dist/dsh/coding-workflow/contracts.js +77 -0
  27. package/dist/dsh/coding-workflow/contracts.js.map +1 -0
  28. package/dist/dsh/coding-workflow/host.d.ts +41 -0
  29. package/dist/dsh/coding-workflow/host.d.ts.map +1 -0
  30. package/dist/dsh/coding-workflow/host.js +235 -0
  31. package/dist/dsh/coding-workflow/host.js.map +1 -0
  32. package/dist/dsh/coding-workflow/intent.d.ts +15 -0
  33. package/dist/dsh/coding-workflow/intent.d.ts.map +1 -0
  34. package/dist/dsh/coding-workflow/intent.js +86 -0
  35. package/dist/dsh/coding-workflow/intent.js.map +1 -0
  36. package/dist/dsh/coding-workflow/service.d.ts +155 -0
  37. package/dist/dsh/coding-workflow/service.d.ts.map +1 -0
  38. package/dist/dsh/coding-workflow/service.js +282 -0
  39. package/dist/dsh/coding-workflow/service.js.map +1 -0
  40. package/dist/dsh/coding-workflow/store.d.ts +17 -0
  41. package/dist/dsh/coding-workflow/store.d.ts.map +1 -0
  42. package/dist/dsh/coding-workflow/store.js +77 -0
  43. package/dist/dsh/coding-workflow/store.js.map +1 -0
  44. package/dist/dsh/completion-verifiers.d.ts +39 -0
  45. package/dist/dsh/completion-verifiers.d.ts.map +1 -0
  46. package/dist/dsh/completion-verifiers.js +9 -0
  47. package/dist/dsh/completion-verifiers.js.map +1 -0
  48. package/dist/dsh/config.d.ts +5 -1
  49. package/dist/dsh/config.d.ts.map +1 -1
  50. package/dist/dsh/core/host.d.ts +1 -1
  51. package/dist/dsh/core/host.d.ts.map +1 -1
  52. package/dist/dsh/core/host.js +97 -11
  53. package/dist/dsh/core/host.js.map +1 -1
  54. package/dist/dsh/core/index.d.ts +4 -4
  55. package/dist/dsh/core/index.js +2 -2
  56. package/dist/dsh/core/index.js.map +1 -1
  57. package/dist/dsh/core/tasks.d.ts +2 -0
  58. package/dist/dsh/core/tasks.d.ts.map +1 -1
  59. package/dist/dsh/core/tasks.js +43 -1
  60. package/dist/dsh/core/tasks.js.map +1 -1
  61. package/dist/dsh/core-runtime.d.ts +1 -0
  62. package/dist/dsh/core-runtime.d.ts.map +1 -1
  63. package/dist/dsh/core-runtime.js +4 -1
  64. package/dist/dsh/core-runtime.js.map +1 -1
  65. package/dist/dsh/decisions/config.d.ts +2 -2
  66. package/dist/dsh/enno-delegation.js +2 -2
  67. package/dist/dsh/enno-delegation.js.map +1 -1
  68. package/dist/dsh/execution-command.d.ts +4 -0
  69. package/dist/dsh/execution-command.d.ts.map +1 -0
  70. package/dist/dsh/execution-command.js +52 -0
  71. package/dist/dsh/execution-command.js.map +1 -0
  72. package/dist/dsh/execution-journal.d.ts +17 -0
  73. package/dist/dsh/execution-journal.d.ts.map +1 -0
  74. package/dist/dsh/execution-journal.js +69 -0
  75. package/dist/dsh/execution-journal.js.map +1 -0
  76. package/dist/dsh/execution-result.d.ts +20 -0
  77. package/dist/dsh/execution-result.d.ts.map +1 -0
  78. package/dist/dsh/execution-result.js +7 -0
  79. package/dist/dsh/execution-result.js.map +1 -0
  80. package/dist/dsh/execution-selection.d.ts +150 -23
  81. package/dist/dsh/execution-selection.d.ts.map +1 -1
  82. package/dist/dsh/execution-selection.js +18 -6
  83. package/dist/dsh/execution-selection.js.map +1 -1
  84. package/dist/dsh/host-adapter/admission.d.ts.map +1 -1
  85. package/dist/dsh/host-adapter/admission.js +33 -22
  86. package/dist/dsh/host-adapter/admission.js.map +1 -1
  87. package/dist/dsh/host-adapter/boundaries.d.ts.map +1 -1
  88. package/dist/dsh/host-adapter/boundaries.js +2 -0
  89. package/dist/dsh/host-adapter/boundaries.js.map +1 -1
  90. package/dist/dsh/host-adapter/context.d.ts.map +1 -1
  91. package/dist/dsh/host-adapter/context.js +18 -13
  92. package/dist/dsh/host-adapter/context.js.map +1 -1
  93. package/dist/dsh/host-adapter/lifecycle.d.ts.map +1 -1
  94. package/dist/dsh/host-adapter/lifecycle.js +12 -0
  95. package/dist/dsh/host-adapter/lifecycle.js.map +1 -1
  96. package/dist/dsh/host-adapter/routing.js +1 -1
  97. package/dist/dsh/host-adapter/routing.js.map +1 -1
  98. package/dist/dsh/host-adapter/turn-state.js +1 -1
  99. package/dist/dsh/host-adapter/turn-state.js.map +1 -1
  100. package/dist/dsh/host-adapter.d.ts.map +1 -1
  101. package/dist/dsh/host-adapter.js +61 -18
  102. package/dist/dsh/host-adapter.js.map +1 -1
  103. package/dist/dsh/index.d.ts +4 -2
  104. package/dist/dsh/index.d.ts.map +1 -1
  105. package/dist/dsh/index.js +7 -0
  106. package/dist/dsh/index.js.map +1 -1
  107. package/dist/dsh/intake-gate.d.ts +1 -0
  108. package/dist/dsh/intake-gate.d.ts.map +1 -1
  109. package/dist/dsh/intake-gate.js +9 -1
  110. package/dist/dsh/intake-gate.js.map +1 -1
  111. package/dist/dsh/lisp/approval.d.ts +2 -1
  112. package/dist/dsh/lisp/approval.d.ts.map +1 -1
  113. package/dist/dsh/lisp/approval.js +4 -3
  114. package/dist/dsh/lisp/approval.js.map +1 -1
  115. package/dist/dsh/lisp/candidate.d.ts +1 -1
  116. package/dist/dsh/lisp/code-intelligence-contracts.d.ts +78 -0
  117. package/dist/dsh/lisp/code-intelligence-contracts.d.ts.map +1 -0
  118. package/dist/dsh/lisp/code-intelligence-contracts.js +54 -0
  119. package/dist/dsh/lisp/code-intelligence-contracts.js.map +1 -0
  120. package/dist/dsh/lisp/code-intelligence-provider.d.ts +116 -0
  121. package/dist/dsh/lisp/code-intelligence.d.ts +13 -0
  122. package/dist/dsh/lisp/code-intelligence.d.ts.map +1 -0
  123. package/dist/dsh/lisp/code-intelligence.js +181 -0
  124. package/dist/dsh/lisp/code-intelligence.js.map +1 -0
  125. package/dist/dsh/lisp/coding-choice.d.ts +4 -1
  126. package/dist/dsh/lisp/coding-choice.d.ts.map +1 -1
  127. package/dist/dsh/lisp/coding-choice.js +26 -10
  128. package/dist/dsh/lisp/coding-choice.js.map +1 -1
  129. package/dist/dsh/lisp/compiled-cache.d.ts.map +1 -1
  130. package/dist/dsh/lisp/compiled-cache.js +3 -2
  131. package/dist/dsh/lisp/compiled-cache.js.map +1 -1
  132. package/dist/dsh/lisp/contracts.d.ts +4 -0
  133. package/dist/dsh/lisp/contracts.d.ts.map +1 -1
  134. package/dist/dsh/lisp/contracts.js +1 -0
  135. package/dist/dsh/lisp/contracts.js.map +1 -1
  136. package/dist/dsh/lisp/manager.d.ts +9 -1
  137. package/dist/dsh/lisp/manager.d.ts.map +1 -1
  138. package/dist/dsh/lisp/manager.js +91 -24
  139. package/dist/dsh/lisp/manager.js.map +1 -1
  140. package/dist/dsh/lisp/model-result.d.ts.map +1 -1
  141. package/dist/dsh/lisp/model-result.js +35 -1
  142. package/dist/dsh/lisp/model-result.js.map +1 -1
  143. package/dist/dsh/lisp/proposal-batch.d.ts +2 -0
  144. package/dist/dsh/lisp/proposal-batch.d.ts.map +1 -1
  145. package/dist/dsh/lisp/proposal-batch.js +32 -2
  146. package/dist/dsh/lisp/proposal-batch.js.map +1 -1
  147. package/dist/dsh/lisp/request-surface.d.ts +12 -2
  148. package/dist/dsh/lisp/request-surface.d.ts.map +1 -1
  149. package/dist/dsh/lisp/request-surface.js +1 -1
  150. package/dist/dsh/lisp/request-surface.js.map +1 -1
  151. package/dist/dsh/lisp/sandbox.d.ts +3 -0
  152. package/dist/dsh/lisp/sandbox.d.ts.map +1 -1
  153. package/dist/dsh/lisp/sandbox.js +13 -6
  154. package/dist/dsh/lisp/sandbox.js.map +1 -1
  155. package/dist/dsh/lisp/surface.d.ts +1 -1
  156. package/dist/dsh/lisp/surface.d.ts.map +1 -1
  157. package/dist/dsh/lisp/surface.js +118 -23
  158. package/dist/dsh/lisp/surface.js.map +1 -1
  159. package/dist/dsh/lisp/worker.d.ts +2 -0
  160. package/dist/dsh/lisp/worker.d.ts.map +1 -1
  161. package/dist/dsh/lisp/worker.js +7 -5
  162. package/dist/dsh/lisp/worker.js.map +1 -1
  163. package/dist/dsh/lisp-service-key.d.ts +9 -0
  164. package/dist/dsh/lisp-service-key.d.ts.map +1 -1
  165. package/dist/dsh/lisp-service-key.js +11 -0
  166. package/dist/dsh/lisp-service-key.js.map +1 -1
  167. package/dist/dsh/memory-application.d.ts +1 -1
  168. package/dist/dsh/memory-application.d.ts.map +1 -1
  169. package/dist/dsh/memory-application.js +4 -3
  170. package/dist/dsh/memory-application.js.map +1 -1
  171. package/dist/dsh/model-auto/candidates.d.ts.map +1 -1
  172. package/dist/dsh/model-auto/candidates.js +31 -22
  173. package/dist/dsh/model-auto/candidates.js.map +1 -1
  174. package/dist/dsh/model-configuration.d.ts +145 -2
  175. package/dist/dsh/model-configuration.d.ts.map +1 -1
  176. package/dist/dsh/model-configuration.js +10 -3
  177. package/dist/dsh/model-configuration.js.map +1 -1
  178. package/dist/dsh/model-selection-ui.d.ts.map +1 -1
  179. package/dist/dsh/model-selection-ui.js +7 -2
  180. package/dist/dsh/model-selection-ui.js.map +1 -1
  181. package/dist/dsh/models/config-store.d.ts +8 -0
  182. package/dist/dsh/models/config-store.d.ts.map +1 -0
  183. package/dist/dsh/models/config-store.js +49 -0
  184. package/dist/dsh/models/config-store.js.map +1 -0
  185. package/dist/dsh/models/contracts.d.ts +107 -0
  186. package/dist/dsh/models/contracts.d.ts.map +1 -0
  187. package/dist/dsh/models/contracts.js +104 -0
  188. package/dist/dsh/models/contracts.js.map +1 -0
  189. package/dist/dsh/models/metadata.d.ts +7 -0
  190. package/dist/dsh/models/metadata.d.ts.map +1 -0
  191. package/dist/dsh/models/metadata.js +13 -0
  192. package/dist/dsh/models/metadata.js.map +1 -0
  193. package/dist/dsh/models/profiles.d.ts +10 -0
  194. package/dist/dsh/models/profiles.d.ts.map +1 -0
  195. package/dist/dsh/models/profiles.js +176 -0
  196. package/dist/dsh/models/profiles.js.map +1 -0
  197. package/dist/dsh/models/service.d.ts +97 -0
  198. package/dist/dsh/models/service.d.ts.map +1 -0
  199. package/dist/dsh/models/service.js +518 -0
  200. package/dist/dsh/models/service.js.map +1 -0
  201. package/dist/dsh/models/surface.d.ts +8 -0
  202. package/dist/dsh/models/surface.d.ts.map +1 -0
  203. package/dist/dsh/models/surface.js +162 -0
  204. package/dist/dsh/models/surface.js.map +1 -0
  205. package/dist/dsh/models/vendor/THIRD_PARTY_NOTICES.txt +134 -0
  206. package/dist/dsh/models/vendor/abortable.d.ts +3 -0
  207. package/dist/dsh/models/vendor/abortable.d.ts.map +1 -0
  208. package/dist/dsh/models/vendor/abortable.js +10 -0
  209. package/dist/dsh/models/vendor/abortable.js.map +1 -0
  210. package/dist/dsh/models/vendor/auth-contract.d.ts +67 -0
  211. package/dist/dsh/models/vendor/auth-contract.d.ts.map +1 -0
  212. package/dist/dsh/models/vendor/auth-contract.js +2 -0
  213. package/dist/dsh/models/vendor/auth-contract.js.map +1 -0
  214. package/dist/dsh/models/vendor/credentials.d.ts +58 -0
  215. package/dist/dsh/models/vendor/credentials.d.ts.map +1 -0
  216. package/dist/dsh/models/vendor/credentials.js +205 -0
  217. package/dist/dsh/models/vendor/credentials.js.map +1 -0
  218. package/dist/dsh/models/vendor/nous-oauth.d.ts +6 -0
  219. package/dist/dsh/models/vendor/nous-oauth.d.ts.map +1 -0
  220. package/dist/dsh/models/vendor/nous-oauth.js +113 -0
  221. package/dist/dsh/models/vendor/nous-oauth.js.map +1 -0
  222. package/dist/dsh/models/vendor/opencode-adapter.d.ts +38 -0
  223. package/dist/dsh/models/vendor/opencode-adapter.d.ts.map +1 -0
  224. package/dist/dsh/models/vendor/opencode-adapter.js +207 -0
  225. package/dist/dsh/models/vendor/opencode-adapter.js.map +1 -0
  226. package/dist/dsh/models/vendor/opencode-catalog.d.ts +73 -0
  227. package/dist/dsh/models/vendor/opencode-catalog.d.ts.map +1 -0
  228. package/dist/dsh/models/vendor/opencode-catalog.js +253 -0
  229. package/dist/dsh/models/vendor/opencode-catalog.js.map +1 -0
  230. package/dist/dsh/models/vendor/opencode-codec.d.ts +7 -0
  231. package/dist/dsh/models/vendor/opencode-codec.d.ts.map +1 -0
  232. package/dist/dsh/models/vendor/opencode-codec.js +107 -0
  233. package/dist/dsh/models/vendor/opencode-codec.js.map +1 -0
  234. package/dist/dsh/models/vendor/opencode-owned.generated.d.ts +114 -0
  235. package/dist/dsh/models/vendor/opencode-owned.generated.d.ts.map +1 -0
  236. package/dist/dsh/models/vendor/opencode-owned.generated.js +2867 -0
  237. package/dist/dsh/models/vendor/opencode-owned.generated.js.map +1 -0
  238. package/dist/dsh/models/vendor/opencode-replay.d.ts +17 -0
  239. package/dist/dsh/models/vendor/opencode-replay.d.ts.map +1 -0
  240. package/dist/dsh/models/vendor/opencode-replay.js +147 -0
  241. package/dist/dsh/models/vendor/opencode-replay.js.map +1 -0
  242. package/dist/dsh/models/vendor/opencode-sdk.d.ts +6 -0
  243. package/dist/dsh/models/vendor/opencode-sdk.d.ts.map +1 -0
  244. package/dist/dsh/models/vendor/opencode-sdk.js +49915 -0
  245. package/dist/dsh/models/vendor/opencode-sdk.js.map +7 -0
  246. package/dist/dsh/models/vendor/opencode-transport.d.ts +6 -0
  247. package/dist/dsh/models/vendor/opencode-transport.d.ts.map +1 -0
  248. package/dist/dsh/models/vendor/opencode-transport.js +70 -0
  249. package/dist/dsh/models/vendor/opencode-transport.js.map +1 -0
  250. package/dist/dsh/models/vendor/pi-ai.d.ts +23 -0
  251. package/dist/dsh/models/vendor/pi-ai.d.ts.map +1 -0
  252. package/dist/dsh/models/vendor/pi-ai.js +27 -0
  253. package/dist/dsh/models/vendor/pi-ai.js.map +1 -0
  254. package/dist/dsh/modules/lisp.d.ts +1 -1
  255. package/dist/dsh/modules/lisp.d.ts.map +1 -1
  256. package/dist/dsh/modules/lisp.js +2 -13
  257. package/dist/dsh/modules/lisp.js.map +1 -1
  258. package/dist/dsh/modules/resources.d.ts +3 -1
  259. package/dist/dsh/modules/resources.d.ts.map +1 -1
  260. package/dist/dsh/modules/resources.js +4 -0
  261. package/dist/dsh/modules/resources.js.map +1 -1
  262. package/dist/dsh/native-model-catalog.d.ts.map +1 -1
  263. package/dist/dsh/native-model-catalog.js +4 -3
  264. package/dist/dsh/native-model-catalog.js.map +1 -1
  265. package/dist/dsh/node-tap-summary.d.ts +8 -1
  266. package/dist/dsh/node-tap-summary.d.ts.map +1 -1
  267. package/dist/dsh/node-tap-summary.js +33 -3
  268. package/dist/dsh/node-tap-summary.js.map +1 -1
  269. package/dist/dsh/on-demand-intake.d.ts +1 -1
  270. package/dist/dsh/on-demand-intake.d.ts.map +1 -1
  271. package/dist/dsh/on-demand-intake.js +35 -14
  272. package/dist/dsh/on-demand-intake.js.map +1 -1
  273. package/dist/dsh/owned-evidence.d.ts +49 -0
  274. package/dist/dsh/owned-evidence.d.ts.map +1 -0
  275. package/dist/dsh/owned-evidence.js +69 -0
  276. package/dist/dsh/owned-evidence.js.map +1 -0
  277. package/dist/dsh/owned-execution.d.ts +99 -0
  278. package/dist/dsh/owned-execution.d.ts.map +1 -0
  279. package/dist/dsh/owned-execution.js +558 -0
  280. package/dist/dsh/owned-execution.js.map +1 -0
  281. package/dist/dsh/plan-transition.d.ts +5 -0
  282. package/dist/dsh/plan-transition.d.ts.map +1 -0
  283. package/dist/dsh/plan-transition.js +34 -0
  284. package/dist/dsh/plan-transition.js.map +1 -0
  285. package/dist/dsh/session-memory-finalizer.d.ts.map +1 -1
  286. package/dist/dsh/session-memory-finalizer.js +46 -3
  287. package/dist/dsh/session-memory-finalizer.js.map +1 -1
  288. package/dist/dsh/setup.d.ts +1 -1
  289. package/dist/dsh/setup.d.ts.map +1 -1
  290. package/dist/dsh/setup.js +2 -0
  291. package/dist/dsh/setup.js.map +1 -1
  292. package/dist/dsh/skill-prompts.json +1 -1
  293. package/dist/dsh/task-completion-host.js +3 -3
  294. package/dist/dsh/task-completion-host.js.map +1 -1
  295. package/dist/dsh/task-completion.d.ts +17 -0
  296. package/dist/dsh/task-completion.d.ts.map +1 -1
  297. package/dist/dsh/task-completion.js +144 -38
  298. package/dist/dsh/task-completion.js.map +1 -1
  299. package/dist/dsh/task-intake.d.ts.map +1 -1
  300. package/dist/dsh/task-intake.js +7 -0
  301. package/dist/dsh/task-intake.js.map +1 -1
  302. package/dist/enno-oduno/coding-workflow.d.ts +39 -0
  303. package/dist/enno-oduno/coding-workflow.d.ts.map +1 -0
  304. package/dist/enno-oduno/coding-workflow.js +33 -0
  305. package/dist/enno-oduno/coding-workflow.js.map +1 -0
  306. package/dist/enno-oduno/schemas.d.ts +10 -10
  307. package/dist/enno-oduno/store.d.ts.map +1 -1
  308. package/dist/enno-oduno/store.js +56 -1
  309. package/dist/enno-oduno/store.js.map +1 -1
  310. package/dist/enno-oduno/types.d.ts +1 -0
  311. package/dist/enno-oduno/types.d.ts.map +1 -1
  312. package/dist/enno-oduno/verifier.d.ts.map +1 -1
  313. package/dist/enno-oduno/verifier.js +4 -1
  314. package/dist/enno-oduno/verifier.js.map +1 -1
  315. package/dist/locale/en.json +1 -1
  316. package/dist/locale/ja.json +1 -1
  317. package/dist/locale/ko.json +1 -1
  318. package/dist/locale/zh-CN.json +1 -1
  319. package/dist/memory/application.d.ts +2 -1
  320. package/dist/memory/application.d.ts.map +1 -1
  321. package/dist/memory/application.js +26 -12
  322. package/dist/memory/application.js.map +1 -1
  323. package/dist/memory/evidence.d.ts +2 -0
  324. package/dist/memory/evidence.d.ts.map +1 -1
  325. package/dist/memory/evidence.js +3 -1
  326. package/dist/memory/evidence.js.map +1 -1
  327. package/dist/model-tools/contracts.d.ts +4 -4
  328. package/dist/models-client.cjs +635 -0
  329. package/dist/models-client.d.ts +26 -0
  330. package/dist/models-client.d.ts.map +1 -0
  331. package/dist/models-client.js +642 -0
  332. package/dist/models-client.js.map +1 -0
  333. package/docs/code-intelligence.md +149 -0
  334. package/docs/coding-workflow.md +45 -0
  335. package/docs/dsh-auth-LICENSE.txt +22 -0
  336. package/docs/dsh-auth-provenance.md +25 -0
  337. package/docs/dsh-plugin.md +19 -0
  338. package/docs/execution-support.md +4 -0
  339. package/docs/kiokuko-models.md +66 -0
  340. package/docs/lisp-hot-tools.md +2 -2
  341. package/docs/lisp.md +112 -63
  342. package/docs/model-selection.ja.md +7 -9
  343. package/docs/model-selection.md +14 -12
  344. package/docs/owned-execution.md +99 -0
  345. package/lisp/supervisor.mjs +8 -2
  346. package/lisp/tools.lisp +31 -3
  347. package/migrations/035_owned_execution.sql +19 -0
  348. package/migrations/036_coding_workflow.sql +26 -0
  349. package/package.json +47 -12
  350. package/skills/coding-ideal-routine-skill/SKILL.md +6 -0
  351. package/skills/kiokuko-lisp/SKILL.md +53 -67
  352. package/skills/kiokuko-soul/SKILL.md +7 -28
  353. package/skills/one-shot-software-completion/SKILL.md +5 -6
package/docs/lisp.md CHANGED
@@ -1,4 +1,4 @@
1
- For configured semantic routing, use [provider-independent decisions](typed-decisions.md) and `kioku.decisions`. The Lisp mode-choice prompt and proposal approvals are unchanged.
1
+ For configured semantic routing, use [provider-independent decisions](typed-decisions.md) and `kioku.decisions`. Lisp coexists with normal tools; routine development is authorized and destructive changes retain concrete review.
2
2
 
3
3
  # Common Lisp tools
4
4
 
@@ -10,6 +10,8 @@ For explicit semantic decisions and `/kioku-typesafe-key` setup, see
10
10
  [TypeSafe from Lisp](typesafe.md). Answers can guide inspection and proposals;
11
11
  the existing permission and approval boundaries still apply.
12
12
 
13
+ The default is `lisp.executionMode: development`. Old `approvalMode` values remain readable. Set `executionMode: protected` explicitly to select the legacy worker/approval/fence behavior. See [owned execution and memory evidence](owned-execution.md).
14
+
13
15
  ## Compose task tools
14
16
 
15
17
  Use the worker as a persistent programming environment. Before repeating primitive
@@ -72,15 +74,9 @@ chooses the type; it does not grant permission or drop other requested actions.
72
74
  Missing context, explicitly undecided alternatives, envelope/provider capacity
73
75
  rejection and model abstention defer classification. Native adapters let the
74
76
  ordinary model infer advisory intent or ask a concrete clarification; they do not
75
- repeat the generic category dialog merely because the classifier abstained. The host asks whether to use Lisp
76
- before coding begins; it resolves unclear task intent first. Both enable and decline choices
77
- persist for that session, including after a restart. Conversation and review
78
- requests do not trigger this prompt. Free text returns to conversation without
79
- starting Lisp; cancellation and startup failure block coding admission.
77
+ repeat the generic category dialog merely because the classifier abstained. Classification does not authorize implementation. For an explicit coding request the agent defines the Goal, implementation items and their observable criteria, then the host asks whether to use Lisp for that task. Both yes and no persist for the task and scope across restart. Conversation, review and plan-only requests do not trigger this prompt. Closing, free text without a clear choice or a disconnected question leaves implementation pending. Cancellation preserves the prepared work. A selected Lisp startup failure remains a recoverable blocker.
80
78
 
81
- Choosing Lisp also selects normal execution; Enno requires choosing not to use
82
- Lisp. The prompt is available only when `lisp.enabled` is true. To enable Lisp
83
- manually or inspect its state, use these commands in the desired DSH session:
79
+ Normal/Enno execution mode and Lisp choice are separate. The task question remains available when the Lisp module is disabled; no needs no Lisp runtime, while yes requires the enabled module and working SBCL. To explicitly change the current task's Lisp route or inspect its state, use these commands in the desired DSH session:
84
80
 
85
81
  ```text
86
82
  /kioku-lisp enable
@@ -90,10 +86,7 @@ manually or inspect its state, use these commands in the desired DSH session:
90
86
  This enables the Lisp tools and supplies the bundled `kiokuko-lisp` Skill.
91
87
  Existing DSH `read`, `glob`, `grep` and `skill` tools remain available under native
92
88
  session permissions, so project files and applicable Skills can be inspected.
93
- File changes still use Lisp proposals and their confirmation rules. The read
94
- implementations are bound when Lisp is enabled; a later same-name replacement
95
- does not inherit permission. Normal sessions retain their tools. Protection also blocks
96
- unclassified child-session execution, late registrations, and PTC bypasses.
89
+ File changes can use owned native tools or Lisp proposals. Ordinary writes/edits do not request approval; destructive source/data deletion retains a concrete review. For a coding task with a saved yes, recover Lisp or explicitly choose another task route before continuing implementation.
97
90
  The protected agent uses native tool presentation even in a PTC deployment.
98
91
 
99
92
  `sbclPath` can point to an explicit installed SBCL launcher. Its runtime files must
@@ -143,13 +136,8 @@ not the complete worker startup or the speed of an individual Lisp computation.
143
136
  copied into the worker's read-only inputs. Files from other sessions and arbitrary
144
137
  absolute paths are refused. The original attachment store stays inaccessible to
145
138
  Lisp and its subprocesses. Limits: 64 MiB per file, 256 MiB per worker generation.
146
- - Direct Lisp/FFI/Python/shell access is limited by the OS to runtime files,
147
- selected read-only input copies and compiled bundle, and the worker's scratch/cache.
148
- - Project changes use host-validated proposals. New regular files can be created
149
- with necessary parent directories. Deletion and replacement require one human
150
- confirmation for the evaluation's frozen batch, showing every target, diff,
151
- digest and backup location. Duplicate targets are rejected; unchanged writes
152
- return `UNCHANGED` without a confirmation or write.
139
+ - Lisp/FFI/Python/shell use the normal user environment. Prefer owned tools and broker APIs for host-observed execution; direct arbitrary effects are not verification evidence.
140
+ - Project proposals freeze targets, preserve backups and reject duplicate targets. Writes/edits are authorized; source/data deletion requires concrete confirmation. Generated/temp/disposable artifacts are routine development.
153
141
  - Refusal, skip, timeout, cancelled confirmation or unavailable UI means no change.
154
142
  File identities/content are checked again after approval. Links, directories,
155
143
  database files/sidecars, common credential paths and plugin/state data are refused.
@@ -223,11 +211,7 @@ schema-size comparisons. It makes no model calls and does not estimate token
223
211
  charges. Native integration tests separately verify confirmation counts, tool
224
212
  delivery, output validation and recovery.
225
213
 
226
- The host serializes conflicting target proposals. OS protection prevents the Lisp
227
- worker from swapping project paths while the host applies a proposal. This is not
228
- a filesystem transaction against unrelated host programs: an external application
229
- can change directory entries between host filesystem calls. Stop other writers
230
- when reviewing/applying sensitive changes; an uncertain outcome requires inspection.
214
+ The host serializes conflicting target proposals and checks their captured hashes before applying them. This is not a transaction against arbitrary Lisp or unrelated programs; concurrent external changes can still race filesystem calls. Unknown outcomes require inspection and must not be replayed.
231
215
 
232
216
  ## Stop and recover
233
217
 
@@ -281,13 +265,7 @@ subprocesses use the same output limit and parent-liveness supervisor as workers
281
265
  Published bundles are limited to 256 MiB each. Concurrent first enables share one
282
266
  serialized build under the host's existing exclusive data-directory lease.
283
267
 
284
- The macOS sandbox denies fork inside workers and jobs. Use `kioku.process` broker APIs for
285
- external processes. Result helpers (`result-ok?`, `result-code`, `result-stdout`,
286
- `result-stderr`, `run-lines`, `python-stdout`, `shell-stdout`) and generation-local
287
- job helpers (`list-jobs`, `forget-job`) avoid ordinary shell plumbing.
288
- `run` and `start-job` accept `:directory`, relative to scratch (default `"."`);
289
- absolute paths, traversal and symlink directories are refused. Node uses an empty
290
- OpenSSL configuration, so it does not need access to host OpenSSL configuration.
268
+ Lisp workers and processes use the normal user environment and process groups for termination. kioku.process run/start-job use the owned execution service; directory defaults to the admitted workspace and may select a real subdirectory. Collect background results rather than rerunning commands.
291
269
  `python`, `shell`, `run-lines`, `python-stdout` and `shell-stdout` also accept
292
270
  `:directory`. The output-only helpers signal an error on process failure, so a
293
271
  composed operation stops before its next step. Use `run` when the function needs
@@ -337,12 +315,7 @@ different repository is rejected.
337
315
  `vendor`. These map to fixed `npm` commands and timeouts; arbitrary executable,
338
316
  arguments, URL or shell input is not accepted. `:directory` selects a relative
339
317
  project directory under the bound workspace, or under the current worker's scratch
340
- with `:location :scratch`. Absolute paths, traversal and links are refused. Before
341
- execution, native confirmation shows the command, package script, exact directory,
342
- timeout and possible artifact effects. The verifier runs on the host, including npm
343
- lifecycle scripts, outside the worker sandbox. Directory identity and scripts are
344
- rechecked after approval. Refusal, cancellation or unavailable confirmation returns
345
- `NOT_APPLIED`; nonzero exit returns `FAILED` with bounded output. The enclosing
318
+ with `:location :scratch`. Absolute paths, traversal and links are refused. Routine verifier execution needs no approval. The host records actual cwd, process outcome and full-output test summaries before display shortening. Register completion checks and source paths before execution. Nonzero exit is FAILED; zero exit alone is not test coverage. The enclosing
346
319
  `lisp_eval` operation ID provides replay and conflict handling.
347
320
 
348
321
  Typical flow:
@@ -385,33 +358,14 @@ For API examples see [the bundled Skill](../skills/kiokuko-lisp/SKILL.md).
385
358
 
386
359
  Verification scope and installed Web reproduction: [verification record](lisp-verification.md).
387
360
 
388
- Native `ask_user_question` and `exit_plan_mode` remain available in both Lisp modes. Plan approval uses the DSH review UI and does not remove Lisp protection. Run `npm run test:lisp:plan:web` for a disposable packed-package Web check without model credentials.
361
+ Native `ask_user_question` and `exit_plan_mode` remain available in both Lisp modes. Plan approval uses the DSH review UI. Explicit human implementation instructions also request exit at the next accepted boundary. Protected compatibility mode retains its Lisp sandbox; development mode allows ordinary owned tools after Plan exits. Run `npm run test:lisp:plan:web` for a disposable packed-package Web check without model credentials.
389
362
 
390
363
  <!-- kiokuko:runtime approval-policy -->
391
- ## Profile-wide Lisp approval policy
392
-
393
- `lisp.approvalMode` defaults to `ask`; auto-approval is never inferred from an
394
- unknown request or from selecting Lisp. Ordinary questions keep normal execution
395
- without a Lisp choice or an approval selector in the chat composer. Once a task
396
- is identified as coding implementation or debugging, the existing coding choice
397
- can offer protected Lisp or normal execution; coding plans do not require Lisp.
398
- Auto-approval is an explicit opt-in through General settings,
399
- `/kioku-lisp approval auto`, or “Auto-approve all Lisp actions for this profile and
400
- continue” in a Lisp approval dialog. Use `/kioku-lisp approval ask` to return to
401
- manual consent. Explicit configuration and saved profile settings persist across
402
- chats and restarts and override the default; changing the default does not revoke
403
- a previously saved choice.
404
- All Lisp permission categories are covered, including file restoration, host
405
- verification, public npm package operations, and shared-function changes.
406
-
407
- Follow the current host-reported mode. In auto mode execute authorized work
408
- without asking whether to submit, resubmit, run tests, or apply changes. Ask only
409
- for missing intent that materially changes the work. In ask mode submit the
410
- operation directly to the host approval dialog without an extra conversational
411
- permission question. Earlier references to human approval describe ask mode.
412
- Explicit refusal, cancellation, stale inputs and unknown outcomes still stop
413
- execution; changing mode does not replay completed or refused operations.
414
- Identity checks, protected paths, backups and journal recovery remain enforced.
364
+ ## Development approval policy
365
+
366
+ The legacy lisp.approvalMode ask/auto configuration and profile commands remain readable. Both authorize routine project edits, tests, helper registration and Kioku saving. Neither disables concrete confirmation for source/data deletion or durable user database mutation. A worker failure leaves normal tools available. Refusal, cancellation, changed targets and unknown outcomes cannot authorize effects.
367
+
368
+ Use kioku_read/write/edit/remove/exec/result for observed work. Host receipts distinguish actual process outcome, source-bound verification and saving status. Lisp/model passed fields are advisory. Saving can be retried without repeating development effects; after restart an interrupted process remains unknown. See [owned execution](owned-execution.md).
415
369
  <!-- /kiokuko:runtime -->
416
370
 
417
371
  Pinned DSH stores this setting in the native `kiokuko-lisp` namespace, keyed by
@@ -419,3 +373,98 @@ the host-owned profile identity. Current DSH exposes `lisp.approvalMode` through
419
373
  the native `kiokuko-dsh` configuration form and saves its profile patch. This
420
374
  compatibility difference does not change the controls or scope. No separate
421
375
  preference file or database migration is used.
376
+
377
+
378
+ ## Read-only code intelligence
379
+
380
+ Persistent `lisp_eval` can use an optional `CodeIntelligenceServiceV1` from
381
+ `@askdkc/dsh-lsp-server`. Kiokuko resolves it in the calling agent's context.
382
+ The provider owns Tree-sitter, grammars, source snapshots, coordinates, and LSP
383
+ processes. Kiokuko does not install them or fall back to generic LSP tools.
384
+ Core alone has no code-intelligence runtime dependency.
385
+
386
+ The published provider v0.1.12 does not supply V1. The local prerequisite is kept
387
+ as a reproducible [upstream patch](../patches/code-intelligence/README.md). A
388
+ future compatible provider should advertise V1 and the required capabilities;
389
+ package version alone is insufficient. Absence, an old provider, missing grammar,
390
+ and an unready language server return explicit outcomes. They do not block the
391
+ ordinary Lisp APIs. Node must satisfy Kiokuko's `>=24.16.0` requirement.
392
+
393
+ Start with `(kioku.code:capabilities)`. Its response includes `status`, `reason`
394
+ when relevant, `data.version`, `data.capabilities`, `data.languages`, distributed
395
+ `data.queryIds`, and `data.semanticReady`. The last field stays false until this lease completes a semantic query: a
396
+ server executable's presence does not establish a synchronized semantic result.
397
+
398
+ ```lisp
399
+ ;; One evaluation: aggregate locally, return selected source and metadata.
400
+ (kioku.code:with-snapshot (snapshot "src/example.ts")
401
+ (let ((outline (kioku.code:outline snapshot :limit 20)))
402
+ (if (member (gethash "status" outline) '("ok" "partial") :test #'equal)
403
+ (let ((items (gethash "items" (gethash "data" outline))))
404
+ (kioku.internal:object
405
+ "status" (gethash "status" outline)
406
+ "omitted" (gethash "omitted" outline)
407
+ "declarationCount" (length items)
408
+ "selected" (if (plusp (length items))
409
+ (kioku.code:span (gethash "handle" (aref items 0))
410
+ :max-chars 1000)
411
+ #())))
412
+ outline)))
413
+ ```
414
+
415
+ Check `status` before accessing `data`. `ok` with an empty array means the query
416
+ completed with no results. `partial` preserves parse-error/truncation information.
417
+ `unsupported`, `unavailable`, `stale`, `cancelled`, `timeout`, and `limit_exceeded`
418
+ are separate states. Missing diagnostics publication never becomes a clean file.
419
+ `with-snapshot` returns the opening failure unchanged and always releases an
420
+ accepted snapshot, including on a Lisp error. For other queries, branch explicitly
421
+ on `ok`/`partial` before using their `data`.
422
+
423
+ | Lisp function | Arguments | Purpose |
424
+ | --- | --- | --- |
425
+ | `capabilities` | none | Negotiate V1, per-language readiness, disk sources and limits |
426
+ | `open` | path | Pin a bounded disk source snapshot |
427
+ | `outline` | handle, `:range`, `:limit` | Bounded declaration map |
428
+ | `enclosing` | handle, position, `:kinds` | Nearest matching node and ancestors |
429
+ | `query` | handle, query ID, `:range`, `:limit` | Distributed `declarations`, `calls`, `imports` captures |
430
+ | `span` | node handle, `:max-chars` | Bounded original source span |
431
+ | `semantic` | handle, kind, `:position`, `:limit` | `definition`, `references`, `implementation`, `hover`, `diagnostics`, `completion` |
432
+ | `release` | handle | Idempotent release |
433
+
434
+ Positions are JSON objects such as `(kioku.internal:object "line" 1 "character" 2)`:
435
+ zero-based lines and UTF-16 character offsets. Ranges have `start` and `end` and
436
+ are half-open. The provider performs conversion. There is no unsaved-editor
437
+ synchronization claim: `sourceKind` is `disk`, with freshness and a snapshot version
438
+ on every accepted source result. File/checkout changes require an explicit reopen.
439
+ Handles and node handles expire at evaluation end; journal replay and saved
440
+ `lisp_inspect` output are historical evidence, never live capabilities. Task workers
441
+ retain their host-RPC prohibition. Neither `lsp` nor `lsp_extra` is added to the
442
+ protected tool allowlist; child sessions cannot borrow admission.
443
+
444
+ Each evaluation has 100 charged calls (including capabilities and failed attempts),
445
+ 100 files, 16 MiB cumulative source input, 64 KiB cumulative code responses, and a
446
+ 30-second code budget. Individual documents are at most 2 MiB; captures 200,
447
+ outline entries 100, source spans 8,000 UTF-16 units, responses 32 KiB. Structural
448
+ calls have a 2-second deadline and semantic calls 10 seconds, capped by the batch
449
+ and caller deadlines. Release/disposal remain available outside exhausted budgets.
450
+ Model presentation remains capped at 16 KiB and retains code outcome metadata;
451
+ use bounded `lisp_inspect` pages for saved detail. Aggregate counts and chosen spans
452
+ inside Lisp; returning full outlines can increase output instead of reducing it.
453
+
454
+ The local prerequisite currently supports JavaScript/JSX/TypeScript/TSX. Its
455
+ checkout metadata read must be allowed by the scoped host filesystem. Linked Git
456
+ worktrees whose metadata is outside that scope return
457
+ `unavailable` rather than read through another filesystem. This condition is
458
+ reported independently from grammar and language-server readiness.
459
+
460
+ Development verification is `npm run test:code-intelligence` after preparing the
461
+ provider fixture. The source/native and packed paths are separate checks. The CI
462
+ matrix runs normal development on macOS, Ubuntu 26.04, and Arch; the protected code-provider path
463
+ is exercised on macOS; Linux protection remains a separate native-suite check. A configured job
464
+ is not evidence that the remote job passed.
465
+
466
+ Clean installation and platform status: [code intelligence setup](code-intelligence.md).
467
+
468
+ ## Coding task choice and recovery
469
+
470
+ For a new coding task, `coding_workflow` first defines and displays the Goal, implementation items and observable conditions. The host then asks whether to use Lisp. Existing enabled settings never imply yes. Closing the question leaves it pending and `coding_workflow next` reopens the same question. Explicit continuation after a host restart restores the task choice; a new task or material scope change asks again. A saved yes followed by startup failure remains a visible blocker; recover the runtime or explicitly change the task route with `/kioku-lisp disable`. No uses ordinary tools and still requires fresh item checks followed by a final user-entry Goal check. Lisp evaluation success alone is insufficient: bind `task_completion` and collect actual host process evidence. See [coding workflow](coding-workflow.md).
@@ -12,7 +12,9 @@ DSHの権限判定、必要な検証を維持し、役小角の契約・WorkUnit
12
12
 
13
13
  ## 通常実行のモデル自動選択
14
14
 
15
- 通常版・modular coreとも `modelAutoMode.mode: off` が既定です。同じDSHプロファイルにdsh-codexを登録して認証し、JevかLayaの判定を準備したうえで、まず `observe` で選択案を確認します。
15
+ Webプロファイルでは [Kiokuko Models](kiokuko-models.md) から接続を設定できます。DSH本体のModelsで設定する必要はありません。登録したモデルは、通常会話・Enno・Deepでネイティブ接続と併用できます。
16
+
17
+ 通常版・modular coreとも `modelAutoMode.mode: off` が既定です。同じDSHプロファイルでKiokuko Modelsまたはdsh-codexからCodexを認証し、JevかLayaの判定を準備したうえで、まず `observe` で選択案を確認します。
16
18
 
17
19
  ```yaml
18
20
  modelAutoMode:
@@ -30,7 +32,7 @@ modelAutoMode:
30
32
 
31
33
  コマンドは現在のnativeセッションだけを変更します。`on` は手動のモデル指定も解除します。DSHのpickerでモデルを手動選択すると、同じセッションで `on` を再実行するまで手動指定が優先します。変更は次の新しいタスクから反映し、送信済みの要求を途中で切り替えません。`/kioku-decisions status` にも同じ状態を表示します。設定を `off` に変更してDSHを再起動すれば、保存済みのセッション指定も無効になります。
32
34
 
33
- 初期候補は `gpt-6-luna` の low・medium・high と `gpt-6-sol` の high です。`modelAutoMode.routes` には最大4件、`id`(`luna-low`、`luna-medium`、`luna-high`、`sol-high`)と `binding`(`provider`、`model`、`reasoningEffort`)を指定できます。IDは経路のラベルなので、登録済みのAstraなども正確なbindingで割り当てられます。候補はDSHの現在の `openai-codex` 一覧、文脈容量・入力形式・推論強度、要求設定の検証、token meterを通ったものに限定します。有効なbindingが2件未満なら判定しません。
35
+ 初期候補は `gpt-6-luna` の low・medium・high と `gpt-6-sol` の high です。`modelAutoMode.routes` には最大4件、`id`(`luna-low`、`luna-medium`、`luna-high`、`sol-high`)と `binding`(`provider`、`model`、`reasoningEffort`)を指定できます。IDは経路のラベルなので、登録済みのAstraなども正確なbindingで割り当てられます。候補はCodex由来とResponses方式を確認でき、現在のモデル一覧、文脈容量・入力形式・推論強度、要求設定の検証、token meterを通った接続に限定します。ネイティブの `openai-codex` とKiokuko所有のCodex接続が対象です。名前だけを似せた接続やOpenAI API接続は対象外です。有効なbindingが2件未満なら判定しません。
34
36
 
35
37
  新しい受付済みの通常タスクでは、現在の依頼文、タスク種別、添付の種類、経路IDと判定基準を選択中のJevかLayaへ送ります。この判定のために添付の内容、全履歴、リポジトリ全体は送信しません。Choice 1問の結果をrunに保存し、継続では同じ経路を使います。再起動時に判定結果が不明なら再送せず元のモデルを維持します。`observe`、棄権、probe失敗、metadata不足、非対応effort、timeout、入力超過でも元のモデルを維持します。取消、セッション同一性の不一致、保存の整合性エラーでは要求を止めます。認証・利用枠・モデル利用不可によるdispatch失敗を別モデルへ自動再送しません。
36
38
 
@@ -74,7 +76,6 @@ npm run test:evaluation:model-routing -- --live --provider laya --config PATH
74
76
  | OpenRouter・DeepSeek V4.1 Flash | `deepseek/deepseek-v4.1-flash` | `deepseek/deepseek-v4.1-flash` | `deepseek/deepseek-v4.1-flash` | `deepseek/deepseek-v4.1-flash` |
75
77
  | OpenRouter・GLM | `z-ai/glm-5.3` | `z-ai/glm-5.3` | `z-ai/glm-5.3-flash` | `z-ai/glm-5.3` |
76
78
  | OpenRouter・Qwen | `qwen/qwen3.8-max-0902` | `qwen/qwen3.8-max-0902` | `qwen/qwen3.8-flash` | `qwen/qwen3.8-max-0902` |
77
- | OrcaRouter・DeepSeek V4.1 Flash | `deepseek/deepseek-v4.1-flash` | `deepseek/deepseek-v4.1-flash` | `deepseek/deepseek-v4.1-flash` | `deepseek/deepseek-v4.1-flash` |
78
79
  | Ollama・ローカル標準 | `qwen3-coder:30b` | `qwen3-coder:30b` | `qwen3-coder:30b` | `qwen3-coder:30b` |
79
80
 
80
81
  これらは版1の構成候補です。適用時にDSHの登録モデルと正確なIDで照合します。
@@ -84,13 +85,11 @@ npm run test:evaluation:model-routing -- --live --provider laya --config PATH
84
85
  DeepSeek系の推奨は全5役を **V4.1 Flash** に統一しています。IDは提供元ごとに、
85
86
  [DeepSeek公式API](https://www.deepseek.com/en/news/deepseek-v4-1-flash/)、
86
87
  [OpenCode Go](https://opencode.ai/docs/go/)、
87
- [OpenRouter](https://openrouter.ai/deepseek/deepseek-v4.1-flash)、
88
- [OrcaRouter](https://www.orcarouter.ai/models/deepseek/deepseek-v4.1-flash)で確認しています。
88
+ [OpenRouter](https://openrouter.ai/deepseek/deepseek-v4.1-flash)で確認しています。
89
89
  公式APIの専用テンプレートはDSHの`deepseek-official`接続を使います。
90
90
  V4.1 Flashが未登録の場合、V4 Proや旧FlashのIDには置き換えません。
91
91
  2026-09-11に[OpenCodeのモデル一覧](https://models.opencode.ai/api.json)も確認しています。
92
92
  `opencode-go`にはV4.1 Flashが掲載されていますが、Zenに相当する`opencode`にはありません。
93
- この一覧のOrcaRouter欄にも未掲載で、OrcaRouter公式モデルページの更新と差があります。
94
93
  Zen・Ollamaで推奨テンプレートにないモデルを使う場合は、以下の登録済みモデル選択を使います。
95
94
 
96
95
  [dsh-codex](https://github.com/askdkc/dsh-codex)を使う場合は、
@@ -100,7 +99,7 @@ Zen・Ollamaで推奨テンプレートにないモデルを使う場合は、
100
99
  [OpenAIのモデルガイド](https://developers.openai.com/api/docs/models)を基にした推奨で、
101
100
  タスク別の速度・利用枠消費を実測して最適化したものではありません。
102
101
 
103
- この専用テンプレートは、[dsh-codexの登録・接続実装](https://github.com/askdkc/dsh-codex/blob/e2e61b6d8f3b511cf2dac99688e97b8728cb122c/src/index.ts)
102
+ このテンプレートはKiokuko ModelsのCodex接続にも対応し、Codex由来とResponses方式を確認して、安定した `kiokuko-…` 登録IDを保存します。ネイティブ接続は [dsh-codexの登録・接続実装](https://github.com/askdkc/dsh-codex/blob/e2e61b6d8f3b511cf2dac99688e97b8728cb122c/src/index.ts)
104
103
  に合わせて`openai-codex` / `codex` / `responses`を使用します。接続先や通信方式を
105
104
  重ねて質問せず、選択した構成に保存します。DSH本体のモデル検証を優先し、
106
105
  旧`modelRoutes`の値を再入力させません。プラグイン設定ファイルは変更しません。モデルはDSH経由の現在の登録一覧に存在する正確なIDだけを割り当て、
@@ -114,9 +113,8 @@ DSHの設定を使い、重ねて質問しません。Kiokukoは認証情報を
114
113
 
115
114
  モデル名から選ぶ場合は、**「DSHに設定済みのモデルから選ぶ」→役割を変更→接続を選択→
116
115
  モデル名で検索・選択→構成を確認して開始**と進みます。
117
- **OpenCode Go、OpenCode Zen、OpenRouter、Ollama、OrcaRouter**の登録済み接続を選べます。
116
+ **OpenCode Go、OpenCode Zen、OpenRouter、Ollama**の登録済み接続を選べます。
118
117
  一覧は現在のDSHプロファイルから取得し、接続名・モデル名と正確なIDを表示します。
119
- 同じモデル名でもOpenRouterとOrcaRouterの割り当ては別々に保持します。
120
118
  接続が表示されない場合はDSHに登録し、「一覧を再取得」で更新してください。
121
119
  公開モデル一覧は推奨IDの参照元で、DSHへのモデル登録は行いません。
122
120
  公開一覧の`ollama-cloud`と、ローカルOllamaのインストール済みモデルは別の一覧です。
@@ -13,7 +13,9 @@ plan approval or automatic Enno continuation.
13
13
 
14
14
  ## Automatic model selection
15
15
 
16
- `modelAutoMode` is off by default in both the full plugin and modular core. To try it, install and authenticate dsh-codex in the same DSH profile, configure a Jev or Laya typed-decision backend, then use `observe` before enabling automatic routing:
16
+ In Web profiles, [Kiokuko Models](kiokuko-models.md) manages connections without requiring DSH's Models settings. Its registered models are available to ordinary chat, Enno and Deep alongside native connections.
17
+
18
+ `modelAutoMode` is off by default in both the full plugin and modular core. To try it, authenticate Codex through Kiokuko Models or dsh-codex in the same DSH profile, configure a Jev or Laya typed-decision backend, then use `observe` before enabling automatic routing:
17
19
 
18
20
  ```yaml
19
21
  modelAutoMode:
@@ -31,7 +33,7 @@ modelAutoMode:
31
33
 
32
34
  The command changes only the current native session. `on` also clears its manual model pin; a model selected in DSH's picker pins that session until `on` is run again. Changes apply at the next new task boundary, without changing a request already sent. `/kioku-decisions status` includes the same session projection. To reset session overrides after a configuration change, restart DSH; changing `modelAutoMode.mode` to `off` and restarting disables routing.
33
35
 
34
- The initial preset offers `gpt-6-luna` at low, medium and high effort, plus `gpt-6-sol` at high effort. Up to four exact route bindings can be configured under `modelAutoMode.routes`; each has an `id` from `luna-low`, `luna-medium`, `luna-high`, `sol-high`, and a `binding` with `provider`, `model`, and `reasoningEffort`. These are route labels, so a registered Astra or other GPT model may be assigned explicitly. No new model ID is guessed or substituted. DSH's live `openai-codex` catalog, model context and modality metadata, supported efforts, call-config validation and token meter must all confirm a candidate. Fewer than two valid bindings skips classification.
36
+ The initial preset offers `gpt-6-luna` at low, medium and high effort, plus `gpt-6-sol` at high effort. Up to four exact route bindings can be configured under `modelAutoMode.routes`; each has an `id` from `luna-low`, `luna-medium`, `luna-high`, `sol-high`, and a `binding` with `provider`, `model`, and `reasoningEffort`. These are route labels, so a registered Astra or other GPT model may be assigned explicitly. No new model ID is guessed or substituted. A candidate must have a validated Codex origin and Responses protocol, live model context and modality metadata, supported efforts, call-config validation and token meter. Both native `openai-codex` and Kiokuko-owned Codex routes qualify; an arbitrary provider name or OpenAI API connection does not. Fewer than two valid bindings skips classification.
35
37
 
36
38
  For a new admitted normal task, Kiokuko sends the current task text, task type, attachment kinds, route IDs and rubric to the selected Jev or Laya backend. It does not send attachment bytes, full history or repository contents for this classification. One Choice result selects a route or abstains. The route is stored against the exact run and reused for continuations; an unknown in-flight decision after restart is retained without another classifier call. `observe` records a proposal but keeps the current model. A failed probe, missing metadata, unsupported effort, timeout, oversized input or abstention also keeps the current model. Cancellation, stale session identity and storage integrity failures stop the request. Dispatch authentication, quota and unavailable-model errors remain ordinary failures; no alternate model is retried automatically.
37
39
 
@@ -63,8 +65,8 @@ above nine, type consecutive digits (`1`, `2`, Enter selects option 12); Backspa
63
65
  corrects the number. Digits typed in the search field remain search text, and Enter
64
66
  submits the search. IME composition and repeated key events do not select or submit.
65
67
 
66
- Enno offers twelve versioned templates across **OpenAI, DeepSeek, OpenCode Go,
67
- OpenCode Zen, OpenRouter, OrcaRouter and Ollama**, plus a custom configured-model selector. The complete
68
+ Enno offers eleven versioned templates across **OpenAI, DeepSeek, OpenCode Go,
69
+ OpenCode Zen, OpenRouter and Ollama**, plus a custom configured-model selector. The complete
68
70
  [template table and configuration reference](model-selection.ja.md) lists exact
69
71
  model IDs. OpenAI assigns Astra to ideal/Zenki/check, Sol to the Goki head and
70
72
  Luna to workers. Go and OpenRouter provide GLM and Qwen variants; Zen uses GLM.
@@ -74,14 +76,12 @@ downloads models. Reasoning uses model defaults; reflection uses the check model
74
76
  All DeepSeek recommendations use **V4.1 Flash for all five roles**. Exact IDs differ:
75
77
  `deepseek-flash` on [DeepSeek's API](https://www.deepseek.com/en/news/deepseek-v4-1-flash/),
76
78
  `deepseek-v4.1-flash` on [OpenCode Go](https://opencode.ai/docs/go/), and
77
- `deepseek/deepseek-v4.1-flash` on [OpenRouter](https://openrouter.ai/deepseek/deepseek-v4.1-flash)
78
- and [OrcaRouter](https://www.orcarouter.ai/models/deepseek/deepseek-v4.1-flash).
79
+ `deepseek/deepseek-v4.1-flash` on [OpenRouter](https://openrouter.ai/deepseek/deepseek-v4.1-flash).
79
80
  The direct DeepSeek template uses DSH's `deepseek-official` connection. These templates
80
81
  never substitute V4 Pro or an older Flash ID when V4.1 Flash is unavailable.
81
82
  The [OpenCode model registry](https://models.opencode.ai/api.json) was also checked
82
83
  on 2026-09-11. Its `opencode-go` entry includes V4.1 Flash; its Zen entry (`opencode`)
83
- does not. Its OrcaRouter entry also lacks V4.1 Flash, although OrcaRouter's own model
84
- page lists the ID above. Registry entries can lag provider changes. Zen and Ollama
84
+ does not. Registry entries can lag provider changes. Zen and Ollama
85
85
  use the configured-model selector for models without a verified template ID.
86
86
 
87
87
  For [dsh-codex](https://github.com/askdkc/dsh-codex), choose **OpenAI Codex・推奨(dsh-codex)**
@@ -89,8 +89,10 @@ from the template menu, then confirm the configuration. It assigns Astra to
89
89
  ideal/planning/check, Sol to the Goki head and Luna to workers, following the
90
90
  [OpenAI model guide](https://developers.openai.com/api/docs/models). This is a
91
91
  quality/workload recommendation, not a measured per-task latency or quota optimum.
92
- The plugin-specific template binds the exact `openai-codex` / `codex` / `responses`
93
- contract from [dsh-codex's implementation](https://github.com/askdkc/dsh-codex/blob/e2e61b6d8f3b511cf2dac99688e97b8728cb122c/src/index.ts)
92
+ The template also accepts a Kiokuko Models Codex connection with verified origin
93
+ and Responses metadata, storing its stable `kiokuko-…` registration ID. The native
94
+ route retains the `openai-codex` / `codex` / `responses` contract from
95
+ [dsh-codex's implementation](https://github.com/askdkc/dsh-codex/blob/e2e61b6d8f3b511cf2dac99688e97b8728cb122c/src/index.ts)
94
96
  without asking for the connection again. Native DSH model validation takes
95
97
  precedence over legacy `modelRoutes` declarations; the plugin configuration file
96
98
  remains untouched. Recommended models must exist in the current DSH catalog;
@@ -116,9 +118,9 @@ than requested again. Back and cancel retain confirmed model assignments.
116
118
 
117
119
  To choose by model name, select **DSHに設定済みのモデルから選ぶ**, edit a role,
118
120
  select its connection, then search or select a model name and confirm the configuration.
119
- This works with configured **OpenCode Go, OpenCode Zen, OpenRouter, Ollama and OrcaRouter**
121
+ This works with configured **OpenCode Go, OpenCode Zen, OpenRouter and Ollama**
120
122
  connections. Every entry displays its name and exact ID; the same model on OpenRouter
121
- and OrcaRouter remains a distinct binding. Lists come from the current DSH profile.
123
+ Each connection remains a distinct binding. Lists come from the current DSH profile.
122
124
  Register a missing connection in DSH and select **一覧を再取得** to refresh it.
123
125
  The public registry is a recommendation reference; it does not register models in
124
126
  DSH. Its `ollama-cloud` catalog is separate from a local Ollama installation.
@@ -0,0 +1,99 @@
1
+ # Kiokuko-owned development execution
2
+
3
+ Kiokuko registers native `kioku_read`, `kioku_write`, `kioku_edit`,
4
+ `kioku_remove`, `kioku_exec`, and `kioku_result` tools. They use Node filesystem
5
+ and process services directly; stock DSH filesystem/shell sandbox settings do
6
+ not control this executor. Native presentation and PTC transport both remain
7
+ supported. Plan, goal, cancellation, admitted identity, and Enno delegation
8
+ scope still apply.
9
+
10
+ Ordinary project reads, edits, builds, tests, PATH commands and investigation
11
+ needed for development require no additional confirmation. Bash/zsh inherit
12
+ the user's environment and may start child processes. Source/data deletion and
13
+ existing durable user database mutation require confirmation of concrete
14
+ targets. Generated artifacts and temporary/disposable data do not. Declare
15
+ `destructiveTargets` for destructive commands: arbitrary shell/Lisp/FFI code
16
+ cannot be completely classified in advance. An unknown side effect does not
17
+ justify refusing execution or treating its result as verification.
18
+
19
+ ## Tools and replay
20
+
21
+ - `kioku_read({path})` returns content and its SHA256.
22
+ - `kioku_write({path,content,expectedHash?})` and
23
+ `kioku_edit({path,oldText,newText,expectedHash?})` compare the actual file with
24
+ the requested result. An edit requires exactly one matching occurrence.
25
+ `expectedHash:null` requires a new file; changed hashes reject a stale edit.
26
+ - `kioku_remove({path,expectedHash?})` removes a single file.
27
+ - `kioku_exec({command,cwd?,shell?,background?,timeoutMs?,destructiveTargets?})`
28
+ executes in the canonical cwd, including project subdirectories.
29
+ - `kioku_result({operationId,cancel?})` retrieves or cancels the existing
30
+ process. It never starts the command again. Collect background operations
31
+ until their receipt is terminal.
32
+
33
+ Each tool returns a host-generated receipt with operation/run/session/generation
34
+ identity, actual cwd/command, file hashes, process exit/signal/cancellation/timeout,
35
+ and verification and persistence states. Process output is bounded at 32 MiB;
36
+ the host parses complete output before returning a 24,000-character preview.
37
+ Observed/displayed byte counts and an output digest distinguish the two scopes.
38
+ Environment variables and full command output are not persisted in execution receipts or passed as supervisor command-line arguments. Secret-bearing
39
+ commands and previews are redacted.
40
+
41
+ Operation identity is tied to the native call. Replaying it with another
42
+ run/generation or changed arguments conflicts. SQLite receipts and a private
43
+ local journal beside the configured database survive restart. A failed SQLite
44
+ save leaves `persistence:pending`; retrieving the result retries storage without
45
+ repeating edits/tests. If the outbox is unavailable, execution can use a database reservation; failure of both stores is reported as pending and cannot promise durable replay protection. A started receipt after a crash becomes unknown, and
46
+ its effect is never automatically retried. Loss of both durable stores cannot
47
+ be reconstructed from a model's success report. After restart, saved receipts restore terminal metadata and verification summaries; full output previews and read contents are not restored from the journal. Use a new read operation to inspect current file contents.
48
+
49
+ ## Verification and memory
50
+
51
+ Register conditions and source/test/configuration paths with `task_completion`
52
+ before running the check. Memory application reviews may specify a repository-relative `cwd`; omitted values retain the historical repository-root meaning. Actual directory, command, source digest, run and generation must match. Owned shell and Lisp process calls feed the existing
53
+ completion and memory-application records. Exit zero alone does not establish
54
+ test success: complete Node TAP and Cargo harness summaries distinguish passed,
55
+ failed, cancelled, ignored/skipped, filtered and zero/incomplete test runs.
56
+ Include every relevant input in the registered source set.
57
+
58
+ Finalization receives structured observations and source-bound checks. Candidate
59
+ memories cite stored receipts from the same run/session and retain conditions
60
+ and source versions. Existing transactions, leases and effect deduplication own
61
+ memory saving; memory retries do not rerun development tools. A staged, secret-scanned extraction is reused after adoption fails only when its run, source log, evidence manifest and entry revisions still match. Retrieval exposes
62
+ execution provenance and recomputes source freshness. Historical results are
63
+ explicitly `currentTaskVerification:false`; they do not complete a new task.
64
+ Unrelated generated files and ordinary reads do not invalidate declared source checks. Unknown side effects mark affected verification unknown without rejecting execution. Tool responses return work, verification, receiptPersistence and memoryStorage separately; not_scheduled is not a successful memory save.
65
+
66
+ ## Lisp and Plan
67
+
68
+ `lisp.executionMode` defaults to `development`, including when an old profile
69
+ omits it or has `approvalMode:ask`. Ordinary tools and Lisp coexist. Process RPC
70
+ and workspace proposals use the owned executor; helper toolsets still compile
71
+ and validate their schemas/examples. Worker failures leave ordinary tools
72
+ available. `executionMode:protected` explicitly selects the legacy isolated
73
+ worker/approval/fence behavior for compatibility; it is not the default.
74
+
75
+ Lisp source can directly call filesystem/FFI APIs in development mode. Such
76
+ effects are not independent process/test proof. Prefer `kioku.tools:call-tool`
77
+ and `kioku.process` for observed results. Plan blocks effectful owned/Lisp
78
+ operations. An explicit human implementation instruction or plan approval
79
+ requests Plan exit at the next accepted native boundary; merely presenting a
80
+ plan does not exit it.
81
+
82
+ ## Local acceptance
83
+
84
+ ```sh
85
+ npm run typecheck
86
+ KIOKUKO_REQUIRE_DSH_NATIVE=1 KIOKUKO_DSH_PACKAGE_ROOT="$PWD/tests/fixtures/dsh-runtime/node_modules" node scripts/run-tests.mjs tests/dsh/integration/owned-native-lifecycle.test.ts
87
+ KIOKUKO_REQUIRE_CARGO_RUNTIME=1 node scripts/run-tests.mjs tests/dsh/integration/owned-execution.test.ts
88
+ KIOKUKO_REQUIRE_LISP_RUNTIME=1 KIOKUKO_DSH_PACKAGE_ROOT="$PWD/tests/fixtures/dsh-runtime/node_modules" npm run test:lisp
89
+ npm run build
90
+ npm run test:skill-delivery
91
+ npm run test:modules
92
+ npm run pack:check
93
+ ```
94
+
95
+ The runtime tests use disposable profiles/databases and scripted provider
96
+ responses. They establish local/native execution, persistence and retrieval;
97
+ they do not prove a live provider or the user's installed profile. The test
98
+ runner bounds concurrent Lisp compilation to two files. Set
99
+ `KIOKUKO_TEST_CONCURRENCY` (1–64) to override it.
@@ -1,7 +1,7 @@
1
1
  // Trusted host helper, never evaluated inside Lisp. stdin is a parent-liveness
2
2
  // pipe. It stays outside the worker sandbox so arbitrary Lisp cannot disable it.
3
3
  import { spawn } from 'node:child_process'
4
- import { openSync, closeSync } from 'node:fs'
4
+ import { openSync, closeSync, writeSync } from 'node:fs'
5
5
  const launch = JSON.parse(process.argv[2])
6
6
  let child, closing = false
7
7
  const kill = () => {
@@ -21,6 +21,12 @@ const stdio = ['ignore', 'inherit', 'inherit', launch.protocol ? 3 : 'ignore']
21
21
  if (filter !== undefined) stdio.push(filter)
22
22
  child = spawn(launch.command, launch.args, { cwd: launch.cwd, env: launch.env, stdio, detached: !!launch.group })
23
23
  if (filter !== undefined) closeSync(filter)
24
+ // Stream one JSON object: older readers still consume the complete terminal
25
+ // object, while current readers observe the prefix only after actual spawn.
26
+ child.once('spawn',()=>{if(launch.report){try{writeSync(4,'{"processStarted":true,')}catch{/* host already stopped */}}})
24
27
  child.once('error', error => { process.stderr.write(`LISP_LAUNCH_ERROR: ${error.message}\n`); process.exit(70) })
25
- child.once('exit', (code, signal) => { if (launch.group) kill(); process.exit(signal ? 128 : code ?? 70) })
28
+ child.once('exit', (code, signal) => {
29
+ if(launch.report){try{writeSync(4,JSON.stringify({exitCode:code,signal}).slice(1)+'\n')}catch{/* host already stopped */}}
30
+ if (launch.group) kill(); process.exit(signal ? 128 : code ?? 70)
31
+ })
26
32
  if (closing) kill()
package/lisp/tools.lisp CHANGED
@@ -9,6 +9,7 @@
9
9
  (defpackage :kioku.decisions (:use :cl) (:export :status :evaluate :assess-relevance :classify-failure :assess-change :service-error :error-code))
10
10
  (defpackage :kioku.typesafe (:use :cl) (:export :status :evaluate :service-error :error-code))
11
11
  (defpackage :kioku.tools (:use :cl) (:export :describe-tools :describe-symbol :available-tools :call-tool))
12
+ (defpackage :kioku.code (:use :cl) (:shadow :open) (:export :capabilities :open :outline :enclosing :query :span :semantic :release :with-snapshot :service-error :error-code))
12
13
  (defpackage :kioku.user (:use :cl))
13
14
  (in-package :kioku.internal)
14
15
  (defvar *wire*)
@@ -40,6 +41,8 @@
40
41
  (unless (and reply (equal id (gethash "id" reply))) (error "RPC_MISMATCH"))
41
42
  (unless (eq yason:true (gethash "ok" reply))
42
43
  (let ((code (gethash "code" reply "")))
44
+ (when (and (stringp code) (alexandria:starts-with-subseq "CODE_" code))
45
+ (error 'kioku.code:service-error :code code :message (gethash "error" reply)))
43
46
  (when (and (stringp code) (alexandria:starts-with-subseq "DECISION_" code))
44
47
  (error 'kioku.decisions:service-error :code code :message (gethash "error" reply)))
45
48
  (when (and (stringp code) (alexandria:starts-with-subseq "TYPESAFE_" code))
@@ -275,7 +278,7 @@
275
278
  (vector (question "change" "Does the change satisfy the requirement without an evident regression?"
276
279
  (vector (choice "yes" "Satisfies requirement") (choice "no" "Missing requirement or regression") (choice "abstain" "Insufficient evidence"))))))
277
280
  (in-package :kioku.environment)
278
- (defun status () (kioku.internal:object "generation" kioku.internal:*generation* "sbcl" (lisp-implementation-version) "os" (software-type) "architecture" (machine-type) "scratch" (namestring (kioku.files:scratch)) "network" yason:false "hostWrites" "proposals only" "libraries" #("yason" "cl-ppcre" "cl-csv")))
281
+ (defun status () (kioku.internal:object "generation" kioku.internal:*generation* "sbcl" (lisp-implementation-version) "os" (software-type) "architecture" (machine-type) "scratch" (namestring (kioku.files:scratch)) "executionMode" (or (uiop:getenv "KIOKU_EXECUTION_MODE") "protected") "network" (if (equal (uiop:getenv "KIOKU_EXECUTION_MODE") "development") "normal user environment" yason:false) "hostWrites" (if (equal (uiop:getenv "KIOKU_EXECUTION_MODE") "development") "owned tools and direct Lisp; only host receipts prove observed effects" "proposals only") "libraries" #("yason" "cl-ppcre" "cl-csv")))
279
282
  (in-package :kioku.tools)
280
283
  (defun available-tools () (kioku.internal:rpc "tools-list" (kioku.internal:object)))
281
284
  (defun call-tool (name &optional (arguments (kioku.internal:object)))
@@ -296,7 +299,7 @@
296
299
  (kioku.internal:object "package" "kioku.user" "generation" kioku.internal:*generation*
297
300
  "symbols" (coerce (task-functions) 'vector))))
298
301
  (let ((package (find-package (string-upcase name))))
299
- (when (and package (member (package-name package) '("KIOKU.TOOLS" "KIOKU.PROCESS" "KIOKU.FILES" "KIOKU.DATA" "KIOKU.OBJECTS" "KIOKU.ENVIRONMENT" "KIOKU.CI" "KIOKU.PACKAGES" "KIOKU.TYPESAFE") :test #'equal))
302
+ (when (and package (member (package-name package) '("KIOKU.TOOLS" "KIOKU.PROCESS" "KIOKU.FILES" "KIOKU.DATA" "KIOKU.OBJECTS" "KIOKU.ENVIRONMENT" "KIOKU.CI" "KIOKU.PACKAGES" "KIOKU.TYPESAFE" "KIOKU.CODE") :test #'equal))
300
303
  (return-from describe-symbol
301
304
  (kioku.internal:object "package" (string-downcase (package-name package))
302
305
  "symbols" (coerce (sort (loop for symbol being the external-symbols of package
@@ -306,7 +309,7 @@
306
309
  (multiple-value-bind (symbol end) (read-from-string name)
307
310
  (unless (and (symbolp symbol) (symbol-package symbol) (fboundp symbol)
308
311
  (zerop (length (string-trim '(#\Space #\Tab #\Newline #\Return) (subseq name end))))
309
- (member (package-name (symbol-package symbol)) '("KIOKU.USER" "KIOKU.TOOLS" "KIOKU.PROCESS" "KIOKU.FILES" "KIOKU.DATA" "KIOKU.OBJECTS" "KIOKU.ENVIRONMENT" "KIOKU.CI" "KIOKU.PACKAGES" "KIOKU.TYPESAFE") :test #'equal))
312
+ (member (package-name (symbol-package symbol)) '("KIOKU.USER" "KIOKU.TOOLS" "KIOKU.PROCESS" "KIOKU.FILES" "KIOKU.DATA" "KIOKU.OBJECTS" "KIOKU.ENVIRONMENT" "KIOKU.CI" "KIOKU.PACKAGES" "KIOKU.TYPESAFE" "KIOKU.CODE") :test #'equal))
310
313
  (error "UNKNOWN_SYMBOL"))
311
314
  (kioku.internal:object "symbol" name "arguments" (kioku.internal::printed (sb-introspect:function-lambda-list symbol)) "documentation" (or (documentation symbol 'function) "No function documentation."))))))
312
315
 
@@ -521,3 +524,28 @@
521
524
  (list (loop for line in lines while (< (length out) cap) do (visit line)))
522
525
  (vector (loop for line across lines while (< (length out) cap) do (visit line)))))
523
526
  (coerce out 'simple-vector)))
527
+
528
+ (in-package :kioku.code)
529
+ (define-condition service-error (error)
530
+ ((code :initarg :code :reader error-code) (message :initarg :message :reader service-message))
531
+ (:report (lambda (condition stream) (format stream "~A: ~A" (error-code condition) (service-message condition)))))
532
+ (defun %request (method &rest pairs)
533
+ (let ((args (make-hash-table :test 'equal)))
534
+ (loop for (key value) on pairs by #'cddr when value do (setf (gethash key args) value))
535
+ (kioku.internal:rpc method args)))
536
+ (defun capabilities () (%request "code-capabilities"))
537
+ (defun open (path) (%request "code-open" "path" path))
538
+ (defun outline (handle &key range limit) (%request "code-outline" "handle" handle "range" range "limit" limit))
539
+ (defun enclosing (handle position &key kinds) (%request "code-enclosing" "handle" handle "position" position "kinds" (and kinds (coerce kinds 'vector))))
540
+ (defun query (handle query-id &key range limit) (%request "code-query" "handle" handle "queryId" query-id "range" range "limit" limit))
541
+ (defun span (node-handle &key max-chars) (%request "code-span" "nodeHandle" node-handle "maxChars" max-chars))
542
+ (defun semantic (handle kind &key position limit) (%request "code-semantic" "handle" handle "kind" kind "position" position "limit" limit))
543
+ (defun release (handle) (%request "code-release" "handle" handle))
544
+ (defmacro with-snapshot ((handle path) &body body)
545
+ "Bind HANDLE only for an accepted snapshot; always release, including errors."
546
+ (let ((response (gensym "SNAPSHOT")))
547
+ `(let ((,response (open ,path)))
548
+ (if (member (gethash "status" ,response) '("ok" "partial") :test #'equal)
549
+ (let ((,handle (gethash "handle" (gethash "data" ,response))))
550
+ (unwind-protect (progn ,@body) (release ,handle)))
551
+ ,response))))
@@ -0,0 +1,19 @@
1
+ CREATE TABLE dsh_owned_operations (
2
+ operation_id TEXT PRIMARY KEY,
3
+ run_id TEXT NOT NULL REFERENCES ledger_runs(run_id) ON DELETE CASCADE,
4
+ session_id TEXT NOT NULL,
5
+ generation TEXT NOT NULL,
6
+ request_digest TEXT NOT NULL,
7
+ state TEXT NOT NULL CHECK(state IN ('started','completed','unknown')),
8
+ receipt_json TEXT NOT NULL CHECK(json_valid(receipt_json)),
9
+ updated_at TEXT NOT NULL
10
+ );
11
+ CREATE INDEX idx_dsh_owned_operations_run ON dsh_owned_operations(run_id, generation);
12
+ CREATE TABLE memory_execution_links (
13
+ entry_id TEXT NOT NULL REFERENCES entries(id) ON DELETE CASCADE,
14
+ revision INTEGER NOT NULL,
15
+ operation_id TEXT NOT NULL REFERENCES dsh_owned_operations(operation_id),
16
+ PRIMARY KEY(entry_id, revision, operation_id)
17
+ );
18
+ ALTER TABLE dsh_memory_finalizations ADD COLUMN staged_capsule_json TEXT CHECK(staged_capsule_json IS NULL OR json_valid(staged_capsule_json));
19
+ ALTER TABLE dsh_memory_finalizations ADD COLUMN staged_binding_hash TEXT;