@parall/openclaw-agent 1.28.0 → 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.
Files changed (3) hide show
  1. package/dist/index.js +24 -14
  2. package/package.json +1 -1
  3. package/src/index.ts +26 -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
- console.log(`Installing Parall plugin from ${pluginArchive}...`);
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
- console.error(`ERROR: Failed to install Parall plugin: ${String(err)}`);
63
+ log.error(`Failed to install Parall plugin: ${String(err)}`);
58
64
  process.exit(1);
59
65
  }
60
66
  }
61
67
  else {
62
- console.warn(`Plugin archive not found at ${pluginArchive} — assuming plugin is already installed.`);
68
+ log.warn(`Plugin archive not found at ${pluginArchive} — assuming plugin is already installed.`);
63
69
  }
64
70
  // ---------------------------------------------------------------------------
65
71
  // 4. Write openclaw.json
@@ -152,6 +158,8 @@ async function preseedPlatformConfig() {
152
158
  cfg = JSON.parse(fs.readFileSync(configPath, "utf8"));
153
159
  }
154
160
  catch { /* fresh */ }
161
+ // Keep in sync with deploy/openclaw-docker/entrypoint.sh and
162
+ // ts/openclaw-channel/src/config-manager.ts.
155
163
  const ALLOWED_DEFAULTS = new Set(["model", "compaction", "memorySearch"]);
156
164
  const platformDefaults = pc.agents?.defaults;
157
165
  if (platformDefaults && typeof platformDefaults === "object") {
@@ -164,6 +172,8 @@ async function preseedPlatformConfig() {
164
172
  agents.defaults = existing;
165
173
  cfg.agents = agents;
166
174
  }
175
+ // Keep in sync with deploy/openclaw-docker/entrypoint.sh and
176
+ // ts/openclaw-channel/src/config-manager.ts.
167
177
  const ALLOWED_MODEL_KEYS = new Set(["id", "name", "contextWindow", "maxTokens"]);
168
178
  const platformModels = pc.models?.providers;
169
179
  const platformParall = platformModels?.parall;
@@ -193,10 +203,10 @@ async function preseedPlatformConfig() {
193
203
  fs.writeFileSync(tmp, JSON.stringify(cfg, null, 2));
194
204
  fs.renameSync(tmp, configPath);
195
205
  const model = cfg.agents?.defaults?.model ?? "none";
196
- console.log(`Platform config pre-seeded (model: ${String(model)}).`);
206
+ log.info(`Platform config pre-seeded (model: ${String(model)}).`);
197
207
  }
198
208
  catch (err) {
199
- console.warn(`Platform config pre-seed skipped: ${String(err)}`);
209
+ log.warn(`Platform config pre-seed skipped: ${String(err)}`);
200
210
  }
201
211
  }
202
212
  // ---------------------------------------------------------------------------
@@ -213,7 +223,7 @@ catch { /* non-fatal */ }
213
223
  // ---------------------------------------------------------------------------
214
224
  // 7. Spawn openclaw gateway run with signal forwarding
215
225
  // ---------------------------------------------------------------------------
216
- console.log("Starting OpenClaw gateway...");
226
+ log.info("Starting OpenClaw gateway...");
217
227
  const workspaceDir = process.env.PRLL_OPENCLAW_WORKSPACE_DIR?.trim() || "";
218
228
  const gatewayEnv = {
219
229
  ...process.env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/openclaw-agent",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "description": "OpenClaw bootstrap wrapper for daemon-mode Parall agents — sets up per-agent OpenClaw state and execs openclaw gateway run",
5
5
  "license": "MIT",
6
6
  "repository": {
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
- console.log(`Installing Parall plugin from ${pluginArchive}...`);
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
- console.error(`ERROR: Failed to install Parall plugin: ${String(err)}`);
75
+ log.error(`Failed to install Parall plugin: ${String(err)}`);
69
76
  process.exit(1);
70
77
  }
71
78
  } else {
72
- console.warn(
79
+ log.warn(
73
80
  `Plugin archive not found at ${pluginArchive} — assuming plugin is already installed.`,
74
81
  );
75
82
  }
@@ -172,6 +179,8 @@ async function preseedPlatformConfig(): Promise<void> {
172
179
  let cfg: Record<string, unknown> = {};
173
180
  try { cfg = JSON.parse(fs.readFileSync(configPath, "utf8")) as Record<string, unknown>; } catch { /* fresh */ }
174
181
 
182
+ // Keep in sync with deploy/openclaw-docker/entrypoint.sh and
183
+ // ts/openclaw-channel/src/config-manager.ts.
175
184
  const ALLOWED_DEFAULTS = new Set(["model", "compaction", "memorySearch"]);
176
185
  const platformDefaults = (pc.agents as Record<string, unknown> | undefined)?.defaults;
177
186
  if (platformDefaults && typeof platformDefaults === "object") {
@@ -184,6 +193,8 @@ async function preseedPlatformConfig(): Promise<void> {
184
193
  cfg.agents = agents;
185
194
  }
186
195
 
196
+ // Keep in sync with deploy/openclaw-docker/entrypoint.sh and
197
+ // ts/openclaw-channel/src/config-manager.ts.
187
198
  const ALLOWED_MODEL_KEYS = new Set(["id", "name", "contextWindow", "maxTokens"]);
188
199
  const platformModels = (pc.models as Record<string, unknown> | undefined)?.providers as Record<string, unknown> | undefined;
189
200
  const platformParall = platformModels?.parall;
@@ -213,9 +224,9 @@ async function preseedPlatformConfig(): Promise<void> {
213
224
  fs.writeFileSync(tmp, JSON.stringify(cfg, null, 2));
214
225
  fs.renameSync(tmp, configPath);
215
226
  const model = ((cfg.agents as Record<string, unknown> | undefined)?.defaults as Record<string, unknown> | undefined)?.model ?? "none";
216
- console.log(`Platform config pre-seeded (model: ${String(model)}).`);
227
+ log.info(`Platform config pre-seeded (model: ${String(model)}).`);
217
228
  } catch (err) {
218
- console.warn(`Platform config pre-seed skipped: ${String(err)}`);
229
+ log.warn(`Platform config pre-seed skipped: ${String(err)}`);
219
230
  }
220
231
  }
221
232
 
@@ -236,7 +247,7 @@ try {
236
247
 
237
248
  // ---------------------------------------------------------------------------
238
249
 
239
- console.log("Starting OpenClaw gateway...");
250
+ log.info("Starting OpenClaw gateway...");
240
251
 
241
252
  const workspaceDir = process.env.PRLL_OPENCLAW_WORKSPACE_DIR?.trim() || "";
242
253