@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
@@ -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>;
@@ -14,11 +14,13 @@ import type { MCPManager } from "../mcp/index.js";
14
14
  import { type PlanApprovalDetails } from "../plan-mode/approved-plan.js";
15
15
  import { type AgentSession } from "../session/agent-session.js";
16
16
  import type { CompactMode } from "../session/compact-modes.js";
17
+ import type { ForeignSessionSource } from "../session/foreign-session-store.js";
17
18
  import { HistoryStorage } from "../session/history-storage.js";
18
19
  import type { SessionContext } from "../session/session-context.js";
19
20
  import type { SessionManager } from "../session/session-manager.js";
20
21
  import type { ShakeMode } from "../session/shake-types.js";
21
22
  import type { LspStartupServerInfo } from "../tools/index.js";
23
+ import { type StartupChangelogSelection } from "../utils/changelog.js";
22
24
  import type { EventBus } from "../utils/event-bus.js";
23
25
  import type { AssistantMessageComponent } from "./components/assistant-message.js";
24
26
  import type { BashExecutionComponent } from "./components/bash-execution.js";
@@ -174,7 +176,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
174
176
  focusParentSession(): Promise<void>;
175
177
  unfocusSession(): Promise<void>;
176
178
  clearTransientSessionUi(): void;
177
- constructor(session: AgentSession, version: string, changelogMarkdown?: string | undefined, setToolUIContext?: (uiContext: ExtensionUIContext, hasUI: boolean) => void, lspServers?: LspStartupServerInfo[] | undefined, mcpManager?: MCPManager, eventBus?: EventBus);
179
+ constructor(session: AgentSession, version: string, startupChangelog?: StartupChangelogSelection | undefined, setToolUIContext?: (uiContext: ExtensionUIContext, hasUI: boolean) => void, lspServers?: LspStartupServerInfo[] | undefined, mcpManager?: MCPManager, eventBus?: EventBus);
178
180
  playWelcomeIntro(): void;
179
181
  init(options?: InteractiveModeInitOptions): Promise<void>;
180
182
  /** Reload the title-generation system prompt override for the provided working
@@ -257,9 +259,10 @@ export declare class InteractiveMode implements InteractiveModeContext {
257
259
  handlePlanModeCommand(initialPrompt?: string): Promise<void>;
258
260
  /**
259
261
  * `/vibe` toggle. Entering installs the ephemeral vibe tools, strips the
260
- * active toolset down to `read` plus those tools, and injects the director
261
- * context. Exiting unregisters them, restores the previous toolset, and kills
262
- * every worker session so workers cannot outlive the mode that directs them.
262
+ * active toolset down to `read`, optional parent-owned `todo`, plus those
263
+ * tools, and injects the director context. Exiting unregisters them, restores
264
+ * the previous toolset, and kills every worker session so workers cannot
265
+ * outlive the mode that directs them.
263
266
  */
264
267
  handleVibeModeCommand(initialPrompt?: string): Promise<void>;
265
268
  handleGoalModeCommand(rest?: string): Promise<void>;
@@ -368,7 +371,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
368
371
  showUserMessageSelector(): void;
369
372
  showCopySelector(): void;
370
373
  showTreeSelector(): void;
371
- showSessionSelector(): void;
374
+ showSessionSelector(source?: ForeignSessionSource): void;
372
375
  handleResumeSession(sessionPath: string): Promise<void>;
373
376
  handleSessionDeleteCommand(): Promise<void>;
374
377
  showOAuthSelector(mode: "login" | "logout", providerId?: string): Promise<void>;
