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,26 @@
1
+ //#region src/cli/program/register.models.ts
2
+ function registerModelsCli(program) {
3
+ const models = program.command("models").description("Model configuration");
4
+ models.command("list").description("List configured model providers").option("--json", "Output JSON").action(async () => {
5
+ console.log("[milaidy] Model providers:");
6
+ for (const [key, name] of [
7
+ ["ANTHROPIC_API_KEY", "Anthropic (Claude)"],
8
+ ["OPENAI_API_KEY", "OpenAI (GPT)"],
9
+ ["GOOGLE_API_KEY", "Google (Gemini)"],
10
+ ["GROQ_API_KEY", "Groq"],
11
+ ["XAI_API_KEY", "xAI (Grok)"],
12
+ ["OPENROUTER_API_KEY", "OpenRouter"],
13
+ ["OLLAMA_BASE_URL", "Ollama (local)"]
14
+ ]) {
15
+ const status = process.env[key] ? "configured" : "not set";
16
+ console.log(` ${name}: ${status}`);
17
+ }
18
+ });
19
+ models.command("set-default <model>").description("Set the default model").action(async (model) => {
20
+ console.log(`[milaidy] Set default model: ${model}`);
21
+ console.log("[milaidy] Use: milaidy config set agents.defaults.model.primary " + model);
22
+ });
23
+ }
24
+
25
+ //#endregion
26
+ export { registerModelsCli };
@@ -0,0 +1,9 @@
1
+ //#region src/cli/program/register.nodes.ts
2
+ function registerNodesCli(program) {
3
+ program.command("nodes").description("Node commands").command("list").description("List connected nodes").option("--json", "Output JSON").action(async () => {
4
+ console.log("[milaidy] Nodes list — not yet fully implemented.");
5
+ });
6
+ }
7
+
8
+ //#endregion
9
+ export { registerNodesCli };
@@ -0,0 +1,10 @@
1
+ //#region src/cli/program/register.skills.ts
2
+ function registerSkillsCli(program) {
3
+ program.command("skills").description("Skills management").command("list").description("List available skills").option("--json", "Output JSON").action(async () => {
4
+ console.log("[milaidy] Skills management — not yet fully implemented.");
5
+ console.log("[milaidy] Skills are loaded from the agent workspace directory.");
6
+ });
7
+ }
8
+
9
+ //#endregion
10
+ export { registerSkillsCli };
@@ -0,0 +1,187 @@
1
+ import { t as isTruthyEnvValue } from "./entry.js";
2
+ import { a as hasHelpOrVersion, r as getPrimaryCommand, t as buildParseArgv } from "./argv-CfSowvEA.js";
3
+ import { createRequire } from "node:module";
4
+
5
+ //#region \0rolldown/runtime.js
6
+ var __defProp = Object.defineProperty;
7
+ var __exportAll = (all, no_symbols) => {
8
+ let target = {};
9
+ for (var name in all) {
10
+ __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ }
15
+ if (!no_symbols) {
16
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
17
+ }
18
+ return target;
19
+ };
20
+
21
+ //#endregion
22
+ //#region src/cli/program/helpers.ts
23
+ /**
24
+ * Extract the action args from a Commander action callback.
25
+ * Used when re-parsing after lazy-loading a subcommand.
26
+ */
27
+ function resolveActionArgs(command) {
28
+ if (!command) return [];
29
+ return command.args ?? [];
30
+ }
31
+
32
+ //#endregion
33
+ //#region src/cli/program/register.subclis.ts
34
+ var register_subclis_exports = /* @__PURE__ */ __exportAll({
35
+ registerSubCliByName: () => registerSubCliByName,
36
+ registerSubCliCommands: () => registerSubCliCommands
37
+ });
38
+ const shouldRegisterPrimaryOnly = (argv) => {
39
+ if (isTruthyEnvValue(process.env.MILAIDY_DISABLE_LAZY_SUBCOMMANDS)) return false;
40
+ if (hasHelpOrVersion(argv)) return false;
41
+ return true;
42
+ };
43
+ const shouldEagerRegisterSubcommands = (_argv) => {
44
+ return isTruthyEnvValue(process.env.MILAIDY_DISABLE_LAZY_SUBCOMMANDS);
45
+ };
46
+ /**
47
+ * Sub-CLI entries — lazy-loaded command groups.
48
+ *
49
+ * Each entry registers a top-level command with subcommands.
50
+ * The module is only imported when the command is actually invoked.
51
+ */
52
+ const entries = [
53
+ {
54
+ name: "gateway",
55
+ description: "Gateway control",
56
+ register: async (program) => {
57
+ (await import("./register.gateway-82SLAvw3.js")).registerGatewayCli(program);
58
+ }
59
+ },
60
+ {
61
+ name: "plugins",
62
+ description: "Plugin management (ElizaOS plugins)",
63
+ register: async (program) => {
64
+ (await import("./plugins-cli-B7kSre2c.js")).registerPluginsCli(program);
65
+ }
66
+ },
67
+ {
68
+ name: "channels",
69
+ description: "Channel management",
70
+ register: async (program) => {
71
+ (await import("./register.channels-CMYQ6K6Y.js")).registerChannelsCli(program);
72
+ }
73
+ },
74
+ {
75
+ name: "agents",
76
+ description: "Manage isolated agents (workspaces + auth + routing)",
77
+ register: async (program) => {
78
+ (await import("./register.agents-CPVmSjMG.js")).registerAgentsCli(program);
79
+ }
80
+ },
81
+ {
82
+ name: "models",
83
+ description: "Model configuration",
84
+ register: async (program) => {
85
+ (await import("./register.models-BJt9eVgZ.js")).registerModelsCli(program);
86
+ }
87
+ },
88
+ {
89
+ name: "skills",
90
+ description: "Skills management",
91
+ register: async (program) => {
92
+ (await import("./register.skills-SFQqYIhg.js")).registerSkillsCli(program);
93
+ }
94
+ },
95
+ {
96
+ name: "devices",
97
+ description: "Device pairing + token management",
98
+ register: async (program) => {
99
+ (await import("./register.devices-rU5I5L_y.js")).registerDevicesCli(program);
100
+ }
101
+ },
102
+ {
103
+ name: "nodes",
104
+ description: "Node commands",
105
+ register: async (program) => {
106
+ (await import("./register.nodes-B5xY1s8a.js")).registerNodesCli(program);
107
+ }
108
+ },
109
+ {
110
+ name: "hooks",
111
+ description: "Hooks tooling",
112
+ register: async (program) => {
113
+ (await import("./register.hooks-B_XTBEkt.js")).registerHooksCli(program);
114
+ }
115
+ },
116
+ {
117
+ name: "cron",
118
+ description: "Cron scheduler",
119
+ register: async (program) => {
120
+ (await import("./register.cron-D91lY1_Y.js")).registerCronCli(program);
121
+ }
122
+ },
123
+ {
124
+ name: "logs",
125
+ description: "Gateway logs",
126
+ register: async (program) => {
127
+ (await import("./register.logs-BgEGcPd8.js")).registerLogsCli(program);
128
+ }
129
+ },
130
+ {
131
+ name: "browser",
132
+ description: "Manage Milaidy's dedicated browser (Chrome/Chromium)",
133
+ register: async (program) => {
134
+ (await import("./register.browser-B2ooXxNx.js")).registerBrowserCli(program);
135
+ }
136
+ }
137
+ ];
138
+ function removeCommand(program, command) {
139
+ const commands = program.commands;
140
+ const index = commands.indexOf(command);
141
+ if (index >= 0) commands.splice(index, 1);
142
+ }
143
+ async function registerSubCliByName(program, name) {
144
+ const entry = entries.find((candidate) => candidate.name === name);
145
+ if (!entry) return false;
146
+ const existing = program.commands.find((cmd) => cmd.name() === entry.name);
147
+ if (existing) removeCommand(program, existing);
148
+ await entry.register(program);
149
+ return true;
150
+ }
151
+ function registerLazyCommand(program, entry) {
152
+ const placeholder = program.command(entry.name).description(entry.description);
153
+ placeholder.allowUnknownOption(true);
154
+ placeholder.allowExcessArguments(true);
155
+ placeholder.action(async (...actionArgs) => {
156
+ removeCommand(program, placeholder);
157
+ await entry.register(program);
158
+ const actionCommand = actionArgs.at(-1);
159
+ const rawArgs = (actionCommand?.parent ?? program).rawArgs;
160
+ const actionArgsList = resolveActionArgs(actionCommand);
161
+ const fallbackArgv = actionCommand?.name() ? [actionCommand.name(), ...actionArgsList] : actionArgsList;
162
+ const parseArgv = buildParseArgv({
163
+ programName: program.name(),
164
+ rawArgs,
165
+ fallbackArgv
166
+ });
167
+ await program.parseAsync(parseArgv);
168
+ });
169
+ }
170
+ function registerSubCliCommands(program, argv = process.argv) {
171
+ if (shouldEagerRegisterSubcommands(argv)) {
172
+ for (const entry of entries) entry.register(program);
173
+ return;
174
+ }
175
+ const primary = getPrimaryCommand(argv);
176
+ if (primary && shouldRegisterPrimaryOnly(argv)) {
177
+ const entry = entries.find((candidate) => candidate.name === primary);
178
+ if (entry) {
179
+ registerLazyCommand(program, entry);
180
+ return;
181
+ }
182
+ }
183
+ for (const candidate of entries) registerLazyCommand(program, candidate);
184
+ }
185
+
186
+ //#endregion
187
+ export { register_subclis_exports as n, registerSubCliCommands as t };
@@ -0,0 +1,56 @@
1
+ import { n as normalizeEnv } from "./entry.js";
2
+ import { a as hasHelpOrVersion, r as getPrimaryCommand } from "./argv-CfSowvEA.js";
3
+ import process from "node:process";
4
+
5
+ //#region src/cli/run-main.ts
6
+ /**
7
+ * CLI entry point — boots the Commander-based CLI.
8
+ *
9
+ * Mirrors the openclaw-classic pattern:
10
+ * 1. Load .env files
11
+ * 2. Normalize environment
12
+ * 3. Build the Commander program
13
+ * 4. Lazy-load the primary subcommand (if detected)
14
+ * 5. Parse and execute
15
+ *
16
+ * @module cli/run-main
17
+ */
18
+ /**
19
+ * Load dotenv files (CWD first, then ~/.milaidy/.env).
20
+ * Best-effort — never crashes.
21
+ */
22
+ async function loadDotEnv() {
23
+ try {
24
+ const dotenvModule = await import("dotenv");
25
+ const configFn = dotenvModule.config ?? dotenvModule.default;
26
+ if (typeof configFn === "function") configFn();
27
+ else if (configFn && typeof configFn === "object" && "config" in configFn && typeof configFn.config === "function") configFn.config();
28
+ } catch {}
29
+ }
30
+ function formatUncaughtError(error) {
31
+ if (error instanceof Error) return error.stack ?? error.message;
32
+ return String(error);
33
+ }
34
+ async function runCli(argv = process.argv) {
35
+ await loadDotEnv();
36
+ normalizeEnv();
37
+ const { buildProgram } = await import("./program-6KwWwKKh.js");
38
+ const program = buildProgram();
39
+ process.on("unhandledRejection", (reason) => {
40
+ console.error("[milaidy] Unhandled rejection:", formatUncaughtError(reason));
41
+ process.exit(1);
42
+ });
43
+ process.on("uncaughtException", (error) => {
44
+ console.error("[milaidy] Uncaught exception:", formatUncaughtError(error));
45
+ process.exit(1);
46
+ });
47
+ const primary = getPrimaryCommand(argv);
48
+ if (primary && !hasHelpOrVersion(argv)) {
49
+ const { registerSubCliByName } = await import("./register.subclis-uF_AsbWR.js").then((n) => n.n);
50
+ await registerSubCliByName(program, primary);
51
+ }
52
+ await program.parseAsync(argv);
53
+ }
54
+
55
+ //#endregion
56
+ export { runCli };
@@ -0,0 +1,36 @@
1
+ import chalk, { Chalk } from "chalk";
2
+
3
+ //#region src/terminal/palette.ts
4
+ const CLI_PALETTE = {
5
+ accent: "#FF5A2D",
6
+ accentBright: "#FF7A3D",
7
+ accentDim: "#D14A22",
8
+ info: "#FF8A5B",
9
+ success: "#2FBF71",
10
+ warn: "#FFB020",
11
+ error: "#E23D2D",
12
+ muted: "#8B7F77"
13
+ };
14
+
15
+ //#endregion
16
+ //#region src/terminal/theme.ts
17
+ const hasForceColor = typeof process.env.FORCE_COLOR === "string" && process.env.FORCE_COLOR.trim().length > 0 && process.env.FORCE_COLOR.trim() !== "0";
18
+ const baseChalk = process.env.NO_COLOR && !hasForceColor ? new Chalk({ level: 0 }) : chalk;
19
+ const hex = (value) => baseChalk.hex(value);
20
+ const theme = {
21
+ accent: hex(CLI_PALETTE.accent),
22
+ accentBright: hex(CLI_PALETTE.accentBright),
23
+ accentDim: hex(CLI_PALETTE.accentDim),
24
+ info: hex(CLI_PALETTE.info),
25
+ success: hex(CLI_PALETTE.success),
26
+ warn: hex(CLI_PALETTE.warn),
27
+ error: hex(CLI_PALETTE.error),
28
+ muted: hex(CLI_PALETTE.muted),
29
+ heading: baseChalk.bold.hex(CLI_PALETTE.accent),
30
+ command: hex(CLI_PALETTE.accentBright),
31
+ option: hex(CLI_PALETTE.warn)
32
+ };
33
+ const isRich = () => Boolean(baseChalk.level > 0);
34
+
35
+ //#endregion
36
+ export { theme as n, isRich as t };
@@ -0,0 +1,42 @@
1
+ import { n as theme } from "./theme-DBvtuGeq.js";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ import fs from "node:fs";
5
+
6
+ //#region src/globals.ts
7
+ let globalVerbose = false;
8
+ function setVerbose(v) {
9
+ globalVerbose = v;
10
+ }
11
+ const success = theme.success;
12
+ const warn = theme.warn;
13
+ const info = theme.info;
14
+ const danger = theme.error;
15
+
16
+ //#endregion
17
+ //#region src/utils.ts
18
+ function resolveUserPath(input) {
19
+ const trimmed = input.trim();
20
+ if (!trimmed) return trimmed;
21
+ if (trimmed.startsWith("~")) {
22
+ const expanded = trimmed.replace(/^~(?=$|[\\/])/, os.homedir());
23
+ return path.resolve(expanded);
24
+ }
25
+ return path.resolve(trimmed);
26
+ }
27
+ function resolveConfigDir(env = process.env, homedir = os.homedir) {
28
+ const override = env.MILAIDY_STATE_DIR?.trim();
29
+ if (override) return resolveUserPath(override);
30
+ return path.join(homedir(), ".milaidy");
31
+ }
32
+ function formatTerminalLink(label, url, opts) {
33
+ const esc = "\x1B";
34
+ const safeLabel = label.replaceAll(esc, "");
35
+ const safeUrl = url.replaceAll(esc, "");
36
+ if (!(opts?.force === true ? true : opts?.force === false ? false : Boolean(process.stdout.isTTY))) return opts?.fallback ?? `${safeLabel} (${safeUrl})`;
37
+ return `\u001b]8;;${safeUrl}\u0007${safeLabel}\u001b]8;;\u0007`;
38
+ }
39
+ const CONFIG_DIR = resolveConfigDir();
40
+
41
+ //#endregion
42
+ export { resolveUserPath as n, setVerbose as r, formatTerminalLink as t };
@@ -0,0 +1,26 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ //#region src/version.ts
4
+ function readVersionFromPackageJson() {
5
+ try {
6
+ return createRequire(import.meta.url)("../package.json").version ?? null;
7
+ } catch {
8
+ return null;
9
+ }
10
+ }
11
+ function readVersionFromBuildInfo() {
12
+ try {
13
+ const require = createRequire(import.meta.url);
14
+ for (const candidate of ["../build-info.json", "./build-info.json"]) try {
15
+ const info = require(candidate);
16
+ if (info.version) return info.version;
17
+ } catch {}
18
+ return null;
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+ const VERSION = typeof __MILAIDY_VERSION__ === "string" && __MILAIDY_VERSION__ || process.env.MILAIDY_BUNDLED_VERSION || readVersionFromPackageJson() || readVersionFromBuildInfo() || "0.0.0";
24
+
25
+ //#endregion
26
+ export { VERSION as t };
@@ -0,0 +1,206 @@
1
+ import { a as DEFAULT_IDENTITY_FILENAME, c as DEFAULT_TOOLS_FILENAME, d as filterBootstrapFilesForSession, f as loadWorkspaceBootstrapFiles, i as DEFAULT_HEARTBEAT_FILENAME, l as DEFAULT_USER_FILENAME, n as DEFAULT_AGENT_WORKSPACE_DIR, o as DEFAULT_MEMORY_ALT_FILENAME, p as resolveDefaultAgentWorkspaceDir, r as DEFAULT_BOOTSTRAP_FILENAME, s as DEFAULT_MEMORY_FILENAME, t as DEFAULT_AGENTS_FILENAME, u as ensureAgentWorkspace } from "./workspace-DCA6MNVK.js";
2
+ import { t as resolveConfigPath } from "./paths-D_yh1DEJ.js";
3
+ import "./theme-DBvtuGeq.js";
4
+ import "./utils-C1AUpp_V.js";
5
+ import path from "node:path";
6
+ import fs from "node:fs";
7
+ import JSON5 from "json5";
8
+
9
+ //#region src/config/includes.ts
10
+ /**
11
+ * Config includes: $include directive for modular configs
12
+ *
13
+ * @example
14
+ * ```json5
15
+ * {
16
+ * "$include": "./base.json5", // single file
17
+ * "$include": ["./a.json5", "./b.json5"] // merge multiple
18
+ * }
19
+ * ```
20
+ */
21
+ const INCLUDE_KEY = "$include";
22
+ const MAX_INCLUDE_DEPTH = 10;
23
+ var ConfigIncludeError = class extends Error {
24
+ constructor(message, includePath, cause) {
25
+ super(message);
26
+ this.includePath = includePath;
27
+ this.cause = cause;
28
+ this.name = "ConfigIncludeError";
29
+ }
30
+ };
31
+ var CircularIncludeError = class extends ConfigIncludeError {
32
+ constructor(chain) {
33
+ super(`Circular include detected: ${chain.join(" -> ")}`, chain[chain.length - 1]);
34
+ this.chain = chain;
35
+ this.name = "CircularIncludeError";
36
+ }
37
+ };
38
+ function isPlainObject(value) {
39
+ return typeof value === "object" && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value) === "[object Object]";
40
+ }
41
+ /** Deep merge: arrays concatenate, objects merge recursively, primitives: source wins */
42
+ function deepMerge(target, source) {
43
+ if (Array.isArray(target) && Array.isArray(source)) return [...target, ...source];
44
+ if (isPlainObject(target) && isPlainObject(source)) {
45
+ const result = { ...target };
46
+ for (const key of Object.keys(source)) result[key] = key in result ? deepMerge(result[key], source[key]) : source[key];
47
+ return result;
48
+ }
49
+ return source;
50
+ }
51
+ var IncludeProcessor = class IncludeProcessor {
52
+ constructor(basePath, resolver) {
53
+ this.basePath = basePath;
54
+ this.resolver = resolver;
55
+ this.visited = /* @__PURE__ */ new Set();
56
+ this.depth = 0;
57
+ this.visited.add(path.normalize(basePath));
58
+ }
59
+ process(obj) {
60
+ if (Array.isArray(obj)) return obj.map((item) => this.process(item));
61
+ if (!isPlainObject(obj)) return obj;
62
+ if (!(INCLUDE_KEY in obj)) return this.processObject(obj);
63
+ return this.processInclude(obj);
64
+ }
65
+ processObject(obj) {
66
+ const result = {};
67
+ for (const [key, value] of Object.entries(obj)) result[key] = this.process(value);
68
+ return result;
69
+ }
70
+ processInclude(obj) {
71
+ const includeValue = obj[INCLUDE_KEY];
72
+ const otherKeys = Object.keys(obj).filter((k) => k !== INCLUDE_KEY);
73
+ const included = this.resolveInclude(includeValue);
74
+ if (otherKeys.length === 0) return included;
75
+ if (!isPlainObject(included)) throw new ConfigIncludeError("Sibling keys require included content to be an object", typeof includeValue === "string" ? includeValue : INCLUDE_KEY);
76
+ const rest = {};
77
+ for (const key of otherKeys) rest[key] = this.process(obj[key]);
78
+ return deepMerge(included, rest);
79
+ }
80
+ resolveInclude(value) {
81
+ if (typeof value === "string") return this.loadFile(value);
82
+ if (Array.isArray(value)) return value.reduce((merged, item) => {
83
+ if (typeof item !== "string") throw new ConfigIncludeError(`Invalid $include array item: expected string, got ${typeof item}`, String(item));
84
+ return deepMerge(merged, this.loadFile(item));
85
+ }, {});
86
+ throw new ConfigIncludeError(`Invalid $include value: expected string or array of strings, got ${typeof value}`, String(value));
87
+ }
88
+ loadFile(includePath) {
89
+ const resolvedPath = this.resolvePath(includePath);
90
+ this.checkCircular(resolvedPath);
91
+ this.checkDepth(includePath);
92
+ const raw = this.readFile(includePath, resolvedPath);
93
+ const parsed = this.parseFile(includePath, resolvedPath, raw);
94
+ return this.processNested(resolvedPath, parsed);
95
+ }
96
+ resolvePath(includePath) {
97
+ const resolved = path.isAbsolute(includePath) ? includePath : path.resolve(path.dirname(this.basePath), includePath);
98
+ return path.normalize(resolved);
99
+ }
100
+ checkCircular(resolvedPath) {
101
+ if (this.visited.has(resolvedPath)) throw new CircularIncludeError([...this.visited, resolvedPath]);
102
+ }
103
+ checkDepth(includePath) {
104
+ if (this.depth >= MAX_INCLUDE_DEPTH) throw new ConfigIncludeError(`Maximum include depth (${MAX_INCLUDE_DEPTH}) exceeded at: ${includePath}`, includePath);
105
+ }
106
+ readFile(includePath, resolvedPath) {
107
+ try {
108
+ return this.resolver.readFile(resolvedPath);
109
+ } catch (err) {
110
+ throw new ConfigIncludeError(`Failed to read include file: ${includePath} (resolved: ${resolvedPath})`, includePath, err instanceof Error ? err : void 0);
111
+ }
112
+ }
113
+ parseFile(includePath, resolvedPath, raw) {
114
+ try {
115
+ return this.resolver.parseJson(raw);
116
+ } catch (err) {
117
+ throw new ConfigIncludeError(`Failed to parse include file: ${includePath} (resolved: ${resolvedPath})`, includePath, err instanceof Error ? err : void 0);
118
+ }
119
+ }
120
+ processNested(resolvedPath, parsed) {
121
+ const nested = new IncludeProcessor(resolvedPath, this.resolver);
122
+ nested.visited = new Set([...this.visited, resolvedPath]);
123
+ nested.depth = this.depth + 1;
124
+ return nested.process(parsed);
125
+ }
126
+ };
127
+ const defaultResolver = {
128
+ readFile: (p) => fs.readFileSync(p, "utf-8"),
129
+ parseJson: (raw) => JSON5.parse(raw)
130
+ };
131
+ /**
132
+ * Resolves all $include directives in a parsed config object.
133
+ */
134
+ function resolveConfigIncludes(obj, configPath, resolver = defaultResolver) {
135
+ return new IncludeProcessor(configPath, resolver).process(obj);
136
+ }
137
+
138
+ //#endregion
139
+ //#region src/config/env-vars.ts
140
+ function collectConfigEnvVars(cfg) {
141
+ const envConfig = cfg?.env;
142
+ if (!envConfig) return {};
143
+ const entries = {};
144
+ if (envConfig.vars) for (const [key, value] of Object.entries(envConfig.vars)) {
145
+ if (!value) continue;
146
+ entries[key] = value;
147
+ }
148
+ for (const [key, value] of Object.entries(envConfig)) {
149
+ if (key === "shellEnv" || key === "vars") continue;
150
+ if (typeof value !== "string" || !value.trim()) continue;
151
+ entries[key] = value;
152
+ }
153
+ return entries;
154
+ }
155
+
156
+ //#endregion
157
+ //#region src/config/config.ts
158
+ /**
159
+ * Config loading and types.
160
+ *
161
+ * Reads ~/.milaidy/milaidy.json (or $MILAIDY_CONFIG_PATH), resolves $include
162
+ * directives, and applies inline env vars.
163
+ *
164
+ * @module config/config
165
+ */
166
+ /**
167
+ * Load the Milaidy config from disk.
168
+ *
169
+ * 1. Resolves the config path (~/.milaidy/milaidy.json or MILAIDY_CONFIG_PATH).
170
+ * 2. Parses the file as JSON5.
171
+ * 3. Resolves any $include directives.
172
+ * 4. Applies inline env vars (config.env.vars) to process.env.
173
+ *
174
+ * Returns an empty MilaidyConfig when the file is missing.
175
+ */
176
+ async function loadMilaidyConfig() {
177
+ const configPath = resolveConfigPath();
178
+ let raw;
179
+ try {
180
+ raw = fs.readFileSync(configPath, "utf-8");
181
+ } catch {
182
+ return {};
183
+ }
184
+ const resolved = resolveConfigIncludes(JSON5.parse(raw), configPath);
185
+ const envVars = collectConfigEnvVars(resolved);
186
+ for (const [key, value] of Object.entries(envVars)) if (!process.env[key]) process.env[key] = value;
187
+ return resolved;
188
+ }
189
+ /**
190
+ * Save the Milaidy config to disk.
191
+ *
192
+ * Writes the config as pretty-printed JSON to the resolved config path.
193
+ * Creates the parent directory if it doesn't exist.
194
+ */
195
+ function saveMilaidyConfig(config) {
196
+ const configPath = resolveConfigPath();
197
+ const dir = path.dirname(configPath);
198
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, {
199
+ recursive: true,
200
+ mode: 448
201
+ });
202
+ fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`, "utf-8");
203
+ }
204
+
205
+ //#endregion
206
+ export { ensureAgentWorkspace, saveMilaidyConfig as n, resolveDefaultAgentWorkspaceDir, loadMilaidyConfig as t };