nolo-cli 0.33.0-alpha.8 → 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-RI6DRQTP.js → _executeModel-BUYCXZCQ.js} +65 -65
  2. package/{action-SMLG6OTB.js → action-KMBZ3LCZ.js} +12 -12
  3. package/{addContentAction-SFO244QN.js → addContentAction-KQ44UT2U.js} +10 -10
  4. package/{addDialogAgentAction-W44ZCEHB.js → addDialogAgentAction-ILSDCMYL.js} +9 -9
  5. package/{agentDeleteCommand-F2P4PF6R.js → agentDeleteCommand-WSS2IJVM.js} +40 -39
  6. package/{agentEmailCommands-BW6ZDQ3C.js → agentEmailCommands-SHTPJTSX.js} +75 -75
  7. package/{agentListCommands-IC3GH45S.js → agentListCommands-GV6UYVAF.js} +47 -37
  8. package/{agentMachineCommands-LGYGQX75.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-F5L6GPSK.js → agentRunCommand-HJGXSMDN.js} +78 -76
  13. package/{agentRunControl-SCIVRZWX.js → agentRunControl-GXOB47YI.js} +5 -1
  14. package/{agentRuntimeLocal-B7SHOEHJ.js → agentRuntimeLocal-G7ZV55I6.js} +33 -33
  15. package/{agentSlice-GMKJKCPY.js → agentSlice-HFR7SP3B.js} +12 -12
  16. package/agentSuperviseCommands-Q64S5SPG.js +640 -0
  17. package/{appDeleteCommands-63VCZ5CT.js → appDeleteCommands-SHHE56Y2.js} +35 -34
  18. package/{appDeployCommands-YFTG2P3K.js → appDeployCommands-WUMSO2VS.js} +35 -34
  19. package/{appDeployStatusCommands-R5ENU5CQ.js → appDeployStatusCommands-VZSVN6SR.js} +35 -34
  20. package/{appGetCommands-3CH3VMUB.js → appGetCommands-ZJ2C3A5Y.js} +35 -34
  21. package/{appListCommands-Q2HVYG7J.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-ZRFKEKD3.js → chatQueueReduxAdapter-SYIX4ODY.js} +28 -28
  25. package/{chunk-57QJXIB6.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-PVVAWIUN.js → chunk-3LWZNEGQ.js} +1 -1
  29. package/{chunk-2GKZGZBN.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-MUCM2MZB.js → chunk-6KYCG5GW.js} +1216 -690
  36. package/chunk-6XG52ZQ6.js +146 -0
  37. package/{chunk-XFV2VK7O.js → chunk-74IQ5RRO.js} +21 -8
  38. package/{chunk-FMEVI5TG.js → chunk-7CH6U3FL.js} +1 -1
  39. package/{chunk-6FNS3SQF.js → chunk-7YDKVLAE.js} +10 -10
  40. package/{chunk-LZC5YX6P.js → chunk-AUH2LTIY.js} +7 -7
  41. package/{chunk-CLP2K7U4.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-XL7BR2GE.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-W7J5HZI7.js → chunk-FDKEDU7R.js} +14 -14
  48. package/{chunk-AOXVOC6D.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-KBZCACG7.js → chunk-HDT2RB7T.js} +3 -3
  55. package/{chunk-X664KVEV.js → chunk-HHBXCRJS.js} +204 -123
  56. package/{chunk-37V5LNEQ.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-PREQU5QV.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-JCGIUBE3.js → chunk-KCBK4MDT.js} +294 -54
  65. package/{chunk-WJSW43QZ.js → chunk-L3JWI7WX.js} +0 -1
  66. package/{chunk-VOBUVWP5.js → chunk-LAUUAYLK.js} +39 -2672
  67. package/{chunk-TFPUAELY.js → chunk-LD6Y6RJY.js} +4 -4
  68. package/{chunk-NKFMFT4W.js → chunk-LQ6PUHW6.js} +4195 -2631
  69. package/chunk-M3JQWYBC.js +387 -0
  70. package/{chunk-GM6PU7B6.js → chunk-MEYIRKDN.js} +0 -1
  71. package/{chunk-JZ5AMMXU.js → chunk-MGIHZ5CJ.js} +4 -4
  72. package/chunk-MI2J67UU.js +43 -0
  73. package/{chunk-JTSGWTYZ.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-CHYAYZJH.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-XCCGU6QB.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-O6W5PZXA.js → chunk-VBD7W4Q6.js} +2057 -212
  86. package/{chunk-RTJWH72P.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-VH2F7ZB6.js → chunk-WN5AJG5I.js} +1 -1
  91. package/{chunk-KSRFVP36.js → chunk-WRN7L5CS.js} +1 -1
  92. package/{chunk-4C7K5NXX.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-IL545V3E.js → chunk-XQES6LXQ.js} +2 -2
  96. package/{chunk-UK5JGQVU.js → chunk-XT73C4VH.js} +26 -21
  97. package/{chunk-RY57GLGW.js → chunk-YPREESF4.js} +42 -5
  98. package/{chunk-YBPAQV37.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-6SE7CQ7F.js → createAgentAutomationAction-BH3D2L2H.js} +28 -30
  106. package/{createDialogAction-AROAXAPM.js → createDialogAction-U4LDV2RW.js} +31 -33
  107. package/{createPageAction-GCO3R6GR.js → createPageAction-Q2ANG535.js} +30 -32
  108. package/{dbSlice-3SD5L5H2.js → dbSlice-PIQGICNM.js} +9 -9
  109. package/{deleteFile-XQXPBFFB.js → deleteFile-NPZ64DFN.js} +4 -4
  110. package/{dialogCommands-N26NNRRD.js → dialogCommands-C556D6WD.js} +37 -36
  111. package/{dialogSlice-JVPBOMFB.js → dialogSlice-P2VSKG2X.js} +27 -27
  112. package/dist-VODFSGNG.js +7442 -0
  113. package/{docCreateCommands-PON6FF4V.js → docCreateCommands-AAVGLQWE.js} +36 -35
  114. package/{docDeleteCommands-WWRFONDS.js → docDeleteCommands-PKMKSQD2.js} +37 -36
  115. package/{docReadCommands-S4Z275LB.js → docReadCommands-2WUH7UXC.js} +36 -35
  116. package/{docStore-WGDO3I76.js → docStore-J5UWRBB4.js} +29 -31
  117. package/{docUpdateCommands-TJQB4IJ7.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-T7AS7DDY.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-C6CPXZRR.js → machineCommands-CWKMJG33.js} +77 -77
  126. package/{machineInfo-M6KB6HZN.js → machineInfo-66ZFUMLE.js} +1 -1
  127. package/{machineWsRunDispatch-27K2P4OP.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-6G73BMEY.js → read-6C2XD3YZ.js} +5 -5
  131. package/{readDocTool-DK4EI2GA.js → readDocTool-Y7AB365O.js} +1 -1
  132. package/{readlineWorkspace-LBWKTPJE.js → readlineWorkspace-VYELP22P.js} +2851 -1515
  133. package/{removeDialogAgentAction-E7H557UO.js → removeDialogAgentAction-KG5WMJRZ.js} +13 -13
  134. package/{runAgentClientLoop-D2T2P36H.js → runAgentClientLoop-35GKZDOZ.js} +62 -61
  135. package/{runtimeDoctorCommands-KIKM6BIO.js → runtimeDoctorCommands-HT4O2PXL.js} +6 -6
  136. package/{setDialogExtraReferencesAction-RMMGBR5F.js → setDialogExtraReferencesAction-O2NLXMSM.js} +10 -10
  137. package/{setPrimaryDialogAgentAction-FWBKKLVA.js → setPrimaryDialogAgentAction-FYYUY7PB.js} +13 -13
  138. package/{settingSlice-73PV4KG4.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-B6LO4U5R.js → spaceCommands-AAKQM2PM.js} +223 -37
  142. package/{spaceSlice-VUAEZVDS.js → spaceSlice-NSNGR4Y2.js} +28 -30
  143. package/{streamAgentChatTurn-BBPSFMTZ.js → streamAgentChatTurn-D5IDHXMV.js} +116 -129
  144. package/{switchDialogAgentAction-US6QNL3N.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-NWA3J7KE.js → tools-JQOETZP5.js} +44 -45
  148. package/{tuiSummaryLlmCaller-KC7JCJBB.js → tuiSummaryLlmCaller-LH7F2SP7.js} +18 -18
  149. package/{updateCommands-AK2RDOFR.js → updateCommands-MNDUIKN7.js} +2 -2
  150. package/{updateDialogTitleAction-TDDQ4J4L.js → updateDialogTitleAction-WOTSDSFQ.js} +31 -33
  151. package/agentRecordCommands-FCQ7ZF6C.js +0 -113
  152. package/chunk-5SBK2MTI.js +0 -528
  153. package/chunk-M3JEW6N6.js +0 -193
  154. package/chunk-OOK2ZT5F.js +0 -1800
  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
