nolo-cli 0.83.0 → 0.84.0
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-LUNEV235.js → _executeModel-BPUR2QYH.js} +29 -28
- package/{action-YVYQEAAV.js → action-P4TNFGAD.js} +3 -3
- package/{addContentAction-O7R66HEX.js → addContentAction-MB2HHMDZ.js} +2 -2
- package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-S2NRBCWW.js} +2 -2
- package/{agentDeleteCommand-2YAHAZFJ.js → agentDeleteCommand-MNAA6MIG.js} +15 -14
- package/{agentEmailCommands-G6A7IRPQ.js → agentEmailCommands-SK34WJKU.js} +37 -36
- package/{agentListCommands-KMS675GZ.js → agentListCommands-I26MKI4T.js} +31 -19
- package/{agentMachineCommands-W2SMNSQ3.js → agentMachineCommands-M6QDR6P3.js} +15 -14
- package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-X3UNW77C.js} +1 -1
- package/{agentRecordCommands-D7BRMFNI.js → agentRecordCommands-HTHLO2MM.js} +36 -35
- package/{agentRunCommand-VL6MMEUB.js → agentRunCommand-IAIRCMTH.js} +38 -36
- package/{agentRuntimeLocal-VXZSDIGT.js → agentRuntimeLocal-3WTYYIT2.js} +16 -11
- package/{agentSlice-5YJHUO47.js → agentSlice-TVP3HINW.js} +2 -2
- package/{appDeleteCommands-32MHLR4L.js → appDeleteCommands-SB5TNLKY.js} +16 -15
- package/{appDeployCommands-WCQOUSOB.js → appDeployCommands-2IPKZINV.js} +16 -15
- package/{appDeployStatusCommands-6QKB7DYN.js → appDeployStatusCommands-K63TFUID.js} +16 -15
- package/{appGetCommands-SFAPP5PB.js → appGetCommands-VU2SLNEH.js} +16 -15
- package/{appListCommands-EKUBDRUO.js → appListCommands-S3T4DJ36.js} +16 -15
- package/{authCommand-F4EFRRX6.js → authCommand-HGP2XTKC.js} +100 -8
- package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-Q2VVY3SC.js} +2 -2
- package/{chatQueueReduxAdapter-PQMRR2PK.js → chatQueueReduxAdapter-TWIYKVIZ.js} +9 -9
- package/{chunk-Z77CRGTW.js → chunk-3AMA42ZI.js} +1 -1
- package/{chunk-5FBTLSFG.js → chunk-3BGIKIPF.js} +317 -153
- package/{chunk-ORYWEJO4.js → chunk-3IUWIAHP.js} +3 -3
- package/{chunk-Q2XN3EOZ.js → chunk-3VUWPRFW.js} +17 -7
- package/{chunk-GEPUP7OO.js → chunk-3YIAR5UI.js} +1 -1
- package/{chunk-5H7KJX7J.js → chunk-4MK3I7Y4.js} +1 -1
- package/{chunk-6VFARHZW.js → chunk-52Q2IW2X.js} +783 -999
- package/{chunk-6Q33GUCC.js → chunk-5MEYHVIB.js} +1 -1
- package/{chunk-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
- package/{chunk-FZGV4FGK.js → chunk-6GFOD3TK.js} +260 -140
- package/{chunk-HJUYAD4A.js → chunk-6Z7MY3V7.js} +1 -1
- package/{chunk-V4MJDUSR.js → chunk-AHAHBQMU.js} +1 -1
- package/{chunk-TOP2VXOR.js → chunk-BFDFRLLQ.js} +2 -2
- package/chunk-BMQ2MJUK.js +153 -0
- package/{chunk-RG6JBBX5.js → chunk-CWQINZEA.js} +119 -3
- package/{chunk-BTI7PJDX.js → chunk-DD6XE56O.js} +12 -65
- package/{chunk-ETI2NYVF.js → chunk-FKNWP6SG.js} +1 -1
- package/{chunk-SSDAAEC2.js → chunk-FP76KI2Y.js} +280 -40
- package/chunk-FV3JEYR3.js +870 -0
- package/{chunk-DHDMC6FO.js → chunk-GIVFXPWK.js} +2 -0
- package/chunk-GMZLP5DV.js +82 -0
- package/{chunk-UZGQNTVW.js → chunk-GNCCNNZD.js} +3 -1
- package/{chunk-AFUORTY4.js → chunk-GP5LKBUZ.js} +1 -1
- package/{chunk-ZCYXJSTU.js → chunk-H4AHY5BU.js} +4 -81
- package/{chunk-OEVAY4J6.js → chunk-HAFJ3NDE.js} +2 -2
- package/{chunk-IIVGDG4I.js → chunk-HCT7U36O.js} +3 -0
- package/{chunk-4OEFYTWL.js → chunk-HKNXJGEC.js} +1 -1
- package/{chunk-VLTIYV3X.js → chunk-HYJFRTLW.js} +1 -1
- package/{chunk-NA35QHCF.js → chunk-K36IXSCQ.js} +1 -1
- package/{chunk-DRGSDQBL.js → chunk-KAUSRTO6.js} +2 -2
- package/{chunk-GPCZ7UXG.js → chunk-LJ5VW2UJ.js} +1 -1
- package/{chunk-YFE4A4O7.js → chunk-LMREEBWT.js} +120 -37
- package/{chunk-JRQFUXY7.js → chunk-LVIFM7VW.js} +1 -1
- package/{chunk-RFCKMYDK.js → chunk-MZYBSTMH.js} +4 -4
- package/chunk-OCZKATRC.js +129 -0
- package/{chunk-DNCEALKX.js → chunk-P5EVSOPA.js} +2 -2
- package/{chunk-BP4XNZRM.js → chunk-PBA4UJBK.js} +1 -1
- package/{chunk-G2O6V3HJ.js → chunk-PMAIQX7A.js} +3 -3
- package/{chunk-AEOE4Z6Q.js → chunk-QSHEEA5N.js} +2 -2
- package/{chunk-KQ4ONNQD.js → chunk-QU7KDSZX.js} +1 -1
- package/{chunk-45C5ER5U.js → chunk-RPJUFEGR.js} +4 -4
- package/{chunk-X6DN5HBD.js → chunk-U4OKDZFH.js} +3 -3
- package/{chunk-4S5QUMJP.js → chunk-UDVH2P4A.js} +4 -4
- package/{chunk-UKZDAFYT.js → chunk-UEVXFHQB.js} +2 -2
- package/{chunk-H62HCIUP.js → chunk-VRTTFDBM.js} +2 -1
- package/{chunk-6IG4XSS6.js → chunk-WP5UXDA5.js} +71 -4
- package/{chunk-3DII57IT.js → chunk-XD2MJFUG.js} +1 -1
- package/{chunk-QVKRR2SS.js → chunk-XP3VVAPG.js} +878 -175
- package/{chunk-L5UXH3B2.js → chunk-Z2PV6O2T.js} +18 -2
- package/{chunk-53HEEOTT.js → chunk-Z5625XML.js} +1 -1
- package/{contentThunks-GJV22WVZ.js → contentThunks-JYWI7G7I.js} +10 -10
- package/{createAgentAutomationAction-6V25TZEO.js → createAgentAutomationAction-Z4SUJ54Y.js} +10 -10
- package/{createDialogAction-SX36BGSX.js → createDialogAction-RCHFLVJ2.js} +12 -12
- package/{createPageAction-IR4BGJSI.js → createPageAction-YK2253XQ.js} +11 -11
- package/{dbSlice-XVWBAGYN.js → dbSlice-A6C6H32X.js} +1 -1
- package/{dialogCommands-5J56DFWN.js → dialogCommands-X4UOZQWX.js} +16 -15
- package/{dialogSlice-UNX2FAPZ.js → dialogSlice-IVTWLCE2.js} +15 -9
- package/{docCreateCommands-KYI2DC2U.js → docCreateCommands-VD6TGHG4.js} +15 -14
- package/{docDeleteCommands-67REUSRY.js → docDeleteCommands-OT3R2G4W.js} +16 -15
- package/{docReadCommands-HOSVSBDJ.js → docReadCommands-2G7BIXSH.js} +15 -14
- package/{docStore-JWVG5NDO.js → docStore-UENKCCDX.js} +2 -2
- package/{docUpdateCommands-EMGCSMXY.js → docUpdateCommands-45MVJKZA.js} +15 -14
- package/{handleSendMessageAction-B75UOJKF.js → handleSendMessageAction-LM2J4HC3.js} +50 -58
- package/index.js +51 -51
- package/{machineCommands-GFPTOY6L.js → machineCommands-6N6MQIE6.js} +38 -37
- package/{machineWsRunDispatch-46PSZ3DJ.js → machineWsRunDispatch-7MFKVQCR.js} +35 -34
- package/{memberThunks-QGFLFVCI.js → memberThunks-P2ECUJ56.js} +2 -2
- package/package.json +1 -1
- package/pdf-U6KSUEZZ.js +26435 -0
- package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-XI3WUPTI.js} +2 -2
- package/{providerRegistry-757OWH3O.js → providerRegistry-KEPWWGXD.js} +2 -2
- package/{readlineWorkspace-UFSWHFKD.js → readlineWorkspace-JWBON5CX.js} +184 -63
- package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-W66BJ7CF.js} +4 -4
- package/{runAgentClientLoop-25LJ4XGV.js → runAgentClientLoop-TA4SSPHE.js} +26 -26
- package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-2ALKG3WA.js} +3 -3
- package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-TQZB55F6.js} +4 -4
- package/{settingSlice-ZQZVUPKK.js → settingSlice-P4ZW7K5X.js} +2 -2
- package/{spaceCommands-NKJVJCQQ.js → spaceCommands-6NSAXB7D.js} +15 -14
- package/{streamAgentChatTurn-A46QFV4O.js → streamAgentChatTurn-X5ENGUIS.js} +94 -34
- package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-3KI72HHS.js} +2 -2
- package/{toolApiClient-QVJ6HDNN.js → toolApiClient-G3M73RTB.js} +2 -2
- package/{tools-TTDGRNY6.js → tools-XRQR7ZZR.js} +23 -23
- package/{tuiSummaryLlmCaller-WFRWERGK.js → tuiSummaryLlmCaller-UFGFOIIW.js} +5 -4
- package/{updateDialogTitleAction-QJPZGF52.js → updateDialogTitleAction-ESUUD3GT.js} +10 -10
- package/chunk-Q5FJJ6XI.js +0 -103
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addContentToSpace
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3IUWIAHP.js";
|
|
4
4
|
import {
|
|
5
5
|
prepareAndPersistMessage,
|
|
6
6
|
uiAskChoiceFunc,
|
|
7
7
|
uiAskChoiceFunctionSchema
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XP3VVAPG.js";
|
|
9
9
|
import {
|
|
10
10
|
require_date_fns
|
|
11
11
|
} from "./chunk-M76ECQRD.js";
|
|
12
12
|
import {
|
|
13
13
|
buildBuiltinObjectSkillReference
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GIVFXPWK.js";
|
|
15
15
|
import {
|
|
16
16
|
PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
|
|
17
17
|
PLATFORM_HOSTED_KIMI_PROVIDER
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
removeCachedEntity,
|
|
23
23
|
upsertSSREntity,
|
|
24
24
|
write
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-VRTTFDBM.js";
|
|
26
26
|
import {
|
|
27
27
|
createAgentKey,
|
|
28
28
|
createDialogKey,
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// packages/ai/chat/parseApiError.ts
|
|
2
|
+
var CONTEXT_OVERFLOW_ACTIONS = [
|
|
3
|
+
"compact-and-retry",
|
|
4
|
+
"new-dialog",
|
|
5
|
+
"switch-model",
|
|
6
|
+
"retry"
|
|
7
|
+
];
|
|
8
|
+
var CONTEXT_TOO_LARGE_ACTIONS = [
|
|
9
|
+
"new-dialog",
|
|
10
|
+
"switch-model",
|
|
11
|
+
"retry"
|
|
12
|
+
];
|
|
13
|
+
var truncateErrorMessage = (message, maxChars = 320) => message.length <= maxChars ? message : `${message.slice(0, maxChars)}\u2026`;
|
|
14
|
+
var isContextOverflowText = (message) => /maximum context|context (length|window|overflow|limit)|context_length_exceed\w*|requested about .*tokens|too many tokens|prompt is too long|exceeds? (the )?(model|max)/i.test(
|
|
15
|
+
message
|
|
16
|
+
);
|
|
17
|
+
function classifyApiError(input) {
|
|
18
|
+
const { status, message, body, code } = input;
|
|
19
|
+
const errorMessage = message;
|
|
20
|
+
let defaultMessage = `\u72B6\u6001\u7801 ${status} ${input.statusText ?? ""}`;
|
|
21
|
+
switch (status) {
|
|
22
|
+
case 400:
|
|
23
|
+
if (isContextOverflowText(errorMessage) || isContextOverflowText(body) || code === "UPSTREAM_400") {
|
|
24
|
+
return {
|
|
25
|
+
kind: "context_overflow",
|
|
26
|
+
message: "\u4E0A\u4E0B\u6587\u8FC7\u957F\uFF1A\u672C\u8F6E\u6D88\u606F\u6216\u5DE5\u5177\u7ED3\u679C\u592A\u5927\u3002\u8BF7\u7F29\u5C0F\u8303\u56F4\uFF0C\u6216\u5148\u8BFB\u53D6\u66F4\u5C0F\u7247\u6BB5\u540E\u518D\u7EE7\u7EED\u3002",
|
|
27
|
+
code,
|
|
28
|
+
status,
|
|
29
|
+
retryable: true,
|
|
30
|
+
actions: [...CONTEXT_OVERFLOW_ACTIONS]
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (code === "MISSING_PROVIDER_API_KEY") {
|
|
34
|
+
return {
|
|
35
|
+
kind: "generic",
|
|
36
|
+
message: truncateErrorMessage(errorMessage),
|
|
37
|
+
code,
|
|
38
|
+
status,
|
|
39
|
+
retryable: false
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (errorMessage && errorMessage !== defaultMessage) {
|
|
43
|
+
return {
|
|
44
|
+
kind: "generic",
|
|
45
|
+
message: `\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}`,
|
|
46
|
+
code,
|
|
47
|
+
status,
|
|
48
|
+
retryable: false
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return { kind: "generic", message: "\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165", code, status, retryable: false };
|
|
52
|
+
case 413:
|
|
53
|
+
return {
|
|
54
|
+
kind: "context_too_large",
|
|
55
|
+
message: "\u8BF7\u6C42\u5185\u5BB9\u8FC7\u5927\uFF1A\u8BF7\u51CF\u5C11\u4E00\u6B21\u53D1\u9001\u7684\u6D88\u606F\u3001\u6587\u4EF6\u6216\u5DE5\u5177\u7ED3\u679C\u3002",
|
|
56
|
+
code,
|
|
57
|
+
status,
|
|
58
|
+
retryable: true,
|
|
59
|
+
actions: [...CONTEXT_TOO_LARGE_ACTIONS]
|
|
60
|
+
};
|
|
61
|
+
case 401:
|
|
62
|
+
return {
|
|
63
|
+
kind: "auth",
|
|
64
|
+
message: code === "AUTH_TOKEN_EXPIRED" ? "\u767B\u5F55\u72B6\u6001\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55" : code === "AUTH_ACCOUNT_INVALID" ? "\u8D26\u6237\u65E0\u6548\u6216\u5DF2\u88AB\u505C\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458" : code === "AUTH_NO_TOKEN" ? "\u672A\u68C0\u6D4B\u5230\u767B\u5F55\u72B6\u6001\uFF0C\u8BF7\u5148\u767B\u5F55" : code === "AUTH_INVALID_TOKEN" ? "\u767B\u5F55\u51ED\u8BC1\u65E0\u6548\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55" : code === "AUTH_TOKEN_NOT_ACTIVE" ? "\u4EE4\u724C\u5C1A\u672A\u751F\u6548\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5" : errorMessage && errorMessage !== `\u72B6\u6001\u7801 401 Unauthorized` ? `\u8BA4\u8BC1\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}` : "\u8EAB\u4EFD\u9A8C\u8BC1\u5931\u8D25\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55",
|
|
65
|
+
code,
|
|
66
|
+
status,
|
|
67
|
+
retryable: true,
|
|
68
|
+
actions: ["retry"]
|
|
69
|
+
};
|
|
70
|
+
case 503:
|
|
71
|
+
return {
|
|
72
|
+
kind: "server",
|
|
73
|
+
message: errorMessage && errorMessage !== `\u72B6\u6001\u7801 503 Service Unavailable` ? truncateErrorMessage(errorMessage) : "\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
|
|
74
|
+
code,
|
|
75
|
+
status,
|
|
76
|
+
retryable: true,
|
|
77
|
+
actions: ["retry"]
|
|
78
|
+
};
|
|
79
|
+
case 504:
|
|
80
|
+
return {
|
|
81
|
+
kind: "timeout",
|
|
82
|
+
message: "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
|
|
83
|
+
code,
|
|
84
|
+
status,
|
|
85
|
+
retryable: true,
|
|
86
|
+
actions: ["retry"]
|
|
87
|
+
};
|
|
88
|
+
default:
|
|
89
|
+
return {
|
|
90
|
+
kind: "generic",
|
|
91
|
+
message: `API\u8BF7\u6C42\u5931\u8D25: ${truncateErrorMessage(errorMessage)}`,
|
|
92
|
+
code,
|
|
93
|
+
status,
|
|
94
|
+
retryable: true,
|
|
95
|
+
actions: ["retry"]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async function parseApiErrorInfo(response) {
|
|
100
|
+
const errorBody = await response.text();
|
|
101
|
+
let errorMessage = `\u72B6\u6001\u7801 ${response.status} ${response.statusText}`;
|
|
102
|
+
let errorCode = `E${response.status}`;
|
|
103
|
+
try {
|
|
104
|
+
const errorJson = JSON.parse(errorBody);
|
|
105
|
+
errorMessage = errorJson?.error?.message || errorJson?.message || errorJson?.msg || errorBody || errorMessage;
|
|
106
|
+
errorCode = errorJson?.error?.code || errorJson?.code || errorCode;
|
|
107
|
+
} catch (_e) {
|
|
108
|
+
if (errorBody) {
|
|
109
|
+
errorMessage = errorBody;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return classifyApiError({
|
|
113
|
+
status: response.status,
|
|
114
|
+
statusText: response.statusText,
|
|
115
|
+
message: errorMessage,
|
|
116
|
+
body: errorBody,
|
|
117
|
+
code: errorCode
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async function parseApiError(response) {
|
|
121
|
+
return (await parseApiErrorInfo(response)).message;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
CONTEXT_OVERFLOW_ACTIONS,
|
|
126
|
+
CONTEXT_TOO_LARGE_ACTIONS,
|
|
127
|
+
isContextOverflowText,
|
|
128
|
+
parseApiError
|
|
129
|
+
};
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-DWLEOOGR.js";
|
|
7
7
|
import {
|
|
8
8
|
addContentAction
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AHAHBQMU.js";
|
|
10
10
|
import {
|
|
11
11
|
upload
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VRTTFDBM.js";
|
|
13
13
|
import {
|
|
14
14
|
getRuntimeServerContext
|
|
15
15
|
} from "./chunk-UKWGR5SS.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
patch,
|
|
12
12
|
readAndWait
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VRTTFDBM.js";
|
|
14
14
|
import {
|
|
15
15
|
asOptionalTrimmedString
|
|
16
16
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -326,7 +326,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
326
326
|
).unwrap();
|
|
327
327
|
if (dbSpaceId) {
|
|
328
328
|
try {
|
|
329
|
-
const { updateContentTitle } = await import("./contentThunks-
|
|
329
|
+
const { updateContentTitle } = await import("./contentThunks-JYWI7G7I.js");
|
|
330
330
|
await dispatch(
|
|
331
331
|
updateContentTitle({
|
|
332
332
|
spaceId: dbSpaceId,
|
|
@@ -365,7 +365,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
async function createDocState(args, thunkApi) {
|
|
368
|
-
const { createPageAction } = await import("./createPageAction-
|
|
368
|
+
const { createPageAction } = await import("./createPageAction-YK2253XQ.js");
|
|
369
369
|
return createPageAction(args, thunkApi);
|
|
370
370
|
}
|
|
371
371
|
function subscribe(listener) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildLocalAgentLookupKeys,
|
|
3
3
|
shouldReadAgentKeyRemotely
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3AMA42ZI.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveCliAgentKeyInput
|
|
7
7
|
} from "./chunk-SV5IJK6K.js";
|
|
@@ -523,7 +523,7 @@ async function buildCreatedAgentRecord(args) {
|
|
|
523
523
|
const resolvedAgentInput = resolveCliAgentKeyInput(args.parsed.agentInput);
|
|
524
524
|
const agentKey = resolvedAgentInput.startsWith("agent-") ? resolvedAgentInput : createAgentKey.private(userId || "local", resolvedAgentInput);
|
|
525
525
|
if (args.parsed.presetId) {
|
|
526
|
-
const { resolveProviderPresetFields } = await import("./providerPresetApply-
|
|
526
|
+
const { resolveProviderPresetFields } = await import("./providerPresetApply-XI3WUPTI.js");
|
|
527
527
|
const fields = resolveProviderPresetFields(args.parsed.presetId);
|
|
528
528
|
if (fields.kind === "manual") {
|
|
529
529
|
throw new Error(
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCliLocalRuntimeAdapter,
|
|
3
3
|
summarizeEndpoint
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LMREEBWT.js";
|
|
5
5
|
import {
|
|
6
6
|
clipMultilineText
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3BGIKIPF.js";
|
|
8
8
|
import {
|
|
9
9
|
runLocalAgentTurn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-52Q2IW2X.js";
|
|
11
11
|
import {
|
|
12
12
|
applyToolSurfaceConstraints
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HCT7U36O.js";
|
|
14
14
|
import {
|
|
15
15
|
resolveLocalRuntimeEnvFromPolicy
|
|
16
16
|
} from "./chunk-HVURBGF3.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearCliLocalRuntimePreparedAgentCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LMREEBWT.js";
|
|
4
4
|
import {
|
|
5
5
|
getReadableCliDb
|
|
6
6
|
} from "./chunk-LS2ZANRJ.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveAgentRecordFromHybridStore,
|
|
13
13
|
sanitizeAgentRecordForCliOutput,
|
|
14
14
|
writeAgentRecord
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QSHEEA5N.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveCliAgentKeyInput
|
|
18
18
|
} from "./chunk-SV5IJK6K.js";
|
|
@@ -212,7 +212,7 @@ async function runAgentCreateCommand(args, deps = {}) {
|
|
|
212
212
|
clearCliLocalRuntimePreparedAgentCache();
|
|
213
213
|
let verifyResult;
|
|
214
214
|
if (parsed.verify) {
|
|
215
|
-
const { verifyCustomProvider } = await import("./agentProviderCommands-
|
|
215
|
+
const { verifyCustomProvider } = await import("./agentProviderCommands-X3UNW77C.js");
|
|
216
216
|
const rec = built.nextRecord;
|
|
217
217
|
verifyResult = await verifyCustomProvider({
|
|
218
218
|
providerUrl: rec.customProviderUrl,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
patch,
|
|
12
12
|
remove,
|
|
13
13
|
write
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VRTTFDBM.js";
|
|
15
15
|
import {
|
|
16
16
|
createAgentKey,
|
|
17
17
|
toTrimmedString
|
|
@@ -304,7 +304,7 @@ var slice = createSliceWithThunks({
|
|
|
304
304
|
const overrides = {};
|
|
305
305
|
if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
|
|
306
306
|
if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
|
|
307
|
-
const { _executeModel } = await import("./_executeModel-
|
|
307
|
+
const { _executeModel } = await import("./_executeModel-BPUR2QYH.js");
|
|
308
308
|
return _executeModel(
|
|
309
309
|
{
|
|
310
310
|
isStreaming: args.isStreaming ?? false,
|
|
@@ -325,7 +325,7 @@ var slice = createSliceWithThunks({
|
|
|
325
325
|
* - 循环直到无工具调用或触发其他运行时停止条件
|
|
326
326
|
*/
|
|
327
327
|
runAgent: create.asyncThunk(async (args, thunkApi) => {
|
|
328
|
-
const { runAgentClientLoop } = await import("./runAgentClientLoop-
|
|
328
|
+
const { runAgentClientLoop } = await import("./runAgentClientLoop-TA4SSPHE.js");
|
|
329
329
|
const { content: loopContent, toolCallCount } = await runAgentClientLoop(
|
|
330
330
|
{
|
|
331
331
|
agentKey: args.agentKey,
|
|
@@ -341,7 +341,7 @@ var slice = createSliceWithThunks({
|
|
|
341
341
|
* 聊天轮次流式 Agent 调用
|
|
342
342
|
*/
|
|
343
343
|
streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
|
|
344
|
-
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-
|
|
344
|
+
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-X5ENGUIS.js");
|
|
345
345
|
return streamAgentChatTurnHandler(args, thunkApi);
|
|
346
346
|
}),
|
|
347
347
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getActiveDialogKey
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6D2JFXLY.js";
|
|
4
4
|
import {
|
|
5
5
|
require_date_fns
|
|
6
6
|
} from "./chunk-M76ECQRD.js";
|
|
7
7
|
import {
|
|
8
8
|
patch,
|
|
9
9
|
selectById
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VRTTFDBM.js";
|
|
11
11
|
import {
|
|
12
12
|
__toESM
|
|
13
13
|
} from "./chunk-4VNS5WPM.js";
|
|
@@ -786,7 +786,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
786
786
|
// 这里改成动态 import,运行期才解析,彻底断开这条边。
|
|
787
787
|
share: create.asyncThunk(
|
|
788
788
|
async (config, thunkApi) => {
|
|
789
|
-
const { shareResourceAction } = await import("./action-
|
|
789
|
+
const { shareResourceAction } = await import("./action-P4TNFGAD.js");
|
|
790
790
|
return shareResourceAction(config, thunkApi);
|
|
791
791
|
}
|
|
792
792
|
),
|
|
@@ -824,6 +824,7 @@ export {
|
|
|
824
824
|
toTimestampMs,
|
|
825
825
|
resolveFileCategory,
|
|
826
826
|
uploadFileAction,
|
|
827
|
+
readFileContentAction,
|
|
827
828
|
dbAdapter,
|
|
828
829
|
selectById,
|
|
829
830
|
selectEntities,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3YIAR5UI.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QSHEEA5N.js";
|
|
8
8
|
import {
|
|
9
9
|
deriveCredentialGroup,
|
|
10
10
|
toSafeAgentSummary
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CWQINZEA.js";
|
|
12
12
|
import {
|
|
13
13
|
PUBLIC_AGENT_KEY_PREFIX,
|
|
14
14
|
isOwnedAgentKey,
|
|
@@ -18,6 +18,70 @@ import {
|
|
|
18
18
|
publicAgentKey
|
|
19
19
|
} from "./chunk-M2EJHDJP.js";
|
|
20
20
|
|
|
21
|
+
// packages/ai/agent/quotaSnapshot.ts
|
|
22
|
+
function findTightestQuotaWindow(quota, now = Date.now()) {
|
|
23
|
+
if (!quota || !Array.isArray(quota.windows) || quota.windows.length === 0) {
|
|
24
|
+
return void 0;
|
|
25
|
+
}
|
|
26
|
+
let best;
|
|
27
|
+
let bestScore = -Infinity;
|
|
28
|
+
for (const w of quota.windows) {
|
|
29
|
+
let score = 0;
|
|
30
|
+
if (typeof w.utilization === "number" && w.utilization >= 0) {
|
|
31
|
+
score = 500 + Math.min(w.utilization, 1) * 500;
|
|
32
|
+
} else if (typeof w.remaining === "number" && typeof w.limit === "number" && w.limit > 0) {
|
|
33
|
+
const util = Math.max(0, 1 - w.remaining / w.limit);
|
|
34
|
+
score = 500 + util * 500;
|
|
35
|
+
} else if (typeof w.resetAt === "number" && w.resetAt > now) {
|
|
36
|
+
score = 200;
|
|
37
|
+
} else if (typeof w.remaining === "number") {
|
|
38
|
+
score = 100;
|
|
39
|
+
}
|
|
40
|
+
if (score > bestScore) {
|
|
41
|
+
bestScore = score;
|
|
42
|
+
best = w;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return best ?? quota.windows[0];
|
|
46
|
+
}
|
|
47
|
+
function formatQuotaSummary(quota, now = Date.now(), options) {
|
|
48
|
+
const tightest = findTightestQuotaWindow(quota, now);
|
|
49
|
+
if (!tightest) return void 0;
|
|
50
|
+
const compact = options?.compact === true;
|
|
51
|
+
const parts = [];
|
|
52
|
+
if (typeof tightest.utilization === "number") {
|
|
53
|
+
const pct = Math.round(tightest.utilization * 100);
|
|
54
|
+
parts.push(`${pct}%\u5DF2\u7528`);
|
|
55
|
+
} else if (typeof tightest.remaining === "number") {
|
|
56
|
+
if (typeof tightest.limit === "number") {
|
|
57
|
+
parts.push(`${tightest.remaining}/${tightest.limit}${tightest.unit ? ` ${tightest.unit}` : ""}`);
|
|
58
|
+
} else {
|
|
59
|
+
parts.push(`\u4F59${tightest.remaining}${tightest.unit ? ` ${tightest.unit}` : ""}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (compact) return parts.length > 0 ? parts[0] : void 0;
|
|
63
|
+
if (tightest.scope && tightest.scope !== "user" && tightest.scope !== "project" && tightest.scope !== tightest.unit) {
|
|
64
|
+
parts.push(tightest.scope);
|
|
65
|
+
}
|
|
66
|
+
if (typeof tightest.resetAt === "number" && tightest.resetAt > now) {
|
|
67
|
+
const diffSec = Math.round((tightest.resetAt - now) / 1e3);
|
|
68
|
+
if (diffSec < 60) {
|
|
69
|
+
parts.push(`${diffSec}s\u540E\u91CD\u7F6E`);
|
|
70
|
+
} else if (diffSec < 3600) {
|
|
71
|
+
parts.push(`${Math.round(diffSec / 60)}m\u540E\u91CD\u7F6E`);
|
|
72
|
+
} else if (diffSec < 86400) {
|
|
73
|
+
const hours = (diffSec / 3600).toFixed(1).replace(/\.0$/, "");
|
|
74
|
+
parts.push(`${hours}h\u540E\u91CD\u7F6E`);
|
|
75
|
+
} else {
|
|
76
|
+
const days = (diffSec / 86400).toFixed(1).replace(/\.0$/, "");
|
|
77
|
+
parts.push(`${days}d\u540E\u91CD\u7F6E`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (parts.length === 0) return void 0;
|
|
81
|
+
if (parts.length === 1 && parts[0] === tightest.scope) return void 0;
|
|
82
|
+
return parts.join(" \xB7 ");
|
|
83
|
+
}
|
|
84
|
+
|
|
21
85
|
// packages/cli/agentListHelpers.ts
|
|
22
86
|
function parseAgentRecordId(privateKey, explicitId) {
|
|
23
87
|
if (explicitId) return explicitId;
|
|
@@ -67,7 +131,8 @@ function normalizeListedAgent(record) {
|
|
|
67
131
|
...credentialKind !== void 0 ? { credentialKind } : {},
|
|
68
132
|
...typeof record?.apiSource === "string" && record.apiSource ? { apiSource: record.apiSource } : {},
|
|
69
133
|
...typeof record?.cliProvider === "string" && record.cliProvider ? { cliProvider: record.cliProvider } : {},
|
|
70
|
-
...typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? { nextAvailableAt: record.nextAvailableAt } : {}
|
|
134
|
+
...typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? { nextAvailableAt: record.nextAvailableAt } : {},
|
|
135
|
+
...record?.quota && typeof record.quota === "object" && Array.isArray(record.quota.windows) ? { quota: record.quota } : {}
|
|
71
136
|
};
|
|
72
137
|
}
|
|
73
138
|
function toSafeListedAgentSummary(agent, options) {
|
|
@@ -97,6 +162,7 @@ function parseAgentListArgs(args) {
|
|
|
97
162
|
publicOnly: args.includes("--public-only"),
|
|
98
163
|
idsOnly: args.includes("--ids-only"),
|
|
99
164
|
scope: readArgValue(args, "--scope"),
|
|
165
|
+
query: readArgValue(args, "--query"),
|
|
100
166
|
showUnavailable: args.includes("--show-unavailable"),
|
|
101
167
|
// --safe 默认输出精简投影(与 server listAgents 一致,防大列表被截断);
|
|
102
168
|
// --verbose 拿回完整字段集排障。
|
|
@@ -238,6 +304,7 @@ async function decorateAgentsWithPublicStatusAcrossServers(args) {
|
|
|
238
304
|
}
|
|
239
305
|
|
|
240
306
|
export {
|
|
307
|
+
formatQuotaSummary,
|
|
241
308
|
normalizeListedAgent,
|
|
242
309
|
toSafeListedAgentSummary,
|
|
243
310
|
parseAgentListArgs,
|