@tomsun28/pizza 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (382) hide show
  1. package/README.md +20 -143
  2. package/README.zh-CN.md +36 -0
  3. package/dist/bun/cli.d.ts +2 -0
  4. package/dist/bun/cli.js +6 -0
  5. package/dist/bun/register-bedrock.d.ts +1 -0
  6. package/dist/bun/register-bedrock.js +3 -0
  7. package/dist/cli/args.d.ts +48 -0
  8. package/dist/cli/args.js +330 -0
  9. package/dist/cli/config-selector.d.ts +13 -0
  10. package/dist/cli/config-selector.js +30 -0
  11. package/dist/cli/file-processor.d.ts +14 -0
  12. package/dist/cli/file-processor.js +82 -0
  13. package/dist/cli/initial-message.d.ts +17 -0
  14. package/dist/cli/initial-message.js +21 -0
  15. package/dist/cli/list-models.d.ts +8 -0
  16. package/dist/cli/list-models.js +96 -0
  17. package/dist/cli.d.ts +2 -0
  18. package/dist/cli.js +68 -0
  19. package/dist/config.d.ts +79 -0
  20. package/dist/config.js +223 -0
  21. package/dist/core/agent/index.d.ts +6 -0
  22. package/dist/core/agent/index.js +6 -0
  23. package/dist/core/agent/types.d.ts +202 -0
  24. package/dist/core/agent/types.js +51 -0
  25. package/dist/core/auth-storage.d.ts +135 -0
  26. package/dist/core/auth-storage.js +417 -0
  27. package/dist/core/bash-executor.d.ts +31 -0
  28. package/dist/core/bash-executor.js +107 -0
  29. package/dist/core/compaction/branch-summarization.d.ts +87 -0
  30. package/dist/core/compaction/branch-summarization.js +242 -0
  31. package/dist/core/compaction/compaction-engine.d.ts +40 -0
  32. package/dist/core/compaction/compaction-engine.js +292 -0
  33. package/dist/core/compaction/compaction.d.ts +106 -0
  34. package/dist/core/compaction/compaction.js +295 -0
  35. package/dist/core/compaction/index.d.ts +7 -0
  36. package/dist/core/compaction/index.js +7 -0
  37. package/dist/core/compaction/utils.d.ts +37 -0
  38. package/dist/core/compaction/utils.js +152 -0
  39. package/dist/core/defaults.d.ts +2 -0
  40. package/dist/core/defaults.js +1 -0
  41. package/dist/core/diagnostics.d.ts +14 -0
  42. package/dist/core/diagnostics.js +1 -0
  43. package/dist/core/event-bus.d.ts +8 -0
  44. package/dist/core/event-bus.js +24 -0
  45. package/dist/core/event-store/events.d.ts +465 -0
  46. package/dist/core/event-store/events.js +6 -0
  47. package/dist/core/event-store/index.d.ts +10 -0
  48. package/dist/core/event-store/index.js +10 -0
  49. package/dist/core/event-store/sqlite-store.d.ts +27 -0
  50. package/dist/core/event-store/sqlite-store.js +275 -0
  51. package/dist/core/event-store/store.d.ts +91 -0
  52. package/dist/core/event-store/store.js +7 -0
  53. package/dist/core/event-store/thread-scoped-store.d.ts +29 -0
  54. package/dist/core/event-store/thread-scoped-store.js +50 -0
  55. package/dist/core/event-store/types.d.ts +70 -0
  56. package/dist/core/event-store/types.js +7 -0
  57. package/dist/core/event-store/workspace.d.ts +37 -0
  58. package/dist/core/event-store/workspace.js +71 -0
  59. package/dist/core/exec.d.ts +28 -0
  60. package/dist/core/exec.js +74 -0
  61. package/dist/core/export-html/ansi-to-html.d.ts +21 -0
  62. package/dist/core/export-html/ansi-to-html.js +248 -0
  63. package/dist/core/export-html/index.d.ts +29 -0
  64. package/dist/core/export-html/index.js +186 -0
  65. package/dist/core/export-html/template.css +1017 -0
  66. package/dist/core/export-html/template.html +55 -0
  67. package/dist/core/export-html/template.js +1742 -0
  68. package/dist/core/export-html/tool-renderer.d.ts +39 -0
  69. package/dist/core/export-html/tool-renderer.js +94 -0
  70. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  71. package/dist/core/export-html/vendor/marked.min.js +6 -0
  72. package/dist/core/extensions/index.d.ts +12 -0
  73. package/dist/core/extensions/index.js +9 -0
  74. package/dist/core/extensions/loader.d.ts +24 -0
  75. package/dist/core/extensions/loader.js +492 -0
  76. package/dist/core/extensions/runner.d.ts +167 -0
  77. package/dist/core/extensions/runner.js +898 -0
  78. package/dist/core/extensions/session-context.d.ts +67 -0
  79. package/dist/core/extensions/session-context.js +272 -0
  80. package/dist/core/extensions/types.d.ts +1147 -0
  81. package/dist/core/extensions/types.js +44 -0
  82. package/dist/core/extensions/wrapper.d.ts +19 -0
  83. package/dist/core/extensions/wrapper.js +21 -0
  84. package/dist/core/footer-data-provider.d.ts +47 -0
  85. package/dist/core/footer-data-provider.js +321 -0
  86. package/dist/core/goal/index.d.ts +3 -0
  87. package/dist/core/goal/index.js +1 -0
  88. package/dist/core/goal/scheduler.d.ts +83 -0
  89. package/dist/core/goal/scheduler.js +154 -0
  90. package/dist/core/goal/types.d.ts +182 -0
  91. package/dist/core/goal/types.js +11 -0
  92. package/dist/core/index.d.ts +8 -0
  93. package/dist/core/index.js +8 -0
  94. package/dist/core/intent/classifier.d.ts +53 -0
  95. package/dist/core/intent/classifier.js +353 -0
  96. package/dist/core/intent/index.d.ts +8 -0
  97. package/dist/core/intent/index.js +8 -0
  98. package/dist/core/intent/tool-adapter.d.ts +31 -0
  99. package/dist/core/intent/tool-adapter.js +168 -0
  100. package/dist/core/intent/types.d.ts +71 -0
  101. package/dist/core/intent/types.js +6 -0
  102. package/dist/core/keybindings.d.ts +297 -0
  103. package/dist/core/keybindings.js +250 -0
  104. package/dist/core/messages.d.ts +30 -0
  105. package/dist/core/messages.js +134 -0
  106. package/dist/core/model-registry.d.ts +131 -0
  107. package/dist/core/model-registry.js +634 -0
  108. package/dist/core/model-resolver.d.ts +109 -0
  109. package/dist/core/model-resolver.js +486 -0
  110. package/dist/core/output-guard.d.ts +5 -0
  111. package/dist/core/output-guard.js +58 -0
  112. package/dist/core/package-manager.d.ts +196 -0
  113. package/dist/core/package-manager.js +1873 -0
  114. package/dist/core/projection/boundary-inferrer.d.ts +58 -0
  115. package/dist/core/projection/boundary-inferrer.js +122 -0
  116. package/dist/core/projection/event-to-message.d.ts +35 -0
  117. package/dist/core/projection/event-to-message.js +253 -0
  118. package/dist/core/projection/goal-projection.d.ts +67 -0
  119. package/dist/core/projection/goal-projection.js +339 -0
  120. package/dist/core/projection/index.d.ts +13 -0
  121. package/dist/core/projection/index.js +13 -0
  122. package/dist/core/projection/session-manager.d.ts +100 -0
  123. package/dist/core/projection/session-manager.js +331 -0
  124. package/dist/core/projection/session-projection.d.ts +58 -0
  125. package/dist/core/projection/session-projection.js +257 -0
  126. package/dist/core/projection/task-history.d.ts +13 -0
  127. package/dist/core/projection/task-history.js +61 -0
  128. package/dist/core/projection/timeline-projection.d.ts +82 -0
  129. package/dist/core/projection/timeline-projection.js +276 -0
  130. package/dist/core/projection/types.d.ts +69 -0
  131. package/dist/core/projection/types.js +6 -0
  132. package/dist/core/prompt-templates.d.ts +51 -0
  133. package/dist/core/prompt-templates.js +249 -0
  134. package/dist/core/resolve-config-value.d.ts +22 -0
  135. package/dist/core/resolve-config-value.js +125 -0
  136. package/dist/core/resource-loader.d.ts +193 -0
  137. package/dist/core/resource-loader.js +685 -0
  138. package/dist/core/runtime/ai-client.d.ts +12 -0
  139. package/dist/core/runtime/ai-client.js +153 -0
  140. package/dist/core/runtime/checkpoint.d.ts +12 -0
  141. package/dist/core/runtime/checkpoint.js +78 -0
  142. package/dist/core/runtime/index.d.ts +12 -0
  143. package/dist/core/runtime/index.js +12 -0
  144. package/dist/core/runtime/llm-types.d.ts +99 -0
  145. package/dist/core/runtime/llm-types.js +6 -0
  146. package/dist/core/runtime/local-runtime.d.ts +23 -0
  147. package/dist/core/runtime/local-runtime.js +59 -0
  148. package/dist/core/runtime/policies.d.ts +72 -0
  149. package/dist/core/runtime/policies.js +37 -0
  150. package/dist/core/runtime/reactor.d.ts +213 -0
  151. package/dist/core/runtime/reactor.js +992 -0
  152. package/dist/core/runtime/runtime.d.ts +191 -0
  153. package/dist/core/runtime/runtime.js +449 -0
  154. package/dist/core/runtime/types.d.ts +42 -0
  155. package/dist/core/runtime/types.js +1 -0
  156. package/dist/core/sdk.d.ts +12 -0
  157. package/dist/core/sdk.js +10 -0
  158. package/dist/core/session-context-builder.d.ts +9 -0
  159. package/dist/core/session-context-builder.js +87 -0
  160. package/dist/core/session-cwd.d.ts +18 -0
  161. package/dist/core/session-cwd.js +36 -0
  162. package/dist/core/session-facade-factory.d.ts +79 -0
  163. package/dist/core/session-facade-factory.js +460 -0
  164. package/dist/core/session-facade.d.ts +57 -0
  165. package/dist/core/session-facade.js +91 -0
  166. package/dist/core/session-listing.d.ts +30 -0
  167. package/dist/core/session-listing.js +168 -0
  168. package/dist/core/session-reader.d.ts +19 -0
  169. package/dist/core/session-reader.js +101 -0
  170. package/dist/core/session-ref.d.ts +7 -0
  171. package/dist/core/session-ref.js +25 -0
  172. package/dist/core/session-services.d.ts +51 -0
  173. package/dist/core/session-services.js +90 -0
  174. package/dist/core/session-stats.d.ts +43 -0
  175. package/dist/core/session-stats.js +41 -0
  176. package/dist/core/settings-manager.d.ts +236 -0
  177. package/dist/core/settings-manager.js +706 -0
  178. package/dist/core/skill-block-parser.d.ts +12 -0
  179. package/dist/core/skill-block-parser.js +15 -0
  180. package/dist/core/skills.d.ts +59 -0
  181. package/dist/core/skills.js +408 -0
  182. package/dist/core/slash-commands.d.ts +13 -0
  183. package/dist/core/slash-commands.js +17 -0
  184. package/dist/core/source-info.d.ts +17 -0
  185. package/dist/core/source-info.js +18 -0
  186. package/dist/core/system-prompt.d.ts +27 -0
  187. package/dist/core/system-prompt.js +179 -0
  188. package/dist/core/timings.d.ts +7 -0
  189. package/dist/core/timings.js +30 -0
  190. package/dist/core/tools/bash.d.ts +95 -0
  191. package/dist/core/tools/bash.js +513 -0
  192. package/dist/core/tools/builtin-commands.d.ts +75 -0
  193. package/dist/core/tools/builtin-commands.js +503 -0
  194. package/dist/core/tools/compat-commands.d.ts +12 -0
  195. package/dist/core/tools/compat-commands.js +1280 -0
  196. package/dist/core/tools/edit-diff.d.ts +59 -0
  197. package/dist/core/tools/edit-diff.js +263 -0
  198. package/dist/core/tools/edit.d.ts +49 -0
  199. package/dist/core/tools/edit.js +340 -0
  200. package/dist/core/tools/file-mutation-queue.d.ts +5 -0
  201. package/dist/core/tools/file-mutation-queue.js +36 -0
  202. package/dist/core/tools/find.d.ts +34 -0
  203. package/dist/core/tools/find.js +459 -0
  204. package/dist/core/tools/grep.d.ts +36 -0
  205. package/dist/core/tools/grep.js +422 -0
  206. package/dist/core/tools/index.d.ts +70 -0
  207. package/dist/core/tools/index.js +129 -0
  208. package/dist/core/tools/line-anchors.d.ts +33 -0
  209. package/dist/core/tools/line-anchors.js +151 -0
  210. package/dist/core/tools/ls.d.ts +36 -0
  211. package/dist/core/tools/ls.js +268 -0
  212. package/dist/core/tools/path-utils.d.ts +7 -0
  213. package/dist/core/tools/path-utils.js +80 -0
  214. package/dist/core/tools/read.d.ts +35 -0
  215. package/dist/core/tools/read.js +244 -0
  216. package/dist/core/tools/render-utils.d.ts +20 -0
  217. package/dist/core/tools/render-utils.js +48 -0
  218. package/dist/core/tools/session-split.d.ts +9 -0
  219. package/dist/core/tools/session-split.js +77 -0
  220. package/dist/core/tools/tool-definition-wrapper.d.ts +13 -0
  221. package/dist/core/tools/tool-definition-wrapper.js +32 -0
  222. package/dist/core/tools/truncate.d.ts +69 -0
  223. package/dist/core/tools/truncate.js +204 -0
  224. package/dist/core/tools/write.d.ts +25 -0
  225. package/dist/core/tools/write.js +211 -0
  226. package/dist/core/types/session-types.d.ts +123 -0
  227. package/dist/core/types/session-types.js +8 -0
  228. package/dist/index.d.ts +27 -0
  229. package/dist/index.js +38 -0
  230. package/dist/main.d.ts +11 -2
  231. package/dist/main.js +577 -149
  232. package/dist/modes/event-mapper.d.ts +115 -0
  233. package/dist/modes/event-mapper.js +200 -0
  234. package/dist/modes/gui/server.d.ts +14 -0
  235. package/dist/modes/gui/server.js +1032 -0
  236. package/dist/modes/index.d.ts +10 -0
  237. package/dist/modes/index.js +9 -0
  238. package/dist/modes/interactive/assets/clankolas.png +0 -0
  239. package/dist/modes/interactive/components/armin.d.ts +33 -0
  240. package/dist/modes/interactive/components/armin.js +328 -0
  241. package/dist/modes/interactive/components/assistant-message.d.ts +19 -0
  242. package/dist/modes/interactive/components/assistant-message.js +115 -0
  243. package/dist/modes/interactive/components/bash-execution.d.ts +33 -0
  244. package/dist/modes/interactive/components/bash-execution.js +169 -0
  245. package/dist/modes/interactive/components/bordered-loader.d.ts +15 -0
  246. package/dist/modes/interactive/components/bordered-loader.js +50 -0
  247. package/dist/modes/interactive/components/branch-summary-message.d.ts +15 -0
  248. package/dist/modes/interactive/components/branch-summary-message.js +41 -0
  249. package/dist/modes/interactive/components/brand-header.d.ts +33 -0
  250. package/dist/modes/interactive/components/brand-header.js +235 -0
  251. package/dist/modes/interactive/components/compaction-summary-message.d.ts +15 -0
  252. package/dist/modes/interactive/components/compaction-summary-message.js +42 -0
  253. package/dist/modes/interactive/components/config-selector.d.ts +70 -0
  254. package/dist/modes/interactive/components/config-selector.js +469 -0
  255. package/dist/modes/interactive/components/countdown-timer.d.ts +13 -0
  256. package/dist/modes/interactive/components/countdown-timer.js +27 -0
  257. package/dist/modes/interactive/components/custom-editor.d.ts +27 -0
  258. package/dist/modes/interactive/components/custom-editor.js +94 -0
  259. package/dist/modes/interactive/components/custom-message.d.ts +19 -0
  260. package/dist/modes/interactive/components/custom-message.js +73 -0
  261. package/dist/modes/interactive/components/daxnuts.d.ts +22 -0
  262. package/dist/modes/interactive/components/daxnuts.js +137 -0
  263. package/dist/modes/interactive/components/diff.d.ts +11 -0
  264. package/dist/modes/interactive/components/diff.js +132 -0
  265. package/dist/modes/interactive/components/dynamic-border.d.ts +14 -0
  266. package/dist/modes/interactive/components/dynamic-border.js +19 -0
  267. package/dist/modes/interactive/components/earendil-announcement.d.ts +4 -0
  268. package/dist/modes/interactive/components/earendil-announcement.js +39 -0
  269. package/dist/modes/interactive/components/extension-editor.d.ts +19 -0
  270. package/dist/modes/interactive/components/extension-editor.js +105 -0
  271. package/dist/modes/interactive/components/extension-input.d.ts +22 -0
  272. package/dist/modes/interactive/components/extension-input.js +54 -0
  273. package/dist/modes/interactive/components/extension-selector.d.ts +23 -0
  274. package/dist/modes/interactive/components/extension-selector.js +70 -0
  275. package/dist/modes/interactive/components/footer.d.ts +55 -0
  276. package/dist/modes/interactive/components/footer.js +207 -0
  277. package/dist/modes/interactive/components/index.d.ts +31 -0
  278. package/dist/modes/interactive/components/index.js +32 -0
  279. package/dist/modes/interactive/components/keybinding-hints.d.ts +7 -0
  280. package/dist/modes/interactive/components/keybinding-hints.js +21 -0
  281. package/dist/modes/interactive/components/login-dialog.d.ts +41 -0
  282. package/dist/modes/interactive/components/login-dialog.js +138 -0
  283. package/dist/modes/interactive/components/model-selector.d.ts +32 -0
  284. package/dist/modes/interactive/components/model-selector.js +209 -0
  285. package/dist/modes/interactive/components/oauth-selector.d.ts +18 -0
  286. package/dist/modes/interactive/components/oauth-selector.js +91 -0
  287. package/dist/modes/interactive/components/settings-selector.d.ts +57 -0
  288. package/dist/modes/interactive/components/settings-selector.js +299 -0
  289. package/dist/modes/interactive/components/show-images-selector.d.ts +9 -0
  290. package/dist/modes/interactive/components/show-images-selector.js +37 -0
  291. package/dist/modes/interactive/components/skill-invocation-message.d.ts +16 -0
  292. package/dist/modes/interactive/components/skill-invocation-message.js +44 -0
  293. package/dist/modes/interactive/components/theme-selector.d.ts +10 -0
  294. package/dist/modes/interactive/components/theme-selector.js +47 -0
  295. package/dist/modes/interactive/components/thinking-selector.d.ts +10 -0
  296. package/dist/modes/interactive/components/thinking-selector.js +50 -0
  297. package/dist/modes/interactive/components/timeline-view.d.ts +31 -0
  298. package/dist/modes/interactive/components/timeline-view.js +81 -0
  299. package/dist/modes/interactive/components/tool-execution.d.ts +64 -0
  300. package/dist/modes/interactive/components/tool-execution.js +305 -0
  301. package/dist/modes/interactive/components/tree-selector.d.ts +88 -0
  302. package/dist/modes/interactive/components/tree-selector.js +1072 -0
  303. package/dist/modes/interactive/components/user-message-selector.d.ts +29 -0
  304. package/dist/modes/interactive/components/user-message-selector.js +110 -0
  305. package/dist/modes/interactive/components/user-message.d.ts +9 -0
  306. package/dist/modes/interactive/components/user-message.js +27 -0
  307. package/dist/modes/interactive/components/visual-truncate.d.ts +23 -0
  308. package/dist/modes/interactive/components/visual-truncate.js +32 -0
  309. package/dist/modes/interactive/interactive-mode.d.ts +394 -0
  310. package/dist/modes/interactive/interactive-mode.js +4116 -0
  311. package/dist/modes/interactive/theme/dark.json +85 -0
  312. package/dist/modes/interactive/theme/light.json +84 -0
  313. package/dist/modes/interactive/theme/theme-schema.json +335 -0
  314. package/dist/modes/interactive/theme/theme.d.ts +80 -0
  315. package/dist/modes/interactive/theme/theme.js +973 -0
  316. package/dist/modes/print-mode.d.ts +27 -0
  317. package/dist/modes/print-mode.js +102 -0
  318. package/dist/modes/rpc/jsonl.d.ts +16 -0
  319. package/dist/modes/rpc/jsonl.js +48 -0
  320. package/dist/modes/rpc/rpc-client.d.ts +219 -0
  321. package/dist/modes/rpc/rpc-client.js +405 -0
  322. package/dist/modes/rpc/rpc-mode.d.ts +19 -0
  323. package/dist/modes/rpc/rpc-mode.js +381 -0
  324. package/dist/modes/rpc/rpc-types.d.ts +406 -0
  325. package/dist/modes/rpc/rpc-types.js +7 -0
  326. package/dist/package-manager-cli.d.ts +3 -0
  327. package/dist/package-manager-cli.js +233 -0
  328. package/dist/utils/changelog.d.ts +20 -0
  329. package/dist/utils/changelog.js +86 -0
  330. package/dist/utils/child-process.d.ts +10 -0
  331. package/dist/utils/child-process.js +77 -0
  332. package/dist/utils/clipboard-image.d.ts +10 -0
  333. package/dist/utils/clipboard-image.js +244 -0
  334. package/dist/utils/clipboard-native.d.ts +7 -0
  335. package/dist/utils/clipboard-native.js +13 -0
  336. package/dist/utils/clipboard.d.ts +1 -0
  337. package/dist/utils/clipboard.js +77 -0
  338. package/dist/utils/exif-orientation.d.ts +4 -0
  339. package/dist/utils/exif-orientation.js +157 -0
  340. package/dist/utils/frontmatter.d.ts +7 -0
  341. package/dist/utils/frontmatter.js +25 -0
  342. package/dist/utils/git.d.ts +25 -0
  343. package/dist/utils/git.js +162 -0
  344. package/dist/utils/image-convert.d.ts +8 -0
  345. package/dist/utils/image-convert.js +38 -0
  346. package/dist/utils/image-resize.d.ts +35 -0
  347. package/dist/utils/image-resize.js +136 -0
  348. package/dist/utils/mime.d.ts +1 -0
  349. package/dist/utils/mime.js +25 -0
  350. package/dist/utils/path-shims.d.ts +1 -0
  351. package/dist/utils/path-shims.js +90 -0
  352. package/dist/utils/paths.d.ts +6 -0
  353. package/dist/utils/paths.js +18 -0
  354. package/dist/utils/photon.d.ts +20 -0
  355. package/dist/utils/photon.js +120 -0
  356. package/dist/utils/shell.d.ts +29 -0
  357. package/dist/utils/shell.js +189 -0
  358. package/dist/utils/sleep.d.ts +4 -0
  359. package/dist/utils/sleep.js +16 -0
  360. package/dist/utils/tools-manager.d.ts +3 -0
  361. package/dist/utils/tools-manager.js +101 -0
  362. package/dist/vendor/bin/darwin-arm64/fd +0 -0
  363. package/dist/vendor/bin/darwin-arm64/rg +0 -0
  364. package/dist/vendor/bin/darwin-x64/fd +0 -0
  365. package/dist/vendor/bin/darwin-x64/rg +0 -0
  366. package/dist/vendor/bin/linux-arm64/fd +0 -0
  367. package/dist/vendor/bin/linux-arm64/rg +0 -0
  368. package/dist/vendor/bin/linux-x64/fd +0 -0
  369. package/dist/vendor/bin/linux-x64/rg +0 -0
  370. package/dist/vendor/bin/win32-arm64/fd.exe +0 -0
  371. package/dist/vendor/bin/win32-arm64/rg.exe +0 -0
  372. package/dist/vendor/bin/win32-x64/fd.exe +0 -0
  373. package/dist/vendor/bin/win32-x64/rg.exe +0 -0
  374. package/package.json +90 -26
  375. package/dist/extension/core.d.ts +0 -69
  376. package/dist/extension/core.js +0 -270
  377. package/dist/extension/core.js.map +0 -1
  378. package/dist/extension/index.d.ts +0 -14
  379. package/dist/extension/index.js +0 -374
  380. package/dist/extension/index.js.map +0 -1
  381. package/dist/main.js.map +0 -1
  382. package/themes/pizza.json +0 -87
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Extension system types.
3
+ *
4
+ * Extensions are TypeScript modules that can:
5
+ * - Subscribe to agent lifecycle events
6
+ * - Register LLM-callable tools
7
+ * - Register commands, keyboard shortcuts, and CLI flags
8
+ * - Interact with the user via UI primitives
9
+ */
10
+ /**
11
+ * Preserve parameter inference for standalone tool definitions.
12
+ *
13
+ * Use this when assigning a tool to a variable or passing it through arrays such
14
+ * as `customTools`, where contextual typing would otherwise widen params to
15
+ * `unknown`.
16
+ */
17
+ export function defineTool(tool) {
18
+ return tool;
19
+ }
20
+ // Type guards for ToolResultEvent
21
+ export function isBashToolResult(e) {
22
+ return e.toolName === "bash";
23
+ }
24
+ export function isReadToolResult(e) {
25
+ return e.toolName === "read";
26
+ }
27
+ export function isEditToolResult(e) {
28
+ return e.toolName === "edit";
29
+ }
30
+ export function isWriteToolResult(e) {
31
+ return e.toolName === "write";
32
+ }
33
+ export function isGrepToolResult(e) {
34
+ return e.toolName === "grep";
35
+ }
36
+ export function isFindToolResult(e) {
37
+ return e.toolName === "find";
38
+ }
39
+ export function isLsToolResult(e) {
40
+ return e.toolName === "ls";
41
+ }
42
+ export function isToolCallEventType(toolName, event) {
43
+ return event.toolName === toolName;
44
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Tool wrappers for extension-registered tools.
3
+ *
4
+ * These wrappers only adapt tool execution so extension tools receive the runner context.
5
+ * Tool call and tool result interception is handled by the reactor via hooks.
6
+ */
7
+ import type { AgentTool } from "../agent/types.js";
8
+ import type { ExtensionRunner } from "./runner.js";
9
+ import type { RegisteredTool } from "./types.js";
10
+ /**
11
+ * Wrap a RegisteredTool into an AgentTool.
12
+ * Uses the runner's createContext() for consistent context across tools and event handlers.
13
+ */
14
+ export declare function wrapRegisteredTool(registeredTool: RegisteredTool, runner: ExtensionRunner): AgentTool;
15
+ /**
16
+ * Wrap all registered tools into AgentTools.
17
+ * Uses the runner's createContext() for consistent context across tools and event handlers.
18
+ */
19
+ export declare function wrapRegisteredTools(registeredTools: RegisteredTool[], runner: ExtensionRunner): AgentTool[];
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Tool wrappers for extension-registered tools.
3
+ *
4
+ * These wrappers only adapt tool execution so extension tools receive the runner context.
5
+ * Tool call and tool result interception is handled by the reactor via hooks.
6
+ */
7
+ import { wrapToolDefinition, wrapToolDefinitions } from "../tools/tool-definition-wrapper.js";
8
+ /**
9
+ * Wrap a RegisteredTool into an AgentTool.
10
+ * Uses the runner's createContext() for consistent context across tools and event handlers.
11
+ */
12
+ export function wrapRegisteredTool(registeredTool, runner) {
13
+ return wrapToolDefinition(registeredTool.definition, () => runner.createContext());
14
+ }
15
+ /**
16
+ * Wrap all registered tools into AgentTools.
17
+ * Uses the runner's createContext() for consistent context across tools and event handlers.
18
+ */
19
+ export function wrapRegisteredTools(registeredTools, runner) {
20
+ return wrapToolDefinitions(registeredTools.map((registeredTool) => registeredTool.definition), () => runner.createContext());
21
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Provides git branch and extension statuses - data not otherwise accessible to extensions.
3
+ * Token stats, model info available via ctx.sessionManager and ctx.model.
4
+ */
5
+ export declare class FooterDataProvider {
6
+ private cwd;
7
+ private static readonly WATCH_DEBOUNCE_MS;
8
+ private extensionStatuses;
9
+ private cachedBranch;
10
+ private gitPaths;
11
+ private headWatcher;
12
+ private reftableWatcher;
13
+ private reftableTablesListWatcher;
14
+ private reftableTablesListPath;
15
+ private branchChangeCallbacks;
16
+ private availableProviderCount;
17
+ private refreshTimer;
18
+ private refreshInFlight;
19
+ private refreshPending;
20
+ private disposed;
21
+ constructor(cwd: string);
22
+ /** Current git branch, null if not in repo, "detached" if detached HEAD */
23
+ getGitBranch(): string | null;
24
+ /** Extension status texts set via ctx.ui.setStatus() */
25
+ getExtensionStatuses(): ReadonlyMap<string, string>;
26
+ /** Subscribe to git branch changes. Returns unsubscribe function. */
27
+ onBranchChange(callback: () => void): () => void;
28
+ /** Internal: set extension status */
29
+ setExtensionStatus(key: string, text: string | undefined): void;
30
+ /** Internal: clear extension statuses */
31
+ clearExtensionStatuses(): void;
32
+ /** Number of unique providers with available models (for footer display) */
33
+ getAvailableProviderCount(): number;
34
+ /** Internal: update available provider count */
35
+ setAvailableProviderCount(count: number): void;
36
+ setCwd(cwd: string): void;
37
+ /** Internal: cleanup */
38
+ dispose(): void;
39
+ private notifyBranchChange;
40
+ private scheduleRefresh;
41
+ private refreshGitBranchAsync;
42
+ private resolveGitBranchSync;
43
+ private resolveGitBranchAsync;
44
+ private setupGitWatcher;
45
+ }
46
+ /** Read-only view for extensions - excludes setExtensionStatus, setAvailableProviderCount and dispose */
47
+ export type ReadonlyFooterDataProvider = Pick<FooterDataProvider, "getGitBranch" | "getExtensionStatuses" | "getAvailableProviderCount" | "onBranchChange">;
@@ -0,0 +1,321 @@
1
+ import { execFile, spawnSync } from "child_process";
2
+ import { existsSync, readFileSync, statSync, unwatchFile, watch, watchFile } from "fs";
3
+ import { dirname, join, resolve } from "path";
4
+ /**
5
+ * Find git metadata paths by walking up from cwd.
6
+ * Handles both regular git repos (.git is a directory) and worktrees (.git is a file).
7
+ */
8
+ function findGitPaths(cwd) {
9
+ let dir = cwd;
10
+ while (true) {
11
+ const gitPath = join(dir, ".git");
12
+ if (existsSync(gitPath)) {
13
+ try {
14
+ const stat = statSync(gitPath);
15
+ if (stat.isFile()) {
16
+ const content = readFileSync(gitPath, "utf8").trim();
17
+ if (content.startsWith("gitdir: ")) {
18
+ const gitDir = resolve(dir, content.slice(8).trim());
19
+ const headPath = join(gitDir, "HEAD");
20
+ if (!existsSync(headPath))
21
+ return null;
22
+ const commonDirPath = join(gitDir, "commondir");
23
+ const commonGitDir = existsSync(commonDirPath)
24
+ ? resolve(gitDir, readFileSync(commonDirPath, "utf8").trim())
25
+ : gitDir;
26
+ return { repoDir: dir, commonGitDir, headPath };
27
+ }
28
+ }
29
+ else if (stat.isDirectory()) {
30
+ const headPath = join(gitPath, "HEAD");
31
+ if (!existsSync(headPath))
32
+ return null;
33
+ return { repoDir: dir, commonGitDir: gitPath, headPath };
34
+ }
35
+ }
36
+ catch {
37
+ return null;
38
+ }
39
+ }
40
+ const parent = dirname(dir);
41
+ if (parent === dir)
42
+ return null;
43
+ dir = parent;
44
+ }
45
+ }
46
+ /** Ask git for the current branch. Returns null on detached HEAD or if git is unavailable. */
47
+ function resolveBranchWithGitSync(repoDir) {
48
+ const result = spawnSync("git", ["--no-optional-locks", "symbolic-ref", "--quiet", "--short", "HEAD"], {
49
+ cwd: repoDir,
50
+ encoding: "utf8",
51
+ stdio: ["ignore", "pipe", "ignore"],
52
+ });
53
+ const branch = result.status === 0 ? result.stdout.trim() : "";
54
+ return branch || null;
55
+ }
56
+ /** Ask git for the current branch asynchronously. Returns null on detached HEAD or if git is unavailable. */
57
+ function resolveBranchWithGitAsync(repoDir) {
58
+ return new Promise((resolvePromise) => {
59
+ execFile("git", ["--no-optional-locks", "symbolic-ref", "--quiet", "--short", "HEAD"], {
60
+ cwd: repoDir,
61
+ encoding: "utf8",
62
+ }, (error, stdout) => {
63
+ if (error) {
64
+ resolvePromise(null);
65
+ return;
66
+ }
67
+ const branch = stdout.trim();
68
+ resolvePromise(branch || null);
69
+ });
70
+ });
71
+ }
72
+ function closeOnWatchError(watcher) {
73
+ watcher.on("error", () => {
74
+ try {
75
+ watcher.close();
76
+ }
77
+ catch { }
78
+ });
79
+ return watcher;
80
+ }
81
+ /**
82
+ * Provides git branch and extension statuses - data not otherwise accessible to extensions.
83
+ * Token stats, model info available via ctx.sessionManager and ctx.model.
84
+ */
85
+ export class FooterDataProvider {
86
+ static { this.WATCH_DEBOUNCE_MS = 500; }
87
+ constructor(cwd) {
88
+ this.extensionStatuses = new Map();
89
+ this.cachedBranch = undefined;
90
+ this.gitPaths = undefined;
91
+ this.headWatcher = null;
92
+ this.reftableWatcher = null;
93
+ this.reftableTablesListWatcher = null;
94
+ this.reftableTablesListPath = null;
95
+ this.branchChangeCallbacks = new Set();
96
+ this.availableProviderCount = 0;
97
+ this.refreshTimer = null;
98
+ this.refreshInFlight = false;
99
+ this.refreshPending = false;
100
+ this.disposed = false;
101
+ this.cwd = cwd;
102
+ this.gitPaths = findGitPaths(cwd);
103
+ this.setupGitWatcher();
104
+ }
105
+ /** Current git branch, null if not in repo, "detached" if detached HEAD */
106
+ getGitBranch() {
107
+ if (this.cachedBranch === undefined) {
108
+ this.cachedBranch = this.resolveGitBranchSync();
109
+ }
110
+ return this.cachedBranch;
111
+ }
112
+ /** Extension status texts set via ctx.ui.setStatus() */
113
+ getExtensionStatuses() {
114
+ return this.extensionStatuses;
115
+ }
116
+ /** Subscribe to git branch changes. Returns unsubscribe function. */
117
+ onBranchChange(callback) {
118
+ this.branchChangeCallbacks.add(callback);
119
+ return () => this.branchChangeCallbacks.delete(callback);
120
+ }
121
+ /** Internal: set extension status */
122
+ setExtensionStatus(key, text) {
123
+ if (text === undefined) {
124
+ this.extensionStatuses.delete(key);
125
+ }
126
+ else {
127
+ this.extensionStatuses.set(key, text);
128
+ }
129
+ }
130
+ /** Internal: clear extension statuses */
131
+ clearExtensionStatuses() {
132
+ this.extensionStatuses.clear();
133
+ }
134
+ /** Number of unique providers with available models (for footer display) */
135
+ getAvailableProviderCount() {
136
+ return this.availableProviderCount;
137
+ }
138
+ /** Internal: update available provider count */
139
+ setAvailableProviderCount(count) {
140
+ this.availableProviderCount = count;
141
+ }
142
+ setCwd(cwd) {
143
+ if (this.cwd === cwd) {
144
+ return;
145
+ }
146
+ this.cwd = cwd;
147
+ if (this.refreshTimer) {
148
+ clearTimeout(this.refreshTimer);
149
+ this.refreshTimer = null;
150
+ }
151
+ if (this.headWatcher) {
152
+ this.headWatcher.close();
153
+ this.headWatcher = null;
154
+ }
155
+ if (this.reftableWatcher) {
156
+ this.reftableWatcher.close();
157
+ this.reftableWatcher = null;
158
+ }
159
+ if (this.reftableTablesListWatcher) {
160
+ this.reftableTablesListWatcher.close();
161
+ this.reftableTablesListWatcher = null;
162
+ }
163
+ if (this.reftableTablesListPath) {
164
+ unwatchFile(this.reftableTablesListPath);
165
+ this.reftableTablesListPath = null;
166
+ }
167
+ this.cachedBranch = undefined;
168
+ this.gitPaths = findGitPaths(cwd);
169
+ this.setupGitWatcher();
170
+ this.notifyBranchChange();
171
+ }
172
+ /** Internal: cleanup */
173
+ dispose() {
174
+ this.disposed = true;
175
+ if (this.refreshTimer) {
176
+ clearTimeout(this.refreshTimer);
177
+ this.refreshTimer = null;
178
+ }
179
+ if (this.headWatcher) {
180
+ this.headWatcher.close();
181
+ this.headWatcher = null;
182
+ }
183
+ if (this.reftableWatcher) {
184
+ this.reftableWatcher.close();
185
+ this.reftableWatcher = null;
186
+ }
187
+ if (this.reftableTablesListWatcher) {
188
+ this.reftableTablesListWatcher.close();
189
+ this.reftableTablesListWatcher = null;
190
+ }
191
+ if (this.reftableTablesListPath) {
192
+ unwatchFile(this.reftableTablesListPath);
193
+ this.reftableTablesListPath = null;
194
+ }
195
+ this.branchChangeCallbacks.clear();
196
+ }
197
+ notifyBranchChange() {
198
+ for (const cb of this.branchChangeCallbacks)
199
+ cb();
200
+ }
201
+ scheduleRefresh() {
202
+ if (this.disposed || this.refreshTimer)
203
+ return;
204
+ if (this.refreshInFlight) {
205
+ this.refreshPending = true;
206
+ return;
207
+ }
208
+ this.refreshTimer = setTimeout(() => {
209
+ this.refreshTimer = null;
210
+ void this.refreshGitBranchAsync();
211
+ }, FooterDataProvider.WATCH_DEBOUNCE_MS);
212
+ }
213
+ async refreshGitBranchAsync() {
214
+ if (this.disposed)
215
+ return;
216
+ if (this.refreshInFlight) {
217
+ this.refreshPending = true;
218
+ return;
219
+ }
220
+ this.refreshInFlight = true;
221
+ try {
222
+ const nextBranch = await this.resolveGitBranchAsync();
223
+ if (this.disposed)
224
+ return;
225
+ if (this.cachedBranch !== undefined && this.cachedBranch !== nextBranch) {
226
+ this.cachedBranch = nextBranch;
227
+ this.notifyBranchChange();
228
+ return;
229
+ }
230
+ this.cachedBranch = nextBranch;
231
+ }
232
+ finally {
233
+ this.refreshInFlight = false;
234
+ if (this.refreshPending && !this.disposed) {
235
+ this.refreshPending = false;
236
+ this.scheduleRefresh();
237
+ }
238
+ }
239
+ }
240
+ resolveGitBranchSync() {
241
+ try {
242
+ if (!this.gitPaths)
243
+ return null;
244
+ const content = readFileSync(this.gitPaths.headPath, "utf8").trim();
245
+ if (content.startsWith("ref: refs/heads/")) {
246
+ const branch = content.slice(16);
247
+ return branch === ".invalid" ? (resolveBranchWithGitSync(this.gitPaths.repoDir) ?? "detached") : branch;
248
+ }
249
+ return "detached";
250
+ }
251
+ catch {
252
+ return null;
253
+ }
254
+ }
255
+ async resolveGitBranchAsync() {
256
+ try {
257
+ if (!this.gitPaths)
258
+ return null;
259
+ const content = readFileSync(this.gitPaths.headPath, "utf8").trim();
260
+ if (content.startsWith("ref: refs/heads/")) {
261
+ const branch = content.slice(16);
262
+ return branch === ".invalid"
263
+ ? ((await resolveBranchWithGitAsync(this.gitPaths.repoDir)) ?? "detached")
264
+ : branch;
265
+ }
266
+ return "detached";
267
+ }
268
+ catch {
269
+ return null;
270
+ }
271
+ }
272
+ setupGitWatcher() {
273
+ if (!this.gitPaths)
274
+ return;
275
+ // Watch the directory containing HEAD, not HEAD itself.
276
+ // Git uses atomic writes (write temp, rename over HEAD), which changes the inode.
277
+ // fs.watch on a file stops working after the inode changes.
278
+ try {
279
+ this.headWatcher = closeOnWatchError(watch(dirname(this.gitPaths.headPath), (_eventType, filename) => {
280
+ if (!filename || filename.toString() === "HEAD") {
281
+ this.scheduleRefresh();
282
+ }
283
+ }));
284
+ }
285
+ catch {
286
+ // Silently fail if we can't watch
287
+ }
288
+ // In reftable repos, branch switches update files in the reftable directory
289
+ // instead of HEAD. Watch it separately so the footer picks up those changes.
290
+ const reftableDir = join(this.gitPaths.commonGitDir, "reftable");
291
+ if (existsSync(reftableDir)) {
292
+ try {
293
+ this.reftableWatcher = closeOnWatchError(watch(reftableDir, () => {
294
+ this.scheduleRefresh();
295
+ }));
296
+ }
297
+ catch {
298
+ // Silently fail if we can't watch
299
+ }
300
+ const tablesListPath = join(reftableDir, "tables.list");
301
+ if (existsSync(tablesListPath)) {
302
+ this.reftableTablesListPath = tablesListPath;
303
+ try {
304
+ this.reftableTablesListWatcher = closeOnWatchError(watch(tablesListPath, () => {
305
+ this.scheduleRefresh();
306
+ }));
307
+ }
308
+ catch {
309
+ // Silently fail if we can't watch
310
+ }
311
+ watchFile(tablesListPath, { interval: 250 }, (current, previous) => {
312
+ if (current.mtimeMs !== previous.mtimeMs ||
313
+ current.ctimeMs !== previous.ctimeMs ||
314
+ current.size !== previous.size) {
315
+ this.scheduleRefresh();
316
+ }
317
+ });
318
+ }
319
+ }
320
+ }
321
+ }
@@ -0,0 +1,3 @@
1
+ export type { GoalStatus, GoalClassification, GoalPhase, GoalDescriptor, TaskStatus, TaskPriority, AgentRole, TaskDescriptor, GoalCreatedPayload, GoalClassifiedPayload, GoalPlannedPayload, GoalLifecyclePayload, GoalCompletedPayload, GoalCancelledPayload, TaskCreatedPayload, TaskAssignedPayload, TaskStartedPayload, TaskProgressPayload, TaskCompletedPayload, TaskFailedPayload, TaskReworkPayload, TaskAcceptedPayload, TaskCancelledPayload, } from "./types.js";
2
+ export { GoalScheduler, DefaultSchedulingPolicy } from "./scheduler.js";
3
+ export type { SchedulingPolicy, SchedulingContext, TaskAssignment, GoalSchedulerOptions } from "./scheduler.js";
@@ -0,0 +1 @@
1
+ export { GoalScheduler, DefaultSchedulingPolicy } from "./scheduler.js";
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Goal Scheduler
3
+ *
4
+ * Watches the EventStore for task completions and automatically
5
+ * dispatches the next ready tasks. A lightweight scheduler that
6
+ * does NOT execute tasks itself — it only emits TASK_ASSIGNED events
7
+ * for ready tasks, and the runtime decides how to execute them.
8
+ *
9
+ * Design principle: the scheduler is a projection + policy.
10
+ * It reads events to understand state, applies a scheduling policy,
11
+ * and emits new events to drive execution.
12
+ */
13
+ import type { EventStore } from "../event-store/store.js";
14
+ import type { AgentRole, GoalDescriptor, TaskDescriptor } from "./types.js";
15
+ /** Scheduling policy — decides which tasks to dispatch and in what order */
16
+ export interface SchedulingPolicy {
17
+ /** Select which ready tasks to assign, and to whom */
18
+ selectTasks(readyTasks: TaskDescriptor[], goal: GoalDescriptor, context: SchedulingContext): TaskAssignment[];
19
+ }
20
+ /** Context available to the scheduling policy */
21
+ export interface SchedulingContext {
22
+ /** All tasks in the goal */
23
+ allTasks: TaskDescriptor[];
24
+ /** Currently running tasks */
25
+ runningTasks: TaskDescriptor[];
26
+ /** Maximum concurrent tasks allowed */
27
+ maxConcurrency: number;
28
+ }
29
+ /** A task assignment decision */
30
+ export interface TaskAssignment {
31
+ task_id: string;
32
+ assigned_to: AgentRole;
33
+ }
34
+ /**
35
+ * DefaultSchedulingPolicy — FIFO with role inference from task content.
36
+ *
37
+ * Rules:
38
+ * 1. Respects maxConcurrency (won't assign more tasks than allowed)
39
+ * 2. Assigns tasks in priority order (critical > high > medium > low)
40
+ * 3. Infers agent role from task title keywords
41
+ */
42
+ export declare class DefaultSchedulingPolicy implements SchedulingPolicy {
43
+ selectTasks(readyTasks: TaskDescriptor[], _goal: GoalDescriptor, context: SchedulingContext): TaskAssignment[];
44
+ private _inferRole;
45
+ }
46
+ export interface GoalSchedulerOptions {
47
+ /** Maximum concurrent tasks per goal (default: 1) */
48
+ maxConcurrency?: number;
49
+ /** Scheduling policy (default: DefaultSchedulingPolicy) */
50
+ policy?: SchedulingPolicy;
51
+ /** Auto-start on construction (default: true) */
52
+ autoStart?: boolean;
53
+ }
54
+ /**
55
+ * GoalScheduler watches task lifecycle events and auto-dispatches ready tasks.
56
+ *
57
+ * Usage:
58
+ * const scheduler = new GoalScheduler(store, { maxConcurrency: 2 });
59
+ * // ... scheduler emits TASK_ASSIGNED events when tasks become ready
60
+ * scheduler.stop();
61
+ */
62
+ export declare class GoalScheduler {
63
+ private store;
64
+ private projection;
65
+ private policy;
66
+ private maxConcurrency;
67
+ private unsubscribe?;
68
+ constructor(store: EventStore, options?: GoalSchedulerOptions);
69
+ /**
70
+ * Start watching for task lifecycle events.
71
+ */
72
+ start(): void;
73
+ /**
74
+ * Stop watching.
75
+ */
76
+ stop(): void;
77
+ /**
78
+ * Manually trigger scheduling for a goal.
79
+ */
80
+ scheduleGoal(goalId: string): void;
81
+ private _onEvent;
82
+ private _tryDispatch;
83
+ }