nolo-cli 0.33.0-alpha.9 → 0.34.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-2WR4RTZZ.js → _executeModel-BUYCXZCQ.js} +65 -65
  2. package/{action-OQWPNKAH.js → action-KMBZ3LCZ.js} +12 -12
  3. package/{addContentAction-YVINZQTF.js → addContentAction-KQ44UT2U.js} +10 -10
  4. package/{addDialogAgentAction-6IOCIEPI.js → addDialogAgentAction-ILSDCMYL.js} +9 -9
  5. package/{agentDeleteCommand-H22WRYC6.js → agentDeleteCommand-WSS2IJVM.js} +40 -39
  6. package/{agentEmailCommands-DGJVCMCG.js → agentEmailCommands-SHTPJTSX.js} +75 -75
  7. package/{agentListCommands-6NWMLIMQ.js → agentListCommands-GV6UYVAF.js} +47 -37
  8. package/{agentMachineCommands-5MUO6RDI.js → agentMachineCommands-FLD7TAFH.js} +37 -36
  9. package/agentProviderCommands-65ZC2WB4.js +122 -0
  10. package/{agentPullCommand-YH5GEBK4.js → agentPullCommand-TSWAJPS2.js} +1 -1
  11. package/agentRecordCommands-57W6R7QW.js +113 -0
  12. package/{agentRunCommand-LYEMVQJH.js → agentRunCommand-HJGXSMDN.js} +78 -76
  13. package/{agentRunControl-SCIVRZWX.js → agentRunControl-GXOB47YI.js} +5 -1
  14. package/{agentRuntimeLocal-PRAR3NCW.js → agentRuntimeLocal-G7ZV55I6.js} +33 -33
  15. package/{agentSlice-AMDSTXP5.js → agentSlice-HFR7SP3B.js} +12 -12
  16. package/agentSuperviseCommands-Q64S5SPG.js +640 -0
  17. package/{appDeleteCommands-L5PKC42V.js → appDeleteCommands-SHHE56Y2.js} +35 -34
  18. package/{appDeployCommands-3J7Z4XWV.js → appDeployCommands-WUMSO2VS.js} +35 -34
  19. package/{appDeployStatusCommands-YTRPXE72.js → appDeployStatusCommands-VZSVN6SR.js} +35 -34
  20. package/{appGetCommands-JVXV5WXD.js → appGetCommands-ZJ2C3A5Y.js} +35 -34
  21. package/{appListCommands-7KDEOJSO.js → appListCommands-W33L6U5X.js} +35 -34
  22. package/{authCommand-6Y5LTMZB.js → authCommand-B2XRHNJH.js} +19 -19
  23. package/{authCommands-EAPFGNHN.js → authCommands-GWABTFMR.js} +6 -6
  24. package/{chatQueueReduxAdapter-ZKSS6XRV.js → chatQueueReduxAdapter-SYIX4ODY.js} +28 -28
  25. package/{chunk-UM4H3URE.js → chunk-23KKIMD5.js} +7 -7
  26. package/{chunk-HUCT7HID.js → chunk-2KO5QQFV.js} +2 -2
  27. package/{chunk-2UECQ7RE.js → chunk-3AOLVADY.js} +1 -1
  28. package/{chunk-EMW55KKX.js → chunk-3LWZNEGQ.js} +1 -1
  29. package/{chunk-MQWVAOIU.js → chunk-3XZUNRYF.js} +33 -158
  30. package/{chunk-M2YMQOLC.js → chunk-4APLX2RT.js} +75 -10
  31. package/{chunk-ZHYK3N56.js → chunk-4AWH4LQA.js} +3 -1
  32. package/{chunk-3GZXL6FM.js → chunk-4DMPISV6.js} +7 -3
  33. package/chunk-4HOXB6SY.js +297 -0
  34. package/{chunk-OIQPORYI.js → chunk-64KIQZA2.js} +175 -2
  35. package/{chunk-BQ3OHLR5.js → chunk-6KYCG5GW.js} +1216 -690
  36. package/chunk-6XG52ZQ6.js +146 -0
  37. package/{chunk-GOIDVXK5.js → chunk-74IQ5RRO.js} +21 -8
  38. package/{chunk-FMEVI5TG.js → chunk-7CH6U3FL.js} +1 -1
  39. package/{chunk-DSBGWT2C.js → chunk-7YDKVLAE.js} +10 -10
  40. package/{chunk-5X4GQ53C.js → chunk-AUH2LTIY.js} +7 -7
  41. package/{chunk-UNOTBWZZ.js → chunk-B6H5XCT2.js} +8 -8
  42. package/{chunk-NNWHHCVP.js → chunk-BMB563Y6.js} +10 -4
  43. package/{chunk-DFUPZE6V.js → chunk-C6ELZQ7H.js} +249 -34
  44. package/{chunk-BXPBZVRE.js → chunk-DX6BP4K7.js} +285 -251
  45. package/{chunk-6HYVJV7B.js → chunk-ESHYE7WU.js} +2 -1
  46. package/{chunk-JZPBVBIY.js → chunk-FD36SCCD.js} +19 -8
  47. package/{chunk-7L5CQQIT.js → chunk-FDKEDU7R.js} +14 -14
  48. package/{chunk-DKMOY3QI.js → chunk-FGLKRJDI.js} +54 -3
  49. package/{chunk-2QTEYCR7.js → chunk-FTM4KUOZ.js} +17 -17
  50. package/{chunk-U4TRT5V4.js → chunk-GEPHJJW4.js} +1 -1
  51. package/{chunk-7YYHKBJP.js → chunk-GKHV4UH5.js} +1 -1
  52. package/{chunk-2IVEXF7P.js → chunk-GUYMR3JL.js} +6 -33
  53. package/{chunk-YDTYDA5W.js → chunk-GZRMWK5R.js} +6 -4
  54. package/{chunk-VWY2CZD2.js → chunk-HDT2RB7T.js} +3 -3
  55. package/{chunk-X664KVEV.js → chunk-HHBXCRJS.js} +204 -123
  56. package/{chunk-75U775RZ.js → chunk-IFS5CUEH.js} +1 -1
  57. package/{chunk-WLH5BAKX.js → chunk-IIOHYLIG.js} +9 -4
  58. package/{chunk-ADLYMQB6.js → chunk-IZCHPD7T.js} +52 -3
  59. package/{chunk-ITIA6OAQ.js → chunk-IZNJDUJ4.js} +5 -5
  60. package/{chunk-X2DAEZ3X.js → chunk-J5NMOM35.js} +1 -1
  61. package/{chunk-RPRRIFXV.js → chunk-JI2TIPLP.js} +1 -1
  62. package/{chunk-EGRJC4ZN.js → chunk-JIADXJYU.js} +1 -1
  63. package/{chunk-IHEC7VBF.js → chunk-K4KIFRIN.js} +1 -1
  64. package/{chunk-7INB7NXF.js → chunk-KCBK4MDT.js} +294 -54
  65. package/{chunk-WJSW43QZ.js → chunk-L3JWI7WX.js} +0 -1
  66. package/{chunk-XLLTJXAD.js → chunk-LAUUAYLK.js} +39 -2672
  67. package/{chunk-3RUW3ONU.js → chunk-LD6Y6RJY.js} +4 -4
  68. package/{chunk-AN7DGYMW.js → chunk-LQ6PUHW6.js} +5077 -3588
  69. package/chunk-M3JQWYBC.js +387 -0
  70. package/{chunk-GM6PU7B6.js → chunk-MEYIRKDN.js} +0 -1
  71. package/{chunk-6YXDOOSH.js → chunk-MGIHZ5CJ.js} +4 -4
  72. package/chunk-MI2J67UU.js +43 -0
  73. package/{chunk-4F5M2MW5.js → chunk-MJWX4JQO.js} +2 -2
  74. package/{chunk-Q5ITEGIN.js → chunk-N4XRDM26.js} +1 -1
  75. package/{chunk-5CS33IBL.js → chunk-NQ4N4IGO.js} +11 -12
  76. package/{chunk-ZZ2MH7LE.js → chunk-O6OSWFZQ.js} +0 -1
  77. package/{chunk-ZURFOV5J.js → chunk-OFZPJ3NT.js} +13 -4
  78. package/{chunk-RJKIB55Y.js → chunk-OSCSEJJR.js} +15 -8
  79. package/{chunk-SCUETSRP.js → chunk-PV734VZX.js} +1 -1
  80. package/{chunk-7E72JMBB.js → chunk-SMPAUSX5.js} +46 -5
  81. package/{chunk-ASDXPOJH.js → chunk-U6QQLXWI.js} +1 -1
  82. package/{chunk-NUO3QFWD.js → chunk-UNHKVD2N.js} +1 -1
  83. package/{chunk-GE6IWA5N.js → chunk-UNZDCI3O.js} +126 -1
  84. package/{chunk-CPYYM4RJ.js → chunk-V5GA74HI.js} +19 -5
  85. package/{chunk-UEAUAXYS.js → chunk-VBD7W4Q6.js} +2057 -212
  86. package/{chunk-DNQK7M7K.js → chunk-VD2SO4RG.js} +4 -4
  87. package/{chunk-FXFGNOT2.js → chunk-VFVCYIRQ.js} +1 -1
  88. package/{chunk-7KNERA53.js → chunk-VSA6QAGV.js} +47 -3
  89. package/{chunk-G7E4NWFE.js → chunk-W445DPVT.js} +1 -1
  90. package/{chunk-3UG2IIZ3.js → chunk-WN5AJG5I.js} +1 -1
  91. package/{chunk-KSRFVP36.js → chunk-WRN7L5CS.js} +1 -1
  92. package/{chunk-GJXRIOLS.js → chunk-WRP5TTM6.js} +4 -84
  93. package/chunk-X2K2JSO4.js +163 -0
  94. package/{chunk-OR2HNLVO.js → chunk-X6EN3KJX.js} +279 -477
  95. package/{chunk-IKWTTKWG.js → chunk-XQES6LXQ.js} +2 -2
  96. package/{chunk-IR6W62Q6.js → chunk-XT73C4VH.js} +18 -21
  97. package/{chunk-RY57GLGW.js → chunk-YPREESF4.js} +42 -5
  98. package/{chunk-WNHST4IE.js → chunk-YRP7LG4R.js} +4527 -4080
  99. package/{chunk-BQXOGBFN.js → chunk-YZ2WE6CW.js} +2 -2
  100. package/{chunk-3WXRAHCG.js → chunk-ZBB3MZR3.js} +3 -3
  101. package/{cliExecutor-DW3PHGEL.js → cliExecutor-BBUVQU4L.js} +2 -2
  102. package/{clipboardy-MMBYVRLF.js → clipboardy-PRUHGPGC.js} +4 -3
  103. package/{codingSkills-DY5MINPG.js → codingSkills-H6N5EKSX.js} +3 -3
  104. package/cooldownCommands-C2SZLEEO.js +90 -0
  105. package/{createAgentAutomationAction-GVSJL2CI.js → createAgentAutomationAction-BH3D2L2H.js} +28 -30
  106. package/{createDialogAction-VVR46Q2A.js → createDialogAction-U4LDV2RW.js} +31 -33
  107. package/{createPageAction-M2VDKBYS.js → createPageAction-Q2ANG535.js} +30 -32
  108. package/{dbSlice-UI2VCBLG.js → dbSlice-PIQGICNM.js} +9 -9
  109. package/{deleteFile-XQXPBFFB.js → deleteFile-NPZ64DFN.js} +4 -4
  110. package/{dialogCommands-26DBYNBT.js → dialogCommands-C556D6WD.js} +37 -36
  111. package/{dialogSlice-FFGLRCBL.js → dialogSlice-P2VSKG2X.js} +27 -27
  112. package/dist-VODFSGNG.js +7442 -0
  113. package/{docCreateCommands-F2ASWG6B.js → docCreateCommands-AAVGLQWE.js} +36 -35
  114. package/{docDeleteCommands-A4URDZPI.js → docDeleteCommands-PKMKSQD2.js} +37 -36
  115. package/{docReadCommands-DO6VHDZD.js → docReadCommands-2WUH7UXC.js} +36 -35
  116. package/{docStore-EDAE7RNT.js → docStore-J5UWRBB4.js} +29 -31
  117. package/{docUpdateCommands-ZTXZ3RTP.js → docUpdateCommands-B2N4E5HQ.js} +38 -37
  118. package/{fetchMessages-7QRCCRYK.js → fetchMessages-CUEFN4GQ.js} +4 -4
  119. package/{getPricing-L2ENXWHV.js → getPricing-P3E2WRIH.js} +5 -5
  120. package/{handleSendMessageAction-CIRLGHOC.js → handleSendMessageAction-RRZ53YYH.js} +29 -29
  121. package/index.js +92 -77
  122. package/{localDialogRead-SLMPV5SK.js → localDialogRead-P7CHFMIC.js} +1 -1
  123. package/{localRuntimeAuthority-E3R24J4T.js → localRuntimeAuthority-S77B5QVB.js} +6 -2
  124. package/{localRuntimeDb-DDZCJFQZ.js → localRuntimeDb-N3H3HQ7G.js} +1 -1
  125. package/{machineCommands-NIQNCYJV.js → machineCommands-CWKMJG33.js} +77 -77
  126. package/{machineInfo-M6KB6HZN.js → machineInfo-66ZFUMLE.js} +1 -1
  127. package/{machineWsRunDispatch-EMTSQGAR.js → machineWsRunDispatch-UYNVNX4A.js} +69 -69
  128. package/{models-OX2S5C6Q.js → models-L7S2EKPM.js} +2 -2
  129. package/package.json +1 -1
  130. package/{read-2VHEHCAN.js → read-6C2XD3YZ.js} +5 -5
  131. package/{readDocTool-CSWD6NPC.js → readDocTool-Y7AB365O.js} +1 -1
  132. package/{readlineWorkspace-A2JBJWLI.js → readlineWorkspace-VYELP22P.js} +2851 -1515
  133. package/{removeDialogAgentAction-2T7BPM3T.js → removeDialogAgentAction-KG5WMJRZ.js} +13 -13
  134. package/{runAgentClientLoop-BV4736ED.js → runAgentClientLoop-35GKZDOZ.js} +62 -61
  135. package/{runtimeDoctorCommands-KIKM6BIO.js → runtimeDoctorCommands-HT4O2PXL.js} +6 -6
  136. package/{setDialogExtraReferencesAction-GPT37HTW.js → setDialogExtraReferencesAction-O2NLXMSM.js} +10 -10
  137. package/{setPrimaryDialogAgentAction-3746P7IW.js → setPrimaryDialogAgentAction-FYYUY7PB.js} +13 -13
  138. package/{settingSlice-FIFOQ6OR.js → settingSlice-GPLI6E3M.js} +11 -11
  139. package/{skillDiscovery-KLLKXPUO.js → skillDiscovery-COX56OBO.js} +3 -3
  140. package/{slateUtils-VO2FU36K.js → slateUtils-RIZES3PV.js} +1 -1
  141. package/{spaceCommands-AYZQHDB3.js → spaceCommands-AAKQM2PM.js} +223 -37
  142. package/{spaceSlice-43BNF22B.js → spaceSlice-NSNGR4Y2.js} +28 -30
  143. package/{streamAgentChatTurn-OLLRSITV.js → streamAgentChatTurn-D5IDHXMV.js} +116 -129
  144. package/{switchDialogAgentAction-MQTUTQHL.js → switchDialogAgentAction-GH5P6Q3Z.js} +9 -9
  145. package/{chunk-IDAU4UFS.js → syncMapping-N6RGXGBW.js} +11 -11
  146. package/{tableCommands-QE47K72R.js → tableCommands-PQUJ55AS.js} +3 -3
  147. package/{tools-2SI3FXLL.js → tools-JQOETZP5.js} +44 -45
  148. package/{tuiSummaryLlmCaller-EAWQ3IZX.js → tuiSummaryLlmCaller-LH7F2SP7.js} +18 -18
  149. package/{updateCommands-AK2RDOFR.js → updateCommands-MNDUIKN7.js} +2 -2
  150. package/{updateDialogTitleAction-YJEQFYOA.js → updateDialogTitleAction-WOTSDSFQ.js} +31 -33
  151. package/agentRecordCommands-YMGKT2WF.js +0 -113
  152. package/chunk-D5JI6VDM.js +0 -1800
  153. package/chunk-M3JEW6N6.js +0 -193
  154. package/chunk-ZWS6DUHX.js +0 -480
  155. package/syncMapping-RK2MANUX.js +0 -43
  156. package/{chunk-KMSZPTM6.js → chunk-2WKUUY2E.js} +3 -3
  157. package/{chunk-CWMSB67P.js → chunk-AGGIDPCZ.js} +0 -0
  158. package/{chunk-SAQQLJZ5.js → chunk-JDSUTNYY.js} +3 -3
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  updateContentTitle
3
- } from "./chunk-XLLTJXAD.js";
3
+ } from "./chunk-LAUUAYLK.js";
4
4
  import {
5
5
  require_date_fns
6
6
  } from "./chunk-M76ECQRD.js";
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  patch,
15
15
  readAndWait
