@oh-my-pi/pi-coding-agent 16.4.8 → 16.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/dist/cli.js +3502 -3444
  3. package/dist/types/cli/args.d.ts +5 -0
  4. package/dist/types/cli/gallery-fixtures/shell.d.ts +1 -1
  5. package/dist/types/commands/launch.d.ts +15 -0
  6. package/dist/types/config/model-resolver.d.ts +4 -3
  7. package/dist/types/config/model-roles.d.ts +8 -0
  8. package/dist/types/config/settings-schema.d.ts +46 -14
  9. package/dist/types/extensibility/extensions/types.d.ts +1 -1
  10. package/dist/types/launch/broker.d.ts +2 -0
  11. package/dist/types/launch/client.d.ts +22 -0
  12. package/dist/types/launch/paths.d.ts +4 -0
  13. package/dist/types/launch/presence.d.ts +8 -0
  14. package/dist/types/launch/protocol.d.ts +170 -0
  15. package/dist/types/launch/terminal-output.d.ts +7 -0
  16. package/dist/types/modes/components/agent-hub.d.ts +1 -1
  17. package/dist/types/modes/components/index.d.ts +1 -0
  18. package/dist/types/modes/components/model-browser.d.ts +17 -2
  19. package/dist/types/modes/components/model-hub.d.ts +0 -10
  20. package/dist/types/modes/components/model-picker.d.ts +44 -0
  21. package/dist/types/modes/components/status-line/types.d.ts +3 -0
  22. package/dist/types/modes/print-mode.d.ts +14 -8
  23. package/dist/types/modes/print-mode.test.d.ts +1 -0
  24. package/dist/types/modes/theme/theme.d.ts +2 -1
  25. package/dist/types/sdk.d.ts +5 -1
  26. package/dist/types/session/agent-session.d.ts +42 -0
  27. package/dist/types/session/session-context.d.ts +9 -0
  28. package/dist/types/session/session-entries.d.ts +6 -0
  29. package/dist/types/thinking.d.ts +2 -2
  30. package/dist/types/tiny/models.d.ts +1 -1
  31. package/dist/types/tools/browser/launch.d.ts +1 -0
  32. package/dist/types/tools/browser/run-cancellation.d.ts +28 -2
  33. package/dist/types/tools/browser/tab-protocol.d.ts +6 -0
  34. package/dist/types/tools/browser/tab-worker.d.ts +6 -0
  35. package/dist/types/tools/builtin-names.d.ts +1 -1
  36. package/dist/types/tools/index.d.ts +1 -0
  37. package/dist/types/tools/launch.d.ts +121 -0
  38. package/dist/types/tools/render-utils.d.ts +2 -0
  39. package/dist/types/tools/terminal-output.d.ts +5 -0
  40. package/dist/types/vibe/runtime.d.ts +2 -2
  41. package/dist/types/web/search/types.d.ts +0 -8
  42. package/package.json +20 -20
  43. package/src/cli/args.ts +11 -0
  44. package/src/cli/flag-tables.ts +9 -0
  45. package/src/cli/gallery-fixtures/shell.ts +82 -1
  46. package/src/cli.ts +10 -0
  47. package/src/commands/launch.ts +17 -0
  48. package/src/config/model-resolver.ts +110 -31
  49. package/src/config/model-roles.ts +14 -0
  50. package/src/config/settings-schema.ts +71 -7
  51. package/src/edit/renderer.ts +13 -10
  52. package/src/eval/__tests__/agent-bridge.test.ts +2 -2
  53. package/src/eval/__tests__/completion-bridge.test.ts +1 -1
  54. package/src/eval/completion-bridge.ts +4 -4
  55. package/src/export/ttsr.ts +0 -3
  56. package/src/extensibility/extensions/model-api.ts +1 -1
  57. package/src/extensibility/extensions/types.ts +1 -1
  58. package/src/internal-urls/docs-index.ts +4 -4
  59. package/src/launch/broker.ts +1017 -0
  60. package/src/launch/client.ts +344 -0
  61. package/src/launch/paths.ts +17 -0
  62. package/src/launch/presence.ts +82 -0
  63. package/src/launch/protocol.ts +386 -0
  64. package/src/launch/terminal-output.ts +46 -0
  65. package/src/main.ts +50 -1
  66. package/src/modes/acp/acp-agent.ts +8 -1
  67. package/src/modes/components/agent-hub.ts +101 -31
  68. package/src/modes/components/compaction-summary-message.ts +8 -2
  69. package/src/modes/components/index.ts +1 -0
  70. package/src/modes/components/model-browser.ts +111 -21
  71. package/src/modes/components/model-hub.ts +23 -116
  72. package/src/modes/components/model-picker.ts +233 -0
  73. package/src/modes/components/snapcompact-shape-preview-doc.md +7 -11
  74. package/src/modes/components/status-line/component.test.ts +41 -2
  75. package/src/modes/components/status-line/component.ts +4 -0
  76. package/src/modes/components/status-line/segments.ts +6 -0
  77. package/src/modes/components/status-line/types.ts +3 -0
  78. package/src/modes/controllers/command-controller.ts +9 -1
  79. package/src/modes/controllers/event-controller.ts +31 -32
  80. package/src/modes/controllers/selector-controller.ts +96 -22
  81. package/src/modes/controllers/tan-command-controller.ts +40 -1
  82. package/src/modes/interactive-mode.ts +7 -3
  83. package/src/modes/print-mode.test.ts +71 -0
  84. package/src/modes/print-mode.ts +51 -2
  85. package/src/modes/theme/theme.ts +9 -0
  86. package/src/modes/utils/ui-helpers.ts +25 -4
  87. package/src/prompts/agents/designer.md +1 -1
  88. package/src/prompts/agents/librarian.md +1 -1
  89. package/src/prompts/agents/reviewer.md +1 -1
  90. package/src/prompts/agents/scout.md +1 -1
  91. package/src/prompts/system/plan-yolo-handoff.md +5 -0
  92. package/src/prompts/system/prewalk-checklist.md +7 -0
  93. package/src/prompts/system/prewalk-continue.md +1 -0
  94. package/src/prompts/system/prewalk-plan.md +13 -0
  95. package/src/prompts/system/system-prompt.md +9 -7
  96. package/src/prompts/system/tan-context-switch.md +17 -0
  97. package/src/prompts/tools/bash.md +6 -4
  98. package/src/prompts/tools/browser.md +4 -4
  99. package/src/prompts/tools/launch.md +25 -0
  100. package/src/sdk.ts +8 -2
  101. package/src/session/agent-session.ts +550 -87
  102. package/src/session/session-context.test.ts +10 -5
  103. package/src/session/session-context.ts +25 -8
  104. package/src/session/session-entries.ts +6 -0
  105. package/src/slash-commands/builtin-registry.ts +25 -0
  106. package/src/task/agents.ts +2 -2
  107. package/src/thinking.ts +10 -3
  108. package/src/tiny/models.ts +7 -7
  109. package/src/tools/bash-interactive.ts +5 -8
  110. package/src/tools/bash.ts +38 -24
  111. package/src/tools/browser/cmux/cmux-tab.ts +17 -2
  112. package/src/tools/browser/launch.ts +8 -4
  113. package/src/tools/browser/run-cancellation.ts +66 -6
  114. package/src/tools/browser/tab-protocol.ts +6 -0
  115. package/src/tools/browser/tab-supervisor.ts +17 -1
  116. package/src/tools/browser/tab-worker.ts +140 -21
  117. package/src/tools/builtin-names.ts +1 -0
  118. package/src/tools/eval-render.ts +16 -14
  119. package/src/tools/index.ts +5 -0
  120. package/src/tools/inspect-image.ts +2 -2
  121. package/src/tools/launch.ts +643 -0
  122. package/src/tools/render-utils.ts +3 -0
  123. package/src/tools/renderers.ts +2 -0
  124. package/src/tools/terminal-output.ts +141 -0
  125. package/src/tts/speech-enhancer.ts +2 -2
  126. package/src/utils/image-vision-fallback.ts +3 -3
  127. package/src/vibe/runtime.ts +2 -2
  128. package/src/web/search/provider.ts +0 -10
  129. package/src/web/search/providers/public.ts +2 -4
  130. package/src/web/search/types.ts +0 -10
  131. package/dist/types/web/search/providers/bing.d.ts +0 -14
  132. package/dist/types/web/search/providers/yahoo.d.ts +0 -14
  133. package/src/web/search/providers/bing.ts +0 -197
  134. package/src/web/search/providers/yahoo.ts +0 -179
