nolo-cli 0.16.0-alpha.12 → 0.16.0-alpha.14

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 (69) hide show
  1. package/{_executeModel-LGHYA5XS.js → _executeModel-UU2JO5OB.js} +16 -15
  2. package/{agentDeleteCommand-PBIUC4FT.js → agentDeleteCommand-L6JRXPYK.js} +10 -10
  3. package/{agentEmailCommands-KC2QCPQV.js → agentEmailCommands-FE3GY3T5.js} +19 -18
  4. package/{agentListCommands-N64PHBXM.js → agentListCommands-ZWSAIC4W.js} +11 -11
  5. package/{agentMachineCommands-P7S5WAVA.js → agentMachineCommands-VWQ2GZBY.js} +10 -10
  6. package/{agentRecordCommands-JKZR2TZJ.js → agentRecordCommands-PYVZMRZM.js} +19 -18
  7. package/{agentRunCommand-2ELKCBWR.js → agentRunCommand-3ADJ2J5U.js} +24 -20
  8. package/{agentRunControl-6ADXVYMR.js → agentRunControl-YVLQ4BW5.js} +24 -1
  9. package/{agentRuntimeLocal-T6YECTNF.js → agentRuntimeLocal-LXTR6SAU.js} +7 -7
  10. package/{agentSlice-NXLMDKR7.js → agentSlice-TI6ECUGN.js} +1 -1
  11. package/{appDeleteCommands-D6B6Z4ZQ.js → appDeleteCommands-QIS37SXE.js} +11 -11
  12. package/{appDeployCommands-YMO5FK4T.js → appDeployCommands-WBHB7T5B.js} +11 -11
  13. package/{appDeployStatusCommands-EO5DWWPQ.js → appDeployStatusCommands-A3OUV6GO.js} +11 -11
  14. package/{appGetCommands-6SMZ3URQ.js → appGetCommands-LCVYIH63.js} +11 -11
  15. package/{appListCommands-RZXSWR2G.js → appListCommands-PC7QOBUO.js} +11 -11
  16. package/{chunk-4LXOVZ4W.js → chunk-2OK7P5XF.js} +54 -13
  17. package/{chunk-MSA4JAOZ.js → chunk-2ZLEOGS5.js} +1 -1
  18. package/{chunk-KKY4B2Q2.js → chunk-4PWB7JRR.js} +4 -1
  19. package/{chunk-VHXXRWNL.js → chunk-5QJFYG2N.js} +15 -5
  20. package/{chunk-F3UOACU4.js → chunk-64IEIMN4.js} +1 -1
  21. package/{chunk-XEWUC53Z.js → chunk-6IGLIDDE.js} +21 -9
  22. package/{chunk-AS3ZQ3O2.js → chunk-7OBMZCRD.js} +1 -1
  23. package/{chunk-QLUFR47U.js → chunk-AL2V7U3E.js} +1 -1
  24. package/{chunk-22NGXGN3.js → chunk-BOBNE3XT.js} +2 -2
  25. package/{chunk-MYMMNKYL.js → chunk-E5CLOOG5.js} +153 -6
  26. package/{chunk-ZXQ52OY2.js → chunk-ECGTEOC2.js} +3 -3
  27. package/chunk-FKXFCYVO.js +221 -0
  28. package/{chunk-6KBBMW4D.js → chunk-FTNTMGXT.js} +1 -1
  29. package/{chunk-6CRACQXW.js → chunk-GFPESFS6.js} +2 -2
  30. package/{chunk-47QUPRHO.js → chunk-GM37ZF7R.js} +2 -2
  31. package/{chunk-A7O4KKLZ.js → chunk-HGDFFA6T.js} +2 -2
  32. package/{chunk-C4MMO7W4.js → chunk-NZBK3ZET.js} +1 -1
  33. package/{chunk-JTMNCCWF.js → chunk-OSIJVBXP.js} +2 -2
  34. package/{chunk-OVBVEXZ7.js → chunk-PFW2ZEON.js} +53 -1
  35. package/{chunk-BXXECNBU.js → chunk-Q6B6XJBG.js} +15 -6
  36. package/{chunk-GPELDE6I.js → chunk-SOW2GCA5.js} +1 -1
  37. package/{chunk-HSASSW4L.js → chunk-TUWPYUVR.js} +7 -7
  38. package/{chunk-EQTZPEID.js → chunk-U3DCTSPN.js} +31 -49
  39. package/{chunk-D4NCEGGR.js → chunk-URVWRKFU.js} +166 -242
  40. package/{chunk-WBA6SIBB.js → chunk-UUDRNDC7.js} +1 -1
  41. package/{chunk-2WXMU64E.js → chunk-W63ZTRQU.js} +3 -3
  42. package/{chunk-ZH62XNZE.js → chunk-W6OKITU6.js} +678 -39
  43. package/{chunk-PU4LXVAC.js → chunk-XG7CSGP3.js} +1 -1
  44. package/{chunk-XRSPI6CP.js → chunk-YZXEEGKV.js} +1 -1
  45. package/{chunk-RIF3XLXK.js → chunk-ZDDHKIWB.js} +8 -4
  46. package/{createAgentAutomationAction-RKWIMKHW.js → createAgentAutomationAction-N4ZB7VX2.js} +3 -3
  47. package/{createDialogAction-VN7MEBS3.js → createDialogAction-KF6HXCCZ.js} +4 -4
  48. package/{createPageAction-JBUWBHHC.js → createPageAction-FXWSJONZ.js} +3 -3
  49. package/{dialogCommands-DFY5HJ6M.js → dialogCommands-ULS6HV5V.js} +11 -11
  50. package/{dialogSlice-NNYBU35K.js → dialogSlice-K32QLYS7.js} +3 -3
  51. package/{docCreateCommands-5L76YTI2.js → docCreateCommands-RZTRTRU4.js} +10 -10
  52. package/{docDeleteCommands-3GASP3VR.js → docDeleteCommands-FU36A663.js} +11 -11
  53. package/{docReadCommands-ALA77AZM.js → docReadCommands-IX4JXD4X.js} +10 -10
  54. package/{docStore-DR22GGF3.js → docStore-L6HBNJ3R.js} +4 -4
  55. package/{docUpdateCommands-6AZGXE5M.js → docUpdateCommands-W4OCR55Z.js} +10 -10
  56. package/{handleSendMessageAction-FHITDM7H.js → handleSendMessageAction-MFKKZXV7.js} +3 -3
  57. package/index.js +45 -45
  58. package/{machineCommands-3B4IHHVK.js → machineCommands-4MFLZERH.js} +18 -17
  59. package/{machineWsRunDispatch-AXZ6OL3V.js → machineWsRunDispatch-AAHRNKIR.js} +18 -17
  60. package/package.json +1 -1
  61. package/{readlineWorkspace-DBZCXS7Y.js → readlineWorkspace-7OPITHTN.js} +38 -29
  62. package/{runAgentClientLoop-AB7PQ3TB.js → runAgentClientLoop-HRWV7KE2.js} +12 -11
  63. package/{setPrimaryDialogAgentAction-IIVDCY5C.js → setPrimaryDialogAgentAction-57GRIGX5.js} +16 -8
  64. package/{skillDiscovery-6M2BZUFN.js → skillDiscovery-KJWT7JBU.js} +3 -3
  65. package/{spaceCommands-AB2D7A2R.js → spaceCommands-GMMQTMHK.js} +10 -10
  66. package/{spaceSlice-TEJDCU6A.js → spaceSlice-V2P5TTQU.js} +3 -3
  67. package/{streamAgentChatTurn-NZ3HLAXS.js → streamAgentChatTurn-ZANOYOUR.js} +64 -43
  68. package/{tools-M4USUF3R.js → tools-YHZP6NXU.js} +8 -7
  69. package/{updateDialogTitleAction-SMPQVKWT.js → updateDialogTitleAction-IKTPGPPE.js} +3 -3
