nolo-cli 0.18.0 → 0.24.0-alpha.6
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/{_executeModel-X5PCIZN6.js → _executeModel-ARCMGGMY.js} +46 -44
- package/{action-LT7BRFLK.js → action-5MNAXR5B.js} +7 -6
- package/{addContentAction-PL3KKBDH.js → addContentAction-UNSYTVTB.js} +5 -5
- package/{addDialogAgentAction-FCMSKYAF.js → addDialogAgentAction-LJGNP2AO.js} +5 -5
- package/{agentDeleteCommand-2BZDQV36.js → agentDeleteCommand-C5PIEBMZ.js} +27 -26
- package/{agentEmailCommands-2QJDGRMB.js → agentEmailCommands-QTGQ3ZAD.js} +57 -55
- package/{agentListCommands-6VEPTKBI.js → agentListCommands-LRHBS3A5.js} +30 -26
- package/{agentMachineCommands-NVVHNWYI.js → agentMachineCommands-4PXIT4BP.js} +25 -24
- package/{agentRecordCommands-4GGRDMD4.js → agentRecordCommands-ZZPTYTYR.js} +52 -50
- package/{agentRunCommand-XOLQNKBZ.js → agentRunCommand-7ZTPZNUX.js} +55 -54
- package/{agentRunControl-Y5AFH5PQ.js → agentRunControl-SNUKXN6J.js} +6 -2
- package/{agentRuntimeLocal-7WYWCGL4.js → agentRuntimeLocal-QOYY5UV2.js} +19 -18
- package/{agentSlice-EAXPGEYV.js → agentSlice-J3W3RX2I.js} +5 -5
- package/{appDeleteCommands-77KR2RJ4.js → appDeleteCommands-7NS46XDH.js} +23 -22
- package/{appDeployCommands-K7CAHGBI.js → appDeployCommands-RSRNQ67U.js} +23 -22
- package/{appDeployStatusCommands-4OEKLTBT.js → appDeployStatusCommands-EF4RSGC6.js} +23 -22
- package/{appGetCommands-VM2WDLAZ.js → appGetCommands-YA7JWYUX.js} +23 -22
- package/{appListCommands-GX6BBA6U.js → appListCommands-WM2ON6JW.js} +23 -22
- package/{authCommand-DY6UUL6O.js → authCommand-HJP7FURK.js} +12 -13
- package/{authCommands-XTBV7OFZ.js → authCommands-NYZM2B2I.js} +4 -5
- package/{chunk-MKA6QE5E.js → chunk-2IPEVBUO.js} +126 -68
- package/{chunk-OWOHNGCN.js → chunk-2MBTWINN.js} +42 -3
- package/{chunk-K6EUAOW3.js → chunk-35RYGII3.js} +1 -1
- package/{chunk-TRT4I4UD.js → chunk-4POUK2BV.js} +2 -2
- package/{chunk-LLWKHDG4.js → chunk-4ULSC37S.js} +1 -3
- package/{chunk-EDV7EBOI.js → chunk-4ZH6GUJF.js} +2151 -1500
- package/{chunk-MVQ4TBSD.js → chunk-54VHTARN.js} +1 -1
- package/{chunk-L4F3I4SR.js → chunk-5HQQ4LUU.js} +4 -6
- package/{chunk-Z4NR32XR.js → chunk-5RGU3J7P.js} +13 -0
- package/{chunk-7BUYEZ6U.js → chunk-7H3UTGPM.js} +12 -72
- package/{chunk-RQN4SEKL.js → chunk-7W6GFNJL.js} +1 -1
- package/{chunk-HEGV7BH3.js → chunk-AQZCWJOG.js} +1 -1
- package/{chunk-3ND52WIL.js → chunk-ATWUOTJP.js} +180 -24
- package/chunk-CF7S2RYZ.js +376 -0
- package/{chunk-I2ZJKTG5.js → chunk-CGVRC2TB.js} +7 -7
- package/{chunk-UAIVG4J6.js → chunk-CHSCAUZN.js} +1 -8
- package/{chunk-KFEVY3ST.js → chunk-D34RI6NI.js} +18 -8
- package/{chunk-ROWQEJRP.js → chunk-DXJS7VSG.js} +3 -2
- package/{chunk-MHSGJW4Z.js → chunk-EHOYZRTI.js} +44 -14
- package/{chunk-XRZJGPFI.js → chunk-FON47ACC.js} +4 -4
- package/{chunk-SCTYAHYK.js → chunk-H2NAWOLH.js} +217 -141
- package/{chunk-MPVYDS7I.js → chunk-H6ODMJR3.js} +3 -3
- package/{chunk-R35XMF6F.js → chunk-H73ZV2GL.js} +352 -30
- package/{chunk-4T5F7YZQ.js → chunk-I6RJGORZ.js} +1 -1
- package/{chunk-OK6YSWLH.js → chunk-IICW77GI.js} +1 -1
- package/{chunk-VDXCXCXH.js → chunk-IUDMBCXC.js} +1 -1
- package/{chunk-AHCY2S2I.js → chunk-JADNODCQ.js} +1 -1
- package/{chunk-DFCFMCY6.js → chunk-JBLY6HQP.js} +2 -2
- package/{chunk-UGUW3FHG.js → chunk-JMSCXQUG.js} +2 -2
- package/{chunk-N54HIJVJ.js → chunk-KFUCLS7Z.js} +101 -9
- package/{chunk-FQZZLA3C.js → chunk-KXKQO4Q6.js} +17 -0
- package/{chunk-3Q7WHGCB.js → chunk-L65QKSVJ.js} +1 -1
- package/{chunk-3ZX7PERL.js → chunk-LALVWNE4.js} +20 -7
- package/{chunk-PJSV3IZ5.js → chunk-M3TMVJKG.js} +1 -1
- package/{chunk-REA4JLBH.js → chunk-M5OZCOBV.js} +7 -6
- package/{chunk-JLA4FXYC.js → chunk-MALVZUYL.js} +1 -1
- package/{chunk-GFUIQ4RY.js → chunk-MXFQHRSS.js} +1 -1
- package/{chunk-LSFAWXKC.js → chunk-N7J63Q6C.js} +1 -0
- package/{chunk-6Y7A3OQQ.js → chunk-NRY4GCKJ.js} +2 -0
- package/{chunk-G5U6LDLG.js → chunk-NVHPMDSZ.js} +6 -6
- package/{chunk-23FZYPLC.js → chunk-OJFYT3ZQ.js} +842 -1060
- package/{chunk-ELT65PZW.js → chunk-OXLLFZNF.js} +1 -1
- package/{chunk-CZ6NYQTV.js → chunk-P4QWLZGU.js} +2 -2
- package/{chunk-5MIDPSSK.js → chunk-PB7G5MAM.js} +3 -3
- package/{chunk-HWW2M4SN.js → chunk-QLVWFXZQ.js} +5 -4
- package/{chunk-VYHDJEQD.js → chunk-QNLLGS37.js} +136 -78
- package/{chunk-XHG22OEX.js → chunk-ROJI6DRT.js} +2 -2
- package/{chunk-BV4VEE3W.js → chunk-ROYOKSX4.js} +243 -354
- package/{chunk-VNAEBGDK.js → chunk-RZNYL4LW.js} +123 -26
- package/{chunk-RVOUXDFU.js → chunk-S6KVFOUG.js} +6 -34
- package/{chunk-V3ED5AWK.js → chunk-S77SCVBU.js} +27 -16
- package/{chunk-UBHAWFQ6.js → chunk-S7RWIPDI.js} +42 -19
- package/{chunk-B5TOXZAK.js → chunk-SIZQB7BD.js} +1 -1
- package/{chunk-DFFIZ25G.js → chunk-SLOGKB7M.js} +4 -1
- package/{chunk-FXUSIQC2.js → chunk-SROR5TSM.js} +1 -1
- package/{chunk-PIZYJVHQ.js → chunk-TN4YHAI3.js} +4 -4
- package/{chunk-IYEXFJPC.js → chunk-TW35GDNW.js} +64 -57
- package/chunk-UZ6XXCVR.js +50 -0
- package/{chunk-DKZFOK24.js → chunk-UZH44DWK.js} +7 -288
- package/{chunk-YGW4G5W5.js → chunk-X546QUDT.js} +61 -12
- package/chunk-YYLHWIW6.js +48 -0
- package/{chunk-SWDPIPOY.js → chunk-ZGVW7MSZ.js} +1 -1
- package/{chunk-34WPV75U.js → chunk-ZUXIXYJI.js} +1 -1
- package/{chunk-VC6OZXO5.js → chunk-ZWJOGMKH.js} +2 -26
- package/{cliExecutor-DNE7TCC4.js → cliExecutor-K3F7DMRO.js} +2 -2
- package/{codingSkills-36KN5NQT.js → codingSkills-EN6Z6G6U.js} +4 -4
- package/{createAgentAutomationAction-GNFF524X.js → createAgentAutomationAction-MKQWN4VQ.js} +19 -18
- package/{createDialogAction-RB55KCLO.js → createDialogAction-YWIZPLFS.js} +22 -20
- package/{createPageAction-Y7343GLU.js → createPageAction-74TTEIPC.js} +20 -19
- package/{db-W3O47YGF.js → db-W5UHK4P3.js} +150 -0
- package/{dbSlice-CGSRFJN3.js → dbSlice-5BKDURDL.js} +4 -4
- package/{dialogCommands-IAZK6YHQ.js → dialogCommands-MJIP32FL.js} +24 -23
- package/{dialogSlice-UQAXF23P.js → dialogSlice-KLLVH4WI.js} +24 -18
- package/{docCreateCommands-I2EWZGCI.js → docCreateCommands-5DN472U6.js} +24 -27
- package/{docDeleteCommands-IZ45UZKG.js → docDeleteCommands-HE76LBN4.js} +25 -24
- package/{docReadCommands-R6Z4QJYU.js → docReadCommands-XVGZSCBS.js} +24 -23
- package/{docStore-5HOJ4D7D.js → docStore-SPH3D6BT.js} +20 -19
- package/{docUpdateCommands-2LRBKQPY.js → docUpdateCommands-P7IAWUAD.js} +24 -27
- package/{fetchMessages-BMGVZVSE.js → fetchMessages-W4IKHPCS.js} +2 -3
- package/{getPricing-G7DLAST6.js → getPricing-WENPBVWH.js} +3 -3
- package/{handleSendMessageAction-Q4HY35WX.js → handleSendMessageAction-ZU6WJVL7.js} +23 -20
- package/index.js +74 -74
- package/{localDialogRead-4H3QJFLW.js → localDialogRead-JXTAHW2E.js} +2 -2
- package/{machineCommands-PKBPQKTY.js → machineCommands-NI76PVHK.js} +59 -57
- package/{machineWsRunDispatch-UZAW4OXJ.js → machineWsRunDispatch-W3G6NJVQ.js} +51 -49
- package/{models-DJFSJ7SW.js → models-DB27UAE3.js} +2 -2
- package/package.json +1 -1
- package/{read-3FMPZPER.js → read-F3L3T2WJ.js} +2 -1
- package/{readDocTool-VSYHKK3V.js → readDocTool-FOHWVA4R.js} +1 -1
- package/{readlineWorkspace-Y2RDOFZG.js → readlineWorkspace-BDH4G477.js} +880 -425
- package/{removeDialogAgentAction-OAGA2G3U.js → removeDialogAgentAction-QCFGIUIH.js} +8 -7
- package/{runAgentClientLoop-NBPIKJ6J.js → runAgentClientLoop-ZPKMXCM5.js} +45 -38
- package/{setDialogExtraReferencesAction-JZEXA5SL.js → setDialogExtraReferencesAction-DK4CKERU.js} +5 -5
- package/{setPrimaryDialogAgentAction-4ZUQQKDG.js → setPrimaryDialogAgentAction-SJSO6N27.js} +8 -7
- package/{settingSlice-7MNKHZ6R.js → settingSlice-XNM5AFPU.js} +6 -5
- package/{spaceCommands-DHCZ7J5I.js → spaceCommands-3GGBJRQR.js} +25 -24
- package/{spaceSlice-ZXLLG3CR.js → spaceSlice-47Z6XLFQ.js} +21 -18
- package/{streamAgentChatTurn-L3YW6LSB.js → streamAgentChatTurn-VT5K5JSD.js} +140 -98
- package/switchDialogAgentAction-4OAC6QRN.js +61 -0
- package/{tableCommands-BEQAGE4I.js → tableCommands-HEQYT2KP.js} +1 -1
- package/{toolApiClient-QI3YBNWB.js → toolApiClient-ISM4ZQX4.js} +2 -2
- package/{tools-ECGXR5QF.js → tools-L7RCHAPT.js} +36 -33
- package/{tuiSummaryLlmCaller-OMSCNHXA.js → tuiSummaryLlmCaller-3DYOLTVN.js} +6 -6
- package/{updateCommands-XTW55TOT.js → updateCommands-HTCOBXCA.js} +2 -2
- package/{updateDialogTitleAction-HQ2EUDFT.js → updateDialogTitleAction-KMPVPQ4A.js} +28 -27
- package/chunk-DL6EPNIK.js +0 -50
- package/chunk-V5R4NZP2.js +0 -78
- package/chunk-X4Q4UZEY.js +0 -26
- package/queryRunOverlay-O4LOMMPO.js +0 -161
- package/runOverlayPresentation-ZO4VCWEU.js +0 -11
- package/types-ZSTJ7MPR.js +0 -7
- package/{chunk-X7W4TNB4.js → chunk-CMKUBIGW.js} +3 -3
- package/{runtimeDoctorCommands-E2OUORHK.js → runtimeDoctorCommands-HSU632DY.js} +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAgentRunTerminalStatus
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KXKQO4Q6.js";
|
|
4
4
|
import {
|
|
5
5
|
isCompiledBinary,
|
|
6
6
|
resolveCliEntrypointPath
|
|
@@ -45,11 +45,58 @@ function defaultGenerateBatchId() {
|
|
|
45
45
|
const random = Math.random().toString(36).slice(2, 8);
|
|
46
46
|
return `batch-${timestamp}-${random}`;
|
|
47
47
|
}
|
|
48
|
+
var LOCK_STALE_MS = 5e3;
|
|
49
|
+
var TMP_STALE_MS = 6e4;
|
|
50
|
+
function withRunRecordLock(runId, deps, fn) {
|
|
51
|
+
const fs = deps.fs ?? nodeFs;
|
|
52
|
+
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
53
|
+
const lockPath = `${resolveRunRecordPath(runId, deps.env, deps.homedir)}.lock`;
|
|
54
|
+
let held = false;
|
|
55
|
+
try {
|
|
56
|
+
try {
|
|
57
|
+
fs.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
58
|
+
held = true;
|
|
59
|
+
} catch {
|
|
60
|
+
try {
|
|
61
|
+
const stat = fs.statSync?.(lockPath);
|
|
62
|
+
const ageMs = stat ? now().getTime() - stat.mtimeMs : Number.POSITIVE_INFINITY;
|
|
63
|
+
if (ageMs > LOCK_STALE_MS) {
|
|
64
|
+
fs.unlinkSync(lockPath);
|
|
65
|
+
fs.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
66
|
+
held = true;
|
|
67
|
+
}
|
|
68
|
+
} catch {
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return fn();
|
|
72
|
+
} finally {
|
|
73
|
+
if (held) {
|
|
74
|
+
try {
|
|
75
|
+
fs.unlinkSync(lockPath);
|
|
76
|
+
} catch {
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
48
81
|
function writeRunRecord(record, deps = {}) {
|
|
49
82
|
const fs = deps.fs ?? nodeFs;
|
|
50
83
|
const path = resolveRunRecordPath(record.runId, deps.env, deps.homedir);
|
|
51
84
|
fs.mkdirSync(resolveRunsDir(deps.env, deps.homedir), { recursive: true });
|
|
52
|
-
|
|
85
|
+
const payload = JSON.stringify(record, null, 2);
|
|
86
|
+
if (typeof fs.renameSync === "function") {
|
|
87
|
+
const tmp = `${path}.${process.pid}.${Math.random().toString(36).slice(2, 8)}.tmp`;
|
|
88
|
+
try {
|
|
89
|
+
fs.writeFileSync(tmp, payload);
|
|
90
|
+
fs.renameSync(tmp, path);
|
|
91
|
+
return;
|
|
92
|
+
} catch {
|
|
93
|
+
try {
|
|
94
|
+
fs.unlinkSync(tmp);
|
|
95
|
+
} catch {
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
fs.writeFileSync(path, payload);
|
|
53
100
|
}
|
|
54
101
|
var FILE_EDIT_TOOL_NAMES = /* @__PURE__ */ new Set(["writeFile", "editFile"]);
|
|
55
102
|
var DEFAULT_ACTIVITY_WRITE_INTERVAL_MS = 2e3;
|
|
@@ -130,11 +177,14 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
|
|
|
130
177
|
function readRunRecord(runId, deps = {}) {
|
|
131
178
|
const fs = deps.fs ?? nodeFs;
|
|
132
179
|
const path = resolveRunRecordPath(runId, deps.env, deps.homedir);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
180
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
181
|
+
try {
|
|
182
|
+
return JSON.parse(fs.readFileSync(path, "utf8"));
|
|
183
|
+
} catch {
|
|
184
|
+
if (attempt === 1) return null;
|
|
185
|
+
}
|
|
137
186
|
}
|
|
187
|
+
return null;
|
|
138
188
|
}
|
|
139
189
|
function listRunRecords(deps = {}) {
|
|
140
190
|
const fs = deps.fs ?? nodeFs;
|
|
@@ -248,6 +298,22 @@ function gcRunRecords(deps = {}, options = {}) {
|
|
|
248
298
|
failedIds.push(record.runId);
|
|
249
299
|
}
|
|
250
300
|
}
|
|
301
|
+
try {
|
|
302
|
+
const dir = resolveRunsDir(deps.env, deps.homedir);
|
|
303
|
+
const statSync = fs.statSync;
|
|
304
|
+
for (const entry of fs.readdirSync(dir)) {
|
|
305
|
+
if (typeof entry !== "string" || !entry.endsWith(".tmp")) continue;
|
|
306
|
+
const tmpPath = join(dir, entry);
|
|
307
|
+
try {
|
|
308
|
+
const stat = statSync?.(tmpPath);
|
|
309
|
+
if (stat && nowMs - stat.mtimeMs <= TMP_STALE_MS) continue;
|
|
310
|
+
} catch {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
tryUnlinkFile(fs, tmpPath);
|
|
314
|
+
}
|
|
315
|
+
} catch {
|
|
316
|
+
}
|
|
251
317
|
return { swept: sweptIds.length, sweptIds, failedIds };
|
|
252
318
|
}
|
|
253
319
|
function stripBackgroundFlag(args) {
|
|
@@ -367,28 +433,39 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
|
|
|
367
433
|
record.pid = proc.pid;
|
|
368
434
|
const processStartedAt = (deps.getProcessStartTime ?? defaultGetProcessStartTime)(proc.pid);
|
|
369
435
|
if (processStartedAt) record.processStartedAt = processStartedAt.toISOString();
|
|
370
|
-
|
|
436
|
+
writeRunRecord(record, deps);
|
|
371
437
|
}
|
|
372
438
|
return { runId, pid: proc.pid, logPath, batchId };
|
|
373
439
|
}
|
|
440
|
+
function ackRunRecord(runId, deps = {}) {
|
|
441
|
+
withRunRecordLock(runId, deps, () => {
|
|
442
|
+
const record = readRunRecord(runId, deps);
|
|
443
|
+
if (!record) return;
|
|
444
|
+
if (record.ack) return;
|
|
445
|
+
record.ack = true;
|
|
446
|
+
writeRunRecord(record, deps);
|
|
447
|
+
});
|
|
448
|
+
}
|
|
374
449
|
function finalizeRunRecord(runId, update, deps = {}) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
450
|
+
withRunRecordLock(runId, deps, () => {
|
|
451
|
+
const record = readRunRecord(runId, deps);
|
|
452
|
+
if (!record) return;
|
|
453
|
+
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
454
|
+
record.status = update.status;
|
|
455
|
+
if (typeof update.exitCode === "number") record.exitCode = update.exitCode;
|
|
456
|
+
if (update.dialogId) record.dialogId = update.dialogId;
|
|
457
|
+
record.endedAt = now().toISOString();
|
|
458
|
+
if (record.note?.startsWith("orphaned:")) record.note = void 0;
|
|
459
|
+
writeRunRecord(record, deps);
|
|
460
|
+
});
|
|
383
461
|
}
|
|
384
462
|
function isPidGone(pid, deps = {}) {
|
|
385
463
|
const kill = deps.kill ?? ((p, s) => process.kill(p, s));
|
|
386
464
|
try {
|
|
387
|
-
kill(pid,
|
|
465
|
+
kill(pid, 0);
|
|
388
466
|
return false;
|
|
389
467
|
} catch (error) {
|
|
390
|
-
|
|
391
|
-
return code === "ESRCH";
|
|
468
|
+
return error.code === "ESRCH";
|
|
392
469
|
}
|
|
393
470
|
}
|
|
394
471
|
function defaultGetProcessStartTime(pid) {
|
|
@@ -406,7 +483,13 @@ function defaultGetProcessStartTime(pid) {
|
|
|
406
483
|
}
|
|
407
484
|
}
|
|
408
485
|
var MAX_PROCESS_START_TIME_DIFF_MS = 3e4;
|
|
409
|
-
var MAX_PERSISTED_PROCESS_START_TIME_DIFF_MS =
|
|
486
|
+
var MAX_PERSISTED_PROCESS_START_TIME_DIFF_MS = 2e3;
|
|
487
|
+
var ORPHAN_HEARTBEAT_GRACE_MS = 1e4;
|
|
488
|
+
function readTimestampMs(value) {
|
|
489
|
+
if (!value) return null;
|
|
490
|
+
const ms = new Date(value).getTime();
|
|
491
|
+
return Number.isNaN(ms) ? null : ms;
|
|
492
|
+
}
|
|
410
493
|
function isPidReused(pid, expectedStartedAt, deps = {}, maxDiffMs = MAX_PROCESS_START_TIME_DIFF_MS) {
|
|
411
494
|
const getStartTime = deps.getProcessStartTime ?? defaultGetProcessStartTime;
|
|
412
495
|
const procStartTime = getStartTime(pid);
|
|
@@ -429,13 +512,25 @@ function checkStaleRun(runId, deps = {}) {
|
|
|
429
512
|
const pidReused = !pidGone && isPidReused(record.pid, expectedStartedAt, deps, maxStartTimeDiffMs);
|
|
430
513
|
if (!pidGone && !pidReused) return record;
|
|
431
514
|
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
515
|
+
const heartbeatAt = readTimestampMs(record.activity?.updatedAt);
|
|
516
|
+
if (heartbeatAt !== null) {
|
|
517
|
+
const silentMs = now().getTime() - heartbeatAt;
|
|
518
|
+
if (silentMs < ORPHAN_HEARTBEAT_GRACE_MS) return record;
|
|
519
|
+
}
|
|
520
|
+
return withRunRecordLock(runId, deps, () => {
|
|
521
|
+
const latest = readRunRecord(runId, deps);
|
|
522
|
+
if (!latest) return record;
|
|
523
|
+
if (latest.status !== "running") return latest;
|
|
524
|
+
if (latest.activity?.updatedAt !== record.activity?.updatedAt) return latest;
|
|
525
|
+
const at = now().toISOString();
|
|
526
|
+
latest.status = "orphaned";
|
|
527
|
+
latest.note = pidReused ? "orphaned: process gone (pid reused by another process)" : "orphaned: process gone without writing terminal status";
|
|
528
|
+
latest.endedAt = at;
|
|
529
|
+
latest.reconciledAt = at;
|
|
530
|
+
latest.pid = void 0;
|
|
531
|
+
writeRunRecord(latest, deps);
|
|
532
|
+
return latest;
|
|
533
|
+
});
|
|
439
534
|
}
|
|
440
535
|
function formatDuration(startedAt, endedAt) {
|
|
441
536
|
const start = new Date(startedAt).getTime();
|
|
@@ -812,10 +907,12 @@ export {
|
|
|
812
907
|
absolutizeSkillArgs,
|
|
813
908
|
rewriteMsgFileArg,
|
|
814
909
|
spawnLocalBackgroundRun,
|
|
910
|
+
ackRunRecord,
|
|
815
911
|
finalizeRunRecord,
|
|
816
912
|
isPidGone,
|
|
817
913
|
defaultGetProcessStartTime,
|
|
818
914
|
MAX_PROCESS_START_TIME_DIFF_MS,
|
|
915
|
+
ORPHAN_HEARTBEAT_GRACE_MS,
|
|
819
916
|
isPidReused,
|
|
820
917
|
checkStaleRun,
|
|
821
918
|
runAgentPsCommand,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parsePositiveFiniteNumberOrFallback
|
|
3
3
|
} from "./chunk-Y5GCAMGP.js";
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_SYSTEM_AGENT_CAPABILITIES
|
|
6
|
+
} from "./chunk-UZ6XXCVR.js";
|
|
4
7
|
import {
|
|
5
8
|
asRecordOrEmpty
|
|
6
9
|
} from "./chunk-KX6YBIHG.js";
|
|
@@ -10,18 +13,18 @@ import {
|
|
|
10
13
|
toTimestampMs,
|
|
11
14
|
upsert,
|
|
12
15
|
write
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FON47ACC.js";
|
|
14
17
|
import {
|
|
15
18
|
createUserKey,
|
|
16
19
|
createUserPreferenceKey,
|
|
17
20
|
ulid
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-NRY4GCKJ.js";
|
|
19
22
|
import {
|
|
20
23
|
asTrimmedLowercaseString
|
|
21
24
|
} from "./chunk-QSJ3HFEF.js";
|
|
22
25
|
import {
|
|
23
26
|
BUILTIN_NOLO_AGENT_KEY
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-ATWUOTJP.js";
|
|
25
28
|
import {
|
|
26
29
|
asyncThunkCreator,
|
|
27
30
|
buildCreateSlice,
|
|
@@ -65,35 +68,6 @@ var DEFAULT_USER_PREFERENCE_PROFILE = {
|
|
|
65
68
|
spaceContextLevel: 3
|
|
66
69
|
};
|
|
67
70
|
|
|
68
|
-
// packages/ai/tools/agentCapabilities.ts
|
|
69
|
-
var SYSTEM_AGENT_CAPABILITIES = [
|
|
70
|
-
{
|
|
71
|
-
id: "web-search",
|
|
72
|
-
label: "\u8054\u7F51\u641C\u7D22",
|
|
73
|
-
description: "\u8BA9 agent \u80FD\u641C\u7D22\u4E92\u8054\u7F51\u3001\u6293\u53D6\u7F51\u9875\u5185\u5BB9\uFF0C\u83B7\u53D6\u6700\u65B0\u4FE1\u606F\u3002",
|
|
74
|
-
tools: ["exa_search", "fetchWebpage"],
|
|
75
|
-
defaultEnabled: true,
|
|
76
|
-
icon: "\u{1F310}"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: "agent-orchestration",
|
|
80
|
-
label: "\u591A agent \u7F16\u6392",
|
|
81
|
-
description: "\u5148\u6309\u6536\u85CF\u3001\u7B80\u4ECB\u3001\u80FD\u529B\u548C\u6210\u672C\u5217\u51FA\u5B89\u5168 agent \u6458\u8981\uFF0C\u6309\u9700\u8BFB\u53D6\u5019\u9009\u914D\u7F6E\u89E3\u6790\u53EF\u8FD0\u884C key\uFF0C\u518D\u540E\u53F0\u542F\u52A8\u5176\u4ED6 agent \u6267\u884C\u5B50\u4EFB\u52A1\uFF0C\u5E76\u89C2\u5BDF\u3001\u67E5\u8BE2\u3001\u505C\u6B62\u8FD0\u884C\u4E2D\u7684 agent run\u2014\u2014\u9002\u5408\u5E76\u884C\u6D3E\u53D1\u3001\u957F\u4EFB\u52A1\u8DDF\u8E2A\u3001\u4E2D\u9014\u53EB\u505C\u7B49\u7F16\u6392\u573A\u666F\u3002",
|
|
82
|
-
tools: ["startAgentRun", "controlAgentRun", "listAgents"],
|
|
83
|
-
defaultEnabled: true,
|
|
84
|
-
icon: "\u{1F9E9}"
|
|
85
|
-
}
|
|
86
|
-
];
|
|
87
|
-
var SYSTEM_AGENT_CAPABILITY_IDS = SYSTEM_AGENT_CAPABILITIES.map(
|
|
88
|
-
({ id }) => id
|
|
89
|
-
);
|
|
90
|
-
var DEFAULT_SYSTEM_AGENT_CAPABILITIES = Object.fromEntries(
|
|
91
|
-
SYSTEM_AGENT_CAPABILITIES.map(({ id, defaultEnabled }) => [
|
|
92
|
-
id,
|
|
93
|
-
defaultEnabled
|
|
94
|
-
])
|
|
95
|
-
);
|
|
96
|
-
|
|
97
71
|
// packages/ai/policy/selfUpdateFields.ts
|
|
98
72
|
var AGENT_UPDATE_FIELD_NAMES = [
|
|
99
73
|
"name",
|
|
@@ -2015,8 +1989,6 @@ var settingSlice_default = settingSlice.reducer;
|
|
|
2015
1989
|
export {
|
|
2016
1990
|
DEFAULT_AGENT_BASE_POLICY,
|
|
2017
1991
|
DEFAULT_USER_PREFERENCE_PROFILE,
|
|
2018
|
-
SYSTEM_AGENT_CAPABILITIES,
|
|
2019
|
-
SYSTEM_AGENT_CAPABILITY_IDS,
|
|
2020
1992
|
AGENT_UPDATE_FIELD_NAMES,
|
|
2021
1993
|
normalizeAgentUpdateFieldList,
|
|
2022
1994
|
SYSTEM_DEFAULT_AGENT_ID,
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
listUserRecordsFromServers,
|
|
8
8
|
readDbRecordFromServers,
|
|
9
9
|
readLiveDbRecordAfterTombstoneMerge
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AQZCWJOG.js";
|
|
11
11
|
import {
|
|
12
12
|
buildDialogAttachmentPlan,
|
|
13
13
|
extractFileContentIds
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SIZQB7BD.js";
|
|
15
15
|
import {
|
|
16
16
|
toErrorMessage
|
|
17
17
|
} from "./chunk-HNMXYYJR.js";
|
|
@@ -624,9 +624,9 @@ async function tryHttpDialogCandidates(args) {
|
|
|
624
624
|
}
|
|
625
625
|
throw Object.assign(new Error("All HTTP dialog reads failed"), { attempts });
|
|
626
626
|
}
|
|
627
|
-
async function readDialogFromLocalDb(dialogKey, dialogId, limit) {
|
|
628
|
-
const
|
|
629
|
-
const result = await
|
|
627
|
+
async function readDialogFromLocalDb(dialogKey, dialogId, limit, readLocalDialog) {
|
|
628
|
+
const reader = readLocalDialog ?? (await import("./localDialogRead-JXTAHW2E.js")).readDialogFromLocalDb;
|
|
629
|
+
const result = await reader({ dialogKey, dialogId, limit });
|
|
630
630
|
return {
|
|
631
631
|
...result,
|
|
632
632
|
source: "local-db-fallback"
|
|
@@ -650,18 +650,29 @@ async function readDialogSnapshot(args) {
|
|
|
650
650
|
const statuses = attempts.map((attempt) => attempt.status).filter((status) => typeof status === "number");
|
|
651
651
|
const all404 = attempts.length > 0 && statuses.length === attempts.length && statuses.every((status) => status === 404);
|
|
652
652
|
const localhostCandidate = candidateBases.find(isLocalBaseUrl);
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
653
|
+
const remoteError = Object.assign(new Error(
|
|
654
|
+
all404 ? `dialog not found on tried servers: ${candidateBases.join(", ")}` : `read dialog failed across candidates: ${attempts.map((attempt) => `${attempt.base} -> ${attempt.status ?? attempt.message}`).join("; ")}`
|
|
655
|
+
), { attempts });
|
|
656
|
+
if (all404 || localhostCandidate) {
|
|
657
|
+
try {
|
|
658
|
+
const fallback = await readDialogFromLocalDb(
|
|
659
|
+
args.dialogKey,
|
|
660
|
+
args.dialogId,
|
|
661
|
+
args.limit,
|
|
662
|
+
args.readLocalDialog
|
|
663
|
+
);
|
|
664
|
+
return {
|
|
665
|
+
...fallback,
|
|
666
|
+
// Keep the configured base stable for callers that render it; the
|
|
667
|
+
// source field identifies that the payload came from local storage.
|
|
668
|
+
resolvedBase: localhostCandidate ?? args.base,
|
|
669
|
+
attempts,
|
|
670
|
+
candidateBases
|
|
671
|
+
};
|
|
672
|
+
} catch {
|
|
673
|
+
}
|
|
657
674
|
}
|
|
658
|
-
|
|
659
|
-
return {
|
|
660
|
-
...fallback,
|
|
661
|
-
resolvedBase: localhostCandidate,
|
|
662
|
-
attempts,
|
|
663
|
-
candidateBases
|
|
664
|
-
};
|
|
675
|
+
throw remoteError;
|
|
665
676
|
}
|
|
666
677
|
}
|
|
667
678
|
function compact(value, max = 180) {
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
inlineImageUrlsForCustomProvider,
|
|
6
6
|
prepareTools,
|
|
7
7
|
shouldInlineImageUrlsForAgent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-P4QWLZGU.js";
|
|
9
9
|
import {
|
|
10
10
|
performFetchRequest
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QNLLGS37.js";
|
|
12
12
|
import {
|
|
13
13
|
createSSEParser,
|
|
14
14
|
createToolRunId,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
toolRunSetPending,
|
|
20
20
|
toolRunStarted,
|
|
21
21
|
toolRunSucceeded
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-4ZH6GUJF.js";
|
|
23
23
|
import {
|
|
24
24
|
getPublicImageAgentMode
|
|
25
25
|
} from "./chunk-VIDPVFP3.js";
|
|
@@ -29,13 +29,13 @@ import {
|
|
|
29
29
|
messageStreaming,
|
|
30
30
|
selectCurrentSpaceId,
|
|
31
31
|
updateToolMessage
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-H2NAWOLH.js";
|
|
33
33
|
import {
|
|
34
34
|
streamAgentChatTurn
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-M5OZCOBV.js";
|
|
36
36
|
import {
|
|
37
37
|
EMPTY_ASSISTANT_REPAIR_PROMPT
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-X546QUDT.js";
|
|
39
39
|
import {
|
|
40
40
|
accumulateToolCallDelta,
|
|
41
41
|
createThinkParserState,
|
|
@@ -44,35 +44,32 @@ import {
|
|
|
44
44
|
flushToolCallTextParserIntoCallback,
|
|
45
45
|
processContentChunkWithToolCallStripping,
|
|
46
46
|
processThinkChunk
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-N7J63Q6C.js";
|
|
48
48
|
import {
|
|
49
49
|
getModelInfo
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-CGVRC2TB.js";
|
|
51
51
|
import {
|
|
52
52
|
getApiEndpoint
|
|
53
|
-
} from "./chunk-
|
|
54
|
-
import {
|
|
55
|
-
toErrorMessage
|
|
56
|
-
} from "./chunk-HNMXYYJR.js";
|
|
57
|
-
import {
|
|
58
|
-
extractCustomId
|
|
59
|
-
} from "./chunk-DFFIZ25G.js";
|
|
53
|
+
} from "./chunk-CHSCAUZN.js";
|
|
60
54
|
import {
|
|
61
55
|
addActiveController,
|
|
62
56
|
removeActiveController,
|
|
63
57
|
tokenUsageLiveUpdate
|
|
64
58
|
} from "./chunk-3ASDTTEI.js";
|
|
59
|
+
import {
|
|
60
|
+
toErrorMessage
|
|
61
|
+
} from "./chunk-HNMXYYJR.js";
|
|
65
62
|
import {
|
|
66
63
|
selectCurrentServer
|
|
67
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-S6KVFOUG.js";
|
|
68
65
|
import {
|
|
69
66
|
write
|
|
70
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-FON47ACC.js";
|
|
71
68
|
import {
|
|
72
69
|
createDialogMessageKeyAndId,
|
|
73
70
|
dialogMessageKey,
|
|
74
71
|
toTrimmedString
|
|
75
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-NRY4GCKJ.js";
|
|
76
73
|
import {
|
|
77
74
|
createAsyncThunk,
|
|
78
75
|
selectIdentityToken
|
|
@@ -83,6 +80,9 @@ import {
|
|
|
83
80
|
import {
|
|
84
81
|
asTrimmedString
|
|
85
82
|
} from "./chunk-3EUW3WEO.js";
|
|
83
|
+
import {
|
|
84
|
+
extractCustomId
|
|
85
|
+
} from "./chunk-SLOGKB7M.js";
|
|
86
86
|
import {
|
|
87
87
|
isRecord
|
|
88
88
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -307,17 +307,20 @@ function updateTotalUsage(currentUsage, newUsageChunk) {
|
|
|
307
307
|
return currentUsage;
|
|
308
308
|
}
|
|
309
309
|
if (!currentUsage) {
|
|
310
|
-
|
|
310
|
+
const first = {
|
|
311
311
|
completion_tokens: 0,
|
|
312
312
|
prompt_tokens: 0,
|
|
313
313
|
total_tokens: 0,
|
|
314
314
|
...newUsageChunk
|
|
315
315
|
};
|
|
316
|
+
applyResponsesUsageFields(first, newUsageChunk);
|
|
317
|
+
return first;
|
|
316
318
|
}
|
|
317
319
|
const updatedUsage = { ...currentUsage };
|
|
318
320
|
if (newUsageChunk.completion_tokens !== void 0) updatedUsage.completion_tokens = newUsageChunk.completion_tokens;
|
|
319
321
|
if (newUsageChunk.prompt_tokens !== void 0) updatedUsage.prompt_tokens = newUsageChunk.prompt_tokens;
|
|
320
322
|
if (newUsageChunk.total_tokens !== void 0) updatedUsage.total_tokens = newUsageChunk.total_tokens;
|
|
323
|
+
applyResponsesUsageFields(updatedUsage, newUsageChunk);
|
|
321
324
|
if (newUsageChunk.prompt_tokens_details) {
|
|
322
325
|
updatedUsage.prompt_tokens_details = {
|
|
323
326
|
...updatedUsage.prompt_tokens_details || {},
|
|
@@ -349,6 +352,26 @@ function updateTotalUsage(currentUsage, newUsageChunk) {
|
|
|
349
352
|
}
|
|
350
353
|
return updatedUsage;
|
|
351
354
|
}
|
|
355
|
+
function applyResponsesUsageFields(target, chunk) {
|
|
356
|
+
if (chunk.input_tokens !== void 0) {
|
|
357
|
+
target.prompt_tokens = chunk.input_tokens;
|
|
358
|
+
}
|
|
359
|
+
if (chunk.output_tokens !== void 0) {
|
|
360
|
+
target.completion_tokens = chunk.output_tokens;
|
|
361
|
+
}
|
|
362
|
+
if (chunk.input_tokens_details) {
|
|
363
|
+
target.prompt_tokens_details = {
|
|
364
|
+
...target.prompt_tokens_details || {},
|
|
365
|
+
...chunk.input_tokens_details
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
if (chunk.output_tokens_details) {
|
|
369
|
+
target.completion_tokens_details = {
|
|
370
|
+
...target.completion_tokens_details || {},
|
|
371
|
+
...chunk.output_tokens_details
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
}
|
|
352
375
|
|
|
353
376
|
// packages/chat/messages/toolThunks.ts
|
|
354
377
|
var TOOL_ARGS_SENTINELS = [
|
|
@@ -23,8 +23,11 @@ var extractCustomId = (key) => {
|
|
|
23
23
|
}
|
|
24
24
|
return extractKeyPart(key, 2);
|
|
25
25
|
};
|
|
26
|
+
var PUBLIC_AGENT_KEY_PREFIX = "agent-pub-";
|
|
27
|
+
var publicAgentKey = (id) => `${PUBLIC_AGENT_KEY_PREFIX}${id}`;
|
|
26
28
|
|
|
27
29
|
export {
|
|
28
30
|
extractUserId,
|
|
29
|
-
extractCustomId
|
|
31
|
+
extractCustomId,
|
|
32
|
+
publicAgentKey
|
|
30
33
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearCliLocalRuntimePreparedAgentCache
|
|
3
|
+
} from "./chunk-OJFYT3ZQ.js";
|
|
1
4
|
import {
|
|
2
5
|
getReadableCliDb
|
|
3
6
|
} from "./chunk-WFHXMLHZ.js";
|
|
@@ -9,10 +12,7 @@ import {
|
|
|
9
12
|
resolveAgentRecordFromHybridStore,
|
|
10
13
|
sanitizeAgentRecordForCliOutput,
|
|
11
14
|
writeAgentRecord
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
clearCliLocalRuntimePreparedAgentCache
|
|
15
|
-
} from "./chunk-23FZYPLC.js";
|
|
15
|
+
} from "./chunk-JBLY6HQP.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveCliAgentKeyInput
|
|
18
18
|
} from "./chunk-VHBWHNVT.js";
|