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,128 @@
1
+ ---
2
+ summary: "Uninstall Milaidy completely (CLI, service, state, workspace)"
3
+ read_when:
4
+ - You want to remove Milaidy from a machine
5
+ - The gateway service is still running after uninstall
6
+ title: "Uninstall"
7
+ ---
8
+
9
+ # Uninstall
10
+
11
+ Two paths:
12
+
13
+ - **Easy path** if `milaidy` is still installed.
14
+ - **Manual service removal** if the CLI is gone but the service is still running.
15
+
16
+ ## Easy path (CLI still installed)
17
+
18
+ Recommended: use the built-in uninstaller:
19
+
20
+ ```bash
21
+ milaidy uninstall
22
+ ```
23
+
24
+ Non-interactive (automation / npx):
25
+
26
+ ```bash
27
+ milaidy uninstall --all --yes --non-interactive
28
+ npx -y milaidy uninstall --all --yes --non-interactive
29
+ ```
30
+
31
+ Manual steps (same result):
32
+
33
+ 1. Stop the gateway service:
34
+
35
+ ```bash
36
+ milaidy gateway stop
37
+ ```
38
+
39
+ 2. Uninstall the gateway service (launchd/systemd/schtasks):
40
+
41
+ ```bash
42
+ milaidy gateway uninstall
43
+ ```
44
+
45
+ 3. Delete state + config:
46
+
47
+ ```bash
48
+ rm -rf "${MILAIDY_STATE_DIR:-$HOME/.milaidy}"
49
+ ```
50
+
51
+ If you set `MILAIDY_CONFIG_PATH` to a custom location outside the state dir, delete that file too.
52
+
53
+ 4. Delete your workspace (optional, removes agent files):
54
+
55
+ ```bash
56
+ rm -rf ~/.milaidy/workspace
57
+ ```
58
+
59
+ 5. Remove the CLI install (pick the one you used):
60
+
61
+ ```bash
62
+ npm rm -g milaidy
63
+ pnpm remove -g milaidy
64
+ bun remove -g milaidy
65
+ ```
66
+
67
+ 6. If you installed the macOS app:
68
+
69
+ ```bash
70
+ rm -rf /Applications/Milaidy.app
71
+ ```
72
+
73
+ Notes:
74
+
75
+ - If you used profiles (`--profile` / `MILAIDY_PROFILE`), repeat step 3 for each state dir (defaults are `~/.milaidy-<profile>`).
76
+ - In remote mode, the state dir lives on the **gateway host**, so run steps 1-4 there too.
77
+
78
+ ## Manual service removal (CLI not installed)
79
+
80
+ Use this if the gateway service keeps running but `milaidy` is missing.
81
+
82
+ ### macOS (launchd)
83
+
84
+ Default label is `bot.molt.gateway` (or `bot.molt.<profile>`; legacy `com.milaidy.*` may still exist):
85
+
86
+ ```bash
87
+ launchctl bootout gui/$UID/bot.molt.gateway
88
+ rm -f ~/Library/LaunchAgents/bot.molt.gateway.plist
89
+ ```
90
+
91
+ If you used a profile, replace the label and plist name with `bot.molt.<profile>`. Remove any legacy `com.milaidy.*` plists if present.
92
+
93
+ ### Linux (systemd user unit)
94
+
95
+ Default unit name is `milaidy-gateway.service` (or `milaidy-gateway-<profile>.service`):
96
+
97
+ ```bash
98
+ systemctl --user disable --now milaidy-gateway.service
99
+ rm -f ~/.config/systemd/user/milaidy-gateway.service
100
+ systemctl --user daemon-reload
101
+ ```
102
+
103
+ ### Windows (Scheduled Task)
104
+
105
+ Default task name is `Milaidy Gateway` (or `Milaidy Gateway (<profile>)`).
106
+ The task script lives under your state dir.
107
+
108
+ ```powershell
109
+ schtasks /Delete /F /TN "Milaidy Gateway"
110
+ Remove-Item -Force "$env:USERPROFILE\.milaidy\gateway.cmd"
111
+ ```
112
+
113
+ If you used a profile, delete the matching task name and `~\.milaidy-<profile>\gateway.cmd`.
114
+
115
+ ## Normal install vs source checkout
116
+
117
+ ### Normal install (install.sh / npm / pnpm / bun)
118
+
119
+ If you used `https://milaidy.ai/install.sh` or `install.ps1`, the CLI was installed with `npm install -g milaidy@latest`.
120
+ Remove it with `npm rm -g milaidy` (or `pnpm remove -g` / `bun remove -g` if you installed that way).
121
+
122
+ ### Source checkout (git clone)
123
+
124
+ If you run from a repo checkout (`git clone` + `milaidy ...` / `bun run milaidy ...`):
125
+
126
+ 1. Uninstall the gateway service **before** deleting the repo (use the easy path above or manual service removal).
127
+ 2. Delete the repo directory.
128
+ 3. Remove state + workspace as shown above.
@@ -0,0 +1,228 @@
1
+ ---
2
+ summary: "Updating Milaidy safely (global install or source), plus rollback strategy"
3
+ read_when:
4
+ - Updating Milaidy
5
+ - Something breaks after an update
6
+ title: "Updating"
7
+ ---
8
+
9
+ # Updating
10
+
11
+ Milaidy is moving fast (pre “1.0”). Treat updates like shipping infra: update → run checks → restart (or use `milaidy update`, which restarts) → verify.
12
+
13
+ ## Recommended: re-run the website installer (upgrade in place)
14
+
15
+ The **preferred** update path is to re-run the installer from the website. It
16
+ detects existing installs, upgrades in place, and runs `milaidy doctor` when
17
+ needed.
18
+
19
+ ```bash
20
+ curl -fsSL https://milaidy.ai/install.sh | bash
21
+ ```
22
+
23
+ Notes:
24
+
25
+ - Add `--no-onboard` if you don’t want the onboarding wizard to run again.
26
+ - For **source installs**, use:
27
+ ```bash
28
+ curl -fsSL https://milaidy.ai/install.sh | bash -s -- --install-method git --no-onboard
29
+ ```
30
+ The installer will `git pull --rebase` **only** if the repo is clean.
31
+ - For **global installs**, the script uses `npm install -g milaidy@latest` under the hood.
32
+ - Legacy note: `milaidy` remains available as a compatibility shim.
33
+
34
+ ## Before you update
35
+
36
+ - Know how you installed: **global** (npm/pnpm) vs **from source** (git clone).
37
+ - Know how your Gateway is running: **foreground terminal** vs **supervised service** (launchd/systemd).
38
+ - Snapshot your tailoring:
39
+ - Config: `~/.milaidy/milaidy.json`
40
+ - Credentials: `~/.milaidy/credentials/`
41
+ - Workspace: `~/.milaidy/workspace`
42
+
43
+ ## Update (global install)
44
+
45
+ Global install (pick one):
46
+
47
+ ```bash
48
+ npm i -g milaidy@latest
49
+ ```
50
+
51
+ ```bash
52
+ pnpm add -g milaidy@latest
53
+ ```
54
+
55
+ We do **not** recommend Bun for the Gateway runtime (WhatsApp/Telegram bugs).
56
+
57
+ To switch update channels (git + npm installs):
58
+
59
+ ```bash
60
+ milaidy update --channel beta
61
+ milaidy update --channel dev
62
+ milaidy update --channel stable
63
+ ```
64
+
65
+ Use `--tag <dist-tag|version>` for a one-off install tag/version.
66
+
67
+ See [Development channels](/install/development-channels) for channel semantics and release notes.
68
+
69
+ Note: on npm installs, the gateway logs an update hint on startup (checks the current channel tag). Disable via `update.checkOnStart: false`.
70
+
71
+ Then:
72
+
73
+ ```bash
74
+ milaidy doctor
75
+ milaidy gateway restart
76
+ milaidy health
77
+ ```
78
+
79
+ Notes:
80
+
81
+ - If your Gateway runs as a service, `milaidy gateway restart` is preferred over killing PIDs.
82
+ - If you’re pinned to a specific version, see “Rollback / pinning” below.
83
+
84
+ ## Update (`milaidy update`)
85
+
86
+ For **source installs** (git checkout), prefer:
87
+
88
+ ```bash
89
+ milaidy update
90
+ ```
91
+
92
+ It runs a safe-ish update flow:
93
+
94
+ - Requires a clean worktree.
95
+ - Switches to the selected channel (tag or branch).
96
+ - Fetches + rebases against the configured upstream (dev channel).
97
+ - Installs deps, builds, builds the Control UI, and runs `milaidy doctor`.
98
+ - Restarts the gateway by default (use `--no-restart` to skip).
99
+
100
+ If you installed via **npm/pnpm** (no git metadata), `milaidy update` will try to update via your package manager. If it can’t detect the install, use “Update (global install)” instead.
101
+
102
+ ## Update (Control UI / RPC)
103
+
104
+ The Control UI has **Update & Restart** (RPC: `update.run`). It:
105
+
106
+ 1. Runs the same source-update flow as `milaidy update` (git checkout only).
107
+ 2. Writes a restart sentinel with a structured report (stdout/stderr tail).
108
+ 3. Restarts the gateway and pings the last active session with the report.
109
+
110
+ If the rebase fails, the gateway aborts and restarts without applying the update.
111
+
112
+ ## Update (from source)
113
+
114
+ From the repo checkout:
115
+
116
+ Preferred:
117
+
118
+ ```bash
119
+ milaidy update
120
+ ```
121
+
122
+ Manual (equivalent-ish):
123
+
124
+ ```bash
125
+ git pull
126
+ pnpm install
127
+ pnpm build
128
+ pnpm ui:build # auto-installs UI deps on first run
129
+ milaidy doctor
130
+ milaidy health
131
+ ```
132
+
133
+ Notes:
134
+
135
+ - `pnpm build` matters when you run the packaged `milaidy` binary ([`milaidy.mjs`](https://github.com/milaidy/milaidy/blob/main/milaidy.mjs)) or use Node to run `dist/`.
136
+ - If you run from a repo checkout without a global install, use `pnpm milaidy ...` for CLI commands.
137
+ - If you run directly from TypeScript (`pnpm milaidy ...`), a rebuild is usually unnecessary, but **config migrations still apply** → run doctor.
138
+ - Switching between global and git installs is easy: install the other flavor, then run `milaidy doctor` so the gateway service entrypoint is rewritten to the current install.
139
+
140
+ ## Always Run: `milaidy doctor`
141
+
142
+ Doctor is the “safe update” command. It’s intentionally boring: repair + migrate + warn.
143
+
144
+ Note: if you’re on a **source install** (git checkout), `milaidy doctor` will offer to run `milaidy update` first.
145
+
146
+ Typical things it does:
147
+
148
+ - Migrate deprecated config keys / legacy config file locations.
149
+ - Audit DM policies and warn on risky “open” settings.
150
+ - Check Gateway health and can offer to restart.
151
+ - Detect and migrate older gateway services (launchd/systemd; legacy schtasks) to current Milaidy services.
152
+ - On Linux, ensure systemd user lingering (so the Gateway survives logout).
153
+
154
+ Details: [Doctor](/gateway/doctor)
155
+
156
+ ## Start / stop / restart the Gateway
157
+
158
+ CLI (works regardless of OS):
159
+
160
+ ```bash
161
+ milaidy gateway status
162
+ milaidy gateway stop
163
+ milaidy gateway restart
164
+ milaidy gateway --port 18789
165
+ milaidy logs --follow
166
+ ```
167
+
168
+ If you’re supervised:
169
+
170
+ - macOS launchd (app-bundled LaunchAgent): `launchctl kickstart -k gui/$UID/bot.molt.gateway` (use `bot.molt.<profile>`; legacy `com.milaidy.*` still works)
171
+ - Linux systemd user service: `systemctl --user restart milaidy-gateway[-<profile>].service`
172
+ - Windows (WSL2): `systemctl --user restart milaidy-gateway[-<profile>].service`
173
+ - `launchctl`/`systemctl` only work if the service is installed; otherwise run `milaidy gateway install`.
174
+
175
+ Runbook + exact service labels: [Gateway runbook](/gateway)
176
+
177
+ ## Rollback / pinning (when something breaks)
178
+
179
+ ### Pin (global install)
180
+
181
+ Install a known-good version (replace `<version>` with the last working one):
182
+
183
+ ```bash
184
+ npm i -g milaidy@<version>
185
+ ```
186
+
187
+ ```bash
188
+ pnpm add -g milaidy@<version>
189
+ ```
190
+
191
+ Tip: to see the current published version, run `npm view milaidy version`.
192
+
193
+ Then restart + re-run doctor:
194
+
195
+ ```bash
196
+ milaidy doctor
197
+ milaidy gateway restart
198
+ ```
199
+
200
+ ### Pin (source) by date
201
+
202
+ Pick a commit from a date (example: “state of main as of 2026-01-01”):
203
+
204
+ ```bash
205
+ git fetch origin
206
+ git checkout "$(git rev-list -n 1 --before=\"2026-01-01\" origin/main)"
207
+ ```
208
+
209
+ Then reinstall deps + restart:
210
+
211
+ ```bash
212
+ pnpm install
213
+ pnpm build
214
+ milaidy gateway restart
215
+ ```
216
+
217
+ If you want to go back to latest later:
218
+
219
+ ```bash
220
+ git checkout main
221
+ git pull
222
+ ```
223
+
224
+ ## If you’re stuck
225
+
226
+ - Run `milaidy doctor` again and read the output carefully (it often tells you the fix).
227
+ - Check: [Troubleshooting](/gateway/troubleshooting)
228
+ - Ask in Discord: https://discord.gg/clawd
@@ -0,0 +1,350 @@
1
+ ---
2
+ summary: "Logging overview: file logs, console output, CLI tailing, and the Control UI"
3
+ read_when:
4
+ - You need a beginner-friendly overview of logging
5
+ - You want to configure log levels or formats
6
+ - You are troubleshooting and need to find logs quickly
7
+ title: "Logging"
8
+ ---
9
+
10
+ # Logging
11
+
12
+ Milaidy logs in two places:
13
+
14
+ - **File logs** (JSON lines) written by the Gateway.
15
+ - **Console output** shown in terminals and the Control UI.
16
+
17
+ This page explains where logs live, how to read them, and how to configure log
18
+ levels and formats.
19
+
20
+ ## Where logs live
21
+
22
+ By default, the Gateway writes a rolling log file under:
23
+
24
+ `/tmp/milaidy/milaidy-YYYY-MM-DD.log`
25
+
26
+ The date uses the gateway host's local timezone.
27
+
28
+ You can override this in `~/.milaidy/milaidy.json`:
29
+
30
+ ```json
31
+ {
32
+ "logging": {
33
+ "file": "/path/to/milaidy.log"
34
+ }
35
+ }
36
+ ```
37
+
38
+ ## How to read logs
39
+
40
+ ### CLI: live tail (recommended)
41
+
42
+ Use the CLI to tail the gateway log file via RPC:
43
+
44
+ ```bash
45
+ milaidy logs --follow
46
+ ```
47
+
48
+ Output modes:
49
+
50
+ - **TTY sessions**: pretty, colorized, structured log lines.
51
+ - **Non-TTY sessions**: plain text.
52
+ - `--json`: line-delimited JSON (one log event per line).
53
+ - `--plain`: force plain text in TTY sessions.
54
+ - `--no-color`: disable ANSI colors.
55
+
56
+ In JSON mode, the CLI emits `type`-tagged objects:
57
+
58
+ - `meta`: stream metadata (file, cursor, size)
59
+ - `log`: parsed log entry
60
+ - `notice`: truncation / rotation hints
61
+ - `raw`: unparsed log line
62
+
63
+ If the Gateway is unreachable, the CLI prints a short hint to run:
64
+
65
+ ```bash
66
+ milaidy doctor
67
+ ```
68
+
69
+ ### Control UI (web)
70
+
71
+ The Control UI’s **Logs** tab tails the same file using `logs.tail`.
72
+ See [/web/control-ui](/web/control-ui) for how to open it.
73
+
74
+ ### Channel-only logs
75
+
76
+ To filter channel activity (WhatsApp/Telegram/etc), use:
77
+
78
+ ```bash
79
+ milaidy channels logs --channel whatsapp
80
+ ```
81
+
82
+ ## Log formats
83
+
84
+ ### File logs (JSONL)
85
+
86
+ Each line in the log file is a JSON object. The CLI and Control UI parse these
87
+ entries to render structured output (time, level, subsystem, message).
88
+
89
+ ### Console output
90
+
91
+ Console logs are **TTY-aware** and formatted for readability:
92
+
93
+ - Subsystem prefixes (e.g. `gateway/channels/whatsapp`)
94
+ - Level coloring (info/warn/error)
95
+ - Optional compact or JSON mode
96
+
97
+ Console formatting is controlled by `logging.consoleStyle`.
98
+
99
+ ## Configuring logging
100
+
101
+ All logging configuration lives under `logging` in `~/.milaidy/milaidy.json`.
102
+
103
+ ```json
104
+ {
105
+ "logging": {
106
+ "level": "info",
107
+ "file": "/tmp/milaidy/milaidy-YYYY-MM-DD.log",
108
+ "consoleLevel": "info",
109
+ "consoleStyle": "pretty",
110
+ "redactSensitive": "tools",
111
+ "redactPatterns": ["sk-.*"]
112
+ }
113
+ }
114
+ ```
115
+
116
+ ### Log levels
117
+
118
+ - `logging.level`: **file logs** (JSONL) level.
119
+ - `logging.consoleLevel`: **console** verbosity level.
120
+
121
+ `--verbose` only affects console output; it does not change file log levels.
122
+
123
+ ### Console styles
124
+
125
+ `logging.consoleStyle`:
126
+
127
+ - `pretty`: human-friendly, colored, with timestamps.
128
+ - `compact`: tighter output (best for long sessions).
129
+ - `json`: JSON per line (for log processors).
130
+
131
+ ### Redaction
132
+
133
+ Tool summaries can redact sensitive tokens before they hit the console:
134
+
135
+ - `logging.redactSensitive`: `off` | `tools` (default: `tools`)
136
+ - `logging.redactPatterns`: list of regex strings to override the default set
137
+
138
+ Redaction affects **console output only** and does not alter file logs.
139
+
140
+ ## Diagnostics + OpenTelemetry
141
+
142
+ Diagnostics are structured, machine-readable events for model runs **and**
143
+ message-flow telemetry (webhooks, queueing, session state). They do **not**
144
+ replace logs; they exist to feed metrics, traces, and other exporters.
145
+
146
+ Diagnostics events are emitted in-process, but exporters only attach when
147
+ diagnostics + the exporter plugin are enabled.
148
+
149
+ ### OpenTelemetry vs OTLP
150
+
151
+ - **OpenTelemetry (OTel)**: the data model + SDKs for traces, metrics, and logs.
152
+ - **OTLP**: the wire protocol used to export OTel data to a collector/backend.
153
+ - Milaidy exports via **OTLP/HTTP (protobuf)** today.
154
+
155
+ ### Signals exported
156
+
157
+ - **Metrics**: counters + histograms (token usage, message flow, queueing).
158
+ - **Traces**: spans for model usage + webhook/message processing.
159
+ - **Logs**: exported over OTLP when `diagnostics.otel.logs` is enabled. Log
160
+ volume can be high; keep `logging.level` and exporter filters in mind.
161
+
162
+ ### Diagnostic event catalog
163
+
164
+ Model usage:
165
+
166
+ - `model.usage`: tokens, cost, duration, context, provider/model/channel, session ids.
167
+
168
+ Message flow:
169
+
170
+ - `webhook.received`: webhook ingress per channel.
171
+ - `webhook.processed`: webhook handled + duration.
172
+ - `webhook.error`: webhook handler errors.
173
+ - `message.queued`: message enqueued for processing.
174
+ - `message.processed`: outcome + duration + optional error.
175
+
176
+ Queue + session:
177
+
178
+ - `queue.lane.enqueue`: command queue lane enqueue + depth.
179
+ - `queue.lane.dequeue`: command queue lane dequeue + wait time.
180
+ - `session.state`: session state transition + reason.
181
+ - `session.stuck`: session stuck warning + age.
182
+ - `run.attempt`: run retry/attempt metadata.
183
+ - `diagnostic.heartbeat`: aggregate counters (webhooks/queue/session).
184
+
185
+ ### Enable diagnostics (no exporter)
186
+
187
+ Use this if you want diagnostics events available to plugins or custom sinks:
188
+
189
+ ```json
190
+ {
191
+ "diagnostics": {
192
+ "enabled": true
193
+ }
194
+ }
195
+ ```
196
+
197
+ ### Diagnostics flags (targeted logs)
198
+
199
+ Use flags to turn on extra, targeted debug logs without raising `logging.level`.
200
+ Flags are case-insensitive and support wildcards (e.g. `telegram.*` or `*`).
201
+
202
+ ```json
203
+ {
204
+ "diagnostics": {
205
+ "flags": ["telegram.http"]
206
+ }
207
+ }
208
+ ```
209
+
210
+ Env override (one-off):
211
+
212
+ ```
213
+ MILAIDY_DIAGNOSTICS=telegram.http,telegram.payload
214
+ ```
215
+
216
+ Notes:
217
+
218
+ - Flag logs go to the standard log file (same as `logging.file`).
219
+ - Output is still redacted according to `logging.redactSensitive`.
220
+ - Full guide: [/diagnostics/flags](/diagnostics/flags).
221
+
222
+ ### Export to OpenTelemetry
223
+
224
+ Diagnostics can be exported via the `diagnostics-otel` plugin (OTLP/HTTP). This
225
+ works with any OpenTelemetry collector/backend that accepts OTLP/HTTP.
226
+
227
+ ```json
228
+ {
229
+ "plugins": {
230
+ "allow": ["diagnostics-otel"],
231
+ "entries": {
232
+ "diagnostics-otel": {
233
+ "enabled": true
234
+ }
235
+ }
236
+ },
237
+ "diagnostics": {
238
+ "enabled": true,
239
+ "otel": {
240
+ "enabled": true,
241
+ "endpoint": "http://otel-collector:4318",
242
+ "protocol": "http/protobuf",
243
+ "serviceName": "milaidy-gateway",
244
+ "traces": true,
245
+ "metrics": true,
246
+ "logs": true,
247
+ "sampleRate": 0.2,
248
+ "flushIntervalMs": 60000
249
+ }
250
+ }
251
+ }
252
+ ```
253
+
254
+ Notes:
255
+
256
+ - You can also enable the plugin with `milaidy plugins enable diagnostics-otel`.
257
+ - `protocol` currently supports `http/protobuf` only. `grpc` is ignored.
258
+ - Metrics include token usage, cost, context size, run duration, and message-flow
259
+ counters/histograms (webhooks, queueing, session state, queue depth/wait).
260
+ - Traces/metrics can be toggled with `traces` / `metrics` (default: on). Traces
261
+ include model usage spans plus webhook/message processing spans when enabled.
262
+ - Set `headers` when your collector requires auth.
263
+ - Environment variables supported: `OTEL_EXPORTER_OTLP_ENDPOINT`,
264
+ `OTEL_SERVICE_NAME`, `OTEL_EXPORTER_OTLP_PROTOCOL`.
265
+
266
+ ### Exported metrics (names + types)
267
+
268
+ Model usage:
269
+
270
+ - `milaidy.tokens` (counter, attrs: `milaidy.token`, `milaidy.channel`,
271
+ `milaidy.provider`, `milaidy.model`)
272
+ - `milaidy.cost.usd` (counter, attrs: `milaidy.channel`, `milaidy.provider`,
273
+ `milaidy.model`)
274
+ - `milaidy.run.duration_ms` (histogram, attrs: `milaidy.channel`,
275
+ `milaidy.provider`, `milaidy.model`)
276
+ - `milaidy.context.tokens` (histogram, attrs: `milaidy.context`,
277
+ `milaidy.channel`, `milaidy.provider`, `milaidy.model`)
278
+
279
+ Message flow:
280
+
281
+ - `milaidy.webhook.received` (counter, attrs: `milaidy.channel`,
282
+ `milaidy.webhook`)
283
+ - `milaidy.webhook.error` (counter, attrs: `milaidy.channel`,
284
+ `milaidy.webhook`)
285
+ - `milaidy.webhook.duration_ms` (histogram, attrs: `milaidy.channel`,
286
+ `milaidy.webhook`)
287
+ - `milaidy.message.queued` (counter, attrs: `milaidy.channel`,
288
+ `milaidy.source`)
289
+ - `milaidy.message.processed` (counter, attrs: `milaidy.channel`,
290
+ `milaidy.outcome`)
291
+ - `milaidy.message.duration_ms` (histogram, attrs: `milaidy.channel`,
292
+ `milaidy.outcome`)
293
+
294
+ Queues + sessions:
295
+
296
+ - `milaidy.queue.lane.enqueue` (counter, attrs: `milaidy.lane`)
297
+ - `milaidy.queue.lane.dequeue` (counter, attrs: `milaidy.lane`)
298
+ - `milaidy.queue.depth` (histogram, attrs: `milaidy.lane` or
299
+ `milaidy.channel=heartbeat`)
300
+ - `milaidy.queue.wait_ms` (histogram, attrs: `milaidy.lane`)
301
+ - `milaidy.session.state` (counter, attrs: `milaidy.state`, `milaidy.reason`)
302
+ - `milaidy.session.stuck` (counter, attrs: `milaidy.state`)
303
+ - `milaidy.session.stuck_age_ms` (histogram, attrs: `milaidy.state`)
304
+ - `milaidy.run.attempt` (counter, attrs: `milaidy.attempt`)
305
+
306
+ ### Exported spans (names + key attributes)
307
+
308
+ - `milaidy.model.usage`
309
+ - `milaidy.channel`, `milaidy.provider`, `milaidy.model`
310
+ - `milaidy.sessionKey`, `milaidy.sessionId`
311
+ - `milaidy.tokens.*` (input/output/cache_read/cache_write/total)
312
+ - `milaidy.webhook.processed`
313
+ - `milaidy.channel`, `milaidy.webhook`, `milaidy.chatId`
314
+ - `milaidy.webhook.error`
315
+ - `milaidy.channel`, `milaidy.webhook`, `milaidy.chatId`,
316
+ `milaidy.error`
317
+ - `milaidy.message.processed`
318
+ - `milaidy.channel`, `milaidy.outcome`, `milaidy.chatId`,
319
+ `milaidy.messageId`, `milaidy.sessionKey`, `milaidy.sessionId`,
320
+ `milaidy.reason`
321
+ - `milaidy.session.stuck`
322
+ - `milaidy.state`, `milaidy.ageMs`, `milaidy.queueDepth`,
323
+ `milaidy.sessionKey`, `milaidy.sessionId`
324
+
325
+ ### Sampling + flushing
326
+
327
+ - Trace sampling: `diagnostics.otel.sampleRate` (0.0–1.0, root spans only).
328
+ - Metric export interval: `diagnostics.otel.flushIntervalMs` (min 1000ms).
329
+
330
+ ### Protocol notes
331
+
332
+ - OTLP/HTTP endpoints can be set via `diagnostics.otel.endpoint` or
333
+ `OTEL_EXPORTER_OTLP_ENDPOINT`.
334
+ - If the endpoint already contains `/v1/traces` or `/v1/metrics`, it is used as-is.
335
+ - If the endpoint already contains `/v1/logs`, it is used as-is for logs.
336
+ - `diagnostics.otel.logs` enables OTLP log export for the main logger output.
337
+
338
+ ### Log export behavior
339
+
340
+ - OTLP logs use the same structured records written to `logging.file`.
341
+ - Respect `logging.level` (file log level). Console redaction does **not** apply
342
+ to OTLP logs.
343
+ - High-volume installs should prefer OTLP collector sampling/filtering.
344
+
345
+ ## Troubleshooting tips
346
+
347
+ - **Gateway not reachable?** Run `milaidy doctor` first.
348
+ - **Logs empty?** Check that the Gateway is running and writing to the file path
349
+ in `logging.file`.
350
+ - **Need more detail?** Set `logging.level` to `debug` or `trace` and retry.