nolo-cli 0.75.0-alpha.7 → 0.76.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 (28) hide show
  1. package/{agentDeleteCommand-UAMLWTPS.js → agentDeleteCommand-2TYFURBN.js} +1 -1
  2. package/{agentEmailCommands-QRVMJZ4C.js → agentEmailCommands-HXIX4KJE.js} +3 -3
  3. package/{agentListCommands-63DOSBY7.js → agentListCommands-IFUOWXP3.js} +1 -1
  4. package/{agentMachineCommands-BLILYHBN.js → agentMachineCommands-NEJEQV5S.js} +2 -2
  5. package/{agentRecordCommands-4RQKVPNP.js → agentRecordCommands-USSLZKED.js} +3 -3
  6. package/{agentRunCommand-CDRQIDLW.js → agentRunCommand-WZZSCEEP.js} +3 -3
  7. package/{agentRuntimeLocal-XG3IDNOC.js → agentRuntimeLocal-PUZINLWJ.js} +1 -1
  8. package/{appDeleteCommands-TJXDMOYT.js → appDeleteCommands-U4NTEJYQ.js} +1 -1
  9. package/{appDeployCommands-ECZJQAAL.js → appDeployCommands-FXF45Q7F.js} +1 -1
  10. package/{appDeployStatusCommands-DZKVFG3Y.js → appDeployStatusCommands-KONVRM53.js} +1 -1
  11. package/{appGetCommands-JIT4OPUD.js → appGetCommands-3VOGIZ7T.js} +1 -1
  12. package/{appListCommands-NR2HRMDY.js → appListCommands-A6ROBW7P.js} +1 -1
  13. package/{chunk-Q2DNZQEZ.js → chunk-2R5EVB2O.js} +1 -1
  14. package/{chunk-RL5PTRUQ.js → chunk-PI4DWFYV.js} +10 -5
  15. package/{chunk-JFXQDXYJ.js → chunk-RILY7TKG.js} +2 -2
  16. package/{chunk-CIHSMPAW.js → chunk-UPQF3C7O.js} +1 -1
  17. package/{chunk-CUQ6PG2C.js → chunk-ZY4K4CZR.js} +51 -7
  18. package/{dialogCommands-CJCAMML3.js → dialogCommands-G223U5WU.js} +1 -1
  19. package/{docCreateCommands-H65RSKT4.js → docCreateCommands-2P47IJDK.js} +1 -1
  20. package/{docDeleteCommands-PBYGJ6CZ.js → docDeleteCommands-N3EGDOIC.js} +1 -1
  21. package/{docReadCommands-4VRYN5R5.js → docReadCommands-6BFV2HI7.js} +1 -1
  22. package/{docUpdateCommands-COZG3ZDB.js → docUpdateCommands-ZTMPXHC5.js} +1 -1
  23. package/index.js +40 -40
  24. package/{machineCommands-BR3OIZHN.js → machineCommands-FUA7HBND.js} +3 -3
  25. package/{machineWsRunDispatch-43YGAXOP.js → machineWsRunDispatch-URIG5N2V.js} +3 -3
  26. package/package.json +1 -1
  27. package/{readlineWorkspace-RFSDCOKK.js → readlineWorkspace-HVQLD7T3.js} +134 -20
  28. package/{spaceCommands-WGXHETMT.js → spaceCommands-MRP5U3C3.js} +1 -1
@@ -15,7 +15,7 @@ import "./chunk-KQHGZWSV.js";
15
15
  import {
16
16
  Level
17
17
  } from "./chunk-UV6VISQJ.js";
18
- import "./chunk-CUQ6PG2C.js";
18
+ import "./chunk-ZY4K4CZR.js";
19
19
  import "./chunk-ZNFJWEN4.js";
20
20
  import "./chunk-QC5LGHYP.js";
21
21
  import "./chunk-KIS76A2P.js";
@@ -8,8 +8,8 @@ import {
8
8
  } from "./chunk-JYYZCK2Z.js";
9
9
  import {
10
10
  runAgentCreateCommand
11
- } from "./chunk-Q2DNZQEZ.js";
12
- import "./chunk-CIHSMPAW.js";
11
+ } from "./chunk-2R5EVB2O.js";
12
+ import "./chunk-UPQF3C7O.js";
13
13
  import "./chunk-GBPZKFYK.js";
14
14
  import "./chunk-QCZX4FTW.js";
15
15
  import "./chunk-EADNWBAZ.js";
@@ -69,7 +69,7 @@ import "./chunk-3IT2PFHL.js";
69
69
  import "./chunk-MYU3MJCF.js";
70
70
  import "./chunk-AETZ7AD6.js";
71
71
  import "./chunk-KHCLMKZZ.js";
72
- import "./chunk-CUQ6PG2C.js";
72
+ import "./chunk-ZY4K4CZR.js";
73
73
  import "./chunk-ZNFJWEN4.js";
74
74
  import "./chunk-QC5LGHYP.js";
75
75
  import "./chunk-KIS76A2P.js";
@@ -39,7 +39,7 @@ import {
39
39
  } from "./chunk-FPTQQSS6.js";
40
40
  import "./chunk-KQHGZWSV.js";
41
41
  import "./chunk-YYLHWIW6.js";
42
- import "./chunk-CUQ6PG2C.js";
42
+ import "./chunk-ZY4K4CZR.js";
43
43
  import "./chunk-ZNFJWEN4.js";
44
44
  import "./chunk-QC5LGHYP.js";
45
45
  import "./chunk-KIS76A2P.js";
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-SPAQ4PVV.js";
16
16
  import "./chunk-NF64D32W.js";
17
17
  import "./chunk-3L2WKC3W.js";
18
- import "./chunk-CUQ6PG2C.js";
18
+ import "./chunk-ZY4K4CZR.js";
19
19
  import "./chunk-ZNFJWEN4.js";
20
20
  import "./chunk-QC5LGHYP.js";
21
21
  import "./chunk-KIS76A2P.js";
@@ -89,7 +89,7 @@ async function defaultExecuteCli(provider, prompt, options) {
89
89
  return executeCli(provider, prompt, options);
90
90
  }
91
91
  async function forwardConnectorRunMessage(machine, message, pushMessage, executeCli, env, fetchImpl) {
92
- const { handleConnectorRunMessage } = await import("./machineWsRunDispatch-43YGAXOP.js");
92
+ const { handleConnectorRunMessage } = await import("./machineWsRunDispatch-URIG5N2V.js");
93
93
  return handleConnectorRunMessage(message, pushMessage, executeCli, env, fetchImpl);
94
94
  }
95
95
  async function detectLaunchableMachineInfo() {
@@ -2,8 +2,8 @@ import {
2
2
  runAgentCreateCommand,
3
3
  runAgentReadCommand,
4
4
  runAgentUpdateCommand
5
- } from "./chunk-Q2DNZQEZ.js";
6
- import "./chunk-CIHSMPAW.js";
5
+ } from "./chunk-2R5EVB2O.js";
6
+ import "./chunk-UPQF3C7O.js";
7
7
  import "./chunk-GBPZKFYK.js";
8
8
  import "./chunk-QCZX4FTW.js";
9
9
  import "./chunk-EADNWBAZ.js";
@@ -56,7 +56,7 @@ import "./chunk-3IT2PFHL.js";
56
56
  import "./chunk-MYU3MJCF.js";
57
57
  import "./chunk-AETZ7AD6.js";
58
58
  import "./chunk-KHCLMKZZ.js";
59
- import "./chunk-CUQ6PG2C.js";
59
+ import "./chunk-ZY4K4CZR.js";
60
60
  import "./chunk-ZNFJWEN4.js";
61
61
  import "./chunk-QC5LGHYP.js";
62
62
  import "./chunk-KIS76A2P.js";
