nolo-cli 0.82.0-alpha.6 → 0.82.0

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 (161) hide show
  1. package/README.md +2 -2
  2. package/{_executeModel-225YRU52.js → _executeModel-FHVQOYWX.js} +48 -48
  3. package/{action-D22U6CTH.js → action-YVYQEAAV.js} +11 -11
  4. package/{addContentAction-XAPUTGL4.js → addContentAction-O7R66HEX.js} +9 -9
  5. package/{addDialogAgentAction-M7VLLBZM.js → addDialogAgentAction-74OA7KYP.js} +8 -8
  6. package/{agentDeleteCommand-ZJNQGVR2.js → agentDeleteCommand-4427YKQF.js} +31 -29
  7. package/{agentEmailCommands-VLVWFWX2.js → agentEmailCommands-LYDIAUOP.js} +67 -63
  8. package/{agentGrantCommands-R3VQEZJR.js → agentGrantCommands-M3XFO6EN.js} +2 -2
  9. package/{agentListCommands-GHQGLAUU.js → agentListCommands-O4AEMQVV.js} +40 -32
  10. package/{agentMachineCommands-QDXYENZJ.js → agentMachineCommands-F6IHXMPD.js} +31 -29
  11. package/{agentProviderCommands-65ZC2WB4.js → agentProviderCommands-GNPTL5XR.js} +87 -0
  12. package/{agentPullCommand-N7L2CT7L.js → agentPullCommand-O5MPVJ5E.js} +3 -3
  13. package/agentRecordCommands-BDLFOU7E.js +128 -0
  14. package/{agentRunCommand-YSCD65HH.js → agentRunCommand-HSSYFGMC.js} +65 -61
  15. package/{agentRunControl-T44MESII.js → agentRunControl-WCTKX5VL.js} +2 -2
  16. package/{agentRuntimeLocal-ZOHB7OOO.js → agentRuntimeLocal-IW3IM5P6.js} +27 -25
  17. package/{agentSlice-O2SBU5TK.js → agentSlice-G54NT6PX.js} +10 -10
  18. package/{appDeleteCommands-PRT6K5N2.js → appDeleteCommands-ZXLXNRHF.js} +31 -29
  19. package/{appDeployCommands-63ZONFAN.js → appDeployCommands-PWB4YERK.js} +31 -29
  20. package/{appDeployStatusCommands-AFAYCVR3.js → appDeployStatusCommands-2EZKZP7Y.js} +31 -29
  21. package/{appGetCommands-TNZDZE36.js → appGetCommands-JNUKOWHO.js} +31 -29
  22. package/{appListCommands-IA4SPG2X.js → appListCommands-6X3H67SS.js} +31 -29
  23. package/{authCommand-EVGFLAHO.js → authCommand-F4EFRRX6.js} +164 -24
  24. package/{authCommands-ILTBI6JV.js → authCommands-RGOGCPP6.js} +4 -5
  25. package/builtinSkillRegistry-FUAVTRVZ.js +33 -0
  26. package/{chatQueueReduxAdapter-4SM3DAWX.js → chatQueueReduxAdapter-VJXYSZ2D.js} +24 -24
  27. package/{chromeCommands-VOIRNJBL.js → chromeCommands-FZYAU75D.js} +1 -1
  28. package/{chromeOpsCommands-M7DPCX2T.js → chromeOpsCommands-62P2Q2YB.js} +31 -1
  29. package/{chunk-C3FZR5EC.js → chunk-2F7RJC6L.js} +1 -1
  30. package/{chunk-QC5LGHYP.js → chunk-2YMRWISD.js} +10 -5
  31. package/{chunk-HQUORJTM.js → chunk-3BMYXEUW.js} +1 -1
  32. package/{chunk-3QPYFHAH.js → chunk-3DII57IT.js} +1 -1
  33. package/{chunk-NTW5GWDM.js → chunk-3VNWWVKB.js} +2 -0
  34. package/{chunk-DWUCB2A3.js → chunk-42V6BK2E.js} +1 -1
  35. package/{chunk-KIS76A2P.js → chunk-4EZHSKTB.js} +38 -4
  36. package/{chunk-GBPZKFYK.js → chunk-53HEEOTT.js} +4 -4
  37. package/{chunk-5XTOKQLW.js → chunk-5UTFL4QJ.js} +6 -2
  38. package/chunk-5ZUL4CUO.js +10 -0
  39. package/{chunk-E6RGHPDR.js → chunk-6D6VBVEW.js} +4 -6
  40. package/{chunk-CMH2SYHX.js → chunk-6OZ36FXI.js} +2 -2
  41. package/{chunk-NRALD3CC.js → chunk-76WEAXJB.js} +49 -10
  42. package/{chunk-3W2JJOH3.js → chunk-7REEVK4I.js} +3 -3
  43. package/{chunk-BYEJ7K2Z.js → chunk-7S4YWN7P.js} +1 -1
  44. package/{chunk-SREASRV5.js → chunk-ABQYVJBJ.js} +1 -1
  45. package/chunk-ACTMNVHM.js +93 -0
  46. package/{chunk-XWNRAIUL.js → chunk-AFUORTY4.js} +6 -16
  47. package/{chunk-E36HZARC.js → chunk-ASQYTZTR.js} +46 -9
  48. package/{chunk-73IOJLK2.js → chunk-AVV3M6CX.js} +10 -10
  49. package/{chunk-WL2RKIBF.js → chunk-BLJWCTRL.js} +1 -1
  50. package/chunk-BNGW5ASC.js +344 -0
  51. package/{chunk-SZLVDREM.js → chunk-BP4XNZRM.js} +3 -3
  52. package/{chunk-2KDR4CWE.js → chunk-BYMV6QZG.js} +24 -1
  53. package/{chunk-MYU3MJCF.js → chunk-DHDMC6FO.js} +175 -7
  54. package/{chunk-FP27MNSX.js → chunk-DL2LVM5E.js} +3 -3
  55. package/{chunk-EXMHJN7C.js → chunk-EYAQT56M.js} +4 -3
  56. package/{chunk-5LSS6MFZ.js → chunk-F5OE5KSJ.js} +13 -15
  57. package/{chunk-CJCJF5XB.js → chunk-FDTR4QJ6.js} +4 -2
  58. package/{chunk-NJ6WLAPS.js → chunk-FEEHCOBD.js} +1 -1
  59. package/{chunk-YSKEOTPH.js → chunk-GGMVRZRO.js} +155 -795
  60. package/{chunk-PYXL2CJL.js → chunk-GPCZ7UXG.js} +1 -1
  61. package/{chunk-K7AG465Q.js → chunk-GQBOR3G6.js} +4 -2
  62. package/{chunk-YFADVSZE.js → chunk-H62HCIUP.js} +6 -6
  63. package/{chunk-PZM3EENV.js → chunk-HJUYAD4A.js} +1 -1
  64. package/{chunk-A3NNC2LA.js → chunk-HOBJGHLD.js} +1235 -59
  65. package/{chunk-3JQ2NRYU.js → chunk-HVURBGF3.js} +4 -4
  66. package/{chunk-6SD5OPQ4.js → chunk-IIBAPOTQ.js} +11 -173
  67. package/{chunk-ZVN6I33J.js → chunk-IIVGDG4I.js} +6 -5
  68. package/{chunk-UDQWGU7F.js → chunk-J4MOO56S.js} +1 -1
  69. package/{chunk-KC5FAHVS.js → chunk-JEDZAO7L.js} +1 -1
  70. package/{chunk-6XIE5ZGI.js → chunk-JPGCXHNM.js} +1 -1
  71. package/chunk-JRQFUXY7.js +1625 -0
  72. package/chunk-KQ4ONNQD.js +677 -0
  73. package/{chunk-CPSZJBLK.js → chunk-L7I247DF.js} +105 -26
  74. package/{chunk-RXX4GDIH.js → chunk-LS2ZANRJ.js} +1 -1
  75. package/{chunk-BJIRLHJR.js → chunk-M2EJHDJP.js} +4 -0
  76. package/{chunk-EVBFYPDC.js → chunk-MC4XLIJ7.js} +6 -2
  77. package/{chunk-DSRXPQWA.js → chunk-NEDZDG3M.js} +43 -43
  78. package/{chunk-UJ63UXGE.js → chunk-OIVSQH2O.js} +1006 -801
  79. package/{chunk-AETZ7AD6.js → chunk-Q554LLSI.js} +1 -1
  80. package/chunk-Q5FJJ6XI.js +103 -0
  81. package/{chunk-AJHEFRGJ.js → chunk-Q67DOFOO.js} +214 -5
  82. package/{chunk-UZ6XXCVR.js → chunk-QDSINZM3.js} +15 -2
  83. package/{chunk-D6XYLSOS.js → chunk-QIAVMDHY.js} +1 -1
  84. package/{chunk-YWG6EMH3.js → chunk-RG6JBBX5.js} +10 -6
  85. package/{chunk-YXLXHIT2.js → chunk-RTUYRRBM.js} +6 -6
  86. package/{chunk-HHLTFENG.js → chunk-SDTTBMBU.js} +907 -317
  87. package/{chunk-QCZX4FTW.js → chunk-SH43IESU.js} +173 -15
  88. package/{chunk-LSZXYE64.js → chunk-SL4QHSPQ.js} +756 -80
  89. package/{chunk-FNGAF7C4.js → chunk-SNPMM7H3.js} +137 -12
  90. package/{chunk-EM6MPSEI.js → chunk-SPUTJ4DW.js} +52 -30
  91. package/{chunk-SO7B7NW3.js → chunk-STHU4Y5X.js} +413 -62
  92. package/{chunk-SPAQ4PVV.js → chunk-SV5IJK6K.js} +1 -1
  93. package/{chunk-KVDUCO4Q.js → chunk-TDRTS7QW.js} +16 -12
  94. package/{chunk-BJCWNHVU.js → chunk-TOP2VXOR.js} +2 -2
  95. package/{chunk-4EJ5QYB5.js → chunk-UKZDAFYT.js} +1 -1
  96. package/{chunk-PGSKWZCB.js → chunk-UZGQNTVW.js} +1 -1
  97. package/{chunk-ZZCJUXUI.js → chunk-V4MJDUSR.js} +2 -2
  98. package/{chunk-JYYZCK2Z.js → chunk-V7E4PXQD.js} +1 -1
  99. package/{chunk-OZX2IPKM.js → chunk-VLTIYV3X.js} +1 -1
  100. package/{chunk-NHRQCXIQ.js → chunk-VMFTFOWF.js} +13 -3
  101. package/{chunk-4UW2LDVA.js → chunk-VQW3EKYS.js} +15 -15
  102. package/{chunk-HH65VA5U.js → chunk-WGR3J4Q6.js} +101 -4
  103. package/{chunk-5J7W2VWW.js → chunk-WV42OMV7.js} +6 -265
  104. package/{chunk-Q46HQOW3.js → chunk-XTAZCQUT.js} +7 -7
  105. package/{chunk-DUJWWUGV.js → chunk-YQTQQX2H.js} +1 -1
  106. package/{chunk-BOYUESO7.js → chunk-Z77CRGTW.js} +1 -1
  107. package/{contentThunks-ENAVF2YU.js → contentThunks-D6QQKIPF.js} +25 -25
  108. package/{cooldownCommands-BSCH2W7P.js → cooldownCommands-REAWYVTY.js} +2 -2
  109. package/{createAgentAutomationAction-CH6BYC7K.js → createAgentAutomationAction-UIPWW4DG.js} +25 -25
  110. package/{createDialogAction-23UDOXSO.js → createDialogAction-573VVP3X.js} +28 -28
  111. package/{createPageAction-J6AEMLHK.js → createPageAction-LRFSS6TD.js} +26 -26
  112. package/{dbSlice-GKGGFNOB.js → dbSlice-XVWBAGYN.js} +8 -8
  113. package/{deleteFile-LWSR674W.js → deleteFile-YG6QMJLU.js} +3 -3
  114. package/{dialogCommands-BJJGCCQR.js → dialogCommands-KFK2FF5B.js} +35 -31
  115. package/{dialogSlice-F7RD6PUY.js → dialogSlice-EXLC5XTD.js} +24 -24
  116. package/{docCreateCommands-53GB2FU3.js → docCreateCommands-V777WOZ7.js} +32 -30
  117. package/{docDeleteCommands-TAW5JEBU.js → docDeleteCommands-5KHT7Z5Q.js} +33 -31
  118. package/{docReadCommands-F5N7N5E3.js → docReadCommands-BLROGWP3.js} +32 -30
  119. package/{docStore-WX4YBGXC.js → docStore-DZNGJXX7.js} +9 -9
  120. package/{docUpdateCommands-YQ7TRT35.js → docUpdateCommands-QXOZHQ5H.js} +32 -30
  121. package/{fetchMessages-DRABNDPZ.js → fetchMessages-EIU7UFFK.js} +3 -4
  122. package/{getPricing-HRMSOF3E.js → getPricing-LUSEABA6.js} +4 -4
  123. package/{handleSendMessageAction-CW4LULIR.js → handleSendMessageAction-OROTZBPO.js} +24 -24
  124. package/index.js +102 -85
  125. package/{localDialogRead-PUQKFI73.js → localDialogRead-BTFJ4V2I.js} +2 -2
  126. package/{localRuntimeDb-P37ZTX55.js → localRuntimeDb-SYQGUF4U.js} +1 -1
  127. package/{machineCommands-FIYWY5EU.js → machineCommands-IJWERHRH.js} +64 -60
  128. package/{machineWsRunDispatch-KQ4OFFNR.js → machineWsRunDispatch-XQ36M4L7.js} +62 -58
  129. package/{memberThunks-KATHH3F4.js → memberThunks-QGFLFVCI.js} +9 -9
  130. package/{models-GS72DVJS.js → models-T3SG6MJ5.js} +2 -2
  131. package/{offlineMarxistsAgentCommand-GEH6SNNA.js → offlineMarxistsAgentCommand-HGXZV4XJ.js} +1 -1
  132. package/package.json +1 -1
  133. package/providerPresetApply-FG6NZ57W.js +214 -0
  134. package/providerRegistry-757OWH3O.js +31 -0
  135. package/{read-LC6HVYBN.js → read-COE3ZYR6.js} +5 -4
  136. package/{readDocTool-N3ERJHHF.js → readDocTool-5USN4A6V.js} +1 -1
  137. package/{readlineWorkspace-QYI6BRNA.js → readlineWorkspace-EB3362L3.js} +144 -108
  138. package/{removeDialogAgentAction-F5GPTALR.js → removeDialogAgentAction-IX3MN2ZO.js} +11 -11
  139. package/{runAgentClientLoop-GZ5VUGAW.js → runAgentClientLoop-3MR2NPWR.js} +47 -47
  140. package/{runtimeDoctorCommands-CROTMULY.js → runtimeDoctorCommands-X6WDBEQX.js} +2 -2
  141. package/{setDialogExtraReferencesAction-AY4ZCF3A.js → setDialogExtraReferencesAction-X4HCPNZL.js} +9 -9
  142. package/{setPrimaryDialogAgentAction-HPMG7V3R.js → setPrimaryDialogAgentAction-4GMIQLOD.js} +11 -11
  143. package/{settingSlice-OEJA4NQO.js → settingSlice-ZQZVUPKK.js} +10 -10
  144. package/{spaceCommands-IYMIXCMC.js → spaceCommands-TIDVUPDV.js} +30 -28
  145. package/{streamAgentChatTurn-EAXIUJTK.js → streamAgentChatTurn-CLP2JWCQ.js} +59 -58
  146. package/{switchDialogAgentAction-HMDZTZ4I.js → switchDialogAgentAction-N52LRPA3.js} +8 -8
  147. package/{tableCommands-SUNTHAYX.js → tableCommands-O6NWHFKV.js} +1 -1
  148. package/{toolApiClient-VGYUB4P5.js → toolApiClient-QVJ6HDNN.js} +2 -2
  149. package/{tools-QWQOW6J4.js → tools-OXEEBABR.js} +43 -43
  150. package/tuiSummaryLlmCaller-VJY3YD2Q.js +127 -0
  151. package/{updateCommands-Y363MC3L.js → updateCommands-2M74UL7P.js} +2 -2
  152. package/{updateDialogTitleAction-2HCE2M7S.js → updateDialogTitleAction-4YWKF2OE.js} +45 -28
  153. package/agentRecordCommands-AQFYM5HS.js +0 -124
  154. package/chunk-3IT2PFHL.js +0 -611
  155. package/chunk-I42VC5KR.js +0 -15
  156. package/chunk-NG4UT4K4.js +0 -79
  157. package/codingSkills-E6KSDNSJ.js +0 -48
  158. package/tuiSummaryLlmCaller-3Z24VUWM.js +0 -116
  159. package/{chunk-3RAG2NAD.js → chunk-UKWGR5SS.js} +3 -3
  160. package/{db-VQSAOWAO.js → db-WK5MDZVN.js} +1 -1
  161. package/{localRuntimeAuthority-R5UBODT3.js → localRuntimeAuthority-6IR6BBXE.js} +3 -3
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  ownedAgentKey,
6
6
  publicAgentKey