@@ -23,7 +23,7 @@ import {
23
23
  shouldStripReasoningContentForOutbound,
24
24
  toOpenAiCompatibleMessages,
25
25
  toResponsesTools
26
- } from "./chunk-NNWHHCVP.js";
26
+ } from "./chunk-BMB563Y6.js";
27
27
  import {
28
28
  buildProviderExecutionPlan,
29
29
  canUsePlatformChatProvider,
@@ -32,10 +32,10 @@ import {
32
32
  resolvePlatformAuthToken,
33
33
  resolvePlatformServerUrl,
34
34
  resolveProviderTransportDecision
35
- } from "./chunk-7YYHKBJP.js";
35
+ } from "./chunk-GKHV4UH5.js";
36
36
  import {
37
37
  clipCompactText
38
- } from "./chunk-AOXVOC6D.js";
38
+ } from "./chunk-FGLKRJDI.js";
39
39
  import {
40
40
  isRecord
41
41
  } from "./chunk-KUG52IAP.js";
@@ -339,15 +339,22 @@ async function* readSseFrames(response) {
339
339
  const { done, value } = await reader.read();
340
340
  if (done) break;
341
341
  buffer += decoder.decode(value, { stream: true });
342
- let boundary = buffer.indexOf("\n\n");
343
- while (boundary !== -1) {
344
- yield buffer.slice(0, boundary);
345
- buffer = buffer.slice(boundary + 2);
346
- boundary = buffer.indexOf("\n\n");
342
+ let boundary = findSseFrameBoundary(buffer);
343
+ while (boundary) {
344
+ yield buffer.slice(0, boundary.index);
345
+ buffer = buffer.slice(boundary.index + boundary.separatorLength);
346
+ boundary = findSseFrameBoundary(buffer);
347
347
  }
348
348
  }
349
349
  if (buffer.trim()) yield buffer;
350
350
  }
