@mono-agent/agent-app 0.20.11 → 0.21.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 (369) hide show
  1. package/README.md +260 -98
  2. package/dist/adapter-send-tools.d.ts +3 -2
  3. package/dist/adapter-send-tools.d.ts.map +1 -1
  4. package/dist/adapter-send-tools.js +15 -5
  5. package/dist/adapter-send-tools.js.map +1 -1
  6. package/dist/app-controller-channels.d.ts +6 -0
  7. package/dist/app-controller-channels.d.ts.map +1 -1
  8. package/dist/app-controller-channels.js +29 -2
  9. package/dist/app-controller-channels.js.map +1 -1
  10. package/dist/app-controller-continuation.d.ts.map +1 -1
  11. package/dist/app-controller-continuation.js +2 -3
  12. package/dist/app-controller-continuation.js.map +1 -1
  13. package/dist/app-controller-lifecycle.d.ts +4 -0
  14. package/dist/app-controller-lifecycle.d.ts.map +1 -1
  15. package/dist/app-controller-lifecycle.js +7 -0
  16. package/dist/app-controller-lifecycle.js.map +1 -1
  17. package/dist/app-controller-maintenance.d.ts +3 -1
  18. package/dist/app-controller-maintenance.d.ts.map +1 -1
  19. package/dist/app-controller-maintenance.js +3 -0
  20. package/dist/app-controller-maintenance.js.map +1 -1
  21. package/dist/app-controller-monitors.d.ts +26 -0
  22. package/dist/app-controller-monitors.d.ts.map +1 -0
  23. package/dist/app-controller-monitors.js +127 -0
  24. package/dist/app-controller-monitors.js.map +1 -0
  25. package/dist/app-controller-responder.d.ts +9 -17
  26. package/dist/app-controller-responder.d.ts.map +1 -1
  27. package/dist/app-controller-responder.js +54 -86
  28. package/dist/app-controller-responder.js.map +1 -1
  29. package/dist/app-controller-traceability.d.ts.map +1 -1
  30. package/dist/app-controller-traceability.js +3 -0
  31. package/dist/app-controller-traceability.js.map +1 -1
  32. package/dist/app-controller-types.d.ts +1 -0
  33. package/dist/app-controller-types.d.ts.map +1 -1
  34. package/dist/app-controller-utils.d.ts +1 -5
  35. package/dist/app-controller-utils.d.ts.map +1 -1
  36. package/dist/app-controller-utils.js +4 -21
  37. package/dist/app-controller-utils.js.map +1 -1
  38. package/dist/app-controller.d.ts +26 -10
  39. package/dist/app-controller.d.ts.map +1 -1
  40. package/dist/app-controller.js +39 -1
  41. package/dist/app-controller.js.map +1 -1
  42. package/dist/artifact-retention.js +11 -0
  43. package/dist/artifact-retention.js.map +1 -1
  44. package/dist/background.d.ts +0 -6
  45. package/dist/background.d.ts.map +1 -1
  46. package/dist/background.js +5 -58
  47. package/dist/background.js.map +1 -1
  48. package/dist/channel-drivers/slack.d.ts.map +1 -1
  49. package/dist/channel-drivers/slack.js +18 -0
  50. package/dist/channel-drivers/slack.js.map +1 -1
  51. package/dist/channel-drivers/telegram.d.ts.map +1 -1
  52. package/dist/channel-drivers/telegram.js +26 -0
  53. package/dist/channel-drivers/telegram.js.map +1 -1
  54. package/dist/channel-drivers/tui.d.ts +68 -8
  55. package/dist/channel-drivers/tui.d.ts.map +1 -1
  56. package/dist/channel-drivers/tui.js +407 -89
  57. package/dist/channel-drivers/tui.js.map +1 -1
  58. package/dist/channel-runtime-controls.d.ts +2 -1
  59. package/dist/channel-runtime-controls.d.ts.map +1 -1
  60. package/dist/channel-runtime-controls.js +79 -22
  61. package/dist/channel-runtime-controls.js.map +1 -1
  62. package/dist/cli-args.d.ts +5 -8
  63. package/dist/cli-args.d.ts.map +1 -1
  64. package/dist/cli-args.js +33 -52
  65. package/dist/cli-args.js.map +1 -1
  66. package/dist/cli-background-command.d.ts.map +1 -1
  67. package/dist/cli-background-command.js +4 -0
  68. package/dist/cli-background-command.js.map +1 -1
  69. package/dist/cli-commands.d.ts.map +1 -1
  70. package/dist/cli-commands.js +24 -2
  71. package/dist/cli-commands.js.map +1 -1
  72. package/dist/cli-help.d.ts +26 -0
  73. package/dist/cli-help.d.ts.map +1 -1
  74. package/dist/cli-help.js +58 -53
  75. package/dist/cli-help.js.map +1 -1
  76. package/dist/cli-init-command.d.ts +1 -2
  77. package/dist/cli-init-command.d.ts.map +1 -1
  78. package/dist/cli-init-command.js +31 -71
  79. package/dist/cli-init-command.js.map +1 -1
  80. package/dist/cli-install-skill-command.d.ts.map +1 -1
  81. package/dist/cli-install-skill-command.js +12 -3
  82. package/dist/cli-install-skill-command.js.map +1 -1
  83. package/dist/config-reference.d.ts +1 -0
  84. package/dist/config-reference.d.ts.map +1 -1
  85. package/dist/config-reference.js +217 -60
  86. package/dist/config-reference.js.map +1 -1
  87. package/dist/configured-agent.d.ts +27 -4
  88. package/dist/configured-agent.d.ts.map +1 -1
  89. package/dist/configured-agent.js +159 -112
  90. package/dist/configured-agent.js.map +1 -1
  91. package/dist/conversation-title.d.ts.map +1 -1
  92. package/dist/conversation-title.js +9 -2
  93. package/dist/conversation-title.js.map +1 -1
  94. package/dist/cron-control-store.d.ts.map +1 -1
  95. package/dist/cron-control-store.js +4 -2
  96. package/dist/cron-control-store.js.map +1 -1
  97. package/dist/doctor.d.ts +7 -13
  98. package/dist/doctor.d.ts.map +1 -1
  99. package/dist/doctor.js +406 -770
  100. package/dist/doctor.js.map +1 -1
  101. package/dist/first-run-readiness.d.ts.map +1 -1
  102. package/dist/first-run-readiness.js +0 -6
  103. package/dist/first-run-readiness.js.map +1 -1
  104. package/dist/index.d.ts +2 -0
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +1 -0
  107. package/dist/index.js.map +1 -1
  108. package/dist/interaction-bridge.d.ts +3 -3
  109. package/dist/interaction-bridge.d.ts.map +1 -1
  110. package/dist/interaction-bridge.js +27 -10
  111. package/dist/interaction-bridge.js.map +1 -1
  112. package/dist/launchd.d.ts +2 -0
  113. package/dist/launchd.d.ts.map +1 -1
  114. package/dist/launchd.js +3 -0
  115. package/dist/launchd.js.map +1 -1
  116. package/dist/local-tui-session.d.ts +14 -0
  117. package/dist/local-tui-session.d.ts.map +1 -0
  118. package/dist/local-tui-session.js +100 -0
  119. package/dist/local-tui-session.js.map +1 -0
  120. package/dist/mcp-apps.d.ts.map +1 -1
  121. package/dist/mcp-apps.js +3 -0
  122. package/dist/mcp-apps.js.map +1 -1
  123. package/dist/memory-journal.d.ts +53 -0
  124. package/dist/memory-journal.d.ts.map +1 -0
  125. package/dist/memory-journal.js +586 -0
  126. package/dist/memory-journal.js.map +1 -0
  127. package/dist/memory-recall.d.ts.map +1 -1
  128. package/dist/memory-recall.js +16 -2
  129. package/dist/memory-recall.js.map +1 -1
  130. package/dist/memory-remember.d.ts +49 -0
  131. package/dist/memory-remember.d.ts.map +1 -0
  132. package/dist/memory-remember.js +190 -0
  133. package/dist/memory-remember.js.map +1 -0
  134. package/dist/memory-retrieval.d.ts +33 -0
  135. package/dist/memory-retrieval.d.ts.map +1 -1
  136. package/dist/memory-retrieval.js +43 -0
  137. package/dist/memory-retrieval.js.map +1 -1
  138. package/dist/model-effort-capabilities.d.ts +8 -9
  139. package/dist/model-effort-capabilities.d.ts.map +1 -1
  140. package/dist/model-effort-capabilities.js +17 -35
  141. package/dist/model-effort-capabilities.js.map +1 -1
  142. package/dist/modules/base.d.ts +3 -4
  143. package/dist/modules/base.d.ts.map +1 -1
  144. package/dist/modules/base.js +4 -6
  145. package/dist/modules/base.js.map +1 -1
  146. package/dist/modules/catalog.d.ts.map +1 -1
  147. package/dist/modules/catalog.js +11 -9
  148. package/dist/modules/catalog.js.map +1 -1
  149. package/dist/modules/known-tools.d.ts +2 -2
  150. package/dist/modules/known-tools.d.ts.map +1 -1
  151. package/dist/modules/known-tools.js +7 -0
  152. package/dist/modules/known-tools.js.map +1 -1
  153. package/dist/monitor-channel-routing.d.ts +20 -0
  154. package/dist/monitor-channel-routing.d.ts.map +1 -0
  155. package/dist/monitor-channel-routing.js +73 -0
  156. package/dist/monitor-channel-routing.js.map +1 -0
  157. package/dist/monitors-command.d.ts +23 -0
  158. package/dist/monitors-command.d.ts.map +1 -0
  159. package/dist/monitors-command.js +217 -0
  160. package/dist/monitors-command.js.map +1 -0
  161. package/dist/monitors-config.d.ts +77 -0
  162. package/dist/monitors-config.d.ts.map +1 -0
  163. package/dist/monitors-config.js +150 -0
  164. package/dist/monitors-config.js.map +1 -0
  165. package/dist/monitors-context.d.ts +58 -0
  166. package/dist/monitors-context.d.ts.map +1 -0
  167. package/dist/monitors-context.js +194 -0
  168. package/dist/monitors-context.js.map +1 -0
  169. package/dist/monitors-runtime.d.ts +36 -0
  170. package/dist/monitors-runtime.d.ts.map +1 -0
  171. package/dist/monitors-runtime.js +103 -0
  172. package/dist/monitors-runtime.js.map +1 -0
  173. package/dist/monitors-service.d.ts +71 -0
  174. package/dist/monitors-service.d.ts.map +1 -0
  175. package/dist/monitors-service.js +1796 -0
  176. package/dist/monitors-service.js.map +1 -0
  177. package/dist/monitors-store.d.ts +93 -0
  178. package/dist/monitors-store.d.ts.map +1 -0
  179. package/dist/monitors-store.js +313 -0
  180. package/dist/monitors-store.js.map +1 -0
  181. package/dist/notify-destinations.d.ts +3 -2
  182. package/dist/notify-destinations.d.ts.map +1 -1
  183. package/dist/notify-destinations.js +6 -7
  184. package/dist/notify-destinations.js.map +1 -1
  185. package/dist/posted-reply-history.d.ts.map +1 -1
  186. package/dist/posted-reply-history.js +40 -3
  187. package/dist/posted-reply-history.js.map +1 -1
  188. package/dist/proactive-notify.d.ts +20 -1
  189. package/dist/proactive-notify.d.ts.map +1 -1
  190. package/dist/proactive-notify.js +56 -3
  191. package/dist/proactive-notify.js.map +1 -1
  192. package/dist/process-job-channel-routing.js +2 -1
  193. package/dist/process-job-channel-routing.js.map +1 -1
  194. package/dist/process-job-output-tail.d.ts +53 -0
  195. package/dist/process-job-output-tail.d.ts.map +1 -0
  196. package/dist/process-job-output-tail.js +257 -0
  197. package/dist/process-job-output-tail.js.map +1 -0
  198. package/dist/process-jobs-config.d.ts +1 -1
  199. package/dist/process-jobs-config.js +1 -1
  200. package/dist/process-jobs-config.js.map +1 -1
  201. package/dist/process-jobs-context.d.ts +11 -1
  202. package/dist/process-jobs-context.d.ts.map +1 -1
  203. package/dist/process-jobs-context.js +55 -11
  204. package/dist/process-jobs-context.js.map +1 -1
  205. package/dist/process-jobs-protection.js +1 -1
  206. package/dist/process-jobs-protection.js.map +1 -1
  207. package/dist/process-jobs-runtime.d.ts.map +1 -1
  208. package/dist/process-jobs-runtime.js +15 -12
  209. package/dist/process-jobs-runtime.js.map +1 -1
  210. package/dist/process-jobs-service.d.ts.map +1 -1
  211. package/dist/process-jobs-service.js +118 -172
  212. package/dist/process-jobs-service.js.map +1 -1
  213. package/dist/process-jobs-store.d.ts +3 -1
  214. package/dist/process-jobs-store.d.ts.map +1 -1
  215. package/dist/process-jobs-store.js +4 -1
  216. package/dist/process-jobs-store.js.map +1 -1
  217. package/dist/process-output-redaction.d.ts +58 -0
  218. package/dist/process-output-redaction.d.ts.map +1 -0
  219. package/dist/process-output-redaction.js +311 -0
  220. package/dist/process-output-redaction.js.map +1 -0
  221. package/dist/project-skills.d.ts +11 -5
  222. package/dist/project-skills.d.ts.map +1 -1
  223. package/dist/project-skills.js +88 -39
  224. package/dist/project-skills.js.map +1 -1
  225. package/dist/provider-auth-checks.d.ts +27 -0
  226. package/dist/provider-auth-checks.d.ts.map +1 -0
  227. package/dist/provider-auth-checks.js +349 -0
  228. package/dist/provider-auth-checks.js.map +1 -0
  229. package/dist/provider-auth-observations.d.ts +22 -0
  230. package/dist/provider-auth-observations.d.ts.map +1 -0
  231. package/dist/provider-auth-observations.js +139 -0
  232. package/dist/provider-auth-observations.js.map +1 -0
  233. package/dist/provider-auth-operator.d.ts +19 -0
  234. package/dist/provider-auth-operator.d.ts.map +1 -0
  235. package/dist/provider-auth-operator.js +560 -0
  236. package/dist/provider-auth-operator.js.map +1 -0
  237. package/dist/provider-auth-status.d.ts +20 -0
  238. package/dist/provider-auth-status.d.ts.map +1 -0
  239. package/dist/provider-auth-status.js +235 -0
  240. package/dist/provider-auth-status.js.map +1 -0
  241. package/dist/provider-model-catalog.d.ts +95 -0
  242. package/dist/provider-model-catalog.d.ts.map +1 -0
  243. package/dist/provider-model-catalog.js +550 -0
  244. package/dist/provider-model-catalog.js.map +1 -0
  245. package/dist/provider-setup.d.ts +26 -13
  246. package/dist/provider-setup.d.ts.map +1 -1
  247. package/dist/provider-setup.js +106 -130
  248. package/dist/provider-setup.js.map +1 -1
  249. package/dist/readiness-probe-worker.d.ts +1 -2
  250. package/dist/readiness-probe-worker.d.ts.map +1 -1
  251. package/dist/readiness-probe-worker.js +3 -8
  252. package/dist/readiness-probe-worker.js.map +1 -1
  253. package/dist/readiness-probe.d.ts +1 -1
  254. package/dist/readiness-probe.d.ts.map +1 -1
  255. package/dist/readiness-probe.js +3 -33
  256. package/dist/readiness-probe.js.map +1 -1
  257. package/dist/reply-artifacts.d.ts +3 -1
  258. package/dist/reply-artifacts.d.ts.map +1 -1
  259. package/dist/reply-artifacts.js +45 -10
  260. package/dist/reply-artifacts.js.map +1 -1
  261. package/dist/request-model-override.d.ts +14 -37
  262. package/dist/request-model-override.d.ts.map +1 -1
  263. package/dist/request-model-override.js +105 -143
  264. package/dist/request-model-override.js.map +1 -1
  265. package/dist/request-scoped-mcp.d.ts +3 -0
  266. package/dist/request-scoped-mcp.d.ts.map +1 -1
  267. package/dist/request-scoped-mcp.js +1 -1
  268. package/dist/request-scoped-mcp.js.map +1 -1
  269. package/dist/run-history.d.ts.map +1 -1
  270. package/dist/run-history.js +56 -13
  271. package/dist/run-history.js.map +1 -1
  272. package/dist/runtime-option-extensions.d.ts +2 -4
  273. package/dist/runtime-option-extensions.d.ts.map +1 -1
  274. package/dist/runtime-option-extensions.js +4 -8
  275. package/dist/runtime-option-extensions.js.map +1 -1
  276. package/dist/runtime-routes.d.ts +5 -5
  277. package/dist/runtime-routes.d.ts.map +1 -1
  278. package/dist/runtime-routes.js +29 -18
  279. package/dist/runtime-routes.js.map +1 -1
  280. package/dist/sandbox-settings-cleanup.d.ts +15 -0
  281. package/dist/sandbox-settings-cleanup.d.ts.map +1 -0
  282. package/dist/sandbox-settings-cleanup.js +88 -0
  283. package/dist/sandbox-settings-cleanup.js.map +1 -0
  284. package/dist/seen-conversations.d.ts +4 -3
  285. package/dist/seen-conversations.d.ts.map +1 -1
  286. package/dist/seen-conversations.js +6 -5
  287. package/dist/seen-conversations.js.map +1 -1
  288. package/dist/session-history.d.ts +14 -0
  289. package/dist/session-history.d.ts.map +1 -1
  290. package/dist/session-history.js +120 -5
  291. package/dist/session-history.js.map +1 -1
  292. package/dist/systemd-command.d.ts +8 -0
  293. package/dist/systemd-command.d.ts.map +1 -0
  294. package/dist/systemd-command.js +206 -0
  295. package/dist/systemd-command.js.map +1 -0
  296. package/dist/systemd.d.ts +51 -0
  297. package/dist/systemd.d.ts.map +1 -0
  298. package/dist/systemd.js +299 -0
  299. package/dist/systemd.js.map +1 -0
  300. package/dist/tool-output-artifacts.d.ts +4 -0
  301. package/dist/tool-output-artifacts.d.ts.map +1 -0
  302. package/dist/tool-output-artifacts.js +17 -0
  303. package/dist/tool-output-artifacts.js.map +1 -0
  304. package/dist/trigger-overrides.d.ts +6 -0
  305. package/dist/trigger-overrides.d.ts.map +1 -1
  306. package/dist/trigger-overrides.js +36 -4
  307. package/dist/trigger-overrides.js.map +1 -1
  308. package/dist/tui-command.d.ts +0 -45
  309. package/dist/tui-command.d.ts.map +1 -1
  310. package/dist/tui-command.js +27 -264
  311. package/dist/tui-command.js.map +1 -1
  312. package/dist/untrusted-text.d.ts +36 -0
  313. package/dist/untrusted-text.d.ts.map +1 -0
  314. package/dist/untrusted-text.js +150 -0
  315. package/dist/untrusted-text.js.map +1 -0
  316. package/dist/web-command.d.ts +3 -0
  317. package/dist/web-command.d.ts.map +1 -1
  318. package/dist/web-command.js +112 -7
  319. package/dist/web-command.js.map +1 -1
  320. package/dist/web-request-coordinator.d.ts +19 -0
  321. package/dist/web-request-coordinator.d.ts.map +1 -0
  322. package/dist/web-request-coordinator.js +242 -0
  323. package/dist/web-request-coordinator.js.map +1 -0
  324. package/dist/wizard/answers.d.ts +3 -9
  325. package/dist/wizard/answers.d.ts.map +1 -1
  326. package/dist/wizard/answers.js +11 -36
  327. package/dist/wizard/answers.js.map +1 -1
  328. package/dist/wizard/from-flags.d.ts +1 -2
  329. package/dist/wizard/from-flags.d.ts.map +1 -1
  330. package/dist/wizard/from-flags.js +8 -3
  331. package/dist/wizard/from-flags.js.map +1 -1
  332. package/dist/wizard/model-discovery.d.ts +7 -8
  333. package/dist/wizard/model-discovery.d.ts.map +1 -1
  334. package/dist/wizard/model-discovery.js +58 -431
  335. package/dist/wizard/model-discovery.js.map +1 -1
  336. package/dist/wizard/presets.js +2 -2
  337. package/dist/wizard/presets.js.map +1 -1
  338. package/dist/wizard/prompts.d.ts +13 -12
  339. package/dist/wizard/prompts.d.ts.map +1 -1
  340. package/dist/wizard/prompts.js +25 -45
  341. package/dist/wizard/prompts.js.map +1 -1
  342. package/dist/wizard/run.d.ts.map +1 -1
  343. package/dist/wizard/run.js +30 -153
  344. package/dist/wizard/run.js.map +1 -1
  345. package/package.json +18 -18
  346. package/schema/mono-agent.config.schema.json +301 -53
  347. package/skills/mono-agent-composer/SKILL.md +5 -5
  348. package/skills/mono-agent-composer/references/config-blueprint.md +61 -47
  349. package/skills/mono-agent-composer/references/discovery-questions.md +18 -18
  350. package/skills/mono-agent-composer/references/feature-coverage.md +39 -21
  351. package/skills/mono-agent-composer/references/package-map.md +26 -17
  352. package/skills/mono-agent-composer/references/playbooks.md +39 -28
  353. package/skills/mono-agent-composer/references/validation.md +4 -3
  354. package/dist/codex-model-catalog.d.ts +0 -15
  355. package/dist/codex-model-catalog.d.ts.map +0 -1
  356. package/dist/codex-model-catalog.js +0 -220
  357. package/dist/codex-model-catalog.js.map +0 -1
  358. package/dist/configuration-proposal-main.d.ts +0 -3
  359. package/dist/configuration-proposal-main.d.ts.map +0 -1
  360. package/dist/configuration-proposal-main.js +0 -13
  361. package/dist/configuration-proposal-main.js.map +0 -1
  362. package/dist/configuration-proposal-tool.d.ts +0 -33
  363. package/dist/configuration-proposal-tool.d.ts.map +0 -1
  364. package/dist/configuration-proposal-tool.js +0 -188
  365. package/dist/configuration-proposal-tool.js.map +0 -1
  366. package/dist/local-configuration.d.ts +0 -99
  367. package/dist/local-configuration.d.ts.map +0 -1
  368. package/dist/local-configuration.js +0 -1330
  369. package/dist/local-configuration.js.map +0 -1
