@oh-my-pi/pi-coding-agent 17.1.8 → 17.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/dist/{CHANGELOG-vt8ene9g.md → CHANGELOG-dj46zzrm.md} +110 -0
  3. package/dist/cli.js +10009 -9654
  4. package/dist/{template-dys3vk5b.js → template-8vdv6xb4.js} +1 -1
  5. package/dist/types/advisor/runtime.d.ts +8 -2
  6. package/dist/types/advisor/transcript-recorder.d.ts +15 -0
  7. package/dist/types/auto-thinking/classifier.d.ts +9 -2
  8. package/dist/types/cli/args.d.ts +2 -0
  9. package/dist/types/cli/session-picker.d.ts +14 -7
  10. package/dist/types/collab/guest.d.ts +21 -2
  11. package/dist/types/commands/launch.d.ts +6 -0
  12. package/dist/types/config/model-discovery.d.ts +12 -0
  13. package/dist/types/config/settings-schema.d.ts +73 -8
  14. package/dist/types/cursor-bridge-tools.d.ts +54 -0
  15. package/dist/types/cursor.d.ts +193 -8
  16. package/dist/types/edit/edit-clipboard.d.ts +19 -0
  17. package/dist/types/edit/hashline/diff.d.ts +9 -1
  18. package/dist/types/edit/index.d.ts +8 -1
  19. package/dist/types/edit/streaming.d.ts +8 -1
  20. package/dist/types/extensibility/extensions/runner.d.ts +19 -2
  21. package/dist/types/extensibility/extensions/types.d.ts +25 -1
  22. package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +25 -0
  23. package/dist/types/internal-urls/index.d.ts +1 -0
  24. package/dist/types/internal-urls/local-protocol.d.ts +3 -2
  25. package/dist/types/internal-urls/security-protocol.d.ts +15 -0
  26. package/dist/types/internal-urls/types.d.ts +1 -1
  27. package/dist/types/launch/terminal-output-worker-client.d.ts +5 -0
  28. package/dist/types/launch/terminal-output-worker-protocol.d.ts +14 -0
  29. package/dist/types/launch/terminal-output-worker.d.ts +1 -0
  30. package/dist/types/lsp/client.d.ts +2 -0
  31. package/dist/types/main.d.ts +2 -0
  32. package/dist/types/mcp/manager.d.ts +33 -4
  33. package/dist/types/modes/components/codex-reset-fireworks.d.ts +51 -0
  34. package/dist/types/modes/components/read-tool-group.d.ts +12 -0
  35. package/dist/types/modes/components/session-selector.d.ts +6 -0
  36. package/dist/types/modes/components/status-line/component.d.ts +23 -0
  37. package/dist/types/modes/components/tool-execution.d.ts +16 -7
  38. package/dist/types/modes/components/usage-row.d.ts +2 -0
  39. package/dist/types/modes/controllers/mcp-command-controller.d.ts +26 -1
  40. package/dist/types/modes/controllers/selector-controller.d.ts +2 -1
  41. package/dist/types/modes/interactive-mode.d.ts +4 -2
  42. package/dist/types/modes/rpc/rpc-client.d.ts +7 -0
  43. package/dist/types/modes/rpc/rpc-types.d.ts +16 -0
  44. package/dist/types/modes/theme/theme.d.ts +12 -1
  45. package/dist/types/modes/types.d.ts +2 -1
  46. package/dist/types/sdk.d.ts +18 -0
  47. package/dist/types/security/auth.d.ts +30 -0
  48. package/dist/types/security/cloud.d.ts +79 -0
  49. package/dist/types/security/comparison.d.ts +49 -0
  50. package/dist/types/security/contracts/ids.d.ts +15 -0
  51. package/dist/types/security/contracts/index.d.ts +4 -0
  52. package/dist/types/security/contracts/schemas.d.ts +660 -0
  53. package/dist/types/security/contracts/types.d.ts +234 -0
  54. package/dist/types/security/contracts/validation.d.ts +5 -0
  55. package/dist/types/security/coordinator.d.ts +100 -0
  56. package/dist/types/security/importers/codex-security.d.ts +7 -0
  57. package/dist/types/security/importers/index.d.ts +2 -0
  58. package/dist/types/security/importers/sarif.d.ts +9 -0
  59. package/dist/types/security/index.d.ts +13 -0
  60. package/dist/types/security/preflight.d.ts +61 -0
  61. package/dist/types/security/provenance.d.ts +24 -0
  62. package/dist/types/security/publication.d.ts +78 -0
  63. package/dist/types/security/remediation.d.ts +27 -0
  64. package/dist/types/security/resource-output.d.ts +8 -0
  65. package/dist/types/security/sarif.d.ts +2 -0
  66. package/dist/types/security/store.d.ts +40 -0
  67. package/dist/types/session/agent-session-events.d.ts +2 -0
  68. package/dist/types/session/agent-session-types.d.ts +36 -1
  69. package/dist/types/session/agent-session.d.ts +4 -2
  70. package/dist/types/session/claude-session-store.d.ts +13 -0
  71. package/dist/types/session/codex-session-store.d.ts +14 -0
  72. package/dist/types/session/credential-pin.d.ts +58 -0
  73. package/dist/types/session/foreign-session-import.d.ts +15 -0
  74. package/dist/types/session/foreign-session-jsonl.d.ts +9 -0
  75. package/dist/types/session/foreign-session-store.d.ts +23 -0
  76. package/dist/types/session/session-advisors.d.ts +47 -2
  77. package/dist/types/session/session-entries.d.ts +19 -1
  78. package/dist/types/session/session-handoff.d.ts +4 -1
  79. package/dist/types/session/session-loader.d.ts +2 -0
  80. package/dist/types/session/session-maintenance.d.ts +1 -1
  81. package/dist/types/session/session-manager.d.ts +21 -0
  82. package/dist/types/session/session-tools.d.ts +25 -1
  83. package/dist/types/session/turn-recovery.d.ts +10 -4
  84. package/dist/types/slash-commands/helpers/security.d.ts +2 -0
  85. package/dist/types/system-prompt.d.ts +4 -1
  86. package/dist/types/task/executor.d.ts +14 -2
  87. package/dist/types/task/render.d.ts +7 -0
  88. package/dist/types/thinking.d.ts +18 -6
  89. package/dist/types/tools/acp-bridge.d.ts +28 -5
  90. package/dist/types/tools/builtin-names.d.ts +1 -1
  91. package/dist/types/tools/grep.d.ts +17 -1
  92. package/dist/types/tools/hub/launch.d.ts +5 -1
  93. package/dist/types/tools/index.d.ts +10 -2
  94. package/dist/types/tools/path-utils.d.ts +19 -0
  95. package/dist/types/tools/read.d.ts +2 -0
  96. package/dist/types/tools/security-scan.d.ts +96 -0
  97. package/dist/types/tools/xdev.d.ts +2 -1
  98. package/dist/types/utils/changelog.d.ts +19 -0
  99. package/dist/types/utils/git.d.ts +10 -0
  100. package/dist/types/utils/jj.d.ts +11 -4
  101. package/dist/types/web/search/types.d.ts +2 -2
  102. package/package.json +12 -12
  103. package/scripts/security-compare.ts +40 -0
  104. package/src/advisor/runtime.ts +138 -12
  105. package/src/advisor/transcript-recorder.ts +56 -0
  106. package/src/auto-thinking/classifier.ts +48 -10
  107. package/src/cli/args.ts +6 -0
  108. package/src/cli/flag-tables.ts +2 -0
  109. package/src/cli/gallery-fixtures/fs.ts +25 -0
  110. package/src/cli/session-picker.ts +34 -17
  111. package/src/cli/ttsr-cli.ts +19 -1
  112. package/src/cli.ts +9 -0
  113. package/src/collab/guest.ts +37 -4
  114. package/src/collab/host.ts +1 -0
  115. package/src/commands/launch.ts +6 -0
  116. package/src/config/model-discovery.ts +32 -5
  117. package/src/config/model-registry.ts +107 -25
  118. package/src/config/settings-schema.ts +77 -6
  119. package/src/config/settings.ts +25 -0
  120. package/src/cursor-bridge-tools.ts +81 -0
  121. package/src/cursor.ts +463 -12
  122. package/src/edit/edit-clipboard.ts +23 -0
  123. package/src/edit/hashline/diff.ts +49 -10
  124. package/src/edit/hashline/execute.ts +38 -6
  125. package/src/edit/hashline/filesystem.ts +27 -3
  126. package/src/edit/index.ts +12 -2
  127. package/src/edit/renderer.ts +4 -4
  128. package/src/edit/streaming.ts +17 -2
  129. package/src/eval/py/prelude.py +7 -3
  130. package/src/export/html/template.js +1 -1
  131. package/src/extensibility/extensions/runner.ts +70 -0
  132. package/src/extensibility/extensions/types.ts +30 -0
  133. package/src/extensibility/legacy-pi-coding-agent-shim.ts +65 -13
  134. package/src/internal-urls/index.ts +1 -0
  135. package/src/internal-urls/local-protocol.ts +3 -2
  136. package/src/internal-urls/mcp-protocol.ts +4 -1
  137. package/src/internal-urls/router.ts +4 -1
  138. package/src/internal-urls/security-protocol.ts +261 -0
  139. package/src/internal-urls/types.ts +1 -1
  140. package/src/launch/terminal-output-worker-client.ts +53 -0
  141. package/src/launch/terminal-output-worker-protocol.ts +11 -0
  142. package/src/launch/terminal-output-worker.ts +23 -0
  143. package/src/lsp/client.ts +18 -3
  144. package/src/lsp/index.ts +7 -0
  145. package/src/lsp/render.ts +1 -1
  146. package/src/main.ts +127 -56
  147. package/src/mcp/manager.ts +120 -18
  148. package/src/modes/acp/acp-agent.ts +15 -9
  149. package/src/modes/components/chat-transcript-builder.ts +30 -11
  150. package/src/modes/components/codex-reset-fireworks.ts +369 -0
  151. package/src/modes/components/read-tool-group.ts +159 -17
  152. package/src/modes/components/session-selector.ts +19 -3
  153. package/src/modes/components/status-line/component.ts +381 -54
  154. package/src/modes/components/tool-execution.ts +78 -31
  155. package/src/modes/components/usage-row.ts +10 -5
  156. package/src/modes/controllers/event-controller.ts +26 -4
  157. package/src/modes/controllers/mcp-command-controller.ts +68 -3
  158. package/src/modes/controllers/selector-controller.ts +94 -36
  159. package/src/modes/controllers/tan-command-controller.ts +14 -0
  160. package/src/modes/interactive-mode.ts +31 -17
  161. package/src/modes/rpc/host-uris.ts +6 -0
  162. package/src/modes/rpc/rpc-client.ts +18 -0
  163. package/src/modes/rpc/rpc-mode.ts +16 -1
  164. package/src/modes/rpc/rpc-types.ts +11 -0
  165. package/src/modes/theme/theme.ts +151 -6
  166. package/src/modes/types.ts +2 -1
  167. package/src/modes/utils/ui-helpers.ts +38 -21
  168. package/src/prompts/agents/security-reviewer.md +75 -0
  169. package/src/prompts/security/scan-coordinator.md +7 -0
  170. package/src/prompts/security/scan-request.md +21 -0
  171. package/src/prompts/security/validate-request.md +8 -0
  172. package/src/prompts/system/auto-thinking-difficulty.md +4 -2
  173. package/src/prompts/system/plan-mode-active.md +2 -2
  174. package/src/prompts/system/system-prompt.md +6 -0
  175. package/src/prompts/system/xdev-mount-notice.md +1 -1
  176. package/src/prompts/tools/bash.md +15 -17
  177. package/src/prompts/tools/checkpoint.md +1 -1
  178. package/src/prompts/tools/glob.md +7 -6
  179. package/src/prompts/tools/grep.md +7 -6
  180. package/src/prompts/tools/security-publish.md +1 -0
  181. package/src/prompts/tools/security-scan.md +1 -0
  182. package/src/sdk.ts +212 -21
  183. package/src/security/auth.ts +98 -0
  184. package/src/security/cloud.ts +686 -0
  185. package/src/security/comparison.ts +255 -0
  186. package/src/security/contracts/ids.ts +111 -0
  187. package/src/security/contracts/index.ts +4 -0
  188. package/src/security/contracts/schemas.ts +201 -0
  189. package/src/security/contracts/types.ts +254 -0
  190. package/src/security/contracts/validation.ts +65 -0
  191. package/src/security/coordinator.ts +708 -0
  192. package/src/security/importers/codex-security.ts +387 -0
  193. package/src/security/importers/index.ts +2 -0
  194. package/src/security/importers/sarif.ts +357 -0
  195. package/src/security/index.ts +13 -0
  196. package/src/security/preflight.ts +405 -0
  197. package/src/security/provenance.ts +106 -0
  198. package/src/security/publication.ts +326 -0
  199. package/src/security/remediation.ts +93 -0
  200. package/src/security/resource-output.ts +50 -0
  201. package/src/security/sarif.ts +78 -0
  202. package/src/security/store.ts +430 -0
  203. package/src/session/agent-session-events.ts +1 -0
  204. package/src/session/agent-session-types.ts +40 -1
  205. package/src/session/agent-session.ts +302 -175
  206. package/src/session/claude-session-store.ts +426 -0
  207. package/src/session/codex-session-store.ts +673 -0
  208. package/src/session/credential-pin.ts +93 -0
  209. package/src/session/foreign-session-import.ts +52 -0
  210. package/src/session/foreign-session-jsonl.ts +29 -0
  211. package/src/session/foreign-session-store.ts +26 -0
  212. package/src/session/model-controls.ts +11 -3
  213. package/src/session/session-advisors.ts +140 -16
  214. package/src/session/session-entries.ts +21 -1
  215. package/src/session/session-handoff.ts +20 -3
  216. package/src/session/session-loader.ts +25 -9
  217. package/src/session/session-maintenance.ts +59 -11
  218. package/src/session/session-manager.ts +61 -0
  219. package/src/session/session-tools.ts +107 -5
  220. package/src/session/settings-stream-fn.ts +1 -0
  221. package/src/session/turn-recovery.ts +97 -51
  222. package/src/slash-commands/builtin-registry.ts +152 -3
  223. package/src/slash-commands/helpers/security.ts +451 -0
  224. package/src/system-prompt.ts +7 -2
  225. package/src/task/agents.ts +2 -0
  226. package/src/task/executor.ts +20 -4
  227. package/src/task/render.ts +20 -4
  228. package/src/task/structured-subagent.ts +6 -4
  229. package/src/thinking.ts +29 -10
  230. package/src/tools/acp-bridge.ts +52 -8
  231. package/src/tools/browser.ts +5 -0
  232. package/src/tools/builtin-names.ts +1 -0
  233. package/src/tools/checkpoint.ts +0 -13
  234. package/src/tools/grep.ts +64 -8
  235. package/src/tools/hub/launch.ts +10 -15
  236. package/src/tools/index.ts +37 -5
  237. package/src/tools/path-utils.ts +91 -0
  238. package/src/tools/read.ts +3 -0
  239. package/src/tools/security-scan.ts +287 -0
  240. package/src/tools/write.ts +9 -3
  241. package/src/tools/xdev.ts +39 -14
  242. package/src/utils/changelog.ts +144 -4
  243. package/src/utils/git.ts +61 -14
  244. package/src/utils/jj.ts +19 -13
  245. package/src/web/search/providers/codex.ts +34 -0
  246. package/src/web/search/types.ts +1 -1
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Session-bound edit clipboard register.
3
+ *
4
+ * `CUT`/`PASTE` hashline ops share one {@link Clipboard} per session so
5
+ * content captured by one edit call can be pasted by a later one (and across
6
+ * files within one call). The executor works on a fork per batch and commits
7
+ * it back only after every write lands — see `executeHashlineSingle`.
8
+ */
9
+ import type { Clipboard } from "@oh-my-pi/hashline";
10
+ interface EditClipboardOwner {
11
+ editClipboard?: Clipboard;
12
+ }
13
+ /**
14
+ * Look up (or lazily create) the clipboard register attached to a session.
15
+ * Storage lives on `session.editClipboard` so it ages out exactly with the
16
+ * session itself.
17
+ */
18
+ export declare function getEditClipboard(session: EditClipboardOwner): Clipboard;
19
+ export {};
@@ -1,4 +1,4 @@
1
- import { type PatchSection, type SnapshotStore } from "@oh-my-pi/hashline";
1
+ import { type Clipboard, type PatchSection, type SnapshotStore } from "@oh-my-pi/hashline";
2
2
  export interface HashlineDiffOptions {
3
3
  /**
4
4
  * Use the streaming-tolerant applier ({@link PatchSection.applyPartialTo})
@@ -12,6 +12,14 @@ export interface HashlineDiffOptions {
12
12
  * authoring input; the final apply path still validates through Patcher.
13
13
  */
14
14
  skipHashValidation?: boolean;
15
+ /**
16
+ * Clipboard register shared across the sections of one patch preview.
17
+ * `CUT` in an earlier section feeds `PASTE` in a later one, so the preview
18
+ * matches apply. Multi-section previews MUST thread one register through
19
+ * sections in patch order; omitted, each section gets a
20
+ * private register (same-file cut/paste still previews correctly).
21
+ */
22
+ clipboard?: Clipboard;
15
23
  }
