@elizaos/autonomous 2.0.0-alpha.10

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 (241) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +270 -0
  3. package/src/actions/emote.ts +101 -0
  4. package/src/actions/restart.ts +101 -0
  5. package/src/actions/send-message.ts +168 -0
  6. package/src/actions/stream-control.ts +439 -0
  7. package/src/actions/switch-stream-source.ts +126 -0
  8. package/src/actions/terminal.ts +186 -0
  9. package/src/api/agent-admin-routes.ts +178 -0
  10. package/src/api/agent-lifecycle-routes.ts +129 -0
  11. package/src/api/agent-model.ts +143 -0
  12. package/src/api/agent-transfer-routes.ts +211 -0
  13. package/src/api/apps-routes.ts +210 -0
  14. package/src/api/auth-routes.ts +90 -0
  15. package/src/api/bsc-trade.ts +736 -0
  16. package/src/api/bug-report-routes.ts +161 -0
  17. package/src/api/character-routes.ts +421 -0
  18. package/src/api/cloud-billing-routes.ts +598 -0
  19. package/src/api/cloud-compat-routes.ts +192 -0
  20. package/src/api/cloud-routes.ts +529 -0
  21. package/src/api/cloud-status-routes.ts +234 -0
  22. package/src/api/compat-utils.ts +154 -0
  23. package/src/api/connector-health.ts +135 -0
  24. package/src/api/coordinator-wiring.ts +179 -0
  25. package/src/api/credit-detection.ts +47 -0
  26. package/src/api/database.ts +1357 -0
  27. package/src/api/diagnostics-routes.ts +389 -0
  28. package/src/api/drop-service.ts +205 -0
  29. package/src/api/early-logs.ts +111 -0
  30. package/src/api/http-helpers.ts +252 -0
  31. package/src/api/index.ts +85 -0
  32. package/src/api/knowledge-routes.ts +1189 -0
  33. package/src/api/knowledge-service-loader.ts +92 -0
  34. package/src/api/memory-bounds.ts +121 -0
  35. package/src/api/memory-routes.ts +349 -0
  36. package/src/api/merkle-tree.ts +239 -0
  37. package/src/api/models-routes.ts +72 -0
  38. package/src/api/nfa-routes.ts +169 -0
  39. package/src/api/nft-verify.ts +188 -0
  40. package/src/api/og-tracker.ts +72 -0
  41. package/src/api/parse-action-block.ts +145 -0
  42. package/src/api/permissions-routes.ts +222 -0
  43. package/src/api/plugin-validation.ts +355 -0
  44. package/src/api/provider-switch-config.ts +455 -0
  45. package/src/api/registry-routes.ts +165 -0
  46. package/src/api/registry-service.ts +292 -0
  47. package/src/api/route-helpers.ts +21 -0
  48. package/src/api/sandbox-routes.ts +1480 -0
  49. package/src/api/server.ts +17674 -0
  50. package/src/api/signal-routes.ts +265 -0
  51. package/src/api/stream-persistence.ts +297 -0
  52. package/src/api/stream-route-state.ts +48 -0
  53. package/src/api/stream-routes.ts +1046 -0
  54. package/src/api/stream-voice-routes.ts +208 -0
  55. package/src/api/streaming-text.ts +129 -0
  56. package/src/api/streaming-types.ts +23 -0
  57. package/src/api/subscription-routes.ts +283 -0
  58. package/src/api/terminal-run-limits.ts +31 -0
  59. package/src/api/training-backend-check.ts +40 -0
  60. package/src/api/training-routes.ts +314 -0
  61. package/src/api/training-service-like.ts +46 -0
  62. package/src/api/trajectory-routes.ts +714 -0
  63. package/src/api/trigger-routes.ts +438 -0
  64. package/src/api/twitter-verify.ts +226 -0
  65. package/src/api/tx-service.ts +193 -0
  66. package/src/api/wallet-dex-prices.ts +206 -0
  67. package/src/api/wallet-evm-balance.ts +989 -0
  68. package/src/api/wallet-routes.ts +505 -0
  69. package/src/api/wallet-rpc.ts +523 -0
  70. package/src/api/wallet-trading-profile.ts +694 -0
  71. package/src/api/wallet.ts +745 -0
  72. package/src/api/whatsapp-routes.ts +282 -0
  73. package/src/api/zip-utils.ts +130 -0
  74. package/src/auth/anthropic.ts +63 -0
  75. package/src/auth/apply-stealth.ts +38 -0
  76. package/src/auth/claude-code-stealth.ts +141 -0
  77. package/src/auth/credentials.ts +226 -0
  78. package/src/auth/index.ts +18 -0
  79. package/src/auth/openai-codex.ts +94 -0
  80. package/src/auth/types.ts +24 -0
  81. package/src/awareness/registry.ts +220 -0
  82. package/src/bin.ts +10 -0
  83. package/src/cli/index.ts +36 -0
  84. package/src/cli/parse-duration.ts +43 -0
  85. package/src/cloud/auth.test.ts +370 -0
  86. package/src/cloud/auth.ts +176 -0
  87. package/src/cloud/backup.test.ts +150 -0
  88. package/src/cloud/backup.ts +50 -0
  89. package/src/cloud/base-url.ts +45 -0
  90. package/src/cloud/bridge-client.test.ts +481 -0
  91. package/src/cloud/bridge-client.ts +307 -0
  92. package/src/cloud/cloud-manager.test.ts +223 -0
  93. package/src/cloud/cloud-manager.ts +151 -0
  94. package/src/cloud/cloud-proxy.test.ts +122 -0
  95. package/src/cloud/cloud-proxy.ts +52 -0
  96. package/src/cloud/index.ts +23 -0
  97. package/src/cloud/reconnect.test.ts +178 -0
  98. package/src/cloud/reconnect.ts +108 -0
  99. package/src/cloud/validate-url.test.ts +147 -0
  100. package/src/cloud/validate-url.ts +176 -0
  101. package/src/config/character-schema.ts +44 -0
  102. package/src/config/config.ts +149 -0
  103. package/src/config/env-vars.ts +86 -0
  104. package/src/config/includes.ts +196 -0
  105. package/src/config/index.ts +15 -0
  106. package/src/config/object-utils.ts +10 -0
  107. package/src/config/paths.ts +92 -0
  108. package/src/config/plugin-auto-enable.ts +520 -0
  109. package/src/config/schema.ts +1342 -0
  110. package/src/config/telegram-custom-commands.ts +99 -0
  111. package/src/config/types.agent-defaults.ts +342 -0
  112. package/src/config/types.agents.ts +112 -0
  113. package/src/config/types.gateway.ts +243 -0
  114. package/src/config/types.hooks.ts +124 -0
  115. package/src/config/types.messages.ts +201 -0
  116. package/src/config/types.milady.ts +791 -0
  117. package/src/config/types.tools.ts +416 -0
  118. package/src/config/types.ts +7 -0
  119. package/src/config/zod-schema.agent-runtime.ts +777 -0
  120. package/src/config/zod-schema.core.ts +778 -0
  121. package/src/config/zod-schema.hooks.ts +139 -0
  122. package/src/config/zod-schema.providers-core.ts +1126 -0
  123. package/src/config/zod-schema.session.ts +98 -0
  124. package/src/config/zod-schema.ts +865 -0
  125. package/src/contracts/apps.ts +46 -0
  126. package/src/contracts/awareness.ts +56 -0
  127. package/src/contracts/config.ts +172 -0
  128. package/src/contracts/drop.ts +21 -0
  129. package/src/contracts/index.ts +8 -0
  130. package/src/contracts/onboarding.ts +592 -0
  131. package/src/contracts/permissions.ts +52 -0
  132. package/src/contracts/verification.ts +9 -0
  133. package/src/contracts/wallet.ts +503 -0
  134. package/src/diagnostics/integration-observability.ts +132 -0
  135. package/src/emotes/catalog.ts +655 -0
  136. package/src/external-modules.d.ts +7 -0
  137. package/src/hooks/discovery.test.ts +357 -0
  138. package/src/hooks/discovery.ts +231 -0
  139. package/src/hooks/eligibility.ts +146 -0
  140. package/src/hooks/hooks.test.ts +320 -0
  141. package/src/hooks/index.ts +8 -0
  142. package/src/hooks/loader.test.ts +418 -0
  143. package/src/hooks/loader.ts +256 -0
  144. package/src/hooks/registry.test.ts +168 -0
  145. package/src/hooks/registry.ts +74 -0
  146. package/src/hooks/types.ts +121 -0
  147. package/src/index.ts +19 -0
  148. package/src/onboarding-presets.ts +828 -0
  149. package/src/plugins/custom-rtmp/index.ts +40 -0
  150. package/src/providers/admin-trust.ts +76 -0
  151. package/src/providers/session-bridge.ts +143 -0
  152. package/src/providers/session-utils.ts +42 -0
  153. package/src/providers/simple-mode.ts +113 -0
  154. package/src/providers/ui-catalog.ts +135 -0
  155. package/src/providers/workspace-provider.ts +213 -0
  156. package/src/providers/workspace.ts +497 -0
  157. package/src/runtime/agent-event-service.ts +57 -0
  158. package/src/runtime/cloud-onboarding.test.ts +489 -0
  159. package/src/runtime/cloud-onboarding.ts +408 -0
  160. package/src/runtime/core-plugins.ts +53 -0
  161. package/src/runtime/custom-actions.ts +605 -0
  162. package/src/runtime/eliza.ts +4941 -0
  163. package/src/runtime/embedding-presets.ts +73 -0
  164. package/src/runtime/index.ts +8 -0
  165. package/src/runtime/milady-plugin.ts +180 -0
  166. package/src/runtime/onboarding-names.ts +76 -0
  167. package/src/runtime/release-plugin-policy.ts +119 -0
  168. package/src/runtime/restart.ts +59 -0
  169. package/src/runtime/trajectory-persistence.ts +2584 -0
  170. package/src/runtime/version.ts +6 -0
  171. package/src/security/audit-log.ts +222 -0
  172. package/src/security/network-policy.ts +91 -0
  173. package/src/server/index.ts +6 -0
  174. package/src/services/agent-export.ts +976 -0
  175. package/src/services/app-manager.ts +755 -0
  176. package/src/services/browser-capture.ts +215 -0
  177. package/src/services/coding-agent-context.ts +355 -0
  178. package/src/services/fallback-training-service.ts +196 -0
  179. package/src/services/index.ts +17 -0
  180. package/src/services/mcp-marketplace.ts +327 -0
  181. package/src/services/plugin-manager-types.ts +185 -0
  182. package/src/services/privy-wallets.ts +352 -0
  183. package/src/services/registry-client-app-meta.ts +201 -0
  184. package/src/services/registry-client-endpoints.ts +253 -0
  185. package/src/services/registry-client-local.ts +485 -0
  186. package/src/services/registry-client-network.ts +173 -0
  187. package/src/services/registry-client-queries.ts +176 -0
  188. package/src/services/registry-client-types.ts +104 -0
  189. package/src/services/registry-client.ts +366 -0
  190. package/src/services/remote-signing-service.ts +261 -0
  191. package/src/services/sandbox-engine.ts +753 -0
  192. package/src/services/sandbox-manager.ts +503 -0
  193. package/src/services/self-updater.ts +213 -0
  194. package/src/services/signal-pairing.ts +189 -0
  195. package/src/services/signing-policy.ts +230 -0
  196. package/src/services/skill-catalog-client.ts +195 -0
  197. package/src/services/skill-marketplace.ts +909 -0
  198. package/src/services/stream-manager.ts +707 -0
  199. package/src/services/tts-stream-bridge.ts +465 -0
  200. package/src/services/update-checker.ts +163 -0
  201. package/src/services/version-compat.ts +367 -0
  202. package/src/services/whatsapp-pairing.ts +279 -0
  203. package/src/shared/ui-catalog-prompt.ts +1158 -0
  204. package/src/test-support/process-helpers.ts +35 -0
  205. package/src/test-support/route-test-helpers.ts +113 -0
  206. package/src/test-support/test-helpers.ts +304 -0
  207. package/src/testing/index.ts +3 -0
  208. package/src/triggers/action.ts +342 -0
  209. package/src/triggers/runtime.ts +432 -0
  210. package/src/triggers/scheduling.ts +472 -0
  211. package/src/triggers/types.ts +133 -0
  212. package/src/types/app-hyperscape-routes-shim.d.ts +29 -0
  213. package/src/types/external-modules.d.ts +7 -0
  214. package/src/utils/exec-safety.ts +23 -0
  215. package/src/utils/number-parsing.ts +112 -0
  216. package/src/utils/spoken-text.ts +65 -0
  217. package/src/version-resolver.ts +60 -0
  218. package/test/api/agent-admin-routes.test.ts +160 -0
  219. package/test/api/agent-lifecycle-routes.test.ts +164 -0
  220. package/test/api/agent-transfer-routes.test.ts +136 -0
  221. package/test/api/apps-routes.test.ts +140 -0
  222. package/test/api/auth-routes.test.ts +160 -0
  223. package/test/api/bug-report-routes.test.ts +88 -0
  224. package/test/api/knowledge-routes.test.ts +73 -0
  225. package/test/api/lifecycle.test.ts +342 -0
  226. package/test/api/memory-routes.test.ts +74 -0
  227. package/test/api/models-routes.test.ts +112 -0
  228. package/test/api/nfa-routes.test.ts +78 -0
  229. package/test/api/permissions-routes.test.ts +185 -0
  230. package/test/api/registry-routes.test.ts +157 -0
  231. package/test/api/signal-routes.test.ts +113 -0
  232. package/test/api/subscription-routes.test.ts +90 -0
  233. package/test/api/trigger-routes.test.ts +87 -0
  234. package/test/api/wallet-routes.observability.test.ts +191 -0
  235. package/test/api/wallet-routes.test.ts +502 -0
  236. package/test/diagnostics/integration-observability.test.ts +135 -0
  237. package/test/security/audit-log.test.ts +229 -0
  238. package/test/security/network-policy.test.ts +143 -0
  239. package/test/services/version-compat.test.ts +127 -0
  240. package/tsconfig.build.json +21 -0
  241. package/tsconfig.json +19 -0
