@bastani/atomic 0.9.25-alpha.5 → 0.9.26-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/dist/builtin/intercom/package.json +2 -2
  3. package/dist/builtin/mcp/CHANGELOG.md +38 -0
  4. package/dist/builtin/mcp/OAUTH.md +1 -1
  5. package/dist/builtin/mcp/native-client-licenses/NOTICE +2 -2
  6. package/dist/builtin/mcp/package.json +1 -1
  7. package/dist/builtin/subagents/package.json +3 -3
  8. package/dist/builtin/web-access/package.json +2 -2
  9. package/dist/builtin/workflows/CHANGELOG.md +20 -0
  10. package/dist/builtin/workflows/package.json +2 -2
  11. package/dist/builtin/workflows/src/extension/index.bundle.mjs +17 -0
  12. package/dist/builtin/workflows/src/index.js +15 -0
  13. package/dist/cli/args.js +1 -1
  14. package/dist/cli/args.js.map +1 -1
  15. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  16. package/dist/core/agent-session-extension-bindings.js +4 -0
  17. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  18. package/dist/core/agent-session-methods.d.ts +5 -1
  19. package/dist/core/agent-session-methods.d.ts.map +1 -1
  20. package/dist/core/agent-session-methods.js.map +1 -1
  21. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  22. package/dist/core/agent-session-prompt.js +1 -0
  23. package/dist/core/agent-session-prompt.js.map +1 -1
  24. package/dist/core/agent-session-state.d.ts +14 -2
  25. package/dist/core/agent-session-state.d.ts.map +1 -1
  26. package/dist/core/agent-session-state.js +31 -6
  27. package/dist/core/agent-session-state.js.map +1 -1
  28. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  29. package/dist/core/agent-session-tool-registry.js +5 -1
  30. package/dist/core/agent-session-tool-registry.js.map +1 -1
  31. package/dist/core/agent-session.d.ts +1 -0
  32. package/dist/core/agent-session.d.ts.map +1 -1
  33. package/dist/core/agent-session.js +2 -2
  34. package/dist/core/agent-session.js.map +1 -1
  35. package/dist/core/messages.d.ts.map +1 -1
  36. package/dist/core/messages.js +4 -3
  37. package/dist/core/messages.js.map +1 -1
  38. package/dist/core/model-registry.d.ts +2 -1
  39. package/dist/core/model-registry.d.ts.map +1 -1
  40. package/dist/core/model-registry.js +3 -0
  41. package/dist/core/model-registry.js.map +1 -1
  42. package/dist/core/oauth-login.d.ts +1 -0
  43. package/dist/core/oauth-login.d.ts.map +1 -1
  44. package/dist/core/oauth-login.js.map +1 -1
  45. package/dist/core/oauth-provider-metadata.d.ts.map +1 -1
  46. package/dist/core/oauth-provider-metadata.js +1 -0
  47. package/dist/core/oauth-provider-metadata.js.map +1 -1
  48. package/dist/core/settings-manager-resource-accessors.d.ts +3 -3
  49. package/dist/core/settings-manager-resource-accessors.d.ts.map +1 -1
  50. package/dist/core/settings-manager-resource-accessors.js +2 -1
  51. package/dist/core/settings-manager-resource-accessors.js.map +1 -1
  52. package/dist/core/settings-manager.d.ts +1 -1
  53. package/dist/core/settings-manager.d.ts.map +1 -1
  54. package/dist/core/settings-manager.js.map +1 -1
  55. package/dist/core/settings-types.d.ts +2 -1
  56. package/dist/core/settings-types.d.ts.map +1 -1
  57. package/dist/core/settings-types.js.map +1 -1
  58. package/dist/core/system-prompt.js +1 -1
  59. package/dist/core/system-prompt.js.map +1 -1
  60. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  61. package/dist/extensions/codemode/execute.js +133 -31
  62. package/dist/extensions/codemode/execute.js.map +1 -1
  63. package/dist/extensions/codemode/tool.d.ts +2 -1
  64. package/dist/extensions/codemode/tool.d.ts.map +1 -1
  65. package/dist/extensions/codemode/tool.js +25 -4
  66. package/dist/extensions/codemode/tool.js.map +1 -1
  67. package/dist/extensions/mcp/cli.js +2 -2
  68. package/dist/extensions/mcp/cli.js.map +1 -1
  69. package/dist/extensions/mcp/client/oauth/flow.d.ts +6 -0
  70. package/dist/extensions/mcp/client/oauth/flow.d.ts.map +1 -1
  71. package/dist/extensions/mcp/client/oauth/flow.js +23 -5
  72. package/dist/extensions/mcp/client/oauth/flow.js.map +1 -1
  73. package/dist/extensions/mcp/client/oauth/index.d.ts +1 -1
  74. package/dist/extensions/mcp/client/oauth/index.d.ts.map +1 -1
  75. package/dist/extensions/mcp/client/oauth/index.js +1 -1
  76. package/dist/extensions/mcp/client/oauth/index.js.map +1 -1
  77. package/dist/extensions/mcp/index.d.ts.map +1 -1
  78. package/dist/extensions/mcp/index.js +22 -12
  79. package/dist/extensions/mcp/index.js.map +1 -1
  80. package/dist/extensions/mcp/oauth.d.ts +12 -7
  81. package/dist/extensions/mcp/oauth.d.ts.map +1 -1
  82. package/dist/extensions/mcp/oauth.js +58 -24
  83. package/dist/extensions/mcp/oauth.js.map +1 -1
  84. package/dist/extensions/mcp/runtime.js +1 -1
  85. package/dist/extensions/mcp/runtime.js.map +1 -1
  86. package/dist/index.d.ts +1 -1
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js.map +1 -1
  89. package/dist/main-session-options.d.ts.map +1 -1
  90. package/dist/main-session-options.js +6 -0
  91. package/dist/main-session-options.js.map +1 -1
  92. package/dist/main.js +1 -1
  93. package/dist/main.js.map +1 -1
  94. package/dist/modes/interactive/components/atomic-banner.d.ts +2 -0
  95. package/dist/modes/interactive/components/atomic-banner.d.ts.map +1 -1
  96. package/dist/modes/interactive/components/atomic-banner.js +9 -1
  97. package/dist/modes/interactive/components/atomic-banner.js.map +1 -1
  98. package/dist/modes/interactive/components/oauth-selector.d.ts +2 -0
  99. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  100. package/dist/modes/interactive/components/oauth-selector.js +9 -4
  101. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  102. package/dist/modes/interactive/components/settings-selector-handlers.js +1 -1
  103. package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
  104. package/dist/modes/interactive/components/settings-selector-items.js +3 -3
  105. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
  106. package/dist/modes/interactive/components/settings-selector-types.d.ts +3 -3
  107. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  108. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  109. package/dist/modes/interactive/components/startup-identity.js +2 -2
  110. package/dist/modes/interactive/components/startup-identity.js.map +1 -1
  111. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  112. package/dist/modes/interactive/components/user-message.js +3 -4
  113. package/dist/modes/interactive/components/user-message.js.map +1 -1
  114. package/dist/modes/interactive/interactive-auth-login.js +14 -5
  115. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  116. package/dist/modes/interactive/interactive-auth-routing.js +38 -17
  117. package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
  118. package/dist/modes/interactive/interactive-mode-surface.d.ts +6 -4
  119. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  120. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  121. package/dist/modes/interactive/interactive-resource-rendering.js +1 -1
  122. package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
  123. package/dist/modes/interactive/interactive-selectors.js +2 -2
  124. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  125. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  126. package/dist/modes/interactive/interactive-startup.js +12 -4
  127. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  128. package/dist/modes/interactive/login-provider-options.d.ts +2 -1
  129. package/dist/modes/interactive/login-provider-options.d.ts.map +1 -1
  130. package/dist/modes/interactive/login-provider-options.js +11 -6
  131. package/dist/modes/interactive/login-provider-options.js.map +1 -1
  132. package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -1
  133. package/dist/modes/interactive/theme/system-theme.js +10 -4
  134. package/dist/modes/interactive/theme/system-theme.js.map +1 -1
  135. package/docs/codemode.md +214 -0
  136. package/docs/docs.json +1 -0
  137. package/docs/extensions/api-reference.md +2 -0
  138. package/docs/getting-started/authentication.md +2 -2
  139. package/docs/guides.md +1 -1
  140. package/docs/mcp-servers.md +2 -0
  141. package/docs/providers.md +5 -3
  142. package/docs/reference/cli.md +1 -1
  143. package/docs/settings.md +1 -1
  144. package/docs/terminal-setup.md +2 -0
  145. package/docs/tools.md +1 -3
  146. package/docs/usage.md +1 -1
  147. package/npm-shrinkwrap.json +68 -73
  148. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -2,6 +2,114 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.26-alpha.1] - 2026-10-01
