nolo-cli 0.32.0 → 0.33.0-alpha.3

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.
Files changed (170) hide show
  1. package/README.md +6 -12
  2. package/{_executeModel-LTMSIBS4.js → _executeModel-RWPVI3YV.js} +76 -67
  3. package/{action-HI3VRQLP.js → action-SMLG6OTB.js} +17 -15
  4. package/{addContentAction-NCURJ6PK.js → addContentAction-SFO244QN.js} +14 -13
  5. package/{addDialogAgentAction-RCY4ECF4.js → addDialogAgentAction-W44ZCEHB.js} +14 -13
  6. package/{agentDeleteCommand-D3MYZK6E.js → agentDeleteCommand-KU2RXQPP.js} +42 -59
  7. package/{agentEmailCommands-6BXS574I.js → agentEmailCommands-MPCMDENS.js} +89 -80
  8. package/{agentGrantCommands-E7ZZFRHK.js → agentGrantCommands-2LEZDADN.js} +2 -2
  9. package/{agentListCommands-SF3HEUTT.js → agentListCommands-EPD4N6FX.js} +73 -78
  10. package/{agentMachineCommands-YARVXRR6.js → agentMachineCommands-AF7C3YRT.js} +40 -57
  11. package/{agentPullCommand-ARSIDNVC.js → agentPullCommand-YH5GEBK4.js} +5 -5
  12. package/agentRecordCommands-EYE6MZZG.js +112 -0
  13. package/agentRunCommand-LL22SGTN.js +130 -0
  14. package/{agentRuntimeLocal-ATGJY6WC.js → agentRuntimeLocal-JX34G47Z.js} +35 -50
  15. package/{agentSlice-4XWW344Y.js → agentSlice-TNMFQQOV.js} +15 -13
  16. package/{appDeleteCommands-63JO7RXS.js → appDeleteCommands-43K5VXQB.js} +38 -55
  17. package/{appDeployCommands-Y7EWYUGM.js → appDeployCommands-FEEJSVDZ.js} +38 -55
  18. package/{appDeployStatusCommands-ZBEY3DWB.js → appDeployStatusCommands-H76CG45R.js} +38 -55
  19. package/{appGetCommands-QSSOSEYL.js → appGetCommands-MDZYFTYZ.js} +38 -55
  20. package/{appListCommands-PH3XWNDX.js → appListCommands-TUJJXPWG.js} +38 -55
  21. package/{authCommand-BBDHMSO6.js → authCommand-T7UK4CWS.js} +18 -18
  22. package/{authCommands-4UDEKRE6.js → authCommands-EAPFGNHN.js} +8 -8
  23. package/chatQueueReduxAdapter-LVQXC4ZY.js +180 -0
  24. package/chunk-2H3XIBY4.js +239 -0
  25. package/{chunk-TEYN42N3.js → chunk-2IVEXF7P.js} +11 -4
  26. package/{chunk-WTGCTVJG.js → chunk-2QTEYCR7.js} +3 -6
  27. package/{chunk-DOISARTV.js → chunk-2UECQ7RE.js} +1 -1
  28. package/{chunk-SWYMCHM7.js → chunk-37V5LNEQ.js} +69 -1
  29. package/{chunk-E3APEOIM.js → chunk-3GZXL6FM.js} +4 -19
  30. package/{chunk-O3JR45Q2.js → chunk-3VAQHAXT.js} +44 -44
  31. package/{chunk-O5OMJPPF.js → chunk-3WXRAHCG.js} +6 -5
  32. package/{chunk-LAXMH7JY.js → chunk-57QJXIB6.js} +18 -15
  33. package/chunk-5CS33IBL.js +301 -0
  34. package/{chunk-3UGKATZQ.js → chunk-5SBK2MTI.js} +8 -369
  35. package/chunk-6PO2SYCS.js +1800 -0
  36. package/{chunk-TA6EA2A3.js → chunk-6SXC35F4.js} +182 -20
  37. package/{chunk-MXFQHRSS.js → chunk-6XIE5ZGI.js} +1 -1
  38. package/{chunk-3GZT3L6F.js → chunk-73GINUCW.js} +326 -481
  39. package/{chunk-VMWR7VNI.js → chunk-7E72JMBB.js} +7 -7
  40. package/{chunk-4PNU7W7K.js → chunk-AAGCMVFT.js} +106 -124
  41. package/chunk-ADLYMQB6.js +642 -0
  42. package/{chunk-ZWJOGMKH.js → chunk-AETZ7AD6.js} +1 -1
  43. package/{chunk-UDA3ZYLW.js → chunk-AFV4FOT2.js} +70 -24
  44. package/{chunk-BGTUGS3T.js → chunk-AOXVOC6D.js} +4 -30
  45. package/{chunk-2ZRP5RUG.js → chunk-B2BSG6QQ.js} +12 -11
  46. package/{chunk-44HACRCK.js → chunk-BANYWEYY.js} +4 -4
  47. package/{chunk-TOW4E763.js → chunk-BJIRLHJR.js} +2 -0
  48. package/{chunk-ZJ2WITOO.js → chunk-BQXOGBFN.js} +2 -2
  49. package/{chunk-G5GVZAXF.js → chunk-CLP2K7U4.js} +15 -19
  50. package/{chunk-2K4NDPT5.js → chunk-DFUPZE6V.js} +20 -12
  51. package/{chunk-YHGHADBQ.js → chunk-DPMBNHOJ.js} +4 -4
  52. package/chunk-EGRJC4ZN.js +91 -0
  53. package/{chunk-K6QEHQZ3.js → chunk-EKLRRZIN.js} +1 -1
  54. package/{chunk-XFG3BAKN.js → chunk-FMEVI5TG.js} +65 -0
  55. package/{chunk-RH53LMEJ.js → chunk-FSSX3XRY.js} +2 -4
  56. package/{chunk-VP4WJWKW.js → chunk-GM6PU7B6.js} +431 -345
  57. package/{chunk-EEF23OOK.js → chunk-GMXWYXAF.js} +7 -7
  58. package/{chunk-SFWZUTCI.js → chunk-GTYM4HKV.js} +1 -1
  59. package/{chunk-MITD7CON.js → chunk-HDKRSRYU.js} +1461 -301
  60. package/chunk-HS7MLR74.js +38 -0
  61. package/{chunk-3AUWC6EM.js → chunk-HUCT7HID.js} +5 -84
  62. package/{chunk-PTHDLIRB.js → chunk-I6N2UVVY.js} +1 -1
  63. package/chunk-IDAU4UFS.js +437 -0
  64. package/{chunk-Q76I4SXI.js → chunk-IHEC7VBF.js} +1 -1
  65. package/{chunk-OWHNFZNW.js → chunk-IL545V3E.js} +4 -4
  66. package/{chunk-3LY4F7SV.js → chunk-INZZJSQF.js} +348 -331
  67. package/{chunk-CF2WZF4N.js → chunk-J6WH4PYZ.js} +0 -8
  68. package/{chunk-2HXKAPH7.js → chunk-JMPYDFHY.js} +6 -6
  69. package/{chunk-V54H24CQ.js → chunk-JTSGWTYZ.js} +3 -3
  70. package/{chunk-ATK5WJOA.js → chunk-JZ5AMMXU.js} +4 -4
  71. package/chunk-KHCLMKZZ.js +3062 -0
  72. package/{chunk-WHLVPK32.js → chunk-KMSZPTM6.js} +27 -3
  73. package/{chunk-L3GCUVOH.js → chunk-KSRFVP36.js} +1 -1
  74. package/{chunk-DLWCWUNW.js → chunk-LOD75GOS.js} +336 -32
  75. package/{chunk-UOJRKY5J.js → chunk-M2YMQOLC.js} +44 -53
  76. package/chunk-M3JEW6N6.js +193 -0
  77. package/{chunk-XDHHF73Q.js → chunk-M4NC7NF6.js} +95 -95
  78. package/{chunk-3FCNXC2J.js → chunk-MPZJVZDC.js} +3735 -1394
  79. package/{chunk-IXZX5CJK.js → chunk-MQRZ5QUH.js} +1 -1
  80. package/{chunk-3ASDTTEI.js → chunk-MRWGHF56.js} +2 -0
  81. package/{chunk-D34RI6NI.js → chunk-NNWHHCVP.js} +75 -1
  82. package/{chunk-6YABCOFU.js → chunk-NUO3QFWD.js} +1 -1
  83. package/{chunk-GAF5X6B7.js → chunk-O6GEBMIY.js} +269 -309
  84. package/{chunk-CAENRKNJ.js → chunk-OR2HNLVO.js} +126 -88
  85. package/chunk-OW765XBU.js +10 -0
  86. package/chunk-PREQU5QV.js +231 -0
  87. package/{chunk-Q3CSL43H.js → chunk-Q5ITEGIN.js} +1 -1
  88. package/{chunk-7S54ZGF6.js → chunk-RAZOLMJR.js} +256 -12
  89. package/chunk-RCFIB45Q.js +28 -0
  90. package/chunk-RY57GLGW.js +188 -0
  91. package/{chunk-KGEVMUMI.js → chunk-TFPUAELY.js} +11 -11
  92. package/{chunk-ZJH3LKEW.js → chunk-UK5JGQVU.js} +94 -15
  93. package/chunk-URMS4XY2.js +10 -0
  94. package/{chunk-RXVX5LFR.js → chunk-VH2F7ZB6.js} +1 -1
  95. package/chunk-VIDPVFP3.js +20 -0
  96. package/{chunk-W367V5CH.js → chunk-WHD6BG7M.js} +400 -115
  97. package/{chunk-5RDLGLAP.js → chunk-WJSW43QZ.js} +4 -7
  98. package/{chunk-CF7S2RYZ.js → chunk-WLH5BAKX.js} +6 -6
  99. package/{chunk-VVEH6XUE.js → chunk-X2DAEZ3X.js} +1 -1
  100. package/{chunk-2IJAKBK2.js → chunk-X664KVEV.js} +426 -246
  101. package/{chunk-43EPBPZ2.js → chunk-XCCGU6QB.js} +2 -2
  102. package/chunk-Y5GCAMGP.js +9 -0
  103. package/{chunk-V42OE5HT.js → chunk-YDTYDA5W.js} +3 -3
  104. package/chunk-YYLHWIW6.js +48 -0
  105. package/{chunk-AOS5IN2I.js → chunk-ZHYK3N56.js} +1 -1
  106. package/{chunk-ODS2MVMU.js → chunk-ZJMME4DS.js} +19 -303
  107. package/{chunk-PJ2DDQQM.js → chunk-ZURFOV5J.js} +2 -2
  108. package/chunk-ZZ2MH7LE.js +84 -0
  109. package/{cliExecutor-BBUVQU4L.js → cliExecutor-DW3PHGEL.js} +2 -2
  110. package/{clipboardy-BVE3LVEH.js → clipboardy-MMBYVRLF.js} +166 -372
  111. package/{codingSkills-V35TRR4Y.js → codingSkills-DY5MINPG.js} +5 -4
  112. package/{createAgentAutomationAction-WLRNE7C4.js → createAgentAutomationAction-INQT23LX.js} +40 -31
  113. package/createDialogAction-LDCPDI73.js +60 -0
  114. package/{createPageAction-7YROVZ3W.js → createPageAction-5YXOG2M4.js} +56 -47
  115. package/{db-6DPSJ6WT.js → db-3H3JECGY.js} +45 -5
  116. package/{dbSlice-BBL3PEVW.js → dbSlice-3SD5L5H2.js} +13 -12
  117. package/{deleteFile-RJTEPOT4.js → deleteFile-XQXPBFFB.js} +7 -6
  118. package/dialogCommands-CHJO47AX.js +81 -0
  119. package/{dialogSlice-N4HPG6HM.js → dialogSlice-DOWKOILN.js} +36 -29
  120. package/{docCreateCommands-GRA5BHSA.js → docCreateCommands-OVZARUFX.js} +40 -55
  121. package/{docDeleteCommands-ONIJM5MD.js → docDeleteCommands-E2XJ62LD.js} +42 -57
  122. package/{docReadCommands-H55VQ2US.js → docReadCommands-I7OSREPJ.js} +40 -55
  123. package/{docStore-B5AHDNW5.js → docStore-UAWSKZ2Y.js} +39 -30
  124. package/{docUpdateCommands-ZQIQVGC2.js → docUpdateCommands-X4Z26VJM.js} +43 -58
  125. package/{fetchMessages-VPPQDDZ4.js → fetchMessages-7QRCCRYK.js} +3 -3
  126. package/{getPricing-QO5TYNCK.js → getPricing-L2ENXWHV.js} +7 -6
  127. package/{handleSendMessageAction-IN5XX5U7.js → handleSendMessageAction-C3TSDWKH.js} +38 -31
  128. package/index.js +67 -67
  129. package/{lib-FYYBQIXS.js → lib-2ZTNRXR4.js} +432 -183
  130. package/{localDialogRead-3DBXVYXS.js → localDialogRead-SLMPV5SK.js} +2 -2
  131. package/{localRuntimeAuthority-NDUA2D7Y.js → localRuntimeAuthority-E3R24J4T.js} +4 -2
  132. package/{localRuntimeDb-GKYRBWLQ.js → localRuntimeDb-DDZCJFQZ.js} +1 -1
  133. package/{machineCommands-H3UMKE76.js → machineCommands-BUOIYJAD.js} +93 -84
  134. package/{machineWsRunDispatch-HONRUK3R.js → machineWsRunDispatch-7CRWAA6O.js} +83 -74
  135. package/{models-WDUTTYFS.js → models-OX2S5C6Q.js} +2 -2
  136. package/{offlineMarxistsAgentCommand-E6LUG63A.js → offlineMarxistsAgentCommand-GEH6SNNA.js} +1 -1
  137. package/package.json +1 -4
  138. package/{read-64OQDO3I.js → read-6G73BMEY.js} +8 -7
  139. package/{readDocTool-MXM3T6PE.js → readDocTool-DK4EI2GA.js} +1 -2
  140. package/{readlineWorkspace-XVJZDCSC.js → readlineWorkspace-ZDWEASJV.js} +265 -428
  141. package/{removeDialogAgentAction-NEKVAMSH.js → removeDialogAgentAction-E7H557UO.js} +19 -17
  142. package/{runAgentClientLoop-H7U53QB6.js → runAgentClientLoop-U7HYA3O5.js} +72 -64
  143. package/{runtimeDoctorCommands-WI2YZUSJ.js → runtimeDoctorCommands-KIKM6BIO.js} +5 -5
  144. package/{setDialogExtraReferencesAction-WTOHQDIV.js → setDialogExtraReferencesAction-RMMGBR5F.js} +15 -14
  145. package/{setPrimaryDialogAgentAction-LDJOYC4F.js → setPrimaryDialogAgentAction-FWBKKLVA.js} +19 -17
  146. package/{settingSlice-4M37TN7V.js → settingSlice-73PV4KG4.js} +16 -14
  147. package/{skillDiscovery-5U6RYAHN.js → skillDiscovery-KLLKXPUO.js} +4 -4
  148. package/{slateUtils-2M7MUTWX.js → slateUtils-VO2FU36K.js} +1 -1
  149. package/{spaceCommands-7VVKJBDV.js → spaceCommands-GEWZXGHM.js} +43 -240
  150. package/{spaceSlice-T6YK6D34.js → spaceSlice-B6MOVY4N.js} +38 -61
  151. package/{streamAgentChatTurn-RQ63QFQ7.js → streamAgentChatTurn-T527EQTT.js} +1261 -150
  152. package/{switchDialogAgentAction-XVWGKR2Z.js → switchDialogAgentAction-US6QNL3N.js} +14 -13
  153. package/syncMapping-RK2MANUX.js +43 -0
  154. package/{tableCommands-RJZ3V4TF.js → tableCommands-QE47K72R.js} +8 -7
  155. package/{toolApiClient-ARGFDJAG.js → toolApiClient-B2MFXMEG.js} +3 -3
  156. package/tools-XMWCVMPM.js +98 -0
  157. package/{tuiSummaryLlmCaller-SRZ4QQUP.js → tuiSummaryLlmCaller-NCAJSVSD.js} +24 -21
  158. package/{updateDialogTitleAction-BBDSWHNG.js → updateDialogTitleAction-XPJZRJEL.js} +48 -38
  159. package/agentRecordCommands-JFZRQJQ4.js +0 -103
  160. package/agentRunCommand-NOX5FLKO.js +0 -121
  161. package/chunk-AYMOSAHE.js +0 -3158
  162. package/chunk-D2BPX6DQ.js +0 -1707
  163. package/chunk-DCDL3GC4.js +0 -171
  164. package/chunk-F3MP7CP6.js +0 -73
  165. package/chunk-WZSRQNQG.js +0 -2587
  166. package/createDialogAction-Y6YV64QB.js +0 -52
  167. package/dialogCommands-XLO5CAHZ.js +0 -95
  168. package/tools-KYZX3BGO.js +0 -90
  169. package/{chunk-Z5MXSEOJ.js → chunk-RQSOAMPJ.js} +2 -2
  170. package/{chunk-JDSUTNYY.js → chunk-SAQQLJZ5.js} +3 -3
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-M76ECQRD.js";
4
4
  import {
5
5
  getActiveDialogKey
6
- } from "./chunk-3ASDTTEI.js";
6
+ } from "./chunk-MRWGHF56.js";
7
7
  import {
8
8
  patch,
9
9
  selectById
10
- } from "./chunk-LAXMH7JY.js";
10
+ } from "./chunk-57QJXIB6.js";
11
11
  import {
12
12
  __toESM
13
13
  } from "./chunk-4VNS5WPM.js";