7
- } from "./chunk-BJIRLHJR.js";
7
+ } from "./chunk-M2EJHDJP.js";
8
8
 
9
9
  // packages/cli/agentAliases.ts
10
10
  var CURRENT_OPERATOR_USER_ID = "0e95801d90";
@@ -1,21 +1,22 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-WL2RKIBF.js";
4
+ } from "./chunk-BLJWCTRL.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-NRALD3CC.js";
7
+ } from "./chunk-76WEAXJB.js";
8
8
  import {
9
9
  deriveCredentialGroup,
10
10
  toSafeAgentSummary
11
- } from "./chunk-YWG6EMH3.js";
11
+ } from "./chunk-RG6JBBX5.js";
12
12
  import {
13
13
  PUBLIC_AGENT_KEY_PREFIX,
14
14
  isOwnedAgentKey,
15
15
  ownedAgentKey,
16
+ ownedAgentKeyPrefix,
16
17
  parseOwnedAgentId,
17
18
  publicAgentKey
18
- } from "./chunk-BJIRLHJR.js";
19
+ } from "./chunk-M2EJHDJP.js";
19
20
 
20
21
  // packages/cli/agentListHelpers.ts
21
22
  function parseAgentRecordId(privateKey, explicitId) {
@@ -105,14 +106,17 @@ function parseAgentListArgs(args) {
105
106
  async function listLocalCachedAgents(args) {
106
107
  const privateRecords = /* @__PURE__ */ new Map();
107
108
  const publicKeys = /* @__PURE__ */ new Set();
108
- for await (const [key, value] of args.db.iterator({ gte: "", lte: "\uFFFF" })) {
109
- if (typeof key !== "string" || !value || typeof value !== "object") continue;
110
- if (isOwnedAgentKey(key, args.userId)) {
111
- privateRecords.set(key, { ...value, dbKey: key });
112
- continue;
113
- }
114
- if (key.startsWith(PUBLIC_AGENT_KEY_PREFIX)) {
115
- publicKeys.add(key);
109
+ const ownedPrefix = ownedAgentKeyPrefix(args.userId);
110
+ for (const prefix of [ownedPrefix, PUBLIC_AGENT_KEY_PREFIX]) {
111
+ for await (const [key, value] of args.db.iterator({ gte: prefix, lte: `${prefix}\uFFFF` })) {
112
+ if (typeof key !== "string" || !value || typeof value !== "object") continue;
113
+ if (isOwnedAgentKey(key, args.userId)) {
114
+ privateRecords.set(key, { ...value, dbKey: key });
115
+ continue;
116
+ }
117
+ if (key.startsWith(PUBLIC_AGENT_KEY_PREFIX)) {
118
+ publicKeys.add(key);
119
+ }
116
120
  }
117
121
  }
118
122
  const agents = sortListedAgents(
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  selectCurrentServer
3
- } from "./chunk-XWNRAIUL.js";
3
+ } from "./chunk-AFUORTY4.js";
4
4
  import {
5
5
  patch
6
- } from "./chunk-YFADVSZE.js";
6
+ } from "./chunk-H62HCIUP.js";
7
7
  import {
8
8
  getIsDesktopApp
9
9
  } from "./chunk-QOKAKDPE.js";
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  patch,
9
9
  selectById
10
- } from "./chunk-YFADVSZE.js";
10
+ } from "./chunk-H62HCIUP.js";
11
11
  import {
12
12
  __toESM
13
13
  } from "./chunk-4VNS5WPM.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  trimTrailingSlash
3
- } from "./chunk-CMH2SYHX.js";
3
+ } from "./chunk-6OZ36FXI.js";
4
4
  import {
5
5
  toErrorMessage
6
6
  } from "./chunk-HNMXYYJR.js";
