nolo-cli 0.29.2 → 0.30.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 (135) hide show
  1. package/{_executeModel-BFVTGZXE.js → _executeModel-VBHHG7LT.js} +62 -68
  2. package/{action-LG32A6DJ.js → action-FENWPT3C.js} +14 -15
  3. package/{addContentAction-MPGMBJTQ.js → addContentAction-Z5S5ZQ7I.js} +12 -12
  4. package/{addDialogAgentAction-ZH23WDID.js → addDialogAgentAction-VUNVD2XR.js} +11 -11
  5. package/{agentDeleteCommand-4S4STG42.js → agentDeleteCommand-LLGZXUYJ.js} +60 -39
  6. package/{agentEmailCommands-3F4IP4DI.js → agentEmailCommands-LC2FPN6G.js} +76 -81
  7. package/{agentGrantCommands-JNDE4RWR.js → agentGrantCommands-E7ZZFRHK.js} +2 -1
  8. package/{agentListCommands-JCRV2XF6.js → agentListCommands-A6OBQ3QX.js} +57 -40
  9. package/{agentMachineCommands-KYXPYSFP.js → agentMachineCommands-4O4Q5B5X.js} +53 -35
  10. package/{agentPullCommand-ZZGU5KOY.js → agentPullCommand-4V36XNGV.js} +4 -3
  11. package/{agentRecordCommands-UADUPIXO.js → agentRecordCommands-W22RIQRV.js} +73 -78
  12. package/{agentRunCommand-MJWSR53W.js → agentRunCommand-V4OBU4FB.js} +77 -82
  13. package/{agentRunControl-SNUKXN6J.js → agentRunControl-AKBN2366.js} +13 -1
  14. package/{agentRuntimeLocal-PC5RRRPT.js → agentRuntimeLocal-I57YSGH4.js} +48 -30
  15. package/{agentSlice-C5OYLNBT.js → agentSlice-3ZHY7RAO.js} +12 -13
  16. package/{appDeleteCommands-ZXODZ5AD.js → appDeleteCommands-DJJF466K.js} +53 -35
  17. package/{appDeployCommands-AWC6JPZH.js → appDeployCommands-WJZGIOEZ.js} +53 -35
  18. package/{appDeployStatusCommands-74NXMDAI.js → appDeployStatusCommands-ICYXUJNO.js} +53 -35
  19. package/{appGetCommands-6YGIAP5L.js → appGetCommands-UOCWYJPV.js} +53 -35
  20. package/{appListCommands-DZWBHMNK.js → appListCommands-EOKWTXPW.js} +53 -35
  21. package/{authCommand-XMQHBK5L.js → authCommand-H5KE7K7K.js} +16 -16
  22. package/{authCommands-JSOG2H4E.js → authCommands-CXJ6PI2O.js} +7 -7
  23. package/{chunk-OEWEE4VW.js → chunk-2XM5KUNE.js} +4 -2
  24. package/{chunk-7H3UTGPM.js → chunk-3AUWC6EM.js} +82 -3
  25. package/{chunk-HEXXIS77.js → chunk-3RIWR23B.js} +1 -1
  26. package/{chunk-R7LOFGRE.js → chunk-446VANPP.js} +18 -14
  27. package/{chunk-RZNYL4LW.js → chunk-4SAV7BD7.js} +65 -1
  28. package/{chunk-QC6ZWDSV.js → chunk-56IUA7RU.js} +3 -3
  29. package/{chunk-R3JSTDQO.js → chunk-66O5MZYH.js} +1 -1
  30. package/{chunk-PSK2RUHV.js → chunk-7CD24PU4.js} +360 -2
  31. package/{chunk-G2BZ43DV.js → chunk-A4JDTA5T.js} +13 -13
  32. package/{chunk-DZ3XJVET.js → chunk-AOS5IN2I.js} +1 -1
  33. package/{chunk-SKDNBYZK.js → chunk-BOL2D2JW.js} +1 -1
  34. package/{chunk-YTA2QOEE.js → chunk-CAENRKNJ.js} +15 -0
  35. package/{chunk-2TYLTEAH.js → chunk-CV6I4HBA.js} +1 -1
  36. package/chunk-DCDL3GC4.js +171 -0
  37. package/{chunk-FVOSIYXM.js → chunk-DCWBP2O7.js} +42 -393
  38. package/{chunk-OLWMGSW2.js → chunk-DI6MXJK5.js} +37 -37
  39. package/{chunk-HRPWRVBI.js → chunk-DKRT67FG.js} +11 -11
  40. package/{chunk-L6RBX4L4.js → chunk-DWQNDGO7.js} +20 -8
  41. package/{chunk-VKBTAQWT.js → chunk-FS5TTXPS.js} +6 -6
  42. package/chunk-G5JHHUAK.js +73 -0
  43. package/{chunk-TOGGHWHI.js → chunk-G6VITLCZ.js} +3 -3
  44. package/{chunk-RJBTU7AS.js → chunk-GAGUBI42.js} +302 -14
  45. package/{chunk-NXMJ55RU.js → chunk-GVKTKT3O.js} +3 -3
  46. package/{chunk-5ZXNLOAG.js → chunk-HI7QZNWX.js} +17 -10
  47. package/{chunk-DF7SMWEV.js → chunk-HLG6GAUD.js} +1 -1
  48. package/{chunk-MQRZ5QUH.js → chunk-IXZX5CJK.js} +1 -1
  49. package/{chunk-IC7W63RM.js → chunk-IZ3CBMD5.js} +3 -3
  50. package/{chunk-VHBWHNVT.js → chunk-K6QEHQZ3.js} +8 -4
  51. package/chunk-KW47OSRJ.js +3246 -0
  52. package/{chunk-Q5RXHXKU.js → chunk-KWKD3BCC.js} +189 -122
  53. package/{chunk-L65QKSVJ.js → chunk-L3GCUVOH.js} +1 -1
  54. package/{chunk-4BDPDTJU.js → chunk-L3VQOVKK.js} +8 -8
  55. package/{chunk-HALKDXKP.js → chunk-MEUZFIAJ.js} +8 -4
  56. package/{chunk-H5S4XUGI.js → chunk-MMCVBEAD.js} +174 -149
  57. package/{chunk-XOIF2TNF.js → chunk-OB6FBSH3.js} +13 -0
  58. package/chunk-OYK7PA5U.js +1707 -0
  59. package/{chunk-6HTWA77J.js → chunk-Q24P6TUS.js} +1 -1
  60. package/{chunk-GMJS5AYP.js → chunk-QLV2GKU5.js} +16 -178
  61. package/{chunk-WMB7GVPN.js → chunk-SWOTB2TX.js} +134 -1166
  62. package/{chunk-GC34RRTQ.js → chunk-SWYMCHM7.js} +1 -69
  63. package/{chunk-BBGRJB5E.js → chunk-SZ5CBYMZ.js} +4 -4
  64. package/chunk-T27IEBNQ.js +149 -0
  65. package/{chunk-WX3ZOSTL.js → chunk-T3Y5EMJS.js} +24 -26
  66. package/{chunk-UFL6WHHJ.js → chunk-THTAR67C.js} +1056 -137
  67. package/{chunk-2FX23RGA.js → chunk-TJYWZ3LO.js} +4 -4
  68. package/{chunk-KEF5OBOZ.js → chunk-UKC5HU2C.js} +33 -27
  69. package/{chunk-HRJEPMZY.js → chunk-UTQZ73QQ.js} +2 -2
  70. package/{chunk-GT3GG2H7.js → chunk-VSTUQGLT.js} +1 -1
  71. package/{chunk-32ZM6HVI.js → chunk-W2YKDXT7.js} +95 -95
  72. package/{chunk-L3QFIBZG.js → chunk-WTGCTVJG.js} +1 -1
  73. package/{chunk-XS7UPVR7.js → chunk-XD5NQEOH.js} +5 -5
  74. package/{chunk-WSQLK2KR.js → chunk-XFGM5PJP.js} +6 -6
  75. package/{chunk-JSB4N6NU.js → chunk-YLADSPDU.js} +3 -3
  76. package/{chunk-FRN5QOKN.js → chunk-YWGSCF37.js} +19 -4
  77. package/{codingSkills-EN6Z6G6U.js → codingSkills-V35TRR4Y.js} +1 -2
  78. package/{createAgentAutomationAction-BK4UZJKU.js → createAgentAutomationAction-3GMH6ORX.js} +30 -37
  79. package/{createDialogAction-MJJUI2MK.js → createDialogAction-R5MCL4RE.js} +32 -38
  80. package/{createPageAction-YMZ7K363.js → createPageAction-QYTG656R.js} +43 -50
  81. package/{dbSlice-6QJYQUBV.js → dbSlice-OBV7VFCF.js} +11 -11
  82. package/{deleteFile-WDZ3VM7B.js → deleteFile-AC45HYSM.js} +5 -5
  83. package/{dialogCommands-OKH45ASS.js → dialogCommands-NUQGIXVZ.js} +53 -37
  84. package/{dialogSlice-UDOKNDHB.js → dialogSlice-CFDECXEU.js} +27 -34
  85. package/{docCreateCommands-MCLMR4TE.js → docCreateCommands-UNFCXB5N.js} +52 -36
  86. package/{docDeleteCommands-ONDHI7JV.js → docDeleteCommands-NG5IVKE5.js} +54 -38
  87. package/{docReadCommands-FCXBMISW.js → docReadCommands-6J7MUUX6.js} +52 -36
  88. package/{docStore-N66O4CGH.js → docStore-MZZWJM4F.js} +28 -35
  89. package/{docUpdateCommands-T3XN6XOX.js → docUpdateCommands-6AW3VZOX.js} +55 -39
  90. package/{fetchMessages-W4IKHPCS.js → fetchMessages-VPPQDDZ4.js} +3 -3
  91. package/{getPricing-X6I23RN6.js → getPricing-XQYSSVV6.js} +6 -7
  92. package/{handleSendMessageAction-KC4AYUZP.js → handleSendMessageAction-IU2QNTLM.js} +30 -37
  93. package/index.js +72 -72
  94. package/{localDialogRead-UFLBS6OT.js → localDialogRead-P72W2U2R.js} +1 -1
  95. package/{machineCommands-DIMRFA3Y.js → machineCommands-Z2QEWTHZ.js} +76 -81
  96. package/{machineWsRunDispatch-2DYJZI6Z.js → machineWsRunDispatch-SJTYHZHN.js} +71 -76
  97. package/{models-YT32CTT5.js → models-WDUTTYFS.js} +2 -2
  98. package/{offlineMarxistsAgentCommand-5OOWZLJI.js → offlineMarxistsAgentCommand-E6LUG63A.js} +6 -2
  99. package/package.json +1 -1
  100. package/{read-C7Y6LSBM.js → read-QK7ZRX6G.js} +6 -6
  101. package/{readDocTool-TOHRYJHP.js → readDocTool-EYDMVRBL.js} +2 -1
  102. package/{readlineWorkspace-HUPHMLDG.js → readlineWorkspace-EY3BPXIU.js} +150 -162
  103. package/{removeDialogAgentAction-WZXPOH5S.js → removeDialogAgentAction-TBW3UZJW.js} +15 -16
  104. package/{runAgentClientLoop-5TGSUKHV.js → runAgentClientLoop-N3YDLTMS.js} +61 -66
  105. package/{setDialogExtraReferencesAction-INZY2ENI.js → setDialogExtraReferencesAction-Q3ANF2NR.js} +12 -12
  106. package/{setPrimaryDialogAgentAction-WCVLPYCF.js → setPrimaryDialogAgentAction-FQ5R3EFJ.js} +15 -16
  107. package/{settingSlice-IDUM4LWU.js → settingSlice-JKKV2T7O.js} +13 -14
  108. package/{skillDiscovery-ITA7BI7A.js → skillDiscovery-I3QRA7NE.js} +2 -2
  109. package/{spaceCommands-XSSDB3YK.js → spaceCommands-R6AEQNLG.js} +57 -40
  110. package/{spaceSlice-BXDCO6PT.js → spaceSlice-MCH7RLLP.js} +27 -34
  111. package/{streamAgentChatTurn-HRFMVSVC.js → streamAgentChatTurn-Q4U2CVMI.js} +130 -1300
  112. package/{switchDialogAgentAction-YBFFCBOD.js → switchDialogAgentAction-QQGVE4SL.js} +11 -11
  113. package/{toolApiClient-WVTUYOFM.js → toolApiClient-ARGFDJAG.js} +2 -2
  114. package/{tools-5V6FHWQU.js → tools-Y3UBLLYW.js} +50 -56
  115. package/{tuiSummaryLlmCaller-GCUPULOV.js → tuiSummaryLlmCaller-4474IBTI.js} +12 -12
  116. package/{updateDialogTitleAction-W62C4W4K.js → updateDialogTitleAction-3J7GH67I.js} +35 -43
  117. package/chunk-5CS33IBL.js +0 -301
  118. package/chunk-5MMAK75Q.js +0 -15
  119. package/chunk-HYSJHRWD.js +0 -669
  120. package/chunk-MRC4Q34M.js +0 -188
  121. package/chunk-SIZQB7BD.js +0 -91
  122. package/chunk-UEOPA6MV.js +0 -641
  123. package/chunk-VIDPVFP3.js +0 -20
  124. package/chunk-W2LZV5GE.js +0 -231
  125. package/chunk-Y5GCAMGP.js +0 -9
  126. package/chunk-YYLHWIW6.js +0 -48
  127. package/chunk-Z54ZAZZC.js +0 -1791
  128. package/chunk-ZZ2MH7LE.js +0 -84
  129. package/{chunk-OMP5L5NF.js → chunk-44HACRCK.js} +3 -3
  130. package/{chunk-ZVZMT3EA.js → chunk-KWCLUYGQ.js} +3 -3
  131. package/{chunk-NRY4GCKJ.js → chunk-WHLVPK32.js} +3 -3
  132. package/{chunk-RQSOAMPJ.js → chunk-Z5MXSEOJ.js} +2 -2
  133. package/{chunk-XMLRJUU5.js → chunk-ZFTCLBEX.js} +9 -9
  134. package/{runtimeDoctorCommands-HSU632DY.js → runtimeDoctorCommands-E2OUORHK.js} +3 -3
  135. package/{tableCommands-QSZILI7I.js → tableCommands-PRJNWN6Q.js} +6 -6
