nolo-cli 0.35.0-alpha.1 → 0.36.0-alpha.2

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 (57) hide show
  1. package/{_executeModel-RV52PPE3.js → _executeModel-2S6HNTBF.js} +11 -11
  2. package/{agentDeleteCommand-FBBW3IIM.js → agentDeleteCommand-EJ6RRIGV.js} +2 -2
  3. package/{agentEmailCommands-7F4PCABZ.js → agentEmailCommands-APU6G6PK.js} +11 -11
  4. package/{agentListCommands-ZQXPSB6U.js → agentListCommands-HSWVSDLI.js} +2 -2
  5. package/{agentMachineCommands-E3NB67GM.js → agentMachineCommands-G7JQUUDC.js} +3 -3
  6. package/{agentRecordCommands-7PXWHCQM.js → agentRecordCommands-PUFDQBQ5.js} +11 -11
  7. package/{agentRunCommand-Z4654ONK.js → agentRunCommand-AS4N52UF.js} +11 -11
  8. package/{agentRuntimeLocal-OBKWKEKW.js → agentRuntimeLocal-GTNYV7LH.js} +2 -2
  9. package/{agentSlice-B2IMSPH5.js → agentSlice-LAILHBMM.js} +1 -1
  10. package/{appDeleteCommands-72BE7DSA.js → appDeleteCommands-YDXSR75I.js} +2 -2
  11. package/{appDeployCommands-XJBLKCYO.js → appDeployCommands-4X5SN3EF.js} +2 -2
  12. package/{appDeployStatusCommands-EC4HWCBQ.js → appDeployStatusCommands-TK3JKBHH.js} +2 -2
  13. package/{appGetCommands-62BAATPL.js → appGetCommands-ZKQHHJYB.js} +2 -2
  14. package/{appListCommands-5EZCONM7.js → appListCommands-JRDOEEGV.js} +2 -2
  15. package/{chatQueueReduxAdapter-SSF3DNBX.js → chatQueueReduxAdapter-DQWFZYNL.js} +2 -2
  16. package/{chunk-ZOEE4OVX.js → chunk-2BKJBSQ4.js} +9 -5
  17. package/{chunk-Z7D7MBWR.js → chunk-3SNGK3FB.js} +1 -1
  18. package/{chunk-7KY6U7MW.js → chunk-ARFXKWJH.js} +8 -8
  19. package/{chunk-55C3UZSC.js → chunk-CVXDBLYH.js} +3 -3
  20. package/{chunk-OCJNJUR4.js → chunk-D72M3G32.js} +2 -2
  21. package/{chunk-KPJYUEPE.js → chunk-EJAL5LSG.js} +1 -1
  22. package/{chunk-RUVWTAK7.js → chunk-FXZBSLFK.js} +4 -4
  23. package/{chunk-LFOILL6R.js → chunk-HRSIJO5A.js} +1 -1
  24. package/{chunk-5Q4DXT47.js → chunk-JK7UM3LT.js} +9 -9
  25. package/{chunk-INXNBCEY.js → chunk-KR74XLMV.js} +2 -2
  26. package/{chunk-EFN2AFWF.js → chunk-LBZHTQTD.js} +164 -10
  27. package/{chunk-P62APAXL.js → chunk-NT3QRCVS.js} +2 -2
  28. package/{chunk-OGPQ3AMC.js → chunk-RPPRK6EZ.js} +6 -6
  29. package/{chunk-M3JQWYBC.js → chunk-T2BZICLK.js} +3 -1
  30. package/chunk-T5HJEUQN.js +956 -0
  31. package/{chunk-SDAPQUSO.js → chunk-YNAGAUJT.js} +6 -6
  32. package/{chunk-ZZDWMZFU.js → chunk-ZQ3IDY66.js} +3 -3
  33. package/{clipboardy-PRUHGPGC.js → clipboardy-BX4NMYHE.js} +7 -5
  34. package/{createAgentAutomationAction-IDIY6K45.js → createAgentAutomationAction-767ZITQJ.js} +3 -3
  35. package/{createDialogAction-5LB4YBPS.js → createDialogAction-H75NDXYH.js} +4 -4
  36. package/{createPageAction-TJWVDPZD.js → createPageAction-KYJYZPLC.js} +3 -3
  37. package/{dialogCommands-44NGBPJJ.js → dialogCommands-VYH2BY5H.js} +2 -2
  38. package/{dialogSlice-62JC4ZMX.js → dialogSlice-YJV3AVFM.js} +2 -2
  39. package/{docCreateCommands-IOGYJ7F7.js → docCreateCommands-JS7A3OHQ.js} +2 -2
  40. package/{docDeleteCommands-RO4BZWFP.js → docDeleteCommands-HG5HNKZR.js} +2 -2
  41. package/{docReadCommands-F2KNOJFW.js → docReadCommands-BH4WN6HH.js} +2 -2
  42. package/{docStore-ZRNKZZXU.js → docStore-JOODSWDW.js} +4 -4
  43. package/{docUpdateCommands-2VG4AYOC.js → docUpdateCommands-TAXC7LHJ.js} +2 -2
  44. package/{handleSendMessageAction-YB64A32O.js → handleSendMessageAction-DGL6H4E4.js} +2 -2
  45. package/index.js +59 -46
  46. package/{machineCommands-6WPICTON.js → machineCommands-DSFTSYUL.js} +11 -11
  47. package/{machineWsRunDispatch-4OGEZTYG.js → machineWsRunDispatch-ZOAJQHTU.js} +11 -11
  48. package/package.json +1 -1
  49. package/{readlineWorkspace-BZAZ5YXM.js → readlineWorkspace-5G3UFHYG.js} +53 -30
  50. package/{runAgentClientLoop-SOZS3YTQ.js → runAgentClientLoop-B3TTKXIX.js} +9 -9
  51. package/{spaceCommands-WEASK3IV.js → spaceCommands-Y33JLAKF.js} +2 -2
  52. package/{spaceSlice-2QNUKRN6.js → spaceSlice-ZKUZSVYD.js} +3 -3
  53. package/{streamAgentChatTurn-BYI7UXAA.js → streamAgentChatTurn-PLTB7RMV.js} +10 -10
  54. package/{tools-E6FEUNZY.js → tools-KQXDW66A.js} +6 -6
  55. package/{updateCommands-MNDUIKN7.js → updateCommands-IYKLF3JX.js} +3 -1
  56. package/{updateDialogTitleAction-2A3BEXSP.js → updateDialogTitleAction-OTYEQJAK.js} +3 -3
  57. package/chunk-VFVCYIRQ.js +0 -407