@@ -4,11 +4,11 @@ import {
4
4
  import {
5
5
  patch,
6
6
  read
7
- } from "./chunk-YFADVSZE.js";
7
+ } from "./chunk-H62HCIUP.js";
8
8
  import {
9
9
  DEVICE_LOCAL_OWNER_ID,
10
10
  isDeviceLocalSpaceBody
11
- } from "./chunk-3RAG2NAD.js";
11
+ } from "./chunk-UKWGR5SS.js";
12
12
  import {
13
13
  selectIdentityUserId
14
14
  } from "./chunk-SEJ5OS6F.js";
@@ -2,7 +2,7 @@ import {
2
2
  LOCAL_CODEX_AGENT_KEY,
3
3
  isLocalCliAgentKey,
4
4
  resolveCliAgentKeyInput
5
- } from "./chunk-SPAQ4PVV.js";
5
+ } from "./chunk-SV5IJK6K.js";
6
6
  import {
7
7
  DEFAULT_NOLO_SERVER_URL
8
8
  } from "./chunk-OLZBQWZU.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-QSJ3HFEF.js";
10
10
  import {
11
11
  extractCustomId
12
- } from "./chunk-BJIRLHJR.js";
12
+ } from "./chunk-M2EJHDJP.js";
13
13
  import {
14
14
  selectIdentityToken
15
15
  } from "./chunk-SEJ5OS6F.js";
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  asOptionalFiniteNumber
3
3
  } from "./chunk-WWC7I6TA.js";