@@ -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-A4JDTA5T.js";
19
12
  import {
20
13
  asyncThunkCreator,
21
14
  buildCreateSlice,
22
15
  getRuntimeServerContext
23
- } from "./chunk-XMLRJUU5.js";
16
+ } from "./chunk-ZFTCLBEX.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-VBHHG7LT.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-N3YDLTMS.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-Q4U2CVMI.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,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-DF7SMWEV.js";
4
+ } from "./chunk-HLG6GAUD.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-QC6ZWDSV.js";
7
+ } from "./chunk-56IUA7RU.js";
8
8
  import {
9
9
  toSafeAgentSummary
10
- } from "./chunk-HRJEPMZY.js";
10
+ } from "./chunk-UTQZ73QQ.js";
11
11
  import {
12
12
  PUBLIC_AGENT_KEY_PREFIX,
13
13
  isOwnedAgentKey,
@@ -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-MMCVBEAD.js";
8
5
  import {
9
6
  runLocalAgentTurn
10
- } from "./chunk-Z54ZAZZC.js";
7
+ } from "./chunk-KW47OSRJ.js";
8
+ import {
9
+ clipMultilineText
10
+ } from "./chunk-OYK7PA5U.js";
11
11
  import {
12
12
  resolveLocalRuntimeEnvFromPolicy
13
- } from "./chunk-5CS33IBL.js";
13
+ } from "./chunk-GAGUBI42.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),
@@ -2,7 +2,7 @@ import {
2
2
  deleteDbRecord,
3
3
  queryUserRecords,
4
4
  readDbRecord
5
- } from "./chunk-QC6ZWDSV.js";
5
+ } from "./chunk-56IUA7RU.js";
6
6
  import {
7
7
  mergeAndDedupUserData
8
8
  } from "./chunk-KQHGZWSV.js";
