@jigging/jig 0.1.0-alpha.19 → 0.1.0-alpha.20
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/libexec/installed-cli.js +21 -3
- package/package.json +1 -1
package/libexec/installed-cli.js
CHANGED
|
@@ -7510,7 +7510,7 @@ import { setTimeout as delay } from "timers/promises";
|
|
|
7510
7510
|
// package.json
|
|
7511
7511
|
var package_default = {
|
|
7512
7512
|
name: "@jigging/jig",
|
|
7513
|
-
version: "0.1.0-alpha.
|
|
7513
|
+
version: "0.1.0-alpha.20",
|
|
7514
7514
|
description: "A local, secure host for admitted FLOW packages",
|
|
7515
7515
|
license: "SEE LICENSE IN LICENSE.md",
|
|
7516
7516
|
repository: {
|
|
@@ -41585,7 +41585,9 @@ async function executePrivateContainedEffect(input) {
|
|
|
41585
41585
|
} catch {
|
|
41586
41586
|
return failed2("UNAVAILABLE", "the admitted contained-operation runtime cannot be reproduced");
|
|
41587
41587
|
}
|
|
41588
|
-
const
|
|
41588
|
+
const ownDeadlineUnixMs = Date.now() + (prepared.kind === "http" ? prepared.value.grant.timeoutMs : PROJECT_COMMAND_LIMITS.timeoutMs);
|
|
41589
|
+
const deadlineUnixMs = Math.min(input.parentDeadlineUnixMs, input.parent.intent.deadlineUnixMs, ownDeadlineUnixMs);
|
|
41590
|
+
const deadlineLimit = privateContainedDeadlineLimit(prepared.kind, input.parent.intent.deadlineUnixMs, input.parentDeadlineUnixMs, ownDeadlineUnixMs);
|
|
41589
41591
|
if (deadlineUnixMs <= Date.now())
|
|
41590
41592
|
return failed2("DEADLINE_EXCEEDED", "the operation deadline elapsed before dispatch");
|
|
41591
41593
|
if (input.parentFlow !== undefined)
|
|
@@ -41637,6 +41639,7 @@ async function executePrivateContainedEffect(input) {
|
|
|
41637
41639
|
}
|
|
41638
41640
|
const files = [];
|
|
41639
41641
|
let attempted = false;
|
|
41642
|
+
let phase = "preparing input";
|
|
41640
41643
|
try {
|
|
41641
41644
|
for (const [path, source] of Object.entries(prepared.kind === "command" ? prepared.value.input.files : {})) {
|
|
41642
41645
|
const bytes = Buffer.from(source);
|
|
@@ -41654,10 +41657,14 @@ async function executePrivateContainedEffect(input) {
|
|
|
41654
41657
|
sandbox: sealed.identity
|
|
41655
41658
|
});
|
|
41656
41659
|
attempted = true;
|
|
41660
|
+
phase = "starting the worker";
|
|
41657
41661
|
const component = await sealed.admit(input.signal);
|
|
41658
41662
|
const stdin = prepared.kind === "command" ? prepared.value.input.stdin ?? "" : httpInput;
|
|
41663
|
+
phase = "collecting the worker result";
|
|
41659
41664
|
const observed = await collectEffect(component, stdin, prepared.kind === "http" ? JSON_1_LIMITS.bytes : PROJECT_COMMAND_LIMITS.streamBytes);
|
|
41665
|
+
phase = "fencing and cleanup";
|
|
41660
41666
|
await releaseEffect(input, lifecycle, observed.fence);
|
|
41667
|
+
phase = "checking the collected result";
|
|
41661
41668
|
const reason = observed.fence.stopReason;
|
|
41662
41669
|
if (!["payload_exit", "cancelled", "deadline"].includes(reason))
|
|
41663
41670
|
return failed2("UNCERTAIN", "the operation was fenced without a proved terminal; effects may have occurred");
|
|
@@ -41715,13 +41722,24 @@ async function executePrivateContainedEffect(input) {
|
|
|
41715
41722
|
if (input.signal.aborted)
|
|
41716
41723
|
return failed2("CANCELLED", "the contained operation was cancelled");
|
|
41717
41724
|
if (Date.now() >= deadlineUnixMs)
|
|
41718
|
-
return failed2("DEADLINE_EXCEEDED",
|
|
41725
|
+
return failed2("DEADLINE_EXCEEDED", privateContainedDeadlineMessage(prepared.kind, deadlineLimit, phase));
|
|
41719
41726
|
return failed2(attempted ? "UNCERTAIN" : "EXECUTION_FAILED", attempted ? "operation dispatch may have occurred but no result was proved" : "contained operation setup failed before dispatch");
|
|
41720
41727
|
} finally {
|
|
41721
41728
|
for (const file of files)
|
|
41722
41729
|
closeSync6(file.fd);
|
|
41723
41730
|
}
|
|
41724
41731
|
}
|
|
41732
|
+
function privateContainedDeadlineLimit(kind, rootDeadlineUnixMs, parentDeadlineUnixMs, ownDeadlineUnixMs) {
|
|
41733
|
+
const deadline = Math.min(rootDeadlineUnixMs, parentDeadlineUnixMs, ownDeadlineUnixMs);
|
|
41734
|
+
if (deadline === rootDeadlineUnixMs)
|
|
41735
|
+
return "root Run";
|
|
41736
|
+
if (deadline === parentDeadlineUnixMs)
|
|
41737
|
+
return "parent Flow";
|
|
41738
|
+
return kind === "http" ? "HTTP grant" : "project command";
|
|
41739
|
+
}
|
|
41740
|
+
function privateContainedDeadlineMessage(kind, limit2, phase) {
|
|
41741
|
+
return `the ${kind === "http" ? "HTTP request" : "project command"} did not return a proved result by its effective deadline (limited by ${limit2}) while ${phase}; effects may have occurred`;
|
|
41742
|
+
}
|
|
41725
41743
|
function httpPlan(recipe, identity2, deadlineUnixMs) {
|
|
41726
41744
|
return {
|
|
41727
41745
|
runId: `effect-${identity2.slice(0, 40)}`,
|