@oh-my-pi/pi-coding-agent 17.2.8 → 17.2.10

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 +94 -1
  2. package/dist/{CHANGELOG-0b0w17se.md → CHANGELOG-rhwzpexa.md} +94 -1
  3. package/dist/cli.js +13216 -15614
  4. package/dist/types/async/job-manager.d.ts +12 -0
  5. package/dist/types/cli/args.d.ts +1 -0
  6. package/dist/types/config/model-resolver.d.ts +13 -0
  7. package/dist/types/discovery/agents.d.ts +11 -0
  8. package/dist/types/extensibility/custom-commands/types.d.ts +5 -5
  9. package/dist/types/extensibility/custom-tools/types.d.ts +1 -1
  10. package/dist/types/extensibility/extensions/loader.d.ts +2 -2
  11. package/dist/types/extensibility/extensions/types.d.ts +34 -8
  12. package/dist/types/extensibility/hooks/types.d.ts +5 -5
  13. package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +10 -0
  14. package/dist/types/hindsight/state.d.ts +0 -1
  15. package/dist/types/index.d.ts +2 -2
  16. package/dist/types/lsp/utils.d.ts +8 -0
  17. package/dist/types/main.d.ts +1 -1
  18. package/dist/types/modes/acp/acp-agent.d.ts +1 -1
  19. package/dist/types/modes/acp/acp-client-bridge.d.ts +1 -1
  20. package/dist/types/modes/acp/acp-event-mapper.d.ts +1 -1
  21. package/dist/types/modes/acp/acp-mode.d.ts +1 -1
  22. package/dist/types/modes/components/agent-hub-projection.d.ts +38 -0
  23. package/dist/types/modes/components/agent-hub-renderer.d.ts +41 -0
  24. package/dist/types/modes/components/agent-hub.d.ts +12 -5
  25. package/dist/types/modes/components/model-browser.d.ts +9 -1
  26. package/dist/types/modes/interactive-mode.d.ts +8 -1
  27. package/dist/types/modes/session-observer-registry.d.ts +2 -0
  28. package/dist/types/registry/agent-lifecycle.d.ts +1 -1
  29. package/dist/types/registry/agent-registry.d.ts +47 -0
  30. package/dist/types/registry/persisted-agents.d.ts +3 -1
  31. package/dist/types/session/agent-session-types.d.ts +7 -0
  32. package/dist/types/session/agent-session.d.ts +8 -4
  33. package/dist/types/session/session-entries.d.ts +10 -0
  34. package/dist/types/session/session-loader.d.ts +11 -1
  35. package/dist/types/session/session-manager.d.ts +9 -1
  36. package/dist/types/session/session-tools.d.ts +10 -1
  37. package/dist/types/session/turn-recovery.d.ts +6 -2
  38. package/dist/types/slash-commands/acp-builtins.d.ts +1 -1
  39. package/dist/types/slash-commands/available-commands.d.ts +1 -1
  40. package/dist/types/task/executor.d.ts +10 -0
  41. package/dist/types/task/index.d.ts +2 -3
  42. package/dist/types/task/read-only-policy.d.ts +3 -0
  43. package/dist/types/task/structured-subagent.d.ts +2 -0
  44. package/dist/types/task/types.d.ts +4 -0
  45. package/dist/types/tools/bash.d.ts +3 -3
  46. package/dist/types/tools/browser/launch.d.ts +3 -0
  47. package/dist/types/tools/browser/tab-worker.d.ts +2 -2
  48. package/dist/types/tools/path-utils.d.ts +8 -0
  49. package/dist/types/tools/read.d.ts +3 -5
  50. package/dist/types/tools/run-scope.d.ts +27 -1
  51. package/dist/types/tools/shell-tokenize.d.ts +21 -3
  52. package/dist/types/tools/terminal-output.d.ts +1 -1
  53. package/dist/types/utils/changelog.d.ts +3 -2
  54. package/dist/types/utils/late-cleanup.d.ts +2 -0
  55. package/dist/types/utils/turndown.d.ts +1 -1
  56. package/dist/types/vibe/runtime.d.ts +4 -3
  57. package/dist/types/web/scrapers/readthedocs.d.ts +0 -3
  58. package/dist/types/web/search/providers/browser-headers.d.ts +2 -3
  59. package/examples/custom-tools/README.md +1 -1
  60. package/examples/extensions/README.md +1 -1
  61. package/examples/extensions/api-demo.ts +5 -6
  62. package/examples/extensions/chalk-logger.ts +1 -1
  63. package/examples/extensions/hello.ts +2 -2
  64. package/examples/extensions/reload-runtime.ts +1 -1
  65. package/examples/extensions/tools.ts +2 -2
  66. package/examples/extensions/with-deps/index.ts +1 -1
  67. package/examples/sdk/06-extensions.ts +1 -1
  68. package/package.json +15 -31
  69. package/scripts/bundle-dist.ts +1 -11
  70. package/scripts/omp +11 -2
  71. package/src/advisor/runtime.ts +54 -0
  72. package/src/async/job-manager.ts +26 -0
  73. package/src/cli/agents-cli.ts +1 -1
  74. package/src/cli/args.ts +24 -2
  75. package/src/cli/auth-broker-cli.ts +1 -1
  76. package/src/cli/auth-gateway-cli.ts +1 -1
  77. package/src/cli/bench-cli.ts +1 -1
  78. package/src/cli/claude-trace-cli.ts +1 -1
  79. package/src/cli/config-cli.ts +1 -1
  80. package/src/cli/dry-balance-cli.ts +1 -1
  81. package/src/cli/file-processor.ts +1 -1
  82. package/src/cli/flag-tables.ts +4 -0
  83. package/src/cli/grep-cli.ts +1 -1
  84. package/src/cli/grievances-cli.ts +1 -1
  85. package/src/cli/help-extra.ts +1 -1
  86. package/src/cli/models-cli.ts +1 -1
  87. package/src/cli/plugin-cli.ts +1 -1
  88. package/src/cli/read-cli.ts +1 -1
  89. package/src/cli/setup-cli.ts +1 -1
  90. package/src/cli/shell-cli.ts +1 -1
  91. package/src/cli/ssh-cli.ts +1 -1
  92. package/src/cli/stats-cli.ts +4 -4
  93. package/src/cli/tiny-models-cli.ts +1 -1
  94. package/src/cli/ttsr-cli.ts +1 -1
  95. package/src/cli/update-cli.ts +3 -57
  96. package/src/cli/usage-cli.ts +1 -1
  97. package/src/cli/web-search-cli.ts +1 -1
  98. package/src/cli/worktree-cli.ts +1 -1
  99. package/src/commands/say.ts +1 -1
  100. package/src/commands/token.ts +1 -1
  101. package/src/commit/agentic/agent.ts +1 -1
  102. package/src/commit/cli.ts +1 -1
  103. package/src/config/config-file.ts +2 -2
  104. package/src/config/keybindings.ts +3 -3
  105. package/src/config/model-discovery.ts +36 -2
  106. package/src/config/model-registry.ts +4 -1
  107. package/src/config/model-resolver.ts +54 -7
  108. package/src/discovery/agents.ts +73 -3
  109. package/src/discovery/builtin-rules/ts-no-inline-cast-access.md +5 -4
  110. package/src/discovery/builtin-rules/ts-no-tiny-functions.md +1 -1
  111. package/src/discovery/claude.ts +8 -5
  112. package/src/discovery/cursor.ts +8 -5
  113. package/src/discovery/gemini.ts +11 -8
  114. package/src/discovery/vscode.ts +1 -0
  115. package/src/discovery/windsurf.ts +4 -2
  116. package/src/edit/hashline/filesystem.ts +7 -7
  117. package/src/eval/agent-bridge.ts +1 -3
  118. package/src/eval/jl/prelude.jl +4 -4
  119. package/src/eval/js/shared/prelude.txt +2 -2
  120. package/src/eval/py/prelude.py +0 -3
  121. package/src/eval/py/runner.py +38 -1
  122. package/src/eval/rb/prelude.rb +1 -2
  123. package/src/extensibility/custom-commands/loader.ts +4 -4
  124. package/src/extensibility/custom-commands/types.ts +5 -5
  125. package/src/extensibility/custom-tools/loader.ts +4 -4
  126. package/src/extensibility/custom-tools/types.ts +1 -1
  127. package/src/extensibility/extensions/loader.ts +7 -6
  128. package/src/extensibility/extensions/types.ts +39 -8
  129. package/src/extensibility/hooks/loader.ts +4 -5
  130. package/src/extensibility/hooks/types.ts +5 -5
  131. package/src/extensibility/legacy-pi-coding-agent-shim.ts +23 -0
  132. package/src/extensibility/plugins/legacy-pi-compat.ts +53 -0
  133. package/src/hindsight/state.ts +2 -22
  134. package/src/index.ts +2 -2
  135. package/src/internal-urls/memory-protocol.ts +33 -0
  136. package/src/launch/terminal-output.ts +1 -1
  137. package/src/lsp/client.ts +2 -2
  138. package/src/lsp/utils.ts +29 -0
  139. package/src/main.ts +85 -21
  140. package/src/markit/converters/docx.ts +1 -1
  141. package/src/markit/converters/epub.ts +1 -1
  142. package/src/markit/converters/pptx.ts +1 -1
  143. package/src/markit/converters/xlsx.ts +1 -1
  144. package/src/modes/acp/acp-agent.ts +7 -6
  145. package/src/modes/acp/acp-client-bridge.ts +1 -1
  146. package/src/modes/acp/acp-event-mapper.ts +1 -1
  147. package/src/modes/acp/acp-mode.ts +1 -1
  148. package/src/modes/components/agent-hub-projection.ts +248 -0
  149. package/src/modes/components/agent-hub-renderer.ts +194 -0
  150. package/src/modes/components/agent-hub.ts +670 -192
  151. package/src/modes/components/agent-transcript-viewer.ts +1 -3
  152. package/src/modes/components/assistant-message.ts +1 -1
  153. package/src/modes/components/bordered-loader.ts +1 -1
  154. package/src/modes/components/custom-editor.ts +2 -2
  155. package/src/modes/components/extensions/inspector-panel.ts +11 -6
  156. package/src/modes/components/footer.ts +1 -3
  157. package/src/modes/components/hook-input.ts +1 -1
  158. package/src/modes/components/hook-selector.ts +2 -2
  159. package/src/modes/components/model-browser.ts +11 -3
  160. package/src/modes/components/model-hub.ts +4 -1
  161. package/src/modes/components/session-selector.ts +2 -2
  162. package/src/modes/components/status-line/segments.ts +4 -3
  163. package/src/modes/controllers/event-controller.ts +188 -7
  164. package/src/modes/controllers/extension-ui-controller.ts +4 -3
  165. package/src/modes/controllers/mcp-command-controller.ts +81 -20
  166. package/src/modes/controllers/selector-controller.ts +40 -49
  167. package/src/modes/controllers/streaming-reveal.ts +1 -1
  168. package/src/modes/interactive-mode.ts +13 -2
  169. package/src/modes/print-mode.ts +29 -12
  170. package/src/modes/rpc/rpc-mode.ts +2 -2
  171. package/src/modes/runtime-init.ts +1 -1
  172. package/src/modes/session-observer-registry.ts +5 -0
  173. package/src/modes/theme/theme.ts +2 -2
  174. package/src/prompts/tools/computer.md +1 -1
  175. package/src/registry/agent-lifecycle.ts +35 -10
  176. package/src/registry/agent-registry.ts +65 -2
  177. package/src/registry/persisted-agents.ts +341 -16
  178. package/src/sdk.ts +11 -5
  179. package/src/session/agent-session-types.ts +8 -0
  180. package/src/session/agent-session.ts +177 -188
  181. package/src/session/session-entries.ts +10 -0
  182. package/src/session/session-listing.ts +1 -1
  183. package/src/session/session-loader.ts +74 -8
  184. package/src/session/session-manager.ts +22 -2
  185. package/src/session/session-paths.ts +105 -110
  186. package/src/session/session-tools.ts +28 -1
  187. package/src/session/settings-stream-fn.ts +7 -3
  188. package/src/session/turn-recovery.ts +236 -18
  189. package/src/session/unexpected-stop-classifier.ts +12 -3
  190. package/src/slash-commands/acp-builtins.ts +1 -1
  191. package/src/slash-commands/available-commands.ts +1 -1
  192. package/src/slash-commands/helpers/stats-dashboard.ts +2 -1
  193. package/src/task/agents.ts +1 -1
  194. package/src/task/executor.ts +173 -47
  195. package/src/task/index.ts +9 -28
  196. package/src/task/isolation-runner.ts +43 -12
  197. package/src/task/persisted-revive.ts +12 -5
  198. package/src/task/read-only-policy.ts +27 -0
  199. package/src/task/structured-subagent.ts +31 -6
  200. package/src/task/types.ts +4 -0
  201. package/src/tiny/worker.ts +1 -1
  202. package/src/tools/auto-generated-guard.ts +1 -1
  203. package/src/tools/bash-interactive.ts +4 -4
  204. package/src/tools/bash-interceptor.ts +8 -4
  205. package/src/tools/bash.ts +6 -6
  206. package/src/tools/browser/cmux/cmux-tab.ts +66 -18
  207. package/src/tools/browser/launch.ts +76 -19
  208. package/src/tools/browser/readable.ts +9 -9
  209. package/src/tools/browser/tab-supervisor.ts +12 -3
  210. package/src/tools/browser/tab-worker-entry.ts +1 -1
  211. package/src/tools/browser/tab-worker.ts +101 -12
  212. package/src/tools/fetch.ts +1 -1
  213. package/src/tools/glob.ts +4 -2
  214. package/src/tools/path-utils.ts +22 -5
  215. package/src/tools/read.ts +22 -5
  216. package/src/tools/run-scope.ts +290 -4
  217. package/src/tools/shell-tokenize.ts +38 -9
  218. package/src/tools/terminal-output.ts +1 -1
  219. package/src/tools/todo.ts +1 -1
  220. package/src/utils/changelog.ts +5 -4
  221. package/src/utils/clipboard.ts +10 -2
  222. package/src/utils/external-editor.ts +4 -2
  223. package/src/utils/jj.ts +1 -1
  224. package/src/utils/late-cleanup.ts +17 -0
  225. package/src/utils/turndown.ts +1 -2
  226. package/src/vibe/runtime.ts +202 -58
  227. package/src/web/scrapers/arxiv.ts +1 -1
  228. package/src/web/scrapers/go-pkg.ts +1 -1
  229. package/src/web/scrapers/hackage.ts +1 -12
  230. package/src/web/scrapers/iacr.ts +1 -1
  231. package/src/web/scrapers/readthedocs.ts +2 -1
  232. package/src/web/scrapers/twitter.ts +2 -2
  233. package/src/web/scrapers/types.ts +1 -1
  234. package/src/web/scrapers/wikipedia.ts +1 -1
  235. package/src/web/search/providers/browser-headers.ts +12 -39
  236. package/src/web/search/providers/codex.ts +3 -26
  237. package/src/web/search/providers/duckduckgo.ts +1 -1
  238. package/src/web/search/providers/ecosia.ts +2 -2
  239. package/src/web/search/providers/exa.ts +1 -1
  240. package/src/web/search/providers/firecrawl.ts +1 -1
  241. package/src/web/search/providers/google.ts +1 -1
  242. package/src/web/search/providers/mojeek.ts +2 -2
  243. package/src/web/search/providers/perplexity.ts +1 -1
  244. package/src/web/search/providers/public.ts +1 -1
  245. package/src/web/search/providers/startpage.ts +2 -2
  246. package/src/markit/converters/mammoth.d.ts +0 -24