@@ -2,7 +2,7 @@ import {
2
2
  CORE_DRAIN_REASON,
3
3
  isGatewayHttpStatus,
4
4
  parseRetryAfterHeaderMs
5
- } from "./chunk-RQSOAMPJ.js";
5
+ } from "./chunk-Z5MXSEOJ.js";
6
6
  import {
7
7
  asTrimmedLowercaseString
8
8
  } from "./chunk-QSJ3HFEF.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  selectCurrentServer
3
- } from "./chunk-R7LOFGRE.js";
3
+ } from "./chunk-446VANPP.js";
4
4
  import {
5
5
  patch
6
- } from "./chunk-G2BZ43DV.js";
6
+ } from "./chunk-A4JDTA5T.js";
7
7
  import {
8
8
  selectIdentityToken
9
- } from "./chunk-XMLRJUU5.js";
9
+ } from "./chunk-ZFTCLBEX.js";
10
10
  import {
11
11
  getIsDesktopApp
12
12
  } from "./chunk-R5V5G73M.js";
@@ -1,17 +1,21 @@
1
1
  import {
2
2
  asTrimmedLowercaseString
3
3
  } from "./chunk-QSJ3HFEF.js";
4
+ import {
5
+ ownedAgentKey,
6
+ publicAgentKey
7
+ } from "./chunk-TOW4E763.js";
4
8
 
