nolo-cli 0.98.0-alpha.4 → 0.98.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-HYZ4NXRJ.js → _executeModel-YEIQBSEM.js} +74 -67
- package/action-PNPQLJHG.js +20 -0
- package/{addContentAction-O7R66HEX.js → addContentAction-RBOUD7SJ.js} +12 -11
- package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-IODCR6TB.js} +18 -19
- package/{agentDeleteCommand-2YAHAZFJ.js → agentDeleteCommand-4PLHGGLA.js} +47 -42
- package/{agentEmailCommands-SLEQANTK.js → agentEmailCommands-NXWEK7QA.js} +97 -87
- package/agentListCommands-VRVS3BJL.js +742 -0
- package/{agentMachineCommands-KBI77S35.js → agentMachineCommands-DJH5VXOD.js} +48 -43
- package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-IRNZXVGE.js} +1 -1
- package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-B4T2DJ5H.js} +1 -1
- package/agentRecordCommands-SQCFY7TA.js +138 -0
- package/agentRunCommand-3HT2JILG.js +167 -0
- package/{agentRunControl-AVJR4JW4.js → agentRunControl-3HWA2LLQ.js} +2 -2
- package/{agentRuntimeLocal-VXZSDIGT.js → agentRuntimeLocal-7TFUAJON.js} +48 -39
- package/{agentSlice-ZOYISPZD.js → agentSlice-XTZIXRNX.js} +14 -13
- package/{appDeleteCommands-32MHLR4L.js → appDeleteCommands-EZLI7EIO.js} +46 -41
- package/{appDeployCommands-WCQOUSOB.js → appDeployCommands-QBWG5BGL.js} +46 -41
- package/{appDeployStatusCommands-6QKB7DYN.js → appDeployStatusCommands-ZLG46B3T.js} +46 -41
- package/{appGetCommands-SFAPP5PB.js → appGetCommands-P4D34JD2.js} +46 -41
- package/{appListCommands-EKUBDRUO.js → appListCommands-JMYHZBQH.js} +46 -41
- package/{authCommand-F4EFRRX6.js → authCommand-NHDLY3IB.js} +118 -24
- package/{authCommands-RGOGCPP6.js → authCommands-UDBJVSZU.js} +7 -5
- package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-MAR5LPAC.js} +10 -8
- package/{chromeCommands-FZYAU75D.js → chromeCommands-K27J4OVZ.js} +124 -28
- package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-IXRLN57H.js} +4 -3
- package/{chunk-6OZ36FXI.js → chunk-27ONFIEY.js} +22 -4
- package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
- package/{chunk-53HEEOTT.js → chunk-2WJ57RJA.js} +83 -16
- package/{chunk-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
- package/{chunk-2D66PZ54.js → chunk-3WHINT3R.js} +24 -77
- package/{chunk-ABQYVJBJ.js → chunk-46Y5D2BZ.js} +5 -5
- package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
- package/{chunk-H62HCIUP.js → chunk-4FFUDT6D.js} +24 -21
- package/chunk-4LCOCOR5.js +50 -0
- package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
- package/{chunk-IIVGDG4I.js → chunk-4YSOUKUR.js} +13 -7
- package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
- package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
- package/chunk-5J3PYNUP.js +255 -0
- package/chunk-5MMAK75Q.js +15 -0
- package/{chunk-JPGCXHNM.js → chunk-5OA5HMTL.js} +1 -1
- package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
- package/{chunk-3BMYXEUW.js → chunk-6O4IK4V2.js} +1 -1
- package/{chunk-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
- package/{chunk-DNCEALKX.js → chunk-7MMSLEPA.js} +22 -29
- package/{chunk-L5UXH3B2.js → chunk-7TKWCTSY.js} +22 -6
- package/chunk-A4SQRTZ6.js +15 -0
- package/{chunk-7S4YWN7P.js → chunk-ADBZWMFB.js} +4 -4
- package/chunk-AGIM7IMJ.js +147 -0
- package/{chunk-5UTFL4QJ.js → chunk-AOTBKDRK.js} +7 -0
- package/{chunk-Q554LLSI.js → chunk-AUDNYVRC.js} +1 -1
- package/chunk-BMQ2MJUK.js +153 -0
- package/{chunk-6YTOJY35.js → chunk-BZ7NPA6G.js} +35 -2
- package/chunk-CHOZJMJS.js +78 -0
- package/{chunk-ACTMNVHM.js → chunk-CYSYR67N.js} +1 -1
- package/{chunk-37NKTC3Q.js → chunk-CYYWWZV7.js} +1 -1
- package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
- package/chunk-DZ7R5V3Y.js +164 -0
- package/{chunk-3VNWWVKB.js → chunk-E3YWHWCR.js} +50 -18
- package/{chunk-V4MJDUSR.js → chunk-E73ON47R.js} +2 -2
- package/{chunk-KQ4ONNQD.js → chunk-EKPKW6RM.js} +155 -8
- package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
- package/{chunk-HJUYAD4A.js → chunk-FJ5BGMNM.js} +5 -5
- package/{chunk-2F7RJC6L.js → chunk-FOXQ7BAB.js} +1 -1
- package/{chunk-6IG4XSS6.js → chunk-FY7DCYW7.js} +88 -17
- package/{chunk-J4MOO56S.js → chunk-GARACBQB.js} +10 -2
- 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-VLTIYV3X.js → chunk-HP57OUJO.js} +4 -4
- package/{chunk-G4EBXCWF.js → chunk-IM6ZMFRL.js} +550 -515
- package/{chunk-34BLIAHQ.js → chunk-JY3XHK42.js} +47 -67
- package/{chunk-GPCZ7UXG.js → chunk-K6U4NKFJ.js} +1 -1
- package/{chunk-6VFARHZW.js → chunk-KQQMCLDJ.js} +934 -1091
- package/{chunk-T37GTQYU.js → chunk-KVKYLJOA.js} +20 -11
- package/{chunk-4OEFYTWL.js → chunk-LKERWYPX.js} +67 -48
- package/{chunk-OEVAY4J6.js → chunk-LNVJHIGA.js} +18 -20
- package/{chunk-LS2ZANRJ.js → chunk-LOCNXNOU.js} +1 -1
- package/chunk-M6NBAHCD.js +7881 -0
- package/{chunk-PUOC4YRO.js → chunk-M7VLQGQP.js} +11 -0
- package/chunk-NFG4GW2E.js +13536 -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-AEOE4Z6Q.js → chunk-NZWAO6LH.js} +13 -15
- package/chunk-OCZKATRC.js +129 -0
- package/chunk-OW4APERY.js +870 -0
- package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
- package/{chunk-TOP2VXOR.js → chunk-PCF3QU5Q.js} +5 -5
- package/{chunk-WV42OMV7.js → chunk-PTDYOADJ.js} +8 -8
- package/{chunk-PKUGW3X6.js → chunk-SDUYSRTJ.js} +23 -28
- package/{chunk-5H7KJX7J.js → chunk-SEB5HAUU.js} +5 -5
- package/{chunk-6D6VBVEW.js → chunk-SNMQMOD2.js} +80 -14
- package/{chunk-ITM7D3UQ.js → chunk-TN3SIMJZ.js} +11 -9
- package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
- package/{chunk-Z77CRGTW.js → chunk-TVCAR26G.js} +1 -1
- package/chunk-TY3TIUJK.js +89 -0
- package/{chunk-I3TQJXQ7.js → chunk-U3C3IA32.js} +9 -2
- package/{chunk-RG6JBBX5.js → chunk-U7XXEI5R.js} +166 -13
- package/{chunk-UZGQNTVW.js → chunk-UA324D4O.js} +8 -6
- package/{chunk-V7BKTIF6.js → chunk-UFUTWXPR.js} +19 -17
- package/chunk-UJXNKP5V.js +760 -0
- package/{chunk-UKZDAFYT.js → chunk-UM4PH574.js} +6 -10
- package/{chunk-XDJFSBVV.js → chunk-UUMRZHVT.js} +24 -5
- package/{chunk-GEPUP7OO.js → chunk-UVKDJUTL.js} +3 -3
- package/{chunk-5ZYCLPXL.js → chunk-V4BX25AC.js} +873 -227
- package/{chunk-ZCYXJSTU.js → chunk-V5OWQOJZ.js} +19 -88
- package/{chunk-NA35QHCF.js → chunk-V7Y6KRAH.js} +1 -1
- package/{chunk-3DII57IT.js → chunk-VCAQFMVN.js} +1 -1
- package/{chunk-JRQFUXY7.js → chunk-VEYL5MO5.js} +99 -22
- package/chunk-VIWDGTDA.js +8 -0
- package/chunk-VJVNU77E.js +83 -0
- package/{chunk-UKWGR5SS.js → chunk-VY6VFGKR.js} +194 -1144
- package/{chunk-BP4XNZRM.js → chunk-W72ISAKC.js} +4 -4
- package/{chunk-DHDMC6FO.js → chunk-WCGC6S77.js} +14 -9
- package/{chunk-QDSINZM3.js → chunk-WJ3B6FX6.js} +1 -14
- package/{chunk-HVURBGF3.js → chunk-XFUBXRVI.js} +6 -6
- package/{chunk-O6OSWFZQ.js → chunk-XUWRURDF.js} +6 -0
- package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
- package/{chunk-ETI2NYVF.js → chunk-YPOPJAKN.js} +4 -4
- package/{chunk-SH43IESU.js → chunk-YUNJN43V.js} +44 -9
- package/chunk-YV25TM3R.js +780 -0
- package/{chunk-PDIBG2WC.js → chunk-ZDXOUUPB.js} +67 -45
- package/{chunk-YRPASJCG.js → chunk-ZH7YLZC5.js} +10 -10
- package/chunk-ZRAU6T47.js +56 -0
- package/commandRegistry-YXINJIJK.js +833 -0
- package/{contentThunks-G55OKUFE.js → contentThunks-ZZVD2LBR.js} +36 -34
- package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
- package/{createAgentAutomationAction-D2J2O5GS.js → createAgentAutomationAction-B2TFWNDC.js} +38 -36
- package/createDialogAction-DVG2MYBF.js +69 -0
- package/{createPageAction-FHZBN7DJ.js → createPageAction-UXBWURHH.js} +45 -42
- package/{chunk-AJ3A3445.js → cursorProvider-YGGNMVWX.js} +2496 -9897
- package/{dbSlice-XVWBAGYN.js → dbSlice-Q25STFGJ.js} +11 -10
- package/{deleteFile-YG6QMJLU.js → deleteFile-AJ2EZMHT.js} +7 -6
- package/{dialogCommands-5J56DFWN.js → dialogCommands-243UITH3.js} +49 -45
- package/{dialogSlice-D4V3HURH.js → dialogSlice-B77ICP3A.js} +40 -33
- package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
- package/{docCreateCommands-KYI2DC2U.js → docCreateCommands-RT6AVFDR.js} +48 -43
- package/{docDeleteCommands-67REUSRY.js → docDeleteCommands-TMKHOR5F.js} +49 -44
- package/{docReadCommands-HOSVSBDJ.js → docReadCommands-KIDSKS6N.js} +47 -42
- package/{docStore-5LROPEEP.js → docStore-NBER5SWJ.js} +16 -12
- package/{docUpdateCommands-EMGCSMXY.js → docUpdateCommands-C6OCR767.js} +48 -43
- package/{fetchMessages-EIU7UFFK.js → fetchMessages-I5ICDDHM.js} +5 -5
- package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +4 -4
- package/{handleSendMessageAction-QBPDYSLZ.js → handleSendMessageAction-4DBKTZDW.js} +110 -86
- package/index.js +87 -884
- package/{localDialogRead-BTFJ4V2I.js → localDialogRead-ZHZ3KXDM.js} +2 -2
- package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-TU6OBC76.js} +9 -6
- package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-VKWVOPPI.js} +1 -1
- package/{machineCommands-4ISPVTPN.js → machineCommands-Y2BN2TCO.js} +91 -81
- package/machineWsRunDispatch-POB6IF6W.js +154 -0
- package/{memberThunks-QGFLFVCI.js → memberThunks-R75S3RWP.js} +20 -18
- package/{models-T3SG6MJ5.js → models-ZPU5EDF4.js} +2 -2
- package/oauthTokenStore-ITEB663N.js +23 -0
- 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-FG6NZ57W.js → providerPresetApply-TEBH7FDX.js} +7 -7
- package/{providerRegistry-757OWH3O.js → providerRegistry-CBJLNCET.js} +11 -7
- package/{read-COE3ZYR6.js → read-SRQMNO26.js} +7 -6
- package/{readDocTool-5USN4A6V.js → readDocTool-RC3JUNJ2.js} +5 -3
- package/{readlineWorkspace-JFADM567.js → readlineWorkspace-OLCGKYLQ.js} +2704 -2060
- package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-46XQV5Q7.js} +21 -25
- package/{runAgentClientLoop-JFFIFP7N.js → runAgentClientLoop-BFVCLCBO.js} +75 -69
- package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-PIVSBZRZ.js} +4 -4
- package/runtimeModeArgs-2Y7BALTO.js +31 -0
- package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-J4V5ADQF.js} +15 -13
- package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-UHHV2QZW.js} +22 -26
- package/{chunk-AFUORTY4.js → settingThunks-PPZZZOWN.js} +226 -940
- package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
- package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
- package/{spaceCommands-NKJVJCQQ.js → spaceCommands-WQBSC4VD.js} +51 -46
- package/{streamAgentChatTurn-HFVTDCFD.js → streamAgentChatTurn-M7V35IXY.js} +199 -104
- package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-A2TMVGAE.js} +18 -19
- package/{tableCommands-O6NWHFKV.js → tableCommands-6U4BMLRR.js} +10 -10
- package/{toolApiClient-QVJ6HDNN.js → toolApiClient-EJT6TMFG.js} +3 -3
- package/tools-4XIEV6FW.js +116 -0
- package/{tuiSummaryLlmCaller-WFRWERGK.js → tuiSummaryLlmCaller-Q65IBDGO.js} +24 -21
- package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
- package/{updateDialogTitleAction-PER2C6MR.js → updateDialogTitleAction-TFQFP7FE.js} +82 -44
- package/action-YVYQEAAV.js +0 -31
- package/agentListCommands-KMS675GZ.js +0 -406
- package/agentRecordCommands-IPPPUHG4.js +0 -128
- package/agentRunCommand-24XO4RDT.js +0 -155
- package/browser-image-compression-MFDTD7K6.js +0 -1763
- package/chatQueueReduxAdapter-PMAMSHG7.js +0 -186
- package/chunk-M76ECQRD.js +0 -13658
- package/chunk-MEYIRKDN.js +0 -8967
- package/chunk-OCSGDPAT.js +0 -18885
- package/chunk-Q5FJJ6XI.js +0 -103
- package/chunk-S7Z2HMCN.js +0 -25
- package/chunk-Y5GCAMGP.js +0 -9
- package/chunk-YPREESF4.js +0 -225
- package/createDialogAction-E2EVICIE.js +0 -65
- package/machineWsRunDispatch-L4MKXQAO.js +0 -144
- package/settingSlice-ZQZVUPKK.js +0 -204
- package/syncMapping-N6RGXGBW.js +0 -437
- package/tools-BBBCUOUZ.js +0 -110
- 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
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UVKDJUTL.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NZWAO6LH.js";
|
|
8
8
|
import {
|
|
9
|
-
deriveCredentialGroup
|
|
10
|
-
|
|
11
|
-
} from "./chunk-RG6JBBX5.js";
|
|
9
|
+
deriveCredentialGroup
|
|
10
|
+
} from "./chunk-U7XXEI5R.js";
|
|
12
11
|
import {
|
|
13
12
|
PUBLIC_AGENT_KEY_PREFIX,
|
|
14
|
-
isOwnedAgentKey,
|
|
15
13
|
ownedAgentKey,
|
|
16
14
|
ownedAgentKeyPrefix,
|
|
17
15
|
parseOwnedAgentId,
|
|
@@ -53,6 +51,9 @@ function normalizeListedAgent(record) {
|
|
|
53
51
|
...typeof record?.handle === "string" && record.handle ? { handle: record.handle } : {},
|
|
54
52
|
...typeof record?.introduction === "string" && record.introduction ? { introduction: record.introduction } : typeof record?.description === "string" && record.description ? { introduction: record.description } : {},
|
|
55
53
|
...typeof record?.provider === "string" && record.provider ? { provider: record.provider } : {},
|
|
54
|
+
// 仅供 resolveBillingSource 判定订阅端点(Step Plan / OpenCode Go 等),
|
|
55
|
+
// safe 投影不输出它。缺了它本地 agent list 会把订阅端点全报成 user_api。
|
|
56
|
+
...typeof record?.customProviderUrl === "string" && record.customProviderUrl ? { customProviderUrl: record.customProviderUrl } : {},
|
|
56
57
|
...typeof record?.inputPrice === "number" && Number.isFinite(record.inputPrice) ? { inputPrice: record.inputPrice } : {},
|
|
57
58
|
...typeof record?.outputPrice === "number" && Number.isFinite(record.outputPrice) ? { outputPrice: record.outputPrice } : {},
|
|
58
59
|
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,
|
|
@@ -67,16 +68,10 @@ function normalizeListedAgent(record) {
|
|
|
67
68
|
...credentialKind !== void 0 ? { credentialKind } : {},
|
|
68
69
|
...typeof record?.apiSource === "string" && record.apiSource ? { apiSource: record.apiSource } : {},
|
|
69
70
|
...typeof record?.cliProvider === "string" && record.cliProvider ? { cliProvider: record.cliProvider } : {},
|
|
70
|
-
...typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? { nextAvailableAt: record.nextAvailableAt } : {}
|
|
71
|
+
...typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? { nextAvailableAt: record.nextAvailableAt } : {},
|
|
72
|
+
...record?.quota && typeof record.quota === "object" && Array.isArray(record.quota.windows) ? { quota: record.quota } : {}
|
|
71
73
|
};
|
|
72
74
|
}
|
|
73
|
-
function toSafeListedAgentSummary(agent, options) {
|
|
74
|
-
const summary = toSafeAgentSummary(agent, options);
|
|
75
|
-
if (agent.publicRecordExists === false) {
|
|
76
|
-
delete summary.publicKey;
|
|
77
|
-
}
|
|
78
|
-
return summary;
|
|
79
|
-
}
|
|
80
75
|
function sortListedAgents(agents) {
|
|
81
76
|
agents.sort((a, b) => {
|
|
82
77
|
const ta = a.updatedAt == null ? 0 : new Date(a.updatedAt).getTime();
|
|
@@ -97,6 +92,7 @@ function parseAgentListArgs(args) {
|
|
|
97
92
|
publicOnly: args.includes("--public-only"),
|
|
98
93
|
idsOnly: args.includes("--ids-only"),
|
|
99
94
|
scope: readArgValue(args, "--scope"),
|
|
95
|
+
query: readArgValue(args, "--query"),
|
|
100
96
|
showUnavailable: args.includes("--show-unavailable"),
|
|
101
97
|
// --safe 默认输出精简投影(与 server listAgents 一致,防大列表被截断);
|
|
102
98
|
// --verbose 拿回完整字段集排障。
|
|
@@ -110,7 +106,7 @@ async function listLocalCachedAgents(args) {
|
|
|
110
106
|
for (const prefix of [ownedPrefix, PUBLIC_AGENT_KEY_PREFIX]) {
|
|
111
107
|
for await (const [key, value] of args.db.iterator({ gte: prefix, lte: `${prefix}\uFFFF` })) {
|
|
112
108
|
if (typeof key !== "string" || !value || typeof value !== "object") continue;
|
|
113
|
-
if (
|
|
109
|
+
if (key.startsWith(ownedPrefix)) {
|
|
114
110
|
privateRecords.set(key, { ...value, dbKey: key });
|
|
115
111
|
continue;
|
|
116
112
|
}
|
|
@@ -237,14 +233,89 @@ async function decorateAgentsWithPublicStatusAcrossServers(args) {
|
|
|
237
233
|
return args.agents;
|
|
238
234
|
}
|
|
239
235
|
|
|
236
|
+
// packages/ai/agent/quotaSnapshot.ts
|
|
237
|
+
function findTightestQuotaWindow(quota, now = Date.now()) {
|
|
238
|
+
if (!quota || !Array.isArray(quota.windows) || quota.windows.length === 0) {
|
|
239
|
+
return void 0;
|
|
240
|
+
}
|
|
241
|
+
let best;
|
|
242
|
+
let bestScore = -Infinity;
|
|
243
|
+
for (const w of quota.windows) {
|
|
244
|
+
let score = 0;
|
|
245
|
+
if (typeof w.utilization === "number" && w.utilization >= 0) {
|
|
246
|
+
score = 500 + Math.min(w.utilization, 1) * 500;
|
|
247
|
+
} else if (typeof w.remaining === "number" && typeof w.limit === "number" && w.limit > 0) {
|
|
248
|
+
const util = Math.max(0, 1 - w.remaining / w.limit);
|
|
249
|
+
score = 500 + util * 500;
|
|
250
|
+
} else if (typeof w.resetAt === "number" && w.resetAt > now) {
|
|
251
|
+
score = 200;
|
|
252
|
+
} else if (typeof w.remaining === "number") {
|
|
253
|
+
score = 100;
|
|
254
|
+
}
|
|
255
|
+
if (score > bestScore) {
|
|
256
|
+
bestScore = score;
|
|
257
|
+
best = w;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return best ?? quota.windows[0];
|
|
261
|
+
}
|
|
262
|
+
function formatQuotaSummary(quota, now = Date.now(), options) {
|
|
263
|
+
const compact = options?.compact === true;
|
|
264
|
+
const planText = formatPlanLabel(quota?.plan);
|
|
265
|
+
const planName = typeof quota?.plan?.name === "string" ? quota.plan.name.trim() : "";
|
|
266
|
+
const tightest = findTightestQuotaWindow(quota, now);
|
|
267
|
+
if (!tightest) return compact ? planName || void 0 : planText;
|
|
268
|
+
const parts = [];
|
|
269
|
+
if (typeof tightest.utilization === "number") {
|
|
270
|
+
const pct = Math.round(tightest.utilization * 100);
|
|
271
|
+
parts.push(`${pct}%\u5DF2\u7528`);
|
|
272
|
+
} else if (typeof tightest.remaining === "number") {
|
|
273
|
+
if (typeof tightest.limit === "number") {
|
|
274
|
+
parts.push(`${tightest.remaining}/${tightest.limit}${tightest.unit ? ` ${tightest.unit}` : ""}`);
|
|
275
|
+
} else {
|
|
276
|
+
parts.push(`\u4F59${tightest.remaining}${tightest.unit ? ` ${tightest.unit}` : ""}`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (compact) {
|
|
280
|
+
const head = parts.length > 0 ? parts[0] : void 0;
|
|
281
|
+
return [planName || void 0, head].filter(Boolean).join(" \xB7 ") || void 0;
|
|
282
|
+
}
|
|
283
|
+
if (tightest.scope && tightest.scope !== "user" && tightest.scope !== "project" && tightest.scope !== tightest.unit) {
|
|
284
|
+
parts.push(tightest.scope);
|
|
285
|
+
}
|
|
286
|
+
if (typeof tightest.resetAt === "number" && tightest.resetAt > now) {
|
|
287
|
+
const diffSec = Math.round((tightest.resetAt - now) / 1e3);
|
|
288
|
+
if (diffSec < 60) {
|
|
289
|
+
parts.push(`${diffSec}s\u540E\u91CD\u7F6E`);
|
|
290
|
+
} else if (diffSec < 3600) {
|
|
291
|
+
parts.push(`${Math.round(diffSec / 60)}m\u540E\u91CD\u7F6E`);
|
|
292
|
+
} else if (diffSec < 86400) {
|
|
293
|
+
const hours = (diffSec / 3600).toFixed(1).replace(/\.0$/, "");
|
|
294
|
+
parts.push(`${hours}h\u540E\u91CD\u7F6E`);
|
|
295
|
+
} else {
|
|
296
|
+
const days = (diffSec / 86400).toFixed(1).replace(/\.0$/, "");
|
|
297
|
+
parts.push(`${days}d\u540E\u91CD\u7F6E`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
const onlyScope = parts.length === 0 || parts.length === 1 && parts[0] === tightest.scope;
|
|
301
|
+
if (onlyScope) return planText;
|
|
302
|
+
return [planText, ...parts].filter(Boolean).join(" \xB7 ");
|
|
303
|
+
}
|
|
304
|
+
function formatPlanLabel(plan) {
|
|
305
|
+
const name = typeof plan?.name === "string" ? plan.name.trim() : "";
|
|
306
|
+
if (!name) return void 0;
|
|
307
|
+
const credits = typeof plan?.monthlyCreditsUsd === "number" && Number.isFinite(plan.monthlyCreditsUsd) && plan.monthlyCreditsUsd > 0 ? `\u6708\u5EA6\u989D\u5EA6 $${plan.monthlyCreditsUsd}` : void 0;
|
|
308
|
+
return [`${name} \u5957\u9910`, credits].filter(Boolean).join(" \xB7 ");
|
|
309
|
+
}
|
|
310
|
+
|
|
240
311
|
export {
|
|
241
312
|
normalizeListedAgent,
|
|
242
|
-
toSafeListedAgentSummary,
|
|
243
313
|
parseAgentListArgs,
|
|
244
314
|
listLocalCachedAgents,
|
|
245
315
|
listRemotePublicAgents,
|
|
246
316
|
listRemoteAgents,
|
|
247
317
|
listRemoteAgentsAcrossServers,
|
|
248
318
|
listFavoriteAgentIdsAcrossServers,
|
|
249
|
-
decorateAgentsWithPublicStatusAcrossServers
|
|
319
|
+
decorateAgentsWithPublicStatusAcrossServers,
|
|
320
|
+
formatQuotaSummary
|
|
250
321
|
};
|
|
@@ -153,6 +153,13 @@ function slateToSimplifiedMarkdown(nodes, options = {}) {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
// packages/ai/tools/readDocTool.ts
|
|
156
|
+
var resolvePageReadMarkdown = (pageData) => {
|
|
157
|
+
const slateData = pageData.slateData;
|
|
158
|
+
if (Array.isArray(slateData) && slateData.length > 0) {
|
|
159
|
+
return slateToSimplifiedMarkdown(slateData);
|
|
160
|
+
}
|
|
161
|
+
return typeof pageData.content === "string" ? pageData.content : "";
|
|
162
|
+
};
|
|
156
163
|
var readDocFunctionSchema = {
|
|
157
164
|
name: "readDoc",
|
|
158
165
|
description: [
|
|
@@ -175,7 +182,7 @@ var readPageFunctionSchema = {
|
|
|
175
182
|
name: "readPage"
|
|
176
183
|
};
|
|
177
184
|
var buildReadDocResult = (pageData) => {
|
|
178
|
-
const markdownContent =
|
|
185
|
+
const markdownContent = resolvePageReadMarkdown(pageData);
|
|
179
186
|
const rawData = {
|
|
180
187
|
success: true,
|
|
181
188
|
id: pageData.dbKey,
|
|
@@ -199,7 +206,7 @@ async function readDocFunc(args, thunkApi) {
|
|
|
199
206
|
throw new Error(`\u65E0\u6548\u7684\u9875\u9762 ID: ${id}\u3002\u9875\u9762 ID \u901A\u5E38\u4EE5 "page-" \u5F00\u5934\u3002`);
|
|
200
207
|
}
|
|
201
208
|
try {
|
|
202
|
-
const { readAction } = await import("./read-
|
|
209
|
+
const { readAction } = await import("./read-SRQMNO26.js");
|
|
203
210
|
const pageData = await readAction({ dbKey: id }, thunkApi);
|
|
204
211
|
if (!pageData) {
|
|
205
212
|
throw new Error(`\u672A\u627E\u5230 ID \u4E3A ${id} \u7684\u9875\u9762\u3002`);
|
|
@@ -213,6 +220,7 @@ var readPageFunc = readDocFunc;
|
|
|
213
220
|
|
|
214
221
|
export {
|
|
215
222
|
slateToSimplifiedMarkdown,
|
|
223
|
+
resolvePageReadMarkdown,
|
|
216
224
|
readDocFunctionSchema,
|
|
217
225
|
readPageFunctionSchema,
|
|
218
226
|
buildReadDocResult,
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// packages/agent-runtime/sseFrames.ts
|
|
2
|
+
async function* readSseFrames(response) {
|
|
3
|
+
const reader = response.body?.getReader();
|
|
4
|
+
if (!reader) {
|
|
5
|
+
throw new Error("SSE response did not include a readable body.");
|
|
6
|
+
}
|
|
7
|
+
const decoder = new TextDecoder();
|
|
8
|
+
let buffer = "";
|
|
9
|
+
while (true) {
|
|
10
|
+
const { done, value } = await reader.read();
|
|
11
|
+
if (done) break;
|
|
12
|
+
buffer += decoder.decode(value, { stream: true });
|
|
13
|
+
let boundary = findSseFrameBoundary(buffer);
|
|
14
|
+
while (boundary) {
|
|
15
|
+
yield buffer.slice(0, boundary.index);
|
|
16
|
+
buffer = buffer.slice(boundary.index + boundary.separatorLength);
|
|
17
|
+
boundary = findSseFrameBoundary(buffer);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const remaining = decoder.decode();
|
|
21
|
+
if (remaining) {
|
|
22
|
+
buffer += remaining;
|
|
23
|
+
let boundary = findSseFrameBoundary(buffer);
|
|
24
|
+
while (boundary) {
|
|
25
|
+
yield buffer.slice(0, boundary.index);
|
|
26
|
+
buffer = buffer.slice(boundary.index + boundary.separatorLength);
|
|
27
|
+
boundary = findSseFrameBoundary(buffer);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (buffer.trim()) yield buffer;
|
|
31
|
+
}
|
|
32
|
+
function findSseFrameBoundary(buffer) {
|
|
33
|
+
const lfLf = buffer.indexOf("\n\n");
|
|
34
|
+
const crLfCrLf = buffer.indexOf("\r\n\r\n");
|
|
35
|
+
if (lfLf === -1 && crLfCrLf === -1) return null;
|
|
36
|
+
const useLf = lfLf !== -1 && (crLfCrLf === -1 || lfLf < crLfCrLf);
|
|
37
|
+
return useLf ? { index: lfLf, separatorLength: 2 } : { index: crLfCrLf, separatorLength: 4 };
|
|
38
|
+
}
|
|
39
|
+
async function* streamSseDataValues(response, parse) {
|
|
40
|
+
const reader = response.body?.getReader();
|
|
41
|
+
if (!reader) return;
|
|
42
|
+
const decoder = new TextDecoder();
|
|
43
|
+
let buffer = "";
|
|
44
|
+
while (true) {
|
|
45
|
+
const { done, value } = await reader.read();
|
|
46
|
+
if (done) break;
|
|
47
|
+
buffer += decoder.decode(value, { stream: true });
|
|
48
|
+
const lines = buffer.split("\n");
|
|
49
|
+
buffer = lines.pop() ?? "";
|
|
50
|
+
for (const line of lines) {
|
|
51
|
+
const parsed = parse(line);
|
|
52
|
+
if (parsed) yield parsed;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const remaining = decoder.decode();
|
|
56
|
+
if (remaining) {
|
|
57
|
+
buffer += remaining;
|
|
58
|
+
const lines = buffer.split("\n");
|
|
59
|
+
buffer = lines.pop() ?? "";
|
|
60
|
+
for (const line of lines) {
|
|
61
|
+
const parsed = parse(line);
|
|
62
|
+
if (parsed) yield parsed;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (buffer.trim()) {
|
|
66
|
+
const parsed = parse(buffer);
|
|
67
|
+
if (parsed) yield parsed;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function readSseDataValues(response, parse) {
|
|
71
|
+
const values = [];
|
|
72
|
+
for await (const value of streamSseDataValues(response, parse)) {
|
|
73
|
+
values.push(value);
|
|
74
|
+
}
|
|
75
|
+
return values;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
readSseFrames,
|
|
80
|
+
streamSseDataValues,
|
|
81
|
+
readSseDataValues
|
|
82
|
+
};
|
|
@@ -180,6 +180,36 @@ function resolveCooldownGate(input, now) {
|
|
|
180
180
|
}
|
|
181
181
|
return now - lastProbeAt >= PROBE_INTERVAL_MS ? "probe" : "blocked";
|
|
182
182
|
}
|
|
183
|
+
function resolveCredentialKey(agent) {
|
|
184
|
+
if (!agent || typeof agent !== "object") return void 0;
|
|
185
|
+
for (const field of ["apiKeyRef", "credentialRef"]) {
|
|
186
|
+
const value = agent[field];
|
|
187
|
+
if (typeof value === "string") {
|
|
188
|
+
const trimmed = value.trim();
|
|
189
|
+
if (trimmed) return trimmed;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return void 0;
|
|
193
|
+
}
|
|
194
|
+
function resolveCredentialKeyWithFallback(agent) {
|
|
195
|
+
const byRef = resolveCredentialKey(agent);
|
|
196
|
+
if (byRef) return byRef;
|
|
197
|
+
if (!agent || typeof agent !== "object") return void 0;
|
|
198
|
+
const endpoint = agent.customProviderUrl;
|
|
199
|
+
if (typeof endpoint === "string") {
|
|
200
|
+
const trimmed = endpoint.trim();
|
|
201
|
+
if (trimmed) {
|
|
202
|
+
try {
|
|
203
|
+
const origin = new URL(trimmed).origin;
|
|
204
|
+
if (origin && origin !== "null") return `custom-endpoint:${origin}`;
|
|
205
|
+
} catch {
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const key = agent.key;
|
|
210
|
+
if (typeof key === "string" && key.trim()) return `custom-agent:${key.trim()}`;
|
|
211
|
+
return void 0;
|
|
212
|
+
}
|
|
183
213
|
|
|
184
214
|
export {
|
|
185
215
|
QUOTA_ERROR_PATTERNS,
|
|
@@ -188,5 +218,6 @@ export {
|
|
|
188
218
|
isQuotaLimited403Body,
|
|
189
219
|
resolveAvailabilityAction,
|
|
190
220
|
mergeAvailabilityDeadline,
|
|
191
|
-
resolveCooldownGate
|
|
221
|
+
resolveCooldownGate,
|
|
222
|
+
resolveCredentialKeyWithFallback
|
|
192
223
|
};
|
|
@@ -206,9 +206,12 @@ export {
|
|
|
206
206
|
resolveNoloStateDir,
|
|
207
207
|
getLegacyCredentialPath,
|
|
208
208
|
migrateLegacyCredentialFile,
|
|
209
|
+
DEFAULT_REFRESH_SKEW_MS,
|
|
209
210
|
getCredentialsDir,
|
|
211
|
+
getCredentialPath,
|
|
210
212
|
readOAuthCredential,
|
|
211
213
|
writeOAuthCredential,
|
|
214
|
+
removeOAuthCredential,
|
|
212
215
|
createOAuthTokenStore,
|
|
213
216
|
isTokenExpired,
|
|
214
217
|
resolveFreshAccessToken
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getActiveDialogKey
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BZ7NPA6G.js";
|
|
4
4
|
import {
|
|
5
5
|
compactWhitespace
|
|
6
6
|
} from "./chunk-DWLEOOGR.js";
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
extractCustomId
|
|
12
12
|
} from "./chunk-M2EJHDJP.js";
|
|
13
|
-
import {
|
|
14
|
-
selectIdentityToken
|
|
15
|
-
} from "./chunk-SEJ5OS6F.js";
|
|
16
13
|
import {
|
|
17
14
|
isRecord
|
|
18
15
|
} from "./chunk-KUG52IAP.js";
|
|
16
|
+
import {
|
|
17
|
+
selectIdentityToken
|
|
18
|
+
} from "./chunk-SEJ5OS6F.js";
|
|
19
19
|
|
|
20
20
|
// packages/ai/tools/toolApiClient.ts
|
|
21
21
|
var MAIN_SERVER = "https://nolo.chat";
|