nolo-cli 0.211.0 → 0.212.0-alpha.1

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 (158) hide show
  1. package/{_executeModel-VVQEOY3D.js → _executeModel-KE6MBNUJ.js} +51 -48
  2. package/{action-U235TV4P.js → action-DF5UYSJF.js} +4 -4
  3. package/{addContentAction-7C76J7ST.js → addContentAction-N2YC5IL3.js} +8 -8
  4. package/{addDialogAgentAction-KTYANUEC.js → addDialogAgentAction-3NKVQCEC.js} +15 -12
  5. package/{agentDeleteCommand-WHRU6VDJ.js → agentDeleteCommand-NWK7VU4N.js} +71 -67
  6. package/{agentEmailCommands-ALLHXPW3.js → agentEmailCommands-UZ4DHEX2.js} +77 -72
  7. package/{agentListCommands-POKMEKMS.js → agentListCommands-HE7L2A6L.js} +190 -77
  8. package/{agentMachineCommands-WJLZLBPI.js → agentMachineCommands-6TE4MBMP.js} +30 -29
  9. package/{agentProviderCommands-MN3ABDME.js → agentProviderCommands-Q5O33MED.js} +33 -4
  10. package/{agentRecordCommands-OULZW3KM.js → agentRecordCommands-L3QQ7HZ4.js} +66 -61
  11. package/{agentRunCommand-ZNG4LGNQ.js → agentRunCommand-2IFGQHCO.js} +68 -64
  12. package/{agentRunControl-AF7BMR22.js → agentRunControl-OI3LOENH.js} +7 -6
  13. package/{agentRuntimeLocal-YMUHFV5M.js → agentRuntimeLocal-HL526DNQ.js} +28 -25
  14. package/{agentSlice-WNGUIMQZ.js → agentSlice-TMYP2UEA.js} +12 -12
  15. package/{appDeleteCommands-6MXPLAVF.js → appDeleteCommands-ZERW4AXY.js} +30 -29
  16. package/{appDeployCommands-ERRSVASW.js → appDeployCommands-DUWSMYHL.js} +30 -29
  17. package/{appDeployStatusCommands-ULICISLI.js → appDeployStatusCommands-N2KIE4BF.js} +30 -29
  18. package/{appGetCommands-WYYYWROF.js → appGetCommands-YVR4NPVY.js} +30 -29
  19. package/{appListCommands-DFCUCRCV.js → appListCommands-JS6HOHZS.js} +30 -29
  20. package/{authCommand-ZJMWXFMA.js → authCommand-FE2C3ZUM.js} +14 -14
  21. package/{authCommands-WK6E42L2.js → authCommands-HV3EAU3V.js} +2 -2
  22. package/{builtinSkillRegistry-HH75G5J3.js → builtinSkillRegistry-3YOIGEF6.js} +5 -4
  23. package/{chunk-JKW6LERJ.js → chunk-22CIEBYO.js} +14 -14
  24. package/{chunk-6HVBI6TI.js → chunk-25JZEIXN.js} +1 -218
  25. package/{chunk-TRZP7JZ7.js → chunk-2QHFH3DR.js} +1 -0
  26. package/{chunk-4LEGTOSR.js → chunk-3AKFVZ2I.js} +1 -1
  27. package/{chunk-XE4Q46FF.js → chunk-3CGG2PAL.js} +1 -1
  28. package/{chunk-25M2K6OA.js → chunk-3FOQHGHN.js} +3 -3
  29. package/{chunk-BSISWVB4.js → chunk-4I7ERB7F.js} +1 -1
  30. package/{chunk-TCTSYFDM.js → chunk-4KH4J3G5.js} +19 -6
  31. package/{chunk-NEZGPBL7.js → chunk-5AQR3DGV.js} +2 -2
  32. package/{chunk-YLTLB5A7.js → chunk-5RYBGBQH.js} +7 -6
  33. package/{chunk-RIALQUSF.js → chunk-6NSSLV67.js} +5 -5
  34. package/{chunk-RXCCWVA2.js → chunk-6OQUPIQF.js} +3 -3
  35. package/chunk-6VLJ6YA7.js +11751 -0
  36. package/{chunk-27E2CBBY.js → chunk-7OCO4TDT.js} +1 -1
  37. package/chunk-7RFNTILS.js +2213 -0
  38. package/{chunk-4WCEC56C.js → chunk-AVTVGMDY.js} +1 -1
  39. package/{chunk-3J3U3KXB.js → chunk-B7NJ3T4A.js} +4 -4
  40. package/{chunk-UMEGDH6A.js → chunk-BFM34N54.js} +7 -7
  41. package/chunk-CJEIOP3E.js +0 -0
  42. package/{chunk-YXOBCDNW.js → chunk-CJRONOYL.js} +5 -5
  43. package/{chunk-LT3EAHJY.js → chunk-CQ46IRNN.js} +38 -36
  44. package/{chunk-NTSRCTUX.js → chunk-CTPXME7U.js} +2 -2
  45. package/{chunk-M4NTDZG3.js → chunk-D5RCRX4A.js} +134 -141
  46. package/{chunk-25OB36GU.js → chunk-DM6UMOEL.js} +4 -4
  47. package/{chunk-TPCDYNJK.js → chunk-EYUBHHFB.js} +1 -1
  48. package/{chunk-Y6M7KJOA.js → chunk-EZFQ6XRV.js} +2 -2
  49. package/{chunk-ZOO3WJIE.js → chunk-FHU44LN3.js} +711 -40
  50. package/chunk-FY7F4Q6X.js +127 -0
  51. package/chunk-G7MLNNEX.js +84 -0
  52. package/{chunk-RYWO5AKN.js → chunk-GNDJKC4B.js} +10 -10
  53. package/{chunk-V3M6IXQI.js → chunk-GPO7FCEZ.js} +187 -36
  54. package/{chunk-RQ22OZD7.js → chunk-H2TJUNCH.js} +1 -1
  55. package/{chunk-C2XZM3K4.js → chunk-HIRC32DV.js} +5 -24
  56. package/{chunk-QQM464AL.js → chunk-HPFCI4SK.js} +3 -3
  57. package/chunk-HRMJUN5J.js +26 -0
  58. package/{chunk-HD3WR3TD.js → chunk-IAPCBNEE.js} +1 -1
  59. package/{chunk-XDMGY5IU.js → chunk-IF45XG7K.js} +220 -9
  60. package/{chunk-NLT32XBZ.js → chunk-IIQ6JGRI.js} +2 -2
  61. package/{chunk-OP7PTBAJ.js → chunk-IJXYFTV7.js} +8 -8
  62. package/{chunk-IIHY4ZAI.js → chunk-INSBKSBB.js} +8 -4
  63. package/{chunk-PAFTGNWA.js → chunk-JIT6FSXJ.js} +1 -1
  64. package/{chunk-WTKYP6QO.js → chunk-JTDORD5P.js} +5 -5
  65. package/{chunk-ECX3NKRD.js → chunk-JY5NGFFH.js} +11 -0
  66. package/chunk-KC4XDTT3.js +227 -0
  67. package/{chunk-PLYWH7XM.js → chunk-KIM6CLW5.js} +7 -7
  68. package/{chunk-SCYQJPGA.js → chunk-M6RL5JCD.js} +147 -20
  69. package/chunk-MMA3LZ3W.js +105 -0
  70. package/{chunk-I5PBXF7O.js → chunk-MMNYUVLW.js} +1 -1
  71. package/{chunk-NHQKWPLP.js → chunk-NJR3WKVP.js} +24 -22
  72. package/{chunk-W5VC7F7V.js → chunk-NOMIGOST.js} +59 -60
  73. package/{chunk-WI6OGHXJ.js → chunk-NRFKLKRU.js} +5 -5
  74. package/{chunk-NXCGNS4N.js → chunk-OHNELDTO.js} +1 -1
  75. package/{chunk-7IYBN7IA.js → chunk-OOF4UPC5.js} +22 -13
  76. package/{chunk-UIOEHFF6.js → chunk-OQHIVPG4.js} +1 -0
  77. package/{chunk-X4F26D5K.js → chunk-P5L7CXOC.js} +58 -33
  78. package/{chunk-5ORJGHTL.js → chunk-PDGKOTO7.js} +5 -5
  79. package/{chunk-UCPAVEQB.js → chunk-PYRUW7XN.js} +1 -1
  80. package/{chunk-SU3QL7YG.js → chunk-QT6PKHYJ.js} +1 -1
  81. package/{chunk-SN5XE6GQ.js → chunk-RPQXPZZF.js} +4 -4
  82. package/{chunk-ZN5AH4BY.js → chunk-RU4SD66C.js} +6 -6
  83. package/{chunk-YKFP6UGT.js → chunk-SOHTHFV2.js} +14 -14
  84. package/{chunk-CKOO42G5.js → chunk-UHJGXRJ4.js} +4 -4
  85. package/{chunk-CVCRAO6Q.js → chunk-UTV2AYEG.js} +9 -7
  86. package/{chunk-DQLB4NQ3.js → chunk-VPAZOH2D.js} +2 -2
  87. package/{chunk-MBS6CTZB.js → chunk-VZKUKCA6.js} +236 -1993
  88. package/{chunk-LNYHAKBP.js → chunk-W4S457LU.js} +1 -1
  89. package/chunk-WPORQFYN.js +74 -0
  90. package/{chunk-ET2CWLIJ.js → chunk-WXYLV624.js} +3 -3
  91. package/chunk-XFYFMTOM.js +92 -0
  92. package/{chunk-NV572QM3.js → chunk-YJMRHHGY.js} +15 -15
  93. package/{chunk-JBOUVTZX.js → chunk-YOIW77S2.js} +13 -2
  94. package/{chunk-ADBWFYJD.js → chunk-YPD3VJZW.js} +9 -9
  95. package/{chunk-DA7CTWT4.js → chunk-YWSEPJ7C.js} +5 -5
  96. package/{chunk-3V2QMRNN.js → chunk-ZL5RAEEB.js} +3 -3
  97. package/cliAgentConfigHelpers-WJBZQTLW.js +41 -0
  98. package/{commandRegistry-FI2IOQ3U.js → commandRegistry-VVMTPFAX.js} +85 -81
  99. package/{contentThunks-5LKNNDGY.js → contentThunks-N52O67MI.js} +25 -24
  100. package/{createAgentAutomationAction-TI4QG4CY.js → createAgentAutomationAction-ZC57YRSV.js} +25 -24
  101. package/{createDialogAction-TJ3JKLO4.js → createDialogAction-VQW5WDYX.js} +27 -26
  102. package/{createPageAction-GKXT6WEH.js → createPageAction-M5VDA7SC.js} +26 -25
  103. package/{dbSlice-LPMZ2DGJ.js → dbSlice-HP7G4LX3.js} +7 -7
  104. package/{deleteFile-EPUQHKPA.js → deleteFile-7VQGLK2V.js} +3 -3
  105. package/{dialogCommands-IWPXIZ5P.js → dialogCommands-JHMR2N2Y.js} +32 -30
  106. package/{dialogSlice-ZWNNS7GZ.js → dialogSlice-GRSVGDTF.js} +23 -22
  107. package/{dialogUsageCommand-ZCPPHPJ5.js → dialogUsageCommand-7KCPYGHG.js} +1 -1
  108. package/{docCreateCommands-HFSPKJSI.js → docCreateCommands-F2K3UPSQ.js} +28 -27
  109. package/{docDeleteCommands-CRL62POH.js → docDeleteCommands-XGXB5RFT.js} +29 -28
  110. package/{docReadCommands-QOTOX3XW.js → docReadCommands-7HWZZV6J.js} +28 -27
  111. package/{docStore-WYLRB7ED.js → docStore-KNZK6Y2G.js} +10 -10
  112. package/{docUpdateCommands-7BMH4MCA.js → docUpdateCommands-OZZ7NQII.js} +28 -27
  113. package/{fetchMessages-YY4SATNR.js → fetchMessages-M3QU7ZCQ.js} +1 -1
  114. package/{getPricing-OQXBJ6VZ.js → getPricing-2MNMXEVG.js} +3 -3
  115. package/{handleSendMessageAction-P27YP2DQ.js → handleSendMessageAction-SHIH74GJ.js} +46 -44
  116. package/hostCredentialCreate-X64WK4JD.js +357 -0
  117. package/index.js +5 -5
  118. package/{keys-P4ZDOVJW.js → keys-BEGDOTRL.js} +3 -1
  119. package/{localDialogRead-5VCMQQZF.js → localDialogRead-XRLAH4CZ.js} +1 -1
  120. package/{localRuntimeAdapter-GP6ZSSO3.js → localRuntimeAdapter-A7K3ABA6.js} +73 -66
  121. package/{machineCommands-6Z6H4BFX.js → machineCommands-DE3MR7CJ.js} +65 -60
  122. package/{machineWsRunDispatch-F2ZIXMYM.js → machineWsRunDispatch-R26P5V36.js} +65 -60
  123. package/{memberThunks-YSEFJF47.js → memberThunks-7WJAY5V6.js} +8 -8
  124. package/package.json +1 -1
  125. package/{projectArchive-PIGEOX3D.js → projectArchive-GGL5HLMD.js} +26 -25
  126. package/{providerPresetApply-ZYMLQA46.js → providerPresetApply-YXGV6NXB.js} +4 -4
  127. package/{providerRegistry-E34XWDLJ.js → providerRegistry-S6UL6UNA.js} +4 -4
  128. package/{read-DIIQBOOO.js → read-4VZQODSN.js} +3 -3
  129. package/{readDocTool-HXYGOEA7.js → readDocTool-AVD32RUJ.js} +1 -1
  130. package/{readlineWorkspace-UG25G7KC.js → readlineWorkspace-XKYKNL2I.js} +157 -100
  131. package/{removeDialogAgentAction-ALJDUJ2E.js → removeDialogAgentAction-FKL4BYMR.js} +17 -14
  132. package/{runAgentClientLoop-IO5F7TCZ.js → runAgentClientLoop-V7E2WBVM.js} +49 -46
  133. package/{runtimeDoctorCommands-PGAA47G5.js → runtimeDoctorCommands-QAI3MBKQ.js} +6 -6
  134. package/{secretCommands-ZCZ4KVET.js → secretCommands-4QS3HCA2.js} +3 -3
  135. package/{setDialogExtraReferencesAction-O3SVMD5A.js → setDialogExtraReferencesAction-TLIOLWWI.js} +10 -10
  136. package/{setPrimaryDialogAgentAction-HE7RVFFF.js → setPrimaryDialogAgentAction-2OLWRFYR.js} +18 -15
  137. package/{settingThunks-BWWJQG4L.js → settingThunks-UGBPCNYF.js} +12 -11
  138. package/{spaceCommands-UAELIFEI.js → spaceCommands-4KSLKVNF.js} +28 -27
  139. package/{streamAgentChatTurn-VUKZQYJR.js → streamAgentChatTurn-7FR7X2NU.js} +57 -54
  140. package/{switchDialogAgentAction-3VZS7SOS.js → switchDialogAgentAction-UZSAG2N5.js} +15 -12
  141. package/{tools-VRXJAVYI.js → tools-ZLKCC25W.js} +43 -40
  142. package/{tuiSummaryLlmCaller-TGCHZLSW.js → tuiSummaryLlmCaller-WC54MVGP.js} +10 -10
  143. package/{updateCommands-Q6CYAEYJ.js → updateCommands-4744PL3P.js} +3 -1
  144. package/{updateDialogTitleAction-MULWCJCW.js → updateDialogTitleAction-U53ZT7PJ.js} +38 -70
  145. package/usageCommand-F4IPVMIZ.js +32 -0
  146. package/usageRebuildCommand-HAW2AD5N.js +626 -0
  147. package/chunk-4LCOCOR5.js +0 -50
  148. package/chunk-7AUQ3WCW.js +0 -51
  149. package/chunk-ZRAU6T47.js +0 -56
  150. package/{agentFavoriteCommands-GAFEXKKP.js → agentFavoriteCommands-EDK743YA.js} +1 -1
  151. package/{agentGrantCommands-V5FOQKFD.js → agentGrantCommands-RQWK2TEV.js} +1 -1
  152. package/{agentPullCommand-2JMJP5BS.js → agentPullCommand-6EM3URVK.js} +1 -1
  153. package/{chunk-BTYQAODF.js → chunk-CZM5YTZ7.js} +3 -3
  154. package/{chunk-A2ZMIRLN.js → chunk-INN4LTAJ.js} +5 -5
  155. package/{chunk-XPHZK3PJ.js → chunk-JNKSDZFS.js} +3 -3
  156. package/{chunk-PV6JJAUB.js → chunk-TCZHTTUU.js} +8 -8
  157. package/{chunk-AKE53VMW.js → chunk-ZCWRMUWT.js} +0 -0
  158. package/{tableCommands-D7WR4QSM.js → tableCommands-MP6VFSVT.js} +3 -3