@@ -0,0 +1,9 @@
1
+ // packages/core/positiveFiniteNumberOrFallback.ts
2
+ function parsePositiveFiniteNumberOrFallback(value, fallback) {
3
+ const parsed = Number(value);
4
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
5
+ }
6
+
7
+ export {
8
+ parsePositiveFiniteNumberOrFallback
9
+ };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  buildLocalAgentLookupKeys,
3
3
  shouldReadAgentKeyRemotely
4
- } from "./chunk-VVEH6XUE.js";
4
+ } from "./chunk-X2DAEZ3X.js";
5
5
  import {
6
6
  resolveCliAgentKeyInput
7
- } from "./chunk-K6QEHQZ3.js";
7
+ } from "./chunk-EKLRRZIN.js";
8
8
  import {
9
9
  toErrorMessage
10
10
  } from "./chunk-HNMXYYJR.js";
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-A7GB5UGH.js";
22
22
  import {
23
23
  createAgentKey
24
- } from "./chunk-WHLVPK32.js";
24
+ } from "./chunk-KMSZPTM6.js";
25
25
 
26
26
  // packages/cli/agentRecordHelpers.ts
27
27
  import { readFileSync } from "node:fs";
@@ -0,0 +1,48 @@
1
+ import {
2
+ asTrimmedLowercaseString
3
+ } from "./chunk-QSJ3HFEF.js";
4
+
5
+ // packages/agent-runtime/serverProxyPolicy.ts
6
+ var OAUTH_APIKEY_REFS = /* @__PURE__ */ new Set([
7
+ "antigravity",
8
+ "xai",
9
+ "chatgpt",
10
+ "claude",
11
+ "cursor"
12
+ ]);
13
+ function isGoogleFamilyProvider(provider) {
14
+ const normalized = asTrimmedLowercaseString(provider);
15
+ return normalized === "google" || normalized.startsWith("google-");
16
+ }
17
+ function isOAuthApiKeyRef(value) {
18
+ const ref = asTrimmedLowercaseString(value);
19
+ return ref.length > 0 && OAUTH_APIKEY_REFS.has(ref);
20
+ }
21
+ function shouldUseServerProxy(agentConfig, requestProvider) {
22
+ const effectiveProvider = (requestProvider || agentConfig.provider || "").toLowerCase();
23
+ if (isGoogleFamilyProvider(effectiveProvider)) {
24
+ return true;
25
+ }
26
+ if (isOAuthApiKeyRef(agentConfig.apiKeyRef)) {
27
+ return true;
28
+ }
29
+ if (agentConfig.apiSource === "custom" && isRemoteCustomEndpoint(agentConfig.customProviderUrl)) {
30
+ return true;
31
+ }
32
+ return !!agentConfig.useServerProxy;
33
+ }
34
+ var LOCAL_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "0.0.0.0"]);
35
+ function isRemoteCustomEndpoint(url) {
36
+ if (typeof url !== "string") return false;
37
+ try {
38
+ const host = new URL(url).hostname.toLowerCase();
39
+ return !LOCAL_HOSTS.has(host);
40
+ } catch {
41
+ return false;
42
+ }
43
+ }
44
+
45
+ export {
46
+ isOAuthApiKeyRef,
47
+ shouldUseServerProxy
48
+ };
@@ -2,7 +2,7 @@ import {
2
2
  LOCAL_CODEX_AGENT_KEY,
3
3
  isLocalCliAgentKey,
4
4
  resolveCliAgentKeyInput
5
- } from "./chunk-K6QEHQZ3.js";
5
+ } from "./chunk-EKLRRZIN.js";
6
6
  import {
7
7
  DEFAULT_NOLO_SERVER_URL
8
8
  } from "./chunk-OLZBQWZU.js";
