nolo-cli 0.95.0-alpha.6 → 0.95.1
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/README.md +1 -1
- package/{_executeModel-AUQRMRWL.js → _executeModel-2A5AFVBG.js} +67 -63
- package/{action-YVYQEAAV.js → action-GI44T4DR.js} +10 -10
- package/{addContentAction-O7R66HEX.js → addContentAction-B2DRF7P6.js} +9 -9
- package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-T3I7IXPK.js} +15 -17
- package/{agentDeleteCommand-4BAHJRU3.js → agentDeleteCommand-QYCCUQ35.js} +47 -43
- package/{agentEmailCommands-QISOY7Y6.js → agentEmailCommands-IX6COKHS.js} +89 -82
- package/{agentListCommands-U46ODMQU.js → agentListCommands-JDU7V3M5.js} +77 -82
- package/{agentMachineCommands-EHV2KM2C.js → agentMachineCommands-W36VFO5M.js} +42 -38
- package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-YK2BIIXZ.js} +1 -1
- package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-HF4A42D4.js} +1 -1
- package/agentRecordCommands-JGOTOBTW.js +135 -0
- package/{agentRunCommand-K4CLMA6B.js → agentRunCommand-LJBG6YF2.js} +89 -80
- package/{agentRunControl-XLGD3UZ5.js → agentRunControl-5T64LM2M.js} +2 -2
- package/{agentRuntimeLocal-O4HPUJA4.js → agentRuntimeLocal-SYLNOKCT.js} +44 -36
- package/{agentSlice-ZYT2OUR3.js → agentSlice-FZ7GGQM2.js} +11 -11
- package/{appDeleteCommands-R5BBTKQK.js → appDeleteCommands-IP22BHZE.js} +42 -38
- package/{appDeployCommands-ZJIXOJWD.js → appDeployCommands-5ZTQL6UL.js} +42 -38
- package/{appDeployStatusCommands-B3R2ZTBF.js → appDeployStatusCommands-G6EMAT75.js} +42 -38
- package/{appGetCommands-2AQSOV2A.js → appGetCommands-UXBDAYEM.js} +42 -38
- package/{appListCommands-HCIJGZFY.js → appListCommands-J274GTVP.js} +42 -38
- package/{authCommand-F4EFRRX6.js → authCommand-2YPMMIJN.js} +117 -23
- package/{authCommands-RGOGCPP6.js → authCommands-FFDS4FVX.js} +7 -5
- package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-ZMF6YGNO.js} +6 -5
- package/{chatQueueReduxAdapter-Q5V4YJVI.js → chatQueueReduxAdapter-PRP4YQP7.js} +30 -29
- package/{chromeCommands-FZYAU75D.js → chromeCommands-K27J4OVZ.js} +124 -28
- package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-IXRLN57H.js} +4 -3
- package/{chunk-6OZ36FXI.js → chunk-27ONFIEY.js} +22 -4
- package/chunk-2QZTQEW4.js +13349 -0
- package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
- package/{chunk-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
- package/{chunk-ZLR5JN3E.js → chunk-4B4DAAFV.js} +7 -7
- package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
- package/chunk-4LCOCOR5.js +50 -0
- package/{chunk-BZWBEHGD.js → chunk-4MPGAOXS.js} +66 -38
- package/{chunk-JOHSKZQX.js → chunk-4RTK7EHT.js} +865 -207
- package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
- package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
- package/{chunk-IAO6JBYW.js → chunk-5B7XS6UO.js} +164 -14
- package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
- package/chunk-5J3PYNUP.js +255 -0
- package/chunk-5MMAK75Q.js +15 -0
- package/{chunk-JPGCXHNM.js → chunk-5OA5HMTL.js} +1 -1
- package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
- package/{chunk-YQTQQX2H.js → chunk-67HHBCFJ.js} +1 -1
- package/{chunk-SNPMM7H3.js → chunk-67T7O467.js} +13 -13
- package/{chunk-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
- package/{chunk-4MY4GLIW.js → chunk-6IHBIRPK.js} +969 -1090
- package/{chunk-3BMYXEUW.js → chunk-6O4IK4V2.js} +1 -1
- package/{chunk-XOVEWFLK.js → chunk-6RDFAKG7.js} +100 -100
- package/{chunk-DHDMC6FO.js → chunk-6TPOEJMQ.js} +9 -4
- package/{chunk-WADCY6G6.js → chunk-6ZWMH6TJ.js} +111 -41
- package/{chunk-ABQYVJBJ.js → chunk-7CHC4W22.js} +1 -1
- package/{chunk-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
- package/{chunk-OA6Q2A4I.js → chunk-A7RSPKU6.js} +98 -22
- package/{chunk-KQ4ONNQD.js → chunk-ALFH24P3.js} +56 -7
- package/{chunk-Q554LLSI.js → chunk-AUDNYVRC.js} +1 -1
- package/{chunk-GPCZ7UXG.js → chunk-AZRHIN5B.js} +1 -1
- package/{chunk-JRQFUXY7.js → chunk-B2XUQXQX.js} +96 -19
- package/{chunk-EGSKXKR5.js → chunk-BJJL5DZF.js} +1 -1
- package/chunk-BMQ2MJUK.js +153 -0
- package/{chunk-XRWZB6CF.js → chunk-BVWTQJAA.js} +23 -76
- package/{chunk-3IIEFNGY.js → chunk-C53ZG23R.js} +2 -2
- package/chunk-CHOZJMJS.js +78 -0
- package/{chunk-HJUYAD4A.js → chunk-CPUFH46E.js} +8 -8
- package/{chunk-LS2ZANRJ.js → chunk-CTUQJVQM.js} +1 -1
- package/{chunk-BP4XNZRM.js → chunk-CU3QB4HW.js} +3 -3
- package/{chunk-ACTMNVHM.js → chunk-CYSYR67N.js} +1 -1
- package/{chunk-VLTIYV3X.js → chunk-DCLMZ5TX.js} +4 -4
- package/{chunk-UKZDAFYT.js → chunk-DSSTTEKI.js} +6 -10
- package/{chunk-HVURBGF3.js → chunk-ESRMFY7G.js} +2 -2
- package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
- package/chunk-GMZLP5DV.js +82 -0
- package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
- package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
- package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
- package/{chunk-H62HCIUP.js → chunk-HYZIYH2H.js} +11 -10
- package/{chunk-MMPXJXHT.js → chunk-HZH7RULB.js} +582 -478
- package/{chunk-NTW5GWDM.js → chunk-I3QNET24.js} +32 -17
- package/{chunk-WV42OMV7.js → chunk-IAESIMK7.js} +4 -4
- package/{chunk-QIAVMDHY.js → chunk-IUVCUGQR.js} +4 -4
- package/{chunk-AFDS2CVM.js → chunk-K5UOP7AI.js} +15 -20
- package/{chunk-IIVGDG4I.js → chunk-LNPYTNMG.js} +8 -4
- package/{chunk-BLJWCTRL.js → chunk-LVITW736.js} +1 -1
- package/chunk-LYS4T7MY.js +7600 -0
- package/{chunk-76WEAXJB.js → chunk-M3LRSBOX.js} +18 -15
- package/{chunk-7S4YWN7P.js → chunk-MX574M24.js} +1 -1
- package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
- package/{chunk-53HEEOTT.js → chunk-O26PCYLS.js} +80 -13
- package/{chunk-3DII57IT.js → chunk-O2OWEFII.js} +1 -1
- package/chunk-OCZKATRC.js +129 -0
- package/{chunk-6D6VBVEW.js → chunk-OTEMQQZI.js} +80 -14
- package/chunk-P6GMCCAT.js +870 -0
- package/{chunk-CPH3W5A7.js → chunk-Q4GP72HX.js} +94 -3
- package/{chunk-A6G32FNX.js → chunk-QYFBT4CV.js} +13 -13
- package/{chunk-Z77CRGTW.js → chunk-R4SQ3LGW.js} +1 -1
- package/{chunk-DEUUPHOO.js → chunk-RKGKDQGJ.js} +74 -17
- package/{chunk-ZXKVPF4K.js → chunk-RQNHAVSR.js} +236 -36
- package/{chunk-LLT642J4.js → chunk-RS4XOX6Y.js} +24 -5
- package/{chunk-V4MJDUSR.js → chunk-RSEEDUMS.js} +2 -2
- package/{chunk-UZGQNTVW.js → chunk-S5XGT6GB.js} +5 -3
- package/{chunk-AFUORTY4.js → chunk-SONWNI3L.js} +21 -21
- package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
- package/{chunk-OF7AQZUG.js → chunk-TU5NE4U3.js} +9 -84
- package/chunk-TY3TIUJK.js +89 -0
- package/chunk-UNYJU5L6.js +780 -0
- package/{chunk-J4MOO56S.js → chunk-UQNS32WZ.js} +10 -2
- package/chunk-VIWDGTDA.js +8 -0
- package/chunk-VJVNU77E.js +83 -0
- package/{chunk-JAXOVNM4.js → chunk-WILHZY7K.js} +45 -45
- package/{chunk-BGSLKVCP.js → chunk-WIU4KIBL.js} +6 -7
- package/{chunk-UKWGR5SS.js → chunk-WIWM4FE3.js} +187 -398
- package/{chunk-O6OSWFZQ.js → chunk-XUWRURDF.js} +6 -0
- package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
- package/{chunk-SH43IESU.js → chunk-YUNJN43V.js} +44 -9
- package/{chunk-TOP2VXOR.js → chunk-Z4CSIXYP.js} +2 -2
- package/{chunk-2F7RJC6L.js → chunk-ZOVKKMF6.js} +1 -1
- package/chunk-ZRAU6T47.js +56 -0
- package/commandRegistry-ESFYIRF4.js +833 -0
- package/{contentThunks-PT23JWJX.js → contentThunks-ECQ6KK3I.js} +32 -30
- package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
- package/{createAgentAutomationAction-N27SYTLU.js → createAgentAutomationAction-6EES5YQO.js} +32 -30
- package/{createDialogAction-XZPLHD5G.js → createDialogAction-JTKMM4VG.js} +36 -33
- package/{createPageAction-KHVJQ3CS.js → createPageAction-WQZTMGAG.js} +38 -36
- package/{chunk-3SJQXXGY.js → cursorProvider-YGGNMVWX.js} +2560 -9879
- package/{dbSlice-XVWBAGYN.js → dbSlice-DQ32LYTJ.js} +8 -8
- package/{deleteFile-YG6QMJLU.js → deleteFile-NX6QHCWZ.js} +3 -3
- package/{dialogCommands-ZUWW5UT6.js → dialogCommands-XXZH5K6U.js} +45 -41
- package/{dialogSlice-3YH242HS.js → dialogSlice-I6GN3I5B.js} +36 -29
- package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
- package/{docCreateCommands-Q6FADDSJ.js → docCreateCommands-FLNUDWG6.js} +44 -40
- package/{docDeleteCommands-ZKIH54PZ.js → docDeleteCommands-74OURFAB.js} +44 -40
- package/{docReadCommands-7BZT2QTW.js → docReadCommands-QENWDQVH.js} +43 -39
- package/{docStore-YSZRNUUD.js → docStore-B2ZM4PCR.js} +11 -10
- package/{docUpdateCommands-WJXWTRL7.js → docUpdateCommands-J4HWJ5JO.js} +44 -40
- package/{fetchMessages-EIU7UFFK.js → fetchMessages-67MEFPZR.js} +2 -2
- package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +3 -3
- package/{handleSendMessageAction-KJO2QDBM.js → handleSendMessageAction-BAUWHASB.js} +91 -83
- package/index.js +87 -884
- package/{localDialogRead-BTFJ4V2I.js → localDialogRead-EBRS242U.js} +2 -2
- package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-5W6IJRAD.js} +6 -6
- package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-3LRMNLCM.js} +1 -1
- package/{machineCommands-QC4TD7GJ.js → machineCommands-SG3QGVOP.js} +84 -77
- package/{machineWsRunDispatch-XUOIAXO7.js → machineWsRunDispatch-RTFT3ZDL.js} +81 -74
- package/{memberThunks-QGFLFVCI.js → memberThunks-5ZXPR63F.js} +9 -9
- package/{models-T3SG6MJ5.js → models-ZPU5EDF4.js} +2 -2
- package/oauthTokenStore-ITEB663N.js +23 -0
- package/package.json +1 -1
- package/pdf-U6KSUEZZ.js +26435 -0
- package/processSpawn-SOAV3FEV.js +11 -0
- package/profileConfig-ZGOFORWV.js +43 -0
- package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-DD6NGWW6.js} +7 -7
- package/{providerRegistry-757OWH3O.js → providerRegistry-XDRLMYGJ.js} +7 -7
- package/{read-COE3ZYR6.js → read-EPTJRAEF.js} +5 -5
- package/{readDocTool-5USN4A6V.js → readDocTool-W4NDXNEX.js} +5 -3
- package/{readlineWorkspace-74TXXSLO.js → readlineWorkspace-MCNBLA56.js} +2449 -2022
- package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-BVAWQKXE.js} +17 -19
- package/{runAgentClientLoop-37BXJD62.js → runAgentClientLoop-XDPBFXV2.js} +61 -58
- package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-3USD722U.js} +3 -3
- package/runtimeModeArgs-2Y7BALTO.js +31 -0
- package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-LYY45IAD.js} +12 -11
- package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-73IL7DLU.js} +18 -20
- package/{settingSlice-ZQZVUPKK.js → settingSlice-Q6EKL7EQ.js} +9 -9
- package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
- package/{spaceCommands-P3ONT6LL.js → spaceCommands-BYDGOMW7.js} +44 -40
- package/{streamAgentChatTurn-FGXQXALU.js → streamAgentChatTurn-BBH3QDEZ.js} +183 -91
- package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-UUXDSQ6X.js} +15 -17
- package/{tableCommands-O6NWHFKV.js → tableCommands-G7RV3RU3.js} +4 -4
- package/{toolApiClient-QVJ6HDNN.js → toolApiClient-INIQCPGY.js} +3 -3
- package/{tools-R5UF2KZO.js → tools-OQWSBQJA.js} +54 -51
- package/{tuiSummaryLlmCaller-T2SHYMDZ.js → tuiSummaryLlmCaller-74NRRLVW.js} +18 -16
- package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
- package/{updateDialogTitleAction-RTADGV7A.js → updateDialogTitleAction-E25IG3J3.js} +81 -43
- package/agentRecordCommands-SIPURU2S.js +0 -128
- package/chunk-FOWEGIMF.js +0 -18881
- package/chunk-M76ECQRD.js +0 -13658
- package/chunk-Q5FJJ6XI.js +0 -103
- package/chunk-S7Z2HMCN.js +0 -25
- package/{chunk-VMFTFOWF.js → chunk-3AH7LNUB.js} +7 -7
- package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
- package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAgentRunTerminalStatus
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-I3QNET24.js";
|
|
4
4
|
import {
|
|
5
5
|
isCompiledBinary,
|
|
6
6
|
resolveCliEntrypointPath
|
|
@@ -11,6 +11,60 @@ import { homedir as nodeHomedir } from "node:os";
|
|
|
11
11
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
12
12
|
import * as nodeFs from "node:fs";
|
|
13
13
|
import { execFileSync as nodeExecFileSync, spawn as nodeSpawn } from "node:child_process";
|
|
14
|
+
|
|
15
|
+
// packages/ai/tools/agent/runFailureClass.ts
|
|
16
|
+
var RATE_LIMIT_PATTERN = /429|rate.?limit|quota|insufficient.?balance|UPSTREAM_402|cooling|冷却/i;
|
|
17
|
+
var PROVIDER_ERROR_PATTERN = /provider|upstream|5\d\d|bad.?gateway|service.?unavailable|overloaded/i;
|
|
18
|
+
var MALFORMED_PATTERN = /MALFORMED_FUNCTION_CALL|malformed|invalid.?function.?call|invalid.?tool.?call/i;
|
|
19
|
+
var STALLED_PATTERN = /stall|no.?progress|repetition|stagnant|无进展|卡死/i;
|
|
20
|
+
var TOOL_ERROR_PATTERN = /tool.?error|tool.?fail|工具/i;
|
|
21
|
+
function classifyRunFailure(input) {
|
|
22
|
+
const status = typeof input.status === "string" ? input.status : "";
|
|
23
|
+
if (status === "done" || status === "killed" || status === "cancelled") {
|
|
24
|
+
return void 0;
|
|
25
|
+
}
|
|
26
|
+
const reason = typeof input.failureReason === "string" ? input.failureReason : "";
|
|
27
|
+
const message = typeof input.errorMessage === "string" ? input.errorMessage : "";
|
|
28
|
+
switch (reason) {
|
|
29
|
+
case "provider_rate_limited":
|
|
30
|
+
return { failureClass: "rate_limited", retryable: true };
|
|
31
|
+
case "provider_error":
|
|
32
|
+
return MALFORMED_PATTERN.test(message) ? { failureClass: "provider_error", retryable: false } : { failureClass: "provider_error", retryable: true };
|
|
33
|
+
case "stalled":
|
|
34
|
+
return { failureClass: "stalled", retryable: false };
|
|
35
|
+
case "tool_error":
|
|
36
|
+
return { failureClass: "tool_error", retryable: false };
|
|
37
|
+
case "config_unresolved":
|
|
38
|
+
return { failureClass: "unknown", retryable: false };
|
|
39
|
+
case "cancelled":
|
|
40
|
+
return void 0;
|
|
41
|
+
default:
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
if (message) {
|
|
45
|
+
if (RATE_LIMIT_PATTERN.test(message)) {
|
|
46
|
+
return { failureClass: "rate_limited", retryable: true };
|
|
47
|
+
}
|
|
48
|
+
if (MALFORMED_PATTERN.test(message)) {
|
|
49
|
+
return { failureClass: "provider_error", retryable: false };
|
|
50
|
+
}
|
|
51
|
+
if (STALLED_PATTERN.test(message)) {
|
|
52
|
+
return { failureClass: "stalled", retryable: false };
|
|
53
|
+
}
|
|
54
|
+
if (TOOL_ERROR_PATTERN.test(message)) {
|
|
55
|
+
return { failureClass: "tool_error", retryable: false };
|
|
56
|
+
}
|
|
57
|
+
if (PROVIDER_ERROR_PATTERN.test(message)) {
|
|
58
|
+
return { failureClass: "provider_error", retryable: true };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (status === "failed" || status === "timeout" || status === "orphaned") {
|
|
62
|
+
return { failureClass: "unknown", retryable: false };
|
|
63
|
+
}
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// packages/cli/agentRunControl.ts
|
|
14
68
|
var RUN_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
15
69
|
"done",
|
|
16
70
|
"failed",
|
|
@@ -794,6 +848,7 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
|
|
|
794
848
|
logPath,
|
|
795
849
|
queuePath,
|
|
796
850
|
batchId,
|
|
851
|
+
...typeof input.credentialGroup === "string" && input.credentialGroup.trim() ? { credentialGroup: input.credentialGroup.trim() } : {},
|
|
797
852
|
...typeof input.parentDialogId === "string" && input.parentDialogId.trim() ? { parentDialogId: input.parentDialogId.trim() } : {},
|
|
798
853
|
...dodCommands && dodCommands.length > 0 ? { dodCommands } : {},
|
|
799
854
|
...spawnHead ? { spawnHead } : {},
|
|
@@ -925,6 +980,15 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
|
|
|
925
980
|
} else if (update.status === "killed") {
|
|
926
981
|
record2.failureReason = "cancelled";
|
|
927
982
|
}
|
|
983
|
+
const classification = classifyRunFailure({
|
|
984
|
+
status: update.status,
|
|
985
|
+
failureReason: record2.failureReason,
|
|
986
|
+
errorMessage: update.note ?? record2.note
|
|
987
|
+
});
|
|
988
|
+
if (classification) {
|
|
989
|
+
record2.failureClass = classification.failureClass;
|
|
990
|
+
record2.retryable = classification.retryable;
|
|
991
|
+
}
|
|
928
992
|
const resolvedToolCount = typeof update.toolCallCount === "number" ? update.toolCallCount : record2.activity?.counters?.toolCalls;
|
|
929
993
|
if (typeof resolvedToolCount === "number") {
|
|
930
994
|
record2.toolCallCount = resolvedToolCount;
|
|
@@ -1044,6 +1108,15 @@ function checkStaleRun(runId, deps = {}) {
|
|
|
1044
1108
|
const at = now().toISOString();
|
|
1045
1109
|
latest.status = "orphaned";
|
|
1046
1110
|
latest.note = pidReused ? "orphaned: process gone (pid reused by another process)" : "orphaned: process gone without writing terminal status";
|
|
1111
|
+
const orphanClassification = classifyRunFailure({
|
|
1112
|
+
status: "orphaned",
|
|
1113
|
+
failureReason: latest.failureReason,
|
|
1114
|
+
errorMessage: latest.note
|
|
1115
|
+
});
|
|
1116
|
+
if (orphanClassification) {
|
|
1117
|
+
latest.failureClass = orphanClassification.failureClass;
|
|
1118
|
+
latest.retryable = orphanClassification.retryable;
|
|
1119
|
+
}
|
|
1047
1120
|
latest.endedAt = at;
|
|
1048
1121
|
latest.reconciledAt = at;
|
|
1049
1122
|
latest.pid = void 0;
|
|
@@ -1259,6 +1332,18 @@ function printStatusOnce(record, deps) {
|
|
|
1259
1332
|
}
|
|
1260
1333
|
if (record.note) deps.output.write(`note: ${record.note}
|
|
1261
1334
|
`);
|
|
1335
|
+
if (record.failureReason) deps.output.write(`failure: ${record.failureReason}
|
|
1336
|
+
`);
|
|
1337
|
+
if (record.failureClass) {
|
|
1338
|
+
deps.output.write(
|
|
1339
|
+
`class: ${record.failureClass}${typeof record.retryable === "boolean" ? ` (retryable=${record.retryable})` : ""}
|
|
1340
|
+
`
|
|
1341
|
+
);
|
|
1342
|
+
}
|
|
1343
|
+
if (record.credentialGroup) {
|
|
1344
|
+
deps.output.write(`credGroup: ${record.credentialGroup}
|
|
1345
|
+
`);
|
|
1346
|
+
}
|
|
1262
1347
|
const activitySummary = formatActivitySummary(record.activity);
|
|
1263
1348
|
if (activitySummary) deps.output.write(`${activitySummary}
|
|
1264
1349
|
`);
|
|
@@ -1388,14 +1473,20 @@ async function terminateRunProcess(record, initialSignal, deps) {
|
|
|
1388
1473
|
signalGroup(initialSignal);
|
|
1389
1474
|
if (initialSignal === "SIGTERM") {
|
|
1390
1475
|
const deadline = nowMs() + TERMINATE_GRACE_MS;
|
|
1391
|
-
|
|
1476
|
+
const maxIterations = Math.ceil(TERMINATE_GRACE_MS / TERMINATE_POLL_MS) + 1;
|
|
1477
|
+
let iterations = 0;
|
|
1478
|
+
while (!isPidGone(pid, deps) && nowMs() < deadline && iterations < maxIterations) {
|
|
1479
|
+
iterations += 1;
|
|
1392
1480
|
await sleep(TERMINATE_POLL_MS);
|
|
1393
1481
|
}
|
|
1394
1482
|
}
|
|
1395
1483
|
if (!isPidGone(pid, deps)) {
|
|
1396
1484
|
signalGroup("SIGKILL");
|
|
1397
1485
|
const killDeadline = nowMs() + TERMINATE_KILL_GRACE_MS;
|
|
1398
|
-
|
|
1486
|
+
const maxIterations = Math.ceil(TERMINATE_KILL_GRACE_MS / TERMINATE_POLL_MS) + 1;
|
|
1487
|
+
let iterations = 0;
|
|
1488
|
+
while (!isPidGone(pid, deps) && nowMs() < killDeadline && iterations < maxIterations) {
|
|
1489
|
+
iterations += 1;
|
|
1399
1490
|
await sleep(TERMINATE_POLL_MS);
|
|
1400
1491
|
}
|
|
1401
1492
|
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCliLocalRuntimeAdapter,
|
|
3
3
|
summarizeEndpoint
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LYS4T7MY.js";
|
|
5
5
|
import {
|
|
6
6
|
clipMultilineText
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HZH7RULB.js";
|
|
8
8
|
import {
|
|
9
9
|
runLocalAgentTurn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6IHBIRPK.js";
|
|
11
11
|
import {
|
|
12
12
|
applyToolSurfaceConstraints
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-LNPYTNMG.js";
|
|
14
14
|
import {
|
|
15
15
|
resolveLocalRuntimeEnvFromPolicy
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ESRMFY7G.js";
|
|
17
17
|
import {
|
|
18
18
|
toErrorMessage
|
|
19
19
|
} from "./chunk-HNMXYYJR.js";
|
|
20
|
-
import {
|
|
21
|
-
readPipeText,
|
|
22
|
-
spawnProcess
|
|
23
|
-
} from "./chunk-X7HHHIOZ.js";
|
|
24
20
|
import {
|
|
25
21
|
parseUserIdFromAuthToken
|
|
26
22
|
} from "./chunk-A7GB5UGH.js";
|
|
27
23
|
import {
|
|
28
24
|
DEFAULT_NOLO_SERVER_URL
|
|
29
25
|
} from "./chunk-OLZBQWZU.js";
|
|
26
|
+
import {
|
|
27
|
+
readPipeText,
|
|
28
|
+
spawnProcess
|
|
29
|
+
} from "./chunk-Y6ROFCZO.js";
|
|
30
30
|
import {
|
|
31
31
|
asRecordOrEmpty
|
|
32
32
|
} from "./chunk-KX6YBIHG.js";
|
|
33
33
|
import {
|
|
34
34
|
asTrimmedNonEmptyStringArray
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import {
|
|
37
|
-
ownedAgentKey
|
|
38
|
-
} from "./chunk-M2EJHDJP.js";
|
|
35
|
+
} from "./chunk-3AH7LNUB.js";
|
|
39
36
|
import {
|
|
40
37
|
isRecord
|
|
41
38
|
} from "./chunk-KUG52IAP.js";
|
|
39
|
+
import {
|
|
40
|
+
ownedAgentKey
|
|
41
|
+
} from "./chunk-M2EJHDJP.js";
|
|
42
42
|
import {
|
|
43
43
|
asTrimmedString
|
|
44
44
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LVITW736.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-M3LRSBOX.js";
|
|
8
8
|
import {
|
|
9
|
-
deriveCredentialGroup
|
|
10
|
-
|
|
11
|
-
} from "./chunk-IAO6JBYW.js";
|
|
9
|
+
deriveCredentialGroup
|
|
10
|
+
} from "./chunk-5B7XS6UO.js";
|
|
12
11
|
import {
|
|
13
12
|
PUBLIC_AGENT_KEY_PREFIX,
|
|
14
|
-
isOwnedAgentKey,
|
|
15
13
|
ownedAgentKey,
|
|
16
14
|
ownedAgentKeyPrefix,
|
|
17
15
|
parseOwnedAgentId,
|
|
@@ -67,16 +65,10 @@ function normalizeListedAgent(record) {
|
|
|
67
65
|
...credentialKind !== void 0 ? { credentialKind } : {},
|
|
68
66
|
...typeof record?.apiSource === "string" && record.apiSource ? { apiSource: record.apiSource } : {},
|
|
69
67
|
...typeof record?.cliProvider === "string" && record.cliProvider ? { cliProvider: record.cliProvider } : {},
|
|
70
|
-
...typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? { nextAvailableAt: record.nextAvailableAt } : {}
|
|
68
|
+
...typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? { nextAvailableAt: record.nextAvailableAt } : {},
|
|
69
|
+
...record?.quota && typeof record.quota === "object" && Array.isArray(record.quota.windows) ? { quota: record.quota } : {}
|
|
71
70
|
};
|
|
72
71
|
}
|
|
73
|
-
function toSafeListedAgentSummary(agent, options) {
|
|
74
|
-
const summary = toSafeAgentSummary(agent, options);
|
|
75
|
-
if (agent.publicRecordExists === false) {
|
|
76
|
-
delete summary.publicKey;
|
|
77
|
-
}
|
|
78
|
-
return summary;
|
|
79
|
-
}
|
|
80
72
|
function sortListedAgents(agents) {
|
|
81
73
|
agents.sort((a, b) => {
|
|
82
74
|
const ta = a.updatedAt == null ? 0 : new Date(a.updatedAt).getTime();
|
|
@@ -97,6 +89,7 @@ function parseAgentListArgs(args) {
|
|
|
97
89
|
publicOnly: args.includes("--public-only"),
|
|
98
90
|
idsOnly: args.includes("--ids-only"),
|
|
99
91
|
scope: readArgValue(args, "--scope"),
|
|
92
|
+
query: readArgValue(args, "--query"),
|
|
100
93
|
showUnavailable: args.includes("--show-unavailable"),
|
|
101
94
|
// --safe 默认输出精简投影(与 server listAgents 一致,防大列表被截断);
|
|
102
95
|
// --verbose 拿回完整字段集排障。
|
|
@@ -110,7 +103,7 @@ async function listLocalCachedAgents(args) {
|
|
|
110
103
|
for (const prefix of [ownedPrefix, PUBLIC_AGENT_KEY_PREFIX]) {
|
|
111
104
|
for await (const [key, value] of args.db.iterator({ gte: prefix, lte: `${prefix}\uFFFF` })) {
|
|
112
105
|
if (typeof key !== "string" || !value || typeof value !== "object") continue;
|
|
113
|
-
if (
|
|
106
|
+
if (key.startsWith(ownedPrefix)) {
|
|
114
107
|
privateRecords.set(key, { ...value, dbKey: key });
|
|
115
108
|
continue;
|
|
116
109
|
}
|
|
@@ -237,14 +230,78 @@ async function decorateAgentsWithPublicStatusAcrossServers(args) {
|
|
|
237
230
|
return args.agents;
|
|
238
231
|
}
|
|
239
232
|
|
|
233
|
+
// packages/ai/agent/quotaSnapshot.ts
|
|
234
|
+
function findTightestQuotaWindow(quota, now = Date.now()) {
|
|
235
|
+
if (!quota || !Array.isArray(quota.windows) || quota.windows.length === 0) {
|
|
236
|
+
return void 0;
|
|
237
|
+
}
|
|
238
|
+
let best;
|
|
239
|
+
let bestScore = -Infinity;
|
|
240
|
+
for (const w of quota.windows) {
|
|
241
|
+
let score = 0;
|
|
242
|
+
if (typeof w.utilization === "number" && w.utilization >= 0) {
|
|
243
|
+
score = 500 + Math.min(w.utilization, 1) * 500;
|
|
244
|
+
} else if (typeof w.remaining === "number" && typeof w.limit === "number" && w.limit > 0) {
|
|
245
|
+
const util = Math.max(0, 1 - w.remaining / w.limit);
|
|
246
|
+
score = 500 + util * 500;
|
|
247
|
+
} else if (typeof w.resetAt === "number" && w.resetAt > now) {
|
|
248
|
+
score = 200;
|
|
249
|
+
} else if (typeof w.remaining === "number") {
|
|
250
|
+
score = 100;
|
|
251
|
+
}
|
|
252
|
+
if (score > bestScore) {
|
|
253
|
+
bestScore = score;
|
|
254
|
+
best = w;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return best ?? quota.windows[0];
|
|
258
|
+
}
|
|
259
|
+
function formatQuotaSummary(quota, now = Date.now(), options) {
|
|
260
|
+
const tightest = findTightestQuotaWindow(quota, now);
|
|
261
|
+
if (!tightest) return void 0;
|
|
262
|
+
const compact = options?.compact === true;
|
|
263
|
+
const parts = [];
|
|
264
|
+
if (typeof tightest.utilization === "number") {
|
|
265
|
+
const pct = Math.round(tightest.utilization * 100);
|
|
266
|
+
parts.push(`${pct}%\u5DF2\u7528`);
|
|
267
|
+
} else if (typeof tightest.remaining === "number") {
|
|
268
|
+
if (typeof tightest.limit === "number") {
|
|
269
|
+
parts.push(`${tightest.remaining}/${tightest.limit}${tightest.unit ? ` ${tightest.unit}` : ""}`);
|
|
270
|
+
} else {
|
|
271
|
+
parts.push(`\u4F59${tightest.remaining}${tightest.unit ? ` ${tightest.unit}` : ""}`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (compact) return parts.length > 0 ? parts[0] : void 0;
|
|
275
|
+
if (tightest.scope && tightest.scope !== "user" && tightest.scope !== "project" && tightest.scope !== tightest.unit) {
|
|
276
|
+
parts.push(tightest.scope);
|
|
277
|
+
}
|
|
278
|
+
if (typeof tightest.resetAt === "number" && tightest.resetAt > now) {
|
|
279
|
+
const diffSec = Math.round((tightest.resetAt - now) / 1e3);
|
|
280
|
+
if (diffSec < 60) {
|
|
281
|
+
parts.push(`${diffSec}s\u540E\u91CD\u7F6E`);
|
|
282
|
+
} else if (diffSec < 3600) {
|
|
283
|
+
parts.push(`${Math.round(diffSec / 60)}m\u540E\u91CD\u7F6E`);
|
|
284
|
+
} else if (diffSec < 86400) {
|
|
285
|
+
const hours = (diffSec / 3600).toFixed(1).replace(/\.0$/, "");
|
|
286
|
+
parts.push(`${hours}h\u540E\u91CD\u7F6E`);
|
|
287
|
+
} else {
|
|
288
|
+
const days = (diffSec / 86400).toFixed(1).replace(/\.0$/, "");
|
|
289
|
+
parts.push(`${days}d\u540E\u91CD\u7F6E`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (parts.length === 0) return void 0;
|
|
293
|
+
if (parts.length === 1 && parts[0] === tightest.scope) return void 0;
|
|
294
|
+
return parts.join(" \xB7 ");
|
|
295
|
+
}
|
|
296
|
+
|
|
240
297
|
export {
|
|
241
298
|
normalizeListedAgent,
|
|
242
|
-
toSafeListedAgentSummary,
|
|
243
299
|
parseAgentListArgs,
|
|
244
300
|
listLocalCachedAgents,
|
|
245
301
|
listRemotePublicAgents,
|
|
246
302
|
listRemoteAgents,
|
|
247
303
|
listRemoteAgentsAcrossServers,
|
|
248
304
|
listFavoriteAgentIdsAcrossServers,
|
|
249
|
-
decorateAgentsWithPublicStatusAcrossServers
|
|
305
|
+
decorateAgentsWithPublicStatusAcrossServers,
|
|
306
|
+
formatQuotaSummary
|
|
250
307
|
};
|