5
9
  // packages/cli/agentAliases.ts
6
10
  var CURRENT_OPERATOR_USER_ID = "0e95801d90";
7
11
  var NOLO_DEFAULT_AGENT_ID = "01NOLOAPPBLD000000019KCKT0";
8
- var NOLO_DEFAULT_AGENT_KEY = `agent-pub-${NOLO_DEFAULT_AGENT_ID}`;
12
+ var NOLO_DEFAULT_AGENT_KEY = publicAgentKey(NOLO_DEFAULT_AGENT_ID);
9
13
  var NOLO_PROJECT_MANAGER_AGENT_ID = "01NOLOPROJMGR00000000MSVGG";
10
- var NOLO_PROJECT_MANAGER_AGENT_KEY = `agent-${CURRENT_OPERATOR_USER_ID}-${NOLO_PROJECT_MANAGER_AGENT_ID}`;
14
+ var NOLO_PROJECT_MANAGER_AGENT_KEY = ownedAgentKey(CURRENT_OPERATOR_USER_ID, NOLO_PROJECT_MANAGER_AGENT_ID);
11
15
  var NOLO_FRONTEND_AGENT_ID = "01FRONTENDAG0000000115N4E1";
12
- var NOLO_FRONTEND_AGENT_KEY = `agent-${CURRENT_OPERATOR_USER_ID}-${NOLO_FRONTEND_AGENT_ID}`;
16
+ var NOLO_FRONTEND_AGENT_KEY = ownedAgentKey(CURRENT_OPERATOR_USER_ID, NOLO_FRONTEND_AGENT_ID);
13
17
  var LOCAL_CODEX_AGENT_ID = "01LOCALCODEXCLI000000NEW";
14
- var LOCAL_CODEX_AGENT_KEY = `agent-${CURRENT_OPERATOR_USER_ID}-${LOCAL_CODEX_AGENT_ID}`;
18
+ var LOCAL_CODEX_AGENT_KEY = ownedAgentKey(CURRENT_OPERATOR_USER_ID, LOCAL_CODEX_AGENT_ID);
15
19
  var AGENT_ALIAS_TO_KEY = {
16
20
  nolo: NOLO_DEFAULT_AGENT_KEY,
17
21
  default: NOLO_DEFAULT_AGENT_KEY,