16
- } from "./chunk-UM4H3URE.js";
16
+ } from "./chunk-23KKIMD5.js";
17
17
  import {
18
18
  asOptionalTrimmedString
19
19
  } from "./chunk-G3SUCT4W.js";
@@ -303,7 +303,7 @@ async function saveDocState(arg, { dispatch, getState }) {
303
303
  { slateToRenderMarkdown },
304
304
  { buildSkillSummaryMarker }
305
305
  ] = await Promise.all([
306
- import("./slateUtils-VO2FU36K.js"),
306
+ import("./slateUtils-RIZES3PV.js"),
307
307
  import("./slateToRenderMarkdown-Y5IYN73U.js"),
308
308
  import("./skillSummaryMarker-42HKSXYY.js")
309
309
  ]);
@@ -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-M2VDKBYS.js");
370
+ const { createPageAction } = await import("./createPageAction-Q2ANG535.js");
371
371
  return createPageAction(args, thunkApi);
372
372
  }
373
373
  function subscribe(listener) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadProfileConfig
3
- } from "./chunk-GE6IWA5N.js";
3
+ } from "./chunk-UNZDCI3O.js";
4
4
  import {
5
5
  resolveDefaultSpawn
6
6
  } from "./chunk-IDZTNRP2.js";
@@ -35,6 +35,12 @@ function resolveRunRecordPath(runId, env, homedir = nodeHomedir) {
35
35
  function resolveRunLogPath(runId, env, homedir = nodeHomedir) {
36
36
  return join(resolveRunsDir(env, homedir), `${runId}.log`);
37
37
  }
38
+ function resolveRunReportPath(runId, env, homedir = nodeHomedir) {
39
+ return join(resolveRunsDir(env, homedir), `${runId}.report.md`);
40
+ }
41
+ function resolveRunReportJsonPath(runId, env, homedir = nodeHomedir) {
42
+ return join(resolveRunsDir(env, homedir), `${runId}.report.json`);
43
+ }
38
44
  function defaultGenerateRunId() {
39
45
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
40
46
  const random = Math.random().toString(36).slice(2, 8);
@@ -149,12 +155,17 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
149
155
  counters.llmCalls += 1;
150
156
  break;
151
157
  case "tool-start":
152
- inFlight = { kind: "tool", name: event.name, startMs: event.atMs };
158
+ inFlight = {
159
+ kind: "tool",
160
+ name: event.toolName ?? event.name ?? "tool",
161
+ startMs: event.atMs
162
+ };
153
163
  break;
154
164
  case "tool-end":
155
165
  inFlight = null;
156
166
  counters.toolCalls += 1;
157
- if (FILE_EDIT_TOOL_NAMES.has(event.name)) {
167
+ const toolEndName = event.toolName ?? event.name;
168
+ if (toolEndName && FILE_EDIT_TOOL_NAMES.has(toolEndName)) {
158
169
  counters.fileEdits += 1;
159
170
  }
160
171
  break;
@@ -285,9 +296,13 @@ function gcRunRecords(deps = {}, options = {}) {
285
296
  if (!Number.isFinite(ageMs) || ageMs < retentionMs) continue;
286
297
  const jsonPath = resolveRunRecordPath(record.runId, deps.env, deps.homedir);
287
298
  const logPath = resolveRunLogPath(record.runId, deps.env, deps.homedir);
299
+ const reportPath = resolveRunReportPath(record.runId, deps.env, deps.homedir);
300
+ const reportJsonPath = resolveRunReportJsonPath(record.runId, deps.env, deps.homedir);
288
301
  const msgPath = record.msgFile ?? join(resolveRunsDir(deps.env, deps.homedir), `${record.runId}.msg.md`);
289
302
  const logOk = tryUnlinkFile(fs, logPath);
290
303
  const msgOk = tryUnlinkFile(fs, msgPath);
304
+ tryUnlinkFile(fs, reportPath);
305
+ tryUnlinkFile(fs, reportJsonPath);
291
306
  if (!logOk || !msgOk) {
292
307
  failedIds.push(record.runId);
293
308
  continue;
@@ -397,6 +412,31 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
397
412
  messagePath = join(runsDir, `${runId}.msg.md`);
398
413
  fs.writeFileSync(messagePath, input.message);
399
414
  }
415
+ const rawDodCommands = [];
416
+ if (Array.isArray(input.rawArgs)) {
417
+ for (let index = 0; index < input.rawArgs.length; index += 1) {
418
+ if (input.rawArgs[index] === "--dod" && input.rawArgs[index + 1]) {
419
+ rawDodCommands.push(input.rawArgs[index + 1]);
420
+ index += 1;
421
+ }
422
+ }
423
+ }
424
+ const dodCommands = input.dodCommands && input.dodCommands.length > 0 ? input.dodCommands : rawDodCommands.length > 0 ? rawDodCommands : void 0;
425
+ let spawnHead;
426
+ const targetCwd = input.cwd ?? process.cwd();
427
+ try {
428
+ const execFile = deps.execFileSync ?? nodeExecFileSync;
429
+ const out = execFile("git", ["rev-parse", "HEAD"], {
430
+ cwd: targetCwd,
431
+ encoding: "utf8",
432
+ stdio: ["ignore", "pipe", "ignore"],
433
+ timeout: 3e3
434
+ }).trim();
435
+ if (out && /^[0-9a-fA-F]{7,40}$/.test(out)) {
436
+ spawnHead = out;
437
+ }
438
+ } catch {
439
+ }
400
440
  const record = {
401
441
  runId,
402
442
  agentKey: input.agentKey,
@@ -408,7 +448,9 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
408
448
  status: "running",
409
449
  logPath,
410
450
  batchId,
411
- ...typeof input.parentDialogId === "string" && input.parentDialogId.trim() ? { parentDialogId: input.parentDialogId.trim() } : {}
451
+ ...typeof input.parentDialogId === "string" && input.parentDialogId.trim() ? { parentDialogId: input.parentDialogId.trim() } : {},
452
+ ...dodCommands && dodCommands.length > 0 ? { dodCommands } : {},
453
+ ...spawnHead ? { spawnHead } : {}
412
454
  };
413
455
  fs.writeFileSync(recordPath, JSON.stringify(record, null, 2));
414
456
  const { execPath, childArgs } = buildAgentRunChildCommand({
@@ -982,6 +1024,8 @@ export {
982
1024
  resolveRunsDir,
983
1025
  resolveRunRecordPath,
984
1026
  resolveRunLogPath,
1027
+ resolveRunReportPath,
1028
+ resolveRunReportJsonPath,
985
1029
  defaultGenerateRunId,
986
1030
  defaultGenerateBatchId,
987
1031
  writeRunRecord,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  generatePkcePair,
3
3
  startCallbackServer
4
- } from "./chunk-ITIA6OAQ.js";
4
+ } from "./chunk-IZNJDUJ4.js";
5
5
  import {
6
6
  toErrorMessage
7
7
  } from "./chunk-HNMXYYJR.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  requireTokenUser
3
- } from "./chunk-IKWTTKWG.js";
3
+ } from "./chunk-XQES6LXQ.js";
4
4
  import {
5
5
  resolveServerUrl
6
6
  } from "./chunk-A7GB5UGH.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dialogMessageRange
3
- } from "./chunk-KMSZPTM6.js";
3
+ } from "./chunk-2WKUUY2E.js";
4
4
  import {
5
5
  isTombstoneRecord
6
6
  } from "./chunk-GBRG75BQ.js";
@@ -1,89 +1,12 @@
1
1
  import {
2
2
  MODEL_LOOKUP_MAP
3
- } from "./chunk-DFUPZE6V.js";
3
+ } from "./chunk-C6ELZQ7H.js";
4
4
  import {
5
5
  ALL_MODELS
6
- } from "./chunk-2QTEYCR7.js";
6
+ } from "./chunk-FTM4KUOZ.js";
7
7
  import {
8
- PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
9
- builtinAgentCatalogEntryById,
10
- builtinRuntimeFallbackEntries,
11
- isBuiltinPlatformAgentKey
12
- } from "./chunk-IR6W62Q6.js";
13
- import {
14
- parsePublicAgentId,
15
- publicAgentKey
16
- } from "./chunk-BJIRLHJR.js";
17
-
18
- // packages/agent-runtime/builtinPlatformAgentRoute.ts
19
- function resolveBuiltinAgentRuntimeFields(agentKey) {
20
- if (!isBuiltinPlatformAgentKey(agentKey)) return null;
21
- const entry = builtinAgentCatalogEntryById(parsePublicAgentId(agentKey));
22
- if (!entry) return null;
23
- return { provider: entry.provider, model: entry.model };
24
- }
25
-
26
- // packages/agent-runtime/builtinPlatformAgentConfigs.ts
27
- function buildConfig(e) {
28
- const key = publicAgentKey(e.id);
29
- const rawRecord = {
30
- dbKey: key,
31
- isPublic: true,
32
- provider: e.provider,
33
- model: e.model,
34
- apiSource: e.apiSource ?? "platform",
35
- useServerProxy: e.useServerProxy ?? true
36
- };
37
- if (e.hasImageOutput) rawRecord.hasImageOutput = true;
38
- if (e.imageModel) rawRecord.imageModel = e.imageModel;
39
- if (e.imageWorkflow) rawRecord.imageWorkflow = e.imageWorkflow;
40
- if (e.imageConfig) rawRecord.imageConfig = e.imageConfig;
41
- return {
42
- key,
43
- name: e.name,
44
- provider: e.provider,
45
- model: e.model,
46
- apiSource: e.apiSource ?? "platform",
47
- useServerProxy: e.useServerProxy ?? true,
48
- rawRecord
49
- };
50
- }
51
- var BUILTIN_PLATFORM_AGENT_CONFIGS = Object.fromEntries(
52
- builtinRuntimeFallbackEntries().map((e) => [publicAgentKey(e.id), buildConfig(e)])
53
- );
54
- function resolveBuiltinPlatformAgentConfig(agentRef) {
55
- return BUILTIN_PLATFORM_AGENT_CONFIGS[agentRef] ?? null;
56
- }
57
- function resolveBuiltinPlatformAgentRecord(agentRef) {
58
- const config = resolveBuiltinPlatformAgentConfig(agentRef);
59
- if (!config) return null;
60
- return {
61
- ...config.rawRecord,
62
- dbKey: agentRef,
63
- ...config.name ? { name: config.name } : {}
64
- };
65
- }
66
- function applyBuiltinAgentRuntimeOverride(agentKey, record) {
67
- const fields = resolveBuiltinAgentRuntimeFields(agentKey);
68
- if (!fields) return record;
69
- const current = record;
70
- const rawNeedsOverride = current.rawRecord != null && (current.rawRecord.provider !== fields.provider || current.rawRecord.model !== fields.model);
71
- if (current.provider === fields.provider && current.model === fields.model && !rawNeedsOverride) {
72
- return record;
73
- }
74
- return {
75
- ...record,
76
- provider: fields.provider,
77
- model: fields.model,
78
- ...current.rawRecord ? {
79
- rawRecord: {
80
- ...current.rawRecord,
81
- provider: fields.provider,
82
- model: fields.model
83
- }
84
- } : {}
85
- };
86
- }
8
+ PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY
9
+ } from "./chunk-XT73C4VH.js";
87
10
 