351
+ function findSseFrameBoundary(buffer) {
352
+ const lfLf = buffer.indexOf("\n\n");
353
+ const crLfCrLf = buffer.indexOf("\r\n\r\n");
354
+ if (lfLf === -1 && crLfCrLf === -1) return null;
355
+ const useLf = lfLf !== -1 && (crLfCrLf === -1 || lfLf < crLfCrLf);
356
+ return useLf ? { index: lfLf, separatorLength: 2 } : { index: crLfCrLf, separatorLength: 4 };
357
+ }
351
358
  async function* streamSseDataValues(response, parse) {
352
359
  const reader = response.body?.getReader();
353
360
  if (!reader) return;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  trimTrailingSlash
3
- } from "./chunk-7YYHKBJP.js";
3
+ } from "./chunk-GKHV4UH5.js";
4
4
  import {
5
5
  toErrorMessage
6
6
  } from "./chunk-HNMXYYJR.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  resolveMachineId
3
- } from "./chunk-6HYVJV7B.js";
3
+ } from "./chunk-ESHYE7WU.js";
4
4
  import {
5
5
  getDefaultCliLocalRuntimeDb
6
- } from "./chunk-Q5ITEGIN.js";
6
+ } from "./chunk-N4XRDM26.js";
7
7
  import {
8
8
  buildCliRuntimeEnv,
9
9
  clearProfileAuthToken,
@@ -11,7 +11,7 @@ import {
11
11
  getDefaultProfileConfigPath,
12
12
  loadProfileConfig,
13
13
  saveDefaultProfile
14
- } from "./chunk-GE6IWA5N.js";
14
+ } from "./chunk-UNZDCI3O.js";
15
15
  import {
16
16
  resolveAuthTokenFromEnv
17
17
  } from "./chunk-A7GB5UGH.js";
