@namzu/cli 45.6.0 → 45.8.0

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 (116) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/chunks/{acp-VJBPFMDK.js → acp-JBHJROEH.js} +8 -8
  4. package/dist/chunks/{add-FRWIF4G3.js → add-LFNYFY3Q.js} +5 -5
  5. package/dist/chunks/{agent-R6JYTUTC.js → agent-Y6CN4KJW.js} +4 -4
  6. package/dist/chunks/{agent-session-I45DFZQY.js → agent-session-A2GKM6DR.js} +5 -5
  7. package/dist/chunks/{bin-main-AHYAIBE5.js → bin-main-S56ONZ3V.js} +3 -3
  8. package/dist/chunks/{chat-T3VP3DCV.js → chat-K4FCFUWQ.js} +2 -2
  9. package/dist/chunks/{chunk-BTMU336W.js → chunk-2ZUXBK2G.js} +2 -2
  10. package/dist/chunks/{chunk-4X3I6SZF.js → chunk-3C34WF54.js} +28 -3
  11. package/dist/chunks/{chunk-4X3I6SZF.js.map → chunk-3C34WF54.js.map} +1 -1
  12. package/dist/chunks/{chunk-76GATJYU.js → chunk-6DZX5T3S.js} +2 -2
  13. package/dist/chunks/{chunk-6GGXRCTW.js → chunk-7EO7AVNF.js} +2 -2
  14. package/dist/chunks/{chunk-AMDJD6CH.js → chunk-7LUBE6UX.js} +2 -2
  15. package/dist/chunks/{chunk-I73NPSRQ.js → chunk-ACEUJQLA.js} +5 -5
  16. package/dist/chunks/{chunk-EXQE56JO.js → chunk-BP62WUCC.js} +2 -2
  17. package/dist/chunks/{chunk-SVMUXZQE.js → chunk-BWSU3DAY.js} +2 -2
  18. package/dist/chunks/{chunk-EYCASCZZ.js → chunk-CGZZAOM3.js} +2 -2
  19. package/dist/chunks/{chunk-E3GOWVGE.js → chunk-DFGGKZAN.js} +2 -2
  20. package/dist/chunks/{chunk-OVOCG3EH.js → chunk-EUFLKDG6.js} +17 -17
  21. package/dist/chunks/{chunk-Z7XLQDDV.js → chunk-GBSX7ZFZ.js} +3 -3
  22. package/dist/chunks/{chunk-G3TIGCWK.js → chunk-H7JRG6GI.js} +2 -2
  23. package/dist/chunks/{chunk-JNUPACSU.js → chunk-JR6WEANS.js} +2 -2
  24. package/dist/chunks/{chunk-36QGYDNX.js → chunk-LXJ7DTNX.js} +5 -4
  25. package/dist/chunks/{chunk-MS2IMZPW.js → chunk-MDA27KYF.js} +10 -3
  26. package/dist/chunks/{chunk-MS2IMZPW.js.map → chunk-MDA27KYF.js.map} +1 -1
  27. package/dist/chunks/{chunk-XHUT5RDY.js → chunk-PKYLKUGU.js} +3 -3
  28. package/dist/chunks/{chunk-I4NKYTRH.js → chunk-RZJ36LG4.js} +2 -2
  29. package/dist/chunks/{chunk-O6QFZAP2.js → chunk-VXNVO5KJ.js} +3 -3
  30. package/dist/chunks/{chunk-MLAJ6ZIG.js → chunk-XMSKDE7G.js} +2 -2
  31. package/dist/chunks/{chunk-HFWISJ3W.js → chunk-YLDVAXIV.js} +2 -2
  32. package/dist/chunks/{cli-runtime-NB4HBCBU.js → cli-runtime-42P3ZY2L.js} +3 -3
  33. package/dist/chunks/{doctor-N7PH4K4N.js → doctor-D7H7UXX6.js} +6 -6
  34. package/dist/chunks/{drain-555N6B62.js → drain-SQ2VZUFJ.js} +2 -2
  35. package/dist/chunks/{exec-LSYIE23V.js → exec-XFV5IMJK.js} +7 -7
  36. package/dist/chunks/{host-queries-FV3F52SM.js → host-queries-HBSQEKUN.js} +2 -2
  37. package/dist/chunks/{learn-XV2UYYVX.js → learn-M5HKRVLA.js} +2 -2
  38. package/dist/chunks/{learn-builtin-W37PQFJV.js → learn-builtin-WLEJOPPA.js} +3 -3
  39. package/dist/chunks/{lifecycle-OJC7MXNX.js → lifecycle-7YYVKNQ4.js} +6 -6
  40. package/dist/chunks/{list-IKFFQ2WL.js → list-OKJHK375.js} +3 -3
  41. package/dist/chunks/{live-JVMAGAIE.js → live-A5IU5I6S.js} +5 -5
  42. package/dist/chunks/{mcp-KJ3RGN3D.js → mcp-MNISFJGL.js} +2 -2
  43. package/dist/chunks/{message-command-SNUKD4UM.js → message-command-X2JR6V5A.js} +7 -7
  44. package/dist/chunks/{pal-DUQ2OASI.js → pal-3GWS24QH.js} +3 -3
  45. package/dist/chunks/{resident-RAXXTDAY.js → resident-QR32XZKI.js} +4 -4
  46. package/dist/chunks/{schedule-QIA3XRIE.js → schedule-VGYXOLXD.js} +5 -5
  47. package/dist/chunks/{service-MVWDIVXD.js → service-TNJWG2JK.js} +5 -5
  48. package/dist/chunks/{session-step-JL6A7XWG.js → session-step-2A6KZCPC.js} +2 -2
  49. package/dist/chunks/{start-check-LNDBVE4T.js → start-check-XGAFZVD7.js} +2 -2
  50. package/dist/chunks/{tui-MXWQWWGT.js → tui-2PZSAL7N.js} +304 -86
  51. package/dist/chunks/tui-2PZSAL7N.js.map +6 -0
  52. package/dist/chunks/{upgrade-27Z2TXDS.js → upgrade-HQWKNEAA.js} +3 -3
  53. package/dist/config/load.d.ts.map +1 -1
  54. package/dist/config/schema.d.ts +11 -0
  55. package/dist/config/schema.d.ts.map +1 -1
  56. package/dist/index.js +7 -7
  57. package/dist/integrations/decision/notify-worthy.d.ts +25 -0
  58. package/dist/integrations/decision/notify-worthy.d.ts.map +1 -0
  59. package/dist/integrations/decision/points.d.ts +71 -0
  60. package/dist/integrations/decision/points.d.ts.map +1 -0
  61. package/dist/integrations/notifications/sound.d.ts +9 -0
  62. package/dist/integrations/notifications/sound.d.ts.map +1 -1
  63. package/dist/integrations/resident/runner-worker.js +1 -1
  64. package/dist/tui/App.d.ts.map +1 -1
  65. package/dist/tui/CopyPicker.d.ts +3 -1
  66. package/dist/tui/CopyPicker.d.ts.map +1 -1
  67. package/dist/tui/copy-targets.d.ts +13 -0
  68. package/dist/tui/copy-targets.d.ts.map +1 -1
  69. package/dist/tui/slashCommands.d.ts +4 -0
  70. package/dist/tui/slashCommands.d.ts.map +1 -1
  71. package/package.json +6 -6
  72. package/dist/chunks/tui-MXWQWWGT.js.map +0 -6
  73. /package/dist/chunks/{acp-VJBPFMDK.js.map → acp-JBHJROEH.js.map} +0 -0
  74. /package/dist/chunks/{add-FRWIF4G3.js.map → add-LFNYFY3Q.js.map} +0 -0
  75. /package/dist/chunks/{agent-R6JYTUTC.js.map → agent-Y6CN4KJW.js.map} +0 -0
  76. /package/dist/chunks/{agent-session-I45DFZQY.js.map → agent-session-A2GKM6DR.js.map} +0 -0
  77. /package/dist/chunks/{bin-main-AHYAIBE5.js.map → bin-main-S56ONZ3V.js.map} +0 -0
  78. /package/dist/chunks/{chat-T3VP3DCV.js.map → chat-K4FCFUWQ.js.map} +0 -0
  79. /package/dist/chunks/{chunk-BTMU336W.js.map → chunk-2ZUXBK2G.js.map} +0 -0
  80. /package/dist/chunks/{chunk-76GATJYU.js.map → chunk-6DZX5T3S.js.map} +0 -0
  81. /package/dist/chunks/{chunk-6GGXRCTW.js.map → chunk-7EO7AVNF.js.map} +0 -0
  82. /package/dist/chunks/{chunk-AMDJD6CH.js.map → chunk-7LUBE6UX.js.map} +0 -0
  83. /package/dist/chunks/{chunk-I73NPSRQ.js.map → chunk-ACEUJQLA.js.map} +0 -0
  84. /package/dist/chunks/{chunk-EXQE56JO.js.map → chunk-BP62WUCC.js.map} +0 -0
  85. /package/dist/chunks/{chunk-SVMUXZQE.js.map → chunk-BWSU3DAY.js.map} +0 -0
  86. /package/dist/chunks/{chunk-EYCASCZZ.js.map → chunk-CGZZAOM3.js.map} +0 -0
  87. /package/dist/chunks/{chunk-E3GOWVGE.js.map → chunk-DFGGKZAN.js.map} +0 -0
  88. /package/dist/chunks/{chunk-OVOCG3EH.js.map → chunk-EUFLKDG6.js.map} +0 -0
  89. /package/dist/chunks/{chunk-Z7XLQDDV.js.map → chunk-GBSX7ZFZ.js.map} +0 -0
  90. /package/dist/chunks/{chunk-G3TIGCWK.js.map → chunk-H7JRG6GI.js.map} +0 -0
  91. /package/dist/chunks/{chunk-JNUPACSU.js.map → chunk-JR6WEANS.js.map} +0 -0
  92. /package/dist/chunks/{chunk-36QGYDNX.js.map → chunk-LXJ7DTNX.js.map} +0 -0
  93. /package/dist/chunks/{chunk-XHUT5RDY.js.map → chunk-PKYLKUGU.js.map} +0 -0
  94. /package/dist/chunks/{chunk-I4NKYTRH.js.map → chunk-RZJ36LG4.js.map} +0 -0
  95. /package/dist/chunks/{chunk-O6QFZAP2.js.map → chunk-VXNVO5KJ.js.map} +0 -0
  96. /package/dist/chunks/{chunk-MLAJ6ZIG.js.map → chunk-XMSKDE7G.js.map} +0 -0
  97. /package/dist/chunks/{chunk-HFWISJ3W.js.map → chunk-YLDVAXIV.js.map} +0 -0
  98. /package/dist/chunks/{cli-runtime-NB4HBCBU.js.map → cli-runtime-42P3ZY2L.js.map} +0 -0
  99. /package/dist/chunks/{doctor-N7PH4K4N.js.map → doctor-D7H7UXX6.js.map} +0 -0
  100. /package/dist/chunks/{drain-555N6B62.js.map → drain-SQ2VZUFJ.js.map} +0 -0
  101. /package/dist/chunks/{exec-LSYIE23V.js.map → exec-XFV5IMJK.js.map} +0 -0
  102. /package/dist/chunks/{host-queries-FV3F52SM.js.map → host-queries-HBSQEKUN.js.map} +0 -0
  103. /package/dist/chunks/{learn-XV2UYYVX.js.map → learn-M5HKRVLA.js.map} +0 -0
  104. /package/dist/chunks/{learn-builtin-W37PQFJV.js.map → learn-builtin-WLEJOPPA.js.map} +0 -0
  105. /package/dist/chunks/{lifecycle-OJC7MXNX.js.map → lifecycle-7YYVKNQ4.js.map} +0 -0
  106. /package/dist/chunks/{list-IKFFQ2WL.js.map → list-OKJHK375.js.map} +0 -0
  107. /package/dist/chunks/{live-JVMAGAIE.js.map → live-A5IU5I6S.js.map} +0 -0
  108. /package/dist/chunks/{mcp-KJ3RGN3D.js.map → mcp-MNISFJGL.js.map} +0 -0
  109. /package/dist/chunks/{message-command-SNUKD4UM.js.map → message-command-X2JR6V5A.js.map} +0 -0
  110. /package/dist/chunks/{pal-DUQ2OASI.js.map → pal-3GWS24QH.js.map} +0 -0
  111. /package/dist/chunks/{resident-RAXXTDAY.js.map → resident-QR32XZKI.js.map} +0 -0
  112. /package/dist/chunks/{schedule-QIA3XRIE.js.map → schedule-VGYXOLXD.js.map} +0 -0
  113. /package/dist/chunks/{service-MVWDIVXD.js.map → service-TNJWG2JK.js.map} +0 -0
  114. /package/dist/chunks/{session-step-JL6A7XWG.js.map → session-step-2A6KZCPC.js.map} +0 -0
  115. /package/dist/chunks/{start-check-LNDBVE4T.js.map → start-check-XGAFZVD7.js.map} +0 -0
  116. /package/dist/chunks/{upgrade-27Z2TXDS.js.map → upgrade-HQWKNEAA.js.map} +0 -0
