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,300 @@
1
+ ---
2
+ summary: "Secret key names, aliases, validation patterns, and storage locations"
3
+ read_when:
4
+ - Configuring API keys or tokens
5
+ - Migrating secrets from another system
6
+ - Understanding secret validation errors
7
+ title: "Secrets"
8
+ ---
9
+
10
+ # Secrets
11
+
12
+ This document covers the canonical secret key names, backward-compatible aliases,
13
+ validation patterns, and storage locations used by Milaidy and ElizaOS.
14
+
15
+ ## Canonical Secret Keys
16
+
17
+ Use these official key names throughout your configuration:
18
+
19
+ ### Model Provider API Keys
20
+
21
+ | Key | Provider | Alias Support |
22
+ |-----|----------|---------------|
23
+ | `OPENAI_API_KEY` | OpenAI | `OPENAI_KEY`, `OPENAI_TOKEN` |
24
+ | `ANTHROPIC_API_KEY` | Anthropic | `ANTHROPIC_KEY`, `ANTHROPIC_TOKEN`, `CLAUDE_API_KEY` |
25
+ | `GOOGLE_API_KEY` | Google (Gemini) | `GOOGLE_KEY`, `GOOGLE_AI_KEY`, `GEMINI_API_KEY`, `GOOGLE_GENERATIVE_AI_API_KEY` |
26
+ | `GROQ_API_KEY` | Groq | `GROQ_KEY`, `GROQ_TOKEN` |
27
+ | `XAI_API_KEY` | XAI (Grok) | `XAI_KEY`, `GROK_API_KEY` |
28
+ | `OPENROUTER_API_KEY` | OpenRouter | `OPENROUTER_KEY`, `OPENROUTER_TOKEN` |
29
+ | `MISTRAL_API_KEY` | Mistral | `MISTRAL_KEY`, `MISTRAL_TOKEN` |
30
+ | `COHERE_API_KEY` | Cohere | `COHERE_KEY`, `COHERE_TOKEN` |
31
+ | `TOGETHER_API_KEY` | Together AI | `TOGETHER_KEY`, `TOGETHER_TOKEN` |
32
+ | `FIREWORKS_API_KEY` | Fireworks AI | - |
33
+ | `PERPLEXITY_API_KEY` | Perplexity | - |
34
+ | `DEEPSEEK_API_KEY` | DeepSeek | - |
35
+
36
+ ### Channel/Platform Tokens
37
+
38
+ | Key | Platform | Alias Support |
39
+ |-----|----------|---------------|
40
+ | `DISCORD_BOT_TOKEN` | Discord | `DISCORD_TOKEN`, `DISCORD_API_TOKEN` |
41
+ | `DISCORD_APPLICATION_ID` | Discord | - |
42
+ | `TELEGRAM_BOT_TOKEN` | Telegram | `TELEGRAM_TOKEN`, `TELEGRAM_API_TOKEN`, `TG_BOT_TOKEN` |
43
+ | `SLACK_BOT_TOKEN` | Slack | `SLACK_TOKEN`, `SLACK_API_TOKEN` |
44
+ | `SLACK_APP_TOKEN` | Slack | - |
45
+ | `WHATSAPP_TOKEN` | WhatsApp | `WHATSAPP_BOT_TOKEN`, `WHATSAPP_API_TOKEN` |
46
+ | `SIGNAL_CLI_PATH` | Signal | - |
47
+
48
+ ### Twitter/X Credentials
49
+
50
+ | Key | Description |
51
+ |-----|-------------|
52
+ | `TWITTER_USERNAME` | Twitter username |
53
+ | `TWITTER_PASSWORD` | Twitter password |
54
+ | `TWITTER_EMAIL` | Associated email |
55
+ | `TWITTER_2FA_SECRET` | TOTP secret (base32) |
56
+
57
+ ### Media/Voice Services
58
+
59
+ | Key | Service | Alias Support |
60
+ |-----|---------|---------------|
61
+ | `ELEVENLABS_API_KEY` | ElevenLabs TTS | `ELEVENLABS_KEY`, `ELEVEN_LABS_API_KEY` |
62
+ | `ELEVENLABS_VOICE_ID` | ElevenLabs voice | - |
63
+
64
+ ### Infrastructure
65
+
66
+ | Key | Description |
67
+ |-----|-------------|
68
+ | `ENCRYPTION_SALT` | Encryption salt (hex) |
69
+ | `DATABASE_URL` | Database connection string |
70
+ | `OLLAMA_BASE_URL` | Ollama server URL |
71
+
72
+ ## Key Aliases
73
+
74
+ Milaidy supports aliases for backward compatibility. When a secret is looked up,
75
+ aliases are automatically resolved to canonical names:
76
+
77
+ ```typescript
78
+ import { resolveSecretKeyAlias } from "@elizaos/core";
79
+
80
+ // Returns "DISCORD_BOT_TOKEN"
81
+ resolveSecretKeyAlias("DISCORD_TOKEN");
82
+
83
+ // Returns "ANTHROPIC_API_KEY"
84
+ resolveSecretKeyAlias("CLAUDE_API_KEY");
85
+ ```
86
+
87
+ ### Full Alias Mapping
88
+
89
+ | Legacy/Alternative | Canonical |
90
+ |-------------------|-----------|
91
+ | `DISCORD_TOKEN` | `DISCORD_BOT_TOKEN` |
92
+ | `DISCORD_API_TOKEN` | `DISCORD_BOT_TOKEN` |
93
+ | `TELEGRAM_TOKEN` | `TELEGRAM_BOT_TOKEN` |
94
+ | `TELEGRAM_API_TOKEN` | `TELEGRAM_BOT_TOKEN` |
95
+ | `TG_BOT_TOKEN` | `TELEGRAM_BOT_TOKEN` |
96
+ | `SLACK_TOKEN` | `SLACK_BOT_TOKEN` |
97
+ | `SLACK_API_TOKEN` | `SLACK_BOT_TOKEN` |
98
+ | `OPENAI_KEY` | `OPENAI_API_KEY` |
99
+ | `OPENAI_TOKEN` | `OPENAI_API_KEY` |
100
+ | `ANTHROPIC_KEY` | `ANTHROPIC_API_KEY` |
101
+ | `ANTHROPIC_TOKEN` | `ANTHROPIC_API_KEY` |
102
+ | `CLAUDE_API_KEY` | `ANTHROPIC_API_KEY` |
103
+ | `GOOGLE_KEY` | `GOOGLE_API_KEY` |
104
+ | `GOOGLE_AI_KEY` | `GOOGLE_API_KEY` |
105
+ | `GEMINI_API_KEY` | `GOOGLE_API_KEY` |
106
+ | `GOOGLE_GENERATIVE_AI_API_KEY` | `GOOGLE_API_KEY` |
107
+ | `GROQ_KEY` | `GROQ_API_KEY` |
108
+ | `GROQ_TOKEN` | `GROQ_API_KEY` |
109
+ | `XAI_KEY` | `XAI_API_KEY` |
110
+ | `GROK_API_KEY` | `XAI_API_KEY` |
111
+ | `OPENROUTER_KEY` | `OPENROUTER_API_KEY` |
112
+ | `OPENROUTER_TOKEN` | `OPENROUTER_API_KEY` |
113
+ | `MISTRAL_KEY` | `MISTRAL_API_KEY` |
114
+ | `MISTRAL_TOKEN` | `MISTRAL_API_KEY` |
115
+ | `COHERE_KEY` | `COHERE_API_KEY` |
116
+ | `COHERE_TOKEN` | `COHERE_API_KEY` |
117
+ | `TOGETHER_KEY` | `TOGETHER_API_KEY` |
118
+ | `TOGETHER_TOKEN` | `TOGETHER_API_KEY` |
119
+ | `ELEVENLABS_KEY` | `ELEVENLABS_API_KEY` |
120
+ | `ELEVEN_LABS_API_KEY` | `ELEVENLABS_API_KEY` |
121
+ | `WHATSAPP_BOT_TOKEN` | `WHATSAPP_TOKEN` |
122
+ | `WHATSAPP_API_TOKEN` | `WHATSAPP_TOKEN` |
123
+
124
+ ## Validation Patterns
125
+
126
+ ElizaOS validates secret formats without making API calls:
127
+
128
+ ### Model Provider Patterns
129
+
130
+ | Key | Pattern | Example |
131
+ |-----|---------|---------|
132
+ | `OPENAI_API_KEY` | `sk-[a-zA-Z0-9-_]{20,}` | `sk-proj-xxxx...` |
133
+ | `ANTHROPIC_API_KEY` | `sk-ant-[a-zA-Z0-9-_]{20,}` | `sk-ant-api03-xxxx...` |
134
+ | `GOOGLE_API_KEY` | `AIza[a-zA-Z0-9-_]{30,}` | `AIzaSyxxxx...` |
135
+ | `GROQ_API_KEY` | `gsk_[a-zA-Z0-9]{20,}` | `gsk_xxxx...` |
136
+ | `XAI_API_KEY` | `xai-[a-zA-Z0-9-_]{20,}` | `xai-xxxx...` |
137
+ | `OPENROUTER_API_KEY` | `sk-or-[a-zA-Z0-9-_]{20,}` | `sk-or-v1-xxxx...` |
138
+ | `FIREWORKS_API_KEY` | `fw_[a-zA-Z0-9]{20,}` | `fw_xxxx...` |
139
+ | `PERPLEXITY_API_KEY` | `pplx-[a-zA-Z0-9]{20,}` | `pplx-xxxx...` |
140
+
141
+ ### Channel Token Patterns
142
+
143
+ | Key | Pattern | Example |
144
+ |-----|---------|---------|
145
+ | `DISCORD_BOT_TOKEN` | `[A-Za-z0-9_-]{24,}.[A-Za-z0-9_-]{6}.[A-Za-z0-9_-]{27,}` | `MTIz...GxxxxX.xxx...` |
146
+ | `DISCORD_APPLICATION_ID` | `\d{17,20}` | `123456789012345678` |
147
+ | `TELEGRAM_BOT_TOKEN` | `\d{8,10}:[A-Za-z0-9_-]{35}` | `123456789:ABC...` |
148
+ | `SLACK_BOT_TOKEN` | `xoxb-[0-9]+-[0-9]+-[a-zA-Z0-9]+` | `xoxb-123...-123...-xxx` |
149
+ | `SLACK_APP_TOKEN` | `xapp-[0-9]+-[a-zA-Z0-9]+-[0-9]+-[a-zA-Z0-9]+` | `xapp-1-A01...-123...` |
150
+
151
+ ### Infrastructure Patterns
152
+
153
+ | Key | Pattern | Example |
154
+ |-----|---------|---------|
155
+ | `DATABASE_URL` | `(postgres\|mysql\|sqlite\|mongodb)://...` | `postgresql://user:pass@localhost:5432/db` |
156
+ | `OLLAMA_BASE_URL` | `https?://...` | `http://localhost:11434` |
157
+ | `ENCRYPTION_SALT` | `[a-f0-9]{32,64}` | `a1b2c3d4...` |
158
+
159
+ ## Storage Locations
160
+
161
+ Secrets are stored in multiple locations depending on usage:
162
+
163
+ ### 1. Character Settings (`character.settings.secrets`)
164
+
165
+ Per-character secrets in `character.json`:
166
+
167
+ ```json
168
+ {
169
+ "name": "MyAgent",
170
+ "settings": {
171
+ "secrets": {
172
+ "DISCORD_BOT_TOKEN": "MTIz...",
173
+ "ANTHROPIC_API_KEY": "sk-ant-..."
174
+ }
175
+ }
176
+ }
177
+ ```
178
+
179
+ ### 2. Environment Variables (`process.env`)
180
+
181
+ System environment or `.env` files:
182
+
183
+ ```bash
184
+ # ~/.milaidy/.env
185
+ ANTHROPIC_API_KEY=sk-ant-...
186
+ DISCORD_BOT_TOKEN=MTIz...
187
+ ```
188
+
189
+ ### 3. Credential Files
190
+
191
+ OAuth and complex credentials:
192
+
193
+ ```
194
+ ~/.milaidy/credentials/
195
+ ├── oauth.json # OAuth tokens
196
+ ├── whatsapp/
197
+ │ └── <accountId>/ # WhatsApp session
198
+ └── ...
199
+ ```
200
+
201
+ ### 4. Auth Profiles
202
+
203
+ Per-agent authentication:
204
+
205
+ ```
206
+ ~/.milaidy/agents/<agentId>/agent/auth-profiles.json
207
+ ```
208
+
209
+ ## Secret Resolution Order
210
+
211
+ When looking up a secret, ElizaOS checks in order:
212
+
213
+ 1. `character.settings.secrets[key]`
214
+ 2. `character.settings.secrets[alias]` (for any known aliases)
215
+ 3. `process.env[key]`
216
+ 4. `process.env[alias]`
217
+
218
+ ```typescript
219
+ // Resolution example
220
+ const token = getSecret("DISCORD_TOKEN"); // Checks DISCORD_TOKEN, then DISCORD_BOT_TOKEN
221
+ ```
222
+
223
+ ## Channel Required Secrets
224
+
225
+ Each channel has required and optional secrets:
226
+
227
+ | Channel | Required | Optional |
228
+ |---------|----------|----------|
229
+ | Discord | `DISCORD_BOT_TOKEN` | `DISCORD_APPLICATION_ID` |
230
+ | Telegram | `TELEGRAM_BOT_TOKEN` | - |
231
+ | Slack | `SLACK_BOT_TOKEN`, `SLACK_APP_TOKEN` | - |
232
+ | WhatsApp | `WHATSAPP_TOKEN` | - |
233
+ | Signal | `SIGNAL_CLI_PATH` | - |
234
+ | Twitter | `TWITTER_USERNAME`, `TWITTER_PASSWORD` | `TWITTER_EMAIL`, `TWITTER_2FA_SECRET` |
235
+
236
+ ## API Usage
237
+
238
+ ### Validate a Secret
239
+
240
+ ```typescript
241
+ import { validateSecretKey } from "@elizaos/core";
242
+
243
+ const result = validateSecretKey("DISCORD_BOT_TOKEN", "MTIz...");
244
+ if (!result.isValid) {
245
+ console.error(result.error);
246
+ }
247
+ ```
248
+
249
+ ### Check Required Secrets
250
+
251
+ ```typescript
252
+ import { checkRequiredSecrets, CHANNEL_SECRETS } from "@elizaos/core";
253
+
254
+ const secrets = {
255
+ DISCORD_BOT_TOKEN: "MTIz...",
256
+ };
257
+
258
+ const result = checkRequiredSecrets(secrets, CHANNEL_SECRETS.discord);
259
+ if (!result.valid) {
260
+ console.log("Missing:", result.missing);
261
+ console.log("Invalid:", result.invalid);
262
+ }
263
+ ```
264
+
265
+ ### Get Provider for API Key
266
+
267
+ ```typescript
268
+ import { getProviderForApiKey } from "@elizaos/core";
269
+
270
+ // Returns "anthropic"
271
+ getProviderForApiKey("ANTHROPIC_API_KEY");
272
+ ```
273
+
274
+ ## Security Best Practices
275
+
276
+ 1. **Never commit secrets** - Use `.env` files or secret managers
277
+ 2. **Use canonical names** - Ensures consistent validation
278
+ 3. **Validate on input** - Catch format errors early
279
+ 4. **Scope secrets** - Use per-character secrets when possible
280
+ 5. **Rotate regularly** - Especially for production deployments
281
+
282
+ ## Troubleshooting
283
+
284
+ ### "Secret appears to be a placeholder"
285
+
286
+ The value matches common placeholder patterns like `your_api_key_here` or `TODO`.
287
+
288
+ ### "Key is too short"
289
+
290
+ The value doesn't meet minimum length requirements for that key type.
291
+
292
+ ### "Pattern mismatch"
293
+
294
+ The value doesn't match the expected format. Check the prefix (e.g., `sk-` for OpenAI).
295
+
296
+ ## Related Docs
297
+
298
+ - [Migration: Secret Keys](/migration/secret-keys) - Migrating from legacy keys
299
+ - [Onboarding](/start/onboarding) - Initial secret setup
300
+ - [Channels](/channels) - Channel-specific credentials
@@ -0,0 +1,122 @@
1
+ ---
2
+ summary: "Session pruning: tool-result trimming to reduce context bloat"
3
+ read_when:
4
+ - You want to reduce LLM context growth from tool outputs
5
+ - You are tuning agents.defaults.contextPruning
6
+ ---
7
+
8
+ # Session Pruning
9
+
10
+ Session pruning trims **old tool results** from the in-memory context right before each LLM call. It does **not** rewrite the on-disk session history (`*.jsonl`).
11
+
12
+ ## When it runs
13
+
14
+ - When `mode: "cache-ttl"` is enabled and the last Anthropic call for the session is older than `ttl`.
15
+ - Only affects the messages sent to the model for that request.
16
+ - Only active for Anthropic API calls (and OpenRouter Anthropic models).
17
+ - For best results, match `ttl` to your model `cacheControlTtl`.
18
+ - After a prune, the TTL window resets so subsequent requests keep cache until `ttl` expires again.
19
+
20
+ ## Smart defaults (Anthropic)
21
+
22
+ - **OAuth or setup-token** profiles: enable `cache-ttl` pruning and set heartbeat to `1h`.
23
+ - **API key** profiles: enable `cache-ttl` pruning, set heartbeat to `30m`, and default `cacheControlTtl` to `1h` on Anthropic models.
24
+ - If you set any of these values explicitly, Milaidy does **not** override them.
25
+
26
+ ## What this improves (cost + cache behavior)
27
+
28
+ - **Why prune:** Anthropic prompt caching only applies within the TTL. If a session goes idle past the TTL, the next request re-caches the full prompt unless you trim it first.
29
+ - **What gets cheaper:** pruning reduces the **cacheWrite** size for that first request after the TTL expires.
30
+ - **Why the TTL reset matters:** once pruning runs, the cache window resets, so follow‑up requests can reuse the freshly cached prompt instead of re-caching the full history again.
31
+ - **What it does not do:** pruning doesn’t add tokens or “double” costs; it only changes what gets cached on that first post‑TTL request.
32
+
33
+ ## What can be pruned
34
+
35
+ - Only `toolResult` messages.
36
+ - User + assistant messages are **never** modified.
37
+ - The last `keepLastAssistants` assistant messages are protected; tool results after that cutoff are not pruned.
38
+ - If there aren’t enough assistant messages to establish the cutoff, pruning is skipped.
39
+ - Tool results containing **image blocks** are skipped (never trimmed/cleared).
40
+
41
+ ## Context window estimation
42
+
43
+ Pruning uses an estimated context window (chars ≈ tokens × 4). The base window is resolved in this order:
44
+
45
+ 1. `models.providers.*.models[].contextWindow` override.
46
+ 2. Model definition `contextWindow` (from the model registry).
47
+ 3. Default `200000` tokens.
48
+
49
+ If `agents.defaults.contextTokens` is set, it is treated as a cap (min) on the resolved window.
50
+
51
+ ## Mode
52
+
53
+ ### cache-ttl
54
+
55
+ - Pruning only runs if the last Anthropic call is older than `ttl` (default `5m`).
56
+ - When it runs: same soft-trim + hard-clear behavior as before.
57
+
58
+ ## Soft vs hard pruning
59
+
60
+ - **Soft-trim**: only for oversized tool results.
61
+ - Keeps head + tail, inserts `...`, and appends a note with the original size.
62
+ - Skips results with image blocks.
63
+ - **Hard-clear**: replaces the entire tool result with `hardClear.placeholder`.
64
+
65
+ ## Tool selection
66
+
67
+ - `tools.allow` / `tools.deny` support `*` wildcards.
68
+ - Deny wins.
69
+ - Matching is case-insensitive.
70
+ - Empty allow list => all tools allowed.
71
+
72
+ ## Interaction with other limits
73
+
74
+ - Built-in tools already truncate their own output; session pruning is an extra layer that prevents long-running chats from accumulating too much tool output in the model context.
75
+ - Compaction is separate: compaction summarizes and persists, pruning is transient per request. See [/concepts/compaction](/concepts/compaction).
76
+
77
+ ## Defaults (when enabled)
78
+
79
+ - `ttl`: `"5m"`
80
+ - `keepLastAssistants`: `3`
81
+ - `softTrimRatio`: `0.3`
82
+ - `hardClearRatio`: `0.5`
83
+ - `minPrunableToolChars`: `50000`
84
+ - `softTrim`: `{ maxChars: 4000, headChars: 1500, tailChars: 1500 }`
85
+ - `hardClear`: `{ enabled: true, placeholder: "[Old tool result content cleared]" }`
86
+
87
+ ## Examples
88
+
89
+ Default (off):
90
+
91
+ ```json5
92
+ {
93
+ agent: {
94
+ contextPruning: { mode: "off" },
95
+ },
96
+ }
97
+ ```
98
+
99
+ Enable TTL-aware pruning:
100
+
101
+ ```json5
102
+ {
103
+ agent: {
104
+ contextPruning: { mode: "cache-ttl", ttl: "5m" },
105
+ },
106
+ }
107
+ ```
108
+
109
+ Restrict pruning to specific tools:
110
+
111
+ ```json5
112
+ {
113
+ agent: {
114
+ contextPruning: {
115
+ mode: "cache-ttl",
116
+ tools: { allow: ["exec", "read"], deny: ["*image*"] },
117
+ },
118
+ },
119
+ }
120
+ ```
121
+
122
+ See config reference: [Gateway Configuration](/gateway/configuration)
@@ -0,0 +1,193 @@
1
+ ---
2
+ summary: "Agent session tools for listing sessions, fetching history, and sending cross-session messages"
3
+ read_when:
4
+ - Adding or modifying session tools
5
+ title: "Session Tools"
6
+ ---
7
+
8
+ # Session Tools
9
+
10
+ Goal: small, hard-to-misuse tool set so agents can list sessions, fetch history, and send to another session.
11
+
12
+ ## Tool Names
13
+
14
+ - `sessions_list`
15
+ - `sessions_history`
16
+ - `sessions_send`
17
+ - `sessions_spawn`
18
+
19
+ ## Key Model
20
+
21
+ - Main direct chat bucket is always the literal key `"main"` (resolved to the current agent’s main key).
22
+ - Group chats use `agent:<agentId>:<channel>:group:<id>` or `agent:<agentId>:<channel>:channel:<id>` (pass the full key).
23
+ - Cron jobs use `cron:<job.id>`.
24
+ - Hooks use `hook:<uuid>` unless explicitly set.
25
+ - Node sessions use `node-<nodeId>` unless explicitly set.
26
+
27
+ `global` and `unknown` are reserved values and are never listed. If `session.scope = "global"`, we alias it to `main` for all tools so callers never see `global`.
28
+
29
+ ## sessions_list
30
+
31
+ List sessions as an array of rows.
32
+
33
+ Parameters:
34
+
35
+ - `kinds?: string[]` filter: any of `"main" | "group" | "cron" | "hook" | "node" | "other"`
36
+ - `limit?: number` max rows (default: server default, clamp e.g. 200)
37
+ - `activeMinutes?: number` only sessions updated within N minutes
38
+ - `messageLimit?: number` 0 = no messages (default 0); >0 = include last N messages
39
+
40
+ Behavior:
41
+
42
+ - `messageLimit > 0` fetches `chat.history` per session and includes the last N messages.
43
+ - Tool results are filtered out in list output; use `sessions_history` for tool messages.
44
+ - When running in a **sandboxed** agent session, session tools default to **spawned-only visibility** (see below).
45
+
46
+ Row shape (JSON):
47
+
48
+ - `key`: session key (string)
49
+ - `kind`: `main | group | cron | hook | node | other`
50
+ - `channel`: `whatsapp | telegram | discord | signal | imessage | webchat | internal | unknown`
51
+ - `displayName` (group display label if available)
52
+ - `updatedAt` (ms)
53
+ - `sessionId`
54
+ - `model`, `contextTokens`, `totalTokens`
55
+ - `thinkingLevel`, `verboseLevel`, `systemSent`, `abortedLastRun`
56
+ - `sendPolicy` (session override if set)
57
+ - `lastChannel`, `lastTo`
58
+ - `deliveryContext` (normalized `{ channel, to, accountId }` when available)
59
+ - `transcriptPath` (best-effort path derived from store dir + sessionId)
60
+ - `messages?` (only when `messageLimit > 0`)
61
+
62
+ ## sessions_history
63
+
64
+ Fetch transcript for one session.
65
+
66
+ Parameters:
67
+
68
+ - `sessionKey` (required; accepts session key or `sessionId` from `sessions_list`)
69
+ - `limit?: number` max messages (server clamps)
70
+ - `includeTools?: boolean` (default false)
71
+
72
+ Behavior:
73
+
74
+ - `includeTools=false` filters `role: "toolResult"` messages.
75
+ - Returns messages array in the raw transcript format.
76
+ - When given a `sessionId`, Milaidy resolves it to the corresponding session key (missing ids error).
77
+
78
+ ## sessions_send
79
+
80
+ Send a message into another session.
81
+
82
+ Parameters:
83
+
84
+ - `sessionKey` (required; accepts session key or `sessionId` from `sessions_list`)
85
+ - `message` (required)
86
+ - `timeoutSeconds?: number` (default >0; 0 = fire-and-forget)
87
+
88
+ Behavior:
89
+
90
+ - `timeoutSeconds = 0`: enqueue and return `{ runId, status: "accepted" }`.
91
+ - `timeoutSeconds > 0`: wait up to N seconds for completion, then return `{ runId, status: "ok", reply }`.
92
+ - If wait times out: `{ runId, status: "timeout", error }`. Run continues; call `sessions_history` later.
93
+ - If the run fails: `{ runId, status: "error", error }`.
94
+ - Announce delivery runs after the primary run completes and is best-effort; `status: "ok"` does not guarantee the announce was delivered.
95
+ - Waits via gateway `agent.wait` (server-side) so reconnects don't drop the wait.
96
+ - Agent-to-agent message context is injected for the primary run.
97
+ - After the primary run completes, Milaidy runs a **reply-back loop**:
98
+ - Round 2+ alternates between requester and target agents.
99
+ - Reply exactly `REPLY_SKIP` to stop the ping‑pong.
100
+ - Max turns is `session.agentToAgent.maxPingPongTurns` (0–5, default 5).
101
+ - Once the loop ends, Milaidy runs the **agent‑to‑agent announce step** (target agent only):
102
+ - Reply exactly `ANNOUNCE_SKIP` to stay silent.
103
+ - Any other reply is sent to the target channel.
104
+ - Announce step includes the original request + round‑1 reply + latest ping‑pong reply.
105
+
106
+ ## Channel Field
107
+
108
+ - For groups, `channel` is the channel recorded on the session entry.
109
+ - For direct chats, `channel` maps from `lastChannel`.
110
+ - For cron/hook/node, `channel` is `internal`.
111
+ - If missing, `channel` is `unknown`.
112
+
113
+ ## Security / Send Policy
114
+
115
+ Policy-based blocking by channel/chat type (not per session id).
116
+
117
+ ```json
118
+ {
119
+ "session": {
120
+ "sendPolicy": {
121
+ "rules": [
122
+ {
123
+ "match": { "channel": "discord", "chatType": "group" },
124
+ "action": "deny"
125
+ }
126
+ ],
127
+ "default": "allow"
128
+ }
129
+ }
130
+ }
131
+ ```
132
+
133
+ Runtime override (per session entry):
134
+
135
+ - `sendPolicy: "allow" | "deny"` (unset = inherit config)
136
+ - Settable via `sessions.patch` or owner-only `/send on|off|inherit` (standalone message).
137
+
138
+ Enforcement points:
139
+
140
+ - `chat.send` / `agent` (gateway)
141
+ - auto-reply delivery logic
142
+
143
+ ## sessions_spawn
144
+
145
+ Spawn a sub-agent run in an isolated session and announce the result back to the requester chat channel.
146
+
147
+ Parameters:
148
+
149
+ - `task` (required)
150
+ - `label?` (optional; used for logs/UI)
151
+ - `agentId?` (optional; spawn under another agent id if allowed)
152
+ - `model?` (optional; overrides the sub-agent model; invalid values error)
153
+ - `runTimeoutSeconds?` (default 0; when set, aborts the sub-agent run after N seconds)
154
+ - `cleanup?` (`delete|keep`, default `keep`)
155
+
156
+ Allowlist:
157
+
158
+ - `agents.list[].subagents.allowAgents`: list of agent ids allowed via `agentId` (`["*"]` to allow any). Default: only the requester agent.
159
+
160
+ Discovery:
161
+
162
+ - Use `agents_list` to discover which agent ids are allowed for `sessions_spawn`.
163
+
164
+ Behavior:
165
+
166
+ - Starts a new `agent:<agentId>:subagent:<uuid>` session with `deliver: false`.
167
+ - Sub-agents default to the full tool set **minus session tools** (configurable via `tools.subagents.tools`).
168
+ - Sub-agents are not allowed to call `sessions_spawn` (no sub-agent → sub-agent spawning).
169
+ - Always non-blocking: returns `{ status: "accepted", runId, childSessionKey }` immediately.
170
+ - After completion, Milaidy runs a sub-agent **announce step** and posts the result to the requester chat channel.
171
+ - Reply exactly `ANNOUNCE_SKIP` during the announce step to stay silent.
172
+ - Announce replies are normalized to `Status`/`Result`/`Notes`; `Status` comes from runtime outcome (not model text).
173
+ - Sub-agent sessions are auto-archived after `agents.defaults.subagents.archiveAfterMinutes` (default: 60).
174
+ - Announce replies include a stats line (runtime, tokens, sessionKey/sessionId, transcript path, and optional cost).
175
+
176
+ ## Sandbox Session Visibility
177
+
178
+ Sandboxed sessions can use session tools, but by default they only see sessions they spawned via `sessions_spawn`.
179
+
180
+ Config:
181
+
182
+ ```json5
183
+ {
184
+ agents: {
185
+ defaults: {
186
+ sandbox: {
187
+ // default: "spawned"
188
+ sessionToolsVisibility: "spawned", // or "all"
189
+ },
190
+ },
191
+ },
192
+ }
193
+ ```