milaidy 1.0.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 (253) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +538 -0
  3. package/dist/argv-CfSowvEA.js +63 -0
  4. package/dist/config-B-mboG4v.js +4 -0
  5. package/dist/eliza-CPJjgw-e.js +1491 -0
  6. package/dist/eliza.js +2192 -0
  7. package/dist/entry.js +232 -0
  8. package/dist/index.js +209 -0
  9. package/dist/links-BFKlWqSe.js +15 -0
  10. package/dist/paths-D_yh1DEJ.js +69 -0
  11. package/dist/plugins-cli-B7kSre2c.js +134 -0
  12. package/dist/program-6KwWwKKh.js +510 -0
  13. package/dist/register.agents-CPVmSjMG.js +17 -0
  14. package/dist/register.browser-B2ooXxNx.js +15 -0
  15. package/dist/register.channels-CMYQ6K6Y.js +42 -0
  16. package/dist/register.cron-D91lY1_Y.js +9 -0
  17. package/dist/register.devices-rU5I5L_y.js +13 -0
  18. package/dist/register.gateway-82SLAvw3.js +22 -0
  19. package/dist/register.hooks-B_XTBEkt.js +9 -0
  20. package/dist/register.logs-BgEGcPd8.js +10 -0
  21. package/dist/register.models-BJt9eVgZ.js +26 -0
  22. package/dist/register.nodes-B5xY1s8a.js +9 -0
  23. package/dist/register.skills-SFQqYIhg.js +10 -0
  24. package/dist/register.subclis-uF_AsbWR.js +187 -0
  25. package/dist/run-main-XODklzS-.js +56 -0
  26. package/dist/theme-DBvtuGeq.js +36 -0
  27. package/dist/utils-C1AUpp_V.js +42 -0
  28. package/dist/version-Cpn3yr5D.js +26 -0
  29. package/dist/workspace-Co3Wul2D.js +206 -0
  30. package/dist/workspace-DCA6MNVK.js +350 -0
  31. package/docs/.i18n/README.md +31 -0
  32. package/docs/.i18n/glossary.zh-CN.json +210 -0
  33. package/docs/.i18n/zh-CN.tm.jsonl +1329 -0
  34. package/docs/CNAME +1 -0
  35. package/docs/automation/cron-jobs.md +468 -0
  36. package/docs/automation/cron-vs-heartbeat.md +254 -0
  37. package/docs/automation/gmail-pubsub.md +256 -0
  38. package/docs/automation/poll.md +69 -0
  39. package/docs/automation/webhook.md +163 -0
  40. package/docs/bedrock.md +176 -0
  41. package/docs/brave-search.md +41 -0
  42. package/docs/broadcast-groups.md +442 -0
  43. package/docs/cli/acp.md +170 -0
  44. package/docs/cli/agent.md +24 -0
  45. package/docs/cli/agents.md +75 -0
  46. package/docs/cli/approvals.md +50 -0
  47. package/docs/cli/browser.md +107 -0
  48. package/docs/cli/channels.md +79 -0
  49. package/docs/cli/config.md +50 -0
  50. package/docs/cli/configure.md +33 -0
  51. package/docs/cli/cron.md +42 -0
  52. package/docs/cli/dashboard.md +16 -0
  53. package/docs/cli/devices.md +67 -0
  54. package/docs/cli/directory.md +63 -0
  55. package/docs/cli/dns.md +23 -0
  56. package/docs/cli/docs.md +15 -0
  57. package/docs/cli/doctor.md +41 -0
  58. package/docs/cli/gateway.md +199 -0
  59. package/docs/cli/health.md +21 -0
  60. package/docs/cli/hooks.md +291 -0
  61. package/docs/cli/index.md +1029 -0
  62. package/docs/cli/logs.md +24 -0
  63. package/docs/cli/memory.md +45 -0
  64. package/docs/cli/message.md +239 -0
  65. package/docs/cli/models.md +79 -0
  66. package/docs/cli/node.md +112 -0
  67. package/docs/cli/nodes.md +73 -0
  68. package/docs/cli/onboard.md +29 -0
  69. package/docs/cli/pairing.md +21 -0
  70. package/docs/cli/plugins.md +62 -0
  71. package/docs/cli/reset.md +17 -0
  72. package/docs/cli/sandbox.md +152 -0
  73. package/docs/cli/security.md +26 -0
  74. package/docs/cli/sessions.md +16 -0
  75. package/docs/cli/setup.md +29 -0
  76. package/docs/cli/skills.md +26 -0
  77. package/docs/cli/status.md +26 -0
  78. package/docs/cli/system.md +60 -0
  79. package/docs/cli/tui.md +23 -0
  80. package/docs/cli/uninstall.md +17 -0
  81. package/docs/cli/update.md +98 -0
  82. package/docs/cli/voicecall.md +34 -0
  83. package/docs/cli/webhooks.md +25 -0
  84. package/docs/concepts/agent-loop.md +146 -0
  85. package/docs/concepts/agent-workspace.md +229 -0
  86. package/docs/concepts/agent.md +122 -0
  87. package/docs/concepts/architecture.md +129 -0
  88. package/docs/concepts/channel-routing.md +114 -0
  89. package/docs/concepts/compaction.md +61 -0
  90. package/docs/concepts/context.md +159 -0
  91. package/docs/concepts/features.md +53 -0
  92. package/docs/concepts/group-messages.md +84 -0
  93. package/docs/concepts/groups.md +373 -0
  94. package/docs/concepts/markdown-formatting.md +130 -0
  95. package/docs/concepts/memory.md +546 -0
  96. package/docs/concepts/messages.md +154 -0
  97. package/docs/concepts/model-failover.md +149 -0
  98. package/docs/concepts/model-providers.md +315 -0
  99. package/docs/concepts/models.md +208 -0
  100. package/docs/concepts/multi-agent.md +376 -0
  101. package/docs/concepts/oauth.md +145 -0
  102. package/docs/concepts/plugins.md +454 -0
  103. package/docs/concepts/presence.md +102 -0
  104. package/docs/concepts/queue.md +89 -0
  105. package/docs/concepts/retry.md +69 -0
  106. package/docs/concepts/secrets.md +300 -0
  107. package/docs/concepts/session-pruning.md +122 -0
  108. package/docs/concepts/session-tool.md +193 -0
  109. package/docs/concepts/session.md +188 -0
  110. package/docs/concepts/sessions.md +10 -0
  111. package/docs/concepts/skills.md +392 -0
  112. package/docs/concepts/streaming.md +135 -0
  113. package/docs/concepts/system-prompt.md +114 -0
  114. package/docs/concepts/timezone.md +91 -0
  115. package/docs/concepts/typebox.md +289 -0
  116. package/docs/concepts/typing-indicators.md +68 -0
  117. package/docs/concepts/usage-tracking.md +35 -0
  118. package/docs/custom.css +4 -0
  119. package/docs/date-time.md +128 -0
  120. package/docs/debugging.md +162 -0
  121. package/docs/docs.json +1599 -0
  122. package/docs/environment.md +81 -0
  123. package/docs/hooks.md +876 -0
  124. package/docs/index.md +179 -0
  125. package/docs/install/ansible.md +208 -0
  126. package/docs/install/bun.md +59 -0
  127. package/docs/install/development-channels.md +75 -0
  128. package/docs/install/docker.md +567 -0
  129. package/docs/install/index.md +185 -0
  130. package/docs/install/installer.md +123 -0
  131. package/docs/install/migrating.md +192 -0
  132. package/docs/install/nix.md +96 -0
  133. package/docs/install/node.md +78 -0
  134. package/docs/install/uninstall.md +128 -0
  135. package/docs/install/updating.md +228 -0
  136. package/docs/logging.md +350 -0
  137. package/docs/multi-agent-sandbox-tools.md +395 -0
  138. package/docs/network.md +54 -0
  139. package/docs/nodes/audio.md +114 -0
  140. package/docs/nodes/camera.md +156 -0
  141. package/docs/nodes/images.md +72 -0
  142. package/docs/nodes/index.md +341 -0
  143. package/docs/nodes/location-command.md +113 -0
  144. package/docs/nodes/media-understanding.md +379 -0
  145. package/docs/nodes/talk.md +90 -0
  146. package/docs/nodes/voicewake.md +65 -0
  147. package/docs/northflank.mdx +53 -0
  148. package/docs/perplexity.md +80 -0
  149. package/docs/platforms/android.md +129 -0
  150. package/docs/platforms/digitalocean.md +262 -0
  151. package/docs/platforms/exe-dev.md +125 -0
  152. package/docs/platforms/fly.md +486 -0
  153. package/docs/platforms/gcp.md +503 -0
  154. package/docs/platforms/hetzner.md +330 -0
  155. package/docs/platforms/index.md +53 -0
  156. package/docs/platforms/ios.md +106 -0
  157. package/docs/platforms/linux.md +94 -0
  158. package/docs/platforms/mac/bundled-gateway.md +73 -0
  159. package/docs/platforms/mac/canvas.md +125 -0
  160. package/docs/platforms/mac/child-process.md +69 -0
  161. package/docs/platforms/mac/dev-setup.md +102 -0
  162. package/docs/platforms/mac/health.md +34 -0
  163. package/docs/platforms/mac/icon.md +31 -0
  164. package/docs/platforms/mac/logging.md +57 -0
  165. package/docs/platforms/mac/menu-bar.md +81 -0
  166. package/docs/platforms/mac/peekaboo.md +65 -0
  167. package/docs/platforms/mac/permissions.md +44 -0
  168. package/docs/platforms/mac/release.md +85 -0
  169. package/docs/platforms/mac/remote.md +83 -0
  170. package/docs/platforms/mac/signing.md +47 -0
  171. package/docs/platforms/mac/skills.md +33 -0
  172. package/docs/platforms/mac/voice-overlay.md +60 -0
  173. package/docs/platforms/mac/voicewake.md +67 -0
  174. package/docs/platforms/mac/webchat.md +41 -0
  175. package/docs/platforms/mac/xpc.md +61 -0
  176. package/docs/platforms/macos-vm.md +281 -0
  177. package/docs/platforms/macos.md +203 -0
  178. package/docs/platforms/oracle.md +303 -0
  179. package/docs/platforms/raspberry-pi.md +358 -0
  180. package/docs/platforms/windows.md +159 -0
  181. package/docs/plugin.md +651 -0
  182. package/docs/plugins/agent-tools.md +99 -0
  183. package/docs/plugins/manifest.md +71 -0
  184. package/docs/plugins/voice-call.md +273 -0
  185. package/docs/plugins/zalouser.md +70 -0
  186. package/docs/providers/anthropic.md +152 -0
  187. package/docs/providers/claude-max-api-proxy.md +148 -0
  188. package/docs/providers/cloudflare-ai-gateway.md +71 -0
  189. package/docs/providers/deepgram.md +93 -0
  190. package/docs/providers/glm.md +33 -0
  191. package/docs/providers/index.md +63 -0
  192. package/docs/providers/minimax.md +208 -0
  193. package/docs/providers/models.md +51 -0
  194. package/docs/providers/moonshot.md +142 -0
  195. package/docs/providers/ollama.md +223 -0
  196. package/docs/providers/openai.md +62 -0
  197. package/docs/providers/opencode.md +36 -0
  198. package/docs/providers/openrouter.md +37 -0
  199. package/docs/providers/qwen.md +53 -0
  200. package/docs/providers/synthetic.md +99 -0
  201. package/docs/providers/venice.md +267 -0
  202. package/docs/providers/vercel-ai-gateway.md +50 -0
  203. package/docs/providers/xiaomi.md +64 -0
  204. package/docs/providers/zai.md +36 -0
  205. package/docs/railway.mdx +99 -0
  206. package/docs/reference/templates/AGENTS.md +9 -0
  207. package/docs/reference/templates/BOOTSTRAP.md +3 -0
  208. package/docs/reference/templates/HEARTBEAT.md +3 -0
  209. package/docs/reference/templates/IDENTITY.md +3 -0
  210. package/docs/reference/templates/TOOLS.md +3 -0
  211. package/docs/reference/templates/USER.md +3 -0
  212. package/docs/render.mdx +165 -0
  213. package/docs/start/docs-directory.md +63 -0
  214. package/docs/start/getting-started.md +212 -0
  215. package/docs/start/milaidy.md +247 -0
  216. package/docs/start/onboarding.md +258 -0
  217. package/docs/start/pairing.md +86 -0
  218. package/docs/start/quickstart.md +81 -0
  219. package/docs/start/setup.md +149 -0
  220. package/docs/start/showcase.md +416 -0
  221. package/docs/start/wizard.md +418 -0
  222. package/docs/testing.md +368 -0
  223. package/docs/token-use.md +112 -0
  224. package/docs/tools/agent-send.md +53 -0
  225. package/docs/tools/apply-patch.md +50 -0
  226. package/docs/tools/browser-linux-troubleshooting.md +139 -0
  227. package/docs/tools/browser-login.md +68 -0
  228. package/docs/tools/browser.md +576 -0
  229. package/docs/tools/chrome-extension.md +178 -0
  230. package/docs/tools/clawhub.md +257 -0
  231. package/docs/tools/creating-skills.md +54 -0
  232. package/docs/tools/elevated.md +57 -0
  233. package/docs/tools/exec-approvals.md +246 -0
  234. package/docs/tools/exec.md +179 -0
  235. package/docs/tools/firecrawl.md +61 -0
  236. package/docs/tools/index.md +508 -0
  237. package/docs/tools/llm-task.md +115 -0
  238. package/docs/tools/reactions.md +22 -0
  239. package/docs/tools/skills-config.md +76 -0
  240. package/docs/tools/skills.md +300 -0
  241. package/docs/tools/slash-commands.md +196 -0
  242. package/docs/tools/subagents.md +151 -0
  243. package/docs/tools/thinking.md +73 -0
  244. package/docs/tools/web.md +261 -0
  245. package/docs/tui.md +159 -0
  246. package/docs/vps.md +43 -0
  247. package/docs/web/control-ui.md +221 -0
  248. package/docs/web/dashboard.md +46 -0
  249. package/docs/web/index.md +116 -0
  250. package/docs/web/webchat.md +49 -0
  251. package/milaidy.mjs +14 -0
  252. package/package.json +271 -0
  253. package/skills/.cache/catalog.json +88519 -0
