@code-yeongyu/senpi 2026.11.10 → 2026.11.11

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 (320) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/dist/bundle/{SKILL-B4R7BVOT.md → SKILL-R7FEIQKG.md} +1 -1
  3. package/dist/bundle/chunks/{SKILL-AZ6ONO52.js → SKILL-5O2UKORG.js} +1 -1
  4. package/dist/bundle/chunks/{SKILL-B4R7BVOT.md → SKILL-R7FEIQKG.md} +1 -1
  5. package/dist/bundle/chunks/{args-77GYOPEO.js → args-HFYB6URH.js} +1 -1
  6. package/dist/bundle/chunks/{azure-openai-responses-YFZ734T3.js → azure-openai-responses-MNN2TINI.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-ZUQCYIRY.js → chunk-2ODGHBUD.js} +1 -1
  8. package/dist/bundle/chunks/chunk-3IYEGHBI.js +2 -0
  9. package/dist/bundle/chunks/{chunk-I5ASHSLZ.js → chunk-4JMGWVRH.js} +1 -1
  10. package/dist/bundle/chunks/{chunk-YKYWL2NO.js → chunk-5F2XC6UC.js} +3 -3
  11. package/dist/bundle/chunks/{chunk-MSDBBOB2.js → chunk-5H43O4MA.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-R3OP7IA4.js → chunk-5PIZWSNG.js} +4 -4
  13. package/dist/bundle/chunks/{chunk-33MZJTQ3.js → chunk-B4WD5XHP.js} +1 -1
  14. package/dist/bundle/chunks/{chunk-Q63YLZMN.js → chunk-BPEA5SWW.js} +2 -2
  15. package/dist/bundle/chunks/{chunk-MOVJQVMC.js → chunk-BUDJLVMF.js} +3 -3
  16. package/dist/bundle/chunks/{chunk-V5FSENW6.js → chunk-COKX65TE.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-2EJ4BGBM.js → chunk-DHORIIVQ.js} +1 -1
  18. package/dist/bundle/chunks/{chunk-NH7SYIGN.js → chunk-DLPV4B3R.js} +1 -1
  19. package/dist/bundle/chunks/{chunk-RCHIMH7N.js → chunk-DQY26AX3.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-Y7Z7XPUF.js → chunk-DZQA5LVN.js} +1 -1
  21. package/dist/bundle/chunks/{chunk-2CNSCMYC.js → chunk-E5O4SP5I.js} +1 -1
  22. package/dist/bundle/chunks/{chunk-3Q5ZENSD.js → chunk-E6ZBTSC6.js} +1 -1
  23. package/dist/bundle/chunks/{chunk-GVPZPVVO.js → chunk-IBDAV2AL.js} +3 -3
  24. package/dist/bundle/chunks/chunk-IREUIMFE.js +11 -0
  25. package/dist/bundle/chunks/{chunk-KU7OCWJF.js → chunk-J4ADZ2OK.js} +1 -1
  26. package/dist/bundle/chunks/{chunk-T2SMQPRE.js → chunk-K3GAGIPX.js} +1 -1
  27. package/dist/bundle/chunks/{chunk-BELNOPAI.js → chunk-L3KVP7VJ.js} +3 -3
  28. package/dist/bundle/chunks/{chunk-IYSJFQUU.js → chunk-L6DF5G6K.js} +1 -1
  29. package/dist/bundle/chunks/{chunk-7MN7YNO5.js → chunk-L7DGTA3L.js} +1 -1
  30. package/dist/bundle/chunks/chunk-LJFQYCFH.js +2 -0
  31. package/dist/bundle/chunks/{chunk-J2NGJKXL.js → chunk-LXINMDMX.js} +1 -1
  32. package/dist/bundle/chunks/{chunk-H33A33M4.js → chunk-M2VJVJMK.js} +1 -1
  33. package/dist/bundle/chunks/{chunk-2U6HXWXS.js → chunk-NNQ34ZDW.js} +1 -1
  34. package/dist/bundle/chunks/chunk-NQKCJQHB.js +2 -0
  35. package/dist/bundle/chunks/{chunk-EJB5E2JK.js → chunk-NRZAJUUO.js} +2 -2
  36. package/dist/bundle/chunks/{chunk-R2Z7CX77.js → chunk-OSNR3IRD.js} +1 -1
  37. package/dist/bundle/chunks/{chunk-O3FG6HML.js → chunk-PJI5GT7U.js} +1 -1
  38. package/dist/bundle/chunks/{chunk-FDNM2DAE.js → chunk-PUZDKFRT.js} +164 -164
  39. package/dist/bundle/chunks/{chunk-BPNSOZ2C.js → chunk-QUVSIW2R.js} +1 -1
  40. package/dist/bundle/chunks/{chunk-WXYMAUFX.js → chunk-QX7WD3IM.js} +1 -1
  41. package/dist/bundle/chunks/{chunk-Y4ONXQMR.js → chunk-RGHVPUUX.js} +1 -1
  42. package/dist/bundle/chunks/{chunk-RYPM5BZQ.js → chunk-S7NAJQB3.js} +1 -1
  43. package/dist/bundle/chunks/{chunk-2BH54YQR.js → chunk-SANWO37B.js} +1 -1
  44. package/dist/bundle/chunks/{chunk-YQZNARTX.js → chunk-SS5VTBAV.js} +1 -1
  45. package/dist/bundle/chunks/{chunk-LT353NSF.js → chunk-T4CUD7RF.js} +1 -1
  46. package/dist/bundle/chunks/{chunk-J7FW7MED.js → chunk-TCZORL3V.js} +1 -1
  47. package/dist/bundle/chunks/{chunk-KU72IKV5.js → chunk-VGSWOLIY.js} +1 -1
  48. package/dist/bundle/chunks/{chunk-DBQBJTMF.js → chunk-VUY4BZDI.js} +1 -1
  49. package/dist/bundle/chunks/chunk-XI6THO4F.js +2 -0
  50. package/dist/bundle/chunks/{chunk-FAFIGBUD.js → chunk-XUDKT4UH.js} +3 -3
  51. package/dist/bundle/chunks/{cli-main-BX5AFWJQ.js → cli-main-7II7GCIR.js} +1 -1
  52. package/dist/bundle/chunks/{credential-accounts-LVVPKFEY.js → credential-accounts-N3B5YJS7.js} +1 -1
  53. package/dist/bundle/chunks/{dispatch-EP35KKJ3.js → dispatch-YUYZQXRP.js} +1 -1
  54. package/dist/bundle/chunks/github-copilot.js +1 -1
  55. package/dist/bundle/chunks/{hand-entry-F6PWKNPJ.js → hand-entry-ONOLRMVB.js} +3 -3
  56. package/dist/bundle/chunks/{headless-host-HKGNJGYT.js → headless-host-53UMJMM6.js} +1 -1
  57. package/dist/bundle/chunks/{health-write-FBF74QJ7.js → health-write-JLSF5EVV.js} +1 -1
  58. package/dist/bundle/chunks/{help-fast-path-5SCPY3OH.js → help-fast-path-552QLMWT.js} +1 -1
  59. package/dist/bundle/chunks/{host-command-47QQKJEY.js → host-command-KWMJLPBS.js} +1 -1
  60. package/dist/bundle/chunks/{host-lifecycle-VSAH4M3R.js → host-lifecycle-4WQDCN3Y.js} +1 -1
  61. package/dist/bundle/chunks/host-lifecycle.js +5 -5
  62. package/dist/bundle/chunks/{host-session-command-SL4AN5WD.js → host-session-command-ZDYEKCUB.js} +1 -1
  63. package/dist/bundle/chunks/{host-socket-request-DMYXC56U.js → host-socket-request-QN4Q2P5E.js} +1 -1
  64. package/dist/bundle/chunks/{interactive-mode-JDMIHJMQ.js → interactive-mode-EPE4M32G.js} +1 -1
  65. package/dist/bundle/chunks/{login-health-EVXVLHB2.js → login-health-TOSQT5RG.js} +1 -1
  66. package/dist/bundle/chunks/{main-4RITUAQF.js → main-OM7BKVZG.js} +1 -1
  67. package/dist/bundle/chunks/{multi-session-host-SKDD4OWM.js → multi-session-host-DB6XMY53.js} +11 -8
  68. package/dist/bundle/chunks/openai-codex-responses-VRGOAFEG.js +10 -0
  69. package/dist/bundle/chunks/{openai-responses-NIVBWE2H.js → openai-responses-I7PXRWCM.js} +2 -2
  70. package/dist/bundle/chunks/{package-manager-cli-B5VA4KFO.js → package-manager-cli-GLU5Q2KV.js} +1 -1
  71. package/dist/bundle/chunks/{role-HQUN4XXK.js → role-AEOLJRTP.js} +1 -1
  72. package/dist/bundle/chunks/{rotation-stream-F3BEMXBE.js → rotation-stream-E3FJFHXJ.js} +1 -1
  73. package/dist/bundle/chunks/rpc-mode-SDJVBT36.js +2 -0
  74. package/dist/bundle/chunks/{rpc-monitor-source-C6VQ3BC4.js → rpc-monitor-source-PGTDSGWP.js} +1 -1
  75. package/dist/bundle/chunks/{run-attached-tui-R3RB5P7G.js → run-attached-tui-4AENRP7P.js} +1 -1
  76. package/dist/bundle/chunks/{schedule-command-FPEQCX33.js → schedule-command-5SQD7M5N.js} +1 -1
  77. package/dist/bundle/chunks/session-control-endpoint-R25A2QGS.js +3 -0
  78. package/dist/bundle/chunks/{session-picker-2FZSNFS7.js → session-picker-GZM5CVQL.js} +1 -1
  79. package/dist/bundle/chunks/{session-slot-CZGQQCOC.js → session-slot-RH7JLO3F.js} +1 -1
  80. package/dist/bundle/chunks/session-worker.js +335 -332
  81. package/dist/bundle/chunks/{state-store-S7QAESIF.js → state-store-IECVTYXC.js} +1 -1
  82. package/dist/bundle/cli.js +2 -2
  83. package/dist/bundle/host-supervisor.js +5 -5
  84. package/dist/bundle/index.js +1 -1
  85. package/dist/bundle/rpc-entry.js +1 -1
  86. package/dist/bundle/runtime-manifest.json +1 -1
  87. package/dist/cli.js +9 -3
  88. package/dist/core/agent-session-runtime.d.ts +2 -0
  89. package/dist/core/agent-session-runtime.js +5 -0
  90. package/dist/core/agent-session.d.ts +15 -3
  91. package/dist/core/agent-session.js +91 -18
  92. package/dist/core/assistant-error-redaction.d.ts +9 -0
  93. package/dist/core/assistant-error-redaction.js +27 -0
  94. package/dist/core/config-reference-redaction.js +90 -10
  95. package/dist/core/context-files.d.ts +10 -0
  96. package/dist/core/context-files.js +58 -12
  97. package/dist/core/credential-accounts.d.ts +2 -0
  98. package/dist/core/credential-accounts.js +10 -1
  99. package/dist/core/dynamic-prompt/intent-gate.js +2 -2
  100. package/dist/core/dynamic-prompt/style.js +2 -2
  101. package/dist/core/dynamic-prompt/verification.js +2 -2
  102. package/dist/core/egress/wire.d.ts +13 -0
  103. package/dist/core/extensions/builtin/anthropic-subscription/accounts.d.ts +3 -0
  104. package/dist/core/extensions/builtin/anthropic-subscription/auth-lane.js +3 -2
  105. package/dist/core/extensions/builtin/anthropic-subscription/claude-cli-account-test.js +3 -1
  106. package/dist/core/extensions/builtin/anthropic-subscription/claude-cli-connection-test.d.ts +3 -1
  107. package/dist/core/extensions/builtin/anthropic-subscription/claude-cli-connection-test.js +47 -16
  108. package/dist/core/extensions/builtin/anthropic-subscription/claude-cli-login-slots.d.ts +1 -1
  109. package/dist/core/extensions/builtin/anthropic-subscription/claude-cli-login-slots.js +4 -2
  110. package/dist/core/extensions/builtin/anthropic-subscription/claude-settings-env.d.ts +20 -0
  111. package/dist/core/extensions/builtin/anthropic-subscription/claude-settings-env.js +39 -0
  112. package/dist/core/extensions/builtin/anthropic-subscription/context-window.d.ts +17 -0
  113. package/dist/core/extensions/builtin/anthropic-subscription/context-window.js +23 -0
  114. package/dist/core/extensions/builtin/anthropic-subscription/errors.d.ts +1 -0
  115. package/dist/core/extensions/builtin/anthropic-subscription/errors.js +14 -5
  116. package/dist/core/extensions/builtin/anthropic-subscription/oauth-login.js +3 -3
  117. package/dist/core/extensions/builtin/anthropic-subscription/prompt-cache-ttl.d.ts +10 -4
  118. package/dist/core/extensions/builtin/anthropic-subscription/prompt-cache-ttl.js +14 -5
  119. package/dist/core/extensions/builtin/anthropic-subscription/query-environment.d.ts +3 -2
  120. package/dist/core/extensions/builtin/anthropic-subscription/query-environment.js +5 -4
  121. package/dist/core/extensions/builtin/anthropic-subscription/sdk-boundary.lazy.d.ts +2 -1
  122. package/dist/core/extensions/builtin/anthropic-subscription/sdk-boundary.lazy.js +1 -0
  123. package/dist/core/extensions/builtin/anthropic-subscription/stream.js +11 -1
  124. package/dist/core/extensions/builtin/config-reload/change-groups.js +6 -2
  125. package/dist/core/extensions/builtin/goal/continuation.d.ts +6 -0
  126. package/dist/core/extensions/builtin/goal/continuation.js +3 -2
  127. package/dist/core/extensions/builtin/goal/index.js +14 -26
  128. package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts +8 -6
  129. package/dist/core/extensions/builtin/goal/lifecycle-helpers.js +77 -39
  130. package/dist/core/extensions/builtin/goal/monitor-continuation.js +66 -7
  131. package/dist/core/extensions/builtin/goal/persistence.js +20 -0
  132. package/dist/core/extensions/builtin/goal/provider-retry.d.ts +9 -0
  133. package/dist/core/extensions/builtin/goal/provider-retry.js +16 -0
  134. package/dist/core/extensions/builtin/goal/reload-reengagement.d.ts +3 -2
  135. package/dist/core/extensions/builtin/goal/reload-reengagement.js +4 -4
  136. package/dist/core/extensions/builtin/goal/session-start-continuation.d.ts +28 -0
  137. package/dist/core/extensions/builtin/goal/session-start-continuation.js +75 -0
  138. package/dist/core/extensions/builtin/goal/store.d.ts +3 -2
  139. package/dist/core/extensions/builtin/goal/store.js +9 -2
  140. package/dist/core/extensions/builtin/goal/types.d.ts +9 -0
  141. package/dist/core/extensions/builtin/handoff-hint/index.js +15 -11
  142. package/dist/core/extensions/builtin/handoff-hint/replacement-relay.d.ts +16 -0
  143. package/dist/core/extensions/builtin/handoff-hint/replacement-relay.js +17 -0
  144. package/dist/core/extensions/builtin/html-render/tool.js +13 -3
  145. package/dist/core/extensions/builtin/imagegen/skill/SKILL.md +1 -1
  146. package/dist/core/extensions/builtin/imagegen/tool.js +4 -14
  147. package/dist/core/extensions/builtin/mcp/auth/catalog-identity.js +32 -8
  148. package/dist/core/extensions/builtin/mcp/auth/commands-auth.js +2 -1
  149. package/dist/core/extensions/builtin/mcp/auth/context.js +3 -0
  150. package/dist/core/extensions/builtin/mcp/auth/oauth-grant.d.ts +43 -0
  151. package/dist/core/extensions/builtin/mcp/auth/oauth-grant.js +196 -0
  152. package/dist/core/extensions/builtin/mcp/auth/oauth-issuer.d.ts +7 -1
  153. package/dist/core/extensions/builtin/mcp/auth/oauth-issuer.js +13 -0
  154. package/dist/core/extensions/builtin/mcp/auth/oauth-provider.d.ts +6 -17
  155. package/dist/core/extensions/builtin/mcp/auth/oauth-provider.js +67 -88
  156. package/dist/core/extensions/builtin/mcp/auth/oauth-refresh.d.ts +1 -1
  157. package/dist/core/extensions/builtin/mcp/auth/oauth-refresh.js +25 -4
  158. package/dist/core/extensions/builtin/mcp/auth/oauth.js +10 -7
  159. package/dist/core/extensions/builtin/mcp/auth/registered-redirect.d.ts +19 -0
  160. package/dist/core/extensions/builtin/mcp/auth/registered-redirect.js +55 -0
  161. package/dist/core/extensions/builtin/mcp/auth/token-store.d.ts +23 -1
  162. package/dist/core/extensions/builtin/mcp/auth/token-store.js +3 -0
  163. package/dist/core/extensions/builtin/mcp/catalog-cache.js +7 -6
  164. package/dist/core/extensions/builtin/mcp/catalog.js +3 -2
  165. package/dist/core/extensions/builtin/mcp/invocation.js +6 -0
  166. package/dist/core/extensions/builtin/mcp/service-register.js +16 -2
  167. package/dist/core/extensions/builtin/mcp/service-tools-changed.js +61 -54
  168. package/dist/core/extensions/builtin/mcp/startup-race.d.ts +2 -0
  169. package/dist/core/extensions/builtin/mcp/startup-race.js +25 -7
  170. package/dist/core/extensions/builtin/permission-system/parsers.js +1 -0
  171. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.js +3 -3
  172. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-2.js +9 -8
  173. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js +3 -3
  174. package/dist/core/extensions/builtin/prompt-preset/claude-haiku-5-5.js +3 -3
  175. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5-5.js +3 -3
  176. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js +4 -4
  177. package/dist/core/extensions/builtin/prompt-preset/claude-sonnet-5-5.js +3 -3
  178. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-1-flash.js +3 -3
  179. package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js +3 -3
  180. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +2 -2
  181. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js +3 -3
  182. package/dist/core/extensions/builtin/prompt-preset/grok-4.5.js +1 -1
  183. package/dist/core/extensions/builtin/prompt-preset/grok-4.6.js +4 -4
  184. package/dist/core/extensions/builtin/prompt-preset/grok-4.7.js +5 -5
  185. package/dist/core/extensions/builtin/prompt-preset/kimi-k3-1.js +4 -4
  186. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +7 -6
  187. package/dist/core/extensions/loader.js +24 -4
  188. package/dist/core/extensions/runner.d.ts +9 -1
  189. package/dist/core/extensions/runner.js +9 -4
  190. package/dist/core/extensions/types.d.ts +19 -3
  191. package/dist/core/hand/hook-advertise.d.ts +41 -0
  192. package/dist/core/hand/hook-advertise.js +98 -0
  193. package/dist/core/hand/hook-contract.d.ts +66 -0
  194. package/dist/core/hand/hook-contract.js +138 -0
  195. package/dist/core/open-timing.d.ts +2 -0
  196. package/dist/core/open-timing.js +7 -1
  197. package/dist/core/resource-loader.js +21 -3
  198. package/dist/core/retry-fallback/controller-types.d.ts +2 -0
  199. package/dist/core/retry-fallback/controller.js +9 -2
  200. package/dist/core/retry-fallback/cooldown.d.ts +7 -0
  201. package/dist/core/retry-fallback/cooldown.js +13 -1
  202. package/dist/core/retry-fallback/credential-recovery.d.ts +7 -0
  203. package/dist/core/retry-fallback/credential-recovery.js +24 -0
  204. package/dist/core/retry-fallback/log.d.ts +7 -1
  205. package/dist/core/retry-fallback/log.js +82 -5
  206. package/dist/core/retry-fallback/model-config-error.js +2 -1
  207. package/dist/core/retry-fallback/settings.d.ts +8 -5
  208. package/dist/core/retry-fallback/settings.js +9 -6
  209. package/dist/core/session-manager.d.ts +2 -0
  210. package/dist/core/session-manager.js +15 -1
  211. package/dist/core/settings-manager.d.ts +6 -0
  212. package/dist/core/settings-manager.js +8 -0
  213. package/dist/core/turn-origin.d.ts +18 -10
  214. package/dist/core/turn-origin.js +34 -30
  215. package/dist/core/ultrafast-lanes.d.ts +1 -0
  216. package/dist/core/ultrafast-lanes.js +4 -2
  217. package/dist/modes/interactive/components/footer.d.ts +23 -5
  218. package/dist/modes/interactive/components/footer.js +45 -16
  219. package/dist/modes/interactive/interactive-mode.js +9 -1
  220. package/dist/modes/interactive/session-control-rpc-commands.d.ts +1 -1
  221. package/dist/modes/interactive/session-control-rpc-commands.js +5 -0
  222. package/dist/modes/rpc/admit-external-message-command.d.ts +2 -0
  223. package/dist/modes/rpc/admit-external-message-command.js +5 -1
  224. package/dist/modes/rpc/compact-admission-validation.js +4 -1
  225. package/dist/modes/rpc/connection-authority.d.ts +2 -1
  226. package/dist/modes/rpc/connection-authority.js +11 -9
  227. package/dist/modes/rpc/connection-handler.d.ts +2 -0
  228. package/dist/modes/rpc/connection-handler.js +33 -7
  229. package/dist/modes/rpc/connection-roles.d.ts +7 -0
  230. package/dist/modes/rpc/connection-roles.js +15 -0
  231. package/dist/modes/rpc/custom-capability.d.ts +6 -0
  232. package/dist/modes/rpc/custom-capability.js +6 -0
  233. package/dist/modes/rpc/delegated-drive-origin.d.ts +6 -6
  234. package/dist/modes/rpc/delegated-drive-origin.js +7 -8
  235. package/dist/modes/rpc/delegation-declaration.d.ts +2 -0
  236. package/dist/modes/rpc/delegation-declaration.js +7 -3
  237. package/dist/modes/rpc/effect-commands.d.ts +33 -0
  238. package/dist/modes/rpc/host-capabilities.d.ts +1 -0
  239. package/dist/modes/rpc/host-capabilities.js +7 -1
  240. package/dist/modes/rpc/host-gc-evidence.d.ts +1 -1
  241. package/dist/modes/rpc/host-gc-evidence.js +9 -3
  242. package/dist/modes/rpc/host-gc.js +4 -1
  243. package/dist/modes/rpc/host-observe-request.d.ts +2 -0
  244. package/dist/modes/rpc/host-observe-request.js +6 -1
  245. package/dist/modes/rpc/host-park-ledger.d.ts +19 -0
  246. package/dist/modes/rpc/host-park-ledger.js +110 -0
  247. package/dist/modes/rpc/lifecycle-delivery.js +4 -1
  248. package/dist/modes/rpc/loopless-tool-handlers.d.ts +6 -0
  249. package/dist/modes/rpc/loopless-tool-handlers.js +14 -1
  250. package/dist/modes/rpc/media-placeholders.js +1 -0
  251. package/dist/modes/rpc/method-classes-schema-host.d.ts +42 -1
  252. package/dist/modes/rpc/method-classes-schema-host.js +24 -21
  253. package/dist/modes/rpc/method-classes-schema-session.d.ts +20 -0
  254. package/dist/modes/rpc/method-classes-schema-session.js +6 -0
  255. package/dist/modes/rpc/method-classes-schema.d.ts +62 -1
  256. package/dist/modes/rpc/method-classes-schema.js +5 -2
  257. package/dist/modes/rpc/method-classes.d.ts +4 -0
  258. package/dist/modes/rpc/method-classes.js +6 -0
  259. package/dist/modes/rpc/multi-session-host.js +1 -1
  260. package/dist/modes/rpc/project-file-commands.d.ts +32 -0
  261. package/dist/modes/rpc/project-file-commands.js +195 -0
  262. package/dist/modes/rpc/project-file-path.d.ts +34 -0
  263. package/dist/modes/rpc/project-file-path.js +93 -0
  264. package/dist/modes/rpc/rpc-error-types.d.ts +9 -1
  265. package/dist/modes/rpc/rpc-error-types.js +8 -0
  266. package/dist/modes/rpc/rpc-host-command-types.d.ts +14 -1
  267. package/dist/modes/rpc/rpc-host-response-types.d.ts +21 -0
  268. package/dist/modes/rpc/rpc-mutation-response-types.d.ts +7 -0
  269. package/dist/modes/rpc/rpc-read-response-types.d.ts +7 -0
  270. package/dist/modes/rpc/rpc-session-command-types.d.ts +10 -0
  271. package/dist/modes/rpc/rpc-session-state-types.d.ts +2 -0
  272. package/dist/modes/rpc/session-attachment-gate.js +6 -0
  273. package/dist/modes/rpc/session-binding.d.ts +1 -0
  274. package/dist/modes/rpc/session-binding.js +6 -1
  275. package/dist/modes/rpc/session-command-activity.js +1 -0
  276. package/dist/modes/rpc/session-connection-context.d.ts +2 -0
  277. package/dist/modes/rpc/session-connection-context.js +4 -0
  278. package/dist/modes/rpc/session-registry-attach.d.ts +2 -0
  279. package/dist/modes/rpc/session-registry-attach.js +15 -11
  280. package/dist/modes/rpc/session-registry-claims.js +2 -0
  281. package/dist/modes/rpc/session-registry-open.js +13 -7
  282. package/dist/modes/rpc/session-registry-opening.js +2 -1
  283. package/dist/modes/rpc/session-registry-types.d.ts +4 -0
  284. package/dist/modes/rpc/session-registry.d.ts +3 -0
  285. package/dist/modes/rpc/session-registry.js +27 -3
  286. package/dist/modes/rpc/session-router-close.js +1 -0
  287. package/dist/modes/rpc/session-router-context.d.ts +4 -2
  288. package/dist/modes/rpc/session-router-context.js +3 -0
  289. package/dist/modes/rpc/session-router-host-reads.js +1 -0
  290. package/dist/modes/rpc/session-router-occupancy.js +10 -1
  291. package/dist/modes/rpc/session-router-open-result.d.ts +12 -0
  292. package/dist/modes/rpc/session-router-open-result.js +63 -0
  293. package/dist/modes/rpc/session-router-open.d.ts +3 -0
  294. package/dist/modes/rpc/session-router-open.js +15 -63
  295. package/dist/modes/rpc/session-router-park.d.ts +15 -0
  296. package/dist/modes/rpc/session-router-park.js +176 -0
  297. package/dist/modes/rpc/session-router-routing.d.ts +1 -1
  298. package/dist/modes/rpc/session-router-routing.js +7 -0
  299. package/dist/modes/rpc/session-status-source.js +2 -2
  300. package/dist/private-fd-startup-fillers.d.ts +2 -2
  301. package/dist/private-fd-startup-fillers.js +34 -4
  302. package/dist/senpi +9 -3
  303. package/docs/engine-socket/fixtures/admission-routes/h-legacy.json +1 -1
  304. package/docs/engine-socket/fixtures/rpc-inbound-samples.json +44 -2
  305. package/docs/extensions.md +11 -1
  306. package/docs/rpc.md +106 -2
  307. package/docs/settings.md +5 -3
  308. package/docs/skills.md +1 -1
  309. package/docs/usage.md +1 -1
  310. package/native/socket-secret/prebuilds/win32-arm64/senpi_socket_secret.win32-arm64.node +0 -0
  311. package/native/socket-secret/prebuilds/win32-x64/senpi_socket_secret.win32-x64.node +0 -0
  312. package/package.json +6 -6
  313. package/dist/bundle/chunks/chunk-436DNN4Z.js +0 -2
  314. package/dist/bundle/chunks/chunk-DLAY7CIU.js +0 -2
  315. package/dist/bundle/chunks/chunk-SJI6UB23.js +0 -2
  316. package/dist/bundle/chunks/chunk-XH2MWTXA.js +0 -11
  317. package/dist/bundle/chunks/chunk-YK3ZZCHI.js +0 -2
  318. package/dist/bundle/chunks/openai-codex-responses-ABB2J43U.js +0 -10
  319. package/dist/bundle/chunks/rpc-mode-ZDUGW2IM.js +0 -2
  320. package/dist/bundle/chunks/session-control-endpoint-MEDV66PS.js +0 -3
