pi-usereq 0.48.0 → 0.50.0

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 (939) hide show
  1. package/README.md +1 -1
  2. package/package.json +5 -1
  3. package/scripts/lib/extension-debug-harness.ts +443 -0
  4. package/scripts/lib/recording-extension-api.ts +855 -0
  5. package/scripts/lib/sdk-smoke.ts +503 -0
  6. package/src/core/prompts.ts +4 -4
  7. package/.g.conf +0 -16
  8. package/.github/workflows/release-npm.yml +0 -134
  9. package/.gitignore +0 -274
  10. package/CHANGELOG.md +0 -699
  11. package/TODO.md +0 -20
  12. package/docs/pi.dev/agent-document-manifest.json +0 -6399
  13. package/docs/pi.dev/coding-agent-docs/compaction.md +0 -394
  14. package/docs/pi.dev/coding-agent-docs/custom-provider.md +0 -637
  15. package/docs/pi.dev/coding-agent-docs/development.md +0 -71
  16. package/docs/pi.dev/coding-agent-docs/extensions.md +0 -2536
  17. package/docs/pi.dev/coding-agent-docs/images/doom-extension.png +0 -0
  18. package/docs/pi.dev/coding-agent-docs/images/exy.png +0 -0
  19. package/docs/pi.dev/coding-agent-docs/images/interactive-mode.png +0 -0
  20. package/docs/pi.dev/coding-agent-docs/images/tree-view.png +0 -0
  21. package/docs/pi.dev/coding-agent-docs/json.md +0 -82
  22. package/docs/pi.dev/coding-agent-docs/keybindings.md +0 -197
  23. package/docs/pi.dev/coding-agent-docs/models.md +0 -395
  24. package/docs/pi.dev/coding-agent-docs/packages.md +0 -218
  25. package/docs/pi.dev/coding-agent-docs/prompt-templates.md +0 -88
  26. package/docs/pi.dev/coding-agent-docs/providers.md +0 -196
  27. package/docs/pi.dev/coding-agent-docs/rpc.md +0 -1407
  28. package/docs/pi.dev/coding-agent-docs/sdk.md +0 -1149
  29. package/docs/pi.dev/coding-agent-docs/session.md +0 -412
  30. package/docs/pi.dev/coding-agent-docs/settings.md +0 -248
  31. package/docs/pi.dev/coding-agent-docs/shell-aliases.md +0 -13
  32. package/docs/pi.dev/coding-agent-docs/skills.md +0 -232
  33. package/docs/pi.dev/coding-agent-docs/terminal-setup.md +0 -106
  34. package/docs/pi.dev/coding-agent-docs/termux.md +0 -127
  35. package/docs/pi.dev/coding-agent-docs/themes.md +0 -295
  36. package/docs/pi.dev/coding-agent-docs/tmux.md +0 -61
  37. package/docs/pi.dev/coding-agent-docs/tree.md +0 -233
  38. package/docs/pi.dev/coding-agent-docs/tui.md +0 -918
  39. package/docs/pi.dev/coding-agent-docs/windows.md +0 -17
  40. package/docs/pi.dev/mom-docs/artifacts-server.md +0 -475
  41. package/docs/pi.dev/mom-docs/events.md +0 -307
  42. package/docs/pi.dev/mom-docs/new.md +0 -970
  43. package/docs/pi.dev/mom-docs/sandbox.md +0 -153
  44. package/docs/pi.dev/mom-docs/slack-bot-minimal-guide.md +0 -399
  45. package/docs/pi.dev/mom-docs/v86.md +0 -319
  46. package/docs/pi.dev/pods-docs/gml-4.5.md +0 -189
  47. package/docs/pi.dev/pods-docs/gpt-oss.md +0 -233
  48. package/docs/pi.dev/pods-docs/implementation-plan.md +0 -183
  49. package/docs/pi.dev/pods-docs/kimi-k2.md +0 -197
  50. package/docs/pi.dev/pods-docs/models.md +0 -116
  51. package/docs/pi.dev/pods-docs/plan.md +0 -166
  52. package/docs/pi.dev/pods-docs/qwen3-coder.md +0 -132
  53. package/images/flowchart-bw.png +0 -0
  54. package/images/flowchart-bw.svg +0 -102
  55. package/images/flowchart.md +0 -100
  56. package/images/flowchart.png +0 -0
  57. package/images/flowchart.svg +0 -3
  58. package/pi-usereq/docs/REFERENCES.md +0 -5713
  59. package/pi-usereq/docs/REQUIREMENTS.md +0 -779
  60. package/pi-usereq/docs/WORKFLOW.md +0 -1341
  61. package/pi.dev-src/pi-mono/agent/src/agent-loop.ts +0 -683
  62. package/pi.dev-src/pi-mono/agent/src/agent.ts +0 -543
  63. package/pi.dev-src/pi-mono/agent/src/index.ts +0 -8
  64. package/pi.dev-src/pi-mono/agent/src/proxy.ts +0 -367
  65. package/pi.dev-src/pi-mono/agent/src/types.ts +0 -364
  66. package/pi.dev-src/pi-mono/agent/test/agent-loop.test.ts +0 -1181
  67. package/pi.dev-src/pi-mono/agent/test/agent.test.ts +0 -463
  68. package/pi.dev-src/pi-mono/agent/test/e2e.test.ts +0 -404
  69. package/pi.dev-src/pi-mono/agent/test/utils/calculate.ts +0 -32
  70. package/pi.dev-src/pi-mono/agent/test/utils/get-current-time.ts +0 -46
  71. package/pi.dev-src/pi-mono/agent/vitest.config.ts +0 -9
  72. package/pi.dev-src/pi-mono/ai/bedrock-provider.d.ts +0 -1
  73. package/pi.dev-src/pi-mono/ai/bedrock-provider.js +0 -1
  74. package/pi.dev-src/pi-mono/ai/scripts/generate-models.ts +0 -1635
  75. package/pi.dev-src/pi-mono/ai/scripts/generate-test-image.ts +0 -34
  76. package/pi.dev-src/pi-mono/ai/src/api-registry.ts +0 -98
  77. package/pi.dev-src/pi-mono/ai/src/bedrock-provider.ts +0 -6
  78. package/pi.dev-src/pi-mono/ai/src/cli.ts +0 -133
  79. package/pi.dev-src/pi-mono/ai/src/env-api-keys.ts +0 -134
  80. package/pi.dev-src/pi-mono/ai/src/index.ts +0 -35
  81. package/pi.dev-src/pi-mono/ai/src/models.generated.ts +0 -14928
  82. package/pi.dev-src/pi-mono/ai/src/models.ts +0 -82
  83. package/pi.dev-src/pi-mono/ai/src/oauth.ts +0 -1
  84. package/pi.dev-src/pi-mono/ai/src/providers/amazon-bedrock.ts +0 -929
  85. package/pi.dev-src/pi-mono/ai/src/providers/anthropic.ts +0 -1125
  86. package/pi.dev-src/pi-mono/ai/src/providers/azure-openai-responses.ts +0 -253
  87. package/pi.dev-src/pi-mono/ai/src/providers/faux.ts +0 -499
  88. package/pi.dev-src/pi-mono/ai/src/providers/github-copilot-headers.ts +0 -37
  89. package/pi.dev-src/pi-mono/ai/src/providers/google-gemini-cli.ts +0 -996
  90. package/pi.dev-src/pi-mono/ai/src/providers/google-shared.ts +0 -354
  91. package/pi.dev-src/pi-mono/ai/src/providers/google-vertex.ts +0 -543
  92. package/pi.dev-src/pi-mono/ai/src/providers/google.ts +0 -500
  93. package/pi.dev-src/pi-mono/ai/src/providers/mistral.ts +0 -629
  94. package/pi.dev-src/pi-mono/ai/src/providers/openai-codex-responses.ts +0 -984
  95. package/pi.dev-src/pi-mono/ai/src/providers/openai-completions.ts +0 -1063
  96. package/pi.dev-src/pi-mono/ai/src/providers/openai-responses-shared.ts +0 -539
  97. package/pi.dev-src/pi-mono/ai/src/providers/openai-responses.ts +0 -264
  98. package/pi.dev-src/pi-mono/ai/src/providers/register-builtins.ts +0 -433
  99. package/pi.dev-src/pi-mono/ai/src/providers/simple-options.ts +0 -47
  100. package/pi.dev-src/pi-mono/ai/src/providers/transform-messages.ts +0 -220
  101. package/pi.dev-src/pi-mono/ai/src/stream.ts +0 -59
  102. package/pi.dev-src/pi-mono/ai/src/types.ts +0 -417
  103. package/pi.dev-src/pi-mono/ai/src/utils/event-stream.ts +0 -87
  104. package/pi.dev-src/pi-mono/ai/src/utils/hash.ts +0 -13
  105. package/pi.dev-src/pi-mono/ai/src/utils/headers.ts +0 -7
  106. package/pi.dev-src/pi-mono/ai/src/utils/json-parse.ts +0 -124
  107. package/pi.dev-src/pi-mono/ai/src/utils/overflow.ts +0 -138
  108. package/pi.dev-src/pi-mono/ai/src/utils/sanitize-unicode.ts +0 -25
  109. package/pi.dev-src/pi-mono/ai/src/utils/typebox-helpers.ts +0 -24
  110. package/pi.dev-src/pi-mono/ai/src/utils/validation.ts +0 -324
  111. package/pi.dev-src/pi-mono/ai/test/abort.test.ts +0 -260
  112. package/pi.dev-src/pi-mono/ai/test/anthropic-oauth.test.ts +0 -99
  113. package/pi.dev-src/pi-mono/ai/test/anthropic-opus-4-7-smoke.test.ts +0 -72
  114. package/pi.dev-src/pi-mono/ai/test/anthropic-sse-parsing.test.ts +0 -113
  115. package/pi.dev-src/pi-mono/ai/test/anthropic-thinking-disable.test.ts +0 -152
  116. package/pi.dev-src/pi-mono/ai/test/anthropic-tool-name-normalization.test.ts +0 -205
  117. package/pi.dev-src/pi-mono/ai/test/azure-utils.ts +0 -28
  118. package/pi.dev-src/pi-mono/ai/test/bedrock-endpoint-resolution.test.ts +0 -131
  119. package/pi.dev-src/pi-mono/ai/test/bedrock-models.test.ts +0 -66
  120. package/pi.dev-src/pi-mono/ai/test/bedrock-thinking-payload.test.ts +0 -107
  121. package/pi.dev-src/pi-mono/ai/test/bedrock-utils.ts +0 -18
  122. package/pi.dev-src/pi-mono/ai/test/cache-retention.test.ts +0 -335
  123. package/pi.dev-src/pi-mono/ai/test/context-overflow.test.ts +0 -714
  124. package/pi.dev-src/pi-mono/ai/test/cross-provider-handoff.test.ts +0 -458
  125. package/pi.dev-src/pi-mono/ai/test/data/red-circle.png +0 -0
  126. package/pi.dev-src/pi-mono/ai/test/empty.test.ts +0 -742
  127. package/pi.dev-src/pi-mono/ai/test/faux-provider.test.ts +0 -597
  128. package/pi.dev-src/pi-mono/ai/test/fireworks-models.test.ts +0 -49
  129. package/pi.dev-src/pi-mono/ai/test/github-copilot-anthropic.test.ts +0 -108
  130. package/pi.dev-src/pi-mono/ai/test/github-copilot-oauth.test.ts +0 -196
  131. package/pi.dev-src/pi-mono/ai/test/google-gemini-cli-claude-thinking-header.test.ts +0 -103
  132. package/pi.dev-src/pi-mono/ai/test/google-gemini-cli-empty-stream.test.ts +0 -108
  133. package/pi.dev-src/pi-mono/ai/test/google-gemini-cli-retry-delay.test.ts +0 -53
  134. package/pi.dev-src/pi-mono/ai/test/google-shared-convert-tools.test.ts +0 -187
  135. package/pi.dev-src/pi-mono/ai/test/google-shared-gemini3-unsigned-tool-call.test.ts +0 -172
  136. package/pi.dev-src/pi-mono/ai/test/google-shared-image-tool-result-routing.test.ts +0 -124
  137. package/pi.dev-src/pi-mono/ai/test/google-thinking-disable.test.ts +0 -183
  138. package/pi.dev-src/pi-mono/ai/test/google-thinking-signature.test.ts +0 -38
  139. package/pi.dev-src/pi-mono/ai/test/google-tool-call-missing-args.test.ts +0 -105
  140. package/pi.dev-src/pi-mono/ai/test/google-vertex-api-key-resolution.test.ts +0 -144
  141. package/pi.dev-src/pi-mono/ai/test/image-tool-result.test.ts +0 -481
  142. package/pi.dev-src/pi-mono/ai/test/interleaved-thinking.test.ts +0 -145
  143. package/pi.dev-src/pi-mono/ai/test/lazy-module-load.test.ts +0 -102
  144. package/pi.dev-src/pi-mono/ai/test/mistral-reasoning-mode.test.ts +0 -66
  145. package/pi.dev-src/pi-mono/ai/test/mistral-tool-schema.test.ts +0 -61
  146. package/pi.dev-src/pi-mono/ai/test/oauth.ts +0 -89
  147. package/pi.dev-src/pi-mono/ai/test/openai-codex-cache-affinity-e2e.test.ts +0 -36
  148. package/pi.dev-src/pi-mono/ai/test/openai-codex-stream.test.ts +0 -686
  149. package/pi.dev-src/pi-mono/ai/test/openai-completions-cache-control-format.test.ts +0 -189
  150. package/pi.dev-src/pi-mono/ai/test/openai-completions-prompt-cache.test.ts +0 -198
  151. package/pi.dev-src/pi-mono/ai/test/openai-completions-thinking-as-text.test.ts +0 -214
  152. package/pi.dev-src/pi-mono/ai/test/openai-completions-tool-choice.test.ts +0 -560
  153. package/pi.dev-src/pi-mono/ai/test/openai-completions-tool-result-images.test.ts +0 -101
  154. package/pi.dev-src/pi-mono/ai/test/openai-responses-cache-affinity-e2e.test.ts +0 -32
  155. package/pi.dev-src/pi-mono/ai/test/openai-responses-copilot-provider.test.ts +0 -128
  156. package/pi.dev-src/pi-mono/ai/test/openai-responses-foreign-toolcall-id.test.ts +0 -66
  157. package/pi.dev-src/pi-mono/ai/test/openai-responses-partial-json-cleanup.test.ts +0 -101
  158. package/pi.dev-src/pi-mono/ai/test/openai-responses-reasoning-replay-e2e.test.ts +0 -292
  159. package/pi.dev-src/pi-mono/ai/test/openai-responses-tool-result-images.test.ts +0 -200
  160. package/pi.dev-src/pi-mono/ai/test/openrouter-cache-write-repro.test.ts +0 -78
  161. package/pi.dev-src/pi-mono/ai/test/overflow.test.ts +0 -64
  162. package/pi.dev-src/pi-mono/ai/test/responseid.test.ts +0 -145
  163. package/pi.dev-src/pi-mono/ai/test/stream.test.ts +0 -1405
  164. package/pi.dev-src/pi-mono/ai/test/supports-xhigh.test.ts +0 -34
  165. package/pi.dev-src/pi-mono/ai/test/tokens.test.ts +0 -304
  166. package/pi.dev-src/pi-mono/ai/test/tool-call-id-normalization.test.ts +0 -291
  167. package/pi.dev-src/pi-mono/ai/test/tool-call-without-result.test.ts +0 -313
  168. package/pi.dev-src/pi-mono/ai/test/total-tokens.test.ts +0 -695
  169. package/pi.dev-src/pi-mono/ai/test/transform-messages-copilot-openai-to-anthropic.test.ts +0 -191
  170. package/pi.dev-src/pi-mono/ai/test/unicode-surrogate.test.ts +0 -754
  171. package/pi.dev-src/pi-mono/ai/test/validation.test.ts +0 -116
  172. package/pi.dev-src/pi-mono/ai/test/xhigh.test.ts +0 -71
  173. package/pi.dev-src/pi-mono/ai/test/zen.test.ts +0 -25
  174. package/pi.dev-src/pi-mono/ai/vitest.config.ts +0 -9
  175. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/antigravity-image-gen.ts +0 -418
  176. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/auto-commit-on-exit.ts +0 -49
  177. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/bash-spawn-hook.ts +0 -30
  178. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/bookmark.ts +0 -50
  179. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/built-in-tool-renderer.ts +0 -249
  180. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/claude-rules.ts +0 -86
  181. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/commands.ts +0 -72
  182. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/confirm-destructive.ts +0 -59
  183. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-compaction.ts +0 -127
  184. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-footer.ts +0 -64
  185. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-header.ts +0 -73
  186. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-anthropic/index.ts +0 -604
  187. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +0 -24
  188. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-gitlab-duo/index.ts +0 -349
  189. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-gitlab-duo/test.ts +0 -82
  190. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-qwen-cli/index.ts +0 -345
  191. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dirty-repo-guard.ts +0 -56
  192. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom/build.sh +0 -152
  193. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +0 -72
  194. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom-component.ts +0 -132
  195. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom-engine.ts +0 -173
  196. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom-keys.ts +0 -104
  197. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/index.ts +0 -74
  198. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/wad-finder.ts +0 -51
  199. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/SKILL.md +0 -8
  200. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/dynamic.json +0 -79
  201. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/dynamic.md +0 -5
  202. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/index.ts +0 -15
  203. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-tools.ts +0 -74
  204. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/event-bus.ts +0 -43
  205. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/file-trigger.ts +0 -41
  206. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/git-checkpoint.ts +0 -53
  207. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/github-issue-autocomplete.ts +0 -185
  208. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/handoff.ts +0 -153
  209. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/hello.ts +0 -26
  210. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/hidden-thinking-label.ts +0 -53
  211. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/inline-bash.ts +0 -94
  212. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/input-transform.ts +0 -43
  213. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/interactive-shell.ts +0 -196
  214. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/mac-system-theme.ts +0 -47
  215. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/message-renderer.ts +0 -59
  216. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/minimal-mode.ts +0 -426
  217. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/modal-editor.ts +0 -85
  218. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/model-status.ts +0 -31
  219. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/notify.ts +0 -55
  220. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/overlay-qa-tests.ts +0 -1348
  221. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/overlay-test.ts +0 -150
  222. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/permission-gate.ts +0 -34
  223. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/pirate.ts +0 -47
  224. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/plan-mode/index.ts +0 -340
  225. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/plan-mode/utils.ts +0 -168
  226. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/preset.ts +0 -430
  227. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/prompt-customizer.ts +0 -97
  228. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/protected-paths.ts +0 -30
  229. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/provider-payload.ts +0 -18
  230. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/qna.ts +0 -122
  231. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/question.ts +0 -264
  232. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/questionnaire.ts +0 -427
  233. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/rainbow-editor.ts +0 -88
  234. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/reload-runtime.ts +0 -37
  235. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/rpc-demo.ts +0 -118
  236. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/sandbox/index.ts +0 -321
  237. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/sandbox/package-lock.json +0 -92
  238. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/send-user-message.ts +0 -97
  239. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/session-name.ts +0 -27
  240. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/shutdown-command.ts +0 -63
  241. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/snake.ts +0 -343
  242. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/space-invaders.ts +0 -560
  243. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/ssh.ts +0 -220
  244. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/status-line.ts +0 -32
  245. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/structured-output.ts +0 -65
  246. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/planner.md +0 -37
  247. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/reviewer.md +0 -35
  248. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/scout.md +0 -50
  249. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/worker.md +0 -24
  250. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents.ts +0 -126
  251. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/index.ts +0 -987
  252. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
  253. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/prompts/implement.md +0 -10
  254. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
  255. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/summarize.ts +0 -206
  256. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/system-prompt-header.ts +0 -17
  257. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/tic-tac-toe.ts +0 -1008
  258. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/timed-confirm.ts +0 -70
  259. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/titlebar-spinner.ts +0 -58
  260. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/todo.ts +0 -297
  261. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/tool-override.ts +0 -144
  262. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/tools.ts +0 -141
  263. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/trigger-compact.ts +0 -50
  264. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/truncated-tool.ts +0 -195
  265. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/widget-placement.ts +0 -9
  266. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/with-deps/index.ts +0 -32
  267. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/with-deps/package-lock.json +0 -31
  268. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/working-indicator.ts +0 -123
  269. package/pi.dev-src/pi-mono/coding-agent/examples/extensions/working-message-test.ts +0 -25
  270. package/pi.dev-src/pi-mono/coding-agent/examples/rpc-extension-ui.ts +0 -632
  271. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/01-minimal.ts +0 -22
  272. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/02-custom-model.ts +0 -49
  273. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/03-custom-prompt.ts +0 -62
  274. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/04-skills.ts +0 -55
  275. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/05-tools.ts +0 -44
  276. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/06-extensions.ts +0 -90
  277. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/07-context-files.ts +0 -42
  278. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/08-prompt-templates.ts +0 -51
  279. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/09-api-keys-and-oauth.ts +0 -48
  280. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/10-settings.ts +0 -53
  281. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/11-sessions.ts +0 -48
  282. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/12-full-control.ts +0 -73
  283. package/pi.dev-src/pi-mono/coding-agent/examples/sdk/13-session-runtime.ts +0 -67
  284. package/pi.dev-src/pi-mono/coding-agent/scripts/migrate-sessions.sh +0 -93
  285. package/pi.dev-src/pi-mono/coding-agent/src/bun/cli.ts +0 -6
  286. package/pi.dev-src/pi-mono/coding-agent/src/bun/register-bedrock.ts +0 -4
  287. package/pi.dev-src/pi-mono/coding-agent/src/cli/args.ts +0 -335
  288. package/pi.dev-src/pi-mono/coding-agent/src/cli/config-selector.ts +0 -52
  289. package/pi.dev-src/pi-mono/coding-agent/src/cli/file-processor.ts +0 -100
  290. package/pi.dev-src/pi-mono/coding-agent/src/cli/initial-message.ts +0 -43
  291. package/pi.dev-src/pi-mono/coding-agent/src/cli/list-models.ts +0 -110
  292. package/pi.dev-src/pi-mono/coding-agent/src/cli/session-picker.ts +0 -52
  293. package/pi.dev-src/pi-mono/coding-agent/src/cli.ts +0 -17
  294. package/pi.dev-src/pi-mono/coding-agent/src/config.ts +0 -261
  295. package/pi.dev-src/pi-mono/coding-agent/src/core/agent-session-runtime.ts +0 -394
  296. package/pi.dev-src/pi-mono/coding-agent/src/core/agent-session-services.ts +0 -196
  297. package/pi.dev-src/pi-mono/coding-agent/src/core/agent-session.ts +0 -3096
  298. package/pi.dev-src/pi-mono/coding-agent/src/core/auth-storage.ts +0 -493
  299. package/pi.dev-src/pi-mono/coding-agent/src/core/bash-executor.ts +0 -154
  300. package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/branch-summarization.ts +0 -355
  301. package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/compaction.ts +0 -839
  302. package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/index.ts +0 -7
  303. package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/utils.ts +0 -170
  304. package/pi.dev-src/pi-mono/coding-agent/src/core/defaults.ts +0 -3
  305. package/pi.dev-src/pi-mono/coding-agent/src/core/diagnostics.ts +0 -15
  306. package/pi.dev-src/pi-mono/coding-agent/src/core/event-bus.ts +0 -33
  307. package/pi.dev-src/pi-mono/coding-agent/src/core/exec.ts +0 -107
  308. package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/ansi-to-html.ts +0 -258
  309. package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/index.ts +0 -314
  310. package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/template.css +0 -1017
  311. package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/template.html +0 -55
  312. package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/template.js +0 -1770
  313. package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/tool-renderer.ts +0 -158
  314. package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/vendor/highlight.min.js +0 -1213
  315. package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/vendor/marked.min.js +0 -6
  316. package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/index.ts +0 -171
  317. package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/loader.ts +0 -606
  318. package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/runner.ts +0 -1019
  319. package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/types.ts +0 -1542
  320. package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/wrapper.ts +0 -30
  321. package/pi.dev-src/pi-mono/coding-agent/src/core/footer-data-provider.ts +0 -354
  322. package/pi.dev-src/pi-mono/coding-agent/src/core/index.ts +0 -77
  323. package/pi.dev-src/pi-mono/coding-agent/src/core/keybindings.ts +0 -370
  324. package/pi.dev-src/pi-mono/coding-agent/src/core/messages.ts +0 -195
  325. package/pi.dev-src/pi-mono/coding-agent/src/core/model-registry.ts +0 -858
  326. package/pi.dev-src/pi-mono/coding-agent/src/core/model-resolver.ts +0 -629
  327. package/pi.dev-src/pi-mono/coding-agent/src/core/output-guard.ts +0 -74
  328. package/pi.dev-src/pi-mono/coding-agent/src/core/package-manager.ts +0 -2408
  329. package/pi.dev-src/pi-mono/coding-agent/src/core/prompt-templates.ts +0 -296
  330. package/pi.dev-src/pi-mono/coding-agent/src/core/resolve-config-value.ts +0 -142
  331. package/pi.dev-src/pi-mono/coding-agent/src/core/resource-loader.ts +0 -917
  332. package/pi.dev-src/pi-mono/coding-agent/src/core/sdk.ts +0 -380
  333. package/pi.dev-src/pi-mono/coding-agent/src/core/session-cwd.ts +0 -59
  334. package/pi.dev-src/pi-mono/coding-agent/src/core/session-manager.ts +0 -1425
  335. package/pi.dev-src/pi-mono/coding-agent/src/core/settings-manager.ts +0 -999
  336. package/pi.dev-src/pi-mono/coding-agent/src/core/skills.ts +0 -508
  337. package/pi.dev-src/pi-mono/coding-agent/src/core/slash-commands.ts +0 -39
  338. package/pi.dev-src/pi-mono/coding-agent/src/core/source-info.ts +0 -40
  339. package/pi.dev-src/pi-mono/coding-agent/src/core/system-prompt.ts +0 -172
  340. package/pi.dev-src/pi-mono/coding-agent/src/core/telemetry.ts +0 -13
  341. package/pi.dev-src/pi-mono/coding-agent/src/core/timings.ts +0 -31
  342. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/bash.ts +0 -448
  343. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/edit-diff.ts +0 -445
  344. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/edit.ts +0 -487
  345. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/file-mutation-queue.ts +0 -39
  346. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/find.ts +0 -370
  347. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/grep.ts +0 -384
  348. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/index.ts +0 -196
  349. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/ls.ts +0 -229
  350. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/path-utils.ts +0 -94
  351. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/read.ts +0 -273
  352. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/render-utils.ts +0 -64
  353. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/tool-definition-wrapper.ts +0 -45
  354. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/truncate.ts +0 -265
  355. package/pi.dev-src/pi-mono/coding-agent/src/core/tools/write.ts +0 -281
  356. package/pi.dev-src/pi-mono/coding-agent/src/index.ts +0 -352
  357. package/pi.dev-src/pi-mono/coding-agent/src/main.ts +0 -731
  358. package/pi.dev-src/pi-mono/coding-agent/src/migrations.ts +0 -314
  359. package/pi.dev-src/pi-mono/coding-agent/src/modes/index.ts +0 -9
  360. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/assets/clankolas.png +0 -0
  361. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/armin.ts +0 -382
  362. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/assistant-message.ts +0 -147
  363. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/bash-execution.ts +0 -218
  364. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/bordered-loader.ts +0 -68
  365. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/branch-summary-message.ts +0 -58
  366. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/compaction-summary-message.ts +0 -59
  367. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/config-selector.ts +0 -592
  368. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/countdown-timer.ts +0 -38
  369. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/custom-editor.ts +0 -80
  370. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/custom-message.ts +0 -99
  371. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/daxnuts.ts +0 -164
  372. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/diff.ts +0 -147
  373. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/dynamic-border.ts +0 -25
  374. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/earendil-announcement.ts +0 -53
  375. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/extension-editor.ts +0 -147
  376. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/extension-input.ts +0 -87
  377. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/extension-selector.ts +0 -107
  378. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/footer.ts +0 -220
  379. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/index.ts +0 -32
  380. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/keybinding-hints.ts +0 -24
  381. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/login-dialog.ts +0 -178
  382. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/model-selector.ts +0 -338
  383. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/oauth-selector.ts +0 -121
  384. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/scoped-models-selector.ts +0 -355
  385. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/session-selector-search.ts +0 -194
  386. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/session-selector.ts +0 -1026
  387. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/settings-selector.ts +0 -456
  388. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/show-images-selector.ts +0 -50
  389. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/skill-invocation-message.ts +0 -55
  390. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/theme-selector.ts +0 -67
  391. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/thinking-selector.ts +0 -74
  392. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/tool-execution.ts +0 -352
  393. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/tree-selector.ts +0 -1246
  394. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/user-message-selector.ts +0 -155
  395. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/user-message.ts +0 -35
  396. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/visual-truncate.ts +0 -50
  397. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/interactive-mode.ts +0 -5155
  398. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/dark.json +0 -85
  399. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/light.json +0 -84
  400. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/theme-schema.json +0 -335
  401. package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/theme.ts +0 -1141
  402. package/pi.dev-src/pi-mono/coding-agent/src/modes/print-mode.ts +0 -158
  403. package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/jsonl.ts +0 -58
  404. package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/rpc-client.ts +0 -515
  405. package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/rpc-mode.ts +0 -745
  406. package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/rpc-types.ts +0 -264
  407. package/pi.dev-src/pi-mono/coding-agent/src/package-manager-cli.ts +0 -270
  408. package/pi.dev-src/pi-mono/coding-agent/src/utils/changelog.ts +0 -99
  409. package/pi.dev-src/pi-mono/coding-agent/src/utils/child-process.ts +0 -86
  410. package/pi.dev-src/pi-mono/coding-agent/src/utils/clipboard-image.ts +0 -300
  411. package/pi.dev-src/pi-mono/coding-agent/src/utils/clipboard-native.ts +0 -22
  412. package/pi.dev-src/pi-mono/coding-agent/src/utils/clipboard.ts +0 -81
  413. package/pi.dev-src/pi-mono/coding-agent/src/utils/exif-orientation.ts +0 -183
  414. package/pi.dev-src/pi-mono/coding-agent/src/utils/frontmatter.ts +0 -39
  415. package/pi.dev-src/pi-mono/coding-agent/src/utils/fs-watch.ts +0 -30
  416. package/pi.dev-src/pi-mono/coding-agent/src/utils/git.ts +0 -192
  417. package/pi.dev-src/pi-mono/coding-agent/src/utils/image-convert.ts +0 -41
  418. package/pi.dev-src/pi-mono/coding-agent/src/utils/image-resize.ts +0 -176
  419. package/pi.dev-src/pi-mono/coding-agent/src/utils/mime.ts +0 -30
  420. package/pi.dev-src/pi-mono/coding-agent/src/utils/paths.ts +0 -20
  421. package/pi.dev-src/pi-mono/coding-agent/src/utils/photon.ts +0 -139
  422. package/pi.dev-src/pi-mono/coding-agent/src/utils/shell.ts +0 -210
  423. package/pi.dev-src/pi-mono/coding-agent/src/utils/sleep.ts +0 -18
  424. package/pi.dev-src/pi-mono/coding-agent/src/utils/tools-manager.ts +0 -287
  425. package/pi.dev-src/pi-mono/coding-agent/test/agent-session-auto-compaction-queue.test.ts +0 -437
  426. package/pi.dev-src/pi-mono/coding-agent/test/agent-session-branching.test.ts +0 -156
  427. package/pi.dev-src/pi-mono/coding-agent/test/agent-session-compaction.test.ts +0 -208
  428. package/pi.dev-src/pi-mono/coding-agent/test/agent-session-concurrent.test.ts +0 -618
  429. package/pi.dev-src/pi-mono/coding-agent/test/agent-session-dynamic-provider.test.ts +0 -117
  430. package/pi.dev-src/pi-mono/coding-agent/test/agent-session-dynamic-tools.test.ts +0 -182
  431. package/pi.dev-src/pi-mono/coding-agent/test/agent-session-retry.test.ts +0 -318
  432. package/pi.dev-src/pi-mono/coding-agent/test/agent-session-runtime-events.test.ts +0 -208
  433. package/pi.dev-src/pi-mono/coding-agent/test/agent-session-stats.test.ts +0 -143
  434. package/pi.dev-src/pi-mono/coding-agent/test/agent-session-tree-navigation.test.ts +0 -323
  435. package/pi.dev-src/pi-mono/coding-agent/test/args.test.ts +0 -328
  436. package/pi.dev-src/pi-mono/coding-agent/test/assistant-message.test.ts +0 -57
  437. package/pi.dev-src/pi-mono/coding-agent/test/auth-storage.test.ts +0 -462
  438. package/pi.dev-src/pi-mono/coding-agent/test/bash-close-hang-windows.test.ts +0 -126
  439. package/pi.dev-src/pi-mono/coding-agent/test/bash-execution-width.test.ts +0 -80
  440. package/pi.dev-src/pi-mono/coding-agent/test/block-images.test.ts +0 -120
  441. package/pi.dev-src/pi-mono/coding-agent/test/clipboard-image-bmp-conversion.test.ts +0 -88
  442. package/pi.dev-src/pi-mono/coding-agent/test/clipboard-image.test.ts +0 -136
  443. package/pi.dev-src/pi-mono/coding-agent/test/compaction-extensions-example.test.ts +0 -66
  444. package/pi.dev-src/pi-mono/coding-agent/test/compaction-extensions.test.ts +0 -415
  445. package/pi.dev-src/pi-mono/coding-agent/test/compaction-serialization.test.ts +0 -79
  446. package/pi.dev-src/pi-mono/coding-agent/test/compaction-summary-reasoning.test.ts +0 -118
  447. package/pi.dev-src/pi-mono/coding-agent/test/compaction-thinking-model.test.ts +0 -223
  448. package/pi.dev-src/pi-mono/coding-agent/test/compaction.test.ts +0 -550
  449. package/pi.dev-src/pi-mono/coding-agent/test/config.test.ts +0 -30
  450. package/pi.dev-src/pi-mono/coding-agent/test/edit-tool-legacy-input.test.ts +0 -116
  451. package/pi.dev-src/pi-mono/coding-agent/test/edit-tool-no-full-redraw.test.ts +0 -235
  452. package/pi.dev-src/pi-mono/coding-agent/test/export-html-whitespace.test.ts +0 -12
  453. package/pi.dev-src/pi-mono/coding-agent/test/export-html-xss.test.ts +0 -28
  454. package/pi.dev-src/pi-mono/coding-agent/test/extensions-discovery.test.ts +0 -463
  455. package/pi.dev-src/pi-mono/coding-agent/test/extensions-input-event.test.ts +0 -112
  456. package/pi.dev-src/pi-mono/coding-agent/test/extensions-runner.test.ts +0 -805
  457. package/pi.dev-src/pi-mono/coding-agent/test/file-mutation-queue.test.ts +0 -163
  458. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/assistant-message-with-thinking-code.json +0 -33
  459. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/before-compaction.jsonl +0 -1003
  460. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/empty-agent/.gitkeep +0 -0
  461. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/empty-cwd/.gitkeep +0 -0
  462. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/large-session.jsonl +0 -1019
  463. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/consecutive-hyphens/SKILL.md +0 -8
  464. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/disable-model-invocation/SKILL.md +0 -9
  465. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/invalid-name-chars/SKILL.md +0 -8
  466. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/invalid-yaml/SKILL.md +0 -8
  467. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/long-name/SKILL.md +0 -8
  468. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/missing-description/SKILL.md +0 -7
  469. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/multiline-description/SKILL.md +0 -11
  470. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/name-mismatch/SKILL.md +0 -8
  471. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/nested/child-skill/SKILL.md +0 -8
  472. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/no-frontmatter/SKILL.md +0 -3
  473. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/root-skill-preferred/SKILL.md +0 -3
  474. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/root-skill-preferred/nested-child/SKILL.md +0 -3
  475. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/unknown-field/SKILL.md +0 -10
  476. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/valid-skill/SKILL.md +0 -8
  477. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills-collision/first/calendar/SKILL.md +0 -8
  478. package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills-collision/second/calendar/SKILL.md +0 -8
  479. package/pi.dev-src/pi-mono/coding-agent/test/footer-data-provider.test.ts +0 -265
  480. package/pi.dev-src/pi-mono/coding-agent/test/footer-width.test.ts +0 -115
  481. package/pi.dev-src/pi-mono/coding-agent/test/frontmatter.test.ts +0 -60
  482. package/pi.dev-src/pi-mono/coding-agent/test/git-ssh-url.test.ts +0 -78
  483. package/pi.dev-src/pi-mono/coding-agent/test/git-update.test.ts +0 -411
  484. package/pi.dev-src/pi-mono/coding-agent/test/image-processing.test.ts +0 -145
  485. package/pi.dev-src/pi-mono/coding-agent/test/image-resize-callers.test.ts +0 -53
  486. package/pi.dev-src/pi-mono/coding-agent/test/initial-message.test.ts +0 -48
  487. package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-anthropic-warning.test.ts +0 -73
  488. package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-clone-command.test.ts +0 -77
  489. package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-compaction.test.ts +0 -57
  490. package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-import-command.test.ts +0 -144
  491. package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-status.test.ts +0 -635
  492. package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-suspend.test.ts +0 -149
  493. package/pi.dev-src/pi-mono/coding-agent/test/keybindings-migration.test.ts +0 -88
  494. package/pi.dev-src/pi-mono/coding-agent/test/model-registry.test.ts +0 -1209
  495. package/pi.dev-src/pi-mono/coding-agent/test/model-resolver.test.ts +0 -436
  496. package/pi.dev-src/pi-mono/coding-agent/test/package-command-paths.test.ts +0 -144
  497. package/pi.dev-src/pi-mono/coding-agent/test/package-manager-ssh.test.ts +0 -97
  498. package/pi.dev-src/pi-mono/coding-agent/test/package-manager.test.ts +0 -1795
  499. package/pi.dev-src/pi-mono/coding-agent/test/path-utils.test.ts +0 -162
  500. package/pi.dev-src/pi-mono/coding-agent/test/plan-mode-utils.test.ts +0 -261
  501. package/pi.dev-src/pi-mono/coding-agent/test/print-mode.test.ts +0 -140
  502. package/pi.dev-src/pi-mono/coding-agent/test/prompt-templates.test.ts +0 -515
  503. package/pi.dev-src/pi-mono/coding-agent/test/resource-loader.test.ts +0 -576
  504. package/pi.dev-src/pi-mono/coding-agent/test/rpc-client-clone.test.ts +0 -29
  505. package/pi.dev-src/pi-mono/coding-agent/test/rpc-example.ts +0 -86
  506. package/pi.dev-src/pi-mono/coding-agent/test/rpc-jsonl.test.ts +0 -65
  507. package/pi.dev-src/pi-mono/coding-agent/test/rpc-prompt-response-semantics.test.ts +0 -285
  508. package/pi.dev-src/pi-mono/coding-agent/test/rpc.test.ts +0 -321
  509. package/pi.dev-src/pi-mono/coding-agent/test/sdk-codex-cache-probe-tool-loop.ts +0 -364
  510. package/pi.dev-src/pi-mono/coding-agent/test/sdk-openrouter-attribution.test.ts +0 -181
  511. package/pi.dev-src/pi-mono/coding-agent/test/sdk-session-manager.test.ts +0 -95
  512. package/pi.dev-src/pi-mono/coding-agent/test/sdk-skills.test.ts +0 -109
  513. package/pi.dev-src/pi-mono/coding-agent/test/session-cwd.test.ts +0 -91
  514. package/pi.dev-src/pi-mono/coding-agent/test/session-info-modified-timestamp.test.ts +0 -83
  515. package/pi.dev-src/pi-mono/coding-agent/test/session-manager/build-context.test.ts +0 -268
  516. package/pi.dev-src/pi-mono/coding-agent/test/session-manager/custom-session-id.test.ts +0 -109
  517. package/pi.dev-src/pi-mono/coding-agent/test/session-manager/file-operations.test.ts +0 -208
  518. package/pi.dev-src/pi-mono/coding-agent/test/session-manager/labels.test.ts +0 -198
  519. package/pi.dev-src/pi-mono/coding-agent/test/session-manager/migration.test.ts +0 -78
  520. package/pi.dev-src/pi-mono/coding-agent/test/session-manager/save-entry.test.ts +0 -55
  521. package/pi.dev-src/pi-mono/coding-agent/test/session-manager/tree-traversal.test.ts +0 -533
  522. package/pi.dev-src/pi-mono/coding-agent/test/session-selector-path-delete.test.ts +0 -315
  523. package/pi.dev-src/pi-mono/coding-agent/test/session-selector-rename.test.ts +0 -111
  524. package/pi.dev-src/pi-mono/coding-agent/test/session-selector-search.test.ts +0 -195
  525. package/pi.dev-src/pi-mono/coding-agent/test/settings-manager-bug.test.ts +0 -147
  526. package/pi.dev-src/pi-mono/coding-agent/test/settings-manager.test.ts +0 -319
  527. package/pi.dev-src/pi-mono/coding-agent/test/skills.test.ts +0 -432
  528. package/pi.dev-src/pi-mono/coding-agent/test/stdout-cleanliness.test.ts +0 -103
  529. package/pi.dev-src/pi-mono/coding-agent/test/streaming-render-debug.ts +0 -97
  530. package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-bash-persistence.test.ts +0 -242
  531. package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-compaction.test.ts +0 -343
  532. package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-model-extension.test.ts +0 -325
  533. package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-prompt.test.ts +0 -323
  534. package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-queue.test.ts +0 -422
  535. package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-retry-events.test.ts +0 -358
  536. package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-runtime.test.ts +0 -553
  537. package/pi.dev-src/pi-mono/coding-agent/test/suite/harness.ts +0 -208
  538. package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2023-queued-slash-command-followup.test.ts +0 -80
  539. package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2753-reload-stale-resource-settings.test.ts +0 -100
  540. package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2781-skill-collision-precedence.test.ts +0 -120
  541. package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2791-fswatch-error-crash.test.ts +0 -106
  542. package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2835-tools-allowlist-filters-extension-tools.test.ts +0 -94
  543. package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2860-replaced-session-context.test.ts +0 -274
  544. package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3217-scoped-model-order.test.ts +0 -104
  545. package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3302-find-path-glob.test.ts +0 -72
  546. package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3303-find-nested-gitignore.test.ts +0 -83
  547. package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3317-network-connection-lost-retry.test.ts +0 -33
  548. package/pi.dev-src/pi-mono/coding-agent/test/system-prompt.test.ts +0 -102
  549. package/pi.dev-src/pi-mono/coding-agent/test/test-harness.test.ts +0 -321
  550. package/pi.dev-src/pi-mono/coding-agent/test/test-harness.ts +0 -446
  551. package/pi.dev-src/pi-mono/coding-agent/test/test-theme-colors.ts +0 -246
  552. package/pi.dev-src/pi-mono/coding-agent/test/theme-export.test.ts +0 -104
  553. package/pi.dev-src/pi-mono/coding-agent/test/tool-execution-component.test.ts +0 -331
  554. package/pi.dev-src/pi-mono/coding-agent/test/tools.test.ts +0 -889
  555. package/pi.dev-src/pi-mono/coding-agent/test/tree-selector.test.ts +0 -655
  556. package/pi.dev-src/pi-mono/coding-agent/test/trigger-compact-extension.test.ts +0 -57
  557. package/pi.dev-src/pi-mono/coding-agent/test/truncate-to-width.test.ts +0 -81
  558. package/pi.dev-src/pi-mono/coding-agent/test/user-message.test.ts +0 -25
  559. package/pi.dev-src/pi-mono/coding-agent/test/utilities.ts +0 -316
  560. package/pi.dev-src/pi-mono/coding-agent/tsconfig.examples.json +0 -16
  561. package/pi.dev-src/pi-mono/coding-agent/vitest.config.ts +0 -26
  562. package/pi.dev-src/pi-mono/mom/dev.sh +0 -30
  563. package/pi.dev-src/pi-mono/mom/docker.sh +0 -95
  564. package/pi.dev-src/pi-mono/mom/scripts/migrate-timestamps.ts +0 -121
  565. package/pi.dev-src/pi-mono/mom/src/agent.ts +0 -882
  566. package/pi.dev-src/pi-mono/mom/src/context.ts +0 -180
  567. package/pi.dev-src/pi-mono/mom/src/download.ts +0 -117
  568. package/pi.dev-src/pi-mono/mom/src/events.ts +0 -442
  569. package/pi.dev-src/pi-mono/mom/src/fs-watch.ts +0 -30
  570. package/pi.dev-src/pi-mono/mom/src/log.ts +0 -271
  571. package/pi.dev-src/pi-mono/mom/src/main.ts +0 -367
  572. package/pi.dev-src/pi-mono/mom/src/sandbox.ts +0 -221
  573. package/pi.dev-src/pi-mono/mom/src/slack.ts +0 -623
  574. package/pi.dev-src/pi-mono/mom/src/store.ts +0 -234
  575. package/pi.dev-src/pi-mono/mom/src/tools/attach.ts +0 -47
  576. package/pi.dev-src/pi-mono/mom/src/tools/bash.ts +0 -97
  577. package/pi.dev-src/pi-mono/mom/src/tools/edit.ts +0 -165
  578. package/pi.dev-src/pi-mono/mom/src/tools/index.ts +0 -19
  579. package/pi.dev-src/pi-mono/mom/src/tools/read.ts +0 -159
  580. package/pi.dev-src/pi-mono/mom/src/tools/truncate.ts +0 -236
  581. package/pi.dev-src/pi-mono/mom/src/tools/write.ts +0 -45
  582. package/pi.dev-src/pi-mono/mom/test/events.test.ts +0 -50
  583. package/pi.dev-src/pi-mono/pods/scripts/model_run.sh +0 -83
  584. package/pi.dev-src/pi-mono/pods/scripts/pod_setup.sh +0 -336
  585. package/pi.dev-src/pi-mono/pods/src/cli.ts +0 -360
  586. package/pi.dev-src/pi-mono/pods/src/commands/models.ts +0 -753
  587. package/pi.dev-src/pi-mono/pods/src/commands/pods.ts +0 -205
  588. package/pi.dev-src/pi-mono/pods/src/commands/prompt.ts +0 -84
  589. package/pi.dev-src/pi-mono/pods/src/config.ts +0 -80
  590. package/pi.dev-src/pi-mono/pods/src/index.ts +0 -2
  591. package/pi.dev-src/pi-mono/pods/src/model-configs.ts +0 -111
  592. package/pi.dev-src/pi-mono/pods/src/models.json +0 -295
  593. package/pi.dev-src/pi-mono/pods/src/ssh.ts +0 -151
  594. package/pi.dev-src/pi-mono/pods/src/types.ts +0 -27
  595. package/pi.dev-src/pi-mono/tui/src/autocomplete.ts +0 -783
  596. package/pi.dev-src/pi-mono/tui/src/components/box.ts +0 -137
  597. package/pi.dev-src/pi-mono/tui/src/components/cancellable-loader.ts +0 -40
  598. package/pi.dev-src/pi-mono/tui/src/components/editor.ts +0 -2280
  599. package/pi.dev-src/pi-mono/tui/src/components/image.ts +0 -104
  600. package/pi.dev-src/pi-mono/tui/src/components/input.ts +0 -503
  601. package/pi.dev-src/pi-mono/tui/src/components/loader.ts +0 -86
  602. package/pi.dev-src/pi-mono/tui/src/components/markdown.ts +0 -852
  603. package/pi.dev-src/pi-mono/tui/src/components/select-list.ts +0 -229
  604. package/pi.dev-src/pi-mono/tui/src/components/settings-list.ts +0 -250
  605. package/pi.dev-src/pi-mono/tui/src/components/spacer.ts +0 -28
  606. package/pi.dev-src/pi-mono/tui/src/components/text.ts +0 -106
  607. package/pi.dev-src/pi-mono/tui/src/components/truncated-text.ts +0 -65
  608. package/pi.dev-src/pi-mono/tui/src/editor-component.ts +0 -74
  609. package/pi.dev-src/pi-mono/tui/src/fuzzy.ts +0 -133
  610. package/pi.dev-src/pi-mono/tui/src/index.ts +0 -106
  611. package/pi.dev-src/pi-mono/tui/src/keybindings.ts +0 -244
  612. package/pi.dev-src/pi-mono/tui/src/keys.ts +0 -1400
  613. package/pi.dev-src/pi-mono/tui/src/kill-ring.ts +0 -46
  614. package/pi.dev-src/pi-mono/tui/src/stdin-buffer.ts +0 -386
  615. package/pi.dev-src/pi-mono/tui/src/terminal-image.ts +0 -414
  616. package/pi.dev-src/pi-mono/tui/src/terminal.ts +0 -373
  617. package/pi.dev-src/pi-mono/tui/src/tui.ts +0 -1243
  618. package/pi.dev-src/pi-mono/tui/src/undo-stack.ts +0 -28
  619. package/pi.dev-src/pi-mono/tui/src/utils.ts +0 -1085
  620. package/pi.dev-src/pi-mono/tui/test/autocomplete.test.ts +0 -542
  621. package/pi.dev-src/pi-mono/tui/test/bug-regression-isimageline-startswith-bug.test.ts +0 -237
  622. package/pi.dev-src/pi-mono/tui/test/chat-simple.ts +0 -129
  623. package/pi.dev-src/pi-mono/tui/test/editor.test.ts +0 -3812
  624. package/pi.dev-src/pi-mono/tui/test/fuzzy.test.ts +0 -98
  625. package/pi.dev-src/pi-mono/tui/test/image-test.ts +0 -56
  626. package/pi.dev-src/pi-mono/tui/test/input.test.ts +0 -580
  627. package/pi.dev-src/pi-mono/tui/test/key-tester.ts +0 -105
  628. package/pi.dev-src/pi-mono/tui/test/keybindings.test.ts +0 -38
  629. package/pi.dev-src/pi-mono/tui/test/keys.test.ts +0 -614
  630. package/pi.dev-src/pi-mono/tui/test/markdown.test.ts +0 -1236
  631. package/pi.dev-src/pi-mono/tui/test/overlay-non-capturing.test.ts +0 -609
  632. package/pi.dev-src/pi-mono/tui/test/overlay-options.test.ts +0 -538
  633. package/pi.dev-src/pi-mono/tui/test/overlay-short-content.test.ts +0 -56
  634. package/pi.dev-src/pi-mono/tui/test/regression-regional-indicator-width.test.ts +0 -52
  635. package/pi.dev-src/pi-mono/tui/test/select-list.test.ts +0 -116
  636. package/pi.dev-src/pi-mono/tui/test/stdin-buffer.test.ts +0 -422
  637. package/pi.dev-src/pi-mono/tui/test/terminal-image.test.ts +0 -279
  638. package/pi.dev-src/pi-mono/tui/test/test-themes.ts +0 -38
  639. package/pi.dev-src/pi-mono/tui/test/truncate-to-width.test.ts +0 -62
  640. package/pi.dev-src/pi-mono/tui/test/truncated-text.test.ts +0 -129
  641. package/pi.dev-src/pi-mono/tui/test/tui-cell-size-input.test.ts +0 -81
  642. package/pi.dev-src/pi-mono/tui/test/tui-overlay-style-leak.test.ts +0 -72
  643. package/pi.dev-src/pi-mono/tui/test/tui-render.test.ts +0 -509
  644. package/pi.dev-src/pi-mono/tui/test/viewport-overwrite-repro.ts +0 -106
  645. package/pi.dev-src/pi-mono/tui/test/virtual-terminal.ts +0 -218
  646. package/pi.dev-src/pi-mono/tui/test/wrap-ansi.test.ts +0 -207
  647. package/pi.dev-src/pi-mono/tui/vitest.config.ts +0 -7
  648. package/pi.dev-src/pi-mono/web-ui/example/index.html +0 -13
  649. package/pi.dev-src/pi-mono/web-ui/example/src/app.css +0 -1
  650. package/pi.dev-src/pi-mono/web-ui/example/src/custom-messages.ts +0 -99
  651. package/pi.dev-src/pi-mono/web-ui/example/src/main.ts +0 -421
  652. package/pi.dev-src/pi-mono/web-ui/example/tsconfig.json +0 -23
  653. package/pi.dev-src/pi-mono/web-ui/example/vite.config.ts +0 -6
  654. package/pi.dev-src/pi-mono/web-ui/scripts/count-prompt-tokens.ts +0 -88
  655. package/pi.dev-src/pi-mono/web-ui/src/ChatPanel.ts +0 -209
  656. package/pi.dev-src/pi-mono/web-ui/src/app.css +0 -68
  657. package/pi.dev-src/pi-mono/web-ui/src/components/AgentInterface.ts +0 -403
  658. package/pi.dev-src/pi-mono/web-ui/src/components/AttachmentTile.ts +0 -107
  659. package/pi.dev-src/pi-mono/web-ui/src/components/ConsoleBlock.ts +0 -72
  660. package/pi.dev-src/pi-mono/web-ui/src/components/CustomProviderCard.ts +0 -100
  661. package/pi.dev-src/pi-mono/web-ui/src/components/ExpandableSection.ts +0 -46
  662. package/pi.dev-src/pi-mono/web-ui/src/components/Input.ts +0 -113
  663. package/pi.dev-src/pi-mono/web-ui/src/components/MessageEditor.ts +0 -405
  664. package/pi.dev-src/pi-mono/web-ui/src/components/MessageList.ts +0 -98
  665. package/pi.dev-src/pi-mono/web-ui/src/components/Messages.ts +0 -383
  666. package/pi.dev-src/pi-mono/web-ui/src/components/ProviderKeyInput.ts +0 -153
  667. package/pi.dev-src/pi-mono/web-ui/src/components/SandboxedIframe.ts +0 -626
  668. package/pi.dev-src/pi-mono/web-ui/src/components/StreamingMessageContainer.ts +0 -103
  669. package/pi.dev-src/pi-mono/web-ui/src/components/ThinkingBlock.ts +0 -43
  670. package/pi.dev-src/pi-mono/web-ui/src/components/message-renderer-registry.ts +0 -28
  671. package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/ArtifactsRuntimeProvider.ts +0 -220
  672. package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/AttachmentsRuntimeProvider.ts +0 -66
  673. package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/ConsoleRuntimeProvider.ts +0 -186
  674. package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/FileDownloadRuntimeProvider.ts +0 -110
  675. package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/RuntimeMessageBridge.ts +0 -82
  676. package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/RuntimeMessageRouter.ts +0 -216
  677. package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/SandboxRuntimeProvider.ts +0 -52
  678. package/pi.dev-src/pi-mono/web-ui/src/dialogs/ApiKeyPromptDialog.ts +0 -75
  679. package/pi.dev-src/pi-mono/web-ui/src/dialogs/AttachmentOverlay.ts +0 -636
  680. package/pi.dev-src/pi-mono/web-ui/src/dialogs/CustomProviderDialog.ts +0 -274
  681. package/pi.dev-src/pi-mono/web-ui/src/dialogs/ModelSelector.ts +0 -370
  682. package/pi.dev-src/pi-mono/web-ui/src/dialogs/PersistentStorageDialog.ts +0 -144
  683. package/pi.dev-src/pi-mono/web-ui/src/dialogs/ProvidersModelsTab.ts +0 -212
  684. package/pi.dev-src/pi-mono/web-ui/src/dialogs/SessionListDialog.ts +0 -150
  685. package/pi.dev-src/pi-mono/web-ui/src/dialogs/SettingsDialog.ts +0 -218
  686. package/pi.dev-src/pi-mono/web-ui/src/index.ts +0 -120
  687. package/pi.dev-src/pi-mono/web-ui/src/prompts/prompts.ts +0 -282
  688. package/pi.dev-src/pi-mono/web-ui/src/storage/app-storage.ts +0 -60
  689. package/pi.dev-src/pi-mono/web-ui/src/storage/backends/indexeddb-storage-backend.ts +0 -193
  690. package/pi.dev-src/pi-mono/web-ui/src/storage/store.ts +0 -33
  691. package/pi.dev-src/pi-mono/web-ui/src/storage/stores/custom-providers-store.ts +0 -62
  692. package/pi.dev-src/pi-mono/web-ui/src/storage/stores/provider-keys-store.ts +0 -33
  693. package/pi.dev-src/pi-mono/web-ui/src/storage/stores/sessions-store.ts +0 -136
  694. package/pi.dev-src/pi-mono/web-ui/src/storage/stores/settings-store.ts +0 -34
  695. package/pi.dev-src/pi-mono/web-ui/src/storage/types.ts +0 -206
  696. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ArtifactElement.ts +0 -14
  697. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ArtifactPill.ts +0 -26
  698. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/Console.ts +0 -93
  699. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/DocxArtifact.ts +0 -213
  700. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ExcelArtifact.ts +0 -231
  701. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/GenericArtifact.ts +0 -117
  702. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/HtmlArtifact.ts +0 -195
  703. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ImageArtifact.ts +0 -116
  704. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/MarkdownArtifact.ts +0 -82
  705. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/PdfArtifact.ts +0 -201
  706. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/SvgArtifact.ts +0 -119
  707. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/TextArtifact.ts +0 -148
  708. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/artifacts-tool-renderer.ts +0 -310
  709. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/artifacts.ts +0 -713
  710. package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/index.ts +0 -7
  711. package/pi.dev-src/pi-mono/web-ui/src/tools/extract-document.ts +0 -275
  712. package/pi.dev-src/pi-mono/web-ui/src/tools/index.ts +0 -46
  713. package/pi.dev-src/pi-mono/web-ui/src/tools/javascript-repl.ts +0 -293
  714. package/pi.dev-src/pi-mono/web-ui/src/tools/renderer-registry.ts +0 -130
  715. package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/BashRenderer.ts +0 -52
  716. package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/CalculateRenderer.ts +0 -58
  717. package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/DefaultRenderer.ts +0 -103
  718. package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/GetCurrentTimeRenderer.ts +0 -92
  719. package/pi.dev-src/pi-mono/web-ui/src/tools/types.ts +0 -15
  720. package/pi.dev-src/pi-mono/web-ui/src/utils/attachment-utils.ts +0 -472
  721. package/pi.dev-src/pi-mono/web-ui/src/utils/auth-token.ts +0 -22
  722. package/pi.dev-src/pi-mono/web-ui/src/utils/format.ts +0 -42
  723. package/pi.dev-src/pi-mono/web-ui/src/utils/i18n.ts +0 -653
  724. package/pi.dev-src/pi-mono/web-ui/src/utils/model-discovery.ts +0 -277
  725. package/pi.dev-src/pi-mono/web-ui/src/utils/proxy-utils.ts +0 -139
  726. package/pi.dev-src/pi-mono/web-ui/src/utils/test-sessions.ts +0 -2357
  727. package/pi.dev-src/pi-mono/web-ui/tsconfig.json +0 -7
  728. package/tests/attended-results-scenarios.ts +0 -648
  729. package/tests/attended-results.test.ts +0 -39
  730. package/tests/cli-command-option-parity.test.ts +0 -798
  731. package/tests/debug-extension-harness.test.ts +0 -466
  732. package/tests/extension-registration.test.ts +0 -6785
  733. package/tests/fixtures/fixture_c.c +0 -361
  734. package/tests/fixtures/fixture_cpp.cpp +0 -407
  735. package/tests/fixtures/fixture_csharp.cs +0 -411
  736. package/tests/fixtures/fixture_elixir.ex +0 -409
  737. package/tests/fixtures/fixture_go.go +0 -341
  738. package/tests/fixtures/fixture_haskell.hs +0 -250
  739. package/tests/fixtures/fixture_java.java +0 -430
  740. package/tests/fixtures/fixture_javascript.js +0 -383
  741. package/tests/fixtures/fixture_kotlin.kt +0 -451
  742. package/tests/fixtures/fixture_lua.lua +0 -276
  743. package/tests/fixtures/fixture_perl.pl +0 -310
  744. package/tests/fixtures/fixture_php.php +0 -433
  745. package/tests/fixtures/fixture_python.py +0 -502
  746. package/tests/fixtures/fixture_ruby.rb +0 -345
  747. package/tests/fixtures/fixture_rust.rs +0 -380
  748. package/tests/fixtures/fixture_scala.scala +0 -398
  749. package/tests/fixtures/fixture_shell.sh +0 -276
  750. package/tests/fixtures/fixture_swift.swift +0 -397
  751. package/tests/fixtures/fixture_typescript.ts +0 -434
  752. package/tests/fixtures/fixture_zig.zig +0 -295
  753. package/tests/fixtures_attended_results/project/compress-line-numbers.json +0 -5
  754. package/tests/fixtures_attended_results/project/compress.json +0 -5
  755. package/tests/fixtures_attended_results/project/enable-static-check-invalid-command.json +0 -5
  756. package/tests/fixtures_attended_results/project/enable-static-check-valid.json +0 -5
  757. package/tests/fixtures_attended_results/project/files-static-check.json +0 -5
  758. package/tests/fixtures_attended_results/project/find-line-numbers.json +0 -5
  759. package/tests/fixtures_attended_results/project/find.json +0 -5
  760. package/tests/fixtures_attended_results/project/get-base-path.json +0 -5
  761. package/tests/fixtures_attended_results/project/git-check-clean.json +0 -5
  762. package/tests/fixtures_attended_results/project/git-check-dirty.json +0 -5
  763. package/tests/fixtures_attended_results/project/git-path.json +0 -5
  764. package/tests/fixtures_attended_results/project/git-wt-create-invalid.json +0 -5
  765. package/tests/fixtures_attended_results/project/git-wt-create-valid.json +0 -5
  766. package/tests/fixtures_attended_results/project/git-wt-delete-nonexistent.json +0 -5
  767. package/tests/fixtures_attended_results/project/git-wt-delete-valid.json +0 -5
  768. package/tests/fixtures_attended_results/project/git-wt-name.json +0 -5
  769. package/tests/fixtures_attended_results/project/static-check.json +0 -5
  770. package/tests/fixtures_attended_results/project/summarize.json +0 -5
  771. package/tests/fixtures_attended_results/project/tokens.json +0 -5
  772. package/tests/fixtures_attended_results/standalone/files-compress/fixture_c.c.json +0 -5
  773. package/tests/fixtures_attended_results/standalone/files-compress/fixture_cpp.cpp.json +0 -5
  774. package/tests/fixtures_attended_results/standalone/files-compress/fixture_csharp.cs.json +0 -5
  775. package/tests/fixtures_attended_results/standalone/files-compress/fixture_elixir.ex.json +0 -5
  776. package/tests/fixtures_attended_results/standalone/files-compress/fixture_go.go.json +0 -5
  777. package/tests/fixtures_attended_results/standalone/files-compress/fixture_haskell.hs.json +0 -5
  778. package/tests/fixtures_attended_results/standalone/files-compress/fixture_java.java.json +0 -5
  779. package/tests/fixtures_attended_results/standalone/files-compress/fixture_javascript.js.json +0 -5
  780. package/tests/fixtures_attended_results/standalone/files-compress/fixture_kotlin.kt.json +0 -5
  781. package/tests/fixtures_attended_results/standalone/files-compress/fixture_lua.lua.json +0 -5
  782. package/tests/fixtures_attended_results/standalone/files-compress/fixture_perl.pl.json +0 -5
  783. package/tests/fixtures_attended_results/standalone/files-compress/fixture_php.php.json +0 -5
  784. package/tests/fixtures_attended_results/standalone/files-compress/fixture_python.py.json +0 -5
  785. package/tests/fixtures_attended_results/standalone/files-compress/fixture_ruby.rb.json +0 -5
  786. package/tests/fixtures_attended_results/standalone/files-compress/fixture_rust.rs.json +0 -5
  787. package/tests/fixtures_attended_results/standalone/files-compress/fixture_scala.scala.json +0 -5
  788. package/tests/fixtures_attended_results/standalone/files-compress/fixture_shell.sh.json +0 -5
  789. package/tests/fixtures_attended_results/standalone/files-compress/fixture_swift.swift.json +0 -5
  790. package/tests/fixtures_attended_results/standalone/files-compress/fixture_typescript.ts.json +0 -5
  791. package/tests/fixtures_attended_results/standalone/files-compress/fixture_zig.zig.json +0 -5
  792. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_c.c.json +0 -5
  793. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_cpp.cpp.json +0 -5
  794. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_csharp.cs.json +0 -5
  795. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_elixir.ex.json +0 -5
  796. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_go.go.json +0 -5
  797. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_haskell.hs.json +0 -5
  798. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_java.java.json +0 -5
  799. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_javascript.js.json +0 -5
  800. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_kotlin.kt.json +0 -5
  801. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_lua.lua.json +0 -5
  802. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_perl.pl.json +0 -5
  803. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_php.php.json +0 -5
  804. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_python.py.json +0 -5
  805. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_ruby.rb.json +0 -5
  806. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_rust.rs.json +0 -5
  807. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_scala.scala.json +0 -5
  808. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_shell.sh.json +0 -5
  809. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_swift.swift.json +0 -5
  810. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_typescript.ts.json +0 -5
  811. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_zig.zig.json +0 -5
  812. package/tests/fixtures_attended_results/standalone/files-find/fixture_c.c.json +0 -5
  813. package/tests/fixtures_attended_results/standalone/files-find/fixture_cpp.cpp.json +0 -5
  814. package/tests/fixtures_attended_results/standalone/files-find/fixture_csharp.cs.json +0 -5
  815. package/tests/fixtures_attended_results/standalone/files-find/fixture_elixir.ex.json +0 -5
  816. package/tests/fixtures_attended_results/standalone/files-find/fixture_go.go.json +0 -5
  817. package/tests/fixtures_attended_results/standalone/files-find/fixture_haskell.hs.json +0 -5
  818. package/tests/fixtures_attended_results/standalone/files-find/fixture_java.java.json +0 -5
  819. package/tests/fixtures_attended_results/standalone/files-find/fixture_javascript.js.json +0 -5
  820. package/tests/fixtures_attended_results/standalone/files-find/fixture_kotlin.kt.json +0 -5
  821. package/tests/fixtures_attended_results/standalone/files-find/fixture_lua.lua.json +0 -5
  822. package/tests/fixtures_attended_results/standalone/files-find/fixture_perl.pl.json +0 -5
  823. package/tests/fixtures_attended_results/standalone/files-find/fixture_php.php.json +0 -5
  824. package/tests/fixtures_attended_results/standalone/files-find/fixture_python.py.json +0 -5
  825. package/tests/fixtures_attended_results/standalone/files-find/fixture_ruby.rb.json +0 -5
  826. package/tests/fixtures_attended_results/standalone/files-find/fixture_rust.rs.json +0 -5
  827. package/tests/fixtures_attended_results/standalone/files-find/fixture_scala.scala.json +0 -5
  828. package/tests/fixtures_attended_results/standalone/files-find/fixture_shell.sh.json +0 -5
  829. package/tests/fixtures_attended_results/standalone/files-find/fixture_swift.swift.json +0 -5
  830. package/tests/fixtures_attended_results/standalone/files-find/fixture_typescript.ts.json +0 -5
  831. package/tests/fixtures_attended_results/standalone/files-find/fixture_zig.zig.json +0 -5
  832. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_c.c.json +0 -5
  833. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_cpp.cpp.json +0 -5
  834. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_csharp.cs.json +0 -5
  835. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_elixir.ex.json +0 -5
  836. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_go.go.json +0 -5
  837. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_haskell.hs.json +0 -5
  838. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_java.java.json +0 -5
  839. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_javascript.js.json +0 -5
  840. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_kotlin.kt.json +0 -5
  841. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_lua.lua.json +0 -5
  842. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_perl.pl.json +0 -5
  843. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_php.php.json +0 -5
  844. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_python.py.json +0 -5
  845. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_ruby.rb.json +0 -5
  846. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_rust.rs.json +0 -5
  847. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_scala.scala.json +0 -5
  848. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_shell.sh.json +0 -5
  849. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_swift.swift.json +0 -5
  850. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_typescript.ts.json +0 -5
  851. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_zig.zig.json +0 -5
  852. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_c.c.json +0 -5
  853. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_cpp.cpp.json +0 -5
  854. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_csharp.cs.json +0 -5
  855. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_elixir.ex.json +0 -5
  856. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_go.go.json +0 -5
  857. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_haskell.hs.json +0 -5
  858. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_java.java.json +0 -5
  859. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_javascript.js.json +0 -5
  860. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_kotlin.kt.json +0 -5
  861. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_lua.lua.json +0 -5
  862. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_perl.pl.json +0 -5
  863. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_php.php.json +0 -5
  864. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_python.py.json +0 -5
  865. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_ruby.rb.json +0 -5
  866. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_rust.rs.json +0 -5
  867. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_scala.scala.json +0 -5
  868. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_shell.sh.json +0 -5
  869. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_swift.swift.json +0 -5
  870. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_typescript.ts.json +0 -5
  871. package/tests/fixtures_attended_results/standalone/files-summarize/fixture_zig.zig.json +0 -5
  872. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_c.c.json +0 -5
  873. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_cpp.cpp.json +0 -5
  874. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_csharp.cs.json +0 -5
  875. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_elixir.ex.json +0 -5
  876. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_go.go.json +0 -5
  877. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_haskell.hs.json +0 -5
  878. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_java.java.json +0 -5
  879. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_javascript.js.json +0 -5
  880. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_kotlin.kt.json +0 -5
  881. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_lua.lua.json +0 -5
  882. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_perl.pl.json +0 -5
  883. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_php.php.json +0 -5
  884. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_python.py.json +0 -5
  885. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_ruby.rb.json +0 -5
  886. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_rust.rs.json +0 -5
  887. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_scala.scala.json +0 -5
  888. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_shell.sh.json +0 -5
  889. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_swift.swift.json +0 -5
  890. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_typescript.ts.json +0 -5
  891. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_zig.zig.json +0 -5
  892. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_c.c.json +0 -5
  893. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_cpp.cpp.json +0 -5
  894. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_csharp.cs.json +0 -5
  895. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_elixir.ex.json +0 -5
  896. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_go.go.json +0 -5
  897. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_haskell.hs.json +0 -5
  898. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_java.java.json +0 -5
  899. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_javascript.js.json +0 -5
  900. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_kotlin.kt.json +0 -5
  901. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_lua.lua.json +0 -5
  902. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_perl.pl.json +0 -5
  903. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_php.php.json +0 -5
  904. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_python.py.json +0 -5
  905. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_ruby.rb.json +0 -5
  906. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_rust.rs.json +0 -5
  907. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_scala.scala.json +0 -5
  908. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_shell.sh.json +0 -5
  909. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_swift.swift.json +0 -5
  910. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_typescript.ts.json +0 -5
  911. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_zig.zig.json +0 -5
  912. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_c.c.json +0 -5
  913. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_cpp.cpp.json +0 -5
  914. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_csharp.cs.json +0 -5
  915. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_elixir.ex.json +0 -5
  916. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_go.go.json +0 -5
  917. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_haskell.hs.json +0 -5
  918. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_java.java.json +0 -5
  919. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_javascript.js.json +0 -5
  920. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_kotlin.kt.json +0 -5
  921. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_lua.lua.json +0 -5
  922. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_perl.pl.json +0 -5
  923. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_php.php.json +0 -5
  924. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_python.py.json +0 -5
  925. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_ruby.rb.json +0 -5
  926. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_rust.rs.json +0 -5
  927. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_scala.scala.json +0 -5
  928. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_shell.sh.json +0 -5
  929. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_swift.swift.json +0 -5
  930. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_typescript.ts.json +0 -5
  931. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_zig.zig.json +0 -5
  932. package/tests/helpers.ts +0 -236
  933. package/tests/oracle-project.test.ts +0 -67
  934. package/tests/oracle-standalone.test.ts +0 -68
  935. package/tests/prompt-command-summary.test.ts +0 -36
  936. package/tests/prompt-rendering.test.ts +0 -103
  937. package/tests/python_oracle_stubs/tiktoken.py +0 -76
  938. package/tests/release-workflow.test.ts +0 -195
  939. package/tests/static-check-bundled.test.ts +0 -332