@@ -23,7 +23,7 @@ import {
23
23
  createMemoryOwnerIndexKey,
24
24
  createMemorySubjectKindIndexKey,
25
25
  memoryOwnerRange
26
- } from "./chunk-KMSZPTM6.js";
26
+ } from "./chunk-2WKUUY2E.js";
27
27
  import {
28
28
  asTrimmedNonEmptyStringArray
29
29
  } from "./chunk-I42VC5KR.js";
@@ -40,6 +40,20 @@ import { stdin as input, stdout as output } from "node:process";
40
40
  import { spawn } from "node:child_process";
41
41
 
42
42
  // packages/ai/memory/delete.ts
43
+ function hasExplicitDeleteFilters(filters) {
44
+ return Boolean(
45
+ filters.ids && filters.ids.length > 0 || typeof filters.contentSubstring === "string" && filters.contentSubstring.trim().length > 0 || filters.tags && filters.tags.length > 0 || typeof filters.sourceDialogId === "string" && filters.sourceDialogId.trim().length > 0 || typeof filters.patternKeyPrefix === "string" && filters.patternKeyPrefix.trim().length > 0 || filters.facets && filters.facets.length > 0 || typeof filters.subjectId === "string" && filters.subjectId.trim().length > 0
46
+ );
47
+ }
48
+ function generateMemoryDeletionToken(ownerId, itemIds) {
49
+ const sorted = [...itemIds].sort().join(",");
50
+ const seed = `${ownerId}:${sorted}`;
51
+ let hash = 0;
52
+ for (let i = 0; i < seed.length; i++) {
53
+ hash = (hash << 5) - hash + seed.charCodeAt(i) | 0;
54
+ }
55
+ return `tok-${Math.abs(hash).toString(36)}-${itemIds.length}`;
56
+ }
43
57
  var normalizeSet = (values) => {
44
58
  if (!Array.isArray(values) || values.length === 0) return null;
45
59
  const normalized = asTrimmedNonEmptyStringArray(values);
@@ -66,6 +80,10 @@ var matchesFilters = (item, filters) => {
66
80
  if (!itemTags.has(tag)) return false;
67
81
  }
68
82
  }
83
+ const contentSub = asTrimmedString(filters.contentSubstring);
84
+ if (contentSub && !(item.content ?? "").toLowerCase().includes(contentSub.toLowerCase())) {
85
+ return false;
86
+ }
69
87
  return true;
70
88
  };
71
89
  var deleteMemoryItemWithIndexesInBatch = (batch, item) => {
@@ -89,6 +107,11 @@ var deleteMemoryItemWithIndexesInBatch = (batch, item) => {
89
107
  );
90
108
  };
91
109
  var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
110
+ if (!hasExplicitDeleteFilters(filters)) {
111
+ throw new Error(
112
+ "At least one filter is required; delete operation will not delete all memory implicitly."
113
+ );
114
+ }
92
115
  const range = memoryOwnerRange(owner.ownerType, owner.ownerId);
93
116
  const matchedItems = [];