@@ -10,7 +10,7 @@ import {
10
10
  fetchAndSerializeTable,
11
11
  resolveBuiltinSkillPage,
12
12
  waitForAbortableDelay
13
- } from "./chunk-5Q4DXT47.js";
13
+ } from "./chunk-JK7UM3LT.js";
14
14
  import {
15
15
  createDrainExhaustedResponse,
16
16
  isCoreDrainingBody,
@@ -26,13 +26,13 @@ import {
26
26
  } from "./chunk-MEYIRKDN.js";
27
27
  import {
28
28
  fetchAndCacheMessages
29
- } from "./chunk-7KY6U7MW.js";
29
+ } from "./chunk-ARFXKWJH.js";
30
30
  import {
31
31
  shouldUseServerProxy
32
32
  } from "./chunk-YYLHWIW6.js";
33
33
  import {
34
34
  fetchServerSyncedCredential
35
- } from "./chunk-55C3UZSC.js";
35
+ } from "./chunk-CVXDBLYH.js";
36
36
  import {
37
37
  buildSkillGuidancePromptBlock,
38
38
  extractRuntimePageCapabilities,
@@ -45,7 +45,7 @@ import {
45
45
  requiresBareImageUrl,
46
46
  resolveToolGuidedSections,
47
47
  toBareImageUrlMessages
48
- } from "./chunk-M3JQWYBC.js";
48
+ } from "./chunk-T2BZICLK.js";
49
49
  import {
50
50
  convertMessagesToResponsesInput,
51
51
  getUsageRequestOptions,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-RUVWTAK7.js";
4
+ } from "./chunk-FXZBSLFK.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -31,7 +31,7 @@ import {
31
31
  } from "./chunk-KXKQO4Q6.js";
