nolo-cli 0.107.0-alpha.4 → 0.107.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-UDCSOTD2.js → _executeModel-M573MKVE.js} +78 -70
- package/action-GVA5ARSJ.js +20 -0
- package/{addContentAction-MB2HHMDZ.js → addContentAction-M2WOWZCL.js} +13 -12
- package/{addDialogAgentAction-MCEABSBA.js → addDialogAgentAction-QMAQ5Z6N.js} +19 -20
- package/{agentDeleteCommand-OWYHN6D6.js → agentDeleteCommand-ZFHYRHBS.js} +118 -43
- package/{agentEmailCommands-AU5I4M4W.js → agentEmailCommands-X6AVPIVQ.js} +100 -90
- package/agentListCommands-PAD2CI2I.js +741 -0
- package/{agentMachineCommands-YMNME2L6.js → agentMachineCommands-UPH6RJCC.js} +50 -46
- package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-CMVTBY5X.js} +97 -2
- package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-B4T2DJ5H.js} +1 -1
- package/agentRecordCommands-UMACPRAF.js +138 -0
- package/agentRunCommand-H6KKHHMU.js +167 -0
- package/{agentRunControl-AVJR4JW4.js → agentRunControl-3HWA2LLQ.js} +2 -2
- package/{agentRuntimeLocal-KCMC2TBD.js → agentRuntimeLocal-N4YGKL7M.js} +44 -40
- package/{agentSlice-R7PR6KYM.js → agentSlice-2LPP43XH.js} +15 -14
- package/{appDeleteCommands-JEPA3EWE.js → appDeleteCommands-7DAF33AM.js} +46 -42
- package/{appDeployCommands-UTB76XFM.js → appDeployCommands-ZPZSMFGZ.js} +46 -42
- package/{appDeployStatusCommands-LGHF2SBD.js → appDeployStatusCommands-FWBDSSS5.js} +46 -42
- package/{appGetCommands-PX2BFHOB.js → appGetCommands-SZZOHGEP.js} +46 -42
- package/{appListCommands-BSMPTWKC.js → appListCommands-FPMUBDPM.js} +46 -42
- package/{authCommand-YW42YZA4.js → authCommand-VL3G26NQ.js} +119 -25
- package/{authCommands-RGOGCPP6.js → authCommands-5RTUDYZW.js} +7 -5
- package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-ZK4K67Y5.js} +11 -9
- package/{chromeCommands-FZYAU75D.js → chromeCommands-AU5ZJXBG.js} +289 -37
- package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-ZYTCMNHG.js} +156 -22
- package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
- package/{chunk-HVURBGF3.js → chunk-2U3NHADM.js} +6 -6
- package/{chunk-QTGQ2LTL.js → chunk-3DQY5IFB.js} +6 -10
- package/{chunk-XT35TTFG.js → chunk-3IXAHOJS.js} +19 -21
- package/{chunk-UVA7OYO3.js → chunk-3W67RV75.js} +29 -9
- package/chunk-4LCOCOR5.js +50 -0
- package/{chunk-JPGCXHNM.js → chunk-4LKMZ3RR.js} +1 -1
- package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
- package/{chunk-6D6VBVEW.js → chunk-4W24JM32.js} +80 -14
- package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
- package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
- package/{chunk-C3M4465B.js → chunk-5HYJ3DSZ.js} +404 -659
- package/chunk-5MMAK75Q.js +15 -0
- package/{chunk-7S4YWN7P.js → chunk-5UUIGN6I.js} +4 -4
- package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
- package/{chunk-4MK3I7Y4.js → chunk-6MAW4XOF.js} +5 -5
- package/{chunk-3UZPUAES.js → chunk-74PPKIY2.js} +1 -1
- package/chunk-76HO2DP6.js +15 -0
- package/{chunk-ASIFZ2WY.js → chunk-7BBP7ZX3.js} +66 -54
- package/{chunk-VLTIYV3X.js → chunk-7I25CBT5.js} +34 -8
- package/{chunk-IBOZNTG2.js → chunk-7X5XZ34C.js} +23 -28
- package/chunk-AGIM7IMJ.js +147 -0
- package/{chunk-5UTFL4QJ.js → chunk-APO5TOXO.js} +1 -1
- package/{chunk-EEGDMATE.js → chunk-AZOVPTL6.js} +91 -81
- package/{chunk-6OZ36FXI.js → chunk-BIPGGSJS.js} +22 -4
- package/{chunk-EYAQT56M.js → chunk-BNQMNUKZ.js} +9 -6
- package/{chunk-62CATUYY.js → chunk-CBUMFIFE.js} +834 -962
- package/{chunk-OIVSQH2O.js → chunk-CDEEFJXN.js} +308 -11
- package/chunk-CHOZJMJS.js +78 -0
- package/{chunk-ETI2NYVF.js → chunk-CIP3AAMT.js} +4 -4
- package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
- package/{chunk-W7HLWAQ7.js → chunk-DE45KZNH.js} +118 -90
- package/{chunk-Q554LLSI.js → chunk-DMXLXZKL.js} +1 -1
- package/{chunk-3VNWWVKB.js → chunk-E3YWHWCR.js} +50 -18
- package/{chunk-HKNXJGEC.js → chunk-ECFHBYUW.js} +85 -50
- package/{chunk-ACTMNVHM.js → chunk-EHSYSKXV.js} +1 -1
- package/{chunk-WV42OMV7.js → chunk-ELUDRSRD.js} +8 -8
- package/{chunk-ABQYVJBJ.js → chunk-EV235ILT.js} +5 -5
- package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
- package/{chunk-BFDFRLLQ.js → chunk-EZ4VZHAG.js} +5 -5
- package/{chunk-GO3Z72MT.js → chunk-FHLMQIU7.js} +65 -95
- package/{chunk-2F7RJC6L.js → chunk-FOXQ7BAB.js} +1 -1
- package/{chunk-SH43IESU.js → chunk-GGC55Q32.js} +199 -29
- package/chunk-GMZLP5DV.js +82 -0
- package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
- package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
- package/{chunk-QOKAKDPE.js → chunk-HIM3FCLF.js} +0 -1
- package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
- package/{chunk-BNGW5ASC.js → chunk-I2RGRVQ7.js} +22 -2
- package/{chunk-O6OSWFZQ.js → chunk-IHPDK6UD.js} +6 -0
- package/{chunk-QDSINZM3.js → chunk-IXH3HKY2.js} +1 -22
- package/{chunk-GQBOR3G6.js → chunk-JBKHQOYK.js} +8 -4
- package/{chunk-XD2MJFUG.js → chunk-JEFXP73H.js} +1 -1
- package/{chunk-PBA4UJBK.js → chunk-JIXGJTBU.js} +4 -4
- package/{chunk-AEOE4Z6Q.js → chunk-K6L5PNXK.js} +39 -15
- package/{chunk-Z77CRGTW.js → chunk-KA5O5KQL.js} +1 -1
- package/{chunk-GPCZ7UXG.js → chunk-KD6D6BLA.js} +1 -1
- package/{chunk-4CR5I7BD.js → chunk-KFWDYYSS.js} +47 -67
- package/{chunk-UZGQNTVW.js → chunk-KHKTDMYG.js} +8 -6
- package/{chunk-JDPFV2JV.js → chunk-KWUKOQM2.js} +20 -11
- package/{chunk-MRIHM22T.js → chunk-LBFL6RZG.js} +58 -9
- package/{chunk-LS2ZANRJ.js → chunk-LOCNXNOU.js} +1 -1
- package/{chunk-DHDMC6FO.js → chunk-LUBFABMJ.js} +15 -14
- package/{chunk-NA35QHCF.js → chunk-LVBFKW65.js} +1 -1
- package/chunk-LWLNLZC5.js +265 -0
- package/chunk-N4NGJDT6.js +929 -0
- package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
- package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
- package/chunk-NWENLDMM.js +42 -0
- package/chunk-O7SVKKLY.js +875 -0
- package/chunk-OCZKATRC.js +129 -0
- package/{chunk-6Z7MY3V7.js → chunk-OEJLGVBL.js} +5 -5
- package/{chunk-VMFTFOWF.js → chunk-OKGVNZTL.js} +35 -8
- package/{chunk-GEPUP7OO.js → chunk-OR2UWD6X.js} +3 -3
- package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
- package/{chunk-J4MOO56S.js → chunk-PNXHPLRU.js} +10 -2
- package/{chunk-3BMYXEUW.js → chunk-R5AJODNI.js} +1 -1
- package/{chunk-P5EVSOPA.js → chunk-R6EBQEQE.js} +22 -29
- package/chunk-RQ6CTX2E.js +164 -0
- package/{chunk-MS7TSPZR.js → chunk-RU36ZYSG.js} +19 -17
- package/{chunk-ALXHV7NK.js → chunk-RWXLPUKI.js} +40 -4
- package/{chunk-KQ4ONNQD.js → chunk-RXA3HAVW.js} +190 -8
- package/{chunk-IIVGDG4I.js → chunk-SJKULPGX.js} +13 -7
- package/{chunk-Q67DOFOO.js → chunk-SZC4REES.js} +212 -105
- package/{chunk-JRQFUXY7.js → chunk-TBAXFWOS.js} +99 -22
- package/{chunk-PQFHGD77.js → chunk-TBM2RS3U.js} +161 -14
- package/{chunk-NOF3HDSN.js → chunk-TFOIJFCM.js} +11 -9
- package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
- package/chunk-TY3TIUJK.js +89 -0
- package/{chunk-I3TQJXQ7.js → chunk-U3C3IA32.js} +9 -2
- package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
- package/chunk-UM7TA3K4.js +1008 -0
- package/{chunk-6YTOJY35.js → chunk-VBG7GWWR.js} +253 -8
- package/{chunk-GL3EHUR4.js → chunk-VHGYUYQ3.js} +69 -47
- package/chunk-VIWDGTDA.js +8 -0
- package/chunk-VJVNU77E.js +83 -0
- package/chunk-VM6IE2GN.js +8004 -0
- package/{chunk-UKWGR5SS.js → chunk-VY6VFGKR.js} +194 -1144
- package/chunk-VZLO4XJD.js +17 -0
- package/chunk-W32HPLTL.js +13692 -0
- package/{chunk-AHAHBQMU.js → chunk-WDLSZMTA.js} +2 -2
- package/{chunk-53HEEOTT.js → chunk-WF5X57VW.js} +83 -16
- package/{chunk-VRTTFDBM.js → chunk-WPHY3VPF.js} +35 -22
- package/{chunk-3L2WKC3W.js → chunk-XPWGOTBQ.js} +8 -1
- package/chunk-YV25TM3R.js +780 -0
- package/chunk-ZRAU6T47.js +56 -0
- package/{chunk-IBOOZVVD.js → chunk-ZTKZZY2A.js} +851 -279
- package/commandRegistry-ASW6IVZ3.js +833 -0
- package/{contentThunks-IV2T3EJC.js → contentThunks-4XNVOIR7.js} +39 -36
- package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
- package/{createAgentAutomationAction-JCOIEYY4.js → createAgentAutomationAction-NHHTCJMC.js} +40 -37
- package/createDialogAction-XEBTHDB3.js +70 -0
- package/{createPageAction-D2VOOLP3.js → createPageAction-VR3WW2AQ.js} +47 -43
- package/{chunk-FG3HKPQP.js → cursorProvider-YGGNMVWX.js} +2751 -10185
- package/{dbSlice-A6C6H32X.js → dbSlice-TG4MZ5EB.js} +12 -11
- package/{deleteFile-YG6QMJLU.js → deleteFile-KESP65GC.js} +7 -6
- package/{dialogCommands-H7FPUYUQ.js → dialogCommands-FJWQG3MX.js} +50 -47
- package/{dialogSlice-6JZOOTDS.js → dialogSlice-GVRDGCRG.js} +57 -37
- package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
- package/{docCreateCommands-WRG2JLGM.js → docCreateCommands-AZSK4NAG.js} +48 -44
- package/{docDeleteCommands-SHWJIBJS.js → docDeleteCommands-DDJMSMFZ.js} +49 -45
- package/{docReadCommands-WJN3WT6O.js → docReadCommands-5F5Q6EBZ.js} +47 -43
- package/{docStore-HUPQ2FSS.js → docStore-SUZUUWDI.js} +17 -13
- package/{docUpdateCommands-IE32IL6O.js → docUpdateCommands-XPNPVZOC.js} +48 -44
- package/{fetchMessages-EIU7UFFK.js → fetchMessages-3PXAHKCR.js} +5 -5
- package/{getPricing-LUSEABA6.js → getPricing-DOBBZLOK.js} +4 -4
- package/{handleSendMessageAction-DFPMQ7YM.js → handleSendMessageAction-VC6VTFKS.js} +109 -42
- package/index.js +87 -884
- package/{lib-FRRS27KN.js → lib-PU2G2MSO.js} +523 -191
- package/{localDialogRead-BTFJ4V2I.js → localDialogRead-UYCKO7YZ.js} +2 -2
- package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-TU6OBC76.js} +9 -6
- package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-VKWVOPPI.js} +1 -1
- package/{machineCommands-M2T2I5NF.js → machineCommands-M634V2L3.js} +98 -89
- package/machineWsRunDispatch-Z3HUSTFI.js +154 -0
- package/{memberThunks-P2ECUJ56.js → memberThunks-5S5D3N4U.js} +20 -18
- package/{models-T3SG6MJ5.js → models-PQU25T6Q.js} +2 -2
- package/oauthTokenStore-ITEB663N.js +23 -0
- package/package.json +1 -1
- package/processSpawn-SOAV3FEV.js +11 -0
- package/profileConfig-ZGOFORWV.js +43 -0
- package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-HAQWVAQX.js} +7 -7
- package/{providerRegistry-757OWH3O.js → providerRegistry-5FGWB3X5.js} +11 -7
- package/{read-COE3ZYR6.js → read-LSYFLSIM.js} +8 -7
- package/{readDocTool-5USN4A6V.js → readDocTool-XWRXV3DR.js} +5 -3
- package/{readlineWorkspace-XQRDGWRZ.js → readlineWorkspace-J3YD3DNW.js} +2596 -2032
- package/{removeDialogAgentAction-J6X5QMTA.js → removeDialogAgentAction-4TEFC3VL.js} +22 -26
- package/{runAgentClientLoop-5ZA62FBA.js → runAgentClientLoop-APSMCLAF.js} +79 -72
- package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-PIVSBZRZ.js} +4 -4
- package/runtimeModeArgs-2Y7BALTO.js +31 -0
- package/{setDialogExtraReferencesAction-WX5VTY6O.js → setDialogExtraReferencesAction-LSEN44OY.js} +16 -14
- package/{setPrimaryDialogAgentAction-FN22THHT.js → setPrimaryDialogAgentAction-SR366X5A.js} +23 -27
- package/{chunk-GP5LKBUZ.js → settingThunks-CTVPPGIN.js} +226 -940
- package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
- package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
- package/{spaceCommands-5GLCWZPO.js → spaceCommands-3UK63WPE.js} +51 -47
- package/{streamAgentChatTurn-6UZJMYRB.js → streamAgentChatTurn-DNY2PSRW.js} +215 -115
- package/{switchDialogAgentAction-LVTEV3FR.js → switchDialogAgentAction-M6NAFOOU.js} +19 -20
- package/{tableCommands-O6NWHFKV.js → tableCommands-6U4BMLRR.js} +10 -10
- package/{toolApiClient-QVJ6HDNN.js → toolApiClient-AD7CXTA4.js} +4 -3
- package/tools-X5UWATZK.js +117 -0
- package/{tuiSummaryLlmCaller-OHHFTHMG.js → tuiSummaryLlmCaller-DEH7ZEM6.js} +25 -23
- package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
- package/{updateDialogTitleAction-QTKNIURB.js → updateDialogTitleAction-YSY5BF5A.js} +84 -45
- package/action-P4TNFGAD.js +0 -31
- package/agentListCommands-B2V4YAC4.js +0 -410
- package/agentRecordCommands-G4KK4R7H.js +0 -128
- package/agentRunCommand-UTZJA23G.js +0 -156
- package/browser-image-compression-MFDTD7K6.js +0 -1763
- package/chatQueueReduxAdapter-2P6NFX64.js +0 -186
- package/chunk-CQ3WA2NE.js +0 -299
- package/chunk-M76ECQRD.js +0 -13658
- package/chunk-MEYIRKDN.js +0 -8967
- package/chunk-PUOC4YRO.js +0 -394
- package/chunk-Q5FJJ6XI.js +0 -103
- package/chunk-S7Z2HMCN.js +0 -25
- package/chunk-T75QD6AB.js +0 -20923
- package/chunk-Y5GCAMGP.js +0 -9
- package/chunk-YPREESF4.js +0 -225
- package/createDialogAction-NGG7YVNU.js +0 -65
- package/machineWsRunDispatch-ISBKOOD7.js +0 -144
- package/settingSlice-P4ZW7K5X.js +0 -204
- package/syncMapping-N6RGXGBW.js +0 -437
- package/tools-KMGFWO43.js +0 -110
- package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
- package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
|
@@ -1,87 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OR2UWD6X.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-K6L5PNXK.js";
|
|
8
8
|
import {
|
|
9
|
-
deriveCredentialGroup
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
deriveCredentialGroup
|
|
10
|
+
} from "./chunk-TBM2RS3U.js";
|
|
11
|
+
import {
|
|
12
|
+
isTombstoneRecord
|
|
13
|
+
} from "./chunk-D2MDMY2M.js";
|
|
12
14
|
import {
|
|
13
15
|
PUBLIC_AGENT_KEY_PREFIX,
|
|
14
|
-
isOwnedAgentKey,
|
|
15
16
|
ownedAgentKey,
|
|
16
17
|
ownedAgentKeyPrefix,
|
|
17
18
|
parseOwnedAgentId,
|
|
18
19
|
publicAgentKey
|
|
19
20
|
} from "./chunk-M2EJHDJP.js";
|
|
20
21
|
|
|
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
|
-
|
|
85
22
|
// packages/cli/agentListHelpers.ts
|
|
86
23
|
function parseAgentRecordId(privateKey, explicitId) {
|
|
87
24
|
if (explicitId) return explicitId;
|
|
@@ -95,6 +32,7 @@ function buildCompanionKeys(rawId, userId) {
|
|
|
95
32
|
};
|
|
96
33
|
}
|
|
97
34
|
function normalizeListedAgent(record) {
|
|
35
|
+
if (isTombstoneRecord(record)) return null;
|
|
98
36
|
const privateKey = typeof record?.dbKey === "string" ? record.dbKey : "";
|
|
99
37
|
const explicitId = typeof record?.id === "string" && record.id ? record.id : void 0;
|
|
100
38
|
const ownerUserId = typeof record?.userId === "string" ? record.userId : "";
|
|
@@ -117,6 +55,9 @@ function normalizeListedAgent(record) {
|
|
|
117
55
|
...typeof record?.handle === "string" && record.handle ? { handle: record.handle } : {},
|
|
118
56
|
...typeof record?.introduction === "string" && record.introduction ? { introduction: record.introduction } : typeof record?.description === "string" && record.description ? { introduction: record.description } : {},
|
|
119
57
|
...typeof record?.provider === "string" && record.provider ? { provider: record.provider } : {},
|
|
58
|
+
// 仅供 resolveBillingSource 判定订阅端点(Step Plan / OpenCode Go 等),
|
|
59
|
+
// safe 投影不输出它。缺了它本地 agent list 会把订阅端点全报成 user_api。
|
|
60
|
+
...typeof record?.customProviderUrl === "string" && record.customProviderUrl ? { customProviderUrl: record.customProviderUrl } : {},
|
|
120
61
|
...typeof record?.inputPrice === "number" && Number.isFinite(record.inputPrice) ? { inputPrice: record.inputPrice } : {},
|
|
121
62
|
...typeof record?.outputPrice === "number" && Number.isFinite(record.outputPrice) ? { outputPrice: record.outputPrice } : {},
|
|
122
63
|
updatedAt: typeof record?.updatedAt === "string" || typeof record?.updatedAt === "number" ? record.updatedAt : typeof record?.createdAt === "string" || typeof record?.createdAt === "number" ? record.createdAt : typeof record?.created === "string" || typeof record?.created === "number" ? record.created : null,
|
|
@@ -135,13 +76,6 @@ function normalizeListedAgent(record) {
|
|
|
135
76
|
...record?.quota && typeof record.quota === "object" && Array.isArray(record.quota.windows) ? { quota: record.quota } : {}
|
|
136
77
|
};
|
|
137
78
|
}
|
|
138
|
-
function toSafeListedAgentSummary(agent, options) {
|
|
139
|
-
const summary = toSafeAgentSummary(agent, options);
|
|
140
|
-
if (agent.publicRecordExists === false) {
|
|
141
|
-
delete summary.publicKey;
|
|
142
|
-
}
|
|
143
|
-
return summary;
|
|
144
|
-
}
|
|
145
79
|
function sortListedAgents(agents) {
|
|
146
80
|
agents.sort((a, b) => {
|
|
147
81
|
const ta = a.updatedAt == null ? 0 : new Date(a.updatedAt).getTime();
|
|
@@ -162,6 +96,7 @@ function parseAgentListArgs(args) {
|
|
|
162
96
|
publicOnly: args.includes("--public-only"),
|
|
163
97
|
idsOnly: args.includes("--ids-only"),
|
|
164
98
|
scope: readArgValue(args, "--scope"),
|
|
99
|
+
query: readArgValue(args, "--query"),
|
|
165
100
|
showUnavailable: args.includes("--show-unavailable"),
|
|
166
101
|
// --safe 默认输出精简投影(与 server listAgents 一致,防大列表被截断);
|
|
167
102
|
// --verbose 拿回完整字段集排障。
|
|
@@ -175,7 +110,8 @@ async function listLocalCachedAgents(args) {
|
|
|
175
110
|
for (const prefix of [ownedPrefix, PUBLIC_AGENT_KEY_PREFIX]) {
|
|
176
111
|
for await (const [key, value] of args.db.iterator({ gte: prefix, lte: `${prefix}\uFFFF` })) {
|
|
177
112
|
if (typeof key !== "string" || !value || typeof value !== "object") continue;
|
|
178
|
-
if (
|
|
113
|
+
if (isTombstoneRecord(value)) continue;
|
|
114
|
+
if (key.startsWith(ownedPrefix)) {
|
|
179
115
|
privateRecords.set(key, { ...value, dbKey: key });
|
|
180
116
|
continue;
|
|
181
117
|
}
|
|
@@ -302,15 +238,89 @@ async function decorateAgentsWithPublicStatusAcrossServers(args) {
|
|
|
302
238
|
return args.agents;
|
|
303
239
|
}
|
|
304
240
|
|
|
241
|
+
// packages/ai/agent/quotaSnapshot.ts
|
|
242
|
+
function findTightestQuotaWindow(quota, now = Date.now()) {
|
|
243
|
+
if (!quota || !Array.isArray(quota.windows) || quota.windows.length === 0) {
|
|
244
|
+
return void 0;
|
|
245
|
+
}
|
|
246
|
+
let best;
|
|
247
|
+
let bestScore = -Infinity;
|
|
248
|
+
for (const w of quota.windows) {
|
|
249
|
+
let score = 0;
|
|
250
|
+
if (typeof w.utilization === "number" && w.utilization >= 0) {
|
|
251
|
+
score = 500 + Math.min(w.utilization, 1) * 500;
|
|
252
|
+
} else if (typeof w.remaining === "number" && typeof w.limit === "number" && w.limit > 0) {
|
|
253
|
+
const util = Math.max(0, 1 - w.remaining / w.limit);
|
|
254
|
+
score = 500 + util * 500;
|
|
255
|
+
} else if (typeof w.resetAt === "number" && w.resetAt > now) {
|
|
256
|
+
score = 200;
|
|
257
|
+
} else if (typeof w.remaining === "number") {
|
|
258
|
+
score = 100;
|
|
259
|
+
}
|
|
260
|
+
if (score > bestScore) {
|
|
261
|
+
bestScore = score;
|
|
262
|
+
best = w;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return best ?? quota.windows[0];
|
|
266
|
+
}
|
|
267
|
+
function formatQuotaSummary(quota, now = Date.now(), options) {
|
|
268
|
+
const compact = options?.compact === true;
|
|
269
|
+
const planText = formatPlanLabel(quota?.plan);
|
|
270
|
+
const planName = typeof quota?.plan?.name === "string" ? quota.plan.name.trim() : "";
|
|
271
|
+
const tightest = findTightestQuotaWindow(quota, now);
|
|
272
|
+
if (!tightest) return compact ? planName || void 0 : planText;
|
|
273
|
+
const parts = [];
|
|
274
|
+
if (typeof tightest.utilization === "number") {
|
|
275
|
+
const pct = Math.round(tightest.utilization * 100);
|
|
276
|
+
parts.push(`${pct}%\u5DF2\u7528`);
|
|
277
|
+
} else if (typeof tightest.remaining === "number") {
|
|
278
|
+
if (typeof tightest.limit === "number") {
|
|
279
|
+
parts.push(`${tightest.remaining}/${tightest.limit}${tightest.unit ? ` ${tightest.unit}` : ""}`);
|
|
280
|
+
} else {
|
|
281
|
+
parts.push(`\u4F59${tightest.remaining}${tightest.unit ? ` ${tightest.unit}` : ""}`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (compact) {
|
|
285
|
+
const head = parts.length > 0 ? parts[0] : void 0;
|
|
286
|
+
return [planName || void 0, head].filter(Boolean).join(" \xB7 ") || void 0;
|
|
287
|
+
}
|
|
288
|
+
if (tightest.scope && tightest.scope !== "user" && tightest.scope !== "project" && tightest.scope !== tightest.unit) {
|
|
289
|
+
parts.push(tightest.scope);
|
|
290
|
+
}
|
|
291
|
+
if (typeof tightest.resetAt === "number" && tightest.resetAt > now) {
|
|
292
|
+
const diffSec = Math.round((tightest.resetAt - now) / 1e3);
|
|
293
|
+
if (diffSec < 60) {
|
|
294
|
+
parts.push(`${diffSec}s\u540E\u91CD\u7F6E`);
|
|
295
|
+
} else if (diffSec < 3600) {
|
|
296
|
+
parts.push(`${Math.round(diffSec / 60)}m\u540E\u91CD\u7F6E`);
|
|
297
|
+
} else if (diffSec < 86400) {
|
|
298
|
+
const hours = (diffSec / 3600).toFixed(1).replace(/\.0$/, "");
|
|
299
|
+
parts.push(`${hours}h\u540E\u91CD\u7F6E`);
|
|
300
|
+
} else {
|
|
301
|
+
const days = (diffSec / 86400).toFixed(1).replace(/\.0$/, "");
|
|
302
|
+
parts.push(`${days}d\u540E\u91CD\u7F6E`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const onlyScope = parts.length === 0 || parts.length === 1 && parts[0] === tightest.scope;
|
|
306
|
+
if (onlyScope) return planText;
|
|
307
|
+
return [planText, ...parts].filter(Boolean).join(" \xB7 ");
|
|
308
|
+
}
|
|
309
|
+
function formatPlanLabel(plan) {
|
|
310
|
+
const name = typeof plan?.name === "string" ? plan.name.trim() : "";
|
|
311
|
+
if (!name) return void 0;
|
|
312
|
+
const credits = typeof plan?.monthlyCreditsUsd === "number" && Number.isFinite(plan.monthlyCreditsUsd) && plan.monthlyCreditsUsd > 0 ? `\u6708\u5EA6\u989D\u5EA6 $${plan.monthlyCreditsUsd}` : void 0;
|
|
313
|
+
return [`${name} \u5957\u9910`, credits].filter(Boolean).join(" \xB7 ");
|
|
314
|
+
}
|
|
315
|
+
|
|
305
316
|
export {
|
|
306
|
-
formatQuotaSummary,
|
|
307
317
|
normalizeListedAgent,
|
|
308
|
-
toSafeListedAgentSummary,
|
|
309
318
|
parseAgentListArgs,
|
|
310
319
|
listLocalCachedAgents,
|
|
311
320
|
listRemotePublicAgents,
|
|
312
321
|
listRemoteAgents,
|
|
313
322
|
listRemoteAgentsAcrossServers,
|
|
314
323
|
listFavoriteAgentIdsAcrossServers,
|
|
315
|
-
decorateAgentsWithPublicStatusAcrossServers
|
|
324
|
+
decorateAgentsWithPublicStatusAcrossServers,
|
|
325
|
+
formatQuotaSummary
|
|
316
326
|
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
resolvePlatformChatCompletionsEndpoint,
|
|
4
4
|
resolvePlatformHostedCredentialProvider,
|
|
5
5
|
resolvePlatformResponsesEndpoint
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JBKHQOYK.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-SZC4REES.js";
|
|
15
15
|
import {
|
|
16
16
|
asTrimmedLowercaseString
|
|
17
17
|
} from "./chunk-QSJ3HFEF.js";
|
|
@@ -164,10 +164,28 @@ function resolveProviderAuthHeaderName(args) {
|
|
|
164
164
|
if (/xiaomimimo\.com/i.test(args.endpoint)) return "api-key";
|
|
165
165
|
return "Authorization";
|
|
166
166
|
}
|
|
167
|
+
var OPENCODE_GO_ENDPOINT_RE = /^https?:\/\/opencode\.ai\/zen\/go\//i;
|
|
168
|
+
var OPENCODE_SESSION_HEADER = "x-opencode-session";
|
|
169
|
+
var OPENCODE_USER_AGENT = "nolo-agent/1.0";
|
|
170
|
+
var PROCESS_FALLBACK_SESSION_ID = `nolo-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
|
|
171
|
+
function isOpenCodeGoEndpoint(endpoint) {
|
|
172
|
+
return typeof endpoint === "string" && OPENCODE_GO_ENDPOINT_RE.test(endpoint.trim());
|
|
173
|
+
}
|
|
174
|
+
function buildProviderSessionHeaders(args) {
|
|
175
|
+
if (!isOpenCodeGoEndpoint(args.endpoint)) return {};
|
|
176
|
+
return {
|
|
177
|
+
[OPENCODE_SESSION_HEADER]: args.sessionId?.trim() || PROCESS_FALLBACK_SESSION_ID,
|
|
178
|
+
"User-Agent": OPENCODE_USER_AGENT
|
|
179
|
+
};
|
|
180
|
+
}
|
|
167
181
|
function buildProviderAuthHeaders(args) {
|
|
168
|
-
|
|
182
|
+
const sessionHeaders = buildProviderSessionHeaders(args);
|
|
183
|
+
if (!args.apiKey) return sessionHeaders;
|
|
169
184
|
const headerName = resolveProviderAuthHeaderName(args);
|
|
170
|
-
return
|
|
185
|
+
return {
|
|
186
|
+
...sessionHeaders,
|
|
187
|
+
...headerName.toLowerCase() === "authorization" ? { Authorization: `Bearer ${args.apiKey}` } : { [headerName]: args.apiKey }
|
|
188
|
+
};
|
|
171
189
|
}
|
|
172
190
|
async function buildProviderExecutionPlan(args) {
|
|
173
191
|
const { agentConfig, env } = args;
|
|
@@ -6,10 +6,12 @@ import {
|
|
|
6
6
|
} from "./chunk-AGGIDPCZ.js";
|
|
7
7
|
import {
|
|
8
8
|
getModelConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CDEEFJXN.js";
|
|
10
10
|
import {
|
|
11
|
-
isPlatformHostedImageModel
|
|
12
|
-
|
|
11
|
+
isPlatformHostedImageModel,
|
|
12
|
+
isPlatformManagedProvider,
|
|
13
|
+
resolvePlatformEffectiveModel
|
|
14
|
+
} from "./chunk-SZC4REES.js";
|
|
13
15
|
import {
|
|
14
16
|
asOptionalFiniteNumber
|
|
15
17
|
} from "./chunk-WWC7I6TA.js";
|
|
@@ -19,15 +21,16 @@ import {
|
|
|
19
21
|
|
|
20
22
|
// packages/ai/llm/getPricing.ts
|
|
21
23
|
var MAX_OUTPUT_TOKENS = 8192;
|
|
22
|
-
var getModelPricing = (provider, modelName, _requestedServiceTier) => {
|
|
24
|
+
var getModelPricing = (provider, modelName, _requestedServiceTier, isPlatformBilled) => {
|
|
25
|
+
const pricedModel = isPlatformBilled === true && isPlatformManagedProvider(provider, modelName) ? resolvePlatformEffectiveModel(modelName) ?? modelName : modelName;
|
|
23
26
|
let model;
|
|
24
27
|
try {
|
|
25
|
-
model = getModelConfig(provider,
|
|
28
|
+
model = getModelConfig(provider, pricedModel);
|
|
26
29
|
} catch {
|
|
27
30
|
return null;
|
|
28
31
|
}
|
|
29
32
|
if (!model?.price) return null;
|
|
30
|
-
return getModelPricingForModel(provider,
|
|
33
|
+
return getModelPricingForModel(provider, pricedModel, model);
|
|
31
34
|
};
|
|
32
35
|
var getModelPricingForModel = (provider, modelName, model) => {
|
|
33
36
|
if (!model.price) return null;
|