@zixt/host 0.0.77 → 0.0.79
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 +291 -149
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import { homedir as homedir2 } from "node:os";
|
|
|
31
31
|
// package.json
|
|
32
32
|
var package_default = {
|
|
33
33
|
name: "@zixt/host",
|
|
34
|
-
version: "0.0.
|
|
34
|
+
version: "0.0.79",
|
|
35
35
|
type: "module",
|
|
36
36
|
exports: {
|
|
37
37
|
".": "./src/client.ts",
|
|
@@ -20587,7 +20587,7 @@ async function generateTaskTitle(instructions, runner) {
|
|
|
20587
20587
|
instructions.slice(0, INSTRUCTIONS_BUDGET),
|
|
20588
20588
|
"</task_request>"
|
|
20589
20589
|
].join("\n");
|
|
20590
|
-
return new Promise((
|
|
20590
|
+
return new Promise((resolve18) => {
|
|
20591
20591
|
const child = spawnCli(
|
|
20592
20592
|
command,
|
|
20593
20593
|
[
|
|
@@ -20610,7 +20610,7 @@ async function generateTaskTitle(instructions, runner) {
|
|
|
20610
20610
|
if (settled) return;
|
|
20611
20611
|
settled = true;
|
|
20612
20612
|
clearTimeout(timer);
|
|
20613
|
-
|
|
20613
|
+
resolve18(value);
|
|
20614
20614
|
};
|
|
20615
20615
|
const timer = setTimeout(() => {
|
|
20616
20616
|
child.kill();
|
|
@@ -20932,11 +20932,11 @@ function createWorkerWatchdogSendDrain() {
|
|
|
20932
20932
|
if (completed) return;
|
|
20933
20933
|
completed = true;
|
|
20934
20934
|
pending--;
|
|
20935
|
-
if (pending === 0) drained.splice(0).forEach((
|
|
20935
|
+
if (pending === 0) drained.splice(0).forEach((resolve18) => resolve18());
|
|
20936
20936
|
};
|
|
20937
20937
|
},
|
|
20938
20938
|
drain: async () => {
|
|
20939
|
-
if (pending > 0) await new Promise((
|
|
20939
|
+
if (pending > 0) await new Promise((resolve18) => drained.push(resolve18));
|
|
20940
20940
|
}
|
|
20941
20941
|
};
|
|
20942
20942
|
}
|
|
@@ -21181,7 +21181,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
|
|
|
21181
21181
|
const deadline = Date.parse(retryAt);
|
|
21182
21182
|
if (!Number.isFinite(deadline) || signal.aborted) return false;
|
|
21183
21183
|
if (deadline <= Date.now()) return true;
|
|
21184
|
-
return await new Promise((
|
|
21184
|
+
return await new Promise((resolve18) => {
|
|
21185
21185
|
let settled = false;
|
|
21186
21186
|
let timer;
|
|
21187
21187
|
const finish = (ready) => {
|
|
@@ -21189,7 +21189,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
|
|
|
21189
21189
|
settled = true;
|
|
21190
21190
|
if (timer) clearTimeout(timer);
|
|
21191
21191
|
signal.removeEventListener("abort", onAbort);
|
|
21192
|
-
|
|
21192
|
+
resolve18(ready);
|
|
21193
21193
|
};
|
|
21194
21194
|
const onAbort = () => finish(false);
|
|
21195
21195
|
const schedule = () => {
|
|
@@ -21457,22 +21457,22 @@ var HostClient = class _HostClient {
|
|
|
21457
21457
|
const unwindingAssignments = [...this.activeAssignments.values()];
|
|
21458
21458
|
for (const cancel of this.cancels.values()) cancel(stopReason);
|
|
21459
21459
|
for (const entry of this.secretGrants.values()) {
|
|
21460
|
-
for (const
|
|
21460
|
+
for (const resolve18 of entry.resolvers) resolve18({});
|
|
21461
21461
|
entry.resolvers = [];
|
|
21462
21462
|
delete entry.value;
|
|
21463
21463
|
}
|
|
21464
21464
|
for (const entry of this.connectionGrants.values()) {
|
|
21465
|
-
for (const
|
|
21465
|
+
for (const resolve18 of entry.resolvers) resolve18([]);
|
|
21466
21466
|
entry.resolvers = [];
|
|
21467
21467
|
delete entry.value;
|
|
21468
21468
|
}
|
|
21469
21469
|
for (const entry of this.providerGrants.values()) {
|
|
21470
|
-
for (const
|
|
21470
|
+
for (const resolve18 of entry.resolvers) resolve18([]);
|
|
21471
21471
|
entry.resolvers = [];
|
|
21472
21472
|
delete entry.value;
|
|
21473
21473
|
}
|
|
21474
21474
|
for (const waiters of this.approvalWaiters.values()) {
|
|
21475
|
-
for (const
|
|
21475
|
+
for (const resolve18 of waiters.values()) resolve18({ approved: false, guidance: reason });
|
|
21476
21476
|
}
|
|
21477
21477
|
for (const waiters of this.agentOpWaiters.values()) {
|
|
21478
21478
|
for (const waiter of waiters.values()) {
|
|
@@ -21498,9 +21498,9 @@ var HostClient = class _HostClient {
|
|
|
21498
21498
|
let drainTimer;
|
|
21499
21499
|
const drained = await Promise.race([
|
|
21500
21500
|
Promise.allSettled(runs).then(() => true),
|
|
21501
|
-
new Promise((
|
|
21501
|
+
new Promise((resolve18) => {
|
|
21502
21502
|
drainTimer = setTimeout(
|
|
21503
|
-
() =>
|
|
21503
|
+
() => resolve18(false),
|
|
21504
21504
|
this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
|
|
21505
21505
|
);
|
|
21506
21506
|
drainTimer.unref?.();
|
|
@@ -21644,9 +21644,9 @@ var HostClient = class _HostClient {
|
|
|
21644
21644
|
let frameDrainTimer;
|
|
21645
21645
|
const framesDrained = await Promise.race([
|
|
21646
21646
|
frameTail.then(() => true),
|
|
21647
|
-
new Promise((
|
|
21647
|
+
new Promise((resolve18) => {
|
|
21648
21648
|
frameDrainTimer = setTimeout(
|
|
21649
|
-
() =>
|
|
21649
|
+
() => resolve18(false),
|
|
21650
21650
|
this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
|
|
21651
21651
|
);
|
|
21652
21652
|
frameDrainTimer.unref?.();
|
|
@@ -22189,7 +22189,7 @@ var HostClient = class _HostClient {
|
|
|
22189
22189
|
const entry = this.secretGrants.get(key) ?? { resolvers: [] };
|
|
22190
22190
|
entry.value = message.secrets;
|
|
22191
22191
|
entry.expiresAt = expiresAt;
|
|
22192
|
-
for (const
|
|
22192
|
+
for (const resolve18 of entry.resolvers) resolve18(message.secrets);
|
|
22193
22193
|
entry.resolvers = [];
|
|
22194
22194
|
this.secretGrants.set(key, entry);
|
|
22195
22195
|
return;
|
|
@@ -22220,13 +22220,13 @@ var HostClient = class _HostClient {
|
|
|
22220
22220
|
const entry = this.connectionGrants.get(key) ?? { resolvers: [] };
|
|
22221
22221
|
entry.value = message.connections;
|
|
22222
22222
|
entry.expiresAt = expiresAt;
|
|
22223
|
-
for (const
|
|
22223
|
+
for (const resolve18 of entry.resolvers) resolve18(message.connections);
|
|
22224
22224
|
entry.resolvers = [];
|
|
22225
22225
|
this.connectionGrants.set(key, entry);
|
|
22226
22226
|
const providerEntry = this.providerGrants.get(key) ?? { resolvers: [] };
|
|
22227
22227
|
providerEntry.value = providers;
|
|
22228
22228
|
providerEntry.expiresAt = authorityExpiresAt;
|
|
22229
|
-
for (const
|
|
22229
|
+
for (const resolve18 of providerEntry.resolvers) resolve18(providers);
|
|
22230
22230
|
providerEntry.resolvers = [];
|
|
22231
22231
|
this.providerGrants.set(key, providerEntry);
|
|
22232
22232
|
return;
|
|
@@ -22303,7 +22303,10 @@ var HostClient = class _HostClient {
|
|
|
22303
22303
|
hostId ? this.opts.onReplacementAssignmentAccepted?.(hostId, assign.taskId, assign.epoch) : void 0
|
|
22304
22304
|
).catch(() => {
|
|
22305
22305
|
});
|
|
22306
|
-
|
|
22306
|
+
const assignment = { taskId: assign.taskId, epoch: assign.epoch };
|
|
22307
|
+
this.activeAssignments.set(key, assignment);
|
|
22308
|
+
void Promise.resolve(this.opts.persistAcceptedAssignment?.(assignment)).catch(() => {
|
|
22309
|
+
});
|
|
22307
22310
|
const run3 = this.runTask(assign);
|
|
22308
22311
|
this.activeRuns.set(key, run3);
|
|
22309
22312
|
const removeRun = () => {
|
|
@@ -22311,6 +22314,8 @@ var HostClient = class _HostClient {
|
|
|
22311
22314
|
this.clearRunUnwindDeadline(key);
|
|
22312
22315
|
this.activeRuns.delete(key);
|
|
22313
22316
|
this.activeAssignments.delete(key);
|
|
22317
|
+
void Promise.resolve(this.opts.forgetAcceptedAssignment?.(assignment)).catch(() => {
|
|
22318
|
+
});
|
|
22314
22319
|
};
|
|
22315
22320
|
void run3.then(removeRun, removeRun);
|
|
22316
22321
|
}
|
|
@@ -22360,8 +22365,8 @@ var HostClient = class _HostClient {
|
|
|
22360
22365
|
return redactCredentialText(text, sensitiveSnapshot()).slice(0, maxLength);
|
|
22361
22366
|
};
|
|
22362
22367
|
let resolveCancelled;
|
|
22363
|
-
const cancelledPromise = new Promise((
|
|
22364
|
-
resolveCancelled =
|
|
22368
|
+
const cancelledPromise = new Promise((resolve18) => {
|
|
22369
|
+
resolveCancelled = resolve18;
|
|
22365
22370
|
});
|
|
22366
22371
|
const endAuthority = (reason = "cloud_cancel") => {
|
|
22367
22372
|
if (stopReason) return;
|
|
@@ -22370,21 +22375,21 @@ var HostClient = class _HostClient {
|
|
|
22370
22375
|
authorityController.abort(reason);
|
|
22371
22376
|
const secretEntry = this.secretGrants.get(cancelKey);
|
|
22372
22377
|
if (secretEntry) {
|
|
22373
|
-
for (const
|
|
22378
|
+
for (const resolve18 of secretEntry.resolvers) resolve18({});
|
|
22374
22379
|
secretEntry.resolvers = [];
|
|
22375
22380
|
delete secretEntry.value;
|
|
22376
22381
|
}
|
|
22377
22382
|
this.secretGrants.delete(cancelKey);
|
|
22378
22383
|
const connectionEntry = this.connectionGrants.get(cancelKey);
|
|
22379
22384
|
if (connectionEntry) {
|
|
22380
|
-
for (const
|
|
22385
|
+
for (const resolve18 of connectionEntry.resolvers) resolve18([]);
|
|
22381
22386
|
connectionEntry.resolvers = [];
|
|
22382
22387
|
delete connectionEntry.value;
|
|
22383
22388
|
}
|
|
22384
22389
|
this.connectionGrants.delete(cancelKey);
|
|
22385
22390
|
const providerEntry = this.providerGrants.get(cancelKey);
|
|
22386
22391
|
if (providerEntry) {
|
|
22387
|
-
for (const
|
|
22392
|
+
for (const resolve18 of providerEntry.resolvers) resolve18([]);
|
|
22388
22393
|
providerEntry.resolvers = [];
|
|
22389
22394
|
delete providerEntry.value;
|
|
22390
22395
|
}
|
|
@@ -22392,8 +22397,8 @@ var HostClient = class _HostClient {
|
|
|
22392
22397
|
this.clearAuthorityExpiry(cancelKey);
|
|
22393
22398
|
const approvalWaiters = this.approvalWaiters.get(cancelKey);
|
|
22394
22399
|
if (approvalWaiters) {
|
|
22395
|
-
for (const
|
|
22396
|
-
|
|
22400
|
+
for (const resolve18 of approvalWaiters.values()) {
|
|
22401
|
+
resolve18({ approved: false, guidance: "task was cancelled" });
|
|
22397
22402
|
}
|
|
22398
22403
|
approvalWaiters.clear();
|
|
22399
22404
|
}
|
|
@@ -22519,9 +22524,9 @@ var HostClient = class _HostClient {
|
|
|
22519
22524
|
return value;
|
|
22520
22525
|
};
|
|
22521
22526
|
if (entry.value) return Promise.resolve(capture(entry.value));
|
|
22522
|
-
return new Promise((
|
|
22523
|
-
entry.resolvers.push((value) =>
|
|
22524
|
-
setTimeout(() =>
|
|
22527
|
+
return new Promise((resolve18) => {
|
|
22528
|
+
entry.resolvers.push((value) => resolve18(capture(value)));
|
|
22529
|
+
setTimeout(() => resolve18(capture(entry.value ?? {})), _HostClient.SECRETS_WAIT_MS);
|
|
22525
22530
|
});
|
|
22526
22531
|
};
|
|
22527
22532
|
const connections = () => {
|
|
@@ -22538,9 +22543,9 @@ var HostClient = class _HostClient {
|
|
|
22538
22543
|
return value;
|
|
22539
22544
|
};
|
|
22540
22545
|
if (entry.value) return Promise.resolve(capture(entry.value));
|
|
22541
|
-
return new Promise((
|
|
22542
|
-
entry.resolvers.push((value) =>
|
|
22543
|
-
setTimeout(() =>
|
|
22546
|
+
return new Promise((resolve18) => {
|
|
22547
|
+
entry.resolvers.push((value) => resolve18(capture(value)));
|
|
22548
|
+
setTimeout(() => resolve18(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
|
|
22544
22549
|
});
|
|
22545
22550
|
};
|
|
22546
22551
|
const providers = () => {
|
|
@@ -22557,9 +22562,9 @@ var HostClient = class _HostClient {
|
|
|
22557
22562
|
return value;
|
|
22558
22563
|
};
|
|
22559
22564
|
if (entry.value !== void 0) return Promise.resolve(capture(entry.value));
|
|
22560
|
-
return new Promise((
|
|
22561
|
-
entry.resolvers.push((value) =>
|
|
22562
|
-
setTimeout(() =>
|
|
22565
|
+
return new Promise((resolve18) => {
|
|
22566
|
+
entry.resolvers.push((value) => resolve18(capture(value)));
|
|
22567
|
+
setTimeout(() => resolve18(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
|
|
22563
22568
|
});
|
|
22564
22569
|
};
|
|
22565
22570
|
const linear = async () => {
|
|
@@ -22585,13 +22590,13 @@ var HostClient = class _HostClient {
|
|
|
22585
22590
|
payload: safe(payload, 5e4),
|
|
22586
22591
|
...questionChoices ? { questionChoices: [...questionChoices] } : {}
|
|
22587
22592
|
});
|
|
22588
|
-
return new Promise((
|
|
22593
|
+
return new Promise((resolve18) => {
|
|
22589
22594
|
const waiters = this.approvalWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
|
|
22590
22595
|
this.approvalWaiters.set(cancelKey, waiters);
|
|
22591
|
-
waiters.set(requestId,
|
|
22596
|
+
waiters.set(requestId, resolve18);
|
|
22592
22597
|
void cancelledPromise.then(() => {
|
|
22593
22598
|
if (waiters.delete(requestId)) {
|
|
22594
|
-
|
|
22599
|
+
resolve18({ approved: false, guidance: "task was cancelled" });
|
|
22595
22600
|
}
|
|
22596
22601
|
});
|
|
22597
22602
|
});
|
|
@@ -22637,11 +22642,11 @@ var HostClient = class _HostClient {
|
|
|
22637
22642
|
if (existing) message = existing;
|
|
22638
22643
|
else terminalMessages.set(requestId, message);
|
|
22639
22644
|
}
|
|
22640
|
-
return new Promise((
|
|
22645
|
+
return new Promise((resolve18) => {
|
|
22641
22646
|
const waiters = this.agentOpWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
|
|
22642
22647
|
this.agentOpWaiters.set(cancelKey, waiters);
|
|
22643
22648
|
if (waiters.has(requestId)) {
|
|
22644
|
-
|
|
22649
|
+
resolve18({ ok: false, error: "provider settlement request is already in flight" });
|
|
22645
22650
|
return;
|
|
22646
22651
|
}
|
|
22647
22652
|
const timer = setTimeout(() => {
|
|
@@ -22652,7 +22657,7 @@ var HostClient = class _HostClient {
|
|
|
22652
22657
|
(pending) => !(pending.type === "agent.op" && pending.requestId === requestId)
|
|
22653
22658
|
);
|
|
22654
22659
|
}
|
|
22655
|
-
|
|
22660
|
+
resolve18({
|
|
22656
22661
|
ok: false,
|
|
22657
22662
|
error: terminal ? "The provider call completed, but Zixt could not record its outcome. Do not retry; wait for reconciliation." : "the platform did not answer in time; verify with a list_* tool before retrying a mutating call"
|
|
22658
22663
|
});
|
|
@@ -22660,7 +22665,7 @@ var HostClient = class _HostClient {
|
|
|
22660
22665
|
}, _HostClient.AGENT_OP_TIMEOUT_MS);
|
|
22661
22666
|
timer.unref?.();
|
|
22662
22667
|
waiters.set(requestId, {
|
|
22663
|
-
resolve:
|
|
22668
|
+
resolve: resolve18,
|
|
22664
22669
|
timer,
|
|
22665
22670
|
...terminal ? { terminalMessage: message } : {}
|
|
22666
22671
|
});
|
|
@@ -22706,12 +22711,12 @@ var HostClient = class _HostClient {
|
|
|
22706
22711
|
"No GitHub change was attempted; the authority grant request was invalid."
|
|
22707
22712
|
);
|
|
22708
22713
|
}
|
|
22709
|
-
const outcome = await new Promise((
|
|
22714
|
+
const outcome = await new Promise((resolve18) => {
|
|
22710
22715
|
const timer = setTimeout(() => {
|
|
22711
22716
|
const waiter = this.operationGrantWaiters.get(requestId);
|
|
22712
22717
|
if (!waiter) return;
|
|
22713
22718
|
this.operationGrantWaiters.delete(requestId);
|
|
22714
|
-
|
|
22719
|
+
resolve18({ grant: null, retryable: true, reason: "no_reply_from_zixt" });
|
|
22715
22720
|
}, this.operationGrantTimeoutMs);
|
|
22716
22721
|
timer.unref?.();
|
|
22717
22722
|
this.operationGrantWaiters.set(requestId, {
|
|
@@ -22724,9 +22729,9 @@ var HostClient = class _HostClient {
|
|
|
22724
22729
|
timer,
|
|
22725
22730
|
accept: (grant) => {
|
|
22726
22731
|
addSensitiveValues(providerGrantSensitiveValues(grant));
|
|
22727
|
-
|
|
22732
|
+
resolve18({ grant });
|
|
22728
22733
|
},
|
|
22729
|
-
deny: (retryable, reason, detail, retryAt, retryCode) =>
|
|
22734
|
+
deny: (retryable, reason, detail, retryAt, retryCode) => resolve18({
|
|
22730
22735
|
grant: null,
|
|
22731
22736
|
retryable,
|
|
22732
22737
|
reason,
|
|
@@ -22740,7 +22745,7 @@ var HostClient = class _HostClient {
|
|
|
22740
22745
|
} catch {
|
|
22741
22746
|
clearTimeout(timer);
|
|
22742
22747
|
this.operationGrantWaiters.delete(requestId);
|
|
22743
|
-
|
|
22748
|
+
resolve18({ grant: null, retryable: false, reason: "connection_unavailable" });
|
|
22744
22749
|
}
|
|
22745
22750
|
});
|
|
22746
22751
|
if (outcome.grant) {
|
|
@@ -22796,7 +22801,7 @@ var HostClient = class _HostClient {
|
|
|
22796
22801
|
)
|
|
22797
22802
|
);
|
|
22798
22803
|
}
|
|
22799
|
-
return new Promise((
|
|
22804
|
+
return new Promise((resolve18, reject3) => {
|
|
22800
22805
|
const timer = setTimeout(() => {
|
|
22801
22806
|
if (this.browserCredentialWaiters.delete(requestId)) {
|
|
22802
22807
|
reject3(
|
|
@@ -22815,7 +22820,7 @@ var HostClient = class _HostClient {
|
|
|
22815
22820
|
timer,
|
|
22816
22821
|
accept: (credential) => {
|
|
22817
22822
|
addSensitiveValues(webLoginSensitiveValues(credential));
|
|
22818
|
-
|
|
22823
|
+
resolve18(credential);
|
|
22819
22824
|
},
|
|
22820
22825
|
deny: (reason) => reject3(new Error(reason))
|
|
22821
22826
|
});
|
|
@@ -23136,14 +23141,14 @@ async function observeWindowsGuardianNonce(pid, nonce) {
|
|
|
23136
23141
|
"Windows runner identity could not be observed"
|
|
23137
23142
|
);
|
|
23138
23143
|
}
|
|
23139
|
-
return new Promise((
|
|
23144
|
+
return new Promise((resolve18, reject3) => {
|
|
23140
23145
|
let done = false;
|
|
23141
23146
|
const finish = (result) => {
|
|
23142
23147
|
if (done) return;
|
|
23143
23148
|
done = true;
|
|
23144
23149
|
clearTimeout(timeout);
|
|
23145
23150
|
if (result instanceof Error) reject3(result);
|
|
23146
|
-
else
|
|
23151
|
+
else resolve18(result);
|
|
23147
23152
|
};
|
|
23148
23153
|
const timeout = setTimeout(
|
|
23149
23154
|
() => finish(
|
|
@@ -23188,7 +23193,7 @@ async function observePosixGuardianNonce(pid, nonce) {
|
|
|
23188
23193
|
);
|
|
23189
23194
|
}
|
|
23190
23195
|
}
|
|
23191
|
-
return new Promise((
|
|
23196
|
+
return new Promise((resolve18, reject3) => {
|
|
23192
23197
|
const observer = spawn2("/bin/ps", ["-ww", "-o", "command=", "-p", String(pid)], {
|
|
23193
23198
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23194
23199
|
});
|
|
@@ -23199,7 +23204,7 @@ async function observePosixGuardianNonce(pid, nonce) {
|
|
|
23199
23204
|
done = true;
|
|
23200
23205
|
clearTimeout(timeout);
|
|
23201
23206
|
if (result instanceof Error) reject3(result);
|
|
23202
|
-
else
|
|
23207
|
+
else resolve18(result);
|
|
23203
23208
|
};
|
|
23204
23209
|
const timeout = setTimeout(() => {
|
|
23205
23210
|
observer.kill("SIGKILL");
|
|
@@ -23246,7 +23251,7 @@ async function observeGuardianIdentity(pid, identity) {
|
|
|
23246
23251
|
return process.platform === "win32" ? observeWindowsGuardianNonce(pid, identity.nonce) : observePosixGuardianNonce(pid, identity.nonce);
|
|
23247
23252
|
}
|
|
23248
23253
|
function delay(ms) {
|
|
23249
|
-
return new Promise((
|
|
23254
|
+
return new Promise((resolve18) => setTimeout(resolve18, ms));
|
|
23250
23255
|
}
|
|
23251
23256
|
function posixProcessRecordsFromPs(output) {
|
|
23252
23257
|
const records = [];
|
|
@@ -23279,7 +23284,7 @@ function posixProcessRecordsFromPs(output) {
|
|
|
23279
23284
|
return records;
|
|
23280
23285
|
}
|
|
23281
23286
|
async function snapshotPosixProcesses() {
|
|
23282
|
-
return new Promise((
|
|
23287
|
+
return new Promise((resolve18, reject3) => {
|
|
23283
23288
|
const observer = spawn2("/bin/ps", ["-axo", "uid=,pid=,ppid=,pgid=,stat="], {
|
|
23284
23289
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23285
23290
|
});
|
|
@@ -23292,7 +23297,7 @@ async function snapshotPosixProcesses() {
|
|
|
23292
23297
|
if (error52) reject3(error52);
|
|
23293
23298
|
else {
|
|
23294
23299
|
try {
|
|
23295
|
-
|
|
23300
|
+
resolve18(posixProcessRecordsFromPs(output));
|
|
23296
23301
|
} catch (caught) {
|
|
23297
23302
|
reject3(caught);
|
|
23298
23303
|
}
|
|
@@ -23627,7 +23632,7 @@ async function snapshotWindowsDescendants(rootPid) {
|
|
|
23627
23632
|
"Windows process-tree observation could not start"
|
|
23628
23633
|
);
|
|
23629
23634
|
}
|
|
23630
|
-
return new Promise((
|
|
23635
|
+
return new Promise((resolve18, reject3) => {
|
|
23631
23636
|
let done = false;
|
|
23632
23637
|
const timeout = setTimeout(() => {
|
|
23633
23638
|
if (done) return;
|
|
@@ -23654,7 +23659,7 @@ async function snapshotWindowsDescendants(rootPid) {
|
|
|
23654
23659
|
return;
|
|
23655
23660
|
}
|
|
23656
23661
|
try {
|
|
23657
|
-
|
|
23662
|
+
resolve18(completeWindowsDescendantPids(rootPid, processes));
|
|
23658
23663
|
} catch (caught) {
|
|
23659
23664
|
reject3(caught);
|
|
23660
23665
|
}
|
|
@@ -23701,7 +23706,7 @@ async function waitForProcessesExit(pids, timeoutMs) {
|
|
|
23701
23706
|
}
|
|
23702
23707
|
async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, independentlyTrackedPids = []) {
|
|
23703
23708
|
const trustedCommand = command ?? defaultTaskkillCommand();
|
|
23704
|
-
const result = await new Promise((
|
|
23709
|
+
const result = await new Promise((resolve18, reject3) => {
|
|
23705
23710
|
const killer = spawn2(trustedCommand, ["/PID", String(pid), "/T", "/F"], {
|
|
23706
23711
|
stdio: ["ignore", "pipe", "pipe"],
|
|
23707
23712
|
windowsHide: true
|
|
@@ -23736,7 +23741,7 @@ async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, indepe
|
|
|
23736
23741
|
done = true;
|
|
23737
23742
|
clearTimeout(timeout);
|
|
23738
23743
|
if (error52) reject3(error52);
|
|
23739
|
-
else
|
|
23744
|
+
else resolve18({ code: killer.exitCode, output, outputTruncated });
|
|
23740
23745
|
};
|
|
23741
23746
|
killer.once(
|
|
23742
23747
|
"error",
|
|
@@ -24430,12 +24435,12 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24430
24435
|
stderr = `${stderr}${String(chunk)}`.slice(-HELPER_OUTPUT_LIMIT);
|
|
24431
24436
|
});
|
|
24432
24437
|
const helperEvents = helper;
|
|
24433
|
-
const exited = new Promise((
|
|
24438
|
+
const exited = new Promise((resolve18) => {
|
|
24434
24439
|
let completed = false;
|
|
24435
24440
|
const complete = (code, signal) => {
|
|
24436
24441
|
if (completed) return;
|
|
24437
24442
|
completed = true;
|
|
24438
|
-
|
|
24443
|
+
resolve18({ code, signal });
|
|
24439
24444
|
};
|
|
24440
24445
|
helperEvents.once("error", () => {
|
|
24441
24446
|
failProtocol(new Error("Windows Job Object helper could not start"));
|
|
@@ -24448,7 +24453,7 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24448
24453
|
});
|
|
24449
24454
|
const nextLine = async (expected) => {
|
|
24450
24455
|
if (protocolFailure) throw protocolFailure;
|
|
24451
|
-
const line = lines.shift() ?? await new Promise((
|
|
24456
|
+
const line = lines.shift() ?? await new Promise((resolve18, reject3) => {
|
|
24452
24457
|
const timer = setTimeout(
|
|
24453
24458
|
() => reject3(timeoutError("Windows Job Object helper did not answer in time")),
|
|
24454
24459
|
timeoutMs
|
|
@@ -24456,7 +24461,7 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24456
24461
|
timer.unref?.();
|
|
24457
24462
|
lineWaiters.push((value) => {
|
|
24458
24463
|
clearTimeout(timer);
|
|
24459
|
-
|
|
24464
|
+
resolve18(value);
|
|
24460
24465
|
});
|
|
24461
24466
|
});
|
|
24462
24467
|
if (protocolFailure) throw protocolFailure;
|
|
@@ -24469,8 +24474,8 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24469
24474
|
}
|
|
24470
24475
|
const stopped = await Promise.race([
|
|
24471
24476
|
exited.then(() => true),
|
|
24472
|
-
new Promise((
|
|
24473
|
-
const timer = setTimeout(() =>
|
|
24477
|
+
new Promise((resolve18) => {
|
|
24478
|
+
const timer = setTimeout(() => resolve18(false), timeoutMs);
|
|
24474
24479
|
timer.unref?.();
|
|
24475
24480
|
})
|
|
24476
24481
|
]);
|
|
@@ -24529,7 +24534,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
|
|
|
24529
24534
|
if (nonce === void 0) return true;
|
|
24530
24535
|
if (!SAFE_NONCE2.test(nonce)) return false;
|
|
24531
24536
|
const expected = windowsContainmentGate(nonce).trimEnd();
|
|
24532
|
-
return new Promise((
|
|
24537
|
+
return new Promise((resolve18) => {
|
|
24533
24538
|
let pending = Buffer.alloc(0);
|
|
24534
24539
|
let settled = false;
|
|
24535
24540
|
const finish = (result) => {
|
|
@@ -24540,7 +24545,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
|
|
|
24540
24545
|
input.off("end", onEnd);
|
|
24541
24546
|
input.off("error", onEnd);
|
|
24542
24547
|
if (result) input.pause();
|
|
24543
|
-
|
|
24548
|
+
resolve18(result);
|
|
24544
24549
|
};
|
|
24545
24550
|
const onData = (chunk) => {
|
|
24546
24551
|
pending = Buffer.concat([pending, chunk]);
|
|
@@ -25068,15 +25073,15 @@ async function syncRunRegistryDirectory(path) {
|
|
|
25068
25073
|
await handle.close();
|
|
25069
25074
|
}
|
|
25070
25075
|
}
|
|
25071
|
-
async function ensureDurableRunRegistryRoot(registryRoot,
|
|
25076
|
+
async function ensureDurableRunRegistryRoot(registryRoot, syncDirectory8) {
|
|
25072
25077
|
const firstCreated = await mkdir3(registryRoot, { recursive: true, mode: DIRECTORY_MODE });
|
|
25073
25078
|
if (firstCreated && process.platform !== "win32") {
|
|
25074
25079
|
const first = resolve4(firstCreated);
|
|
25075
25080
|
const target = resolve4(registryRoot);
|
|
25076
|
-
await
|
|
25081
|
+
await syncDirectory8(dirname3(first));
|
|
25077
25082
|
let current = first;
|
|
25078
25083
|
for (const part of relative3(first, target).split(sep3).filter(Boolean)) {
|
|
25079
|
-
await
|
|
25084
|
+
await syncDirectory8(current);
|
|
25080
25085
|
current = join6(current, part);
|
|
25081
25086
|
}
|
|
25082
25087
|
}
|
|
@@ -25088,8 +25093,8 @@ async function recordRunAssignment(runToken, record2, registryRoot = defaultRunR
|
|
|
25088
25093
|
const temporary = join6(registryRoot, `.${runToken}.${process.pid}.${Date.now()}.tmp`);
|
|
25089
25094
|
let handle;
|
|
25090
25095
|
try {
|
|
25091
|
-
const
|
|
25092
|
-
await ensureDurableRunRegistryRoot(registryRoot,
|
|
25096
|
+
const syncDirectory8 = options.syncDirectory ?? syncRunRegistryDirectory;
|
|
25097
|
+
await ensureDurableRunRegistryRoot(registryRoot, syncDirectory8);
|
|
25093
25098
|
handle = await open3(temporary, "wx", FILE_MODE);
|
|
25094
25099
|
await handle.writeFile(JSON.stringify(record2), "utf8");
|
|
25095
25100
|
await handle.sync();
|
|
@@ -25097,7 +25102,7 @@ async function recordRunAssignment(runToken, record2, registryRoot = defaultRunR
|
|
|
25097
25102
|
handle = void 0;
|
|
25098
25103
|
await rename2(temporary, destination);
|
|
25099
25104
|
if (process.platform !== "win32") {
|
|
25100
|
-
await
|
|
25105
|
+
await syncDirectory8(registryRoot);
|
|
25101
25106
|
}
|
|
25102
25107
|
return true;
|
|
25103
25108
|
} catch {
|
|
@@ -25623,7 +25628,7 @@ async function installRelease(version2, options = {}) {
|
|
|
25623
25628
|
installerContainmentSetupError = error52;
|
|
25624
25629
|
return null;
|
|
25625
25630
|
}) : Promise.resolve(null);
|
|
25626
|
-
const installed = await new Promise((
|
|
25631
|
+
const installed = await new Promise((resolve18, reject3) => {
|
|
25627
25632
|
let finished = false;
|
|
25628
25633
|
let cleanupStarted = false;
|
|
25629
25634
|
let exitObserved = false;
|
|
@@ -25639,7 +25644,7 @@ async function installRelease(version2, options = {}) {
|
|
|
25639
25644
|
finished = true;
|
|
25640
25645
|
clearTimeout(timer);
|
|
25641
25646
|
options.signal?.removeEventListener("abort", requestCleanup);
|
|
25642
|
-
|
|
25647
|
+
resolve18(result);
|
|
25643
25648
|
};
|
|
25644
25649
|
const requestCleanup = () => {
|
|
25645
25650
|
if (cleanupStarted || finished) return;
|
|
@@ -25953,11 +25958,11 @@ async function runWorkerCompatibilityProxy(env = process.env, argv = process.arg
|
|
|
25953
25958
|
child.stdin?.on("error", () => {
|
|
25954
25959
|
});
|
|
25955
25960
|
process.stdin.pipe(child.stdin);
|
|
25956
|
-
return new Promise((
|
|
25957
|
-
child.once("error", () =>
|
|
25961
|
+
return new Promise((resolve18) => {
|
|
25962
|
+
child.once("error", () => resolve18(1));
|
|
25958
25963
|
child.once("exit", (code) => {
|
|
25959
25964
|
process.stdin.unpipe(child.stdin);
|
|
25960
|
-
|
|
25965
|
+
resolve18(code ?? 1);
|
|
25961
25966
|
});
|
|
25962
25967
|
});
|
|
25963
25968
|
}
|
|
@@ -26037,11 +26042,11 @@ async function launchHostSupervisor(options = {}) {
|
|
|
26037
26042
|
const waitOrStop = async (ms) => {
|
|
26038
26043
|
if (stopping) return false;
|
|
26039
26044
|
if (!customDelay) {
|
|
26040
|
-
await new Promise((
|
|
26045
|
+
await new Promise((resolve18) => {
|
|
26041
26046
|
const finish = () => {
|
|
26042
26047
|
clearTimeout(timer);
|
|
26043
26048
|
stopController.signal.removeEventListener("abort", finish);
|
|
26044
|
-
|
|
26049
|
+
resolve18();
|
|
26045
26050
|
};
|
|
26046
26051
|
const timer = setTimeout(finish, ms);
|
|
26047
26052
|
stopController.signal.addEventListener("abort", finish, { once: true });
|
|
@@ -26049,8 +26054,8 @@ async function launchHostSupervisor(options = {}) {
|
|
|
26049
26054
|
return !stopping;
|
|
26050
26055
|
}
|
|
26051
26056
|
let finishStop;
|
|
26052
|
-
const stopped = new Promise((
|
|
26053
|
-
finishStop = () =>
|
|
26057
|
+
const stopped = new Promise((resolve18) => {
|
|
26058
|
+
finishStop = () => resolve18();
|
|
26054
26059
|
stopController.signal.addEventListener("abort", finishStop, { once: true });
|
|
26055
26060
|
});
|
|
26056
26061
|
await Promise.race([customDelay(ms), stopped]);
|
|
@@ -26180,19 +26185,19 @@ async function launchHostSupervisor(options = {}) {
|
|
|
26180
26185
|
child = spawnSupervisor(entry, version2, ownershipDirectory, containmentGateNonce);
|
|
26181
26186
|
const launchedSupervisor = child;
|
|
26182
26187
|
let resolveChildExited;
|
|
26183
|
-
const childExited = new Promise((
|
|
26184
|
-
resolveChildExited =
|
|
26188
|
+
const childExited = new Promise((resolve18) => {
|
|
26189
|
+
resolveChildExited = resolve18;
|
|
26185
26190
|
});
|
|
26186
26191
|
const supervisorContainmentAbort = new AbortController();
|
|
26187
26192
|
void childExited.then(() => supervisorContainmentAbort.abort());
|
|
26188
26193
|
const outcomePromise = new Promise(
|
|
26189
|
-
(
|
|
26194
|
+
(resolve18) => {
|
|
26190
26195
|
let observed = false;
|
|
26191
26196
|
const finish = (code, signal) => {
|
|
26192
26197
|
if (observed) return;
|
|
26193
26198
|
observed = true;
|
|
26194
26199
|
resolveChildExited();
|
|
26195
|
-
|
|
26200
|
+
resolve18({ code, signal });
|
|
26196
26201
|
};
|
|
26197
26202
|
child.once("error", () => finish(1, null));
|
|
26198
26203
|
child.once("exit", finish);
|
|
@@ -26213,12 +26218,12 @@ async function launchHostSupervisor(options = {}) {
|
|
|
26213
26218
|
if (!supervisorContainment || !launchedSupervisor.stdin) {
|
|
26214
26219
|
throw new Error("supervisor Job Object gate is unavailable");
|
|
26215
26220
|
}
|
|
26216
|
-
await new Promise((
|
|
26221
|
+
await new Promise((resolve18, reject3) => {
|
|
26217
26222
|
launchedSupervisor.stdin.write(
|
|
26218
26223
|
windowsContainmentGate(containmentGateNonce),
|
|
26219
26224
|
(error52) => {
|
|
26220
26225
|
if (error52) reject3(error52);
|
|
26221
|
-
else
|
|
26226
|
+
else resolve18();
|
|
26222
26227
|
}
|
|
26223
26228
|
);
|
|
26224
26229
|
});
|
|
@@ -26360,18 +26365,18 @@ async function superviseHost(options = {}) {
|
|
|
26360
26365
|
}
|
|
26361
26366
|
}
|
|
26362
26367
|
let announceShutdown;
|
|
26363
|
-
const shutdownAnnounced = new Promise((
|
|
26364
|
-
announceShutdown =
|
|
26368
|
+
const shutdownAnnounced = new Promise((resolve18) => {
|
|
26369
|
+
announceShutdown = resolve18;
|
|
26365
26370
|
});
|
|
26366
26371
|
const attempted = /* @__PURE__ */ new Set();
|
|
26367
26372
|
const waitOrShutdown = async (ms) => {
|
|
26368
26373
|
if (shuttingDown2) return false;
|
|
26369
26374
|
if (!customDelay) {
|
|
26370
|
-
await new Promise((
|
|
26375
|
+
await new Promise((resolve18) => {
|
|
26371
26376
|
const finish = () => {
|
|
26372
26377
|
clearTimeout(timer);
|
|
26373
26378
|
shutdownController.signal.removeEventListener("abort", finish);
|
|
26374
|
-
|
|
26379
|
+
resolve18();
|
|
26375
26380
|
};
|
|
26376
26381
|
const timer = setTimeout(finish, ms);
|
|
26377
26382
|
shutdownController.signal.addEventListener("abort", finish, { once: true });
|
|
@@ -26514,19 +26519,19 @@ async function superviseHost(options = {}) {
|
|
|
26514
26519
|
child = spawnWorker(command, watchdogLaunch, compatibilityOwnership, containmentGateNonce);
|
|
26515
26520
|
const watchedChild = child;
|
|
26516
26521
|
let resolveChildExited;
|
|
26517
|
-
const childExited = new Promise((
|
|
26518
|
-
resolveChildExited =
|
|
26522
|
+
const childExited = new Promise((resolve18) => {
|
|
26523
|
+
resolveChildExited = resolve18;
|
|
26519
26524
|
});
|
|
26520
26525
|
const workerContainmentAbort = new AbortController();
|
|
26521
26526
|
void childExited.then(() => workerContainmentAbort.abort());
|
|
26522
26527
|
const outcomePromise = new Promise(
|
|
26523
|
-
(
|
|
26528
|
+
(resolve18) => {
|
|
26524
26529
|
let observed = false;
|
|
26525
26530
|
const finish = (result) => {
|
|
26526
26531
|
if (observed) return;
|
|
26527
26532
|
observed = true;
|
|
26528
26533
|
resolveChildExited();
|
|
26529
|
-
|
|
26534
|
+
resolve18(result);
|
|
26530
26535
|
};
|
|
26531
26536
|
watchedChild.once("error", () => finish({ code: 1, signal: null }));
|
|
26532
26537
|
watchedChild.once(
|
|
@@ -26548,10 +26553,10 @@ async function superviseHost(options = {}) {
|
|
|
26548
26553
|
if (!workerContainment || !watchedChild.stdin) {
|
|
26549
26554
|
throw new Error("worker Job Object gate is unavailable");
|
|
26550
26555
|
}
|
|
26551
|
-
await new Promise((
|
|
26556
|
+
await new Promise((resolve18, reject3) => {
|
|
26552
26557
|
watchedChild.stdin.write(windowsContainmentGate(containmentGateNonce), (error52) => {
|
|
26553
26558
|
if (error52) reject3(error52);
|
|
26554
|
-
else
|
|
26559
|
+
else resolve18();
|
|
26555
26560
|
});
|
|
26556
26561
|
});
|
|
26557
26562
|
}
|
|
@@ -26815,7 +26820,7 @@ async function superviseHost(options = {}) {
|
|
|
26815
26820
|
}
|
|
26816
26821
|
|
|
26817
26822
|
// src/index.ts
|
|
26818
|
-
import { homedir as
|
|
26823
|
+
import { homedir as homedir13, hostname as hostname3 } from "node:os";
|
|
26819
26824
|
|
|
26820
26825
|
// src/hardware.ts
|
|
26821
26826
|
import { existsSync } from "node:fs";
|
|
@@ -31153,8 +31158,8 @@ async function runGit(input, args, env) {
|
|
|
31153
31158
|
let settled = false;
|
|
31154
31159
|
let stopping = false;
|
|
31155
31160
|
let resolveExited;
|
|
31156
|
-
const exited = new Promise((
|
|
31157
|
-
resolveExited =
|
|
31161
|
+
const exited = new Promise((resolve18) => {
|
|
31162
|
+
resolveExited = resolve18;
|
|
31158
31163
|
});
|
|
31159
31164
|
child.once("exit", resolveExited);
|
|
31160
31165
|
const cleanup = () => {
|
|
@@ -33642,8 +33647,8 @@ var linearToolPackFactory = {
|
|
|
33642
33647
|
async create(grant, context) {
|
|
33643
33648
|
let resolveCancelled;
|
|
33644
33649
|
let closed = false;
|
|
33645
|
-
const cancelled = new Promise((
|
|
33646
|
-
resolveCancelled =
|
|
33650
|
+
const cancelled = new Promise((resolve18) => {
|
|
33651
|
+
resolveCancelled = resolve18;
|
|
33647
33652
|
});
|
|
33648
33653
|
const cancel = () => {
|
|
33649
33654
|
if (closed) return;
|
|
@@ -34443,7 +34448,7 @@ function createAskUserServer() {
|
|
|
34443
34448
|
let server;
|
|
34444
34449
|
let listening;
|
|
34445
34450
|
function ensureListening() {
|
|
34446
|
-
listening ??= new Promise((
|
|
34451
|
+
listening ??= new Promise((resolve18, reject3) => {
|
|
34447
34452
|
server = createServer2((req, res) => {
|
|
34448
34453
|
res.on("error", () => {
|
|
34449
34454
|
});
|
|
@@ -34459,7 +34464,7 @@ function createAskUserServer() {
|
|
|
34459
34464
|
server.on("error", reject3);
|
|
34460
34465
|
server.listen(0, "127.0.0.1", () => {
|
|
34461
34466
|
const address = server.address();
|
|
34462
|
-
if (address && typeof address === "object")
|
|
34467
|
+
if (address && typeof address === "object") resolve18(address.port);
|
|
34463
34468
|
else reject3(new Error("ask_user server failed to bind"));
|
|
34464
34469
|
});
|
|
34465
34470
|
server.unref();
|
|
@@ -36901,7 +36906,7 @@ function runCliProcess(options) {
|
|
|
36901
36906
|
usage: { inputTokens: 0, outputTokens: 0 }
|
|
36902
36907
|
});
|
|
36903
36908
|
}
|
|
36904
|
-
return new Promise((
|
|
36909
|
+
return new Promise((resolve18) => {
|
|
36905
36910
|
const platform = options.platform ?? process.platform;
|
|
36906
36911
|
const containmentGateNonce = options.guardian && platform === "win32" ? randomUUID10() : void 0;
|
|
36907
36912
|
const child = options.guardian ? spawn8(
|
|
@@ -36963,7 +36968,7 @@ function runCliProcess(options) {
|
|
|
36963
36968
|
clearInterval(timer);
|
|
36964
36969
|
unregisterFollowUps?.();
|
|
36965
36970
|
parser.stop?.();
|
|
36966
|
-
|
|
36971
|
+
resolve18(result);
|
|
36967
36972
|
};
|
|
36968
36973
|
const terminate = (result) => {
|
|
36969
36974
|
if (settled || forcedResult) return;
|
|
@@ -37309,7 +37314,7 @@ async function readCodexSessionRuntime(input) {
|
|
|
37309
37314
|
}
|
|
37310
37315
|
var codexCatalogCache = /* @__PURE__ */ new Map();
|
|
37311
37316
|
async function loadCodexModelCatalog(command, prefixArgs, env) {
|
|
37312
|
-
const output = await new Promise((
|
|
37317
|
+
const output = await new Promise((resolve18) => {
|
|
37313
37318
|
const child = spawnCli(command, [...prefixArgs, "debug", "models"], {
|
|
37314
37319
|
stdio: ["ignore", "pipe", "ignore"],
|
|
37315
37320
|
windowsHide: true,
|
|
@@ -37324,7 +37329,7 @@ async function loadCodexModelCatalog(command, prefixArgs, env) {
|
|
|
37324
37329
|
if (settled) return;
|
|
37325
37330
|
settled = true;
|
|
37326
37331
|
clearTimeout(timer);
|
|
37327
|
-
|
|
37332
|
+
resolve18(value);
|
|
37328
37333
|
};
|
|
37329
37334
|
const timer = setTimeout(() => {
|
|
37330
37335
|
child.kill();
|
|
@@ -37429,8 +37434,8 @@ function createRuntimeReporter(input, sessionId) {
|
|
|
37429
37434
|
var EFFORT_READ_ATTEMPTS = 5;
|
|
37430
37435
|
var EFFORT_READ_INTERVAL_MS = 3e3;
|
|
37431
37436
|
function delay2(ms) {
|
|
37432
|
-
return new Promise((
|
|
37433
|
-
const timer = setTimeout(
|
|
37437
|
+
return new Promise((resolve18) => {
|
|
37438
|
+
const timer = setTimeout(resolve18, ms);
|
|
37434
37439
|
timer.unref?.();
|
|
37435
37440
|
});
|
|
37436
37441
|
}
|
|
@@ -37507,10 +37512,10 @@ function createClaudeLiveParser(onStream, onSessionModel) {
|
|
|
37507
37512
|
},
|
|
37508
37513
|
async steer(followUp) {
|
|
37509
37514
|
if (!write) return false;
|
|
37510
|
-
return await new Promise((
|
|
37511
|
-
acknowledgements.set(followUp.inputId,
|
|
37515
|
+
return await new Promise((resolve18) => {
|
|
37516
|
+
acknowledgements.set(followUp.inputId, resolve18);
|
|
37512
37517
|
void write(input(followUp.inputId, followUp.text)).catch(() => {
|
|
37513
|
-
if (acknowledgements.delete(followUp.inputId))
|
|
37518
|
+
if (acknowledgements.delete(followUp.inputId)) resolve18(false);
|
|
37514
37519
|
});
|
|
37515
37520
|
});
|
|
37516
37521
|
},
|
|
@@ -37817,8 +37822,8 @@ ${value}` : value;
|
|
|
37817
37822
|
var RUNTIME_READ_ATTEMPTS = 5;
|
|
37818
37823
|
var RUNTIME_READ_INTERVAL_MS = 2e3;
|
|
37819
37824
|
function delay3(ms) {
|
|
37820
|
-
return new Promise((
|
|
37821
|
-
const timer = setTimeout(
|
|
37825
|
+
return new Promise((resolve18) => {
|
|
37826
|
+
const timer = setTimeout(resolve18, ms);
|
|
37822
37827
|
timer.unref?.();
|
|
37823
37828
|
});
|
|
37824
37829
|
}
|
|
@@ -37857,7 +37862,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37857
37862
|
const turnReadyWaiters = /* @__PURE__ */ new Set();
|
|
37858
37863
|
const usage = () => ({ inputTokens, outputTokens });
|
|
37859
37864
|
const settleTurnReadiness = (ready) => {
|
|
37860
|
-
for (const
|
|
37865
|
+
for (const resolve18 of turnReadyWaiters) resolve18(ready);
|
|
37861
37866
|
turnReadyWaiters.clear();
|
|
37862
37867
|
};
|
|
37863
37868
|
const send = async (message) => {
|
|
@@ -38038,12 +38043,12 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
38038
38043
|
async steer(input) {
|
|
38039
38044
|
if (stopped) return false;
|
|
38040
38045
|
if (!activeTurnId) {
|
|
38041
|
-
const ready = await new Promise((
|
|
38046
|
+
const ready = await new Promise((resolve18) => turnReadyWaiters.add(resolve18));
|
|
38042
38047
|
if (!ready || stopped) return false;
|
|
38043
38048
|
}
|
|
38044
38049
|
if (!threadId || !activeTurnId) return false;
|
|
38045
|
-
return await new Promise((
|
|
38046
|
-
steerWaiters.set(input.inputId,
|
|
38050
|
+
return await new Promise((resolve18) => {
|
|
38051
|
+
steerWaiters.set(input.inputId, resolve18);
|
|
38047
38052
|
void send({
|
|
38048
38053
|
id: `steer:${input.inputId}`,
|
|
38049
38054
|
method: "turn/steer",
|
|
@@ -38054,7 +38059,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
38054
38059
|
clientUserMessageId: input.inputId
|
|
38055
38060
|
}
|
|
38056
38061
|
}).catch(() => {
|
|
38057
|
-
if (steerWaiters.delete(input.inputId))
|
|
38062
|
+
if (steerWaiters.delete(input.inputId)) resolve18(false);
|
|
38058
38063
|
});
|
|
38059
38064
|
});
|
|
38060
38065
|
},
|
|
@@ -38062,7 +38067,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
38062
38067
|
stopped = true;
|
|
38063
38068
|
write = null;
|
|
38064
38069
|
settleTurnReadiness(false);
|
|
38065
|
-
for (const
|
|
38070
|
+
for (const resolve18 of steerWaiters.values()) resolve18(false);
|
|
38066
38071
|
steerWaiters.clear();
|
|
38067
38072
|
},
|
|
38068
38073
|
push(chunk) {
|
|
@@ -38482,7 +38487,7 @@ function parseAuth(result) {
|
|
|
38482
38487
|
return "unknown";
|
|
38483
38488
|
}
|
|
38484
38489
|
function run2(command, args) {
|
|
38485
|
-
return new Promise((
|
|
38490
|
+
return new Promise((resolve18) => {
|
|
38486
38491
|
const child = spawnCli(command, args, {
|
|
38487
38492
|
stdio: ["ignore", "pipe", "pipe"],
|
|
38488
38493
|
windowsHide: true
|
|
@@ -38498,7 +38503,7 @@ function run2(command, args) {
|
|
|
38498
38503
|
if (settled) return;
|
|
38499
38504
|
settled = true;
|
|
38500
38505
|
clearTimeout(timeout);
|
|
38501
|
-
|
|
38506
|
+
resolve18(result);
|
|
38502
38507
|
};
|
|
38503
38508
|
const timeout = setTimeout(() => {
|
|
38504
38509
|
child.kill();
|
|
@@ -38542,7 +38547,7 @@ function boundedAppend(current, chunk) {
|
|
|
38542
38547
|
}
|
|
38543
38548
|
async function defaultRunCommand(command, args) {
|
|
38544
38549
|
const commandEnvironment3 = systemServiceCommandEnvironment();
|
|
38545
|
-
return new Promise((
|
|
38550
|
+
return new Promise((resolve18) => {
|
|
38546
38551
|
const child = spawn10(command, [...args], {
|
|
38547
38552
|
stdio: ["ignore", "pipe", "pipe"],
|
|
38548
38553
|
env: commandEnvironment3,
|
|
@@ -38556,7 +38561,7 @@ async function defaultRunCommand(command, args) {
|
|
|
38556
38561
|
if (settled) return;
|
|
38557
38562
|
settled = true;
|
|
38558
38563
|
if (timer) clearTimeout(timer);
|
|
38559
|
-
|
|
38564
|
+
resolve18(result);
|
|
38560
38565
|
};
|
|
38561
38566
|
child.stdout?.on("data", (chunk) => {
|
|
38562
38567
|
stdout = boundedAppend(stdout, chunk);
|
|
@@ -38614,22 +38619,22 @@ async function defaultSyncDirectory(path) {
|
|
|
38614
38619
|
await directory.close();
|
|
38615
38620
|
}
|
|
38616
38621
|
}
|
|
38617
|
-
async function ensureDirectory(path, mode,
|
|
38622
|
+
async function ensureDirectory(path, mode, syncDirectory8) {
|
|
38618
38623
|
const firstCreated = await mkdir12(path, { recursive: true, mode });
|
|
38619
38624
|
if (!firstCreated) return;
|
|
38620
38625
|
const first = resolve12(firstCreated);
|
|
38621
38626
|
const target = resolve12(path);
|
|
38622
|
-
await
|
|
38627
|
+
await syncDirectory8(dirname9(first));
|
|
38623
38628
|
let current = first;
|
|
38624
38629
|
const descendants = relative9(first, target);
|
|
38625
38630
|
for (const part of descendants ? descendants.split(sep5) : []) {
|
|
38626
|
-
await
|
|
38631
|
+
await syncDirectory8(current);
|
|
38627
38632
|
current = join17(current, part);
|
|
38628
38633
|
}
|
|
38629
38634
|
}
|
|
38630
|
-
async function replacePrivateFile(path, contents, mode,
|
|
38635
|
+
async function replacePrivateFile(path, contents, mode, syncDirectory8) {
|
|
38631
38636
|
const parent = dirname9(path);
|
|
38632
|
-
await ensureDirectory(parent, 448,
|
|
38637
|
+
await ensureDirectory(parent, 448, syncDirectory8);
|
|
38633
38638
|
const temporary = join17(parent, `.${basename4(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
38634
38639
|
const handle = await open7(temporary, "wx", mode);
|
|
38635
38640
|
try {
|
|
@@ -38638,7 +38643,7 @@ async function replacePrivateFile(path, contents, mode, syncDirectory7) {
|
|
|
38638
38643
|
await handle.close();
|
|
38639
38644
|
await rename6(temporary, path);
|
|
38640
38645
|
await chmod7(path, mode);
|
|
38641
|
-
await
|
|
38646
|
+
await syncDirectory8(parent);
|
|
38642
38647
|
} catch (error52) {
|
|
38643
38648
|
await handle.close().catch(() => void 0);
|
|
38644
38649
|
await rm8(temporary, { force: true }).catch(() => void 0);
|
|
@@ -38691,8 +38696,8 @@ async function installLinuxService(options) {
|
|
|
38691
38696
|
const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : activateInstalledRelease);
|
|
38692
38697
|
const resolveCommand = options.resolveCommand ?? defaultResolveCommand;
|
|
38693
38698
|
const run3 = options.runCommand ?? defaultRunCommand;
|
|
38694
|
-
const
|
|
38695
|
-
const stabilityDelay = options.delay ?? ((ms) => new Promise((
|
|
38699
|
+
const syncDirectory8 = options.syncDirectory ?? defaultSyncDirectory;
|
|
38700
|
+
const stabilityDelay = options.delay ?? ((ms) => new Promise((resolve18) => setTimeout(resolve18, ms)));
|
|
38696
38701
|
const [systemctl, loginctl] = await Promise.all([
|
|
38697
38702
|
resolveCommand("systemctl"),
|
|
38698
38703
|
resolveCommand("loginctl")
|
|
@@ -38719,7 +38724,7 @@ async function installLinuxService(options) {
|
|
|
38719
38724
|
);
|
|
38720
38725
|
}
|
|
38721
38726
|
}
|
|
38722
|
-
await ensureDirectory(configRoot, 448,
|
|
38727
|
+
await ensureDirectory(configRoot, 448, syncDirectory8);
|
|
38723
38728
|
await chmod7(configRoot, 448);
|
|
38724
38729
|
const serviceEnvironment = [
|
|
38725
38730
|
`ZIXT_HOST_TOKEN=${systemdEnvironmentValue(token2)}`,
|
|
@@ -38730,7 +38735,7 @@ async function installLinuxService(options) {
|
|
|
38730
38735
|
...env.ZIXT_HOST_VERSIONS_DIR ? [`ZIXT_HOST_VERSIONS_DIR=${systemdEnvironmentValue(env.ZIXT_HOST_VERSIONS_DIR)}`] : [],
|
|
38731
38736
|
""
|
|
38732
38737
|
].join("\n");
|
|
38733
|
-
await replacePrivateFile(environmentPath, serviceEnvironment, 384,
|
|
38738
|
+
await replacePrivateFile(environmentPath, serviceEnvironment, 384, syncDirectory8);
|
|
38734
38739
|
const unit = [
|
|
38735
38740
|
"[Unit]",
|
|
38736
38741
|
"Description=Zixt Host",
|
|
@@ -38752,7 +38757,7 @@ async function installLinuxService(options) {
|
|
|
38752
38757
|
"WantedBy=default.target",
|
|
38753
38758
|
""
|
|
38754
38759
|
].join("\n");
|
|
38755
|
-
await replacePrivateFile(unitPath, unit, 384,
|
|
38760
|
+
await replacePrivateFile(unitPath, unit, 384, syncDirectory8);
|
|
38756
38761
|
await requireSuccess(run3, systemctl, ["--user", "daemon-reload"], "Preparing Zixt startup");
|
|
38757
38762
|
await requireSuccess(
|
|
38758
38763
|
run3,
|
|
@@ -39555,6 +39560,120 @@ async function forgetSupersededTerminalOutcomes(hostId, taskId, epoch, root = de
|
|
|
39555
39560
|
if (removed) await syncDirectory6(hostOutcomeRoot(root, hostId));
|
|
39556
39561
|
}
|
|
39557
39562
|
|
|
39563
|
+
// src/accepted-assignments.ts
|
|
39564
|
+
import { chmod as chmod10, lstat as lstat13, mkdir as mkdir16, open as open11, readdir as readdir6, rename as rename10, rm as rm12 } from "node:fs/promises";
|
|
39565
|
+
import { homedir as homedir12 } from "node:os";
|
|
39566
|
+
import { dirname as dirname13, join as join21, relative as relative13, resolve as resolve16, sep as sep9 } from "node:path";
|
|
39567
|
+
var DIRECTORY_MODE6 = 448;
|
|
39568
|
+
var FILE_MODE5 = 384;
|
|
39569
|
+
var CLAIM_FILE = /^(tsk_[0-9a-f]{32})\.([1-9][0-9]*)\.json$/;
|
|
39570
|
+
var TASK_ID = /^tsk_[0-9a-f]{32}$/;
|
|
39571
|
+
function defaultAcceptedAssignmentRoot() {
|
|
39572
|
+
return join21(homedir12(), ".zixt", "accepted-assignments");
|
|
39573
|
+
}
|
|
39574
|
+
async function syncDirectory7(root) {
|
|
39575
|
+
if (process.platform === "win32") return;
|
|
39576
|
+
const handle = await open11(root, "r");
|
|
39577
|
+
try {
|
|
39578
|
+
await handle.sync();
|
|
39579
|
+
} finally {
|
|
39580
|
+
await handle.close();
|
|
39581
|
+
}
|
|
39582
|
+
}
|
|
39583
|
+
async function requirePrivateRoot2(root, sync = syncDirectory7) {
|
|
39584
|
+
const firstCreated = await mkdir16(root, { recursive: true, mode: DIRECTORY_MODE6 });
|
|
39585
|
+
if (firstCreated) {
|
|
39586
|
+
const first = resolve16(firstCreated);
|
|
39587
|
+
const target = resolve16(root);
|
|
39588
|
+
await sync(dirname13(first));
|
|
39589
|
+
let current = first;
|
|
39590
|
+
for (const part of relative13(first, target).split(sep9).filter(Boolean)) {
|
|
39591
|
+
await sync(current);
|
|
39592
|
+
current = join21(current, part);
|
|
39593
|
+
}
|
|
39594
|
+
}
|
|
39595
|
+
const stat3 = await lstat13(root);
|
|
39596
|
+
if (stat3.isSymbolicLink() || !stat3.isDirectory()) {
|
|
39597
|
+
throw new Error("accepted assignment journal root is not a trusted directory");
|
|
39598
|
+
}
|
|
39599
|
+
await chmod10(root, DIRECTORY_MODE6);
|
|
39600
|
+
}
|
|
39601
|
+
function claimPath(root, taskId, epoch) {
|
|
39602
|
+
if (!TASK_ID.test(taskId)) throw new Error("accepted assignment Task identity is malformed");
|
|
39603
|
+
if (!Number.isSafeInteger(epoch) || epoch < 1) {
|
|
39604
|
+
throw new Error("accepted assignment epoch is malformed");
|
|
39605
|
+
}
|
|
39606
|
+
return join21(root, `${taskId}.${epoch}.json`);
|
|
39607
|
+
}
|
|
39608
|
+
async function recordAcceptedAssignment(assignment, root = defaultAcceptedAssignmentRoot(), options = {}) {
|
|
39609
|
+
const sync = options.syncDirectory ?? syncDirectory7;
|
|
39610
|
+
let destination;
|
|
39611
|
+
try {
|
|
39612
|
+
destination = claimPath(root, assignment.taskId, assignment.epoch);
|
|
39613
|
+
} catch {
|
|
39614
|
+
return false;
|
|
39615
|
+
}
|
|
39616
|
+
const temporary = join21(
|
|
39617
|
+
root,
|
|
39618
|
+
`.${assignment.taskId}.${assignment.epoch}.${process.pid}.${Date.now()}.tmp`
|
|
39619
|
+
);
|
|
39620
|
+
let handle;
|
|
39621
|
+
try {
|
|
39622
|
+
await requirePrivateRoot2(root, sync);
|
|
39623
|
+
handle = await open11(temporary, "wx", FILE_MODE5);
|
|
39624
|
+
await handle.writeFile(JSON.stringify(assignment), "utf8");
|
|
39625
|
+
await handle.sync();
|
|
39626
|
+
await handle.close();
|
|
39627
|
+
handle = void 0;
|
|
39628
|
+
await rename10(temporary, destination);
|
|
39629
|
+
if (process.platform !== "win32") await sync(root);
|
|
39630
|
+
return true;
|
|
39631
|
+
} catch {
|
|
39632
|
+
return false;
|
|
39633
|
+
} finally {
|
|
39634
|
+
await handle?.close().catch(() => {
|
|
39635
|
+
});
|
|
39636
|
+
await rm12(temporary, { force: true }).catch(() => {
|
|
39637
|
+
});
|
|
39638
|
+
}
|
|
39639
|
+
}
|
|
39640
|
+
async function recoverAcceptedAssignments(root = defaultAcceptedAssignmentRoot()) {
|
|
39641
|
+
let rootStat;
|
|
39642
|
+
try {
|
|
39643
|
+
rootStat = await lstat13(root);
|
|
39644
|
+
} catch (error52) {
|
|
39645
|
+
if (error52.code === "ENOENT") return [];
|
|
39646
|
+
throw new Error("accepted assignment journal could not be observed");
|
|
39647
|
+
}
|
|
39648
|
+
if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
|
|
39649
|
+
throw new Error("accepted assignment journal root is not a trusted directory");
|
|
39650
|
+
}
|
|
39651
|
+
await chmod10(root, DIRECTORY_MODE6);
|
|
39652
|
+
const claims = [];
|
|
39653
|
+
for (const entry of await readdir6(root, { withFileTypes: true })) {
|
|
39654
|
+
if (!entry.isFile()) continue;
|
|
39655
|
+
const match = CLAIM_FILE.exec(entry.name);
|
|
39656
|
+
if (!match) continue;
|
|
39657
|
+
claims.push({ taskId: match[1], epoch: Number(match[2]) });
|
|
39658
|
+
}
|
|
39659
|
+
return claims.sort(
|
|
39660
|
+
(left, right) => left.taskId.localeCompare(right.taskId) || left.epoch - right.epoch
|
|
39661
|
+
);
|
|
39662
|
+
}
|
|
39663
|
+
async function forgetAcceptedAssignment(assignment, root = defaultAcceptedAssignmentRoot()) {
|
|
39664
|
+
let path;
|
|
39665
|
+
try {
|
|
39666
|
+
path = claimPath(root, assignment.taskId, assignment.epoch);
|
|
39667
|
+
} catch {
|
|
39668
|
+
return;
|
|
39669
|
+
}
|
|
39670
|
+
await rm12(path, { force: true }).catch(() => {
|
|
39671
|
+
});
|
|
39672
|
+
}
|
|
39673
|
+
async function forgetAcknowledgedAcceptedAssignments(assignments, root = defaultAcceptedAssignmentRoot()) {
|
|
39674
|
+
for (const assignment of assignments) await forgetAcceptedAssignment(assignment, root);
|
|
39675
|
+
}
|
|
39676
|
+
|
|
39558
39677
|
// src/logger.ts
|
|
39559
39678
|
var ANSI = {
|
|
39560
39679
|
reset: "\x1B[0m",
|
|
@@ -39657,22 +39776,23 @@ function createHostLogger(options = {}) {
|
|
|
39657
39776
|
}
|
|
39658
39777
|
|
|
39659
39778
|
// src/demo-state.ts
|
|
39660
|
-
import { isAbsolute as isAbsolute17, join as
|
|
39779
|
+
import { isAbsolute as isAbsolute17, join as join22, parse as parse3, resolve as resolve17 } from "node:path";
|
|
39661
39780
|
var DEMO_STATE_ROOT_ENV = "ZIXT_DEMO_STATE_ROOT";
|
|
39662
39781
|
function resolveDemoHostStatePaths(env = process.env) {
|
|
39663
39782
|
const configured = env.ZIXT_RUNNER === "demo" ? env[DEMO_STATE_ROOT_ENV] : void 0;
|
|
39664
39783
|
if (!configured) return null;
|
|
39665
|
-
const root =
|
|
39784
|
+
const root = resolve17(configured);
|
|
39666
39785
|
if (!isAbsolute17(configured) || root === parse3(root).root) {
|
|
39667
39786
|
throw new Error(`${DEMO_STATE_ROOT_ENV} must be a dedicated absolute directory`);
|
|
39668
39787
|
}
|
|
39669
39788
|
return {
|
|
39670
|
-
runRegistryRoot:
|
|
39671
|
-
terminalOutcomeRoot:
|
|
39672
|
-
|
|
39673
|
-
|
|
39674
|
-
|
|
39675
|
-
|
|
39789
|
+
runRegistryRoot: join22(root, "run-registry"),
|
|
39790
|
+
terminalOutcomeRoot: join22(root, "terminal-outcomes"),
|
|
39791
|
+
acceptedAssignmentRoot: join22(root, "accepted-assignments"),
|
|
39792
|
+
runArtifactRoot: join22(root, "run-artifacts"),
|
|
39793
|
+
browserProfileRoot: join22(root, "browser-profiles"),
|
|
39794
|
+
runnerWorkspaceRoot: join22(root, "workspaces"),
|
|
39795
|
+
codexThreadIndexRoot: join22(root, "codex-threads")
|
|
39676
39796
|
};
|
|
39677
39797
|
}
|
|
39678
39798
|
|
|
@@ -39906,15 +40026,18 @@ try {
|
|
|
39906
40026
|
var {
|
|
39907
40027
|
runRegistryRoot,
|
|
39908
40028
|
terminalOutcomeRoot,
|
|
40029
|
+
acceptedAssignmentRoot,
|
|
39909
40030
|
runArtifactRoot,
|
|
39910
40031
|
browserProfileRoot,
|
|
39911
40032
|
runnerWorkspaceRoot,
|
|
39912
40033
|
codexThreadIndexRoot
|
|
39913
40034
|
} = demoState ?? {};
|
|
39914
40035
|
var disclaimableAssignments;
|
|
40036
|
+
var acceptedAssignments;
|
|
39915
40037
|
var terminalOutcomes;
|
|
39916
40038
|
try {
|
|
39917
40039
|
disclaimableAssignments = await recoverRecordedRunAssignments(runRegistryRoot);
|
|
40040
|
+
acceptedAssignments = await recoverAcceptedAssignments(acceptedAssignmentRoot);
|
|
39918
40041
|
terminalOutcomes = await readTerminalOutcomesStrict(terminalOutcomeRoot);
|
|
39919
40042
|
} catch {
|
|
39920
40043
|
log.error("Previous Task recovery state could not be confirmed", {
|
|
@@ -39929,6 +40052,18 @@ var terminalOutcomeKeys = new Set(
|
|
|
39929
40052
|
disclaimableAssignments = disclaimableAssignments.filter(
|
|
39930
40053
|
(assignment) => !terminalOutcomeKeys.has(`${assignment.taskId}:${assignment.epoch}`)
|
|
39931
40054
|
);
|
|
40055
|
+
var helloUnwoundAssignments = [
|
|
40056
|
+
...disclaimableAssignments.map(({ taskId, epoch }) => ({ taskId, epoch }))
|
|
40057
|
+
];
|
|
40058
|
+
for (const accepted of acceptedAssignments) {
|
|
40059
|
+
if (terminalOutcomeKeys.has(`${accepted.taskId}:${accepted.epoch}`)) continue;
|
|
40060
|
+
if (helloUnwoundAssignments.some(
|
|
40061
|
+
(assignment) => assignment.taskId === accepted.taskId && assignment.epoch === accepted.epoch
|
|
40062
|
+
)) {
|
|
40063
|
+
continue;
|
|
40064
|
+
}
|
|
40065
|
+
helloUnwoundAssignments.push(accepted);
|
|
40066
|
+
}
|
|
39932
40067
|
await sweepOrphanedRunnerArtifacts(runArtifactRoot);
|
|
39933
40068
|
if (!token) {
|
|
39934
40069
|
log.error("Machine token is missing", {
|
|
@@ -40083,7 +40218,7 @@ async function telemetry() {
|
|
|
40083
40218
|
// Measured per heartbeat: free memory and free disk are only useful while
|
|
40084
40219
|
// they are current, and a demo Host reports its own private root so the
|
|
40085
40220
|
// number describes the filesystem its Tasks would really write to.
|
|
40086
|
-
hardware: await machineHardware(runnerWorkspaceRoot ??
|
|
40221
|
+
hardware: await machineHardware(runnerWorkspaceRoot ?? homedir13()),
|
|
40087
40222
|
capabilities: {
|
|
40088
40223
|
linearToolPack: providerToolPacks.some(
|
|
40089
40224
|
(pack) => pack.provider === "linear" && pack.health === "ready"
|
|
@@ -40209,9 +40344,16 @@ function requestHostUpdate() {
|
|
|
40209
40344
|
var client = new HostClient({
|
|
40210
40345
|
url: url2,
|
|
40211
40346
|
token,
|
|
40212
|
-
...
|
|
40347
|
+
...helloUnwoundAssignments.length > 0 ? { unwoundAssignments: helloUnwoundAssignments } : {},
|
|
40213
40348
|
...terminalOutcomes.length > 0 ? { terminalOutcomes } : {},
|
|
40214
|
-
onUnwoundAssignmentsAcknowledged: (assignments) =>
|
|
40349
|
+
onUnwoundAssignmentsAcknowledged: async (assignments) => {
|
|
40350
|
+
await Promise.all([
|
|
40351
|
+
forgetAcknowledgedRunAssignments(assignments, runRegistryRoot),
|
|
40352
|
+
forgetAcknowledgedAcceptedAssignments(assignments, acceptedAssignmentRoot)
|
|
40353
|
+
]);
|
|
40354
|
+
},
|
|
40355
|
+
persistAcceptedAssignment: (assignment) => recordAcceptedAssignment(assignment, acceptedAssignmentRoot).then(() => void 0),
|
|
40356
|
+
forgetAcceptedAssignment: (assignment) => forgetAcceptedAssignment(assignment, acceptedAssignmentRoot),
|
|
40215
40357
|
persistTerminalOutcome: (hostId, outcome) => recordTerminalOutcome(hostId, outcome, terminalOutcomeRoot),
|
|
40216
40358
|
onTerminalOutcomesAcknowledged: async (outcomes) => {
|
|
40217
40359
|
await Promise.all([
|