@mono-agent/agent-app 0.6.2 → 0.9.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 (313) hide show
  1. package/README.md +259 -19
  2. package/dist/account-home.d.ts +6 -0
  3. package/dist/account-home.d.ts.map +1 -0
  4. package/dist/account-home.js +9 -0
  5. package/dist/account-home.js.map +1 -0
  6. package/dist/adapter-send-proxy.d.ts +18 -0
  7. package/dist/adapter-send-proxy.d.ts.map +1 -0
  8. package/dist/adapter-send-proxy.js +229 -0
  9. package/dist/adapter-send-proxy.js.map +1 -0
  10. package/dist/adapter-send-tools-main.js +62 -4
  11. package/dist/adapter-send-tools-main.js.map +1 -1
  12. package/dist/adapter-send-tools.d.ts +33 -6
  13. package/dist/adapter-send-tools.d.ts.map +1 -1
  14. package/dist/adapter-send-tools.js +485 -87
  15. package/dist/adapter-send-tools.js.map +1 -1
  16. package/dist/app-config.d.ts +3 -1
  17. package/dist/app-config.d.ts.map +1 -1
  18. package/dist/app-config.js +16 -5
  19. package/dist/app-config.js.map +1 -1
  20. package/dist/app.d.ts +27 -0
  21. package/dist/app.d.ts.map +1 -1
  22. package/dist/app.js +761 -147
  23. package/dist/app.js.map +1 -1
  24. package/dist/background-environment.d.ts +16 -0
  25. package/dist/background-environment.d.ts.map +1 -0
  26. package/dist/background-environment.js +68 -0
  27. package/dist/background-environment.js.map +1 -0
  28. package/dist/background-runtime.d.ts +62 -0
  29. package/dist/background-runtime.d.ts.map +1 -0
  30. package/dist/background-runtime.js +1115 -0
  31. package/dist/background-runtime.js.map +1 -0
  32. package/dist/background-snapshot-key.d.ts +13 -0
  33. package/dist/background-snapshot-key.d.ts.map +1 -0
  34. package/dist/background-snapshot-key.js +194 -0
  35. package/dist/background-snapshot-key.js.map +1 -0
  36. package/dist/background-snapshot.d.ts +96 -0
  37. package/dist/background-snapshot.d.ts.map +1 -0
  38. package/dist/background-snapshot.js +450 -0
  39. package/dist/background-snapshot.js.map +1 -0
  40. package/dist/background-worker-lease.d.ts +39 -0
  41. package/dist/background-worker-lease.d.ts.map +1 -0
  42. package/dist/background-worker-lease.js +356 -0
  43. package/dist/background-worker-lease.js.map +1 -0
  44. package/dist/background.d.ts +74 -2
  45. package/dist/background.d.ts.map +1 -1
  46. package/dist/background.js +815 -73
  47. package/dist/background.js.map +1 -1
  48. package/dist/broadcast-recorder.d.ts.map +1 -1
  49. package/dist/broadcast-recorder.js +24 -2
  50. package/dist/broadcast-recorder.js.map +1 -1
  51. package/dist/channel-plugins.d.ts +2 -0
  52. package/dist/channel-plugins.d.ts.map +1 -1
  53. package/dist/channel-plugins.js +8 -0
  54. package/dist/channel-plugins.js.map +1 -1
  55. package/dist/channels.d.ts +10 -0
  56. package/dist/channels.d.ts.map +1 -1
  57. package/dist/channels.js +87 -9
  58. package/dist/channels.js.map +1 -1
  59. package/dist/cli.d.ts +86 -4
  60. package/dist/cli.d.ts.map +1 -1
  61. package/dist/cli.js +2421 -143
  62. package/dist/cli.js.map +1 -1
  63. package/dist/config-reference.d.ts.map +1 -1
  64. package/dist/config-reference.js +448 -6
  65. package/dist/config-reference.js.map +1 -1
  66. package/dist/configuration-proposal-main.d.ts +3 -0
  67. package/dist/configuration-proposal-main.d.ts.map +1 -0
  68. package/dist/configuration-proposal-main.js +13 -0
  69. package/dist/configuration-proposal-main.js.map +1 -0
  70. package/dist/configuration-proposal-tool.d.ts +33 -0
  71. package/dist/configuration-proposal-tool.d.ts.map +1 -0
  72. package/dist/configuration-proposal-tool.js +188 -0
  73. package/dist/configuration-proposal-tool.js.map +1 -0
  74. package/dist/configured-agent.d.ts +16 -0
  75. package/dist/configured-agent.d.ts.map +1 -1
  76. package/dist/configured-agent.js +165 -18
  77. package/dist/configured-agent.js.map +1 -1
  78. package/dist/consumer-contract.d.ts +3 -0
  79. package/dist/consumer-contract.d.ts.map +1 -1
  80. package/dist/consumer-contract.js +44 -1
  81. package/dist/consumer-contract.js.map +1 -1
  82. package/dist/continuation-command.d.ts +15 -0
  83. package/dist/continuation-command.d.ts.map +1 -0
  84. package/dist/continuation-command.js +170 -0
  85. package/dist/continuation-command.js.map +1 -0
  86. package/dist/continuation-config.d.ts +25 -0
  87. package/dist/continuation-config.d.ts.map +1 -0
  88. package/dist/continuation-config.js +236 -0
  89. package/dist/continuation-config.js.map +1 -0
  90. package/dist/continuation-service.d.ts +99 -0
  91. package/dist/continuation-service.d.ts.map +1 -0
  92. package/dist/continuation-service.js +1313 -0
  93. package/dist/continuation-service.js.map +1 -0
  94. package/dist/continuation-store.d.ts +104 -0
  95. package/dist/continuation-store.d.ts.map +1 -0
  96. package/dist/continuation-store.js +688 -0
  97. package/dist/continuation-store.js.map +1 -0
  98. package/dist/continuations.d.ts +167 -0
  99. package/dist/continuations.d.ts.map +1 -0
  100. package/dist/continuations.js +71 -0
  101. package/dist/continuations.js.map +1 -0
  102. package/dist/doctor.d.ts +29 -5
  103. package/dist/doctor.d.ts.map +1 -1
  104. package/dist/doctor.js +1611 -116
  105. package/dist/doctor.js.map +1 -1
  106. package/dist/first-run-managed-memory.d.ts +39 -0
  107. package/dist/first-run-managed-memory.d.ts.map +1 -0
  108. package/dist/first-run-managed-memory.js +584 -0
  109. package/dist/first-run-managed-memory.js.map +1 -0
  110. package/dist/first-run-readiness.d.ts +111 -0
  111. package/dist/first-run-readiness.d.ts.map +1 -0
  112. package/dist/first-run-readiness.js +728 -0
  113. package/dist/first-run-readiness.js.map +1 -0
  114. package/dist/index.d.ts +17 -3
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +8 -1
  117. package/dist/index.js.map +1 -1
  118. package/dist/init.d.ts +95 -3
  119. package/dist/init.d.ts.map +1 -1
  120. package/dist/init.js +1218 -24
  121. package/dist/init.js.map +1 -1
  122. package/dist/interaction-bridge.d.ts +25 -1
  123. package/dist/interaction-bridge.d.ts.map +1 -1
  124. package/dist/interaction-bridge.js +281 -19
  125. package/dist/interaction-bridge.js.map +1 -1
  126. package/dist/launchd.d.ts +16 -6
  127. package/dist/launchd.d.ts.map +1 -1
  128. package/dist/launchd.js +30 -15
  129. package/dist/launchd.js.map +1 -1
  130. package/dist/local-configuration.d.ts +99 -0
  131. package/dist/local-configuration.d.ts.map +1 -0
  132. package/dist/local-configuration.js +1299 -0
  133. package/dist/local-configuration.js.map +1 -0
  134. package/dist/managed-runtime-packages.d.ts +9 -0
  135. package/dist/managed-runtime-packages.d.ts.map +1 -0
  136. package/dist/managed-runtime-packages.js +56 -0
  137. package/dist/managed-runtime-packages.js.map +1 -0
  138. package/dist/memory-command.d.ts +4 -0
  139. package/dist/memory-command.d.ts.map +1 -1
  140. package/dist/memory-command.js +751 -27
  141. package/dist/memory-command.js.map +1 -1
  142. package/dist/memory-embedding-service.d.ts +33 -0
  143. package/dist/memory-embedding-service.d.ts.map +1 -0
  144. package/dist/memory-embedding-service.js +207 -0
  145. package/dist/memory-embedding-service.js.map +1 -0
  146. package/dist/memory-recall.d.ts +43 -14
  147. package/dist/memory-recall.d.ts.map +1 -1
  148. package/dist/memory-recall.js +103 -33
  149. package/dist/memory-recall.js.map +1 -1
  150. package/dist/memory-retrieval.d.ts +66 -0
  151. package/dist/memory-retrieval.d.ts.map +1 -0
  152. package/dist/memory-retrieval.js +332 -0
  153. package/dist/memory-retrieval.js.map +1 -0
  154. package/dist/modules/base.d.ts +6 -5
  155. package/dist/modules/base.d.ts.map +1 -1
  156. package/dist/modules/base.js +11 -7
  157. package/dist/modules/base.js.map +1 -1
  158. package/dist/modules/catalog.d.ts.map +1 -1
  159. package/dist/modules/catalog.js +141 -25
  160. package/dist/modules/catalog.js.map +1 -1
  161. package/dist/modules/index.d.ts +2 -2
  162. package/dist/modules/index.d.ts.map +1 -1
  163. package/dist/modules/index.js +1 -1
  164. package/dist/modules/index.js.map +1 -1
  165. package/dist/modules/known-tools.d.ts +3 -0
  166. package/dist/modules/known-tools.d.ts.map +1 -1
  167. package/dist/modules/known-tools.js +11 -1
  168. package/dist/modules/known-tools.js.map +1 -1
  169. package/dist/modules/types.d.ts +20 -6
  170. package/dist/modules/types.d.ts.map +1 -1
  171. package/dist/modules/types.js.map +1 -1
  172. package/dist/notify-runtime.d.ts +26 -0
  173. package/dist/notify-runtime.d.ts.map +1 -0
  174. package/dist/notify-runtime.js +27 -0
  175. package/dist/notify-runtime.js.map +1 -0
  176. package/dist/notify-tool.d.ts +51 -0
  177. package/dist/notify-tool.d.ts.map +1 -0
  178. package/dist/notify-tool.js +182 -0
  179. package/dist/notify-tool.js.map +1 -0
  180. package/dist/package-version.d.ts +3 -0
  181. package/dist/package-version.d.ts.map +1 -0
  182. package/dist/package-version.js +14 -0
  183. package/dist/package-version.js.map +1 -0
  184. package/dist/pi-auth-store-inspection.d.ts +21 -0
  185. package/dist/pi-auth-store-inspection.d.ts.map +1 -0
  186. package/dist/pi-auth-store-inspection.js +120 -0
  187. package/dist/pi-auth-store-inspection.js.map +1 -0
  188. package/dist/pi-oauth-login-main.d.ts +3 -0
  189. package/dist/pi-oauth-login-main.d.ts.map +1 -0
  190. package/dist/pi-oauth-login-main.js +14 -0
  191. package/dist/pi-oauth-login-main.js.map +1 -0
  192. package/dist/pi-oauth-login.d.ts +22 -0
  193. package/dist/pi-oauth-login.d.ts.map +1 -0
  194. package/dist/pi-oauth-login.js +79 -0
  195. package/dist/pi-oauth-login.js.map +1 -0
  196. package/dist/proactive-notify.d.ts +2 -0
  197. package/dist/proactive-notify.d.ts.map +1 -1
  198. package/dist/proactive-notify.js +1 -0
  199. package/dist/proactive-notify.js.map +1 -1
  200. package/dist/process-incarnation.d.ts +23 -0
  201. package/dist/process-incarnation.d.ts.map +1 -0
  202. package/dist/process-incarnation.js +208 -0
  203. package/dist/process-incarnation.js.map +1 -0
  204. package/dist/project-skills.d.ts +40 -0
  205. package/dist/project-skills.d.ts.map +1 -0
  206. package/dist/project-skills.js +573 -0
  207. package/dist/project-skills.js.map +1 -0
  208. package/dist/provider-setup.d.ts +117 -2
  209. package/dist/provider-setup.d.ts.map +1 -1
  210. package/dist/provider-setup.js +1505 -49
  211. package/dist/provider-setup.js.map +1 -1
  212. package/dist/readiness-probe-worker.d.ts +12 -0
  213. package/dist/readiness-probe-worker.d.ts.map +1 -0
  214. package/dist/readiness-probe-worker.js +276 -0
  215. package/dist/readiness-probe-worker.js.map +1 -0
  216. package/dist/readiness-probe.d.ts +100 -0
  217. package/dist/readiness-probe.d.ts.map +1 -0
  218. package/dist/readiness-probe.js +780 -0
  219. package/dist/readiness-probe.js.map +1 -0
  220. package/dist/recipes/base.d.ts +15 -0
  221. package/dist/recipes/base.d.ts.map +1 -0
  222. package/dist/recipes/base.js +51 -0
  223. package/dist/recipes/base.js.map +1 -0
  224. package/dist/recipes/catalog.d.ts +4 -0
  225. package/dist/recipes/catalog.d.ts.map +1 -0
  226. package/dist/recipes/catalog.js +525 -0
  227. package/dist/recipes/catalog.js.map +1 -0
  228. package/dist/recipes/index.d.ts +11 -0
  229. package/dist/recipes/index.d.ts.map +1 -0
  230. package/dist/recipes/index.js +14 -0
  231. package/dist/recipes/index.js.map +1 -0
  232. package/dist/recipes/types.d.ts +70 -0
  233. package/dist/recipes/types.d.ts.map +1 -0
  234. package/dist/recipes/types.js +15 -0
  235. package/dist/recipes/types.js.map +1 -0
  236. package/dist/request-model-override.d.ts +43 -1
  237. package/dist/request-model-override.d.ts.map +1 -1
  238. package/dist/request-model-override.js +178 -19
  239. package/dist/request-model-override.js.map +1 -1
  240. package/dist/run-history.d.ts +32 -0
  241. package/dist/run-history.d.ts.map +1 -0
  242. package/dist/run-history.js +859 -0
  243. package/dist/run-history.js.map +1 -0
  244. package/dist/runs-health.d.ts.map +1 -1
  245. package/dist/runs-health.js +12 -4
  246. package/dist/runs-health.js.map +1 -1
  247. package/dist/runtime-option-extensions.d.ts +14 -0
  248. package/dist/runtime-option-extensions.d.ts.map +1 -0
  249. package/dist/runtime-option-extensions.js +98 -0
  250. package/dist/runtime-option-extensions.js.map +1 -0
  251. package/dist/runtime-routes.d.ts +9 -0
  252. package/dist/runtime-routes.d.ts.map +1 -0
  253. package/dist/runtime-routes.js +13 -0
  254. package/dist/runtime-routes.js.map +1 -0
  255. package/dist/sandbox-manager.d.ts +86 -0
  256. package/dist/sandbox-manager.d.ts.map +1 -0
  257. package/dist/sandbox-manager.js +1402 -0
  258. package/dist/sandbox-manager.js.map +1 -0
  259. package/dist/setup.d.ts +29 -0
  260. package/dist/setup.d.ts.map +1 -0
  261. package/dist/setup.js +97 -0
  262. package/dist/setup.js.map +1 -0
  263. package/dist/supermemory-plugin.d.ts +56 -0
  264. package/dist/supermemory-plugin.d.ts.map +1 -0
  265. package/dist/supermemory-plugin.js +142 -0
  266. package/dist/supermemory-plugin.js.map +1 -0
  267. package/dist/tui-command.d.ts +56 -0
  268. package/dist/tui-command.d.ts.map +1 -1
  269. package/dist/tui-command.js +305 -31
  270. package/dist/tui-command.js.map +1 -1
  271. package/dist/web-command.d.ts +8 -0
  272. package/dist/web-command.d.ts.map +1 -1
  273. package/dist/web-command.js +174 -17
  274. package/dist/web-command.js.map +1 -1
  275. package/dist/wizard/answers.d.ts +31 -4
  276. package/dist/wizard/answers.d.ts.map +1 -1
  277. package/dist/wizard/answers.js +141 -29
  278. package/dist/wizard/answers.js.map +1 -1
  279. package/dist/wizard/from-flags.d.ts +7 -0
  280. package/dist/wizard/from-flags.d.ts.map +1 -1
  281. package/dist/wizard/from-flags.js +36 -2
  282. package/dist/wizard/from-flags.js.map +1 -1
  283. package/dist/wizard/index.d.ts +4 -4
  284. package/dist/wizard/index.d.ts.map +1 -1
  285. package/dist/wizard/index.js +2 -2
  286. package/dist/wizard/index.js.map +1 -1
  287. package/dist/wizard/model-discovery.d.ts +33 -2
  288. package/dist/wizard/model-discovery.d.ts.map +1 -1
  289. package/dist/wizard/model-discovery.js +826 -108
  290. package/dist/wizard/model-discovery.js.map +1 -1
  291. package/dist/wizard/presets.d.ts +1 -1
  292. package/dist/wizard/presets.d.ts.map +1 -1
  293. package/dist/wizard/presets.js +7 -12
  294. package/dist/wizard/presets.js.map +1 -1
  295. package/dist/wizard/prompts.d.ts +56 -9
  296. package/dist/wizard/prompts.d.ts.map +1 -1
  297. package/dist/wizard/prompts.js +172 -20
  298. package/dist/wizard/prompts.js.map +1 -1
  299. package/dist/wizard/run.d.ts +59 -3
  300. package/dist/wizard/run.d.ts.map +1 -1
  301. package/dist/wizard/run.js +1290 -191
  302. package/dist/wizard/run.js.map +1 -1
  303. package/package.json +21 -16
  304. package/resources/srt/package-lock.json +66 -0
  305. package/resources/srt/package.json +9 -0
  306. package/schema/mono-agent.config.schema.json +587 -20
  307. package/skills/mono-agent-composer/SKILL.md +6 -6
  308. package/skills/mono-agent-composer/references/config-blueprint.md +11 -10
  309. package/skills/mono-agent-composer/references/discovery-questions.md +33 -18
  310. package/skills/mono-agent-composer/references/feature-coverage.md +14 -12
  311. package/skills/mono-agent-composer/references/package-map.md +2 -2
  312. package/skills/mono-agent-composer/references/playbooks.md +8 -7
  313. package/skills/mono-agent-composer/references/validation.md +3 -3
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Config-first mono-agent host. Reads one `mono-agent.config.json` in a folder,
4
4
  builds the configured responder, and starts every configured communication
