@parall/openclaw-agent 1.28.1 → 1.29.0
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/index.js +20 -14
- package/package.json +1 -1
- package/src/index.ts +22 -15
package/dist/index.js
CHANGED
|
@@ -10,6 +10,20 @@ import * as path from "node:path";
|
|
|
10
10
|
// ---------------------------------------------------------------------------
|
|
11
11
|
// 1. Read + validate ENV
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
|
+
function ts() { return new Date().toISOString(); }
|
|
14
|
+
const log = {
|
|
15
|
+
info: (msg) => console.log(`${ts()} [openclaw-agent] ${msg}`),
|
|
16
|
+
warn: (msg) => console.warn(`${ts()} [openclaw-agent] ${msg}`),
|
|
17
|
+
error: (msg) => console.error(`${ts()} [openclaw-agent] ${msg}`),
|
|
18
|
+
};
|
|
19
|
+
function env(name) {
|
|
20
|
+
const v = process.env[name]?.trim();
|
|
21
|
+
if (!v) {
|
|
22
|
+
log.error(`Missing required environment variable: ${name}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
return v;
|
|
26
|
+
}
|
|
13
27
|
const PRLL_API_URL = env("PRLL_API_URL");
|
|
14
28
|
const PRLL_API_KEY = env("PRLL_API_KEY");
|
|
15
29
|
const PRLL_ORG_ID = env("PRLL_ORG_ID");
|
|
@@ -19,14 +33,6 @@ const PRLL_SWIMLANE_NAME = process.env.PRLL_SWIMLANE_NAME?.trim() || "";
|
|
|
19
33
|
const gatewayPort = process.env.OPENCLAW_GATEWAY_PORT?.trim() || "0";
|
|
20
34
|
const pluginArchive = process.env.PRLL_OPENCLAW_PLUGIN_ARCHIVE?.trim()
|
|
21
35
|
|| "/opt/parall-plugin/parall-plugin.tgz";
|
|
22
|
-
function env(name) {
|
|
23
|
-
const v = process.env[name]?.trim();
|
|
24
|
-
if (!v) {
|
|
25
|
-
console.error(`ERROR: Missing required environment variable: ${name}`);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
return v;
|
|
29
|
-
}
|
|
30
36
|
// ---------------------------------------------------------------------------
|
|
31
37
|
// 2. Create per-agent state directory
|
|
32
38
|
// ---------------------------------------------------------------------------
|
|
@@ -42,7 +48,7 @@ if (fs.existsSync(pluginArchive)) {
|
|
|
42
48
|
// to replace it — otherwise the existing install is the only copy).
|
|
43
49
|
const legacyExtDir = path.join(openclawStateDir, "extensions", "parall");
|
|
44
50
|
fs.rmSync(legacyExtDir, { recursive: true, force: true });
|
|
45
|
-
|
|
51
|
+
log.info(`Installing Parall plugin from ${pluginArchive}...`);
|
|
46
52
|
try {
|
|
47
53
|
execFileSync("openclaw", [
|
|
48
54
|
"plugins", "install", pluginArchive,
|
|
@@ -54,12 +60,12 @@ if (fs.existsSync(pluginArchive)) {
|
|
|
54
60
|
});
|
|
55
61
|
}
|
|
56
62
|
catch (err) {
|
|
57
|
-
|
|
63
|
+
log.error(`Failed to install Parall plugin: ${String(err)}`);
|
|
58
64
|
process.exit(1);
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
67
|
else {
|
|
62
|
-
|
|
68
|
+
log.warn(`Plugin archive not found at ${pluginArchive} — assuming plugin is already installed.`);
|
|
63
69
|
}
|
|
64
70
|
// ---------------------------------------------------------------------------
|
|
65
71
|
// 4. Write openclaw.json
|
|
@@ -197,10 +203,10 @@ async function preseedPlatformConfig() {
|
|
|
197
203
|
fs.writeFileSync(tmp, JSON.stringify(cfg, null, 2));
|
|
198
204
|
fs.renameSync(tmp, configPath);
|
|
199
205
|
const model = cfg.agents?.defaults?.model ?? "none";
|
|
200
|
-
|
|
206
|
+
log.info(`Platform config pre-seeded (model: ${String(model)}).`);
|
|
201
207
|
}
|
|
202
208
|
catch (err) {
|
|
203
|
-
|
|
209
|
+
log.warn(`Platform config pre-seed skipped: ${String(err)}`);
|
|
204
210
|
}
|
|
205
211
|
}
|
|
206
212
|
// ---------------------------------------------------------------------------
|
|
@@ -217,7 +223,7 @@ catch { /* non-fatal */ }
|
|
|
217
223
|
// ---------------------------------------------------------------------------
|
|
218
224
|
// 7. Spawn openclaw gateway run with signal forwarding
|
|
219
225
|
// ---------------------------------------------------------------------------
|
|
220
|
-
|
|
226
|
+
log.info("Starting OpenClaw gateway...");
|
|
221
227
|
const workspaceDir = process.env.PRLL_OPENCLAW_WORKSPACE_DIR?.trim() || "";
|
|
222
228
|
const gatewayEnv = {
|
|
223
229
|
...process.env,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -14,6 +14,22 @@ import * as path from "node:path";
|
|
|
14
14
|
// 1. Read + validate ENV
|
|
15
15
|
// ---------------------------------------------------------------------------
|
|
16
16
|
|
|
17
|
+
function ts(): string { return new Date().toISOString(); }
|
|
18
|
+
const log = {
|
|
19
|
+
info: (msg: string) => console.log(`${ts()} [openclaw-agent] ${msg}`),
|
|
20
|
+
warn: (msg: string) => console.warn(`${ts()} [openclaw-agent] ${msg}`),
|
|
21
|
+
error: (msg: string) => console.error(`${ts()} [openclaw-agent] ${msg}`),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function env(name: string): string {
|
|
25
|
+
const v = process.env[name]?.trim();
|
|
26
|
+
if (!v) {
|
|
27
|
+
log.error(`Missing required environment variable: ${name}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
return v;
|
|
31
|
+
}
|
|
32
|
+
|
|
17
33
|
const PRLL_API_URL = env("PRLL_API_URL");
|
|
18
34
|
const PRLL_API_KEY = env("PRLL_API_KEY");
|
|
19
35
|
const PRLL_ORG_ID = env("PRLL_ORG_ID");
|
|
@@ -25,15 +41,6 @@ const gatewayPort = process.env.OPENCLAW_GATEWAY_PORT?.trim() || "0";
|
|
|
25
41
|
const pluginArchive = process.env.PRLL_OPENCLAW_PLUGIN_ARCHIVE?.trim()
|
|
26
42
|
|| "/opt/parall-plugin/parall-plugin.tgz";
|
|
27
43
|
|
|
28
|
-
function env(name: string): string {
|
|
29
|
-
const v = process.env[name]?.trim();
|
|
30
|
-
if (!v) {
|
|
31
|
-
console.error(`ERROR: Missing required environment variable: ${name}`);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
return v;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
44
|
// ---------------------------------------------------------------------------
|
|
38
45
|
// 2. Create per-agent state directory
|
|
39
46
|
// ---------------------------------------------------------------------------
|
|
@@ -54,7 +61,7 @@ if (fs.existsSync(pluginArchive)) {
|
|
|
54
61
|
const legacyExtDir = path.join(openclawStateDir, "extensions", "parall");
|
|
55
62
|
fs.rmSync(legacyExtDir, { recursive: true, force: true });
|
|
56
63
|
|
|
57
|
-
|
|
64
|
+
log.info(`Installing Parall plugin from ${pluginArchive}...`);
|
|
58
65
|
try {
|
|
59
66
|
execFileSync("openclaw", [
|
|
60
67
|
"plugins", "install", pluginArchive,
|
|
@@ -65,11 +72,11 @@ if (fs.existsSync(pluginArchive)) {
|
|
|
65
72
|
timeout: 60_000,
|
|
66
73
|
});
|
|
67
74
|
} catch (err) {
|
|
68
|
-
|
|
75
|
+
log.error(`Failed to install Parall plugin: ${String(err)}`);
|
|
69
76
|
process.exit(1);
|
|
70
77
|
}
|
|
71
78
|
} else {
|
|
72
|
-
|
|
79
|
+
log.warn(
|
|
73
80
|
`Plugin archive not found at ${pluginArchive} — assuming plugin is already installed.`,
|
|
74
81
|
);
|
|
75
82
|
}
|
|
@@ -217,9 +224,9 @@ async function preseedPlatformConfig(): Promise<void> {
|
|
|
217
224
|
fs.writeFileSync(tmp, JSON.stringify(cfg, null, 2));
|
|
218
225
|
fs.renameSync(tmp, configPath);
|
|
219
226
|
const model = ((cfg.agents as Record<string, unknown> | undefined)?.defaults as Record<string, unknown> | undefined)?.model ?? "none";
|
|
220
|
-
|
|
227
|
+
log.info(`Platform config pre-seeded (model: ${String(model)}).`);
|
|
221
228
|
} catch (err) {
|
|
222
|
-
|
|
229
|
+
log.warn(`Platform config pre-seed skipped: ${String(err)}`);
|
|
223
230
|
}
|
|
224
231
|
}
|
|
225
232
|
|
|
@@ -240,7 +247,7 @@ try {
|
|
|
240
247
|
|
|
241
248
|
// ---------------------------------------------------------------------------
|
|
242
249
|
|
|
243
|
-
|
|
250
|
+
log.info("Starting OpenClaw gateway...");
|
|
244
251
|
|
|
245
252
|
const workspaceDir = process.env.PRLL_OPENCLAW_WORKSPACE_DIR?.trim() || "";
|
|
246
253
|
|