dal-code 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 (2532) hide show
  1. package/CHANGELOG.md +5626 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +29 -0
  4. package/PRIVACY.md +103 -0
  5. package/README.md +108 -0
  6. package/dist/bun/cli.d.ts +5 -0
  7. package/dist/bun/cli.d.ts.map +1 -0
  8. package/dist/bun/cli.js +5 -0
  9. package/dist/bun/cli.js.map +1 -0
  10. package/dist/bun/register-bedrock.d.ts +2 -0
  11. package/dist/bun/register-bedrock.d.ts.map +1 -0
  12. package/dist/bun/register-bedrock.js +4 -0
  13. package/dist/bun/register-bedrock.js.map +1 -0
  14. package/dist/bun/restore-sandbox-env.d.ts +17 -0
  15. package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
  16. package/dist/bun/restore-sandbox-env.js +36 -0
  17. package/dist/bun/restore-sandbox-env.js.map +1 -0
  18. package/dist/bun/runtime-setup.d.ts +2 -0
  19. package/dist/bun/runtime-setup.d.ts.map +1 -0
  20. package/dist/bun/runtime-setup.js +9 -0
  21. package/dist/bun/runtime-setup.js.map +1 -0
  22. package/dist/bun/sandbox-env-setup.d.ts +2 -0
  23. package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
  24. package/dist/bun/sandbox-env-setup.js +4 -0
  25. package/dist/bun/sandbox-env-setup.js.map +1 -0
  26. package/dist/cli/args.d.ts +61 -0
  27. package/dist/cli/args.d.ts.map +1 -0
  28. package/dist/cli/args.js +440 -0
  29. package/dist/cli/args.js.map +1 -0
  30. package/dist/cli/auth-check.d.ts +19 -0
  31. package/dist/cli/auth-check.d.ts.map +1 -0
  32. package/dist/cli/auth-check.js +50 -0
  33. package/dist/cli/auth-check.js.map +1 -0
  34. package/dist/cli/auth-command.d.ts +24 -0
  35. package/dist/cli/auth-command.d.ts.map +1 -0
  36. package/dist/cli/auth-command.js +103 -0
  37. package/dist/cli/auth-command.js.map +1 -0
  38. package/dist/cli/config-selector.d.ts +16 -0
  39. package/dist/cli/config-selector.d.ts.map +1 -0
  40. package/dist/cli/config-selector.js +32 -0
  41. package/dist/cli/config-selector.js.map +1 -0
  42. package/dist/cli/credential-print.d.ts +13 -0
  43. package/dist/cli/credential-print.d.ts.map +1 -0
  44. package/dist/cli/credential-print.js +76 -0
  45. package/dist/cli/credential-print.js.map +1 -0
  46. package/dist/cli/file-processor.d.ts +15 -0
  47. package/dist/cli/file-processor.d.ts.map +1 -0
  48. package/dist/cli/file-processor.js +71 -0
  49. package/dist/cli/file-processor.js.map +1 -0
  50. package/dist/cli/initial-message.d.ts +18 -0
  51. package/dist/cli/initial-message.d.ts.map +1 -0
  52. package/dist/cli/initial-message.js +22 -0
  53. package/dist/cli/initial-message.js.map +1 -0
  54. package/dist/cli/list-models.d.ts +9 -0
  55. package/dist/cli/list-models.d.ts.map +1 -0
  56. package/dist/cli/list-models.js +98 -0
  57. package/dist/cli/list-models.js.map +1 -0
  58. package/dist/cli/project-trust.d.ts +10 -0
  59. package/dist/cli/project-trust.d.ts.map +1 -0
  60. package/dist/cli/project-trust.js +49 -0
  61. package/dist/cli/project-trust.js.map +1 -0
  62. package/dist/cli/session-picker.d.ts +10 -0
  63. package/dist/cli/session-picker.d.ts.map +1 -0
  64. package/dist/cli/session-picker.js +36 -0
  65. package/dist/cli/session-picker.js.map +1 -0
  66. package/dist/cli/setup.d.ts +2 -0
  67. package/dist/cli/setup.d.ts.map +1 -0
  68. package/dist/cli/setup.js +12 -0
  69. package/dist/cli/setup.js.map +1 -0
  70. package/dist/cli/startup-ui.d.ts +20 -0
  71. package/dist/cli/startup-ui.d.ts.map +1 -0
  72. package/dist/cli/startup-ui.js +185 -0
  73. package/dist/cli/startup-ui.js.map +1 -0
  74. package/dist/cli.d.ts +3 -0
  75. package/dist/cli.d.ts.map +1 -0
  76. package/dist/cli.js +6 -0
  77. package/dist/cli.js.map +1 -0
  78. package/dist/config.d.ts +107 -0
  79. package/dist/config.d.ts.map +1 -0
  80. package/dist/config.js +504 -0
  81. package/dist/config.js.map +1 -0
  82. package/dist/core/agent-session-runtime.d.ts +119 -0
  83. package/dist/core/agent-session-runtime.d.ts.map +1 -0
  84. package/dist/core/agent-session-runtime.js +317 -0
  85. package/dist/core/agent-session-runtime.js.map +1 -0
  86. package/dist/core/agent-session-services.d.ts +86 -0
  87. package/dist/core/agent-session-services.d.ts.map +1 -0
  88. package/dist/core/agent-session-services.js +134 -0
  89. package/dist/core/agent-session-services.js.map +1 -0
  90. package/dist/core/agent-session.d.ts +687 -0
  91. package/dist/core/agent-session.d.ts.map +1 -0
  92. package/dist/core/agent-session.js +2887 -0
  93. package/dist/core/agent-session.js.map +1 -0
  94. package/dist/core/auth-guidance.d.ts +5 -0
  95. package/dist/core/auth-guidance.d.ts.map +1 -0
  96. package/dist/core/auth-guidance.js +17 -0
  97. package/dist/core/auth-guidance.js.map +1 -0
  98. package/dist/core/auth-storage.d.ts +72 -0
  99. package/dist/core/auth-storage.d.ts.map +1 -0
  100. package/dist/core/auth-storage.js +426 -0
  101. package/dist/core/auth-storage.js.map +1 -0
  102. package/dist/core/bash-executor.d.ts +32 -0
  103. package/dist/core/bash-executor.d.ts.map +1 -0
  104. package/dist/core/bash-executor.js +111 -0
  105. package/dist/core/bash-executor.js.map +1 -0
  106. package/dist/core/cache-stats.d.ts +49 -0
  107. package/dist/core/cache-stats.d.ts.map +1 -0
  108. package/dist/core/cache-stats.js +101 -0
  109. package/dist/core/cache-stats.js.map +1 -0
  110. package/dist/core/compaction/branch-summarization.d.ts +98 -0
  111. package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  112. package/dist/core/compaction/branch-summarization.js +251 -0
  113. package/dist/core/compaction/branch-summarization.js.map +1 -0
  114. package/dist/core/compaction/compaction.d.ts +143 -0
  115. package/dist/core/compaction/compaction.d.ts.map +1 -0
  116. package/dist/core/compaction/compaction.js +668 -0
  117. package/dist/core/compaction/compaction.js.map +1 -0
  118. package/dist/core/compaction/index.d.ts +7 -0
  119. package/dist/core/compaction/index.d.ts.map +1 -0
  120. package/dist/core/compaction/index.js +7 -0
  121. package/dist/core/compaction/index.js.map +1 -0
  122. package/dist/core/compaction/utils.d.ts +38 -0
  123. package/dist/core/compaction/utils.d.ts.map +1 -0
  124. package/dist/core/compaction/utils.js +142 -0
  125. package/dist/core/compaction/utils.js.map +1 -0
  126. package/dist/core/defaults.d.ts +4 -0
  127. package/dist/core/defaults.d.ts.map +1 -0
  128. package/dist/core/defaults.js +11 -0
  129. package/dist/core/defaults.js.map +1 -0
  130. package/dist/core/diagnostics.d.ts +15 -0
  131. package/dist/core/diagnostics.d.ts.map +1 -0
  132. package/dist/core/diagnostics.js +2 -0
  133. package/dist/core/diagnostics.js.map +1 -0
  134. package/dist/core/empty-assistant.d.ts +13 -0
  135. package/dist/core/empty-assistant.d.ts.map +1 -0
  136. package/dist/core/empty-assistant.js +27 -0
  137. package/dist/core/empty-assistant.js.map +1 -0
  138. package/dist/core/event-bus.d.ts +9 -0
  139. package/dist/core/event-bus.d.ts.map +1 -0
  140. package/dist/core/event-bus.js +25 -0
  141. package/dist/core/event-bus.js.map +1 -0
  142. package/dist/core/exec.d.ts +29 -0
  143. package/dist/core/exec.d.ts.map +1 -0
  144. package/dist/core/exec.js +75 -0
  145. package/dist/core/exec.js.map +1 -0
  146. package/dist/core/experimental.d.ts +6 -0
  147. package/dist/core/experimental.d.ts.map +1 -0
  148. package/dist/core/experimental.js +8 -0
  149. package/dist/core/experimental.js.map +1 -0
  150. package/dist/core/export-html/ansi-to-html.d.ts +22 -0
  151. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  152. package/dist/core/export-html/ansi-to-html.js +249 -0
  153. package/dist/core/export-html/ansi-to-html.js.map +1 -0
  154. package/dist/core/export-html/index.d.ts +37 -0
  155. package/dist/core/export-html/index.d.ts.map +1 -0
  156. package/dist/core/export-html/index.js +226 -0
  157. package/dist/core/export-html/index.js.map +1 -0
  158. package/dist/core/export-html/template.css +1066 -0
  159. package/dist/core/export-html/template.html +55 -0
  160. package/dist/core/export-html/template.js +1864 -0
  161. package/dist/core/export-html/tool-renderer.d.ts +34 -0
  162. package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  163. package/dist/core/export-html/tool-renderer.js +108 -0
  164. package/dist/core/export-html/tool-renderer.js.map +1 -0
  165. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  166. package/dist/core/export-html/vendor/marked.min.js +78 -0
  167. package/dist/core/extensions/api-version.d.ts +9 -0
  168. package/dist/core/extensions/api-version.d.ts.map +1 -0
  169. package/dist/core/extensions/api-version.js +17 -0
  170. package/dist/core/extensions/api-version.js.map +1 -0
  171. package/dist/core/extensions/index.d.ts +12 -0
  172. package/dist/core/extensions/index.d.ts.map +1 -0
  173. package/dist/core/extensions/index.js +9 -0
  174. package/dist/core/extensions/index.js.map +1 -0
  175. package/dist/core/extensions/loader.d.ts +23 -0
  176. package/dist/core/extensions/loader.d.ts.map +1 -0
  177. package/dist/core/extensions/loader.js +653 -0
  178. package/dist/core/extensions/loader.js.map +1 -0
  179. package/dist/core/extensions/permission-surface.d.ts +10 -0
  180. package/dist/core/extensions/permission-surface.d.ts.map +1 -0
  181. package/dist/core/extensions/permission-surface.js +33 -0
  182. package/dist/core/extensions/permission-surface.js.map +1 -0
  183. package/dist/core/extensions/runner.d.ts +178 -0
  184. package/dist/core/extensions/runner.d.ts.map +1 -0
  185. package/dist/core/extensions/runner.js +1014 -0
  186. package/dist/core/extensions/runner.js.map +1 -0
  187. package/dist/core/extensions/types.d.ts +1393 -0
  188. package/dist/core/extensions/types.d.ts.map +1 -0
  189. package/dist/core/extensions/types.js +60 -0
  190. package/dist/core/extensions/types.js.map +1 -0
  191. package/dist/core/extensions/wrapper.d.ts +20 -0
  192. package/dist/core/extensions/wrapper.d.ts.map +1 -0
  193. package/dist/core/extensions/wrapper.js +41 -0
  194. package/dist/core/extensions/wrapper.js.map +1 -0
  195. package/dist/core/footer-data-provider.d.ts +64 -0
  196. package/dist/core/footer-data-provider.d.ts.map +1 -0
  197. package/dist/core/footer-data-provider.js +338 -0
  198. package/dist/core/footer-data-provider.js.map +1 -0
  199. package/dist/core/http-dispatcher.d.ts +22 -0
  200. package/dist/core/http-dispatcher.d.ts.map +1 -0
  201. package/dist/core/http-dispatcher.js +98 -0
  202. package/dist/core/http-dispatcher.js.map +1 -0
  203. package/dist/core/index.d.ts +13 -0
  204. package/dist/core/index.d.ts.map +1 -0
  205. package/dist/core/index.js +13 -0
  206. package/dist/core/index.js.map +1 -0
  207. package/dist/core/keybindings.d.ts +433 -0
  208. package/dist/core/keybindings.d.ts.map +1 -0
  209. package/dist/core/keybindings.js +326 -0
  210. package/dist/core/keybindings.js.map +1 -0
  211. package/dist/core/messages.d.ts +77 -0
  212. package/dist/core/messages.d.ts.map +1 -0
  213. package/dist/core/messages.js +123 -0
  214. package/dist/core/messages.js.map +1 -0
  215. package/dist/core/model-config.d.ts +591 -0
  216. package/dist/core/model-config.d.ts.map +1 -0
  217. package/dist/core/model-config.js +259 -0
  218. package/dist/core/model-config.js.map +1 -0
  219. package/dist/core/model-registry.d.ts +45 -0
  220. package/dist/core/model-registry.d.ts.map +1 -0
  221. package/dist/core/model-registry.js +107 -0
  222. package/dist/core/model-registry.js.map +1 -0
  223. package/dist/core/model-resolver.d.ts +130 -0
  224. package/dist/core/model-resolver.d.ts.map +1 -0
  225. package/dist/core/model-resolver.js +615 -0
  226. package/dist/core/model-resolver.js.map +1 -0
  227. package/dist/core/model-runtime.d.ts +101 -0
  228. package/dist/core/model-runtime.d.ts.map +1 -0
  229. package/dist/core/model-runtime.js +603 -0
  230. package/dist/core/model-runtime.js.map +1 -0
  231. package/dist/core/models-store.d.ts +22 -0
  232. package/dist/core/models-store.d.ts.map +1 -0
  233. package/dist/core/models-store.js +115 -0
  234. package/dist/core/models-store.js.map +1 -0
  235. package/dist/core/output-guard.d.ts +7 -0
  236. package/dist/core/output-guard.d.ts.map +1 -0
  237. package/dist/core/output-guard.js +89 -0
  238. package/dist/core/output-guard.js.map +1 -0
  239. package/dist/core/package-manager.d.ts +224 -0
  240. package/dist/core/package-manager.d.ts.map +1 -0
  241. package/dist/core/package-manager.js +2241 -0
  242. package/dist/core/package-manager.js.map +1 -0
  243. package/dist/core/pi-manifest.d.ts +25 -0
  244. package/dist/core/pi-manifest.d.ts.map +1 -0
  245. package/dist/core/pi-manifest.js +83 -0
  246. package/dist/core/pi-manifest.js.map +1 -0
  247. package/dist/core/project-map.d.ts +23 -0
  248. package/dist/core/project-map.d.ts.map +1 -0
  249. package/dist/core/project-map.js +268 -0
  250. package/dist/core/project-map.js.map +1 -0
  251. package/dist/core/project-trust.d.ts +15 -0
  252. package/dist/core/project-trust.d.ts.map +1 -0
  253. package/dist/core/project-trust.js +59 -0
  254. package/dist/core/project-trust.js.map +1 -0
  255. package/dist/core/prompt-templates.d.ts +54 -0
  256. package/dist/core/prompt-templates.d.ts.map +1 -0
  257. package/dist/core/prompt-templates.js +236 -0
  258. package/dist/core/prompt-templates.js.map +1 -0
  259. package/dist/core/provider-attribution.d.ts +4 -0
  260. package/dist/core/provider-attribution.d.ts.map +1 -0
  261. package/dist/core/provider-attribution.js +72 -0
  262. package/dist/core/provider-attribution.js.map +1 -0
  263. package/dist/core/provider-composer.d.ts +58 -0
  264. package/dist/core/provider-composer.d.ts.map +1 -0
  265. package/dist/core/provider-composer.js +409 -0
  266. package/dist/core/provider-composer.js.map +1 -0
  267. package/dist/core/radius.d.ts +2 -0
  268. package/dist/core/radius.d.ts.map +1 -0
  269. package/dist/core/radius.js +2 -0
  270. package/dist/core/radius.js.map +1 -0
  271. package/dist/core/remote-catalog-provider.d.ts +5 -0
  272. package/dist/core/remote-catalog-provider.d.ts.map +1 -0
  273. package/dist/core/remote-catalog-provider.js +122 -0
  274. package/dist/core/remote-catalog-provider.js.map +1 -0
  275. package/dist/core/resolve-config-value.d.ts +30 -0
  276. package/dist/core/resolve-config-value.d.ts.map +1 -0
  277. package/dist/core/resolve-config-value.js +247 -0
  278. package/dist/core/resolve-config-value.js.map +1 -0
  279. package/dist/core/resource-loader.d.ts +221 -0
  280. package/dist/core/resource-loader.d.ts.map +1 -0
  281. package/dist/core/resource-loader.js +885 -0
  282. package/dist/core/resource-loader.js.map +1 -0
  283. package/dist/core/runtime-credentials.d.ts +15 -0
  284. package/dist/core/runtime-credentials.d.ts.map +1 -0
  285. package/dist/core/runtime-credentials.js +39 -0
  286. package/dist/core/runtime-credentials.js.map +1 -0
  287. package/dist/core/sdk.d.ts +108 -0
  288. package/dist/core/sdk.d.ts.map +1 -0
  289. package/dist/core/sdk.js +290 -0
  290. package/dist/core/sdk.js.map +1 -0
  291. package/dist/core/session-cwd.d.ts +19 -0
  292. package/dist/core/session-cwd.d.ts.map +1 -0
  293. package/dist/core/session-cwd.js +38 -0
  294. package/dist/core/session-cwd.js.map +1 -0
  295. package/dist/core/session-export.d.ts +4 -0
  296. package/dist/core/session-export.d.ts.map +1 -0
  297. package/dist/core/session-export.js +32 -0
  298. package/dist/core/session-export.js.map +1 -0
  299. package/dist/core/session-manager.d.ts +357 -0
  300. package/dist/core/session-manager.d.ts.map +1 -0
  301. package/dist/core/session-manager.js +1370 -0
  302. package/dist/core/session-manager.js.map +1 -0
  303. package/dist/core/settings-diagnostics.d.ts +9 -0
  304. package/dist/core/settings-diagnostics.d.ts.map +1 -0
  305. package/dist/core/settings-diagnostics.js +21 -0
  306. package/dist/core/settings-diagnostics.js.map +1 -0
  307. package/dist/core/settings-manager.d.ts +333 -0
  308. package/dist/core/settings-manager.d.ts.map +1 -0
  309. package/dist/core/settings-manager.js +1005 -0
  310. package/dist/core/settings-manager.js.map +1 -0
  311. package/dist/core/skills.d.ts +60 -0
  312. package/dist/core/skills.d.ts.map +1 -0
  313. package/dist/core/skills.js +407 -0
  314. package/dist/core/skills.js.map +1 -0
  315. package/dist/core/slash-commands.d.ts +15 -0
  316. package/dist/core/slash-commands.d.ts.map +1 -0
  317. package/dist/core/slash-commands.js +29 -0
  318. package/dist/core/slash-commands.js.map +1 -0
  319. package/dist/core/source-info.d.ts +18 -0
  320. package/dist/core/source-info.d.ts.map +1 -0
  321. package/dist/core/source-info.js +19 -0
  322. package/dist/core/source-info.js.map +1 -0
  323. package/dist/core/system-prompt.d.ts +28 -0
  324. package/dist/core/system-prompt.d.ts.map +1 -0
  325. package/dist/core/system-prompt.js +118 -0
  326. package/dist/core/system-prompt.js.map +1 -0
  327. package/dist/core/telemetry.d.ts +3 -0
  328. package/dist/core/telemetry.d.ts.map +1 -0
  329. package/dist/core/telemetry.js +9 -0
  330. package/dist/core/telemetry.js.map +1 -0
  331. package/dist/core/timings.d.ts +10 -0
  332. package/dist/core/timings.d.ts.map +1 -0
  333. package/dist/core/timings.js +41 -0
  334. package/dist/core/timings.js.map +1 -0
  335. package/dist/core/tools/bash.d.ts +87 -0
  336. package/dist/core/tools/bash.d.ts.map +1 -0
  337. package/dist/core/tools/bash.js +439 -0
  338. package/dist/core/tools/bash.js.map +1 -0
  339. package/dist/core/tools/edit-diff.d.ts +101 -0
  340. package/dist/core/tools/edit-diff.d.ts.map +1 -0
  341. package/dist/core/tools/edit-diff.js +421 -0
  342. package/dist/core/tools/edit-diff.js.map +1 -0
  343. package/dist/core/tools/edit.d.ts +55 -0
  344. package/dist/core/tools/edit.d.ts.map +1 -0
  345. package/dist/core/tools/edit.js +327 -0
  346. package/dist/core/tools/edit.js.map +1 -0
  347. package/dist/core/tools/file-mutation-queue.d.ts +6 -0
  348. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  349. package/dist/core/tools/file-mutation-queue.js +52 -0
  350. package/dist/core/tools/file-mutation-queue.js.map +1 -0
  351. package/dist/core/tools/find.d.ts +42 -0
  352. package/dist/core/tools/find.d.ts.map +1 -0
  353. package/dist/core/tools/find.js +306 -0
  354. package/dist/core/tools/find.js.map +1 -0
  355. package/dist/core/tools/grep.d.ts +41 -0
  356. package/dist/core/tools/grep.d.ts.map +1 -0
  357. package/dist/core/tools/grep.js +312 -0
  358. package/dist/core/tools/grep.js.map +1 -0
  359. package/dist/core/tools/index.d.ts +43 -0
  360. package/dist/core/tools/index.d.ts.map +1 -0
  361. package/dist/core/tools/index.js +129 -0
  362. package/dist/core/tools/index.js.map +1 -0
  363. package/dist/core/tools/ls.d.ts +41 -0
  364. package/dist/core/tools/ls.d.ts.map +1 -0
  365. package/dist/core/tools/ls.js +175 -0
  366. package/dist/core/tools/ls.js.map +1 -0
  367. package/dist/core/tools/output-accumulator.d.ts +52 -0
  368. package/dist/core/tools/output-accumulator.d.ts.map +1 -0
  369. package/dist/core/tools/output-accumulator.js +184 -0
  370. package/dist/core/tools/output-accumulator.js.map +1 -0
  371. package/dist/core/tools/path-utils.d.ts +10 -0
  372. package/dist/core/tools/path-utils.d.ts.map +1 -0
  373. package/dist/core/tools/path-utils.js +99 -0
  374. package/dist/core/tools/path-utils.js.map +1 -0
  375. package/dist/core/tools/powershell.d.ts +16 -0
  376. package/dist/core/tools/powershell.d.ts.map +1 -0
  377. package/dist/core/tools/powershell.js +39 -0
  378. package/dist/core/tools/powershell.js.map +1 -0
  379. package/dist/core/tools/read.d.ts +39 -0
  380. package/dist/core/tools/read.d.ts.map +1 -0
  381. package/dist/core/tools/read.js +279 -0
  382. package/dist/core/tools/read.js.map +1 -0
  383. package/dist/core/tools/render-utils.d.ts +29 -0
  384. package/dist/core/tools/render-utils.d.ts.map +1 -0
  385. package/dist/core/tools/render-utils.js +113 -0
  386. package/dist/core/tools/render-utils.js.map +1 -0
  387. package/dist/core/tools/renderers/bash.d.ts +12 -0
  388. package/dist/core/tools/renderers/bash.d.ts.map +1 -0
  389. package/dist/core/tools/renderers/bash.js +130 -0
  390. package/dist/core/tools/renderers/bash.js.map +1 -0
  391. package/dist/core/tools/renderers/edit.d.ts +23 -0
  392. package/dist/core/tools/renderers/edit.d.ts.map +1 -0
  393. package/dist/core/tools/renderers/edit.js +167 -0
  394. package/dist/core/tools/renderers/edit.js.map +1 -0
  395. package/dist/core/tools/renderers/find.d.ts +10 -0
  396. package/dist/core/tools/renderers/find.d.ts.map +1 -0
  397. package/dist/core/tools/renderers/find.js +64 -0
  398. package/dist/core/tools/renderers/find.js.map +1 -0
  399. package/dist/core/tools/renderers/grep.d.ts +10 -0
  400. package/dist/core/tools/renderers/grep.d.ts.map +1 -0
  401. package/dist/core/tools/renderers/grep.js +69 -0
  402. package/dist/core/tools/renderers/grep.js.map +1 -0
  403. package/dist/core/tools/renderers/index.d.ts +28 -0
  404. package/dist/core/tools/renderers/index.d.ts.map +1 -0
  405. package/dist/core/tools/renderers/index.js +47 -0
  406. package/dist/core/tools/renderers/index.js.map +1 -0
  407. package/dist/core/tools/renderers/ls.d.ts +10 -0
  408. package/dist/core/tools/renderers/ls.d.ts.map +1 -0
  409. package/dist/core/tools/renderers/ls.js +58 -0
  410. package/dist/core/tools/renderers/ls.js.map +1 -0
  411. package/dist/core/tools/renderers/read.d.ts +11 -0
  412. package/dist/core/tools/renderers/read.d.ts.map +1 -0
  413. package/dist/core/tools/renderers/read.js +129 -0
  414. package/dist/core/tools/renderers/read.js.map +1 -0
  415. package/dist/core/tools/renderers/write.d.ts +10 -0
  416. package/dist/core/tools/renderers/write.d.ts.map +1 -0
  417. package/dist/core/tools/renderers/write.js +153 -0
  418. package/dist/core/tools/renderers/write.js.map +1 -0
  419. package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  420. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  421. package/dist/core/tools/tool-definition-wrapper.js +36 -0
  422. package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  423. package/dist/core/tools/truncate.d.ts +70 -0
  424. package/dist/core/tools/truncate.d.ts.map +1 -0
  425. package/dist/core/tools/truncate.js +215 -0
  426. package/dist/core/tools/truncate.js.map +1 -0
  427. package/dist/core/tools/write.d.ts +30 -0
  428. package/dist/core/tools/write.d.ts.map +1 -0
  429. package/dist/core/tools/write.js +208 -0
  430. package/dist/core/tools/write.js.map +1 -0
  431. package/dist/core/trust-manager.d.ts +36 -0
  432. package/dist/core/trust-manager.d.ts.map +1 -0
  433. package/dist/core/trust-manager.js +203 -0
  434. package/dist/core/trust-manager.js.map +1 -0
  435. package/dist/core/usage-totals.d.ts +19 -0
  436. package/dist/core/usage-totals.d.ts.map +1 -0
  437. package/dist/core/usage-totals.js +52 -0
  438. package/dist/core/usage-totals.js.map +1 -0
  439. package/dist/dal/builtins.d.ts +17 -0
  440. package/dist/dal/builtins.d.ts.map +1 -0
  441. package/dist/dal/builtins.js +80 -0
  442. package/dist/dal/builtins.js.map +1 -0
  443. package/dist/dal/i18n.d.ts +12 -0
  444. package/dist/dal/i18n.d.ts.map +1 -0
  445. package/dist/dal/i18n.js +2 -0
  446. package/dist/dal/i18n.js.map +1 -0
  447. package/dist/extensions/index.d.ts +3 -0
  448. package/dist/extensions/index.d.ts.map +1 -0
  449. package/dist/extensions/index.js +3 -0
  450. package/dist/extensions/index.js.map +1 -0
  451. package/dist/extensions/llama/client.d.ts +67 -0
  452. package/dist/extensions/llama/client.d.ts.map +1 -0
  453. package/dist/extensions/llama/client.js +309 -0
  454. package/dist/extensions/llama/client.js.map +1 -0
  455. package/dist/extensions/llama/huggingface.d.ts +23 -0
  456. package/dist/extensions/llama/huggingface.d.ts.map +1 -0
  457. package/dist/extensions/llama/huggingface.js +141 -0
  458. package/dist/extensions/llama/huggingface.js.map +1 -0
  459. package/dist/extensions/llama/index.d.ts +3 -0
  460. package/dist/extensions/llama/index.d.ts.map +1 -0
  461. package/dist/extensions/llama/index.js +219 -0
  462. package/dist/extensions/llama/index.js.map +1 -0
  463. package/dist/extensions/llama/provider.d.ts +12 -0
  464. package/dist/extensions/llama/provider.d.ts.map +1 -0
  465. package/dist/extensions/llama/provider.js +146 -0
  466. package/dist/extensions/llama/provider.js.map +1 -0
  467. package/dist/extensions/llama/ui.d.ts +42 -0
  468. package/dist/extensions/llama/ui.d.ts.map +1 -0
  469. package/dist/extensions/llama/ui.js +416 -0
  470. package/dist/extensions/llama/ui.js.map +1 -0
  471. package/dist/index.d.ts +36 -0
  472. package/dist/index.d.ts.map +1 -0
  473. package/dist/index.js +48 -0
  474. package/dist/index.js.map +1 -0
  475. package/dist/main.d.ts +16 -0
  476. package/dist/main.d.ts.map +1 -0
  477. package/dist/main.js +804 -0
  478. package/dist/main.js.map +1 -0
  479. package/dist/migrations.d.ts +33 -0
  480. package/dist/migrations.d.ts.map +1 -0
  481. package/dist/migrations.js +282 -0
  482. package/dist/migrations.js.map +1 -0
  483. package/dist/modes/acp/acp-mapping.d.ts +17 -0
  484. package/dist/modes/acp/acp-mapping.d.ts.map +1 -0
  485. package/dist/modes/acp/acp-mapping.js +131 -0
  486. package/dist/modes/acp/acp-mapping.js.map +1 -0
  487. package/dist/modes/acp/acp-mode.d.ts +11 -0
  488. package/dist/modes/acp/acp-mode.d.ts.map +1 -0
  489. package/dist/modes/acp/acp-mode.js +131 -0
  490. package/dist/modes/acp/acp-mode.js.map +1 -0
  491. package/dist/modes/acp/acp-stream.d.ts +9 -0
  492. package/dist/modes/acp/acp-stream.d.ts.map +1 -0
  493. package/dist/modes/acp/acp-stream.js +21 -0
  494. package/dist/modes/acp/acp-stream.js.map +1 -0
  495. package/dist/modes/index.d.ts +11 -0
  496. package/dist/modes/index.d.ts.map +1 -0
  497. package/dist/modes/index.js +9 -0
  498. package/dist/modes/index.js.map +1 -0
  499. package/dist/modes/interactive/assets/clankolas.png +0 -0
  500. package/dist/modes/interactive/chat-viewport.d.ts +20 -0
  501. package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
  502. package/dist/modes/interactive/chat-viewport.js +28 -0
  503. package/dist/modes/interactive/chat-viewport.js.map +1 -0
  504. package/dist/modes/interactive/components/armin.d.ts +34 -0
  505. package/dist/modes/interactive/components/armin.d.ts.map +1 -0
  506. package/dist/modes/interactive/components/armin.js +333 -0
  507. package/dist/modes/interactive/components/armin.js.map +1 -0
  508. package/dist/modes/interactive/components/assistant-message.d.ts +29 -0
  509. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  510. package/dist/modes/interactive/components/assistant-message.js +183 -0
  511. package/dist/modes/interactive/components/assistant-message.js.map +1 -0
  512. package/dist/modes/interactive/components/bash-execution.d.ts +34 -0
  513. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  514. package/dist/modes/interactive/components/bash-execution.js +156 -0
  515. package/dist/modes/interactive/components/bash-execution.js.map +1 -0
  516. package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
  517. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  518. package/dist/modes/interactive/components/bordered-loader.js +55 -0
  519. package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  520. package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
  521. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  522. package/dist/modes/interactive/components/branch-summary-message.js +39 -0
  523. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  524. package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
  525. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  526. package/dist/modes/interactive/components/compaction-summary-message.js +41 -0
  527. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  528. package/dist/modes/interactive/components/config-selector.d.ts +103 -0
  529. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  530. package/dist/modes/interactive/components/config-selector.js +781 -0
  531. package/dist/modes/interactive/components/config-selector.js.map +1 -0
  532. package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  533. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  534. package/dist/modes/interactive/components/countdown-timer.js +33 -0
  535. package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  536. package/dist/modes/interactive/components/custom-editor.d.ts +30 -0
  537. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  538. package/dist/modes/interactive/components/custom-editor.js +115 -0
  539. package/dist/modes/interactive/components/custom-editor.js.map +1 -0
  540. package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
  541. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
  542. package/dist/modes/interactive/components/custom-entry.js +52 -0
  543. package/dist/modes/interactive/components/custom-entry.js.map +1 -0
  544. package/dist/modes/interactive/components/custom-message.d.ts +22 -0
  545. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  546. package/dist/modes/interactive/components/custom-message.js +88 -0
  547. package/dist/modes/interactive/components/custom-message.js.map +1 -0
  548. package/dist/modes/interactive/components/dal-brand.d.ts +46 -0
  549. package/dist/modes/interactive/components/dal-brand.d.ts.map +1 -0
  550. package/dist/modes/interactive/components/dal-brand.js +202 -0
  551. package/dist/modes/interactive/components/dal-brand.js.map +1 -0
  552. package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
  553. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
  554. package/dist/modes/interactive/components/daxnuts.js +140 -0
  555. package/dist/modes/interactive/components/daxnuts.js.map +1 -0
  556. package/dist/modes/interactive/components/diff.d.ts +12 -0
  557. package/dist/modes/interactive/components/diff.d.ts.map +1 -0
  558. package/dist/modes/interactive/components/diff.js +133 -0
  559. package/dist/modes/interactive/components/diff.js.map +1 -0
  560. package/dist/modes/interactive/components/dynamic-border.d.ts +20 -0
  561. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  562. package/dist/modes/interactive/components/dynamic-border.js +45 -0
  563. package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  564. package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
  565. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
  566. package/dist/modes/interactive/components/earendil-announcement.js +40 -0
  567. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
  568. package/dist/modes/interactive/components/extension-editor.d.ts +21 -0
  569. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  570. package/dist/modes/interactive/components/extension-editor.js +96 -0
  571. package/dist/modes/interactive/components/extension-editor.js.map +1 -0
  572. package/dist/modes/interactive/components/extension-input.d.ts +23 -0
  573. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  574. package/dist/modes/interactive/components/extension-input.js +61 -0
  575. package/dist/modes/interactive/components/extension-input.js.map +1 -0
  576. package/dist/modes/interactive/components/extension-selector.d.ts +26 -0
  577. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  578. package/dist/modes/interactive/components/extension-selector.js +83 -0
  579. package/dist/modes/interactive/components/extension-selector.js.map +1 -0
  580. package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
  581. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
  582. package/dist/modes/interactive/components/first-time-setup.js +103 -0
  583. package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
  584. package/dist/modes/interactive/components/footer.d.ts +32 -0
  585. package/dist/modes/interactive/components/footer.d.ts.map +1 -0
  586. package/dist/modes/interactive/components/footer.js +191 -0
  587. package/dist/modes/interactive/components/footer.js.map +1 -0
  588. package/dist/modes/interactive/components/index.d.ts +34 -0
  589. package/dist/modes/interactive/components/index.d.ts.map +1 -0
  590. package/dist/modes/interactive/components/index.js +35 -0
  591. package/dist/modes/interactive/components/index.js.map +1 -0
  592. package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
  593. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  594. package/dist/modes/interactive/components/keybinding-hints.js +36 -0
  595. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  596. package/dist/modes/interactive/components/login-dialog.d.ts +52 -0
  597. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  598. package/dist/modes/interactive/components/login-dialog.js +184 -0
  599. package/dist/modes/interactive/components/login-dialog.js.map +1 -0
  600. package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
  601. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
  602. package/dist/modes/interactive/components/markdown-transform.js +19 -0
  603. package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
  604. package/dist/modes/interactive/components/mermaid.d.ts +11 -0
  605. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
  606. package/dist/modes/interactive/components/mermaid.js +75 -0
  607. package/dist/modes/interactive/components/mermaid.js.map +1 -0
  608. package/dist/modes/interactive/components/model-selector.d.ts +60 -0
  609. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  610. package/dist/modes/interactive/components/model-selector.js +358 -0
  611. package/dist/modes/interactive/components/model-selector.js.map +1 -0
  612. package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
  613. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  614. package/dist/modes/interactive/components/oauth-selector.js +161 -0
  615. package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  616. package/dist/modes/interactive/components/scoped-models-selector.d.ts +46 -0
  617. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  618. package/dist/modes/interactive/components/scoped-models-selector.js +325 -0
  619. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  620. package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
  621. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  622. package/dist/modes/interactive/components/session-selector-search.js +155 -0
  623. package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  624. package/dist/modes/interactive/components/session-selector.d.ts +95 -0
  625. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  626. package/dist/modes/interactive/components/session-selector.js +867 -0
  627. package/dist/modes/interactive/components/session-selector.js.map +1 -0
  628. package/dist/modes/interactive/components/settings-selector.d.ts +92 -0
  629. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  630. package/dist/modes/interactive/components/settings-selector.js +708 -0
  631. package/dist/modes/interactive/components/settings-selector.js.map +1 -0
  632. package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
  633. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
  634. package/dist/modes/interactive/components/settings-submenu.js +165 -0
  635. package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
  636. package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  637. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  638. package/dist/modes/interactive/components/show-images-selector.js +37 -0
  639. package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  640. package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
  641. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  642. package/dist/modes/interactive/components/skill-invocation-message.js +45 -0
  643. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  644. package/dist/modes/interactive/components/status-indicator.d.ts +46 -0
  645. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
  646. package/dist/modes/interactive/components/status-indicator.js +121 -0
  647. package/dist/modes/interactive/components/status-indicator.js.map +1 -0
  648. package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  649. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  650. package/dist/modes/interactive/components/theme-selector.js +48 -0
  651. package/dist/modes/interactive/components/theme-selector.js.map +1 -0
  652. package/dist/modes/interactive/components/thinking-selector.d.ts +23 -0
  653. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  654. package/dist/modes/interactive/components/thinking-selector.js +102 -0
  655. package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  656. package/dist/modes/interactive/components/tool-execution.d.ts +76 -0
  657. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  658. package/dist/modes/interactive/components/tool-execution.js +442 -0
  659. package/dist/modes/interactive/components/tool-execution.js.map +1 -0
  660. package/dist/modes/interactive/components/tree-selector.d.ts +94 -0
  661. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  662. package/dist/modes/interactive/components/tree-selector.js +1245 -0
  663. package/dist/modes/interactive/components/tree-selector.js.map +1 -0
  664. package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
  665. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
  666. package/dist/modes/interactive/components/trust-selector.js +91 -0
  667. package/dist/modes/interactive/components/trust-selector.js.map +1 -0
  668. package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  669. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  670. package/dist/modes/interactive/components/user-message-selector.js +114 -0
  671. package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  672. package/dist/modes/interactive/components/user-message.d.ts +19 -0
  673. package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  674. package/dist/modes/interactive/components/user-message.js +79 -0
  675. package/dist/modes/interactive/components/user-message.js.map +1 -0
  676. package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  677. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  678. package/dist/modes/interactive/components/visual-truncate.js +33 -0
  679. package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  680. package/dist/modes/interactive/external-editor.d.ts +12 -0
  681. package/dist/modes/interactive/external-editor.d.ts.map +1 -0
  682. package/dist/modes/interactive/external-editor.js +38 -0
  683. package/dist/modes/interactive/external-editor.js.map +1 -0
  684. package/dist/modes/interactive/interactive-mode.d.ts +448 -0
  685. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  686. package/dist/modes/interactive/interactive-mode.js +5688 -0
  687. package/dist/modes/interactive/interactive-mode.js.map +1 -0
  688. package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
  689. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
  690. package/dist/modes/interactive/model-catalog-refresh.js +34 -0
  691. package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
  692. package/dist/modes/interactive/model-search.d.ts +12 -0
  693. package/dist/modes/interactive/model-search.d.ts.map +1 -0
  694. package/dist/modes/interactive/model-search.js +15 -0
  695. package/dist/modes/interactive/model-search.js.map +1 -0
  696. package/dist/modes/interactive/session-share.d.ts +16 -0
  697. package/dist/modes/interactive/session-share.d.ts.map +1 -0
  698. package/dist/modes/interactive/session-share.js +184 -0
  699. package/dist/modes/interactive/session-share.js.map +1 -0
  700. package/dist/modes/interactive/theme/dark.json +84 -0
  701. package/dist/modes/interactive/theme/light.json +84 -0
  702. package/dist/modes/interactive/theme/theme-controller.d.ts +41 -0
  703. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  704. package/dist/modes/interactive/theme/theme-controller.js +130 -0
  705. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  706. package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
  707. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
  708. package/dist/modes/interactive/theme/theme-json.js +130 -0
  709. package/dist/modes/interactive/theme/theme-json.js.map +1 -0
  710. package/dist/modes/interactive/theme/theme-schema.json +356 -0
  711. package/dist/modes/interactive/theme/theme.d.ts +131 -0
  712. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  713. package/dist/modes/interactive/theme/theme.js +992 -0
  714. package/dist/modes/interactive/theme/theme.js.map +1 -0
  715. package/dist/modes/interactive/tui-renderer.d.ts +21 -0
  716. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
  717. package/dist/modes/interactive/tui-renderer.js +66 -0
  718. package/dist/modes/interactive/tui-renderer.js.map +1 -0
  719. package/dist/modes/json-event.d.ts +34 -0
  720. package/dist/modes/json-event.d.ts.map +1 -0
  721. package/dist/modes/json-event.js +29 -0
  722. package/dist/modes/json-event.js.map +1 -0
  723. package/dist/modes/print-mode.d.ts +28 -0
  724. package/dist/modes/print-mode.d.ts.map +1 -0
  725. package/dist/modes/print-mode.js +142 -0
  726. package/dist/modes/print-mode.js.map +1 -0
  727. package/dist/modes/rpc/jsonl.d.ts +17 -0
  728. package/dist/modes/rpc/jsonl.d.ts.map +1 -0
  729. package/dist/modes/rpc/jsonl.js +49 -0
  730. package/dist/modes/rpc/jsonl.js.map +1 -0
  731. package/dist/modes/rpc/rpc-client.d.ts +269 -0
  732. package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  733. package/dist/modes/rpc/rpc-client.js +555 -0
  734. package/dist/modes/rpc/rpc-client.js.map +1 -0
  735. package/dist/modes/rpc/rpc-mode.d.ts +20 -0
  736. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  737. package/dist/modes/rpc/rpc-mode.js +674 -0
  738. package/dist/modes/rpc/rpc-mode.js.map +1 -0
  739. package/dist/modes/rpc/rpc-types.d.ts +497 -0
  740. package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  741. package/dist/modes/rpc/rpc-types.js +8 -0
  742. package/dist/modes/rpc/rpc-types.js.map +1 -0
  743. package/dist/node_modules/@dalcode/dal-bridge/LICENSE +21 -0
  744. package/dist/node_modules/@dalcode/dal-bridge/package.json +32 -0
  745. package/dist/node_modules/@dalcode/dal-bridge/src/client.ts +77 -0
  746. package/dist/node_modules/@dalcode/dal-bridge/src/index.ts +204 -0
  747. package/dist/node_modules/@dalcode/dal-gateway/LICENSE +21 -0
  748. package/dist/node_modules/@dalcode/dal-gateway/package.json +30 -0
  749. package/dist/node_modules/@dalcode/dal-gateway/src/index.ts +124 -0
  750. package/dist/node_modules/@dalcode/dal-guard/LICENSE +21 -0
  751. package/dist/node_modules/@dalcode/dal-guard/package.json +32 -0
  752. package/dist/node_modules/@dalcode/dal-guard/src/index.ts +262 -0
  753. package/dist/node_modules/@dalcode/dal-halo/LICENSE +21 -0
  754. package/dist/node_modules/@dalcode/dal-halo/package.json +27 -0
  755. package/dist/node_modules/@dalcode/dal-halo/src/halo-client.ts +118 -0
  756. package/dist/node_modules/@dalcode/dal-halo/src/index.ts +131 -0
  757. package/dist/node_modules/@dalcode/dal-lang/LICENSE +21 -0
  758. package/dist/node_modules/@dalcode/dal-lang/package.json +31 -0
  759. package/dist/node_modules/@dalcode/dal-lang/src/index.ts +57 -0
  760. package/dist/node_modules/@dalcode/dal-lsp/LICENSE +21 -0
  761. package/dist/node_modules/@dalcode/dal-lsp/package.json +32 -0
  762. package/dist/node_modules/@dalcode/dal-lsp/src/index.ts +92 -0
  763. package/dist/node_modules/@dalcode/dal-mcp/LICENSE +21 -0
  764. package/dist/node_modules/@dalcode/dal-mcp/package.json +35 -0
  765. package/dist/node_modules/@dalcode/dal-mcp/src/config.ts +116 -0
  766. package/dist/node_modules/@dalcode/dal-mcp/src/http-client.ts +134 -0
  767. package/dist/node_modules/@dalcode/dal-mcp/src/index.ts +297 -0
  768. package/dist/node_modules/@dalcode/dal-mcp/src/report.ts +33 -0
  769. package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.ts +159 -0
  770. package/dist/node_modules/@dalcode/dal-mcp/src/types.ts +39 -0
  771. package/dist/node_modules/@dalcode/dal-pi-kit/LICENSE +21 -0
  772. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.d.ts +18 -0
  773. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.d.ts.map +1 -0
  774. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +241 -0
  775. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js.map +1 -0
  776. package/dist/node_modules/@dalcode/dal-pi-kit/dist/index.d.ts +2 -0
  777. package/dist/node_modules/@dalcode/dal-pi-kit/dist/index.d.ts.map +1 -0
  778. package/dist/node_modules/@dalcode/dal-pi-kit/dist/index.js +2 -0
  779. package/dist/node_modules/@dalcode/dal-pi-kit/dist/index.js.map +1 -0
  780. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +20 -0
  781. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.ts +279 -0
  782. package/dist/node_modules/@dalcode/dal-pi-kit/src/index.ts +1 -0
  783. package/dist/node_modules/@dalcode/dal-subagent/LICENSE +21 -0
  784. package/dist/node_modules/@dalcode/dal-subagent/package.json +34 -0
  785. package/dist/node_modules/@dalcode/dal-subagent/src/index.ts +218 -0
  786. package/dist/node_modules/@dalcode/dal-telemetry/LICENSE +21 -0
  787. package/dist/node_modules/@dalcode/dal-telemetry/package.json +33 -0
  788. package/dist/node_modules/@dalcode/dal-telemetry/src/config.ts +114 -0
  789. package/dist/node_modules/@dalcode/dal-telemetry/src/index.ts +140 -0
  790. package/dist/node_modules/@dalcode/dal-telemetry/src/redact.ts +98 -0
  791. package/dist/node_modules/@dalcode/dal-telemetry/src/reporter.ts +132 -0
  792. package/dist/node_modules/@dalcode/deepailab/LICENSE +21 -0
  793. package/dist/node_modules/@dalcode/deepailab/package.json +33 -0
  794. package/dist/node_modules/@dalcode/deepailab/src/index.ts +268 -0
  795. package/dist/node_modules/@dalcode/deepailab/src/model-defaults.ts +136 -0
  796. package/dist/node_modules/@dalcode/deepailab/src/oidc.ts +507 -0
  797. package/dist/node_modules/@earendil-works/pi-agent-core/LICENSE +21 -0
  798. package/dist/node_modules/@earendil-works/pi-agent-core/README.md +517 -0
  799. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +24 -0
  800. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -0
  801. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +586 -0
  802. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -0
  803. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +122 -0
  804. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -0
  805. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent.js +422 -0
  806. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -0
  807. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +716 -0
  808. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -0
  809. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +6 -0
  810. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -0
  811. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +68 -0
  812. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -0
  813. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +176 -0
  814. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -0
  815. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +126 -0
  816. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -0
  817. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +560 -0
  818. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -0
  819. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +25 -0
  820. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts.map +1 -0
  821. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +120 -0
  822. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js.map +1 -0
  823. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/config.d.ts +9 -0
  824. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/config.d.ts.map +1 -0
  825. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js +27 -0
  826. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js.map +1 -0
  827. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.d.ts +9 -0
  828. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.d.ts.map +1 -0
  829. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js +13 -0
  830. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js.map +1 -0
  831. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts +42 -0
  832. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -0
  833. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +794 -0
  834. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -0
  835. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.d.ts +25 -0
  836. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.d.ts.map +1 -0
  837. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js +250 -0
  838. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js.map +1 -0
  839. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.d.ts +42 -0
  840. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.d.ts.map +1 -0
  841. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js +82 -0
  842. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js.map +1 -0
  843. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.d.ts +22 -0
  844. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.d.ts.map +1 -0
  845. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js +49 -0
  846. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js.map +1 -0
  847. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.d.ts +67 -0
  848. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.d.ts.map +1 -0
  849. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js +121 -0
  850. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js.map +1 -0
  851. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.d.ts +38 -0
  852. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.d.ts.map +1 -0
  853. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js +406 -0
  854. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js.map +1 -0
  855. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +51 -0
  856. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -0
  857. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +102 -0
  858. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -0
  859. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +49 -0
  860. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts.map +1 -0
  861. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +225 -0
  862. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js.map +1 -0
  863. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.d.ts +100 -0
  864. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.d.ts.map +1 -0
  865. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +415 -0
  866. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js.map +1 -0
  867. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.d.ts +133 -0
  868. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.d.ts.map +1 -0
  869. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.js +81 -0
  870. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.js.map +1 -0
  871. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.d.ts +28 -0
  872. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.d.ts.map +1 -0
  873. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js +170 -0
  874. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js.map +1 -0
  875. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.d.ts +8 -0
  876. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.d.ts.map +1 -0
  877. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js +133 -0
  878. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js.map +1 -0
  879. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.d.ts +15 -0
  880. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.d.ts.map +1 -0
  881. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js +179 -0
  882. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js.map +1 -0
  883. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.d.ts +8 -0
  884. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.d.ts.map +1 -0
  885. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js +205 -0
  886. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js.map +1 -0
  887. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.d.ts +5 -0
  888. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.d.ts.map +1 -0
  889. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js +140 -0
  890. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js.map +1 -0
  891. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.d.ts +8 -0
  892. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.d.ts.map +1 -0
  893. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js +85 -0
  894. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js.map +1 -0
  895. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.d.ts +23 -0
  896. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.d.ts.map +1 -0
  897. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js +394 -0
  898. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js.map +1 -0
  899. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.d.ts +4 -0
  900. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.d.ts.map +1 -0
  901. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js +37 -0
  902. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js.map +1 -0
  903. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.d.ts +32 -0
  904. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.d.ts.map +1 -0
  905. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js +929 -0
  906. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js.map +1 -0
  907. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.d.ts +7 -0
  908. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.d.ts.map +1 -0
  909. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js +49 -0
  910. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js.map +1 -0
  911. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.d.ts +14 -0
  912. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.d.ts.map +1 -0
  913. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js +244 -0
  914. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js.map +1 -0
  915. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.d.ts +6 -0
  916. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.d.ts.map +1 -0
  917. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js +449 -0
  918. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js.map +1 -0
  919. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.d.ts +6 -0
  920. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.d.ts.map +1 -0
  921. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js +93 -0
  922. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js.map +1 -0
  923. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.d.ts +59 -0
  924. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.d.ts.map +1 -0
  925. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js +311 -0
  926. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js.map +1 -0
  927. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.d.ts +2 -0
  928. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.d.ts.map +1 -0
  929. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js +2 -0
  930. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js.map +1 -0
  931. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.d.ts +101 -0
  932. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.d.ts.map +1 -0
  933. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js +1575 -0
  934. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js.map +1 -0
  935. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.d.ts +15 -0
  936. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.d.ts.map +1 -0
  937. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js +66 -0
  938. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js.map +1 -0
  939. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.d.ts +5 -0
  940. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.d.ts.map +1 -0
  941. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js +240 -0
  942. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js.map +1 -0
  943. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.d.ts +24 -0
  944. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.d.ts.map +1 -0
  945. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js +117 -0
  946. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js.map +1 -0
  947. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.d.ts +21 -0
  948. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.d.ts.map +1 -0
  949. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js +72 -0
  950. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js.map +1 -0
  951. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.d.ts +105 -0
  952. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.d.ts.map +1 -0
  953. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js +61 -0
  954. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js.map +1 -0
  955. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.d.ts +53 -0
  956. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.d.ts.map +1 -0
  957. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js +57 -0
  958. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js.map +1 -0
  959. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.d.ts +10 -0
  960. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.d.ts.map +1 -0
  961. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js +49 -0
  962. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js.map +1 -0
  963. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.d.ts +13 -0
  964. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.d.ts.map +1 -0
  965. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js +22 -0
  966. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js.map +1 -0
  967. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts +18 -0
  968. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts.map +1 -0
  969. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +127 -0
  970. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js.map +1 -0
  971. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.d.ts +39 -0
  972. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.d.ts.map +1 -0
  973. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js +216 -0
  974. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js.map +1 -0
  975. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.d.ts +11 -0
  976. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.d.ts.map +1 -0
  977. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.js +9 -0
  978. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.js.map +1 -0
  979. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.d.ts +21 -0
  980. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.d.ts.map +1 -0
  981. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js +45 -0
  982. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js.map +1 -0
  983. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.d.ts +9 -0
  984. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.d.ts.map +1 -0
  985. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +19 -0
  986. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js.map +1 -0
  987. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.d.ts +4 -0
  988. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.d.ts.map +1 -0
  989. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js +4 -0
  990. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js.map +1 -0
  991. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.d.ts +18 -0
  992. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.d.ts.map +1 -0
  993. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js +383 -0
  994. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js.map +1 -0
  995. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts +34 -0
  996. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts.map +1 -0
  997. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js +285 -0
  998. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js.map +1 -0
  999. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.d.ts +41 -0
  1000. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.d.ts.map +1 -0
  1001. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js +274 -0
  1002. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js.map +1 -0
  1003. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.d.ts +39 -0
  1004. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.d.ts.map +1 -0
  1005. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js +3 -0
  1006. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js.map +1 -0
  1007. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts +26 -0
  1008. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts.map +1 -0
  1009. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +103 -0
  1010. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js.map +1 -0
  1011. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts +42 -0
  1012. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -0
  1013. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +293 -0
  1014. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +1 -0
  1015. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.d.ts +3 -0
  1016. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.d.ts.map +1 -0
  1017. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +2 -0
  1018. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js.map +1 -0
  1019. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts +18 -0
  1020. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts.map +1 -0
  1021. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +42 -0
  1022. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js.map +1 -0
  1023. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts +33 -0
  1024. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -0
  1025. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +168 -0
  1026. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +1 -0
  1027. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts +50 -0
  1028. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts.map +1 -0
  1029. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js +374 -0
  1030. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js.map +1 -0
  1031. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.d.ts +8 -0
  1032. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.d.ts.map +1 -0
  1033. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js +21 -0
  1034. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js.map +1 -0
  1035. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts +11 -0
  1036. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -0
  1037. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +39 -0
  1038. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +1 -0
  1039. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +82 -0
  1040. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -0
  1041. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +361 -0
  1042. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -0
  1043. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.d.ts +65 -0
  1044. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.d.ts.map +1 -0
  1045. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +319 -0
  1046. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js.map +1 -0
  1047. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.d.ts +12 -0
  1048. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.d.ts.map +1 -0
  1049. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js +24 -0
  1050. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js.map +1 -0
  1051. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.d.ts +42 -0
  1052. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.d.ts.map +1 -0
  1053. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js +127 -0
  1054. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js.map +1 -0
  1055. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.d.ts +25 -0
  1056. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.d.ts.map +1 -0
  1057. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js +114 -0
  1058. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js.map +1 -0
  1059. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.d.ts +21 -0
  1060. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.d.ts.map +1 -0
  1061. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js +590 -0
  1062. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js.map +1 -0
  1063. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.d.ts +4 -0
  1064. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.d.ts.map +1 -0
  1065. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js +600 -0
  1066. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js.map +1 -0
  1067. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.d.ts +4 -0
  1068. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.d.ts.map +1 -0
  1069. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +762 -0
  1070. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js.map +1 -0
  1071. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.d.ts +26 -0
  1072. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.d.ts.map +1 -0
  1073. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js +100 -0
  1074. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js.map +1 -0
  1075. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.d.ts +10 -0
  1076. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.d.ts.map +1 -0
  1077. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.js +9 -0
  1078. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.js.map +1 -0
  1079. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.d.ts +11 -0
  1080. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.d.ts.map +1 -0
  1081. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js +16 -0
  1082. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js.map +1 -0
  1083. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.d.ts +20 -0
  1084. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.d.ts.map +1 -0
  1085. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js +41 -0
  1086. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js.map +1 -0
  1087. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.d.ts +12 -0
  1088. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.d.ts.map +1 -0
  1089. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.js +2 -0
  1090. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.js.map +1 -0
  1091. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts +511 -0
  1092. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts.map +1 -0
  1093. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js +9 -0
  1094. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js.map +1 -0
  1095. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.d.ts +95 -0
  1096. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.d.ts.map +1 -0
  1097. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js +81 -0
  1098. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js.map +1 -0
  1099. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +46 -0
  1100. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts.map +1 -0
  1101. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +326 -0
  1102. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js.map +1 -0
  1103. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts +3 -0
  1104. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts.map +1 -0
  1105. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +30 -0
  1106. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js.map +1 -0
  1107. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.d.ts +1242 -0
  1108. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.d.ts.map +1 -0
  1109. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.js +527 -0
  1110. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.js.map +1 -0
  1111. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.d.ts +27 -0
  1112. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.d.ts.map +1 -0
  1113. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js +105 -0
  1114. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js.map +1 -0
  1115. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.d.ts +89 -0
  1116. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.d.ts.map +1 -0
  1117. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.js +386 -0
  1118. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.js.map +1 -0
  1119. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.d.ts +19 -0
  1120. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.d.ts.map +1 -0
  1121. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +108 -0
  1122. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js.map +1 -0
  1123. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.d.ts +5 -0
  1124. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.d.ts.map +1 -0
  1125. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js +46 -0
  1126. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js.map +1 -0
  1127. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.d.ts +3 -0
  1128. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.d.ts.map +1 -0
  1129. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.js +106 -0
  1130. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.js.map +1 -0
  1131. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.d.ts +6 -0
  1132. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.d.ts.map +1 -0
  1133. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js +5 -0
  1134. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js.map +1 -0
  1135. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.d.ts +5 -0
  1136. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.d.ts.map +1 -0
  1137. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js +26 -0
  1138. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js.map +1 -0
  1139. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts +35 -0
  1140. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts.map +1 -0
  1141. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js +108 -0
  1142. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js.map +1 -0
  1143. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.d.ts +6 -0
  1144. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.d.ts.map +1 -0
  1145. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.js +2 -0
  1146. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.js.map +1 -0
  1147. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.d.ts +11 -0
  1148. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.d.ts.map +1 -0
  1149. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +31 -0
  1150. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js.map +1 -0
  1151. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +291 -0
  1152. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -0
  1153. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +75 -0
  1154. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -0
  1155. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.d.ts +24 -0
  1156. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.d.ts.map +1 -0
  1157. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js +79 -0
  1158. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js.map +1 -0
  1159. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.d.ts +31 -0
  1160. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.d.ts.map +1 -0
  1161. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js +217 -0
  1162. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js.map +1 -0
  1163. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +29 -0
  1164. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -0
  1165. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +71 -0
  1166. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -0
  1167. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts +71 -0
  1168. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -0
  1169. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +296 -0
  1170. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -0
  1171. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.d.ts +4 -0
  1172. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.d.ts.map +1 -0
  1173. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js +33 -0
  1174. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js.map +1 -0
  1175. package/dist/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +28 -0
  1176. package/dist/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -0
  1177. package/dist/node_modules/@earendil-works/pi-agent-core/dist/index.js +26 -0
  1178. package/dist/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -0
  1179. package/dist/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts +3 -0
  1180. package/dist/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts.map +1 -0
  1181. package/dist/node_modules/@earendil-works/pi-agent-core/dist/node.js +3 -0
  1182. package/dist/node_modules/@earendil-works/pi-agent-core/dist/node.js.map +1 -0
  1183. package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +72 -0
  1184. package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -0
  1185. package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +310 -0
  1186. package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -0
  1187. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/index.d.ts +29 -0
  1188. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/index.d.ts.map +1 -0
  1189. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/index.js +2 -0
  1190. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/index.js.map +1 -0
  1191. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.d.ts +29 -0
  1192. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.d.ts.map +1 -0
  1193. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +103 -0
  1194. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js.map +1 -0
  1195. package/dist/node_modules/@earendil-works/pi-agent-core/dist/stream-fn.d.ts +10 -0
  1196. package/dist/node_modules/@earendil-works/pi-agent-core/dist/stream-fn.d.ts.map +1 -0
  1197. package/dist/node_modules/@earendil-works/pi-agent-core/dist/stream-fn.js +17 -0
  1198. package/dist/node_modules/@earendil-works/pi-agent-core/dist/stream-fn.js.map +1 -0
  1199. package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +416 -0
  1200. package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -0
  1201. package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.js +2 -0
  1202. package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -0
  1203. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +68 -0
  1204. package/dist/node_modules/@earendil-works/pi-ai/LICENSE +21 -0
  1205. package/dist/node_modules/@earendil-works/pi-ai/README.md +1713 -0
  1206. package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +71 -0
  1207. package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -0
  1208. package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +1161 -0
  1209. package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -0
  1210. package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.d.ts +3 -0
  1211. package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.d.ts.map +1 -0
  1212. package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.js +3 -0
  1213. package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.js.map +1 -0
  1214. package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts +17 -0
  1215. package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -0
  1216. package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +249 -0
  1217. package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -0
  1218. package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.d.ts +3 -0
  1219. package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.d.ts.map +1 -0
  1220. package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.js +3 -0
  1221. package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.js.map +1 -0
  1222. package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts +38 -0
  1223. package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -0
  1224. package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1091 -0
  1225. package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -0
  1226. package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.d.ts +9 -0
  1227. package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.d.ts.map +1 -0
  1228. package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.js +30 -0
  1229. package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.js.map +1 -0
  1230. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.d.ts +77 -0
  1231. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.d.ts.map +1 -0
  1232. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.js +72 -0
  1233. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.js.map +1 -0
  1234. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.d.ts +69 -0
  1235. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.d.ts.map +1 -0
  1236. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +159 -0
  1237. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js.map +1 -0
  1238. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare.d.ts +9 -0
  1239. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare.d.ts.map +1 -0
  1240. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare.js +9 -0
  1241. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare.js.map +1 -0
  1242. package/dist/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.d.ts +20 -0
  1243. package/dist/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.d.ts.map +1 -0
  1244. package/dist/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js +222 -0
  1245. package/dist/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js.map +1 -0
  1246. package/dist/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-headers.d.ts +8 -0
  1247. package/dist/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-headers.d.ts.map +1 -0
  1248. package/dist/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-headers.js +29 -0
  1249. package/dist/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-headers.js.map +1 -0
  1250. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts +13 -0
  1251. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -0
  1252. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +421 -0
  1253. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -0
  1254. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.d.ts +3 -0
  1255. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.d.ts.map +1 -0
  1256. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.js +3 -0
  1257. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.js.map +1 -0
  1258. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts +84 -0
  1259. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts.map +1 -0
  1260. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +400 -0
  1261. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js.map +1 -0
  1262. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts +15 -0
  1263. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -0
  1264. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +470 -0
  1265. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -0
  1266. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.d.ts +3 -0
  1267. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.d.ts.map +1 -0
  1268. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.js +3 -0
  1269. package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.js.map +1 -0
  1270. package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts +19 -0
  1271. package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts.map +1 -0
  1272. package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +70 -0
  1273. package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.js.map +1 -0
  1274. package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts +25 -0
  1275. package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -0
  1276. package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +741 -0
  1277. package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -0
  1278. package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.d.ts +3 -0
  1279. package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.d.ts.map +1 -0
  1280. package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.js +3 -0
  1281. package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.js.map +1 -0
  1282. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts +31 -0
  1283. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -0
  1284. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +1300 -0
  1285. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -0
  1286. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.d.ts +3 -0
  1287. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.d.ts.map +1 -0
  1288. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.js +3 -0
  1289. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.js.map +1 -0
  1290. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +24 -0
  1291. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -0
  1292. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +1357 -0
  1293. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -0
  1294. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.d.ts +3 -0
  1295. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.d.ts.map +1 -0
  1296. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.js +3 -0
  1297. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.js.map +1 -0
  1298. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.d.ts +3 -0
  1299. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.d.ts.map +1 -0
  1300. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.js +10 -0
  1301. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.js.map +1 -0
  1302. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts +26 -0
  1303. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -0
  1304. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +689 -0
  1305. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -0
  1306. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +14 -0
  1307. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -0
  1308. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +298 -0
  1309. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -0
  1310. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.d.ts +3 -0
  1311. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.d.ts.map +1 -0
  1312. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.js +3 -0
  1313. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.js.map +1 -0
  1314. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.d.ts +3 -0
  1315. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.d.ts.map +1 -0
  1316. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +132 -0
  1317. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js.map +1 -0
  1318. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.lazy.d.ts +3 -0
  1319. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.lazy.d.ts.map +1 -0
  1320. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.lazy.js +4 -0
  1321. package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.lazy.js.map +1 -0
  1322. package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +99 -0
  1323. package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts.map +1 -0
  1324. package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +313 -0
  1325. package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -0
  1326. package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.d.ts +3 -0
  1327. package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.d.ts.map +1 -0
  1328. package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.js +3 -0
  1329. package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.js.map +1 -0
  1330. package/dist/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts +15 -0
  1331. package/dist/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -0
  1332. package/dist/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +66 -0
  1333. package/dist/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -0
  1334. package/dist/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.d.ts +8 -0
  1335. package/dist/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.d.ts.map +1 -0
  1336. package/dist/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js +187 -0
  1337. package/dist/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js.map +1 -0
  1338. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/context.d.ts +7 -0
  1339. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/context.d.ts.map +1 -0
  1340. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/context.js +42 -0
  1341. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/context.js.map +1 -0
  1342. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts +17 -0
  1343. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts.map +1 -0
  1344. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.js +51 -0
  1345. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.js.map +1 -0
  1346. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/helpers.d.ts +22 -0
  1347. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/helpers.d.ts.map +1 -0
  1348. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/helpers.js +53 -0
  1349. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/helpers.js.map +1 -0
  1350. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.d.ts +9 -0
  1351. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.d.ts.map +1 -0
  1352. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js +308 -0
  1353. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js.map +1 -0
  1354. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/device-code.d.ts +24 -0
  1355. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/device-code.d.ts.map +1 -0
  1356. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/device-code.js +69 -0
  1357. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/device-code.js.map +1 -0
  1358. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.d.ts +6 -0
  1359. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.d.ts.map +1 -0
  1360. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js +392 -0
  1361. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js.map +1 -0
  1362. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.d.ts +10 -0
  1363. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.d.ts.map +1 -0
  1364. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js +248 -0
  1365. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js.map +1 -0
  1366. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.d.ts +27 -0
  1367. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.d.ts.map +1 -0
  1368. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +59 -0
  1369. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js.map +1 -0
  1370. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/oauth-page.d.ts +3 -0
  1371. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/oauth-page.d.ts.map +1 -0
  1372. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/oauth-page.js +105 -0
  1373. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/oauth-page.js.map +1 -0
  1374. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.d.ts +9 -0
  1375. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.d.ts.map +1 -0
  1376. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js +450 -0
  1377. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js.map +1 -0
  1378. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts +15 -0
  1379. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts.map +1 -0
  1380. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +277 -0
  1381. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js.map +1 -0
  1382. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/pkce.d.ts +13 -0
  1383. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/pkce.d.ts.map +1 -0
  1384. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/pkce.js +31 -0
  1385. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/pkce.js.map +1 -0
  1386. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.d.ts +17 -0
  1387. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.d.ts.map +1 -0
  1388. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js +321 -0
  1389. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js.map +1 -0
  1390. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/xai.d.ts +6 -0
  1391. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/xai.d.ts.map +1 -0
  1392. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/xai.js +190 -0
  1393. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/xai.js.map +1 -0
  1394. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +27 -0
  1395. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -0
  1396. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +132 -0
  1397. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -0
  1398. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +231 -0
  1399. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts.map +1 -0
  1400. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/types.js +2 -0
  1401. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/types.js.map +1 -0
  1402. package/dist/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts +5 -0
  1403. package/dist/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts.map +1 -0
  1404. package/dist/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js +6 -0
  1405. package/dist/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js.map +1 -0
  1406. package/dist/node_modules/@earendil-works/pi-ai/dist/bun-oauth.d.ts +3 -0
  1407. package/dist/node_modules/@earendil-works/pi-ai/dist/bun-oauth.d.ts.map +1 -0
  1408. package/dist/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js +21 -0
  1409. package/dist/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js.map +1 -0
  1410. package/dist/node_modules/@earendil-works/pi-ai/dist/cli.d.ts +3 -0
  1411. package/dist/node_modules/@earendil-works/pi-ai/dist/cli.d.ts.map +1 -0
  1412. package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +113 -0
  1413. package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js.map +1 -0
  1414. package/dist/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +39 -0
  1415. package/dist/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts.map +1 -0
  1416. package/dist/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.js +2 -0
  1417. package/dist/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.js.map +1 -0
  1418. package/dist/node_modules/@earendil-works/pi-ai/dist/compat.d.ts +67 -0
  1419. package/dist/node_modules/@earendil-works/pi-ai/dist/compat.d.ts.map +1 -0
  1420. package/dist/node_modules/@earendil-works/pi-ai/dist/compat.js +205 -0
  1421. package/dist/node_modules/@earendil-works/pi-ai/dist/compat.js.map +1 -0
  1422. package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +21 -0
  1423. package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -0
  1424. package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +156 -0
  1425. package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -0
  1426. package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts +10 -0
  1427. package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts.map +1 -0
  1428. package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +785 -0
  1429. package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -0
  1430. package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +787 -0
  1431. package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -0
  1432. package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.js +23 -0
  1433. package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.js.map +1 -0
  1434. package/dist/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +14 -0
  1435. package/dist/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts.map +1 -0
  1436. package/dist/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js +22 -0
  1437. package/dist/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js.map +1 -0
  1438. package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.d.ts +95 -0
  1439. package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.d.ts.map +1 -0
  1440. package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.js +143 -0
  1441. package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.js.map +1 -0
  1442. package/dist/node_modules/@earendil-works/pi-ai/dist/images.d.ts +4 -0
  1443. package/dist/node_modules/@earendil-works/pi-ai/dist/images.d.ts.map +1 -0
  1444. package/dist/node_modules/@earendil-works/pi-ai/dist/images.js +14 -0
  1445. package/dist/node_modules/@earendil-works/pi-ai/dist/images.js.map +1 -0
  1446. package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts +36 -0
  1447. package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -0
  1448. package/dist/node_modules/@earendil-works/pi-ai/dist/index.js +23 -0
  1449. package/dist/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -0
  1450. package/dist/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.d.ts +42 -0
  1451. package/dist/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.d.ts.map +1 -0
  1452. package/dist/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.js +49 -0
  1453. package/dist/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.js.map +1 -0
  1454. package/dist/node_modules/@earendil-works/pi-ai/dist/model-catalog.d.ts +17 -0
  1455. package/dist/node_modules/@earendil-works/pi-ai/dist/model-catalog.d.ts.map +1 -0
  1456. package/dist/node_modules/@earendil-works/pi-ai/dist/model-catalog.js +4 -0
  1457. package/dist/node_modules/@earendil-works/pi-ai/dist/model-catalog.js.map +1 -0
  1458. package/dist/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts +29 -0
  1459. package/dist/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts.map +1 -0
  1460. package/dist/node_modules/@earendil-works/pi-ai/dist/models-store.js +17 -0
  1461. package/dist/node_modules/@earendil-works/pi-ai/dist/models-store.js.map +1 -0
  1462. package/dist/node_modules/@earendil-works/pi-ai/dist/models.d.ts +211 -0
  1463. package/dist/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -0
  1464. package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +81 -0
  1465. package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -0
  1466. package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.js +83 -0
  1467. package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -0
  1468. package/dist/node_modules/@earendil-works/pi-ai/dist/models.js +595 -0
  1469. package/dist/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -0
  1470. package/dist/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts +3 -0
  1471. package/dist/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts.map +1 -0
  1472. package/dist/node_modules/@earendil-works/pi-ai/dist/oauth.js +2 -0
  1473. package/dist/node_modules/@earendil-works/pi-ai/dist/oauth.js.map +1 -0
  1474. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts +28 -0
  1475. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -0
  1476. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/all.js +131 -0
  1477. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -0
  1478. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts +3 -0
  1479. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
  1480. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +93 -0
  1481. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -0
  1482. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts +4 -0
  1483. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts.map +1 -0
  1484. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js +6 -0
  1485. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js.map +1 -0
  1486. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.d.ts +3 -0
  1487. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.d.ts.map +1 -0
  1488. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.js +15 -0
  1489. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.js.map +1 -0
  1490. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.d.ts +4 -0
  1491. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.d.ts.map +1 -0
  1492. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js +6 -0
  1493. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js.map +1 -0
  1494. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +3 -0
  1495. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -0
  1496. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +83 -0
  1497. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -0
  1498. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts +4 -0
  1499. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts.map +1 -0
  1500. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js +6 -0
  1501. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js.map +1 -0
  1502. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts +3 -0
  1503. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
  1504. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +14 -0
  1505. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -0
  1506. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts +4 -0
  1507. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts.map +1 -0
  1508. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +6 -0
  1509. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js.map +1 -0
  1510. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/baseten.d.ts +3 -0
  1511. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/baseten.d.ts.map +1 -0
  1512. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/baseten.js +15 -0
  1513. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/baseten.js.map +1 -0
  1514. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/baseten.models.d.ts +4 -0
  1515. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/baseten.models.d.ts.map +1 -0
  1516. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/baseten.models.js +6 -0
  1517. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/baseten.models.js.map +1 -0
  1518. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.d.ts +3 -0
  1519. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.d.ts.map +1 -0
  1520. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.js +15 -0
  1521. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.js.map +1 -0
  1522. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.d.ts +4 -0
  1523. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.d.ts.map +1 -0
  1524. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js +6 -0
  1525. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js.map +1 -0
  1526. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts +3 -0
  1527. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -0
  1528. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js +27 -0
  1529. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js.map +1 -0
  1530. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts +4 -0
  1531. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts.map +1 -0
  1532. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js +6 -0
  1533. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js.map +1 -0
  1534. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.d.ts +4 -0
  1535. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.d.ts.map +1 -0
  1536. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.js +86 -0
  1537. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.js.map +1 -0
  1538. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-stream.d.ts +8 -0
  1539. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-stream.d.ts.map +1 -0
  1540. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-stream.js +21 -0
  1541. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-stream.js.map +1 -0
  1542. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.d.ts +3 -0
  1543. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.d.ts.map +1 -0
  1544. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.js +15 -0
  1545. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.js.map +1 -0
  1546. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.d.ts +4 -0
  1547. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.d.ts.map +1 -0
  1548. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js +6 -0
  1549. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js.map +1 -0
  1550. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -0
  1551. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -0
  1552. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/ant-ling.json +1 -0
  1553. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -0
  1554. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -0
  1555. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -0
  1556. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -0
  1557. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -0
  1558. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -0
  1559. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/deepseek.json +1 -0
  1560. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -0
  1561. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -0
  1562. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -0
  1563. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -0
  1564. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/groq.json +1 -0
  1565. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -0
  1566. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -0
  1567. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax-cn.json +1 -0
  1568. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax.json +1 -0
  1569. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -0
  1570. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -0
  1571. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -0
  1572. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -0
  1573. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -0
  1574. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -0
  1575. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -0
  1576. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -0
  1577. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -0
  1578. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -0
  1579. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual.json +1 -0
  1580. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -0
  1581. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -0
  1582. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -0
  1583. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -0
  1584. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -0
  1585. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -0
  1586. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -0
  1587. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -0
  1588. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -0
  1589. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -0
  1590. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.d.ts +3 -0
  1591. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.d.ts.map +1 -0
  1592. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.js +15 -0
  1593. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.js.map +1 -0
  1594. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts +4 -0
  1595. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts.map +1 -0
  1596. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js +6 -0
  1597. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js.map +1 -0
  1598. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +102 -0
  1599. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -0
  1600. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +488 -0
  1601. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -0
  1602. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.d.ts +3 -0
  1603. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.d.ts.map +1 -0
  1604. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.js +19 -0
  1605. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.js.map +1 -0
  1606. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts +4 -0
  1607. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts.map +1 -0
  1608. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js +6 -0
  1609. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js.map +1 -0
  1610. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.d.ts +3 -0
  1611. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.d.ts.map +1 -0
  1612. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js +34 -0
  1613. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js.map +1 -0
  1614. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts +4 -0
  1615. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts.map +1 -0
  1616. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js +6 -0
  1617. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js.map +1 -0
  1618. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts +3 -0
  1619. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts.map +1 -0
  1620. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js +94 -0
  1621. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js.map +1 -0
  1622. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.d.ts +4 -0
  1623. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.d.ts.map +1 -0
  1624. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.js +6 -0
  1625. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.js.map +1 -0
  1626. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts +3 -0
  1627. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts.map +1 -0
  1628. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google.js +15 -0
  1629. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google.js.map +1 -0
  1630. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google.models.d.ts +4 -0
  1631. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google.models.d.ts.map +1 -0
  1632. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google.models.js +6 -0
  1633. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google.models.js.map +1 -0
  1634. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/groq.d.ts +3 -0
  1635. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/groq.d.ts.map +1 -0
  1636. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/groq.js +15 -0
  1637. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/groq.js.map +1 -0
  1638. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.d.ts +4 -0
  1639. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.d.ts.map +1 -0
  1640. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js +6 -0
  1641. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js.map +1 -0
  1642. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.d.ts +3 -0
  1643. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.d.ts.map +1 -0
  1644. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.js +15 -0
  1645. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.js.map +1 -0
  1646. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.d.ts +4 -0
  1647. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.d.ts.map +1 -0
  1648. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js +6 -0
  1649. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js.map +1 -0
  1650. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts +4 -0
  1651. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts.map +1 -0
  1652. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +34 -0
  1653. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js.map +1 -0
  1654. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.d.ts +3 -0
  1655. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.d.ts.map +1 -0
  1656. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js +24 -0
  1657. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js.map +1 -0
  1658. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts +4 -0
  1659. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts.map +1 -0
  1660. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js +6 -0
  1661. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js.map +1 -0
  1662. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.d.ts +3 -0
  1663. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.d.ts.map +1 -0
  1664. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.js +15 -0
  1665. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.js.map +1 -0
  1666. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.d.ts +4 -0
  1667. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.d.ts.map +1 -0
  1668. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js +6 -0
  1669. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js.map +1 -0
  1670. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax.d.ts +3 -0
  1671. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax.d.ts.map +1 -0
  1672. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax.js +15 -0
  1673. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax.js.map +1 -0
  1674. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.d.ts +4 -0
  1675. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.d.ts.map +1 -0
  1676. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js +6 -0
  1677. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js.map +1 -0
  1678. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts +3 -0
  1679. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts.map +1 -0
  1680. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js +15 -0
  1681. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js.map +1 -0
  1682. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.d.ts +4 -0
  1683. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.d.ts.map +1 -0
  1684. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js +6 -0
  1685. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js.map +1 -0
  1686. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.d.ts +3 -0
  1687. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.d.ts.map +1 -0
  1688. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.js +15 -0
  1689. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.js.map +1 -0
  1690. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts +4 -0
  1691. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts.map +1 -0
  1692. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js +6 -0
  1693. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js.map +1 -0
  1694. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.d.ts +3 -0
  1695. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.d.ts.map +1 -0
  1696. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.js +15 -0
  1697. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.js.map +1 -0
  1698. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts +4 -0
  1699. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts.map +1 -0
  1700. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js +6 -0
  1701. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js.map +1 -0
  1702. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.d.ts +3 -0
  1703. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.d.ts.map +1 -0
  1704. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.js +15 -0
  1705. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.js.map +1 -0
  1706. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.d.ts +4 -0
  1707. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.d.ts.map +1 -0
  1708. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js +6 -0
  1709. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js.map +1 -0
  1710. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.d.ts +3 -0
  1711. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.d.ts.map +1 -0
  1712. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js +16 -0
  1713. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js.map +1 -0
  1714. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts +4 -0
  1715. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts.map +1 -0
  1716. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js +6 -0
  1717. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js.map +1 -0
  1718. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai.d.ts +3 -0
  1719. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai.d.ts.map +1 -0
  1720. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai.js +15 -0
  1721. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai.js.map +1 -0
  1722. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts +4 -0
  1723. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts.map +1 -0
  1724. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js +6 -0
  1725. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js.map +1 -0
  1726. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.d.ts +3 -0
  1727. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.d.ts.map +1 -0
  1728. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js +20 -0
  1729. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js.map +1 -0
  1730. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts +4 -0
  1731. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts.map +1 -0
  1732. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js +6 -0
  1733. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js.map +1 -0
  1734. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode.d.ts +3 -0
  1735. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode.d.ts.map +1 -0
  1736. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode.js +22 -0
  1737. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode.js.map +1 -0
  1738. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts +4 -0
  1739. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts.map +1 -0
  1740. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js +6 -0
  1741. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js.map +1 -0
  1742. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.d.ts +3 -0
  1743. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.d.ts.map +1 -0
  1744. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js +22 -0
  1745. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js.map +1 -0
  1746. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts +3 -0
  1747. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts.map +1 -0
  1748. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +27 -0
  1749. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js.map +1 -0
  1750. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts +4 -0
  1751. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts.map +1 -0
  1752. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +6 -0
  1753. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js.map +1 -0
  1754. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.d.ts +3 -0
  1755. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.d.ts.map +1 -0
  1756. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.js +15 -0
  1757. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.js.map +1 -0
  1758. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.d.ts +4 -0
  1759. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.d.ts.map +1 -0
  1760. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.js +6 -0
  1761. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.js.map +1 -0
  1762. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.d.ts +3 -0
  1763. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.d.ts.map +1 -0
  1764. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.js +15 -0
  1765. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.js.map +1 -0
  1766. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.d.ts +4 -0
  1767. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.d.ts.map +1 -0
  1768. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.js +6 -0
  1769. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.js.map +1 -0
  1770. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.d.ts +3 -0
  1771. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.d.ts.map +1 -0
  1772. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.js +15 -0
  1773. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.js.map +1 -0
  1774. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.d.ts +4 -0
  1775. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.d.ts.map +1 -0
  1776. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.js +6 -0
  1777. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.js.map +1 -0
  1778. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.d.ts +26 -0
  1779. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.d.ts.map +1 -0
  1780. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.js +63 -0
  1781. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.js.map +1 -0
  1782. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius.d.ts +9 -0
  1783. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius.d.ts.map +1 -0
  1784. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius.js +64 -0
  1785. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius.js.map +1 -0
  1786. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/together.d.ts +3 -0
  1787. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/together.d.ts.map +1 -0
  1788. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/together.js +15 -0
  1789. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/together.js.map +1 -0
  1790. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/together.models.d.ts +4 -0
  1791. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/together.models.d.ts.map +1 -0
  1792. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js +6 -0
  1793. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js.map +1 -0
  1794. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.d.ts +3 -0
  1795. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.d.ts.map +1 -0
  1796. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.js +15 -0
  1797. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.js.map +1 -0
  1798. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts +4 -0
  1799. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -0
  1800. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js +6 -0
  1801. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js.map +1 -0
  1802. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xai.d.ts +3 -0
  1803. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xai.d.ts.map +1 -0
  1804. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xai.js +19 -0
  1805. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xai.js.map +1 -0
  1806. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts +4 -0
  1807. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts.map +1 -0
  1808. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js +6 -0
  1809. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js.map +1 -0
  1810. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.d.ts +3 -0
  1811. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.d.ts.map +1 -0
  1812. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.js +15 -0
  1813. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.js.map +1 -0
  1814. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.d.ts +4 -0
  1815. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.d.ts.map +1 -0
  1816. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js +6 -0
  1817. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js.map +1 -0
  1818. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.d.ts +3 -0
  1819. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.d.ts.map +1 -0
  1820. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.js +15 -0
  1821. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.js.map +1 -0
  1822. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.d.ts +4 -0
  1823. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.d.ts.map +1 -0
  1824. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js +6 -0
  1825. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js.map +1 -0
  1826. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.d.ts +3 -0
  1827. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.d.ts.map +1 -0
  1828. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.js +15 -0
  1829. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.js.map +1 -0
  1830. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.d.ts +4 -0
  1831. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.d.ts.map +1 -0
  1832. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js +6 -0
  1833. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js.map +1 -0
  1834. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.d.ts +3 -0
  1835. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.d.ts.map +1 -0
  1836. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.js +15 -0
  1837. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.js.map +1 -0
  1838. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.d.ts +4 -0
  1839. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.d.ts.map +1 -0
  1840. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js +6 -0
  1841. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js.map +1 -0
  1842. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.d.ts +3 -0
  1843. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.d.ts.map +1 -0
  1844. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.js +15 -0
  1845. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.js.map +1 -0
  1846. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts +4 -0
  1847. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts.map +1 -0
  1848. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js +6 -0
  1849. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js.map +1 -0
  1850. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai.d.ts +3 -0
  1851. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai.d.ts.map +1 -0
  1852. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai.js +15 -0
  1853. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai.js.map +1 -0
  1854. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts +4 -0
  1855. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts.map +1 -0
  1856. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js +6 -0
  1857. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js.map +1 -0
  1858. package/dist/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts +4 -0
  1859. package/dist/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts.map +1 -0
  1860. package/dist/node_modules/@earendil-works/pi-ai/dist/session-resources.js +22 -0
  1861. package/dist/node_modules/@earendil-works/pi-ai/dist/session-resources.js.map +1 -0
  1862. package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts +743 -0
  1863. package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -0
  1864. package/dist/node_modules/@earendil-works/pi-ai/dist/types.js +2 -0
  1865. package/dist/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -0
  1866. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.d.ts +6 -0
  1867. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.d.ts.map +1 -0
  1868. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.js +34 -0
  1869. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.js.map +1 -0
  1870. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/abort.d.ts +8 -0
  1871. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/abort.d.ts.map +1 -0
  1872. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/abort.js +49 -0
  1873. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/abort.js.map +1 -0
  1874. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts +77 -0
  1875. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts.map +1 -0
  1876. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js +425 -0
  1877. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js.map +1 -0
  1878. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.d.ts +9 -0
  1879. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.d.ts.map +1 -0
  1880. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js +36 -0
  1881. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js.map +1 -0
  1882. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts +19 -0
  1883. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts.map +1 -0
  1884. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js +25 -0
  1885. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js.map +1 -0
  1886. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/error-body.d.ts +25 -0
  1887. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/error-body.d.ts.map +1 -0
  1888. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js +133 -0
  1889. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js.map +1 -0
  1890. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/estimate.d.ts +17 -0
  1891. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/estimate.d.ts.map +1 -0
  1892. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js +116 -0
  1893. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js.map +1 -0
  1894. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +21 -0
  1895. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -0
  1896. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +81 -0
  1897. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -0
  1898. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts +3 -0
  1899. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts.map +1 -0
  1900. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/hash.js +14 -0
  1901. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/hash.js.map +1 -0
  1902. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts +4 -0
  1903. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts.map +1 -0
  1904. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/headers.js +18 -0
  1905. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/headers.js.map +1 -0
  1906. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts +16 -0
  1907. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts.map +1 -0
  1908. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js +113 -0
  1909. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js.map +1 -0
  1910. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts +4 -0
  1911. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts.map +1 -0
  1912. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +133 -0
  1913. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js.map +1 -0
  1914. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +68 -0
  1915. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -0
  1916. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +172 -0
  1917. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -0
  1918. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.d.ts +2 -0
  1919. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.d.ts.map +1 -0
  1920. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.js +12 -0
  1921. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.js.map +1 -0
  1922. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/provider-env.d.ts +7 -0
  1923. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/provider-env.d.ts.map +1 -0
  1924. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/provider-env.js +44 -0
  1925. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/provider-env.js.map +1 -0
  1926. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts +16 -0
  1927. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts.map +1 -0
  1928. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js +94 -0
  1929. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js.map +1 -0
  1930. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +53 -0
  1931. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -0
  1932. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +176 -0
  1933. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -0
  1934. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts +22 -0
  1935. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
  1936. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js +26 -0
  1937. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js.map +1 -0
  1938. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/sleep.d.ts +2 -0
  1939. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/sleep.d.ts.map +1 -0
  1940. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/sleep.js +15 -0
  1941. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/sleep.js.map +1 -0
  1942. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.d.ts +6 -0
  1943. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.d.ts.map +1 -0
  1944. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.js +10 -0
  1945. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.js.map +1 -0
  1946. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts +17 -0
  1947. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts.map +1 -0
  1948. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js +21 -0
  1949. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js.map +1 -0
  1950. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/uuid.d.ts +3 -0
  1951. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/uuid.d.ts.map +1 -0
  1952. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/uuid.js +42 -0
  1953. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/uuid.js.map +1 -0
  1954. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts +18 -0
  1955. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts.map +1 -0
  1956. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/validation.js +309 -0
  1957. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/validation.js.map +1 -0
  1958. package/dist/node_modules/@earendil-works/pi-ai/package.json +87 -0
  1959. package/dist/node_modules/@earendil-works/pi-client/CHANGELOG.md +25 -0
  1960. package/dist/node_modules/@earendil-works/pi-client/LICENSE +21 -0
  1961. package/dist/node_modules/@earendil-works/pi-client/README.md +72 -0
  1962. package/dist/node_modules/@earendil-works/pi-client/dist/client.d.ts +30 -0
  1963. package/dist/node_modules/@earendil-works/pi-client/dist/client.d.ts.map +1 -0
  1964. package/dist/node_modules/@earendil-works/pi-client/dist/client.js +388 -0
  1965. package/dist/node_modules/@earendil-works/pi-client/dist/client.js.map +1 -0
  1966. package/dist/node_modules/@earendil-works/pi-client/dist/connection.d.ts +25 -0
  1967. package/dist/node_modules/@earendil-works/pi-client/dist/connection.d.ts.map +1 -0
  1968. package/dist/node_modules/@earendil-works/pi-client/dist/connection.js +208 -0
  1969. package/dist/node_modules/@earendil-works/pi-client/dist/connection.js.map +1 -0
  1970. package/dist/node_modules/@earendil-works/pi-client/dist/errors.d.ts +14 -0
  1971. package/dist/node_modules/@earendil-works/pi-client/dist/errors.d.ts.map +1 -0
  1972. package/dist/node_modules/@earendil-works/pi-client/dist/errors.js +28 -0
  1973. package/dist/node_modules/@earendil-works/pi-client/dist/errors.js.map +1 -0
  1974. package/dist/node_modules/@earendil-works/pi-client/dist/index.d.ts +5 -0
  1975. package/dist/node_modules/@earendil-works/pi-client/dist/index.d.ts.map +1 -0
  1976. package/dist/node_modules/@earendil-works/pi-client/dist/index.js +3 -0
  1977. package/dist/node_modules/@earendil-works/pi-client/dist/index.js.map +1 -0
  1978. package/dist/node_modules/@earendil-works/pi-client/dist/promise.d.ts +8 -0
  1979. package/dist/node_modules/@earendil-works/pi-client/dist/promise.d.ts.map +1 -0
  1980. package/dist/node_modules/@earendil-works/pi-client/dist/promise.js +11 -0
  1981. package/dist/node_modules/@earendil-works/pi-client/dist/promise.js.map +1 -0
  1982. package/dist/node_modules/@earendil-works/pi-client/dist/session-handle.d.ts +58 -0
  1983. package/dist/node_modules/@earendil-works/pi-client/dist/session-handle.d.ts.map +1 -0
  1984. package/dist/node_modules/@earendil-works/pi-client/dist/session-handle.js +57 -0
  1985. package/dist/node_modules/@earendil-works/pi-client/dist/session-handle.js.map +1 -0
  1986. package/dist/node_modules/@earendil-works/pi-client/dist/state.d.ts +22 -0
  1987. package/dist/node_modules/@earendil-works/pi-client/dist/state.d.ts.map +1 -0
  1988. package/dist/node_modules/@earendil-works/pi-client/dist/state.js +148 -0
  1989. package/dist/node_modules/@earendil-works/pi-client/dist/state.js.map +1 -0
  1990. package/dist/node_modules/@earendil-works/pi-client/dist/transport.d.ts +17 -0
  1991. package/dist/node_modules/@earendil-works/pi-client/dist/transport.d.ts.map +1 -0
  1992. package/dist/node_modules/@earendil-works/pi-client/dist/transport.js +2 -0
  1993. package/dist/node_modules/@earendil-works/pi-client/dist/transport.js.map +1 -0
  1994. package/dist/node_modules/@earendil-works/pi-client/dist/types.d.ts +28 -0
  1995. package/dist/node_modules/@earendil-works/pi-client/dist/types.d.ts.map +1 -0
  1996. package/dist/node_modules/@earendil-works/pi-client/dist/types.js +2 -0
  1997. package/dist/node_modules/@earendil-works/pi-client/dist/types.js.map +1 -0
  1998. package/dist/node_modules/@earendil-works/pi-client/dist/unix.d.ts +21 -0
  1999. package/dist/node_modules/@earendil-works/pi-client/dist/unix.d.ts.map +1 -0
  2000. package/dist/node_modules/@earendil-works/pi-client/dist/unix.js +281 -0
  2001. package/dist/node_modules/@earendil-works/pi-client/dist/unix.js.map +1 -0
  2002. package/dist/node_modules/@earendil-works/pi-client/package.json +45 -0
  2003. package/dist/node_modules/@earendil-works/pi-protocol/LICENSE +21 -0
  2004. package/dist/node_modules/@earendil-works/pi-protocol/README.md +41 -0
  2005. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.d.ts +4 -0
  2006. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.d.ts.map +1 -0
  2007. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.js +165 -0
  2008. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.js.map +1 -0
  2009. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.d.ts +4 -0
  2010. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.d.ts.map +1 -0
  2011. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.js +201 -0
  2012. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.js.map +1 -0
  2013. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/index.d.ts +4 -0
  2014. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/index.d.ts.map +1 -0
  2015. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/index.js +4 -0
  2016. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/index.js.map +1 -0
  2017. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/options.d.ts +26 -0
  2018. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/options.d.ts.map +1 -0
  2019. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/options.js +29 -0
  2020. package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/options.js.map +1 -0
  2021. package/dist/node_modules/@earendil-works/pi-protocol/dist/codec.d.ts +27 -0
  2022. package/dist/node_modules/@earendil-works/pi-protocol/dist/codec.d.ts.map +1 -0
  2023. package/dist/node_modules/@earendil-works/pi-protocol/dist/codec.js +119 -0
  2024. package/dist/node_modules/@earendil-works/pi-protocol/dist/codec.js.map +1 -0
  2025. package/dist/node_modules/@earendil-works/pi-protocol/dist/framing.d.ts +27 -0
  2026. package/dist/node_modules/@earendil-works/pi-protocol/dist/framing.d.ts.map +1 -0
  2027. package/dist/node_modules/@earendil-works/pi-protocol/dist/framing.js +140 -0
  2028. package/dist/node_modules/@earendil-works/pi-protocol/dist/framing.js.map +1 -0
  2029. package/dist/node_modules/@earendil-works/pi-protocol/dist/index.d.ts +5 -0
  2030. package/dist/node_modules/@earendil-works/pi-protocol/dist/index.d.ts.map +1 -0
  2031. package/dist/node_modules/@earendil-works/pi-protocol/dist/index.js +5 -0
  2032. package/dist/node_modules/@earendil-works/pi-protocol/dist/index.js.map +1 -0
  2033. package/dist/node_modules/@earendil-works/pi-protocol/dist/protocol.d.ts +167 -0
  2034. package/dist/node_modules/@earendil-works/pi-protocol/dist/protocol.d.ts.map +1 -0
  2035. package/dist/node_modules/@earendil-works/pi-protocol/dist/protocol.js +85 -0
  2036. package/dist/node_modules/@earendil-works/pi-protocol/dist/protocol.js.map +1 -0
  2037. package/dist/node_modules/@earendil-works/pi-protocol/dist/schemas.d.ts +14002 -0
  2038. package/dist/node_modules/@earendil-works/pi-protocol/dist/schemas.d.ts.map +1 -0
  2039. package/dist/node_modules/@earendil-works/pi-protocol/dist/schemas.js +468 -0
  2040. package/dist/node_modules/@earendil-works/pi-protocol/dist/schemas.js.map +1 -0
  2041. package/dist/node_modules/@earendil-works/pi-protocol/package.json +39 -0
  2042. package/dist/node_modules/@earendil-works/pi-telemetry/LICENSE +21 -0
  2043. package/dist/node_modules/@earendil-works/pi-telemetry/README.md +464 -0
  2044. package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.d.ts +194 -0
  2045. package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.d.ts.map +1 -0
  2046. package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.js +18 -0
  2047. package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.js.map +1 -0
  2048. package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.d.ts +26 -0
  2049. package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.d.ts.map +1 -0
  2050. package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.js +154 -0
  2051. package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.js.map +1 -0
  2052. package/dist/node_modules/@earendil-works/pi-telemetry/dist/noop.d.ts +4 -0
  2053. package/dist/node_modules/@earendil-works/pi-telemetry/dist/noop.d.ts.map +1 -0
  2054. package/dist/node_modules/@earendil-works/pi-telemetry/dist/noop.js +18 -0
  2055. package/dist/node_modules/@earendil-works/pi-telemetry/dist/noop.js.map +1 -0
  2056. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/conformance.d.ts +4 -0
  2057. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/conformance.d.ts.map +1 -0
  2058. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/conformance.js +294 -0
  2059. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/conformance.js.map +1 -0
  2060. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/index.d.ts +3 -0
  2061. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/index.d.ts.map +1 -0
  2062. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/index.js +2 -0
  2063. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/index.js.map +1 -0
  2064. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/types.d.ts +16 -0
  2065. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/types.d.ts.map +1 -0
  2066. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/types.js +2 -0
  2067. package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/types.js.map +1 -0
  2068. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +37 -0
  2069. package/dist/node_modules/@earendil-works/pi-tui/LICENSE +21 -0
  2070. package/dist/node_modules/@earendil-works/pi-tui/README.md +903 -0
  2071. package/dist/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.d.ts +46 -0
  2072. package/dist/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.d.ts.map +1 -0
  2073. package/dist/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.js +282 -0
  2074. package/dist/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.js.map +1 -0
  2075. package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +57 -0
  2076. package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -0
  2077. package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +665 -0
  2078. package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -0
  2079. package/dist/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.d.ts +13 -0
  2080. package/dist/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.d.ts.map +1 -0
  2081. package/dist/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.js +37 -0
  2082. package/dist/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.js.map +1 -0
  2083. package/dist/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +24 -0
  2084. package/dist/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -0
  2085. package/dist/node_modules/@earendil-works/pi-tui/dist/components/box.js +133 -0
  2086. package/dist/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -0
  2087. package/dist/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +22 -0
  2088. package/dist/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +1 -0
  2089. package/dist/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +35 -0
  2090. package/dist/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +1 -0
  2091. package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +269 -0
  2092. package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -0
  2093. package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.js +2086 -0
  2094. package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -0
  2095. package/dist/node_modules/@earendil-works/pi-tui/dist/components/h-stack.d.ts +7 -0
  2096. package/dist/node_modules/@earendil-works/pi-tui/dist/components/h-stack.d.ts.map +1 -0
  2097. package/dist/node_modules/@earendil-works/pi-tui/dist/components/h-stack.js +43 -0
  2098. package/dist/node_modules/@earendil-works/pi-tui/dist/components/h-stack.js.map +1 -0
  2099. package/dist/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +28 -0
  2100. package/dist/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -0
  2101. package/dist/node_modules/@earendil-works/pi-tui/dist/components/image.js +90 -0
  2102. package/dist/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -0
  2103. package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +48 -0
  2104. package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -0
  2105. package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js +417 -0
  2106. package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -0
  2107. package/dist/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +46 -0
  2108. package/dist/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -0
  2109. package/dist/node_modules/@earendil-works/pi-tui/dist/components/loader.js +97 -0
  2110. package/dist/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -0
  2111. package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +103 -0
  2112. package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -0
  2113. package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +813 -0
  2114. package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -0
  2115. package/dist/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.d.ts +12 -0
  2116. package/dist/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.d.ts.map +1 -0
  2117. package/dist/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.js +21 -0
  2118. package/dist/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.js.map +1 -0
  2119. package/dist/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts +63 -0
  2120. package/dist/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts.map +1 -0
  2121. package/dist/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js +216 -0
  2122. package/dist/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js.map +1 -0
  2123. package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +53 -0
  2124. package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +1 -0
  2125. package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +206 -0
  2126. package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +1 -0
  2127. package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +60 -0
  2128. package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -0
  2129. package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +252 -0
  2130. package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -0
  2131. package/dist/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +12 -0
  2132. package/dist/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +1 -0
  2133. package/dist/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +23 -0
  2134. package/dist/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +1 -0
  2135. package/dist/node_modules/@earendil-works/pi-tui/dist/components/stack.d.ts +38 -0
  2136. package/dist/node_modules/@earendil-works/pi-tui/dist/components/stack.d.ts.map +1 -0
  2137. package/dist/node_modules/@earendil-works/pi-tui/dist/components/stack.js +117 -0
  2138. package/dist/node_modules/@earendil-works/pi-tui/dist/components/stack.js.map +1 -0
  2139. package/dist/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +19 -0
  2140. package/dist/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +1 -0
  2141. package/dist/node_modules/@earendil-works/pi-tui/dist/components/text.js +90 -0
  2142. package/dist/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +1 -0
  2143. package/dist/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +13 -0
  2144. package/dist/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +1 -0
  2145. package/dist/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +51 -0
  2146. package/dist/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +1 -0
  2147. package/dist/node_modules/@earendil-works/pi-tui/dist/components/v-stack.d.ts +8 -0
  2148. package/dist/node_modules/@earendil-works/pi-tui/dist/components/v-stack.d.ts.map +1 -0
  2149. package/dist/node_modules/@earendil-works/pi-tui/dist/components/v-stack.js +35 -0
  2150. package/dist/node_modules/@earendil-works/pi-tui/dist/components/v-stack.js.map +1 -0
  2151. package/dist/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +41 -0
  2152. package/dist/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +1 -0
  2153. package/dist/node_modules/@earendil-works/pi-tui/dist/editor-component.js +2 -0
  2154. package/dist/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +1 -0
  2155. package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +16 -0
  2156. package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -0
  2157. package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +110 -0
  2158. package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -0
  2159. package/dist/node_modules/@earendil-works/pi-tui/dist/index.d.ts +32 -0
  2160. package/dist/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -0
  2161. package/dist/node_modules/@earendil-works/pi-tui/dist/index.js +43 -0
  2162. package/dist/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -0
  2163. package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +273 -0
  2164. package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -0
  2165. package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.js +233 -0
  2166. package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -0
  2167. package/dist/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +184 -0
  2168. package/dist/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +1 -0
  2169. package/dist/node_modules/@earendil-works/pi-tui/dist/keys.js +1174 -0
  2170. package/dist/node_modules/@earendil-works/pi-tui/dist/keys.js.map +1 -0
  2171. package/dist/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts +28 -0
  2172. package/dist/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +1 -0
  2173. package/dist/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +44 -0
  2174. package/dist/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +1 -0
  2175. package/dist/node_modules/@earendil-works/pi-tui/dist/latex.d.ts +10 -0
  2176. package/dist/node_modules/@earendil-works/pi-tui/dist/latex.d.ts.map +1 -0
  2177. package/dist/node_modules/@earendil-works/pi-tui/dist/latex.js +1285 -0
  2178. package/dist/node_modules/@earendil-works/pi-tui/dist/latex.js.map +1 -0
  2179. package/dist/node_modules/@earendil-works/pi-tui/dist/layout-node.d.ts +42 -0
  2180. package/dist/node_modules/@earendil-works/pi-tui/dist/layout-node.d.ts.map +1 -0
  2181. package/dist/node_modules/@earendil-works/pi-tui/dist/layout-node.js +6 -0
  2182. package/dist/node_modules/@earendil-works/pi-tui/dist/layout-node.js.map +1 -0
  2183. package/dist/node_modules/@earendil-works/pi-tui/dist/layout.d.ts +42 -0
  2184. package/dist/node_modules/@earendil-works/pi-tui/dist/layout.d.ts.map +1 -0
  2185. package/dist/node_modules/@earendil-works/pi-tui/dist/layout.js +498 -0
  2186. package/dist/node_modules/@earendil-works/pi-tui/dist/layout.js.map +1 -0
  2187. package/dist/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts +3 -0
  2188. package/dist/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +1 -0
  2189. package/dist/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +54 -0
  2190. package/dist/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +1 -0
  2191. package/dist/node_modules/@earendil-works/pi-tui/dist/native-module-path.d.ts +7 -0
  2192. package/dist/node_modules/@earendil-works/pi-tui/dist/native-module-path.d.ts.map +1 -0
  2193. package/dist/node_modules/@earendil-works/pi-tui/dist/native-module-path.js +19 -0
  2194. package/dist/node_modules/@earendil-works/pi-tui/dist/native-module-path.js.map +1 -0
  2195. package/dist/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +56 -0
  2196. package/dist/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +1 -0
  2197. package/dist/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +366 -0
  2198. package/dist/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +1 -0
  2199. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-colors.d.ts +10 -0
  2200. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-colors.d.ts.map +1 -0
  2201. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-colors.js +59 -0
  2202. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-colors.js.map +1 -0
  2203. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +118 -0
  2204. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -0
  2205. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +550 -0
  2206. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -0
  2207. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +123 -0
  2208. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -0
  2209. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.js +460 -0
  2210. package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -0
  2211. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +159 -0
  2212. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -0
  2213. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +1492 -0
  2214. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -0
  2215. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.d.ts +39 -0
  2216. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.d.ts.map +1 -0
  2217. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js +594 -0
  2218. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js.map +1 -0
  2219. package/dist/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +399 -0
  2220. package/dist/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -0
  2221. package/dist/node_modules/@earendil-works/pi-tui/dist/tui.js +1112 -0
  2222. package/dist/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -0
  2223. package/dist/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts +17 -0
  2224. package/dist/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +1 -0
  2225. package/dist/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +25 -0
  2226. package/dist/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +1 -0
  2227. package/dist/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +98 -0
  2228. package/dist/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -0
  2229. package/dist/node_modules/@earendil-works/pi-tui/dist/utils.js +1200 -0
  2230. package/dist/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -0
  2231. package/dist/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts +25 -0
  2232. package/dist/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts.map +1 -0
  2233. package/dist/node_modules/@earendil-works/pi-tui/dist/word-navigation.js +96 -0
  2234. package/dist/node_modules/@earendil-works/pi-tui/dist/word-navigation.js.map +1 -0
  2235. package/dist/node_modules/@earendil-works/pi-tui/native/darwin/README.md +20 -0
  2236. package/dist/node_modules/@earendil-works/pi-tui/native/darwin/build.sh +62 -0
  2237. package/dist/node_modules/@earendil-works/pi-tui/native/win32/README.md +22 -0
  2238. package/dist/node_modules/@earendil-works/pi-tui/native/win32/build.mjs +229 -0
  2239. package/dist/node_modules/@earendil-works/pi-tui/package.json +43 -0
  2240. package/dist/package-manager-cli.d.ts +10 -0
  2241. package/dist/package-manager-cli.d.ts.map +1 -0
  2242. package/dist/package-manager-cli.js +1054 -0
  2243. package/dist/package-manager-cli.js.map +1 -0
  2244. package/dist/rpc-entry.d.ts +3 -0
  2245. package/dist/rpc-entry.d.ts.map +1 -0
  2246. package/dist/rpc-entry.js +11 -0
  2247. package/dist/rpc-entry.js.map +1 -0
  2248. package/dist/server/create-harness.d.ts +26 -0
  2249. package/dist/server/create-harness.d.ts.map +1 -0
  2250. package/dist/server/create-harness.js +106 -0
  2251. package/dist/server/create-harness.js.map +1 -0
  2252. package/dist/utils/abort.d.ts +5 -0
  2253. package/dist/utils/abort.d.ts.map +1 -0
  2254. package/dist/utils/abort.js +48 -0
  2255. package/dist/utils/abort.js.map +1 -0
  2256. package/dist/utils/ansi.d.ts +2 -0
  2257. package/dist/utils/ansi.d.ts.map +1 -0
  2258. package/dist/utils/ansi.js +52 -0
  2259. package/dist/utils/ansi.js.map +1 -0
  2260. package/dist/utils/changelog.d.ts +24 -0
  2261. package/dist/utils/changelog.d.ts.map +1 -0
  2262. package/dist/utils/changelog.js +176 -0
  2263. package/dist/utils/changelog.js.map +1 -0
  2264. package/dist/utils/child-process.d.ts +18 -0
  2265. package/dist/utils/child-process.d.ts.map +1 -0
  2266. package/dist/utils/child-process.js +106 -0
  2267. package/dist/utils/child-process.js.map +1 -0
  2268. package/dist/utils/clipboard-image.d.ts +11 -0
  2269. package/dist/utils/clipboard-image.d.ts.map +1 -0
  2270. package/dist/utils/clipboard-image.js +245 -0
  2271. package/dist/utils/clipboard-image.js.map +1 -0
  2272. package/dist/utils/clipboard-native.d.ts +11 -0
  2273. package/dist/utils/clipboard-native.d.ts.map +1 -0
  2274. package/dist/utils/clipboard-native.js +20 -0
  2275. package/dist/utils/clipboard-native.js.map +1 -0
  2276. package/dist/utils/clipboard.d.ts +4 -0
  2277. package/dist/utils/clipboard.d.ts.map +1 -0
  2278. package/dist/utils/clipboard.js +161 -0
  2279. package/dist/utils/clipboard.js.map +1 -0
  2280. package/dist/utils/deprecation.d.ts +4 -0
  2281. package/dist/utils/deprecation.d.ts.map +1 -0
  2282. package/dist/utils/deprecation.js +13 -0
  2283. package/dist/utils/deprecation.js.map +1 -0
  2284. package/dist/utils/exif-orientation.d.ts +5 -0
  2285. package/dist/utils/exif-orientation.d.ts.map +1 -0
  2286. package/dist/utils/exif-orientation.js +157 -0
  2287. package/dist/utils/exif-orientation.js.map +1 -0
  2288. package/dist/utils/frontmatter.d.ts +8 -0
  2289. package/dist/utils/frontmatter.d.ts.map +1 -0
  2290. package/dist/utils/frontmatter.js +27 -0
  2291. package/dist/utils/frontmatter.js.map +1 -0
  2292. package/dist/utils/fs-watch.d.ts +5 -0
  2293. package/dist/utils/fs-watch.d.ts.map +1 -0
  2294. package/dist/utils/fs-watch.js +25 -0
  2295. package/dist/utils/fs-watch.js.map +1 -0
  2296. package/dist/utils/git.d.ts +26 -0
  2297. package/dist/utils/git.d.ts.map +1 -0
  2298. package/dist/utils/git.js +195 -0
  2299. package/dist/utils/git.js.map +1 -0
  2300. package/dist/utils/html.d.ts +7 -0
  2301. package/dist/utils/html.d.ts.map +1 -0
  2302. package/dist/utils/html.js +40 -0
  2303. package/dist/utils/html.js.map +1 -0
  2304. package/dist/utils/image-convert.d.ts +10 -0
  2305. package/dist/utils/image-convert.d.ts.map +1 -0
  2306. package/dist/utils/image-convert.js +45 -0
  2307. package/dist/utils/image-convert.js.map +1 -0
  2308. package/dist/utils/image-process.d.ts +18 -0
  2309. package/dist/utils/image-process.d.ts.map +1 -0
  2310. package/dist/utils/image-process.js +83 -0
  2311. package/dist/utils/image-process.js.map +1 -0
  2312. package/dist/utils/image-resize-core.d.ts +30 -0
  2313. package/dist/utils/image-resize-core.d.ts.map +1 -0
  2314. package/dist/utils/image-resize-core.js +124 -0
  2315. package/dist/utils/image-resize-core.js.map +1 -0
  2316. package/dist/utils/image-resize-worker.d.ts +2 -0
  2317. package/dist/utils/image-resize-worker.d.ts.map +1 -0
  2318. package/dist/utils/image-resize-worker.js +31 -0
  2319. package/dist/utils/image-resize-worker.js.map +1 -0
  2320. package/dist/utils/image-resize.d.ts +16 -0
  2321. package/dist/utils/image-resize.d.ts.map +1 -0
  2322. package/dist/utils/image-resize.js +97 -0
  2323. package/dist/utils/image-resize.js.map +1 -0
  2324. package/dist/utils/json.d.ts +3 -0
  2325. package/dist/utils/json.d.ts.map +1 -0
  2326. package/dist/utils/json.js +7 -0
  2327. package/dist/utils/json.js.map +1 -0
  2328. package/dist/utils/management-http.d.ts +25 -0
  2329. package/dist/utils/management-http.d.ts.map +1 -0
  2330. package/dist/utils/management-http.js +54 -0
  2331. package/dist/utils/management-http.js.map +1 -0
  2332. package/dist/utils/mime.d.ts +3 -0
  2333. package/dist/utils/mime.d.ts.map +1 -0
  2334. package/dist/utils/mime.js +110 -0
  2335. package/dist/utils/mime.js.map +1 -0
  2336. package/dist/utils/offline.d.ts +12 -0
  2337. package/dist/utils/offline.d.ts.map +1 -0
  2338. package/dist/utils/offline.js +19 -0
  2339. package/dist/utils/offline.js.map +1 -0
  2340. package/dist/utils/open-browser.d.ts +9 -0
  2341. package/dist/utils/open-browser.d.ts.map +1 -0
  2342. package/dist/utils/open-browser.js +22 -0
  2343. package/dist/utils/open-browser.js.map +1 -0
  2344. package/dist/utils/paths.d.ts +34 -0
  2345. package/dist/utils/paths.d.ts.map +1 -0
  2346. package/dist/utils/paths.js +114 -0
  2347. package/dist/utils/paths.js.map +1 -0
  2348. package/dist/utils/photon.d.ts +21 -0
  2349. package/dist/utils/photon.d.ts.map +1 -0
  2350. package/dist/utils/photon.js +121 -0
  2351. package/dist/utils/photon.js.map +1 -0
  2352. package/dist/utils/pi-user-agent.d.ts +2 -0
  2353. package/dist/utils/pi-user-agent.d.ts.map +1 -0
  2354. package/dist/utils/pi-user-agent.js +6 -0
  2355. package/dist/utils/pi-user-agent.js.map +1 -0
  2356. package/dist/utils/shell.d.ts +34 -0
  2357. package/dist/utils/shell.d.ts.map +1 -0
  2358. package/dist/utils/shell.js +216 -0
  2359. package/dist/utils/shell.js.map +1 -0
  2360. package/dist/utils/sleep.d.ts +5 -0
  2361. package/dist/utils/sleep.d.ts.map +1 -0
  2362. package/dist/utils/sleep.js +17 -0
  2363. package/dist/utils/sleep.js.map +1 -0
  2364. package/dist/utils/syntax-highlight.d.ts +13 -0
  2365. package/dist/utils/syntax-highlight.d.ts.map +1 -0
  2366. package/dist/utils/syntax-highlight.js +177 -0
  2367. package/dist/utils/syntax-highlight.js.map +1 -0
  2368. package/dist/utils/text.d.ts +8 -0
  2369. package/dist/utils/text.d.ts.map +1 -0
  2370. package/dist/utils/text.js +9 -0
  2371. package/dist/utils/text.js.map +1 -0
  2372. package/dist/utils/tool-result-images.d.ts +19 -0
  2373. package/dist/utils/tool-result-images.d.ts.map +1 -0
  2374. package/dist/utils/tool-result-images.js +45 -0
  2375. package/dist/utils/tool-result-images.js.map +1 -0
  2376. package/dist/utils/tools-manager.d.ts +13 -0
  2377. package/dist/utils/tools-manager.d.ts.map +1 -0
  2378. package/dist/utils/tools-manager.js +338 -0
  2379. package/dist/utils/tools-manager.js.map +1 -0
  2380. package/dist/utils/version-check.d.ts +23 -0
  2381. package/dist/utils/version-check.d.ts.map +1 -0
  2382. package/dist/utils/version-check.js +215 -0
  2383. package/dist/utils/version-check.js.map +1 -0
  2384. package/dist/utils/windows-self-update.d.ts +3 -0
  2385. package/dist/utils/windows-self-update.d.ts.map +1 -0
  2386. package/dist/utils/windows-self-update.js +77 -0
  2387. package/dist/utils/windows-self-update.js.map +1 -0
  2388. package/docs/configuration.md +59 -0
  2389. package/docs/extensions.md +85 -0
  2390. package/docs/index.md +77 -0
  2391. package/docs/security.md +56 -0
  2392. package/examples/README.md +28 -0
  2393. package/examples/extensions/README.md +213 -0
  2394. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  2395. package/examples/extensions/bash-spawn-hook.ts +30 -0
  2396. package/examples/extensions/bookmark.ts +50 -0
  2397. package/examples/extensions/border-status-editor.ts +150 -0
  2398. package/examples/extensions/built-in-tool-renderer.ts +249 -0
  2399. package/examples/extensions/claude-rules.ts +86 -0
  2400. package/examples/extensions/commands.ts +72 -0
  2401. package/examples/extensions/confirm-destructive.ts +59 -0
  2402. package/examples/extensions/custom-compaction.ts +117 -0
  2403. package/examples/extensions/custom-footer.ts +64 -0
  2404. package/examples/extensions/custom-header.ts +73 -0
  2405. package/examples/extensions/custom-provider-anthropic/index.ts +611 -0
  2406. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  2407. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  2408. package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
  2409. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  2410. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  2411. package/examples/extensions/dirty-repo-guard.ts +56 -0
  2412. package/examples/extensions/doom-overlay/README.md +46 -0
  2413. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  2414. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  2415. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  2416. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  2417. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  2418. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  2419. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  2420. package/examples/extensions/doom-overlay/index.ts +74 -0
  2421. package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
  2422. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  2423. package/examples/extensions/dynamic-resources/dynamic.json +81 -0
  2424. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  2425. package/examples/extensions/dynamic-resources/index.ts +15 -0
  2426. package/examples/extensions/dynamic-tools.ts +74 -0
  2427. package/examples/extensions/entry-renderer.ts +41 -0
  2428. package/examples/extensions/event-bus.ts +43 -0
  2429. package/examples/extensions/file-trigger.ts +41 -0
  2430. package/examples/extensions/git-checkpoint.ts +53 -0
  2431. package/examples/extensions/git-merge-and-resolve.ts +115 -0
  2432. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  2433. package/examples/extensions/gondolin/index.ts +531 -0
  2434. package/examples/extensions/gondolin/package-lock.json +185 -0
  2435. package/examples/extensions/gondolin/package.json +19 -0
  2436. package/examples/extensions/handoff.ts +190 -0
  2437. package/examples/extensions/hello.ts +26 -0
  2438. package/examples/extensions/hidden-thinking-label.ts +53 -0
  2439. package/examples/extensions/inline-bash.ts +94 -0
  2440. package/examples/extensions/input-transform-streaming.ts +39 -0
  2441. package/examples/extensions/input-transform.ts +43 -0
  2442. package/examples/extensions/interactive-shell.ts +196 -0
  2443. package/examples/extensions/kimi-deferred-tools.ts +61 -0
  2444. package/examples/extensions/mac-system-theme.ts +47 -0
  2445. package/examples/extensions/message-renderer.ts +59 -0
  2446. package/examples/extensions/minimal-mode.ts +426 -0
  2447. package/examples/extensions/modal-editor.ts +85 -0
  2448. package/examples/extensions/model-status.ts +31 -0
  2449. package/examples/extensions/notify.ts +57 -0
  2450. package/examples/extensions/official/git-checkpoint.ts +1 -0
  2451. package/examples/extensions/official/notify.ts +1 -0
  2452. package/examples/extensions/official/package.json +25 -0
  2453. package/examples/extensions/official/plan-mode.ts +1 -0
  2454. package/examples/extensions/official/todo.ts +1 -0
  2455. package/examples/extensions/overlay-qa-tests.ts +1450 -0
  2456. package/examples/extensions/overlay-test.ts +153 -0
  2457. package/examples/extensions/permission-gate.ts +34 -0
  2458. package/examples/extensions/pirate.ts +47 -0
  2459. package/examples/extensions/plan-mode/README.md +66 -0
  2460. package/examples/extensions/plan-mode/index.ts +382 -0
  2461. package/examples/extensions/plan-mode/utils.ts +168 -0
  2462. package/examples/extensions/preset.ts +436 -0
  2463. package/examples/extensions/project-trust.ts +64 -0
  2464. package/examples/extensions/prompt-customizer.ts +97 -0
  2465. package/examples/extensions/protected-paths.ts +30 -0
  2466. package/examples/extensions/provider-payload.ts +18 -0
  2467. package/examples/extensions/qna.ts +118 -0
  2468. package/examples/extensions/question.ts +286 -0
  2469. package/examples/extensions/questionnaire.ts +448 -0
  2470. package/examples/extensions/rainbow-editor.ts +88 -0
  2471. package/examples/extensions/reload-runtime.ts +37 -0
  2472. package/examples/extensions/rpc-demo.ts +118 -0
  2473. package/examples/extensions/sandbox/index.ts +321 -0
  2474. package/examples/extensions/sandbox/package-lock.json +92 -0
  2475. package/examples/extensions/sandbox/package.json +19 -0
  2476. package/examples/extensions/send-user-message.ts +97 -0
  2477. package/examples/extensions/session-name.ts +27 -0
  2478. package/examples/extensions/shutdown-command.ts +63 -0
  2479. package/examples/extensions/snake.ts +343 -0
  2480. package/examples/extensions/space-invaders.ts +560 -0
  2481. package/examples/extensions/ssh.ts +220 -0
  2482. package/examples/extensions/status-line.ts +32 -0
  2483. package/examples/extensions/structured-output.ts +65 -0
  2484. package/examples/extensions/subagent/README.md +177 -0
  2485. package/examples/extensions/subagent/agents/planner.md +37 -0
  2486. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  2487. package/examples/extensions/subagent/agents/scout.md +50 -0
  2488. package/examples/extensions/subagent/agents/worker.md +24 -0
  2489. package/examples/extensions/subagent/agents.ts +157 -0
  2490. package/examples/extensions/subagent/index.ts +1038 -0
  2491. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  2492. package/examples/extensions/subagent/prompts/implement.md +10 -0
  2493. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  2494. package/examples/extensions/summarize.ts +199 -0
  2495. package/examples/extensions/system-prompt-header.ts +17 -0
  2496. package/examples/extensions/tic-tac-toe.ts +1008 -0
  2497. package/examples/extensions/timed-confirm.ts +70 -0
  2498. package/examples/extensions/titlebar-spinner.ts +58 -0
  2499. package/examples/extensions/todo.ts +297 -0
  2500. package/examples/extensions/tool-override.ts +144 -0
  2501. package/examples/extensions/tools.ts +146 -0
  2502. package/examples/extensions/trigger-compact.ts +50 -0
  2503. package/examples/extensions/truncated-tool.ts +195 -0
  2504. package/examples/extensions/widget-placement.ts +9 -0
  2505. package/examples/extensions/with-deps/index.ts +32 -0
  2506. package/examples/extensions/with-deps/package-lock.json +31 -0
  2507. package/examples/extensions/with-deps/package.json +22 -0
  2508. package/examples/extensions/working-indicator.ts +123 -0
  2509. package/examples/extensions/working-message-test.ts +25 -0
  2510. package/examples/plugins/pi-example-plugin/README.md +38 -0
  2511. package/examples/plugins/pi-example-plugin/package.json +10 -0
  2512. package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
  2513. package/examples/plugins/pi-example-plugin/src/session.ts +23 -0
  2514. package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
  2515. package/examples/rpc-extension-ui.ts +641 -0
  2516. package/examples/sdk/01-minimal.ts +26 -0
  2517. package/examples/sdk/02-custom-model.ts +49 -0
  2518. package/examples/sdk/03-custom-prompt.ts +75 -0
  2519. package/examples/sdk/04-skills.ts +55 -0
  2520. package/examples/sdk/05-tools.ts +48 -0
  2521. package/examples/sdk/06-extensions.ts +99 -0
  2522. package/examples/sdk/07-context-files.ts +47 -0
  2523. package/examples/sdk/08-prompt-templates.ts +51 -0
  2524. package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  2525. package/examples/sdk/10-settings.ts +53 -0
  2526. package/examples/sdk/11-sessions.ts +52 -0
  2527. package/examples/sdk/12-full-control.ts +74 -0
  2528. package/examples/sdk/13-session-runtime.ts +67 -0
  2529. package/examples/sdk/README.md +140 -0
  2530. package/examples/skills/project-map/SKILL.md +18 -0
  2531. package/npm-shrinkwrap.json +2282 -0
  2532. package/package.json +114 -0