5
5
  channel plus traceability. Ships the
6
- `mono-agent` CLI (`init`, `validate`, `memory`, `start`) so an agent folder works without
6
+ `mono-agent` CLI (`init`, `auth`, `sandbox`, `validate`, `memory`, `tui`, `start`) so an agent folder works without
7
7
  hand-written composition code.
8
8
 
9
9
  ## Category
@@ -19,17 +19,25 @@ Turn a folder's `mono-agent.config.json` into a running agent host:
19
19
  external channel plugins from `channels.plugins[]`.
20
20
  - Build the shared runtime/responder/memory stack through app-owned configured
21
21
  composition
22
- (including `runtime.fallbackModels` backup chains).
22
+ (including canonical `runtime.fallbacks` routes and legacy
23
+ `runtime.fallbackModels` compatibility).
24
+ - Preserve completed blocking `AskUser` / `TelegramAskButtons` question,
25
+ options, and outcome in the assistant history copy so cold/stateless provider
26
+ replay does not lose the out-of-band exchange.
27
+ - Expose the request-scoped read-only `RunHistory` tool for safe normalized
28
+ evidence from completed prior runs in the current conversation bucket.
23
29
  - Drive each channel through a uniform driver contract with per-channel
24
30
  `disabled` / `waiting_for_config` / `running` / `failed` status.
