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
@@ -0,0 +1,297 @@
1
+ import {
2
+ resolveRunReportJsonPath,
3
+ resolveRunReportPath,
4
+ resolveRunsDir
5
+ } from "./chunk-VSA6QAGV.js";
6
+
7
+ // packages/cli/agentRunReport.ts
8
+ import { homedir as nodeHomedir } from "node:os";
9
+ import * as nodeFs from "node:fs";
10
+ import {
11
+ execFileSync as nodeExecFileSync,
12
+ spawnSync as nodeSpawnSync
13
+ } from "node:child_process";
14
+ function formatDuration(startedAt, endedAt, now) {
15
+ const start = new Date(startedAt).getTime();
16
+ const end = endedAt ? new Date(endedAt).getTime() : (now ?? /* @__PURE__ */ new Date()).getTime();
17
+ if (isNaN(start)) return "-";
18
+ const elapsedMs = Math.max(0, (isNaN(end) ? Date.now() : end) - start);
19
+ const seconds = Math.floor(elapsedMs / 1e3) % 60;
20
+ const minutes = Math.floor(elapsedMs / 6e4) % 60;
21
+ const hours = Math.floor(elapsedMs / 36e5);
22
+ if (hours > 0) return `${hours}h ${minutes}m ${seconds}s`;
23
+ if (minutes > 0) return `${minutes}m ${seconds}s`;
24
+ return `${seconds}s`;
25
+ }
26
+ function extractTailLines(text, count) {
27
+ if (!text) return [];
28
+ const lines = String(text).split(/\r?\n/);
29
+ if (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
30
+ return lines.slice(Math.max(0, lines.length - count));
31
+ }
32
+ function formatCodeBlockCell(lines) {
33
+ if (lines.length === 0) return "-";
34
+ const escaped = lines.map((line) => line.replace(/\|/g, "\\|")).join("<br>");
35
+ return `<pre>${escaped}</pre>`;
36
+ }
37
+ function executeDoDCommand(cmd, cwd, deps = {}) {
38
+ const spawnSync = deps.spawnSync ?? nodeSpawnSync;
39
+ try {
40
+ const res = spawnSync(cmd, {
41
+ shell: true,
42
+ cwd: cwd || process.cwd(),
43
+ timeout: 12e4,
44
+ maxBuffer: 10 * 1024 * 1024,
45
+ encoding: "utf8"
46
+ });
47
+ if (res.error) {
48
+ const errCode = res.error.code;
49
+ if (errCode === "ETIMEDOUT" || res.signal === "SIGTERM" || res.signal === "SIGKILL") {
50
+ return {
51
+ command: cmd,
52
+ exitCode: "timeout",
53
+ stdoutTail: extractTailLines(res.stdout, 20),
54
+ stderrTail: extractTailLines(res.stderr || res.error.message, 10)
55
+ };
56
+ }
57
+ return {
58
+ command: cmd,
59
+ exitCode: "error",
60
+ stdoutTail: extractTailLines(res.stdout, 20),
61
+ stderrTail: extractTailLines(res.stderr || res.error.message, 10)
62
+ };
63
+ }
64
+ if (res.status === null && (res.signal === "SIGTERM" || res.signal === "SIGKILL")) {
65
+ return {
66
+ command: cmd,
67
+ exitCode: "timeout",
68
+ stdoutTail: extractTailLines(res.stdout, 20),
69
+ stderrTail: extractTailLines(res.stderr, 10)
70
+ };
71
+ }
72
+ const exitCode = typeof res.status === "number" ? res.status : "error";
73
+ return {
74
+ command: cmd,
75
+ exitCode,
76
+ stdoutTail: extractTailLines(res.stdout, 20),
77
+ stderrTail: extractTailLines(res.stderr, 10)
78
+ };
79
+ } catch (err) {
80
+ return {
81
+ command: cmd,
82
+ exitCode: "error",
83
+ stdoutTail: [],
84
+ stderrTail: extractTailLines(err instanceof Error ? err.message : String(err), 10)
85
+ };
86
+ }
87
+ }
88
+ function collectGitSummary(cwd, spawnHead, deps = {}) {
89
+ const targetCwd = cwd || process.cwd();
90
+ const execFile = deps.execFileSync ?? nodeExecFileSync;
91
+ try {
92
+ const isRepo = execFile("git", ["rev-parse", "--is-inside-work-tree"], {
93
+ cwd: targetCwd,
94
+ encoding: "utf8",
95
+ stdio: ["ignore", "pipe", "ignore"],
96
+ timeout: 5e3
97
+ }).trim();
98
+ if (isRepo !== "true") {
99
+ return { isGitRepo: false };
100
+ }
101
+ let modifiedCount = 0;
102
+ let untrackedCount = 0;
103
+ try {
104
+ const statusOut = execFile("git", ["status", "--porcelain"], {
105
+ cwd: targetCwd,
106
+ encoding: "utf8",
107
+ stdio: ["ignore", "pipe", "ignore"],
108
+ timeout: 1e4
109
+ });
110
+ const statusLines = statusOut.split(/\r?\n/).filter((l) => l.trim().length > 0);
111
+ for (const line of statusLines) {
112
+ if (line.startsWith("??")) {
113
+ untrackedCount += 1;
114
+ } else {
115
+ modifiedCount += 1;
116
+ }
117
+ }
118
+ } catch (err) {
119
+ return {
120
+ isGitRepo: true,
121
+ error: `git status \u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`
122
+ };
123
+ }
124
+ let commits;
125
+ if (spawnHead) {
126
+ try {
127
+ const logOut = execFile(
128
+ "git",
129
+ ["log", `${spawnHead}..HEAD`, "--oneline", "-n", "20"],
130
+ {
131
+ cwd: targetCwd,
132
+ encoding: "utf8",
133
+ stdio: ["ignore", "pipe", "ignore"],
134
+ timeout: 1e4
135
+ }
136
+ );
137
+ commits = logOut.split(/\r?\n/).filter((l) => l.trim().length > 0).slice(0, 20);
138
+ } catch (logErr) {
139
+ commits = [`(git log \u5931\u8D25: ${logErr instanceof Error ? logErr.message : String(logErr)})`];
140
+ }
141
+ }
142
+ return {
143
+ isGitRepo: true,
144
+ modifiedCount,
145
+ untrackedCount,
146
+ spawnHead,
147
+ commits
148
+ };
149
+ } catch (err) {
150
+ return {
151
+ isGitRepo: false,
152
+ error: err instanceof Error ? err.message : String(err)
153
+ };
154
+ }
155
+ }
156
+ function parseDoDResultsFromMarkdown(markdown) {
157
+ const dodResults = [];
158
+ const lines = markdown.split(/\r?\n/);
159
+ let inDoDSection = false;
160
+ for (const line of lines) {
161
+ if (line.startsWith("## DoD \u9A8C\u6536\u7ED3\u679C")) {
162
+ inDoDSection = true;
163
+ continue;
164
+ }
165
+ if (inDoDSection && line.startsWith("## ")) {
166
+ inDoDSection = false;
167
+ break;
168
+ }
169
+ if (inDoDSection && line.startsWith("|")) {
170
+ const cells = line.split("|").map((c) => c.trim()).filter((c) => c.length > 0);
171
+ if (cells.length >= 2) {
172
+ if (cells[0] === "\u547D\u4EE4" || cells[0].startsWith("---")) continue;
173
+ const cmd = cells[0].replace(/^`|`$/g, "").trim();
174
+ const codeRaw = cells[1].trim();
175
+ let exitCode;
176
+ if (codeRaw === "timeout") exitCode = "timeout";
177
+ else if (codeRaw === "error") exitCode = "error";
178
+ else {
179
+ const parsedNum = parseInt(codeRaw, 10);
180
+ exitCode = isNaN(parsedNum) ? "error" : parsedNum;
181
+ }
182
+ dodResults.push({ command: cmd, exitCode });
183
+ }
184
+ }
185
+ }
186
+ const passed = dodResults.length > 0 && dodResults.every((r) => r.exitCode === 0);
187
+ return { passed, dodResults };
188
+ }
189
+ async function buildRunReportData(record, deps = {}) {
190
+ const now = (deps.now ?? (() => /* @__PURE__ */ new Date()))();
191
+ const duration = formatDuration(record.startedAt, record.endedAt, now);
192
+ const edits = record.activity?.counters?.fileEdits ?? 0;
193
+ const tools = record.activity?.counters?.toolCalls ?? 0;
194
+ const llmCalls = record.activity?.counters?.llmCalls ?? 0;
195
+ const activityStr = `${edits} edits, ${tools} tools`;
196
+ const exitCodeStr = typeof record.exitCode === "number" ? String(record.exitCode) : "-";
197
+ const agentDisplay = record.agentName ? `${record.agentName} (${record.agentKey})` : record.agentKey;
198
+ const dialogIdStr = record.dialogId || "-";
199
+ const lines = [];
200
+ lines.push(`# Run \u9A8C\u6536\u62A5\u544A: ${record.runId}`);
201
+ lines.push("");
202
+ lines.push("## \u6982\u8981");
203
+ lines.push("");
204
+ lines.push("| \u5B57\u6BB5 | \u503C |");
205
+ lines.push("| --- | --- |");
206
+ lines.push(`| runId | ${record.runId} |`);
207
+ lines.push(`| agent | ${agentDisplay} |`);
208
+ lines.push(`| status | ${record.status} |`);
209
+ lines.push(`| exitCode | ${exitCodeStr} |`);
210
+ lines.push(`| \u8017\u65F6 | ${duration} |`);
211
+ lines.push(`| activity | ${activityStr} |`);
212
+ lines.push(`| dialogId | ${dialogIdStr} |`);
213
+ lines.push("");
214
+ let dodResults;
215
+ if (record.dodCommands && record.dodCommands.length > 0) {
216
+ dodResults = [];
217
+ lines.push("## DoD \u9A8C\u6536\u7ED3\u679C");
218
+ lines.push("");
219
+ lines.push("| \u547D\u4EE4 | exit code | stdout (\u5C3E\u90E8 20 \u884C) | stderr (\u5C3E\u90E8 10 \u884C) |");
220
+ lines.push("| --- | --- | --- | --- |");
221
+ for (const cmd of record.dodCommands) {
222
+ const result = executeDoDCommand(cmd, record.cwd, deps);
223
+ dodResults.push(result);
224
+ const codeStr = typeof result.exitCode === "number" ? String(result.exitCode) : result.exitCode;
225
+ const stdoutCell = formatCodeBlockCell(result.stdoutTail);
226
+ const stderrCell = formatCodeBlockCell(result.stderrTail);
227
+ const cmdCell = `\`${cmd.replace(/\|/g, "\\|")}\``;
228
+ lines.push(`| ${cmdCell} | ${codeStr} | ${stdoutCell} | ${stderrCell} |`);
229
+ }
230
+ lines.push("");
231
+ }
232
+ lines.push("## Git \u6458\u8981");
233
+ lines.push("");
234
+ const gitSummary = collectGitSummary(record.cwd, record.spawnHead, deps);
235
+ if (!gitSummary.isGitRepo) {
236
+ lines.push("\u975E Git \u4ED3\u5E93\u6216 Git \u4E0D\u53EF\u7528");
237
+ } else if (gitSummary.error) {
238
+ lines.push(`Git \u7EDF\u8BA1\u5F02\u5E38: ${gitSummary.error}`);
239
+ } else {
240
+ lines.push(`- \u53D8\u66F4\u7EDF\u8BA1: ${gitSummary.modifiedCount ?? 0} modified / ${gitSummary.untrackedCount ?? 0} untracked`);
241
+ if (record.spawnHead) {
242
+ lines.push(`- \u65B0\u589E Commit (${record.spawnHead}..HEAD):`);
243
+ if (gitSummary.commits && gitSummary.commits.length > 0) {
244
+ for (const c of gitSummary.commits) {
245
+ lines.push(` - ${c}`);
246
+ }
247
+ } else {
248
+ lines.push(" - (\u65E0\u65B0 commit)");
249
+ }
250
+ } else {
251
+ lines.push("- \u65B0\u589E Commit: \u672A\u8BB0\u5F55 spawnHead");
252
+ }
253
+ }
254
+ lines.push("");
255
+ lines.push("---");
256
+ lines.push(`_\u751F\u6210\u65F6\u95F4: ${now.toISOString()}_`);
257
+ lines.push("");
258
+ const markdown = lines.join("\n");
259
+ const report = {
260
+ runId: record.runId,
261
+ agentKey: record.agentKey,
262
+ ...record.agentName ? { agentName: record.agentName } : {},
263
+ status: record.status,
264
+ ...typeof record.exitCode === "number" ? { exitCode: record.exitCode } : {},
265
+ startedAt: record.startedAt,
266
+ ...record.endedAt ? { endedAt: record.endedAt } : {},
267
+ duration,
268
+ activity: { fileEdits: edits, toolCalls: tools, llmCalls },
269
+ ...record.dialogId ? { dialogId: record.dialogId } : {},
270
+ ...dodResults ? { dodResults } : {},
271
+ gitSummary,
272
+ generatedAt: now.toISOString()
273
+ };
274
+ return { markdown, report };
275
+ }
276
+ async function generateRunReport(record, deps = {}) {
277
+ const fs = deps.fs ?? nodeFs;
278
+ const env = deps.env ?? process.env;
279
+ const homedir = deps.homedir ?? nodeHomedir;
280
+ const runsDir = resolveRunsDir(env, homedir);
281
+ const reportPath = resolveRunReportPath(record.runId, env, homedir);
282
+ const reportJsonPath = resolveRunReportJsonPath(record.runId, env, homedir);
283
+ const { markdown, report } = await buildRunReportData(record, deps);
284
+ try {
285
+ fs.mkdirSync(runsDir, { recursive: true });
286
+ fs.writeFileSync(reportPath, markdown, "utf8");
287
+ fs.writeFileSync(reportJsonPath, JSON.stringify(report, null, 2), "utf8");
288
+ } catch (err) {
289
+ console.warn(`[nolo] failed to write run report file to ${reportPath}:`, err);
290
+ }
291
+ return { reportPath, reportJsonPath, markdown, report };
292
+ }
293
+
294
+ export {
295
+ parseDoDResultsFromMarkdown,
296
+ generateRunReport
297
+ };
@@ -1,16 +1,125 @@
1
+ import {
2
+ findModelConfig,
3
+ getProviderByModelName
4
+ } from "./chunk-C6ELZQ7H.js";
1
5
  import {
2
6
  asOptionalFiniteNumber
3
7
  } from "./chunk-WWC7I6TA.js";
4
8
  import {
5
- asTrimmedString
6
- } from "./chunk-3EUW3WEO.js";
9
+ asTrimmedLowercaseString
10
+ } from "./chunk-QSJ3HFEF.js";
7
11
  import {
8
12
  isRecord
9
13
  } from "./chunk-KUG52IAP.js";
