@oh-my-pi/pi-coding-agent 17.1.7 → 17.2.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 (246) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/dist/{CHANGELOG-5k4dq4g6.md → CHANGELOG-be1f2t8h.md} +127 -0
  3. package/dist/cli.js +9554 -12379
  4. package/dist/template-8vdv6xb4.js +1671 -0
  5. package/dist/template-f8wx9vfn.css +1355 -0
  6. package/dist/template-qat058wr.html +55 -0
  7. package/dist/tool-views.generated-jdfmzwmn.js +35 -0
  8. package/dist/types/advisor/advise-tool.d.ts +0 -7
  9. package/dist/types/advisor/runtime.d.ts +8 -11
  10. package/dist/types/advisor/transcript-recorder.d.ts +15 -0
  11. package/dist/types/async/job-manager.d.ts +11 -0
  12. package/dist/types/auto-thinking/classifier.d.ts +9 -2
  13. package/dist/types/cleanse/agent.d.ts +19 -0
  14. package/dist/types/cleanse/balance.d.ts +7 -0
  15. package/dist/types/cleanse/checkers.d.ts +13 -0
  16. package/dist/types/cleanse/index.d.ts +16 -0
  17. package/dist/types/cleanse/loop.d.ts +16 -0
  18. package/dist/types/cleanse/parsers.d.ts +13 -0
  19. package/dist/types/cleanse/progress.d.ts +14 -0
  20. package/dist/types/cleanse/types.d.ts +64 -0
  21. package/dist/types/cli/args.d.ts +2 -0
  22. package/dist/types/cli/session-picker.d.ts +14 -7
  23. package/dist/types/collab/guest.d.ts +21 -2
  24. package/dist/types/commands/cleanse.d.ts +23 -0
  25. package/dist/types/commands/launch.d.ts +6 -0
  26. package/dist/types/config/settings-schema.d.ts +63 -8
  27. package/dist/types/cursor-bridge-tools.d.ts +54 -0
  28. package/dist/types/cursor.d.ts +193 -8
  29. package/dist/types/edit/edit-clipboard.d.ts +19 -0
  30. package/dist/types/edit/hashline/diff.d.ts +9 -1
  31. package/dist/types/edit/index.d.ts +8 -1
  32. package/dist/types/edit/streaming.d.ts +8 -1
  33. package/dist/types/export/html/index.d.ts +2 -0
  34. package/dist/types/extensibility/extensions/runner.d.ts +19 -2
  35. package/dist/types/extensibility/extensions/types.d.ts +25 -1
  36. package/dist/types/extensibility/legacy-pi-ai-shim.d.ts +27 -1
  37. package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +2 -0
  38. package/dist/types/internal-urls/local-protocol.d.ts +3 -2
  39. package/dist/types/launch/terminal-output-worker-client.d.ts +5 -0
  40. package/dist/types/launch/terminal-output-worker-protocol.d.ts +14 -0
  41. package/dist/types/launch/terminal-output-worker.d.ts +1 -0
  42. package/dist/types/lsp/client.d.ts +2 -0
  43. package/dist/types/main.d.ts +2 -0
  44. package/dist/types/mcp/manager.d.ts +33 -4
  45. package/dist/types/modes/components/codex-reset-fireworks.d.ts +51 -0
  46. package/dist/types/modes/components/read-tool-group.d.ts +12 -0
  47. package/dist/types/modes/components/session-selector.d.ts +6 -0
  48. package/dist/types/modes/components/status-line/component.d.ts +23 -0
  49. package/dist/types/modes/components/tool-execution.d.ts +16 -7
  50. package/dist/types/modes/components/usage-row.d.ts +2 -0
  51. package/dist/types/modes/controllers/mcp-command-controller.d.ts +26 -1
  52. package/dist/types/modes/controllers/selector-controller.d.ts +2 -1
  53. package/dist/types/modes/interactive-mode.d.ts +8 -5
  54. package/dist/types/modes/rpc/rpc-client.d.ts +7 -0
  55. package/dist/types/modes/rpc/rpc-types.d.ts +16 -0
  56. package/dist/types/modes/theme/theme.d.ts +12 -1
  57. package/dist/types/modes/types.d.ts +2 -1
  58. package/dist/types/sdk.d.ts +1 -0
  59. package/dist/types/session/agent-session-events.d.ts +2 -0
  60. package/dist/types/session/agent-session-types.d.ts +36 -1
  61. package/dist/types/session/agent-session.d.ts +4 -2
  62. package/dist/types/session/async-job-delivery.d.ts +8 -0
  63. package/dist/types/session/claude-session-store.d.ts +13 -0
  64. package/dist/types/session/codex-session-store.d.ts +14 -0
  65. package/dist/types/session/credential-pin.d.ts +58 -0
  66. package/dist/types/session/foreign-session-import.d.ts +15 -0
  67. package/dist/types/session/foreign-session-jsonl.d.ts +9 -0
  68. package/dist/types/session/foreign-session-store.d.ts +23 -0
  69. package/dist/types/session/model-controls.d.ts +3 -3
  70. package/dist/types/session/session-advisors.d.ts +47 -2
  71. package/dist/types/session/session-entries.d.ts +19 -1
  72. package/dist/types/session/session-handoff.d.ts +4 -1
  73. package/dist/types/session/session-loader.d.ts +2 -0
  74. package/dist/types/session/session-maintenance.d.ts +1 -1
  75. package/dist/types/session/session-manager.d.ts +21 -0
  76. package/dist/types/session/session-tools.d.ts +25 -1
  77. package/dist/types/session/turn-recovery.d.ts +10 -4
  78. package/dist/types/system-prompt.d.ts +2 -1
  79. package/dist/types/task/executor.d.ts +11 -2
  80. package/dist/types/task/isolation-ownership.d.ts +34 -0
  81. package/dist/types/task/render.d.ts +7 -0
  82. package/dist/types/thinking.d.ts +18 -6
  83. package/dist/types/tools/acp-bridge.d.ts +28 -5
  84. package/dist/types/tools/browser/cmux/cmux-tab.d.ts +1 -2
  85. package/dist/types/tools/browser/tab-worker.d.ts +1 -4
  86. package/dist/types/tools/grep.d.ts +17 -1
  87. package/dist/types/tools/hub/launch.d.ts +5 -1
  88. package/dist/types/tools/index.d.ts +4 -1
  89. package/dist/types/tools/path-utils.d.ts +19 -0
  90. package/dist/types/tools/read.d.ts +2 -0
  91. package/dist/types/tools/xdev.d.ts +2 -1
  92. package/dist/types/tui/output-block.d.ts +5 -5
  93. package/dist/types/utils/changelog.d.ts +19 -0
  94. package/dist/types/utils/git.d.ts +10 -0
  95. package/dist/types/utils/jj.d.ts +11 -4
  96. package/dist/types/web/search/types.d.ts +2 -2
  97. package/package.json +16 -12
  98. package/scripts/bundle-dist.ts +3 -1
  99. package/src/advisor/advise-tool.ts +0 -11
  100. package/src/advisor/runtime.ts +138 -24
  101. package/src/advisor/transcript-recorder.ts +56 -0
  102. package/src/async/job-manager.ts +30 -7
  103. package/src/auto-thinking/classifier.ts +48 -10
  104. package/src/cleanse/agent.ts +226 -0
  105. package/src/cleanse/balance.ts +79 -0
  106. package/src/cleanse/checkers.ts +996 -0
  107. package/src/cleanse/index.ts +190 -0
  108. package/src/cleanse/loop.ts +51 -0
  109. package/src/cleanse/parsers.ts +726 -0
  110. package/src/cleanse/progress.ts +50 -0
  111. package/src/cleanse/prompts/assignment.md +47 -0
  112. package/src/cleanse/types.ts +72 -0
  113. package/src/cli/args.ts +6 -0
  114. package/src/cli/flag-tables.ts +2 -0
  115. package/src/cli/gallery-fixtures/fs.ts +25 -0
  116. package/src/cli/session-picker.ts +34 -17
  117. package/src/cli/ttsr-cli.ts +19 -1
  118. package/src/cli/update-cli.ts +3 -0
  119. package/src/cli/usage-cli.ts +29 -4
  120. package/src/cli/worktree-cli.ts +28 -11
  121. package/src/cli-commands.ts +1 -0
  122. package/src/cli.ts +11 -1
  123. package/src/collab/guest.ts +37 -4
  124. package/src/collab/host.ts +1 -0
  125. package/src/commands/cleanse.ts +45 -0
  126. package/src/commands/launch.ts +6 -0
  127. package/src/config/model-registry.ts +103 -25
  128. package/src/config/settings-schema.ts +65 -6
  129. package/src/config/settings.ts +25 -0
  130. package/src/cursor-bridge-tools.ts +81 -0
  131. package/src/cursor.ts +463 -12
  132. package/src/discovery/claude-plugins.ts +144 -34
  133. package/src/edit/edit-clipboard.ts +23 -0
  134. package/src/edit/hashline/diff.ts +49 -10
  135. package/src/edit/hashline/execute.ts +38 -6
  136. package/src/edit/hashline/filesystem.ts +27 -3
  137. package/src/edit/index.ts +12 -2
  138. package/src/edit/renderer.ts +4 -4
  139. package/src/edit/streaming.ts +17 -2
  140. package/src/export/html/index.ts +17 -10
  141. package/src/export/html/template.js +1 -1
  142. package/src/extensibility/extensions/runner.ts +70 -0
  143. package/src/extensibility/extensions/types.ts +30 -0
  144. package/src/extensibility/legacy-pi-ai-shim.ts +46 -1
  145. package/src/extensibility/legacy-pi-coding-agent-shim.ts +12 -13
  146. package/src/internal-urls/local-protocol.ts +3 -2
  147. package/src/internal-urls/mcp-protocol.ts +4 -1
  148. package/src/launch/broker.ts +14 -4
  149. package/src/launch/terminal-output-worker-client.ts +53 -0
  150. package/src/launch/terminal-output-worker-protocol.ts +11 -0
  151. package/src/launch/terminal-output-worker.ts +23 -0
  152. package/src/lsp/client.ts +18 -3
  153. package/src/lsp/index.ts +4 -0
  154. package/src/lsp/render.ts +1 -1
  155. package/src/main.ts +127 -56
  156. package/src/mcp/manager.ts +120 -18
  157. package/src/modes/acp/acp-agent.ts +27 -18
  158. package/src/modes/acp/acp-event-mapper.ts +38 -4
  159. package/src/modes/components/chat-transcript-builder.ts +30 -11
  160. package/src/modes/components/codex-reset-fireworks.ts +369 -0
  161. package/src/modes/components/read-tool-group.ts +159 -17
  162. package/src/modes/components/session-selector.ts +19 -3
  163. package/src/modes/components/settings-selector.ts +9 -1
  164. package/src/modes/components/status-line/component.ts +381 -54
  165. package/src/modes/components/tool-execution.ts +78 -31
  166. package/src/modes/components/usage-row.ts +10 -5
  167. package/src/modes/controllers/event-controller.ts +26 -4
  168. package/src/modes/controllers/mcp-command-controller.ts +68 -3
  169. package/src/modes/controllers/selector-controller.ts +94 -36
  170. package/src/modes/controllers/tan-command-controller.ts +14 -0
  171. package/src/modes/interactive-mode.ts +67 -64
  172. package/src/modes/prompt-action-autocomplete.ts +5 -3
  173. package/src/modes/rpc/rpc-client.ts +18 -0
  174. package/src/modes/rpc/rpc-mode.ts +16 -1
  175. package/src/modes/rpc/rpc-types.ts +11 -0
  176. package/src/modes/theme/theme.ts +151 -6
  177. package/src/modes/types.ts +2 -1
  178. package/src/modes/utils/ui-helpers.ts +38 -21
  179. package/src/prompts/goals/guided-goal-interview.md +41 -6
  180. package/src/prompts/system/auto-thinking-difficulty.md +4 -2
  181. package/src/prompts/system/plan-mode-active.md +2 -2
  182. package/src/prompts/system/system-prompt.md +3 -0
  183. package/src/prompts/system/vibe-mode-active.md +4 -1
  184. package/src/prompts/system/xdev-mount-notice.md +1 -1
  185. package/src/prompts/tools/bash.md +15 -17
  186. package/src/prompts/tools/browser.md +1 -0
  187. package/src/prompts/tools/checkpoint.md +1 -1
  188. package/src/prompts/tools/glob.md +7 -6
  189. package/src/prompts/tools/goal.md +1 -1
  190. package/src/prompts/tools/grep.md +7 -6
  191. package/src/sdk.ts +178 -15
  192. package/src/session/agent-session-events.ts +1 -0
  193. package/src/session/agent-session-types.ts +40 -1
  194. package/src/session/agent-session.ts +330 -179
  195. package/src/session/async-job-delivery.ts +8 -0
  196. package/src/session/claude-session-store.ts +426 -0
  197. package/src/session/codex-session-store.ts +673 -0
  198. package/src/session/credential-pin.ts +93 -0
  199. package/src/session/foreign-session-import.ts +52 -0
  200. package/src/session/foreign-session-jsonl.ts +29 -0
  201. package/src/session/foreign-session-store.ts +26 -0
  202. package/src/session/model-controls.ts +15 -7
  203. package/src/session/session-advisors.ts +142 -23
  204. package/src/session/session-entries.ts +21 -1
  205. package/src/session/session-handoff.ts +20 -3
  206. package/src/session/session-history-format.ts +31 -6
  207. package/src/session/session-loader.ts +25 -9
  208. package/src/session/session-maintenance.ts +59 -11
  209. package/src/session/session-manager.ts +61 -0
  210. package/src/session/session-tools.ts +107 -5
  211. package/src/session/settings-stream-fn.ts +1 -0
  212. package/src/session/turn-recovery.ts +97 -51
  213. package/src/slash-commands/builtin-registry.ts +136 -5
  214. package/src/system-prompt.ts +3 -2
  215. package/src/task/executor.ts +17 -4
  216. package/src/task/isolation-ownership.ts +106 -0
  217. package/src/task/render.ts +20 -4
  218. package/src/task/worktree.ts +8 -0
  219. package/src/thinking.ts +29 -10
  220. package/src/tools/acp-bridge.ts +52 -8
  221. package/src/tools/ask.ts +3 -3
  222. package/src/tools/ast-edit.ts +9 -2
  223. package/src/tools/browser/cmux/cmux-tab.ts +9 -14
  224. package/src/tools/browser/tab-worker.ts +12 -35
  225. package/src/tools/browser.ts +7 -2
  226. package/src/tools/checkpoint.ts +0 -13
  227. package/src/tools/gh-renderer.ts +3 -3
  228. package/src/tools/grep.ts +64 -8
  229. package/src/tools/hub/launch.ts +10 -15
  230. package/src/tools/index.ts +38 -5
  231. package/src/tools/path-utils.ts +88 -0
  232. package/src/tools/read.ts +3 -0
  233. package/src/tools/write.ts +44 -3
  234. package/src/tools/xdev.ts +39 -14
  235. package/src/tui/code-cell.ts +4 -4
  236. package/src/tui/output-block.ts +25 -8
  237. package/src/utils/changelog.ts +144 -4
  238. package/src/utils/git.ts +61 -14
  239. package/src/utils/jj.ts +19 -13
  240. package/src/utils/shell-snapshot-fn-env.sh +5 -2
  241. package/src/web/search/providers/codex.ts +34 -0
  242. package/src/web/search/render.ts +2 -2
  243. package/src/web/search/types.ts +1 -1
  244. package/dist/types/goals/guided-setup.d.ts +0 -30
  245. package/src/goals/guided-setup.ts +0 -171
  246. package/src/prompts/goals/guided-goal-system.md +0 -33