@@ -1,4 +1,5 @@
1
- import { createAgentHarness, createAgentResponder, acquireToolHistoryWriter, createDurableHistoryStore, createToolPolicy, loadToolPolicyFromJsonFileSync, renderSkillIndexSection, ToolHistoryReader, toolHistoryLogicalConversationId, } from "@mono-agent/agent-harness";
1
+ import { createHostWebRequestCoordinator } from "./web-request-coordinator.js";
2
+ import { createAgentHarness, createSessionRuntimeResolver, createAgentResponder, acquireToolHistoryWriter, createDurableHistoryStore, createToolPolicy, loadToolPolicyFromJsonFileSync, renderSkillIndexSection, ToolHistoryReader, toolHistoryLogicalConversationId, } from "@mono-agent/agent-harness";
2
3
  import { readFileSync } from "node:fs";
3
4
  import { homedir } from "node:os";
4
5
  import { resolve as resolvePath } from "node:path";
@@ -6,17 +7,22 @@ import { setToolActivityPathRoots } from "@mono-agent/agent-contracts";
6
7
  import { resolveSupermemoryContainer } from "@mono-agent/config";
7
8
  import { createCompositeRunRecorder, createJsonlRunRecorder } from "@mono-agent/observability";
8
9
  import { createPhoenixRunExporter } from "@mono-agent/observability/otel";
