@parall/daemon 1.49.0 → 1.50.1
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 +11 -11
- package/bundle/parall-browser-pod.js +318 -104
- package/bundle/parall-claude-agent.js +124 -29
- package/bundle/parall-codex-agent.js +124 -29
- package/bundle/parall-daemon.js +368 -184
- package/dist/browser-pod.d.ts.map +1 -1
- package/dist/browser-pod.js +9 -14
- package/dist/browser-profile-viewer-control.d.ts +15 -0
- package/dist/browser-profile-viewer-control.d.ts.map +1 -0
- package/dist/browser-profile-viewer-control.js +27 -0
- package/dist/clip-runtime/bb-viewer-command-client.d.ts +19 -0
- package/dist/clip-runtime/bb-viewer-command-client.d.ts.map +1 -0
- package/dist/clip-runtime/bb-viewer-command-client.js +89 -0
- package/dist/clip-runtime/browser-profile-manager.d.ts +3 -1
- package/dist/clip-runtime/browser-profile-manager.d.ts.map +1 -1
- package/dist/clip-runtime/browser-profile-manager.js +2 -2
- package/dist/clip-runtime/browser-viewer-streamer.d.ts +7 -7
- package/dist/clip-runtime/browser-viewer-streamer.d.ts.map +1 -1
- package/dist/clip-runtime/browser-viewer-streamer.js +39 -47
- package/dist/clip-runtime/clip-provider.d.ts +3 -2
- package/dist/clip-runtime/clip-provider.d.ts.map +1 -1
- package/dist/clip-runtime/clip-provider.js +13 -6
- package/dist/clip-runtime/hosted-viewer-command-queue.d.ts +43 -0
- package/dist/clip-runtime/hosted-viewer-command-queue.d.ts.map +1 -0
- package/dist/clip-runtime/hosted-viewer-command-queue.js +72 -0
- package/dist/clip-runtime/index.d.ts +1 -0
- package/dist/clip-runtime/index.d.ts.map +1 -1
- package/dist/clip-runtime/index.js +1 -0
- package/dist/clip-runtime/viewer-command-deadline.d.ts +14 -0
- package/dist/clip-runtime/viewer-command-deadline.d.ts.map +1 -0
- package/dist/clip-runtime/viewer-command-deadline.js +29 -0
- package/dist/clip-runtime/viewer-command-error.d.ts +18 -0
- package/dist/clip-runtime/viewer-command-error.d.ts.map +1 -0
- package/dist/clip-runtime/viewer-command-error.js +23 -0
- package/dist/supervisor.d.ts +0 -8
- package/dist/supervisor.d.ts.map +1 -1
- package/dist/supervisor.js +3 -32
- package/package.json +6 -6
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface HostedViewerCommand {
|
|
2
|
+
profileId: string;
|
|
3
|
+
sessionId: string;
|
|
4
|
+
command: string;
|
|
5
|
+
input?: Record<string, unknown>;
|
|
6
|
+
turn?: {
|
|
7
|
+
url: string;
|
|
8
|
+
username?: string;
|
|
9
|
+
credential?: string;
|
|
10
|
+
};
|
|
11
|
+
/** Absolute api-server request deadline, normalized from proto JSON int64. */
|
|
12
|
+
dispatchDeadlineUnixMs?: number;
|
|
13
|
+
}
|
|
14
|
+
export type HostedViewerCommandRunner = (command: HostedViewerCommand, executionDeadlineUnixMs?: number) => Promise<Record<string, unknown>>;
|
|
15
|
+
export interface HostedViewerDeadlineTimer {
|
|
16
|
+
cancel(): void;
|
|
17
|
+
unref?(): void;
|
|
18
|
+
}
|
|
19
|
+
export interface HostedViewerCommandQueueOptions {
|
|
20
|
+
now?: () => number;
|
|
21
|
+
readinessBudgetMs?: number;
|
|
22
|
+
replyReserveMs?: number;
|
|
23
|
+
schedule?: (callback: () => void, delayMs: number) => HostedViewerDeadlineTimer;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Serializes the hosted pod's viewer mutations while preserving the API's
|
|
27
|
+
* absolute readiness deadline. A readiness timer starts when the command enters
|
|
28
|
+
* THIS queue, not later when an earlier command releases it. If it expires while
|
|
29
|
+
* queued, the command is never executed; if it expires in bb-viewer, the runner
|
|
30
|
+
* receives the same deadline so its HTTP request can abort at the boundary.
|
|
31
|
+
*/
|
|
32
|
+
export declare class HostedViewerCommandQueue {
|
|
33
|
+
private readonly run;
|
|
34
|
+
private tail;
|
|
35
|
+
private readonly now;
|
|
36
|
+
private readonly readinessBudgetMs;
|
|
37
|
+
private readonly replyReserveMs;
|
|
38
|
+
private readonly schedule;
|
|
39
|
+
constructor(run: HostedViewerCommandRunner, opts?: HostedViewerCommandQueueOptions);
|
|
40
|
+
enqueue(command: HostedViewerCommand): Promise<Record<string, unknown>>;
|
|
41
|
+
private executionDeadline;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=hosted-viewer-command-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-viewer-command-queue.d.ts","sourceRoot":"","sources":["../../src/clip-runtime/hosted-viewer-command-queue.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,8EAA8E;IAC9E,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,MAAM,yBAAyB,GAAG,CACtC,OAAO,EAAE,mBAAmB,EAC5B,uBAAuB,CAAC,EAAE,MAAM,KAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEtC,MAAM,WAAW,yBAAyB;IACxC,MAAM,IAAI,IAAI,CAAC;IACf,KAAK,CAAC,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,+BAA+B;IAC9C,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,yBAAyB,CAAC;CACjF;AAED;;;;;;GAMG;AACH,qBAAa,wBAAwB;IAQjC,OAAO,CAAC,QAAQ,CAAC,GAAG;IAPtB,OAAO,CAAC,IAAI,CAAuC;IACnD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuE;gBAG7E,GAAG,EAAE,yBAAyB,EAC/C,IAAI,GAAE,+BAAoC;IAgB5C,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA+BvE,OAAO,CAAC,iBAAiB;CAiB1B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { HOSTED_VIEWER_READINESS_POD_BUDGET_MS, HOSTED_VIEWER_REPLY_RESERVE_MS, isViewerReadinessCommand, viewerReadinessDeadlineError, } from './viewer-command-deadline.js';
|
|
2
|
+
/**
|
|
3
|
+
* Serializes the hosted pod's viewer mutations while preserving the API's
|
|
4
|
+
* absolute readiness deadline. A readiness timer starts when the command enters
|
|
5
|
+
* THIS queue, not later when an earlier command releases it. If it expires while
|
|
6
|
+
* queued, the command is never executed; if it expires in bb-viewer, the runner
|
|
7
|
+
* receives the same deadline so its HTTP request can abort at the boundary.
|
|
8
|
+
*/
|
|
9
|
+
export class HostedViewerCommandQueue {
|
|
10
|
+
run;
|
|
11
|
+
tail = Promise.resolve();
|
|
12
|
+
now;
|
|
13
|
+
readinessBudgetMs;
|
|
14
|
+
replyReserveMs;
|
|
15
|
+
schedule;
|
|
16
|
+
constructor(run, opts = {}) {
|
|
17
|
+
this.run = run;
|
|
18
|
+
this.now = opts.now ?? Date.now;
|
|
19
|
+
this.readinessBudgetMs = opts.readinessBudgetMs ?? HOSTED_VIEWER_READINESS_POD_BUDGET_MS;
|
|
20
|
+
this.replyReserveMs = opts.replyReserveMs ?? HOSTED_VIEWER_REPLY_RESERVE_MS;
|
|
21
|
+
this.schedule =
|
|
22
|
+
opts.schedule ??
|
|
23
|
+
((callback, delayMs) => {
|
|
24
|
+
const handle = setTimeout(callback, delayMs);
|
|
25
|
+
return {
|
|
26
|
+
cancel: () => clearTimeout(handle),
|
|
27
|
+
unref: () => handle.unref?.(),
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
enqueue(command) {
|
|
32
|
+
const receivedAt = this.now();
|
|
33
|
+
const executionDeadline = this.executionDeadline(command, receivedAt);
|
|
34
|
+
const run = this.tail
|
|
35
|
+
.catch(() => { }) // one failed command must not poison the serialization lane
|
|
36
|
+
.then(() => {
|
|
37
|
+
if (executionDeadline !== undefined && this.now() >= executionDeadline) {
|
|
38
|
+
throw viewerReadinessDeadlineError('before hosted pod execution');
|
|
39
|
+
}
|
|
40
|
+
return this.run(command, executionDeadline);
|
|
41
|
+
});
|
|
42
|
+
this.tail = run.catch(() => { });
|
|
43
|
+
if (executionDeadline === undefined) {
|
|
44
|
+
return run;
|
|
45
|
+
}
|
|
46
|
+
let timer;
|
|
47
|
+
const timeout = new Promise((_, reject) => {
|
|
48
|
+
const delay = Math.max(0, executionDeadline - this.now());
|
|
49
|
+
timer = this.schedule(() => {
|
|
50
|
+
reject(viewerReadinessDeadlineError('inside the hosted pod queue'));
|
|
51
|
+
}, delay);
|
|
52
|
+
timer.unref?.();
|
|
53
|
+
});
|
|
54
|
+
return Promise.race([run, timeout]).finally(() => {
|
|
55
|
+
timer?.cancel();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
executionDeadline(command, receivedAt) {
|
|
59
|
+
if (!isViewerReadinessCommand(command.command)) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
const dispatchDeadline = command.dispatchDeadlineUnixMs;
|
|
63
|
+
if (!Number.isSafeInteger(dispatchDeadline) || dispatchDeadline === undefined) {
|
|
64
|
+
throw viewerReadinessDeadlineError('because the authenticated deadline is missing');
|
|
65
|
+
}
|
|
66
|
+
const deadline = Math.min(receivedAt + this.readinessBudgetMs, dispatchDeadline - this.replyReserveMs);
|
|
67
|
+
if (deadline <= receivedAt) {
|
|
68
|
+
throw viewerReadinessDeadlineError('before hosted pod receipt');
|
|
69
|
+
}
|
|
70
|
+
return deadline;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -6,5 +6,6 @@ export { ClipProvider, type ClipProviderOptions } from './clip-provider.js';
|
|
|
6
6
|
export { HubClient, HubCommandError, type HubClientOptions, type ClipBinding, } from './hub-client.js';
|
|
7
7
|
export { BrowserProfileManager, type BrowserInvoker, type BrowserInvokeRequest, type BrowserProxyConfig, } from './browser-profile-manager.js';
|
|
8
8
|
export { BrowserProfilePool, type BrowserProfilePoolOptions } from './browser-profile-pool.js';
|
|
9
|
+
export { ViewerCommandError, viewerCommandFailure, type ViewerCommandFailure, } from './viewer-command-error.js';
|
|
9
10
|
export { installClip, removeClip, parseSource, type InstallOptions, type InstallResult, } from './clip-installer.js';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clip-runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,WAAW,EACX,YAAY,EACZ,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,QAAQ,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACL,SAAS,EACT,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clip-runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,WAAW,EACX,YAAY,EACZ,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,QAAQ,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACL,SAAS,EACT,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,oBAAoB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC"}
|
|
@@ -5,4 +5,5 @@ export { ClipProvider } from './clip-provider.js';
|
|
|
5
5
|
export { HubClient, HubCommandError, } from './hub-client.js';
|
|
6
6
|
export { BrowserProfileManager, } from './browser-profile-manager.js';
|
|
7
7
|
export { BrowserProfilePool } from './browser-profile-pool.js';
|
|
8
|
+
export { ViewerCommandError, viewerCommandFailure, } from './viewer-command-error.js';
|
|
8
9
|
export { installClip, removeClip, parseSource, } from './clip-installer.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ViewerCommandError } from './viewer-command-error.js';
|
|
2
|
+
/** The pod owns at most 30s from ProviderStream receipt/queue entry through
|
|
3
|
+
* bb-viewer's first-frame/RTP acknowledgement. Keep in sync with
|
|
4
|
+
* model.HostedViewerReadinessPodBudget. */
|
|
5
|
+
export declare const HOSTED_VIEWER_READINESS_POD_BUDGET_MS = 30000;
|
|
6
|
+
/** Time left after the pod result for ProviderStream → Redis → api-server.
|
|
7
|
+
* Keep in sync with model.HostedViewerReplyForwardBudget. */
|
|
8
|
+
export declare const HOSTED_VIEWER_REPLY_RESERVE_MS = 5000;
|
|
9
|
+
export declare function isViewerReadinessCommand(command: string): boolean;
|
|
10
|
+
/** Proto JSON encodes int64 values as decimal strings. Accept a number as well
|
|
11
|
+
* for test/older hand-written peers, but always normalize to one safe integer. */
|
|
12
|
+
export declare function parseViewerDispatchDeadlineUnixMs(value: unknown): number | undefined;
|
|
13
|
+
export declare function viewerReadinessDeadlineError(phase: string): ViewerCommandError;
|
|
14
|
+
//# sourceMappingURL=viewer-command-deadline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewer-command-deadline.d.ts","sourceRoot":"","sources":["../../src/clip-runtime/viewer-command-deadline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;2CAE2C;AAC3C,eAAO,MAAM,qCAAqC,QAAS,CAAC;AAE5D;6DAC6D;AAC7D,eAAO,MAAM,8BAA8B,OAAQ,CAAC;AAEpD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED;kFACkF;AAClF,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAUpF;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,CAK9E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ViewerCommandError } from './viewer-command-error.js';
|
|
2
|
+
/** The pod owns at most 30s from ProviderStream receipt/queue entry through
|
|
3
|
+
* bb-viewer's first-frame/RTP acknowledgement. Keep in sync with
|
|
4
|
+
* model.HostedViewerReadinessPodBudget. */
|
|
5
|
+
export const HOSTED_VIEWER_READINESS_POD_BUDGET_MS = 30_000;
|
|
6
|
+
/** Time left after the pod result for ProviderStream → Redis → api-server.
|
|
7
|
+
* Keep in sync with model.HostedViewerReplyForwardBudget. */
|
|
8
|
+
export const HOSTED_VIEWER_REPLY_RESERVE_MS = 5_000;
|
|
9
|
+
export function isViewerReadinessCommand(command) {
|
|
10
|
+
return command === 'stream.answer' || command === 'stream.switch';
|
|
11
|
+
}
|
|
12
|
+
/** Proto JSON encodes int64 values as decimal strings. Accept a number as well
|
|
13
|
+
* for test/older hand-written peers, but always normalize to one safe integer. */
|
|
14
|
+
export function parseViewerDispatchDeadlineUnixMs(value) {
|
|
15
|
+
let parsed;
|
|
16
|
+
if (typeof value === 'number') {
|
|
17
|
+
parsed = value;
|
|
18
|
+
}
|
|
19
|
+
else if (typeof value === 'string' && /^[1-9]\d*$/.test(value)) {
|
|
20
|
+
parsed = Number(value);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : undefined;
|
|
26
|
+
}
|
|
27
|
+
export function viewerReadinessDeadlineError(phase) {
|
|
28
|
+
return new ViewerCommandError(`viewer readiness deadline elapsed ${phase}`, 'VIEWER_STREAM_CANCELLED');
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable live-viewer failure carried from the bb-viewer command adapter through
|
|
3
|
+
* either daemon reply transport (machine REST or hosted ProviderStream).
|
|
4
|
+
*
|
|
5
|
+
* Only this error type contributes a public code. Generic Node/system errors
|
|
6
|
+
* such as ECONNREFUSED remain message-only and are collapsed by api-server.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ViewerCommandError extends Error {
|
|
9
|
+
readonly code?: string | undefined;
|
|
10
|
+
constructor(message: string, code?: string | undefined);
|
|
11
|
+
}
|
|
12
|
+
export interface ViewerCommandFailure {
|
|
13
|
+
message: string;
|
|
14
|
+
code?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Convert a thrown viewer failure to the additive daemon reply envelope. */
|
|
17
|
+
export declare function viewerCommandFailure(error: unknown): ViewerCommandFailure;
|
|
18
|
+
//# sourceMappingURL=viewer-command-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewer-command-error.d.ts","sourceRoot":"","sources":["../../src/clip-runtime/viewer-command-error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAGzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;gBADtB,OAAO,EAAE,MAAM,EACN,IAAI,CAAC,EAAE,MAAM,YAAA;CAKzB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAMzE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable live-viewer failure carried from the bb-viewer command adapter through
|
|
3
|
+
* either daemon reply transport (machine REST or hosted ProviderStream).
|
|
4
|
+
*
|
|
5
|
+
* Only this error type contributes a public code. Generic Node/system errors
|
|
6
|
+
* such as ECONNREFUSED remain message-only and are collapsed by api-server.
|
|
7
|
+
*/
|
|
8
|
+
export class ViewerCommandError extends Error {
|
|
9
|
+
code;
|
|
10
|
+
constructor(message, code) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.name = 'ViewerCommandError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/** Convert a thrown viewer failure to the additive daemon reply envelope. */
|
|
17
|
+
export function viewerCommandFailure(error) {
|
|
18
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19
|
+
if (error instanceof ViewerCommandError && error.code) {
|
|
20
|
+
return { code: error.code, message };
|
|
21
|
+
}
|
|
22
|
+
return { message };
|
|
23
|
+
}
|
package/dist/supervisor.d.ts
CHANGED
|
@@ -114,14 +114,6 @@ export declare class DaemonSupervisor {
|
|
|
114
114
|
localProfileControlDeps(): LocalProfileControlPlaneDeps;
|
|
115
115
|
private enqueueBrowserProfileOp;
|
|
116
116
|
private enqueueBrowserProfileRevive;
|
|
117
|
-
/**
|
|
118
|
-
* Handle one viewer control command and reply via REST. Always answers the
|
|
119
|
-
* request/reply bridge exactly once ({result} on success, {error:{message}}
|
|
120
|
-
* on failure) and never throws into the WS event loop — mirrors
|
|
121
|
-
* handleFilesystemBrowse. Serialized per profile by enqueueBrowserProfileViewer.
|
|
122
|
-
*/
|
|
123
|
-
private handleBrowserProfileViewer;
|
|
124
|
-
private enqueueBrowserProfileViewer;
|
|
125
117
|
private handleClipSync;
|
|
126
118
|
private reconcileMachineClips;
|
|
127
119
|
private reconcileMachineClipsNow;
|
package/dist/supervisor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyC,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,
|
|
1
|
+
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyC,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAeL,KAAK,YAAY,EAElB,MAAM,aAAa,CAAC;AAarB,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,KAAK,4BAA4B,EAElC,MAAM,4BAA4B,CAAC;AAcpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAsBvE;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAa3E;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AA4B5B;;;;;;;;;;GAUG;AACH,qBAAa,gBAAgB;IA+EzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAhFtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAC1D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,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,wBAAwB;IAwDtC;;;;;;;OAOG;YACW,qBAAqB;IAcnC,OAAO,CAAC,+BAA+B;IAYvC,OAAO,CAAC,4BAA4B;YAQtB,eAAe;YAgDf,UAAU;IA+BxB;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;YAgBhB,cAAc;IAoE5B,OAAO,CAAC,UAAU;IAsKlB;;;;;OAKG;YACW,cAAc;CAwB7B"}
|
package/dist/supervisor.js
CHANGED
|
@@ -4,12 +4,13 @@ import * as os from 'node:os';
|
|
|
4
4
|
import * as path from 'node:path';
|
|
5
5
|
import { effectiveLLMSourceExplicit, llmSource } from '@parall/agent-core';
|
|
6
6
|
import { ParallWs, } from '@parall/sdk';
|
|
7
|
+
import { reconcileBrowserProfiles as runBrowserProfileReconcile } from './browser-profile-reconcile.js';
|
|
8
|
+
import { handleBrowserProfileViewerCommand } from './browser-profile-viewer-control.js';
|
|
7
9
|
import { PUBLIC_PROXY_PROBE_FALLBACK_URL } from './clip-runtime/browser-readiness.js';
|
|
8
10
|
import { installClip, parseSource } from './clip-runtime/clip-installer.js';
|
|
9
11
|
import { parseIpcCommands } from './clip-runtime/manifest.js';
|
|
10
12
|
import { BrowserProfilePool, ClipProcessManager, ClipProvider, HubClient, } from './clip-runtime/index.js';
|
|
11
13
|
import { agentClaudeHomeFor, agentHomeDirFor, agentStateDirFor, agentWorkspaceDirFor, } from './config.js';
|
|
12
|
-
import { reconcileBrowserProfiles as runBrowserProfileReconcile } from './browser-profile-reconcile.js';
|
|
13
14
|
import { listDirectory } from './filesystem.js';
|
|
14
15
|
import { startLocalProfileControl, } from './local-profile-control.js';
|
|
15
16
|
import { ensureIsolatedHome, ensureSharedCredentialLink, } from './home-isolation.js';
|
|
@@ -319,7 +320,7 @@ export class DaemonSupervisor {
|
|
|
319
320
|
});
|
|
320
321
|
this.ws.on('machine.browser_profile.viewer', (data) => {
|
|
321
322
|
this.log.info(`WS: browser profile viewer command — profile=${data.profile_id} command=${data.command}`);
|
|
322
|
-
this.
|
|
323
|
+
void this.enqueueBrowserProfileOp(data.profile_id, () => handleBrowserProfileViewerCommand({ pool: this.browserProfilePool, client: this.client, log: this.log }, data));
|
|
323
324
|
});
|
|
324
325
|
this.ws.onStateChange((state) => {
|
|
325
326
|
if (state === 'disconnected' || state === 'reconnecting') {
|
|
@@ -881,36 +882,6 @@ export class DaemonSupervisor {
|
|
|
881
882
|
this.browserProfilePendingRevives.set(profileId, remaining);
|
|
882
883
|
});
|
|
883
884
|
}
|
|
884
|
-
/**
|
|
885
|
-
* Handle one viewer control command and reply via REST. Always answers the
|
|
886
|
-
* request/reply bridge exactly once ({result} on success, {error:{message}}
|
|
887
|
-
* on failure) and never throws into the WS event loop — mirrors
|
|
888
|
-
* handleFilesystemBrowse. Serialized per profile by enqueueBrowserProfileViewer.
|
|
889
|
-
*/
|
|
890
|
-
async handleBrowserProfileViewer(data) {
|
|
891
|
-
if (!this.browserProfilePool) {
|
|
892
|
-
await this.client
|
|
893
|
-
.postBrowserProfileViewerResponse(data.request_id, {
|
|
894
|
-
error: { message: 'Browser profile runtime is disabled on this daemon' },
|
|
895
|
-
})
|
|
896
|
-
.catch((err) => this.log.warn(`browser profile viewer negative ACK failed: ${String(err)}`));
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
try {
|
|
900
|
-
const result = await this.browserProfilePool.handleViewerCommand(data.profile_id, data.session_id, data.command, data.input, data.turn);
|
|
901
|
-
await this.client.postBrowserProfileViewerResponse(data.request_id, { result });
|
|
902
|
-
}
|
|
903
|
-
catch (err) {
|
|
904
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
905
|
-
this.log.warn(`browser profile viewer command failed (profile=${data.profile_id}, command=${data.command}): ${message}`);
|
|
906
|
-
await this.client
|
|
907
|
-
.postBrowserProfileViewerResponse(data.request_id, { error: { message } })
|
|
908
|
-
.catch((replyErr) => this.log.warn(`browser profile viewer error ACK failed: ${String(replyErr)}`));
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
enqueueBrowserProfileViewer(data) {
|
|
912
|
-
void this.enqueueBrowserProfileOp(data.profile_id, () => this.handleBrowserProfileViewer(data));
|
|
913
|
-
}
|
|
914
885
|
async handleClipSync(_data) {
|
|
915
886
|
await this.reconcileMachineClips();
|
|
916
887
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parall/daemon",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.50.1",
|
|
4
4
|
"description": "Parall local agent runtime — daemon supervisor + bridge runtimes, bundled as standalone JS files",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"@aws-sdk/client-s3": "3.984.0",
|
|
34
34
|
"@pinixai/bb-browser-pro": "0.15.0",
|
|
35
35
|
"ws": "^8.18.0",
|
|
36
|
-
"@parall/agent-core": "1.
|
|
37
|
-
"@parall/sdk": "1.
|
|
38
|
-
"@parall/codex-agent": "1.
|
|
39
|
-
"@parall/openclaw-agent": "1.
|
|
40
|
-
"@parall/claude-agent": "1.
|
|
36
|
+
"@parall/agent-core": "1.50.1",
|
|
37
|
+
"@parall/sdk": "1.50.1",
|
|
38
|
+
"@parall/codex-agent": "1.50.1",
|
|
39
|
+
"@parall/openclaw-agent": "1.50.1",
|
|
40
|
+
"@parall/claude-agent": "1.50.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^22.0.0",
|