@@ -36,13 +36,6 @@ export declare function formatAdvisorBatchContent(notes: readonly AdvisorNote[])
36
36
  * and `blocker` interrupt; a plain `nit` queues.
37
37
  */
38
38
  export declare function isInterruptingSeverity(severity: AdvisorSeverity | undefined): boolean;
39
- /**
40
- * Append a staleness caveat to an advisor note when newer primary turns arrived
41
- * after the reviewed transcript window (i.e. `hasFreshBacklog` is true on the
42
- * advisor runtime at delivery time). Pure function — no session coupling — so it
43
- * can be unit-tested in isolation and called from `AgentSession#routeAdvice`.
44
- */
45
- export declare function annotateForStaleness(note: string, hasFreshBacklog: boolean): string;
46
39
  /** How an advisor note is routed to the primary. */
47
40
  export type AdvisorDeliveryChannel = "aside" | "steer" | "preserve";
48
41
  /** Half-open turn-count fence for the post-interrupt cooldown. */
@@ -38,7 +38,7 @@ export interface AdvisorRuntimeHost {
38
38
  * recovery path must never replay the full primary transcript.
39
39
  * Optional: hosts that omit it get no proactive maintenance.
40
40
  */
41
- maintainContext?(incomingTokens: number): Promise<boolean>;
41
+ maintainContext?(incomingTokens: number, signal: AbortSignal): Promise<boolean>;
42
42
  /**
43
43
  * Called immediately before each `agent.prompt(batch)` cycle. Lets the host
44
44
  * clear per-update advisor state — currently the one-advise-per-update gate
@@ -55,7 +55,7 @@ export interface AdvisorRuntimeHost {
55
55
  * failed prompt's appended turns before rollback. Errors thrown here are
56
56
  * logged and swallowed.
57
57
  */
58
- onTurnError?(error: unknown, failedMessages: readonly AgentMessage[]): Promise<boolean | undefined> | boolean | undefined;
58
+ onTurnError?(error: unknown, failedMessages: readonly AgentMessage[], signal: AbortSignal): Promise<boolean | undefined> | boolean | undefined;
59
59
  /** Called after a successful advisor turn so the host can finish fallback lifecycle reporting. */
60
60
  onTurnSuccess?(): Promise<void> | void;
61
61
  /** Surface a non-recovering advisor failure to the host UI without adding model-visible context. */
@@ -64,6 +64,8 @@ export interface AdvisorRuntimeHost {
64
64
  * recovery (credential switch, fallback chain) declined. Cleared only by
65
65
  * an explicit reset (`/new`, config rebuild, session restart). */
66
66
  notifyQuotaExhausted?(): void;
67
+ /** Stable identity for the live advisor model. Used to restore full transcript rendering after a model switch. */
68
+ getModelIdentity?(): string;
67
69
  }
68
70
  /** Signals that an advisor response was discarded before it could become model-visible context. */
69
71
  export declare class AdvisorOutputQuarantinedError extends Error {
@@ -95,15 +97,6 @@ export declare class AdvisorRuntime {
95
97
  get failureNotified(): boolean;
96
98
  /** True after the runtime hard-stopped on repeated or permanent failures. */
97
99
  get halted(): boolean;
98
- /**
99
- * True when `#pending` is non-empty while the drain loop is busy — i.e., newer
100
- * primary turns arrived after the current batch's transcript window was fixed
101
- * but before the advisor model finished processing it. The delivery path uses
102
- * this to annotate advice that was generated without seeing those newer turns.
103
- * Can be true during `agent.prompt()`, a `maintainContext` await, or a retry
104
- * sleep — any time `#drain` is busy and a concurrent `onTurnEnd` pushed.
105
- */
106
- get hasFreshBacklog(): boolean;
107
100
  /**
108
101
  * Called after each primary turn ends. Renders the incremental delta and
109
102
  * queues it for the advisor model.
@@ -125,6 +118,10 @@ export declare class AdvisorRuntime {
125
118
  */
126
119
  waitForCatchup(maxMs: number, threshold: number, signal?: AbortSignal): Promise<boolean>;
127
120
  dispose(): void;
121
+ /** Stop new advisor work and wait only for the active prompt's recorder-visible events. */
122
+ pauseForSessionTransition(): Promise<void>;
123
+ /** Continue queued work after a session transition rolls back or preserves the conversation. */
124
+ resumeAfterSessionTransition(): void;
128
125
  /**
129
126
  * Re-prime the advisor after a history rewrite (compaction, session
130
127
  * switch/resume, branch). Clears the advisor's own (non-persisted) context
@@ -14,6 +14,21 @@ export declare const ADVISOR_TRANSCRIPT_FILENAME = "__advisor.jsonl";
14
14
  export declare function advisorTranscriptFilename(slug: string): string;
15
15
  /** Whether a filename is any advisor transcript (`__advisor.jsonl` or `__advisor.<slug>.jsonl`). */
16
16
  export declare function isAdvisorTranscriptName(name: string): boolean;
17
+ /**
18
+ * Sum the advisor spend already persisted next to a primary session transcript,
19
+ * keyed by advisor slug.
20
+ *
21
+ * The ledger a session keeps in memory only covers the current process, so a
22
+ * resumed session would report zero until the next advisor turn. The recorded
23
+ * transcripts are the durable copy of exactly the same finalized messages, so
24
+ * they are read back through the shared loader - no lock, no writer, and no
25
+ * second parser to keep in step with the session format.
26
+ *
27
+ * Only the session's own advisors count: subagent advisors write to
28
+ * `<session>/<SubId>/__advisor.jsonl`, and their spend belongs to the subagent,
29
+ * not to this roster. Hence the scan stays at the top level of the directory.
30
+ */
31
+ export declare function loadAdvisorTranscriptCosts(sessionFile: string | undefined): Promise<Map<string, number>>;
17
32
  /**
18
33
  * Append-only persister for an advisor agent's transcript.
19
34
  *
@@ -129,6 +129,17 @@ export declare class AsyncJobManager {
129
129
  * (used by `dispose()` to nuke the manager's state).
130
130
  */
131
131
  cancelAll(filter?: AsyncJobFilter): void;
132
+ /**
133
+ * Immediately evict completed and failed jobs matching the filter instead of
134
+ * waiting for retention expiry, dropping every queued delivery so a prior
135
+ * session's result can never be injected into a later transcript. Returns the
136
+ * number of jobs evicted.
137
+ *
138
+ * A delivery whose sink call is already in flight (or drained onto a caller's
139
+ * yield queue) is guarded by the owner's delivery generation, not the per-id
140
+ * suppression marker — that marker is cleared when the id is reused.
141
+ */
142
+ evictCompletedJobs(filter?: AsyncJobFilter): number;
132
143
  waitForAll(): Promise<void>;
133
144
  /**
134
145
  * Route completions for jobs owned by `ownerId` to `sink`. Sessions register
@@ -5,7 +5,8 @@
5
5
  * {@link Effort}, clamped into the active model's supported range (never below
6
6
  * {@link Effort.Low}). Two backends, selected by `providers.autoThinkingModel`:
7
7
  *
8
- * - `online` (default): a smol model classifies into `low|medium|high|xhigh`.
8
+ * - `online` (default): a smol model classifies into `low|medium|high|xhigh`,
9
+ * plus `max` when the target model exposes that tier.
9
10
  * - a local key: an on-device memory model classifies into the coarser
10
11
  * `trivial|moderate|hard` scheme (3-class is more reliable than 4-way ordinal
11
12
  * on sub-2B models), mapped to `low|high|xhigh`.
@@ -31,7 +32,13 @@ export interface ClassifyDifficultyDeps {
31
32
  * @throws when the backend cannot produce a usable classification.
32
33
  */
33
34
  export declare function classifyDifficulty(promptText: string, deps: ClassifyDifficultyDeps): Promise<Effort | undefined>;
34
- /** Map the online 4-way level keyword to an {@link Effort}; earliest match wins. */
35
+ /**
36
+ * Map an online level keyword to an {@link Effort}; earliest match wins.
37
+ *
38
+ * `max` is only offered to the classifier when the target model exposes that
39
+ * tier, but it is always parsed: an unsupported `max` is snapped back down by
40
+ * {@link clampAutoThinkingEffort} rather than failing the turn.
41
+ */
35
42
  export declare function parseDifficultyLevel(text: string): Effort | undefined;
36
43
  /** Map the local 3-way bucket keyword to an {@link Effort}; earliest match wins. */
37
44
  export declare function parseDifficultyBucket(text: string): Effort | undefined;
@@ -0,0 +1,19 @@
1
+ import type { CleanseAgentOutcome, CleanseAssignment, CleanseDiagnosticReport, CleanseLoopResult } from "./types.js";
2
+ /** Hooks used by the standalone command to render subagent lifecycle progress. */
3
+ export interface CleanseAgentHooks {
4
+ onStart?(name: string, assignment: CleanseAssignment): void;
5
+ onFinish?(outcome: CleanseAgentOutcome, assignment: CleanseAssignment): void;
6
+ }
7
+ /** Persisted parent session that dispatches file-disjoint cleanse workers. */
8
+ export interface CleanseAgentRuntime {
9
+ readonly model: string;
10
+ readonly sessionFile: string;
11
+ dispatch(assignments: CleanseAssignment[], wave: number, report: CleanseDiagnosticReport, signal?: AbortSignal): Promise<CleanseAgentOutcome[]>;
12
+ close(result?: CleanseLoopResult): Promise<void>;
13
+ }
14
+ /** Resolve the requested model and create a fresh persisted cleanse session. */
15
+ export declare function createCleanseAgentRuntime(options: {
16
+ cwd?: string;
17
+ model: string;
18
+ hooks?: CleanseAgentHooks;
19
+ }): Promise<CleanseAgentRuntime>;
@@ -0,0 +1,7 @@
1
+ import type { CleanseAssignment, CleanseDiagnostic, CleanseFileIssues } from "./types.js";
2
+ /** Estimate repair burden from severity and available location/fix evidence. */
3
+ export declare function diagnosticWeight(diagnostic: CleanseDiagnostic): number;
4
+ /** Group diagnostics by file while keeping project-level failures together. */
5
+ export declare function groupDiagnosticsByFile(diagnostics: readonly CleanseDiagnostic[]): CleanseFileIssues[];
6
+ /** Balance whole-file workloads with longest-processing-time bin packing. */
7
+ export declare function balanceDiagnostics(diagnostics: readonly CleanseDiagnostic[], maxAgents: number): CleanseAssignment[];
@@ -0,0 +1,13 @@
1
+ import type { CleanseDiagnosticReport, SkippedCleanseCheck } from "./types.js";
2
+ /** Optional checker families enabled for a cleanse run. */
3
+ export interface CleanseDiagnosticSuiteOptions {
4
+ includeTests?: boolean;
5
+ }
6
+ /** Re-runnable checker set discovered from one project snapshot. */
7
+ export interface CleanseDiagnosticSuite {
8
+ readonly checkCount: number;
9
+ readonly skipped: readonly SkippedCleanseCheck[];
10
+ run(signal?: AbortSignal): Promise<CleanseDiagnosticReport>;
11
+ }
12
+ /** Discover configured language checkers without installing missing tools. */
13
+ export declare function discoverCleanseDiagnosticSuite(projectCwd: string, options?: CleanseDiagnosticSuiteOptions): Promise<CleanseDiagnosticSuite>;
@@ -0,0 +1,16 @@
1
+ import type { CleanseDiagnosticReport } from "./types.js";
2
+ /** User-facing options for `omp cleanse`. */
3
+ export interface CleanseCommandOptions {
4
+ maxAgents?: number;
5
+ model?: string;
6
+ includeTests?: boolean;
7
+ }
8
+ /** Observable completion state returned to the CLI adapter. */
9
+ export interface CleanseCommandResult {
10
+ exitCode: number;
11
+ status: "clean" | "unresolved" | "unsupported" | "cancelled";
12
+ report: CleanseDiagnosticReport;
13
+ sessionFile?: string;
14
+ }
15
+ /** Detect project diagnostics, dispatch one bounded repair batch, and verify it. */
16
+ export declare function runCleanseCommand(options?: CleanseCommandOptions): Promise<CleanseCommandResult>;
@@ -0,0 +1,16 @@
1
+ import type { CleanseAgentOutcome, CleanseAssignment, CleanseDiagnosticReport, CleanseLoopResult } from "./types.js";
2
+ /** Runtime seams for one bounded diagnose, dispatch, and verify pass. */
3
+ export interface CleanseLoopDependencies {
4
+ collect(signal?: AbortSignal): Promise<CleanseDiagnosticReport>;
5
+ dispatch(assignments: CleanseAssignment[], wave: number, report: CleanseDiagnosticReport, signal?: AbortSignal): Promise<CleanseAgentOutcome[]>;
6
+ onWave?(wave: number, assignments: readonly CleanseAssignment[]): void;
7
+ onReport?(wave: number, report: CleanseDiagnosticReport): void;
8
+ }
9
+ /** Inputs controlling one complete cleanse loop. */
10
+ export interface CleanseLoopOptions {
11
+ maxAgents: number;
12
+ initialReport: CleanseDiagnosticReport;
13
+ signal?: AbortSignal;
14
+ }
15
+ /** Dispatch at most `maxAgents` workers once, then verify their combined edits. */
16
+ export declare function runCleanseLoop(options: CleanseLoopOptions, dependencies: CleanseLoopDependencies): Promise<CleanseLoopResult>;
@@ -0,0 +1,13 @@
1
+ import type { CleanseDiagnostic } from "./types.js";
2
+ /** Machine and fallback output formats understood by cleanse. */
3
+ export type CleanseParserKind = "rust" | "rust-test" | "go" | "go-test" | "ruff" | "pyright" | "eslint" | "biome" | "rubocop" | "phpstan" | "psalm" | "swiftlint" | "dart" | "credo" | "shellcheck" | "hlint" | "terraform" | "tflint" | "generic";
4
+ /** Captured checker process output passed to a format parser. */
5
+ export interface CleanseParserInput {
6
+ checker: string;
7
+ projectCwd: string;
8
+ checkerCwd: string;
9
+ stdout: string;
10
+ stderr: string;
11
+ }
12
+ /** Parse one checker invocation into normalized, project-relative diagnostics. */
13
+ export declare function parseCleanseDiagnostics(kind: CleanseParserKind, input: CleanseParserInput): CleanseDiagnostic[];
@@ -0,0 +1,14 @@
1
+ /** Minimal output contract used by the interactive cleanse progress reporter. */
2
+ export interface CleanseProgressOutput {
3
+ isTTY?: boolean;
4
+ write(text: string): boolean;
5
+ }
6
+ /** Renders completed repair workers on one transient terminal line. */
7
+ export interface CleanseProgressReporter {
8
+ readonly interactive: boolean;
9
+ start(total: number): void;
10
+ complete(): void;
11
+ finish(): void;
12
+ }
13
+ /** Create the TTY-only worker completion reporter used by `omp cleanse`. */
14
+ export declare function createCleanseProgressReporter(output?: CleanseProgressOutput): CleanseProgressReporter;
@@ -0,0 +1,64 @@
1
+ /** Severity normalized across checker-specific output formats. */
2
+ export type CleanseSeverity = "error" | "warning" | "info";
3
+ /** One actionable problem reported by a project checker. */
4
+ export interface CleanseDiagnostic {
5
+ checker: string;
6
+ file?: string;
7
+ line?: number;
8
+ column?: number;
9
+ endLine?: number;
10
+ endColumn?: number;
11
+ code?: string;
12
+ severity: CleanseSeverity;
13
+ message: string;
14
+ suggestion?: string;
15
+ }
16
+ /** Result metadata for one checker invocation. */
17
+ export interface CleanseCheckResult {
18
+ id: string;
19
+ label: string;
20
+ language: string;
21
+ cwd: string;
22
+ command: string;
23
+ exitCode: number | null;
24
+ diagnostics: CleanseDiagnostic[];
25
+ }
26
+ /** Checker discovery result omitted because its required executable was unavailable. */
27
+ export interface SkippedCleanseCheck {
28
+ label: string;
29
+ language: string;
30
+ reason: string;
31
+ }
32
+ /** Aggregate diagnostics from every checker selected for a project. */
33
+ export interface CleanseDiagnosticReport {
34
+ checks: CleanseCheckResult[];
35
+ diagnostics: CleanseDiagnostic[];
36
+ skipped: SkippedCleanseCheck[];
37
+ }
38
+ /** All diagnostics attached to one file, which scheduling never splits across agents. */
39
+ export interface CleanseFileIssues {
40
+ file?: string;
41
+ diagnostics: CleanseDiagnostic[];
42
+ weight: number;
43
+ }
44
+ /** One weighted, file-disjoint workload handed to a subagent. */
45
+ export interface CleanseAssignment {
46
+ index: number;
47
+ groups: CleanseFileIssues[];
48
+ weight: number;
49
+ }
50
+ /** Settled result from one cleanse subagent. */
51
+ export interface CleanseAgentOutcome {
52
+ name: string;
53
+ success: boolean;
54
+ output: string;
55
+ error?: string;
56
+ resolvedModel?: string;
57
+ }
58
+ /** Final state after one bounded repair wave and verification pass. */
59
+ export interface CleanseLoopResult {
60
+ status: "clean" | "stalled" | "cancelled";
61
+ waves: number;
62
+ report: CleanseDiagnosticReport;
63
+ outcomes: CleanseAgentOutcome[];
64
+ }
@@ -27,6 +27,8 @@ export interface Args {
27
27
  advisor?: boolean;
28
28
  continue?: boolean;
29
29
  resume?: string | true;
30
+ fromClaude?: boolean;
31
+ fromCodex?: boolean;
30
32
  help?: boolean;
31
33
  version?: boolean;
32
34
  mode?: Mode;
@@ -1,11 +1,18 @@
1
1
  import type { SessionInfo } from "../session/session-listing.js";
2
+ /** Presentation and capability controls for the standalone session picker. */
3
+ export interface SessionPickerOptions {
4
+ allSessions?: SessionInfo[];
5
+ title?: string;
6
+ scopeLabel?: string | false;
7
+ showCwd?: boolean;
8
+ allowDelete?: boolean;
9
+ allowGlobalScope?: boolean;
10
+ historySearch?: boolean;
11
+ }
2
12
  /**
3
13
  * Show the TUI session selector and return the selected session, or null if
4
- * cancelled. Rendered as a fullscreen overlay on the terminal's alternate
5
- * screen, so the list scrolls and rows are clickable with the mouse. Tab
6
- * toggles between current-folder and all-projects scope; the all-projects list
7
- * is loaded lazily via `SessionManager.listAll`.
14
+ * cancelled. The default OMP picker supports deletion, transcript-history
15
+ * search, and an all-projects scope; foreign import pickers disable those
16
+ * source-owned capabilities.
8
17
  */
9
- export declare function selectSession(sessions: SessionInfo[], options?: {
10
- allSessions?: SessionInfo[];
11
- }): Promise<SessionInfo | null>;
18
+ export declare function selectSession(sessions: SessionInfo[], options?: SessionPickerOptions): Promise<SessionInfo | null>;
@@ -10,6 +10,7 @@ export interface GuestIdleReconcilerCtx {
10
10
  statusLine: {
11
11
  markActivityEnd: () => void;
12
12
  };
13
+ statusContainer: Pick<InteractiveModeContext["statusContainer"], "disposeChildren">;
13
14
  loadingAnimation: {
14
15
  stop: () => void;
15
16
  } | undefined;
@@ -17,8 +18,8 @@ export interface GuestIdleReconcilerCtx {
17
18
  /**
18
19
  * Close the guest UI state held open by an earlier `agent_start` whose
19
20
  * matching `agent_end` never reached us — most often because a reconnect
20
- * dropped the event mid-stream. Triggered from {@link CollabGuestLink}'s
21
- * `state` reconciler when the host reports `isStreaming === false`:
21
+ * dropped the event mid-stream. Reached via {@link reconcileGuestSnapshotHostState}
22
+ * (the live `state`-frame and welcome/resync reconciler) when the host reports `isStreaming === false`:
22
23
  * folds the in-flight active-time window into the per-session meter (so
23
24
  * `time_spent` stops ticking) and stops the `Working…` loader if one is
24
25
  * still animating. No-op when the host is still streaming.
@@ -32,7 +33,25 @@ export interface GuestSnapshotActivityReconcilerCtx extends GuestIdleReconcilerC
32
33
  statusLine: GuestIdleReconcilerCtx["statusLine"] & {
33
34
  markActivityStart: () => void;
34
35
  };
36
+ /**
37
+ * Start (or re-attach) the live "Working…" loader. Mirrors
38
+ * `InteractiveModeContext.ensureLoadingAnimation`, which is what
39
+ * `EventController` calls on `agent_start`. Required so a guest that
40
+ * missed an earlier `agent_start` (a reconnect dropped it mid-stream)
41
+ * starts its spinner when the host later reports it is streaming.
42
+ */
43
+ ensureLoadingAnimation: InteractiveModeContext["ensureLoadingAnimation"];
44
+ autoCompactionLoader: InteractiveModeContext["autoCompactionLoader"];
45
+ retryLoader: InteractiveModeContext["retryLoader"];
35
46
  }
47
+ /** Status-area state which cannot outlive removal of its child components. */
48
+ export interface GuestTransientStatusCtx {
49
+ statusContainer: Pick<InteractiveModeContext["statusContainer"], "clear">;
50
+ autoCompactionLoader: InteractiveModeContext["autoCompactionLoader"];
51
+ retryLoader: InteractiveModeContext["retryLoader"];
52
+ }
53
+ /** Stop and forget status-area loaders before detaching their components. */
54
+ export declare function clearGuestTransientStatus(ctx: GuestTransientStatusCtx): void;
36
55
  export declare function reconcileGuestSnapshotHostState(ctx: GuestSnapshotActivityReconcilerCtx, isStreaming: boolean): void;
37
56
  export declare class CollabGuestLink {
38
57
  #private;
@@ -0,0 +1,23 @@
1
+ import { Command } from "@oh-my-pi/pi-utils/cli";
2
+ export default class Cleanse extends Command {
3
+ static description: string;
4
+ static flags: {
5
+ agents: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"integer"> & {
6
+ char: string;
7
+ description: string;
8
+ default: number;
9
+ };
10
+ model: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"string"> & {
11
+ char: string;
12
+ description: string;
13
+ default: string;
14
+ };
15
+ tests: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"boolean"> & {
16
+ char: string;
17
+ description: string;
18
+ default: boolean;
19
+ };
20
+ };
21
+ static examples: string[];
22
+ run(): Promise<void>;
23
+ }
@@ -88,6 +88,12 @@ export default class Index extends Command {
88
88
  char: string;
89
89
  description: string;
90
90
  };
91
+ "from-claude": import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"boolean"> & {
92
+ description: string;
93
+ };
94
+ "from-codex": import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"boolean"> & {
95
+ description: string;
96
+ };
91
97
  "session-dir": import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"string"> & {
92
98
  description: string;
93
99
  };
@@ -839,6 +839,16 @@ export declare const SETTINGS_SCHEMA: {
839
839
  readonly description: "Render Mermaid fenced code blocks as ASCII diagrams";
840
840
  };
841
841
  };
842
+ readonly "tui.codexResetFireworks": {
843
+ readonly type: "boolean";
844
+ readonly default: false;
845
+ readonly ui: {
846
+ readonly tab: "appearance";
847
+ readonly group: "Display";
848
+ readonly label: "Codex Reset Fireworks";
849
+ readonly description: "Celebrate unscheduled Codex weekly usage resets and newly banked saved resets with a top-third fireworks overlay that remains until Escape";
850
+ };
851
+ };
842
852
  readonly "tui.titleState": {
843
853
  readonly type: "boolean";
844
854
  readonly default: true;
@@ -1796,14 +1806,28 @@ export declare const SETTINGS_SCHEMA: {
1796
1806
  }];
1797
1807
  };
1798
1808
  };
1799
- readonly collapseChangelog: {
1800
- readonly type: "boolean";
1801
- readonly default: false;
1809
+ readonly "startup.changelogMode": {
1810
+ readonly type: "enum";
1811
+ readonly values: readonly ["summary", "expanded", "hidden"];
1812
+ readonly default: "summary";
1802
1813
  readonly ui: {
1803
1814
  readonly tab: "interaction";
1804
1815
  readonly group: "Startup & Updates";
1805
- readonly label: "Collapse Changelog";
1806
- readonly description: "Show condensed changelog after updates";
1816
+ readonly label: "Startup Changelog";
1817
+ readonly description: "Choose whether update notes start as a summary, full details, or stay hidden";
1818
+ readonly options: readonly [{
1819
+ readonly value: "summary";
1820
+ readonly label: "Summary";
1821
+ readonly description: "Show release and change counts with a /changelog hint";
1822
+ }, {
1823
+ readonly value: "expanded";
1824
+ readonly label: "Expanded";
1825
+ readonly description: "Show the recent release notes in full";
1826
+ }, {
1827
+ readonly value: "hidden";
1828
+ readonly label: "Hidden";
1829
+ readonly description: "Do not show release notes on startup";
1830
+ }];
1807
1831
  };
1808
1832
  };
1809
1833
  readonly "magicKeywords.enabled": {
@@ -4147,6 +4171,16 @@ export declare const SETTINGS_SCHEMA: {
4147
4171
  readonly description: "Enable the browser tool for scripted Chromium automation (puppeteer)";
4148
4172
  };
4149
4173
  };
4174
+ readonly "browser.cdpUrl": {
4175
+ readonly type: "string";
4176
+ readonly default: undefined;
4177
+ readonly ui: {
4178
+ readonly tab: "tools";
4179
+ readonly group: "Grep & Browser";
4180
+ readonly label: "Browser CDP URL";
4181
+ readonly description: "Default HTTP CDP discovery endpoint (for example http://127.0.0.1:9222) to attach to instead of launching a browser. Explicit app.cdp_url or app.path on the tool call take precedence.";
4182
+ };
4183
+ };
4150
4184
  readonly "browser.headless": {
4151
4185
  readonly type: "boolean";
4152
4186
  readonly default: true;
@@ -4717,7 +4751,7 @@ export declare const SETTINGS_SCHEMA: {
4717
4751
  readonly tab: "tasks";
4718
4752
  readonly group: "Subagents";
4719
4753
  readonly label: "Soft Subagent Request Budget";
4720
- readonly description: "Soft per-subagent request budget (assistant requests per run). Crossing it injects a wrap-up steering notice (see task.softRequestBudgetNotice); at 1.5x the budget the run is force-stopped and the agent must yield its partial findings. 0 disables the guard. Bundled scout/sonic agents use a lower built-in budget.";
4754
+ readonly description: "Soft per-subagent request budget (assistant requests per run). Crossing it injects a wrap-up steering notice (see task.softRequestBudgetNotice); at 1.5x the budget the run is force-stopped and the agent must yield its partial findings. 0 disables the guard. Bundled scout/sonic agents cap out at a lower built-in budget, so a value below that cap still applies to them.";
4721
4755
  readonly options: readonly [{
4722
4756
  readonly value: "0";
4723
4757
  readonly label: "Disabled";
@@ -4970,7 +5004,7 @@ export declare const SETTINGS_SCHEMA: {
4970
5004
  } | {
4971
5005
  readonly value: "exa";
4972
5006
  readonly label: "Exa";
4973
- readonly description: "Uses Exa API when EXA_API_KEY is set; falls back to Exa MCP";
5007
+ readonly description: "API via /login exa or EXA_API_KEY; explicit keyless fallback via MCP";
4974
5008
  } | {
4975
5009
  readonly value: "tinyfish";
4976
5010
  readonly label: "TinyFish";
@@ -5074,7 +5108,7 @@ export declare const SETTINGS_SCHEMA: {
5074
5108
  } | {
5075
5109
  readonly value: "exa";
5076
5110
  readonly label: "Exa";
5077
- readonly description: "Uses Exa API when EXA_API_KEY is set; falls back to Exa MCP";
5111
+ readonly description: "API via /login exa or EXA_API_KEY; explicit keyless fallback via MCP";
5078
5112
  } | {
5079
5113
  readonly value: "tinyfish";
5080
5114
  readonly label: "TinyFish";
@@ -5580,6 +5614,27 @@ export declare const SETTINGS_SCHEMA: {
5580
5614
  })[];
5581
5615
  };
5582
5616
  };
5617
+ readonly "providers.autoThinkingMaxEffort": {
5618
+ readonly type: "enum";
5619
+ readonly values: readonly ["xhigh", "max"];
5620
+ readonly default: "xhigh";
5621
+ readonly ui: {
5622
+ readonly tab: "model";
5623
+ readonly group: "Thinking";
5624
+ readonly label: "Auto Thinking Ceiling";
5625
+ readonly description: "Highest effort the `auto` classifier may resolve. `xhigh` keeps the classifier one tier below the top, so only an explicit `ultrathink` reaches `max`; `max` lets a turn the classifier judges exceptional bill the top tier on models that expose it.";
5626
+ readonly condition: "autoThinkingActive";
5627
+ readonly options: readonly [{
5628
+ readonly value: "xhigh";
5629
+ readonly label: "xhigh";
5630
+ readonly description: "Classifier stops at xhigh (default)";
5631
+ }, {
5632
+ readonly value: "max";
5633
+ readonly label: "max";
5634
+ readonly description: "Classifier may resolve max where the model supports it";
5635
+ }];
5636
+ };
5637
+ };
5583
5638
  readonly "features.unexpectedStopDetection": {
5584
5639
  readonly type: "boolean";
5585
5640
  readonly default: false;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Per-call tools the Cursor exec bridge needs but the model-facing registry
3
+ * cannot supply.
4
+ *
5
+ * Both bridge callsites — the primary session and the advisor roster — build
6
+ * the same instances, and both must apply the session's approval wrapper. A
7
+ * raw tool here silently escapes the gate every registry call goes through, so
8
+ * the construction lives in one place rather than being repeated per callsite.
9
+ */
10
+ import type { AgentTool } from "@oh-my-pi/pi-agent-core";
11
+ import type { ExtensionRunner } from "./extensibility/extensions/index.js";
12
+ import type { GrepToolOptions, ToolSession } from "./tools/index.js";
13
+ /**
14
+ * Build the bridge's `createGrepTool` factory for one tool session.
15
+ *
16
+ * A `pi_grep` frame carries its own context width and total match cap. Neither
17
+ * is expressible in the model-facing `grep` schema — context comes from
18
+ * `grep.contextBefore`/`grep.contextAfter`, fixed when the shared instance is
19
+ * constructed — so honoring them needs a fresh tool per call.
20
+ *
21
+ * The result is wrapped exactly like a registry tool: the approval gate runs on
22
+ * every call site, and a per-call instance is no exception.
23
+ */
24
+ export declare function createBridgeGrepFactory(session: ToolSession, extensionRunner: ExtensionRunner): (options: GrepToolOptions) => AgentTool;
25
+ /**
26
+ * Build the `replace`-mode `edit` the bridge answers `pi_edit` with.
27
+ *
28
+ * `PiEditExecArgs` carries `old_text`/`new_text` pairs, which is exactly
29
+ * `replace`'s schema and nothing else's. The session's own instance follows the
30
+ * configured `edit.mode` — `hashline` by default, whose schema is a single
31
+ * `input` string — so a frame handed that instance fails validation instead of
32
+ * editing the file.
33
+ *
34
+ * Callers MUST gate this on the session having actually granted `edit`: the
35
+ * tool is constructed rather than looked up, so building one unconditionally
36
+ * hands a restricted agent a mutating tool it was denied (issue #5680).
37
+ */
38
+ export declare function createBridgeEditTool(session: ToolSession, extensionRunner: ExtensionRunner): AgentTool;
39
+ /**
40
+ * The tool map the exec bridge should run, given the map a caller granted.
41
+ *
42
+ * `pi_edit` needs a `replace`-mode instance, but only when `edit` was granted:
43
+ * the tool is constructed rather than looked up, so substituting
44
+ * unconditionally would hand a restricted roster a mutating tool it was denied
45
+ * (issue #5680). The granted map is never mutated: an unsubstituted result is a
46
+ * copy, so a caller without an `edit` grant cannot accidentally gain one.
47
+ *
48
+ * The advisor roster passes its granted map here; the primary session keeps its
49
+ * instance out of the registry entirely (Cursor does not advertise `edit`) and
50
+ * serves it through the bridge's `getEditReplaceTool` accessor instead — not
51
+ * the `getTool` fallback, which doubles as the agent loop's resolver for
52
+ * unadvertised calls and must stay device-only.
53
+ */
54
+ export declare function bridgeToolMap(granted: ReadonlyMap<string, AgentTool>, createEditTool: (() => AgentTool | undefined) | undefined): Map<string, AgentTool>;