@@ -0,0 +1,395 @@
1
+ ---
2
+ summary: "Per-agent sandbox + tool restrictions, precedence, and examples"
3
+ title: Multi-Agent Sandbox & Tools
4
+ read_when: "You want per-agent sandboxing or per-agent tool allow/deny policies in a multi-agent gateway."
5
+ status: active
6
+ ---
7
+
8
+ # Multi-Agent Sandbox & Tools Configuration
9
+
10
+ ## Overview
11
+
12
+ Each agent in a multi-agent setup can now have its own:
13
+
14
+ - **Sandbox configuration** (`agents.list[].sandbox` overrides `agents.defaults.sandbox`)
15
+ - **Tool restrictions** (`tools.allow` / `tools.deny`, plus `agents.list[].tools`)
16
+
17
+ This allows you to run multiple agents with different security profiles:
18
+
19
+ - Personal assistant with full access
20
+ - Family/work agents with restricted tools
21
+ - Public-facing agents in sandboxes
22
+
23
+ `setupCommand` belongs under `sandbox.docker` (global or per-agent) and runs once
24
+ when the container is created.
25
+
26
+ Auth is per-agent: each agent reads from its own `agentDir` auth store at:
27
+
28
+ ```
29
+ ~/.milaidy/agents/<agentId>/agent/auth-profiles.json
30
+ ```
31
+
32
+ Credentials are **not** shared between agents. Never reuse `agentDir` across agents.
33
+ If you want to share creds, copy `auth-profiles.json` into the other agent's `agentDir`.
34
+
35
+ For how sandboxing behaves at runtime, see [Sandboxing](/gateway/sandboxing).
36
+ For debugging “why is this blocked?”, see [Sandbox vs Tool Policy vs Elevated](/gateway/sandbox-vs-tool-policy-vs-elevated) and `milaidy sandbox explain`.
37
+
38
+ ---
39
+
40
+ ## Configuration Examples
41
+
42
+ ### Example 1: Personal + Restricted Family Agent
43
+
44
+ ```json
45
+ {
46
+ "agents": {
47
+ "list": [
48
+ {
49
+ "id": "main",
50
+ "default": true,
51
+ "name": "Personal Assistant",
52
+ "workspace": "~/.milaidy/workspace",
53
+ "sandbox": { "mode": "off" }
54
+ },
55
+ {
56
+ "id": "family",
57
+ "name": "Family Bot",
58
+ "workspace": "~/.milaidy/workspace-family",
59
+ "sandbox": {
60
+ "mode": "all",
61
+ "scope": "agent"
62
+ },
63
+ "tools": {
64
+ "allow": ["read"],
65
+ "deny": ["exec", "write", "edit", "apply_patch", "process", "browser"]
66
+ }
67
+ }
68
+ ]
69
+ },
70
+ "bindings": [
71
+ {
72
+ "agentId": "family",
73
+ "match": {
74
+ "provider": "whatsapp",
75
+ "accountId": "*",
76
+ "peer": {
77
+ "kind": "group",
78
+ "id": "120363424282127706@g.us"
79
+ }
80
+ }
81
+ }
82
+ ]
83
+ }
84
+ ```
85
+
86
+ **Result:**
87
+
88
+ - `main` agent: Runs on host, full tool access
89
+ - `family` agent: Runs in Docker (one container per agent), only `read` tool
90
+
91
+ ---
92
+
93
+ ### Example 2: Work Agent with Shared Sandbox
94
+
95
+ ```json
96
+ {
97
+ "agents": {
98
+ "list": [
99
+ {
100
+ "id": "personal",
101
+ "workspace": "~/.milaidy/workspace-personal",
102
+ "sandbox": { "mode": "off" }
103
+ },
104
+ {
105
+ "id": "work",
106
+ "workspace": "~/.milaidy/workspace-work",
107
+ "sandbox": {
108
+ "mode": "all",
109
+ "scope": "shared",
110
+ "workspaceRoot": "/tmp/work-sandboxes"
111
+ },
112
+ "tools": {
113
+ "allow": ["read", "write", "apply_patch", "exec"],
114
+ "deny": ["browser", "gateway", "discord"]
115
+ }
116
+ }
117
+ ]
118
+ }
119
+ }
120
+ ```
121
+
122
+ ---
123
+
124
+ ### Example 2b: Global coding profile + messaging-only agent
125
+
126
+ ```json
127
+ {
128
+ "tools": { "profile": "coding" },
129
+ "agents": {
130
+ "list": [
131
+ {
132
+ "id": "support",
133
+ "tools": { "profile": "messaging", "allow": ["slack"] }
134
+ }
135
+ ]
136
+ }
137
+ }
138
+ ```
139
+
140
+ **Result:**
141
+
142
+ - default agents get coding tools
143
+ - `support` agent is messaging-only (+ Slack tool)
144
+
145
+ ---
146
+
147
+ ### Example 3: Different Sandbox Modes per Agent
148
+
149
+ ```json
150
+ {
151
+ "agents": {
152
+ "defaults": {
153
+ "sandbox": {
154
+ "mode": "non-main", // Global default
155
+ "scope": "session"
156
+ }
157
+ },
158
+ "list": [
159
+ {
160
+ "id": "main",
161
+ "workspace": "~/.milaidy/workspace",
162
+ "sandbox": {
163
+ "mode": "off" // Override: main never sandboxed
164
+ }
165
+ },
166
+ {
167
+ "id": "public",
168
+ "workspace": "~/.milaidy/workspace-public",
169
+ "sandbox": {
170
+ "mode": "all", // Override: public always sandboxed
171
+ "scope": "agent"
172
+ },
173
+ "tools": {
174
+ "allow": ["read"],
175
+ "deny": ["exec", "write", "edit", "apply_patch"]
176
+ }
177
+ }
178
+ ]
179
+ }
180
+ }
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Configuration Precedence
186
+
187
+ When both global (`agents.defaults.*`) and agent-specific (`agents.list[].*`) configs exist:
188
+
189
+ ### Sandbox Config
190
+
191
+ Agent-specific settings override global:
192
+
193
+ ```
194
+ agents.list[].sandbox.mode > agents.defaults.sandbox.mode
195
+ agents.list[].sandbox.scope > agents.defaults.sandbox.scope
196
+ agents.list[].sandbox.workspaceRoot > agents.defaults.sandbox.workspaceRoot
197
+ agents.list[].sandbox.workspaceAccess > agents.defaults.sandbox.workspaceAccess
198
+ agents.list[].sandbox.docker.* > agents.defaults.sandbox.docker.*
199
+ agents.list[].sandbox.browser.* > agents.defaults.sandbox.browser.*
200
+ agents.list[].sandbox.prune.* > agents.defaults.sandbox.prune.*
201
+ ```
202
+
203
+ **Notes:**
204
+
205
+ - `agents.list[].sandbox.{docker,browser,prune}.*` overrides `agents.defaults.sandbox.{docker,browser,prune}.*` for that agent (ignored when sandbox scope resolves to `"shared"`).
206
+
207
+ ### Tool Restrictions
208
+
209
+ The filtering order is:
210
+
211
+ 1. **Tool profile** (`tools.profile` or `agents.list[].tools.profile`)
212
+ 2. **Provider tool profile** (`tools.byProvider[provider].profile` or `agents.list[].tools.byProvider[provider].profile`)
213
+ 3. **Global tool policy** (`tools.allow` / `tools.deny`)
214
+ 4. **Provider tool policy** (`tools.byProvider[provider].allow/deny`)
215
+ 5. **Agent-specific tool policy** (`agents.list[].tools.allow/deny`)
216
+ 6. **Agent provider policy** (`agents.list[].tools.byProvider[provider].allow/deny`)
217
+ 7. **Sandbox tool policy** (`tools.sandbox.tools` or `agents.list[].tools.sandbox.tools`)
218
+ 8. **Subagent tool policy** (`tools.subagents.tools`, if applicable)
219
+
220
+ Each level can further restrict tools, but cannot grant back denied tools from earlier levels.
221
+ If `agents.list[].tools.sandbox.tools` is set, it replaces `tools.sandbox.tools` for that agent.
222
+ If `agents.list[].tools.profile` is set, it overrides `tools.profile` for that agent.
223
+ Provider tool keys accept either `provider` (e.g. `google-antigravity`) or `provider/model` (e.g. `openai/gpt-5.2`).
224
+
225
+ ### Tool groups (shorthands)
226
+
227
+ Tool policies (global, agent, sandbox) support `group:*` entries that expand to multiple concrete tools:
228
+
229
+ - `group:runtime`: `exec`, `bash`, `process`
230
+ - `group:fs`: `read`, `write`, `edit`, `apply_patch`
231
+ - `group:sessions`: `sessions_list`, `sessions_history`, `sessions_send`, `sessions_spawn`, `session_status`
232
+ - `group:memory`: `memory_search`, `memory_get`
233
+ - `group:ui`: `browser`, `canvas`
234
+ - `group:automation`: `cron`, `gateway`
235
+ - `group:messaging`: `message`
236
+ - `group:nodes`: `nodes`
237
+ - `group:milaidy`: all built-in Milaidy tools (excludes provider plugins)
238
+
239
+ ### Elevated Mode
240
+
241
+ `tools.elevated` is the global baseline (sender-based allowlist). `agents.list[].tools.elevated` can further restrict elevated for specific agents (both must allow).
242
+
243
+ Mitigation patterns:
244
+
245
+ - Deny `exec` for untrusted agents (`agents.list[].tools.deny: ["exec"]`)
246
+ - Avoid allowlisting senders that route to restricted agents
247
+ - Disable elevated globally (`tools.elevated.enabled: false`) if you only want sandboxed execution
248
+ - Disable elevated per agent (`agents.list[].tools.elevated.enabled: false`) for sensitive profiles
249
+
250
+ ---
251
+
252
+ ## Migration from Single Agent
253
+
254
+ **Before (single agent):**
255
+
256
+ ```json
257
+ {
258
+ "agents": {
259
+ "defaults": {
260
+ "workspace": "~/.milaidy/workspace",
261
+ "sandbox": {
262
+ "mode": "non-main"
263
+ }
264
+ }
265
+ },
266
+ "tools": {
267
+ "sandbox": {
268
+ "tools": {
269
+ "allow": ["read", "write", "apply_patch", "exec"],
270
+ "deny": []
271
+ }
272
+ }
273
+ }
274
+ }
275
+ ```
276
+
277
+ **After (multi-agent with different profiles):**
278
+
279
+ ```json
280
+ {
281
+ "agents": {
282
+ "list": [
283
+ {
284
+ "id": "main",
285
+ "default": true,
286
+ "workspace": "~/.milaidy/workspace",
287
+ "sandbox": { "mode": "off" }
288
+ }
289
+ ]
290
+ }
291
+ }
292
+ ```
293
+
294
+ Legacy `agent.*` configs are migrated by `milaidy doctor`; prefer `agents.defaults` + `agents.list` going forward.
295
+
296
+ ---
297
+
298
+ ## Tool Restriction Examples
299
+
300
+ ### Read-only Agent
301
+
302
+ ```json
303
+ {
304
+ "tools": {
305
+ "allow": ["read"],
306
+ "deny": ["exec", "write", "edit", "apply_patch", "process"]
307
+ }
308
+ }
309
+ ```
310
+
311
+ ### Safe Execution Agent (no file modifications)
312
+
313
+ ```json
314
+ {
315
+ "tools": {
316
+ "allow": ["read", "exec", "process"],
317
+ "deny": ["write", "edit", "apply_patch", "browser", "gateway"]
318
+ }
319
+ }
320
+ ```
321
+
322
+ ### Communication-only Agent
323
+
324
+ ```json
325
+ {
326
+ "tools": {
327
+ "allow": ["sessions_list", "sessions_send", "sessions_history", "session_status"],
328
+ "deny": ["exec", "write", "edit", "apply_patch", "read", "browser"]
329
+ }
330
+ }
331
+ ```
332
+
333
+ ---
334
+
335
+ ## Common Pitfall: "non-main"
336
+
337
+ `agents.defaults.sandbox.mode: "non-main"` is based on `session.mainKey` (default `"main"`),
338
+ not the agent id. Group/channel sessions always get their own keys, so they
339
+ are treated as non-main and will be sandboxed. If you want an agent to never
340
+ sandbox, set `agents.list[].sandbox.mode: "off"`.
341
+
342
+ ---
343
+
344
+ ## Testing
345
+
346
+ After configuring multi-agent sandbox and tools:
347
+
348
+ 1. **Check agent resolution:**
349
+
350
+ ```exec
351
+ milaidy agents list --bindings
352
+ ```
353
+
354
+ 2. **Verify sandbox containers:**
355
+
356
+ ```exec
357
+ docker ps --filter "name=milaidy-sbx-"
358
+ ```
359
+
360
+ 3. **Test tool restrictions:**
361
+ - Send a message requiring restricted tools
362
+ - Verify the agent cannot use denied tools
363
+
364
+ 4. **Monitor logs:**
365
+ ```exec
366
+ tail -f "${MILAIDY_STATE_DIR:-$HOME/.milaidy}/logs/gateway.log" | grep -E "routing|sandbox|tools"
367
+ ```
368
+
369
+ ---
370
+
371
+ ## Troubleshooting
372
+
373
+ ### Agent not sandboxed despite `mode: "all"`
374
+
375
+ - Check if there's a global `agents.defaults.sandbox.mode` that overrides it
376
+ - Agent-specific config takes precedence, so set `agents.list[].sandbox.mode: "all"`
377
+
378
+ ### Tools still available despite deny list
379
+
380
+ - Check tool filtering order: global → agent → sandbox → subagent
381
+ - Each level can only further restrict, not grant back
382
+ - Verify with logs: `[tools] filtering tools for agent:${agentId}`
383
+
384
+ ### Container not isolated per agent
385
+
386
+ - Set `scope: "agent"` in agent-specific sandbox config
387
+ - Default is `"session"` which creates one container per session
388
+
389
+ ---
390
+
391
+ ## See Also
392
+
393
+ - [Multi-Agent Routing](/concepts/multi-agent)
394
+ - [Sandbox Configuration](/gateway/configuration#agentsdefaults-sandbox)
395
+ - [Session Management](/concepts/session)
@@ -0,0 +1,54 @@
1
+ ---
2
+ summary: "Network hub: gateway surfaces, pairing, discovery, and security"
3
+ read_when:
4
+ - You need the network architecture + security overview
5
+ - You are debugging local vs tailnet access or pairing
6
+ - You want the canonical list of networking docs
7
+ title: "Network"
8
+ ---
9
+
10
+ # Network hub
11
+
12
+ This hub links the core docs for how Milaidy connects, pairs, and secures
13
+ devices across localhost, LAN, and tailnet.
14
+
15
+ ## Core model
16
+
17
+ - [Gateway architecture](/concepts/architecture)
18
+ - [Gateway protocol](/gateway/protocol)
19
+ - [Gateway runbook](/gateway)
20
+ - [Web surfaces + bind modes](/web)
21
+
22
+ ## Pairing + identity
23
+
24
+ - [Pairing overview (DM + nodes)](/start/pairing)
25
+ - [Gateway-owned node pairing](/gateway/pairing)
26
+ - [Devices CLI (pairing + token rotation)](/cli/devices)
27
+ - [Pairing CLI (DM approvals)](/cli/pairing)
28
+
29
+ Local trust:
30
+
31
+ - Local connections (loopback or the gateway host’s own tailnet address) can be
32
+ auto‑approved for pairing to keep same‑host UX smooth.
33
+ - Non‑local tailnet/LAN clients still require explicit pairing approval.
34
+
35
+ ## Discovery + transports
36
+
37
+ - [Discovery & transports](/gateway/discovery)
38
+ - [Bonjour / mDNS](/gateway/bonjour)
39
+ - [Remote access (SSH)](/gateway/remote)
40
+ - [Tailscale](/gateway/tailscale)
41
+
42
+ ## Nodes + transports
43
+
44
+ - [Nodes overview](/nodes)
45
+ - [Bridge protocol (legacy nodes)](/gateway/bridge-protocol)
46
+ - [Node runbook: iOS](/platforms/ios)
47
+ - [Node runbook: Android](/platforms/android)
48
+
49
+ ## Security
50
+
51
+ - [Security overview](/gateway/security)
52
+ - [Gateway config reference](/gateway/configuration)
53
+ - [Troubleshooting](/gateway/troubleshooting)
54
+ - [Doctor](/gateway/doctor)
@@ -0,0 +1,114 @@
1
+ ---
2
+ summary: "How inbound audio/voice notes are downloaded, transcribed, and injected into replies"
3
+ read_when:
4
+ - Changing audio transcription or media handling
5
+ title: "Audio and Voice Notes"
6
+ ---
7
+
8
+ # Audio / Voice Notes — 2026-01-17
9
+
10
+ ## What works
11
+
12
+ - **Media understanding (audio)**: If audio understanding is enabled (or auto‑detected), Milaidy:
13
+ 1. Locates the first audio attachment (local path or URL) and downloads it if needed.
14
+ 2. Enforces `maxBytes` before sending to each model entry.
15
+ 3. Runs the first eligible model entry in order (provider or CLI).
16
+ 4. If it fails or skips (size/timeout), it tries the next entry.
17
+ 5. On success, it replaces `Body` with an `[Audio]` block and sets `{{Transcript}}`.
18
+ - **Command parsing**: When transcription succeeds, `CommandBody`/`RawBody` are set to the transcript so slash commands still work.
19
+ - **Verbose logging**: In `--verbose`, we log when transcription runs and when it replaces the body.
20
+
21
+ ## Auto-detection (default)
22
+
23
+ If you **don’t configure models** and `tools.media.audio.enabled` is **not** set to `false`,
24
+ Milaidy auto-detects in this order and stops at the first working option:
25
+
26
+ 1. **Local CLIs** (if installed)
27
+ - `sherpa-onnx-offline` (requires `SHERPA_ONNX_MODEL_DIR` with encoder/decoder/joiner/tokens)
28
+ - `whisper-cli` (from `whisper-cpp`; uses `WHISPER_CPP_MODEL` or the bundled tiny model)
29
+ - `whisper` (Python CLI; downloads models automatically)
30
+ 2. **Gemini CLI** (`gemini`) using `read_many_files`
31
+ 3. **Provider keys** (OpenAI → Groq → Deepgram → Google)
32
+
33
+ To disable auto-detection, set `tools.media.audio.enabled: false`.
34
+ To customize, set `tools.media.audio.models`.
35
+ Note: Binary detection is best-effort across macOS/Linux/Windows; ensure the CLI is on `PATH` (we expand `~`), or set an explicit CLI model with a full command path.
36
+
37
+ ## Config examples
38
+
39
+ ### Provider + CLI fallback (OpenAI + Whisper CLI)
40
+
41
+ ```json5
42
+ {
43
+ tools: {
44
+ media: {
45
+ audio: {
46
+ enabled: true,
47
+ maxBytes: 20971520,
48
+ models: [
49
+ { provider: "openai", model: "gpt-5-mini-transcribe" },
50
+ {
51
+ type: "cli",
52
+ command: "whisper",
53
+ args: ["--model", "base", "{{MediaPath}}"],
54
+ timeoutSeconds: 45,
55
+ },
56
+ ],
57
+ },
58
+ },
59
+ },
60
+ }
61
+ ```
62
+
63
+ ### Provider-only with scope gating
64
+
65
+ ```json5
66
+ {
67
+ tools: {
68
+ media: {
69
+ audio: {
70
+ enabled: true,
71
+ scope: {
72
+ default: "allow",
73
+ rules: [{ action: "deny", match: { chatType: "group" } }],
74
+ },
75
+ models: [{ provider: "openai", model: "gpt-5-mini-transcribe" }],
76
+ },
77
+ },
78
+ },
79
+ }
80
+ ```
81
+
82
+ ### Provider-only (Deepgram)
83
+
84
+ ```json5
85
+ {
86
+ tools: {
87
+ media: {
88
+ audio: {
89
+ enabled: true,
90
+ models: [{ provider: "deepgram", model: "nova-3" }],
91
+ },
92
+ },
93
+ },
94
+ }
95
+ ```
96
+
97
+ ## Notes & limits
98
+
99
+ - Provider auth follows the standard model auth order (auth profiles, env vars, `models.providers.*.apiKey`).
100
+ - Deepgram picks up `DEEPGRAM_API_KEY` when `provider: "deepgram"` is used.
101
+ - Deepgram setup details: [Deepgram (audio transcription)](/providers/deepgram).
102
+ - Audio providers can override `baseUrl`, `headers`, and `providerOptions` via `tools.media.audio`.
103
+ - Default size cap is 20MB (`tools.media.audio.maxBytes`). Oversize audio is skipped for that model and the next entry is tried.
104
+ - Default `maxChars` for audio is **unset** (full transcript). Set `tools.media.audio.maxChars` or per-entry `maxChars` to trim output.
105
+ - OpenAI auto default is `gpt-5-mini-transcribe`; set `model: "gpt-5-transcribe"` for higher accuracy.
106
+ - Use `tools.media.audio.attachments` to process multiple voice notes (`mode: "all"` + `maxAttachments`).
107
+ - Transcript is available to templates as `{{Transcript}}`.
108
+ - CLI stdout is capped (5MB); keep CLI output concise.
109
+
110
+ ## Gotchas
111
+
112
+ - Scope rules use first-match wins. `chatType` is normalized to `direct`, `group`, or `room`.
113
+ - Ensure your CLI exits 0 and prints plain text; JSON needs to be massaged via `jq -r .text`.
114
+ - Keep timeouts reasonable (`timeoutSeconds`, default 60s) to avoid blocking the reply queue.