32
32
  import {
33
33
  createDocState
34
- } from "./chunk-INXNBCEY.js";
34
+ } from "./chunk-KR74XLMV.js";
35
35
  import {
36
36
  ToolApiError,
37
37
  buildToolRequestHeaders,
@@ -61,7 +61,7 @@ import {
61
61
  buildBuiltinObjectSkillDbKey,
62
62
  buildBuiltinObjectSkillPageContent,
63
63
  createDialogAction
64
- } from "./chunk-P62APAXL.js";
64
+ } from "./chunk-NT3QRCVS.js";
65
65
  import {
66
66
  addCategory,
67
67
  addContentToSpace,
@@ -81,7 +81,7 @@ import {
81
81
  loadTableRows,
82
82
  updateContentCategory,
83
83
  updateContentTitle
84
- } from "./chunk-OCJNJUR4.js";
84
+ } from "./chunk-D72M3G32.js";
85
85
  import {
86
86
  normalizeAppRouteId,
87
87
  resolveDialogRuntimeAgentKey,
@@ -91,13 +91,13 @@ import {
91
91
  selectMsgById,
92
92
  uiAskChoiceFunc,
93
93
  uiAskChoiceFunctionSchema
94
- } from "./chunk-7KY6U7MW.js";
94
+ } from "./chunk-ARFXKWJH.js";
95
95
  import {
96
96
  createAgent,
97
97
  runLlm,
98
98
  streamAgentChatTurn,
99
99
  updateAgent
100
- } from "./chunk-55C3UZSC.js";
100
+ } from "./chunk-CVXDBLYH.js";
101
101
  import {
102
102
  getActiveDialogKey,
103
103
  require_react,
@@ -15303,7 +15303,7 @@ async function deleteDialogsFunc(args, thunkApi) {
15303
15303
  const deletedDialogIds = [];
15304
15304
  const deletedDialogKeys = [];
15305
15305
  const failures = [];
15306
- const { deleteDialog } = await import("./dialogSlice-62JC4ZMX.js");
15306
+ const { deleteDialog } = await import("./dialogSlice-YJV3AVFM.js");
15307
15307
  for (const target of targets) {
15308
15308
  try {
15309
15309
  await thunkApi.dispatch(deleteDialog(target.dbKey)).unwrap();
@@ -24850,7 +24850,7 @@ var executeToolRun = createAsyncThunk(
24850
24850
  if (!executionInput) {
24851
24851
  throw new Error(`ToolRun ${id} has no input to execute with.`);
24852
24852
  }
24853
- const { findToolExecutor: findToolExecutor2 } = await import("./tools-E6FEUNZY.js");
24853
+ const { findToolExecutor: findToolExecutor2 } = await import("./tools-KQXDW66A.js");
24854
24854
  const { executor } = findToolExecutor2(run.toolName);
24855
24855
  toolRunStarted({
24856
24856
  id: run.id,
@@ -24874,7 +24874,7 @@ var executeToolRun = createAsyncThunk(
24874
24874
  const latestState = thunkApi.getState();
24875
24875
  const userId = latestState.auth?.currentUser?.userId;
24876
24876
  if (userId) {
24877
- const { fetchUserSpaceMemberships } = await import("./spaceSlice-2QNUKRN6.js");
24877
+ const { fetchUserSpaceMemberships } = await import("./spaceSlice-ZKUZSVYD.js");
24878
24878
  await thunkApi.dispatch(fetchUserSpaceMemberships(userId));
24879
24879
  }
24880
24880
  }
@@ -27357,7 +27357,7 @@ async function updateDocFunc(args, thunkApi) {
27357
27357
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
27358
27358
  };
27359
27359
  await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
27360
- const { getDocState, applyExternalDocUpdate } = await import("./docStore-ZRNKZZXU.js");
27360
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-JOODSWDW.js");
27361
27361
  if (getDocState().pageKey === id) {
27362
27362
  applyExternalDocUpdate({
27363
27363
  slateData: finalSlateData,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  updateContentTitle
3
- } from "./chunk-OCJNJUR4.js";
3
+ } from "./chunk-D72M3G32.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-TJWVDPZD.js");
370
+ const { createPageAction } = await import("./createPageAction-KYJYZPLC.js");
371
371
  return createPageAction(args, thunkApi);
372
372
  }
373
373
  function subscribe(listener) {
@@ -42,7 +42,7 @@ import {
42
42
  requiresBareImageUrl,
43
43
  resolveToolGuidedSections,
44
44
  toBareImageUrlMessages
45
- } from "./chunk-M3JQWYBC.js";
45
+ } from "./chunk-T2BZICLK.js";
46
46
  import {
47
47
  convertMessagesToResponsesInput,
48
48
  extractReasoningFromResponseOutput,
@@ -3608,27 +3608,116 @@ function spawnToWebStreams(options) {
3608
3608
  };
3609
3609
  }
3610
3610
 
3611
+ // packages/agent-runtime/processTask.ts
3612
+ var ProcessTaskEventLog = class {
3613
+ events = /* @__PURE__ */ new Map();
3614
+ /** Append one event; assigns the next monotonic seq for the task. */
3615
+ append(input) {
3616
+ const list = this.events.get(input.taskId) ?? [];
3617
+ const lastSeq = list.length > 0 ? list[list.length - 1].seq : 0;
3618
+ const event = Object.freeze({
3619
+ taskId: input.taskId,
3620
+ seq: lastSeq + 1,
3621
+ type: input.type,
3622
+ pid: input.pid,
3623
+ createdAt: Date.now(),
3624
+ ...input.exitCode !== void 0 ? { exitCode: input.exitCode } : {}
3625
+ });
3626
+ list.push(event);
3627
+ this.events.set(input.taskId, list);
3628
+ return { ...event };
3629
+ }
3630
+ /** All events of the task with `seq > cursor` (default 0 = from the start). */
3631
+ read(taskId, cursor = 0) {
3632
+ return (this.events.get(taskId) ?? []).filter((event) => event.seq > cursor).map((event) => ({ ...event }));
3633
+ }
3634
+ latestSeq(taskId) {
3635
+ const list = this.events.get(taskId);
3636
+ return list && list.length > 0 ? list[list.length - 1].seq : 0;
3637
+ }
3638
+ clear() {
3639
+ this.events.clear();
3640
+ }
3641
+ };
3642
+
3611
3643
  // packages/agent-runtime/processRegistry.ts
3644
+ var taskIdCounter = 0;
3645
+ function mintTaskId(pid) {
3646
+ taskIdCounter += 1;
3647
+ return `ptask-${pid}-${Date.now().toString(36)}-${taskIdCounter.toString(36)}`;
3648
+ }
3612
3649
  var ProcessRegistry = class {
3613
3650
  processes = /* @__PURE__ */ new Map();
3651
+ byTaskId = /* @__PURE__ */ new Map();
3652
+ eventLog = new ProcessTaskEventLog();
3653
+ /**
3654
+ * Pre-register an envelope right after a successful spawn and emit the
3655
+ * `started` event. Returns the stored record (with its stable taskId).
3656
+ */
3614
3657
  add(proc) {
3615
- this.processes.set(proc.pid, {
3658
+ const record = {
3659
+ taskId: proc.taskId ?? mintTaskId(proc.pid),
3616
3660
  pid: proc.pid,
3617
3661
  pgid: proc.pgid,
3618
3662
  command: proc.command,
3619
3663
  label: proc.label,
3620
3664
  startedAt: Date.now(),
3621
3665
  status: "running",
3622
- persist: proc.persist ?? false
3623
- });
3666
+ persist: proc.persist ?? false,
3667
+ promoted: false,
3668
+ transient: proc.transient ?? false
3669
+ };
3670
+ this.processes.set(proc.pid, record);
3671
+ this.byTaskId.set(record.taskId, proc.pid);
3672
+ this.eventLog.append({ taskId: record.taskId, pid: proc.pid, type: "started" });
3673
+ return { ...record };
3624
3674
  }
3625
3675
  list() {
3626
3676
  return Array.from(this.processes.values()).map((proc) => ({ ...proc }));
3627
3677
  }
3678
+ /**
3679
+ * User-visible view: only real background tasks — entries registered by
3680
+ * launchProcess (background from birth) plus envelopes promoted to
3681
+ * background by timeout detach. Transient foreground grace-period envelopes
3682
+ * (workspaceShell pre-registration, not yet promoted) are excluded so the
3683
+ * status line, /procs and /stop keep behaving exactly as before Phase 0.
3684
+ * Audit/internal consumers that need the full truth use list() instead.
3685
+ */
3686
+ listBackground() {
3687
+ return Array.from(this.processes.values()).filter((proc) => !proc.transient).map((proc) => ({ ...proc }));
3688
+ }
3628
3689
  get(pid) {
3629
3690
  const item = this.processes.get(pid);
3630
3691
  return item ? { ...item } : void 0;
3631
3692
  }
3693
+ getTaskId(pid) {
3694
+ return this.processes.get(pid)?.taskId;
3695
+ }
3696
+ getByTaskId(taskId) {
3697
+ const pid = this.byTaskId.get(taskId);
3698
+ return pid === void 0 ? void 0 : this.get(pid);
3699
+ }
3700
+ /** Append-only lifecycle events of a task with `seq > cursor` (ascending). */
3701
+ getTaskEvents(taskId, cursor = 0) {
3702
+ return this.eventLog.read(taskId, cursor);
3703
+ }
3704
+ latestTaskSeq(taskId) {
3705
+ return this.eventLog.latestSeq(taskId);
3706
+ }
3707
+ /**
3708
+ * Timeout-detach promotion: mark the pre-registered envelope as a background
3709
+ * task. Same record, same taskId, no re-execution, no second registration.
3710
+ */
3711
+ promote(pid) {
3712
+ const item = this.processes.get(pid);
3713
+ if (!item) return void 0;
3714
+ if (!item.promoted) {
3715
+ item.promoted = true;
3716
+ item.transient = false;
3717
+ this.eventLog.append({ taskId: item.taskId, pid, type: "promoted" });
3718
+ }
3719
+ return { ...item };
3720
+ }
3632
3721
  kill(pid, signal = "SIGTERM") {
3633
3722
  const item = this.processes.get(pid);
3634
3723
  if (!item) return false;
@@ -3638,18 +3727,21 @@ var ProcessRegistry = class {
3638
3727
  } catch {
3639
3728
  }
3640
3729
  item.status = "stopped";
3730
+ this.eventLog.append({ taskId: item.taskId, pid, type: "killed" });
3641
3731
  return true;
3642
3732
  }
3643
3733
  return false;
3644
3734
  }
3645
3735
  stopAll(signal = "SIGTERM", opts) {
3646
3736
  for (const item of this.processes.values()) {
3737
+ if (opts?.backgroundOnly && item.transient) continue;
3647
3738
  if (item.status === "running" && (opts?.includePersist || !item.persist)) {
3648
3739
  try {
3649
3740
  process.kill(-item.pgid, signal);
3650
3741
  } catch {
3651
3742
  }
3652
3743
  item.status = "stopped";
3744
+ this.eventLog.append({ taskId: item.taskId, pid: item.pid, type: "killed" });
3653
3745
  }
3654
3746
  }
3655
3747
  }
@@ -3658,10 +3750,40 @@ var ProcessRegistry = class {
3658
3750
  if (item && item.status === "running") {
3659
3751
  item.exitCode = exitCode;
3660
3752
  item.status = exitCode === 0 ? "exited" : "failed";
3753
+ this.eventLog.append({
3754
+ taskId: item.taskId,
3755
+ pid,
3756
+ type: "exited",
3757
+ exitCode
3758
+ });
3661
3759
  }
3662
3760
  }
3761
+ /**
3762
+ * Grace-period completion: the command ended before detach promotion, so the
3763
+ * envelope is transient by design — record the final event, then drop the
3764
+ * envelope entirely ("不留痕是结果"). The event stream keeps the audit trail.
3765
+ * No-op for already-promoted envelopes (their lifecycle is owned by
3766
+ * markExited after detach).
3767
+ */
3768
+ completeTransient(pid, exitCode) {
3769
+ const item = this.processes.get(pid);
3770
+ if (!item || item.promoted) return;
3771
+ this.eventLog.append({ taskId: item.taskId, pid, type: "exited", exitCode });
3772
+ this.processes.delete(pid);
3773
+ this.byTaskId.delete(item.taskId);
3774
+ }
3775
+ /** Drop an envelope without emitting events (spawn/registration failure paths). */
3776
+ remove(pid) {
3777
+ const item = this.processes.get(pid);
3778
+ if (!item) return false;
3779
+ this.processes.delete(pid);
3780
+ this.byTaskId.delete(item.taskId);
3781
+ return true;
3782
+ }
3663
3783
  clear() {
3664
3784
  this.processes.clear();
3785
+ this.byTaskId.clear();
3786
+ this.eventLog.clear();
3665
3787
  }
3666
3788
  };
3667
3789
  var registry = null;
@@ -4009,6 +4131,21 @@ async function runWorkspaceCommand(args) {
4009
4131
  proc.stdin.write(args.stdin);
4010
4132
  proc.stdin.end();
4011
4133
  }
4134
+ const label = deriveLabel(args.command.join(" "));
4135
+ const registry2 = getProcessRegistry();
4136
+ if (typeof proc.pid === "number") {
4137
+ registry2.add({
4138
+ pid: proc.pid,
4139
+ pgid: proc.pid,
4140
+ command: args.command.join(" "),
4141
+ label,
4142
+ // Foreground grace-period envelope: not a user-visible background task
4143
+ // until promote() flips the marker on timeout detach (see
4144
+ // listBackground). Keeps the status line / /procs / /stop semantics
4145
+ // identical to pre-Phase-0.
4146
+ transient: true
4147
+ });
4148
+ }
4012
4149
  const exitPromise = waitForNodeProcessExit(proc);
4013
4150
  const cleanupChildOnHostSignal = (signal) => {
4014
4151
  if (typeof proc.pid === "number") {
@@ -4085,6 +4222,9 @@ async function runWorkspaceCommand(args) {
4085
4222
  if (abortListener && args.abortSignal) {
4086
4223
  args.abortSignal.removeEventListener("abort", abortListener);
4087
4224
  }
4225
+ if (typeof proc.pid === "number") {
4226
+ registry2.remove(proc.pid);
4227
+ }
4088
4228
  if (isSpawnFailureError(error)) {
4089
4229
  return spawnFailedCommandResult(error, args.outputLimit);
4090
4230
  }
@@ -4114,10 +4254,10 @@ async function runWorkspaceCommand(args) {
4114
4254
  exitPromise.catch(() => {
4115
4255
  });
4116
4256
  const pid = typeof proc.pid === "number" ? proc.pid : 0;
4117
- const label = deriveLabel(args.command.join(" "));
4118
4257
  const pgid = pid;
4119
- const registry2 = getProcessRegistry();
4120
- registry2.add({ pid, pgid, command: args.command.join(" "), label });
4258
+ const promoted = registry2.promote(pid);
4259
+ const envelope = promoted ?? registry2.add({ pid, pgid, command: args.command.join(" "), label });
4260
+ const taskId = envelope.taskId;
4121
4261
  proc.on("close", (code) => {
4122
4262
  detachSignalCleanup();
4123
4263
  registry2.markExited(pid, code ?? 1);
@@ -4133,10 +4273,12 @@ Use listProcesses to inspect or stop it.`,
4133
4273
  detached: true,
4134
4274
  pid,
4135
4275
  label,
4276
+ taskId,
4136
4277
  content: JSON.stringify({
4137
4278
  detached: true,
4138
4279
  pid,
4139
4280
  label,
4281
+ taskId,
4140
4282
  status: "running",
4141
4283
  ...immediate ? { reason: "long-running-command" } : {}
4142
4284
  })
@@ -4147,6 +4289,9 @@ Use listProcesses to inspect or stop it.`,
4147
4289
  stderrPromise
4148
4290
  ]);
4149
4291
  const exitCode = aborted ? 130 : timedOut ? 124 : Number(raceWinner);
4292
+ if (typeof proc.pid === "number") {
4293
+ registry2.completeTransient(proc.pid, exitCode);
4294
+ }
4150
4295
  const stderr = aborted ? `${rawStderr.trim() ? `${rawStderr.trim()}
4151
4296
  ` : ""}command aborted by signal
4152
4297
  ` : timedOut ? `${rawStderr.trim() ? `${rawStderr.trim()}
@@ -4283,7 +4428,15 @@ var execShellCapability = {
4283
4428
  exitCode: result.exitCode,
4284
4429
  timedOut: result.timedOut,
4285
4430
  ...result.aborted ? { aborted: true } : {},
4286
- ...result.detached ? { detached: true, pid: result.pid, label: result.label, status: "running" } : {},
4431
+ ...result.detached ? {
4432
+ detached: true,
4433
+ pid: result.pid,
4434
+ label: result.label,
4435
+ // Phase 0: stable taskId from the pre-registered Execution
4436
+ // Envelope (additive; existing detached fields untouched).
4437
+ taskId: result.taskId,
4438
+ status: "running"
4439
+ } : {},
4287
4440
  ...normalized.activity ? { activity: normalized.activity } : {}
4288
4441
  }
4289
4442
  };
@@ -5895,7 +6048,7 @@ async function launchProcessTool(args) {
5895
6048
  }
5896
6049
  const pgid = detached ? pid : pid;
5897
6050
  const registry2 = getProcessRegistry();
5898
- registry2.add({ pid, pgid, command, label, persist });
6051
+ const envelope = registry2.add({ pid, pgid, command, label, persist });
5899
6052
  const cleanupChildOnHostSignal = (signal) => {
5900
6053
  try {
5901
6054
  if (detached) {
@@ -5920,7 +6073,7 @@ async function launchProcessTool(args) {
5920
6073
  registry2.markExited(pid, code ?? 1);
5921
6074
  });
5922
6075
  const activity = extractActivity(parsed);
5923
- const resultData = { pid, label, status: "running" };
6076
+ const resultData = { pid, label, taskId: envelope.taskId, status: "running" };
5924
6077
  return {
5925
6078
  content: JSON.stringify(resultData),
5926
6079
  metadata: {
@@ -5928,6 +6081,7 @@ async function launchProcessTool(args) {
5928
6081
  pid,
5929
6082
  label,
5930
6083
  status: "running",
6084
+ taskId: envelope.taskId,
5931
6085
  processLaunch: resultData,
5932
6086
  ...activity ? { activity } : {}
5933
6087
  }
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-OCJNJUR4.js";
3
+ } from "./chunk-D72M3G32.js";
4
4
  import {
5
5
  prepareAndPersistMessage,
6
6
  uiAskChoiceFunc,
7
7
  uiAskChoiceFunctionSchema
8
- } from "./chunk-7KY6U7MW.js";
8
+ } from "./chunk-ARFXKWJH.js";
9
9
  import {
10
10
  require_date_fns
11
11
  } from "./chunk-M76ECQRD.js";
@@ -20,7 +20,7 @@ import {
20
20
  parseAgentRunEvent,
21
21
  t,
22
22
  toolLabel
23
- } from "./chunk-ZOEE4OVX.js";
23
+ } from "./chunk-2BKJBSQ4.js";
24
24
  import {
25
25
  getReadableCliDb
26
26
  } from "./chunk-UNHKVD2N.js";
@@ -51,7 +51,7 @@ import {
51
51
  } from "./chunk-LTRXGFMS.js";
52
52
  import {
53
53
  formatAgentListCard
54
- } from "./chunk-5Q4DXT47.js";
54
+ } from "./chunk-JK7UM3LT.js";
55
55
  import {
56
56
  isGatewayHttpStatus
57
57
  } from "./chunk-RQSOAMPJ.js";
@@ -70,12 +70,12 @@ import {
70
70
  chooseMemoryOwners,
71
71
  loadMemoryCandidatesFromDb,
72
72
  resolveAgentMemoryPolicy
73
- } from "./chunk-P62APAXL.js";
73
+ } from "./chunk-NT3QRCVS.js";
74
74
  import {
75
75
  API_REPORTED_COST_MULTIPLIER,
76
76
  normalizeUsage,
77
77
  parseUiAskChoiceContent
78
- } from "./chunk-7KY6U7MW.js";
78
+ } from "./chunk-ARFXKWJH.js";
79
79
  import {
80
80
  getDefaultCliLocalRuntimeDb
81
81
  } from "./chunk-N4XRDM26.js";
@@ -91,7 +91,7 @@ import {
91
91
  LOCAL_TURN_ABORTED_CODE,
92
92
  readActionGate,
93
93
  readCommandActionGatePayload
94
- } from "./chunk-EFN2AFWF.js";
94
+ } from "./chunk-LBZHTQTD.js";
95
95
  import {
96
96
  resolveAgentRuntimeConfigFromRecord
97
97
  } from "./chunk-64KIQZA2.js";
@@ -5359,7 +5359,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
5359
5359
  // packages/cli/client/agentRun.ts
5360
5360
  import { ulid } from "ulid";
5361
5361
  async function loadRunLocalAgentTurn() {
5362
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-OBKWKEKW.js");
5362
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-GTNYV7LH.js");
5363
5363
  return runLocalAgentTurn;
5364
5364
  }
5365
5365
  async function resolveCurrentMachineId(options) {
@@ -151,7 +151,9 @@ var MENU_USAGE_INSTRUCTIONS = `--- \u4EA4\u4E92\u8BF4\u660E ---
151
151
  \u6240\u6709\u7528\u6237\u8F93\u5165\u5747\u4E3A\u7EAF\u6587\u672C\u6D88\u606F\uFF0C\u76F4\u63A5\u7406\u89E3\u5373\u53EF\uFF0C\u4E0D\u8981\u5728\u56DE\u590D\u4E2D\u63D0\u53CA\u6309\u94AE\u3001\u83DC\u5355\u3001\u754C\u9762\u7B49 UI \u5143\u7D20\u3002
152
152
 
153
153
  ## \u4F55\u65F6\u8C03\u7528 ask_user
154
- \u9ED8\u8BA4\u76F4\u63A5\u884C\u52A8\uFF1A\u80FD\u57FA\u4E8E\u73B0\u6709\u4E0A\u4E0B\u6587\u7ED9\u51FA\u9AD8\u8D28\u91CF\u7B54\u6848\u65F6\u5C31\u76F4\u63A5\u505A\uFF0C\u4E0D\u8981\u4E3A\u4E86\u95EE\u800C\u95EE\uFF1B\u7528\u6237\u76EE\u6807\u5DF2\u5177\u4F53\u6E05\u6670\u65F6\uFF0C\u5373\u4FBF\u5F62\u5F0F\u4E0A\u6EE1\u8DB3\u4E0B\u5217\u6761\u4EF6\u4E5F\u4F18\u5148\u76F4\u63A5\u56DE\u7B54\uFF0C\u4E0D\u5F3A\u884C\u5F39\u83DC\u5355\u3002\u4EC5\u4E09\u79CD\u60C5\u51B5\u8C03\u7528\uFF1A1\uFF09\u9700\u6C42\u5BBD\u6CDB\u6216\u6A21\u7CCA\uFF0C\u7ED9\u51FA 2\uFF5E5 \u4E2A\u4E92\u65A5\u4E14\u90FD\u5408\u7406\u7684\u65B9\u5411\u8BA9\u7528\u6237\u5148\u9009\uFF1B2\uFF09\u8BA1\u5212\u5230\u8FBE\u771F\u6B63\u7684\u5206\u652F\u8282\u70B9\u2014\u2014\u4E0D\u540C\u9009\u62E9\u4F1A\u663E\u8457\u6539\u53D8\u6210\u672C\u3001\u9690\u79C1\u6216\u7ED3\u679C\u8D70\u5411\uFF0C\u4E14\u65E0\u6CD5\u4ECE\u4E0A\u4E0B\u6587\u63A8\u65AD\u7528\u6237\u504F\u597D\uFF1B3\uFF09\u65B0\u4F1A\u8BDD\u5F00\u5934\u9700\u8981\u6309\u7528\u6237\u753B\u50CF\u505A\u529F\u80FD\u5BFC\u822A\u6216\u5F15\u5BFC\u3002
154
+ \u9ED8\u8BA4\u76F4\u63A5\u884C\u52A8\uFF1A\u80FD\u57FA\u4E8E\u73B0\u6709\u4E0A\u4E0B\u6587\u7ED9\u51FA\u9AD8\u8D28\u91CF\u7B54\u6848\u65F6\u5C31\u76F4\u63A5\u505A\uFF0C\u4E0D\u8981\u4E3A\u4E86\u95EE\u800C\u95EE\u3002\u5224\u636E\u662F**\u7528\u6237\u662F\u5426\u9700\u8981\u4E3A\u8FD9\u4E2A\u9009\u62E9\u627F\u62C5\u540E\u679C**\uFF08\u82B1\u94B1\u3001\u6CC4\u9732\u6570\u636E\u3001\u52A8\u7EBF\u4E0A\u3001\u4E0D\u53EF\u56DE\u6EDA\uFF1B\u6216\u8BE5\u9009\u62E9\u7EAF\u5C5E\u4E2A\u4EBA\u53E3\u5473\u3001\u65E0\u4ECE\u63A8\u65AD\uFF09\uFF0C\u800C\u4E0D\u662F"\u8FD9\u4E2A\u9009\u62E9\u4F1A\u4E0D\u4F1A\u5F71\u54CD\u540E\u7EED\u8D70\u5411"\u3002\u4EC5\u4E09\u79CD\u60C5\u51B5\u8C03\u7528\uFF1A1\uFF09\u9700\u6C42\u5BBD\u6CDB\u6216\u6A21\u7CCA\uFF0C\u7ED9\u51FA 2\uFF5E5 \u4E2A\u4E92\u65A5\u4E14\u90FD\u5408\u7406\u7684\u65B9\u5411\u8BA9\u7528\u6237\u5148\u9009\uFF1B2\uFF09\u5206\u53C9\u7684\u540E\u679C\u7531\u7528\u6237\u627F\u62C5\u4E14\u65E0\u6CD5\u4ECE\u4E0A\u4E0B\u6587\u63A8\u65AD\u5176\u504F\u597D\uFF1B3\uFF09\u65B0\u4F1A\u8BDD\u5F00\u5934\u9700\u8981\u6309\u7528\u6237\u753B\u50CF\u505A\u529F\u80FD\u5BFC\u822A\u6216\u5F15\u5BFC\u3002
155
+
156
+ \u4E0D\u8981\u95EE\u7684\uFF08\u5C5E\u4E8E\u4F60\u7684\u804C\u8D23\uFF0C\u95EE\u51FA\u6765\u662F\u628A\u672C\u8BE5\u4F60\u505A\u7684\u5224\u65AD\u63A8\u7ED9\u7528\u6237\uFF09\uFF1A\u5148\u505A\u54EA\u4E2A\u4EFB\u52A1\u3001\u6309\u4EC0\u4E48\u987A\u5E8F\u63A8\u8FDB\u3001\u8981\u4E0D\u8981\u987A\u624B\u4FEE\u67D0\u5904\u3001\u65E5\u5E38\u5B9E\u73B0\u7EC6\u8282\u7528\u54EA\u79CD\u5199\u6CD5\u3001\u8981\u4E0D\u8981\u518D\u68C0\u67E5\u4E00\u904D\u3002\u8FD9\u4E9B\u81EA\u5DF1\u5B9A\uFF0C\u505A\u5B8C\u5728\u56DE\u590D\u91CC\u8BF4\u660E\u7406\u7531\u5373\u53EF\u3002\u6CE8\u610F\u533A\u5206\uFF1A\u67B6\u6784\u9009\u578B\u3001\u6280\u672F\u6808\u3001\u6570\u636E\u5B58\u50A8\u65B9\u6848\u7B49\u957F\u671F\u4E14\u96BE\u56DE\u6EDA\u7684\u6280\u672F\u51B3\u7B56\u4E0D\u5728\u6B64\u5217\u2014\u2014\u5B83\u4EEC\u7684\u540E\u679C\u7531\u7528\u6237\u627F\u62C5\uFF0C\u6309\u4E0A\u8FF0\u7B2C 2 \u6761\u8BE5\u95EE\u5C31\u95EE\u3002\u7528\u6237\u76EE\u6807\u5DF2\u5177\u4F53\u6E05\u6670\u65F6\uFF0C\u5373\u4FBF\u5F62\u5F0F\u4E0A\u6EE1\u8DB3\u524D\u8FF0\u4E09\u79CD\u60C5\u51B5\u4E5F\u4F18\u5148\u76F4\u63A5\u56DE\u7B54\uFF0C\u4E0D\u5F3A\u884C\u5F39\u83DC\u5355\uFF1B\u5C31\u540C\u4E00\u4EF6\u4E8B\u7B2C\u4E8C\u6B21\u5F39\u83DC\u5355\u524D\uFF0C\u5148\u81EA\u68C0\u5224\u636E\u662F\u4E0D\u662F\u7528\u9519\u4E86\u3002
155
157
 
156
158
  ## \u8C03\u7528\u89C4\u8303
157
159
  - \u5148\u5728\u666E\u901A\u56DE\u590D\u6587\u672C\u91CC\u5199\u6E05\u80CC\u666F\u3001\u7406\u7531\u4E0E\u6743\u8861\u518D\u8C03\u7528\u5DE5\u5177\uFF1B\u65E0\u660E\u786E\u63A8\u8350\u9879\u65F6\uFF0C\u5FC5\u987B\u9010\u4E2A\u7B80\u8FF0\u9009\u9879\u4F18\u7F3A\u70B9\u5E2E\u52A9\u6743\u8861\uFF1B