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,281 @@
1
+ ---
2
+ summary: "Run Milaidy in a sandboxed macOS VM (local or hosted) when you need isolation or iMessage"
3
+ read_when:
4
+ - You want Milaidy isolated from your main macOS environment
5
+ - You want iMessage integration (BlueBubbles) in a sandbox
6
+ - You want a resettable macOS environment you can clone
7
+ - You want to compare local vs hosted macOS VM options
8
+ title: "macOS VMs"
9
+ ---
10
+
11
+ # Milaidy on macOS VMs (Sandboxing)
12
+
13
+ ## Recommended default (most users)
14
+
15
+ - **Small Linux VPS** for an always-on Gateway and low cost. See [VPS hosting](/vps).
16
+ - **Dedicated hardware** (Mac mini or Linux box) if you want full control and a **residential IP** for browser automation. Many sites block data center IPs, so local browsing often works better.
17
+ - **Hybrid:** keep the Gateway on a cheap VPS, and connect your Mac as a **node** when you need browser/UI automation. See [Nodes](/nodes) and [Gateway remote](/gateway/remote).
18
+
19
+ Use a macOS VM when you specifically need macOS-only capabilities (iMessage/BlueBubbles) or want strict isolation from your daily Mac.
20
+
21
+ ## macOS VM options
22
+
23
+ ### Local VM on your Apple Silicon Mac (Lume)
24
+
25
+ Run Milaidy in a sandboxed macOS VM on your existing Apple Silicon Mac using [Lume](https://cua.ai/docs/lume).
26
+
27
+ This gives you:
28
+
29
+ - Full macOS environment in isolation (your host stays clean)
30
+ - iMessage support via BlueBubbles (impossible on Linux/Windows)
31
+ - Instant reset by cloning VMs
32
+ - No extra hardware or cloud costs
33
+
34
+ ### Hosted Mac providers (cloud)
35
+
36
+ If you want macOS in the cloud, hosted Mac providers work too:
37
+
38
+ - [MacStadium](https://www.macstadium.com/) (hosted Macs)
39
+ - Other hosted Mac vendors also work; follow their VM + SSH docs
40
+
41
+ Once you have SSH access to a macOS VM, continue at step 6 below.
42
+
43
+ ---
44
+
45
+ ## Quick path (Lume, experienced users)
46
+
47
+ 1. Install Lume
48
+ 2. `lume create milaidy --os macos --ipsw latest`
49
+ 3. Complete Setup Assistant, enable Remote Login (SSH)
50
+ 4. `lume run milaidy --no-display`
51
+ 5. SSH in, install Milaidy, configure channels
52
+ 6. Done
53
+
54
+ ---
55
+
56
+ ## What you need (Lume)
57
+
58
+ - Apple Silicon Mac (M1/M2/M3/M4)
59
+ - macOS Sequoia or later on the host
60
+ - ~60 GB free disk space per VM
61
+ - ~20 minutes
62
+
63
+ ---
64
+
65
+ ## 1) Install Lume
66
+
67
+ ```bash
68
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"
69
+ ```
70
+
71
+ If `~/.local/bin` isn't in your PATH:
72
+
73
+ ```bash
74
+ echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.zshrc && source ~/.zshrc
75
+ ```
76
+
77
+ Verify:
78
+
79
+ ```bash
80
+ lume --version
81
+ ```
82
+
83
+ Docs: [Lume Installation](https://cua.ai/docs/lume/guide/getting-started/installation)
84
+
85
+ ---
86
+
87
+ ## 2) Create the macOS VM
88
+
89
+ ```bash
90
+ lume create milaidy --os macos --ipsw latest
91
+ ```
92
+
93
+ This downloads macOS and creates the VM. A VNC window opens automatically.
94
+
95
+ Note: The download can take a while depending on your connection.
96
+
97
+ ---
98
+
99
+ ## 3) Complete Setup Assistant
100
+
101
+ In the VNC window:
102
+
103
+ 1. Select language and region
104
+ 2. Skip Apple ID (or sign in if you want iMessage later)
105
+ 3. Create a user account (remember the username and password)
106
+ 4. Skip all optional features
107
+
108
+ After setup completes, enable SSH:
109
+
110
+ 1. Open System Settings → General → Sharing
111
+ 2. Enable "Remote Login"
112
+
113
+ ---
114
+
115
+ ## 4) Get the VM's IP address
116
+
117
+ ```bash
118
+ lume get milaidy
119
+ ```
120
+
121
+ Look for the IP address (usually `192.168.64.x`).
122
+
123
+ ---
124
+
125
+ ## 5) SSH into the VM
126
+
127
+ ```bash
128
+ ssh youruser@192.168.64.X
129
+ ```
130
+
131
+ Replace `youruser` with the account you created, and the IP with your VM's IP.
132
+
133
+ ---
134
+
135
+ ## 6) Install Milaidy
136
+
137
+ Inside the VM:
138
+
139
+ ```bash
140
+ npm install -g milaidy@latest
141
+ milaidy onboard --install-daemon
142
+ ```
143
+
144
+ Follow the onboarding prompts to set up your model provider (Anthropic, OpenAI, etc.).
145
+
146
+ ---
147
+
148
+ ## 7) Configure channels
149
+
150
+ Edit the config file:
151
+
152
+ ```bash
153
+ nano ~/.milaidy/milaidy.json
154
+ ```
155
+
156
+ Add your channels:
157
+
158
+ ```json
159
+ {
160
+ "channels": {
161
+ "whatsapp": {
162
+ "dmPolicy": "allowlist",
163
+ "allowFrom": ["+15551234567"]
164
+ },
165
+ "telegram": {
166
+ "botToken": "YOUR_BOT_TOKEN"
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ Then login to WhatsApp (scan QR):
173
+
174
+ ```bash
175
+ milaidy channels login
176
+ ```
177
+
178
+ ---
179
+
180
+ ## 8) Run the VM headlessly
181
+
182
+ Stop the VM and restart without display:
183
+
184
+ ```bash
185
+ lume stop milaidy
186
+ lume run milaidy --no-display
187
+ ```
188
+
189
+ The VM runs in the background. Milaidy's daemon keeps the gateway running.
190
+
191
+ To check status:
192
+
193
+ ```bash
194
+ ssh youruser@192.168.64.X "milaidy status"
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Bonus: iMessage integration
200
+
201
+ This is the killer feature of running on macOS. Use [BlueBubbles](https://bluebubbles.app) to add iMessage to Milaidy.
202
+
203
+ Inside the VM:
204
+
205
+ 1. Download BlueBubbles from bluebubbles.app
206
+ 2. Sign in with your Apple ID
207
+ 3. Enable the Web API and set a password
208
+ 4. Point BlueBubbles webhooks at your gateway (example: `https://your-gateway-host:3000/bluebubbles-webhook?password=<password>`)
209
+
210
+ Add to your Milaidy config:
211
+
212
+ ```json
213
+ {
214
+ "channels": {
215
+ "bluebubbles": {
216
+ "serverUrl": "http://localhost:1234",
217
+ "password": "your-api-password",
218
+ "webhookPath": "/bluebubbles-webhook"
219
+ }
220
+ }
221
+ }
222
+ ```
223
+
224
+ Restart the gateway. Now your agent can send and receive iMessages.
225
+
226
+ Full setup details: [BlueBubbles channel](/channels/bluebubbles)
227
+
228
+ ---
229
+
230
+ ## Save a golden image
231
+
232
+ Before customizing further, snapshot your clean state:
233
+
234
+ ```bash
235
+ lume stop milaidy
236
+ lume clone milaidy milaidy-golden
237
+ ```
238
+
239
+ Reset anytime:
240
+
241
+ ```bash
242
+ lume stop milaidy && lume delete milaidy
243
+ lume clone milaidy-golden milaidy
244
+ lume run milaidy --no-display
245
+ ```
246
+
247
+ ---
248
+
249
+ ## Running 24/7
250
+
251
+ Keep the VM running by:
252
+
253
+ - Keeping your Mac plugged in
254
+ - Disabling sleep in System Settings → Energy Saver
255
+ - Using `caffeinate` if needed
256
+
257
+ For true always-on, consider a dedicated Mac mini or a small VPS. See [VPS hosting](/vps).
258
+
259
+ ---
260
+
261
+ ## Troubleshooting
262
+
263
+ | Problem | Solution |
264
+ | ------------------------ | ---------------------------------------------------------------------------------- |
265
+ | Can't SSH into VM | Check "Remote Login" is enabled in VM's System Settings |
266
+ | VM IP not showing | Wait for VM to fully boot, run `lume get milaidy` again |
267
+ | Lume command not found | Add `~/.local/bin` to your PATH |
268
+ | WhatsApp QR not scanning | Ensure you're logged into the VM (not host) when running `milaidy channels login` |
269
+
270
+ ---
271
+
272
+ ## Related docs
273
+
274
+ - [VPS hosting](/vps)
275
+ - [Nodes](/nodes)
276
+ - [Gateway remote](/gateway/remote)
277
+ - [BlueBubbles channel](/channels/bluebubbles)
278
+ - [Lume Quickstart](https://cua.ai/docs/lume/guide/getting-started/quickstart)
279
+ - [Lume CLI Reference](https://cua.ai/docs/lume/reference/cli-reference)
280
+ - [Unattended VM Setup](https://cua.ai/docs/lume/guide/fundamentals/unattended-setup) (advanced)
281
+ - [Docker Sandboxing](/install/docker) (alternative isolation approach)
@@ -0,0 +1,203 @@
1
+ ---
2
+ summary: "Milaidy macOS companion app (menu bar + gateway broker)"
3
+ read_when:
4
+ - Implementing macOS app features
5
+ - Changing gateway lifecycle or node bridging on macOS
6
+ title: "macOS App"
7
+ ---
8
+
9
+ # Milaidy macOS Companion (menu bar + gateway broker)
10
+
11
+ The macOS app is the **menu‑bar companion** for Milaidy. It owns permissions,
12
+ manages/attaches to the Gateway locally (launchd or manual), and exposes macOS
13
+ capabilities to the agent as a node.
14
+
15
+ ## What it does
16
+
17
+ - Shows native notifications and status in the menu bar.
18
+ - Owns TCC prompts (Notifications, Accessibility, Screen Recording, Microphone,
19
+ Speech Recognition, Automation/AppleScript).
20
+ - Runs or connects to the Gateway (local or remote).
21
+ - Exposes macOS‑only tools (Canvas, Camera, Screen Recording, `system.run`).
22
+ - Starts the local node host service in **remote** mode (launchd), and stops it in **local** mode.
23
+ - Optionally hosts **PeekabooBridge** for UI automation.
24
+ - Installs the global CLI (`milaidy`) via npm/pnpm on request (bun not recommended for the Gateway runtime).
25
+
26
+ ## Local vs remote mode
27
+
28
+ - **Local** (default): the app attaches to a running local Gateway if present;
29
+ otherwise it enables the launchd service via `milaidy gateway install`.
30
+ - **Remote**: the app connects to a Gateway over SSH/Tailscale and never starts
31
+ a local process.
32
+ The app starts the local **node host service** so the remote Gateway can reach this Mac.
33
+ The app does not spawn the Gateway as a child process.
34
+
35
+ ## Launchd control
36
+
37
+ The app manages a per‑user LaunchAgent labeled `bot.molt.gateway`
38
+ (or `bot.molt.<profile>` when using `--profile`/`MILAIDY_PROFILE`; legacy `com.milaidy.*` still unloads).
39
+
40
+ ```bash
41
+ launchctl kickstart -k gui/$UID/bot.molt.gateway
42
+ launchctl bootout gui/$UID/bot.molt.gateway
43
+ ```
44
+
45
+ Replace the label with `bot.molt.<profile>` when running a named profile.
46
+
47
+ If the LaunchAgent isn’t installed, enable it from the app or run
48
+ `milaidy gateway install`.
49
+
50
+ ## Node capabilities (mac)
51
+
52
+ The macOS app presents itself as a node. Common commands:
53
+
54
+ - Canvas: `canvas.present`, `canvas.navigate`, `canvas.eval`, `canvas.snapshot`, `canvas.a2ui.*`
55
+ - Camera: `camera.snap`, `camera.clip`
56
+ - Screen: `screen.record`
57
+ - System: `system.run`, `system.notify`
58
+
59
+ The node reports a `permissions` map so agents can decide what’s allowed.
60
+
61
+ Node service + app IPC:
62
+
63
+ - When the headless node host service is running (remote mode), it connects to the Gateway WS as a node.
64
+ - `system.run` executes in the macOS app (UI/TCC context) over a local Unix socket; prompts + output stay in-app.
65
+
66
+ Diagram (SCI):
67
+
68
+ ```
69
+ Gateway -> Node Service (WS)
70
+ | IPC (UDS + token + HMAC + TTL)
71
+ v
72
+ Mac App (UI + TCC + system.run)
73
+ ```
74
+
75
+ ## Exec approvals (system.run)
76
+
77
+ `system.run` is controlled by **Exec approvals** in the macOS app (Settings → Exec approvals).
78
+ Security + ask + allowlist are stored locally on the Mac in:
79
+
80
+ ```
81
+ ~/.milaidy/exec-approvals.json
82
+ ```
83
+
84
+ Example:
85
+
86
+ ```json
87
+ {
88
+ "version": 1,
89
+ "defaults": {
90
+ "security": "deny",
91
+ "ask": "on-miss"
92
+ },
93
+ "agents": {
94
+ "main": {
95
+ "security": "allowlist",
96
+ "ask": "on-miss",
97
+ "allowlist": [{ "pattern": "/opt/homebrew/bin/rg" }]
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ Notes:
104
+
105
+ - `allowlist` entries are glob patterns for resolved binary paths.
106
+ - Choosing “Always Allow” in the prompt adds that command to the allowlist.
107
+ - `system.run` environment overrides are filtered (drops `PATH`, `DYLD_*`, `LD_*`, `NODE_OPTIONS`, `PYTHON*`, `PERL*`, `RUBYOPT`) and then merged with the app’s environment.
108
+
109
+ ## Deep links
110
+
111
+ The app registers the `milaidy://` URL scheme for local actions.
112
+
113
+ ### `milaidy://agent`
114
+
115
+ Triggers a Gateway `agent` request.
116
+
117
+ ```bash
118
+ open 'milaidy://agent?message=Hello%20from%20deep%20link'
119
+ ```
120
+
121
+ Query parameters:
122
+
123
+ - `message` (required)
124
+ - `sessionKey` (optional)
125
+ - `thinking` (optional)
126
+ - `deliver` / `to` / `channel` (optional)
127
+ - `timeoutSeconds` (optional)
128
+ - `key` (optional unattended mode key)
129
+
130
+ Safety:
131
+
132
+ - Without `key`, the app prompts for confirmation.
133
+ - With a valid `key`, the run is unattended (intended for personal automations).
134
+
135
+ ## Onboarding flow (typical)
136
+
137
+ 1. Install and launch **Milaidy.app**.
138
+ 2. Complete the permissions checklist (TCC prompts).
139
+ 3. Ensure **Local** mode is active and the Gateway is running.
140
+ 4. Install the CLI if you want terminal access.
141
+
142
+ ## Build & dev workflow (native)
143
+
144
+ - `cd apps/macos && swift build`
145
+ - `swift run Milaidy` (or Xcode)
146
+ - Package app: `apps/shared/scripts/package-mac-app.sh`
147
+
148
+ ## Debug gateway connectivity (macOS CLI)
149
+
150
+ Use the debug CLI to exercise the same Gateway WebSocket handshake and discovery
151
+ logic that the macOS app uses, without launching the app.
152
+
153
+ ```bash
154
+ cd apps/macos
155
+ swift run milaidy-mac connect --json
156
+ swift run milaidy-mac discover --timeout 3000 --json
157
+ ```
158
+
159
+ Connect options:
160
+
161
+ - `--url <ws://host:port>`: override config
162
+ - `--mode <local|remote>`: resolve from config (default: config or local)
163
+ - `--probe`: force a fresh health probe
164
+ - `--timeout <ms>`: request timeout (default: `15000`)
165
+ - `--json`: structured output for diffing
166
+
167
+ Discovery options:
168
+
169
+ - `--include-local`: include gateways that would be filtered as “local”
170
+ - `--timeout <ms>`: overall discovery window (default: `2000`)
171
+ - `--json`: structured output for diffing
172
+
173
+ Tip: compare against `milaidy gateway discover --json` to see whether the
174
+ macOS app’s discovery pipeline (NWBrowser + tailnet DNS‑SD fallback) differs from
175
+ the Node CLI’s `dns-sd` based discovery.
176
+
177
+ ## Remote connection plumbing (SSH tunnels)
178
+
179
+ When the macOS app runs in **Remote** mode, it opens an SSH tunnel so local UI
180
+ components can talk to a remote Gateway as if it were on localhost.
181
+
182
+ ### Control tunnel (Gateway WebSocket port)
183
+
184
+ - **Purpose:** health checks, status, Web Chat, config, and other control-plane calls.
185
+ - **Local port:** the Gateway port (default `18789`), always stable.
186
+ - **Remote port:** the same Gateway port on the remote host.
187
+ - **Behavior:** no random local port; the app reuses an existing healthy tunnel
188
+ or restarts it if needed.
189
+ - **SSH shape:** `ssh -N -L <local>:127.0.0.1:<remote>` with BatchMode +
190
+ ExitOnForwardFailure + keepalive options.
191
+ - **IP reporting:** the SSH tunnel uses loopback, so the gateway will see the node
192
+ IP as `127.0.0.1`. Use **Direct (ws/wss)** transport if you want the real client
193
+ IP to appear (see [macOS remote access](/platforms/mac/remote)).
194
+
195
+ For setup steps, see [macOS remote access](/platforms/mac/remote). For protocol
196
+ details, see [Gateway protocol](/gateway/protocol).
197
+
198
+ ## Related docs
199
+
200
+ - [Gateway runbook](/gateway)
201
+ - [Gateway (macOS)](/platforms/mac/bundled-gateway)
202
+ - [macOS permissions](/platforms/mac/permissions)
203
+ - [Canvas](/platforms/mac/canvas)