@pqpo/pragma 0.1.0-next.10 → 0.1.0-next.12
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/cli.js +340 -114
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -82528,6 +82528,130 @@ var init_redaction = __esm({
|
|
|
82528
82528
|
}
|
|
82529
82529
|
});
|
|
82530
82530
|
|
|
82531
|
+
// packages/local-host/dist/mission-event-projector.js
|
|
82532
|
+
import { createHash as createHash17 } from "node:crypto";
|
|
82533
|
+
function createLocalHostMissionEventProjector(options2) {
|
|
82534
|
+
const redactor = options2.redactor ?? createRunRedactor();
|
|
82535
|
+
const knownEventIds = new Set(options2.knownEventIds ?? []);
|
|
82536
|
+
let queued = Promise.resolve();
|
|
82537
|
+
let failed = false;
|
|
82538
|
+
let failure3;
|
|
82539
|
+
const appendOne = async (event, publish) => {
|
|
82540
|
+
const redacted = redactEvent(event, redactor);
|
|
82541
|
+
if (!isObjectData(event.data)) {
|
|
82542
|
+
if (publish) {
|
|
82543
|
+
options2.onEvent?.({ ...redacted, replayable: false, cursor: void 0 });
|
|
82544
|
+
}
|
|
82545
|
+
return;
|
|
82546
|
+
}
|
|
82547
|
+
if (event.eventId !== void 0 && knownEventIds.has(event.eventId))
|
|
82548
|
+
return;
|
|
82549
|
+
if (event.eventId !== void 0) {
|
|
82550
|
+
const snapshot = await options2.mission.controller.readSnapshot({
|
|
82551
|
+
missionId: options2.missionId
|
|
82552
|
+
});
|
|
82553
|
+
if (snapshot.events.some((candidate) => candidate.eventId === event.eventId)) {
|
|
82554
|
+
knownEventIds.add(event.eventId);
|
|
82555
|
+
return;
|
|
82556
|
+
}
|
|
82557
|
+
}
|
|
82558
|
+
const committed = await options2.mission.append(options2.missionId, options2.guard, event.type, redactEventData(event.data, redactor), event.eventId);
|
|
82559
|
+
if (event.eventId !== void 0)
|
|
82560
|
+
knownEventIds.add(event.eventId);
|
|
82561
|
+
if (publish) {
|
|
82562
|
+
options2.onEvent?.({ ...redacted, replayable: true, cursor: committed.cursor });
|
|
82563
|
+
}
|
|
82564
|
+
};
|
|
82565
|
+
const flush = async () => {
|
|
82566
|
+
await queued;
|
|
82567
|
+
if (failed)
|
|
82568
|
+
throw failure3;
|
|
82569
|
+
};
|
|
82570
|
+
return {
|
|
82571
|
+
enqueue(event) {
|
|
82572
|
+
queued = queued.then(async () => await appendOne(event, true)).catch((error52) => {
|
|
82573
|
+
failed ||= true;
|
|
82574
|
+
failure3 ??= error52;
|
|
82575
|
+
});
|
|
82576
|
+
},
|
|
82577
|
+
async append(event) {
|
|
82578
|
+
await flush();
|
|
82579
|
+
await appendOne(event, false);
|
|
82580
|
+
},
|
|
82581
|
+
flush,
|
|
82582
|
+
async appendTerminal(terminal) {
|
|
82583
|
+
await flush();
|
|
82584
|
+
const redacted = redactTerminal(terminal, redactor);
|
|
82585
|
+
const type = `run.${redacted.status}`;
|
|
82586
|
+
const snapshot = await options2.mission.controller.readSnapshot({
|
|
82587
|
+
missionId: options2.missionId
|
|
82588
|
+
});
|
|
82589
|
+
if (snapshot.events.some((event) => event.type === type && event.data["executionId"] === redacted.executionId)) {
|
|
82590
|
+
return redacted;
|
|
82591
|
+
}
|
|
82592
|
+
await appendOne({
|
|
82593
|
+
type,
|
|
82594
|
+
data: terminalData(redacted),
|
|
82595
|
+
eventId: terminalEventId(redacted.executionId, type)
|
|
82596
|
+
}, false);
|
|
82597
|
+
return redacted;
|
|
82598
|
+
}
|
|
82599
|
+
};
|
|
82600
|
+
}
|
|
82601
|
+
function isObjectData(value2) {
|
|
82602
|
+
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
82603
|
+
}
|
|
82604
|
+
function redactEvent(event, redactor) {
|
|
82605
|
+
return { ...event, data: redactor.redactJson(event.data) };
|
|
82606
|
+
}
|
|
82607
|
+
function redactEventData(value2, redactor) {
|
|
82608
|
+
return redactor.redactJson(value2);
|
|
82609
|
+
}
|
|
82610
|
+
function redactTerminal(terminal, redactor) {
|
|
82611
|
+
return {
|
|
82612
|
+
...terminal,
|
|
82613
|
+
...terminal.result === void 0 ? {} : { result: redactor.redactJson(terminal.result) },
|
|
82614
|
+
...terminal.interaction === void 0 ? {} : { interaction: redactInteraction(terminal.interaction, redactor) },
|
|
82615
|
+
...terminal.error === void 0 ? {} : {
|
|
82616
|
+
error: {
|
|
82617
|
+
...terminal.error,
|
|
82618
|
+
message: redactor.redactText(terminal.error.message),
|
|
82619
|
+
...terminal.error.details === void 0 ? {} : {
|
|
82620
|
+
details: redactor.redactJson(terminal.error.details)
|
|
82621
|
+
}
|
|
82622
|
+
}
|
|
82623
|
+
}
|
|
82624
|
+
};
|
|
82625
|
+
}
|
|
82626
|
+
function terminalData(terminal) {
|
|
82627
|
+
return {
|
|
82628
|
+
executionId: terminal.executionId,
|
|
82629
|
+
...terminal.result === void 0 ? {} : { result: terminal.result },
|
|
82630
|
+
...terminal.interaction === void 0 ? {} : { interaction: terminal.interaction },
|
|
82631
|
+
...terminal.usage === void 0 ? {} : { usage: terminal.usage },
|
|
82632
|
+
...terminal.error === void 0 ? {} : { error: terminal.error }
|
|
82633
|
+
};
|
|
82634
|
+
}
|
|
82635
|
+
function terminalEventId(executionId, type) {
|
|
82636
|
+
const hex3 = createHash17("sha256").update(`pragma.local-host/mission-terminal\0${executionId}\0${type}`).digest("hex").slice(0, 32);
|
|
82637
|
+
const chars = hex3.split("");
|
|
82638
|
+
chars[12] = "5";
|
|
82639
|
+
chars[16] = ["8", "9", "a", "b"][Number.parseInt(chars[16] ?? "8", 16) % 4] ?? "8";
|
|
82640
|
+
return `${chars.slice(0, 8).join("")}-${chars.slice(8, 12).join("")}-${chars.slice(12, 16).join("")}-${chars.slice(16, 20).join("")}-${chars.slice(20, 32).join("")}`;
|
|
82641
|
+
}
|
|
82642
|
+
function redactInteraction(interaction, redactor) {
|
|
82643
|
+
return {
|
|
82644
|
+
...interaction,
|
|
82645
|
+
interaction: redactor.redactJson(interaction.interaction)
|
|
82646
|
+
};
|
|
82647
|
+
}
|
|
82648
|
+
var init_mission_event_projector = __esm({
|
|
82649
|
+
"packages/local-host/dist/mission-event-projector.js"() {
|
|
82650
|
+
"use strict";
|
|
82651
|
+
init_redaction();
|
|
82652
|
+
}
|
|
82653
|
+
});
|
|
82654
|
+
|
|
82531
82655
|
// packages/local-host/dist/run.js
|
|
82532
82656
|
import { randomUUID as randomUUID24 } from "node:crypto";
|
|
82533
82657
|
function createLocalHostRunApplication(options2) {
|
|
@@ -82645,29 +82769,17 @@ function createLocalHostRunApplication(options2) {
|
|
|
82645
82769
|
const pendingHumanEvents = [];
|
|
82646
82770
|
let humanProcessing = Promise.resolve();
|
|
82647
82771
|
let humanFailure;
|
|
82648
|
-
let eventProjection = Promise.resolve();
|
|
82649
|
-
let eventProjectionFailure;
|
|
82650
82772
|
let missionStarted = existingEvents.some((event) => event.type === "run.started");
|
|
82651
82773
|
const pendingProjectionEvents = [];
|
|
82652
|
-
const
|
|
82653
|
-
|
|
82654
|
-
|
|
82655
|
-
|
|
82656
|
-
|
|
82657
|
-
|
|
82658
|
-
|
|
82659
|
-
|
|
82660
|
-
|
|
82661
|
-
const committed = await options2.mission.append(reservation.missionId, guard, event.type, redactEventData(event.data, redactor), event.eventId);
|
|
82662
|
-
publishEvent({
|
|
82663
|
-
...redactEvent(event, redactor),
|
|
82664
|
-
replayable: true,
|
|
82665
|
-
cursor: committed.cursor
|
|
82666
|
-
});
|
|
82667
|
-
}).catch((error52) => {
|
|
82668
|
-
eventProjectionFailure ??= error52;
|
|
82669
|
-
});
|
|
82670
|
-
};
|
|
82774
|
+
const eventProjector = createLocalHostMissionEventProjector({
|
|
82775
|
+
missionId: reservation.missionId,
|
|
82776
|
+
guard,
|
|
82777
|
+
mission: options2.mission,
|
|
82778
|
+
redactor,
|
|
82779
|
+
onEvent: presentation.onEvent,
|
|
82780
|
+
knownEventIds: existingEvents.map((event) => event.eventId)
|
|
82781
|
+
});
|
|
82782
|
+
const projectEvent = (event) => eventProjector.enqueue(event);
|
|
82671
82783
|
const processHumanInteraction = (interaction) => {
|
|
82672
82784
|
humanProcessing = humanProcessing.then(async () => {
|
|
82673
82785
|
const decision = await presentation.onHumanInteraction?.(interaction);
|
|
@@ -82793,20 +82905,10 @@ function createLocalHostRunApplication(options2) {
|
|
|
82793
82905
|
});
|
|
82794
82906
|
const outcome = handle.result.then(async (terminal) => {
|
|
82795
82907
|
try {
|
|
82796
|
-
await eventProjection;
|
|
82797
|
-
if (eventProjectionFailure !== void 0)
|
|
82798
|
-
throw eventProjectionFailure;
|
|
82799
82908
|
await humanProcessing;
|
|
82800
82909
|
if (humanFailure !== void 0)
|
|
82801
82910
|
throw humanFailure;
|
|
82802
|
-
const safeTerminal =
|
|
82803
|
-
await options2.mission.append(reservation.missionId, guard, `run.${safeTerminal.status}`, {
|
|
82804
|
-
executionId: safeTerminal.executionId,
|
|
82805
|
-
...safeTerminal.result === void 0 ? {} : { result: safeTerminal.result },
|
|
82806
|
-
...safeTerminal.interaction === void 0 ? {} : { interaction: safeTerminal.interaction },
|
|
82807
|
-
...safeTerminal.usage === void 0 ? {} : { usage: safeTerminal.usage },
|
|
82808
|
-
...safeTerminal.error === void 0 ? {} : { error: safeTerminal.error }
|
|
82809
|
-
});
|
|
82911
|
+
const safeTerminal = await eventProjector.appendTerminal(terminal);
|
|
82810
82912
|
return {
|
|
82811
82913
|
...safeTerminal,
|
|
82812
82914
|
missionId: reservation.missionId,
|
|
@@ -82872,41 +82974,6 @@ function createLocalHostRunApplication(options2) {
|
|
|
82872
82974
|
}
|
|
82873
82975
|
};
|
|
82874
82976
|
}
|
|
82875
|
-
function redactEvent(event, redactor) {
|
|
82876
|
-
if (redactor === void 0)
|
|
82877
|
-
return event;
|
|
82878
|
-
return { ...event, data: redactor.redactJson(event.data) };
|
|
82879
|
-
}
|
|
82880
|
-
function redactEventData(value2, redactor) {
|
|
82881
|
-
const redacted = redactor?.redactJson(value2) ?? value2;
|
|
82882
|
-
return redacted;
|
|
82883
|
-
}
|
|
82884
|
-
function redactTerminal(terminal, redactor) {
|
|
82885
|
-
if (redactor === void 0)
|
|
82886
|
-
return terminal;
|
|
82887
|
-
return {
|
|
82888
|
-
...terminal,
|
|
82889
|
-
...terminal.result === void 0 ? {} : { result: redactor.redactJson(terminal.result) },
|
|
82890
|
-
...terminal.interaction === void 0 ? {} : { interaction: redactInteraction(terminal.interaction, redactor) },
|
|
82891
|
-
...terminal.error === void 0 ? {} : {
|
|
82892
|
-
error: {
|
|
82893
|
-
...terminal.error,
|
|
82894
|
-
message: redactor.redactText(terminal.error.message),
|
|
82895
|
-
...terminal.error.details === void 0 ? {} : {
|
|
82896
|
-
details: redactor.redactJson(terminal.error.details)
|
|
82897
|
-
}
|
|
82898
|
-
}
|
|
82899
|
-
}
|
|
82900
|
-
};
|
|
82901
|
-
}
|
|
82902
|
-
function redactInteraction(interaction, redactor) {
|
|
82903
|
-
if (redactor === void 0)
|
|
82904
|
-
return interaction;
|
|
82905
|
-
return {
|
|
82906
|
-
...interaction,
|
|
82907
|
-
interaction: redactor.redactJson(interaction.interaction)
|
|
82908
|
-
};
|
|
82909
|
-
}
|
|
82910
82977
|
function createControllerRunMissionPort(controller, options2 = {}) {
|
|
82911
82978
|
const ownerScope = options2.ownerScope ?? createMissionOwnerScope({
|
|
82912
82979
|
controller,
|
|
@@ -83188,6 +83255,7 @@ var init_run = __esm({
|
|
|
83188
83255
|
init_owner_scope();
|
|
83189
83256
|
init_run_payload();
|
|
83190
83257
|
init_redaction();
|
|
83258
|
+
init_mission_event_projector();
|
|
83191
83259
|
MISSION_EVENT_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;
|
|
83192
83260
|
}
|
|
83193
83261
|
});
|
|
@@ -83700,6 +83768,7 @@ function createLocalHostCoreMissionControlAdapter(options2) {
|
|
|
83700
83768
|
});
|
|
83701
83769
|
const recoveredOwners = /* @__PURE__ */ new Map();
|
|
83702
83770
|
const settlementTasks = /* @__PURE__ */ new Map();
|
|
83771
|
+
const redactor = options2.redactor ?? createRunRedactor();
|
|
83703
83772
|
const createApp = (hostContextBindings) => options2.app ?? createPragma({
|
|
83704
83773
|
pragmaHome: options2.pragmaHome,
|
|
83705
83774
|
runtimes: options2.runtimes,
|
|
@@ -83773,7 +83842,7 @@ function createLocalHostCoreMissionControlAdapter(options2) {
|
|
|
83773
83842
|
const recoverMission = async (missionId) => {
|
|
83774
83843
|
await recover(missionId);
|
|
83775
83844
|
};
|
|
83776
|
-
const settleRecoveredOwner = async (missionId) => {
|
|
83845
|
+
const settleRecoveredOwner = async (missionId, guard) => {
|
|
83777
83846
|
if (options2.releaseMissionOwner === void 0)
|
|
83778
83847
|
return;
|
|
83779
83848
|
await unrefDelay(25);
|
|
@@ -83794,6 +83863,14 @@ function createLocalHostCoreMissionControlAdapter(options2) {
|
|
|
83794
83863
|
await unrefDelay(100);
|
|
83795
83864
|
continue;
|
|
83796
83865
|
}
|
|
83866
|
+
await projectRecoveredOwner({
|
|
83867
|
+
missionId,
|
|
83868
|
+
guard,
|
|
83869
|
+
executionIds: state2.executionIds,
|
|
83870
|
+
executions,
|
|
83871
|
+
mission: options2.mission,
|
|
83872
|
+
redactor
|
|
83873
|
+
});
|
|
83797
83874
|
const checkpointed = state2.lastStatus === "waiting" || prompts.some((prompt) => prompt.status === "queued");
|
|
83798
83875
|
if (checkpointed)
|
|
83799
83876
|
await owner.session.releaseAfterHumanCheckpoint();
|
|
@@ -83808,6 +83885,14 @@ function createLocalHostCoreMissionControlAdapter(options2) {
|
|
|
83808
83885
|
continue;
|
|
83809
83886
|
}
|
|
83810
83887
|
}
|
|
83888
|
+
await projectRecoveredOwner({
|
|
83889
|
+
missionId,
|
|
83890
|
+
guard,
|
|
83891
|
+
executionIds: [missionId],
|
|
83892
|
+
executions,
|
|
83893
|
+
mission: options2.mission,
|
|
83894
|
+
redactor
|
|
83895
|
+
});
|
|
83811
83896
|
}
|
|
83812
83897
|
if (recoveredOwners.get(missionId) === owner)
|
|
83813
83898
|
recoveredOwners.delete(missionId);
|
|
@@ -83815,12 +83900,12 @@ function createLocalHostCoreMissionControlAdapter(options2) {
|
|
|
83815
83900
|
return;
|
|
83816
83901
|
}
|
|
83817
83902
|
};
|
|
83818
|
-
const scheduleRecoveredOwnerSettlement = (missionId) => {
|
|
83903
|
+
const scheduleRecoveredOwnerSettlement = (missionId, guard) => {
|
|
83819
83904
|
if (options2.releaseMissionOwner === void 0 || !recoveredOwners.has(missionId))
|
|
83820
83905
|
return;
|
|
83821
83906
|
if (settlementTasks.has(missionId))
|
|
83822
83907
|
return;
|
|
83823
|
-
const task = settleRecoveredOwner(missionId).finally(() => {
|
|
83908
|
+
const task = settleRecoveredOwner(missionId, guard).finally(() => {
|
|
83824
83909
|
if (settlementTasks.get(missionId) === task)
|
|
83825
83910
|
settlementTasks.delete(missionId);
|
|
83826
83911
|
});
|
|
@@ -83970,10 +84055,19 @@ function createLocalHostCoreMissionControlAdapter(options2) {
|
|
|
83970
84055
|
}
|
|
83971
84056
|
recoveredOwners.delete(missionId);
|
|
83972
84057
|
},
|
|
83973
|
-
releaseAfterHumanCheckpoint: async (missionId) => {
|
|
84058
|
+
releaseAfterHumanCheckpoint: async (missionId, guard) => {
|
|
83974
84059
|
const owner = recoveredOwners.get(missionId);
|
|
83975
84060
|
if (owner === void 0)
|
|
83976
84061
|
return;
|
|
84062
|
+
const executionIds = owner.kind === "session" ? (await owner.session.getState()).executionIds : [missionId];
|
|
84063
|
+
await projectRecoveredOwner({
|
|
84064
|
+
missionId,
|
|
84065
|
+
guard,
|
|
84066
|
+
executionIds,
|
|
84067
|
+
executions,
|
|
84068
|
+
mission: options2.mission,
|
|
84069
|
+
redactor
|
|
84070
|
+
});
|
|
83977
84071
|
if (owner.kind === "session") {
|
|
83978
84072
|
await owner.session.releaseAfterHumanCheckpoint();
|
|
83979
84073
|
}
|
|
@@ -83987,9 +84081,9 @@ function createLocalHostCoreMissionControlAdapter(options2) {
|
|
|
83987
84081
|
result: await applyCoreMissionCommand({ command, executions, recover })
|
|
83988
84082
|
};
|
|
83989
84083
|
},
|
|
83990
|
-
afterOutcome({ command }) {
|
|
84084
|
+
afterOutcome({ command, guard }) {
|
|
83991
84085
|
if (recoveredOwners.has(command.missionId)) {
|
|
83992
|
-
scheduleRecoveredOwnerSettlement(command.missionId);
|
|
84086
|
+
scheduleRecoveredOwnerSettlement(command.missionId, guard);
|
|
83993
84087
|
} else {
|
|
83994
84088
|
scheduleUnbackedMissionOwnerSettlement(command.missionId);
|
|
83995
84089
|
}
|
|
@@ -84240,6 +84334,79 @@ async function applyFlowResponse(execution, executions, command) {
|
|
|
84240
84334
|
await execution.respondToHumanInteraction(interactionId, toCoreResponse(envelope.interaction, response), { requestId: command.request.requestId });
|
|
84241
84335
|
return { missionId: command.missionId, executionId: execution.executionId, interactionId };
|
|
84242
84336
|
}
|
|
84337
|
+
async function projectRecoveredOwner(options2) {
|
|
84338
|
+
const snapshot = await options2.mission.controller.readSnapshot({
|
|
84339
|
+
missionId: options2.missionId
|
|
84340
|
+
});
|
|
84341
|
+
const knownEventIds = new Set(snapshot.events.map((event) => event.eventId));
|
|
84342
|
+
const projector = createLocalHostMissionEventProjector({
|
|
84343
|
+
missionId: options2.missionId,
|
|
84344
|
+
guard: options2.guard,
|
|
84345
|
+
mission: options2.mission,
|
|
84346
|
+
redactor: options2.redactor,
|
|
84347
|
+
knownEventIds
|
|
84348
|
+
});
|
|
84349
|
+
for (const executionId of new Set(options2.executionIds)) {
|
|
84350
|
+
const events = await options2.executions.readEvents(executionId);
|
|
84351
|
+
const pending = /* @__PURE__ */ new Map();
|
|
84352
|
+
const mappedEvents = events.map((event) => mapExecutionEvent(event, options2.missionId, executionId, pending));
|
|
84353
|
+
let lastKnownIndex = -1;
|
|
84354
|
+
events.forEach((event, index3) => {
|
|
84355
|
+
if (knownEventIds.has(event.eventId))
|
|
84356
|
+
lastKnownIndex = index3;
|
|
84357
|
+
});
|
|
84358
|
+
for (const event of mappedEvents.slice(lastKnownIndex + 1)) {
|
|
84359
|
+
await projector.append(event);
|
|
84360
|
+
}
|
|
84361
|
+
const terminal = await terminalFromRecoveredExecution({
|
|
84362
|
+
executions: options2.executions,
|
|
84363
|
+
executionId,
|
|
84364
|
+
missionId: options2.missionId,
|
|
84365
|
+
pending
|
|
84366
|
+
});
|
|
84367
|
+
if (terminal !== void 0)
|
|
84368
|
+
await projector.appendTerminal(terminal);
|
|
84369
|
+
}
|
|
84370
|
+
await projector.flush();
|
|
84371
|
+
}
|
|
84372
|
+
async function terminalFromRecoveredExecution(options2) {
|
|
84373
|
+
const execution = await options2.executions.get(options2.executionId);
|
|
84374
|
+
if (execution === void 0)
|
|
84375
|
+
return void 0;
|
|
84376
|
+
if (execution.status === "waiting") {
|
|
84377
|
+
const interaction = await readPendingInteraction(options2.executions, options2.executionId, options2.missionId, options2.pending);
|
|
84378
|
+
return interaction === void 0 ? void 0 : {
|
|
84379
|
+
status: "input_required",
|
|
84380
|
+
executionId: options2.executionId,
|
|
84381
|
+
interaction,
|
|
84382
|
+
...execution.usage === void 0 ? {} : { usage: execution.usage }
|
|
84383
|
+
};
|
|
84384
|
+
}
|
|
84385
|
+
if (execution.status === "succeeded") {
|
|
84386
|
+
return {
|
|
84387
|
+
status: "succeeded",
|
|
84388
|
+
executionId: options2.executionId,
|
|
84389
|
+
result: toJsonValue2(execution.output === void 0 ? void 0 : unwrapInvocationOutput(execution.output)),
|
|
84390
|
+
...execution.usage === void 0 ? {} : { usage: execution.usage }
|
|
84391
|
+
};
|
|
84392
|
+
}
|
|
84393
|
+
if (execution.status === "failed") {
|
|
84394
|
+
return {
|
|
84395
|
+
status: "failed",
|
|
84396
|
+
executionId: options2.executionId,
|
|
84397
|
+
error: executionError(execution.error),
|
|
84398
|
+
...execution.usage === void 0 ? {} : { usage: execution.usage }
|
|
84399
|
+
};
|
|
84400
|
+
}
|
|
84401
|
+
if (execution.status === "cancelled" || execution.status === "interrupted") {
|
|
84402
|
+
return {
|
|
84403
|
+
status: "interrupted",
|
|
84404
|
+
executionId: options2.executionId,
|
|
84405
|
+
...execution.usage === void 0 ? {} : { usage: execution.usage }
|
|
84406
|
+
};
|
|
84407
|
+
}
|
|
84408
|
+
return void 0;
|
|
84409
|
+
}
|
|
84243
84410
|
async function readActiveExpertTarget(sessions, missionId) {
|
|
84244
84411
|
const state2 = await sessions.get(missionId);
|
|
84245
84412
|
if (state2?.activeExecutionId === void 0)
|
|
@@ -84286,7 +84453,8 @@ async function waitForExecution(executions, input) {
|
|
|
84286
84453
|
return {
|
|
84287
84454
|
executionId: execution.executionId,
|
|
84288
84455
|
status: execution.status,
|
|
84289
|
-
interaction: JsonValueSchema.parse(interaction)
|
|
84456
|
+
interaction: JsonValueSchema.parse(interaction),
|
|
84457
|
+
...execution.usage === void 0 ? {} : { usage: execution.usage }
|
|
84290
84458
|
};
|
|
84291
84459
|
}
|
|
84292
84460
|
}
|
|
@@ -84295,17 +84463,23 @@ async function waitForExecution(executions, input) {
|
|
|
84295
84463
|
return {
|
|
84296
84464
|
executionId: execution.executionId,
|
|
84297
84465
|
status: execution.status,
|
|
84298
|
-
result: toJsonValue2(execution.output)
|
|
84466
|
+
result: toJsonValue2(execution.output === void 0 ? void 0 : unwrapInvocationOutput(execution.output)),
|
|
84467
|
+
...execution.usage === void 0 ? {} : { usage: execution.usage }
|
|
84299
84468
|
};
|
|
84300
84469
|
}
|
|
84301
84470
|
if (execution.status === "failed") {
|
|
84302
84471
|
return {
|
|
84303
84472
|
executionId: execution.executionId,
|
|
84304
84473
|
status: execution.status,
|
|
84305
|
-
error: executionError(execution.error)
|
|
84474
|
+
error: executionError(execution.error),
|
|
84475
|
+
...execution.usage === void 0 ? {} : { usage: execution.usage }
|
|
84306
84476
|
};
|
|
84307
84477
|
}
|
|
84308
|
-
return {
|
|
84478
|
+
return {
|
|
84479
|
+
executionId: execution.executionId,
|
|
84480
|
+
status: execution.status,
|
|
84481
|
+
...execution.usage === void 0 ? {} : { usage: execution.usage }
|
|
84482
|
+
};
|
|
84309
84483
|
}
|
|
84310
84484
|
await delay3(pollIntervalMs);
|
|
84311
84485
|
}
|
|
@@ -84322,6 +84496,8 @@ function executionError(value2) {
|
|
|
84322
84496
|
});
|
|
84323
84497
|
}
|
|
84324
84498
|
function toJsonValue2(value2) {
|
|
84499
|
+
if (value2 === void 0)
|
|
84500
|
+
return null;
|
|
84325
84501
|
const parsed = JsonValueSchema.safeParse(value2);
|
|
84326
84502
|
return parsed.success ? parsed.data : String(value2);
|
|
84327
84503
|
}
|
|
@@ -84399,6 +84575,8 @@ var init_core_control_adapter = __esm({
|
|
|
84399
84575
|
init_integration();
|
|
84400
84576
|
init_pinned_binding();
|
|
84401
84577
|
init_core_run();
|
|
84578
|
+
init_mission_event_projector();
|
|
84579
|
+
init_redaction();
|
|
84402
84580
|
}
|
|
84403
84581
|
});
|
|
84404
84582
|
|
|
@@ -94050,7 +94228,7 @@ var init_registries2 = __esm({
|
|
|
94050
94228
|
});
|
|
94051
94229
|
|
|
94052
94230
|
// packages/interpreter/dist/runtime/resource-adapters.js
|
|
94053
|
-
import { createHash as
|
|
94231
|
+
import { createHash as createHash18 } from "node:crypto";
|
|
94054
94232
|
import { lstat as lstat2, readFile as readFile11, readdir as readdir8, realpath as realpath2 } from "node:fs/promises";
|
|
94055
94233
|
import { isAbsolute as isAbsolute4, relative as relative4, resolve as resolve7 } from "node:path";
|
|
94056
94234
|
function createDefaultPragmaResourceAdapterRegistry() {
|
|
@@ -94457,7 +94635,7 @@ function diagnostic(code, message) {
|
|
|
94457
94635
|
return { severity: "error", code, message, path: [] };
|
|
94458
94636
|
}
|
|
94459
94637
|
function sha2563(value2) {
|
|
94460
|
-
return
|
|
94638
|
+
return createHash18("sha256").update(value2).digest("hex");
|
|
94461
94639
|
}
|
|
94462
94640
|
function stableStringify6(value2) {
|
|
94463
94641
|
if (Array.isArray(value2))
|
|
@@ -94756,9 +94934,9 @@ var init_flow_values = __esm({
|
|
|
94756
94934
|
});
|
|
94757
94935
|
|
|
94758
94936
|
// packages/interpreter/dist/compiler/compiler-hash.js
|
|
94759
|
-
import { createHash as
|
|
94937
|
+
import { createHash as createHash19 } from "node:crypto";
|
|
94760
94938
|
function sha2564(value2) {
|
|
94761
|
-
return
|
|
94939
|
+
return createHash19("sha256").update(value2).digest("hex");
|
|
94762
94940
|
}
|
|
94763
94941
|
function stableStringify7(value2) {
|
|
94764
94942
|
if (Array.isArray(value2))
|
|
@@ -102882,14 +103060,14 @@ var init_builtin_generated = __esm({
|
|
|
102882
103060
|
});
|
|
102883
103061
|
|
|
102884
103062
|
// packages/built-in-agents/dist/builtin.js
|
|
102885
|
-
import { createHash as
|
|
103063
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
102886
103064
|
import { access, mkdir as mkdir14, writeFile as writeFile10 } from "node:fs/promises";
|
|
102887
103065
|
import { dirname as dirname13, join as join13 } from "node:path";
|
|
102888
103066
|
function builtInAgentResource(ref) {
|
|
102889
103067
|
return PragmaExpertResourceSchema.parse(parsePragmaYaml(BUILT_IN_AGENT_FILES[BUILT_IN_AGENT_PATHS[ref]]));
|
|
102890
103068
|
}
|
|
102891
103069
|
function builtInAgentFingerprint(ref, expertResource, additionalResources = []) {
|
|
102892
|
-
const hash3 =
|
|
103070
|
+
const hash3 = createHash20("sha256");
|
|
102893
103071
|
hash3.update(ref);
|
|
102894
103072
|
hash3.update("\0");
|
|
102895
103073
|
for (const [path15, source] of builtInAgentSourceEntries(ref, expertResource, additionalResources)) {
|
|
@@ -102960,7 +103138,7 @@ async function exists2(path15) {
|
|
|
102960
103138
|
}
|
|
102961
103139
|
}
|
|
102962
103140
|
function builtInAgentAdapterHost(environmentId, projectRoot, tools, external) {
|
|
102963
|
-
const fingerprint =
|
|
103141
|
+
const fingerprint = createHash20("sha256").update(JSON.stringify(tools.map((tool) => ({
|
|
102964
103142
|
name: tool.name,
|
|
102965
103143
|
inputSchema: tool.inputSchema,
|
|
102966
103144
|
approval: tool.approval?.mode
|
|
@@ -106487,7 +106665,7 @@ var init_runtime_environment = __esm({
|
|
|
106487
106665
|
});
|
|
106488
106666
|
|
|
106489
106667
|
// packages/local-host/dist/usage.js
|
|
106490
|
-
import { createHash as
|
|
106668
|
+
import { createHash as createHash21 } from "node:crypto";
|
|
106491
106669
|
import { mkdir as mkdir16, readFile as readFile14, rename as rename10, writeFile as writeFile11 } from "node:fs/promises";
|
|
106492
106670
|
import { dirname as dirname14 } from "node:path";
|
|
106493
106671
|
function createLocalHostUsageSink(options2) {
|
|
@@ -106543,7 +106721,7 @@ function createLocalHostUsageSink(options2) {
|
|
|
106543
106721
|
};
|
|
106544
106722
|
}
|
|
106545
106723
|
function observationSignature(observation) {
|
|
106546
|
-
return
|
|
106724
|
+
return createHash21("sha256").update(JSON.stringify({
|
|
106547
106725
|
observationId: observation.observationId,
|
|
106548
106726
|
occurredAt: observation.occurredAt,
|
|
106549
106727
|
executionId: observation.executionId,
|
|
@@ -106588,7 +106766,7 @@ var init_logger2 = __esm({
|
|
|
106588
106766
|
});
|
|
106589
106767
|
|
|
106590
106768
|
// packages/local-host/dist/project-revision.js
|
|
106591
|
-
import { createHash as
|
|
106769
|
+
import { createHash as createHash22, randomUUID as randomUUID25 } from "node:crypto";
|
|
106592
106770
|
import { mkdir as mkdir17, readFile as readFile15, readdir as readdir10, rename as rename11, rm as rm12, writeFile as writeFile12 } from "node:fs/promises";
|
|
106593
106771
|
import { dirname as dirname15, isAbsolute as isAbsolute7, join as join16, relative as relative7, resolve as resolve10 } from "node:path";
|
|
106594
106772
|
function createLocalHostProjectRevisionReader(options2) {
|
|
@@ -106806,7 +106984,7 @@ async function readTextFiles(rootDir, excludeCompilerViewMarker = false) {
|
|
|
106806
106984
|
return files;
|
|
106807
106985
|
}
|
|
106808
106986
|
function createCompilerViewKey(input) {
|
|
106809
|
-
return
|
|
106987
|
+
return createHash22("sha256").update(JSON.stringify({
|
|
106810
106988
|
sourceSnapshotHash: input.sourceSnapshotHash,
|
|
106811
106989
|
sourceProjectFingerprint: input.sourceProjectFingerprint,
|
|
106812
106990
|
sourceCompilerVersion: input.sourceCompilerVersion,
|
|
@@ -107195,7 +107373,7 @@ var init_native_os_keychain = __esm({
|
|
|
107195
107373
|
});
|
|
107196
107374
|
|
|
107197
107375
|
// packages/local-host/dist/secrets/secret-store.js
|
|
107198
|
-
import { createCipheriv, createDecipheriv, createHash as
|
|
107376
|
+
import { createCipheriv, createDecipheriv, createHash as createHash23, randomBytes as cryptoRandomBytes, randomUUID as randomUUID26, timingSafeEqual } from "node:crypto";
|
|
107199
107377
|
import { chmod as chmod2, mkdir as mkdir18, open as open5, readFile as readFile16, readdir as readdir11, rename as rename12, rm as rm13, stat as stat10 } from "node:fs/promises";
|
|
107200
107378
|
import { dirname as dirname16, join as join17, resolve as resolve11 } from "node:path";
|
|
107201
107379
|
function createSecretStore(options2) {
|
|
@@ -107632,7 +107810,7 @@ async function pathExists(path15) {
|
|
|
107632
107810
|
}
|
|
107633
107811
|
}
|
|
107634
107812
|
function sha2565(value2) {
|
|
107635
|
-
return
|
|
107813
|
+
return createHash23("sha256").update(value2).digest("hex");
|
|
107636
107814
|
}
|
|
107637
107815
|
var SECRET_STORE_SERVICE, MASTER_KEY_SCHEMA, ENVELOPE_SCHEMA, REF_SCHEMA, STORE_SCHEMA, TombstoneSchema, SecretStoreError;
|
|
107638
107816
|
var init_secret_store = __esm({
|
|
@@ -107910,6 +108088,7 @@ __export(dist_exports, {
|
|
|
107910
108088
|
createLocalHostCoreMissionControlAdapter: () => createLocalHostCoreMissionControlAdapter,
|
|
107911
108089
|
createLocalHostCoreStores: () => createLocalHostCoreStores,
|
|
107912
108090
|
createLocalHostMissionBoardBindings: () => createLocalHostMissionBoardBindings,
|
|
108091
|
+
createLocalHostMissionEventProjector: () => createLocalHostMissionEventProjector,
|
|
107913
108092
|
createLocalHostProjectCatalog: () => createLocalHostProjectCatalog,
|
|
107914
108093
|
createLocalHostProjectCatalogFromHome: () => createLocalHostProjectCatalogFromHome,
|
|
107915
108094
|
createLocalHostProjectRevisionReader: () => createLocalHostProjectRevisionReader,
|
|
@@ -107944,11 +108123,13 @@ __export(dist_exports, {
|
|
|
107944
108123
|
isTerminalMissionOperationState: () => isTerminalMissionOperationState,
|
|
107945
108124
|
listLocalHostBuiltInExecutorDescriptors: () => listLocalHostBuiltInExecutorDescriptors,
|
|
107946
108125
|
makeMissionEventCursor: () => makeMissionEventCursor,
|
|
108126
|
+
mapExecutionEvent: () => mapExecutionEvent,
|
|
107947
108127
|
normalizeMissionPrompt: () => normalizeMissionPrompt,
|
|
107948
108128
|
parseMissionEventCursor: () => parseMissionEventCursor,
|
|
107949
108129
|
parseMissionPinnedBindingData: () => parseMissionPinnedBindingData,
|
|
107950
108130
|
planMissionRetention: () => planMissionRetention,
|
|
107951
108131
|
readPendingInteraction: () => readPendingInteraction,
|
|
108132
|
+
redactInteraction: () => redactInteraction,
|
|
107952
108133
|
resolveLateBoundSecrets: () => resolveLateBoundSecrets,
|
|
107953
108134
|
resolveMissionRetentionPolicy: () => resolveMissionRetentionPolicy,
|
|
107954
108135
|
retentionReport: () => retentionReport,
|
|
@@ -107958,7 +108139,7 @@ __export(dist_exports, {
|
|
|
107958
108139
|
toCoreResponse: () => toCoreResponse,
|
|
107959
108140
|
unsupportedPinnedBindingError: () => unsupportedPinnedBindingError
|
|
107960
108141
|
});
|
|
107961
|
-
import { createHash as
|
|
108142
|
+
import { createHash as createHash24 } from "node:crypto";
|
|
107962
108143
|
import { basename as basename6, isAbsolute as isAbsolute8 } from "node:path";
|
|
107963
108144
|
function createLocalHostRuntimeResolver(options2) {
|
|
107964
108145
|
const delegate = createStaticRuntimeResolver(options2);
|
|
@@ -108070,7 +108251,7 @@ async function resolveWorkspace(requestedPath, filesystem) {
|
|
|
108070
108251
|
requestedPath,
|
|
108071
108252
|
canonicalPath,
|
|
108072
108253
|
displayName: basename6(canonicalPath) || canonicalPath,
|
|
108073
|
-
identityHash: `sha256:${
|
|
108254
|
+
identityHash: `sha256:${createHash24("sha256").update(canonicalPath).digest("hex")}`,
|
|
108074
108255
|
access: { exists: true, readable: true, writable: true },
|
|
108075
108256
|
source: "explicit"
|
|
108076
108257
|
});
|
|
@@ -108107,6 +108288,7 @@ var init_dist13 = __esm({
|
|
|
108107
108288
|
init_migrations();
|
|
108108
108289
|
init_run_payload();
|
|
108109
108290
|
init_run();
|
|
108291
|
+
init_mission_event_projector();
|
|
108110
108292
|
init_core_run();
|
|
108111
108293
|
init_core_control_adapter();
|
|
108112
108294
|
init_built_in_executors();
|
|
@@ -147555,7 +147737,7 @@ var require_websocket = __commonJS({
|
|
|
147555
147737
|
var http3 = __require("http");
|
|
147556
147738
|
var net = __require("net");
|
|
147557
147739
|
var tls = __require("tls");
|
|
147558
|
-
var { randomBytes: randomBytes7, createHash:
|
|
147740
|
+
var { randomBytes: randomBytes7, createHash: createHash30 } = __require("crypto");
|
|
147559
147741
|
var { Duplex, Readable: Readable4 } = __require("stream");
|
|
147560
147742
|
var { URL: URL2 } = __require("url");
|
|
147561
147743
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -148223,7 +148405,7 @@ var require_websocket = __commonJS({
|
|
|
148223
148405
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
148224
148406
|
return;
|
|
148225
148407
|
}
|
|
148226
|
-
const digest =
|
|
148408
|
+
const digest = createHash30("sha1").update(key + GUID).digest("base64");
|
|
148227
148409
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
148228
148410
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
148229
148411
|
return;
|
|
@@ -148592,7 +148774,7 @@ var require_websocket_server = __commonJS({
|
|
|
148592
148774
|
var EventEmitter4 = __require("events");
|
|
148593
148775
|
var http3 = __require("http");
|
|
148594
148776
|
var { Duplex } = __require("stream");
|
|
148595
|
-
var { createHash:
|
|
148777
|
+
var { createHash: createHash30 } = __require("crypto");
|
|
148596
148778
|
var extension2 = require_extension();
|
|
148597
148779
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
148598
148780
|
var subprotocol2 = require_subprotocol();
|
|
@@ -148899,7 +149081,7 @@ var require_websocket_server = __commonJS({
|
|
|
148899
149081
|
);
|
|
148900
149082
|
}
|
|
148901
149083
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
148902
|
-
const digest =
|
|
149084
|
+
const digest = createHash30("sha1").update(key + GUID).digest("base64");
|
|
148903
149085
|
const headers = [
|
|
148904
149086
|
"HTTP/1.1 101 Switching Protocols",
|
|
148905
149087
|
"Upgrade: websocket",
|
|
@@ -334322,7 +334504,7 @@ function errorMessage2(error52) {
|
|
|
334322
334504
|
}
|
|
334323
334505
|
|
|
334324
334506
|
// packages/runtime/antigravity/dist/managed-home.js
|
|
334325
|
-
import { createHash as
|
|
334507
|
+
import { createHash as createHash25, randomUUID as randomUUID27 } from "node:crypto";
|
|
334326
334508
|
import { constants as constants3 } from "node:fs";
|
|
334327
334509
|
import { access as access2, chmod as chmod3, cp as cp2, mkdir as mkdir19, readFile as readFile18, readdir as readdir12, rename as rename13, rm as rm14, stat as stat13, writeFile as writeFile13 } from "node:fs/promises";
|
|
334328
334510
|
import { basename as basename7, dirname as dirname18, isAbsolute as isAbsolute10, join as join20, posix as posix3, resolve as resolve13, win32 as win322 } from "node:path";
|
|
@@ -334591,7 +334773,7 @@ function readEnvironmentValue(environment, name, platform3) {
|
|
|
334591
334773
|
return matched === void 0 ? void 0 : environment[matched];
|
|
334592
334774
|
}
|
|
334593
334775
|
function createManagedAntigravityIdentity(agentId, sessionDir) {
|
|
334594
|
-
const namespace =
|
|
334776
|
+
const namespace = createHash25("sha256").update("pragma.antigravity-managed-identity/v1\0").update(resolve13(sessionDir)).digest("hex").slice(0, MANAGED_NAMESPACE_CHARACTERS);
|
|
334595
334777
|
return {
|
|
334596
334778
|
namespace,
|
|
334597
334779
|
agentName: managedAgentName(agentId, namespace),
|
|
@@ -334900,7 +335082,7 @@ function isReplaceError(error52) {
|
|
|
334900
335082
|
|
|
334901
335083
|
// packages/runtime/antigravity/dist/models.js
|
|
334902
335084
|
init_dist6();
|
|
334903
|
-
import { createHash as
|
|
335085
|
+
import { createHash as createHash26 } from "node:crypto";
|
|
334904
335086
|
import { mkdir as mkdir20, mkdtemp as mkdtemp4, rm as rm15 } from "node:fs/promises";
|
|
334905
335087
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
334906
335088
|
import { join as join21 } from "node:path";
|
|
@@ -335108,7 +335290,7 @@ function modelHasSelectionSuffix(value2) {
|
|
|
335108
335290
|
return /\s+(?:(?:default|selected|current)|\[(?:default|selected|current)\]|\((?:default|selected|current)\))\s*$/i.test(value2);
|
|
335109
335291
|
}
|
|
335110
335292
|
function modelCatalogCacheKey(options2) {
|
|
335111
|
-
return
|
|
335293
|
+
return createHash26("sha256").update("pragma.antigravity-model-catalog/v1\0").update(resolveAntigravityExecutablePath(options2)).update("\0").update(options2.modelCatalogCacheRoot ?? "default").update("\0").update(options2.spawn === void 0 ? "native" : `custom:${spawnId2(options2.spawn)}`).update("\0").update(JSON.stringify(Object.entries(options2.env ?? {}).toSorted(([left], [right]) => left.localeCompare(right)))).digest("hex");
|
|
335112
335294
|
}
|
|
335113
335295
|
function spawnId2(spawn13) {
|
|
335114
335296
|
let id = spawnIds2.get(spawn13);
|
|
@@ -340107,7 +340289,7 @@ function readRecord4(value2) {
|
|
|
340107
340289
|
|
|
340108
340290
|
// packages/runtime/codex/dist/codex-home.js
|
|
340109
340291
|
init_dist6();
|
|
340110
|
-
import { createHash as
|
|
340292
|
+
import { createHash as createHash27, randomUUID as randomUUID32 } from "node:crypto";
|
|
340111
340293
|
import { lstat as lstat5, mkdir as mkdir25, readFile as readFile23, readlink, rename as rename14, rm as rm18, stat as stat18, symlink, writeFile as writeFile17 } from "node:fs/promises";
|
|
340112
340294
|
import { dirname as dirname22, isAbsolute as isAbsolute15, join as join31, normalize, relative as relative10, resolve as resolve19, sep as sep4 } from "node:path";
|
|
340113
340295
|
import { homedir as homedir8 } from "node:os";
|
|
@@ -340415,7 +340597,7 @@ async function syncModelsCache({ sourceHome, home, freshHome, configSnapshot, mo
|
|
|
340415
340597
|
return seeded;
|
|
340416
340598
|
}
|
|
340417
340599
|
function fingerprintModelConfiguration(configSnapshot, modelCatalog) {
|
|
340418
|
-
const hash3 =
|
|
340600
|
+
const hash3 = createHash27("sha256").update("pragma.codex-model-cache-binding/v1\0");
|
|
340419
340601
|
for (const file2 of ["config.json", "config.toml"]) {
|
|
340420
340602
|
const bytes = configSnapshot.values.get(file2);
|
|
340421
340603
|
hash3.update(`${file2}\0`);
|
|
@@ -389778,7 +389960,7 @@ var ModelRuntime = class _ModelRuntime {
|
|
|
389778
389960
|
};
|
|
389779
389961
|
|
|
389780
389962
|
// node_modules/.pnpm/@earendil-works+pi-coding-agent@0.83.0_@modelcontextprotocol+sdk@1.30.0_@cfworker+json-_40ddb6b236cbde8a388a4228cb3c4733/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js
|
|
389781
|
-
import { createHash as
|
|
389963
|
+
import { createHash as createHash28 } from "node:crypto";
|
|
389782
389964
|
import { chmodSync as chmodSync3, existsSync as existsSync13, mkdirSync as mkdirSync6, readdirSync as readdirSync9, readFileSync as readFileSync11, rmSync as rmSync2, statSync as statSync8, writeFileSync as writeFileSync6 } from "node:fs";
|
|
389783
389965
|
import { homedir as homedir15 } from "node:os";
|
|
389784
389966
|
import { basename as basename20, dirname as dirname37, join as join54, relative as relative14, resolve as resolve26, sep as sep11 } from "node:path";
|
|
@@ -394641,7 +394823,7 @@ var DefaultPackageManager = class {
|
|
|
394641
394823
|
}
|
|
394642
394824
|
getTemporaryDir(prefix, suffix) {
|
|
394643
394825
|
const root = this.resolveManagedPath(getExtensionTempFolder(this.agentDir), prefix);
|
|
394644
|
-
const hash3 =
|
|
394826
|
+
const hash3 = createHash28("sha256").update(`${prefix}-${suffix ?? ""}`).digest("hex").slice(0, 8);
|
|
394645
394827
|
return this.resolveManagedPath(root, hash3, suffix ?? "");
|
|
394646
394828
|
}
|
|
394647
394829
|
resolveManagedPath(root, ...parts) {
|
|
@@ -416317,7 +416499,7 @@ async function canUseQoderCliRuntime(options2 = {}) {
|
|
|
416317
416499
|
|
|
416318
416500
|
// packages/runtime/qodercli/dist/models.js
|
|
416319
416501
|
init_dist6();
|
|
416320
|
-
import { createHash as
|
|
416502
|
+
import { createHash as createHash29 } from "node:crypto";
|
|
416321
416503
|
|
|
416322
416504
|
// node_modules/.pnpm/@qoder-ai+qoder-agent-sdk@1.0.16_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@qoder-ai/qoder-agent-sdk/dist/index.js
|
|
416323
416505
|
import { spawn as Mr } from "child_process";
|
|
@@ -420615,7 +420797,7 @@ function createQoderCliModelDiscovery(options2) {
|
|
|
420615
420797
|
};
|
|
420616
420798
|
}
|
|
420617
420799
|
function qoderModelCatalogCacheKey(options2) {
|
|
420618
|
-
return
|
|
420800
|
+
return createHash29("sha256").update("pragma.qoder-model-catalog/v1\0").update(resolveQoderCliExecutablePath(options2)).update("\0").update(options2.modelCatalogCacheRoot ?? "default").update("\0").update(JSON.stringify(options2.auth ?? { type: "qodercli" })).update("\0").update(JSON.stringify(Object.entries(options2.env ?? {}).toSorted(([left], [right]) => left.localeCompare(right)))).digest("hex");
|
|
420619
420801
|
}
|
|
420620
420802
|
function notifyModelCatalogUpdated4(listener) {
|
|
420621
420803
|
try {
|
|
@@ -421761,7 +421943,7 @@ init_dist13();
|
|
|
421761
421943
|
init_integration();
|
|
421762
421944
|
|
|
421763
421945
|
// apps/cli/src/version.ts
|
|
421764
|
-
var CLI_VERSION = false ? "0.0.0" : "0.1.0-next.
|
|
421946
|
+
var CLI_VERSION = false ? "0.0.0" : "0.1.0-next.12";
|
|
421765
421947
|
|
|
421766
421948
|
// apps/cli/src/composition/default.ts
|
|
421767
421949
|
function createCliLocalHost(input = {}) {
|
|
@@ -421844,6 +422026,7 @@ function createProductionLocalHost() {
|
|
|
421844
422026
|
createHostContextBindings: async ({ missionId }) => await createLocalHostMissionBoardBindings({ pragmaHome, missionId }),
|
|
421845
422027
|
executors: resolveExecutor
|
|
421846
422028
|
});
|
|
422029
|
+
const missionPort = createControllerRunMissionPort(missionController, { ownerScope });
|
|
421847
422030
|
const coreControl = createLocalHostCoreMissionControlAdapter({
|
|
421848
422031
|
pragmaHome,
|
|
421849
422032
|
runtimes: runtimeResolver,
|
|
@@ -421851,6 +422034,7 @@ function createProductionLocalHost() {
|
|
|
421851
422034
|
loggerProvider,
|
|
421852
422035
|
executions: executionStore,
|
|
421853
422036
|
sessions: expertSessionStore,
|
|
422037
|
+
mission: missionPort,
|
|
421854
422038
|
createHostContextBindings: async ({ missionId }) => await createLocalHostMissionBoardBindings({ pragmaHome, missionId }),
|
|
421855
422039
|
executors: resolveExecutor,
|
|
421856
422040
|
resolveActiveOwner: executorPort.resolveActiveOwner,
|
|
@@ -421889,7 +422073,7 @@ function createProductionLocalHost() {
|
|
|
421889
422073
|
});
|
|
421890
422074
|
const run = createLocalHostRunApplication({
|
|
421891
422075
|
executors: executorPort,
|
|
421892
|
-
mission:
|
|
422076
|
+
mission: missionPort,
|
|
421893
422077
|
commandConsumer: coreControl.consumer
|
|
421894
422078
|
});
|
|
421895
422079
|
const application = createLocalHostApplication({
|
|
@@ -422153,8 +422337,13 @@ function assertAppliedOperation(operation, missionId) {
|
|
|
422153
422337
|
throw resumeOperationError(operation.error, missionId);
|
|
422154
422338
|
}
|
|
422155
422339
|
async function releaseRecoveredOwner(options2) {
|
|
422340
|
+
const guard = options2.ownerScope.currentGuard(options2.missionId);
|
|
422341
|
+
if (guard === void 0) {
|
|
422342
|
+
await options2.coreControl.release(options2.missionId);
|
|
422343
|
+
return;
|
|
422344
|
+
}
|
|
422156
422345
|
try {
|
|
422157
|
-
await options2.coreControl.releaseAfterHumanCheckpoint(options2.missionId);
|
|
422346
|
+
await options2.coreControl.releaseAfterHumanCheckpoint(options2.missionId, guard);
|
|
422158
422347
|
} catch (error52) {
|
|
422159
422348
|
if (!(error52 instanceof Error) || !error52.message.includes("active execution")) throw error52;
|
|
422160
422349
|
return;
|
|
@@ -422292,18 +422481,47 @@ async function listMissionSnapshots(controller, missionsPath) {
|
|
|
422292
422481
|
if (isNodeError4(error52, "ENOENT")) return [];
|
|
422293
422482
|
throw error52;
|
|
422294
422483
|
}
|
|
422484
|
+
const missionIds = [];
|
|
422485
|
+
for (const entry of directories) {
|
|
422486
|
+
if (!entry.isDirectory() || entry.name.startsWith(".")) continue;
|
|
422487
|
+
if (!MissionIdSchema.safeParse(entry.name).success) continue;
|
|
422488
|
+
const localHostPath = join76(missionsPath, entry.name, "local-host");
|
|
422489
|
+
let localHostDirectory;
|
|
422490
|
+
try {
|
|
422491
|
+
localHostDirectory = await stat26(localHostPath);
|
|
422492
|
+
} catch (error52) {
|
|
422493
|
+
if (isNodeError4(error52, "ENOENT")) continue;
|
|
422494
|
+
throw localHostStorageError(entry.name);
|
|
422495
|
+
}
|
|
422496
|
+
if (!localHostDirectory.isDirectory()) throw localHostStorageError(entry.name);
|
|
422497
|
+
let aggregate;
|
|
422498
|
+
try {
|
|
422499
|
+
aggregate = await stat26(join76(localHostPath, "aggregate.json"));
|
|
422500
|
+
} catch (error52) {
|
|
422501
|
+
if (isNodeError4(error52, "ENOENT")) throw localHostStorageError(entry.name);
|
|
422502
|
+
throw localHostStorageError(entry.name);
|
|
422503
|
+
}
|
|
422504
|
+
if (!aggregate.isFile()) throw localHostStorageError(entry.name);
|
|
422505
|
+
missionIds.push(entry.name);
|
|
422506
|
+
}
|
|
422295
422507
|
const snapshots = await Promise.all(
|
|
422296
|
-
|
|
422297
|
-
|
|
422508
|
+
missionIds.map(async (missionId) => {
|
|
422509
|
+
let snapshot;
|
|
422510
|
+
try {
|
|
422511
|
+
snapshot = await controller.readSnapshot({ missionId });
|
|
422512
|
+
} catch (error52) {
|
|
422513
|
+
if (IntegrationErrorSchema.safeParse(error52).success) throw error52;
|
|
422514
|
+
throw localHostStorageError(missionId);
|
|
422515
|
+
}
|
|
422298
422516
|
const created = snapshot.events.find((event) => event.type === "mission.created");
|
|
422299
422517
|
if (created === void 0) return void 0;
|
|
422300
422518
|
const latest = snapshot.events.at(-1);
|
|
422301
422519
|
const status = missionStatus(snapshot.events.map((event) => event.type));
|
|
422302
422520
|
const executor = created.data["executor"];
|
|
422303
422521
|
return {
|
|
422304
|
-
id:
|
|
422305
|
-
missionId
|
|
422306
|
-
title:
|
|
422522
|
+
id: missionId,
|
|
422523
|
+
missionId,
|
|
422524
|
+
title: missionId,
|
|
422307
422525
|
...executor === void 0 ? {} : { executor },
|
|
422308
422526
|
...created.data["workspace"] === void 0 ? {} : { workspace: { canonicalPath: created.data["workspace"] } },
|
|
422309
422527
|
status,
|
|
@@ -422323,6 +422541,14 @@ async function listMissionSnapshots(controller, missionsPath) {
|
|
|
422323
422541
|
(left, right) => String(right["updatedAt"]).localeCompare(String(left["updatedAt"]))
|
|
422324
422542
|
);
|
|
422325
422543
|
}
|
|
422544
|
+
function localHostStorageError(missionId) {
|
|
422545
|
+
return createIntegrationError({
|
|
422546
|
+
code: "STORAGE_CORRUPTED",
|
|
422547
|
+
category: "protocol",
|
|
422548
|
+
message: "A Local Host Mission aggregate is corrupted.",
|
|
422549
|
+
details: { missionId }
|
|
422550
|
+
});
|
|
422551
|
+
}
|
|
422326
422552
|
function missionStatus(eventTypes) {
|
|
422327
422553
|
for (const type of eventTypes.toReversed()) {
|
|
422328
422554
|
switch (type) {
|