@runweave/server-win32-x64 0.1.27 → 0.1.28
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/manifest.json +156 -154
- package/native.tar.gz +0 -0
- package/package.json +1 -1
- package/payload/app-server/build-info.json +4 -4
- package/payload/app-server/index.cjs +636 -315
- package/payload/app-server/index.cjs.map +1 -1
- package/payload/backend/build-info.json +4 -4
- package/payload/backend/index.cjs +673 -291
- package/payload/frontend/dist/assets/{_baseUniq-CvQ_Kf6J.js → _baseUniq-CMN8EMJe.js} +1 -1
- package/payload/frontend/dist/assets/{access-BM48T8pi.js → access-DFaVCfwr.js} +1 -1
- package/payload/frontend/dist/assets/{advanced-tiNwdsWg.js → advanced-CKAJ9tXg.js} +1 -1
- package/payload/frontend/dist/assets/{appearance-BkACCLPd.js → appearance-CKvvyFpM.js} +1 -1
- package/payload/frontend/dist/assets/{arc-CG4ZorIz.js → arc-Cbf15wI1.js} +1 -1
- package/payload/frontend/dist/assets/{architectureDiagram-Q4EWVU46-ChTaJQWa.js → architectureDiagram-Q4EWVU46-Bvi3ZBt1.js} +1 -1
- package/payload/frontend/dist/assets/{blockDiagram-DXYQGD6D-wyOyxXn6.js → blockDiagram-DXYQGD6D-DgDkN-KK.js} +1 -1
- package/payload/frontend/dist/assets/{c4Diagram-AHTNJAMY-aTSGv6b-.js → c4Diagram-AHTNJAMY-CWt609Q-.js} +1 -1
- package/payload/frontend/dist/assets/channel-CdBTczzC.js +1 -0
- package/payload/frontend/dist/assets/{chunk-4BX2VUAB-CL1i1VLL.js → chunk-4BX2VUAB-BFqHquBR.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-4TB4RGXK-DIeWEhjD.js → chunk-4TB4RGXK-CW5WaIJq.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-55IACEB6-Cggk_br2.js → chunk-55IACEB6-DHJtIfsv.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-EDXVE4YY-B9bwitXJ.js → chunk-EDXVE4YY-CGOb1mZr.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-FMBD7UC4-BY4GYa45.js → chunk-FMBD7UC4-CSoB33q_.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-OYMX7WX6-CsZ8Gk1p.js → chunk-OYMX7WX6-C01d--Rs.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-QZHKN3VN-m0WQ1QIW.js → chunk-QZHKN3VN-CUx1bRVL.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-YZCP3GAM-BJFF_8vq.js → chunk-YZCP3GAM-ClNvKMAO.js} +1 -1
- package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-DarZ1ILp.js +1 -0
- package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-DarZ1ILp.js +1 -0
- package/payload/frontend/dist/assets/clone--jdpc5ik.js +1 -0
- package/payload/frontend/dist/assets/{connection-xS-NfZnK.js → connection-DVMHE60_.js} +1 -1
- package/payload/frontend/dist/assets/{connections-BNpmNrpN.js → connections-C_lEmoKc.js} +1 -1
- package/payload/frontend/dist/assets/{cose-bilkent-S5V4N54A-Dfl9Zac8.js → cose-bilkent-S5V4N54A-1sgd6Ms5.js} +1 -1
- package/payload/frontend/dist/assets/{dagre-KV5264BT-CbufX2f3.js → dagre-KV5264BT-DPn4YqGI.js} +1 -1
- package/payload/frontend/dist/assets/{desktop-CJFLIWqk.js → desktop-CSZOBxgD.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-5BDNPKRD-Bv4HpQAy.js → diagram-5BDNPKRD-BHjywjmP.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-G4DWMVQ6-qCQp8RdH.js → diagram-G4DWMVQ6-S7iEdHyz.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-MMDJMWI5-B_XnhIdh.js → diagram-MMDJMWI5-DqMZnrHB.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-TYMM5635-CLa1LRaH.js → diagram-TYMM5635-BYTMiif1.js} +1 -1
- package/payload/frontend/dist/assets/{erDiagram-SMLLAGMA-CeaiozYq.js → erDiagram-SMLLAGMA-B4hCkvwX.js} +1 -1
- package/payload/frontend/dist/assets/{flowDiagram-DWJPFMVM-DvZ6HuiB.js → flowDiagram-DWJPFMVM-DDkmdUVE.js} +1 -1
- package/payload/frontend/dist/assets/{ganttDiagram-T4ZO3ILL-Cr27GUzO.js → ganttDiagram-T4ZO3ILL-BGIkOL1N.js} +1 -1
- package/payload/frontend/dist/assets/{gitGraphDiagram-UUTBAWPF-D7cLIKdE.js → gitGraphDiagram-UUTBAWPF-CqEnUqEN.js} +1 -1
- package/payload/frontend/dist/assets/{graph-D3h2OtRH.js → graph-CE7npIW2.js} +1 -1
- package/payload/frontend/dist/assets/{image-pr8iiZ6b.js → image-BsntFN4u.js} +1 -1
- package/payload/frontend/dist/assets/{index-BTUcEYWC.js → index-DY03KvB5.js} +6 -6
- package/payload/frontend/dist/assets/{infoDiagram-42DDH7IO-D-898NXw.js → infoDiagram-42DDH7IO-DKWMe4K7.js} +1 -1
- package/payload/frontend/dist/assets/{ishikawaDiagram-UXIWVN3A-FCDV3drO.js → ishikawaDiagram-UXIWVN3A-DeYvcKaA.js} +1 -1
- package/payload/frontend/dist/assets/{journeyDiagram-VCZTEJTY-CGbhVJdx.js → journeyDiagram-VCZTEJTY-BQ8mdvF0.js} +1 -1
- package/payload/frontend/dist/assets/{kanban-definition-6JOO6SKY-BdZMqjYd.js → kanban-definition-6JOO6SKY-B7Ke9FjO.js} +1 -1
- package/payload/frontend/dist/assets/{layout-CSVX6YJ2.js → layout-DcxgNsVh.js} +1 -1
- package/payload/frontend/dist/assets/{linear-BC2CbN34.js → linear-DSV9ubbU.js} +1 -1
- package/payload/frontend/dist/assets/{main-B5-ZQCYl.js → main-CpzvlGm1.js} +144 -144
- package/payload/frontend/dist/assets/{min-BOM36O-V.js → min-Dd3QZ8lP.js} +1 -1
- package/payload/frontend/dist/assets/{mindmap-definition-QFDTVHPH-K1lKJajL.js → mindmap-definition-QFDTVHPH-DaFx6hc6.js} +1 -1
- package/payload/frontend/dist/assets/{monitoring-Cper7Dw-.js → monitoring-CsBkbvRU.js} +1 -1
- package/payload/frontend/dist/assets/{notifications-DrRwAV8g.js → notifications-BYk1WjVP.js} +1 -1
- package/payload/frontend/dist/assets/{pieDiagram-DEJITSTG-Cln37rnp.js → pieDiagram-DEJITSTG-VQsbwxkg.js} +1 -1
- package/payload/frontend/dist/assets/{quadrantDiagram-34T5L4WZ-DBP5Cea5.js → quadrantDiagram-34T5L4WZ-tLKlVC0j.js} +1 -1
- package/payload/frontend/dist/assets/{record-content-CsOXQ3vx.js → record-content-DWUPk_tO.js} +1 -1
- package/payload/frontend/dist/assets/{requirementDiagram-MS252O5E-C6DUCDR4.js → requirementDiagram-MS252O5E-DDfjmbNt.js} +1 -1
- package/payload/frontend/dist/assets/{sankeyDiagram-XADWPNL6-D-neOSXc.js → sankeyDiagram-XADWPNL6-SaxuUxjL.js} +1 -1
- package/payload/frontend/dist/assets/{sequenceDiagram-FGHM5R23-ok7v11We.js → sequenceDiagram-FGHM5R23-C2bw8Wko.js} +1 -1
- package/payload/frontend/dist/assets/{stateDiagram-FHFEXIEX-t2YXr83_.js → stateDiagram-FHFEXIEX-BgrY776w.js} +1 -1
- package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-BuYWor8l.js +1 -0
- package/payload/frontend/dist/assets/{status-DEsW_4J3.js → status-BQ_1tMq6.js} +1 -1
- package/payload/frontend/dist/assets/suiji-Bct1RCM_.js +1 -0
- package/payload/frontend/dist/assets/{svg-BATDsnTM.js → svg-CrC4YdVu.js} +1 -1
- package/payload/frontend/dist/assets/{tabs-dzJwAbvS.js → tabs-BvO6o4wK.js} +1 -1
- package/payload/frontend/dist/assets/{timeline-definition-GMOUNBTQ-DeW1BaAA.js → timeline-definition-GMOUNBTQ-N9V5Dskh.js} +1 -1
- package/payload/frontend/dist/assets/{vennDiagram-DHZGUBPP-DIaLa_Oo.js → vennDiagram-DHZGUBPP-gAjWqrE-.js} +1 -1
- package/payload/frontend/dist/assets/{wardley-RL74JXVD-DcfvLEAe.js → wardley-RL74JXVD-DV4R7zd5.js} +1 -1
- package/payload/frontend/dist/assets/{wardleyDiagram-NUSXRM2D-C0FuVPkb.js → wardleyDiagram-NUSXRM2D-DBzyAlhE.js} +1 -1
- package/payload/frontend/dist/assets/{xychartDiagram-5P7HB3ND-DIa6gq2O.js → xychartDiagram-5P7HB3ND-BGAjyxZd.js} +1 -1
- package/payload/frontend/dist/build-info.json +4 -4
- package/payload/frontend/dist/companion.html +1 -1
- package/payload/frontend/dist/index.html +2 -2
- package/payload/frontend/dist/assets/channel-CsCfvOaJ.js +0 -1
- package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-esUmDk_l.js +0 -1
- package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-esUmDk_l.js +0 -1
- package/payload/frontend/dist/assets/clone-DIPLBiAi.js +0 -1
- package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-Bl3BtoZ6.js +0 -1
- package/payload/frontend/dist/assets/suiji-C5flJh58.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* runweave:build-info */var __RUNWEAVE_BUILD_INFO__={"version":"0.1.0","buildId":"
|
|
1
|
+
/* runweave:build-info */var __RUNWEAVE_BUILD_INFO__={"version":"0.1.0","buildId":"20261115T232603953Z-06d2bd51","sourceRevision":"06d2bd5167dce947cb3e3e42805a5e97c5a8563f","sourceDirty":false,"builtAt":"2026-11-15T23:26:03.953Z","contentSha256":"9b4cbfd2795b1f9b2203cb34617573bcb0bb4dc51d4303eb2aad2db95b82d662"};
|
|
2
2
|
const __IMPORT_META_URL__ = require('url').pathToFileURL(__filename).href;
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -69936,10 +69936,10 @@ var FeishuBridgeConnector = class {
|
|
|
69936
69936
|
for (const item of [...this.pending.values()])
|
|
69937
69937
|
item.reject(new FeishuBridgeError("input_unknown"));
|
|
69938
69938
|
if (!this.stopped) {
|
|
69939
|
-
const
|
|
69939
|
+
const delay11 = Math.min(3e4, 1e3 * 2 ** Math.min(this.retry++, 5));
|
|
69940
69940
|
this.reconnect = setTimeout(
|
|
69941
69941
|
() => this.connect(),
|
|
69942
|
-
Math.min(3e4,
|
|
69942
|
+
Math.min(3e4, delay11 * (1 + Math.random() * 0.2))
|
|
69943
69943
|
);
|
|
69944
69944
|
}
|
|
69945
69945
|
});
|
|
@@ -77452,7 +77452,7 @@ function createResourceSampler(helperPath) {
|
|
|
77452
77452
|
);
|
|
77453
77453
|
if (match) rss.set(Number(match[1]), Number(match[2]) / 1024);
|
|
77454
77454
|
}
|
|
77455
|
-
const
|
|
77455
|
+
const processes2 = [];
|
|
77456
77456
|
const apps = /* @__PURE__ */ new Map();
|
|
77457
77457
|
let matched = 0;
|
|
77458
77458
|
for (const identity2 of [...all.values()].slice(0, 4096)) {
|
|
@@ -77484,7 +77484,7 @@ function createResourceSampler(helperPath) {
|
|
|
77484
77484
|
actionKind: identity2.actionKind,
|
|
77485
77485
|
actionReason: reason
|
|
77486
77486
|
};
|
|
77487
|
-
|
|
77487
|
+
processes2.push(item);
|
|
77488
77488
|
const group = apps.get(appKey) ?? {
|
|
77489
77489
|
appKey,
|
|
77490
77490
|
appName,
|
|
@@ -77563,7 +77563,7 @@ function createResourceSampler(helperPath) {
|
|
|
77563
77563
|
dischargePowerW
|
|
77564
77564
|
} : { available: false },
|
|
77565
77565
|
apps: [...apps.values()],
|
|
77566
|
-
processes
|
|
77566
|
+
processes: processes2
|
|
77567
77567
|
}
|
|
77568
77568
|
};
|
|
77569
77569
|
};
|
|
@@ -79548,15 +79548,18 @@ var import_node_path31 = __toESM(require("node:path"), 1);
|
|
|
79548
79548
|
var INPUT_BUDGET_BYTES = 18e4;
|
|
79549
79549
|
var digest = (text5) => (0, import_node_crypto26.createHash)("sha256").update(text5).digest("hex");
|
|
79550
79550
|
var isSupervisionPrompt = (text5) => text5.includes("[runweave-task-supervision:") || text5.startsWith("[runweave-code-review-feedback:");
|
|
79551
|
-
async function readWatchContext(watch, threadId, read) {
|
|
79551
|
+
async function readWatchContext(watch, threadId, read, recentOnly = false) {
|
|
79552
79552
|
const current = watch.target.threadId === threadId;
|
|
79553
79553
|
const ids = current ? [
|
|
79554
79554
|
.../* @__PURE__ */ new Set([
|
|
79555
|
-
watch.
|
|
79556
|
-
...
|
|
79557
|
-
|
|
79558
|
-
|
|
79559
|
-
|
|
79555
|
+
...watch.contextStartMessageId ? [watch.contextStartMessageId] : [],
|
|
79556
|
+
...recentOnly ? [] : [
|
|
79557
|
+
watch.taskStartMessageId,
|
|
79558
|
+
...watch.evidenceMessageIds ?? [],
|
|
79559
|
+
...watch.completedReplyIds ?? [],
|
|
79560
|
+
...watch.goalDefinition?.sourceMessageIds ?? [],
|
|
79561
|
+
...watch.goalDefinition?.plans.flatMap((p) => [p.sourceMessageId, p.authorizationMessageId]) ?? []
|
|
79562
|
+
]
|
|
79560
79563
|
])
|
|
79561
79564
|
].filter((id7) => !id7.startsWith("pending:") && !id7.startsWith("goal-manual:")) : [];
|
|
79562
79565
|
if (ids.length > 63)
|
|
@@ -79568,7 +79571,23 @@ async function readWatchContext(watch, threadId, read) {
|
|
|
79568
79571
|
throw new Error(
|
|
79569
79572
|
"CONTEXT_SOURCE_CHANGED: \u539F\u59CB\u4F1A\u8BDD\u5DF2\u66FF\u6362\uFF0C\u65E7\u6765\u6E90\u4E0D\u53EF\u590D\u7528\uFF1B\u8BF7\u5728\u65B0\u4F1A\u8BDD\u7EE7\u7EED\u4EFB\u52A1\u3002"
|
|
79570
79573
|
);
|
|
79571
|
-
return source2;
|
|
79574
|
+
return scopeWatchContext(current ? watch.contextStartMessageId : void 0, source2);
|
|
79575
|
+
}
|
|
79576
|
+
function scopeWatchContext(startMessageId, source2) {
|
|
79577
|
+
if (!startMessageId) return source2;
|
|
79578
|
+
const messages = messagesFrom(source2);
|
|
79579
|
+
if (!messages.some((message2) => message2.id === startMessageId && message2.role === "user"))
|
|
79580
|
+
throw new Error("\u76D1\u63A7\u91CD\u7F6E\u8D77\u70B9\u4E0D\u53EF\u8BFB\uFF0C\u672A\u4F7F\u7528\u65E7\u4E0A\u4E0B\u6587\uFF1B\u8BF7\u4ECE\u6700\u65B0\u8BF7\u6C42\u91CD\u65B0\u91CD\u7F6E\u3002");
|
|
79581
|
+
let started = false;
|
|
79582
|
+
const turns = source2.turns.map((turn) => ({
|
|
79583
|
+
...turn,
|
|
79584
|
+
messages: turn.messages.filter((message2) => {
|
|
79585
|
+
if (message2.id === startMessageId) started = true;
|
|
79586
|
+
return started;
|
|
79587
|
+
})
|
|
79588
|
+
})).filter((turn) => turn.messages.length);
|
|
79589
|
+
const runtimeError = source2.runtimeError && turns.some((turn) => turn.messages.some((message2) => message2.rawTurnId === source2.runtimeError?.turnId)) ? source2.runtimeError : void 0;
|
|
79590
|
+
return { ...source2, turns, runtimeError };
|
|
79572
79591
|
}
|
|
79573
79592
|
function messagesFrom(content) {
|
|
79574
79593
|
if (content.availability !== "available" || content.partial)
|
|
@@ -80247,6 +80266,7 @@ function synchronizeTarget(watch, target2, cancel) {
|
|
|
80247
80266
|
const pendingId = `pending:${(0, import_node_crypto28.randomUUID)()}`;
|
|
80248
80267
|
watch.taskStartMessageId = pendingId;
|
|
80249
80268
|
delete watch.sourceVersion;
|
|
80269
|
+
delete watch.contextStartMessageId;
|
|
80250
80270
|
watch.task = { id: pendingId, role: "user", text: "" };
|
|
80251
80271
|
watch.goal = "";
|
|
80252
80272
|
watch.plans = [];
|
|
@@ -80371,7 +80391,7 @@ function alreadyProcessedReply(watch, threadId, reply) {
|
|
|
80371
80391
|
(decision3) => decision3.threadId === threadId && decision3.contextRevision === watch.contextRevision && decision3.goalVersion === watch.goalDefinition?.version && decision3.currentReplyId === reply.id && decision3.rawTurnId === (reply.rawTurnId ?? reply.id)
|
|
80372
80392
|
);
|
|
80373
80393
|
}
|
|
80374
|
-
async function readFinalReply(read, event, signal) {
|
|
80394
|
+
async function readFinalReply(read, event, signal, afterReset = false) {
|
|
80375
80395
|
let source2 = await read();
|
|
80376
80396
|
const readError = () => runtimeErrorReply(source2, event);
|
|
80377
80397
|
let messages = messagesFrom(source2);
|
|
@@ -80381,8 +80401,11 @@ async function readFinalReply(read, event, signal) {
|
|
|
80381
80401
|
))
|
|
80382
80402
|
);
|
|
80383
80403
|
const failure3 = readError();
|
|
80384
|
-
if (event.error && !failure3)
|
|
80404
|
+
if (event.error && !failure3) {
|
|
80405
|
+
if (afterReset && event.turnId && !messages.some((message2) => message2.rawTurnId === event.turnId))
|
|
80406
|
+
return { source: source2, messages, native: void 0 };
|
|
80385
80407
|
throw new Error(`${event.error.code}: ${event.error.message}`);
|
|
80408
|
+
}
|
|
80386
80409
|
let native = failure3 ?? locate();
|
|
80387
80410
|
for (let attempt = 0; !native && attempt < 3 && !signal.aborted; attempt++) {
|
|
80388
80411
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
@@ -80390,6 +80413,7 @@ async function readFinalReply(read, event, signal) {
|
|
|
80390
80413
|
messages = messagesFrom(source2);
|
|
80391
80414
|
native = readError() ?? locate();
|
|
80392
80415
|
}
|
|
80416
|
+
if (!native && afterReset) return { source: source2, messages, native: void 0 };
|
|
80393
80417
|
if (!native)
|
|
80394
80418
|
throw new Error("\u6700\u7EC8\u56DE\u590D\u4E8B\u4EF6\u5DF2\u6536\u5230\uFF0C\u4F46\u5B8C\u6574\u4F1A\u8BDD\u5C1A\u4E0D\u53EF\u8BFB\uFF1B\u7B49\u5F85\u4E0B\u4E00\u6761\u56DE\u590D\u3002");
|
|
80395
80419
|
return { source: source2, messages, native };
|
|
@@ -80887,8 +80911,18 @@ async function processSupervisionReply(operations, id7, target2, event, controll
|
|
|
80887
80911
|
const { source: source2, messages, native } = await readFinalReply(
|
|
80888
80912
|
() => operations.readContext(id7, target2.threadId),
|
|
80889
80913
|
event,
|
|
80890
|
-
controller.signal
|
|
80914
|
+
controller.signal,
|
|
80915
|
+
!!operations.find(id7).contextStartMessageId
|
|
80891
80916
|
);
|
|
80917
|
+
if (!native) {
|
|
80918
|
+
await operations.transaction(() => {
|
|
80919
|
+
if (controller.signal.aborted) return;
|
|
80920
|
+
const watch = operations.find(id7);
|
|
80921
|
+
if (watch.pendingReply?.eventId === event.eventId) delete watch.pendingReply;
|
|
80922
|
+
});
|
|
80923
|
+
skip("reply_not_in_reset_context");
|
|
80924
|
+
return ALLOW;
|
|
80925
|
+
}
|
|
80892
80926
|
const finalKey = `${target2.threadId}:${native.id}`;
|
|
80893
80927
|
stage = "prepare_context";
|
|
80894
80928
|
let snapshot2 = await operations.transaction(async () => {
|
|
@@ -81308,7 +81342,7 @@ var SupervisionGoalEditor = class {
|
|
|
81308
81342
|
for (; ; ) {
|
|
81309
81343
|
signal.throwIfAborted();
|
|
81310
81344
|
try {
|
|
81311
|
-
const source3 = await (recent ? ops.readRecent(watch.target.threadId, signal) : ops.read(id7, watch.target.threadId, signal));
|
|
81345
|
+
const source3 = await (recent ? ops.readRecent(id7, watch.target.threadId, signal) : ops.read(id7, watch.target.threadId, signal));
|
|
81312
81346
|
signal.throwIfAborted();
|
|
81313
81347
|
return source3;
|
|
81314
81348
|
} catch (error2) {
|
|
@@ -81370,7 +81404,7 @@ var SupervisionGoalEditor = class {
|
|
|
81370
81404
|
if (preview.needsClarification)
|
|
81371
81405
|
throw new SupervisionError("\u5FC5\u8981\u6765\u6E90\u4E0D\u8DB3\uFF0C\u8BF7\u660E\u786E\u76EE\u6807\u540E\u518D\u91C7\u7528\u3002", 422);
|
|
81372
81406
|
const signal = AbortSignal.timeout(ops.timeoutMs());
|
|
81373
|
-
const source2 = await (entry.recent ? ops.readRecent(preview.target.threadId, signal) : ops.read(id7, preview.target.threadId, signal));
|
|
81407
|
+
const source2 = await (entry.recent ? ops.readRecent(id7, preview.target.threadId, signal) : ops.read(id7, preview.target.threadId, signal));
|
|
81374
81408
|
let adopted = false;
|
|
81375
81409
|
const updated = await ops.transaction(() => {
|
|
81376
81410
|
const watch = ops.find(id7);
|
|
@@ -81446,6 +81480,7 @@ var SupervisionGoalEditor = class {
|
|
|
81446
81480
|
|
|
81447
81481
|
// backend/src/task-supervision/service.ts
|
|
81448
81482
|
var import_node_path37 = __toESM(require("node:path"), 1);
|
|
81483
|
+
var import_node_crypto33 = require("node:crypto");
|
|
81449
81484
|
var import_promises21 = require("node:timers/promises");
|
|
81450
81485
|
|
|
81451
81486
|
// backend/src/app-server/handlers/agent-event-payload.ts
|
|
@@ -82514,7 +82549,7 @@ var TaskSupervisionService = class {
|
|
|
82514
82549
|
find: (id7) => this.find(id7),
|
|
82515
82550
|
read: (id7, thread, signal) => this.readContext(id7, thread, signal),
|
|
82516
82551
|
current: (target2) => this.current(target2),
|
|
82517
|
-
readRecent: (thread, signal) => this.
|
|
82552
|
+
readRecent: (id7, thread, signal) => this.readContext(id7, thread, signal, true),
|
|
82518
82553
|
timeoutMs: () => this.modelOptions().timeoutMs,
|
|
82519
82554
|
root: (target2) => this.resolve(target2.terminalSessionId, target2.panelId).root,
|
|
82520
82555
|
inputRevision: (target2) => terminalInputAdmission(this.manager.getSession(target2.terminalSessionId)).revision,
|
|
@@ -82635,8 +82670,8 @@ var TaskSupervisionService = class {
|
|
|
82635
82670
|
});
|
|
82636
82671
|
return [];
|
|
82637
82672
|
}
|
|
82638
|
-
readContext(id7, threadId, signal) {
|
|
82639
|
-
return readWatchContext(this.find(id7), threadId, (thread, ids) => this.history.getSupervisionContext(thread, ids, signal));
|
|
82673
|
+
readContext(id7, threadId, signal, recentOnly = false) {
|
|
82674
|
+
return readWatchContext(this.find(id7), threadId, (thread, ids) => this.history.getSupervisionContext(thread, ids, signal), recentOnly);
|
|
82640
82675
|
}
|
|
82641
82676
|
async discover(terminalSessionId, panelId, _expectedThreadId) {
|
|
82642
82677
|
void _expectedThreadId;
|
|
@@ -82716,8 +82751,40 @@ var TaskSupervisionService = class {
|
|
|
82716
82751
|
}
|
|
82717
82752
|
async change(id7, request2) {
|
|
82718
82753
|
if (request2.action === "retry-continuation") return retryContinuation(request2, this.continuationOperations(id7));
|
|
82754
|
+
if (request2.action === "reset") return this.reset(id7, request2.expectedRevision);
|
|
82719
82755
|
return this.transaction(() => changeWatch(id7, request2, this.watchControls()));
|
|
82720
82756
|
}
|
|
82757
|
+
async reset(id7, expectedRevision) {
|
|
82758
|
+
const before = await this.get(id7);
|
|
82759
|
+
if (before.revision !== expectedRevision || !this.current(before.target))
|
|
82760
|
+
throw new SupervisionError("\u76D1\u63A7\u72B6\u6001\u6216\u4F1A\u8BDD\u5DF2\u53D8\u5316\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u7F6E\u3002");
|
|
82761
|
+
const session = this.manager.getSession(before.target.terminalSessionId);
|
|
82762
|
+
const inputRevision = terminalInputAdmission(session).inputWriteRevision;
|
|
82763
|
+
const source2 = await this.history.getSupervisionContext(before.target.threadId, []);
|
|
82764
|
+
const task = taskCandidates(source2).at(-1);
|
|
82765
|
+
if (!task) throw new SupervisionError("\u5F53\u524D\u4F1A\u8BDD\u8FD8\u6CA1\u6709\u53EF\u8BFB\u7684\u7528\u6237\u8BF7\u6C42\uFF0C\u672A\u91CD\u7F6E\u76D1\u63A7\u3002", 422);
|
|
82766
|
+
return this.transaction(() => {
|
|
82767
|
+
if (!this.current(before.target) || terminalInputAdmission(session).inputWriteRevision !== inputRevision)
|
|
82768
|
+
throw new SupervisionError("\u8BFB\u53D6\u671F\u95F4\u4F1A\u8BDD\u6216\u8F93\u5165\u5DF2\u53D8\u5316\uFF0C\u8BF7\u6838\u5BF9\u6700\u65B0\u8BF7\u6C42\u540E\u91CD\u7F6E\u3002");
|
|
82769
|
+
const controls = this.watchControls();
|
|
82770
|
+
changeWatch(id7, { action: "pause", expectedRevision }, controls);
|
|
82771
|
+
const watch = startWatch(this.journal, {
|
|
82772
|
+
target: before.target,
|
|
82773
|
+
requestId: (0, import_node_crypto33.randomUUID)(),
|
|
82774
|
+
taskStartMessageId: "",
|
|
82775
|
+
goal: "",
|
|
82776
|
+
planPaths: []
|
|
82777
|
+
}, controls);
|
|
82778
|
+
watch.contextStartMessageId = task.id;
|
|
82779
|
+
watch.taskStartMessageId = task.id;
|
|
82780
|
+
watch.lastUserMessageId = task.id;
|
|
82781
|
+
watch.task = task;
|
|
82782
|
+
watch.goal = task.text;
|
|
82783
|
+
watch.goalState = "checking";
|
|
82784
|
+
watch.sourceVersion = source2.sourceVersion;
|
|
82785
|
+
return watch;
|
|
82786
|
+
});
|
|
82787
|
+
}
|
|
82721
82788
|
continuationOperations(id7) {
|
|
82722
82789
|
return {
|
|
82723
82790
|
get: () => this.get(id7),
|
|
@@ -82941,7 +83008,7 @@ var start = external_exports.object({
|
|
|
82941
83008
|
expectedRevision: external_exports.number().int().positive().optional()
|
|
82942
83009
|
}).strict();
|
|
82943
83010
|
var change = external_exports.object({
|
|
82944
|
-
action: external_exports.enum(["pause", "resume", "update-context", "retry-continuation"]),
|
|
83011
|
+
action: external_exports.enum(["pause", "resume", "reset", "update-context", "retry-continuation"]),
|
|
82945
83012
|
expectedRevision: external_exports.number().int().positive(),
|
|
82946
83013
|
goal: external_exports.string().trim().min(1).max(8e3).optional(),
|
|
82947
83014
|
decisionId: external_exports.string().uuid().optional(),
|
|
@@ -83174,7 +83241,7 @@ function registerTerminalTaskRoutes(app, services, requireAuth, requireTunnelAut
|
|
|
83174
83241
|
|
|
83175
83242
|
// backend/src/bootstrap/bound-cli.ts
|
|
83176
83243
|
var import_node_fs21 = require("node:fs");
|
|
83177
|
-
var
|
|
83244
|
+
var import_node_crypto34 = require("node:crypto");
|
|
83178
83245
|
var import_node_path38 = __toESM(require("node:path"), 1);
|
|
83179
83246
|
function installBoundCli(context) {
|
|
83180
83247
|
const directory4 = import_node_path38.default.dirname(process.argv[1] ?? "");
|
|
@@ -83192,13 +83259,13 @@ function installBoundCli(context) {
|
|
|
83192
83259
|
if (!modules) throw new Error("CONFIG_BOUND_CLI_DEPENDENCIES_REQUIRED");
|
|
83193
83260
|
const bin = import_node_path38.default.join(context.configRoot, "runtime", "bin");
|
|
83194
83261
|
(0, import_node_fs21.mkdirSync)(bin, { recursive: true, mode: 448 });
|
|
83195
|
-
const digest8 = (0,
|
|
83262
|
+
const digest8 = (0, import_node_crypto34.createHash)("sha256").update((0, import_node_fs21.readFileSync)(entry)).digest("hex");
|
|
83196
83263
|
const versionFile = ["release.json", "build-info.json"].map((name) => import_node_path38.default.join(import_node_path38.default.dirname(entry), name)).find(import_node_fs21.existsSync);
|
|
83197
83264
|
const versionBytes = versionFile ? (0, import_node_fs21.readFileSync)(versionFile) : null;
|
|
83198
|
-
const versionDigest = versionBytes ? (0,
|
|
83265
|
+
const versionDigest = versionBytes ? (0, import_node_crypto34.createHash)("sha256").update(versionBytes).digest("hex").slice(0, 16) : "unknown";
|
|
83199
83266
|
const release = import_node_path38.default.join(context.configRoot, "runtime", "cli", `${digest8}-${versionDigest}-cjs`);
|
|
83200
83267
|
if (!(0, import_node_fs21.existsSync)(import_node_path38.default.join(release, "index.cjs"))) {
|
|
83201
|
-
const temporary = `${release}.${(0,
|
|
83268
|
+
const temporary = `${release}.${(0, import_node_crypto34.randomUUID)()}.tmp`;
|
|
83202
83269
|
(0, import_node_fs21.mkdirSync)(temporary, { recursive: true, mode: 448 });
|
|
83203
83270
|
(0, import_node_fs21.cpSync)(entry, import_node_path38.default.join(temporary, "index.cjs"));
|
|
83204
83271
|
if (versionBytes && versionFile) (0, import_node_fs21.writeFileSync)(import_node_path38.default.join(temporary, import_node_path38.default.basename(versionFile)), versionBytes);
|
|
@@ -83227,7 +83294,7 @@ process.exit(result.status??1);
|
|
|
83227
83294
|
exec env ELECTRON_RUN_AS_NODE=1 ${quote(process.execPath)} ${quote(runner)} "$@"
|
|
83228
83295
|
`, 448]
|
|
83229
83296
|
]) {
|
|
83230
|
-
const temporary = `${file}.${(0,
|
|
83297
|
+
const temporary = `${file}.${(0, import_node_crypto34.randomUUID)()}.tmp`;
|
|
83231
83298
|
(0, import_node_fs21.writeFileSync)(temporary, content, { mode, flag: "wx" });
|
|
83232
83299
|
(0, import_node_fs21.renameSync)(temporary, file);
|
|
83233
83300
|
}
|
|
@@ -83478,7 +83545,7 @@ var ExperienceError = class extends Error {
|
|
|
83478
83545
|
};
|
|
83479
83546
|
|
|
83480
83547
|
// backend/src/experience/candidate-lifecycle.ts
|
|
83481
|
-
var
|
|
83548
|
+
var import_node_crypto35 = require("node:crypto");
|
|
83482
83549
|
|
|
83483
83550
|
// backend/src/experience/storage.ts
|
|
83484
83551
|
var import_node_fs22 = require("node:fs");
|
|
@@ -83569,7 +83636,7 @@ var ExperienceStore = class {
|
|
|
83569
83636
|
function candidateView(candidate) {
|
|
83570
83637
|
return {
|
|
83571
83638
|
candidate,
|
|
83572
|
-
version: (0,
|
|
83639
|
+
version: (0, import_node_crypto35.createHash)("sha256").update(JSON.stringify(candidate)).digest("hex")
|
|
83573
83640
|
};
|
|
83574
83641
|
}
|
|
83575
83642
|
function readCandidate(directory4, candidateId) {
|
|
@@ -83687,12 +83754,12 @@ function readExperienceCatalog(storage, repositoryId, sourceAvailable, kind2, li
|
|
|
83687
83754
|
}
|
|
83688
83755
|
|
|
83689
83756
|
// backend/src/experience/maintenance-review.ts
|
|
83690
|
-
var
|
|
83757
|
+
var import_node_crypto37 = require("node:crypto");
|
|
83691
83758
|
var import_node_fs25 = require("node:fs");
|
|
83692
83759
|
var import_node_path42 = __toESM(require("node:path"), 1);
|
|
83693
83760
|
|
|
83694
83761
|
// backend/src/experience/evidence.ts
|
|
83695
|
-
var
|
|
83762
|
+
var import_node_crypto36 = require("node:crypto");
|
|
83696
83763
|
var import_node_fs24 = require("node:fs");
|
|
83697
83764
|
var import_promises22 = require("node:fs/promises");
|
|
83698
83765
|
var import_node_readline = require("node:readline");
|
|
@@ -83713,7 +83780,7 @@ function redactActivityText(value) {
|
|
|
83713
83780
|
|
|
83714
83781
|
// backend/src/experience/evidence.ts
|
|
83715
83782
|
var import_node_path41 = __toESM(require("node:path"), 1);
|
|
83716
|
-
var hash2 = (value) => (0,
|
|
83783
|
+
var hash2 = (value) => (0, import_node_crypto36.createHash)("sha256").update(value).digest("hex");
|
|
83717
83784
|
var IncompleteEvidence = class extends Error {
|
|
83718
83785
|
constructor(sourceSha256) {
|
|
83719
83786
|
super("experience_evidence_lines_missing");
|
|
@@ -83728,7 +83795,7 @@ async function readEvidence(input2, archive = false) {
|
|
|
83728
83795
|
throw new Error("experience_evidence_must_be_a_file");
|
|
83729
83796
|
}
|
|
83730
83797
|
const stream = (0, import_node_fs24.createReadStream)(input2.path);
|
|
83731
|
-
const observed = (0,
|
|
83798
|
+
const observed = (0, import_node_crypto36.createHash)("sha256");
|
|
83732
83799
|
stream.on("data", (chunk) => {
|
|
83733
83800
|
observed.update(chunk);
|
|
83734
83801
|
});
|
|
@@ -83806,7 +83873,7 @@ function redactExcerpt(value) {
|
|
|
83806
83873
|
}
|
|
83807
83874
|
|
|
83808
83875
|
// backend/src/experience/maintenance-review.ts
|
|
83809
|
-
var digest2 = (value) => (0,
|
|
83876
|
+
var digest2 = (value) => (0, import_node_crypto37.createHash)("sha256").update(JSON.stringify(value)).digest("hex");
|
|
83810
83877
|
var reviewKey = (policy, kind2, itemId2, version2) => digest2([policy, kind2, itemId2, version2]);
|
|
83811
83878
|
var reviewDirectory = (storage, repositoryId) => import_node_path42.default.join(storage.home, storage.namespace, repositoryId);
|
|
83812
83879
|
function readExperienceMaintenanceReview(storage, repositoryId, requestId) {
|
|
@@ -84048,7 +84115,7 @@ function replayReceipt(stored, repositoryId, namespace, requestHash) {
|
|
|
84048
84115
|
}
|
|
84049
84116
|
|
|
84050
84117
|
// backend/src/experience/service.ts
|
|
84051
|
-
var
|
|
84118
|
+
var import_node_crypto39 = require("node:crypto");
|
|
84052
84119
|
var import_node_path44 = __toESM(require("node:path"), 1);
|
|
84053
84120
|
|
|
84054
84121
|
// backend/src/experience/schema.ts
|
|
@@ -84095,7 +84162,7 @@ var cwdSchema = external_exports.string().trim().min(1).max(4e3);
|
|
|
84095
84162
|
|
|
84096
84163
|
// backend/src/repository/identity.ts
|
|
84097
84164
|
var import_node_child_process9 = require("node:child_process");
|
|
84098
|
-
var
|
|
84165
|
+
var import_node_crypto38 = require("node:crypto");
|
|
84099
84166
|
var import_promises23 = require("node:fs/promises");
|
|
84100
84167
|
var import_node_path43 = __toESM(require("node:path"), 1);
|
|
84101
84168
|
var import_node_util5 = require("node:util");
|
|
@@ -84122,7 +84189,7 @@ async function resolveRepositoryIdentity(cwd) {
|
|
|
84122
84189
|
]);
|
|
84123
84190
|
const commonDirectory = await (0, import_promises23.realpath)(common.stdout.trim());
|
|
84124
84191
|
return {
|
|
84125
|
-
repositoryId: (0,
|
|
84192
|
+
repositoryId: (0, import_node_crypto38.createHash)("sha256").update(commonDirectory).digest("hex"),
|
|
84126
84193
|
commonDirectory,
|
|
84127
84194
|
worktreeRoot: await (0, import_promises23.realpath)(root.stdout.trim())
|
|
84128
84195
|
};
|
|
@@ -84193,7 +84260,7 @@ var ExperienceService = class {
|
|
|
84193
84260
|
(a, b) => b.matchedTerms.length - a.matchedTerms.length || a.record.id.localeCompare(b.record.id)
|
|
84194
84261
|
);
|
|
84195
84262
|
const result = {
|
|
84196
|
-
lookupId: (0,
|
|
84263
|
+
lookupId: (0, import_node_crypto39.randomUUID)(),
|
|
84197
84264
|
repositoryId: scope.repositoryId,
|
|
84198
84265
|
namespace: scope.namespace,
|
|
84199
84266
|
matches: matches2.slice(0, 3).map((match) => ({
|
|
@@ -84326,7 +84393,7 @@ var ExperienceService = class {
|
|
|
84326
84393
|
...parsed,
|
|
84327
84394
|
repositoryId: scope.repositoryId,
|
|
84328
84395
|
namespace: scope.namespace,
|
|
84329
|
-
revision: (0,
|
|
84396
|
+
revision: (0, import_node_crypto39.randomUUID)(),
|
|
84330
84397
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
84331
84398
|
evidence: await Promise.all(parsed.evidence.map(snapshotEvidence))
|
|
84332
84399
|
};
|
|
@@ -84462,7 +84529,7 @@ var ExperienceService = class {
|
|
|
84462
84529
|
throw new ExperienceError("experience_not_in_lookup", 409);
|
|
84463
84530
|
const result = {
|
|
84464
84531
|
...input2,
|
|
84465
|
-
feedbackId: (0,
|
|
84532
|
+
feedbackId: (0, import_node_crypto39.randomUUID)(),
|
|
84466
84533
|
repositoryId: scope.repositoryId,
|
|
84467
84534
|
namespace: scope.namespace,
|
|
84468
84535
|
recordedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -84478,7 +84545,7 @@ var ExperienceService = class {
|
|
|
84478
84545
|
const invalidated = {
|
|
84479
84546
|
...withoutLegacyCodeHashes(record3),
|
|
84480
84547
|
state: "needs_revalidation",
|
|
84481
|
-
revision: (0,
|
|
84548
|
+
revision: (0, import_node_crypto39.randomUUID)(),
|
|
84482
84549
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
84483
84550
|
};
|
|
84484
84551
|
store.put("revisions", invalidated.revision, invalidated);
|
|
@@ -84822,7 +84889,7 @@ function trimTrailingSlash(value) {
|
|
|
84822
84889
|
}
|
|
84823
84890
|
|
|
84824
84891
|
// packages/config-node/src/app-server/runtime-release.ts
|
|
84825
|
-
var
|
|
84892
|
+
var import_node_crypto40 = require("node:crypto");
|
|
84826
84893
|
var import_node_fs26 = require("node:fs");
|
|
84827
84894
|
var import_node_path46 = __toESM(require("node:path"), 1);
|
|
84828
84895
|
function resolveCurrentAppServerRuntimeRelease(options = {}) {
|
|
@@ -84868,7 +84935,7 @@ function readJsonFile(filePath) {
|
|
|
84868
84935
|
}
|
|
84869
84936
|
}
|
|
84870
84937
|
function sha256(filePath) {
|
|
84871
|
-
return (0,
|
|
84938
|
+
return (0, import_node_crypto40.createHash)("sha256").update((0, import_node_fs26.readFileSync)(filePath)).digest("hex");
|
|
84872
84939
|
}
|
|
84873
84940
|
function isSafeRelativePath(value) {
|
|
84874
84941
|
if (typeof value !== "string") {
|
|
@@ -85127,7 +85194,7 @@ function createCodexQuotaRouter() {
|
|
|
85127
85194
|
var import_express17 = __toESM(require_express2(), 1);
|
|
85128
85195
|
|
|
85129
85196
|
// backend/src/device-monitor/subscriptions.ts
|
|
85130
|
-
var
|
|
85197
|
+
var import_node_crypto41 = require("node:crypto");
|
|
85131
85198
|
|
|
85132
85199
|
// backend/src/device-monitor/push-client.ts
|
|
85133
85200
|
var PushClientError = class extends Error {
|
|
@@ -85368,7 +85435,7 @@ var DeviceSubscriptions = class {
|
|
|
85368
85435
|
if (!existing && Object.values(data.subscriptions).filter((s) => s.enabled).length >= 100)
|
|
85369
85436
|
throw new SubscriptionError(429, "\u8BA2\u9605\u6570\u91CF\u5DF2\u8FBE\u4E0A\u9650");
|
|
85370
85437
|
const next = {
|
|
85371
|
-
id: existing?.id ?? (0,
|
|
85438
|
+
id: existing?.id ?? (0, import_node_crypto41.randomUUID)(),
|
|
85372
85439
|
installationId,
|
|
85373
85440
|
connectionId: owner.connectionId,
|
|
85374
85441
|
sessionId,
|
|
@@ -85641,7 +85708,7 @@ function normalizeMobileLoginBaseUrl(raw) {
|
|
|
85641
85708
|
}
|
|
85642
85709
|
|
|
85643
85710
|
// backend/src/auth/mobile-login.ts
|
|
85644
|
-
var
|
|
85711
|
+
var import_node_crypto42 = require("node:crypto");
|
|
85645
85712
|
var MobileLoginError = class extends Error {
|
|
85646
85713
|
constructor(status, code, retryAfter) {
|
|
85647
85714
|
super(code);
|
|
@@ -85651,8 +85718,8 @@ var MobileLoginError = class extends Error {
|
|
|
85651
85718
|
}
|
|
85652
85719
|
};
|
|
85653
85720
|
var unissued = (state) => ["waiting_scan", "pending_approval", "approved"].includes(state);
|
|
85654
|
-
var hash3 = (secret2) => (0,
|
|
85655
|
-
var matches = (secret2, expected) => !!expected && (0,
|
|
85721
|
+
var hash3 = (secret2) => (0, import_node_crypto42.createHash)("sha256").update(secret2).digest();
|
|
85722
|
+
var matches = (secret2, expected) => !!expected && (0, import_node_crypto42.timingSafeEqual)(hash3(secret2), expected);
|
|
85656
85723
|
var MobileLoginService = class {
|
|
85657
85724
|
constructor(auth) {
|
|
85658
85725
|
this.auth = auth;
|
|
@@ -85692,8 +85759,8 @@ var MobileLoginService = class {
|
|
|
85692
85759
|
if (activeCount - (previous ? 1 : 0) >= 64 || this.requests.size >= 256) {
|
|
85693
85760
|
throw new MobileLoginError(429, "capacity", 60);
|
|
85694
85761
|
}
|
|
85695
|
-
const id7 = (0,
|
|
85696
|
-
const qrSecret = (0,
|
|
85762
|
+
const id7 = (0, import_node_crypto42.randomUUID)();
|
|
85763
|
+
const qrSecret = (0, import_node_crypto42.randomBytes)(32).toString("base64url");
|
|
85697
85764
|
const expiresAt = Date.now() + MOBILE_LOGIN_TTL_MS;
|
|
85698
85765
|
const qr = {
|
|
85699
85766
|
kind: "runweave.mobile-login",
|
|
@@ -85723,7 +85790,7 @@ var MobileLoginService = class {
|
|
|
85723
85790
|
this.requireUnexpired(request2);
|
|
85724
85791
|
if (request2.state === "waiting_scan") {
|
|
85725
85792
|
request2.claimantTokenHash = hash3(input2.claimantToken);
|
|
85726
|
-
request2.claimId = (0,
|
|
85793
|
+
request2.claimId = (0, import_node_crypto42.randomUUID)();
|
|
85727
85794
|
request2.deviceName = input2.deviceName;
|
|
85728
85795
|
request2.connectionId = input2.connectionId;
|
|
85729
85796
|
request2.state = "pending_approval";
|
|
@@ -86075,13 +86142,13 @@ var AppServerEventConsumer = class {
|
|
|
86075
86142
|
if (this.stopped || this.reconnectTimer) {
|
|
86076
86143
|
return;
|
|
86077
86144
|
}
|
|
86078
|
-
const
|
|
86145
|
+
const delay11 = this.reconnectDelayMs;
|
|
86079
86146
|
this.reconnectDelayMs = Math.min(this.reconnectDelayMs * 2, 3e4);
|
|
86080
86147
|
this.updateStatus({
|
|
86081
86148
|
state: "connecting",
|
|
86082
86149
|
failureSince: this.state.failureSince ?? Date.now(),
|
|
86083
86150
|
reconnectAttempt: this.state.reconnectAttempt + 1,
|
|
86084
|
-
nextAttemptAt: Date.now() +
|
|
86151
|
+
nextAttemptAt: Date.now() + delay11
|
|
86085
86152
|
});
|
|
86086
86153
|
this.reconnectTimer = setTimeout(async () => {
|
|
86087
86154
|
this.reconnectTimer = null;
|
|
@@ -86089,7 +86156,7 @@ var AppServerEventConsumer = class {
|
|
|
86089
86156
|
this.options.consumerId
|
|
86090
86157
|
);
|
|
86091
86158
|
this.connect(cursor);
|
|
86092
|
-
},
|
|
86159
|
+
}, delay11);
|
|
86093
86160
|
}
|
|
86094
86161
|
handleSocketError(error2) {
|
|
86095
86162
|
if (this.stopped) return;
|
|
@@ -88815,7 +88882,7 @@ var import_express26 = __toESM(require_express2(), 1);
|
|
|
88815
88882
|
|
|
88816
88883
|
// backend/src/race/race-service.ts
|
|
88817
88884
|
var import_node_child_process12 = require("node:child_process");
|
|
88818
|
-
var
|
|
88885
|
+
var import_node_crypto45 = require("node:crypto");
|
|
88819
88886
|
|
|
88820
88887
|
// packages/shared/src/terminal/project-context.ts
|
|
88821
88888
|
var CHILD_PROJECT_ID_PREFIX = "wt";
|
|
@@ -88894,10 +88961,10 @@ function resolveTerminalParentProjectId(projectId) {
|
|
|
88894
88961
|
}
|
|
88895
88962
|
|
|
88896
88963
|
// backend/src/terminal/application/agent-preparation.ts
|
|
88897
|
-
var
|
|
88964
|
+
var import_node_crypto44 = require("node:crypto");
|
|
88898
88965
|
|
|
88899
88966
|
// backend/src/terminal/application/panel-split.ts
|
|
88900
|
-
var
|
|
88967
|
+
var import_node_crypto43 = require("node:crypto");
|
|
88901
88968
|
function assertUniqueAlias(panels, alias) {
|
|
88902
88969
|
if (!alias) {
|
|
88903
88970
|
return;
|
|
@@ -88949,7 +89016,7 @@ async function createTerminalPanelSplit(terminalSessionManager, session, options
|
|
|
88949
89016
|
session,
|
|
88950
89017
|
sourcePanel
|
|
88951
89018
|
);
|
|
88952
|
-
const panelId = (0,
|
|
89019
|
+
const panelId = (0, import_node_crypto43.randomUUID)();
|
|
88953
89020
|
const { command, args } = resolveTerminalLaunchConfig(params);
|
|
88954
89021
|
const cwd = params.cwd?.trim() || sourcePanel.cwd || session.cwd;
|
|
88955
89022
|
const previousWorkspace = terminalSessionManager.getPanelWorkspace(
|
|
@@ -89188,7 +89255,7 @@ var CODEX_SKIP_UPDATE_ON_STARTUP_ARGS3 = [
|
|
|
89188
89255
|
"check_for_update_on_startup=false"
|
|
89189
89256
|
];
|
|
89190
89257
|
async function prepareTerminalAgent(terminalSessionManager, session, options, request2, internalOptions) {
|
|
89191
|
-
const operationId = `terminal_agent_prepare_${(0,
|
|
89258
|
+
const operationId = `terminal_agent_prepare_${(0, import_node_crypto44.randomUUID)()}`;
|
|
89192
89259
|
let target2 = null;
|
|
89193
89260
|
let createdPanel = false;
|
|
89194
89261
|
let preparationPanelId = null;
|
|
@@ -89414,7 +89481,7 @@ async function prepareTerminalAgent(terminalSessionManager, session, options, re
|
|
|
89414
89481
|
operationId,
|
|
89415
89482
|
paneTarget
|
|
89416
89483
|
);
|
|
89417
|
-
if (
|
|
89484
|
+
if (internalOptions?.stageResumeCommand) {
|
|
89418
89485
|
await withStagedAgentLaunch(launchCommand, submit);
|
|
89419
89486
|
} else {
|
|
89420
89487
|
await submit(launchCommand);
|
|
@@ -89938,7 +90005,7 @@ var RaceService = class {
|
|
|
89938
90005
|
});
|
|
89939
90006
|
this.creationSettled = creationSettled;
|
|
89940
90007
|
const record3 = {
|
|
89941
|
-
raceId: `race_${(0,
|
|
90008
|
+
raceId: `race_${(0, import_node_crypto45.randomUUID)()}`,
|
|
89942
90009
|
goal: request2.goal,
|
|
89943
90010
|
plan: request2.plan,
|
|
89944
90011
|
baseRef: request2.baseRef,
|
|
@@ -90309,10 +90376,10 @@ var ACTIVITY_EVENT_NAMES = [
|
|
|
90309
90376
|
];
|
|
90310
90377
|
|
|
90311
90378
|
// backend/src/routes/activity/index.ts
|
|
90312
|
-
var
|
|
90379
|
+
var import_node_crypto47 = __toESM(require("node:crypto"), 1);
|
|
90313
90380
|
|
|
90314
90381
|
// backend/src/activity/security/canonical.ts
|
|
90315
|
-
var
|
|
90382
|
+
var import_node_crypto46 = __toESM(require("node:crypto"), 1);
|
|
90316
90383
|
function canonicalJson(value) {
|
|
90317
90384
|
if (value === null || typeof value !== "object") {
|
|
90318
90385
|
return JSON.stringify(value);
|
|
@@ -90324,7 +90391,7 @@ function canonicalJson(value) {
|
|
|
90324
90391
|
return `{${entries.map(([key2, child]) => `${JSON.stringify(key2)}:${canonicalJson(child)}`).join(",")}}`;
|
|
90325
90392
|
}
|
|
90326
90393
|
function sha2562(value) {
|
|
90327
|
-
return
|
|
90394
|
+
return import_node_crypto46.default.createHash("sha256").update(value).digest("hex");
|
|
90328
90395
|
}
|
|
90329
90396
|
function canonicalActivityScope(scope) {
|
|
90330
90397
|
const scopeType = typeof scope.projectId === "string" ? "project" : "thread";
|
|
@@ -90571,7 +90638,7 @@ async function writeIngressBatch(params) {
|
|
|
90571
90638
|
const firstProducer = firstEvent.producer && typeof firstEvent.producer === "object" ? firstEvent.producer : {};
|
|
90572
90639
|
const message2 = error2 instanceof Error ? error2.message : "activity_schema_rejected";
|
|
90573
90640
|
const reasonCode = message2.startsWith("activity_") ? message2.slice(0, 256) : "activity_schema_rejected";
|
|
90574
|
-
const requestSha256 =
|
|
90641
|
+
const requestSha256 = import_node_crypto47.default.createHash("sha256").update(JSON.stringify(params.body ?? null)).digest("hex");
|
|
90575
90642
|
await params.store.recordRejection({
|
|
90576
90643
|
requestSha256,
|
|
90577
90644
|
reasonCode,
|
|
@@ -90657,7 +90724,7 @@ function createActivityRouter(options) {
|
|
|
90657
90724
|
response2.status(401).json({ message: "Unauthorized" });
|
|
90658
90725
|
return;
|
|
90659
90726
|
}
|
|
90660
|
-
const requestId =
|
|
90727
|
+
const requestId = import_node_crypto47.default.randomUUID();
|
|
90661
90728
|
const authSubjectHmac = await options.store.auditSubjectHmac(subject);
|
|
90662
90729
|
const content = await options.store.content(request2.params.contentId);
|
|
90663
90730
|
await options.store.recordAccessAudit({
|
|
@@ -90694,7 +90761,7 @@ function createActivityRouter(options) {
|
|
|
90694
90761
|
response2.status(413).json({ message: "activity_export_scope_too_large" });
|
|
90695
90762
|
return;
|
|
90696
90763
|
}
|
|
90697
|
-
const requestId =
|
|
90764
|
+
const requestId = import_node_crypto47.default.randomUUID();
|
|
90698
90765
|
const authSubjectHmac = await options.store.auditSubjectHmac(auditSubject);
|
|
90699
90766
|
if (parsed.action === "export") {
|
|
90700
90767
|
const facts = await options.store.exportSnapshot({
|
|
@@ -90849,7 +90916,7 @@ async function recoverCodexToolConversation(manager, panel, threadId, operationI
|
|
|
90849
90916
|
|
|
90850
90917
|
// backend/src/routes/terminal/state.ts
|
|
90851
90918
|
var import_express28 = __toESM(require_express2(), 1);
|
|
90852
|
-
var
|
|
90919
|
+
var import_node_crypto48 = __toESM(require("node:crypto"), 1);
|
|
90853
90920
|
var terminalStateLogger = logger.child({ component: "terminal-state" });
|
|
90854
90921
|
var AGENT_HOOKS = ["codex", "claude", "trae", "traecli", "traex", "pi"];
|
|
90855
90922
|
var agentHookStateSchema = external_exports.object({
|
|
@@ -91101,7 +91168,7 @@ function recordAgentHookActivity(activity, hook2, hookActivityEvents, cwd) {
|
|
|
91101
91168
|
if (content !== void 0 && content !== null) {
|
|
91102
91169
|
const text5 = typeof content === "string" ? content : JSON.stringify(content);
|
|
91103
91170
|
event.contents.push({
|
|
91104
|
-
contentId:
|
|
91171
|
+
contentId: import_node_crypto48.default.randomUUID(),
|
|
91105
91172
|
role: hook2.hookEvent === "ToolRequested" ? "tool_args" : hook2.hookEvent === "ToolCompleted" ? "tool_result" : hook2.hookEvent === "UserPromptSubmit" ? "query" : "response",
|
|
91106
91173
|
mediaType: typeof content === "string" ? "text/plain; charset=utf-8" : "application/json",
|
|
91107
91174
|
bytesBase64: Buffer.from(text5, "utf8").toString("base64")
|
|
@@ -91492,7 +91559,7 @@ function resolveCompletionPane(terminalSessionManager, terminalSessionId, panelI
|
|
|
91492
91559
|
}
|
|
91493
91560
|
|
|
91494
91561
|
// backend/src/terminal/code-review/store.ts
|
|
91495
|
-
var
|
|
91562
|
+
var import_node_crypto49 = require("node:crypto");
|
|
91496
91563
|
var import_node_fs27 = require("node:fs");
|
|
91497
91564
|
var import_promises30 = require("node:fs/promises");
|
|
91498
91565
|
var import_node_path52 = __toESM(require("node:path"), 1);
|
|
@@ -91504,7 +91571,7 @@ var CodeReviewError = class extends Error {
|
|
|
91504
91571
|
}
|
|
91505
91572
|
};
|
|
91506
91573
|
async function atomicJson(file, value) {
|
|
91507
|
-
const temporary = `${file}.${(0,
|
|
91574
|
+
const temporary = `${file}.${(0, import_node_crypto49.randomUUID)()}.tmp`;
|
|
91508
91575
|
const handle2 = await (0, import_promises30.open)(temporary, "wx", 384);
|
|
91509
91576
|
try {
|
|
91510
91577
|
await handle2.writeFile(JSON.stringify(value));
|
|
@@ -91551,7 +91618,7 @@ var CodeReviewStore = class {
|
|
|
91551
91618
|
constructor(directory4) {
|
|
91552
91619
|
this.directory = directory4;
|
|
91553
91620
|
}
|
|
91554
|
-
backendIdentity = (0,
|
|
91621
|
+
backendIdentity = (0, import_node_crypto49.randomUUID)();
|
|
91555
91622
|
records = /* @__PURE__ */ new Map();
|
|
91556
91623
|
tail = Promise.resolve();
|
|
91557
91624
|
failed = false;
|
|
@@ -91726,7 +91793,7 @@ function createTerminalUnreadRouter(service, desktopAccess = null, auth) {
|
|
|
91726
91793
|
}
|
|
91727
91794
|
|
|
91728
91795
|
// backend/src/terminal/questions/gateway.ts
|
|
91729
|
-
var
|
|
91796
|
+
var import_node_crypto50 = require("node:crypto");
|
|
91730
91797
|
var questionParams = external_exports.object({
|
|
91731
91798
|
threadId: external_exports.string(),
|
|
91732
91799
|
turnId: external_exports.string(),
|
|
@@ -91773,7 +91840,7 @@ var TerminalQuestionGateway = class {
|
|
|
91773
91840
|
}, 2e4);
|
|
91774
91841
|
this.heartbeat.unref();
|
|
91775
91842
|
}
|
|
91776
|
-
generation = (0,
|
|
91843
|
+
generation = (0, import_node_crypto50.randomUUID)();
|
|
91777
91844
|
socket;
|
|
91778
91845
|
nextId = 0;
|
|
91779
91846
|
pending = /* @__PURE__ */ new Map();
|
|
@@ -91842,7 +91909,7 @@ var TerminalQuestionGateway = class {
|
|
|
91842
91909
|
const parsed = questionParams.safeParse(message2.params);
|
|
91843
91910
|
if (!parsed.success || parsed.data.threadId !== this.threadId || typeof message2.id !== "string" && typeof message2.id !== "number") return;
|
|
91844
91911
|
if ([...this.entries.values()].some((entry) => entry.rawId === message2.id)) return;
|
|
91845
|
-
const requestId = (0,
|
|
91912
|
+
const requestId = (0, import_node_crypto50.randomUUID)();
|
|
91846
91913
|
this.entries.set(requestId, { rawId: message2.id, value: { ...parsed.data, requestId, generation: this.generation, state: "pending" } });
|
|
91847
91914
|
if (this.entries.size > 100) {
|
|
91848
91915
|
const old = [...this.entries].find(([, entry]) => entry.value.state === "expired" || entry.value.state === "resolved");
|
|
@@ -92124,7 +92191,7 @@ async function createTerminalSession(manager, request2, options, source2) {
|
|
|
92124
92191
|
kind: "terminal_session_created",
|
|
92125
92192
|
terminalSessionId: created.id,
|
|
92126
92193
|
projectId: created.projectId,
|
|
92127
|
-
payload: { session: toSessionListItem(created, resolveEffectiveTerminalState(manager, options.terminalStateService, created), toPanelWorkspacePayload(manager, created.id)) }
|
|
92194
|
+
payload: { session: toSessionListItem(created, resolveEffectiveTerminalState(manager, options.terminalStateService, created), toPanelWorkspacePayload(manager, created.id)), ...options.activate ? { activate: true } : {} }
|
|
92128
92195
|
});
|
|
92129
92196
|
recordTerminalSessionCreated(options.activity, created);
|
|
92130
92197
|
return created;
|
|
@@ -92262,7 +92329,7 @@ var TerminalAgentForkService = class {
|
|
|
92262
92329
|
};
|
|
92263
92330
|
|
|
92264
92331
|
// backend/src/terminal/tasks/service.ts
|
|
92265
|
-
var
|
|
92332
|
+
var import_node_crypto51 = require("node:crypto");
|
|
92266
92333
|
|
|
92267
92334
|
// packages/config-node/src/claude.ts
|
|
92268
92335
|
var import_node_os16 = __toESM(require("node:os"), 1);
|
|
@@ -92289,21 +92356,21 @@ async function readClaudeConversationIdentity(session, panel, tmux) {
|
|
|
92289
92356
|
if (!Number.isSafeInteger(panePid) || panePid <= 0) return null;
|
|
92290
92357
|
const psOptions = { env: { TZ: "UTC", LC_ALL: "C" }, timeout: 2e3, maxBuffer: 4 * 1024 * 1024 };
|
|
92291
92358
|
const { stdout } = await tmux.execFileImpl("ps", ["-axo", "pid=,ppid=,comm="], psOptions);
|
|
92292
|
-
const
|
|
92359
|
+
const processes2 = /* @__PURE__ */ new Map();
|
|
92293
92360
|
for (const line of stdout.split("\n")) {
|
|
92294
92361
|
const match = /^\s*(\d+)\s+(\d+)\s+(.+)$/.exec(line);
|
|
92295
|
-
if (match)
|
|
92362
|
+
if (match) processes2.set(Number(match[1]), { parent: Number(match[2]), agent: getAgentForCommand(match[3]) });
|
|
92296
92363
|
}
|
|
92297
|
-
const candidates = [...
|
|
92364
|
+
const candidates = [...processes2].filter(([pid2, info]) => {
|
|
92298
92365
|
if (info.agent !== "claude") return false;
|
|
92299
92366
|
if (pid2 === panePid) return true;
|
|
92300
|
-
if (
|
|
92367
|
+
if (processes2.get(panePid)?.agent) return false;
|
|
92301
92368
|
const visited = /* @__PURE__ */ new Set([pid2]);
|
|
92302
92369
|
let parent = info.parent;
|
|
92303
92370
|
while (parent !== panePid) {
|
|
92304
92371
|
if (visited.has(parent)) return false;
|
|
92305
92372
|
visited.add(parent);
|
|
92306
|
-
const ancestor =
|
|
92373
|
+
const ancestor = processes2.get(parent);
|
|
92307
92374
|
if (!ancestor || ancestor.agent) return false;
|
|
92308
92375
|
parent = ancestor.parent;
|
|
92309
92376
|
}
|
|
@@ -92442,7 +92509,7 @@ function conflict(code, message2) {
|
|
|
92442
92509
|
throw new TerminalTaskError(409, code, message2);
|
|
92443
92510
|
}
|
|
92444
92511
|
function digest3(value) {
|
|
92445
|
-
return (0,
|
|
92512
|
+
return (0, import_node_crypto51.createHash)("sha256").update(JSON.stringify(value)).digest("hex");
|
|
92446
92513
|
}
|
|
92447
92514
|
var TerminalTaskService = class {
|
|
92448
92515
|
constructor(store, manager, options, history = new AppServerHistoryGateway()) {
|
|
@@ -93089,7 +93156,7 @@ function registerTerminalSessionUpdateRoute(router, terminalSessionManager, term
|
|
|
93089
93156
|
var import_express31 = __toESM(require_express2(), 1);
|
|
93090
93157
|
|
|
93091
93158
|
// backend/src/terminal/browser-assistance/service.ts
|
|
93092
|
-
var
|
|
93159
|
+
var import_node_crypto52 = require("node:crypto");
|
|
93093
93160
|
var TTL_MS2 = 30 * 6e4;
|
|
93094
93161
|
var ACTIVE = /* @__PURE__ */ new Set([
|
|
93095
93162
|
"requesting",
|
|
@@ -93188,7 +93255,7 @@ ${recovery.nextStep}`.slice(
|
|
|
93188
93255
|
requestId
|
|
93189
93256
|
);
|
|
93190
93257
|
}
|
|
93191
|
-
create(sessionId, input2, requestId = (0,
|
|
93258
|
+
create(sessionId, input2, requestId = (0, import_node_crypto52.randomUUID)()) {
|
|
93192
93259
|
const { session, panel, threadId } = this.panel(sessionId, input2.panelId);
|
|
93193
93260
|
const admission = terminalInputAdmission(session);
|
|
93194
93261
|
if (admission.writers || admission.returning)
|
|
@@ -93396,7 +93463,7 @@ function registerBrowserAssistanceRoutes(router, manager, options) {
|
|
|
93396
93463
|
|
|
93397
93464
|
// backend/src/terminal/preview/change-content.ts
|
|
93398
93465
|
var import_node_child_process13 = require("node:child_process");
|
|
93399
|
-
var
|
|
93466
|
+
var import_node_crypto53 = require("node:crypto");
|
|
93400
93467
|
var import_node_fs30 = require("node:fs");
|
|
93401
93468
|
var import_promises32 = require("node:fs/promises");
|
|
93402
93469
|
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
@@ -93537,7 +93604,7 @@ async function readChangeContent(options) {
|
|
|
93537
93604
|
bytes = await git2(repoRoot, ["cat-file", "blob", oid], IMAGE_PREVIEW_MAX_BYTES + 1);
|
|
93538
93605
|
}
|
|
93539
93606
|
side.sizeBytes = bytes.length;
|
|
93540
|
-
side.version = (0,
|
|
93607
|
+
side.version = (0, import_node_crypto53.createHash)("sha256").update(bytes).digest("hex");
|
|
93541
93608
|
const mime = detectImageMimeType(bytes, filePath);
|
|
93542
93609
|
const isImage = mime && mime !== "image/svg+xml";
|
|
93543
93610
|
let binary = isLikelyBinary(bytes) || bytes.subarray(0, 5).toString("ascii") === "%PDF-";
|
|
@@ -97535,7 +97602,7 @@ function scheduledTaskErrorFromStorage(error2) {
|
|
|
97535
97602
|
}
|
|
97536
97603
|
|
|
97537
97604
|
// backend/src/terminal/quick-input/service.ts
|
|
97538
|
-
var
|
|
97605
|
+
var import_node_crypto54 = require("node:crypto");
|
|
97539
97606
|
var QUICK_INPUT_MODES = /* @__PURE__ */ new Set([
|
|
97540
97607
|
"line",
|
|
97541
97608
|
"codex_slash_command",
|
|
@@ -97656,7 +97723,7 @@ var TerminalQuickInputService = class {
|
|
|
97656
97723
|
replaceItem(items, result);
|
|
97657
97724
|
} else {
|
|
97658
97725
|
result = {
|
|
97659
|
-
id: (0,
|
|
97726
|
+
id: (0, import_node_crypto54.randomUUID)(),
|
|
97660
97727
|
title: normalized.title,
|
|
97661
97728
|
data: normalized.data,
|
|
97662
97729
|
mode: normalized.mode,
|
|
@@ -97790,7 +97857,7 @@ var TerminalQuickInputService = class {
|
|
|
97790
97857
|
replaceItem(items, result);
|
|
97791
97858
|
} else {
|
|
97792
97859
|
result = {
|
|
97793
|
-
id: (0,
|
|
97860
|
+
id: (0, import_node_crypto54.randomUUID)(),
|
|
97794
97861
|
title: normalized.title,
|
|
97795
97862
|
data: normalized.data,
|
|
97796
97863
|
mode: normalized.mode,
|
|
@@ -97931,7 +97998,7 @@ function ensureManualOrders(items) {
|
|
|
97931
97998
|
});
|
|
97932
97999
|
}
|
|
97933
98000
|
function hash4(value) {
|
|
97934
|
-
return (0,
|
|
98001
|
+
return (0, import_node_crypto54.createHash)("sha256").update(value).digest("hex");
|
|
97935
98002
|
}
|
|
97936
98003
|
function encodeCursor(offset, fingerprint3) {
|
|
97937
98004
|
return Buffer.from(JSON.stringify({ offset, fingerprint: fingerprint3 })).toString("base64url");
|
|
@@ -98139,7 +98206,7 @@ function registerTerminalQuickInputRoutes(router, quickInputService, scheduledTa
|
|
|
98139
98206
|
var import_node_fs33 = require("node:fs");
|
|
98140
98207
|
var import_promises43 = require("node:fs/promises");
|
|
98141
98208
|
var import_node_path69 = __toESM(require("node:path"), 1);
|
|
98142
|
-
var
|
|
98209
|
+
var import_node_crypto55 = require("node:crypto");
|
|
98143
98210
|
|
|
98144
98211
|
// packages/shared/src/terminal/runtime/text-attachments.ts
|
|
98145
98212
|
var TERMINAL_TEXT_ATTACHMENT_LIMITS = {
|
|
@@ -98188,7 +98255,7 @@ var TextAttachmentError = class extends Error {
|
|
|
98188
98255
|
}
|
|
98189
98256
|
};
|
|
98190
98257
|
function attachmentFingerprint(value) {
|
|
98191
|
-
return (0,
|
|
98258
|
+
return (0, import_node_crypto55.createHash)("sha256").update(JSON.stringify(value)).digest("hex");
|
|
98192
98259
|
}
|
|
98193
98260
|
var TerminalTextAttachmentService = class {
|
|
98194
98261
|
constructor(root) {
|
|
@@ -98256,7 +98323,7 @@ var TerminalTextAttachmentService = class {
|
|
|
98256
98323
|
}
|
|
98257
98324
|
}
|
|
98258
98325
|
async atomic(file, data) {
|
|
98259
|
-
const temporary = `${file}.${(0,
|
|
98326
|
+
const temporary = `${file}.${(0, import_node_crypto55.randomUUID)()}.tmp`;
|
|
98260
98327
|
const handle2 = await (0, import_promises43.open)(temporary, "wx", 384);
|
|
98261
98328
|
try {
|
|
98262
98329
|
await handle2.writeFile(data);
|
|
@@ -98305,7 +98372,7 @@ var TerminalTextAttachmentService = class {
|
|
|
98305
98372
|
);
|
|
98306
98373
|
const bytes = await this.readFile(this.describe(record3).filePath);
|
|
98307
98374
|
const text5 = bytes.toString("utf8");
|
|
98308
|
-
if (bytes.length !== record3.utf8Bytes || text5.length !== record3.utf16Length || (0,
|
|
98375
|
+
if (bytes.length !== record3.utf8Bytes || text5.length !== record3.utf16Length || (0, import_node_crypto55.createHash)("sha256").update(bytes).digest("hex") !== record3.sha256)
|
|
98309
98376
|
throw new TextAttachmentError(410, "\u9644\u4EF6\u5185\u5BB9\u6821\u9A8C\u5931\u8D25");
|
|
98310
98377
|
return text5;
|
|
98311
98378
|
}
|
|
@@ -98378,7 +98445,7 @@ var TerminalTextAttachmentService = class {
|
|
|
98378
98445
|
await this.ensureDirectory(this.directory(sessionId));
|
|
98379
98446
|
const record3 = {
|
|
98380
98447
|
schemaVersion: 1,
|
|
98381
|
-
id: (0,
|
|
98448
|
+
id: (0, import_node_crypto55.randomUUID)(),
|
|
98382
98449
|
sessionId,
|
|
98383
98450
|
panelId: request2.panelId,
|
|
98384
98451
|
threadId: request2.expectedThreadId ?? null,
|
|
@@ -98386,7 +98453,7 @@ var TerminalTextAttachmentService = class {
|
|
|
98386
98453
|
purpose: request2.purpose,
|
|
98387
98454
|
utf16Length: request2.text.length,
|
|
98388
98455
|
utf8Bytes: bytes.length,
|
|
98389
|
-
sha256: (0,
|
|
98456
|
+
sha256: (0, import_node_crypto55.createHash)("sha256").update(bytes).digest("hex"),
|
|
98390
98457
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
98391
98458
|
retainedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
98392
98459
|
state: "draft"
|
|
@@ -98664,7 +98731,7 @@ function registerTerminalTextAttachmentRoutes(router, manager, delivery) {
|
|
|
98664
98731
|
}
|
|
98665
98732
|
|
|
98666
98733
|
// backend/src/terminal/application/hosted-agent-recovery.ts
|
|
98667
|
-
var
|
|
98734
|
+
var import_node_crypto56 = require("node:crypto");
|
|
98668
98735
|
async function recoverHostedAgent(manager, session, options, request2) {
|
|
98669
98736
|
if (!options.runtimeRegistry || request2.panelId && request2.panelId !== "default")
|
|
98670
98737
|
throw new TerminalPanelError(409, "Hosted terminal recovery unavailable for this target");
|
|
@@ -98676,7 +98743,7 @@ async function recoverHostedAgent(manager, session, options, request2) {
|
|
|
98676
98743
|
);
|
|
98677
98744
|
const target2 = resolve();
|
|
98678
98745
|
if (!target2) throw new TerminalPanelError(409, "Only an idle hosted terminal with a saved agent thread can be recovered");
|
|
98679
|
-
const operationId = `terminal_agent_recover_${(0,
|
|
98746
|
+
const operationId = `terminal_agent_recover_${(0, import_node_crypto56.randomUUID)()}`;
|
|
98680
98747
|
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
98681
98748
|
try {
|
|
98682
98749
|
await recoverHostedTerminal({
|
|
@@ -99221,7 +99288,7 @@ function registerTerminalPanelRoutes(router, terminalSessionManager, options) {
|
|
|
99221
99288
|
}
|
|
99222
99289
|
|
|
99223
99290
|
// backend/src/routes/terminal/input/clipboard-image.ts
|
|
99224
|
-
var
|
|
99291
|
+
var import_node_crypto57 = require("node:crypto");
|
|
99225
99292
|
var import_promises44 = require("node:fs/promises");
|
|
99226
99293
|
var import_node_os18 = __toESM(require("node:os"), 1);
|
|
99227
99294
|
var import_node_path70 = __toESM(require("node:path"), 1);
|
|
@@ -99270,7 +99337,7 @@ function resolveClipboardImageExtension(mimeType) {
|
|
|
99270
99337
|
throw new Error(`Unsupported clipboard image mime type: ${mimeType}`);
|
|
99271
99338
|
}
|
|
99272
99339
|
}
|
|
99273
|
-
function buildClipboardImageFileName(now2, extension, randomHex = (0,
|
|
99340
|
+
function buildClipboardImageFileName(now2, extension, randomHex = (0, import_node_crypto57.randomBytes)(3).toString("hex")) {
|
|
99274
99341
|
const date3 = now2.toISOString().slice(0, 10).replaceAll("-", "");
|
|
99275
99342
|
const time4 = now2.toISOString().slice(11, 19).replaceAll(":", "");
|
|
99276
99343
|
return `runweave-terminal-image-${date3}-${time4}-${randomHex}.${extension}`;
|
|
@@ -99666,7 +99733,7 @@ function registerTerminalInputRoutes(router, terminalSessionManager, options) {
|
|
|
99666
99733
|
}
|
|
99667
99734
|
|
|
99668
99735
|
// backend/src/terminal/runtime/terminal-agent-settings.ts
|
|
99669
|
-
var
|
|
99736
|
+
var import_node_crypto58 = require("node:crypto");
|
|
99670
99737
|
|
|
99671
99738
|
// backend/src/agent-model-catalog/types.ts
|
|
99672
99739
|
var import_node_child_process20 = require("node:child_process");
|
|
@@ -99985,7 +100052,7 @@ async function readThread(provider3, threadId) {
|
|
|
99985
100052
|
function settingsFor(target2, thread, models) {
|
|
99986
100053
|
const model = normalizedModel(thread.model, models);
|
|
99987
100054
|
const reasoningEffort = thread.reasoningEffort;
|
|
99988
|
-
const revision2 = (0,
|
|
100055
|
+
const revision2 = (0, import_node_crypto58.createHash)("sha256").update(JSON.stringify([target2.provider, target2.threadId, thread.model, reasoningEffort])).digest("hex");
|
|
99989
100056
|
return {
|
|
99990
100057
|
terminalSessionId: target2.session.id,
|
|
99991
100058
|
panelId: target2.panelId,
|
|
@@ -101492,7 +101559,7 @@ function registerMonitoringRoutes(app, requireAuth, services) {
|
|
|
101492
101559
|
var import_express40 = __toESM(require_express2(), 1);
|
|
101493
101560
|
|
|
101494
101561
|
// backend/src/evolution/knowledge/lifecycle.ts
|
|
101495
|
-
var
|
|
101562
|
+
var import_node_crypto59 = require("node:crypto");
|
|
101496
101563
|
function defaultEvolutionScopePolicy(learningScopeId, now2 = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
101497
101564
|
return {
|
|
101498
101565
|
learningScopeId,
|
|
@@ -101531,7 +101598,7 @@ function validateEvolutionScopePolicy(policy) {
|
|
|
101531
101598
|
return policy;
|
|
101532
101599
|
}
|
|
101533
101600
|
function nextRevision(candidate, lifecycle, reason, now2, audit) {
|
|
101534
|
-
const revisionId = `arev_${(0,
|
|
101601
|
+
const revisionId = `arev_${(0, import_node_crypto59.createHash)("sha256").update(`${candidate.revisionId}
|
|
101535
101602
|
${lifecycle}
|
|
101536
101603
|
${reason}
|
|
101537
101604
|
${now2}`).digest("hex").slice(0, 20)}`;
|
|
@@ -101543,7 +101610,7 @@ ${now2}`).digest("hex").slice(0, 20)}`;
|
|
|
101543
101610
|
lifecycleHistory: [
|
|
101544
101611
|
...candidate.lifecycleHistory,
|
|
101545
101612
|
{
|
|
101546
|
-
eventId: `ale_${(0,
|
|
101613
|
+
eventId: `ale_${(0, import_node_crypto59.createHash)("sha256").update(`${revisionId}
|
|
101547
101614
|
${audit.actor}
|
|
101548
101615
|
${reason}`).digest("hex").slice(0, 20)}`,
|
|
101549
101616
|
from: candidate.lifecycle,
|
|
@@ -113445,7 +113512,7 @@ function createHttpUpgradeRouter(server) {
|
|
|
113445
113512
|
}
|
|
113446
113513
|
|
|
113447
113514
|
// backend/src/server/profile-lock.ts
|
|
113448
|
-
var
|
|
113515
|
+
var import_node_crypto60 = require("node:crypto");
|
|
113449
113516
|
var import_node_child_process23 = require("node:child_process");
|
|
113450
113517
|
var import_promises46 = require("node:fs/promises");
|
|
113451
113518
|
var import_node_path75 = __toESM(require("node:path"), 1);
|
|
@@ -113623,7 +113690,7 @@ async function replaceLockFile(profileDir, lockFile, expectedOwner, nextOwner) {
|
|
|
113623
113690
|
async function createLockCandidate(lockFile, owner) {
|
|
113624
113691
|
const candidatePath = import_node_path75.default.join(
|
|
113625
113692
|
import_node_path75.default.dirname(lockFile),
|
|
113626
|
-
`.${import_node_path75.default.basename(lockFile)}.${(0,
|
|
113693
|
+
`.${import_node_path75.default.basename(lockFile)}.${(0, import_node_crypto60.randomUUID)()}.tmp`
|
|
113627
113694
|
);
|
|
113628
113695
|
let handle2;
|
|
113629
113696
|
try {
|
|
@@ -113966,7 +114033,7 @@ function isRemoteBrowserProfileState(value) {
|
|
|
113966
114033
|
}
|
|
113967
114034
|
|
|
113968
114035
|
// backend/src/remote/browser-bindings.ts
|
|
113969
|
-
var
|
|
114036
|
+
var import_node_crypto61 = require("node:crypto");
|
|
113970
114037
|
function matchesOwner(owner, binding) {
|
|
113971
114038
|
return owner.desktopId === binding.desktopId && owner.hostId === binding.hostId && (owner.ownerKeyHash ? owner.ownerKeyHash === binding.ownerKeyHash : owner.ownerSessionId === binding.ownerSessionId);
|
|
113972
114039
|
}
|
|
@@ -114005,7 +114072,7 @@ var DesktopBrowserBindings = class {
|
|
|
114005
114072
|
};
|
|
114006
114073
|
if (!this.recoveryRequests.has(key2) && this.recoveryRequests.size >= 64)
|
|
114007
114074
|
throw new RemoteBrowserError("BROWSER_CAPACITY_EXCEEDED", 503, "Too many pending Browser recoveries");
|
|
114008
|
-
const request2 = { owner: { ...owner }, requestedAt: Date.now(), requestId: (0,
|
|
114075
|
+
const request2 = { owner: { ...owner }, requestedAt: Date.now(), requestId: (0, import_node_crypto61.randomUUID)(), complete: false };
|
|
114009
114076
|
this.recoveryRequests.set(key2, request2);
|
|
114010
114077
|
return { requestId: request2.requestId, requestedAt: request2.requestedAt, status: "pending" };
|
|
114011
114078
|
}
|
|
@@ -114021,7 +114088,7 @@ var DesktopBrowserBindings = class {
|
|
|
114021
114088
|
"Invalid desktop binding"
|
|
114022
114089
|
);
|
|
114023
114090
|
}
|
|
114024
|
-
const ownerKeyHash = input2.ownerKey ? (0,
|
|
114091
|
+
const ownerKeyHash = input2.ownerKey ? (0, import_node_crypto61.createHash)("sha256").update(input2.ownerKey).digest("hex") : void 0;
|
|
114025
114092
|
this.pruneRecoveryRequests();
|
|
114026
114093
|
for (const request2 of this.recoveryRequests.values()) {
|
|
114027
114094
|
if (request2.complete || !matchesOwner(request2.owner, { ...input2, ownerSessionId, ownerKeyHash })) continue;
|
|
@@ -114059,7 +114126,7 @@ var DesktopBrowserBindings = class {
|
|
|
114059
114126
|
}
|
|
114060
114127
|
}
|
|
114061
114128
|
const record3 = {
|
|
114062
|
-
id: existingId ?? (0,
|
|
114129
|
+
id: existingId ?? (0, import_node_crypto61.randomUUID)(),
|
|
114063
114130
|
protocolVersion: 2,
|
|
114064
114131
|
ownerSessionId,
|
|
114065
114132
|
ownerKeyHash,
|
|
@@ -114190,7 +114257,7 @@ var DesktopBrowserBindings = class {
|
|
|
114190
114257
|
this.capabilities.delete(token2);
|
|
114191
114258
|
}
|
|
114192
114259
|
const binding = this.selectedBinding(terminalSessionId);
|
|
114193
|
-
const token = (0,
|
|
114260
|
+
const token = (0, import_node_crypto61.randomBytes)(32).toString("hex");
|
|
114194
114261
|
this.capabilities.set(token, {
|
|
114195
114262
|
bindingId: binding.id,
|
|
114196
114263
|
generation: binding.generation,
|
|
@@ -114291,7 +114358,7 @@ var DesktopBrowserBindings = class {
|
|
|
114291
114358
|
};
|
|
114292
114359
|
|
|
114293
114360
|
// backend/src/remote/installation-id.ts
|
|
114294
|
-
var
|
|
114361
|
+
var import_node_crypto62 = require("node:crypto");
|
|
114295
114362
|
var import_promises47 = require("node:fs/promises");
|
|
114296
114363
|
var import_node_path77 = __toESM(require("node:path"), 1);
|
|
114297
114364
|
async function loadInstallationId(storageDirectory) {
|
|
@@ -114304,7 +114371,7 @@ async function loadInstallationId(storageDirectory) {
|
|
|
114304
114371
|
} catch (error2) {
|
|
114305
114372
|
if (error2.code !== "ENOENT") throw error2;
|
|
114306
114373
|
}
|
|
114307
|
-
const id7 = (0,
|
|
114374
|
+
const id7 = (0, import_node_crypto62.randomUUID)();
|
|
114308
114375
|
try {
|
|
114309
114376
|
await (0, import_promises47.writeFile)(file, `${id7}
|
|
114310
114377
|
`, { flag: "wx", mode: 384 });
|
|
@@ -114341,12 +114408,12 @@ function registerRemoteCapabilitiesRoute(app, requireTunnelAuth, requireAuth, br
|
|
|
114341
114408
|
}
|
|
114342
114409
|
|
|
114343
114410
|
// backend/src/remote/terminal-hook-auth.ts
|
|
114344
|
-
var
|
|
114411
|
+
var import_node_crypto63 = require("node:crypto");
|
|
114345
114412
|
function matchesToken2(value, expected) {
|
|
114346
114413
|
if (!expected) return false;
|
|
114347
114414
|
const supplied = Buffer.from(value);
|
|
114348
114415
|
const actual = Buffer.from(expected);
|
|
114349
|
-
return supplied.length === actual.length && (0,
|
|
114416
|
+
return supplied.length === actual.length && (0, import_node_crypto63.timingSafeEqual)(supplied, actual);
|
|
114350
114417
|
}
|
|
114351
114418
|
async function authenticatesTerminal(value, terminalId, sessions, signal) {
|
|
114352
114419
|
signal.throwIfAborted();
|
|
@@ -114507,7 +114574,7 @@ function registerRemoteBrowserRoutes(app, auth, sessions, requireTunnelAuth, bro
|
|
|
114507
114574
|
}
|
|
114508
114575
|
|
|
114509
114576
|
// backend/src/ws/terminal-events-server.ts
|
|
114510
|
-
var
|
|
114577
|
+
var import_node_crypto64 = require("node:crypto");
|
|
114511
114578
|
|
|
114512
114579
|
// backend/src/ws/heartbeat.ts
|
|
114513
114580
|
function createHeartbeatController(socket, state, onTimeout) {
|
|
@@ -114599,7 +114666,7 @@ function attachTerminalEventsWebSocketServer(upgradeRouter, authService, termina
|
|
|
114599
114666
|
});
|
|
114600
114667
|
wss.on("connection", (socket, request2) => {
|
|
114601
114668
|
const connectedAt = Date.now();
|
|
114602
|
-
const clientId = (0,
|
|
114669
|
+
const clientId = (0, import_node_crypto64.randomUUID)();
|
|
114603
114670
|
const identifier = (name) => {
|
|
114604
114671
|
const value = request2.headers[name];
|
|
114605
114672
|
return typeof value === "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(value) ? value : void 0;
|
|
@@ -114685,7 +114752,7 @@ function attachTerminalEventsWebSocketServer(upgradeRouter, authService, termina
|
|
|
114685
114752
|
}
|
|
114686
114753
|
|
|
114687
114754
|
// backend/src/ws/terminal-server.ts
|
|
114688
|
-
var
|
|
114755
|
+
var import_node_crypto65 = require("node:crypto");
|
|
114689
114756
|
|
|
114690
114757
|
// backend/src/terminal/runtime/output-batcher.ts
|
|
114691
114758
|
var OUTPUT_BATCH_DURATION_MS = 16;
|
|
@@ -115733,7 +115800,7 @@ function attachTerminalWebSocketServer(upgradeRouter, terminalSessionManager, ru
|
|
|
115733
115800
|
const session = terminalSessionManager.getSession(terminalSessionId);
|
|
115734
115801
|
const params = new URL(request2.url ?? "/", "http://localhost").searchParams;
|
|
115735
115802
|
const requestedViewerId = params.get("resumeClientId");
|
|
115736
|
-
const viewerId = requestedViewerId && /^[a-zA-Z0-9_-]{16,128}$/.test(requestedViewerId) ? requestedViewerId : (0,
|
|
115803
|
+
const viewerId = requestedViewerId && /^[a-zA-Z0-9_-]{16,128}$/.test(requestedViewerId) ? requestedViewerId : (0, import_node_crypto65.randomUUID)();
|
|
115737
115804
|
const runtimeId = session && isTmuxBackedSession(session) ? runtimeRegistry.displayRuntimeId(terminalSessionId, viewerId) : terminalSessionId;
|
|
115738
115805
|
const sendInitialSnapshot = shouldSendInitialSnapshot(request2);
|
|
115739
115806
|
const settleInitialTmuxRepaint = shouldSettleInitialTmuxRepaint(
|
|
@@ -116226,7 +116293,7 @@ async function collectAgentEvidence(history, collector, deviceID, effectiveFrom,
|
|
|
116226
116293
|
}
|
|
116227
116294
|
|
|
116228
116295
|
// backend/src/screen-recording-analysis/runtime.ts
|
|
116229
|
-
var
|
|
116296
|
+
var import_node_crypto66 = require("node:crypto");
|
|
116230
116297
|
var import_promises50 = require("node:fs/promises");
|
|
116231
116298
|
var import_node_path80 = __toESM(require("node:path"), 1);
|
|
116232
116299
|
|
|
@@ -116279,9 +116346,39 @@ var import_node_path79 = __toESM(require("node:path"), 1);
|
|
|
116279
116346
|
// backend/src/screen-recording-analysis/batching.ts
|
|
116280
116347
|
function representativeFrames(manifest, maximum = 15) {
|
|
116281
116348
|
const frames = manifest.captures.filter((frame) => !frame.privacyPlaceholder);
|
|
116282
|
-
if (
|
|
116349
|
+
if (!Number.isSafeInteger(maximum) || maximum < 1) return [];
|
|
116350
|
+
if (maximum === 1) return frames.slice(0, 1);
|
|
116351
|
+
const priorities = frames.map((frame, index) => {
|
|
116352
|
+
const previous = frames[index - 1];
|
|
116353
|
+
const app = frame.frontmostApplication?.id, previousApp = previous?.frontmostApplication?.id;
|
|
116354
|
+
if (previous && (frame.sessionID !== previous.sessionID || frame.displayID !== previous.displayID || app && previousApp && app !== previousApp)) return 3;
|
|
116355
|
+
if (frame.visualChanged === true && previous?.visualChanged === false) return 2;
|
|
116356
|
+
return frame.visualChanged === false ? 0 : 1;
|
|
116357
|
+
});
|
|
116358
|
+
const candidates = frames.map((_, index) => index).filter((index) => index === 0 || index === frames.length - 1 || priorities[index] > 0);
|
|
116359
|
+
if (candidates.length <= maximum) return candidates.map((index) => frames[index]);
|
|
116283
116360
|
const indices = /* @__PURE__ */ new Set();
|
|
116284
|
-
|
|
116361
|
+
const interior = candidates.slice(1, -1);
|
|
116362
|
+
if (interior.every((index) => priorities[index] === priorities[interior[0]])) {
|
|
116363
|
+
for (let i = 0; i < maximum; i++) indices.add(candidates[Math.round(i * (candidates.length - 1) / (maximum - 1))]);
|
|
116364
|
+
} else {
|
|
116365
|
+
indices.add(0);
|
|
116366
|
+
indices.add(frames.length - 1);
|
|
116367
|
+
while (indices.size < maximum) {
|
|
116368
|
+
let best = -1, bestPriority = -1, bestDistance = -1;
|
|
116369
|
+
for (const index of interior) {
|
|
116370
|
+
if (indices.has(index)) continue;
|
|
116371
|
+
const priority = priorities[index];
|
|
116372
|
+
const distance = Math.min(...[...indices].map((selected) => Math.abs(index - selected)));
|
|
116373
|
+
if (priority > bestPriority || priority === bestPriority && distance > bestDistance) {
|
|
116374
|
+
best = index;
|
|
116375
|
+
bestPriority = priority;
|
|
116376
|
+
bestDistance = distance;
|
|
116377
|
+
}
|
|
116378
|
+
}
|
|
116379
|
+
indices.add(best);
|
|
116380
|
+
}
|
|
116381
|
+
}
|
|
116285
116382
|
return [...indices].sort((a, b) => a - b).map((index) => frames[index]);
|
|
116286
116383
|
}
|
|
116287
116384
|
function idleObservation(manifest) {
|
|
@@ -116507,7 +116604,7 @@ var ScreenRecordingAnalysisRuntime = class {
|
|
|
116507
116604
|
constructor(history) {
|
|
116508
116605
|
this.history = history;
|
|
116509
116606
|
}
|
|
116510
|
-
workerID = (0,
|
|
116607
|
+
workerID = (0, import_node_crypto66.randomUUID)();
|
|
116511
116608
|
collector = new AnalysisCollector();
|
|
116512
116609
|
timer;
|
|
116513
116610
|
active;
|
|
@@ -116521,7 +116618,7 @@ var ScreenRecordingAnalysisRuntime = class {
|
|
|
116521
116618
|
});
|
|
116522
116619
|
this.schedule(0);
|
|
116523
116620
|
}
|
|
116524
|
-
schedule(
|
|
116621
|
+
schedule(delay11) {
|
|
116525
116622
|
if (this.closed) return;
|
|
116526
116623
|
this.timer = setTimeout(() => {
|
|
116527
116624
|
this.active = this.tick().catch(() => {
|
|
@@ -116530,7 +116627,7 @@ var ScreenRecordingAnalysisRuntime = class {
|
|
|
116530
116627
|
this.active = void 0;
|
|
116531
116628
|
this.schedule(6e4);
|
|
116532
116629
|
});
|
|
116533
|
-
},
|
|
116630
|
+
}, delay11);
|
|
116534
116631
|
this.timer.unref();
|
|
116535
116632
|
}
|
|
116536
116633
|
async tick() {
|
|
@@ -116721,10 +116818,10 @@ var ScreenRecordingService = class {
|
|
|
116721
116818
|
};
|
|
116722
116819
|
|
|
116723
116820
|
// backend/src/side-chat/service.ts
|
|
116724
|
-
var
|
|
116821
|
+
var import_node_crypto68 = require("node:crypto");
|
|
116725
116822
|
|
|
116726
116823
|
// backend/src/side-chat/provider.ts
|
|
116727
|
-
var
|
|
116824
|
+
var import_node_crypto67 = require("node:crypto");
|
|
116728
116825
|
var import_node_child_process25 = require("node:child_process");
|
|
116729
116826
|
var import_node_fs37 = require("node:fs");
|
|
116730
116827
|
var import_node_path81 = __toESM(require("node:path"), 1);
|
|
@@ -116743,7 +116840,7 @@ var SideChatProvider = class {
|
|
|
116743
116840
|
this.binary = binary;
|
|
116744
116841
|
this.env = env;
|
|
116745
116842
|
}
|
|
116746
|
-
profile = `runweave_side_chat_${(0,
|
|
116843
|
+
profile = `runweave_side_chat_${(0, import_node_crypto67.randomUUID)().replaceAll("-", "")}`;
|
|
116747
116844
|
child = null;
|
|
116748
116845
|
pending = /* @__PURE__ */ new Map();
|
|
116749
116846
|
buffer = "";
|
|
@@ -117135,7 +117232,7 @@ var SideChatService = class {
|
|
|
117135
117232
|
const repeated = this.repeated(operationId, fingerprint3);
|
|
117136
117233
|
if (repeated) return { chat: this.requireChat(repeated.sideChatId), operation: repeated, created: false };
|
|
117137
117234
|
const active3 = this.store.active(this.owner, sourceKey(source2));
|
|
117138
|
-
const chat = active3 ?? { id: (0,
|
|
117235
|
+
const chat = active3 ?? { id: (0, import_node_crypto68.randomUUID)(), ownerScope: this.owner, sourceKey: sourceKey(source2), source: source2, providerThreadId: null, status: "creating", version: 1, createdAt: now(), endedAt: null };
|
|
117139
117236
|
if (!active3) this.store.saveChat(chat);
|
|
117140
117237
|
const operation2 = this.accept(operationId, fingerprint3, "create", chat, null, active3 ? "completed" : "accepted");
|
|
117141
117238
|
return { chat, operation: operation2, created: !active3 };
|
|
@@ -117172,7 +117269,7 @@ var SideChatService = class {
|
|
|
117172
117269
|
if (chat.status !== "active") throw new SideChatError(409, "CHAT_NOT_ACTIVE", "\u65C1\u804A\u5F53\u524D\u4E0D\u80FD\u7EE7\u7EED\u63D0\u95EE");
|
|
117173
117270
|
const current = this.store.current(id7);
|
|
117174
117271
|
if (current && SIDE_CHAT_BUSY_STATES.includes(current.state)) throw new SideChatError(409, "TURN_IN_FLIGHT", "\u5F53\u524D\u56DE\u7B54\u5C1A\u672A\u7ED3\u675F\u6216\u7ED3\u679C\u4E0D\u660E\uFF0C\u8BF7\u5148\u6838\u5BF9\u72B6\u6001");
|
|
117175
|
-
const turn = { id: (0,
|
|
117272
|
+
const turn = { id: (0, import_node_crypto68.randomUUID)(), sideChatId: id7, clientOperationId: request2.operationId, providerTurnId: null, state: "accepted", acceptedAt: now(), finishedAt: null, errorCode: null };
|
|
117176
117273
|
chat.version++;
|
|
117177
117274
|
this.store.saveChat(chat);
|
|
117178
117275
|
this.store.saveTurn(turn);
|
|
@@ -117273,7 +117370,7 @@ var SideChatService = class {
|
|
|
117273
117370
|
}
|
|
117274
117371
|
}
|
|
117275
117372
|
acquire(chat) {
|
|
117276
|
-
const execution = { provider: new SideChatProvider(chat.source.cwd), generation: (0,
|
|
117373
|
+
const execution = { provider: new SideChatProvider(chat.source.cwd), generation: (0, import_node_crypto68.randomUUID)(), turnId: null, items: /* @__PURE__ */ new Map(), completed: null };
|
|
117277
117374
|
this.executions.set(chat.id, execution);
|
|
117278
117375
|
execution.provider.observe((event) => {
|
|
117279
117376
|
const current = this.executions.get(chat.id);
|
|
@@ -117556,9 +117653,9 @@ var SideChatStore = class {
|
|
|
117556
117653
|
};
|
|
117557
117654
|
|
|
117558
117655
|
// backend/src/auth/connection-identity.ts
|
|
117559
|
-
var import_node_crypto68 = require("node:crypto");
|
|
117560
|
-
var import_promises51 = require("node:fs/promises");
|
|
117561
117656
|
var import_node_crypto69 = require("node:crypto");
|
|
117657
|
+
var import_promises51 = require("node:fs/promises");
|
|
117658
|
+
var import_node_crypto70 = require("node:crypto");
|
|
117562
117659
|
var import_node_path84 = __toESM(require("node:path"), 1);
|
|
117563
117660
|
|
|
117564
117661
|
// packages/shared/src/auth/connection-identity.ts
|
|
@@ -117581,9 +117678,9 @@ var ConnectionIdentityService = class _ConnectionIdentityService {
|
|
|
117581
117678
|
await (0, import_promises51.lstat)(file);
|
|
117582
117679
|
} catch (error2) {
|
|
117583
117680
|
if (error2.code !== "ENOENT") throw error2;
|
|
117584
|
-
const { privateKey } = (0,
|
|
117681
|
+
const { privateKey } = (0, import_node_crypto69.generateKeyPairSync)("ed25519");
|
|
117585
117682
|
const data = JSON.stringify({ schemaVersion: 1, privateKey: privateKey.export({ format: "jwk" }) });
|
|
117586
|
-
const temporary = `${file}.${(0,
|
|
117683
|
+
const temporary = `${file}.${(0, import_node_crypto70.randomUUID)()}.tmp`;
|
|
117587
117684
|
const handle2 = await (0, import_promises51.open)(temporary, "wx", 384);
|
|
117588
117685
|
try {
|
|
117589
117686
|
await handle2.writeFile(data);
|
|
@@ -117604,10 +117701,10 @@ var ConnectionIdentityService = class _ConnectionIdentityService {
|
|
|
117604
117701
|
assertWindowsPrivatePath(file);
|
|
117605
117702
|
const stored = JSON.parse(await (0, import_promises51.readFile)(file, "utf8"));
|
|
117606
117703
|
if (stored.schemaVersion !== 1 || stored.privateKey?.crv !== "Ed25519" || !stored.privateKey.d) throw new Error("Invalid identity key");
|
|
117607
|
-
const key2 = (0,
|
|
117608
|
-
if (key2.asymmetricKeyType !== "ed25519" || (0,
|
|
117704
|
+
const key2 = (0, import_node_crypto69.createPrivateKey)({ key: stored.privateKey, format: "jwk" });
|
|
117705
|
+
if (key2.asymmetricKeyType !== "ed25519" || (0, import_node_crypto69.createPublicKey)(key2).export({ format: "jwk" }).x !== stored.privateKey.x) throw new Error("Invalid identity key");
|
|
117609
117706
|
const challenge = Buffer.from("runweave-identity-file-check-v1");
|
|
117610
|
-
if (!(0,
|
|
117707
|
+
if (!(0, import_node_crypto69.verify)(null, challenge, (0, import_node_crypto69.createPublicKey)(key2), (0, import_node_crypto69.sign)(null, challenge, key2))) throw new Error("Invalid identity key pair");
|
|
117611
117708
|
return new _ConnectionIdentityService(key2);
|
|
117612
117709
|
} catch {
|
|
117613
117710
|
return new _ConnectionIdentityService(null);
|
|
@@ -117615,13 +117712,13 @@ var ConnectionIdentityService = class _ConnectionIdentityService {
|
|
|
117615
117712
|
}
|
|
117616
117713
|
identity() {
|
|
117617
117714
|
if (!this.key) return null;
|
|
117618
|
-
const publicKey = (0,
|
|
117619
|
-
return { version: 1, identityId: (0,
|
|
117715
|
+
const publicKey = (0, import_node_crypto69.createPublicKey)(this.key).export({ format: "jwk" }).x;
|
|
117716
|
+
return { version: 1, identityId: (0, import_node_crypto69.createHash)("sha256").update(Buffer.from(publicKey, "base64url")).digest("hex"), publicKey };
|
|
117620
117717
|
}
|
|
117621
117718
|
prove(nonce) {
|
|
117622
117719
|
const identity2 = this.identity();
|
|
117623
117720
|
if (!identity2 || !this.key) return null;
|
|
117624
|
-
return { ...identity2, nonce, signature: (0,
|
|
117721
|
+
return { ...identity2, nonce, signature: (0, import_node_crypto69.sign)(null, Buffer.from(connectionProbeMessage(identity2.identityId, nonce)), this.key).toString("base64url") };
|
|
117625
117722
|
}
|
|
117626
117723
|
};
|
|
117627
117724
|
|
|
@@ -117928,11 +118025,11 @@ var LowDbAuthStore = class {
|
|
|
117928
118025
|
};
|
|
117929
118026
|
|
|
117930
118027
|
// backend/src/auth/service.ts
|
|
117931
|
-
var
|
|
117932
|
-
var
|
|
118028
|
+
var import_node_crypto72 = __toESM(require("node:crypto"), 1);
|
|
118029
|
+
var import_node_crypto73 = require("node:crypto");
|
|
117933
118030
|
|
|
117934
118031
|
// backend/src/auth/jwt.ts
|
|
117935
|
-
var
|
|
118032
|
+
var import_node_crypto71 = __toESM(require("node:crypto"), 1);
|
|
117936
118033
|
function encodePayload(payload) {
|
|
117937
118034
|
return Buffer.from(JSON.stringify(payload), "utf8").toString("base64url");
|
|
117938
118035
|
}
|
|
@@ -117967,7 +118064,7 @@ function decodePayload(encodedPayload) {
|
|
|
117967
118064
|
}
|
|
117968
118065
|
}
|
|
117969
118066
|
function signPayload(encodedPayload, secret2) {
|
|
117970
|
-
return
|
|
118067
|
+
return import_node_crypto71.default.createHmac("sha256", secret2).update(encodedPayload).digest("base64url");
|
|
117971
118068
|
}
|
|
117972
118069
|
function issueToken(params) {
|
|
117973
118070
|
const nowMs = Date.now();
|
|
@@ -117976,7 +118073,7 @@ function issueToken(params) {
|
|
|
117976
118073
|
sub: params.username,
|
|
117977
118074
|
sid: params.sessionId,
|
|
117978
118075
|
exp: Math.floor(nowMs / 1e3) + expiresIn,
|
|
117979
|
-
jti:
|
|
118076
|
+
jti: import_node_crypto71.default.randomUUID(),
|
|
117980
118077
|
type: params.tokenType,
|
|
117981
118078
|
resource: params.resource
|
|
117982
118079
|
};
|
|
@@ -118002,7 +118099,7 @@ function verifyToken(token, secret2) {
|
|
|
118002
118099
|
if (receivedBuffer.length !== expectedBuffer.length) {
|
|
118003
118100
|
return { valid: false };
|
|
118004
118101
|
}
|
|
118005
|
-
if (!
|
|
118102
|
+
if (!import_node_crypto71.default.timingSafeEqual(receivedBuffer, expectedBuffer)) {
|
|
118006
118103
|
return { valid: false };
|
|
118007
118104
|
}
|
|
118008
118105
|
const payload = decodePayload(encodedPayload);
|
|
@@ -118020,7 +118117,7 @@ function verifyToken(token, secret2) {
|
|
|
118020
118117
|
|
|
118021
118118
|
// backend/src/auth/service.ts
|
|
118022
118119
|
function hashToken(token) {
|
|
118023
|
-
return
|
|
118120
|
+
return import_node_crypto72.default.createHash("sha256").update(token).digest("hex");
|
|
118024
118121
|
}
|
|
118025
118122
|
function toIsoAfter(ttlMs) {
|
|
118026
118123
|
return new Date(Date.now() + ttlMs).toISOString();
|
|
@@ -118069,7 +118166,7 @@ var AuthService = class {
|
|
|
118069
118166
|
return result;
|
|
118070
118167
|
}
|
|
118071
118168
|
async issueSession(username, params) {
|
|
118072
|
-
const sessionId = (0,
|
|
118169
|
+
const sessionId = (0, import_node_crypto73.randomUUID)();
|
|
118073
118170
|
const accessToken = issueToken({
|
|
118074
118171
|
username,
|
|
118075
118172
|
sessionId,
|
|
@@ -118288,7 +118385,7 @@ async function createAuthRuntime(storagePaths, resources) {
|
|
|
118288
118385
|
}
|
|
118289
118386
|
|
|
118290
118387
|
// backend/src/dev-resources/service.ts
|
|
118291
|
-
var
|
|
118388
|
+
var import_node_crypto74 = require("node:crypto");
|
|
118292
118389
|
var import_node_fs40 = require("node:fs");
|
|
118293
118390
|
var import_promises55 = __toESM(require("node:fs/promises"), 1);
|
|
118294
118391
|
var import_node_os20 = __toESM(require("node:os"), 1);
|
|
@@ -118310,7 +118407,7 @@ function signature(pid) {
|
|
|
118310
118407
|
}
|
|
118311
118408
|
}
|
|
118312
118409
|
var DevResourcesService = class {
|
|
118313
|
-
generation = (0,
|
|
118410
|
+
generation = (0, import_node_crypto74.randomUUID)();
|
|
118314
118411
|
directory = import_node_path87.default.join(
|
|
118315
118412
|
import_node_os20.default.homedir(),
|
|
118316
118413
|
".runweave",
|
|
@@ -118342,7 +118439,7 @@ var DevResourcesService = class {
|
|
|
118342
118439
|
file(key2) {
|
|
118343
118440
|
return import_node_path87.default.join(
|
|
118344
118441
|
this.directory,
|
|
118345
|
-
(0,
|
|
118442
|
+
(0, import_node_crypto74.createHash)("sha256").update(key2).digest("hex") + ".json"
|
|
118346
118443
|
);
|
|
118347
118444
|
}
|
|
118348
118445
|
async read(file) {
|
|
@@ -118365,7 +118462,7 @@ var DevResourcesService = class {
|
|
|
118365
118462
|
}
|
|
118366
118463
|
}
|
|
118367
118464
|
async save(file, record3) {
|
|
118368
|
-
const temporary = `${file}.${(0,
|
|
118465
|
+
const temporary = `${file}.${(0, import_node_crypto74.randomUUID)()}.tmp`;
|
|
118369
118466
|
await import_promises55.default.writeFile(temporary, JSON.stringify(record3), {
|
|
118370
118467
|
mode: 384,
|
|
118371
118468
|
flag: "wx"
|
|
@@ -118449,7 +118546,7 @@ var DevResourcesService = class {
|
|
|
118449
118546
|
ownerId: resource?.owner?.id ?? null,
|
|
118450
118547
|
generation: this.generation,
|
|
118451
118548
|
result: {
|
|
118452
|
-
operationId: (0,
|
|
118549
|
+
operationId: (0, import_node_crypto74.randomUUID)(),
|
|
118453
118550
|
state: "running",
|
|
118454
118551
|
message: "\u6B63\u5728\u6838\u5BF9\u5360\u7528\u5E76\u91CA\u653E\u8D44\u6E90"
|
|
118455
118552
|
},
|
|
@@ -118541,18 +118638,18 @@ var DevResourcesService = class {
|
|
|
118541
118638
|
};
|
|
118542
118639
|
|
|
118543
118640
|
// backend/src/terminal/code-review/service.ts
|
|
118544
|
-
var
|
|
118641
|
+
var import_node_crypto76 = require("node:crypto");
|
|
118545
118642
|
var import_promises58 = require("node:fs/promises");
|
|
118546
118643
|
var import_node_path93 = __toESM(require("node:path"), 1);
|
|
118547
118644
|
|
|
118548
118645
|
// backend/src/terminal/code-review/snapshot.ts
|
|
118549
118646
|
var import_node_child_process27 = require("node:child_process");
|
|
118550
|
-
var
|
|
118647
|
+
var import_node_crypto75 = require("node:crypto");
|
|
118551
118648
|
var import_promises56 = require("node:fs/promises");
|
|
118552
118649
|
var import_node_path88 = __toESM(require("node:path"), 1);
|
|
118553
118650
|
var import_node_util15 = require("node:util");
|
|
118554
118651
|
var exec4 = (0, import_node_util15.promisify)(import_node_child_process27.execFile);
|
|
118555
|
-
var reviewDigest = (value) => (0,
|
|
118652
|
+
var reviewDigest = (value) => (0, import_node_crypto75.createHash)("sha256").update(JSON.stringify(value)).digest("hex");
|
|
118556
118653
|
async function git3(root, args) {
|
|
118557
118654
|
return (await exec4("git", args, {
|
|
118558
118655
|
cwd: root,
|
|
@@ -118629,7 +118726,7 @@ async function captureReviewSnapshot(projectId, rootPath) {
|
|
|
118629
118726
|
if (!first.stable || !second.stable || first.fingerprint !== second.fingerprint) continue;
|
|
118630
118727
|
return {
|
|
118631
118728
|
schemaVersion: 1,
|
|
118632
|
-
snapshotId: (0,
|
|
118729
|
+
snapshotId: (0, import_node_crypto75.randomUUID)(),
|
|
118633
118730
|
rootPath,
|
|
118634
118731
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
118635
118732
|
head: first.head,
|
|
@@ -119157,7 +119254,7 @@ var CodeReviewService = class {
|
|
|
119157
119254
|
}
|
|
119158
119255
|
if (continuing && ["pending", "writing"].includes(previous.run.delivery))
|
|
119159
119256
|
throw new CodeReviewError(409, "delivery_pending", "\u672C\u8F6E\u7ED3\u679C\u5C1A\u5728\u56DE\u4F20\uFF0C\u8BF7\u7B49\u5F85\u56DE\u4F20\u7ED3\u675F\u540E\u590D\u5BA1");
|
|
119160
|
-
const id7 = (0,
|
|
119257
|
+
const id7 = (0, import_node_crypto76.randomUUID)();
|
|
119161
119258
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
119162
119259
|
const candidate = continuing && previous.reviewerThreadId && previous.run.reviewerTerminalId ? await this.tasks.observe(previous.reviewerTaskId).catch(() => null) : null;
|
|
119163
119260
|
const reuse = candidate?.availability === "available" && candidate.task.phase === "ready" && candidate.task.control === "supervisor" && candidate.task.threadId === previous?.reviewerThreadId && candidate.task.terminalSessionId === previous?.run.reviewerTerminalId && candidate.terminalState?.state === "agent_idle";
|
|
@@ -119273,8 +119370,8 @@ var CodeReviewService = class {
|
|
|
119273
119370
|
await (0, import_promises58.chmod)(import_node_path93.default.join(this.store.input(id7), "snapshot.json"), 256);
|
|
119274
119371
|
record3.snapshotId = snapshot3.snapshotId;
|
|
119275
119372
|
await this.touch(record3);
|
|
119276
|
-
await (0, import_promises58.chmod)(this.store.input(id7), 320);
|
|
119277
119373
|
}
|
|
119374
|
+
await (0, import_promises58.chmod)(this.store.input(id7), 320);
|
|
119278
119375
|
if (snapshot3.entries.every((entry) => entry.omission)) throw new CodeReviewError(422, "no_reviewable_changes", "\u5168\u90E8\u53D8\u66F4\u5747\u4E0D\u53EF\u8BFB\u53D6\uFF0C\u8986\u76D6\u7F3A\u53E3\u5DF2\u4FDD\u5B58");
|
|
119279
119376
|
if (record3.recovered && !this.tasks.list().some((task2) => task2.taskId === record3.reviewerTaskId) && !run2.reviewerTerminalId) {
|
|
119280
119377
|
record3.recovered = false;
|
|
@@ -119381,7 +119478,7 @@ var CodeReviewService = class {
|
|
|
119381
119478
|
};
|
|
119382
119479
|
|
|
119383
119480
|
// backend/src/terminal/tasks/store.ts
|
|
119384
|
-
var
|
|
119481
|
+
var import_node_crypto77 = require("node:crypto");
|
|
119385
119482
|
var import_promises59 = require("node:fs/promises");
|
|
119386
119483
|
var import_node_path94 = __toESM(require("node:path"), 1);
|
|
119387
119484
|
var TerminalTaskStore = class {
|
|
@@ -119417,7 +119514,7 @@ var TerminalTaskStore = class {
|
|
|
119417
119514
|
this.assertWritable();
|
|
119418
119515
|
const body2 = JSON.stringify({ version: 1, tasks: [...this.tasks.values()] });
|
|
119419
119516
|
const work = this.tail.then(async () => {
|
|
119420
|
-
const temporary = `${this.file}.${(0,
|
|
119517
|
+
const temporary = `${this.file}.${(0, import_node_crypto77.randomUUID)()}.tmp`;
|
|
119421
119518
|
const handle2 = await (0, import_promises59.open)(temporary, "wx", 384);
|
|
119422
119519
|
try {
|
|
119423
119520
|
await handle2.writeFile(body2);
|
|
@@ -119445,7 +119542,7 @@ var TerminalTaskStore = class {
|
|
|
119445
119542
|
var import_node_path97 = __toESM(require("node:path"), 1);
|
|
119446
119543
|
|
|
119447
119544
|
// backend/src/task-handoff/service.ts
|
|
119448
|
-
var
|
|
119545
|
+
var import_node_crypto78 = require("node:crypto");
|
|
119449
119546
|
var import_promises61 = require("node:fs/promises");
|
|
119450
119547
|
var import_node_path96 = __toESM(require("node:path"), 1);
|
|
119451
119548
|
|
|
@@ -119774,7 +119871,7 @@ var TaskHandoffService = class {
|
|
|
119774
119871
|
queue = Promise.resolve();
|
|
119775
119872
|
analysis;
|
|
119776
119873
|
key(target2) {
|
|
119777
|
-
return (0,
|
|
119874
|
+
return (0, import_node_crypto78.createHash)("sha256").update(JSON.stringify(target2)).digest("hex");
|
|
119778
119875
|
}
|
|
119779
119876
|
resolve(terminalSessionId, panelId) {
|
|
119780
119877
|
const session = this.manager.getSession(terminalSessionId);
|
|
@@ -119866,7 +119963,7 @@ var TaskHandoffService = class {
|
|
|
119866
119963
|
async save(card) {
|
|
119867
119964
|
await (0, import_promises61.mkdir)(this.directory, { recursive: true, mode: 448 });
|
|
119868
119965
|
const filename = import_node_path96.default.join(this.directory, `${this.key(card.target)}.json`);
|
|
119869
|
-
const temporary = `${filename}.${(0,
|
|
119966
|
+
const temporary = `${filename}.${(0, import_node_crypto78.randomUUID)()}.tmp`;
|
|
119870
119967
|
await (0, import_promises61.writeFile)(temporary, JSON.stringify(card), { mode: 384 });
|
|
119871
119968
|
await (0, import_promises61.rename)(temporary, filename);
|
|
119872
119969
|
}
|
|
@@ -120190,10 +120287,10 @@ var TerminalBadges = class {
|
|
|
120190
120287
|
};
|
|
120191
120288
|
|
|
120192
120289
|
// backend/src/device-monitor/terminal-replies.ts
|
|
120193
|
-
var
|
|
120290
|
+
var import_node_crypto80 = require("node:crypto");
|
|
120194
120291
|
|
|
120195
120292
|
// backend/src/device-monitor/alerts.ts
|
|
120196
|
-
var
|
|
120293
|
+
var import_node_crypto79 = require("node:crypto");
|
|
120197
120294
|
var targetFor = (s) => `${s.installationId}:${s.environment}`;
|
|
120198
120295
|
function updateAlerts(data, snapshot2, recipients, now2 = Date.now()) {
|
|
120199
120296
|
const level2 = batteryAlertLevel(snapshot2);
|
|
@@ -120203,7 +120300,7 @@ function updateAlerts(data, snapshot2, recipients, now2 = Date.now()) {
|
|
|
120203
120300
|
data.cycle = null;
|
|
120204
120301
|
}
|
|
120205
120302
|
if (level2 && !data.cycle)
|
|
120206
|
-
data.cycle = { id: (0,
|
|
120303
|
+
data.cycle = { id: (0, import_node_crypto79.randomUUID)(), highest: level2, startedAt: now2 };
|
|
120207
120304
|
if (data.cycle && level2 === 10) data.cycle.highest = 10;
|
|
120208
120305
|
const targets = new Set(recipients.map(targetFor));
|
|
120209
120306
|
for (const delivery of Object.values(data.deliveries)) {
|
|
@@ -120214,7 +120311,7 @@ function updateAlerts(data, snapshot2, recipients, now2 = Date.now()) {
|
|
|
120214
120311
|
}
|
|
120215
120312
|
if (level2 && data.cycle && level2 === data.cycle.highest) {
|
|
120216
120313
|
for (const target2 of targets) {
|
|
120217
|
-
const id7 = (0,
|
|
120314
|
+
const id7 = (0, import_node_crypto79.createHash)("sha256").update(`${data.hostId}:${data.cycle.id}:${level2}:${target2}`).digest("hex");
|
|
120218
120315
|
if (!data.deliveries[id7])
|
|
120219
120316
|
data.deliveries[id7] = {
|
|
120220
120317
|
id: id7,
|
|
@@ -120264,7 +120361,7 @@ var TerminalReplyNotifications = class {
|
|
|
120264
120361
|
if (this.stopped) return;
|
|
120265
120362
|
const recipients = Object.values(this.subscriptions.store.snapshot().subscriptions).filter((s) => s.sessionId === sessionId && this.eligible(s));
|
|
120266
120363
|
if (!recipients.length) return;
|
|
120267
|
-
const id7 = (0,
|
|
120364
|
+
const id7 = (0, import_node_crypto80.randomUUID)();
|
|
120268
120365
|
await this.subscriptions.store.update((data) => {
|
|
120269
120366
|
const state = data.terminalReplies ??= { inputs: {}, turns: {}, deliveries: {} };
|
|
120270
120367
|
const key2 = panelKey(terminalId, panelId);
|
|
@@ -120302,7 +120399,7 @@ var TerminalReplyNotifications = class {
|
|
|
120302
120399
|
}
|
|
120303
120400
|
if (!input2 && !previous) return;
|
|
120304
120401
|
state.turns[key2] = {
|
|
120305
|
-
id: (0,
|
|
120402
|
+
id: (0, import_node_crypto80.randomUUID)(),
|
|
120306
120403
|
threadId,
|
|
120307
120404
|
source: source2,
|
|
120308
120405
|
startEventId,
|
|
@@ -120329,7 +120426,7 @@ var TerminalReplyNotifications = class {
|
|
|
120329
120426
|
if (subscription2?.sessionId === turn.sessionId && this.eligible(subscription2)) recipients.set(targetFor(subscription2), subscription2);
|
|
120330
120427
|
}
|
|
120331
120428
|
for (const [target2, subscription2] of recipients) {
|
|
120332
|
-
const id7 = (0,
|
|
120429
|
+
const id7 = (0, import_node_crypto80.createHash)("sha256").update(`${input2.terminalSessionId}:${turn.id}:${target2}`).digest("hex");
|
|
120333
120430
|
state.deliveries[id7] ??= {
|
|
120334
120431
|
id: id7,
|
|
120335
120432
|
terminalSessionId: session.id,
|
|
@@ -120429,11 +120526,11 @@ function panelKey(terminalId, panelId) {
|
|
|
120429
120526
|
return JSON.stringify([terminalId, panelId]);
|
|
120430
120527
|
}
|
|
120431
120528
|
function hashPrompt(text5) {
|
|
120432
|
-
return (0,
|
|
120529
|
+
return (0, import_node_crypto80.createHash)("sha256").update(text5.replace(/\r\n/g, "\n").trim().slice(0, 8e3)).digest("hex");
|
|
120433
120530
|
}
|
|
120434
120531
|
|
|
120435
120532
|
// backend/src/device-monitor/desktop-badge-access.ts
|
|
120436
|
-
var
|
|
120533
|
+
var import_node_crypto81 = require("node:crypto");
|
|
120437
120534
|
|
|
120438
120535
|
// packages/shared/src/push-notifications.ts
|
|
120439
120536
|
function pushBadgeTargetIdentity(environment2, installationId) {
|
|
@@ -120441,7 +120538,7 @@ function pushBadgeTargetIdentity(environment2, installationId) {
|
|
|
120441
120538
|
}
|
|
120442
120539
|
|
|
120443
120540
|
// backend/src/device-monitor/desktop-badge-access.ts
|
|
120444
|
-
var digest4 = (value) => (0,
|
|
120541
|
+
var digest4 = (value) => (0, import_node_crypto81.createHash)("sha256").update(value).digest("hex");
|
|
120445
120542
|
var DesktopBadgeAccess = class {
|
|
120446
120543
|
constructor(auth, subscriptions) {
|
|
120447
120544
|
this.auth = auth;
|
|
@@ -120481,7 +120578,7 @@ var DesktopBadgeAccess = class {
|
|
|
120481
120578
|
};
|
|
120482
120579
|
|
|
120483
120580
|
// backend/src/terminal/questions/service.ts
|
|
120484
|
-
var
|
|
120581
|
+
var import_node_crypto82 = require("node:crypto");
|
|
120485
120582
|
|
|
120486
120583
|
// backend/src/terminal/questions/executor.ts
|
|
120487
120584
|
var import_node_child_process30 = require("node:child_process");
|
|
@@ -120543,18 +120640,18 @@ function remoteSocket(args) {
|
|
|
120543
120640
|
}
|
|
120544
120641
|
async function findQuestionExecutor(panePid) {
|
|
120545
120642
|
const { stdout } = await exec6("ps", ["-ww", "-axo", "pid=,ppid=,uid="], { timeout: 3e3, maxBuffer: 4 * 1024 * 1024 });
|
|
120546
|
-
const
|
|
120643
|
+
const processes2 = stdout.split("\n").flatMap((line) => {
|
|
120547
120644
|
const match = line.match(/^\s*(\d+)\s+(\d+)\s+(\d+)\s*$/);
|
|
120548
120645
|
return match ? [{ pid: Number(match[1]), parent: Number(match[2]), uid: Number(match[3]) }] : [];
|
|
120549
120646
|
});
|
|
120550
120647
|
const descendants = /* @__PURE__ */ new Set([panePid]);
|
|
120551
|
-
for (let iteration = 0; iteration <
|
|
120648
|
+
for (let iteration = 0; iteration < processes2.length; iteration++) {
|
|
120552
120649
|
const before = descendants.size;
|
|
120553
|
-
for (const entry of
|
|
120650
|
+
for (const entry of processes2) if (descendants.has(entry.parent)) descendants.add(entry.pid);
|
|
120554
120651
|
if (before === descendants.size) break;
|
|
120555
120652
|
}
|
|
120556
120653
|
const candidates = [];
|
|
120557
|
-
for (const entry of
|
|
120654
|
+
for (const entry of processes2) {
|
|
120558
120655
|
if (!descendants.has(entry.pid) || entry.uid !== process.getuid?.()) continue;
|
|
120559
120656
|
const args = await readCodexProcessArguments(entry.pid);
|
|
120560
120657
|
const socket = args && remoteSocket(args);
|
|
@@ -120571,7 +120668,7 @@ var TerminalQuestionsService = class {
|
|
|
120571
120668
|
this.manager = manager;
|
|
120572
120669
|
this.tmux = tmux;
|
|
120573
120670
|
}
|
|
120574
|
-
generation = (0,
|
|
120671
|
+
generation = (0, import_node_crypto82.randomUUID)();
|
|
120575
120672
|
closed = false;
|
|
120576
120673
|
connections = /* @__PURE__ */ new Map();
|
|
120577
120674
|
async target(terminalId, panelId) {
|
|
@@ -120659,10 +120756,10 @@ var TerminalQuestionsService = class {
|
|
|
120659
120756
|
|
|
120660
120757
|
// backend/src/resource-monitor/service.ts
|
|
120661
120758
|
var import_node_os21 = __toESM(require("node:os"), 1);
|
|
120662
|
-
var
|
|
120759
|
+
var import_node_crypto84 = require("node:crypto");
|
|
120663
120760
|
|
|
120664
120761
|
// backend/src/resource-monitor/observations.ts
|
|
120665
|
-
var
|
|
120762
|
+
var import_node_crypto83 = require("node:crypto");
|
|
120666
120763
|
var ResourceObservations = class {
|
|
120667
120764
|
observations = /* @__PURE__ */ new Map();
|
|
120668
120765
|
ready = /* @__PURE__ */ new Set();
|
|
@@ -120742,7 +120839,7 @@ var ResourceObservations = class {
|
|
|
120742
120839
|
if (alert) Object.assign(alert, evidence);
|
|
120743
120840
|
else if ((state.cooldowns[key2] ?? 0) <= now2 && (state.snoozes[app.appKey] ?? 0) <= now2) {
|
|
120744
120841
|
state.alerts.push({
|
|
120745
|
-
alertId: (0,
|
|
120842
|
+
alertId: (0, import_node_crypto83.randomUUID)(),
|
|
120746
120843
|
hostId,
|
|
120747
120844
|
appKey: app.appKey,
|
|
120748
120845
|
appName: app.appName,
|
|
@@ -120796,7 +120893,7 @@ var ResourceMonitorService = class {
|
|
|
120796
120893
|
this.observations.reset("energy");
|
|
120797
120894
|
});
|
|
120798
120895
|
}
|
|
120799
|
-
streamId = (0,
|
|
120896
|
+
streamId = (0, import_node_crypto84.randomUUID)();
|
|
120800
120897
|
revision = 0;
|
|
120801
120898
|
latest = null;
|
|
120802
120899
|
timer;
|
|
@@ -120975,7 +121072,7 @@ var ResourceMonitorService = class {
|
|
|
120975
121072
|
};
|
|
120976
121073
|
|
|
120977
121074
|
// backend/src/resource-monitor/store.ts
|
|
120978
|
-
var
|
|
121075
|
+
var import_node_crypto85 = require("node:crypto");
|
|
120979
121076
|
var import_promises64 = require("node:fs/promises");
|
|
120980
121077
|
var import_node_path99 = __toESM(require("node:path"), 1);
|
|
120981
121078
|
var alertSchema = external_exports.object({
|
|
@@ -121042,7 +121139,7 @@ var ResourceMonitorStore = class _ResourceMonitorStore {
|
|
|
121042
121139
|
const next = structuredClone(this.data);
|
|
121043
121140
|
const result = mutate(next);
|
|
121044
121141
|
schema2.parse(next);
|
|
121045
|
-
const temporary = `${this.file}.${(0,
|
|
121142
|
+
const temporary = `${this.file}.${(0, import_node_crypto85.randomUUID)()}.tmp`;
|
|
121046
121143
|
const handle2 = await (0, import_promises64.open)(temporary, "wx", 384);
|
|
121047
121144
|
try {
|
|
121048
121145
|
await handle2.writeFile(JSON.stringify(next));
|
|
@@ -121066,7 +121163,7 @@ var ResourceMonitorStore = class _ResourceMonitorStore {
|
|
|
121066
121163
|
};
|
|
121067
121164
|
|
|
121068
121165
|
// backend/src/terminal/attachments/text-attachment-delivery.ts
|
|
121069
|
-
var
|
|
121166
|
+
var import_node_crypto86 = require("node:crypto");
|
|
121070
121167
|
var TerminalTextAttachmentDelivery = class {
|
|
121071
121168
|
constructor(files, manager, tmux, registry2, pty) {
|
|
121072
121169
|
this.files = files;
|
|
@@ -121093,7 +121190,7 @@ var TerminalTextAttachmentDelivery = class {
|
|
|
121093
121190
|
if (this.preparations.size >= 1e3)
|
|
121094
121191
|
throw new TextAttachmentError(429, "\u5F85\u5904\u7406\u7C98\u8D34\u8FC7\u591A");
|
|
121095
121192
|
const target2 = this.target(sessionId, panelId);
|
|
121096
|
-
const preparationId = (0,
|
|
121193
|
+
const preparationId = (0, import_node_crypto86.randomUUID)();
|
|
121097
121194
|
const expiresAt = Date.now() + 12e4;
|
|
121098
121195
|
this.preparations.set(preparationId, {
|
|
121099
121196
|
target: target2,
|
|
@@ -121429,7 +121526,7 @@ var import_node_os22 = __toESM(require("node:os"), 1);
|
|
|
121429
121526
|
var import_node_path101 = __toESM(require("node:path"), 1);
|
|
121430
121527
|
|
|
121431
121528
|
// backend/src/knowledge-inbox/projection.ts
|
|
121432
|
-
var
|
|
121529
|
+
var import_node_crypto87 = require("node:crypto");
|
|
121433
121530
|
function publicText(value) {
|
|
121434
121531
|
return redactExcerpt(value).replace(/file:\/\/[^\s<>"'`]+/giu, "[\u8DEF\u5F84]").replace(
|
|
121435
121532
|
/(?:[A-Za-z]:\\|~\/|(?<![\w:/])\/)[^\s<>"'`,。;))]+/gu,
|
|
@@ -121457,7 +121554,7 @@ function itemId(source2, repositoryId, sourceId) {
|
|
|
121457
121554
|
return digest5(JSON.stringify([source2, repositoryId, sourceId]));
|
|
121458
121555
|
}
|
|
121459
121556
|
function digest5(value) {
|
|
121460
|
-
return (0,
|
|
121557
|
+
return (0, import_node_crypto87.createHash)("sha256").update(value).digest("hex");
|
|
121461
121558
|
}
|
|
121462
121559
|
function publicContent(content) {
|
|
121463
121560
|
return {
|
|
@@ -121684,7 +121781,7 @@ async function readStable(source2, repositories) {
|
|
|
121684
121781
|
var import_node_fs42 = require("node:fs");
|
|
121685
121782
|
var import_node_module3 = require("node:module");
|
|
121686
121783
|
var import_node_path100 = __toESM(require("node:path"), 1);
|
|
121687
|
-
var
|
|
121784
|
+
var import_node_crypto88 = require("node:crypto");
|
|
121688
121785
|
var require4 = (0, import_node_module3.createRequire)(__IMPORT_META_URL__);
|
|
121689
121786
|
var InboxStorage = class {
|
|
121690
121787
|
constructor(directory4) {
|
|
@@ -121716,7 +121813,7 @@ var InboxStorage = class {
|
|
|
121716
121813
|
CREATE TABLE IF NOT EXISTS share_identity (id INTEGER PRIMARY KEY CHECK(id=1), identity TEXT NOT NULL);
|
|
121717
121814
|
CREATE TABLE IF NOT EXISTS knowledge_shares (id TEXT PRIMARY KEY, username TEXT NOT NULL, snapshot TEXT NOT NULL);
|
|
121718
121815
|
`);
|
|
121719
|
-
db.prepare("INSERT OR IGNORE INTO share_identity VALUES(1,?)").run((0,
|
|
121816
|
+
db.prepare("INSERT OR IGNORE INTO share_identity VALUES(1,?)").run((0, import_node_crypto88.randomUUID)());
|
|
121720
121817
|
const columns = db.prepare("PRAGMA table_info(user_state)").all();
|
|
121721
121818
|
if (!columns.some((column) => column.name === "snapshot")) {
|
|
121722
121819
|
db.transaction(() => {
|
|
@@ -121739,7 +121836,7 @@ var InboxDatabase = class {
|
|
|
121739
121836
|
return this.db.prepare("SELECT identity FROM share_identity WHERE id=1").get().identity;
|
|
121740
121837
|
}
|
|
121741
121838
|
saveShare(username, snapshot2) {
|
|
121742
|
-
const id7 = (0,
|
|
121839
|
+
const id7 = (0, import_node_crypto88.randomUUID)();
|
|
121743
121840
|
this.db.prepare("INSERT INTO knowledge_shares VALUES(?,?,?)").run(id7, username, JSON.stringify(snapshot2));
|
|
121744
121841
|
return `rw-knowledge:v1:${this.shareIdentity()}:${id7}`;
|
|
121745
121842
|
}
|
|
@@ -122189,12 +122286,12 @@ function createKnowledgeInbox(resources, dependencies) {
|
|
|
122189
122286
|
}
|
|
122190
122287
|
|
|
122191
122288
|
// backend/src/evolution/tools/token-registry.ts
|
|
122192
|
-
var
|
|
122289
|
+
var import_node_crypto89 = __toESM(require("node:crypto"), 1);
|
|
122193
122290
|
var EvolutionToolTokenRegistry = class {
|
|
122194
122291
|
grants = /* @__PURE__ */ new Map();
|
|
122195
122292
|
runToolCalls = /* @__PURE__ */ new Map();
|
|
122196
122293
|
issue(input2) {
|
|
122197
|
-
const token =
|
|
122294
|
+
const token = import_node_crypto89.default.randomBytes(32).toString("base64url");
|
|
122198
122295
|
const grant = {
|
|
122199
122296
|
runId: input2.runId,
|
|
122200
122297
|
attemptId: input2.attemptId,
|
|
@@ -122249,7 +122346,7 @@ var EvolutionToolTokenRegistry = class {
|
|
|
122249
122346
|
}
|
|
122250
122347
|
};
|
|
122251
122348
|
function tokenDigest(token) {
|
|
122252
|
-
return
|
|
122349
|
+
return import_node_crypto89.default.createHash("sha256").update(token).digest("hex");
|
|
122253
122350
|
}
|
|
122254
122351
|
function cloneGrant(grant) {
|
|
122255
122352
|
return { ...grant, allowedTools: [...grant.allowedTools] };
|
|
@@ -122301,9 +122398,9 @@ function resolveEvolutionLearningScope(projectId) {
|
|
|
122301
122398
|
}
|
|
122302
122399
|
|
|
122303
122400
|
// backend/src/evolution/repository-store.ts
|
|
122304
|
-
var
|
|
122401
|
+
var import_node_crypto90 = require("node:crypto");
|
|
122305
122402
|
function repositoryRegistrationVersion(repository) {
|
|
122306
|
-
return (0,
|
|
122403
|
+
return (0, import_node_crypto90.createHash)("sha256").update(JSON.stringify(repository)).digest("hex");
|
|
122307
122404
|
}
|
|
122308
122405
|
function repositoryRegistrationRemoved(repository) {
|
|
122309
122406
|
return repository.registrationHistory?.at(-1)?.action === "removed";
|
|
@@ -122818,7 +122915,7 @@ async function readRunConclusions(runId, analysisStore, activationStore) {
|
|
|
122818
122915
|
}
|
|
122819
122916
|
|
|
122820
122917
|
// backend/src/evolution/service.ts
|
|
122821
|
-
var
|
|
122918
|
+
var import_node_crypto91 = __toESM(require("node:crypto"), 1);
|
|
122822
122919
|
|
|
122823
122920
|
// backend/src/evolution/cron.ts
|
|
122824
122921
|
var MINUTE_MS2 = 6e4;
|
|
@@ -123076,7 +123173,7 @@ var EvolutionService = class {
|
|
|
123076
123173
|
const requestedAfterWatermark = request2.dataRange?.afterWatermark;
|
|
123077
123174
|
const storedWatermark = requestedAfterWatermark === void 0 ? await store.getWatermark(learningScopeId, "activity") : null;
|
|
123078
123175
|
const run2 = {
|
|
123079
|
-
runId:
|
|
123176
|
+
runId: import_node_crypto91.default.randomUUID(),
|
|
123080
123177
|
repository,
|
|
123081
123178
|
learningScopeId,
|
|
123082
123179
|
trigger: { type: "manual", requestedBy },
|
|
@@ -123172,7 +123269,7 @@ var EvolutionService = class {
|
|
|
123172
123269
|
if (!this.repositories) throw new Error("evolution_repository_unavailable");
|
|
123173
123270
|
const repository = await this.repositories.resolve(request2);
|
|
123174
123271
|
const schedule2 = {
|
|
123175
|
-
scheduleId:
|
|
123272
|
+
scheduleId: import_node_crypto91.default.randomUUID(),
|
|
123176
123273
|
repository,
|
|
123177
123274
|
learningScopeId: repository.repositoryId,
|
|
123178
123275
|
name: request2.name.trim(),
|
|
@@ -123238,7 +123335,7 @@ var EvolutionService = class {
|
|
|
123238
123335
|
schedule2.timezone,
|
|
123239
123336
|
at
|
|
123240
123337
|
).toISOString();
|
|
123241
|
-
const runId =
|
|
123338
|
+
const runId = import_node_crypto91.default.randomUUID();
|
|
123242
123339
|
const watermark = await store.getWatermark(
|
|
123243
123340
|
schedule2.learningScopeId,
|
|
123244
123341
|
"activity"
|
|
@@ -123341,7 +123438,7 @@ var EvolutionService = class {
|
|
|
123341
123438
|
)
|
|
123342
123439
|
);
|
|
123343
123440
|
const batch = {
|
|
123344
|
-
batchId:
|
|
123441
|
+
batchId: import_node_crypto91.default.randomUUID(),
|
|
123345
123442
|
idempotencyKey,
|
|
123346
123443
|
createdAt: now2,
|
|
123347
123444
|
snapshotBoundary: boundary,
|
|
@@ -123487,7 +123584,7 @@ var import_node_fs46 = require("node:fs");
|
|
|
123487
123584
|
var import_node_path108 = __toESM(require("node:path"), 1);
|
|
123488
123585
|
|
|
123489
123586
|
// backend/src/evolution/storage/repository-migration-audit.ts
|
|
123490
|
-
var
|
|
123587
|
+
var import_node_crypto93 = require("node:crypto");
|
|
123491
123588
|
var import_promises65 = require("node:fs/promises");
|
|
123492
123589
|
var import_node_path104 = __toESM(require("node:path"), 1);
|
|
123493
123590
|
|
|
@@ -123554,7 +123651,7 @@ function queryActivityEvolutionEvidenceAvailability(database, requestedEventIds)
|
|
|
123554
123651
|
}
|
|
123555
123652
|
|
|
123556
123653
|
// backend/src/evolution/storage/repository-migration-integrity.ts
|
|
123557
|
-
var
|
|
123654
|
+
var import_node_crypto92 = require("node:crypto");
|
|
123558
123655
|
|
|
123559
123656
|
// backend/src/evolution/storage/sqlite-driver.ts
|
|
123560
123657
|
var import_node_module5 = require("node:module");
|
|
@@ -123566,7 +123663,7 @@ function openEvolutionDatabase(file, options = {}) {
|
|
|
123566
123663
|
|
|
123567
123664
|
// backend/src/evolution/storage/repository-migration-integrity.ts
|
|
123568
123665
|
function hash5(value) {
|
|
123569
|
-
return (0,
|
|
123666
|
+
return (0, import_node_crypto92.createHash)("sha256").update(value).digest("hex");
|
|
123570
123667
|
}
|
|
123571
123668
|
function manifestDigest(manifest) {
|
|
123572
123669
|
const content = { ...manifest, digest: void 0 };
|
|
@@ -123587,7 +123684,7 @@ function tables(database) {
|
|
|
123587
123684
|
}
|
|
123588
123685
|
function tableDigest(database, table) {
|
|
123589
123686
|
if (!/^[a-z_]+$/u.test(table)) throw new Error("invalid_table");
|
|
123590
|
-
const digest8 = (0,
|
|
123687
|
+
const digest8 = (0, import_node_crypto92.createHash)("sha256");
|
|
123591
123688
|
for (const row of database.prepare(`SELECT * FROM ${table} ORDER BY rowid`).iterate())
|
|
123592
123689
|
digest8.update(JSON.stringify(row) + "\n");
|
|
123593
123690
|
return digest8.digest("hex");
|
|
@@ -123897,7 +123994,7 @@ async function auditRepositoryMigration(dataDir) {
|
|
|
123897
123994
|
}
|
|
123898
123995
|
const manifest = {
|
|
123899
123996
|
version: 1,
|
|
123900
|
-
migrationId: (0,
|
|
123997
|
+
migrationId: (0, import_node_crypto93.randomUUID)(),
|
|
123901
123998
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
123902
123999
|
source: source2,
|
|
123903
124000
|
fingerprints: {
|
|
@@ -124547,7 +124644,7 @@ async function prepareEvolutionRepositoryMigration() {
|
|
|
124547
124644
|
|
|
124548
124645
|
// backend/src/browser-local/service.ts
|
|
124549
124646
|
var import_node_net5 = __toESM(require("node:net"), 1);
|
|
124550
|
-
var
|
|
124647
|
+
var import_node_crypto94 = require("node:crypto");
|
|
124551
124648
|
var import_node_tls = __toESM(require("node:tls"), 1);
|
|
124552
124649
|
function loopback(host) {
|
|
124553
124650
|
if (host === "localhost" || /^[a-z0-9-]+(?:\.[a-z0-9-]+)*\.localhost$/.test(host))
|
|
@@ -124568,7 +124665,7 @@ var LocalBrowserService = class {
|
|
|
124568
124665
|
issueGrant(authId, open19) {
|
|
124569
124666
|
for (const [key2, grant] of this.grants) if (grant.expiresAt <= Date.now()) this.grants.delete(key2);
|
|
124570
124667
|
if (this.disposed || !this.enabled || !this.sourceAvailable(authId, open19.terminalSessionId) || !loopback(open19.host) || !Number.isInteger(open19.port) || open19.port < 1 || open19.port > 65535 || this.grants.size >= 1024) return null;
|
|
124571
|
-
const token = (0,
|
|
124668
|
+
const token = (0, import_node_crypto94.randomBytes)(32).toString("base64url");
|
|
124572
124669
|
this.grants.set(token, { authId, open: open19, expiresAt: Date.now() + 6e4 });
|
|
124573
124670
|
return token;
|
|
124574
124671
|
}
|
|
@@ -124873,7 +124970,7 @@ var BatteryAlerts = class {
|
|
|
124873
124970
|
};
|
|
124874
124971
|
|
|
124875
124972
|
// backend/src/device-monitor/service.ts
|
|
124876
|
-
var
|
|
124973
|
+
var import_node_crypto95 = require("node:crypto");
|
|
124877
124974
|
|
|
124878
124975
|
// backend/src/device-monitor/sampler.ts
|
|
124879
124976
|
var import_node_child_process33 = require("node:child_process");
|
|
@@ -124904,7 +125001,7 @@ var DeviceMonitorService = class {
|
|
|
124904
125001
|
this.snapshotValue = {
|
|
124905
125002
|
protocolVersion: 1,
|
|
124906
125003
|
hostId: store.snapshot().hostId,
|
|
124907
|
-
streamId: (0,
|
|
125004
|
+
streamId: (0, import_node_crypto95.randomUUID)(),
|
|
124908
125005
|
revision: 0,
|
|
124909
125006
|
sampleStatus: "pending",
|
|
124910
125007
|
observedAt: null,
|
|
@@ -124979,7 +125076,7 @@ var DeviceMonitorService = class {
|
|
|
124979
125076
|
};
|
|
124980
125077
|
|
|
124981
125078
|
// backend/src/device-monitor/store.ts
|
|
124982
|
-
var
|
|
125079
|
+
var import_node_crypto96 = require("node:crypto");
|
|
124983
125080
|
var import_promises66 = require("node:fs/promises");
|
|
124984
125081
|
var import_node_path109 = __toESM(require("node:path"), 1);
|
|
124985
125082
|
|
|
@@ -125125,7 +125222,7 @@ var DeviceMonitorStore = class _DeviceMonitorStore {
|
|
|
125125
125222
|
if (error2.code !== "ENOENT") throw error2;
|
|
125126
125223
|
data = {
|
|
125127
125224
|
schemaVersion: 1,
|
|
125128
|
-
hostId: (0,
|
|
125225
|
+
hostId: (0, import_node_crypto96.randomUUID)(),
|
|
125129
125226
|
cycle: null,
|
|
125130
125227
|
subscriptions: {},
|
|
125131
125228
|
deliveries: {}
|
|
@@ -125148,7 +125245,7 @@ var DeviceMonitorStore = class _DeviceMonitorStore {
|
|
|
125148
125245
|
const work = this.tail.catch(() => void 0).then(async () => {
|
|
125149
125246
|
const next = structuredClone(this.data);
|
|
125150
125247
|
const result = mutate(next);
|
|
125151
|
-
const temporary = `${this.file}.${(0,
|
|
125248
|
+
const temporary = `${this.file}.${(0, import_node_crypto96.randomUUID)()}.tmp`;
|
|
125152
125249
|
const handle2 = await (0, import_promises66.open)(temporary, "wx", 384);
|
|
125153
125250
|
try {
|
|
125154
125251
|
await handle2.writeFile(JSON.stringify(next));
|
|
@@ -125219,9 +125316,9 @@ var import_promises67 = require("node:fs/promises");
|
|
|
125219
125316
|
var import_node_path112 = __toESM(require("node:path"), 1);
|
|
125220
125317
|
|
|
125221
125318
|
// backend/src/experience/learning-queue.ts
|
|
125222
|
-
var
|
|
125319
|
+
var import_node_crypto97 = require("node:crypto");
|
|
125223
125320
|
var import_node_path111 = __toESM(require("node:path"), 1);
|
|
125224
|
-
var digest6 = (text5) => (0,
|
|
125321
|
+
var digest6 = (text5) => (0, import_node_crypto97.createHash)("sha256").update(text5).digest("hex");
|
|
125225
125322
|
var ExperienceLearningQueue = class {
|
|
125226
125323
|
directory;
|
|
125227
125324
|
store;
|
|
@@ -125280,7 +125377,7 @@ var ExperienceLearningQueue = class {
|
|
|
125280
125377
|
...job,
|
|
125281
125378
|
status: "running",
|
|
125282
125379
|
attempts: job.attempts + 1,
|
|
125283
|
-
claim: (0,
|
|
125380
|
+
claim: (0, import_node_crypto97.randomUUID)(),
|
|
125284
125381
|
leaseUntil: now2 + 5 * 6e4,
|
|
125285
125382
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
125286
125383
|
};
|
|
@@ -125540,7 +125637,7 @@ compatible \u53EA\u8868\u793A\u672C\u6BB5\u672A\u53D1\u73B0\u95EE\u9898\uFF0C\u4
|
|
|
125540
125637
|
};
|
|
125541
125638
|
|
|
125542
125639
|
// backend/src/experience/learning-failure.ts
|
|
125543
|
-
var
|
|
125640
|
+
var import_node_crypto98 = require("node:crypto");
|
|
125544
125641
|
function learningFailureReceipt(error2, input2) {
|
|
125545
125642
|
const raw = error2 instanceof ProviderOutputError || error2 instanceof ProviderProcessError ? error2.raw : input2.output === void 0 ? "" : JSON.stringify(input2.output);
|
|
125546
125643
|
let normalized = raw;
|
|
@@ -125568,7 +125665,7 @@ function learningFailureReceipt(error2, input2) {
|
|
|
125568
125665
|
}
|
|
125569
125666
|
const code = error2 instanceof ProviderOutputError ? error2.ioCode ?? error2.message : error2 instanceof external_exports.ZodError ? "provider_output_schema_invalid" : error2 instanceof Error && /^provider_[a-z_]+$/u.test(error2.message) ? error2.message : "provider_failed";
|
|
125570
125667
|
return {
|
|
125571
|
-
receiptId: (0,
|
|
125668
|
+
receiptId: (0, import_node_crypto98.randomUUID)(),
|
|
125572
125669
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
125573
125670
|
attempt: input2.attempt,
|
|
125574
125671
|
phase: input2.phase,
|
|
@@ -126033,7 +126130,7 @@ function hasToolPair(facts, ids) {
|
|
|
126033
126130
|
}
|
|
126034
126131
|
|
|
126035
126132
|
// backend/src/experience/learning-source.ts
|
|
126036
|
-
var
|
|
126133
|
+
var import_node_crypto99 = require("node:crypto");
|
|
126037
126134
|
async function readLearningFacts(store, source2) {
|
|
126038
126135
|
if (!store) throw new Error("experience_activity_unavailable");
|
|
126039
126136
|
const selected = [];
|
|
@@ -126129,7 +126226,7 @@ function projectToolImages(text5) {
|
|
|
126129
126226
|
type: "omitted_image",
|
|
126130
126227
|
reason: "Image not inspected by text-only experience analysis; not outcome evidence",
|
|
126131
126228
|
sourceBytes: Buffer.byteLength(block.image_url),
|
|
126132
|
-
sha256: (0,
|
|
126229
|
+
sha256: (0, import_node_crypto99.createHash)("sha256").update(block.image_url).digest("hex")
|
|
126133
126230
|
};
|
|
126134
126231
|
});
|
|
126135
126232
|
return {
|
|
@@ -126699,7 +126796,7 @@ function readVersion(output) {
|
|
|
126699
126796
|
}
|
|
126700
126797
|
|
|
126701
126798
|
// backend/src/activity/runtime.ts
|
|
126702
|
-
var
|
|
126799
|
+
var import_node_crypto101 = __toESM(require("node:crypto"), 1);
|
|
126703
126800
|
var import_node_path115 = __toESM(require("node:path"), 1);
|
|
126704
126801
|
|
|
126705
126802
|
// backend/src/activity/database/service.ts
|
|
@@ -126754,17 +126851,17 @@ var ActivityQueryService = class {
|
|
|
126754
126851
|
};
|
|
126755
126852
|
|
|
126756
126853
|
// backend/src/activity/recording/event-factory.ts
|
|
126757
|
-
var
|
|
126854
|
+
var import_node_crypto100 = __toESM(require("node:crypto"), 1);
|
|
126758
126855
|
var ActivityEventFactory = class {
|
|
126759
126856
|
constructor(identity2) {
|
|
126760
126857
|
this.identity = identity2;
|
|
126761
126858
|
}
|
|
126762
|
-
bootId =
|
|
126859
|
+
bootId = import_node_crypto100.default.randomUUID();
|
|
126763
126860
|
bootStartedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
126764
126861
|
sequence = 0;
|
|
126765
126862
|
create(params) {
|
|
126766
126863
|
return {
|
|
126767
|
-
eventId:
|
|
126864
|
+
eventId: import_node_crypto100.default.randomUUID(),
|
|
126768
126865
|
eventName: params.eventName,
|
|
126769
126866
|
schemaVersion: 1,
|
|
126770
126867
|
occurredAt: params.occurredAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -127358,7 +127455,7 @@ var ActivityRuntime = class _ActivityRuntime {
|
|
|
127358
127455
|
this.instanceId = instanceId;
|
|
127359
127456
|
this.recorder = new ActivityRecorder(store);
|
|
127360
127457
|
this.queryService = new ActivityQueryService(store, unavailableReason);
|
|
127361
|
-
this.maintenanceOwnerId = `${instanceId}:${
|
|
127458
|
+
this.maintenanceOwnerId = `${instanceId}:${import_node_crypto101.default.randomUUID()}`;
|
|
127362
127459
|
}
|
|
127363
127460
|
recorder;
|
|
127364
127461
|
queryService;
|
|
@@ -127369,7 +127466,7 @@ var ActivityRuntime = class _ActivityRuntime {
|
|
|
127369
127466
|
maintenanceOwnerId;
|
|
127370
127467
|
static async create(input2) {
|
|
127371
127468
|
const { env, browserProfileDir, runtimeChannel } = input2;
|
|
127372
|
-
const instanceId = env.RUNWEAVE_DESKTOP_INSTANCE_ID?.trim() || `backend:${process.pid}:${
|
|
127469
|
+
const instanceId = env.RUNWEAVE_DESKTOP_INSTANCE_ID?.trim() || `backend:${process.pid}:${import_node_crypto101.default.createHash("sha256").update(browserProfileDir).digest("hex").slice(0, 12)}`;
|
|
127373
127470
|
const eventFactory = new ActivityEventFactory({
|
|
127374
127471
|
producerName: "runweave-backend",
|
|
127375
127472
|
producerVersion: env.RUNWEAVE_RUNTIME_RELEASE_ID?.trim() || "builtin",
|
|
@@ -127512,7 +127609,7 @@ var LowDbTerminalQuickInputStore = class {
|
|
|
127512
127609
|
|
|
127513
127610
|
// backend/src/terminal/application/hook-token.ts
|
|
127514
127611
|
var import_node_fs47 = require("node:fs");
|
|
127515
|
-
var
|
|
127612
|
+
var import_node_crypto102 = require("node:crypto");
|
|
127516
127613
|
var import_node_path117 = __toESM(require("node:path"), 1);
|
|
127517
127614
|
var HOOK_TOKEN_BYTES = 32;
|
|
127518
127615
|
function loadOrCreateHookToken(filePath) {
|
|
@@ -127526,7 +127623,7 @@ function loadOrCreateHookToken(filePath) {
|
|
|
127526
127623
|
throw error2;
|
|
127527
127624
|
}
|
|
127528
127625
|
}
|
|
127529
|
-
const generated = (0,
|
|
127626
|
+
const generated = (0, import_node_crypto102.randomBytes)(HOOK_TOKEN_BYTES).toString("hex");
|
|
127530
127627
|
(0, import_node_fs47.mkdirSync)(import_node_path117.default.dirname(filePath), { recursive: true });
|
|
127531
127628
|
(0, import_node_fs47.writeFileSync)(filePath, generated, "utf8");
|
|
127532
127629
|
try {
|
|
@@ -128403,7 +128500,7 @@ var TmuxLifecycleCoordinator = class {
|
|
|
128403
128500
|
};
|
|
128404
128501
|
|
|
128405
128502
|
// backend/src/terminal/tmux/output-watcher.ts
|
|
128406
|
-
var
|
|
128503
|
+
var import_node_crypto103 = require("node:crypto");
|
|
128407
128504
|
var import_promises72 = require("node:fs/promises");
|
|
128408
128505
|
var import_node_string_decoder2 = require("node:string_decoder");
|
|
128409
128506
|
|
|
@@ -128819,7 +128916,7 @@ var TmuxOutputWatcher = class {
|
|
|
128819
128916
|
const markerSearchCursor = captureScrollbackBufferCursor(
|
|
128820
128917
|
watched.outputBuffer
|
|
128821
128918
|
);
|
|
128822
|
-
const markerId = (0,
|
|
128919
|
+
const markerId = (0, import_node_crypto103.randomUUID)();
|
|
128823
128920
|
const marker = `\x1B]777;runweave-pane-boundary=${markerId}\x07`;
|
|
128824
128921
|
const release = beginTerminalInput(session, target2.paneId, { kind: "edit", source: "pane-command", submit: true });
|
|
128825
128922
|
try {
|
|
@@ -129404,11 +129501,11 @@ function getInitialTerminalActiveCommand(command) {
|
|
|
129404
129501
|
}
|
|
129405
129502
|
|
|
129406
129503
|
// backend/src/terminal/runtime/session-id.ts
|
|
129407
|
-
var
|
|
129504
|
+
var import_node_crypto104 = require("node:crypto");
|
|
129408
129505
|
var TERMINAL_SESSION_ID_BYTES = 4;
|
|
129409
129506
|
var MAX_TERMINAL_SESSION_ID_GENERATION_ATTEMPTS = 16;
|
|
129410
129507
|
function createTerminalSessionId() {
|
|
129411
|
-
return (0,
|
|
129508
|
+
return (0, import_node_crypto104.randomBytes)(TERMINAL_SESSION_ID_BYTES).toString("hex");
|
|
129412
129509
|
}
|
|
129413
129510
|
function createUniqueTerminalSessionId(hasSessionId) {
|
|
129414
129511
|
for (let attempt = 0; attempt < MAX_TERMINAL_SESSION_ID_GENERATION_ATTEMPTS; attempt += 1) {
|
|
@@ -129431,7 +129528,7 @@ function isExistingDirectory2(value) {
|
|
|
129431
129528
|
}
|
|
129432
129529
|
|
|
129433
129530
|
// backend/src/terminal/completion/feishu-policy.ts
|
|
129434
|
-
var
|
|
129531
|
+
var import_node_crypto105 = require("node:crypto");
|
|
129435
129532
|
var MIN_DURATION_MS = 6e4;
|
|
129436
129533
|
var GRACE_MS = 3e4;
|
|
129437
129534
|
var INPUT_TTL_MS = 12e4;
|
|
@@ -129460,7 +129557,7 @@ var TerminalFeishuPolicy = class {
|
|
|
129460
129557
|
if (!feishuReply || previous.feishuReply) return;
|
|
129461
129558
|
previous.feishuReply = true;
|
|
129462
129559
|
} else {
|
|
129463
|
-
state.turns[key2] = { id: (0,
|
|
129560
|
+
state.turns[key2] = { id: (0, import_node_crypto105.randomUUID)(), startEventId, threadId, source: source2, startedAt: Date.now(), completed: false, feishuReply };
|
|
129464
129561
|
}
|
|
129465
129562
|
await this.save(id7, state);
|
|
129466
129563
|
}
|
|
@@ -129547,7 +129644,7 @@ var TerminalFeishuPolicy = class {
|
|
|
129547
129644
|
async attention(id7, panelId) {
|
|
129548
129645
|
const state = this.state(id7);
|
|
129549
129646
|
if (!state) return null;
|
|
129550
|
-
const notificationId = (0,
|
|
129647
|
+
const notificationId = (0, import_node_crypto105.randomUUID)();
|
|
129551
129648
|
state.completions[notificationId] = {
|
|
129552
129649
|
panelId,
|
|
129553
129650
|
turnId: null,
|
|
@@ -129586,7 +129683,7 @@ var TerminalFeishuPolicy = class {
|
|
|
129586
129683
|
}
|
|
129587
129684
|
};
|
|
129588
129685
|
function hashPrompt2(text5) {
|
|
129589
|
-
return (0,
|
|
129686
|
+
return (0, import_node_crypto105.createHash)("sha256").update(text5.replace(/\r\n/g, "\n").trim().slice(0, 8e3)).digest("hex");
|
|
129590
129687
|
}
|
|
129591
129688
|
|
|
129592
129689
|
// backend/src/terminal/workspace-service/worktree-project-registry.ts
|
|
@@ -131243,7 +131340,7 @@ var import_node_fs50 = require("node:fs");
|
|
|
131243
131340
|
var import_node_util19 = require("node:util");
|
|
131244
131341
|
var import_promises74 = require("node:fs/promises");
|
|
131245
131342
|
var import_node_path122 = __toESM(require("node:path"), 1);
|
|
131246
|
-
var
|
|
131343
|
+
var import_node_crypto106 = require("node:crypto");
|
|
131247
131344
|
|
|
131248
131345
|
// packages/shared/src/terminal/workspace-service.ts
|
|
131249
131346
|
var WORKSPACE_SERVICE_CONFIG_FILE_NAME = "runweave.json";
|
|
@@ -131399,7 +131496,7 @@ var WorkspaceServiceConfigLoader = class {
|
|
|
131399
131496
|
return {
|
|
131400
131497
|
config: {
|
|
131401
131498
|
status: "valid",
|
|
131402
|
-
revision: (0,
|
|
131499
|
+
revision: (0, import_node_crypto106.createHash)("sha256").update(content).digest("hex"),
|
|
131403
131500
|
error: null
|
|
131404
131501
|
},
|
|
131405
131502
|
definitions
|
|
@@ -131493,7 +131590,7 @@ async function waitForWorkspaceServiceReady(input2) {
|
|
|
131493
131590
|
}
|
|
131494
131591
|
|
|
131495
131592
|
// backend/src/terminal/workspace-service/identity.ts
|
|
131496
|
-
var
|
|
131593
|
+
var import_node_crypto107 = require("node:crypto");
|
|
131497
131594
|
var WORKSPACE_SERVICE_HASH_LENGTH = 12;
|
|
131498
131595
|
var HOST_LABEL_MAX_LENGTH = 63;
|
|
131499
131596
|
function slugify(value, fallback) {
|
|
@@ -131504,7 +131601,7 @@ function buildWorkspaceServiceIdentity(input2) {
|
|
|
131504
131601
|
const key2 = [input2.parentProjectId, input2.projectId, input2.serviceName].join(
|
|
131505
131602
|
"\0"
|
|
131506
131603
|
);
|
|
131507
|
-
const hash7 = (0,
|
|
131604
|
+
const hash7 = (0, import_node_crypto107.createHash)("sha256").update(key2).digest("hex").slice(0, WORKSPACE_SERVICE_HASH_LENGTH);
|
|
131508
131605
|
const readable = [
|
|
131509
131606
|
slugify(input2.serviceName, "service"),
|
|
131510
131607
|
slugify(input2.contextName, "workspace"),
|
|
@@ -132399,7 +132496,7 @@ var TerminalCompletionEventService = class {
|
|
|
132399
132496
|
};
|
|
132400
132497
|
|
|
132401
132498
|
// backend/src/terminal/state/terminal-event-service.ts
|
|
132402
|
-
var
|
|
132499
|
+
var import_node_crypto108 = require("node:crypto");
|
|
132403
132500
|
var MAX_TERMINAL_EVENTS = 500;
|
|
132404
132501
|
var terminalEventServiceLogger = logger.child({
|
|
132405
132502
|
component: "terminal-event-service"
|
|
@@ -132407,7 +132504,7 @@ var terminalEventServiceLogger = logger.child({
|
|
|
132407
132504
|
var TerminalEventService = class {
|
|
132408
132505
|
events = [];
|
|
132409
132506
|
nextId = 1;
|
|
132410
|
-
streamId = (0,
|
|
132507
|
+
streamId = (0, import_node_crypto108.randomUUID)();
|
|
132411
132508
|
listeners = /* @__PURE__ */ new Set();
|
|
132412
132509
|
record(input2) {
|
|
132413
132510
|
const event = {
|
|
@@ -133985,7 +134082,7 @@ var import_promises79 = require("node:fs/promises");
|
|
|
133985
134082
|
var import_node_path127 = __toESM(require("node:path"), 1);
|
|
133986
134083
|
|
|
133987
134084
|
// backend/src/evolution/trace-segmenter.ts
|
|
133988
|
-
var
|
|
134085
|
+
var import_node_crypto109 = require("node:crypto");
|
|
133989
134086
|
function segmentContextPack(manifest) {
|
|
133990
134087
|
const groups = /* @__PURE__ */ new Map();
|
|
133991
134088
|
for (const evidence of manifest.evidence) {
|
|
@@ -134035,7 +134132,7 @@ function strongestRelation(evidence) {
|
|
|
134035
134132
|
return { kind: "standalone", id: evidence.sourceRecordId };
|
|
134036
134133
|
}
|
|
134037
134134
|
function stableId(prefix, values) {
|
|
134038
|
-
return `${prefix}_${(0,
|
|
134135
|
+
return `${prefix}_${(0, import_node_crypto109.createHash)("sha256").update(values.join("\n")).digest("hex").slice(0, 24)}`;
|
|
134039
134136
|
}
|
|
134040
134137
|
|
|
134041
134138
|
// backend/src/evolution/providers/trae.ts
|
|
@@ -134117,7 +134214,7 @@ function selectEvolutionProviders(params) {
|
|
|
134117
134214
|
}
|
|
134118
134215
|
|
|
134119
134216
|
// backend/src/evolution/analysis/episode-builder.ts
|
|
134120
|
-
var
|
|
134217
|
+
var import_node_crypto110 = require("node:crypto");
|
|
134121
134218
|
function buildEpisodes(manifest, segments) {
|
|
134122
134219
|
const evidenceById = new Map(
|
|
134123
134220
|
manifest.evidence.map((evidence) => [evidence.evidenceId, evidence])
|
|
@@ -134216,11 +134313,11 @@ function evidenceRole(evidence) {
|
|
|
134216
134313
|
return "fact";
|
|
134217
134314
|
}
|
|
134218
134315
|
function stableId2(prefix, values) {
|
|
134219
|
-
return `${prefix}_${(0,
|
|
134316
|
+
return `${prefix}_${(0, import_node_crypto110.createHash)("sha256").update(values.join("\n")).digest("hex").slice(0, 24)}`;
|
|
134220
134317
|
}
|
|
134221
134318
|
|
|
134222
134319
|
// backend/src/evolution/analysis/claim-ledger.ts
|
|
134223
|
-
var
|
|
134320
|
+
var import_node_crypto111 = require("node:crypto");
|
|
134224
134321
|
function buildClaimLedger(params) {
|
|
134225
134322
|
const crossByTopic = new Map(
|
|
134226
134323
|
(params.crossQuestion?.reviews ?? []).map((review) => [
|
|
@@ -134294,7 +134391,7 @@ function unique(values) {
|
|
|
134294
134391
|
return [...new Set(values)].sort();
|
|
134295
134392
|
}
|
|
134296
134393
|
function stableId3(prefix, values) {
|
|
134297
|
-
return `${prefix}_${(0,
|
|
134394
|
+
return `${prefix}_${(0, import_node_crypto111.createHash)("sha256").update(values.join("\n")).digest("hex").slice(0, 24)}`;
|
|
134298
134395
|
}
|
|
134299
134396
|
|
|
134300
134397
|
// backend/src/evolution/analysis/novelty-gate.ts
|
|
@@ -134612,13 +134709,13 @@ function buildCrossQuestionPrompt(params) {
|
|
|
134612
134709
|
}
|
|
134613
134710
|
|
|
134614
134711
|
// backend/src/evolution/knowledge/insight-service.ts
|
|
134615
|
-
var
|
|
134712
|
+
var import_node_crypto113 = require("node:crypto");
|
|
134616
134713
|
|
|
134617
134714
|
// backend/src/evolution/knowledge/candidate-factory.ts
|
|
134618
|
-
var
|
|
134715
|
+
var import_node_crypto112 = require("node:crypto");
|
|
134619
134716
|
var GENERATOR_VERSION = "candidate-factory-v1";
|
|
134620
134717
|
function stableId4(prefix, values) {
|
|
134621
|
-
return `${prefix}_${(0,
|
|
134718
|
+
return `${prefix}_${(0, import_node_crypto112.createHash)("sha256").update(values.join("\n")).digest("hex").slice(0, 20)}`;
|
|
134622
134719
|
}
|
|
134623
134720
|
function createCandidateAsset(input2, now2 = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
134624
134721
|
if (input2.evidenceRefs.length === 0) {
|
|
@@ -134790,11 +134887,11 @@ function edge(revision2, evidenceId, relation) {
|
|
|
134790
134887
|
};
|
|
134791
134888
|
}
|
|
134792
134889
|
function stableId5(prefix, values) {
|
|
134793
|
-
return `${prefix}_${(0,
|
|
134890
|
+
return `${prefix}_${(0, import_node_crypto113.createHash)("sha256").update(values.join("\n")).digest("hex").slice(0, 24)}`;
|
|
134794
134891
|
}
|
|
134795
134892
|
|
|
134796
134893
|
// backend/src/evolution/analysis/orchestrator-helpers.ts
|
|
134797
|
-
var
|
|
134894
|
+
var import_node_crypto114 = require("node:crypto");
|
|
134798
134895
|
var import_promises78 = require("node:fs/promises");
|
|
134799
134896
|
var import_node_path126 = __toESM(require("node:path"), 1);
|
|
134800
134897
|
var ANALYSIS_TOOLS = [
|
|
@@ -134924,7 +135021,7 @@ function providerErrorCode(error2) {
|
|
|
134924
135021
|
return "provider_failed";
|
|
134925
135022
|
}
|
|
134926
135023
|
function stableId6(prefix, values) {
|
|
134927
|
-
return `${prefix}_${(0,
|
|
135024
|
+
return `${prefix}_${(0, import_node_crypto114.createHash)("sha256").update(values.join("\n")).digest("hex").slice(0, 24)}`;
|
|
134928
135025
|
}
|
|
134929
135026
|
|
|
134930
135027
|
// backend/src/evolution/analysis/orchestrator.ts
|
|
@@ -135592,7 +135689,7 @@ function unavailableContentIssues(evidence) {
|
|
|
135592
135689
|
}
|
|
135593
135690
|
|
|
135594
135691
|
// backend/src/evolution/knowledge/evidence-reconciler.ts
|
|
135595
|
-
var
|
|
135692
|
+
var import_node_crypto115 = require("node:crypto");
|
|
135596
135693
|
var ACTIVITY_EVIDENCE_PREFIX = "activity:";
|
|
135597
135694
|
var AVAILABILITY_BATCH_SIZE = 1e3;
|
|
135598
135695
|
var EvolutionEvidenceReconciler = class {
|
|
@@ -135728,11 +135825,11 @@ function reconciledRevision(current, edges, createdAt) {
|
|
|
135728
135825
|
};
|
|
135729
135826
|
}
|
|
135730
135827
|
function stableId7(prefix, values) {
|
|
135731
|
-
return `${prefix}_${(0,
|
|
135828
|
+
return `${prefix}_${(0, import_node_crypto115.createHash)("sha256").update(values.join("\n")).digest("hex").slice(0, 24)}`;
|
|
135732
135829
|
}
|
|
135733
135830
|
|
|
135734
135831
|
// backend/src/evolution/runtime.ts
|
|
135735
|
-
var
|
|
135832
|
+
var import_node_crypto116 = __toESM(require("node:crypto"), 1);
|
|
135736
135833
|
var RECOVERY_INTERVAL_MS = 5e3;
|
|
135737
135834
|
var LEASE_TTL_MS = 45e3;
|
|
135738
135835
|
var HEARTBEAT_INTERVAL_MS = 1e4;
|
|
@@ -135759,7 +135856,7 @@ var EvolutionRuntime = class {
|
|
|
135759
135856
|
lastMaintenanceFailedAt = null;
|
|
135760
135857
|
lastLeaseHeartbeatAt = null;
|
|
135761
135858
|
consecutiveMaintenanceFailures = 0;
|
|
135762
|
-
ownerId = `evolution-runtime:${process.pid}:${
|
|
135859
|
+
ownerId = `evolution-runtime:${process.pid}:${import_node_crypto116.default.randomUUID()}`;
|
|
135763
135860
|
start(controlPlaneBaseUrl) {
|
|
135764
135861
|
if (!this.store || this.recoveryTimer || this.stopping) return;
|
|
135765
135862
|
this.controlPlaneBaseUrl = controlPlaneBaseUrl;
|
|
@@ -136093,7 +136190,7 @@ function withinRoot(root, candidate) {
|
|
|
136093
136190
|
var import_promises82 = require("node:fs/promises");
|
|
136094
136191
|
|
|
136095
136192
|
// backend/src/utils/json-file.ts
|
|
136096
|
-
var
|
|
136193
|
+
var import_node_crypto117 = require("node:crypto");
|
|
136097
136194
|
var import_promises81 = require("node:fs/promises");
|
|
136098
136195
|
var import_node_path129 = __toESM(require("node:path"), 1);
|
|
136099
136196
|
async function readJsonFile2(filePath) {
|
|
@@ -136105,7 +136202,7 @@ async function readJsonFile2(filePath) {
|
|
|
136105
136202
|
}
|
|
136106
136203
|
async function writeJsonFile(filePath, value) {
|
|
136107
136204
|
await (0, import_promises81.mkdir)(import_node_path129.default.dirname(filePath), { recursive: true });
|
|
136108
|
-
const temporaryPath = `${filePath}.${process.pid}.${(0,
|
|
136205
|
+
const temporaryPath = `${filePath}.${process.pid}.${(0, import_node_crypto117.randomUUID)()}.tmp`;
|
|
136109
136206
|
try {
|
|
136110
136207
|
await (0, import_promises81.writeFile)(temporaryPath, `${JSON.stringify(value, null, 2)}
|
|
136111
136208
|
`, {
|
|
@@ -136681,7 +136778,7 @@ var BackendRuntimeStatusService = class {
|
|
|
136681
136778
|
var import_node_path135 = __toESM(require("node:path"), 1);
|
|
136682
136779
|
|
|
136683
136780
|
// backend/src/scheduled-tasks/migration.ts
|
|
136684
|
-
var
|
|
136781
|
+
var import_node_crypto119 = require("node:crypto");
|
|
136685
136782
|
var import_node_child_process39 = require("node:child_process");
|
|
136686
136783
|
var import_node_fs51 = require("node:fs");
|
|
136687
136784
|
var import_node_path131 = __toESM(require("node:path"), 1);
|
|
@@ -136716,7 +136813,7 @@ try {
|
|
|
136716
136813
|
}
|
|
136717
136814
|
|
|
136718
136815
|
// backend/src/scheduled-tasks/storage/migrations.ts
|
|
136719
|
-
var
|
|
136816
|
+
var import_node_crypto118 = require("node:crypto");
|
|
136720
136817
|
var import_better_sqlite33 = __toESM(require("better-sqlite3"), 1);
|
|
136721
136818
|
|
|
136722
136819
|
// backend/src/scheduled-tasks/storage/migrations/001-initial-schema.ts
|
|
@@ -136907,13 +137004,13 @@ function parseScheduledResult(text5) {
|
|
|
136907
137004
|
throw new Error("provider_result_invalid");
|
|
136908
137005
|
}
|
|
136909
137006
|
}
|
|
136910
|
-
function scheduledPrompt(prompt, runId) {
|
|
137007
|
+
function scheduledPrompt(prompt, runId, terminal = false) {
|
|
136911
137008
|
return `${prompt}
|
|
136912
137009
|
|
|
136913
137010
|
<scheduled_run_context>
|
|
136914
|
-
\u8FD9\u662F\u540E\u53F0\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u8FD0\u884C ID\uFF1A${runId}\u3002\u6CA1\u6709\u4EA4\u4E92\u5F0F Runweave \u7EC8\u7AEF\u8EAB\u4EFD\uFF0C\u4E0D\u5F97\u501F\u7528\u5176\u4ED6\u7EC8\u7AEF\u7684 Runweave \u6807\u8BC6\u6216\u4F2A\u9020 terminalSessionId\uFF1B\u8FD9\u4E0D\u9650\u5236\u5E38\u89C4\u5DE5\u5177\u4F7F\u7528\u5F53\u524D\u7CFB\u7EDF\u8D26\u53F7\u5DF2\u6709\u7684\u5408\u6CD5\u51ED\u8BC1\u3002\u9700\u8981\u8C03\u7528 Runweave CLI \u65F6\uFF0C\u82E5 RUNWEAVE_CLI_BIN \u5DF2\u8BBE\u7F6E\uFF0C\u5FC5\u987B\u4F7F\u7528 "$RUNWEAVE_CLI_BIN"\uFF1B\u767B\u5F55 shell \u4E2D PATH \u91CC\u7684 rw \u53EF\u80FD\u5C5E\u4E8E\u5176\u4ED6\u8FD0\u884C\u5B9E\u4F8B\u3002
|
|
137011
|
+
\u8FD9\u662F\u540E\u53F0\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u8FD0\u884C ID\uFF1A${runId}\u3002${terminal ? "\u8FD9\u662F\u5728\u4E13\u7528 Runweave \u7EC8\u7AEF\u4E2D\u6267\u884C\u7684\u4EFB\u52A1\uFF0C\u4F7F\u7528\u5F53\u524D\u7EC8\u7AEF\u7684\u771F\u5B9E\u8EAB\u4EFD\uFF0C\u4E0D\u5F97\u501F\u7528\u5176\u4ED6\u7EC8\u7AEF\u7684\u6807\u8BC6\u3002\u672C\u8F6E\u8FD4\u56DE\u6700\u7EC8\u7ED3\u679C\u540E\u7531\u8C03\u5EA6\u5668\u5173\u95ED\u7EC8\u7AEF\uFF0C\u4E0D\u8981\u81EA\u884C\u5173\u95ED\u7EC8\u7AEF\u3002" : "\u6CA1\u6709\u4EA4\u4E92\u5F0F Runweave \u7EC8\u7AEF\u8EAB\u4EFD\uFF0C\u4E0D\u5F97\u501F\u7528\u5176\u4ED6\u7EC8\u7AEF\u7684 Runweave \u6807\u8BC6\u6216\u4F2A\u9020 terminalSessionId\uFF1B\u8FD9\u4E0D\u9650\u5236\u5E38\u89C4\u5DE5\u5177\u4F7F\u7528\u5F53\u524D\u7CFB\u7EDF\u8D26\u53F7\u5DF2\u6709\u7684\u5408\u6CD5\u51ED\u8BC1\u3002"}\u9700\u8981\u8C03\u7528 Runweave CLI \u65F6\uFF0C\u82E5 RUNWEAVE_CLI_BIN \u5DF2\u8BBE\u7F6E\uFF0C\u5FC5\u987B\u4F7F\u7528 "$RUNWEAVE_CLI_BIN"\uFF1B\u767B\u5F55 shell \u4E2D PATH \u91CC\u7684 rw \u53EF\u80FD\u5C5E\u4E8E\u5176\u4ED6\u8FD0\u884C\u5B9E\u4F8B\u3002
|
|
136915
137012
|
Runweave \u53F3\u4FA7\u6D4F\u89C8\u5668\u4F7F\u7528 toolkit:playwright-cli\uFF0C\u4E0D\u662F Computer Use \u7684 iab\u3002\u9700\u8981\u6D4F\u89C8\u5668\u65F6\u5148\u8FD0\u884C rw browser profile resolve --json\uFF0C\u518D\u9644\u7740\u8FD4\u56DE\u7684 cdpEndpoint\uFF1B\u4E0D\u5F97\u76F4\u63A5\u628A\u7A7A\u5206\u7EC4\u9519\u8BEF\u89E3\u91CA\u4E3A\u6D4F\u89C8\u5668\u4E0D\u53EF\u7528\uFF0C\u4E5F\u4E0D\u8981\u56E0\u6B64\u6539\u7528\u72EC\u7ACB Chrome\u3002\u82E5\u9700\u7528\u6237\u767B\u5F55\u6216\u64CD\u4F5C\u9875\u9762\uFF0C\u8C03\u7528 rw browser assist request --browser-profile <1|2|3> --group-id <\u89E3\u6790\u8FD4\u56DE\u7684\u5206\u7EC4> --target-id <\u771F\u5B9E\u9875\u9762 targetId> --reason <\u5177\u4F53\u64CD\u4F5C> --json\uFF1B\u540E\u53F0\u6A21\u5F0F\u4F1A\u8FD4\u56DE\u5F85\u63D0\u4EA4\u7684 blocked \u7ED3\u679C\uFF0C\u987B\u4F5C\u4E3A\u672C\u8F6E\u6700\u7EC8 JSON \u8FD4\u56DE\u540E\u505C\u6B62\u64CD\u4F5C\u9875\u9762\uFF0C\u8BA9\u7528\u6237\u4ECE\u8FD0\u884C\u8BB0\u5F55\u63A5\u7BA1\u539F\u4F1A\u8BDD\u3002\u6CA1\u6709\u6D4F\u89C8\u5668\u534F\u52A9\u65F6 recovery.browser \u4E3A null\u3002
|
|
136916
|
-
\u8BF7\u6267\u884C\u4EFB\u52A1\uFF0C\u5E76\u901A\u8FC7\u6307\u5B9A JSON schema \u8FD4\u56DE\u6700\u7EC8\u7ED3\u679C\
|
|
137013
|
+
\u8BF7\u6267\u884C\u4EFB\u52A1\uFF0C\u5E76${terminal ? `\u6700\u7EC8\u56DE\u590D\u5FC5\u987B\u662F\u5355\u4E2A JSON \u5BF9\u8C61\uFF0C\u4E0D\u4F7F\u7528 Markdown \u4EE3\u7801\u5757\uFF0C\u7B26\u5408\u4EE5\u4E0B schema\uFF1A${JSON.stringify(scheduledResultSchema)}\u3002` : "\u901A\u8FC7\u6307\u5B9A JSON schema \u8FD4\u56DE\u6700\u7EC8\u7ED3\u679C\u3002"}outcome \u4EC5\u5728\u7528\u6237\u8981\u6C42\u7684\u5DE5\u4F5C\u548C\u5FC5\u8981\u9A8C\u8BC1\u5B9E\u9645\u5B8C\u6210\u65F6\u4E3A succeeded\uFF1B\u6743\u9650\u3001\u7F51\u7EDC\u3001\u8BA4\u8BC1\u3001\u5BA1\u6279\u62D2\u7EDD\u6216\u7F3A\u5C11\u5FC5\u8981\u8F93\u5165\u5BFC\u81F4\u4E0D\u80FD\u7EE7\u7EED\u65F6\u4E3A blocked\uFF1B\u6267\u884C\u5931\u8D25\u4E3A failed\u3002summary \u7528\u4E2D\u6587 Markdown \u8BF4\u660E\u5B9E\u9645\u6210\u679C\u548C\u8BC1\u636E\uFF0Creason \u8BF4\u660E\u963B\u585E\u6216\u5931\u8D25\u7684\u5177\u4F53\u539F\u56E0\u4E0E\u4E0B\u4E00\u6B65\uFF08\u6210\u529F\u65F6\u4E3A\u7A7A\uFF09\u3002\u8FDB\u7A0B\u6B63\u5E38\u9000\u51FA\u3001\u8BFB\u5B8C\u6280\u80FD\u6216\u751F\u6210\u8BA1\u5212\u5747\u4E0D\u7B49\u4E8E\u4EFB\u52A1\u6210\u529F\u3002\u672A\u5B8C\u6210\u65F6\u5FC5\u987B\u63D0\u4F9B recovery \u5EFA\u8BAE\uFF1A\u539F\u6388\u6743\u5185\u4ECD\u6709\u5177\u4F53\u4E0B\u4E00\u6B65\u7528 continue/remaining-work\uFF1B\u6709\u8BC1\u636E\u7684\u4E34\u65F6\u670D\u52A1\u6545\u969C\u7528 wait/transient\uFF1B\u7B49\u5F85 CI \u6216\u53EF\u9A8C\u8BC1\u7684\u5916\u90E8\u6761\u4EF6\u7528 wait/external-wait\uFF1B\u7F3A\u5C11\u7528\u6237\u8F93\u5165\u7528 needs-input/input\uFF0C\u6743\u9650\u6216\u5BA1\u6279\u62D2\u7EDD\u7528 needs-input/permission\uFF1B\u672A\u77E5\u7ED3\u679C\u6216\u4E0D\u53EF\u6062\u590D\u7528 stop/unknown\u3002evidence \u5199\u4E8B\u5B9E\u4F9D\u636E\uFF0CnextStep \u5199\u6838\u5BF9\u6761\u4EF6\u53CA\u5269\u4F59\u5DE5\u4F5C\uFF0CnotBefore \u4EC5\u5728\u6709\u660E\u786E\u6700\u65E9\u6062\u590D\u65F6\u95F4\u65F6\u5199 UTC ISO \u65F6\u95F4\uFF0C\u5426\u5219\u4E3A null\u3002\u82E5\u53EA\u5DEE\u7528\u6237\u660E\u786E\u540C\u610F\uFF0C\u5728 confirmation \u4E2D\u5199\u6E05\u70B9\u51FB\u5141\u8BB8\u5C06\u786E\u8BA4\u7684\u5177\u4F53\u52A8\u4F5C\u3001\u8303\u56F4\u53CA\u5FC5\u8981\u6761\u4EF6\uFF1B\u4E0D\u8981\u53EA\u5199\u201C\u7EE7\u7EED\u201D\uFF0C\u4E5F\u4E0D\u8981\u628A\u5F00\u653E\u6027\u95EE\u9898\u4F2A\u88C5\u6210\u6388\u6743\uFF0C\u5176\u4ED6\u60C5\u51B5 confirmation \u4E3A null\u3002\u7528\u6237\u5DF2\u660E\u786E\u56DE\u7B54\u7684\u95EE\u9898\u65E0\u9700\u91CD\u590D\u8BE2\u95EE\uFF1B\u4EC5\u6709\u8FDB\u7A0B\u5B58\u5728\u4E0D\u80FD\u8BC1\u660E\u4ECD\u6709\u5E76\u53D1\u5199\u5165\uFF0C\u5E94\u5148\u6838\u5BF9\u5B9E\u9645\u53D8\u5316\u3002\u6210\u529F\u65F6 recovery \u4E3A null\u3002\u7EE7\u7EED\u5EFA\u8BAE\u4E0D\u4EE3\u8868\u6269\u5C55\u6388\u6743\uFF0C\u8303\u56F4\u4E0D\u660E\u6216\u5E76\u53D1\u5199\u5165\u5F52\u5C5E\u4E0D\u660E\u4E0D\u80FD\u53EA\u9760\u7B49\u5F85\u81EA\u52A8\u89E3\u51B3\u3002\u7F51\u7EDC\u6216\u8BA4\u8BC1\u68C0\u67E5\u8D85\u65F6\u4E0D\u7B49\u4E8E\u51ED\u8BC1\u5931\u6548\u6216\u6743\u9650\u62D2\u7EDD\uFF1B\u5148\u6309\u6240\u7528\u6280\u80FD\u533A\u5206\u7F51\u7EDC\u8FDE\u901A\u3001\u51ED\u8BC1\u8BFB\u53D6\u4E0E\u5B9E\u9645\u8BA4\u8BC1\u7ED3\u679C\uFF0C\u5E76\u5728\u83B7\u51C6\u8DEF\u7EBF\u5185\u6709\u754C\u6062\u590D\uFF0C\u539F\u56E0\u5FC5\u987B\u6709\u8BC1\u636E\u3002\u4E0D\u8981\u7ED5\u8FC7\u6743\u9650\u9650\u5236\uFF1B\u5BA1\u6279\u6216\u6743\u9650\u62D2\u7EDD\u540E\u5982\u65E0\u83B7\u51C6\u7684\u66FF\u4EE3\u8DEF\u5F84\uFF0C\u5E94\u8FD4\u56DE blocked\u3002
|
|
136917
137014
|
</scheduled_run_context>`;
|
|
136918
137015
|
}
|
|
136919
137016
|
|
|
@@ -137376,7 +137473,7 @@ function migrateScheduledTasks(database, reviewedPrompts) {
|
|
|
137376
137473
|
}).immediate();
|
|
137377
137474
|
}
|
|
137378
137475
|
function checksum(sql) {
|
|
137379
|
-
return (0,
|
|
137476
|
+
return (0, import_node_crypto118.createHash)("sha256").update(sql).digest("hex");
|
|
137380
137477
|
}
|
|
137381
137478
|
function assertLegacySchema(database) {
|
|
137382
137479
|
const tables2 = database.prepare(
|
|
@@ -137490,12 +137587,12 @@ var ScheduledTaskMigration = class {
|
|
|
137490
137587
|
database.pragma("busy_timeout = 5000");
|
|
137491
137588
|
const preview = database.transaction(() => this.readPreview(database))();
|
|
137492
137589
|
this.assertApplicable(database, preview, input2);
|
|
137493
|
-
const backupPath = import_node_path131.default.join(import_node_path131.default.dirname(this.databasePath), "migration-backups", `${(0,
|
|
137590
|
+
const backupPath = import_node_path131.default.join(import_node_path131.default.dirname(this.databasePath), "migration-backups", `${(0, import_node_crypto119.randomUUID)()}.sqlite`);
|
|
137494
137591
|
(0, import_node_fs51.mkdirSync)(import_node_path131.default.dirname(backupPath), { recursive: true, mode: 448 });
|
|
137495
137592
|
await database.backup(backupPath);
|
|
137496
137593
|
(0, import_node_fs51.chmodSync)(backupPath, 384);
|
|
137497
137594
|
const receipt = {
|
|
137498
|
-
migrationId: (0,
|
|
137595
|
+
migrationId: (0, import_node_crypto119.randomUUID)(),
|
|
137499
137596
|
sourceVersion: preview.schemaVersion,
|
|
137500
137597
|
targetVersion: SCHEDULED_TASK_SCHEMA_VERSION,
|
|
137501
137598
|
changedTaskIds: preview.tasks.map((task) => task.id),
|
|
@@ -137596,7 +137693,7 @@ var ScheduledTaskMigration = class {
|
|
|
137596
137693
|
}
|
|
137597
137694
|
};
|
|
137598
137695
|
function digest7(value) {
|
|
137599
|
-
return (0,
|
|
137696
|
+
return (0, import_node_crypto119.createHash)("sha256").update(JSON.stringify(value)).digest("hex");
|
|
137600
137697
|
}
|
|
137601
137698
|
function failure2(code, message2) {
|
|
137602
137699
|
return new ScheduledTaskError(code, 409, message2);
|
|
@@ -138239,12 +138336,12 @@ function continuationPrompt2(run2) {
|
|
|
138239
138336
|
}
|
|
138240
138337
|
|
|
138241
138338
|
// backend/src/scheduled-tasks/runtime.ts
|
|
138242
|
-
var
|
|
138339
|
+
var import_node_crypto121 = require("node:crypto");
|
|
138243
138340
|
|
|
138244
138341
|
// backend/src/scheduled-tasks/run-record.ts
|
|
138245
|
-
var
|
|
138342
|
+
var import_node_crypto120 = require("node:crypto");
|
|
138246
138343
|
function createScheduledRunRecord(task, trigger, scheduledFor, context) {
|
|
138247
|
-
const id7 = (0,
|
|
138344
|
+
const id7 = (0, import_node_crypto120.randomUUID)();
|
|
138248
138345
|
return {
|
|
138249
138346
|
id: id7,
|
|
138250
138347
|
revision: 1,
|
|
@@ -138286,14 +138383,15 @@ function createScheduledRunRecord(task, trigger, scheduledFor, context) {
|
|
|
138286
138383
|
var TICK_MS = 5e3;
|
|
138287
138384
|
var LATE_WINDOW_MS = 6e4;
|
|
138288
138385
|
var ScheduledTaskRuntime = class {
|
|
138289
|
-
constructor(store, terminalSessionManager, providers, enabled, limits) {
|
|
138386
|
+
constructor(store, terminalSessionManager, providers, enabled, limits, terminalProvider) {
|
|
138290
138387
|
this.store = store;
|
|
138291
138388
|
this.terminalSessionManager = terminalSessionManager;
|
|
138292
138389
|
this.providers = providers;
|
|
138293
138390
|
this.enabled = enabled;
|
|
138294
138391
|
this.limits = limits;
|
|
138392
|
+
this.terminalProvider = terminalProvider;
|
|
138295
138393
|
}
|
|
138296
|
-
ownerId = `scheduled:${process.pid}:${(0,
|
|
138394
|
+
ownerId = `scheduled:${process.pid}:${(0, import_node_crypto121.randomUUID)()}`;
|
|
138297
138395
|
active = /* @__PURE__ */ new Map();
|
|
138298
138396
|
executions = /* @__PURE__ */ new Map();
|
|
138299
138397
|
timer = null;
|
|
@@ -138468,8 +138566,9 @@ var ScheduledTaskRuntime = class {
|
|
|
138468
138566
|
const executionStarted = Date.now();
|
|
138469
138567
|
try {
|
|
138470
138568
|
const cwd = await validateExecutionContext(initial, this.terminalSessionManager, !initial.threadRef);
|
|
138471
|
-
|
|
138569
|
+
let provider3 = this.providers.get(initial.snapshot.provider);
|
|
138472
138570
|
if (!provider3) throw new Error("provider_unavailable");
|
|
138571
|
+
if (initial.snapshot.provider === "codex" && initial.snapshot.executionPolicy === "full-access" && !initial.snapshot.origin && this.terminalProvider) provider3 = this.terminalProvider;
|
|
138473
138572
|
const budget = initial.executionBudget ?? this.limits;
|
|
138474
138573
|
const remainingMs = budget.timeoutMs - (initial.continuation?.activeMs ?? 0);
|
|
138475
138574
|
const remainingBytes = budget.maxOutputBytes - Number(initial.outputCursor ?? 0);
|
|
@@ -138480,6 +138579,8 @@ var ScheduledTaskRuntime = class {
|
|
|
138480
138579
|
const previous = !resuming && initial.trigger === "scheduled" && !initial.snapshot.origin && initial.snapshot.schedule.kind !== "once" ? await this.store.previousFinishedRun(initial.id) : null;
|
|
138481
138580
|
const result = await provider3.run({
|
|
138482
138581
|
runId: initial.id,
|
|
138582
|
+
source: { type: "scheduled-task", taskId: initial.taskId, runId: initial.id },
|
|
138583
|
+
name: initial.snapshot.name,
|
|
138483
138584
|
projectId: initial.executionContext.kind === "project" ? initial.executionContext.projectId : void 0,
|
|
138484
138585
|
prompt: resuming ? continuationPrompt2(initial) : previousBlockerPrompt(initial, previous),
|
|
138485
138586
|
...resuming ? { resumeThreadId: initial.threadRef.threadId } : {},
|
|
@@ -138496,6 +138597,9 @@ var ScheduledTaskRuntime = class {
|
|
|
138496
138597
|
onOutput: (text5) => this.store.appendOutput(initial.id, text5, budget.maxOutputBytes),
|
|
138497
138598
|
onThread: async (threadId) => {
|
|
138498
138599
|
await this.store.setRunThread(initial.id, this.ownerId, threadId);
|
|
138600
|
+
},
|
|
138601
|
+
onTerminalRetained: async (binding) => {
|
|
138602
|
+
await this.store.putBinding(initial.id, binding);
|
|
138499
138603
|
}
|
|
138500
138604
|
});
|
|
138501
138605
|
if (resuming && result.threadId !== initial.threadRef.threadId)
|
|
@@ -138513,6 +138617,15 @@ var ScheduledTaskRuntime = class {
|
|
|
138513
138617
|
}
|
|
138514
138618
|
});
|
|
138515
138619
|
} catch (error2) {
|
|
138620
|
+
if (error2 instanceof Error && error2.message === "provider_stop_unconfirmed") {
|
|
138621
|
+
await this.store.requestRunStop(initial.id, (/* @__PURE__ */ new Date()).toISOString());
|
|
138622
|
+
logger.warn("scheduled-tasks.execution.stop-unconfirmed", {
|
|
138623
|
+
component: "scheduled-tasks",
|
|
138624
|
+
runId: initial.id,
|
|
138625
|
+
error: error2
|
|
138626
|
+
});
|
|
138627
|
+
return;
|
|
138628
|
+
}
|
|
138516
138629
|
const code = controller.signal.aborted ? "cancelled" : error2 instanceof Error ? "code" in error2 ? String(error2.code) : error2.message : "provider_failed";
|
|
138517
138630
|
await this.store.finishExecution(initial.id, this.ownerId, {
|
|
138518
138631
|
finishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -138544,6 +138657,12 @@ function providerErrorMessage(code) {
|
|
|
138544
138657
|
return "The provider did not return a persistent thread identity";
|
|
138545
138658
|
case "provider_completion_missing":
|
|
138546
138659
|
return "The provider exited without a confirmed completion event";
|
|
138660
|
+
case "provider_terminal_taken_over":
|
|
138661
|
+
return "\u7528\u6237\u5DF2\u63A5\u7BA1\u6267\u884C\u7EC8\u7AEF\uFF0C\u5DF2\u505C\u6B62\u81EA\u52A8\u7BA1\u7406\u5E76\u4FDD\u7559\u7EC8\u7AEF\u3002";
|
|
138662
|
+
case "provider_terminal_changed":
|
|
138663
|
+
return "\u6267\u884C\u7EC8\u7AEF\u6216\u5BF9\u8BDD\u5DF2\u53D8\u5316\uFF0C\u65E0\u6CD5\u786E\u8BA4\u672C\u6B21\u4EFB\u52A1\u7ED3\u679C\u3002";
|
|
138664
|
+
case "provider_history_unavailable":
|
|
138665
|
+
return "\u65E0\u6CD5\u8BFB\u53D6\u6267\u884C\u7EC8\u7AEF\u7684\u539F\u751F\u5BF9\u8BDD\u8BB0\u5F55\uFF0C\u672A\u786E\u8BA4\u4EFB\u52A1\u6210\u529F\u3002";
|
|
138547
138666
|
case "provider_result_invalid":
|
|
138548
138667
|
return "Agent \u672A\u8FD4\u56DE\u6709\u6548\u7684\u4EFB\u52A1\u7ED3\u679C\uFF0C\u65E0\u6CD5\u786E\u8BA4\u6210\u529F\u3002\u8BF7\u67E5\u770B\u8F93\u51FA\u6216\u6253\u5F00\u5BF9\u8BDD\u3002";
|
|
138549
138668
|
case "provider_output_persist_failed":
|
|
@@ -138621,10 +138740,10 @@ function scheduleError(error2) {
|
|
|
138621
138740
|
}
|
|
138622
138741
|
|
|
138623
138742
|
// backend/src/scheduled-tasks/service.ts
|
|
138624
|
-
var
|
|
138743
|
+
var import_node_crypto123 = require("node:crypto");
|
|
138625
138744
|
|
|
138626
138745
|
// backend/src/scheduled-tasks/quick-input-run.ts
|
|
138627
|
-
var
|
|
138746
|
+
var import_node_crypto122 = require("node:crypto");
|
|
138628
138747
|
async function startQuickInputRun(args) {
|
|
138629
138748
|
const {
|
|
138630
138749
|
quickInputId,
|
|
@@ -138633,7 +138752,7 @@ async function startQuickInputRun(args) {
|
|
|
138633
138752
|
idempotencyKey,
|
|
138634
138753
|
store
|
|
138635
138754
|
} = args;
|
|
138636
|
-
const requestHash = (0,
|
|
138755
|
+
const requestHash = (0, import_node_crypto122.createHash)("sha256").update(JSON.stringify({ quickInputId, projectId, expectedInputUpdatedAt })).digest("hex");
|
|
138637
138756
|
try {
|
|
138638
138757
|
const existing = await store.findQuickInputRun(
|
|
138639
138758
|
quickInputId,
|
|
@@ -138725,7 +138844,7 @@ async function startQuickInputRun(args) {
|
|
|
138725
138844
|
);
|
|
138726
138845
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
138727
138846
|
const task = {
|
|
138728
|
-
id: (0,
|
|
138847
|
+
id: (0, import_node_crypto122.randomUUID)(),
|
|
138729
138848
|
revision: 1,
|
|
138730
138849
|
name: input2.title.trim() || "\u521B\u5EFA github pr",
|
|
138731
138850
|
provider: "codex",
|
|
@@ -138808,7 +138927,7 @@ var ScheduledTaskService = class {
|
|
|
138808
138927
|
const { store, nextRunAt, now: now2 } = this.prepareCreate(input2);
|
|
138809
138928
|
const task = {
|
|
138810
138929
|
...normalizeConfig(input2),
|
|
138811
|
-
id: (0,
|
|
138930
|
+
id: (0, import_node_crypto123.randomUUID)(),
|
|
138812
138931
|
revision: 1,
|
|
138813
138932
|
enabled: input2.enabled,
|
|
138814
138933
|
nextRunAt,
|
|
@@ -139192,7 +139311,7 @@ ${task.prompt}`.toLocaleLowerCase().includes(query))
|
|
|
139192
139311
|
}
|
|
139193
139312
|
};
|
|
139194
139313
|
function hash6(value) {
|
|
139195
|
-
return (0,
|
|
139314
|
+
return (0, import_node_crypto123.createHash)("sha256").update(JSON.stringify(value)).digest("hex");
|
|
139196
139315
|
}
|
|
139197
139316
|
|
|
139198
139317
|
// backend/src/scheduled-tasks/storage/store.ts
|
|
@@ -139831,6 +139950,268 @@ function response(projectId, binding) {
|
|
|
139831
139950
|
};
|
|
139832
139951
|
}
|
|
139833
139952
|
|
|
139953
|
+
// backend/src/scheduled-tasks/providers/codex-terminal.ts
|
|
139954
|
+
var import_node_crypto124 = require("node:crypto");
|
|
139955
|
+
var import_promises87 = require("node:timers/promises");
|
|
139956
|
+
|
|
139957
|
+
// backend/src/scheduled-tasks/providers/terminal-processes.ts
|
|
139958
|
+
var import_node_child_process43 = require("node:child_process");
|
|
139959
|
+
var import_promises86 = require("node:timers/promises");
|
|
139960
|
+
var import_node_util23 = require("node:util");
|
|
139961
|
+
var exec8 = (0, import_node_util23.promisify)(import_node_child_process43.execFile);
|
|
139962
|
+
async function processes() {
|
|
139963
|
+
const { stdout } = await exec8("ps", ["-axo", "pid=,ppid=,uid=,lstart="], {
|
|
139964
|
+
timeout: 3e3,
|
|
139965
|
+
maxBuffer: 4 * 1024 * 1024
|
|
139966
|
+
});
|
|
139967
|
+
return stdout.split("\n").flatMap((line) => {
|
|
139968
|
+
const match = line.match(/^\s*(\d+)\s+(\d+)\s+(\d+)\s+(.+?)\s*$/);
|
|
139969
|
+
return match && Number(match[3]) === process.getuid?.() ? [{ pid: Number(match[1]), parent: Number(match[2]), identity: `${match[3]}:${match[4]}` }] : [];
|
|
139970
|
+
});
|
|
139971
|
+
}
|
|
139972
|
+
async function terminalChildren(panePid) {
|
|
139973
|
+
const rows = await processes();
|
|
139974
|
+
if (!rows.some((row) => row.pid === panePid)) throw new Error("provider_stop_unconfirmed");
|
|
139975
|
+
const owned = /* @__PURE__ */ new Set([panePid]);
|
|
139976
|
+
for (let pass = 0; pass < rows.length; pass++) {
|
|
139977
|
+
const before = owned.size;
|
|
139978
|
+
for (const row of rows) if (owned.has(row.parent)) owned.add(row.pid);
|
|
139979
|
+
if (owned.size === before) break;
|
|
139980
|
+
}
|
|
139981
|
+
return rows.filter((row) => row.pid !== panePid && owned.has(row.pid));
|
|
139982
|
+
}
|
|
139983
|
+
async function stopTerminalChildren(children) {
|
|
139984
|
+
const expected = new Map(children.map((child) => [child.pid, child.identity]));
|
|
139985
|
+
const live = async () => (await processes()).filter((row) => expected.get(row.pid) === row.identity);
|
|
139986
|
+
const signal = (rows, value) => {
|
|
139987
|
+
for (const row of rows) {
|
|
139988
|
+
try {
|
|
139989
|
+
process.kill(row.pid, value);
|
|
139990
|
+
} catch (error2) {
|
|
139991
|
+
if (error2.code !== "ESRCH") throw error2;
|
|
139992
|
+
}
|
|
139993
|
+
}
|
|
139994
|
+
};
|
|
139995
|
+
signal(await live(), "SIGTERM");
|
|
139996
|
+
const deadline = Date.now() + 3e3;
|
|
139997
|
+
while (Date.now() < deadline) {
|
|
139998
|
+
if (!(await live()).length) return;
|
|
139999
|
+
await (0, import_promises86.setTimeout)(100);
|
|
140000
|
+
}
|
|
140001
|
+
signal(await live(), "SIGKILL");
|
|
140002
|
+
const forceDeadline = Date.now() + 1e3;
|
|
140003
|
+
while (Date.now() < forceDeadline) {
|
|
140004
|
+
if (!(await live()).length) return;
|
|
140005
|
+
await (0, import_promises86.setTimeout)(100);
|
|
140006
|
+
}
|
|
140007
|
+
throw new Error("provider_stop_unconfirmed");
|
|
140008
|
+
}
|
|
140009
|
+
|
|
140010
|
+
// backend/src/scheduled-tasks/providers/codex-terminal.ts
|
|
140011
|
+
var CodexTerminalScheduledTaskProvider = class {
|
|
140012
|
+
constructor(manager, options, history = new AppServerHistoryGateway()) {
|
|
140013
|
+
this.manager = manager;
|
|
140014
|
+
this.options = options;
|
|
140015
|
+
this.history = history;
|
|
140016
|
+
}
|
|
140017
|
+
provider = "codex";
|
|
140018
|
+
async run(request2) {
|
|
140019
|
+
const signal = AbortSignal.any([request2.signal, AbortSignal.timeout(request2.maxWallTimeMs)]);
|
|
140020
|
+
const checkCancelled = () => {
|
|
140021
|
+
if (signal.aborted) throw new Error(request2.signal.aborted ? "provider_cancelled" : "provider_timeout");
|
|
140022
|
+
};
|
|
140023
|
+
checkCancelled();
|
|
140024
|
+
if (request2.executionPolicy !== "full-access" || !request2.source || !this.options.tmuxService)
|
|
140025
|
+
throw new Error("execution_policy_unavailable");
|
|
140026
|
+
if (request2.resumeThreadId)
|
|
140027
|
+
await checkpointCodexResume(request2.resumeThreadId, request2.workingDirectory);
|
|
140028
|
+
checkCancelled();
|
|
140029
|
+
const session = await createTerminalSession(this.manager, {
|
|
140030
|
+
...request2.projectId ? { projectId: request2.projectId } : {},
|
|
140031
|
+
cwd: request2.workingDirectory,
|
|
140032
|
+
runtimePreference: "tmux"
|
|
140033
|
+
}, { ...this.options, strictDefaultPanel: true, activate: true }, request2.source);
|
|
140034
|
+
let takenOver = false;
|
|
140035
|
+
let unwatch = () => {
|
|
140036
|
+
};
|
|
140037
|
+
let panelId;
|
|
140038
|
+
let operationId;
|
|
140039
|
+
let threadId = "";
|
|
140040
|
+
let result;
|
|
140041
|
+
let failure3;
|
|
140042
|
+
let failed = false;
|
|
140043
|
+
let stopUnconfirmed = false;
|
|
140044
|
+
try {
|
|
140045
|
+
const panel = this.manager.listPanels(session.id)[0];
|
|
140046
|
+
if (!panel || session.runtimeKind !== "tmux") throw new Error("provider_terminal_changed");
|
|
140047
|
+
panelId = panel.id;
|
|
140048
|
+
const target2 = buildPaneTarget(session, this.options.tmuxService, panel);
|
|
140049
|
+
await this.manager.updateSessionAlias(session.id, `\u5B9A\u65F6\u4EFB\u52A1 \xB7 ${request2.name ?? request2.runId}`);
|
|
140050
|
+
unwatch = observeTerminalInput(session, () => {
|
|
140051
|
+
takenOver = true;
|
|
140052
|
+
});
|
|
140053
|
+
const assertOwned = () => {
|
|
140054
|
+
checkCancelled();
|
|
140055
|
+
if (takenOver) throw new Error("provider_terminal_taken_over");
|
|
140056
|
+
if (this.manager.getSession(session.id)?.status !== "running" || this.manager.getPanel(panel.id)?.tmuxPaneId !== panel.tmuxPaneId)
|
|
140057
|
+
throw new Error("provider_terminal_changed");
|
|
140058
|
+
if (operationId && !this.manager.matchesPanelAgentOperationGeneration(session.id, panel.id, operationId, "codex")) {
|
|
140059
|
+
takenOver = true;
|
|
140060
|
+
throw new Error("provider_terminal_changed");
|
|
140061
|
+
}
|
|
140062
|
+
const current = resolveConversationTarget(this.manager, session.id, panel.id).target;
|
|
140063
|
+
if (threadId && current && (current.threadId !== threadId || current.provider !== "codex")) {
|
|
140064
|
+
takenOver = true;
|
|
140065
|
+
throw new Error("provider_thread_mismatch");
|
|
140066
|
+
}
|
|
140067
|
+
};
|
|
140068
|
+
const marker = `RW_SCHEDULED_ATTEMPT_${(0, import_node_crypto124.randomUUID)()}`;
|
|
140069
|
+
const prompt = scheduledPrompt(`${marker}
|
|
140070
|
+
|
|
140071
|
+
${request2.prompt}`, request2.runId, true);
|
|
140072
|
+
const prepared = await prepareTerminalAgent(this.manager, session, this.options, {
|
|
140073
|
+
agent: "codex",
|
|
140074
|
+
command: settingText("agents.codex.binary")?.trim() || "codex",
|
|
140075
|
+
panelId: panel.id,
|
|
140076
|
+
cwd: request2.workingDirectory,
|
|
140077
|
+
prompt,
|
|
140078
|
+
...request2.resumeThreadId ? { resumeThreadId: request2.resumeThreadId } : {},
|
|
140079
|
+
args: [...codexScheduledArgs(request2), "-c", 'tui.resume_cwd="current"']
|
|
140080
|
+
}, {
|
|
140081
|
+
supervisorInput: true,
|
|
140082
|
+
stageResumeCommand: true,
|
|
140083
|
+
validateLaunchTarget: async () => {
|
|
140084
|
+
assertOwned();
|
|
140085
|
+
await request2.onSpawn(await this.options.tmuxService.readPaneProcessId(target2));
|
|
140086
|
+
assertOwned();
|
|
140087
|
+
},
|
|
140088
|
+
validateSupervisorTarget: assertOwned
|
|
140089
|
+
});
|
|
140090
|
+
operationId = prepared.operationId;
|
|
140091
|
+
let unavailableSince = null;
|
|
140092
|
+
let unsettledSince = null;
|
|
140093
|
+
let outputBytes = 0;
|
|
140094
|
+
const output = /* @__PURE__ */ new Map();
|
|
140095
|
+
while (true) {
|
|
140096
|
+
assertOwned();
|
|
140097
|
+
const identity2 = resolveConversationTarget(this.manager, session.id, panel.id).target;
|
|
140098
|
+
if (identity2) {
|
|
140099
|
+
if (identity2.provider !== "codex" || threadId && identity2.threadId !== threadId || request2.resumeThreadId && identity2.threadId !== request2.resumeThreadId) {
|
|
140100
|
+
takenOver = true;
|
|
140101
|
+
throw new Error("provider_thread_mismatch");
|
|
140102
|
+
}
|
|
140103
|
+
if (!threadId) {
|
|
140104
|
+
threadId = identity2.threadId;
|
|
140105
|
+
await request2.onThread(threadId);
|
|
140106
|
+
}
|
|
140107
|
+
const response2 = await this.history.getThreadDetail(threadId).catch(() => null);
|
|
140108
|
+
assertOwned();
|
|
140109
|
+
const detail2 = response2?.availability === "available" && response2.detail && "threadId" in response2.detail && response2.detail.provider === "codex" && response2.detail.threadId === threadId ? response2.detail : null;
|
|
140110
|
+
if (!detail2) {
|
|
140111
|
+
unavailableSince ??= Date.now();
|
|
140112
|
+
if (Date.now() - unavailableSince >= 3e4) throw new Error("provider_history_unavailable");
|
|
140113
|
+
} else {
|
|
140114
|
+
unavailableSince = null;
|
|
140115
|
+
const turns = detail2.turns.filter((turn2) => turn2.messages.some((message2) => message2.role === "user" && message2.text.includes(marker)));
|
|
140116
|
+
if (turns.length > 1) throw new Error("provider_thread_mismatch");
|
|
140117
|
+
const turn = turns[0];
|
|
140118
|
+
if (turn) {
|
|
140119
|
+
for (const message2 of turn.messages.filter((message3) => message3.role === "assistant")) {
|
|
140120
|
+
const previous = output.get(message2.id) ?? "";
|
|
140121
|
+
if (previous === message2.text) continue;
|
|
140122
|
+
const text5 = `${message2.text.startsWith(previous) ? message2.text.slice(previous.length) : message2.text}
|
|
140123
|
+
`;
|
|
140124
|
+
outputBytes += Buffer.byteLength(text5);
|
|
140125
|
+
if (outputBytes > request2.maxOutputBytes || !await request2.onOutput(text5))
|
|
140126
|
+
throw new Error("provider_output_limit_exceeded");
|
|
140127
|
+
output.set(message2.id, message2.text);
|
|
140128
|
+
}
|
|
140129
|
+
if (this.manager.getPanel(panel.id)?.terminalState?.state === "agent_idle" && turn.status !== "inProgress" && turn.itemsView === "full") {
|
|
140130
|
+
if (turn.status === "completed") {
|
|
140131
|
+
const final = turn.messages.filter((message2) => message2.role === "assistant" && message2.phase !== "commentary").at(-1);
|
|
140132
|
+
if (!final) throw new Error("provider_result_invalid");
|
|
140133
|
+
result = { provider: this.provider, threadId, ...parseScheduledResult(final.text) };
|
|
140134
|
+
break;
|
|
140135
|
+
}
|
|
140136
|
+
unsettledSince ??= Date.now();
|
|
140137
|
+
if (Date.now() - unsettledSince >= 1e4) throw new Error("provider_completion_missing");
|
|
140138
|
+
} else {
|
|
140139
|
+
unsettledSince = null;
|
|
140140
|
+
}
|
|
140141
|
+
}
|
|
140142
|
+
}
|
|
140143
|
+
}
|
|
140144
|
+
const pane = (await this.options.tmuxService.listPanes(target2)).find((item) => item.paneId === target2.paneId);
|
|
140145
|
+
if (!pane || pane.agentPrepareExit?.startsWith(`exit:${prepared.operationId}:`))
|
|
140146
|
+
throw new Error("provider_completion_missing");
|
|
140147
|
+
await (0, import_promises87.setTimeout)(1e3, void 0, { signal }).catch(() => {
|
|
140148
|
+
checkCancelled();
|
|
140149
|
+
});
|
|
140150
|
+
}
|
|
140151
|
+
} catch (error2) {
|
|
140152
|
+
failed = true;
|
|
140153
|
+
failure3 = error2;
|
|
140154
|
+
} finally {
|
|
140155
|
+
try {
|
|
140156
|
+
if (!takenOver && !result && panelId && operationId) {
|
|
140157
|
+
try {
|
|
140158
|
+
takenOver = !await this.interrupt(session.id, panelId, operationId, threadId, () => takenOver);
|
|
140159
|
+
} catch {
|
|
140160
|
+
stopUnconfirmed = true;
|
|
140161
|
+
}
|
|
140162
|
+
}
|
|
140163
|
+
if ((takenOver || stopUnconfirmed) && panelId) {
|
|
140164
|
+
await request2.onTerminalRetained?.({
|
|
140165
|
+
terminalSessionId: session.id,
|
|
140166
|
+
panelId,
|
|
140167
|
+
attachmentState: stopUnconfirmed ? "failed" : "ready",
|
|
140168
|
+
...stopUnconfirmed ? { error: "provider_stop_unconfirmed" } : {}
|
|
140169
|
+
});
|
|
140170
|
+
} else {
|
|
140171
|
+
const deleted = await deleteTerminalSession(session.id, { ...this.options, terminalSessionManager: this.manager });
|
|
140172
|
+
if (deleted) this.options.terminalEventService?.record({
|
|
140173
|
+
kind: "terminal_session_deleted",
|
|
140174
|
+
terminalSessionId: session.id,
|
|
140175
|
+
projectId: session.projectId,
|
|
140176
|
+
payload: { terminalSessionId: session.id, projectId: session.projectId }
|
|
140177
|
+
});
|
|
140178
|
+
if (deleted) recordTerminalSessionDeleted(this.options.activity, session);
|
|
140179
|
+
}
|
|
140180
|
+
} finally {
|
|
140181
|
+
unwatch();
|
|
140182
|
+
}
|
|
140183
|
+
}
|
|
140184
|
+
if (stopUnconfirmed) throw new Error("provider_stop_unconfirmed");
|
|
140185
|
+
if (failed) throw failure3;
|
|
140186
|
+
return result;
|
|
140187
|
+
}
|
|
140188
|
+
async interrupt(sessionId, panelId, operationId, threadId, takenOver) {
|
|
140189
|
+
const session = this.manager.getSession(sessionId);
|
|
140190
|
+
const panel = this.manager.getPanel(panelId);
|
|
140191
|
+
if (!session || !panel || !this.options.tmuxService) return true;
|
|
140192
|
+
const owned = () => {
|
|
140193
|
+
const current = resolveConversationTarget(this.manager, sessionId, panelId).target;
|
|
140194
|
+
return !takenOver() && this.manager.matchesPanelAgentOperationGeneration(sessionId, panelId, operationId, "codex") && (!threadId || !current || current.provider === "codex" && current.threadId === threadId);
|
|
140195
|
+
};
|
|
140196
|
+
if (!owned()) return false;
|
|
140197
|
+
const panePid = await this.options.tmuxService.readPaneProcessId(buildPaneTarget(session, this.options.tmuxService, panel));
|
|
140198
|
+
const children = await terminalChildren(panePid);
|
|
140199
|
+
if (!owned()) return false;
|
|
140200
|
+
await sendInputToSession(this.manager, {
|
|
140201
|
+
...this.options,
|
|
140202
|
+
supervisorInput: true,
|
|
140203
|
+
validateSupervisorTarget: () => {
|
|
140204
|
+
if (!owned()) throw new Error("provider_terminal_taken_over");
|
|
140205
|
+
}
|
|
140206
|
+
}, session, "\x1B", "raw", void 0, buildPaneTarget(session, this.options.tmuxService, panel));
|
|
140207
|
+
if (!owned()) return false;
|
|
140208
|
+
const afterInterrupt = await terminalChildren(panePid);
|
|
140209
|
+
if (!owned()) return false;
|
|
140210
|
+
await stopTerminalChildren([...children, ...afterInterrupt]);
|
|
140211
|
+
return !takenOver();
|
|
140212
|
+
}
|
|
140213
|
+
};
|
|
140214
|
+
|
|
139834
140215
|
// backend/src/scheduled-tasks/bootstrap.ts
|
|
139835
140216
|
var DEFAULT_TIMEOUT_MS2 = 2 * 60 * 6e4;
|
|
139836
140217
|
var DEFAULT_MAX_OUTPUT_BYTES = 16 * 1024 * 1024;
|
|
@@ -139890,7 +140271,8 @@ async function createScheduledTaskSubsystem(params) {
|
|
|
139890
140271
|
params.terminalSessionManager,
|
|
139891
140272
|
providerProbe.adapters,
|
|
139892
140273
|
enabled,
|
|
139893
|
-
{ maxConcurrentRuns, timeoutMs, maxOutputBytes }
|
|
140274
|
+
{ maxConcurrentRuns, timeoutMs, maxOutputBytes },
|
|
140275
|
+
new CodexTerminalScheduledTaskProvider(params.terminalSessionManager, params.terminalOptions)
|
|
139894
140276
|
);
|
|
139895
140277
|
await runtime.initialize();
|
|
139896
140278
|
const service = new ScheduledTaskService(
|
|
@@ -139957,7 +140339,7 @@ async function createScheduledTasks(resources, input2) {
|
|
|
139957
140339
|
}
|
|
139958
140340
|
|
|
139959
140341
|
// backend/src/device-monitor/scheduled-task-alerts.ts
|
|
139960
|
-
var
|
|
140342
|
+
var import_node_crypto125 = require("node:crypto");
|
|
139961
140343
|
var INTERVAL_MS2 = 5e3;
|
|
139962
140344
|
var DELIVERY_WINDOW_MS2 = 3e5;
|
|
139963
140345
|
var ScheduledTaskAlerts = class {
|
|
@@ -140086,7 +140468,7 @@ var ScheduledTaskAlerts = class {
|
|
|
140086
140468
|
}
|
|
140087
140469
|
};
|
|
140088
140470
|
function deliveryId(run2, recipient) {
|
|
140089
|
-
return (0,
|
|
140471
|
+
return (0, import_node_crypto125.createHash)("sha256").update(run2.resultRevision ? `${run2.id}:${run2.resultRevision}:${recipient}` : `${run2.id}:${recipient}`).digest("hex");
|
|
140090
140472
|
}
|
|
140091
140473
|
function deliveryPlans(data, runs, recipients) {
|
|
140092
140474
|
const deliveries = data.taskDeliveries ?? {};
|
|
@@ -140141,11 +140523,11 @@ function createDelivery(id7, run2, subscriptionId) {
|
|
|
140141
140523
|
}
|
|
140142
140524
|
|
|
140143
140525
|
// backend/src/bootstrap/tmux-paths.ts
|
|
140144
|
-
var
|
|
140526
|
+
var import_node_crypto126 = require("node:crypto");
|
|
140145
140527
|
var import_node_os26 = __toESM(require("node:os"), 1);
|
|
140146
140528
|
var import_node_path136 = __toESM(require("node:path"), 1);
|
|
140147
140529
|
function profileId(browserProfileDir) {
|
|
140148
|
-
return (0,
|
|
140530
|
+
return (0, import_node_crypto126.createHash)("sha256").update(browserProfileDir).digest("hex").slice(0, 12);
|
|
140149
140531
|
}
|
|
140150
140532
|
function resolvePersistentTmuxSocketPath(browserProfileDir) {
|
|
140151
140533
|
return import_node_path136.default.join(
|