@mono-agent/agent-app 0.6.2 → 0.8.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 (211) hide show
  1. package/README.md +210 -19
  2. package/dist/adapter-send-proxy.d.ts +18 -0
  3. package/dist/adapter-send-proxy.d.ts.map +1 -0
  4. package/dist/adapter-send-proxy.js +229 -0
  5. package/dist/adapter-send-proxy.js.map +1 -0
  6. package/dist/adapter-send-tools-main.js +62 -4
  7. package/dist/adapter-send-tools-main.js.map +1 -1
  8. package/dist/adapter-send-tools.d.ts +33 -6
  9. package/dist/adapter-send-tools.d.ts.map +1 -1
  10. package/dist/adapter-send-tools.js +485 -87
  11. package/dist/adapter-send-tools.js.map +1 -1
  12. package/dist/app-config.d.ts.map +1 -1
  13. package/dist/app-config.js +8 -0
  14. package/dist/app-config.js.map +1 -1
  15. package/dist/app.d.ts +2 -0
  16. package/dist/app.d.ts.map +1 -1
  17. package/dist/app.js +528 -135
  18. package/dist/app.js.map +1 -1
  19. package/dist/broadcast-recorder.d.ts.map +1 -1
  20. package/dist/broadcast-recorder.js +24 -2
  21. package/dist/broadcast-recorder.js.map +1 -1
  22. package/dist/channels.d.ts.map +1 -1
  23. package/dist/channels.js +16 -6
  24. package/dist/channels.js.map +1 -1
  25. package/dist/cli.d.ts +76 -4
  26. package/dist/cli.d.ts.map +1 -1
  27. package/dist/cli.js +2102 -102
  28. package/dist/cli.js.map +1 -1
  29. package/dist/config-reference.d.ts.map +1 -1
  30. package/dist/config-reference.js +195 -6
  31. package/dist/config-reference.js.map +1 -1
  32. package/dist/configuration-proposal-main.d.ts +3 -0
  33. package/dist/configuration-proposal-main.d.ts.map +1 -0
  34. package/dist/configuration-proposal-main.js +13 -0
  35. package/dist/configuration-proposal-main.js.map +1 -0
  36. package/dist/configuration-proposal-tool.d.ts +26 -0
  37. package/dist/configuration-proposal-tool.d.ts.map +1 -0
  38. package/dist/configuration-proposal-tool.js +139 -0
  39. package/dist/configuration-proposal-tool.js.map +1 -0
  40. package/dist/configured-agent.d.ts +12 -0
  41. package/dist/configured-agent.d.ts.map +1 -1
  42. package/dist/configured-agent.js +150 -18
  43. package/dist/configured-agent.js.map +1 -1
  44. package/dist/consumer-contract.d.ts +3 -0
  45. package/dist/consumer-contract.d.ts.map +1 -1
  46. package/dist/consumer-contract.js +44 -1
  47. package/dist/consumer-contract.js.map +1 -1
  48. package/dist/doctor.d.ts +27 -5
  49. package/dist/doctor.d.ts.map +1 -1
  50. package/dist/doctor.js +1197 -101
  51. package/dist/doctor.js.map +1 -1
  52. package/dist/first-run-managed-memory.d.ts +39 -0
  53. package/dist/first-run-managed-memory.d.ts.map +1 -0
  54. package/dist/first-run-managed-memory.js +521 -0
  55. package/dist/first-run-managed-memory.js.map +1 -0
  56. package/dist/first-run-readiness.d.ts +111 -0
  57. package/dist/first-run-readiness.d.ts.map +1 -0
  58. package/dist/first-run-readiness.js +757 -0
  59. package/dist/first-run-readiness.js.map +1 -0
  60. package/dist/index.d.ts +8 -3
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +4 -1
  63. package/dist/index.js.map +1 -1
  64. package/dist/init.d.ts +88 -3
  65. package/dist/init.d.ts.map +1 -1
  66. package/dist/init.js +1212 -23
  67. package/dist/init.js.map +1 -1
  68. package/dist/interaction-bridge.d.ts +25 -1
  69. package/dist/interaction-bridge.d.ts.map +1 -1
  70. package/dist/interaction-bridge.js +281 -19
  71. package/dist/interaction-bridge.js.map +1 -1
  72. package/dist/local-configuration.d.ts +56 -0
  73. package/dist/local-configuration.d.ts.map +1 -0
  74. package/dist/local-configuration.js +914 -0
  75. package/dist/local-configuration.js.map +1 -0
  76. package/dist/memory-command.d.ts +4 -0
  77. package/dist/memory-command.d.ts.map +1 -1
  78. package/dist/memory-command.js +751 -27
  79. package/dist/memory-command.js.map +1 -1
  80. package/dist/memory-recall.d.ts +38 -10
  81. package/dist/memory-recall.d.ts.map +1 -1
  82. package/dist/memory-recall.js +82 -25
  83. package/dist/memory-recall.js.map +1 -1
  84. package/dist/memory-retrieval.d.ts +66 -0
  85. package/dist/memory-retrieval.d.ts.map +1 -0
  86. package/dist/memory-retrieval.js +332 -0
  87. package/dist/memory-retrieval.js.map +1 -0
  88. package/dist/modules/base.d.ts +6 -5
  89. package/dist/modules/base.d.ts.map +1 -1
  90. package/dist/modules/base.js +11 -7
  91. package/dist/modules/base.js.map +1 -1
  92. package/dist/modules/catalog.d.ts.map +1 -1
  93. package/dist/modules/catalog.js +54 -20
  94. package/dist/modules/catalog.js.map +1 -1
  95. package/dist/modules/index.d.ts +2 -2
  96. package/dist/modules/index.d.ts.map +1 -1
  97. package/dist/modules/index.js +1 -1
  98. package/dist/modules/index.js.map +1 -1
  99. package/dist/modules/known-tools.d.ts +3 -0
  100. package/dist/modules/known-tools.d.ts.map +1 -1
  101. package/dist/modules/known-tools.js +11 -1
  102. package/dist/modules/known-tools.js.map +1 -1
  103. package/dist/modules/types.d.ts +20 -6
  104. package/dist/modules/types.d.ts.map +1 -1
  105. package/dist/modules/types.js.map +1 -1
  106. package/dist/package-version.d.ts +3 -0
  107. package/dist/package-version.d.ts.map +1 -0
  108. package/dist/package-version.js +14 -0
  109. package/dist/package-version.js.map +1 -0
  110. package/dist/pi-auth-store-inspection.d.ts +21 -0
  111. package/dist/pi-auth-store-inspection.d.ts.map +1 -0
  112. package/dist/pi-auth-store-inspection.js +120 -0
  113. package/dist/pi-auth-store-inspection.js.map +1 -0
  114. package/dist/pi-oauth-login-main.d.ts +3 -0
  115. package/dist/pi-oauth-login-main.d.ts.map +1 -0
  116. package/dist/pi-oauth-login-main.js +14 -0
  117. package/dist/pi-oauth-login-main.js.map +1 -0
  118. package/dist/pi-oauth-login.d.ts +22 -0
  119. package/dist/pi-oauth-login.d.ts.map +1 -0
  120. package/dist/pi-oauth-login.js +79 -0
  121. package/dist/pi-oauth-login.js.map +1 -0
  122. package/dist/project-skills.d.ts +40 -0
  123. package/dist/project-skills.d.ts.map +1 -0
  124. package/dist/project-skills.js +573 -0
  125. package/dist/project-skills.js.map +1 -0
  126. package/dist/provider-setup.d.ts +117 -2
  127. package/dist/provider-setup.d.ts.map +1 -1
  128. package/dist/provider-setup.js +1505 -49
  129. package/dist/provider-setup.js.map +1 -1
  130. package/dist/readiness-probe-worker.d.ts +12 -0
  131. package/dist/readiness-probe-worker.d.ts.map +1 -0
  132. package/dist/readiness-probe-worker.js +276 -0
  133. package/dist/readiness-probe-worker.js.map +1 -0
  134. package/dist/readiness-probe.d.ts +100 -0
  135. package/dist/readiness-probe.d.ts.map +1 -0
  136. package/dist/readiness-probe.js +780 -0
  137. package/dist/readiness-probe.js.map +1 -0
  138. package/dist/request-model-override.d.ts +43 -1
  139. package/dist/request-model-override.d.ts.map +1 -1
  140. package/dist/request-model-override.js +178 -19
  141. package/dist/request-model-override.js.map +1 -1
  142. package/dist/run-history.d.ts +32 -0
  143. package/dist/run-history.d.ts.map +1 -0
  144. package/dist/run-history.js +859 -0
  145. package/dist/run-history.js.map +1 -0
  146. package/dist/runs-health.d.ts.map +1 -1
  147. package/dist/runs-health.js +12 -4
  148. package/dist/runs-health.js.map +1 -1
  149. package/dist/runtime-option-extensions.d.ts +14 -0
  150. package/dist/runtime-option-extensions.d.ts.map +1 -0
  151. package/dist/runtime-option-extensions.js +98 -0
  152. package/dist/runtime-option-extensions.js.map +1 -0
  153. package/dist/runtime-routes.d.ts +9 -0
  154. package/dist/runtime-routes.d.ts.map +1 -0
  155. package/dist/runtime-routes.js +13 -0
  156. package/dist/runtime-routes.js.map +1 -0
  157. package/dist/sandbox-manager.d.ts +69 -0
  158. package/dist/sandbox-manager.d.ts.map +1 -0
  159. package/dist/sandbox-manager.js +856 -0
  160. package/dist/sandbox-manager.js.map +1 -0
  161. package/dist/supermemory-plugin.d.ts +54 -0
  162. package/dist/supermemory-plugin.d.ts.map +1 -0
  163. package/dist/supermemory-plugin.js +136 -0
  164. package/dist/supermemory-plugin.js.map +1 -0
  165. package/dist/tui-command.d.ts +15 -0
  166. package/dist/tui-command.d.ts.map +1 -1
  167. package/dist/tui-command.js +46 -6
  168. package/dist/tui-command.js.map +1 -1
  169. package/dist/web-command.d.ts +8 -0
  170. package/dist/web-command.d.ts.map +1 -1
  171. package/dist/web-command.js +174 -17
  172. package/dist/web-command.js.map +1 -1
  173. package/dist/wizard/answers.d.ts +31 -4
  174. package/dist/wizard/answers.d.ts.map +1 -1
  175. package/dist/wizard/answers.js +145 -16
  176. package/dist/wizard/answers.js.map +1 -1
  177. package/dist/wizard/from-flags.d.ts +7 -0
  178. package/dist/wizard/from-flags.d.ts.map +1 -1
  179. package/dist/wizard/from-flags.js +36 -2
  180. package/dist/wizard/from-flags.js.map +1 -1
  181. package/dist/wizard/index.d.ts +4 -4
  182. package/dist/wizard/index.d.ts.map +1 -1
  183. package/dist/wizard/index.js +2 -2
  184. package/dist/wizard/index.js.map +1 -1
  185. package/dist/wizard/model-discovery.d.ts +33 -2
  186. package/dist/wizard/model-discovery.d.ts.map +1 -1
  187. package/dist/wizard/model-discovery.js +826 -108
  188. package/dist/wizard/model-discovery.js.map +1 -1
  189. package/dist/wizard/presets.d.ts +1 -1
  190. package/dist/wizard/presets.d.ts.map +1 -1
  191. package/dist/wizard/presets.js +7 -12
  192. package/dist/wizard/presets.js.map +1 -1
  193. package/dist/wizard/prompts.d.ts +56 -9
  194. package/dist/wizard/prompts.d.ts.map +1 -1
  195. package/dist/wizard/prompts.js +172 -20
  196. package/dist/wizard/prompts.js.map +1 -1
  197. package/dist/wizard/run.d.ts +59 -3
  198. package/dist/wizard/run.d.ts.map +1 -1
  199. package/dist/wizard/run.js +1133 -191
  200. package/dist/wizard/run.js.map +1 -1
  201. package/package.json +21 -16
  202. package/resources/srt/package-lock.json +66 -0
  203. package/resources/srt/package.json +9 -0
  204. package/schema/mono-agent.config.schema.json +381 -17
  205. package/skills/mono-agent-composer/SKILL.md +4 -4
  206. package/skills/mono-agent-composer/references/config-blueprint.md +5 -4
  207. package/skills/mono-agent-composer/references/discovery-questions.md +8 -8
  208. package/skills/mono-agent-composer/references/feature-coverage.md +8 -6
  209. package/skills/mono-agent-composer/references/package-map.md +1 -1
  210. package/skills/mono-agent-composer/references/playbooks.md +8 -7
  211. package/skills/mono-agent-composer/references/validation.md +1 -1
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-local configuration
33
+ 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,198 @@ 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 a concise purpose and composes the capability selection before writing anything. 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. Searchable primary/fallback pickers combine every bundled model
72
+ for the guided Pi providers (Anthropic, GitHub Copilot, OpenAI Codex, and
73
+ OpenCode-Go), Codex's live account catalog, the Claude SDK catalog, and local
74
+ discovery. The live Codex provider default leads when available; offline setup
75
+ falls back to curated `codex:gpt-5.6-terra` without guessing effort metadata, so
76
+ only **Provider default** is offered until live `model/list` succeeds. GPT-5.6 Sol is selectable as
77
+ `codex:gpt-5.6-sol` or `pi:openai-codex:gpt-5.6-sol`.
78
+ OpenCode-Go Pi refs can save `OPENCODE_API_KEY` into
79
+ the Pi auth store or remain environment-provided, and any number of fallback
80
+ models are selected from the same discovered choices one at a time. Each route
81
+ offers only its advertised effort values plus **Provider default**. Standalone
82
+ `mono-agent auth login anthropic` keeps its localhost callback active while
83
+ also reading a pasted final redirect URL through Pi's code/state-validating
84
+ OAuth implementation. `mono-agent auth login opencode-go` uses a masked TTY prompt; headless callers
85
+ must opt in to one-line redirected input with `--api-key-stdin`. Any flag (or a piped/non-TTY
86
+ invocation) takes the silent default/preset scaffold path instead; add `--auth`
87
+ to run supported provider setup in that non-interactive path. Required selected
88
+ channel secrets are masked and never enter config JSON, examples, review output,
89
+ or logs. Durable provider credentials already in `.env` are secured by the same
90
+ preflight. POSIX persistence is owner-only (`0600`), preserves existing dotenv
91
+ values/comments, and uses an external lock plus no-clobber promotion with exact
92
+ ignore rules for `.env` and transaction artifacts. The canonical agent directory
93
+ must be current-user-owned and not group/world-writable; existing `.env` and
94
+ `.gitignore` files must be current-user-owned with one link, and the ignore guard
95
+ loses group/world write access. Pathname competitors are
96
+ protected; the claimed inode is rechecked and detected open-descriptor writes are
97
+ retained in a reported recovery copy (writes after the final POSIX check remain
98
+ non-cooperative); unsafe/tracked/foreign-owned/multiply-linked
99
+ paths, stale locks, invalid dotenv, conflicts, and Windows fail closed to manual setup. Before the
100
+ interactive wizard opens the local TUI it requires one disposable no-tool
101
+ response from every selected runtime route and a complete validation report with
102
+ every selected expectation ready. Cancellation, provider failure, timeout (90s
103
+ cloud / 240s local per route), empty output, or any tool action fails the check.
104
+ Escape or Ctrl-C interrupts preflight; recovery can resume verified routes when
105
+ the non-secret plan fingerprint still matches, restart all checks, edit choices,
106
+ or cancel. Authentication repair clears every prior route proof because it can
107
+ replace credential bytes. Guided commit atomically
108
+ creates the config and rechecks its exact snapshot after validation and before
109
+ opening `mono-agent tui --local --configure`. This builds the current-folder
110
+ responder in-process and never creates launchd state. Saving after failure is
111
+ explicitly incomplete and never auto-starts.
112
+
113
+ Every scaffold selects versioned `mono-agent-configure` and `mono-agent-memory`
114
+ skills from `./skills` with index disclosure. `ReadSkill` remains separate from
115
+ action-tool policy. `mono-agent install-skill --project --check|--update` reports
116
+ version/hash drift and refreshes only unchanged managed copies with backups; a
117
+ canonical owner-only non-symlink parent chain, per-project owner lock, and
118
+ compare-and-swap activation prevent outside or concurrent
119
+ operator edits from being overwritten, and a partial activation restores only
120
+ files that still equal the managed bytes it wrote.
121
+
122
+ In a marked local configuration turn only, the app injects proposal-only
123
+ `ProposeAgentConfiguration`. The host accepts only a fail-closed low-risk
124
+ allowlist: public name; effort, turn/session UX; selected project skills and
125
+ disclosure; memory size or MemoryRecall enablement; semantic tool-policy
126
+ tightening; and the separately validated Role body. Every path, memory-tier or
127
+ capture-cost change, runtime/provider route, channel/proactive/plugin, MCP,
128
+ exporter, embeddings/LLM endpoint, sandbox/network field, secret, and unknown
129
+ future field is handed to the explicit guided flow. It canonicalizes
130
+ config/Identity/state paths without following symlink parents, stages and
131
+ fsyncs replacements, then performs the final source comparison and rename as
132
+ one non-yielding commit step under an owner-only transaction lock. Separate TUI
133
+ confirmation, failure-atomic config/Role rollback compensation, rollback
134
+ evidence, and a fresh responder remain mandatory. Configuration turns replace
135
+ the ordinary tool/MCP policy with `ReadSkill`, `MemoryRecall`, and the proposal
136
+ tool only; direct providers that cannot project a finite list run in their
137
+ native read-only plan posture. Fast follow-ups wait through responder rotation.
138
+ Remote/proactive channels never receive this tool.
139
+
140
+ Guided readiness uses a worker-reproducible environment rather than the launching
141
+ shell: durable `.env` values, entered selected secrets, the resolved Pi auth path,
142
+ and operational values such as `PATH`/`HOME`. Shell-only provider credentials and
143
+ config overrides cannot create a success that launchd cannot reproduce; persisted
144
+ non-secret `MONO_AGENT_*` overrides are rejected by name.
145
+
146
+ Direct Codex discovery checks the executable, login status, and live app-server
147
+ model catalog without equating catalog availability with authentication or a
148
+ verified turn. Missing Codex setup points to the official instructions at
149
+ <https://developers.openai.com/codex/cli/>; the app never auto-installs it. The
150
+ wizard offers browser callback and headless device-code login. Detected credentials
151
+ skip redundant authentication but remain unverified until the exact route call
152
+ successfully runs. Guided Pi setup covers Anthropic, GitHub Copilot, OpenAI Codex,
153
+ and OpenCode-Go; other hand-authored Pi and local-provider configs remain compatible
154
+ without being advertised as guided cloud integrations. Supported OAuth methods and
155
+ the OpenCode-Go key flow come from the bundled upstream catalog;
156
+ stale auth locks are repaired only when the recorded process is securely proven
157
+ gone. The
158
+ wizard keeps **Allow all tools** as its default. Pi/Claude flows disclose
159
+ shell/file/web/channel effects and reconfirm an unsandboxed choice. Direct Codex
160
+ fixes policy to exact allow-all, uses its native network-off workspace sandbox,
161
+ denies unattended escalations, and fails unexpected server requests promptly.
162
+ Mixed chains are unrestricted only under explicit `runtime.routeSafety:
163
+ "per-route-native"`, which isolates provider runtimes and applies a documented
164
+ route-local contract. The default `uniform` mode keeps one common monotonic
165
+ contract and rejects/skips routes that cannot represent it. Pi keeps mono-agent
166
+ tool policy and optional SRT; Claude uses representable provider-native controls;
167
+ direct Codex/OpenCode use provider-native safety plus exact allow-all. No route
168
+ silently drops a required capability. Pi `pi:opencode-go:*` remains a Pi route.
169
+ Direct OpenCode also requires exact allow-all; restrictive static policies fail
170
+ validation/runtime and an incompatible dynamic override is warned and ignored.
171
+
172
+ `RunHistory` requires no config key. It is automatically available under
173
+ allow-all on MCP-capable routes; a restrictive `tools.allowedTools` must name
174
+ `RunHistory` explicitly (`run_history` remains a deprecated input alias), and
175
+ `disallowedTools` can remove it. Direct OpenCode and other MCP-incompatible
176
+ routes suppress it. Its `list` and `inspect` actions can read only completed
177
+ prior runs in the exact current conversation bucket and return bounded,
178
+ redacted, normalized evidence. They exclude the current/running run, other
179
+ conversations or rollover buckets, system prompts, reasoning, recalled memory,
180
+ turn-context payloads, and raw artifact paths; historical text is marked
181
+ untrusted.
182
+
183
+ For missing context, the agent should use active conversation history first,
184
+ `MemoryRecall` for intentionally captured durable facts, and `RunHistory` for
185
+ exact prior-run/tool evidence. Completed blocking `AskUser` and
186
+ `TelegramAskButtons` exchanges are written into the assistant history copy
187
+ before the final response, explicitly labelled as untrusted historical data and
188
+ bounded by newest whole interactions, without changing the outward message or
189
+ long-term memory capture. `TelegramAskButtons` with `wait: false` continues to produce a
190
+ synthetic next turn when the user taps later.
191
+
192
+ The app publishes a cached, content-free `memoryHealth` snapshot in the primary
193
+ trace-source heartbeat and any enabled best-effort global mirror. Built-in
194
+ health is computed through a dynamic memory import so a native SQLite ABI
195
+ failure becomes sanitized `unknown` health
196
+ instead of crashing unrelated CLI startup. Concurrent refreshes coalesce; in
197
+ steady state, ordinary trace events and the completion-based timer never run a
198
+ full audit less than 30 seconds after the prior completion. Startup and reload
199
+ make one explicit post-lifecycle exception so the registered snapshot reflects
200
+ the newly started store. The timer is unreferenced and invalidated at
201
+ stop/reconfigure entry, and the same
202
+ snapshot is used for both registries. The shape is limited to backend/mode,
203
+ closed status and issue vocabularies, ISO check time, and eight whitelisted
204
+ counts—never paths, ids, content, payloads, or raw errors.
205
+
206
+ Unexpected built-in audit failures use the stable `health_check_failed` issue,
207
+ while durable work that exceeds its ownership grace uses `work_stalled`; both
208
+ are fixed metadata-only classifications.
209
+
210
+ Operator automation should use:
211
+
212
+ ```bash
213
+ # One prose/ANSI-free {ok:boolean, sections, ...} object; exit 0 iff ok.
214
+ mono-agent validate --json
215
+
216
+ # Provider-free closed health; healthy/in_progress/not_configured exit 0.
217
+ mono-agent memory audit --strict --json
218
+
219
+ # Payload-free inventory; mutations require the matching agent to be stopped.
220
+ mono-agent memory inspect --json
221
+ mono-agent memory retry --json
222
+ mono-agent memory retry <64-character-id> --json
223
+ mono-agent memory resolve <64-character-id> <reason-slug> --json
224
+ ```
225
+
226
+ Journal and BuJo always require a valid managed `.index/manifest.json`; only
227
+ Lite may remain unmanaged. Missing/corrupt authority, active/configured
228
+ tier-model-dimension mismatch, and native-module/ABI failure are validation
229
+ errors with stop/rebuild/revalidate remediation. Provider reachability remains
230
+ an operational `waiting` state. `retry` makes dead/delayed intake due for the
231
+ next store start; `resolve` explicitly abandons one item without claiming
232
+ capture succeeded, keeps permanent duplicate protection, and refuses a retained
233
+ semantic plan.
234
+
235
+ For launchd fleet verification, invoke the deployed CLI with each plist's exact
236
+ `ProgramArguments[0]` Node, `[1]` CLI, absolute `--config`/`--env-file`, and
237
+ managed `PATH`. Probe children retain only launchd-safe operational environment
238
+ values; shell-only `MONO_AGENT_*`, provider credentials, `NODE_OPTIONS`, and
239
+ proxy overrides are not fleet evidence. The current fleet contract is Node
240
+ `24.15.0`, modules ABI `137`; an ambient shell Node or environment is not
241
+ evidence that the service can load the native memory modules.
57
242
 
