@bastani/atomic 0.9.40-alpha.1 → 0.9.40

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 (35) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +14 -0
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/subagents/CHANGELOG.md +31 -0
  6. package/dist/builtin/subagents/package.json +1 -1
  7. package/dist/builtin/web-access/CHANGELOG.md +12 -0
  8. package/dist/builtin/web-access/README.md +1 -1
  9. package/dist/builtin/web-access/index.bundle.mjs +2 -5
  10. package/dist/builtin/web-access/package.json +1 -1
  11. package/dist/builtin/workflows/CHANGELOG.md +25 -0
  12. package/dist/builtin/workflows/package.json +1 -1
  13. package/dist/builtin/workflows/src/extension/index.bundle.mjs +11 -2
  14. package/dist/cli/args.js +1 -1
  15. package/dist/cli/args.js.map +1 -1
  16. package/dist/core/export-html/index.d.ts.map +1 -1
  17. package/dist/core/export-html/index.js +3 -2
  18. package/dist/core/export-html/index.js.map +1 -1
  19. package/dist/core/export-html/template.html +1 -0
  20. package/dist/core/export-html/template.js +37 -20
  21. package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
  22. package/dist/core/export-html/vendor/marked.min.js +76 -3
  23. package/docs/providers.md +1 -1
  24. package/docs/settings.md +1 -1
  25. package/npm-shrinkwrap.json +35 -35
  26. package/package.json +5 -5
  27. package/dist/core/export-html/template-js/data-tree.js +0 -287
  28. package/dist/core/export-html/template-js/entries-navigation.js +0 -434
  29. package/dist/core/export-html/template-js/initialization.js +0 -335
  30. package/dist/core/export-html/template-js/message-tools.js +0 -428
  31. package/dist/core/export-html/template-js/tree-filter-render.js +0 -419
  32. package/dist/core/export-html/template-script.d.ts +0 -3
  33. package/dist/core/export-html/template-script.d.ts.map +0 -1
  34. package/dist/core/export-html/template-script.js +0 -13
  35. package/dist/core/export-html/template-script.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,43 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.40] - 2026-10-20