@@ -135,6 +135,13 @@ export declare class RpcClient {
135
135
  * Get current session state.
136
136
  */
137
137
  getState(): Promise<RpcSessionState>;
138
+ /**
139
+ * Enable or disable fast mode for the active model family.
140
+ */
141
+ setFastMode(enabled: boolean): Promise<{
142
+ enabled: boolean;
143
+ active: boolean;
144
+ }>;
138
145
  /**
139
146
  * Configure subagent frames emitted by the RPC server. Servers default to "off".
140
147
  * "progress" emits lifecycle/progress frames; "events" additionally emits raw subagent session events.
@@ -50,6 +50,10 @@ export type RpcCommand = {
50
50
  } | {
51
51
  id?: string;
52
52
  type: "get_state";
53
+ } | {
54
+ id?: string;
55
+ type: "set_fast_mode";
56
+ enabled: boolean;
53
57
  } | {
54
58
  id?: string;
55
59
  type: "get_available_commands";
@@ -187,6 +191,9 @@ export interface RpcSessionState {
187
191
  sessionId: string;
188
192
  sessionName?: string;
189
193
  autoCompactionEnabled: boolean;
194
+ fastModeEnabled: boolean;
195
+ fastModeActive: boolean;
196
+ tokensPerSecond: number | null;
190
197
  messageCount: number;
191
198
  queuedMessageCount: number;
192
199
  todoPhases: TodoPhase[];
@@ -315,6 +322,15 @@ export type RpcResponse = {
315
322
  command: "get_state";
316
323
  success: true;
317
324
  data: RpcSessionState;
325
+ } | {
326
+ id?: string;
327
+ type: "response";
328
+ command: "set_fast_mode";
329
+ success: true;
330
+ data: {
331
+ enabled: boolean;
332
+ active: boolean;
333
+ };
318
334
  } | {
319
335
  id?: string;
320
336
  type: "response";
@@ -1,6 +1,6 @@
1
1
  import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
2
2
  import type { Effort } from "@oh-my-pi/pi-ai";
3
- import type { EditorTheme, MarkdownTheme, SelectListTheme, SettingsListTheme, SymbolTheme } from "@oh-my-pi/pi-tui";
3
+ import type { EditorTheme, MarkdownTheme, SelectListTheme, SettingsListTheme, SymbolTheme, Terminal } from "@oh-my-pi/pi-tui";
4
4
  export { getLanguageFromPath, isMarkdownPath } from "../../utils/lang-from-path.js";
5
5
  export type SymbolPreset = "unicode" | "nerd" | "ascii";
6
6
  /**
@@ -328,6 +328,17 @@ export declare function getAvailableSymbolPresets(): SymbolPreset[];
328
328
  * Check if a string is a valid symbol preset.
329
329
  */
330
330
  export declare function isValidSymbolPreset(preset: string): preset is SymbolPreset;
331
+ type MacOSAppearanceReprobeTerminal = Pick<Terminal, "appearance" | "onAppearanceChange" | "onAppearanceReport" | "onPrivateModeReport" | "refreshAppearance">;
332
+ /**
333
+ * Fall back to native macOS appearance notifications when the terminal
334
+ * explicitly confirms that Mode 2031 notifications are unsupported.
335
+ *
336
+ * Native notifications provisionally repaint from the host appearance and
337
+ * synchronously trigger an OSC 11 probe, followed by a bounded burst of six
338
+ * retries. A changed terminal classification cancels the sequence; otherwise
339
+ * a confirmed terminal classification is restored at the validation deadline.
340
+ */
341
+ export declare function startMacOSAppearanceReprobeFallback(terminal: MacOSAppearanceReprobeTerminal): () => void;
331
342
  export declare function stopThemeWatcher(): void;
332
343
  /**
333
344
  * Get resolved theme colors as CSS-compatible hex strings.
@@ -13,6 +13,7 @@ import type { MCPManager } from "../mcp/index.js";
13
13
  import type { PlanApprovalDetails } from "../plan-mode/approved-plan.js";
14
14
  import type { AgentSession } from "../session/agent-session.js";
15
15
  import type { CompactMode } from "../session/compact-modes.js";
16
+ import type { ForeignSessionSource } from "../session/foreign-session-store.js";
16
17
  import type { HistoryStorage } from "../session/history-storage.js";
17
18
  import type { SessionContext } from "../session/session-context.js";
18
19
  import type { SessionManager } from "../session/session-manager.js";
@@ -357,7 +358,7 @@ export interface InteractiveModeContext {
357
358
  showUserMessageSelector(): void;
358
359
  showCopySelector(): void;
359
360
  showTreeSelector(): void;
360
- showSessionSelector(): void;
361
+ showSessionSelector(source?: ForeignSessionSource): void;
361
362
  handleResumeSession(sessionPath: string): Promise<void>;
362
363
  handleSessionDeleteCommand(): Promise<void>;
363
364
  showOAuthSelector(mode: "login" | "logout", providerId?: string): Promise<void>;
@@ -270,6 +270,7 @@ export type * from "./extensibility/extensions/index.js";
270
270
  export type { Skill } from "./extensibility/skills.js";
271
271
  export type { FileSlashCommand } from "./extensibility/slash-commands.js";
272
272
  export type { MCPManager, MCPServerConfig, MCPServerConnection, MCPToolsLoadResult } from "./mcp/index.js";
273
+ export { type AgentRef, AgentRegistry, MAIN_AGENT_ID } from "./registry/agent-registry.js";
273
274
  export type { Tool } from "./tools/index.js";
274
275
  export { buildDirectoryTree, buildWorkspaceTree, type DirectoryTree, type WorkspaceTree } from "./workspace-tree.js";
275
276
  export { BashTool, BUILTIN_TOOLS, createTools, EditTool, EvalTool, GlobTool, GrepTool, HIDDEN_TOOLS, ReadTool, type ToolSession, WebSearchTool, WriteTool, };
@@ -50,6 +50,8 @@ export type AgentSessionEvent = Exclude<AgentEvent, {
50
50
  type: "retry_fallback_succeeded";
51
51
  model: string;
52
52
  role: string;
53
+ } | {
54
+ type: "model_changed";
53
55
  } | {
54
56
  type: "ttsr_triggered";
55
57
  rules: Rule[];
@@ -1,4 +1,4 @@
1
- import type { Agent, AgentMessage, AgentTool, StreamFn, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
1
+ import type { Agent, AgentMessage, AgentTool, AgentToolContext, StreamFn, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
2
2
  import type { Context, Effort, ImageContent, Message, MessageAttribution, Model, OAuthAccountSummary, ServiceTierByFamily, SimpleStreamOptions, ToolChoice } from "@oh-my-pi/pi-ai";
3
3
  import type { postmortem } from "@oh-my-pi/pi-utils";
4
4
  import type { AdvisorConfig } from "../advisor/index.js";
@@ -6,6 +6,7 @@ import type { AsyncJob, AsyncJobDeliveryState, AsyncJobManager } from "../async/
6
6
  import type { ModelRegistry } from "../config/model-registry.js";
7
7
  import type { PromptTemplate } from "../config/prompt-templates.js";
8
8
  import type { Settings, SkillsSettings } from "../config/settings.js";
9
+ import type { CursorMcpResourceAdapter } from "../cursor.js";
9
10
  import type { RawSseDebugBuffer } from "../debug/raw-sse-buffer.js";
10
11
  import type { TtsrManager } from "../export/ttsr.js";
11
12
  import type { LoadedCustomCommand } from "../extensibility/custom-commands/index.js";
@@ -143,6 +144,8 @@ export interface AgentSessionConfig {
143
144
  sideStreamFn?: StreamFn;
144
145
  /** Stream wrapper for advisor requests. */
145
146
  advisorStreamFn?: StreamFn;
147
+ /** Advisor spend already recorded for the session being opened, restored on resume. */
148
+ initialAdvisorCosts?: ReadonlyMap<string, number>;
146
149
  /** Prefer websocket transport for OpenAI Codex requests when supported. */
147
150
  preferWebsockets?: boolean;
148
151
  /** Provider payload hook used by the active session request path. */
@@ -194,6 +197,38 @@ export interface AgentSessionConfig {
194
197
  providerPromptCacheKeySource?: "explicit" | "fork";
195
198
  /** Full advisor toolset built against an advisor-scoped tool session. */
196
199
  advisorTools?: AgentTool[];
200
+ /**
201
+ * Build a `grep` honoring a Cursor `pi_grep` frame's own context width and
202
+ * match cap, against the advisor-scoped tool session. Without it an advisor
203
+ * running on Cursor silently drops both fields.
204
+ */
205
+ advisorCreateGrepTool?(options: {
206
+ context?: number;
207
+ totalMatchLimit?: number;
208
+ }): AgentTool | undefined;
209
+ /**
210
+ * Build the `replace`-mode `edit` a Cursor `pi_edit` frame needs, against the
211
+ * advisor-scoped tool session. The advisor's ordinary instance follows the
212
+ * configured `edit.mode` and rejects the frame's `old_text`/`new_text` pairs.
213
+ */
214
+ advisorCreateEditTool?(): AgentTool | undefined;
215
+ /**
216
+ * The execute-time context the advisor's bridge tools resolve approval from.
217
+ *
218
+ * `ExtensionToolWrapper` reads `tools.approvalMode`, per-tool
219
+ * `tools.approval.<tool>` policies and `autoApprove` only from this context;
220
+ * with none it defaults to `yolo` with empty policies, so a bridge tool would
221
+ * run a native frame the user configured `ask` or `deny` for.
222
+ */
223
+ advisorGetToolContext?: () => AgentToolContext | undefined;
224
+ /**
225
+ * The live MCP connections the advisor's Cursor resource frames answer from.
226
+ *
227
+ * Advisors share the session's connections and may be granted tools from
228
+ * those same servers; without this their `list_mcp_resources` reports an
229
+ * empty catalog and every `read_mcp_resource` a `not_found`.
230
+ */
231
+ advisorMcpResources?: CursorMcpResourceAdapter;
197
232
  /** Preloaded watchdog prompt content for the advisor. */
198
233
  advisorWatchdogPrompt?: string;
199
234
  /** Shared advisor instructions loaded from WATCHDOG.yml. */
@@ -12,12 +12,12 @@
12
12
  *
13
13
  * Modes use this class and add their own I/O layer on top.
14
14
  */
15
- import type { InMemorySnapshotStore } from "@oh-my-pi/hashline";
15
+ import type { Clipboard, InMemorySnapshotStore } from "@oh-my-pi/hashline";
16
16
  import { type Agent, type AgentMessage, type AgentState, type AgentTool, type AgentToolContext, type AgentToolResult, type ThinkingLevel, type ToolChoiceDirective } from "@oh-my-pi/pi-agent-core";
17
17
  import { type CompactionResult, type ShakeConfig } from "@oh-my-pi/pi-agent-core/compaction";
18
18
  import type { AssistantMessage, ImageContent, Message, Model, ProviderSessionState, ResetCreditAccountStatus, ResetCreditRedeemOutcome, ResetCreditTarget, ServiceTier, ServiceTierByFamily, ServiceTierFamily, SimpleStreamOptions, TextContent, UsageReport } from "@oh-my-pi/pi-ai";
19
19
  import { type Effort } from "@oh-my-pi/pi-ai";
20
- import type { AdvisorConfig, AdvisorRuntimeStatus } from "../advisor/index.js";
20
+ import { type AdvisorConfig, type AdvisorRuntimeStatus } from "../advisor/index.js";
21
21
  import { AsyncJobManager } from "../async/index.js";
22
22
  import type { ModelRegistry } from "../config/model-registry.js";
23
23
  import { type ResolvedModelRoleValue } from "../config/model-resolver.js";
@@ -75,6 +75,8 @@ export declare class AgentSession {
75
75
  }>;
76
76
  readonly yieldQueue: YieldQueue;
77
77
  fileSnapshotStore?: InMemorySnapshotStore;
78
+ /** Per-session `CUT`/`PASTE` clipboard register shared across edit calls. */
79
+ editClipboard?: Clipboard;
78
80
  readonly configWarnings: string[];
79
81
  readonly rawSseDebugBuffer: RawSseDebugBuffer;
80
82
  /**
@@ -14,6 +14,14 @@ export interface AsyncResultEntry {
14
14
  result: string;
15
15
  job: AsyncJob | undefined;
16
16
  durationMs: number | undefined;
17
+ /**
18
+ * Owning session's async-delivery generation at enqueue time. A session
19
+ * transition (`/new`, switch, handoff) bumps the generation, so an entry
20
+ * whose generation no longer matches belongs to a replaced transcript and
21
+ * is dropped at flush — even after its job id has been reused, which clears
22
+ * the manager's per-id suppression marker.
23
+ */
24
+ epoch: number;
17
25
  }
18
26
  type AsyncResultJobDetails = {
19
27
  jobId: string;
@@ -0,0 +1,13 @@
1
+ import type { ForeignSessionInfo, ForeignSessionStore } from "./foreign-session-store.js";
2
+ import { SessionManager } from "./session-manager.js";
3
+ /** Imports Claude Code JSONL sessions into non-persistent OMP session managers. */
4
+ export declare class ClaudeSessionStore implements ForeignSessionStore {
5
+ #private;
6
+ readonly source = "claude";
7
+ /** Creates a store rooted at Claude's data directory, or at a fixture root when supplied. */
8
+ constructor(root?: string);
9
+ /** Lists indexed Claude sessions without reading transcript bodies. */
10
+ list(): Promise<ForeignSessionInfo[]>;
11
+ /** Loads and converts a Claude transcript while preserving its source tree and timestamps. */
12
+ load(info: ForeignSessionInfo): Promise<SessionManager>;
13
+ }
@@ -0,0 +1,14 @@
1
+ import type { ForeignSessionInfo, ForeignSessionStore } from "./foreign-session-store.js";
2
+ import { SessionManager } from "./session-manager.js";
3
+ /** Imports locally stored OpenAI Codex sessions into OMP's in-memory session format. */
4
+ export declare class CodexSessionStore implements ForeignSessionStore {
5
+ #private;
6
+ /** Foreign-session source discriminator. */
7
+ readonly source = "codex";
8
+ /** Uses the supplied Codex data root, or ~/.codex by default. */
9
+ constructor(rootDirectory?: string);
10
+ /** Lists Codex sessions from its state index without reading transcript bodies. */
11
+ list(): Promise<ForeignSessionInfo[]>;
12
+ /** Converts one Codex rollout into a non-persistent OMP session. */
13
+ load(info: ForeignSessionInfo): Promise<SessionManager>;
14
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Session-file persistence of the OAuth account that served a session.
3
+ *
4
+ * Provider prompt caches are account-scoped (Anthropic bills a full cache
5
+ * re-write after an account flip), and the auth store's session-sticky routing
6
+ * is process-local when a remote auth broker is configured — the broker
7
+ * store's KV cache is in-memory, so sticky rows die with the CLI process.
8
+ * Resuming a session in a fresh process then re-ranks accounts by usage
9
+ * headroom, which is biased *away* from the account that just served the
10
+ * session (it has the highest recent burn), cold-missing the entire prefix.
11
+ *
12
+ * These helpers close the loop through the session file itself: after each
13
+ * assistant turn the serving account is recorded as a `credential_pin` entry,
14
+ * and on session adoption the pin is matched against the stored accounts and
15
+ * seeded back into the auth store with the session's effective last-use
16
+ * timestamp, so the provider's warm-window semantics still decide whether to
17
+ * stick or re-rank.
18
+ */
19
+ import type { AuthStorage } from "./auth-storage.js";
20
+ import type { SessionManager } from "./session-manager.js";
21
+ /** Account fields shared by `OAuthAccountIdentity` and `OAuthAccountSummary`. */
22
+ interface CredentialPinIdentity {
23
+ accountId?: string;
24
+ email?: string;
25
+ projectId?: string;
26
+ orgId?: string;
27
+ }
28
+ /**
29
+ * Stable identifier for a provider account within its billing scope. The
30
+ * digest covers the full scope tuple — the same account in two orgs (Anthropic
31
+ * multi-subscription) or projects (Gemini) is two distinct cache domains and
32
+ * must produce two distinct pins. The digest input is the persisted contract
33
+ * for `CredentialPinEntry.hash` — changing it orphans every recorded pin.
34
+ *
35
+ * Hashing avoids embedding raw emails/uuids in session files, but an unsalted
36
+ * digest of a guessable email is still linkable — treat exported sessions
37
+ * accordingly.
38
+ *
39
+ * Returns `undefined` when the identity carries no account key at all.
40
+ */
41
+ export declare function credentialPinHash(provider: string, identity: CredentialPinIdentity): string | undefined;
42
+ /**
43
+ * Record the account that served the latest assistant turn for `provider`.
44
+ * Appends a `credential_pin` entry only when the account differs from the
45
+ * branch's latest pin, so steady-state sessions add a single entry; the
46
+ * effective last-use time is derived from later assistant turns on read
47
+ * (see `SessionManager.getCredentialPins`).
48
+ */
49
+ export declare function recordCredentialPin(authStorage: AuthStorage, sessionManager: SessionManager, sessionId: string, provider: string): void;
50
+ /**
51
+ * Re-pin the accounts recorded in the session file onto the auth store's
52
+ * session stickiness. No-op per provider when the account is gone (logged out)
53
+ * or when a live sticky already exists (same-process branch/session switches
54
+ * must not clobber fresher routing). Seeds with the session's effective
55
+ * last-use time so stale resumes still fall through to usage ranking.
56
+ */
57
+ export declare function seedCredentialPins(authStorage: AuthStorage, sessionManager: SessionManager, sessionId: string): void;
58
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { ForeignSessionInfo, ForeignSessionSource, ForeignSessionStore } from "./foreign-session-store.js";
2
+ import type { SessionInfo } from "./session-listing.js";
3
+ import type { SessionManager } from "./session-manager.js";
4
+ /** Construct the importer for a supported foreign session source. */
5
+ export declare function createForeignSessionStore(source: ForeignSessionSource): ForeignSessionStore;
6
+ /** Display name for a supported foreign session source. */
7
+ export declare function foreignSessionSourceName(source: ForeignSessionSource): string;
8
+ /** Convert lightweight foreign metadata for the existing session picker. */
9
+ export declare function foreignSessionInfoToSessionInfo(info: ForeignSessionInfo): SessionInfo;
10
+ /** Import and persist one foreign session under a fresh OMP session identity. */
11
+ export declare function persistForeignSession(store: ForeignSessionStore, info: ForeignSessionInfo, options?: {
12
+ fallbackCwd?: string;
13
+ sessionDir?: string;
14
+ suppressBreadcrumb?: boolean;
15
+ }): Promise<SessionManager>;
@@ -0,0 +1,9 @@
1
+ /** One readable object record from a foreign JSONL transcript. */
2
+ export interface ForeignJsonRecord {
3
+ readonly value: Record<string, unknown>;
4
+ readonly line: number;
5
+ }
6
+ /** Stream valid object records while tolerating malformed or truncated lines. */
7
+ export declare function readForeignJsonRecords(filePath: string): AsyncGenerator<ForeignJsonRecord>;
8
+ /** Read every valid object record from a foreign JSONL transcript. */
9
+ export declare function collectForeignJsonRecords(filePath: string): Promise<ForeignJsonRecord[]>;