@@ -1,13 +1,14 @@
1
+ import {
2
+ resolveRuntimeAuthToken,
3
+ resolveRuntimeServerUrl
4
+ } from "./chunk-HRMJUN5J.js";
1
5
  import {
2
6
  isAgentRunTerminalStatus,
3
7
  normalizeRunTitle
4
8
  } from "./chunk-PJNFNEJE.js";
5
9
  import {
6
10
  findPowerShellExecutable
7
- } from "./chunk-XPHZK3PJ.js";
8
- import {
9
- resolvePlatformAuthToken
10
- } from "./chunk-PV6JJAUB.js";
11
+ } from "./chunk-JNKSDZFS.js";
11
12
  import {
12
13
  isRecord
13
14
  } from "./chunk-KUG52IAP.js";
@@ -1073,22 +1074,6 @@ function reserveHostMemory(deps) {
1073
1074
  throw new Error("[host-memory-reservation] exclusive lock required");
1074
1075
  }
1075
1076
 
1076
- // packages/cli/client/localRuntimeHelpers.ts
1077
- var REMOTE_DIALOG_SYNC_TIMEOUT_MS = 1e4;
1078
- var remoteDialogSyncTimeoutMsForTest;
1079
- function setRemoteDialogSyncTimeoutForTest(ms) {
1080
- remoteDialogSyncTimeoutMsForTest = ms;
1081
- }
1082
- function remoteDialogSyncTimeout() {
1083
- return remoteDialogSyncTimeoutMsForTest ?? REMOTE_DIALOG_SYNC_TIMEOUT_MS;
1084
- }
1085
- function resolveRuntimeServerUrl(env) {
1086
- return (env?.NOLO_SERVER_URL || env?.NOLO_SERVER || env?.BASE_URL || "").replace(/\/+$/, "");
1087
- }
1088
- function resolveRuntimeAuthToken(env) {
1089
- return resolvePlatformAuthToken(env ?? {});
1090
- }
1091
-
1092
1077
  // packages/cli/agentRunResultFile.ts