14
+ import {
15
+ asTrimmedString
16
+ } from "./chunk-3EUW3WEO.js";
10
17
  import {
11
18
  asOptionalTrimmedString
12
19
  } from "./chunk-G3SUCT4W.js";
13
20
 
21
+ // packages/ai/llm/agentCapabilities.ts
22
+ var ANTIGRAVITY_EFFORT_SUFFIXES = [
23
+ "-tiered",
24
+ "-extra-low",
25
+ "-low",
26
+ "-medium",
27
+ "-high"
28
+ ];
29
+ function stripEffortSuffix(model) {
30
+ for (const suffix of ANTIGRAVITY_EFFORT_SUFFIXES) {
31
+ if (model.endsWith(suffix) && model.length > suffix.length) {
32
+ return model.slice(0, -suffix.length);
33
+ }
34
+ }
35
+ return model;
36
+ }
37
+ function stripPreviewSuffix(model) {
38
+ const suffix = "-preview";
39
+ if (model.endsWith(suffix) && model.length > suffix.length) {
40
+ return model.slice(0, -suffix.length);
41
+ }
42
+ return model;
43
+ }
44
+ var lookupKnownModelVision = (provider, model) => {
45
+ if (!model) return void 0;
46
+ const candidates = [model];
47
+ const strippedEffort = stripEffortSuffix(model);
48
+ if (strippedEffort !== model) candidates.push(strippedEffort);
49
+ const strippedPreview = stripPreviewSuffix(model);
50
+ if (strippedPreview !== model) candidates.push(strippedPreview);
51
+ for (const candidate of candidates) {
52
+ if (provider && provider !== "custom") {
53
+ const direct = findModelConfig(provider, candidate);
54
+ if (direct && typeof direct.hasVision === "boolean") return direct.hasVision;
55
+ }
56
+ const detected = getProviderByModelName(candidate);
57
+ if (detected) {
58
+ const found = findModelConfig(detected, candidate)?.hasVision;
59
+ if (found !== void 0) return found;
60
+ }
61
+ if (candidate.includes("/")) {
62
+ const slash = candidate.indexOf("/");
63
+ const modelProvider = candidate.slice(0, slash).toLowerCase();
64
+ const modelName = candidate.slice(slash + 1);
65
+ const nested = findModelConfig(modelProvider, modelName);
66
+ if (nested && typeof nested.hasVision === "boolean") return nested.hasVision;
67
+ }
68
+ }
69
+ return void 0;
70
+ };
71
+ var resolveAgentImageInputSupport = (agent) => {
72
+ if (!agent) return true;
73
+ const provider = asTrimmedLowercaseString(agent.provider) || null;
74
+ const model = asOptionalTrimmedString(agent.model) ?? "";
75
+ const catalogHasVision = lookupKnownModelVision(
76
+ provider,
77
+ model
78
+ );
79
+ if (catalogHasVision !== void 0) {
80
+ return catalogHasVision;
81
+ }
82
+ if (typeof agent.hasVision === "boolean") {
83
+ return agent.hasVision;
84
+ }
85
+ return true;
86
+ };
87
+
88
+ // packages/ai/agent/imagePreprocessing.ts
89
+ function extractImageUrlsFromMessages(messages) {
90
+ const urls = [];
91
+ for (const msg of messages) {
92
+ if (!Array.isArray(msg.content)) continue;
93
+ for (const part of msg.content) {
94
+ if (part && typeof part === "object" && part.type === "image_url" && part.image_url && typeof part.image_url.url === "string" && part.image_url.url.trim()) {
95
+ urls.push(part.image_url.url);
96
+ }
97
+ }
98
+ }
99
+ return urls;
100
+ }
101
+ function hasImageInRuntimeMessages(messages) {
102
+ return extractImageUrlsFromMessages(messages).length > 0;
103
+ }
104
+ var IMAGE_OMITTED_PLACEHOLDER = "[Image content omitted: model does not support image input]";
105
+ function stripImagePartsFromContent(content) {
106
+ if (!Array.isArray(content)) return content;
107
+ const filtered = content.filter((part) => part?.type !== "image_url");
108
+ if (filtered.length === 0) return IMAGE_OMITTED_PLACEHOLDER;
109
+ return filtered;
110
+ }
111
+ function stripImagePartsFromMessages(messages) {
112
+ return messages.map((msg) => ({
113
+ ...msg,
114
+ content: stripImagePartsFromContent(msg.content)
115
+ }));
116
+ }
117
+ async function stripImagePartsForTextOnlyAgent(messages, agentConfig) {
118
+ const supportsVision = resolveAgentImageInputSupport(agentConfig);
119
+ const hasImages = hasImageInRuntimeMessages(messages);
120
+ return { messages: !supportsVision && hasImages ? stripImagePartsFromMessages(messages) : messages };
121
+ }
122
+
14
123
  // packages/agent-runtime/agentRecordConfig.ts
