nolo-cli 0.29.2 → 0.30.0-alpha.10

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 (138) hide show
  1. package/{_executeModel-BFVTGZXE.js → _executeModel-5ARVVUIK.js} +64 -69
  2. package/{action-LG32A6DJ.js → action-HI3VRQLP.js} +15 -16
  3. package/{addContentAction-MPGMBJTQ.js → addContentAction-NCURJ6PK.js} +13 -13
  4. package/{addDialogAgentAction-ZH23WDID.js → addDialogAgentAction-RCY4ECF4.js} +12 -12
  5. package/{agentDeleteCommand-4S4STG42.js → agentDeleteCommand-5Q6TDCJU.js} +62 -40
  6. package/{agentEmailCommands-3F4IP4DI.js → agentEmailCommands-DSX4BJ2I.js} +77 -81
  7. package/{agentGrantCommands-JNDE4RWR.js → agentGrantCommands-E7ZZFRHK.js} +2 -1
  8. package/{agentListCommands-JCRV2XF6.js → agentListCommands-S66HL5RO.js} +59 -41
  9. package/{agentMachineCommands-KYXPYSFP.js → agentMachineCommands-ULCQ5ZNN.js} +55 -36
  10. package/{agentPullCommand-ZZGU5KOY.js → agentPullCommand-4V36XNGV.js} +4 -3
  11. package/{agentRecordCommands-UADUPIXO.js → agentRecordCommands-2AA3GEGO.js} +75 -79
  12. package/{agentRunCommand-MJWSR53W.js → agentRunCommand-3KOT77XY.js} +79 -83
  13. package/{agentRunControl-SNUKXN6J.js → agentRunControl-AKBN2366.js} +13 -1
  14. package/{agentRuntimeLocal-PC5RRRPT.js → agentRuntimeLocal-7TMDJD4S.js} +50 -31
  15. package/{agentSlice-C5OYLNBT.js → agentSlice-6IQRQZX3.js} +13 -14
  16. package/{appDeleteCommands-ZXODZ5AD.js → appDeleteCommands-UUDIWLNE.js} +55 -36
  17. package/{appDeployCommands-AWC6JPZH.js → appDeployCommands-CO6SZ7YP.js} +55 -36
  18. package/{appDeployStatusCommands-74NXMDAI.js → appDeployStatusCommands-QEVKVECJ.js} +55 -36
  19. package/{appGetCommands-6YGIAP5L.js → appGetCommands-3YSCCLK4.js} +55 -36
  20. package/{appListCommands-DZWBHMNK.js → appListCommands-FBJAFZKK.js} +55 -36
  21. package/{authCommand-XMQHBK5L.js → authCommand-3ADNCFKD.js} +16 -16
  22. package/{authCommands-JSOG2H4E.js → authCommands-CXJ6PI2O.js} +7 -7
  23. package/{chunk-TOGGHWHI.js → chunk-2CYGIPJH.js} +3 -3
  24. package/{chunk-HRJEPMZY.js → chunk-2HQ4OG6N.js} +2 -2
  25. package/{chunk-XMLRJUU5.js → chunk-2IJAKBK2.js} +12 -10
  26. package/{chunk-OLWMGSW2.js → chunk-2SOQY5L6.js} +41 -39
  27. package/{chunk-7H3UTGPM.js → chunk-3AUWC6EM.js} +82 -3
  28. package/{chunk-6HTWA77J.js → chunk-43EPBPZ2.js} +1 -1
  29. package/{chunk-RJBTU7AS.js → chunk-4F77PJBR.js} +302 -14
  30. package/{chunk-RZNYL4LW.js → chunk-4SAV7BD7.js} +65 -1
  31. package/{chunk-R5V5G73M.js → chunk-5RDLGLAP.js} +0 -1
  32. package/{chunk-VKBTAQWT.js → chunk-6JH2DF7J.js} +6 -6
  33. package/{chunk-DZ3XJVET.js → chunk-AOS5IN2I.js} +1 -1
  34. package/{chunk-5ZXNLOAG.js → chunk-ARPAHODF.js} +17 -10
  35. package/{chunk-IC7W63RM.js → chunk-ATK5WJOA.js} +4 -4
  36. package/{chunk-OEWEE4VW.js → chunk-BIPRFBC2.js} +4 -2
  37. package/{chunk-YTA2QOEE.js → chunk-CAENRKNJ.js} +15 -0
  38. package/chunk-CYRMUTGB.js +1707 -0
  39. package/chunk-DCDL3GC4.js +171 -0
  40. package/{chunk-WX3ZOSTL.js → chunk-EBNSAABL.js} +24 -26
  41. package/{chunk-2TYLTEAH.js → chunk-EDWM6D6L.js} +1 -1
  42. package/{chunk-GT3GG2H7.js → chunk-EIQDGAAE.js} +148 -2
  43. package/chunk-F3MP7CP6.js +73 -0
  44. package/{chunk-R7LOFGRE.js → chunk-G5GVZAXF.js} +19 -15
  45. package/{chunk-KEF5OBOZ.js → chunk-GKXS4F2I.js} +33 -27
  46. package/{chunk-R3JSTDQO.js → chunk-GVPMJPCT.js} +1 -1
  47. package/{chunk-WMB7GVPN.js → chunk-IPSPETAL.js} +152 -1177
  48. package/{chunk-MQRZ5QUH.js → chunk-IXZX5CJK.js} +1 -1
  49. package/{chunk-2FX23RGA.js → chunk-J3LHGBNO.js} +5 -5
  50. package/{chunk-VHBWHNVT.js → chunk-K6QEHQZ3.js} +8 -4
  51. package/{chunk-HRPWRVBI.js → chunk-KGEVMUMI.js} +11 -11
  52. package/{chunk-L65QKSVJ.js → chunk-L3GCUVOH.js} +1 -1
  53. package/{chunk-G2BZ43DV.js → chunk-LAXMH7JY.js} +14 -14
  54. package/chunk-LEVCXTDN.js +5558 -0
  55. package/{chunk-HEXXIS77.js → chunk-N2IX3ZYK.js} +1 -1
  56. package/{chunk-32ZM6HVI.js → chunk-NZBH7FTB.js} +95 -95
  57. package/{chunk-XOIF2TNF.js → chunk-OB6FBSH3.js} +13 -0
  58. package/{chunk-PSK2RUHV.js → chunk-OIW2RJ74.js} +360 -2
  59. package/{chunk-FRN5QOKN.js → chunk-PACNSC37.js} +19 -4
  60. package/{chunk-QC6ZWDSV.js → chunk-PIC6Z7VI.js} +3 -3
  61. package/{chunk-H5S4XUGI.js → chunk-Q243PXRU.js} +185 -158
  62. package/{chunk-BBGRJB5E.js → chunk-QBOW6RZN.js} +4 -4
  63. package/{chunk-FVOSIYXM.js → chunk-R5Y4XELF.js} +43 -394
  64. package/{chunk-DF7SMWEV.js → chunk-RWJPDKPB.js} +1 -1
  65. package/{chunk-NXMJ55RU.js → chunk-S2BMRBR2.js} +3 -3
  66. package/{chunk-GC34RRTQ.js → chunk-SWYMCHM7.js} +1 -69
  67. package/chunk-T27IEBNQ.js +149 -0
  68. package/{chunk-GMJS5AYP.js → chunk-T4X4GCYT.js} +19 -179
  69. package/{chunk-4BDPDTJU.js → chunk-TXVSNFHC.js} +8 -8
  70. package/{chunk-JSB4N6NU.js → chunk-V54H24CQ.js} +3 -3
  71. package/chunk-VQ4QPCKE.js +3226 -0
  72. package/{chunk-Q5RXHXKU.js → chunk-W3UDJJMA.js} +189 -122
  73. package/{chunk-L3QFIBZG.js → chunk-WTGCTVJG.js} +1 -1
  74. package/{chunk-XS7UPVR7.js → chunk-WTPC3XD4.js} +5 -5
  75. package/{chunk-WSQLK2KR.js → chunk-XFGM5PJP.js} +6 -6
  76. package/{chunk-HALKDXKP.js → chunk-XORE26Z4.js} +8 -4
  77. package/chunk-YLC42PIE.js +7889 -0
  78. package/{chunk-SKDNBYZK.js → chunk-ZJ2WITOO.js} +2 -2
  79. package/{chunk-L6RBX4L4.js → chunk-ZJH3LKEW.js} +21 -9
  80. package/{codingSkills-EN6Z6G6U.js → codingSkills-V35TRR4Y.js} +1 -2
  81. package/{createAgentAutomationAction-BK4UZJKU.js → createAgentAutomationAction-EYNYY2LB.js} +31 -37
  82. package/{createDialogAction-MJJUI2MK.js → createDialogAction-OUIRWYZP.js} +34 -39
  83. package/{createPageAction-YMZ7K363.js → createPageAction-2I5PHJFF.js} +45 -51
  84. package/{dbSlice-6QJYQUBV.js → dbSlice-BBL3PEVW.js} +12 -12
  85. package/{deleteFile-WDZ3VM7B.js → deleteFile-RJTEPOT4.js} +6 -6
  86. package/{dialogCommands-OKH45ASS.js → dialogCommands-5CL4QYQ7.js} +55 -38
  87. package/{dialogSlice-UDOKNDHB.js → dialogSlice-EKKVFKBJ.js} +28 -35
  88. package/{docCreateCommands-MCLMR4TE.js → docCreateCommands-QHCLYGNW.js} +54 -37
  89. package/{docDeleteCommands-ONDHI7JV.js → docDeleteCommands-DS6KOU6N.js} +56 -39
  90. package/{docReadCommands-FCXBMISW.js → docReadCommands-FRI5DAKH.js} +54 -37
  91. package/{docStore-N66O4CGH.js → docStore-V7EJS4PX.js} +30 -36
  92. package/{docUpdateCommands-T3XN6XOX.js → docUpdateCommands-RQO5ZTXT.js} +57 -40
  93. package/{fetchMessages-W4IKHPCS.js → fetchMessages-VPPQDDZ4.js} +3 -3
  94. package/{getPricing-X6I23RN6.js → getPricing-67TQVKFV.js} +6 -7
  95. package/{handleSendMessageAction-KC4AYUZP.js → handleSendMessageAction-KCF7KII4.js} +30 -37
  96. package/index.js +72 -72
  97. package/{localDialogRead-UFLBS6OT.js → localDialogRead-P72W2U2R.js} +1 -1
  98. package/{machineCommands-DIMRFA3Y.js → machineCommands-IAGAKTHV.js} +78 -82
  99. package/{machineWsRunDispatch-2DYJZI6Z.js → machineWsRunDispatch-JGKC2HEK.js} +73 -77
  100. package/{models-YT32CTT5.js → models-WDUTTYFS.js} +2 -2
  101. package/{offlineMarxistsAgentCommand-5OOWZLJI.js → offlineMarxistsAgentCommand-E6LUG63A.js} +6 -2
  102. package/package.json +1 -1
  103. package/{read-C7Y6LSBM.js → read-64OQDO3I.js} +7 -7
  104. package/{readDocTool-TOHRYJHP.js → readDocTool-MXM3T6PE.js} +2 -1
  105. package/{readlineWorkspace-HUPHMLDG.js → readlineWorkspace-5AQHHIBK.js} +209 -183
  106. package/{removeDialogAgentAction-WZXPOH5S.js → removeDialogAgentAction-NEKVAMSH.js} +16 -17
  107. package/{runAgentClientLoop-5TGSUKHV.js → runAgentClientLoop-6OGPS6SI.js} +63 -67
  108. package/{setDialogExtraReferencesAction-INZY2ENI.js → setDialogExtraReferencesAction-WTOHQDIV.js} +13 -13
  109. package/{setPrimaryDialogAgentAction-WCVLPYCF.js → setPrimaryDialogAgentAction-LDJOYC4F.js} +16 -17
  110. package/{settingSlice-IDUM4LWU.js → settingSlice-4M37TN7V.js} +14 -15
  111. package/{skillDiscovery-ITA7BI7A.js → skillDiscovery-I3QRA7NE.js} +2 -2
  112. package/{spaceCommands-XSSDB3YK.js → spaceCommands-VTDNKTSF.js} +240 -41
  113. package/{spaceSlice-BXDCO6PT.js → spaceSlice-LGUZMB7Y.js} +29 -35
  114. package/{streamAgentChatTurn-HRFMVSVC.js → streamAgentChatTurn-TIGCZUNZ.js} +133 -1301
  115. package/{switchDialogAgentAction-YBFFCBOD.js → switchDialogAgentAction-XVWGKR2Z.js} +12 -12
  116. package/{tableCommands-QSZILI7I.js → tableCommands-RJZ3V4TF.js} +7 -7
  117. package/{toolApiClient-WVTUYOFM.js → toolApiClient-ARGFDJAG.js} +2 -2
  118. package/{tools-5V6FHWQU.js → tools-BQAOPYMR.js} +51 -56
  119. package/{tuiSummaryLlmCaller-GCUPULOV.js → tuiSummaryLlmCaller-YQBN5IMG.js} +12 -12
  120. package/{updateDialogTitleAction-W62C4W4K.js → updateDialogTitleAction-E6HMEDPH.js} +39 -45
  121. package/chunk-5CS33IBL.js +0 -301
  122. package/chunk-5MMAK75Q.js +0 -15
  123. package/chunk-HYSJHRWD.js +0 -669
  124. package/chunk-MRC4Q34M.js +0 -188
  125. package/chunk-SIZQB7BD.js +0 -91
  126. package/chunk-UEOPA6MV.js +0 -641
  127. package/chunk-UFL6WHHJ.js +0 -15419
  128. package/chunk-VIDPVFP3.js +0 -20
  129. package/chunk-W2LZV5GE.js +0 -231
  130. package/chunk-Y5GCAMGP.js +0 -9
  131. package/chunk-YYLHWIW6.js +0 -48
  132. package/chunk-Z54ZAZZC.js +0 -1791
  133. package/chunk-ZZ2MH7LE.js +0 -84
  134. package/{chunk-OMP5L5NF.js → chunk-44HACRCK.js} +3 -3
  135. package/{chunk-ZVZMT3EA.js → chunk-KWCLUYGQ.js} +3 -3
  136. package/{chunk-NRY4GCKJ.js → chunk-WHLVPK32.js} +3 -3
  137. package/{chunk-RQSOAMPJ.js → chunk-Z5MXSEOJ.js} +2 -2
  138. package/{runtimeDoctorCommands-HSU632DY.js → runtimeDoctorCommands-E2OUORHK.js} +3 -3