6
+
7
+ ### Breaking Changes
8
+
9
+ - MCP OAuth credentials are now stored per server name and URL, so MCP servers with the same URL can sign in with different accounts. Credentials stored by URL alone move to the first server that uses them ([#10252](https://github.com/earendil-works/pi/issues/10252)). SDK consumers of the exported `McpOAuthCredentialStore` must now pass the server name to `forServer`, `tokens`, `remove` and `removeAsync`.
10
+
11
+ ### Added
12
+
13
+ - Added `quietStartup: "header"`, which keeps the startup header but hides the model scope line. `/settings` offers it alongside `true` and `false`.
14
+ - Added `models.generateImages()` to codemode scripts. It runs image models such as OpenRouter's with the session's credentials and returns base64 image blocks that `image()` attaches to the result; usage counts toward the session cost like `models.classify()`. Extensions can call `ctx.modelRegistry.generateImages()`. See [Built-in tools](docs/tools.md#codemode).
15
+
16
+ ### Changed
17
+
18
+ - Cancelling a login started from a `/login` menu now returns to that menu.
19
+ - The "Cloud Providers" section of the [Providers](docs/providers.md) docs page is now "Provider Specific Config".
20
+ - Codemode costs fewer prompt tokens. The `codemode` description points to the new [Codemode](docs/codemode.md) reference for the `models` API, which the model reads when it needs it, and declared tools say in one line how scripts call them and what the call resolves to instead of repeating their full declaration. The MCP server section of the system prompt only explains the ways of reaching tools that its servers use, and the system prompt points to the new reference.
21
+ - Codemode errors now say how to recover: reading a tool or `models` member that does not exist names the close matches (`tools.Bash` suggests `tools.bash`), `models.classify()` and `models.generateImages()` reject malformed arguments with the expected shape, an unknown model points to `models.getAvailableOfType()`, an oversized `store()` value explains what the store is for, and a script that generates images without showing them gets a note. Scripts that probed for a tool with `typeof tools.name` must use `"name" in tools`.
22
+ - `/login` and `/logout` now label providers without credentials as "not configured" instead of "unconfigured".
23
+ - OAuth browser pages now show the Atomic logo in color instead of white.
24
+
25
+ ### Fixed
26
+
27
+ - `/mcp login` now prints its sign-in URL as a clickable link in the terminal UI, even when the URL wraps ([#10186](https://github.com/earendil-works/pi/issues/10186)).
28
+ - `--provider` without `--model` now fails with an error instead of being silently ignored while the default model from another provider runs ([#10236](https://github.com/earendil-works/pi/issues/10236)).
29
+ - MCP servers that ask for more scope (`insufficient_scope`) no longer trigger repeated sign-in requests. The new sign-in now keeps the scopes granted earlier instead of requesting only the missing ones.
30
+ - User messages in the transcript now keep one copy of each rendered line instead of two full-width copies, with identical output.
31
+ - Deferred MCP tools that `tool_search` loaded are no longer dropped on resume and `/reload` when their server reconnects before the next prompt; the session restored its tools before the MCP servers reconnected.
32
+ - The `system` theme keeps pastel terminal palettes pastel instead of making their accent colors more saturated at the lightness the theme needs ([#10255](https://github.com/earendil-works/pi/issues/10255), [#10293](https://github.com/earendil-works/pi/pull/10293) by [@dgtlntv](https://github.com/dgtlntv)).
33
+ - `/login` and `/logout` no longer label every OAuth sign-in as a subscription. Only subscription-backed providers say "subscription"; other OAuth sign-ins say "account".
34
+ - The startup header logo no longer renders with gaps in Apple Terminal; it shows a text `∀ Atomic` wordmark with the version and session details instead.
35
+ - Slash command autocompletion now triggers when the input starts with whitespace ([#10218](https://github.com/earendil-works/pi/pull/10218) by [@haoqixu](https://github.com/haoqixu)).
36
+ - Color no longer bleeds past mouse selections in fullscreen mode when a styled token ends at the selection boundary ([#10169](https://github.com/earendil-works/pi/issues/10169)).
37
+ - The transcript retains less memory per rendered message; a long assistant message keeps about a fifth of the heap it kept before.
38
+
39
+ ## [0.9.25] - 2026-10-01
40
+
41
+ ### Breaking Changes
42
+
43
+ - Replaced the old MCP adapter with the native client. Only `~/.atomic/agent/mcp.json` and trusted `.atomic/mcp.json` are read, using the native configuration shape. Shared config layers, client imports, and old-field translations are no longer supported; old OAuth credentials are not imported.
44
+ - MCP tools now use `mcp__<server>__<tool>` names and default to `codemode` exposure. The old gateway, configurable prefixes, lazy/idle lifecycle settings, metadata cache, SSE transport, MCP Apps rendering, and setup command are removed. Enabled servers connect in the background; `/mcp reconnect` without a name selects one server rather than reconnecting every server.
45
+
46
+ ### Added
47
+
48
+ - MCP servers can set `oauth.authServerMetadataUrl` to a trusted authorization server metadata document when discovery advertises the wrong server or none. See [MCP authentication](docs/mcp-servers.md#override-oauth-authorization-server-discovery) ([#10172](https://github.com/earendil-works/pi/issues/10172)).
49
+ - Added `/mcp login [server]`, command completion, and server selection for login, logout, and reconnect. The manager offers per-server action menus for enabled state and tool exposure, and OAuth sign-in accepts a pasted redirect URL when the browser is on another machine.
50
+ - MCP servers support `codemode`, `deferred`, `direct`, and `hidden` exposure with per-tool pattern overrides, standard resource list/read tools, and per-server OAuth callback ports and URLs. See [MCP servers](docs/mcp-servers.md).
51
+ - Added shell commands `atomic mcp add`, `remove`, `list`, `login`, and `logout` to configure, check, and authenticate file-configured servers without starting a session.
52
+ - SDK hosts can now manage the workflow runs their session owns through `session.workflows`: `listRuns()`, `getRun()`, `getStages()`, `pause()`, `quit()` and `resume()` return the workflow tool's structured results, and failures reject with typed `WorkflowRunControlError` subclasses (`WorkflowRunNotFoundError`, `WorkflowRunOwnershipError`, `WorkflowRunNotResumableError`, `WorkflowRunDatabaseError`, `WorkflowStageNotFoundError`, `WorkflowStageAmbiguousError`, `WorkflowStageResumeUnsupportedError`) instead of strings. A batch `pause({ all: true })` or `quit({ all: true })` returns a `partial` outcome whose `failedRuns` names the runs still active only when that call stopped at least one run, and rejects with `WorkflowRunControlError` carrying `failedRuns` when active runs could not be stopped and the call stopped none, even if other runs were already paused. Already-paused and already-ended runs are not failures. A database outage while checking who owns a run rejects `pause()` and `quit()` with `WorkflowRunDatabaseError`. It uses the same ownership and durable-resume rules as the `workflow` tool, so runs owned by another session or live process stay read-only ([#3377](https://github.com/bastani-inc/atomic/issues/3377)).
53
+ - Codemode scripts can retrieve namespace summaries, instructions, and callable tool names with `describeNamespace(name)`. Tool search indexes namespace instructions without including them in inline tool listings, and codemode listings no longer include tool counts ([#10212](https://github.com/earendil-works/pi/issues/10212)).
54
+ - `/reload` enables tools newly added to `defaultTools`, while preserving session-disabled tools, tools removed from the setting, and explicit CLI tool restrictions ([#10245](https://github.com/earendil-works/pi/issues/10245)).
55
+ - Added Anthropic workload identity federation from the `ANTHROPIC_FEDERATION_RULE_ID`, `ANTHROPIC_ORGANIZATION_ID`, and `ANTHROPIC_IDENTITY_TOKEN_FILE` environment variables, with optional `ANTHROPIC_SERVICE_ACCOUNT_ID` and `ANTHROPIC_WORKSPACE_ID`. See [Providers](docs/providers.md#anthropic-workload-identity-federation) ([#10177](https://github.com/earendil-works/pi/issues/10177), [#10242](https://github.com/earendil-works/pi/pull/10242) by [@philfreo](https://github.com/philfreo)).
56
+ - MCP servers can set `oauth.clientName` for dynamic OAuth registration, or use `"auth": { "provider": "<provider>" }` to send the current provider login token. Provider-token authentication is restricted to global configuration and extension registrations, with HTTPS required except on loopback hosts. See [MCP authentication](docs/mcp-servers.md#authentication) ([#10226](https://github.com/earendil-works/pi/issues/10226)).
57
+ - `/login anthropic` now offers **Copy code login (headless)** when the browser is on another machine and cannot reach Atomic's local callback ([#10194](https://github.com/earendil-works/pi/pull/10194) by [@lucasmeijer](https://github.com/lucasmeijer)).
58
+ - Added GPT-6.1 Sol and its first-party Fast variants for OpenAI API keys and ChatGPT Codex subscriptions.
59
+ - Added **Sign in with ChatGPT** for the OpenAI provider, independently of Codex backend login.
60
+ - Added Jev decision models on Vercel AI Gateway and OpenCode Zen.
61
+ - Added configurable fullscreen mouse-wheel scrolling with terminal-aware automatic behavior or a fixed line count.
62
+ - Extension tools can declare exposure, namespaces, annotations and output schemas, and invoke permitted nested tools through the ordinary validation and permission hooks.
63
+ - Added a selectable system theme based on the terminal's palette and contrast, and OKHSL colors for custom themes.
64
+ - Added opt-in `codemode` scripts for composing permitted tools, filtering output, branch-local JSON storage, and classifier calls, plus `tool_search` for activating deferred tools. Interactive and orchestration tools remain unavailable from scripts.
65
+ - Added `builtin:llama.cpp`, `builtin:codemode`, and `builtin:tool-search` extension resources for explicit loading and settings-based enable/disable controls, with diagnostics when an extension replaces codemode or tool search.
66
+ - Added Ultrafast for GPT-6 Astra as `openai/gpt-6-astra-ultrafast` and `openai-codex/gpt-6-astra-ultrafast`, priced at OpenAI's published Ultrafast rates. GPT-6 Astra is the only model with an Ultrafast choice. If the provider rejects an Ultrafast choice you selected, the request fails.
67
+
68
+ ### Changed
69
+
70
+ - MCP now uses pi's native client, tool exposure, resources, and server manager. Calls, including codemode calls, pass through Atomic's tool permission pipeline. Native OAuth credentials are stored in `mcp-auth.json`.
71
+ - `defaultTools` now accepts `+name` and `-name` modifiers. Project modifier-only lists adjust the global selection instead of replacing it.
72
+ - Automatic model routing now includes GPT-6.1 Sol results from Artificial Analysis, FrontierCode, and OpenAI's published external benchmarks, preserving measured efforts and independent reporters. Metadata-backed Fast variants use base-model evidence without inventing separate Fast scores; independently registered Fast IDs require their own evidence.
73
+ - Completed `bash` commands now return bounded structured output for programmatic callers, including nonzero exits, without increasing model-facing output limits.
74
+ - Codex's automatic provider default is now GPT-6.1 Sol. Explicit saved model selections remain unchanged.
75
+ - Reduced transcript/footer and shell-preview rendering work in long sessions.
76
+ - Tool previews without custom renderers now show their arguments in collapsed and expanded views.
77
+ - `-fast` and `-ultrafast` choices for OpenAI and Codex models now follow the tiers each model advertises in Codex's catalog and on OpenAI's pricing page. Models without Fast, such as `gpt-5.3-codex-spark`, `openai/gpt-5-nano`, `openai/gpt-5-pro`, and `openai/o1`, no longer list a `-fast` choice. A tier the model doesn't advertise is left out of the request, which runs at standard processing.
78
+ - OpenAI and Codex Fast usage is priced at each model's published Fast rates instead of a flat 2x, for example 1.7x for GPT-4o. A Fast request that OpenAI serves at Standard is priced at Standard.
79
+
80
+ ### Fixed
81
+
82
+ - `/session` now shows current message counts, token totals, cost, and the correct session ID during an interactive run instead of displaying the previous turn's statistics or zero counts on the first run ([#3383](https://github.com/bastani-inc/atomic/issues/3383)).
83
+ - MCP OAuth rejects authorization responses from another issuer, including a missing `iss` when the server promises it under RFC 9207.
84
+ - MCP OAuth sign-in and refresh now tolerate empty or null optional token and registration fields, and empty requested scopes use the next scope source ([#10266](https://github.com/earendil-works/pi/issues/10266)).
85
+ - MCP sign-out no longer lets an in-progress OAuth refresh restore deleted credentials.
86
+ - Session shutdown now closes MCP connections that are still opening instead of leaving them running after the session ends.
87
+ - Replacing an extension-contributed MCP server now retires pending connections, and reloading with active servers no longer fails during connection cleanup.
88
+ - Malformed MCP configuration errors no longer quote file contents that may contain credentials.
89
+ - MCP OAuth refreshes authorization-server discovery when a server advertises a changed metadata URL.
90
+ - On a heavily loaded machine, a workflow run could fail with a bare `Query read timeout` while Atomic verified its managed PostgreSQL connection, even though the database was healthy. Health queries now get more time (3 s) on every path, and both the check of a borrowed connection and Atomic's periodic background health check repeat once after a timeout. If the timeout persists, the run fails with a resumable database-unavailable error instead of `Query read timeout`, and other running workflows' database connections are not closed and PostgreSQL is not restarted. A refused or terminated connection, a server shutdown, or a changed database identity is still treated as an outage.
91
+ - Renderer examples now retain the built-in tools' prompt guidance and execution behavior when customizing their display ([#10072](https://github.com/earendil-works/pi/issues/10072)).
92
+ - Reduced model lookup overhead when merging large remote provider catalogs.
93
+ - Invalid extension commands now fail registration with a clear error instead of crashing slash-command completion ([#10054](https://github.com/earendil-works/pi/issues/10054)).
94
+ - Codemode and tool-search descriptions now remain unchanged when deferred tools register, preserving prompt stability while discovery continues to find those tools ([#10212](https://github.com/earendil-works/pi/issues/10212)).
95
+ - Collapsed codemode scripts and results now limit wrapped screen lines, so long single-line JSON no longer fills the transcript. Bash previews use the same cached visual-line component.
96
+ - In `codemode.mode: "only"`, the system prompt's tool list no longer advertises tools whose direct declarations are hidden ([#10192](https://github.com/earendil-works/pi/issues/10192)).
97
+ - Fixed context overflow detection for Z.AI CN endpoint `Prompt exceeds max length` errors ([#10208](https://github.com/earendil-works/pi/issues/10208)).
98
+ - Anthropic tools with strict-schema constraints the provider rejects now fall back to non-strict mode when strict sampling is preferred ([#9953](https://github.com/earendil-works/pi/issues/9953)).
99
+ - Provider retries now use exponential backoff when `Retry-After` contains an unparseable date ([#9571](https://github.com/earendil-works/pi/issues/9571)).
100
+ - MCP sign-in URLs remain clickable when they wrap, including inside the `/mcp` panel ([#10186](https://github.com/earendil-works/pi/issues/10186)).
101
+ - MCP tool names now use JavaScript-safe identifiers with deterministic suffixes for collisions and long names, consistently across direct tools, gateway discovery, and codemode ([#10239](https://github.com/earendil-works/pi/issues/10239)).
102
+ - Codemode `image()` now rejects malformed base64 and unsupported image types before saving a tool result, and detects the MIME type from the image data instead of trusting the supplied type ([#10215](https://github.com/earendil-works/pi/issues/10215)).
103
+ - OpenAI's **Sign in with ChatGPT** login now shows a redirect-URL paste input, allowing authentication from remote machines without a reachable local browser callback.
104
+ - SDK-created sessions now discover package-provided workflows from their resource loader, including after workflow reload, while preserving project trust and custom loaders without workflow resources ([#3372](https://github.com/bastani-inc/atomic/issues/3372)).
105
+ - SDK-created sessions now retain package-contributed MCP servers when adding the shipped MCP extension to a custom resource loader ([#3372](https://github.com/bastani-inc/atomic/issues/3372)).
106
+ - Structured decisions and schema-backed workflow results now accept strict-provider null placeholders for omitted optional fields instead of exhausting output repairs. Explicitly nullable fields keep their null values, and required fields still enforce the original schema.
107
+ - Theme-colored notices now refresh after theme changes and late terminal color replies.
108
+ - llama.cpp unloaded autoload presets now retain their cached effective context size instead of falling back to the model's training limit.
109
+ - Native extension providers with stored credentials become available immediately after registration without exposing unrelated unauthenticated models.
110
+ - Cancelled tools no longer start queued native or nested sequential calls after cancellation.
111
+ - The interactive footer's context percentage, token, cost and cache-hit (`CH`) segments update after every message again, instead of only when a run ends. A new session no longer shows `0.0%` with no token or cost segments for its whole first run, and steered or long runs keep the footer current. The footer totals now include cache-warming requests, which `/session` already counts, and RPC `get_session_stats` responses report the newest reply's usage as `latestAssistantUsage` ([#3328](https://github.com/bastani-inc/atomic/issues/3328); [#3364](https://github.com/bastani-inc/atomic/pull/3364) by [@dairefagan](https://github.com/dairefagan)).
112
+
5
113
  ## [0.9.25-alpha.5] - 2026-09-30
6
114
 
7
115
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.9.25-alpha.5",
3
+ "version": "0.9.26-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic extension providing a private coordination channel between parent and child agent sessions. Fork of: https://github.com/nicobailon/pi-intercom",
6
6
  "contributors": [
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@bastani/atomic": "*",
47
- "@earendil-works/pi-tui": "^0.99.2",
47
+ "@earendil-works/pi-tui": "^1.0.0",
48
48
  "typebox": "*"
49
49
  },
50
50
  "peerDependenciesMeta": {
@@ -7,6 +7,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.9.25] - 2026-10-01
11
+
12
+ ### Breaking Changes
13
+
14
+ - Replaced the old adapter with the native client. Only `~/.atomic/agent/mcp.json` and trusted `.atomic/mcp.json` are read, using the native configuration shape. Shared config layers, client imports, and old-field translations are no longer supported; old OAuth credentials are not imported.
15
+ - Tools now use `mcp__<server>__<tool>` names and default to `codemode` exposure. The old gateway, configurable prefixes, lazy/idle lifecycle settings, metadata cache, SSE transport, MCP Apps rendering, and setup command are removed. Enabled servers connect in the background; `/mcp reconnect` without a name selects one server rather than reconnecting all servers.
16
+
17
+ ### Added
18
+
19
+ - Set `oauth.authServerMetadataUrl` to use a trusted authorization server metadata document instead of discovery when an MCP server advertises the wrong authorization server or none ([#10172](https://github.com/earendil-works/pi/issues/10172)).
20
+ - Added `/mcp login [server]`, completion and optional server selection for login/logout/reconnect, and a server manager with enabled-state and exposure menus. Sign-in accepts pasted remote-browser redirect URLs.
21
+ - Added native tool exposure modes and per-tool patterns, standard resource list/read tools, and per-server OAuth `callbackPort` and `callbackUrl`.
22
+ - Added shell commands `atomic mcp add`, `remove`, `list`, `login`, and `logout` to configure, check, and authenticate file-configured servers without starting a session.
23
+ - Set `oauth.clientName` to choose the client name sent during dynamic OAuth registration. The default is `atomic` ([#10226](https://github.com/earendil-works/pi/issues/10226)).
24
+ - HTTP MCP servers can set `"auth": { "provider": "<provider>" }` to send the current `/login` token of a provider as the bearer token instead of using MCP OAuth. The token is read for every request and is never stored by MCP. It is accepted only from the global `mcp.json` and extension registrations, requires `https` except on `localhost`, `127.0.0.1`, and `[::1]`, and is sent only to the server's origin.
25
+
26
+ ### Changed
27
+
28
+ - Adopted pi's native MCP client, tool exposure, resources, and server manager. Calls, including codemode calls, use Atomic's permission pipeline. Native OAuth credentials are stored in `mcp-auth.json`.
29
+ - MCP tool previews now show arguments in collapsed and expanded views while redacting sensitive argument fields.
30
+
31
+ ### Fixed
32
+
33
+ - OAuth authorization codes are rejected before exchange when the response's `iss` names another issuer, or is missing when the authorization server promises it under RFC 9207.
34
+ - Empty or null optional OAuth token and client registration fields now count as absent. Refresh responses retain the previous refresh token when the new one is empty, and `expires_in: null` no longer immediately expires a token ([#10266](https://github.com/earendil-works/pi/issues/10266)).
35
+ - Empty OAuth scopes fall through to the configured scope instead of overriding it.
36
+ - Tool and resource listing now accepts an empty or null final pagination cursor ([#10266](https://github.com/earendil-works/pi/issues/10266)).
37
+ - Sign-out no longer lets an in-progress OAuth refresh restore deleted credentials.
38
+ - Session shutdown now closes MCP connections that are still opening instead of leaving them running after the session ends.
39
+ - Replacing or unregistering an extension-contributed server now retires its pending connection without leaving a detached transport running.
40
+ - Reloading a session with active MCP servers no longer fails during cleanup of the old connections.
41
+ - OAuth refreshes discovery when a server advertises a changed metadata URL instead of retaining the previous authorization server.
42
+ - MCP sign-in now displays a clickable terminal hyperlink and a Cmd/Ctrl+click hint, including when the authorization URL wraps across lines ([#10186](https://github.com/earendil-works/pi/issues/10186)).
43
+ - MCP tool names now use JavaScript-safe identifiers. Tools whose names sanitize to the same identifier all receive deterministic hash suffixes, preventing codemode calls from reaching the wrong tool. Server names that differ only in `-` and `_` conflict ([#10239](https://github.com/earendil-works/pi/issues/10239)).
44
+ - Cached MCP tools now reconnect after `/login <provider>` when a provider-authenticated server needs sign-in, without requiring `/mcp reconnect`.
45
+ - Concurrent Atomic processes now coordinate rotating OAuth refresh tokens, reusing the refreshed credential rather than independently rotating the same token.
46
+ - Stalled OAuth refresh requests now time out after 15 seconds, including response-body reads, so connection shutdown can finish and release the refresh lock.
47
+
10
48
  ## [0.9.25-alpha.4] - 2026-09-30
11
49
 
12
50
  ### Breaking Changes
@@ -75,7 +75,7 @@ An authorization response's `iss` must name the flow's authorization server. If
75
75
 
76
76
  ## Tokens and refresh
77
77
 
78
- Credentials are stored in `~/.atomic/agent/mcp-auth.json`, keyed by server URL. `ATOMIC_CODING_AGENT_DIR` relocates the agent directory. Tokens refresh when expired or rejected, and signing out removes the stored credentials.
78
+ Credentials are stored in `~/.atomic/agent/mcp-auth.json`, keyed by server name and URL. A URL-only entry from an older version moves to the first server that loads it. `ATOMIC_CODING_AGENT_DIR` relocates the agent directory. Tokens refresh when expired or rejected, and signing out removes the stored credentials.
79
79
 
80
80
  Optional OAuth response fields that are empty or null count as absent, including `scope`, `refresh_token`, `id_token`, and `client_secret`. A refresh response with no new refresh token keeps the previous one. `expires_in: null` does not immediately expire an access token. Empty scope values fall through to the next scope source.
81
81
 
@@ -1,6 +1,6 @@
1
1
  This directory vendors packages/mcp/src from earendil-works/pi at commit
2
- 8ce69e9d2b171d173fe4b6b2b6256f1f4411e69d:
3
- https://github.com/earendil-works/pi/tree/8ce69e9d2b171d173fe4b6b2b6256f1f4411e69d/packages/mcp
2
+ e529a82c98fad679c6e20c03ffbb0bc7896fecb9:
3
+ https://github.com/earendil-works/pi/tree/e529a82c98fad679c6e20c03ffbb0bc7896fecb9/packages/mcp
4
4
 
5
5
  Relative TypeScript imports use .js extensions for Atomic's compiled package.
6
6
  Atomic patches OAuth discovery to refresh changed authorization-server metadata.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/mcp",
3
- "version": "0.9.25-alpha.5",
3
+ "version": "0.9.26-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic's pi-compatible MCP integration for server connections, OAuth, tools, resources, and terminal management.",
6
6
  "contributors": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.9.25-alpha.5",
3
+ "version": "0.9.26-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic extension for delegating tasks to subagents with parallel execution. Fork of: https://github.com/nicobailon/pi-subagents",
6
6
  "contributors": [
@@ -35,8 +35,8 @@
35
35
  "peerDependencies": {
36
36
  "@bastani/atomic": "*",
37
37
  "@bastani/pi-ai": "*",
38
- "@earendil-works/pi-agent-core": "^0.99.2",
39
- "@earendil-works/pi-tui": "^0.99.2",
38
+ "@earendil-works/pi-agent-core": "^1.0.0",
39
+ "@earendil-works/pi-tui": "^1.0.0",
40
40
  "typebox": "*"
41
41
  },
42
42
  "peerDependenciesMeta": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.9.25-alpha.5",
3
+ "version": "0.9.26-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
6
6
  "contributors": [
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@bastani/atomic": "*",
34
- "@earendil-works/pi-tui": "^0.99.2"
34
+ "@earendil-works/pi-tui": "^1.0.0"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@bastani/atomic": {
@@ -6,6 +6,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.9.26-alpha.1] - 2026-10-01
10
+
11
+ ### Fixed
12
+
13
+ - Fixed workflow-stage `ask_user_question` questions never reaching an SDK host's `HostInput` when the stage was already awaiting input, which left the run waiting indefinitely ([#3396](https://github.com/bastani-inc/atomic/issues/3396)).
14
+
15
+ ## [0.9.25] - 2026-10-01
16
+
17
+ ### Added
18
+
19
+ - `pause`, `quit` and `resume` results from the `workflow` tool now carry a machine-readable `code` (`run_not_found`, `not_resumable`, `owned_elsewhere`, `database_unavailable`, `stage_not_found`, `stage_ambiguous`, `stage_resume_unsupported` or `control_failed`) when the request could not be carried out, so SDK hosts using `session.workflows` receive typed errors. Resuming a run that is executing in another live Atomic process now reports `owned_elsewhere` instead of `not_resumable`. Pausing or quitting, by full run id, a run owned by another session or executing in another live Atomic process now reports `owned_elsewhere` instead of `Run not found`. Pausing or resuming a stage that does not exist or matches several stages, and resuming a single stage of a durable run, now report `stage_not_found`, `stage_ambiguous` or `stage_resume_unsupported` instead of an uncoded no-op ([#3377](https://github.com/bastani-inc/atomic/issues/3377)).
20
+ - Added an official-source GPT-6.1 Sol reference to the prompt-engineering skill, with supported-effort migration guidance and selective use of shared templates whose behavior was observed on Astra.
21
+
22
+ ### Fixed
23
+
24
+ - Pausing a run whose only active stage is waiting for human input now marks the run paused instead of rejecting with `no_active_stages`. An already-open question stays open, questions not yet shown wait until resume, and hosts can hold answers until they resume the run ([#3391](https://github.com/bastani-inc/atomic/issues/3391)).
25
+ - `pause` and `quit` with `all: true` no longer report success when some runs could not be stopped. The result is `partial` only when that call stopped at least one run and others are still active, and a `noop` with `control_failed` when active runs could not be stopped and the call stopped none, even if other runs were already paused. Either result lists each failed run id and reason in the message and in a `failedRuns` list. Runs that are already paused or already ended are not failures, and a batch with nothing left to stop is a benign `noop`. `/workflow pause --all` now names runs that failed to pause instead of reporting them as paused or as "No in-flight runs to pause", and reports an error when it stopped no run. Any failure while inspecting the database to pause or quit an unknown full run id now returns a structured `database_unavailable` result instead of throwing or a generic `control_failed` ([#3377](https://github.com/bastani-inc/atomic/issues/3377)).
26
+ - On a heavily loaded machine, a workflow run could fail with a bare `Query read timeout` while Atomic verified its managed PostgreSQL connection, even though the database was healthy. Health queries now get more time (3 s) on every path, and both the check of a borrowed connection and Atomic's periodic background health check repeat once after a timeout. If the timeout persists, the run fails with a resumable database-unavailable error instead of `Query read timeout`, and other running workflows' database connections are not closed and PostgreSQL is not restarted. A refused or terminated connection, a server shutdown, or a changed database identity is still treated as an outage.
27
+ - Fixed a workflow run resumed right after it was paused failing with `Workflow database admission timed out`. A pause or resume now waits for the control write already in flight instead of cancelling it mid-write, which could leave the run's database claim stuck and stall every later pause, resume, or quit on that run until the admission timeout ([#3377](https://github.com/bastani-inc/atomic/issues/3377)).
28
+
9
29
  ## [0.9.25-alpha.5] - 2026-09-30
10
30
 
11
31
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.9.25-alpha.5",
3
+ "version": "0.9.26-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [
@@ -85,7 +85,7 @@
85
85
  },
86
86
  "peerDependencies": {
87
87
  "@bastani/atomic": "*",
88
- "@earendil-works/pi-tui": "^0.99.2",
88
+ "@earendil-works/pi-tui": "^1.0.0",
89
89
  "typebox": "*"
90
90
  },
91
91
  "peerDependenciesMeta": {
@@ -77250,6 +77250,7 @@ class StageUiBroker {
77250
77250
  adapters = new Map;
77251
77251
  resolvedPromptIds = new Map;
77252
77252
  resolvedListeners = new Set;
77253
+ registeredListeners = new Set;
77253
77254
  constructor(store = currentWorkflowStore()) {
77254
77255
  this.store = store;
77255
77256
  }
@@ -77314,6 +77315,19 @@ class StageUiBroker {
77314
77315
  this.resolvedListeners.delete(listener);
77315
77316
  };
77316
77317
  }
77318
+ onStageRequestRegistered(listener) {
77319
+ this.registeredListeners.add(listener);
77320
+ return () => {
77321
+ this.registeredListeners.delete(listener);
77322
+ };
77323
+ }
77324
+ notifyStageRequestRegistered() {
77325
+ for (const listener of this.registeredListeners) {
77326
+ try {
77327
+ listener();
77328
+ } catch {}
77329
+ }
77330
+ }
77317
77331
  notifyStagePromptAnswered(event) {
77318
77332
  for (const listener of this.resolvedListeners) {
77319
77333
  try {
@@ -77386,6 +77400,7 @@ class StageUiBroker {
77386
77400
  const host = this.hosts.get(hostKey);
77387
77401
  if (host)
77388
77402
  this.showHostOrReject(host, request);
77403
+ this.notifyStageRequestRegistered();
77389
77404
  if (signal?.aborted)
77390
77405
  onAbort();
77391
77406
  return promise.finally(() => {
@@ -116590,11 +116605,13 @@ function bindWorkflowHumanInput(store, ctx, stageUiBroker = currentStageUiBroker
116590
116605
  }
116591
116606
  };
116592
116607
  const unsubscribe = store.subscribeInvalidation(refresh);
116608
+ const unsubscribeRegistered = stageUiBroker.onStageRequestRegistered(refresh);
116593
116609
  const unsubscribeBinding = ownerInput?.subscribe(bindingChanged);
116594
116610
  refresh();
116595
116611
  return () => {
116596
116612
  disposed = true;
116597
116613
  unsubscribe();
116614
+ unsubscribeRegistered();
116598
116615
  unsubscribeBinding?.();
116599
116616
  for (const unsubscribe of childSubscriptions.values())
116600
116617
  unsubscribe();
@@ -33819,6 +33819,7 @@ class StageUiBroker {
33819
33819
  adapters = new Map;
33820
33820
  resolvedPromptIds = new Map;
33821
33821
  resolvedListeners = new Set;
33822
+ registeredListeners = new Set;
33822
33823
  constructor(store = currentWorkflowStore()) {
33823
33824
  this.store = store;
33824
33825
  }
@@ -33883,6 +33884,19 @@ class StageUiBroker {
33883
33884
  this.resolvedListeners.delete(listener);
33884
33885
  };
33885
33886
  }
33887
+ onStageRequestRegistered(listener) {
33888
+ this.registeredListeners.add(listener);
33889
+ return () => {
33890
+ this.registeredListeners.delete(listener);
33891
+ };
33892
+ }
33893
+ notifyStageRequestRegistered() {
33894
+ for (const listener of this.registeredListeners) {
33895
+ try {
33896
+ listener();
33897
+ } catch {}
33898
+ }
33899
+ }
33886
33900
  notifyStagePromptAnswered(event) {
33887
33901
  for (const listener of this.resolvedListeners) {
33888
33902
  try {
@@ -33955,6 +33969,7 @@ class StageUiBroker {
33955
33969
  const host = this.hosts.get(hostKey);
33956
33970
  if (host)
33957
33971
  this.showHostOrReject(host, request);
33972
+ this.notifyStageRequestRegistered();
33958
33973
  if (signal?.aborted)
33959
33974
  onAbort();
33960
33975
  return promise.finally(() => {
package/dist/cli/args.js CHANGED
@@ -261,7 +261,7 @@ ${chalk.bold("Commands:")}
261
261
  ${APP_NAME} <command> --help Show help for install/remove/uninstall/update/list/config/auth/mcp
262
262
 
263
263
  ${chalk.bold("Options:")}
264
- --provider <name> Provider name (default: google)
264
+ --provider <name> Provider to search for --model (requires --model)
265
265
  --model <pattern> Model pattern or ID (supports "provider/id" and optional ":<thinking>")
266
266
  --api-key <key> API key (defaults to env vars)
267
267
  --system-prompt <text> System prompt (default: coding assistant prompt)
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACN,QAAQ,EACR,eAAe,EACf,aAAa,EACb,WAAW,EACX,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,aAAa,GACb,MAAM,cAAc,CAAC;AAmDtB,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAEnG,MAAM,UAAU,oBAAoB,CAAC,KAAa;IACjD,OAAO,qBAAqB,CAAC,QAAQ,CAAC,KAAsB,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mCAAmC,CAAC,IAAc,EAAE,MAAgB;IACnF,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,MA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ACtC,QAAQ;;EAEV,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyClC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,mCAAmC,eAAe;IAC1E,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1B,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1B,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;IACtB,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;;;EAGjC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC;;;;;;;;;;;CAWnC,CAAC,CAAC;AACH,CAAC","sourcesContent":["/**\n * CLI argument parsing and help display\n */\n\nimport type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport chalk from \"chalk\";\nimport {\n\tAPP_NAME,\n\tCONFIG_DIR_NAME,\n\tENV_AGENT_DIR,\n\tENV_OFFLINE,\n\tENV_PACKAGE_DIR,\n\tENV_SESSION_DIR,\n\tENV_SHARE_VIEWER_URL,\n\tENV_TELEMETRY,\n} from \"../config.js\";\nimport type { ExtensionFlag } from \"../core/extensions/types.ts\";\n\nexport type Mode = \"text\" | \"json\" | \"rpc\";\n\nexport interface Args {\n\tprovider?: string;\n\tmodel?: string;\n\tapiKey?: string;\n\tsystemPrompt?: string;\n\tappendSystemPrompt?: string[];\n\tthinking?: ThinkingLevel;\n\tcontinue?: boolean;\n\tresume?: boolean;\n\thelp?: boolean;\n\tversion?: boolean;\n\tmode?: Mode;\n\tname?: string;\n\tnoSession?: boolean;\n\tsession?: string;\n\tsessionId?: string;\n\tfork?: string;\n\tsessionDir?: string;\n\tmodels?: string[];\n\ttools?: string[];\n\texcludeTools?: string[];\n\tnoTools?: boolean;\n\tnoBuiltinTools?: boolean;\n\textensions?: string[];\n\tnoExtensions?: boolean;\n\tprint?: boolean;\n\texport?: string;\n\tnoSkills?: boolean;\n\tskills?: string[];\n\tpromptTemplates?: string[];\n\tnoPromptTemplates?: boolean;\n\tthemes?: string[];\n\tuseTheme?: string;\n\tnoThemes?: boolean;\n\tnoContextFiles?: boolean;\n\tlistModels?: string | true;\n\toffline?: boolean;\n\tverbose?: boolean;\n\tprojectTrustOverride?: boolean;\n\tmessages: string[];\n\tfileArgs: string[];\n\t/** Unknown flags (potentially extension flags) - map of flag name to value */\n\tunknownFlags: Map<string, boolean | string>;\n\tdiagnostics: Array<{ type: \"warning\" | \"error\"; message: string }>;\n}\n\nconst VALID_THINKING_LEVELS = [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const;\n\nexport function isValidThinkingLevel(level: string): level is ThinkingLevel {\n\treturn VALID_THINKING_LEVELS.includes(level as ThinkingLevel);\n}\n\n/**\n * Insert forced option arguments (e.g. a dedicated entry point's `--mode rpc`)\n * immediately before the first `--` end-of-options terminator, or append them\n * when no terminator is present. Keeps the forced options parsed as options\n * (never literal message text) while preserving last-option-wins semantics,\n * since caller options can only appear before the terminator.\n */\nexport function insertForcedOptionsBeforeTerminator(args: string[], forced: string[]): string[] {\n\tconst terminatorIndex = args.indexOf(\"--\");\n\tconst insertAt = terminatorIndex === -1 ? args.length : terminatorIndex;\n\treturn [...args.slice(0, insertAt), ...forced, ...args.slice(insertAt)];\n}\n\nexport function parseArgs(args: string[]): Args {\n\tconst result: Args = {\n\t\tmessages: [],\n\t\tfileArgs: [],\n\t\tunknownFlags: new Map(),\n\t\tdiagnostics: [],\n\t};\n\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i];\n\n\t\tif (arg === \"--\") {\n\t\t\tresult.messages.push(...args.slice(i + 1));\n\t\t\tbreak;\n\t\t}\n\n\t\tif (arg === \"--help\" || arg === \"-h\") {\n\t\t\tresult.help = true;\n\t\t} else if (arg === \"--version\" || arg === \"-v\") {\n\t\t\tresult.version = true;\n\t\t} else if (arg === \"--mode\") {\n\t\t\tconst mode = args[i + 1];\n\t\t\tif (mode === undefined || mode.startsWith(\"-\")) {\n\t\t\t\tresult.diagnostics.push({ type: \"error\", message: \"--mode requires text, json, or rpc\" });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ti++;\n\t\t\tif (mode !== \"text\" && mode !== \"json\" && mode !== \"rpc\") {\n\t\t\t\tresult.diagnostics.push({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\tmessage: `Invalid mode \"${mode}\". Valid values: text, json, rpc`,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tresult.mode = mode;\n\t\t} else if (arg === \"--continue\" || arg === \"-c\") {\n\t\t\tresult.continue = true;\n\t\t} else if (arg === \"--resume\" || arg === \"-r\") {\n\t\t\tresult.resume = true;\n\t\t} else if (arg === \"--provider\" && i + 1 < args.length) {\n\t\t\tresult.provider = args[++i];\n\t\t} else if (arg === \"--model\" && i + 1 < args.length) {\n\t\t\tresult.model = args[++i];\n\t\t} else if (arg === \"--api-key\" && i + 1 < args.length) {\n\t\t\tresult.apiKey = args[++i];\n\t\t} else if (arg === \"--system-prompt\" && i + 1 < args.length) {\n\t\t\tresult.systemPrompt = args[++i];\n\t\t} else if (arg === \"--append-system-prompt\" && i + 1 < args.length) {\n\t\t\tresult.appendSystemPrompt = result.appendSystemPrompt ?? [];\n\t\t\tresult.appendSystemPrompt.push(args[++i]);\n\t\t} else if (arg === \"--name\" || arg === \"-n\") {\n\t\t\tif (i + 1 < args.length) {\n\t\t\t\tresult.name = args[++i];\n\t\t\t} else {\n\t\t\t\tresult.diagnostics.push({ type: \"error\", message: \"--name requires a value\" });\n\t\t\t}\n\t\t} else if (arg === \"--no-session\") {\n\t\t\tresult.noSession = true;\n\t\t} else if (arg === \"--session\" && i + 1 < args.length) {\n\t\t\tresult.session = args[++i];\n\t\t} else if (arg === \"--session-id\" && i + 1 < args.length) {\n\t\t\tresult.sessionId = args[++i];\n\t\t} else if (arg === \"--fork\" && i + 1 < args.length) {\n\t\t\tresult.fork = args[++i];\n\t\t} else if (arg === \"--session-dir\" && i + 1 < args.length) {\n\t\t\tresult.sessionDir = args[++i];\n\t\t} else if (arg === \"--models\" && i + 1 < args.length) {\n\t\t\tresult.models = args[++i].split(\",\").map((s) => s.trim());\n\t\t} else if (arg === \"--no-tools\" || arg === \"-nt\") {\n\t\t\tresult.noTools = true;\n\t\t} else if (arg === \"--no-builtin-tools\" || arg === \"-nbt\") {\n\t\t\tresult.noBuiltinTools = true;\n\t\t} else if ((arg === \"--tools\" || arg === \"-t\") && i + 1 < args.length) {\n\t\t\tresult.tools = args[++i]\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((s) => s.trim())\n\t\t\t\t.filter((name) => name.length > 0);\n\t\t} else if ((arg === \"--exclude-tools\" || arg === \"-xt\") && i + 1 < args.length) {\n\t\t\tresult.excludeTools = args[++i]\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((s) => s.trim())\n\t\t\t\t.filter((name) => name.length > 0);\n\t\t} else if (arg === \"--thinking\" && i + 1 < args.length) {\n\t\t\tconst level = args[++i];\n\t\t\tif (isValidThinkingLevel(level)) {\n\t\t\t\tresult.thinking = level;\n\t\t\t} else {\n\t\t\t\tresult.diagnostics.push({\n\t\t\t\t\ttype: \"warning\",\n\t\t\t\t\tmessage: `Invalid thinking level \"${level}\". Valid values: ${VALID_THINKING_LEVELS.join(\", \")}`,\n\t\t\t\t});\n\t\t\t}\n\t\t} else if (arg === \"--print\" || arg === \"-p\") {\n\t\t\tresult.print = true;\n\t\t\tconst next = args[i + 1];\n\t\t\tif (next !== undefined && !next.startsWith(\"@\") && (!next.startsWith(\"-\") || next.startsWith(\"---\"))) {\n\t\t\t\tresult.messages.push(next);\n\t\t\t\ti++;\n\t\t\t}\n\t\t} else if (arg === \"--export\" && i + 1 < args.length) {\n\t\t\tresult.export = args[++i];\n\t\t} else if ((arg === \"--extension\" || arg === \"-e\") && i + 1 < args.length) {\n\t\t\tresult.extensions = result.extensions ?? [];\n\t\t\tresult.extensions.push(args[++i]);\n\t\t} else if (arg === \"--no-extensions\" || arg === \"-ne\") {\n\t\t\tresult.noExtensions = true;\n\t\t} else if (arg === \"--skill\" && i + 1 < args.length) {\n\t\t\tresult.skills = result.skills ?? [];\n\t\t\tresult.skills.push(args[++i]);\n\t\t} else if (arg === \"--prompt-template\" && i + 1 < args.length) {\n\t\t\tresult.promptTemplates = result.promptTemplates ?? [];\n\t\t\tresult.promptTemplates.push(args[++i]);\n\t\t} else if (arg === \"--theme\" && i + 1 < args.length) {\n\t\t\tresult.themes = result.themes ?? [];\n\t\t\tresult.themes.push(args[++i]);\n\t\t} else if (arg === \"--use-theme\") {\n\t\t\tconst themeName = args[i + 1];\n\t\t\tif (themeName === undefined || themeName.startsWith(\"-\")) {\n\t\t\t\tresult.diagnostics.push({ type: \"error\", message: \"--use-theme requires a theme name\" });\n\t\t\t} else {\n\t\t\t\tresult.useTheme = themeName;\n\t\t\t\ti++;\n\t\t\t}\n\t\t} else if (arg === \"--no-skills\" || arg === \"-ns\") {\n\t\t\tresult.noSkills = true;\n\t\t} else if (arg === \"--no-prompt-templates\" || arg === \"-np\") {\n\t\t\tresult.noPromptTemplates = true;\n\t\t} else if (arg === \"--no-themes\") {\n\t\t\tresult.noThemes = true;\n\t\t} else if (arg === \"--no-context-files\" || arg === \"-nc\") {\n\t\t\tresult.noContextFiles = true;\n\t\t} else if (arg === \"--list-models\") {\n\t\t\t// Check if next arg is a search pattern (not a flag or file arg)\n\t\t\tif (i + 1 < args.length && !args[i + 1].startsWith(\"-\") && !args[i + 1].startsWith(\"@\")) {\n\t\t\t\tresult.listModels = args[++i];\n\t\t\t} else {\n\t\t\t\tresult.listModels = true;\n\t\t\t}\n\t\t} else if (arg === \"--verbose\") {\n\t\t\tresult.verbose = true;\n\t\t} else if (arg === \"--approve\" || arg === \"-a\") {\n\t\t\tresult.projectTrustOverride = true;\n\t\t} else if (arg === \"--no-approve\" || arg === \"-na\") {\n\t\t\tresult.projectTrustOverride = false;\n\t\t} else if (arg === \"--offline\") {\n\t\t\tresult.offline = true;\n\t\t} else if (arg.startsWith(\"@\")) {\n\t\t\tresult.fileArgs.push(arg.slice(1)); // Remove @ prefix\n\t\t} else if (arg.startsWith(\"--\")) {\n\t\t\tconst eqIndex = arg.indexOf(\"=\");\n\t\t\tif (eqIndex !== -1) {\n\t\t\t\tresult.unknownFlags.set(arg.slice(2, eqIndex), arg.slice(eqIndex + 1));\n\t\t\t} else {\n\t\t\t\tconst flagName = arg.slice(2);\n\t\t\t\tconst next = args[i + 1];\n\t\t\t\tif (next !== undefined && !next.startsWith(\"-\") && !next.startsWith(\"@\")) {\n\t\t\t\t\tresult.unknownFlags.set(flagName, next);\n\t\t\t\t\ti++;\n\t\t\t\t} else {\n\t\t\t\t\tresult.unknownFlags.set(flagName, true);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (arg.startsWith(\"-\") && !arg.startsWith(\"--\")) {\n\t\t\tresult.diagnostics.push({ type: \"error\", message: `Unknown option: ${arg}` });\n\t\t} else if (!arg.startsWith(\"-\")) {\n\t\t\tresult.messages.push(arg);\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function printHelp(extensionFlags?: ExtensionFlag[]): void {\n\tconst extensionFlagsText =\n\t\textensionFlags && extensionFlags.length > 0\n\t\t\t? `\\n${chalk.bold(\"Extension CLI Flags:\")}\\n${extensionFlags\n\t\t\t\t\t.map((flag) => {\n\t\t\t\t\t\tconst value = flag.type === \"string\" ? \" <value>\" : \"\";\n\t\t\t\t\t\tconst description = flag.description ?? `Registered by ${flag.extensionPath}`;\n\t\t\t\t\t\treturn ` --${flag.name}${value}`.padEnd(30) + description;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\"\\n\")}\\n`\n\t\t\t: \"\";\n\tconsole.log(`${chalk.bold(APP_NAME)} - AI coding assistant with read, bash, edit, write, find, search, ask_user_question, todo tools\n\n${chalk.bold(\"Usage:\")}\n ${APP_NAME} [options] [--] [@files...] [messages...]\n\n${chalk.bold(\"Commands:\")}\n ${APP_NAME} install <source> [-l] Install extension source and add to settings\n ${APP_NAME} remove <source> [-l] Remove extension source from settings\n ${APP_NAME} uninstall <source> [-l] Alias for remove\n ${APP_NAME} update [source|self|${APP_NAME}] [--all] Update ${APP_NAME} (use --all for ${APP_NAME} and extensions)\n ${APP_NAME} list List installed extensions from settings\n ${APP_NAME} config [-l] Open resource TUI (Tab switches global/project scope)\n ${APP_NAME} auth <command> Print credentials or check provider readiness\n ${APP_NAME} mcp <command> Configure MCP servers, check connections, and sign in\n ${APP_NAME} <command> --help Show help for install/remove/uninstall/update/list/config/auth/mcp\n\n${chalk.bold(\"Options:\")}\n --provider <name> Provider name (default: google)\n --model <pattern> Model pattern or ID (supports \"provider/id\" and optional \":<thinking>\")\n --api-key <key> API key (defaults to env vars)\n --system-prompt <text> System prompt (default: coding assistant prompt)\n --append-system-prompt <text> Append text or file contents to the system prompt (can be used multiple times)\n --mode <mode> Output mode: text (default), json, or rpc\n --print, -p Non-interactive mode: process prompt and exit\n --continue, -c Continue previous session\n --resume, -r Select a session to resume\n --session <path|id> Use file, exact ID, or unique 8-hex UUID prefix\n --session-id <id> Use exact project session ID, creating it if missing\n --fork <path|id> Fork file, exact ID, or unique 8-hex UUID prefix into a new session\n --session-dir <dir> Directory for session storage and lookup\n --no-session Don't save session (ephemeral)\n --name, -n <name> Set session display name\n --models <patterns> Comma-separated model patterns for ctrl+p cycling\n Supports globs (anthropic/*, *sonnet*) and fuzzy matching\n --no-tools, -nt Disable every tool except mandatory ordinary intercom\n --no-builtin-tools, -nbt Disable built-in tools by default but keep extension/custom tools enabled\n --tools, -t <tools> Comma-separated allowlist of non-mandatory tool names\n Mandatory ordinary intercom remains available\n --exclude-tools, -xt <tools> Comma-separated denylist of non-mandatory tool names\n Mandatory ordinary intercom cannot be excluded\n --thinking <level> Set thinking level: off, minimal, low, medium, high, xhigh, max\n --extension, -e <path> Load an extension file (can be used multiple times)\n --no-extensions, -ne Disable optional extension discovery; mandatory bundled Intercom remains loaded\n --skill <path> Load a skill file or directory (can be used multiple times)\n --no-skills, -ns Disable skills discovery and loading\n --prompt-template <path> Load a prompt template file or directory (can be used multiple times)\n --no-prompt-templates, -np Disable prompt template discovery and loading\n --theme <path> Load a theme file or directory (can be used multiple times)\n --use-theme <name[/name]> Set the interactive theme for this run without saving it\n --no-themes Disable theme discovery and loading\n --no-context-files, -nc Disable context-file discovery and loading\n --export <file> Export session file to HTML and exit\n --list-models [search] List available models (with optional fuzzy search)\n --verbose Force verbose startup (overrides quietStartup setting)\n --approve, -a Trust project-local files for this run\n --no-approve, -na Ignore project-local files for this run\n --offline Disable startup network operations (same as ${ENV_OFFLINE}=1)\n -- End option parsing; treat remaining arguments as messages/files\n --help, -h Show this help\n --version, -v Show version number\n\nExtensions can register additional flags (e.g., --plan from plan-mode extension).${extensionFlagsText}\n\n${chalk.bold(\"Examples:\")}\n # Print a provider API key for an external client\n ${APP_NAME} auth print-api-key --model gpt-5.5 --provider openai\n\n # Check configured provider readiness before starting a session\n ${APP_NAME} auth check --provider openai\n\n # Print an OAuth bearer token, refreshing it when under the minimum expiry\n ${APP_NAME} auth print-bearer-token --model gpt-5.5 --provider openai-codex --min-expiry 30m\n\n # Interactive mode\n ${APP_NAME}\n\n # Interactive mode with initial prompt\n ${APP_NAME} \"List all .ts files in src/\"\n\n # Include files in initial message\n ${APP_NAME} @prompt.md @image.png \"What color is the sky?\"\n\n # Non-interactive mode (process and exit)\n ${APP_NAME} -p \"List all .ts files in src/\"\n\n # Prompt beginning with a dash\n ${APP_NAME} -p -- \"- Summarize these points\"\n\n # Multiple messages (interactive)\n ${APP_NAME} \"Read package.json\" \"What dependencies do we have?\"\n\n # Continue previous session\n ${APP_NAME} --continue \"What did we discuss?\"\n\n # Start a named session\n ${APP_NAME} --name \"Refactor auth module\"\n\n # Use different model\n ${APP_NAME} --provider openai --model gpt-4o-mini \"Help me refactor this code\"\n\n # Use model with provider prefix (no --provider needed)\n ${APP_NAME} --model openai/gpt-4o \"Help me refactor this code\"\n\n # Use model with thinking level shorthand\n ${APP_NAME} --model sonnet:high \"Solve this complex problem\"\n\n # Limit model cycling to specific models\n ${APP_NAME} --models claude-sonnet,claude-haiku,gpt-4o\n\n # Limit to a specific provider with glob pattern\n ${APP_NAME} --models \"github-copilot/*\"\n\n # Cycle models with fixed thinking levels\n ${APP_NAME} --models sonnet:high,haiku:low\n\n # Start with a specific thinking level\n ${APP_NAME} --thinking high \"Solve this complex problem\"\n\n # Read-only mode (no file modifications possible)\n ${APP_NAME} --tools read,search,find,ls -p \"Review the code in src/\"\n\n # Disable one tool while keeping the rest available\n ${APP_NAME} --exclude-tools ask_user_question\n\n # Export a session file to HTML\n ${APP_NAME} --export ~/${CONFIG_DIR_NAME}/agent/sessions/--path--/session.jsonl\n ${APP_NAME} --export session.jsonl output.html\n\n${chalk.bold(\"Environment Variables:\")}\n ANTHROPIC_AUTH_TOKEN - Anthropic bearer auth token\n ANTHROPIC_API_KEY - Anthropic Claude API key\n ANTHROPIC_OAUTH_TOKEN - Anthropic OAuth token (alternative to API key)\n OPENAI_API_KEY - OpenAI GPT API key\n AZURE_OPENAI_API_KEY - Azure OpenAI API key\n AZURE_OPENAI_BASE_URL - Azure OpenAI/Cognitive Services base URL (e.g. https://{resource}.openai.azure.com)\n AZURE_OPENAI_RESOURCE_NAME - Azure OpenAI resource name (alternative to base URL)\n AZURE_OPENAI_API_VERSION - Azure OpenAI API version (default: v1)\n AZURE_OPENAI_DEPLOYMENT_NAME_MAP - Azure OpenAI model=deployment map (comma-separated)\n DEEPSEEK_API_KEY - DeepSeek API key\n GEMINI_API_KEY - Google Gemini API key\n GROQ_API_KEY - Groq API key\n CEREBRAS_API_KEY - Cerebras API key\n XAI_API_KEY - xAI Grok API key\n FIREWORKS_API_KEY - Fireworks API key\n TOGETHER_API_KEY - Together AI API key\n BASETEN_API_KEY - Baseten API key\n OPENROUTER_API_KEY - OpenRouter API key\n AI_GATEWAY_API_KEY - Vercel AI Gateway API key\n ZAI_API_KEY - ZAI API key\n MISTRAL_API_KEY - Mistral API key\n MINIMAX_API_KEY - MiniMax API key\n MOONSHOT_API_KEY - Moonshot AI API key\n OPENCODE_API_KEY - OpenCode Zen/OpenCode Go API key\n KIMI_API_KEY - Kimi For Coding API key\n META_API_KEY - Meta Model API key\n CLOUDFLARE_API_KEY - Cloudflare API token (Workers AI and AI Gateway)\n CLOUDFLARE_ACCOUNT_ID - Cloudflare account id (required for both)\n CLOUDFLARE_GATEWAY_ID - Cloudflare AI Gateway slug (required for AI Gateway)\n QWEN_TOKEN_PLAN_API_KEY - Qwen Token Plan API key (international region)\n QWEN_TOKEN_PLAN_CN_API_KEY - Qwen Token Plan API key (China region)\n XIAOMI_API_KEY - Xiaomi MiMo API key (api.xiaomimimo.com billing)\n XIAOMI_TOKEN_PLAN_CN_API_KEY - Xiaomi MiMo Token Plan API key (China region)\n XIAOMI_TOKEN_PLAN_AMS_API_KEY - Xiaomi MiMo Token Plan API key (Amsterdam region)\n XIAOMI_TOKEN_PLAN_SGP_API_KEY - Xiaomi MiMo Token Plan API key (Singapore region)\n AWS_PROFILE - AWS profile for Amazon Bedrock\n AWS_ACCESS_KEY_ID - AWS access key for Amazon Bedrock\n AWS_SECRET_ACCESS_KEY - AWS secret key for Amazon Bedrock\n AWS_BEARER_TOKEN_BEDROCK - Bedrock API key (bearer token)\n AWS_REGION - AWS region for Amazon Bedrock (e.g., us-east-1)\n ${ENV_AGENT_DIR.padEnd(32)} - Config directory (default: ~/${CONFIG_DIR_NAME}/agent)\n ${ENV_SESSION_DIR.padEnd(32)} - Session storage directory (overridden by --session-dir)\n ${ENV_PACKAGE_DIR.padEnd(32)} - Override package directory (for Nix/Guix store paths)\n ${ENV_OFFLINE.padEnd(32)} - Disable startup network operations when set to 1/true/yes\n ${ENV_TELEMETRY.padEnd(32)} - Override install telemetry when set to 1/true/yes or 0/false/no\n ${ENV_SHARE_VIEWER_URL.padEnd(32)} - Base URL for /share command (default: https://pi.dev/session/)\n PI_* aliases are also supported for app-specific variables above.\n\n${chalk.bold(\"Built-in Tool Names:\")}\n read - Read path selectors (files, dirs, archives, URLs)\n bash - Execute shell commands\n powershell - Execute PowerShell commands on Windows\n edit - Apply hashline-anchored source edits\n write - Create or overwrite writable path selectors\n find - Find filesystem paths by glob pattern (default)\n search - Search file contents with regex (default)\n ask_user_question - Ask structured questions in the TUI (default)\n todo - Manage file-based todos (default)\n ls - Legacy directory listing helper (read-only, off by default)\n`);\n}\n"]}
1
+ {"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACN,QAAQ,EACR,eAAe,EACf,aAAa,EACb,WAAW,EACX,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,aAAa,GACb,MAAM,cAAc,CAAC;AAmDtB,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAEnG,MAAM,UAAU,oBAAoB,CAAC,KAAa;IACjD,OAAO,qBAAqB,CAAC,QAAQ,CAAC,KAAsB,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mCAAmC,CAAC,IAAc,EAAE,MAAgB;IACnF,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,eAAe,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC;IACxE,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IA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a,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;;;EAGjC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC;;;;;;;;;;;CAWnC,CAAC,CAAC;AACH,CAAC","sourcesContent":["/**\n * CLI argument parsing and help display\n */\n\nimport type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport chalk from \"chalk\";\nimport {\n\tAPP_NAME,\n\tCONFIG_DIR_NAME,\n\tENV_AGENT_DIR,\n\tENV_OFFLINE,\n\tENV_PACKAGE_DIR,\n\tENV_SESSION_DIR,\n\tENV_SHARE_VIEWER_URL,\n\tENV_TELEMETRY,\n} from \"../config.js\";\nimport type { ExtensionFlag } from \"../core/extensions/types.ts\";\n\nexport type Mode = \"text\" | \"json\" | \"rpc\";\n\nexport interface Args {\n\tprovider?: string;\n\tmodel?: string;\n\tapiKey?: string;\n\tsystemPrompt?: string;\n\tappendSystemPrompt?: string[];\n\tthinking?: ThinkingLevel;\n\tcontinue?: boolean;\n\tresume?: boolean;\n\thelp?: boolean;\n\tversion?: boolean;\n\tmode?: Mode;\n\tname?: string;\n\tnoSession?: boolean;\n\tsession?: string;\n\tsessionId?: string;\n\tfork?: string;\n\tsessionDir?: string;\n\tmodels?: string[];\n\ttools?: string[];\n\texcludeTools?: string[];\n\tnoTools?: boolean;\n\tnoBuiltinTools?: boolean;\n\textensions?: string[];\n\tnoExtensions?: boolean;\n\tprint?: boolean;\n\texport?: string;\n\tnoSkills?: boolean;\n\tskills?: string[];\n\tpromptTemplates?: string[];\n\tnoPromptTemplates?: boolean;\n\tthemes?: string[];\n\tuseTheme?: string;\n\tnoThemes?: boolean;\n\tnoContextFiles?: boolean;\n\tlistModels?: string | true;\n\toffline?: boolean;\n\tverbose?: boolean;\n\tprojectTrustOverride?: boolean;\n\tmessages: string[];\n\tfileArgs: string[];\n\t/** Unknown flags (potentially extension flags) - map of flag name to value */\n\tunknownFlags: Map<string, boolean | string>;\n\tdiagnostics: Array<{ type: \"warning\" | \"error\"; message: string }>;\n}\n\nconst VALID_THINKING_LEVELS = [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const;\n\nexport function isValidThinkingLevel(level: string): level is ThinkingLevel {\n\treturn VALID_THINKING_LEVELS.includes(level as ThinkingLevel);\n}\n\n/**\n * Insert forced option arguments (e.g. a dedicated entry point's `--mode rpc`)\n * immediately before the first `--` end-of-options terminator, or append them\n * when no terminator is present. Keeps the forced options parsed as options\n * (never literal message text) while preserving last-option-wins semantics,\n * since caller options can only appear before the terminator.\n */\nexport function insertForcedOptionsBeforeTerminator(args: string[], forced: string[]): string[] {\n\tconst terminatorIndex = args.indexOf(\"--\");\n\tconst insertAt = terminatorIndex === -1 ? args.length : terminatorIndex;\n\treturn [...args.slice(0, insertAt), ...forced, ...args.slice(insertAt)];\n}\n\nexport function parseArgs(args: string[]): Args {\n\tconst result: Args = {\n\t\tmessages: [],\n\t\tfileArgs: [],\n\t\tunknownFlags: new Map(),\n\t\tdiagnostics: [],\n\t};\n\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i];\n\n\t\tif (arg === \"--\") {\n\t\t\tresult.messages.push(...args.slice(i + 1));\n\t\t\tbreak;\n\t\t}\n\n\t\tif (arg === \"--help\" || arg === \"-h\") {\n\t\t\tresult.help = true;\n\t\t} else if (arg === \"--version\" || arg === \"-v\") {\n\t\t\tresult.version = true;\n\t\t} else if (arg === \"--mode\") {\n\t\t\tconst mode = args[i + 1];\n\t\t\tif (mode === undefined || mode.startsWith(\"-\")) {\n\t\t\t\tresult.diagnostics.push({ type: \"error\", message: \"--mode requires text, json, or rpc\" });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ti++;\n\t\t\tif (mode !== \"text\" && mode !== \"json\" && mode !== \"rpc\") {\n\t\t\t\tresult.diagnostics.push({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\tmessage: `Invalid mode \"${mode}\". Valid values: text, json, rpc`,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tresult.mode = mode;\n\t\t} else if (arg === \"--continue\" || arg === \"-c\") {\n\t\t\tresult.continue = true;\n\t\t} else if (arg === \"--resume\" || arg === \"-r\") {\n\t\t\tresult.resume = true;\n\t\t} else if (arg === \"--provider\" && i + 1 < args.length) {\n\t\t\tresult.provider = args[++i];\n\t\t} else if (arg === \"--model\" && i + 1 < args.length) {\n\t\t\tresult.model = args[++i];\n\t\t} else if (arg === \"--api-key\" && i + 1 < args.length) {\n\t\t\tresult.apiKey = args[++i];\n\t\t} else if (arg === \"--system-prompt\" && i + 1 < args.length) {\n\t\t\tresult.systemPrompt = args[++i];\n\t\t} else if (arg === \"--append-system-prompt\" && i + 1 < args.length) {\n\t\t\tresult.appendSystemPrompt = result.appendSystemPrompt ?? [];\n\t\t\tresult.appendSystemPrompt.push(args[++i]);\n\t\t} else if (arg === \"--name\" || arg === \"-n\") {\n\t\t\tif (i + 1 < args.length) {\n\t\t\t\tresult.name = args[++i];\n\t\t\t} else {\n\t\t\t\tresult.diagnostics.push({ type: \"error\", message: \"--name requires a value\" });\n\t\t\t}\n\t\t} else if (arg === \"--no-session\") {\n\t\t\tresult.noSession = true;\n\t\t} else if (arg === \"--session\" && i + 1 < args.length) {\n\t\t\tresult.session = args[++i];\n\t\t} else if (arg === \"--session-id\" && i + 1 < args.length) {\n\t\t\tresult.sessionId = args[++i];\n\t\t} else if (arg === \"--fork\" && i + 1 < args.length) {\n\t\t\tresult.fork = args[++i];\n\t\t} else if (arg === \"--session-dir\" && i + 1 < args.length) {\n\t\t\tresult.sessionDir = args[++i];\n\t\t} else if (arg === \"--models\" && i + 1 < args.length) {\n\t\t\tresult.models = args[++i].split(\",\").map((s) => s.trim());\n\t\t} else if (arg === \"--no-tools\" || arg === \"-nt\") {\n\t\t\tresult.noTools = true;\n\t\t} else if (arg === \"--no-builtin-tools\" || arg === \"-nbt\") {\n\t\t\tresult.noBuiltinTools = true;\n\t\t} else if ((arg === \"--tools\" || arg === \"-t\") && i + 1 < args.length) {\n\t\t\tresult.tools = args[++i]\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((s) => s.trim())\n\t\t\t\t.filter((name) => name.length > 0);\n\t\t} else if ((arg === \"--exclude-tools\" || arg === \"-xt\") && i + 1 < args.length) {\n\t\t\tresult.excludeTools = args[++i]\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((s) => s.trim())\n\t\t\t\t.filter((name) => name.length > 0);\n\t\t} else if (arg === \"--thinking\" && i + 1 < args.length) {\n\t\t\tconst level = args[++i];\n\t\t\tif (isValidThinkingLevel(level)) {\n\t\t\t\tresult.thinking = level;\n\t\t\t} else {\n\t\t\t\tresult.diagnostics.push({\n\t\t\t\t\ttype: \"warning\",\n\t\t\t\t\tmessage: `Invalid thinking level \"${level}\". Valid values: ${VALID_THINKING_LEVELS.join(\", \")}`,\n\t\t\t\t});\n\t\t\t}\n\t\t} else if (arg === \"--print\" || arg === \"-p\") {\n\t\t\tresult.print = true;\n\t\t\tconst next = args[i + 1];\n\t\t\tif (next !== undefined && !next.startsWith(\"@\") && (!next.startsWith(\"-\") || next.startsWith(\"---\"))) {\n\t\t\t\tresult.messages.push(next);\n\t\t\t\ti++;\n\t\t\t}\n\t\t} else if (arg === \"--export\" && i + 1 < args.length) {\n\t\t\tresult.export = args[++i];\n\t\t} else if ((arg === \"--extension\" || arg === \"-e\") && i + 1 < args.length) {\n\t\t\tresult.extensions = result.extensions ?? [];\n\t\t\tresult.extensions.push(args[++i]);\n\t\t} else if (arg === \"--no-extensions\" || arg === \"-ne\") {\n\t\t\tresult.noExtensions = true;\n\t\t} else if (arg === \"--skill\" && i + 1 < args.length) {\n\t\t\tresult.skills = result.skills ?? [];\n\t\t\tresult.skills.push(args[++i]);\n\t\t} else if (arg === \"--prompt-template\" && i + 1 < args.length) {\n\t\t\tresult.promptTemplates = result.promptTemplates ?? [];\n\t\t\tresult.promptTemplates.push(args[++i]);\n\t\t} else if (arg === \"--theme\" && i + 1 < args.length) {\n\t\t\tresult.themes = result.themes ?? [];\n\t\t\tresult.themes.push(args[++i]);\n\t\t} else if (arg === \"--use-theme\") {\n\t\t\tconst themeName = args[i + 1];\n\t\t\tif (themeName === undefined || themeName.startsWith(\"-\")) {\n\t\t\t\tresult.diagnostics.push({ type: \"error\", message: \"--use-theme requires a theme name\" });\n\t\t\t} else {\n\t\t\t\tresult.useTheme = themeName;\n\t\t\t\ti++;\n\t\t\t}\n\t\t} else if (arg === \"--no-skills\" || arg === \"-ns\") {\n\t\t\tresult.noSkills = true;\n\t\t} else if (arg === \"--no-prompt-templates\" || arg === \"-np\") {\n\t\t\tresult.noPromptTemplates = true;\n\t\t} else if (arg === \"--no-themes\") {\n\t\t\tresult.noThemes = true;\n\t\t} else if (arg === \"--no-context-files\" || arg === \"-nc\") {\n\t\t\tresult.noContextFiles = true;\n\t\t} else if (arg === \"--list-models\") {\n\t\t\t// Check if next arg is a search pattern (not a flag or file arg)\n\t\t\tif (i + 1 < args.length && !args[i + 1].startsWith(\"-\") && !args[i + 1].startsWith(\"@\")) {\n\t\t\t\tresult.listModels = args[++i];\n\t\t\t} else {\n\t\t\t\tresult.listModels = true;\n\t\t\t}\n\t\t} else if (arg === \"--verbose\") {\n\t\t\tresult.verbose = true;\n\t\t} else if (arg === \"--approve\" || arg === \"-a\") {\n\t\t\tresult.projectTrustOverride = true;\n\t\t} else if (arg === \"--no-approve\" || arg === \"-na\") {\n\t\t\tresult.projectTrustOverride = false;\n\t\t} else if (arg === \"--offline\") {\n\t\t\tresult.offline = true;\n\t\t} else if (arg.startsWith(\"@\")) {\n\t\t\tresult.fileArgs.push(arg.slice(1)); // Remove @ prefix\n\t\t} else if (arg.startsWith(\"--\")) {\n\t\t\tconst eqIndex = arg.indexOf(\"=\");\n\t\t\tif (eqIndex !== -1) {\n\t\t\t\tresult.unknownFlags.set(arg.slice(2, eqIndex), arg.slice(eqIndex + 1));\n\t\t\t} else {\n\t\t\t\tconst flagName = arg.slice(2);\n\t\t\t\tconst next = args[i + 1];\n\t\t\t\tif (next !== undefined && !next.startsWith(\"-\") && !next.startsWith(\"@\")) {\n\t\t\t\t\tresult.unknownFlags.set(flagName, next);\n\t\t\t\t\ti++;\n\t\t\t\t} else {\n\t\t\t\t\tresult.unknownFlags.set(flagName, true);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (arg.startsWith(\"-\") && !arg.startsWith(\"--\")) {\n\t\t\tresult.diagnostics.push({ type: \"error\", message: `Unknown option: ${arg}` });\n\t\t} else if (!arg.startsWith(\"-\")) {\n\t\t\tresult.messages.push(arg);\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function printHelp(extensionFlags?: ExtensionFlag[]): void {\n\tconst extensionFlagsText =\n\t\textensionFlags && extensionFlags.length > 0\n\t\t\t? `\\n${chalk.bold(\"Extension CLI Flags:\")}\\n${extensionFlags\n\t\t\t\t\t.map((flag) => {\n\t\t\t\t\t\tconst value = flag.type === \"string\" ? \" <value>\" : \"\";\n\t\t\t\t\t\tconst description = flag.description ?? `Registered by ${flag.extensionPath}`;\n\t\t\t\t\t\treturn ` --${flag.name}${value}`.padEnd(30) + description;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\"\\n\")}\\n`\n\t\t\t: \"\";\n\tconsole.log(`${chalk.bold(APP_NAME)} - AI coding assistant with read, bash, edit, write, find, search, ask_user_question, todo tools\n\n${chalk.bold(\"Usage:\")}\n ${APP_NAME} [options] [--] [@files...] [messages...]\n\n${chalk.bold(\"Commands:\")}\n ${APP_NAME} install <source> [-l] Install extension source and add to settings\n ${APP_NAME} remove <source> [-l] Remove extension source from settings\n ${APP_NAME} uninstall <source> [-l] Alias for remove\n ${APP_NAME} update [source|self|${APP_NAME}] [--all] Update ${APP_NAME} (use --all for ${APP_NAME} and extensions)\n ${APP_NAME} list List installed extensions from settings\n ${APP_NAME} config [-l] Open resource TUI (Tab switches global/project scope)\n ${APP_NAME} auth <command> Print credentials or check provider readiness\n ${APP_NAME} mcp <command> Configure MCP servers, check connections, and sign in\n ${APP_NAME} <command> --help Show help for install/remove/uninstall/update/list/config/auth/mcp\n\n${chalk.bold(\"Options:\")}\n --provider <name> Provider to search for --model (requires --model)\n --model <pattern> Model pattern or ID (supports \"provider/id\" and optional \":<thinking>\")\n --api-key <key> API key (defaults to env vars)\n --system-prompt <text> System prompt (default: coding assistant prompt)\n --append-system-prompt <text> Append text or file contents to the system prompt (can be used multiple times)\n --mode <mode> Output mode: text (default), json, or rpc\n --print, -p Non-interactive mode: process prompt and exit\n --continue, -c Continue previous session\n --resume, -r Select a session to resume\n --session <path|id> Use file, exact ID, or unique 8-hex UUID prefix\n --session-id <id> Use exact project session ID, creating it if missing\n --fork <path|id> Fork file, exact ID, or unique 8-hex UUID prefix into a new session\n --session-dir <dir> Directory for session storage and lookup\n --no-session Don't save session (ephemeral)\n --name, -n <name> Set session display name\n --models <patterns> Comma-separated model patterns for ctrl+p cycling\n Supports globs (anthropic/*, *sonnet*) and fuzzy matching\n --no-tools, -nt Disable every tool except mandatory ordinary intercom\n --no-builtin-tools, -nbt Disable built-in tools by default but keep extension/custom tools enabled\n --tools, -t <tools> Comma-separated allowlist of non-mandatory tool names\n Mandatory ordinary intercom remains available\n --exclude-tools, -xt <tools> Comma-separated denylist of non-mandatory tool names\n Mandatory ordinary intercom cannot be excluded\n --thinking <level> Set thinking level: off, minimal, low, medium, high, xhigh, max\n --extension, -e <path> Load an extension file (can be used multiple times)\n --no-extensions, -ne Disable optional extension discovery; mandatory bundled Intercom remains loaded\n --skill <path> Load a skill file or directory (can be used multiple times)\n --no-skills, -ns Disable skills discovery and loading\n --prompt-template <path> Load a prompt template file or directory (can be used multiple times)\n --no-prompt-templates, -np Disable prompt template discovery and loading\n --theme <path> Load a theme file or directory (can be used multiple times)\n --use-theme <name[/name]> Set the interactive theme for this run without saving it\n --no-themes Disable theme discovery and loading\n --no-context-files, -nc Disable context-file discovery and loading\n --export <file> Export session file to HTML and exit\n --list-models [search] List available models (with optional fuzzy search)\n --verbose Force verbose startup (overrides quietStartup setting)\n --approve, -a Trust project-local files for this run\n --no-approve, -na Ignore project-local files for this run\n --offline Disable startup network operations (same as ${ENV_OFFLINE}=1)\n -- End option parsing; treat remaining arguments as messages/files\n --help, -h Show this help\n --version, -v Show version number\n\nExtensions can register additional flags (e.g., --plan from plan-mode extension).${extensionFlagsText}\n\n${chalk.bold(\"Examples:\")}\n # Print a provider API key for an external client\n ${APP_NAME} auth print-api-key --model gpt-5.5 --provider openai\n\n # Check configured provider readiness before starting a session\n ${APP_NAME} auth check --provider openai\n\n # Print an OAuth bearer token, refreshing it when under the minimum expiry\n ${APP_NAME} auth print-bearer-token --model gpt-5.5 --provider openai-codex --min-expiry 30m\n\n # Interactive mode\n ${APP_NAME}\n\n # Interactive mode with initial prompt\n ${APP_NAME} \"List all .ts files in src/\"\n\n # Include files in initial message\n ${APP_NAME} @prompt.md @image.png \"What color is the sky?\"\n\n # Non-interactive mode (process and exit)\n ${APP_NAME} -p \"List all .ts files in src/\"\n\n # Prompt beginning with a dash\n ${APP_NAME} -p -- \"- Summarize these points\"\n\n # Multiple messages (interactive)\n ${APP_NAME} \"Read package.json\" \"What dependencies do we have?\"\n\n # Continue previous session\n ${APP_NAME} --continue \"What did we discuss?\"\n\n # Start a named session\n ${APP_NAME} --name \"Refactor auth module\"\n\n # Use different model\n ${APP_NAME} --provider openai --model gpt-4o-mini \"Help me refactor this code\"\n\n # Use model with provider prefix (no --provider needed)\n ${APP_NAME} --model openai/gpt-4o \"Help me refactor this code\"\n\n # Use model with thinking level shorthand\n ${APP_NAME} --model sonnet:high \"Solve this complex problem\"\n\n # Limit model cycling to specific models\n ${APP_NAME} --models claude-sonnet,claude-haiku,gpt-4o\n\n # Limit to a specific provider with glob pattern\n ${APP_NAME} --models \"github-copilot/*\"\n\n # Cycle models with fixed thinking levels\n ${APP_NAME} --models sonnet:high,haiku:low\n\n # Start with a specific thinking level\n ${APP_NAME} --thinking high \"Solve this complex problem\"\n\n # Read-only mode (no file modifications possible)\n ${APP_NAME} --tools read,search,find,ls -p \"Review the code in src/\"\n\n # Disable one tool while keeping the rest available\n ${APP_NAME} --exclude-tools ask_user_question\n\n # Export a session file to HTML\n ${APP_NAME} --export ~/${CONFIG_DIR_NAME}/agent/sessions/--path--/session.jsonl\n ${APP_NAME} --export session.jsonl output.html\n\n${chalk.bold(\"Environment Variables:\")}\n ANTHROPIC_AUTH_TOKEN - Anthropic bearer auth token\n ANTHROPIC_API_KEY - Anthropic Claude API key\n ANTHROPIC_OAUTH_TOKEN - Anthropic OAuth token (alternative to API key)\n OPENAI_API_KEY - OpenAI GPT API key\n AZURE_OPENAI_API_KEY - Azure OpenAI API key\n AZURE_OPENAI_BASE_URL - Azure OpenAI/Cognitive Services base URL (e.g. https://{resource}.openai.azure.com)\n AZURE_OPENAI_RESOURCE_NAME - Azure OpenAI resource name (alternative to base URL)\n AZURE_OPENAI_API_VERSION - Azure OpenAI API version (default: v1)\n AZURE_OPENAI_DEPLOYMENT_NAME_MAP - Azure OpenAI model=deployment map (comma-separated)\n DEEPSEEK_API_KEY - DeepSeek API key\n GEMINI_API_KEY - Google Gemini API key\n GROQ_API_KEY - Groq API key\n CEREBRAS_API_KEY - Cerebras API key\n XAI_API_KEY - xAI Grok API key\n FIREWORKS_API_KEY - Fireworks API key\n TOGETHER_API_KEY - Together AI API key\n BASETEN_API_KEY - Baseten API key\n OPENROUTER_API_KEY - OpenRouter API key\n AI_GATEWAY_API_KEY - Vercel AI Gateway API key\n ZAI_API_KEY - ZAI API key\n MISTRAL_API_KEY - Mistral API key\n MINIMAX_API_KEY - MiniMax API key\n MOONSHOT_API_KEY - Moonshot AI API key\n OPENCODE_API_KEY - OpenCode Zen/OpenCode Go API key\n KIMI_API_KEY - Kimi For Coding API key\n META_API_KEY - Meta Model API key\n CLOUDFLARE_API_KEY - Cloudflare API token (Workers AI and AI Gateway)\n CLOUDFLARE_ACCOUNT_ID - Cloudflare account id (required for both)\n CLOUDFLARE_GATEWAY_ID - Cloudflare AI Gateway slug (required for AI Gateway)\n QWEN_TOKEN_PLAN_API_KEY - Qwen Token Plan API key (international region)\n QWEN_TOKEN_PLAN_CN_API_KEY - Qwen Token Plan API key (China region)\n XIAOMI_API_KEY - Xiaomi MiMo API key (api.xiaomimimo.com billing)\n XIAOMI_TOKEN_PLAN_CN_API_KEY - Xiaomi MiMo Token Plan API key (China region)\n XIAOMI_TOKEN_PLAN_AMS_API_KEY - Xiaomi MiMo Token Plan API key (Amsterdam region)\n XIAOMI_TOKEN_PLAN_SGP_API_KEY - Xiaomi MiMo Token Plan API key (Singapore region)\n AWS_PROFILE - AWS profile for Amazon Bedrock\n AWS_ACCESS_KEY_ID - AWS access key for Amazon Bedrock\n AWS_SECRET_ACCESS_KEY - AWS secret key for Amazon Bedrock\n AWS_BEARER_TOKEN_BEDROCK - Bedrock API key (bearer token)\n AWS_REGION - AWS region for Amazon Bedrock (e.g., us-east-1)\n ${ENV_AGENT_DIR.padEnd(32)} - Config directory (default: ~/${CONFIG_DIR_NAME}/agent)\n ${ENV_SESSION_DIR.padEnd(32)} - Session storage directory (overridden by --session-dir)\n ${ENV_PACKAGE_DIR.padEnd(32)} - Override package directory (for Nix/Guix store paths)\n ${ENV_OFFLINE.padEnd(32)} - Disable startup network operations when set to 1/true/yes\n ${ENV_TELEMETRY.padEnd(32)} - Override install telemetry when set to 1/true/yes or 0/false/no\n ${ENV_SHARE_VIEWER_URL.padEnd(32)} - Base URL for /share command (default: https://pi.dev/session/)\n PI_* aliases are also supported for app-specific variables above.\n\n${chalk.bold(\"Built-in Tool Names:\")}\n read - Read path selectors (files, dirs, archives, URLs)\n bash - Execute shell commands\n powershell - Execute PowerShell commands on Windows\n edit - Apply hashline-anchored source edits\n write - Create or overwrite writable path selectors\n find - Find filesystem paths by glob pattern (default)\n search - Search file contents with regex (default)\n ask_user_question - Ask structured questions in the TUI (default)\n todo - Manage file-based todos (default)\n ls - Legacy directory listing helper (read-only, off by default)\n`);\n}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CA0RN;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAKnG;AAiPD,qGAAqG;AACrG,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAehH;AAMD;;;GAGG;AAEH,eAAO,MAAM,oCAAoC;;;;;;;;;;;CAWhD,CAAC"}
@@ -625,6 +625,8 @@ async function reloadOwnedGeneration(retainedRuntimes, options) {
625
625
  resetApiProviders();
626
626
  await this._resourceLoader.reload();
627
627
  const defaultTools = this.settingsManager.getDefaultTools() ?? getDefaultToolNames();
628
+ for (const name of this.getActiveToolNames())
629
+ this._pendingToolNames.add(name);
628
630
  this._buildRuntime({
629
631
  activeToolNames: activeToolsAfterReload(defaultTools),
630
632
  flagValues: previousFlagValues,
@@ -742,6 +744,8 @@ async function reloadOwnedGeneration(retainedRuntimes, options) {
742
744
  this._extensionRunnerRef.current = candidateRunner;
743
745
  this._bindExtensionCore(candidateRunner);
744
746
  this._applyExtensionBindings(candidateRunner);
747
+ for (const name of this.getActiveToolNames())
748
+ this._pendingToolNames.add(name);
745
749
  this._buildRuntime({
746
750
  activeToolNames: activeToolsAfterReload(defaultTools),
747
751
  flagValues: previousFlagValues,