25
31
  - Register the host as a traceability source. Config edits are made directly in
26
- `mono-agent.config.json` and take effect on the next `mono-agent restart`.
32
+ `mono-agent.config.json`, or proposed through the OS-owner-managed macOS
33
+ configuration TUI; direct edits take effect on the next `mono-agent restart`.
27
34
  - Resolve and surface any configured `observability.exporters` (the Phoenix
28
35
  preset): `start`/`status` report the configured endpoint and a note that JSONL
29
36
  artifacts remain local; `validate` performs the live reachability probe. Export
30
37
  is best-effort and never changes a run outcome.
31
- - Preview the configured memory backend from the same config/env resolution path
32
- via `mono-agent memory` (`stats`, `today`, `show`, `search`, `top`).
38
+ - Preview, strictly audit, and safely maintain the configured memory backend
39
+ from the same config/env resolution path via `mono-agent memory` (including
40
+ provider-free strict health and payload-free intake inspect/retry/resolve).
33
41
  - Scaffold (`mono-agent init`) and validate (`mono-agent validate`) agent
34
42
  folders non-destructively.
35
43
 
@@ -39,21 +47,245 @@ Turn a folder's `mono-agent.config.json` into a running agent host:
39
47
  # inside the workspace
40
48
  pnpm --filter @mono-agent/agent-app run build