@@ -1,6 +1,9 @@
1
1
  import {
2
- getCredentialsDir
3
- } from "./chunk-JZPBVBIY.js";
2
+ applyAgentSecretMigrationUpdates,
3
+ createFileCredentialBroker,
4
+ migrateAgentSecrets,
5
+ normalizeAgentRuntimeToolPolicy
6
+ } from "./chunk-5CS33IBL.js";
4
7
  import {
5
8
  asRecordOrEmpty
6
9
  } from "./chunk-KX6YBIHG.js";
@@ -8,28 +11,19 @@ import {
8
11
  patch,
9
12
  remove,
10
13
  write
11
- } from "./chunk-LAXMH7JY.js";
14
+ } from "./chunk-57QJXIB6.js";
15
+ import {
16
+ createAgentKey,
17
+ toTrimmedString
18
+ } from "./chunk-KMSZPTM6.js";
12
19
  import {
13
20
  asyncThunkCreator,
14
21
  buildCreateSlice,
15
22
  getRuntimeServerContext
16
- } from "./chunk-2IJAKBK2.js";
17
- import {
18
- createAgentKey,
19
- toTrimmedString
20
- } from "./chunk-WHLVPK32.js";
23
+ } from "./chunk-X664KVEV.js";
21
24
  import {
22
25
  asTrimmedString
23
26
  } from "./chunk-3EUW3WEO.js";
