@elizaos/ui 2.0.0-alpha.526 → 2.0.0-alpha.528
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.
- package/apps/app-elizamaker/src/index.d.ts +2 -0
- package/apps/app-elizamaker/src/index.d.ts.map +1 -1
- package/apps/app-elizamaker/src/index.js +2 -0
- package/apps/app-elizamaker/src/init-registry-services.d.ts +18 -0
- package/apps/app-elizamaker/src/init-registry-services.d.ts.map +1 -0
- package/apps/app-elizamaker/src/init-registry-services.js +63 -0
- package/apps/app-elizamaker/src/plugin.d.ts.map +1 -1
- package/apps/app-elizamaker/src/plugin.js +7 -0
- package/apps/app-elizamaker/src/registry-service-registry.d.ts +4 -0
- package/apps/app-elizamaker/src/registry-service-registry.d.ts.map +1 -0
- package/apps/app-elizamaker/src/registry-service-registry.js +7 -0
- package/apps/app-lifeops/src/automation-node-contributor.d.ts +2 -0
- package/apps/app-lifeops/src/automation-node-contributor.d.ts.map +1 -0
- package/apps/app-lifeops/src/automation-node-contributor.js +93 -0
- package/apps/app-lifeops/src/public.d.ts.map +1 -1
- package/apps/app-lifeops/src/public.js +2 -0
- package/apps/app-training/src/services/training-service-registry.d.ts +4 -0
- package/apps/app-training/src/services/training-service-registry.d.ts.map +1 -0
- package/apps/app-training/src/services/training-service-registry.js +7 -0
- package/package.json +1 -1
- package/packages/agent/src/api/agent-status-routes.d.ts +3 -23
- package/packages/agent/src/api/agent-status-routes.d.ts.map +1 -1
- package/packages/agent/src/api/agent-status-routes.js +7 -40
- package/packages/agent/src/api/coordinator-wiring.d.ts.map +1 -0
- package/packages/agent/src/api/misc-routes.d.ts.map +1 -1
- package/packages/agent/src/api/misc-routes.js +3 -37
- package/packages/agent/src/api/nfa-routes.d.ts.map +1 -1
- package/packages/agent/src/api/nfa-routes.js +1 -9
- package/packages/agent/src/api/provider-switch-routes.d.ts +8 -7
- package/packages/agent/src/api/provider-switch-routes.d.ts.map +1 -1
- package/packages/agent/src/api/provider-switch-routes.js +41 -26
- package/packages/agent/src/api/server-types.d.ts +0 -6
- package/packages/agent/src/api/server-types.d.ts.map +1 -1
- package/packages/agent/src/api/server.d.ts.map +1 -1
- package/packages/agent/src/api/server.js +31 -138
- package/packages/agent/src/api/stream-routes.d.ts.map +1 -1
- package/packages/agent/src/api/stream-routes.js +6 -8
- package/packages/agent/src/api/wallet-trading-profile.d.ts.map +1 -1
- package/packages/agent/src/api/wallet-trading-profile.js +2 -23
- package/packages/agent/src/auth/account-storage.d.ts.map +1 -1
- package/packages/agent/src/auth/account-storage.js +4 -15
- package/packages/agent/src/runtime/eliza.d.ts.map +1 -1
- package/packages/agent/src/runtime/eliza.js +2 -6
- package/packages/agent/src/runtime/first-time-setup.d.ts.map +1 -1
- package/packages/agent/src/runtime/first-time-setup.js +1 -7
- package/packages/agent/src/runtime/operations/cold-strategy.d.ts +4 -4
- package/packages/agent/src/runtime/operations/cold-strategy.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/cold-strategy.js +13 -46
- package/packages/agent/src/runtime/operations/health-checks.d.ts +1 -0
- package/packages/agent/src/runtime/operations/health-checks.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/health-checks.js +1 -1
- package/packages/agent/src/runtime/operations/health.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/health.js +1 -13
- package/packages/agent/src/runtime/operations/index.d.ts +1 -0
- package/packages/agent/src/runtime/operations/index.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/index.js +1 -0
- package/packages/agent/src/runtime/operations/manager.d.ts +2 -0
- package/packages/agent/src/runtime/operations/manager.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/manager.js +27 -7
- package/packages/agent/src/runtime/operations/reload-hot.d.ts +4 -1
- package/packages/agent/src/runtime/operations/reload-hot.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/reload-hot.js +46 -41
- package/packages/agent/src/runtime/operations/repository.d.ts +30 -8
- package/packages/agent/src/runtime/operations/repository.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/repository.js +140 -54
- package/packages/agent/src/runtime/operations/types.d.ts +26 -24
- package/packages/agent/src/runtime/operations/types.d.ts.map +1 -1
- package/packages/agent/src/runtime/operations/types.js +8 -20
- package/packages/agent/src/runtime/operations/vault-bridge.d.ts +60 -0
- package/packages/agent/src/runtime/operations/vault-bridge.d.ts.map +1 -0
- package/packages/agent/src/runtime/operations/vault-bridge.js +80 -0
- package/packages/agent/src/runtime/plugin-resolver.d.ts.map +1 -1
- package/packages/agent/src/runtime/plugin-resolver.js +1 -3
- package/packages/agent/src/runtime/plugin-types.d.ts.map +1 -1
- package/packages/agent/src/runtime/plugin-types.js +1 -3
- package/packages/agent/src/services/app-package-modules.d.ts.map +1 -1
- package/packages/agent/src/services/app-package-modules.js +1 -8
- package/packages/agent/src/services/app-run-store.d.ts.map +1 -1
- package/packages/agent/src/services/app-run-store.js +2 -23
- package/packages/agent/src/services/registry-client-local.d.ts.map +1 -1
- package/packages/agent/src/services/registry-client-local.js +1 -9
- package/packages/agent/src/utils/atomic-json.d.ts +37 -0
- package/packages/agent/src/utils/atomic-json.d.ts.map +1 -0
- package/packages/agent/src/utils/atomic-json.js +98 -0
- package/packages/app-core/src/api/automation-node-contributors.d.ts +14 -0
- package/packages/app-core/src/api/automation-node-contributors.d.ts.map +1 -0
- package/packages/app-core/src/api/automation-node-contributors.js +14 -0
- package/packages/app-core/src/api/client-agent.d.ts +627 -0
- package/packages/app-core/src/api/client-agent.d.ts.map +1 -0
- package/packages/app-core/src/api/client-agent.js +1442 -0
- package/packages/app-core/src/api/client-automations.d.ts +8 -0
- package/packages/app-core/src/api/client-automations.d.ts.map +1 -0
- package/packages/app-core/src/api/client-automations.js +7 -0
- package/packages/app-core/src/api/client-base.d.ts +82 -0
- package/packages/app-core/src/api/client-base.d.ts.map +1 -0
- package/packages/app-core/src/api/client-base.js +729 -0
- package/packages/app-core/src/api/client-browser-workspace.d.ts +25 -0
- package/packages/app-core/src/api/client-browser-workspace.d.ts.map +1 -0
- package/packages/app-core/src/api/client-browser-workspace.js +98 -0
- package/packages/app-core/src/api/client-chat.d.ts +355 -0
- package/packages/app-core/src/api/client-chat.d.ts.map +1 -0
- package/packages/app-core/src/api/client-chat.js +582 -0
- package/packages/app-core/src/api/client-cloud.d.ts +286 -0
- package/packages/app-core/src/api/client-cloud.d.ts.map +1 -0
- package/packages/app-core/src/api/client-cloud.js +410 -0
- package/packages/app-core/src/api/client-computeruse.d.ts +32 -0
- package/packages/app-core/src/api/client-computeruse.d.ts.map +1 -0
- package/packages/app-core/src/api/client-computeruse.js +16 -0
- package/packages/app-core/src/api/client-imessage.d.ts +68 -0
- package/packages/app-core/src/api/client-imessage.d.ts.map +1 -0
- package/packages/app-core/src/api/client-imessage.js +74 -0
- package/packages/app-core/src/api/client-local-inference.d.ts +62 -0
- package/packages/app-core/src/api/client-local-inference.d.ts.map +1 -0
- package/packages/app-core/src/api/client-local-inference.js +87 -0
- package/packages/app-core/src/api/client-n8n.d.ts +27 -0
- package/packages/app-core/src/api/client-n8n.d.ts.map +1 -0
- package/packages/app-core/src/api/client-n8n.js +61 -0
- package/packages/app-core/src/api/client-skills.d.ts +475 -0
- package/packages/app-core/src/api/client-skills.d.ts.map +1 -0
- package/packages/app-core/src/api/client-skills.js +608 -0
- package/packages/app-core/src/api/client-types-babylon.d.ts +254 -0
- package/packages/app-core/src/api/client-types-babylon.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-babylon.js +2 -0
- package/packages/app-core/src/api/client-types-character.d.ts +39 -0
- package/packages/app-core/src/api/client-types-character.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-character.js +1 -0
- package/packages/app-core/src/api/client-types-chat.d.ts +428 -0
- package/packages/app-core/src/api/client-types-chat.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-chat.js +9 -0
- package/packages/app-core/src/api/client-types-config.d.ts +587 -0
- package/packages/app-core/src/api/client-types-config.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-config.js +5 -0
- package/packages/app-core/src/api/client-types-experience.d.ts +97 -0
- package/packages/app-core/src/api/client-types-experience.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-experience.js +1 -0
- package/packages/app-core/src/api/client-types-relationships.d.ts +181 -0
- package/packages/app-core/src/api/client-types-relationships.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-relationships.js +1 -0
- package/packages/app-core/src/api/client-types-steward.d.ts +85 -0
- package/packages/app-core/src/api/client-types-steward.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-steward.js +9 -0
- package/packages/app-core/src/api/client-types.d.ts +9 -0
- package/packages/app-core/src/api/client-types.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types.js +12 -0
- package/packages/app-core/src/api/client-wallet.d.ts +130 -0
- package/packages/app-core/src/api/client-wallet.d.ts.map +1 -0
- package/packages/app-core/src/api/client-wallet.js +228 -0
- package/packages/app-core/src/api/client.d.ts +36 -0
- package/packages/app-core/src/api/client.d.ts.map +1 -0
- package/packages/app-core/src/api/client.js +36 -0
- package/packages/app-core/src/api/index.d.ts +2 -0
- package/packages/app-core/src/api/index.d.ts.map +1 -0
- package/packages/app-core/src/api/index.js +1 -0
- package/packages/app-core/src/bridge/electrobun-rpc.d.ts +57 -0
- package/packages/app-core/src/bridge/electrobun-rpc.d.ts.map +1 -0
- package/packages/app-core/src/bridge/electrobun-rpc.js +87 -0
- package/packages/app-core/src/bridge/electrobun-runtime.d.ts +3 -0
- package/packages/app-core/src/bridge/electrobun-runtime.d.ts.map +1 -0
- package/packages/app-core/src/bridge/electrobun-runtime.js +34 -0
- package/packages/app-core/src/bridge/native-plugins.d.ts +504 -0
- package/packages/app-core/src/bridge/native-plugins.d.ts.map +1 -0
- package/packages/app-core/src/bridge/native-plugins.js +67 -0
- package/packages/app-core/src/chat/coding-agent-session-state.d.ts +16 -0
- package/packages/app-core/src/chat/coding-agent-session-state.d.ts.map +1 -0
- package/packages/app-core/src/chat/coding-agent-session-state.js +27 -0
- package/packages/app-core/src/components/pages/browser-workspace-wallet.d.ts +80 -0
- package/packages/app-core/src/components/pages/browser-workspace-wallet.d.ts.map +1 -0
- package/packages/app-core/src/components/pages/browser-workspace-wallet.js +135 -0
- package/packages/app-core/src/services/account-pool.d.ts +98 -0
- package/packages/app-core/src/services/account-pool.d.ts.map +1 -0
- package/packages/app-core/src/services/account-pool.js +506 -0
- package/packages/app-core/src/services/account-usage.d.ts +75 -0
- package/packages/app-core/src/services/account-usage.d.ts.map +1 -0
- package/packages/app-core/src/services/account-usage.js +179 -0
- package/packages/app-core/src/services/local-inference/active-model.d.ts +59 -0
- package/packages/app-core/src/services/local-inference/active-model.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/active-model.js +120 -0
- package/packages/app-core/src/services/local-inference/device-bridge.d.ts +131 -0
- package/packages/app-core/src/services/local-inference/device-bridge.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/device-bridge.js +748 -0
- package/packages/app-core/src/services/local-inference/engine.d.ts +52 -0
- package/packages/app-core/src/services/local-inference/engine.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/engine.js +138 -0
- package/packages/app-core/src/services/local-inference/external-scanner.d.ts +17 -0
- package/packages/app-core/src/services/local-inference/external-scanner.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/external-scanner.js +261 -0
- package/packages/app-core/src/services/local-inference/handler-registry.d.ts +72 -0
- package/packages/app-core/src/services/local-inference/handler-registry.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/handler-registry.js +160 -0
- package/packages/app-core/src/services/local-inference/paths.d.ts +24 -0
- package/packages/app-core/src/services/local-inference/paths.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/paths.js +41 -0
- package/packages/app-core/src/services/local-inference/providers.d.ts +61 -0
- package/packages/app-core/src/services/local-inference/providers.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/providers.js +277 -0
- package/packages/app-core/src/services/local-inference/registry.d.ts +35 -0
- package/packages/app-core/src/services/local-inference/registry.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/registry.js +108 -0
- package/packages/app-core/src/services/local-inference/routing-preferences.d.ts +31 -0
- package/packages/app-core/src/services/local-inference/routing-preferences.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/routing-preferences.js +72 -0
- package/packages/app-core/src/services/local-inference/types.d.ts +121 -0
- package/packages/app-core/src/services/local-inference/types.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/types.js +14 -0
- package/packages/app-core/src/services/local-inference/verify.d.ts +39 -0
- package/packages/app-core/src/services/local-inference/verify.d.ts.map +1 -0
- package/packages/app-core/src/services/local-inference/verify.js +104 -0
- package/packages/app-core/src/types/index.d.ts +658 -0
- package/packages/app-core/src/types/index.d.ts.map +1 -0
- package/packages/app-core/src/types/index.js +4 -0
- package/packages/app-core/src/utils/assistant-text.d.ts +2 -0
- package/packages/app-core/src/utils/assistant-text.d.ts.map +1 -0
- package/packages/app-core/src/utils/assistant-text.js +167 -0
- package/packages/app-core/src/utils/eliza-globals.d.ts +15 -0
- package/packages/app-core/src/utils/eliza-globals.d.ts.map +1 -0
- package/packages/app-core/src/utils/eliza-globals.js +50 -0
- package/packages/app-core/src/utils/streaming-text.d.ts +9 -0
- package/packages/app-core/src/utils/streaming-text.d.ts.map +1 -0
- package/packages/app-core/src/utils/streaming-text.js +112 -0
- package/packages/shared/src/format-error.d.ts +14 -0
- package/packages/shared/src/format-error.d.ts.map +1 -0
- package/packages/shared/src/format-error.js +17 -0
- package/packages/shared/src/index.d.ts +1 -0
- package/packages/shared/src/index.d.ts.map +1 -1
- package/packages/shared/src/index.js +1 -0
- package/packages/typescript/src/runtime.d.ts +14 -0
- package/packages/typescript/src/runtime.d.ts.map +1 -1
- package/packages/typescript/src/runtime.js +42 -0
- package/packages/typescript/src/services/message.d.ts +8 -0
- package/packages/typescript/src/services/message.d.ts.map +1 -1
- package/packages/typescript/src/services/message.js +51 -0
- package/packages/typescript/src/services/task.d.ts +1 -0
- package/packages/typescript/src/services/task.d.ts.map +1 -1
- package/packages/typescript/src/services/task.js +26 -3
- package/apps/app-task-coordinator/src/api/coordinator-wiring.d.ts.map +0 -1
- /package/{apps/app-task-coordinator → packages/agent}/src/api/coordinator-wiring.d.ts +0 -0
- /package/{apps/app-task-coordinator → packages/agent}/src/api/coordinator-wiring.js +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vault bridge — the only place runtime-ops talks to `@elizaos/vault`.
|
|
3
|
+
*
|
|
4
|
+
* Enforces:
|
|
5
|
+
* 1. The naming convention for provider API key vault entries
|
|
6
|
+
* (`providers.<normalizedProvider>.api-key`).
|
|
7
|
+
* 2. Sensitive flag on every write (so the secret is encrypted at rest).
|
|
8
|
+
* 3. Caller tagging for the audit log so a reader of
|
|
9
|
+
* `<stateDir>/audit/vault.jsonl` can attribute every access to a
|
|
10
|
+
* runtime-ops phase.
|
|
11
|
+
*
|
|
12
|
+
* The bridge owns NO mutable state. Either pass an explicit
|
|
13
|
+
* SecretsManager (tests), or call `defaultSecretsManager()` (production)
|
|
14
|
+
* which constructs a fresh manager backed by the OS-keychain vault.
|
|
15
|
+
*/
|
|
16
|
+
import { createManager } from "@elizaos/vault";
|
|
17
|
+
export class VaultResolveError extends Error {
|
|
18
|
+
code = "vault-resolve-failed";
|
|
19
|
+
constructor(apiKeyRef, cause) {
|
|
20
|
+
super(`[runtime-ops:vault] failed to resolve ${apiKeyRef}: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
21
|
+
this.name = "VaultResolveError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** Stable vault key for a provider API key. */
|
|
25
|
+
export function vaultKeyForProviderApiKey(normalizedProvider) {
|
|
26
|
+
if (!normalizedProvider || normalizedProvider.includes(".")) {
|
|
27
|
+
throw new TypeError(`[runtime-ops:vault] invalid provider id: ${JSON.stringify(normalizedProvider)}`);
|
|
28
|
+
}
|
|
29
|
+
return `providers.${normalizedProvider}.api-key`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Persist a provider API key in the vault under the canonical key name and
|
|
33
|
+
* return the vault key (the `apiKeyRef`).
|
|
34
|
+
*
|
|
35
|
+
* This is the single write path used by `provider-switch-routes.ts`. The
|
|
36
|
+
* route MUST persist the secret here BEFORE constructing the
|
|
37
|
+
* `ProviderSwitchIntent` so the intent never carries plaintext.
|
|
38
|
+
*/
|
|
39
|
+
export async function persistProviderApiKey(opts) {
|
|
40
|
+
const ref = vaultKeyForProviderApiKey(opts.normalizedProvider);
|
|
41
|
+
await opts.secrets.vault.set(ref, opts.apiKey, {
|
|
42
|
+
sensitive: true,
|
|
43
|
+
caller: opts.caller,
|
|
44
|
+
});
|
|
45
|
+
return ref;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolve a stored API key for the in-memory `process.env` write path.
|
|
49
|
+
*
|
|
50
|
+
* Returns `undefined` only when `apiKeyRef` is absent. If a ref is present,
|
|
51
|
+
* the operation must fail loudly when the vault cannot resolve it; otherwise a
|
|
52
|
+
* provider switch can appear successful while running with no key or a stale
|
|
53
|
+
* key from process.env.
|
|
54
|
+
*
|
|
55
|
+
* The caller is recorded on each successful read.
|
|
56
|
+
*/
|
|
57
|
+
export async function resolveProviderApiKey(opts) {
|
|
58
|
+
if (!opts.apiKeyRef)
|
|
59
|
+
return undefined;
|
|
60
|
+
try {
|
|
61
|
+
return await opts.secrets.vault.reveal(opts.apiKeyRef, opts.caller);
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
throw new VaultResolveError(opts.apiKeyRef, err);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
let cached = null;
|
|
68
|
+
/**
|
|
69
|
+
* Lazy default manager. Production code paths construct a fresh manager
|
|
70
|
+
* the first time runtime-ops needs the vault; tests inject their own.
|
|
71
|
+
*/
|
|
72
|
+
export function defaultSecretsManager() {
|
|
73
|
+
if (!cached)
|
|
74
|
+
cached = createManager();
|
|
75
|
+
return cached;
|
|
76
|
+
}
|
|
77
|
+
/** Test hook: drop the cached manager. */
|
|
78
|
+
export function _resetDefaultSecretsManagerForTesting() {
|
|
79
|
+
cached = null;
|
|
80
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-resolver.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/runtime/plugin-resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-resolver.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/runtime/plugin-resolver.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,qBAAqB,CAAC;AAgBxE,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAOpB,MAAM,mBAAmB,CAAC;AAsC3B,wBAAgB,mCAAmC,CACjD,UAAU,EAAE,MAAM,GACjB,MAAM,CAMR;AA2VD;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,aAAa,SAAM,GAClB,OAAO,CAAC,iBAAiB,CAAC,CAkC5B;AAgCD,wBAAgB,wBAAwB,IAAI,MAAM,EAAE,CAMnD;AA4VD;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,WAAW,EACnB,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACzB,OAAO,CAAC,cAAc,EAAE,CAAC,CA+Z3B"}
|
|
@@ -24,6 +24,7 @@ import fs from "node:fs/promises";
|
|
|
24
24
|
import path from "node:path";
|
|
25
25
|
import { pathToFileURL } from "node:url";
|
|
26
26
|
import { logger } from "@elizaos/core";
|
|
27
|
+
import { formatError } from "@elizaos/shared";
|
|
27
28
|
import { saveElizaConfig } from "../config/config.js";
|
|
28
29
|
import { resolveStateDir, resolveUserPath } from "../config/paths.js";
|
|
29
30
|
import { applyPluginAutoEnable, } from "../config/plugin-auto-enable.js";
|
|
@@ -43,9 +44,6 @@ const RUNTIME_APP_PLUGIN_SUBPATHS = new Set([
|
|
|
43
44
|
// ---------------------------------------------------------------------------
|
|
44
45
|
// Helpers (private)
|
|
45
46
|
// ---------------------------------------------------------------------------
|
|
46
|
-
function formatError(err) {
|
|
47
|
-
return err instanceof Error ? err.message : String(err);
|
|
48
|
-
}
|
|
49
47
|
/** Missing npm package, Bun resolve, or browser stagehand — expected when optional plugins are allow-listed but not installed. */
|
|
50
48
|
function isBenignOptionalPluginFailure(msg) {
|
|
51
49
|
return (msg.includes("Cannot find module") ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-types.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/runtime/plugin-types.ts"],"names":[],"mappings":"AAeA,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-types.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/runtime/plugin-types.ts"],"names":[],"mappings":"AAeA,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAIpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMpE,0EAA0E;AAC1E,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAMD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,CAAC;AAEhE,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AACvD,kEAAkE;AAClE,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAqCzD,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAsC7E;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CA2C9C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACnD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACpD,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC5B,GAAG;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAyB5C;AAED,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,MAAM,EAClB,gBAAgB,SAAkB,GACjC,MAAM,CAaR;AAED,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAE3E;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmB7E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAyEjD"}
|
|
@@ -4,6 +4,7 @@ import { createRequire } from "node:module";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
import { logger } from "@elizaos/core";
|
|
7
|
+
import { formatError } from "@elizaos/shared";
|
|
7
8
|
// ---------------------------------------------------------------------------
|
|
8
9
|
// Constants
|
|
9
10
|
// ---------------------------------------------------------------------------
|
|
@@ -23,9 +24,6 @@ export const EJECTED_PLUGINS_DIRNAME = "plugins/ejected";
|
|
|
23
24
|
// ---------------------------------------------------------------------------
|
|
24
25
|
// Private helpers
|
|
25
26
|
// ---------------------------------------------------------------------------
|
|
26
|
-
function formatError(err) {
|
|
27
|
-
return err instanceof Error ? err.message : String(err);
|
|
28
|
-
}
|
|
29
27
|
function looksLikePlugin(value) {
|
|
30
28
|
if (!value || typeof value !== "object")
|
|
31
29
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-package-modules.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/services/app-package-modules.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAG1B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"app-package-modules.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/services/app-package-modules.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAG1B,MAAM,sBAAsB,CAAC;AAI9B,YAAY,EACV,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,4BAA4B,GAAG,CACzC,GAAG,EAAE,uBAAuB,KACzB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;AAE1C,MAAM,MAAM,4BAA4B,GAAG,CACzC,GAAG,EAAE,uBAAuB,KACzB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;AAE1C,MAAM,MAAM,wBAAwB,GAAG,CACrC,GAAG,EAAE,uBAAuB,KACzB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;AAErC,MAAM,MAAM,sBAAsB,GAAG,CACnC,GAAG,EAAE,oBAAoB,KACtB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrD,aAAa,CAAC,EAAE,4BAA4B,CAAC;IAC7C,wBAAwB,CAAC,EAAE,4BAA4B,CAAC;IACxD,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,wBAAwB,CAAC,EAAE,CACzB,GAAG,EAAE,oBAAoB,KACtB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IACpC,oBAAoB,CAAC,EAAE,wBAAwB,CAAC;IAChD,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AA8HF,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAGxB;AAuBD,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEvE;AAmQD,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA0DhC;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAsBxB"}
|
|
@@ -12,6 +12,7 @@ import path from "node:path";
|
|
|
12
12
|
import { pathToFileURL } from "node:url";
|
|
13
13
|
import { logger } from "@elizaos/core";
|
|
14
14
|
import { hasAppInterface, packageNameToAppRouteSlug, } from "../contracts/apps.js";
|
|
15
|
+
import { readJsonFile } from "../utils/atomic-json.js";
|
|
15
16
|
import { getPluginInfo } from "./registry-client.js";
|
|
16
17
|
function uniquePaths(paths) {
|
|
17
18
|
const seen = new Set();
|
|
@@ -124,14 +125,6 @@ async function importFirstExistingModule(candidatePaths) {
|
|
|
124
125
|
export function packageNameToAppSlug(packageName) {
|
|
125
126
|
return packageNameToAppRouteSlug(packageName);
|
|
126
127
|
}
|
|
127
|
-
async function readJsonFile(filePath) {
|
|
128
|
-
try {
|
|
129
|
-
return JSON.parse(await fs.promises.readFile(filePath, "utf8"));
|
|
130
|
-
}
|
|
131
|
-
catch {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
128
|
async function readLocalBridgeExport(packageDir) {
|
|
136
129
|
const packageJson = await readJsonFile(path.join(packageDir, "package.json"));
|
|
137
130
|
const manifest = await readJsonFile(path.join(packageDir, "elizaos.plugin.json"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-run-store.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/services/app-run-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAQV,aAAa,EAId,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"app-run-store.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/services/app-run-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAQV,aAAa,EAId,MAAM,sBAAsB,CAAC;AAkf9B,wBAAgB,0BAA0B,CACxC,QAAQ,GAAE,MAA0B,GACnC,MAAM,CAER;AAED,wBAAgB,gCAAgC,CAC9C,QAAQ,GAAE,MAA0B,GACnC,MAAM,CAER;AA2BD,wBAAgB,eAAe,CAC7B,QAAQ,GAAE,MAA0B,GACnC,aAAa,EAAE,CA6BjB;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,aAAa,EAAE,EACrB,QAAQ,GAAE,MAA0B,GACnC,aAAa,EAAE,CAWjB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { resolveStateDir } from "../config/paths.js";
|
|
4
|
+
import { writeJsonAtomicSync } from "../utils/atomic-json.js";
|
|
4
5
|
const APP_RUN_STORE_VERSION = 2;
|
|
5
6
|
const MAX_RECORDED_RUN_EVENTS = 20;
|
|
6
7
|
function nowIso() {
|
|
@@ -16,28 +17,6 @@ function _defaultStoreFile() {
|
|
|
16
17
|
runs: [],
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
|
-
function ensureParentDir(filePath) {
|
|
20
|
-
const dir = path.dirname(filePath);
|
|
21
|
-
if (!fs.existsSync(dir)) {
|
|
22
|
-
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function atomicWrite(filePath, payload) {
|
|
26
|
-
ensureParentDir(filePath);
|
|
27
|
-
const tmpPath = `${filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
28
|
-
try {
|
|
29
|
-
fs.writeFileSync(tmpPath, JSON.stringify(payload, null, 2), {
|
|
30
|
-
encoding: "utf-8",
|
|
31
|
-
mode: 0o600,
|
|
32
|
-
});
|
|
33
|
-
fs.renameSync(tmpPath, filePath);
|
|
34
|
-
}
|
|
35
|
-
finally {
|
|
36
|
-
if (fs.existsSync(tmpPath)) {
|
|
37
|
-
fs.rmSync(tmpPath, { force: true });
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
20
|
function normalizeAvailability(value) {
|
|
42
21
|
if (value === "available" || value === "unavailable") {
|
|
43
22
|
return value;
|
|
@@ -481,7 +460,7 @@ export function readAppRunStore(stateDir = resolveStateDir()) {
|
|
|
481
460
|
export function writeAppRunStore(runs, stateDir = resolveStateDir()) {
|
|
482
461
|
const filePath = resolveAppRunStoreFilePath(stateDir);
|
|
483
462
|
const normalizedRuns = [...runs].sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
484
|
-
|
|
463
|
+
writeJsonAtomicSync(filePath, {
|
|
485
464
|
version: APP_RUN_STORE_VERSION,
|
|
486
465
|
updatedAt: nowIso(),
|
|
487
466
|
runs: normalizedRuns,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-client-local.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/services/registry-client-local.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry-client-local.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/services/registry-client-local.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAKV,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAqoBpC,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,GACvC,OAAO,CAAC,IAAI,CAAC,CAyBf;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,GACvC,OAAO,CAAC,IAAI,CAAC,CA8Bf"}
|
|
@@ -4,6 +4,7 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
import { logger } from "@elizaos/core";
|
|
5
5
|
import { resolveStateDir } from "../config/paths.js";
|
|
6
6
|
import { packageNameToAppDisplayName } from "../contracts/apps.js";
|
|
7
|
+
import { readJsonFile } from "../utils/atomic-json.js";
|
|
7
8
|
import { mergeAppMeta, resolveAppOverride, } from "./registry-client-app-meta.js";
|
|
8
9
|
const LOCAL_PLUGIN_TAG_STOPWORDS = new Set([
|
|
9
10
|
"plugin",
|
|
@@ -94,15 +95,6 @@ function normaliseGitHubRepo(repo) {
|
|
|
94
95
|
return null;
|
|
95
96
|
return cleaned;
|
|
96
97
|
}
|
|
97
|
-
async function readJsonFile(filePath) {
|
|
98
|
-
try {
|
|
99
|
-
const raw = await fs.readFile(filePath, "utf-8");
|
|
100
|
-
return JSON.parse(raw);
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
98
|
function normalizeLocalTag(tag) {
|
|
107
99
|
const normalized = tag
|
|
108
100
|
.trim()
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atomic JSON read/write helpers (node-only).
|
|
3
|
+
*
|
|
4
|
+
* Consolidates the write-tmp + rename pattern duplicated across the agent
|
|
5
|
+
* package for tokens, ledgers, config snapshots, and runtime operations.
|
|
6
|
+
*
|
|
7
|
+
* Defaults:
|
|
8
|
+
* - mode 0o600 on the written file (secret-grade)
|
|
9
|
+
* - dir mode 0o700 when the parent has to be created
|
|
10
|
+
* - JSON 2-space indent, no trailing newline
|
|
11
|
+
* - tmp filename `${filePath}.tmp-${pid}-${Date.now()}` (multi-process safe)
|
|
12
|
+
* - parent directory created with mkdir recursive
|
|
13
|
+
*
|
|
14
|
+
* On failure, the temp file is best-effort removed.
|
|
15
|
+
*/
|
|
16
|
+
export interface WriteJsonAtomicOptions {
|
|
17
|
+
/** File mode for the final file. Default 0o600. */
|
|
18
|
+
mode?: number;
|
|
19
|
+
/** Directory mode if the parent has to be created. Default 0o700. */
|
|
20
|
+
dirMode?: number;
|
|
21
|
+
/** Append a trailing newline. Default false. */
|
|
22
|
+
trailingNewline?: boolean;
|
|
23
|
+
/** `space` arg passed to JSON.stringify. Default 2. */
|
|
24
|
+
indent?: number | string;
|
|
25
|
+
/** Skip mkdir of the parent directory. Default false. */
|
|
26
|
+
skipMkdir?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare function writeJsonAtomic(filePath: string, value: unknown, opts?: WriteJsonAtomicOptions): Promise<void>;
|
|
29
|
+
export declare function writeJsonAtomicSync(filePath: string, value: unknown, opts?: WriteJsonAtomicOptions): void;
|
|
30
|
+
/**
|
|
31
|
+
* Read and JSON.parse a file. Returns `null` if the file does not exist or
|
|
32
|
+
* cannot be parsed — callers that need the distinction should call
|
|
33
|
+
* `fs.readFile` directly.
|
|
34
|
+
*/
|
|
35
|
+
export declare function readJsonFile<T>(filePath: string): Promise<T | null>;
|
|
36
|
+
export declare function readJsonFileSync<T>(filePath: string): T | null;
|
|
37
|
+
//# sourceMappingURL=atomic-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-json.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/utils/atomic-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,WAAW,sBAAsB;IACrC,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AA+BD,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,EACd,IAAI,CAAC,EAAE,sBAAsB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,EACd,IAAI,CAAC,EAAE,sBAAsB,GAC5B,IAAI,CAkBN;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAOzE;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAO9D"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atomic JSON read/write helpers (node-only).
|
|
3
|
+
*
|
|
4
|
+
* Consolidates the write-tmp + rename pattern duplicated across the agent
|
|
5
|
+
* package for tokens, ledgers, config snapshots, and runtime operations.
|
|
6
|
+
*
|
|
7
|
+
* Defaults:
|
|
8
|
+
* - mode 0o600 on the written file (secret-grade)
|
|
9
|
+
* - dir mode 0o700 when the parent has to be created
|
|
10
|
+
* - JSON 2-space indent, no trailing newline
|
|
11
|
+
* - tmp filename `${filePath}.tmp-${pid}-${Date.now()}` (multi-process safe)
|
|
12
|
+
* - parent directory created with mkdir recursive
|
|
13
|
+
*
|
|
14
|
+
* On failure, the temp file is best-effort removed.
|
|
15
|
+
*/
|
|
16
|
+
import fs from "node:fs";
|
|
17
|
+
import fsp from "node:fs/promises";
|
|
18
|
+
import path from "node:path";
|
|
19
|
+
function normalizeOptions(opts) {
|
|
20
|
+
return {
|
|
21
|
+
mode: opts?.mode ?? 0o600,
|
|
22
|
+
dirMode: opts?.dirMode ?? 0o700,
|
|
23
|
+
trailingNewline: opts?.trailingNewline ?? false,
|
|
24
|
+
indent: opts?.indent ?? 2,
|
|
25
|
+
skipMkdir: opts?.skipMkdir ?? false,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function tmpPathFor(filePath) {
|
|
29
|
+
return `${filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
30
|
+
}
|
|
31
|
+
function serialize(value, opts) {
|
|
32
|
+
const body = JSON.stringify(value, null, opts.indent);
|
|
33
|
+
return opts.trailingNewline ? `${body}\n` : body;
|
|
34
|
+
}
|
|
35
|
+
export async function writeJsonAtomic(filePath, value, opts) {
|
|
36
|
+
const o = normalizeOptions(opts);
|
|
37
|
+
if (!o.skipMkdir) {
|
|
38
|
+
await fsp.mkdir(path.dirname(filePath), {
|
|
39
|
+
recursive: true,
|
|
40
|
+
mode: o.dirMode,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const tmp = tmpPathFor(filePath);
|
|
44
|
+
try {
|
|
45
|
+
await fsp.writeFile(tmp, serialize(value, o), {
|
|
46
|
+
encoding: "utf-8",
|
|
47
|
+
mode: o.mode,
|
|
48
|
+
});
|
|
49
|
+
await fsp.rename(tmp, filePath);
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
await fsp.rm(tmp, { force: true }).catch(() => { });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function writeJsonAtomicSync(filePath, value, opts) {
|
|
56
|
+
const o = normalizeOptions(opts);
|
|
57
|
+
if (!o.skipMkdir) {
|
|
58
|
+
fs.mkdirSync(path.dirname(filePath), {
|
|
59
|
+
recursive: true,
|
|
60
|
+
mode: o.dirMode,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const tmp = tmpPathFor(filePath);
|
|
64
|
+
try {
|
|
65
|
+
fs.writeFileSync(tmp, serialize(value, o), {
|
|
66
|
+
encoding: "utf-8",
|
|
67
|
+
mode: o.mode,
|
|
68
|
+
});
|
|
69
|
+
fs.renameSync(tmp, filePath);
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
if (fs.existsSync(tmp))
|
|
73
|
+
fs.rmSync(tmp, { force: true });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Read and JSON.parse a file. Returns `null` if the file does not exist or
|
|
78
|
+
* cannot be parsed — callers that need the distinction should call
|
|
79
|
+
* `fs.readFile` directly.
|
|
80
|
+
*/
|
|
81
|
+
export async function readJsonFile(filePath) {
|
|
82
|
+
try {
|
|
83
|
+
const raw = await fsp.readFile(filePath, "utf-8");
|
|
84
|
+
return JSON.parse(raw);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export function readJsonFileSync(filePath) {
|
|
91
|
+
try {
|
|
92
|
+
const raw = fs.readFileSync(filePath, "utf-8");
|
|
93
|
+
return JSON.parse(raw);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { loadElizaConfig } from "@elizaos/agent";
|
|
2
|
+
import type { AgentRuntime, UUID } from "@elizaos/core";
|
|
3
|
+
import type { AutomationNodeDescriptor } from "./client-types-config";
|
|
4
|
+
export interface AutomationNodeContributorContext {
|
|
5
|
+
runtime: AgentRuntime;
|
|
6
|
+
config: ReturnType<typeof loadElizaConfig>;
|
|
7
|
+
agentName: string;
|
|
8
|
+
adminEntityId: UUID;
|
|
9
|
+
}
|
|
10
|
+
export type AutomationNodeContributor = (context: AutomationNodeContributorContext) => Promise<AutomationNodeDescriptor[]> | AutomationNodeDescriptor[];
|
|
11
|
+
export declare function registerAutomationNodeContributor(id: string, contributor: AutomationNodeContributor): void;
|
|
12
|
+
export declare function listAutomationNodeContributors(): AutomationNodeContributor[];
|
|
13
|
+
export declare function clearAutomationNodeContributorsForTests(): void;
|
|
14
|
+
//# sourceMappingURL=automation-node-contributors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automation-node-contributors.d.ts","sourceRoot":"","sources":["../../../../../../app-core/src/api/automation-node-contributors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,yBAAyB,GAAG,CACtC,OAAO,EAAE,gCAAgC,KACtC,OAAO,CAAC,wBAAwB,EAAE,CAAC,GAAG,wBAAwB,EAAE,CAAC;AAItE,wBAAgB,iCAAiC,CAC/C,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,yBAAyB,GACrC,IAAI,CAMN;AAED,wBAAgB,8BAA8B,IAAI,yBAAyB,EAAE,CAE5E;AAED,wBAAgB,uCAAuC,IAAI,IAAI,CAE9D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const contributors = new Map();
|
|
2
|
+
export function registerAutomationNodeContributor(id, contributor) {
|
|
3
|
+
const normalizedId = id.trim();
|
|
4
|
+
if (!normalizedId) {
|
|
5
|
+
throw new Error("Automation node contributor id is required");
|
|
6
|
+
}
|
|
7
|
+
contributors.set(normalizedId, contributor);
|
|
8
|
+
}
|
|
9
|
+
export function listAutomationNodeContributors() {
|
|
10
|
+
return [...contributors.values()];
|
|
11
|
+
}
|
|
12
|
+
export function clearAutomationNodeContributorsForTests() {
|
|
13
|
+
contributors.clear();
|
|
14
|
+
}
|