41
49
 
42
- # scaffold and run an agent folder
50
+ # guided, readiness-proven setup and run
43
51
  cd /path/to/agent-folder
44
- node <workspace>/packages/agent-app/dist/cli.js init --model pi:openai-codex:gpt-5.5
45
- node <workspace>/packages/agent-app/dist/cli.js validate
46
- node <workspace>/packages/agent-app/dist/cli.js start
52
+ node <workspace>/packages/agent-app/dist/cli.js init
47
53
  ```
48
54
 
49
55
  On an interactive terminal, bare `mono-agent init` (no flags) runs a colourful,
50
- step-by-step wizard — powered by `@clack/prompts` — that composes the capability
51
- selection before writing anything and can opt in to provider auth/preflight
52
- commands before the scaffold is created. The default model is
53
- `pi:openai-codex:gpt-5.5`; OpenCode-Go Pi refs can save `OPENCODE_API_KEY` into
54
- the Pi auth store. Any flag (or a piped/non-TTY invocation) takes the silent
55
- default/preset scaffold path instead; add `--auth` to run supported provider
56
- setup in that non-interactive path.
56
+ step-by-step wizard — powered by `@clack/prompts` — that asks for the public
57
+ agent name plus exact Role text for `IDENTITY.md` → `## Role` and composes the capability selection before writing anything. An existing `IDENTITY.md` is preserved and the review says the entered Role will not be written. Escape
58
+ moves back one logical step; Ctrl-C asks for exit confirmation. The final
59
+ **Creation review** names the agent, routes/efforts, route safety, provider/SRT
60
+ actions, exact files, secret destinations, and number of real model calls before
61
+ offering **Run setup and readiness checks, then create agent** when setup is
62
+ needed, or **Run readiness checks, then create agent** when credentials are
63
+ already detected, alongside **Edit choices** and **Cancel without writing**.
64
+ Status, sandbox, and route preflights accept Escape or Ctrl-C and enter the same
65
+ resume/restart recovery flow without writing agent files. Interactive provider
66
+ authentication uses Ctrl-C only so the parent never competes with the provider
67
+ child for terminal input. This is the readiness-proven path;
68
+ any flag or non-TTY invocation is scaffold-only and never claims the agent is
69
+ ready. Presets seed the same model, channel,
70
+ tool, and sandbox decisions as the custom path; they do not silently bypass
71
+ safety choices. Journal and BuJo open a dedicated local embeddings step: choose
72
+ Ollama or LM Studio, service root, exact model, actual dimension, and optional
73
+ `apiKeyEnv`. Ollama discovery filters `/api/tags` models through `/api/show`
74
+ `embedding` capabilities; LM Studio filters exact `type: "embedding"` entries
75
+ from `/api/v1/models` and uses their `key`. One fixed non-user request to
76
+ `/api/embed` or `/v1/embeddings` must return a non-empty finite vector of the
77
+ configured dimension before readiness. Manual model/dimension entry can author
78
+ the plan when discovery is inconclusive, but cannot fake readiness. Provider
79
+ failures never fall through to the other local service. Searchable
80
+ primary/fallback pickers combine every bundled model
81
+ for the guided Pi providers (Anthropic, GitHub Copilot, OpenAI Codex, and
82
+ OpenCode-Go), Codex's live account catalog, the Claude SDK catalog, and local
83
+ discovery. The live Codex provider default leads when available; offline setup
84
+ falls back to curated `codex:gpt-5.6-terra` without guessing effort metadata, so
85
+ only **Provider default** is offered until live `model/list` succeeds. GPT-5.6 Sol is selectable as
86
+ `codex:gpt-5.6-sol` or `pi:openai-codex:gpt-5.6-sol`.
87
+ OpenCode-Go Pi refs can save `OPENCODE_API_KEY` into
88
+ the Pi auth store or remain environment-provided, and any number of fallback
89
+ models are selected from the same discovered choices one at a time. Each route
90
+ offers only its advertised effort values plus **Provider default**. Standalone
91
+ `mono-agent auth login anthropic` keeps its localhost callback active while
92
+ also reading a pasted final redirect URL through Pi's code/state-validating
93
+ OAuth implementation. `mono-agent auth login opencode-go` uses a masked TTY prompt; headless callers
94
+ must opt in to one-line redirected input with `--api-key-stdin`. Any flag (or a piped/non-TTY
95
+ invocation) takes the silent default/preset scaffold path instead; add `--auth`
96
+ to run supported provider setup in that non-interactive path. Required selected
97
+ channel secrets are masked and never enter config JSON, examples, review output,
98
+ or logs. Durable provider credentials already in `.env` are secured by the same
99
+ preflight. POSIX persistence is owner-only (`0600`), preserves existing dotenv
100
+ values/comments, and uses an external lock plus no-clobber promotion with exact
101
+ ignore rules for `.env` and transaction artifacts. The canonical agent directory
102
+ must be current-user-owned and not group/world-writable; existing `.env` and
103
+ `.gitignore` files must be current-user-owned with one link, and the ignore guard
104
+ loses group/world write access. Pathname competitors are
105
+ protected; the claimed inode is rechecked and detected open-descriptor writes are
106
+ retained in a reported recovery copy (writes after the final POSIX check remain
107
+ non-cooperative); unsafe/tracked/foreign-owned/multiply-linked
108
+ paths, stale locks, invalid dotenv, conflicts, and Windows fail closed to manual setup. Before the
109
+ interactive wizard can start the background agent it requires one disposable no-tool
110
+ response from every selected runtime route and a complete validation report with
111
+ every selected expectation ready. Cancellation, provider failure, timeout (90s
112
+ cloud / 240s local per route), empty output, or any tool action fails the check.
113
+ Escape or Ctrl-C interrupts preflight; recovery can resume verified routes when
114
+ the non-secret plan fingerprint still matches, restart all checks, edit choices,
115
+ or cancel. Authentication repair clears every prior route proof because it can
116
+ replace credential bytes. Guided commit atomically creates the config and rechecks its exact snapshot after validation. On macOS it then creates or refreshes the canonical per-config launchd service, waits for a fresh `startup-complete` trace source, and opens `mono-agent tui --configure` remotely against that same background responder. A background-start failure preserves the committed files, skips the chat, and prints exact `start`, `status`, and `logs --follow` recovery commands plus log paths. Off macOS, conversational configuration is unavailable: the wizard preserves the files and gives manual edit/validate, foreground-start, and ordinary-TUI guidance without claiming readiness. Any flag or non-TTY invocation remains scaffold-only and never starts a process.
117
+
118
+ Every scaffold selects versioned `mono-agent-configure` and `mono-agent-memory`
119
+ skills from `./skills` with index disclosure. `ReadSkill` remains separate from
120
+ action-tool policy. `mono-agent install-skill --project --check|--update` reports
121
+ version/hash drift and refreshes only unchanged managed copies with backups; a
122
+ canonical owner-only non-symlink parent chain, per-project owner lock, and
123
+ compare-and-swap activation prevent outside or concurrent
124
+ operator edits from being overwritten, and a partial activation restores only
125
+ files that still equal the managed bytes it wrote.
126
+
127
+ In the separate **Temporary post-wizard configuration mode** only, the background app injects proposal-only
128
+ `ProposeAgentConfiguration`. The opening message says to discuss the agent's Role,
129
+ behavior, memory, skills, tools, or channels; never enter secrets; and expect a
130
+ separate host approval before anything changes. Reply `done` or `no changes` to
131
+ finish without edits. It also says ordinary chat starts
132
+ after the reply and any approval or rejection, while `/quit` closes only the console
133
+ and leaves the background agent running. The host accepts only a fail-closed low-risk
134
+ allowlist: public name; effort, turn/session UX; selected project skills and
135
+ disclosure; memory size or MemoryRecall enablement; semantic tool-policy
136
+ tightening; and the separately validated Role body. Every path, memory-tier or
137
+ capture-cost change, runtime/provider route, channel/proactive/plugin, MCP,
138
+ exporter, embeddings/LLM endpoint, sandbox/network field, secret, and unknown
139
+ future field is handed to the explicit guided flow. It canonicalizes
140
+ config/Identity/state paths without following symlink parents, stages and
141
+ fsyncs replacements, then performs the final source comparison and rename as
142
+ one non-yielding commit step under an owner-only transaction lock. Separate TUI
143
+ confirmation, failure-atomic config/Role rollback compensation, rollback
144
+ evidence, a successful managed restart, and a fresh ready trace source remain mandatory. Configuration turns replace
145
+ the ordinary tool/MCP policy with `ReadSkill`, `MemoryRecall`, and the proposal
146
+ tool only. Pure direct-Codex chains use its native read-only plan posture;
147
+ mixed chains keep the finite proposal surface so a route that cannot represent
148
+ it cannot widen authority. Direct OpenCode cannot receive the host-owned MCP
149
+ proposal capability: a direct-OpenCode primary is routed through a configured
150
+ proposal-capable fallback, while a direct-OpenCode fallback makes temporary
151
+ configuration unavailable with explicit remediation. The approval card shows
152
+ every full, untruncated JSON patch value and pages through the exact Role body
153
+ while keeping Reject/Approve reachable, and rejects
154
+ terminal-control or bidi-control review text before displaying it. Fast follow-ups wait through responder rotation.
155
+ Ordinary chat uses a different conversation id. A proposal-free finish, rejection, successful approval, or recovered rollback ends the temporary mode and activates ordinary chat; `/quit` closes only the console while the daemon keeps running. Remote/proactive channels never receive this tool.
156
+
157
+ Before the first macOS background launch, the CLI copies the exact package and
158
+ already-resolved dependency closure it is currently executing—including configured
159
+ channel plugins and the optional Supermemory backend—into an owner-only,
160
+ version/Node-ABI/CLI/closure-digest runtime under `~/.mono-agent/runtimes/agent-app/`.
161
+ It does not invoke npm or lifecycle scripts, so provider secrets never reach an
162
+ installer and pnpm `workspace:` links do not require registry resolution. A
163
+ relative-path/type/mode/content-hash manifest and the complete source-closure
164
+ digest are bound into the runtime marker and verified on every reuse. The LaunchAgent always points there, never at an
165
+ `npm create`/npx cache. Existing verified runtime snapshots are reused and
166
+ retained because another agent may still reference them. A loaded job is fully
167
+ booted out and bootstrapped again so rewritten arguments and environment are
168
+ adopted. Launchd enters Node through `/usr/bin/env -i`, so inherited variables
169
+ such as `NODE_OPTIONS` cannot execute before the worker's allowlisted environment
170
+ is established. Every foreground worker holds one owner-only lifetime lease for its
171
+ canonical config, so a managed and manual host cannot run together. A per-config
172
+ 256-bit key in owner-only `~/.mono-agent/background-snapshot-keys/` commits exact
173
+ file bytes without exposing plaintext or offline-testable hashes in argv/traces.
174
+ A managed worker freezes the proven config, Identity, optional Soul, and MCP authority
175
+ file into private read-only copies before app/channel loading, while trace metadata continues to
176
+ name the canonical config. Readiness requires one live launchd-owned trace PID,
177
+ the exact durable snapshot, and, for configuration, a reachable TUI endpoint.
178
+ Stop succeeds only after both launchd unload and worker death are proven.
179
+
180
+ Guided readiness uses a worker-reproducible environment rather than the launching
181
+ shell: durable `.env` values, entered selected secrets, the resolved Pi auth path,
182
+ and operational values such as `PATH`/`HOME`. Shell-only provider credentials and
183
+ config overrides cannot create a success that launchd cannot reproduce; persisted
184
+ non-secret `MONO_AGENT_*` overrides are rejected by name.
185
+
186
+ Direct Codex discovery checks the executable, login status, and live app-server
187
+ model catalog without equating catalog availability with authentication or a
188
+ verified turn. Missing Codex setup points to the official instructions at
189
+ <https://developers.openai.com/codex/cli/>; the app never auto-installs it. The
190
+ wizard offers browser callback and headless device-code login. Detected credentials
191
+ skip redundant authentication but remain unverified until the exact route call
192
+ successfully runs. Guided Pi setup covers Anthropic, GitHub Copilot, OpenAI Codex,
193
+ and OpenCode-Go; other hand-authored Pi and local-provider configs remain compatible
194
+ without being advertised as guided cloud integrations. Supported OAuth methods and
195
+ the OpenCode-Go key flow come from the bundled upstream catalog;
196
+ stale auth locks are repaired only when the recorded process is securely proven
197
+ gone. The
198
+ wizard keeps **Allow all tools** as its default. Pi/Claude flows disclose
199
+ shell/file/web/channel effects and reconfirm an unsandboxed choice. Direct Codex
200
+ fixes policy to exact allow-all, uses its native network-off workspace sandbox,
201
+ denies unattended escalations, and fails unexpected server requests promptly.
202
+ Mixed chains are unrestricted only under explicit `runtime.routeSafety:
203
+ "per-route-native"`, which isolates provider runtimes and applies a documented
204
+ route-local contract. The default `uniform` mode keeps one common monotonic
205
+ contract and rejects/skips routes that cannot represent it. Pi keeps mono-agent
206
+ tool policy and optional SRT; Claude uses representable provider-native controls;
207
+ direct Codex/OpenCode use provider-native safety plus exact allow-all. No route
208
+ silently drops a required capability. Pi `pi:opencode-go:*` remains a Pi route.
209
+ Direct OpenCode also requires exact allow-all; restrictive static policies fail
210
+ validation/runtime and an incompatible dynamic override is warned and ignored.
211
+
212
+ `RunHistory` requires no config key. It is automatically available under
213
+ allow-all on MCP-capable routes; a restrictive `tools.allowedTools` must name
214
+ `RunHistory` explicitly (`run_history` remains a deprecated input alias), and
215
+ `disallowedTools` can remove it. Direct OpenCode and other MCP-incompatible
216
+ routes suppress it. Its `list` and `inspect` actions can read only completed
217
+ prior runs in the exact current conversation bucket and return bounded,
218
+ redacted, normalized evidence. They exclude the current/running run, other
219
+ conversations or rollover buckets, system prompts, reasoning, recalled memory,
220
+ turn-context payloads, and raw artifact paths; historical text is marked
221
+ untrusted.
222
+
223
+ For missing context, the agent should use active conversation history first,
224
+ `MemoryRecall` for intentionally captured durable facts, and `RunHistory` for
225
+ exact prior-run/tool evidence. Completed blocking `AskUser` and
226
+ `TelegramAskButtons` exchanges are written into the assistant history copy
227
+ before the final response, explicitly labelled as untrusted historical data and
228
+ bounded by newest whole interactions, without changing the outward message or
229
+ long-term memory capture. `TelegramAskButtons` with `wait: false` continues to produce a
230
+ synthetic next turn when the user taps later.
231
+
232
+ The app publishes a cached, content-free `memoryHealth` snapshot in the primary
233
+ trace-source heartbeat and any enabled best-effort global mirror. Built-in
234
+ health is computed through a dynamic memory import so a native SQLite ABI
235
+ failure becomes sanitized `unknown` health
236
+ instead of crashing unrelated CLI startup. Concurrent refreshes coalesce; in
237
+ steady state, ordinary trace events and the completion-based timer never run a
238
+ full audit less than 30 seconds after the prior completion. Startup and reload
239
+ make one explicit post-lifecycle exception so the registered snapshot reflects
240
+ the newly started store. The timer is unreferenced and invalidated at
241
+ stop/reconfigure entry, and the same
242
+ snapshot is used for both registries. The shape is limited to backend/mode,
243
+ closed status and issue vocabularies, ISO check time, and eight whitelisted
244
+ counts—never paths, ids, content, payloads, or raw errors.
245
+
246
+ Unexpected built-in audit failures use the stable `health_check_failed` issue,
247
+ while durable work that exceeds its ownership grace uses `work_stalled`; both
248
+ are fixed metadata-only classifications.
249
+
250
+ Operator automation should use:
251
+
252
+ ```bash
253
+ # One prose/ANSI-free {ok:boolean, sections, ...} object; exit 0 iff ok.
254
+ mono-agent validate --json
255
+
256
+ # Provider-free closed health; healthy/in_progress/not_configured exit 0.
257
+ mono-agent memory audit --strict --json
258
+
259
+ # Payload-free inventory; mutations require the matching agent to be stopped.
260
+ mono-agent memory inspect --json
261
+ mono-agent memory retry --json
262
+ mono-agent memory retry <64-character-id> --json
263
+ mono-agent memory resolve <64-character-id> <reason-slug> --json
264
+ ```
265
+
266
+ Journal and BuJo always require a valid managed `.index/manifest.json`; only
267
+ Lite may remain unmanaged. Missing/corrupt authority, active/configured
268
+ tier-provider-model-dimension mismatch, and native-module/ABI failure are validation
269
+ errors with stop/rebuild/revalidate remediation. Provider reachability remains
270
+ an operational `waiting` state. LM Studio is keyless when `apiKeyEnv` is omitted;
271
+ a declared but missing variable stays `waiting` and never retries keyless.
272
+ Changing provider, model, or dimension on an existing root requires a stopped,
273
+ config-aware `mono-agent memory rebuild --json`. BuJo uses the selected
274
+ embeddings service independently from its explicit capture LLM (`agent-host` in
275
+ generated configs, or an authored Ollama block). The advanced standalone
276
+ `memory-bujo migrate` command remains Ollama-only and outside guided init.
277
+ `retry` makes dead/delayed intake due for the
278
+ next store start; `resolve` explicitly abandons one item without claiming
279
+ capture succeeded, keeps permanent duplicate protection, and refuses a retained
280
+ semantic plan.
281
+
282
+ For launchd fleet verification, invoke the deployed CLI with each plist's exact
283
+ `ProgramArguments[0]` Node, `[1]` CLI, absolute `--config`/`--env-file`, and
284
+ managed `PATH`. Probe children retain only launchd-safe operational environment
285
+ values; shell-only `MONO_AGENT_*`, provider credentials, `NODE_OPTIONS`, and
286
+ proxy overrides are not fleet evidence. The current fleet contract is Node
287
+ `24.15.0`, modules ABI `137`; an ambient shell Node or environment is not
288
+ evidence that the service can load the native memory modules.
57
289
 