24
- import {
25
- asOptionalPositiveFiniteNumber
26
- } from "./chunk-U6VC4MU4.js";
27
- import {
28
- isRecord
29
- } from "./chunk-KUG52IAP.js";
30
- import {
31
- asNonEmptyStringArray
32
- } from "./chunk-I42VC5KR.js";
33
27
  import {
34
28
  asOptionalTrimmedString
35
29
  } from "./chunk-G3SUCT4W.js";
@@ -89,283 +83,6 @@ var sanitizeOptionalModelString = (value) => {
89
83
 
90
84
  // packages/ai/agent/agentSlice.ts
91
85
  import { ulid } from "ulid";
92
-
93
- // packages/agent-runtime/fileCredentialBroker.ts
94
- import {
95
- chmodSync,
96
- existsSync,
97
- mkdirSync,
98
- readFileSync,
99
- unlinkSync,
100
- writeFileSync
101
- } from "node:fs";
102
- import { homedir } from "node:os";
103
- import { join } from "node:path";
104
-
105
- // packages/agent-runtime/credentialBroker.ts
106
- function assertCredentialRef(ref) {
107
- const trimmed = asTrimmedString(ref);
108
- if (!trimmed) {
109
- throw new Error("invalid_ref");
110
- }
111
- if (trimmed.includes("..") || trimmed.includes("/") || trimmed.includes("\\")) {
112
- throw new Error("invalid_ref");
113
- }
114
- return trimmed;
115
- }
116
-
117
- // packages/agent-runtime/fileCredentialBroker.ts
118
- function getApiKeyCredentialsDir(homeDir = homedir()) {
119
- return join(getCredentialsDir(homeDir), "keys");
120
- }
121
- function credentialRefToFileName(ref) {
122
- const safe = assertCredentialRef(ref).replace(/[^a-zA-Z0-9._-]+/g, "_");
123
- if (!safe || safe === "." || safe === "..") {
124
- throw new Error(`Credential ref is not filesystem-safe: ${ref}`);
125
- }
126
- return `${safe}.json`;
127
- }
128
- function getApiKeyCredentialPath(ref, homeDir = homedir()) {
129
- return join(getApiKeyCredentialsDir(homeDir), credentialRefToFileName(ref));
130
- }
131
- function ensurePrivateDir(dir) {
132
- mkdirSync(dir, { recursive: true, mode: 448 });
133
- try {
134
- chmodSync(dir, 448);
135
- } catch {
136
- }
137
- }
138
- function writePrivateFile(path, body) {
139
- writeFileSync(path, body, { encoding: "utf8", mode: 384 });
140
- try {
141
- chmodSync(path, 384);
142
- } catch {
143
- }
144
- }
145
- function readApiKeyCredential(ref, homeDir = homedir()) {
146
- const path = getApiKeyCredentialPath(ref, homeDir);
147
- if (!existsSync(path)) return null;
148
- try {
149
- const raw = readFileSync(path, "utf8");
150
- const parsed = JSON.parse(raw);
151
- if (typeof parsed?.secret !== "string" || !parsed.secret) return null;
152
- return parsed.secret;
153
- } catch {
154
- return null;
155
- }
156
- }
157
- function writeApiKeyCredential(ref, secret, homeDir = homedir(), now = Date.now()) {
158
- const trimmedSecret = secret.trim();
159
- if (!trimmedSecret) {
160
- throw new Error("Cannot store an empty credential secret.");
161
- }
162
- assertCredentialRef(ref);
163
- const dir = getApiKeyCredentialsDir(homeDir);
164
- ensurePrivateDir(dir);
165
- const path = getApiKeyCredentialPath(ref, homeDir);
166
- const payload = {
167
- secret: trimmedSecret,
168
- updatedAt: now
169
- };
170
- writePrivateFile(path, `${JSON.stringify(payload, null, 2)}
171
- `);
172
- }
173
- function removeApiKeyCredential(ref, homeDir = homedir()) {
174
- assertCredentialRef(ref);
175
- const path = getApiKeyCredentialPath(ref, homeDir);
176
- if (!existsSync(path)) return;
177
- unlinkSync(path);
178
- }
179
- function hasApiKeyCredential(ref, homeDir = homedir()) {
180
- return readApiKeyCredential(ref, homeDir) !== null;
181
- }
182
- function createFileCredentialBroker(options = {}) {
183
- const homeDir = options.homeDir ?? homedir();
184
- const now = options.now ?? Date.now;
185
- return {
186
- get(ref) {
187
- return readApiKeyCredential(ref, homeDir);
188
- },
189
- put(ref, secret) {
190
- writeApiKeyCredential(ref, secret, homeDir, now());
191
- },
192
- delete(ref) {
193
- removeApiKeyCredential(ref, homeDir);
194
- },
195
- has(ref) {
196
- return hasApiKeyCredential(ref, homeDir);
197
- }
198
- };
199
- }
200
-
201
- // packages/agent-runtime/migrateAgentSecrets.ts
202
- function buildAgentApiKeyCredentialRef(agentKey) {
203
- const key = asTrimmedString(agentKey);
204
- if (!key) throw new Error("agentKey is required to build a credential ref.");
205
- return `api-key:${key}`;
206
- }
207
- function readRawApiKey(agent) {
208
- return asTrimmedString(agent.apiKey);
209
- }
210
- function resolveTargetRef(agent) {
211
- const fromCredential = asTrimmedString(agent.credentialRef);
212
- if (fromCredential) return fromCredential;
213
- const fromApiKeyRef = asTrimmedString(agent.apiKeyRef);
214
- if (fromApiKeyRef.startsWith("api-key:")) return fromApiKeyRef;
215
- return buildAgentApiKeyCredentialRef(agent.key);
216
- }
217
- async function brokerHas(broker, ref) {
218
- return Boolean(await broker.has(ref));
219
- }
220
- async function brokerPut(broker, ref, secret) {
221
- await broker.put(ref, secret);
222
- }
223
- async function migrateAgentSecrets(args) {
224
- const { agent, broker } = args;
225
- const raw = readRawApiKey(agent);
226
- const migration = asTrimmedString(agent.credentialMigration);
227
- if (migration === "done" && !raw) {
228
- const ref = typeof agent.credentialRef === "string" && agent.credentialRef.trim() || (typeof agent.apiKeyRef === "string" && agent.apiKeyRef.startsWith("api-key:") ? agent.apiKeyRef.trim() : "") || void 0;
229
- return {
230
- updates: {},
231
- status: "already-done",
232
- ...ref ? { credentialRef: ref } : {},
233
- phase: "complete"
234
- };
235
- }
236
- if (!raw && migration !== "pending") {
237
- return { updates: {}, status: "noop", phase: "none" };
238
- }
239
- const targetRef = resolveTargetRef(agent);
240
- if (raw) {
241
- await brokerPut(broker, targetRef, raw);
242
- const stored2 = await brokerHas(broker, targetRef);
243
- if (!stored2) {
244
- return {
245
- updates: {
246
- credentialRef: targetRef,
247
- credentialMigration: "pending"
248
- },
249
- status: "resumed-pending",
250
- credentialRef: targetRef,
251
- phase: "put"
252
- };
253
- }
254
- return {
255
- updates: {
256
- apiKey: null,
257
- credentialRef: targetRef,
258
- // Keep apiKeyRef for resolution if not already an OAuth provider name.
259
- // Prefer explicit credentialRef; set apiKeyRef only when empty so OAuth agents stay intact.
260
- ...!(typeof agent.apiKeyRef === "string" && agent.apiKeyRef.trim()) ? { apiKeyRef: targetRef } : {},
261
- credentialMigration: "done"
262
- },
263
- status: migration === "pending" ? "resumed-pending" : "migrated",
264
- credentialRef: targetRef,
265
- phase: "strip"
266
- };
267
- }
268
- const stored = await brokerHas(broker, targetRef);
269
- if (stored) {
270
- return {
271
- updates: {
272
- credentialRef: targetRef,
273
- credentialMigration: "done",
274
- ...!(typeof agent.apiKeyRef === "string" && agent.apiKeyRef.trim()) ? { apiKeyRef: targetRef } : {}
275
- },
276
- status: "resumed-pending",
277
- credentialRef: targetRef,
278
- phase: "complete"
279
- };
280
- }
281
- return {
282
- updates: {
283
- credentialRef: targetRef,
284
- credentialMigration: "pending"
285
- },
286
- status: "awaiting-secret",
287
- credentialRef: targetRef,
288
- phase: "put"
289
- };
290
- }
291
- function applyAgentSecretMigrationUpdates(record, updates) {
292
- const next = { ...record };
293
- if ("apiKey" in updates) {
294
- if (updates.apiKey === null || updates.apiKey === "") {
295
- delete next.apiKey;
296
- } else if (typeof updates.apiKey === "string") {
297
- next.apiKey = updates.apiKey;
298
- }
299
- }
300
- if (updates.apiKeyRef !== void 0) next.apiKeyRef = updates.apiKeyRef;
301
- if (updates.credentialRef !== void 0) next.credentialRef = updates.credentialRef;
302
- if (updates.credentialMigration !== void 0) {
303
- next.credentialMigration = updates.credentialMigration;
304
- }
305
- return next;
306
- }
307
-
308
- // packages/agent-runtime/runtimeToolPolicy.ts
309
- function unique(values) {
310
- return [...new Set(values)];
311
- }
312
- function normalizeAgentRuntimeToolPolicy(value) {
313
- if (!isRecord(value)) return void 0;
314
- return {
315
- version: 1,
316
- ...asNonEmptyStringArray(value.agentTools).length ? { agentTools: unique(asNonEmptyStringArray(value.agentTools)) } : {},
317
- ...asNonEmptyStringArray(value.runtimeTools).length ? { runtimeTools: unique(asNonEmptyStringArray(value.runtimeTools)) } : {},
318
- ...isRecord(value.workspace) ? { workspace: { ...value.workspace } } : {},
319
- ...isRecord(value.shell) ? { shell: { ...value.shell } } : {},
320
- ...isRecord(value.isolation) ? { isolation: { ...value.isolation } } : {},
321
- ...isRecord(value.git) ? { git: { ...value.git } } : {},
322
- ...isRecord(value.budget) ? { budget: { ...value.budget } } : {},
323
- ...isRecord(value.audit) ? { audit: { ...value.audit } } : {}
324
- };
325
- }
326
- function runtimeBindingRecord(runtimeBinding) {
327
- return isRecord(runtimeBinding) ? runtimeBinding : void 0;
328
- }
329
- function runtimeToolNamesFromPolicy(policy) {
330
- return asNonEmptyStringArray(policy?.runtimeTools);
331
- }
332
- function readPositiveNumber(value) {
333
- return asOptionalPositiveFiniteNumber(Number(value));
334
- }
335
- function resolveRequestedRuntimeToolNames(args) {
336
- const runtimeBinding = runtimeBindingRecord(args.agentConfig.runtimeBinding);
337
- const bindingPolicy = normalizeAgentRuntimeToolPolicy(
338
- runtimeBinding?.runtimeToolPolicy
339
- );
340
- const bindingSnapshotPolicy = normalizeAgentRuntimeToolPolicy(
341
- runtimeBinding?.runtimeToolPolicySnapshot
342
- );
343
- return unique([
344
- ...asNonEmptyStringArray(args.agentConfig.toolNames),
345
- ...runtimeToolNamesFromPolicy(
346
- normalizeAgentRuntimeToolPolicy(args.agentConfig.runtimeToolPolicy)
347
- ),
348
- ...runtimeToolNamesFromPolicy(bindingPolicy),
349
- ...runtimeToolNamesFromPolicy(bindingSnapshotPolicy)
350
- ]);
351
- }
352
- function resolveCurrentRunRuntimeToolPolicy(agentConfig) {
353
- const runtimeBinding = runtimeBindingRecord(agentConfig?.runtimeBinding);
354
- return normalizeAgentRuntimeToolPolicy(
355
- runtimeBinding?.runtimeToolPolicySnapshot ?? agentConfig?.runtimeToolPolicy ?? runtimeBinding?.runtimeToolPolicy
356
- );
357
- }
358
- function resolveLocalRuntimeEnvFromPolicy(runtimeEnv, policy) {
359
- return { ...runtimeEnv };
360
- }
361
- function resolveLocalWorkspaceExecutorOptionsFromPolicy(policy) {
362
- const maxOutputBytes = readPositiveNumber(policy?.shell?.maxOutputBytes);
363
- return {
364
- ...maxOutputBytes ? { commandOutputLimit: Math.floor(maxOutputBytes) } : {}
365
- };
366
- }
367
-
368
- // packages/ai/agent/agentSlice.ts
369
86
  var createAgentCredentialBroker = createFileCredentialBroker;
370
87
  function setAgentCredentialBrokerFactoryForTests(factory) {
371
88
  createAgentCredentialBroker = factory ?? createFileCredentialBroker;
@@ -445,6 +162,10 @@ var processAgentCreateForm = (formData, userId) => {
445
162
  if ("provider" in result) {
446
163
  result.provider = sanitizeOptionalModelString(result.provider);
447
164
  }
165
+ if ("cliProvider" in result) {
166
+ const cp = result.cliProvider;
167
+ result.cliProvider = cp || null;
168
+ }
448
169
  return result;
449
170
  };
450
171
  var processAgentUpdateChanges = (data, userId, previousAgent) => {
@@ -477,7 +198,7 @@ var processAgentUpdateChanges = (data, userId, previousAgent) => {
477
198
  changes.apiSource = data.apiSource;
478
199
  }
479
200
  if ("cliProvider" in data) {
480
- changes.cliProvider = data.cliProvider || "";
201
+ changes.cliProvider = data.cliProvider || null;
481
202
  }
482
203
  if ("machineId" in data) {
483
204
  const machineId = String(data.machineId ?? "").trim();
@@ -583,7 +304,7 @@ var slice = createSliceWithThunks({
583
304
  const overrides = {};
584
305
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
585
306
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
586
- const { _executeModel } = await import("./_executeModel-LTMSIBS4.js");
307
+ const { _executeModel } = await import("./_executeModel-RWPVI3YV.js");
587
308
  return _executeModel(
588
309
  {
589
310
  isStreaming: args.isStreaming ?? false,
@@ -604,7 +325,7 @@ var slice = createSliceWithThunks({
604
325
  * - 循环直到无工具调用或触发其他运行时停止条件
605
326
  */
606
327
  runAgent: create.asyncThunk(async (args, thunkApi) => {
607
- const { runAgentClientLoop } = await import("./runAgentClientLoop-H7U53QB6.js");
328
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-U7HYA3O5.js");
608
329
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
609
330
  {
610
331
  agentKey: args.agentKey,
@@ -620,7 +341,7 @@ var slice = createSliceWithThunks({
620
341
  * 聊天轮次流式 Agent 调用
621
342
  */
622
343
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
623
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-RQ63QFQ7.js");
344
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-T527EQTT.js");
624
345
  return streamAgentChatTurnHandler(args, thunkApi);
625
346
  }),
626
347
  /**
@@ -846,11 +567,6 @@ var agentSlice_default = agentReducer;
846
567
  export {
847
568
  fetchServerSyncedCredential,
848
569
  deleteServerSyncedCredential,
849
- createFileCredentialBroker,
850
- resolveRequestedRuntimeToolNames,
851
- resolveCurrentRunRuntimeToolPolicy,
852
- resolveLocalRuntimeEnvFromPolicy,
853
- resolveLocalWorkspaceExecutorOptionsFromPolicy,
854
570
  setAgentCredentialBrokerFactoryForTests,
855
571
  slice,
856
572
  runLlm,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  buildSkillDiscoveryLayer
3
- } from "./chunk-DOISARTV.js";
3
+ } from "./chunk-2UECQ7RE.js";
4
4
  import {
5
5
  load
6
- } from "./chunk-WZSRQNQG.js";
6
+ } from "./chunk-KHCLMKZZ.js";
7
7
 
8
8
  // packages/agent-runtime/skillDiscovery.ts
9
9
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
@@ -0,0 +1,84 @@
1
+ // packages/agent-runtime/toolNameAliases.ts
2
+ var LEGACY_TOOL_NAME_ALIASES = {
3
+ createPage: "createDoc",
4
+ updatePage: "updateDoc",
5
+ update_page: "updateDoc",
6
+ create_page: "createDoc",
7
+ fetchwebpage: "fetchWebpage",
8
+ fetch_webpage: "fetchWebpage",
9
+ "fetch-page": "fetchWebpage",
10
+ exasearch: "exa_search",
11
+ "exa-search": "exa_search",
12
+ exa_search: "exa_search",
13
+ firecrawlscrape: "firecrawl_scrape",
14
+ "firecrawl-scrape": "firecrawl_scrape",
15
+ firecrawl_scrape: "firecrawl_scrape",
16
+ firecrawlsearch: "firecrawl_search",
17
+ "firecrawl-search": "firecrawl_search",
18
+ firecrawl_search: "firecrawl_search",
19
+ readDoc: "readDoc",
20
+ readpage: "readDoc",
21
+ read_page: "readDoc",
22
+ read_doc: "readDoc",
23
+ createdoc: "createDoc",
24
+ updateDocTool: "updateDoc",
25
+ terminalCommand: "execShell",
26
+ terminal_command: "execShell",
27
+ runCommand: "execShell",
28
+ run_command: "execShell",
29
+ runInBash: "execShell",
30
+ run_in_bash: "execShell",
31
+ executeCommand: "execShell",
32
+ execute_command: "execShell",
33
+ // Codex CLI 风格工具名 → nolo 原生工具名
34
+ bash: "execShell",
35
+ shell: "execShell",
36
+ read: "readFile",
37
+ edit: "editFile",
38
+ write: "writeFile",
39
+ glob: "globFiles",
40
+ grep: "searchFiles",
41
+ // 联网搜索别名
42
+ web_search: "exa_search",
43
+ websearch: "exa_search",
44
+ search_web: "exa_search",
45
+ searchweb: "exa_search",
46
+ webfetch: "fetchWebpage",
47
+ web_fetch: "fetchWebpage",
48
+ fetchweb: "fetchWebpage",
49
+ fetch_web: "fetchWebpage",
50
+ // 模型偶尔会把 loadSkill 幻觉成 readSkill(参数风格 name= 一致),
51
+ // 规范化到 loadSkill,避免 localToolPolicy 把这种调用直接拦死。
52
+ readSkill: "loadSkill"
53
+ };
54
+ var normalizeToolName = (name) => name.replace(/[-_]/g, "").toLowerCase();
55
+ var canonicalizeToolName = (rawName) => {
56
+ const trimmedName = rawName.trim();
57
+ if (!trimmedName) return rawName;
58
+ if (LEGACY_TOOL_NAME_ALIASES[trimmedName]) {
59
+ return LEGACY_TOOL_NAME_ALIASES[trimmedName];
60
+ }
61
+ const normalizedRawName = normalizeToolName(trimmedName);
62
+ const matchedAlias = Object.entries(LEGACY_TOOL_NAME_ALIASES).find(
63
+ ([alias]) => normalizeToolName(alias) === normalizedRawName
64
+ );
65
+ return matchedAlias?.[1] ?? trimmedName;
66
+ };
67
+ var canonicalizeToolNames = (toolNames) => Array.from(
68
+ new Set(
69
+ toolNames.filter((toolName) => typeof toolName === "string").map(canonicalizeToolName)
70
+ )
71
+ );
72
+ var prioritizeToolNames = (toolNames, preferredToolNames) => {
73
+ const canonicalTools = canonicalizeToolNames(toolNames);
74
+ const preferred = new Set(canonicalizeToolNames(preferredToolNames));
75
+ const prioritized = canonicalTools.filter((toolName) => preferred.has(toolName));
76
+ const remaining = canonicalTools.filter((toolName) => !preferred.has(toolName));
77
+ return [...prioritized, ...remaining];
78
+ };
79
+
80
+ export {
81
+ canonicalizeToolName,
82
+ canonicalizeToolNames,
83
+ prioritizeToolNames
84
+ };
@@ -12,11 +12,11 @@ import {
12
12
  isBufferedCliStreamingProvider,
13
13
  materializeCliImageInputs,
14
14
  startCliSession
15
- } from "./chunk-JDSUTNYY.js";
16
- import "./chunk-JBTJAPUF.js";
15
+ } from "./chunk-SAQQLJZ5.js";
17
16
  import {
18
17
  buildCliPrompt
19
18
  } from "./chunk-ATNTHIZI.js";
19
+ import "./chunk-JBTJAPUF.js";
20
20
  import "./chunk-4VNS5WPM.js";
21
21
  export {
22
22
  CLI_PROBE_BINARIES,