@@ -1,9 +1,6 @@
1
1
  import {
2
- applyAgentSecretMigrationUpdates,
3
- createFileCredentialBroker,
4
- migrateAgentSecrets,
5
- normalizeAgentRuntimeToolPolicy
6
- } from "./chunk-5CS33IBL.js";
2
+ getCredentialsDir
3
+ } from "./chunk-JZPBVBIY.js";
7
4
  import {
8
5
  asRecordOrEmpty
9
6
  } from "./chunk-KX6YBIHG.js";
@@ -11,19 +8,28 @@ import {
11
8
  patch,
12
9
  remove,
13
10
  write
14
- } from "./chunk-G2BZ43DV.js";
15
- import {
16
- createAgentKey,
17
- toTrimmedString
18
- } from "./chunk-NRY4GCKJ.js";
11
+ } from "./chunk-LAXMH7JY.js";
19
12
  import {
20
13
  asyncThunkCreator,
21
14
  buildCreateSlice,
22
15
  getRuntimeServerContext
23
- } from "./chunk-XMLRJUU5.js";
16
+ } from "./chunk-2IJAKBK2.js";
17
+ import {
18
+ createAgentKey,
19
+ toTrimmedString
20
+ } from "./chunk-WHLVPK32.js";
24
21
  import {
25
22
  asTrimmedString
26
23
  } 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";
