@oh-my-pi/pi-coding-agent 17.2.4 → 17.2.6

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 (348) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/{CHANGELOG-bpmhv26t.md → CHANGELOG-gs76k6wc.md} +69 -0
  3. package/dist/cli.js +4438 -3962
  4. package/dist/{template-8vdv6xb4.js → template-c2hyaytt.js} +8 -26
  5. package/dist/types/cli/args.d.ts +4 -1
  6. package/dist/types/cli/browser-relay-cli.d.ts +15 -0
  7. package/dist/types/cli/command-help.d.ts +99 -0
  8. package/dist/types/cli/gc-cli.d.ts +1 -0
  9. package/dist/types/cli/help-extra.d.ts +2 -0
  10. package/dist/types/cli/thinking-levels.d.ts +5 -0
  11. package/dist/types/cli/update-cli.d.ts +13 -0
  12. package/dist/types/commands/browser-relay.d.ts +38 -0
  13. package/dist/types/commands/commit.d.ts +3 -0
  14. package/dist/types/commands/complete.d.ts +1 -1
  15. package/dist/types/commands/completions.d.ts +6 -0
  16. package/dist/types/commands/grep.d.ts +3 -0
  17. package/dist/types/commands/join.d.ts +4 -0
  18. package/dist/types/commands/launch-help.d.ts +171 -0
  19. package/dist/types/commands/launch.d.ts +5 -1
  20. package/dist/types/commands/models.d.ts +3 -0
  21. package/dist/types/commands/say.d.ts +10 -0
  22. package/dist/types/commands/worktree.d.ts +3 -0
  23. package/dist/types/config/keybindings.d.ts +5 -0
  24. package/dist/types/config/model-discovery.d.ts +2 -2
  25. package/dist/types/config/models-config-schema-bundle.d.ts +3 -0
  26. package/dist/types/config/models-config-schema.d.ts +2 -0
  27. package/dist/types/config/models-config.d.ts +1 -0
  28. package/dist/types/config/service-tier.d.ts +2 -0
  29. package/dist/types/config/settings-schema.d.ts +69 -21
  30. package/dist/types/cursor-bridge-tools.d.ts +1 -1
  31. package/dist/types/cursor.d.ts +7 -4
  32. package/dist/types/edit/index.d.ts +3 -3
  33. package/dist/types/edit/modes/replace.d.ts +22 -15
  34. package/dist/types/edit/renderer.d.ts +1 -1
  35. package/dist/types/eval/py/kernel.d.ts +3 -1
  36. package/dist/types/eval/py/spawn-options.d.ts +12 -16
  37. package/dist/types/extensibility/legacy-pi-ai-shim.d.ts +8 -1
  38. package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +1 -1
  39. package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +2 -0
  40. package/dist/types/launch/broker.d.ts +1 -1
  41. package/dist/types/launch/client.d.ts +15 -4
  42. package/dist/types/launch/ensure.d.ts +8 -0
  43. package/dist/types/launch/paths.d.ts +1 -1
  44. package/dist/types/launch/protocol.d.ts +19 -2
  45. package/dist/types/lsp/client.d.ts +2 -0
  46. package/dist/types/lsp/mux/daemon.d.ts +15 -0
  47. package/dist/types/lsp/mux/protocol.d.ts +57 -0
  48. package/dist/types/lsp/mux/server.d.ts +18 -0
  49. package/dist/types/lsp/types.d.ts +22 -2
  50. package/dist/types/main.d.ts +2 -0
  51. package/dist/types/mnemopi/embed-client.d.ts +1 -1
  52. package/dist/types/mnemopi/state.d.ts +0 -23
  53. package/dist/types/modes/components/assistant-message.d.ts +2 -0
  54. package/dist/types/modes/components/btw-panel.d.ts +3 -0
  55. package/dist/types/modes/components/custom-editor.d.ts +2 -1
  56. package/dist/types/modes/components/read-tool-group.d.ts +2 -0
  57. package/dist/types/modes/components/stripped-tool-calls-placeholder.d.ts +12 -0
  58. package/dist/types/modes/components/tool-execution.d.ts +2 -0
  59. package/dist/types/modes/controllers/btw-controller.d.ts +2 -0
  60. package/dist/types/modes/controllers/command-controller.d.ts +1 -0
  61. package/dist/types/modes/controllers/input-controller.d.ts +1 -0
  62. package/dist/types/modes/interactive-mode.d.ts +5 -1
  63. package/dist/types/modes/types.d.ts +4 -1
  64. package/dist/types/modes/workflow.d.ts +2 -1
  65. package/dist/types/sdk.d.ts +3 -1
  66. package/dist/types/secrets/index.d.ts +1 -1
  67. package/dist/types/security/contracts/schemas.d.ts +405 -403
  68. package/dist/types/session/agent-session-types.d.ts +8 -1
  69. package/dist/types/session/agent-session.d.ts +26 -2
  70. package/dist/types/session/indexed-session-storage.d.ts +1 -0
  71. package/dist/types/session/launch-completion.d.ts +10 -0
  72. package/dist/types/session/session-advisors.d.ts +1 -1
  73. package/dist/types/session/session-context.d.ts +2 -1
  74. package/dist/types/session/session-entries.d.ts +15 -1
  75. package/dist/types/session/session-maintenance.d.ts +1 -0
  76. package/dist/types/session/session-manager.d.ts +23 -11
  77. package/dist/types/session/session-stats.d.ts +10 -0
  78. package/dist/types/session/session-storage.d.ts +15 -3
  79. package/dist/types/session/yield-queue.d.ts +6 -1
  80. package/dist/types/system-prompt.d.ts +4 -1
  81. package/dist/types/task/index.d.ts +2 -1
  82. package/dist/types/task/spawn-policy.d.ts +5 -0
  83. package/dist/types/thinking.d.ts +1 -7
  84. package/dist/types/tools/ast-grep.d.ts +1 -1
  85. package/dist/types/tools/browser/registry.d.ts +2 -1
  86. package/dist/types/tools/browser/relay/bridge.d.ts +35 -0
  87. package/dist/types/tools/browser/relay/daemon.d.ts +16 -0
  88. package/dist/types/tools/browser/relay/kind.d.ts +19 -0
  89. package/dist/types/tools/browser/relay/protocol.d.ts +97 -0
  90. package/dist/types/tools/browser/relay/server.d.ts +35 -0
  91. package/dist/types/tools/browser/render.d.ts +1 -0
  92. package/dist/types/tools/browser.d.ts +3 -0
  93. package/dist/types/tools/computer/exposure.d.ts +9 -7
  94. package/dist/types/tools/computer/protocol.d.ts +70 -17
  95. package/dist/types/tools/computer/supervisor.d.ts +23 -10
  96. package/dist/types/tools/computer/worker-entry.d.ts +1 -0
  97. package/dist/types/tools/computer/worker.d.ts +42 -7
  98. package/dist/types/tools/computer-renderer.d.ts +7 -5
  99. package/dist/types/tools/computer.d.ts +25 -44
  100. package/dist/types/tools/context.d.ts +3 -0
  101. package/dist/types/tools/glob.d.ts +1 -1
  102. package/dist/types/tools/grep.d.ts +1 -1
  103. package/dist/types/tools/index.d.ts +9 -0
  104. package/dist/types/tools/render-utils.d.ts +2 -0
  105. package/dist/types/tools/{browser/run-cancellation.d.ts → run-scope.d.ts} +8 -8
  106. package/dist/types/tools/tool-timeouts.d.ts +5 -0
  107. package/dist/types/tools/xdev.d.ts +8 -0
  108. package/dist/types/utils/clipboard.d.ts +2 -2
  109. package/dist/types/web/kagi.d.ts +1 -0
  110. package/dist/types/web/search/index.d.ts +1 -1
  111. package/dist/types/web/search/providers/anthropic.d.ts +1 -0
  112. package/dist/types/web/search/providers/base.d.ts +2 -0
  113. package/dist/types/web/search/providers/brave.d.ts +1 -0
  114. package/dist/types/web/search/providers/browser-page.d.ts +1 -0
  115. package/dist/types/web/search/providers/codex.d.ts +1 -0
  116. package/dist/types/web/search/providers/exa.d.ts +1 -0
  117. package/dist/types/web/search/providers/firecrawl.d.ts +1 -0
  118. package/dist/types/web/search/providers/gemini.d.ts +1 -0
  119. package/dist/types/web/search/providers/jina.d.ts +1 -0
  120. package/dist/types/web/search/providers/kagi.d.ts +1 -0
  121. package/dist/types/web/search/providers/kimi.d.ts +1 -0
  122. package/dist/types/web/search/providers/parallel.d.ts +1 -0
  123. package/dist/types/web/search/providers/perplexity.d.ts +1 -0
  124. package/dist/types/web/search/providers/searxng.d.ts +1 -0
  125. package/dist/types/web/search/providers/tavily.d.ts +1 -0
  126. package/dist/types/web/search/providers/tinyfish.d.ts +1 -0
  127. package/dist/types/web/search/providers/utils.d.ts +6 -9
  128. package/dist/types/web/search/providers/zai.d.ts +1 -0
  129. package/dist/types/web/search/types.d.ts +4 -0
  130. package/package.json +12 -12
  131. package/src/cli/args.ts +7 -87
  132. package/src/cli/browser-relay-cli.ts +119 -0
  133. package/src/cli/command-help.ts +103 -0
  134. package/src/cli/completion-gen.ts +5 -5
  135. package/src/cli/flag-tables.ts +9 -0
  136. package/src/cli/gc-cli.ts +641 -21
  137. package/src/cli/help-extra.ts +89 -0
  138. package/src/cli/setup-cli.ts +13 -21
  139. package/src/cli/thinking-levels.ts +7 -0
  140. package/src/cli/update-cli.ts +26 -7
  141. package/src/cli-commands.ts +170 -33
  142. package/src/cli.ts +17 -5
  143. package/src/commands/acp.ts +3 -1
  144. package/src/commands/agents.ts +3 -2
  145. package/src/commands/auth-broker.ts +3 -2
  146. package/src/commands/auth-gateway.ts +3 -2
  147. package/src/commands/bench.ts +2 -3
  148. package/src/commands/browser-relay.ts +53 -0
  149. package/src/commands/cleanse.ts +2 -2
  150. package/src/commands/commit.ts +3 -2
  151. package/src/commands/complete.ts +2 -1
  152. package/src/commands/completions.ts +3 -2
  153. package/src/commands/config.ts +3 -2
  154. package/src/commands/dry-balance.ts +2 -2
  155. package/src/commands/gallery.ts +3 -2
  156. package/src/commands/gc.ts +3 -2
  157. package/src/commands/grep.ts +3 -2
  158. package/src/commands/grievances.ts +3 -2
  159. package/src/commands/install.ts +2 -2
  160. package/src/commands/join.ts +3 -2
  161. package/src/commands/launch-help.ts +116 -0
  162. package/src/commands/launch.ts +7 -191
  163. package/src/commands/models.ts +3 -2
  164. package/src/commands/plugin.ts +3 -2
  165. package/src/commands/read.ts +3 -2
  166. package/src/commands/say.ts +3 -2
  167. package/src/commands/setup.ts +3 -2
  168. package/src/commands/shell.ts +3 -2
  169. package/src/commands/ssh.ts +3 -2
  170. package/src/commands/stats.ts +3 -2
  171. package/src/commands/tiny-models.ts +2 -2
  172. package/src/commands/token.ts +2 -2
  173. package/src/commands/ttsr.ts +2 -2
  174. package/src/commands/update.ts +3 -2
  175. package/src/commands/usage.ts +3 -2
  176. package/src/commands/web-search.ts +3 -2
  177. package/src/commands/worktree.ts +3 -2
  178. package/src/config/keybindings.ts +5 -0
  179. package/src/config/model-discovery.ts +44 -27
  180. package/src/config/model-registry.ts +19 -13
  181. package/src/config/models-config-schema-bundle.ts +9 -0
  182. package/src/config/resolve-config-value.ts +2 -1
  183. package/src/config/service-tier.ts +5 -0
  184. package/src/config/settings-schema.ts +72 -20
  185. package/src/config/settings.ts +1 -1
  186. package/src/cursor-bridge-tools.ts +1 -1
  187. package/src/cursor.ts +10 -14
  188. package/src/edit/diff.ts +17 -8
  189. package/src/edit/index.ts +20 -7
  190. package/src/edit/modes/replace.ts +93 -40
  191. package/src/edit/renderer.ts +1 -1
  192. package/src/edit/streaming.ts +14 -17
  193. package/src/eval/py/kernel.ts +2 -1
  194. package/src/eval/py/spawn-options.ts +24 -29
  195. package/src/export/html/index.ts +10 -3
  196. package/src/export/html/template.js +8 -26
  197. package/src/export/share.ts +4 -0
  198. package/src/extensibility/extensions/wrapper.ts +1 -0
  199. package/src/extensibility/legacy-pi-ai-shim.ts +22 -1
  200. package/src/extensibility/legacy-pi-coding-agent-shim.ts +7 -6
  201. package/src/extensibility/plugins/legacy-pi-compat.ts +124 -57
  202. package/src/extensibility/skills.ts +11 -0
  203. package/src/extensibility/utils.ts +10 -2
  204. package/src/launch/broker.ts +223 -7
  205. package/src/launch/client.ts +192 -21
  206. package/src/launch/ensure.ts +73 -0
  207. package/src/launch/paths.ts +1 -1
  208. package/src/launch/protocol.ts +54 -2
  209. package/src/lsp/client.ts +23 -2
  210. package/src/lsp/index.ts +8 -0
  211. package/src/lsp/mux/daemon.ts +348 -0
  212. package/src/lsp/mux/protocol.ts +96 -0
  213. package/src/lsp/mux/server.ts +797 -0
  214. package/src/lsp/types.ts +28 -2
  215. package/src/main.ts +20 -8
  216. package/src/mcp/config-writer.ts +1 -1
  217. package/src/mcp/oauth-flow.ts +11 -1
  218. package/src/mnemopi/embed-client.ts +49 -2
  219. package/src/mnemopi/state.ts +57 -23
  220. package/src/modes/components/assistant-message.ts +11 -0
  221. package/src/modes/components/btw-panel.ts +41 -4
  222. package/src/modes/components/chat-transcript-builder.ts +4 -0
  223. package/src/modes/components/custom-editor.ts +9 -0
  224. package/src/modes/components/read-tool-group.ts +10 -0
  225. package/src/modes/components/status-line/component.ts +1 -1
  226. package/src/modes/components/stripped-tool-calls-placeholder.ts +35 -0
  227. package/src/modes/components/tool-execution.ts +8 -0
  228. package/src/modes/components/tree-selector.ts +46 -48
  229. package/src/modes/controllers/btw-controller.ts +55 -7
  230. package/src/modes/controllers/command-controller.ts +31 -0
  231. package/src/modes/controllers/event-controller.ts +17 -0
  232. package/src/modes/controllers/input-controller.ts +63 -8
  233. package/src/modes/controllers/mcp-command-controller.ts +11 -5
  234. package/src/modes/controllers/selector-controller.ts +20 -0
  235. package/src/modes/interactive-mode.ts +18 -2
  236. package/src/modes/types.ts +9 -1
  237. package/src/modes/utils/hotkeys-markdown.ts +1 -0
  238. package/src/modes/utils/interactive-context-helpers.ts +1 -0
  239. package/src/modes/utils/ui-helpers.ts +6 -10
  240. package/src/modes/workflow.ts +8 -2
  241. package/src/prompts/agents/init.md +1 -1
  242. package/src/prompts/session/launch-completion.md +1 -0
  243. package/src/prompts/system/plan-mode-active.md +2 -2
  244. package/src/prompts/system/system-prompt.md +26 -52
  245. package/src/prompts/system/workflow-notice.md +3 -3
  246. package/src/prompts/tools/ast-grep.md +1 -1
  247. package/src/prompts/tools/bash.md +1 -1
  248. package/src/prompts/tools/browser.md +1 -0
  249. package/src/prompts/tools/computer.md +21 -21
  250. package/src/prompts/tools/glob.md +1 -1
  251. package/src/prompts/tools/grep.md +1 -1
  252. package/src/prompts/tools/replace.md +5 -4
  253. package/src/prompts/tools/task.md +4 -4
  254. package/src/sdk.ts +49 -6
  255. package/src/secrets/index.ts +1 -1
  256. package/src/security/contracts/schemas.ts +205 -183
  257. package/src/security/contracts/validation.ts +5 -1
  258. package/src/security/store.ts +2 -2
  259. package/src/session/agent-session-types.ts +9 -1
  260. package/src/session/agent-session.ts +204 -15
  261. package/src/session/indexed-session-storage.ts +9 -0
  262. package/src/session/launch-completion.ts +37 -0
  263. package/src/session/prewalk.ts +24 -2
  264. package/src/session/session-advisors.ts +2 -2
  265. package/src/session/session-context.ts +42 -12
  266. package/src/session/session-dump-format.ts +1 -1
  267. package/src/session/session-entries.ts +17 -1
  268. package/src/session/session-maintenance.ts +38 -4
  269. package/src/session/session-manager.ts +123 -67
  270. package/src/session/session-paths.ts +118 -55
  271. package/src/session/session-stats.ts +48 -3
  272. package/src/session/session-storage.ts +30 -22
  273. package/src/session/stream-guards.ts +1 -1
  274. package/src/session/yield-queue.ts +121 -16
  275. package/src/slash-commands/builtin-registry.ts +37 -24
  276. package/src/system-prompt.ts +8 -3
  277. package/src/task/index.ts +23 -8
  278. package/src/task/spawn-policy.ts +14 -0
  279. package/src/thinking.ts +2 -8
  280. package/src/tools/ast-grep.ts +10 -4
  281. package/src/tools/browser/cmux/cmux-tab.ts +97 -14
  282. package/src/tools/browser/cmux/rpc.ts +2 -8
  283. package/src/tools/browser/registry.ts +53 -2
  284. package/src/tools/browser/relay/bridge.ts +945 -0
  285. package/src/tools/browser/relay/daemon.ts +117 -0
  286. package/src/tools/browser/relay/extension-assets/background.js.txt +242 -0
  287. package/src/tools/browser/relay/extension-assets/manifest.json.txt +14 -0
  288. package/src/tools/browser/relay/extension-assets/options.html.txt +53 -0
  289. package/src/tools/browser/relay/extension-assets/options.js.txt +23 -0
  290. package/src/tools/browser/relay/kind.ts +41 -0
  291. package/src/tools/browser/relay/protocol.ts +54 -0
  292. package/src/tools/browser/relay/server.ts +141 -0
  293. package/src/tools/browser/render.ts +4 -1
  294. package/src/tools/browser/shared-daemon.ts +7 -58
  295. package/src/tools/browser/tab-supervisor.ts +5 -4
  296. package/src/tools/browser/tab-worker.ts +33 -12
  297. package/src/tools/browser.ts +26 -1
  298. package/src/tools/computer/exposure.ts +11 -35
  299. package/src/tools/computer/protocol.ts +51 -10
  300. package/src/tools/computer/supervisor.ts +227 -124
  301. package/src/tools/computer/worker-entry.ts +11 -6
  302. package/src/tools/computer/worker.ts +695 -81
  303. package/src/tools/computer-renderer.ts +104 -65
  304. package/src/tools/computer.ts +134 -428
  305. package/src/tools/context.ts +3 -0
  306. package/src/tools/glob.ts +9 -2
  307. package/src/tools/grep.ts +12 -6
  308. package/src/tools/hub/launch.ts +122 -6
  309. package/src/tools/index.ts +9 -0
  310. package/src/tools/inspect-image.ts +32 -6
  311. package/src/tools/render-utils.ts +2 -0
  312. package/src/tools/{browser/run-cancellation.ts → run-scope.ts} +11 -11
  313. package/src/tools/tool-timeouts.ts +1 -0
  314. package/src/tools/xdev.ts +29 -2
  315. package/src/utils/clipboard.ts +40 -14
  316. package/src/utils/command-args.ts +26 -28
  317. package/src/utils/tool-choice.ts +0 -13
  318. package/src/web/kagi.ts +2 -1
  319. package/src/web/search/index.ts +18 -2
  320. package/src/web/search/providers/anthropic.ts +4 -1
  321. package/src/web/search/providers/base.ts +2 -0
  322. package/src/web/search/providers/brave.ts +3 -1
  323. package/src/web/search/providers/browser-page.ts +6 -4
  324. package/src/web/search/providers/codex.ts +4 -1
  325. package/src/web/search/providers/duckduckgo.ts +2 -1
  326. package/src/web/search/providers/ecosia.ts +2 -1
  327. package/src/web/search/providers/exa.ts +4 -2
  328. package/src/web/search/providers/firecrawl.ts +3 -1
  329. package/src/web/search/providers/gemini.ts +8 -2
  330. package/src/web/search/providers/google.ts +2 -1
  331. package/src/web/search/providers/jina.ts +12 -2
  332. package/src/web/search/providers/kagi.ts +3 -0
  333. package/src/web/search/providers/kimi.ts +5 -1
  334. package/src/web/search/providers/mojeek.ts +2 -1
  335. package/src/web/search/providers/parallel.ts +5 -1
  336. package/src/web/search/providers/perplexity.ts +6 -3
  337. package/src/web/search/providers/public.ts +1 -1
  338. package/src/web/search/providers/searxng.ts +11 -5
  339. package/src/web/search/providers/startpage.ts +10 -4
  340. package/src/web/search/providers/synthetic.ts +11 -5
  341. package/src/web/search/providers/tavily.ts +3 -1
  342. package/src/web/search/providers/tinyfish.ts +3 -1
  343. package/src/web/search/providers/utils.ts +12 -10
  344. package/src/web/search/providers/xai.ts +2 -2
  345. package/src/web/search/providers/zai.ts +18 -3
  346. package/src/web/search/types.ts +6 -0
  347. package/dist/types/config/file-lock.d.ts +0 -29
  348. package/src/config/file-lock.ts +0 -164
