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
package/docs/plugin.md ADDED
@@ -0,0 +1,651 @@
1
+ ---
2
+ summary: "Milaidy plugins/extensions: discovery, config, and safety"
3
+ read_when:
4
+ - Adding or modifying plugins/extensions
5
+ - Documenting plugin install or load rules
6
+ title: "Plugins"
7
+ ---
8
+
9
+ # Plugins (Extensions)
10
+
11
+ ## Quick start (new to plugins?)
12
+
13
+ A plugin is just a **small code module** that extends Milaidy with extra
14
+ features (commands, tools, and Gateway RPC).
15
+
16
+ Most of the time, you’ll use plugins when you want a feature that’s not built
17
+ into core Milaidy yet (or you want to keep optional features out of your main
18
+ install).
19
+
20
+ Fast path:
21
+
22
+ 1. See what’s already loaded:
23
+
24
+ ```bash
25
+ milaidy plugins list
26
+ ```
27
+
28
+ 2. Install an official plugin (example: Voice Call):
29
+
30
+ ```bash
31
+ milaidy plugins install @elizaos/plugin-voice-call
32
+ ```
33
+
34
+ 3. Restart the Gateway, then configure under `plugins.entries.<id>.config`.
35
+
36
+ See [Voice Call](/plugins/voice-call) for a concrete example plugin.
37
+
38
+ ## Available plugins (official)
39
+
40
+ - Microsoft Teams is plugin-only as of 2026.1.15; install `@elizaos/plugin-msteams` if you use Teams.
41
+ - [Voice Call](/plugins/voice-call) — `@elizaos/plugin-voice-call`
42
+ - [Zalo Personal](/plugins/zalouser) — `@elizaos/plugin-zalouser`
43
+ - [Matrix](/channels/matrix) — `@elizaos/plugin-matrix`
44
+ - [Nostr](/channels/nostr) — `@elizaos/plugin-nostr`
45
+ - [Zalo](/channels/zalo) — `@elizaos/plugin-zalo`
46
+ - [Microsoft Teams](/channels/msteams) — `@elizaos/plugin-msteams`
47
+
48
+ Milaidy plugins are **TypeScript modules** loaded at runtime via jiti. **Config
49
+ validation does not execute plugin code**; it uses the plugin manifest and JSON
50
+ Schema instead. See [Plugin manifest](/plugins/manifest).
51
+
52
+ Plugins can register:
53
+
54
+ - Gateway RPC methods
55
+ - Gateway HTTP handlers
56
+ - Agent tools
57
+ - CLI commands
58
+ - Background services
59
+ - Optional config validation
60
+ - **Skills** (by listing `skills` directories in the plugin manifest)
61
+ - **Auto-reply commands** (execute without invoking the AI agent)
62
+
63
+ Plugins run **in‑process** with the Gateway, so treat them as trusted code.
64
+ Tool authoring guide: [Plugin agent tools](/plugins/agent-tools).
65
+
66
+ ## Runtime helpers
67
+
68
+ Plugins can access selected core helpers via `api.runtime`. For telephony TTS:
69
+
70
+ ```ts
71
+ const result = await api.runtime.tts.textToSpeechTelephony({
72
+ text: "Hello from Milaidy",
73
+ cfg: api.config,
74
+ });
75
+ ```
76
+
77
+ Notes:
78
+
79
+ - Uses core `messages.tts` configuration (OpenAI or ElevenLabs).
80
+ - Returns PCM audio buffer + sample rate. Plugins must resample/encode for providers.
81
+ - Edge TTS is not supported for telephony.
82
+
83
+ ## Discovery & precedence
84
+
85
+ Milaidy scans, in order:
86
+
87
+ 1. Config paths
88
+
89
+ - `plugins.load.paths` (file or directory)
90
+
91
+ 2. Workspace plugins
92
+
93
+ - `<workspace>/.milaidy/plugins/*.ts`
94
+ - `<workspace>/.milaidy/plugins/*/index.ts`
95
+
96
+ 3. Global plugins
97
+
98
+ - `~/.milaidy/plugins/*.ts`
99
+ - `~/.milaidy/plugins/*/index.ts`
100
+
101
+ Installed plugins are enabled by default, but can be disabled via
102
+ `plugins.entries.<id>.enabled` or `milaidy plugins disable <id>`.
103
+
104
+ Each plugin must include a `milaidy.plugin.json` file in its root. If a path
105
+ points at a file, the plugin root is the file's directory and must contain the
106
+ manifest.
107
+
108
+ If multiple plugins resolve to the same id, the first match in the order above
109
+ wins and lower-precedence copies are ignored.
110
+
111
+ ### Package packs
112
+
113
+ A plugin directory may include a `package.json` with `milaidy.extensions`:
114
+
115
+ ```json
116
+ {
117
+ "name": "my-pack",
118
+ "milaidy": {
119
+ "extensions": ["./src/safety.ts", "./src/tools.ts"]
120
+ }
121
+ }
122
+ ```
123
+
124
+ Each entry becomes a plugin. If the pack lists multiple extensions, the plugin id
125
+ becomes `name/<fileBase>`.
126
+
127
+ If your plugin imports npm deps, install them in that directory so
128
+ `node_modules` is available (`npm install` / `pnpm install`).
129
+
130
+ ### Channel catalog metadata
131
+
132
+ Channel plugins can advertise onboarding metadata via `milaidy.channel` and
133
+ install hints via `milaidy.install`. This keeps the core catalog data-free.
134
+
135
+ Example:
136
+
137
+ ```json
138
+ {
139
+ "name": "@elizaos/plugin-nextcloud-talk",
140
+ "milaidy": {
141
+ "extensions": ["./index.ts"],
142
+ "channel": {
143
+ "id": "nextcloud-talk",
144
+ "label": "Nextcloud Talk",
145
+ "selectionLabel": "Nextcloud Talk (self-hosted)",
146
+ "docsPath": "/channels/nextcloud-talk",
147
+ "docsLabel": "nextcloud-talk",
148
+ "blurb": "Self-hosted chat via Nextcloud Talk webhook bots.",
149
+ "order": 65,
150
+ "aliases": ["nc-talk", "nc"]
151
+ },
152
+ "install": {
153
+ "npmSpec": "@elizaos/plugin-nextcloud-talk",
154
+ "defaultChoice": "npm"
155
+ }
156
+ }
157
+ }
158
+ ```
159
+
160
+ Milaidy can also merge **external channel catalogs** (for example, an MPM
161
+ registry export). Drop a JSON file at one of:
162
+
163
+ - `~/.milaidy/mpm/plugins.json`
164
+ - `~/.milaidy/mpm/catalog.json`
165
+ - `~/.milaidy/plugins/catalog.json`
166
+
167
+ Or point `MILAIDY_PLUGIN_CATALOG_PATHS` (or `MILAIDY_MPM_CATALOG_PATHS`) at
168
+ one or more JSON files (comma/semicolon/`PATH`-delimited). Each file should
169
+ contain `{ "entries": [ { "name": "@scope/pkg", "milaidy": { "channel": {...}, "install": {...} } } ] }`.
170
+
171
+ ## Plugin IDs
172
+
173
+ Default plugin ids:
174
+
175
+ - Package packs: `package.json` `name`
176
+ - Standalone file: file base name (`~/.../voice-call.ts` → `voice-call`)
177
+
178
+ If a plugin exports `id`, Milaidy uses it but warns when it doesn’t match the
179
+ configured id.
180
+
181
+ ## Config
182
+
183
+ ```json5
184
+ {
185
+ plugins: {
186
+ enabled: true,
187
+ allow: ["voice-call"],
188
+ deny: ["untrusted-plugin"],
189
+ load: { paths: ["~/Projects/oss/voice-call-extension"] },
190
+ entries: {
191
+ "voice-call": { enabled: true, config: { provider: "twilio" } },
192
+ },
193
+ },
194
+ }
195
+ ```
196
+
197
+ Fields:
198
+
199
+ - `enabled`: master toggle (default: true)
200
+ - `allow`: allowlist (optional)
201
+ - `deny`: denylist (optional; deny wins)
202
+ - `load.paths`: extra plugin files/dirs
203
+ - `entries.<id>`: per‑plugin toggles + config
204
+
205
+ Config changes **require a gateway restart**.
206
+
207
+ Validation rules (strict):
208
+
209
+ - Unknown plugin ids in `entries`, `allow`, `deny`, or `slots` are **errors**.
210
+ - Unknown `channels.<id>` keys are **errors** unless a plugin manifest declares
211
+ the channel id.
212
+ - Plugin config is validated using the JSON Schema embedded in
213
+ `milaidy.plugin.json` (`configSchema`).
214
+ - If a plugin is disabled, its config is preserved and a **warning** is emitted.
215
+
216
+ ## Plugin slots (exclusive categories)
217
+
218
+ Some plugin categories are **exclusive** (only one active at a time). Use
219
+ `plugins.slots` to select which plugin owns the slot:
220
+
221
+ ```json5
222
+ {
223
+ plugins: {
224
+ slots: {
225
+ memory: "memory-core", // or "none" to disable memory plugins
226
+ },
227
+ },
228
+ }
229
+ ```
230
+
231
+ If multiple plugins declare `kind: "memory"`, only the selected one loads. Others
232
+ are disabled with diagnostics.
233
+
234
+ ## Control UI (schema + labels)
235
+
236
+ The Control UI uses `config.schema` (JSON Schema + `uiHints`) to render better forms.
237
+
238
+ Milaidy augments `uiHints` at runtime based on discovered plugins:
239
+
240
+ - Adds per-plugin labels for `plugins.entries.<id>` / `.enabled` / `.config`
241
+ - Merges optional plugin-provided config field hints under:
242
+ `plugins.entries.<id>.config.<field>`
243
+
244
+ If you want your plugin config fields to show good labels/placeholders (and mark secrets as sensitive),
245
+ provide `uiHints` alongside your JSON Schema in the plugin manifest.
246
+
247
+ Example:
248
+
249
+ ```json
250
+ {
251
+ "id": "my-plugin",
252
+ "configSchema": {
253
+ "type": "object",
254
+ "additionalProperties": false,
255
+ "properties": {
256
+ "apiKey": { "type": "string" },
257
+ "region": { "type": "string" }
258
+ }
259
+ },
260
+ "uiHints": {
261
+ "apiKey": { "label": "API Key", "sensitive": true },
262
+ "region": { "label": "Region", "placeholder": "us-east-1" }
263
+ }
264
+ }
265
+ ```
266
+
267
+ ## CLI
268
+
269
+ ```bash
270
+ milaidy plugins list
271
+ milaidy plugins info <id>
272
+ milaidy plugins install <path> # copy a local file/dir into ~/.milaidy/plugins/<id>
273
+ milaidy plugins install ./my-plugin # relative path ok
274
+ milaidy plugins install ./plugin.tgz # install from a local tarball
275
+ milaidy plugins install ./plugin.zip # install from a local zip
276
+ milaidy plugins install -l ./my-plugin # link (no copy) for dev
277
+ milaidy plugins install @elizaos/plugin-voice-call # install from npm
278
+ milaidy plugins update <id>
279
+ milaidy plugins update --all
280
+ milaidy plugins enable <id>
281
+ milaidy plugins disable <id>
282
+ milaidy plugins doctor
283
+ ```
284
+
285
+ `plugins update` only works for npm installs tracked under `plugins.installs`.
286
+
287
+ Plugins may also register their own top‑level commands (example: `milaidy voicecall`).
288
+
289
+ ## Plugin API (overview)
290
+
291
+ Plugins export either:
292
+
293
+ - A function: `(api) => { ... }`
294
+ - An object: `{ id, name, configSchema, register(api) { ... } }`
295
+
296
+ ## Plugin hooks
297
+
298
+ Plugins can ship hooks and register them at runtime. This lets a plugin bundle
299
+ event-driven automation without a separate hook pack install.
300
+
301
+ ### Example
302
+
303
+ ```
304
+ import { registerPluginHooksFromDir } from "milaidy/plugin-sdk";
305
+
306
+ export default function register(api) {
307
+ registerPluginHooksFromDir(api, "./hooks");
308
+ }
309
+ ```
310
+
311
+ Notes:
312
+
313
+ - Hook directories follow the normal hook structure (`HOOK.md` + `handler.ts`).
314
+ - Hook eligibility rules still apply (OS/bins/env/config requirements).
315
+ - Plugin-managed hooks show up in `milaidy hooks list` with `plugin:<id>`.
316
+ - You cannot enable/disable plugin-managed hooks via `milaidy hooks`; enable/disable the plugin instead.
317
+
318
+ ## Provider plugins (model auth)
319
+
320
+ Plugins can register **model provider auth** flows so users can run OAuth or
321
+ API-key setup inside Milaidy (no external scripts needed).
322
+
323
+ Register a provider via `api.registerProvider(...)`. Each provider exposes one
324
+ or more auth methods (OAuth, API key, device code, etc.). These methods power:
325
+
326
+ - `milaidy models auth login --provider <id> [--method <id>]`
327
+
328
+ Example:
329
+
330
+ ```ts
331
+ api.registerProvider({
332
+ id: "acme",
333
+ label: "AcmeAI",
334
+ auth: [
335
+ {
336
+ id: "oauth",
337
+ label: "OAuth",
338
+ kind: "oauth",
339
+ run: async (ctx) => {
340
+ // Run OAuth flow and return auth profiles.
341
+ return {
342
+ profiles: [
343
+ {
344
+ profileId: "acme:default",
345
+ credential: {
346
+ type: "oauth",
347
+ provider: "acme",
348
+ access: "...",
349
+ refresh: "...",
350
+ expires: Date.now() + 3600 * 1000,
351
+ },
352
+ },
353
+ ],
354
+ defaultModel: "acme/opus-1",
355
+ };
356
+ },
357
+ },
358
+ ],
359
+ });
360
+ ```
361
+
362
+ Notes:
363
+
364
+ - `run` receives a `ProviderAuthContext` with `prompter`, `runtime`,
365
+ `openUrl`, and `oauth.createVpsAwareHandlers` helpers.
366
+ - Return `configPatch` when you need to add default models or provider config.
367
+ - Return `defaultModel` so `--set-default` can update agent defaults.
368
+
369
+ ### Register a messaging channel
370
+
371
+ Plugins can register **channel plugins** that behave like built‑in channels
372
+ (WhatsApp, Telegram, etc.). Channel config lives under `channels.<id>` and is
373
+ validated by your channel plugin code.
374
+
375
+ ```ts
376
+ const myChannel = {
377
+ id: "acmechat",
378
+ meta: {
379
+ id: "acmechat",
380
+ label: "AcmeChat",
381
+ selectionLabel: "AcmeChat (API)",
382
+ docsPath: "/channels/acmechat",
383
+ blurb: "demo channel plugin.",
384
+ aliases: ["acme"],
385
+ },
386
+ capabilities: { chatTypes: ["direct"] },
387
+ config: {
388
+ listAccountIds: (cfg) => Object.keys(cfg.channels?.acmechat?.accounts ?? {}),
389
+ resolveAccount: (cfg, accountId) =>
390
+ cfg.channels?.acmechat?.accounts?.[accountId ?? "default"] ?? {
391
+ accountId,
392
+ },
393
+ },
394
+ outbound: {
395
+ deliveryMode: "direct",
396
+ sendText: async () => ({ ok: true }),
397
+ },
398
+ };
399
+
400
+ export default function (api) {
401
+ api.registerChannel({ plugin: myChannel });
402
+ }
403
+ ```
404
+
405
+ Notes:
406
+
407
+ - Put config under `channels.<id>` (not `plugins.entries`).
408
+ - `meta.label` is used for labels in CLI/UI lists.
409
+ - `meta.aliases` adds alternate ids for normalization and CLI inputs.
410
+ - `meta.preferOver` lists channel ids to skip auto-enable when both are configured.
411
+ - `meta.detailLabel` and `meta.systemImage` let UIs show richer channel labels/icons.
412
+
413
+ ### Write a new messaging channel (step‑by‑step)
414
+
415
+ Use this when you want a **new chat surface** (a “messaging channel”), not a model provider.
416
+ Model provider docs live under `/providers/*`.
417
+
418
+ 1. Pick an id + config shape
419
+
420
+ - All channel config lives under `channels.<id>`.
421
+ - Prefer `channels.<id>.accounts.<accountId>` for multi‑account setups.
422
+
423
+ 2. Define the channel metadata
424
+
425
+ - `meta.label`, `meta.selectionLabel`, `meta.docsPath`, `meta.blurb` control CLI/UI lists.
426
+ - `meta.docsPath` should point at a docs page like `/channels/<id>`.
427
+ - `meta.preferOver` lets a plugin replace another channel (auto-enable prefers it).
428
+ - `meta.detailLabel` and `meta.systemImage` are used by UIs for detail text/icons.
429
+
430
+ 3. Implement the required adapters
431
+
432
+ - `config.listAccountIds` + `config.resolveAccount`
433
+ - `capabilities` (chat types, media, threads, etc.)
434
+ - `outbound.deliveryMode` + `outbound.sendText` (for basic send)
435
+
436
+ 4. Add optional adapters as needed
437
+
438
+ - `setup` (wizard), `security` (DM policy), `status` (health/diagnostics)
439
+ - `gateway` (start/stop/login), `mentions`, `threading`, `streaming`
440
+ - `actions` (message actions), `commands` (native command behavior)
441
+
442
+ 5. Register the channel in your plugin
443
+
444
+ - `api.registerChannel({ plugin })`
445
+
446
+ Minimal config example:
447
+
448
+ ```json5
449
+ {
450
+ channels: {
451
+ acmechat: {
452
+ accounts: {
453
+ default: { token: "ACME_TOKEN", enabled: true },
454
+ },
455
+ },
456
+ },
457
+ }
458
+ ```
459
+
460
+ Minimal channel plugin (outbound‑only):
461
+
462
+ ```ts
463
+ const plugin = {
464
+ id: "acmechat",
465
+ meta: {
466
+ id: "acmechat",
467
+ label: "AcmeChat",
468
+ selectionLabel: "AcmeChat (API)",
469
+ docsPath: "/channels/acmechat",
470
+ blurb: "AcmeChat messaging channel.",
471
+ aliases: ["acme"],
472
+ },
473
+ capabilities: { chatTypes: ["direct"] },
474
+ config: {
475
+ listAccountIds: (cfg) => Object.keys(cfg.channels?.acmechat?.accounts ?? {}),
476
+ resolveAccount: (cfg, accountId) =>
477
+ cfg.channels?.acmechat?.accounts?.[accountId ?? "default"] ?? {
478
+ accountId,
479
+ },
480
+ },
481
+ outbound: {
482
+ deliveryMode: "direct",
483
+ sendText: async ({ text }) => {
484
+ // deliver `text` to your channel here
485
+ return { ok: true };
486
+ },
487
+ },
488
+ };
489
+
490
+ export default function (api) {
491
+ api.registerChannel({ plugin });
492
+ }
493
+ ```
494
+
495
+ Load the plugin (extensions dir or `plugins.load.paths`), restart the gateway,
496
+ then configure `channels.<id>` in your config.
497
+
498
+ ### Agent tools
499
+
500
+ See the dedicated guide: [Plugin agent tools](/plugins/agent-tools).
501
+
502
+ ### Register a gateway RPC method
503
+
504
+ ```ts
505
+ export default function (api) {
506
+ api.registerGatewayMethod("myplugin.status", ({ respond }) => {
507
+ respond(true, { ok: true });
508
+ });
509
+ }
510
+ ```
511
+
512
+ ### Register CLI commands
513
+
514
+ ```ts
515
+ export default function (api) {
516
+ api.registerCli(
517
+ ({ program }) => {
518
+ program.command("mycmd").action(() => {
519
+ console.log("Hello");
520
+ });
521
+ },
522
+ { commands: ["mycmd"] },
523
+ );
524
+ }
525
+ ```
526
+
527
+ ### Register auto-reply commands
528
+
529
+ Plugins can register custom slash commands that execute **without invoking the
530
+ AI agent**. This is useful for toggle commands, status checks, or quick actions
531
+ that don't need LLM processing.
532
+
533
+ ```ts
534
+ export default function (api) {
535
+ api.registerCommand({
536
+ name: "mystatus",
537
+ description: "Show plugin status",
538
+ handler: (ctx) => ({
539
+ text: `Plugin is running! Channel: ${ctx.channel}`,
540
+ }),
541
+ });
542
+ }
543
+ ```
544
+
545
+ Command handler context:
546
+
547
+ - `senderId`: The sender's ID (if available)
548
+ - `channel`: The channel where the command was sent
549
+ - `isAuthorizedSender`: Whether the sender is an authorized user
550
+ - `args`: Arguments passed after the command (if `acceptsArgs: true`)
551
+ - `commandBody`: The full command text
552
+ - `config`: The current Milaidy config
553
+
554
+ Command options:
555
+
556
+ - `name`: Command name (without the leading `/`)
557
+ - `description`: Help text shown in command lists
558
+ - `acceptsArgs`: Whether the command accepts arguments (default: false). If false and arguments are provided, the command won't match and the message falls through to other handlers
559
+ - `requireAuth`: Whether to require authorized sender (default: true)
560
+ - `handler`: Function that returns `{ text: string }` (can be async)
561
+
562
+ Example with authorization and arguments:
563
+
564
+ ```ts
565
+ api.registerCommand({
566
+ name: "setmode",
567
+ description: "Set plugin mode",
568
+ acceptsArgs: true,
569
+ requireAuth: true,
570
+ handler: async (ctx) => {
571
+ const mode = ctx.args?.trim() || "default";
572
+ await saveMode(mode);
573
+ return { text: `Mode set to: ${mode}` };
574
+ },
575
+ });
576
+ ```
577
+
578
+ Notes:
579
+
580
+ - Plugin commands are processed **before** built-in commands and the AI agent
581
+ - Commands are registered globally and work across all channels
582
+ - Command names are case-insensitive (`/MyStatus` matches `/mystatus`)
583
+ - Command names must start with a letter and contain only letters, numbers, hyphens, and underscores
584
+ - Reserved command names (like `help`, `status`, `reset`, etc.) cannot be overridden by plugins
585
+ - Duplicate command registration across plugins will fail with a diagnostic error
586
+
587
+ ### Register background services
588
+
589
+ ```ts
590
+ export default function (api) {
591
+ api.registerService({
592
+ id: "my-service",
593
+ start: () => api.logger.info("ready"),
594
+ stop: () => api.logger.info("bye"),
595
+ });
596
+ }
597
+ ```
598
+
599
+ ## Naming conventions
600
+
601
+ - Gateway methods: `pluginId.action` (example: `voicecall.status`)
602
+ - Tools: `snake_case` (example: `voice_call`)
603
+ - CLI commands: kebab or camel, but avoid clashing with core commands
604
+
605
+ ## Skills
606
+
607
+ Plugins can ship a skill in the repo (`skills/<name>/SKILL.md`).
608
+ Enable it with `plugins.entries.<id>.enabled` (or other config gates) and ensure
609
+ it’s present in your workspace/managed skills locations.
610
+
611
+ ## Distribution (npm)
612
+
613
+ Recommended packaging:
614
+
615
+ - Main package: `milaidy` (this repo)
616
+ - Plugins: separate npm packages under `@elizaos/*` (example: `@elizaos/plugin-voice-call`)
617
+
618
+ Publishing contract:
619
+
620
+ - Plugin `package.json` must include `milaidy.extensions` with one or more entry files.
621
+ - Entry files can be `.js` or `.ts` (jiti loads TS at runtime).
622
+ - `milaidy plugins install <npm-spec>` uses `npm pack`, extracts into `~/.milaidy/plugins/<id>/`, and enables it in config.
623
+ - Config key stability: scoped packages are normalized to the **unscoped** id for `plugins.entries.*`.
624
+
625
+ ## Example plugin: Voice Call
626
+
627
+ The voice-call plugin (Twilio or log fallback) is available as `@elizaos/plugin-voice-call`:
628
+
629
+ - Install: `milaidy plugins install @elizaos/plugin-voice-call`
630
+ - CLI: `milaidy voicecall start|status`
631
+ - Tool: `voice_call`
632
+ - RPC: `voicecall.start`, `voicecall.status`
633
+ - Config (twilio): `provider: "twilio"` + `twilio.accountSid/authToken/from` (optional `statusCallbackUrl`, `twimlUrl`)
634
+ - Config (dev): `provider: "log"` (no network)
635
+
636
+ See [Voice Call](/plugins/voice-call) for setup and usage.
637
+
638
+ ## Safety notes
639
+
640
+ Plugins run in-process with the Gateway. Treat them as trusted code:
641
+
642
+ - Only install plugins you trust.
643
+ - Prefer `plugins.allow` allowlists.
644
+ - Restart the Gateway after changes.
645
+
646
+ ## Testing plugins
647
+
648
+ Plugins can (and should) ship tests:
649
+
650
+ - Plugins should keep Vitest tests under `src/**` or adjacent to their source files.
651
+ - Published plugins should run their own CI (lint/build/test) and validate `milaidy.extensions` points at the built entrypoint (`dist/index.js`).