4
- import {
5
- asNonEmptyStringArray
6
- } from "./chunk-I42VC5KR.js";
7
4
  import {
8
5
  asTrimmedString
9
6
  } from "./chunk-3EUW3WEO.js";
@@ -2393,6 +2390,17 @@ var require_rambda = __commonJS({
2393
2390
  }
2394
2391
  });
2395
2392
 
2393
+ // packages/core/stringArray.ts
2394
+ function asNonEmptyStringArray(value) {
2395
+ if (!Array.isArray(value)) return [];
2396
+ return value.filter(
2397
+ (item) => typeof item === "string" && !!item.trim()
2398
+ );
2399
+ }
2400
+ function asTrimmedNonEmptyStringArray(value) {
2401
+ return asNonEmptyStringArray(value).map((item) => item.trim());
2402
+ }
2403
+
2396
2404
  // packages/core/toTrimmedString.ts
2397
2405
  function toTrimmedString(value) {
2398
2406
  return typeof value === "string" ? value.trim() : value == null ? "" : String(value).trim();
@@ -3169,6 +3177,8 @@ var sanitizeShareData = (data) => {
3169
3177
  };
3170
3178
 
3171
3179
  export {
3180
+ asNonEmptyStringArray,
3181
+ asTrimmedNonEmptyStringArray,
3172
3182
  ulid,
3173
3183
  toTrimmedString,
3174
3184
  toNonEmptyString,
@@ -5,14 +5,14 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-3W2JJOH3.js";
8
+ } from "./chunk-7REEVK4I.js";
9
9
  import {
10
10
  INVALID_TOOL_ARGS_REPLACEMENT,
11
11
  buildInvalidToolCallSelfHealResult,
12
12
  parseToolCallArguments,
13
13
  performFetchRequest,
14
14
  sanitizeOutboundMessages
15
- } from "./chunk-EM6MPSEI.js";
15
+ } from "./chunk-SPUTJ4DW.js";
16
16
  import {
17
17
  createSSEParser,
18
18
  createToolRunId,
@@ -23,7 +23,7 @@ import {
23
23
  toolRunSetPending,
24
24
  toolRunStarted,
25
25
  toolRunSucceeded
26
- } from "./chunk-YSKEOTPH.js";
26
+ } from "./chunk-GGMVRZRO.js";
27
27
  import {
28
28
  getPublicImageAgentMode
29
29
  } from "./chunk-VIDPVFP3.js";