94
117
  const limit = typeof filters.limit === "number" && filters.limit > 0 ? filters.limit : Number.POSITIVE_INFINITY;
@@ -108,6 +131,23 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
108
131
  if (matchedItems.length === 0) {
109
132
  return { deletedCount: 0, deletedIds: [], matchedItems: [] };
110
133
  }
134
+ const token = generateMemoryDeletionToken(
135
+ owner.ownerId,
136
+ matchedItems.map((i) => i.id)
137
+ );
138
+ if (filters.dryRun) {
139
+ return {
140
+ deletedCount: 0,
141
+ deletedIds: [],
142
+ matchedItems,
143
+ deletionToken: token
144
+ };
145
+ }
146
+ if (filters.deletionToken && filters.deletionToken !== token) {
147
+ throw new Error(
148
+ "deletionToken mismatch: memory dataset changed since preview; please rerun dry-run preview before confirming."
149
+ );
150
+ }
111
151
  const batch = db.batch();
112
152
  for (const item of matchedItems) {
113
153
  deleteMemoryItemWithIndexesInBatch(batch, item);
@@ -116,7 +156,8 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
116
156
  return {
117
157
  deletedCount: matchedItems.length,
118
158
  deletedIds: matchedItems.map((item) => item.id),
119
- matchedItems
159
+ matchedItems,
160
+ deletionToken: token
120
161
  };
121
162
  };
122
163
 
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  patch,
9
9
  selectById
10
- } from "./chunk-57QJXIB6.js";
10
+ } from "./chunk-23KKIMD5.js";
11
11
  import {
12
12
  __toESM
13
13
  } from "./chunk-4VNS5WPM.js";