@@ -8,12 +8,12 @@ import {
8
8
  resolveRunSettlementNote,
9
9
  resolveWorkflowReference,
10
10
  runAgentRunCommand
11
- } from "./chunk-RL5PTRUQ.js";
11
+ } from "./chunk-PI4DWFYV.js";
12
12
  import "./chunk-S7Z2HMCN.js";
13
13
  import {
14
14
  parseAgentRunArgs
15
15
  } from "./chunk-JYYZCK2Z.js";
16
- import "./chunk-CIHSMPAW.js";
16
+ import "./chunk-UPQF3C7O.js";
17
17
  import "./chunk-GBPZKFYK.js";
18
18
  import "./chunk-QCZX4FTW.js";
19
19
  import "./chunk-EADNWBAZ.js";
@@ -71,7 +71,7 @@ import "./chunk-3IT2PFHL.js";
71
71
  import "./chunk-MYU3MJCF.js";
72
72
  import "./chunk-AETZ7AD6.js";
73
73
  import "./chunk-KHCLMKZZ.js";
74
- import "./chunk-CUQ6PG2C.js";
74
+ import "./chunk-ZY4K4CZR.js";
75
75
  import "./chunk-ZNFJWEN4.js";
76
76
  import "./chunk-QC5LGHYP.js";
77
77
  import "./chunk-KIS76A2P.js";
@@ -19,7 +19,7 @@ import {
19
19
  resolveOpenAiCompatibleProviderConfig,
20
20
  runLocalAgentTurn,
21
21
  shouldCacheHybridRemoteRecord
22
- } from "./chunk-CUQ6PG2C.js";
22
+ } from "./chunk-ZY4K4CZR.js";
23
23
  import "./chunk-ZNFJWEN4.js";
24
24
  import {
25
25
  buildPlatformChatCompletionRequest,
@@ -13,7 +13,7 @@ import "./chunk-QA6YKM3H.js";
13
13
  import "./chunk-Q6FF2MCK.js";
14
14
  import "./chunk-SPAQ4PVV.js";
15
15
  import "./chunk-VF4K2QE6.js";
16
- import "./chunk-CUQ6PG2C.js";
16
+ import "./chunk-ZY4K4CZR.js";
17
17
  import "./chunk-ZNFJWEN4.js";
18
18
  import "./chunk-QC5LGHYP.js";
19
19
  import "./chunk-KIS76A2P.js";
@@ -14,7 +14,7 @@ import "./chunk-QA6YKM3H.js";
14
14
  import "./chunk-Q6FF2MCK.js";
15
15
  import "./chunk-SPAQ4PVV.js";
16
16
  import "./chunk-VF4K2QE6.js";
17
- import "./chunk-CUQ6PG2C.js";
17
+ import "./chunk-ZY4K4CZR.js";
18
18
  import "./chunk-ZNFJWEN4.js";
19
19
  import "./chunk-QC5LGHYP.js";
20
20
  import "./chunk-KIS76A2P.js";
@@ -13,7 +13,7 @@ import "./chunk-QA6YKM3H.js";
13
13
  import "./chunk-Q6FF2MCK.js";
14
14
  import "./chunk-SPAQ4PVV.js";
15
15
  import "./chunk-VF4K2QE6.js";
16
- import "./chunk-CUQ6PG2C.js";
16
+ import "./chunk-ZY4K4CZR.js";
17
17
  import "./chunk-ZNFJWEN4.js";
18
18
  import "./chunk-QC5LGHYP.js";
19
19
  import "./chunk-KIS76A2P.js";
@@ -14,7 +14,7 @@ import "./chunk-QA6YKM3H.js";
14
14
  import "./chunk-Q6FF2MCK.js";
15
15
  import "./chunk-SPAQ4PVV.js";
16
16
  import "./chunk-VF4K2QE6.js";
17
- import "./chunk-CUQ6PG2C.js";
17
+ import "./chunk-ZY4K4CZR.js";
18
18
  import "./chunk-ZNFJWEN4.js";
19
19
  import "./chunk-QC5LGHYP.js";
20
20
  import "./chunk-KIS76A2P.js";
@@ -14,7 +14,7 @@ import "./chunk-QA6YKM3H.js";
14
14
  import "./chunk-Q6FF2MCK.js";
15
15
  import "./chunk-SPAQ4PVV.js";
16
16
  import "./chunk-VF4K2QE6.js";
17
- import "./chunk-CUQ6PG2C.js";
17
+ import "./chunk-ZY4K4CZR.js";
18
18
  import "./chunk-ZNFJWEN4.js";
19
19
  import "./chunk-QC5LGHYP.js";
20
20
  import "./chunk-KIS76A2P.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clearCliLocalRuntimePreparedAgentCache
3
- } from "./chunk-CIHSMPAW.js";
3
+ } from "./chunk-UPQF3C7O.js";
4
4
  import {
5
5
  getReadableCliDb
6
6
  } from "./chunk-RXX4GDIH.js";
@@ -27,7 +27,7 @@ import {
27
27
  resolveLocalUserId,
28
28
  t,
29
29
  toolLabel
30
- } from "./chunk-CIHSMPAW.js";
30
+ } from "./chunk-UPQF3C7O.js";
31
31
  import {
32
32
  createRunActivityTracker,
33
33
  popSingleQueueMessage,
@@ -111,7 +111,7 @@ import {
111
111
  LOCAL_AGENT_CONFIG_MISSING_CODE,
112
112
  LOCAL_TURN_ABORTED_CODE,
113
113
  readActionGate
114
- } from "./chunk-CUQ6PG2C.js";
114
+ } from "./chunk-ZY4K4CZR.js";
115
115
  import {
116
116
  resolveAgentRuntimeConfigFromRecord
117
117
  } from "./chunk-KIS76A2P.js";
@@ -10413,7 +10413,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
10413
10413
  // packages/cli/client/agentRun.ts
10414
10414
  import { ulid } from "ulid";
10415
10415
  async function loadRunLocalAgentTurn() {
10416
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-XG3IDNOC.js");
10416
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-PUZINLWJ.js");
10417
10417
  return runLocalAgentTurn;
10418
10418
  }
10419
10419
  var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
@@ -11079,6 +11079,12 @@ async function runLocalAgentTurnForCli(options, settings) {
11079
11079
  ...options.parentDialogId ? { parentThreadId: options.parentDialogId } : {}
11080
11080
  } : void 0;
11081
11081
  const currentDialogId = options.continueDialogId ?? ulid();
11082
+ const turnId = `turn-${ulid()}`;
11083
+ const runtimeContextWithOwnership = {
11084
+ ...runtimeContext ?? {},
11085
+ dialogId: currentDialogId,
11086
+ turnId
11087
+ };
11082
11088
  const adapter = baseAdapter;
11083
11089
  const expandedMessage = options.pastedTextStore?.items.size ? expandCollapsedPastes(options.message, options.pastedTextStore) : options.message;
11084
11090
  const workingLabel = `${options.agentName} -> working locally`;
@@ -11114,11 +11120,10 @@ async function runLocalAgentTurnForCli(options, settings) {
11114
11120
  category: options.category,
11115
11121
  inheritedFromDialogKey: options.inheritedFromDialogKey,
11116
11122
  parentDialogId: options.parentDialogId,
11117
- runtimeContext,
11123
+ runtimeContext: runtimeContextWithOwnership,
11118
11124
  runKind: options.env.NOLO_AGENT_RUN_CHILD === "1" ? "subtask" : "interactive",
11119
11125
  background: options.background,
11120
11126
  noStream: options.noStream,
11121
- ...runtimeContext ? { runtimeContext } : {},
11122
11127
  ...options.contextBlockScopes?.length ? { contextBlockScopes: options.contextBlockScopes } : options.extraContextBlocks?.length ? { contextBlocks: options.extraContextBlocks } : {},
11123
11128
  ...typeof options.timeoutMs === "number" ? { timeoutMs: options.timeoutMs } : {},
11124
11129
  ...options.actionGateHandler ? { onActionGate: options.actionGateHandler } : {},
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-CIHSMPAW.js";
4
+ } from "./chunk-UPQF3C7O.js";
5
5
  import {
6
6
  clipMultilineText
7
7
  } from "./chunk-QH6NK22I.js";
