@openclaw-cloud/agent-controller 3.6.2 → 3.6.3
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/dist/api.d.ts +2 -14
- package/dist/api.js +1 -15
- package/dist/api.js.map +1 -1
- package/dist/commands/agent-update-cli.js +0 -7
- package/dist/commands/agent-update-cli.js.map +1 -1
- package/dist/commands/bootstrap.d.ts +0 -10
- package/dist/commands/bootstrap.js +2 -16
- package/dist/commands/bootstrap.js.map +1 -1
- package/dist/commands/channel-server.d.ts +0 -16
- package/dist/commands/channel-server.js +1 -19
- package/dist/commands/channel-server.js.map +1 -1
- package/dist/commands/deploy-cli.js +2 -12
- package/dist/commands/deploy-cli.js.map +1 -1
- package/dist/commands/diagnostics-cli.js +0 -6
- package/dist/commands/diagnostics-cli.js.map +1 -1
- package/dist/commands/install-deps.d.ts +0 -10
- package/dist/commands/install-deps.js +1 -10
- package/dist/commands/install-deps.js.map +1 -1
- package/dist/commands/install.js +0 -6
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/package-install-cli.js +1 -14
- package/dist/commands/package-install-cli.js.map +1 -1
- package/dist/commands/plugin-update-cli.js +1 -8
- package/dist/commands/plugin-update-cli.js.map +1 -1
- package/dist/commands/restart-cli.js +0 -4
- package/dist/commands/restart-cli.js.map +1 -1
- package/dist/commands/self-update.d.ts +2 -24
- package/dist/commands/self-update.js +5 -54
- package/dist/commands/self-update.js.map +1 -1
- package/dist/commands/stop-cli.d.ts +0 -4
- package/dist/commands/stop-cli.js +1 -24
- package/dist/commands/stop-cli.js.map +1 -1
- package/dist/config-file.d.ts +3 -20
- package/dist/config-file.js +3 -22
- package/dist/config-file.js.map +1 -1
- package/dist/config.d.ts +0 -22
- package/dist/config.js +1 -34
- package/dist/config.js.map +1 -1
- package/dist/connection.js +2 -39
- package/dist/connection.js.map +1 -1
- package/dist/handlers/agent-update.d.ts +1 -21
- package/dist/handlers/agent-update.js +1 -21
- package/dist/handlers/agent-update.js.map +1 -1
- package/dist/handlers/chat.d.ts +0 -8
- package/dist/handlers/chat.js +3 -23
- package/dist/handlers/chat.js.map +1 -1
- package/dist/handlers/file-write.js +1 -4
- package/dist/handlers/file-write.js.map +1 -1
- package/dist/handlers/memory.d.ts +1 -9
- package/dist/handlers/memory.js +3 -25
- package/dist/handlers/memory.js.map +1 -1
- package/dist/handlers/onboarding.js +0 -2
- package/dist/handlers/onboarding.js.map +1 -1
- package/dist/handlers/pair.js +1 -3
- package/dist/handlers/pair.js.map +1 -1
- package/dist/handlers/plugin-update.d.ts +1 -16
- package/dist/handlers/plugin-update.js +1 -16
- package/dist/handlers/plugin-update.js.map +1 -1
- package/dist/handlers/restart.js +0 -2
- package/dist/handlers/restart.js.map +1 -1
- package/dist/handlers/self-update.d.ts +2 -29
- package/dist/handlers/self-update.js +3 -35
- package/dist/handlers/self-update.js.map +1 -1
- package/dist/handlers/slack-event.d.ts +2 -9
- package/dist/handlers/slack-event.js +2 -10
- package/dist/handlers/slack-event.js.map +1 -1
- package/dist/heartbeat.d.ts +2 -12
- package/dist/heartbeat.js +3 -18
- package/dist/heartbeat.js.map +1 -1
- package/dist/index.js +6 -50
- package/dist/index.js.map +1 -1
- package/dist/lockfile.d.ts +0 -7
- package/dist/lockfile.js +0 -9
- package/dist/lockfile.js.map +1 -1
- package/dist/memory-mcp-server.d.ts +1 -19
- package/dist/memory-mcp-server.js +5 -53
- package/dist/memory-mcp-server.js.map +1 -1
- package/dist/mock-board-worker.d.ts +2 -25
- package/dist/mock-board-worker.js +7 -54
- package/dist/mock-board-worker.js.map +1 -1
- package/dist/platform/linux.js +0 -3
- package/dist/platform/linux.js.map +1 -1
- package/dist/platform/macos.js +0 -2
- package/dist/platform/macos.js.map +1 -1
- package/dist/providers/chat-types.d.ts +0 -3
- package/dist/providers/chat-types.js +0 -3
- package/dist/providers/chat-types.js.map +1 -1
- package/dist/providers/claude-code/channel-server.d.ts +0 -19
- package/dist/providers/claude-code/channel-server.js +0 -19
- package/dist/providers/claude-code/channel-server.js.map +1 -1
- package/dist/providers/claude-code/index.d.ts +0 -22
- package/dist/providers/claude-code/index.js +3 -26
- package/dist/providers/claude-code/index.js.map +1 -1
- package/dist/providers/claude-code/login-flow.d.ts +0 -17
- package/dist/providers/claude-code/login-flow.js +2 -16
- package/dist/providers/claude-code/login-flow.js.map +1 -1
- package/dist/providers/claude-code/settings-writer.d.ts +1 -16
- package/dist/providers/claude-code/settings-writer.js +5 -20
- package/dist/providers/claude-code/settings-writer.js.map +1 -1
- package/dist/providers/claude-code/socket-bridge.d.ts +0 -35
- package/dist/providers/claude-code/socket-bridge.js +2 -43
- package/dist/providers/claude-code/socket-bridge.js.map +1 -1
- package/dist/providers/claude-code/spawn-claude.d.ts +0 -17
- package/dist/providers/claude-code/spawn-claude.js +1 -15
- package/dist/providers/claude-code/spawn-claude.js.map +1 -1
- package/dist/providers/index.d.ts +1 -10
- package/dist/providers/index.js +2 -13
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/mock/index.d.ts +0 -4
- package/dist/providers/mock/index.js +0 -4
- package/dist/providers/mock/index.js.map +1 -1
- package/dist/providers/openclaw/auto-pair.d.ts +1 -6
- package/dist/providers/openclaw/auto-pair.js +1 -10
- package/dist/providers/openclaw/auto-pair.js.map +1 -1
- package/dist/providers/openclaw/device-identity.d.ts +1 -1
- package/dist/providers/openclaw/device-identity.js +33 -17
- package/dist/providers/openclaw/device-identity.js.map +1 -1
- package/dist/providers/openclaw/gateway-adapter.d.ts +0 -5
- package/dist/providers/openclaw/gateway-adapter.js +4 -32
- package/dist/providers/openclaw/gateway-adapter.js.map +1 -1
- package/dist/providers/openclaw/gateway-client.js +3 -9
- package/dist/providers/openclaw/gateway-client.js.map +1 -1
- package/dist/providers/openclaw/index.js +2 -15
- package/dist/providers/openclaw/index.js.map +1 -1
- package/dist/providers/types.d.ts +0 -10
- package/dist/slack-relay-server.d.ts +4 -33
- package/dist/slack-relay-server.js +9 -57
- package/dist/slack-relay-server.js.map +1 -1
- package/dist/types.d.ts +1 -12
- package/dist/types.js +0 -6
- package/dist/types.js.map +1 -1
- package/dist/utils/agent-controller-bin.d.ts +0 -6
- package/dist/utils/agent-controller-bin.js +1 -21
- package/dist/utils/agent-controller-bin.js.map +1 -1
- package/dist/utils/anthropic-auth.d.ts +1 -22
- package/dist/utils/anthropic-auth.js +0 -10
- package/dist/utils/anthropic-auth.js.map +1 -1
- package/dist/utils/apply-config.d.ts +7 -74
- package/dist/utils/apply-config.js +30 -221
- package/dist/utils/apply-config.js.map +1 -1
- package/dist/utils/backup-push.d.ts +0 -10
- package/dist/utils/backup-push.js +0 -15
- package/dist/utils/backup-push.js.map +1 -1
- package/dist/utils/claude-env.d.ts +1 -10
- package/dist/utils/claude-env.js +2 -14
- package/dist/utils/claude-env.js.map +1 -1
- package/dist/utils/config-merge-paths.d.ts +5 -43
- package/dist/utils/config-merge-paths.js +5 -43
- package/dist/utils/config-merge-paths.js.map +1 -1
- package/dist/utils/deploy-type.d.ts +1 -13
- package/dist/utils/deploy-type.js +2 -19
- package/dist/utils/deploy-type.js.map +1 -1
- package/dist/utils/diagnostics.d.ts +0 -7
- package/dist/utils/diagnostics.js +0 -15
- package/dist/utils/diagnostics.js.map +1 -1
- package/dist/utils/exec.d.ts +0 -10
- package/dist/utils/exec.js +2 -32
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/gateway-restart-handler.d.ts +1 -8
- package/dist/utils/gateway-restart-handler.js +1 -8
- package/dist/utils/gateway-restart-handler.js.map +1 -1
- package/dist/utils/gateway-restart.d.ts +1 -11
- package/dist/utils/gateway-restart.js +1 -11
- package/dist/utils/gateway-restart.js.map +1 -1
- package/dist/utils/knowledge-graph.d.ts +2 -25
- package/dist/utils/knowledge-graph.js +2 -37
- package/dist/utils/knowledge-graph.js.map +1 -1
- package/dist/utils/knowledge-push.d.ts +0 -4
- package/dist/utils/knowledge-push.js +4 -19
- package/dist/utils/knowledge-push.js.map +1 -1
- package/dist/utils/legacy-mcp-servers.d.ts +1 -11
- package/dist/utils/legacy-mcp-servers.js +1 -11
- package/dist/utils/legacy-mcp-servers.js.map +1 -1
- package/dist/utils/log-collector.js +0 -2
- package/dist/utils/log-collector.js.map +1 -1
- package/dist/utils/openclaw-ops.d.ts +5 -72
- package/dist/utils/openclaw-ops.js +6 -98
- package/dist/utils/openclaw-ops.js.map +1 -1
- package/dist/utils/openclaw-stack-update.d.ts +2 -14
- package/dist/utils/openclaw-stack-update.js +1 -6
- package/dist/utils/openclaw-stack-update.js.map +1 -1
- package/dist/utils/package-install.d.ts +0 -5
- package/dist/utils/package-install.js +2 -21
- package/dist/utils/package-install.js.map +1 -1
- package/dist/utils/package-version.d.ts +1 -9
- package/dist/utils/package-version.js +1 -9
- package/dist/utils/package-version.js.map +1 -1
- package/dist/utils/parse-id-at-version.d.ts +1 -11
- package/dist/utils/parse-id-at-version.js +1 -11
- package/dist/utils/parse-id-at-version.js.map +1 -1
- package/dist/utils/plugin-reconcile.d.ts +2 -33
- package/dist/utils/plugin-reconcile.js +7 -77
- package/dist/utils/plugin-reconcile.js.map +1 -1
- package/dist/utils/release-channel.d.ts +0 -8
- package/dist/utils/release-channel.js.map +1 -1
- package/dist/utils/write-home-files.d.ts +2 -24
- package/dist/utils/write-home-files.js +3 -27
- package/dist/utils/write-home-files.js.map +1 -1
- package/dist/utils/write-workspace-files.d.ts +0 -14
- package/dist/utils/write-workspace-files.js +1 -19
- package/dist/utils/write-workspace-files.js.map +1 -1
- package/dist/workspace.d.ts +1 -21
- package/dist/workspace.js +1 -21
- package/dist/workspace.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backup-push.js","sourceRoot":"","sources":["../../src/utils/backup-push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO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AAC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IAC9C,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Write ~/.claude/settings.json, ~/.claude/cc-notify.sh, and auth-profiles.json
|
|
3
|
-
* from a flat env vars dict (ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL).
|
|
4
|
-
*
|
|
5
|
-
* This is a WHOLESALE rewrite of the user's Claude settings, so it is gated on
|
|
6
|
-
* the install being managed ('vm'/'k8s'). The guard lives here rather than in
|
|
7
|
-
* the callers deliberately: it is defense in depth that holds for every current
|
|
8
|
-
* and future caller. `agent-controller bootstrap` on a developer laptop once
|
|
9
|
-
* blew away ~/.claude/settings.json — that must not be re-reachable.
|
|
10
|
-
*/
|
|
1
|
+
/** Guard wholesale Claude settings writes here, so every caller protects third-party user config. */
|
|
11
2
|
export declare function writeClaudeEnv(envVars: Record<string, string>): Promise<void>;
|
package/dist/utils/claude-env.js
CHANGED
|
@@ -39,16 +39,7 @@ MSG="\${MSG:0:500}"
|
|
|
39
39
|
openclaw system event --text "$MSG" --mode now 2>/dev/null &
|
|
40
40
|
exit 0
|
|
41
41
|
`;
|
|
42
|
-
/**
|
|
43
|
-
* Write ~/.claude/settings.json, ~/.claude/cc-notify.sh, and auth-profiles.json
|
|
44
|
-
* from a flat env vars dict (ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL).
|
|
45
|
-
*
|
|
46
|
-
* This is a WHOLESALE rewrite of the user's Claude settings, so it is gated on
|
|
47
|
-
* the install being managed ('vm'/'k8s'). The guard lives here rather than in
|
|
48
|
-
* the callers deliberately: it is defense in depth that holds for every current
|
|
49
|
-
* and future caller. `agent-controller bootstrap` on a developer laptop once
|
|
50
|
-
* blew away ~/.claude/settings.json — that must not be re-reachable.
|
|
51
|
-
*/
|
|
42
|
+
/** Guard wholesale Claude settings writes here, so every caller protects third-party user config. */
|
|
52
43
|
export async function writeClaudeEnv(envVars) {
|
|
53
44
|
if (!isManagedDeploy()) {
|
|
54
45
|
console.log(`[claude-env] skipped: not a managed install (deployType=${getResolvedDeployType() ?? 'unknown'})`);
|
|
@@ -56,7 +47,6 @@ export async function writeClaudeEnv(envVars) {
|
|
|
56
47
|
}
|
|
57
48
|
const claudeDir = path.join(os.homedir(), '.claude');
|
|
58
49
|
await fs.mkdir(claudeDir, { recursive: true });
|
|
59
|
-
// Write cc-notify.sh
|
|
60
50
|
const notifyPath = path.join(claudeDir, 'cc-notify.sh');
|
|
61
51
|
await fs.writeFile(notifyPath, CC_NOTIFY_SH);
|
|
62
52
|
await fs.chmod(notifyPath, 0o755);
|
|
@@ -80,8 +70,7 @@ export async function writeClaudeEnv(envVars) {
|
|
|
80
70
|
// anthropicAuthToken input); an `auth_token` classification here always
|
|
81
71
|
// means "the API key was in fact an OAuth token".
|
|
82
72
|
const settings = auth.kind === 'auth_token'
|
|
83
|
-
?
|
|
84
|
-
{ ...buildClaudeSettings(auth), hooks }
|
|
73
|
+
? { ...buildClaudeSettings(auth), hooks }
|
|
85
74
|
: // API key flow (default): the key is NOT embedded — apiKeyHelper reads it
|
|
86
75
|
// out of the VM .env at runtime — so this branch cannot use the shared
|
|
87
76
|
// `env` variant. Optional ANTHROPIC_BASE_URL rides along.
|
|
@@ -95,6 +84,5 @@ export async function writeClaudeEnv(envVars) {
|
|
|
95
84
|
};
|
|
96
85
|
// Contains ANTHROPIC_AUTH_TOKEN on OAuth flow — chmod 0o600.
|
|
97
86
|
await fs.writeFile(path.join(claudeDir, 'settings.json'), JSON.stringify(settings, null, 2) + '\n', { mode: 0o600 });
|
|
98
|
-
// auth-profiles.json is now written by applyBootstrapConfig from openclaw.json
|
|
99
87
|
}
|
|
100
88
|
//# sourceMappingURL=claude-env.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-env.js","sourceRoot":"","sources":["../../src/utils/claude-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE1E,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCpB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"claude-env.js","sourceRoot":"","sources":["../../src/utils/claude-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE1E,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCpB,CAAC;AAEF,qGAAqG;AACrG,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAA+B;IAClE,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CACT,2DAA2D,qBAAqB,EAAE,IAAI,SAAS,GAAG,CACnG,CAAC;QACF,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,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G,CAAC,OAAO,CAAC,kBAAkB;oBAC5B,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,EAAE,EAAE;oBAC7D,CAAC,CAAC,EAAE,CAAC;gBACP,KAAK;aACN,CAAC;IAER,6DAA6D;IAC7D,MAAM,EAAE,CAAC,SAAS,CAChB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,EACrC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EACxC,EAAE,IAAI,EAAE,KAAK,EAAE,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -1,48 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Each entry is a dot-separated path into `data.openclawConfig`. For dict-typed
|
|
6
|
-
* values (e.g. `mcp.servers`), merging happens KEY-by-KEY — missing keys are
|
|
7
|
-
* added, conflicting keys keep the local value. For leaf-ish subtrees
|
|
8
|
-
* (e.g. `tools.media.audio`), the whole subtree is either written (local
|
|
9
|
-
* missing) or skipped on conflict (local differs). Paths NOT in this list are
|
|
10
|
-
* never touched, even if the remote bootstrap includes them.
|
|
11
|
-
*
|
|
12
|
-
* NOTE: `mcp.servers` is a DOTTED path — the OpenClaw CLI's modern config
|
|
13
|
-
* schema nests MCP servers under `mcp.servers`, not the legacy flat
|
|
14
|
-
* `mcpServers` key. Agent-controller migrates any pre-existing flat
|
|
15
|
-
* `mcpServers` into `mcp.servers` and deletes the flat key (see
|
|
16
|
-
* `applyMergeableConfig` in apply-config.ts and `migrateLegacyMcpServers`
|
|
17
|
-
* in index.ts).
|
|
18
|
-
*
|
|
19
|
-
* To extend: add the path here. Keep it tight — every entry is an implicit
|
|
20
|
-
* promise that merging it won't clobber user work.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* The one backend-managed section of openclaw.json. Merged REMOTE-wins per
|
|
24
|
-
* server name (see `applyMergeableConfig`) and the only section whose change
|
|
25
|
-
* forces a gateway restart on standalone — openclaw does not hot-reload it.
|
|
26
|
-
*/
|
|
1
|
+
/** Only allowlisted paths may affect user-owned config. Legacy mcpServers must migrate to mcp.servers
|
|
2
|
+
* because strict schema validation rejects the flat key; see applyMergeableConfig. */
|
|
3
|
+
/** Backend-managed mcp.servers is remote-wins; changed entries need a restart fallback on older builds. */
|
|
27
4
|
export declare const MCP_SERVERS_PATH = "mcp.servers";
|
|
28
5
|
export declare const MERGEABLE_CONFIG_PATHS: readonly string[];
|
|
29
6
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* user-owned keys) is left untouched.
|
|
33
|
-
*
|
|
34
|
-
* `env` is DELIBERATELY EXCLUDED and must never be added back. The backend's
|
|
35
|
-
* `envVars` carry `ANTHROPIC_API_KEY` / `ANTHROPIC_BASE_URL`; merging them into
|
|
36
|
-
* a standalone user's ~/.claude/settings.json points ALL of that user's own
|
|
37
|
-
* Claude Code sessions at the platform proxy — which, when it is not running,
|
|
38
|
-
* breaks Claude Code on the machine outright. That incident happened twice
|
|
39
|
-
* (latest 2026-08-02) before the path was removed. Managed installs ('vm'/'k8s')
|
|
40
|
-
* still get their credentials, via `writeClaudeEnv()` — not via this merge.
|
|
41
|
-
*
|
|
42
|
-
* NOTE: `mcp.servers` is a DOTTED path — Claude Code's modern settings.json
|
|
43
|
-
* schema nests MCP servers under `mcp.servers`, not the legacy flat
|
|
44
|
-
* `mcpServers` key. Agent-controller migrates any pre-existing flat
|
|
45
|
-
* `mcpServers` into `mcp.servers` on first merge and deletes the flat key
|
|
46
|
-
* (see `applyMergeableConfig` in apply-config.ts).
|
|
7
|
+
* Never allow env here: platform credentials would redirect the user's own Claude sessions to our proxy.
|
|
8
|
+
* Managed credentials go through writeClaudeEnv; standalone settings retain local-wins mcp.servers only.
|
|
47
9
|
*/
|
|
48
10
|
export declare const MERGEABLE_SETTINGS_PATHS: readonly string[];
|
|
@@ -1,29 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Each entry is a dot-separated path into `data.openclawConfig`. For dict-typed
|
|
6
|
-
* values (e.g. `mcp.servers`), merging happens KEY-by-KEY — missing keys are
|
|
7
|
-
* added, conflicting keys keep the local value. For leaf-ish subtrees
|
|
8
|
-
* (e.g. `tools.media.audio`), the whole subtree is either written (local
|
|
9
|
-
* missing) or skipped on conflict (local differs). Paths NOT in this list are
|
|
10
|
-
* never touched, even if the remote bootstrap includes them.
|
|
11
|
-
*
|
|
12
|
-
* NOTE: `mcp.servers` is a DOTTED path — the OpenClaw CLI's modern config
|
|
13
|
-
* schema nests MCP servers under `mcp.servers`, not the legacy flat
|
|
14
|
-
* `mcpServers` key. Agent-controller migrates any pre-existing flat
|
|
15
|
-
* `mcpServers` into `mcp.servers` and deletes the flat key (see
|
|
16
|
-
* `applyMergeableConfig` in apply-config.ts and `migrateLegacyMcpServers`
|
|
17
|
-
* in index.ts).
|
|
18
|
-
*
|
|
19
|
-
* To extend: add the path here. Keep it tight — every entry is an implicit
|
|
20
|
-
* promise that merging it won't clobber user work.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* The one backend-managed section of openclaw.json. Merged REMOTE-wins per
|
|
24
|
-
* server name (see `applyMergeableConfig`) and the only section whose change
|
|
25
|
-
* forces a gateway restart on standalone — openclaw does not hot-reload it.
|
|
26
|
-
*/
|
|
1
|
+
/** Only allowlisted paths may affect user-owned config. Legacy mcpServers must migrate to mcp.servers
|
|
2
|
+
* because strict schema validation rejects the flat key; see applyMergeableConfig. */
|
|
3
|
+
/** Backend-managed mcp.servers is remote-wins; changed entries need a restart fallback on older builds. */
|
|
27
4
|
export const MCP_SERVERS_PATH = 'mcp.servers';
|
|
28
5
|
export const MERGEABLE_CONFIG_PATHS = [
|
|
29
6
|
MCP_SERVERS_PATH,
|
|
@@ -32,23 +9,8 @@ export const MERGEABLE_CONFIG_PATHS = [
|
|
|
32
9
|
'tools.transcription',
|
|
33
10
|
];
|
|
34
11
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* user-owned keys) is left untouched.
|
|
38
|
-
*
|
|
39
|
-
* `env` is DELIBERATELY EXCLUDED and must never be added back. The backend's
|
|
40
|
-
* `envVars` carry `ANTHROPIC_API_KEY` / `ANTHROPIC_BASE_URL`; merging them into
|
|
41
|
-
* a standalone user's ~/.claude/settings.json points ALL of that user's own
|
|
42
|
-
* Claude Code sessions at the platform proxy — which, when it is not running,
|
|
43
|
-
* breaks Claude Code on the machine outright. That incident happened twice
|
|
44
|
-
* (latest 2026-08-02) before the path was removed. Managed installs ('vm'/'k8s')
|
|
45
|
-
* still get their credentials, via `writeClaudeEnv()` — not via this merge.
|
|
46
|
-
*
|
|
47
|
-
* NOTE: `mcp.servers` is a DOTTED path — Claude Code's modern settings.json
|
|
48
|
-
* schema nests MCP servers under `mcp.servers`, not the legacy flat
|
|
49
|
-
* `mcpServers` key. Agent-controller migrates any pre-existing flat
|
|
50
|
-
* `mcpServers` into `mcp.servers` on first merge and deletes the flat key
|
|
51
|
-
* (see `applyMergeableConfig` in apply-config.ts).
|
|
12
|
+
* Never allow env here: platform credentials would redirect the user's own Claude sessions to our proxy.
|
|
13
|
+
* Managed credentials go through writeClaudeEnv; standalone settings retain local-wins mcp.servers only.
|
|
52
14
|
*/
|
|
53
15
|
export const MERGEABLE_SETTINGS_PATHS = ['mcp.servers'];
|
|
54
16
|
//# sourceMappingURL=config-merge-paths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-merge-paths.js","sourceRoot":"","sources":["../../src/utils/config-merge-paths.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config-merge-paths.js","sourceRoot":"","sources":["../../src/utils/config-merge-paths.ts"],"names":[],"mappings":"AAAA;sFACsF;AACtF,2GAA2G;AAC3G,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE9C,MAAM,CAAC,MAAM,sBAAsB,GAAsB;IACvD,gBAAgB;IAChB,mBAAmB;IACnB,mBAAmB;IACnB,qBAAqB;CACb,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsB,CAAC,aAAa,CAAU,CAAC"}
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Record the deployment type reported by a bootstrap payload. Ignores empty
|
|
3
|
-
* values so an older backend that omits the field cannot clear a known type.
|
|
4
|
-
*/
|
|
5
1
|
export declare function setResolvedDeployType(t?: string): void;
|
|
6
|
-
/**
|
|
7
|
-
* The payload-reported deployment type if one has arrived, otherwise the
|
|
8
|
-
* `AGENT_DEPLOY_TYPE` env var. `undefined` means "we do not know".
|
|
9
|
-
*/
|
|
10
2
|
export declare function getResolvedDeployType(): string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* True only for managed installs ('vm' / 'k8s'). Unknown deployment types
|
|
13
|
-
* deliberately resolve to false — fail safe, because the expensive mistake is
|
|
14
|
-
* rewriting a developer's ~/.claude/settings.json, not skipping a full apply.
|
|
15
|
-
*/
|
|
3
|
+
/** Fail safe on unknown types: skipping full apply is safer than overwriting a user's Claude settings. */
|
|
16
4
|
export declare function isManagedDeploy(): boolean;
|
|
@@ -1,32 +1,15 @@
|
|
|
1
1
|
import { config } from '../config.js';
|
|
2
|
-
/**
|
|
3
|
-
* Deployment types describing a machine our platform provisioned end to end.
|
|
4
|
-
* Everything else — 'standalone', 'external', or an unknown/absent type — is a
|
|
5
|
-
* third-party machine whose config files we are only allowed to merge into.
|
|
6
|
-
*/
|
|
2
|
+
/** Unknown or absent deployment types are third-party: wholesale config writes are forbidden. */
|
|
7
3
|
const MANAGED_TYPES = new Set(['vm', 'k8s']);
|
|
8
|
-
/** Set from the bootstrap payload; survives for the life of the process. */
|
|
9
4
|
let resolvedDeployType;
|
|
10
|
-
/**
|
|
11
|
-
* Record the deployment type reported by a bootstrap payload. Ignores empty
|
|
12
|
-
* values so an older backend that omits the field cannot clear a known type.
|
|
13
|
-
*/
|
|
14
5
|
export function setResolvedDeployType(t) {
|
|
15
6
|
if (t)
|
|
16
7
|
resolvedDeployType = t;
|
|
17
8
|
}
|
|
18
|
-
/**
|
|
19
|
-
* The payload-reported deployment type if one has arrived, otherwise the
|
|
20
|
-
* `AGENT_DEPLOY_TYPE` env var. `undefined` means "we do not know".
|
|
21
|
-
*/
|
|
22
9
|
export function getResolvedDeployType() {
|
|
23
10
|
return resolvedDeployType ?? config.agentDeployType;
|
|
24
11
|
}
|
|
25
|
-
/**
|
|
26
|
-
* True only for managed installs ('vm' / 'k8s'). Unknown deployment types
|
|
27
|
-
* deliberately resolve to false — fail safe, because the expensive mistake is
|
|
28
|
-
* rewriting a developer's ~/.claude/settings.json, not skipping a full apply.
|
|
29
|
-
*/
|
|
12
|
+
/** Fail safe on unknown types: skipping full apply is safer than overwriting a user's Claude settings. */
|
|
30
13
|
export function isManagedDeploy() {
|
|
31
14
|
const type = getResolvedDeployType();
|
|
32
15
|
return type !== undefined && MANAGED_TYPES.has(type);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-type.js","sourceRoot":"","sources":["../../src/utils/deploy-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"deploy-type.js","sourceRoot":"","sources":["../../src/utils/deploy-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,iGAAiG;AACjG,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAE7C,IAAI,kBAAsC,CAAC;AAE3C,MAAM,UAAU,qBAAqB,CAAC,CAAU;IAC9C,IAAI,CAAC;QAAE,kBAAkB,GAAG,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO,kBAAkB,IAAI,MAAM,CAAC,eAAe,CAAC;AACtD,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,eAAe;IAC7B,MAAM,IAAI,GAAG,qBAAqB,EAAE,CAAC;IACrC,OAAO,IAAI,KAAK,SAAS,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -10,11 +10,4 @@ export interface UnknownCheck {
|
|
|
10
10
|
}
|
|
11
11
|
export type DiagnosticsResult = Record<string, CheckResult | UnknownCheck>;
|
|
12
12
|
export declare function isKnownCheck(key: string): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Run one or more diagnostic checks. Each key is looked up in ALLOWED_CHECKS;
|
|
15
|
-
* unknown keys are recorded as `{ error: 'Unknown check' }` rather than
|
|
16
|
-
* throwing — the WS handler and CLI both surface that to the caller.
|
|
17
|
-
*
|
|
18
|
-
* Pass `undefined` (or no argument) to run every allowlisted check.
|
|
19
|
-
*/
|
|
20
13
|
export declare function runDiagnostics(checks?: string[]): Promise<DiagnosticsResult>;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { exec } from 'node:child_process';
|
|
2
|
-
// ---------------------------------------------------------------------------
|
|
3
|
-
// Shared diagnostics module — used by:
|
|
4
|
-
// - src/handlers/diagnostics.ts (WS handler)
|
|
5
|
-
// - src/commands/diagnostics-cli.ts (CLI)
|
|
6
|
-
//
|
|
7
|
-
// Allowlist of diagnostic checks. Adding a new key here exposes it both via
|
|
8
|
-
// WS and via the CLI automatically.
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
2
|
const DIAGNOSTICS_TIMEOUT_MS = 10_000;
|
|
11
3
|
export const ALLOWED_CHECKS = {
|
|
12
4
|
disk_usage: 'df -h',
|
|
@@ -32,13 +24,6 @@ function runCheck(cmd) {
|
|
|
32
24
|
});
|
|
33
25
|
});
|
|
34
26
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Run one or more diagnostic checks. Each key is looked up in ALLOWED_CHECKS;
|
|
37
|
-
* unknown keys are recorded as `{ error: 'Unknown check' }` rather than
|
|
38
|
-
* throwing — the WS handler and CLI both surface that to the caller.
|
|
39
|
-
*
|
|
40
|
-
* Pass `undefined` (or no argument) to run every allowlisted check.
|
|
41
|
-
*/
|
|
42
27
|
export async function runDiagnostics(checks) {
|
|
43
28
|
const targets = checks && checks.length > 0 ? checks : Object.keys(ALLOWED_CHECKS);
|
|
44
29
|
const results = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../src/utils/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../src/utils/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAEtC,MAAM,CAAC,MAAM,cAAc,GAA2B;IACpD,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,oBAAoB;IACjC,MAAM,EAAE,QAAQ;IAChB,cAAc,EAAE,gCAAgC;IAChD,YAAY,EAAE,gBAAgB;IAC9B,kBAAkB,EAAE,wDAAwD;IAC5E,SAAS,EAAE,+BAA+B;CAC3C,CAAC;AAeF,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW;IAC3B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACvE,OAAO,CAAC;gBACN,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;gBACzB,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;gBACzB,OAAO,EAAE,CAAC,KAAK;gBACf,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3C,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAiB;IACpD,MAAM,OAAO,GAAG,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnF,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;YAC1C,SAAS;QACX,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/utils/exec.d.ts
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
/** PATH handed to child processes: the inherited one plus {@link extraPathDirs}. */
|
|
2
1
|
export declare function execPath(): string;
|
|
3
|
-
/**
|
|
4
|
-
* Run a command through a shell and resolve its trimmed stdout.
|
|
5
|
-
*
|
|
6
|
-
* `timeout` defaults to 0 (no timeout) to preserve the behaviour of existing
|
|
7
|
-
* no-timeout callers (fast systemctl/launchctl/which calls); long-running
|
|
8
|
-
* callers already pass an explicit timeout. The raised maxBuffer prevents
|
|
9
|
-
* verbose output (e.g. `npm install -g`) from rejecting with
|
|
10
|
-
* ERR_CHILD_PROCESS_STDOUT_MAXBUFFER.
|
|
11
|
-
*/
|
|
12
2
|
export declare function execAsync(cmd: string, timeout?: number): Promise<string>;
|
package/dist/utils/exec.js
CHANGED
|
@@ -3,31 +3,10 @@ import path from 'node:path';
|
|
|
3
3
|
import { config } from '../config.js';
|
|
4
4
|
// 16 MB — avoid ERR_CHILD_PROCESS_STDOUT_MAXBUFFER on chatty commands like `npm install -g`.
|
|
5
5
|
const DEFAULT_MAX_BUFFER = 16 * 1024 * 1024;
|
|
6
|
-
/**
|
|
7
|
-
* Directories APPENDED to PATH for every child process we spawn.
|
|
8
|
-
*
|
|
9
|
-
* Why: the binaries we shell out to (`openclaw`, `npm`) live in a global npm
|
|
10
|
-
* prefix that is not on the ambient PATH in every context we run from, and a
|
|
11
|
-
* missing PATH entry has cost us the fleet twice:
|
|
12
|
-
* - VM first boot: the user-data step `su - ubuntu -c "openclaw plugins
|
|
13
|
-
* install @openclaw-cloud/mcp-warmup@latest"` died with `openclaw: command
|
|
14
|
-
* not found` on a whole cohort (~/.profile exports the npm-global bin only
|
|
15
|
-
* later in the bootstrap), and the `|| echo` swallowed it.
|
|
16
|
-
* - macOS launchd: the service PATH lacks /opt/homebrew/bin, so the
|
|
17
|
-
* best-effort `openclaw gateway restart` after a config merge always failed
|
|
18
|
-
* with `/bin/sh: openclaw: command not found`.
|
|
19
|
-
*
|
|
20
|
-
* APPENDED, never prepended — an operator's own PATH entry still wins, so this
|
|
21
|
-
* cannot hijack a deliberately pinned binary. Non-existent dirs are harmless.
|
|
22
|
-
*/
|
|
6
|
+
/** Append missing npm/Homebrew paths for provisioner and launchd contexts; never override operator PATH priority. */
|
|
23
7
|
function extraPathDirs() {
|
|
24
|
-
return [
|
|
25
|
-
path.join(config.home, '.npm-global', 'bin'), // npm prefix used by the VM provisioner
|
|
26
|
-
'/usr/local/bin',
|
|
27
|
-
'/opt/homebrew/bin', // Homebrew on Apple silicon
|
|
28
|
-
];
|
|
8
|
+
return [path.join(config.home, '.npm-global', 'bin'), '/usr/local/bin', '/opt/homebrew/bin'];
|
|
29
9
|
}
|
|
30
|
-
/** PATH handed to child processes: the inherited one plus {@link extraPathDirs}. */
|
|
31
10
|
export function execPath() {
|
|
32
11
|
const parts = (process.env.PATH ?? '').split(path.delimiter).filter(Boolean);
|
|
33
12
|
for (const dir of extraPathDirs()) {
|
|
@@ -36,15 +15,6 @@ export function execPath() {
|
|
|
36
15
|
}
|
|
37
16
|
return parts.join(path.delimiter);
|
|
38
17
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Run a command through a shell and resolve its trimmed stdout.
|
|
41
|
-
*
|
|
42
|
-
* `timeout` defaults to 0 (no timeout) to preserve the behaviour of existing
|
|
43
|
-
* no-timeout callers (fast systemctl/launchctl/which calls); long-running
|
|
44
|
-
* callers already pass an explicit timeout. The raised maxBuffer prevents
|
|
45
|
-
* verbose output (e.g. `npm install -g`) from rejecting with
|
|
46
|
-
* ERR_CHILD_PROCESS_STDOUT_MAXBUFFER.
|
|
47
|
-
*/
|
|
48
18
|
export function execAsync(cmd, timeout = 0) {
|
|
49
19
|
return new Promise((resolve, reject) => {
|
|
50
20
|
exec(cmd, { timeout, maxBuffer: DEFAULT_MAX_BUFFER, env: { ...process.env, PATH: execPath() } }, (err, stdout) => {
|
package/dist/utils/exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,6FAA6F;AAC7F,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C
|
|
1
|
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gBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;gBAChB,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QACzC,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
import type { AgentCommand, AgentResponse } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* The handler behind every command whose whole job is "restart the OpenClaw
|
|
4
|
-
* gateway": `restart`, `deploy` and `onboarding_complete`. They were three
|
|
5
|
-
* byte-identical copies of this wrapper.
|
|
6
|
-
*
|
|
7
|
-
* Emits only the domain event (`gateway_restart`) — the command lifecycle
|
|
8
|
-
* events are owned by the dispatch loop in connection.ts.
|
|
9
|
-
*/
|
|
2
|
+
/** connection.ts owns lifecycle events; emitting them here would duplicate backend log rows. */
|
|
10
3
|
export declare function handleGatewayRestartCommand(command: AgentCommand): Promise<AgentResponse>;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { restartGateway } from './gateway-restart.js';
|
|
2
2
|
import { logCollector } from '../connection.js';
|
|
3
|
-
/**
|
|
4
|
-
* The handler behind every command whose whole job is "restart the OpenClaw
|
|
5
|
-
* gateway": `restart`, `deploy` and `onboarding_complete`. They were three
|
|
6
|
-
* byte-identical copies of this wrapper.
|
|
7
|
-
*
|
|
8
|
-
* Emits only the domain event (`gateway_restart`) — the command lifecycle
|
|
9
|
-
* events are owned by the dispatch loop in connection.ts.
|
|
10
|
-
*/
|
|
3
|
+
/** connection.ts owns lifecycle events; emitting them here would duplicate backend log rows. */
|
|
11
4
|
export async function handleGatewayRestartCommand(command) {
|
|
12
5
|
logCollector?.push('gateway_restart', 'info', 'Gateway restart requested', {
|
|
13
6
|
commandId: command.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-restart-handler.js","sourceRoot":"","sources":["../../src/utils/gateway-restart-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD
|
|
1
|
+
{"version":3,"file":"gateway-restart-handler.js","sourceRoot":"","sources":["../../src/utils/gateway-restart-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,gGAAgG;AAChG,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,OAAqB;IACrE,YAAY,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,2BAA2B,EAAE;QACzE,SAAS,EAAE,OAAO,CAAC,EAAE;QACrB,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC,CAAC;IACH,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,cAAc,EAAE,CAAC;QAClD,OAAO;YACL,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;SACzB,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,GAAG,GAAmD,CAAC;QAC9D,OAAO;YACL,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,EAAE,EAAE;YACxD,KAAK,EAAE,CAAC,CAAC,OAAO;SACjB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -2,17 +2,7 @@ export interface GatewayRestartResult {
|
|
|
2
2
|
stdout: string;
|
|
3
3
|
stderr: string;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
* Restart the gateway via the configured agent provider.
|
|
7
|
-
* Returns { stdout: '', stderr: '' } for interface compatibility.
|
|
8
|
-
*
|
|
9
|
-
* `configureProvider()` only ever runs inside the daemon's `main()`, so in
|
|
10
|
-
* EVERY CLI invocation `getProvider()` is null. This used to warn and return
|
|
11
|
-
* success, which made `agent-controller restart` (and the restart tail of
|
|
12
|
-
* `deploy` / `agent-update` / `self-update`) a silent no-op that still exited
|
|
13
|
-
* 0. We now build a throwaway provider from config instead, and throw when
|
|
14
|
-
* even that is impossible so the caller can exit non-zero.
|
|
15
|
-
*/
|
|
5
|
+
/** CLI calls lack a configured daemon provider; create a throwaway or fail instead of reporting a no-op success. */
|
|
16
6
|
export declare function restartGateway(): Promise<GatewayRestartResult>;
|
|
17
7
|
/**
|
|
18
8
|
* @deprecated Use restartGateway() instead.
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { createProviderFromConfig, getProvider } from '../providers/index.js';
|
|
2
2
|
import { config } from '../config.js';
|
|
3
|
-
/**
|
|
4
|
-
* Restart the gateway via the configured agent provider.
|
|
5
|
-
* Returns { stdout: '', stderr: '' } for interface compatibility.
|
|
6
|
-
*
|
|
7
|
-
* `configureProvider()` only ever runs inside the daemon's `main()`, so in
|
|
8
|
-
* EVERY CLI invocation `getProvider()` is null. This used to warn and return
|
|
9
|
-
* success, which made `agent-controller restart` (and the restart tail of
|
|
10
|
-
* `deploy` / `agent-update` / `self-update`) a silent no-op that still exited
|
|
11
|
-
* 0. We now build a throwaway provider from config instead, and throw when
|
|
12
|
-
* even that is impossible so the caller can exit non-zero.
|
|
13
|
-
*/
|
|
3
|
+
/** CLI calls lack a configured daemon provider; create a throwaway or fail instead of reporting a no-op success. */
|
|
14
4
|
export async function restartGateway() {
|
|
15
5
|
const provider = getProvider() ?? createProviderFromConfig();
|
|
16
6
|
if (!provider) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-restart.js","sourceRoot":"","sources":["../../src/utils/gateway-restart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAOtC
|
|
1
|
+
{"version":3,"file":"gateway-restart.js","sourceRoot":"","sources":["../../src/utils/gateway-restart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAOtC,oHAAoH;AACpH,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,QAAQ,GAAG,WAAW,EAAE,IAAI,wBAAwB,EAAE,CAAC;IAC7D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,mDAAmD,MAAM,CAAC,aAAa,IAAI;YACzE,uDAAuD,CAC1D,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC"}
|
|
@@ -30,41 +30,18 @@ export interface MemoryDelta {
|
|
|
30
30
|
action: MemoryDeltaAction;
|
|
31
31
|
data: unknown;
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
34
|
-
* In-memory knowledge graph with atomic persistence.
|
|
35
|
-
*
|
|
36
|
-
* Ported from @modelcontextprotocol/server-memory with key differences:
|
|
37
|
-
* - Graph stays in memory (this.graph), loaded once at init()
|
|
38
|
-
* - All mutations operate on this.graph, then call persist()
|
|
39
|
-
* - persist() uses atomic write: write to .tmp file, then fs.rename()
|
|
40
|
-
* - Extends EventEmitter, emits 'delta' event after each mutation
|
|
41
|
-
* - Query methods (readGraph, searchNodes, openNodes) are synchronous
|
|
42
|
-
*/
|
|
43
33
|
export declare class KnowledgeGraphManager extends EventEmitter {
|
|
44
34
|
private memoryFilePath;
|
|
45
35
|
private graph;
|
|
46
36
|
private persistQueue;
|
|
47
37
|
constructor(memoryFilePath: string);
|
|
48
|
-
/** Load graph from disk into memory. Call once at startup. */
|
|
49
38
|
init(): Promise<void>;
|
|
50
39
|
private readGraphFromDisk;
|
|
51
|
-
/**
|
|
52
|
-
* Serialized persist: enqueues writes so concurrent calls never interleave.
|
|
53
|
-
* The queue tail swallows rejections so persistQueue is always fulfilled — a
|
|
54
|
-
* failed write never poisons the chain (the next write still runs) — while the
|
|
55
|
-
* caller of THIS write still observes its real success/failure.
|
|
56
|
-
*/
|
|
40
|
+
/** Keep the queue tail fulfilled after failure so later writes run, while the failing caller still rejects. */
|
|
57
41
|
private persist;
|
|
58
|
-
/**
|
|
59
|
-
* Persist after an in-memory mutation, rolling the graph back to `snapshot`
|
|
60
|
-
* if the write fails. This keeps memory consistent with disk and with the
|
|
61
|
-
* backend (which is told the mutation failed and receives no delta) instead
|
|
62
|
-
* of leaving the failed mutation in memory to land on the next write.
|
|
63
|
-
*/
|
|
42
|
+
/** Roll back failed writes so memory matches disk and no unreported mutation leaks into the next persist. */
|
|
64
43
|
private persistWithRollback;
|
|
65
|
-
/** Atomic persist: write to .tmp, then fs.rename(). */
|
|
66
44
|
private doPersist;
|
|
67
|
-
/** Emit delta event after mutation (for sync to backend). */
|
|
68
45
|
private emitDelta;
|
|
69
46
|
createEntities(entities: Entity[]): Promise<Entity[]>;
|
|
70
47
|
createRelations(relations: Relation[]): Promise<Relation[]>;
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
|
-
// ---------------------------------------------------------------------------
|
|
5
|
-
// KnowledgeGraphManager
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
/**
|
|
8
|
-
* In-memory knowledge graph with atomic persistence.
|
|
9
|
-
*
|
|
10
|
-
* Ported from @modelcontextprotocol/server-memory with key differences:
|
|
11
|
-
* - Graph stays in memory (this.graph), loaded once at init()
|
|
12
|
-
* - All mutations operate on this.graph, then call persist()
|
|
13
|
-
* - persist() uses atomic write: write to .tmp file, then fs.rename()
|
|
14
|
-
* - Extends EventEmitter, emits 'delta' event after each mutation
|
|
15
|
-
* - Query methods (readGraph, searchNodes, openNodes) are synchronous
|
|
16
|
-
*/
|
|
17
4
|
export class KnowledgeGraphManager extends EventEmitter {
|
|
18
5
|
memoryFilePath;
|
|
19
6
|
graph = { entities: [], relations: [] };
|
|
@@ -22,13 +9,9 @@ export class KnowledgeGraphManager extends EventEmitter {
|
|
|
22
9
|
super();
|
|
23
10
|
this.memoryFilePath = memoryFilePath;
|
|
24
11
|
}
|
|
25
|
-
/** Load graph from disk into memory. Call once at startup. */
|
|
26
12
|
async init() {
|
|
27
13
|
this.graph = await this.readGraphFromDisk();
|
|
28
14
|
}
|
|
29
|
-
// -------------------------------------------------------------------------
|
|
30
|
-
// Disk I/O
|
|
31
|
-
// -------------------------------------------------------------------------
|
|
32
15
|
async readGraphFromDisk() {
|
|
33
16
|
try {
|
|
34
17
|
const data = await fs.readFile(this.memoryFilePath, 'utf-8');
|
|
@@ -70,23 +53,13 @@ export class KnowledgeGraphManager extends EventEmitter {
|
|
|
70
53
|
throw error;
|
|
71
54
|
}
|
|
72
55
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Serialized persist: enqueues writes so concurrent calls never interleave.
|
|
75
|
-
* The queue tail swallows rejections so persistQueue is always fulfilled — a
|
|
76
|
-
* failed write never poisons the chain (the next write still runs) — while the
|
|
77
|
-
* caller of THIS write still observes its real success/failure.
|
|
78
|
-
*/
|
|
56
|
+
/** Keep the queue tail fulfilled after failure so later writes run, while the failing caller still rejects. */
|
|
79
57
|
persist() {
|
|
80
58
|
const run = this.persistQueue.then(() => this.doPersist());
|
|
81
59
|
this.persistQueue = run.then(() => undefined, () => undefined);
|
|
82
60
|
return run;
|
|
83
61
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Persist after an in-memory mutation, rolling the graph back to `snapshot`
|
|
86
|
-
* if the write fails. This keeps memory consistent with disk and with the
|
|
87
|
-
* backend (which is told the mutation failed and receives no delta) instead
|
|
88
|
-
* of leaving the failed mutation in memory to land on the next write.
|
|
89
|
-
*/
|
|
62
|
+
/** Roll back failed writes so memory matches disk and no unreported mutation leaks into the next persist. */
|
|
90
63
|
async persistWithRollback(snapshot) {
|
|
91
64
|
try {
|
|
92
65
|
await this.persist();
|
|
@@ -96,7 +69,6 @@ export class KnowledgeGraphManager extends EventEmitter {
|
|
|
96
69
|
throw err;
|
|
97
70
|
}
|
|
98
71
|
}
|
|
99
|
-
/** Atomic persist: write to .tmp, then fs.rename(). */
|
|
100
72
|
async doPersist() {
|
|
101
73
|
const lines = [
|
|
102
74
|
...this.graph.entities.map((e) => JSON.stringify({
|
|
@@ -112,13 +84,9 @@ export class KnowledgeGraphManager extends EventEmitter {
|
|
|
112
84
|
await fs.writeFile(tmpPath, lines.join('\n'));
|
|
113
85
|
await fs.rename(tmpPath, this.memoryFilePath);
|
|
114
86
|
}
|
|
115
|
-
/** Emit delta event after mutation (for sync to backend). */
|
|
116
87
|
emitDelta(action, data) {
|
|
117
88
|
this.emit('delta', { action, data });
|
|
118
89
|
}
|
|
119
|
-
// -------------------------------------------------------------------------
|
|
120
|
-
// Mutations — operate on this.graph, persist, emit delta
|
|
121
|
-
// -------------------------------------------------------------------------
|
|
122
90
|
async createEntities(entities) {
|
|
123
91
|
const newEntities = entities.filter((e) => !this.graph.entities.some((existing) => existing.name === e.name));
|
|
124
92
|
const snapshot = structuredClone(this.graph);
|
|
@@ -184,9 +152,6 @@ export class KnowledgeGraphManager extends EventEmitter {
|
|
|
184
152
|
await this.persistWithRollback(snapshot);
|
|
185
153
|
this.emitDelta('relations_deleted', relations);
|
|
186
154
|
}
|
|
187
|
-
// -------------------------------------------------------------------------
|
|
188
|
-
// Queries — read from this.graph in-memory, no disk I/O
|
|
189
|
-
// -------------------------------------------------------------------------
|
|
190
155
|
readGraph() {
|
|
191
156
|
return this.graph;
|
|
192
157
|
}
|