@susu-eng/gralkor 26.0.8 → 26.0.9
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.
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
export interface ExecResult {
|
|
2
|
-
stdout: string;
|
|
3
|
-
stderr: string;
|
|
4
|
-
exitCode: number;
|
|
5
|
-
}
|
|
6
1
|
export interface PluginInfo {
|
|
7
2
|
id: string;
|
|
8
3
|
version: string | null;
|
|
@@ -13,13 +8,6 @@ export declare function checkOpenclaw(): Promise<string>;
|
|
|
13
8
|
export declare function parsePluginList(stdout: string): PluginInfo[];
|
|
14
9
|
export declare function getInstalledPlugins(): Promise<PluginInfo[]>;
|
|
15
10
|
export declare function getPluginInfo(pluginId: string): Promise<PluginInfo | null>;
|
|
16
|
-
/**
|
|
17
|
-
* Check if openclaw output contains only config warnings (no real errors).
|
|
18
|
-
* openclaw plugins install exits non-zero for stale config references
|
|
19
|
-
* (e.g. plugins.allow referencing a not-yet-installed plugin).
|
|
20
|
-
* These are harmless — the install succeeded despite the exit code.
|
|
21
|
-
*/
|
|
22
|
-
export declare function isConfigWarningOnly(output: string): boolean;
|
|
23
11
|
export declare function installPlugin(source: string): Promise<void>;
|
|
24
12
|
export declare function uninstallPlugin(pluginId: string): Promise<void>;
|
|
25
13
|
export declare function setConfig(key: string, value: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openclaw.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/openclaw.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,UAAU;IACzB,
|
|
1
|
+
{"version":3,"file":"openclaw.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/openclaw.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB;AASD,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAErD;AAED,wEAAwE;AACxE,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,CAiB5D;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAEjE;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAGhF;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAErE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAOnE"}
|
package/dist/cli/lib/openclaw.js
CHANGED
|
@@ -1,37 +1,14 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
3
|
const execFileAsync = promisify(execFile);
|
|
4
|
-
async function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return { stdout, stderr, exitCode: 0 };
|
|
10
|
-
}
|
|
11
|
-
catch (err) {
|
|
12
|
-
if (isExecError(err)) {
|
|
13
|
-
const stdout = err.stdout ?? "";
|
|
14
|
-
const stderr = err.stderr ?? "";
|
|
15
|
-
const exitCode = err.code ?? 1;
|
|
16
|
-
// openclaw exits non-zero for stale config warnings (e.g. plugins.allow
|
|
17
|
-
// referencing a not-yet-installed plugin). These are harmless — treat as success.
|
|
18
|
-
if (isConfigWarningOnly(stderr || stdout)) {
|
|
19
|
-
return { stdout, stderr, exitCode: 0 };
|
|
20
|
-
}
|
|
21
|
-
return { stdout, stderr, exitCode };
|
|
22
|
-
}
|
|
23
|
-
throw new Error("openclaw not found on PATH. Install: https://docs.openclaw.ai/install");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function isExecError(err) {
|
|
27
|
-
return err instanceof Error && "code" in err;
|
|
4
|
+
async function openclaw(...args) {
|
|
5
|
+
const { stdout } = await execFileAsync("openclaw", args, {
|
|
6
|
+
timeout: 30_000,
|
|
7
|
+
});
|
|
8
|
+
return stdout;
|
|
28
9
|
}
|
|
29
10
|
export async function checkOpenclaw() {
|
|
30
|
-
|
|
31
|
-
if (result.exitCode !== 0) {
|
|
32
|
-
throw new Error("openclaw returned non-zero exit code");
|
|
33
|
-
}
|
|
34
|
-
return result.stdout.trim();
|
|
11
|
+
return (await openclaw("--version")).trim();
|
|
35
12
|
}
|
|
36
13
|
/** Parse `openclaw plugins list` output into structured plugin info. */
|
|
37
14
|
export function parsePluginList(stdout) {
|
|
@@ -53,51 +30,28 @@ export function parsePluginList(stdout) {
|
|
|
53
30
|
return plugins;
|
|
54
31
|
}
|
|
55
32
|
export async function getInstalledPlugins() {
|
|
56
|
-
|
|
57
|
-
if (result.exitCode !== 0) {
|
|
58
|
-
throw new Error(`Failed to list plugins: ${result.stderr}`);
|
|
59
|
-
}
|
|
60
|
-
return parsePluginList(result.stdout);
|
|
33
|
+
return parsePluginList(await openclaw("plugins", "list"));
|
|
61
34
|
}
|
|
62
35
|
export async function getPluginInfo(pluginId) {
|
|
63
36
|
const plugins = await getInstalledPlugins();
|
|
64
37
|
return plugins.find((p) => p.id === pluginId) ?? null;
|
|
65
38
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Check if openclaw output contains only config warnings (no real errors).
|
|
68
|
-
* openclaw plugins install exits non-zero for stale config references
|
|
69
|
-
* (e.g. plugins.allow referencing a not-yet-installed plugin).
|
|
70
|
-
* These are harmless — the install succeeded despite the exit code.
|
|
71
|
-
*/
|
|
72
|
-
export function isConfigWarningOnly(output) {
|
|
73
|
-
return output.includes("Config warnings:") &&
|
|
74
|
-
!output.includes("ENOENT") &&
|
|
75
|
-
!output.includes("npm error") &&
|
|
76
|
-
!output.includes("404");
|
|
77
|
-
}
|
|
78
39
|
export async function installPlugin(source) {
|
|
79
|
-
|
|
80
|
-
if (result.exitCode !== 0) {
|
|
81
|
-
throw new Error(`Install failed: ${result.stderr || result.stdout}`);
|
|
82
|
-
}
|
|
40
|
+
await openclaw("plugins", "install", source);
|
|
83
41
|
}
|
|
84
42
|
export async function uninstallPlugin(pluginId) {
|
|
85
|
-
|
|
86
|
-
if (result.exitCode !== 0) {
|
|
87
|
-
throw new Error(`Uninstall failed: ${result.stderr || result.stdout}`);
|
|
88
|
-
}
|
|
43
|
+
await openclaw("plugins", "uninstall", pluginId);
|
|
89
44
|
}
|
|
90
45
|
export async function setConfig(key, value) {
|
|
91
|
-
|
|
92
|
-
if (result.exitCode !== 0) {
|
|
93
|
-
throw new Error(`Config set failed: ${result.stderr || result.stdout}`);
|
|
94
|
-
}
|
|
46
|
+
await openclaw("config", "set", key, value);
|
|
95
47
|
}
|
|
96
48
|
export async function getConfig(key) {
|
|
97
|
-
|
|
98
|
-
|
|
49
|
+
try {
|
|
50
|
+
const val = (await openclaw("config", "get", key)).trim();
|
|
51
|
+
return val || null;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
99
54
|
return null;
|
|
100
|
-
|
|
101
|
-
return val || null;
|
|
55
|
+
}
|
|
102
56
|
}
|
|
103
57
|
//# sourceMappingURL=openclaw.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openclaw.js","sourceRoot":"","sources":["../../../src/cli/lib/openclaw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3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