@@ -35,10 +35,10 @@ import {
35
35
  messageStreamEnd,
36
36
  messageStreaming,
37
37
  updateToolMessage
38
- } from "./chunk-SO7B7NW3.js";
38
+ } from "./chunk-STHU4Y5X.js";
39
39
  import {
40
40
  streamAgentChatTurn
41
- } from "./chunk-Q46HQOW3.js";
41
+ } from "./chunk-XTAZCQUT.js";
42
42
  import {
43
43
  addActiveController,
44
44
  removeActiveController,
@@ -56,42 +56,42 @@ import {
56
56
  import {
57
57
  EMPTY_ASSISTANT_REPAIR_PROMPT,
58
58
  getModelInfo
59
- } from "./chunk-DSRXPQWA.js";
59
+ } from "./chunk-NEDZDG3M.js";
60
60
  import {
61
61
  getApiEndpoint
62
- } from "./chunk-UJ63UXGE.js";
62
+ } from "./chunk-OIVSQH2O.js";
63
63
  import {
64
64
  toErrorMessage
65
65
  } from "./chunk-HNMXYYJR.js";
66
66
  import {
67
67
  selectCurrentServer
68
- } from "./chunk-XWNRAIUL.js";
68
+ } from "./chunk-AFUORTY4.js";
69
69
  import {
70
70
  write
71
- } from "./chunk-YFADVSZE.js";
71
+ } from "./chunk-H62HCIUP.js";
72
72
  import {
73
73
  createDialogMessageKeyAndId,
74
74
  dialogMessageKey,
75
75
  toTrimmedString
76
- } from "./chunk-NHRQCXIQ.js";
76
+ } from "./chunk-VMFTFOWF.js";
77
77
  import {
78
78
  extractCustomId
79
- } from "./chunk-BJIRLHJR.js";
79
+ } from "./chunk-M2EJHDJP.js";
80
80
  import {
81
81
  createAsyncThunk
82
- } from "./chunk-3RAG2NAD.js";
82
+ } from "./chunk-UKWGR5SS.js";
83
83
  import {
84
84
  isAbortError
85
85
  } from "./chunk-QOKAKDPE.js";
