nolo-cli 0.226.0-alpha.2 → 0.227.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-IKZGZZXW.js → _executeModel-JKQGZ3HU.js} +60 -60
- package/accountResolver-EK2S4PWF.js +1 -1
- package/action-CK64LS6S.js +3 -3
- package/{addContentAction-EQXMFNPR.js → addContentAction-CARFID6E.js} +11 -11
- package/{addDialogAgentAction-RSDZDASD.js → addDialogAgentAction-APLZLFW5.js} +10 -10
- package/{agentDeleteCommand-IZY3VF5F.js → agentDeleteCommand-NVR2V2HH.js} +86 -87
- package/{agentEmailCommands-YWL567CL.js → agentEmailCommands-UCVOWD3S.js} +86 -87
- package/{agentFavoriteCommands-2LKGKSUD.js → agentFavoriteCommands-4PDOP3GW.js} +3 -3
- package/{agentGrantCommands-QQV4N4JW.js → agentGrantCommands-FLCEXLUH.js} +4 -4
- package/{agentListCommands-YBNOQ5T3.js → agentListCommands-C65UESYM.js} +70 -57
- package/{agentMachineCommands-AXJ4A772.js → agentMachineCommands-V3DGEJU4.js} +43 -43
- package/{agentProviderCommands-7BSJH7TO.js → agentProviderCommands-7QBFRFRK.js} +4 -4
- package/{agentPullCommand-XN6ZPBUW.js → agentPullCommand-E6JBGBVG.js} +3 -3
- package/{agentRecordCommands-WUUC2CX7.js → agentRecordCommands-6RCJS2EY.js} +83 -84
- package/{agentRunCommand-W6MDKVLJ.js → agentRunCommand-P3GRKXKS.js} +86 -86
- package/{agentRunControl-DFEEOFC7.js → agentRunControl-SNZZ5XP4.js} +10 -10
- package/{agentRuntimeLocal-GSTYFEX4.js → agentRuntimeLocal-GOX2DIY7.js} +38 -38
- package/{agentSlice-5F5U5X2U.js → agentSlice-N7H2FRJA.js} +15 -15
- package/{appDeleteCommands-L7HL4AWF.js → appDeleteCommands-LZDN26FU.js} +47 -47
- package/{appDeployCommands-SGSUNFZR.js → appDeployCommands-6IO6TTZH.js} +47 -47
- package/{appDeployStatusCommands-AAA3XD54.js → appDeployStatusCommands-FG3LX24J.js} +47 -47
- package/{appGetCommands-LN72GAOA.js → appGetCommands-NAKVDVD4.js} +47 -47
- package/{appListCommands-IJQQ3VND.js → appListCommands-KL56RN73.js} +47 -47
- package/{authCommand-7JXW54U4.js → authCommand-AUN5MXV2.js} +20 -20
- package/{authCommands-YDNAIDEY.js → authCommands-D2IPS6ES.js} +7 -7
- package/{builtinSkillRegistry-PXH7EGQB.js → builtinSkillRegistry-UQGLKRYP.js} +5 -5
- package/{chromeOpsCommands-YKX2QX3A.js → chromeOpsCommands-UJWN5HWH.js} +5 -5
- package/{chunk-3QFLXA24.js → chunk-2G3YSVO6.js} +1 -1
- package/{chunk-2COEG5ZV.js → chunk-2SKTCNWO.js} +2 -2
- package/{chunk-KNIIRXHF.js → chunk-3HTP4WZQ.js} +2 -2
- package/{chunk-2TIQO6TC.js → chunk-3VFYQH3I.js} +21 -170
- package/{chunk-AZQZ5XPM.js → chunk-4OKTPFNX.js} +27 -27
- package/{chunk-UYOICCYG.js → chunk-5HL4KC4A.js} +9 -9
- package/{chunk-2VA6TU4I.js → chunk-5LQDHFBN.js} +14 -14
- package/{chunk-QLFCTYRH.js → chunk-5RKRXQ2H.js} +2 -2
- package/{chunk-PDCV7P5W.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-QTMIHVLE.js → chunk-7Z3WUZ4Q.js} +27 -24
- package/{chunk-BLSNUIZD.js → chunk-ABGULE7H.js} +13 -13
- package/{chunk-VQUWV3YR.js → chunk-AXYH4734.js} +12 -12
- package/{chunk-UEKXWO7A.js → chunk-C2B7M567.js} +4 -4
- package/{chunk-2ZKFCIJJ.js → chunk-CLCXHIBS.js} +1 -1
- package/{chunk-GBZ4YKEO.js → chunk-CQVGR3MX.js} +2 -2
- package/{chunk-KC4SCKXO.js → chunk-CVERLOJM.js} +51 -52
- package/{chunk-KN3HEZIQ.js → chunk-EVGU5P4U.js} +1 -1
- package/{chunk-QZI44GWV.js → chunk-F5AY2UZL.js} +145 -4
- package/{chunk-WSJMT3FA.js → chunk-FKEZOMIF.js} +426 -2459
- package/{chunk-PVZY6P3S.js → chunk-G6HJUMST.js} +2 -2
- package/{chunk-NEKH3XDV.js → chunk-GOLPOTG5.js} +3 -3
- package/{chunk-GVGOEMNV.js → chunk-GOQ6ZVTN.js} +1 -1
- package/{chunk-T3T57NVP.js → chunk-GRXSJR2Z.js} +19 -19
- package/{chunk-GGKNJ42M.js → chunk-GUVXQSFZ.js} +2 -2
- package/{chunk-UKS7D2NL.js → chunk-HYKGIXNO.js} +9 -9
- package/{chunk-6O5YP6FX.js → chunk-IAJJYHIB.js} +5 -5
- package/{chunk-SOF4OWDM.js → chunk-IC2I373Q.js} +3 -5
- package/{chunk-UJKTI5PG.js → chunk-ILHQ2AXT.js} +0 -1
- package/{chunk-VV7TXWOC.js → chunk-IX2BXN2K.js} +3 -3
- package/{chunk-RRVQ446B.js → chunk-JHF6VLVL.js} +29 -29
- package/{chunk-DISQCYPE.js → chunk-KJAAPGBE.js} +1 -1
- package/{chunk-N5PQJKCY.js → chunk-KMRKZNGT.js} +5 -5
- package/{chunk-GNHMRBYZ.js → chunk-KRRE4A7D.js} +3 -3
- package/{chunk-6J4TTPS2.js → chunk-L42CBKBZ.js} +4 -4
- package/{chunk-BYH3HMUP.js → chunk-LA7JYAKF.js} +3 -3
- package/{chunk-EJU6WCDH.js → chunk-LXTC53TN.js} +84 -72
- package/{chunk-67BE44IS.js → chunk-M3Y4IBIR.js} +4 -4
- package/{chunk-GIABSSWQ.js → chunk-MWHOH4RJ.js} +1 -1
- package/{chunk-3KNEE64G.js → chunk-NAOO4PVX.js} +16 -16
- package/{chunk-MOMR7NMG.js → chunk-NO3VBWTL.js} +1 -1
- package/{chunk-YDBMZ7FV.js → chunk-OXA5GWHU.js} +2 -2
- package/{chunk-FTQWYWUI.js → chunk-PHOSZT3E.js} +1 -1
- package/{chunk-C4WTX5TU.js → chunk-PLPLH2XZ.js} +1 -1
- package/{chunk-W772FYAQ.js → chunk-PVAWNHP5.js} +52 -52
- package/{chunk-OLMJR6UM.js → chunk-PXKF5CV4.js} +4 -4
- package/{chunk-ZH6MUQEO.js → chunk-RU6DULV4.js} +1 -1
- package/{chunk-JVRQ6YVK.js → chunk-S6K5F3KP.js} +1 -1
- package/{chunk-AVHRSJUH.js → chunk-SFTTXGPM.js} +10 -10
- package/{chunk-4HFTBHBF.js → chunk-SRG5CNLC.js} +4 -4
- package/{chunk-HHL7WG65.js → chunk-SW6OD4KE.js} +6 -6
- package/{chunk-TXGQ4O5S.js → chunk-T43K75CK.js} +13 -13
- package/{chunk-KZU52OJ5.js → chunk-T5N6NHAT.js} +6 -6
- package/{chunk-JHRQXQ4A.js → chunk-TINJKQSO.js} +11 -11
- package/{chunk-JM5C4EUA.js → chunk-TOKPHZ55.js} +1 -1
- package/{chunk-GBUDWITV.js → chunk-UAPNPNSG.js} +892 -625
- package/{chunk-BGGHA5DV.js → chunk-UCFPVYP7.js} +1 -1
- package/{chunk-SOG7OEXX.js → chunk-ULAQPRHX.js} +1 -1
- package/{chunk-SBVTHMEG.js → chunk-UN7HIYMH.js} +1 -1
- package/{chunk-GOAPXKQU.js → chunk-UVUVQVZ6.js} +4 -4
- package/{chunk-4AMQZTE7.js → chunk-VIHDJ3FK.js} +5 -5
- package/{chunk-EWPDMS4N.js → chunk-VPAZ6BEN.js} +1 -1
- package/{chunk-XN23AUVU.js → chunk-VZW34YUL.js} +3 -3
- package/{chunk-D726I5AZ.js → chunk-WJP4TH6U.js} +1 -1
- package/{chunk-EOWLBDY6.js → chunk-X2KRQP7V.js} +1 -1
- package/{chunk-F7DU25CE.js → chunk-XIEYGCN6.js} +4 -10
- package/{chunk-KOXKKHFE.js → chunk-XZODOEKU.js} +1 -1
- package/{chunk-QVBXJNZ2.js → chunk-YGILMZ7N.js} +1 -1
- package/{chunk-C4VAR65S.js → chunk-YOT437BH.js} +5 -5
- package/{chunk-VFBVA3U2.js → chunk-YPPKC6FL.js} +2 -2
- package/{chunk-LM2PS3YS.js → chunk-YQETUZ5V.js} +5 -5
- package/{chunk-E5EIYI34.js → chunk-ZADGPNTV.js} +24 -24
- package/{chunk-L4NFXFFF.js → chunk-ZI5SZ3MV.js} +11 -11
- package/{chunk-EFX3Q5SM.js → chunk-ZYA2YDB6.js} +18 -18
- package/{cliAgentConfigHelpers-KICKKNYQ.js → cliAgentConfigHelpers-QVSQYTKC.js} +10 -10
- package/{cliEnvHelpers-VPSJ4XWC.js → cliEnvHelpers-D6HMC46Z.js} +2 -2
- package/{cliLocalAgentRecordReader-6FXGFBI3.js → cliLocalAgentRecordReader-SPKAJYME.js} +45 -45
- package/{commandRegistry-6EQXVODF.js → commandRegistry-TKR6OWXP.js} +91 -91
- package/{contentThunks-ANUP57QV.js → contentThunks-BQWRPCTM.js} +29 -29
- package/{createAgentAutomationAction-XMUWUDKQ.js → createAgentAutomationAction-GFI6SJZV.js} +32 -32
- package/{createDialogAction-43QJIQDH.js → createDialogAction-MMBIHFFU.js} +30 -30
- package/{createPageAction-SJO7UC3J.js → createPageAction-EEYUE5FB.js} +32 -32
- package/{dbSlice-ZJPDIFER.js → dbSlice-X4Z4E4QU.js} +10 -10
- package/{deleteFile-Q3YDB4ML.js → deleteFile-QOOP2UK7.js} +5 -5
- package/{dialogCommands-V5IYEOQP.js → dialogCommands-OXBQ73DD.js} +48 -48
- package/{dialogNotifyCommand-77B57PL6.js → dialogNotifyCommand-VWS5G4OO.js} +13 -13
- package/{dialogSlice-FQ6WOKWJ.js → dialogSlice-KGYIABDY.js} +27 -27
- package/{dialogUsageCommand-HTVPR2CX.js → dialogUsageCommand-FEWCN7IA.js} +6 -6
- package/{docCreateCommands-36WS33BK.js → docCreateCommands-LS32VKY3.js} +47 -47
- package/{docDeleteCommands-C4CS4XLF.js → docDeleteCommands-JTYR5RPH.js} +48 -48
- package/{docReadCommands-QZMSFMPN.js → docReadCommands-E5LTVKWN.js} +47 -47
- package/{docStore-BZ2O7WLF.js → docStore-TVS2FNER.js} +12 -12
- package/{docUpdateCommands-BYI64HVV.js → docUpdateCommands-I3J3JDZ2.js} +47 -47
- package/{fetchMessages-TQEUZD7H.js → fetchMessages-Q3INLN5F.js} +2 -2
- package/getPricing-VNGFM4PN.js +2 -2
- package/{handleSendMessageAction-I5J7QR7K.js → handleSendMessageAction-SSON36TJ.js} +54 -54
- package/{hostCredentialCreate-AVPMK7EQ.js → hostCredentialCreate-WTW4THJF.js} +83 -84
- package/index.js +12 -12
- package/{localDialogRead-SVTPA5GY.js → localDialogRead-V36DX2Q2.js} +1 -1
- package/{localRuntimeAdapter-S56R76HN.js → localRuntimeAdapter-MI2JGXSF.js} +83 -84
- package/{machineCommands-77NFB2AE.js → machineCommands-3LROJZDK.js} +86 -87
- package/{machineWsRunDispatch-5XWFUJ53.js → machineWsRunDispatch-BUUJRUUB.js} +82 -83
- package/{memberThunks-JRYNONYV.js → memberThunks-CFEPHAND.js} +14 -14
- package/{memoryCommands-5WC3T66U.js → memoryCommands-JQMEJO7J.js} +3 -3
- package/package.json +1 -1
- package/{projectArchive-GNOSYH6F.js → projectArchive-3X54XFVN.js} +32 -32
- package/{providerPresetApply-J3WMRPD2.js → providerPresetApply-FO36N5TX.js} +5 -5
- package/{providerRegistry-KJGB5XWS.js → providerRegistry-U2BSFE6K.js} +5 -5
- package/{read-Q7GOHGNP.js → read-KA3L2V7O.js} +6 -6
- package/{readDocTool-Z5OQ6422.js → readDocTool-AMAZAPAW.js} +1 -1
- package/{readlineWorkspace-2PONGBUP.js → readlineWorkspace-Z3YUH4SX.js} +599 -1264
- package/{removeDialogAgentAction-U3F2MNAY.js → removeDialogAgentAction-JQOJSUM7.js} +12 -12
- package/{runAgentClientLoop-WEXFFHVS.js → runAgentClientLoop-4FCFLMDJ.js} +63 -59
- package/{runtimeDoctorCommands-UXKXYBW6.js → runtimeDoctorCommands-CXOCVDPU.js} +5 -5
- package/{secretCommands-LJXOOYA7.js → secretCommands-GGUAWAE7.js} +3 -3
- package/{setDialogExtraReferencesAction-G3WSJ7EM.js → setDialogExtraReferencesAction-YXQTGXIN.js} +11 -11
- package/{setPrimaryDialogAgentAction-6FHAHZBB.js → setPrimaryDialogAgentAction-YNLB66WE.js} +12 -12
- package/{settingThunks-AXTBX3Q5.js → settingThunks-E6N7RSSS.js} +16 -16
- package/{spaceCommands-GUKMDRWN.js → spaceCommands-DB5DKC2J.js} +43 -43
- package/{streamAgentChatTurn-D2WFS5MF.js → streamAgentChatTurn-FCBGMD4D.js} +84 -123
- package/{switchDialogAgentAction-UOFIAGPL.js → switchDialogAgentAction-LAHLUECU.js} +10 -10
- package/{tools-YKE6PQHT.js → tools-6JD36D6K.js} +49 -49
- package/{tuiSummaryLlmCaller-7WLUKNP2.js → tuiSummaryLlmCaller-UHZIPGAX.js} +14 -14
- package/{updateCommands-RJVCRSBP.js → updateCommands-KZ54HCU5.js} +6 -6
- package/{updateDialogTitleAction-D5NCA4FC.js → updateDialogTitleAction-RV3EUEN3.js} +32 -32
- package/{usageCommand-YPJ2ZI2F.js → usageCommand-KFVV6UL3.js} +1 -1
- package/{usageRebuildCommand-FERQO74C.js → usageRebuildCommand-HHFSNK46.js} +2 -2
- package/{chunk-4NA3YTBC.js → chunk-6EDAMVG6.js} +6 -6
- package/{chunk-W6RFEDN4.js → chunk-AETZ7AD6.js} +3 -3
- package/{chunk-2VUZSVAS.js → chunk-CSW7IPVD.js} +9 -9
- package/{chunk-KEN3N2TN.js → chunk-HVUDBOQG.js} +7 -7
- package/{chunk-SNBZZPYH.js → chunk-OQHIVPG4.js} +3 -3
- package/{chunk-47ITIXO7.js → chunk-SSGTV4FC.js} +3 -3
- package/{chunk-IZIN2UNJ.js → chunk-T2BEPTAG.js} +6 -6
- package/{chunk-HXER7YJF.js → chunk-VXL2FZTP.js} +3 -3
- package/{chunk-2THCNKE4.js → chunk-WACI5I6V.js} +3 -3
- package/{cooldownCommands-X7P5M2V5.js → cooldownCommands-FZYQOWI5.js} +1 -1
- package/{offlineMarxistsAgentCommand-4IC3Y4C6.js → offlineMarxistsAgentCommand-AGA2X5E4.js} +6 -6
- package/{tableCommands-HITDSLHS.js → tableCommands-VNSXHAMG.js} +9 -9
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
compareAgentSelection,
|
|
6
6
|
resolveModelTier
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YOT437BH.js";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_PROVIDER_RETRY_MS,
|
|
10
10
|
isAgentUnavailableNow,
|
|
@@ -20,12 +20,69 @@ import {
|
|
|
20
20
|
isAntigravityOAuthAgent,
|
|
21
21
|
isSubscriptionEndpoint,
|
|
22
22
|
isSubscriptionOAuthCredential
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-VPAZ6BEN.js";
|
|
24
24
|
import {
|
|
25
25
|
isOwnedAgentKey,
|
|
26
26
|
ownedAgentKey,
|
|
27
27
|
publicAgentKey
|
|
28
28
|
} from "./chunk-M2EJHDJP.js";
|
|
29
|
+
import {
|
|
30
|
+
asTrimmedLowercaseString
|
|
31
|
+
} from "./chunk-QSJ3HFEF.js";
|
|
32
|
+
|
|
33
|
+
// packages/core/gptProTier.ts
|
|
34
|
+
var GPT_PRO_REQUIRED_RECHARGE_AMOUNT = 199;
|
|
35
|
+
var SUPPORTED_TIER_PROVIDERS = /* @__PURE__ */ new Set([
|
|
36
|
+
"nolo",
|
|
37
|
+
"openai",
|
|
38
|
+
"deepinfra"
|
|
39
|
+
]);
|
|
40
|
+
var CLAUDE_PREMIUM_RE = /^(?:anthropic\/)?claude-(opus|fable)(?:-\d+(?:[.-]\d+)*(?:-[a-z0-9]+)*)?$/i;
|
|
41
|
+
var GPT_PRO_RE = /^(?:openai\/)?gpt-[a-z0-9.-]+-pro(?:-[a-z0-9]+(?:[.-][a-z0-9]+)*)?$/i;
|
|
42
|
+
var GPT_SOL_RE = /^(?:openai\/)?gpt-\d+(?:\.\d+)*-sol(?:-[a-z0-9]+(?:[.-][a-z0-9]+)*)?$/i;
|
|
43
|
+
var GPT_ASTRA_RE = /^(?:openai\/)?gpt-\d+(?:\.\d+)*-astra(?:-[a-z0-9]+(?:[.-][a-z0-9]+)*)?$/i;
|
|
44
|
+
var KIMI_K3_MODELS = /* @__PURE__ */ new Set([
|
|
45
|
+
"kimi-k3",
|
|
46
|
+
"moonshotai/kimi-k3"
|
|
47
|
+
]);
|
|
48
|
+
function classifyPremiumModel(model) {
|
|
49
|
+
const normalizedModel = asTrimmedLowercaseString(model);
|
|
50
|
+
if (!normalizedModel) return void 0;
|
|
51
|
+
const claudeMatch = CLAUDE_PREMIUM_RE.exec(normalizedModel);
|
|
52
|
+
if (claudeMatch) {
|
|
53
|
+
return claudeMatch[1].toLowerCase() === "opus" ? "claude-opus" : "claude-fable";
|
|
54
|
+
}
|
|
55
|
+
if (GPT_PRO_RE.test(normalizedModel)) {
|
|
56
|
+
return "gpt-pro";
|
|
57
|
+
}
|
|
58
|
+
if (GPT_SOL_RE.test(normalizedModel)) {
|
|
59
|
+
return "gpt-sol";
|
|
60
|
+
}
|
|
61
|
+
if (GPT_ASTRA_RE.test(normalizedModel)) {
|
|
62
|
+
return "gpt-astra";
|
|
63
|
+
}
|
|
64
|
+
if (KIMI_K3_MODELS.has(normalizedModel)) {
|
|
65
|
+
return "kimi-k3";
|
|
66
|
+
}
|
|
67
|
+
return void 0;
|
|
68
|
+
}
|
|
69
|
+
function isGptProModel(provider, model) {
|
|
70
|
+
const normalizedProvider = asTrimmedLowercaseString(provider);
|
|
71
|
+
if (!SUPPORTED_TIER_PROVIDERS.has(normalizedProvider)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return classifyPremiumModel(model) !== void 0;
|
|
75
|
+
}
|
|
76
|
+
var GPT_PRO_BLOCKED_MESSAGE = `GPT Pro / Kimi K3 \u7B49\u9AD8\u7EA7\u6A21\u578B\u9700\u8981\u5148\u5F00\u901A ${GPT_PRO_REQUIRED_RECHARGE_AMOUNT} \u79EF\u5206\u6863\u4F4D\u3002`;
|
|
77
|
+
function shouldBlockForGptPro(input) {
|
|
78
|
+
if (input?.premium !== true || input?.platformPaid !== true) {
|
|
79
|
+
return { blocked: false };
|
|
80
|
+
}
|
|
81
|
+
if (asTrimmedLowercaseString(input.gptProStatus) === "active") {
|
|
82
|
+
return { blocked: false };
|
|
83
|
+
}
|
|
84
|
+
return { blocked: true, message: GPT_PRO_BLOCKED_MESSAGE };
|
|
85
|
+
}
|
|
29
86
|
|
|
30
87
|
// packages/ai/agent/agentBilling.ts
|
|
31
88
|
function resolveBillingSource(candidate) {
|
|
@@ -451,6 +508,14 @@ function toSafeAgentSummary(record, options) {
|
|
|
451
508
|
isFavorite: favStatus.isFavorite,
|
|
452
509
|
favoritedAt: favStatus.favoritedAt,
|
|
453
510
|
isPublic,
|
|
511
|
+
// 复用 platformPaidCall.ts 的唯一判据(该文件头明确它是「谁出钱」的真源):
|
|
512
|
+
// 自己写 billingSource === "platform_credits" 会与 199 门槛口径分叉——
|
|
513
|
+
// 例如 apiSource==="cli" 的本地 CLI Agent 在 resolveBillingSource 里会落到
|
|
514
|
+
// platform_credits,但 isPlatformPaidAgentCall 显式短路为「非平台垫付」。
|
|
515
|
+
requiresPaidApproval: isPlatformPaidAgentCall({
|
|
516
|
+
agentConfig: record ?? void 0,
|
|
517
|
+
callerUserId: currentUserId ?? void 0
|
|
518
|
+
}),
|
|
454
519
|
...economics ? { economics } : {},
|
|
455
520
|
isOwned,
|
|
456
521
|
isOAuth,
|
|
@@ -478,6 +543,10 @@ var COMPACT_AGENT_SUMMARY_FIELDS = [
|
|
|
478
543
|
"model",
|
|
479
544
|
"modelTier",
|
|
480
545
|
"billingSource",
|
|
546
|
+
// 扣费授权判据:listAgents 默认走 compact 投影,缺了它模型在默认派发
|
|
547
|
+
// 流程里读不到「派它之前要先问用户」(2026-11-15 事故成因)。
|
|
548
|
+
// 与 ULTRA_COMPACT 白名单必须同时保留——两处任何一处缺失都等于该字段不存在。
|
|
549
|
+
"requiresPaidApproval",
|
|
481
550
|
"availabilityStatus",
|
|
482
551
|
"credentialGroup",
|
|
483
552
|
"isFavorite",
|
|
@@ -528,6 +597,9 @@ var ULTRA_COMPACT_AGENT_SUMMARY_FIELDS = [
|
|
|
528
597
|
"model",
|
|
529
598
|
"modelTier",
|
|
530
599
|
"billingSource",
|
|
600
|
+
// 扣费授权判据必须随投影一起走:精简投影里没有它,模型就看不到
|
|
601
|
+
// 「派它之前要先问用户」,等于该字段不存在(2026-11-15 事故的直接成因)。
|
|
602
|
+
"requiresPaidApproval",
|
|
531
603
|
"availabilityStatus",
|
|
532
604
|
"credentialGroup",
|
|
533
605
|
"isFavorite",
|
|
@@ -555,6 +627,39 @@ function toUltraCompactAgentSummary(summary) {
|
|
|
555
627
|
return compact;
|
|
556
628
|
}
|
|
557
629
|
|
|
630
|
+
// packages/ai/agent/platformPaidCall.ts
|
|
631
|
+
var asTrimmed = (value) => typeof value === "string" ? value.trim() : "";
|
|
632
|
+
var hasOAuthCredentialShape = (agentConfig) => isOAuthApiKeyRef(agentConfig?.apiKeyRef) || isAntigravityOAuthAgent({
|
|
633
|
+
key: "platform-paid-call-probe",
|
|
634
|
+
apiKeyRef: agentConfig?.apiKeyRef ?? void 0,
|
|
635
|
+
provider: agentConfig?.provider ?? void 0,
|
|
636
|
+
customProviderUrl: agentConfig?.customProviderUrl ?? void 0
|
|
637
|
+
});
|
|
638
|
+
function isPlatformPaidAgentCall(probe) {
|
|
639
|
+
const agentConfig = probe?.agentConfig ?? {};
|
|
640
|
+
const authKind = asTrimmed(probe?.authKind);
|
|
641
|
+
if (authKind) return authKind === "platform-key";
|
|
642
|
+
if (asTrimmed(agentConfig.apiSource) === "cli") return false;
|
|
643
|
+
return resolveBillingSource({
|
|
644
|
+
local: agentConfig.local,
|
|
645
|
+
isLocal: agentConfig.isLocal,
|
|
646
|
+
cliProvider: agentConfig.cliProvider,
|
|
647
|
+
apiSource: agentConfig.apiSource,
|
|
648
|
+
provider: agentConfig.provider,
|
|
649
|
+
billingSource: agentConfig.billingSource,
|
|
650
|
+
// 形态证明而非记录自声明(见文件头):自声明 isOAuth 不足以证明 OAuth 通道归属。
|
|
651
|
+
isOAuth: hasOAuthCredentialShape(agentConfig),
|
|
652
|
+
apiKeyRef: agentConfig.apiKeyRef,
|
|
653
|
+
customProviderUrl: agentConfig.customProviderUrl,
|
|
654
|
+
isOwned: isOwnedAgentRecord(
|
|
655
|
+
agentConfig,
|
|
656
|
+
asTrimmed(probe?.callerUserId) || void 0
|
|
657
|
+
),
|
|
658
|
+
userId: agentConfig.userId,
|
|
659
|
+
ownerId: agentConfig.ownerId
|
|
660
|
+
}) === "platform_credits";
|
|
661
|
+
}
|
|
662
|
+
|
|
558
663
|
// packages/ai/agent/agentDiscovery.ts
|
|
559
664
|
function isPreferredAgent(agent) {
|
|
560
665
|
return agent.isFavorite === true || agent.isOwned === true || agent.isOAuth === true || agent.billingSource === "user_subscription" || agent.billingSource === "user_api" || agent.billingSource === "local";
|
|
@@ -616,6 +721,36 @@ function filterAgentsByScope(agents, scope) {
|
|
|
616
721
|
if (scope === "public") return unique.filter((agent) => isPublicDiscoveryAgent(agent));
|
|
617
722
|
return unique.filter((agent) => isPreferredAgent(agent) || agent.isPublic === true);
|
|
618
723
|
}
|
|
724
|
+
function recommendPlanning(agents, caller, poolComplete) {
|
|
725
|
+
const callerKey = typeof caller?.agentKey === "string" && caller.agentKey.trim() ? caller.agentKey : void 0;
|
|
726
|
+
const current = callerKey ? agents.find((a) => a.agentKey === callerKey) : void 0;
|
|
727
|
+
const currentTier = callerKey ? resolveModelTier(caller?.effectiveModel ?? current?.model) : "unknown";
|
|
728
|
+
const base = {
|
|
729
|
+
condition: "when_planning_needed_and_candidate_suitable",
|
|
730
|
+
action: "self",
|
|
731
|
+
currentTier,
|
|
732
|
+
poolComplete,
|
|
733
|
+
requiresPaidApproval: false
|
|
734
|
+
};
|
|
735
|
+
if (caller?.runKind === "subtask") return { ...base, reason: "bounded_subtask" };
|
|
736
|
+
if (!callerKey) return { ...base, reason: "caller_unknown" };
|
|
737
|
+
if (currentTier === "unknown") return { ...base, reason: "caller_tier_unknown" };
|
|
738
|
+
if (!poolComplete) return { ...base, reason: "pool_incomplete" };
|
|
739
|
+
const ranks = { easy: 0, normal: 1, complex: 2, extreme: 3 };
|
|
740
|
+
const higher = agents.filter((a) => a.agentKey && a.agentKey !== callerKey && a.modelTier !== "unknown" && ranks[a.modelTier] > ranks[currentTier]);
|
|
741
|
+
const free = higher.filter((a) => a.requiresPaidApproval === false);
|
|
742
|
+
free.sort((a, b) => ranks[b.modelTier] - ranks[a.modelTier]);
|
|
743
|
+
const best = free[0];
|
|
744
|
+
if (best) return {
|
|
745
|
+
...base,
|
|
746
|
+
action: "delegate",
|
|
747
|
+
reason: "higher_suitable_agent",
|
|
748
|
+
agentKey: best.agentKey,
|
|
749
|
+
recommendedTier: best.modelTier
|
|
750
|
+
};
|
|
751
|
+
if (higher.length) return { ...base, reason: "paid_approval_required", requiresPaidApproval: true };
|
|
752
|
+
return { ...base, reason: "no_higher_suitable_agent" };
|
|
753
|
+
}
|
|
619
754
|
function resolvePaginationArgs(args) {
|
|
620
755
|
let limit;
|
|
621
756
|
let offset;
|
|
@@ -754,6 +889,11 @@ function buildAgentDiscoveryResult(options) {
|
|
|
754
889
|
...isTruncated ? { truncated: true } : {},
|
|
755
890
|
unavailableCount,
|
|
756
891
|
agents: projectedAgents,
|
|
892
|
+
planningRecommendation: recommendPlanning(
|
|
893
|
+
sortedAgents,
|
|
894
|
+
options.caller,
|
|
895
|
+
!isTruncated && scope === "all" && !hasQuery && !options.poolRestricted
|
|
896
|
+
),
|
|
757
897
|
credentialGroups
|
|
758
898
|
};
|
|
759
899
|
}
|
|
@@ -763,11 +903,12 @@ function toDiscoverySafeAgentSummary(record, options) {
|
|
|
763
903
|
}
|
|
764
904
|
|
|
765
905
|
export {
|
|
766
|
-
|
|
906
|
+
isGptProModel,
|
|
907
|
+
shouldBlockForGptPro,
|
|
908
|
+
isPlatformPaidAgentCall,
|
|
767
909
|
deriveCredentialGroup,
|
|
768
910
|
deriveCustomProviderCredentialGroup,
|
|
769
911
|
summarizeCredentialGroups,
|
|
770
|
-
isOwnedAgentRecord,
|
|
771
912
|
resolveDiscoveryScope,
|
|
772
913
|
resolvePaginationArgs,
|
|
773
914
|
matchesAgentQuery,
|