9
- import { assertExecutionModeCompatible, createMonoRuntime, createPiOAuthApiKeyResolver, createSrtSandboxEngine, defaultExecutionModeForModel, describeMonoRuntimeSupport, modelReferenceKey, monoRuntimeSupportsSessionResume, parseMonoRuntimeModelReference, runtimeOptionsForLocalProvider, mergeSandboxPolicies, } from "@mono-agent/runtime-adapter";
10
+ import { createMonoRuntime, createPiOAuthApiKeyResolver, createSrtSandboxEngine, describeMonoRuntimeSupport, modelReferenceKey, monoRuntimeSupportsSessionResume, parseMonoRuntimeModelReference, runtimeOptionsForLocalProvider, mergeSandboxPolicies, } from "@mono-agent/runtime-adapter";
10
11
  import { agentArtifactDerivedRoots } from "./agent-artifact-paths.js";
12
+ import { createToolOutputArtifactsRuntimeExtension } from "./tool-output-artifacts.js";
11
13
  import { acquireAgentRootOwnership, assertAgentRootLeaseOutsideWorkspace, releaseAgentRootOwnershipWhenIdle, } from "./agent-root-coordinator.js";
12
14
  import { resolveMemoryRecallSettings } from "./memory-recall.js";
15
+ import { createMemoryJournalRuntimeExtension, isMemoryJournalCapableStore, isMemoryJournalToolAllowed, } from "./memory-journal.js";
13
16
  import { BUILTIN_TOOL_NAMES, canonicalToolName, isAllowAllTools } from "./modules/known-tools.js";