@@ -51,6 +51,11 @@ export interface AsyncJobDeliveryState {
51
51
  nextRetryAt?: number;
52
52
  pendingJobIds: string[];
53
53
  }
54
+ export interface AsyncJobReapResult {
55
+ settled: boolean;
56
+ pendingJobIds: string[];
57
+ completion: Promise<void>;
58
+ }
54
59
  export interface AsyncJobRegisterOptions {
55
60
  id?: string;
56
61
  /** Registry id of the agent that owns this job; used to scope cancelAll. */
@@ -167,6 +172,13 @@ export declare class AsyncJobManager {
167
172
  timeoutMs?: number;
168
173
  excludeSuppressed?: boolean;
169
174
  }): Promise<boolean>;
175
+ /**
176
+ * Cancel every job owned by `ownerId`, then wait only until `deadlineAt`.
177
+ * The returned completion keeps waiting for actual process settlement when
178
+ * the deadline expires, so callers can move that cleanup out of the
179
+ * user-visible Task wait without losing ownership of the live work.
180
+ */
181
+ cancelAndReapOwnerJobs(ownerId: string, deadlineAt: number): Promise<AsyncJobReapResult>;
170
182
  drainDeliveries(options?: {
171
183
  timeoutMs?: number;
172
184
  filter?: AsyncJobFilter;
@@ -50,6 +50,7 @@ export interface Args {
50
50
  noPty?: boolean;
51
51
  hooks?: string[];
52
52
  extensions?: string[];
53
+ trustedExtensions?: string[];
53
54
  noExtensions?: boolean;
54
55
  pluginDirs?: string[];
55
56
  print?: boolean;
@@ -97,18 +97,31 @@ export declare function parseModelPattern(pattern: string, availableModels: Mode
97
97
  export interface ModelRoleLookup {
98
98
  getModelRole(role: ModelRole | string): string | undefined;
99
99
  }
100
+ /**
101
+ * Extract the first explicit model-role alias from a raw model selection.
102
+ *
103
+ * This intentionally runs before role expansion so callers can retain the
104
+ * source identity (`@smol`, `pi/slow`, or `*`) even when it resolves to a
105
+ * concrete provider/model or inherited fallback. Bare role names and explicit
106
+ * provider/model selectors are not role aliases.
107
+ */
108
+ export declare function resolveExplicitModelRole(value: string | string[] | undefined, settings?: ModelRoleLookup): string | undefined;
100
109
  /**
101
110
  * Expand a role alias like "@smol" to the configured model string.
102
111
  */
103
112
  export declare function expandRoleAlias(value: string, settings?: ModelRoleLookup): string;
104
113
  export declare function resolveConfiguredModelPatterns(value: string | string[] | undefined, settings?: ModelRoleLookup): string[];
105
114
  export interface AgentModelPatternResolutionOptions {
115
+ /** Highest-priority request selector, when supplied by a caller. */
116
+ requestModel?: string | string[];
106
117
  settingsOverride?: string | string[];
107
118
  agentModel?: string | string[];
108
119
  settings?: Settings;
109
120
  activeModelPattern?: string;
110
121
  fallbackModelPattern?: string;
111
122
  }
123
+ /** Return the raw selector source that supplies the effective agent patterns. */
124
+ export declare function resolveAgentModelSource(options: AgentModelPatternResolutionOptions): string | string[] | undefined;
112
125
  export declare function resolveAgentModelPatterns(options: AgentModelPatternResolutionOptions): string[];
113
126
  /** Default prewalk hand-off target when no explicit target is configured. */
114
127
  export declare const DEFAULT_PREWALK_TARGET = "@smol";
@@ -1,4 +1,14 @@
1
1
  import type { LoadContext } from "../capability/types.js";
2
+ interface UserPathCandidateOptions {
3
+ platform?: NodeJS.Platform;
4
+ env?: NodeJS.ProcessEnv;
5
+ windowsUserProfile?: () => string | undefined;
6
+ wslPath?: (windowsPath: string) => string | undefined;
7
+ }
8
+ /** Resolve the Windows host profile home exposed to WSL, if available. */
9
+ export declare function getWslWindowsHomeCandidate(options?: UserPathCandidateOptions): string | undefined;
10
+ /** User-level paths: ~/.agent[s]/<segments>, plus the Windows host profile under WSL. */
11
+ export declare function getUserPathCandidates(ctx: LoadContext, ...segments: string[]): string[];
2
12
  /**
3
13
  * Project-level paths: walk up from cwd to repoRoot, returning `.agent/<segments>`
4
14
  * and `.agents/<segments>` at each ancestor.
@@ -10,3 +20,4 @@ import type { LoadContext } from "../capability/types.js";
10
20
  * directory — see https://github.com/can1357/oh-my-pi/issues/1116.
11
21
  */
12
22
  export declare function getProjectPathCandidates(ctx: LoadContext, ...segments: string[]): string[];
23
+ export {};
@@ -5,7 +5,7 @@
5
5
  * Unlike markdown commands which expand to prompts, custom commands can execute
6
6
  * arbitrary logic with full access to the hook context.
7
7
  */
8
- import type * as arktype from "@oh-my-pi/omptype";
8
+ import type { type as ArkType } from "@oh-my-pi/omptype";
9
9
  import type * as TypeBox from "@oh-my-pi/omptype/typebox";
10
10
  import type * as zod from "@oh-my-pi/omptype/zod";
11
11
  import type { ExecOptions, ExecResult, HookCommandContext } from "../../extensibility/hooks/types.js";
@@ -20,11 +20,11 @@ export interface CustomCommandAPI {
20
20
  cwd: string;
21
21
  /** Execute a shell command */
22
22
  exec(command: string, args: string[], options?: ExecOptions): Promise<ExecResult>;
23
- /** Injected zod-backed typebox shim (legacy/compat). */
23
+ /** Injected TypeBox shim (legacy/compat). */
24
24
  typebox: typeof TypeBox;
25
- /** Injected arktype module for validation in custom commands. */
26
- arktype: typeof arktype;
27
- /** Injected omptype-backed zod facade for command validation. */
25
+ /** Injected omptype schema builder for custom commands. */
26
+ arktype: typeof ArkType;
27
+ /** Injected Zod-compatible omptype builder for custom commands. */
28
28
  zod: typeof zod;
29
29
  /** Injected pi-coding-agent exports */
30
30
  pi: typeof PiCodingAgent;
@@ -57,7 +57,7 @@ export interface CustomToolAPI {
57
57
  typebox: typeof TypeBox;
58
58
  /** Injected arktype module for arktype-authored custom tools. */
59
59
  arktype: typeof ArkType;
60
- /** Injected omptype-backed zod facade for parameter schemas. */
60
+ /** Injected Zod-compatible omptype builder for custom tools. */
61
61
  zod: typeof zod;
62
62
  /** Injected pi-coding-agent exports */
63
63
  pi: typeof PiCodingAgent;
@@ -1,7 +1,7 @@
1
1
  import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
2
2
  import type { ServiceTierByFamily } from "@oh-my-pi/pi-ai";
3
3
  import { EventBus } from "../../utils/event-bus.js";
4
- import type { Extension, ExtensionFactory, ExtensionRuntime as IExtensionRuntime, LoadExtensionsResult, ProviderConfig } from "./types.js";
4
+ import type { Extension, ExtensionFactory, ExtensionRuntime as IExtensionRuntime, LoadExtensionsResult, ProviderConfig, ToolInfo } from "./types.js";
5
5
  export declare class ExtensionRuntimeNotInitializedError extends Error {
6
6
  constructor();
7
7
  }
@@ -21,7 +21,7 @@ export declare class ExtensionRuntime implements IExtensionRuntime {
21
21
  appendEntry(): void;
22
22
  setLabel(): void;
23
23
  getActiveTools(): string[];
24
- getAllTools(): string[];
24
+ getAllTools(): ToolInfo[];
25
25
  setActiveTools(): Promise<void>;
26
26
  getCommands(): never;
27
27
  setModel(): Promise<boolean>;
@@ -7,7 +7,7 @@
7
7
  * - Register commands, keyboard shortcuts, and CLI flags
8
8
  * - Interact with the user via UI primitives
9
9
  */
10
- import type { Type as arktype } from "@oh-my-pi/omptype";
10
+ import type { type as ArkType } from "@oh-my-pi/omptype";
11
11
  import type * as TypeBox from "@oh-my-pi/omptype/typebox";
12
12
  import type * as zod from "@oh-my-pi/omptype/zod";
13
13
  import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, ThinkingLevel, ToolApproval, ToolLoadMode } from "@oh-my-pi/pi-agent-core";
@@ -432,6 +432,32 @@ export interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = un
432
432
  /** Custom rendering for tool result display */
433
433
  renderResult?: (result: AgentToolResult<TDetails>, options: ToolRenderResultOptions, theme: Theme, args?: Static<TParams>) => Component;
434
434
  }
435
+ /** Whether a tool's source is scoped to the user, the project, or a transient runtime session. */
436
+ export type SourceScope = "user" | "project" | "temporary";
437
+ /** Whether a tool's source came from an installed package or a top-level (loose) file. */
438
+ export type SourceOrigin = "package" | "top-level";
439
+ /**
440
+ * Provenance metadata describing where a registered tool came from. Mirrors the
441
+ * `@earendil-works/pi-coding-agent` `SourceInfo` contract so extensions authored
442
+ * against upstream pi (e.g. gentle-pi) can read `sourceInfo.source` unchanged.
443
+ */
444
+ export interface SourceInfo {
445
+ /** Synthetic or on-disk identifier for the tool's origin (e.g. `<builtin:read>`). */
446
+ path: string;
447
+ /** Origin class: `"builtin"`, `"sdk"`, `"mcp"`, or `"extension"`. */
448
+ source: string;
449
+ scope: SourceScope;
450
+ origin: SourceOrigin;
451
+ baseDir?: string;
452
+ }
453
+ /** Tool metadata returned by {@link ExtensionAPI.getAllTools}: identity, schema, and source provenance. */
454
+ export interface ToolInfo {
455
+ name: string;
456
+ description: string;
457
+ parameters: TSchema;
458
+ promptGuidelines?: string[];
459
+ sourceInfo: SourceInfo;
460
+ }
435
461
  /** Fired after session_start to allow extensions to provide additional resource paths. */
436
462
  export interface ResourcesDiscoverEvent {
437
463
  type: "resources_discover";
@@ -736,11 +762,11 @@ export type ExtensionServiceTier<Family extends ServiceTierFamily> = Family exte
736
762
  export interface ExtensionAPI {
737
763
  /** File logger for error/warning/debug messages */
738
764
  logger: typeof PiLogger;
739
- /** Injected zod-backed typebox shim for legacy `Type.Object(...)` parameter authoring. */
765
+ /** Injected TypeBox shim for legacy `Type.Object(...)` parameter authoring. */
740
766
  typebox: typeof TypeBox;
741
- /** Injected arktype module for arktype-authored extension tools (canonical going forward). */
742
- arktype: typeof arktype;
743
- /** Injected omptype-backed zod facade for extension tool parameter schemas. */
767
+ /** Injected omptype schema builder for extension tools. */
768
+ arktype: typeof ArkType;
769
+ /** Injected Zod-compatible omptype builder for extension tools. */
744
770
  zod: typeof zod;
745
771
  /** Injected pi-coding-agent exports for accessing SDK utilities */
746
772
  pi: typeof PiCodingAgent;
@@ -835,8 +861,8 @@ export interface ExtensionAPI {
835
861
  exec(command: string, args: string[], options?: ExecOptions): Promise<ExecResult>;
836
862
  /** Get the list of currently active tool names. */
837
863
  getActiveTools(): string[];
838
- /** Get all configured tools (built-in + extension tools). */
839
- getAllTools(): string[];
864
+ /** Get all configured tools (built-in + extension tools) with schema and source metadata. */
865
+ getAllTools(): ToolInfo[];
840
866
  /** Set the active tools by name. */
841
867
  setActiveTools(toolNames: string[]): Promise<void>;
842
868
  /** Get available slash commands in the current session. */
@@ -999,7 +1025,7 @@ export type SendUserMessageHandler = (content: string | (TextContent | ImageCont
999
1025
  }) => void;
1000
1026
  export type AppendEntryHandler = <T = unknown>(customType: string, data?: T) => void;
1001
1027
  export type GetActiveToolsHandler = () => string[];
1002
- export type GetAllToolsHandler = () => string[];
1028
+ export type GetAllToolsHandler = () => ToolInfo[];
1003
1029
  export type GetCommandsHandler = () => SlashCommandInfo[];
1004
1030
  export type SetActiveToolsHandler = (toolNames: string[]) => Promise<void>;
1005
1031
  export type SetModelHandler = (model: Model) => Promise<boolean>;
@@ -1,4 +1,4 @@
1
- import type { Type } from "@oh-my-pi/omptype";
1
+ import type { type as ArkType } from "@oh-my-pi/omptype";
2
2
  import type * as TypeBox from "@oh-my-pi/omptype/typebox";
3
3
  import type * as zod from "@oh-my-pi/omptype/zod";
4
4
  import type { ImageContent, Message, Model, TextContent } from "@oh-my-pi/pi-ai";
@@ -418,11 +418,11 @@ export interface HookAPI {
418
418
  exec(command: string, args: string[], options?: ExecOptions): Promise<ExecResult>;
419
419
  /** File logger for error/warning/debug messages */
420
420
  logger: typeof PiLogger;
421
- /** Injected zod-backed typebox shim (legacy/compat — prefer `arktype`). */
421
+ /** Injected TypeBox shim (legacy/compat — prefer `arktype`). */
422
422
  typebox: typeof TypeBox;
423
- /** Injected arktype module for arktype-authored hooks. */
424
- arktype: typeof Type;
425
- /** Injected omptype-backed zod facade for hook validation. */
423
+ /** Injected omptype schema builder for hooks. */
424
+ arktype: typeof ArkType;
425
+ /** Injected Zod-compatible omptype builder for hooks. */
426
426
  zod: typeof zod;
427
427
  /** Injected pi-coding-agent exports */
428
428
  pi: typeof PiCodingAgent;
@@ -92,6 +92,16 @@ export interface WriteOperations {
92
92
  export interface WriteToolOptions {
93
93
  operations?: WriteOperations;
94
94
  }
95
+ /**
96
+ * Convert an image attachment to PNG using the legacy package-root contract.
97
+ *
98
+ * Invalid or unsupported image data returns `null`, matching Pi's historical
99
+ * helper instead of surfacing Bun's decoder error to extensions.
100
+ */
101
+ export declare function convertToPng(base64Data: string, mimeType: string): Promise<{
102
+ data: string;
103
+ mimeType: string;
104
+ } | null>;
95
105
  /** Format the active shortcut for legacy extensions that render keybinding hints. */
96
106
  export declare function keyText(action: Keybinding): string;
97
107
  /** Parse frontmatter using the historical Pi package-root helper. */
@@ -93,7 +93,6 @@ export declare class HindsightSessionState {
93
93
  retainSession(messages: HindsightMessage[]): Promise<void>;
94
94
  maybeRetainOnAgentEnd(): Promise<void>;
95
95
  forceRetainCurrentSession(): Promise<void>;
96
- maybeRecallOnAgentStart(): Promise<void>;
97
96
  beforeAgentStartPrompt(promptText: string): Promise<string | undefined>;
98
97
  recallForCompaction(messages: HindsightMessage[]): Promise<string | undefined>;
99
98
  runMentalModelLoad(scope: BankScope): Promise<void>;
@@ -1,8 +1,8 @@
1
1
  import { HookEditorComponent, HookInputComponent, HookSelectorComponent } from "./modes/components/index.js";
2
+ export * as zod from "@oh-my-pi/omptype/zod";
3
+ export { z } from "@oh-my-pi/omptype/zod";
2
4
  export { Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui";
3
5
  export { getAgentDir, logger, VERSION } from "@oh-my-pi/pi-utils";
4
- export * as zod from "zod/v4";
5
- export { z } from "zod/v4";
6
6
  export * from "./config/keybindings.js";
7
7
  export * from "./config/model-registry.js";
8
8
  export type * from "./config/prompt-templates.js";
@@ -14,6 +14,14 @@ export declare function fileToUri(filePath: string): string;
14
14
  * Handles Windows drive letters correctly.
15
15
  */
16
16
  export declare function uriToFile(uri: string): string;
17
+ /** Map that treats equivalent file URI spellings as the same key. */
18
+ export declare class EquivalentUriMap<Value> extends Map<string, Value> {
19
+ #private;
20
+ delete(uri: string): boolean;
21
+ get(uri: string): Value | undefined;
22
+ has(uri: string): boolean;
23
+ set(uri: string, value: Value): this;
24
+ }
17
25
  /**
18
26
  * Convert diagnostic severity number to string name.
19
27
  */
@@ -28,7 +28,7 @@ export interface AcpSessionFactoryOptions {
28
28
  sessionDir?: string;
29
29
  authStorage: AuthStorage;
30
30
  modelRegistry: ModelRegistry;
31
- parsedArgs: Pick<Args, "apiKey">;
31
+ parsedArgs: Pick<Args, "apiKey" | "trustedExtensions">;
32
32
  rawArgs: string[];
33
33
  createSession: (options: CreateAgentSessionOptions) => Promise<CreateAgentSessionResult>;
34
34
  }
@@ -1,5 +1,5 @@
1
- import { type Agent, type AgentSideConnection, type AuthenticateRequest, type AuthenticateResponse, type ClientCapabilities, type CloseSessionRequest, type CloseSessionResponse, type ForkSessionRequest, type ForkSessionResponse, type InitializeRequest, type InitializeResponse, type ListSessionsRequest, type ListSessionsResponse, type LoadSessionRequest, type LoadSessionResponse, type NewSessionRequest, type NewSessionResponse, type PromptRequest, type PromptResponse, type ResumeSessionRequest, type ResumeSessionResponse, type SetSessionConfigOptionRequest, type SetSessionConfigOptionResponse, type SetSessionModeRequest, type SetSessionModeResponse } from "@agentclientprotocol/sdk";
2
1
  import { type postmortem } from "@oh-my-pi/pi-utils";
2
+ import { type Agent, type AgentSideConnection, type AuthenticateRequest, type AuthenticateResponse, type ClientCapabilities, type CloseSessionRequest, type CloseSessionResponse, type ForkSessionRequest, type ForkSessionResponse, type InitializeRequest, type InitializeResponse, type ListSessionsRequest, type ListSessionsResponse, type LoadSessionRequest, type LoadSessionResponse, type NewSessionRequest, type NewSessionResponse, type PromptRequest, type PromptResponse, type ResumeSessionRequest, type ResumeSessionResponse, type SetSessionConfigOptionRequest, type SetSessionConfigOptionResponse, type SetSessionModeRequest, type SetSessionModeResponse } from "@oh-my-pi/pi-utils/acp";
3
3
  import { type ExtensionUIContext } from "../../extensibility/extensions/index.js";
4
4
  import type { AgentSession } from "../../session/agent-session.js";
5
5
  /**
@@ -4,6 +4,6 @@
4
4
  * `AgentSession`) can route through the client when it advertises the
5
5
  * relevant capabilities at `initialize` time.
6
6
  */
7
- import type { AgentSideConnection, ClientCapabilities } from "@agentclientprotocol/sdk";
7
+ import type { AgentSideConnection, ClientCapabilities } from "@oh-my-pi/pi-utils/acp";
8
8
  import type { ClientBridge } from "../../session/client-bridge.js";
9
9
  export declare function createAcpClientBridge(connection: AgentSideConnection, sessionId: string, clientCapabilities: ClientCapabilities | undefined): ClientBridge;
@@ -1,4 +1,4 @@
1
- import type { SessionNotification, SessionUpdate, ToolKind } from "@agentclientprotocol/sdk";
1
+ import type { SessionNotification, SessionUpdate, ToolKind } from "@oh-my-pi/pi-utils/acp";
2
2
  import type { AgentSessionEvent } from "../../session/agent-session.js";
3
3
  interface MessageProgress {
4
4
  textEmitted: boolean;
@@ -1,4 +1,4 @@
1
- import { AgentSideConnection, type Stream } from "@agentclientprotocol/sdk";
1
+ import { AgentSideConnection, type Stream } from "@oh-my-pi/pi-utils/acp";
2
2
  import type { AgentSession } from "../../session/agent-session.js";
3
3
  import { AcpAgent } from "./acp-agent.js";
4
4
  /** Creates sessions requested by an ACP client. */
@@ -0,0 +1,38 @@
1
+ import type { AgentMetricsSummary, AgentRef, AgentStatus } from "../../registry/agent-registry.js";
2
+ import type { ObservableSession } from "../session-observer-registry.js";
3
+ export type AgentMetrics = AgentMetricsSummary;
4
+ export interface AggregateMetrics extends AgentMetrics {
5
+ reportedAgents: number;
6
+ /** Rows whose duration is an observer-measured active runtime. */
7
+ activeDurationAgents: number;
8
+ }
9
+ export interface AgentTreeProjection {
10
+ rows: AgentRef[];
11
+ depthById: Map<string, number>;
12
+ parentById: Map<string, string>;
13
+ lastSiblingById: Map<string, boolean>;
14
+ }
15
+ export declare const STATUS_ORDER: Record<AgentStatus, number>;
16
+ /** Exact observer usage for one roster entry. */
17
+ export declare function progressMetrics(observed: ObservableSession | undefined): AgentMetrics | undefined;
18
+ /**
19
+ * Read direct assistant usage from a live session. SessionStats also includes
20
+ * usage embedded in completed `task` tool results, so using it for a parent
21
+ * row would double-count child rows in the aggregate.
22
+ */
23
+ export declare function readSessionMetrics(session: NonNullable<AgentRef["session"]>): AgentMetrics | undefined;
24
+ export declare function aggregateMetrics(args: {
25
+ rows: readonly AgentRef[];
26
+ observedById: ReadonlyMap<string, ObservableSession>;
27
+ metricsFor: (ref: AgentRef, observed: ObservableSession | undefined) => AgentMetrics | undefined;
28
+ fallbackStatsSession: (ref: AgentRef, observed: ObservableSession | undefined) => NonNullable<AgentRef["session"]> | undefined;
29
+ sessionMetrics: WeakMap<object, {
30
+ metrics: AgentMetrics | undefined;
31
+ }>;
32
+ refreshFallback: boolean;
33
+ }): {
34
+ metrics: AggregateMetrics;
35
+ hasFallbackLiveSessions: boolean;
36
+ };
37
+ /** Parent-before-child projection preserving the roster's stable sibling order. */
38
+ export declare function projectAgentTree(refs: readonly AgentRef[]): AgentTreeProjection;
@@ -0,0 +1,41 @@
1
+ import { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
2
+ import type { Settings } from "../../config/settings.js";
3
+ import { type AgentRef } from "../../registry/agent-registry.js";
4
+ import type { ObservableSession } from "../session-observer-registry.js";
5
+ import type { AgentMetrics } from "./agent-hub-projection.js";
6
+ export interface RosterRender {
7
+ lines: string[];
8
+ hitRows: Array<number | undefined>;
9
+ }
10
+ /** Legacy progress snapshots may omit counters; snapshot absence remains distinct. */
11
+ export declare function metricNumber(value: number | undefined): number;
12
+ /** Compute the max content width for the current terminal, accounting for chrome. */
13
+ export declare function contentWidth(): number;
14
+ /** Remove terminal controls and normalize a value before it reaches the TUI. */
15
+ export declare function sanitizeDisplayText(text: string): string;
16
+ /** Sanitize a line for TUI display and truncate it to the viewport width. */
17
+ export declare function sanitizeLine(text: string, maxWidth?: number): string;
18
+ export declare function clampHubLine(line: string, width: number): string;
19
+ /** Status glyph, colored per theme status conventions. The title-line counts spell out the words. */
20
+ export declare function statusGlyph(status: AgentRef["status"]): string;
21
+ export declare function statusText(status: AgentRef["status"], text: string): string;
22
+ /** Model id + thinking level (`sonnet-4-6 ◒ high`), level colored per theme. */
23
+ export declare function formatModelBadge(modelId: string, level: ThinkingLevel | undefined): string;
24
+ /** Textual model-role tag; color reinforces (but never replaces) the label. */
25
+ export declare function formatRoleBadge(role: string, settings: Settings): string;
26
+ /** Format a resolved selector, preserving provider identity when requested. */
27
+ export declare function formatResolvedModelBadge(resolved: string, preserveProvider?: boolean, fallbackLevel?: ThinkingLevel): string;
28
+ /**
29
+ * Resolved model + reasoning level for a hub row. Exact executor progress is
30
+ * authoritative (and survives completion); direct live sessions are the
31
+ * fallback for agents without an observer snapshot.
32
+ */
33
+ export declare function modelBadge(ref: AgentRef, observed: ObservableSession | undefined): string | undefined;
34
+ export declare function formatMetricDuration(metrics: AgentMetrics): string | undefined;
35
+ export declare function formatCost(cost: number): string;
36
+ export declare function formatMetrics(metrics: AgentMetrics): string;
37
+ export declare function contextGauge(tokens: number, window: number): string;
38
+ /** Fit a child-id preview without joining an arbitrarily large child set. */
39
+ export declare function formatChildIds(children: readonly AgentRef[], width: number): string;
40
+ /** Bash `tree`-style ancestry prefix, clipped from the left on pathological depth. */
41
+ export declare function treeBranch(ref: AgentRef, maxWidth: number, depthById: ReadonlyMap<string, number>, parentById: ReadonlyMap<string, string>, lastSiblingById: ReadonlyMap<string, boolean>): string;
@@ -4,8 +4,8 @@
4
4
  * One overlay, two views:
5
5
  * - Table view: every registered agent except Main (Main IS the ambient
6
6
  * chat), live from the global AgentRegistry — status, unread irc count,
7
- * current/last task, last activity. Select with j/k, Enter opens a chat,
8
- * `r` revives a parked agent, `x` aborts + releases one.
7
+ * current/last task, last activity. Navigate with keys, wheel, hover, and
8
+ * click; `r` revives a parked agent, `x` aborts + releases one.
9
9
  * - Chat view: per-agent transcript (incremental session-file tail, absorbed
10
10
  * from the old session observer overlay) plus an input line. Submitting
11
11
  * revives a parked agent, then prompts/steers it; the message lands in the
@@ -13,9 +13,10 @@
13
13
  *
14
14
  * Replaces the old SessionObserverOverlayComponent (ctrl+s observer).
15
15
  */
16
- import { type AgentTool } from "@oh-my-pi/pi-agent-core";
17
- import { Container, type TUI } from "@oh-my-pi/pi-tui";
16
+ import type { AgentTool } from "@oh-my-pi/pi-agent-core";
17
+ import { Container, type SelectListMouseTarget, type TUI } from "@oh-my-pi/pi-tui";
18
18
  import type { KeyId } from "../../config/keybindings.js";
19
+ import type { Settings } from "../../config/settings.js";
19
20
  import type { MessageRenderer } from "../../extensibility/extensions/types.js";
20
21
  import { IrcBus } from "../../irc/bus.js";
21
22
  import { AgentLifecycleManager } from "../../registry/agent-lifecycle.js";
@@ -39,6 +40,8 @@ export interface AgentHubRemote {
39
40
  export interface AgentHubDeps {
40
41
  /** Progress/status snapshot source (task lifecycle + progress channels). */
41
42
  observers: SessionObserverRegistry;
43
+ /** Production settings used to resolve textual model-role tags. */
44
+ settings?: Settings;
42
45
  /** Keys that toggle the hub closed from inside (app.agents.hub + app.session.observe). */
43
46
  hubKeys: KeyId[];
44
47
  onDone: () => void;
@@ -69,7 +72,7 @@ export interface AgentHubDeps {
69
72
  /** Collab guest: route actions/transcripts to the host instead of local sessions. */
70
73
  remote?: AgentHubRemote;
71
74
  }
72
- export declare class AgentHubOverlayComponent extends Container {
75
+ export declare class AgentHubOverlayComponent extends Container implements SelectListMouseTarget {
73
76
  #private;
74
77
  /** Resolves after persisted historical subagents have been registered and rows refreshed. */
75
78
  readonly persistedSubagentsReady: Promise<void>;
@@ -101,4 +104,8 @@ export declare class AgentHubOverlayComponent extends Container {
101
104
  * restored when the viewer closes. No-op without a real TUI (render-only test stub).
102
105
  */
103
106
  openChat(id: string): void;
107
+ handleWheel(delta: -1 | 1): void;
108
+ hitTest(line: number): number | undefined;
109
+ setHoverIndex(index: number | null): void;
110
+ clickItem(index: number): void;
104
111
  }
@@ -50,8 +50,16 @@ export declare function sortModelItems(items: ModelBrowserItem[], options?: Sort
50
50
  /** Compact glyph for a configured thinking level; empty for `inherit` (nothing to show). */
51
51
  export declare function thinkingLevelGlyph(level: ConfiguredThinkingLevel): string;
52
52
  /**
53
- * A slim role chip: `●default ◉` — solid dot for configured assignments,
53
+ * A slim role chip: `● default ◉` — solid dot for configured assignments,
54
54
  * hollow for auto-selected fallbacks, thinking glyph attached when set.
55
+ *
56
+ * The space after the status glyph is load-bearing. Under the `nerd` preset
57
+ * these are Nerd Font private-use icons (U+F111 / U+F10C) whose glyphs are
58
+ * drawn two cells wide, while `visibleWidth` counts them as one
59
+ * (`ambiguousIsNarrow: true` in tui/utils.ts — the PUA block is
60
+ * East_Asian_Width=Ambiguous). Without a separator the icon overhangs and
61
+ * eats the label's first character (`● default` renders as `●efault`).
62
+ * Mirrors the spacing already used for `status.success` in model-hub.
55
63
  */
56
64
  export declare function formatRoleChip(role: string, assignment: RoleAssignment, settings: Settings): string;
57
65
  /** Behavior switches for {@link ModelBrowser}. */
@@ -284,7 +284,14 @@ export declare class InteractiveMode implements InteractiveModeContext {
284
284
  initializeHookRunner(uiContext: ExtensionUIContext, hasUI: boolean): void;
285
285
  setEditorComponent(factory: ((tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager) => CustomEditor) | undefined): void;
286
286
  present(content: Component | readonly Component[]): void;
287
- /** Defer transcript command panels until the active turn can no longer grow above them. */
287
+ /**
288
+ * Defer transcript command panels while the agent is streaming, then mount
289
+ * them at the next settle, terminal or not. A non-terminal settle is only a
290
+ * scheduling pause, so resumed streaming can still land below a panel
291
+ * flushed there. That is preferred over leaving it queued behind a command
292
+ * the user runs during the pause, which mounts immediately and would put the
293
+ * older panel out of order.
294
+ */
288
295
  presentCommandOutput(content: Component | readonly Component[]): void;
289
296
  /** Mount every command panel queued for the current session while the agent was streaming. */
290
297
  flushPendingCommandOutput(): void;
@@ -28,6 +28,8 @@ export declare class SessionObserverRegistry {
28
28
  /** Add a change listener. Returns unsubscribe function. */
29
29
  onChange(cb: (kind: SessionObserverChangeKind) => void): () => void;
30
30
  setMainSession(sessionFile?: string): void;
31
+ /** Return one tracked session without copying or sorting the registry. */
32
+ getSession(id: string): ObservableSession | undefined;
31
33
  getSessions(): ObservableSession[];
32
34
  getActiveSubagentCount(): number;
33
35
  /** Clear all tracked sessions (e.g. on session switch). Keeps EventBus subscriptions and listeners. */
@@ -108,5 +108,5 @@ export declare class AgentLifecycleManager {
108
108
  tombstone?: boolean;
109
109
  }): Promise<boolean>;
110
110
  /** Teardown everything (process exit / main session dispose). */
111
- dispose(): Promise<void>;
111
+ dispose(deadlineAt?: number): Promise<void>;
112
112
  }
@@ -10,6 +10,9 @@
10
10
  */
11
11
  import type { AgentSession } from "../session/agent-session.js";
12
12
  export declare const MAIN_AGENT_ID = "Main";
13
+ /** Sidecar marker retained beside a child transcript after an explicit kill. */
14
+ export declare const AGENT_TOMBSTONE_SUFFIX = ".tombstone";
15
+ export declare function getAgentTombstonePath(sessionFile: string): string;
13
16
  /**
14
17
  * - `running`: a turn is in flight.
15
18
  * - `idle`: live AgentSession in memory, awaiting work. Finished agents are
@@ -18,6 +21,8 @@ export declare const MAIN_AGENT_ID = "Main";
18
21
  * - `aborted`: hard-killed, terminal.
19
22
  */
20
23
  export type AgentStatus = "running" | "idle" | "parked" | "aborted";
24
+ /** Provenance of a displayed duration: active runtime, transcript span, or unavailable. */
25
+ export type AgentDurationKind = "active" | "span" | "unknown";
21
26
  /**
22
27
  * - `main`/`sub`: the user-facing agent tree (driving agent + task subagents).
23
28
  * - `advisor`: a passive review transcript persisted like a subagent for usage
@@ -25,6 +30,33 @@ export type AgentStatus = "running" | "idle" | "parked" | "aborted";
25
30
  * agent-facing rosters (`hub`, `history://`) and not messageable/revivable.
26
31
  */
27
32
  export type AgentKind = "main" | "sub" | "advisor";
33
+ /** Persisted per-agent totals reconstructed from the child session transcript. */
34
+ export interface AgentMetricsSummary {
35
+ tokens: number;
36
+ requests: number;
37
+ tools: number;
38
+ cost: number;
39
+ durationMs: number;
40
+ durationKind?: AgentDurationKind;
41
+ contextTokens?: number;
42
+ contextWindow?: number;
43
+ }
44
+ /** Historical identity and telemetry that remain available after the live session is disposed. */
45
+ export interface AgentHistorySummary {
46
+ agent?: string;
47
+ modelRole?: string;
48
+ resolvedModel?: string;
49
+ /** Whether the last resolved model was selected by retry fallback routing. */
50
+ resolvedModelIsFallback?: boolean;
51
+ metrics?: AgentMetricsSummary;
52
+ readOnly?: boolean;
53
+ /** Durable task output artifact, when the executor wrote one. */
54
+ outputPath?: string;
55
+ /** Captured isolated-worktree patch, when patch capture succeeded. */
56
+ patchPath?: string;
57
+ /** Isolated branch identity, when branch-mode capture succeeded. */
58
+ branchName?: string;
59
+ }
28
60
  export interface AgentRef {
29
61
  id: string;
30
62
  displayName: string;
@@ -38,6 +70,8 @@ export interface AgentRef {
38
70
  lastActivity: number;
39
71
  /** Short gist of what the agent is currently doing (latest intent or tool), for the work-aware roster. Display-only. */
40
72
  activity?: string;
73
+ /** Persisted identity and telemetry restored after the live observer is gone. */
74
+ history?: AgentHistorySummary;
41
75
  }
42
76
  export type AgentRefExpectation = AgentRef | AgentSession;
43
77
  export type RegistryEvent = {
@@ -46,6 +80,9 @@ export type RegistryEvent = {
46
80
  } | {
47
81
  type: "status_changed";
48
82
  ref: AgentRef;
83
+ } | {
84
+ type: "metadata_changed";
85
+ ref: AgentRef;
49
86
  } | {
50
87
  type: "removed";
51
88
  ref: AgentRef;
@@ -59,6 +96,14 @@ export interface RegisterInput {
59
96
  session: AgentSession | null;
60
97
  sessionFile?: string | null;
61
98
  status?: AgentStatus;
99
+ /** Last persisted task summary, when restoring a historical agent. */
100
+ activity?: string;
101
+ /** Original registration timestamp, when known from persisted history. */
102
+ createdAt?: number;
103
+ /** Last transcript activity timestamp, when known from persisted history. */
104
+ lastActivity?: number;
105
+ /** Persisted identity and telemetry restored after the live observer is gone. */
106
+ history?: AgentHistorySummary;
62
107
  }
63
108
  export declare class AgentRegistry {
64
109
  #private;
@@ -73,6 +118,8 @@ export declare class AgentRegistry {
73
118
  * id after its prior generation disappeared or was hard-killed.
74
119
  */
75
120
  registerIfAvailable(input: RegisterInput, expected: AgentRef | null): AgentRef | undefined;
121
+ /** Attach transcript-derived identity and telemetry without changing lifecycle state. */
122
+ setHistory(id: string, history: AgentHistorySummary, expectedSessionFile?: string): boolean;
76
123
  setStatus(id: string, status: AgentStatus, expected?: AgentRefExpectation): boolean;
77
124
  /**
78
125
  * Record a short activity gist for the work-aware roster. Display-only and
@@ -1,3 +1,5 @@
1
1
  import { type AgentRegistry } from "./agent-registry.js";
2
2
  /** Register persisted subagent and advisor transcripts as parked registry refs. */
3
- export declare function registerPersistedSubagents(registry: AgentRegistry, sessionFile: string | null | undefined): Promise<void>;
3
+ export declare function registerPersistedSubagents(registry: AgentRegistry, sessionFile: string | null | undefined, options?: {
4
+ shouldContinue?: () => boolean;
5
+ }): Promise<void>;