58
243
  Programmatic:
59
244
 
@@ -67,8 +252,8 @@ await app.stop();
67
252
 
68
253
  ## Public API
69
254
 
70
- - `startMonoAgentApp(options)` → `MonoAgentApp` (statuses, `applyConfigChange`,
71
- `startChannelIfConfigured`, `stop`).
255
+ - `startMonoAgentApp(options)` → `MonoAgentApp` (statuses, cached typed
256
+ `memoryHealth`, `applyConfigChange`, `startChannelIfConfigured`, `stop`).
72
257
  - `defaultChannelDrivers(overrides)` plus built-in per-channel
73
258
  `create<Channel>ChannelDriver(overrides)` factories with test seams.
74
259
  - `createConfiguredAgentRuntime`, `createConfiguredAgentHarness`,
@@ -76,10 +261,16 @@ await app.stop();
76
261
  transport-free programmatic composition from a loaded `MonoAgentConfig`.
77
262
  - `createBroadcastRunRecorder` for publishing recorder lifecycle events to a
78
263
  live run-event sink.
79
- - `initMonoAgentFolder(options)` / `validateMonoAgentFolder(options)`.
264
+ - `initMonoAgentFolder(options)` / `validateMonoAgentFolder(options)`. Init results
265
+ expose precise `changes` and `secretPersistence` outcomes; the compatibility
266
+ `secretsPersisted` flag is true only after a committed secret write.
80
267
  - `MONO_AGENT_APP_FIELD_GROUPS` and the `resolveApp*` traceability/artifact