86
86
  import {
87
87
  selectIdentityToken
88
88
  } from "./chunk-SEJ5OS6F.js";
89
- import {
90
- asTrimmedString
91
- } from "./chunk-3EUW3WEO.js";
92
89
  import {
93
90
  isRecord
94
91
  } from "./chunk-KUG52IAP.js";
92
+ import {
93
+ asTrimmedString
94
+ } from "./chunk-3EUW3WEO.js";
95
95
  import {
96
96
  asOptionalTrimmedString
97
97
  } from "./chunk-G3SUCT4W.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isAgentRunTerminalStatus
3
- } from "./chunk-NTW5GWDM.js";
3
+ } from "./chunk-3VNWWVKB.js";
4
4
  import {
5
5
  isCompiledBinary,
6
6
  resolveCliEntrypointPath
@@ -11,6 +11,60 @@ import { homedir as nodeHomedir } from "node:os";
11
11
  import { dirname, isAbsolute, join, resolve } from "node:path";
12
12
  import * as nodeFs from "node:fs";
13
13
  import { execFileSync as nodeExecFileSync, spawn as nodeSpawn } from "node:child_process";
14
+
15
+ // packages/ai/tools/agent/runFailureClass.ts
16
+ var RATE_LIMIT_PATTERN = /429|rate.?limit|quota|insufficient.?balance|UPSTREAM_402|cooling|冷却/i;
17
+ var PROVIDER_ERROR_PATTERN = /provider|upstream|5\d\d|bad.?gateway|service.?unavailable|overloaded/i;
18
+ var MALFORMED_PATTERN = /MALFORMED_FUNCTION_CALL|malformed|invalid.?function.?call|invalid.?tool.?call/i;
19
+ var STALLED_PATTERN = /stall|no.?progress|repetition|stagnant|无进展|卡死/i;
20
+ var TOOL_ERROR_PATTERN = /tool.?error|tool.?fail|工具/i;
21
+ function classifyRunFailure(input) {
22
+ const status = typeof input.status === "string" ? input.status : "";
23
+ if (status === "done" || status === "killed" || status === "cancelled") {
24
+ return void 0;
25
+ }
26
+ const reason = typeof input.failureReason === "string" ? input.failureReason : "";
27
+ const message = typeof input.errorMessage === "string" ? input.errorMessage : "";
28
+ switch (reason) {
29
+ case "provider_rate_limited":
30
+ return { failureClass: "rate_limited", retryable: true };
31
+ case "provider_error":
32
+ return MALFORMED_PATTERN.test(message) ? { failureClass: "provider_error", retryable: false } : { failureClass: "provider_error", retryable: true };
33
+ case "stalled":
34
+ return { failureClass: "stalled", retryable: false };
35
+ case "tool_error":
36
+ return { failureClass: "tool_error", retryable: false };
37
+ case "config_unresolved":
38
+ return { failureClass: "unknown", retryable: false };
39
+ case "cancelled":
40
+ return void 0;
41
+ default:
42
+ break;
43
+ }
44
+ if (message) {
45
+ if (RATE_LIMIT_PATTERN.test(message)) {
46
+ return { failureClass: "rate_limited", retryable: true };
47
+ }
48
+ if (MALFORMED_PATTERN.test(message)) {
49
+ return { failureClass: "provider_error", retryable: false };
50
+ }
51
+ if (STALLED_PATTERN.test(message)) {
52
+ return { failureClass: "stalled", retryable: false };
53
+ }
54
+ if (TOOL_ERROR_PATTERN.test(message)) {
55
+ return { failureClass: "tool_error", retryable: false };
56
+ }
57
+ if (PROVIDER_ERROR_PATTERN.test(message)) {
58
+ return { failureClass: "provider_error", retryable: true };
59
+ }
60
+ }
61
+ if (status === "failed" || status === "timeout" || status === "orphaned") {
62
+ return { failureClass: "unknown", retryable: false };
63
+ }
64
+ return void 0;
65
+ }
66
+
67
+ // packages/cli/agentRunControl.ts
14
68
  var RUN_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
15
69
  "done",
16
70
  "failed",
@@ -405,6 +459,8 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
405
459
  const fs = deps.fs ?? nodeFs;
406
460
  const now = deps.now ?? (() => /* @__PURE__ */ new Date());
407
461
  const minWriteIntervalMs = options.minWriteIntervalMs ?? DEFAULT_ACTIVITY_WRITE_INTERVAL_MS;
462
+ const keepAlive = options.keepAlive ?? true;
463
+ let disposed = false;
408
464
  let lastEventAt = now().toISOString();
409
465
  let inFlight = null;
410
466
  const counters = { llmCalls: 0, toolCalls: 0, fileEdits: 0 };
@@ -425,7 +481,9 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
425
481
  };