8
8
  import {
9
9
  runLocalAgentTurn
10
- } from "./chunk-CUQ6PG2C.js";
10
+ } from "./chunk-ZY4K4CZR.js";
11
11
  import {
12
12
  applyToolSurfaceConstraints
13
13
  } from "./chunk-V3ZKNK5D.js";
@@ -159,7 +159,7 @@ import {
159
159
  resolveOpenAiCompatibleProviderConfig,
160
160
  shouldUseGeminiNativeToolRoute,
161
161
  summarizeToolArguments
162
- } from "./chunk-CUQ6PG2C.js";
162
+ } from "./chunk-ZY4K4CZR.js";
163
163
  import {
164
164
  PlatformStreamInterruptedError,
165
165
  buildPlatformChatCompletionRequest,
@@ -16266,7 +16266,8 @@ var ProcessRegistry = class {
16266
16266
  status: "running",
16267
16267
  persist: proc.persist ?? false,
16268
16268
  promoted: false,
16269
- transient: proc.transient ?? false
16269
+ transient: proc.transient ?? false,
16270
+ owner: proc.owner ?? null
16270
16271
  };
16271
16272
  this.processes.set(proc.pid, record);
16272
16273
  this.byTaskId.set(record.taskId, proc.pid);
@@ -16453,6 +16454,25 @@ function getProcessRegistry() {
16453
16454
  return registry;
16454
16455
  }
16455
16456
 
16457
+ // packages/agent-runtime/processOwnership.ts
16458
+ var asNonEmptyString = (value) => {
16459
+ if (typeof value !== "string") return null;
16460
+ const trimmed = value.trim();
16461
+ return trimmed ? trimmed : null;
16462
+ };
16463
+ function readProcessOwner(runtimeContext) {
16464
+ if (!runtimeContext || typeof runtimeContext !== "object") return null;
16465
+ const dialogId = asNonEmptyString(runtimeContext.dialogId) ?? asNonEmptyString(runtimeContext.parentThreadId);
16466
+ if (!dialogId) return null;
16467
+ const turnId = asNonEmptyString(runtimeContext.turnId);
16468
+ const ownerId = asNonEmptyString(runtimeContext.ownerId);
16469
+ return {
16470
+ dialogId,
16471
+ ...turnId ? { turnId } : {},
16472
+ ...ownerId ? { ownerId } : {}
16473
+ };
16474
+ }
16475
+
16456
16476
  // packages/agent-runtime/workspaceShell.ts
16457
16477
  import { resolve as resolve3 } from "node:path";
16458
16478
  import { spawn as spawnChildProcess2 } from "node:child_process";
@@ -16866,8 +16886,10 @@ async function runWorkspaceCommand(args2) {
16866
16886
  // Foreground grace-period envelope: not a user-visible background task
16867
16887
  // until promote() flips the marker on timeout detach (see
16868
16888
  // listBackground). Keeps the status line / /procs / /stop semantics
16869
- // identical to pre-Phase-0.
16870
- transient: true
16889
+ // identical to pre-Phase-0. Ownership rides along so the promoted record
16890
+ // stays attributable without any terminal-time inference.
16891
+ transient: true,
16892
+ owner: args2.owner ?? null
16871
16893
  });
16872
16894
  }
16873
16895
  const exitPromise = waitForNodeProcessExit(proc);
