nolo-cli 0.105.0-alpha.3 → 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-VXWM4UYD.js → readlineWorkspace-7Q6MITLV.js} +2593 -2029
- 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,23 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isOAuthApiKeyRef
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UKZX3NHN.js";
|
|
4
4
|
import {
|
|
5
5
|
compareAgentSelection
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SJKULPGX.js";
|
|
7
|
+
import {
|
|
8
|
+
isAgentUnavailableNow
|
|
9
|
+
} from "./chunk-H6A6X4EK.js";
|
|
10
|
+
import {
|
|
11
|
+
isSubscriptionEndpoint,
|
|
12
|
+
isSubscriptionOAuthCredential
|
|
13
|
+
} from "./chunk-EKPKW6RM.js";
|
|
7
14
|
import {
|
|
8
15
|
isAntigravityOAuthAgent
|
|
9
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UA324D4O.js";
|
|
10
17
|
import {
|
|
11
18
|
getModelAbility
|
|
12
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-CYSYR67N.js";
|
|
20
|
+
import {
|
|
21
|
+
fnv1a32Hex
|
|
22
|
+
} from "./chunk-O7SVKKLY.js";
|
|
13
23
|
import {
|
|
14
24
|
isOwnedAgentKey,
|
|
15
25
|
ownedAgentKey,
|
|
16
26
|
publicAgentKey
|
|
17
27
|
} from "./chunk-M2EJHDJP.js";
|
|
18
|
-
import {
|
|
19
|
-
fnv1a32Hex
|
|
20
|
-
} from "./chunk-UKWGR5SS.js";
|
|
21
28
|
|
|
22
29
|
// packages/ai/agent/agentBilling.ts
|
|
23
30
|
function resolveBillingSource(candidate) {
|
|
@@ -36,6 +43,9 @@ function resolveBillingSource(candidate) {
|
|
|
36
43
|
}
|
|
37
44
|
if (candidate?.isOAuth === true || candidate?.billingSource === "user_subscription" || candidate?.apiSource === "oauth" || isOAuthApiKeyRef(candidate?.apiKeyRef)) return "user_subscription";
|
|
38
45
|
if (candidate?.apiSource === "custom" || candidate?.billingSource === "user_api") {
|
|
46
|
+
if (isSubscriptionEndpoint(candidate?.customProviderUrl) || isSubscriptionOAuthCredential(candidate?.apiKeyRef)) {
|
|
47
|
+
return "user_subscription";
|
|
48
|
+
}
|
|
39
49
|
return "user_api";
|
|
40
50
|
}
|
|
41
51
|
return "platform_credits";
|
|
@@ -227,6 +237,16 @@ function deriveCredentialGroup(ref) {
|
|
|
227
237
|
credentialKind: "api-key"
|
|
228
238
|
};
|
|
229
239
|
}
|
|
240
|
+
function deriveCustomProviderCredentialGroup(userId, customProviderUrl) {
|
|
241
|
+
if (typeof customProviderUrl !== "string" || !customProviderUrl.trim()) {
|
|
242
|
+
return void 0;
|
|
243
|
+
}
|
|
244
|
+
const basis = `${userId ?? ""}|${customProviderUrl.trim().toLowerCase()}`;
|
|
245
|
+
return {
|
|
246
|
+
credentialGroup: `custom-${fnv1a32Hex(basis)}`,
|
|
247
|
+
credentialKind: "api-key"
|
|
248
|
+
};
|
|
249
|
+
}
|
|
230
250
|
function summarizeCredentialGroups(agents, now = Date.now()) {
|
|
231
251
|
const groups = /* @__PURE__ */ new Map();
|
|
232
252
|
for (const agent of agents) {
|
|
@@ -327,6 +347,15 @@ function resolveFavoriteStatus(record, options) {
|
|
|
327
347
|
}
|
|
328
348
|
return { isFavorite: false, favoritedAt: null };
|
|
329
349
|
}
|
|
350
|
+
function isOwnedAgentRecord(record, userId) {
|
|
351
|
+
if (!userId) return false;
|
|
352
|
+
if (typeof record?.userId === "string" && record.userId === userId || typeof record?.ownerId === "string" && record.ownerId === userId) {
|
|
353
|
+
return true;
|
|
354
|
+
}
|
|
355
|
+
return [record?.dbKey, record?.privateKey].some(
|
|
356
|
+
(key) => isOwnedAgentKey(key, userId)
|
|
357
|
+
);
|
|
358
|
+
}
|
|
330
359
|
function toSafeAgentSummary(record, options) {
|
|
331
360
|
const rawId = parseAgentRecordId(
|
|
332
361
|
typeof record?.privateKey === "string" ? record.privateKey : record?.dbKey,
|
|
@@ -359,11 +388,10 @@ function toSafeAgentSummary(record, options) {
|
|
|
359
388
|
const rawQuota = record?.quota;
|
|
360
389
|
const quota = rawQuota && typeof rawQuota === "object" && Array.isArray(rawQuota.windows) && typeof rawQuota.observedAt === "number" && Number.isFinite(rawQuota.observedAt) ? rawQuota : void 0;
|
|
361
390
|
const currentUserId = options?.userId;
|
|
362
|
-
const isOwnedByRecord = Boolean(currentUserId) && (typeof record?.userId === "string" && record.userId === currentUserId || typeof record?.ownerId === "string" && record.ownerId === currentUserId);
|
|
363
391
|
const ownedKey = currentUserId ? [record?.dbKey, record?.privateKey].find(
|
|
364
392
|
(key) => isOwnedAgentKey(key, currentUserId)
|
|
365
393
|
) : void 0;
|
|
366
|
-
const isOwned =
|
|
394
|
+
const isOwned = isOwnedAgentRecord(record, currentUserId);
|
|
367
395
|
const isOAuth = isOAuthApiKeyRef(record?.apiKeyRef);
|
|
368
396
|
const billingSource = resolveBillingSource({
|
|
369
397
|
...record,
|
|
@@ -506,12 +534,131 @@ function toUnavailableAgentSummary(summary) {
|
|
|
506
534
|
return item;
|
|
507
535
|
}
|
|
508
536
|
|
|
537
|
+
// packages/ai/agent/agentDiscovery.ts
|
|
538
|
+
function isPreferredAgent(agent) {
|
|
539
|
+
return agent.isFavorite === true || agent.isOwned === true || agent.isOAuth === true || agent.billingSource === "user_subscription" || agent.billingSource === "user_api" || agent.billingSource === "local";
|
|
540
|
+
}
|
|
541
|
+
function isPublicDiscoveryAgent(agent) {
|
|
542
|
+
return agent.isPublic === true && !isPreferredAgent(agent);
|
|
543
|
+
}
|
|
544
|
+
function resolveDiscoveryScope(args) {
|
|
545
|
+
const rawScope = typeof args?.scope === "string" ? args.scope.trim().toLowerCase() : void 0;
|
|
546
|
+
const hasScope = rawScope !== void 0 && rawScope !== "";
|
|
547
|
+
const hasPublicOnly = typeof args?.publicOnly === "boolean";
|
|
548
|
+
const publicOnly = args?.publicOnly === true;
|
|
549
|
+
if (hasScope) {
|
|
550
|
+
if (rawScope !== "preferred" && rawScope !== "public" && rawScope !== "all") {
|
|
551
|
+
throw new Error(`Invalid scope '${args?.scope}': must be 'preferred', 'public', or 'all'.`);
|
|
552
|
+
}
|
|
553
|
+
const scope = rawScope;
|
|
554
|
+
if (hasPublicOnly) {
|
|
555
|
+
if (publicOnly && scope !== "public") {
|
|
556
|
+
throw new Error(
|
|
557
|
+
`Conflicting arguments: scope='${args?.scope}' conflicts with publicOnly=true.`
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
if (!publicOnly && scope === "public") {
|
|
561
|
+
throw new Error(
|
|
562
|
+
`Conflicting arguments: scope='${args?.scope}' conflicts with publicOnly=false.`
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return scope;
|
|
567
|
+
}
|
|
568
|
+
if (hasPublicOnly && publicOnly) {
|
|
569
|
+
return "public";
|
|
570
|
+
}
|
|
571
|
+
return "preferred";
|
|
572
|
+
}
|
|
573
|
+
function agentIdentityKeys(agent) {
|
|
574
|
+
return [agent.agentKey, agent.publicKey, agent.id].filter(
|
|
575
|
+
(key) => typeof key === "string" && key.length > 0
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
function deduplicateAgentSummaries(agents) {
|
|
579
|
+
const byIdentity = /* @__PURE__ */ new Map();
|
|
580
|
+
for (const agent of agents) {
|
|
581
|
+
const keys = agentIdentityKeys(agent);
|
|
582
|
+
const existing = keys.map((key) => byIdentity.get(key)).find(Boolean);
|
|
583
|
+
if (!existing) {
|
|
584
|
+
for (const key of keys) byIdentity.set(key, agent);
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
587
|
+
const winner = isPreferredAgent(agent) && !isPreferredAgent(existing) ? agent : existing;
|
|
588
|
+
for (const key of /* @__PURE__ */ new Set([...agentIdentityKeys(existing), ...keys])) byIdentity.set(key, winner);
|
|
589
|
+
}
|
|
590
|
+
return [...new Set(byIdentity.values())];
|
|
591
|
+
}
|
|
592
|
+
function filterAgentsByScope(agents, scope) {
|
|
593
|
+
const unique = deduplicateAgentSummaries(agents);
|
|
594
|
+
if (scope === "preferred") return unique.filter((agent) => isPreferredAgent(agent));
|
|
595
|
+
if (scope === "public") return unique.filter((agent) => isPublicDiscoveryAgent(agent));
|
|
596
|
+
return unique.filter((agent) => isPreferredAgent(agent) || agent.isPublic === true);
|
|
597
|
+
}
|
|
598
|
+
function matchesAgentQuery(agent, query) {
|
|
599
|
+
if (!query || typeof query !== "string") return true;
|
|
600
|
+
const q = query.trim().toLowerCase();
|
|
601
|
+
if (!q) return true;
|
|
602
|
+
const candidates = [
|
|
603
|
+
agent.name,
|
|
604
|
+
agent.model,
|
|
605
|
+
agent.provider,
|
|
606
|
+
agent.handle,
|
|
607
|
+
agent.agentKey,
|
|
608
|
+
agent.publicKey,
|
|
609
|
+
agent.id
|
|
610
|
+
];
|
|
611
|
+
return candidates.some((text) => typeof text === "string" && text.toLowerCase().includes(q));
|
|
612
|
+
}
|
|
613
|
+
function buildAgentDiscoveryResult(options) {
|
|
614
|
+
const scope = resolveDiscoveryScope({
|
|
615
|
+
scope: options.scope,
|
|
616
|
+
publicOnly: options.publicOnly
|
|
617
|
+
});
|
|
618
|
+
const now = options.now ?? Date.now();
|
|
619
|
+
let scopedAgents = filterAgentsByScope(options.agents, scope);
|
|
620
|
+
if (options.query && typeof options.query === "string" && options.query.trim()) {
|
|
621
|
+
scopedAgents = scopedAgents.filter((a) => matchesAgentQuery(a, options.query));
|
|
622
|
+
}
|
|
623
|
+
const unavailableList = scopedAgents.filter((a) => isAgentUnavailableNow(a, now));
|
|
624
|
+
const unavailableCount = unavailableList.length;
|
|
625
|
+
const unavailableAgents = sortSafeAgentSummaries(unavailableList).map(toUnavailableAgentSummary);
|
|
626
|
+
const credentialGroups = summarizeCredentialGroups(scopedAgents, now);
|
|
627
|
+
if (options.showUnavailable !== true) {
|
|
628
|
+
scopedAgents = scopedAgents.filter((a) => !isAgentUnavailableNow(a, now));
|
|
629
|
+
}
|
|
630
|
+
const sortedAgents = sortSafeAgentSummaries(scopedAgents);
|
|
631
|
+
const projectedAgents = options.verbose === true ? sortedAgents.map(omitNullishAgentSummaryFields) : sortedAgents.map(toCompactAgentSummary);
|
|
632
|
+
return {
|
|
633
|
+
total: projectedAgents.length,
|
|
634
|
+
unavailableCount,
|
|
635
|
+
unavailableAgents,
|
|
636
|
+
credentialGroups,
|
|
637
|
+
agents: projectedAgents
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
function toDiscoverySafeAgentSummary(record, options) {
|
|
641
|
+
const mergedOptions = record?.publicRecordExists === true ? { ...options, publicRecordExists: true } : options;
|
|
642
|
+
return toSafeAgentSummary(record, mergedOptions);
|
|
643
|
+
}
|
|
644
|
+
function assembleAgentDiscoveryResult(options) {
|
|
645
|
+
const { records, summaryOptions, ...discoveryOptions } = options;
|
|
646
|
+
const agents = records.map(
|
|
647
|
+
(record) => toDiscoverySafeAgentSummary(
|
|
648
|
+
record,
|
|
649
|
+
typeof summaryOptions === "function" ? summaryOptions(record) : summaryOptions
|
|
650
|
+
)
|
|
651
|
+
);
|
|
652
|
+
return buildAgentDiscoveryResult({ ...discoveryOptions, agents });
|
|
653
|
+
}
|
|
654
|
+
|
|
509
655
|
export {
|
|
510
656
|
deriveCredentialGroup,
|
|
657
|
+
deriveCustomProviderCredentialGroup,
|
|
511
658
|
summarizeCredentialGroups,
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
659
|
+
resolveDiscoveryScope,
|
|
660
|
+
matchesAgentQuery,
|
|
661
|
+
buildAgentDiscoveryResult,
|
|
662
|
+
toDiscoverySafeAgentSummary,
|
|
663
|
+
assembleAgentDiscoveryResult
|
|
517
664
|
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
clipMultilineText,
|
|
9
9
|
fetchAndSerializeTable
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LWXE6IFU.js";
|
|
11
11
|
import {
|
|
12
12
|
isGatewayHttpStatus
|
|
13
13
|
} from "./chunk-NF64D32W.js";
|
|
@@ -18,104 +18,106 @@ import {
|
|
|
18
18
|
parseRetryAfterHeaderMs
|
|
19
19
|
} from "./chunk-3L2WKC3W.js";
|
|
20
20
|
import {
|
|
21
|
+
resolvePageReadMarkdown,
|
|
21
22
|
slateToSimplifiedMarkdown
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-RILRSUGC.js";
|
|
23
24
|
import {
|
|
24
25
|
waitForAbortableDelay
|
|
25
26
|
} from "./chunk-N4G4PKQ6.js";
|
|
26
27
|
import {
|
|
27
28
|
extractCategorizedMentions
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-AGIM7IMJ.js";
|
|
29
30
|
import {
|
|
30
31
|
fetchAndCacheMessages
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-44CU7CKA.js";
|
|
32
33
|
import {
|
|
33
34
|
shouldUseServerProxy
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-UKZX3NHN.js";
|
|
35
36
|
import {
|
|
36
37
|
fetchServerSyncedCredential
|
|
37
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-S2NSK7AZ.js";
|
|
38
39
|
import {
|
|
39
40
|
buildSkillGuidancePromptBlock,
|
|
40
41
|
extractRuntimePageCapabilities,
|
|
41
42
|
resolveBuiltinSkillPage,
|
|
42
43
|
resolveSkillGraphFromRoots
|
|
43
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-P5GCTVGV.js";
|
|
44
45
|
import {
|
|
46
|
+
DELETE_SAFETY_RED_LINE,
|
|
45
47
|
buildIdentityBlock,
|
|
46
48
|
buildRuntimeGuidanceBlocks,
|
|
47
49
|
compileContextLayers,
|
|
48
50
|
detectDispatchIntentFromMessages,
|
|
49
51
|
normalizeChatCompletionsBodyForProvider,
|
|
50
52
|
resolveToolGuidedSections
|
|
51
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-AFH5QC6R.js";
|
|
52
54
|
import {
|
|
53
55
|
convertMessagesToResponsesInput,
|
|
54
56
|
getUsageRequestOptions,
|
|
55
57
|
preserveAgentStateFields,
|
|
56
58
|
stablePromptCacheKey
|
|
57
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-M7VLQGQP.js";
|
|
60
|
+
import {
|
|
61
|
+
createFileCredentialBroker
|
|
62
|
+
} from "./chunk-2U3NHADM.js";
|
|
63
|
+
import {
|
|
64
|
+
estimateTokenCount
|
|
65
|
+
} from "./chunk-PSCNXBYA.js";
|
|
66
|
+
import {
|
|
67
|
+
createSpaceKey
|
|
68
|
+
} from "./chunk-UAD2WT54.js";
|
|
69
|
+
import {
|
|
70
|
+
read
|
|
71
|
+
} from "./chunk-4WMMIL66.js";
|
|
72
|
+
import {
|
|
73
|
+
MEMORY_USE_GUIDANCE,
|
|
74
|
+
buildUserResponseLanguageContext,
|
|
75
|
+
wrapHistoricalSummaryWithReplayGuard
|
|
76
|
+
} from "./chunk-4VJAC32I.js";
|
|
77
|
+
import {
|
|
78
|
+
canonicalizeToolNames
|
|
79
|
+
} from "./chunk-IHPDK6UD.js";
|
|
58
80
|
import {
|
|
59
81
|
ANTIGRAVITY_CLOUD_CODE_BASE_URL,
|
|
60
82
|
isAntigravityOAuthAgent
|
|
61
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-UA324D4O.js";
|
|
62
84
|
import {
|
|
63
85
|
buildProviderAuthHeaders
|
|
64
|
-
} from "./chunk-
|
|
65
|
-
import {
|
|
66
|
-
estimateTokenCount
|
|
67
|
-
} from "./chunk-PSCNXBYA.js";
|
|
86
|
+
} from "./chunk-27ONFIEY.js";
|
|
68
87
|
import {
|
|
69
88
|
isOpenAiResponsesModel,
|
|
70
89
|
resolvePlatformChatCompletionsEndpoint,
|
|
71
90
|
resolvePlatformResponsesEndpoint
|
|
72
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-7KVZ5LDQ.js";
|
|
73
92
|
import {
|
|
74
93
|
clampReasoningEffort,
|
|
75
94
|
getModelConfig,
|
|
76
95
|
isModelSupportReasoningEffort
|
|
77
|
-
} from "./chunk-
|
|
78
|
-
import {
|
|
79
|
-
createFileCredentialBroker
|
|
80
|
-
} from "./chunk-HVURBGF3.js";
|
|
96
|
+
} from "./chunk-3BXNTXYI.js";
|
|
81
97
|
import {
|
|
82
98
|
toErrorMessage
|
|
83
99
|
} from "./chunk-HNMXYYJR.js";
|
|
84
|
-
import {
|
|
85
|
-
MEMORY_USE_GUIDANCE,
|
|
86
|
-
buildUserResponseLanguageContext,
|
|
87
|
-
wrapHistoricalSummaryWithReplayGuard
|
|
88
|
-
} from "./chunk-2GRGFCF6.js";
|
|
89
|
-
import {
|
|
90
|
-
canonicalizeToolNames
|
|
91
|
-
} from "./chunk-O6OSWFZQ.js";
|
|
92
100
|
import {
|
|
93
101
|
isDeepInfraKimiModel,
|
|
94
102
|
isFireworksKimiModel,
|
|
95
103
|
isPlatformMimoProviderModel,
|
|
96
104
|
resolveFireworksKimiModel
|
|
97
|
-
} from "./chunk-
|
|
98
|
-
import {
|
|
99
|
-
createSpaceKey
|
|
100
|
-
} from "./chunk-UAD2WT54.js";
|
|
101
|
-
import {
|
|
102
|
-
read
|
|
103
|
-
} from "./chunk-H62HCIUP.js";
|
|
105
|
+
} from "./chunk-Y3PMXGLH.js";
|
|
104
106
|
import {
|
|
105
107
|
asTrimmedLowercaseString
|
|
106
108
|
} from "./chunk-QSJ3HFEF.js";
|
|
107
|
-
import {
|
|
108
|
-
extractCustomId
|
|
109
|
-
} from "./chunk-M2EJHDJP.js";
|
|
110
109
|
import {
|
|
111
110
|
getRuntimeServerContext
|
|
112
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-O7SVKKLY.js";
|
|
113
112
|
import {
|
|
114
|
-
|
|
115
|
-
} from "./chunk-
|
|
113
|
+
extractCustomId
|
|
114
|
+
} from "./chunk-M2EJHDJP.js";
|
|
116
115
|
import {
|
|
117
116
|
isRecord
|
|
118
117
|
} from "./chunk-KUG52IAP.js";
|
|
118
|
+
import {
|
|
119
|
+
isAbortError
|
|
120
|
+
} from "./chunk-HIM3FCLF.js";
|
|
119
121
|
import {
|
|
120
122
|
asTrimmedString
|
|
121
123
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -648,6 +650,14 @@ ${contexts.userGlobalPrompt.trim()} ` : "";
|
|
|
648
650
|
const dialogSummarySection = contexts.dialogSummary?.trim() ? `--- \u5386\u53F2\u5BF9\u8BDD\u6458\u8981 ---
|
|
649
651
|
${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
|
|
650
652
|
return compileContextLayers([
|
|
653
|
+
// 删除安全红线:系统层最高优先级约束,位于所有层之前(含身份信息),
|
|
654
|
+
// owner 要求常驻「根本提示词」的最顶部(2026-09-26 批量误删事故)。
|
|
655
|
+
{
|
|
656
|
+
id: "delete-safety-red-line",
|
|
657
|
+
owner: "platform",
|
|
658
|
+
cacheScope: "static",
|
|
659
|
+
content: DELETE_SAFETY_RED_LINE
|
|
660
|
+
},
|
|
651
661
|
{ id: "identity", owner: "platform", cacheScope: "session", content: identitySection },
|
|
652
662
|
{ id: "user-response-language", owner: "platform", cacheScope: "session", content: buildUserResponseLanguageContext({ language: safeLanguage }) },
|
|
653
663
|
{ id: "startup-protocol", owner: "platform", cacheScope: "static", content: startupProtocol },
|
|
@@ -655,6 +665,7 @@ ${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
|
|
|
655
665
|
{ id: "tool-round-economy", owner: "platform", cacheScope: "session", content: toolSections.toolRoundEconomy },
|
|
656
666
|
{ id: "tool-use-guidance", owner: "platform", cacheScope: "session", content: toolSections.toolUseGuidance },
|
|
657
667
|
{ id: "privilege-escalation", owner: "platform", cacheScope: "session", content: toolSections.privilegeEscalation },
|
|
668
|
+
{ id: "shell-task-lifecycle", owner: "platform", cacheScope: "session", content: toolSections.shellTaskLifecycle },
|
|
658
669
|
{ id: "agent-orchestration", owner: "platform", cacheScope: "session", content: toolSections.agentOrchestration },
|
|
659
670
|
{ id: "agent-collaboration", owner: "platform", cacheScope: "session", content: toolSections.agentCollaboration },
|
|
660
671
|
{ id: "web-access", owner: "platform", cacheScope: "session", content: toolSections.webAccess },
|
|
@@ -776,8 +787,13 @@ var buildRequestBody = (options) => {
|
|
|
776
787
|
endpoint: customProviderUrl
|
|
777
788
|
});
|
|
778
789
|
Object.assign(bodyData, usageRequestOptions);
|
|
779
|
-
|
|
780
|
-
|
|
790
|
+
const effectiveProviderForReasoning = providerName?.toLowerCase() === "openrouter" || customProviderUrl?.toLowerCase().includes("openrouter.ai") ? "openrouter" : providerName;
|
|
791
|
+
if (reasoning_effort && isModelSupportReasoningEffort(model, effectiveProviderForReasoning)) {
|
|
792
|
+
const clamped = clampReasoningEffort(
|
|
793
|
+
reasoning_effort,
|
|
794
|
+
effectiveProviderForReasoning,
|
|
795
|
+
model
|
|
796
|
+
);
|
|
781
797
|
if (clamped) {
|
|
782
798
|
bodyData.reasoning_effort = clamped;
|
|
783
799
|
}
|
|
@@ -1208,7 +1224,7 @@ var buildProxyPayload = (bodyData, api, agentConfig, dialogId) => {
|
|
|
1208
1224
|
};
|
|
1209
1225
|
};
|
|
1210
1226
|
var fetchDirectly = async (params) => {
|
|
1211
|
-
const { api, agentConfig, bodyData, signal, currentServer, token } = params;
|
|
1227
|
+
const { api, agentConfig, bodyData, signal, currentServer, token, dialogId } = params;
|
|
1212
1228
|
try {
|
|
1213
1229
|
const apiKey = await resolveDirectRequestApiKey(agentConfig, {
|
|
1214
1230
|
syncFetcher: currentServer && token ? (ref) => fetchServerSyncedCredential({ currentServer, authToken: token }, ref) : void 0,
|
|
@@ -1228,7 +1244,8 @@ var fetchDirectly = async (params) => {
|
|
|
1228
1244
|
const authHeaders = buildProviderAuthHeaders({
|
|
1229
1245
|
endpoint: api,
|
|
1230
1246
|
apiKey: apiKey ?? "",
|
|
1231
|
-
apiKeyHeader: agentConfig.apiKeyHeader
|
|
1247
|
+
apiKeyHeader: agentConfig.apiKeyHeader,
|
|
1248
|
+
sessionId: dialogId || agentConfig.dbKey || agentConfig.key
|
|
1232
1249
|
});
|
|
1233
1250
|
return await fetch(api, {
|
|
1234
1251
|
method: "POST",
|
|
@@ -1794,12 +1811,17 @@ ${tableMd}
|
|
|
1794
1811
|
`;
|
|
1795
1812
|
};
|
|
1796
1813
|
var fetchSlateReference = async (dbKey, refContent, dispatch, options) => {
|
|
1797
|
-
|
|
1814
|
+
const hasSlate = Array.isArray(refContent?.slateData) && refContent.slateData.length > 0;
|
|
1815
|
+
const legacyContent = hasSlate ? null : resolvePageReadMarkdown(refContent).trim() || null;
|
|
1816
|
+
if (!hasSlate && !legacyContent) return null;
|
|
1798
1817
|
const title = refContent.title || `Untitled (${dbKey})`;
|
|
1799
1818
|
let contentString;
|
|
1800
1819
|
let contentType;
|
|
1801
1820
|
const inlineMentionMeta = options.inlineMentionMeta ?? options.format === "simplified_markdown";
|
|
1802
|
-
|
|
1821
|
+
if (legacyContent) {
|
|
1822
|
+
contentType = "Markdown (legacy content)";
|
|
1823
|
+
contentString = legacyContent;
|
|
1824
|
+
} else switch (options.format) {
|
|
1803
1825
|
case "text":
|
|
1804
1826
|
contentType = "Plain Text";
|
|
1805
1827
|
contentString = slateToText(refContent.slateData);
|
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
deleteDbRecord,
|
|
3
3
|
queryUserRecords,
|
|
4
4
|
readDbRecord
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AFSY3ZMB.js";
|
|
6
6
|
import {
|
|
7
7
|
mergeAndDedupUserData
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OXME3PEE.js";
|
|
9
9
|
import {
|
|
10
10
|
toErrorMessage
|
|
11
11
|
} from "./chunk-HNMXYYJR.js";
|
|
12
12
|
import {
|
|
13
13
|
isTombstoneRecord
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-D2MDMY2M.js";
|
|
15
15
|
|
|
16
16
|
// packages/cli/globalRecordOperations.ts
|
|
17
17
|
async function listUserRecordsFromServers(args) {
|
|
@@ -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-PJIT2YEJ.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,
|
|
@@ -7,18 +7,15 @@ import {
|
|
|
7
7
|
listUserRecordsFromServers,
|
|
8
8
|
readDbRecordFromServers,
|
|
9
9
|
readLiveDbRecordAfterTombstoneMerge
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QYUBY3OZ.js";
|
|
11
11
|
import {
|
|
12
|
-
fetchWithTransientRetry
|
|
13
|
-
|
|
12
|
+
fetchWithTransientRetry,
|
|
13
|
+
parsePositiveFiniteNumberOrFallback
|
|
14
|
+
} from "./chunk-AOTBKDRK.js";
|
|
14
15
|
import {
|
|
15
16
|
DRAIN_EXHAUSTED_USER_MESSAGE,
|
|
16
17
|
isDrainExhaustedResponse
|
|
17
18
|
} from "./chunk-3L2WKC3W.js";
|
|
18
|
-
import {
|
|
19
|
-
buildDialogAttachmentPlan,
|
|
20
|
-
extractFileContentIds
|
|
21
|
-
} from "./chunk-3BMYXEUW.js";
|
|
22
19
|
import {
|
|
23
20
|
isLevelLockError
|
|
24
21
|
} from "./chunk-URMS4XY2.js";
|
|
@@ -26,11 +23,18 @@ import {
|
|
|
26
23
|
resolveLocalDialogDbCandidates,
|
|
27
24
|
resolveServerDbPath
|
|
28
25
|
} from "./chunk-GLKOYSRU.js";
|
|
26
|
+
import {
|
|
27
|
+
buildDialogAttachmentPlan,
|
|
28
|
+
extractFileContentIds
|
|
29
|
+
} from "./chunk-R5AJODNI.js";
|
|
29
30
|
import {
|
|
30
31
|
boundSummaryText,
|
|
31
32
|
buildDialogReadEnvelope,
|
|
32
33
|
projectDialogReadForAgent
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-SJKULPGX.js";
|
|
35
|
+
import {
|
|
36
|
+
asRecordOrEmpty
|
|
37
|
+
} from "./chunk-KX6YBIHG.js";
|
|
34
38
|
import {
|
|
35
39
|
toErrorMessage
|
|
36
40
|
} from "./chunk-HNMXYYJR.js";
|
|
@@ -43,24 +47,18 @@ import {
|
|
|
43
47
|
resolveServerUrl
|
|
44
48
|
} from "./chunk-A7GB5UGH.js";
|
|
45
49
|
import {
|
|
46
|
-
|
|
47
|
-
} from "./chunk-
|
|
48
|
-
import {
|
|
49
|
-
asRecordOrEmpty
|
|
50
|
-
} from "./chunk-KX6YBIHG.js";
|
|
50
|
+
isRecord
|
|
51
|
+
} from "./chunk-KUG52IAP.js";
|
|
51
52
|
import {
|
|
52
53
|
asNonEmptyStringArray,
|
|
53
54
|
asTrimmedNonEmptyStringArray
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-OKGVNZTL.js";
|
|
55
56
|
import {
|
|
56
57
|
createClientLogger
|
|
57
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-HIM3FCLF.js";
|
|
58
59
|
import {
|
|
59
60
|
isLevelNotFoundError
|
|
60
61
|
} from "./chunk-OW765XBU.js";
|
|
61
|
-
import {
|
|
62
|
-
isRecord
|
|
63
|
-
} from "./chunk-KUG52IAP.js";
|
|
64
62
|
import {
|
|
65
63
|
asTrimmedString
|
|
66
64
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -725,7 +723,7 @@ function isExplicitDialogIdMismatch(meta, dialogId) {
|
|
|
725
723
|
return meta && typeof meta === "object" && "id" in meta && meta.id != null && String(meta.id) !== dialogId;
|
|
726
724
|
}
|
|
727
725
|
async function readDialogFromLocalDb(dialogKey, dialogId, limit, readLocalDialog) {
|
|
728
|
-
const reader = readLocalDialog ?? (await import("./localDialogRead-
|
|
726
|
+
const reader = readLocalDialog ?? (await import("./localDialogRead-UYCKO7YZ.js")).readDialogFromLocalDb;
|
|
729
727
|
const result = await reader({ dialogKey, dialogId, limit });
|
|
730
728
|
return {
|
|
731
729
|
...result,
|
|
@@ -742,7 +740,7 @@ async function readLocalDialogAtDbPathDefault(args) {
|
|
|
742
740
|
const [{ Level }, { safeJsonEncoding }, { fetchMessages }] = await Promise.all([
|
|
743
741
|
import("./levelLazyShim-GZBKODGI.js"),
|
|
744
742
|
import("./serverStoreFactory-YMXDF4NI.js"),
|
|
745
|
-
import("./fetchMessages-
|
|
743
|
+
import("./fetchMessages-3PXAHKCR.js")
|
|
746
744
|
]);
|
|
747
745
|
const db = new Level(args.dbPath, {
|
|
748
746
|
valueEncoding: safeJsonEncoding,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createFileCredentialBroker,
|
|
4
4
|
migrateAgentSecrets,
|
|
5
5
|
normalizeAgentRuntimeToolPolicy
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2U3NHADM.js";
|
|
7
7
|
import {
|
|
8
8
|
asRecordOrEmpty
|
|
9
9
|
} from "./chunk-KX6YBIHG.js";
|
|
@@ -11,16 +11,18 @@ import {
|
|
|
11
11
|
patch,
|
|
12
12
|
remove,
|
|
13
13
|
write
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4WMMIL66.js";
|
|
15
|
+
import {
|
|
16
|
+
getRuntimeServerContext
|
|
17
|
+
} from "./chunk-O7SVKKLY.js";
|
|
15
18
|
import {
|
|
16
19
|
createAgentKey,
|
|
17
20
|
toTrimmedString
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-OKGVNZTL.js";
|
|
19
22
|
import {
|
|
20
23
|
asyncThunkCreator,
|
|
21
|
-
buildCreateSlice
|
|
22
|
-
|
|
23
|
-
} from "./chunk-UKWGR5SS.js";
|
|
24
|
+
buildCreateSlice
|
|
25
|
+
} from "./chunk-VY6VFGKR.js";
|
|
24
26
|
import {
|
|
25
27
|
asTrimmedString
|
|
26
28
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -304,7 +306,7 @@ var slice = createSliceWithThunks({
|
|
|
304
306
|
const overrides = {};
|
|
305
307
|
if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
|
|
306
308
|
if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
|
|
307
|
-
const { _executeModel } = await import("./_executeModel-
|
|
309
|
+
const { _executeModel } = await import("./_executeModel-JXG5TLPE.js");
|
|
308
310
|
return _executeModel(
|
|
309
311
|
{
|
|
310
312
|
isStreaming: args.isStreaming ?? false,
|
|
@@ -325,7 +327,7 @@ var slice = createSliceWithThunks({
|
|
|
325
327
|
* - 循环直到无工具调用或触发其他运行时停止条件
|
|
326
328
|
*/
|
|
327
329
|
runAgent: create.asyncThunk(async (args, thunkApi) => {
|
|
328
|
-
const { runAgentClientLoop } = await import("./runAgentClientLoop-
|
|
330
|
+
const { runAgentClientLoop } = await import("./runAgentClientLoop-H2JALUVD.js");
|
|
329
331
|
const { content: loopContent, toolCallCount } = await runAgentClientLoop(
|
|
330
332
|
{
|
|
331
333
|
agentKey: args.agentKey,
|
|
@@ -341,7 +343,7 @@ var slice = createSliceWithThunks({
|
|
|
341
343
|
* 聊天轮次流式 Agent 调用
|
|
342
344
|
*/
|
|
343
345
|
streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
|
|
344
|
-
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-
|
|
346
|
+
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-FFJWW3FD.js");
|
|
345
347
|
return streamAgentChatTurnHandler(args, thunkApi);
|
|
346
348
|
}),
|
|
347
349
|
/**
|