nolo-cli 0.164.0-alpha.5 → 0.166.0-alpha.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/{_executeModel-M5PGAD3Z.js → _executeModel-XPCZ5RBB.js} +21 -21
- package/{accountResolver-55EDKEIK.js → accountResolver-JS7QDNNL.js} +1 -1
- package/{agentDeleteCommand-FNLCIWA7.js → agentDeleteCommand-OGJISSU7.js} +27 -27
- package/{agentEmailCommands-SBPLOOIY.js → agentEmailCommands-XGD4KL64.js} +28 -28
- package/{agentListCommands-GOCGOQUB.js → agentListCommands-34W3Q23M.js} +44 -21
- package/{agentMachineCommands-L7NY3BCY.js → agentMachineCommands-BFAPCDL5.js} +14 -14
- package/{agentRecordCommands-GHQNXIVM.js → agentRecordCommands-IHO3IDQK.js} +27 -27
- package/{agentRunCommand-2QU75CBD.js → agentRunCommand-MQGSEJPR.js} +28 -28
- package/{agentRuntimeLocal-J6I63NZC.js → agentRuntimeLocal-3EDL6FJP.js} +11 -11
- package/{agentSlice-JOVX3KY3.js → agentSlice-FHAWX2N7.js} +1 -1
- package/{appDeleteCommands-KKLAK2UR.js → appDeleteCommands-4NDA5UOW.js} +16 -16
- package/{appDeployCommands-PXWK4FAX.js → appDeployCommands-ST3R26X3.js} +16 -16
- package/{appDeployStatusCommands-3NGWDZTX.js → appDeployStatusCommands-7NARROTP.js} +16 -16
- package/{appGetCommands-APWYPEO3.js → appGetCommands-BWJF2GVT.js} +16 -16
- package/{appListCommands-OP7IRALO.js → appListCommands-KHC5STHO.js} +16 -16
- package/{authCommand-3Z52KJID.js → authCommand-OVBMDPIF.js} +1 -1
- package/{chunk-YTWGTCVW.js → chunk-3WYHEMHF.js} +14 -14
- package/{chunk-N665S3Z2.js → chunk-4M5NB6HV.js} +2 -2
- package/{chunk-MLEANT7D.js → chunk-6HAE54KH.js} +2 -2
- package/{chunk-L2JMH4I5.js → chunk-6LYCXISC.js} +6 -3
- package/{chunk-QXZH5UDF.js → chunk-7NKZA46B.js} +2 -2
- package/{chunk-QA2C5NKI.js → chunk-ASSNAASW.js} +1 -1
- package/{chunk-U34KT53V.js → chunk-BSKTDOGA.js} +6 -2
- package/{chunk-IPQ3W3CZ.js → chunk-BWLTQSBQ.js} +10 -10
- package/{chunk-ULQAD7ZY.js → chunk-CEXJ6Y3C.js} +1 -1
- package/{chunk-4L4K6YR7.js → chunk-DI7ZFGDQ.js} +1 -1
- package/{chunk-ZU4J4GRW.js → chunk-E3J37BFW.js} +3 -3
- package/{chunk-EFGBXVOC.js → chunk-ENZVVNIQ.js} +2 -2
- package/{chunk-DE3RG4GV.js → chunk-FVKOS527.js} +2 -2
- package/{chunk-5E5VB7PS.js → chunk-GHG5ONT5.js} +10 -9
- package/{chunk-YVPQATSC.js → chunk-GPLUFN2E.js} +7 -1
- package/{chunk-3N5VQFR7.js → chunk-GSKYA637.js} +2 -2
- package/{chunk-Y2UYLA5L.js → chunk-GVT4GTDD.js} +5 -5
- package/{chunk-TDMS3H4D.js → chunk-H3THOSSL.js} +3 -3
- package/{chunk-F3SOW2EU.js → chunk-HEC32F3G.js} +1 -1
- package/{chunk-W7FGZRLK.js → chunk-I72LPLCP.js} +1 -1
- package/{chunk-JGXBS3CI.js → chunk-JB7B7EH3.js} +8 -8
- package/chunk-JLR5NWP2.js +548 -0
- package/{chunk-ZZDVBZOP.js → chunk-K3NJW7LY.js} +6 -4
- package/{chunk-CNWKLQRL.js → chunk-KSTEXKL6.js} +70 -36
- package/{chunk-5IKRTRRR.js → chunk-MCGCC5BA.js} +1 -1
- package/{chunk-GVGQKI6E.js → chunk-MV2VYO4L.js} +85 -33
- package/{chunk-35CEDQD6.js → chunk-P3JTVV3J.js} +139 -29
- package/{chunk-RBMYJSZF.js → chunk-P46JXWXJ.js} +2 -2
- package/{chunk-647HBTHJ.js → chunk-QPW5KIX3.js} +2 -2
- package/{chunk-6MXDOUMH.js → chunk-R4BMKAR5.js} +70 -8
- package/{chunk-TT644UJD.js → chunk-SAZSXMTR.js} +1 -1
- package/{chunk-3M52COK5.js → chunk-SLAZGVZN.js} +71 -3
- package/{chunk-ZMVXHANW.js → chunk-STFIUL6J.js} +1 -1
- package/{chunk-2AB2HA4M.js → chunk-TDX2L4W2.js} +8 -2
- package/{chunk-DJ2BOPJY.js → chunk-TQGP2LAX.js} +1 -1
- package/{chunk-2MWKM3NP.js → chunk-UCQ6TM4H.js} +5 -5
- package/{chunk-OC72ZET2.js → chunk-V2KGGU2X.js} +10 -10
- package/{chunk-ZKBZLQTG.js → chunk-XGJTJIMA.js} +3 -3
- package/{chunk-WYJTNSVL.js → chunk-XKVWXU6D.js} +35 -4
- package/{chunk-BL4HFN6L.js → chunk-YL26TH2V.js} +1 -1
- package/{chunk-4JCAW7TO.js → chunk-Z2LMCNOD.js} +2 -2
- package/{commandRegistry-6VNTR43G.js → commandRegistry-QCIEJGYN.js} +49 -49
- package/{contentThunks-7JLGMPNX.js → contentThunks-Y5PIKT2D.js} +5 -5
- package/{cooldownCommands-JFKTYS2D.js → cooldownCommands-NS63RGBO.js} +2 -2
- package/{createAgentAutomationAction-WSQ3VZ3X.js → createAgentAutomationAction-ZAMCZGS3.js} +5 -5
- package/{createDialogAction-4SHMWQYD.js → createDialogAction-RRSAGTPA.js} +6 -6
- package/{createPageAction-GHYKDASE.js → createPageAction-QQTGDZGC.js} +6 -6
- package/{dialogCommands-3W6AIUXT.js → dialogCommands-4ONUY3PM.js} +15 -15
- package/{dialogSlice-YXRGO7UV.js → dialogSlice-PS42ZUMV.js} +4 -4
- package/{docCreateCommands-KQHQNLRX.js → docCreateCommands-UMNAXUXH.js} +14 -14
- package/{docDeleteCommands-O3DWFX2W.js → docDeleteCommands-FDG74KV7.js} +15 -15
- package/{docReadCommands-2U2BUONC.js → docReadCommands-YOWFYZF4.js} +14 -14
- package/{docStore-2U6GZMDG.js → docStore-3N4GMKE5.js} +1 -1
- package/{docUpdateCommands-MF3C52XI.js → docUpdateCommands-FRRMAFI2.js} +14 -14
- package/{handleSendMessageAction-SK6Q2N7Z.js → handleSendMessageAction-LQA55M62.js} +24 -11
- package/index.js +4 -4
- package/{localRuntimeAdapter-IIGPBSU6.js → localRuntimeAdapter-4HJXHS3I.js} +27 -25
- package/{machineCommands-2SN3XNMT.js → machineCommands-3C7IFGSE.js} +26 -26
- package/{machineWsRunDispatch-DQE55BK5.js → machineWsRunDispatch-DMEKTEMI.js} +26 -26
- package/package.json +1 -1
- package/{readlineWorkspace-VM35JAR6.js → readlineWorkspace-5PT2F33I.js} +31 -31
- package/{runAgentClientLoop-FR7N5TID.js → runAgentClientLoop-FEG5ZOME.js} +19 -19
- package/{spaceCommands-NDPGHDMD.js → spaceCommands-L3XQIY3J.js} +14 -14
- package/{streamAgentChatTurn-YHZNWDWS.js → streamAgentChatTurn-QD6ARRXS.js} +23 -23
- package/{tools-AEPUZOZ2.js → tools-YQIMXETR.js} +13 -13
- package/{tuiSummaryLlmCaller-FESHBDTT.js → tuiSummaryLlmCaller-FQOEF4IE.js} +3 -3
- package/{updateDialogTitleAction-QERIYNOM.js → updateDialogTitleAction-YEJY2VIX.js} +5 -5
- package/{workloadLifecycle-6O6PMISX.js → workloadLifecycle-MZ2V5L43.js} +1 -1
- package/chunk-3MZAGMYY.js +0 -239
|
@@ -7255,16 +7255,50 @@ var empty = [];
|
|
|
7255
7255
|
var CONTINUE = true;
|
|
7256
7256
|
var EXIT = false;
|
|
7257
7257
|
var SKIP = "skip";
|
|
7258
|
-
function visitParents(tree,
|
|
7258
|
+
function visitParents(tree, testOrEnterOrVisitors, enterOrVisitorsOrReverse, reverse) {
|
|
7259
|
+
if (!tree || typeof tree !== "object") {
|
|
7260
|
+
throw new Error("Unexpected value `" + tree + "` for `tree`, expected node");
|
|
7261
|
+
}
|
|
7262
|
+
let preorder = true;
|
|
7259
7263
|
let check;
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7264
|
+
let visitors;
|
|
7265
|
+
let enter;
|
|
7266
|
+
let exit3;
|
|
7267
|
+
if (typeof enterOrVisitorsOrReverse === "function" || enterOrVisitorsOrReverse && typeof enterOrVisitorsOrReverse === "object") {
|
|
7268
|
+
check = /** @type {Test} */
|
|
7269
|
+
testOrEnterOrVisitors;
|
|
7270
|
+
visitors = enterOrVisitorsOrReverse;
|
|
7271
|
+
if (reverse) preorder = false;
|
|
7272
|
+
} else {
|
|
7273
|
+
visitors = /** @type {Visitors | Visitor} */
|
|
7274
|
+
testOrEnterOrVisitors;
|
|
7275
|
+
if (enterOrVisitorsOrReverse) preorder = false;
|
|
7276
|
+
}
|
|
7277
|
+
if (typeof visitors === "function") {
|
|
7278
|
+
enter = visitors;
|
|
7279
|
+
} else if (visitors && typeof visitors === "object") {
|
|
7280
|
+
if (visitors.enter === null || visitors.enter === void 0) {
|
|
7281
|
+
} else if (typeof visitors.enter === "function") {
|
|
7282
|
+
enter = visitors.enter;
|
|
7283
|
+
} else {
|
|
7284
|
+
throw new Error(
|
|
7285
|
+
"Unexpected value `" + visitors.enter + "` for `visitors.enter`, expected optional visitor"
|
|
7286
|
+
);
|
|
7287
|
+
}
|
|
7288
|
+
if (typeof visitors.exit === "function") {
|
|
7289
|
+
exit3 = visitors.exit;
|
|
7290
|
+
} else {
|
|
7291
|
+
throw new Error(
|
|
7292
|
+
"Unexpected value `" + visitors.exit + "` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)"
|
|
7293
|
+
);
|
|
7294
|
+
}
|
|
7263
7295
|
} else {
|
|
7264
|
-
|
|
7296
|
+
throw new Error(
|
|
7297
|
+
"Unexpected value `" + visitors + "` for `enter` or `visitors`, expected visitor or object with visitors"
|
|
7298
|
+
);
|
|
7265
7299
|
}
|
|
7266
7300
|
const is2 = convert(check);
|
|
7267
|
-
const step =
|
|
7301
|
+
const step = preorder ? 1 : -1;
|
|
7268
7302
|
factory(tree, void 0, [])();
|
|
7269
7303
|
function factory(node2, index2, parents) {
|
|
7270
7304
|
const value = (
|
|
@@ -7285,12 +7319,10 @@ function visitParents(tree, test, visitor, reverse) {
|
|
|
7285
7319
|
}
|
|
7286
7320
|
return visit;
|
|
7287
7321
|
function visit() {
|
|
7322
|
+
const matches = !check || is2(node2, index2, parents[parents.length - 1] || void 0);
|
|
7288
7323
|
let result = empty;
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
let grandparents;
|
|
7292
|
-
if (!test || is2(node2, index2, parents[parents.length - 1] || void 0)) {
|
|
7293
|
-
result = toResult(visitor(node2, parents));
|
|
7324
|
+
if (enter && matches) {
|
|
7325
|
+
result = toResult(enter(node2, parents, index2));
|
|
7294
7326
|
if (result[0] === EXIT) {
|
|
7295
7327
|
return result;
|
|
7296
7328
|
}
|
|
@@ -7301,11 +7333,11 @@ function visitParents(tree, test, visitor, reverse) {
|
|
|
7301
7333
|
node2
|
|
7302
7334
|
);
|
|
7303
7335
|
if (nodeAsParent.children && result[0] !== SKIP) {
|
|
7304
|
-
offset = (
|
|
7305
|
-
grandparents = parents
|
|
7336
|
+
let offset = (preorder ? -1 : nodeAsParent.children.length) + step;
|
|
7337
|
+
const grandparents = [...parents, nodeAsParent];
|
|
7306
7338
|
while (offset > -1 && offset < nodeAsParent.children.length) {
|
|
7307
7339
|
const child = nodeAsParent.children[offset];
|
|
7308
|
-
subresult = factory(child, offset, grandparents)();
|
|
7340
|
+
const subresult = factory(child, offset, grandparents)();
|
|
7309
7341
|
if (subresult[0] === EXIT) {
|
|
7310
7342
|
return subresult;
|
|
7311
7343
|
}
|
|
@@ -7313,6 +7345,17 @@ function visitParents(tree, test, visitor, reverse) {
|
|
|
7313
7345
|
}
|
|
7314
7346
|
}
|
|
7315
7347
|
}
|
|
7348
|
+
if (exit3 && matches) {
|
|
7349
|
+
const exitResult = toResult(exit3(node2, parents, index2));
|
|
7350
|
+
if (exitResult[0] === SKIP) {
|
|
7351
|
+
throw new Error(
|
|
7352
|
+
"Unexpected value `" + exitResult[0] + "` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing"
|
|
7353
|
+
);
|
|
7354
|
+
}
|
|
7355
|
+
if (exitResult[0] === EXIT || typeof exitResult[1] === "number") {
|
|
7356
|
+
return exitResult;
|
|
7357
|
+
}
|
|
7358
|
+
}
|
|
7316
7359
|
return result;
|
|
7317
7360
|
}
|
|
7318
7361
|
}
|
|
@@ -7334,34 +7377,19 @@ function findAndReplace(tree, list2, options) {
|
|
|
7334
7377
|
const pairs = toPairs(list2);
|
|
7335
7378
|
let pairIndex = -1;
|
|
7336
7379
|
while (++pairIndex < pairs.length) {
|
|
7337
|
-
visitParents(tree,
|
|
7380
|
+
visitParents(tree, visitor);
|
|
7338
7381
|
}
|
|
7339
|
-
function visitor(node2, parents) {
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
while (++index2 < parents.length) {
|
|
7343
|
-
const parent = parents[index2];
|
|
7344
|
-
const siblings = grandparent ? grandparent.children : void 0;
|
|
7345
|
-
if (ignored(
|
|
7346
|
-
parent,
|
|
7347
|
-
siblings ? siblings.indexOf(parent) : void 0,
|
|
7348
|
-
grandparent
|
|
7349
|
-
)) {
|
|
7350
|
-
return;
|
|
7351
|
-
}
|
|
7352
|
-
grandparent = parent;
|
|
7353
|
-
}
|
|
7354
|
-
if (grandparent) {
|
|
7355
|
-
return handler(node2, parents);
|
|
7382
|
+
function visitor(node2, parents, index2) {
|
|
7383
|
+
if (node2.type === "text" && typeof index2 === "number") {
|
|
7384
|
+
return handler(node2, parents, index2);
|
|
7356
7385
|
}
|
|
7386
|
+
if (ignored(node2, index2, parents[parents.length - 1])) return SKIP;
|
|
7357
7387
|
}
|
|
7358
|
-
function handler(node2, parents) {
|
|
7388
|
+
function handler(node2, parents, index2) {
|
|
7359
7389
|
const parent = parents[parents.length - 1];
|
|
7360
7390
|
const find = pairs[pairIndex][0];
|
|
7361
7391
|
const replace2 = pairs[pairIndex][1];
|
|
7362
7392
|
let start = 0;
|
|
7363
|
-
const siblings = parent.children;
|
|
7364
|
-
const index2 = siblings.indexOf(node2);
|
|
7365
7393
|
let change = false;
|
|
7366
7394
|
let nodes = [];
|
|
7367
7395
|
find.lastIndex = 0;
|
|
@@ -7420,7 +7448,13 @@ function toPairs(tupleOrList) {
|
|
|
7420
7448
|
throw new TypeError("Expected find and replace tuple or list of tuples");
|
|
7421
7449
|
}
|
|
7422
7450
|
const result = [];
|
|
7423
|
-
const list2 = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ?
|
|
7451
|
+
const list2 = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? (
|
|
7452
|
+
/** @type {FindAndReplaceList} */
|
|
7453
|
+
tupleOrList
|
|
7454
|
+
) : [
|
|
7455
|
+
/** @type {FindAndReplaceTuple} */
|
|
7456
|
+
tupleOrList
|
|
7457
|
+
];
|
|
7424
7458
|
let index2 = -1;
|
|
7425
7459
|
while (++index2 < list2.length) {
|
|
7426
7460
|
const tuple = list2[index2];
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
resolveRawAgentInput,
|
|
10
10
|
resolveServerUrl,
|
|
11
11
|
writeUsage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4M5NB6HV.js";
|
|
13
13
|
import {
|
|
14
14
|
getReadableCliDb
|
|
15
15
|
} from "./chunk-62TBKWTV.js";
|
|
@@ -31,19 +31,19 @@ import {
|
|
|
31
31
|
resolveFileWriteGateEnabled,
|
|
32
32
|
resolveLocalUserId,
|
|
33
33
|
validateInstaboxWorkspaceSelection
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-P3JTVV3J.js";
|
|
35
35
|
import {
|
|
36
36
|
clearCredentialAvailability,
|
|
37
|
-
|
|
37
|
+
readEffectiveCredentialEntry,
|
|
38
38
|
recordCredentialProbe
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-R4BMKAR5.js";
|
|
40
40
|
import {
|
|
41
41
|
agentRunCardLabels,
|
|
42
42
|
getCliLocale,
|
|
43
43
|
t,
|
|
44
44
|
toolLabel,
|
|
45
45
|
toolLabelVariants
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-TDX2L4W2.js";
|
|
47
47
|
import {
|
|
48
48
|
_appendEntityBatch,
|
|
49
49
|
_appendEvidenceBatch,
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
import {
|
|
65
65
|
readDbRecord,
|
|
66
66
|
resolveAgentRecordFromHybridStore
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-MCGCC5BA.js";
|
|
68
68
|
import {
|
|
69
69
|
isLocalCliAgentKey
|
|
70
70
|
} from "./chunk-NBTY7YJF.js";
|
|
@@ -79,14 +79,14 @@ import {
|
|
|
79
79
|
} from "./chunk-BMQ2MJUK.js";
|
|
80
80
|
import {
|
|
81
81
|
resolveCliLocalRuntimeKeyCapability
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-3WYHEMHF.js";
|
|
83
83
|
import {
|
|
84
84
|
isTransientFetchError
|
|
85
85
|
} from "./chunk-KFHREHUQ.js";
|
|
86
86
|
import {
|
|
87
87
|
parseUiCard,
|
|
88
88
|
uiCardFallback
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-P46JXWXJ.js";
|
|
90
90
|
import {
|
|
91
91
|
isGatewayHttpStatus
|
|
92
92
|
} from "./chunk-NF64D32W.js";
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
chooseMemoryOwners,
|
|
96
96
|
loadMemoryCandidatesFromDb,
|
|
97
97
|
resolveAgentMemoryPolicy
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-ENZVVNIQ.js";
|
|
99
99
|
import {
|
|
100
100
|
API_REPORTED_COST_MULTIPLIER,
|
|
101
101
|
estimateMessagesTokens,
|
|
@@ -103,7 +103,7 @@ import {
|
|
|
103
103
|
resolveAgentContextWindow,
|
|
104
104
|
resolveOccupancy,
|
|
105
105
|
resolveOccupancyWindow
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-V2KGGU2X.js";
|
|
107
107
|
import {
|
|
108
108
|
buildSkillDiscoveryContextLayer
|
|
109
109
|
} from "./chunk-AU7AXHUL.js";
|
|
@@ -115,10 +115,10 @@ import {
|
|
|
115
115
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
116
116
|
LOCAL_TURN_ABORTED_CODE,
|
|
117
117
|
readActionGate
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-GHG5ONT5.js";
|
|
119
119
|
import {
|
|
120
120
|
resolveAgentRuntimeConfigFromRecord
|
|
121
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-CEXJ6Y3C.js";
|
|
122
122
|
import {
|
|
123
123
|
createThinkParserState,
|
|
124
124
|
flushThinkParser,
|
|
@@ -133,16 +133,18 @@ import {
|
|
|
133
133
|
import {
|
|
134
134
|
PROBE_INTERVAL_MS,
|
|
135
135
|
QUOTA_ERROR_PATTERNS,
|
|
136
|
+
classifyFailureSubclass,
|
|
137
|
+
isCapacitySaturatedRateLimit,
|
|
136
138
|
isQuotaExhaustedError,
|
|
137
|
-
|
|
139
|
+
isQuotaExhaustedText,
|
|
138
140
|
mergeAvailabilityDeadline,
|
|
139
141
|
resolveCooldownGate,
|
|
140
142
|
resolveCredentialKeyWithFallback
|
|
141
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-JLR5NWP2.js";
|
|
142
144
|
import {
|
|
143
145
|
isOAuthApiKeyRef,
|
|
144
146
|
normalizeUsage
|
|
145
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-HEC32F3G.js";
|
|
146
148
|
import {
|
|
147
149
|
clipCompactText
|
|
148
150
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -11371,7 +11373,7 @@ function isBalanceExhaustedError(error) {
|
|
|
11371
11373
|
|
|
11372
11374
|
// packages/cli/client/agentRun.ts
|
|
11373
11375
|
async function loadRunLocalAgentTurn() {
|
|
11374
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
11376
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-3EDL6FJP.js");
|
|
11375
11377
|
return runLocalAgentTurn;
|
|
11376
11378
|
}
|
|
11377
11379
|
var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
|
|
@@ -11643,7 +11645,7 @@ function looksLikeRateLimitedText(message) {
|
|
|
11643
11645
|
var AUTH_TEXT_SIGNAL_RE = /\b401\b|unauthori[sz]ed|invalid[_\s-]?(?:api[_\s-]?key|token|credential)s?|(?:api[_\s-]?key|token|credential)s?[_\s-](?:invalid|expired|rejected|missing|not[_\s-]?found)|authentication[_\s-]?(?:error|failed|required)/i;
|
|
11644
11646
|
var QUOTA_EXHAUSTED_EXTRA_RE = /insufficient[_\s-]?(?:quota|balance|credits?)|余额不足|额度已?用尽/i;
|
|
11645
11647
|
function looksLikeQuotaExhaustedText(message) {
|
|
11646
|
-
return
|
|
11648
|
+
return isQuotaExhaustedText(message) || QUOTA_EXHAUSTED_EXTRA_RE.test(message);
|
|
11647
11649
|
}
|
|
11648
11650
|
var BARE_UPSTREAM_5XX_RE = /\bHTTP[:\s]+(5\d\d)\b|\bstatus[:\s=]+(5\d\d)\b|\breturned error\s+(5\d\d)\b/i;
|
|
11649
11651
|
function classifyLocalRunError(message) {
|
|
@@ -11890,7 +11892,7 @@ function formatRateLimitResetHint(hint, locale) {
|
|
|
11890
11892
|
return parts.join(" ");
|
|
11891
11893
|
}
|
|
11892
11894
|
function buildRateLimitFailure(ctx) {
|
|
11893
|
-
const headlineKey = ctx.quotaExhausted ? "localRunRateLimitQuota" : "localRunRateLimitThrottled";
|
|
11895
|
+
const headlineKey = isCapacitySaturatedRateLimit(ctx.message, Date.now()) ? "localRunRateLimitCapacity" : ctx.quotaExhausted ? "localRunRateLimitQuota" : "localRunRateLimitThrottled";
|
|
11894
11896
|
const lines = [
|
|
11895
11897
|
t(
|
|
11896
11898
|
headlineKey,
|
|
@@ -12228,8 +12230,15 @@ async function runHttpAgentTurn(options, authToken) {
|
|
|
12228
12230
|
if (options.abortSignal?.aborted) {
|
|
12229
12231
|
return { exitCode: 0, streamInterrupted: true };
|
|
12230
12232
|
}
|
|
12233
|
+
const failureSubclass = classifyFailureSubclass({
|
|
12234
|
+
message: toErrorMessage(error),
|
|
12235
|
+
body: error
|
|
12236
|
+
});
|
|
12231
12237
|
options.output.write(buildTransportErrorHint(options.serverUrl, error));
|
|
12232
|
-
return {
|
|
12238
|
+
return {
|
|
12239
|
+
exitCode: 1,
|
|
12240
|
+
...failureSubclass && failureSubclass !== "unknown" ? { failureSubclass } : {}
|
|
12241
|
+
};
|
|
12233
12242
|
}
|
|
12234
12243
|
if (shouldStream && isGatewayHttpStatus(res.status)) {
|
|
12235
12244
|
const failureMeta = await readAgentRunFailureMetadata(res);
|
|
@@ -12244,8 +12253,15 @@ async function runHttpAgentTurn(options, authToken) {
|
|
|
12244
12253
|
res = await postAgentRun(false);
|
|
12245
12254
|
} catch (error) {
|
|
12246
12255
|
spinner.stop();
|
|
12256
|
+
const failureSubclass = classifyFailureSubclass({
|
|
12257
|
+
message: toErrorMessage(error),
|
|
12258
|
+
body: error
|
|
12259
|
+
});
|
|
12247
12260
|
options.output.write(buildTransportErrorHint(options.serverUrl, error));
|
|
12248
|
-
return {
|
|
12261
|
+
return {
|
|
12262
|
+
exitCode: 1,
|
|
12263
|
+
...failureSubclass && failureSubclass !== "unknown" ? { failureSubclass } : {}
|
|
12264
|
+
};
|
|
12249
12265
|
}
|
|
12250
12266
|
}
|
|
12251
12267
|
}
|
|
@@ -12293,7 +12309,16 @@ async function runHttpAgentTurn(options, authToken) {
|
|
|
12293
12309
|
`
|
|
12294
12310
|
);
|
|
12295
12311
|
}
|
|
12296
|
-
|
|
12312
|
+
const failureSubclass = classifyFailureSubclass({
|
|
12313
|
+
status: res.status,
|
|
12314
|
+
message: `${errorText || messageText} ${reasonText || ""} ${codeText || ""}`.trim(),
|
|
12315
|
+
body: data
|
|
12316
|
+
});
|
|
12317
|
+
return {
|
|
12318
|
+
exitCode: 1,
|
|
12319
|
+
...dialogIdText ? { dialogId: dialogIdText } : {},
|
|
12320
|
+
...failureSubclass && failureSubclass !== "unknown" ? { failureSubclass } : {}
|
|
12321
|
+
};
|
|
12297
12322
|
}
|
|
12298
12323
|
const content = formatAssistantResponseForCli(
|
|
12299
12324
|
String(data?.content ?? data?.message ?? "")
|
|
@@ -12604,6 +12629,10 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
|
|
|
12604
12629
|
return {
|
|
12605
12630
|
exitCode: 1,
|
|
12606
12631
|
localError: error,
|
|
12632
|
+
failureSubclass: classifyFailureSubclass({
|
|
12633
|
+
message: toErrorMessage(error),
|
|
12634
|
+
body: error
|
|
12635
|
+
}),
|
|
12607
12636
|
...savedDialogId ? { dialogId: savedDialogId } : {},
|
|
12608
12637
|
...abortedTurnCredits !== void 0 ? { turnCredits: abortedTurnCredits } : {},
|
|
12609
12638
|
...abortedUsageRecords?.length ? { usageRecords: abortedUsageRecords } : {}
|
|
@@ -12622,7 +12651,9 @@ async function checkLocalAvailabilityBeforeHttpDispatch(options) {
|
|
|
12622
12651
|
}
|
|
12623
12652
|
if (!config || typeof config !== "object") return null;
|
|
12624
12653
|
const baseRecord = config.rawRecord ?? config;
|
|
12625
|
-
let credentialKey = resolveCredentialKeyWithFallback(
|
|
12654
|
+
let credentialKey = resolveCredentialKeyWithFallback(
|
|
12655
|
+
baseRecord.agentKey || baseRecord.key ? baseRecord : { ...baseRecord, agentKey: options.agentKey }
|
|
12656
|
+
);
|
|
12626
12657
|
if (credentialKey && resolveOAuthChannelOwnerSkip(
|
|
12627
12658
|
config,
|
|
12628
12659
|
options
|
|
@@ -12636,19 +12667,30 @@ async function checkLocalAvailabilityBeforeHttpDispatch(options) {
|
|
|
12636
12667
|
}
|
|
12637
12668
|
const env = options.env;
|
|
12638
12669
|
const now = Date.now();
|
|
12639
|
-
|
|
12670
|
+
let entry;
|
|
12671
|
+
let matchedKey;
|
|
12672
|
+
if (credentialKey) {
|
|
12673
|
+
const effective = await readEffectiveCredentialEntry(credentialKey, env, now).catch(() => void 0);
|
|
12674
|
+
if (effective) {
|
|
12675
|
+
entry = effective;
|
|
12676
|
+
matchedKey = effective.matchedKey;
|
|
12677
|
+
}
|
|
12678
|
+
}
|
|
12640
12679
|
const entryAt = entry?.nextAvailableAt;
|
|
12641
12680
|
const effectiveNextAvailableAt = typeof entryAt === "number" ? mergeAvailabilityDeadline(agentLevelNextAvailableAt, entryAt) : agentLevelNextAvailableAt;
|
|
12642
|
-
|
|
12681
|
+
const activeKey = matchedKey || credentialKey;
|
|
12682
|
+
if (typeof effectiveNextAvailableAt !== "number") {
|
|
12683
|
+
return { credentialKey: credentialKey || activeKey, matchedKey };
|
|
12684
|
+
}
|
|
12643
12685
|
const gateDecision = resolveCooldownGate(
|
|
12644
12686
|
{ nextAvailableAt: effectiveNextAvailableAt, lastProbeAt: entry?.lastProbeAt },
|
|
12645
12687
|
now
|
|
12646
12688
|
);
|
|
12647
|
-
if (gateDecision === "probe" &&
|
|
12648
|
-
await recordCredentialProbe(
|
|
12649
|
-
return { credentialKey };
|
|
12689
|
+
if (gateDecision === "probe" && activeKey) {
|
|
12690
|
+
await recordCredentialProbe(activeKey, env, now).catch(() => void 0);
|
|
12691
|
+
return { credentialKey: credentialKey || activeKey, matchedKey };
|
|
12650
12692
|
}
|
|
12651
|
-
if (gateDecision !== "blocked") return { credentialKey };
|
|
12693
|
+
if (gateDecision !== "blocked") return { credentialKey: credentialKey || activeKey, matchedKey };
|
|
12652
12694
|
options.output.write(
|
|
12653
12695
|
`${t(
|
|
12654
12696
|
"agentCooldownBlocked",
|
|
@@ -12659,7 +12701,7 @@ async function checkLocalAvailabilityBeforeHttpDispatch(options) {
|
|
|
12659
12701
|
)}
|
|
12660
12702
|
`
|
|
12661
12703
|
);
|
|
12662
|
-
return { exitCode: 1 };
|
|
12704
|
+
return { exitCode: 1, failureSubclass: "rate_limit" };
|
|
12663
12705
|
}
|
|
12664
12706
|
function foldLocalResultForTui(localResult) {
|
|
12665
12707
|
const folded = {
|
|
@@ -12685,7 +12727,8 @@ function foldLocalResultForTui(localResult) {
|
|
|
12685
12727
|
// 上 finalText 永远到不了结算点 → agentRunCommand 的 settleRunTerminal-
|
|
12686
12728
|
// Authoritatively 拿不到 lastAssistantText → `.result.md` 不写、status 无
|
|
12687
12729
|
// resultFile,编排者只能去啃带 ANSI 的 .log(同坑位历史:turnCredits)。
|
|
12688
|
-
...localResult.finalText ? { finalText: localResult.finalText } : {}
|
|
12730
|
+
...localResult.finalText ? { finalText: localResult.finalText } : {},
|
|
12731
|
+
...localResult.failureSubclass ? { failureSubclass: localResult.failureSubclass } : {}
|
|
12689
12732
|
};
|
|
12690
12733
|
const headerMeta = getRunResultHeaderMeta(localResult);
|
|
12691
12734
|
recordRunResultHeaderMeta(folded, headerMeta);
|
|
@@ -12760,9 +12803,14 @@ async function runAgentTurn(options) {
|
|
|
12760
12803
|
}
|
|
12761
12804
|
}
|
|
12762
12805
|
const localErrorMessage = localResult.localError ? toErrorMessage(localResult.localError) : "local runtime failed";
|
|
12806
|
+
const failureSubclass = localResult.failureSubclass ?? classifyFailureSubclass({
|
|
12807
|
+
message: localErrorMessage,
|
|
12808
|
+
body: localResult.localError
|
|
12809
|
+
});
|
|
12763
12810
|
options.output.write(describeLocalRunFailure(localErrorMessage, localResult.localError));
|
|
12764
12811
|
return {
|
|
12765
12812
|
exitCode: 1,
|
|
12813
|
+
failureSubclass,
|
|
12766
12814
|
...localResult.dialogId ? { dialogId: localResult.dialogId } : {},
|
|
12767
12815
|
// Keep localError so TUI can show balance/quota/dialog-preserved hints
|
|
12768
12816
|
// instead of only the raw auto-runtime line.
|
|
@@ -12782,12 +12830,16 @@ async function runAgentTurn(options) {
|
|
|
12782
12830
|
}
|
|
12783
12831
|
const localAvailability = await checkLocalAvailabilityBeforeHttpDispatch(options);
|
|
12784
12832
|
if (localAvailability?.exitCode) {
|
|
12785
|
-
return {
|
|
12833
|
+
return {
|
|
12834
|
+
exitCode: localAvailability.exitCode,
|
|
12835
|
+
failureSubclass: localAvailability.failureSubclass ?? "rate_limit"
|
|
12836
|
+
};
|
|
12786
12837
|
}
|
|
12787
12838
|
const httpResult = await runHttpAgentTurn(options, authToken);
|
|
12788
|
-
if (httpResult.exitCode === 0 && !httpResult.streamInterrupted && localAvailability?.credentialKey) {
|
|
12839
|
+
if (httpResult.exitCode === 0 && !httpResult.streamInterrupted && (localAvailability?.credentialKey || localAvailability?.matchedKey)) {
|
|
12840
|
+
const keyToClear = localAvailability.credentialKey || localAvailability.matchedKey;
|
|
12789
12841
|
await clearCredentialAvailability(
|
|
12790
|
-
|
|
12842
|
+
keyToClear,
|
|
12791
12843
|
options.env
|
|
12792
12844
|
).catch(() => void 0);
|
|
12793
12845
|
}
|