nolo-cli 0.91.0-alpha.1 → 0.91.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-U5V7LOJX.js → _executeModel-H35GQ2XO.js} +61 -60
- package/{action-EXQVY3UO.js → action-3ZOODRBC.js} +11 -11
- package/{addContentAction-6IXQSRD2.js → addContentAction-IJHG2ZV7.js} +9 -9
- package/{addDialogAgentAction-FZOB4BYM.js → addDialogAgentAction-IGFS2UBX.js} +11 -11
- package/{agentDeleteCommand-4MIJFQQB.js → agentDeleteCommand-XOFMXMHW.js} +43 -42
- package/{agentEmailCommands-JUXT36BY.js → agentEmailCommands-H2SEP6ZQ.js} +82 -78
- package/{agentGrantCommands-YW6PQAQ2.js → agentGrantCommands-M3XFO6EN.js} +2 -2
- package/{agentListCommands-MUVKMMZ5.js → agentListCommands-RYGH6NUL.js} +72 -80
- package/{agentMachineCommands-56FTZLYV.js → agentMachineCommands-XELOBZIP.js} +37 -36
- package/{agentProviderCommands-TOMVKJOV.js → agentProviderCommands-JCRK6ST2.js} +1 -1
- package/{agentPullCommand-GLOOXJ2E.js → agentPullCommand-HF4A42D4.js} +3 -3
- package/agentRecordCommands-43HAXAZO.js +130 -0
- package/{agentRunCommand-UMUEVIY2.js → agentRunCommand-GIPN6DBO.js} +80 -75
- package/{agentRunControl-XLGD3UZ5.js → agentRunControl-AVJR4JW4.js} +2 -2
- package/{agentRuntimeLocal-NH6GSGAJ.js → agentRuntimeLocal-SDOSSCLU.js} +38 -33
- package/{agentSlice-YZK6KG73.js → agentSlice-B2DLZMAC.js} +11 -11
- package/{appDeleteCommands-U45KXYX7.js → appDeleteCommands-7OR5MAOR.js} +37 -36
- package/{appDeployCommands-LWQIQCFX.js → appDeployCommands-5GNI723H.js} +37 -36
- package/{appDeployStatusCommands-LZO33PGD.js → appDeployStatusCommands-WL2NG3SG.js} +37 -36
- package/{appGetCommands-OJSO6BCF.js → appGetCommands-7BVKQS44.js} +37 -36
- package/{appListCommands-NE56V7DI.js → appListCommands-5VXFJOBU.js} +37 -36
- package/{authCommand-U5LA6H4Y.js → authCommand-N4Q6463J.js} +115 -23
- package/{authCommands-RGOGCPP6.js → authCommands-GBIFZWD3.js} +5 -5
- package/{builtinSkillRegistry-4NB7PCOF.js → builtinSkillRegistry-JPY2DKRF.js} +7 -7
- package/{chatQueueReduxAdapter-FRMSYX7N.js → chatQueueReduxAdapter-3KDRKXTT.js} +29 -29
- package/{chromeCommands-VOIRNJBL.js → chromeCommands-NKU3OWKH.js} +36 -11
- package/{chromeOpsCommands-M7DPCX2T.js → chromeOpsCommands-OQDJGD4Y.js} +31 -1
- package/{chunk-R2YY6MWV.js → chunk-232453C2.js} +994 -1036
- package/{chunk-HWZAXNO7.js → chunk-25GAGMRK.js} +6 -83
- package/{chunk-DM4UNXPK.js → chunk-3IYMTWYZ.js} +22 -22
- package/{chunk-NTW5GWDM.js → chunk-3VNWWVKB.js} +2 -0
- package/{chunk-X2ZTVRXP.js → chunk-46CRK7XP.js} +7 -7
- package/{chunk-WKEUHK57.js → chunk-55VQ4OPL.js} +4 -4
- package/{chunk-JPGCXHNM.js → chunk-5OA5HMTL.js} +1 -1
- package/{chunk-DWUCB2A3.js → chunk-62IL3KQV.js} +4 -34
- package/{chunk-4JBZUECA.js → chunk-64TIEZHF.js} +1 -1
- package/{chunk-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
- package/{chunk-3BMYXEUW.js → chunk-6O4IK4V2.js} +1 -1
- package/{chunk-UBNV6CS6.js → chunk-6PELJ3DS.js} +533 -236
- package/{chunk-7IBK6MYW.js → chunk-7EMJBGCA.js} +966 -218
- package/{chunk-YPYMGGPJ.js → chunk-7YMUSSHQ.js} +93 -93
- package/chunk-ACTMNVHM.js +93 -0
- package/{chunk-Q554LLSI.js → chunk-AUDNYVRC.js} +1 -1
- package/{chunk-UKWGR5SS.js → chunk-AUXHZ2M5.js} +186 -397
- package/{chunk-377KM42Z.js → chunk-B4PW6UAI.js} +61 -34
- package/{chunk-XLGHBHGP.js → chunk-B7ANJQWZ.js} +2 -2
- package/{chunk-COM7GG76.js → chunk-BAAKVSMZ.js} +4 -4
- package/{chunk-QMASIHYZ.js → chunk-BFCXG6AJ.js} +16 -16
- package/{chunk-KR3YI36B.js → chunk-BJUDYFV5.js} +10 -2
- package/chunk-BMQ2MJUK.js +153 -0
- package/{chunk-XGJAR4T5.js → chunk-BNGW5ASC.js} +65 -4
- package/{chunk-VOOTT7HA.js → chunk-BTSYHR7J.js} +4 -4
- package/{chunk-LS2ZANRJ.js → chunk-CTUQJVQM.js} +1 -1
- package/{chunk-JEDZAO7L.js → chunk-D2W6WRHT.js} +13 -8
- package/{chunk-U47DH2WO.js → chunk-D76D3RTR.js} +2 -2
- package/{chunk-HQCSU3DI.js → chunk-DCLMZ5TX.js} +4 -4
- package/{chunk-OOLWKQSM.js → chunk-EFZKILX6.js} +4 -4
- package/{chunk-WP6BC7OF.js → chunk-EHO5EGU4.js} +23 -76
- package/{chunk-HVURBGF3.js → chunk-ESRMFY7G.js} +2 -2
- package/{chunk-ABQYVJBJ.js → chunk-ETZWFV6M.js} +1 -1
- package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
- package/{chunk-BF2K6MRF.js → chunk-F64B2W3R.js} +110 -34
- package/{chunk-S3UI4IUJ.js → chunk-G4EMOUX3.js} +886 -154
- package/{chunk-B4S7MR5S.js → chunk-GJUKGFHG.js} +74 -16
- package/{chunk-LSSBA2TN.js → chunk-GMVELWJG.js} +3 -3
- package/chunk-GMZLP5DV.js +82 -0
- package/{chunk-CJCJF5XB.js → chunk-H6A6X4EK.js} +36 -3
- package/{chunk-DSX6K7C2.js → chunk-HBTA2SGQ.js} +97 -21
- package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
- package/{chunk-W2E6HIIK.js → chunk-HNRASX3X.js} +8 -8
- package/{chunk-CPH3W5A7.js → chunk-I3TQJXQ7.js} +94 -3
- package/{chunk-E3VQ6S3A.js → chunk-IS5VEM2G.js} +140 -15
- package/{chunk-NKIH4Q7W.js → chunk-ISHYYQJC.js} +5 -3
- package/{chunk-RLEWGSM5.js → chunk-K7M4I3PF.js} +30 -7
- package/{chunk-OH7H6LPC.js → chunk-KQOD3G2X.js} +165 -15
- package/{chunk-YOXYA2GU.js → chunk-LNPYTNMG.js} +10 -5
- package/{chunk-GRDSMV4V.js → chunk-LS2MI3B4.js} +45 -45
- package/{chunk-GII32WZW.js → chunk-M2EJHDJP.js} +3 -0
- package/{chunk-7S4YWN7P.js → chunk-MX574M24.js} +1 -1
- package/{chunk-RZYQMSQA.js → chunk-N3XA2O6O.js} +1 -1
- package/{chunk-SASGLNUD.js → chunk-NILSKYOE.js} +3 -3
- package/chunk-OCZKATRC.js +129 -0
- package/{chunk-MBEEYLGL.js → chunk-OOSVFT6S.js} +2 -2
- package/{chunk-QCZX4FTW.js → chunk-OY5IJI2N.js} +194 -21
- package/{chunk-SUERPXJZ.js → chunk-PAYUVQ6P.js} +7517 -1091
- package/{chunk-JTYPAMGP.js → chunk-Q67DOFOO.js} +59 -4
- package/{chunk-F3UTRUDO.js → chunk-QALRKMHF.js} +11 -10
- package/{chunk-546FPOW3.js → chunk-QDSINZM3.js} +1 -1
- package/{chunk-TMAZ3VHN.js → chunk-QJLEMM2V.js} +1 -1
- package/{chunk-IIKPWSPX.js → chunk-R4SQ3LGW.js} +1 -1
- package/{chunk-E2NP7ZQU.js → chunk-RZ6CQZB2.js} +34 -20
- package/{chunk-SAFZABH7.js → chunk-SV5IJK6K.js} +1 -1
- package/{chunk-AQDH76OK.js → chunk-T5V7HA3K.js} +1 -1
- package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
- package/chunk-UNYJU5L6.js +780 -0
- package/{chunk-QFMFJZLO.js → chunk-V7E4PXQD.js} +1 -1
- package/{chunk-G5X57NDE.js → chunk-VBSVA6CB.js} +2 -2
- package/{chunk-3XMOAYRC.js → chunk-VETFWL5K.js} +1 -1
- package/chunk-VJVNU77E.js +83 -0
- package/{chunk-6D6VBVEW.js → chunk-VPFEPRME.js} +9 -9
- package/{chunk-HGRDL36J.js → chunk-W2P25VGS.js} +25 -6
- package/{chunk-XAQAF25W.js → chunk-WC6A2Q7S.js} +5 -3
- package/{chunk-WON762L4.js → chunk-WT2IAJAJ.js} +4 -4
- package/chunk-X6YIXGPT.js +870 -0
- package/{chunk-ZKMYGRO7.js → chunk-YMPTI7RZ.js} +9 -9
- package/{chunk-BKP7CFUD.js → chunk-YRIFJ6XQ.js} +13 -13
- package/{chunk-FZGV4FGK.js → chunk-YRRASA5Q.js} +268 -143
- package/{chunk-UDEFS2PV.js → chunk-Z5W7UMQV.js} +2 -2
- package/{chunk-ZHUTWJ3N.js → chunk-ZGJLSHER.js} +2 -2
- package/{chunk-4CAPEGHN.js → chunk-ZI2MEZMT.js} +304 -136
- package/{chunk-2F7RJC6L.js → chunk-ZOVKKMF6.js} +1 -1
- package/commandRegistry-BP5JLW24.js +822 -0
- package/{contentThunks-TC3AENBY.js → contentThunks-2HYFUXUM.js} +29 -29
- package/{cooldownCommands-BSCH2W7P.js → cooldownCommands-ZLEPIB4A.js} +2 -2
- package/{createAgentAutomationAction-67EOD3WK.js → createAgentAutomationAction-DCKUSJH7.js} +29 -29
- package/{createDialogAction-4OCQC5MW.js → createDialogAction-NRIAEH2A.js} +32 -32
- package/{createPageAction-JLGVP57B.js → createPageAction-AUJHHXGG.js} +35 -35
- package/{dbSlice-RDGCE5MU.js → dbSlice-HFPIJT5P.js} +8 -8
- package/{deleteFile-YG6QMJLU.js → deleteFile-UEAD5A5Z.js} +3 -3
- package/{dialogCommands-JHSDKCR5.js → dialogCommands-UJRGCRN6.js} +42 -39
- package/{dialogSlice-I2DK32ZT.js → dialogSlice-AHU4XXIW.js} +35 -29
- package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
- package/{docCreateCommands-QUL6VWK2.js → docCreateCommands-ZOV3ZBLW.js} +39 -38
- package/{docDeleteCommands-DMQ2MU6I.js → docDeleteCommands-G4KAXJYQ.js} +39 -38
- package/{docReadCommands-FVHENBU6.js → docReadCommands-B2MM3JIT.js} +38 -37
- package/{docStore-OLC6MD7B.js → docStore-SITH63V3.js} +9 -9
- package/{docUpdateCommands-VA6V5C6L.js → docUpdateCommands-2QNF5CYN.js} +39 -38
- package/{fetchMessages-EIU7UFFK.js → fetchMessages-67MEFPZR.js} +2 -2
- package/{getPricing-YYXTEPBP.js → getPricing-OX7B4R6B.js} +3 -3
- package/{handleSendMessageAction-GRDIRXAK.js → handleSendMessageAction-7ZMJMWLC.js} +72 -80
- package/index.js +74 -877
- 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-IJJ66MYU.js → machineCommands-YCTD5KOL.js} +75 -71
- package/{machineWsRunDispatch-PP2ZBS6D.js → machineWsRunDispatch-JFMD4ZAW.js} +73 -69
- package/{memberThunks-WQGQWYYT.js → memberThunks-SKFZ37VS.js} +9 -9
- package/{models-UN7YGMPM.js → models-T3SG6MJ5.js} +2 -2
- package/oauthTokenStore-ITEB663N.js +23 -0
- package/{offlineMarxistsAgentCommand-JEWCIAWM.js → offlineMarxistsAgentCommand-HGXZV4XJ.js} +1 -1
- 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-NO73BG45.js → providerPresetApply-2QTBYN36.js} +7 -7
- package/{providerRegistry-OVY4VKNN.js → providerRegistry-SVXE4G4T.js} +7 -7
- package/{read-S4WC2OUK.js → read-IEJLLUXY.js} +5 -5
- package/{readDocTool-PQNM63KV.js → readDocTool-4SPYCP2Y.js} +5 -3
- package/{readlineWorkspace-ASJECDJD.js → readlineWorkspace-M3PLTBLD.js} +2396 -2018
- package/{removeDialogAgentAction-YJZ6XJV6.js → removeDialogAgentAction-LILXTOQY.js} +14 -14
- package/{runAgentClientLoop-KIOQSDRC.js → runAgentClientLoop-QMCXBOBH.js} +55 -55
- package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-3USD722U.js} +3 -3
- package/runtimeModeArgs-2Y7BALTO.js +31 -0
- package/{setDialogExtraReferencesAction-E6A3WL4E.js → setDialogExtraReferencesAction-LVNHLNT5.js} +10 -10
- package/{setPrimaryDialogAgentAction-WBLIVICQ.js → setPrimaryDialogAgentAction-DCKO5NTW.js} +14 -14
- package/{settingSlice-JR6S7TRD.js → settingSlice-CNE75ISY.js} +10 -10
- package/{spaceCommands-WDUNCAK5.js → spaceCommands-3U6OHM6O.js} +39 -38
- package/{streamAgentChatTurn-EGQDPMAO.js → streamAgentChatTurn-JPMJQSEE.js} +144 -84
- package/{switchDialogAgentAction-DTR36ZY2.js → switchDialogAgentAction-JSYUQ5CG.js} +11 -11
- package/{tableCommands-O6NWHFKV.js → tableCommands-G7RV3RU3.js} +4 -4
- package/{toolApiClient-7PSIFQPJ.js → toolApiClient-INIQCPGY.js} +3 -3
- package/{tools-AOVE5LKM.js → tools-XQ5GIH6P.js} +49 -49
- package/{tuiSummaryLlmCaller-XRQCSNYQ.js → tuiSummaryLlmCaller-L63PDJUD.js} +16 -15
- package/{updateCommands-2M74UL7P.js → updateCommands-ECWKIWLQ.js} +3 -3
- package/{updateDialogTitleAction-T66TXHIR.js → updateDialogTitleAction-EGAZMLUB.js} +32 -32
- package/agentRecordCommands-FST3KAKG.js +0 -126
- package/chunk-4QKBQHPQ.js +0 -79
- 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
|
@@ -3,21 +3,24 @@ import {
|
|
|
3
3
|
} from "./chunk-YYLHWIW6.js";
|
|
4
4
|
import {
|
|
5
5
|
compareAgentSelection
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LNPYTNMG.js";
|
|
7
|
+
import {
|
|
8
|
+
isAgentUnavailableNow
|
|
9
|
+
} from "./chunk-H6A6X4EK.js";
|
|
7
10
|
import {
|
|
8
11
|
isAntigravityOAuthAgent
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ISHYYQJC.js";
|
|
10
13
|
import {
|
|
11
14
|
getModelAbility
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ACTMNVHM.js";
|
|
16
|
+
import {
|
|
17
|
+
fnv1a32Hex
|
|
18
|
+
} from "./chunk-AUXHZ2M5.js";
|
|
13
19
|
import {
|
|
14
20
|
isOwnedAgentKey,
|
|
15
21
|
ownedAgentKey,
|
|
16
22
|
publicAgentKey
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import {
|
|
19
|
-
fnv1a32Hex
|
|
20
|
-
} from "./chunk-UKWGR5SS.js";
|
|
23
|
+
} from "./chunk-M2EJHDJP.js";
|
|
21
24
|
|
|
22
25
|
// packages/ai/agent/agentBilling.ts
|
|
23
26
|
function resolveBillingSource(candidate) {
|
|
@@ -227,6 +230,16 @@ function deriveCredentialGroup(ref) {
|
|
|
227
230
|
credentialKind: "api-key"
|
|
228
231
|
};
|
|
229
232
|
}
|
|
233
|
+
function deriveCustomProviderCredentialGroup(userId, customProviderUrl) {
|
|
234
|
+
if (typeof customProviderUrl !== "string" || !customProviderUrl.trim()) {
|
|
235
|
+
return void 0;
|
|
236
|
+
}
|
|
237
|
+
const basis = `${userId ?? ""}|${customProviderUrl.trim().toLowerCase()}`;
|
|
238
|
+
return {
|
|
239
|
+
credentialGroup: `custom-${fnv1a32Hex(basis)}`,
|
|
240
|
+
credentialKind: "api-key"
|
|
241
|
+
};
|
|
242
|
+
}
|
|
230
243
|
function summarizeCredentialGroups(agents, now = Date.now()) {
|
|
231
244
|
const groups = /* @__PURE__ */ new Map();
|
|
232
245
|
for (const agent of agents) {
|
|
@@ -327,6 +340,15 @@ function resolveFavoriteStatus(record, options) {
|
|
|
327
340
|
}
|
|
328
341
|
return { isFavorite: false, favoritedAt: null };
|
|
329
342
|
}
|
|
343
|
+
function isOwnedAgentRecord(record, userId) {
|
|
344
|
+
if (!userId) return false;
|
|
345
|
+
if (typeof record?.userId === "string" && record.userId === userId || typeof record?.ownerId === "string" && record.ownerId === userId) {
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
return [record?.dbKey, record?.privateKey].some(
|
|
349
|
+
(key) => isOwnedAgentKey(key, userId)
|
|
350
|
+
);
|
|
351
|
+
}
|
|
330
352
|
function toSafeAgentSummary(record, options) {
|
|
331
353
|
const rawId = parseAgentRecordId(
|
|
332
354
|
typeof record?.privateKey === "string" ? record.privateKey : record?.dbKey,
|
|
@@ -356,12 +378,13 @@ function toSafeAgentSummary(record, options) {
|
|
|
356
378
|
const isPublic = record?.isPublic === true || record?.isPublicFlag === true || record?.publicRecordExists === true;
|
|
357
379
|
const updatedAt = safeTimestamp(record?.updatedAt ?? record?.createdAt ?? record?.created);
|
|
358
380
|
const nextAvailableAt = typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? record.nextAvailableAt : void 0;
|
|
381
|
+
const rawQuota = record?.quota;
|
|
382
|
+
const quota = rawQuota && typeof rawQuota === "object" && Array.isArray(rawQuota.windows) && typeof rawQuota.observedAt === "number" && Number.isFinite(rawQuota.observedAt) ? rawQuota : void 0;
|
|
359
383
|
const currentUserId = options?.userId;
|
|
360
|
-
const isOwnedByRecord = Boolean(currentUserId) && (typeof record?.userId === "string" && record.userId === currentUserId || typeof record?.ownerId === "string" && record.ownerId === currentUserId);
|
|
361
384
|
const ownedKey = currentUserId ? [record?.dbKey, record?.privateKey].find(
|
|
362
385
|
(key) => isOwnedAgentKey(key, currentUserId)
|
|
363
386
|
) : void 0;
|
|
364
|
-
const isOwned =
|
|
387
|
+
const isOwned = isOwnedAgentRecord(record, currentUserId);
|
|
365
388
|
const isOAuth = isOAuthApiKeyRef(record?.apiKeyRef);
|
|
366
389
|
const billingSource = resolveBillingSource({
|
|
367
390
|
...record,
|
|
@@ -418,8 +441,12 @@ function toSafeAgentSummary(record, options) {
|
|
|
418
441
|
isOwned,
|
|
419
442
|
isOAuth,
|
|
420
443
|
...nextAvailableAt !== void 0 ? { nextAvailableAt } : {},
|
|
444
|
+
...quota !== void 0 ? { quota } : {},
|
|
421
445
|
...credentialGroup !== void 0 ? { credentialGroup } : {},
|
|
422
446
|
...credentialKind !== void 0 ? { credentialKind } : {},
|
|
447
|
+
// 「未知 ≠ 独立」:无 credentialGroup 时显式 credentialed:false,调用方
|
|
448
|
+
// 不得把缺失解读成独立凭证(并发扇出守卫依赖这个区分)。
|
|
449
|
+
credentialed: credentialGroup !== void 0,
|
|
423
450
|
updatedAt
|
|
424
451
|
};
|
|
425
452
|
}
|
|
@@ -445,8 +472,11 @@ var COMPACT_AGENT_SUMMARY_FIELDS = [
|
|
|
445
472
|
// 决策信息(CLI --show-unavailable 场景);默认列表已把这类 agent 过滤掉,
|
|
446
473
|
// 所以通常根本不占字节。
|
|
447
474
|
"nextAvailableAt",
|
|
475
|
+
// 额度快照:只有上游真上报过窗口的 agent 才带(通常是小对象)。
|
|
476
|
+
"quota",
|
|
448
477
|
"credentialGroup",
|
|
449
|
-
"credentialKind"
|
|
478
|
+
"credentialKind",
|
|
479
|
+
"credentialed"
|
|
450
480
|
];
|
|
451
481
|
function omitNullishAgentSummaryFields(summary) {
|
|
452
482
|
const result = {};
|
|
@@ -477,6 +507,7 @@ var UNAVAILABLE_AGENT_SUMMARY_FIELDS = [
|
|
|
477
507
|
"isOAuth",
|
|
478
508
|
"isOwned",
|
|
479
509
|
"nextAvailableAt",
|
|
510
|
+
"quota",
|
|
480
511
|
"favoritedAt",
|
|
481
512
|
"updatedAt"
|
|
482
513
|
];
|
|
@@ -496,12 +527,131 @@ function toUnavailableAgentSummary(summary) {
|
|
|
496
527
|
return item;
|
|
497
528
|
}
|
|
498
529
|
|
|
530
|
+
// packages/ai/agent/agentDiscovery.ts
|
|
531
|
+
function isPreferredAgent(agent) {
|
|
532
|
+
return agent.isFavorite === true || agent.isOwned === true || agent.isOAuth === true || agent.billingSource === "user_subscription" || agent.billingSource === "user_api" || agent.billingSource === "local";
|
|
533
|
+
}
|
|
534
|
+
function isPublicDiscoveryAgent(agent) {
|
|
535
|
+
return agent.isPublic === true && !isPreferredAgent(agent);
|
|
536
|
+
}
|
|
537
|
+
function resolveDiscoveryScope(args) {
|
|
538
|
+
const rawScope = typeof args?.scope === "string" ? args.scope.trim().toLowerCase() : void 0;
|
|
539
|
+
const hasScope = rawScope !== void 0 && rawScope !== "";
|
|
540
|
+
const hasPublicOnly = typeof args?.publicOnly === "boolean";
|
|
541
|
+
const publicOnly = args?.publicOnly === true;
|
|
542
|
+
if (hasScope) {
|
|
543
|
+
if (rawScope !== "preferred" && rawScope !== "public" && rawScope !== "all") {
|
|
544
|
+
throw new Error(`Invalid scope '${args?.scope}': must be 'preferred', 'public', or 'all'.`);
|
|
545
|
+
}
|
|
546
|
+
const scope = rawScope;
|
|
547
|
+
if (hasPublicOnly) {
|
|
548
|
+
if (publicOnly && scope !== "public") {
|
|
549
|
+
throw new Error(
|
|
550
|
+
`Conflicting arguments: scope='${args?.scope}' conflicts with publicOnly=true.`
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
if (!publicOnly && scope === "public") {
|
|
554
|
+
throw new Error(
|
|
555
|
+
`Conflicting arguments: scope='${args?.scope}' conflicts with publicOnly=false.`
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return scope;
|
|
560
|
+
}
|
|
561
|
+
if (hasPublicOnly && publicOnly) {
|
|
562
|
+
return "public";
|
|
563
|
+
}
|
|
564
|
+
return "preferred";
|
|
565
|
+
}
|
|
566
|
+
function agentIdentityKeys(agent) {
|
|
567
|
+
return [agent.agentKey, agent.publicKey, agent.id].filter(
|
|
568
|
+
(key) => typeof key === "string" && key.length > 0
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
function deduplicateAgentSummaries(agents) {
|
|
572
|
+
const byIdentity = /* @__PURE__ */ new Map();
|
|
573
|
+
for (const agent of agents) {
|
|
574
|
+
const keys = agentIdentityKeys(agent);
|
|
575
|
+
const existing = keys.map((key) => byIdentity.get(key)).find(Boolean);
|
|
576
|
+
if (!existing) {
|
|
577
|
+
for (const key of keys) byIdentity.set(key, agent);
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
const winner = isPreferredAgent(agent) && !isPreferredAgent(existing) ? agent : existing;
|
|
581
|
+
for (const key of /* @__PURE__ */ new Set([...agentIdentityKeys(existing), ...keys])) byIdentity.set(key, winner);
|
|
582
|
+
}
|
|
583
|
+
return [...new Set(byIdentity.values())];
|
|
584
|
+
}
|
|
585
|
+
function filterAgentsByScope(agents, scope) {
|
|
586
|
+
const unique = deduplicateAgentSummaries(agents);
|
|
587
|
+
if (scope === "preferred") return unique.filter((agent) => isPreferredAgent(agent));
|
|
588
|
+
if (scope === "public") return unique.filter((agent) => isPublicDiscoveryAgent(agent));
|
|
589
|
+
return unique.filter((agent) => isPreferredAgent(agent) || agent.isPublic === true);
|
|
590
|
+
}
|
|
591
|
+
function matchesAgentQuery(agent, query) {
|
|
592
|
+
if (!query || typeof query !== "string") return true;
|
|
593
|
+
const q = query.trim().toLowerCase();
|
|
594
|
+
if (!q) return true;
|
|
595
|
+
const candidates = [
|
|
596
|
+
agent.name,
|
|
597
|
+
agent.model,
|
|
598
|
+
agent.provider,
|
|
599
|
+
agent.handle,
|
|
600
|
+
agent.agentKey,
|
|
601
|
+
agent.publicKey,
|
|
602
|
+
agent.id
|
|
603
|
+
];
|
|
604
|
+
return candidates.some((text) => typeof text === "string" && text.toLowerCase().includes(q));
|
|
605
|
+
}
|
|
606
|
+
function buildAgentDiscoveryResult(options) {
|
|
607
|
+
const scope = resolveDiscoveryScope({
|
|
608
|
+
scope: options.scope,
|
|
609
|
+
publicOnly: options.publicOnly
|
|
610
|
+
});
|
|
611
|
+
const now = options.now ?? Date.now();
|
|
612
|
+
let scopedAgents = filterAgentsByScope(options.agents, scope);
|
|
613
|
+
if (options.query && typeof options.query === "string" && options.query.trim()) {
|
|
614
|
+
scopedAgents = scopedAgents.filter((a) => matchesAgentQuery(a, options.query));
|
|
615
|
+
}
|
|
616
|
+
const unavailableList = scopedAgents.filter((a) => isAgentUnavailableNow(a, now));
|
|
617
|
+
const unavailableCount = unavailableList.length;
|
|
618
|
+
const unavailableAgents = sortSafeAgentSummaries(unavailableList).map(toUnavailableAgentSummary);
|
|
619
|
+
const credentialGroups = summarizeCredentialGroups(scopedAgents, now);
|
|
620
|
+
if (options.showUnavailable !== true) {
|
|
621
|
+
scopedAgents = scopedAgents.filter((a) => !isAgentUnavailableNow(a, now));
|
|
622
|
+
}
|
|
623
|
+
const sortedAgents = sortSafeAgentSummaries(scopedAgents);
|
|
624
|
+
const projectedAgents = options.verbose === true ? sortedAgents.map(omitNullishAgentSummaryFields) : sortedAgents.map(toCompactAgentSummary);
|
|
625
|
+
return {
|
|
626
|
+
total: projectedAgents.length,
|
|
627
|
+
unavailableCount,
|
|
628
|
+
unavailableAgents,
|
|
629
|
+
credentialGroups,
|
|
630
|
+
agents: projectedAgents
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
function toDiscoverySafeAgentSummary(record, options) {
|
|
634
|
+
const mergedOptions = record?.publicRecordExists === true ? { ...options, publicRecordExists: true } : options;
|
|
635
|
+
return toSafeAgentSummary(record, mergedOptions);
|
|
636
|
+
}
|
|
637
|
+
function assembleAgentDiscoveryResult(options) {
|
|
638
|
+
const { records, summaryOptions, ...discoveryOptions } = options;
|
|
639
|
+
const agents = records.map(
|
|
640
|
+
(record) => toDiscoverySafeAgentSummary(
|
|
641
|
+
record,
|
|
642
|
+
typeof summaryOptions === "function" ? summaryOptions(record) : summaryOptions
|
|
643
|
+
)
|
|
644
|
+
);
|
|
645
|
+
return buildAgentDiscoveryResult({ ...discoveryOptions, agents });
|
|
646
|
+
}
|
|
647
|
+
|
|
499
648
|
export {
|
|
500
649
|
deriveCredentialGroup,
|
|
650
|
+
deriveCustomProviderCredentialGroup,
|
|
501
651
|
summarizeCredentialGroups,
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
652
|
+
resolveDiscoveryScope,
|
|
653
|
+
matchesAgentQuery,
|
|
654
|
+
buildAgentDiscoveryResult,
|
|
655
|
+
toDiscoverySafeAgentSummary,
|
|
656
|
+
assembleAgentDiscoveryResult
|
|
507
657
|
};
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
asNonEmptyStringArray,
|
|
6
6
|
asTrimmedNonEmptyStringArray
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3AH7LNUB.js";
|
|
8
8
|
import {
|
|
9
9
|
asOptionalFiniteNumber
|
|
10
10
|
} from "./chunk-WWC7I6TA.js";
|
|
11
|
+
import {
|
|
12
|
+
isRecord
|
|
13
|
+
} from "./chunk-KUG52IAP.js";
|
|
11
14
|
import {
|
|
12
15
|
isOwnedAgentKey,
|
|
13
16
|
ownedAgentKey,
|
|
14
17
|
publicAgentKey
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import {
|
|
17
|
-
isRecord
|
|
18
|
-
} from "./chunk-KUG52IAP.js";
|
|
18
|
+
} from "./chunk-M2EJHDJP.js";
|
|
19
19
|
import {
|
|
20
20
|
asOptionalTrimmedString
|
|
21
21
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -25,6 +25,7 @@ var DEFAULT_PRIVATE_NOLO_WORKSPACE_TOOLS = [
|
|
|
25
25
|
"listDialogs",
|
|
26
26
|
"readDialog",
|
|
27
27
|
"queryDialogsBySubjectRef",
|
|
28
|
+
"deleteDialogs",
|
|
28
29
|
"listAgents",
|
|
29
30
|
"readAgent",
|
|
30
31
|
"listSpaces",
|
|
@@ -763,6 +764,7 @@ var AGENT_SELECTION_PRIORITY_INSTRUCTIONS = ` - \u4F18\u5148\u7EA7\u5951\u7EA6
|
|
|
763
764
|
4. \u516C\u5F00 Agent \u53D1\u73B0\uFF1A\u4EC5\u5F53 preferred \u5217\u8868\u4E2D\u6CA1\u6709\u9002\u5408\u4E14\u53EF\u7528\u7684\u5019\u9009\uFF0C\u6216\u7528\u6237\u660E\u786E\u8981\u6C42\u63A2\u7D22\u516C\u5F00 Agent \u65F6\uFF0C\u624D\u663E\u5F0F\u8C03\u7528 listAgents({ scope: "public" })\u3002\u516C\u5F00 Agent \u53EF\u80FD\u6D88\u8017 platform_credits\uFF0C\u5FC5\u987B\u5728\u83B7\u5F97\u7528\u6237\u660E\u786E\u6263\u8D39\u6388\u6743\u540E\u624D\u80FD\u8C03\u7528\u3002
|
|
764
765
|
- \u6536\u85CF\u4F18\u5148\u786C\u95E8\uFF08\u7528\u6237\u94A6\u5B9A\uFF0C\u8986\u76D6\u9876\u6863\u6210\u672C\u95E8\uFF09\uFF1A\u5F53\u5B58\u5728\u53EF\u7528\u4E14\u9002\u5408\u4EFB\u52A1\u7684\u6536\u85CF user_subscription / user_api / local Agent \u65F6\uFF0C\u7981\u6B62\u6539\u6D3E platform_credits\u3002favorite + platform_credits \u53EA\u8868\u793A\u7528\u6237\u8868\u8FBE\u8FC7\u504F\u597D\u5E76\u56E0\u6B64\u8FDB\u5165 preferred discovery\uFF0C\u4E0D\u4EE3\u8868\u514D\u8D39\u6216\u514D\u6388\u6743\uFF1B\u4F7F\u7528\u5B83\u4ECD\u987B\u9075\u5B88\u5E73\u53F0\u79EF\u5206\u6263\u8D39\u544A\u77E5/\u6388\u6743\u89C4\u5219\u3002\u4F46\u6CE8\u610F\u533A\u5206\uFF1AbillingSource="owner_subscription" \u7684\u6536\u85CF Agent\uFF08\u975E\u81EA\u6709\u3001\u8DD1 owner \u7684\u8BA2\u9605\u901A\u9053\uFF09\u4E0D\u5C5E\u4E8E\u6B64\u5217\u2014\u2014\u5B83\u662F\u53EF\u76F4\u63A5\u4F7F\u7528\u7684\uFF0C\u4E0D\u4EA7\u751F\u4EFB\u4F55\u6263\u8D39\uFF0C\u4E0D\u8981\u5BF9\u5B83\u7D22\u53D6\u6263\u8D39\u6388\u6743\u3001\u4E5F\u4E0D\u8981\u56E0\u6B64\u6539\u6D3E\u5E73\u53F0 Agent\u3002\u6BCF\u6B21 startAgentRun \u90FD\u521B\u5EFA\u72EC\u7ACB\u7684 run/dialog\uFF1B\u5E76\u884C\u6D3E\u53D1\u65F6\u5FC5\u987B\u7528\u5404\u81EA\u7684 runId\uFF0C\u5E76\u7528 batchId \u7BA1\u7406\u6279\u6B21\uFF0C\u907F\u514D\u7F16\u6392\u5C42\u6DF7\u6DC6\u7ED3\u679C\u3002\u4EC5\u5F53\u6536\u85CF Agent \u786E\u8BA4\u4E0D\u53EF\u7528\u540E\u624D\u5141\u8BB8\u6D3E\u5E73\u53F0 Agent\uFF0C\u4E14\u5FC5\u987B\u5F53\u6B21\u544A\u77E5\u7528\u6237\u5C06\u6D88\u8017\u5E73\u53F0\u79EF\u5206\u3002
|
|
765
766
|
- \u5339\u914D\u53C2\u8003\uFF1A\u6309\u4EFB\u52A1\u6240\u9700\u80FD\u529B\u7B5B tools \u5B57\u6BB5\uFF1B\u540C\u6863\u5019\u9009\u4F18\u5148\u6210\u672C\u4F4E\uFF08\u4F4E inputPrice\uFF09\u6216\u8D70\u7528\u6237\u79C1\u6709\u51ED\u636E\u7684\u901A\u9053\u3002tools \u5B57\u6BB5\u53EA\u53CD\u6620\u989D\u5916\u80FD\u529B\uFF0C\u4E0D\u53CD\u6620 coding \u80FD\u529B\u2014\u2014\u4EE3\u7801\u5DE5\u5177\u7531 host \u81EA\u52A8\u6CE8\u5165\uFF0Ctools=[] \u4E0D\u4EE3\u8868\u4E0D\u80FD\u5199\u4EE3\u7801\uFF0C\u4E0D\u8981\u636E\u6B64\u6392\u9664\u5019\u9009\u3002
|
|
767
|
+
- reset-aware economics\uFF08\u53EA\u4F5C\u540C\u6863\u3001\u9002\u5408\u3001\u5F53\u524D\u53EF\u7528\u5019\u9009\u4E4B\u95F4\u7684\u7ECF\u6D4E\u504F\u597D\uFF0C\u4E0D\u8986\u76D6\u6536\u85CF\u786C\u95E8\u3001\u80FD\u529B\u5339\u914D\u6216\u53EF\u7528\u6027\uFF09\uFF1AlistAgents \u5DF2\u66B4\u9732 economics\uFF08\u5B98\u65B9\u5CF0\u8C37\u4EF7\u683C/\u914D\u989D\u500D\u7387\uFF09\u548C quota\uFF08\u4E0A\u6E38\u771F\u5B9E remaining/limit/utilization/resetAt \u7A97\u53E3\uFF09\u3002\u5BF9\u4E8E billingSource="user_subscription"\uFF0C\u82E5 quota \u7A97\u53E3\u540C\u65F6\u7ED9\u51FA\u672A\u7528\u989D\u5EA6\u4FE1\u53F7\uFF08remaining/limit \u6216 utilization\uFF09\u4E14 resetAt \u5728\u672A\u6765\uFF0C\u4E14\u8BE5\u7A97\u53E3\u4EE3\u8868\u8BA2\u9605\u989D\u5EA6\u672C\u8EAB\uFF08\u5982 Claude \u8BA2\u9605\u7684 5h/7d \u914D\u989D\u7A97\u53E3\u8FD9\u7C7B\u4E0D\u7528\u5C31\u4F5C\u5E9F\u7684\u5DF2\u4ED8\u989D\u5EA6\uFF09\uFF0C\u800C\u4E0D\u662F\u7EAF\u541E\u5410\u5BB9\u91CF\uFF0C\u5219\u8FD9\u90E8\u5206\u5DF2\u4ED8\u989D\u5EA6\u4F1A\u5728 reset \u540E\u5931\u6548\uFF1B\u5728\u8D28\u91CF/\u80FD\u529B\u90FD\u8DB3\u591F\u65F6\uFF0Creset \u8D8A\u8FD1\u4E14\u672A\u7528\u989D\u5EA6\u8D8A\u591A\uFF0C\u8D8A\u5E94\u4F18\u5148\u6D88\u8017\uFF0C\u907F\u514D\u628A\u5DF2\u4ED8\u6B3E\u989D\u5EA6\u767D\u767D\u8FC7\u671F\u540E\u518D\u53BB\u4EA7\u751F PAYG / platform \u6210\u672C\u3002\u4E0D\u8981\u56E0\u4E3A\u53EA\u6709 resetAt \u5C31\u63A8\u65AD\u201C\u8FD8\u6709\u53EF\u7528\u989D\u5EA6\u201D\uFF0C\u4E5F\u4E0D\u8981\u628A billingSource="user_api" \u7684 requests/tokens rate-limit reset\u3001nextAvailableAt\uFF08429 \u51B7\u5374\u6062\u590D\uFF09\u8BEF\u5F53\u6210\u201C\u5DF2\u4ED8\u989D\u5EA6\u8FC7\u671F\u201D\uFF1B\u5B83\u4EEC\u662F\u5BB9\u91CF/\u53EF\u7528\u6027\u4FE1\u53F7\uFF0C\u4E0D\u662F\u7ECF\u6D4E\u4F18\u60E0\u3002\u901A\u7528 requests/tokens rate-limit \u5BB9\u91CF\u7A97\u53E3\u5373\u4F7F\u51FA\u73B0\u5728 billingSource="user_subscription" \u901A\u9053\u4E0A\uFF0C\u4E5F\u53EA\u662F\u901F\u7387\u5BB9\u91CF\u800C\u975E\u4F1A\u8FC7\u671F\u7684\u5DF2\u4ED8\u8D44\u4EA7\uFF0C\u4E0D\u5F97\u89E6\u53D1\u8BE5\u504F\u597D\uFF1B\u5206\u4E0D\u6E05\u7A97\u53E3\u8BED\u4E49\u65F6\u6309\u5BB9\u91CF\u5904\u7406\uFF0C\u4E0D\u6309\u7ECF\u6D4E\u8D44\u4EA7\u5904\u7406\u3002owner_subscription \u4E0D\u5360\u5F53\u524D\u7528\u6237\u989D\u5EA6\uFF0C\u4ECD\u6309\u201C\u8C03\u7528\u8005\u4E0E\u5E73\u53F0\u96F6\u65B0\u589E\u6210\u672C\u201D\u7406\u89E3\uFF0C\u4F46\u4E0D\u8981\u628A owner \u7684 quota \u5F53\u6210\u5F53\u524D\u7528\u6237\u9700\u8981\u4E3B\u52A8\u70E7\u5B8C\u7684\u8D44\u4EA7\u3002\u82E5 economics \u663E\u793A\u5373\u5C06\u8DE8 peak/off_peak \u6216 quotaMultiplier/priceMultiplier \u5C06\u53D8\u5316\uFF0C\u628A changesAt \u4E0E\u4EFB\u52A1\u9884\u8BA1\u65F6\u957F\u4E00\u8D77\u8003\u8651\uFF1B\u8BC1\u636E\u4E0D\u8DB3\u65F6\u4FDD\u6301 neutral\uFF0C\u4E0D\u731C\u3002
|
|
766
768
|
- isOwned=true\u3001isOAuth=true \u6216 apiSource="custom" \u7684\u5019\u9009\u6309\u4F18\u5148\u7EA7\u5951\u7EA6\u5904\u7406\u3002
|
|
767
769
|
- qualityContext \u662F task-domain-specific supporting evidence\uFF1A\u53EA\u5728\u5339\u914D\u7684 task domain \u5185\u3001suitable candidates \u4E2D\uFF0C\u5E76\u4E14\u4ECD\u6392\u5728\u73B0\u6709\u4F18\u5148\u7EA7 / \u6210\u672C / \u53EF\u7528\u6027\u89C4\u5219\u4E4B\u540E\u53C2\u8003\u3002
|
|
768
770
|
\u6BCF\u884C\u5F62\u5982 \`dimension [direction] (benchmark version): model=score\`\u3002\u6BCF\u4E2A dimension\uFF08preference / rubric / slop / repetition / length / task_success \u7B49\uFF09\u90FD\u662F\u4E00\u6761\u72EC\u7ACB evidence\uFF0C\u4E0D\u662F\u603B\u5206\u7684\u4E00\u90E8\u5206\u3002
|
|
@@ -853,6 +855,7 @@ function buildNoloWorkspaceOpenAiTools(args) {
|
|
|
853
855
|
}
|
|
854
856
|
}, ["query"]);
|
|
855
857
|
add("listAgents", "List agents for delegation. Default scope='preferred' returns the user's favorites, owned, OAuth, custom API, and local agents only; scope='public' discovers shared/marketplace agents; scope='all' returns their deduplicated union. Public agents may consume platform credits. Copy the agentKey verbatim; use the runnable agentKey exactly and do not infer it from the display name. publicOnly is deprecated compatibility for scope='public'. Rate-limited agents are hidden unless showUnavailable is true.", {
|
|
858
|
+
query: stringToolParam("Optional case-insensitive search substring matching agent name, model, provider, handle, or agentKey."),
|
|
856
859
|
scope: { type: "string", enum: ["preferred", "public", "all"], description: "Discovery scope; preferred is the default and does not load the public marketplace." },
|
|
857
860
|
publicOnly: { type: "boolean", description: "Deprecated compatibility alias for scope='public'." },
|
|
858
861
|
showUnavailable: { type: "boolean", description: "Include agents currently rate-limited (429). Default false." },
|
|
@@ -1182,6 +1185,8 @@ function buildNoloWorkspaceCommandArgs(call) {
|
|
|
1182
1185
|
}
|
|
1183
1186
|
case "listAgents": {
|
|
1184
1187
|
const cliArgs = ["agent", "list"];
|
|
1188
|
+
const query = noloStringArg(args.query);
|
|
1189
|
+
if (query) cliArgs.push("--query", query);
|
|
1185
1190
|
const space = noloStringArg(args.space);
|
|
1186
1191
|
if (space) cliArgs.push("--space", space);
|
|
1187
1192
|
const scope = noloStringArg(args.scope);
|
|
@@ -1,25 +1,62 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeTimingMs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-F64B2W3R.js";
|
|
4
4
|
import {
|
|
5
5
|
MODEL_LOOKUP_MAP
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZI2MEZMT.js";
|
|
7
7
|
import {
|
|
8
8
|
ALL_MODELS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ACTMNVHM.js";
|
|
10
10
|
import {
|
|
11
11
|
asTrimmedNonEmptyStringArray
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3AH7LNUB.js";
|
|
13
13
|
import {
|
|
14
14
|
asOptionalFiniteNumber
|
|
15
15
|
} from "./chunk-WWC7I6TA.js";
|
|
16
16
|
import {
|
|
17
17
|
BUILTIN_NOLO_AGENT_KEY
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-BNGW5ASC.js";
|
|
19
19
|
import {
|
|
20
20
|
asOptionalTrimmedString
|
|
21
21
|
} from "./chunk-G3SUCT4W.js";
|
|
22
22
|
|
|
23
|
+
// packages/agent-runtime/autoExecutionProfiles.ts
|
|
24
|
+
var createProfile = (input) => ({
|
|
25
|
+
id: input.id,
|
|
26
|
+
tier: input.tier,
|
|
27
|
+
legacyAgentKey: input.legacyAgentKey,
|
|
28
|
+
key: input.legacyAgentKey,
|
|
29
|
+
name: input.name,
|
|
30
|
+
provider: "nolo",
|
|
31
|
+
model: input.model,
|
|
32
|
+
apiSource: "platform",
|
|
33
|
+
useServerProxy: true,
|
|
34
|
+
rawRecord: {
|
|
35
|
+
dbKey: input.legacyAgentKey,
|
|
36
|
+
isPublic: true,
|
|
37
|
+
provider: "nolo",
|
|
38
|
+
model: input.model,
|
|
39
|
+
apiSource: "platform",
|
|
40
|
+
useServerProxy: true
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
var FLASH_PROFILE = createProfile({
|
|
44
|
+
id: "builtin:auto:nolo",
|
|
45
|
+
tier: "flash",
|
|
46
|
+
legacyAgentKey: BUILTIN_NOLO_AGENT_KEY,
|
|
47
|
+
name: "nolo",
|
|
48
|
+
model: "deepseek-flash"
|
|
49
|
+
});
|
|
50
|
+
var AUTO_EXECUTION_PROFILES = {
|
|
51
|
+
flash: FLASH_PROFILE,
|
|
52
|
+
balanced: { ...FLASH_PROFILE, tier: "balanced" },
|
|
53
|
+
quality: { ...FLASH_PROFILE, tier: "quality" },
|
|
54
|
+
image: { ...FLASH_PROFILE, tier: "image" }
|
|
55
|
+
};
|
|
56
|
+
var DEFAULT_AUTO_EXECUTION_TIER = "flash";
|
|
57
|
+
var DEFAULT_AUTO_EXECUTION_PROFILE = AUTO_EXECUTION_PROFILES[DEFAULT_AUTO_EXECUTION_TIER];
|
|
58
|
+
var resolveAutoExecutionProfile = (tier) => AUTO_EXECUTION_PROFILES[tier ?? DEFAULT_AUTO_EXECUTION_TIER] ?? DEFAULT_AUTO_EXECUTION_PROFILE;
|
|
59
|
+
|
|
23
60
|
// packages/ai/token/cacheTokenFields.ts
|
|
24
61
|
var finiteTokenCount = (value) => {
|
|
25
62
|
if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
|
|
@@ -346,44 +383,9 @@ function resolveTruncatedReasoningTailLog(reason, reasoning_content) {
|
|
|
346
383
|
return null;
|
|
347
384
|
}
|
|
348
385
|
|
|
349
|
-
// packages/agent-runtime/autoExecutionProfiles.ts
|
|
350
|
-
var createProfile = (input) => ({
|
|
351
|
-
id: input.id,
|
|
352
|
-
tier: input.tier,
|
|
353
|
-
legacyAgentKey: input.legacyAgentKey,
|
|
354
|
-
key: input.legacyAgentKey,
|
|
355
|
-
name: input.name,
|
|
356
|
-
provider: "nolo",
|
|
357
|
-
model: input.model,
|
|
358
|
-
apiSource: "platform",
|
|
359
|
-
useServerProxy: true,
|
|
360
|
-
rawRecord: {
|
|
361
|
-
dbKey: input.legacyAgentKey,
|
|
362
|
-
isPublic: true,
|
|
363
|
-
provider: "nolo",
|
|
364
|
-
model: input.model,
|
|
365
|
-
apiSource: "platform",
|
|
366
|
-
useServerProxy: true
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
var FLASH_PROFILE = createProfile({
|
|
370
|
-
id: "builtin:auto:nolo",
|
|
371
|
-
tier: "flash",
|
|
372
|
-
legacyAgentKey: BUILTIN_NOLO_AGENT_KEY,
|
|
373
|
-
name: "nolo",
|
|
374
|
-
model: "deepseek-flash"
|
|
375
|
-
});
|
|
376
|
-
var AUTO_EXECUTION_PROFILES = {
|
|
377
|
-
flash: FLASH_PROFILE,
|
|
378
|
-
balanced: { ...FLASH_PROFILE, tier: "balanced" },
|
|
379
|
-
quality: { ...FLASH_PROFILE, tier: "quality" },
|
|
380
|
-
image: { ...FLASH_PROFILE, tier: "image" }
|
|
381
|
-
};
|
|
382
|
-
var DEFAULT_AUTO_EXECUTION_TIER = "flash";
|
|
383
|
-
var DEFAULT_AUTO_EXECUTION_PROFILE = AUTO_EXECUTION_PROFILES[DEFAULT_AUTO_EXECUTION_TIER];
|
|
384
|
-
var resolveAutoExecutionProfile = (tier) => AUTO_EXECUTION_PROFILES[tier ?? DEFAULT_AUTO_EXECUTION_TIER] ?? DEFAULT_AUTO_EXECUTION_PROFILE;
|
|
385
|
-
|
|
386
386
|
export {
|
|
387
|
+
DEFAULT_AUTO_EXECUTION_PROFILE,
|
|
388
|
+
resolveAutoExecutionProfile,
|
|
387
389
|
readCacheReadInputTokens,
|
|
388
390
|
readCacheCreationInputTokens,
|
|
389
391
|
DEFAULT_CONTEXT_WINDOW,
|
|
@@ -399,7 +401,5 @@ export {
|
|
|
399
401
|
resolveEmptyAssistantOutcome,
|
|
400
402
|
resolveEmptyAssistantFallbackMessage,
|
|
401
403
|
hasAssistantVisibleOutput,
|
|
402
|
-
resolveTruncatedReasoningTailLog
|
|
403
|
-
DEFAULT_AUTO_EXECUTION_PROFILE,
|
|
404
|
-
resolveAutoExecutionProfile
|
|
404
|
+
resolveTruncatedReasoningTailLog
|
|
405
405
|
};
|
|
@@ -24,8 +24,10 @@ var extractCustomId = (key) => {
|
|
|
24
24
|
return extractKeyPart(key, 2);
|
|
25
25
|
};
|
|
26
26
|
var PUBLIC_AGENT_KEY_PREFIX = "agent-pub-";
|
|
27
|
+
var SYSTEM_AGENT_KEY_PREFIX = "agent-system-";
|
|
27
28
|
var publicAgentKey = (id) => `${PUBLIC_AGENT_KEY_PREFIX}${id}`;
|
|
28
29
|
var parsePublicAgentId = (key) => key.startsWith(PUBLIC_AGENT_KEY_PREFIX) ? key.slice(PUBLIC_AGENT_KEY_PREFIX.length) : null;
|
|
30
|
+
var parseSystemAgentId = (key) => key.startsWith(SYSTEM_AGENT_KEY_PREFIX) ? key.slice(SYSTEM_AGENT_KEY_PREFIX.length) : null;
|
|
29
31
|
var ownedAgentKeyPrefix = (userId) => `agent-${userId}-`;
|
|
30
32
|
var ownedAgentKey = (userId, id) => id.startsWith(ownedAgentKeyPrefix(userId)) ? id : `${ownedAgentKeyPrefix(userId)}${id}`;
|
|
31
33
|
var isOwnedAgentKey = (key, userId) => typeof key === "string" && key.startsWith(ownedAgentKeyPrefix(userId));
|
|
@@ -37,6 +39,7 @@ export {
|
|
|
37
39
|
PUBLIC_AGENT_KEY_PREFIX,
|
|
38
40
|
publicAgentKey,
|
|
39
41
|
parsePublicAgentId,
|
|
42
|
+
parseSystemAgentId,
|
|
40
43
|
ownedAgentKeyPrefix,
|
|
41
44
|
ownedAgentKey,
|
|
42
45
|
isOwnedAgentKey,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
patch,
|
|
12
12
|
readAndWait
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QALRKMHF.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-2HYFUXUM.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-AUJHHXGG.js");
|
|
369
369
|
return createPageAction(args, thunkApi);
|
|
370
370
|
}
|
|
371
371
|
function subscribe(listener) {
|
|
@@ -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
|
+
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
resolvePlatformChatCompletionsEndpoint,
|
|
4
4
|
resolvePlatformHostedCredentialProvider,
|
|
5
5
|
resolvePlatformResponsesEndpoint
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZGJLSHER.js";
|
|
7
7
|
import {
|
|
8
8
|
CLI_PROVIDER_VALUES
|
|
9
9
|
} from "./chunk-W7XHHYWM.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
CLIENT_VERSION_TOO_OLD_CODE,
|
|
12
12
|
buildClientVersionGateErrorDetail,
|
|
13
13
|
evaluatePlatformHostedClientVersionGate
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Q67DOFOO.js";
|
|
15
15
|
import {
|
|
16
16
|
asTrimmedLowercaseString
|
|
17
17
|
} from "./chunk-QSJ3HFEF.js";
|