1093
1078
  function resolveResultServerMeta(input) {
1094
1079
  const serverUrl = resolveRuntimeServerUrl(input.env);
@@ -3152,10 +3137,6 @@ export {
3152
3137
  createShellApprovalChild,
3153
3138
  readHostMemory,
3154
3139
  assertHostMemoryAdmission,
3155
- setRemoteDialogSyncTimeoutForTest,
3156
- remoteDialogSyncTimeout,
3157
- resolveRuntimeServerUrl,
3158
- resolveRuntimeAuthToken,
3159
3140
  resolveResultServerMeta,
3160
3141
  recordRunResultHeaderMeta,
3161
3142
  getRunResultHeaderMeta,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  selectCurrentServer,
3
3
  selectRemoteServers
4
- } from "./chunk-BSISWVB4.js";
4
+ } from "./chunk-4I7ERB7F.js";
5
5
  import {
6
6
  noloDeleteRequest,
7
7
  noloWriteRequest
8
- } from "./chunk-X4F26D5K.js";
8
+ } from "./chunk-P5L7CXOC.js";
9
9
  import {
10
10
  normalizeTimeFields
11
11
  } from "./chunk-AGP3YSEC.js";
@@ -21,7 +21,7 @@ import {
21
21
  sanitizeShareData,
22
22
  shareKey,
23
23
  toNonEmptyString
24
- } from "./chunk-ECX3NKRD.js";
24
+ } from "./chunk-JY5NGFFH.js";
25
25
 