@@ -14,7 +14,7 @@ import {
14
14
  confirmationView,
15
15
  describeChanges,
16
16
  permissionsChanged
17
- } from "./chunk-76GATJYU.js";
17
+ } from "./chunk-6DZX5T3S.js";
18
18
  import {
19
19
  visibleScheduleMessage
20
20
  } from "./chunk-NADQQMMG.js";
@@ -59,7 +59,7 @@ import {
59
59
  useReducedMotion,
60
60
  useThemeEpoch,
61
61
  useThemeSubscription
62
- } from "./chunk-MS2IMZPW.js";
62
+ } from "./chunk-MDA27KYF.js";
63
63
  import {
64
64
  handleTerminationSignals
65
65
  } from "./chunk-WVNXGMNE.js";
@@ -98,12 +98,12 @@ import {
98
98
  } from "./chunk-XH5YF2YX.js";
99
99
  import {
100
100
  settleAnsweredPark
101
- } from "./chunk-I4NKYTRH.js";
101
+ } from "./chunk-RZJ36LG4.js";
102
102
  import {
103
103
  DELIVERY_READ_LIMIT,
104
104
  readSourceDeliveryPage,
105
105
  takeSuppressedCount
106
- } from "./chunk-I73NPSRQ.js";
106
+ } from "./chunk-ACEUJQLA.js";
107
107
  import {
108
108
  callsCount
109
109
  } from "./chunk-HFY2647W.js";
@@ -120,14 +120,14 @@ import {
120
120
  runsPerDay,
121
121
  scriptShellUnavailableReason,
122
122
  verifyScheduledScript
123
- } from "./chunk-EXQE56JO.js";
123
+ } from "./chunk-BP62WUCC.js";
124
124
  import "./chunk-R4FHPOJJ.js";