@@ -0,0 +1,2887 @@
1
+ /**
2
+ * AgentSession - Core abstraction for agent lifecycle and session management.
3
+ *
4
+ * This class is shared between all run modes (interactive, print, rpc).
5
+ * It encapsulates:
6
+ * - Agent state access
7
+ * - Event subscription with automatic session persistence
8
+ * - Model and thinking level management
9
+ * - Compaction (manual and auto)
10
+ * - Bash execution
11
+ * - Session switching and branching
12
+ *
13
+ * Modes use this class and add their own I/O layer on top.
14
+ */
15
+ import { readFileSync } from "node:fs";
16
+ import { basename, dirname } from "node:path";
17
+ import { contentText } from "@earendil-works/pi-ai";
18
+ import { clampThinkingLevel, cleanupSessionResources, getSupportedThinkingLevels, isContextOverflow, isRecoverableLength, isRetryableAssistantError, modelsAreEqual, resetApiProviders, streamSimple, } from "@earendil-works/pi-ai/compat";
19
+ import { getThemeByName, theme } from "../modes/interactive/theme/theme.js";
20
+ import { stripFrontmatter } from "../utils/frontmatter.js";
21
+ import { sleep } from "../utils/sleep.js";
22
+ import { normalizeToolResultImages } from "../utils/tool-result-images.js";
23
+ import { formatNoApiKeyFoundMessage, formatNoModelSelectedMessage } from "./auth-guidance.js";
24
+ import { executeBashWithOperations } from "./bash-executor.js";
25
+ import { calculateContextTokens, collectEntriesForBranchSummary, compact, estimateContextTokens, estimateTokens, generateBranchSummary, prepareCompaction, shouldCompact, } from "./compaction/index.js";
26
+ import { DEFAULT_THINKING_LEVEL, THINKING_LEVEL_OPTIONS } from "./defaults.js";
27
+ import { markBlankAssistantAsError } from "./empty-assistant.js";
28
+ import { exportSessionToHtml } from "./export-html/index.js";
29
+ import { createToolHtmlRenderer } from "./export-html/tool-renderer.js";
30
+ import { ExtensionRunner, wrapRegisteredTools, } from "./extensions/index.js";
31
+ import { emitSessionShutdownEvent } from "./extensions/runner.js";
32
+ import { ModelRegistry } from "./model-registry.js";
33
+ import { isPlaceholderModel, pickHouseModel } from "./model-resolver.js";
34
+ import { expandPromptTemplate } from "./prompt-templates.js";
35
+ import { exportSessionToJsonl } from "./session-export.js";
36
+ import { getLatestCompactionEntry } from "./session-manager.js";
37
+ import { createSyntheticSourceInfo } from "./source-info.js";
38
+ import { buildSystemPrompt } from "./system-prompt.js";
39
+ import { createLocalBashOperations } from "./tools/bash.js";
40
+ import { createAllToolDefinitions } from "./tools/index.js";
41
+ import { createToolDefinitionFromAgentTool } from "./tools/tool-definition-wrapper.js";
42
+ import { addUsageToTotals, createUsageTotals } from "./usage-totals.js";
43
+ /**
44
+ * Parse a skill block from message text.
45
+ * Returns null if the text doesn't contain a skill block.
46
+ */
47
+ export function parseSkillBlock(text) {
48
+ const match = text.match(/^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/);
49
+ if (!match)
50
+ return null;
51
+ return {
52
+ name: match[1],
53
+ location: match[2],
54
+ content: match[3],
55
+ userMessage: match[4]?.trim() || undefined,
56
+ };
57
+ }
58
+ // ============================================================================
59
+ // Types
60
+ // ============================================================================
61
+ function withoutDeletedHeaders(headers) {
62
+ return headers
63
+ ? Object.fromEntries(Object.entries(headers).filter((entry) => entry[1] !== null))
64
+ : undefined;
65
+ }
66
+ function estimateMessagesTokens(messages) {
67
+ let tokens = 0;
68
+ for (const message of messages) {
69
+ tokens += estimateTokens(message);
70
+ }
71
+ return tokens;
72
+ }
73
+ // ============================================================================
74
+ // Constants
75
+ // ============================================================================
76
+ // ============================================================================
77
+ // AgentSession Class
78
+ // ============================================================================
79
+ export class AgentSession {
80
+ agent;
81
+ sessionManager;
82
+ settingsManager;
83
+ _scopedModels;
84
+ // Event subscription state
85
+ _unsubscribeAgent;
86
+ _eventListeners = [];
87
+ _isAgentRunActive = false;
88
+ _idleWaitPromise;
89
+ _resolveIdleWait;
90
+ /** Tracks pending steering messages for UI display. Removed when delivered. */
91
+ _steeringMessages = [];
92
+ /** Tracks pending follow-up messages for UI display. Removed when delivered. */
93
+ _followUpMessages = [];
94
+ /** Messages queued to be included with the next user prompt as context ("asides"). */
95
+ _pendingNextTurnMessages = [];
96
+ /** Context-only custom messages queued during a run, flushed once the current turn's tool results are in. */
97
+ _pendingCustomMessages = [];
98
+ // Compaction state
99
+ _compactionAbortController = undefined;
100
+ _autoCompactionAbortController = undefined;
101
+ _overflowRecoveryAttempted = false;
102
+ // Branch summarization state
103
+ _branchSummaryAbortController = undefined;
104
+ // Retry state
105
+ _retryAbortController = undefined;
106
+ _retryAttempt = 0;
107
+ // Bash execution state
108
+ _bashAbortControllers = new Set();
109
+ _pendingBashMessages = [];
110
+ // Extension system
111
+ _extensionRunner;
112
+ _turnIndex = 0;
113
+ _resourceLoader;
114
+ _customTools;
115
+ _baseToolDefinitions = new Map();
116
+ _cwd;
117
+ _extensionRunnerRef;
118
+ _initialActiveToolNames;
119
+ _allowedToolNames;
120
+ _excludedToolNames;
121
+ _baseToolsOverride;
122
+ _sessionStartEvent;
123
+ _extensionUIContext;
124
+ _extensionMode = "print";
125
+ _extensionCommandContextActions;
126
+ _extensionAbortHandler;
127
+ _extensionShutdownHandler;
128
+ _extensionErrorListener;
129
+ _extensionErrorUnsubscriber;
130
+ _modelRuntime;
131
+ // See AgentSessionConfig.desiredModel. Cleared after the first reconcile attempt.
132
+ _desiredModel;
133
+ // Tool registry for extension getTools/setTools
134
+ _toolRegistry = new Map();
135
+ _toolDefinitions = new Map();
136
+ _toolPromptSnippets = new Map();
137
+ _toolPromptGuidelines = new Map();
138
+ // Base system prompt (without extension appends) - used to apply fresh appends each turn
139
+ _baseSystemPrompt = "";
140
+ _baseSystemPromptOptions;
141
+ _systemPromptOverride;
142
+ constructor(config) {
143
+ this.agent = config.agent;
144
+ this.sessionManager = config.sessionManager;
145
+ this.settingsManager = config.settingsManager;
146
+ this._scopedModels = config.scopedModels ?? [];
147
+ this._resourceLoader = config.resourceLoader;
148
+ this._customTools = config.customTools ?? [];
149
+ this._cwd = config.cwd;
150
+ this._modelRuntime = config.modelRuntime;
151
+ this._desiredModel = config.desiredModel;
152
+ this._extensionRunnerRef = config.extensionRunnerRef;
153
+ this._initialActiveToolNames = config.initialActiveToolNames;
154
+ this._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : undefined;
155
+ this._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : undefined;
156
+ this._baseToolsOverride = config.baseToolsOverride;
157
+ this._sessionStartEvent = config.sessionStartEvent ?? { type: "session_start", reason: "startup" };
158
+ // Always subscribe to agent events for internal handling
159
+ // (session persistence, extensions, auto-compaction, retry logic)
160
+ this._unsubscribeAgent = this.agent.subscribe(this._handleAgentEvent);
161
+ this._installAgentToolHooks();
162
+ this._installAgentNextTurnRefresh();
163
+ this._buildRuntime({
164
+ activeToolNames: this._initialActiveToolNames,
165
+ includeAllExtensionTools: true,
166
+ });
167
+ }
168
+ get modelRuntime() {
169
+ return this._modelRuntime;
170
+ }
171
+ async _getRequiredRequestAuth(model) {
172
+ let result;
173
+ try {
174
+ result = await this._modelRuntime.getAuth(model);
175
+ }
176
+ catch (error) {
177
+ const cause = error instanceof Error ? error.cause : undefined;
178
+ if (cause instanceof Error && cause.message === "authHeader requires a resolved API key") {
179
+ throw new Error(formatNoApiKeyFoundMessage(model.provider));
180
+ }
181
+ throw error;
182
+ }
183
+ if (result && (result.auth.apiKey || result.auth.headers)) {
184
+ const requestModel = result.auth.baseUrl ? { ...model, baseUrl: result.auth.baseUrl } : model;
185
+ return {
186
+ model: requestModel,
187
+ apiKey: result.auth.apiKey,
188
+ headers: withoutDeletedHeaders(result.auth.headers),
189
+ env: result.env,
190
+ };
191
+ }
192
+ const isOAuth = this._modelRuntime.isUsingOAuth(model.provider);
193
+ if (isOAuth) {
194
+ throw new Error(`Authentication failed for "${model.provider}". ` +
195
+ `Credentials may have expired or network is unavailable. ` +
196
+ `Run '/login ${model.provider}' to re-authenticate.`);
197
+ }
198
+ throw new Error(formatNoApiKeyFoundMessage(model.provider));
199
+ }
200
+ async _getSummarizationRequestAuth(model) {
201
+ if (this.agent.streamFunction === streamSimple) {
202
+ return this._getRequiredRequestAuth(model);
203
+ }
204
+ try {
205
+ const result = await this._modelRuntime.getAuth(model);
206
+ if (!result)
207
+ return { model };
208
+ const requestModel = result.auth.baseUrl ? { ...model, baseUrl: result.auth.baseUrl } : model;
209
+ return {
210
+ model: requestModel,
211
+ apiKey: result.auth.apiKey,
212
+ headers: withoutDeletedHeaders(result.auth.headers),
213
+ env: result.env,
214
+ };
215
+ }
216
+ catch {
217
+ return { model };
218
+ }
219
+ }
220
+ /**
221
+ * Install tool hooks once on the Agent instance.
222
+ *
223
+ * The callbacks read `this._extensionRunner` at execution time, so extension reload swaps in the
224
+ * new runner without reinstalling hooks. Extension-specific tool wrappers are still used to adapt
225
+ * registered tool execution to the extension context. Tool call and tool result interception now
226
+ * happens here instead of in wrappers.
227
+ */
228
+ _installAgentToolHooks() {
229
+ this.agent.beforeToolCall = async ({ toolCall, args }) => {
230
+ const runner = this._extensionRunner;
231
+ if (!runner.hasHandlers("tool_call")) {
232
+ return undefined;
233
+ }
234
+ try {
235
+ return await runner.emitToolCall({
236
+ type: "tool_call",
237
+ toolName: toolCall.name,
238
+ toolCallId: toolCall.id,
239
+ input: args,
240
+ });
241
+ }
242
+ catch (err) {
243
+ if (err instanceof Error) {
244
+ throw err;
245
+ }
246
+ throw new Error(`Extension failed, blocking execution: ${String(err)}`);
247
+ }
248
+ };
249
+ this.agent.afterToolCall = async ({ toolCall, args, result, isError }) => {
250
+ const runner = this._extensionRunner;
251
+ const hookResult = runner.hasHandlers("tool_result")
252
+ ? await runner.emitToolResult({
253
+ type: "tool_result",
254
+ toolName: toolCall.name,
255
+ toolCallId: toolCall.id,
256
+ input: args,
257
+ content: result.content,
258
+ details: result.details,
259
+ isError,
260
+ usage: result.usage,
261
+ })
262
+ : undefined;
263
+ const content = hookResult?.content ?? result.content ?? [];
264
+ // Runs after the extension hook so images injected or replaced by extensions are normalized too.
265
+ const normalizedContent = await normalizeToolResultImages(content, {
266
+ autoResizeImages: this.settingsManager.getImageAutoResize(),
267
+ });
268
+ if (!hookResult && normalizedContent === content) {
269
+ return undefined;
270
+ }
271
+ return {
272
+ content: normalizedContent,
273
+ details: hookResult?.details,
274
+ isError: hookResult?.isError ?? isError,
275
+ usage: hookResult?.usage,
276
+ };
277
+ };
278
+ }
279
+ async _compactBeforeNextAssistantResponse(context) {
280
+ const model = this.model;
281
+ const settings = this.settingsManager.getCompactionSettings();
282
+ if (!model ||
283
+ model.contextWindow <= 0 ||
284
+ !shouldCompact(estimateContextTokens(context.messages).tokens, model.contextWindow, settings)) {
285
+ return context;
286
+ }
287
+ await this._runAutoCompaction("threshold", false);
288
+ return {
289
+ ...context,
290
+ messages: this.agent.state.messages.slice(),
291
+ };
292
+ }
293
+ _installAgentNextTurnRefresh() {
294
+ const previousPrepareNextTurnWithContext = this.agent.prepareNextTurnWithContext ??
295
+ (this.agent.prepareNextTurn
296
+ ? async (_turn, signal) => await this.agent.prepareNextTurn?.(signal)
297
+ : undefined);
298
+ this.agent.prepareNextTurnWithContext = async (turn, signal) => {
299
+ const context = await this._compactBeforeNextAssistantResponse(turn.context);
300
+ const previousSnapshot = await previousPrepareNextTurnWithContext?.({ ...turn, context }, signal);
301
+ const nextContext = previousSnapshot?.context ?? context;
302
+ return {
303
+ ...previousSnapshot,
304
+ context: {
305
+ ...nextContext,
306
+ systemPrompt: this._systemPromptOverride ?? this._baseSystemPrompt,
307
+ tools: this.agent.state.tools.slice(),
308
+ },
309
+ model: this.agent.state.model,
310
+ thinkingLevel: this.agent.state.thinkingLevel,
311
+ };
312
+ };
313
+ }
314
+ // =========================================================================
315
+ // Event Subscription
316
+ // =========================================================================
317
+ /** Emit an event to all listeners */
318
+ _emit(event) {
319
+ for (const l of this._eventListeners) {
320
+ l(event);
321
+ }
322
+ }
323
+ _emitQueueUpdate() {
324
+ this._emit({
325
+ type: "queue_update",
326
+ steering: [...this._steeringMessages],
327
+ followUp: [...this._followUpMessages],
328
+ });
329
+ }
330
+ async _emitSessionCompactFailed(event) {
331
+ if (this._extensionRunner.hasHandlers("session_compact_failed")) {
332
+ await this._extensionRunner.emit({ type: "session_compact_failed", ...event });
333
+ }
334
+ }
335
+ _getIdleWaitPromise() {
336
+ if (!this._idleWaitPromise) {
337
+ this._idleWaitPromise = new Promise((resolve) => {
338
+ this._resolveIdleWait = resolve;
339
+ });
340
+ }
341
+ return this._idleWaitPromise;
342
+ }
343
+ _resolveIdleWaitIfIdle() {
344
+ if (!this.isIdle || !this._resolveIdleWait) {
345
+ return;
346
+ }
347
+ const resolve = this._resolveIdleWait;
348
+ this._idleWaitPromise = undefined;
349
+ this._resolveIdleWait = undefined;
350
+ resolve();
351
+ }
352
+ async _emitAgentSettled() {
353
+ this._isAgentRunActive = false;
354
+ try {
355
+ await this._extensionRunner.emit({ type: "agent_settled" });
356
+ this._emit({ type: "agent_settled" });
357
+ }
358
+ finally {
359
+ this._resolveIdleWaitIfIdle();
360
+ }
361
+ }
362
+ // Track last assistant message for auto-compaction check
363
+ _lastAssistantMessage = undefined;
364
+ /** Internal handler for agent events - shared by subscribe and reconnect */
365
+ _handleAgentEvent = async (event) => {
366
+ // When a user message starts, check if it's from either queue and remove it BEFORE emitting
367
+ // This ensures the UI sees the updated queue state
368
+ if (event.type === "message_start" && event.message.role === "user") {
369
+ this._overflowRecoveryAttempted = false;
370
+ const messageText = contentText(event.message.content, "");
371
+ if (messageText) {
372
+ // Check steering queue first
373
+ const steeringIndex = this._steeringMessages.indexOf(messageText);
374
+ if (steeringIndex !== -1) {
375
+ this._steeringMessages.splice(steeringIndex, 1);
376
+ this._emitQueueUpdate();
377
+ }
378
+ else {
379
+ // Check follow-up queue
380
+ const followUpIndex = this._followUpMessages.indexOf(messageText);
381
+ if (followUpIndex !== -1) {
382
+ this._followUpMessages.splice(followUpIndex, 1);
383
+ this._emitQueueUpdate();
384
+ }
385
+ }
386
+ }
387
+ }
388
+ if (event.type === "message_end" && event.message.role === "assistant") {
389
+ const original = event.message;
390
+ const rewritten = markBlankAssistantAsError(original);
391
+ if (rewritten !== original) {
392
+ event.message = rewritten;
393
+ const messages = this.agent.state.messages;
394
+ for (let i = messages.length - 1; i >= 0; i--) {
395
+ if (messages[i] === original) {
396
+ messages[i] = rewritten;
397
+ break;
398
+ }
399
+ }
400
+ }
401
+ }
402
+ // Emit to extensions first
403
+ await this._emitExtensionEvent(event);
404
+ // Notify all listeners
405
+ this._emit(event.type === "agent_end" ? { ...event, willRetry: this._willRetryAfterAgentEnd(event) } : event);
406
+ // Handle session persistence
407
+ if (event.type === "message_end") {
408
+ // Check if this is a custom message from extensions
409
+ if (event.message.role === "custom") {
410
+ // Persist as CustomMessageEntry
411
+ this.sessionManager.appendCustomMessageEntry(event.message.customType, event.message.content, event.message.display, event.message.details);
412
+ }
413
+ else if (event.message.role === "user" ||
414
+ event.message.role === "assistant" ||
415
+ event.message.role === "toolResult") {
416
+ // Regular LLM message - persist as SessionMessageEntry
417
+ this.sessionManager.appendMessage(event.message);
418
+ }
419
+ // Other message types (bashExecution, compactionSummary, branchSummary) are persisted elsewhere
420
+ // Track assistant message for auto-compaction (checked on agent_end)
421
+ if (event.message.role === "assistant") {
422
+ const assistantMsg = event.message;
423
+ this._lastAssistantMessage = assistantMsg;
424
+ if (assistantMsg.stopReason !== "error" && assistantMsg.stopReason !== "length") {
425
+ this._overflowRecoveryAttempted = false;
426
+ }
427
+ // Reset retry counter immediately on successful assistant response
428
+ // This prevents accumulation across multiple LLM calls within a turn
429
+ if (assistantMsg.stopReason !== "error" && this._retryAttempt > 0) {
430
+ this._emit({
431
+ type: "auto_retry_end",
432
+ success: true,
433
+ attempt: this._retryAttempt,
434
+ });
435
+ this._retryAttempt = 0;
436
+ }
437
+ }
438
+ }
439
+ // A turn ends after its assistant message and every tool result has been appended,
440
+ // so this is the first point in the run where a context-only custom message can be
441
+ // inserted without landing between a tool call and its result. Flushing after the
442
+ // extension and listener dispatch above also picks up messages that turn_end
443
+ // handlers queued.
444
+ if (event.type === "turn_end") {
445
+ this._flushPendingCustomMessages();
446
+ }
447
+ };
448
+ _willRetryAfterAgentEnd(event) {
449
+ const settings = this.settingsManager.getRetrySettings();
450
+ if (!settings.enabled || this._retryAttempt >= settings.maxRetries) {
451
+ return false;
452
+ }
453
+ for (let i = event.messages.length - 1; i >= 0; i--) {
454
+ const message = event.messages[i];
455
+ if (message.role === "assistant") {
456
+ return this._isRetryableError(message);
457
+ }
458
+ }
459
+ return false;
460
+ }
461
+ /** Find the last assistant message in agent state (including aborted ones) */
462
+ _findLastAssistantMessage() {
463
+ const messages = this.agent.state.messages;
464
+ for (let i = messages.length - 1; i >= 0; i--) {
465
+ const msg = messages[i];
466
+ if (msg.role === "assistant") {
467
+ return msg;
468
+ }
469
+ }
470
+ return undefined;
471
+ }
472
+ _replaceMessageInPlace(target, replacement) {
473
+ // Agent-core stores the finalized message object in its state before emitting message_end.
474
+ // SessionManager persistence happens later in _handleAgentEvent() with event.message.
475
+ // Mutating this object in place keeps agent state, later turn/agent events, listeners,
476
+ // and the eventual SessionManager.appendMessage(event.message) persistence in sync.
477
+ if (target === replacement) {
478
+ return;
479
+ }
480
+ const targetRecord = target;
481
+ for (const key of Object.keys(targetRecord)) {
482
+ delete targetRecord[key];
483
+ }
484
+ Object.assign(targetRecord, replacement);
485
+ }
486
+ /** Emit extension events based on agent events */
487
+ async _emitExtensionEvent(event) {
488
+ if (event.type === "agent_start") {
489
+ this._turnIndex = 0;
490
+ await this._extensionRunner.emit({ type: "agent_start" });
491
+ }
492
+ else if (event.type === "agent_end") {
493
+ await this._extensionRunner.emit({ type: "agent_end", messages: event.messages });
494
+ }
495
+ else if (event.type === "turn_start") {
496
+ const extensionEvent = {
497
+ type: "turn_start",
498
+ turnIndex: this._turnIndex,
499
+ timestamp: Date.now(),
500
+ };
501
+ await this._extensionRunner.emit(extensionEvent);
502
+ }
503
+ else if (event.type === "turn_end") {
504
+ const extensionEvent = {
505
+ type: "turn_end",
506
+ turnIndex: this._turnIndex,
507
+ message: event.message,
508
+ toolResults: event.toolResults,
509
+ };
510
+ await this._extensionRunner.emit(extensionEvent);
511
+ this._turnIndex++;
512
+ }
513
+ else if (event.type === "message_start") {
514
+ const extensionEvent = {
515
+ type: "message_start",
516
+ message: event.message,
517
+ };
518
+ await this._extensionRunner.emit(extensionEvent);
519
+ }
520
+ else if (event.type === "message_update") {
521
+ const extensionEvent = {
522
+ type: "message_update",
523
+ message: event.message,
524
+ assistantMessageEvent: event.assistantMessageEvent,
525
+ };
526
+ await this._extensionRunner.emit(extensionEvent);
527
+ }
528
+ else if (event.type === "message_end") {
529
+ const extensionEvent = {
530
+ type: "message_end",
531
+ message: event.message,
532
+ };
533
+ const replacement = await this._extensionRunner.emitMessageEnd(extensionEvent);
534
+ if (replacement) {
535
+ // Untyped extension handlers can return messages with null/missing content;
536
+ // normalize so it never enters agent state or session history.
537
+ const normalized = (replacement.role === "user" ||
538
+ replacement.role === "assistant" ||
539
+ replacement.role === "toolResult" ||
540
+ replacement.role === "custom") &&
541
+ replacement.content == null
542
+ ? { ...replacement, content: [] }
543
+ : replacement;
544
+ this._replaceMessageInPlace(event.message, normalized);
545
+ }
546
+ }
547
+ else if (event.type === "tool_execution_start") {
548
+ const extensionEvent = {
549
+ type: "tool_execution_start",
550
+ toolCallId: event.toolCallId,
551
+ toolName: event.toolName,
552
+ args: event.args,
553
+ };
554
+ await this._extensionRunner.emit(extensionEvent);
555
+ }
556
+ else if (event.type === "tool_execution_update") {
557
+ const extensionEvent = {
558
+ type: "tool_execution_update",
559
+ toolCallId: event.toolCallId,
560
+ toolName: event.toolName,
561
+ args: event.args,
562
+ partialResult: event.partialResult,
563
+ };
564
+ await this._extensionRunner.emit(extensionEvent);
565
+ }
566
+ else if (event.type === "tool_execution_end") {
567
+ const extensionEvent = {
568
+ type: "tool_execution_end",
569
+ toolCallId: event.toolCallId,
570
+ toolName: event.toolName,
571
+ result: event.result,
572
+ isError: event.isError,
573
+ };
574
+ await this._extensionRunner.emit(extensionEvent);
575
+ }
576
+ }
577
+ /**
578
+ * Subscribe to agent events.
579
+ * Session persistence is handled internally (saves messages on message_end).
580
+ * Multiple listeners can be added. Returns unsubscribe function for this listener.
581
+ */
582
+ subscribe(listener) {
583
+ this._eventListeners.push(listener);
584
+ // Return unsubscribe function for this specific listener
585
+ return () => {
586
+ const index = this._eventListeners.indexOf(listener);
587
+ if (index !== -1) {
588
+ this._eventListeners.splice(index, 1);
589
+ }
590
+ };
591
+ }
592
+ /** Disconnect from agent events during disposal. */
593
+ _disconnectFromAgent() {
594
+ if (this._unsubscribeAgent) {
595
+ this._unsubscribeAgent();
596
+ this._unsubscribeAgent = undefined;
597
+ }
598
+ }
599
+ /**
600
+ * Remove all listeners and disconnect from agent.
601
+ * Call this when completely done with the session.
602
+ */
603
+ dispose() {
604
+ try {
605
+ this.abortRetry();
606
+ this.abortCompaction();
607
+ this.abortBranchSummary();
608
+ this.abortBash();
609
+ this.agent.abort();
610
+ }
611
+ catch {
612
+ // Dispose must succeed even if an abort hook throws.
613
+ }
614
+ this._extensionRunner.invalidate("This extension ctx is stale after session replacement or reload. Do not use a captured pi or command ctx after ctx.newSession(), ctx.fork(), ctx.switchSession(), or ctx.reload(). For newSession, fork, and switchSession, move post-replacement work into withSession and use the ctx passed to withSession. For reload, do not use the old ctx after await ctx.reload().");
615
+ this._disconnectFromAgent();
616
+ this._eventListeners = [];
617
+ cleanupSessionResources(this.sessionId);
618
+ }
619
+ // =========================================================================
620
+ // Read-only State Access
621
+ // =========================================================================
622
+ /** Full agent state */
623
+ get state() {
624
+ return this.agent.state;
625
+ }
626
+ /** Current model (may be undefined if not yet selected) */
627
+ get model() {
628
+ return this.agent.state.model;
629
+ }
630
+ /** Current thinking level */
631
+ get thinkingLevel() {
632
+ return this.agent.state.thinkingLevel;
633
+ }
634
+ /** Whether the session is currently processing an agent run or post-run continuation. */
635
+ get isStreaming() {
636
+ return this._isAgentRunActive;
637
+ }
638
+ /** Whether the session has no active agent run, compaction, branch summary, retry, or queued continuation. */
639
+ get isIdle() {
640
+ return !this._isAgentRunActive && !this.isCompacting;
641
+ }
642
+ /** Current effective system prompt (includes any per-turn extension modifications) */
643
+ get systemPrompt() {
644
+ return this.agent.state.systemPrompt;
645
+ }
646
+ /** Current retry attempt (0 if not retrying) */
647
+ get retryAttempt() {
648
+ return this._retryAttempt;
649
+ }
650
+ /**
651
+ * Get the names of currently active tools.
652
+ * Returns the names of tools currently set on the agent.
653
+ */
654
+ getActiveToolNames() {
655
+ return this.agent.state.tools.map((t) => t.name);
656
+ }
657
+ /**
658
+ * Get all configured tools with name, description, parameter schema, prompt guidelines, and source metadata.
659
+ */
660
+ getAllTools() {
661
+ return Array.from(this._toolDefinitions.values()).map(({ definition, sourceInfo }) => ({
662
+ name: definition.name,
663
+ description: definition.description,
664
+ parameters: definition.parameters,
665
+ promptGuidelines: definition.promptGuidelines,
666
+ sourceInfo,
667
+ }));
668
+ }
669
+ getToolDefinition(name) {
670
+ return this._toolDefinitions.get(name)?.definition;
671
+ }
672
+ /**
673
+ * Set active tools by name.
674
+ * Only tools in the registry can be enabled. Unknown tool names are ignored.
675
+ * Also rebuilds the system prompt to reflect the new tool set.
676
+ * Changes take effect on the next agent turn.
677
+ */
678
+ setActiveToolsByName(toolNames) {
679
+ const tools = [];
680
+ const validToolNames = [];
681
+ for (const name of toolNames) {
682
+ const tool = this._toolRegistry.get(name);
683
+ if (tool) {
684
+ tools.push(tool);
685
+ validToolNames.push(name);
686
+ }
687
+ }
688
+ this.agent.state.tools = tools;
689
+ // Rebuild base system prompt with new tool set
690
+ this._baseSystemPrompt = this._rebuildSystemPrompt(validToolNames);
691
+ this.agent.state.systemPrompt = this._systemPromptOverride ?? this._baseSystemPrompt;
692
+ }
693
+ /** Whether compaction or branch summarization is currently running */
694
+ get isCompacting() {
695
+ return (this._autoCompactionAbortController !== undefined ||
696
+ this._compactionAbortController !== undefined ||
697
+ this._branchSummaryAbortController !== undefined);
698
+ }
699
+ /** All messages including custom types like BashExecutionMessage */
700
+ get messages() {
701
+ return this.agent.state.messages;
702
+ }
703
+ /** Current steering mode */
704
+ get steeringMode() {
705
+ return this.agent.steeringMode;
706
+ }
707
+ /** Current follow-up mode */
708
+ get followUpMode() {
709
+ return this.agent.followUpMode;
710
+ }
711
+ /** Current session file path, or undefined if sessions are disabled */
712
+ get sessionFile() {
713
+ return this.sessionManager.getSessionFile();
714
+ }
715
+ /** Current session ID */
716
+ get sessionId() {
717
+ return this.sessionManager.getSessionId();
718
+ }
719
+ /** Current session display name, if set */
720
+ get sessionName() {
721
+ return this.sessionManager.getSessionName();
722
+ }
723
+ /** Scoped models for cycling (from --models flag) */
724
+ get scopedModels() {
725
+ return this._scopedModels;
726
+ }
727
+ /** Update scoped models for cycling */
728
+ setScopedModels(scopedModels) {
729
+ this._scopedModels = scopedModels;
730
+ }
731
+ /** File-based prompt templates */
732
+ get promptTemplates() {
733
+ return this._resourceLoader.getPrompts().prompts;
734
+ }
735
+ _normalizePromptSnippet(text) {
736
+ if (!text)
737
+ return undefined;
738
+ const oneLine = text
739
+ .replace(/[\r\n]+/g, " ")
740
+ .replace(/\s+/g, " ")
741
+ .trim();
742
+ return oneLine.length > 0 ? oneLine : undefined;
743
+ }
744
+ _normalizePromptGuidelines(guidelines) {
745
+ if (!guidelines || guidelines.length === 0) {
746
+ return [];
747
+ }
748
+ const unique = new Set();
749
+ for (const guideline of guidelines) {
750
+ const normalized = guideline.trim();
751
+ if (normalized.length > 0) {
752
+ unique.add(normalized);
753
+ }
754
+ }
755
+ return Array.from(unique);
756
+ }
757
+ _rebuildSystemPrompt(toolNames) {
758
+ const validToolNames = toolNames.filter((name) => this._toolRegistry.has(name));
759
+ const toolSnippets = {};
760
+ const promptGuidelines = [];
761
+ for (const name of validToolNames) {
762
+ const snippet = this._toolPromptSnippets.get(name);
763
+ if (snippet) {
764
+ toolSnippets[name] = snippet;
765
+ }
766
+ const toolGuidelines = this._toolPromptGuidelines.get(name);
767
+ if (toolGuidelines) {
768
+ promptGuidelines.push(...toolGuidelines);
769
+ }
770
+ }
771
+ const loaderSystemPrompt = this._resourceLoader.getSystemPrompt();
772
+ const loaderAppendSystemPrompt = this._resourceLoader.getAppendSystemPrompt();
773
+ const appendSystemPrompt = loaderAppendSystemPrompt.length > 0 ? loaderAppendSystemPrompt.join("\n\n") : undefined;
774
+ const loadedSkills = this._resourceLoader.getSkills().skills;
775
+ const loadedContextFiles = this._resourceLoader.getAgentsFiles().agentsFiles;
776
+ this._baseSystemPromptOptions = {
777
+ cwd: this._cwd,
778
+ skills: loadedSkills,
779
+ contextFiles: loadedContextFiles,
780
+ customPrompt: loaderSystemPrompt,
781
+ appendSystemPrompt,
782
+ selectedTools: validToolNames,
783
+ toolSnippets,
784
+ promptGuidelines,
785
+ };
786
+ return buildSystemPrompt(this._baseSystemPromptOptions);
787
+ }
788
+ // =========================================================================
789
+ // Prompting
790
+ // =========================================================================
791
+ async _runAgentPrompt(messages) {
792
+ this._isAgentRunActive = true;
793
+ try {
794
+ await this.agent.prompt(messages);
795
+ while (await this._handlePostAgentRun()) {
796
+ await this.agent.continue();
797
+ }
798
+ }
799
+ finally {
800
+ this._systemPromptOverride = undefined;
801
+ this._flushPendingBashMessages();
802
+ this._flushPendingCustomMessages();
803
+ await this._emitAgentSettled();
804
+ }
805
+ }
806
+ async _handlePostAgentRun() {
807
+ const msg = this._lastAssistantMessage;
808
+ this._lastAssistantMessage = undefined;
809
+ if (!msg) {
810
+ return false;
811
+ }
812
+ if (this._isRetryableError(msg) && (await this._prepareRetry(msg))) {
813
+ return true;
814
+ }
815
+ if (msg.stopReason === "error" && this._retryAttempt > 0) {
816
+ this._emit({
817
+ type: "auto_retry_end",
818
+ success: false,
819
+ attempt: this._retryAttempt,
820
+ finalError: msg.errorMessage,
821
+ });
822
+ this._retryAttempt = 0;
823
+ }
824
+ if (await this._checkCompaction(msg)) {
825
+ return true;
826
+ }
827
+ // The agent loop drains both queues before emitting agent_end. Any messages
828
+ // here were queued by agent_end extension handlers and need a continuation.
829
+ return this.agent.hasQueuedMessages();
830
+ }
831
+ /**
832
+ * Send a prompt to the agent.
833
+ * - Handles extension commands (registered via pi.registerCommand) immediately, even during streaming
834
+ * - Expands file-based prompt templates by default
835
+ * - During streaming, queues via steer() or followUp() based on streamingBehavior option
836
+ * - Validates model and API key before sending (when not streaming)
837
+ * @throws Error if streaming and no streamingBehavior specified
838
+ * @throws Error if no model selected or no API key available (when not streaming)
839
+ */
840
+ async prompt(text, options) {
841
+ const expandPromptTemplates = options?.expandPromptTemplates ?? true;
842
+ const preflightResult = options?.preflightResult;
843
+ let messages;
844
+ try {
845
+ // Handle extension commands first (execute immediately, even during streaming)
846
+ // Extension commands manage their own LLM interaction via pi.sendMessage()
847
+ if (expandPromptTemplates && text.startsWith("/")) {
848
+ const handled = await this._tryExecuteExtensionCommand(text);
849
+ if (handled) {
850
+ // Extension command executed, no prompt to send
851
+ preflightResult?.(true);
852
+ return;
853
+ }
854
+ }
855
+ if (this._compactionAbortController !== undefined) {
856
+ throw new Error("Cannot submit a prompt while compaction is in progress. Wait for compaction to finish and retry.");
857
+ }
858
+ // Emit input event for extension interception (before skill/template expansion)
859
+ let currentText = text;
860
+ let currentImages = options?.images;
861
+ if (this._extensionRunner.hasHandlers("input")) {
862
+ const inputResult = await this._extensionRunner.emitInput(currentText, currentImages, options?.source ?? "interactive", this.isStreaming ? options?.streamingBehavior : undefined);
863
+ if (inputResult.action === "handled") {
864
+ preflightResult?.(true);
865
+ return;
866
+ }
867
+ if (inputResult.action === "transform") {
868
+ currentText = inputResult.text;
869
+ currentImages = inputResult.images ?? currentImages;
870
+ }
871
+ }
872
+ // Expand skill commands (/skill:name args) and prompt templates (/template args)
873
+ let expandedText = currentText;
874
+ if (expandPromptTemplates) {
875
+ expandedText = this._expandSkillCommand(expandedText);
876
+ expandedText = expandPromptTemplate(expandedText, [...this.promptTemplates]);
877
+ }
878
+ // If streaming, queue via steer() or followUp() based on option
879
+ if (this.isStreaming) {
880
+ if (!options?.streamingBehavior) {
881
+ throw new Error("Agent is already processing. Specify streamingBehavior ('steer' or 'followUp') to queue the message.");
882
+ }
883
+ if (options.streamingBehavior === "followUp") {
884
+ await this._queueFollowUp(expandedText, currentImages);
885
+ }
886
+ else {
887
+ await this._queueSteer(expandedText, currentImages);
888
+ }
889
+ preflightResult?.(true);
890
+ return;
891
+ }
892
+ // Flush any pending bash and custom messages before the new prompt
893
+ this._flushPendingBashMessages();
894
+ this._flushPendingCustomMessages();
895
+ // Validate model
896
+ if (!this.model) {
897
+ throw new Error(formatNoModelSelectedMessage());
898
+ }
899
+ const hasConfiguredAuth = this._modelRuntime.hasConfiguredAuth(this.model.provider) ||
900
+ (await this._modelRuntime.checkAuth(this.model.provider)) !== undefined;
901
+ if (!hasConfiguredAuth) {
902
+ const isOAuth = this._modelRuntime.isUsingOAuth(this.model.provider);
903
+ if (isOAuth) {
904
+ throw new Error(`Authentication failed for "${this.model.provider}". ` +
905
+ `Credentials may have expired or network is unavailable. ` +
906
+ `Run '/login ${this.model.provider}' to re-authenticate.`);
907
+ }
908
+ throw new Error(formatNoApiKeyFoundMessage(this.model.provider));
909
+ }
910
+ // Check if we need to compact before sending (catches aborted responses).
911
+ // The user's new prompt is sent below, so do not call agent.continue() here.
912
+ const lastAssistant = this._findLastAssistantMessage();
913
+ if (lastAssistant) {
914
+ await this._checkCompaction(lastAssistant, false);
915
+ }
916
+ // Build messages array (custom message if any, then user message)
917
+ messages = [];
918
+ // Add user message
919
+ const userContent = [{ type: "text", text: expandedText }];
920
+ if (currentImages) {
921
+ userContent.push(...currentImages);
922
+ }
923
+ messages.push({
924
+ role: "user",
925
+ content: userContent,
926
+ timestamp: Date.now(),
927
+ });
928
+ // Inject any pending "nextTurn" messages as context alongside the user message
929
+ for (const msg of this._pendingNextTurnMessages) {
930
+ messages.push(msg);
931
+ }
932
+ this._pendingNextTurnMessages = [];
933
+ // Emit before_agent_start extension event
934
+ const result = await this._extensionRunner.emitBeforeAgentStart(expandedText, currentImages, this._baseSystemPrompt, this._baseSystemPromptOptions);
935
+ // Add all custom messages from extensions
936
+ if (result?.messages) {
937
+ for (const msg of result.messages) {
938
+ messages.push({
939
+ role: "custom",
940
+ customType: msg.customType,
941
+ // Untyped extensions can pass null/missing content; normalize at ingestion.
942
+ content: msg.content ?? [],
943
+ display: msg.display,
944
+ details: msg.details,
945
+ timestamp: Date.now(),
946
+ });
947
+ }
948
+ }
949
+ // Apply extension-modified system prompt, or reset to base
950
+ if (result?.systemPrompt !== undefined) {
951
+ this._systemPromptOverride = result.systemPrompt;
952
+ this.agent.state.systemPrompt = result.systemPrompt;
953
+ }
954
+ else {
955
+ // Ensure we're using the base prompt (in case previous turn had modifications)
956
+ this._systemPromptOverride = undefined;
957
+ this.agent.state.systemPrompt = this._baseSystemPrompt;
958
+ }
959
+ }
960
+ catch (error) {
961
+ preflightResult?.(false);
962
+ throw error;
963
+ }
964
+ if (!messages) {
965
+ return;
966
+ }
967
+ preflightResult?.(true);
968
+ await this._runAgentPrompt(messages);
969
+ }
970
+ /**
971
+ * Try to execute an extension command. Returns true if command was found and executed.
972
+ */
973
+ async _tryExecuteExtensionCommand(text) {
974
+ // Parse command name and args
975
+ const spaceIndex = text.indexOf(" ");
976
+ const commandName = spaceIndex === -1 ? text.slice(1) : text.slice(1, spaceIndex);
977
+ const args = spaceIndex === -1 ? "" : text.slice(spaceIndex + 1);
978
+ const command = this._extensionRunner.getCommand(commandName);
979
+ if (!command)
980
+ return false;
981
+ // Get command context from extension runner (includes session control methods)
982
+ const ctx = this._extensionRunner.createCommandContext();
983
+ try {
984
+ await command.handler(args, ctx);
985
+ return true;
986
+ }
987
+ catch (err) {
988
+ // Emit error via extension runner
989
+ this._extensionRunner.emitError({
990
+ extensionPath: `command:${commandName}`,
991
+ event: "command",
992
+ error: err instanceof Error ? err.message : String(err),
993
+ });
994
+ return true;
995
+ }
996
+ }
997
+ /**
998
+ * Expand skill commands (/skill:name args) to their full content.
999
+ * Returns the expanded text, or the original text if not a skill command or skill not found.
1000
+ * Emits errors via extension runner if file read fails.
1001
+ */
1002
+ _expandSkillCommand(text) {
1003
+ if (!text.startsWith("/skill:"))
1004
+ return text;
1005
+ const spaceIndex = text.indexOf(" ");
1006
+ const skillName = spaceIndex === -1 ? text.slice(7) : text.slice(7, spaceIndex);
1007
+ const args = spaceIndex === -1 ? "" : text.slice(spaceIndex + 1).trim();
1008
+ const skill = this.resourceLoader.getSkills().skills.find((s) => s.name === skillName);
1009
+ if (!skill)
1010
+ return text; // Unknown skill, pass through
1011
+ try {
1012
+ const content = readFileSync(skill.filePath, "utf-8");
1013
+ const body = stripFrontmatter(content).trim();
1014
+ const skillBlock = `<skill name="${skill.name}" location="${skill.filePath}">\nReferences are relative to ${skill.baseDir}.\n\n${body}\n</skill>`;
1015
+ return args ? `${skillBlock}\n\n${args}` : skillBlock;
1016
+ }
1017
+ catch (err) {
1018
+ // Emit error like extension commands do
1019
+ this._extensionRunner.emitError({
1020
+ extensionPath: skill.filePath,
1021
+ event: "skill_expansion",
1022
+ error: err instanceof Error ? err.message : String(err),
1023
+ });
1024
+ return text; // Return original on error
1025
+ }
1026
+ }
1027
+ /**
1028
+ * Queue a steering message while the agent is running.
1029
+ * Delivered after the current assistant turn finishes executing its tool calls,
1030
+ * before the next LLM call.
1031
+ * Expands skill commands and prompt templates. Errors on extension commands.
1032
+ * @param images Optional image attachments to include with the message
1033
+ * @throws Error if text is an extension command
1034
+ */
1035
+ async steer(text, images) {
1036
+ // Check for extension commands (cannot be queued)
1037
+ if (text.startsWith("/")) {
1038
+ this._throwIfExtensionCommand(text);
1039
+ }
1040
+ // Expand skill commands and prompt templates
1041
+ let expandedText = this._expandSkillCommand(text);
1042
+ expandedText = expandPromptTemplate(expandedText, [...this.promptTemplates]);
1043
+ await this._queueSteer(expandedText, images);
1044
+ }
1045
+ /**
1046
+ * Queue a follow-up message to be processed after the agent finishes.
1047
+ * Delivered only when agent has no more tool calls or steering messages.
1048
+ * Expands skill commands and prompt templates. Errors on extension commands.
1049
+ * @param images Optional image attachments to include with the message
1050
+ * @throws Error if text is an extension command
1051
+ */
1052
+ async followUp(text, images) {
1053
+ // Check for extension commands (cannot be queued)
1054
+ if (text.startsWith("/")) {
1055
+ this._throwIfExtensionCommand(text);
1056
+ }
1057
+ // Expand skill commands and prompt templates
1058
+ let expandedText = this._expandSkillCommand(text);
1059
+ expandedText = expandPromptTemplate(expandedText, [...this.promptTemplates]);
1060
+ await this._queueFollowUp(expandedText, images);
1061
+ }
1062
+ /**
1063
+ * Internal: Queue a steering message (already expanded, no extension command check).
1064
+ */
1065
+ async _queueSteer(text, images) {
1066
+ this._steeringMessages.push(text);
1067
+ this._emitQueueUpdate();
1068
+ const content = [{ type: "text", text }];
1069
+ if (images) {
1070
+ content.push(...images);
1071
+ }
1072
+ this.agent.steer({
1073
+ role: "user",
1074
+ content,
1075
+ timestamp: Date.now(),
1076
+ });
1077
+ }
1078
+ /**
1079
+ * Internal: Queue a follow-up message (already expanded, no extension command check).
1080
+ */
1081
+ async _queueFollowUp(text, images) {
1082
+ this._followUpMessages.push(text);
1083
+ this._emitQueueUpdate();
1084
+ const content = [{ type: "text", text }];
1085
+ if (images) {
1086
+ content.push(...images);
1087
+ }
1088
+ this.agent.followUp({
1089
+ role: "user",
1090
+ content,
1091
+ timestamp: Date.now(),
1092
+ });
1093
+ }
1094
+ /**
1095
+ * Throw an error if the text is an extension command.
1096
+ */
1097
+ _throwIfExtensionCommand(text) {
1098
+ const spaceIndex = text.indexOf(" ");
1099
+ const commandName = spaceIndex === -1 ? text.slice(1) : text.slice(1, spaceIndex);
1100
+ const command = this._extensionRunner.getCommand(commandName);
1101
+ if (command) {
1102
+ throw new Error(`Extension command "/${commandName}" cannot be queued. Use prompt() or execute the command when not streaming.`);
1103
+ }
1104
+ }
1105
+ /**
1106
+ * Send a custom message to the session. Creates a CustomMessageEntry.
1107
+ *
1108
+ * Handles four cases:
1109
+ * - Streaming: queues message, processed when loop pulls from queue
1110
+ * - Streaming + triggerTurn false: appended to state/session once the current turn ends
1111
+ * - Not streaming + triggerTurn: appends to state/session, starts new turn
1112
+ * - Not streaming + no trigger: appends to state/session, no turn
1113
+ *
1114
+ * @param message Custom message with customType, content, display, details
1115
+ * @param options.triggerTurn If true and not streaming, triggers a new LLM turn
1116
+ * @param options.deliverAs Delivery mode: "steer", "followUp", or "nextTurn"
1117
+ */
1118
+ async sendCustomMessage(message, options) {
1119
+ const appMessage = {
1120
+ role: "custom",
1121
+ customType: message.customType,
1122
+ // Untyped extensions can pass null/missing content; normalize at ingestion.
1123
+ content: message.content ?? [],
1124
+ display: message.display,
1125
+ details: message.details,
1126
+ timestamp: Date.now(),
1127
+ };
1128
+ if (options?.deliverAs === "nextTurn") {
1129
+ this._pendingNextTurnMessages.push(appMessage);
1130
+ }
1131
+ else if (this.isStreaming && options?.triggerTurn !== false) {
1132
+ if (options?.deliverAs === "followUp") {
1133
+ this.agent.followUp(appMessage);
1134
+ }
1135
+ else {
1136
+ this.agent.steer(appMessage);
1137
+ }
1138
+ }
1139
+ else if (options?.triggerTurn) {
1140
+ await this._runAgentPrompt(appMessage);
1141
+ }
1142
+ else if (this.isStreaming) {
1143
+ // Appending now would put the message between an assistant tool call and its
1144
+ // result, which providers that validate message order reject on replay. Defer
1145
+ // to the end of the turn. Nothing is emitted yet: message events must not
1146
+ // describe messages the session tree does not contain.
1147
+ this._pendingCustomMessages.push(appMessage);
1148
+ }
1149
+ else {
1150
+ this._appendCustomMessage(appMessage);
1151
+ }
1152
+ }
1153
+ _appendCustomMessage(appMessage) {
1154
+ this.agent.state.messages.push(appMessage);
1155
+ this.sessionManager.appendCustomMessageEntry(appMessage.customType, appMessage.content, appMessage.display, appMessage.details);
1156
+ this._emit({ type: "message_start", message: appMessage });
1157
+ this._emit({ type: "message_end", message: appMessage });
1158
+ }
1159
+ /**
1160
+ * Append custom messages queued while the agent was running.
1161
+ * Called once the current turn's tool results are in agent state and session history.
1162
+ */
1163
+ _flushPendingCustomMessages() {
1164
+ if (this._pendingCustomMessages.length === 0)
1165
+ return;
1166
+ const pending = this._pendingCustomMessages;
1167
+ this._pendingCustomMessages = [];
1168
+ for (const appMessage of pending) {
1169
+ this._appendCustomMessage(appMessage);
1170
+ }
1171
+ }
1172
+ /**
1173
+ * Send a user message to the agent. Always triggers a turn.
1174
+ * When the agent is streaming, use deliverAs to specify how to queue the message.
1175
+ *
1176
+ * @param content User message content (string or content array)
1177
+ * @param options.deliverAs Delivery mode when streaming: "steer" or "followUp"
1178
+ * @param options.expandPromptTemplates Whether to dispatch extension commands and expand skill commands and prompt templates. Default: false.
1179
+ */
1180
+ async sendUserMessage(content, options) {
1181
+ // Normalize content to text string + optional images
1182
+ let text;
1183
+ let images;
1184
+ if (typeof content === "string") {
1185
+ text = content;
1186
+ }
1187
+ else {
1188
+ const textParts = [];
1189
+ images = [];
1190
+ for (const part of content) {
1191
+ if (part.type === "text") {
1192
+ textParts.push(part.text);
1193
+ }
1194
+ else {
1195
+ images.push(part);
1196
+ }
1197
+ }
1198
+ text = textParts.join("\n");
1199
+ if (images.length === 0)
1200
+ images = undefined;
1201
+ }
1202
+ await this.prompt(text, {
1203
+ expandPromptTemplates: options?.expandPromptTemplates ?? false,
1204
+ streamingBehavior: options?.deliverAs,
1205
+ images,
1206
+ source: "extension",
1207
+ });
1208
+ }
1209
+ /**
1210
+ * Clear all queued messages and return them.
1211
+ * Useful for restoring to editor when user aborts.
1212
+ * @returns Object with steering and followUp arrays
1213
+ */
1214
+ clearQueue() {
1215
+ const steering = [...this._steeringMessages];
1216
+ const followUp = [...this._followUpMessages];
1217
+ this._steeringMessages = [];
1218
+ this._followUpMessages = [];
1219
+ this.agent.clearAllQueues();
1220
+ this._emitQueueUpdate();
1221
+ return { steering, followUp };
1222
+ }
1223
+ /** Number of pending messages (includes both steering and follow-up) */
1224
+ get pendingMessageCount() {
1225
+ return this._steeringMessages.length + this._followUpMessages.length;
1226
+ }
1227
+ /** Get pending steering messages (read-only) */
1228
+ getSteeringMessages() {
1229
+ return this._steeringMessages;
1230
+ }
1231
+ /** Get pending follow-up messages (read-only) */
1232
+ getFollowUpMessages() {
1233
+ return this._followUpMessages;
1234
+ }
1235
+ get resourceLoader() {
1236
+ return this._resourceLoader;
1237
+ }
1238
+ /**
1239
+ * Abort current operation and wait for agent to become idle.
1240
+ */
1241
+ async abort() {
1242
+ this.abortRetry();
1243
+ this.abortCompaction();
1244
+ this.abortBranchSummary();
1245
+ this.agent.abort();
1246
+ await this.waitForIdle();
1247
+ }
1248
+ async waitForIdle() {
1249
+ if (this.isIdle) {
1250
+ return;
1251
+ }
1252
+ await this._getIdleWaitPromise();
1253
+ }
1254
+ // =========================================================================
1255
+ // Model Management
1256
+ // =========================================================================
1257
+ async _emitModelSelect(nextModel, previousModel, source) {
1258
+ if (modelsAreEqual(previousModel, nextModel))
1259
+ return;
1260
+ await this._extensionRunner.emit({
1261
+ type: "model_select",
1262
+ model: nextModel,
1263
+ previousModel,
1264
+ source,
1265
+ });
1266
+ }
1267
+ /**
1268
+ * Re-checks the saved/restored model once extensions have had a chance to
1269
+ * refresh their catalogs (e.g. the deepailab provider only has a seed model
1270
+ * until its session_start handler fetches the full list). Only fires once.
1271
+ */
1272
+ async _reconcileDesiredModel() {
1273
+ const desired = this._desiredModel;
1274
+ this._desiredModel = undefined;
1275
+ if (desired) {
1276
+ const current = this.model;
1277
+ if (current && current.provider === desired.provider && current.id === desired.modelId)
1278
+ return;
1279
+ const resolved = this._modelRuntime.getModel(desired.provider, desired.modelId);
1280
+ if (resolved && this._modelRuntime.hasConfiguredAuth(resolved.provider)) {
1281
+ await this.setModel(resolved);
1282
+ return;
1283
+ }
1284
+ }
1285
+ if (!isPlaceholderModel(this.model))
1286
+ return;
1287
+ try {
1288
+ await this._modelRuntime.refresh({ allowNetwork: false });
1289
+ }
1290
+ catch {
1291
+ // Snapshot may already include provisionally configured providers.
1292
+ }
1293
+ const pick = pickHouseModel([...this._modelRuntime.getAvailableSnapshot()]);
1294
+ if (!pick)
1295
+ return;
1296
+ try {
1297
+ await this.setModel(pick);
1298
+ }
1299
+ catch {
1300
+ // Auth is still not usable (e.g. logged-out session).
1301
+ }
1302
+ }
1303
+ /**
1304
+ * Set model directly.
1305
+ * Validates that auth is configured and saves to the session transcript.
1306
+ * Persists to global defaults only when options.persist is true.
1307
+ * @throws Error if no auth is configured for the model
1308
+ */
1309
+ async setModel(model, options = {}) {
1310
+ if (!(await this._modelRuntime.checkAuth(model.provider))) {
1311
+ throw new Error(`No API key for ${model.provider}/${model.id}`);
1312
+ }
1313
+ const previousModel = this.model;
1314
+ const thinkingLevel = this._getThinkingLevelForModelSwitch(model);
1315
+ this.agent.state.model = model;
1316
+ this.sessionManager.appendModelChange(model.provider, model.id);
1317
+ if (options.persist) {
1318
+ this.settingsManager.setDefaultModelAndProvider(model.provider, model.id);
1319
+ this._addPersistedDefaultToNonEmptyScope(model);
1320
+ }
1321
+ // Apply thinking level for the new model.
1322
+ // Per-model thinking level overrides take priority over the global default.
1323
+ // Model persistence does not implicitly rewrite the global thinking default.
1324
+ this.setThinkingLevel(thinkingLevel);
1325
+ await this._emitModelSelect(model, previousModel, "set");
1326
+ }
1327
+ _addPersistedDefaultToNonEmptyScope(model) {
1328
+ if (this._scopedModels.length === 0)
1329
+ return;
1330
+ if (this._scopedModels.some((scoped) => modelsAreEqual(scoped.model, model)))
1331
+ return;
1332
+ this._scopedModels = [...this._scopedModels, { model }];
1333
+ const enabledModels = this.settingsManager.getEnabledModels();
1334
+ if (!enabledModels?.length)
1335
+ return;
1336
+ const modelReference = `${model.provider}/${model.id}`;
1337
+ if (enabledModels.some((pattern) => pattern.toLowerCase() === modelReference.toLowerCase()))
1338
+ return;
1339
+ this.settingsManager.setEnabledModels([...enabledModels, modelReference]);
1340
+ }
1341
+ /**
1342
+ * Cycle to next/previous model.
1343
+ * Uses scoped models (from --models flag) if available, otherwise all available models.
1344
+ * @param direction - "forward" (default) or "backward"
1345
+ * @returns The new model info, or undefined if only one model available
1346
+ */
1347
+ async cycleModel(direction = "forward", options = {}) {
1348
+ if (this._scopedModels.length > 0) {
1349
+ return this._cycleScopedModel(direction, options);
1350
+ }
1351
+ return this._cycleAvailableModel(direction, options);
1352
+ }
1353
+ async _cycleScopedModel(direction, options) {
1354
+ const availableIds = new Set(this._modelRuntime.getAvailableSnapshot().map((model) => `${model.provider}\0${model.id}`));
1355
+ const scopedModels = this._scopedModels.filter((scoped) => availableIds.has(`${scoped.model.provider}\0${scoped.model.id}`));
1356
+ if (scopedModels.length <= 1)
1357
+ return undefined;
1358
+ const currentModel = this.model;
1359
+ let currentIndex = scopedModels.findIndex((sm) => modelsAreEqual(sm.model, currentModel));
1360
+ if (currentIndex === -1)
1361
+ currentIndex = 0;
1362
+ const len = scopedModels.length;
1363
+ const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
1364
+ const next = scopedModels[nextIndex];
1365
+ const thinkingLevel = this._getThinkingLevelForModelSwitch(next.model, next.thinkingLevel);
1366
+ // Apply model
1367
+ this.agent.state.model = next.model;
1368
+ this.sessionManager.appendModelChange(next.model.provider, next.model.id);
1369
+ if (options.persist) {
1370
+ this.settingsManager.setDefaultModelAndProvider(next.model.provider, next.model.id);
1371
+ this._addPersistedDefaultToNonEmptyScope(next.model);
1372
+ }
1373
+ // Apply thinking level for the new model.
1374
+ // - Explicit scoped model thinking level overrides defaults
1375
+ // - Per-model thinking level overrides take priority over the global default
1376
+ // setThinkingLevel clamps to model capabilities.
1377
+ // Model persistence does not implicitly rewrite the global thinking default.
1378
+ this.setThinkingLevel(thinkingLevel);
1379
+ await this._emitModelSelect(next.model, currentModel, "cycle");
1380
+ return { model: next.model, thinkingLevel: this.thinkingLevel, isScoped: true };
1381
+ }
1382
+ async _cycleAvailableModel(direction, options) {
1383
+ const availableModels = this._modelRuntime.getAvailableSnapshot();
1384
+ if (availableModels.length <= 1)
1385
+ return undefined;
1386
+ const currentModel = this.model;
1387
+ let currentIndex = availableModels.findIndex((m) => modelsAreEqual(m, currentModel));
1388
+ if (currentIndex === -1)
1389
+ currentIndex = 0;
1390
+ const len = availableModels.length;
1391
+ const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
1392
+ const nextModel = availableModels[nextIndex];
1393
+ const thinkingLevel = this._getThinkingLevelForModelSwitch(nextModel);
1394
+ this.agent.state.model = nextModel;
1395
+ this.sessionManager.appendModelChange(nextModel.provider, nextModel.id);
1396
+ if (options.persist) {
1397
+ this.settingsManager.setDefaultModelAndProvider(nextModel.provider, nextModel.id);
1398
+ this._addPersistedDefaultToNonEmptyScope(nextModel);
1399
+ }
1400
+ // Apply thinking level for the new model.
1401
+ // Model persistence does not implicitly rewrite the global thinking default.
1402
+ this.setThinkingLevel(thinkingLevel);
1403
+ await this._emitModelSelect(nextModel, currentModel, "cycle");
1404
+ return { model: nextModel, thinkingLevel: this.thinkingLevel, isScoped: false };
1405
+ }
1406
+ // =========================================================================
1407
+ // Thinking Level Management
1408
+ // =========================================================================
1409
+ /**
1410
+ * Set thinking level.
1411
+ * Clamps to model capabilities based on available thinking levels.
1412
+ * Saves the clamped level to the session transcript only if the level actually changes.
1413
+ * Persists the requested level to global defaults only when options.persist is true.
1414
+ */
1415
+ setThinkingLevel(level, options = {}) {
1416
+ const availableLevels = this.getAvailableThinkingLevels();
1417
+ const effectiveLevel = availableLevels.includes(level) ? level : this._clampThinkingLevel(level, availableLevels);
1418
+ // Only persist if actually changing
1419
+ const previousLevel = this.agent.state.thinkingLevel;
1420
+ const isChanging = effectiveLevel !== previousLevel;
1421
+ this.agent.state.thinkingLevel = effectiveLevel;
1422
+ if (options.persist) {
1423
+ this.settingsManager.setDefaultThinkingLevel(level);
1424
+ }
1425
+ if (isChanging) {
1426
+ this.sessionManager.appendThinkingLevelChange(effectiveLevel);
1427
+ this._emit({ type: "thinking_level_changed", level: effectiveLevel });
1428
+ void this._extensionRunner.emit({
1429
+ type: "thinking_level_select",
1430
+ level: effectiveLevel,
1431
+ previousLevel,
1432
+ });
1433
+ }
1434
+ }
1435
+ /**
1436
+ * Cycle to next thinking level.
1437
+ * @returns New level, or undefined if model doesn't support thinking
1438
+ */
1439
+ cycleThinkingLevel(options = {}) {
1440
+ if (!this.supportsThinking())
1441
+ return undefined;
1442
+ const levels = this.getAvailableThinkingLevels();
1443
+ const currentIndex = levels.indexOf(this.thinkingLevel);
1444
+ const nextIndex = (currentIndex + 1) % levels.length;
1445
+ const nextLevel = levels[nextIndex];
1446
+ this.setThinkingLevel(nextLevel, options);
1447
+ return nextLevel;
1448
+ }
1449
+ /**
1450
+ * Get available thinking levels for current model.
1451
+ * The provider will clamp to what the specific model supports internally.
1452
+ */
1453
+ getAvailableThinkingLevels() {
1454
+ if (!this.model)
1455
+ return [...THINKING_LEVEL_OPTIONS];
1456
+ return getSupportedThinkingLevels(this.model);
1457
+ }
1458
+ /**
1459
+ * Check if current model supports thinking/reasoning.
1460
+ */
1461
+ supportsThinking() {
1462
+ return !!this.model?.reasoning;
1463
+ }
1464
+ _getThinkingLevelForModelSwitch(targetModel, explicitLevel) {
1465
+ if (explicitLevel !== undefined) {
1466
+ return explicitLevel;
1467
+ }
1468
+ // Per-model default takes priority when switching to a model that has one
1469
+ if (targetModel) {
1470
+ const perModel = this.settingsManager.getModelThinkingLevel(targetModel.provider, targetModel.id);
1471
+ if (perModel !== undefined) {
1472
+ return perModel;
1473
+ }
1474
+ }
1475
+ return this.settingsManager.getDefaultThinkingLevel() ?? this.thinkingLevel ?? DEFAULT_THINKING_LEVEL;
1476
+ }
1477
+ _clampThinkingLevel(level, _availableLevels) {
1478
+ return this.model ? clampThinkingLevel(this.model, level) : "off";
1479
+ }
1480
+ // =========================================================================
1481
+ // Queue Mode Management
1482
+ // =========================================================================
1483
+ syncQueueModesFromSettings() {
1484
+ this.agent.steeringMode = this.settingsManager.getSteeringMode();
1485
+ this.agent.followUpMode = this.settingsManager.getFollowUpMode();
1486
+ }
1487
+ /**
1488
+ * Set steering message mode.
1489
+ * Saves to settings.
1490
+ */
1491
+ setSteeringMode(mode) {
1492
+ this.agent.steeringMode = mode;
1493
+ this.settingsManager.setSteeringMode(mode);
1494
+ }
1495
+ /**
1496
+ * Set follow-up message mode.
1497
+ * Saves to settings.
1498
+ */
1499
+ setFollowUpMode(mode) {
1500
+ this.agent.followUpMode = mode;
1501
+ this.settingsManager.setFollowUpMode(mode);
1502
+ }
1503
+ // =========================================================================
1504
+ // Compaction
1505
+ // =========================================================================
1506
+ /** Generate Pi's built-in compaction summary for manual and automatic compaction. */
1507
+ async _runDefaultCompaction(preparation, requestModel, apiKey, headers, customInstructions, signal, env, reason) {
1508
+ return compact(preparation, requestModel, apiKey, headers, customInstructions, signal, this.thinkingLevel, this.agent.streamFunction, env, this.settingsManager.getRetrySettings(), this._summarizationRetryCallbacks({ source: "compaction", reason }), undefined);
1509
+ }
1510
+ _clearManualCompactionState() {
1511
+ this._compactionAbortController = undefined;
1512
+ this._resolveIdleWaitIfIdle();
1513
+ }
1514
+ /**
1515
+ * Manually compact the session context.
1516
+ *
1517
+ * This is the manual entry point used by `/compact`, RPC, and extensions. It is
1518
+ * separate from automatic threshold/overflow compaction, which enters through
1519
+ * `_checkCompaction()` and `_runAutoCompaction()`. After preparation and the
1520
+ * `session_before_compact` hook, both paths call the lower-level `compact()`
1521
+ * function imported from `./compaction/index.ts`, unless the hook cancels or
1522
+ * supplies a custom result.
1523
+ *
1524
+ * Aborts the current agent operation first. Manual compaction never retries or
1525
+ * continues the interrupted agent turn.
1526
+ *
1527
+ * @param customInstructions Optional instructions for the compaction summary
1528
+ */
1529
+ async compact(customInstructions) {
1530
+ await this.abort();
1531
+ this._compactionAbortController = new AbortController();
1532
+ this._emit({ type: "compaction_start", reason: "manual" });
1533
+ let fromExtension = false;
1534
+ try {
1535
+ if (!this.model) {
1536
+ throw new Error(formatNoModelSelectedMessage());
1537
+ }
1538
+ const { model: requestModel, apiKey, headers, env } = await this._getSummarizationRequestAuth(this.model);
1539
+ const pathEntries = this.sessionManager.getBranch();
1540
+ const settings = this.settingsManager.getCompactionSettings();
1541
+ const preparation = prepareCompaction(pathEntries, settings);
1542
+ if (!preparation) {
1543
+ // Check why we can't compact
1544
+ const lastEntry = pathEntries[pathEntries.length - 1];
1545
+ if (lastEntry?.type === "compaction") {
1546
+ throw new Error("Already compacted");
1547
+ }
1548
+ throw new Error("Nothing to compact (session too small)");
1549
+ }
1550
+ let extensionCompaction;
1551
+ if (this._extensionRunner.hasHandlers("session_before_compact")) {
1552
+ const result = (await this._extensionRunner.emit({
1553
+ type: "session_before_compact",
1554
+ preparation,
1555
+ branchEntries: pathEntries,
1556
+ customInstructions,
1557
+ reason: "manual",
1558
+ willRetry: false,
1559
+ signal: this._compactionAbortController.signal,
1560
+ }));
1561
+ if (result?.cancel) {
1562
+ throw new Error("Compaction cancelled");
1563
+ }
1564
+ if (result?.compaction) {
1565
+ extensionCompaction = result.compaction;
1566
+ fromExtension = true;
1567
+ }
1568
+ }
1569
+ let summary;
1570
+ let firstKeptEntryId;
1571
+ let tokensBefore;
1572
+ let usage;
1573
+ let details;
1574
+ if (extensionCompaction) {
1575
+ // Extension provided compaction content
1576
+ summary = extensionCompaction.summary;
1577
+ firstKeptEntryId = extensionCompaction.firstKeptEntryId;
1578
+ tokensBefore = extensionCompaction.tokensBefore;
1579
+ usage = extensionCompaction.usage;
1580
+ details = extensionCompaction.details;
1581
+ }
1582
+ else {
1583
+ // Shared default summary generator, also used by automatic compaction.
1584
+ const result = await this._runDefaultCompaction(preparation, requestModel, apiKey, headers, customInstructions, this._compactionAbortController.signal, env, "manual");
1585
+ summary = result.summary;
1586
+ firstKeptEntryId = result.firstKeptEntryId;
1587
+ tokensBefore = result.tokensBefore;
1588
+ usage = result.usage;
1589
+ details = result.details;
1590
+ }
1591
+ if (this._compactionAbortController.signal.aborted) {
1592
+ throw new Error("Compaction cancelled");
1593
+ }
1594
+ this.sessionManager.appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromExtension, usage);
1595
+ const newEntries = this.sessionManager.getEntries();
1596
+ const sessionContext = this.sessionManager.buildSessionContext();
1597
+ this.agent.state.messages = sessionContext.messages;
1598
+ const estimatedTokensAfter = estimateMessagesTokens(sessionContext.messages);
1599
+ // Get the saved compaction entry for the extension event
1600
+ const savedCompactionEntry = newEntries.find((e) => e.type === "compaction" && e.summary === summary);
1601
+ if (this._extensionRunner && savedCompactionEntry) {
1602
+ await this._extensionRunner.emit({
1603
+ type: "session_compact",
1604
+ compactionEntry: savedCompactionEntry,
1605
+ fromExtension,
1606
+ reason: "manual",
1607
+ willRetry: false,
1608
+ });
1609
+ }
1610
+ const compactionResult = {
1611
+ summary,
1612
+ firstKeptEntryId,
1613
+ tokensBefore,
1614
+ estimatedTokensAfter,
1615
+ usage,
1616
+ details,
1617
+ };
1618
+ // compaction_end listeners may submit queued prompts, so expose idle state before notifying them.
1619
+ this._clearManualCompactionState();
1620
+ this._emit({
1621
+ type: "compaction_end",
1622
+ reason: "manual",
1623
+ result: compactionResult,
1624
+ aborted: false,
1625
+ willRetry: false,
1626
+ });
1627
+ return compactionResult;
1628
+ }
1629
+ catch (error) {
1630
+ const message = error instanceof Error ? error.message : String(error);
1631
+ const aborted = message === "Compaction cancelled" || (error instanceof Error && error.name === "AbortError");
1632
+ const errorMessage = aborted ? undefined : `Compaction failed: ${message}`;
1633
+ this._clearManualCompactionState();
1634
+ this._emit({
1635
+ type: "compaction_end",
1636
+ reason: "manual",
1637
+ result: undefined,
1638
+ aborted,
1639
+ willRetry: false,
1640
+ errorMessage,
1641
+ });
1642
+ await this._emitSessionCompactFailed({
1643
+ reason: "manual",
1644
+ errorMessage,
1645
+ aborted,
1646
+ willRetry: false,
1647
+ fromExtension,
1648
+ });
1649
+ throw error;
1650
+ }
1651
+ finally {
1652
+ this._clearManualCompactionState();
1653
+ }
1654
+ }
1655
+ /**
1656
+ * Cancel in-progress compaction (manual or auto).
1657
+ */
1658
+ abortCompaction() {
1659
+ this._compactionAbortController?.abort();
1660
+ this._autoCompactionAbortController?.abort();
1661
+ }
1662
+ /**
1663
+ * Cancel in-progress branch summarization.
1664
+ */
1665
+ abortBranchSummary() {
1666
+ this._branchSummaryAbortController?.abort();
1667
+ }
1668
+ /**
1669
+ * Dispatch automatic compaction after `agent_end` or before prompt submission.
1670
+ * Manual compaction does not call this method; it enters through `compact()`.
1671
+ *
1672
+ * Automatic cases:
1673
+ * 1. Overflow with retry: a context-overflow error or recoverable length stop;
1674
+ * remove the failed assistant message, compact, and retry the turn once.
1675
+ * 2. Overflow without retry: a successful response exceeded the configured
1676
+ * context window; compact but preserve the completed response.
1677
+ * 3. Threshold without retry: valid or estimated context usage crossed the
1678
+ * configured threshold; compact without retrying the completed response.
1679
+ *
1680
+ * Each case calls `_runAutoCompaction()`. After preparation and the
1681
+ * `session_before_compact` hook, that method calls the lower-level `compact()`
1682
+ * function imported from `./compaction/index.ts`, unless the hook cancels or
1683
+ * supplies a custom result.
1684
+ *
1685
+ * @param assistantMessage The assistant message to check
1686
+ * @param skipAbortedCheck If false, include aborted messages (for pre-prompt check). Default: true
1687
+ * @returns Whether the post-run loop should call `agent.continue()` for overflow recovery or queued messages
1688
+ */
1689
+ async _checkCompaction(assistantMessage, skipAbortedCheck = true) {
1690
+ const settings = this.settingsManager.getCompactionSettings();
1691
+ if (!settings.enabled)
1692
+ return false;
1693
+ // Skip if message was aborted (user cancelled) - unless skipAbortedCheck is false
1694
+ if (skipAbortedCheck && assistantMessage.stopReason === "aborted")
1695
+ return false;
1696
+ const contextWindow = this.model?.contextWindow ?? 0;
1697
+ // Skip overflow check if the message came from a different model.
1698
+ // This handles the case where user switched from a smaller-context model (e.g. opus)
1699
+ // to a larger-context model (e.g. codex) - the overflow error from the old model
1700
+ // shouldn't trigger compaction for the new model.
1701
+ const sameModel = this.model && assistantMessage.provider === this.model.provider && assistantMessage.model === this.model.id;
1702
+ // Skip compaction checks if this assistant message is older than the latest
1703
+ // compaction boundary. This prevents a stale pre-compaction usage/error
1704
+ // from retriggering compaction on the first prompt after compaction.
1705
+ const compactionEntry = getLatestCompactionEntry(this.sessionManager.getBranch());
1706
+ const assistantIsFromBeforeCompaction = compactionEntry !== null && assistantMessage.timestamp <= new Date(compactionEntry.timestamp).getTime();
1707
+ if (assistantIsFromBeforeCompaction) {
1708
+ return false;
1709
+ }
1710
+ // Automatic cases 1 and 2: context overflow.
1711
+ // A length stop is recoverable when output ended below the model's original desired limit,
1712
+ // independent of the configured context size or any context-clamped provider request limit.
1713
+ const contextOverflow = sameModel && isContextOverflow(assistantMessage, contextWindow);
1714
+ const recoverableLength = sameModel && isRecoverableLength(assistantMessage, this.model?.maxTokens ?? 0);
1715
+ if (contextOverflow || recoverableLength) {
1716
+ const willRetry = assistantMessage.stopReason !== "stop";
1717
+ // Case 2: the response completed successfully. Compact, but do not retry because
1718
+ // agent.continue() cannot continue from a completed assistant response.
1719
+ if (!willRetry) {
1720
+ return await this._runAutoCompaction("overflow", false);
1721
+ }
1722
+ if (this._overflowRecoveryAttempted) {
1723
+ const errorMessage = contextOverflow
1724
+ ? "Context overflow recovery failed after one compact-and-retry attempt. Try reducing context or switching to a larger-context model."
1725
+ : "Truncated response recovery failed after one compact-and-retry attempt.";
1726
+ this._emit({
1727
+ type: "compaction_end",
1728
+ reason: "overflow",
1729
+ result: undefined,
1730
+ aborted: false,
1731
+ willRetry: false,
1732
+ errorMessage,
1733
+ });
1734
+ await this._emitSessionCompactFailed({
1735
+ reason: "overflow",
1736
+ errorMessage,
1737
+ aborted: false,
1738
+ willRetry: false,
1739
+ fromExtension: false,
1740
+ });
1741
+ return false;
1742
+ }
1743
+ // Case 1: remove the failed or truncated message from agent state, compact, and
1744
+ // retry once. The message remains in session history but is excluded from retry context.
1745
+ this._overflowRecoveryAttempted = true;
1746
+ const messages = this.agent.state.messages;
1747
+ if (messages.length > 0 && messages[messages.length - 1].role === "assistant") {
1748
+ this.agent.state.messages = messages.slice(0, -1);
1749
+ }
1750
+ return await this._runAutoCompaction("overflow", willRetry);
1751
+ }
1752
+ // Case 3: threshold compaction without retry.
1753
+ // For error messages or all-zero usage messages, estimate from the last valid response.
1754
+ // This ensures sessions that hit persistent API errors (e.g. 529) or malformed zero-usage
1755
+ // responses can still compact and do not reset context accounting.
1756
+ let contextTokens;
1757
+ const directContextTokens = assistantMessage.usage ? calculateContextTokens(assistantMessage.usage) : 0;
1758
+ if (assistantMessage.stopReason === "error" || directContextTokens === 0) {
1759
+ const messages = this.agent.state.messages;
1760
+ const estimate = estimateContextTokens(messages);
1761
+ // Without provider usage, estimate.tokens is the pure message-size estimate.
1762
+ // Only usage-backed estimates need the stale pre-compaction check.
1763
+ if (estimate.lastUsageIndex !== null) {
1764
+ // Verify the usage source is post-compaction. Kept pre-compaction messages
1765
+ // have stale usage reflecting the old (larger) context and would falsely
1766
+ // trigger compaction right after one just finished.
1767
+ const usageMsg = messages[estimate.lastUsageIndex];
1768
+ if (compactionEntry &&
1769
+ usageMsg.role === "assistant" &&
1770
+ usageMsg.timestamp <= new Date(compactionEntry.timestamp).getTime()) {
1771
+ return false;
1772
+ }
1773
+ }
1774
+ contextTokens = estimate.tokens;
1775
+ }
1776
+ else {
1777
+ contextTokens = directContextTokens;
1778
+ }
1779
+ if (shouldCompact(contextTokens, contextWindow, settings)) {
1780
+ return await this._runAutoCompaction("threshold", false);
1781
+ }
1782
+ return false;
1783
+ }
1784
+ /**
1785
+ * Execute threshold or overflow compaction. Manual compaction uses
1786
+ * `AgentSession.compact()` instead. Both paths call the lower-level `compact()`
1787
+ * function imported from `./compaction/index.ts` after preparation and extension
1788
+ * interception.
1789
+ *
1790
+ * @param reason Automatic trigger selected by `_checkCompaction()`
1791
+ * @param willRetry Whether to continue the interrupted turn after overflow compaction
1792
+ * @returns Whether the post-run loop should call `agent.continue()`
1793
+ */
1794
+ async _runAutoCompaction(reason, willRetry) {
1795
+ const settings = this.settingsManager.getCompactionSettings();
1796
+ let started = false;
1797
+ let fromExtension = false;
1798
+ try {
1799
+ if (!this.model) {
1800
+ return false;
1801
+ }
1802
+ const { model: requestModel, apiKey, headers, env } = await this._getSummarizationRequestAuth(this.model);
1803
+ const pathEntries = this.sessionManager.getBranch();
1804
+ const preparation = prepareCompaction(pathEntries, settings);
1805
+ if (!preparation) {
1806
+ return false;
1807
+ }
1808
+ this._emit({ type: "compaction_start", reason });
1809
+ this._autoCompactionAbortController = new AbortController();
1810
+ started = true;
1811
+ let extensionCompaction;
1812
+ if (this._extensionRunner.hasHandlers("session_before_compact")) {
1813
+ const extensionResult = (await this._extensionRunner.emit({
1814
+ type: "session_before_compact",
1815
+ preparation,
1816
+ branchEntries: pathEntries,
1817
+ customInstructions: undefined,
1818
+ reason,
1819
+ willRetry,
1820
+ signal: this._autoCompactionAbortController.signal,
1821
+ }));
1822
+ if (extensionResult?.cancel) {
1823
+ this._emit({
1824
+ type: "compaction_end",
1825
+ reason,
1826
+ result: undefined,
1827
+ aborted: true,
1828
+ willRetry: false,
1829
+ });
1830
+ await this._emitSessionCompactFailed({
1831
+ reason,
1832
+ aborted: true,
1833
+ willRetry: false,
1834
+ fromExtension: false,
1835
+ });
1836
+ return false;
1837
+ }
1838
+ if (extensionResult?.compaction) {
1839
+ extensionCompaction = extensionResult.compaction;
1840
+ fromExtension = true;
1841
+ }
1842
+ }
1843
+ let summary;
1844
+ let firstKeptEntryId;
1845
+ let tokensBefore;
1846
+ let usage;
1847
+ let details;
1848
+ if (extensionCompaction) {
1849
+ // Extension provided compaction content
1850
+ summary = extensionCompaction.summary;
1851
+ firstKeptEntryId = extensionCompaction.firstKeptEntryId;
1852
+ tokensBefore = extensionCompaction.tokensBefore;
1853
+ usage = extensionCompaction.usage;
1854
+ details = extensionCompaction.details;
1855
+ }
1856
+ else {
1857
+ // Shared default summary generator, also used by manual compaction.
1858
+ const compactResult = await this._runDefaultCompaction(preparation, requestModel, apiKey, headers, undefined, this._autoCompactionAbortController.signal, env, reason);
1859
+ summary = compactResult.summary;
1860
+ firstKeptEntryId = compactResult.firstKeptEntryId;
1861
+ tokensBefore = compactResult.tokensBefore;
1862
+ usage = compactResult.usage;
1863
+ details = compactResult.details;
1864
+ }
1865
+ if (this._autoCompactionAbortController.signal.aborted) {
1866
+ this._emit({
1867
+ type: "compaction_end",
1868
+ reason,
1869
+ result: undefined,
1870
+ aborted: true,
1871
+ willRetry: false,
1872
+ });
1873
+ await this._emitSessionCompactFailed({
1874
+ reason,
1875
+ aborted: true,
1876
+ willRetry: false,
1877
+ fromExtension,
1878
+ });
1879
+ return false;
1880
+ }
1881
+ this.sessionManager.appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromExtension, usage);
1882
+ const newEntries = this.sessionManager.getEntries();
1883
+ const sessionContext = this.sessionManager.buildSessionContext();
1884
+ this.agent.state.messages = sessionContext.messages;
1885
+ const estimatedTokensAfter = estimateMessagesTokens(sessionContext.messages);
1886
+ // Get the saved compaction entry for the extension event
1887
+ const savedCompactionEntry = newEntries.find((e) => e.type === "compaction" && e.summary === summary);
1888
+ if (this._extensionRunner && savedCompactionEntry) {
1889
+ await this._extensionRunner.emit({
1890
+ type: "session_compact",
1891
+ compactionEntry: savedCompactionEntry,
1892
+ fromExtension,
1893
+ reason,
1894
+ willRetry,
1895
+ });
1896
+ }
1897
+ const result = {
1898
+ summary,
1899
+ firstKeptEntryId,
1900
+ tokensBefore,
1901
+ estimatedTokensAfter,
1902
+ usage,
1903
+ details,
1904
+ };
1905
+ this._emit({ type: "compaction_end", reason, result, aborted: false, willRetry });
1906
+ if (willRetry) {
1907
+ const messages = this.agent.state.messages;
1908
+ const lastMsg = messages[messages.length - 1];
1909
+ // The overflow response was persisted on message_end before _checkCompaction() removed it
1910
+ // from agent state. Rebuilding state from the new compaction can restore that kept entry,
1911
+ // leaving an assistant as the final message. agent.continue() rejects that state, so remove
1912
+ // the retriable error or truncated-length response again before continuing the interrupted turn.
1913
+ if (lastMsg?.role === "assistant" && (lastMsg.stopReason === "error" || lastMsg.stopReason === "length")) {
1914
+ this.agent.state.messages = messages.slice(0, -1);
1915
+ }
1916
+ return true;
1917
+ }
1918
+ // Auto-compaction can complete while follow-up/steering/custom messages are waiting.
1919
+ // Continue once so queued messages are delivered.
1920
+ return this.agent.hasQueuedMessages();
1921
+ }
1922
+ catch (error) {
1923
+ const errorMessage = error instanceof Error ? error.message : "compaction failed";
1924
+ if (started) {
1925
+ const formattedErrorMessage = reason === "overflow"
1926
+ ? `Context overflow recovery failed: ${errorMessage}`
1927
+ : `Auto-compaction failed: ${errorMessage}`;
1928
+ this._emit({
1929
+ type: "compaction_end",
1930
+ reason,
1931
+ result: undefined,
1932
+ aborted: false,
1933
+ willRetry: false,
1934
+ errorMessage: formattedErrorMessage,
1935
+ });
1936
+ await this._emitSessionCompactFailed({
1937
+ reason,
1938
+ errorMessage: formattedErrorMessage,
1939
+ aborted: false,
1940
+ willRetry: false,
1941
+ fromExtension,
1942
+ });
1943
+ }
1944
+ return false;
1945
+ }
1946
+ finally {
1947
+ this._autoCompactionAbortController = undefined;
1948
+ this._resolveIdleWaitIfIdle();
1949
+ }
1950
+ }
1951
+ /**
1952
+ * Toggle auto-compaction setting.
1953
+ */
1954
+ setAutoCompactionEnabled(enabled) {
1955
+ this.settingsManager.setCompactionEnabled(enabled);
1956
+ }
1957
+ /** Whether auto-compaction is enabled */
1958
+ get autoCompactionEnabled() {
1959
+ return this.settingsManager.getCompactionEnabled();
1960
+ }
1961
+ async bindExtensions(bindings) {
1962
+ if (bindings.uiContext !== undefined) {
1963
+ this._extensionUIContext = bindings.uiContext;
1964
+ }
1965
+ if (bindings.mode !== undefined) {
1966
+ this._extensionMode = bindings.mode;
1967
+ }
1968
+ if (bindings.commandContextActions !== undefined) {
1969
+ this._extensionCommandContextActions = bindings.commandContextActions;
1970
+ }
1971
+ if (bindings.abortHandler !== undefined) {
1972
+ this._extensionAbortHandler = bindings.abortHandler;
1973
+ }
1974
+ if (bindings.shutdownHandler !== undefined) {
1975
+ this._extensionShutdownHandler = bindings.shutdownHandler;
1976
+ }
1977
+ if (bindings.onError !== undefined) {
1978
+ this._extensionErrorListener = bindings.onError;
1979
+ }
1980
+ this._applyExtensionBindings(this._extensionRunner);
1981
+ await this._extensionRunner.emit(this._sessionStartEvent);
1982
+ await this._reconcileDesiredModel();
1983
+ await this.extendResourcesFromExtensions(this._sessionStartEvent.reason === "reload" ? "reload" : "startup");
1984
+ }
1985
+ async extendResourcesFromExtensions(reason) {
1986
+ if (!this._extensionRunner.hasHandlers("resources_discover")) {
1987
+ return;
1988
+ }
1989
+ const { skillPaths, promptPaths, themePaths } = await this._extensionRunner.emitResourcesDiscover(this._cwd, reason);
1990
+ if (skillPaths.length === 0 && promptPaths.length === 0 && themePaths.length === 0) {
1991
+ return;
1992
+ }
1993
+ const extensionPaths = {
1994
+ skillPaths: this.buildExtensionResourcePaths(skillPaths),
1995
+ promptPaths: this.buildExtensionResourcePaths(promptPaths),
1996
+ themePaths: this.buildExtensionResourcePaths(themePaths),
1997
+ };
1998
+ this._resourceLoader.extendResources(extensionPaths);
1999
+ this._baseSystemPrompt = this._rebuildSystemPrompt(this.getActiveToolNames());
2000
+ this.agent.state.systemPrompt = this._baseSystemPrompt;
2001
+ }
2002
+ buildExtensionResourcePaths(entries) {
2003
+ return entries.map((entry) => {
2004
+ const source = this.getExtensionSourceLabel(entry.extensionPath);
2005
+ const baseDir = entry.extensionPath.startsWith("<") ? undefined : dirname(entry.extensionPath);
2006
+ return {
2007
+ path: entry.path,
2008
+ metadata: {
2009
+ source,
2010
+ scope: "temporary",
2011
+ origin: "top-level",
2012
+ baseDir,
2013
+ },
2014
+ };
2015
+ });
2016
+ }
2017
+ getExtensionSourceLabel(extensionPath) {
2018
+ if (extensionPath.startsWith("<")) {
2019
+ return `extension:${extensionPath.replace(/[<>]/g, "")}`;
2020
+ }
2021
+ const base = basename(extensionPath);
2022
+ const name = base.replace(/\.(ts|js)$/, "");
2023
+ return `extension:${name}`;
2024
+ }
2025
+ _applyExtensionBindings(runner) {
2026
+ runner.setUIContext(this._extensionUIContext, this._extensionMode);
2027
+ runner.bindCommandContext(this._extensionCommandContextActions);
2028
+ this._extensionErrorUnsubscriber?.();
2029
+ this._extensionErrorUnsubscriber = this._extensionErrorListener
2030
+ ? runner.onError(this._extensionErrorListener)
2031
+ : undefined;
2032
+ }
2033
+ _refreshCurrentModelFromRegistry() {
2034
+ const currentModel = this.model;
2035
+ if (!currentModel) {
2036
+ return;
2037
+ }
2038
+ const refreshedModel = this._modelRuntime.getModel(currentModel.provider, currentModel.id);
2039
+ if (!refreshedModel || refreshedModel === currentModel) {
2040
+ return;
2041
+ }
2042
+ this.agent.state.model = refreshedModel;
2043
+ }
2044
+ _bindExtensionCore(runner) {
2045
+ const getCommands = () => {
2046
+ const extensionCommands = runner.getRegisteredCommands().map((command) => ({
2047
+ name: command.invocationName,
2048
+ description: command.description,
2049
+ source: "extension",
2050
+ sourceInfo: command.sourceInfo,
2051
+ }));
2052
+ const templates = this.promptTemplates.map((template) => ({
2053
+ name: template.name,
2054
+ description: template.description,
2055
+ source: "prompt",
2056
+ sourceInfo: template.sourceInfo,
2057
+ }));
2058
+ const skills = this._resourceLoader.getSkills().skills.map((skill) => ({
2059
+ name: `skill:${skill.name}`,
2060
+ description: skill.description,
2061
+ source: "skill",
2062
+ sourceInfo: skill.sourceInfo,
2063
+ }));
2064
+ return [...extensionCommands, ...templates, ...skills];
2065
+ };
2066
+ runner.bindCore({
2067
+ sendMessage: (message, options) => {
2068
+ this.sendCustomMessage(message, options).catch((err) => {
2069
+ runner.emitError({
2070
+ extensionPath: "<runtime>",
2071
+ event: "send_message",
2072
+ error: err instanceof Error ? err.message : String(err),
2073
+ });
2074
+ });
2075
+ },
2076
+ sendUserMessage: (content, options) => {
2077
+ this.sendUserMessage(content, options).catch((err) => {
2078
+ runner.emitError({
2079
+ extensionPath: "<runtime>",
2080
+ event: "send_user_message",
2081
+ error: err instanceof Error ? err.message : String(err),
2082
+ });
2083
+ });
2084
+ },
2085
+ appendEntry: (customType, data) => {
2086
+ const entryId = this.sessionManager.appendCustomEntry(customType, data);
2087
+ const entry = this.sessionManager.getEntry(entryId);
2088
+ if (entry) {
2089
+ this._emit({ type: "entry_appended", entry });
2090
+ }
2091
+ },
2092
+ setSessionName: (name) => {
2093
+ this.setSessionName(name);
2094
+ },
2095
+ getSessionName: () => {
2096
+ return this.sessionManager.getSessionName();
2097
+ },
2098
+ setLabel: (entryId, label) => {
2099
+ this.sessionManager.appendLabelChange(entryId, label);
2100
+ },
2101
+ getActiveTools: () => this.getActiveToolNames(),
2102
+ getAllTools: () => this.getAllTools(),
2103
+ setActiveTools: (toolNames) => this.setActiveToolsByName(toolNames),
2104
+ refreshTools: () => this._refreshToolRegistry(),
2105
+ getCommands,
2106
+ setModel: async (model) => {
2107
+ if (!this._modelRuntime.hasConfiguredAuth(model.provider))
2108
+ return false;
2109
+ await this.setModel(model);
2110
+ return true;
2111
+ },
2112
+ getThinkingLevel: () => this.thinkingLevel,
2113
+ setThinkingLevel: (level) => this.setThinkingLevel(level),
2114
+ }, {
2115
+ getModel: () => this.model,
2116
+ getScopedModels: () => this._scopedModels,
2117
+ isIdle: () => this.isIdle,
2118
+ isProjectTrusted: () => this.settingsManager.isProjectTrusted(),
2119
+ getSignal: () => this.agent.signal,
2120
+ abort: () => {
2121
+ if (this._extensionAbortHandler) {
2122
+ this._extensionAbortHandler();
2123
+ return;
2124
+ }
2125
+ void this.abort();
2126
+ },
2127
+ hasPendingMessages: () => this.pendingMessageCount > 0,
2128
+ shutdown: () => {
2129
+ this._extensionShutdownHandler?.();
2130
+ },
2131
+ getContextUsage: () => this.getContextUsage(),
2132
+ compact: (options) => {
2133
+ void (async () => {
2134
+ try {
2135
+ const result = await this.compact(options?.customInstructions);
2136
+ options?.onComplete?.(result);
2137
+ }
2138
+ catch (error) {
2139
+ const err = error instanceof Error ? error : new Error(String(error));
2140
+ options?.onError?.(err);
2141
+ }
2142
+ })();
2143
+ },
2144
+ getSystemPrompt: () => this.systemPrompt,
2145
+ getSystemPromptOptions: () => this._baseSystemPromptOptions,
2146
+ }, {
2147
+ registerProvider: (name, config) => {
2148
+ this._modelRuntime.registerProvider(name, config);
2149
+ this._refreshCurrentModelFromRegistry();
2150
+ },
2151
+ registerNativeProvider: (provider) => {
2152
+ this._modelRuntime.registerNativeProvider(provider);
2153
+ this._refreshCurrentModelFromRegistry();
2154
+ },
2155
+ unregisterProvider: (name) => {
2156
+ this._modelRuntime.unregisterProvider(name);
2157
+ this._refreshCurrentModelFromRegistry();
2158
+ },
2159
+ });
2160
+ }
2161
+ _refreshToolRegistry(options) {
2162
+ const previousRegistryNames = new Set(this._toolRegistry.keys());
2163
+ const previousActiveToolNames = this.getActiveToolNames();
2164
+ const allowedToolNames = this._allowedToolNames;
2165
+ const excludedToolNames = this._excludedToolNames;
2166
+ const isAllowedTool = (name) => (!allowedToolNames || allowedToolNames.has(name)) && !excludedToolNames?.has(name);
2167
+ const registeredTools = this._extensionRunner.getAllRegisteredTools();
2168
+ const allCustomTools = [
2169
+ ...registeredTools,
2170
+ ...this._customTools.map((definition) => ({
2171
+ definition,
2172
+ sourceInfo: createSyntheticSourceInfo(`<sdk:${definition.name}>`, { source: "sdk" }),
2173
+ })),
2174
+ ].filter((tool) => isAllowedTool(tool.definition.name));
2175
+ const definitionRegistry = new Map(Array.from(this._baseToolDefinitions.entries())
2176
+ .filter(([name]) => isAllowedTool(name))
2177
+ .map(([name, definition]) => [
2178
+ name,
2179
+ {
2180
+ definition,
2181
+ sourceInfo: createSyntheticSourceInfo(`<builtin:${name}>`, { source: "builtin" }),
2182
+ },
2183
+ ]));
2184
+ for (const tool of allCustomTools) {
2185
+ definitionRegistry.set(tool.definition.name, {
2186
+ definition: tool.definition,
2187
+ sourceInfo: tool.sourceInfo,
2188
+ });
2189
+ }
2190
+ this._toolDefinitions = definitionRegistry;
2191
+ this._toolPromptSnippets = new Map(Array.from(definitionRegistry.values())
2192
+ .map(({ definition }) => {
2193
+ const snippet = this._normalizePromptSnippet(definition.promptSnippet);
2194
+ return snippet ? [definition.name, snippet] : undefined;
2195
+ })
2196
+ .filter((entry) => entry !== undefined));
2197
+ this._toolPromptGuidelines = new Map(Array.from(definitionRegistry.values())
2198
+ .map(({ definition }) => {
2199
+ const guidelines = this._normalizePromptGuidelines(definition.promptGuidelines);
2200
+ return guidelines.length > 0 ? [definition.name, guidelines] : undefined;
2201
+ })
2202
+ .filter((entry) => entry !== undefined));
2203
+ const runner = this._extensionRunner;
2204
+ const wrappedExtensionTools = wrapRegisteredTools(allCustomTools, runner);
2205
+ const wrappedBuiltInTools = wrapRegisteredTools(Array.from(this._baseToolDefinitions.values())
2206
+ .filter((definition) => isAllowedTool(definition.name))
2207
+ .map((definition) => ({
2208
+ definition,
2209
+ sourceInfo: createSyntheticSourceInfo(`<builtin:${definition.name}>`, { source: "builtin" }),
2210
+ })), runner);
2211
+ const toolRegistry = new Map(wrappedBuiltInTools.map((tool) => [tool.name, tool]));
2212
+ for (const tool of wrappedExtensionTools) {
2213
+ toolRegistry.set(tool.name, tool);
2214
+ }
2215
+ this._toolRegistry = toolRegistry;
2216
+ const nextActiveToolNames = (options?.activeToolNames ? [...options.activeToolNames] : [...previousActiveToolNames]).filter((name) => isAllowedTool(name));
2217
+ if (allowedToolNames) {
2218
+ for (const toolName of this._toolRegistry.keys()) {
2219
+ if (allowedToolNames.has(toolName)) {
2220
+ nextActiveToolNames.push(toolName);
2221
+ }
2222
+ }
2223
+ }
2224
+ else if (options?.includeAllExtensionTools) {
2225
+ for (const tool of wrappedExtensionTools) {
2226
+ nextActiveToolNames.push(tool.name);
2227
+ }
2228
+ }
2229
+ else if (!options?.activeToolNames) {
2230
+ for (const toolName of this._toolRegistry.keys()) {
2231
+ if (!previousRegistryNames.has(toolName)) {
2232
+ nextActiveToolNames.push(toolName);
2233
+ }
2234
+ }
2235
+ }
2236
+ this.setActiveToolsByName([...new Set(nextActiveToolNames)]);
2237
+ }
2238
+ _buildRuntime(options) {
2239
+ const autoResizeImages = this.settingsManager.getImageAutoResize();
2240
+ const shellCommandPrefix = this.settingsManager.getShellCommandPrefix();
2241
+ const shellPath = this.settingsManager.getShellPath();
2242
+ const baseToolDefinitions = this._baseToolsOverride
2243
+ ? Object.fromEntries(Object.entries(this._baseToolsOverride).map(([name, tool]) => [
2244
+ name,
2245
+ createToolDefinitionFromAgentTool(tool),
2246
+ ]))
2247
+ : createAllToolDefinitions(this._cwd, {
2248
+ read: { autoResizeImages },
2249
+ bash: { commandPrefix: shellCommandPrefix, shellPath },
2250
+ });
2251
+ this._baseToolDefinitions = new Map(Object.entries(baseToolDefinitions).map(([name, tool]) => [name, tool]));
2252
+ const extensionsResult = this._resourceLoader.getExtensions();
2253
+ if (options.flagValues) {
2254
+ for (const [name, value] of options.flagValues) {
2255
+ extensionsResult.runtime.flagValues.set(name, value);
2256
+ }
2257
+ }
2258
+ this._extensionRunner = new ExtensionRunner(extensionsResult.extensions, extensionsResult.runtime, this._cwd, this.sessionManager, new ModelRegistry(this._modelRuntime));
2259
+ if (this._extensionRunnerRef) {
2260
+ this._extensionRunnerRef.current = this._extensionRunner;
2261
+ }
2262
+ this._bindExtensionCore(this._extensionRunner);
2263
+ this._applyExtensionBindings(this._extensionRunner);
2264
+ const defaultActiveToolNames = this._baseToolsOverride
2265
+ ? Object.keys(this._baseToolsOverride)
2266
+ : ["read", "bash", "edit", "write"];
2267
+ const baseActiveToolNames = options.activeToolNames ?? defaultActiveToolNames;
2268
+ this._refreshToolRegistry({
2269
+ activeToolNames: baseActiveToolNames,
2270
+ includeAllExtensionTools: options.includeAllExtensionTools,
2271
+ });
2272
+ }
2273
+ async reload(options) {
2274
+ const oldRunner = this._extensionRunner;
2275
+ const previousFlagValues = oldRunner.getFlagValues();
2276
+ await emitSessionShutdownEvent(oldRunner, { type: "session_shutdown", reason: "reload" });
2277
+ oldRunner.invalidate();
2278
+ await this.settingsManager.reload();
2279
+ this.syncQueueModesFromSettings();
2280
+ resetApiProviders();
2281
+ await this._resourceLoader.reload();
2282
+ this._buildRuntime({
2283
+ activeToolNames: this.getActiveToolNames(),
2284
+ flagValues: previousFlagValues,
2285
+ includeAllExtensionTools: true,
2286
+ });
2287
+ const hasBindings = this._extensionUIContext ||
2288
+ this._extensionCommandContextActions ||
2289
+ this._extensionShutdownHandler ||
2290
+ this._extensionErrorListener;
2291
+ if (hasBindings) {
2292
+ await options?.beforeSessionStart?.();
2293
+ await this._extensionRunner.emit({ type: "session_start", reason: "reload" });
2294
+ await this.extendResourcesFromExtensions("reload");
2295
+ }
2296
+ }
2297
+ // =========================================================================
2298
+ // Auto-Retry
2299
+ // =========================================================================
2300
+ /**
2301
+ * Check if an error is retryable (overloaded, rate limit, server errors).
2302
+ * Context overflow errors are NOT retryable (handled by compaction instead).
2303
+ */
2304
+ _isRetryableError(message) {
2305
+ // Context overflow is handled by compaction, not retry.
2306
+ if (isContextOverflow(message, this.model?.contextWindow ?? 0))
2307
+ return false;
2308
+ return isRetryableAssistantError(message);
2309
+ }
2310
+ /**
2311
+ * Retry policy + callbacks shared by compaction and branch-summary summarization calls.
2312
+ * Uses the same `settings.retry` budget/backoff as agent-turn retries so a single transient
2313
+ * stream drop no longer fails the whole operation. `source` carries the context
2314
+ * the TUI needs to render the retry and recreate the underlying indicator.
2315
+ */
2316
+ _summarizationRetryCallbacks(source) {
2317
+ return {
2318
+ onRetryScheduled: (attempt, maxAttempts, delayMs, errorMessage) => {
2319
+ this._emit({
2320
+ type: "summarization_retry_scheduled",
2321
+ attempt,
2322
+ maxAttempts,
2323
+ delayMs,
2324
+ errorMessage,
2325
+ });
2326
+ },
2327
+ onRetryAttemptStart: () => {
2328
+ this._emit({
2329
+ type: "summarization_retry_attempt_start",
2330
+ ...source,
2331
+ });
2332
+ },
2333
+ onRetryFinished: () => {
2334
+ this._emit({ type: "summarization_retry_finished" });
2335
+ },
2336
+ };
2337
+ }
2338
+ /**
2339
+ * Prepare a retryable error for continuation with exponential backoff.
2340
+ * @returns true if the caller should continue the agent, false otherwise
2341
+ */
2342
+ async _prepareRetry(message) {
2343
+ const settings = this.settingsManager.getRetrySettings();
2344
+ if (!settings.enabled) {
2345
+ return false;
2346
+ }
2347
+ this._retryAttempt++;
2348
+ if (this._retryAttempt > settings.maxRetries) {
2349
+ // Preserve the completed attempt count so post-run handling can emit the final failure.
2350
+ this._retryAttempt--;
2351
+ return false;
2352
+ }
2353
+ const delayMs = settings.baseDelayMs * 2 ** (this._retryAttempt - 1);
2354
+ this._emit({
2355
+ type: "auto_retry_start",
2356
+ attempt: this._retryAttempt,
2357
+ maxAttempts: settings.maxRetries,
2358
+ delayMs,
2359
+ errorMessage: message.errorMessage || "Unknown error",
2360
+ });
2361
+ // Remove error message from agent state (keep in session for history)
2362
+ const messages = this.agent.state.messages;
2363
+ if (messages.length > 0 && messages[messages.length - 1].role === "assistant") {
2364
+ this.agent.state.messages = messages.slice(0, -1);
2365
+ }
2366
+ // Wait with exponential backoff (abortable)
2367
+ this._retryAbortController = new AbortController();
2368
+ try {
2369
+ await sleep(delayMs, this._retryAbortController.signal);
2370
+ }
2371
+ catch {
2372
+ // Aborted during sleep - emit end event so UI can clean up
2373
+ const attempt = this._retryAttempt;
2374
+ this._retryAttempt = 0;
2375
+ this._emit({
2376
+ type: "auto_retry_end",
2377
+ success: false,
2378
+ attempt,
2379
+ finalError: "Retry cancelled",
2380
+ });
2381
+ return false;
2382
+ }
2383
+ finally {
2384
+ this._retryAbortController = undefined;
2385
+ }
2386
+ return true;
2387
+ }
2388
+ /**
2389
+ * Cancel in-progress retry.
2390
+ */
2391
+ abortRetry() {
2392
+ this._retryAbortController?.abort();
2393
+ }
2394
+ /** Whether auto-retry is currently in progress */
2395
+ get isRetrying() {
2396
+ return this._retryAbortController !== undefined;
2397
+ }
2398
+ /** Whether auto-retry is enabled */
2399
+ get autoRetryEnabled() {
2400
+ return this.settingsManager.getRetryEnabled();
2401
+ }
2402
+ /**
2403
+ * Toggle auto-retry setting.
2404
+ */
2405
+ setAutoRetryEnabled(enabled) {
2406
+ this.settingsManager.setRetryEnabled(enabled);
2407
+ }
2408
+ // =========================================================================
2409
+ // Bash Execution
2410
+ // =========================================================================
2411
+ /**
2412
+ * Execute a bash command.
2413
+ * Adds result to agent context and session.
2414
+ * @param command The bash command to execute
2415
+ * @param onChunk Optional streaming callback for output
2416
+ * @param options.excludeFromContext If true, command output won't be sent to LLM (!! prefix)
2417
+ * @param options.id Optional identifier included in bash execution update events
2418
+ * @param options.operations Custom BashOperations for remote execution
2419
+ */
2420
+ async executeBash(command, onChunk, options) {
2421
+ const abortController = new AbortController();
2422
+ this._bashAbortControllers.add(abortController);
2423
+ // Apply command prefix if configured (e.g., "shopt -s expand_aliases" for alias support)
2424
+ const prefix = this.settingsManager.getShellCommandPrefix();
2425
+ const shellPath = this.settingsManager.getShellPath();
2426
+ const resolvedCommand = prefix ? `${prefix}\n${command}` : command;
2427
+ try {
2428
+ const result = await executeBashWithOperations(resolvedCommand, this.sessionManager.getCwd(), options?.operations ?? createLocalBashOperations({ shellPath }), {
2429
+ onChunk: (delta) => {
2430
+ onChunk?.(delta);
2431
+ this._emit({ type: "bash_execution_update", id: options?.id, delta });
2432
+ },
2433
+ signal: abortController.signal,
2434
+ });
2435
+ this.recordBashResult(command, result, options);
2436
+ return result;
2437
+ }
2438
+ finally {
2439
+ this._bashAbortControllers.delete(abortController);
2440
+ }
2441
+ }
2442
+ /**
2443
+ * Record a bash execution result in session history.
2444
+ * Used by executeBash and by extensions that handle bash execution themselves.
2445
+ */
2446
+ recordBashResult(command, result, options) {
2447
+ const bashMessage = {
2448
+ role: "bashExecution",
2449
+ command,
2450
+ output: result.output,
2451
+ exitCode: result.exitCode,
2452
+ cancelled: result.cancelled,
2453
+ truncated: result.truncated,
2454
+ fullOutputPath: result.fullOutputPath,
2455
+ timestamp: Date.now(),
2456
+ excludeFromContext: options?.excludeFromContext,
2457
+ };
2458
+ // If agent is streaming, defer adding to avoid breaking tool_use/tool_result ordering
2459
+ if (this.isStreaming) {
2460
+ // Queue for later - will be flushed on agent_end
2461
+ this._pendingBashMessages.push(bashMessage);
2462
+ }
2463
+ else {
2464
+ // Add to agent state immediately
2465
+ this.agent.state.messages.push(bashMessage);
2466
+ // Save to session
2467
+ this.sessionManager.appendMessage(bashMessage);
2468
+ }
2469
+ }
2470
+ /**
2471
+ * Cancel running bash command.
2472
+ */
2473
+ abortBash() {
2474
+ for (const abortController of [...this._bashAbortControllers]) {
2475
+ abortController.abort();
2476
+ }
2477
+ }
2478
+ /** Whether a bash command is currently running */
2479
+ get isBashRunning() {
2480
+ return this._bashAbortControllers.size > 0;
2481
+ }
2482
+ /** Whether there are pending bash messages waiting to be flushed */
2483
+ get hasPendingBashMessages() {
2484
+ return this._pendingBashMessages.length > 0;
2485
+ }
2486
+ /**
2487
+ * Flush pending bash messages to agent state and session.
2488
+ * Called after agent turn completes to maintain proper message ordering.
2489
+ */
2490
+ _flushPendingBashMessages() {
2491
+ if (this._pendingBashMessages.length === 0)
2492
+ return;
2493
+ for (const bashMessage of this._pendingBashMessages) {
2494
+ // Add to agent state
2495
+ this.agent.state.messages.push(bashMessage);
2496
+ // Save to session
2497
+ this.sessionManager.appendMessage(bashMessage);
2498
+ }
2499
+ this._pendingBashMessages = [];
2500
+ }
2501
+ // =========================================================================
2502
+ // Session Management
2503
+ // =========================================================================
2504
+ /**
2505
+ * Set a display name for the current session.
2506
+ */
2507
+ setSessionName(name) {
2508
+ this.sessionManager.appendSessionInfo(name);
2509
+ const event = { type: "session_info_changed", name: this.sessionManager.getSessionName() };
2510
+ this._emit(event);
2511
+ void this._extensionRunner.emit(event);
2512
+ }
2513
+ // =========================================================================
2514
+ // Tree Navigation
2515
+ // =========================================================================
2516
+ /**
2517
+ * Navigate to a different node in the session tree.
2518
+ * Unlike fork() which creates a new session file, this stays in the same file.
2519
+ *
2520
+ * @param targetId The entry ID to navigate to
2521
+ * @param options.summarize Whether user wants to summarize abandoned branch
2522
+ * @param options.customInstructions Custom instructions for summarizer
2523
+ * @param options.replaceInstructions If true, customInstructions replaces the default prompt
2524
+ * @param options.label Label to attach to the branch summary entry
2525
+ * @returns Result with editorText (if user message) and cancelled status
2526
+ */
2527
+ async navigateTree(targetId, options = {}) {
2528
+ if (this.isStreaming) {
2529
+ throw new Error("Wait for the current response to finish before navigating the session tree.");
2530
+ }
2531
+ const oldLeafId = this.sessionManager.getLeafId();
2532
+ // No-op if already at target
2533
+ if (targetId === oldLeafId) {
2534
+ return { cancelled: false };
2535
+ }
2536
+ // Model required for summarization
2537
+ if (options.summarize && !this.model) {
2538
+ throw new Error("No model available for summarization");
2539
+ }
2540
+ const targetEntry = this.sessionManager.getEntry(targetId);
2541
+ if (!targetEntry) {
2542
+ throw new Error(`Entry ${targetId} not found`);
2543
+ }
2544
+ // Collect entries to summarize (from old leaf to common ancestor)
2545
+ const { entries: entriesToSummarize, commonAncestorId } = collectEntriesForBranchSummary(this.sessionManager, oldLeafId, targetId);
2546
+ // Prepare event data - mutable so extensions can override
2547
+ let customInstructions = options.customInstructions;
2548
+ let replaceInstructions = options.replaceInstructions;
2549
+ let label = options.label;
2550
+ const preparation = {
2551
+ targetId,
2552
+ oldLeafId,
2553
+ commonAncestorId,
2554
+ entriesToSummarize,
2555
+ userWantsSummary: options.summarize ?? false,
2556
+ customInstructions,
2557
+ replaceInstructions,
2558
+ label,
2559
+ };
2560
+ // Set up abort controller for summarization
2561
+ this._branchSummaryAbortController = new AbortController();
2562
+ try {
2563
+ let extensionSummary;
2564
+ let fromExtension = false;
2565
+ // Emit session_before_tree event
2566
+ if (this._extensionRunner.hasHandlers("session_before_tree")) {
2567
+ const result = (await this._extensionRunner.emit({
2568
+ type: "session_before_tree",
2569
+ preparation,
2570
+ signal: this._branchSummaryAbortController.signal,
2571
+ }));
2572
+ if (result?.cancel) {
2573
+ return { cancelled: true };
2574
+ }
2575
+ if (result?.summary && options.summarize) {
2576
+ extensionSummary = result.summary;
2577
+ fromExtension = true;
2578
+ }
2579
+ // Allow extensions to override instructions and label
2580
+ if (result?.customInstructions !== undefined) {
2581
+ customInstructions = result.customInstructions;
2582
+ }
2583
+ if (result?.replaceInstructions !== undefined) {
2584
+ replaceInstructions = result.replaceInstructions;
2585
+ }
2586
+ if (result?.label !== undefined) {
2587
+ label = result.label;
2588
+ }
2589
+ }
2590
+ // Run default summarizer if needed
2591
+ let summaryText;
2592
+ let summaryDetails;
2593
+ let summaryUsage;
2594
+ if (options.summarize && entriesToSummarize.length > 0 && !extensionSummary) {
2595
+ const model = this.model;
2596
+ const { model: requestModel, apiKey, headers, env } = await this._getSummarizationRequestAuth(model);
2597
+ const branchSummarySettings = this.settingsManager.getBranchSummarySettings();
2598
+ const result = await generateBranchSummary(entriesToSummarize, {
2599
+ model: requestModel,
2600
+ apiKey,
2601
+ headers,
2602
+ env,
2603
+ signal: this._branchSummaryAbortController.signal,
2604
+ customInstructions,
2605
+ replaceInstructions,
2606
+ reserveTokens: branchSummarySettings.reserveTokens,
2607
+ streamFn: this.agent.streamFunction,
2608
+ retry: this.settingsManager.getRetrySettings(),
2609
+ callbacks: this._summarizationRetryCallbacks({ source: "branchSummary" }),
2610
+ });
2611
+ if (result.aborted) {
2612
+ return { cancelled: true, aborted: true };
2613
+ }
2614
+ if (result.error) {
2615
+ throw new Error(result.error);
2616
+ }
2617
+ summaryText = result.summary;
2618
+ summaryUsage = result.usage;
2619
+ summaryDetails = {
2620
+ readFiles: result.readFiles || [],
2621
+ modifiedFiles: result.modifiedFiles || [],
2622
+ };
2623
+ }
2624
+ else if (extensionSummary) {
2625
+ summaryText = extensionSummary.summary;
2626
+ summaryDetails = extensionSummary.details;
2627
+ summaryUsage = extensionSummary.usage;
2628
+ }
2629
+ // Determine the new leaf position based on target type
2630
+ let newLeafId;
2631
+ let editorText;
2632
+ if (targetEntry.type === "message" && targetEntry.message.role === "user") {
2633
+ // User message: leaf = parent (null if root), text goes to editor
2634
+ newLeafId = targetEntry.parentId;
2635
+ editorText = contentText(targetEntry.message.content, "");
2636
+ }
2637
+ else if (targetEntry.type === "custom_message") {
2638
+ // Custom message: leaf = parent (null if root), text goes to editor
2639
+ newLeafId = targetEntry.parentId;
2640
+ editorText = contentText(targetEntry.content, "");
2641
+ }
2642
+ else {
2643
+ // Non-user message: leaf = selected node
2644
+ newLeafId = targetId;
2645
+ }
2646
+ // Switch leaf (with or without summary)
2647
+ // Summary is attached at the navigation target position (newLeafId), not the old branch
2648
+ let summaryEntry;
2649
+ if (summaryText) {
2650
+ // Create summary at target position (can be null for root)
2651
+ const summaryId = this.sessionManager.branchWithSummary(newLeafId, summaryText, summaryDetails, fromExtension, summaryUsage);
2652
+ summaryEntry = this.sessionManager.getEntry(summaryId);
2653
+ // Attach label to the summary entry
2654
+ if (label) {
2655
+ this.sessionManager.appendLabelChange(summaryId, label);
2656
+ }
2657
+ }
2658
+ else if (newLeafId === null) {
2659
+ // No summary, navigating to root - reset leaf
2660
+ this.sessionManager.resetLeaf();
2661
+ }
2662
+ else {
2663
+ // No summary, navigating to non-root
2664
+ this.sessionManager.branch(newLeafId);
2665
+ }
2666
+ // Attach label to target entry when not summarizing (no summary entry to label)
2667
+ if (label && !summaryText) {
2668
+ this.sessionManager.appendLabelChange(targetId, label);
2669
+ }
2670
+ // Update agent state
2671
+ const sessionContext = this.sessionManager.buildSessionContext();
2672
+ this.agent.state.messages = sessionContext.messages;
2673
+ // Emit session_tree event
2674
+ await this._extensionRunner.emit({
2675
+ type: "session_tree",
2676
+ newLeafId: this.sessionManager.getLeafId(),
2677
+ oldLeafId,
2678
+ summaryEntry,
2679
+ fromExtension: summaryText ? fromExtension : undefined,
2680
+ });
2681
+ // Emit to custom tools
2682
+ return { editorText, cancelled: false, summaryEntry };
2683
+ }
2684
+ finally {
2685
+ this._branchSummaryAbortController = undefined;
2686
+ this._resolveIdleWaitIfIdle();
2687
+ }
2688
+ }
2689
+ /**
2690
+ * Get all user messages from session for fork selector.
2691
+ */
2692
+ getUserMessagesForForking() {
2693
+ const entries = this.sessionManager.getEntries();
2694
+ const result = [];
2695
+ for (const entry of entries) {
2696
+ if (entry.type !== "message")
2697
+ continue;
2698
+ if (entry.message.role !== "user")
2699
+ continue;
2700
+ const text = contentText(entry.message.content, "");
2701
+ if (text) {
2702
+ result.push({ entryId: entry.id, text });
2703
+ }
2704
+ }
2705
+ return result;
2706
+ }
2707
+ /**
2708
+ * Get session statistics. Aggregates over ALL session entries (including
2709
+ * history that was compacted away), so token/cost totals reflect what was
2710
+ * actually billed across the session.
2711
+ */
2712
+ getSessionStats() {
2713
+ let userMessages = 0;
2714
+ let assistantMessages = 0;
2715
+ let toolResults = 0;
2716
+ let totalMessages = 0;
2717
+ let toolCalls = 0;
2718
+ const usageTotals = createUsageTotals();
2719
+ for (const entry of this.sessionManager.getEntries()) {
2720
+ if ((entry.type === "branch_summary" || entry.type === "compaction") && entry.usage) {
2721
+ addUsageToTotals(usageTotals, entry.usage);
2722
+ }
2723
+ if (entry.type !== "message")
2724
+ continue;
2725
+ totalMessages++;
2726
+ const message = entry.message;
2727
+ if (message.role === "user") {
2728
+ userMessages++;
2729
+ }
2730
+ else if (message.role === "toolResult") {
2731
+ toolResults++;
2732
+ if (message.usage) {
2733
+ addUsageToTotals(usageTotals, message.usage);
2734
+ }
2735
+ }
2736
+ else if (message.role === "assistant") {
2737
+ assistantMessages++;
2738
+ const assistantMsg = message;
2739
+ if (Array.isArray(assistantMsg.content)) {
2740
+ toolCalls += assistantMsg.content.filter((c) => c.type === "toolCall").length;
2741
+ }
2742
+ addUsageToTotals(usageTotals, assistantMsg.usage);
2743
+ }
2744
+ }
2745
+ return {
2746
+ sessionFile: this.sessionFile,
2747
+ sessionId: this.sessionId,
2748
+ userMessages,
2749
+ assistantMessages,
2750
+ toolCalls,
2751
+ toolResults,
2752
+ totalMessages,
2753
+ tokens: {
2754
+ input: usageTotals.input,
2755
+ output: usageTotals.output,
2756
+ cacheRead: usageTotals.cacheRead,
2757
+ cacheWrite: usageTotals.cacheWrite,
2758
+ total: usageTotals.input + usageTotals.output + usageTotals.cacheRead + usageTotals.cacheWrite,
2759
+ },
2760
+ cost: usageTotals.cost,
2761
+ contextUsage: this.getContextUsage(),
2762
+ };
2763
+ }
2764
+ getContextUsage() {
2765
+ const model = this.model;
2766
+ if (!model)
2767
+ return undefined;
2768
+ const contextWindow = model.contextWindow ?? 0;
2769
+ if (contextWindow <= 0)
2770
+ return undefined;
2771
+ // After compaction, the last assistant usage reflects pre-compaction context size.
2772
+ // We can only trust usage from an assistant that responded after the latest compaction.
2773
+ // If no such assistant exists, context token count is unknown until the next LLM response.
2774
+ const branchEntries = this.sessionManager.getBranch();
2775
+ const latestCompaction = getLatestCompactionEntry(branchEntries);
2776
+ if (latestCompaction) {
2777
+ // Check if there's a valid assistant usage after the compaction boundary
2778
+ const compactionIndex = branchEntries.lastIndexOf(latestCompaction);
2779
+ let hasPostCompactionUsage = false;
2780
+ for (let i = branchEntries.length - 1; i > compactionIndex; i--) {
2781
+ const entry = branchEntries[i];
2782
+ if (entry.type === "message" && entry.message.role === "assistant") {
2783
+ const assistant = entry.message;
2784
+ if (assistant.stopReason !== "aborted" && assistant.stopReason !== "error") {
2785
+ const contextTokens = calculateContextTokens(assistant.usage);
2786
+ if (contextTokens > 0) {
2787
+ hasPostCompactionUsage = true;
2788
+ break;
2789
+ }
2790
+ }
2791
+ }
2792
+ }
2793
+ if (!hasPostCompactionUsage) {
2794
+ return { tokens: null, contextWindow, percent: null };
2795
+ }
2796
+ }
2797
+ const estimate = estimateContextTokens(this.messages);
2798
+ const percent = (estimate.tokens / contextWindow) * 100;
2799
+ return {
2800
+ tokens: estimate.tokens,
2801
+ contextWindow,
2802
+ percent,
2803
+ };
2804
+ }
2805
+ /**
2806
+ * Export session to HTML.
2807
+ * @param outputPath Optional output path (defaults to session directory)
2808
+ * @param options Optional export presentation settings
2809
+ * @returns Path to exported file
2810
+ */
2811
+ async exportToHtml(outputPath, options = {}) {
2812
+ const themeName = [options.themeName, this.settingsManager.getTheme()].find((candidate) => candidate !== undefined && getThemeByName(candidate) !== undefined);
2813
+ // Create tool renderer if we have an extension runner (for custom tool HTML rendering)
2814
+ const toolRenderer = createToolHtmlRenderer({
2815
+ getToolDefinition: (name) => this.getToolDefinition(name),
2816
+ theme,
2817
+ cwd: this.sessionManager.getCwd(),
2818
+ });
2819
+ return await exportSessionToHtml(this.sessionManager, this.state, {
2820
+ outputPath,
2821
+ themeName,
2822
+ toolRenderer,
2823
+ });
2824
+ }
2825
+ /**
2826
+ * Export the current session branch to a JSONL file.
2827
+ * Writes the session header followed by all entries on the current branch path.
2828
+ * @param outputPath Target file path. If omitted, generates a timestamped file in cwd.
2829
+ * @returns The resolved output file path.
2830
+ */
2831
+ exportToJsonl(outputPath) {
2832
+ return exportSessionToJsonl(this.sessionManager, outputPath);
2833
+ }
2834
+ // =========================================================================
2835
+ // Utilities
2836
+ // =========================================================================
2837
+ /**
2838
+ * Get text content of last assistant message.
2839
+ * Useful for /copy command.
2840
+ * @returns Text content, or undefined if no assistant message exists
2841
+ */
2842
+ getLastAssistantText() {
2843
+ const lastAssistant = this.messages
2844
+ .slice()
2845
+ .reverse()
2846
+ .find((m) => {
2847
+ if (m.role !== "assistant")
2848
+ return false;
2849
+ const msg = m;
2850
+ // Skip aborted messages with no content
2851
+ if (msg.stopReason === "aborted" && msg.content.length === 0)
2852
+ return false;
2853
+ return true;
2854
+ });
2855
+ if (!lastAssistant)
2856
+ return undefined;
2857
+ let text = "";
2858
+ for (const content of lastAssistant.content) {
2859
+ if (content.type === "text") {
2860
+ text += content.text;
2861
+ }
2862
+ }
2863
+ return text.trim() || undefined;
2864
+ }
2865
+ // =========================================================================
2866
+ // Extension System
2867
+ // =========================================================================
2868
+ createReplacedSessionContext() {
2869
+ const context = Object.defineProperties({}, Object.getOwnPropertyDescriptors(this._extensionRunner.createCommandContext()));
2870
+ context.sendMessage = (message, options) => this.sendCustomMessage(message, options);
2871
+ context.sendUserMessage = (content, options) => this.sendUserMessage(content, options);
2872
+ return context;
2873
+ }
2874
+ /**
2875
+ * Check if extensions have handlers for a specific event type.
2876
+ */
2877
+ hasExtensionHandlers(eventType) {
2878
+ return this._extensionRunner.hasHandlers(eventType);
2879
+ }
2880
+ /**
2881
+ * Get the extension runner (for setting UI context and error handlers).
2882
+ */
2883
+ get extensionRunner() {
2884
+ return this._extensionRunner;
2885
+ }
2886
+ }
2887
+ //# sourceMappingURL=agent-session.js.map