@@ -16980,7 +17002,13 @@ async function runWorkspaceCommand(args2) {
16980
17002
  const pid = typeof proc.pid === "number" ? proc.pid : 0;
16981
17003
  const pgid = pid;
16982
17004
  const promoted = registry2.promote(pid);
16983
- const envelope = promoted ?? registry2.add({ pid, pgid, command: args2.command.join(" "), label });
17005
+ const envelope = promoted ?? registry2.add({
17006
+ pid,
17007
+ pgid,
17008
+ command: args2.command.join(" "),
17009
+ label,
17010
+ owner: args2.owner ?? null
17011
+ });
16984
17012
  const taskId = envelope.taskId;
16985
17013
  proc.on("close", (code) => {
16986
17014
  detachSignalCleanup();
@@ -17387,7 +17415,11 @@ var execShellCapability = {
17387
17415
  commandPrefix: ctx.commandPrefix,
17388
17416
  abortSignal: ctx.abortSignal,
17389
17417
  detachMs: isImmediateDetachShellCommand({ command }) ? 0 : ctx.detachMs,
17390
- stdin: typeof normalized.input === "string" ? normalized.input : void 0
17418
+ stdin: typeof normalized.input === "string" ? normalized.input : void 0,
17419
+ // Ownership of the turn that invoked this command: an auto-detached
17420
+ // command keeps its parent dialog so its terminal can resume that
17421
+ // conversation (see processOwnership.ts). Absent ctx.owner = unowned.
17422
+ owner: ctx.owner ?? null
17391
17423
  });
17392
17424
  return {
17393
17425
  content: result4.content,
@@ -18799,7 +18831,10 @@ async function execShellTool(args2) {
18799
18831
  enableDestructiveShellGuard: args2.enableDestructiveShellGuard,
18800
18832
  confirmDestructiveAction: args2.confirmDestructiveAction,
18801
18833
  blockDestructiveWithoutConfirmation: args2.blockDestructiveWithoutConfirmation,
18802
- onInvoke: args2.onInvoke
18834
+ onInvoke: args2.onInvoke,
18835
+ // Ownership is captured here (launch time) from the host-injected turn
18836
+ // context, never re-derived when the task later reaches a terminal state.
18837
+ owner: readProcessOwner(args2.call.runtimeContext)
18803
18838
  }
18804
18839
  );
18805
18840
  }
@@ -18839,7 +18874,16 @@ async function launchProcessTool(args2) {
18839
18874
  }
18840
18875
  const pgid = detached ? pid : pid;
18841
18876
  const registry2 = getProcessRegistry();
18842
- const envelope = registry2.add({ pid, pgid, command, label, persist });
18877
+ const envelope = registry2.add({
18878
+ pid,
18879
+ pgid,
18880
+ command,
18881
+ label,
18882
+ persist,
18883
+ // Launch-time ownership: the dialog/turn that asked for this background
18884
+ // task. Terminal-time resume reads this record, never "current dialog".
18885
+ owner: readProcessOwner(args2.call.runtimeContext)
18886
+ });
18843
18887
  const cleanupChildOnHostSignal = (signal) => {
18844
18888
  try {
18845
18889
  if (detached) {
@@ -23,7 +23,7 @@ import "./chunk-KQHGZWSV.js";
23
23
  import "./chunk-HQUORJTM.js";
24
24
  import "./chunk-URMS4XY2.js";
25
25
  import "./chunk-GLKOYSRU.js";
26
- import "./chunk-CUQ6PG2C.js";
26
+ import "./chunk-ZY4K4CZR.js";
27
27
  import "./chunk-ZNFJWEN4.js";
28
28
  import "./chunk-QC5LGHYP.js";
29
29
  import "./chunk-KIS76A2P.js";
@@ -28,7 +28,7 @@ import "./chunk-SPAQ4PVV.js";
28
28
  import "./chunk-VF4K2QE6.js";
29
29
  import "./chunk-AETZ7AD6.js";
30
30
  import "./chunk-KHCLMKZZ.js";
31
- import "./chunk-CUQ6PG2C.js";
31
+ import "./chunk-ZY4K4CZR.js";
32
32
  import "./chunk-ZNFJWEN4.js";
33
33
  import "./chunk-QC5LGHYP.js";
34
34
  import "./chunk-KIS76A2P.js";
@@ -21,7 +21,7 @@ import "./chunk-KQHGZWSV.js";
21
21
  import "./chunk-VF4K2QE6.js";
22
22
  import "./chunk-AETZ7AD6.js";
23
23
  import "./chunk-KHCLMKZZ.js";
24
- import "./chunk-CUQ6PG2C.js";
24
+ import "./chunk-ZY4K4CZR.js";
25
25
  import "./chunk-ZNFJWEN4.js";
26
26
  import "./chunk-QC5LGHYP.js";
27
27
  import "./chunk-KIS76A2P.js";
@@ -16,7 +16,7 @@ import "./chunk-SPAQ4PVV.js";
16
16
  import "./chunk-VF4K2QE6.js";
17
17
  import "./chunk-AETZ7AD6.js";
18
18
  import "./chunk-KHCLMKZZ.js";
19
- import "./chunk-CUQ6PG2C.js";
19
+ import "./chunk-ZY4K4CZR.js";
20
20
  import "./chunk-ZNFJWEN4.js";
21
21
  import "./chunk-QC5LGHYP.js";
22
22
  import "./chunk-KIS76A2P.js";
@@ -30,7 +30,7 @@ import {
30
30
  resolvePageSkillMetadata
31
31
  } from "./chunk-AETZ7AD6.js";
32
32
  import "./chunk-KHCLMKZZ.js";
33
- import "./chunk-CUQ6PG2C.js";
33
+ import "./chunk-ZY4K4CZR.js";
34
34
  import "./chunk-ZNFJWEN4.js";
35
35
  import "./chunk-QC5LGHYP.js";
36
36
  import "./chunk-KIS76A2P.js";
package/index.js CHANGED
@@ -127,7 +127,7 @@ function createDaemonShortcutCommand(path, description, command2) {
127
127
  // packages/cli/agentInternalCommandEntries.ts
128
128
  function getAgentInternalCommandEntries() {
129
129
  const createAgentRunCommand = (path, description) => createContextCommand(path, description, async (args2, ctx) => {
130
- const { runAgentRunCommand } = await import("./agentRunCommand-CDRQIDLW.js");
130
+ const { runAgentRunCommand } = await import("./agentRunCommand-WZZSCEEP.js");
131
131
  return runAgentRunCommand(args2, {
132
132
  env: ctx.env,
133
133
  scriptDir: ctx.scriptDir,
@@ -139,11 +139,11 @@ function getAgentInternalCommandEntries() {
139
139
  createAgentRunCommand(["run"], "Run a no-login local agent in this workspace"),
140
140
  createAgentRunCommand(["chat"], "Chat with an agent"),
141
141
  createEnvCommand(["agent", "list"], "List owned agents", async (args2, deps) => {
142
- const { runAgentListCommand } = await import("./agentListCommands-63DOSBY7.js");
142
+ const { runAgentListCommand } = await import("./agentListCommands-IFUOWXP3.js");
143
143
  return runAgentListCommand(args2, deps);
144
144
  }),
145
145
  createEnvCommand(["agent", "create"], "Create a new agent", async (args2, deps) => {
146
- const { runAgentCreateCommand } = await import("./agentRecordCommands-4RQKVPNP.js");
146
+ const { runAgentCreateCommand } = await import("./agentRecordCommands-USSLZKED.js");
147
147
  return runAgentCreateCommand(args2, deps);
148
148
  }),
149
149
  createEnvCommand(["agent", "models"], "List models available on an OpenAI-compatible provider", async (args2, deps) => {
@@ -155,7 +155,7 @@ function getAgentInternalCommandEntries() {
155
155
  return runAgentPullCommand(args2, deps);
156
156
  }),
157
157
  createEnvCommand(["agent", "read"], "Read a single agent", async (args2, deps) => {
158
- const { runAgentReadCommand } = await import("./agentRecordCommands-4RQKVPNP.js");
158
+ const { runAgentReadCommand } = await import("./agentRecordCommands-USSLZKED.js");
159
159
  return runAgentReadCommand(args2, deps);
160
160
  }),
161
161
  createAgentRunCommand(["agent", "run"], "Run an agent"),
@@ -184,31 +184,31 @@ function getAgentInternalCommandEntries() {
184
184
  return runSetupOfflineMarxistsAgentCommand(args2, deps);
185
185
  }),
186
186
  createEnvCommand(["agent", "update"], "Update agent fields", async (args2, deps) => {
187
- const { runAgentUpdateCommand } = await import("./agentRecordCommands-4RQKVPNP.js");
187
+ const { runAgentUpdateCommand } = await import("./agentRecordCommands-USSLZKED.js");
188
188
  return runAgentUpdateCommand(args2, deps);
189
189
  }),
190
190
  createEnvCommand(["agent", "email", "provision"], "Provision a controlled inbox for an agent", async (args2, deps) => {
191
- const { runAgentEmailProvisionCommand } = await import("./agentEmailCommands-QRVMJZ4C.js");
191
+ const { runAgentEmailProvisionCommand } = await import("./agentEmailCommands-HXIX4KJE.js");
192
192
  return runAgentEmailProvisionCommand(args2, deps);
193
193
  }),
194
194
  createEnvCommand(["agent", "email", "bind"], "Bind an existing email address to an agent", async (args2, deps) => {
195
- const { runAgentEmailBindCommand } = await import("./agentEmailCommands-QRVMJZ4C.js");
195
+ const { runAgentEmailBindCommand } = await import("./agentEmailCommands-HXIX4KJE.js");
196
196
  return runAgentEmailBindCommand(args2, deps);
197
197
  }),
198
198
  createEnvCommand(["agent", "email", "transfer"], "Transfer an email identity from one agent to another (cross-account)", async (args2, deps) => {
199
- const { runAgentEmailTransferCommand } = await import("./agentEmailCommands-QRVMJZ4C.js");
199
+ const { runAgentEmailTransferCommand } = await import("./agentEmailCommands-HXIX4KJE.js");
200
200
  return runAgentEmailTransferCommand(args2, deps);
201
201
  }),
202
202
  createEnvCommand(
203
203
  ["agent", "email", "create-and-provision"],
204
204
  "Create an agent and provision its controlled inbox",
205
205
  async (args2, deps) => {
206
- const { runAgentEmailCreateAndProvisionCommand } = await import("./agentEmailCommands-QRVMJZ4C.js");
206
+ const { runAgentEmailCreateAndProvisionCommand } = await import("./agentEmailCommands-HXIX4KJE.js");
207
207
  return runAgentEmailCreateAndProvisionCommand(args2, deps);
208
208
  }
209
209
  ),
210
210
  createEnvCommand(["agent", "delete"], "Hard-delete an agent's private and public records", async (args2, deps) => {
211
- const { runAgentDeleteCommand } = await import("./agentDeleteCommand-UAMLWTPS.js");
211
+ const { runAgentDeleteCommand } = await import("./agentDeleteCommand-2TYFURBN.js");
212
212
  return runAgentDeleteCommand(args2, deps);
213
213
  }),
214
214
  createEnvCommand(["agent", "grant"], "Grant another user access to this agent's owner credentials", async (args2, deps) => {
@@ -224,15 +224,15 @@ function getAgentInternalCommandEntries() {
224
224
  return runAgentRevokeGrantCommand(args2, deps);
225
225
  }),
226
226
  createEnvCommand(["agent", "bind-current"], "Bind an agent to this machine", async (args2, deps) => {
227
- const { runAgentBindCurrentCommand } = await import("./agentMachineCommands-BLILYHBN.js");
227
+ const { runAgentBindCurrentCommand } = await import("./agentMachineCommands-NEJEQV5S.js");
228
228
  return runAgentBindCurrentCommand(args2, deps);
229
229
  }),
230
230
  createEnvCommand(["agent", "smoke-current"], "Smoke test a bound agent through this machine", async (args2, deps) => {
231
- const { runAgentSmokeCurrentCommand } = await import("./agentMachineCommands-BLILYHBN.js");
231
+ const { runAgentSmokeCurrentCommand } = await import("./agentMachineCommands-NEJEQV5S.js");
232
232
  return runAgentSmokeCurrentCommand(args2, deps);
233
233
  }),
234
234
  createEnvCommand(["agent", "runtime-doctor"], "Diagnose current machine runtime compatibility", async (args2, deps) => {
235
- const { runAgentRuntimeDoctorCommand } = await import("./agentMachineCommands-BLILYHBN.js");
235
+ const { runAgentRuntimeDoctorCommand } = await import("./agentMachineCommands-NEJEQV5S.js");
236
236
  return runAgentRuntimeDoctorCommand(args2, deps);
237
237
  }),
238
238
  createAgentRunCommand(["agent", "chat"], "Chat with an agent")
@@ -243,23 +243,23 @@ function getAgentInternalCommandEntries() {
243
243
  function getAppInternalCommandEntries() {
244
244
  return [
245
245
  createEnvCommand(["app", "list"], "List your apps", async (args2, deps) => {
246
- const { runAppListCommand } = await import("./appListCommands-NR2HRMDY.js");
246
+ const { runAppListCommand } = await import("./appListCommands-A6ROBW7P.js");
247
247
  return runAppListCommand(args2, deps);
248
248
  }),
249
249
  createEnvCommand(["app", "get"], "Get app details", async (args2, deps) => {
250
- const { runAppGetCommand } = await import("./appGetCommands-JIT4OPUD.js");
250
+ const { runAppGetCommand } = await import("./appGetCommands-3VOGIZ7T.js");
251
251
  return runAppGetCommand(args2, deps);
252
252
  }),
253
253
  createEnvCommand(["app", "deploy"], "Deploy an app", async (args2, deps) => {
254
- const { runAppDeployCommand } = await import("./appDeployCommands-ECZJQAAL.js");
254
+ const { runAppDeployCommand } = await import("./appDeployCommands-FXF45Q7F.js");
255
255
  return runAppDeployCommand(args2, deps);
256
256
  }),
257
257
  createEnvCommand(["app", "deploy", "status"], "Check app deploy status", async (args2, deps) => {
258
- const { runAppDeployStatusCommand } = await import("./appDeployStatusCommands-DZKVFG3Y.js");
258
+ const { runAppDeployStatusCommand } = await import("./appDeployStatusCommands-KONVRM53.js");
259
259
  return runAppDeployStatusCommand(args2, deps);
260
260
  }),
261
261
  createEnvCommand(["app", "delete"], "Delete an app", async (args2, deps) => {
262
- const { runAppDeleteCommand } = await import("./appDeleteCommands-TJXDMOYT.js");
262
+ const { runAppDeleteCommand } = await import("./appDeleteCommands-U4NTEJYQ.js");
263
263
  return runAppDeleteCommand(args2, deps);
264
264
  })
265
265
  ];
@@ -324,23 +324,23 @@ function getChromeInternalCommandEntries() {
324
324
  function getDialogInternalCommandEntries() {
325
325
  return [
326
326
  createEnvCommand(["dialog", "list"], "List dialogs (default --limit 50; --all/--limit 0 full; --jsonl streams)", async (args2, deps) => {
327
- const { runDialogListCommand } = await import("./dialogCommands-CJCAMML3.js");
327
+ const { runDialogListCommand } = await import("./dialogCommands-G223U5WU.js");
328
328
  return runDialogListCommand(args2, deps);
329
329
  }),
330
330
  createEnvCommand(["dialog", "delete"], "Delete one or more dialogs", async (args2, deps) => {
331
- const { runDialogDeleteCommand } = await import("./dialogCommands-CJCAMML3.js");
331
+ const { runDialogDeleteCommand } = await import("./dialogCommands-G223U5WU.js");
332
332
  return runDialogDeleteCommand(args2, deps);
333
333
  }),
334
334
  createEnvCommand(["dialog", "query"], "Query dialogs by subject refs (default --limit 50; --all full; --jsonl streams)", async (args2, deps) => {
335
- const { runDialogQueryCommand } = await import("./dialogCommands-CJCAMML3.js");
335
+ const { runDialogQueryCommand } = await import("./dialogCommands-G223U5WU.js");
336
336
  return runDialogQueryCommand(args2, deps);
337
337
  }),
338
338
  createEnvCommand(["dialog", "read"], "Read a dialog", async (args2, deps) => {
339
- const { runDialogReadCommand } = await import("./dialogCommands-CJCAMML3.js");
339
+ const { runDialogReadCommand } = await import("./dialogCommands-G223U5WU.js");
340
340
  return runDialogReadCommand(args2, deps);
341
341
  }),
342
342
  createEnvCommand(["dialog", "status"], "Read compact dialog status", async (args2, deps) => {
343
- const { runDialogStatusCommand } = await import("./dialogCommands-CJCAMML3.js");
343
+ const { runDialogStatusCommand } = await import("./dialogCommands-G223U5WU.js");
344
344
  return runDialogStatusCommand(args2, deps);
345
345
  })
346
346
  ];
@@ -350,39 +350,39 @@ function getDialogInternalCommandEntries() {
350
350
  function getDocInternalCommandEntries() {
351
351
  return [
352
352
  createEnvCommand(["doc", "create"], "Create a normal doc", async (args2, deps) => {
353
- const { runDocCreateCommand } = await import("./docCreateCommands-H65RSKT4.js");
353
+ const { runDocCreateCommand } = await import("./docCreateCommands-2P47IJDK.js");
354
354
  return runDocCreateCommand(args2, deps);
355
355
  }),
356
356
  createEnvCommand(["doc", "read"], "Read a normal doc", async (args2, deps) => {
357
- const { runDocReadCommand } = await import("./docReadCommands-4VRYN5R5.js");
357
+ const { runDocReadCommand } = await import("./docReadCommands-6BFV2HI7.js");
358
358
  return runDocReadCommand(args2, deps);
359
359
  }),
360
360
  createEnvCommand(["doc", "update"], "Update a normal doc", async (args2, deps) => {
361
- const { runDocUpdateCommand } = await import("./docUpdateCommands-COZG3ZDB.js");
361
+ const { runDocUpdateCommand } = await import("./docUpdateCommands-ZTMPXHC5.js");
362
362
  return runDocUpdateCommand(args2, deps);
363
363
  }),
364
364
  createEnvCommand(["doc", "delete"], "Delete a normal doc", async (args2, deps) => {
365
- const { runDocDeleteCommand } = await import("./docDeleteCommands-PBYGJ6CZ.js");
365
+ const { runDocDeleteCommand } = await import("./docDeleteCommands-N3EGDOIC.js");
366
366
  return runDocDeleteCommand(args2, deps);
367
367
  }),
368
368
  createEnvCommand(["skill-doc", "create"], "Create a skill-backed doc", async (args2, deps) => {
369
- const { runSkillDocCreateCommand } = await import("./docCreateCommands-H65RSKT4.js");
369
+ const { runSkillDocCreateCommand } = await import("./docCreateCommands-2P47IJDK.js");
370
370
  return runSkillDocCreateCommand(args2, deps);
371
371
  }),
372
372
  createEnvCommand(["skill", "create-doc"], "Create a skill-backed doc", async (args2, deps) => {
373
- const { runSkillDocCreateCommand } = await import("./docCreateCommands-H65RSKT4.js");
373
+ const { runSkillDocCreateCommand } = await import("./docCreateCommands-2P47IJDK.js");
374
374
  return runSkillDocCreateCommand(args2, deps);
375
375
  }),
376
376
  createEnvCommand(["skill-doc", "read"], "Read a skill doc", async (args2, deps) => {
377
- const { runSkillDocReadCommand } = await import("./docReadCommands-4VRYN5R5.js");
377
+ const { runSkillDocReadCommand } = await import("./docReadCommands-6BFV2HI7.js");
378
378
  return runSkillDocReadCommand(args2, deps);
379
379
  }),
380
380
  createEnvCommand(["skill-doc", "update"], "Update a skill doc", async (args2, deps) => {
381
- const { runSkillDocUpdateCommand } = await import("./docUpdateCommands-COZG3ZDB.js");
381
+ const { runSkillDocUpdateCommand } = await import("./docUpdateCommands-ZTMPXHC5.js");
382
382
  return runSkillDocUpdateCommand(args2, deps);
383
383
  }),
384
384
  createEnvCommand(["skill-doc", "delete"], "Delete a skill doc", async (args2, deps) => {
385
- const { runSkillDocDeleteCommand } = await import("./docDeleteCommands-PBYGJ6CZ.js");
385
+ const { runSkillDocDeleteCommand } = await import("./docDeleteCommands-N3EGDOIC.js");
386
386
  return runSkillDocDeleteCommand(args2, deps);
387
387
  })
388
388
  ];
@@ -410,19 +410,19 @@ function getMemoryInternalCommandEntries() {
410
410
  function getSpaceInternalCommandEntries() {
411
411
  return [
412
412
  createEnvCommand(["space", "create"], "Create a space", async (args2, deps) => {
413
- const { runSpaceCreateCommand } = await import("./spaceCommands-WGXHETMT.js");
413
+ const { runSpaceCreateCommand } = await import("./spaceCommands-MRP5U3C3.js");
414
414
  return runSpaceCreateCommand(args2, deps);
415
415
  }),
416
416
  createEnvCommand(["space", "invite"], "Invite an existing user to a space", async (args2, deps) => {
417
- const { runSpaceInviteCommand } = await import("./spaceCommands-WGXHETMT.js");
417
+ const { runSpaceInviteCommand } = await import("./spaceCommands-MRP5U3C3.js");
418
418
  return runSpaceInviteCommand(args2, deps);
419
419
  }),
420
420
  createEnvCommand(["space", "accept-invite"], "Accept a space invite", async (args2, deps) => {
421
- const { runSpaceAcceptInviteCommand } = await import("./spaceCommands-WGXHETMT.js");
421
+ const { runSpaceAcceptInviteCommand } = await import("./spaceCommands-MRP5U3C3.js");
422
422
  return runSpaceAcceptInviteCommand(args2, deps);
423
423
  }),
424
424
  createEnvCommand(["space", "upload"], "Upload a file to a space", async (args2, deps) => {
425
- const { runSpaceUploadCommand } = await import("./spaceCommands-WGXHETMT.js");
425
+ const { runSpaceUploadCommand } = await import("./spaceCommands-MRP5U3C3.js");
426
426
  return runSpaceUploadCommand(args2, deps);
427
427
  })
428
428
  ];
@@ -472,15 +472,15 @@ function getSystemInternalCommandEntries(renderHelpText2) {
472
472
  return runWhoamiCommand({ args: args2, env: ctx.env });
473
473
  }),
474
474
  createEntrypointEnvCommand(["connect"], "Send machine heartbeats or hold a connector websocket", async (args2, deps) => {
475
- const { runMachineConnectCommand } = await import("./machineCommands-BR3OIZHN.js");
475
+ const { runMachineConnectCommand } = await import("./machineCommands-FUA7HBND.js");
476
476
  return runMachineConnectCommand(args2, deps);
477
477
  }),
478
478
  createDaemonShortcutCommand(["daemon"], "Run the connector daemon shortcut", async (args2, deps) => {
479
- const { runMachineConnectCommand } = await import("./machineCommands-BR3OIZHN.js");
479
+ const { runMachineConnectCommand } = await import("./machineCommands-FUA7HBND.js");
480
480
  return runMachineConnectCommand(args2, deps);
481
481
  }),
482
482
  createEnvCommand(["machine", "status"], "List machines registered to the current profile", async (args2, deps) => {
483
- const { runMachineStatusCommand } = await import("./machineCommands-BR3OIZHN.js");
483
+ const { runMachineStatusCommand } = await import("./machineCommands-FUA7HBND.js");
484
484
  return runMachineStatusCommand(args2, deps);
485
485
  }),
486
486
  createEnvCommand(["doctor", "runtime"], "Diagnose local-first agent runtime selection", async (args2, deps) => {
@@ -875,7 +875,7 @@ async function runScript(script, forwardedArgs, env) {
875
875
  return proc.exited;
876
876
  }
877
877
  async function launchTuiWorkspace(args2) {
878
- const { startTuiWorkspace } = await import("./readlineWorkspace-RFSDCOKK.js");
878
+ const { startTuiWorkspace } = await import("./readlineWorkspace-HVQLD7T3.js");
879
879
  const { createTuiSummaryLlmCaller } = await import("./tuiSummaryLlmCaller-3Z24VUWM.js");
880
880
  return startTuiWorkspace({
881
881
  ...args2,
@@ -2,13 +2,13 @@ import {
2
2
  buildMachinePermissionPromptBlock,
3
3
  handleConnectorRunMessage,
4
4
  resolveMachineRunPermissionPolicy
5
- } from "./chunk-JFXQDXYJ.js";
5
+ } from "./chunk-RILY7TKG.js";
6
6
  import {
7
7
  isConnectorWebSocketAuthError,
8
8
  isConnectorWebSocketRetryableError,
9
9
  resolveConnectorWebSocketTarget
10
10
  } from "./chunk-ALXHV7NK.js";
11
- import "./chunk-CIHSMPAW.js";
11
+ import "./chunk-UPQF3C7O.js";
12
12
  import "./chunk-GBPZKFYK.js";
13
13
  import "./chunk-QCZX4FTW.js";
14
14
  import "./chunk-EADNWBAZ.js";
@@ -67,7 +67,7 @@ import "./chunk-KHCLMKZZ.js";
67
67
  import {
68
68
  PATH_FIELD_ALIASES,
69
69
  createLocalWorkspaceToolExecutors
70
- } from "./chunk-CUQ6PG2C.js";
70
+ } from "./chunk-ZY4K4CZR.js";
71
71
  import "./chunk-ZNFJWEN4.js";
72
72
  import "./chunk-QC5LGHYP.js";
73
73
  import "./chunk-KIS76A2P.js";
@@ -11,8 +11,8 @@ import {
11
11
  runtimeWorkspacePermissionPolicy,
12
12
  scopePermissionPolicyToRuntimeWorkspace,
13
13
  summarizeAgentConfigForLogs
14
- } from "./chunk-JFXQDXYJ.js";
15
- import "./chunk-CIHSMPAW.js";
14
+ } from "./chunk-RILY7TKG.js";
15
+ import "./chunk-UPQF3C7O.js";
16
16
  import "./chunk-GBPZKFYK.js";
17
17
  import "./chunk-QCZX4FTW.js";
18
18
  import "./chunk-EADNWBAZ.js";
@@ -63,7 +63,7 @@ import "./chunk-3IT2PFHL.js";
63
63
  import "./chunk-MYU3MJCF.js";
64
64
  import "./chunk-AETZ7AD6.js";
65
65
  import "./chunk-KHCLMKZZ.js";
66
- import "./chunk-CUQ6PG2C.js";
66
+ import "./chunk-ZY4K4CZR.js";
67
67
  import "./chunk-ZNFJWEN4.js";
68
68
  import "./chunk-QC5LGHYP.js";
69
69
  import "./chunk-KIS76A2P.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nolo-cli",
3
- "version": "0.75.0-alpha.7",
3
+ "version": "0.76.0-alpha.1",
4
4
  "type": "module",
5
5
  "description": "Agent-first terminal workspace for Nolo",
6
6
  "bin": {
@@ -72,7 +72,7 @@ import {
72
72
  wrapTextToLines,
73
73
  wrapTranscriptLine,
74
74
  wrapTranscriptLineWithLayout
75
- } from "./chunk-RL5PTRUQ.js";
75
+ } from "./chunk-PI4DWFYV.js";
76
76
  import "./chunk-S7Z2HMCN.js";
77
77
  import {
78
78
  listFavoriteAgentIdsAcrossServers,
@@ -96,7 +96,7 @@ import {
96
96
  readTimestamp,
97
97
  setCliLocale,
98
98
  t
99
- } from "./chunk-CIHSMPAW.js";
99
+ } from "./chunk-UPQF3C7O.js";
100
100
  import "./chunk-GBPZKFYK.js";
101
101
  import "./chunk-QCZX4FTW.js";
102
102
  import "./chunk-EADNWBAZ.js";
@@ -202,7 +202,7 @@ import {
202
202
  buildLocalWorkspaceToolset,
203
203
  getProcessRegistry,
204
204
  readCommandActionGatePayload
205
- } from "./chunk-CUQ6PG2C.js";
205
+ } from "./chunk-ZY4K4CZR.js";
206
206
  import "./chunk-ZNFJWEN4.js";
207
207
  import "./chunk-QC5LGHYP.js";
208
208
  import "./chunk-KIS76A2P.js";
@@ -6763,6 +6763,16 @@ function buildProcessTerminalTurnMessage(notices) {
6763
6763
  if (notices.length === 0) return "";
6764
6764
  return formatProcessTerminalWakeMessage(notices);
6765
6765
  }
6766
+ function buildProcessTaskCompletedTurnEvent(notice) {
6767
+ return {
6768
+ kind: "background-task-completed",
6769
+ taskId: notice.taskId,
6770
+ status: notice.status,
6771
+ ...notice.exitCode !== void 0 ? { exitCode: notice.exitCode } : {},
6772
+ text: buildProcessTerminalTurnMessage([notice]),
6773
+ displayText: formatProcessTerminalNoticeLine(notice)
6774
+ };
6775
+ }
6766
6776
  function parsePendingProcessNoticeLine(line) {
6767
6777
  const taskMatch = line.match(
6768
6778
  /^\[Background task ([^ \]]+?)(?:\s+\(label: "((?:[^"\\]|\\.)*)"\))? finished: status=(\w+)(?: exitCode=(-?\d+))?\]$/
@@ -6795,6 +6805,75 @@ function normalizeStatus(raw) {
6795
6805
  return "failed";
6796
6806
  }
6797
6807
 
6808
+ // packages/agent-runtime/processTerminalResume.ts
6809
+ var DEFAULT_MAX_CHAINED_COMPLETION_TURNS = 3;
6810
+ function createProcessTerminalResumeState() {
6811
+ const claimedTaskIds = /* @__PURE__ */ new Set();
6812
+ const chainDepthByDialog = /* @__PURE__ */ new Map();
6813
+ return {
6814
+ claimedTaskIds,
6815
+ chainDepthByDialog,
6816
+ noteUserTurn() {
6817
+ chainDepthByDialog.clear();
6818
+ }
6819
+ };
6820
+ }
6821
+ var resolveCap = (value) => {
6822
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 1) {
6823
+ return DEFAULT_MAX_CHAINED_COMPLETION_TURNS;
6824
+ }
6825
+ return Math.floor(value);
6826
+ };
6827
+ function decideProcessTerminalResume(input) {
6828
+ const taskId = input.notice.taskId;
6829
+ if (input.canDeliver === false) {
6830
+ return { kind: "notice-only", reason: "no-channel", taskId };
6831
+ }
6832
+ const dialogId = input.owner?.dialogId;
6833
+ if (!input.owner || !dialogId) {
6834
+ return { kind: "notice-only", reason: "unowned", taskId };
6835
+ }
6836
+ if (input.state.claimedTaskIds.has(taskId)) {
6837
+ return { kind: "notice-only", reason: "duplicate", taskId };
6838
+ }
6839
+ const currentDialogId = input.currentDialogId ?? null;
6840
+ if (currentDialogId !== dialogId) {
6841
+ return { kind: "notice-only", reason: "dialog-mismatch", taskId };
6842
+ }
6843
+ if (input.turnActive) {
6844
+ input.state.claimedTaskIds.add(taskId);
6845
+ return { kind: "inject-turn", taskId, owner: input.owner, notice: input.notice };
6846
+ }
6847
+ const cap = resolveCap(input.maxChainedCompletionTurns);
6848
+ const depth = input.state.chainDepthByDialog.get(dialogId) ?? 0;
6849
+ if (depth >= cap) {
6850
+ return { kind: "notice-only", reason: "chain-cap", taskId };
6851
+ }
6852
+ input.state.claimedTaskIds.add(taskId);
6853
+ input.state.chainDepthByDialog.set(dialogId, depth + 1);
6854
+ return { kind: "completion-turn", taskId, owner: input.owner, notice: input.notice };
6855
+ }
6856
+ function createProcessTerminalAutoResumer(deps) {
6857
+ const state = createProcessTerminalResumeState();
6858
+ return {
6859
+ state,
6860
+ noteUserTurn: () => state.noteUserTurn(),
6861
+ decide: (notice) => {
6862
+ const decision = decideProcessTerminalResume({
6863
+ notice,
6864
+ owner: deps.readOwner(notice.taskId),
6865
+ currentDialogId: deps.getCurrentDialogId(),
6866
+ turnActive: deps.isTurnActive(),
6867
+ state,
6868
+ ...deps.canDeliver ? { canDeliver: deps.canDeliver() } : {},
6869
+ ...deps.maxChainedCompletionTurns === void 0 ? {} : { maxChainedCompletionTurns: deps.maxChainedCompletionTurns }
6870
+ });
6871
+ deps.onDecision?.(decision);
6872
+ return decision;
6873
+ }
6874
+ };
6875
+ }
6876
+
6798
6877
  // packages/cli/client/turnBillingAudit.ts
6799
6878
  import { appendFileSync, mkdirSync as mkdirSync2 } from "node:fs";
6800
6879
  import { homedir as homedir4 } from "node:os";
@@ -7597,6 +7676,8 @@ async function runAskChoiceDialog(args) {
7597
7676
  // packages/chat/messages/contextualFragment.ts
7598
7677
  var BACKGROUND_RUN_OPEN = "<background_run_completion";
7599
7678
  var BACKGROUND_RUN_CLOSE = "</background_run_completion>";
7679
+ var BACKGROUND_TASK_OPEN = "<background_task_completion";
7680
+ var BACKGROUND_TASK_CLOSE = "</background_task_completion>";
7600
7681
  var SERVER_LEGACY_PREFIX = "--- \u540E\u53F0 run \u7EC8\u6001\u4E8B\u4EF6 ---";
7601
7682
  var TUI_LEGACY_PREFIX = "\u3010\u540E\u53F0 run \u7EC8\u6001\u901A\u77E5\u3011";
7602
7683
  var TIME_BLOCK_PREFIX = "--- \u5F53\u524D\u65F6\u95F4 ---";
@@ -7611,6 +7692,13 @@ var registry = [
7611
7692
  return trimmed.startsWith(BACKGROUND_RUN_OPEN) && trimmed.endsWith(BACKGROUND_RUN_CLOSE);
7612
7693
  }
7613
7694
  },
7695
+ {
7696
+ kind: "background_task_completion",
7697
+ match: (text) => {
7698
+ const trimmed = text.trim();
7699
+ return trimmed.startsWith(BACKGROUND_TASK_OPEN) && trimmed.endsWith(BACKGROUND_TASK_CLOSE);
7700
+ }
7701
+ },
7614
7702
  {
7615
7703
  kind: "server_legacy_wake",
7616
7704
  match: (text) => {
@@ -8310,6 +8398,7 @@ async function runOneAgentTurn(ctx, inputMsg, imageUrls, actionGateHandler, conf
8310
8398
  }
8311
8399
  }
8312
8400
  const message = req.text;
8401
+ if (req.event.kind === "user") ctx.noteUserTurn?.();
8313
8402
  ctx.forcedStop = false;
8314
8403
  ctx.turnEpoch += 1;
8315
8404
  const myEpoch = ctx.turnEpoch;
@@ -8317,7 +8406,7 @@ async function runOneAgentTurn(ctx, inputMsg, imageUrls, actionGateHandler, conf
8317
8406
  ctx.history.followBottom = true;
8318
8407
  const isInternalEvent = req.event.kind !== "user";
8319
8408
  const isContextualFragment = matchContextualFragment(message) !== null;
8320
- const transcriptText = isContextualFragment && req.event.kind === "child-run-completed" ? req.event.displayText ?? req.event.text : message;
8409
+ const transcriptText = isContextualFragment && (req.event.kind === "child-run-completed" || req.event.kind === "background-task-completed") ? req.event.displayText ?? req.event.text : message;
8321
8410
  startTurn(ctx.history, isInternalEvent ? "assistant" : "user");
8322
8411
  appendToCurrentTurn(
8323
8412
  ctx.history,
@@ -10567,9 +10656,10 @@ async function runTuiWorkspace(options) {
10567
10656
  };
10568
10657
  scheduleRender();
10569
10658
  };
10570
- const unsubscribeProcessTerminal = getProcessRegistry().onProcessTerminal(
10571
- pushPendingProcessNotice
10572
- );
10659
+ let deliverProcessTerminalNotice = pushPendingProcessNotice;
10660
+ const unsubscribeProcessTerminal = getProcessRegistry().onProcessTerminal((notice) => {
10661
+ deliverProcessTerminalNotice(notice);
10662
+ });
10573
10663
  const effectiveEnv = options.env ? { ...process.env, ...options.env } : process.env;
10574
10664
  const runRegistryPoller = createRunRegistryPoller({
10575
10665
  getDockedRuns: () => activityIndicator.getAgentRuns(),
@@ -10834,6 +10924,7 @@ async function runTuiWorkspace(options) {
10834
10924
  };
10835
10925
  let chatQueueBinding = null;
10836
10926
  let turnInjectionInbox = null;
10927
+ let noteUserTurnHook = null;
10837
10928
  const turnCtx = {
10838
10929
  get state() {
10839
10930
  return state;
@@ -10883,6 +10974,7 @@ async function runTuiWorkspace(options) {
10883
10974
  set turnInjectionInbox(v) {
10884
10975
  turnInjectionInbox = v;
10885
10976
  },
10977
+ noteUserTurn: () => noteUserTurnHook?.(),
10886
10978
  get sessionEnded() {
10887
10979
  return sessionEnded;
10888
10980
  },
@@ -11102,6 +11194,13 @@ async function runTuiWorkspace(options) {
11102
11194
  };
11103
11195
  return { actionGateHandler, confirmDestructiveAction };
11104
11196
  };
11197
+ const processTerminalResumer = createProcessTerminalAutoResumer({
11198
+ readOwner: (taskId) => getProcessRegistry().getByTaskId(taskId)?.owner ?? null,
11199
+ getCurrentDialogId: () => state.dialogId ?? null,
11200
+ isTurnActive: () => busy || fixedInput.isPaused(),
11201
+ canDeliver: () => !sessionEnded && !done && runWakeHandler !== null
11202
+ });
11203
+ noteUserTurnHook = () => processTerminalResumer.noteUserTurn();
11105
11204
  const runIdleTextTurn = async (inputMsg) => {
11106
11205
  const req = createTurnRequest(inputMsg);
11107
11206
  const { actionGateHandler, confirmDestructiveAction } = buildInteractiveTurnHandlers();
@@ -11132,25 +11231,28 @@ ${err.message}` : ""}`
11132
11231
  fixedInput.exitOutputMode(buffer, cursorPos);
11133
11232
  };
11134
11233
  (options.env ?? process.env)[RUN_WAKE_CHANNEL_ENV] = "1";
11234
+ const printInternalEventLine = (displayText) => {
11235
+ const noticeLine = dimCliText(displayText, resolveCliColorEnabled());
11236
+ if (!isInteractiveInput(input)) {
11237
+ output.write(`${noticeLine}
11238
+ `);
11239
+ return;
11240
+ }
11241
+ history.followBottom = true;
11242
+ appendStreamSafeNotice(history, noticeLine, {
11243
+ appendLocalTurn,
11244
+ startTurn
11245
+ });
11246
+ renderHistoryToOutput();
11247
+ };
11135
11248
  runWakeHandler = (event) => {
11136
11249
  if (done) return;
11137
11250
  if (busy || fixedInput.isPaused()) {
11138
11251
  const text = typeof event === "string" ? event : event.text;
11139
11252
  const injected = !!turnInjectionInbox && turnInjectionInbox.push({ text, fallback: event });
11140
11253
  if (injected) {
11141
- const displayText = typeof event !== "string" && event.kind === "child-run-completed" ? event.displayText ?? event.text : text;
11142
- const noticeLine = dimCliText(displayText, resolveCliColorEnabled());
11143
- if (!isInteractiveInput(input)) {
11144
- output.write(`${noticeLine}
11145
- `);
11146
- } else {
11147
- history.followBottom = true;
11148
- appendStreamSafeNotice(history, noticeLine, {
11149
- appendLocalTurn,
11150
- startTurn
11151
- });
11152
- renderHistoryToOutput();
11153
- }
11254
+ const displayText = typeof event === "string" ? event : event.kind === "user" ? event.text : event.displayText ?? event.text;
11255
+ printInternalEventLine(displayText);
11154
11256
  } else {
11155
11257
  const { actionGateHandler, confirmDestructiveAction } = buildInteractiveTurnHandlers();
11156
11258
  ensureChatQueueBinding(turnCtx, actionGateHandler, confirmDestructiveAction).enqueue(event);
@@ -11167,6 +11269,18 @@ ${err.message}` : ""}`
11167
11269
  );
11168
11270
  });
11169
11271
  };
11272
+ deliverProcessTerminalNotice = (notice) => {
11273
+ if (done || sessionEnded) return;
11274
+ const decision = processTerminalResumer.decide(notice);
11275
+ if (decision.kind === "notice-only") {
11276
+ pushPendingProcessNotice(notice);
11277
+ return;
11278
+ }
11279
+ runWakeHandler?.(buildProcessTaskCompletedTurnEvent(notice));
11280
+ if (fixedInput.active && !fixedInput.isPaused()) {
11281
+ fixedInput.repaint(buffer, cursorPos);
11282
+ }
11283
+ };
11170
11284
  let autoScrollDirection = "up";
11171
11285
  const autoScrollStep = () => autoScrollStepForTicks(++autoScrollTicks);
11172
11286
  const startAutoScroll = (direction, mouseX) => {
@@ -11,7 +11,7 @@ import {
11
11
  import "./chunk-Q6FF2MCK.js";
12
12
  import "./chunk-SPAQ4PVV.js";
13
13
  import "./chunk-KQHGZWSV.js";
14
- import "./chunk-CUQ6PG2C.js";
14
+ import "./chunk-ZY4K4CZR.js";
15
15
  import "./chunk-ZNFJWEN4.js";
16
16
  import "./chunk-QC5LGHYP.js";
17
17
  import "./chunk-KIS76A2P.js";