125
125
  import {
126
126
  allowsCommands,
127
127
  compileJobPolicy,
128
128
  compileScriptCheckPolicy,
129
129
  isPresetName
130
- } from "./chunk-HFWISJ3W.js";
130
+ } from "./chunk-YLDVAXIV.js";
131
131
  import {
132
132
  formatResumeShellCommand,
133
133
  parkedRunWords,
@@ -178,20 +178,20 @@ import {
178
178
  sectionHeading,
179
179
  withAutoChoice,
180
180
  writeConversationExport
181
- } from "./chunk-6GGXRCTW.js";
181
+ } from "./chunk-7EO7AVNF.js";
182
182
  import {
183
183
  tuiPalDefinition,
184
184
  tuiPalEnvironment,
185
185
  tuiPalOwner,
186
186
  tuiPalPreferences
187
- } from "./chunk-MLAJ6ZIG.js";
187
+ } from "./chunk-XMSKDE7G.js";
188
188
  import {
189
189
  isModelOnlyContext,
190
190
  runtimeContextLabel
191
191
  } from "./chunk-FJONRQQU.js";
192
192
  import "./chunk-RSAZJF3I.js";
193
193
  import "./chunk-ZWA2JRJV.js";
194
- import "./chunk-G3TIGCWK.js";
194
+ import "./chunk-H7JRG6GI.js";
195
195
  import "./chunk-EPV5O6RP.js";
196
196
  import {
197
197
  claimPalConversation,
@@ -249,6 +249,7 @@ import {
249
249
  hiddenLinesHint,
250
250
  hintRows,
251
251
  isSessionPlanPath,
252
+ maybeCreateDecisionModel,
252
253
  mergeGroups,
253
254
  modelListingCause,
254
255
  mustAskPerson,
@@ -278,7 +279,7 @@ import {
278
279
  webLiveStatus,
279
280
  webSettledLine,
280
281
  withDebugDetail
281
- } from "./chunk-36QGYDNX.js";
282
+ } from "./chunk-LXJ7DTNX.js";
282
283
  import {
283
284
  openManagedWorktrees,
284
285
  worktreeOpenHint
@@ -325,7 +326,7 @@ import {
325
326
  isSelfMending,
326
327
  isSpentAllowance
327
328
  } from "./chunk-C3YZAJ2Z.js";
328
- import "./chunk-SVMUXZQE.js";
329
+ import "./chunk-BWSU3DAY.js";
329
330
  import {
330
331
  describeBrowserStatus
331
332
  } from "./chunk-WHODOMXA.js";
@@ -369,14 +370,14 @@ import {
369
370
  } from "./chunk-PRNBQTUI.js";
370
371
  import {
371
372
  startAutoUpdate
372
- } from "./chunk-EYCASCZZ.js";
373
+ } from "./chunk-CGZZAOM3.js";
373
374
  import {
374
375
  readManifest
375
376
  } from "./chunk-AK2U3N2A.js";
376
377
  import {
377
378
  resolveNpmInvocation
378
- } from "./chunk-JNUPACSU.js";
379
- import "./chunk-XHUT5RDY.js";
379
+ } from "./chunk-JR6WEANS.js";
380
+ import "./chunk-PKYLKUGU.js";
380
381
  import {
381
382
  ScheduleConflictError,
382
383
  confirmationHolds,
@@ -426,7 +427,7 @@ import {
426
427
  pendingServersMessage,
427
428
  readPermissionLayers,
428
429
  resolveComposerTriggers
429
- } from "./chunk-4X3I6SZF.js";
430
+ } from "./chunk-3C34WF54.js";
430
431
  import "./chunk-KONYGNG6.js";
431
432
  import "./chunk-LCGXWCVU.js";