426
482
  }
427
483
  function doWrite() {
484
+ if (disposed) return;
428
485
  writeTimer = void 0;
486
+ const attemptAt = now().getTime();
429
487
  withRunRecordLock(
430
488
  runId,
431
489
  deps,
@@ -438,7 +496,10 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
438
496
  },
439
497
  { strict: true }
440
498
  );
499
+ if (lastWriteAt < attemptAt) lastWriteAt = attemptAt;
500
+ if (keepAlive) scheduleWrite();
441
501
  }
502
+ scheduleWrite();
442
503
  function scheduleWrite() {
443
504
  if (writeTimer !== void 0) return;
444
505
  const elapsed = now().getTime() - lastWriteAt;
@@ -446,6 +507,7 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
446
507
  writeTimer = setTimeout(doWrite, delay);
447
508
  }
448
509
  function onLoopEvent(event) {
510
+ if (disposed) return;
449
511
  lastEventAt = new Date(event.atMs).toISOString();
450
512
  switch (event.kind) {
451
513
  case "llm-start":
@@ -480,6 +542,7 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
480
542
  doWrite();
481
543
  }
482
544
  function dispose() {
545
+ disposed = true;
483
546
  if (writeTimer !== void 0) {
484
547
  clearTimeout(writeTimer);
485
548
  writeTimer = void 0;
@@ -785,6 +848,7 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
785
848
  logPath,
786
849
  queuePath,
787
850
  batchId,
851
+ ...typeof input.credentialGroup === "string" && input.credentialGroup.trim() ? { credentialGroup: input.credentialGroup.trim() } : {},
788
852
  ...typeof input.parentDialogId === "string" && input.parentDialogId.trim() ? { parentDialogId: input.parentDialogId.trim() } : {},
789
853
  ...dodCommands && dodCommands.length > 0 ? { dodCommands } : {},
790
854
  ...spawnHead ? { spawnHead } : {},
@@ -817,10 +881,13 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
817
881
  });
818
882
  proc.unref();
819
883
  if (typeof proc.pid === "number") {
820
- record.pid = proc.pid;
821
884
  const processStartedAt = (deps.getProcessStartTime ?? defaultGetProcessStartTime)(proc.pid);
822
- if (processStartedAt) record.processStartedAt = processStartedAt.toISOString();
823
- writeRunRecord(record, deps);
885
+ withRunRecordLock(runId, deps, () => {
886
+ const latest = readRunRecord(runId, deps) ?? record;
887
+ latest.pid = proc.pid;
888
+ if (processStartedAt) latest.processStartedAt = processStartedAt.toISOString();
889
+ writeRunRecord(latest, deps);
890
+ });
824
891
  }
825
892
  return { runId, pid: proc.pid, logPath, queuePath, batchId };
826
893
  }