58
290
  Programmatic:
59
291
 
@@ -67,8 +299,8 @@ await app.stop();
67
299
 
68
300
  ## Public API
69
301
 
70
- - `startMonoAgentApp(options)` → `MonoAgentApp` (statuses, `applyConfigChange`,
71
- `startChannelIfConfigured`, `stop`).
302
+ - `startMonoAgentApp(options)` → `MonoAgentApp` (statuses, cached typed
303
+ `memoryHealth`, `applyConfigChange`, `startChannelIfConfigured`, `stop`).
72
304
  - `defaultChannelDrivers(overrides)` plus built-in per-channel
73
305
  `create<Channel>ChannelDriver(overrides)` factories with test seams.
74
306
  - `createConfiguredAgentRuntime`, `createConfiguredAgentHarness`,
@@ -76,10 +308,18 @@ await app.stop();
76
308
  transport-free programmatic composition from a loaded `MonoAgentConfig`.
77
309
  - `createBroadcastRunRecorder` for publishing recorder lifecycle events to a
78
310
  live run-event sink.
79
- - `initMonoAgentFolder(options)` / `validateMonoAgentFolder(options)`.
311
+ - `initMonoAgentFolder(options)` / `validateMonoAgentFolder(options)`. Init results
312
+ expose precise `changes`, `secretPersistence`, and canonical `identityRole`
313
+ created/preserved/planned outcomes; the compatibility `secretsPersisted` flag
314
+ is true only after a committed secret write.
80
315
  - `MONO_AGENT_APP_FIELD_GROUPS` and the `resolveApp*` traceability/artifact