@@ -1,1542 +0,0 @@
1
- /**
2
- * Extension system types.
3
- *
4
- * Extensions are TypeScript modules that can:
5
- * - Subscribe to agent lifecycle events
6
- * - Register LLM-callable tools
7
- * - Register commands, keyboard shortcuts, and CLI flags
8
- * - Interact with the user via UI primitives
9
- */
10
-
11
- import type {
12
- AgentMessage,
13
- AgentToolResult,
14
- AgentToolUpdateCallback,
15
- ThinkingLevel,
16
- ToolExecutionMode,
17
- } from "@mariozechner/pi-agent-core";
18
- import type {
19
- Api,
20
- AssistantMessageEvent,
21
- AssistantMessageEventStream,
22
- Context,
23
- ImageContent,
24
- Model,
25
- OAuthCredentials,
26
- OAuthLoginCallbacks,
27
- SimpleStreamOptions,
28
- TextContent,
29
- ToolResultMessage,
30
- } from "@mariozechner/pi-ai";
31
- import type {
32
- AutocompleteItem,
33
- AutocompleteProvider,
34
- Component,
35
- EditorComponent,
36
- EditorTheme,
37
- KeyId,
38
- OverlayHandle,
39
- OverlayOptions,
40
- TUI,
41
- } from "@mariozechner/pi-tui";
42
- import type { Static, TSchema } from "typebox";
43
- import type { Theme } from "../../modes/interactive/theme/theme.js";
44
- import type { BashResult } from "../bash-executor.js";
45
- import type { CompactionPreparation, CompactionResult } from "../compaction/index.js";
46
- import type { EventBus } from "../event-bus.js";
47
- import type { ExecOptions, ExecResult } from "../exec.js";
48
- import type { ReadonlyFooterDataProvider } from "../footer-data-provider.js";
49
- import type { KeybindingsManager } from "../keybindings.js";
50
- import type { CustomMessage } from "../messages.js";
51
- import type { ModelRegistry } from "../model-registry.js";
52
- import type {
53
- BranchSummaryEntry,
54
- CompactionEntry,
55
- ReadonlySessionManager,
56
- SessionEntry,
57
- SessionManager,
58
- } from "../session-manager.js";
59
- import type { SlashCommandInfo } from "../slash-commands.js";
60
- import type { SourceInfo } from "../source-info.js";
61
- import type { BuildSystemPromptOptions } from "../system-prompt.js";
62
- import type { BashOperations } from "../tools/bash.js";
63
- import type { EditToolDetails } from "../tools/edit.js";
64
- import type {
65
- BashToolDetails,
66
- BashToolInput,
67
- EditToolInput,
68
- FindToolDetails,
69
- FindToolInput,
70
- GrepToolDetails,
71
- GrepToolInput,
72
- LsToolDetails,
73
- LsToolInput,
74
- ReadToolDetails,
75
- ReadToolInput,
76
- WriteToolInput,
77
- } from "../tools/index.js";
78
-
79
- export type { ExecOptions, ExecResult } from "../exec.js";
80
- export type { BuildSystemPromptOptions } from "../system-prompt.js";
81
- export type { AgentToolResult, AgentToolUpdateCallback, ToolExecutionMode };
82
- export type { AppKeybinding, KeybindingsManager } from "../keybindings.js";
83
-
84
- // ============================================================================
85
- // UI Context
86
- // ============================================================================
87
-
88
- /** Options for extension UI dialogs. */
89
- export interface ExtensionUIDialogOptions {
90
- /** AbortSignal to programmatically dismiss the dialog. */
91
- signal?: AbortSignal;
92
- /** Timeout in milliseconds. Dialog auto-dismisses with live countdown display. */
93
- timeout?: number;
94
- }
95
-
96
- /** Placement for extension widgets. */
97
- export type WidgetPlacement = "aboveEditor" | "belowEditor";
98
-
99
- /** Options for extension widgets. */
100
- export interface ExtensionWidgetOptions {
101
- /** Where the widget is rendered. Defaults to "aboveEditor". */
102
- placement?: WidgetPlacement;
103
- }
104
-
105
- /** Raw terminal input listener for extensions. */
106
- export type TerminalInputHandler = (data: string) => { consume?: boolean; data?: string } | undefined;
107
-
108
- /** Working indicator configuration for the interactive streaming loader. */
109
- export interface WorkingIndicatorOptions {
110
- /** Animation frames. Use an empty array to hide the indicator entirely. Custom frames are rendered verbatim. */
111
- frames?: string[];
112
- /** Frame interval in milliseconds for animated indicators. */
113
- intervalMs?: number;
114
- }
115
-
116
- /** Wrap the current autocomplete provider with additional behavior. */
117
- export type AutocompleteProviderFactory = (current: AutocompleteProvider) => AutocompleteProvider;
118
-
119
- /**
120
- * UI context for extensions to request interactive UI.
121
- * Each mode (interactive, RPC, print) provides its own implementation.
122
- */
123
- export interface ExtensionUIContext {
124
- /** Show a selector and return the user's choice. */
125
- select(title: string, options: string[], opts?: ExtensionUIDialogOptions): Promise<string | undefined>;
126
-
127
- /** Show a confirmation dialog. */
128
- confirm(title: string, message: string, opts?: ExtensionUIDialogOptions): Promise<boolean>;
129
-
130
- /** Show a text input dialog. */
131
- input(title: string, placeholder?: string, opts?: ExtensionUIDialogOptions): Promise<string | undefined>;
132
-
133
- /** Show a notification to the user. */
134
- notify(message: string, type?: "info" | "warning" | "error"): void;
135
-
136
- /** Listen to raw terminal input (interactive mode only). Returns an unsubscribe function. */
137
- onTerminalInput(handler: TerminalInputHandler): () => void;
138
-
139
- /** Set status text in the footer/status bar. Pass undefined to clear. */
140
- setStatus(key: string, text: string | undefined): void;
141
-
142
- /** Set the working/loading message shown during streaming. Call with no argument to restore default. */
143
- setWorkingMessage(message?: string): void;
144
-
145
- /**
146
- * Configure the interactive working indicator shown during streaming.
147
- *
148
- * - Omit the argument to restore the default animated spinner.
149
- * - Use `frames: ["●"]` for a static indicator.
150
- * - Use `frames: []` to hide the indicator entirely.
151
- * - Custom frames are rendered as provided, so extensions must add their own colors.
152
- */
153
- setWorkingIndicator(options?: WorkingIndicatorOptions): void;
154
-
155
- /** Set the label shown for hidden thinking blocks. Call with no argument to restore default. */
156
- setHiddenThinkingLabel(label?: string): void;
157
-
158
- /** Set a widget to display above or below the editor. Accepts string array or component factory. */
159
- setWidget(key: string, content: string[] | undefined, options?: ExtensionWidgetOptions): void;
160
- setWidget(
161
- key: string,
162
- content: ((tui: TUI, theme: Theme) => Component & { dispose?(): void }) | undefined,
163
- options?: ExtensionWidgetOptions,
164
- ): void;
165
-
166
- /** Set a custom footer component, or undefined to restore the built-in footer.
167
- *
168
- * The factory receives a FooterDataProvider for data not otherwise accessible:
169
- * git branch and extension statuses from setStatus(). Token stats, model info,
170
- * etc. are available via ctx.sessionManager and ctx.model.
171
- */
172
- setFooter(
173
- factory:
174
- | ((tui: TUI, theme: Theme, footerData: ReadonlyFooterDataProvider) => Component & { dispose?(): void })
175
- | undefined,
176
- ): void;
177
-
178
- /** Set a custom header component (shown at startup, above chat), or undefined to restore the built-in header. */
179
- setHeader(factory: ((tui: TUI, theme: Theme) => Component & { dispose?(): void }) | undefined): void;
180
-
181
- /** Set the terminal window/tab title. */
182
- setTitle(title: string): void;
183
-
184
- /** Show a custom component with keyboard focus. */
185
- custom<T>(
186
- factory: (
187
- tui: TUI,
188
- theme: Theme,
189
- keybindings: KeybindingsManager,
190
- done: (result: T) => void,
191
- ) => (Component & { dispose?(): void }) | Promise<Component & { dispose?(): void }>,
192
- options?: {
193
- overlay?: boolean;
194
- /** Overlay positioning/sizing options. Can be static or a function for dynamic updates. */
195
- overlayOptions?: OverlayOptions | (() => OverlayOptions);
196
- /** Called with the overlay handle after the overlay is shown. Use to control visibility. */
197
- onHandle?: (handle: OverlayHandle) => void;
198
- },
199
- ): Promise<T>;
200
-
201
- /** Paste text into the editor, triggering paste handling (collapse for large content). */
202
- pasteToEditor(text: string): void;
203
-
204
- /** Set the text in the core input editor. */
205
- setEditorText(text: string): void;
206
-
207
- /** Get the current text from the core input editor. */
208
- getEditorText(): string;
209
-
210
- /** Show a multi-line editor for text editing. */
211
- editor(title: string, prefill?: string): Promise<string | undefined>;
212
-
213
- /** Stack additional autocomplete behavior on top of the built-in provider. */
214
- addAutocompleteProvider(factory: AutocompleteProviderFactory): void;
215
-
216
- /**
217
- * Set a custom editor component via factory function.
218
- * Pass undefined to restore the default editor.
219
- *
220
- * The factory receives:
221
- * - `theme`: EditorTheme for styling borders and autocomplete
222
- * - `keybindings`: KeybindingsManager for app-level keybindings
223
- *
224
- * For full app keybinding support (escape, ctrl+d, model switching, etc.),
225
- * extend `CustomEditor` from `@mariozechner/pi-coding-agent` and call
226
- * `super.handleInput(data)` for keys you don't handle.
227
- *
228
- * @example
229
- * ```ts
230
- * import { CustomEditor } from "@mariozechner/pi-coding-agent";
231
- *
232
- * class VimEditor extends CustomEditor {
233
- * private mode: "normal" | "insert" = "insert";
234
- *
235
- * handleInput(data: string): void {
236
- * if (this.mode === "normal") {
237
- * // Handle vim normal mode keys...
238
- * if (data === "i") { this.mode = "insert"; return; }
239
- * }
240
- * super.handleInput(data); // App keybindings + text editing
241
- * }
242
- * }
243
- *
244
- * ctx.ui.setEditorComponent((tui, theme, keybindings) =>
245
- * new VimEditor(tui, theme, keybindings)
246
- * );
247
- * ```
248
- */
249
- setEditorComponent(
250
- factory: ((tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager) => EditorComponent) | undefined,
251
- ): void;
252
-
253
- /** Get the current theme for styling. */
254
- readonly theme: Theme;
255
-
256
- /** Get all available themes with their names and file paths. */
257
- getAllThemes(): { name: string; path: string | undefined }[];
258
-
259
- /** Load a theme by name without switching to it. Returns undefined if not found. */
260
- getTheme(name: string): Theme | undefined;
261
-
262
- /** Set the current theme by name or Theme object. */
263
- setTheme(theme: string | Theme): { success: boolean; error?: string };
264
-
265
- /** Get current tool output expansion state. */
266
- getToolsExpanded(): boolean;
267
-
268
- /** Set tool output expansion state. */
269
- setToolsExpanded(expanded: boolean): void;
270
- }
271
-
272
- // ============================================================================
273
- // Extension Context
274
- // ============================================================================
275
-
276
- export interface ContextUsage {
277
- /** Estimated context tokens, or null if unknown (e.g. right after compaction, before next LLM response). */
278
- tokens: number | null;
279
- contextWindow: number;
280
- /** Context usage as percentage of context window, or null if tokens is unknown. */
281
- percent: number | null;
282
- }
283
-
284
- export interface CompactOptions {
285
- customInstructions?: string;
286
- onComplete?: (result: CompactionResult) => void;
287
- onError?: (error: Error) => void;
288
- }
289
-
290
- /**
291
- * Context passed to extension event handlers.
292
- */
293
- export interface ExtensionContext {
294
- /** UI methods for user interaction */
295
- ui: ExtensionUIContext;
296
- /** Whether UI is available (false in print/RPC mode) */
297
- hasUI: boolean;
298
- /** Current working directory */
299
- cwd: string;
300
- /** Session manager (read-only) */
301
- sessionManager: ReadonlySessionManager;
302
- /** Model registry for API key resolution */
303
- modelRegistry: ModelRegistry;
304
- /** Current model (may be undefined) */
305
- model: Model<any> | undefined;
306
- /** Whether the agent is idle (not streaming) */
307
- isIdle(): boolean;
308
- /** The current abort signal, or undefined when the agent is not streaming. */
309
- signal: AbortSignal | undefined;
310
- /** Abort the current agent operation */
311
- abort(): void;
312
- /** Whether there are queued messages waiting */
313
- hasPendingMessages(): boolean;
314
- /** Gracefully shutdown pi and exit. Available in all contexts. */
315
- shutdown(): void;
316
- /** Get current context usage for the active model. */
317
- getContextUsage(): ContextUsage | undefined;
318
- /** Trigger compaction without awaiting completion. */
319
- compact(options?: CompactOptions): void;
320
- /** Get the current effective system prompt. */
321
- getSystemPrompt(): string;
322
- }
323
-
324
- /**
325
- * Extended context for command handlers.
326
- * Includes session control methods only safe in user-initiated commands.
327
- */
328
- export interface ExtensionCommandContext extends ExtensionContext {
329
- /** Wait for the agent to finish streaming */
330
- waitForIdle(): Promise<void>;
331
-
332
- /** Start a new session, optionally with initialization. */
333
- newSession(options?: {
334
- parentSession?: string;
335
- setup?: (sessionManager: SessionManager) => Promise<void>;
336
- withSession?: (ctx: ReplacedSessionContext) => Promise<void>;
337
- }): Promise<{ cancelled: boolean }>;
338
-
339
- /** Fork from a specific entry, creating a new session file. */
340
- fork(
341
- entryId: string,
342
- options?: { position?: "before" | "at"; withSession?: (ctx: ReplacedSessionContext) => Promise<void> },
343
- ): Promise<{ cancelled: boolean }>;
344
-
345
- /** Navigate to a different point in the session tree. */
346
- navigateTree(
347
- targetId: string,
348
- options?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string },
349
- ): Promise<{ cancelled: boolean }>;
350
-
351
- /** Switch to a different session file. */
352
- switchSession(
353
- sessionPath: string,
354
- options?: { withSession?: (ctx: ReplacedSessionContext) => Promise<void> },
355
- ): Promise<{ cancelled: boolean }>;
356
-
357
- /** Reload extensions, skills, prompts, and themes. */
358
- reload(): Promise<void>;
359
- }
360
-
361
- /**
362
- * Fresh command-capable context bound to the replacement session after a session switch.
363
- *
364
- * This is passed to `withSession()` callbacks on `newSession()`, `fork()`, and `switchSession()`.
365
- */
366
- export interface ReplacedSessionContext extends ExtensionCommandContext {
367
- sendMessage<T = unknown>(
368
- message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details">,
369
- options?: { triggerTurn?: boolean; deliverAs?: "steer" | "followUp" | "nextTurn" },
370
- ): Promise<void>;
371
-
372
- sendUserMessage(
373
- content: string | (TextContent | ImageContent)[],
374
- options?: { deliverAs?: "steer" | "followUp" },
375
- ): Promise<void>;
376
- }
377
-
378
- // ============================================================================
379
- // Tool Types
380
- // ============================================================================
381
-
382
- /** Rendering options for tool results */
383
- export interface ToolRenderResultOptions {
384
- /** Whether the result view is expanded */
385
- expanded: boolean;
386
- /** Whether this is a partial/streaming result */
387
- isPartial: boolean;
388
- }
389
-
390
- /** Context passed to tool renderers. */
391
- export interface ToolRenderContext<TState = any, TArgs = any> {
392
- /** Current tool call arguments. Shared across call/result renders for the same tool call. */
393
- args: TArgs;
394
- /** Unique id for this tool execution. Stable across call/result renders for the same tool call. */
395
- toolCallId: string;
396
- /** Invalidate just this tool execution component for redraw. */
397
- invalidate: () => void;
398
- /** Previously returned component for this render slot, if any. */
399
- lastComponent: Component | undefined;
400
- /** Shared renderer state for this tool row. Initialized by tool-execution.ts. */
401
- state: TState;
402
- /** Working directory for this tool execution. */
403
- cwd: string;
404
- /** Whether the tool execution has started. */
405
- executionStarted: boolean;
406
- /** Whether the tool call arguments are complete. */
407
- argsComplete: boolean;
408
- /** Whether the tool result is partial/streaming. */
409
- isPartial: boolean;
410
- /** Whether the result view is expanded. */
411
- expanded: boolean;
412
- /** Whether inline images are currently shown in the TUI. */
413
- showImages: boolean;
414
- /** Whether the current result is an error. */
415
- isError: boolean;
416
- }
417
-
418
- /**
419
- * Tool definition for registerTool().
420
- */
421
- export interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = unknown, TState = any> {
422
- /** Tool name (used in LLM tool calls) */
423
- name: string;
424
- /** Human-readable label for UI */
425
- label: string;
426
- /** Description for LLM */
427
- description: string;
428
- /** Optional one-line snippet for the Available tools section in the default system prompt. Custom tools are omitted from that section when this is not provided. */
429
- promptSnippet?: string;
430
- /** Optional guideline bullets appended to the default system prompt Guidelines section when this tool is active. */
431
- promptGuidelines?: string[];
432
- /** Parameter schema (TypeBox) */
433
- parameters: TParams;
434
- /** Controls whether ToolExecutionComponent renders the standard colored shell or the tool renders its own framing. */
435
- renderShell?: "default" | "self";
436
-
437
- /** Optional compatibility shim to prepare raw tool call arguments before schema validation. Must return an object conforming to TParams. */
438
- prepareArguments?: (args: unknown) => Static<TParams>;
439
-
440
- /**
441
- * Per-tool execution mode override.
442
- * - "sequential": this tool must execute one at a time with other tool calls.
443
- * - "parallel": this tool can execute concurrently with other tool calls.
444
- *
445
- * If omitted, the default execution mode applies.
446
- */
447
- executionMode?: ToolExecutionMode;
448
-
449
- /** Execute the tool. */
450
- execute(
451
- toolCallId: string,
452
- params: Static<TParams>,
453
- signal: AbortSignal | undefined,
454
- onUpdate: AgentToolUpdateCallback<TDetails> | undefined,
455
- ctx: ExtensionContext,
456
- ): Promise<AgentToolResult<TDetails>>;
457
-
458
- /** Custom rendering for tool call display */
459
- renderCall?: (args: Static<TParams>, theme: Theme, context: ToolRenderContext<TState, Static<TParams>>) => Component;
460
-
461
- /** Custom rendering for tool result display */
462
- renderResult?: (
463
- result: AgentToolResult<TDetails>,
464
- options: ToolRenderResultOptions,
465
- theme: Theme,
466
- context: ToolRenderContext<TState, Static<TParams>>,
467
- ) => Component;
468
- }
469
-
470
- type AnyToolDefinition = ToolDefinition<any, any, any>;
471
-
472
- /**
473
- * Preserve parameter inference for standalone tool definitions.
474
- *
475
- * Use this when assigning a tool to a variable or passing it through arrays such
476
- * as `customTools`, where contextual typing would otherwise widen params to
477
- * `unknown`.
478
- */
479
- export function defineTool<TParams extends TSchema, TDetails = unknown, TState = any>(
480
- tool: ToolDefinition<TParams, TDetails, TState>,
481
- ): ToolDefinition<TParams, TDetails, TState> & AnyToolDefinition {
482
- return tool as ToolDefinition<TParams, TDetails, TState> & AnyToolDefinition;
483
- }
484
-
485
- // ============================================================================
486
- // Resource Events
487
- // ============================================================================
488
-
489
- /** Fired after session_start to allow extensions to provide additional resource paths. */
490
- export interface ResourcesDiscoverEvent {
491
- type: "resources_discover";
492
- cwd: string;
493
- reason: "startup" | "reload";
494
- }
495
-
496
- /** Result from resources_discover event handler */
497
- export interface ResourcesDiscoverResult {
498
- skillPaths?: string[];
499
- promptPaths?: string[];
500
- themePaths?: string[];
501
- }
502
-
503
- // ============================================================================
504
- // Session Events
505
- // ============================================================================
506
-
507
- /** Fired when a session is started, loaded, or reloaded */
508
- export interface SessionStartEvent {
509
- type: "session_start";
510
- /** Why this session start happened. */
511
- reason: "startup" | "reload" | "new" | "resume" | "fork";
512
- /** Previously active session file. Present for "new", "resume", and "fork". */
513
- previousSessionFile?: string;
514
- }
515
-
516
- /** Fired before switching to another session (can be cancelled) */
517
- export interface SessionBeforeSwitchEvent {
518
- type: "session_before_switch";
519
- reason: "new" | "resume";
520
- targetSessionFile?: string;
521
- }
522
-
523
- /** Fired before forking a session (can be cancelled) */
524
- export interface SessionBeforeForkEvent {
525
- type: "session_before_fork";
526
- entryId: string;
527
- position: "before" | "at";
528
- }
529
-
530
- /** Fired before context compaction (can be cancelled or customized) */
531
- export interface SessionBeforeCompactEvent {
532
- type: "session_before_compact";
533
- preparation: CompactionPreparation;
534
- branchEntries: SessionEntry[];
535
- customInstructions?: string;
536
- signal: AbortSignal;
537
- }
538
-
539
- /** Fired after context compaction */
540
- export interface SessionCompactEvent {
541
- type: "session_compact";
542
- compactionEntry: CompactionEntry;
543
- fromExtension: boolean;
544
- }
545
-
546
- /** Fired before an extension runtime is torn down due to quit, reload, or session replacement. */
547
- export interface SessionShutdownEvent {
548
- type: "session_shutdown";
549
- reason: "quit" | "reload" | "new" | "resume" | "fork";
550
- /** Destination session file when shutting down due to session replacement. */
551
- targetSessionFile?: string;
552
- }
553
-
554
- /** Preparation data for tree navigation */
555
- export interface TreePreparation {
556
- targetId: string;
557
- oldLeafId: string | null;
558
- commonAncestorId: string | null;
559
- entriesToSummarize: SessionEntry[];
560
- userWantsSummary: boolean;
561
- /** Custom instructions for summarization */
562
- customInstructions?: string;
563
- /** If true, customInstructions replaces the default prompt instead of being appended */
564
- replaceInstructions?: boolean;
565
- /** Label to attach to the branch summary entry */
566
- label?: string;
567
- }
568
-
569
- /** Fired before navigating in the session tree (can be cancelled) */
570
- export interface SessionBeforeTreeEvent {
571
- type: "session_before_tree";
572
- preparation: TreePreparation;
573
- signal: AbortSignal;
574
- }
575
-
576
- /** Fired after navigating in the session tree */
577
- export interface SessionTreeEvent {
578
- type: "session_tree";
579
- newLeafId: string | null;
580
- oldLeafId: string | null;
581
- summaryEntry?: BranchSummaryEntry;
582
- fromExtension?: boolean;
583
- }
584
-
585
- export type SessionEvent =
586
- | SessionStartEvent
587
- | SessionBeforeSwitchEvent
588
- | SessionBeforeForkEvent
589
- | SessionBeforeCompactEvent
590
- | SessionCompactEvent
591
- | SessionShutdownEvent
592
- | SessionBeforeTreeEvent
593
- | SessionTreeEvent;
594
-
595
- // ============================================================================
596
- // Agent Events
597
- // ============================================================================
598
-
599
- /** Fired before each LLM call. Can modify messages. */
600
- export interface ContextEvent {
601
- type: "context";
602
- messages: AgentMessage[];
603
- }
604
-
605
- /** Fired before a provider request is sent. Can replace the payload. */
606
- export interface BeforeProviderRequestEvent {
607
- type: "before_provider_request";
608
- payload: unknown;
609
- }
610
-
611
- /** Fired after a provider response is received and before the response stream is consumed. */
612
- export interface AfterProviderResponseEvent {
613
- type: "after_provider_response";
614
- status: number;
615
- headers: Record<string, string>;
616
- }
617
-
618
- /** Fired after user submits prompt but before agent loop. */
619
- export interface BeforeAgentStartEvent {
620
- type: "before_agent_start";
621
- /** The raw user prompt text (after expansion). */
622
- prompt: string;
623
- /** Images attached to the user prompt, if any. */
624
- images?: ImageContent[];
625
- /** The fully assembled system prompt string. */
626
- systemPrompt: string;
627
- /** Structured options used to build the system prompt. Extensions can inspect this to understand what Pi loaded without re-discovering resources. */
628
- systemPromptOptions: BuildSystemPromptOptions;
629
- }
630
-
631
- /** Fired when an agent loop starts */
632
- export interface AgentStartEvent {
633
- type: "agent_start";
634
- }
635
-
636
- /** Fired when an agent loop ends */
637
- export interface AgentEndEvent {
638
- type: "agent_end";
639
- messages: AgentMessage[];
640
- }
641
-
642
- /** Fired at the start of each turn */
643
- export interface TurnStartEvent {
644
- type: "turn_start";
645
- turnIndex: number;
646
- timestamp: number;
647
- }
648
-
649
- /** Fired at the end of each turn */
650
- export interface TurnEndEvent {
651
- type: "turn_end";
652
- turnIndex: number;
653
- message: AgentMessage;
654
- toolResults: ToolResultMessage[];
655
- }
656
-
657
- /** Fired when a message starts (user, assistant, or toolResult) */
658
- export interface MessageStartEvent {
659
- type: "message_start";
660
- message: AgentMessage;
661
- }
662
-
663
- /** Fired during assistant message streaming with token-by-token updates */
664
- export interface MessageUpdateEvent {
665
- type: "message_update";
666
- message: AgentMessage;
667
- assistantMessageEvent: AssistantMessageEvent;
668
- }
669
-
670
- /** Fired when a message ends */
671
- export interface MessageEndEvent {
672
- type: "message_end";
673
- message: AgentMessage;
674
- }
675
-
676
- /** Fired when a tool starts executing */
677
- export interface ToolExecutionStartEvent {
678
- type: "tool_execution_start";
679
- toolCallId: string;
680
- toolName: string;
681
- args: any;
682
- }
683
-
684
- /** Fired during tool execution with partial/streaming output */
685
- export interface ToolExecutionUpdateEvent {
686
- type: "tool_execution_update";
687
- toolCallId: string;
688
- toolName: string;
689
- args: any;
690
- partialResult: any;
691
- }
692
-
693
- /** Fired when a tool finishes executing */
694
- export interface ToolExecutionEndEvent {
695
- type: "tool_execution_end";
696
- toolCallId: string;
697
- toolName: string;
698
- result: any;
699
- isError: boolean;
700
- }
701
-
702
- // ============================================================================
703
- // Model Events
704
- // ============================================================================
705
-
706
- export type ModelSelectSource = "set" | "cycle" | "restore";
707
-
708
- /** Fired when a new model is selected */
709
- export interface ModelSelectEvent {
710
- type: "model_select";
711
- model: Model<any>;
712
- previousModel: Model<any> | undefined;
713
- source: ModelSelectSource;
714
- }
715
-
716
- // ============================================================================
717
- // User Bash Events
718
- // ============================================================================
719
-
720
- /** Fired when user executes a bash command via ! or !! prefix */
721
- export interface UserBashEvent {
722
- type: "user_bash";
723
- /** The command to execute */
724
- command: string;
725
- /** True if !! prefix was used (excluded from LLM context) */
726
- excludeFromContext: boolean;
727
- /** Current working directory */
728
- cwd: string;
729
- }
730
-
731
- // ============================================================================
732
- // Input Events
733
- // ============================================================================
734
-
735
- /** Source of user input */
736
- export type InputSource = "interactive" | "rpc" | "extension";
737
-
738
- /** Fired when user input is received, before agent processing */
739
- export interface InputEvent {
740
- type: "input";
741
- /** The input text */
742
- text: string;
743
- /** Attached images, if any */
744
- images?: ImageContent[];
745
- /** Where the input came from */
746
- source: InputSource;
747
- }
748
-
749
- /** Result from input event handler */
750
- export type InputEventResult =
751
- | { action: "continue" }
752
- | { action: "transform"; text: string; images?: ImageContent[] }
753
- | { action: "handled" };
754
-
755
- // ============================================================================
756
- // Tool Events
757
- // ============================================================================
758
-
759
- interface ToolCallEventBase {
760
- type: "tool_call";
761
- toolCallId: string;
762
- }
763
-
764
- export interface BashToolCallEvent extends ToolCallEventBase {
765
- toolName: "bash";
766
- input: BashToolInput;
767
- }
768
-
769
- export interface ReadToolCallEvent extends ToolCallEventBase {
770
- toolName: "read";
771
- input: ReadToolInput;
772
- }
773
-
774
- export interface EditToolCallEvent extends ToolCallEventBase {
775
- toolName: "edit";
776
- input: EditToolInput;
777
- }
778
-
779
- export interface WriteToolCallEvent extends ToolCallEventBase {
780
- toolName: "write";
781
- input: WriteToolInput;
782
- }
783
-
784
- export interface GrepToolCallEvent extends ToolCallEventBase {
785
- toolName: "grep";
786
- input: GrepToolInput;
787
- }
788
-
789
- export interface FindToolCallEvent extends ToolCallEventBase {
790
- toolName: "find";
791
- input: FindToolInput;
792
- }
793
-
794
- export interface LsToolCallEvent extends ToolCallEventBase {
795
- toolName: "ls";
796
- input: LsToolInput;
797
- }
798
-
799
- export interface CustomToolCallEvent extends ToolCallEventBase {
800
- toolName: string;
801
- input: Record<string, unknown>;
802
- }
803
-
804
- /**
805
- * Fired before a tool executes. Can block.
806
- *
807
- * `event.input` is mutable. Mutate it in place to patch tool arguments before execution.
808
- * Later `tool_call` handlers see earlier mutations. No re-validation is performed after mutation.
809
- */
810
- export type ToolCallEvent =
811
- | BashToolCallEvent
812
- | ReadToolCallEvent
813
- | EditToolCallEvent
814
- | WriteToolCallEvent
815
- | GrepToolCallEvent
816
- | FindToolCallEvent
817
- | LsToolCallEvent
818
- | CustomToolCallEvent;
819
-
820
- interface ToolResultEventBase {
821
- type: "tool_result";
822
- toolCallId: string;
823
- input: Record<string, unknown>;
824
- content: (TextContent | ImageContent)[];
825
- isError: boolean;
826
- }
827
-
828
- export interface BashToolResultEvent extends ToolResultEventBase {
829
- toolName: "bash";
830
- details: BashToolDetails | undefined;
831
- }
832
-
833
- export interface ReadToolResultEvent extends ToolResultEventBase {
834
- toolName: "read";
835
- details: ReadToolDetails | undefined;
836
- }
837
-
838
- export interface EditToolResultEvent extends ToolResultEventBase {
839
- toolName: "edit";
840
- details: EditToolDetails | undefined;
841
- }
842
-
843
- export interface WriteToolResultEvent extends ToolResultEventBase {
844
- toolName: "write";
845
- details: undefined;
846
- }
847
-
848
- export interface GrepToolResultEvent extends ToolResultEventBase {
849
- toolName: "grep";
850
- details: GrepToolDetails | undefined;
851
- }
852
-
853
- export interface FindToolResultEvent extends ToolResultEventBase {
854
- toolName: "find";
855
- details: FindToolDetails | undefined;
856
- }
857
-
858
- export interface LsToolResultEvent extends ToolResultEventBase {
859
- toolName: "ls";
860
- details: LsToolDetails | undefined;
861
- }
862
-
863
- export interface CustomToolResultEvent extends ToolResultEventBase {
864
- toolName: string;
865
- details: unknown;
866
- }
867
-
868
- /** Fired after a tool executes. Can modify result. */
869
- export type ToolResultEvent =
870
- | BashToolResultEvent
871
- | ReadToolResultEvent
872
- | EditToolResultEvent
873
- | WriteToolResultEvent
874
- | GrepToolResultEvent
875
- | FindToolResultEvent
876
- | LsToolResultEvent
877
- | CustomToolResultEvent;
878
-
879
- // Type guards for ToolResultEvent
880
- export function isBashToolResult(e: ToolResultEvent): e is BashToolResultEvent {
881
- return e.toolName === "bash";
882
- }
883
- export function isReadToolResult(e: ToolResultEvent): e is ReadToolResultEvent {
884
- return e.toolName === "read";
885
- }
886
- export function isEditToolResult(e: ToolResultEvent): e is EditToolResultEvent {
887
- return e.toolName === "edit";
888
- }
889
- export function isWriteToolResult(e: ToolResultEvent): e is WriteToolResultEvent {
890
- return e.toolName === "write";
891
- }
892
- export function isGrepToolResult(e: ToolResultEvent): e is GrepToolResultEvent {
893
- return e.toolName === "grep";
894
- }
895
- export function isFindToolResult(e: ToolResultEvent): e is FindToolResultEvent {
896
- return e.toolName === "find";
897
- }
898
- export function isLsToolResult(e: ToolResultEvent): e is LsToolResultEvent {
899
- return e.toolName === "ls";
900
- }
901
-
902
- /**
903
- * Type guard for narrowing ToolCallEvent by tool name.
904
- *
905
- * Built-in tools narrow automatically (no type params needed):
906
- * ```ts
907
- * if (isToolCallEventType("bash", event)) {
908
- * event.input.command; // string
909
- * }
910
- * ```
911
- *
912
- * Custom tools require explicit type parameters:
913
- * ```ts
914
- * if (isToolCallEventType<"my_tool", MyToolInput>("my_tool", event)) {
915
- * event.input.action; // typed
916
- * }
917
- * ```
918
- *
919
- * Note: Direct narrowing via `event.toolName === "bash"` doesn't work because
920
- * CustomToolCallEvent.toolName is `string` which overlaps with all literals.
921
- */
922
- export function isToolCallEventType(toolName: "bash", event: ToolCallEvent): event is BashToolCallEvent;
923
- export function isToolCallEventType(toolName: "read", event: ToolCallEvent): event is ReadToolCallEvent;
924
- export function isToolCallEventType(toolName: "edit", event: ToolCallEvent): event is EditToolCallEvent;
925
- export function isToolCallEventType(toolName: "write", event: ToolCallEvent): event is WriteToolCallEvent;
926
- export function isToolCallEventType(toolName: "grep", event: ToolCallEvent): event is GrepToolCallEvent;
927
- export function isToolCallEventType(toolName: "find", event: ToolCallEvent): event is FindToolCallEvent;
928
- export function isToolCallEventType(toolName: "ls", event: ToolCallEvent): event is LsToolCallEvent;
929
- export function isToolCallEventType<TName extends string, TInput extends Record<string, unknown>>(
930
- toolName: TName,
931
- event: ToolCallEvent,
932
- ): event is ToolCallEvent & { toolName: TName; input: TInput };
933
- export function isToolCallEventType(toolName: string, event: ToolCallEvent): boolean {
934
- return event.toolName === toolName;
935
- }
936
-
937
- /** Union of all event types */
938
- export type ExtensionEvent =
939
- | ResourcesDiscoverEvent
940
- | SessionEvent
941
- | ContextEvent
942
- | BeforeProviderRequestEvent
943
- | AfterProviderResponseEvent
944
- | BeforeAgentStartEvent
945
- | AgentStartEvent
946
- | AgentEndEvent
947
- | TurnStartEvent
948
- | TurnEndEvent
949
- | MessageStartEvent
950
- | MessageUpdateEvent
951
- | MessageEndEvent
952
- | ToolExecutionStartEvent
953
- | ToolExecutionUpdateEvent
954
- | ToolExecutionEndEvent
955
- | ModelSelectEvent
956
- | UserBashEvent
957
- | InputEvent
958
- | ToolCallEvent
959
- | ToolResultEvent;
960
-
961
- // ============================================================================
962
- // Event Results
963
- // ============================================================================
964
-
965
- export interface ContextEventResult {
966
- messages?: AgentMessage[];
967
- }
968
-
969
- export type BeforeProviderRequestEventResult = unknown;
970
-
971
- export interface ToolCallEventResult {
972
- /** Block tool execution. To modify arguments, mutate `event.input` in place instead. */
973
- block?: boolean;
974
- reason?: string;
975
- }
976
-
977
- /** Result from user_bash event handler */
978
- export interface UserBashEventResult {
979
- /** Custom operations to use for execution */
980
- operations?: BashOperations;
981
- /** Full replacement: extension handled execution, use this result */
982
- result?: BashResult;
983
- }
984
-
985
- export interface ToolResultEventResult {
986
- content?: (TextContent | ImageContent)[];
987
- details?: unknown;
988
- isError?: boolean;
989
- }
990
-
991
- export interface BeforeAgentStartEventResult {
992
- message?: Pick<CustomMessage, "customType" | "content" | "display" | "details">;
993
- /** Replace the system prompt for this turn. If multiple extensions return this, they are chained. */
994
- systemPrompt?: string;
995
- }
996
-
997
- export interface SessionBeforeSwitchResult {
998
- cancel?: boolean;
999
- }
1000
-
1001
- export interface SessionBeforeForkResult {
1002
- cancel?: boolean;
1003
- skipConversationRestore?: boolean;
1004
- }
1005
-
1006
- export interface SessionBeforeCompactResult {
1007
- cancel?: boolean;
1008
- compaction?: CompactionResult;
1009
- }
1010
-
1011
- export interface SessionBeforeTreeResult {
1012
- cancel?: boolean;
1013
- summary?: {
1014
- summary: string;
1015
- details?: unknown;
1016
- };
1017
- /** Override custom instructions for summarization */
1018
- customInstructions?: string;
1019
- /** Override whether customInstructions replaces the default prompt */
1020
- replaceInstructions?: boolean;
1021
- /** Override label to attach to the branch summary entry */
1022
- label?: string;
1023
- }
1024
-
1025
- // ============================================================================
1026
- // Message Rendering
1027
- // ============================================================================
1028
-
1029
- export interface MessageRenderOptions {
1030
- expanded: boolean;
1031
- }
1032
-
1033
- export type MessageRenderer<T = unknown> = (
1034
- message: CustomMessage<T>,
1035
- options: MessageRenderOptions,
1036
- theme: Theme,
1037
- ) => Component | undefined;
1038
-
1039
- // ============================================================================
1040
- // Command Registration
1041
- // ============================================================================
1042
-
1043
- export interface RegisteredCommand {
1044
- name: string;
1045
- sourceInfo: SourceInfo;
1046
- description?: string;
1047
- getArgumentCompletions?: (argumentPrefix: string) => AutocompleteItem[] | null | Promise<AutocompleteItem[] | null>;
1048
- handler: (args: string, ctx: ExtensionCommandContext) => Promise<void>;
1049
- }
1050
-
1051
- export interface ResolvedCommand extends RegisteredCommand {
1052
- invocationName: string;
1053
- }
1054
-
1055
- // ============================================================================
1056
- // Extension API
1057
- // ============================================================================
1058
-
1059
- /** Handler function type for events */
1060
- // biome-ignore lint/suspicious/noConfusingVoidType: void allows bare return statements
1061
- export type ExtensionHandler<E, R = undefined> = (event: E, ctx: ExtensionContext) => Promise<R | void> | R | void;
1062
-
1063
- /**
1064
- * ExtensionAPI passed to extension factory functions.
1065
- */
1066
- export interface ExtensionAPI {
1067
- // =========================================================================
1068
- // Event Subscription
1069
- // =========================================================================
1070
-
1071
- on(event: "resources_discover", handler: ExtensionHandler<ResourcesDiscoverEvent, ResourcesDiscoverResult>): void;
1072
- on(event: "session_start", handler: ExtensionHandler<SessionStartEvent>): void;
1073
- on(
1074
- event: "session_before_switch",
1075
- handler: ExtensionHandler<SessionBeforeSwitchEvent, SessionBeforeSwitchResult>,
1076
- ): void;
1077
- on(event: "session_before_fork", handler: ExtensionHandler<SessionBeforeForkEvent, SessionBeforeForkResult>): void;
1078
- on(
1079
- event: "session_before_compact",
1080
- handler: ExtensionHandler<SessionBeforeCompactEvent, SessionBeforeCompactResult>,
1081
- ): void;
1082
- on(event: "session_compact", handler: ExtensionHandler<SessionCompactEvent>): void;
1083
- on(event: "session_shutdown", handler: ExtensionHandler<SessionShutdownEvent>): void;
1084
- on(event: "session_before_tree", handler: ExtensionHandler<SessionBeforeTreeEvent, SessionBeforeTreeResult>): void;
1085
- on(event: "session_tree", handler: ExtensionHandler<SessionTreeEvent>): void;
1086
- on(event: "context", handler: ExtensionHandler<ContextEvent, ContextEventResult>): void;
1087
- on(
1088
- event: "before_provider_request",
1089
- handler: ExtensionHandler<BeforeProviderRequestEvent, BeforeProviderRequestEventResult>,
1090
- ): void;
1091
- on(event: "after_provider_response", handler: ExtensionHandler<AfterProviderResponseEvent>): void;
1092
- on(event: "before_agent_start", handler: ExtensionHandler<BeforeAgentStartEvent, BeforeAgentStartEventResult>): void;
1093
- on(event: "agent_start", handler: ExtensionHandler<AgentStartEvent>): void;
1094
- on(event: "agent_end", handler: ExtensionHandler<AgentEndEvent>): void;
1095
- on(event: "turn_start", handler: ExtensionHandler<TurnStartEvent>): void;
1096
- on(event: "turn_end", handler: ExtensionHandler<TurnEndEvent>): void;
1097
- on(event: "message_start", handler: ExtensionHandler<MessageStartEvent>): void;
1098
- on(event: "message_update", handler: ExtensionHandler<MessageUpdateEvent>): void;
1099
- on(event: "message_end", handler: ExtensionHandler<MessageEndEvent>): void;
1100
- on(event: "tool_execution_start", handler: ExtensionHandler<ToolExecutionStartEvent>): void;
1101
- on(event: "tool_execution_update", handler: ExtensionHandler<ToolExecutionUpdateEvent>): void;
1102
- on(event: "tool_execution_end", handler: ExtensionHandler<ToolExecutionEndEvent>): void;
1103
- on(event: "model_select", handler: ExtensionHandler<ModelSelectEvent>): void;
1104
- on(event: "tool_call", handler: ExtensionHandler<ToolCallEvent, ToolCallEventResult>): void;
1105
- on(event: "tool_result", handler: ExtensionHandler<ToolResultEvent, ToolResultEventResult>): void;
1106
- on(event: "user_bash", handler: ExtensionHandler<UserBashEvent, UserBashEventResult>): void;
1107
- on(event: "input", handler: ExtensionHandler<InputEvent, InputEventResult>): void;
1108
-
1109
- // =========================================================================
1110
- // Tool Registration
1111
- // =========================================================================
1112
-
1113
- /** Register a tool that the LLM can call. */
1114
- registerTool<TParams extends TSchema = TSchema, TDetails = unknown, TState = any>(
1115
- tool: ToolDefinition<TParams, TDetails, TState>,
1116
- ): void;
1117
-
1118
- // =========================================================================
1119
- // Command, Shortcut, Flag Registration
1120
- // =========================================================================
1121
-
1122
- /** Register a custom command. */
1123
- registerCommand(name: string, options: Omit<RegisteredCommand, "name" | "sourceInfo">): void;
1124
-
1125
- /** Register a keyboard shortcut. */
1126
- registerShortcut(
1127
- shortcut: KeyId,
1128
- options: {
1129
- description?: string;
1130
- handler: (ctx: ExtensionContext) => Promise<void> | void;
1131
- },
1132
- ): void;
1133
-
1134
- /** Register a CLI flag. */
1135
- registerFlag(
1136
- name: string,
1137
- options: {
1138
- description?: string;
1139
- type: "boolean" | "string";
1140
- default?: boolean | string;
1141
- },
1142
- ): void;
1143
-
1144
- /** Get the value of a registered CLI flag. */
1145
- getFlag(name: string): boolean | string | undefined;
1146
-
1147
- // =========================================================================
1148
- // Message Rendering
1149
- // =========================================================================
1150
-
1151
- /** Register a custom renderer for CustomMessageEntry. */
1152
- registerMessageRenderer<T = unknown>(customType: string, renderer: MessageRenderer<T>): void;
1153
-
1154
- // =========================================================================
1155
- // Actions
1156
- // =========================================================================
1157
-
1158
- /** Send a custom message to the session. */
1159
- sendMessage<T = unknown>(
1160
- message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details">,
1161
- options?: { triggerTurn?: boolean; deliverAs?: "steer" | "followUp" | "nextTurn" },
1162
- ): void;
1163
-
1164
- /**
1165
- * Send a user message to the agent. Always triggers a turn.
1166
- * When the agent is streaming, use deliverAs to specify how to queue the message.
1167
- */
1168
- sendUserMessage(
1169
- content: string | (TextContent | ImageContent)[],
1170
- options?: { deliverAs?: "steer" | "followUp" },
1171
- ): void;
1172
-
1173
- /** Append a custom entry to the session for state persistence (not sent to LLM). */
1174
- appendEntry<T = unknown>(customType: string, data?: T): void;
1175
-
1176
- // =========================================================================
1177
- // Session Metadata
1178
- // =========================================================================
1179
-
1180
- /** Set the session display name (shown in session selector). */
1181
- setSessionName(name: string): void;
1182
-
1183
- /** Get the current session name, if set. */
1184
- getSessionName(): string | undefined;
1185
-
1186
- /** Set or clear a label on an entry. Labels are user-defined markers for bookmarking/navigation. */
1187
- setLabel(entryId: string, label: string | undefined): void;
1188
-
1189
- /** Execute a shell command. */
1190
- exec(command: string, args: string[], options?: ExecOptions): Promise<ExecResult>;
1191
-
1192
- /** Get the list of currently active tool names. */
1193
- getActiveTools(): string[];
1194
-
1195
- /** Get all configured tools with parameter schema and source metadata. */
1196
- getAllTools(): ToolInfo[];
1197
-
1198
- /** Set the active tools by name. */
1199
- setActiveTools(toolNames: string[]): void;
1200
-
1201
- /** Get available slash commands in the current session. */
1202
- getCommands(): SlashCommandInfo[];
1203
-
1204
- // =========================================================================
1205
- // Model and Thinking Level
1206
- // =========================================================================
1207
-
1208
- /** Set the current model. Returns false if no API key available. */
1209
- setModel(model: Model<any>): Promise<boolean>;
1210
-
1211
- /** Get current thinking level. */
1212
- getThinkingLevel(): ThinkingLevel;
1213
-
1214
- /** Set thinking level (clamped to model capabilities). */
1215
- setThinkingLevel(level: ThinkingLevel): void;
1216
-
1217
- // =========================================================================
1218
- // Provider Registration
1219
- // =========================================================================
1220
-
1221
- /**
1222
- * Register or override a model provider.
1223
- *
1224
- * If `models` is provided: replaces all existing models for this provider.
1225
- * If only `baseUrl` is provided: overrides the URL for existing models.
1226
- * If `oauth` is provided: registers OAuth provider for /login support.
1227
- * If `streamSimple` is provided: registers a custom API stream handler.
1228
- *
1229
- * During initial extension load this call is queued and applied once the
1230
- * runner has bound its context. After that it takes effect immediately, so
1231
- * it is safe to call from command handlers or event callbacks without
1232
- * requiring a `/reload`.
1233
- *
1234
- * @example
1235
- * // Register a new provider with custom models
1236
- * pi.registerProvider("my-proxy", {
1237
- * baseUrl: "https://proxy.example.com",
1238
- * apiKey: "PROXY_API_KEY",
1239
- * api: "anthropic-messages",
1240
- * models: [
1241
- * {
1242
- * id: "claude-sonnet-4-20250514",
1243
- * name: "Claude 4 Sonnet (proxy)",
1244
- * reasoning: false,
1245
- * input: ["text", "image"],
1246
- * cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
1247
- * contextWindow: 200000,
1248
- * maxTokens: 16384
1249
- * }
1250
- * ]
1251
- * });
1252
- *
1253
- * @example
1254
- * // Override baseUrl for an existing provider
1255
- * pi.registerProvider("anthropic", {
1256
- * baseUrl: "https://proxy.example.com"
1257
- * });
1258
- *
1259
- * @example
1260
- * // Register provider with OAuth support
1261
- * pi.registerProvider("corporate-ai", {
1262
- * baseUrl: "https://ai.corp.com",
1263
- * api: "openai-responses",
1264
- * models: [...],
1265
- * oauth: {
1266
- * name: "Corporate AI (SSO)",
1267
- * async login(callbacks) { ... },
1268
- * async refreshToken(credentials) { ... },
1269
- * getApiKey(credentials) { return credentials.access; }
1270
- * }
1271
- * });
1272
- */
1273
- registerProvider(name: string, config: ProviderConfig): void;
1274
-
1275
- /**
1276
- * Unregister a previously registered provider.
1277
- *
1278
- * Removes all models belonging to the named provider and restores any
1279
- * built-in models that were overridden by it. Has no effect if the provider
1280
- * is not currently registered.
1281
- *
1282
- * Like `registerProvider`, this takes effect immediately when called after
1283
- * the initial load phase.
1284
- *
1285
- * @example
1286
- * pi.unregisterProvider("my-proxy");
1287
- */
1288
- unregisterProvider(name: string): void;
1289
-
1290
- /** Shared event bus for extension communication. */
1291
- events: EventBus;
1292
- }
1293
-
1294
- // ============================================================================
1295
- // Provider Registration Types
1296
- // ============================================================================
1297
-
1298
- /** Configuration for registering a provider via pi.registerProvider(). */
1299
- export interface ProviderConfig {
1300
- /** Base URL for the API endpoint. Required when defining models. */
1301
- baseUrl?: string;
1302
- /** API key or environment variable name. Required when defining models (unless oauth provided). */
1303
- apiKey?: string;
1304
- /** API type. Required at provider or model level when defining models. */
1305
- api?: Api;
1306
- /** Optional streamSimple handler for custom APIs. */
1307
- streamSimple?: (model: Model<Api>, context: Context, options?: SimpleStreamOptions) => AssistantMessageEventStream;
1308
- /** Custom headers to include in requests. */
1309
- headers?: Record<string, string>;
1310
- /** If true, adds Authorization: Bearer header with the resolved API key. */
1311
- authHeader?: boolean;
1312
- /** Models to register. If provided, replaces all existing models for this provider. */
1313
- models?: ProviderModelConfig[];
1314
- /** OAuth provider for /login support. The `id` is set automatically from the provider name. */
1315
- oauth?: {
1316
- /** Display name for the provider in login UI. */
1317
- name: string;
1318
- /** Run the login flow, return credentials to persist. */
1319
- login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
1320
- /** Refresh expired credentials, return updated credentials to persist. */
1321
- refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
1322
- /** Convert credentials to API key string for the provider. */
1323
- getApiKey(credentials: OAuthCredentials): string;
1324
- /** Optional: modify models for this provider (e.g., update baseUrl based on credentials). */
1325
- modifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];
1326
- };
1327
- }
1328
-
1329
- /** Configuration for a model within a provider. */
1330
- export interface ProviderModelConfig {
1331
- /** Model ID (e.g., "claude-sonnet-4-20250514"). */
1332
- id: string;
1333
- /** Display name (e.g., "Claude 4 Sonnet"). */
1334
- name: string;
1335
- /** API type override for this model. */
1336
- api?: Api;
1337
- /** Whether the model supports extended thinking. */
1338
- reasoning: boolean;
1339
- /** Supported input types. */
1340
- input: ("text" | "image")[];
1341
- /** Cost per token (for tracking, can be 0). */
1342
- cost: { input: number; output: number; cacheRead: number; cacheWrite: number };
1343
- /** Maximum context window size in tokens. */
1344
- contextWindow: number;
1345
- /** Maximum output tokens. */
1346
- maxTokens: number;
1347
- /** Custom headers for this model. */
1348
- headers?: Record<string, string>;
1349
- /** OpenAI compatibility settings. */
1350
- compat?: Model<Api>["compat"];
1351
- }
1352
-
1353
- /** Extension factory function type. Supports both sync and async initialization. */
1354
- export type ExtensionFactory = (pi: ExtensionAPI) => void | Promise<void>;
1355
-
1356
- // ============================================================================
1357
- // Loaded Extension Types
1358
- // ============================================================================
1359
-
1360
- export interface RegisteredTool {
1361
- definition: ToolDefinition;
1362
- sourceInfo: SourceInfo;
1363
- }
1364
-
1365
- export interface ExtensionFlag {
1366
- name: string;
1367
- description?: string;
1368
- type: "boolean" | "string";
1369
- default?: boolean | string;
1370
- extensionPath: string;
1371
- }
1372
-
1373
- export interface ExtensionShortcut {
1374
- shortcut: KeyId;
1375
- description?: string;
1376
- handler: (ctx: ExtensionContext) => Promise<void> | void;
1377
- extensionPath: string;
1378
- }
1379
-
1380
- type HandlerFn = (...args: unknown[]) => Promise<unknown>;
1381
-
1382
- export type SendMessageHandler = <T = unknown>(
1383
- message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details">,
1384
- options?: { triggerTurn?: boolean; deliverAs?: "steer" | "followUp" | "nextTurn" },
1385
- ) => void;
1386
-
1387
- export type SendUserMessageHandler = (
1388
- content: string | (TextContent | ImageContent)[],
1389
- options?: { deliverAs?: "steer" | "followUp" },
1390
- ) => void;
1391
-
1392
- export type AppendEntryHandler = <T = unknown>(customType: string, data?: T) => void;
1393
-
1394
- export type SetSessionNameHandler = (name: string) => void;
1395
-
1396
- export type GetSessionNameHandler = () => string | undefined;
1397
-
1398
- export type GetActiveToolsHandler = () => string[];
1399
-
1400
- /** Tool info with name, description, parameter schema, and source metadata */
1401
- export type ToolInfo = Pick<ToolDefinition, "name" | "description" | "parameters"> & {
1402
- sourceInfo: SourceInfo;
1403
- };
1404
-
1405
- export type GetAllToolsHandler = () => ToolInfo[];
1406
-
1407
- export type GetCommandsHandler = () => SlashCommandInfo[];
1408
-
1409
- export type SetActiveToolsHandler = (toolNames: string[]) => void;
1410
-
1411
- export type RefreshToolsHandler = () => void;
1412
-
1413
- export type SetModelHandler = (model: Model<any>) => Promise<boolean>;
1414
-
1415
- export type GetThinkingLevelHandler = () => ThinkingLevel;
1416
-
1417
- export type SetThinkingLevelHandler = (level: ThinkingLevel) => void;
1418
-
1419
- export type SetLabelHandler = (entryId: string, label: string | undefined) => void;
1420
-
1421
- /**
1422
- * Shared state created by loader, used during registration and runtime.
1423
- * Contains flag values (defaults set during registration, CLI values set after).
1424
- */
1425
- export interface ExtensionRuntimeState {
1426
- flagValues: Map<string, boolean | string>;
1427
- /** Provider registrations queued during extension loading, processed when runner binds */
1428
- pendingProviderRegistrations: Array<{ name: string; config: ProviderConfig; extensionPath: string }>;
1429
- /** Throws when this extension instance is stale after runtime replacement. */
1430
- assertActive: () => void;
1431
- /** Marks this extension instance as stale after runtime replacement or reload. */
1432
- invalidate: (message?: string) => void;
1433
- /**
1434
- * Register or unregister a provider.
1435
- *
1436
- * Before bindCore(): queues registrations / removes from queue.
1437
- * After bindCore(): calls ModelRegistry directly for immediate effect.
1438
- */
1439
- registerProvider: (name: string, config: ProviderConfig, extensionPath?: string) => void;
1440
- unregisterProvider: (name: string, extensionPath?: string) => void;
1441
- }
1442
-
1443
- /**
1444
- * Action implementations for pi.* API methods.
1445
- * Provided to runner.initialize(), copied into the shared runtime.
1446
- */
1447
- export interface ExtensionActions {
1448
- sendMessage: SendMessageHandler;
1449
- sendUserMessage: SendUserMessageHandler;
1450
- appendEntry: AppendEntryHandler;
1451
- setSessionName: SetSessionNameHandler;
1452
- getSessionName: GetSessionNameHandler;
1453
- setLabel: SetLabelHandler;
1454
- getActiveTools: GetActiveToolsHandler;
1455
- getAllTools: GetAllToolsHandler;
1456
- setActiveTools: SetActiveToolsHandler;
1457
- refreshTools: RefreshToolsHandler;
1458
- getCommands: GetCommandsHandler;
1459
- setModel: SetModelHandler;
1460
- getThinkingLevel: GetThinkingLevelHandler;
1461
- setThinkingLevel: SetThinkingLevelHandler;
1462
- }
1463
-
1464
- /**
1465
- * Actions for ExtensionContext (ctx.* in event handlers).
1466
- * Required by all modes.
1467
- */
1468
- export interface ExtensionContextActions {
1469
- getModel: () => Model<any> | undefined;
1470
- isIdle: () => boolean;
1471
- getSignal: () => AbortSignal | undefined;
1472
- abort: () => void;
1473
- hasPendingMessages: () => boolean;
1474
- shutdown: () => void;
1475
- getContextUsage: () => ContextUsage | undefined;
1476
- compact: (options?: CompactOptions) => void;
1477
- getSystemPrompt: () => string;
1478
- }
1479
-
1480
- /**
1481
- * Actions for ExtensionCommandContext (ctx.* in command handlers).
1482
- * Only needed for interactive mode where extension commands are invokable.
1483
- */
1484
- export interface ExtensionCommandContextActions {
1485
- waitForIdle: () => Promise<void>;
1486
- newSession: (options?: {
1487
- parentSession?: string;
1488
- setup?: (sessionManager: SessionManager) => Promise<void>;
1489
- withSession?: (ctx: ReplacedSessionContext) => Promise<void>;
1490
- }) => Promise<{ cancelled: boolean }>;
1491
- fork: (
1492
- entryId: string,
1493
- options?: { position?: "before" | "at"; withSession?: (ctx: ReplacedSessionContext) => Promise<void> },
1494
- ) => Promise<{ cancelled: boolean }>;
1495
- navigateTree: (
1496
- targetId: string,
1497
- options?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string },
1498
- ) => Promise<{ cancelled: boolean }>;
1499
- switchSession: (
1500
- sessionPath: string,
1501
- options?: { withSession?: (ctx: ReplacedSessionContext) => Promise<void> },
1502
- ) => Promise<{ cancelled: boolean }>;
1503
- reload: () => Promise<void>;
1504
- }
1505
-
1506
- /**
1507
- * Full runtime = state + actions.
1508
- * Created by loader with throwing action stubs, completed by runner.initialize().
1509
- */
1510
- export interface ExtensionRuntime extends ExtensionRuntimeState, ExtensionActions {}
1511
-
1512
- /** Loaded extension with all registered items. */
1513
- export interface Extension {
1514
- path: string;
1515
- resolvedPath: string;
1516
- sourceInfo: SourceInfo;
1517
- handlers: Map<string, HandlerFn[]>;
1518
- tools: Map<string, RegisteredTool>;
1519
- messageRenderers: Map<string, MessageRenderer>;
1520
- commands: Map<string, RegisteredCommand>;
1521
- flags: Map<string, ExtensionFlag>;
1522
- shortcuts: Map<KeyId, ExtensionShortcut>;
1523
- }
1524
-
1525
- /** Result of loading extensions. */
1526
- export interface LoadExtensionsResult {
1527
- extensions: Extension[];
1528
- errors: Array<{ path: string; error: string }>;
1529
- /** Shared runtime - actions are throwing stubs until runner.initialize() */
1530
- runtime: ExtensionRuntime;
1531
- }
1532
-
1533
- // ============================================================================
1534
- // Extension Error
1535
- // ============================================================================
1536
-
1537
- export interface ExtensionError {
1538
- extensionPath: string;
1539
- event: string;
1540
- error: string;
1541
- stack?: string;
1542
- }