@@ -913,6 +980,15 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
913
980
  } else if (update.status === "killed") {
914
981
  record2.failureReason = "cancelled";
915
982
  }
983
+ const classification = classifyRunFailure({
984
+ status: update.status,
985
+ failureReason: record2.failureReason,
986
+ errorMessage: update.note ?? record2.note
987
+ });
988
+ if (classification) {
989
+ record2.failureClass = classification.failureClass;
990
+ record2.retryable = classification.retryable;
991
+ }
916
992
  const resolvedToolCount = typeof update.toolCallCount === "number" ? update.toolCallCount : record2.activity?.counters?.toolCalls;
917
993
  if (typeof resolvedToolCount === "number") {
918
994
  record2.toolCallCount = resolvedToolCount;
@@ -1032,6 +1108,15 @@ function checkStaleRun(runId, deps = {}) {
1032
1108
  const at = now().toISOString();
1033
1109
  latest.status = "orphaned";
1034
1110
  latest.note = pidReused ? "orphaned: process gone (pid reused by another process)" : "orphaned: process gone without writing terminal status";
1111
+ const orphanClassification = classifyRunFailure({
1112
+ status: "orphaned",
1113
+ failureReason: latest.failureReason,
1114
+ errorMessage: latest.note
1115
+ });
1116
+ if (orphanClassification) {
1117
+ latest.failureClass = orphanClassification.failureClass;
1118
+ latest.retryable = orphanClassification.retryable;
1119
+ }
1035
1120
  latest.endedAt = at;
1036
1121
  latest.reconciledAt = at;
1037
1122
  latest.pid = void 0;
@@ -1247,6 +1332,18 @@ function printStatusOnce(record, deps) {
1247
1332
  }
1248
1333
  if (record.note) deps.output.write(`note: ${record.note}
1249
1334
  `);
1335
+ if (record.failureReason) deps.output.write(`failure: ${record.failureReason}
1336
+ `);
1337
+ if (record.failureClass) {
1338
+ deps.output.write(
1339
+ `class: ${record.failureClass}${typeof record.retryable === "boolean" ? ` (retryable=${record.retryable})` : ""}
1340
+ `
1341
+ );
1342
+ }
1343
+ if (record.credentialGroup) {
1344
+ deps.output.write(`credGroup: ${record.credentialGroup}
1345
+ `);
1346
+ }
1250
1347
  const activitySummary = formatActivitySummary(record.activity);
1251
1348
  if (activitySummary) deps.output.write(`${activitySummary}
1252
1349
  `);