81
316
  resolvers.
82
317
  - `runCli(argv)` / `parseCliArgs(argv)` backing the `mono-agent` bin.
318
+ - Managed configuration CLI lifecycle: macOS `mono-agent tui --configure`
319
+ against the background agent (`--local` is ordinary chat only), plus managed
320
+ project-skill drift/update through `install-skill --project`.
321
+ - Managed SRT lifecycle: `sandboxRuntimeStatus`, `setupManagedSrt`, and
322
+ `checkSandboxRuntime` (also exposed as `mono-agent sandbox status|setup|check`).
83
323
 
84
324
  ## Dependency Boundary
85
325
 
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Persistent service artifacts belong to the logged-in OS account, not an
3
+ * ambient HOME override that may differ between shells or launchd invocations.
4
+ */
5
+ export declare function accountHomeDirectory(): string;
6
+ //# sourceMappingURL=account-home.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-home.d.ts","sourceRoot":"","sources":["../src/account-home.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
@@ -0,0 +1,9 @@
1
+ import { userInfo } from "node:os";
2
+ /**
3
+ * Persistent service artifacts belong to the logged-in OS account, not an
4
+ * ambient HOME override that may differ between shells or launchd invocations.
5
+ */
6
+ export function accountHomeDirectory() {
7
+ return userInfo().homedir;
8
+ }
9
+ //# sourceMappingURL=account-home.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-home.js","sourceRoot":"","sources":["../src/account-home.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,QAAQ,EAAE,CAAC,OAAO,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,18 @@
1
+ export interface AdapterSendProxy {
2
+ readonly fetchImpl: typeof fetch;
3
+ close(): Promise<void>;
4
+ destroy(error?: Error): Promise<void>;
5
+ }
6
+ export interface AdapterSendProxyOptions {
7
+ /** Explicit configured endpoints that may need SRT's coarse loopback capability. */
8
+ readonly directLoopbackUrls?: readonly string[];
9
+ }
10
+ export declare function safeAdapterSendProxyErrorMessage(error: unknown, env?: Record<string, string | undefined>): string;
11
+ /**
12
+ * Build the adapter-send child's HTTP transport from its inherited proxy
13
+ * environment. The parent MCP spec deliberately does not copy these values:
14
+ * credentials stay in process environment state and never enter the serialized
15
+ * runtime/tool configuration.
16
+ */
17
+ export declare function createAdapterSendProxy(env?: Record<string, string | undefined>, options?: AdapterSendProxyOptions): AdapterSendProxy | undefined;
18
+ //# sourceMappingURL=adapter-send-proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-send-proxy.d.ts","sourceRoot":"","sources":["../src/adapter-send-proxy.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,OAAO,KAAK,CAAC;IACjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,uBAAuB;IACtC,oFAAoF;IACpF,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACjD;AAED,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,OAAO,EACd,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,MAAM,CAeR;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EACrD,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,GAAG,SAAS,CAoE9B"}
@@ -0,0 +1,229 @@
1
+ import { isIP } from "node:net";
2
+ import { Agent, Dispatcher, EnvHttpProxyAgent, fetch as undiciFetch, } from "undici";
3
+ export function safeAdapterSendProxyErrorMessage(error, env = process.env) {
4
+ let message = error instanceof Error ? error.message : String(error);
5
+ // Redact the exact environment values first. This also covers malformed
6
+ // proxy strings that cannot be recognized as URLs.
7
+ for (const name of ["http_proxy", "HTTP_PROXY", "https_proxy", "HTTPS_PROXY"]) {
8
+ const value = env[name]?.trim();
9
+ if (value !== undefined && value.length > 0) {
10
+ message = message.split(value).join("[redacted-proxy]");
11
+ }
12
+ }
13
+ return message
14
+ // URL userinfo is the normal shape of SRT's authenticated proxy secret.
15
+ .replace(/([a-z][a-z0-9+.-]*:\/\/)[^\s/@]+(?::[^\s/@]*)?@/giu, "$1[redacted]@")
16
+ // Defense in depth for diagnostics that spell the header rather than URL.
17
+ .replace(/(proxy-authorization\s*[:=]\s*)(?:\S+\s+)?\S+/giu, "$1[redacted]");
18
+ }
19
+ /**
20
+ * Build the adapter-send child's HTTP transport from its inherited proxy
21
+ * environment. The parent MCP spec deliberately does not copy these values:
22
+ * credentials stay in process environment state and never enter the serialized
23
+ * runtime/tool configuration.
24
+ */
25
+ export function createAdapterSendProxy(env = process.env, options = {}) {
26
+ const httpProxy = proxyEnvValue(env.http_proxy) ?? proxyEnvValue(env.HTTP_PROXY);
27
+ const httpsProxy = proxyEnvValue(env.https_proxy) ?? proxyEnvValue(env.HTTPS_PROXY);
28
+ if (httpProxy === undefined && httpsProxy === undefined) {
29
+ return undefined;
30
+ }
31
+ const noProxy = normalizeNoProxyValue(env.no_proxy ?? env.NO_PROXY);
32
+ const proxyDispatcher = new EnvHttpProxyAgent({
33
+ // Empty values prevent EnvHttpProxyAgent from consulting ambient process.env
34
+ // when a caller supplies an explicit environment snapshot (notably tests).
35
+ httpProxy: httpProxy ?? "",
36
+ httpsProxy: httpsProxy ?? "",
37
+ noProxy,
38
+ });
39
+ // Managed SRT's NO_PROXY always includes loopback. Keep that behavior for
40
+ // configured endpoints, but retain a dispatcher that cannot silently bypass
41
+ // the policy proxy when a redirect changes to an unconfigured loopback origin.
42
+ const forcedProxyDispatcher = new EnvHttpProxyAgent({
43
+ httpProxy: httpProxy ?? "",
44
+ httpsProxy: httpsProxy ?? "",
45
+ noProxy: "",
46
+ });
47
+ const directLoopbackOrigins = collectDirectLoopbackOrigins(options.directLoopbackUrls ?? []);
48
+ const directDispatcher = directLoopbackOrigins.size === 0 ? undefined : new Agent();
49
+ const requestDispatcher = new DirectLoopbackRoutingDispatcher(proxyDispatcher, forcedProxyDispatcher, directDispatcher, directLoopbackOrigins);
50
+ let closePromise;
51
+ let destroyPromise;
52
+ const fetchImpl = (async (input, init) => {
53
+ const { requestInit, detachAbortListener } = adaptFetchInit(init);
54
+ try {
55
+ return await undiciFetch(input, {
56
+ ...requestInit,
57
+ // Undici invokes this dispatcher again for every redirect hop. The
58
+ // wrapper therefore evaluates the actual dispatch origin instead of
59
+ // granting the initial URL's direct capability to the whole chain.
60
+ dispatcher: requestDispatcher,
61
+ });
62
+ }
63
+ finally {
64
+ detachAbortListener();
65
+ }
66
+ });
67
+ return {
68
+ fetchImpl,
69
+ close() {
70
+ return closePromise ??= Promise.all([
71
+ proxyDispatcher.close(),
72
+ forcedProxyDispatcher.close(),
73
+ ...(directDispatcher === undefined ? [] : [directDispatcher.close()]),
74
+ ]).then(() => undefined);
75
+ },
76
+ destroy(error) {
77
+ return destroyPromise ??= Promise.all([
78
+ error === undefined ? proxyDispatcher.destroy() : proxyDispatcher.destroy(error),
79
+ error === undefined ? forcedProxyDispatcher.destroy() : forcedProxyDispatcher.destroy(error),
80
+ ...(directDispatcher === undefined
81
+ ? []
82
+ : [error === undefined ? directDispatcher.destroy() : directDispatcher.destroy(error)]),
83
+ ]).then(() => undefined);
84
+ },
85
+ };
86
+ }
87
+ function normalizeNoProxyValue(value) {
88
+ const entries = (value ?? "")
89
+ .split(",")
90
+ .map((entry) => entry.trim())
91
+ .filter((entry) => entry.length > 0);
92
+ // SRT 0.0.64 emits bare ::1, while Undici 8 expects the bracketed URL-host
93
+ // spelling. Preserve SRT's list and add the compatible equivalent.
94
+ if (entries.includes("::1") && !entries.includes("[::1]"))
95
+ entries.push("[::1]");
96
+ return entries.join(",");
97
+ }
98
+ function collectDirectLoopbackOrigins(urls) {
99
+ const origins = new Set();
100
+ for (const value of urls) {
101
+ try {
102
+ const url = new URL(value);
103
+ const host = stripIpv6Brackets(url.hostname.toLowerCase());
104
+ if (isLoopbackHost(host))
105
+ origins.add(url.origin);
106
+ }
107
+ catch {
108
+ // The config loader owns URL diagnostics; an invalid endpoint must not
109
+ // accidentally become a direct-routing exception here.
110
+ }
111
+ }
112
+ return origins;
113
+ }
114
+ function loopbackOriginForDispatch(origin) {
115
+ try {
116
+ if (origin === undefined)
117
+ return undefined;
118
+ const url = new URL(String(origin));
119
+ const host = stripIpv6Brackets(url.hostname.toLowerCase());
120
+ return isLoopbackHost(host) ? url.origin : undefined;
121
+ }
122
+ catch {
123
+ return undefined;
124
+ }
125
+ }
126
+ class DirectLoopbackRoutingDispatcher extends Dispatcher {
127
+ proxyDispatcher;
128
+ forcedProxyDispatcher;
129
+ directDispatcher;
130
+ directLoopbackOrigins;
131
+ constructor(proxyDispatcher, forcedProxyDispatcher, directDispatcher, directLoopbackOrigins) {
132
+ super();
133
+ this.proxyDispatcher = proxyDispatcher;
134
+ this.forcedProxyDispatcher = forcedProxyDispatcher;
135
+ this.directDispatcher = directDispatcher;
136
+ this.directLoopbackOrigins = directLoopbackOrigins;
137
+ }
138
+ dispatch(options, handler) {
139
+ const loopbackOrigin = loopbackOriginForDispatch(options.origin);
140
+ if (loopbackOrigin !== undefined
141
+ && this.directDispatcher !== undefined
142
+ && this.directLoopbackOrigins.has(loopbackOrigin)) {
143
+ return this.directDispatcher.dispatch(options, handler);
144
+ }
145
+ // An unconfigured loopback origin must not inherit SRT's broad NO_PROXY
146
+ // exception. Send it to the authenticated policy proxy, which applies the
147
+ // actual sandbox destination allowlist. Non-loopback origins retain the
148
+ // caller's complete NO_PROXY semantics through `proxyDispatcher`.
149
+ return loopbackOrigin === undefined
150
+ ? this.proxyDispatcher.dispatch(options, handler)
151
+ : this.forcedProxyDispatcher.dispatch(options, handler);
152
+ }
153
+ }
154
+ function stripIpv6Brackets(host) {
155
+ return host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
156
+ }
157
+ function isLoopbackHost(host) {
158
+ return host === "localhost" || host === "::1" || (isIP(host) === 4 && host.split(".")[0] === "127");
159
+ }
160
+ function adaptFetchInit(init) {
161
+ const {
162
+ // grammY's Node fetch configuration includes these node-fetch-only fields.
163
+ // undici owns proxying through `dispatcher`, so forwarding `agent` would be
164
+ // both incompatible and ambiguous.
165
+ agent: _agent, compress: _compress, signal, ...rest } = (init ?? {});
166
+ const normalized = normalizeAbortSignal(signal);
167
+ const body = rest.body;
168
+ const requestInit = {
169
+ ...rest,
170
+ ...(normalized.signal === undefined ? {} : { signal: normalized.signal }),
171
+ ...(isStreamingBody(body) && rest.duplex === undefined ? { duplex: "half" } : {}),
172
+ };
173
+ return { requestInit, detachAbortListener: normalized.detach };
174
+ }
175
+ function normalizeAbortSignal(signal) {
176
+ if (signal === null || signal === undefined) {
177
+ return { detach: () => { } };
178
+ }
179
+ if (signal instanceof AbortSignal) {
180
+ return { signal, detach: () => { } };
181
+ }
182
+ // grammY uses an abort-controller shim whose signal is EventTarget-like but
183
+ // fails undici's native AbortSignal Web IDL conversion on Node 22. Mirror it
184
+ // into a native controller for the lifetime of this request.
185
+ const controller = new AbortController();
186
+ const abort = () => {
187
+ controller.abort(signal.reason);
188
+ };
189
+ if (signal.aborted) {
190
+ abort();
191
+ return { signal: controller.signal, detach: () => { } };
192
+ }
193
+ signal.addEventListener?.("abort", abort, { once: true });
194
+ return {
195
+ signal: controller.signal,
196
+ detach: () => {
197
+ signal.removeEventListener?.("abort", abort);
198
+ },
199
+ };
200
+ }
201
+ function isStreamingBody(body) {
202
+ if (body === null || body === undefined || typeof body !== "object") {
203
+ return false;
204
+ }
205
+ const candidate = body;
206
+ return typeof candidate[Symbol.asyncIterator] === "function"
207
+ || typeof candidate.pipe === "function"
208
+ || typeof candidate.getReader === "function";
209
+ }
210
+ function proxyEnvValue(value) {
211
+ const normalized = value?.trim();
212
+ if (normalized === undefined || normalized.length === 0)
213
+ return undefined;
214
+ try {
215
+ const url = new URL(normalized);
216
+ // Managed SRT advertises its authenticated policy proxy on localhost, but
217
+ // an external-only sandbox need not make hostname resolution available.
218
+ // The proxy itself is IPv4 loopback; use its numeric spelling without
219
+ // changing credentials, port, path, or any destination/NO_PROXY policy.
220
+ if (url.hostname === "localhost")
221
+ url.hostname = "127.0.0.1";
222
+ return url.href;
223
+ }
224
+ catch {
225
+ // Preserve Undici's authoritative invalid-proxy diagnostic.
226
+ return normalized;
227
+ }
228
+ }
229
+ //# sourceMappingURL=adapter-send-proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-send-proxy.js","sourceRoot":"","sources":["../src/adapter-send-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EACL,KAAK,EACL,UAAU,EACV,iBAAiB,EACjB,KAAK,IAAI,WAAW,GAGrB,MAAM,QAA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