16
24
  export declare function computeHashlineSectionDiff(section: PatchSection, cwd: string, snapshots: SnapshotStore, options?: HashlineDiffOptions): Promise<{
17
25
  diff: string;
@@ -33,7 +33,14 @@ export declare class EditTool implements AgentTool<TInput> {
33
33
  readonly loadMode = "essential";
34
34
  readonly concurrency = "exclusive";
35
35
  readonly strict = true;
36
- constructor(session: ToolSession);
36
+ /**
37
+ * `mode` pins the edit variant for this instance, for callers whose protocol
38
+ * fixes the shape of an edit. The Cursor `pi_edit` frame carries
39
+ * `old_text`/`new_text` pairs, which only `replace` accepts — under the
40
+ * default `hashline` mode those args do not match the schema at all. Left
41
+ * unset, the env/settings resolution applies as before.
42
+ */
43
+ constructor(session: ToolSession, mode?: EditMode);
37
44
  get mode(): EditMode;
38
45
  get description(): string;
39
46
  get parameters(): TInput;
@@ -12,7 +12,7 @@
12
12
  * The shared renderer / `ToolExecutionComponent` consult the strategy via
13
13
  * the injected `editMode` rather than probing argument shape.
14
14
  */
15
- import { type SnapshotStore } from "@oh-my-pi/hashline";
15
+ import { type Clipboard, type SnapshotStore } from "@oh-my-pi/hashline";
16
16
  import type { Theme } from "../modes/theme/theme.js";
17
17
  import { type EditMode, resolveEditMode } from "../utils/edit-mode.js";
18
18
  export interface PerFileDiffPreview {
@@ -34,6 +34,13 @@ export interface StreamingDiffContext {
34
34
  * not flicker in the preview.
35
35
  */
36
36
  isStreaming?: boolean;
37
+ /**
38
+ * Session-persistent clipboard register (`CUT`/`PASTE`). Previews
39
+ * fork it per frame — never mutating it — so a `PASTE` of content cut in
40
+ * an earlier edit call (or an earlier section of this patch) renders the
41
+ * real rows.
42
+ */
43
+ clipboard?: Clipboard;
37
44
  }
38
45
  /**
39
46
  * Per-file projection of a streamed edit payload. Pairs one target file path
@@ -8,9 +8,10 @@ import type { ModelRegistry } from "../../config/model-registry.js";
8
8
  import type { Settings } from "../../config/settings.js";
9
9
  import type { LocalProtocolOptions } from "../../internal-urls/local-protocol.js";
10
10
  import type { MemoryRuntimeContext } from "../../memory-backend/index.js";
11
+ import type { AsyncJobSnapshot } from "../../session/agent-session.js";
11
12
  import type { SessionManager } from "../../session/session-manager.js";
12
13
  import type { BranchHandler, NavigateTreeHandler, NewSessionHandler } from "../session-handler-types.js";
13
- import type { AfterProviderResponseEvent, AssistantThinkingRenderer, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, ContextEvent, Extension, ExtensionActions, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFlag, ExtensionRuntime, ExtensionShortcut, ExtensionUIContext, InputEvent, InputEventResult, MessageRenderer, RegisteredCommand, RegisteredTool, ResourcesDiscoverEvent, SessionBeforeBranchResult, SessionBeforeCompactResult, SessionBeforeSwitchResult, SessionBeforeTreeResult, SessionCompactingResult, SessionStopEvent, SessionStopEventResult, ToolCallEvent, ToolCallEventResult, ToolResultEvent, ToolResultEventResult, UserBashEvent, UserBashEventResult, UserPythonEvent, UserPythonEventResult } from "./types.js";
14
+ import type { AfterProviderResponseEvent, AssistantThinkingRenderer, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, ContextEvent, Extension, ExtensionActions, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFlag, ExtensionRuntime, ExtensionShortcut, ExtensionUIContext, InputEvent, InputEventResult, McpNotificationEvent, MessageRenderer, RegisteredCommand, RegisteredTool, ResourcesDiscoverEvent, SessionBeforeBranchResult, SessionBeforeCompactResult, SessionBeforeSwitchResult, SessionBeforeTreeResult, SessionCompactingResult, SessionStopEvent, SessionStopEventResult, ToolCallEvent, ToolCallEventResult, ToolResultEvent, ToolResultEventResult, UserBashEvent, UserBashEventResult, UserPythonEvent, UserPythonEventResult } from "./types.js";
14
15
  /** Combined result from all before_agent_start handlers */
15
16
  interface BeforeAgentStartCombinedResult {
16
17
  messages?: NonNullable<BeforeAgentStartEventResult["message"]>[];
@@ -73,7 +74,7 @@ export declare class ExtensionRunner {
73
74
  markToolCallEmitted(toolCallId: string, toolName: string): void;
74
75
  /** Consumes a {@link markToolCallEmitted} marker; true when the loop already emitted. */
75
76
  consumeToolCallEmitted(toolCallId: string, toolName: string): boolean;
76
- constructor(extensions: Extension[], runtime: ExtensionRuntime, cwd: string, sessionManager: SessionManager, modelRegistry: ModelRegistry, getMemory?: () => MemoryRuntimeContext | undefined, settings?: Settings | undefined, localProtocolOptions?: LocalProtocolOptions | undefined);
77
+ constructor(extensions: Extension[], runtime: ExtensionRuntime, cwd: string, sessionManager: SessionManager, modelRegistry: ModelRegistry, getMemory?: () => MemoryRuntimeContext | undefined, settings?: Settings | undefined, localProtocolOptions?: LocalProtocolOptions | undefined, getAsyncJobSnapshot?: () => AsyncJobSnapshot | null);
77
78
  initialize(actions: ExtensionActions, contextActions: ExtensionContextActions, commandContextActions?: ExtensionCommandContextActions, uiContext?: ExtensionUIContext): void;
78
79
  /**
79
80
  * Forward a `credential_disabled` event from `AuthStorage` to extension handlers.
@@ -90,6 +91,22 @@ export declare class ExtensionRunner {
90
91
  * {@link onError} via {@link emit}'s normal isolation.
91
92
  */
92
93
  emitCredentialDisabled(event: CredentialDisabledEvent): Promise<void>;
94
+ /**
95
+ * Forward an MCP server notification to extension handlers.
96
+ *
97
+ * If {@link initialize} has not yet run, the notification is buffered and replayed
98
+ * once initialize wires the runtime/UI context. Matches the credential-disabled
99
+ * deferral above: the sdk.ts bridge registers `MCPManager.addNotificationListener`
100
+ * inside `createAgentSession` — BEFORE the mode controller calls `initialize()` on
101
+ * this runner — so notification frames drained by the manager (either fresh
102
+ * arrivals or replay from its own startup buffer) can reach us pre-init. Without
103
+ * this buffer they would evaporate for a second time here.
104
+ *
105
+ * Bounded at {@link MAX_PENDING_MCP_NOTIFICATIONS}; oldest entries drop under
106
+ * pressure. Never throws; per-handler errors are routed through {@link onError}
107
+ * via {@link emit}'s normal isolation.
108
+ */
109
+ emitMcpNotification(event: Omit<McpNotificationEvent, "type">): Promise<void>;
93
110
  /** Emits a session stop pass that can be cancelled with the active settle signal. */
94
111
  emitSessionStop(event: Omit<SessionStopEvent, "type">): Promise<SessionStopEventResult | undefined>;
95
112
  getUIContext(): ExtensionUIContext;
@@ -26,6 +26,7 @@ import type { LocalProtocolOptions } from "../../internal-urls/local-protocol.js
26
26
  import type { MemoryRuntimeContext } from "../../memory-backend/index.js";
27
27
  import type { CustomEditor } from "../../modes/components/custom-editor.js";
28
28
  import type { Theme } from "../../modes/theme/theme.js";
29
+ import type { AsyncJobSnapshot } from "../../session/agent-session.js";
29
30
  import type { CompactMode } from "../../session/compact-modes.js";
30
31
  import type { CustomMessage, CustomMessagePayload } from "../../session/messages.js";
31
32
  import type { ReadonlySessionManager, SessionManager } from "../../session/session-manager.js";
@@ -276,6 +277,8 @@ export interface ExtensionContext {
276
277
  ui: ExtensionUIContext;
277
278
  /** Get current context usage for the active model. */
278
279
  getContextUsage(): ContextUsage | undefined;
280
+ /** Get a read-only snapshot of async jobs owned by this session. */
281
+ getAsyncJobSnapshot(): AsyncJobSnapshot | null;
279
282
  /** Compact the session context (interactive mode shows UI). */
280
283
  compact(instructionsOrOptions?: string | CompactOptions): Promise<void>;
281
284
  /** Whether UI is available (false in print/RPC mode) */
@@ -494,6 +497,26 @@ export interface CredentialDisabledEvent {
494
497
  /** Verbatim error captured for forensics (truncated upstream). */
495
498
  disabledCause: string;
496
499
  }
500
+ /**
501
+ * Fired for every JSON-RPC notification received from a connected MCP server,
502
+ * AFTER the runtime's own handling of known list/update methods. Unknown or
503
+ * server-custom methods are delivered too — extensions can bridge them into
504
+ * session behavior by inspecting `method`/`params` and injecting a follow-up
505
+ * via `pi.sendMessage(..., { deliverAs })` or `pi.sendUserMessage(...)`.
506
+ */
507
+ export interface McpNotificationEvent {
508
+ type: "mcp_notification";
509
+ /**
510
+ * Server name as declared in the MCP config (raw, unsanitized). Note this
511
+ * differs from the sanitized prefix used in `mcp__<sanitized_server>_<tool>`
512
+ * tool names — filter by this raw name, not by tool-name prefix matching.
513
+ */
514
+ server: string;
515
+ /** JSON-RPC method (e.g. `notifications/tools/list_changed`, or server-custom). */
516
+ method: string;
517
+ /** JSON-RPC params, opaque to the runtime. */
518
+ params: unknown;
519
+ }
497
520
  /** Fired when user executes a bash command via ! or !! prefix */
498
521
  export interface UserBashEvent {
499
522
  type: "user_bash";
@@ -639,7 +662,7 @@ export declare function isToolCallEventType<TName extends string, TInput extends
639
662
  input: TInput;
640
663
  };
641
664
  /** Union of all event types */
642
- export type ExtensionEvent = ResourcesDiscoverEvent | SessionEvent | ContextEvent | BeforeProviderRequestEvent | AfterProviderResponseEvent | BeforeAgentStartEvent | AgentStartEvent | AgentEndEvent | SessionStopEvent | TurnStartEvent | TurnEndEvent | MessageStartEvent | MessageUpdateEvent | MessageEndEvent | ToolExecutionStartEvent | ToolExecutionUpdateEvent | ToolExecutionEndEvent | AutoCompactionStartEvent | AutoCompactionEndEvent | AutoRetryStartEvent | AutoRetryEndEvent | TtsrTriggeredEvent | TodoReminderEvent | GoalUpdatedEvent | CredentialDisabledEvent | UserBashEvent | UserPythonEvent | InputEvent | ToolCallEvent | ToolResultEvent | ToolApprovalRequestedEvent | ToolApprovalResolvedEvent;
665
+ export type ExtensionEvent = ResourcesDiscoverEvent | SessionEvent | ContextEvent | BeforeProviderRequestEvent | AfterProviderResponseEvent | BeforeAgentStartEvent | AgentStartEvent | AgentEndEvent | SessionStopEvent | TurnStartEvent | TurnEndEvent | MessageStartEvent | MessageUpdateEvent | MessageEndEvent | ToolExecutionStartEvent | ToolExecutionUpdateEvent | ToolExecutionEndEvent | AutoCompactionStartEvent | AutoCompactionEndEvent | AutoRetryStartEvent | AutoRetryEndEvent | TtsrTriggeredEvent | TodoReminderEvent | GoalUpdatedEvent | CredentialDisabledEvent | McpNotificationEvent | UserBashEvent | UserPythonEvent | InputEvent | ToolCallEvent | ToolResultEvent | ToolApprovalRequestedEvent | ToolApprovalResolvedEvent;
643
666
  export interface ContextEventResult {
644
667
  messages?: AgentMessage[];
645
668
  }
@@ -748,6 +771,7 @@ export interface ExtensionAPI {
748
771
  on(event: "tool_result", handler: ExtensionHandler<ToolResultEvent, ToolResultEventResult>): void;
749
772
  on(event: "user_bash", handler: ExtensionHandler<UserBashEvent, UserBashEventResult>): void;
750
773
  on(event: "user_python", handler: ExtensionHandler<UserPythonEvent, UserPythonEventResult>): void;
774
+ on(event: "mcp_notification", handler: ExtensionHandler<McpNotificationEvent>): void;
751
775
  /** Register a tool that the LLM can call. */
752
776
  registerTool<TParams extends TSchema = TSchema, TDetails = unknown>(tool: ToolDefinition<TParams, TDetails>): void;
753
777
  /** Register a custom command. */
@@ -77,6 +77,21 @@ export interface LsOperations {
77
77
  export interface LsToolOptions {
78
78
  operations?: LsOperations;
79
79
  }
80
+ export interface EditOperations {
81
+ readFile: (absolutePath: string) => Promise<Buffer>;
82
+ writeFile: (absolutePath: string, content: string) => Promise<void>;
83
+ access: (absolutePath: string) => Promise<void>;
84
+ }
85
+ export interface EditToolOptions {
86
+ operations?: EditOperations;
87
+ }
88
+ export interface WriteOperations {
89
+ writeFile: (absolutePath: string, content: string) => Promise<void>;
90
+ mkdir: (dir: string) => Promise<void>;
91
+ }
92
+ export interface WriteToolOptions {
93
+ operations?: WriteOperations;
94
+ }
80
95
  /** Format the active shortcut for legacy extensions that render keybinding hints. */
81
96
  export declare function keyText(action: Keybinding): string;
82
97
  /** Parse frontmatter using the historical Pi package-root helper. */
@@ -110,6 +125,14 @@ export declare function createFindTool(cwd: string, options?: FindToolOptions):
110
125
  export declare function createLsToolDefinition(cwd: string, options?: LsToolOptions): ToolDefinition;
111
126
  /** Create the legacy ls tool. */
112
127
  export declare function createLsTool(cwd: string, options?: LsToolOptions): ToolDefinition;
128
+ /** Create the legacy edit tool definition. */
129
+ export declare function createEditToolDefinition(cwd: string, options?: EditToolOptions): ToolDefinition;
130
+ /** Create the legacy edit tool. */
131
+ export declare function createEditTool(cwd: string, options?: EditToolOptions): ToolDefinition;
132
+ /** Create the legacy write tool definition. */
133
+ export declare function createWriteToolDefinition(cwd: string, options?: WriteToolOptions): ToolDefinition;
134
+ /** Create the legacy write tool. */
135
+ export declare function createWriteTool(cwd: string, options?: WriteToolOptions): ToolDefinition;
113
136
  /** Create legacy read, bash, edit, and write tools. */
114
137
  export declare function createCodingTools(cwd: string): ToolDefinition[];
115
138
  /** Create legacy read, grep, find, and ls tools. */
@@ -376,6 +399,8 @@ export { getProjectDir } from "@oh-my-pi/pi-utils";
376
399
  */
377
400
  export declare function getPackageDir(): string;
378
401
  export { estimateTokens } from "@oh-my-pi/pi-agent-core/compaction";
402
+ export { CONFIG_DIR_NAME } from "@oh-my-pi/pi-utils";
403
+ export { parseArgs } from "../cli/args.js";
379
404
  export * from "../index.js";
380
405
  export { formatBytes as formatSize } from "../tools/render-utils.js";
381
406
  export { copyToClipboard } from "../utils/clipboard.js";
@@ -19,6 +19,7 @@ export * from "./omp-protocol.js";
19
19
  export * from "./parse.js";
20
20
  export * from "./router.js";
21
21
  export * from "./rule-protocol.js";
22
+ export * from "./security-protocol.js";
22
23
  export * from "./skill-protocol.js";
23
24
  export * from "./ssh-protocol.js";
24
25
  export type * from "./types.js";
@@ -47,8 +47,9 @@ export declare class LocalProtocolHandler implements ProtocolHandler {
47
47
  readonly immutable = false;
48
48
  /**
49
49
  * Install a process-global override that wins over the AgentRegistry-based
50
- * derivation. Used by SDK consumers that wire `localProtocolOptions` on
51
- * `createAgentSession` and by subagents that share their parent's root.
50
+ * derivation. Used by top-level SDK consumers that wire
51
+ * `localProtocolOptions` on `createAgentSession`; subagents keep their
52
+ * inherited mapping session-bound.
52
53
  */
53
54
  static setOverride(value: LocalProtocolOptions | undefined): void;
54
55
  /** Reset the process-global override. Test-only. */
@@ -0,0 +1,15 @@
1
+ import { SecurityStore } from "../security/store.js";
2
+ import type { InternalResource, InternalUrl, ProtocolHandler, ResolveContext, UrlCompletion } from "./types.js";
3
+ export type SecurityStoreResolver = (cwd: string, signal?: AbortSignal) => Promise<SecurityStore>;
4
+ export declare function isSecurityEnabled(): boolean;
5
+ export declare class SecurityDisabledError extends Error {
6
+ constructor();
7
+ }
8
+ export declare class SecurityProtocolHandler implements ProtocolHandler {
9
+ #private;
10
+ readonly scheme = "security";
11
+ readonly immutable = true;
12
+ constructor(resolveStore?: SecurityStoreResolver, enabled?: () => boolean);
13
+ resolve(url: InternalUrl, context?: ResolveContext): Promise<InternalResource>;
14
+ complete(query?: string, context?: ResolveContext): Promise<UrlCompletion[]>;
15
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Types for the internal URL routing system.
3
3
  *
4
- * Internal URLs (`agent://`, `artifact://`, `history://`, `issue://`, `local://`, `mcp://`, `memory://`, `omp://`, `pr://`, `rule://`, `skill://`, `ssh://`, `vault://`, and `xd://`) are resolved by tools like read,
4
+ * Internal URLs (`agent://`, `artifact://`, `history://`, `issue://`, `local://`, `mcp://`, `memory://`, `omp://`, `pr://`, `rule://`, `security://`, `skill://`, `ssh://`, `vault://`, and `xd://`) are resolved by tools like read,
5
5
  * providing access to agent outputs and server resources without exposing filesystem paths.
6
6
  */
7
7
  import type { Skill } from "../extensibility/skills.js";
@@ -0,0 +1,5 @@
1
+ import type { TerminalOutputOptions } from "./terminal-output.js";
2
+ /** Replay legacy broker PTY bytes without evaluating xterm in the client process. */
3
+ export declare function renderTerminalOutputIsolated(output: string, options: TerminalOutputOptions): Promise<string[] | undefined>;
4
+ /** Distribution smoke for source, npm-bundle, and compiled worker routing. */
5
+ export declare function smokeTestTerminalOutputWorker(): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import type { TerminalOutputOptions } from "./terminal-output.js";
2
+ /** Hidden CLI selector for legacy PTY replay outside the client process. */
3
+ export declare const TERMINAL_OUTPUT_WORKER_ARG = "__omp_worker_terminal_output";
4
+ export interface TerminalOutputWorkerRequest {
5
+ output: string;
6
+ options: TerminalOutputOptions;
7
+ }
8
+ export type TerminalOutputWorkerResult = {
9
+ ok: true;
10
+ rows: string[] | undefined;
11
+ } | {
12
+ ok: false;
13
+ error: string;
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -19,6 +19,8 @@ export interface WatchedFileChange {
19
19
  export declare function supportsDocumentDiagnostics(client: LspClient): boolean;
20
20
  /** Timeout for warmup initialize requests (5 seconds) */
21
21
  export declare const WARMUP_TIMEOUT_MS = 5000;
22
+ /** Allow an explicit user reload to retry a matching initialization failure immediately. */
23
+ export declare function clearInitializationFailure(config: ServerConfig, cwd: string): void;
22
24
  /**
23
25
  * Get or create an LSP client for the given server configuration and working directory.
24
26
  * @param config - Server configuration
@@ -8,6 +8,7 @@ import type { SubmittedUserInput } from "./modes/types.js";
8
8
  import { type CreateAgentSessionOptions, type CreateAgentSessionResult, createAgentSession, discoverAuthStorage } from "./sdk.js";
9
9
  import type { AgentSession } from "./session/agent-session.js";
10
10
  import type { AuthStorage } from "./session/auth-storage.js";
11
+ import type { ForeignSessionSource, ForeignSessionStore } from "./session/foreign-session-store.js";
11
12
  import { type SessionInfo } from "./session/session-listing.js";
12
13
  import { SessionManager } from "./session/session-manager.js";
13
14
  type RunAcpMode = (createSession: AcpSessionFactory) => Promise<never>;
@@ -65,6 +66,7 @@ interface RunRootCommandDependencies {
65
66
  discoverAuthStorage?: typeof discoverAuthStorage;
66
67
  selectSession?: typeof selectSession;
67
68
  runAcpMode?: RunAcpMode;
69
+ createForeignSessionStore?: (source: ForeignSessionSource) => ForeignSessionStore;
68
70
  settings?: Settings;
69
71
  forceSetupWizard?: boolean;
70
72
  }
@@ -61,13 +61,42 @@ export declare class MCPManager {
61
61
  static resetForTests(): void;
62
62
  constructor(cwd: string, toolCache?: MCPToolCache | null);
63
63
  /**
64
- * Set a callback to receive all server notifications.
64
+ * Register a listener for server-initiated MCP notifications.
65
+ *
66
+ * The listener is called for every JSON-RPC notification received from any
67
+ * connected server, AFTER the manager's own handling of known methods
68
+ * (`notifications/tools/list_changed`, `notifications/resources/list_changed`,
69
+ * `notifications/resources/updated`, `notifications/prompts/list_changed`).
70
+ * For list-change methods the internal refresh promise is awaited before
71
+ * fanout, so listeners observe up-to-date manager and tool state. Unknown
72
+ * or server-custom methods are also delivered, letting consumers bridge
73
+ * server-initiated events into session-level behavior (e.g. an extension
74
+ * injecting a steer via `pi.sendMessage`).
75
+ *
76
+ * Notifications received before any listener attached are buffered
77
+ * (bounded FIFO, cap {@link NOTIFICATION_BUFFER_CAP}, drop-oldest) and
78
+ * drained into the first subscriber — matches {@link setOnPromptsChanged}'s
79
+ * replay-on-attach and {@link IrcBus}'s mailbox semantics.
80
+ *
81
+ * Returns an unsubscribe function; call it to remove the listener.
82
+ *
83
+ * Multiple listeners are allowed; each is invoked with independent error
84
+ * isolation — a listener that throws does not prevent other listeners from
85
+ * firing.
65
86
  */
66
- setOnNotification(handler: (serverName: string, method: string, params: unknown) => void): void;
87
+ addNotificationListener(listener: (serverName: string, method: string, params: unknown) => void): () => void;
67
88
  /**
68
89
  * Set a callback to fire when any server's tools change.
69
- */
70
- setOnToolsChanged(handler: (tools: CustomTool<TSchema, MCPToolDetails>[]) => void): void;
90
+ *
91
+ * May return a Promise; if so, {@link refreshServerTools} awaits it so that
92
+ * downstream consumers (e.g. `mcp_notification` listeners for
93
+ * `notifications/tools/list_changed`) observe not just the manager's
94
+ * refreshed tool set but also any session-level rebind driven by the
95
+ * handler (`session.refreshMCPTools`). Other callsites (initial connect,
96
+ * disconnect, reconnect) invoke the handler synchronously — their downstream
97
+ * chains don't need to serialize on the rebind.
98
+ */
99
+ setOnToolsChanged(handler: (tools: CustomTool<TSchema, MCPToolDetails>[]) => void | Promise<void>): void;
71
100
  /**
72
101
  * Set a callback to fire when any server's resources change.
73
102
  */
@@ -0,0 +1,51 @@
1
+ import { type Component, type OverlayHandle, type OverlayOptions } from "@oh-my-pi/pi-tui";
2
+ /** The active Codex account fields retained between status refreshes. */
3
+ export interface CodexResetUsageSnapshot {
4
+ /** When this usage report was observed, if supplied by the provider. */
5
+ observedAt?: number;
6
+ /** Weekly usage, its quota identity, and its previously scheduled reset deadline. */
7
+ sevenDay?: {
8
+ percent: number;
9
+ resetsAt?: number;
10
+ tier?: string;
11
+ plan?: string;
12
+ };
13
+ savedResets?: number;
14
+ }
15
+ /** A detected Codex quota event that can trigger the fireworks presentation. */
16
+ export type CodexResetFireworksEvent = {
17
+ kind: "unscheduled-weekly-reset";
18
+ } | {
19
+ kind: "saved-reset-banked";
20
+ added: number;
21
+ available: number;
22
+ };
23
+ interface CodexResetFireworksHost {
24
+ ui: {
25
+ showOverlay(component: Component, options?: OverlayOptions): OverlayHandle;
26
+ setFocus(component: Component): void;
27
+ requestRender(): void;
28
+ readonly terminal: {
29
+ readonly rows: number;
30
+ };
31
+ };
32
+ }
33
+ /**
34
+ * Compare consecutive reports for one Codex account. A saved-reset grant takes
35
+ * precedence when both changes arrive in the same report. A verified decrease,
36
+ * or a prior positive balance becoming unavailable, suppresses the weekly event
37
+ * because the user may have redeemed a credit. Other weekly usage drops are
38
+ * celebrated only before the previously scheduled reset deadline.
39
+ */
40
+ export declare function detectCodexResetFireworks(previous: CodexResetUsageSnapshot, current: CodexResetUsageSnapshot): CodexResetFireworksEvent | undefined;
41
+ /** Owns the at-most-one modal celebration lifecycle for an interactive session. */
42
+ export declare class CodexResetFireworksController {
43
+ #private;
44
+ private readonly host;
45
+ constructor(host: CodexResetFireworksHost);
46
+ /** Present a celebration unless another one already owns the modal overlay. */
47
+ show(event: CodexResetFireworksEvent): boolean;
48
+ /** Stop the active celebration and release its overlay, if present. */
49
+ dispose(): void;
50
+ }
51
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { AssistantMessage, Usage } from "@oh-my-pi/pi-ai";
1
2
  import type { Component } from "@oh-my-pi/pi-tui";
2
3
  import { Container } from "@oh-my-pi/pi-tui";
3
4
  import type { ToolExecutionHandle } from "./tool-execution.js";
@@ -10,6 +11,12 @@ export declare function readArgsHaveTarget(args: unknown): boolean;
10
11
  * they list devices/docs and read better in the compact grouped view.
11
12
  */
12
13
  export declare function readArgsCollapseIntoGroup(args: unknown): boolean;
14
+ /**
15
+ * Return the collapsed read calls that can own a turn's usage row. Mixed-tool
16
+ * turns and visible content after a read keep the standalone row so request
17
+ * metrics retain their transcript ordering.
18
+ */
19
+ export declare function groupedReadUsageCallIds(message: AssistantMessage): string[] | undefined;
13
20
  type ReadRenderArgs = {
14
21
  path?: string;
15
22
  file_path?: string;
@@ -37,6 +44,11 @@ export declare class ReadToolGroupComponent extends Container implements ToolExe
37
44
  details?: unknown;
38
45
  isError?: boolean;
39
46
  }, isPartial?: boolean, toolCallId?: string): void;
47
+ /**
48
+ * Nest one request's usage beneath the last visible read call from that
49
+ * request. Parallel reads share one row rather than duplicating request totals.
50
+ */
51
+ attachUsage(toolCallIds: readonly string[], usage: Usage, durationMs?: number, ttftMs?: number, timestamp?: number): boolean;
40
52
  setArgsComplete(_toolCallId?: string): void;
41
53
  setExpanded(expanded: boolean): void;
42
54
  getComponent(): Component;
@@ -63,6 +63,12 @@ export interface SessionSelectorOptions {
63
63
  loadAllSessions?: () => Promise<SessionInfo[]>;
64
64
  /** Preloaded all-projects list; cached so the first Tab toggle is instant. */
65
65
  allSessions?: SessionInfo[];
66
+ /** Picker heading; defaults to "Resume Session". */
67
+ title?: string;
68
+ /** Fixed scope label, or false to omit the scope suffix. */
69
+ scopeLabel?: string | false;
70
+ /** Show each session's working directory in the list. */
71
+ showCwd?: boolean;
66
72
  /**
67
73
  * Reads the live terminal height so the visible window fits the viewport.
68
74
  * Omitted only in tests; defaults to a conservative 24 rows.
@@ -1,5 +1,6 @@
1
1
  import { type Component } from "@oh-my-pi/pi-tui";
2
2
  import type { AgentSession } from "../../../session/agent-session.js";
3
+ import { type CodexResetFireworksEvent } from "../codex-reset-fireworks.js";
3
4
  import { type SegmentContext } from "./segments.js";
4
5
  import type { CollabStatus, EffectiveStatusLineSettings, StatusLineSettings } from "./types.js";
5
6
  export declare class StatusLineComponent implements Component {
@@ -73,10 +74,32 @@ export declare class StatusLineComponent implements Component {
73
74
  */
74
75
  setVibeWorkerTokenRateProvider(provider: (() => number | null) | undefined): void;
75
76
  setCollabStatus(status: CollabStatus | null): void;
77
+ /** Set the callback that presents detected Codex reset celebrations, or clear it with `undefined`. */
78
+ setCodexResetFireworksHandler(handler: ((event: CodexResetFireworksEvent) => void) | undefined): void;
76
79
  setHookStatus(key: string, text: string | undefined): void;
77
80
  watchBranch(onBranchChange: () => void): void;
78
81
  dispose(): void;
79
82
  invalidate(): void;
83
+ /**
84
+ * Explicit Git/repository cache invalidation. Aborts any in-flight
85
+ * reftable HEAD/PR resolve, bumps the stale-result generation, and drops
86
+ * the branch/PR/jj caches so the next render refetches from disk. Called
87
+ * by the git watcher on a HEAD move and by {@link applyCwdChange} on a
88
+ * repo/cwd switch. Generic repaints use {@link invalidate} instead and
89
+ * must never reach this path.
90
+ */
91
+ invalidateGitCaches(): void;
92
+ /**
93
+ * Re-point the status line's VCS watcher and caches at a new cwd/repository.
94
+ * Atomically retires the old watcher/listeners, invalidates VCS caches and
95
+ * in-flight controllers, then runs watcher setup for the new cwd and requests
96
+ * a repaint. Called by {@link InteractiveMode.applyCwdChange} after the
97
+ * SessionManager's cwd has moved — the watcher ownership always follows the
98
+ * effective cwd/repo, so a stale watcher for the previous repo can never
99
+ * invalidate the new one. Generic repaints use {@link invalidate} and must
100
+ * never retire the watcher or abort a live resolve.
101
+ */
102
+ applyCwdChange(): void;
80
103
  /**
81
104
  * Startup redraws only arm a short-delayed task; timeout releases the render
82
105
  * cadence while a late successful fetch can still refresh the cached segment.
@@ -1,4 +1,4 @@
1
- import type { SnapshotStore } from "@oh-my-pi/hashline";
1
+ import type { Clipboard, SnapshotStore } from "@oh-my-pi/hashline";
2
2
  import type { AgentTool } from "@oh-my-pi/pi-agent-core";
3
3
  import { type Component, Container, type NativeScrollbackLiveRegion, type TUI } from "@oh-my-pi/pi-tui";
4
4
  /**
@@ -8,6 +8,13 @@ import { type Component, Container, type NativeScrollbackLiveRegion, type TUI }
8
8
  */
9
9
  export interface TranscriptLiveRegionProbe {
10
10
  isBlockInLiveRegion(component: Component): boolean;
11
+ /**
12
+ * Whether none of the block's rows have entered native scrollback (see
13
+ * `TranscriptContainer.isBlockUncommitted`). Optional: standalone hosts
14
+ * without commit tracking omit it, and blocks treat their rows as
15
+ * uncommitted.
16
+ */
17
+ isBlockUncommitted?(component: Component): boolean;
11
18
  }
12
19
  /** Minimal TUI surface ToolExecutionComponent uses to schedule repaints and share image budget. */
13
20
  export interface ToolExecutionUi {
@@ -18,6 +25,8 @@ export interface ToolExecutionUi {
18
25
  }
19
26
  export interface ToolExecutionOptions {
20
27
  snapshots?: SnapshotStore;
28
+ /** Session-persistent edit clipboard register, forked per preview frame. */
29
+ clipboard?: Clipboard;
21
30
  showImages?: boolean;
22
31
  editFuzzyThreshold?: number;
23
32
  editAllowFuzzy?: boolean;
@@ -94,12 +103,12 @@ export declare class ToolExecutionComponent extends Container implements NativeS
94
103
  getNativeScrollbackLiveRegionStart(): number | undefined;
95
104
  /**
96
105
  * Keeps in-flight TV-wall frames out of immutable native scrollback: the
97
- * `vibe_wait` wall and displaceable snapshots (`hub` waiting polls, `todo`
98
- * lists). Their frames replace each other rather than append, and their
99
- * rows mutate every spinner tick an unpinned commit records a per-tick
100
- * frozen snapshot AND force-seals the block (see TranscriptContainer's
101
- * committed-snapshot seal), so the next poll stacks a new frame instead of
102
- * displacing this one.
106
+ * `vibe_wait` wall, displaceable snapshots (`hub` waiting polls, `todo`
107
+ * lists), and live `task` calls. Their frames replace each other rather
108
+ * than append task progress rows rewrite in place on every snapshot —
109
+ * so an unpinned commit records a per-tick frozen snapshot (and for
110
+ * displaceable blocks force-seals them, stacking the next poll below).
111
+ * The finalized frame commits exactly once when the pin lifts.
103
112
  */
104
113
  isNativeScrollbackLiveRegionPinned(): boolean;
105
114
  /**
@@ -1,3 +1,5 @@
1
1
  import type { Usage } from "@oh-my-pi/pi-ai";
2
2
  import { Container } from "@oh-my-pi/pi-tui";
3
+ /** Format the metrics shared by standalone usage blocks and compact tool groups. */
4
+ export declare function formatUsageRow(usage: Usage, durationMs?: number, ttftMs?: number, timestamp?: number): string;
3
5
  export declare function createUsageRowBlock(usage: Usage, durationMs?: number, ttftMs?: number, timestamp?: number): Container;
@@ -1,5 +1,5 @@
1
1
  import { type Component } from "@oh-my-pi/pi-tui";
2
- import type { MCPAuthChallenge, MCPServerConfig } from "../../mcp/types.js";
2
+ import type { MCPAuthChallenge, MCPConfigFile, MCPServerConfig } from "../../mcp/types.js";
3
3
  import type { InteractiveModeContext } from "../types.js";
4
4
  /**
5
5
  * Renders the MCP OAuth fallback URL. Always shows the full authorization URL
@@ -34,6 +34,31 @@ export declare class MCPAuthorizationLinkPrompt implements Component {
34
34
  export declare class MCPOAuthCancelledError extends Error {
35
35
  constructor(message?: string);
36
36
  }
37
+ /**
38
+ * Collect the de-duplicated union of every MCP server name we know about:
39
+ * user config, project config, and any runtime-discovered servers not
40
+ * already present in either config (`ctx.mcpManager.getAllServerNames()`
41
+ * covers connections, pending connections, and discovered-but-not-yet-
42
+ * connected sources).
43
+ *
44
+ * `includeDisabledOnly` controls names found only in
45
+ * `userConfig.disabledServers`, while `includeDisabledConfigured` controls
46
+ * config entries whose `enabled` flag is false. Both default to true because
47
+ * callers such as `/mcp list` need the complete union. Autocomplete callers
48
+ * must disable the categories their target operation cannot accept.
49
+ *
50
+ * This is the single source of truth for "every known server name": both
51
+ * `MCPCommandController#handleList()` and the `/mcp` slash-command argument
52
+ * completer (server-name autocomplete for `enable`/`disable`/`test`/etc.)
53
+ * call this instead of re-deriving the union themselves.
54
+ *
55
+ * `preloaded` lets a caller that already read both config files (e.g.
56
+ * `#handleList()`) pass them in and skip the redundant re-read.
57
+ */
58
+ export declare function collectMcpServerNames(ctx: InteractiveModeContext, preloaded?: {
59
+ userConfig: MCPConfigFile;
60
+ projectConfig: MCPConfigFile;
61
+ }, includeDisabledOnly?: boolean, includeDisabledConfigured?: boolean): Promise<string[]>;
37
62
  export declare class MCPCommandController {
38
63
  #private;
39
64
  private ctx;
@@ -1,5 +1,6 @@
1
1
  import type { Component } from "@oh-my-pi/pi-tui";
2
2
  import type { InteractiveModeContext } from "../../modes/types.js";
3
+ import type { ForeignSessionSource } from "../../session/foreign-session-store.js";
3
4
  import type { SessionObserverRegistry } from "../session-observer-registry.js";
4
5
  export declare class SelectorController {
5
6
  #private;
@@ -49,7 +50,7 @@ export declare class SelectorController {
49
50
  showUserMessageSelector(): void;
50
51
  showCopySelector(): void;
51
52
  showTreeSelector(): void;
52
- showSessionSelector(): Promise<void>;
53
+ showSessionSelector(source?: ForeignSessionSource): Promise<void>;
53
54
  handleResumeSession(sessionPath: string, options?: {
54
55
  settingsFlushed?: boolean;
55
56
  }): Promise<boolean>;