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/dist/entry.js ADDED
@@ -0,0 +1,232 @@
1
+ #!/usr/bin/env node
2
+ import process$1 from "node:process";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import { logger } from "@elizaos/core";
6
+
7
+ //#region src/cli/profile-utils.ts
8
+ const PROFILE_NAME_RE = /^[a-z0-9][a-z0-9_-]{0,63}$/i;
9
+ function isValidProfileName(value) {
10
+ if (!value) return false;
11
+ return PROFILE_NAME_RE.test(value);
12
+ }
13
+
14
+ //#endregion
15
+ //#region src/cli/profile.ts
16
+ function takeValue(raw, next) {
17
+ if (raw.includes("=")) {
18
+ const [, value] = raw.split("=", 2);
19
+ return {
20
+ value: (value ?? "").trim() || null,
21
+ consumedNext: false
22
+ };
23
+ }
24
+ return {
25
+ value: (next ?? "").trim() || null,
26
+ consumedNext: Boolean(next)
27
+ };
28
+ }
29
+ function parseCliProfileArgs(argv) {
30
+ if (argv.length < 2) return {
31
+ ok: true,
32
+ profile: null,
33
+ argv
34
+ };
35
+ const out = argv.slice(0, 2);
36
+ let profile = null;
37
+ let sawDev = false;
38
+ let sawCommand = false;
39
+ const args = argv.slice(2);
40
+ for (let i = 0; i < args.length; i += 1) {
41
+ const arg = args[i];
42
+ if (arg === void 0) continue;
43
+ if (sawCommand) {
44
+ out.push(arg);
45
+ continue;
46
+ }
47
+ if (arg === "--dev") {
48
+ if (profile && profile !== "dev") return {
49
+ ok: false,
50
+ error: "Cannot combine --dev with --profile"
51
+ };
52
+ sawDev = true;
53
+ profile = "dev";
54
+ continue;
55
+ }
56
+ if (arg === "--profile" || arg.startsWith("--profile=")) {
57
+ if (sawDev) return {
58
+ ok: false,
59
+ error: "Cannot combine --dev with --profile"
60
+ };
61
+ const next = args[i + 1];
62
+ const { value, consumedNext } = takeValue(arg, next);
63
+ if (consumedNext) i += 1;
64
+ if (!value) return {
65
+ ok: false,
66
+ error: "--profile requires a value"
67
+ };
68
+ if (!isValidProfileName(value)) return {
69
+ ok: false,
70
+ error: "Invalid --profile (use letters, numbers, \"_\", \"-\" only)"
71
+ };
72
+ profile = value;
73
+ continue;
74
+ }
75
+ if (!arg.startsWith("-")) {
76
+ sawCommand = true;
77
+ out.push(arg);
78
+ continue;
79
+ }
80
+ out.push(arg);
81
+ }
82
+ return {
83
+ ok: true,
84
+ profile,
85
+ argv: out
86
+ };
87
+ }
88
+ function resolveProfileStateDir(profile, homedir) {
89
+ const suffix = profile.toLowerCase() === "default" ? "" : `-${profile}`;
90
+ return path.join(homedir(), `.milaidy${suffix}`);
91
+ }
92
+ function applyCliProfileEnv(params) {
93
+ const env = params.env ?? process.env;
94
+ const homedir = params.homedir ?? os.homedir;
95
+ const profile = params.profile.trim();
96
+ if (!profile) return;
97
+ env.MILAIDY_PROFILE = profile;
98
+ const stateDir = env.MILAIDY_STATE_DIR?.trim() || resolveProfileStateDir(profile, homedir);
99
+ if (!env.MILAIDY_STATE_DIR?.trim()) env.MILAIDY_STATE_DIR = stateDir;
100
+ if (!env.MILAIDY_CONFIG_PATH?.trim()) env.MILAIDY_CONFIG_PATH = path.join(stateDir, "milaidy.json");
101
+ if (profile === "dev" && !env.MILAIDY_GATEWAY_PORT?.trim()) env.MILAIDY_GATEWAY_PORT = "19001";
102
+ }
103
+
104
+ //#endregion
105
+ //#region src/logging.ts
106
+ /**
107
+ * Simplified logging module using @elizaos/core logger
108
+ *
109
+ * This module provides backward-compatible APIs for Milaidy's subsystem logging
110
+ * while delegating to the eliza core logger under the hood.
111
+ *
112
+ * Key changes from the original:
113
+ * - No file-based logging (use LOG_JSON_FORMAT=true for machine-readable logs)
114
+ * - Uses eliza's namespaced child loggers for subsystems
115
+ * - Simpler configuration via LOG_LEVEL environment variable
116
+ */
117
+ const ALLOWED_LOG_LEVELS = [
118
+ "trace",
119
+ "debug",
120
+ "info",
121
+ "warn",
122
+ "error",
123
+ "fatal",
124
+ "silent"
125
+ ];
126
+ function normalizeLogLevel(level, fallback = "info") {
127
+ if (!level) return fallback;
128
+ const normalized = level.toLowerCase();
129
+ return ALLOWED_LOG_LEVELS.includes(normalized) ? normalized : fallback;
130
+ }
131
+ /**
132
+ * Create a subsystem logger using eliza's namespaced child logger
133
+ */
134
+ function createSubsystemLogger(subsystem) {
135
+ const childLogger = logger.child({ namespace: subsystem });
136
+ const emit = (method, message, meta) => {
137
+ if (meta && Object.keys(meta).length > 0) childLogger[method]({
138
+ src: subsystem,
139
+ ...meta
140
+ }, message);
141
+ else childLogger[method]({ src: subsystem }, message);
142
+ };
143
+ return {
144
+ subsystem,
145
+ trace: (message, meta) => emit("trace", message, meta),
146
+ debug: (message, meta) => emit("debug", message, meta),
147
+ info: (message, meta) => emit("info", message, meta),
148
+ warn: (message, meta) => emit("warn", message, meta),
149
+ error: (message, meta) => emit("error", message, meta),
150
+ fatal: (message, meta) => emit("fatal", message, meta),
151
+ raw: (message) => childLogger.info({ src: subsystem }, message),
152
+ child: (name) => createSubsystemLogger(`${subsystem}/${name}`)
153
+ };
154
+ }
155
+ let consoleSettings = {
156
+ level: normalizeLogLevel(process.env.LOG_LEVEL, "info"),
157
+ style: process.env.LOG_JSON_FORMAT === "true" ? "json" : "pretty"
158
+ };
159
+
160
+ //#endregion
161
+ //#region src/utils/boolean.ts
162
+ const DEFAULT_TRUTHY = [
163
+ "true",
164
+ "1",
165
+ "yes",
166
+ "on"
167
+ ];
168
+ const DEFAULT_FALSY = [
169
+ "false",
170
+ "0",
171
+ "no",
172
+ "off"
173
+ ];
174
+ const DEFAULT_TRUTHY_SET = new Set(DEFAULT_TRUTHY);
175
+ const DEFAULT_FALSY_SET = new Set(DEFAULT_FALSY);
176
+ function parseBooleanValue(value, options = {}) {
177
+ if (typeof value === "boolean") return value;
178
+ if (typeof value !== "string") return;
179
+ const normalized = value.trim().toLowerCase();
180
+ if (!normalized) return;
181
+ const truthy = options.truthy ?? DEFAULT_TRUTHY;
182
+ const falsy = options.falsy ?? DEFAULT_FALSY;
183
+ const truthySet = truthy === DEFAULT_TRUTHY ? DEFAULT_TRUTHY_SET : new Set(truthy);
184
+ const falsySet = falsy === DEFAULT_FALSY ? DEFAULT_FALSY_SET : new Set(falsy);
185
+ if (truthySet.has(normalized)) return true;
186
+ if (falsySet.has(normalized)) return false;
187
+ }
188
+
189
+ //#endregion
190
+ //#region src/infra/env.ts
191
+ const log = createSubsystemLogger("env");
192
+ function normalizeZaiEnv() {
193
+ if (!process.env.ZAI_API_KEY?.trim() && process.env.Z_AI_API_KEY?.trim()) process.env.ZAI_API_KEY = process.env.Z_AI_API_KEY;
194
+ }
195
+ function isTruthyEnvValue(value) {
196
+ return parseBooleanValue(value) === true;
197
+ }
198
+ function normalizeEnv() {
199
+ normalizeZaiEnv();
200
+ }
201
+
202
+ //#endregion
203
+ //#region src/entry.ts
204
+ /**
205
+ * CLI entry point for Milaidy.
206
+ *
207
+ * This file is built by tsdown into dist/entry.js and invoked by milaidy.mjs.
208
+ * It bootstraps the CLI: normalizes env, applies profile settings,
209
+ * and delegates to the Commander-based CLI.
210
+ */
211
+ process$1.title = "milaidy";
212
+ normalizeEnv();
213
+ if (process$1.argv.includes("--no-color")) {
214
+ process$1.env.NO_COLOR = "1";
215
+ process$1.env.FORCE_COLOR = "0";
216
+ }
217
+ const parsed = parseCliProfileArgs(process$1.argv);
218
+ if (!parsed.ok) {
219
+ console.error(`[milaidy] ${parsed.error}`);
220
+ process$1.exit(2);
221
+ }
222
+ if (parsed.profile) {
223
+ applyCliProfileEnv({ profile: parsed.profile });
224
+ process$1.argv = parsed.argv;
225
+ }
226
+ import("./run-main-XODklzS-.js").then(({ runCli }) => runCli(process$1.argv)).catch((error) => {
227
+ console.error("[milaidy] Failed to start CLI:", error instanceof Error ? error.stack ?? error.message : error);
228
+ process$1.exitCode = 1;
229
+ });
230
+
231
+ //#endregion
232
+ export { normalizeEnv as n, isTruthyEnvValue as t };
package/dist/index.js ADDED
@@ -0,0 +1,209 @@
1
+ import os from "node:os";
2
+ import path from "node:path";
3
+ import "@elizaos/core";
4
+ import chalk, { Chalk } from "chalk";
5
+
6
+ //#region src/config/paths.ts
7
+ /**
8
+ * Nix mode detection: When MILAIDY_NIX_MODE=1, the gateway is running under Nix.
9
+ * In this mode:
10
+ * - No auto-install flows should be attempted
11
+ * - Missing dependencies should produce actionable Nix-specific error messages
12
+ * - Config is managed externally (read-only from Nix perspective)
13
+ */
14
+ function resolveIsNixMode(env = process.env) {
15
+ return env.MILAIDY_NIX_MODE === "1";
16
+ }
17
+ const isNixMode = resolveIsNixMode();
18
+ const STATE_DIRNAME = ".milaidy";
19
+ const CONFIG_FILENAME = "milaidy.json";
20
+ function stateDir(homedir = os.homedir) {
21
+ return path.join(homedir(), STATE_DIRNAME);
22
+ }
23
+ /**
24
+ * State directory for mutable data (sessions, logs, caches).
25
+ * Can be overridden via MILAIDY_STATE_DIR.
26
+ * Default: ~/.milaidy
27
+ */
28
+ function resolveStateDir(env = process.env, homedir = os.homedir) {
29
+ const override = env.MILAIDY_STATE_DIR?.trim();
30
+ if (override) return resolveUserPath$1(override);
31
+ return stateDir(homedir);
32
+ }
33
+ function resolveUserPath$1(input) {
34
+ const trimmed = input.trim();
35
+ if (!trimmed) return trimmed;
36
+ if (trimmed.startsWith("~")) {
37
+ const expanded = trimmed.replace(/^~(?=$|[\\/])/, os.homedir());
38
+ return path.resolve(expanded);
39
+ }
40
+ return path.resolve(trimmed);
41
+ }
42
+ const STATE_DIR = resolveStateDir();
43
+ /**
44
+ * Config file path (JSON5).
45
+ * Can be overridden via MILAIDY_CONFIG_PATH.
46
+ * Default: ~/.milaidy/milaidy.json (or $MILAIDY_STATE_DIR/milaidy.json)
47
+ */
48
+ function resolveCanonicalConfigPath(env = process.env, stateDirPath = resolveStateDir(env, os.homedir)) {
49
+ const override = env.MILAIDY_CONFIG_PATH?.trim();
50
+ if (override) return resolveUserPath$1(override);
51
+ return path.join(stateDirPath, CONFIG_FILENAME);
52
+ }
53
+ /**
54
+ * Resolve the active config path by preferring existing config candidates
55
+ * before falling back to the canonical path.
56
+ */
57
+ function resolveConfigPathCandidate(env = process.env, homedir = os.homedir) {
58
+ return resolveCanonicalConfigPath(env, resolveStateDir(env, homedir));
59
+ }
60
+ const CONFIG_PATH = resolveConfigPathCandidate();
61
+
62
+ //#endregion
63
+ //#region src/logging.ts
64
+ const ALLOWED_LOG_LEVELS = [
65
+ "trace",
66
+ "debug",
67
+ "info",
68
+ "warn",
69
+ "error",
70
+ "fatal",
71
+ "silent"
72
+ ];
73
+ function normalizeLogLevel(level, fallback = "info") {
74
+ if (!level) return fallback;
75
+ const normalized = level.toLowerCase();
76
+ return ALLOWED_LOG_LEVELS.includes(normalized) ? normalized : fallback;
77
+ }
78
+ let consoleSettings = {
79
+ level: normalizeLogLevel(process.env.LOG_LEVEL, "info"),
80
+ style: process.env.LOG_JSON_FORMAT === "true" ? "json" : "pretty"
81
+ };
82
+
83
+ //#endregion
84
+ //#region src/terminal/palette.ts
85
+ const CLI_PALETTE = {
86
+ accent: "#FF5A2D",
87
+ accentBright: "#FF7A3D",
88
+ accentDim: "#D14A22",
89
+ info: "#FF8A5B",
90
+ success: "#2FBF71",
91
+ warn: "#FFB020",
92
+ error: "#E23D2D",
93
+ muted: "#8B7F77"
94
+ };
95
+
96
+ //#endregion
97
+ //#region src/terminal/theme.ts
98
+ const hasForceColor = typeof process.env.FORCE_COLOR === "string" && process.env.FORCE_COLOR.trim().length > 0 && process.env.FORCE_COLOR.trim() !== "0";
99
+ const baseChalk = process.env.NO_COLOR && !hasForceColor ? new Chalk({ level: 0 }) : chalk;
100
+ const hex = (value) => baseChalk.hex(value);
101
+ const theme = {
102
+ accent: hex(CLI_PALETTE.accent),
103
+ accentBright: hex(CLI_PALETTE.accentBright),
104
+ accentDim: hex(CLI_PALETTE.accentDim),
105
+ info: hex(CLI_PALETTE.info),
106
+ success: hex(CLI_PALETTE.success),
107
+ warn: hex(CLI_PALETTE.warn),
108
+ error: hex(CLI_PALETTE.error),
109
+ muted: hex(CLI_PALETTE.muted),
110
+ heading: baseChalk.bold.hex(CLI_PALETTE.accent),
111
+ command: hex(CLI_PALETTE.accentBright),
112
+ option: hex(CLI_PALETTE.warn)
113
+ };
114
+
115
+ //#endregion
116
+ //#region src/globals.ts
117
+ const success = theme.success;
118
+ const warn = theme.warn;
119
+ const info = theme.info;
120
+ const danger = theme.error;
121
+
122
+ //#endregion
123
+ //#region src/utils.ts
124
+ function assertWebChannel(input) {
125
+ if (input !== "web") throw new Error("Web channel must be 'web'");
126
+ }
127
+ function normalizeE164(number) {
128
+ const digits = number.replace(/^whatsapp:/, "").trim().replace(/[^\d+]/g, "");
129
+ if (digits.startsWith("+")) return `+${digits.slice(1)}`;
130
+ return `+${digits}`;
131
+ }
132
+ function toWhatsappJid(number) {
133
+ const withoutPrefix = number.replace(/^whatsapp:/, "").trim();
134
+ if (withoutPrefix.includes("@")) return withoutPrefix;
135
+ return `${normalizeE164(withoutPrefix).replace(/\D/g, "")}@s.whatsapp.net`;
136
+ }
137
+ function resolveUserPath(input) {
138
+ const trimmed = input.trim();
139
+ if (!trimmed) return trimmed;
140
+ if (trimmed.startsWith("~")) {
141
+ const expanded = trimmed.replace(/^~(?=$|[\\/])/, os.homedir());
142
+ return path.resolve(expanded);
143
+ }
144
+ return path.resolve(trimmed);
145
+ }
146
+ function resolveConfigDir(env = process.env, homedir = os.homedir) {
147
+ const override = env.MILAIDY_STATE_DIR?.trim();
148
+ if (override) return resolveUserPath(override);
149
+ return path.join(homedir(), ".milaidy");
150
+ }
151
+ const CONFIG_DIR = resolveConfigDir();
152
+
153
+ //#endregion
154
+ //#region src/index.ts
155
+ /**
156
+ * Milaidy exports - deprecated, functionality moved to ElizaOS
157
+ *
158
+ * @deprecated This module is deprecated. Import from @elizaos/core instead.
159
+ *
160
+ * **Migration Path:**
161
+ *
162
+ * Most Milaidy functionality has been migrated to ElizaOS. Update your imports:
163
+ *
164
+ * ```typescript
165
+ * // Before (deprecated):
166
+ * import { SomeType } from "milaidy";
167
+ *
168
+ * // After (recommended):
169
+ * import { SomeType } from "@elizaos/core";
170
+ * ```
171
+ *
172
+ * **What's changed:**
173
+ * - Runtime types: Use `@elizaos/core`
174
+ * - Plugin types: Use `@elizaos/core`
175
+ * - Agent types: Use `@elizaos/core`
176
+ * - Config types: Still available here for backward compatibility
177
+ * - Utilities (assertWebChannel, normalizeE164, toWhatsappJid): Still available
178
+ *
179
+ * See: https://docs.elizaos.ai/migration/from-milaidy
180
+ *
181
+ * @module milaidy
182
+ */
183
+ let moduleDeprecationWarningShown = false;
184
+ if (!moduleDeprecationWarningShown && typeof console !== "undefined") {
185
+ console.warn("[DEPRECATED] Importing from 'milaidy' is deprecated.\nMigration: Import from '@elizaos/core' instead.\nConfig types are still available for backward compatibility.\nSee: https://docs.elizaos.ai/migration/from-milaidy");
186
+ moduleDeprecationWarningShown = true;
187
+ }
188
+ /**
189
+ * Check if a config object uses deprecated fields.
190
+ * Logs warnings for any deprecated usage found.
191
+ *
192
+ * @param config - The config object to check
193
+ * @param configPath - Optional path to the config file for better error messages
194
+ */
195
+ function checkDeprecatedConfigFields(config, configPath) {
196
+ const location = configPath ? ` in ${configPath}` : "";
197
+ if ("agent" in config && config.agent !== void 0) console.warn(`[DEPRECATED] The 'agent' config field${location} is deprecated.\nMigration: Use 'agents' config instead.
198
+
199
+ Before:
200
+ { "agent": { "name": "MyAgent", ... } }
201
+
202
+ After:
203
+ { "agents": { "default": { "name": "MyAgent", ... } } }
204
+
205
+ See: https://docs.elizaos.ai/configuration#agents`);
206
+ }
207
+
208
+ //#endregion
209
+ export { assertWebChannel, checkDeprecatedConfigFields, normalizeE164, toWhatsappJid };
@@ -0,0 +1,15 @@
1
+ import { t as formatTerminalLink } from "./utils-C1AUpp_V.js";
2
+
3
+ //#region src/terminal/links.ts
4
+ const DOCS_ROOT = "https://docs.milaidy.ai";
5
+ function formatDocsLink(path, label, opts) {
6
+ const trimmed = path.trim();
7
+ const url = trimmed.startsWith("http") ? trimmed : `${DOCS_ROOT}${trimmed.startsWith("/") ? trimmed : `/${trimmed}`}`;
8
+ return formatTerminalLink(label ?? url, url, {
9
+ fallback: opts?.fallback ?? url,
10
+ force: opts?.force
11
+ });
12
+ }
13
+
14
+ //#endregion
15
+ export { formatDocsLink as t };
@@ -0,0 +1,69 @@
1
+ import os from "node:os";
2
+ import path from "node:path";
3
+
4
+ //#region src/config/paths.ts
5
+ /**
6
+ * Nix mode detection: When MILAIDY_NIX_MODE=1, the gateway is running under Nix.
7
+ * In this mode:
8
+ * - No auto-install flows should be attempted
9
+ * - Missing dependencies should produce actionable Nix-specific error messages
10
+ * - Config is managed externally (read-only from Nix perspective)
11
+ */
12
+ function resolveIsNixMode(env = process.env) {
13
+ return env.MILAIDY_NIX_MODE === "1";
14
+ }
15
+ const isNixMode = resolveIsNixMode();
16
+ const STATE_DIRNAME = ".milaidy";
17
+ const CONFIG_FILENAME = "milaidy.json";
18
+ function stateDir(homedir = os.homedir) {
19
+ return path.join(homedir(), STATE_DIRNAME);
20
+ }
21
+ /**
22
+ * State directory for mutable data (sessions, logs, caches).
23
+ * Can be overridden via MILAIDY_STATE_DIR.
24
+ * Default: ~/.milaidy
25
+ */
26
+ function resolveStateDir(env = process.env, homedir = os.homedir) {
27
+ const override = env.MILAIDY_STATE_DIR?.trim();
28
+ if (override) return resolveUserPath(override);
29
+ return stateDir(homedir);
30
+ }
31
+ function resolveUserPath(input) {
32
+ const trimmed = input.trim();
33
+ if (!trimmed) return trimmed;
34
+ if (trimmed.startsWith("~")) {
35
+ const expanded = trimmed.replace(/^~(?=$|[\\/])/, os.homedir());
36
+ return path.resolve(expanded);
37
+ }
38
+ return path.resolve(trimmed);
39
+ }
40
+ const STATE_DIR = resolveStateDir();
41
+ /**
42
+ * Config file path (JSON5).
43
+ * Can be overridden via MILAIDY_CONFIG_PATH.
44
+ * Default: ~/.milaidy/milaidy.json (or $MILAIDY_STATE_DIR/milaidy.json)
45
+ */
46
+ function resolveCanonicalConfigPath(env = process.env, stateDirPath = resolveStateDir(env, os.homedir)) {
47
+ const override = env.MILAIDY_CONFIG_PATH?.trim();
48
+ if (override) return resolveUserPath(override);
49
+ return path.join(stateDirPath, CONFIG_FILENAME);
50
+ }
51
+ /**
52
+ * Resolve the active config path by preferring existing config candidates
53
+ * before falling back to the canonical path.
54
+ */
55
+ function resolveConfigPathCandidate(env = process.env, homedir = os.homedir) {
56
+ return resolveCanonicalConfigPath(env, resolveStateDir(env, homedir));
57
+ }
58
+ /**
59
+ * Active config path (prefers existing config files).
60
+ */
61
+ function resolveConfigPath(env = process.env, stateDirPath = resolveStateDir(env, os.homedir), _homedir = os.homedir) {
62
+ const override = env.MILAIDY_CONFIG_PATH?.trim();
63
+ if (override) return resolveUserPath(override);
64
+ return path.join(stateDirPath, CONFIG_FILENAME);
65
+ }
66
+ const CONFIG_PATH = resolveConfigPathCandidate();
67
+
68
+ //#endregion
69
+ export { resolveConfigPath as t };
@@ -0,0 +1,134 @@
1
+ //#region src/cli/plugins-cli.ts
2
+ const PLUGIN_REGISTRY = [
3
+ {
4
+ name: "@elizaos/plugin-anthropic",
5
+ description: "Anthropic Claude models"
6
+ },
7
+ {
8
+ name: "@elizaos/plugin-openai",
9
+ description: "OpenAI GPT models"
10
+ },
11
+ {
12
+ name: "@elizaos/plugin-google-genai",
13
+ description: "Google Gemini models"
14
+ },
15
+ {
16
+ name: "@elizaos/plugin-groq",
17
+ description: "Groq inference"
18
+ },
19
+ {
20
+ name: "@elizaos/plugin-ollama",
21
+ description: "Local Ollama models"
22
+ },
23
+ {
24
+ name: "@elizaos/plugin-xai",
25
+ description: "xAI Grok models"
26
+ },
27
+ {
28
+ name: "@elizaos/plugin-openrouter",
29
+ description: "OpenRouter multi-model gateway"
30
+ },
31
+ {
32
+ name: "@elizaos/plugin-telegram",
33
+ description: "Telegram bot integration"
34
+ },
35
+ {
36
+ name: "@elizaos/plugin-discord",
37
+ description: "Discord bot integration"
38
+ },
39
+ {
40
+ name: "@elizaos/plugin-whatsapp",
41
+ description: "WhatsApp integration"
42
+ },
43
+ {
44
+ name: "@elizaos/plugin-shell",
45
+ description: "Shell command execution"
46
+ },
47
+ {
48
+ name: "@elizaos/plugin-browser",
49
+ description: "Browser automation"
50
+ },
51
+ {
52
+ name: "@elizaos/plugin-sql",
53
+ description: "SQL database integration"
54
+ },
55
+ {
56
+ name: "@elizaos/plugin-cron",
57
+ description: "Scheduled tasks"
58
+ },
59
+ {
60
+ name: "@elizaos/plugin-cli",
61
+ description: "CLI interface"
62
+ },
63
+ {
64
+ name: "@elizaos/plugin-code",
65
+ description: "Code analysis and execution"
66
+ },
67
+ {
68
+ name: "@elizaos/plugin-directives",
69
+ description: "Response directives"
70
+ },
71
+ {
72
+ name: "@elizaos/plugin-agent-skills",
73
+ description: "Agent skills framework"
74
+ },
75
+ {
76
+ name: "@elizaos/plugin-acp",
77
+ description: "Agent Communication Protocol"
78
+ }
79
+ ];
80
+ /**
81
+ * Register the plugins CLI commands.
82
+ *
83
+ * @param program - Commander program instance
84
+ */
85
+ function registerPluginsCli(program) {
86
+ const pluginsCommand = program.command("plugins").description("Plugin management (ElizaOS plugins)");
87
+ pluginsCommand.command("list").description("List available ElizaOS plugins").action(async () => {
88
+ console.log("\nAvailable ElizaOS plugins:\n");
89
+ for (const plugin of PLUGIN_REGISTRY) {
90
+ console.log(` ${plugin.name}`);
91
+ console.log(` ${plugin.description}\n`);
92
+ }
93
+ console.log("To install a plugin, add it to your package.json dependencies:");
94
+ console.log(" \"dependencies\": {");
95
+ console.log(" \"@elizaos/plugin-<name>\": \"workspace:*\"");
96
+ console.log(" }");
97
+ console.log("\nThen run: pnpm install\n");
98
+ });
99
+ pluginsCommand.command("info <pluginName>").description("Show information about a plugin").action(async (pluginName) => {
100
+ const normalizedName = pluginName.startsWith("@elizaos/plugin-") ? pluginName : `@elizaos/plugin-${pluginName}`;
101
+ const plugin = PLUGIN_REGISTRY.find((p) => p.name === normalizedName);
102
+ if (plugin) {
103
+ console.log(`\n${plugin.name}`);
104
+ console.log(` ${plugin.description}`);
105
+ console.log(`\nInstallation:`);
106
+ console.log(` pnpm add ${plugin.name}`);
107
+ console.log(`\nUsage in character.json:`);
108
+ console.log(` {`);
109
+ console.log(` "plugins": ["${plugin.name}"]`);
110
+ console.log(` }\n`);
111
+ } else {
112
+ console.log(`\nPlugin not found in registry: ${normalizedName}`);
113
+ console.log("\nUse 'milaidy plugins list' to see available plugins.\n");
114
+ }
115
+ });
116
+ pluginsCommand.command("install <pluginName>").description("Install an ElizaOS plugin").action(async (pluginName) => {
117
+ const normalizedName = pluginName.startsWith("@elizaos/plugin-") ? pluginName : `@elizaos/plugin-${pluginName}`;
118
+ console.log(`\nTo install ${normalizedName}:\n`);
119
+ console.log(` pnpm add ${normalizedName}`);
120
+ console.log(`\nThen add it to your character configuration:\n`);
121
+ console.log(` {`);
122
+ console.log(` "plugins": ["${normalizedName}"]`);
123
+ console.log(` }\n`);
124
+ });
125
+ pluginsCommand.command("update").description("Update installed plugins").action(async () => {
126
+ console.log("\nTo update all ElizaOS plugins:\n");
127
+ console.log(" pnpm update '@elizaos/*'\n");
128
+ console.log("Or update a specific plugin:\n");
129
+ console.log(" pnpm update @elizaos/plugin-<name>\n");
130
+ });
131
+ }
132
+
133
+ //#endregion
134
+ export { registerPluginsCli };