81
268
  resolvers.
82
269
  - `runCli(argv)` / `parseCliArgs(argv)` backing the `mono-agent` bin.
270
+ - Local configuration CLI lifecycle: `mono-agent tui --local [--configure]` and
271
+ managed project-skill drift/update through `install-skill --project`.
272
+ - Managed SRT lifecycle: `sandboxRuntimeStatus`, `setupManagedSrt`, and
273
+ `checkSandboxRuntime` (also exposed as `mono-agent sandbox status|setup|check`).
83
274
 
84
275
  ## Dependency Boundary
85
276
 
@@ -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
@@ -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jD,CAAC;AAED,SAAS,aAAa,CAAC,KAAyB;IAC9C,MAAM,UAAU,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IACjC,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1E,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;QAChC,0EAA0E;QAC1E,wEAAwE;QACxE,sEAAsE;QACtE,wEAAwE;QACxE,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW;YAAE,GAAG,CAAC,QAAQ,GAAG,WAAW,CAAC;QAC7D,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,4DAA4D;QAC5D,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC"}
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+ import { createAdapterSendProxy, safeAdapterSendProxyErrorMessage, } from "./adapter-send-proxy.js";
3
4
  import { adapterSendToolsChildConfigFromEnv, createAdapterSendToolsClients, createAdapterSendToolsServer, resolveAdapterSendToolsSettings, } from "./adapter-send-tools.js";