26
26
  // packages/share/action.ts
27
27
  var generateToken = () => {
@@ -0,0 +1,26 @@
1
+ import {
2
+ resolvePlatformAuthToken
3
+ } from "./chunk-TCZHTTUU.js";
4
+
5
+ // packages/cli/client/localRuntimeHelpers.ts
6
+ var REMOTE_DIALOG_SYNC_TIMEOUT_MS = 1e4;
7
+ var remoteDialogSyncTimeoutMsForTest;
8
+ function setRemoteDialogSyncTimeoutForTest(ms) {
9
+ remoteDialogSyncTimeoutMsForTest = ms;
10
+ }
11
+ function remoteDialogSyncTimeout() {
12
+ return remoteDialogSyncTimeoutMsForTest ?? REMOTE_DIALOG_SYNC_TIMEOUT_MS;
13
+ }
14
+ function resolveRuntimeServerUrl(env) {
15
+ return (env?.NOLO_SERVER_URL || env?.NOLO_SERVER || env?.BASE_URL || "").replace(/\/+$/, "");
16
+ }
17
+ function resolveRuntimeAuthToken(env) {
18
+ return resolvePlatformAuthToken(env ?? {});
19
+ }
20
+
21
+ export {
22
+ setRemoteDialogSyncTimeoutForTest,
23
+ remoteDialogSyncTimeout,
24
+ resolveRuntimeServerUrl,
25
+ resolveRuntimeAuthToken
26
+ };
@@ -206,7 +206,7 @@ async function readDocFunc(args, thunkApi) {
206
206
  throw new Error(`\u65E0\u6548\u7684\u9875\u9762 ID: ${id}\u3002\u9875\u9762 ID \u901A\u5E38\u4EE5 "page-" \u5F00\u5934\u3002`);
207
207
  }
208
208
  try {
209
- const { readAction } = await import("./read-DIIQBOOO.js");
209
+ const { readAction } = await import("./read-4VZQODSN.js");
210
210
  const pageData = await readAction({ dbKey: id }, thunkApi);
211
211
  if (!pageData) {
212
212
  throw new Error(`\u672A\u627E\u5230 ID \u4E3A ${id} \u7684\u9875\u9762\u3002`);
@@ -1,12 +1,22 @@
1
- import {
2
- buildLocalAgentLookupKeys,
3
- classifyAgentApiKeyRef,
4
- formatUnsupportedAgentApiKeyRefMessage,
5
- shouldReadAgentKeyRemotely
6
- } from "./chunk-7AUQ3WCW.js";
7
1
  import {
8
2
  resolveCliAgentKeyInput
9
3
  } from "./chunk-NBTY7YJF.js";
4
+ import {
5
+ createHostCredentialBrokerChain,
6
+ createStrictHostCredentialBroker
7
+ } from "./chunk-FHU44LN3.js";
8
+ import {
9
+ buildAgentRuntimeAgentLookupKeys,
10
+ shouldFetchAgentRuntimeRecordRemotely
11
+ } from "./chunk-25JZEIXN.js";
12
+ import {
13
+ buildAgentApiKeyCredentialRef,
14
+ migrateAgentSecrets
15
+ } from "./chunk-2QHFH3DR.js";
16
+ import {
17
+ assertCredentialRef,
18
+ createFileCredentialBroker
19
+ } from "./chunk-OQHIVPG4.js";
10
20
  import {
11
21
  toErrorMessage
12
22
  } from "./chunk-HNMXYYJR.js";
@@ -23,16 +33,85 @@ import {
23
33
  } from "./chunk-4O22PGNQ.js";
24
34
  import {
25
35
  createAgentKey
26
- } from "./chunk-ECX3NKRD.js";
36
+ } from "./chunk-JY5NGFFH.js";
37
+
38
+ // packages/agent-runtime/sessionCredentialBroker.ts
39
+ function createSessionMemoryCredentialBroker() {
40
+ const store = /* @__PURE__ */ new Map();
41
+ return {
42
+ get(ref) {
43
+ return store.get(assertCredentialRef(ref)) ?? null;
44
+ },
45
+ put(ref, secret) {
46
+ const safe = assertCredentialRef(ref);
47
+ const value = typeof secret === "string" ? secret.trim() : "";
48
+ if (!value) throw new Error("Cannot store an empty credential secret.");
49
+ store.set(safe, value);
50
+ },
51
+ delete(ref) {
52
+ store.delete(assertCredentialRef(ref));
53
+ },
54
+ has(ref) {
55
+ return store.has(assertCredentialRef(ref));
56
+ },
57
+ size() {
58
+ return store.size;
59
+ }
60
+ };
61
+ }
62
+ var sharedSessionBroker;
63
+ function getSharedSessionCredentialBroker() {
64
+ if (!sharedSessionBroker) sharedSessionBroker = createSessionMemoryCredentialBroker();
65
+ return sharedSessionBroker;
66
+ }
27
67
 
28
68
  // packages/cli/agentRecordHelpers.ts
29
69
  import { readFileSync } from "node:fs";
30
70
 
71
+ // packages/agent-runtime/oauthProviderRefs.ts
72
+ var OAUTH_PROVIDER_REFS = [
73
+ "chatgpt",
74
+ "xai",
75
+ "antigravity",
76
+ "claude",
77
+ "cursor",
78
+ "devin"
79
+ ];
80
+ var METERED_API_KEY_REF_PREFIX = "api-key:";
81
+ var normalizeRef = (ref) => typeof ref === "string" ? ref.trim().toLowerCase() : "";
82
+ var isKnownOAuthProviderRef = (ref) => OAUTH_PROVIDER_REFS.includes(normalizeRef(ref));
83
+ var isMeteredApiKeyRef = (ref) => {
84
+ const trimmed = typeof ref === "string" ? ref.trim() : "";
85
+ return trimmed.length > METERED_API_KEY_REF_PREFIX.length && trimmed.slice(0, METERED_API_KEY_REF_PREFIX.length).toLowerCase() === METERED_API_KEY_REF_PREFIX;
86
+ };
87
+ var OAUTH_PROVIDER_REF_LIST_COPY = OAUTH_PROVIDER_REFS.join(" / ");
88
+ function classifyAgentApiKeyRef(raw) {
89
+ const trimmed = typeof raw === "string" ? raw.trim() : "";
90
+ if (!trimmed) return { ok: true, kind: "empty" };
91
+ if (isKnownOAuthProviderRef(trimmed)) {
92
+ return {
93
+ ok: true,
94
+ kind: "oauth-provider",
95
+ provider: normalizeRef(trimmed)
96
+ };
97
+ }
98
+ if (isMeteredApiKeyRef(trimmed)) return { ok: true, kind: "metered-api-key" };
99
+ return { ok: false, kind: "unsupported-oauth-provider", ref: trimmed };
100
+ }
101
+ function formatUnsupportedAgentApiKeyRefMessage(raw) {
102
+ const shown = typeof raw === "string" ? raw.trim() : "";
103
+ return `apiKeyRef "${shown}" \u4E0D\u662F\u53D7\u652F\u6301\u7684\u53D6\u503C\uFF0C\u8BB0\u5F55\u672A\u5199\u5165\u3002\u5408\u6CD5\u53D6\u503C\uFF1AOAuth provider ref\uFF08${OAUTH_PROVIDER_REF_LIST_COPY}\uFF09\uFF0C\u6216\u8BA1\u91CF/\u8BBE\u5907 broker ref\uFF08\u4EE5 "${METERED_API_KEY_REF_PREFIX}" \u5F00\u5934\uFF0C\u5982 ${METERED_API_KEY_REF_PREFIX}agent-...\uFF09\u3002\u6539\u6CD5\uFF1A\u628A apiKeyRef \u6539\u6210\u4E0A\u9762\u67D0\u4E2A\u53D7\u652F\u6301\u7684\u53D6\u503C\uFF0C\u6216\u6539\u7528 ${METERED_API_KEY_REF_PREFIX}<id>\uFF1B\u82E5\u8981\u7528\u81EA\u5E26 API key\uFF0C\u8BF7\u6E05\u7A7A apiKeyRef \u5E76\u586B\u5199 apiKey\u3002`;
104
+ }
105
+
31
106
  // packages/core/agentHandle.ts
32
107
  function normalizeAgentHandle(value) {
33
108
  return typeof value === "string" && value.trim() ? value.trim().toLowerCase().replace(/\s+/g, " ") : void 0;
34
109
  }
35
110
 
111
+ // packages/cli/client/localAgentRecords.ts
112
+ var buildLocalAgentLookupKeys = buildAgentRuntimeAgentLookupKeys;
113
+ var shouldReadAgentKeyRemotely = shouldFetchAgentRuntimeRecordRemotely;
114
+
36
115
  // packages/cli/agentRecordHelpers.ts
37
116
  var PROVIDER_COPY_FIELDS = [
38
117
  "apiSource",
@@ -243,6 +322,7 @@ function assertSupportedAgentApiKeyRef(record) {
243
322
  }
244
323
  async function writeAgentRecord(args) {
245
324
  assertSupportedAgentApiKeyRef(args.record);
325
+ const remoteRecord = args.remoteIncludeApiKey === false ? Object.fromEntries(Object.entries(args.record).filter(([field]) => field !== "apiKey")) : args.record;
246
326
  const res = await fetchWithTransportFallback(`${args.serverUrl}/api/v1/db/write/`, {
247
327
  method: "POST",
248
328
  headers: {
@@ -253,7 +333,7 @@ async function writeAgentRecord(args) {
253
333
  customKey: args.agentKey,
254
334
  userId: args.userId,
255
335
  data: {
256
- ...args.record,
336
+ ...remoteRecord,
257
337
  dbKey: args.agentKey
258
338
  }
259
339
  })
@@ -494,6 +574,72 @@ function normalizeAgentRecordForOutput(agentKey, authToken, agent) {
494
574
  record: sanitizedRecord
495
575
  };
496
576
  }
577
+ var INBOUND_CRED_REF_PREFIX = "$nolo_cred:";
578
+ var VAULT_REF_PATTERN = /^vault-cred-[A-Za-z0-9]+$/;
579
+ function detectVaultCredentialId(value) {
580
+ const trimmed = typeof value === "string" ? value.trim() : "";
581
+ const candidate = trimmed.startsWith(INBOUND_CRED_REF_PREFIX) ? trimmed.slice(INBOUND_CRED_REF_PREFIX.length).trim() : trimmed;
582
+ return VAULT_REF_PATTERN.test(candidate) ? candidate : null;
583
+ }
584
+ var hostCredentialBrokerOverride;
585
+ var credentialStorageWarnings = [];
586
+ var CREDENTIAL_STORE_SESSION_FALLBACK_WARNING = "\u7CFB\u7EDF\u5B89\u5168\u533A\u4E0D\u53EF\u7528\uFF0C\u672C\u6B21\u4F1A\u8BDD\u5185\u6709\u6548\uFF0C\u672A\u6301\u4E45\u5316\uFF1B\u91CD\u542F\u540E\u9700\u91CD\u65B0\u63D0\u4F9B\u8BE5\u51ED\u636E\u3002";
587
+ var CREDENTIAL_STORE_FALLBACK_WARNING = "\u7CFB\u7EDF\u5B89\u5168\u533A\u4E0D\u53EF\u7528\uFF0C\u5DF2\u56DE\u9000\u5230\u672C\u5730\u6587\u4EF6\u5B58\u50A8\uFF080600 \u660E\u6587\uFF09\u3002\u5EFA\u8BAE\u542F\u7528\u7CFB\u7EDF\u94A5\u5319\u4E32\uFF08Linux: Secret Service / gnome-keyring\uFF09\u3002";
588
+ function resolveStrictCredentialBroker(broker) {
589
+ return broker ?? hostCredentialBrokerOverride ?? createStrictHostCredentialBroker();
590
+ }
591
+ var legacyReadNoticed = /* @__PURE__ */ new Set();
592
+ function resolveHostCredentialBroker(broker) {
593
+ if (broker || hostCredentialBrokerOverride) return resolveStrictCredentialBroker(broker);
594
+ return createHostCredentialBrokerChain({
595
+ strict: createStrictHostCredentialBroker(),
596
+ session: getSharedSessionCredentialBroker(),
597
+ legacy: createFileCredentialBroker({ migration: { enableLegacyMigration: true } }),
598
+ notifySessionFallback: () => {
599
+ try {
600
+ process.stderr.write(`[nolo] Warning: ${CREDENTIAL_STORE_SESSION_FALLBACK_WARNING}
601
+ `);
602
+ } catch {
603
+ }
604
+ },
605
+ notifyLegacyHit: (ref) => {
606
+ if (legacyReadNoticed.has(ref)) return;
607
+ legacyReadNoticed.add(ref);
608
+ try {
609
+ process.stderr.write(
610
+ `[nolo] Warning: \u51ED\u636E "${ref}" \u6765\u81EA\u9057\u7559\u672C\u5730\u660E\u6587\u5B58\u50A8\uFF08\u53EA\u8BFB\u56DE\u9000\uFF09\u3002\u5EFA\u8BAE\u91CD\u65B0\u5F55\u5165\u8BE5 API key \u4EE5\u8FC1\u5165\u7CFB\u7EDF\u5B89\u5168\u533A\u3002
611
+ `
612
+ );
613
+ } catch {
614
+ }
615
+ }
616
+ });
617
+ }
618
+ async function storeAgentCredential(args) {
619
+ const broker = resolveStrictCredentialBroker(args.broker);
620
+ const credentialRef = buildAgentApiKeyCredentialRef(args.agentKey);
621
+ await migrateAgentSecrets({
622
+ agent: { key: args.agentKey, apiKey: args.secret, apiKeyRef: credentialRef },
623
+ broker
624
+ });
625
+ if (!await broker.has(credentialRef)) {
626
+ throw new Error(`failed to store the credential in the host credential store (${credentialRef}).`);
627
+ }
628
+ return { credentialRef };
629
+ }
630
+ async function bindVaultCredentialToAgent(args) {
631
+ const broker = resolveHostCredentialBroker(args.broker);
632
+ const secret = await broker.get(args.vaultId);
633
+ if (!secret) {
634
+ throw new Error(
635
+ `--api-key received a vault credential id (${args.vaultId}) but no secret is stored for it on this device. Re-paste the key in the chat so the runtime can isolate it again, or ask the user to run \`nolo secret set <name> --prompt\`.`
636
+ );
637
+ }
638
+ return await storeAgentCredential({ agentKey: args.agentKey, secret, broker: args.broker });
639
+ }
640
+ async function readBoundAgentCredential(credentialRef, broker) {
641
+ return await resolveHostCredentialBroker(broker).get(credentialRef);
642
+ }
497
643
  function parseAgentUpdateArgs(args) {
498
644
  const agentInput = readOption(args, "--agent") ?? readOption(args, "--id") ?? args[0]?.trim();
499
645
  if (!agentInput || agentInput === "--help" || agentInput === "-h") return null;
@@ -552,13 +698,57 @@ function parseAgentUpdateArgs(args) {
552
698
  }
553
699
  return { agentInput, updates, promptDoc, copyProviderFrom, verify, verifyPrompt, presetId };
554
700
  }
701
+ function looksLikePlaintextApiKey(value) {
702
+ const trimmed = typeof value === "string" ? value.trim() : "";
703
+ if (trimmed.length < 12) return false;
704
+ if (/^(?:api-key:|vault-cred-)/i.test(trimmed)) return false;
705
+ const verdict = classifyAgentApiKeyRef(trimmed);
706
+ if (verdict.ok && verdict.kind !== "empty") return false;
707
+ return true;
708
+ }
709
+ async function applyVaultCredentialBinding(updates, agentKey, broker, fallbackProviderUrl, preservePlaintextApiKey) {
710
+ const vaultId = detectVaultCredentialId(updates.apiKey);
711
+ if (!vaultId) {
712
+ const rawApiKey = updates.apiKey;
713
+ if (!looksLikePlaintextApiKey(rawApiKey)) return;
714
+ try {
715
+ const { credentialRef: credentialRef2 } = await storeAgentCredential({
716
+ agentKey,
717
+ secret: String(rawApiKey).trim(),
718
+ broker
719
+ });
720
+ delete updates.apiKey;
721
+ updates.credentialRef = credentialRef2;
722
+ updates.apiKeyRef = credentialRef2;
723
+ if (preservePlaintextApiKey && typeof rawApiKey === "string") {
724
+ updates.apiKey = rawApiKey;
725
+ }
726
+ return;
727
+ } catch {
728
+ credentialStorageWarnings.push(CREDENTIAL_STORE_FALLBACK_WARNING);
729
+ process.stderr.write(`[nolo] Warning: ${CREDENTIAL_STORE_FALLBACK_WARNING}
730
+ `);
731
+ return;
732
+ }
733
+ }
734
+ delete updates.apiKey;
735
+ const target = typeof updates.customProviderUrl === "string" && updates.customProviderUrl.trim() ? updates.customProviderUrl.trim() : (fallbackProviderUrl ?? "").trim();
736
+ if (!target) {
737
+ throw new Error(
738
+ "--api-key received a vault credential id, but no provider target was given. Pass --custom-provider-url <base> (or --preset <id>) so the credential has a known destination."
739
+ );
740
+ }
741
+ const { credentialRef } = await bindVaultCredentialToAgent({ agentKey, vaultId, broker });
742
+ updates.credentialRef = credentialRef;
743
+ updates.apiKeyRef = credentialRef;
744
+ }
555
745
  async function buildCreatedAgentRecord(args) {
556
746
  const serverUrl = args.cliArgs ? resolveServerUrl(args.cliArgs, args.env) : resolveServerUrl(args.env);
557
747
  const userId = parseUserIdFromAuthToken(args.authToken);
558
748
  const resolvedAgentInput = resolveCliAgentKeyInput(args.parsed.agentInput);
559
749
  const agentKey = resolvedAgentInput.startsWith("agent-") ? resolvedAgentInput : createAgentKey.private(userId || "local", resolvedAgentInput);
560
750
  if (args.parsed.presetId) {
561
- const { resolveProviderPresetFields } = await import("./providerPresetApply-ZYMLQA46.js");
751
+ const { resolveProviderPresetFields } = await import("./providerPresetApply-YXGV6NXB.js");
562
752
  const fields = resolveProviderPresetFields(args.parsed.presetId);
563
753
  if (fields.kind === "manual") {
564
754
  throw new Error(
@@ -617,6 +807,13 @@ async function buildCreatedAgentRecord(args) {
617
807
  if (args.parsed.updates.customProviderUrl && !args.parsed.updates.apiSource) {
618
808
  args.parsed.updates.apiSource = "custom";
619
809
  }
810
+ await applyVaultCredentialBinding(
811
+ args.parsed.updates,
812
+ agentKey,
813
+ args.credentialBroker,
814
+ void 0,
815
+ !args.hostApproval?.gateId
816
+ );
620
817
  const nextRecord = {
621
818
  ...args.parsed.updates,
622
819
  dbKey: agentKey,
@@ -686,6 +883,15 @@ async function buildUpdatedAgentRecord(args) {
686
883
  }
687
884
  args.parsed.updates.prompt = promptBody;
688
885
  }
886
+ await applyVaultCredentialBinding(
887
+ args.parsed.updates,
888
+ agentKey,
889
+ args.credentialBroker,
890
+ typeof currentRecord?.customProviderUrl === "string" ? currentRecord.customProviderUrl : void 0,
891
+ // update 的来源判定与 create 一致:宿主代执行 → 严格(删明文只留 ref);
892
+ // 用户自己终端敲 → 保持既有行为(明文照旧写进记录)。
893
+ !args.hostApproval?.gateId
894
+ );
689
895
  const nextRecord = {
690
896
  ...currentRecord,
691
897
  ...args.parsed.updates,
@@ -701,6 +907,9 @@ async function buildUpdatedAgentRecord(args) {
701
907
  }
702
908
 
703
909
  export {
910
+ getSharedSessionCredentialBroker,
911
+ OAUTH_PROVIDER_REFS,
912
+ buildLocalAgentLookupKeys,
704
913
  fetchWithTransportFallback,
705
914
  readAgentRecord,
706
915
  readDbRecord,
@@ -713,6 +922,8 @@ export {
713
922
  agentRecordHasConfiguredCredential,
714
923
  sanitizeAgentRecordForCliOutput,
715
924
  normalizeAgentRecordForOutput,
925
+ CREDENTIAL_STORE_SESSION_FALLBACK_WARNING,
926
+ readBoundAgentCredential,
716
927
  parseAgentUpdateArgs,
717
928
  buildCreatedAgentRecord,
718
929
  buildUpdatedAgentRecord
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  selectCurrentServer
3
- } from "./chunk-BSISWVB4.js";
3
+ } from "./chunk-4I7ERB7F.js";
4
4
  import {
5
5
  patch
6
- } from "./chunk-UMEGDH6A.js";
6
+ } from "./chunk-BFM34N54.js";
7
7
  import {
8
8
  getIsDesktopApp
9
9
  } from "./chunk-AGP3YSEC.js";
@@ -3,10 +3,10 @@ import {
3
3
  parseFlagWithOptionalValue,
4
4
  runCloudflareOAuthLogin,
5
5
  upsertEnvVariable
6
- } from "./chunk-27E2CBBY.js";
6
+ } from "./chunk-7OCO4TDT.js";
7
7
  import {
8
8
  defaultOpenBrowser
9
- } from "./chunk-XE4Q46FF.js";
9
+ } from "./chunk-3CGG2PAL.js";
10
10
  import {
11
11
  ANTHROPIC_OAUTH_AUTHORIZE_URL,
12
12
  ANTHROPIC_OAUTH_CALLBACK_PORT,
@@ -50,7 +50,7 @@ import {
50
50
  startCallbackServer,
51
51
  validateXAIEndpoint,
52
52
  xaiOAuthDiscovery
53
- } from "./chunk-SN5XE6GQ.js";
53
+ } from "./chunk-RPQXPZZF.js";
54
54
  import {
55
55
  extractGoogleValidationLink
56
56
  } from "./chunk-BMQ2MJUK.js";
@@ -60,11 +60,7 @@ import {
60
60
  detectLocalDevinCredentials,
61
61
  extractDevinToken,
62
62
  fetchAntigravityCloudCodeCompletion
63
- } from "./chunk-NTSRCTUX.js";
64
- import {
65
- createOAuthTokenStore,
66
- resolveFreshAccessToken
67
- } from "./chunk-G7Y4GXTY.js";
63
+ } from "./chunk-CTPXME7U.js";
68
64
  import {
69
65
  toErrorMessage
70
66
  } from "./chunk-HNMXYYJR.js";
@@ -81,6 +77,10 @@ import {
81
77
  import {
82
78
  t
83
79
  } from "./chunk-3RQVYR4B.js";
80
+ import {
81
+ createOAuthTokenStore,
82
+ resolveFreshAccessToken
83
+ } from "./chunk-G7Y4GXTY.js";
84
84
  import {
85
85
  asOptionalFiniteNumber
86
86
  } from "./chunk-WWC7I6TA.js";
@@ -1,15 +1,19 @@
1
1
  import {
2
- formatISO
3
- } from "./chunk-ZRAU6T47.js";
2
+ require_formatISO
3
+ } from "./chunk-WPORQFYN.js";
4
4
  import {
5
5
  getActiveDialogKey
6
6
  } from "./chunk-OWYYDMGJ.js";
7
7
  import {
8
8
  patch,
9
9
  selectById
10
- } from "./chunk-UMEGDH6A.js";
10
+ } from "./chunk-BFM34N54.js";
11
+ import {
12
+ __toESM
13
+ } from "./chunk-4VNS5WPM.js";
11
14
 
12
15
  // packages/chat/dialog/actions/setDialogExtraReferencesAction.ts
16
+ var import_formatISO = __toESM(require_formatISO());
13
17
  var setDialogExtraReferencesAction = async (extraReferences, thunkApi) => {
14
18
  const { dispatch, getState } = thunkApi;
15
19
  const state = getState();
@@ -29,7 +33,7 @@ var setDialogExtraReferencesAction = async (extraReferences, thunkApi) => {
29
33
  dbKey: currentDialogKey,
30
34
  changes: {
31
35
  extraReferences: extraReferences ?? [],
32
- updatedAt: formatISO(/* @__PURE__ */ new Date())
36
+ updatedAt: (0, import_formatISO.default)(/* @__PURE__ */ new Date())
33
37
  }
34
38
  })
35
39
  ).unwrap();
@@ -7,7 +7,7 @@ import {
7
7
  scheduleExistingRecordReplication,
8
8
  shouldReplaceLocalWithRemoteRecord,
9
9
  shouldReplicateLocalRecord
10
- } from "./chunk-UCPAVEQB.js";
10
+ } from "./chunk-PYRUW7XN.js";
11
11
  import {
12
12
  fetchFromClientDb,
13
13
  fetchFromServer,
@@ -1,12 +1,12 @@
1
- import {
2
- isDevinOAuthAgent
3
- } from "./chunk-5ZUL4CUO.js";
4
1
  import {
5
2
  getModelContextWindow
6
- } from "./chunk-BTYQAODF.js";
3
+ } from "./chunk-CZM5YTZ7.js";
7
4
  import {
8
5
  normalizeTimingMs
9
6
  } from "./chunk-H57T64RA.js";
7
+ import {
8
+ isDevinOAuthAgent
9
+ } from "./chunk-5ZUL4CUO.js";
10
10
  import {
11
11
  BUILTIN_NOLO_AGENT_KEY
12
12
  } from "./chunk-LOEO7LRC.js";
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  isPageKey,
18
18
  isTableMetaKey
19
- } from "./chunk-ECX3NKRD.js";
19
+ } from "./chunk-JY5NGFFH.js";
20
20
  import {
21
21
  isDialogRecordKey
22
22
  } from "./chunk-XJWWBO34.js";
@@ -3051,6 +3051,16 @@ var createTokenStatsAppliedKey = Object.assign(
3051
3051
  })
3052
3052
  }
3053
3053
  );
3054
+ var createUsageBackupKey = Object.assign(
3055
+ (userId, dateKey, nowMs) => createKey("usage", "backup", userId, dateKey, nowMs),
3056
+ {
3057
+ /** 某个用户的全部日聚合备份范围:usage-backup-<userId>-* */
3058
+ rangeOfUser: (userId) => ({
3059
+ start: createKey("usage", "backup", userId, ""),
3060
+ end: createKey("usage", "backup", userId, "\uFFFF")
3061
+ })
3062
+ }
3063
+ );
3054
3064
  var isTokenStatsKey = (key) => {
3055
3065
  const parts = splitKey(key);
3056
3066
  return parts.length >= 2 && parts[0] === "token" && parts[1] === "stats";
@@ -3509,6 +3519,7 @@ export {
3509
3519
  createTokenDialogBackfillKey,
3510
3520
  createTokenStatsKey,
3511
3521
  createTokenStatsAppliedKey,
3522
+ createUsageBackupKey,
3512
3523
  isTokenStatsKey,
3513
3524
  DIALOG_AGENT_LIST_INDEX_PREFIX,
3514
3525
  parseDialogUpdatedAtMs,