nolo-cli 0.16.0-alpha.2 → 0.16.0-alpha.21

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 (136) hide show
  1. package/{_executeModel-QAUS6B7J.js → _executeModel-GRCQXT5R.js} +51 -45
  2. package/{action-GUOZYYGN.js → action-LT7BRFLK.js} +10 -9
  3. package/{addContentAction-QDGHGUBH.js → addContentAction-PL3KKBDH.js} +9 -8
  4. package/{addDialogAgentAction-Z4YCYZIV.js → addDialogAgentAction-FCMSKYAF.js} +8 -7
  5. package/{agentDeleteCommand-365DMKHW.js → agentDeleteCommand-WNL3CNQX.js} +32 -29
  6. package/{agentEmailCommands-TQMXL36I.js → agentEmailCommands-MPEUMRAS.js} +63 -57
  7. package/{agentListCommands-6B5X4RC6.js → agentListCommands-YO4AOQMS.js} +31 -28
  8. package/{agentMachineCommands-LOEARB6V.js → agentMachineCommands-WYM6YRYJ.js} +30 -27
  9. package/{agentPullCommand-6HWUT3SW.js → agentPullCommand-ZZGU5KOY.js} +4 -4
  10. package/agentRecordCommands-BVWSHMIY.js +105 -0
  11. package/{agentRunCommand-SGMH67WT.js → agentRunCommand-E3ZI6RSF.js} +64 -55
  12. package/{agentRunControl-6ADXVYMR.js → agentRunControl-Y5AFH5PQ.js} +24 -1
  13. package/{agentRuntimeLocal-YSYZ33ER.js → agentRuntimeLocal-P4VGX6H6.js} +26 -25
  14. package/{agentSlice-IVE735EV.js → agentSlice-D33GU3JL.js} +9 -8
  15. package/{appDeleteCommands-6QYOO3JB.js → appDeleteCommands-VA4R2SWX.js} +29 -26
  16. package/{appDeployCommands-WTCT6XO6.js → appDeployCommands-JWMWQNG6.js} +29 -26
  17. package/{appDeployStatusCommands-CGWGZJKB.js → appDeployStatusCommands-KYXGLZSQ.js} +29 -26
  18. package/{appGetCommands-O4OCAMRW.js → appGetCommands-ELOO3JG6.js} +29 -26
  19. package/{appListCommands-UENFP4XY.js → appListCommands-SJUW4RLW.js} +29 -26
  20. package/{authCommand-YFTR3347.js → authCommand-WJZPOLSS.js} +16 -9
  21. package/{authCommands-YXGOXNBZ.js → authCommands-XTBV7OFZ.js} +6 -5
  22. package/{chunk-RKM3K52F.js → chunk-34WPV75U.js} +23 -2
  23. package/{chunk-VPTJB4HM.js → chunk-3ND52WIL.js} +2 -5
  24. package/{chunk-SOTZ6RDN.js → chunk-3Q7WHGCB.js} +1 -1
  25. package/{chunk-KKY4B2Q2.js → chunk-4PWB7JRR.js} +4 -1
  26. package/{chunk-U7LEGLEB.js → chunk-4T5F7YZQ.js} +1 -1
  27. package/{chunk-OQMPU2ML.js → chunk-5PGGCJGV.js} +6 -6
  28. package/chunk-7BUYEZ6U.js +671 -0
  29. package/{chunk-AS3ZQ3O2.js → chunk-7OBMZCRD.js} +1 -1
  30. package/{chunk-WA6KZL5V.js → chunk-AAODAAUQ.js} +23 -20
  31. package/{chunk-GRTFNYLR.js → chunk-AKVLLMOU.js} +3 -3
  32. package/{chunk-QLUFR47U.js → chunk-AL2V7U3E.js} +1 -1
  33. package/{chunk-MTU75CZ2.js → chunk-B5TOXZAK.js} +1 -1
  34. package/{chunk-QZVGMD5F.js → chunk-BE2GNT5E.js} +2 -8
  35. package/{chunk-JKWWVF2I.js → chunk-D3HVJJIA.js} +1 -1
  36. package/{chunk-B4KT7RN2.js → chunk-DKZFOK24.js} +18 -89
  37. package/chunk-DL6EPNIK.js +50 -0
  38. package/{chunk-YYIRR6QC.js → chunk-E5KQTMMJ.js} +212 -250
  39. package/{chunk-4QQFLN5C.js → chunk-EGPCU42M.js} +58 -8
  40. package/{chunk-XVP3C2KY.js → chunk-ELT65PZW.js} +2 -2
  41. package/{chunk-EMXI3N3Z.js → chunk-ENP2ELIL.js} +5 -5
  42. package/{chunk-6565R2TI.js → chunk-EXAEHRLI.js} +112 -191
  43. package/chunk-FQZZLA3C.js +223 -0
  44. package/{chunk-WPN6RMDF.js → chunk-GMZZ5EKJ.js} +3 -3
  45. package/{chunk-RSYUDGGZ.js → chunk-HQNPCMWL.js} +3 -3
  46. package/{chunk-OGGHETUE.js → chunk-HQPG2PIV.js} +62 -19
  47. package/{chunk-4NLUNENX.js → chunk-IQZ6TGVW.js} +10 -3
  48. package/{chunk-VE6XMVKG.js → chunk-J67FKTTY.js} +330 -213
  49. package/{chunk-G2MKOQCB.js → chunk-JFE7XW4D.js} +1 -1
  50. package/{setDialogExtraReferencesAction-2VLGWQKG.js → chunk-JLA4FXYC.js} +2 -17
  51. package/{chunk-OOIN7HSO.js → chunk-JP7REMYP.js} +19 -1
  52. package/chunk-KFEVY3ST.js +255 -0
  53. package/{chunk-I66RU7P7.js → chunk-KKWJ5VPZ.js} +1 -1
  54. package/{chunk-WRN5EQT7.js → chunk-L2RRMXNJ.js} +13 -4
  55. package/{chunk-ISYE6GZB.js → chunk-L6NVTGI7.js} +1 -1
  56. package/{chunk-HRQCKQA5.js → chunk-MUCU6ATG.js} +8 -257
  57. package/{chunk-BFRVXJJJ.js → chunk-MUIT5AAM.js} +112 -27
  58. package/{chunk-WNLPAOIT.js → chunk-MVQ4TBSD.js} +1 -1
  59. package/{chunk-O53CP2QR.js → chunk-N2HYIBLH.js} +6 -6
  60. package/{chunk-524BDL33.js → chunk-O6W2O2DA.js} +1 -15
  61. package/{chunk-YC3DJILJ.js → chunk-PUSK7HXJ.js} +64 -22
  62. package/{chunk-OOSFSFMA.js → chunk-R5V5G73M.js} +2 -0
  63. package/{chunk-4IJYA27C.js → chunk-RG2U2MTJ.js} +1 -1
  64. package/{chunk-Z24FGIU2.js → chunk-RIDWN7AP.js} +34 -15
  65. package/{chunk-IKXL2HZ3.js → chunk-RK5NYQEL.js} +1 -1
  66. package/{chunk-QLFCNUVQ.js → chunk-RUTSBLDM.js} +1629 -261
  67. package/{chunk-TTGAVETO.js → chunk-RVOUXDFU.js} +5 -5
  68. package/{chunk-JTINRTBT.js → chunk-SKDNBYZK.js} +2 -2
  69. package/{chunk-KMQPSTMJ.js → chunk-TRT4I4UD.js} +2 -2
  70. package/{chunk-EHLHSX7R.js → chunk-UB4RYYNQ.js} +9 -2
  71. package/{chunk-N5424GSW.js → chunk-UGUW3FHG.js} +4 -4
  72. package/{chunk-YNHQIXX5.js → chunk-UIOYWBU7.js} +395 -326
  73. package/chunk-V5R4NZP2.js +78 -0
  74. package/{chunk-MYMMNKYL.js → chunk-VNAEBGDK.js} +156 -6
  75. package/{chunk-J55UHASN.js → chunk-VST53WEL.js} +1 -1
  76. package/{chunk-6MHDWKOT.js → chunk-VVKQFITN.js} +25 -12
  77. package/{chunk-W4NVOSFF.js → chunk-WFHXMLHZ.js} +1 -1
  78. package/{chunk-H33743XH.js → chunk-WJRJDX2W.js} +1 -1
  79. package/chunk-X4Q4UZEY.js +26 -0
  80. package/{chunk-E237VE6U.js → chunk-XFYDGBXL.js} +4 -4
  81. package/{chunk-JS33TCQ3.js → chunk-XHG22OEX.js} +4 -4
  82. package/{chunk-DVRHHFEA.js → chunk-XMLRJUU5.js} +1 -1
  83. package/{chunk-V2J635L5.js → chunk-XOIF2TNF.js} +2 -2
  84. package/{chunk-SFXYKGK2.js → chunk-XRZJGPFI.js} +7 -7
  85. package/chunk-ZHXJ6M7T.js +27 -0
  86. package/chunk-ZZ2MH7LE.js +84 -0
  87. package/{cliExecutor-K3F7DMRO.js → cliExecutor-DNE7TCC4.js} +2 -2
  88. package/codingSkills-36KN5NQT.js +48 -0
  89. package/{createAgentAutomationAction-TS6NNZ4X.js → createAgentAutomationAction-ONKZ46XE.js} +22 -21
  90. package/{createDialogAction-5HVQ33EX.js → createDialogAction-7QWJEBKU.js} +24 -23
  91. package/{createPageAction-4F3ZGQJD.js → createPageAction-PB3KXZIA.js} +28 -27
  92. package/{dbSlice-OP6UPXKA.js → dbSlice-CGSRFJN3.js} +8 -7
  93. package/{deleteFile-WPWVZE4B.js → deleteFile-WDZ3VM7B.js} +3 -3
  94. package/{dialogCommands-ZL6L24BS.js → dialogCommands-YZFU4Q26.js} +30 -27
  95. package/{dialogSlice-FAWUQDJW.js → dialogSlice-53B5ISGQ.js} +22 -21
  96. package/{docCreateCommands-LYROQTFH.js → docCreateCommands-LOUC5PFB.js} +28 -25
  97. package/{docDeleteCommands-6TWGTZNR.js → docDeleteCommands-HHPGT4BR.js} +29 -26
  98. package/{docReadCommands-PRULNF26.js → docReadCommands-YPSN4HEF.js} +28 -25
  99. package/{docStore-2UHVWLTV.js → docStore-LJXXRB5W.js} +23 -22
  100. package/{docUpdateCommands-NNYYWJBI.js → docUpdateCommands-CJCZO54M.js} +28 -25
  101. package/{fetchMessages-KTNM7QAR.js → fetchMessages-BMGVZVSE.js} +4 -3
  102. package/{getPricing-UGDJHI7M.js → getPricing-RYY6OBA4.js} +4 -4
  103. package/handleSendMessageAction-ICGX4QCM.js +402 -0
  104. package/index.js +68 -68
  105. package/{localDialogRead-2VRI24F4.js → localDialogRead-HQZPVIE3.js} +1 -1
  106. package/{localRuntimeDb-LGDF6FQP.js → localRuntimeDb-THJZGAOJ.js} +1 -1
  107. package/{machineCommands-JQPEQFSE.js → machineCommands-YLDZXK4D.js} +64 -58
  108. package/{machineWsRunDispatch-FFFNWVEW.js → machineWsRunDispatch-LTQL3DRE.js} +56 -50
  109. package/{models-LSCRJJ6P.js → models-5K5G2CZI.js} +2 -2
  110. package/package.json +1 -1
  111. package/queryRunOverlay-O4LOMMPO.js +161 -0
  112. package/{read-HXHAZBKH.js → read-3FMPZPER.js} +3 -3
  113. package/{readDocTool-VPBDTO4G.js → readDocTool-VSYHKK3V.js} +1 -1
  114. package/{readlineWorkspace-QSXHSBHA.js → readlineWorkspace-OSPVWNAT.js} +699 -168
  115. package/{removeDialogAgentAction-HUFVN35S.js → removeDialogAgentAction-OAGA2G3U.js} +11 -10
  116. package/{runAgentClientLoop-A75BUU6D.js → runAgentClientLoop-76SUKKPX.js} +46 -40
  117. package/runOverlayPresentation-ZO4VCWEU.js +11 -0
  118. package/{runtimeDoctorCommands-THIHX2SY.js → runtimeDoctorCommands-E2OUORHK.js} +6 -6
  119. package/setDialogExtraReferencesAction-JZEXA5SL.js +27 -0
  120. package/{setPrimaryDialogAgentAction-VB4UV2CC.js → setPrimaryDialogAgentAction-4ZUQQKDG.js} +27 -18
  121. package/{settingSlice-7JYPQNAC.js → settingSlice-7MNKHZ6R.js} +9 -8
  122. package/{skillDiscovery-6M2BZUFN.js → skillDiscovery-KJWT7JBU.js} +3 -3
  123. package/{spaceCommands-4LE45GB7.js → spaceCommands-GIF7MKVD.js} +31 -28
  124. package/{spaceSlice-444MFUP6.js → spaceSlice-M4PVN5PO.js} +22 -21
  125. package/{streamAgentChatTurn-DJAE7USZ.js → streamAgentChatTurn-GCKTFSHQ.js} +96 -55
  126. package/{tableCommands-3P7MJ3PF.js → tableCommands-BEQAGE4I.js} +1 -1
  127. package/{tools-YB6LXSVN.js → tools-RJVFXOLR.js} +35 -30
  128. package/{tuiSummaryLlmCaller-QQL3JA5I.js → tuiSummaryLlmCaller-VUNVBRX3.js} +7 -6
  129. package/types-ZSTJ7MPR.js +7 -0
  130. package/{updateDialogTitleAction-6HGFBM64.js → updateDialogTitleAction-PSR67DLV.js} +25 -24
  131. package/agentRecordCommands-DCH2WBL2.js +0 -99
  132. package/chunk-BYXBJQAS.js +0 -0
  133. package/handleSendMessageAction-LJPUYNOH.js +0 -215
  134. package/{chunk-O4BU24WZ.js → chunk-6Y7A3OQQ.js} +3 -3
  135. package/{chunk-CMKUBIGW.js → chunk-X7W4TNB4.js} +3 -3
  136. package/{localRuntimeAuthority-TEGCOWX4.js → localRuntimeAuthority-4IXJCHZ7.js} +3 -3