15
124
  function stringField(record, key) {
16
125
  const value = record[key];
@@ -97,6 +206,60 @@ function resolveAgentRuntimeConfigFromRecord(key, record) {
97
206
  };
98
207
  }
99
208
 
209
+ // packages/ai/agent/toolOutputPolicy.ts
210
+ var MAX_HISTORICAL_TOOL_CONTENT_CHARS = 1600;
211
+ var MAX_IN_TURN_TOOL_CONTENT_CHARS = 4e3;
212
+ var FRESH_TOOL_OUTPUT_MAX_CHARS = 32e3;
213
+ var DEFAULT_TOOL_OUTPUT_PROFILE = {
214
+ maxChars: MAX_IN_TURN_TOOL_CONTENT_CHARS,
215
+ headRatio: 0.5
216
+ };
217
+ var TOOL_OUTPUT_PROFILES = {
218
+ readFile: { maxChars: 4800, headRatio: 0.68, historicalMaxChars: 4800 },
219
+ read_file: { maxChars: 4800, headRatio: 0.68, historicalMaxChars: 4800 },
220
+ readWorkspaceFile: { maxChars: 4800, headRatio: 0.68, historicalMaxChars: 4800 },
221
+ globFiles: { maxChars: 2800, headRatio: 0.85 },
222
+ execShell: { maxChars: 4e3, headRatio: 0.35 },
223
+ runCommand: { maxChars: 4e3, headRatio: 0.35 },
224
+ launchProcess: { maxChars: 2800, headRatio: 0.35 },
225
+ editFile: { maxChars: 2800, headRatio: 0.62 },
226
+ writeFile: { maxChars: 2400, headRatio: 0.62 },
227
+ readPastedText: { maxChars: 4800, headRatio: 0.5, historicalMaxChars: 4800 }
228
+ };
229
+ function resolveToolOutputProfile(toolName) {
230
+ return (toolName ? TOOL_OUTPUT_PROFILES[toolName] : void 0) ?? DEFAULT_TOOL_OUTPUT_PROFILE;
231
+ }
232
+ function resolveHistoricalToolContentCap(toolName, historicalMaxChars) {
233
+ const profile = toolName ? TOOL_OUTPUT_PROFILES[toolName] : void 0;
234
+ return profile?.historicalMaxChars !== void 0 ? Math.max(historicalMaxChars, profile.historicalMaxChars) : historicalMaxChars;
235
+ }
236
+ function projectToolMessageContent(input) {
237
+ const { content, isFresh, toolName, historicalMaxChars } = input;
238
+ if (isFresh) {
239
+ if (content.length <= FRESH_TOOL_OUTPUT_MAX_CHARS) return content;
240
+ return clipToolText(
241
+ content,
242
+ FRESH_TOOL_OUTPUT_MAX_CHARS,
243
+ resolveToolOutputProfile(toolName).headRatio,
244
+ `
245
+ \u2026[\u622A\u65AD\uFF0C\u539F\u59CB\u957F\u5EA6 ${content.length} \u5B57\u7B26]`
246
+ );
247
+ }
248
+ const cap = resolveHistoricalToolContentCap(toolName, historicalMaxChars);
249
+ if (content.length <= cap) return content;
250
+ return content.slice(0, cap) + `
251
+ \u2026[\u622A\u65AD\uFF0C\u539F\u59CB\u957F\u5EA6 ${content.length} \u5B57\u7B26]`;
252
+ }
253
+ function clipToolText(content, maxChars, headRatio, marker = "\n\n[... tool output middle omitted; head/tail preserved ...]\n\n") {
254
+ const normalized = content.replace(/\r\n/g, "\n").trim();
255
+ if (normalized.length <= maxChars) return normalized;
256
+ if (maxChars <= marker.length + 2) return normalized.slice(0, maxChars);
257
+ const available = maxChars - marker.length;
258
+ const headChars = Math.max(1, Math.floor(available * headRatio));
259
+ const tailChars = Math.max(1, available - headChars);
260
+ return `${normalized.slice(0, headChars)}${marker}${normalized.slice(-tailChars)}`;
261
+ }
262
+
100
263
  // packages/agent-runtime/desktopRequestSnapshot.ts
101
264
  var DESKTOP_AGENT_CONFIG_SNAPSHOT_STRING_FIELDS = [
102
265
  "name",
@@ -376,6 +539,16 @@ function assertDesktopAgentRuntimeTurnBodyHasNoRawSecrets(body) {
376
539
  }
377
540
 
378
541
  export {
542
+ resolveAgentImageInputSupport,
543
+ hasImageInRuntimeMessages,
544
+ stripImagePartsFromMessages,
545
+ stripImagePartsForTextOnlyAgent,
546
+ MAX_HISTORICAL_TOOL_CONTENT_CHARS,
547
+ FRESH_TOOL_OUTPUT_MAX_CHARS,
548
+ resolveToolOutputProfile,
549
+ resolveHistoricalToolContentCap,
550
+ projectToolMessageContent,
551
+ clipToolText,
379
552
  resolveAgentRuntimeConfigFromRecord,
380
553
  buildDesktopAgentRuntimeAgentConfigSnapshot,
381
554
  buildDesktopAgentRuntimeDialogHistorySnapshot,