@parall/daemon 1.31.0 → 1.32.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/bundle/manifest.json +16 -11
- package/bundle/package.json +1 -0
- package/bundle/parall-claude-agent.js +27556 -339
- package/bundle/parall-codex-agent.js +27603 -372
- package/bundle/parall-daemon.js +30204 -1760
- package/bundle/parall-openclaw-agent.js +49 -24
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +83 -83
- package/dist/clip-runtime/clip-installer.d.ts +44 -0
- package/dist/clip-runtime/clip-installer.d.ts.map +1 -0
- package/dist/clip-runtime/clip-installer.js +501 -0
- package/dist/clip-runtime/clip-provider.d.ts +76 -0
- package/dist/clip-runtime/clip-provider.d.ts.map +1 -0
- package/dist/clip-runtime/clip-provider.js +402 -0
- package/dist/clip-runtime/index.d.ts +7 -0
- package/dist/clip-runtime/index.d.ts.map +1 -0
- package/dist/clip-runtime/index.js +5 -0
- package/dist/clip-runtime/ipc.d.ts +94 -0
- package/dist/clip-runtime/ipc.d.ts.map +1 -0
- package/dist/clip-runtime/ipc.js +98 -0
- package/dist/clip-runtime/manifest.d.ts +74 -0
- package/dist/clip-runtime/manifest.d.ts.map +1 -0
- package/dist/clip-runtime/manifest.js +181 -0
- package/dist/clip-runtime/process-manager.d.ts +57 -0
- package/dist/clip-runtime/process-manager.d.ts.map +1 -0
- package/dist/clip-runtime/process-manager.js +354 -0
- package/dist/clip-runtime/process.d.ts +59 -0
- package/dist/clip-runtime/process.d.ts.map +1 -0
- package/dist/clip-runtime/process.js +350 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +24 -24
- package/dist/filesystem.d.ts +1 -1
- package/dist/filesystem.d.ts.map +1 -1
- package/dist/filesystem.js +51 -53
- package/dist/index.js +20 -15
- package/dist/runtimes.d.ts +3 -2
- package/dist/runtimes.d.ts.map +1 -1
- package/dist/runtimes.js +24 -20
- package/dist/supervisor.d.ts +9 -4
- package/dist/supervisor.d.ts.map +1 -1
- package/dist/supervisor.js +244 -76
- package/dist/updater-manifest.d.ts +2 -0
- package/dist/updater-manifest.d.ts.map +1 -1
- package/dist/updater-manifest.js +6 -6
- package/dist/updater.d.ts +2 -2
- package/dist/updater.d.ts.map +1 -1
- package/dist/updater.js +55 -37
- package/dist/workspace.d.ts +2 -2
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +112 -112
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createLogger } from
|
|
3
|
-
import { ParallClient } from
|
|
4
|
-
import { resolveClaudeDaemonConfig, resolveBundleDir, resolveWsUrl } from
|
|
5
|
-
import { DaemonSupervisor, sleepCancellable } from
|
|
6
|
-
import { DaemonUpdater } from
|
|
7
|
-
import { runCLI } from
|
|
2
|
+
import { createLogger, createOtelLogger, initAgentTelemetry, } from '@parall/agent-core';
|
|
3
|
+
import { ParallClient } from '@parall/sdk';
|
|
4
|
+
import { resolveClaudeDaemonConfig, resolveBundleDir, resolveWsUrl, } from './config.js';
|
|
5
|
+
import { DaemonSupervisor, sleepCancellable } from './supervisor.js';
|
|
6
|
+
import { DaemonUpdater } from './updater.js';
|
|
7
|
+
import { runCLI } from './cli.js';
|
|
8
8
|
const UPDATE_EXIT_CODE = 42;
|
|
9
|
-
|
|
9
|
+
let log = createLogger('daemon');
|
|
10
10
|
function formatError(reason) {
|
|
11
11
|
if (reason instanceof Error) {
|
|
12
12
|
return reason.stack ?? reason.message;
|
|
@@ -58,7 +58,7 @@ async function runForever(config, client, log, signal, updater) {
|
|
|
58
58
|
log.warn(`supervisor.stop() after crash threw: ${String(stopErr)}`);
|
|
59
59
|
}
|
|
60
60
|
if (config.supervisorRestartBackoffMs === 0) {
|
|
61
|
-
log.error(
|
|
61
|
+
log.error('supervisor keepalive disabled (PRLL_DAEMON_SUPERVISOR_RESTART_BACKOFF_MS=0) — exiting');
|
|
62
62
|
throw err;
|
|
63
63
|
}
|
|
64
64
|
const delay = Math.min(config.supervisorRestartBackoffMs * Math.pow(2, attempt), config.supervisorRestartBackoffMaxMs);
|
|
@@ -72,6 +72,8 @@ async function runForever(config, client, log, signal, updater) {
|
|
|
72
72
|
}
|
|
73
73
|
async function main() {
|
|
74
74
|
const config = resolveClaudeDaemonConfig(process.env);
|
|
75
|
+
const telemetry = await initAgentTelemetry('parall-daemon', 'daemon');
|
|
76
|
+
log = createOtelLogger('daemon', 'daemon');
|
|
75
77
|
log.info(`boot: api=${config.apiUrl} pollMs=${config.pollIntervalMs} heartbeatMs=${config.heartbeatIntervalMs} agentBin=${config.agentBin}`);
|
|
76
78
|
log.info(`keepalive: bootstrapBackoffMs=${config.bootstrapBackoffMs} supervisorRestartBackoffMs=${config.supervisorRestartBackoffMs}`);
|
|
77
79
|
// --- Self-update: rollback check (before any network calls) ---
|
|
@@ -80,7 +82,8 @@ async function main() {
|
|
|
80
82
|
const bundleDir = resolveBundleDir(process.env);
|
|
81
83
|
updater = new DaemonUpdater(bundleDir, config.updateCdnUrl, log, true);
|
|
82
84
|
if (updater.checkRollback()) {
|
|
83
|
-
log.info(
|
|
85
|
+
log.info('rollback applied — exiting for service manager restart');
|
|
86
|
+
await telemetry.shutdown();
|
|
84
87
|
process.exit(UPDATE_EXIT_CODE);
|
|
85
88
|
}
|
|
86
89
|
log.info(`update: bundleDir=${bundleDir} cdn=${config.updateCdnUrl} interval=${config.updateIntervalMs}ms`);
|
|
@@ -98,15 +101,15 @@ async function main() {
|
|
|
98
101
|
log.info(`received ${sig} — initiating shutdown`);
|
|
99
102
|
abortController.abort();
|
|
100
103
|
};
|
|
101
|
-
process.on(
|
|
102
|
-
process.on(
|
|
104
|
+
process.on('SIGINT', () => onSignal('SIGINT'));
|
|
105
|
+
process.on('SIGTERM', () => onSignal('SIGTERM'));
|
|
103
106
|
// Defensive: unexpected async failures are logged explicitly. Rejections
|
|
104
107
|
// stay in-process so the supervisor loop can recover; uncaught exceptions
|
|
105
108
|
// exit so entrypoint.sh's shell-level keepalive restarts from a clean VM.
|
|
106
|
-
process.on(
|
|
109
|
+
process.on('unhandledRejection', (reason) => {
|
|
107
110
|
log.error(`unhandledRejection: ${formatError(reason)}`);
|
|
108
111
|
});
|
|
109
|
-
process.on(
|
|
112
|
+
process.on('uncaughtException', (err) => {
|
|
110
113
|
log.error(`uncaughtException: ${formatError(err)}`);
|
|
111
114
|
process.exitCode = 1;
|
|
112
115
|
process.exit(1);
|
|
@@ -119,17 +122,19 @@ async function main() {
|
|
|
119
122
|
return false;
|
|
120
123
|
});
|
|
121
124
|
if (applied) {
|
|
122
|
-
log.info(
|
|
125
|
+
log.info('boot update applied — exiting for restart');
|
|
126
|
+
await telemetry.shutdown();
|
|
123
127
|
process.exit(UPDATE_EXIT_CODE);
|
|
124
128
|
}
|
|
125
129
|
updater.startPeriodicCheck(config.updateIntervalMs);
|
|
126
130
|
}
|
|
127
131
|
await runForever(config, client, log, abortController.signal, updater);
|
|
132
|
+
await telemetry.shutdown();
|
|
128
133
|
}
|
|
129
134
|
const cliArgs = process.argv.slice(2);
|
|
130
135
|
runCLI(cliArgs)
|
|
131
136
|
.then((result) => {
|
|
132
|
-
if (result ===
|
|
137
|
+
if (result === 'handled')
|
|
133
138
|
return;
|
|
134
139
|
main().catch((err) => {
|
|
135
140
|
log.error(`fatal: ${formatError(err)}`);
|
package/dist/runtimes.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { clearAllProviderCreds } from
|
|
2
|
-
import type { ProviderConfig } from
|
|
1
|
+
import { clearAllProviderCreds } from '@parall/agent-core';
|
|
2
|
+
import type { ProviderConfig } from '@parall/agent-core';
|
|
3
3
|
export type { ProviderConfig };
|
|
4
4
|
export { clearAllProviderCreds };
|
|
5
5
|
export interface RuntimeAdapter {
|
|
6
6
|
bin: string;
|
|
7
|
+
args: string[];
|
|
7
8
|
buildEnv(baseEnv: NodeJS.ProcessEnv, agentId: string, orgId: string, apiKey: string, dirs: AgentDirs, pc?: ProviderConfig): NodeJS.ProcessEnv;
|
|
8
9
|
}
|
|
9
10
|
export interface AgentDirs {
|
package/dist/runtimes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimes.d.ts","sourceRoot":"","sources":["../src/runtimes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,YAAY,EAAE,cAAc,EAAE,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,
|
|
1
|
+
{"version":3,"file":"runtimes.d.ts","sourceRoot":"","sources":["../src/runtimes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,YAAY,EAAE,cAAc,EAAE,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,CACN,OAAO,EAAE,MAAM,CAAC,UAAU,EAC1B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,EACf,EAAE,CAAC,EAAE,cAAc,GAClB,MAAM,CAAC,UAAU,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAuED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,CAerE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAInD"}
|
package/dist/runtimes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as fs from
|
|
2
|
-
import * as path from
|
|
3
|
-
import { clearAllProviderCreds } from
|
|
4
|
-
import { resolveBundleDir } from
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { clearAllProviderCreds } from '@parall/agent-core';
|
|
4
|
+
import { resolveBundleDir } from './config.js';
|
|
5
5
|
export { clearAllProviderCreds };
|
|
6
6
|
function buildStandardEnv(baseEnv, agentId, orgId, apiKey, dirs, pc) {
|
|
7
7
|
const env = { ...baseEnv };
|
|
@@ -18,7 +18,8 @@ function buildStandardEnv(baseEnv, agentId, orgId, apiKey, dirs, pc) {
|
|
|
18
18
|
return env;
|
|
19
19
|
}
|
|
20
20
|
const claudeCodeAdapter = {
|
|
21
|
-
bin:
|
|
21
|
+
bin: 'parall-claude-agent',
|
|
22
|
+
args: [],
|
|
22
23
|
buildEnv(baseEnv, agentId, orgId, apiKey, dirs, pc) {
|
|
23
24
|
const env = buildStandardEnv(baseEnv, agentId, orgId, apiKey, dirs, pc);
|
|
24
25
|
env.PRLL_CLAUDE_HOME = dirs.claudeHome;
|
|
@@ -26,34 +27,37 @@ const claudeCodeAdapter = {
|
|
|
26
27
|
},
|
|
27
28
|
};
|
|
28
29
|
const codexAdapter = {
|
|
29
|
-
bin:
|
|
30
|
+
bin: 'parall-codex-agent',
|
|
31
|
+
args: [],
|
|
30
32
|
buildEnv(baseEnv, agentId, orgId, apiKey, dirs, pc) {
|
|
31
33
|
const env = buildStandardEnv(baseEnv, agentId, orgId, apiKey, dirs, pc);
|
|
32
|
-
env.PRLL_CODEX_HOME = path.join(dirs.stateDir,
|
|
34
|
+
env.PRLL_CODEX_HOME = path.join(dirs.stateDir, '.codex');
|
|
33
35
|
return env;
|
|
34
36
|
},
|
|
35
37
|
};
|
|
36
38
|
const defaultAdapter = {
|
|
37
|
-
bin:
|
|
39
|
+
bin: 'parall-agent',
|
|
40
|
+
args: [],
|
|
38
41
|
buildEnv: buildStandardEnv,
|
|
39
42
|
};
|
|
40
43
|
const openclawAdapter = {
|
|
41
|
-
bin:
|
|
44
|
+
bin: 'parall-openclaw-agent',
|
|
45
|
+
args: [],
|
|
42
46
|
buildEnv(baseEnv, agentId, orgId, apiKey, dirs, pc) {
|
|
43
47
|
const env = buildStandardEnv(baseEnv, agentId, orgId, apiKey, dirs, pc);
|
|
44
|
-
env.OPENCLAW_GATEWAY_PORT = env.OPENCLAW_GATEWAY_PORT ||
|
|
48
|
+
env.OPENCLAW_GATEWAY_PORT = env.OPENCLAW_GATEWAY_PORT || '0';
|
|
45
49
|
return env;
|
|
46
50
|
},
|
|
47
51
|
};
|
|
48
52
|
const RUNTIME_ADAPTERS = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
'claude-code': claudeCodeAdapter,
|
|
54
|
+
codex: codexAdapter,
|
|
55
|
+
openclaw: openclawAdapter,
|
|
52
56
|
};
|
|
53
57
|
const OVERLAY_BIN_NAMES = {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
'claude-code': 'parall-claude-agent.js',
|
|
59
|
+
codex: 'parall-codex-agent.js',
|
|
60
|
+
openclaw: 'parall-openclaw-agent.js',
|
|
57
61
|
};
|
|
58
62
|
/**
|
|
59
63
|
* Resolve a runtime adapter, preferring overlay bundle paths when available.
|
|
@@ -67,9 +71,9 @@ export function getRuntimeAdapter(runtimeType) {
|
|
|
67
71
|
return base;
|
|
68
72
|
try {
|
|
69
73
|
const bundleDir = resolveBundleDir();
|
|
70
|
-
const overlayBin = path.join(bundleDir,
|
|
74
|
+
const overlayBin = path.join(bundleDir, 'current', overlayName);
|
|
71
75
|
if (fs.existsSync(overlayBin)) {
|
|
72
|
-
return { ...base, bin: overlayBin };
|
|
76
|
+
return { ...base, bin: process.execPath, args: [overlayBin] };
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
79
|
catch {
|
|
@@ -78,7 +82,7 @@ export function getRuntimeAdapter(runtimeType) {
|
|
|
78
82
|
return base;
|
|
79
83
|
}
|
|
80
84
|
export function assertAgentKey(apiKey) {
|
|
81
|
-
if (apiKey.startsWith(
|
|
82
|
-
throw new Error(
|
|
85
|
+
if (apiKey.startsWith('mck_')) {
|
|
86
|
+
throw new Error('BUG: machine key leaked to child process — expected agk_, got mck_');
|
|
83
87
|
}
|
|
84
88
|
}
|
package/dist/supervisor.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { ParallClient } from
|
|
3
|
-
import type { DaemonUpdater } from
|
|
4
|
-
import { type ClaudeDaemonConfig } from
|
|
1
|
+
import { type GatewayLogger } from '@parall/agent-core';
|
|
2
|
+
import { ParallClient } from '@parall/sdk';
|
|
3
|
+
import type { DaemonUpdater } from './updater.js';
|
|
4
|
+
import { type ClaudeDaemonConfig } from './config.js';
|
|
5
5
|
/**
|
|
6
6
|
* Sleep that wakes early on abort. Returns true if the full delay elapsed,
|
|
7
7
|
* false if aborted. Used by bootstrap retry and the outer keepalive in
|
|
@@ -31,11 +31,14 @@ export declare class DaemonSupervisor {
|
|
|
31
31
|
private readonly cancelledSpawns;
|
|
32
32
|
private ws;
|
|
33
33
|
private running;
|
|
34
|
+
private machineId;
|
|
34
35
|
private machineOrgId;
|
|
35
36
|
private machineLlmSource;
|
|
36
37
|
private stopResolve;
|
|
37
38
|
private updater;
|
|
38
39
|
private healthConfirmed;
|
|
40
|
+
private clipManager;
|
|
41
|
+
private clipProvider;
|
|
39
42
|
constructor(config: ClaudeDaemonConfig, client: ParallClient, log: GatewayLogger);
|
|
40
43
|
setUpdater(updater: DaemonUpdater): void;
|
|
41
44
|
/** Start the supervisor. Returns a promise that resolves on `stop()`. */
|
|
@@ -54,6 +57,8 @@ export declare class DaemonSupervisor {
|
|
|
54
57
|
private handleAgentAttached;
|
|
55
58
|
private handleAgentDetached;
|
|
56
59
|
private handleFilesystemBrowse;
|
|
60
|
+
private handleClipInstall;
|
|
61
|
+
private reconcileClipInstalls;
|
|
57
62
|
private handleWorkspaceSetupRequested;
|
|
58
63
|
private scheduleWorkspaceSetupRetry;
|
|
59
64
|
private clearWorkspaceSetupRetry;
|
package/dist/supervisor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EACL,YAAY,EAab,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EACL,KAAK,kBAAkB,EAMxB,MAAM,aAAa,CAAC;AAmBrB;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAa3E;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAyB5B;;;;;;;;;;GAUG;AACH,qBAAa,gBAAgB;IAkBzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAnBtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAC1D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAqB;IAC3D,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAqC;IAC/E,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IACrD,OAAO,CAAC,EAAE,CAAyB;IACnC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,gBAAgB,CAAoB;IAC5C,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,WAAW,CAAmC;IACtD,OAAO,CAAC,YAAY,CAA6B;gBAG9B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,aAAa;IAGrC,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAIxC,yEAAyE;IACnE,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA+J7C,sEAAsE;IAChE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAyCb,kBAAkB;YAsClB,aAAa;IA2D3B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;YA6CX,kBAAkB;YAqBlB,mBAAmB;YAgBnB,mBAAmB;YAmBnB,sBAAsB;YAwBtB,iBAAiB;YAmEjB,qBAAqB;YAqBrB,6BAA6B;IAqC3C,OAAO,CAAC,2BAA2B;IAYnC,OAAO,CAAC,wBAAwB;YAUlB,oBAAoB;YAgBpB,kBAAkB;YAYlB,eAAe;YAcf,UAAU;YAoBV,cAAc;IAkE5B,OAAO,CAAC,UAAU;YA2GJ,cAAc;IAyB5B,OAAO,CAAC,0BAA0B;CAkCnC"}
|