432
433
  import {
@@ -33994,7 +33995,7 @@ var import_react61 = __toESM(require_react(), 1);
33994
33995
 
33995
33996
  // src/tui/App.tsx
33996
33997
  import { existsSync as existsSync3, rmSync as rmSync2 } from "node:fs";
33997
- import { join as join9, relative as relative3, resolve as resolve7 } from "node:path";
33998
+ import { join as join10, relative as relative3, resolve as resolve7 } from "node:path";
33998
33999
  var import_react60 = __toESM(require_react(), 1);
33999
34000
 
34000
34001
  // src/tui/system-rows.ts
@@ -34430,33 +34431,33 @@ function workflowRowVariants(workflow, now) {
34430
34431
  const count2 = `${workflow.done}/${workflow.total}`;
34431
34432
  const elapsed2 = formatElapsed(Math.max(0, (workflow.endedAt ?? now) - workflow.startedAt));
34432
34433
  const spent = workflow.tokens === void 0 ? void 0 : formatCompactCount(workflow.tokens);
34433
- const join12 = /* @__PURE__ */ __name((parts) => parts.filter((part) => part !== void 0).join(" \xB7 "), "join");
34434
+ const join13 = /* @__PURE__ */ __name((parts) => parts.filter((part) => part !== void 0).join(" \xB7 "), "join");
34434
34435
  const [wide, mid, narrow] = WORKFLOW_BAR_WIDTHS;
34435
34436
  const warned = workflow.large ? [
34436
34437
  {
34437
34438
  barWidth: wide,
34438
- text: join12([count2, elapsed2, spent && `\u2193 ${spent} tokens`, LARGE_WORKFLOW_WARNING])
34439
+ text: join13([count2, elapsed2, spent && `\u2193 ${spent} tokens`, LARGE_WORKFLOW_WARNING])
34439
34440
  },
34440
34441
  {
34441
34442
  barWidth: wide,
34442
- text: join12([count2, elapsed2, spent && `\u2193 ${spent} tokens`, LARGE_WORKFLOW_WARNING_SHORT])
34443
+ text: join13([count2, elapsed2, spent && `\u2193 ${spent} tokens`, LARGE_WORKFLOW_WARNING_SHORT])
34443
34444
  },
34444
34445
  {
34445
34446
  barWidth: wide,
34446
- text: join12([elapsed2, spent && `\u2193 ${spent}`, LARGE_WORKFLOW_WARNING_SHORT])
34447
+ text: join13([elapsed2, spent && `\u2193 ${spent}`, LARGE_WORKFLOW_WARNING_SHORT])
34447
34448
  }
34448
34449
  ] : [];
34449
34450
  const variants = [
34450
34451
  ...warned,
34451
34452
  {
34452
34453
  barWidth: wide,
34453
- text: join12([count2, elapsed2, spent && `\u2193 ${spent} tokens`])
34454
+ text: join13([count2, elapsed2, spent && `\u2193 ${spent} tokens`])
34454
34455
  },
34455
- { barWidth: wide, text: join12([elapsed2, spent && `\u2193 ${spent} tokens`]) },
34456
- { barWidth: wide, text: join12([elapsed2, spent && `\u2193 ${spent}`]) },
34457
- { barWidth: wide, text: join12([spent && `\u2193 ${spent}`]) },
34458
- { barWidth: mid, text: join12([spent && `\u2193 ${spent}`]) },
34459
- { barWidth: narrow, text: join12([spent && `\u2193 ${spent}`]) },
34456
+ { barWidth: wide, text: join13([elapsed2, spent && `\u2193 ${spent} tokens`]) },
34457
+ { barWidth: wide, text: join13([elapsed2, spent && `\u2193 ${spent}`]) },
34458
+ { barWidth: wide, text: join13([spent && `\u2193 ${spent}`]) },
34459
+ { barWidth: mid, text: join13([spent && `\u2193 ${spent}`]) },
34460
+ { barWidth: narrow, text: join13([spent && `\u2193 ${spent}`]) },
34460
34461
  { barWidth: narrow, text: "" }
34461
34462
  ];
34462
34463
  return variants.filter(
@@ -40014,6 +40015,123 @@ function hostAccountFacts(input) {
40014
40015
  }
40015
40016
  __name(hostAccountFacts, "hostAccountFacts");
40016
40017
 
40018
+ // src/integrations/decision/notify-worthy.ts
40019
+ var NOTIFY_WORTHY_TAIL_CHARS = 1200;
40020
+ var NOTIFY_WORTHY_INSTRUCTIONS = "Would a person who stepped away from the terminal want to be called back right now? Answer yes when the reply asks them something, needs their decision or approval, hands over a finished result, or reports a failure they must act on. Answer no for progress notes, acknowledgements, and a short answer to something they just asked and are watching for.";
40021
+ function printable(text) {
40022
+ let out = "";
40023
+ for (const ch of text) {
40024
+ const code = ch.codePointAt(0) ?? 0;
40025
+ if (code < 32 && code !== 10 && code !== 9 || code === 127) continue;
40026
+ out += ch;
40027
+ }
40028
+ return out;
40029
+ }
40030
+ __name(printable, "printable");
40031
+ function notifyWorthyQuestion(input) {
40032
+ const chars = [...printable(input.reply).trim()];
40033
+ const tail = chars.slice(-NOTIFY_WORTHY_TAIL_CHARS).join("");
40034
+ const seconds = Math.round(input.turnMs / 1e3);
40035
+ return {
40036
+ point: "notify-worthy",
40037
+ state: `${tail}
40038
+
40039
+ [the turn took ${seconds}s]`,
40040
+ instructions: NOTIFY_WORTHY_INSTRUCTIONS,
40041
+ rule: input.rule
40042
+ };
40043
+ }
40044
+ __name(notifyWorthyQuestion, "notifyWorthyQuestion");
40045
+
40046
+ // src/integrations/decision/points.ts
40047
+ import { appendFileSync, mkdirSync as mkdirSync2, renameSync, statSync as statSync2 } from "node:fs";
40048
+ import { join as join3 } from "node:path";
40049
+ var DEFAULT_TIMEOUT_MS2 = 1500;
40050
+ var LOG_ROTATE_BYTES = 1e6;
40051
+ function createDecisionPoints(options) {
40052
+ const { model } = options;
40053
+ const now = options.now ?? Date.now;
40054
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS2;
40055
+ const log = options.log ?? appendDecisionLog;
40056
+ const mode = /* @__PURE__ */ __name((point) => model === void 0 ? "off" : options.modes?.[point] ?? "off", "mode");
40057
+ return {
40058
+ mode,
40059
+ async ask(question, signal) {
40060
+ const current = mode(question.point);
40061
+ if (current === "off" || model === void 0) return void 0;
40062
+ const startedAt = now();
40063
+ const controller = new AbortController();
40064
+ let timer;
40065
+ const onOuterAbort = /* @__PURE__ */ __name(() => controller.abort(), "onOuterAbort");
40066
+ signal?.addEventListener("abort", onOuterAbort, { once: true });
40067
+ if (signal?.aborted) controller.abort();
40068
+ let p;
40069
+ let outcome = "answered";
40070
+ try {
40071
+ const timedOut = new Promise((_, reject) => {
40072
+ timer = setTimeout(() => {
40073
+ controller.abort();
40074
+ reject(new Error("timeout"));
40075
+ }, timeoutMs);
40076
+ });
40077
+ const answer = await Promise.race([
40078
+ model.yesno(question.state, question.instructions, { signal: controller.signal }),
40079
+ timedOut
40080
+ ]);
40081
+ p = answer.p;
40082
+ if (typeof p !== "number" || !Number.isFinite(p) || p < 0 || p > 1) {
40083
+ p = void 0;
40084
+ outcome = "error";
40085
+ }
40086
+ } catch (error) {
40087
+ outcome = error instanceof Error && error.message === "timeout" ? "timeout" : "error";
40088
+ } finally {
40089
+ if (timer !== void 0) clearTimeout(timer);
40090
+ signal?.removeEventListener("abort", onOuterAbort);
40091
+ }
40092
+ try {
40093
+ log({
40094
+ at: startedAt,
40095
+ point: question.point,
40096
+ mode: current,
40097
+ ...p !== void 0 ? { p } : {},
40098
+ rule: question.rule,
40099
+ latencyMs: Math.max(0, now() - startedAt),
40100
+ outcome,
40101
+ chars: question.state.length
40102
+ });
40103
+ } catch {
40104
+ }
40105
+ return current === "on" ? p : void 0;
40106
+ }
40107
+ };
40108
+ }
40109
+ __name(createDecisionPoints, "createDecisionPoints");
40110
+ function appendDecisionLog(entry, home = namzuHomePath()) {
40111
+ try {
40112
+ const directory = join3(home, "decision");
40113
+ const file = join3(directory, "points.jsonl");
40114
+ mkdirSync2(directory, { recursive: true, mode: 448 });
40115
+ try {
40116
+ if (statSync2(file).size >= LOG_ROTATE_BYTES) renameSync(file, `${file}.1`);
40117
+ } catch {
40118
+ }
40119
+ appendFileSync(file, `${JSON.stringify(entry)}
40120
+ `, { mode: 384 });
40121
+ } catch {
40122
+ }
40123
+ }
40124
+ __name(appendDecisionLog, "appendDecisionLog");
40125
+ var CONFIDENT_YES = 0.7;
40126
+ var CONFIDENT_NO = 0.3;
40127
+ function verdictOf(p) {
40128
+ if (p === void 0) return "unsure";
40129
+ if (p >= CONFIDENT_YES) return "yes";
40130
+ if (p <= CONFIDENT_NO) return "no";
40131
+ return "unsure";
40132
+ }
40133
+ __name(verdictOf, "verdictOf");
40134
+
40017
40135
  // src/integrations/mcp/person-commands.ts
40018
40136
  var MCP_PERSON_USAGE = [
40019
40137
  "/mcp prompts [server]",
@@ -40106,8 +40224,8 @@ __name(mcpPersonCommand, "mcpPersonCommand");
40106
40224
 
40107
40225
  // src/integrations/notifications/sound.ts
40108
40226
  import { spawn as spawn2 } from "node:child_process";
40109
- import { existsSync as existsSync2, mkdirSync as mkdirSync2, renameSync, statSync as statSync2, writeFileSync } from "node:fs";
40110
- import { join as join3 } from "node:path";
40227
+ import { existsSync as existsSync2, mkdirSync as mkdirSync3, renameSync as renameSync2, statSync as statSync3, writeFileSync } from "node:fs";
40228
+ import { join as join4 } from "node:path";
40111
40229
 
40112
40230
  // src/integrations/notifications/sound/chime.ts
40113
40231
  var FIGURES = {
@@ -40188,6 +40306,15 @@ function soundFor(moment, turnMs) {
40188
40306
  return turnMs !== void 0 && turnMs >= SOUND_MIN_TURN_MS ? "done" : void 0;
40189
40307
  }
40190
40308
  __name(soundFor, "soundFor");
40309
+ function soundForVerdict(moment, turnMs, verdict) {
40310
+ if (moment.kind !== "turn-settled" || moment.outcome !== "completed") {
40311
+ return soundFor(moment, turnMs);
40312
+ }
40313
+ if (verdict === "yes") return "done";
40314
+ if (verdict === "no") return void 0;
40315
+ return soundFor(moment, turnMs);
40316
+ }
40317
+ __name(soundForVerdict, "soundForVerdict");
40191
40318
  var PLAY_SCRIPT = "$ErrorActionPreference = 'Stop'; (New-Object System.Media.SoundPlayer $env:NAMZU_SOUND_FILE).PlaySync()";
40192
40319
  var POWERSHELL_ARGS = [
40193
40320
  "-NoProfile",
@@ -40200,7 +40327,7 @@ var POWERSHELL_ARGS = [
40200
40327
  function onPath(env3, exists, name) {
40201
40328
  for (const dir of (env3.PATH ?? "").split(":")) {
40202
40329
  if (!dir || dir.startsWith("/mnt/")) continue;
40203
- const candidate = join3(dir, name);
40330
+ const candidate = join4(dir, name);
40204
40331
  if (exists(candidate)) return candidate;
40205
40332
  }
40206
40333
  return void 0;
@@ -40252,20 +40379,20 @@ function selectSoundPlayer(probe = {}) {
40252
40379
  }
40253
40380
  __name(selectSoundPlayer, "selectSoundPlayer");
40254
40381
  function soundFilePath(kind, home = namzuHomePath()) {
40255
- return join3(home, "cache", "sound", `namzu-${kind}-v1.wav`);
40382
+ return join4(home, "cache", "sound", `namzu-${kind}-v1.wav`);
40256
40383
  }
40257
40384
  __name(soundFilePath, "soundFilePath");
40258
40385
  function ensureSoundFile(kind, home) {
40259
40386
  const file = soundFilePath(kind, home);
40260
40387
  const wav = chimeWav(kind);
40261
40388
  try {
40262
- if (statSync2(file).size === wav.length) return file;
40389
+ if (statSync3(file).size === wav.length) return file;
40263
40390
  } catch {
40264
40391
  }
40265
- mkdirSync2(join3(file, ".."), { recursive: true });
40392
+ mkdirSync3(join4(file, ".."), { recursive: true });
40266
40393
  const staging = `${file}.${process.pid}.tmp`;
40267
40394
  writeFileSync(staging, wav);
40268
- renameSync(staging, file);
40395
+ renameSync2(staging, file);
40269
40396
  return file;
40270
40397
  }
40271
40398
  __name(ensureSoundFile, "ensureSoundFile");
@@ -40291,7 +40418,7 @@ function playMoment(moment, turnMs, options = {}) {
40291
40418
  const env3 = options.env ?? process.env;
40292
40419
  if (options.enabled === false || options.isTTY === false) return void 0;
40293
40420
  if (env3[SOUND_KILL_SWITCH] === "1") return void 0;
40294
- const kind = soundFor(moment, turnMs);
40421
+ const kind = soundForVerdict(moment, turnMs, options.verdict);
40295
40422
  if (!kind) return void 0;
40296
40423
  const now = (options.now ?? Date.now)();
40297
40424
  if (now - lastPlayedAt < SOUND_SPACING_MS) return void 0;
@@ -41617,7 +41744,7 @@ __name(loadImageFiles, "loadImageFiles");
41617
41744
  // src/integrations/clipboard/image.ts
41618
41745
  import { spawn as spawn3 } from "node:child_process";
41619
41746
  import { readFile as readFile2, rm } from "node:fs/promises";
41620
- import { join as join4 } from "node:path";
41747
+ import { join as join5 } from "node:path";
41621
41748
  var MAX_IMAGE_BASE64_BYTES = 5 * 1024 * 1024;
41622
41749
  function imageFitsProvider(image2) {
41623
41750
  return image2.data.length <= MAX_IMAGE_BASE64_BYTES;
@@ -41818,7 +41945,7 @@ async function readLinux(run4, wsl, readText, fit2) {
41818
41945
  __name(readLinux, "readLinux");
41819
41946
  async function readMac(run4, fit2) {
41820
41947
  const dir = await createTempDir("clip-");
41821
- const file = join4(dir, "clip.png");
41948
+ const file = join5(dir, "clip.png");
41822
41949
  try {
41823
41950
  const result = await run4(
41824
41951
  "osascript",
@@ -41957,7 +42084,7 @@ import {
41957
42084
  openSync,
41958
42085
  readSync,
41959
42086
  realpathSync,
41960
- statSync as statSync3
42087
+ statSync as statSync4
41961
42088
  } from "node:fs";
41962
42089
  import { resolve as resolve2, sep } from "node:path";
41963
42090
  import { StringDecoder } from "node:string_decoder";
@@ -41970,7 +42097,7 @@ function readMentionFile(cwd2, rel, range, maxChars, budget) {
41970
42097
  const abs = realpathSync(resolve2(root, rel));
41971
42098
  const inside = /* @__PURE__ */ __name((path) => path === root || path.startsWith(root + sep), "inside");
41972
42099
  if (!inside(abs)) return null;
41973
- const before = statSync3(abs);
42100
+ const before = statSync4(abs);
41974
42101
  if (!before.isFile()) return null;
41975
42102
  fd = openSync(abs, constants2.O_RDONLY | constants2.O_NOFOLLOW | constants2.O_NONBLOCK);
41976
42103
  const opened = fstatSync(fd);
@@ -45037,12 +45164,12 @@ __name(GlowRule, "GlowRule");
45037
45164
 
45038
45165
  // src/tui/CopyPicker.tsx
45039
45166
  var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
45040
- function CopyPicker({ targets, selected }) {
45167
+ function CopyPicker({ targets, selected, mode = "copy" }) {
45041
45168
  const { start, items: visible } = selectionWindow(targets, selected);
45042
45169
  const terminal = use_window_size_default();
45043
45170
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: theme.border.focus, paddingX: 1, children: [
45044
45171
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Box_default, { justifyContent: "space-between", children: [
45045
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { color: theme.accent.user, bold: true, children: "Copy from response" }),
45172
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { color: theme.accent.user, bold: true, children: mode === "run" ? "Run from response" : "Copy from response" }),
45046
45173
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text, { color: theme.text.muted, children: [
45047
45174
  selected + 1,
45048
45175
  "/",
@@ -45074,7 +45201,11 @@ function CopyPicker({ targets, selected }) {
45074
45201
  { text: "PgUp/PgDn jump", rank: 1 },
45075
45202
  { text: "Home/End", rank: 1 },
45076
45203
  { text: "1\u20139 select", rank: 2 },
45077
- { text: "enter copy", rank: 5 },
45204
+ {
45205
+ text: mode === "run" ? "enter put in prompt" : "enter copy",
45206
+ short: "enter",
45207
+ rank: 5
45208
+ },
45078
45209
  { text: "esc cancel", short: "esc", rank: 5 }
45079
45210
  ],
45080
45211
  boxedHintWidth(terminal.columns)
@@ -47840,9 +47971,9 @@ function editLine(text, key) {
47840
47971
  if (key.ctrl || key.meta || key.tab || key.return || key.escape) return null;
47841
47972
  if (key.upArrow || key.downArrow || key.leftArrow || key.rightArrow || key.pageUp || key.pageDown || key.home || key.end)
47842
47973
  return null;
47843
- const printable2 = key.input.replace(/[\u0000-\u001f\u007f]/g, "");
47844
- if (printable2.length === 0) return null;
47845
- return text + printable2;
47974
+ const printable3 = key.input.replace(/[\u0000-\u001f\u007f]/g, "");
47975
+ if (printable3.length === 0) return null;
47976
+ return text + printable3;
47846
47977
  }
47847
47978
  __name(editLine, "editLine");
47848
47979
  function resumeScopeLabel(scope) {
@@ -48270,10 +48401,10 @@ function confirmKey(state, input, key, env3) {
48270
48401
  };
48271
48402
  }
48272
48403
  if (input && !key.ctrl && !key.meta) {
48273
- const printable2 = [...input].filter((ch) => !isControl(ch)).join("");
48274
- if (printable2) {
48404
+ const printable3 = [...input].filter((ch) => !isControl(ch)).join("");
48405
+ if (printable3) {
48275
48406
  return {
48276
- state: { ...state, texts: { ...state.texts, [slot]: state.texts[slot] + printable2 } }
48407
+ state: { ...state, texts: { ...state.texts, [slot]: state.texts[slot] + printable3 } }
48277
48408
  };
48278
48409
  }
48279
48410
  }
@@ -50362,6 +50493,31 @@ function quoteHasProse(lines2) {
50362
50493
  return false;
50363
50494
  }
50364
50495
  __name(quoteHasProse, "quoteHasProse");
50496
+ var SHELL_LANGUAGES = /* @__PURE__ */ new Set([
50497
+ "sh",
50498
+ "bash",
50499
+ "shell",
50500
+ "zsh",
50501
+ "console",
50502
+ "shellsession",
50503
+ "terminal"
50504
+ ]);
50505
+ function runnableCommands(source) {
50506
+ const out = [];
50507
+ for (const target of copyTargetsForResponse(source)) {
50508
+ if (target.kind !== "code") continue;
50509
+ const language = target.label.endsWith(" code") ? target.label.slice(0, -5).toLowerCase() : void 0;
50510
+ if (language !== void 0 && !SHELL_LANGUAGES.has(language)) continue;
50511
+ const lines2 = target.text.replace(/\r\n/gu, "\n").replace(/\n+$/u, "").split("\n");
50512
+ const content = lines2.filter((line) => line.trim() !== "");
50513
+ if (content.length === 0 || content.every((line) => line.trim().startsWith("#"))) continue;
50514
+ const prompted = content.every((line) => /^\$ /u.test(line));
50515
+ const text = (prompted ? lines2.map((line) => line.replace(/^\$ /u, "")) : lines2).join("\n");
50516
+ out.push({ label: target.label, text });
50517
+ }
50518
+ return out;
50519
+ }
50520
+ __name(runnableCommands, "runnableCommands");
50365
50521
 
50366
50522
  // src/tui/edit-prompts.ts
50367
50523
  function editablePrompts(history, transcript) {
@@ -50393,7 +50549,7 @@ __name(editablePrompts, "editablePrompts");
50393
50549
  // src/tui/external-editor.ts
50394
50550
  import { spawn as spawn4 } from "node:child_process";
50395
50551
  import { lstat, mkdtemp, readFile as readFile4, rm as rm2, writeFile } from "node:fs/promises";
50396
- import { join as join5 } from "node:path";
50552
+ import { join as join6 } from "node:path";
50397
50553
  var MAX_EDITED_DRAFT_BYTES = 4 * 1024 * 1024;
50398
50554
  var ExternalEditorError = class extends Error {
50399
50555
  static {
@@ -50479,8 +50635,8 @@ __name(resolveExternalEditorCommand, "resolveExternalEditorCommand");
50479
50635
  async function editDraftInExternalEditor(seed, options) {
50480
50636
  options.signal?.throwIfAborted();
50481
50637
  const command = resolveExternalEditorCommand(options.env, options.pressed);
50482
- const directory = options.temporaryRoot === void 0 ? await createTempDir("editor-") : await mkdtemp(join5(options.temporaryRoot, "namzu-editor-"));
50483
- const draftPath = join5(directory, "draft.md");
50638
+ const directory = options.temporaryRoot === void 0 ? await createTempDir("editor-") : await mkdtemp(join6(options.temporaryRoot, "namzu-editor-"));
50639
+ const draftPath = join6(directory, "draft.md");
50484
50640
  let edited;
50485
50641
  let failure;
50486
50642
  try {
@@ -51084,7 +51240,7 @@ var AskQueue = class {
51084
51240
  };
51085
51241
 
51086
51242
  // src/tui/plugin-view.ts
51087
- import { join as join6 } from "node:path";
51243
+ import { join as join7 } from "node:path";
51088
51244
  function pluginOption(plugin) {
51089
51245
  return {
51090
51246
  label: plugin.name,
@@ -51127,9 +51283,9 @@ function emptyPluginReport(config, cwd2) {
51127
51283
  const reason = config?.enabled !== true ? "Plugins are off. Set plugins.enabled: true in your Namzu configuration to load trusted plugins at startup." : config.autoDiscovery === false ? "Plugin discovery is off (plugins.autoDiscovery: false)." : scopes.length === 0 ? "No plugin scopes are allowed (plugins.allowedScopes: [])." : "No plugins are loaded in this conversation.";
51128
51284
  return [
51129
51285
  reason,
51130
- `Configuration: ${join6(home, "config.yaml")}`,
51131
- ...scopes.includes("project") ? [`Project plugins: ${join6(cwd2, ".namzu", "plugins")}`] : [],
51132
- ...scopes.includes("user") ? [`User plugins: ${join6(home, "plugins")}`] : [],
51286
+ `Configuration: ${join7(home, "config.yaml")}`,
51287
+ ...scopes.includes("project") ? [`Project plugins: ${join7(cwd2, ".namzu", "plugins")}`] : [],
51288
+ ...scopes.includes("user") ? [`User plugins: ${join7(home, "plugins")}`] : [],
51133
51289
  "Each plugin directory contains plugin.json. Only Namzu plugin manifests are supported.",
51134
51290
  "Tools, hooks and MCP servers can execute code. Enable only plugins you trust, then restart Namzu."
51135
51291
  ].map(choiceDisplayText).join("\n");
@@ -52563,7 +52719,7 @@ __name(prepareScheduledResume, "prepareScheduledResume");
52563
52719
 
52564
52720
  // src/tui/schedule/startup.ts
52565
52721
  import { readFileSync as readFileSync6 } from "node:fs";
52566
- import { join as join7 } from "node:path";
52722
+ import { join as join8 } from "node:path";
52567
52723
  function ago(ms) {
52568
52724
  if (ms < 36e5) return `${Math.max(1, Math.round(ms / 6e4))} min`;
52569
52725
  if (ms < 1728e5) return `${Math.round(ms / 36e5)} h`;
@@ -52645,7 +52801,7 @@ function scheduleStartupLine(home, cwd2, now = Date.now()) {
52645
52801
  parts.push("The scheduler is installed but has not started \u2014 namzu schedule status");
52646
52802
  }
52647
52803
  }
52648
- const suppressed = takeSuppressedCount(join7(paths.daemon, "notify.json"));
52804
+ const suppressed = takeSuppressedCount(join8(paths.daemon, "notify.json"));
52649
52805
  if (suppressed > 0)
52650
52806
  parts.push(
52651
52807
  `${plural(suppressed, "scheduled notification")} ${suppressed === 1 ? "was" : "were"} held back`
@@ -53699,12 +53855,12 @@ function setSkillSuggestions(on, opts = {}) {
53699
53855
  __name(setSkillSuggestions, "setSkillSuggestions");
53700
53856
 
53701
53857
  // src/tui/skills/suggestion-ledger.ts
53702
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync7, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
53703
- import { dirname, join as join8 } from "node:path";
53858
+ import { mkdirSync as mkdirSync4, readFileSync as readFileSync7, renameSync as renameSync3, writeFileSync as writeFileSync2 } from "node:fs";
53859
+ import { dirname, join as join9 } from "node:path";
53704
53860
  var SUGGESTION_IGNORE_LIMIT = 3;
53705
53861
  var FRESH_LEDGER = { v: 1, unanswered: 0, stopped: false };
53706
53862
  function suggestionLedgerPath(namzuHome) {
53707
- return join8(namzuHome, "skills", ".suggestions.json");
53863
+ return join9(namzuHome, "skills", ".suggestions.json");
53708
53864
  }
53709
53865
  __name(suggestionLedgerPath, "suggestionLedgerPath");
53710
53866
  function readSuggestionLedger(namzuHome) {
@@ -53720,11 +53876,11 @@ __name(readSuggestionLedger, "readSuggestionLedger");
53720
53876
  function writeSuggestionLedger(namzuHome, ledger) {
53721
53877
  const path = suggestionLedgerPath(namzuHome);
53722
53878
  try {
53723
- mkdirSync3(dirname(path), { recursive: true });
53879
+ mkdirSync4(dirname(path), { recursive: true });
53724
53880
  const temp = `${path}.${process.pid}.tmp`;
53725
53881
  writeFileSync2(temp, `${JSON.stringify(ledger)}
53726
53882
  `, { mode: 384 });
53727
- renameSync2(temp, path);
53883
+ renameSync3(temp, path);
53728
53884
  } catch {
53729
53885
  }
53730
53886
  }
@@ -55868,10 +56024,10 @@ var TITLE_ANIMATION_MS = 960;
55868
56024
  var TITLE_NAME_MAX = 100;
55869
56025
  var OSC_SET_TITLE_AND_ICON = "\x1B]0;";
55870
56026
  var BEL4 = "\x07";
55871
- function printable(text) {
56027
+ function printable2(text) {
55872
56028
  return text.replace(/[\u0000-\u001f\u007f-\u009f]+/gu, " ").replace(/\s+/gu, " ").trim();
55873
56029
  }
55874
- __name(printable, "printable");
56030
+ __name(printable2, "printable");
55875
56031
  function titleAnimates(input) {
55876
56032
  return input.working && input.focused && !underMultiplexer(input.env);
55877
56033
  }
@@ -55881,7 +56037,7 @@ function underMultiplexer(env3) {
55881
56037
  }
55882
56038
  __name(underMultiplexer, "underMultiplexer");
55883
56039
  function terminalTitleText(input) {
55884
- const name = [input.named, input.generated, DEFAULT_TERMINAL_TITLE].map((candidate) => printable(candidate ?? "")).find((candidate) => candidate.length > 0);
56040
+ const name = [input.named, input.generated, DEFAULT_TERMINAL_TITLE].map((candidate) => printable2(candidate ?? "")).find((candidate) => candidate.length > 0);
55885
56041
  const shown = name.length > TITLE_NAME_MAX ? `${name.slice(0, TITLE_NAME_MAX - 1)}\u2026` : name;
55886
56042
  const frames = BUSY_TITLE_FRAMES.length;
55887
56043
  const glyph = input.busy ? BUSY_TITLE_FRAMES[((input.frame ?? 0) % frames + frames) % frames] ?? BUSY_TITLE_GLYPH : IDLE_TITLE_GLYPH;
@@ -55889,7 +56045,7 @@ function terminalTitleText(input) {
55889
56045
  }
55890
56046
  __name(terminalTitleText, "terminalTitleText");
55891
56047
  function setTerminalTitleSequence(text) {
55892
- return `${OSC_SET_TITLE_AND_ICON}${printable(text)}${BEL4}`;
56048
+ return `${OSC_SET_TITLE_AND_ICON}${printable2(text)}${BEL4}`;
55893
56049
  }
55894
56050
  __name(setTerminalTitleSequence, "setTerminalTitleSequence");
55895
56051
  var RESET_TERMINAL_TITLE_SEQUENCE = `${OSC_SET_TITLE_AND_ICON}${BEL4}`;
@@ -57551,7 +57707,7 @@ ${blocks.join("\n\n")}`;
57551
57707
  const scope = scopeRef.current;
57552
57708
  if (!sessions || !scope || !conversationMaterializedRef.current) return void 0;
57553
57709
  try {
57554
- return join9(sessions.paths.sessionDir({ sessionId: scope.sessionId }), "loops.json");
57710
+ return join10(sessions.paths.sessionDir({ sessionId: scope.sessionId }), "loops.json");
57555
57711
  } catch {
57556
57712
  return void 0;
57557
57713
  }
@@ -59240,6 +59396,16 @@ ${blocks.join("\n\n")}`;
59240
59396
  const picker = copyPickerRef.current;
59241
59397
  const target = picker?.targets[index];
59242
59398
  if (!picker || !target) return;
59399
+ if (picker.mode === "run") {
59400
+ setCopyPicker(null);
59401
+ composerDraftTokenRef.current += 1;
59402
+ setComposerDraft({ token: composerDraftTokenRef.current, text: `!${target.text}` });
59403
+ pushMessage(
59404
+ "system",
59405
+ "The command is in the prompt: press Enter to run it, or edit it first."
59406
+ );
59407
+ return;
59408
+ }
59243
59409
  setCopyPicker(null);
59244
59410
  const origin = picker.provenance === "persisted" ? "the latest saved reply" : "the latest normally completed answer";
59245
59411
  const selection = target.kind === "whole" ? origin : `${target.label} from ${origin}`;
@@ -59252,8 +59418,15 @@ ${blocks.join("\n\n")}`;
59252
59418
  },
59253
59419
  [clipboard, pushMessage, setCopyPicker, pushSystem]
59254
59420
  );
59421
+ const decisionPointsRef = (0, import_react60.useRef)(null);
59422
+ if (decisionPointsRef.current === null) {
59423
+ decisionPointsRef.current = createDecisionPoints({
59424
+ model: maybeCreateDecisionModel(ctx.decision, process.env),
59425
+ modes: ctx.decision?.points
59426
+ });
59427
+ }
59255
59428
  const sendTerminalNotification = (0, import_react60.useCallback)(
59256
- (notification, turnMs) => {
59429
+ (notification, turnMs, reply) => {
59257
59430
  if (notification.kind === "approval-required") {
59258
59431
  session?.notifyHooks?.({
59259
59432
  type: "approval_required",
@@ -59270,10 +59443,17 @@ ${blocks.join("\n\n")}`;
59270
59443
  message: notification.outcome === "completed" ? "The turn completed." : notification.outcome === "stopped" ? "The turn stopped and needs attention." : "The turn failed."
59271
59444
  });
59272
59445
  }
59273
- playMoment(notification, turnMs, {
59274
- enabled: ctx.tui?.sound !== false,
59275
- isTTY: stdout.isTTY
59276
- });
59446
+ const sound = { enabled: ctx.tui?.sound !== false, isTTY: stdout.isTTY };
59447
+ const points = decisionPointsRef.current;
59448
+ if (reply !== void 0 && sound.enabled && notification.kind === "turn-settled" && notification.outcome === "completed" && points?.mode("notify-worthy") !== "off") {
59449
+ void points?.ask(
59450
+ notifyWorthyQuestion({
59451
+ reply,
59452
+ turnMs: turnMs ?? 0,
59453
+ rule: soundFor(notification, turnMs) !== void 0
59454
+ })
59455
+ ).then((p) => playMoment(notification, turnMs, { ...sound, verdict: verdictOf(p) }));
59456
+ } else playMoment(notification, turnMs, sound);
59277
59457
  if (!terminalNotificationEnabled(ctx.tui?.notifications, notification)) return;
59278
59458
  const result = writeTerminalNotification(
59279
59459
  notification,
@@ -60601,7 +60781,7 @@ ${blocks.join("\n\n")}`;
60601
60781
  doctorRunningRef.current = true;
60602
60782
  const progressId = pushMessage("system", "Checking\u2026");
60603
60783
  try {
60604
- const { runLiveDoctor } = await import("./live-JVMAGAIE.js");
60784
+ const { runLiveDoctor } = await import("./live-A5IU5I6S.js");
60605
60785
  const { describePlainDoctor } = await import("./plain-report-XVPBQDLE.js");
60606
60786
  const report = await runLiveDoctor({
60607
60787
  ...ctxRef.current.telemetry ? { telemetry: ctxRef.current.telemetry } : {}
@@ -63199,7 +63379,8 @@ ${jobLines.map(([, line]) => `- ${line}`).join("\n")}`] : []
63199
63379
  if (ownsTurn && !ac.signal.aborted && !goalRound && st.notification && (roundQueueRef.current.items().length === 0 || shouldPauseQueued)) {
63200
63380
  sendTerminalNotification(
63201
63381
  st.notification,
63202
- st.startedAt !== void 0 ? Date.now() - st.startedAt : void 0
63382
+ st.startedAt !== void 0 ? Date.now() - st.startedAt : void 0,
63383
+ st.text
63203
63384
  );
63204
63385
  }
63205
63386
  }
@@ -63754,7 +63935,7 @@ ${jobLines.map(([, line]) => `- ${line}`).join("\n")}`] : []
63754
63935
  }
63755
63936
  try {
63756
63937
  const sameSignIn = accounts.registry.list("codex").find(
63757
- (other) => other.source.kind === "codex-home" && readCodexCredentialFile(join9(other.source.dir, "auth.json"))?.accountId === result.accountId
63938
+ (other) => other.source.kind === "codex-home" && readCodexCredentialFile(join10(other.source.dir, "auth.json"))?.accountId === result.accountId
63758
63939
  );
63759
63940
  if (sameSignIn) {
63760
63941
  rmSync2(dir, { recursive: true, force: true });
@@ -65437,6 +65618,36 @@ ${plugins.map((plugin) => {
65437
65618
  });
65438
65619
  return;
65439
65620
  }
65621
+ case "run": {
65622
+ const target = lastCompletedOutputRef.current;
65623
+ const commands = target ? runnableCommands(target.text) : [];
65624
+ if (!target || commands.length === 0) {
65625
+ pushMessage(
65626
+ "system",
65627
+ "No command to run in the latest answer \u2014 /run looks for shell code blocks in the latest answer that finished normally."
65628
+ );
65629
+ return;
65630
+ }
65631
+ if (commands.length === 1) {
65632
+ composerDraftTokenRef.current += 1;
65633
+ setComposerDraft({
65634
+ token: composerDraftTokenRef.current,
65635
+ text: `!${commands[0]?.text ?? ""}`
65636
+ });
65637
+ pushMessage(
65638
+ "system",
65639
+ "The command is in the prompt: press Enter to run it, or edit it first."
65640
+ );
65641
+ return;
65642
+ }
65643
+ setSelectedCopy(0);
65644
+ setCopyPicker({
65645
+ targets: commands.map((c) => ({ kind: "code", label: c.label, text: c.text })),
65646
+ provenance: target.provenance,
65647
+ mode: "run"
65648
+ });
65649
+ return;
65650
+ }
65440
65651
  case "raw": {
65441
65652
  const enabled = slash.enabled === "toggle" ? !rawOutput : slash.enabled;
65442
65653
  setRawOutput(enabled);
@@ -67588,7 +67799,14 @@ ${plugins.map((plugin) => {
67588
67799
  extra: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ThemeSample, { width: Math.max(10, (terminal.columns ?? 80) - 6) })
67589
67800
  } : {}
67590
67801
  }
67591
- ) : permission === null && scheduleReviewPrompt === null && !childSurfaceOpen && copyPicker ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CopyPicker, { targets: copyPicker.targets, selected: selectedCopy }) : null,
67802
+ ) : permission === null && scheduleReviewPrompt === null && !childSurfaceOpen && copyPicker ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
67803
+ CopyPicker,
67804
+ {
67805
+ targets: copyPicker.targets,
67806
+ selected: selectedCopy,
67807
+ ...copyPicker.mode ? { mode: copyPicker.mode } : {}
67808
+ }
67809
+ ) : null,
67592
67810
  scrollOpen && permission === null && scheduleReviewPrompt === null ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
67593
67811
  TranscriptScrollView,
67594
67812
  {
@@ -68195,12 +68413,12 @@ __name(installFocusReporting, "installFocusReporting");
68195
68413
 
68196
68414
  // src/tui/hint-counts.ts
68197
68415
  import { randomUUID } from "node:crypto";
68198
- import { mkdirSync as mkdirSync4, readFileSync as readFileSync8, renameSync as renameSync3, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "node:fs";
68199
- import { dirname as dirname2, join as join10 } from "node:path";
68416
+ import { mkdirSync as mkdirSync5, readFileSync as readFileSync8, renameSync as renameSync4, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "node:fs";
68417
+ import { dirname as dirname2, join as join11 } from "node:path";
68200
68418
  var FILE_MODE = 384;
68201
68419
  var DIR_MODE = 448;
68202
68420
  function hintCountsPath(home) {
68203
- return join10(namzuHomePath(home), "hint-counts.json");
68421
+ return join11(namzuHomePath(home), "hint-counts.json");
68204
68422
  }
68205
68423
  __name(hintCountsPath, "hintCountsPath");
68206
68424
  function readAll(path) {
@@ -68225,12 +68443,12 @@ function writeHintCount(name, count2, home) {
68225
68443
  const path = hintCountsPath(home);
68226
68444
  const temp = `${path}.${randomUUID()}.tmp`;
68227
68445
  try {
68228
- mkdirSync4(dirname2(path), { recursive: true, mode: DIR_MODE });
68446
+ mkdirSync5(dirname2(path), { recursive: true, mode: DIR_MODE });
68229
68447
  writeFileSync3(temp, `${JSON.stringify({ ...readAll(path), [name]: count2 }, null, 2)}
68230
68448
  `, {
68231
68449
  mode: FILE_MODE
68232
68450
  });
68233
- renameSync3(temp, path);
68451
+ renameSync4(temp, path);
68234
68452
  } catch {
68235
68453
  rmSync3(temp, { force: true });
68236
68454
  }
@@ -68364,13 +68582,13 @@ __name(askTerminal, "askTerminal");
68364
68582
 
68365
68583
  // src/tui/tip-history.ts
68366
68584
  import { randomUUID as randomUUID2 } from "node:crypto";
68367
- import { mkdirSync as mkdirSync5, readFileSync as readFileSync9, renameSync as renameSync4, rmSync as rmSync4, writeFileSync as writeFileSync4 } from "node:fs";
68368
- import { dirname as dirname3, join as join11 } from "node:path";
68585
+ import { mkdirSync as mkdirSync6, readFileSync as readFileSync9, renameSync as renameSync5, rmSync as rmSync4, writeFileSync as writeFileSync4 } from "node:fs";
68586
+ import { dirname as dirname3, join as join12 } from "node:path";
68369
68587
  var FILE_MODE2 = 384;
68370
68588
  var DIR_MODE2 = 448;
68371
68589
  var EMPTY_TIP_HISTORY = { launches: 0, shown: {}, used: {} };
68372
68590
  function tipHistoryPath(home) {
68373
- return join11(namzuHomePath(home), "tip-history.json");
68591
+ return join12(namzuHomePath(home), "tip-history.json");
68374
68592
  }
68375
68593
  __name(tipHistoryPath, "tipHistoryPath");
68376
68594
  function wholeNumber(value) {
@@ -68404,10 +68622,10 @@ __name(readTipHistory, "readTipHistory");
68404
68622
  function writeTipHistory(path, history) {
68405
68623
  const temp = `${path}.${randomUUID2()}.tmp`;
68406
68624
  try {
68407
- mkdirSync5(dirname3(path), { recursive: true, mode: DIR_MODE2 });
68625
+ mkdirSync6(dirname3(path), { recursive: true, mode: DIR_MODE2 });
68408
68626
  writeFileSync4(temp, `${JSON.stringify(history, null, 2)}
68409
68627
  `, { mode: FILE_MODE2 });
68410
- renameSync4(temp, path);
68628
+ renameSync5(temp, path);
68411
68629
  } catch {
68412
68630
  try {
68413
68631
  rmSync4(temp, { force: true });
@@ -68829,4 +69047,4 @@ react/cjs/react-jsx-runtime.development.js:
68829
69047
  * LICENSE file in the root directory of this source tree.
68830
69048
  *)
68831
69049
  */
68832
- //# sourceMappingURL=tui-MXWQWWGT.js.map
69050
+ //# sourceMappingURL=tui-2PZSAL7N.js.map