@@ -0,0 +1,253 @@
1
+ import { lookup as dnsLookup } from "node:dns/promises";
2
+ import net from "node:net";
3
+ import { logger } from "@elizaos/core";
4
+ import type { RegistryEndpoint } from "../config/types.milady.js";
5
+ import {
6
+ isBlockedPrivateOrLinkLocalIp,
7
+ normalizeHostLike,
8
+ } from "../security/network-policy.js";
9
+ import type { RegistryPluginInfo } from "./registry-client-types.js";
10
+
11
+ const BLOCKED_REGISTRY_HOST_LITERALS = new Set([
12
+ "localhost",
13
+ "127.0.0.1",
14
+ "::1",
15
+ "0.0.0.0",
16
+ "169.254.169.254",
17
+ ]);
18
+
19
+ export function normaliseEndpointUrl(url: string): string {
20
+ return url.replace(/\/+$/, "");
21
+ }
22
+
23
+ export function isDefaultEndpoint(url: string, defaultUrl: string): boolean {
24
+ return normaliseEndpointUrl(url) === normaliseEndpointUrl(defaultUrl);
25
+ }
26
+
27
+ export function parseRegistryEndpointUrl(rawUrl: string): URL {
28
+ let parsed: URL;
29
+ try {
30
+ parsed = new URL(rawUrl);
31
+ } catch {
32
+ throw new Error("Endpoint URL must be a valid absolute URL");
33
+ }
34
+
35
+ if (parsed.protocol !== "https:") {
36
+ throw new Error("Endpoint URL must use https://");
37
+ }
38
+
39
+ const hostname = normalizeHostLike(parsed.hostname);
40
+ if (!hostname) throw new Error("Endpoint URL hostname is required");
41
+
42
+ if (
43
+ BLOCKED_REGISTRY_HOST_LITERALS.has(hostname) ||
44
+ hostname.endsWith(".localhost") ||
45
+ hostname.endsWith(".local")
46
+ ) {
47
+ throw new Error(`Endpoint host "${hostname}" is blocked`);
48
+ }
49
+
50
+ if (net.isIP(hostname) && isBlockedPrivateOrLinkLocalIp(hostname)) {
51
+ throw new Error(`Endpoint host "${hostname}" is blocked`);
52
+ }
53
+
54
+ return parsed;
55
+ }
56
+
57
+ type ResolvedRegistryEndpoint = {
58
+ parsed: URL;
59
+ hostname: string;
60
+ pinnedAddress: string | null;
61
+ };
62
+
63
+ async function resolveRegistryEndpointUrlRejection(rawUrl: string): Promise<{
64
+ rejection: string | null;
65
+ endpoint: ResolvedRegistryEndpoint | null;
66
+ }> {
67
+ let parsed: URL;
68
+ try {
69
+ parsed = parseRegistryEndpointUrl(rawUrl);
70
+ } catch (error) {
71
+ return {
72
+ rejection: error instanceof Error ? error.message : String(error),
73
+ endpoint: null,
74
+ };
75
+ }
76
+
77
+ const hostname = normalizeHostLike(parsed.hostname);
78
+ if (!hostname) {
79
+ return {
80
+ rejection: "Endpoint URL hostname is required",
81
+ endpoint: null,
82
+ };
83
+ }
84
+
85
+ if (net.isIP(hostname)) {
86
+ return {
87
+ rejection: null,
88
+ endpoint: { parsed, hostname, pinnedAddress: hostname },
89
+ };
90
+ }
91
+
92
+ let addresses: Array<{ address: string }>;
93
+ try {
94
+ const resolved = await dnsLookup(hostname, { all: true });
95
+ addresses = Array.isArray(resolved) ? resolved : [resolved];
96
+ } catch {
97
+ return {
98
+ rejection: `Could not resolve endpoint host "${hostname}"`,
99
+ endpoint: null,
100
+ };
101
+ }
102
+
103
+ if (addresses.length === 0) {
104
+ return {
105
+ rejection: `Could not resolve endpoint host "${hostname}"`,
106
+ endpoint: null,
107
+ };
108
+ }
109
+
110
+ for (const entry of addresses) {
111
+ if (isBlockedPrivateOrLinkLocalIp(entry.address)) {
112
+ return {
113
+ rejection: `Endpoint host "${hostname}" resolves to blocked address ${entry.address}`,
114
+ endpoint: null,
115
+ };
116
+ }
117
+ }
118
+
119
+ return {
120
+ rejection: null,
121
+ endpoint: {
122
+ parsed,
123
+ hostname,
124
+ pinnedAddress: addresses[0]?.address ?? null,
125
+ },
126
+ };
127
+ }
128
+
129
+ async function fetchSingleEndpoint(
130
+ url: string,
131
+ label: string,
132
+ ): Promise<Map<string, RegistryPluginInfo> | null> {
133
+ const { rejection, endpoint } =
134
+ await resolveRegistryEndpointUrlRejection(url);
135
+ if (rejection || !endpoint) {
136
+ logger.warn(
137
+ `[registry-client] Endpoint "${label}" (${url}) blocked: ${rejection ?? "validation failed"}`,
138
+ );
139
+ return null;
140
+ }
141
+
142
+ try {
143
+ if (endpoint.pinnedAddress && !net.isIP(endpoint.hostname)) {
144
+ const refreshed = await dnsLookup(endpoint.hostname, { all: true });
145
+ const refreshedAddresses = new Set(
146
+ (Array.isArray(refreshed) ? refreshed : [refreshed]).map((entry) =>
147
+ normalizeHostLike(entry.address),
148
+ ),
149
+ );
150
+
151
+ if (!refreshedAddresses.has(normalizeHostLike(endpoint.pinnedAddress))) {
152
+ logger.warn(
153
+ `[registry-client] Endpoint "${label}" (${url}) blocked: host resolution changed before fetch`,
154
+ );
155
+ return null;
156
+ }
157
+
158
+ for (const address of refreshedAddresses) {
159
+ if (isBlockedPrivateOrLinkLocalIp(address)) {
160
+ logger.warn(
161
+ `[registry-client] Endpoint "${label}" (${url}) blocked: host resolves to blocked address ${address}`,
162
+ );
163
+ return null;
164
+ }
165
+ }
166
+ }
167
+
168
+ const resp = await fetch(url, { redirect: "error" });
169
+ if (!resp.ok) {
170
+ logger.warn(
171
+ `[registry-client] Endpoint "${label}" (${url}): ${resp.status} ${resp.statusText}`,
172
+ );
173
+ return null;
174
+ }
175
+ const data = (await resp.json()) as {
176
+ registry?: Record<string, unknown>;
177
+ };
178
+ if (!data.registry || typeof data.registry !== "object") {
179
+ logger.warn(
180
+ `[registry-client] Endpoint "${label}" (${url}): missing registry field`,
181
+ );
182
+ return null;
183
+ }
184
+ const plugins = new Map<string, RegistryPluginInfo>();
185
+ for (const [name, raw] of Object.entries(data.registry)) {
186
+ const e = raw as Record<string, unknown>;
187
+ const git = (e.git ?? {}) as Record<string, unknown>;
188
+ const npm = (e.npm ?? {}) as Record<string, unknown>;
189
+ const supports = (e.supports ?? { v0: false, v1: false, v2: false }) as {
190
+ v0: boolean;
191
+ v1: boolean;
192
+ v2: boolean;
193
+ };
194
+ plugins.set(name, {
195
+ name,
196
+ gitRepo: (git.repo as string) ?? "unknown/unknown",
197
+ gitUrl: `https://github.com/${(git.repo as string) ?? "unknown/unknown"}.git`,
198
+ description: (e.description as string) ?? "",
199
+ homepage: (e.homepage as string) ?? null,
200
+ topics: (e.topics as string[]) ?? [],
201
+ stars: (e.stargazers_count as number) ?? 0,
202
+ language: (e.language as string) ?? "TypeScript",
203
+ npm: {
204
+ package: (npm.repo as string) ?? name,
205
+ v0Version: (npm.v0 as string) ?? null,
206
+ v1Version: (npm.v1 as string) ?? null,
207
+ v2Version: (npm.v2 as string) ?? null,
208
+ },
209
+ git: {
210
+ v0Branch:
211
+ ((git.v0 as Record<string, unknown>)?.branch as string) ?? null,
212
+ v1Branch:
213
+ ((git.v1 as Record<string, unknown>)?.branch as string) ?? null,
214
+ v2Branch:
215
+ ((git.v2 as Record<string, unknown>)?.branch as string) ?? null,
216
+ },
217
+ supports,
218
+ });
219
+ }
220
+ return plugins;
221
+ } catch (err) {
222
+ logger.warn(
223
+ `[registry-client] Endpoint "${label}" (${url}) failed: ${err instanceof Error ? err.message : String(err)}`,
224
+ );
225
+ return null;
226
+ }
227
+ }
228
+
229
+ export async function mergeCustomEndpoints(
230
+ plugins: Map<string, RegistryPluginInfo>,
231
+ endpoints: RegistryEndpoint[],
232
+ ): Promise<void> {
233
+ const enabledEndpoints = endpoints.filter((ep) => ep.enabled !== false);
234
+ if (enabledEndpoints.length === 0) return;
235
+
236
+ const results = await Promise.allSettled(
237
+ enabledEndpoints.map((ep) => fetchSingleEndpoint(ep.url, ep.label)),
238
+ );
239
+
240
+ for (const result of results) {
241
+ if (result.status === "fulfilled" && result.value) {
242
+ for (const [name, info] of result.value) {
243
+ if (plugins.has(name)) {
244
+ logger.warn(
245
+ `[registry-client] Ignoring custom endpoint override for ${name}`,
246
+ );
247
+ continue;
248
+ }
249
+ plugins.set(name, info);
250
+ }
251
+ }
252
+ }
253
+ }