@greppleai/grip 0.0.0-stage → 0.1.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 (1119) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/README.md +731 -2
  3. package/dist/bun/cli.d.ts +3 -0
  4. package/dist/bun/cli.d.ts.map +1 -0
  5. package/dist/bun/cli.js +13 -0
  6. package/dist/bun/cli.js.map +1 -0
  7. package/dist/bun/embedded-assets.d.ts +3 -0
  8. package/dist/bun/embedded-assets.d.ts.map +1 -0
  9. package/dist/bun/embedded-assets.js +52 -0
  10. package/dist/bun/embedded-assets.js.map +1 -0
  11. package/dist/bun/register-bedrock.d.ts +2 -0
  12. package/dist/bun/register-bedrock.d.ts.map +1 -0
  13. package/dist/bun/register-bedrock.js +4 -0
  14. package/dist/bun/register-bedrock.js.map +1 -0
  15. package/dist/bun/restore-sandbox-env.d.ts +13 -0
  16. package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
  17. package/dist/bun/restore-sandbox-env.js +32 -0
  18. package/dist/bun/restore-sandbox-env.js.map +1 -0
  19. package/dist/cli/args.d.ts +70 -0
  20. package/dist/cli/args.d.ts.map +1 -0
  21. package/dist/cli/args.js +442 -0
  22. package/dist/cli/args.js.map +1 -0
  23. package/dist/cli/config-selector.d.ts +14 -0
  24. package/dist/cli/config-selector.d.ts.map +1 -0
  25. package/dist/cli/config-selector.js +31 -0
  26. package/dist/cli/config-selector.js.map +1 -0
  27. package/dist/cli/file-processor.d.ts +15 -0
  28. package/dist/cli/file-processor.d.ts.map +1 -0
  29. package/dist/cli/file-processor.js +60 -0
  30. package/dist/cli/file-processor.js.map +1 -0
  31. package/dist/cli/initial-message.d.ts +18 -0
  32. package/dist/cli/initial-message.d.ts.map +1 -0
  33. package/dist/cli/initial-message.js +22 -0
  34. package/dist/cli/initial-message.js.map +1 -0
  35. package/dist/cli/list-models.d.ts +9 -0
  36. package/dist/cli/list-models.d.ts.map +1 -0
  37. package/dist/cli/list-models.js +98 -0
  38. package/dist/cli/list-models.js.map +1 -0
  39. package/dist/cli/session-picker.d.ts +9 -0
  40. package/dist/cli/session-picker.d.ts.map +1 -0
  41. package/dist/cli/session-picker.js +35 -0
  42. package/dist/cli/session-picker.js.map +1 -0
  43. package/dist/cli.d.ts +3 -0
  44. package/dist/cli.d.ts.map +1 -0
  45. package/dist/cli.js +14 -0
  46. package/dist/cli.js.map +1 -0
  47. package/dist/config.d.ts +82 -0
  48. package/dist/config.d.ts.map +1 -0
  49. package/dist/config.js +406 -0
  50. package/dist/config.js.map +1 -0
  51. package/dist/core/agent-session.d.ts +970 -0
  52. package/dist/core/agent-session.d.ts.map +1 -0
  53. package/dist/core/agent-session.js +5191 -0
  54. package/dist/core/agent-session.js.map +1 -0
  55. package/dist/core/auth-guidance.d.ts +5 -0
  56. package/dist/core/auth-guidance.d.ts.map +1 -0
  57. package/dist/core/auth-guidance.js +21 -0
  58. package/dist/core/auth-guidance.js.map +1 -0
  59. package/dist/core/auth-storage.d.ts +150 -0
  60. package/dist/core/auth-storage.d.ts.map +1 -0
  61. package/dist/core/auth-storage.js +557 -0
  62. package/dist/core/auth-storage.js.map +1 -0
  63. package/dist/core/bash-executor.d.ts +26 -0
  64. package/dist/core/bash-executor.d.ts.map +1 -0
  65. package/dist/core/bash-executor.js +99 -0
  66. package/dist/core/bash-executor.js.map +1 -0
  67. package/dist/core/compaction/branch-summarization.d.ts +83 -0
  68. package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  69. package/dist/core/compaction/branch-summarization.js +220 -0
  70. package/dist/core/compaction/branch-summarization.js.map +1 -0
  71. package/dist/core/compaction/compaction.d.ts +65 -0
  72. package/dist/core/compaction/compaction.d.ts.map +1 -0
  73. package/dist/core/compaction/compaction.js +550 -0
  74. package/dist/core/compaction/compaction.js.map +1 -0
  75. package/dist/core/compaction/compression-detection-ledger.d.ts +34 -0
  76. package/dist/core/compaction/compression-detection-ledger.d.ts.map +1 -0
  77. package/dist/core/compaction/compression-detection-ledger.js +52 -0
  78. package/dist/core/compaction/compression-detection-ledger.js.map +1 -0
  79. package/dist/core/compaction/compression-detector.d.ts +71 -0
  80. package/dist/core/compaction/compression-detector.d.ts.map +1 -0
  81. package/dist/core/compaction/compression-detector.js +407 -0
  82. package/dist/core/compaction/compression-detector.js.map +1 -0
  83. package/dist/core/compaction/compression-economics.d.ts +55 -0
  84. package/dist/core/compaction/compression-economics.d.ts.map +1 -0
  85. package/dist/core/compaction/compression-economics.js +151 -0
  86. package/dist/core/compaction/compression-economics.js.map +1 -0
  87. package/dist/core/compaction/utils.d.ts +28 -0
  88. package/dist/core/compaction/utils.d.ts.map +1 -0
  89. package/dist/core/compaction/utils.js +165 -0
  90. package/dist/core/compaction/utils.js.map +1 -0
  91. package/dist/core/defaults.d.ts +3 -0
  92. package/dist/core/defaults.d.ts.map +1 -0
  93. package/dist/core/defaults.js +2 -0
  94. package/dist/core/defaults.js.map +1 -0
  95. package/dist/core/diagnostics.d.ts +18 -0
  96. package/dist/core/diagnostics.d.ts.map +1 -0
  97. package/dist/core/diagnostics.js +2 -0
  98. package/dist/core/diagnostics.js.map +1 -0
  99. package/dist/core/event-bus.d.ts +9 -0
  100. package/dist/core/event-bus.d.ts.map +1 -0
  101. package/dist/core/event-bus.js +25 -0
  102. package/dist/core/event-bus.js.map +1 -0
  103. package/dist/core/exec.d.ts +29 -0
  104. package/dist/core/exec.d.ts.map +1 -0
  105. package/dist/core/exec.js +75 -0
  106. package/dist/core/exec.js.map +1 -0
  107. package/dist/core/export-html/ansi-to-html.d.ts +22 -0
  108. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  109. package/dist/core/export-html/ansi-to-html.js +245 -0
  110. package/dist/core/export-html/ansi-to-html.js.map +1 -0
  111. package/dist/core/export-html/index.d.ts +21 -0
  112. package/dist/core/export-html/index.d.ts.map +1 -0
  113. package/dist/core/export-html/index.js +230 -0
  114. package/dist/core/export-html/index.js.map +1 -0
  115. package/dist/core/export-html/template.css +1066 -0
  116. package/dist/core/export-html/template.html +55 -0
  117. package/dist/core/export-html/template.js +1864 -0
  118. package/dist/core/export-html/tool-renderer.d.ts +32 -0
  119. package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  120. package/dist/core/export-html/tool-renderer.js +108 -0
  121. package/dist/core/export-html/tool-renderer.js.map +1 -0
  122. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  123. package/dist/core/export-html/vendor/marked.min.js +78 -0
  124. package/dist/core/extensions/loader.d.ts +24 -0
  125. package/dist/core/extensions/loader.d.ts.map +1 -0
  126. package/dist/core/extensions/loader.js +613 -0
  127. package/dist/core/extensions/loader.js.map +1 -0
  128. package/dist/core/extensions/runner.d.ts +160 -0
  129. package/dist/core/extensions/runner.d.ts.map +1 -0
  130. package/dist/core/extensions/runner.js +962 -0
  131. package/dist/core/extensions/runner.js.map +1 -0
  132. package/dist/core/extensions/types.d.ts +1311 -0
  133. package/dist/core/extensions/types.d.ts.map +1 -0
  134. package/dist/core/extensions/types.js +51 -0
  135. package/dist/core/extensions/types.js.map +1 -0
  136. package/dist/core/extensions/wrapper.d.ts +20 -0
  137. package/dist/core/extensions/wrapper.d.ts.map +1 -0
  138. package/dist/core/extensions/wrapper.js +22 -0
  139. package/dist/core/extensions/wrapper.js.map +1 -0
  140. package/dist/core/footer-data-provider.d.ts +52 -0
  141. package/dist/core/footer-data-provider.d.ts.map +1 -0
  142. package/dist/core/footer-data-provider.js +318 -0
  143. package/dist/core/footer-data-provider.js.map +1 -0
  144. package/dist/core/grip-agent.d.ts +240 -0
  145. package/dist/core/grip-agent.d.ts.map +1 -0
  146. package/dist/core/grip-agent.js +1243 -0
  147. package/dist/core/grip-agent.js.map +1 -0
  148. package/dist/core/grip-manifest.d.ts +9 -0
  149. package/dist/core/grip-manifest.d.ts.map +1 -0
  150. package/dist/core/grip-manifest.js +25 -0
  151. package/dist/core/grip-manifest.js.map +1 -0
  152. package/dist/core/hooks/aggregate.d.ts +5 -0
  153. package/dist/core/hooks/aggregate.d.ts.map +1 -0
  154. package/dist/core/hooks/aggregate.js +226 -0
  155. package/dist/core/hooks/aggregate.js.map +1 -0
  156. package/dist/core/hooks/config.d.ts +14 -0
  157. package/dist/core/hooks/config.d.ts.map +1 -0
  158. package/dist/core/hooks/config.js +372 -0
  159. package/dist/core/hooks/config.js.map +1 -0
  160. package/dist/core/hooks/executor.d.ts +12 -0
  161. package/dist/core/hooks/executor.d.ts.map +1 -0
  162. package/dist/core/hooks/executor.js +708 -0
  163. package/dist/core/hooks/executor.js.map +1 -0
  164. package/dist/core/hooks/index.d.ts +9 -0
  165. package/dist/core/hooks/index.d.ts.map +1 -0
  166. package/dist/core/hooks/index.js +14 -0
  167. package/dist/core/hooks/index.js.map +1 -0
  168. package/dist/core/hooks/matcher.d.ts +10 -0
  169. package/dist/core/hooks/matcher.d.ts.map +1 -0
  170. package/dist/core/hooks/matcher.js +70 -0
  171. package/dist/core/hooks/matcher.js.map +1 -0
  172. package/dist/core/hooks/trust-store.d.ts +38 -0
  173. package/dist/core/hooks/trust-store.d.ts.map +1 -0
  174. package/dist/core/hooks/trust-store.js +167 -0
  175. package/dist/core/hooks/trust-store.js.map +1 -0
  176. package/dist/core/hooks/types.d.ts +234 -0
  177. package/dist/core/hooks/types.d.ts.map +1 -0
  178. package/dist/core/hooks/types.js +52 -0
  179. package/dist/core/hooks/types.js.map +1 -0
  180. package/dist/core/http-dispatcher.d.ts +21 -0
  181. package/dist/core/http-dispatcher.d.ts.map +1 -0
  182. package/dist/core/http-dispatcher.js +82 -0
  183. package/dist/core/http-dispatcher.js.map +1 -0
  184. package/dist/core/instruction-resource-loader.d.ts +81 -0
  185. package/dist/core/instruction-resource-loader.d.ts.map +1 -0
  186. package/dist/core/instruction-resource-loader.js +574 -0
  187. package/dist/core/instruction-resource-loader.js.map +1 -0
  188. package/dist/core/keybindings.d.ts +399 -0
  189. package/dist/core/keybindings.d.ts.map +1 -0
  190. package/dist/core/keybindings.js +299 -0
  191. package/dist/core/keybindings.js.map +1 -0
  192. package/dist/core/lsp/abort.d.ts +3 -0
  193. package/dist/core/lsp/abort.d.ts.map +1 -0
  194. package/dist/core/lsp/abort.js +28 -0
  195. package/dist/core/lsp/abort.js.map +1 -0
  196. package/dist/core/lsp/client.d.ts +108 -0
  197. package/dist/core/lsp/client.d.ts.map +1 -0
  198. package/dist/core/lsp/client.js +586 -0
  199. package/dist/core/lsp/client.js.map +1 -0
  200. package/dist/core/lsp/config-loader.d.ts +44 -0
  201. package/dist/core/lsp/config-loader.d.ts.map +1 -0
  202. package/dist/core/lsp/config-loader.js +223 -0
  203. package/dist/core/lsp/config-loader.js.map +1 -0
  204. package/dist/core/lsp/config.d.ts +134 -0
  205. package/dist/core/lsp/config.d.ts.map +1 -0
  206. package/dist/core/lsp/config.js +682 -0
  207. package/dist/core/lsp/config.js.map +1 -0
  208. package/dist/core/lsp/diagnostics.d.ts +18 -0
  209. package/dist/core/lsp/diagnostics.d.ts.map +1 -0
  210. package/dist/core/lsp/diagnostics.js +311 -0
  211. package/dist/core/lsp/diagnostics.js.map +1 -0
  212. package/dist/core/lsp/file-sync.d.ts +58 -0
  213. package/dist/core/lsp/file-sync.d.ts.map +1 -0
  214. package/dist/core/lsp/file-sync.js +432 -0
  215. package/dist/core/lsp/file-sync.js.map +1 -0
  216. package/dist/core/lsp/integration.d.ts +62 -0
  217. package/dist/core/lsp/integration.d.ts.map +1 -0
  218. package/dist/core/lsp/integration.js +145 -0
  219. package/dist/core/lsp/integration.js.map +1 -0
  220. package/dist/core/lsp/language-map.d.ts +54 -0
  221. package/dist/core/lsp/language-map.d.ts.map +1 -0
  222. package/dist/core/lsp/language-map.js +300 -0
  223. package/dist/core/lsp/language-map.js.map +1 -0
  224. package/dist/core/lsp/manager.d.ts +120 -0
  225. package/dist/core/lsp/manager.d.ts.map +1 -0
  226. package/dist/core/lsp/manager.js +636 -0
  227. package/dist/core/lsp/manager.js.map +1 -0
  228. package/dist/core/lsp/navigation.d.ts +32 -0
  229. package/dist/core/lsp/navigation.d.ts.map +1 -0
  230. package/dist/core/lsp/navigation.js +327 -0
  231. package/dist/core/lsp/navigation.js.map +1 -0
  232. package/dist/core/lsp/portable-path.d.ts +18 -0
  233. package/dist/core/lsp/portable-path.d.ts.map +1 -0
  234. package/dist/core/lsp/portable-path.js +83 -0
  235. package/dist/core/lsp/portable-path.js.map +1 -0
  236. package/dist/core/lsp/refactor.d.ts +32 -0
  237. package/dist/core/lsp/refactor.d.ts.map +1 -0
  238. package/dist/core/lsp/refactor.js +519 -0
  239. package/dist/core/lsp/refactor.js.map +1 -0
  240. package/dist/core/lsp/transport.d.ts +39 -0
  241. package/dist/core/lsp/transport.d.ts.map +1 -0
  242. package/dist/core/lsp/transport.js +261 -0
  243. package/dist/core/lsp/transport.js.map +1 -0
  244. package/dist/core/messages.d.ts +34 -0
  245. package/dist/core/messages.d.ts.map +1 -0
  246. package/dist/core/messages.js +140 -0
  247. package/dist/core/messages.js.map +1 -0
  248. package/dist/core/model-registry.d.ts +148 -0
  249. package/dist/core/model-registry.d.ts.map +1 -0
  250. package/dist/core/model-registry.js +812 -0
  251. package/dist/core/model-registry.js.map +1 -0
  252. package/dist/core/model-resolver.d.ts +115 -0
  253. package/dist/core/model-resolver.d.ts.map +1 -0
  254. package/dist/core/model-resolver.js +498 -0
  255. package/dist/core/model-resolver.js.map +1 -0
  256. package/dist/core/output-guard.d.ts +7 -0
  257. package/dist/core/output-guard.d.ts.map +1 -0
  258. package/dist/core/output-guard.js +89 -0
  259. package/dist/core/output-guard.js.map +1 -0
  260. package/dist/core/package-manager.d.ts +209 -0
  261. package/dist/core/package-manager.d.ts.map +1 -0
  262. package/dist/core/package-manager.js +2341 -0
  263. package/dist/core/package-manager.js.map +1 -0
  264. package/dist/core/prompt-templates.d.ts +57 -0
  265. package/dist/core/prompt-templates.d.ts.map +1 -0
  266. package/dist/core/prompt-templates.js +353 -0
  267. package/dist/core/prompt-templates.js.map +1 -0
  268. package/dist/core/provider-display-names.d.ts +2 -0
  269. package/dist/core/provider-display-names.d.ts.map +1 -0
  270. package/dist/core/provider-display-names.js +33 -0
  271. package/dist/core/provider-display-names.js.map +1 -0
  272. package/dist/core/remote-workspace-protocol/contract.d.ts +465 -0
  273. package/dist/core/remote-workspace-protocol/contract.d.ts.map +1 -0
  274. package/dist/core/remote-workspace-protocol/contract.js +825 -0
  275. package/dist/core/remote-workspace-protocol/contract.js.map +1 -0
  276. package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts +16 -0
  277. package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts.map +1 -0
  278. package/dist/core/remote-workspace-protocol/guest-shared-client.js +54 -0
  279. package/dist/core/remote-workspace-protocol/guest-shared-client.js.map +1 -0
  280. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts +23 -0
  281. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts.map +1 -0
  282. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js +112 -0
  283. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js.map +1 -0
  284. package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts +30 -0
  285. package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts.map +1 -0
  286. package/dist/core/remote-workspace-protocol/guest-shared-uplink.js +243 -0
  287. package/dist/core/remote-workspace-protocol/guest-shared-uplink.js.map +1 -0
  288. package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts +3 -0
  289. package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts.map +1 -0
  290. package/dist/core/remote-workspace-protocol/lima-owner-directory.js +31 -0
  291. package/dist/core/remote-workspace-protocol/lima-owner-directory.js.map +1 -0
  292. package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts +9 -0
  293. package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts.map +1 -0
  294. package/dist/core/remote-workspace-protocol/lima-owner-lock.js +89 -0
  295. package/dist/core/remote-workspace-protocol/lima-owner-lock.js.map +1 -0
  296. package/dist/core/remote-workspace-protocol/session.d.ts +249 -0
  297. package/dist/core/remote-workspace-protocol/session.d.ts.map +1 -0
  298. package/dist/core/remote-workspace-protocol/session.js +1842 -0
  299. package/dist/core/remote-workspace-protocol/session.js.map +1 -0
  300. package/dist/core/remote-workspace-protocol/shared-transport.d.ts +71 -0
  301. package/dist/core/remote-workspace-protocol/shared-transport.d.ts.map +1 -0
  302. package/dist/core/remote-workspace-protocol/shared-transport.js +68 -0
  303. package/dist/core/remote-workspace-protocol/shared-transport.js.map +1 -0
  304. package/dist/core/resolve-config-value.d.ts +32 -0
  305. package/dist/core/resolve-config-value.d.ts.map +1 -0
  306. package/dist/core/resolve-config-value.js +257 -0
  307. package/dist/core/resolve-config-value.js.map +1 -0
  308. package/dist/core/resource-loader.d.ts +200 -0
  309. package/dist/core/resource-loader.d.ts.map +1 -0
  310. package/dist/core/resource-loader.js +1209 -0
  311. package/dist/core/resource-loader.js.map +1 -0
  312. package/dist/core/rules.d.ts +40 -0
  313. package/dist/core/rules.d.ts.map +1 -0
  314. package/dist/core/rules.js +57 -0
  315. package/dist/core/rules.js.map +1 -0
  316. package/dist/core/sandbox/command.d.ts +25 -0
  317. package/dist/core/sandbox/command.d.ts.map +1 -0
  318. package/dist/core/sandbox/command.js +102 -0
  319. package/dist/core/sandbox/command.js.map +1 -0
  320. package/dist/core/sandbox/config.d.ts +91 -0
  321. package/dist/core/sandbox/config.d.ts.map +1 -0
  322. package/dist/core/sandbox/config.js +88 -0
  323. package/dist/core/sandbox/config.js.map +1 -0
  324. package/dist/core/sandbox/lima-guest-binary.d.ts +11 -0
  325. package/dist/core/sandbox/lima-guest-binary.d.ts.map +1 -0
  326. package/dist/core/sandbox/lima-guest-binary.js +140 -0
  327. package/dist/core/sandbox/lima-guest-binary.js.map +1 -0
  328. package/dist/core/sandbox/lima.d.ts +57 -0
  329. package/dist/core/sandbox/lima.d.ts.map +1 -0
  330. package/dist/core/sandbox/lima.js +716 -0
  331. package/dist/core/sandbox/lima.js.map +1 -0
  332. package/dist/core/sandbox/shared-lima-roots.d.ts +11 -0
  333. package/dist/core/sandbox/shared-lima-roots.d.ts.map +1 -0
  334. package/dist/core/sandbox/shared-lima-roots.js +25 -0
  335. package/dist/core/sandbox/shared-lima-roots.js.map +1 -0
  336. package/dist/core/sandbox/update-shared-guest-binary.d.ts +8 -0
  337. package/dist/core/sandbox/update-shared-guest-binary.d.ts.map +1 -0
  338. package/dist/core/sandbox/update-shared-guest-binary.js +100 -0
  339. package/dist/core/sandbox/update-shared-guest-binary.js.map +1 -0
  340. package/dist/core/session/constants.d.ts +2 -0
  341. package/dist/core/session/constants.d.ts.map +1 -0
  342. package/dist/core/session/constants.js +2 -0
  343. package/dist/core/session/constants.js.map +1 -0
  344. package/dist/core/session/context-metadata.d.ts +5 -0
  345. package/dist/core/session/context-metadata.d.ts.map +1 -0
  346. package/dist/core/session/context-metadata.js +55 -0
  347. package/dist/core/session/context-metadata.js.map +1 -0
  348. package/dist/core/session/context.d.ts +14 -0
  349. package/dist/core/session/context.d.ts.map +1 -0
  350. package/dist/core/session/context.js +117 -0
  351. package/dist/core/session/context.js.map +1 -0
  352. package/dist/core/session/ids.d.ts +9 -0
  353. package/dist/core/session/ids.d.ts.map +1 -0
  354. package/dist/core/session/ids.js +21 -0
  355. package/dist/core/session/ids.js.map +1 -0
  356. package/dist/core/session/in-memory-session-manager.d.ts +17 -0
  357. package/dist/core/session/in-memory-session-manager.d.ts.map +1 -0
  358. package/dist/core/session/in-memory-session-manager.js +40 -0
  359. package/dist/core/session/in-memory-session-manager.js.map +1 -0
  360. package/dist/core/session/in-memory-session.d.ts +7 -0
  361. package/dist/core/session/in-memory-session.d.ts.map +1 -0
  362. package/dist/core/session/in-memory-session.js +11 -0
  363. package/dist/core/session/in-memory-session.js.map +1 -0
  364. package/dist/core/session/jsonl-errors.d.ts +36 -0
  365. package/dist/core/session/jsonl-errors.d.ts.map +1 -0
  366. package/dist/core/session/jsonl-errors.js +49 -0
  367. package/dist/core/session/jsonl-errors.js.map +1 -0
  368. package/dist/core/session/jsonl-helpers.d.ts +20 -0
  369. package/dist/core/session/jsonl-helpers.d.ts.map +1 -0
  370. package/dist/core/session/jsonl-helpers.js +21 -0
  371. package/dist/core/session/jsonl-helpers.js.map +1 -0
  372. package/dist/core/session/local-session-manager.d.ts +30 -0
  373. package/dist/core/session/local-session-manager.d.ts.map +1 -0
  374. package/dist/core/session/local-session-manager.js +205 -0
  375. package/dist/core/session/local-session-manager.js.map +1 -0
  376. package/dist/core/session/local-session.d.ts +9 -0
  377. package/dist/core/session/local-session.d.ts.map +1 -0
  378. package/dist/core/session/local-session.js +15 -0
  379. package/dist/core/session/local-session.js.map +1 -0
  380. package/dist/core/session/migrations.d.ts +11 -0
  381. package/dist/core/session/migrations.d.ts.map +1 -0
  382. package/dist/core/session/migrations.js +78 -0
  383. package/dist/core/session/migrations.js.map +1 -0
  384. package/dist/core/session/remote-session-client.d.ts +83 -0
  385. package/dist/core/session/remote-session-client.d.ts.map +1 -0
  386. package/dist/core/session/remote-session-client.js +224 -0
  387. package/dist/core/session/remote-session-client.js.map +1 -0
  388. package/dist/core/session/remote-session-manager.d.ts +32 -0
  389. package/dist/core/session/remote-session-manager.d.ts.map +1 -0
  390. package/dist/core/session/remote-session-manager.js +124 -0
  391. package/dist/core/session/remote-session-manager.js.map +1 -0
  392. package/dist/core/session/remote-session.d.ts +20 -0
  393. package/dist/core/session/remote-session.d.ts.map +1 -0
  394. package/dist/core/session/remote-session.js +33 -0
  395. package/dist/core/session/remote-session.js.map +1 -0
  396. package/dist/core/session/session-manager.d.ts +18 -0
  397. package/dist/core/session/session-manager.d.ts.map +1 -0
  398. package/dist/core/session/session-manager.js +2 -0
  399. package/dist/core/session/session-manager.js.map +1 -0
  400. package/dist/core/session/session.d.ts +140 -0
  401. package/dist/core/session/session.d.ts.map +1 -0
  402. package/dist/core/session/session.js +461 -0
  403. package/dist/core/session/session.js.map +1 -0
  404. package/dist/core/session/stores/in-memory-session-store.d.ts +39 -0
  405. package/dist/core/session/stores/in-memory-session-store.d.ts.map +1 -0
  406. package/dist/core/session/stores/in-memory-session-store.js +168 -0
  407. package/dist/core/session/stores/in-memory-session-store.js.map +1 -0
  408. package/dist/core/session/stores/jsonl-session-store.d.ts +97 -0
  409. package/dist/core/session/stores/jsonl-session-store.d.ts.map +1 -0
  410. package/dist/core/session/stores/jsonl-session-store.js +1140 -0
  411. package/dist/core/session/stores/jsonl-session-store.js.map +1 -0
  412. package/dist/core/session/stores/remote-session-store.d.ts +44 -0
  413. package/dist/core/session/stores/remote-session-store.d.ts.map +1 -0
  414. package/dist/core/session/stores/remote-session-store.js +159 -0
  415. package/dist/core/session/stores/remote-session-store.js.map +1 -0
  416. package/dist/core/session/stores/session-store.d.ts +42 -0
  417. package/dist/core/session/stores/session-store.d.ts.map +1 -0
  418. package/dist/core/session/stores/session-store.js +2 -0
  419. package/dist/core/session/stores/session-store.js.map +1 -0
  420. package/dist/core/session/types.d.ts +141 -0
  421. package/dist/core/session/types.d.ts.map +1 -0
  422. package/dist/core/session/types.js +2 -0
  423. package/dist/core/session/types.js.map +1 -0
  424. package/dist/core/session/usage-ledger.d.ts +18 -0
  425. package/dist/core/session/usage-ledger.d.ts.map +1 -0
  426. package/dist/core/session/usage-ledger.js +68 -0
  427. package/dist/core/session/usage-ledger.js.map +1 -0
  428. package/dist/core/session-cwd.d.ts +19 -0
  429. package/dist/core/session-cwd.d.ts.map +1 -0
  430. package/dist/core/session-cwd.js +38 -0
  431. package/dist/core/session-cwd.js.map +1 -0
  432. package/dist/core/settings-manager.d.ts +314 -0
  433. package/dist/core/settings-manager.d.ts.map +1 -0
  434. package/dist/core/settings-manager.js +991 -0
  435. package/dist/core/settings-manager.js.map +1 -0
  436. package/dist/core/skills.d.ts +40 -0
  437. package/dist/core/skills.d.ts.map +1 -0
  438. package/dist/core/skills.js +57 -0
  439. package/dist/core/skills.js.map +1 -0
  440. package/dist/core/slash-commands.d.ts +15 -0
  441. package/dist/core/slash-commands.d.ts.map +1 -0
  442. package/dist/core/slash-commands.js +36 -0
  443. package/dist/core/slash-commands.js.map +1 -0
  444. package/dist/core/source-info.d.ts +26 -0
  445. package/dist/core/source-info.d.ts.map +1 -0
  446. package/dist/core/source-info.js +27 -0
  447. package/dist/core/source-info.js.map +1 -0
  448. package/dist/core/system-prompt.d.ts +32 -0
  449. package/dist/core/system-prompt.d.ts.map +1 -0
  450. package/dist/core/system-prompt.js +131 -0
  451. package/dist/core/system-prompt.js.map +1 -0
  452. package/dist/core/telemetry.d.ts +3 -0
  453. package/dist/core/telemetry.d.ts.map +1 -0
  454. package/dist/core/telemetry.js +9 -0
  455. package/dist/core/telemetry.js.map +1 -0
  456. package/dist/core/timings.d.ts +10 -0
  457. package/dist/core/timings.d.ts.map +1 -0
  458. package/dist/core/timings.js +41 -0
  459. package/dist/core/timings.js.map +1 -0
  460. package/dist/core/tools/bash.d.ts +51 -0
  461. package/dist/core/tools/bash.d.ts.map +1 -0
  462. package/dist/core/tools/bash.js +321 -0
  463. package/dist/core/tools/bash.js.map +1 -0
  464. package/dist/core/tools/compress-context.d.ts +27 -0
  465. package/dist/core/tools/compress-context.d.ts.map +1 -0
  466. package/dist/core/tools/compress-context.js +142 -0
  467. package/dist/core/tools/compress-context.js.map +1 -0
  468. package/dist/core/tools/edit-diff.d.ts +82 -0
  469. package/dist/core/tools/edit-diff.d.ts.map +1 -0
  470. package/dist/core/tools/edit-diff.js +327 -0
  471. package/dist/core/tools/edit-diff.js.map +1 -0
  472. package/dist/core/tools/edit.d.ts +50 -0
  473. package/dist/core/tools/edit.d.ts.map +1 -0
  474. package/dist/core/tools/edit.js +324 -0
  475. package/dist/core/tools/edit.js.map +1 -0
  476. package/dist/core/tools/file-mutation-queue.d.ts +8 -0
  477. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  478. package/dist/core/tools/file-mutation-queue.js +69 -0
  479. package/dist/core/tools/file-mutation-queue.js.map +1 -0
  480. package/dist/core/tools/find.d.ts +22 -0
  481. package/dist/core/tools/find.d.ts.map +1 -0
  482. package/dist/core/tools/find.js +268 -0
  483. package/dist/core/tools/find.js.map +1 -0
  484. package/dist/core/tools/grep.d.ts +27 -0
  485. package/dist/core/tools/grep.d.ts.map +1 -0
  486. package/dist/core/tools/grep.js +332 -0
  487. package/dist/core/tools/grep.js.map +1 -0
  488. package/dist/core/tools/hash-store.d.ts +12 -0
  489. package/dist/core/tools/hash-store.d.ts.map +1 -0
  490. package/dist/core/tools/hash-store.js +48 -0
  491. package/dist/core/tools/hash-store.js.map +1 -0
  492. package/dist/core/tools/hashline/apply.d.ts +40 -0
  493. package/dist/core/tools/hashline/apply.d.ts.map +1 -0
  494. package/dist/core/tools/hashline/apply.js +261 -0
  495. package/dist/core/tools/hashline/apply.js.map +1 -0
  496. package/dist/core/tools/hashline/hash.d.ts +56 -0
  497. package/dist/core/tools/hashline/hash.d.ts.map +1 -0
  498. package/dist/core/tools/hashline/hash.js +196 -0
  499. package/dist/core/tools/hashline/hash.js.map +1 -0
  500. package/dist/core/tools/hashline/parse.d.ts +8 -0
  501. package/dist/core/tools/hashline/parse.d.ts.map +1 -0
  502. package/dist/core/tools/hashline/parse.js +41 -0
  503. package/dist/core/tools/hashline/parse.js.map +1 -0
  504. package/dist/core/tools/hashline/resolve.d.ts +51 -0
  505. package/dist/core/tools/hashline/resolve.d.ts.map +1 -0
  506. package/dist/core/tools/hashline/resolve.js +187 -0
  507. package/dist/core/tools/hashline/resolve.js.map +1 -0
  508. package/dist/core/tools/hashline-utils.d.ts +6 -0
  509. package/dist/core/tools/hashline-utils.d.ts.map +1 -0
  510. package/dist/core/tools/hashline-utils.js +23 -0
  511. package/dist/core/tools/hashline-utils.js.map +1 -0
  512. package/dist/core/tools/index.d.ts +36 -0
  513. package/dist/core/tools/index.d.ts.map +1 -0
  514. package/dist/core/tools/index.js +141 -0
  515. package/dist/core/tools/index.js.map +1 -0
  516. package/dist/core/tools/ls.d.ts +21 -0
  517. package/dist/core/tools/ls.d.ts.map +1 -0
  518. package/dist/core/tools/ls.js +156 -0
  519. package/dist/core/tools/ls.js.map +1 -0
  520. package/dist/core/tools/operations.d.ts +212 -0
  521. package/dist/core/tools/operations.d.ts.map +1 -0
  522. package/dist/core/tools/operations.js +793 -0
  523. package/dist/core/tools/operations.js.map +1 -0
  524. package/dist/core/tools/output-accumulator.d.ts +54 -0
  525. package/dist/core/tools/output-accumulator.d.ts.map +1 -0
  526. package/dist/core/tools/output-accumulator.js +184 -0
  527. package/dist/core/tools/output-accumulator.js.map +1 -0
  528. package/dist/core/tools/path-utils.d.ts +9 -0
  529. package/dist/core/tools/path-utils.d.ts.map +1 -0
  530. package/dist/core/tools/path-utils.js +99 -0
  531. package/dist/core/tools/path-utils.js.map +1 -0
  532. package/dist/core/tools/read.d.ts +32 -0
  533. package/dist/core/tools/read.d.ts.map +1 -0
  534. package/dist/core/tools/read.js +318 -0
  535. package/dist/core/tools/read.js.map +1 -0
  536. package/dist/core/tools/render-utils.d.ts +33 -0
  537. package/dist/core/tools/render-utils.d.ts.map +1 -0
  538. package/dist/core/tools/render-utils.js +61 -0
  539. package/dist/core/tools/render-utils.js.map +1 -0
  540. package/dist/core/tools/replace-diff.d.ts +16 -0
  541. package/dist/core/tools/replace-diff.d.ts.map +1 -0
  542. package/dist/core/tools/replace-diff.js +117 -0
  543. package/dist/core/tools/replace-diff.js.map +1 -0
  544. package/dist/core/tools/replace-normalize.d.ts +2 -0
  545. package/dist/core/tools/replace-normalize.d.ts.map +1 -0
  546. package/dist/core/tools/replace-normalize.js +73 -0
  547. package/dist/core/tools/replace-normalize.js.map +1 -0
  548. package/dist/core/tools/replace-render.d.ts +51 -0
  549. package/dist/core/tools/replace-render.d.ts.map +1 -0
  550. package/dist/core/tools/replace-render.js +162 -0
  551. package/dist/core/tools/replace-render.js.map +1 -0
  552. package/dist/core/tools/runtime.d.ts +2 -0
  553. package/dist/core/tools/runtime.d.ts.map +1 -0
  554. package/dist/core/tools/runtime.js +6 -0
  555. package/dist/core/tools/runtime.js.map +1 -0
  556. package/dist/core/tools/session-history.d.ts +55 -0
  557. package/dist/core/tools/session-history.d.ts.map +1 -0
  558. package/dist/core/tools/session-history.js +649 -0
  559. package/dist/core/tools/session-history.js.map +1 -0
  560. package/dist/core/tools/subagent-agents.d.ts +29 -0
  561. package/dist/core/tools/subagent-agents.d.ts.map +1 -0
  562. package/dist/core/tools/subagent-agents.js +223 -0
  563. package/dist/core/tools/subagent-agents.js.map +1 -0
  564. package/dist/core/tools/subagent.d.ts +185 -0
  565. package/dist/core/tools/subagent.d.ts.map +1 -0
  566. package/dist/core/tools/subagent.js +1309 -0
  567. package/dist/core/tools/subagent.js.map +1 -0
  568. package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  569. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  570. package/dist/core/tools/tool-definition-wrapper.js +34 -0
  571. package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  572. package/dist/core/tools/truncate.d.ts +39 -0
  573. package/dist/core/tools/truncate.d.ts.map +1 -0
  574. package/dist/core/tools/truncate.js +215 -0
  575. package/dist/core/tools/truncate.js.map +1 -0
  576. package/dist/core/tools/websearch.d.ts +33 -0
  577. package/dist/core/tools/websearch.d.ts.map +1 -0
  578. package/dist/core/tools/websearch.js +341 -0
  579. package/dist/core/tools/websearch.js.map +1 -0
  580. package/dist/core/tools/workspace-tool-host.d.ts +102 -0
  581. package/dist/core/tools/workspace-tool-host.d.ts.map +1 -0
  582. package/dist/core/tools/workspace-tool-host.js +348 -0
  583. package/dist/core/tools/workspace-tool-host.js.map +1 -0
  584. package/dist/core/tools/write.d.ts +16 -0
  585. package/dist/core/tools/write.d.ts.map +1 -0
  586. package/dist/core/tools/write.js +204 -0
  587. package/dist/core/tools/write.js.map +1 -0
  588. package/dist/core/workspace-identity.d.ts +7 -0
  589. package/dist/core/workspace-identity.d.ts.map +1 -0
  590. package/dist/core/workspace-identity.js +2 -0
  591. package/dist/core/workspace-identity.js.map +1 -0
  592. package/dist/daemon/activity-budget.d.ts +10 -0
  593. package/dist/daemon/activity-budget.d.ts.map +1 -0
  594. package/dist/daemon/activity-budget.js +34 -0
  595. package/dist/daemon/activity-budget.js.map +1 -0
  596. package/dist/daemon/command.d.ts +6 -0
  597. package/dist/daemon/command.d.ts.map +1 -0
  598. package/dist/daemon/command.js +58 -0
  599. package/dist/daemon/command.js.map +1 -0
  600. package/dist/daemon/config.d.ts +45 -0
  601. package/dist/daemon/config.d.ts.map +1 -0
  602. package/dist/daemon/config.js +319 -0
  603. package/dist/daemon/config.js.map +1 -0
  604. package/dist/daemon/help.d.ts +2 -0
  605. package/dist/daemon/help.d.ts.map +1 -0
  606. package/dist/daemon/help.js +42 -0
  607. package/dist/daemon/help.js.map +1 -0
  608. package/dist/daemon/lsp-config.d.ts +4 -0
  609. package/dist/daemon/lsp-config.d.ts.map +1 -0
  610. package/dist/daemon/lsp-config.js +155 -0
  611. package/dist/daemon/lsp-config.js.map +1 -0
  612. package/dist/daemon/outbound-budget.d.ts +10 -0
  613. package/dist/daemon/outbound-budget.d.ts.map +1 -0
  614. package/dist/daemon/outbound-budget.js +30 -0
  615. package/dist/daemon/outbound-budget.js.map +1 -0
  616. package/dist/daemon/security.d.ts +19 -0
  617. package/dist/daemon/security.d.ts.map +1 -0
  618. package/dist/daemon/security.js +177 -0
  619. package/dist/daemon/security.js.map +1 -0
  620. package/dist/daemon/server.d.ts +20 -0
  621. package/dist/daemon/server.d.ts.map +1 -0
  622. package/dist/daemon/server.js +480 -0
  623. package/dist/daemon/server.js.map +1 -0
  624. package/dist/daemon/shared-connection.d.ts +33 -0
  625. package/dist/daemon/shared-connection.d.ts.map +1 -0
  626. package/dist/daemon/shared-connection.js +271 -0
  627. package/dist/daemon/shared-connection.js.map +1 -0
  628. package/dist/daemon/shared-revision.d.ts +5 -0
  629. package/dist/daemon/shared-revision.d.ts.map +1 -0
  630. package/dist/daemon/shared-revision.js +61 -0
  631. package/dist/daemon/shared-revision.js.map +1 -0
  632. package/dist/daemon/shared-roots.d.ts +9 -0
  633. package/dist/daemon/shared-roots.d.ts.map +1 -0
  634. package/dist/daemon/shared-roots.js +33 -0
  635. package/dist/daemon/shared-roots.js.map +1 -0
  636. package/dist/daemon/workspace-runtime.d.ts +46 -0
  637. package/dist/daemon/workspace-runtime.d.ts.map +1 -0
  638. package/dist/daemon/workspace-runtime.js +705 -0
  639. package/dist/daemon/workspace-runtime.js.map +1 -0
  640. package/dist/index.d.ts +109 -0
  641. package/dist/index.d.ts.map +1 -0
  642. package/dist/index.js +107 -0
  643. package/dist/index.js.map +1 -0
  644. package/dist/main.d.ts +39 -0
  645. package/dist/main.d.ts.map +1 -0
  646. package/dist/main.js +765 -0
  647. package/dist/main.js.map +1 -0
  648. package/dist/migrations.d.ts +35 -0
  649. package/dist/migrations.d.ts.map +1 -0
  650. package/dist/migrations.js +412 -0
  651. package/dist/migrations.js.map +1 -0
  652. package/dist/modes/interactive/components/assistant-message.d.ts +30 -0
  653. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  654. package/dist/modes/interactive/components/assistant-message.js +159 -0
  655. package/dist/modes/interactive/components/assistant-message.js.map +1 -0
  656. package/dist/modes/interactive/components/bash-execution.d.ts +36 -0
  657. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  658. package/dist/modes/interactive/components/bash-execution.js +173 -0
  659. package/dist/modes/interactive/components/bash-execution.js.map +1 -0
  660. package/dist/modes/interactive/components/bordered-loader.d.ts +18 -0
  661. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  662. package/dist/modes/interactive/components/bordered-loader.js +54 -0
  663. package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  664. package/dist/modes/interactive/components/branch-summary-message.d.ts +17 -0
  665. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  666. package/dist/modes/interactive/components/branch-summary-message.js +45 -0
  667. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  668. package/dist/modes/interactive/components/compaction-summary-message.d.ts +17 -0
  669. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  670. package/dist/modes/interactive/components/compaction-summary-message.js +46 -0
  671. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  672. package/dist/modes/interactive/components/config-selector.d.ts +74 -0
  673. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  674. package/dist/modes/interactive/components/config-selector.js +514 -0
  675. package/dist/modes/interactive/components/config-selector.js.map +1 -0
  676. package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  677. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  678. package/dist/modes/interactive/components/countdown-timer.js +33 -0
  679. package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  680. package/dist/modes/interactive/components/custom-editor.d.ts +25 -0
  681. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  682. package/dist/modes/interactive/components/custom-editor.js +85 -0
  683. package/dist/modes/interactive/components/custom-editor.js.map +1 -0
  684. package/dist/modes/interactive/components/custom-message.d.ts +20 -0
  685. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  686. package/dist/modes/interactive/components/custom-message.js +81 -0
  687. package/dist/modes/interactive/components/custom-message.js.map +1 -0
  688. package/dist/modes/interactive/components/diff.d.ts +12 -0
  689. package/dist/modes/interactive/components/diff.d.ts.map +1 -0
  690. package/dist/modes/interactive/components/diff.js +118 -0
  691. package/dist/modes/interactive/components/diff.js.map +1 -0
  692. package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  693. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  694. package/dist/modes/interactive/components/dynamic-border.js +21 -0
  695. package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  696. package/dist/modes/interactive/components/extension-editor.d.ts +22 -0
  697. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  698. package/dist/modes/interactive/components/extension-editor.js +128 -0
  699. package/dist/modes/interactive/components/extension-editor.js.map +1 -0
  700. package/dist/modes/interactive/components/extension-input.d.ts +23 -0
  701. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  702. package/dist/modes/interactive/components/extension-input.js +61 -0
  703. package/dist/modes/interactive/components/extension-input.js.map +1 -0
  704. package/dist/modes/interactive/components/extension-selector.d.ts +26 -0
  705. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  706. package/dist/modes/interactive/components/extension-selector.js +83 -0
  707. package/dist/modes/interactive/components/extension-selector.js.map +1 -0
  708. package/dist/modes/interactive/components/footer.d.ts +36 -0
  709. package/dist/modes/interactive/components/footer.d.ts.map +1 -0
  710. package/dist/modes/interactive/components/footer.js +227 -0
  711. package/dist/modes/interactive/components/footer.js.map +1 -0
  712. package/dist/modes/interactive/components/hook-execution.d.ts +19 -0
  713. package/dist/modes/interactive/components/hook-execution.d.ts.map +1 -0
  714. package/dist/modes/interactive/components/hook-execution.js +185 -0
  715. package/dist/modes/interactive/components/hook-execution.js.map +1 -0
  716. package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
  717. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  718. package/dist/modes/interactive/components/keybinding-hints.js +36 -0
  719. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  720. package/dist/modes/interactive/components/login-dialog.d.ts +55 -0
  721. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  722. package/dist/modes/interactive/components/login-dialog.js +176 -0
  723. package/dist/modes/interactive/components/login-dialog.js.map +1 -0
  724. package/dist/modes/interactive/components/markdown-transform.d.ts +4 -0
  725. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
  726. package/dist/modes/interactive/components/markdown-transform.js +19 -0
  727. package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
  728. package/dist/modes/interactive/components/mermaid.d.ts +14 -0
  729. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
  730. package/dist/modes/interactive/components/mermaid.js +228 -0
  731. package/dist/modes/interactive/components/mermaid.js.map +1 -0
  732. package/dist/modes/interactive/components/message-card.d.ts +9 -0
  733. package/dist/modes/interactive/components/message-card.d.ts.map +1 -0
  734. package/dist/modes/interactive/components/message-card.js +24 -0
  735. package/dist/modes/interactive/components/message-card.js.map +1 -0
  736. package/dist/modes/interactive/components/model-selector.d.ts +52 -0
  737. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  738. package/dist/modes/interactive/components/model-selector.js +296 -0
  739. package/dist/modes/interactive/components/model-selector.js.map +1 -0
  740. package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
  741. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  742. package/dist/modes/interactive/components/oauth-selector.js +165 -0
  743. package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  744. package/dist/modes/interactive/components/scoped-models-selector.d.ts +50 -0
  745. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  746. package/dist/modes/interactive/components/scoped-models-selector.js +300 -0
  747. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  748. package/dist/modes/interactive/components/session-selector-search.d.ts +22 -0
  749. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  750. package/dist/modes/interactive/components/session-selector-search.js +144 -0
  751. package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  752. package/dist/modes/interactive/components/session-selector.d.ts +108 -0
  753. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  754. package/dist/modes/interactive/components/session-selector.js +835 -0
  755. package/dist/modes/interactive/components/session-selector.js.map +1 -0
  756. package/dist/modes/interactive/components/settings-selector.d.ts +81 -0
  757. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  758. package/dist/modes/interactive/components/settings-selector.js +455 -0
  759. package/dist/modes/interactive/components/settings-selector.js.map +1 -0
  760. package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  761. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  762. package/dist/modes/interactive/components/show-images-selector.js +39 -0
  763. package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  764. package/dist/modes/interactive/components/skill-invocation-message.d.ts +18 -0
  765. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  766. package/dist/modes/interactive/components/skill-invocation-message.js +48 -0
  767. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  768. package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  769. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  770. package/dist/modes/interactive/components/theme-selector.js +50 -0
  771. package/dist/modes/interactive/components/theme-selector.js.map +1 -0
  772. package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
  773. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  774. package/dist/modes/interactive/components/thinking-selector.js +51 -0
  775. package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  776. package/dist/modes/interactive/components/tool-execution.d.ts +67 -0
  777. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  778. package/dist/modes/interactive/components/tool-execution.js +312 -0
  779. package/dist/modes/interactive/components/tool-execution.js.map +1 -0
  780. package/dist/modes/interactive/components/tree-selector.d.ts +127 -0
  781. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  782. package/dist/modes/interactive/components/tree-selector.js +1098 -0
  783. package/dist/modes/interactive/components/tree-selector.js.map +1 -0
  784. package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  785. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  786. package/dist/modes/interactive/components/user-message-selector.js +114 -0
  787. package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  788. package/dist/modes/interactive/components/user-message.d.ts +16 -0
  789. package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  790. package/dist/modes/interactive/components/user-message.js +50 -0
  791. package/dist/modes/interactive/components/user-message.js.map +1 -0
  792. package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  793. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  794. package/dist/modes/interactive/components/visual-truncate.js +33 -0
  795. package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  796. package/dist/modes/interactive/interactive-mode.d.ts +554 -0
  797. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  798. package/dist/modes/interactive/interactive-mode.js +5870 -0
  799. package/dist/modes/interactive/interactive-mode.js.map +1 -0
  800. package/dist/modes/interactive/theme/dark.json +86 -0
  801. package/dist/modes/interactive/theme/light.json +85 -0
  802. package/dist/modes/interactive/theme/theme-schema.json +335 -0
  803. package/dist/modes/interactive/theme/theme.d.ts +109 -0
  804. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  805. package/dist/modes/interactive/theme/theme.js +1040 -0
  806. package/dist/modes/interactive/theme/theme.js.map +1 -0
  807. package/dist/modes/json-event.d.ts +28 -0
  808. package/dist/modes/json-event.d.ts.map +1 -0
  809. package/dist/modes/json-event.js +12 -0
  810. package/dist/modes/json-event.js.map +1 -0
  811. package/dist/modes/print-mode.d.ts +29 -0
  812. package/dist/modes/print-mode.d.ts.map +1 -0
  813. package/dist/modes/print-mode.js +142 -0
  814. package/dist/modes/print-mode.js.map +1 -0
  815. package/dist/modes/rpc/jsonl.d.ts +17 -0
  816. package/dist/modes/rpc/jsonl.d.ts.map +1 -0
  817. package/dist/modes/rpc/jsonl.js +49 -0
  818. package/dist/modes/rpc/jsonl.js.map +1 -0
  819. package/dist/modes/rpc/rpc-client.d.ts +321 -0
  820. package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  821. package/dist/modes/rpc/rpc-client.js +755 -0
  822. package/dist/modes/rpc/rpc-client.js.map +1 -0
  823. package/dist/modes/rpc/rpc-mode.d.ts +20 -0
  824. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  825. package/dist/modes/rpc/rpc-mode.js +963 -0
  826. package/dist/modes/rpc/rpc-mode.js.map +1 -0
  827. package/dist/modes/rpc/rpc-types.d.ts +652 -0
  828. package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  829. package/dist/modes/rpc/rpc-types.js +8 -0
  830. package/dist/modes/rpc/rpc-types.js.map +1 -0
  831. package/dist/package-manager-cli.d.ts +4 -0
  832. package/dist/package-manager-cli.d.ts.map +1 -0
  833. package/dist/package-manager-cli.js +488 -0
  834. package/dist/package-manager-cli.js.map +1 -0
  835. package/dist/utils/ansi.d.ts +2 -0
  836. package/dist/utils/ansi.d.ts.map +1 -0
  837. package/dist/utils/ansi.js +25 -0
  838. package/dist/utils/ansi.js.map +1 -0
  839. package/dist/utils/changelog.d.ts +23 -0
  840. package/dist/utils/changelog.d.ts.map +1 -0
  841. package/dist/utils/changelog.js +74 -0
  842. package/dist/utils/changelog.js.map +1 -0
  843. package/dist/utils/child-process.d.ts +15 -0
  844. package/dist/utils/child-process.d.ts.map +1 -0
  845. package/dist/utils/child-process.js +88 -0
  846. package/dist/utils/child-process.js.map +1 -0
  847. package/dist/utils/clipboard-image.d.ts +13 -0
  848. package/dist/utils/clipboard-image.d.ts.map +1 -0
  849. package/dist/utils/clipboard-image.js +248 -0
  850. package/dist/utils/clipboard-image.js.map +1 -0
  851. package/dist/utils/clipboard-native.d.ts +11 -0
  852. package/dist/utils/clipboard-native.d.ts.map +1 -0
  853. package/dist/utils/clipboard-native.js +20 -0
  854. package/dist/utils/clipboard-native.js.map +1 -0
  855. package/dist/utils/clipboard.d.ts +4 -0
  856. package/dist/utils/clipboard.d.ts.map +1 -0
  857. package/dist/utils/clipboard.js +171 -0
  858. package/dist/utils/clipboard.js.map +1 -0
  859. package/dist/utils/deprecation.d.ts +4 -0
  860. package/dist/utils/deprecation.d.ts.map +1 -0
  861. package/dist/utils/deprecation.js +13 -0
  862. package/dist/utils/deprecation.js.map +1 -0
  863. package/dist/utils/directory-completions.d.ts +5 -0
  864. package/dist/utils/directory-completions.d.ts.map +1 -0
  865. package/dist/utils/directory-completions.js +64 -0
  866. package/dist/utils/directory-completions.js.map +1 -0
  867. package/dist/utils/exif-orientation.d.ts +6 -0
  868. package/dist/utils/exif-orientation.d.ts.map +1 -0
  869. package/dist/utils/exif-orientation.js +166 -0
  870. package/dist/utils/exif-orientation.js.map +1 -0
  871. package/dist/utils/frontmatter.d.ts +8 -0
  872. package/dist/utils/frontmatter.d.ts.map +1 -0
  873. package/dist/utils/frontmatter.js +26 -0
  874. package/dist/utils/frontmatter.js.map +1 -0
  875. package/dist/utils/fs-watch.d.ts +5 -0
  876. package/dist/utils/fs-watch.d.ts.map +1 -0
  877. package/dist/utils/fs-watch.js +25 -0
  878. package/dist/utils/fs-watch.js.map +1 -0
  879. package/dist/utils/git.d.ts +27 -0
  880. package/dist/utils/git.d.ts.map +1 -0
  881. package/dist/utils/git.js +237 -0
  882. package/dist/utils/git.js.map +1 -0
  883. package/dist/utils/grip-user-agent.d.ts +2 -0
  884. package/dist/utils/grip-user-agent.d.ts.map +1 -0
  885. package/dist/utils/grip-user-agent.js +5 -0
  886. package/dist/utils/grip-user-agent.js.map +1 -0
  887. package/dist/utils/html.d.ts +7 -0
  888. package/dist/utils/html.d.ts.map +1 -0
  889. package/dist/utils/html.js +40 -0
  890. package/dist/utils/html.js.map +1 -0
  891. package/dist/utils/image-convert.d.ts +12 -0
  892. package/dist/utils/image-convert.d.ts.map +1 -0
  893. package/dist/utils/image-convert.js +43 -0
  894. package/dist/utils/image-convert.js.map +1 -0
  895. package/dist/utils/image-process.d.ts +18 -0
  896. package/dist/utils/image-process.d.ts.map +1 -0
  897. package/dist/utils/image-process.js +83 -0
  898. package/dist/utils/image-process.js.map +1 -0
  899. package/dist/utils/image-resize-core.d.ts +30 -0
  900. package/dist/utils/image-resize-core.d.ts.map +1 -0
  901. package/dist/utils/image-resize-core.js +133 -0
  902. package/dist/utils/image-resize-core.js.map +1 -0
  903. package/dist/utils/image-resize-worker.d.ts +2 -0
  904. package/dist/utils/image-resize-worker.d.ts.map +1 -0
  905. package/dist/utils/image-resize-worker.js +31 -0
  906. package/dist/utils/image-resize-worker.js.map +1 -0
  907. package/dist/utils/image-resize.d.ts +19 -0
  908. package/dist/utils/image-resize.d.ts.map +1 -0
  909. package/dist/utils/image-resize.js +86 -0
  910. package/dist/utils/image-resize.js.map +1 -0
  911. package/dist/utils/json.d.ts +3 -0
  912. package/dist/utils/json.d.ts.map +1 -0
  913. package/dist/utils/json.js +7 -0
  914. package/dist/utils/json.js.map +1 -0
  915. package/dist/utils/mime.d.ts +3 -0
  916. package/dist/utils/mime.d.ts.map +1 -0
  917. package/dist/utils/mime.js +110 -0
  918. package/dist/utils/mime.js.map +1 -0
  919. package/dist/utils/open-browser.d.ts +9 -0
  920. package/dist/utils/open-browser.d.ts.map +1 -0
  921. package/dist/utils/open-browser.js +22 -0
  922. package/dist/utils/open-browser.js.map +1 -0
  923. package/dist/utils/paths.d.ts +31 -0
  924. package/dist/utils/paths.d.ts.map +1 -0
  925. package/dist/utils/paths.js +87 -0
  926. package/dist/utils/paths.js.map +1 -0
  927. package/dist/utils/photon.d.ts +22 -0
  928. package/dist/utils/photon.d.ts.map +1 -0
  929. package/dist/utils/photon.js +126 -0
  930. package/dist/utils/photon.js.map +1 -0
  931. package/dist/utils/shell.d.ts +28 -0
  932. package/dist/utils/shell.d.ts.map +1 -0
  933. package/dist/utils/shell.js +188 -0
  934. package/dist/utils/shell.js.map +1 -0
  935. package/dist/utils/sleep.d.ts +5 -0
  936. package/dist/utils/sleep.d.ts.map +1 -0
  937. package/dist/utils/sleep.js +17 -0
  938. package/dist/utils/sleep.js.map +1 -0
  939. package/dist/utils/syntax-highlight.d.ts +12 -0
  940. package/dist/utils/syntax-highlight.d.ts.map +1 -0
  941. package/dist/utils/syntax-highlight.js +125 -0
  942. package/dist/utils/syntax-highlight.js.map +1 -0
  943. package/dist/utils/tools-manager.d.ts +5 -0
  944. package/dist/utils/tools-manager.d.ts.map +1 -0
  945. package/dist/utils/tools-manager.js +329 -0
  946. package/dist/utils/tools-manager.js.map +1 -0
  947. package/dist/utils/version-check.d.ts +14 -0
  948. package/dist/utils/version-check.d.ts.map +1 -0
  949. package/dist/utils/version-check.js +91 -0
  950. package/dist/utils/version-check.js.map +1 -0
  951. package/dist/utils/windows-self-update.d.ts +3 -0
  952. package/dist/utils/windows-self-update.d.ts.map +1 -0
  953. package/dist/utils/windows-self-update.js +77 -0
  954. package/dist/utils/windows-self-update.js.map +1 -0
  955. package/docs/compaction.md +408 -0
  956. package/docs/custom-provider.md +714 -0
  957. package/docs/daemon-architecture.md +399 -0
  958. package/docs/daemon.md +112 -0
  959. package/docs/development.md +72 -0
  960. package/docs/docs.json +164 -0
  961. package/docs/extensions.md +2745 -0
  962. package/docs/hooks.md +85 -0
  963. package/docs/images/doom-extension.png +0 -0
  964. package/docs/images/exy.png +0 -0
  965. package/docs/images/interactive-mode.png +0 -0
  966. package/docs/images/tree-view.png +0 -0
  967. package/docs/index.md +77 -0
  968. package/docs/json.md +89 -0
  969. package/docs/keybindings.md +230 -0
  970. package/docs/lsp.md +499 -0
  971. package/docs/migrating-to-grip.md +18 -0
  972. package/docs/models.md +496 -0
  973. package/docs/packages.md +228 -0
  974. package/docs/prompt-templates.md +88 -0
  975. package/docs/providers.md +251 -0
  976. package/docs/quickstart.md +159 -0
  977. package/docs/rpc.md +1492 -0
  978. package/docs/rules.md +117 -0
  979. package/docs/sandbox.md +104 -0
  980. package/docs/sdk.md +360 -0
  981. package/docs/session-format.md +414 -0
  982. package/docs/sessions.md +137 -0
  983. package/docs/settings.md +372 -0
  984. package/docs/shell-aliases.md +13 -0
  985. package/docs/skills.md +246 -0
  986. package/docs/terminal-setup.md +112 -0
  987. package/docs/termux.md +112 -0
  988. package/docs/themes.md +295 -0
  989. package/docs/tmux.md +61 -0
  990. package/docs/tui.md +918 -0
  991. package/docs/usage.md +304 -0
  992. package/docs/windows.md +17 -0
  993. package/examples/README.md +29 -0
  994. package/examples/daemon-docker/Dockerfile +43 -0
  995. package/examples/daemon-docker/README.md +45 -0
  996. package/examples/extensions/README.md +208 -0
  997. package/examples/extensions/auto-commit-on-exit.ts +46 -0
  998. package/examples/extensions/bash-spawn-hook.ts +30 -0
  999. package/examples/extensions/bookmark.ts +50 -0
  1000. package/examples/extensions/border-status-editor.ts +145 -0
  1001. package/examples/extensions/built-in-tool-renderer.ts +259 -0
  1002. package/examples/extensions/claude-rules.ts +86 -0
  1003. package/examples/extensions/commands.ts +82 -0
  1004. package/examples/extensions/confirm-destructive.ts +59 -0
  1005. package/examples/extensions/custom-compaction.ts +131 -0
  1006. package/examples/extensions/custom-footer.ts +79 -0
  1007. package/examples/extensions/custom-header.ts +73 -0
  1008. package/examples/extensions/custom-provider-anthropic/index.ts +707 -0
  1009. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  1010. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  1011. package/examples/extensions/custom-provider-gitlab-duo/index.ts +402 -0
  1012. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  1013. package/examples/extensions/custom-provider-gitlab-duo/test.ts +104 -0
  1014. package/examples/extensions/dirty-repo-guard.ts +59 -0
  1015. package/examples/extensions/doom-overlay/README.md +46 -0
  1016. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  1017. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  1018. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  1019. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  1020. package/examples/extensions/doom-overlay/doom-component.ts +133 -0
  1021. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  1022. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  1023. package/examples/extensions/doom-overlay/index.ts +74 -0
  1024. package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
  1025. package/examples/extensions/dynamic-resources/RULES.md +8 -0
  1026. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  1027. package/examples/extensions/dynamic-resources/dynamic.json +79 -0
  1028. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  1029. package/examples/extensions/dynamic-resources/index.ts +16 -0
  1030. package/examples/extensions/dynamic-tools.ts +74 -0
  1031. package/examples/extensions/event-bus.ts +43 -0
  1032. package/examples/extensions/file-trigger.ts +41 -0
  1033. package/examples/extensions/git-checkpoint.ts +53 -0
  1034. package/examples/extensions/git-merge-and-resolve.ts +125 -0
  1035. package/examples/extensions/github-issue-autocomplete.ts +191 -0
  1036. package/examples/extensions/handoff.ts +191 -0
  1037. package/examples/extensions/hello.ts +26 -0
  1038. package/examples/extensions/hidden-thinking-label.ts +53 -0
  1039. package/examples/extensions/inline-bash.ts +104 -0
  1040. package/examples/extensions/input-transform.ts +43 -0
  1041. package/examples/extensions/interactive-shell.ts +194 -0
  1042. package/examples/extensions/mac-system-theme.ts +47 -0
  1043. package/examples/extensions/message-renderer.ts +59 -0
  1044. package/examples/extensions/minimal-mode.ts +428 -0
  1045. package/examples/extensions/modal-editor.ts +86 -0
  1046. package/examples/extensions/model-status.ts +31 -0
  1047. package/examples/extensions/notify.ts +55 -0
  1048. package/examples/extensions/overlay-qa-tests.ts +1374 -0
  1049. package/examples/extensions/overlay-test.ts +171 -0
  1050. package/examples/extensions/permission-gate.ts +34 -0
  1051. package/examples/extensions/pirate.ts +47 -0
  1052. package/examples/extensions/plan-mode/README.md +65 -0
  1053. package/examples/extensions/plan-mode/index.ts +346 -0
  1054. package/examples/extensions/plan-mode/utils.ts +172 -0
  1055. package/examples/extensions/preset.ts +426 -0
  1056. package/examples/extensions/prompt-customizer.ts +97 -0
  1057. package/examples/extensions/protected-paths.ts +29 -0
  1058. package/examples/extensions/provider-payload.ts +18 -0
  1059. package/examples/extensions/qna.ts +125 -0
  1060. package/examples/extensions/question.ts +294 -0
  1061. package/examples/extensions/questionnaire.ts +459 -0
  1062. package/examples/extensions/rainbow-editor.ts +88 -0
  1063. package/examples/extensions/reload-runtime.ts +37 -0
  1064. package/examples/extensions/rpc-demo.ts +118 -0
  1065. package/examples/extensions/sandbox/index.ts +320 -0
  1066. package/examples/extensions/sandbox/package-lock.json +92 -0
  1067. package/examples/extensions/sandbox/package.json +19 -0
  1068. package/examples/extensions/send-user-message.ts +97 -0
  1069. package/examples/extensions/session-name.ts +27 -0
  1070. package/examples/extensions/shutdown-command.ts +63 -0
  1071. package/examples/extensions/snake.ts +381 -0
  1072. package/examples/extensions/space-invaders.ts +597 -0
  1073. package/examples/extensions/status-line.ts +32 -0
  1074. package/examples/extensions/structured-output.ts +65 -0
  1075. package/examples/extensions/subagent/README.md +175 -0
  1076. package/examples/extensions/subagent/agents/planner.md +37 -0
  1077. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  1078. package/examples/extensions/subagent/agents/scout.md +50 -0
  1079. package/examples/extensions/subagent/agents/worker.md +24 -0
  1080. package/examples/extensions/subagent/agents.ts +126 -0
  1081. package/examples/extensions/subagent/index.ts +1083 -0
  1082. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  1083. package/examples/extensions/subagent/prompts/implement.md +10 -0
  1084. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  1085. package/examples/extensions/summarize.ts +186 -0
  1086. package/examples/extensions/system-prompt-header.ts +17 -0
  1087. package/examples/extensions/tic-tac-toe.ts +1091 -0
  1088. package/examples/extensions/timed-confirm.ts +70 -0
  1089. package/examples/extensions/titlebar-spinner.ts +58 -0
  1090. package/examples/extensions/todo.ts +306 -0
  1091. package/examples/extensions/tool-override.ts +144 -0
  1092. package/examples/extensions/tools.ts +141 -0
  1093. package/examples/extensions/trigger-compact.ts +50 -0
  1094. package/examples/extensions/truncated-tool.ts +200 -0
  1095. package/examples/extensions/widget-placement.ts +9 -0
  1096. package/examples/extensions/with-deps/index.ts +32 -0
  1097. package/examples/extensions/with-deps/package-lock.json +31 -0
  1098. package/examples/extensions/with-deps/package.json +22 -0
  1099. package/examples/extensions/working-indicator.ts +123 -0
  1100. package/examples/extensions/working-message-test.ts +25 -0
  1101. package/examples/remote-session-server/README.md +71 -0
  1102. package/examples/remote-session-server/server.ts +353 -0
  1103. package/examples/rpc-extension-ui.ts +642 -0
  1104. package/examples/sdk/01-minimal.ts +27 -0
  1105. package/examples/sdk/02-custom-model.ts +54 -0
  1106. package/examples/sdk/03-custom-prompt.ts +76 -0
  1107. package/examples/sdk/04-skills.ts +60 -0
  1108. package/examples/sdk/05-tools.ts +55 -0
  1109. package/examples/sdk/06-extensions.ts +94 -0
  1110. package/examples/sdk/07-context-files.ts +47 -0
  1111. package/examples/sdk/08-prompt-templates.ts +56 -0
  1112. package/examples/sdk/09-api-keys-and-oauth.ts +50 -0
  1113. package/examples/sdk/10-settings.ts +58 -0
  1114. package/examples/sdk/11-sessions.ts +54 -0
  1115. package/examples/sdk/12-full-control.ts +79 -0
  1116. package/examples/sdk/13-session-runtime.ts +49 -0
  1117. package/examples/sdk/README.md +94 -0
  1118. package/npm-shrinkwrap.json +1878 -0
  1119. package/package.json +101 -5
