@oh-my-pi/pi-coding-agent 17.0.8 → 17.1.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 (340) hide show
  1. package/CHANGELOG.md +87 -1
  2. package/README.md +1 -1
  3. package/dist/cli.js +5495 -5021
  4. package/dist/types/async/job-manager.d.ts +37 -1
  5. package/dist/types/cli/args.d.ts +2 -0
  6. package/dist/types/cli/bench-cli.d.ts +41 -0
  7. package/dist/types/commands/bench.d.ts +15 -3
  8. package/dist/types/commands/launch.d.ts +4 -0
  9. package/dist/types/config/__tests__/model-registry.test.d.ts +1 -0
  10. package/dist/types/config/model-registry.d.ts +30 -1
  11. package/dist/types/config/models-config-schema.d.ts +18 -6
  12. package/dist/types/config/models-config.d.ts +14 -5
  13. package/dist/types/config/provider-globals.d.ts +2 -2
  14. package/dist/types/config/service-tier.d.ts +5 -1
  15. package/dist/types/config/settings-schema.d.ts +350 -50
  16. package/dist/types/config/settings.d.ts +7 -0
  17. package/dist/types/dap/client.d.ts +20 -0
  18. package/dist/types/exec/bash-executor.d.ts +38 -0
  19. package/dist/types/exec/direnv.d.ts +33 -0
  20. package/dist/types/export/html/args.d.ts +15 -0
  21. package/dist/types/export/html/index.d.ts +11 -26
  22. package/dist/types/export/html/web-palette.d.ts +55 -116
  23. package/dist/types/extensibility/extensions/loader.d.ts +3 -0
  24. package/dist/types/extensibility/extensions/types.d.ts +17 -2
  25. package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +1 -0
  26. package/dist/types/extensibility/legacy-pi-tui-shim.d.ts +10 -0
  27. package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +14 -1
  28. package/dist/types/internal-urls/registry-helpers.d.ts +11 -0
  29. package/dist/types/live/controller.d.ts +40 -0
  30. package/dist/types/live/protocol.d.ts +85 -0
  31. package/dist/types/live/protocol.test.d.ts +1 -0
  32. package/dist/types/live/transport.d.ts +48 -0
  33. package/dist/types/live/visualizer.d.ts +33 -0
  34. package/dist/types/lsp/client.d.ts +18 -1
  35. package/dist/types/mcp/config-writer.test.d.ts +1 -0
  36. package/dist/types/mcp/manager.d.ts +6 -2
  37. package/dist/types/mcp/oauth-discovery.d.ts +2 -0
  38. package/dist/types/mcp/render.d.ts +2 -2
  39. package/dist/types/mcp/smithery-auth.d.ts +1 -1
  40. package/dist/types/mcp/smithery-auth.test.d.ts +1 -0
  41. package/dist/types/mcp/tool-bridge.d.ts +7 -3
  42. package/dist/types/mcp/types.d.ts +6 -0
  43. package/dist/types/memory-backend/tool-names.d.ts +2 -0
  44. package/dist/types/modes/components/login-dialog.d.ts +2 -2
  45. package/dist/types/modes/components/oauth-selector.d.ts +8 -0
  46. package/dist/types/modes/components/plan-review-overlay.d.ts +26 -0
  47. package/dist/types/modes/components/settings-defs.d.ts +8 -1
  48. package/dist/types/modes/components/status-line/component.jj-cache.test.d.ts +1 -0
  49. package/dist/types/modes/components/tool-execution.d.ts +9 -1
  50. package/dist/types/modes/controllers/command-controller.d.ts +1 -1
  51. package/dist/types/modes/controllers/event-controller.d.ts +6 -1
  52. package/dist/types/modes/controllers/live-command-controller.d.ts +14 -0
  53. package/dist/types/modes/controllers/mcp-command-controller.d.ts +3 -0
  54. package/dist/types/modes/interactive-mode.d.ts +5 -0
  55. package/dist/types/modes/rpc/rpc-client.d.ts +10 -1
  56. package/dist/types/modes/rpc/rpc-frame.d.ts +16 -0
  57. package/dist/types/modes/rpc/rpc-messages.d.ts +26 -0
  58. package/dist/types/modes/rpc/rpc-types.d.ts +40 -0
  59. package/dist/types/modes/setup-wizard/scenes/sign-in.d.ts +1 -1
  60. package/dist/types/modes/setup-wizard/scenes/types.d.ts +9 -1
  61. package/dist/types/modes/setup-wizard/scenes/web-search.d.ts +1 -1
  62. package/dist/types/modes/theme/theme.d.ts +1 -1
  63. package/dist/types/modes/types.d.ts +3 -1
  64. package/dist/types/modes/utils/context-usage.d.ts +12 -2
  65. package/dist/types/plan-mode/plan-files.d.ts +10 -0
  66. package/dist/types/registry/agent-lifecycle.d.ts +21 -9
  67. package/dist/types/registry/agent-registry.d.ts +11 -4
  68. package/dist/types/sdk.d.ts +15 -1
  69. package/dist/types/secrets/index.d.ts +15 -2
  70. package/dist/types/secrets/obfuscator.d.ts +113 -15
  71. package/dist/types/session/acp-permission-gate.d.ts +19 -0
  72. package/dist/types/session/agent-session-events.d.ts +84 -0
  73. package/dist/types/session/agent-session-types.d.ts +314 -0
  74. package/dist/types/session/agent-session.d.ts +120 -750
  75. package/dist/types/session/async-job-delivery.d.ts +28 -0
  76. package/dist/types/session/bash-runner.d.ts +75 -0
  77. package/dist/types/session/blob-store.d.ts +11 -1
  78. package/dist/types/session/blob-store.test.d.ts +1 -0
  79. package/dist/types/session/checkpoint-entries.d.ts +28 -0
  80. package/dist/types/session/eval-runner.d.ts +49 -0
  81. package/dist/types/session/irc-bridge.d.ts +46 -0
  82. package/dist/types/session/messages.d.ts +22 -0
  83. package/dist/types/session/model-controls.d.ts +180 -0
  84. package/dist/types/session/prewalk.d.ts +46 -0
  85. package/dist/types/session/queued-messages.d.ts +22 -0
  86. package/dist/types/session/redis-session-storage.d.ts +1 -0
  87. package/dist/types/session/retry-fallback-chains.d.ts +74 -0
  88. package/dist/types/session/role-models.d.ts +15 -0
  89. package/dist/types/session/session-advisors.d.ts +228 -0
  90. package/dist/types/session/session-entries.d.ts +8 -0
  91. package/dist/types/session/session-handoff.d.ts +70 -0
  92. package/dist/types/session/session-history-format.d.ts +6 -1
  93. package/dist/types/session/session-loader.d.ts +6 -4
  94. package/dist/types/session/session-maintenance.d.ts +246 -0
  95. package/dist/types/session/session-manager.d.ts +41 -0
  96. package/dist/types/session/session-memory.d.ts +56 -0
  97. package/dist/types/session/session-provider-boundary.d.ts +62 -0
  98. package/dist/types/session/session-stats.d.ts +48 -0
  99. package/dist/types/session/session-tools.d.ts +143 -0
  100. package/dist/types/session/session-workspace.d.ts +32 -0
  101. package/dist/types/session/stream-guards.d.ts +44 -0
  102. package/dist/types/session/todo-tracker.d.ts +56 -0
  103. package/dist/types/session/ttsr-coordinator.d.ts +51 -0
  104. package/dist/types/session/turn-recovery.d.ts +225 -0
  105. package/dist/types/system-prompt.d.ts +2 -0
  106. package/dist/types/task/executor.d.ts +4 -1
  107. package/dist/types/task/output-manager.d.ts +3 -1
  108. package/dist/types/task/types.d.ts +14 -0
  109. package/dist/types/tools/approval.d.ts +1 -0
  110. package/dist/types/tools/browser/launch.d.ts +5 -0
  111. package/dist/types/tools/hub/jobs.d.ts +1 -1
  112. package/dist/types/tools/image-gen.d.ts +4 -4
  113. package/dist/types/tools/image-providers.d.ts +38 -0
  114. package/dist/types/tools/index.d.ts +8 -0
  115. package/dist/types/tools/path-utils.d.ts +8 -0
  116. package/dist/types/tools/report-tool-issue.d.ts +24 -9
  117. package/dist/types/tools/todo.d.ts +10 -4
  118. package/dist/types/tools/xdev.d.ts +5 -1
  119. package/dist/types/tts/streaming-player.d.ts +14 -0
  120. package/dist/types/tts/vocalizer.d.ts +5 -0
  121. package/dist/types/utils/jj.d.ts +29 -0
  122. package/dist/types/utils/lang-from-path.d.ts +1 -0
  123. package/dist/types/utils/title-generator.d.ts +30 -0
  124. package/dist/types/vibe/runtime.d.ts +36 -8
  125. package/dist/types/web/search/index.d.ts +1 -1
  126. package/dist/types/web/search/provider.d.ts +15 -5
  127. package/dist/types/web/search/providers/firecrawl.d.ts +9 -0
  128. package/dist/types/web/search/types.d.ts +95 -1
  129. package/package.json +13 -12
  130. package/scripts/generate-share-viewer.ts +4 -6
  131. package/scripts/legacy-pi-virtual-module.ts +1 -1
  132. package/src/advisor/__tests__/advisor.test.ts +643 -0
  133. package/src/advisor/runtime.ts +144 -43
  134. package/src/async/job-manager.ts +90 -2
  135. package/src/cli/args.ts +2 -0
  136. package/src/cli/auth-gateway-cli.ts +18 -3
  137. package/src/cli/bench-cli.ts +395 -29
  138. package/src/cli/flag-tables.ts +3 -0
  139. package/src/cli/gc-cli.ts +2 -2
  140. package/src/cli/grievances-cli.ts +2 -2
  141. package/src/cli/usage-cli.ts +11 -2
  142. package/src/collab/host.ts +3 -2
  143. package/src/commands/bench.ts +18 -4
  144. package/src/commands/launch.ts +4 -0
  145. package/src/config/__tests__/model-registry.test.ts +147 -0
  146. package/src/config/model-registry.ts +50 -2
  147. package/src/config/model-resolver.ts +0 -1
  148. package/src/config/models-config-schema.ts +15 -4
  149. package/src/config/provider-globals.ts +9 -9
  150. package/src/config/service-tier.ts +26 -1
  151. package/src/config/settings-schema.ts +250 -54
  152. package/src/config/settings.ts +81 -2
  153. package/src/dap/client.ts +37 -4
  154. package/src/edit/index.ts +49 -12
  155. package/src/eval/py/executor.ts +103 -33
  156. package/src/exec/bash-executor.ts +89 -6
  157. package/src/exec/direnv.ts +145 -0
  158. package/src/export/html/args.ts +20 -0
  159. package/src/export/html/index.ts +45 -47
  160. package/src/export/html/template.css +19 -1
  161. package/src/export/html/template.html +6 -0
  162. package/src/export/html/template.js +21 -0
  163. package/src/export/html/tool-views.generated.js +31 -31
  164. package/src/export/html/web-palette.ts +116 -132
  165. package/src/export/share.ts +249 -49
  166. package/src/extensibility/extensions/loader.ts +29 -1
  167. package/src/extensibility/extensions/runner.ts +6 -0
  168. package/src/extensibility/extensions/types.ts +33 -2
  169. package/src/extensibility/legacy-pi-coding-agent-shim.ts +1 -0
  170. package/src/extensibility/legacy-pi-tui-shim.ts +10 -0
  171. package/src/extensibility/plugins/legacy-pi-compat.ts +870 -311
  172. package/src/hindsight/state.ts +64 -6
  173. package/src/internal-urls/local-protocol.ts +2 -1
  174. package/src/internal-urls/memory-protocol.ts +2 -2
  175. package/src/internal-urls/registry-helpers.ts +40 -0
  176. package/src/internal-urls/skill-protocol.ts +2 -2
  177. package/src/internal-urls/ssh-protocol.ts +2 -1
  178. package/src/internal-urls/vault-protocol.ts +2 -1
  179. package/src/live/audio-worklet.txt +59 -0
  180. package/src/live/browser-runtime.txt +221 -0
  181. package/src/live/controller.ts +464 -0
  182. package/src/live/prompts/agent-final-message.md +3 -0
  183. package/src/live/prompts/live-instructions.md +23 -0
  184. package/src/live/protocol.test.ts +140 -0
  185. package/src/live/protocol.ts +233 -0
  186. package/src/live/transport.ts +490 -0
  187. package/src/live/visualizer.ts +234 -0
  188. package/src/lsp/client.ts +52 -9
  189. package/src/lsp/clients/biome-client.ts +3 -4
  190. package/src/lsp/index.ts +44 -11
  191. package/src/main.ts +9 -1
  192. package/src/mcp/config-writer.test.ts +43 -0
  193. package/src/mcp/config-writer.ts +109 -82
  194. package/src/mcp/manager.ts +39 -8
  195. package/src/mcp/oauth-discovery.ts +10 -2
  196. package/src/mcp/render.ts +94 -35
  197. package/src/mcp/smithery-auth.test.ts +29 -0
  198. package/src/mcp/smithery-auth.ts +3 -2
  199. package/src/mcp/tool-bridge.ts +107 -11
  200. package/src/mcp/types.ts +7 -0
  201. package/src/memories/index.ts +40 -20
  202. package/src/memory-backend/tool-names.ts +2 -0
  203. package/src/mnemopi/backend.ts +24 -7
  204. package/src/modes/acp/acp-agent.ts +56 -10
  205. package/src/modes/acp/acp-event-mapper.ts +8 -1
  206. package/src/modes/components/agent-hub.ts +27 -10
  207. package/src/modes/components/login-dialog.ts +14 -4
  208. package/src/modes/components/oauth-selector.ts +24 -7
  209. package/src/modes/components/plan-review-overlay.ts +350 -35
  210. package/src/modes/components/settings-defs.ts +28 -3
  211. package/src/modes/components/settings-selector.ts +178 -6
  212. package/src/modes/components/status-line/component.jj-cache.test.ts +229 -0
  213. package/src/modes/components/status-line/component.ts +123 -2
  214. package/src/modes/components/tool-execution.test.ts +63 -2
  215. package/src/modes/components/tool-execution.ts +11 -2
  216. package/src/modes/controllers/command-controller.ts +70 -22
  217. package/src/modes/controllers/event-controller.ts +111 -16
  218. package/src/modes/controllers/extension-ui-controller.test.ts +1 -0
  219. package/src/modes/controllers/extension-ui-controller.ts +20 -4
  220. package/src/modes/controllers/live-command-controller.ts +178 -0
  221. package/src/modes/controllers/mcp-command-controller.ts +80 -41
  222. package/src/modes/controllers/omfg-controller.ts +44 -40
  223. package/src/modes/controllers/selector-controller.ts +18 -10
  224. package/src/modes/controllers/session-focus-controller.ts +6 -1
  225. package/src/modes/interactive-mode.ts +160 -38
  226. package/src/modes/rpc/rpc-client.ts +94 -3
  227. package/src/modes/rpc/rpc-frame.ts +164 -4
  228. package/src/modes/rpc/rpc-messages.ts +127 -0
  229. package/src/modes/rpc/rpc-mode.ts +79 -7
  230. package/src/modes/rpc/rpc-types.ts +34 -2
  231. package/src/modes/runtime-init.ts +2 -0
  232. package/src/modes/setup-wizard/scenes/model.ts +5 -7
  233. package/src/modes/setup-wizard/scenes/providers.ts +3 -2
  234. package/src/modes/setup-wizard/scenes/sign-in.ts +8 -2
  235. package/src/modes/setup-wizard/scenes/theme.ts +13 -3
  236. package/src/modes/setup-wizard/scenes/types.ts +9 -1
  237. package/src/modes/setup-wizard/scenes/web-search.ts +23 -10
  238. package/src/modes/setup-wizard/wizard-overlay.ts +1 -1
  239. package/src/modes/theme/theme.ts +1 -1
  240. package/src/modes/types.ts +3 -1
  241. package/src/modes/utils/context-usage.ts +23 -7
  242. package/src/modes/utils/ui-helpers.ts +10 -5
  243. package/src/plan-mode/plan-files.ts +40 -0
  244. package/src/prompts/bench/cache-prefix-chunk.md +1 -0
  245. package/src/prompts/bench/cache-prefix.md +3 -0
  246. package/src/prompts/bench/cache-suffix.md +1 -0
  247. package/src/prompts/goals/guided-goal-system.md +24 -3
  248. package/src/prompts/system/custom-system-prompt.md +1 -1
  249. package/src/prompts/system/project-prompt.md +8 -1
  250. package/src/prompts/system/subagent-async-pending.md +6 -0
  251. package/src/prompts/system/system-prompt.md +1 -1
  252. package/src/prompts/system/workflow-notice.md +48 -40
  253. package/src/prompts/system/xdev-mount-notice.md +4 -0
  254. package/src/prompts/tools/task.md +12 -2
  255. package/src/prompts/tools/todo.md +3 -1
  256. package/src/registry/agent-lifecycle.ts +116 -46
  257. package/src/registry/agent-registry.ts +35 -8
  258. package/src/registry/persisted-agents.ts +26 -2
  259. package/src/sdk.ts +255 -139
  260. package/src/secrets/index.ts +127 -4
  261. package/src/secrets/obfuscator.ts +2328 -105
  262. package/src/session/acp-permission-gate.ts +165 -0
  263. package/src/session/agent-session-error-log.test.ts +1 -1
  264. package/src/session/agent-session-events.ts +66 -0
  265. package/src/session/agent-session-types.ts +334 -0
  266. package/src/session/agent-session.ts +1910 -12213
  267. package/src/session/artifacts.ts +6 -5
  268. package/src/session/async-job-delivery.ts +74 -0
  269. package/src/session/bash-runner.ts +326 -0
  270. package/src/session/blob-store.test.ts +56 -0
  271. package/src/session/blob-store.ts +18 -2
  272. package/src/session/checkpoint-entries.ts +81 -0
  273. package/src/session/eval-runner.ts +212 -0
  274. package/src/session/indexed-session-storage.ts +9 -2
  275. package/src/session/irc-bridge.ts +203 -0
  276. package/src/session/messages.ts +263 -1
  277. package/src/session/model-controls.ts +714 -0
  278. package/src/session/prewalk.ts +252 -0
  279. package/src/session/queued-messages.ts +93 -0
  280. package/src/session/redis-session-storage.ts +51 -11
  281. package/src/session/retry-fallback-chains.ts +455 -0
  282. package/src/session/role-models.ts +85 -0
  283. package/src/session/session-advisors.ts +1679 -0
  284. package/src/session/session-context.test.ts +224 -1
  285. package/src/session/session-context.ts +47 -5
  286. package/src/session/session-entries.ts +8 -0
  287. package/src/session/session-handoff.ts +308 -0
  288. package/src/session/session-history-format.ts +20 -9
  289. package/src/session/session-loader.ts +10 -51
  290. package/src/session/session-maintenance.ts +2983 -0
  291. package/src/session/session-manager.ts +390 -30
  292. package/src/session/session-memory.ts +222 -0
  293. package/src/session/session-provider-boundary.ts +307 -0
  294. package/src/session/session-stats.ts +293 -0
  295. package/src/session/session-tools.ts +943 -0
  296. package/src/session/session-workspace.ts +53 -0
  297. package/src/session/stream-guards.ts +417 -0
  298. package/src/session/todo-tracker.ts +380 -0
  299. package/src/session/ttsr-coordinator.ts +496 -0
  300. package/src/session/turn-recovery.ts +1629 -0
  301. package/src/slash-commands/builtin-registry.ts +92 -11
  302. package/src/slash-commands/helpers/usage-report.ts +25 -4
  303. package/src/system-prompt.ts +41 -17
  304. package/src/task/executor.ts +288 -70
  305. package/src/task/index.ts +148 -111
  306. package/src/task/output-manager.ts +25 -3
  307. package/src/task/persisted-revive.ts +4 -3
  308. package/src/task/structured-subagent.ts +4 -1
  309. package/src/task/types.ts +16 -0
  310. package/src/tools/approval.ts +55 -10
  311. package/src/tools/bash-interactive.ts +26 -0
  312. package/src/tools/bash-skill-urls.ts +28 -2
  313. package/src/tools/bash.ts +339 -123
  314. package/src/tools/browser/launch.ts +9 -1
  315. package/src/tools/browser/tab-supervisor.ts +8 -5
  316. package/src/tools/browser.ts +94 -47
  317. package/src/tools/hub/index.ts +1 -1
  318. package/src/tools/hub/jobs.ts +67 -8
  319. package/src/tools/image-gen.ts +20 -28
  320. package/src/tools/image-providers.ts +50 -0
  321. package/src/tools/index.ts +12 -0
  322. package/src/tools/path-utils.ts +49 -2
  323. package/src/tools/read.ts +156 -88
  324. package/src/tools/renderers.ts +7 -1
  325. package/src/tools/report-tool-issue.ts +79 -28
  326. package/src/tools/todo.ts +101 -11
  327. package/src/tools/vibe.ts +1 -2
  328. package/src/tools/write.ts +51 -1
  329. package/src/tools/xdev.ts +67 -3
  330. package/src/tts/streaming-player.ts +62 -4
  331. package/src/tts/vocalizer.ts +18 -1
  332. package/src/utils/jj.ts +125 -4
  333. package/src/utils/lang-from-path.ts +7 -0
  334. package/src/utils/title-generator.ts +137 -1
  335. package/src/vibe/runtime.ts +852 -72
  336. package/src/web/search/index.ts +3 -6
  337. package/src/web/search/provider.ts +31 -16
  338. package/src/web/search/providers/firecrawl.ts +46 -13
  339. package/src/web/search/providers/xai.ts +7 -1
  340. package/src/web/search/types.ts +8 -1