@@ -4,7 +4,7 @@ import {
4
4
 
5
5
  // packages/cli/agentCommandSupport.ts
6
6
  async function getDefaultCliDb() {
7
- const { getDefaultCliLocalRuntimeDb } = await import("./localRuntimeDb-DDZCJFQZ.js");
7
+ const { getDefaultCliLocalRuntimeDb } = await import("./localRuntimeDb-N3H3HQ7G.js");
8
8
  return getDefaultCliLocalRuntimeDb();
9
9
  }
10
10
  function createNullCliDb() {
@@ -1,5 +1,13 @@
1
1
  // packages/cli/client/profileConfig.ts
2
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import {
3
+ appendFileSync,
4
+ chmodSync,
5
+ existsSync,
6
+ mkdirSync,
7
+ readFileSync,
8
+ statSync,
9
+ writeFileSync
10
+ } from "node:fs";
3
11
  import { dirname, join } from "node:path";
4
12
  import { homedir } from "node:os";
5
13
 
@@ -27,6 +35,10 @@ function canonicalizeNoloServerUrl(value) {
27
35
 
28
36
  // packages/cli/client/profileConfig.ts
29
37
  var normalizeProfileServerUrl = canonicalizeNoloServerUrl;
38
+ function isProtectedHomeProfileWrite(path) {
39
+ if (process.env.NODE_ENV !== "test") return false;
40
+ return path === join(homedir(), ".nolo", "config.json");
41
+ }
30
42
  function getDefaultProfileConfigPath() {
31
43
  const noloHome = process.env.NOLO_HOME?.trim();
32
44
  return noloHome ? join(noloHome, "config.json") : join(homedir(), ".nolo", "config.json");
@@ -43,6 +55,7 @@ function loadProfileConfig(path = getDefaultProfileConfigPath()) {
43
55
  return parsed;
44
56
  }
45
57
  function clearProfileAuthToken(path = getDefaultProfileConfigPath()) {
58
+ if (isProtectedHomeProfileWrite(path)) return false;
46
59
  const config = loadProfileConfig(path);
47
60
  if (!config) return false;
48
61
  const profile = config.profiles[config.currentProfile];
@@ -54,6 +67,11 @@ function clearProfileAuthToken(path = getDefaultProfileConfigPath()) {
54
67
  return true;
55
68
  }
56
69
  function saveDefaultProfile(path, profile) {
70
+ if (isProtectedHomeProfileWrite(path)) {
71
+ throw new Error(
72
+ `Refusing to write the developer's real profile from a test process: ${path}. Pass a temp path or set NOLO_HOME.`
73
+ );
74
+ }
57
75
  const existing = loadProfileConfig(path);
58
76
  const mergedDefault = {
59
77
  ...existing?.profiles?.default ?? {},
@@ -89,9 +107,11 @@ function buildCliRuntimeEnv(processEnv, config) {
89
107
  const profileEnv = buildEnvFromProfile(config);
90
108
  const explicitAuthToken = processEnv.AUTH_TOKEN || processEnv.AUTH;
91
109
  const explicitServerUrl = processEnv.NOLO_SERVER || processEnv.NOLO_SERVER_URL || processEnv.BASE_URL;
110
+ const agentSource = processEnv.NOLO_AGENT?.trim() ? "env" : profileEnv.NOLO_AGENT ? "profile" : void 0;
92
111
  return {
93
112
  ...profileEnv,
94
113
  ...processEnv,
114
+ NOLO_AGENT_SOURCE: agentSource,
95
115
  ...explicitAuthToken ? { AUTH_TOKEN: explicitAuthToken } : {},
96
116
  ...explicitServerUrl ? {
97
117
  NOLO_SERVER: explicitServerUrl,
@@ -104,6 +124,7 @@ function getCurrentProfile(config) {
104
124
  return config.profiles[config.currentProfile] ?? null;
105
125
  }
106
126
  function saveProfileLocale(locale, path = getDefaultProfileConfigPath()) {
127
+ if (isProtectedHomeProfileWrite(path)) return null;
107
128
  const config = loadProfileConfig(path);
108
129
  if (!config) return null;
109
130
  const profile = config.profiles[config.currentProfile];
@@ -114,13 +135,115 @@ function saveProfileLocale(locale, path = getDefaultProfileConfigPath()) {
114
135
  `, "utf8");
115
136
  return config;
116
137
  }
138
+ function getAgentSelectionAuditPath(configPath = getDefaultProfileConfigPath()) {
139
+ return join(dirname(configPath), "agent-selection.log");
140
+ }
141
+ var AGENT_SELECTION_AUDIT_MAX_BYTES = 512 * 1024;
142
+ var AGENT_SELECTION_AUDIT_KEEP_LINES = 200;
143
+ var SECRET_ARGV_FLAGS = /* @__PURE__ */ new Set([
144
+ "--token",
145
+ "--auth",
146
+ "--auth-token",
147
+ "--key",
148
+ "--api-key",
149
+ "--app-key",
150
+ "--machine-key",
151
+ "--provider-api-key",
152
+ "--invite-token",
153
+ "--password",
154
+ "--secret"
155
+ ]);
156
+ function redactArgvSecrets(argv) {
157
+ const redacted = [];
158
+ let maskNext = false;
159
+ for (const arg of argv) {
160
+ if (maskNext) {
161
+ maskNext = false;
162
+ redacted.push("[REDACTED]");
163
+ continue;
164
+ }
165
+ const equals = arg.indexOf("=");
166
+ if (equals > 0 && SECRET_ARGV_FLAGS.has(arg.slice(0, equals))) {
167
+ redacted.push(`${arg.slice(0, equals)}=[REDACTED]`);
168
+ continue;
169
+ }
170
+ maskNext = SECRET_ARGV_FLAGS.has(arg);
171
+ redacted.push(arg);
172
+ }
173
+ return redacted;
174
+ }
175
+ function appendAgentSelectionAudit(entry, auditPath = getAgentSelectionAuditPath(entry.configPath)) {
176
+ try {
177
+ const stack = (new Error().stack ?? "").split("\n").slice(2, 8).map((line2) => line2.trim()).filter(Boolean);
178
+ const line = `${JSON.stringify({
179
+ at: (/* @__PURE__ */ new Date()).toISOString(),
180
+ pid: process.pid,
181
+ // Distinguishes repo source / installed binary / bundled desktop build —
182
+ // the field that says whether a stale build is doing the writing.
183
+ execPath: process.execPath,
184
+ argv: redactArgvSecrets(process.argv),
185
+ cwd: process.cwd(),
186
+ previous: entry.previous,
187
+ next: entry.next,
188
+ stack
189
+ })}
190
+ `;
191
+ mkdirSync(dirname(auditPath), { recursive: true });
192
+ const auditMode = 384;
193
+ if (existsSync(auditPath) && statSync(auditPath).size > AGENT_SELECTION_AUDIT_MAX_BYTES) {
194
+ const kept = readFileSync(auditPath, "utf8").split("\n").filter((entry2) => entry2.trim()).slice(-AGENT_SELECTION_AUDIT_KEEP_LINES).join("\n");
195
+ writeFileSync(auditPath, `${kept}
196
+ `, {
197
+ encoding: "utf8",
198
+ mode: auditMode
199
+ });
200
+ }
201
+ appendFileSync(auditPath, line, { encoding: "utf8", mode: auditMode });
202
+ try {
203
+ chmodSync(auditPath, auditMode);
204
+ } catch {
205
+ }
206
+ } catch {
207
+ }
208
+ }
209
+ function readLastAgentSelectionAudit(auditPath = getAgentSelectionAuditPath()) {
210
+ try {
211
+ if (!existsSync(auditPath)) return { logExists: false, last: null };
212
+ const lines = readFileSync(auditPath, "utf8").trim().split("\n");
213
+ for (let index = lines.length - 1; index >= 0; index -= 1) {
214
+ const raw = lines[index]?.trim();
215
+ if (!raw) continue;
216
+ const parsed = JSON.parse(raw);
217
+ if (!parsed.next) continue;
218
+ return {
219
+ logExists: true,
220
+ last: {
221
+ agentKey: parsed.next.agentKey ?? "",
222
+ agentName: parsed.next.agentName ?? ""
223
+ }
224
+ };
225
+ }
226
+ return { logExists: true, last: null };
227
+ } catch {
228
+ return { logExists: false, last: null };
229
+ }
230
+ }
117
231
  function saveProfileAgentSelection(selection, path = getDefaultProfileConfigPath()) {
232
+ if (isProtectedHomeProfileWrite(path)) return null;
118
233
  const config = loadProfileConfig(path);
119
234
  if (!config) return null;
120
235
  const profile = config.profiles[config.currentProfile];
121
236
  if (!profile) return null;
122
237
  const agentKey = selection.agentKey.trim();
123
238
  const agentName = selection.agentName.trim();
239
+ appendAgentSelectionAudit({
240
+ previous: {
241
+ ...profile.agentKey ? { agentKey: profile.agentKey } : {},
242
+ ...profile.agentName ? { agentName: profile.agentName } : {}
243
+ },
244
+ next: { agentKey, agentName },
245
+ configPath: path
246
+ });
124
247
  if (!agentKey) {
125
248
  delete profile.agentKey;
126
249
  delete profile.agentName;
@@ -143,5 +266,7 @@ export {
143
266
  buildCliRuntimeEnv,
144
267
  getCurrentProfile,
145
268
  saveProfileLocale,
269
+ getAgentSelectionAuditPath,
270
+ readLastAgentSelectionAudit,
146
271
  saveProfileAgentSelection
147
272
  };
@@ -1,16 +1,18 @@
1
1
  import {
2
2
  getModelConfig
3
- } from "./chunk-DFUPZE6V.js";
3
+ } from "./chunk-C6ELZQ7H.js";
4
4
  import {
5
5
  PLATFORM_HOSTED_KIMI_K3_MODEL,
6
6
  isPlatformHostedClaudeModel,
7
7
  isPlatformHostedDeepseekModel,
8
+ isPlatformHostedGeminiImageModel,
8
9
  isPlatformHostedGeminiModel,
10
+ isPlatformHostedGlm53FlashModel,
9
11
  isPlatformHostedGlmModel,
10
12
  isPlatformHostedGrokModel,
11
13
  isPlatformHostedKimiK26Model,
12
- isPlatformHostedQwen37FlashModel
13
- } from "./chunk-OR2HNLVO.js";
14
+ isPlatformHostedOpenAIImageModel
15
+ } from "./chunk-X6EN3KJX.js";
14
16
  import {
15
17
  asTrimmedLowercaseString
16
18
  } from "./chunk-QSJ3HFEF.js";
@@ -30,7 +32,9 @@ var PLATFORM_CHAT_COMPLETIONS_ENDPOINTS = {
30
32
  // Moonshot AI(月之暗面)开放平台 OpenAI 兼容模式(按量计费)
31
33
  moonshot: "https://api.moonshot.cn/v1/chat/completions",
32
34
  // 平台托管 Kimi K3 的实际上游
33
- crof: "https://crof.ai/v1/chat/completions"
35
+ crof: "https://crof.ai/v1/chat/completions",
36
+ // 平台托管 GLM 5.3 Flash 的实际上游(RunInfra 独家廉价快档)
37
+ runinfra: "https://api.runinfra.ai/v1/chat/completions"
34
38
  // 无 nolo 默认上游:平台托管模型全部显式分流,未识别模型返回 undefined
35
39
  };
36
40
  function isOpenAiResponsesModel(args) {
@@ -46,6 +50,7 @@ function isOpenAiResponsesModel(args) {
46
50
  }
47
51
  if (provider === "deepseek" || provider === "nolo" || provider === "ollama-cloud") {
48
52
  if (isPlatformHostedDeepseekModel(args.model)) return true;
53
+ if (isPlatformHostedOpenAIImageModel(args.model)) return true;
49
54
  }
50
55
  return false;
51
56
  }
@@ -53,6 +58,9 @@ function resolvePlatformResponsesEndpoint(provider, model) {
53
58
  const normalized = asTrimmedLowercaseString(provider);
54
59
  if (normalized === "openai") return OPENAI_RESPONSES_ENDPOINT;
55
60
  if (normalized === "deepseek" || normalized === "nolo" || normalized === "ollama-cloud") {
61
+ if (isPlatformHostedOpenAIImageModel(model)) {
62
+ return OPENAI_RESPONSES_ENDPOINT;
63
+ }
56
64
  if (!model || isPlatformHostedDeepseekModel(model)) {
57
65
  return DEEPSEEK_RESPONSES_ENDPOINT;
58
66
  }
@@ -76,12 +84,18 @@ function resolvePlatformChatCompletionsEndpoint(provider, model) {
76
84
  if (aliased === "nolo" && (isPlatformHostedKimiK26Model(model) || isPlatformHostedGlmModel(model))) {
77
85
  return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.openrouter;
78
86
  }
87
+ if (aliased === "nolo" && isPlatformHostedGlm53FlashModel(model)) {
88
+ return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.runinfra;
89
+ }
79
90
  if (aliased === "nolo" && asTrimmedLowercaseString(model) === PLATFORM_HOSTED_KIMI_K3_MODEL) {
80
91
  return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.crof;
81
92
  }
82
- if (aliased === "nolo" && (isPlatformHostedGeminiModel(model) || isPlatformHostedQwen37FlashModel(model))) {
93
+ if (aliased === "nolo" && (isPlatformHostedGeminiModel(model) || isPlatformHostedGeminiImageModel(model))) {
83
94
  return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.google;
84
95
  }
96
+ if (aliased === "nolo" && isPlatformHostedOpenAIImageModel(model)) {
97
+ return void 0;
98
+ }
85
99
  if (aliased === "nolo" && isPlatformHostedDeepseekModel(model)) {
86
100
  return void 0;
87
101
  }