@@ -45,7 +45,7 @@ import {
45
45
  SKILL_PROMPT_MESSAGE_TYPE,
46
46
  type SkillPromptDetails,
47
47
  } from "../../session/messages";
48
- import type { SessionContext } from "../../session/session-context";
48
+ import type { SessionContext, StrippedToolCallsMarker } from "../../session/session-context";
49
49
  import { replaceTabs } from "../../tools/render-utils";
50
50
  import { buildSkillCommandPrompt, invokeSkillCommandFromText, isKnownSkillCommand } from "../skill-command";
51
51
  import { createAssistantMessageComponent } from "./interactive-context-helpers";
@@ -465,6 +465,26 @@ export class UiHelpers {
465
465
  this.ctx.pendingTools.set(content.id, component);
466
466
  }
467
467
  }
468
+ // Dangling toolCalls (no result on the resolved path — failed or
469
+ // retried turns, results on sibling branches) were stripped by the
470
+ // context build; surface a placeholder so the turn's activity is
471
+ // visibly elided instead of silently vanishing (the "bare thinking
472
+ // lines" transcript trap).
473
+ const strippedToolCalls = (message as AgentMessage & StrippedToolCallsMarker).strippedToolCalls ?? 0;
474
+ if (strippedToolCalls > 0) {
475
+ this.ctx.chatContainer.addChild(
476
+ new Text(
477
+ theme.fg(
478
+ "dim",
479
+ theme.italic(
480
+ `${strippedToolCalls} tool call${strippedToolCalls === 1 ? "" : "s"} elided — no result on this branch`,
481
+ ),
482
+ ),
483
+ 1,
484
+ 0,
485
+ ),
486
+ );
487
+ }
468
488
  pendingUsage =