@@ -31,6 +31,7 @@ export interface GeminiSearchParams extends GeminiToolParams {
31
31
  /** Sampling temperature (0–1). Lower = more focused/factual. */
32
32
  temperature?: number;
33
33
  signal?: AbortSignal;
34
+ timeoutMs?: number;
34
35
  authStorage: AuthStorage;
35
36
  sessionId?: string;
36
37
  fetch?: FetchImpl;
@@ -17,6 +17,7 @@ export interface JinaSearchParams {
17
17
  /** Single bare host for Jina's `X-Site` in-site search header. */
18
18
  site?: string;
19
19
  signal?: AbortSignal;
20
+ timeoutMs?: number;
20
21
  fetch?: FetchImpl;
21
22
  }
22
23
  /** Find JINA_API_KEY from environment or .env files. */
@@ -18,6 +18,7 @@ export declare function searchKagi(params: {
18
18
  recency?: SearchParams["recency"];
19
19
  parsedQuery?: StructuredQuery;
20
20
  signal?: AbortSignal;
21
+ timeoutMs?: number;
21
22
  authStorage: AuthStorage;
22
23
  sessionId?: string;
23
24
  fetch?: FetchImpl;
@@ -21,6 +21,7 @@ export interface KimiSearchParams {
21
21
  num_results?: number;
22
22
  include_content?: boolean;
23
23
  signal?: AbortSignal;
24
+ timeoutMs?: number;
24
25
  authStorage: AuthStorage;
25
26
  sessionId?: string;
26
27
  fetch?: FetchImpl;
@@ -7,6 +7,7 @@ export declare function searchParallel(params: {
7
7
  query: string;
8
8
  num_results?: number;
9
9
  signal?: AbortSignal;
10
+ timeoutMs?: number;
10
11
  fetch?: FetchImpl;
11
12
  parsedQuery?: StructuredQuery;
12
13
  }, authStorage: AuthStorage, sessionId?: string): Promise<SearchResponse>;
@@ -14,6 +14,7 @@ import type { SearchParams } from "./base.js";
14
14
  import { SearchProvider } from "./base.js";
15
15
  export interface PerplexitySearchParams {
16
16
  signal?: AbortSignal;
17
+ timeoutMs?: number;
17
18
  query: string;
18
19
  system_prompt?: string;
19
20
  /** Pre-parsed view of `query` from the search pipeline; parsed locally when absent. */
@@ -44,6 +44,7 @@ export declare function searchSearXNG(params: {
44
44
  num_results?: number;
45
45
  recency?: "day" | "week" | "month" | "year";
46
46
  signal?: AbortSignal;
47
+ timeoutMs?: number;
47
48
  fetch?: FetchImpl;
48
49
  }): Promise<SearchResponse>;
49
50
  /** Search provider for SearXNG web search. */
@@ -21,6 +21,7 @@ export interface TavilySearchParams {
21
21
  /** `before:` upper bound, ISO `YYYY-MM-DD`, mapped to `end_date`. */
22
22
  end_date?: string;
23
23
  signal?: AbortSignal;
24
+ timeoutMs?: number;
24
25
  fetch?: FetchImpl;
25
26
  }
26
27
  /** Find Tavily API key through AuthStorage's unified refresh pipeline. */
@@ -14,6 +14,7 @@ export interface TinyFishSearchParams {
14
14
  recency?: SearchParams["recency"];
15
15
  page?: number;
16
16
  signal?: AbortSignal;
17
+ timeoutMs?: number;
17
18
  fetch?: FetchImpl;
18
19
  }
19
20
  /** Resolve TinyFish API key through the shared auth storage pipeline. */
@@ -15,16 +15,13 @@ import { SearchProviderError, type SearchProviderId, type SearchSource } from ".
15
15
  */
16
16
  export declare function findCredential(storage: AgentStorage | null | undefined, envKey: string | null | undefined, ...storageProviders: string[]): string | null;
17
17
  /**
18
- * Default hard ceiling for a single web-search round-trip. 60s tolerates
19
- * legitimate slow LLM-mediated responses (anthropic web_search_20250305,
20
- * perplexity, gemini, codex) while still guaranteeing the session unfreezes
21
- * within a minute if Bun's `AbortSignal` fails to propagate on Windows.
22
- *
23
- * Pure search APIs (brave, exa, jina, tavily, searxng, synthetic, zai)
24
- * settle far faster in practice; reusing the same ceiling keeps the wiring
25
- * uniform without compromising correctness.
18
+ * The 60-second default tolerates legitimate slow LLM-mediated responses
19
+ * (Anthropic web_search_20250305, Perplexity, Gemini, Codex) while bounding
20
+ * Windows stalls when Bun's `AbortSignal` fails to propagate. Callers may
21
+ * configure a longer provider deadline, capped at five minutes by the
22
+ * dispatcher; pure search APIs typically settle far faster.
26
23
  */
27
- export declare const SEARCH_HARD_TIMEOUT_MS = 60000;
24
+ export declare const SEARCH_HARD_TIMEOUT_MS: number;
28
25
  /**
29
26
  * Compose a caller-supplied {@link AbortSignal} with a hard timeout so an
30
27
  * outbound `fetch()` is guaranteed to settle within `ms` even when the
@@ -12,6 +12,7 @@ export interface ZaiSearchParams {
12
12
  query: string;
13
13
  num_results?: number;
14
14
  signal?: AbortSignal;
15
+ timeoutMs?: number;
15
16
  fetch?: FetchImpl;
16
17
  authStorage: AuthStorage;
17
18
  sessionId?: string;
@@ -100,6 +100,10 @@ export declare const SEARCH_PROVIDER_OPTIONS: readonly [{
100
100
  readonly label: "Public Web";
101
101
  readonly description: "Queries every credential-free engine in parallel and consolidates deduplicated results";
102
102
  }];
103
+ /** Default hard timeout for each web-search provider transport. */
104
+ export declare const DEFAULT_WEB_SEARCH_TIMEOUT_SECONDS = 60;
105
+ /** Maximum configurable hard timeout for each web-search provider transport. */
106
+ export declare const MAX_WEB_SEARCH_TIMEOUT_SECONDS = 300;
103
107
  /** Supported web search providers (every option except `auto`). */
104
108
  export type SearchProviderId = Exclude<(typeof SEARCH_PROVIDER_OPTIONS)[number]["value"], "auto">;
105
109
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-coding-agent",
4
- "version": "17.2.4",
4
+ "version": "17.2.6",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Can Boluk",
@@ -52,17 +52,17 @@
52
52
  "@agentclientprotocol/sdk": "1.2.1",
53
53
  "@babel/parser": "^7.29.7",
54
54
  "@mozilla/readability": "^0.6.0",
55
- "@oh-my-pi/hashline": "17.2.4",
56
- "@oh-my-pi/omp-stats": "17.2.4",
57
- "@oh-my-pi/pi-agent-core": "17.2.4",
58
- "@oh-my-pi/pi-ai": "17.2.4",
59
- "@oh-my-pi/pi-catalog": "17.2.4",
60
- "@oh-my-pi/pi-mnemopi": "17.2.4",
61
- "@oh-my-pi/pi-natives": "17.2.4",
62
- "@oh-my-pi/pi-tui": "17.2.4",
63
- "@oh-my-pi/pi-utils": "17.2.4",
64
- "@oh-my-pi/pi-wire": "17.2.4",
65
- "@oh-my-pi/snapcompact": "17.2.4",
55
+ "@oh-my-pi/hashline": "17.2.6",
56
+ "@oh-my-pi/omp-stats": "17.2.6",
57
+ "@oh-my-pi/pi-agent-core": "17.2.6",
58
+ "@oh-my-pi/pi-ai": "17.2.6",
59
+ "@oh-my-pi/pi-catalog": "17.2.6",
60
+ "@oh-my-pi/pi-mnemopi": "17.2.6",
61
+ "@oh-my-pi/pi-natives": "17.2.6",
62
+ "@oh-my-pi/pi-tui": "17.2.6",
63
+ "@oh-my-pi/pi-utils": "17.2.6",
64
+ "@oh-my-pi/pi-wire": "17.2.6",
65
+ "@oh-my-pi/snapcompact": "17.2.6",
66
66
  "@opentelemetry/api": "^1.9.1",
67
67
  "@opentelemetry/api-logs": "^0.220.0",
68
68
  "@opentelemetry/context-async-hooks": "^2.9.0",
package/src/cli/args.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * CLI argument parsing and help display
3
3
  */
4
- import { APP_NAME, CONFIG_DIR_NAME, logger } from "@oh-my-pi/pi-utils";
4
+ import { $env, APP_NAME, logger } from "@oh-my-pi/pi-utils";
5
5
  import chalk from "chalk";
6
+ import type { ServiceTierOpenAISettingValue } from "../config/service-tier";
6
7
  import { CLI_THINKING_LEVELS, type ConfiguredThinkingLevel, parseCliThinkingLevel } from "../thinking";
7
8
  import { BUILTIN_TOOL_NAMES, HIDDEN_TOOL_NAMES, normalizeToolNames } from "../tools/builtin-names";
8
9
  import {
@@ -13,8 +14,11 @@ import {
13
14
  STRING_SETTERS,
14
15
  STRING_VALUE_FLAGS,
15
16
  } from "./flag-tables";
17
+ import { getExtraHelpText } from "./help-extra";
16
18
  import { CliUsageError } from "./usage-error";
17
19
 
20
+ export { getExtraHelpText };
21
+
18
22
  export type Mode = "text" | "json" | "rpc" | "acp" | "rpc-ui";
19
23
 
20
24
  export interface Args {
@@ -40,6 +44,7 @@ export interface Args {
40
44
  systemPrompt?: string;
41
45
  appendSystemPrompt?: string;
42
46
  thinking?: ConfiguredThinkingLevel;
47
+ serviceTier?: ServiceTierOpenAISettingValue;
43
48
  hideThinking?: boolean;
44
49
  advisor?: boolean;
45
50
  continue?: boolean;
@@ -145,6 +150,7 @@ export function parseArgs(inputArgs: string[], extensionFlags?: Map<string, { ty
145
150
  fileArgs: [],
146
151
  unknownFlags: new Map(),
147
152
  unrecognizedFlags: [],
153
+ sessionDir: $env.PI_CODING_AGENT_SESSION_DIR || undefined,
148
154
  };
149
155
 
150
156
  // `--` ends option parsing (POSIX end-of-options). Everything after it is
@@ -330,92 +336,6 @@ export function reportCliUsageError(
330
336
  return true;
331
337
  }
332
338
 
333
- export function getExtraHelpText(): string {
334
- return `${chalk.bold("Environment Variables:")}
335
- ${chalk.dim("# Core Providers")}
336
- ANTHROPIC_API_KEY - Anthropic Claude models
337
- ANTHROPIC_OAUTH_TOKEN - Anthropic OAuth (takes precedence over API key)
338
- CLAUDE_CODE_USE_FOUNDRY - Enable Anthropic Foundry mode (uses Foundry endpoint + mTLS)
339
- FOUNDRY_BASE_URL - Anthropic Foundry base URL (e.g., https://<foundry-host>)
340
- ANTHROPIC_FOUNDRY_API_KEY - Anthropic token used as Authorization: Bearer <token> in Foundry mode
341
- ANTHROPIC_CUSTOM_HEADERS - Extra headers for Foundry or any custom ANTHROPIC_BASE_URL gateway (e.g., "user-id: USERNAME")
342
- CLAUDE_CODE_CLIENT_CERT - Client certificate (PEM path or inline PEM) for mTLS
343
- CLAUDE_CODE_CLIENT_KEY - Client private key (PEM path or inline PEM) for mTLS
344
- NODE_EXTRA_CA_CERTS - CA bundle path (or inline PEM) for server certificate validation
345
- OPENAI_API_KEY - OpenAI GPT models
346
- GEMINI_API_KEY - Google Gemini models
347
- COPILOT_GITHUB_TOKEN - GitHub Copilot
348
-
349
- ${chalk.dim("# Additional LLM Providers")}
350
- AZURE_OPENAI_API_KEY - Azure OpenAI models
351
- GROQ_API_KEY - Groq models
352
- CEREBRAS_API_KEY - Cerebras models
353
- XAI_API_KEY - xAI Grok models
354
- OPENROUTER_API_KEY - OpenRouter aggregated models
355
- KILO_API_KEY - Kilo Gateway models
356
- MISTRAL_API_KEY - Mistral models
357
- ZAI_API_KEY - z.ai models (ZhipuAI/GLM)
358
- UMANS_AI_CODING_PLAN_API_KEY - Umans AI Coding Plan models
359
- UMANS_WEBSEARCH_PROVIDER - Umans gateway web search backend (native or exa)
360
- MINIMAX_API_KEY - MiniMax models
361
- OPENCODE_API_KEY - OpenCode Zen/OpenCode Go models
362
- CURSOR_ACCESS_TOKEN - Cursor AI models
363
- AI_GATEWAY_API_KEY - Vercel AI Gateway
364
- WAFER_SERVERLESS_API_KEY - Wafer Serverless (pay-as-you-go)
365
-
366
- ${chalk.dim("# Cloud Providers")}
367
- AWS_PROFILE - AWS Bedrock (or AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY)
368
- GOOGLE_CLOUD_PROJECT - Google Vertex AI (requires GOOGLE_CLOUD_LOCATION)
369
- GOOGLE_APPLICATION_CREDENTIALS - Service account for Vertex AI
370
-
371
- ${chalk.dim("# Search & Tools")}
372
- EXA_API_KEY - Exa web search
373
- BRAVE_API_KEY - Brave web search
374
- PERPLEXITY_API_KEY - Perplexity web search API key (optional; anonymous fallback)
375
- PERPLEXITY_COOKIES - Perplexity web search (session cookie)
376
- TAVILY_API_KEY - Tavily web search
377
- TINYFISH_API_KEY - TinyFish web search
378
- FIRECRAWL_API_KEY - Firecrawl web search
379
- ANTHROPIC_SEARCH_API_KEY - Anthropic web search (override; isolates search from main ANTHROPIC_API_KEY)
380
- ANTHROPIC_SEARCH_BASE_URL - Anthropic web search base URL (override; pairs with ANTHROPIC_SEARCH_API_KEY)
381
-
382
- ${chalk.dim("# Configuration")}
383
- OMP_PROFILE - Named profile for isolated agent state (same as --profile)
384
- Use \`omp --profile <name> --alias <command>\` to create a shell shortcut for a profile
385
- PI_CODING_AGENT_DIR - Session storage directory (default: ~/${CONFIG_DIR_NAME}/agent)
386
- PI_PACKAGE_DIR - Override package directory (for Nix/Guix store paths)
387
- PI_SMOL_MODEL - Override smol/fast model (see --smol)
388
- PI_SLOW_MODEL - Override slow/reasoning model (see --slow)
389
- PI_PLAN_MODEL - Override planning model (see --plan)
390
- PI_NO_PTY - Disable PTY-based interactive bash execution
391
- For complete environment variable reference, see:
392
- ${chalk.dim("docs/environment-variables.md")}
393
- ${chalk.bold("Available Tools (default-enabled unless noted):")}
394
- read - Read file contents
395
- bash - Execute bash commands
396
- edit - Edit files with find/replace
397
- write - Write files (creates/overwrites)
398
- grep - Search file contents
399
- glob - Find files by glob pattern
400
- lsp - Language server protocol (code intelligence)
401
- python - Execute Python code (requires: ${APP_NAME} setup python)
402
- notebook - Edit Jupyter notebooks
403
- inspect_image - Analyze images with a vision model
404
- browser - Browser automation (Puppeteer)
405
- computer - Native host desktop capture and input (disabled by default)
406
- task - Launch sub-agents for parallel tasks
407
- todo - Manage todo/task lists
408
- web_search - Search the web
409
- ask - Ask user questions (interactive mode only)
410
-
411
- ${chalk.bold("Plugin Options:")}
412
- --plugin-dir <path> Load plugin from directory (repeatable)
413
-
414
- ${chalk.bold("Useful Commands:")}
415
- omp agents unpack - Export bundled subagents to ~/.omp/agent/agents (default)
416
- omp agents unpack --project - Export bundled subagents to ./.omp/agents`;
417
- }
418
-
419
339
  export function printHelp(): void {
420
340
  process.stdout.write(
421
341
  `${chalk.bold(APP_NAME)} - AI coding assistant\n\n` +
@@ -0,0 +1,119 @@
1
+ /**
2
+ * `omp browser-relay` implementation: serve the local CDP relay and install
3
+ * its Chrome extension. Standalone CLI command — console output here is
4
+ * intentional user-facing output.
5
+ */
6
+ import * as path from "node:path";
7
+ import { getBrowserRelayDir } from "@oh-my-pi/pi-utils";
8
+ import { probeRelayServer } from "../tools/browser/relay/daemon";
9
+ import backgroundJs from "../tools/browser/relay/extension-assets/background.js.txt" with { type: "text" };
10
+ import manifestJson from "../tools/browser/relay/extension-assets/manifest.json.txt" with { type: "text" };
11
+ import optionsHtml from "../tools/browser/relay/extension-assets/options.html.txt" with { type: "text" };
12
+ import optionsJs from "../tools/browser/relay/extension-assets/options.js.txt" with { type: "text" };
13
+ import { DEFAULT_RELAY_URL } from "../tools/browser/relay/kind";
14
+ import { type RelayServer, startRelayServer } from "../tools/browser/relay/server";
15
+
16
+ export const BROWSER_RELAY_ACTIONS = ["serve", "install"] as const;
17
+ export type BrowserRelayAction = (typeof BROWSER_RELAY_ACTIONS)[number];
18
+
19
+ export interface BrowserRelayCommandArgs {
20
+ action: BrowserRelayAction;
21
+ port: number;
22
+ token?: string;
23
+ /** Install target directory; defaults to ~/.omp/browser-relay/extension. */
24
+ dir?: string;
25
+ /** Gather tabs the agent actively drives into an 'omp' Chrome tab group (default true). */
26
+ group?: boolean;
27
+ verbose?: boolean;
28
+ }
29
+
30
+ const EXTENSION_FILES: Record<string, string> = {
31
+ "background.js": backgroundJs,
32
+ "manifest.json": manifestJson,
33
+ "options.html": optionsHtml,
34
+ "options.js": optionsJs,
35
+ };
36
+
37
+ /** Default port of the relay endpoint (kept in sync with DEFAULT_RELAY_URL). */
38
+ export const DEFAULT_RELAY_PORT = Number(new URL(DEFAULT_RELAY_URL).port);
39
+
40
+ export async function runBrowserRelayCommand(args: BrowserRelayCommandArgs): Promise<void> {
41
+ if (args.action === "install") {
42
+ await runInstall(args.dir);
43
+ return;
44
+ }
45
+ await runServe(args);
46
+ }
47
+
48
+ async function runInstall(dirOverride: string | undefined): Promise<void> {
49
+ const dir = dirOverride ? path.resolve(dirOverride) : path.join(getBrowserRelayDir(), "extension");
50
+ for (const name in EXTENSION_FILES) {
51
+ await Bun.write(path.join(dir, name), EXTENSION_FILES[name]!);
52
+ }
53
+ console.log(`Installed the OMP Browser Relay extension to ${dir}`);
54
+ console.log("");
55
+ console.log("Finish setup in Chrome:");
56
+ console.log(" 1. Open chrome://extensions and enable Developer mode.");
57
+ console.log(` 2. Click "Load unpacked" and select: ${dir}`);
58
+ console.log(" 3. Enable the mode: omp config set browser.relay true");
59
+ console.log("");
60
+ console.log("omp starts the relay automatically when the browser tool needs it;");
61
+ console.log("run `omp browser-relay` yourself only for --token or --no-group.");
62
+ console.log("The extension badge shows 'on' once it reaches a relay.");
63
+ }
64
+
65
+ async function runServe(args: BrowserRelayCommandArgs): Promise<void> {
66
+ const log = args.verbose
67
+ ? (message: string, data?: Record<string, unknown>) => {
68
+ console.error(`[relay] ${message}${data ? ` ${JSON.stringify(data)}` : ""}`);
69
+ }
70
+ : undefined;
71
+ let relay: RelayServer;
72
+ try {
73
+ relay = startRelayServer({ port: args.port, token: args.token, group: args.group !== false, log });
74
+ } catch (err) {
75
+ // The port is machine-global while relays can be started by any project's
76
+ // broker (or by hand): losing the bind to a live relay is success.
77
+ if (err instanceof Error && "code" in err && err.code === "EADDRINUSE") {
78
+ if (await probeRelayServer(`http://127.0.0.1:${args.port}`)) {
79
+ console.log(`omp browser relay already running on http://127.0.0.1:${args.port}; nothing to do.`);
80
+ return;
81
+ }
82
+ console.error(`Port ${args.port} is in use by something that is not an omp browser relay.`);
83
+ process.exit(1);
84
+ }
85
+ throw err;
86
+ }
87
+
88
+ console.log(`omp browser relay listening on http://127.0.0.1:${args.port}`);
89
+ console.log(` extension endpoint ws://127.0.0.1:${args.port}/ext${args.token ? "?token=***" : ""}`);
90
+ if (args.port === DEFAULT_RELAY_PORT) {
91
+ console.log(" enable with omp config set browser.relay true");
92
+ } else {
93
+ console.log(
94
+ ` enable with omp config set browser.relay true && omp config set browser.relayUrl http://127.0.0.1:${args.port}`,
95
+ );
96
+ }
97
+ console.log("Waiting for the OMP Browser Relay extension to connect (omp browser-relay install)...");
98
+
99
+ let announced = false;
100
+ const readiness = setInterval(() => {
101
+ if (relay.bridge.ready && !announced) {
102
+ announced = true;
103
+ console.log("Extension connected. The omp browser tool can now drive your tabs.");
104
+ } else if (!relay.bridge.ready && announced) {
105
+ announced = false;
106
+ console.log("Extension disconnected; waiting for it to reconnect...");
107
+ }
108
+ }, 500);
109
+
110
+ const shutdown = () => {
111
+ clearInterval(readiness);
112
+ relay.stop();
113
+ process.exit(0);
114
+ };
115
+ process.on("SIGINT", shutdown);
116
+ process.on("SIGTERM", shutdown);
117
+ // Serve runs until SIGINT/SIGTERM; keep the process alive.
118
+ await new Promise<never>(() => {});
119
+ }
@@ -0,0 +1,103 @@
1
+ import type { CommandMetadata } from "@oh-my-pi/pi-utils/cli";
2
+
3
+ export const acpHelp = {
4
+ description: "Run Oh My Pi as an ACP (Agent Client Protocol) server over stdio",
5
+ } satisfies CommandMetadata;
6
+
7
+ export const agentsHelp = { description: "Manage bundled task agents" } satisfies CommandMetadata;
8
+
9
+ export const authBrokerHelp = {
10
+ description: "Manage the omp auth-broker (credential vault)",
11
+ } satisfies CommandMetadata;
12
+
13
+ export const authGatewayHelp = {
14
+ description: "Run an auth-gateway forward proxy backed by the configured broker",
15
+ } satisfies CommandMetadata;
16
+
17
+ export const benchHelp = {
18
+ description: "Benchmark models with the same prompt: time-to-first-token and generation throughput (tokens/s)",
19
+ } satisfies CommandMetadata;
20
+
21
+ export const browserRelayHelp = {
22
+ description: "Run the local CDP relay that lets the browser tool drive your own Chrome tabs",
23
+ } satisfies CommandMetadata;
24
+
25
+ export const cleanseHelp = {
26
+ description: "Detect and fix project diagnostics with weighted parallel subagents",
27
+ } satisfies CommandMetadata;
28
+
29
+ export const commitHelp = { description: "Generate a commit message and update changelogs" } satisfies CommandMetadata;
30
+
31
+ export const completionsHelp = {
32
+ description: "Print a shell completion script (bash, zsh, or fish)",
33
+ } satisfies CommandMetadata;
34
+
35
+ export const completeHelp = { hidden: true } satisfies CommandMetadata;
36
+
37
+ export const configHelp = { description: "Manage configuration settings" } satisfies CommandMetadata;
38
+
39
+ export const dryBalanceHelp = {
40
+ description: "Dry-run OAuth account balancing across random session ids",
41
+ } satisfies CommandMetadata;
42
+
43
+ export const galleryHelp = {
44
+ description: "Preview tool renderers across streaming, in-progress, success, and failure states",
45
+ } satisfies CommandMetadata;
46
+
47
+ export const gcHelp = { description: "Run storage garbage collection" } satisfies CommandMetadata;
48
+
49
+ export const grepHelp = { description: "Test grep tool" } satisfies CommandMetadata;
50
+
51
+ export const grievancesHelp = {
52
+ description: "View, clean, or push reported tool issues (auto-QA grievances)",
53
+ } satisfies CommandMetadata;
54
+
55
+ export const installHelp = {
56
+ description: "Install or link an extension package (alias of `plugin install`/`plugin link`)",
57
+ } satisfies CommandMetadata;
58
+
59
+ export const joinHelp = { description: "Join a shared collab session (same as /join)" } satisfies CommandMetadata;
60
+
61
+ export const modelsHelp = { description: "List, search, and refresh available models" } satisfies CommandMetadata;
62
+
63
+ export const pluginHelp = { description: "Manage plugins (install, uninstall, list, etc.)" } satisfies CommandMetadata;
64
+
65
+ export const readHelp = {
66
+ description: "Show what the read tool will return for a path, URL, or internal URI",
67
+ } satisfies CommandMetadata;
68
+
69
+ export const sayHelp = {
70
+ description: "Synthesize text with the local TTS engine and play it through the speakers",
71
+ } satisfies CommandMetadata;
72
+
73
+ export const searchHelp = { description: "Test web search providers" } satisfies CommandMetadata;
74
+
75
+ export const setupHelp = {
76
+ description: "Run onboarding setup or install dependencies for optional features",
77
+ } satisfies CommandMetadata;
78
+
79
+ export const shellHelp = { description: "Interactive shell console" } satisfies CommandMetadata;
80
+
81
+ export const sshHelp = { description: "Manage SSH host configurations" } satisfies CommandMetadata;
82
+
83
+ export const statsHelp = { description: "View usage statistics" } satisfies CommandMetadata;
84
+
85
+ export const tinyModelsHelp = {
86
+ description: "Download tiny local models (session titles + memory)",
87
+ } satisfies CommandMetadata;
88
+
89
+ export const tokenHelp = { description: "Get the API key or OAuth token for a provider" } satisfies CommandMetadata;
90
+
91
+ export const ttsrHelp = {
92
+ description: "Inspect and test Time-Traveling Stream Rules (TTSR)",
93
+ } satisfies CommandMetadata;
94
+
95
+ export const updateHelp = { description: "Check for and install updates" } satisfies CommandMetadata;
96
+
97
+ export const usageHelp = {
98
+ description: "Show provider usage limits for every authenticated account",
99
+ } satisfies CommandMetadata;
100
+
101
+ export const worktreeHelp = {
102
+ description: "List or clear agent-managed git worktrees (~/.omp/wt)",
103
+ } satisfies CommandMetadata;
@@ -14,7 +14,7 @@
14
14
  * — see `commands/complete.ts`. The flag→source mapping below is the only manual
15
15
  * knob and is keyed by flag name so it stays stable as flags are added.
16
16
  */
17
- import type { ArgDescriptor, CliConfig, CommandCtor, FlagDescriptor } from "@oh-my-pi/pi-utils/cli";
17
+ import type { ArgDescriptor, CliConfig, CommandMetadata, FlagDescriptor } from "@oh-my-pi/pi-utils/cli";
18
18
  import { BUILTIN_TOOL_NAMES } from "../tools/builtin-names";
19
19
 
20
20
  export type Shell = "bash" | "zsh" | "fish";
@@ -88,9 +88,9 @@ function argValue(desc: ArgDescriptor): ValueSource {
88
88
  return { kind: "file" };
89
89
  }
90
90
 
91
- function buildFlags(Cmd: CommandCtor): CompletionFlag[] {
91
+ function buildFlags(command: CommandMetadata): CompletionFlag[] {
92
92
  const out: CompletionFlag[] = [];
93
- const flags = Cmd.flags ?? {};
93
+ const flags = command.flags ?? {};
94
94
  for (const name in flags) {
95
95
  const desc = flags[name];
96
96
  out.push({
@@ -104,9 +104,9 @@ function buildFlags(Cmd: CommandCtor): CompletionFlag[] {
104
104
  return out;
105
105
  }
106
106
 
107
- function buildArgs(Cmd: CommandCtor): CompletionArg[] {
107
+ function buildArgs(command: CommandMetadata): CompletionArg[] {
108
108
  const out: CompletionArg[] = [];
109
- const args = Cmd.args ?? {};
109
+ const args = command.args ?? {};
110
110
  for (const name in args) {
111
111
  const desc = args[name];
112
112
  out.push({ name, description: desc.description ?? "", value: argValue(desc) });
@@ -30,6 +30,7 @@
30
30
  * real implementations at the dispatch site.
31
31
  */
32
32
 
33
+ import { isServiceTierOpenAISettingValue, SERVICE_TIER_OPENAI_VALUES } from "../config/service-tier";
33
34
  import type { ConfiguredThinkingLevel } from "../thinking";
34
35
  import type { Args } from "./args";
35
36
  import { CliUsageError } from "./usage-error";
@@ -152,6 +153,14 @@ export const STRING_SETTERS: Record<string, StringSetter> = {
152
153
  "--max-time": (result, value) => {
153
154
  result.maxTime = parseMaxTimeSeconds(value);
154
155
  },
156
+ "--service-tier": (result, value) => {
157
+ if (!isServiceTierOpenAISettingValue(value)) {
158
+ throw new CliUsageError(
159
+ `Invalid --service-tier value: ${JSON.stringify(value)}. Expected one of: ${SERVICE_TIER_OPENAI_VALUES.join(", ")}.`,
160
+ );
161
+ }
162
+ result.serviceTier = value;
163
+ },
155
164
  "--api-key": (result, value) => {
156
165
  result.apiKey = value;
157
166
  },