4
5
  async function main() {
5
6
  const childConfig = adapterSendToolsChildConfigFromEnv(process.env, process.cwd());
@@ -9,12 +10,69 @@ async function main() {
9
10
  if (settings === undefined) {
10
11
  throw new Error("no adapter send tools configured.");
11
12
  }
12
- const clients = await createAdapterSendToolsClients(settings);
13
- const server = await createAdapterSendToolsServer(settings, clients, childConfig.indexing);
14
- await server.connect(new StdioServerTransport());
13
+ const proxy = createAdapterSendProxy(process.env, {
14
+ directLoopbackUrls: [
15
+ settings.telegram?.apiRoot,
16
+ settings.telegram?.askBridge?.bridgeUrl,
17
+ settings.askUser?.bridgeUrl,
18
+ ].filter((value) => value !== undefined),
19
+ });
20
+ const removeProxyLifecycle = proxy === undefined ? () => { } : installProxyLifecycle(proxy);
21
+ try {
22
+ const httpOptions = proxy === undefined ? {} : { fetchImpl: proxy.fetchImpl };
23
+ const clients = await createAdapterSendToolsClients(settings, httpOptions);
24
+ const server = await createAdapterSendToolsServer(settings, clients, childConfig.indexing, httpOptions);
25
+ await server.connect(new StdioServerTransport());
26
+ }
27
+ catch (error) {
28
+ removeProxyLifecycle();
29
+ await proxy?.destroy().catch((closeError) => {
30
+ logProxyShutdownError(closeError);
31
+ });
32
+ throw error;
33
+ }
34
+ }
35
+ function installProxyLifecycle(proxy) {
36
+ let gracefulShutdown;
37
+ let forcedShutdown;
38
+ const shutdown = (force, exitAfter) => {
39
+ const operation = force
40
+ ? (forcedShutdown ??= proxy.destroy())
41
+ : (gracefulShutdown ??= proxy.close());
42
+ void operation
43
+ .catch((error) => {
44
+ logProxyShutdownError(error);
45
+ })
46
+ .finally(() => {
47
+ if (exitAfter)
48
+ process.exit(0);
49
+ });
50
+ };
51
+ const onStdinEnd = () => {
52
+ shutdown(false, false);
53
+ };
54
+ const onSignal = () => {
55
+ // Installing signal handlers replaces Node's default termination behavior,
56
+ // so destroy active requests and exit explicitly once the dispatcher drains.
57
+ shutdown(true, true);
58
+ };
59
+ process.stdin.once("end", onStdinEnd);
60
+ process.once("SIGINT", onSignal);
61
+ process.once("SIGTERM", onSignal);
62
+ return () => {
63
+ process.stdin.off("end", onStdinEnd);
64
+ process.off("SIGINT", onSignal);
65
+ process.off("SIGTERM", onSignal);
66
+ };
67
+ }
68
+ function logProxyShutdownError(error) {
69
+ void error;
70
+ // Dispatcher errors can include the proxy URL. Keep credentials out of MCP
71
+ // stderr even when the underlying client reports an unsafe diagnostic.
72
+ process.stderr.write("mono-agent-adapter-send-tools: proxy shutdown failed.\n");
15
73
  }
16
74
  main().catch((error) => {
17
- process.stderr.write(`mono-agent-adapter-send-tools: fatal: ${error instanceof Error ? error.message : String(error)}\n`);
75
+ process.stderr.write(`mono-agent-adapter-send-tools: fatal: ${safeAdapterSendProxyErrorMessage(error)}\n`);
18
76
  process.exitCode = 1;
19
77
  });
20
78
  //# sourceMappingURL=adapter-send-tools-main.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter-send-tools-main.js","sourceRoot":"","sources":["../src/adapter-send-tools-main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EACL,kCAAkC,EAClC,6BAA6B,EAC7B,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AAEjC,KAAK,UAAU,IAAI;IACjB,MAAM,WAAW,GAAG,kCAAkC,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACnF,MAAM,QAAQ,GAAG,MAAM,+BAA+B,CAAC,WAAW,CAAC,KAAK,EAAE;QACxE,YAAY,EAAE,WAAW,CAAC,YAAY;KACvC,CAAC,CAAC;IACH,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,MAAM,4BAA4B,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC3F,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1H,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
1
+ {"version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