14
17
  import { createSharedMemoryRecallRuntimeExtension, isSharedRecallStore, MemoryRetrievalService, } from "./memory-retrieval.js";
18
+ import { createMemoryRememberRuntimeExtension, isRememberCapableStore, isRememberToolAllowed, } from "./memory-remember.js";
15
19
  import { clearSessionsSandboxPolicy, composeRuntimeOptionExtensions, createClearSessionsRuntimeExtension, } from "./runtime-option-extensions.js";
16
20
  import { configuredRuntimeFallbackModels, runtimeUsesFallbackRouter, } from "./runtime-routes.js";
17
21
  import { resolveProcessJobsProtectionPosture, } from "./process-jobs-protection.js";
22
+ import { createMonitorsRuntimeExtension, monitorsAvailableForRequest } from "./monitors-runtime.js";
18
23
  import { createProcessJobsRuntimeExtension, processJobsAvailableForRequest, processJobsSandboxPolicy, PROCESS_JOBS_PI_NATIVE_REQUIRED_ERROR, PROCESS_JOBS_PROTECTION_UNAVAILABLE_ERROR, } from "./process-jobs-runtime.js";
19
24
  import { attestProcessJobsRootRegistrySnapshot, loadProcessJobsRootRegistryProtection, processJobsProtectionPolicyRoots, registerProcessJobsRoot, } from "./process-jobs-root-registry.js";
25
+ import { activeProjectSkillSelections, isRetiredProjectSkillName } from "./project-skills.js";
20
26
  import { isReadSkillDenied } from "./skill-registry.js";
21
27
  import { loadSupermemoryPlugin } from "./supermemory-plugin.js";
22
28
  /**
@@ -81,12 +87,17 @@ function withArtifactCommitHook(recorder, onCommitted, args) {
81
87
  return recorder;
82
88
  }
83
89
  let terminalPromise;
84
- const notify = (phase) => {
90
+ const notify = (phase, summary) => {
85
91
  try {
86
92
  // The cache invalidation used by the app is synchronous. Promise.resolve
87
93
  // also contains an async implementation without delaying
88
94
  // the JSONL/export pipeline or leaking an unhandled rejection.
89
- void Promise.resolve(onCommitted({ phase, runId: args.runId, conversationId: args.conversationId }))
95
+ void Promise.resolve(onCommitted({
96
+ phase,
97
+ runId: args.runId,
98
+ conversationId: args.conversationId,
99
+ ...(summary === undefined ? {} : { summary }),
100
+ }))
90
101
  .catch(() => undefined);
91
102
  }
92
103
  catch {
@@ -95,7 +106,7 @@ function withArtifactCommitHook(recorder, onCommitted, args) {
95
106
  };
96
107
  const commitTerminal = (operation) => {
97
108
  terminalPromise ??= operation().then((summary) => {
98
- notify("finished");
109
+ notify("finished", summary);
99
110
  return summary;
100
111
  });
101
112
  return terminalPromise;
@@ -116,8 +127,10 @@ function withArtifactCommitHook(recorder, onCommitted, args) {
116
127
  await wrapped.prepareFinish?.(result);
117
128
  return await wrapped.commitFinish(result);
118
129
  },
119
- async fail(error) {
120
- return await commitTerminal(async () => await recorder.fail(error));
130
+ async fail(error, context) {
131
+ return await commitTerminal(async () => context === undefined
132
+ ? await recorder.fail(error)
133
+ : await recorder.fail(error, context));
121
134
  },
122
135
  };
123
136
  if (recorder.start !== undefined) {
@@ -166,7 +179,7 @@ function createConfiguredAgentRuntimeBase(config, options, suppressSandboxEngine
166
179
  const fallback = fallbackChainForConfig(config, options);
167
180
  const sandboxEngine = suppressSandboxEngine
168
181
  ? undefined
169
- : configuredSandboxEngine(config, options?.model ?? config.runtime.model, options?.sandboxEngine);
182
+ : configuredSandboxEngine(options?.sandboxEngine);
170
183
  const runtimeOptions = {
171
184
  ...runtimeHostOptionsForConfig(config),
172
185
  ...(sandboxEngine === undefined ? {} : { sandboxEngine }),
@@ -174,7 +187,6 @@ function createConfiguredAgentRuntimeBase(config, options, suppressSandboxEngine
174
187
  ...(fallback.fallbackChain === undefined
175
188
  ? {}
176
189
  : {
177
- routeSafety: config.runtime.routeSafety ?? "uniform",
178
190
  ...(config.runtime.retry === undefined
179
191
  ? {}
180
192
  : {
@@ -193,13 +205,8 @@ function createConfiguredAgentRuntimeBase(config, options, suppressSandboxEngine
193
205
  };
194
206
  return createMonoRuntime(runtimeOptions);
195
207
  }
196
- function configuredSandboxEngine(config, primaryModel, explicit) {
197
- if (explicit !== undefined)
198
- return explicit;
199
- return [primaryModel, ...configuredRuntimeFallbackModels(config.runtime)]
200
- .some((model) => model.sdk === "pi")
201
- ? createSrtSandboxEngine()
202
- : undefined;
208
+ function configuredSandboxEngine(explicit) {
209
+ return explicit ?? createSrtSandboxEngine();
203
210
  }
204
211
  function wrapOwnedConfiguredRuntime(runtime, config, agentRoot, configuredSandboxEngine) {
205
212
  let security;
@@ -246,9 +253,6 @@ function wrapOwnedConfiguredRuntime(runtime, config, agentRoot, configuredSandbo
246
253
  if (!verdict.ok) {
247
254
  throw new Error(`${PROCESS_JOBS_PI_NATIVE_REQUIRED_ERROR} Rejected the configured runtime chain: ${verdict.reason}.`);
248
255
  }
249
- if (runOptions.model.sdk !== "pi") {
250
- throw new Error(`${PROCESS_JOBS_PI_NATIVE_REQUIRED_ERROR} The configured runtime route ${modelReferenceKey(runOptions.model)} is not Pi-native.`);
251
- }
252
256
  const sandboxEngine = runOptions.sandboxEngine
253
257
  ?? configuredSandboxEngine
254
258
  ?? createSrtSandboxEngine();
@@ -362,9 +366,9 @@ function inlineSubagentCeiling(config) {
362
366
  * Fails closed: an unparseable or incompatible route means no skills, never a
363
367
  * throw from what is otherwise a plain forwarding decision.
364
368
  */