@@ -0,0 +1,78 @@
1
+ // packages/core/chat/runOverlayPresentation.ts
2
+ var STATUS_ORDER = [
3
+ "running",
4
+ "reviewing",
5
+ "testing",
6
+ "done",
7
+ "failed",
8
+ "cancelled",
9
+ "orphaned"
10
+ ];
11
+ var STATUS_DISPLAY = {
12
+ running: { icon: "\u25B6", label: "\u6B63\u5728\u8FD0\u884C" },
13
+ reviewing: { icon: "\u{1F441}", label: "\u5F85 review" },
14
+ testing: { icon: "\u{1F9EA}", label: "\u5728\u6D4B\u8BD5" },
15
+ done: { icon: "\u2705", label: "\u5DF2\u5B8C\u6210" },
16
+ failed: { icon: "\u274C", label: "\u5931\u8D25" },
17
+ cancelled: { icon: "\u23F9", label: "\u5DF2\u53D6\u6D88" },
18
+ orphaned: { icon: "\u{1F47B}", label: "\u5B64\u513F" }
19
+ };
20
+ function statusLabel(status) {
21
+ return STATUS_DISPLAY[status]?.label ?? status;
22
+ }
23
+ function groupByStatus(runs) {
24
+ const buckets = /* @__PURE__ */ new Map();
25
+ for (const run of runs.values()) {
26
+ const arr = buckets.get(run.status);
27
+ if (arr) arr.push(run);
28
+ else buckets.set(run.status, [run]);
29
+ }
30
+ const grouped = [];
31
+ for (const status of STATUS_ORDER) {
32
+ const arr = buckets.get(status);
33
+ if (arr && arr.length > 0) grouped.push({ status, runs: arr });
34
+ }
35
+ return grouped;
36
+ }
37
+ function buildOverlayPresentation(state) {
38
+ if (state.runs.size === 0) return null;
39
+ const grouped = groupByStatus(state.runs);
40
+ const lines = [];
41
+ for (const { status, runs } of grouped) {
42
+ const { icon, label } = STATUS_DISPLAY[status];
43
+ lines.push(`${icon} ${runs.length} \u4E2A${label}`);
44
+ }
45
+ lines.push("");
46
+ lines.push("--- \u8BE6\u60C5 ---");
47
+ for (const { runs } of grouped) {
48
+ for (const run of runs) {
49
+ lines.push(detailLine(run));
50
+ }
51
+ }
52
+ return lines.join("\n");
53
+ }
54
+ function detailLine(run) {
55
+ const short = shortStatusLabel(run.status);
56
+ let suffix = short;
57
+ if (run.summary) suffix += ` \u2014 ${run.summary}`;
58
+ else if (run.status === "failed" && run.errorMessage) suffix += ` \u2014 ${run.errorMessage}`;
59
+ return `\u2022 ${run.runId} (${run.name}): ${suffix}`;
60
+ }
61
+ var SHORT_STATUS_LABEL = {
62
+ running: "\u8FD0\u884C\u4E2D",
63
+ reviewing: "\u5F85 review",
64
+ testing: "\u6D4B\u8BD5\u4E2D",
65
+ done: "\u5DF2\u5B8C\u6210",
66
+ failed: "\u5931\u8D25",
67
+ cancelled: "\u5DF2\u53D6\u6D88",
68
+ orphaned: "\u5B64\u513F"
69
+ };
70
+ function shortStatusLabel(status) {
71
+ return SHORT_STATUS_LABEL[status];
72
+ }
73
+
74
+ export {
75
+ statusLabel,
76
+ groupByStatus,
77
+ buildOverlayPresentation
78
+ };
@@ -1,3 +1,6 @@
1
+ import {
2
+ isAgentRunTerminalStatus
3
+ } from "./chunk-FQZZLA3C.js";
1
4
  import {
2
5
  isCompiledBinary,
3
6
  resolveCliEntrypointPath
@@ -7,7 +10,17 @@ import {
7
10
  import { homedir as nodeHomedir } from "node:os";
8
11
  import { isAbsolute, join, resolve } from "node:path";
9
12
  import * as nodeFs from "node:fs";
10
- import { spawn as nodeSpawn } from "node:child_process";
13
+ import { execFileSync as nodeExecFileSync, spawn as nodeSpawn } from "node:child_process";
14
+ var RUN_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
15
+ "done",
16
+ "failed",
17
+ "timeout",
18
+ "killed",
19
+ "orphaned"
20
+ ]);
21
+ function isRunTerminalStatus(status) {
22
+ return isAgentRunTerminalStatus(status);
23
+ }
11
24
  function resolveNoloHome(env, homedir = nodeHomedir) {
12
25
  const fromEnv = env?.NOLO_HOME;
13
26
  if (typeof fromEnv === "string" && fromEnv.length > 0) return fromEnv;
@@ -27,6 +40,11 @@ function defaultGenerateRunId() {
27
40
  const random = Math.random().toString(36).slice(2, 8);
28
41
  return `run-${timestamp}-${random}`;
29
42
  }
43
+ function defaultGenerateBatchId() {
44
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
45
+ const random = Math.random().toString(36).slice(2, 8);
46
+ return `batch-${timestamp}-${random}`;
47
+ }
30
48
  function writeRunRecord(record, deps = {}) {
31
49
  const fs = deps.fs ?? nodeFs;
32
50
  const path = resolveRunRecordPath(record.runId, deps.env, deps.homedir);
@@ -149,6 +167,89 @@ function findRunRecord(target, deps = {}) {
149
167
  }
150
168
  return readRunRecord(target, deps) ?? void 0;
151
169
  }
170
+ var DEFAULT_LIST_LIMIT = 20;
171
+ var MAX_LIST_LIMIT = 200;
172
+ function parseStatusFilter(status) {
173
+ if (typeof status !== "string" || status.trim() === "" || status === "all") {
174
+ return void 0;
175
+ }
176
+ const parts = status.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
177
+ return parts.length > 0 ? new Set(parts) : void 0;
178
+ }
179
+ function clampLimit(limit) {
180
+ if (typeof limit !== "number" || !Number.isFinite(limit) || limit <= 0) {
181
+ return DEFAULT_LIST_LIMIT;
182
+ }
183
+ const floored = Math.floor(limit);
184
+ if (floored > MAX_LIST_LIMIT) return MAX_LIST_LIMIT;
185
+ if (floored < 1) return 1;
186
+ return floored;
187
+ }
188
+ function queryRunRecords(query, deps = {}) {
189
+ let records = listRunRecords(deps);
190
+ records = records.map(
191
+ (record) => record.status === "running" ? checkStaleRun(record.runId, deps) ?? record : record
192
+ );
193
+ const statusSet = parseStatusFilter(query.status);
194
+ const batchId = typeof query.batchId === "string" && query.batchId.trim() !== "" ? query.batchId.trim() : void 0;
195
+ const parentDialogId = typeof query.parentDialogId === "string" && query.parentDialogId.trim() !== "" ? query.parentDialogId.trim() : void 0;
196
+ let filtered = records.filter((record) => {
197
+ if (batchId && record.batchId !== batchId) return false;
198
+ if (parentDialogId && record.parentDialogId !== parentDialogId) return false;
199
+ if (statusSet && !statusSet.has(record.status)) return false;
200
+ return true;
201
+ });
202
+ const total = filtered.length;
203
+ const limit = clampLimit(query.limit);
204
+ const offset = typeof query.offset === "number" && Number.isFinite(query.offset) && query.offset > 0 ? Math.floor(query.offset) : 0;
205
+ const sliced = filtered.slice(offset, offset + limit);
206
+ const hasMore = offset + sliced.length < total;
207
+ return { runs: sliced, total, hasMore };
208
+ }
209
+ var DEFAULT_GC_RETENTION_MS = 7 * 24 * 60 * 60 * 1e3;
210
+ function tryUnlinkFile(fs, path) {
211
+ if (typeof path !== "string" || path.length === 0) return true;
212
+ try {
213
+ if (fs.existsSync(path)) {
214
+ fs.unlinkSync(path);
215
+ }
216
+ return true;
217
+ } catch (error) {
218
+ const code = error.code;
219
+ return code === "ENOENT";
220
+ }
221
+ }
222
+ function gcRunRecords(deps = {}, options = {}) {
223
+ const fs = deps.fs ?? nodeFs;
224
+ const now = (deps.now ?? (() => /* @__PURE__ */ new Date()))();
225
+ const nowMs = now instanceof Date ? now.getTime() : Date.parse(String(now));
226
+ const retentionMs = typeof options.retentionMs === "number" && options.retentionMs >= 0 ? options.retentionMs : DEFAULT_GC_RETENTION_MS;
227
+ const records = listRunRecords(deps);
228
+ const sweptIds = [];
229
+ const failedIds = [];
230
+ for (const record of records) {
231
+ if (!isRunTerminalStatus(record.status)) continue;
232
+ const ts = record.reconciledAt ?? record.endedAt ?? record.startedAt;
233
+ const ageMs = nowMs - new Date(ts).getTime();
234
+ if (!Number.isFinite(ageMs) || ageMs < retentionMs) continue;
235
+ const jsonPath = resolveRunRecordPath(record.runId, deps.env, deps.homedir);
236
+ const logPath = resolveRunLogPath(record.runId, deps.env, deps.homedir);
237
+ const msgPath = record.msgFile ?? join(resolveRunsDir(deps.env, deps.homedir), `${record.runId}.msg.md`);
238
+ const logOk = tryUnlinkFile(fs, logPath);
239
+ const msgOk = tryUnlinkFile(fs, msgPath);
240
+ if (!logOk || !msgOk) {
241
+ failedIds.push(record.runId);
242
+ continue;
243
+ }
244
+ const jsonOk = tryUnlinkFile(fs, jsonPath);
245
+ if (jsonOk) {
246
+ sweptIds.push(record.runId);
247
+ } else {
248
+ failedIds.push(record.runId);
249
+ }
250
+ }
251
+ return { swept: sweptIds.length, sweptIds, failedIds };
252
+ }
152
253
  function stripBackgroundFlag(args) {
153
254
  const result = [];
154
255
  for (const arg of args) {
@@ -219,6 +320,7 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
219
320
  const generateRunId = deps.generateRunId ?? defaultGenerateRunId;
220
321
  const now = deps.now ?? (() => /* @__PURE__ */ new Date());
221
322
  const runId = generateRunId();
323
+ const batchId = input.batchId ?? (deps.generateBatchId ?? defaultGenerateBatchId)();
222
324
  const logPath = resolveRunLogPath(runId, env, homedir);
223
325
  const recordPath = resolveRunRecordPath(runId, env, homedir);
224
326
  const runsDir = resolveRunsDir(env, homedir);
@@ -237,7 +339,9 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
237
339
  startedAt: now().toISOString(),
238
340
  ...typeof input.timeoutMs === "number" ? { timeoutMs: input.timeoutMs } : {},
239
341
  status: "running",
240
- logPath
342
+ logPath,
343
+ batchId,
344
+ ...typeof input.parentDialogId === "string" && input.parentDialogId.trim() ? { parentDialogId: input.parentDialogId.trim() } : {}
241
345
  };
242
346
  fs.writeFileSync(recordPath, JSON.stringify(record, null, 2));
243
347
  const { execPath, childArgs } = buildAgentRunChildCommand({
@@ -261,9 +365,11 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
261
365
  proc.unref();
262
366
  if (typeof proc.pid === "number") {
263
367
  record.pid = proc.pid;
368
+ const processStartedAt = (deps.getProcessStartTime ?? defaultGetProcessStartTime)(proc.pid);
369
+ if (processStartedAt) record.processStartedAt = processStartedAt.toISOString();
264
370
  fs.writeFileSync(recordPath, JSON.stringify(record, null, 2));
265
371
  }
266
- return { runId, pid: proc.pid, logPath };
372
+ return { runId, pid: proc.pid, logPath, batchId };
267
373
  }
268
374
  function finalizeRunRecord(runId, update, deps = {}) {
269
375
  const record = readRunRecord(runId, deps);
@@ -285,16 +391,49 @@ function isPidGone(pid, deps = {}) {
285
391
  return code === "ESRCH";
286
392
  }
287
393
  }
394
+ function defaultGetProcessStartTime(pid) {
395
+ try {
396
+ const output = nodeExecFileSync("ps", ["-o", "lstart=", "-p", String(pid)], {
397
+ encoding: "utf8",
398
+ stdio: ["ignore", "pipe", "ignore"],
399
+ timeout: 1e3
400
+ }).trim();
401
+ if (!output) return null;
402
+ const d = new Date(output);
403
+ return isNaN(d.getTime()) ? null : d;
404
+ } catch {
405
+ return null;
406
+ }
407
+ }
408
+ var MAX_PROCESS_START_TIME_DIFF_MS = 3e4;
409
+ var MAX_PERSISTED_PROCESS_START_TIME_DIFF_MS = 1e3;
410
+ function isPidReused(pid, expectedStartedAt, deps = {}, maxDiffMs = MAX_PROCESS_START_TIME_DIFF_MS) {
411
+ const getStartTime = deps.getProcessStartTime ?? defaultGetProcessStartTime;
412
+ const procStartTime = getStartTime(pid);
413
+ if (!procStartTime) {
414
+ return false;
415
+ }
416
+ const recordTime = new Date(expectedStartedAt).getTime();
417
+ if (isNaN(recordTime)) return false;
418
+ const diffMs = Math.abs(procStartTime.getTime() - recordTime);
419
+ return diffMs > maxDiffMs;
420
+ }
288
421
  function checkStaleRun(runId, deps = {}) {
289
422
  const record = readRunRecord(runId, deps);
290
423
  if (!record) return null;
291
424
  if (record.status !== "running") return record;
292
425
  if (typeof record.pid !== "number") return record;
293
- if (!isPidGone(record.pid, deps)) return record;
426
+ const pidGone = isPidGone(record.pid, deps);
427
+ const expectedStartedAt = record.processStartedAt ?? record.startedAt;
428
+ const maxStartTimeDiffMs = record.processStartedAt ? MAX_PERSISTED_PROCESS_START_TIME_DIFF_MS : MAX_PROCESS_START_TIME_DIFF_MS;
429
+ const pidReused = !pidGone && isPidReused(record.pid, expectedStartedAt, deps, maxStartTimeDiffMs);
430
+ if (!pidGone && !pidReused) return record;
294
431
  const now = deps.now ?? (() => /* @__PURE__ */ new Date());
295
- record.status = "failed";
296
- record.note = "process gone: pid no longer exists";
432
+ record.status = "orphaned";
433
+ record.note = pidReused ? "orphaned: process gone (pid reused by another process)" : "orphaned: process gone without writing terminal status";
297
434
  record.endedAt = now().toISOString();
435
+ record.reconciledAt = now().toISOString();
436
+ record.pid = void 0;
298
437
  writeRunRecord(record, deps);
299
438
  return record;
300
439
  }
@@ -650,23 +789,34 @@ async function runAgentKillCommand(args, deps) {
650
789
  }
651
790
 
652
791
  export {
792
+ RUN_TERMINAL_STATUSES,
793
+ isRunTerminalStatus,
653
794
  resolveNoloHome,
654
795
  resolveRunsDir,
655
796
  resolveRunRecordPath,
656
797
  resolveRunLogPath,
657
798
  defaultGenerateRunId,
799
+ defaultGenerateBatchId,
658
800
  writeRunRecord,
659
801
  createRunActivityTracker,
660
802
  readRunRecord,
661
803
  listRunRecords,
662
804
  findRunRecordByPid,
663
805
  findRunRecord,
806
+ DEFAULT_LIST_LIMIT,
807
+ MAX_LIST_LIMIT,
808
+ queryRunRecords,
809
+ DEFAULT_GC_RETENTION_MS,
810
+ gcRunRecords,
664
811
  stripBackgroundFlag,
665
812
  absolutizeSkillArgs,
666
813
  rewriteMsgFileArg,
667
814
  spawnLocalBackgroundRun,
668
815
  finalizeRunRecord,
669
816
  isPidGone,
817
+ defaultGetProcessStartTime,
818
+ MAX_PROCESS_START_TIME_DIFF_MS,
819
+ isPidReused,
670
820
  checkStaleRun,
671
821
  runAgentPsCommand,
672
822
  runAgentStatusCommand,
@@ -2,7 +2,7 @@ import {
2
2
  deleteDbRecord,
3
3
  queryUserRecords,
4
4
  readDbRecord
5
- } from "./chunk-4NLUNENX.js";
5
+ } from "./chunk-IQZ6TGVW.js";
6
6
  import {
7
7
  mergeAndDedupUserData
8
8
  } from "./chunk-KQHGZWSV.js";
@@ -1,31 +1,32 @@
1
1
  import {
2
+ MENU_USAGE_INSTRUCTIONS,
2
3
  buildCurrentTimeBlock,
3
4
  buildIdentityBlock,
4
5
  buildRuntimeGuidanceBlocks
5
- } from "./chunk-RKM3K52F.js";
6
- import {
7
- canonicalizeToolNames
8
- } from "./chunk-B4KT7RN2.js";
6
+ } from "./chunk-34WPV75U.js";
9
7
  import {
10
8
  estimateTokenCount,
11
9
  getModelContextWindow,
12
10
  planCompression,
13
11
  planContextUsage,
14
12
  serializeMessageContent
15
- } from "./chunk-4QQFLN5C.js";
13
+ } from "./chunk-EGPCU42M.js";
16
14
  import {
17
15
  clipCompactText
18
16
  } from "./chunk-5MMAK75Q.js";
19
17
  import {
20
18
  findModelConfig,
21
19
  getProviderByModelName
22
- } from "./chunk-OGGHETUE.js";
23
- import {
24
- buildDialogSummaryLayer
25
- } from "./chunk-QLUFR47U.js";
20
+ } from "./chunk-HQPG2PIV.js";
26
21
  import {
27
22
  toErrorMessage
28
23
  } from "./chunk-HNMXYYJR.js";