469
489
  this.ctx.settings.get("display.showTokenUsage") && assistantUsageIsBilled(message.usage)
470
490
  ? message.usage
@@ -607,13 +627,14 @@ export class UiHelpers {
607
627
  this.ctx.pendingBashComponents = [];
608
628
  this.ctx.pendingPythonComponents = [];
609
629
 
610
- // Live display uses the compacted transcript tail; export/resume callers
611
- // can still request the full inline compaction history. Mid-turn rebuilds
630
+ // Live display collapses to the compacted transcript tail unless the
631
+ // user opted into the full inline history; export/resume callers can
632
+ // still request either mode. Mid-turn rebuilds
612
633
  // (focus attach/unfocus while a tool executes) keep dangling toolCalls so
613
634
  // the in-flight call re-renders as pending instead of vanishing;
614
635
  // renderSessionContext then keeps it in `pendingTools` for live routing.
615
636
  const context = this.ctx.viewSession.buildTranscriptSessionContext({
616
- collapseCompactedHistory: true,
637
+ collapseCompactedHistory: settings.get("display.collapseCompacted"),
617
638
  keepDanglingToolCalls: this.ctx.viewSession.isStreaming,
618
639
  });
619
640
  this.ctx.renderSessionContext(context, {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: designer
3
3
  description: UI/UX specialist for design implementation, review, visual refinement
4
- model: pi/designer
4
+ model: "@designer"
5
5
  ---
6
6
 
7
7
  Implement and review UI designs. Edit files, create components, run commands when needed.
@@ -2,7 +2,7 @@
2
2
  name: librarian
3
3
  description: Researches external libraries and APIs by reading source code. Returns definitive, source-verified answers.
4
4
  tools: read, grep, glob, bash, lsp, web_search, ast_grep
5
- model: pi/smol
5
+ model: "@smol"
6
6
  thinking-level: minimal
7
7
  read-summarize: false
8
8
  output:
@@ -3,7 +3,7 @@ name: reviewer
3
3
  description: "Code review specialist for quality/security analysis"
4
4
  tools: read, grep, glob, bash, lsp, web_search, ast_grep
5
5
  spawns: scout
6
- model: pi/slow
6
+ model: "@slow"
7
7
  output:
8
8
  properties:
9
9
  overall_correctness:
@@ -2,7 +2,7 @@
2
2
  name: scout
3
3
  description: MUST be used for exploratory codebase research, rapid code analysis, and broad pattern searches. Fast read-only scout returning compressed context for handoff.
4
4
  tools: read, grep, glob, web_search
5
- model: pi/smol
5
+ model: "@smol"
6
6
  thinking-level: medium
7
7
  read-summarize: false
8
8
  output:
@@ -0,0 +1,5 @@
1
+ Plan approved: **{{title}}**.
2
+
3
+ Read `{{planFilePath}}` and implement it now — full tool access is restored. Execute the plan top to bottom exactly as written; you were not part of drafting it, so treat every choice in it as already made. Do not ask for further approval and do not re-plan.
4
+
5
+ When finished, re-read the plan and confirm every step was completed before ending your turn.
@@ -0,0 +1,7 @@
1
+ Before you consider this task finished, verify:
2
+
3
+ - Consistency: if you changed a pattern, signature, or check in one place, grep for every other call site or duplicate copy that needs the identical change. A fix applied to only some of the matching sites is still a failure.
4
+ - Scope: if your diff does more than the minimal change needed to resolve the issue, confirm you have not altered behavior for any case outside the reported issue. Prefer the smallest correct diff over a broader rewrite.
5
+ - Verification: run the full test module or file the issue lives in, not just the one test you expect to flip. A change that breaks a sibling test is not a fix.
6
+
7
+ Do not claim the task is complete until you have done these three checks.
@@ -0,0 +1 @@
1
+ Continue the task now — do not end your turn here.
@@ -0,0 +1,13 @@
1
+ Stop and write the complete plan in your NEXT reply — before any further exploration. You have already seen enough to commit to a plan; do not defer this.
2
+
3
+ First, state the plan itself, explicitly and comprehensively:
4
+
5
+ - Every remaining step in execution order, with the exact files, symbols, commands, and checks involved.
6
+ - Known risks, edge cases, and how you will verify each step actually landed (specific commands, expected outputs). Never modify tests or verification assets to make checks pass.
7
+ - What is already done, stated briefly, so no step gets repeated.
8
+
9
+ Be thorough and concrete — this plan is the reference for the remainder of the run. You may verify details with tools after the plan is written, never before.
10
+
11
+ Then, only once the plan above is complete, in the SAME reply, capture it as a todo list (the todo tool): 5-9 items, one per MEANINGFUL step, each naming its concrete target and its verification. Only steps that change or verify code belong on the list — no reporting, bookkeeping, cleanup-ceremony, or release-note items. The todo list serves the task, never the reverse: when reality disagrees with an item, fix the actual problem rather than working the checklist.
12
+
13
+ This is a checkpoint, not a final answer: do not end your turn on the plan alone — after recording the todo list, continue the task; do not stop here.
@@ -192,7 +192,7 @@ EXECUTION WORKFLOW
192
192
 
193
193
  # 3. Decompose
194
194
  - Update todos as you go; skip them for trivial requests. Marking a todo done is a transition: start the next in the same turn.
195
- - Plan only what makes the request work. Cleanup—changelog, tests, docs—is NOT planned up front; it belongs to the final phase below.
195
+ - Plan only what makes the request work. Cleanup—changelog, docs, removing scaffolding—is NOT planned up front; it belongs to the final phase below. Tests are cleanup only for permanent feature/bug-fix work (see Cleanup).
196
196
 
197
197
  # 4. Implement
198
198
  - Fix problems at the source. Remove obsolete code—no leftover comments, aliases, or re-exports.
@@ -202,14 +202,16 @@ EXECUTION WORKFLOW
202
202
  {{#has tools "ask"}}- Ask before destructive commands or deleting code you didn't write.{{else}}- Don't run destructive git commands or delete code you didn't write.{{/has}}
203
203
 
204
204
  # 5. Verify
205
- - NEVER yield non-trivial work without proof: tests, E2E, browsing, or QA.
206
- - Every test MUST defend an observable contract and fail on a plausible bug.
207
- - Test behavior, boundaries, invariants, transitions, precedence, and real errors—not plumbing, source text, or incidental defaults.
208
- - Match existing conventions; keep tests deterministic, isolated, and full-suite safe.
209
- - Run only touched tests; small/no-test changes still REQUIRE a focused behavioral smoke test.
205
+ - NEVER yield non-trivial work without proof that the deliverable works. The proof method depends on the ask:
206
+ - **Experiment / investigation** run it. The output IS the proof. No tests.
207
+ - **UI change** drive it in browser. Visual confirmation IS the proof. No tests unless the existing suite breaks and the break is real.
208
+ - **Bug fix** reproduce the bug, apply the fix, confirm the reproduction no longer triggers.
209
+ - **Permanent feature / API change** → existing tests that cover the changed contract. Add a test only when the change introduces a new observable contract not already covered, or the user asked for one.
210
+ - Smoke test: run the thing, not a test file. Launch it, exercise the changed path, observe the result.
211
+ - When you ARE writing tests (not the default): every test MUST defend an observable contract and fail on a plausible bug. Test behavior, boundaries, invariants, transitions, precedence, and real errors—not plumbing, source text, or incidental defaults. Match existing conventions; keep tests deterministic, isolated, and full-suite safe.
210
212
 
211
213
  # 6. Cleanup
212
- Changelog, tests, docs, and removing scaffolding are the LAST phase—NEVER skipped, but gated on the request demonstrably working.
214
+ Changelog and removing scaffolding are the LAST phase—NEVER skipped, but gated on the request demonstrably working. Tests and docs are cleanup ONLY when the work is a permanent feature change or bug fix, not for experiments or one-off investigations.
213
215
 
214
216
  - NEVER start, pre-plan, or pre-allocate todos for cleanup before you've made the request work and smoke-tested it. Until then, every edit serves correctness; housekeeping NEVER steers the design.
215
217
  - Once your smoke test confirms “it works,” do the cleanup in full before yielding.
@@ -0,0 +1,17 @@
1
+ <system-notice cause="fork">
2
+ The conversation above belongs to your parent session.
3
+ You are a fork created solely to handle the user's request below.
4
+
5
+ Your parent agent is still working on the original task — that responsibility is
6
+ NOT yours. You have no obligations from the prior conversation.
7
+
8
+ - Focus EXCLUSIVELY on the user's immediate request. Nothing else.
9
+ - NEVER continue, follow up on, or intervene in anything discussed before this
10
+ message. Those belong to the parent session.
11
+ - Your parent is CONCURRENTLY editing this same working directory. Files may
12
+ change between your reads, look mid-refactor, or fail to compile. That is the
13
+ parent's live work — NEVER fix, audit, or build on it, even if it looks broken.
14
+ - Any todo list, plan, or unfinished checklist from the prior conversation is
15
+ the parent's. NEVER resume or update it.
16
+ - After addressing the user's request, STOP. Do not work on ANY OTHER TASK.
17
+ </system-notice>
@@ -5,6 +5,7 @@ Runs commands in the embedded shell — terminal ops: git, bun, cargo, python.
5
5
  The shell invokes **real binaries** with simple args. It is NOT full GNU Bash.
6
6
 
7
7
  Use bash ONLY for: a single binary call, or one short pipeline that COMPUTES a fact and does not depend on shell-specific regex/quoting (`wc -l`, `sort | uniq -c`, `comm`, `diff`, a checksum, `git status`).
8
+ {{#if hasLaunch}}Long-running service, watcher, debugger, REPL, or process needing later input? MUST use `launch`, not bash.{{/if}}
8
9
 
9
10
  {{#if hasEval}}Anything below → `eval` cell, not bash:
10
11
  - Inline interpreter scripts (`-e`/`-c`/`--eval`) when an eval runtime exists for that language
@@ -33,7 +34,7 @@ Use bash ONLY for: a single binary call, or one short pipeline that COMPUTES a f
33
34
  - Internal URIs (`skill://`, `agent://`, …) auto-resolve to FS paths
34
35
  {{#if hasEval}}- Need exact pipeline semantics (`cmd | head`, multi-stage filtering) or output truncation? Prefer `eval` and process the stream directly.{{else}}- Need exact pipeline semantics (`cmd | head`, multi-stage filtering) or output truncation? Use a checked-in script, purpose-built tool, or single command that owns the output shape.{{/if}}
35
36
  {{#if asyncEnabled}}
36
- - `async: true` for long-running commands when you don't need immediate output: returns a background job ID; result delivered as a follow-up.
37
+ - `async: true` defers reporting for finite commands that need no later input; completion arrives as a follow-up.
37
38
  {{/if}}
38
39
  </instruction>
39
40
 
@@ -42,6 +43,7 @@ Use bash ONLY for: a single binary call, or one short pipeline that COMPUTES a f
42
43
  {{#if hasGrep}}- NEVER shell out to search content or files: `grep/rg` → `grep`.{{else}}- Avoid shelling out for broad content search; use an active search/read tool when one is available.{{/if}}
43
44
  {{#if hasRead}}{{#if hasGlob}}- NEVER use `ls` or `find` to list or locate files — `ls` → `read` (a directory path lists entries), `find` → the `glob` tool (globbing). This is non-negotiable, even for a single quick listing.{{else}}- Prefer `read` for known file and directory reads. Only use shell listing when no file-listing tool is active.{{/if}}{{else}}{{#if hasGlob}}- Prefer `glob` for file discovery; avoid `find` when `glob` is active.{{else}}- If no file read/listing tool is active, keep shell inspection narrow and state that limitation.{{/if}}{{/if}}
44
45
  - Avoid head/tail/redirections: stderr already merged; long output auto-truncated, FULL capture kept at `artifact://<id>`.
46
+ {{#if hasLaunch}}- NEVER launch daemons, watchers, dev servers, debuggers, or REPLs through bash/background shell syntax — use `launch`.{{/if}}
45
47
  </critical>
46
48
 
47
49
  <output>
@@ -52,9 +54,9 @@ Use bash ONLY for: a single binary call, or one short pipeline that COMPUTES a f
52
54
  {{#if asyncEnabled}}
53
55
  # Timeout and async
54
56
 
55
- - `timeout` is seconds; nonzero values are clamped to `1..3600` and the process is killed on elapse. Set `timeout: 0` only for commands that must run until completion or explicit cancellation.
56
- - `async: true` defers only reporting it does NOT extend a nonzero timeout; use `timeout: 0` when a daemon or watcher must be cancellation-owned.
57
- - Need a daemon or >3600s run? Use `async: true` with `timeout: 0` when the harness should keep it alive until cancellation, or detach/manage lifecycle yourself (`cmd &`, supervisor, self-restarting script). The shell session persists across calls.
57
+ - `timeout` is seconds; nonzero values are clamped to `1..3600` and the process is killed on elapse. Set `timeout: 0` only for finite commands whose completion is cancellation-owned.
58
+ - `async: true` defers only reporting; it does NOT extend a nonzero timeout.
59
+ {{#if hasLaunch}}- Need a service, watcher, debugger, REPL, or later stdin? MUST use `launch`. NEVER use `cmd &`, `nohup`, or async bash as a process supervisor.{{else}}- Need a long-running process or >3600s run? Use an external process supervisor; avoid detached shell jobs you cannot later observe or stop.{{/if}}
58
60
  {{/if}}
59
61
  {{#if autoBackgroundEnabled}}
60
62
 
@@ -5,7 +5,7 @@ Drives real Chromium tab; full puppeteer access via JS.
5
5
  - Three actions:
6
6
  - `open` — acquire/reuse named tab (`name` defaults `"main"`). Optional `url` (navigate once ready), `viewport`, `dialogs: "accept" | "dismiss"` (auto-handle `alert`/`confirm`/`beforeunload`; else page hangs till you wire `page.on('dialog', …)`).
7
7
  - `close` — release tab by `name`, or all with `all: true`. `kill: true` also kills spawned-app process trees.
8
- - `run` — execute JS in existing tab. `code` = async function body; `page`, `browser`, `tab`, `display`, `assert`, `wait` in scope. Return value JSON-stringified into result; `display(value)` accumulates text/images.
8
+ - `run` — execute JS in existing tab. `code` = async function body; `page`, `browser`, `tab`, `display`, `assert`, `wait` in scope. Return value JSON-stringified into result; `display(value)` accumulates text/images. `wait(ms)` sleeps; `wait(fn, { timeout?, interval? })` polls `fn` (sync or async) until truthy and resolves with that value (default 100ms interval; deadline min(30s, cell budget − 1s), named error on timeout) — use it instead of in-page polling Promises inside `tab.evaluate`.
9
9
  - Tabs survive `run` calls and in-process subagents — open once, reuse.
10
10
  - Browser kinds (`app` on `open`):
11
11
  - default (no `app`) → headless Chromium with stealth patches.
@@ -13,7 +13,7 @@ Drives real Chromium tab; full puppeteer access via JS.
13
13
  - `app.cdp_url` → connect to existing CDP endpoint (e.g. `http://127.0.0.1:9222`).
14
14
  - `app.target` (with `path`/`cdp_url`) — substring on url+title picks BrowserWindow.
15
15
  - `tab` helpers; drop to raw puppeteer `page` for anything uncovered:
16
- - `tab.goto(url, { waitUntil? })` — navigate.
16
+ - `tab.goto(url, { waitUntil? })` — navigate. A hung load fails ~1s before the cell budget with a named, catchable error and the pending navigation is stopped; for slow pages raise `timeout` or use `waitUntil: "domcontentloaded"`.
17
17
  - `tab.observe({ includeAll?, viewportOnly? })` — accessibility snapshot: `{ url, title, viewport, scroll, elements: [{ id, role, name, value, states, … }] }`. Ids stable until next observe/goto.
18
18
  - `tab.ariaSnapshot(selector?, { depth?, boxes? })` — Playwright-format ARIA-tree YAML (nested roles + accessible names + `/url`/`/placeholder`), scoped to `selector` or the whole document. Every node carries a `[ref=eN]` id; `[cursor=pointer]` flags clickables. Captures dense, hierarchical structure/text that `observe()`'s flat list flattens away. Refs renumber from e1 each call and stay valid until the next `ariaSnapshot()`.
19
19
  - `tab.ref("e5")` — `[ref=eN]` from the last ariaSnapshot → element handle with the common action methods (`.click()`, `.type()`, `.fill()`, `.hover()`, `.evaluate()`, …); the primary way to act on a ref. For convenience `aria-ref=e5` also works inline in `tab.click`/`type`/`fill`/`waitFor`/`scrollIntoView` (e.g. `tab.click("aria-ref=e5")`).
@@ -27,10 +27,10 @@ Drives real Chromium tab; full puppeteer access via JS.
27
27
  - `tab.waitForUrl(pattern, { timeout? })` — substring or `RegExp` (matches SPA pushState nav); returns matched URL.
28
28
  - `tab.waitForResponse(pattern, { timeout? })` — substring, `RegExp`, or `(response) => boolean`; returns puppeteer `HTTPResponse` (`.text()`/`.json()`/`.status()`/`.headers()`).
29
29
  - `tab.waitForNavigation({ waitUntil?, timeout? })` — resolves on the next navigation. Start it BEFORE the click/submit that triggers it; after `tab.goto` (which already waits) use `tab.waitForUrl`/`tab.waitForSelector` instead.
30
- - `tab.evaluate(fn, …args)` — `page.evaluate` for ad-hoc DOM reads.
30
+ - `tab.evaluate(fn, …args)` — run ad-hoc code in the page's MAIN world. DOM and page-defined globals (`window.myFlag`) are visible; mutations affect the page.
31
31
  - `tab.screenshot({ selector?, fullPage?, save?, silent? })` — capture + attach for viewing (`silent: true` skips). Pass `save` only when a later step needs the file.
32
32
  - `tab.extract(format = "markdown")` — readable page content (`"markdown"` | `"text"`); throws when nothing readable.
33
- - Selectors: CSS + puppeteer handlers `aria/Sign in`, `text/Continue`, `xpath/…`, `pierce/…`; also Playwright-style `p-aria/…`, `p-text/…`. Playwright-only engines/pseudos (`:has-text()`, `:visible`, …) are rejected — use `text/…` or `aria/…`. A stalled action/wait fails fast with a named `tab.<op>` error carrying a match-count diagnosis, never the whole-cell timeout; a selector matching nothing fails in ~2s (pass an explicit `{ timeout }` to `waitFor`/`waitForSelector` to wait out slow-appearing elements).
33
+ - Selectors: CSS + puppeteer handlers `aria/Sign in`, `text/Continue`, `xpath/…`, `pierce/…`; also Playwright-style `p-aria/…`, `p-text/…`. Playwright-only engines/pseudos (`:has-text()`, `:visible`, …) are rejected — use `text/…` or `aria/…`. A stalled action/wait fails fast with a named `tab.<op>` error carrying a match-count diagnosis, never the whole-cell timeout; a selector matching nothing fails in ~2s (pass an explicit `{ timeout }` to `waitFor`/`waitForSelector` to wait out slow-appearing elements). A whole-cell timeout names the stalled op (including `wait(…)`) and any unhandled dialog blocking the page.
34
34
  </instruction>
35
35
 
36
36
  <critical>
@@ -0,0 +1,25 @@
1
+ Launches and controls project-scoped long-running processes shared by every omp instance in the same directory.
2
+
3
+ <instruction>
4
+ - Long-running service, watcher, debugger, REPL, or process needing later input? MUST use `launch`, not `bash`.
5
+ - `start` launches `application` + `args` directly. `cwd` defaults to the session directory; `pty` defaults true.
6
+ - `ready.log` is a regex; `ready.port` is a TCP port. Both supplied? BOTH MUST pass. `ready.timeout` is seconds.
7
+ - Names are unique per project directory. A completed name MAY be started again; a live name MUST be stopped or restarted.
8
+ - `list`, `logs`, `wait`, `send`, `stop`, `restart`, and `describe` address the stable `name`.
9
+ - `logs` defaults to the last 100 lines. `head: true` reads the beginning. `grep` is a regex.
10
+ - `logs` with `follow: true` waits for output after `cursor`; reuse the returned cursor on the next call.
11
+ - `wait` blocks until readiness/exit/pattern or timeout. Use it only when blocked; do useful work instead of tight polling.
12
+ - `send.text` writes stdin; `enter` defaults true. `keys` supports ENTER, TAB, ESCAPE, CTRL_C, CTRL_D, UP, DOWN, LEFT, RIGHT.
13
+ - `send.signal` supports SIGINT, SIGTERM, SIGHUP, SIGQUIT, SIGKILL. PTY input is serialized; many clients MAY observe, but writes share one input stream.
14
+ - `stop` performs graceful process-tree termination before hard-kill. `restart` reuses the retained launch spec.
15
+ - `restart` policy defaults `no`; `on-failure` and `always` use bounded backoff.
16
+ - `persist: true` opts out of last-omp teardown. Otherwise the broker stops every non-persistent supervised process after the last omp in this directory exits.
17
+ - `detached: true` survives broker shutdown and all omp exits. It implies `persist` and disables PTY/stdin.
18
+ </instruction>
19
+
20
+ <critical>
21
+ - Long-running work MUST use `launch`, not async/background bash.
22
+ - Readiness MUST be observed; process creation alone is not readiness.
23
+ - Omit `persist` and `detached` unless their survival guarantees are required.
24
+ - Use `stop`; NEVER kill an unverified PID through bash.
25
+ </critical>
package/src/sdk.ts CHANGED
@@ -109,7 +109,7 @@ import {
109
109
  obfuscateProviderContext,
110
110
  SecretObfuscator,
111
111
  } from "./secrets";
112
- import { AgentSession } from "./session/agent-session";
112
+ import { AgentSession, type PlanYolo, type Prewalk } from "./session/agent-session";
113
113
  import { discoverAuthStorage as discoverAuthStorageFromConfig } from "./session/auth-broker-config";
114
114
  import type { AuthStorage } from "./session/auth-storage";
115
115
  import {
@@ -407,6 +407,10 @@ export interface CreateAgentSessionOptions {
407
407
  thinkingLevel?: ConfiguredThinkingLevel;
408
408
  /** Models available for cycling (Ctrl+P in interactive mode) */
409
409
  scopedModels?: Array<{ model: Model; thinkingLevel?: ThinkingLevel }>;
410
+ /** Prewalk from the starting model to a fast/cheap target at the first edit/write once the todo list exists. */
411
+ prewalk?: Prewalk;
412
+ /** Force read-only plan mode at start, auto-approve on the model's first resolve call, then switch to execute. */
413
+ planYolo?: PlanYolo;
410
414
 
411
415
  /** Provider-facing system prompt override. Replaces the fully rendered default blocks. */
412
416
  systemPrompt?: string | string[] | ((defaultPrompt: string[]) => string | string[]);
@@ -1983,7 +1987,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1983
1987
  }
1984
1988
  }
1985
1989
  // Resolve deferred --model/subagent patterns now that extension models are
1986
- // registered. Expand role aliases (`pi/smol`) and comma chains to concrete
1990
+ // registered. Expand role aliases (`@smol`) and comma chains to concrete
1987
1991
  // selectors first so deferred resolution accepts everything the immediate
1988
1992
  // path (resolveModelOverride → resolveModelRoleValue) accepts.
1989
1993
  if (!model && deferredModelPatterns.length > 0) {
@@ -2863,6 +2867,8 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
2863
2867
  agent,
2864
2868
  pruneToolDescriptions: inlineToolDescriptors,
2865
2869
  thinkingLevel: autoThinking ? AUTO_THINKING : effectiveThinkingLevel,
2870
+ prewalk: options.prewalk,
2871
+ planYolo: options.planYolo,
2866
2872
  serviceTierByFamily: initialServiceTierByFamily,
2867
2873
  sessionManager,
2868
2874
  settings,