@@ -12,6 +12,8 @@
12
12
  * and the connection attaches, so a client cannot hold a session while its host idles out under it.
13
13
  * `warm` never attaches, marked or not: it opens nothing, so a host that only received it idles out
14
14
  * on its normal deadline (senpi#2314).
15
+ * `park_session` likewise holds no client attachment: its speculative runtime is discarded at host exit.
16
+ * `claim_session` takes an ordinary opener attachment and is never observing.
15
17
  * Hosts that predate the field ignore it (commands are parsed by `type`), so a marked read works
16
18
  * against every generation.
17
19
  *
@@ -59,7 +61,10 @@ export function isObservingRequest(line) {
59
61
  if (typeof request !== "object" || request === null || Array.isArray(request))
60
62
  return false;
61
63
  const record = request;
62
- if (record.type === "warm" || record.type === "authenticate" || record.type === RPC_LAUNCH_PROOF_RECORD)
64
+ if (record.type === "warm" ||
65
+ record.type === "park_session" ||
66
+ record.type === "authenticate" ||
67
+ record.type === RPC_LAUNCH_PROOF_RECORD)
63
68
  return true;
64
69
  return record[OBSERVE_REQUEST_FIELD] === true && OBSERVING_COMMANDS.has(record.type);
65
70
  }
@@ -0,0 +1,19 @@
1
+ import type { OpenRpcSession } from "./session-registry.ts";
2
+ /** Owns both in-flight builds and ready parks, including the races with claim, expiry and shutdown. */
3
+ export declare class HostParkLedger {
4
+ private readonly parks;
5
+ private readonly replacements;
6
+ private stopped;
7
+ private readonly close;
8
+ constructor(close: (opened: OpenRpcSession) => Promise<void>);
9
+ get size(): number;
10
+ park(key: string, build: () => Promise<OpenRpcSession>): Promise<"parked" | "already_parked" | "full">;
11
+ /** A claim never waits for a build, and consumes the ready park synchronously. */
12
+ take(key: string): OpenRpcSession | undefined;
13
+ finish(key: string): void;
14
+ replace(key: string, build: () => Promise<OpenRpcSession>): void;
15
+ /** Fences new builds synchronously; every build already accepted is closed when it finishes. */
16
+ stop(): Promise<void>;
17
+ private retire;
18
+ }
19
+ //# sourceMappingURL=host-park-ledger.d.ts.map
@@ -0,0 +1,110 @@
1
+ /** Speculation is bounded independently of the unlimited in-process session registry. */
2
+ const MAX_PARKS = 4;
3
+ const PARK_TTL_MS = 60_000;
4
+ /** Owns both in-flight builds and ready parks, including the races with claim, expiry and shutdown. */
5
+ export class HostParkLedger {
6
+ constructor(close) {
7
+ this.parks = new Map();
8
+ this.replacements = new Map();
9
+ this.stopped = false;
10
+ this.close = close;
11
+ }
12
+ get size() {
13
+ return this.parks.size;
14
+ }
15
+ async park(key, build) {
16
+ const existing = this.parks.get(key);
17
+ if (existing && !existing.claim && !existing.closing) {
18
+ await existing.ready;
19
+ return "already_parked";
20
+ }
21
+ // A park being claimed or closed is on its way out; the replacement scheduled after it builds the next.
22
+ if (existing)
23
+ return "full";
24
+ const replacement = this.replacements.get(key);
25
+ if (replacement !== undefined) {
26
+ clearTimeout(replacement);
27
+ this.replacements.delete(key);
28
+ }
29
+ if (this.stopped)
30
+ throw new Error("host_draining");
31
+ if (this.parks.size + this.replacements.size >= MAX_PARKS)
32
+ return "full";
33
+ const ready = Promise.withResolvers();
34
+ ready.promise.catch(() => { });
35
+ const park = { ready: ready.promise };
36
+ // Reserved before build's first await: a second request joins, never starts another runtime.
37
+ this.parks.set(key, park);
38
+ try {
39
+ park.opened = await build();
40
+ if (!this.stopped) {
41
+ park.expiry = setTimeout(() => void this.retire(key, park), PARK_TTL_MS);
42
+ park.expiry.unref?.();
43
+ }
44
+ ready.resolve();
45
+ if (this.stopped)
46
+ await this.retire(key, park);
47
+ return "parked";
48
+ }
49
+ catch (cause) {
50
+ this.parks.delete(key);
51
+ ready.reject(cause);
52
+ throw cause;
53
+ }
54
+ }
55
+ /** A claim never waits for a build, and consumes the ready park synchronously. */
56
+ take(key) {
57
+ const park = this.parks.get(key);
58
+ if (this.stopped || !park?.opened || park.claim || park.closing)
59
+ return undefined;
60
+ clearTimeout(park.expiry);
61
+ park.claim = Promise.withResolvers();
62
+ return park.opened;
63
+ }
64
+ finish(key) {
65
+ const park = this.parks.get(key);
66
+ this.parks.delete(key);
67
+ park?.claim?.resolve();
68
+ }
69
+ replace(key, build) {
70
+ if (this.stopped || this.replacements.has(key))
71
+ return;
72
+ const timer = setTimeout(() => {
73
+ this.replacements.delete(key);
74
+ void this.park(key, build).catch((cause) => {
75
+ process.stderr.write(`senpi rpc replacement park failed: ${String(cause)}\n`);
76
+ });
77
+ }, 0);
78
+ timer.unref?.();
79
+ this.replacements.set(key, timer);
80
+ }
81
+ /** Fences new builds synchronously; every build already accepted is closed when it finishes. */
82
+ async stop() {
83
+ this.stopped = true;
84
+ for (const timer of this.replacements.values())
85
+ clearTimeout(timer);
86
+ this.replacements.clear();
87
+ await Promise.all([...this.parks].map(async ([key, park]) => {
88
+ await park.ready.catch(() => { });
89
+ if (park.claim)
90
+ await park.claim.promise;
91
+ else
92
+ await this.retire(key, park);
93
+ }));
94
+ }
95
+ retire(key, park) {
96
+ clearTimeout(park.expiry);
97
+ park.closing ??= (async () => {
98
+ try {
99
+ if (park.opened)
100
+ await this.close(park.opened);
101
+ }
102
+ finally {
103
+ if (this.parks.get(key) === park)
104
+ this.parks.delete(key);
105
+ }
106
+ })();
107
+ return park.closing;
108
+ }
109
+ }
110
+ //# sourceMappingURL=host-park-ledger.js.map
@@ -15,7 +15,10 @@ export function observeLifecycleDelivery(record) {
15
15
  return record;
16
16
  if (record.command === "get_state")
17
17
  return { ...record, data: observeState(data) };
18
- if (record.command === "open_session" && "state" in data && typeof data.state === "object" && data.state !== null)
18
+ if ((record.command === "open_session" || record.command === "claim_session") &&
19
+ "state" in data &&
20
+ typeof data.state === "object" &&
21
+ data.state !== null)
19
22
  return { ...record, data: { ...data, state: observeState(data.state) } };
20
23
  return record;
21
24
  }
@@ -25,6 +25,12 @@ export type LooplessLoopHooks = (event: string, payload: JsonValue) => Promise<J
25
25
  * (`errors`).
26
26
  */
27
27
  export declare function extensionLoopHooks(runner: ExtensionRunner, twoSidedHome: TwoSidedHome, cwd: string, call: LoopHookCall): LooplessLoopHooks;
28
+ /**
29
+ * The user's loop hooks, which a hand runs for a hosted loop: its non-builtin extensions (C7(c), K5) and the hooks
30
+ * builtin, which runs the user's shell hooks (C8). Every other builtin is the loop's own machinery (model, compaction,
31
+ * todo, search): each side loads its own builtins, so those run where the loop runs, as S29 never forwards builtins.
32
+ */
33
+ export declare const isUserLoopHook: (extensionPath: string) => boolean;
28
34
  /** A message a loop hook sent during its call, for the loop to send with the same options. */
29
35
  export interface SentLoopMessage {
30
36
  readonly message: Parameters<LoopHookCallFacts["sendMessage"]>[0];
@@ -1,5 +1,6 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
2
  import { forwardToolEvents } from "../../core/extensions/two-sided-forwarding.js";
3
+ import { hookModelOf, hookRequestOutputOf, parseHookRequestInput } from "../../core/hand/hook-contract.js";
3
4
  /**
4
5
  * A loopless runtime's own extensions' `tool_call`/`tool_result` handlers, emitted as a session emits them. On a hand
5
6
  * (a call that carries its nested requests), a two-sided extension's handlers are forwarded to the loop that owns the
@@ -78,6 +79,18 @@ export function extensionLoopHooks(runner, twoSidedHome, cwd, call) {
78
79
  ...(preview === undefined ? {} : { preview }),
79
80
  })));
80
81
  }
82
+ if (event === "before_provider_request") {
83
+ // The hosted loop's request hooks (CK21): the user's hooks get the projected input (payload and effective model,
84
+ // no headers), and the reply's `output` carries the payload they produced.
85
+ const input = parseHookRequestInput(payload.input);
86
+ const model = hookModelOf(input);
87
+ return call.run(sessionId, cwd, idle, (effects) => dispatchLoopHook(runner, call, effects, async () => ({
88
+ output: hookRequestOutputOf(input, await runner.emitBeforeProviderRequest(structuredClone(input.payload), undefined, undefined, {
89
+ only: isUserLoopHook,
90
+ ...(model === undefined ? {} : { model }),
91
+ })),
92
+ })));
93
+ }
81
94
  throw new Error(`no loop hooks run on a hand for ${event}`);
82
95
  };
83
96
  }
@@ -86,7 +99,7 @@ export function extensionLoopHooks(runner, twoSidedHome, cwd, call) {
86
99
  * builtin, which runs the user's shell hooks (C8). Every other builtin is the loop's own machinery (model, compaction,
87
100
  * todo, search): each side loads its own builtins, so those run where the loop runs, as S29 never forwards builtins.
88
101
  */
89
- const isUserLoopHook = (extensionPath) => !extensionPath.startsWith("<builtin:") || extensionPath === "<builtin:hooks>";
102
+ export const isUserLoopHook = (extensionPath) => !extensionPath.startsWith("<builtin:") || extensionPath === "<builtin:hooks>";
90
103
  const INPUT_SOURCES = ["interactive", "rpc", "extension"];
91
104
  const INPUT_ATTRIBUTIONS = ["user", "agent"];
92
105
  const STREAMING_BEHAVIORS = ["steer", "followUp"];
@@ -39,6 +39,7 @@ const MEDIA_BEARING_RESPONSE_COMMANDS = new Set([
39
39
  "get_tree",
40
40
  "get_state",
41
41
  "open_session",
42
+ "claim_session",
42
43
  ]);
43
44
  /**
44
45
  * Decoded byte length of a base64 string, derived from its length alone.
@@ -15,6 +15,38 @@ export declare const HOST_RECORD_SCHEMAS: {
15
15
  id: Type.TOptional<Type.TString>;
16
16
  admissionId: Type.TOptional<Type.TString>;
17
17
  type: Type.TLiteral<"open_session">;
18
+ } & {
19
+ retry: Type.TOptional<Type.TLiteral<true>>;
20
+ attended: Type.TOptional<Type.TLiteral<false>>;
21
+ spawnedBy: Type.TOptional<Type.TObject<{
22
+ parentSessionId: Type.TString;
23
+ rootSessionId: Type.TString;
24
+ taskId: Type.TString;
25
+ }>>;
26
+ expectedHostInstance: Type.TOptional<Type.TString>;
27
+ sessionPath: Type.TOptional<Type.TString>;
28
+ cwd: Type.TOptional<Type.TString>;
29
+ provider: Type.TOptional<Type.TString>;
30
+ modelId: Type.TOptional<Type.TString>;
31
+ thinkingLevel: Type.TOptional<Type.TUnion<[Type.TLiteral<string>, ...Type.TLiteral<string>[]]>>;
32
+ permissionPreset: Type.TOptional<Type.TString>;
33
+ retain_on_disconnect: Type.TOptional<Type.TBoolean>;
34
+ kind: Type.TOptional<Type.TUnion<[Type.TLiteral<string>, ...Type.TLiteral<string>[]]>>;
35
+ context: Type.TOptional<Type.TRecord<"^.*$", Type.TString>>;
36
+ auto_title: Type.TOptional<Type.TBoolean>;
37
+ durableSessionId: Type.TOptional<Type.TString>;
38
+ promptSurface: Type.TOptional<Type.TUnion<[Type.TLiteral<string>, ...Type.TLiteral<string>[]]>>;
39
+ browserEngine: Type.TOptional<Type.TUnion<[Type.TLiteral<string>, ...Type.TLiteral<string>[]]>>;
40
+ retryFallback: Type.TOptional<Type.TObject<{
41
+ modelFallback: Type.TBoolean;
42
+ fallbackChains: Type.TRecord<"^.*$", Type.TImmutable<Type.TArray<Type.TString>>>;
43
+ }>>;
44
+ env: Type.TOptional<Type.TRecord<"^.*$", Type.TString>>;
45
+ }>;
46
+ claim_session: Type.TObject<{
47
+ id: Type.TOptional<Type.TString>;
48
+ admissionId: Type.TOptional<Type.TString>;
49
+ type: Type.TLiteral<"claim_session">;
18
50
  } & {
19
51
  readonly retry: Type.TOptional<Type.TLiteral<true>>;
20
52
  readonly attended: Type.TOptional<Type.TLiteral<false>>;
@@ -25,7 +57,6 @@ export declare const HOST_RECORD_SCHEMAS: {
25
57
  }>>;
26
58
  readonly expectedHostInstance: Type.TOptional<Type.TString>;
27
59
  readonly sessionPath: Type.TOptional<Type.TString>;
28
- readonly cwd: Type.TOptional<Type.TString>;
29
60
  readonly provider: Type.TOptional<Type.TString>;
30
61
  readonly modelId: Type.TOptional<Type.TString>;
31
62
  readonly thinkingLevel: Type.TOptional<Type.TUnion<[Type.TLiteral<string>, ...Type.TLiteral<string>[]]>>;
@@ -42,6 +73,16 @@ export declare const HOST_RECORD_SCHEMAS: {
42
73
  fallbackChains: Type.TRecord<"^.*$", Type.TImmutable<Type.TArray<Type.TString>>>;
43
74
  }>>;
44
75
  readonly env: Type.TOptional<Type.TRecord<"^.*$", Type.TString>>;
76
+ readonly cwd: Type.TString;
77
+ }>;
78
+ park_session: Type.TObject<{
79
+ id: Type.TOptional<Type.TString>;
80
+ admissionId: Type.TOptional<Type.TString>;
81
+ type: Type.TLiteral<"park_session">;
82
+ } & {
83
+ readonly cwd: Type.TString;
84
+ readonly kind: Type.TOptional<Type.TUnion<[Type.TLiteral<string>, ...Type.TLiteral<string>[]]>>;
85
+ readonly context: Type.TOptional<Type.TRecord<"^.*$", Type.TString>>;
45
86
  }>;
46
87
  close_session: Type.TObject<{
47
88
  id: Type.TOptional<Type.TString>;
@@ -9,32 +9,35 @@ const uiResponseFrame = {
9
9
  uiRequestId: OptId,
10
10
  answerId: OptId,
11
11
  };
12
+ const openProperties = {
13
+ retry: Opt(Type.Literal(true)),
14
+ attended: Opt(Type.Literal(false)),
15
+ spawnedBy: Opt(Type.Object({ parentSessionId: Id, rootSessionId: Id, taskId: Id })),
16
+ expectedHostInstance: OptId,
17
+ sessionPath: OptPath,
18
+ cwd: OptPath,
19
+ provider: OptId,
20
+ modelId: OptId,
21
+ thinkingLevel: Opt(ThinkingLevel),
22
+ permissionPreset: OptId,
23
+ retain_on_disconnect: OptBool,
24
+ kind: Opt(SessionKind),
25
+ context: Opt(SessionContext),
26
+ auto_title: OptBool,
27
+ durableSessionId: OptId,
28
+ promptSurface: Opt(literals("terminal", "app", "chat")),
29
+ browserEngine: Opt(literals("connected", "builtin", "none")),
30
+ retryFallback: Opt(RetryFallback),
31
+ env: Opt(SessionEnv),
32
+ };
12
33
  export const HOST_RECORD_SCHEMAS = {
13
34
  get_protocol_info: command("get_protocol_info", {
14
35
  auth: Opt(Type.Object({ client_nonce: Id })),
15
36
  observe: OptBool,
16
37
  }),
17
- open_session: command("open_session", {
18
- retry: Opt(Type.Literal(true)),
19
- attended: Opt(Type.Literal(false)),
20
- spawnedBy: Opt(Type.Object({ parentSessionId: Id, rootSessionId: Id, taskId: Id })),
21
- expectedHostInstance: OptId,
22
- sessionPath: OptPath,
23
- cwd: OptPath,
24
- provider: OptId,
25
- modelId: OptId,
26
- thinkingLevel: Opt(ThinkingLevel),
27
- permissionPreset: OptId,
28
- retain_on_disconnect: OptBool,
29
- kind: Opt(SessionKind),
30
- context: Opt(SessionContext),
31
- auto_title: OptBool,
32
- durableSessionId: OptId,
33
- promptSurface: Opt(literals("terminal", "app", "chat")),
34
- browserEngine: Opt(literals("connected", "builtin", "none")),
35
- retryFallback: Opt(RetryFallback),
36
- env: Opt(SessionEnv),
37
- }),
38
+ open_session: command("open_session", openProperties),
39
+ claim_session: command("claim_session", { ...openProperties, cwd: PathStr }),
40
+ park_session: command("park_session", { cwd: PathStr, kind: Opt(SessionKind), context: Opt(SessionContext) }),
38
41
  close_session: command("close_session", { sessionId: Id }),
39
42
  move_session: Type.Union([
40
43
  move({ op: Type.Literal("prepare"), moveId: Id }),
@@ -850,6 +850,26 @@ export declare const SESSION_RECORD_SCHEMAS: {
850
850
  readonly key: Type.TString;
851
851
  readonly value: Type.TUnknown;
852
852
  }>;
853
+ read_project_file: Type.TObject<{
854
+ id: Type.TOptional<Type.TString>;
855
+ admissionId: Type.TOptional<Type.TString>;
856
+ type: Type.TLiteral<"read_project_file">;
857
+ } & {
858
+ readonly sessionId: Type.TOptional<Type.TString>;
859
+ } & {
860
+ readonly path: Type.TString;
861
+ }>;
862
+ write_project_file: Type.TObject<{
863
+ id: Type.TOptional<Type.TString>;
864
+ admissionId: Type.TOptional<Type.TString>;
865
+ type: Type.TLiteral<"write_project_file">;
866
+ } & {
867
+ readonly sessionId: Type.TOptional<Type.TString>;
868
+ } & {
869
+ readonly path: Type.TString;
870
+ readonly content: Type.TString;
871
+ readonly ifEtag: Type.TUnion<[Type.TString, Type.TNull]>;
872
+ }>;
853
873
  extension_request: Type.TObject<{
854
874
  id: Type.TOptional<Type.TString>;
855
875
  admissionId: Type.TOptional<Type.TString>;
@@ -197,6 +197,12 @@ const SURFACE_AND_ACCOUNT_SCHEMAS = {
197
197
  set_project_trust: session("set_project_trust", { choice: literals("trust", "trust_parent", "do_not_trust") }),
198
198
  get_project_settings: session("get_project_settings", {}),
199
199
  set_project_setting: session("set_project_setting", { key: Id, value: Type.Unknown() }),
200
+ read_project_file: session("read_project_file", { path: PathStr }),
201
+ write_project_file: session("write_project_file", {
202
+ path: PathStr,
203
+ content: Str,
204
+ ifEtag: Type.Union([Id, Type.Null()]),
205
+ }),
200
206
  extension_request: session("extension_request", { name: Id, data: Opt(Type.Unknown()) }),
201
207
  "eval_cells.list": session("eval_cells.list", {}),
202
208
  "eval_cells.peek": session("eval_cells.peek", { cellId: Id, tailBytes: OptNum }),
@@ -70,6 +70,38 @@ export declare const RPC_INBOUND_SCHEMAS: {
70
70
  id: import("typebox").TOptional<import("typebox").TString>;
71
71
  admissionId: import("typebox").TOptional<import("typebox").TString>;
72
72
  type: import("typebox").TLiteral<"open_session">;
73
+ } & {
74
+ retry: import("typebox").TOptional<import("typebox").TLiteral<true>>;
75
+ attended: import("typebox").TOptional<import("typebox").TLiteral<false>>;
76
+ spawnedBy: import("typebox").TOptional<import("typebox").TObject<{
77
+ parentSessionId: import("typebox").TString;
78
+ rootSessionId: import("typebox").TString;
79
+ taskId: import("typebox").TString;
80
+ }>>;
81
+ expectedHostInstance: import("typebox").TOptional<import("typebox").TString>;
82
+ sessionPath: import("typebox").TOptional<import("typebox").TString>;
83
+ cwd: import("typebox").TOptional<import("typebox").TString>;
84
+ provider: import("typebox").TOptional<import("typebox").TString>;
85
+ modelId: import("typebox").TOptional<import("typebox").TString>;
86
+ thinkingLevel: import("typebox").TOptional<import("typebox").TUnion<[import("typebox").TLiteral<string>, ...import("typebox").TLiteral<string>[]]>>;
87
+ permissionPreset: import("typebox").TOptional<import("typebox").TString>;
88
+ retain_on_disconnect: import("typebox").TOptional<import("typebox").TBoolean>;
89
+ kind: import("typebox").TOptional<import("typebox").TUnion<[import("typebox").TLiteral<string>, ...import("typebox").TLiteral<string>[]]>>;
90
+ context: import("typebox").TOptional<import("typebox").TRecord<"^.*$", import("typebox").TString>>;
91
+ auto_title: import("typebox").TOptional<import("typebox").TBoolean>;
92
+ durableSessionId: import("typebox").TOptional<import("typebox").TString>;
93
+ promptSurface: import("typebox").TOptional<import("typebox").TUnion<[import("typebox").TLiteral<string>, ...import("typebox").TLiteral<string>[]]>>;
94
+ browserEngine: import("typebox").TOptional<import("typebox").TUnion<[import("typebox").TLiteral<string>, ...import("typebox").TLiteral<string>[]]>>;
95
+ retryFallback: import("typebox").TOptional<import("typebox").TObject<{
96
+ modelFallback: import("typebox").TBoolean;
97
+ fallbackChains: import("typebox").TRecord<"^.*$", import("typebox").TImmutable<import("typebox").TArray<import("typebox").TString>>>;
98
+ }>>;
99
+ env: import("typebox").TOptional<import("typebox").TRecord<"^.*$", import("typebox").TString>>;
100
+ }>;
101
+ readonly claim_session: import("typebox").TObject<{
102
+ id: import("typebox").TOptional<import("typebox").TString>;
103
+ admissionId: import("typebox").TOptional<import("typebox").TString>;
104
+ type: import("typebox").TLiteral<"claim_session">;
73
105
  } & {
74
106
  readonly retry: import("typebox").TOptional<import("typebox").TLiteral<true>>;
75
107
  readonly attended: import("typebox").TOptional<import("typebox").TLiteral<false>>;
@@ -80,7 +112,6 @@ export declare const RPC_INBOUND_SCHEMAS: {
80
112
  }>>;
81
113
  readonly expectedHostInstance: import("typebox").TOptional<import("typebox").TString>;
82
114
  readonly sessionPath: import("typebox").TOptional<import("typebox").TString>;
83
- readonly cwd: import("typebox").TOptional<import("typebox").TString>;
84
115
  readonly provider: import("typebox").TOptional<import("typebox").TString>;
85
116
  readonly modelId: import("typebox").TOptional<import("typebox").TString>;
86
117
  readonly thinkingLevel: import("typebox").TOptional<import("typebox").TUnion<[import("typebox").TLiteral<string>, ...import("typebox").TLiteral<string>[]]>>;
@@ -97,6 +128,16 @@ export declare const RPC_INBOUND_SCHEMAS: {
97
128
  fallbackChains: import("typebox").TRecord<"^.*$", import("typebox").TImmutable<import("typebox").TArray<import("typebox").TString>>>;
98
129
  }>>;
99
130
  readonly env: import("typebox").TOptional<import("typebox").TRecord<"^.*$", import("typebox").TString>>;
131
+ readonly cwd: import("typebox").TString;
132
+ }>;
133
+ readonly park_session: import("typebox").TObject<{
134
+ id: import("typebox").TOptional<import("typebox").TString>;
135
+ admissionId: import("typebox").TOptional<import("typebox").TString>;
136
+ type: import("typebox").TLiteral<"park_session">;
137
+ } & {
138
+ readonly cwd: import("typebox").TString;
139
+ readonly kind: import("typebox").TOptional<import("typebox").TUnion<[import("typebox").TLiteral<string>, ...import("typebox").TLiteral<string>[]]>>;
140
+ readonly context: import("typebox").TOptional<import("typebox").TRecord<"^.*$", import("typebox").TString>>;
100
141
  }>;
101
142
  readonly close_session: import("typebox").TObject<{
102
143
  id: import("typebox").TOptional<import("typebox").TString>;
@@ -1224,6 +1265,26 @@ export declare const RPC_INBOUND_SCHEMAS: {
1224
1265
  readonly key: import("typebox").TString;
1225
1266
  readonly value: import("typebox").TUnknown;
1226
1267
  }>;
1268
+ readonly read_project_file: import("typebox").TObject<{
1269
+ id: import("typebox").TOptional<import("typebox").TString>;
1270
+ admissionId: import("typebox").TOptional<import("typebox").TString>;
1271
+ type: import("typebox").TLiteral<"read_project_file">;
1272
+ } & {
1273
+ readonly sessionId: import("typebox").TOptional<import("typebox").TString>;
1274
+ } & {
1275
+ readonly path: import("typebox").TString;
1276
+ }>;
1277
+ readonly write_project_file: import("typebox").TObject<{
1278
+ id: import("typebox").TOptional<import("typebox").TString>;
1279
+ admissionId: import("typebox").TOptional<import("typebox").TString>;
1280
+ type: import("typebox").TLiteral<"write_project_file">;
1281
+ } & {
1282
+ readonly sessionId: import("typebox").TOptional<import("typebox").TString>;
1283
+ } & {
1284
+ readonly path: import("typebox").TString;
1285
+ readonly content: import("typebox").TString;
1286
+ readonly ifEtag: import("typebox").TUnion<[import("typebox").TString, import("typebox").TNull]>;
1287
+ }>;
1227
1288
  readonly extension_request: import("typebox").TObject<{
1228
1289
  id: import("typebox").TOptional<import("typebox").TString>;
1229
1290
  admissionId: import("typebox").TOptional<import("typebox").TString>;
@@ -37,12 +37,15 @@ function fieldBoundsError(record) {
37
37
  const payload = rpcCommandPayloadError(record) ?? rpcMessageLengthError(record);
38
38
  if (payload !== undefined)
39
39
  return payload;
40
- if (record.type === "open_session" || record.type === "warm") {
40
+ if (record.type === "open_session" ||
41
+ record.type === "warm" ||
42
+ record.type === "park_session" ||
43
+ record.type === "claim_session") {
41
44
  const context = sessionContextError(record.context);
42
45
  if (context !== undefined)
43
46
  return context;
44
47
  }
45
- if (record.type === "open_session")
48
+ if (record.type === "open_session" || record.type === "claim_session")
46
49
  return sessionRetryFallbackError(record.retryFallback) ?? sessionEnvShapeError(record.env);
47
50
  if (record.type === "set_retry_fallback")
48
51
  return sessionRetryFallbackError(record.retryFallback);
@@ -163,6 +163,8 @@ export declare const RPC_METHOD_CLASS: {
163
163
  readonly classify: typeof openSessionClass;
164
164
  readonly version: 2;
165
165
  };
166
+ readonly claim_session: "device_admin";
167
+ readonly park_session: "device_admin";
166
168
  readonly resume_session: "thread";
167
169
  readonly fork: "thread";
168
170
  readonly clone: "thread";
@@ -202,6 +204,8 @@ export declare const RPC_METHOD_CLASS: {
202
204
  readonly set_project_trust: "device_admin";
203
205
  readonly get_project_settings: "device_admin";
204
206
  readonly set_project_setting: "device_admin";
207
+ readonly read_project_file: "device_admin";
208
+ readonly write_project_file: "device_admin";
205
209
  readonly edit_assistant_message: "device_admin";
206
210
  readonly send_custom_message: "device_admin";
207
211
  readonly switch_session: "device_admin";
@@ -207,6 +207,9 @@ export const RPC_METHOD_CLASS = {
207
207
  // thread by id; device_admin when the record names a host path, a permission preset or a tool environment
208
208
  new_session: { classify: newSessionClass, version: 1 },
209
209
  open_session: { classify: openSessionClass, version: 2 },
210
+ // Both commands require a cwd; claim has the same device authority as a cwd-naming open.
211
+ claim_session: "device_admin",
212
+ park_session: "device_admin",
210
213
  resume_session: "thread",
211
214
  fork: "thread",
212
215
  clone: "thread",
@@ -254,6 +257,9 @@ export const RPC_METHOD_CLASS = {
254
257
  // reads a file from the session's cwd; writes one into it
255
258
  get_project_settings: "device_admin",
256
259
  set_project_setting: "device_admin",
260
+ // reads or replaces an instruction file in the session's cwd (AGENTS.md, CLAUDE.md, .omo/rules/**)
261
+ read_project_file: "device_admin",
262
+ write_project_file: "device_admin",
257
263
  // switch_session opens (and appends to) the named session file; import_jsonl reads any host file into a session
258
264
  // both write what the model reads as engine work: an assistant reply it never gave, a custom context message
259
265
  // (append_session_entry classes the same entries appended directly as device_admin)
@@ -177,7 +177,7 @@ export function createHostCore(options, writer, capabilities = parseClientCapabi
177
177
  return;
178
178
  }
179
179
  const command = parsed;
180
- const response = await gate.dispatch(command.type === "open_session" &&
180
+ const response = await gate.dispatch((command.type === "open_session" || command.type === "claim_session") &&
181
181
  (delegated
182
182
  ? command.retain_on_disconnect !== true
183
183
  : machineOwned && command.retain_on_disconnect === undefined)
@@ -0,0 +1,32 @@
1
+ /**
2
+ * `read_project_file` / `write_project_file`: read and edit the session workspace's instruction files over RPC, so a
3
+ * client with no filesystem access to the machine (a remote desktop) edits Rules the way a local one does.
4
+ *
5
+ * Reading runs nothing, so trust does not gate it; writing is refused while the project is untrusted, like
6
+ * `set_project_setting`. Every write names the version it replaces (`ifEtag`, `null` to create), is refused as a
7
+ * conflict carrying the current etag when the file moved on, and lands by temp file + rename so a reader never sees a
8
+ * half-written file. Writes to one file are serialized inside the engine.
9
+ */
10
+ import type { AgentSession } from "../../core/agent-session.ts";
11
+ export interface RpcProjectFile {
12
+ cwd: string;
13
+ /** The canonical workspace-relative path. */
14
+ path: string;
15
+ exists: boolean;
16
+ content: string | null;
17
+ /** Opaque version of the stored bytes; compare it, never parse it. */
18
+ etag: string | null;
19
+ projectTrusted: boolean;
20
+ }
21
+ export type ProjectFileResult = {
22
+ ok: true;
23
+ data: RpcProjectFile;
24
+ } | {
25
+ ok: false;
26
+ message: string;
27
+ errorCode: string;
28
+ errorData?: Record<string, unknown>;
29
+ };
30
+ export declare function readProjectFile(session: AgentSession, path: unknown): Promise<ProjectFileResult>;
31
+ export declare function writeProjectFile(session: AgentSession, path: unknown, content: unknown, ifEtag: unknown): Promise<ProjectFileResult>;
32
+ //# sourceMappingURL=project-file-commands.d.ts.map