nolo-cli 0.105.0-alpha.2 → 0.105.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/{_executeModel-4W7C3ACS.js → _executeModel-JXG5TLPE.js} +75 -68
- package/action-GVA5ARSJ.js +20 -0
- package/{addContentAction-O7R66HEX.js → addContentAction-J3DLDV64.js} +12 -11
- package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-PHIXJCF2.js} +18 -19
- package/{agentDeleteCommand-YB3S2LPY.js → agentDeleteCommand-2AWJGHXG.js} +117 -42
- package/{agentEmailCommands-J6YBHL42.js → agentEmailCommands-VV5OSILE.js} +98 -88
- package/agentListCommands-OQMRBDWP.js +742 -0
- package/{agentMachineCommands-2RWGEBA3.js → agentMachineCommands-3VLLR6RL.js} +48 -43
- package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-XPJYZSCE.js} +97 -2
- package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-B4T2DJ5H.js} +1 -1
- package/agentRecordCommands-GPIARVOW.js +138 -0
- package/agentRunCommand-LRJTZ7IM.js +167 -0
- package/{agentRunControl-AVJR4JW4.js → agentRunControl-3HWA2LLQ.js} +2 -2
- package/{agentRuntimeLocal-FRUE5P2V.js → agentRuntimeLocal-PV6AZOEU.js} +44 -39
- package/{agentSlice-6LBOYNKN.js → agentSlice-6R3JKS6I.js} +14 -13
- package/{appDeleteCommands-JPWTSFID.js → appDeleteCommands-WEX73P5R.js} +46 -41
- package/{appDeployCommands-YCVY2UYO.js → appDeployCommands-7BAXWA4M.js} +46 -41
- package/{appDeployStatusCommands-JMCEIKTI.js → appDeployStatusCommands-EJ6A2U4X.js} +46 -41
- package/{appGetCommands-EXWT3QAE.js → appGetCommands-SB355OEX.js} +46 -41
- package/{appListCommands-PKRLSWRE.js → appListCommands-TSZDPIKJ.js} +46 -41
- package/{authCommand-F4EFRRX6.js → authCommand-5PB3YRVV.js} +118 -24
- package/{authCommands-RGOGCPP6.js → authCommands-5RTUDYZW.js} +7 -5
- package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-SBBWTANC.js} +10 -8
- package/{chromeCommands-FZYAU75D.js → chromeCommands-AU5ZJXBG.js} +289 -37
- package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-ZYTCMNHG.js} +156 -22
- package/{chunk-6OZ36FXI.js → chunk-27ONFIEY.js} +22 -4
- package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
- package/{chunk-HVURBGF3.js → chunk-2U3NHADM.js} +6 -6
- package/{chunk-53HEEOTT.js → chunk-2WJ57RJA.js} +83 -16
- package/{chunk-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
- package/{chunk-V4MJDUSR.js → chunk-3F424ASC.js} +2 -2
- package/{chunk-HJUYAD4A.js → chunk-3Q7NEHAR.js} +5 -5
- package/chunk-44CU7CKA.js +13545 -0
- package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
- 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-H62HCIUP.js → chunk-4WMMIL66.js} +35 -22
- package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
- package/{chunk-ZCYXJSTU.js → chunk-54VPQTOA.js} +66 -94
- package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
- 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-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
- package/chunk-A4SQRTZ6.js +15 -0
- package/{chunk-L5UXH3B2.js → chunk-AFH5QC6R.js} +58 -9
- package/{chunk-AEOE4Z6Q.js → chunk-AFSY3ZMB.js} +39 -15
- package/chunk-AGIM7IMJ.js +147 -0
- package/{chunk-5UTFL4QJ.js → chunk-AOTBKDRK.js} +7 -0
- package/{chunk-NA35QHCF.js → chunk-AWVP7PPG.js} +1 -1
- package/{chunk-EEGDMATE.js → chunk-B7APRSPS.js} +86 -81
- package/{chunk-W324THOB.js → chunk-BB7LVBTS.js} +20 -11
- package/{chunk-6YTOJY35.js → chunk-BZ7NPA6G.js} +35 -2
- package/{chunk-5H7KJX7J.js → chunk-CFHWVEUJ.js} +5 -5
- package/chunk-CHOZJMJS.js +78 -0
- package/{chunk-ETI2NYVF.js → chunk-CNA27EMD.js} +4 -4
- package/{chunk-ACTMNVHM.js → chunk-CYSYR67N.js} +1 -1
- package/{chunk-WV42OMV7.js → chunk-D2GQE6AF.js} +8 -8
- package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
- package/{chunk-Q554LLSI.js → chunk-DMXLXZKL.js} +1 -1
- package/chunk-DZ7R5V3Y.js +164 -0
- package/{chunk-3VNWWVKB.js → chunk-E3YWHWCR.js} +50 -18
- package/{chunk-KQ4ONNQD.js → chunk-EKPKW6RM.js} +155 -8
- package/{chunk-2J5Y72GY.js → chunk-EP7BWZ4B.js} +1 -1
- package/{chunk-ABQYVJBJ.js → chunk-EV235ILT.js} +5 -5
- package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
- package/{chunk-3ZW5ZJMM.js → chunk-FGSJ3YMD.js} +23 -28
- 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-DHDMC6FO.js → chunk-GSKPJIHY.js} +14 -9
- 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-NXUYQBDZ.js → chunk-HYXABXCZ.js} +29 -78
- package/{chunk-DNCEALKX.js → chunk-IEJ5YDA4.js} +22 -29
- package/{chunk-O6OSWFZQ.js → chunk-IHPDK6UD.js} +6 -0
- package/{chunk-BP4XNZRM.js → chunk-JIXGJTBU.js} +4 -4
- package/{chunk-GPCZ7UXG.js → chunk-K6U4NKFJ.js} +1 -1
- package/{chunk-Z77CRGTW.js → chunk-KA5O5KQL.js} +1 -1
- package/{chunk-4OEFYTWL.js → chunk-L5WOICCV.js} +67 -48
- package/{chunk-LS2ZANRJ.js → chunk-LOCNXNOU.js} +1 -1
- package/chunk-LWLNLZC5.js +265 -0
- package/{chunk-H66KLASO.js → chunk-LWXE6IFU.js} +567 -519
- package/{chunk-PUOC4YRO.js → chunk-M7VLQGQP.js} +11 -0
- package/chunk-NKWIS6G2.js +442 -0
- package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
- package/{chunk-DJWMIXDZ.js → chunk-NSAFG343.js} +10 -10
- package/{chunk-UKZDAFYT.js → chunk-NSBID7PR.js} +6 -10
- package/{chunk-U7ISRJQO.js → chunk-NTR4SD3P.js} +845 -240
- 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-VMFTFOWF.js → chunk-OKGVNZTL.js} +35 -8
- package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
- package/{chunk-JRQFUXY7.js → chunk-P5GCTVGV.js} +99 -22
- package/{chunk-PQFHGD77.js → chunk-QKTESDWK.js} +161 -14
- package/{chunk-U3JZVWIB.js → chunk-QMXJ5KDJ.js} +68 -46
- package/{chunk-GEPUP7OO.js → chunk-QYUBY3OZ.js} +3 -3
- package/{chunk-3BMYXEUW.js → chunk-R5AJODNI.js} +1 -1
- package/{chunk-J4MOO56S.js → chunk-RILRSUGC.js} +10 -2
- package/{chunk-OEVAY4J6.js → chunk-RWX7AY7J.js} +18 -20
- package/{chunk-YY7I6GQ3.js → chunk-S2NSK7AZ.js} +11 -9
- package/{chunk-IIVGDG4I.js → chunk-SJKULPGX.js} +13 -7
- 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-UZGQNTVW.js → chunk-UA324D4O.js} +8 -6
- package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
- package/chunk-UWXDA7L5.js +8005 -0
- package/{chunk-3DII57IT.js → chunk-VCAQFMVN.js} +1 -1
- package/chunk-VIWDGTDA.js +8 -0
- package/chunk-VJVNU77E.js +83 -0
- package/{chunk-A6FMKU7M.js → chunk-VVJ2ENLY.js} +47 -67
- package/{chunk-UKWGR5SS.js → chunk-VY6VFGKR.js} +194 -1144
- package/{chunk-QDSINZM3.js → chunk-WJ3B6FX6.js} +1 -14
- package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
- package/chunk-YK5MHOWM.js +915 -0
- package/chunk-YV25TM3R.js +780 -0
- package/{chunk-TOP2VXOR.js → chunk-YVU4XVJD.js} +5 -5
- package/{chunk-HVP6P5FV.js → chunk-Z5NGE5DH.js} +29 -9
- package/{chunk-LC43IGO4.js → chunk-ZBHR642M.js} +704 -950
- package/chunk-ZRAU6T47.js +56 -0
- package/{chunk-XPVRVN4U.js → chunk-ZSUDOTPL.js} +19 -17
- package/commandRegistry-QU62WJQX.js +833 -0
- package/{contentThunks-LXOZUD2Y.js → contentThunks-VGV3JJVB.js} +37 -35
- package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
- package/{createAgentAutomationAction-M5NDEIC6.js → createAgentAutomationAction-ZNVLI4WV.js} +39 -37
- package/createDialogAction-TTUA46DT.js +69 -0
- package/{createPageAction-WY5ZKP2M.js → createPageAction-KUFSC5XW.js} +46 -43
- package/{chunk-OWS6OYF4.js → cursorProvider-YGGNMVWX.js} +2751 -10172
- package/{dbSlice-XVWBAGYN.js → dbSlice-MYEETO73.js} +11 -10
- package/{deleteFile-YG6QMJLU.js → deleteFile-KESP65GC.js} +7 -6
- package/{dialogCommands-YVMHDEOX.js → dialogCommands-DRDPEOTL.js} +49 -45
- package/{dialogSlice-HSGREZGA.js → dialogSlice-V2SVSTIV.js} +41 -34
- package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
- package/{docCreateCommands-7UTWDYJU.js → docCreateCommands-M26CFDDQ.js} +48 -43
- package/{docDeleteCommands-GG6BJ4PS.js → docDeleteCommands-LRZHCKVX.js} +49 -44
- package/{docReadCommands-QHMQVSLP.js → docReadCommands-6QJSISHK.js} +47 -42
- package/{docStore-IIS36NGG.js → docStore-4RWAFNDM.js} +16 -12
- package/{docUpdateCommands-QPL6IVUK.js → docUpdateCommands-W4KU4U5T.js} +48 -43
- package/{fetchMessages-EIU7UFFK.js → fetchMessages-3PXAHKCR.js} +5 -5
- package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +4 -4
- package/{handleSendMessageAction-FEHCWMN2.js → handleSendMessageAction-VEWLGB5Z.js} +107 -41
- 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-ERCXIPJC.js → machineCommands-AEHHCJEW.js} +92 -82
- package/machineWsRunDispatch-MY2KHS36.js +154 -0
- package/{memberThunks-QGFLFVCI.js → memberThunks-EE6TI3TV.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-PJIT2YEJ.js} +7 -6
- package/{readDocTool-5USN4A6V.js → readDocTool-DRSXHGNL.js} +5 -3
- package/{readlineWorkspace-PXATJOED.js → readlineWorkspace-7Q6MITLV.js} +2605 -2031
- package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-IN4WUKJJ.js} +21 -25
- package/{runAgentClientLoop-UY76PPZM.js → runAgentClientLoop-H2JALUVD.js} +76 -70
- package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-PIVSBZRZ.js} +4 -4
- package/runtimeModeArgs-2Y7BALTO.js +31 -0
- package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-VDRF7LPK.js} +15 -13
- package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-RO6LIWJ4.js} +22 -26
- package/{chunk-AFUORTY4.js → settingThunks-3OPOLOIA.js} +226 -940
- package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
- package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
- package/{spaceCommands-BMXKR7H6.js → spaceCommands-UBLL5EF2.js} +51 -46
- package/{streamAgentChatTurn-3YVIO4KE.js → streamAgentChatTurn-FFJWW3FD.js} +214 -108
- package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-MVF2JNE7.js} +18 -19
- package/{tableCommands-O6NWHFKV.js → tableCommands-6U4BMLRR.js} +10 -10
- package/{toolApiClient-QVJ6HDNN.js → toolApiClient-EJT6TMFG.js} +3 -3
- package/tools-AZRYLYNK.js +116 -0
- package/{tuiSummaryLlmCaller-WFRWERGK.js → tuiSummaryLlmCaller-7S5HJ3MT.js} +25 -22
- package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
- package/{updateDialogTitleAction-GF5T3VMK.js → updateDialogTitleAction-5WXTRUJM.js} +82 -44
- package/action-YVYQEAAV.js +0 -31
- package/agentListCommands-3GWH4E4G.js +0 -410
- package/agentRecordCommands-UOF6YM5M.js +0 -128
- package/agentRunCommand-AVBWVTAJ.js +0 -156
- package/browser-image-compression-MFDTD7K6.js +0 -1763
- package/chatQueueReduxAdapter-WFROMKD3.js +0 -186
- package/chunk-CQ3WA2NE.js +0 -299
- package/chunk-FQUHIG5X.js +0 -20782
- package/chunk-M76ECQRD.js +0 -13658
- package/chunk-MEYIRKDN.js +0 -8967
- 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-TDFOINOY.js +0 -65
- package/machineWsRunDispatch-OVA3G76V.js +0 -144
- package/settingSlice-ZQZVUPKK.js +0 -204
- package/syncMapping-N6RGXGBW.js +0 -437
- package/tools-Q6IBBG33.js +0 -110
- package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
- package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
|
@@ -1,87 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QYUBY3OZ.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AFSY3ZMB.js";
|
|
8
8
|
import {
|
|
9
|
-
deriveCredentialGroup
|
|
10
|
-
|
|
11
|
-
} from "./chunk-PQFHGD77.js";
|
|
9
|
+
deriveCredentialGroup
|
|
10
|
+
} from "./chunk-QKTESDWK.js";
|
|
12
11
|
import {
|
|
13
12
|
PUBLIC_AGENT_KEY_PREFIX,
|
|
14
|
-
isOwnedAgentKey,
|
|
15
13
|
ownedAgentKey,
|
|
16
14
|
ownedAgentKeyPrefix,
|
|
17
15
|
parseOwnedAgentId,
|
|
18
16
|
publicAgentKey
|
|
19
17
|
} from "./chunk-M2EJHDJP.js";
|
|
20
18
|
|
|
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
19
|
// packages/cli/agentListHelpers.ts
|
|
86
20
|
function parseAgentRecordId(privateKey, explicitId) {
|
|
87
21
|
if (explicitId) return explicitId;
|
|
@@ -117,6 +51,9 @@ function normalizeListedAgent(record) {
|
|
|
117
51
|
...typeof record?.handle === "string" && record.handle ? { handle: record.handle } : {},
|
|
118
52
|
...typeof record?.introduction === "string" && record.introduction ? { introduction: record.introduction } : typeof record?.description === "string" && record.description ? { introduction: record.description } : {},
|
|
119
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 } : {},
|
|
120
57
|
...typeof record?.inputPrice === "number" && Number.isFinite(record.inputPrice) ? { inputPrice: record.inputPrice } : {},
|
|
121
58
|
...typeof record?.outputPrice === "number" && Number.isFinite(record.outputPrice) ? { outputPrice: record.outputPrice } : {},
|
|
122
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,
|
|
@@ -135,13 +72,6 @@ function normalizeListedAgent(record) {
|
|
|
135
72
|
...record?.quota && typeof record.quota === "object" && Array.isArray(record.quota.windows) ? { quota: record.quota } : {}
|
|
136
73
|
};
|
|
137
74
|
}
|
|
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
75
|
function sortListedAgents(agents) {
|
|
146
76
|
agents.sort((a, b) => {
|
|
147
77
|
const ta = a.updatedAt == null ? 0 : new Date(a.updatedAt).getTime();
|
|
@@ -162,6 +92,7 @@ function parseAgentListArgs(args) {
|
|
|
162
92
|
publicOnly: args.includes("--public-only"),
|
|
163
93
|
idsOnly: args.includes("--ids-only"),
|
|
164
94
|
scope: readArgValue(args, "--scope"),
|
|
95
|
+
query: readArgValue(args, "--query"),
|
|
165
96
|
showUnavailable: args.includes("--show-unavailable"),
|
|
166
97
|
// --safe 默认输出精简投影(与 server listAgents 一致,防大列表被截断);
|
|
167
98
|
// --verbose 拿回完整字段集排障。
|
|
@@ -175,7 +106,7 @@ async function listLocalCachedAgents(args) {
|
|
|
175
106
|
for (const prefix of [ownedPrefix, PUBLIC_AGENT_KEY_PREFIX]) {
|
|
176
107
|
for await (const [key, value] of args.db.iterator({ gte: prefix, lte: `${prefix}\uFFFF` })) {
|
|
177
108
|
if (typeof key !== "string" || !value || typeof value !== "object") continue;
|
|
178
|
-
if (
|
|
109
|
+
if (key.startsWith(ownedPrefix)) {
|
|
179
110
|
privateRecords.set(key, { ...value, dbKey: key });
|
|
180
111
|
continue;
|
|
181
112
|
}
|
|
@@ -302,15 +233,89 @@ async function decorateAgentsWithPublicStatusAcrossServers(args) {
|
|
|
302
233
|
return args.agents;
|
|
303
234
|
}
|
|
304
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
|
+
|
|
305
311
|
export {
|
|
306
|
-
formatQuotaSummary,
|
|
307
312
|
normalizeListedAgent,
|
|
308
|
-
toSafeListedAgentSummary,
|
|
309
313
|
parseAgentListArgs,
|
|
310
314
|
listLocalCachedAgents,
|
|
311
315
|
listRemotePublicAgents,
|
|
312
316
|
listRemoteAgents,
|
|
313
317
|
listRemoteAgentsAcrossServers,
|
|
314
318
|
listFavoriteAgentIdsAcrossServers,
|
|
315
|
-
decorateAgentsWithPublicStatusAcrossServers
|
|
319
|
+
decorateAgentsWithPublicStatusAcrossServers,
|
|
320
|
+
formatQuotaSummary
|
|
316
321
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
formatISO
|
|
3
|
+
} from "./chunk-ZRAU6T47.js";
|
|
4
4
|
import {
|
|
5
5
|
require_react
|
|
6
6
|
} from "./chunk-YDH3FDFQ.js";
|
|
7
|
-
import {
|
|
8
|
-
toErrorMessage
|
|
9
|
-
} from "./chunk-HNMXYYJR.js";
|
|
10
7
|
import {
|
|
11
8
|
patch,
|
|
12
9
|
readAndWait
|
|
13
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4WMMIL66.js";
|
|
11
|
+
import {
|
|
12
|
+
toErrorMessage
|
|
13
|
+
} from "./chunk-HNMXYYJR.js";
|
|
14
14
|
import {
|
|
15
15
|
asOptionalTrimmedString
|
|
16
16
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
|
|
21
21
|
// packages/render/page/docStore.ts
|
|
22
22
|
var import_react = __toESM(require_react(), 1);
|
|
23
|
-
var import_date_fns = __toESM(require_date_fns(), 1);
|
|
24
23
|
var createInitialState = () => ({
|
|
25
24
|
content: null,
|
|
26
25
|
slateData: null,
|
|
@@ -52,6 +51,7 @@ var createInitialState = () => ({
|
|
|
52
51
|
var listeners = /* @__PURE__ */ new Set();
|
|
53
52
|
var version = 0;
|
|
54
53
|
var state = createInitialState();
|
|
54
|
+
var latestInitRequestKey = null;
|
|
55
55
|
var notify = () => {
|
|
56
56
|
for (const listener of listeners) {
|
|
57
57
|
try {
|
|
@@ -102,6 +102,9 @@ function getDocField(selector) {
|
|
|
102
102
|
function getDocPageKey() {
|
|
103
103
|
return state.pageKey;
|
|
104
104
|
}
|
|
105
|
+
function isDocStateForPage(state2, pageKey) {
|
|
106
|
+
return Boolean(pageKey) && state2.pageKey === pageKey;
|
|
107
|
+
}
|
|
105
108
|
function getDocIsInitialized() {
|
|
106
109
|
return state.isInitialized;
|
|
107
110
|
}
|
|
@@ -143,6 +146,7 @@ function updateDocTags(tags) {
|
|
|
143
146
|
setState((prev) => ({ ...prev, tags }));
|
|
144
147
|
}
|
|
145
148
|
function resetDocState() {
|
|
149
|
+
latestInitRequestKey = null;
|
|
146
150
|
setState(createInitialState());
|
|
147
151
|
}
|
|
148
152
|
function previewDocState(payload) {
|
|
@@ -190,6 +194,7 @@ function applyExternalDocUpdate(payload) {
|
|
|
190
194
|
}
|
|
191
195
|
async function initDocState(args, { dispatch }) {
|
|
192
196
|
const { pageKey, isReadOnly } = args;
|
|
197
|
+
latestInitRequestKey = pageKey;
|
|
193
198
|
setState((prev) => ({
|
|
194
199
|
...createInitialState(),
|
|
195
200
|
isLoading: true,
|
|
@@ -198,6 +203,7 @@ async function initDocState(args, { dispatch }) {
|
|
|
198
203
|
}));
|
|
199
204
|
try {
|
|
200
205
|
const readAction = await dispatch(readAndWait(pageKey));
|
|
206
|
+
if (latestInitRequestKey !== pageKey) return;
|
|
201
207
|
if (readAndWait.fulfilled.match(readAction) && readAction.payload) {
|
|
202
208
|
const data = readAction.payload;
|
|
203
209
|
if (data.type !== "page" /* DOC */) {
|
|
@@ -247,6 +253,7 @@ async function initDocState(args, { dispatch }) {
|
|
|
247
253
|
}));
|
|
248
254
|
}
|
|
249
255
|
} catch (e) {
|
|
256
|
+
if (latestInitRequestKey !== pageKey) return;
|
|
250
257
|
setState((prev) => ({
|
|
251
258
|
...prev,
|
|
252
259
|
isLoading: false,
|
|
@@ -300,7 +307,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
300
307
|
{ slateToRenderMarkdown },
|
|
301
308
|
{ buildSkillSummaryMarker }
|
|
302
309
|
] = await Promise.all([
|
|
303
|
-
import("./slateUtils-
|
|
310
|
+
import("./slateUtils-NGV2NMKM.js"),
|
|
304
311
|
import("./slateToRenderMarkdown-Y5IYN73U.js"),
|
|
305
312
|
import("./skillSummaryMarker-42HKSXYY.js")
|
|
306
313
|
]);
|
|
@@ -309,7 +316,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
309
316
|
const skillSummary = buildSkillSummaryMarker(meta);
|
|
310
317
|
const content = slateToRenderMarkdown(slateData);
|
|
311
318
|
const now = /* @__PURE__ */ new Date();
|
|
312
|
-
const updatedAt =
|
|
319
|
+
const updatedAt = formatISO(now);
|
|
313
320
|
await dispatch(
|
|
314
321
|
patch({
|
|
315
322
|
dbKey: pageKey,
|
|
@@ -326,7 +333,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
326
333
|
).unwrap();
|
|
327
334
|
if (dbSpaceId) {
|
|
328
335
|
try {
|
|
329
|
-
const { updateContentTitle } = await import("./contentThunks-
|
|
336
|
+
const { updateContentTitle } = await import("./contentThunks-VGV3JJVB.js");
|
|
330
337
|
await dispatch(
|
|
331
338
|
updateContentTitle({
|
|
332
339
|
spaceId: dbSpaceId,
|
|
@@ -365,7 +372,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
365
372
|
}
|
|
366
373
|
}
|
|
367
374
|
async function createDocState(args, thunkApi) {
|
|
368
|
-
const { createPageAction } = await import("./createPageAction-
|
|
375
|
+
const { createPageAction } = await import("./createPageAction-KUFSC5XW.js");
|
|
369
376
|
return createPageAction(args, thunkApi);
|
|
370
377
|
}
|
|
371
378
|
function subscribe(listener) {
|
|
@@ -387,6 +394,7 @@ function useDocField(selector) {
|
|
|
387
394
|
}
|
|
388
395
|
function resetDocStoreForTests() {
|
|
389
396
|
state = createInitialState();
|
|
397
|
+
latestInitRequestKey = null;
|
|
390
398
|
bump();
|
|
391
399
|
}
|
|
392
400
|
|
|
@@ -394,6 +402,7 @@ export {
|
|
|
394
402
|
getDocState,
|
|
395
403
|
getDocField,
|
|
396
404
|
getDocPageKey,
|
|
405
|
+
isDocStateForPage,
|
|
397
406
|
getDocIsInitialized,
|
|
398
407
|
getDocIsReadOnly,
|
|
399
408
|
getDocHasPendingChanges,
|
|
@@ -21,6 +21,8 @@ var createEmptyDialogRuntimeState = () => ({
|
|
|
21
21
|
activeControllers: {},
|
|
22
22
|
pendingRawData: {},
|
|
23
23
|
loopStopReason: null,
|
|
24
|
+
turnPhase: null,
|
|
25
|
+
turnPhaseTurnId: null,
|
|
24
26
|
pendingUserInputQueue: []
|
|
25
27
|
});
|
|
26
28
|
var activeDialogKey = null;
|
|
@@ -67,6 +69,8 @@ function resetDialogRuntimeSessionState(dialogKey) {
|
|
|
67
69
|
const runtime = ensureDialogRuntimeState(dialogKey);
|
|
68
70
|
runtime.tokens = createEmptyTokenStats();
|
|
69
71
|
runtime.loopStopReason = null;
|
|
72
|
+
runtime.turnPhase = null;
|
|
73
|
+
runtime.turnPhaseTurnId = null;
|
|
70
74
|
runtime.pendingUserInputQueue = [];
|
|
71
75
|
notify();
|
|
72
76
|
}
|
|
@@ -114,6 +118,26 @@ function setLoopStopReason(payload) {
|
|
|
114
118
|
notify();
|
|
115
119
|
return action("dialogRuntime/setLoopStopReason", payload);
|
|
116
120
|
}
|
|
121
|
+
function claimDialogTurnPhase(payload) {
|
|
122
|
+
const runtime = ensureDialogRuntimeState(payload.dialogKey);
|
|
123
|
+
runtime.turnPhaseTurnId = payload.turnId;
|
|
124
|
+
runtime.turnPhase = null;
|
|
125
|
+
notify();
|
|
126
|
+
return action("dialogRuntime/claimDialogTurnPhase", payload);
|
|
127
|
+
}
|
|
128
|
+
function setDialogTurnPhase(payload) {
|
|
129
|
+
const runtime = ensureDialogRuntimeState(payload.dialogKey);
|
|
130
|
+
if (typeof payload.turnId === "string" && runtime.turnPhaseTurnId !== null && runtime.turnPhaseTurnId !== payload.turnId) {
|
|
131
|
+
return action("dialogRuntime/setDialogTurnPhase:rejected", payload);
|
|
132
|
+
}
|
|
133
|
+
runtime.turnPhase = payload.phase;
|
|
134
|
+
runtime.turnPhaseTurnId = payload.phase === null ? null : payload.turnId ?? null;
|
|
135
|
+
notify();
|
|
136
|
+
return action("dialogRuntime/setDialogTurnPhase", payload);
|
|
137
|
+
}
|
|
138
|
+
function clearDialogTurnPhase(payload = {}) {
|
|
139
|
+
return setDialogTurnPhase({ phase: null, dialogKey: payload.dialogKey, turnId: payload.turnId });
|
|
140
|
+
}
|
|
117
141
|
function clearDialogRuntimeState(payload) {
|
|
118
142
|
delete runtimeByKey[payload.dialogKey];
|
|
119
143
|
notify();
|
|
@@ -258,6 +282,9 @@ function getPendingUserInputQueue(dialogKey) {
|
|
|
258
282
|
function getLoopStopReason(dialogKey) {
|
|
259
283
|
return getDialogRuntimeState(dialogKey).loopStopReason;
|
|
260
284
|
}
|
|
285
|
+
function getDialogTurnPhase(dialogKey) {
|
|
286
|
+
return getDialogRuntimeState(dialogKey).turnPhase;
|
|
287
|
+
}
|
|
261
288
|
var selectDialogRuntimeByKey = (_state, dialogKey) => getDialogRuntimeState(dialogKey);
|
|
262
289
|
var selectPendingFiles = (_state, dialogKey) => getPendingFiles(dialogKey);
|
|
263
290
|
var selectActiveControllers = (_state, dialogKey) => getActiveControllers(dialogKey);
|
|
@@ -293,6 +320,10 @@ function useLoopStopReason(dialogKey) {
|
|
|
293
320
|
(0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
294
321
|
return getLoopStopReason(dialogKey);
|
|
295
322
|
}
|
|
323
|
+
function useDialogTurnPhase(dialogKey) {
|
|
324
|
+
(0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
325
|
+
return getDialogTurnPhase(dialogKey);
|
|
326
|
+
}
|
|
296
327
|
function useDialogRuntimeTokens(dialogKey) {
|
|
297
328
|
(0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
298
329
|
return getDialogRuntimeTokens(dialogKey);
|
|
@@ -316,6 +347,9 @@ export {
|
|
|
316
347
|
removePendingFile,
|
|
317
348
|
clearPendingAttachments,
|
|
318
349
|
setLoopStopReason,
|
|
350
|
+
claimDialogTurnPhase,
|
|
351
|
+
setDialogTurnPhase,
|
|
352
|
+
clearDialogTurnPhase,
|
|
319
353
|
clearDialogRuntimeState,
|
|
320
354
|
addActiveController,
|
|
321
355
|
removeActiveController,
|
|
@@ -330,8 +364,6 @@ export {
|
|
|
330
364
|
deleteDialogRuntime,
|
|
331
365
|
abortActiveControllers,
|
|
332
366
|
getDialogRuntimeTokens,
|
|
333
|
-
getPendingUserInputQueue,
|
|
334
|
-
getLoopStopReason,
|
|
335
367
|
selectDialogRuntimeByKey,
|
|
336
368
|
selectPendingFiles,
|
|
337
369
|
selectActiveControllers,
|
|
@@ -346,6 +378,7 @@ export {
|
|
|
346
378
|
useActiveControllers,
|
|
347
379
|
usePendingUserInputQueue,
|
|
348
380
|
useLoopStopReason,
|
|
381
|
+
useDialogTurnPhase,
|
|
349
382
|
useDialogRuntimeTokens,
|
|
350
383
|
useCurrentDialogKey,
|
|
351
384
|
useDialogConfigError
|
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
} from "./chunk-5ZUL4CUO.js";
|
|
4
4
|
import {
|
|
5
5
|
getModelContextWindow
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-L5WOICCV.js";
|
|
7
7
|
import {
|
|
8
8
|
findModelConfig,
|
|
9
9
|
getProviderByModelName
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
asOptionalFiniteNumber
|
|
13
|
-
} from "./chunk-WWC7I6TA.js";
|
|
10
|
+
} from "./chunk-3BXNTXYI.js";
|
|
14
11
|
import {
|
|
15
12
|
asTrimmedLowercaseString
|
|
16
13
|
} from "./chunk-QSJ3HFEF.js";
|
|
17
14
|
import {
|
|
18
15
|
isRecord
|
|
19
16
|
} from "./chunk-KUG52IAP.js";
|
|
17
|
+
import {
|
|
18
|
+
asOptionalFiniteNumber
|
|
19
|
+
} from "./chunk-WWC7I6TA.js";
|
|
20
20
|
import {
|
|
21
21
|
asTrimmedString
|
|
22
22
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clipCompactText
|
|
3
|
+
} from "./chunk-5MMAK75Q.js";
|
|
4
|
+
import {
|
|
5
|
+
asRecordOrEmpty
|
|
6
|
+
} from "./chunk-KX6YBIHG.js";
|
|
7
|
+
import {
|
|
8
|
+
asOptionalTrimmedString
|
|
9
|
+
} from "./chunk-G3SUCT4W.js";
|
|
10
|
+
|
|
11
|
+
// packages/agent-runtime/fileWritePolicy.ts
|
|
12
|
+
function evaluateFileWritePolicy(args) {
|
|
13
|
+
if (args.sessionApproved) return { permissionDecision: "allow" };
|
|
14
|
+
return {
|
|
15
|
+
permissionDecision: "ask",
|
|
16
|
+
permissionRequest: {
|
|
17
|
+
id: "permission-file-write-session",
|
|
18
|
+
tool: args.tool,
|
|
19
|
+
action: "file_write",
|
|
20
|
+
title: "\u786E\u8BA4\u5199\u5165\u6587\u4EF6",
|
|
21
|
+
body: `\u672C\u4F1A\u8BDD\u9996\u6B21\u5199\u5165\u6587\u4EF6\uFF1A${args.path}\u3002\u6279\u51C6\u540E\u672C\u4F1A\u8BDD\u540E\u7EED\u5199\u5165\u4E0D\u518D\u9010\u6B21\u786E\u8BA4\u3002`,
|
|
22
|
+
command: args.path,
|
|
23
|
+
suggestedRule: {
|
|
24
|
+
scope: "session",
|
|
25
|
+
pattern: { capability: "file_write", target: "session" }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// packages/agent-runtime/parseToolArguments.ts
|
|
32
|
+
function parseToolArgumentsJson(raw) {
|
|
33
|
+
if (!raw?.trim()) return {};
|
|
34
|
+
try {
|
|
35
|
+
return asRecordOrEmpty(JSON.parse(raw));
|
|
36
|
+
} catch {
|
|
37
|
+
return {};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// packages/agent-runtime/summarizeToolArguments.ts
|
|
42
|
+
function clip(value, max = 240) {
|
|
43
|
+
return clipCompactText(value, max);
|
|
44
|
+
}
|
|
45
|
+
function summarizeToolArguments(toolName, rawArgs) {
|
|
46
|
+
const args = parseToolArgumentsJson(rawArgs);
|
|
47
|
+
const pick = (...keys2) => {
|
|
48
|
+
for (const key of keys2) {
|
|
49
|
+
const value = asOptionalTrimmedString(args[key]);
|
|
50
|
+
if (value) return value;
|
|
51
|
+
}
|
|
52
|
+
return "";
|
|
53
|
+
};
|
|
54
|
+
const command = pick("command", "cmd", "runCommand", "executeCommand", "bash");
|
|
55
|
+
if (command) return clip(command);
|
|
56
|
+
const query = pick("query", "pattern", "search", "q");
|
|
57
|
+
if (query) return clip(query);
|
|
58
|
+
const filePath = pick("filePath", "file_path", "path", "filename", "file");
|
|
59
|
+
if (filePath) return clip(filePath);
|
|
60
|
+
const keys = Object.keys(args);
|
|
61
|
+
if (keys.length === 0) return "";
|
|
62
|
+
return clip(
|
|
63
|
+
keys.slice(0, 6).map((key) => {
|
|
64
|
+
const value = args[key];
|
|
65
|
+
if (typeof value === "string") return `${key}=${clip(value, 80)}`;
|
|
66
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
67
|
+
return `${key}=${String(value)}`;
|
|
68
|
+
}
|
|
69
|
+
if (Array.isArray(value)) return `${key}[${value.length}]`;
|
|
70
|
+
return `${key}=${value === null ? "null" : typeof value}`;
|
|
71
|
+
}).join(" ")
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
evaluateFileWritePolicy,
|
|
77
|
+
summarizeToolArguments
|
|
78
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readDbRecord,
|
|
3
3
|
writeAgentRecord
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AFSY3ZMB.js";
|
|
5
5
|
import {
|
|
6
6
|
buildSkillSummaryMarker
|
|
7
7
|
} from "./chunk-VF4K2QE6.js";
|
|
8
|
+
import {
|
|
9
|
+
createSpaceKey
|
|
10
|
+
} from "./chunk-UAD2WT54.js";
|
|
8
11
|
import {
|
|
9
12
|
parseUserIdFromAuthToken,
|
|
10
13
|
readOption,
|
|
11
14
|
resolveAuthToken,
|
|
12
15
|
resolveServerUrl
|
|
13
16
|
} from "./chunk-A7GB5UGH.js";
|
|
14
|
-
import {
|
|
15
|
-
createSpaceKey
|
|
16
|
-
} from "./chunk-UAD2WT54.js";
|
|
17
17
|
import {
|
|
18
18
|
asTrimmedLowercaseString
|
|
19
19
|
} from "./chunk-QSJ3HFEF.js";
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BUILTIN_PLATFORM_AGENT_KEYS
|
|
3
|
-
} from "./chunk-BNGW5ASC.js";
|
|
4
1
|
import {
|
|
5
2
|
getRuntimeServerContext,
|
|
6
3
|
partitionReadServers,
|
|
@@ -10,17 +7,20 @@ import {
|
|
|
10
7
|
scheduleExistingRecordReplication,
|
|
11
8
|
shouldReplaceLocalWithRemoteRecord,
|
|
12
9
|
shouldReplicateLocalRecord
|
|
13
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-O7SVKKLY.js";
|
|
11
|
+
import {
|
|
12
|
+
shouldReplaceWithNextRecord
|
|
13
|
+
} from "./chunk-D2MDMY2M.js";
|
|
14
|
+
import {
|
|
15
|
+
BUILTIN_PLATFORM_AGENT_KEYS
|
|
16
|
+
} from "./chunk-BNGW5ASC.js";
|
|
14
17
|
import {
|
|
15
18
|
fetchFromClientDb,
|
|
16
19
|
fetchFromServer,
|
|
17
20
|
isAbortError,
|
|
18
21
|
isReadTimeoutError,
|
|
19
22
|
logger
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import {
|
|
22
|
-
shouldReplaceWithNextRecord
|
|
23
|
-
} from "./chunk-GBRG75BQ.js";
|
|
23
|
+
} from "./chunk-HIM3FCLF.js";
|
|
24
24
|
import {
|
|
25
25
|
NOLO_CLUSTER_SERVERS,
|
|
26
26
|
normalizeKnownServerOrigin
|