88
11
  // packages/ai/llm/getModelContextWindow.ts
89
12
  var DEFAULT_CONTEXT_WINDOW = 256e3;
@@ -230,9 +153,6 @@ var DEFAULT_AUTO_EXECUTION_PROFILE = AUTO_EXECUTION_PROFILES[DEFAULT_AUTO_EXECUT
230
153
  var resolveAutoExecutionProfile = (tier) => AUTO_EXECUTION_PROFILES[tier ?? DEFAULT_AUTO_EXECUTION_TIER] ?? DEFAULT_AUTO_EXECUTION_PROFILE;
231
154
 
232
155
  export {
233
- resolveBuiltinPlatformAgentConfig,
234
- resolveBuiltinPlatformAgentRecord,
235
- applyBuiltinAgentRuntimeOverride,
236
156
  DEFAULT_CONTEXT_WINDOW,
237
157
  getModelContextWindow,
238
158
  getModelInfo,
@@ -0,0 +1,163 @@
1
+ // packages/ai/tools/agent/quotaCircuitBreaker.ts
2
+ var QUOTA_ERROR_PATTERNS = [
3
+ /429/,
4
+ /quota/i,
5
+ /rate\s*limit/i,
6
+ /too\s*many\s*requests/i,
7
+ /额度/,
8
+ /上限/,
9
+ /用尽/,
10
+ /CliProviderQuotaError/i
11
+ ];
12
+ function isCliProviderQuotaErrorShape(error) {
13
+ if (!error || typeof error !== "object") return false;
14
+ const e = error;
15
+ return e.name === "CliProviderQuotaError" || typeof e.message === "string" && e.message.startsWith("[QUOTA_LIMITED:");
16
+ }
17
+ function isQuotaExhaustedError(error) {
18
+ if (!error) return false;
19
+ if (isCliProviderQuotaErrorShape(error)) return true;
20
+ if (error instanceof Error) {
21
+ return QUOTA_ERROR_PATTERNS.some((pattern) => pattern.test(error.message));
22
+ }
23
+ if (typeof error === "string") {
24
+ return QUOTA_ERROR_PATTERNS.some((pattern) => pattern.test(error));
25
+ }
26
+ const maybeStatus = error.status;
27
+ if (typeof maybeStatus === "number" && maybeStatus === 429) return true;
28
+ const maybeStatusCode = error.statusCode;
29
+ if (typeof maybeStatusCode === "number" && maybeStatusCode === 429) return true;
30
+ return false;
31
+ }
32
+ function parseResetsInMs(text) {
33
+ if (!text) return void 0;
34
+ const unitMs = (n, unit) => {
35
+ if (/^d/.test(unit)) return n * 24 * 3600 * 1e3;
36
+ if (/^h/.test(unit)) return n * 3600 * 1e3;
37
+ if (/^m/.test(unit)) return n * 60 * 1e3;
38
+ if (/^s/.test(unit)) return n * 1e3;
39
+ return NaN;
40
+ };
41
+ const re = /(\d+)\s*(d(?:ay|ays)?|h(?:r|rs|our|ours)?|m(?:in|ins|inute|inutes)?|s(?:ec|ecs|econd|econds)?)/gi;
42
+ let totalMs = 0;
43
+ let matched = false;
44
+ let m;
45
+ while ((m = re.exec(text)) !== null) {
46
+ const ms = unitMs(Number(m[1]), m[2]);
47
+ if (!Number.isFinite(ms)) continue;
48
+ totalMs += ms;
49
+ matched = true;
50
+ }
51
+ return matched ? totalMs : void 0;
52
+ }
53
+ var DEFAULT_QUOTA_BREAKER_MS = 6 * 3600 * 1e3;
54
+ var DEFAULT_AGENT_NOT_FOUND_BREAKER_MS = 15 * 60 * 1e3;
55
+
56
+ // packages/ai/agent/agentAvailabilityShared.ts
57
+ var DEFAULT_PROVIDER_RETRY_MS = 5 * 60 * 1e3;
58
+ var MAX_COOLDOWN_MS = 24 * 60 * 60 * 1e3;
59
+ function clampCooldownDeadline(at, now) {
60
+ const min = now;
61
+ const max = now + MAX_COOLDOWN_MS;
62
+ return Math.min(Math.max(at, min), max);
63
+ }
64
+ function isAgentUnavailableNow(agent, now = Date.now()) {
65
+ const at = agent?.nextAvailableAt;
66
+ return typeof at === "number" && Number.isFinite(at) && at > now;
67
+ }
68
+ function readRetryAfterTimestamp(body, now) {
69
+ if (!body || typeof body !== "object") return void 0;
70
+ const root = body;
71
+ const raw = root.retryAfter ?? root.retry_after ?? root["Retry-After"];
72
+ if (typeof raw === "number" && Number.isFinite(raw)) {
73
+ return raw > 1e12 ? raw : now + Math.max(0, raw) * 1e3;
74
+ }
75
+ if (typeof raw === "string") {
76
+ const seconds = Number(raw.trim());
77
+ if (Number.isFinite(seconds)) return now + Math.max(0, seconds) * 1e3;
78
+ const date = Date.parse(raw);
79
+ if (Number.isFinite(date)) return date;
80
+ }
81
+ return void 0;
82
+ }
83
+ function readResetTimestamp(body, now) {
84
+ if (!body || typeof body !== "object") return void 0;
85
+ const root = body;
86
+ const error = root.error && typeof root.error === "object" ? root.error : root;
87
+ if (Array.isArray(error.details)) {
88
+ for (const item of error.details) {
89
+ if (!item || typeof item !== "object") continue;
90
+ const retryDelay = item.retryDelay;
91
+ if (typeof retryDelay === "string") {
92
+ const ms = parseResetsInMs(retryDelay);
93
+ if (typeof ms === "number" && Number.isFinite(ms)) return now + ms;
94
+ }
95
+ }
96
+ }
97
+ const details = !Array.isArray(error.details) && error.details && typeof error.details === "object" ? error.details : void 0;
98
+ const raw = error.resets_at ?? error.resetsAt ?? details?.resets_at ?? details?.resetsAt;
99
+ if (typeof raw === "number" && Number.isFinite(raw)) {
100
+ return raw > 1e12 ? raw : raw * 1e3;
101
+ }
102
+ if (typeof raw === "string") {
103
+ const parsed = Date.parse(raw);
104
+ if (Number.isFinite(parsed)) return parsed;
105
+ }
106
+ return void 0;
107
+ }
108
+ function parseResetAtText(value, now) {
109
+ const m = value.match(
110
+ /resets?\s+at\s+(\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)?)/i
111
+ );
112
+ if (!m?.[1]) return void 0;
113
+ const parsed = Date.parse(m[1]);
114
+ return Number.isFinite(parsed) && parsed > now ? parsed : void 0;
115
+ }
116
+ function resolveNextAvailableAt(body, now, headers) {
117
+ const headerRetryAfter = headers && typeof headers.get === "function" ? headers.get("retry-after") : headers?.["retry-after"] ?? headers?.["Retry-After"];
118
+ const retryAfter = headerRetryAfter ? readRetryAfterTimestamp({ retryAfter: headerRetryAfter }, now) : readRetryAfterTimestamp(body, now);
119
+ if (retryAfter !== void 0 && retryAfter > now) {
120
+ return clampCooldownDeadline(retryAfter, now);
121
+ }
122
+ const absolute = readResetTimestamp(body, now);
123
+ if (absolute !== void 0 && absolute > now) {
124
+ return clampCooldownDeadline(absolute, now);
125
+ }
126
+ const text = typeof body === "string" ? body : JSON.stringify(body ?? "");
127
+ const parsed = parseResetAtText(text, now) ?? now + (parseResetsInMs(text) ?? DEFAULT_PROVIDER_RETRY_MS);
128
+ return clampCooldownDeadline(parsed, now);
129
+ }
130
+ function resolveAvailabilityAction(status, body, now, headers) {
131
+ if (status >= 200 && status < 300) return { kind: "clear" };
132
+ if (status === 429) {
133
+ return { kind: "mark", nextAvailableAt: resolveNextAvailableAt(body, now, headers) };
134
+ }
135
+ if (status >= 500) {
136
+ return { kind: "mark", nextAvailableAt: now + DEFAULT_PROVIDER_RETRY_MS };
137
+ }
138
+ return { kind: "noop" };
139
+ }
140
+ function mergeAvailabilityDeadline(currentDeadline, nextAvailableAt) {
141
+ return typeof currentDeadline === "number" && Number.isFinite(currentDeadline) ? Math.max(currentDeadline, nextAvailableAt) : nextAvailableAt;
142
+ }
143
+ var PROBE_INTERVAL_MS = 10 * 60 * 1e3;
144
+ function resolveCooldownGate(input, now) {
145
+ const nextAvailableAt = input.nextAvailableAt;
146
+ if (typeof nextAvailableAt !== "number" || !Number.isFinite(nextAvailableAt) || nextAvailableAt <= now) {
147
+ return "open";
148
+ }
149
+ const lastProbeAt = input.lastProbeAt;
150
+ if (typeof lastProbeAt !== "number" || !Number.isFinite(lastProbeAt)) {
151
+ return "probe";
152
+ }
153
+ return now - lastProbeAt >= PROBE_INTERVAL_MS ? "probe" : "blocked";
154
+ }
155
+
156
+ export {
157
+ QUOTA_ERROR_PATTERNS,
158
+ isQuotaExhaustedError,
159
+ isAgentUnavailableNow,
160
+ resolveAvailabilityAction,
161
+ mergeAvailabilityDeadline,
162
+ resolveCooldownGate
163
+ };