27
33
  import {
28
34
  asOptionalTrimmedString
29
35
  } from "./chunk-G3SUCT4W.js";
@@ -83,6 +89,283 @@ var sanitizeOptionalModelString = (value) => {
83
89
 
84
90
  // packages/ai/agent/agentSlice.ts
85
91
  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
86
369
  var createAgentCredentialBroker = createFileCredentialBroker;
87
370
  function setAgentCredentialBrokerFactoryForTests(factory) {
88
371
  createAgentCredentialBroker = factory ?? createFileCredentialBroker;
@@ -300,7 +583,7 @@ var slice = createSliceWithThunks({
300
583
  const overrides = {};
301
584
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
302
585
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
303
- const { _executeModel } = await import("./_executeModel-BFVTGZXE.js");
586
+ const { _executeModel } = await import("./_executeModel-5ARVVUIK.js");
304
587
  return _executeModel(
305
588
  {
306
589
  isStreaming: args.isStreaming ?? false,
@@ -321,7 +604,7 @@ var slice = createSliceWithThunks({
321
604
  * - 循环直到无工具调用或触发其他运行时停止条件
322
605
  */
323
606
  runAgent: create.asyncThunk(async (args, thunkApi) => {
324
- const { runAgentClientLoop } = await import("./runAgentClientLoop-5TGSUKHV.js");
607
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-6OGPS6SI.js");
325
608
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
326
609
  {
327
610
  agentKey: args.agentKey,
@@ -337,7 +620,7 @@ var slice = createSliceWithThunks({
337
620
  * 聊天轮次流式 Agent 调用
338
621
  */
339
622
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
340
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-HRFMVSVC.js");
623
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-TIGCZUNZ.js");
341
624
  return streamAgentChatTurnHandler(args, thunkApi);
342
625
  }),
343
626
  /**
@@ -563,6 +846,11 @@ var agentSlice_default = agentReducer;
563
846
  export {
564
847
  fetchServerSyncedCredential,
565
848
  deleteServerSyncedCredential,
849
+ createFileCredentialBroker,
850
+ resolveRequestedRuntimeToolNames,
851
+ resolveCurrentRunRuntimeToolPolicy,
852
+ resolveLocalRuntimeEnvFromPolicy,
853
+ resolveLocalWorkspaceExecutorOptionsFromPolicy,
566
854
  setAgentCredentialBrokerFactoryForTests,
567
855
  slice,
568
856
  runLlm,
@@ -47,7 +47,7 @@ function defaultGenerateBatchId() {
47
47
  }
48
48
  var LOCK_STALE_MS = 5e3;
49
49
  var TMP_STALE_MS = 6e4;
50
- function withRunRecordLock(runId, deps, fn) {
50
+ function withRunRecordLock(runId, deps, fn, opts = {}) {
51
51
  const fs = deps.fs ?? nodeFs;
52
52
  const now = deps.now ?? (() => /* @__PURE__ */ new Date());
53
53
  const lockPath = `${resolveRunRecordPath(runId, deps.env, deps.homedir)}.lock`;
@@ -68,6 +68,7 @@ function withRunRecordLock(runId, deps, fn) {
68
68
  } catch {
69
69
  }
70
70
  }
71
+ if (!held && opts.strict) return void 0;
71
72
  return fn();
72
73
  } finally {
73
74
  if (held) {
@@ -443,6 +444,63 @@ function ackRunRecord(runId, deps = {}) {
443
444
  if (!record) return;
444
445
  if (record.ack) return;
445
446
  record.ack = true;
447
+ delete record.ackLease;
448
+ writeRunRecord(record, deps);
449
+ });
450
+ }
451
+ var DEFAULT_ACK_LEASE_TTL_MS = 15 * 60 * 1e3;
452
+ function isAckLeaseExpired(lease, nowMs) {
453
+ if (!lease) return true;
454
+ const ttl = typeof lease.ttlMs === "number" && lease.ttlMs > 0 ? lease.ttlMs : DEFAULT_ACK_LEASE_TTL_MS;
455
+ const claimedAt = typeof lease.claimedAt === "number" ? lease.claimedAt : 0;
456
+ return nowMs - claimedAt >= ttl;
457
+ }
458
+ function isRunRecordClaimed(record, nowMs) {
459
+ if (!record) return false;
460
+ if (record.ack === true && !record.ackLease) return true;
461
+ return !isAckLeaseExpired(record.ackLease, nowMs);
462
+ }
463
+ function claimRunRecord(runId, deps = {}) {
464
+ const now = deps.now ?? (() => /* @__PURE__ */ new Date());
465
+ const nowMs = now().getTime();
466
+ return withRunRecordLock(
467
+ runId,
468
+ deps,
469
+ () => {
470
+ const record = readRunRecord(runId, deps);
471
+ if (!record) return null;
472
+ if (record.ack === true && !record.ackLease) return null;
473
+ if (!isAckLeaseExpired(record.ackLease, nowMs)) return null;
474
+ const token = `${nowMs.toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
475
+ record.ack = true;
476
+ record.ackLease = {
477
+ token,
478
+ claimedAt: nowMs,
479
+ ttlMs: deps.ttlMs && deps.ttlMs > 0 ? deps.ttlMs : DEFAULT_ACK_LEASE_TTL_MS
480
+ };
481
+ writeRunRecord(record, deps);
482
+ return token;
483
+ },
484
+ { strict: true }
485
+ ) ?? null;
486
+ }
487
+ function commitRunRecordClaim(runId, token, deps = {}) {
488
+ withRunRecordLock(runId, deps, () => {
489
+ const record = readRunRecord(runId, deps);
490
+ if (!record) return;
491
+ if (record.ackLease && record.ackLease.token !== token) return;
492
+ record.ack = true;
493
+ delete record.ackLease;
494
+ writeRunRecord(record, deps);
495
+ });
496
+ }
497
+ function releaseRunRecordAck(runId, token, deps = {}) {
498
+ withRunRecordLock(runId, deps, () => {
499
+ const record = readRunRecord(runId, deps);
500
+ if (!record) return;
501
+ if (!record.ackLease || record.ackLease.token !== token) return;
502
+ delete record.ackLease;
503
+ delete record.ack;
446
504
  writeRunRecord(record, deps);
447
505
  });
448
506
  }
@@ -908,6 +966,12 @@ export {
908
966
  rewriteMsgFileArg,
909
967
  spawnLocalBackgroundRun,
910
968
  ackRunRecord,
969
+ DEFAULT_ACK_LEASE_TTL_MS,
970
+ isAckLeaseExpired,
971
+ isRunRecordClaimed,
972
+ claimRunRecord,
973
+ commitRunRecordClaim,
974
+ releaseRunRecordAck,
911
975
  finalizeRunRecord,
912
976
  isPidGone,
913
977
  defaultGetProcessStartTime,
@@ -263,7 +263,6 @@ export {
263
263
  getIsDesktopApp,
264
264
  createClientLogger,
265
265
  isAbortError,
266
- fetchWithTransientReadRetry,
267
266
  logger,
268
267
  getAllServers,
269
268
  fetchFromClientDb,
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  updateContentTitle
3
- } from "./chunk-UFL6WHHJ.js";
3
+ } from "./chunk-YLC42PIE.js";
4
4
  import {
5
5
  require_date_fns
6
6
  } from "./chunk-M76ECQRD.js";
7
- import {
8
- require_react
9
- } from "./chunk-3ASDTTEI.js";
10
7
  import {
11
8
  toErrorMessage
12
9
  } from "./chunk-HNMXYYJR.js";
10
+ import {
11
+ require_react
12
+ } from "./chunk-3ASDTTEI.js";
13
13
  import {
14
14
  patch,
15
15
  readAndWait
16
- } from "./chunk-G2BZ43DV.js";
16
+ } from "./chunk-LAXMH7JY.js";
17
17
  import {
18
18
  asOptionalTrimmedString
19
19
  } from "./chunk-G3SUCT4W.js";
@@ -367,7 +367,7 @@ async function saveDocState(arg, { dispatch, getState }) {
367
367
  }
368
368
  }
369
369
  async function createDocState(args, thunkApi) {
370
- const { createPageAction } = await import("./createPageAction-YMZ7K363.js");
370
+ const { createPageAction } = await import("./createPageAction-2I5PHJFF.js");
371
371
  return createPageAction(args, thunkApi);
372
372
  }
373
373
  function subscribe(listener) {
@@ -2,7 +2,7 @@ import {
2
2
  LOCAL_CODEX_AGENT_KEY,
3
3
  isLocalCliAgentKey,
4
4
  resolveCliAgentKeyInput
5
- } from "./chunk-VHBWHNVT.js";
5
+ } from "./chunk-K6QEHQZ3.js";
6
6
  import {
7
7
  DEFAULT_NOLO_SERVER_URL
8
8
  } from "./chunk-OLZBQWZU.js";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-H5S4XUGI.js";
5
- import {
6
- clipMultilineText
7
- } from "./chunk-WMB7GVPN.js";
4
+ } from "./chunk-Q243PXRU.js";
8
5
  import {
9
6
  runLocalAgentTurn
10
- } from "./chunk-Z54ZAZZC.js";
7
+ } from "./chunk-VQ4QPCKE.js";
8
+ import {
9
+ clipMultilineText
10
+ } from "./chunk-CYRMUTGB.js";
11
11
  import {
12
12
  resolveLocalRuntimeEnvFromPolicy
13
- } from "./chunk-5CS33IBL.js";
13
+ } from "./chunk-4F77PJBR.js";
14
14
  import {
15
15
  toErrorMessage
16
16
  } from "./chunk-HNMXYYJR.js";
@@ -28,8 +28,8 @@ import {
28
28
  asRecordOrEmpty
29
29
  } from "./chunk-KX6YBIHG.js";
30
30
  import {
31
- asTrimmedNonEmptyStringArray
32
- } from "./chunk-I42VC5KR.js";
31
+ ownedAgentKey
32
+ } from "./chunk-TOW4E763.js";
33
33
  import {
34
34
  asTrimmedString
35
35
  } from "./chunk-3EUW3WEO.js";
@@ -39,6 +39,9 @@ import {
39
39
  import {
40
40
  isRecord
41
41
  } from "./chunk-KUG52IAP.js";
42
+ import {
43
+ asTrimmedNonEmptyStringArray
44
+ } from "./chunk-I42VC5KR.js";
42
45
  import {
43
46
  asOptionalTrimmedString
44
47
  } from "./chunk-G3SUCT4W.js";
@@ -446,10 +449,14 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
446
449
  toolNames,
447
450
  ...policy ? { runtimeToolPolicy: policy } : {}
448
451
  };
452
+ const dispatchUserId = String(args.runtimeEnv.NOLO_USER_ID || "local");
453
+ const localUserId = String(
454
+ args.runtimeEnv.NOLO_LOCAL_USER_ID || args.runtimeEnv.NOLO_USER_ID || "local"
455
+ );
449
456
  const store = /* @__PURE__ */ new Map([
450
457
  [agentKey, agentRecord],
451
- [`agent-${args.runtimeEnv.NOLO_USER_ID || "local"}-${agentKey}`, agentRecord],
452
- [`agent-${args.runtimeEnv.NOLO_LOCAL_USER_ID || args.runtimeEnv.NOLO_USER_ID || "local"}-${agentKey}`, agentRecord]
458
+ [ownedAgentKey(dispatchUserId, agentKey), agentRecord],
459
+ [ownedAgentKey(localUserId, agentKey), agentRecord]
453
460
  ]);
454
461
  const env = localRuntimeEnvFromPolicy(
455
462
  withForwardedUserAuthToken(args.runtimeEnv, args.parsed),
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  selectCurrentServer
3
- } from "./chunk-R7LOFGRE.js";
3
+ } from "./chunk-G5GVZAXF.js";
4
4
  import {
5
5
  patch
6
- } from "./chunk-G2BZ43DV.js";
6
+ } from "./chunk-LAXMH7JY.js";
7
7
  import {
8
8
  selectIdentityToken
9
- } from "./chunk-XMLRJUU5.js";
9
+ } from "./chunk-2IJAKBK2.js";
10
10
  import {
11
11
  getIsDesktopApp
12
- } from "./chunk-R5V5G73M.js";
12
+ } from "./chunk-5RDLGLAP.js";
13
13
 
14
14
  // packages/ai/agent/cliChatClient.ts
15
15
  function getCliChatRequestConfig(thunkApi) {
@@ -1,7 +1,9 @@
1
1
  import {
2
- fetchReferenceContents,
3
2
  resolveReferenceAssets
4
- } from "./chunk-FVOSIYXM.js";
3
+ } from "./chunk-R5Y4XELF.js";
4
+ import {
5
+ fetchReferenceContents
6
+ } from "./chunk-OIW2RJ74.js";
5
7
 
6
8
  // packages/ai/agent/fetchAgentContexts.ts
7
9
  async function fetchAgentContexts(references, dispatch) {
@@ -516,6 +516,7 @@ var isPlatformHostedClaudeModel = (model) => PLATFORM_HOSTED_CLAUDE_MODELS.some(
516
516
  );
517
517
  var PLATFORM_HOSTED_GROK_4_6_MODEL = "grok-4.6";
518
518
  var isPlatformHostedGrokModel = (model) => asTrimmedLowercaseString(model) === PLATFORM_HOSTED_GROK_4_6_MODEL;
519
+ var PLATFORM_HOSTED_QWEN_37_FLASH_MODEL = "qwen3.7-flash";
519
520
  var PLATFORM_CREDITS_PER_USD = 7;
520
521
  var EXTERNAL_API_DISCOUNT = 0.8;
521
522
  var toPlatformCredits = (usdPerMillion) => Number(
@@ -687,6 +688,19 @@ var platformHostedModels = [
687
688
  maxOutputTokens: 1e5,
688
689
  contextWindow: 5e5,
689
690
  supportsTool: true
691
+ },
692
+ {
693
+ name: PLATFORM_HOSTED_QWEN_37_FLASH_MODEL,
694
+ displayName: "Qwen 3.7 Flash",
695
+ hasVision: true,
696
+ // 上游 OpenRouter:$0.03/$0.13 per 1M → nolo 8 折 ×7
697
+ price: {
698
+ input: toPlatformCredits(0.03),
699
+ output: toPlatformCredits(0.13)
700
+ },
701
+ maxOutputTokens: 65536,
702
+ contextWindow: 1e6,
703
+ supportsTool: true
690
704
  }
691
705
  ];
692
706
 
@@ -705,6 +719,7 @@ export {
705
719
  resolveFireworksKimiModel,
706
720
  isPlatformHostedClaudeModel,
707
721
  isPlatformHostedGrokModel,
722
+ PLATFORM_HOSTED_QWEN_37_FLASH_MODEL,
708
723
  PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
709
724
  PLATFORM_HOSTED_DEEPSEEK_FLASH_PRICE,
710
725
  getPlatformHostedDeepSeekV4Price,