24
+ import {
25
+ buildDialogSummaryLayer
26
+ } from "./chunk-AL2V7U3E.js";
27
+ import {
28
+ canonicalizeToolNames
29
+ } from "./chunk-ZZ2MH7LE.js";
29
30
  import {
30
31
  asRecordOrEmpty
31
32
  } from "./chunk-KX6YBIHG.js";
@@ -1034,7 +1035,11 @@ function buildMessages(args) {
1034
1035
  ${dynamicContent}` : stableContent;
1035
1036
  return {
1036
1037
  messages: [
1037
- ...systemContent2 ? [{ role: "system", content: systemContent2 }] : [],
1038
+ ...systemContent2 ? [{
1039
+ role: "system",
1040
+ content: systemContent2,
1041
+ ...stableContent ? { stable_prefix_chars: stableContent.length } : {}
1042
+ }] : [],
1038
1043
  ...prepareHistoryForNextTurn(args.history, args.contextReferenceResolver),
1039
1044
  { role: "user", content: args.input }
1040
1045
  ],
@@ -1147,7 +1152,9 @@ function applyPersistedTurnInput(messages, persistedInput, persistedInputReferen
1147
1152
  async function runLocalAgentTurn(input) {
1148
1153
  const agentConfig = await input.adapter.loadAgentConfig(input.agentRef);
1149
1154
  if (!agentConfig) {
1150
- const error = new Error(`Local agent config not found: ${input.agentRef}`);
1155
+ const error = new Error(
1156
+ `agentRef "${input.agentRef}" \u672A\u5339\u914D\u5230\u672C\u5730 agent\u3002\u8FD9\u4E0D\u662F\u914D\u7F6E\u7F3A\u5931\uFF0C\u8BF7\u7528 listAgents \u67E5\u770B\u53EF\u7528 agent\uFF0C\u518D\u7528 readAgent \u89E3\u6790 agentKey\uFF0C\u52FF\u624B\u5DE5\u62FC key\u3002`
1157
+ );
1151
1158
  error.code = LOCAL_AGENT_CONFIG_MISSING_CODE;
1152
1159
  error.agentRef = input.agentRef;
1153
1160
  throw error;
@@ -1176,11 +1183,13 @@ async function runLocalAgentTurn(input) {
1176
1183
  agentConfig.exposedToolNames ?? agentConfig.toolNames ?? []
1177
1184
  );
1178
1185
  const guidanceBlocks = buildRuntimeGuidanceBlocks(agentTools);
1186
+ const menuUsageBlock = agentTools.includes("ask_user") ? MENU_USAGE_INSTRUCTIONS : "";
1179
1187
  const guidanceScopes = [
1180
1188
  guidanceBlocks.startupProtocol,
1181
1189
  guidanceBlocks.contextLayerContract,
1182
1190
  guidanceBlocks.emailRegistrationWorkflow,
1183
- guidanceBlocks.webResearchToolPolicy
1191
+ guidanceBlocks.webResearchToolPolicy,
1192
+ menuUsageBlock
1184
1193
  ].map((content) => content.trim()).filter((content) => content.length > 0).map((content) => ({ content, cacheScope: "session" }));
1185
1194
  const currentTimeScope = [
1186
1195
  { content: buildCurrentTimeBlock(/* @__PURE__ */ new Date(), void 0), cacheScope: "turn" }
@@ -1370,7 +1379,11 @@ async function runLocalAgentTurn(input) {
1370
1379
  name: toolName,
1371
1380
  arguments: toolCall.function.arguments,
1372
1381
  ...userInputText ? { userInput: userInputText } : {},
1382
+ ...input.runtimeContext ? { runtimeContext: input.runtimeContext } : {},
1373
1383
  ...input.abortSignal ? { abortSignal: input.abortSignal } : {}
1384
+ }, {
1385
+ ...input.abortSignal ? { abortSignal: input.abortSignal } : {},
1386
+ ...input.runtimeContext ? { runtimeContext: input.runtimeContext } : {}
1374
1387
  });
1375
1388
  toolResult = await raceWithAbort(input, executePromise, toolName);
1376
1389
  const actionGate = buildActionGate({
@@ -4,7 +4,7 @@ import {
4
4
 
5
5
  // packages/cli/agentCommandSupport.ts
6
6
  async function getDefaultCliDb() {
7
- const { getDefaultCliLocalRuntimeDb } = await import("./localRuntimeDb-LGDF6FQP.js");
7
+ const { getDefaultCliLocalRuntimeDb } = await import("./localRuntimeDb-THJZGAOJ.js");
8
8
  return getDefaultCliLocalRuntimeDb();
9
9
  }
10
10
  function createNullCliDb() {
@@ -14,7 +14,7 @@ function buildCliLocalRuntimeDbEnv(env = process.env) {
14
14
  };
15
15
  }
16
16
  async function getDefaultCliLocalRuntimeDb(options = {}) {
17
- const { getDefaultCliLocalRuntimeDb: getAuthorityBackedDb } = await import("./localRuntimeAuthority-TEGCOWX4.js");
17
+ const { getDefaultCliLocalRuntimeDb: getAuthorityBackedDb } = await import("./localRuntimeAuthority-4IXJCHZ7.js");
18
18
  return getAuthorityBackedDb(options);
19
19
  }
20
20
 
@@ -0,0 +1,26 @@
1
+ // packages/create/types.ts
2
+ var DataType = /* @__PURE__ */ ((DataType2) => {
3
+ DataType2["AGENT"] = "agent";
4
+ DataType2["DOC"] = "page";
5
+ DataType2["DIALOG"] = "dialog";
6
+ DataType2["NOTIFICATION"] = "notification";
7
+ DataType2["MSG"] = "msg";
8
+ DataType2["TOKEN"] = "token";
9
+ DataType2["SPACE"] = "space";
10
+ DataType2["TRANSACTION"] = "transaction";
11
+ DataType2["SETTING"] = "setting";
12
+ DataType2["TASK"] = "task";
13
+ DataType2["AGENT_AUTOMATION"] = "agent-automation";
14
+ DataType2["TABLE"] = "table";
15
+ DataType2["TABLE_ROW"] = "table_row";
16
+ DataType2["FILE"] = "file";
17
+ DataType2["IMAGE"] = "image";
18
+ DataType2["APP"] = "app";
19
+ DataType2["EMAIL"] = "email";
20
+ DataType2["Category"] = "category";
21
+ return DataType2;
22
+ })(DataType || {});
23
+
24
+ export {
25
+ DataType
26
+ };
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  readDbRecord,
3
3
  writeAgentRecord
4
- } from "./chunk-4NLUNENX.js";
4
+ } from "./chunk-IQZ6TGVW.js";
5
5
  import {
6
6
  buildSkillSummaryMarker
7
7
  } from "./chunk-VF4K2QE6.js";
8
+ import {
9
+ createSpaceKey
10
+ } from "./chunk-ELT65PZW.js";
8
11
  import {
9
12
  parseUserIdFromAuthToken,
10
13
  readOption,
11
14
  resolveAuthToken,
12
15
  resolveServerUrl
13
16
  } from "./chunk-A7GB5UGH.js";
14
- import {
15
- createSpaceKey
16
- } from "./chunk-XVP3C2KY.js";
17
17
  import {
18
18
  asTrimmedLowercaseString
19
19
  } from "./chunk-QSJ3HFEF.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  selectCurrentServer
3
- } from "./chunk-TTGAVETO.js";
3
+ } from "./chunk-RVOUXDFU.js";
4
4
  import {
5
5
  patch
6
- } from "./chunk-SFXYKGK2.js";
6
+ } from "./chunk-XRZJGPFI.js";
7
7
  import {
8
8
  selectIdentityToken
9
- } from "./chunk-DVRHHFEA.js";
9
+ } from "./chunk-XMLRJUU5.js";
10
10
  import {
11
11
  getIsDesktopApp
12
- } from "./chunk-OOSFSFMA.js";
12
+ } from "./chunk-R5V5G73M.js";
13
13
 
14
14
  // packages/ai/agent/cliChatClient.ts
15
15
  function getCliChatRequestConfig(thunkApi) {
@@ -2,7 +2,7 @@ import {
2
2
  getAllServers,
3
3
  getIsDesktopApp,
4
4
  isAbortError
5
- } from "./chunk-OOSFSFMA.js";
5
+ } from "./chunk-R5V5G73M.js";
6
6
  import {
7
7
  asTrimmedString
8
8
  } from "./chunk-3EUW3WEO.js";
@@ -5,7 +5,7 @@ var BASE_BUILTIN_DIALOG_LLM_CONFIG = {
5
5
  };
6
6
  var BUILTIN_TITLE_LLM_CONFIG = {
7
7
  ...BASE_BUILTIN_DIALOG_LLM_CONFIG,
8
- provider: "deepseek",
8
+ provider: "nolo",
9
9
  id: "builtin-dialog-title-llm",
10
10
  name: "Builtin Dialog Title LLM",
11
11
  model: "deepseek-v4-flash",
@@ -13,7 +13,7 @@ var BUILTIN_TITLE_LLM_CONFIG = {
13
13
  };
14
14
  var BUILTIN_SUMMARY_LLM_CONFIG = {
15
15
  ...BASE_BUILTIN_DIALOG_LLM_CONFIG,
16
- provider: "deepseek",
16
+ provider: "nolo",
17
17
  id: "builtin-dialog-summary-llm",
18
18
  name: "Builtin Dialog Summary LLM",
19
19
  model: "deepseek-v4-flash",
@@ -2,17 +2,17 @@ import {
2
2
  fileKey,
3
3
  getFileIdFromKey,
4
4
  ulid
5
- } from "./chunk-O4BU24WZ.js";
5
+ } from "./chunk-6Y7A3OQQ.js";
6
6
  import {
7
7
  loadFileFromIndexedDb,
8
8
  removeAction,
9
9
  saveFileToIndexedDb
10
- } from "./chunk-JTINRTBT.js";
10
+ } from "./chunk-SKDNBYZK.js";
11
11
  import {
12
12
  readAction,
13
13
  readRequestManager,
14
14
  resolveAgentReadServers
15
- } from "./chunk-VPTJB4HM.js";
15
+ } from "./chunk-3ND52WIL.js";
16
16
  import {
17
17
  asyncThunkCreator,
18
18
  buildCreateSlice,
@@ -32,13 +32,13 @@ import {
32
32
  shouldReplaceLocalWithRemoteRecord,
33
33
  shouldReplicateLocalRecord,
34
34
  uploadToCurrentServer
35
- } from "./chunk-DVRHHFEA.js";
35
+ } from "./chunk-XMLRJUU5.js";
36
36
  import {
37
37
  fetchFromClientDb,
38
38
  fetchFromServer,
39
39
  logger,
40
40
  normalizeTimeFields
41
- } from "./chunk-OOSFSFMA.js";
41
+ } from "./chunk-R5V5G73M.js";
42
42
  import {
43
43
  isTombstoneRecord
44
44
  } from "./chunk-GBRG75BQ.js";
@@ -704,7 +704,7 @@ var dbSlice = createSliceWithThunks({
704
704
  // 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
705
705
  read: create.asyncThunk(
706
706
  async (payload, thunkApi) => {
707
- const { readAction: readAction2 } = await import("./read-HXHAZBKH.js");
707
+ const { readAction: readAction2 } = await import("./read-3FMPZPER.js");
708
708
  return readAction2(payload, thunkApi);
709
709
  },
710
710
  {
@@ -778,7 +778,7 @@ var dbSlice = createSliceWithThunks({
778
778
  // 这里改成动态 import,运行期才解析,彻底断开这条边。
779
779
  share: create.asyncThunk(
780
780
  async (config, thunkApi) => {
781
- const { shareResourceAction } = await import("./action-GUOZYYGN.js");
781
+ const { shareResourceAction } = await import("./action-LT7BRFLK.js");
782
782
  return shareResourceAction(config, thunkApi);
783
783
  }
784
784
  ),
@@ -0,0 +1,27 @@
1
+ // packages/ai/agent/cliProviders.ts
2
+ var CLI_PROVIDER_VALUES = [
3
+ "copilot",
4
+ "gemini",
5
+ "codex",
6
+ "claude",
7
+ "agy",
8
+ "qoder",
9
+ "opencode",
10
+ "grok",
11
+ "kimi"
12
+ ];
13
+ var CLI_PROVIDER_DISPLAY_LABELS = {
14
+ copilot: "GitHub Copilot CLI\uFF08gh copilot\uFF09",
15
+ gemini: "Gemini CLI\uFF08gemini\uFF09",
16
+ codex: "OpenAI Codex CLI\uFF08codex exec\uFF09",
17
+ claude: "Claude CLI\uFF08claude\uFF09",
18
+ agy: "Google Antigravity CLI\uFF08agy\uFF09",
19
+ qoder: "Qoder CLI\uFF08qoder\uFF09",
20
+ opencode: "OpenCode CLI\uFF08opencode\uFF09",
21
+ grok: "Grok CLI\uFF08grok\uFF09",
22
+ kimi: "Kimi Code CLI\uFF08kimi\uFF09"
23
+ };
24
+ var CLI_PROVIDER_OPTIONS = CLI_PROVIDER_VALUES.map((value) => ({
25
+ value,
26
+ label: CLI_PROVIDER_DISPLAY_LABELS[value]
27
+ }));