nolo-cli 0.103.0-alpha.1 → 0.103.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-3UCNJCQA.js → _executeModel-7J7Q3WXY.js} +75 -68
- package/action-C4KMTCJF.js +20 -0
- package/{addContentAction-O7R66HEX.js → addContentAction-7TNIOVZI.js} +12 -11
- package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-O47J3MVW.js} +18 -19
- package/{agentDeleteCommand-2YAHAZFJ.js → agentDeleteCommand-YPJHK7JA.js} +117 -42
- package/{agentEmailCommands-WLYF3JRS.js → agentEmailCommands-AWEXOHWM.js} +98 -88
- package/agentListCommands-2DTLLJZD.js +742 -0
- package/{agentMachineCommands-HNGAR5GI.js → agentMachineCommands-PGEEQ4JJ.js} +48 -43
- package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-XPJYZSCE.js} +97 -2
- package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-B4T2DJ5H.js} +1 -1
- package/agentRecordCommands-DZVLCPLJ.js +138 -0
- package/agentRunCommand-AX5CYQ46.js +167 -0
- package/{agentRunControl-AVJR4JW4.js → agentRunControl-3HWA2LLQ.js} +2 -2
- package/{agentRuntimeLocal-VXZSDIGT.js → agentRuntimeLocal-PITRQ2EU.js} +48 -39
- package/{agentSlice-SICQBMCM.js → agentSlice-4TLSG6FB.js} +14 -13
- package/{appDeleteCommands-32MHLR4L.js → appDeleteCommands-UC2JW5FJ.js} +46 -41
- package/{appDeployCommands-WCQOUSOB.js → appDeployCommands-OL2RKVJ3.js} +46 -41
- package/{appDeployStatusCommands-6QKB7DYN.js → appDeployStatusCommands-B3PLC62M.js} +46 -41
- package/{appGetCommands-SFAPP5PB.js → appGetCommands-REESA2XQ.js} +46 -41
- package/{appListCommands-EKUBDRUO.js → appListCommands-UF6XX7HR.js} +46 -41
- package/{authCommand-F4EFRRX6.js → authCommand-NQPMGYHP.js} +118 -24
- package/{authCommands-RGOGCPP6.js → authCommands-LWLOZETU.js} +7 -5
- package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-GFY77VRN.js} +10 -8
- package/{chromeCommands-FZYAU75D.js → chromeCommands-K27J4OVZ.js} +124 -28
- package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-IXRLN57H.js} +4 -3
- package/{chunk-UKZDAFYT.js → chunk-22RVE2PC.js} +6 -10
- package/{chunk-6OZ36FXI.js → chunk-27ONFIEY.js} +22 -4
- package/{chunk-HVURBGF3.js → chunk-2H6SEVDS.js} +6 -6
- package/{chunk-TOP2VXOR.js → chunk-2K4TM6AW.js} +5 -5
- package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
- package/{chunk-53HEEOTT.js → chunk-2WJ57RJA.js} +83 -16
- package/{chunk-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
- package/chunk-4A2R7KHG.js +13545 -0
- package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
- package/{chunk-JRQFUXY7.js → chunk-4G4C5SXT.js} +99 -22
- package/{chunk-DHDMC6FO.js → chunk-4HTMUQIZ.js} +14 -9
- package/{chunk-B3TVQ6PI.js → chunk-4IVA6UUE.js} +20 -11
- package/chunk-4LCOCOR5.js +50 -0
- package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
- package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
- package/{chunk-H62HCIUP.js → chunk-56HJ2LAA.js} +35 -22
- package/{chunk-V4MJDUSR.js → chunk-5EPHWMP5.js} +2 -2
- package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
- package/{chunk-3WLK2JQ5.js → chunk-5IWONK6X.js} +68 -46
- package/chunk-5J3PYNUP.js +255 -0
- package/chunk-5MMAK75Q.js +15 -0
- package/{chunk-LW4VFPAY.js → chunk-5ZDLVKNG.js} +873 -228
- package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
- package/{chunk-AEOE4Z6Q.js → chunk-6UEJDFF7.js} +39 -15
- package/{chunk-JPGCXHNM.js → chunk-7JWCVINR.js} +1 -1
- package/{chunk-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
- package/{chunk-IIVGDG4I.js → chunk-7KWFIKKK.js} +13 -7
- package/chunk-A4SQRTZ6.js +15 -0
- package/chunk-AGIM7IMJ.js +147 -0
- package/{chunk-5UTFL4QJ.js → chunk-AOTBKDRK.js} +7 -0
- package/{chunk-L5UXH3B2.js → chunk-B455PEFD.js} +27 -8
- package/{chunk-XS5SWEDQ.js → chunk-BELZY72F.js} +1 -1
- package/chunk-BMQ2MJUK.js +153 -0
- package/{chunk-6YTOJY35.js → chunk-BZ7NPA6G.js} +35 -2
- package/chunk-CHOZJMJS.js +78 -0
- package/{chunk-3BMYXEUW.js → chunk-CUF4MYKI.js} +1 -1
- 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-DZ7R5V3Y.js +164 -0
- package/{chunk-3VNWWVKB.js → chunk-E3YWHWCR.js} +50 -18
- package/{chunk-KQ4ONNQD.js → chunk-EKPKW6RM.js} +155 -8
- package/{chunk-ABQYVJBJ.js → chunk-EV235ILT.js} +5 -5
- package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
- package/{chunk-AGVEIAQA.js → chunk-F442UK5V.js} +29 -78
- package/{chunk-HJUYAD4A.js → chunk-FBTNYNAL.js} +5 -5
- package/{chunk-2F7RJC6L.js → chunk-FOXQ7BAB.js} +1 -1
- package/{chunk-ETI2NYVF.js → chunk-GCTKWVLU.js} +4 -4
- package/chunk-GMZLP5DV.js +82 -0
- package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
- package/{chunk-6VFARHZW.js → chunk-H7TQORR4.js} +994 -1079
- package/{chunk-5H7KJX7J.js → chunk-HD3S2F7U.js} +5 -5
- package/chunk-HDJRLWTG.js +8002 -0
- 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-4OEFYTWL.js → chunk-IRZTHHNM.js} +67 -48
- package/{chunk-GPCZ7UXG.js → chunk-K6U4NKFJ.js} +1 -1
- package/{chunk-OZGZPSEG.js → chunk-KGRP4VOK.js} +47 -67
- package/{chunk-DNCEALKX.js → chunk-LB5A6JTU.js} +22 -29
- package/{chunk-LS2ZANRJ.js → chunk-LOCNXNOU.js} +1 -1
- package/{chunk-PUOC4YRO.js → chunk-M7VLQGQP.js} +11 -0
- package/{chunk-Z77CRGTW.js → chunk-MSFZ7FMO.js} +1 -1
- package/chunk-NKWIS6G2.js +442 -0
- package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
- package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
- package/chunk-NWENLDMM.js +42 -0
- package/chunk-O7SVKKLY.js +875 -0
- package/chunk-OCZKATRC.js +129 -0
- package/{chunk-PQFHGD77.js → chunk-OM2RUOEU.js} +161 -14
- package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
- package/{chunk-TQBHNYVR.js → chunk-PLRFCQ7C.js} +567 -519
- package/{chunk-6D6VBVEW.js → chunk-Q7O72MF5.js} +80 -14
- package/{chunk-J4MOO56S.js → chunk-RILRSUGC.js} +10 -2
- package/{chunk-RSONHHPE.js → chunk-RNUDNZJW.js} +10 -10
- package/{chunk-3N3W7KBB.js → chunk-RZJAZVCF.js} +11 -9
- package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
- package/{chunk-GEPUP7OO.js → chunk-TSXNDTXL.js} +3 -3
- 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-BP4XNZRM.js → chunk-UNAOTLKO.js} +4 -4
- package/{chunk-CUQEXCAU.js → chunk-UQ5P2WHS.js} +29 -9
- package/{chunk-NA35QHCF.js → chunk-V6YASAZR.js} +1 -1
- package/{chunk-3DII57IT.js → chunk-VCAQFMVN.js} +1 -1
- package/chunk-VIWDGTDA.js +8 -0
- package/chunk-VJVNU77E.js +83 -0
- package/{chunk-ZCYXJSTU.js → chunk-VL3H5ZU3.js} +66 -94
- package/{chunk-Q554LLSI.js → chunk-VLGL7FOL.js} +1 -1
- package/{chunk-UKWGR5SS.js → chunk-VY6VFGKR.js} +194 -1144
- package/{chunk-4EG4QFTK.js → chunk-WI6TUGLJ.js} +19 -17
- package/{chunk-QDSINZM3.js → chunk-WJ3B6FX6.js} +1 -14
- package/{chunk-OEVAY4J6.js → chunk-XMUZHRSB.js} +18 -20
- package/{chunk-O6OSWFZQ.js → chunk-XUWRURDF.js} +6 -0
- package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
- package/{chunk-7S4YWN7P.js → chunk-YDO5ERB4.js} +4 -4
- package/chunk-YK5MHOWM.js +915 -0
- package/{chunk-SH43IESU.js → chunk-YUNJN43V.js} +44 -9
- package/chunk-YV25TM3R.js +780 -0
- package/{chunk-IONPPCL5.js → chunk-YZZREBID.js} +86 -16
- package/{chunk-DNUUJ45N.js → chunk-Z3WSAK6A.js} +23 -28
- package/chunk-ZRAU6T47.js +56 -0
- package/commandRegistry-VQPFWVDH.js +833 -0
- package/{contentThunks-S4S7QPSO.js → contentThunks-A26ME6OJ.js} +37 -35
- package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
- package/{createAgentAutomationAction-ODGL2YGP.js → createAgentAutomationAction-BSAMZJ5W.js} +39 -37
- package/createDialogAction-CMCQXYHD.js +69 -0
- package/{createPageAction-FBV3OWX7.js → createPageAction-ANGKJTK2.js} +46 -43
- package/{chunk-F2RNI7ZR.js → cursorProvider-YGGNMVWX.js} +2496 -9897
- package/{dbSlice-XVWBAGYN.js → dbSlice-QOLNF5GN.js} +11 -10
- package/{deleteFile-YG6QMJLU.js → deleteFile-KESP65GC.js} +7 -6
- package/{dialogCommands-5J56DFWN.js → dialogCommands-AMPAWLX4.js} +49 -45
- package/{dialogSlice-LEO27SQG.js → dialogSlice-DGWDEBYC.js} +41 -34
- package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
- package/{docCreateCommands-KYI2DC2U.js → docCreateCommands-7NMIYL5D.js} +48 -43
- package/{docDeleteCommands-67REUSRY.js → docDeleteCommands-BD4OM5PV.js} +49 -44
- package/{docReadCommands-HOSVSBDJ.js → docReadCommands-5IOVAKU2.js} +47 -42
- package/{docStore-MNX5MHA5.js → docStore-TP4QDER4.js} +16 -12
- package/{docUpdateCommands-EMGCSMXY.js → docUpdateCommands-ZTKJ6UPC.js} +48 -43
- package/{fetchMessages-EIU7UFFK.js → fetchMessages-5L7OVM5Y.js} +5 -5
- package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +4 -4
- package/{handleSendMessageAction-YB6KQFJS.js → handleSendMessageAction-N4WKFRSQ.js} +111 -87
- package/index.js +87 -884
- package/{lib-FRRS27KN.js → lib-PU2G2MSO.js} +523 -191
- package/{localDialogRead-BTFJ4V2I.js → localDialogRead-O5A26FDK.js} +2 -2
- package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-TU6OBC76.js} +9 -6
- package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-VKWVOPPI.js} +1 -1
- package/{machineCommands-7GVQCUAK.js → machineCommands-47WKGY5Z.js} +92 -82
- package/machineWsRunDispatch-CYW5FJ52.js +154 -0
- package/{memberThunks-QGFLFVCI.js → memberThunks-25K6DDRA.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-WA7JNI6J.js → readlineWorkspace-CK7GOVOC.js} +2698 -2055
- package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-VIWJL6MX.js} +21 -25
- package/{runAgentClientLoop-JGFQ6KIR.js → runAgentClientLoop-BGHGP5AR.js} +76 -70
- package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-PIVSBZRZ.js} +4 -4
- package/runtimeModeArgs-2Y7BALTO.js +31 -0
- package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-A7VA3NFM.js} +15 -13
- package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-B4P7YQX2.js} +22 -26
- package/{chunk-AFUORTY4.js → settingThunks-KOYSAT65.js} +226 -940
- package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
- package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
- package/{spaceCommands-NKJVJCQQ.js → spaceCommands-QJCYG27F.js} +51 -46
- package/{streamAgentChatTurn-XLFZ66UC.js → streamAgentChatTurn-ANE7OTCZ.js} +214 -108
- package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-3VYWHZKH.js} +18 -19
- package/{tableCommands-O6NWHFKV.js → tableCommands-6U4BMLRR.js} +10 -10
- package/{toolApiClient-QVJ6HDNN.js → toolApiClient-EJT6TMFG.js} +3 -3
- package/tools-WPOVVP7M.js +116 -0
- package/{tuiSummaryLlmCaller-WFRWERGK.js → tuiSummaryLlmCaller-QCHCULPM.js} +25 -22
- package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
- package/{updateDialogTitleAction-6MBTD4UE.js → updateDialogTitleAction-C4GRCXL4.js} +82 -44
- package/action-YVYQEAAV.js +0 -31
- package/agentListCommands-JP7S7PT2.js +0 -469
- package/agentRecordCommands-SXFPW3DL.js +0 -128
- package/agentRunCommand-JIQ4HY4D.js +0 -155
- package/browser-image-compression-MFDTD7K6.js +0 -1763
- package/chatQueueReduxAdapter-HHMUDNXL.js +0 -186
- package/chunk-CQ3WA2NE.js +0 -299
- 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-XVZ22N6C.js +0 -20782
- package/chunk-Y5GCAMGP.js +0 -9
- package/chunk-YPREESF4.js +0 -225
- package/createDialogAction-GFKRXTK4.js +0 -65
- package/machineWsRunDispatch-XA7TD7Z7.js +0 -144
- package/settingSlice-ZQZVUPKK.js +0 -204
- package/syncMapping-N6RGXGBW.js +0 -437
- package/tools-NF5AB34X.js +0 -110
- package/{chunk-VMFTFOWF.js → chunk-ODAPITXL.js} +7 -7
- package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
- package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// packages/cli/secretScan.ts
|
|
2
|
+
var ASSIGNMENT_KEYS = [
|
|
3
|
+
{ label: "password", keys: "password|passwd", min: 8 },
|
|
4
|
+
{ label: "psk", keys: "psk", min: 8 },
|
|
5
|
+
{ label: "api key", keys: "api[_-]?key|apikey", min: 12 },
|
|
6
|
+
{ label: "token", keys: "token|secret", min: 12 }
|
|
7
|
+
];
|
|
8
|
+
var ASSIGNMENT_PATTERNS = ASSIGNMENT_KEYS.map(
|
|
9
|
+
({ label, keys, min }) => ({
|
|
10
|
+
label,
|
|
11
|
+
// 反向引用 \1 让引号成对成为必要条件:半截引号不算。值里允许空格与逗号——
|
|
12
|
+
// 写成带空格的口令是常见形态,旧的字符类会把这种值截成半截从而整条漏掉。
|
|
13
|
+
quoted: new RegExp(
|
|
14
|
+
`\\b(?:${keys})\\s*[:=]\\s*(["'])([^"']{${min},})\\1`,
|
|
15
|
+
"i"
|
|
16
|
+
),
|
|
17
|
+
// 不带引号时只取到分隔符为止,是否算密钥交给 looksLikeBareSecret 判。
|
|
18
|
+
bare: new RegExp(
|
|
19
|
+
`\\b(?:${keys})\\s*[:=]\\s*([^\\s"',#]{${min},})`,
|
|
20
|
+
"i"
|
|
21
|
+
)
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
var PRIVATE_KEY_PATTERN = /-----BEGIN [A-Z ]*PRIVATE KEY-----/;
|
|
25
|
+
var EXPRESSION_CHARS = /[?(){};|&<>$]/;
|
|
26
|
+
var CONSTANT_CASE = /^[A-Z][A-Z0-9_]*$/;
|
|
27
|
+
var CAMEL_CASE = /^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]+)+$/;
|
|
28
|
+
var PROPERTY_SEGMENT = /^[A-Za-z_$][\w$]*$/;
|
|
29
|
+
var NAME_FORM_MAX_CHARS = 48;
|
|
30
|
+
var PROPERTY_SEGMENT_MAX_CHARS = 24;
|
|
31
|
+
function looksLikeDottedName(value) {
|
|
32
|
+
const segments = value.split(".");
|
|
33
|
+
if (segments.length < 2) return false;
|
|
34
|
+
return segments.every(
|
|
35
|
+
(segment) => PROPERTY_SEGMENT.test(segment) && (segment.length <= PROPERTY_SEGMENT_MAX_CHARS || CONSTANT_CASE.test(segment) && segment.includes("_"))
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function stripTrailingMarkdownFence(value) {
|
|
39
|
+
return value.replace(/`+$/, "");
|
|
40
|
+
}
|
|
41
|
+
function looksLikeBareSecret(rawValue) {
|
|
42
|
+
const value = stripTrailingMarkdownFence(rawValue);
|
|
43
|
+
if (EXPRESSION_CHARS.test(value)) return false;
|
|
44
|
+
if (CONSTANT_CASE.test(value) && value.includes("_")) return false;
|
|
45
|
+
if (looksLikeDottedName(value)) return false;
|
|
46
|
+
if (value.length > NAME_FORM_MAX_CHARS) {
|
|
47
|
+
return /\d/.test(value);
|
|
48
|
+
}
|
|
49
|
+
if (CAMEL_CASE.test(value)) return false;
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
function toPreview(line) {
|
|
53
|
+
return line.length > 120 ? `${line.slice(0, 117)}...` : line;
|
|
54
|
+
}
|
|
55
|
+
function findPotentialSecrets(text) {
|
|
56
|
+
const findings = [];
|
|
57
|
+
text.split(/\r?\n/).forEach((line, index) => {
|
|
58
|
+
const lineNumber = index + 1;
|
|
59
|
+
const preview = toPreview(line);
|
|
60
|
+
for (const { label, quoted, bare } of ASSIGNMENT_PATTERNS) {
|
|
61
|
+
if (quoted.test(line)) {
|
|
62
|
+
findings.push({ label, line: lineNumber, preview });
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const bareMatch = bare.exec(line);
|
|
66
|
+
if (bareMatch && looksLikeBareSecret(bareMatch[1])) {
|
|
67
|
+
findings.push({ label, line: lineNumber, preview });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (PRIVATE_KEY_PATTERN.test(line)) {
|
|
71
|
+
findings.push({ label: "private key", line: lineNumber, preview });
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return findings;
|
|
75
|
+
}
|
|
76
|
+
function formatSecretFindings(findings) {
|
|
77
|
+
return findings.map((finding) => ` line ${finding.line} (${finding.label}): ${finding.preview}`).join("\n");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export {
|
|
81
|
+
findPotentialSecrets,
|
|
82
|
+
formatSecretFindings
|
|
83
|
+
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readSseFrames
|
|
3
|
+
} from "./chunk-GMZLP5DV.js";
|
|
1
4
|
import {
|
|
2
5
|
sanitizeForOutbound
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NKWIS6G2.js";
|
|
4
7
|
import {
|
|
5
8
|
accumulateToolCallDelta,
|
|
6
9
|
createThinkParserState,
|
|
@@ -25,7 +28,14 @@ import {
|
|
|
25
28
|
stablePromptCacheKey,
|
|
26
29
|
toOpenAiCompatibleMessages,
|
|
27
30
|
toResponsesTools
|
|
28
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-M7VLQGQP.js";
|
|
32
|
+
import {
|
|
33
|
+
isMeaningfulChatCompletionOutput,
|
|
34
|
+
isMeaningfulResponsesOutput
|
|
35
|
+
} from "./chunk-LB5A6JTU.js";
|
|
36
|
+
import {
|
|
37
|
+
clipCompactText
|
|
38
|
+
} from "./chunk-5MMAK75Q.js";
|
|
29
39
|
import {
|
|
30
40
|
buildProviderExecutionPlan,
|
|
31
41
|
canUsePlatformChatProvider,
|
|
@@ -35,16 +45,11 @@ import {
|
|
|
35
45
|
resolvePlatformAuthToken,
|
|
36
46
|
resolvePlatformServerUrl,
|
|
37
47
|
resolveProviderTransportDecision
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import {
|
|
40
|
-
clipCompactText,
|
|
41
|
-
isMeaningfulChatCompletionOutput,
|
|
42
|
-
isMeaningfulResponsesOutput
|
|
43
|
-
} from "./chunk-DNCEALKX.js";
|
|
48
|
+
} from "./chunk-27ONFIEY.js";
|
|
44
49
|
import {
|
|
45
50
|
NOLO_CLIENT_VERSION_HEADER,
|
|
46
51
|
isPlatformMimoProviderModel
|
|
47
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-Y3PMXGLH.js";
|
|
48
53
|
import {
|
|
49
54
|
isRecord
|
|
50
55
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -213,18 +218,58 @@ function createResponsesToolAccumulator() {
|
|
|
213
218
|
function keyOf(event) {
|
|
214
219
|
return typeof event?.item_id === "string" && event.item_id ? event.item_id : typeof event?.item?.id === "string" && event.item.id ? event.item.id : typeof event?.item?.call_id === "string" && event.item.call_id ? event.item.call_id : typeof event?.call_id === "string" && event.call_id ? event.call_id : "";
|
|
215
220
|
}
|
|
221
|
+
function shortFingerprint(value) {
|
|
222
|
+
let hash = 2166136261;
|
|
223
|
+
for (let i = 0; i < value.length; i++) {
|
|
224
|
+
hash ^= value.charCodeAt(i);
|
|
225
|
+
hash = Math.imul(hash, 16777619);
|
|
226
|
+
}
|
|
227
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
228
|
+
}
|
|
229
|
+
function parsesAsJsonObject(value) {
|
|
230
|
+
try {
|
|
231
|
+
const parsed = JSON.parse(value);
|
|
232
|
+
return parsed !== null && typeof parsed === "object";
|
|
233
|
+
} catch {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
216
237
|
function applyResponsesToolEvent(calls, event) {
|
|
217
238
|
const key = keyOf(event);
|
|
218
239
|
if (!key) return;
|
|
219
240
|
const item = event?.item;
|
|
220
241
|
const id = item?.call_id || item?.id || event?.call_id || key;
|
|
221
|
-
const current = calls.get(key) ?? { id, name: "", arguments: "" };
|
|
242
|
+
const current = calls.get(key) ?? { id, name: "", arguments: "", sawDelta: false };
|
|
222
243
|
if (typeof item?.name === "string" && item.name) current.name = item.name;
|
|
244
|
+
const applySnapshot = (next) => {
|
|
245
|
+
if (!current.sawDelta) {
|
|
246
|
+
current.arguments = next;
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (next.startsWith(current.arguments)) {
|
|
250
|
+
current.arguments = next;
|
|
251
|
+
} else if (current.arguments.startsWith(next)) {
|
|
252
|
+
} else {
|
|
253
|
+
if (!parsesAsJsonObject(current.arguments) && parsesAsJsonObject(next)) {
|
|
254
|
+
console.warn(
|
|
255
|
+
`[responses-tool-call] adopting parsable snapshot over unparsable accumulation (accumulated length=${current.arguments.length}, fingerprint=${shortFingerprint(current.arguments)}; snapshot length=${next.length}, fingerprint=${shortFingerprint(next)})`
|
|
256
|
+
);
|
|
257
|
+
current.arguments = next;
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
console.warn(
|
|
261
|
+
`[responses-tool-call] conflicting arguments snapshot (accumulated length=${current.arguments.length}, fingerprint=${shortFingerprint(current.arguments)}; snapshot length=${next.length}, fingerprint=${shortFingerprint(next)})`
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
223
265
|
const itemArguments = normalizeResponsesToolArguments(item?.arguments);
|
|
224
|
-
if (itemArguments !== void 0)
|
|
266
|
+
if (itemArguments !== void 0) applySnapshot(itemArguments);
|
|
225
267
|
const eventArguments = normalizeResponsesToolArguments(event?.arguments);
|
|
226
|
-
if (eventArguments !== void 0)
|
|
227
|
-
if (typeof event?.delta === "string")
|
|
268
|
+
if (eventArguments !== void 0) applySnapshot(eventArguments);
|
|
269
|
+
if (typeof event?.delta === "string") {
|
|
270
|
+
current.sawDelta = true;
|
|
271
|
+
current.arguments += event.delta;
|
|
272
|
+
}
|
|
228
273
|
calls.set(key, current);
|
|
229
274
|
}
|
|
230
275
|
function addResponsesToolCall(calls, call) {
|
|
@@ -232,7 +277,8 @@ function addResponsesToolCall(calls, call) {
|
|
|
232
277
|
calls.set(key, {
|
|
233
278
|
id: call.id,
|
|
234
279
|
name: call.function.name,
|
|
235
|
-
arguments: call.function.arguments
|
|
280
|
+
arguments: call.function.arguments,
|
|
281
|
+
sawDelta: false
|
|
236
282
|
});
|
|
237
283
|
}
|
|
238
284
|
function finalizeResponsesToolCalls(calls) {
|
|
@@ -347,83 +393,6 @@ function flushChatCompletionStream(state) {
|
|
|
347
393
|
}
|
|
348
394
|
}
|
|
349
395
|
|
|
350
|
-
// packages/agent-runtime/sseFrames.ts
|
|
351
|
-
async function* readSseFrames(response) {
|
|
352
|
-
const reader = response.body?.getReader();
|
|
353
|
-
if (!reader) {
|
|
354
|
-
throw new Error("SSE response did not include a readable body.");
|
|
355
|
-
}
|
|
356
|
-
const decoder = new TextDecoder();
|
|
357
|
-
let buffer = "";
|
|
358
|
-
while (true) {
|
|
359
|
-
const { done, value } = await reader.read();
|
|
360
|
-
if (done) break;
|
|
361
|
-
buffer += decoder.decode(value, { stream: true });
|
|
362
|
-
let boundary = findSseFrameBoundary(buffer);
|
|
363
|
-
while (boundary) {
|
|
364
|
-
yield buffer.slice(0, boundary.index);
|
|
365
|
-
buffer = buffer.slice(boundary.index + boundary.separatorLength);
|
|
366
|
-
boundary = findSseFrameBoundary(buffer);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
const remaining = decoder.decode();
|
|
370
|
-
if (remaining) {
|
|
371
|
-
buffer += remaining;
|
|
372
|
-
let boundary = findSseFrameBoundary(buffer);
|
|
373
|
-
while (boundary) {
|
|
374
|
-
yield buffer.slice(0, boundary.index);
|
|
375
|
-
buffer = buffer.slice(boundary.index + boundary.separatorLength);
|
|
376
|
-
boundary = findSseFrameBoundary(buffer);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
if (buffer.trim()) yield buffer;
|
|
380
|
-
}
|
|
381
|
-
function findSseFrameBoundary(buffer) {
|
|
382
|
-
const lfLf = buffer.indexOf("\n\n");
|
|
383
|
-
const crLfCrLf = buffer.indexOf("\r\n\r\n");
|
|
384
|
-
if (lfLf === -1 && crLfCrLf === -1) return null;
|
|
385
|
-
const useLf = lfLf !== -1 && (crLfCrLf === -1 || lfLf < crLfCrLf);
|
|
386
|
-
return useLf ? { index: lfLf, separatorLength: 2 } : { index: crLfCrLf, separatorLength: 4 };
|
|
387
|
-
}
|
|
388
|
-
async function* streamSseDataValues(response, parse) {
|
|
389
|
-
const reader = response.body?.getReader();
|
|
390
|
-
if (!reader) return;
|
|
391
|
-
const decoder = new TextDecoder();
|
|
392
|
-
let buffer = "";
|
|
393
|
-
while (true) {
|
|
394
|
-
const { done, value } = await reader.read();
|
|
395
|
-
if (done) break;
|
|
396
|
-
buffer += decoder.decode(value, { stream: true });
|
|
397
|
-
const lines = buffer.split("\n");
|
|
398
|
-
buffer = lines.pop() ?? "";
|
|
399
|
-
for (const line of lines) {
|
|
400
|
-
const parsed = parse(line);
|
|
401
|
-
if (parsed) yield parsed;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
const remaining = decoder.decode();
|
|
405
|
-
if (remaining) {
|
|
406
|
-
buffer += remaining;
|
|
407
|
-
const lines = buffer.split("\n");
|
|
408
|
-
buffer = lines.pop() ?? "";
|
|
409
|
-
for (const line of lines) {
|
|
410
|
-
const parsed = parse(line);
|
|
411
|
-
if (parsed) yield parsed;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
if (buffer.trim()) {
|
|
415
|
-
const parsed = parse(buffer);
|
|
416
|
-
if (parsed) yield parsed;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
async function readSseDataValues(response, parse) {
|
|
420
|
-
const values = [];
|
|
421
|
-
for await (const value of streamSseDataValues(response, parse)) {
|
|
422
|
-
values.push(value);
|
|
423
|
-
}
|
|
424
|
-
return values;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
396
|
// packages/agent-runtime/platformChatProvider.ts
|
|
428
397
|
var PlatformStreamInterruptedError = class extends Error {
|
|
429
398
|
code = "PLATFORM_STREAM_INTERRUPTED";
|
|
@@ -535,6 +504,12 @@ async function resolvePlatformChatProviderConfig(args) {
|
|
|
535
504
|
};
|
|
536
505
|
}
|
|
537
506
|
function buildPlatformChatCompletionRequest(args) {
|
|
507
|
+
if (!args.providerConfig.authToken?.trim()) {
|
|
508
|
+
throw Object.assign(
|
|
509
|
+
new Error("desktop platform provider failed: AUTH_NO_TOKEN"),
|
|
510
|
+
{ code: "AUTH_NO_TOKEN", authCode: "AUTH_NO_TOKEN", stage: "provider" }
|
|
511
|
+
);
|
|
512
|
+
}
|
|
538
513
|
const usesResponsesApi = isResponsesEndpoint(args.providerConfig.endpoint);
|
|
539
514
|
const requestOptions = usesResponsesApi ? toResponsesRequestOptions(args.providerConfig.requestOptions) : args.providerConfig.requestOptions;
|
|
540
515
|
const shouldStripReasoning = shouldStripReasoningContentForOutbound(
|
|
@@ -926,9 +901,6 @@ export {
|
|
|
926
901
|
applyChatCompletionDelta,
|
|
927
902
|
flushChatCompletionStream,
|
|
928
903
|
providerHttpFailure,
|
|
929
|
-
readSseFrames,
|
|
930
|
-
streamSseDataValues,
|
|
931
|
-
readSseDataValues,
|
|
932
904
|
createResponsesToolAccumulator,
|
|
933
905
|
applyResponsesToolEvent,
|
|
934
906
|
finalizeResponsesToolCalls,
|