nolo-cli 0.96.0-alpha.1 → 0.96.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-AUQRMRWL.js → _executeModel-GWF37P7J.js} +68 -63
- package/{action-YVYQEAAV.js → action-GI44T4DR.js} +10 -10
- package/{addContentAction-O7R66HEX.js → addContentAction-B2DRF7P6.js} +9 -9
- package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-T3I7IXPK.js} +15 -17
- package/{agentDeleteCommand-4BAHJRU3.js → agentDeleteCommand-5SHJMUF7.js} +47 -43
- package/{agentEmailCommands-QISOY7Y6.js → agentEmailCommands-YC7RFNYN.js} +90 -82
- package/{agentListCommands-U46ODMQU.js → agentListCommands-O4DSVOHQ.js} +78 -82
- package/{agentMachineCommands-EHV2KM2C.js → agentMachineCommands-ZSQCK3SA.js} +42 -38
- package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-EMZCM6VA.js} +1 -1
- package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-HF4A42D4.js} +1 -1
- package/agentRecordCommands-MUG5QMN7.js +136 -0
- package/{agentRunCommand-K4CLMA6B.js → agentRunCommand-5EBSIN74.js} +90 -80
- package/{agentRunControl-XLGD3UZ5.js → agentRunControl-5T64LM2M.js} +2 -2
- package/{agentRuntimeLocal-O4HPUJA4.js → agentRuntimeLocal-KTWDCVYZ.js} +44 -36
- package/{agentSlice-ZYT2OUR3.js → agentSlice-QA6WAKNE.js} +11 -11
- package/{appDeleteCommands-R5BBTKQK.js → appDeleteCommands-JPPKN55V.js} +42 -38
- package/{appDeployCommands-ZJIXOJWD.js → appDeployCommands-QU5PW23S.js} +42 -38
- package/{appDeployStatusCommands-B3R2ZTBF.js → appDeployStatusCommands-QVAJTRSP.js} +42 -38
- package/{appGetCommands-2AQSOV2A.js → appGetCommands-LT3KDTHJ.js} +42 -38
- package/{appListCommands-HCIJGZFY.js → appListCommands-V37HIWKN.js} +42 -38
- package/{authCommand-F4EFRRX6.js → authCommand-2YPMMIJN.js} +117 -23
- package/{authCommands-RGOGCPP6.js → authCommands-FFDS4FVX.js} +7 -5
- package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-CALVIJTX.js} +6 -5
- package/{chatQueueReduxAdapter-Q5V4YJVI.js → chatQueueReduxAdapter-YYIRKWPD.js} +30 -29
- 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-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
- package/{chunk-BLJWCTRL.js → chunk-45LEXXBA.js} +1 -1
- package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
- package/chunk-4LCOCOR5.js +50 -0
- package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
- package/{chunk-LLT642J4.js → chunk-4W65H3KF.js} +24 -5
- package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
- package/chunk-5G7QSEFG.js +13349 -0
- 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-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
- package/{chunk-3BMYXEUW.js → chunk-6O4IK4V2.js} +1 -1
- package/{chunk-WADCY6G6.js → chunk-6ZWMH6TJ.js} +111 -41
- package/{chunk-ABQYVJBJ.js → chunk-7CHC4W22.js} +1 -1
- package/{chunk-YQTQQX2H.js → chunk-7IJ3GSRH.js} +1 -1
- package/{chunk-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
- package/{chunk-OA6Q2A4I.js → chunk-A7RSPKU6.js} +98 -22
- package/chunk-ALY3N3HU.js +7600 -0
- package/{chunk-Q554LLSI.js → chunk-AUDNYVRC.js} +1 -1
- package/{chunk-GPCZ7UXG.js → chunk-AZRHIN5B.js} +1 -1
- package/chunk-BMQ2MJUK.js +153 -0
- package/{chunk-3IIEFNGY.js → chunk-C53ZG23R.js} +2 -2
- package/chunk-CHOZJMJS.js +78 -0
- package/{chunk-HJUYAD4A.js → chunk-CPUFH46E.js} +8 -8
- package/{chunk-LS2ZANRJ.js → chunk-CTUQJVQM.js} +1 -1
- package/{chunk-BP4XNZRM.js → chunk-CU3QB4HW.js} +3 -3
- package/{chunk-ACTMNVHM.js → chunk-CYSYR67N.js} +1 -1
- package/{chunk-KQ4ONNQD.js → chunk-DAWDCRIG.js} +82 -8
- package/{chunk-VLTIYV3X.js → chunk-DCLMZ5TX.js} +4 -4
- package/{chunk-UKZDAFYT.js → chunk-DSSTTEKI.js} +6 -10
- package/{chunk-HVURBGF3.js → chunk-ESRMFY7G.js} +2 -2
- package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
- package/{chunk-ZLR5JN3E.js → chunk-FKBRWL4E.js} +7 -7
- package/{chunk-XOVEWFLK.js → chunk-G3BCMDJB.js} +100 -100
- 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-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
- package/{chunk-IAO6JBYW.js → chunk-HP2HV7RZ.js} +171 -14
- package/{chunk-H62HCIUP.js → chunk-HYZIYH2H.js} +11 -10
- package/{chunk-NTW5GWDM.js → chunk-I3QNET24.js} +32 -17
- package/{chunk-WV42OMV7.js → chunk-IAESIMK7.js} +4 -4
- package/{chunk-JRQFUXY7.js → chunk-KCDUTE5V.js} +96 -19
- package/{chunk-XRWZB6CF.js → chunk-KLTTJFH2.js} +23 -76
- package/{chunk-IIVGDG4I.js → chunk-LNPYTNMG.js} +8 -4
- package/{chunk-AFDS2CVM.js → chunk-MDMTFGJ2.js} +15 -20
- package/{chunk-4MY4GLIW.js → chunk-MN3RHOFX.js} +969 -1090
- package/{chunk-7S4YWN7P.js → chunk-MX574M24.js} +1 -1
- package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
- package/{chunk-53HEEOTT.js → chunk-O26PCYLS.js} +80 -13
- package/{chunk-3DII57IT.js → chunk-O2OWEFII.js} +1 -1
- package/chunk-OCZKATRC.js +129 -0
- package/{chunk-6D6VBVEW.js → chunk-OTEMQQZI.js} +80 -14
- package/chunk-P6GMCCAT.js +870 -0
- package/{chunk-CPH3W5A7.js → chunk-Q4GP72HX.js} +94 -3
- package/{chunk-DHDMC6FO.js → chunk-QKUMVP3O.js} +11 -6
- package/{chunk-76WEAXJB.js → chunk-QXWGM7NK.js} +18 -15
- package/{chunk-JOHSKZQX.js → chunk-R2TEASHZ.js} +865 -207
- package/{chunk-Z77CRGTW.js → chunk-R4SQ3LGW.js} +1 -1
- package/{chunk-V4MJDUSR.js → chunk-RSEEDUMS.js} +2 -2
- package/{chunk-UZGQNTVW.js → chunk-S5XGT6GB.js} +5 -3
- package/{chunk-QIAVMDHY.js → chunk-SDAPKV2N.js} +4 -4
- package/{chunk-SNPMM7H3.js → chunk-SN2U5EE7.js} +13 -13
- package/{chunk-AFUORTY4.js → chunk-SONWNI3L.js} +21 -21
- package/{chunk-A6G32FNX.js → chunk-SYAMDUAL.js} +13 -13
- package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
- package/{chunk-OF7AQZUG.js → chunk-TU5NE4U3.js} +9 -84
- package/{chunk-EGSKXKR5.js → chunk-TWROMK2A.js} +1 -1
- package/chunk-TY3TIUJK.js +89 -0
- package/chunk-UNYJU5L6.js +780 -0
- package/{chunk-J4MOO56S.js → chunk-UQNS32WZ.js} +10 -2
- package/chunk-VIWDGTDA.js +8 -0
- package/chunk-VJVNU77E.js +83 -0
- package/{chunk-MMPXJXHT.js → chunk-VKEMMN62.js} +584 -480
- package/{chunk-ZXKVPF4K.js → chunk-W5HY3V6I.js} +236 -36
- package/{chunk-JAXOVNM4.js → chunk-WILHZY7K.js} +45 -45
- package/{chunk-UKWGR5SS.js → chunk-WIWM4FE3.js} +187 -398
- package/{chunk-BGSLKVCP.js → chunk-XAAUXO27.js} +6 -7
- package/{chunk-O6OSWFZQ.js → chunk-XUWRURDF.js} +6 -0
- package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
- package/{chunk-SH43IESU.js → chunk-YUNJN43V.js} +44 -9
- package/{chunk-BZWBEHGD.js → chunk-YYMTXN25.js} +66 -38
- package/{chunk-TOP2VXOR.js → chunk-Z4CSIXYP.js} +2 -2
- package/{chunk-DEUUPHOO.js → chunk-ZGESTNDD.js} +77 -17
- package/{chunk-2F7RJC6L.js → chunk-ZOVKKMF6.js} +1 -1
- package/chunk-ZRAU6T47.js +56 -0
- package/commandRegistry-JPJBZMSB.js +833 -0
- package/{contentThunks-PT23JWJX.js → contentThunks-S5S6Y7FH.js} +32 -30
- package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
- package/{createAgentAutomationAction-N27SYTLU.js → createAgentAutomationAction-E3V23HF4.js} +32 -30
- package/{createDialogAction-XZPLHD5G.js → createDialogAction-PS2N7OCP.js} +36 -33
- package/{createPageAction-KHVJQ3CS.js → createPageAction-6XUY3KXJ.js} +38 -36
- package/{chunk-3SJQXXGY.js → cursorProvider-YGGNMVWX.js} +2560 -9879
- package/{dbSlice-XVWBAGYN.js → dbSlice-DQ32LYTJ.js} +8 -8
- package/{deleteFile-YG6QMJLU.js → deleteFile-NX6QHCWZ.js} +3 -3
- package/{dialogCommands-ZUWW5UT6.js → dialogCommands-3YXLYO2W.js} +45 -41
- package/{dialogSlice-3YH242HS.js → dialogSlice-NTZ5GT5B.js} +36 -29
- package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
- package/{docCreateCommands-Q6FADDSJ.js → docCreateCommands-4JSMQDST.js} +44 -40
- package/{docDeleteCommands-ZKIH54PZ.js → docDeleteCommands-3KTE3KP6.js} +44 -40
- package/{docReadCommands-7BZT2QTW.js → docReadCommands-54BL4OYN.js} +43 -39
- package/{docStore-YSZRNUUD.js → docStore-QE6H3LDC.js} +11 -10
- package/{docUpdateCommands-WJXWTRL7.js → docUpdateCommands-BMBPTW5U.js} +44 -40
- package/{fetchMessages-EIU7UFFK.js → fetchMessages-67MEFPZR.js} +2 -2
- package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +3 -3
- package/{handleSendMessageAction-KJO2QDBM.js → handleSendMessageAction-34BJIBML.js} +91 -83
- package/index.js +87 -884
- package/{localDialogRead-BTFJ4V2I.js → localDialogRead-EBRS242U.js} +2 -2
- package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-5W6IJRAD.js} +6 -6
- package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-3LRMNLCM.js} +1 -1
- package/{machineCommands-QC4TD7GJ.js → machineCommands-KBMEZDL3.js} +85 -77
- package/{machineWsRunDispatch-XUOIAXO7.js → machineWsRunDispatch-FRANXJZJ.js} +82 -74
- package/{memberThunks-QGFLFVCI.js → memberThunks-5ZXPR63F.js} +9 -9
- 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-76AVU3HD.js} +7 -7
- package/{providerRegistry-757OWH3O.js → providerRegistry-Z62NC45X.js} +11 -7
- package/{read-COE3ZYR6.js → read-EPTJRAEF.js} +5 -5
- package/{readDocTool-5USN4A6V.js → readDocTool-W4NDXNEX.js} +5 -3
- package/{readlineWorkspace-74TXXSLO.js → readlineWorkspace-P7WDR4NG.js} +2450 -2022
- package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-BVAWQKXE.js} +17 -19
- package/{runAgentClientLoop-37BXJD62.js → runAgentClientLoop-5OQN64SG.js} +62 -58
- package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-3USD722U.js} +3 -3
- package/runtimeModeArgs-2Y7BALTO.js +31 -0
- package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-LYY45IAD.js} +12 -11
- package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-73IL7DLU.js} +18 -20
- package/{settingSlice-ZQZVUPKK.js → settingSlice-Q6EKL7EQ.js} +9 -9
- package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
- package/{spaceCommands-P3ONT6LL.js → spaceCommands-W7B34E7K.js} +44 -40
- package/{streamAgentChatTurn-FGXQXALU.js → streamAgentChatTurn-7AX7XVHL.js} +184 -91
- package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-UUXDSQ6X.js} +15 -17
- package/{tableCommands-O6NWHFKV.js → tableCommands-G7RV3RU3.js} +4 -4
- package/{toolApiClient-QVJ6HDNN.js → toolApiClient-INIQCPGY.js} +3 -3
- package/{tools-R5UF2KZO.js → tools-357446VN.js} +55 -51
- package/{tuiSummaryLlmCaller-T2SHYMDZ.js → tuiSummaryLlmCaller-74NRRLVW.js} +18 -16
- package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
- package/{updateDialogTitleAction-RTADGV7A.js → updateDialogTitleAction-A2OK52IY.js} +81 -43
- package/agentRecordCommands-SIPURU2S.js +0 -128
- package/chunk-FOWEGIMF.js +0 -18881
- package/chunk-M76ECQRD.js +0 -13658
- package/chunk-Q5FJJ6XI.js +0 -103
- package/chunk-S7Z2HMCN.js +0 -25
- 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,6 +1,6 @@
|
|
|
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";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
patch,
|
|
12
12
|
readAndWait
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HYZIYH2H.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,
|
|
@@ -309,7 +308,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
309
308
|
const skillSummary = buildSkillSummaryMarker(meta);
|
|
310
309
|
const content = slateToRenderMarkdown(slateData);
|
|
311
310
|
const now = /* @__PURE__ */ new Date();
|
|
312
|
-
const updatedAt =
|
|
311
|
+
const updatedAt = formatISO(now);
|
|
313
312
|
await dispatch(
|
|
314
313
|
patch({
|
|
315
314
|
dbKey: pageKey,
|
|
@@ -326,7 +325,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
326
325
|
).unwrap();
|
|
327
326
|
if (dbSpaceId) {
|
|
328
327
|
try {
|
|
329
|
-
const { updateContentTitle } = await import("./contentThunks-
|
|
328
|
+
const { updateContentTitle } = await import("./contentThunks-S5S6Y7FH.js");
|
|
330
329
|
await dispatch(
|
|
331
330
|
updateContentTitle({
|
|
332
331
|
spaceId: dbSpaceId,
|
|
@@ -365,7 +364,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
365
364
|
}
|
|
366
365
|
}
|
|
367
366
|
async function createDocState(args, thunkApi) {
|
|
368
|
-
const { createPageAction } = await import("./createPageAction-
|
|
367
|
+
const { createPageAction } = await import("./createPageAction-6XUY3KXJ.js");
|
|
369
368
|
return createPageAction(args, thunkApi);
|
|
370
369
|
}
|
|
371
370
|
function subscribe(listener) {
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CHROME_CONNECTOR_LEGACY_TOOL_ALIASES
|
|
3
|
+
} from "./chunk-5J3PYNUP.js";
|
|
4
|
+
|
|
1
5
|
// packages/agent-runtime/toolNameAliases.ts
|
|
2
6
|
var LEGACY_TOOL_NAME_ALIASES = {
|
|
7
|
+
// Nolo Browser Connector: legacy chrome_* → canonical browser_*
|
|
8
|
+
...CHROME_CONNECTOR_LEGACY_TOOL_ALIASES,
|
|
3
9
|
createPage: "createDoc",
|
|
4
10
|
updatePage: "updateDoc",
|
|
5
11
|
update_page: "updateDoc",
|
|
@@ -11,6 +11,7 @@ var PLATFORM_HOSTED_KIMI_K3_MODEL = "kimi-k3";
|
|
|
11
11
|
var PLATFORM_HOSTED_KIMI_K26_MODEL = "kimi-k2.6";
|
|
12
12
|
var PLATFORM_HOSTED_KIMI_PROVIDER = "nolo";
|
|
13
13
|
var LEGACY_OLLAMA_CLOUD_PROVIDER = "ollama-cloud";
|
|
14
|
+
var PLATFORM_LLM_BUSY_USER_MESSAGE = "\u670D\u52A1\u5668\u7D27\u5F20";
|
|
14
15
|
var isNoloHostedProvider = (provider) => {
|
|
15
16
|
const normalized = asTrimmedLowercaseString(provider);
|
|
16
17
|
return normalized === PLATFORM_HOSTED_KIMI_PROVIDER || normalized === LEGACY_OLLAMA_CLOUD_PROVIDER;
|
|
@@ -1200,6 +1201,7 @@ export {
|
|
|
1200
1201
|
openrouterModels,
|
|
1201
1202
|
PLATFORM_HOSTED_KIMI_K3_MODEL,
|
|
1202
1203
|
PLATFORM_HOSTED_KIMI_PROVIDER,
|
|
1204
|
+
PLATFORM_LLM_BUSY_USER_MESSAGE,
|
|
1203
1205
|
isNoloHostedProvider,
|
|
1204
1206
|
isFireworksKimiModel,
|
|
1205
1207
|
isDeepInfraKimiModel,
|
|
@@ -136,6 +136,11 @@ function logUploadAudit(entry, logFn = console.warn) {
|
|
|
136
136
|
|
|
137
137
|
// packages/desktop-chrome-connector/chromeConnector.ts
|
|
138
138
|
var NOLO_CHROME_CONNECTOR_EXTENSION_ID = "ahpdoopadkamnglhlacfjdfnonpjdplg";
|
|
139
|
+
var NOLO_FIREFOX_CONNECTOR_EXTENSION_ID = "nolo-browser-connector@nolo.chat";
|
|
140
|
+
var NOLO_CONNECTOR_EXTENSION_IDS = [
|
|
141
|
+
NOLO_CHROME_CONNECTOR_EXTENSION_ID,
|
|
142
|
+
NOLO_FIREFOX_CONNECTOR_EXTENSION_ID
|
|
143
|
+
];
|
|
139
144
|
var NOLO_CHROME_CONNECTOR_PROTOCOL_VERSION = "2";
|
|
140
145
|
function defaultTokenPath() {
|
|
141
146
|
return resolve2(
|
|
@@ -149,6 +154,18 @@ function readConnectorToken(tokenPath = defaultTokenPath()) {
|
|
|
149
154
|
return readFileSync(tokenPath, "utf8").trim();
|
|
150
155
|
}
|
|
151
156
|
var CHROME_TOOL_ACTIONS = {
|
|
157
|
+
browser_list_tabs: "list_tabs",
|
|
158
|
+
browser_open_tab: "open_tab",
|
|
159
|
+
browser_close_tab: "close_tab",
|
|
160
|
+
browser_read_page: "read_page",
|
|
161
|
+
browser_click_element: "click",
|
|
162
|
+
browser_type: "type",
|
|
163
|
+
browser_press: "press",
|
|
164
|
+
browser_scroll: "scroll",
|
|
165
|
+
browser_screenshot: "screenshot",
|
|
166
|
+
browser_read_console: "read_console",
|
|
167
|
+
browser_read_network: "read_network",
|
|
168
|
+
// Legacy aliases (kept for existing agents/tests).
|
|
152
169
|
chrome_list_tabs: "list_tabs",
|
|
153
170
|
chrome_open_tab: "open_tab",
|
|
154
171
|
chrome_close_tab: "close_tab",
|
|
@@ -164,6 +181,12 @@ var CHROME_TOOL_ACTIONS = {
|
|
|
164
181
|
chrome_upload_file: "set_files",
|
|
165
182
|
chrome_upload: "set_files"
|
|
166
183
|
};
|
|
184
|
+
for (const legacyName of ["chrome_set_files", "chrome_upload_file", "chrome_upload"]) {
|
|
185
|
+
const action = CHROME_TOOL_ACTIONS[legacyName];
|
|
186
|
+
if (action) {
|
|
187
|
+
CHROME_TOOL_ACTIONS[`browser_${legacyName.slice("chrome_".length)}`] = action;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
167
190
|
function createConnectorError(code, message, details) {
|
|
168
191
|
const error = new Error(message);
|
|
169
192
|
error.code = code;
|
|
@@ -183,9 +206,13 @@ function parseArguments(raw) {
|
|
|
183
206
|
}
|
|
184
207
|
}
|
|
185
208
|
function errorPayload(error) {
|
|
209
|
+
const code = error?.code ?? "CHROME_CONNECTOR_ERROR";
|
|
186
210
|
return {
|
|
187
|
-
code
|
|
211
|
+
code,
|
|
188
212
|
message: toErrorMessage(error),
|
|
213
|
+
...code === "CHROME_CONNECTOR_UNAVAILABLE" ? {
|
|
214
|
+
hint: "The Nolo Browser Connector is not reachable. It runs inside the user's own Chrome or Firefox \u2014 ask the user to open their browser with the Nolo Browser Connector extension enabled, or install it from https://nolo.chat/downloads (Firefox can install the signed .xpi directly), then retry."
|
|
215
|
+
} : {},
|
|
189
216
|
...error?.details !== void 0 ? { details: error.details } : {}
|
|
190
217
|
};
|
|
191
218
|
}
|
|
@@ -198,7 +225,7 @@ function validateChromeConnectorPayload(action, payload) {
|
|
|
198
225
|
if (!tabId) {
|
|
199
226
|
throw createConnectorError(
|
|
200
227
|
"TAB_ID_REQUIRED",
|
|
201
|
-
`Provide the tabId from
|
|
228
|
+
`Provide the tabId from browser_list_tabs before calling ${action}.`
|
|
202
229
|
);
|
|
203
230
|
}
|
|
204
231
|
if (!TARGET_REQUIRED_ACTIONS.has(action)) return;
|
|
@@ -210,7 +237,7 @@ function validateChromeConnectorPayload(action, payload) {
|
|
|
210
237
|
if (!elementRef && !selector) {
|
|
211
238
|
throw createConnectorError(
|
|
212
239
|
"ELEMENT_TARGET_REQUIRED",
|
|
213
|
-
"Provide elementRef from
|
|
240
|
+
"Provide elementRef from browser_read_page or a CSS selector."
|
|
214
241
|
);
|
|
215
242
|
}
|
|
216
243
|
if (action === "set_files") {
|
|
@@ -285,7 +312,10 @@ var REQUIRED_CHROME_CONNECTOR_FEATURES = {
|
|
|
285
312
|
type: ["compact_observation_v2", "action_gate"],
|
|
286
313
|
press: ["compact_observation_v2", "action_gate"],
|
|
287
314
|
scroll: ["compact_observation_v2"],
|
|
288
|
-
screenshot:
|
|
315
|
+
// Both browsers advertise the dedicated `screenshot` feature: Chrome serves it through
|
|
316
|
+
// Page.captureScreenshot (browser_debug-adjacent) while Firefox falls back to
|
|
317
|
+
// tabs.captureVisibleTab, so gating on browser_debug would wrongly refuse Firefox.
|
|
318
|
+
screenshot: ["screenshot"],
|
|
289
319
|
read_console: ["browser_debug"],
|
|
290
320
|
read_network: ["browser_debug"],
|
|
291
321
|
detach: ["browser_debug"],
|
|
@@ -296,17 +326,20 @@ function requiredFeaturesForConnectorAction(action) {
|
|
|
296
326
|
}
|
|
297
327
|
function createVerifiedChromeConnectorClient(args) {
|
|
298
328
|
const client = args?.client ?? createChromeConnectorClient();
|
|
299
|
-
const
|
|
329
|
+
const expectedExtensionIds = new Set(
|
|
330
|
+
args?.expectedExtensionIds ?? (args?.expectedExtensionId ? [args.expectedExtensionId] : NOLO_CONNECTOR_EXTENSION_IDS)
|
|
331
|
+
);
|
|
300
332
|
let verified = null;
|
|
301
333
|
let negotiatedFeatures = [];
|
|
302
334
|
const verify = async () => {
|
|
303
335
|
const connectorInfo = await client.request("connector_info", {});
|
|
304
336
|
const receivedExtensionId = connectorInfo?.extensionId;
|
|
305
|
-
if (receivedExtensionId !==
|
|
337
|
+
if (typeof receivedExtensionId !== "string" || !expectedExtensionIds.has(receivedExtensionId)) {
|
|
338
|
+
const expectedList = [...expectedExtensionIds].join(", ");
|
|
306
339
|
throw createConnectorError(
|
|
307
340
|
"CHROME_CONNECTOR_EXTENSION_MISMATCH",
|
|
308
|
-
`Chrome connector extension id mismatch: expected ${
|
|
309
|
-
{
|
|
341
|
+
`Chrome connector extension id mismatch: expected one of ${expectedList}, received ${typeof receivedExtensionId === "string" ? receivedExtensionId : "unknown"}.`,
|
|
342
|
+
{ expectedExtensionIds: [...expectedExtensionIds], receivedExtensionId }
|
|
310
343
|
);
|
|
311
344
|
}
|
|
312
345
|
const receivedProtocolVersion = connectorInfo?.protocolVersion;
|
|
@@ -366,7 +399,7 @@ async function executeChromeConnectorTool(args) {
|
|
|
366
399
|
};
|
|
367
400
|
}
|
|
368
401
|
try {
|
|
369
|
-
const payload = parseArguments(args.call.arguments);
|
|
402
|
+
const { target: _ignoredTarget, ...payload } = parseArguments(args.call.arguments);
|
|
370
403
|
validateChromeConnectorPayload(action, payload);
|
|
371
404
|
const result = await (args.client ?? createChromeConnectorClient()).request(action, payload);
|
|
372
405
|
return {
|
|
@@ -392,6 +425,8 @@ var CHROME_CONNECTOR_TOOL_ACTIONS = { ...CHROME_TOOL_ACTIONS };
|
|
|
392
425
|
|
|
393
426
|
export {
|
|
394
427
|
NOLO_CHROME_CONNECTOR_EXTENSION_ID,
|
|
428
|
+
NOLO_FIREFOX_CONNECTOR_EXTENSION_ID,
|
|
429
|
+
NOLO_CONNECTOR_EXTENSION_IDS,
|
|
395
430
|
NOLO_CHROME_CONNECTOR_PROTOCOL_VERSION,
|
|
396
431
|
createChromeConnectorClient,
|
|
397
432
|
REQUIRED_CHROME_CONNECTOR_FEATURES,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
clipMultilineText,
|
|
9
9
|
fetchAndSerializeTable
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VKEMMN62.js";
|
|
11
11
|
import {
|
|
12
12
|
isGatewayHttpStatus
|
|
13
13
|
} from "./chunk-NF64D32W.js";
|
|
@@ -17,37 +17,40 @@ import {
|
|
|
17
17
|
normalizeNonNegativeMs,
|
|
18
18
|
parseRetryAfterHeaderMs
|
|
19
19
|
} from "./chunk-3L2WKC3W.js";
|
|
20
|
-
import {
|
|
21
|
-
slateToSimplifiedMarkdown
|
|
22
|
-
} from "./chunk-J4MOO56S.js";
|
|
23
20
|
import {
|
|
24
21
|
waitForAbortableDelay
|
|
25
22
|
} from "./chunk-N4G4PKQ6.js";
|
|
23
|
+
import {
|
|
24
|
+
resolvePageReadMarkdown,
|
|
25
|
+
slateToSimplifiedMarkdown
|
|
26
|
+
} from "./chunk-UQNS32WZ.js";
|
|
26
27
|
import {
|
|
27
28
|
extractCategorizedMentions
|
|
28
29
|
} from "./chunk-MEYIRKDN.js";
|
|
29
30
|
import {
|
|
30
31
|
fetchAndCacheMessages
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-5G7QSEFG.js";
|
|
32
33
|
import {
|
|
33
34
|
shouldUseServerProxy
|
|
34
35
|
} from "./chunk-YYLHWIW6.js";
|
|
35
36
|
import {
|
|
36
37
|
fetchServerSyncedCredential
|
|
37
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-FKBRWL4E.js";
|
|
38
39
|
import {
|
|
39
40
|
buildSkillGuidancePromptBlock,
|
|
40
41
|
extractRuntimePageCapabilities,
|
|
41
42
|
resolveBuiltinSkillPage,
|
|
42
43
|
resolveSkillGraphFromRoots
|
|
43
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-KCDUTE5V.js";
|
|
44
45
|
import {
|
|
46
|
+
DELETE_SAFETY_RED_LINE,
|
|
45
47
|
buildIdentityBlock,
|
|
46
48
|
buildRuntimeGuidanceBlocks,
|
|
47
49
|
compileContextLayers,
|
|
50
|
+
detectDispatchIntentFromMessages,
|
|
48
51
|
normalizeChatCompletionsBodyForProvider,
|
|
49
52
|
resolveToolGuidedSections
|
|
50
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-A7RSPKU6.js";
|
|
51
54
|
import {
|
|
52
55
|
convertMessagesToResponsesInput,
|
|
53
56
|
getUsageRequestOptions,
|
|
@@ -57,64 +60,64 @@ import {
|
|
|
57
60
|
import {
|
|
58
61
|
ANTIGRAVITY_CLOUD_CODE_BASE_URL,
|
|
59
62
|
isAntigravityOAuthAgent
|
|
60
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-S5XGT6GB.js";
|
|
61
64
|
import {
|
|
62
65
|
buildProviderAuthHeaders
|
|
63
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-27ONFIEY.js";
|
|
64
67
|
import {
|
|
65
68
|
estimateTokenCount
|
|
66
69
|
} from "./chunk-PSCNXBYA.js";
|
|
70
|
+
import {
|
|
71
|
+
createFileCredentialBroker
|
|
72
|
+
} from "./chunk-ESRMFY7G.js";
|
|
67
73
|
import {
|
|
68
74
|
isOpenAiResponsesModel,
|
|
69
75
|
resolvePlatformChatCompletionsEndpoint,
|
|
70
76
|
resolvePlatformResponsesEndpoint
|
|
71
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-7KVZ5LDQ.js";
|
|
78
|
+
import {
|
|
79
|
+
toErrorMessage
|
|
80
|
+
} from "./chunk-HNMXYYJR.js";
|
|
72
81
|
import {
|
|
73
82
|
clampReasoningEffort,
|
|
74
83
|
getModelConfig,
|
|
75
84
|
isModelSupportReasoningEffort
|
|
76
|
-
} from "./chunk-
|
|
77
|
-
import {
|
|
78
|
-
createFileCredentialBroker
|
|
79
|
-
} from "./chunk-HVURBGF3.js";
|
|
85
|
+
} from "./chunk-3BXNTXYI.js";
|
|
80
86
|
import {
|
|
81
|
-
|
|
82
|
-
} from "./chunk-
|
|
87
|
+
createSpaceKey
|
|
88
|
+
} from "./chunk-UAD2WT54.js";
|
|
83
89
|
import {
|
|
84
90
|
MEMORY_USE_GUIDANCE,
|
|
85
91
|
buildUserResponseLanguageContext,
|
|
86
92
|
wrapHistoricalSummaryWithReplayGuard
|
|
87
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-4VJAC32I.js";
|
|
88
94
|
import {
|
|
89
95
|
canonicalizeToolNames
|
|
90
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-XUWRURDF.js";
|
|
91
97
|
import {
|
|
92
98
|
isDeepInfraKimiModel,
|
|
93
99
|
isFireworksKimiModel,
|
|
94
100
|
isPlatformMimoProviderModel,
|
|
95
101
|
resolveFireworksKimiModel
|
|
96
|
-
} from "./chunk-
|
|
97
|
-
import {
|
|
98
|
-
createSpaceKey
|
|
99
|
-
} from "./chunk-UAD2WT54.js";
|
|
102
|
+
} from "./chunk-Y3PMXGLH.js";
|
|
100
103
|
import {
|
|
101
104
|
read
|
|
102
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-HYZIYH2H.js";
|
|
103
106
|
import {
|
|
104
107
|
asTrimmedLowercaseString
|
|
105
108
|
} from "./chunk-QSJ3HFEF.js";
|
|
106
|
-
import {
|
|
107
|
-
extractCustomId
|
|
108
|
-
} from "./chunk-M2EJHDJP.js";
|
|
109
109
|
import {
|
|
110
110
|
getRuntimeServerContext
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-WIWM4FE3.js";
|
|
112
112
|
import {
|
|
113
113
|
isAbortError
|
|
114
114
|
} from "./chunk-QOKAKDPE.js";
|
|
115
115
|
import {
|
|
116
116
|
isRecord
|
|
117
117
|
} from "./chunk-KUG52IAP.js";
|
|
118
|
+
import {
|
|
119
|
+
extractCustomId
|
|
120
|
+
} from "./chunk-M2EJHDJP.js";
|
|
118
121
|
import {
|
|
119
122
|
asTrimmedString
|
|
120
123
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -619,7 +622,9 @@ var buildSystemPromptContext = (options) => {
|
|
|
619
622
|
${mainPrompt}` : "";
|
|
620
623
|
const agentTools = canonicalizeToolNames(agentConfig.tools ?? []);
|
|
621
624
|
const hasAskTool = agentTools.includes("ask_user");
|
|
622
|
-
const toolSections = resolveToolGuidedSections(agentTools
|
|
625
|
+
const toolSections = resolveToolGuidedSections(agentTools, {
|
|
626
|
+
dispatchIntent: options.dispatchIntent === true
|
|
627
|
+
});
|
|
623
628
|
const {
|
|
624
629
|
startupProtocol,
|
|
625
630
|
contextLayerContract,
|
|
@@ -645,6 +650,14 @@ ${contexts.userGlobalPrompt.trim()} ` : "";
|
|
|
645
650
|
const dialogSummarySection = contexts.dialogSummary?.trim() ? `--- \u5386\u53F2\u5BF9\u8BDD\u6458\u8981 ---
|
|
646
651
|
${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
|
|
647
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
|
+
},
|
|
648
661
|
{ id: "identity", owner: "platform", cacheScope: "session", content: identitySection },
|
|
649
662
|
{ id: "user-response-language", owner: "platform", cacheScope: "session", content: buildUserResponseLanguageContext({ language: safeLanguage }) },
|
|
650
663
|
{ id: "startup-protocol", owner: "platform", cacheScope: "static", content: startupProtocol },
|
|
@@ -652,6 +665,7 @@ ${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
|
|
|
652
665
|
{ id: "tool-round-economy", owner: "platform", cacheScope: "session", content: toolSections.toolRoundEconomy },
|
|
653
666
|
{ id: "tool-use-guidance", owner: "platform", cacheScope: "session", content: toolSections.toolUseGuidance },
|
|
654
667
|
{ id: "privilege-escalation", owner: "platform", cacheScope: "session", content: toolSections.privilegeEscalation },
|
|
668
|
+
{ id: "shell-task-lifecycle", owner: "platform", cacheScope: "session", content: toolSections.shellTaskLifecycle },
|
|
655
669
|
{ id: "agent-orchestration", owner: "platform", cacheScope: "session", content: toolSections.agentOrchestration },
|
|
656
670
|
{ id: "agent-collaboration", owner: "platform", cacheScope: "session", content: toolSections.agentCollaboration },
|
|
657
671
|
{ id: "web-access", owner: "platform", cacheScope: "session", content: toolSections.webAccess },
|
|
@@ -699,8 +713,9 @@ var applyClaudeCache = (stableContent, dynamicContent) => {
|
|
|
699
713
|
var prependPromptMessage = (messages, agentConfig, resolvedModel, language, contexts, prependSystemPrompt = true) => {
|
|
700
714
|
if (!prependSystemPrompt) return messages;
|
|
701
715
|
if (!contexts && !agentConfig.prompt) return messages;
|
|
716
|
+
const dispatchIntent = detectDispatchIntentFromMessages(messages);
|
|
702
717
|
if (isClaudeModel(resolvedModel)) {
|
|
703
|
-
const compiled = buildSystemPromptContext({ agentConfig, language, contexts });
|
|
718
|
+
const compiled = buildSystemPromptContext({ agentConfig, language, contexts, dispatchIntent });
|
|
704
719
|
if (!compiled.content.trim()) return messages;
|
|
705
720
|
const content = applyClaudeCache(
|
|
706
721
|
compiled.stablePrefixContent,
|
|
@@ -709,7 +724,7 @@ var prependPromptMessage = (messages, agentConfig, resolvedModel, language, cont
|
|
|
709
724
|
const systemMessage2 = { role: "system", content };
|
|
710
725
|
return [systemMessage2, ...messages];
|
|
711
726
|
}
|
|
712
|
-
const promptContent = buildSystemPrompt({ agentConfig, language, contexts });
|
|
727
|
+
const promptContent = buildSystemPrompt({ agentConfig, language, contexts, dispatchIntent });
|
|
713
728
|
if (!promptContent.trim()) return messages;
|
|
714
729
|
const systemMessage = { role: "system", content: promptContent };
|
|
715
730
|
return [systemMessage, ...messages];
|
|
@@ -772,8 +787,13 @@ var buildRequestBody = (options) => {
|
|
|
772
787
|
endpoint: customProviderUrl
|
|
773
788
|
});
|
|
774
789
|
Object.assign(bodyData, usageRequestOptions);
|
|
775
|
-
|
|
776
|
-
|
|
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
|
+
);
|
|
777
797
|
if (clamped) {
|
|
778
798
|
bodyData.reasoning_effort = clamped;
|
|
779
799
|
}
|
|
@@ -892,7 +912,9 @@ function generateResponseRequestBody(agentConfig, msgs, contexts, prependSystemP
|
|
|
892
912
|
const promptContent = buildSystemPrompt({
|
|
893
913
|
agentConfig,
|
|
894
914
|
language,
|
|
895
|
-
contexts
|
|
915
|
+
contexts,
|
|
916
|
+
// 按当前用户输入检测派发意图:无意图只注入最小派发协议(安全硬门常在)。
|
|
917
|
+
dispatchIntent: detectDispatchIntentFromMessages(msgs)
|
|
896
918
|
});
|
|
897
919
|
body.instructions = promptContent;
|
|
898
920
|
}
|
|
@@ -1202,7 +1224,7 @@ var buildProxyPayload = (bodyData, api, agentConfig, dialogId) => {
|
|
|
1202
1224
|
};
|
|
1203
1225
|
};
|
|
1204
1226
|
var fetchDirectly = async (params) => {
|
|
1205
|
-
const { api, agentConfig, bodyData, signal, currentServer, token } = params;
|
|
1227
|
+
const { api, agentConfig, bodyData, signal, currentServer, token, dialogId } = params;
|
|
1206
1228
|
try {
|
|
1207
1229
|
const apiKey = await resolveDirectRequestApiKey(agentConfig, {
|
|
1208
1230
|
syncFetcher: currentServer && token ? (ref) => fetchServerSyncedCredential({ currentServer, authToken: token }, ref) : void 0,
|
|
@@ -1222,7 +1244,8 @@ var fetchDirectly = async (params) => {
|
|
|
1222
1244
|
const authHeaders = buildProviderAuthHeaders({
|
|
1223
1245
|
endpoint: api,
|
|
1224
1246
|
apiKey: apiKey ?? "",
|
|
1225
|
-
apiKeyHeader: agentConfig.apiKeyHeader
|
|
1247
|
+
apiKeyHeader: agentConfig.apiKeyHeader,
|
|
1248
|
+
sessionId: dialogId || agentConfig.dbKey || agentConfig.key
|
|
1226
1249
|
});
|
|
1227
1250
|
return await fetch(api, {
|
|
1228
1251
|
method: "POST",
|
|
@@ -1788,12 +1811,17 @@ ${tableMd}
|
|
|
1788
1811
|
`;
|
|
1789
1812
|
};
|
|
1790
1813
|
var fetchSlateReference = async (dbKey, refContent, dispatch, options) => {
|
|
1791
|
-
|
|
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;
|
|
1792
1817
|
const title = refContent.title || `Untitled (${dbKey})`;
|
|
1793
1818
|
let contentString;
|
|
1794
1819
|
let contentType;
|
|
1795
1820
|
const inlineMentionMeta = options.inlineMentionMeta ?? options.format === "simplified_markdown";
|
|
1796
|
-
|
|
1821
|
+
if (legacyContent) {
|
|
1822
|
+
contentType = "Markdown (legacy content)";
|
|
1823
|
+
contentString = legacyContent;
|
|
1824
|
+
} else switch (options.format) {
|
|
1797
1825
|
case "text":
|
|
1798
1826
|
contentType = "Plain Text";
|
|
1799
1827
|
contentString = slateToText(refContent.slateData);
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-45LEXXBA.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QXWGM7NK.js";
|
|
8
8
|
import {
|
|
9
|
-
deriveCredentialGroup
|
|
10
|
-
|
|
11
|
-
} from "./chunk-IAO6JBYW.js";
|
|
9
|
+
deriveCredentialGroup
|
|
10
|
+
} from "./chunk-HP2HV7RZ.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,78 @@ 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 tightest = findTightestQuotaWindow(quota, now);
|
|
264
|
+
if (!tightest) return void 0;
|
|
265
|
+
const compact = options?.compact === true;
|
|
266
|
+
const parts = [];
|
|
267
|
+
if (typeof tightest.utilization === "number") {
|
|
268
|
+
const pct = Math.round(tightest.utilization * 100);
|
|
269
|
+
parts.push(`${pct}%\u5DF2\u7528`);
|
|
270
|
+
} else if (typeof tightest.remaining === "number") {
|
|
271
|
+
if (typeof tightest.limit === "number") {
|
|
272
|
+
parts.push(`${tightest.remaining}/${tightest.limit}${tightest.unit ? ` ${tightest.unit}` : ""}`);
|
|
273
|
+
} else {
|
|
274
|
+
parts.push(`\u4F59${tightest.remaining}${tightest.unit ? ` ${tightest.unit}` : ""}`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (compact) return parts.length > 0 ? parts[0] : void 0;
|
|
278
|
+
if (tightest.scope && tightest.scope !== "user" && tightest.scope !== "project" && tightest.scope !== tightest.unit) {
|
|
279
|
+
parts.push(tightest.scope);
|
|
280
|
+
}
|
|
281
|
+
if (typeof tightest.resetAt === "number" && tightest.resetAt > now) {
|
|
282
|
+
const diffSec = Math.round((tightest.resetAt - now) / 1e3);
|
|
283
|
+
if (diffSec < 60) {
|
|
284
|
+
parts.push(`${diffSec}s\u540E\u91CD\u7F6E`);
|
|
285
|
+
} else if (diffSec < 3600) {
|
|
286
|
+
parts.push(`${Math.round(diffSec / 60)}m\u540E\u91CD\u7F6E`);
|
|
287
|
+
} else if (diffSec < 86400) {
|
|
288
|
+
const hours = (diffSec / 3600).toFixed(1).replace(/\.0$/, "");
|
|
289
|
+
parts.push(`${hours}h\u540E\u91CD\u7F6E`);
|
|
290
|
+
} else {
|
|
291
|
+
const days = (diffSec / 86400).toFixed(1).replace(/\.0$/, "");
|
|
292
|
+
parts.push(`${days}d\u540E\u91CD\u7F6E`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (parts.length === 0) return void 0;
|
|
296
|
+
if (parts.length === 1 && parts[0] === tightest.scope) return void 0;
|
|
297
|
+
return parts.join(" \xB7 ");
|
|
298
|
+
}
|
|
299
|
+
|
|
240
300
|
export {
|
|
241
301
|
normalizeListedAgent,
|
|
242
|
-
toSafeListedAgentSummary,
|
|
243
302
|
parseAgentListArgs,
|
|
244
303
|
listLocalCachedAgents,
|
|
245
304
|
listRemotePublicAgents,
|
|
246
305
|
listRemoteAgents,
|
|
247
306
|
listRemoteAgentsAcrossServers,
|
|
248
307
|
listFavoriteAgentIdsAcrossServers,
|
|
249
|
-
decorateAgentsWithPublicStatusAcrossServers
|
|
308
|
+
decorateAgentsWithPublicStatusAcrossServers,
|
|
309
|
+
formatQuotaSummary
|
|
250
310
|
};
|
|
@@ -14,7 +14,7 @@ function buildCliLocalRuntimeDbEnv(env = process.env) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
async function getDefaultCliLocalRuntimeDb(options = {}) {
|
|
17
|
-
const { getDefaultCliLocalRuntimeDb: getAuthorityBackedDb } = await import("./localRuntimeAuthority-
|
|
17
|
+
const { getDefaultCliLocalRuntimeDb: getAuthorityBackedDb } = await import("./localRuntimeAuthority-5W6IJRAD.js");
|
|
18
18
|
return getAuthorityBackedDb(options);
|
|
19
19
|
}
|
|
20
20
|
|