@@ -0,0 +1,825 @@
1
+ import { createHash } from "node:crypto";
2
+ import { Type } from "typebox";
3
+ import { Compile } from "typebox/compile";
4
+ export const REMOTE_WORKSPACE_PROTOCOL_VERSIONS = [{ major: 1, minMinor: 0, maxMinor: 0 }];
5
+ export const REMOTE_WORKSPACE_CAPABILITIES = [
6
+ "catalog_refresh",
7
+ "tool_updates",
8
+ "primitive_operations",
9
+ "lsp_status",
10
+ "file_transfer",
11
+ "artifacts",
12
+ ];
13
+ export const REMOTE_WORKSPACE_METHODS = [
14
+ "catalog.get",
15
+ "tool.invoke",
16
+ "workspace.access",
17
+ "workspace.read",
18
+ "workspace.write",
19
+ "workspace.mkdir",
20
+ "workspace.stat",
21
+ "workspace.readdir",
22
+ "workspace.glob",
23
+ "workspace.grep",
24
+ "workspace.detect_image_mime",
25
+ "workspace.exec",
26
+ "lsp.status",
27
+ "resource.read",
28
+ "artifact.read",
29
+ "transfer.upload",
30
+ "transfer.download",
31
+ ];
32
+ export const REMOTE_WORKSPACE_ERROR_CODES = [
33
+ "invalid_request",
34
+ "method_not_supported",
35
+ "incompatible_version",
36
+ "capability_mismatch",
37
+ "schema_mismatch",
38
+ "stale_generation",
39
+ "not_available",
40
+ "limit_exceeded",
41
+ "deadline_exceeded",
42
+ "cancelled",
43
+ "conflict",
44
+ "generation_retired",
45
+ "connection_draining",
46
+ "result_too_large",
47
+ "internal_error",
48
+ ];
49
+ export const DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS = {
50
+ maxMessageBytes: 2 * 1024 * 1024,
51
+ maxStringBytes: 1536 * 1024,
52
+ maxDepth: 32,
53
+ maxObjectKeys: 4096,
54
+ maxArrayLength: 4096,
55
+ maxNodes: 16_384,
56
+ maxRequestMs: 10 * 60 * 1000,
57
+ maxTransferChunkBytes: 64 * 1024,
58
+ maxPendingTransferBytes: 256 * 1024,
59
+ maxPendingInboundBytes: 4 * 1024 * 1024,
60
+ maxPendingInboundMessages: 64,
61
+ maxPendingOutboundBytes: 4 * 1024 * 1024,
62
+ maxPendingOutboundMessages: 128,
63
+ maxTransferBytes: 100 * 1024 * 1024,
64
+ maxTransferChunks: 16_384,
65
+ maxActiveRequests: 64,
66
+ maxActiveTransfers: 8,
67
+ maxCancellationMs: 100,
68
+ maxTransportSendMs: 10_000,
69
+ };
70
+ const closedObject = { additionalProperties: false };
71
+ const safeIntegerOptions = { minimum: 0, maximum: Number.MAX_SAFE_INTEGER };
72
+ const RequestIdSchema = Type.String({ minLength: 1, maxLength: 128, pattern: "^[A-Za-z0-9._:-]+$" });
73
+ const HashSchema = Type.String({ pattern: "^[0-9a-f]{64}$" });
74
+ const CapabilitySchema = Type.String({ minLength: 1, maxLength: 128, pattern: "^[a-z][a-z0-9_.-]*$" });
75
+ const RemoteWorkspaceMethodSchema = Type.Union([
76
+ Type.Literal("catalog.get"),
77
+ Type.Literal("tool.invoke"),
78
+ Type.Literal("workspace.access"),
79
+ Type.Literal("workspace.read"),
80
+ Type.Literal("workspace.write"),
81
+ Type.Literal("workspace.mkdir"),
82
+ Type.Literal("workspace.stat"),
83
+ Type.Literal("workspace.readdir"),
84
+ Type.Literal("workspace.glob"),
85
+ Type.Literal("workspace.grep"),
86
+ Type.Literal("workspace.detect_image_mime"),
87
+ Type.Literal("workspace.exec"),
88
+ Type.Literal("lsp.status"),
89
+ Type.Literal("resource.read"),
90
+ Type.Literal("artifact.read"),
91
+ Type.Literal("transfer.upload"),
92
+ Type.Literal("transfer.download"),
93
+ ]);
94
+ export const RemoteWorkspaceVersionRangeSchema = Type.Object({
95
+ major: Type.Integer({ minimum: 1, maximum: 65535 }),
96
+ minMinor: Type.Integer({ minimum: 0, maximum: 65535 }),
97
+ maxMinor: Type.Integer({ minimum: 0, maximum: 65535 }),
98
+ }, closedObject);
99
+ export const RemoteWorkspaceVersionSchema = Type.Object({
100
+ major: Type.Integer({ minimum: 1, maximum: 65535 }),
101
+ minor: Type.Integer({ minimum: 0, maximum: 65535 }),
102
+ }, closedObject);
103
+ export const RemoteWorkspaceLimitsSchema = Type.Object({
104
+ maxMessageBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),
105
+ maxStringBytes: Type.Integer({ minimum: 1, maximum: 64 * 1024 * 1024 }),
106
+ maxDepth: Type.Integer({ minimum: 1, maximum: 256 }),
107
+ maxObjectKeys: Type.Integer({ minimum: 1, maximum: 1_000_000 }),
108
+ maxArrayLength: Type.Integer({ minimum: 1, maximum: 1_000_000 }),
109
+ maxNodes: Type.Integer({ minimum: 1, maximum: 2_000_000 }),
110
+ maxRequestMs: Type.Integer({ minimum: 1, maximum: 24 * 60 * 60 * 1000 }),
111
+ maxTransferChunkBytes: Type.Integer({ minimum: 1024, maximum: 1024 * 1024 }),
112
+ maxPendingTransferBytes: Type.Integer({ minimum: 1024, maximum: 16 * 1024 * 1024 }),
113
+ maxPendingInboundBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),
114
+ maxPendingInboundMessages: Type.Integer({ minimum: 1, maximum: 100_000 }),
115
+ maxPendingOutboundBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),
116
+ maxPendingOutboundMessages: Type.Integer({ minimum: 1, maximum: 100_000 }),
117
+ maxTransferBytes: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),
118
+ maxTransferChunks: Type.Integer({ minimum: 1, maximum: 1_000_000 }),
119
+ maxActiveRequests: Type.Integer({ minimum: 1, maximum: 10_000_000 }),
120
+ maxActiveTransfers: Type.Integer({ minimum: 1, maximum: 10_000 }),
121
+ maxCancellationMs: Type.Integer({ minimum: 1, maximum: 60_000 }),
122
+ maxTransportSendMs: Type.Integer({ minimum: 1, maximum: 5 * 60_000 }),
123
+ }, closedObject);
124
+ export const RemoteWorkspaceIdentitySchema = Type.Object({
125
+ id: Type.String({ minLength: 16, maxLength: 128, pattern: "^[A-Za-z0-9_-]+$" }),
126
+ root: Type.String({ minLength: 1, maxLength: 32_768 }),
127
+ pathFlavor: Type.Union([Type.Literal("posix"), Type.Literal("windows")]),
128
+ }, closedObject);
129
+ export const RemoteWorkspaceToolCatalogEntrySchema = Type.Object({
130
+ name: Type.String({ minLength: 1, maxLength: 128, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$" }),
131
+ executionMode: Type.Union([
132
+ Type.Literal("read"),
133
+ Type.Literal("mutation"),
134
+ Type.Literal("process"),
135
+ Type.Literal("service"),
136
+ ]),
137
+ parameterSchema: Type.Record(Type.String({ maxLength: 256 }), Type.Unknown()),
138
+ schemaHash: HashSchema,
139
+ featureFlags: Type.Array(CapabilitySchema, { maxItems: 256 }),
140
+ }, closedObject);
141
+ export const RemoteWorkspaceCatalogSchema = Type.Object({
142
+ generation: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),
143
+ tools: Type.Array(RemoteWorkspaceToolCatalogEntrySchema, { maxItems: 1024 }),
144
+ operations: Type.Array(RemoteWorkspaceMethodSchema, { maxItems: 256 }),
145
+ }, closedObject);
146
+ export const RemoteWorkspaceHandshakeSchema = Type.Object({
147
+ type: Type.Literal("handshake"),
148
+ id: RequestIdSchema,
149
+ versions: Type.Array(RemoteWorkspaceVersionRangeSchema, { minItems: 1, maxItems: 16 }),
150
+ requiredCapabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),
151
+ optionalCapabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),
152
+ receiveLimits: RemoteWorkspaceLimitsSchema,
153
+ }, closedObject);
154
+ export const RemoteWorkspaceHandshakeAckSchema = Type.Object({
155
+ type: Type.Literal("handshake_ack"),
156
+ id: RequestIdSchema,
157
+ version: RemoteWorkspaceVersionSchema,
158
+ capabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),
159
+ workspace: RemoteWorkspaceIdentitySchema,
160
+ limits: RemoteWorkspaceLimitsSchema,
161
+ catalog: RemoteWorkspaceCatalogSchema,
162
+ catalogHash: HashSchema,
163
+ backendMetadata: Type.Object({
164
+ kind: Type.Literal("remote-workspace"),
165
+ label: Type.Optional(Type.String({ minLength: 1, maxLength: 256 })),
166
+ }, closedObject),
167
+ }, closedObject);
168
+ export const RemoteWorkspaceRequestSchema = Type.Object({
169
+ type: Type.Literal("request"),
170
+ id: RequestIdSchema,
171
+ method: Type.String({ minLength: 1, maxLength: 128 }),
172
+ timeoutMs: Type.Integer({ minimum: 1, maximum: 24 * 60 * 60 * 1000 }),
173
+ params: Type.Unknown(),
174
+ }, closedObject);
175
+ export const RemoteWorkspaceCancelSchema = Type.Object({
176
+ type: Type.Literal("cancel"),
177
+ id: RequestIdSchema,
178
+ reason: Type.Optional(Type.String({ maxLength: 256 })),
179
+ }, closedObject);
180
+ export const RemoteWorkspaceTransferChunkSchema = Type.Object({
181
+ type: Type.Literal("transfer_chunk"),
182
+ id: RequestIdSchema,
183
+ sequence: Type.Integer(safeIntegerOptions),
184
+ dataBase64: Type.String({ minLength: 4 }),
185
+ }, closedObject);
186
+ export const RemoteWorkspaceTransferFinishSchema = Type.Object({
187
+ type: Type.Literal("transfer_finish"),
188
+ id: RequestIdSchema,
189
+ length: Type.Integer(safeIntegerOptions),
190
+ sha256: HashSchema,
191
+ }, closedObject);
192
+ export const RemoteWorkspaceResultSchema = Type.Object({
193
+ type: Type.Literal("result"),
194
+ id: RequestIdSchema,
195
+ result: Type.Unknown(),
196
+ }, closedObject);
197
+ export const RemoteWorkspaceProtocolErrorSchema = Type.Object({
198
+ code: Type.Union([
199
+ Type.Literal("invalid_request"),
200
+ Type.Literal("method_not_supported"),
201
+ Type.Literal("incompatible_version"),
202
+ Type.Literal("capability_mismatch"),
203
+ Type.Literal("schema_mismatch"),
204
+ Type.Literal("stale_generation"),
205
+ Type.Literal("not_available"),
206
+ Type.Literal("limit_exceeded"),
207
+ Type.Literal("deadline_exceeded"),
208
+ Type.Literal("cancelled"),
209
+ Type.Literal("conflict"),
210
+ Type.Literal("generation_retired"),
211
+ Type.Literal("connection_draining"),
212
+ Type.Literal("result_too_large"),
213
+ Type.Literal("internal_error"),
214
+ ]),
215
+ message: Type.String({ minLength: 1, maxLength: 4096 }),
216
+ executionState: Type.Union([
217
+ Type.Literal("not_started"),
218
+ Type.Literal("completed"),
219
+ Type.Literal("indeterminate"),
220
+ ]),
221
+ retryable: Type.Boolean(),
222
+ details: Type.Optional(Type.Unknown()),
223
+ }, closedObject);
224
+ export const RemoteWorkspaceErrorMessageSchema = Type.Object({
225
+ type: Type.Literal("error"),
226
+ id: RequestIdSchema,
227
+ error: RemoteWorkspaceProtocolErrorSchema,
228
+ }, closedObject);
229
+ export const RemoteWorkspaceUpdateSchema = Type.Object({
230
+ type: Type.Literal("update"),
231
+ id: RequestIdSchema,
232
+ sequence: Type.Integer(safeIntegerOptions),
233
+ update: Type.Unknown(),
234
+ }, closedObject);
235
+ export const RemoteWorkspaceTransferStartSchema = Type.Object({
236
+ type: Type.Literal("transfer_start"),
237
+ id: RequestIdSchema,
238
+ length: Type.Integer(safeIntegerOptions),
239
+ sha256: HashSchema,
240
+ }, closedObject);
241
+ export const RemoteWorkspaceCatalogChangedSchema = Type.Object({
242
+ type: Type.Literal("catalog_changed"),
243
+ generation: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),
244
+ catalogHash: HashSchema,
245
+ }, closedObject);
246
+ export const RemoteWorkspaceClientMessageSchema = Type.Union([
247
+ RemoteWorkspaceHandshakeSchema,
248
+ RemoteWorkspaceRequestSchema,
249
+ RemoteWorkspaceCancelSchema,
250
+ RemoteWorkspaceTransferChunkSchema,
251
+ RemoteWorkspaceTransferFinishSchema,
252
+ ]);
253
+ export const RemoteWorkspaceServerMessageSchema = Type.Union([
254
+ RemoteWorkspaceHandshakeAckSchema,
255
+ RemoteWorkspaceResultSchema,
256
+ RemoteWorkspaceErrorMessageSchema,
257
+ RemoteWorkspaceUpdateSchema,
258
+ RemoteWorkspaceTransferStartSchema,
259
+ RemoteWorkspaceTransferChunkSchema,
260
+ RemoteWorkspaceCatalogChangedSchema,
261
+ ]);
262
+ const EmptyParamsSchema = Type.Object({}, closedObject);
263
+ const PathParamsSchema = Type.Object({ path: Type.String({ minLength: 1, maxLength: 32_768 }) }, closedObject);
264
+ const CatalogGetParamsSchema = EmptyParamsSchema;
265
+ const SessionEnvironmentSchema = Type.Object({
266
+ GRIP_SESSION_ID: Type.Optional(Type.String({ maxLength: 32_768 })),
267
+ GRIP_SESSION_FILE: Type.Optional(Type.String({ maxLength: 32_768 })),
268
+ GRIP_PROVIDER: Type.Optional(Type.String({ maxLength: 32_768 })),
269
+ GRIP_MODEL: Type.Optional(Type.String({ maxLength: 32_768 })),
270
+ GRIP_REASONING_LEVEL: Type.Optional(Type.String({ maxLength: 32_768 })),
271
+ }, closedObject);
272
+ /** Shared v2 mutations require an observed digest/absence, or an explicitly unsafe write. */
273
+ const ExpectedRevisionSchema = Type.Union([
274
+ Type.Object({ sha256: HashSchema }, closedObject),
275
+ Type.Object({ absent: Type.Literal(true) }, closedObject),
276
+ Type.Object({ unsafeOverwrite: Type.Literal(true) }, closedObject),
277
+ ]);
278
+ const ToolInvokeParamsSchema = Type.Object({
279
+ generation: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),
280
+ catalogHash: HashSchema,
281
+ toolName: Type.String({ minLength: 1, maxLength: 128 }),
282
+ schemaHash: HashSchema,
283
+ argumentsPrepared: Type.Literal(true),
284
+ arguments: Type.Unknown(),
285
+ expectedRevision: Type.Optional(ExpectedRevisionSchema),
286
+ executionOptions: Type.Object({
287
+ imageAutoResize: Type.Optional(Type.Boolean()),
288
+ shellCommandPrefix: Type.Optional(Type.String({ maxLength: 32_768 })),
289
+ sessionEnvironment: Type.Optional(SessionEnvironmentSchema),
290
+ }, closedObject),
291
+ }, closedObject);
292
+ const AccessParamsSchema = Type.Object({
293
+ path: Type.String({ minLength: 1, maxLength: 32_768 }),
294
+ mode: Type.Optional(Type.Union([Type.Literal("exists"), Type.Literal("read"), Type.Literal("write"), Type.Literal("readwrite")])),
295
+ }, closedObject);
296
+ const WriteParamsSchema = Type.Object({
297
+ path: Type.String({ minLength: 1, maxLength: 32_768 }),
298
+ contentBase64: Type.String(),
299
+ expectedRevision: Type.Optional(ExpectedRevisionSchema),
300
+ }, closedObject);
301
+ const MkdirParamsSchema = Type.Object({
302
+ path: Type.String({ minLength: 1, maxLength: 32_768 }),
303
+ recursive: Type.Boolean(),
304
+ }, closedObject);
305
+ const GlobParamsSchema = Type.Object({
306
+ pattern: Type.String({ minLength: 1, maxLength: 32_768 }),
307
+ cwd: Type.String({ minLength: 1, maxLength: 32_768 }),
308
+ ignore: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 4096 }),
309
+ limit: Type.Integer({ minimum: 1, maximum: 1_000_000 }),
310
+ }, closedObject);
311
+ const GrepParamsSchema = Type.Object({
312
+ pattern: Type.String({ maxLength: 1024 * 1024 }),
313
+ path: Type.String({ minLength: 1, maxLength: 32_768 }),
314
+ glob: Type.Optional(Type.String({ maxLength: 32_768 })),
315
+ ignoreCase: Type.Optional(Type.Boolean()),
316
+ literal: Type.Optional(Type.Boolean()),
317
+ limit: Type.Integer({ minimum: 1, maximum: 1_000_000 }),
318
+ }, closedObject);
319
+ const ExecParamsSchema = Type.Object({
320
+ command: Type.String({ minLength: 1 }),
321
+ cwd: Type.String({ minLength: 1, maxLength: 32_768 }),
322
+ }, closedObject);
323
+ const TransferUploadParamsSchema = Type.Object({
324
+ path: Type.String({ minLength: 1, maxLength: 32_768 }),
325
+ length: Type.Integer(safeIntegerOptions),
326
+ sha256: HashSchema,
327
+ overwrite: Type.Boolean(),
328
+ }, closedObject);
329
+ const TransferDownloadParamsSchema = Type.Object({
330
+ path: Type.String({ minLength: 1, maxLength: 32_768 }),
331
+ }, closedObject);
332
+ const ToolContentSchema = Type.Union([
333
+ Type.Object({ type: Type.Literal("text"), text: Type.String() }, closedObject),
334
+ Type.Object({
335
+ type: Type.Literal("image"),
336
+ data: Type.String(),
337
+ mimeType: Type.String({ minLength: 1, maxLength: 256 }),
338
+ }, closedObject),
339
+ ]);
340
+ const ToolResultSchema = Type.Object({
341
+ content: Type.Array(ToolContentSchema),
342
+ details: Type.Optional(Type.Unknown()),
343
+ terminate: Type.Optional(Type.Boolean()),
344
+ }, closedObject);
345
+ const EmptyResultSchema = EmptyParamsSchema;
346
+ const LspStatusServerSchema = Type.Object({
347
+ serverId: Type.String({ minLength: 1, maxLength: 256 }),
348
+ languageIds: Type.Array(Type.String({ maxLength: 256 }), { maxItems: 256 }),
349
+ transport: Type.String({ minLength: 1, maxLength: 128 }),
350
+ instanceKey: Type.Optional(Type.String({ maxLength: 4096 })),
351
+ workspaceRoot: Type.Optional(Type.String({ maxLength: 32_768 })),
352
+ endpoint: Type.Optional(Type.String({ maxLength: 4096 })),
353
+ rootUri: Type.Optional(Type.String({ maxLength: 32_768 })),
354
+ ownership: Type.Union([Type.Literal("managed"), Type.Literal("attached")]),
355
+ shutdownMode: Type.Union([Type.Literal("protocol"), Type.Literal("disconnect")]),
356
+ state: Type.Union([
357
+ Type.Literal("idle"),
358
+ Type.Literal("connecting"),
359
+ Type.Literal("initializing"),
360
+ Type.Literal("running"),
361
+ Type.Literal("closed"),
362
+ Type.Literal("failed"),
363
+ Type.Literal("disposed"),
364
+ ]),
365
+ reconnectEligible: Type.Boolean(),
366
+ running: Type.Boolean(),
367
+ starting: Type.Boolean(),
368
+ diagnosticsCount: Type.Integer(safeIntegerOptions),
369
+ lastError: Type.Optional(Type.String()),
370
+ lastRequestError: Type.Optional(Type.String()),
371
+ stderr: Type.Optional(Type.String()),
372
+ synchronizationError: Type.Optional(Type.String()),
373
+ }, closedObject);
374
+ const LspStatusResultSchema = Type.Object({ enabled: Type.Boolean(), servers: Type.Array(LspStatusServerSchema, { maxItems: 1024 }) }, closedObject);
375
+ const ReadResultSchema = Type.Object({
376
+ contentBase64: Type.String(),
377
+ workspace: RemoteWorkspaceIdentitySchema,
378
+ revision: Type.Optional(HashSchema),
379
+ }, closedObject);
380
+ const StatResultSchema = Type.Object({
381
+ kind: Type.Union([
382
+ Type.Literal("file"),
383
+ Type.Literal("directory"),
384
+ Type.Literal("other"),
385
+ Type.Literal("absent"),
386
+ ]),
387
+ workspace: RemoteWorkspaceIdentitySchema,
388
+ }, closedObject);
389
+ const ReaddirResultSchema = Type.Object({
390
+ entries: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 1_000_000 }),
391
+ workspace: RemoteWorkspaceIdentitySchema,
392
+ }, closedObject);
393
+ const GlobResultSchema = Type.Object({
394
+ matches: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 1_000_000 }),
395
+ workspace: RemoteWorkspaceIdentitySchema,
396
+ }, closedObject);
397
+ const GrepResultSchema = Type.Object({
398
+ isDirectory: Type.Boolean(),
399
+ matches: Type.Array(Type.Object({
400
+ filePath: Type.String({ minLength: 1, maxLength: 32_768 }),
401
+ lineNumber: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),
402
+ lineText: Type.Optional(Type.String()),
403
+ }, closedObject), { maxItems: 1_000_000 }),
404
+ workspace: RemoteWorkspaceIdentitySchema,
405
+ }, closedObject);
406
+ const MimeResultSchema = Type.Object({
407
+ mimeType: Type.Union([
408
+ Type.Literal("image/jpeg"),
409
+ Type.Literal("image/png"),
410
+ Type.Literal("image/gif"),
411
+ Type.Literal("image/webp"),
412
+ Type.Null(),
413
+ ]),
414
+ workspace: RemoteWorkspaceIdentitySchema,
415
+ }, closedObject);
416
+ const ExecResultSchema = Type.Object({ exitCode: Type.Union([Type.Integer({ minimum: 0, maximum: 255 }), Type.Null()]) }, closedObject);
417
+ const TransferResultSchema = Type.Object({
418
+ length: Type.Integer(safeIntegerOptions),
419
+ sha256: HashSchema,
420
+ }, closedObject);
421
+ const parameterValidators = {
422
+ "catalog.get": Compile(CatalogGetParamsSchema),
423
+ "tool.invoke": Compile(ToolInvokeParamsSchema),
424
+ "workspace.access": Compile(AccessParamsSchema),
425
+ "workspace.read": Compile(PathParamsSchema),
426
+ "workspace.write": Compile(WriteParamsSchema),
427
+ "workspace.mkdir": Compile(MkdirParamsSchema),
428
+ "workspace.stat": Compile(PathParamsSchema),
429
+ "workspace.readdir": Compile(PathParamsSchema),
430
+ "workspace.glob": Compile(GlobParamsSchema),
431
+ "workspace.grep": Compile(GrepParamsSchema),
432
+ "workspace.detect_image_mime": Compile(PathParamsSchema),
433
+ "workspace.exec": Compile(ExecParamsSchema),
434
+ "lsp.status": Compile(EmptyParamsSchema),
435
+ "resource.read": Compile(PathParamsSchema),
436
+ "artifact.read": Compile(PathParamsSchema),
437
+ "transfer.upload": Compile(TransferUploadParamsSchema),
438
+ "transfer.download": Compile(TransferDownloadParamsSchema),
439
+ };
440
+ const resultValidators = {
441
+ "catalog.get": Compile(RemoteWorkspaceCatalogSchema),
442
+ "tool.invoke": Compile(ToolResultSchema),
443
+ "workspace.access": Compile(EmptyResultSchema),
444
+ "workspace.read": Compile(ReadResultSchema),
445
+ "workspace.write": Compile(EmptyResultSchema),
446
+ "workspace.mkdir": Compile(EmptyResultSchema),
447
+ "workspace.stat": Compile(StatResultSchema),
448
+ "workspace.readdir": Compile(ReaddirResultSchema),
449
+ "workspace.glob": Compile(GlobResultSchema),
450
+ "workspace.grep": Compile(GrepResultSchema),
451
+ "workspace.detect_image_mime": Compile(MimeResultSchema),
452
+ "workspace.exec": Compile(ExecResultSchema),
453
+ "lsp.status": Compile(LspStatusResultSchema),
454
+ "resource.read": Compile(ReadResultSchema),
455
+ "artifact.read": Compile(TransferResultSchema),
456
+ "transfer.upload": Compile(TransferResultSchema),
457
+ "transfer.download": Compile(TransferResultSchema),
458
+ };
459
+ const clientMessageValidator = Compile(RemoteWorkspaceClientMessageSchema);
460
+ const serverMessageValidator = Compile(RemoteWorkspaceServerMessageSchema);
461
+ const handshakeAckValidator = Compile(RemoteWorkspaceHandshakeAckSchema);
462
+ const limitsValidator = Compile(RemoteWorkspaceLimitsSchema);
463
+ export class RemoteWorkspaceValidationError extends Error {
464
+ constructor(message) {
465
+ super(message);
466
+ this.name = "RemoteWorkspaceValidationError";
467
+ }
468
+ }
469
+ function validationMessage(validator, value) {
470
+ const error = validator.Errors(value)[0];
471
+ if (!error)
472
+ return "value does not match the protocol schema";
473
+ return `${error.instancePath || "/"}: ${error.message}`;
474
+ }
475
+ function parseWithValidator(validator, value, label) {
476
+ if (!validator.Check(value)) {
477
+ throw new RemoteWorkspaceValidationError(`Invalid ${label}: ${validationMessage(validator, value)}`);
478
+ }
479
+ return value;
480
+ }
481
+ export function validateRemoteWorkspaceProtocolLimits(value) {
482
+ const limits = parseWithValidator(limitsValidator, value, "protocol limits");
483
+ if (limits.maxMessageBytes > limits.maxPendingInboundBytes) {
484
+ throw new RemoteWorkspaceValidationError("maxMessageBytes must not exceed maxPendingInboundBytes");
485
+ }
486
+ if (limits.maxMessageBytes > limits.maxPendingOutboundBytes) {
487
+ throw new RemoteWorkspaceValidationError("maxMessageBytes must not exceed maxPendingOutboundBytes");
488
+ }
489
+ if (limits.maxTransferChunkBytes > limits.maxPendingTransferBytes) {
490
+ throw new RemoteWorkspaceValidationError("maxTransferChunkBytes must not exceed maxPendingTransferBytes");
491
+ }
492
+ if (Math.ceil((limits.maxTransferChunkBytes * 4) / 3) + 512 > limits.maxMessageBytes) {
493
+ throw new RemoteWorkspaceValidationError("maxTransferChunkBytes must fit in one base64 protocol message");
494
+ }
495
+ return limits;
496
+ }
497
+ function validateRemoteWorkspaceNodeBudget(depth, state) {
498
+ state.nodes++;
499
+ if (state.nodes > state.limits.maxNodes)
500
+ throw new RemoteWorkspaceValidationError("Protocol value exceeds node limit");
501
+ if (depth > state.limits.maxDepth)
502
+ throw new RemoteWorkspaceValidationError("Protocol value exceeds depth limit");
503
+ }
504
+ function validateRemoteWorkspaceScalar(value, limits) {
505
+ if (value === null || typeof value === "boolean")
506
+ return true;
507
+ if (typeof value === "number") {
508
+ if (!Number.isFinite(value))
509
+ throw new RemoteWorkspaceValidationError("Protocol numbers must be finite");
510
+ return true;
511
+ }
512
+ if (typeof value !== "string")
513
+ return false;
514
+ if (Buffer.byteLength(value, "utf8") > limits.maxStringBytes) {
515
+ throw new RemoteWorkspaceValidationError("Protocol string exceeds byte limit");
516
+ }
517
+ return true;
518
+ }
519
+ function enqueueRemoteWorkspaceArray(value, depth, state) {
520
+ if (value.length > state.limits.maxArrayLength) {
521
+ throw new RemoteWorkspaceValidationError("Protocol array exceeds item limit");
522
+ }
523
+ for (let index = value.length - 1; index >= 0; index--) {
524
+ state.pending.push({ value: value[index], depth: depth + 1 });
525
+ }
526
+ }
527
+ function enqueueRemoteWorkspaceObject(value, depth, state) {
528
+ if (value === null || typeof value !== "object")
529
+ throw new RemoteWorkspaceValidationError("Protocol values must be JSON-compatible");
530
+ const prototype = Object.getPrototypeOf(value);
531
+ if (prototype !== Object.prototype && prototype !== null) {
532
+ throw new RemoteWorkspaceValidationError("Protocol objects must be plain JSON objects");
533
+ }
534
+ const entries = Object.entries(value);
535
+ if (entries.length > state.limits.maxObjectKeys) {
536
+ throw new RemoteWorkspaceValidationError("Protocol object exceeds key limit");
537
+ }
538
+ state.objectKeys += entries.length;
539
+ if (state.objectKeys > state.limits.maxObjectKeys) {
540
+ throw new RemoteWorkspaceValidationError("Protocol value exceeds total key limit");
541
+ }
542
+ for (let index = entries.length - 1; index >= 0; index--) {
543
+ const entry = entries[index];
544
+ if (!entry)
545
+ continue;
546
+ if (Buffer.byteLength(entry[0], "utf8") > state.limits.maxStringBytes) {
547
+ throw new RemoteWorkspaceValidationError("Protocol object key exceeds byte limit");
548
+ }
549
+ state.pending.push({ value: entry[1], depth: depth + 1 });
550
+ }
551
+ }
552
+ export function assertRemoteWorkspaceJsonStructure(value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
553
+ const state = {
554
+ pending: [{ value, depth: 1 }],
555
+ nodes: 0,
556
+ objectKeys: 0,
557
+ limits,
558
+ };
559
+ while (state.pending.length > 0) {
560
+ const current = state.pending.pop();
561
+ if (!current)
562
+ break;
563
+ validateRemoteWorkspaceNodeBudget(current.depth, state);
564
+ if (validateRemoteWorkspaceScalar(current.value, limits))
565
+ continue;
566
+ if (Array.isArray(current.value)) {
567
+ enqueueRemoteWorkspaceArray(current.value, current.depth, state);
568
+ continue;
569
+ }
570
+ enqueueRemoteWorkspaceObject(current.value, current.depth, state);
571
+ }
572
+ }
573
+ export function decodeRemoteWorkspaceMessage(payload, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
574
+ const bytes = typeof payload === "string" ? Buffer.from(payload, "utf8") : payload;
575
+ if (bytes.byteLength > limits.maxMessageBytes) {
576
+ throw new RemoteWorkspaceValidationError("Protocol message exceeds byte limit");
577
+ }
578
+ const text = typeof payload === "string" ? payload : new TextDecoder("utf-8", { fatal: true }).decode(payload);
579
+ let value;
580
+ try {
581
+ value = JSON.parse(text);
582
+ }
583
+ catch (error) {
584
+ throw new RemoteWorkspaceValidationError(`Protocol message is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
585
+ }
586
+ assertRemoteWorkspaceJsonStructure(value, limits);
587
+ return value;
588
+ }
589
+ export function parseRemoteWorkspaceClientMessage(value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
590
+ assertRemoteWorkspaceJsonStructure(value, limits);
591
+ return parseWithValidator(clientMessageValidator, value, "client message");
592
+ }
593
+ export function parseRemoteWorkspaceServerMessage(value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
594
+ assertRemoteWorkspaceJsonStructure(value, limits);
595
+ return parseWithValidator(serverMessageValidator, value, "server message");
596
+ }
597
+ export function isRemoteWorkspaceMethod(method) {
598
+ return REMOTE_WORKSPACE_METHODS.includes(method);
599
+ }
600
+ export function parseRemoteWorkspaceRequestParams(method, value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
601
+ assertRemoteWorkspaceJsonStructure(value, limits);
602
+ const parsed = parseWithValidator(parameterValidators[method], value, `${method} params`);
603
+ if (method === "workspace.write") {
604
+ decodeCanonicalBase64(parsed.contentBase64, limits.maxMessageBytes);
605
+ }
606
+ return parsed;
607
+ }
608
+ export function parseRemoteWorkspaceResult(method, value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
609
+ assertRemoteWorkspaceJsonStructure(value, limits);
610
+ const validator = resultValidators[method];
611
+ const parsed = validator ? parseWithValidator(validator, value, `${method} result`) : value;
612
+ if (method === "workspace.read" || method === "resource.read") {
613
+ decodeCanonicalBase64(parsed.contentBase64, limits.maxMessageBytes);
614
+ }
615
+ return parsed;
616
+ }
617
+ export function parseRemoteWorkspaceToolResult(value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
618
+ assertRemoteWorkspaceJsonStructure(value, limits);
619
+ return parseWithValidator(Compile(ToolResultSchema), value, "tool result");
620
+ }
621
+ export function decodeCanonicalBase64(value, maxBytes) {
622
+ if (value.length % 4 !== 0 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value)) {
623
+ throw new RemoteWorkspaceValidationError("Transfer data is not canonical base64");
624
+ }
625
+ const decoded = Buffer.from(value, "base64");
626
+ if (decoded.byteLength > maxBytes)
627
+ throw new RemoteWorkspaceValidationError("Transfer chunk exceeds byte limit");
628
+ if (decoded.toString("base64") !== value) {
629
+ throw new RemoteWorkspaceValidationError("Transfer data is not canonical base64");
630
+ }
631
+ return decoded;
632
+ }
633
+ function canonicalJson(value) {
634
+ if (value === null)
635
+ return "null";
636
+ if (typeof value === "boolean")
637
+ return value ? "true" : "false";
638
+ if (typeof value === "number") {
639
+ if (!Number.isFinite(value))
640
+ throw new RemoteWorkspaceValidationError("Cannot hash a non-finite number");
641
+ return JSON.stringify(value);
642
+ }
643
+ if (typeof value === "string")
644
+ return JSON.stringify(value);
645
+ if (Array.isArray(value))
646
+ return `[${value.map((entry) => canonicalJson(entry)).join(",")}]`;
647
+ if (typeof value !== "object" || value === undefined) {
648
+ throw new RemoteWorkspaceValidationError("Cannot hash a non-JSON value");
649
+ }
650
+ const entries = Object.entries(value).sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));
651
+ return `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(",")}}`;
652
+ }
653
+ export function hashRemoteWorkspaceJson(value) {
654
+ assertRemoteWorkspaceJsonStructure(value);
655
+ return createHash("sha256").update(canonicalJson(value)).digest("hex");
656
+ }
657
+ export function hashRemoteWorkspaceCatalog(catalog) {
658
+ return hashRemoteWorkspaceJson(catalog);
659
+ }
660
+ function assertUnique(values, label) {
661
+ if (new Set(values).size !== values.length)
662
+ throw new RemoteWorkspaceValidationError(`${label} contains duplicates`);
663
+ }
664
+ export function validateRemoteWorkspaceCatalog(catalog) {
665
+ parseWithValidator(Compile(RemoteWorkspaceCatalogSchema), catalog, "tool catalog");
666
+ assertUnique(catalog.operations, "Catalog operations");
667
+ assertUnique(catalog.tools.map((tool) => tool.name), "Catalog tool names");
668
+ for (const tool of catalog.tools) {
669
+ assertUnique(tool.featureFlags, `Feature flags for ${tool.name}`);
670
+ if (hashRemoteWorkspaceJson(tool.parameterSchema) !== tool.schemaHash) {
671
+ throw new RemoteWorkspaceValidationError(`Schema hash mismatch for tool ${tool.name}`);
672
+ }
673
+ }
674
+ }
675
+ export function validateRemoteWorkspaceLocalToolSchemas(catalog, localToolSchemas) {
676
+ for (const tool of catalog.tools) {
677
+ const localHash = localToolSchemas.get(tool.name);
678
+ if (localHash !== undefined && localHash !== tool.schemaHash) {
679
+ throw new RemoteWorkspaceValidationError(`Remote schema does not match the local canonical schema for ${tool.name}`);
680
+ }
681
+ }
682
+ }
683
+ export function validateRemoteWorkspaceHandshakeAck(ack, offer, localToolSchemas = new Map()) {
684
+ const parsed = parseWithValidator(handshakeAckValidator, ack, "handshake response");
685
+ validateRemoteWorkspaceProtocolLimits(offer.receiveLimits);
686
+ validateRemoteWorkspaceProtocolLimits(parsed.limits);
687
+ const selected = offer.versions.some((range) => range.major === parsed.version.major &&
688
+ range.minMinor <= parsed.version.minor &&
689
+ range.maxMinor >= parsed.version.minor);
690
+ if (!selected)
691
+ throw new RemoteWorkspaceValidationError("Server selected a protocol version outside the offered range");
692
+ const offeredCapabilities = new Set([...offer.requiredCapabilities, ...offer.optionalCapabilities]);
693
+ for (const capability of parsed.capabilities) {
694
+ if (!offeredCapabilities.has(capability)) {
695
+ throw new RemoteWorkspaceValidationError(`Server selected an unoffered capability: ${capability}`);
696
+ }
697
+ }
698
+ const selectedCapabilities = new Set(parsed.capabilities);
699
+ for (const capability of offer.requiredCapabilities) {
700
+ if (!selectedCapabilities.has(capability)) {
701
+ throw new RemoteWorkspaceValidationError(`Server omitted required capability: ${capability}`);
702
+ }
703
+ }
704
+ assertUnique(parsed.capabilities, "Negotiated capabilities");
705
+ validateRemoteWorkspaceCatalog(parsed.catalog);
706
+ if (hashRemoteWorkspaceCatalog(parsed.catalog) !== parsed.catalogHash) {
707
+ throw new RemoteWorkspaceValidationError("Catalog hash does not match the negotiated catalog");
708
+ }
709
+ validateRemoteWorkspaceLocalToolSchemas(parsed.catalog, localToolSchemas);
710
+ for (const key of Object.keys(offer.receiveLimits)) {
711
+ if (parsed.limits[key] > offer.receiveLimits[key]) {
712
+ throw new RemoteWorkspaceValidationError(`Server increased negotiated limit: ${key}`);
713
+ }
714
+ }
715
+ return parsed;
716
+ }
717
+ export class RemoteWorkspaceNegotiationError extends Error {
718
+ code;
719
+ constructor(code, message) {
720
+ super(message);
721
+ this.name = "RemoteWorkspaceNegotiationError";
722
+ this.code = code;
723
+ }
724
+ }
725
+ function validateVersionRanges(ranges, label) {
726
+ for (const range of ranges) {
727
+ if (range.minMinor > range.maxMinor) {
728
+ throw new RemoteWorkspaceNegotiationError("incompatible_version", `${label} has an inverted minor range`);
729
+ }
730
+ }
731
+ }
732
+ function findCompatibleRemoteWorkspaceVersions(clientVersions, serverVersions) {
733
+ const serverVersionsByMajor = new Map();
734
+ for (const server of serverVersions) {
735
+ const ranges = serverVersionsByMajor.get(server.major) ?? [];
736
+ ranges.push(server);
737
+ serverVersionsByMajor.set(server.major, ranges);
738
+ }
739
+ const candidates = [];
740
+ for (const client of clientVersions) {
741
+ for (const server of serverVersionsByMajor.get(client.major) ?? []) {
742
+ const minMinor = Math.max(client.minMinor, server.minMinor);
743
+ const maxMinor = Math.min(client.maxMinor, server.maxMinor);
744
+ if (minMinor <= maxMinor)
745
+ candidates.push({ major: client.major, minor: maxMinor });
746
+ }
747
+ }
748
+ return candidates;
749
+ }
750
+ export function negotiateRemoteWorkspaceHandshake(handshake, options) {
751
+ validateRemoteWorkspaceProtocolLimits(handshake.receiveLimits);
752
+ validateRemoteWorkspaceProtocolLimits(options.serverLimits);
753
+ validateVersionRanges(handshake.versions, "Client version offer");
754
+ validateVersionRanges(options.serverVersions, "Server version offer");
755
+ assertUnique(handshake.requiredCapabilities, "Required capabilities");
756
+ assertUnique(handshake.optionalCapabilities, "Optional capabilities");
757
+ const optionalCapabilities = new Set(handshake.optionalCapabilities);
758
+ const duplicateOffer = handshake.requiredCapabilities.find((capability) => optionalCapabilities.has(capability));
759
+ if (duplicateOffer) {
760
+ throw new RemoteWorkspaceNegotiationError("capability_mismatch", `Capability is both required and optional: ${duplicateOffer}`);
761
+ }
762
+ const candidates = findCompatibleRemoteWorkspaceVersions(handshake.versions, options.serverVersions);
763
+ candidates.sort((left, right) => right.major - left.major || right.minor - left.minor);
764
+ const version = candidates[0];
765
+ if (!version) {
766
+ throw new RemoteWorkspaceNegotiationError("incompatible_version", "No compatible remote workspace protocol version");
767
+ }
768
+ const serverCapabilities = new Set(options.serverCapabilities);
769
+ for (const capability of handshake.requiredCapabilities) {
770
+ if (!serverCapabilities.has(capability)) {
771
+ throw new RemoteWorkspaceNegotiationError("capability_mismatch", `Server does not support required capability: ${capability}`);
772
+ }
773
+ }
774
+ const clientCapabilities = new Set([...handshake.requiredCapabilities, ...handshake.optionalCapabilities]);
775
+ for (const capability of options.requiredClientCapabilities ?? []) {
776
+ if (!clientCapabilities.has(capability)) {
777
+ throw new RemoteWorkspaceNegotiationError("capability_mismatch", `Client does not support required capability: ${capability}`);
778
+ }
779
+ }
780
+ const capabilities = Array.from(clientCapabilities)
781
+ .filter((capability) => serverCapabilities.has(capability))
782
+ .sort();
783
+ const clientLimits = handshake.receiveLimits;
784
+ const serverLimits = options.serverLimits;
785
+ return {
786
+ version,
787
+ capabilities,
788
+ limits: {
789
+ maxMessageBytes: Math.min(clientLimits.maxMessageBytes, serverLimits.maxMessageBytes),
790
+ maxStringBytes: Math.min(clientLimits.maxStringBytes, serverLimits.maxStringBytes),
791
+ maxDepth: Math.min(clientLimits.maxDepth, serverLimits.maxDepth),
792
+ maxObjectKeys: Math.min(clientLimits.maxObjectKeys, serverLimits.maxObjectKeys),
793
+ maxArrayLength: Math.min(clientLimits.maxArrayLength, serverLimits.maxArrayLength),
794
+ maxNodes: Math.min(clientLimits.maxNodes, serverLimits.maxNodes),
795
+ maxRequestMs: Math.min(clientLimits.maxRequestMs, serverLimits.maxRequestMs),
796
+ maxTransferChunkBytes: Math.min(clientLimits.maxTransferChunkBytes, serverLimits.maxTransferChunkBytes),
797
+ maxPendingTransferBytes: Math.min(clientLimits.maxPendingTransferBytes, serverLimits.maxPendingTransferBytes),
798
+ maxPendingInboundBytes: Math.min(clientLimits.maxPendingInboundBytes, serverLimits.maxPendingInboundBytes),
799
+ maxPendingInboundMessages: Math.min(clientLimits.maxPendingInboundMessages, serverLimits.maxPendingInboundMessages),
800
+ maxPendingOutboundBytes: Math.min(clientLimits.maxPendingOutboundBytes, serverLimits.maxPendingOutboundBytes),
801
+ maxPendingOutboundMessages: Math.min(clientLimits.maxPendingOutboundMessages, serverLimits.maxPendingOutboundMessages),
802
+ maxTransferBytes: Math.min(clientLimits.maxTransferBytes, serverLimits.maxTransferBytes),
803
+ maxTransferChunks: Math.min(clientLimits.maxTransferChunks, serverLimits.maxTransferChunks),
804
+ maxActiveRequests: Math.min(clientLimits.maxActiveRequests, serverLimits.maxActiveRequests),
805
+ maxActiveTransfers: Math.min(clientLimits.maxActiveTransfers, serverLimits.maxActiveTransfers),
806
+ maxCancellationMs: Math.min(clientLimits.maxCancellationMs, serverLimits.maxCancellationMs),
807
+ maxTransportSendMs: Math.min(clientLimits.maxTransportSendMs, serverLimits.maxTransportSendMs),
808
+ },
809
+ };
810
+ }
811
+ export function getRemoteWorkspaceMethodKind(method) {
812
+ switch (method) {
813
+ case "workspace.write":
814
+ case "workspace.mkdir":
815
+ case "transfer.upload":
816
+ return "mutation";
817
+ case "workspace.exec":
818
+ return "process";
819
+ case "tool.invoke":
820
+ return "service";
821
+ default:
822
+ return "read";
823
+ }
824
+ }
825
+ //# sourceMappingURL=contract.js.map