365
- function childRuntimeSupportsSkills(model, executionMode) {
369
+ function childRuntimeSupportsSkills(model) {
366
370
  try {
367
- const support = describeMonoRuntimeSupport(model, executionMode);
371
+ const support = describeMonoRuntimeSupport(model);
368
372
  return support.backend?.capabilities.supports_skills !== false;
369
373
  }
370
374
  catch {
@@ -422,11 +426,8 @@ function subagentsRuntimeOptions(config, deps) {
422
426
  const childModel = overrides
423
427
  ? request.definition.model
424
428
  : deps.baseModel;
425
- const childExecutionMode = overrides
426
- ? defaultExecutionModeForModel(childModel)
427
- : deps.baseExecutionMode;
428
429
  const runtime = overrides && deps.runtimeForModel !== undefined
429
- ? deps.runtimeForModel(childModel, childExecutionMode)
430
+ ? deps.runtimeForModel(childModel)
430
431
  : deps.runtime;
431
432
  // Whether this child may inherit the parent's skill index. Decided here
432
433
  // because this is the only layer holding all four inputs: the offered
@@ -438,7 +439,7 @@ function subagentsRuntimeOptions(config, deps) {
438
439
  && (request.skills?.length ?? 0) > 0
439
440
  && !skillsDeniedGlobally
440
441
  && !profileDeniesSkills
441
- && childRuntimeSupportsSkills(childModel, childExecutionMode)
442
+ && childRuntimeSupportsSkills(childModel)
442
443
  ? request.skills
443
444
  : undefined;
444
445
  // Appended, not prepended: the parent's own context orders these as
@@ -448,14 +449,8 @@ function subagentsRuntimeOptions(config, deps) {
448
449
  const childSystemPrompt = childSkills === undefined
449
450
  ? request.systemPrompt
450
451
  : `${request.systemPrompt}\n\n${renderSkillIndexSection(childSkills)}`;
451
- if (childModel.sdk !== "pi"
452
- && (deps.processJobsProtectionPosture.requiresPiNative
453
- || sandboxPolicyCarriesProtectedRoots(request.sandboxPolicy))) {
454
- throw new Error(`${PROCESS_JOBS_PI_NATIVE_REQUIRED_ERROR} The Agent child route ${modelReferenceKey(childModel)} is not Pi-native.`);
455
- }
456
452
  return await runtime.run(childSystemPrompt, {
457
453
  model: childModel,
458
- executionMode: childExecutionMode,
459
454
  messages: [{ role: "user", content: request.prompt }],
460
455
  maxTurns: request.maxTurns,
461
456
  ...(request.cwd === undefined ? {} : { cwd: request.cwd }),
@@ -472,6 +467,7 @@ function subagentsRuntimeOptions(config, deps) {
472
467
  // milliseconds. The parent keeps working, so the degradation is invisible
473
468
  // until you read the child's activity log.
474
469
  ...(config.tools.web?.search === undefined ? {} : { webSearchConfig: config.tools.web.search }),
470
+ ...(config.tools.web?.coordination === "host" ? { webRequestCoordinator: createHostWebRequestCoordinator() } : {}),
475
471
  ...(config.tools.web?.fetch === undefined ? {} : { webFetchConfig: config.tools.web.fetch }),
476
472
  // Both keys or neither: pi-bridge builds ReadSkill only when it has the
477
473
  // names AND the root, and a half-set pair fails by silently omitting the
@@ -511,61 +507,49 @@ function subagentsRuntimeOptions(config, deps) {
511
507
  }
512
508
  /**
513
509
  * When backup models are configured, runs go through the agent-runtime fallback
514
- * router with the effective primary model first. Fallback entries use their
515
- * default execution mode.
510
+ * router with the effective primary model first.
516
511
  */
517
512
  function fallbackChainForConfig(config, options) {
518
513
  const canonicalFallbacks = config.runtime.fallbacks;
519
- const legacyFallbackModels = config.runtime.fallbackModels;
520
514
  // The loader always materializes `retry`, but this package is published and
521
515
  // `createConfiguredAgentRuntime` accepts a caller-built MonoAgentConfig — an
522
516
  // older hand-built object must degrade to single-shot, not crash.
523
517
  const primaryAttempts = config.runtime.retry?.primaryAttempts ?? 1;
524
- if ((canonicalFallbacks?.length ?? 0) === 0 && (legacyFallbackModels?.length ?? 0) === 0) {
518
+ if ((canonicalFallbacks?.length ?? 0) === 0) {
525
519
  // Without a chain `createMonoRuntime` takes the plain `createRuntime` path
526
520
  // and the router never runs — so same-model retries would silently do
527
521
  // nothing for every agent with no configured backups. Build a retry-only
528
522
  // single-entry chain instead whenever the primary asks for more than one
529
- // attempt. `hasConfiguredFallback` deliberately stays false for this shape,
530
- // keeping `sessionOptions.supportsResume` true: the router only drops the
531
- // provider session on the retry itself (retryIndex > 0).
523
+ // attempt. Both retry-only and multi-entry chains keep sessions on the
524
+ // primary's first attempt; the router makes later attempts stateless.
532
525
  if (primaryAttempts <= 1) {
533
526
  return {};
534
527
  }
535
528
  return {
536
529
  fallbackChain: [{
537
530
  model: options?.model ?? config.runtime.model,
538
- executionMode: (options?.executionMode ?? config.runtime.executionMode),
539
531
  attempts: primaryAttempts,
540
532
  }],
541
533
  };
542
534
  }
543
535
  const primaryModel = options?.model ?? config.runtime.model;
544
- const primaryExecutionMode = options?.executionMode ?? config.runtime.executionMode;
545
536
  // Drop any fallback equal to the primary so a per-trigger override that happens
546
537
  // to match a configured backup is not retried against itself before advancing.
547
538
  const primaryKey = modelReferenceKey(primaryModel);
548
- const canonicalFallbackEntries = canonicalFallbacks ?? [];
549
- const fallbackEntries = canonicalFallbackEntries.length > 0
550
- ? canonicalFallbackEntries
551
- .filter((entry) => modelReferenceKey(entry.model) !== primaryKey)
552
- .map((entry) => ({
553
- model: entry.model,
554
- // Canonical omission means provider default. Legacy fallbackModels
555
- // omit this field and therefore continue inheriting runtime.effort.
556
- effort: entry.effort ?? null,
557
- // Omitted per-route attempts stay single-shot: only the primary
558
- // retries unless a backup opts in explicitly.
559
- ...(entry.attempts === undefined ? {} : { attempts: entry.attempts }),
560
- }))
561
- : (legacyFallbackModels ?? [])
562
- .filter((model) => modelReferenceKey(model) !== primaryKey)
563
- .map((model) => ({ model }));
539
+ const fallbackEntries = (canonicalFallbacks ?? [])
540
+ .filter((entry) => modelReferenceKey(entry.model) !== primaryKey)
541
+ .map((entry) => ({
542
+ model: entry.model,
543
+ // Canonical omission means provider default.
544
+ effort: entry.effort ?? null,
545
+ // Omitted per-route attempts stay single-shot: only the primary
546
+ // retries unless a backup opts in explicitly.
547
+ ...(entry.attempts === undefined ? {} : { attempts: entry.attempts }),
548
+ }));
564
549
  return {
565
550
  fallbackChain: [
566
551
  {
567
552
  model: primaryModel,
568
- executionMode: primaryExecutionMode,
569
553
  ...(primaryAttempts > 1 ? { attempts: primaryAttempts } : {}),
570
554
  },
571
555
  ...fallbackEntries,
@@ -587,21 +571,7 @@ function configuredRoutesOnlyPiNative(config, primary) {
587
571
  if (routes.length === 0) {
588
572
  return { ok: false, reason: "the configured route chain is empty" };
589
573
  }
590
- const nonPi = routes.filter((model) => model.sdk !== "pi");
591
- return nonPi.length === 0
592
- ? { ok: true }
593
- : { ok: false, reason: `non-Pi routes are reachable: ${nonPi.map(modelReferenceKey).join(", ")}` };
594
- }
595
- function sandboxPolicyCarriesProtectedRoots(policy) {
596
- if (policy === undefined || policy === null || typeof policy !== "object")
597
- return false;
598
- try {
599
- const roots = policy.protectedRoots;
600
- return roots !== undefined && (!Array.isArray(roots) || roots.length > 0);
601
- }
602
- catch {
603
- return true;
604
- }
574
+ return { ok: true };
605
575
  }
606
576
  let memoryBujoModule;
607
577
  let memorySearchModule;
@@ -645,11 +615,10 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
645
615
  // supervisor started it in — and tool previews expose the full machine layout.
646
616
  setToolActivityPathRoots({ workspaceRoot: config.runtime.workspace, homeDir: homedir() });
647
617
  const model = options.model ?? config.runtime.model;
648
- const executionMode = options.executionMode ?? config.runtime.executionMode;
649
618
  const fallbackModels = configuredRuntimeFallbackModels(config.runtime);
650
619
  const sandboxEngine = processJobsProtectionPosture.suppressSyntheticSandbox
651
620
  ? undefined
652
- : configuredSandboxEngine(config, model, options.sandboxEngine);
621
+ : configuredSandboxEngine(options.sandboxEngine);
653
622
  const harnessSandboxPolicy = processJobsProtectionPosture.suppressSyntheticSandbox
654
623
  ? config.sandbox
655
624
  : processJobsProtectedRoots.length === 0
@@ -659,11 +628,15 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
659
628
  config,
660
629
  cwd: agentRoot,
661
630
  model,
662
- executionMode,
663
631
  ...(sandboxEngine === undefined ? {} : { sandboxEngine }),
664
632
  }, {
665
633
  suppressSandboxEngine: processJobsProtectionPosture.suppressSyntheticSandbox,
666
634
  });
635
+ const runtimeForSession = createSessionRuntimeResolver({ runtime, model,
636
+ ...(options.runtimeForModel === undefined ? {} : { runtimeForModel: options.runtimeForModel }),
637
+ });
638
+ const runtimeForModel = options.runtimeForModel === undefined ? undefined
639
+ : (target) => runtimeForSession(modelReferenceKey(target));
667
640
  const clearSessionsBoundaryOptions = {
668
641
  cwd: agentRoot,
669
642
  workspace: config.runtime.workspace,
@@ -694,7 +667,8 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
694
667
  // fallback-free runtime when no `memoryRuntime` is injected.
695
668
  const configuredMemory = options.memory ?? (await createConfiguredMemoryInternal(config, { cwd: agentRoot }, processJobsProtectionPosture));
696
669
  const memory = configuredMemoryForHarness(config, configuredMemory);
697
- const memoryRecall = resolveMemoryRecallSettings(config) === undefined
670
+ const memoryReadToolsEnabled = resolveMemoryRecallSettings(config) !== undefined;
671
+ const memoryRecall = !memoryReadToolsEnabled
698
672
  || !(memory instanceof MemoryRetrievalService)
699
673
  ? undefined
700
674
  : createSharedMemoryRecallRuntimeExtension(memory, {
@@ -702,8 +676,39 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
702
676
  ? {}
703
677
  : { onUnavailable: options.onMemoryRecallUnavailable }),
704
678
  });
679
+ // Chronological enumeration shares the explicit memory-read switch with
680
+ // MemoryRecall, but additionally follows normal app-tool policy and requires
681
+ // an affirmative local capability. External search backends stay incapable.
682
+ const memoryJournal = !memoryReadToolsEnabled
683
+ || !(memory instanceof MemoryRetrievalService)
684
+ || !isMemoryJournalCapableStore(memory)
685
+ || !isMemoryJournalToolAllowed(config.tools)
686
+ ? undefined
687
+ : createMemoryJournalRuntimeExtension(memory, {
688
+ ...(options.env === undefined ? {} : { env: options.env }),
689
+ ...(options.onMemoryJournalUnavailable === undefined
690
+ ? {}
691
+ : { onUnavailable: options.onMemoryJournalUnavailable }),
692
+ });
693
+ // The durable write surface is gated three ways: the store must affirm the
694
+ // capability (a read-only or external backend never does), the operator must
695
+ // not have disabled it, and tool policy must allow it. Unlike MemoryRecall it
696
+ // is allowlist-gated, so an operator can withhold writes while keeping recall.
697
+ const memoryRemember = config.memory?.rememberTool?.enabled === false
698
+ || !(memory instanceof MemoryRetrievalService)
699
+ || !isRememberCapableStore(memory)
700
+ || !isRememberToolAllowed(config.tools)
701
+ ? undefined
702
+ : createMemoryRememberRuntimeExtension(memory, {
703
+ ...(options.env === undefined ? {} : { env: options.env }),
704
+ ...(options.onMemoryRememberUnavailable === undefined
705
+ ? {}
706
+ : { onUnavailable: options.onMemoryRememberUnavailable }),
707
+ });
705
708
  const composedRuntimeOptionsForRequest = composeRuntimeOptionExtensions([
706
709
  memoryRecall,
710
+ memoryJournal,
711
+ memoryRemember,
707
712
  options.runtimeOptionsForRequest,
708
713
  ], {
709
714
  // The app-owned, read-only MemoryRecall endpoint is part of every configured
@@ -712,7 +717,7 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
712
717
  preserveMcpServersUnderOverride: memoryRecall === undefined ? [] : [memoryRecall],
713
718
  });
714
719
  const clearSessionsRuntimeOptionsForRequest = createClearSessionsRuntimeExtension(composedRuntimeOptionsForRequest, clearSessionsBoundaryOptions);
715
- const runtimeOptionsForRequest = createProcessJobsRuntimeExtension({
720
+ const processJobsRuntimeOptionsForRequest = createProcessJobsRuntimeExtension({
716
721
  next: clearSessionsRuntimeOptionsForRequest,
717
722
  ownership,
718
723
  registry: processJobsRegistry,
@@ -726,27 +731,39 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
726
731
  routesOnlyPiNative: internalHooks.processJobs?.routesOnlyPiNative
727
732
  ?? (() => configuredRoutesOnlyPiNative(config, model).ok),
728
733
  });
734
+ const monitoredRuntimeOptionsForRequest = createMonitorsRuntimeExtension({
735
+ next: processJobsRuntimeOptionsForRequest,
736
+ service: internalHooks.monitors?.service,
737
+ coreConfig: config,
738
+ channelId: internalHooks.monitors?.channelId ?? internalHooks.processJobs?.channelId,
739
+ conversationScheme: internalHooks.monitors?.conversationScheme
740
+ ?? internalHooks.processJobs?.conversationScheme,
741
+ routesOnlyPiNative: internalHooks.monitors?.routesOnlyPiNative
742
+ ?? internalHooks.processJobs?.routesOnlyPiNative
743
+ ?? (() => configuredRoutesOnlyPiNative(config, model).ok),
744
+ });
745
+ const toolOutputArtifactRoot = resolvePath(config.artifacts.dir, "tool-output");
746
+ const runtimeOptionsForRequest = createToolOutputArtifactsRuntimeExtension(monitoredRuntimeOptionsForRequest, toolOutputArtifactRoot);
729
747
  const subagents = subagentsRuntimeOptions(config, {
730
748
  runtime,
731
749
  baseModel: model,
732
- baseExecutionMode: executionMode,
733
- processJobsProtectionPosture,
734
- ...(options.runtimeForModel === undefined ? {} : { runtimeForModel: options.runtimeForModel }),
750
+ ...(runtimeForModel === undefined ? {} : { runtimeForModel }),
735
751
  });
736
752
  const runtimeOptions = mergeStaticRuntimeOptions(runtimeOptionsForLocalProvider(model, config.providers?.local), configRuntimeFlags(config), sandboxEngine === undefined ? undefined : { sandboxEngine }, subagents, options.runtimeOptions);
737
753
  const sessionOptions = {
738
754
  mode: config.runtime.session.mode,
739
755
  idleTimeoutMs: config.runtime.session.idleTimeoutMs,
740
- // Any fallback makes the logical run stateless. A provider-owned session
741
- // cannot safely cross the route boundary, even when both bridges happen to
742
- // expose resume support. History replay remains available to every attempt.
743
- supportsResume: hasConfiguredFallback(config)
744
- ? false
745
- : supportsSessionResume(model, executionMode),
756
+ // Continuous sessions belong to the primary's first attempt. The router
757
+ // strips session state from retries and backups and withholds their resumable
758
+ // result id; an unsynchronized durable answer rotates the epoch before the next turn.
759
+ supportsResume: supportsSessionResume(),
746
760
  ...(config.runtime.session.isolateProactive === undefined
747
761
  ? {}
748
762
  : { isolateProactive: config.runtime.session.isolateProactive }),
749
763
  ...(options.onSessionEvent === undefined ? {} : { onSessionEvent: options.onSessionEvent }),
764
+ ...(options.terminalRecoverySettlementMs === undefined
765
+ ? {}
766
+ : { terminalRecoverySettlementMs: options.terminalRecoverySettlementMs }),
750
767
  };
751
768
  const piSessionsRoot = config.providers?.piNative?.piSessionsRoot;
752
769
  const retireDurableSession = runtime.retireDurableSession?.bind(runtime);
@@ -757,8 +774,18 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
757
774
  ...(piSessionsRoot === undefined || retireDurableSession === undefined
758
775
  ? {}
759
776
  : {
760
- retireProviderSession: async (providerSessionId) => {
761
- await retireDurableSession(providerSessionId, piSessionsRoot);
777
+ retireProviderSession: async (providerSessionId, modelKey) => {
778
+ const owner = runtimeForSession(modelKey);
779
+ if (owner.retireDurableSession === undefined) {
780
+ throw new Error("Session owner cannot retire durable provider state.");
781
+ }
782
+ // Durable retirement detaches an open Pi handle before unlinking;
783
+ // ordinary invalidation alone rejects while a cancelled turn unwinds.
784
+ await owner.retireDurableSession(providerSessionId, piSessionsRoot);
785
+ if (owner.invalidateSession !== undefined)
786
+ await owner.invalidateSession(providerSessionId);
787
+ else
788
+ await owner.disposeSession?.(providerSessionId);
762
789
  },
763
790
  }),
764
791
  });
@@ -771,7 +798,7 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
771
798
  // create either the sidecar or its owner database.
772
799
  const toolHistory = lazyConfiguredToolHistory({
773
800
  root: historyRoot,
774
- artifactRoot: resolvePath(config.artifacts.dir, "tool-output"),
801
+ artifactRoot: toolOutputArtifactRoot,
775
802
  rollover,
776
803
  ...(options.onToolHistoryWarning === undefined
777
804
  ? {}
@@ -783,11 +810,21 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
783
810
  ...(config.context.soulPath === undefined ? {} : { soulPath: config.context.soulPath }),
784
811
  ...(config.context.skillsRoot === undefined ? {} : { skillsRoot: config.context.skillsRoot }),
785
812
  ...(config.context.skillMaxBytes === undefined ? {} : { skillMaxBytes: config.context.skillMaxBytes }),
786
- ...(config.context.skillDisclosure === undefined ? {} : { skillDisclosure: config.context.skillDisclosure }),
787
- selectedSkills: config.context.selectedSkills,
813
+ ...(config.context.skillDisclosure === undefined
814
+ ? {}
815
+ : {
816
+ // Index disclosure inventories every installed skill, not only selected
817
+ // ones. Until the explicit updater retires the legacy file, fall back
818
+ // to selected-body loading so that stale configure instructions cannot
819
+ // re-enter through ReadSkill.
820
+ skillDisclosure: config.context.skillDisclosure === "index"
821
+ && config.context.selectedSkills.some(isRetiredProjectSkillName)
822
+ ? "full"
823
+ : config.context.skillDisclosure,
824
+ }),
825
+ selectedSkills: activeProjectSkillSelections(config.context.selectedSkills),
788
826
  runtime,
789
827
  model,
790
- executionMode,
791
828
  cwd: config.runtime.workspace,
792
829
  ...(config.runtime.effort === undefined ? {} : { effort: config.runtime.effort }),
793
830
  ...(config.runtime.maxTurns === undefined ? {} : { maxTurns: config.runtime.maxTurns }),
@@ -821,6 +858,17 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
821
858
  routesOnlyPiNative: internalHooks.processJobs?.routesOnlyPiNative
822
859
  ?? (() => configuredRoutesOnlyPiNative(config, model).ok),
823
860
  }),
861
+ // Same predicate the monitors extension uses, for the same reason.
862
+ monitorsAvailable: (input) => monitorsAvailableForRequest(input, {
863
+ service: internalHooks.monitors?.service,
864
+ coreConfig: config,
865
+ channelId: internalHooks.monitors?.channelId ?? internalHooks.processJobs?.channelId,
866
+ conversationScheme: internalHooks.monitors?.conversationScheme
867
+ ?? internalHooks.processJobs?.conversationScheme,
868
+ routesOnlyPiNative: internalHooks.monitors?.routesOnlyPiNative
869
+ ?? internalHooks.processJobs?.routesOnlyPiNative
870
+ ?? (() => configuredRoutesOnlyPiNative(config, model).ok),
871
+ }),
824
872
  ...(config.tools.mcpRequestContextServers === undefined
825
873
  ? {}
826
874
  : {
@@ -840,7 +888,7 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
840
888
  capabilityIssuer: options.continuationCapabilityIssuer,
841
889
  },
842
890
  }),
843
- ...(options.runtimeForModel === undefined ? {} : { runtimeForModel: options.runtimeForModel }),
891
+ ...(runtimeForModel === undefined ? {} : { runtimeForModel }),
844
892
  ...(memory === undefined ? {} : { memory }),
845
893
  memoryWriteMode: config.memory?.writeMode ?? "disabled",
846
894
  ...(options.onMemoryWarning === undefined ? {} : { onMemoryWarning: options.onMemoryWarning }),
@@ -881,6 +929,7 @@ async function createConfiguredAgentHarnessInternal(options, internalHooks = {})
881
929
  function harnessWithAgentRootOwnership(harness, ownership) {
882
930
  let disposePromise;
883
931
  return {
932
+ ...(harness.liveInputOwnership === undefined ? {} : { liveInputOwnership: harness.liveInputOwnership }),
884
933
  run: harness.run.bind(harness),
885
934
  ...(harness.submit === undefined ? {} : { submit: harness.submit.bind(harness) }),
886
935
  ...(harness.offerLiveInput === undefined
@@ -893,6 +942,9 @@ function harnessWithAgentRootOwnership(harness, ownership) {
893
942
  ...(harness.appendVerbatimTurn === undefined
894
943
  ? {}
895
944
  : { appendVerbatimTurn: harness.appendVerbatimTurn.bind(harness) }),
945
+ ...(harness.importContext === undefined
946
+ ? {}
947
+ : { importContext: harness.importContext.bind(harness) }),
896
948
  dispose: () => {
897
949
  disposePromise ??= Promise.resolve()
898
950
  .then(async () => await harness.dispose?.())
@@ -1087,7 +1139,7 @@ export function lazyConfiguredToolHistory(options) {
1087
1139
  }
1088
1140
  };
1089
1141
  },
1090
- async finishRun(binding, status, failureKind) {
1142
+ async finishRun(binding, status, failureKind, cancellationReasonCode) {
1091
1143
  const key = turnKey(binding.conversationId, binding.runId);
1092
1144
  const state = turnStates.get(key);
1093
1145
  try {
@@ -1095,7 +1147,7 @@ export function lazyConfiguredToolHistory(options) {
1095
1147
  return;
1096
1148
  const handle = await state.attempt.promise.catch(() => undefined);
1097
1149
  try {
1098
- await handle?.writer.finishRun(binding, status, failureKind);
1150
+ await handle?.writer.finishRun(binding, status, failureKind, cancellationReasonCode);
1099
1151
  }
1100
1152
  catch (error) {
1101
1153
  if (handle === undefined)
@@ -1231,13 +1283,9 @@ async function createConfiguredAgentResponderInternal(options, internalHooks = {
1231
1283
  }
1232
1284
  /** @internal Shared only with app-local history decorators; absent from the package root. */
1233
1285
  export const DEFAULT_HISTORY_MAX_MESSAGES = 64;
1234
- function hasConfiguredFallback(config) {
1235
- return (config.runtime.fallbacks?.length ?? 0) > 0
1236
- || (config.runtime.fallbackModels?.length ?? 0) > 0;
1237
- }
1238
- function supportsSessionResume(model, executionMode) {
1286
+ function supportsSessionResume() {
1239
1287
  try {
1240
- return monoRuntimeSupportsSessionResume(model, executionMode);
1288
+ return monoRuntimeSupportsSessionResume();
1241
1289
  }
1242
1290
  catch {
1243
1291
  return false;
@@ -1363,6 +1411,12 @@ async function createConfiguredMemoryInternal(config, deps, protectionPosture) {
1363
1411
  function runtimeHostOptionsForConfig(config) {
1364
1412
  return {
1365
1413
  workspace: config.runtime.workspace,
1414
+ ...(config.tools.filesystem === undefined
1415
+ ? {}
1416
+ : {
1417
+ additionalReadRoots: config.tools.filesystem.readableRoots,
1418
+ additionalWriteRoots: config.tools.filesystem.writableRoots,
1419
+ }),
1366
1420
  qaOutputDir: config.artifacts.dir,
1367
1421
  ...(config.providers?.piAuthPath === undefined
1368
1422
  ? {}
@@ -1385,11 +1439,6 @@ memoryRuntimeOverride, recording, agentRoot, protectionPosture) {
1385
1439
  }), config, agentRoot);
1386
1440
  }
1387
1441
  const model = parseMonoRuntimeModelReference(llmConfig.model);
1388
- const executionMode = llmConfig.executionMode ?? defaultExecutionModeForModel(model);
1389
- assertExecutionModeCompatible(model, executionMode);
1390
- if (executionMode !== "sdk") {
1391
- throw new Error("memory.llm provider agent-host supports SDK execution mode only.");
1392
- }
1393
1442
  // NOTE: createMonoRuntime is called WITHOUT a fallbackChain here on purpose, so
1394
1443
  // the per-call `model: config.memory.llm.model` is the sole/primary model. The
1395
1444
  // channel runtime (which carries the fallback chain whose primary is
@@ -1399,7 +1448,6 @@ memoryRuntimeOverride, recording, agentRoot, protectionPosture) {
1399
1448
  return createAgentHostMemoryLlm({
1400
1449
  runtime,
1401
1450
  model,
1402
- executionMode,
1403
1451
  cwd: config.runtime.workspace,
1404
1452
  runtimeOptions: mergeStaticRuntimeOptions(runtimeOptionsForLocalProvider(model, config.providers?.local), configRuntimeFlags(config)),
1405
1453
  // Per-call timeout; default 60s. Configurable so a slow local model can be
@@ -1434,9 +1482,6 @@ function wrapPerRunOwnedConfiguredRuntime(runtime, config, agentRoot, protection
1434
1482
  const protectedRoots = processJobsProtectionPolicyRoots(attested);
1435
1483
  let effectiveOptions = runOptions;
1436
1484
  if (protectedRoots.length > 0) {
1437
- if (runOptions.model.sdk !== "pi") {
1438
- throw new Error(`${PROCESS_JOBS_PI_NATIVE_REQUIRED_ERROR} The agent-host memory LLM route ${modelReferenceKey(runOptions.model)} is not Pi-native.`);
1439
- }
1440
1485
  if (protectionPosture?.suppressSyntheticSandbox !== true) {
1441
1486
  const sandboxEngine = runOptions.sandboxEngine ?? createSrtSandboxEngine();
1442
1487
  if (!await sandboxEngine.isAvailable().catch(() => false)) {
@@ -1583,7 +1628,6 @@ function createAgentHostMemoryLlm(options) {
1583
1628
  model: options.model,
1584
1629
  messages: [{ role: "user", content: prompt }],
1585
1630
  abortSignal: ctrl.signal,
1586
- executionMode: options.executionMode,
1587
1631
  cwd: options.cwd,
1588
1632
  maxTurns: 1,
1589
1633
  allowedTools: [],
@@ -1755,6 +1799,7 @@ function configRuntimeFlags(config) {
1755
1799
  };
1756
1800
  if (permissionMode === undefined
1757
1801
  && piNative?.transport === undefined
1802
+ && piNative?.promptCacheDiagnostics === undefined
1758
1803
  && piNative?.piMaxRetries === undefined
1759
1804
  && piNative?.maxRetryDelayMs === undefined
1760
1805
  && compaction === undefined
@@ -1766,12 +1811,14 @@ function configRuntimeFlags(config) {
1766
1811
  return {
1767
1812
  ...(permissionMode === undefined ? {} : { permissionMode }),
1768
1813
  ...(piNative?.transport === undefined ? {} : { piTransport: piNative.transport }),
1814
+ ...(piNative?.promptCacheDiagnostics === undefined ? {} : { promptCacheDiagnostics: piNative.promptCacheDiagnostics }),
1769
1815
  ...(piNative?.piMaxRetries === undefined ? {} : { piMaxRetries: piNative.piMaxRetries }),
1770
1816
  ...(piNative?.maxRetryDelayMs === undefined ? {} : { maxRetryDelayMs: piNative.maxRetryDelayMs }),
1771
1817
  ...(compaction === undefined ? {} : { compaction }),
1772
1818
  ...(settings === undefined ? {} : { settings }),
1773
1819
  ...(webSearchConfig === undefined ? {} : { webSearchConfig }),
1774
1820
  ...(webFetchConfig === undefined ? {} : { webFetchConfig }),
1821
+ ...(config.tools.web?.coordination === "host" ? { webRequestCoordinator: createHostWebRequestCoordinator() } : {}),
1775
1822
  };
1776
1823
  }
1777
1824
  function isRuntimeOptions(value) {