@openclaw-cloud/agent-controller 3.0.0-beta.2 → 3.0.0-beta.20
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/bin/agent-controller.js +5 -9
- package/dist/api.d.ts +16 -0
- package/dist/api.js.map +1 -1
- package/dist/commands/agent-update-cli.js +23 -38
- package/dist/commands/agent-update-cli.js.map +1 -1
- package/dist/commands/backup-cli.js +6 -4
- package/dist/commands/backup-cli.js.map +1 -1
- package/dist/commands/bootstrap.d.ts +10 -1
- package/dist/commands/bootstrap.js +33 -73
- package/dist/commands/bootstrap.js.map +1 -1
- package/dist/commands/channel-server.js +4 -3
- package/dist/commands/channel-server.js.map +1 -1
- package/dist/commands/heartbeat-cli.js +2 -6
- package/dist/commands/heartbeat-cli.js.map +1 -1
- package/dist/commands/install-deps.d.ts +10 -0
- package/dist/commands/install-deps.js +33 -43
- package/dist/commands/install-deps.js.map +1 -1
- package/dist/commands/knowledge-sync-cli.js +6 -4
- package/dist/commands/knowledge-sync-cli.js.map +1 -1
- package/dist/commands/plugin-update-cli.js +4 -8
- package/dist/commands/plugin-update-cli.js.map +1 -1
- package/dist/commands/self-update.d.ts +1 -0
- package/dist/commands/self-update.js +76 -37
- package/dist/commands/self-update.js.map +1 -1
- package/dist/commands/update-skills.js +7 -6
- package/dist/commands/update-skills.js.map +1 -1
- package/dist/config-file.d.ts +24 -0
- package/dist/config-file.js +56 -20
- package/dist/config-file.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -1
- package/dist/connection.d.ts +4 -0
- package/dist/connection.js +50 -5
- package/dist/connection.js.map +1 -1
- package/dist/handlers/agent-update.d.ts +4 -0
- package/dist/handlers/agent-update.js +16 -44
- package/dist/handlers/agent-update.js.map +1 -1
- package/dist/handlers/deploy.d.ts +1 -2
- package/dist/handlers/deploy.js +4 -20
- package/dist/handlers/deploy.js.map +1 -1
- package/dist/handlers/diagnostics.js +0 -12
- package/dist/handlers/diagnostics.js.map +1 -1
- package/dist/handlers/file-delete.js +4 -5
- package/dist/handlers/file-delete.js.map +1 -1
- package/dist/handlers/file-write.js +4 -4
- package/dist/handlers/file-write.js.map +1 -1
- package/dist/handlers/knowledge-sync.js +2 -14
- package/dist/handlers/knowledge-sync.js.map +1 -1
- package/dist/handlers/memory.d.ts +11 -1
- package/dist/handlers/memory.js.map +1 -1
- package/dist/handlers/onboarding.d.ts +1 -2
- package/dist/handlers/onboarding.js +3 -20
- package/dist/handlers/onboarding.js.map +1 -1
- package/dist/handlers/package-install.js +1 -1
- package/dist/handlers/package-install.js.map +1 -1
- package/dist/handlers/pair.js +0 -12
- package/dist/handlers/pair.js.map +1 -1
- package/dist/handlers/restart.d.ts +1 -2
- package/dist/handlers/restart.js +3 -8
- package/dist/handlers/restart.js.map +1 -1
- package/dist/handlers/slack-event.d.ts +13 -0
- package/dist/handlers/slack-event.js +40 -0
- package/dist/handlers/slack-event.js.map +1 -0
- package/dist/handlers/stop.js +0 -7
- package/dist/handlers/stop.js.map +1 -1
- package/dist/handlers/telegram-webhook.js +3 -22
- package/dist/handlers/telegram-webhook.js.map +1 -1
- package/dist/handlers/update-config.js +4 -13
- package/dist/handlers/update-config.js.map +1 -1
- package/dist/heartbeat.d.ts +7 -1
- package/dist/heartbeat.js +35 -6
- package/dist/heartbeat.js.map +1 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.js +87 -119
- package/dist/index.js.map +1 -1
- package/dist/lockfile.js +2 -1
- package/dist/lockfile.js.map +1 -1
- package/dist/platform/linux.js +6 -5
- package/dist/platform/linux.js.map +1 -1
- package/dist/platform/macos.js +3 -2
- package/dist/platform/macos.js.map +1 -1
- package/dist/platform/windows.js +3 -2
- package/dist/platform/windows.js.map +1 -1
- package/dist/providers/claude-code/channel-server.js +2 -1
- package/dist/providers/claude-code/channel-server.js.map +1 -1
- package/dist/providers/claude-code/settings-writer.d.ts +3 -2
- package/dist/providers/claude-code/settings-writer.js +6 -15
- package/dist/providers/claude-code/settings-writer.js.map +1 -1
- package/dist/providers/index.d.ts +13 -0
- package/dist/providers/index.js +25 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/openclaw/gateway-adapter.js +2 -0
- package/dist/providers/openclaw/gateway-adapter.js.map +1 -1
- package/dist/providers/openclaw/gateway-client.js +6 -1
- package/dist/providers/openclaw/gateway-client.js.map +1 -1
- package/dist/providers/openclaw/index.js +11 -13
- package/dist/providers/openclaw/index.js.map +1 -1
- package/dist/slack-relay-server.d.ts +48 -0
- package/dist/slack-relay-server.js +197 -0
- package/dist/slack-relay-server.js.map +1 -0
- package/dist/types.d.ts +16 -1
- package/dist/utils/anthropic-auth.d.ts +14 -0
- package/dist/utils/anthropic-auth.js +24 -0
- package/dist/utils/anthropic-auth.js.map +1 -1
- package/dist/utils/apply-config.d.ts +65 -12
- package/dist/utils/apply-config.js +295 -100
- package/dist/utils/apply-config.js.map +1 -1
- package/dist/utils/claude-env.d.ts +6 -0
- package/dist/utils/claude-env.js +29 -28
- package/dist/utils/claude-env.js.map +1 -1
- package/dist/utils/config-merge-paths.d.ts +15 -1
- package/dist/utils/config-merge-paths.js +17 -3
- package/dist/utils/config-merge-paths.js.map +1 -1
- package/dist/utils/deploy-type.d.ts +16 -0
- package/dist/utils/deploy-type.js +34 -0
- package/dist/utils/deploy-type.js.map +1 -0
- package/dist/utils/env.d.ts +0 -1
- package/dist/utils/env.js +0 -8
- package/dist/utils/env.js.map +1 -1
- package/dist/utils/exec.d.ts +11 -0
- package/dist/utils/exec.js +47 -1
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/gateway-restart-handler.d.ts +6 -2
- package/dist/utils/gateway-restart-handler.js +11 -2
- package/dist/utils/gateway-restart-handler.js.map +1 -1
- package/dist/utils/gateway-restart.d.ts +7 -0
- package/dist/utils/gateway-restart.js +12 -4
- package/dist/utils/gateway-restart.js.map +1 -1
- package/dist/utils/knowledge-graph.d.ts +13 -1
- package/dist/utils/knowledge-graph.js +75 -29
- package/dist/utils/knowledge-graph.js.map +1 -1
- package/dist/utils/legacy-mcp-servers.d.ts +12 -0
- package/dist/utils/legacy-mcp-servers.js +37 -0
- package/dist/utils/legacy-mcp-servers.js.map +1 -0
- package/dist/utils/log-collector.js +2 -1
- package/dist/utils/log-collector.js.map +1 -1
- package/dist/utils/openclaw-ops.d.ts +45 -3
- package/dist/utils/openclaw-ops.js +94 -15
- package/dist/utils/openclaw-ops.js.map +1 -1
- package/dist/utils/openclaw-stack-update.d.ts +31 -0
- package/dist/utils/openclaw-stack-update.js +50 -0
- package/dist/utils/openclaw-stack-update.js.map +1 -0
- package/dist/utils/package-install.js +4 -12
- package/dist/utils/package-install.js.map +1 -1
- package/dist/utils/package-version.d.ts +10 -0
- package/dist/utils/package-version.js +18 -0
- package/dist/utils/package-version.js.map +1 -0
- package/dist/utils/parse-id-at-version.d.ts +15 -0
- package/dist/utils/parse-id-at-version.js +22 -0
- package/dist/utils/parse-id-at-version.js.map +1 -0
- package/dist/utils/plugin-reconcile.d.ts +46 -0
- package/dist/utils/plugin-reconcile.js +201 -0
- package/dist/utils/plugin-reconcile.js.map +1 -0
- package/dist/utils/response.js +1 -0
- package/dist/utils/response.js.map +1 -1
- package/dist/utils/write-home-files.d.ts +27 -0
- package/dist/utils/write-home-files.js +72 -0
- package/dist/utils/write-home-files.js.map +1 -0
- package/dist/utils/write-workspace-files.d.ts +1 -1
- package/dist/utils/write-workspace-files.js +19 -7
- package/dist/utils/write-workspace-files.js.map +1 -1
- package/dist/workspace.d.ts +11 -0
- package/dist/workspace.js +20 -0
- package/dist/workspace.js.map +1 -1
- package/package.json +9 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge-graph.js","sourceRoot":"","sources":["../../src/utils/knowledge-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B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CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CACnD,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CACxE,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;IACtE,CAAC;IAED,SAAS,CAAC,KAAe;QACvB,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACnF,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACzE,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CACnD,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CACxE,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;IACtE,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lift a legacy flat `mcpServers` map at the root of a config file into the
|
|
3
|
+
* canonical nested `mcp.servers`. Existing nested entries win; the flat key is
|
|
4
|
+
* removed. Mutates `fileConfig` in place and returns true when anything moved.
|
|
5
|
+
*
|
|
6
|
+
* OpenClaw's CLI switched to strict schema validation that rejects the unknown
|
|
7
|
+
* top-level `mcpServers` key, so leaving it behind crashes the gateway on
|
|
8
|
+
* startup. The same migration runs against openclaw.json (both at startup and
|
|
9
|
+
* on the scoped-merge path) and against ~/.claude/settings.json, which is why
|
|
10
|
+
* it lives here instead of being copy-pasted into each of them.
|
|
11
|
+
*/
|
|
12
|
+
export declare function migrateLegacyMcpServers(fileConfig: Record<string, unknown>, logPrefix: string): boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function asPlainObject(v) {
|
|
2
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v)
|
|
3
|
+
? v
|
|
4
|
+
: null;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Lift a legacy flat `mcpServers` map at the root of a config file into the
|
|
8
|
+
* canonical nested `mcp.servers`. Existing nested entries win; the flat key is
|
|
9
|
+
* removed. Mutates `fileConfig` in place and returns true when anything moved.
|
|
10
|
+
*
|
|
11
|
+
* OpenClaw's CLI switched to strict schema validation that rejects the unknown
|
|
12
|
+
* top-level `mcpServers` key, so leaving it behind crashes the gateway on
|
|
13
|
+
* startup. The same migration runs against openclaw.json (both at startup and
|
|
14
|
+
* on the scoped-merge path) and against ~/.claude/settings.json, which is why
|
|
15
|
+
* it lives here instead of being copy-pasted into each of them.
|
|
16
|
+
*/
|
|
17
|
+
export function migrateLegacyMcpServers(fileConfig, logPrefix) {
|
|
18
|
+
const flat = asPlainObject(fileConfig.mcpServers);
|
|
19
|
+
if (!flat)
|
|
20
|
+
return false;
|
|
21
|
+
const mcp = asPlainObject(fileConfig.mcp) ?? {};
|
|
22
|
+
const nested = asPlainObject(mcp.servers) ?? {};
|
|
23
|
+
for (const [name, value] of Object.entries(flat)) {
|
|
24
|
+
if (!(name in nested)) {
|
|
25
|
+
nested[name] = value;
|
|
26
|
+
console.log(`${logPrefix} MIGRATED legacy mcpServers.${name} → mcp.servers.${name}`);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
console.warn(`${logPrefix} MIGRATION SKIP: mcp.servers.${name} already exists, dropping legacy flat entry`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
mcp.servers = nested;
|
|
33
|
+
fileConfig.mcp = mcp;
|
|
34
|
+
delete fileConfig.mcpServers;
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=legacy-mcp-servers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-mcp-servers.js","sourceRoot":"","sources":["../../src/utils/legacy-mcp-servers.ts"],"names":[],"mappings":"AAAA,SAAS,aAAa,CAAC,CAAU;IAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAE,CAA6B;QAChC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAmC,EACnC,SAAiB;IAEjB,MAAM,IAAI,GAAG,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAClD,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IAExB,MAAM,GAAG,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IAChD,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAEhD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACjD,IAAI,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,+BAA+B,IAAI,kBAAkB,IAAI,EAAE,CAAC,CAAC;QACvF,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CACV,GAAG,SAAS,gCAAgC,IAAI,6CAA6C,CAC9F,CAAC;QACJ,CAAC;IACH,CAAC;IAED,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IACrB,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC;IACrB,OAAO,UAAU,CAAC,UAAU,CAAC;IAC7B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { toErrorMessage } from './response.js';
|
|
1
2
|
export class LogCollector {
|
|
2
3
|
buffer = [];
|
|
3
4
|
timer = null;
|
|
@@ -39,7 +40,7 @@ export class LogCollector {
|
|
|
39
40
|
if (this.buffer.length > 500) {
|
|
40
41
|
this.buffer.splice(500);
|
|
41
42
|
}
|
|
42
|
-
console.error('[log-collector] flush failed:', err
|
|
43
|
+
console.error('[log-collector] flush failed:', toErrorMessage(err));
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
async shutdown() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-collector.js","sourceRoot":"","sources":["../../src/utils/log-collector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log-collector.js","sourceRoot":"","sources":["../../src/utils/log-collector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAU/C,MAAM,OAAO,YAAY;IACf,MAAM,GAAe,EAAE,CAAC;IACxB,KAAK,GAA0B,IAAI,CAAC;IAC3B,eAAe,CAAS;IACxB,YAAY,CAAS;IACrB,GAAG,CAAW;IAE/B,YAAY,GAAa,EAAE,IAA0D;QACnF,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,eAAe,GAAG,IAAI,EAAE,eAAe,IAAI,IAAI,CAAC;QACrD,IAAI,CAAC,YAAY,GAAG,IAAI,EAAE,YAAY,IAAI,EAAE,CAAC;QAC7C,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED,IAAI,CACF,SAAiB,EACjB,KAA0C,EAC1C,OAAe,EACf,QAAk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,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAEO,UAAU;QAChB,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACnF,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -11,15 +11,46 @@ export interface InstalledPlugin {
|
|
|
11
11
|
id: string;
|
|
12
12
|
version: string;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Reads installed plugins from `<stateDir>/openclaw.json` directly.
|
|
16
|
+
*
|
|
17
|
+
* Why prefer the config file over the CLI: the WS `plugin_update` handler
|
|
18
|
+
* (and `agent-update`) writes `plugins.installs.<id>.{spec, version,
|
|
19
|
+
* resolvedVersion}` into the openclaw config; openclaw watches the file
|
|
20
|
+
* and reloads. So the config file is the canonical "what's installed"
|
|
21
|
+
* record — there is no separate package directory we need to enumerate.
|
|
22
|
+
*
|
|
23
|
+
* Reading the file avoids:
|
|
24
|
+
* - 30s-cadence `openclaw plugins list --json` fork+execs from the
|
|
25
|
+
* heartbeat loop, AND
|
|
26
|
+
* - dependency on a specific openclaw CLI version exposing that
|
|
27
|
+
* subcommand at all (older runtimes silently failed → empty list).
|
|
28
|
+
*
|
|
29
|
+
* Returns an empty array on missing file, malformed JSON, or absent
|
|
30
|
+
* `plugins.installs` — heartbeat callers don't want to crash on partial
|
|
31
|
+
* config. Prefers `resolvedVersion` (the post-install actual version)
|
|
32
|
+
* over `version` (the requested spec) when both are present.
|
|
33
|
+
*/
|
|
34
|
+
export declare function listInstalledPluginsFromConfig(): Promise<InstalledPlugin[]>;
|
|
14
35
|
/**
|
|
15
36
|
* Reads the installed plugin list via `openclaw plugins list --json`.
|
|
16
37
|
* Throws on exec failure or malformed JSON, including a stdout snippet so
|
|
17
38
|
* operators can debug from the agent log.
|
|
39
|
+
*
|
|
40
|
+
* 60-second timeout: the CLI has been observed to take 30s+ on cold
|
|
41
|
+
* boot when openclaw warms up its plugin scanner, and a tighter cap
|
|
42
|
+
* caused spurious failures from the heartbeat / installPlugins paths.
|
|
18
43
|
*/
|
|
19
44
|
export declare function listInstalledPlugins(): Promise<InstalledPlugin[]>;
|
|
20
45
|
/**
|
|
21
46
|
* Install a specific openclaw runtime version globally.
|
|
22
47
|
* Skip-fast when `openclaw --version` already matches.
|
|
48
|
+
*
|
|
49
|
+
* `--force` is required: a previous install often leaves the
|
|
50
|
+
* `/usr/local/bin/openclaw` symlink owned by a different user (or
|
|
51
|
+
* untracked by the new package metadata), which makes a plain
|
|
52
|
+
* `npm install -g openclaw@<v>` fail with `EEXIST: file already exists`.
|
|
53
|
+
* The flag tells npm to overwrite the existing link instead of bailing.
|
|
23
54
|
*/
|
|
24
55
|
export declare function installOpenclaw(version: string): Promise<boolean>;
|
|
25
56
|
/**
|
|
@@ -38,9 +69,20 @@ export interface InstallPluginsResult {
|
|
|
38
69
|
}>;
|
|
39
70
|
}
|
|
40
71
|
/**
|
|
41
|
-
* Install several plugins sequentially. One
|
|
42
|
-
* is shared across the whole loop;
|
|
43
|
-
* not abort the rest of the
|
|
72
|
+
* Install several plugins sequentially. One inventory probe via
|
|
73
|
+
* `openclaw plugins list --json` is shared across the whole loop;
|
|
74
|
+
* per-plugin failures are recorded but do not abort the rest of the
|
|
75
|
+
* batch (poison-pill protection).
|
|
76
|
+
*
|
|
77
|
+
* Why CLI not config-file: the config file's `plugins.installs` block
|
|
78
|
+
* is incomplete in practice (bundled / compat-discovered plugins are
|
|
79
|
+
* absent, and openclaw itself sometimes rewrites the file without
|
|
80
|
+
* preserving installs), so a config-driven skip-cache under-reports
|
|
81
|
+
* what's actually loaded and forces every install to re-run with
|
|
82
|
+
* `--force`. The CLI is the source of truth.
|
|
83
|
+
*
|
|
84
|
+
* If the CLI throws we still try every install — the per-plugin
|
|
85
|
+
* `installPlugin --force` will overwrite cleanly.
|
|
44
86
|
*/
|
|
45
87
|
export declare function installPlugins(plugins: Array<{
|
|
46
88
|
id: string;
|
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
*
|
|
9
9
|
* NEVER import 'process.env.X' here — use config from '../config.js'.
|
|
10
10
|
*/
|
|
11
|
+
import fs from 'node:fs/promises';
|
|
12
|
+
import path from 'node:path';
|
|
11
13
|
import { execAsync } from './exec.js';
|
|
12
14
|
import { config } from '../config.js';
|
|
15
|
+
import { toErrorMessage } from './response.js';
|
|
13
16
|
const OPENCLAW_PACKAGE = 'openclaw';
|
|
14
17
|
export const AC_PACKAGE = '@openclaw-cloud/agent-controller';
|
|
15
18
|
// ---------------------------------------------------------------------------
|
|
@@ -32,11 +35,11 @@ export async function withEaccesRetry(fn, label) {
|
|
|
32
35
|
return await fn();
|
|
33
36
|
}
|
|
34
37
|
catch (retryErr) {
|
|
35
|
-
console.error(`${label} failed after permission fix:`, retryErr
|
|
38
|
+
console.error(`${label} failed after permission fix:`, toErrorMessage(retryErr));
|
|
36
39
|
throw retryErr;
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
|
-
console.error(`${label} failed:`, err
|
|
42
|
+
console.error(`${label} failed:`, toErrorMessage(err));
|
|
40
43
|
throw err;
|
|
41
44
|
}
|
|
42
45
|
}
|
|
@@ -54,7 +57,7 @@ export async function getOpenclawVersion() {
|
|
|
54
57
|
stdout = await execAsync('openclaw --version', 10_000);
|
|
55
58
|
}
|
|
56
59
|
catch (err) {
|
|
57
|
-
const msg =
|
|
60
|
+
const msg = toErrorMessage(err);
|
|
58
61
|
throw new Error(`openclaw --version failed: ${msg}`);
|
|
59
62
|
}
|
|
60
63
|
// Match a SemVer-like token; tolerate prefixes like "openclaw v1.2.3"
|
|
@@ -64,18 +67,80 @@ export async function getOpenclawVersion() {
|
|
|
64
67
|
}
|
|
65
68
|
return match[0];
|
|
66
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Reads installed plugins from `<stateDir>/openclaw.json` directly.
|
|
72
|
+
*
|
|
73
|
+
* Why prefer the config file over the CLI: the WS `plugin_update` handler
|
|
74
|
+
* (and `agent-update`) writes `plugins.installs.<id>.{spec, version,
|
|
75
|
+
* resolvedVersion}` into the openclaw config; openclaw watches the file
|
|
76
|
+
* and reloads. So the config file is the canonical "what's installed"
|
|
77
|
+
* record — there is no separate package directory we need to enumerate.
|
|
78
|
+
*
|
|
79
|
+
* Reading the file avoids:
|
|
80
|
+
* - 30s-cadence `openclaw plugins list --json` fork+execs from the
|
|
81
|
+
* heartbeat loop, AND
|
|
82
|
+
* - dependency on a specific openclaw CLI version exposing that
|
|
83
|
+
* subcommand at all (older runtimes silently failed → empty list).
|
|
84
|
+
*
|
|
85
|
+
* Returns an empty array on missing file, malformed JSON, or absent
|
|
86
|
+
* `plugins.installs` — heartbeat callers don't want to crash on partial
|
|
87
|
+
* config. Prefers `resolvedVersion` (the post-install actual version)
|
|
88
|
+
* over `version` (the requested spec) when both are present.
|
|
89
|
+
*/
|
|
90
|
+
export async function listInstalledPluginsFromConfig() {
|
|
91
|
+
const configPath = path.join(config.stateDir, 'openclaw.json');
|
|
92
|
+
let raw;
|
|
93
|
+
try {
|
|
94
|
+
raw = await fs.readFile(configPath, 'utf-8');
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
let parsed;
|
|
100
|
+
try {
|
|
101
|
+
parsed = JSON.parse(raw);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
const plugins = parsed?.plugins;
|
|
107
|
+
if (!plugins || typeof plugins !== 'object')
|
|
108
|
+
return [];
|
|
109
|
+
const installs = plugins.installs;
|
|
110
|
+
if (!installs || typeof installs !== 'object')
|
|
111
|
+
return [];
|
|
112
|
+
const out = [];
|
|
113
|
+
for (const [id, value] of Object.entries(installs)) {
|
|
114
|
+
if (!id || !value || typeof value !== 'object')
|
|
115
|
+
continue;
|
|
116
|
+
const v = value;
|
|
117
|
+
const version = typeof v.resolvedVersion === 'string' && v.resolvedVersion.length > 0
|
|
118
|
+
? v.resolvedVersion
|
|
119
|
+
: typeof v.version === 'string' && v.version.length > 0
|
|
120
|
+
? v.version
|
|
121
|
+
: null;
|
|
122
|
+
if (!version)
|
|
123
|
+
continue;
|
|
124
|
+
out.push({ id, version });
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
67
128
|
/**
|
|
68
129
|
* Reads the installed plugin list via `openclaw plugins list --json`.
|
|
69
130
|
* Throws on exec failure or malformed JSON, including a stdout snippet so
|
|
70
131
|
* operators can debug from the agent log.
|
|
132
|
+
*
|
|
133
|
+
* 60-second timeout: the CLI has been observed to take 30s+ on cold
|
|
134
|
+
* boot when openclaw warms up its plugin scanner, and a tighter cap
|
|
135
|
+
* caused spurious failures from the heartbeat / installPlugins paths.
|
|
71
136
|
*/
|
|
72
137
|
export async function listInstalledPlugins() {
|
|
73
138
|
let stdout;
|
|
74
139
|
try {
|
|
75
|
-
stdout = await execAsync('openclaw plugins list --json',
|
|
140
|
+
stdout = await execAsync('openclaw plugins list --json', 60_000);
|
|
76
141
|
}
|
|
77
142
|
catch (err) {
|
|
78
|
-
const msg =
|
|
143
|
+
const msg = toErrorMessage(err);
|
|
79
144
|
throw new Error(`openclaw plugins list --json failed: ${msg}`);
|
|
80
145
|
}
|
|
81
146
|
let parsed;
|
|
@@ -83,7 +148,7 @@ export async function listInstalledPlugins() {
|
|
|
83
148
|
parsed = JSON.parse(stdout);
|
|
84
149
|
}
|
|
85
150
|
catch (err) {
|
|
86
|
-
const msg =
|
|
151
|
+
const msg = toErrorMessage(err);
|
|
87
152
|
throw new Error(`openclaw plugins list --json returned invalid JSON (${msg}): ${stdout.slice(0, 200)}`);
|
|
88
153
|
}
|
|
89
154
|
// Accept either a top-level array or { plugins: [...] }
|
|
@@ -114,6 +179,12 @@ export async function listInstalledPlugins() {
|
|
|
114
179
|
/**
|
|
115
180
|
* Install a specific openclaw runtime version globally.
|
|
116
181
|
* Skip-fast when `openclaw --version` already matches.
|
|
182
|
+
*
|
|
183
|
+
* `--force` is required: a previous install often leaves the
|
|
184
|
+
* `/usr/local/bin/openclaw` symlink owned by a different user (or
|
|
185
|
+
* untracked by the new package metadata), which makes a plain
|
|
186
|
+
* `npm install -g openclaw@<v>` fail with `EEXIST: file already exists`.
|
|
187
|
+
* The flag tells npm to overwrite the existing link instead of bailing.
|
|
117
188
|
*/
|
|
118
189
|
export async function installOpenclaw(version) {
|
|
119
190
|
let current = null;
|
|
@@ -126,7 +197,7 @@ export async function installOpenclaw(version) {
|
|
|
126
197
|
if (current === version) {
|
|
127
198
|
return false;
|
|
128
199
|
}
|
|
129
|
-
await withEaccesRetry(() => execAsync(`npm install -g ${OPENCLAW_PACKAGE}@${version}`, 120_000), `npm install -g ${OPENCLAW_PACKAGE}@${version}`);
|
|
200
|
+
await withEaccesRetry(() => execAsync(`npm install -g ${OPENCLAW_PACKAGE}@${version} --force`, 120_000), `npm install -g ${OPENCLAW_PACKAGE}@${version}`);
|
|
130
201
|
return true;
|
|
131
202
|
}
|
|
132
203
|
/**
|
|
@@ -144,9 +215,20 @@ export async function installPlugin(id, version, alreadyInstalled) {
|
|
|
144
215
|
return true;
|
|
145
216
|
}
|
|
146
217
|
/**
|
|
147
|
-
* Install several plugins sequentially. One
|
|
148
|
-
* is shared across the whole loop;
|
|
149
|
-
* not abort the rest of the
|
|
218
|
+
* Install several plugins sequentially. One inventory probe via
|
|
219
|
+
* `openclaw plugins list --json` is shared across the whole loop;
|
|
220
|
+
* per-plugin failures are recorded but do not abort the rest of the
|
|
221
|
+
* batch (poison-pill protection).
|
|
222
|
+
*
|
|
223
|
+
* Why CLI not config-file: the config file's `plugins.installs` block
|
|
224
|
+
* is incomplete in practice (bundled / compat-discovered plugins are
|
|
225
|
+
* absent, and openclaw itself sometimes rewrites the file without
|
|
226
|
+
* preserving installs), so a config-driven skip-cache under-reports
|
|
227
|
+
* what's actually loaded and forces every install to re-run with
|
|
228
|
+
* `--force`. The CLI is the source of truth.
|
|
229
|
+
*
|
|
230
|
+
* If the CLI throws we still try every install — the per-plugin
|
|
231
|
+
* `installPlugin --force` will overwrite cleanly.
|
|
150
232
|
*/
|
|
151
233
|
export async function installPlugins(plugins) {
|
|
152
234
|
const result = { installed: [], skipped: [], failed: [] };
|
|
@@ -157,10 +239,7 @@ export async function installPlugins(plugins) {
|
|
|
157
239
|
inventory = await listInstalledPlugins();
|
|
158
240
|
}
|
|
159
241
|
catch (err) {
|
|
160
|
-
|
|
161
|
-
// own --force will overwrite. Record the read failure as the first
|
|
162
|
-
// diagnostic context but don't abort.
|
|
163
|
-
console.warn('listInstalledPlugins failed; proceeding without skip-cache:', err instanceof Error ? err.message : err);
|
|
242
|
+
console.warn('listInstalledPlugins failed; proceeding without skip-cache:', toErrorMessage(err));
|
|
164
243
|
}
|
|
165
244
|
for (const p of plugins) {
|
|
166
245
|
if (!p || typeof p.id !== 'string' || typeof p.version !== 'string' || !p.id || !p.version) {
|
|
@@ -175,7 +254,7 @@ export async function installPlugins(plugins) {
|
|
|
175
254
|
result.skipped.push(p.id);
|
|
176
255
|
}
|
|
177
256
|
catch (err) {
|
|
178
|
-
const msg =
|
|
257
|
+
const msg = toErrorMessage(err);
|
|
179
258
|
result.failed.push({ id: p.id, error: msg });
|
|
180
259
|
}
|
|
181
260
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openclaw-ops.js","sourceRoot":"","sources":["../../src/utils/openclaw-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"openclaw-ops.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,CAAC,EAAE,CAAC,CAAC;;gBACtC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACjC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;YAChC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe,EAAE,cAAsB;IACzE,IAAI,cAAc,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IAC7C,MAAM,eAAe,CACnB,GAAG,EAAE,CAAC,SAAS,CAAC,kBAAkB,UAAU,IAAI,OAAO,EAAE,EAAE,OAAO,CAAC,EACnE,kBAAkB,UAAU,IAAI,OAAO,EAAE,CAC1C,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type InstallPluginsResult } from './openclaw-ops.js';
|
|
2
|
+
export interface OpenclawStackUpdateOptions {
|
|
3
|
+
/** openclaw runtime version to install. Omit to only touch plugins. */
|
|
4
|
+
version?: string;
|
|
5
|
+
plugins?: Array<{
|
|
6
|
+
id: string;
|
|
7
|
+
version: string;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Prefix for the emitted logCollector events (`self_update`, `agent_update`,
|
|
11
|
+
* `agent_update_cli`). Kept per-caller so backend log queries can still tell
|
|
12
|
+
* a self-update apart from an agent-update.
|
|
13
|
+
*/
|
|
14
|
+
eventPrefix: string;
|
|
15
|
+
/** Extra fields merged into every emitted event (e.g. `{ commandId }`). */
|
|
16
|
+
meta?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export interface OpenclawStackUpdateResult {
|
|
19
|
+
runtimeChanged: boolean;
|
|
20
|
+
pluginSummary?: InstallPluginsResult;
|
|
21
|
+
/** True only when a restart was attempted AND succeeded. */
|
|
22
|
+
gatewayRestarted: boolean;
|
|
23
|
+
/** Set when a restart was attempted and failed (best-effort — not fatal). */
|
|
24
|
+
restartError?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Throws whatever `installOpenclaw` / `installPlugins` throw — per-plugin
|
|
28
|
+
* failures are reported inside `pluginSummary`, not raised. A failed gateway
|
|
29
|
+
* restart is never thrown: the install already landed, so it is a warning.
|
|
30
|
+
*/
|
|
31
|
+
export declare function runOpenclawStackUpdate(opts: OpenclawStackUpdateOptions): Promise<OpenclawStackUpdateResult>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { installOpenclaw, installPlugins } from './openclaw-ops.js';
|
|
2
|
+
import { restartGateway } from './gateway-restart.js';
|
|
3
|
+
import { logCollector } from '../connection.js';
|
|
4
|
+
import { toErrorMessage } from './response.js';
|
|
5
|
+
/**
|
|
6
|
+
* Throws whatever `installOpenclaw` / `installPlugins` throw — per-plugin
|
|
7
|
+
* failures are reported inside `pluginSummary`, not raised. A failed gateway
|
|
8
|
+
* restart is never thrown: the install already landed, so it is a warning.
|
|
9
|
+
*/
|
|
10
|
+
export async function runOpenclawStackUpdate(opts) {
|
|
11
|
+
const { version, plugins, eventPrefix, meta = {} } = opts;
|
|
12
|
+
const push = (event, level, msg, data = {}) => {
|
|
13
|
+
logCollector?.push(`${eventPrefix}_${event}`, level, msg, { ...meta, ...data });
|
|
14
|
+
};
|
|
15
|
+
let runtimeChanged = false;
|
|
16
|
+
if (version) {
|
|
17
|
+
runtimeChanged = await installOpenclaw(version);
|
|
18
|
+
push(runtimeChanged ? 'runtime_installed' : 'runtime_skipped', 'info', runtimeChanged
|
|
19
|
+
? `openclaw runtime installed at ${version}`
|
|
20
|
+
: `openclaw runtime already at ${version}`, { version });
|
|
21
|
+
}
|
|
22
|
+
let pluginSummary;
|
|
23
|
+
if (plugins?.length) {
|
|
24
|
+
push('plugin_install_start', 'info', `Installing ${plugins.length} plugin(s)`, {
|
|
25
|
+
pluginCount: plugins.length,
|
|
26
|
+
});
|
|
27
|
+
pluginSummary = await installPlugins(plugins);
|
|
28
|
+
push('plugin_install_done', pluginSummary.failed.length > 0 ? 'warn' : 'info', `Plugin install complete: ${pluginSummary.installed.length} installed, ` +
|
|
29
|
+
`${pluginSummary.skipped.length} skipped, ${pluginSummary.failed.length} failed`, {
|
|
30
|
+
installed: pluginSummary.installed,
|
|
31
|
+
skipped: pluginSummary.skipped,
|
|
32
|
+
failed: pluginSummary.failed,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// One restart per invocation, no matter how many things changed.
|
|
36
|
+
const anyChanged = runtimeChanged || (pluginSummary?.installed.length ?? 0) > 0;
|
|
37
|
+
if (!anyChanged)
|
|
38
|
+
return { runtimeChanged, pluginSummary, gatewayRestarted: false };
|
|
39
|
+
try {
|
|
40
|
+
await restartGateway();
|
|
41
|
+
push('gateway_restarted', 'info', 'Gateway restarted after openclaw stack update');
|
|
42
|
+
return { runtimeChanged, pluginSummary, gatewayRestarted: true };
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
const error = toErrorMessage(err);
|
|
46
|
+
push('gateway_restart_failed', 'warn', `Gateway restart after openclaw stack update failed: ${error}`, { error });
|
|
47
|
+
return { runtimeChanged, pluginSummary, gatewayRestarted: false, restartError: error };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=openclaw-stack-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openclaw-stack-update.js","sourceRoot":"","sources":["../../src/utils/openclaw-stack-update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAA6B,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,s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,MAAM,CAAC,CAAC,CAAC,MAAM,EACjD,4BAA4B,aAAa,CAAC,SAAS,CAAC,MAAM,cAAc;YACtE,GAAG,aAAa,CAAC,OAAO,CAAC,MAAM,aAAa,aAAa,CAAC,MAAM,CAAC,MAAM,SAAS,EAClF;YACE,SAAS,EAAE,aAAa,CAAC,SAAS;YAClC,OAAO,EAAE,aAAa,CAAC,OAAO;YAC9B,MAAM,EAAE,aAAa,CAAC,MAAM;SAC7B,CACF,CAAC;IACJ,CAAC;IAED,iEAAiE;IACjE,MAAM,UAAU,GAAG,cAAc,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAChF,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;IAEnF,IAAI,CAAC;QACH,MAAM,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC,mBAAmB,EAAE,MAAM,EAAE,+CAA+C,CAAC,CAAC;QACnF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;IACnE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CACF,wBAAwB,EACxB,MAAM,EACN,uDAAuD,KAAK,EAAE,EAC9D,EAAE,KAAK,EAAE,CACV,CAAC;QACF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IACzF,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execAsync } from './exec.js';
|
|
2
2
|
import { toErrorMessage } from './response.js';
|
|
3
3
|
// ---------------------------------------------------------------------------
|
|
4
4
|
// Shared package-install module — used by:
|
|
@@ -30,16 +30,6 @@ export function buildInstallCommand(manager, pkg) {
|
|
|
30
30
|
return `pip install ${pkg}`;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
function execPackage(cmd, timeoutMs) {
|
|
34
|
-
return new Promise((resolve, reject) => {
|
|
35
|
-
exec(cmd, { timeout: timeoutMs }, (error) => {
|
|
36
|
-
if (error)
|
|
37
|
-
reject(error);
|
|
38
|
-
else
|
|
39
|
-
resolve();
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
33
|
/**
|
|
44
34
|
* Install a single package via the named manager. Validates the package
|
|
45
35
|
* name against the allowlist regex first; never reaches the shell with an
|
|
@@ -50,7 +40,9 @@ export async function installOnePackage(manager, pkg, timeoutMs = INSTALL_TIMEOU
|
|
|
50
40
|
return { ok: false, error: 'Invalid package name: contains disallowed characters' };
|
|
51
41
|
}
|
|
52
42
|
try {
|
|
53
|
-
|
|
43
|
+
// execAsync, not a local wrapper: its 16MB maxBuffer is what keeps a
|
|
44
|
+
// chatty `npm install -g` from failing with ERR_CHILD_PROCESS_STDOUT_MAXBUFFER.
|
|
45
|
+
await execAsync(buildInstallCommand(manager, pkg), timeoutMs);
|
|
54
46
|
return { ok: true };
|
|
55
47
|
}
|
|
56
48
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-install.js","sourceRoot":"","sources":["../../src/utils/package-install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"package-install.js","sourceRoot":"","sources":["../../src/utils/package-install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,8EAA8E;AAC9E,2CAA2C;AAC3C,oDAAoD;AACpD,gDAAgD;AAChD,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,sEAAsE;AACtE,iEAAiE;AACjE,8EAA8E;AAE9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC,CAAC,kBAAkB;AAE7D;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,iCAAiC,CAAC;AAI/D,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAuB,EAAE,GAAW;IACtE,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,KAAK;YACR,OAAO,sBAAsB,GAAG,EAAE,CAAC;QACrC,KAAK,KAAK;YACR,OAAO,kBAAkB,GAAG,EAAE,CAAC;QACjC,KAAK,KAAK;YACR,OAAO,eAAe,GAAG,EAAE,CAAC;IAChC,CAAC;AACH,CAAC;AAOD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAuB,EACvB,GAAW,EACX,YAAoB,kBAAkB;IAEtC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,sDAAsD,EAAE,CAAC;IACtF,CAAC;IACD,IAAI,CAAC;QACH,qEAAqE;QACrE,gFAAgF;QAChF,MAAM,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;QAC9D,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;IACnD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version from the package's own package.json.
|
|
3
|
+
*
|
|
4
|
+
* Read via `createRequire` rather than a JSON import so the compiled output
|
|
5
|
+
* stays plain ESM. The relative depth (`../..`) is correct from both
|
|
6
|
+
* `dist/utils/` and `src/utils/` — three call sites used to hand-roll this with
|
|
7
|
+
* three different depths, which is exactly the kind of thing that breaks
|
|
8
|
+
* silently when a file moves.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getPackageVersion(): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
const _require = createRequire(import.meta.url);
|
|
5
|
+
/**
|
|
6
|
+
* Version from the package's own package.json.
|
|
7
|
+
*
|
|
8
|
+
* Read via `createRequire` rather than a JSON import so the compiled output
|
|
9
|
+
* stays plain ESM. The relative depth (`../..`) is correct from both
|
|
10
|
+
* `dist/utils/` and `src/utils/` — three call sites used to hand-roll this with
|
|
11
|
+
* three different depths, which is exactly the kind of thing that breaks
|
|
12
|
+
* silently when a file moves.
|
|
13
|
+
*/
|
|
14
|
+
export function getPackageVersion() {
|
|
15
|
+
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), '../../package.json');
|
|
16
|
+
return _require(pkgPath).version;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=package-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-version.js","sourceRoot":"","sources":["../../src/utils/package-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC;IACpF,OAAQ,QAAQ,CAAC,OAAO,CAAyB,CAAC,OAAO,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split a CLI token like `@scope/pkg@1.2.3` into `{ id, version }`, or null if
|
|
3
|
+
* it isn't one. Splits at the LAST `@` so scoped npm names survive, and rejects
|
|
4
|
+
* a leading `@` so a bare `@scope/name` (no version) doesn't parse as
|
|
5
|
+
* `{ id: '', version: 'scope/name' }`.
|
|
6
|
+
*
|
|
7
|
+
* Shared by the `plugin-update` and `agent-update` CLIs, which each had their
|
|
8
|
+
* own byte-identical copy. Kept out of openclaw-ops.ts on purpose: this is a
|
|
9
|
+
* pure parser, and openclaw-ops is the module every test mocks wholesale
|
|
10
|
+
* because it shells out.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseIdAtVersion(token: string): {
|
|
13
|
+
id: string;
|
|
14
|
+
version: string;
|
|
15
|
+
} | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split a CLI token like `@scope/pkg@1.2.3` into `{ id, version }`, or null if
|
|
3
|
+
* it isn't one. Splits at the LAST `@` so scoped npm names survive, and rejects
|
|
4
|
+
* a leading `@` so a bare `@scope/name` (no version) doesn't parse as
|
|
5
|
+
* `{ id: '', version: 'scope/name' }`.
|
|
6
|
+
*
|
|
7
|
+
* Shared by the `plugin-update` and `agent-update` CLIs, which each had their
|
|
8
|
+
* own byte-identical copy. Kept out of openclaw-ops.ts on purpose: this is a
|
|
9
|
+
* pure parser, and openclaw-ops is the module every test mocks wholesale
|
|
10
|
+
* because it shells out.
|
|
11
|
+
*/
|
|
12
|
+
export function parseIdAtVersion(token) {
|
|
13
|
+
const at = token.lastIndexOf('@');
|
|
14
|
+
if (at <= 0)
|
|
15
|
+
return null;
|
|
16
|
+
const id = token.slice(0, at).trim();
|
|
17
|
+
const version = token.slice(at + 1).trim();
|
|
18
|
+
if (!id || !version)
|
|
19
|
+
return null;
|
|
20
|
+
return { id, version };
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=parse-id-at-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-id-at-version.js","sourceRoot":"","sources":["../../src/utils/parse-id-at-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,EAAE,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AACzB,CAAC"}
|