@@ -1,3 +1,6 @@
1
+ import {
2
+ isAgentRunTerminalStatus
3
+ } from "./chunk-FKXFCYVO.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,87 @@ 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
+ let filtered = records.filter((record) => {
196
+ if (batchId && record.batchId !== batchId) return false;
197
+ if (statusSet && !statusSet.has(record.status)) return false;
198
+ return true;
199
+ });
200
+ const total = filtered.length;
201
+ const limit = clampLimit(query.limit);
202
+ const offset = typeof query.offset === "number" && Number.isFinite(query.offset) && query.offset > 0 ? Math.floor(query.offset) : 0;
203
+ const sliced = filtered.slice(offset, offset + limit);
204
+ const hasMore = offset + sliced.length < total;
205
+ return { runs: sliced, total, hasMore };
206
+ }
207
+ var DEFAULT_GC_RETENTION_MS = 7 * 24 * 60 * 60 * 1e3;
208
+ function tryUnlinkFile(fs, path) {
209
+ if (typeof path !== "string" || path.length === 0) return true;
210
+ try {
211
+ if (fs.existsSync(path)) {
212
+ fs.unlinkSync(path);
213
+ }
214
+ return true;
215
+ } catch (error) {
216
+ const code = error.code;
217
+ return code === "ENOENT";
218
+ }
219
+ }
220
+ function gcRunRecords(deps = {}, options = {}) {
221
+ const fs = deps.fs ?? nodeFs;
222
+ const now = (deps.now ?? (() => /* @__PURE__ */ new Date()))();
223
+ const nowMs = now instanceof Date ? now.getTime() : Date.parse(String(now));
224
+ const retentionMs = typeof options.retentionMs === "number" && options.retentionMs >= 0 ? options.retentionMs : DEFAULT_GC_RETENTION_MS;
225
+ const records = listRunRecords(deps);
226
+ const sweptIds = [];
227
+ const failedIds = [];
228
+ for (const record of records) {
229
+ if (!isRunTerminalStatus(record.status)) continue;
230
+ const ts = record.reconciledAt ?? record.endedAt ?? record.startedAt;
231
+ const ageMs = nowMs - new Date(ts).getTime();
232
+ if (!Number.isFinite(ageMs) || ageMs < retentionMs) continue;
233
+ const jsonPath = resolveRunRecordPath(record.runId, deps.env, deps.homedir);
234
+ const logPath = resolveRunLogPath(record.runId, deps.env, deps.homedir);
235
+ const msgPath = record.msgFile ?? join(resolveRunsDir(deps.env, deps.homedir), `${record.runId}.msg.md`);
236
+ const logOk = tryUnlinkFile(fs, logPath);
237
+ const msgOk = tryUnlinkFile(fs, msgPath);
238
+ if (!logOk || !msgOk) {
239
+ failedIds.push(record.runId);
240
+ continue;
241
+ }
242
+ const jsonOk = tryUnlinkFile(fs, jsonPath);
243
+ if (jsonOk) {
244
+ sweptIds.push(record.runId);
245
+ } else {
246
+ failedIds.push(record.runId);
247
+ }
248
+ }
249
+ return { swept: sweptIds.length, sweptIds, failedIds };
250
+ }
152
251
  function stripBackgroundFlag(args) {
153
252
  const result = [];
154
253
  for (const arg of args) {
@@ -219,6 +318,7 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
219
318
  const generateRunId = deps.generateRunId ?? defaultGenerateRunId;
220
319
  const now = deps.now ?? (() => /* @__PURE__ */ new Date());
221
320
  const runId = generateRunId();
321
+ const batchId = input.batchId ?? (deps.generateBatchId ?? defaultGenerateBatchId)();
222
322
  const logPath = resolveRunLogPath(runId, env, homedir);
223
323
  const recordPath = resolveRunRecordPath(runId, env, homedir);
224
324
  const runsDir = resolveRunsDir(env, homedir);
@@ -237,7 +337,8 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
237
337
  startedAt: now().toISOString(),
238
338
  ...typeof input.timeoutMs === "number" ? { timeoutMs: input.timeoutMs } : {},
239
339
  status: "running",
240
- logPath
340
+ logPath,
341
+ batchId
241
342
  };
242
343
  fs.writeFileSync(recordPath, JSON.stringify(record, null, 2));
243
344
  const { execPath, childArgs } = buildAgentRunChildCommand({
@@ -261,9 +362,11 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
261
362
  proc.unref();
262
363
  if (typeof proc.pid === "number") {
263
364
  record.pid = proc.pid;
365
+ const processStartedAt = (deps.getProcessStartTime ?? defaultGetProcessStartTime)(proc.pid);
366
+ if (processStartedAt) record.processStartedAt = processStartedAt.toISOString();
264
367
  fs.writeFileSync(recordPath, JSON.stringify(record, null, 2));
265
368
  }
266
- return { runId, pid: proc.pid, logPath };
369
+ return { runId, pid: proc.pid, logPath, batchId };
267
370
  }
268
371
  function finalizeRunRecord(runId, update, deps = {}) {
269
372
  const record = readRunRecord(runId, deps);
@@ -285,16 +388,49 @@ function isPidGone(pid, deps = {}) {
285
388
  return code === "ESRCH";
286
389
  }
287
390
  }
391
+ function defaultGetProcessStartTime(pid) {
392
+ try {
393
+ const output = nodeExecFileSync("ps", ["-o", "lstart=", "-p", String(pid)], {
394
+ encoding: "utf8",
395
+ stdio: ["ignore", "pipe", "ignore"],
396
+ timeout: 1e3
397
+ }).trim();
398
+ if (!output) return null;
399
+ const d = new Date(output);
400
+ return isNaN(d.getTime()) ? null : d;
401
+ } catch {
402
+ return null;
403
+ }
404
+ }
405
+ var MAX_PROCESS_START_TIME_DIFF_MS = 3e4;
406
+ var MAX_PERSISTED_PROCESS_START_TIME_DIFF_MS = 1e3;
407
+ function isPidReused(pid, expectedStartedAt, deps = {}, maxDiffMs = MAX_PROCESS_START_TIME_DIFF_MS) {
408
+ const getStartTime = deps.getProcessStartTime ?? defaultGetProcessStartTime;
409
+ const procStartTime = getStartTime(pid);
410
+ if (!procStartTime) {
411
+ return false;
412
+ }
413
+ const recordTime = new Date(expectedStartedAt).getTime();
414
+ if (isNaN(recordTime)) return false;
415
+ const diffMs = Math.abs(procStartTime.getTime() - recordTime);
416
+ return diffMs > maxDiffMs;
417
+ }
288
418
  function checkStaleRun(runId, deps = {}) {
289
419
  const record = readRunRecord(runId, deps);
290
420
  if (!record) return null;
291
421
  if (record.status !== "running") return record;
292
422
  if (typeof record.pid !== "number") return record;
293
- if (!isPidGone(record.pid, deps)) return record;
423
+ const pidGone = isPidGone(record.pid, deps);
424
+ const expectedStartedAt = record.processStartedAt ?? record.startedAt;
425
+ const maxStartTimeDiffMs = record.processStartedAt ? MAX_PERSISTED_PROCESS_START_TIME_DIFF_MS : MAX_PROCESS_START_TIME_DIFF_MS;
426
+ const pidReused = !pidGone && isPidReused(record.pid, expectedStartedAt, deps, maxStartTimeDiffMs);
427
+ if (!pidGone && !pidReused) return record;
294
428
  const now = deps.now ?? (() => /* @__PURE__ */ new Date());
295
- record.status = "failed";
296
- record.note = "process gone: pid no longer exists";
429
+ record.status = "orphaned";
430
+ record.note = pidReused ? "orphaned: process gone (pid reused by another process)" : "orphaned: process gone without writing terminal status";
297
431
  record.endedAt = now().toISOString();
432
+ record.reconciledAt = now().toISOString();
433
+ record.pid = void 0;
298
434
  writeRunRecord(record, deps);
299
435
  return record;
300
436
  }
@@ -650,23 +786,34 @@ async function runAgentKillCommand(args, deps) {
650
786
  }
651
787
 
652
788
  export {
789
+ RUN_TERMINAL_STATUSES,
790
+ isRunTerminalStatus,
653
791
  resolveNoloHome,
654
792
  resolveRunsDir,
655
793
  resolveRunRecordPath,
656
794
  resolveRunLogPath,
657
795
  defaultGenerateRunId,
796
+ defaultGenerateBatchId,
658
797
  writeRunRecord,
659
798
  createRunActivityTracker,
660
799
  readRunRecord,
661
800
  listRunRecords,
662
801
  findRunRecordByPid,
663
802
  findRunRecord,
803
+ DEFAULT_LIST_LIMIT,
804
+ MAX_LIST_LIMIT,
805
+ queryRunRecords,
806
+ DEFAULT_GC_RETENTION_MS,
807
+ gcRunRecords,
664
808
  stripBackgroundFlag,
665
809
  absolutizeSkillArgs,
666
810
  rewriteMsgFileArg,
667
811
  spawnLocalBackgroundRun,
668
812
  finalizeRunRecord,
669
813
  isPidGone,
814
+ defaultGetProcessStartTime,
815
+ MAX_PROCESS_START_TIME_DIFF_MS,
816
+ isPidReused,
670
817
  checkStaleRun,
671
818
  runAgentPsCommand,
672
819
  runAgentStatusCommand,
@@ -300,7 +300,7 @@ var slice = createSliceWithThunks({
300
300
  const overrides = {};
301
301
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
302
302
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
303
- const { _executeModel } = await import("./_executeModel-LGHYA5XS.js");
303
+ const { _executeModel } = await import("./_executeModel-UU2JO5OB.js");
304
304
  return _executeModel(
305
305
  {
306
306
  isStreaming: args.isStreaming ?? false,
@@ -321,7 +321,7 @@ var slice = createSliceWithThunks({
321
321
  * - 循环直到无工具调用或触发其他运行时停止条件
322
322
  */
323
323
  runAgent: create.asyncThunk(async (args, thunkApi) => {
324
- const { runAgentClientLoop } = await import("./runAgentClientLoop-AB7PQ3TB.js");
324
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-HRWV7KE2.js");
325
325
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
326
326
  {
327
327
  agentKey: args.agentKey,
@@ -337,7 +337,7 @@ var slice = createSliceWithThunks({
337
337
  * 聊天轮次流式 Agent 调用
338
338
  */
339
339
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
340
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-NZ3HLAXS.js");
340
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-ZANOYOUR.js");
341
341
  return streamAgentChatTurnHandler(args, thunkApi);
342
342
  }),
343
343
  /**
@@ -0,0 +1,221 @@
1
+ // packages/ai/tools/agent/agentRunDisplayHelpers.ts
2
+ function getAgentRunStatusIcon(status) {
3
+ switch (status) {
4
+ case "running":
5
+ case "pending":
6
+ return "\u23F3";
7
+ case "done":
8
+ return "\u2713";
9
+ case "failed":
10
+ case "timeout":
11
+ return "\u2717";
12
+ case "killed":
13
+ case "cancelled":
14
+ case "cancelling":
15
+ return "\u{1F6D1}";
16
+ case "orphaned":
17
+ return "\u{1F47B}";
18
+ case "not_found":
19
+ default:
20
+ return "?";
21
+ }
22
+ }
23
+ var DEFAULT_LABELS = {
24
+ runStatus: "Run status",
25
+ runStarted: "Run started",
26
+ runStopped: "Run stopped",
27
+ runFinished: "Run finished",
28
+ logTail: "Log tail:",
29
+ runs: (count) => `Runs (${count})`
30
+ };
31
+ function resolveLabels(labels) {
32
+ return {
33
+ runStatus: labels?.runStatus ?? DEFAULT_LABELS.runStatus,
34
+ runStarted: labels?.runStarted ?? DEFAULT_LABELS.runStarted,
35
+ runStopped: labels?.runStopped ?? DEFAULT_LABELS.runStopped,
36
+ runFinished: labels?.runFinished ?? DEFAULT_LABELS.runFinished,
37
+ logTail: labels?.logTail ?? DEFAULT_LABELS.logTail,
38
+ runs: labels?.runs ?? DEFAULT_LABELS.runs
39
+ };
40
+ }
41
+ function shortRunId(runId) {
42
+ const trimmed = typeof runId === "string" ? runId.trim() : "";
43
+ if (!trimmed) return "";
44
+ const segments = trimmed.split("-").filter(Boolean);
45
+ let pick = segments[segments.length - 1] ?? trimmed;
46
+ if (pick.length < 4 && segments.length >= 2) pick = segments.slice(-2).join("-");
47
+ if (!pick) pick = trimmed;
48
+ return pick.length > 8 ? pick.slice(-8) : pick;
49
+ }
50
+ function clipText(text, max) {
51
+ const collapsed = text.replace(/\s+/g, " ").trim();
52
+ return collapsed.length > max ? `${collapsed.slice(0, max - 1)}\u2026` : collapsed;
53
+ }
54
+ function formatDuration(ms) {
55
+ const totalSec = Math.max(0, Math.floor(ms / 1e3));
56
+ if (totalSec < 60) return `${totalSec}s`;
57
+ const totalMin = Math.floor(totalSec / 60);
58
+ if (totalMin < 60) return `${totalMin}m${String(totalSec % 60).padStart(2, "0")}s`;
59
+ return `${Math.floor(totalMin / 60)}h${String(totalMin % 60).padStart(2, "0")}m`;
60
+ }
61
+ function formatRunAge(timing, now = Date.now()) {
62
+ const startedAt = timing?.startedAt;
63
+ if (typeof startedAt !== "number" || !Number.isFinite(startedAt) || startedAt <= 0) {
64
+ return "";
65
+ }
66
+ const end = typeof timing?.finishedAt === "number" && Number.isFinite(timing.finishedAt) && timing.finishedAt > 0 ? timing.finishedAt : now;
67
+ return formatDuration(end - startedAt);
68
+ }
69
+ function formatIdentityRow(agentName, runId) {
70
+ const parts = [];
71
+ if (!isAgentNameFallback(agentName)) parts.push(agentName);
72
+ const short = shortRunId(runId);
73
+ if (short) parts.push(`#${short}`);
74
+ return parts.join(" ");
75
+ }
76
+ function isAgentNameFallback(agentName) {
77
+ const trimmed = typeof agentName === "string" ? agentName.trim() : "";
78
+ return !trimmed || trimmed === "agent";
79
+ }
80
+ function resolveRunLabel(run) {
81
+ for (const candidate of [run.agentName, run.name, run.agentKey, run.runId]) {
82
+ if (typeof candidate === "string" && !isAgentNameFallback(candidate)) {
83
+ return candidate.trim();
84
+ }
85
+ }
86
+ return "agent";
87
+ }
88
+ function formatStartRunCard(agentName, status = "running", opts) {
89
+ const L = resolveLabels(opts?.labels);
90
+ const icon = getAgentRunStatusIcon(status);
91
+ const lines = [L.runStarted];
92
+ const identity = formatIdentityRow(agentName, opts?.runId);
93
+ if (identity) {
94
+ lines.push(` agent ${identity}`);
95
+ }
96
+ lines.push(` status ${icon} ${status}`);
97
+ const task = opts?.task?.trim();
98
+ if (task) {
99
+ lines.push(` task ${clipText(task, TASK_PREVIEW_MAX)}`);
100
+ }
101
+ return lines.join("\n");
102
+ }
103
+ var TASK_PREVIEW_MAX = 72;
104
+ var NOTE_PREVIEW_MAX = 72;
105
+ function formatProgressRow(toolCallCount, lastToolNames) {
106
+ const parts = [];
107
+ if (typeof toolCallCount === "number" && Number.isFinite(toolCallCount)) {
108
+ parts.push(`${toolCallCount} tools`);
109
+ }
110
+ if (lastToolNames && lastToolNames.length > 0) {
111
+ parts.push(lastToolNames.join(", "));
112
+ }
113
+ return parts.join(" \xB7 ");
114
+ }
115
+ function formatStatusRunCard(agentName, status = "running", opts) {
116
+ const L = resolveLabels(opts?.labels);
117
+ const icon = getAgentRunStatusIcon(status);
118
+ const age = formatRunAge(opts?.timing, opts?.now);
119
+ const lines = [L.runStatus, ` ${icon} ${status}${age ? ` ${age}` : ""}`];
120
+ const identity = formatIdentityRow(agentName, opts?.runId);
121
+ if (identity) {
122
+ lines.push(` agent ${identity}`);
123
+ }
124
+ const progress = formatProgressRow(opts?.toolCallCount, opts?.lastToolNames);
125
+ if (progress) {
126
+ lines.push(` tools ${progress}`);
127
+ }
128
+ const note = opts?.lastAssistantText?.trim();
129
+ if (note) {
130
+ lines.push(` note ${clipText(note, NOTE_PREVIEW_MAX)}`);
131
+ }
132
+ if (opts?.errorMessage?.trim()) {
133
+ lines.push(` error ${opts.errorMessage.trim()}`);
134
+ }
135
+ if (shouldShowLogTail(status, opts?.includeLogTail, opts?.logLines)) {
136
+ lines.push("", L.logTail, ...opts.logLines.map((l) => ` ${l}`));
137
+ }
138
+ return lines.join("\n");
139
+ }
140
+ function runShowsLogTail(status) {
141
+ return status === "failed" || status === "timeout";
142
+ }
143
+ function shouldShowLogTail(status, includeLogTail, logLines) {
144
+ if (includeLogTail === false) return false;
145
+ if (!logLines || logLines.length === 0) return false;
146
+ return runShowsLogTail(status);
147
+ }
148
+ function formatFinishedRunCard(agentName, status, opts) {
149
+ const L = resolveLabels(opts?.labels);
150
+ const icon = getAgentRunStatusIcon(status);
151
+ const age = formatRunAge(opts?.timing, opts?.now);
152
+ const summary = [status, age, formatProgressRow(opts?.toolCallCount, opts?.lastToolNames)].filter(Boolean).join(" \xB7 ");
153
+ const lines = [L.runFinished, ` ${icon} ${summary}`];
154
+ const identity = formatIdentityRow(agentName, opts?.runId);
155
+ if (identity) {
156
+ lines.push(` agent ${identity}`);
157
+ }
158
+ const note = opts?.lastAssistantText?.trim();
159
+ if (note) {
160
+ lines.push(` note ${clipText(note, NOTE_PREVIEW_MAX)}`);
161
+ }
162
+ if (opts?.errorMessage?.trim()) {
163
+ lines.push(` error ${opts.errorMessage.trim()}`);
164
+ }
165
+ if (shouldShowLogTail(status, opts?.includeLogTail, opts?.logLines)) {
166
+ lines.push("", L.logTail, ...opts.logLines.map((l) => ` ${l}`));
167
+ }
168
+ return lines.join("\n");
169
+ }
170
+ function formatStopRunCard(status = "killed", labels) {
171
+ const L = resolveLabels(labels);
172
+ const icon = getAgentRunStatusIcon(status);
173
+ return `${L.runStopped}
174
+ ${icon} ${status}`;
175
+ }
176
+ function formatListRunsCard(runs, labels) {
177
+ const L = resolveLabels(labels);
178
+ const lines = [L.runs(runs.length)];
179
+ for (const run of runs) {
180
+ const status = run.status ?? "\u2014";
181
+ const icon = getAgentRunStatusIcon(status);
182
+ lines.push(` ${icon} ${resolveRunLabel(run)}`);
183
+ }
184
+ return lines.join("\n");
185
+ }
186
+ function formatNotFoundRunCard(labels) {
187
+ const L = resolveLabels(labels);
188
+ return `${L.runStatus}
189
+ ? not_found`;
190
+ }
191
+ var AGENT_RUN_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
192
+ "done",
193
+ "failed",
194
+ "timeout",
195
+ "killed",
196
+ "cancelled",
197
+ // orphaned: pid gone but the run record was still "running" — the process
198
+ // died (killed/OOM/crashed) before writing its own terminal status. Treated
199
+ // as terminal by all display/filter/GC consumers.
200
+ "orphaned"
201
+ ]);
202
+ function isAgentRunTerminalStatus(status) {
203
+ return typeof status === "string" && AGENT_RUN_TERMINAL_STATUSES.has(status);
204
+ }
205
+
206
+ export {
207
+ getAgentRunStatusIcon,
208
+ shortRunId,
209
+ formatRunAge,
210
+ isAgentNameFallback,
211
+ resolveRunLabel,
212
+ formatStartRunCard,
213
+ TASK_PREVIEW_MAX,
214
+ formatStatusRunCard,
215
+ runShowsLogTail,
216
+ formatFinishedRunCard,
217
+ formatStopRunCard,
218
+ formatListRunsCard,
219
+ formatNotFoundRunCard,
220
+ isAgentRunTerminalStatus
221
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readDbRecord,
3
3
  writeAgentRecord
4
- } from "./chunk-C4MMO7W4.js";
4
+ } from "./chunk-NZBK3ZET.js";
5
5
  import {
6
6
  buildSkillSummaryMarker
7
7
  } from "./chunk-VF4K2QE6.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  updateContentTitle
3
- } from "./chunk-4LXOVZ4W.js";
3
+ } from "./chunk-2OK7P5XF.js";
4
4
  import {
5
5
  require_date_fns
6
6
  } from "./chunk-M76ECQRD.js";
@@ -367,7 +367,7 @@ async function saveDocState(arg, { dispatch, getState }) {
367
367
  }
368
368
  }
369
369
  async function createDocState(args, thunkApi) {
370
- const { createPageAction } = await import("./createPageAction-JBUWBHHC.js");
370
+ const { createPageAction } = await import("./createPageAction-FXWSJONZ.js");
371
371
  return createPageAction(args, thunkApi);
372
372
  }
373
373
  function subscribe(listener) {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  i18n_default,
3
3
  toolRegistry
4
- } from "./chunk-D4NCEGGR.js";
4
+ } from "./chunk-URVWRKFU.js";
5
5
  import {
6
6
  canonicalizeToolNames
7
- } from "./chunk-JTMNCCWF.js";
7
+ } from "./chunk-OSIJVBXP.js";
8
8
  import {
9
9
  isNoloHostedProvider
10
10
  } from "./chunk-O6W2O2DA.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-MSA4JAOZ.js";
4
+ } from "./chunk-2ZLEOGS5.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-C4MMO7W4.js";
7
+ } from "./chunk-NZBK3ZET.js";
8
8
  import {
9
9
  toSafeAgentSummary
10
10
  } from "./chunk-XJITGCTM.js";
@@ -2,7 +2,7 @@ import {
2
2
  buildLocalAgentLookupKeys,
3
3
  normalizeAgentHandle,
4
4
  shouldReadAgentKeyRemotely
5
- } from "./chunk-PU4LXVAC.js";
5
+ } from "./chunk-XG7CSGP3.js";
6
6
  import {
7
7
  resolveCliAgentKeyInput
8
8
  } from "./chunk-VHBWHNVT.js";
@@ -892,7 +892,7 @@ function buildLoadSkillExecutor(args) {
892
892
  metadata: { loadSkill: true, resolved: false }
893
893
  };
894
894
  }
895
- const { resolveSkillByName } = await import("./skillDiscovery-6M2BZUFN.js");
895
+ const { resolveSkillByName } = await import("./skillDiscovery-KJWT7JBU.js");
896
896
  const resolved = resolveSkillByName(args.cwd, name);
897
897
  if (!resolved) {
898
898
  return {
@@ -919,7 +919,7 @@ ${body}`,
919
919
  };
920
920
  }
921
921
  async function formatUnknownSkillMessage(cwd, requestedName) {
922
- const { discoverSkills } = await import("./skillDiscovery-6M2BZUFN.js");
922
+ const { discoverSkills } = await import("./skillDiscovery-KJWT7JBU.js");
923
923
  let available = [];
924
924
  try {
925
925
  available = discoverSkills(cwd).map((s) => s.name);
@@ -10,6 +10,10 @@ import {
10
10
  import {
11
11
  upload
12
12
  } from "./chunk-3S2VOMIF.js";
13
+ import {
14
+ PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
15
+ PUBLIC_KIMI_K26_IMAGE_AGENT_KEY
16
+ } from "./chunk-XPC5C7BK.js";
13
17
  import {
14
18
  getRuntimeServerContext
15
19
  } from "./chunk-DVRHHFEA.js";
@@ -539,6 +543,51 @@ function planCompression(input) {
539
543
  };
540
544
  }
541
545
 
546
+ // packages/agent-runtime/autoExecutionProfiles.ts
547
+ var AUTO_ASSISTANT_MEMORY_SUBJECT_ID = "builtin:auto";
548
+ var createProfile = (input) => ({
549
+ id: input.id,
550
+ tier: input.tier,
551
+ legacyAgentKey: input.legacyAgentKey,
552
+ key: input.legacyAgentKey,
553
+ name: input.name,
554
+ provider: "nolo",
555
+ model: input.model,
556
+ apiSource: "platform",
557
+ useServerProxy: true,
558
+ rawRecord: {
559
+ dbKey: input.legacyAgentKey,
560
+ isPublic: true,
561
+ provider: "nolo",
562
+ model: input.model,
563
+ apiSource: "platform",
564
+ useServerProxy: true
565
+ }
566
+ });
567
+ var FLASH_PROFILE = createProfile({
568
+ id: "builtin:auto:deepseek-v4-flash",
569
+ tier: "flash",
570
+ legacyAgentKey: PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
571
+ name: "DeepSeek V4 Flash",
572
+ model: "deepseek-v4-flash"
573
+ });
574
+ var IMAGE_PROFILE = createProfile({
575
+ id: "builtin:auto:kimi-k2.6",
576
+ tier: "image",
577
+ legacyAgentKey: PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
578
+ name: "Kimi K2.6",
579
+ model: "kimi-k2.6"
580
+ });
581
+ var AUTO_EXECUTION_PROFILES = {
582
+ flash: FLASH_PROFILE,
583
+ balanced: { ...FLASH_PROFILE, tier: "balanced" },
584
+ quality: { ...FLASH_PROFILE, tier: "quality" },
585
+ image: IMAGE_PROFILE
586
+ };
587
+ var DEFAULT_AUTO_EXECUTION_TIER = "flash";
588
+ var DEFAULT_AUTO_EXECUTION_PROFILE = AUTO_EXECUTION_PROFILES[DEFAULT_AUTO_EXECUTION_TIER];
589
+ var resolveAutoExecutionProfile = (tier) => AUTO_EXECUTION_PROFILES[tier ?? DEFAULT_AUTO_EXECUTION_TIER] ?? DEFAULT_AUTO_EXECUTION_PROFILE;
590
+
542
591
  export {
543
592
  planContextUsage,
544
593
  estimateTokenCount,
@@ -548,5 +597,8 @@ export {
548
597
  buildDatabaseFileContentUrl,
549
598
  serializeMessageContent,
550
599
  normalizeAssistantContentBuffer,
551
- planCompression
600
+ planCompression,
601
+ AUTO_ASSISTANT_MEMORY_SUBJECT_ID,
602
+ DEFAULT_AUTO_EXECUTION_PROFILE,
603
+ resolveAutoExecutionProfile
552
604
  };