6
+
7
+ ### Breaking Changes
8
+
9
+ - Binding or switching a session no longer replays deliveries that a previous process left unfinished. SDK hosts call `session.startPendingRecovery()` and RPC clients send `start_pending_recovery` once they show the session. Until then, interrupted work stays pending ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
10
+ - Removed the bundled `subagent` tool's `kill` action. Replace `subagent({ action: "kill", id })` with `subagent({ action: "quit", id })`, which stops the child gracefully and keeps it resumable. Calls with `action: "kill"` or the earlier `action: "interrupt"` are rejected with an error that names `quit` as the replacement ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
11
+
12
+ ### Added
13
+
14
+ - Added `AgentSession.startPendingRecovery()`, the RPC `start_pending_recovery` command, and the `session_recovery_restore` and `session_recovery_replay` extension events. Extensions can now restore background work after a restart, decline to replay deliveries whose peer is gone, and defer deliveries they cannot decide on yet to the next resume without starting a turn ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
15
+ - Added the `typesafe/jev-1.14.0` classifier. Both direct TypeSafe classifiers, `typesafe/jev-latest` and `typesafe/jev-1.14.0`, now accept up to 262K tokens and PNG or JPEG images, for example through `models.classify()` in codemode. See [TypeSafe Jev](docs/providers.md#typesafe-jev).
16
+ - The bundled `subagent` tool now has workflow-style run control: `pause`, `resume` (with an optional `message`), and `quit`, with `all: true` for `pause` and `quit`. Pausing or quitting a parallel child still queued behind its concurrency limit keeps it from starting until you resume it. Paused, quit, interrupted, completed, and failed children resume from their own saved session under the same id and Intercom name, including children of a session you closed or switched away from (exit or crash, `/new`, `/resume` to another session, `/fork`). Subagents of a workflow stage that is paused or quit, including by Atomic exiting or a session switch, stay resumable too, and resuming the run after a restart restores them with the stage. With a `message`, a paused, quit, or interrupted child receives it once and then continues where it left off, and a completed or failed child receives it as one fresh prompt; without one, the child is asked to continue where it left off. Children cancelled for good (owner or batch cancellation, a `/tasks` stop), every subagent of a workflow stage that finished or whose run ended or was cancelled, including ones you paused or quit, and children reported gone after a restart are terminal, and `resume` on them returns an error that says why ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
17
+ - Background subagent launch cards show the child's latest state (running, paused, quit, interrupted, completed, failed, or terminal), also after you reopen the session (`/resume` or `atomic --session <id>`) or view a workflow stage's transcript. Expanding a card shows the end of the child's saved transcript. A resumed child continues in its original card, and replayed `pause`, `resume`, and `quit` calls render as their results ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
18
+ - Added per-process storage selection. `ATOMIC_STORAGE`, `ATOMIC_SESSIONS_STORAGE`, `ATOMIC_WORKFLOWS_JOURNAL`, `--storage '<json>'`, and `--storage-file <path>` take the same JSON selections as the storage settings, adapters and `secrets` included, so a host can start `atomic --mode rpc` children on their own store without editing settings. A process without them keeps using its settings, and `/resume` in each lists only its own store. Invalid or conflicting selections stop startup with a `StorageConfigError` naming the variable or flag. See [Selecting storage per process](docs/storage.md#selecting-storage-per-process) ([#3783](https://github.com/bastani-inc/atomic/issues/3783)).
19
+ - Added multi-node routing: Intercom brokers on different machines that select the same shared `storage` (in settings, `ATOMIC_STORAGE`, or `--storage`) now deliver messages to each other through that database. A message to a session on another machine arrives exactly like a local one, with the same sender identity, replies and asks, group rules, supervisor routes and save-before-delivered receipts. A send to a session that is offline, including one that quit cleanly in the last 7 days, is reported as queued for an offline session and delivered when it reconnects on any broker. Brokers coordinate only through the shared database and a polled wake-up signal; there is no broker-to-broker network connection. Without a shared `storage` selection, Intercom behaves as before.
20
+
21
+ ### Fixed
22
+
23
+ - Resuming a session with `atomic --session <id>` or `/resume` now shows the transcript before any recovery work runs, instead of leaving the screen blank while hidden agent turns replay messages from before the restart. Recovery runs afterwards and is visible in the transcript. A "Replaying N interrupted deliveries" line precedes any replayed turn, and a status line summarizes the result ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
24
+ - Resuming no longer starts agent turns on its own for stale queued messages or background task results. Results that an earlier process never delivered appear as cards without starting a turn. Messages from peers that no longer exist are not replayed; one notice tells you and the agent which peers are gone. Messages from a background subagent that was relaunched but has not reconnected yet are deferred instead, and the notice says it is not gone ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
25
+ - Intercom messages sent to a busy session are no longer lost when that session is killed or crashes before it goes idle: the recipient saves each message when it arrives, the sender sees `delivered` only after that save, and resuming the session with `atomic --session <id>` or `/resume` shows each saved message once. Like interrupted deliveries, a saved message starts a turn only when its sender is still connected; one from a gone sender is added once, in full, to the session history without starting a turn, and the recovery notice says the sender is gone; one whose sender cannot be checked is deferred to the next resume ([#3761](https://github.com/bastani-inc/atomic/issues/3761)).
26
+ - Fixed Windows rejecting Bash and PowerShell executables installed as Windows Store app aliases, such as those in `%LOCALAPPDATA%\Microsoft\WindowsApps`, as missing. Shell discovery and a configured `shellPath` now accept them ([upstream commit](https://github.com/earendil-works/pi/commit/28bea006be4adb950dcb4f86f9ee5be857bf74ff)).
27
+ - Fixed Windows PowerShell discovery when PowerShell is not on `PATH`: Atomic now also checks `%ProgramFiles%\PowerShell\7\pwsh.exe` and `%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe`. The legacy WSL `bash.exe` launcher is now recognized under the actual Windows directory, including installs on another drive or a renamed Windows directory ([#9490](https://github.com/earendil-works/pi/issues/9490)).
28
+ - JSONL sessions no longer stall when many sessions share a directory. Each append now rereads only its own session header instead of every session header in the directory ([#3780](https://github.com/bastani-inc/atomic/pull/3780) by [@darionco](https://github.com/darionco)).
29
+ - Opening or loading a session in a directory with many JSONL sessions no longer reads every session header, including the first lookup in a process and sessions created by another process.
30
+ - A resumed session no longer splits an extension tool call into an arguments-only card and a separate result card when the extension saved its own entries between them, and tool cards in an attached workflow stage chat now redraw when their renderer updates them ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
31
+ - Extension tool cards, including subagent cards, now use their extension renderers and current state when a session is opened with `atomic --session <id>`, instead of showing raw arguments. They also redraw as soon as their state changes, so an expanded subagent card shows the child's saved transcript and a resumed child updates in its original card without waiting for another screen redraw ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
32
+ - Fixed HTML export showing literal asterisks for Markdown bold and italic next to CJK punctuation ([#3353](https://github.com/earendil-works/pi/issues/3353), [#10154](https://github.com/earendil-works/pi/issues/10154))
33
+ - Fixed HTML export omitting nested tool calls (for example from codemode scripts), and not scrolling to the tool call when a tool result is selected in the tree
34
+
35
+ ## [0.9.40-alpha.2] - 2026-10-20
36
+
37
+ ### Fixed
38
+
39
+ - Fixed HTML export showing literal asterisks for Markdown bold and italic next to CJK punctuation ([#3353](https://github.com/earendil-works/pi/issues/3353), [#10154](https://github.com/earendil-works/pi/issues/10154))
40
+ - Fixed HTML export omitting nested tool calls (for example from codemode scripts), and not scrolling to the tool call when a tool result is selected in the tree
41
+
5
42
  ## [0.9.40-alpha.1] - 2026-10-20
6
43
 
7
44
  ### Breaking Changes
@@ -4,6 +4,20 @@ All notable changes to the `pi-intercom` extension will be documented in this fi
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.9.40] - 2026-10-20
8
+
9
+ ### Added
10
+
11
+ - Added multi-node routing: Intercom brokers on different machines that select the same shared `storage` (in settings, `ATOMIC_STORAGE`, or `--storage`) now deliver messages to each other through that database. A message to a session on another machine arrives exactly like a local one, with the same sender identity, replies and asks, group rules, supervisor routes and save-before-delivered receipts. A send to a session that is offline, including one that quit cleanly in the last 7 days, is reported as queued for an offline session and delivered when it reconnects on any broker. Brokers coordinate only through the shared database and a polled wake-up signal; there is no broker-to-broker network connection. Without a shared `storage` selection, Intercom behaves as before.
12
+
13
+ ### Fixed
14
+
15
+ - On resume, Intercom messages interrupted by an exit are replayed only if their sender is connected again. Messages from a peer that is gone no longer start a hidden turn: they appear once as history in a visible notice that tells the agent the peer is gone. A resumed session that used Intercom re-registers right away. A resumed session or restored background subagent also keeps the Intercom session ID it had before the restart (unless a live session holds it), so peers can reach it by its name, by that ID, or by its Atomic session ID instead of getting `Session not found` ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
16
+ - Intercom now keeps an interrupted workflow run's targets with the restarted session that launched the run, so messages sent before `/workflow resume` are queued instead of failing with `Session not found`. If another session resumes the run, it takes over those targets, and the restarted session stops answering for the run ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
17
+ - A `send` or `ask` to a background subagent that its restarted owner has not restored yet now waits for it, whoever sends it: the session that owns it, a sibling subagent, a workflow stage, or another session in the subagent's group. This applies whether the message is addressed by the subagent's name, its Atomic session ID, or the Intercom session ID it had before the restart. The wait starts when the owning session starts, not only once its recovery has restored the subagent, and recovery takes the wait over without dropping or repeating a message. For the subagents of an interrupted workflow run's stages, the session that launched the run holds them while the run waits for `/workflow resume`, and the resumed stage takes the hold over, so a message sent in that interval is delivered once after the subagent reconnects. Waiting messages are delivered once each, in the order each sender sent them, as soon as the subagent registers again, and each sender gets its usual confirmation. A message still waiting after 20 seconds gets a "still being restored, try again" error; the owning session is told instead when the subagent was relaunched but has not reconnected. If the subagent did not survive the restart, waiting and later messages get an explicit "did not survive the restart and is gone" error instead of `Session not found`; senders other than the owner get it while the owning session stays connected to Intercom. If another Atomic session resumes the run, the messages waiting for its subagents get an error saying so. If the owning session disconnects, waiting messages get `Session not found`; a wait that nothing restores also ends after 60 seconds. Messages to a subagent while no Atomic process of its owner is running are not queued and get `Session not found` ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
18
+ - If Intercom cannot be reached when a session resumes, its interrupted Intercom messages are no longer discarded or attributed to peers that are gone. They stay pending without starting a turn, one notice says that Intercom was unreachable and the deliveries were deferred, and the next resume decides about them again. The same applies to messages from a background subagent that was relaunched but has not re-registered with Intercom yet: they are deferred, not dropped, and the subagent is not reported as gone ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
19
+ - Intercom messages that reach a busy session are no longer lost if that session is killed or crashes before it goes idle. The recipient saves each message to its session when it arrives, and the sender sees `delivered` only after that save. Resuming the session with `atomic --session <id>` or `/resume` shows every saved message it never showed or otherwise handled (a reply already returned to a waiting `ask` or a message it refused is not shown again), once each and in arrival order, after the transcript appears. Saved messages pass the same sender check as interrupted Intercom deliveries: only a message whose sender is connected again starts a turn; a message from a sender that is gone is added once, in full, to the session history without starting a turn, and the recovery notice says the sender is gone. A message whose sender cannot be checked is deferred until the session is opened again: Intercom was unreachable, or the sender is a relaunched subagent that has not reconnected yet. When the recipient does not confirm the save in time, the sender gets an explicit failure saying the outcome is uncertain instead of a false `delivered`, and a recipient that reconnects before confirming receives the message again without showing it twice, and its answer to an `ask` still reaches the waiting sender. Recipients from earlier Atomic versions keep the previous behavior, and so does an Intercom broker from an earlier version that is still running after an upgrade: upgraded sessions keep working with it and still save each message on arrival. Sessions started with `--no-session` are still not saved ([#3761](https://github.com/bastani-inc/atomic/issues/3761)).
20
+
7
21
  ## [0.9.40-alpha.1] - 2026-10-20
8
22
 
9
23
  ### Added
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.9.40-alpha.1",
3
+ "version": "0.9.40",
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": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/mcp",
3
- "version": "0.9.40-alpha.1",
3
+ "version": "0.9.40",
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": [
@@ -2,6 +2,37 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.40] - 2026-10-20
6
+
7
+ ### Breaking Changes
8
+
9
+ - Removed the `kill` action from the `subagent` tool. Replace `subagent({ action: "kill", id })` with `subagent({ action: "quit", id })`, which stops the child gracefully and keeps it resumable. Calls with `action: "kill"` or the earlier `action: "interrupt"` are rejected with an error that names `quit` as the replacement ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
10
+
11
+ ### Added
12
+
13
+ - Added workflow-style run control to the `subagent` tool: `pause` stops a child and holds its queued messages until resume, `quit` stops it gracefully, and `resume` continues it from its own saved session under the same child id, Intercom name, and group. `pause` and `quit` accept `all: true` and also reach parallel children still queued behind their concurrency limit, which then start only when resumed, and `resume` accepts an optional `message`: a paused, quit, or interrupted child receives it once as its next prompt and then continues where it left off, and a completed or failed child receives it as one fresh prompt. Without `message`, the child is asked to continue where it left off, including a completed or failed child. A resumed child of a parallel run waits for a slot under that run's concurrency limit, and keeps its `worktree: true` worktree until it finishes; a paused or quit child holds no slot, and its worktree is kept only while it has uncommitted or untracked changes or commits that are not in the run's base. Resume continues in a kept worktree, or recreates a removed one from the run's base; a resume that fails keeps the worktree, its changes, and its branch. Steering and follow-up messages a child had queued when it was paused or quit are delivered once, in order, when it resumes, before the resume `message`. An SDK session without a task host records its subagents the same way, so `pause`, `resume` and `quit` work there too, also after the session is reopened; a child it resumes runs in the background and reports through a completion notice. A child paused or quit before it read its task or the resume message keeps them, and resume delivers them. `id` accepts the child id, task id, Intercom name, or a single-child run id ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
14
+ - Paused, quit, interrupted, completed, and failed children can be resumed, including children of a session you closed or switched away from (Atomic exit or crash, `/new`, `/resume` to another session, `/fork`). Children cancelled for good (owner or batch cancellation, a `/tasks` stop, the removed `kill` action) or reported gone after a restart are terminal, and `resume` on them returns an error that says why ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
15
+ - Background subagent launch cards now show the child's latest state, also after you reopen the session (`/resume` or `atomic --session <id>`) or view a workflow stage's transcript: running, paused, paused with its workflow stage, quit, or interrupted (resumable), completed, failed, or terminal (killed, gone after a restart, or its workflow stage ended). Expanding a card shows the end of the child's saved transcript. A resumed child continues in its original card, marked resumed, and replayed `pause`, `resume`, and `quit` calls render as their results, or as errors when they were rejected ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
16
+
17
+ ### Changed
18
+
19
+ - Updated the bundled Cua Driver skill to upstream `cua-driver-rs-v0.36.0`. It now starts with an efficient loop: targeted `get_window_state` reads with `query`, acting by `element_token`, batching actions with `run_steps` or `run_script`, re-reading only changes with `since:"latest"`, and verifying at checkpoints instead of after every action. It also covers opening local files with `launch_app`, browser fallbacks when browser tools refuse in the background, and macOS editor recipes.
20
+ - When a workflow stage closes for good (the stage finished, or its run ended or was cancelled), every subagent it launched becomes terminal, whether running, paused, quit, completed, or failed, and `resume` on them returns an error that says their workflow stage ended. A quit child stays resumable only while the session or stage that launched it can still resume it. `quit` also accepts a child paused with its workflow stage, and `pause` reports such a child as already paused. Pausing or quitting a workflow run, Atomic exiting, switching sessions, and an interrupted stage leave the stage's children resumable: `resume` continues them, and resuming the run after Atomic restarts restores them with the stage ([#3760](https://github.com/bastani-inc/atomic/issues/3760)). A stage blocked by a recoverable failure, such as a rate limit or provider outage that leaves its run resumable, keeps its paused and quit subagents resumable until the run is killed, cancelled, or ends without staying resumable; then they end with the stage.
21
+
22
+ ### Fixed
23
+
24
+ - Background subagents that were still running when Atomic exited are now relaunched from their own sessions when you resume the session (`atomic --session <id>` or `/resume`) or resume a workflow stage that launched them. They keep their original Intercom name and group and get fresh supervisor authorization, and Intercom messages sent to it by any session in its group wait for it from the moment the resumed session starts (or, for a stage's subagent, from the moment the interrupted run becomes addressable) until it has been restored. Only the session that launched a child restores it: a fork of that session (`/fork`, `atomic --fork`, or a branched session) copies the child's record but never relaunches, waits for, or reports the child. If a child cannot be restored, the resumed agent is told explicitly that it is gone, once: the child is then recorded as gone, so later resumes neither retry it nor repeat the notice ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
25
+ - On Windows, removing a `worktree: true` worktree now removes its directory. Its `node_modules` junction is unlinked first, so Git for Windows no longer leaves the directory behind, and older Git versions no longer delete the main checkout's `node_modules` through the junction.
26
+ - A `worktree: true` child resumed after an Atomic restart saves its tracked and untracked edits as a patch in its run's `worktree-diffs` directory before its worktree is removed, as a child of a fresh run does.
27
+ - Resuming a `worktree: true` child whose worktree was already removed, such as a completed child, now restores the edits it saved as a patch before it continues, so its earlier work is not lost. Each run saves its patches in its own `worktree-diffs/<run id>` directory, and each execution of a resumed child writes its own patch (`task-<n>-<agent>.<execution>.patch`) instead of overwriting the earlier one. Patches now include binary changes.
28
+ - A subagent that an SDK session without a task host resumed now stops when that session closes, as the original launch does. Reopening the session relaunches it automatically, as it does a task-host child, and the steering and follow-up messages it had queued and not read are delivered once, in order. A task-host child whose session or workflow stage closes now keeps its unread steering and follow-up messages the same way, and restoring or resuming it delivers them once, in order, instead of losing them.
29
+ - Opening a fork no longer changes the original session's subagent launch cards back to an older state copied into the fork, such as showing a completed child as running.
30
+ - `pause` or `quit` of a subagent that completes just before the stop takes effect now reports that it completed instead of "Paused", and Intercom messages sent to it are no longer held until a resume ([#3784](https://github.com/bastani-inc/atomic/pull/3784)).
31
+ - A parallel subagent paused or quit while it still waited for a free slot can now be resumed after Atomic restarts, and one still waiting when Atomic exited starts when its session reopens, instead of being reported unrestorable or gone. It starts as a new launch under the same child id, Intercom name, and group, with its original agent definition, task, working directory or worktree, model, and skills, and a `context: "fork"` child starts on the parent conversation its launch branched; if that branch can no longer be reopened, the child is reported gone rather than started without it. This holds in task-host and SDK sessions alike ([#3784](https://github.com/bastani-inc/atomic/pull/3784)).
32
+ - Subagents of a workflow stage whose run is killed while it waits, after Atomic restarts, for `/workflow resume` now end with the run: `resume` returns "its workflow stage ended", their cards no longer show them as resumable, and reopening the stage's session no longer restores them ([#3784](https://github.com/bastani-inc/atomic/pull/3784)).
33
+ - A subagent relaunched from its own session after Atomic restarts, or resumed with `resume`, now runs on the agent definition it was launched with: a user agent is no longer replaced by a project agent of the same name. A child launched with `context: "fork"` also keeps its Intercom bridge instructions under `intercomBridge.mode: "fork-only"`. Children recorded by an earlier version keep the previous lookup ([#3784](https://github.com/bastani-inc/atomic/pull/3784)).
34
+ - A queued parallel subagent that inherited its parent's model and thinking level now keeps them when it starts after Atomic restarts, instead of taking whatever model and thinking level the parent switched to meanwhile. If that model is no longer available, resume reports the child as gone instead of starting it on the parent's current model. A child restored or resumed from its own session also falls back to the model it was launched with, not the parent's current one, and a child launched outside any Intercom group no longer joins a group the parent joined later ([#3784](https://github.com/bastani-inc/atomic/pull/3784)).
35
+
5
36
  ## [0.9.40-alpha.1] - 2026-10-20
6
37
 
7
38
  ### Breaking Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.9.40-alpha.1",
3
+ "version": "0.9.40",
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": [
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.9.40] - 2026-10-20
8
+
9
+ ### Changed
10
+
11
+ - Curator summary drafts for Codex-only users now prefer `openai-codex/gpt-6.1-sol`, the `openai-codex` default, instead of `gpt-5.3-codex-spark`, which ChatGPT accounts can no longer use. `anthropic/claude-haiku-4-5` remains the first choice.
12
+
13
+ ## [0.9.40-alpha.2] - 2026-10-20
14
+
15
+ ### Changed
16
+
17
+ - Curator summary drafts for Codex-only users now prefer `openai-codex/gpt-6.1-sol`, the `openai-codex` default, instead of `gpt-5.3-codex-spark`, which ChatGPT accounts can no longer use. `anthropic/claude-haiku-4-5` remains the first choice.
18
+
7
19
  ## [0.9.38] - 2026-10-18
8
20
 
9
21
  ### Fixed
@@ -291,7 +291,7 @@ All config lives in `~/.pi/web-search.json`. Every field is optional.
291
291
  }
292
292
  ```
293
293
 
294
- `EXA_API_KEY`, `GEMINI_API_KEY`, and `PERPLEXITY_API_KEY` env vars take precedence over config file values. `provider` sets the default search provider: `"exa"`, `"perplexity"`, or `"gemini"`. This is also updated automatically when you change the provider in the curator UI. `workflow` sets the curator mode: `"none"` (default, raw results, no curator) or `"summary-review"` (opens curator with auto-generated summary draft). Enable it in this file or toggle at runtime with `/curator`. `chromeProfile` overrides the Chromium profile directory used for Gemini Web cookie lookup. `allowBrowserCookies` enables Chromium cookie extraction for Gemini Web; it defaults to `false` to avoid surprise macOS Keychain prompts. You can also set `PI_ALLOW_BROWSER_COOKIES=1`. `searchModel` overrides the Gemini API model used by `web_search` without changing URL, YouTube, or video extraction defaults. `summaryModel` sets the default model used for generating summary drafts in the curator UI (e.g. `"anthropic/claude-haiku-4-5"` or `"openai-codex/gpt-5.3-codex-spark"`). Only models available in your model registry are eligible; if the configured model is unavailable, the default falls back to the built-in preference list. `curatorTimeoutSeconds` controls the initial curator idle timeout (default `20`, max `600`); users can still adjust the timer in the curator UI.
294
+ `EXA_API_KEY`, `GEMINI_API_KEY`, and `PERPLEXITY_API_KEY` env vars take precedence over config file values. `provider` sets the default search provider: `"exa"`, `"perplexity"`, or `"gemini"`. This is also updated automatically when you change the provider in the curator UI. `workflow` sets the curator mode: `"none"` (default, raw results, no curator) or `"summary-review"` (opens curator with auto-generated summary draft). Enable it in this file or toggle at runtime with `/curator`. `chromeProfile` overrides the Chromium profile directory used for Gemini Web cookie lookup. `allowBrowserCookies` enables Chromium cookie extraction for Gemini Web; it defaults to `false` to avoid surprise macOS Keychain prompts. You can also set `PI_ALLOW_BROWSER_COOKIES=1`. `searchModel` overrides the Gemini API model used by `web_search` without changing URL, YouTube, or video extraction defaults. `summaryModel` sets the default model used for generating summary drafts in the curator UI (e.g. `"anthropic/claude-haiku-4-5"` or `"openai-codex/gpt-6.1-sol"`). Only models available in your model registry are eligible; if the configured model is unavailable, the default falls back to the built-in preference list. `curatorTimeoutSeconds` controls the initial curator idle timeout (default `20`, max `600`); users can still adjust the timer in the curator UI.
295
295
 
296
296
  ### Shortcuts
297
297
 
@@ -96123,7 +96123,7 @@ var PREFERRED_SUMMARY_MODELS;
96123
96123
  var init_summary_review = __esm(() => {
96124
96124
  PREFERRED_SUMMARY_MODELS = [
96125
96125
  { provider: "anthropic", id: "claude-haiku-4-5" },
96126
- { provider: "openai-codex", id: "gpt-5.3-codex-spark" }
96126
+ { provider: "openai-codex", id: "gpt-6.1-sol" }
96127
96127
  ];
96128
96128
  });
96129
96129
 
@@ -96228,10 +96228,7 @@ async function loadSummaryModelChoices(summaryContext) {
96228
96228
  }
96229
96229
  const config = loadConfig5();
96230
96230
  const configuredSummaryModel = typeof config.summaryModel === "string" ? config.summaryModel.trim() : "";
96231
- const preferredDefaults = [
96232
- "anthropic/claude-haiku-4-5",
96233
- "openai-codex/gpt-5.3-codex-spark"
96234
- ];
96231
+ const preferredDefaults = ["anthropic/claude-haiku-4-5", "openai-codex/gpt-6.1-sol"];
96235
96232
  let defaultSummaryModel = null;
96236
96233
  if (configuredSummaryModel.length > 0 && availableValues.has(configuredSummaryModel)) {
96237
96234
  defaultSummaryModel = configuredSummaryModel;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.9.40-alpha.1",
3
+ "version": "0.9.40",
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": [
@@ -6,6 +6,31 @@ 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.40] - 2026-10-20
10
+
11
+ ### Added
12
+
13
+ - The workflow journal can be selected for one process with `ATOMIC_WORKFLOWS_JOURNAL`, `ATOMIC_STORAGE`, or Atomic's `--storage` and `--storage-file` flags, using the same JSON as the `workflows.journal` and `storage` settings. Setting `ATOMIC_WORKFLOWS_JOURNAL` together with `ATOMIC_WORKFLOW_JOURNAL_PATH` is rejected as a conflict ([#3783](https://github.com/bastani-inc/atomic/issues/3783)).
14
+
15
+ ### Changed
16
+
17
+ - Updated the bundled Impeccable skill to 4.7.0 with engine 0.1.16. Critique and audit can scan a running Electron, NW.js, CEF, or WebView2 app window through its debugging port (`impeccable detect --cdp 9222`), and critique runs its design review on iOS, Android, and adaptive projects instead of reporting an empty web scan as clean. New `straggler` and `unbalanced-heading` typography checks flag a paragraph ending on one word and a heading whose last line is a stub, and the detector raises fewer false alarms on hidden, screen-reader-only, and layered content. Decision and review pages follow the OS dark mode, `context` offers only workspaces that render a UI as targets, and the Claude Code design hook can be installed in your user settings instead of the project's. Live Mode now starts on LAN and Tailscale addresses over plain HTTP, copying works there when the clipboard API is unavailable, and an interrupted engine download cleans up after itself. Atomic's launcher still turns off the engine's choice reports and update check by default.
18
+
19
+ ### Fixed
20
+
21
+ - Resuming a workflow restores the background subagents its stages launched and delivers the stages' interrupted messages before the stage continues. Both happen visibly in the stage, and stages stay addressable at the same `workflow:<rootRunId>/...` targets ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
22
+ - An interrupted workflow run stays addressable after the session that launched it restarts, before you run `/workflow resume`. Sends to `workflow:<rootRunId>/<stage>` and `workflow:<rootRunId>/**` are queued in the run's own journal instead of failing with `Session not found`, and `intercom list` shows the run's stages as pending. Each queued message is delivered exactly once when its stage is live again, including messages sent while resume is starting. A queued message no longer makes a resume that started at the same time fail as stale. The background subagents that the run's stages launched stay addressable in the same interval: sends to them wait and are delivered once after the resumed stage restores them. If another Atomic session resumes the run instead, that session takes over the run's Intercom targets and the sends still waiting for the subagents get an error saying so ([#3760](https://github.com/bastani-inc/atomic/issues/3760)).
23
+ - A session created with its own `agentDir` now keeps its workflow runs in the same storage as its sessions. Relative paths, `{ file }` secrets, and storage adapters in a shared `storage` selection, from settings or from `ATOMIC_STORAGE`/`--storage`, previously resolved against the default Atomic home for workflow runs, and the default journal ignored the custom `agentDir` ([#3783](https://github.com/bastani-inc/atomic/issues/3783)).
24
+ - On Windows, removing a workflow's temporary worktree now deletes the worktree directory and leaves the main checkout's `node_modules` alone. Atomic unlinks the worktree's `node_modules` junction, and any other directory it linked, before asking Git to remove the worktree. Current Git for Windows left these worktrees behind, and older releases could delete the main checkout's `node_modules` through the junction. If Atomic cannot inspect or unlink one of these links, it leaves the worktree and its branch in place rather than risk Git following the link.
25
+ - Killing a workflow run while it waits, after Atomic restarts, for `/workflow resume` now ends the background subagents its stages launched. Their launch cards no longer show them as resumable, and reopening a stage's session no longer restores them ([#3784](https://github.com/bastani-inc/atomic/pull/3784)).
26
+ - Quitting Atomic after opening the workflow graph or `/workflow` run picker no longer prints an `AbortError: The operation was aborted.` trace. The graph overlay also remounts cleanly when it is opened again after a reload.
27
+
28
+ ## [0.9.40-alpha.2] - 2026-10-20
29
+
30
+ ### Fixed
31
+
32
+ - Quitting Atomic after opening the workflow graph or `/workflow` run picker no longer prints an `AbortError: The operation was aborted.` trace. The graph overlay also remounts cleanly when it is opened again after a reload.
33
+
9
34
  ## [0.9.40-alpha.1] - 2026-10-20
10
35
 
11
36
  ### Added
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.9.40-alpha.1",
3
+ "version": "0.9.40",
4
4
  "private": true,
5
5
  "description": "Atomic extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [
@@ -50018,6 +50018,7 @@ function buildGraphOverlayAdapter(pi, store, buildOpts = {}) {
50018
50018
  if (typeof custom !== "function")
50019
50019
  return;
50020
50020
  let settled = false;
50021
+ let finishThisMount;
50021
50022
  const factory = (tui, theme, keybindings, done) => {
50022
50023
  localTerminalModesSuppressed = tui.mode === "fullscreen";
50023
50024
  remoteTerminalControl = remoteTerminalControlFrom(tui);
@@ -50077,6 +50078,7 @@ function buildGraphOverlayAdapter(pi, store, buildOpts = {}) {
50077
50078
  });
50078
50079
  currentView = view;
50079
50080
  finishMounted = finish;
50081
+ finishThisMount = finish;
50080
50082
  mounted = true;
50081
50083
  updateTerminalAutowrap(true);
50082
50084
  updateMainChatInputHint(readHostCustomUiActive(ui));
@@ -50094,7 +50096,7 @@ function buildGraphOverlayAdapter(pi, store, buildOpts = {}) {
50094
50096
  updateMainChatInputHint(readHostCustomUiActive(ui));
50095
50097
  }
50096
50098
  };
50097
- custom(factory, options);
50099
+ Promise.resolve(custom(factory, options)).catch(() => finishThisMount?.());
50098
50100
  }
50099
50101
  function toggle(runId, surface) {
50100
50102
  observeHostCustomUi(surface?.ui ?? pi.ui);
@@ -88212,7 +88214,14 @@ function openSessionPicker(ui, store, theme, intent = "connect") {
88212
88214
  }
88213
88215
  };
88214
88216
  };
88215
- custom(factory, { overlay: false, purpose: "navigation" });
88217
+ Promise.resolve(custom(factory, { overlay: false, purpose: "navigation" })).catch(() => {
88218
+ unsubscribe?.();
88219
+ unsubscribe = null;
88220
+ if (settled)
88221
+ return;
88222
+ settled = true;
88223
+ resolve({ kind: "close" });
88224
+ });
88216
88225
  });
88217
88226
  }
88218
88227
 
package/dist/cli/args.js CHANGED
@@ -371,7 +371,7 @@ ${chalk.bold("Examples:")}
371
371
  ${APP_NAME} auth check --provider openai
372
372
 
373
373
  # Print an OAuth bearer token, refreshing it when under the minimum expiry
374
- ${APP_NAME} auth print-bearer-token --model gpt-5.5 --provider openai-codex --min-expiry 30m
374
+ ${APP_NAME} auth print-bearer-token --model gpt-6.1-sol --provider openai-codex --min-expiry 30m
375
375
 
376
376
  # Interactive mode
377
377
  ${APP_NAME}
@@ -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;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAwDlE,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAEn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;;;IAGR,QAAQ;;;IAGR,QAAQ;;;IAGR,QAAQ;;;IAGR,QAAQ;;;IAGR,QAAQ;;;IAGR,QAAQ;;;IAGR,QAAQ;;;IAGR,QAAQ;;;IAGR,QAAQ;;;IAGR,QAAQ;;;IAGR,QAAQ;;;IAGR,QAAQ,eAAe,eAAe;IACtC,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;;;oGAGiE,eAAe;;;;EAIjH,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\";\nimport { getToolListError } from \"../core/settings-merge.js\";\nimport { StorageConfigError } from \"../core/storage/errors.js\";\nimport { validateStoragePrefix } from \"../core/storage/prefix.js\";\nimport type { StorageFlagArgument } from \"../core/storage/process-selection.js\";\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\timport?: string;\n\tsessionId?: string;\n\tfork?: string;\n\tsessionDir?: string;\n\tsessionStorePath?: string;\n\tsessionPrefix?: string;\n\tstorage?: StorageFlagArgument;\n\tmodels?: string[];\n\ttools?: string[];\n\texcludeTools?: string[];\n\tnoTools?: boolean;\n\tnoBuiltinTools?: boolean;\n\textensions?: string[];\n\tnoExtensions?: boolean;\n\tnoMcp?: 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 === \"--import\" && i + 1 < args.length) {\n\t\t\tresult.import = 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\") {\n\t\t\tif (i + 1 === args.length) throw new StorageConfigError(\"cli\", \"--session-dir\", \"directory-required\");\n\t\t\tresult.sessionDir = args[++i];\n\t\t} else if (arg === \"--session-store\") {\n\t\t\tif (i + 1 === args.length) throw new StorageConfigError(\"cli\", arg, \"path-required\");\n\t\t\tresult.sessionStorePath = args[++i];\n\t\t} else if (arg === \"--session-prefix\") {\n\t\t\tif (i + 1 === args.length) throw new StorageConfigError(\"cli\", arg, \"prefix-required\");\n\t\t\tresult.sessionPrefix = args[++i];\n\t\t} else if (arg === \"--storage\" || arg === \"--storage-file\") {\n\t\t\tif (i + 1 === args.length) {\n\t\t\t\tthrow new StorageConfigError(\"cli\", arg, arg === \"--storage\" ? \"selection-required\" : \"path-required\");\n\t\t\t}\n\t\t\tif (result.storage !== undefined && result.storage.flag !== arg) {\n\t\t\t\tthrow new StorageConfigError(\"cli\", \"--storage, --storage-file\", \"conflicting-flags\");\n\t\t\t}\n\t\t\tresult.storage = { flag: arg, value: args[++i] };\n\t\t} else if (arg === \"--models\" && i + 1 < args.length) {\n\t\t\tresult.models = args[++i]\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((s) => s.trim())\n\t\t\t\t.filter((pattern) => pattern.length > 0);\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\tconst 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\tconst error = getToolListError(tools);\n\t\t\tif (error) result.diagnostics.push({ type: \"error\", message: `${arg}: ${error}` });\n\t\t\telse result.tools = tools;\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 === \"--no-mcp\") {\n\t\t\tresult.noMcp = 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\tif (result.sessionStorePath !== undefined) {\n\t\tconst conflict =\n\t\t\tresult.sessionDir !== undefined ? \"--session-dir\" : result.noSession ? \"--no-session\" : undefined;\n\t\tif (conflict) throw new StorageConfigError(\"cli\", `--session-store, ${conflict}`, \"conflicting-flags\");\n\t} else if (result.sessionPrefix !== undefined) {\n\t\tthrow new StorageConfigError(\"cli\", \"--session-prefix\", \"requires --session-store\");\n\t}\n\n\tif (result.sessionPrefix !== undefined) validateStoragePrefix(result.sessionPrefix);\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 <id|prefix> Use exact ID or unique 8-hex UUID prefix\n --import <file> Import a format-4 JSONL export into session storage\n --session-id <id> Use exact project session ID, creating it if missing\n --fork <id|prefix> Fork exact ID or unique 8-hex UUID prefix into a new session\n --session-dir <dir> Select JSONL session storage and lookup directory\n --session-store <path> Select a SQLite session database\n --session-prefix <prefix> Table prefix for --session-store (default: empty)\n --no-session Don't save session (ephemeral)\n --storage <json> Storage selection for this process's sessions and workflow runs,\n in the same JSON form as the \"storage\" setting; never saved\n --storage-file <path> Read the --storage selection from a JSON file\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, including Intercom, even with --tools\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 tool names or patterns (*)\n Keeps MCP tools unless an entry starts with mcp__\n Only +name/-name entries change the default selection\n --exclude-tools, -xt <tools> Comma-separated denylist of tool names or patterns (*), including MCP tools\n Intercom follows the allowlist and exclusions\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 --no-mcp Disable built-in MCP support for this run\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 # Codemode with only one MCP server's tools\n ${APP_NAME} --tools read,codemode,'mcp__docs__*'\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)} - Select JSONL session 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 ATOMIC_STORAGE - Storage selection JSON for sessions and workflow runs (overridden by --storage)\n ATOMIC_SESSIONS_STORAGE - Session-only storage selection JSON (cannot be combined with ${ENV_SESSION_DIR})\n ATOMIC_WORKFLOWS_JOURNAL - Workflow-run-only storage selection JSON\n ATOMIC_WORKFLOW_JOURNAL_PATH - Workflow journal SQLite path (cannot be combined with ATOMIC_WORKFLOWS_JOURNAL)\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
+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/**\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\";\nimport { getToolListError } from \"../core/settings-merge.js\";\nimport { StorageConfigError } from \"../core/storage/errors.js\";\nimport { validateStoragePrefix } from \"../core/storage/prefix.js\";\nimport type { StorageFlagArgument } from \"../core/storage/process-selection.js\";\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\timport?: string;\n\tsessionId?: string;\n\tfork?: string;\n\tsessionDir?: string;\n\tsessionStorePath?: string;\n\tsessionPrefix?: string;\n\tstorage?: StorageFlagArgument;\n\tmodels?: string[];\n\ttools?: string[];\n\texcludeTools?: string[];\n\tnoTools?: boolean;\n\tnoBuiltinTools?: boolean;\n\textensions?: string[];\n\tnoExtensions?: boolean;\n\tnoMcp?: 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 === \"--import\" && i + 1 < args.length) {\n\t\t\tresult.import = 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\") {\n\t\t\tif (i + 1 === args.length) throw new StorageConfigError(\"cli\", \"--session-dir\", \"directory-required\");\n\t\t\tresult.sessionDir = args[++i];\n\t\t} else if (arg === \"--session-store\") {\n\t\t\tif (i + 1 === args.length) throw new StorageConfigError(\"cli\", arg, \"path-required\");\n\t\t\tresult.sessionStorePath = args[++i];\n\t\t} else if (arg === \"--session-prefix\") {\n\t\t\tif (i + 1 === args.length) throw new StorageConfigError(\"cli\", arg, \"prefix-required\");\n\t\t\tresult.sessionPrefix = args[++i];\n\t\t} else if (arg === \"--storage\" || arg === \"--storage-file\") {\n\t\t\tif (i + 1 === args.length) {\n\t\t\t\tthrow new StorageConfigError(\"cli\", arg, arg === \"--storage\" ? \"selection-required\" : \"path-required\");\n\t\t\t}\n\t\t\tif (result.storage !== undefined && result.storage.flag !== arg) {\n\t\t\t\tthrow new StorageConfigError(\"cli\", \"--storage, --storage-file\", \"conflicting-flags\");\n\t\t\t}\n\t\t\tresult.storage = { flag: arg, value: args[++i] };\n\t\t} else if (arg === \"--models\" && i + 1 < args.length) {\n\t\t\tresult.models = args[++i]\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((s) => s.trim())\n\t\t\t\t.filter((pattern) => pattern.length > 0);\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\tconst 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\tconst error = getToolListError(tools);\n\t\t\tif (error) result.diagnostics.push({ type: \"error\", message: `${arg}: ${error}` });\n\t\t\telse result.tools = tools;\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 === \"--no-mcp\") {\n\t\t\tresult.noMcp = 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\tif (result.sessionStorePath !== undefined) {\n\t\tconst conflict =\n\t\t\tresult.sessionDir !== undefined ? \"--session-dir\" : result.noSession ? \"--no-session\" : undefined;\n\t\tif (conflict) throw new StorageConfigError(\"cli\", `--session-store, ${conflict}`, \"conflicting-flags\");\n\t} else if (result.sessionPrefix !== undefined) {\n\t\tthrow new StorageConfigError(\"cli\", \"--session-prefix\", \"requires --session-store\");\n\t}\n\n\tif (result.sessionPrefix !== undefined) validateStoragePrefix(result.sessionPrefix);\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 <id|prefix> Use exact ID or unique 8-hex UUID prefix\n --import <file> Import a format-4 JSONL export into session storage\n --session-id <id> Use exact project session ID, creating it if missing\n --fork <id|prefix> Fork exact ID or unique 8-hex UUID prefix into a new session\n --session-dir <dir> Select JSONL session storage and lookup directory\n --session-store <path> Select a SQLite session database\n --session-prefix <prefix> Table prefix for --session-store (default: empty)\n --no-session Don't save session (ephemeral)\n --storage <json> Storage selection for this process's sessions and workflow runs,\n in the same JSON form as the \"storage\" setting; never saved\n --storage-file <path> Read the --storage selection from a JSON file\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, including Intercom, even with --tools\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 tool names or patterns (*)\n Keeps MCP tools unless an entry starts with mcp__\n Only +name/-name entries change the default selection\n --exclude-tools, -xt <tools> Comma-separated denylist of tool names or patterns (*), including MCP tools\n Intercom follows the allowlist and exclusions\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 --no-mcp Disable built-in MCP support for this run\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-6.1-sol --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 # Codemode with only one MCP server's tools\n ${APP_NAME} --tools read,codemode,'mcp__docs__*'\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)} - Select JSONL session 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 ATOMIC_STORAGE - Storage selection JSON for sessions and workflow runs (overridden by --storage)\n ATOMIC_SESSIONS_STORAGE - Session-only storage selection JSON (cannot be combined with ${ENV_SESSION_DIR})\n ATOMIC_WORKFLOWS_JOURNAL - Workflow-run-only storage selection JSON\n ATOMIC_WORKFLOW_JOURNAL_PATH - Workflow journal SQLite path (cannot be combined with ATOMIC_WORKFLOWS_JOURNAL)\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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/export-html/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAQhE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,oFAAoF;IACpF,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACpF,4GAA4G;IAC5G,YAAY,CACX,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAChF,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,GACd;QAAE,SAAS,CAAC,EAAE,M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AE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACzD;AASD,MAAM,WAAW,aAAa;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAkMD;;;GAGG;AACH,wBAAsB,mBAAmB,CACxC,EAAE,EAAE,cAAc,EAClB,KAAK,CAAC,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,GAC9B,OAAO,CAAC,MAAM,CAAC,CA2CjB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BzG"}
@@ -5,7 +5,6 @@ import { getResolvedThemeColors, getThemeExportColors } from "../../modes/intera
5
5
  import { normalizePath, resolvePath } from "../../utils/paths.js";
6
6
  import { SessionManager } from "../session-manager.js";
7
7
  import { SessionNotFoundError } from "../storage/session/errors.js";
8
- import { readExportHtmlTemplateScript } from "./template-script.js";
9
8
  /** Parse a color string to RGB values. Supports hex (#RRGGBB) and rgb(r,g,b) formats. */
10
9
  function parseColor(color) {
11
10
  const hexMatch = color.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);
@@ -92,8 +91,9 @@ function generateHtml(sessionData, themeName) {
92
91
  const templateDir = getExportTemplateDir();
93
92
  const template = readFileSync(join(templateDir, "template.html"), "utf-8");
94
93
  const templateCss = readFileSync(join(templateDir, "template.css"), "utf-8");
95
- const templateJs = readExportHtmlTemplateScript(templateDir);
94
+ const templateJs = readFileSync(join(templateDir, "template.js"), "utf-8");
96
95
  const markedJs = readFileSync(join(templateDir, "vendor", "marked.min.js"), "utf-8");
96
+ const markedCjkFriendlyJs = readFileSync(join(templateDir, "vendor", "marked-cjk-friendly.min.js"), "utf-8");
97
97
  const hljsJs = readFileSync(join(templateDir, "vendor", "highlight.min.js"), "utf-8");
98
98
  const themeVars = generateThemeVars(themeName);
99
99
  const colors = getResolvedThemeColors(themeName);
@@ -115,6 +115,7 @@ function generateHtml(sessionData, themeName) {
115
115
  .replace("{{JS}}", templateJs)
116
116
  .replace("{{SESSION_DATA}}", sessionDataBase64)
117
117
  .replace("{{MARKED_JS}}", markedJs)
118
+ .replace("{{MARKED_CJK_FRIENDLY_JS}}", markedCjkFriendlyJs)
118
119
  .replace("{{HIGHLIGHT_JS}}", hljsJs);
119
120
  }
120
121
  /** Tools rendered directly by the HTML template (not pre-rendered via TUI→ANSI→HTML pipeline) */