@@ -0,0 +1,225 @@
1
+ import { type Agent, type AgentMessage, type ThinkingLevel } from "@oh-my-pi/pi-agent-core";
2
+ import type { AssistantMessage, CodexCompactionContext, Model, ToolChoice } from "@oh-my-pi/pi-ai";
3
+ import type { ModelRegistry } from "../config/model-registry.js";
4
+ import type { Settings } from "../config/settings.js";
5
+ import type { ConfiguredThinkingLevel } from "../thinking.js";
6
+ import type { AgentSessionEvent } from "./agent-session-events.js";
7
+ import type { InitialRetryFallbackState } from "./agent-session-types.js";
8
+ import { type RetryFallbackSelector } from "./retry-fallback-chains.js";
9
+ import type { SessionManager } from "./session-manager.js";
10
+ /** Result shape shared with automatic maintenance recovery. */
11
+ export interface RecoveryCompactionResult {
12
+ deferredHandoff: boolean;
13
+ continuationScheduled: boolean;
14
+ automaticContinuationBlocked?: boolean;
15
+ historyRewritten?: boolean;
16
+ }
17
+ /** Capabilities borrowed from the owning AgentSession. */
18
+ export interface TurnRecoveryHost {
19
+ agent: Agent;
20
+ sessionManager: SessionManager;
21
+ settings: Settings;
22
+ modelRegistry: ModelRegistry;
23
+ configWarnings: string[];
24
+ model(): Model | undefined;
25
+ thinkingLevel(): ThinkingLevel | undefined;
26
+ configuredThinkingLevel(): ConfiguredThinkingLevel | undefined;
27
+ setThinkingLevel(level: ConfiguredThinkingLevel | undefined): void;
28
+ isDisposed(): boolean;
29
+ isStreaming(): boolean;
30
+ isCompacting(): boolean;
31
+ abortInProgress(): boolean;
32
+ streamingEditAbortTriggered(): boolean;
33
+ promptGeneration(): number;
34
+ sessionId(): string;
35
+ emitSessionEvent(event: AgentSessionEvent): Promise<void>;
36
+ scheduleAgentContinue(options: {
37
+ delayMs?: number;
38
+ generation?: number;
39
+ }): void;
40
+ waitForSessionMessagePersistence(message: AssistantMessage): Promise<void>;
41
+ appendSessionMessage(message: AssistantMessage): void;
42
+ sessionMessageAlreadyPersisted(message: AssistantMessage): boolean;
43
+ setModelWithProviderSessionReset(model: Model): void;
44
+ resetCurrentResponsesProviderSession(reason: string): void;
45
+ maybeAutoRedeemCodexReset(): Promise<boolean>;
46
+ runAutoCompaction(reason: "overflow" | "threshold" | "idle" | "incomplete", willRetry: boolean, deferred?: boolean, allowDefer?: boolean, options?: {
47
+ autoContinue?: boolean;
48
+ triggerContextTokens?: number;
49
+ suppressContinuation?: boolean;
50
+ suppressHandoff?: boolean;
51
+ phase?: CodexCompactionContext["phase"];
52
+ terminalTextAnswer?: boolean;
53
+ }): Promise<RecoveryCompactionResult>;
54
+ withBashBranchTransition<T>(operation: () => T): T;
55
+ }
56
+ /** Construction-time retry state restored from model selection. */
57
+ export interface TurnRecoveryOptions {
58
+ initialRetryFallback?: InitialRetryFallbackState;
59
+ }
60
+ /** Owns terminal-stop recovery, automatic retries, and fallback routing. */
61
+ export declare class TurnRecovery {
62
+ #private;
63
+ constructor(host: TurnRecoveryHost, options?: TurnRecoveryOptions);
64
+ /** Current automatic retry attempt. */
65
+ get attempt(): number;
66
+ /** Promise settled when the active retry saga finishes. */
67
+ get retryPromise(): Promise<void> | undefined;
68
+ /** Resolved selector while fallback routing owns the current model. */
69
+ get retryFallbackModel(): string | undefined;
70
+ /** Resets per-prompt recovery counters and terminal-stop acceptance. */
71
+ resetForNewPrompt(): void;
72
+ /** Sets whether one terminal empty stop is accepted for the current prompt. */
73
+ setAcceptTerminalEmptyStop(accept: boolean): void;
74
+ /** Closes a successful retry saga and annotates recovered persisted errors. */
75
+ onAssistantSettledSuccessfully(message: AssistantMessage): Promise<void>;
76
+ /** Closes a failed retry saga when no compaction continuation took ownership. */
77
+ onErrorSettledWithoutRetry(message: AssistantMessage, compaction: RecoveryCompactionResult): Promise<void>;
78
+ /** Persists an otherwise skipped terminal empty error turn. */
79
+ persistTerminalEmptyErrorTurn(message: AssistantMessage): Promise<void>;
80
+ /** Handles empty terminal assistant turns and schedules bounded recovery. */
81
+ handleEmptyAssistantStop(message: AssistantMessage): Promise<boolean>;
82
+ /** Classifies suspicious terminal stops and schedules bounded recovery. */
83
+ handleUnexpectedAssistantStop(message: AssistantMessage): Promise<boolean>;
84
+ /** Removes a persisted failed assistant turn after its persistence slot settles. */
85
+ dropPersistedAssistantTurn(message: AssistantMessage): Promise<void>;
86
+ /** Runs recovery compaction and restores the failed turn when no rewrite occurs. */
87
+ runRecoveryCompactionWithRollback(reason: "overflow" | "incomplete", message: AssistantMessage, allowDefer: boolean, options: {
88
+ autoContinue: boolean;
89
+ triggerContextTokens?: number;
90
+ }): Promise<RecoveryCompactionResult>;
91
+ /** Restores the configured primary after fallback cooldown expiry. */
92
+ maybeRestoreRetryFallbackPrimary(): Promise<void>;
93
+ /** Applies automatic retry, credential rotation, and model fallback policy. */
94
+ handleRetryableError(message: AssistantMessage, options?: {
95
+ allowModelFallback?: boolean;
96
+ fireworksFastFallback?: boolean;
97
+ hardErrorFallback?: boolean;
98
+ preserveFailedTurn?: boolean;
99
+ }): Promise<boolean>;
100
+ /** Prompts after transient overlap with a prior agent run. */
101
+ promptAgentWithIdleRetry(messages: AgentMessage[], options?: {
102
+ toolChoice?: ToolChoice;
103
+ }): Promise<void>;
104
+ /** Parses provider retry and rate-limit reset hints into a delay. */
105
+ parseRetryAfterMsFromError(errorMessage: string): number | undefined;
106
+ /** Resolve the pending retry promise */
107
+ resolveRetry(): void;
108
+ removeAssistantMessageFromActiveContext(assistantMessage: AssistantMessage, reason?: string): void;
109
+ /**
110
+ * Drop an assistant turn from BOTH the live agent context and the persisted
111
+ * session branch (reparenting the leaf to the turn's parent), so a discarded
112
+ * turn does not resurface on reload. Used for empty/reasoning-only stops and
113
+ * the Gemini header-runaway interrupt, which must not replay a partial,
114
+ * loop-fueling thinking block.
115
+ */
116
+ discardAssistantTurn(assistantMessage: AssistantMessage): void;
117
+ /**
118
+ * Retry an empty, reason-less provider abort: a turn with no content that
119
+ * carries the generic sentinel (bare `abort()`), whether the provider
120
+ * finalized it as `stopReason: "aborted"` or leaked it as `stopReason:
121
+ * "error"` (a stalled/dropped stream reported as an error rather than an
122
+ * abort — issue #5375). Only fires while the session is neither aborting nor
123
+ * tearing down. A user/lifecycle abort (`#abortInProgress`), a dispose-driven
124
+ * abort (`#isDisposed`), or a session-induced streaming-edit guard abort
125
+ * (`StreamingEditGuard.abortTriggered` — auto-generated-file guard or failed-patch
126
+ * preview) is deliberate and MUST settle the turn instead: routing it through
127
+ * retry would orphan `#retryPromise` on a continuation the guard skips
128
+ * (hanging the in-flight `prompt()`) or silently undo the guard's intended
129
+ * abort. Deliberate user interrupts (`UserInterrupt`) and silent aborts carry
130
+ * their own marker, not the generic sentinel, so they never match here.
131
+ */
132
+ isRetryableReasonlessAbort(message: AssistantMessage): boolean;
133
+ /**
134
+ * Check if an error is retryable (transient errors or usage limits).
135
+ * Context overflow is NOT retryable (handled by compaction instead).
136
+ * Usage-limit errors are retryable because the retry handler performs credential switching.
137
+ */
138
+ isRetryableError(message: AssistantMessage): boolean;
139
+ /**
140
+ * Resume a stalled turn after every emitted tool call has produced a result.
141
+ * Cursor calls must also carry the server-execution marker. The failed
142
+ * assistant/tool-result pair stays in context so completed side effects are
143
+ * continued from rather than replayed.
144
+ */
145
+ canResumeResolvedStreamStall(message: AssistantMessage): boolean;
146
+ /** Checks whether a provider error represents a classifier refusal. */
147
+ isClassifierRefusal(message: AssistantMessage): boolean;
148
+ /** Clears fallback ownership after an explicit model change. */
149
+ clearActiveRetryFallback(): void;
150
+ /** Checks whether a fallback selector remains in cooldown. */
151
+ isRetryFallbackSelectorSuppressed(selector: RetryFallbackSelector): boolean;
152
+ /** Records the cooldown that should suppress a failing selector. */
153
+ noteRetryFallbackCooldown(currentSelector: string, retryAfterMs: number | undefined, errorMessage: string): void;
154
+ /**
155
+ * Map the failing model selector to the chain key that owns it, by
156
+ * specificity: an exact model-selector key, then a `provider/*` wildcard,
157
+ * then a model role whose current assignment matches, then `default`.
158
+ * Model-oriented keys win over roles so a chain follows the model across
159
+ * role reassignments.
160
+ */
161
+ resolveRetryFallbackRole(currentSelector: string, currentModel?: Model | null | undefined): string | undefined;
162
+ /** Finds fallback candidates that follow the active selector. */
163
+ findRetryFallbackCandidates(role: string, currentSelector: string, currentModel?: Model | null | undefined): RetryFallbackSelector[];
164
+ applyRetryFallbackCandidate(role: string, selector: RetryFallbackSelector, currentSelector: string, options?: {
165
+ pinFallback?: boolean;
166
+ apiKey?: string;
167
+ signal?: AbortSignal;
168
+ }): Promise<void>;
169
+ /**
170
+ * True when the current turn failed on a Fireworks Fast (`-fast`) model in a
171
+ * way that should degrade to the reliable base (Standard) model. Fast is a
172
+ * speed-optimized router with no SLA, so any *pre-content* failure — a
173
+ * transient overload/5xx or a hard "router/model not found / unsupported" —
174
+ * is worth retrying on the base id. Skips failures the base model shares:
175
+ * context overflow (compaction's job), usage limits and auth errors (same
176
+ * account/key), and turns that already emitted a tool call (replaying would
177
+ * duplicate work). Requires the base model to exist in the registry.
178
+ */
179
+ isFireworksFastFallbackEligible(message: AssistantMessage): boolean;
180
+ /**
181
+ * True when a turn failed with a hard (non-retryable) provider error but a
182
+ * configured `retry.fallbackChains` entry covers the active model: the same
183
+ * model is not worth retrying, yet a DIFFERENT model is a fresh chance, so
184
+ * the chain is consulted before the error becomes final. Skips failures a
185
+ * model switch cannot fix or must not replay: cancellations (abort-flavored
186
+ * errors are not model faults), context overflow (compaction's job),
187
+ * classifier refusals (chain consult is handled on the retryable path with
188
+ * `pinFallback`), and turns that already emitted a tool call (replaying
189
+ * could duplicate work).
190
+ */
191
+ isHardErrorFallbackEligible(message: AssistantMessage): boolean;
192
+ /**
193
+ * Cancel in-progress retry.
194
+ */
195
+ abortRetry(): void;
196
+ /** Whether auto-retry is currently in progress */
197
+ get isRetrying(): boolean;
198
+ /** Whether auto-retry is enabled */
199
+ get autoRetryEnabled(): boolean;
200
+ /**
201
+ * Toggle auto-retry setting.
202
+ */
203
+ setAutoRetryEnabled(enabled: boolean): void;
204
+ /**
205
+ * Manually retry the last failed assistant turn.
206
+ * Removes the error message from active agent state when present and
207
+ * re-attempts with a fresh retry budget.
208
+ *
209
+ * A stream that stalls or aborts mid-tool-call ends the turn with
210
+ * `stopReason: "error" | "aborted"` and then appends one synthetic
211
+ * {@link isSyntheticToolResultMessage tool_result} per emitted tool call to
212
+ * preserve the provider's tool_use/tool_result pairing (see
213
+ * `createAbortedToolResult` in `agent-loop.ts`). Those placeholders trail the
214
+ * failed assistant turn, so the retry lookback walks back over them before
215
+ * checking the assistant message; it strips both the placeholders and the
216
+ * failed turn before re-attempting.
217
+ *
218
+ * A restored session deliberately omits failed assistant turns from provider
219
+ * context. In that case, the persisted display transcript remains the source
220
+ * of truth for whether the current branch has a retryable failed tail.
221
+ *
222
+ * @returns true if retry was initiated, false if no failed turn to retry or agent is busy
223
+ */
224
+ retry(): Promise<boolean>;
225
+ }
@@ -72,6 +72,8 @@ export interface BuildSystemPromptOptions {
72
72
  skillsSettings?: SkillsSettings;
73
73
  /** Working directory. Default: getProjectDir() */
74
74
  cwd?: string;
75
+ /** Additional workspace directories beyond cwd (multi-root), absolute. Injected into the project prompt. */
76
+ additionalWorkspaceRoots?: string[];
75
77
  /** Pre-loaded context files (skips discovery if provided). */
76
78
  contextFiles?: Array<{
77
79
  path: string;
@@ -17,6 +17,7 @@ import type { HindsightSessionState } from "../hindsight/state.js";
17
17
  import type { LocalProtocolOptions } from "../internal-urls/index.js";
18
18
  import type { MCPManager } from "../mcp/manager.js";
19
19
  import type { MnemopiSessionState } from "../mnemopi/state.js";
20
+ import { type AgentReviver } from "../registry/agent-lifecycle.js";
20
21
  import type { AgentSession } from "../session/agent-session.js";
21
22
  import type { ArtifactManager } from "../session/artifacts.js";
22
23
  import type { AuthStorage } from "../session/auth-storage.js";
@@ -44,6 +45,8 @@ export declare function buildBudgetNotice(requests: number, budget: number): str
44
45
  /** Options for subagent execution */
45
46
  export interface ExecutorOptions {
46
47
  cwd: string;
48
+ /** Additional workspace directories to seed on the subagent session (multi-root). */
49
+ additionalDirectories?: string[];
47
50
  worktree?: string;
48
51
  agent: AgentDefinition;
49
52
  task: string;
@@ -249,7 +252,7 @@ export declare function finalizeSubagentLifecycle(args: {
249
252
  keepAlive: boolean;
250
253
  isolated: boolean;
251
254
  agentIdleTtlMs: number;
252
- reviveSession: (() => Promise<AgentSession>) | null;
255
+ reviveSession: AgentReviver | null;
253
256
  }): Promise<void>;
254
257
  /** Options for {@link runSubagentFollowUpTurn}. */
255
258
  export interface FollowUpTurnOptions {
@@ -3,13 +3,15 @@
3
3
  *
4
4
  * The first allocation of a given name keeps the name as-is; subsequent
5
5
  * allocations of the same name get a `-2`, `-3`, … suffix. On resume, scans
6
- * existing output files so previously written outputs are never overwritten.
6
+ * existing output and child-session files so prior state is never overwritten.
7
7
  */
8
8
  export declare class AgentOutputManager {
9
9
  #private;
10
10
  constructor(getArtifactsDir: () => string | null, options?: {
11
11
  parentPrefix?: string;
12
12
  });
13
+ /** Reserve final IDs discovered outside the output directory scan. */
14
+ reserve(ids: Iterable<string>): Promise<void>;
13
15
  /**
14
16
  * Allocate a unique ID.
15
17
  *
@@ -83,6 +83,7 @@ export declare const taskItemSchema: import("arktype/internal/variants/object.ts
83
83
  name?: string | undefined;
84
84
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
85
85
  task: string;
86
+ model?: string | string[] | undefined;
86
87
  outputSchema?: string | boolean | object | null | undefined;
87
88
  schemaMode?: "permissive" | "strict" | undefined;
88
89
  }, {}>;
@@ -94,6 +95,8 @@ export interface TaskItem {
94
95
  agent?: string;
95
96
  /** The work; required by the schema. */
96
97
  task?: string;
98
+ /** Explicit model selector or fallback chain for this spawn, including optional reasoning suffixes. */
99
+ model?: string | string[];
97
100
  /** Caller-provided output schema; its presence overrides the selected agent's schema. */
98
101
  outputSchema?: unknown;
99
102
  /** Validation behavior for a caller-provided or inherited output schema. */
@@ -105,6 +108,7 @@ export declare const taskSchema: import("arktype/internal/variants/object.ts").O
105
108
  name?: string | undefined;
106
109
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
107
110
  task: string;
111
+ model?: string | string[] | undefined;
108
112
  outputSchema?: string | boolean | object | null | undefined;
109
113
  schemaMode?: "permissive" | "strict" | undefined;
110
114
  isolated?: boolean | undefined;
@@ -113,6 +117,7 @@ declare const ALL_TASK_SCHEMAS: readonly [import("arktype/internal/variants/obje
113
117
  name?: string | undefined;
114
118
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
115
119
  task: string;
120
+ model?: string | string[] | undefined;
116
121
  outputSchema?: string | boolean | object | null | undefined;
117
122
  schemaMode?: "permissive" | "strict" | undefined;
118
123
  isolated?: boolean | undefined;
@@ -120,6 +125,7 @@ declare const ALL_TASK_SCHEMAS: readonly [import("arktype/internal/variants/obje
120
125
  name?: string | undefined;
121
126
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
122
127
  task: string;
128
+ model?: string | string[] | undefined;
123
129
  outputSchema?: string | boolean | object | null | undefined;
124
130
  schemaMode?: "permissive" | "strict" | undefined;
125
131
  }, {}>, import("arktype/internal/variants/object.ts").ObjectType<{
@@ -128,6 +134,7 @@ declare const ALL_TASK_SCHEMAS: readonly [import("arktype/internal/variants/obje
128
134
  name?: string | undefined;
129
135
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
130
136
  task: string;
137
+ model?: string | string[] | undefined;
131
138
  outputSchema?: string | boolean | object | null | undefined;
132
139
  schemaMode?: "permissive" | "strict" | undefined;
133
140
  isolated?: boolean | undefined;
@@ -138,6 +145,7 @@ declare const ALL_TASK_SCHEMAS: readonly [import("arktype/internal/variants/obje
138
145
  name?: string | undefined;
139
146
  agent: import("arktype/internal/attributes.ts").Default<string, "task">;
140
147
  task: string;
148
+ model?: string | string[] | undefined;
141
149
  outputSchema?: string | boolean | object | null | undefined;
142
150
  schemaMode?: "permissive" | "strict" | undefined;
143
151
  }[];
@@ -168,6 +176,8 @@ export interface TaskParams {
168
176
  agent?: string;
169
177
  /** The work (flat form). */
170
178
  task?: string;
179
+ /** Explicit model selector or fallback chain for the spawn, including optional reasoning suffixes. */
180
+ model?: string | string[];
171
181
  /** Caller-provided output schema; its presence overrides the selected agent's schema. */
172
182
  outputSchema?: unknown;
173
183
  /** Validation behavior for a caller-provided or inherited output schema. */
@@ -291,6 +301,8 @@ export interface AgentProgress {
291
301
  modelOverride?: string | string[];
292
302
  /** Resolved model display string in the form `<provider>/<id>`, optionally suffixed with `:<thinkingLevel>` when the level was set explicitly. Undefined when the model could not be resolved. */
293
303
  resolvedModel?: string;
304
+ /** True when {@link resolvedModel} is the target of an active retry fallback (not the originally configured model). Lets observer-only UIs (collab guests, Agent Hub rows with no live session) flag the fallback and keep the provider. */
305
+ resolvedModelIsFallback?: boolean;
294
306
  /** Data extracted by registered subprocess tool handlers (keyed by tool name) */
295
307
  extractedToolData?: Record<string, unknown[]>;
296
308
  /**
@@ -357,6 +369,8 @@ export interface SingleResult {
357
369
  modelOverride?: string | string[];
358
370
  /** Resolved model display string in the form `<provider>/<id>`, optionally suffixed with `:<thinkingLevel>` when the level was set explicitly. Omitted from tool-result JSON when undefined to keep wire payloads small. */
359
371
  resolvedModel?: string;
372
+ /** True when {@link resolvedModel} is the target of an active retry fallback. Mirrors {@link AgentProgress.resolvedModelIsFallback} onto the settled result. */
373
+ resolvedModelIsFallback?: boolean;
360
374
  error?: string;
361
375
  aborted?: boolean;
362
376
  abortReason?: string;
@@ -16,6 +16,7 @@ export interface ResolvedApproval {
16
16
  tier: ToolTier;
17
17
  reason?: string;
18
18
  override: boolean;
19
+ source?: "tool" | "user" | "mode";
19
20
  }
20
21
  /**
21
22
  * Evaluate a tool's own approval declaration against `args` and return the
@@ -14,6 +14,7 @@ export declare const BROWSER_PROTOCOL_TIMEOUT_MS = 60000;
14
14
  export declare function loadPuppeteer(): Promise<typeof Puppeteer>;
15
15
  export declare function loadPuppeteerInWorker(safeDir: string): Promise<typeof Puppeteer>;
16
16
  export declare function ensureChromiumExecutable(): Promise<string | undefined>;
17
+ /** Options shared by headless Chromium consumers. */
17
18
  export interface LaunchHeadlessOptions {
18
19
  headless: boolean;
19
20
  viewport?: {
@@ -21,6 +22,10 @@ export interface LaunchHeadlessOptions {
21
22
  height: number;
22
23
  deviceScaleFactor?: number;
23
24
  };
25
+ /** Additional Chromium arguments merged with the centralized launch defaults. */
26
+ args?: readonly string[];
27
+ /** Additional exact Puppeteer default arguments to suppress. */
28
+ ignoreDefaultArgs?: readonly string[];
24
29
  }
25
30
  export declare function launchHeadlessBrowser(opts: LaunchHeadlessOptions): Promise<Browser>;
26
31
  export declare function applyViewport(page: Page, viewport?: {
@@ -55,7 +55,7 @@ export declare function noMatchingJobsResult(session: ToolSession, ids: string[]
55
55
  /** Bare `wait` with no running jobs and nobody who could message: nothing to block on. */
56
56
  export declare function nothingToWaitForResult(session: ToolSession): AgentToolResult<CoordinationDetails>;
57
57
  /** `cancel`: kill the named jobs; returns immediately with outcomes + snapshots. */
58
- export declare function executeCancel(session: ToolSession, manager: AsyncJobManager, ownerId: string | undefined, ids: string[]): AgentToolResult<CoordinationDetails>;
58
+ export declare function executeCancel(session: ToolSession, manager: AsyncJobManager, ownerId: string | undefined, ids: string[]): Promise<AgentToolResult<CoordinationDetails>>;
59
59
  /** `jobs`: read-only snapshot of every job plus the jobless running-agent roster. */
60
60
  export declare function executeJobsSnapshot(session: ToolSession, manager: AsyncJobManager, ownerId: string | undefined): AgentToolResult<CoordinationDetails>;
61
61
  /** Pending-call frame for job ops (wait/cancel/jobs). */
@@ -1,7 +1,8 @@
1
1
  import { type Model } from "@oh-my-pi/pi-ai";
2
2
  import { type ModelRegistry } from "../config/model-registry.js";
3
3
  import type { CustomTool } from "../extensibility/custom-tools/types.js";
4
- export type ImageProvider = "antigravity" | "gemini" | "openai" | "openai-codex" | "openrouter" | "xai";
4
+ import { type ImageProvider } from "./image-providers.js";
5
+ export type { ImageProvider } from "./image-providers.js";
5
6
  export type ImageProviderPreference = ImageProvider | "auto";
6
7
  declare const responseModalitySchema: import("arktype/internal/variants/string.ts").StringType<"IMAGE" | "TEXT", {}>;
7
8
  export declare const imageGenSchema: import("arktype/internal/variants/object.ts").ObjectType<{
@@ -59,9 +60,8 @@ interface InlineImageData {
59
60
  mimeType: string;
60
61
  }
61
62
  export declare function isImageProviderPreference(value: unknown): value is ImageProviderPreference;
62
- /** Set the preferred image provider from settings */
63
- export declare function setPreferredImageProvider(provider: ImageProviderPreference): void;
63
+ /** Set the configured image-provider priority from settings; invalid IDs are dropped. */
64
+ export declare function setImageProviderOrder(providers: readonly string[]): void;
64
65
  export declare const imageGenTool: CustomTool<typeof imageGenSchema, ImageGenToolDetails>;
65
66
  export declare function getImageGenTools(_modelRegistry?: ModelRegistry, _activeModel?: Model): Promise<Array<CustomTool<typeof imageGenSchema, ImageGenToolDetails>>>;
66
67
  export declare function getImageGenToolsWithRegistry(_modelRegistry: ModelRegistry, _activeModel?: Model): Promise<Array<CustomTool<typeof imageGenSchema, ImageGenToolDetails>>>;
67
- export {};
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Image Generation Providers
3
+ *
4
+ * Leaf module (no runtime deps) shared by the image_gen tool, the settings
5
+ * schema, and settings migrations — mirrors `web/search/types.ts` so the
6
+ * provider list, auto order, and settings choices never drift apart.
7
+ */
8
+ /** Image generation backends, in settings/tool vocabulary. */
9
+ export type ImageProvider = "antigravity" | "gemini" | "openai" | "openai-codex" | "openrouter" | "xai";
10
+ /** Auto-resolution fallback order when no configured entry or session provider matches. */
11
+ export declare const AUTO_IMAGE_PROVIDER_ORDER: readonly ImageProvider[];
12
+ /** Settings choices for `providers.imageOrder` (labels shared with the retired single-preference enum). */
13
+ export declare const IMAGE_PROVIDER_CHOICES: readonly [{
14
+ readonly value: "openai";
15
+ readonly label: "OpenAI";
16
+ readonly description: "OPENAI_API_KEY (gpt-image-2) or active GPT model; falls back to a connected Codex subscription";
17
+ }, {
18
+ readonly value: "openai-codex";
19
+ readonly label: "OpenAI Codex (ChatGPT)";
20
+ readonly description: "Uses a connected Codex / ChatGPT subscription — no OPENAI_API_KEY needed";
21
+ }, {
22
+ readonly value: "antigravity";
23
+ readonly label: "Antigravity";
24
+ readonly description: "Requires google-antigravity OAuth";
25
+ }, {
26
+ readonly value: "xai";
27
+ readonly label: "xAI Grok Imagine";
28
+ readonly description: "Requires xAI Grok OAuth or XAI_API_KEY";
29
+ }, {
30
+ readonly value: "gemini";
31
+ readonly label: "Gemini";
32
+ readonly description: "Requires GEMINI_API_KEY";
33
+ }, {
34
+ readonly value: "openrouter";
35
+ readonly label: "OpenRouter";
36
+ readonly description: "Requires OPENROUTER_API_KEY";
37
+ }];
38
+ export declare function isImageProviderId(value: unknown): value is ImageProvider;
@@ -13,11 +13,13 @@ import type { LocalProtocolOptions } from "../internal-urls/index.js";
13
13
  import type { MCPManager } from "../mcp/index.js";
14
14
  import type { MnemopiSessionState } from "../mnemopi/state.js";
15
15
  import type { PlanModeState } from "../plan-mode/state.js";
16
+ import type { AgentLifecycleManager } from "../registry/agent-lifecycle.js";
16
17
  import type { AgentRegistry } from "../registry/agent-registry.js";
17
18
  import type { ArtifactManager } from "../session/artifacts.js";
18
19
  import type { ClientBridge } from "../session/client-bridge.js";
19
20
  import type { CustomMessage } from "../session/messages.js";
20
21
  import type { UsageStatistics } from "../session/session-entries.js";
22
+ import type { SessionManager } from "../session/session-manager.js";
21
23
  import type { ToolChoiceQueue } from "../session/tool-choice-queue.js";
22
24
  import type { AgentOutputManager } from "../task/output-manager.js";
23
25
  import { type StructuredSubagentSchemaMode } from "../task/types.js";
@@ -105,6 +107,8 @@ export interface DeferredDiagnosticsEntry {
105
107
  export interface ToolSession {
106
108
  /** Current working directory */
107
109
  cwd: string;
110
+ /** Additional workspace directories beyond cwd (multi-root), forwarded to subagents. */
111
+ additionalDirectories?: string[];
108
112
  /** Whether UI is available */
109
113
  hasUI: boolean;
110
114
  /**
@@ -176,6 +180,8 @@ export interface ToolSession {
176
180
  getEvalSessionId?: () => string | null;
177
181
  /** Get session file */
178
182
  getSessionFile: () => string | null;
183
+ /** Parent session journal used by tools that persist runtime lifecycle state. */
184
+ sessionManager?: Pick<SessionManager, "appendCustomEntry" | "ensureOnDisk" | "flush" | "getBranch" | "getEntries">;
179
185
  /** Get eval kernel owner ID for session-scoped retained-kernel cleanup. */
180
186
  getEvalKernelOwnerId?: () => string | null;
181
187
  /** Reject new eval work once session disposal has started. */
@@ -200,6 +206,8 @@ export interface ToolSession {
200
206
  xdevRegistry?: XdevRegistry;
201
207
  /** Agent registry for IRC routing across live sessions. */
202
208
  agentRegistry?: AgentRegistry;
209
+ /** Idle→parked→revive lifecycle owner; lets the hub kill a non-job-backed agent registration. Default: AgentLifecycleManager.global(). */
210
+ agentLifecycle?: () => AgentLifecycleManager;
203
211
  /** Get artifacts directory for artifact:// URLs */
204
212
  getArtifactsDir?: () => string | null;
205
213
  /** Get the ArtifactManager backing this session (shared across parent + subagents). */
@@ -236,6 +236,14 @@ export declare function partitionExistingPaths(items: string[], cwd: string, spl
236
236
  basePath: string;
237
237
  }): Promise<PartitionedPaths>;
238
238
  export declare function resolveReadPath(filePath: string, cwd: string): string;
239
+ /**
240
+ * Find a unique workspace entry whose trailing path matches a missing authored path.
241
+ * Returns `null` for no match, ambiguity, timeout, or scan failure.
242
+ */
243
+ export declare function findUniqueWorkspaceSuffix(rawPath: string, cwd: string, signal?: AbortSignal): Promise<{
244
+ absolutePath: string;
245
+ displayPath: string;
246
+ } | null>;
239
247
  /** Local file materialized from a readable external URL for shared tool-scope resolution. */
240
248
  export interface ResolvedExternalSearchUrl {
241
249
  /** Absolute or cwd-relative file path to search. */
@@ -5,16 +5,21 @@
5
5
  * `xd://report_issue`, and the system prompt tells the model to write
6
6
  * `<tool>: <concise description>` there when auto-QA is enabled.
7
7
  *
8
- * Enabled by default; gated behind PI_AUTO_QA=1 / `dev.autoqa` so a user who
9
- * flips the setting off short-circuits injection entirely.
8
+ * Enabled by default (`dev.autoqa` defaults to true); `PI_AUTO_QA=0` or an
9
+ * explicit `dev.autoqa: false` short-circuits injection entirely. When the
10
+ * user is only enabled by default (never configured `dev.autoqa` themselves),
11
+ * a persisted `dev.autoqaConsent: "denied"` also disables injection so a "No"
12
+ * in the consent dialog fully turns the feature off.
10
13
  * Records grievances to a local SQLite database; never throws from the device
11
14
  * dispatch path.
12
15
  *
13
- * Before the first record lands, the user's consent is checked. If they've
14
- * never been asked (`dev.autoqaConsent === "unset"`) the process-global
15
- * consent handler — wired by `InteractiveMode` to a Yes/No popup — is invoked
16
- * exactly once and the decision is persisted. Subsequent calls (including from
17
- * subagents) read the cached decision without prompting.
16
+ * Nothing is written until consent resolves. If the user has never been asked
17
+ * (`dev.autoqaConsent === "unset"`) the process-global consent handler —
18
+ * wired by `InteractiveMode` to a Yes/No popup — is invoked exactly once and
19
+ * the decision is persisted; a denial (or dismissal) drops the pending report
20
+ * without touching the database. Subsequent calls (including from subagents)
21
+ * read the cached decision without prompting. `PI_AUTO_QA_PUSH=1` bypasses
22
+ * the dialog for headless environments.
18
23
  *
19
24
  * When the user grants consent, push is automatically active against the
20
25
  * bundled endpoint (`dev.autoqaPush.endpoint`, default `qa.omp.sh`). Each
@@ -42,6 +47,14 @@ export declare function isReportIssueToolCall(toolCall: {
42
47
  }): boolean;
43
48
  /** Call preview for an `xd://report_issue` write. */
44
49
  export declare function renderReportIssueDeviceCall(content: unknown, uiTheme: Theme): Component;
50
+ /**
51
+ * Whether Auto-QA is active for this session.
52
+ *
53
+ * Precedence: `PI_AUTO_QA` env flag > explicit `dev.autoqa` setting >
54
+ * default-on unless the user previously denied consent. The denial veto only
55
+ * applies to the default: explicitly configuring `dev.autoqa: true` re-enables
56
+ * injection (recording still no-ops until consent is granted).
57
+ */
45
58
  export declare function isAutoQaEnabled(settings?: Settings): boolean;
46
59
  /**
47
60
  * Resolver for the user's "share grievances?" consent.
@@ -82,8 +95,8 @@ export declare function __resetAutoQaConsentForTests(): void;
82
95
  export declare function resolveAutoQaConsent(settings: Settings | undefined): Promise<boolean>;
83
96
  /**
84
97
  * Open (or return the cached handle for) the auto-QA SQLite database at
85
- * `~/.omp/agent/autoqa.db`, creating the schema lazily. Returns `null` when
86
- * the agent data dir cannot be resolved.
98
+ * `~/.omp/autoqa.db` (XDG: `$XDG_DATA_HOME/omp/autoqa.db`), creating the
99
+ * schema lazily. Returns `null` when the path cannot be resolved or opened.
87
100
  */
88
101
  export declare function openAutoQaDb(): Database | null;
89
102
  export interface FlushResult {
@@ -127,6 +140,8 @@ export declare function __resetAutoQaFlushStateForTests(): void;
127
140
  * Flush queued grievances to the configured backend.
128
141
  */
129
142
  export declare function flushGrievances(db?: Database, settings?: Settings, options?: FlushOptions): Promise<FlushResult>;
143
+ /** Test-only: await the last consent → insert → flush pipeline. */
144
+ export declare function __awaitAutoQaRecordPipelineForTests(): Promise<void>;
130
145
  /**
131
146
  * Execute `write xd://report_issue`. `text` must be either:
132
147
  * - `<tool>: <concise description>` on one line, or
@@ -5,17 +5,21 @@ import type { RenderResultOptions } from "../extensibility/custom-tools/types.js
5
5
  import type { Theme } from "../modes/theme/theme.js";
6
6
  import type { ToolSession } from "../sdk.js";
7
7
  import type { SessionEntry } from "../session/session-entries.js";
8
- export type TodoStatus = "pending" | "in_progress" | "completed" | "abandoned";
8
+ export type TodoStatus = "pending" | "in_progress" | "completed" | "abandoned" | "blocked";
9
9
  /** Operation names accepted by the todo tool and echoed in successful result details. */
10
- export type TodoOperation = "init" | "start" | "done" | "rm" | "drop" | "append" | "view";
10
+ export type TodoOperation = "init" | "start" | "done" | "rm" | "drop" | "block" | "unblock" | "append" | "view";
11
11
  export interface TodoItem {
12
12
  content: string;
13
13
  status: TodoStatus;
14
+ /** When `status === "blocked"`, an optional note on what the task is waiting for. */
15
+ blocker?: string;
14
16
  }
15
17
  export interface TodoPhase {
16
18
  name: string;
17
19
  tasks: TodoItem[];
18
20
  }
21
+ /** Whether an unknown value is a persisted todo phase. */
22
+ export declare function isTodoPhase(value: unknown): value is TodoPhase;
19
23
  export interface TodoCompletionTransition {
20
24
  phase: string;
21
25
  content: string;
@@ -28,7 +32,7 @@ export interface TodoToolDetails {
28
32
  completedTasks?: TodoCompletionTransition[];
29
33
  }
30
34
  declare const todoSchema: import("arktype/internal/variants/object.ts").ObjectType<{
31
- op: "append" | "done" | "drop" | "init" | "rm" | "start" | "view";
35
+ op: "append" | "block" | "done" | "drop" | "init" | "rm" | "start" | "unblock" | "view";
32
36
  list?: {
33
37
  phase: string;
34
38
  items: string[];
@@ -36,6 +40,7 @@ declare const todoSchema: import("arktype/internal/variants/object.ts").ObjectTy
36
40
  task?: string | undefined;
37
41
  phase?: string | undefined;
38
42
  items?: string[] | undefined;
43
+ reason?: string | undefined;
39
44
  }, {}>;
40
45
  type TodoParams = TodoSchema;
41
46
  type TodoSchema = typeof todoSchema.infer;
@@ -107,7 +112,7 @@ export declare class TodoTool implements AgentTool<typeof todoSchema, TodoToolDe
107
112
  readonly summary = "Write a structured todo list to track progress within a session";
108
113
  readonly description: string;
109
114
  readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
110
- op: "append" | "done" | "drop" | "init" | "rm" | "start" | "view";
115
+ op: "append" | "block" | "done" | "drop" | "init" | "rm" | "start" | "unblock" | "view";
111
116
  list?: {
112
117
  phase: string;
113
118
  items: string[];
@@ -115,6 +120,7 @@ export declare class TodoTool implements AgentTool<typeof todoSchema, TodoToolDe
115
120
  task?: string | undefined;
116
121
  phase?: string | undefined;
117
122
  items?: string[] | undefined;
123
+ reason?: string | undefined;
118
124
  }, {}>;
119
125
  readonly concurrency = "exclusive";
120
126
  readonly strict = true;