orion-super-agent-dev 0.1.18 → 0.1.19

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.
package/out/main.js CHANGED
@@ -2230,7 +2230,7 @@ var require_react_jsx_runtime_development = __commonJS({
2230
2230
  if (process.env.NODE_ENV !== "production") {
2231
2231
  (function() {
2232
2232
  "use strict";
2233
- var React31 = require_react();
2233
+ var React32 = require_react();
2234
2234
  var REACT_ELEMENT_TYPE = Symbol.for("react.element");
2235
2235
  var REACT_PORTAL_TYPE = Symbol.for("react.portal");
2236
2236
  var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
@@ -2256,7 +2256,7 @@ var require_react_jsx_runtime_development = __commonJS({
2256
2256
  }
2257
2257
  return null;
2258
2258
  }
2259
- var ReactSharedInternals = React31.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2259
+ var ReactSharedInternals = React32.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2260
2260
  function error(format2) {
2261
2261
  {
2262
2262
  {
@@ -3201,7 +3201,7 @@ var require_string_width = __commonJS({
3201
3201
  var stripAnsi6 = require_strip_ansi();
3202
3202
  var isFullwidthCodePoint2 = require_is_fullwidth_code_point();
3203
3203
  var emojiRegex2 = require_emoji_regex();
3204
- var stringWidth5 = (string) => {
3204
+ var stringWidth6 = (string) => {
3205
3205
  if (typeof string !== "string" || string.length === 0) {
3206
3206
  return 0;
3207
3207
  }
@@ -3226,8 +3226,8 @@ var require_string_width = __commonJS({
3226
3226
  }
3227
3227
  return width;
3228
3228
  };
3229
- module2.exports = stringWidth5;
3230
- module2.exports.default = stringWidth5;
3229
+ module2.exports = stringWidth6;
3230
+ module2.exports.default = stringWidth6;
3231
3231
  }
3232
3232
  });
3233
3233
 
@@ -4336,7 +4336,7 @@ var require_ansi_styles = __commonJS({
4336
4336
  var require_wrap_ansi = __commonJS({
4337
4337
  "../node_modules/wrap-ansi/index.js"(exports2, module2) {
4338
4338
  "use strict";
4339
- var stringWidth5 = require_string_width();
4339
+ var stringWidth6 = require_string_width();
4340
4340
  var stripAnsi6 = require_strip_ansi();
4341
4341
  var ansiStyles2 = require_ansi_styles();
4342
4342
  var ESCAPES2 = /* @__PURE__ */ new Set([
@@ -4351,14 +4351,14 @@ var require_wrap_ansi = __commonJS({
4351
4351
  var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
4352
4352
  var wrapAnsi2 = (code) => `${ESCAPES2.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
4353
4353
  var wrapAnsiHyperlink = (uri) => `${ESCAPES2.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`;
4354
- var wordLengths = (string) => string.split(" ").map((character) => stringWidth5(character));
4354
+ var wordLengths = (string) => string.split(" ").map((character) => stringWidth6(character));
4355
4355
  var wrapWord = (rows, word, columns) => {
4356
4356
  const characters = [...word];
4357
4357
  let isInsideEscape = false;
4358
4358
  let isInsideLinkEscape = false;
4359
- let visible = stringWidth5(stripAnsi6(rows[rows.length - 1]));
4359
+ let visible = stringWidth6(stripAnsi6(rows[rows.length - 1]));
4360
4360
  for (const [index, character] of characters.entries()) {
4361
- const characterLength = stringWidth5(character);
4361
+ const characterLength = stringWidth6(character);
4362
4362
  if (visible + characterLength <= columns) {
4363
4363
  rows[rows.length - 1] += character;
4364
4364
  } else {
@@ -4394,7 +4394,7 @@ var require_wrap_ansi = __commonJS({
4394
4394
  const words = string.split(" ");
4395
4395
  let last = words.length;
4396
4396
  while (last > 0) {
4397
- if (stringWidth5(words[last - 1]) > 0) {
4397
+ if (stringWidth6(words[last - 1]) > 0) {
4398
4398
  break;
4399
4399
  }
4400
4400
  last--;
@@ -4417,7 +4417,7 @@ var require_wrap_ansi = __commonJS({
4417
4417
  if (options.trim !== false) {
4418
4418
  rows[rows.length - 1] = rows[rows.length - 1].trimStart();
4419
4419
  }
4420
- let rowLength = stringWidth5(rows[rows.length - 1]);
4420
+ let rowLength = stringWidth6(rows[rows.length - 1]);
4421
4421
  if (index !== 0) {
4422
4422
  if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
4423
4423
  rows.push("");
@@ -9963,9 +9963,9 @@ var require_react_reconciler_development = __commonJS({
9963
9963
  module2.exports = function $$$reconciler($$$hostConfig) {
9964
9964
  var exports3 = {};
9965
9965
  "use strict";
9966
- var React31 = require_react();
9966
+ var React32 = require_react();
9967
9967
  var Scheduler = require_scheduler();
9968
- var ReactSharedInternals = React31.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
9968
+ var ReactSharedInternals = React32.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
9969
9969
  var suppressWarning = false;
9970
9970
  function setSuppressWarning(newSuppressWarning) {
9971
9971
  {
@@ -28228,6 +28228,70 @@ var require_askAnswers = __commonJS({
28228
28228
  }
28229
28229
  });
28230
28230
 
28231
+ // ../packages/orion-client-core/dist/fileMentions.js
28232
+ var require_fileMentions = __commonJS({
28233
+ "../packages/orion-client-core/dist/fileMentions.js"(exports2) {
28234
+ "use strict";
28235
+ Object.defineProperty(exports2, "__esModule", { value: true });
28236
+ exports2.FILE_MENTION_LEADER = void 0;
28237
+ exports2.findFileMentionQuery = findFileMentionQuery3;
28238
+ exports2.insertFileMention = insertFileMention2;
28239
+ exports2.scanFileMentionRanges = scanFileMentionRanges2;
28240
+ exports2.toWorkspaceRelative = toWorkspaceRelative;
28241
+ exports2.FILE_MENTION_LEADER = "@";
28242
+ function findFileMentionQuery3(text, caret) {
28243
+ const before = text.slice(0, caret);
28244
+ const match = /(^|\s)@([^\s@]*)$/.exec(before);
28245
+ if (!match)
28246
+ return null;
28247
+ const token = match[0];
28248
+ const at = caret - token.length + token.lastIndexOf("@");
28249
+ return { start: at, end: caret, query: match[2] };
28250
+ }
28251
+ function insertFileMention2(text, at, path13) {
28252
+ const suffix = text.slice(at.end);
28253
+ const token = `${exports2.FILE_MENTION_LEADER}${path13}`;
28254
+ const closes = !path13.endsWith("/") && (suffix.length === 0 || !/^\s/.test(suffix));
28255
+ const inserted = `${token}${closes ? " " : ""}`;
28256
+ return {
28257
+ text: `${text.slice(0, at.start)}${inserted}${suffix}`,
28258
+ caret: at.start + inserted.length
28259
+ };
28260
+ }
28261
+ function scanFileMentionRanges2(text, paths) {
28262
+ if (paths.size === 0)
28263
+ return [];
28264
+ const ranges = [];
28265
+ const byLongest = [...paths].filter((p) => p.length > 0).sort((a, b2) => b2.length - a.length);
28266
+ for (const path13 of byLongest) {
28267
+ const token = `${exports2.FILE_MENTION_LEADER}${path13}`;
28268
+ for (let from = text.indexOf(token); from >= 0; from = text.indexOf(token, from + 1)) {
28269
+ const end = from + token.length;
28270
+ if (from > 0 && !/\s/.test(text[from - 1]))
28271
+ continue;
28272
+ if (end < text.length && !/\s/.test(text[end]))
28273
+ continue;
28274
+ if (ranges.some((r2) => from < r2.end && end > r2.start))
28275
+ continue;
28276
+ ranges.push({ start: from, end });
28277
+ }
28278
+ }
28279
+ return ranges.sort((a, b2) => a.start - b2.start);
28280
+ }
28281
+ function toWorkspaceRelative(path13, workspaceRoot) {
28282
+ if (!workspaceRoot)
28283
+ return path13;
28284
+ const root2 = workspaceRoot.replace(/\\/g, "/").replace(/\/+$/, "");
28285
+ const normalized = path13.replace(/\\/g, "/");
28286
+ if (normalized === root2)
28287
+ return normalized.slice(normalized.lastIndexOf("/") + 1);
28288
+ if (normalized.startsWith(`${root2}/`))
28289
+ return normalized.slice(root2.length + 1);
28290
+ return path13;
28291
+ }
28292
+ }
28293
+ });
28294
+
28231
28295
  // ../packages/orion-client-core/dist/trustFindings.js
28232
28296
  var require_trustFindings = __commonJS({
28233
28297
  "../packages/orion-client-core/dist/trustFindings.js"(exports2) {
@@ -35522,14 +35586,14 @@ var require_agentNarration = __commonJS({
35522
35586
  exports2.PARTIAL_TEXT_CAP = 2e4;
35523
35587
  exports2.ACTIVITY_CAP = 5;
35524
35588
  function describeChildActivity(name2, input) {
35525
- const clip = (v2, n) => {
35589
+ const clip2 = (v2, n) => {
35526
35590
  const s = String(v2 ?? "").trim();
35527
35591
  return s.length > n ? s.slice(0, n - 1) + "\u2026" : s;
35528
35592
  };
35529
35593
  const base = (v2) => {
35530
35594
  const s = String(v2 ?? "").trim();
35531
35595
  const leaf = s.split("/").filter(Boolean).pop() ?? s;
35532
- return clip(leaf, 40);
35596
+ return clip2(leaf, 40);
35533
35597
  };
35534
35598
  switch (name2) {
35535
35599
  case "read_file":
@@ -35541,23 +35605,23 @@ var require_agentNarration = __commonJS({
35541
35605
  case "bash":
35542
35606
  case "bash_background":
35543
35607
  case "powershell":
35544
- return `Running ${clip(input.command, 48)}`;
35608
+ return `Running ${clip2(input.command, 48)}`;
35545
35609
  case "grep":
35546
- return `Grepping "${clip(input.pattern, 40)}"`;
35610
+ return `Grepping "${clip2(input.pattern, 40)}"`;
35547
35611
  case "glob":
35548
- return `Globbing ${clip(input.pattern, 40)}`;
35612
+ return `Globbing ${clip2(input.pattern, 40)}`;
35549
35613
  case "list_dir":
35550
- return `Listing ${clip(input.path ?? ".", 40)}`;
35614
+ return `Listing ${clip2(input.path ?? ".", 40)}`;
35551
35615
  case "search_codebase":
35552
- return `Searching for "${clip(input.query, 40)}"`;
35616
+ return `Searching for "${clip2(input.query, 40)}"`;
35553
35617
  case "trace_codebase":
35554
- return `Tracing ${clip(input.target, 40)}`;
35618
+ return `Tracing ${clip2(input.target, 40)}`;
35555
35619
  case "web_fetch":
35556
- return `Fetching ${clip(input.url, 48)}`;
35620
+ return `Fetching ${clip2(input.url, 48)}`;
35557
35621
  case "web_search":
35558
- return `Searching the web for "${clip(input.query, 40)}"`;
35622
+ return `Searching the web for "${clip2(input.query, 40)}"`;
35559
35623
  case "spawn_agent":
35560
- return `Spawning ${clip(input.type, 24)} sub-agent`;
35624
+ return `Spawning ${clip2(input.type, 24)} sub-agent`;
35561
35625
  case "update_plan":
35562
35626
  return "Updating the plan";
35563
35627
  // The child's own progress note IS the activity line — deriving "agent progress" from the
@@ -35565,9 +35629,9 @@ var require_agentNarration = __commonJS({
35565
35629
  // meaningful one. Empty (no note yet, because a streamed call starts before its input
35566
35630
  // lands) pushes nothing at all; the handler supplies the line a moment later.
35567
35631
  case "agent_progress":
35568
- return clip(input.note, 48);
35632
+ return clip2(input.note, 48);
35569
35633
  default:
35570
- return clip(name2.replace(/_/g, " "), 48);
35634
+ return clip2(name2.replace(/_/g, " "), 48);
35571
35635
  }
35572
35636
  }
35573
35637
  function launchedText(entry) {
@@ -37613,9 +37677,9 @@ var require_agentAuth = __commonJS({
37613
37677
  function formatUsageBar2(pct2, width = 12) {
37614
37678
  if (pct2 === null || pct2 === void 0)
37615
37679
  return "No limit";
37616
- const clamped = Math.max(0, Math.min(100, Math.round(pct2)));
37617
- const filled = clamped === 0 ? 0 : clamped === 100 ? width : Math.min(width - 1, Math.max(1, Math.round(clamped / 100 * width)));
37618
- return `${"\u2588".repeat(filled)}${"\u2591".repeat(Math.max(0, width - filled))} ${clamped}%`;
37680
+ const clamped2 = Math.max(0, Math.min(100, Math.round(pct2)));
37681
+ const filled = clamped2 === 0 ? 0 : clamped2 === 100 ? width : Math.min(width - 1, Math.max(1, Math.round(clamped2 / 100 * width)));
37682
+ return `${"\u2588".repeat(filled)}${"\u2591".repeat(Math.max(0, width - filled))} ${clamped2}%`;
37619
37683
  }
37620
37684
  function formatResetDate(date, now2 = /* @__PURE__ */ new Date()) {
37621
37685
  const months = [
@@ -41395,7 +41459,7 @@ var require_activity = __commonJS({
41395
41459
  }
41396
41460
  return target;
41397
41461
  }
41398
- function clip(text) {
41462
+ function clip2(text) {
41399
41463
  const flat = text.replace(/\s+/g, " ").trim();
41400
41464
  return flat.length > TEXT_CAP ? `${flat.slice(0, TEXT_CAP - 1)}\u2026` : flat;
41401
41465
  }
@@ -41410,7 +41474,7 @@ var require_activity = __commonJS({
41410
41474
  }
41411
41475
  const input = typeof data.input === "object" && data.input !== null ? data.input : {};
41412
41476
  const target = typeof input.path === "string" ? relativize(input.path, workspaceRoot) : typeof input.file_path === "string" ? relativize(input.file_path, workspaceRoot) : typeof input.command === "string" ? input.command : typeof input.pattern === "string" ? input.pattern : typeof input.query === "string" ? input.query : typeof input.url === "string" ? input.url : "";
41413
- return clip(target === "" ? verb.replace(/:$/, "") : `${verb} ${target}`);
41477
+ return clip2(target === "" ? verb.replace(/:$/, "") : `${verb} ${target}`);
41414
41478
  }
41415
41479
  var ActivityRing = class {
41416
41480
  entries = [];
@@ -43087,9 +43151,7 @@ var require_steerPromotion = __commonJS({
43087
43151
  "use strict";
43088
43152
  Object.defineProperty(exports2, "__esModule", { value: true });
43089
43153
  exports2.promoteLeftoverSteers = promoteLeftoverSteers2;
43090
- function promoteLeftoverSteers2(outcome, leftovers) {
43091
- if (outcome === "cancelled")
43092
- return null;
43154
+ function promoteLeftoverSteers2(leftovers) {
43093
43155
  const kept = leftovers.map((text) => text.trim()).filter((text) => text.length > 0);
43094
43156
  if (kept.length === 0)
43095
43157
  return null;
@@ -43237,7 +43299,7 @@ var require_zipReader = __commonJS({
43237
43299
  var EOCD_SIG = 101010256;
43238
43300
  var CENTRAL_SIG = 33639248;
43239
43301
  var LOCAL_SIG = 67324752;
43240
- var MAX_ENTRIES2 = 2e3;
43302
+ var MAX_ENTRIES = 2e3;
43241
43303
  var MAX_TOTAL_BYTES = 100 * 1024 * 1024;
43242
43304
  var u16 = (b2, o) => b2[o] | b2[o + 1] << 8;
43243
43305
  var u32 = (b2, o) => (b2[o] | b2[o + 1] << 8 | b2[o + 2] << 16 | b2[o + 3] << 24) >>> 0;
@@ -43265,7 +43327,7 @@ var require_zipReader = __commonJS({
43265
43327
  throw new Error("not a zip archive (no end-of-central-directory)");
43266
43328
  const count = u16(bytes, eocd + 10);
43267
43329
  const cdOffset = u32(bytes, eocd + 16);
43268
- if (count > MAX_ENTRIES2)
43330
+ if (count > MAX_ENTRIES)
43269
43331
  throw new Error(`zip has too many entries (${count})`);
43270
43332
  const out2 = [];
43271
43333
  let total = 0;
@@ -44617,6 +44679,58 @@ var require_types3 = __commonJS({
44617
44679
  }
44618
44680
  });
44619
44681
 
44682
+ // ../packages/orion-client-core/dist/attachments/pathAttachment.js
44683
+ var require_pathAttachment = __commonJS({
44684
+ "../packages/orion-client-core/dist/attachments/pathAttachment.js"(exports2) {
44685
+ "use strict";
44686
+ Object.defineProperty(exports2, "__esModule", { value: true });
44687
+ exports2.INLINE_IMAGE_MAX_BYTES = void 0;
44688
+ exports2.attachmentBaseName = attachmentBaseName;
44689
+ exports2.attachmentExtension = attachmentExtension;
44690
+ exports2.shouldInlineImage = shouldInlineImage;
44691
+ exports2.pathAttachment = pathAttachment;
44692
+ var types_1 = require_types3();
44693
+ function attachmentBaseName(p) {
44694
+ const trimmed = p.replace(/[/\\]+$/, "");
44695
+ if (!trimmed) {
44696
+ return p;
44697
+ }
44698
+ const cut = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
44699
+ return cut === -1 ? trimmed : trimmed.slice(cut + 1);
44700
+ }
44701
+ function attachmentExtension(p) {
44702
+ const base = attachmentBaseName(p);
44703
+ const dot = base.lastIndexOf(".");
44704
+ return dot > 0 ? base.slice(dot).toLowerCase() : "";
44705
+ }
44706
+ exports2.INLINE_IMAGE_MAX_BYTES = 10 * 1024 * 1024;
44707
+ var INLINABLE_IMAGE_MIMES = /* @__PURE__ */ new Set([
44708
+ "image/png",
44709
+ "image/jpeg",
44710
+ "image/gif",
44711
+ "image/webp",
44712
+ "image/bmp"
44713
+ ]);
44714
+ function shouldInlineImage(mime, sizeBytes) {
44715
+ return INLINABLE_IMAGE_MIMES.has(mime) && sizeBytes <= exports2.INLINE_IMAGE_MAX_BYTES;
44716
+ }
44717
+ function pathAttachment(absPath, opts) {
44718
+ const name2 = attachmentBaseName(absPath);
44719
+ const videoMime = types_1.VIDEO_EXT[attachmentExtension(absPath)];
44720
+ if (videoMime) {
44721
+ return { kind: "video", mime: videoMime, path: absPath, name: name2, size_bytes: opts.sizeBytes };
44722
+ }
44723
+ return {
44724
+ kind: "file",
44725
+ path: absPath,
44726
+ name: name2,
44727
+ size_bytes: opts.sizeBytes,
44728
+ ...opts.mime ? { mime: opts.mime } : {}
44729
+ };
44730
+ }
44731
+ }
44732
+ });
44733
+
44620
44734
  // ../packages/orion-client-core/dist/video/budget.js
44621
44735
  var require_budget = __commonJS({
44622
44736
  "../packages/orion-client-core/dist/video/budget.js"(exports2) {
@@ -44640,9 +44754,9 @@ var require_budget = __commonJS({
44640
44754
  };
44641
44755
  exports2.VideoArgError = VideoArgError;
44642
44756
  function clampFps(fps, durationSeconds, maxFrames) {
44643
- const clamped = Math.min(fps, exports2.MAX_FPS);
44644
- const target = Math.min(maxFrames, Math.max(1, Math.round(clamped * durationSeconds)));
44645
- return { fps: clamped, target };
44757
+ const clamped2 = Math.min(fps, exports2.MAX_FPS);
44758
+ const target = Math.min(maxFrames, Math.max(1, Math.round(clamped2 * durationSeconds)));
44759
+ return { fps: clamped2, target };
44646
44760
  }
44647
44761
  function parseTime(value) {
44648
44762
  if (value === null || value === void 0)
@@ -46121,7 +46235,7 @@ var require_terminalOutputFilters = __commonJS({
46121
46235
  function compactForSummary(line, maxChars) {
46122
46236
  return cleanLine(line.replace(/\s+/g, " ").trim(), maxChars);
46123
46237
  }
46124
- function commandLabel2(profile) {
46238
+ function commandLabel3(profile) {
46125
46239
  return profile.label || "terminal";
46126
46240
  }
46127
46241
  function header(level, label, detail) {
@@ -46430,16 +46544,16 @@ var require_terminalOutputFilters = __commonJS({
46430
46544
  function filterBuildOutput(input, lines) {
46431
46545
  const spec = SPECS[input.level];
46432
46546
  if (failureLikely(lines, input.exitCode)) {
46433
- return failureOutput(input, lines, commandLabel2(input.profile));
46547
+ return failureOutput(input, lines, commandLabel3(input.profile));
46434
46548
  }
46435
46549
  const kept = tailMeaningful(lines.filter((line) => !isNoiseLine(line)), spec);
46436
46550
  if (input.level === "ultra") {
46437
- return `${commandLabel2(input.profile)} ok`;
46551
+ return `${commandLabel3(input.profile)} ok`;
46438
46552
  }
46439
46553
  if (input.level === "full") {
46440
- return limitLines([header(input.level, commandLabel2(input.profile), "ok; noisy lines removed"), ...kept], spec);
46554
+ return limitLines([header(input.level, commandLabel3(input.profile), "ok; noisy lines removed"), ...kept], spec);
46441
46555
  }
46442
- return limitLines([header(input.level, commandLabel2(input.profile), "ok; reduced noisy output"), ...kept], spec);
46556
+ return limitLines([header(input.level, commandLabel3(input.profile), "ok; reduced noisy output"), ...kept], spec);
46443
46557
  }
46444
46558
  function logKey(line) {
46445
46559
  return line.replace(/\b\d{4}-\d{2}-\d{2}[T ][0-9:.+-]+Z?\b/g, "<time>").replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi, "<uuid>").replace(/\b0x[0-9a-f]+\b/gi, "<hex>").replace(/\/[\w./-]+/g, "<path>").replace(/\b\d{4,}\b/g, "<num>").replace(/\s+/g, " ").trim().toLowerCase();
@@ -48332,7 +48446,7 @@ var require_retrievalTokens = __commonJS({
48332
48446
  exports2.tokenizeSearchText = tokenizeSearchText;
48333
48447
  exports2.tokenizeContentText = tokenizeContentText;
48334
48448
  exports2.pathSegments = pathSegments;
48335
- exports2.basenameOf = basenameOf;
48449
+ exports2.basenameOf = basenameOf2;
48336
48450
  exports2.stripExtension = stripExtension;
48337
48451
  exports2.acronymForPath = acronymForPath;
48338
48452
  exports2.isConfigPath = isConfigPath;
@@ -48441,7 +48555,7 @@ var require_retrievalTokens = __commonJS({
48441
48555
  function pathSegments(path13) {
48442
48556
  return path13.replace(/\\/g, "/").split("/").filter(Boolean);
48443
48557
  }
48444
- function basenameOf(path13) {
48558
+ function basenameOf2(path13) {
48445
48559
  const parts2 = pathSegments(path13);
48446
48560
  return parts2.at(-1) ?? path13;
48447
48561
  }
@@ -58123,14 +58237,14 @@ var require_runtimeTrace = __commonJS({
58123
58237
  return redactTraceText(raw);
58124
58238
  }
58125
58239
  }
58126
- function clip(text, max) {
58240
+ function clip2(text, max) {
58127
58241
  return text.length <= max ? text : text.slice(0, max - 1) + "\u2026";
58128
58242
  }
58129
58243
  function finish(input) {
58130
58244
  return {
58131
58245
  ...input,
58132
- text: clip(redactTraceText(input.text), exports2.TRACE_TEXT_MAX),
58133
- url: input.url ? clip(redactTraceUrl(input.url), exports2.TRACE_URL_MAX) : void 0
58246
+ text: clip2(redactTraceText(input.text), exports2.TRACE_TEXT_MAX),
58247
+ url: input.url ? clip2(redactTraceUrl(input.url), exports2.TRACE_URL_MAX) : void 0
58134
58248
  };
58135
58249
  }
58136
58250
  function traceFromConsole(type, text) {
@@ -58479,12 +58593,12 @@ var require_browserController = __commonJS({
58479
58593
  if (errors.length) {
58480
58594
  lines.push("", "Console errors:");
58481
58595
  for (const e of errors.slice(-MAX_CONSOLE))
58482
- lines.push(` \u2022 ${clip(e.text, 300)}`);
58596
+ lines.push(` \u2022 ${clip2(e.text, 300)}`);
58483
58597
  }
58484
58598
  if (this.netFailures.length) {
58485
58599
  lines.push("", "Failed network requests:");
58486
58600
  for (const f of this.netFailures.slice(-MAX_NET_FAILURES))
58487
- lines.push(` \u2022 ${clip(f, 300)}`);
58601
+ lines.push(` \u2022 ${clip2(f, 300)}`);
58488
58602
  }
58489
58603
  return lines.join("\n");
58490
58604
  }
@@ -58581,7 +58695,7 @@ var require_browserController = __commonJS({
58581
58695
  function errMsg(e) {
58582
58696
  return e instanceof Error ? e.message : String(e);
58583
58697
  }
58584
- function clip(s, n) {
58698
+ function clip2(s, n) {
58585
58699
  return s.length > n ? s.slice(0, n) + "\u2026" : s;
58586
58700
  }
58587
58701
  }
@@ -58807,8 +58921,8 @@ var require_toolExecutor = __commonJS({
58807
58921
  if (closest) {
58808
58922
  return [
58809
58923
  `old_string not found in ${path14}.`,
58810
- `You sent (first line): ${clip(oldFirstLine, 120)}`,
58811
- `Closest match in file (line ${closest.lineNumber}): ${clip(closest.line, 120)}`,
58924
+ `You sent (first line): ${clip2(oldFirstLine, 120)}`,
58925
+ `Closest match in file (line ${closest.lineNumber}): ${clip2(closest.line, 120)}`,
58812
58926
  `Re-read the file with read_file to get the literal bytes, then retry edit_file.`
58813
58927
  ].join("\n");
58814
58928
  }
@@ -58900,7 +59014,7 @@ var require_toolExecutor = __commonJS({
58900
59014
  `Make it unique by adding more surrounding context, OR set replace_all: true to change every occurrence.`
58901
59015
  ].join("\n");
58902
59016
  }
58903
- function clip(s, n) {
59017
+ function clip2(s, n) {
58904
59018
  return s.length > n ? s.slice(0, n) + "\u2026" : s;
58905
59019
  }
58906
59020
  function clipLines(s, maxLines) {
@@ -62085,7 +62199,7 @@ var require_capture = __commonJS({
62085
62199
  var HARD_WON_THRESHOLD = 2;
62086
62200
  var SUMMARY_MAX = 300;
62087
62201
  var digest = (text) => (0, crypto_1.createHash)("sha1").update(text, "utf8").digest("hex");
62088
- var clip = (text) => text.length <= SUMMARY_MAX ? text : text.slice(0, SUMMARY_MAX - 1) + "\u2026";
62202
+ var clip2 = (text) => text.length <= SUMMARY_MAX ? text : text.slice(0, SUMMARY_MAX - 1) + "\u2026";
62089
62203
  function firstString(params, keys) {
62090
62204
  for (const key of keys) {
62091
62205
  const value = params[key];
@@ -62126,7 +62240,7 @@ var require_capture = __commonJS({
62126
62240
  this.thisTurnAnchors.clear();
62127
62241
  this.turn += 1;
62128
62242
  this.turnOptedOut = OPT_OUT_RE.test(text);
62129
- this.turnGoal = clip(text.trim());
62243
+ this.turnGoal = clip2(text.trim());
62130
62244
  this.waveGroup = void 0;
62131
62245
  this.pendingVotes.clear();
62132
62246
  if (this.turnOptedOut) {
@@ -62136,7 +62250,7 @@ var require_capture = __commonJS({
62136
62250
  if (CORRECTION_RE.test(text.trim()) && this.lastTurnAnchors.length > 0) {
62137
62251
  this.push("user_correction", {
62138
62252
  anchors: this.lastTurnAnchors,
62139
- summary: clip(`user corrected the previous action: ${text.trim()}`)
62253
+ summary: clip2(`user corrected the previous action: ${text.trim()}`)
62140
62254
  });
62141
62255
  }
62142
62256
  }
@@ -62154,8 +62268,8 @@ var require_capture = __commonJS({
62154
62268
  this.push(isTest ? "test_failure" : "tool_failure", {
62155
62269
  tool: req.name,
62156
62270
  anchors,
62157
- summary: clip(`${req.name} failed${isTest ? " (test run)" : ""}: ${payload.error ?? "unknown error"}`),
62158
- payload: { error: clip(String(payload.error ?? "")) }
62271
+ summary: clip2(`${req.name} failed${isTest ? " (test run)" : ""}: ${payload.error ?? "unknown error"}`),
62272
+ payload: { error: clip2(String(payload.error ?? "")) }
62159
62273
  });
62160
62274
  return;
62161
62275
  }
@@ -62164,7 +62278,7 @@ var require_capture = __commonJS({
62164
62278
  this.push("hard_won_success", {
62165
62279
  tool: req.name,
62166
62280
  anchors,
62167
- summary: clip(`${req.name} succeeded after ${attempts} consecutive failures`),
62281
+ summary: clip2(`${req.name} succeeded after ${attempts} consecutive failures`),
62168
62282
  payload: { attempts }
62169
62283
  });
62170
62284
  }
@@ -62173,7 +62287,7 @@ var require_capture = __commonJS({
62173
62287
  this.push("edit_reverted", {
62174
62288
  tool: req.name,
62175
62289
  anchors: reverted.map((p) => this.relativize(p)),
62176
- summary: clip(`edit restored a prior state of ${reverted.map((p) => this.relativize(p)).join(", ")}`)
62290
+ summary: clip2(`edit restored a prior state of ${reverted.map((p) => this.relativize(p)).join(", ")}`)
62177
62291
  });
62178
62292
  }
62179
62293
  }
@@ -62185,7 +62299,7 @@ var require_capture = __commonJS({
62185
62299
  this.push("permission_denial", {
62186
62300
  tool: req.tool_name,
62187
62301
  anchors,
62188
- summary: clip(`user denied ${req.tool_name}`)
62302
+ summary: clip2(`user denied ${req.tool_name}`)
62189
62303
  });
62190
62304
  }
62191
62305
  /** The most recent lesson recall the backend reported this session (for `/o-vault popup`). */
@@ -62233,7 +62347,7 @@ var require_capture = __commonJS({
62233
62347
  if (!this.isCancellation(error)) {
62234
62348
  this.push("turn_error", {
62235
62349
  anchors: [...this.thisTurnAnchors],
62236
- summary: clip(`turn ended in error: ${error || "unknown"}`)
62350
+ summary: clip2(`turn ended in error: ${error || "unknown"}`)
62237
62351
  });
62238
62352
  }
62239
62353
  this.flushTurn();
@@ -62258,7 +62372,7 @@ var require_capture = __commonJS({
62258
62372
  return;
62259
62373
  this.push("generative_candidate", {
62260
62374
  anchors: [...this.thisTurnAnchors],
62261
- summary: clip(`friction-free code-touching turn: ${this.turnGoal || "(no goal text)"}`),
62375
+ summary: clip2(`friction-free code-touching turn: ${this.turnGoal || "(no goal text)"}`),
62262
62376
  payload: { goal: this.turnGoal }
62263
62377
  });
62264
62378
  }
@@ -62299,7 +62413,7 @@ var require_capture = __commonJS({
62299
62413
  return;
62300
62414
  this.appendDirect({
62301
62415
  kind: "sibling_outcome",
62302
- summary: clip(`sub-agent ${outcome.ordinal} [${outcome.type}] ${outcome.status}: ${outcome.summary || outcome.brief}`),
62416
+ summary: clip2(`sub-agent ${outcome.ordinal} [${outcome.type}] ${outcome.status}: ${outcome.summary || outcome.brief}`),
62303
62417
  payload: {
62304
62418
  agent_id: outcome.agentId,
62305
62419
  ordinal: outcome.ordinal,
@@ -62313,7 +62427,7 @@ var require_capture = __commonJS({
62313
62427
  worktree_branch: outcome.worktree.branch,
62314
62428
  worktree_kept: outcome.worktree.kept === true
62315
62429
  } : {},
62316
- brief: clip(outcome.brief)
62430
+ brief: clip2(outcome.brief)
62317
62431
  }
62318
62432
  }, outcome.team);
62319
62433
  }
@@ -62330,14 +62444,14 @@ var require_capture = __commonJS({
62330
62444
  this.appendDirect({
62331
62445
  kind: "vote_outcome",
62332
62446
  tool: "vote_and_gate_candidates",
62333
- summary: clip(`best-of-${vote.candidateCount} vote: ${winner ? `candidate ${winner[1]} won` : "winner unparsed"}${method ? ` (${method[1]})` : ""}`),
62447
+ summary: clip2(`best-of-${vote.candidateCount} vote: ${winner ? `candidate ${winner[1]} won` : "winner unparsed"}${method ? ` (${method[1]})` : ""}`),
62334
62448
  payload: {
62335
62449
  candidate_count: vote.candidateCount,
62336
62450
  ...vote.estimatedCosts.some((c3) => c3 > 0) ? { estimated_costs: vote.estimatedCosts } : {},
62337
62451
  ...winner ? { winner_index: Number(winner[1]) } : {},
62338
62452
  ...key ? { winner_key_hash: key[1] } : {},
62339
62453
  ...method ? { method: method[1] } : {},
62340
- ...distribution ? { distribution_raw: clip(distribution[1]) } : {}
62454
+ ...distribution ? { distribution_raw: clip2(distribution[1]) } : {}
62341
62455
  }
62342
62456
  });
62343
62457
  }
@@ -64516,7 +64630,7 @@ var require_flow = __commonJS({
64516
64630
  function planWaves(plan) {
64517
64631
  const byId = new Map(plan.phases.map((phase) => [phase.id, phase]));
64518
64632
  const depth = /* @__PURE__ */ new Map();
64519
- const depthOf = (id, visiting) => {
64633
+ const depthOf2 = (id, visiting) => {
64520
64634
  const cached = depth.get(id);
64521
64635
  if (cached !== void 0)
64522
64636
  return cached;
@@ -64528,7 +64642,7 @@ var require_flow = __commonJS({
64528
64642
  for (const need of phase.needs ?? []) {
64529
64643
  if (!byId.has(need))
64530
64644
  continue;
64531
- deepest = Math.max(deepest, depthOf(need, visiting) + 1);
64645
+ deepest = Math.max(deepest, depthOf2(need, visiting) + 1);
64532
64646
  }
64533
64647
  visiting.delete(id);
64534
64648
  depth.set(id, deepest);
@@ -64536,7 +64650,7 @@ var require_flow = __commonJS({
64536
64650
  };
64537
64651
  const waves = [];
64538
64652
  for (const phase of plan.phases) {
64539
- const level = depthOf(phase.id, /* @__PURE__ */ new Set());
64653
+ const level = depthOf2(phase.id, /* @__PURE__ */ new Set());
64540
64654
  (waves[level] ??= []).push(phase);
64541
64655
  }
64542
64656
  return waves.map((phases, index) => ({ index: index + 1, phases: phases ?? [] })).filter((wave) => wave.phases.length > 0);
@@ -66910,6 +67024,7 @@ var require_dist = __commonJS({
66910
67024
  __exportStar(require_shims(), exports2);
66911
67025
  __exportStar(require_protocol(), exports2);
66912
67026
  __exportStar(require_askAnswers(), exports2);
67027
+ __exportStar(require_fileMentions(), exports2);
66913
67028
  __exportStar(require_trustFindings(), exports2);
66914
67029
  __exportStar(require_compactionCard(), exports2);
66915
67030
  __exportStar(require_inputGuardCard(), exports2);
@@ -66975,6 +67090,7 @@ var require_dist = __commonJS({
66975
67090
  __exportStar(require_bashFileChanges(), exports2);
66976
67091
  __exportStar(require_multimodalRead(), exports2);
66977
67092
  __exportStar(require_toolText(), exports2);
67093
+ __exportStar(require_pathAttachment(), exports2);
66978
67094
  __exportStar(require_types3(), exports2);
66979
67095
  __exportStar(require_budget(), exports2);
66980
67096
  __exportStar(require_transcript(), exports2);
@@ -67930,6 +68046,51 @@ var require_subagentRow = __commonJS({
67930
68046
  }
67931
68047
  });
67932
68048
 
68049
+ // ../packages/orion-client-ui-core/dist/steerRow.js
68050
+ var require_steerRow = __commonJS({
68051
+ "../packages/orion-client-ui-core/dist/steerRow.js"(exports2) {
68052
+ "use strict";
68053
+ Object.defineProperty(exports2, "__esModule", { value: true });
68054
+ exports2.MACHINE_STEER_CAP = void 0;
68055
+ exports2.isEditableSteer = isEditableSteer2;
68056
+ exports2.mergeIntoDraft = mergeIntoDraft2;
68057
+ exports2.capMachineRows = capMachineRows2;
68058
+ function isEditableSteer2(row) {
68059
+ return (row.origin ?? "user") === "user";
68060
+ }
68061
+ function mergeIntoDraft2(restored, draft) {
68062
+ const kept = restored.filter((text2) => text2.trim().length > 0);
68063
+ if (kept.length === 0)
68064
+ return null;
68065
+ const prefix = kept.join("\n");
68066
+ const hasDraft = draft.text.length > 0;
68067
+ const text = hasDraft ? `${prefix}
68068
+ ${draft.text}` : prefix;
68069
+ const cursor = hasDraft ? prefix.length + 1 + draft.cursor : prefix.length;
68070
+ return { text, cursor: Math.min(Math.max(0, cursor), text.length) };
68071
+ }
68072
+ exports2.MACHINE_STEER_CAP = 3;
68073
+ function capMachineRows2(rows) {
68074
+ const shown = [];
68075
+ let machineShown = 0;
68076
+ let hidden = 0;
68077
+ for (const row of rows) {
68078
+ if (isEditableSteer2(row)) {
68079
+ shown.push(row);
68080
+ continue;
68081
+ }
68082
+ if (machineShown < exports2.MACHINE_STEER_CAP) {
68083
+ machineShown += 1;
68084
+ shown.push(row);
68085
+ continue;
68086
+ }
68087
+ hidden += 1;
68088
+ }
68089
+ return { shown, hidden };
68090
+ }
68091
+ }
68092
+ });
68093
+
67933
68094
  // ../packages/orion-client-ui-core/dist/index.js
67934
68095
  var require_dist2 = __commonJS({
67935
68096
  "../packages/orion-client-ui-core/dist/index.js"(exports2) {
@@ -67963,6 +68124,7 @@ var require_dist2 = __commonJS({
67963
68124
  __exportStar(require_toolLabel(), exports2);
67964
68125
  __exportStar(require_toolVisibility(), exports2);
67965
68126
  __exportStar(require_subagentRow(), exports2);
68127
+ __exportStar(require_steerRow(), exports2);
67966
68128
  var client_core_1 = require_dist();
67967
68129
  Object.defineProperty(exports2, "parseTrust", { enumerable: true, get: function() {
67968
68130
  return client_core_1.parseTrust;
@@ -71347,10 +71509,10 @@ function resolveFlexibleLengths(children, availableInnerMain, totalFlexBasis, is
71347
71509
  const initialFree = isDefined(availableInnerMain) ? availableInnerMain - totalFlexBasis : 0;
71348
71510
  for (let i2 = 0; i2 < n; i2++) {
71349
71511
  const c3 = children[i2];
71350
- const clamped = boundAxis(c3.style, isMainRow, c3._flexBasis, ownerW, ownerH);
71512
+ const clamped2 = boundAxis(c3.style, isMainRow, c3._flexBasis, ownerW, ownerH);
71351
71513
  const inflexible = !isDefined(availableInnerMain) || (initialFree >= 0 ? c3.style.flexGrow === 0 : c3.style.flexShrink === 0);
71352
71514
  if (inflexible) {
71353
- c3._mainSize = Math.max(0, clamped);
71515
+ c3._mainSize = Math.max(0, clamped2);
71354
71516
  frozen[i2] = true;
71355
71517
  } else {
71356
71518
  c3._mainSize = c3._flexBasis;
@@ -71398,12 +71560,12 @@ function resolveFlexibleLengths(children, availableInnerMain, totalFlexBasis, is
71398
71560
  t += remaining * (c3.style.flexShrink * c3._flexBasis) / totalShrinkScaled;
71399
71561
  }
71400
71562
  unclamped[i2] = t;
71401
- const clamped = Math.max(
71563
+ const clamped2 = Math.max(
71402
71564
  0,
71403
71565
  boundAxis(c3.style, isMainRow, t, ownerW, ownerH)
71404
71566
  );
71405
- c3._mainSize = clamped;
71406
- totalViolation += clamped - t;
71567
+ c3._mainSize = clamped2;
71568
+ totalViolation += clamped2 - t;
71407
71569
  }
71408
71570
  if (totalViolation === 0) break;
71409
71571
  let anyFrozen = false;
@@ -80687,10 +80849,10 @@ var Output = class {
80687
80849
  softWrap
80688
80850
  });
80689
80851
  }
80690
- clip(clip) {
80852
+ clip(clip2) {
80691
80853
  this.operations.push({
80692
80854
  type: "clip",
80693
- clip
80855
+ clip: clip2
80694
80856
  });
80695
80857
  }
80696
80858
  unclip() {
@@ -80741,20 +80903,20 @@ var Output = class {
80741
80903
  width: regionWidth,
80742
80904
  height: regionHeight
80743
80905
  } = operation;
80744
- const clip = clips.at(-1);
80745
- const startX = Math.max(regionX, clip?.x1 ?? 0);
80746
- const startY = Math.max(regionY, clip?.y1 ?? 0);
80906
+ const clip2 = clips.at(-1);
80907
+ const startX = Math.max(regionX, clip2?.x1 ?? 0);
80908
+ const startY = Math.max(regionY, clip2?.y1 ?? 0);
80747
80909
  const maxY = Math.min(
80748
80910
  regionY + regionHeight,
80749
80911
  screenHeight,
80750
80912
  src.height,
80751
- clip?.y2 ?? Infinity
80913
+ clip2?.y2 ?? Infinity
80752
80914
  );
80753
80915
  const maxX = Math.min(
80754
80916
  regionX + regionWidth,
80755
80917
  screenWidth,
80756
80918
  src.width,
80757
- clip?.x2 ?? Infinity
80919
+ clip2?.x2 ?? Infinity
80758
80920
  );
80759
80921
  if (startX >= maxX || startY >= maxY) continue;
80760
80922
  if (absoluteClears.length === 0) {
@@ -80787,48 +80949,48 @@ var Output = class {
80787
80949
  let lines = text.split("\n");
80788
80950
  let swFrom = 0;
80789
80951
  let prevContentEnd = 0;
80790
- const clip = clips.at(-1);
80791
- if (clip) {
80792
- const clipHorizontally = typeof clip?.x1 === "number" && typeof clip?.x2 === "number";
80793
- const clipVertically = typeof clip?.y1 === "number" && typeof clip?.y2 === "number";
80952
+ const clip2 = clips.at(-1);
80953
+ if (clip2) {
80954
+ const clipHorizontally = typeof clip2?.x1 === "number" && typeof clip2?.x2 === "number";
80955
+ const clipVertically = typeof clip2?.y1 === "number" && typeof clip2?.y2 === "number";
80794
80956
  if (clipHorizontally) {
80795
80957
  const width = widestLine(text);
80796
- if (x2 + width <= clip.x1 || x2 >= clip.x2) {
80958
+ if (x2 + width <= clip2.x1 || x2 >= clip2.x2) {
80797
80959
  continue;
80798
80960
  }
80799
80961
  }
80800
80962
  if (clipVertically) {
80801
80963
  const height = lines.length;
80802
- if (y2 + height <= clip.y1 || y2 >= clip.y2) {
80964
+ if (y2 + height <= clip2.y1 || y2 >= clip2.y2) {
80803
80965
  continue;
80804
80966
  }
80805
80967
  }
80806
80968
  if (clipHorizontally) {
80807
80969
  lines = lines.map((line) => {
80808
- const from = x2 < clip.x1 ? clip.x1 - x2 : 0;
80970
+ const from = x2 < clip2.x1 ? clip2.x1 - x2 : 0;
80809
80971
  const width = stringWidth(line);
80810
- const to = x2 + width > clip.x2 ? clip.x2 - x2 : width;
80972
+ const to = x2 + width > clip2.x2 ? clip2.x2 - x2 : width;
80811
80973
  let sliced = sliceAnsi(line, from, to);
80812
80974
  if (stringWidth(sliced) > to - from) {
80813
80975
  sliced = sliceAnsi(line, from, to - 1);
80814
80976
  }
80815
80977
  return sliced;
80816
80978
  });
80817
- if (x2 < clip.x1) {
80818
- x2 = clip.x1;
80979
+ if (x2 < clip2.x1) {
80980
+ x2 = clip2.x1;
80819
80981
  }
80820
80982
  }
80821
80983
  if (clipVertically) {
80822
- const from = y2 < clip.y1 ? clip.y1 - y2 : 0;
80984
+ const from = y2 < clip2.y1 ? clip2.y1 - y2 : 0;
80823
80985
  const height = lines.length;
80824
- const to = y2 + height > clip.y2 ? clip.y2 - y2 : height;
80986
+ const to = y2 + height > clip2.y2 ? clip2.y2 - y2 : height;
80825
80987
  if (softWrap && from > 0 && softWrap[from] === true) {
80826
80988
  prevContentEnd = x2 + stringWidth(lines[from - 1]);
80827
80989
  }
80828
80990
  lines = lines.slice(from, to);
80829
80991
  swFrom = from;
80830
- if (y2 < clip.y1) {
80831
- y2 = clip.y1;
80992
+ if (y2 < clip2.y1) {
80993
+ y2 = clip2.y1;
80832
80994
  }
80833
80995
  }
80834
80996
  }
@@ -81566,11 +81728,11 @@ function renderNodeToOutput(node, output, {
81566
81728
  node.pendingScrollDelta = void 0;
81567
81729
  }
81568
81730
  let scrollTop = Math.max(0, Math.min(cur, maxScroll));
81569
- const clamped = haveClamp ? Math.max(cMin, Math.min(scrollTop, cMax)) : scrollTop;
81731
+ const clamped2 = haveClamp ? Math.max(cMin, Math.min(scrollTop, cMax)) : scrollTop;
81570
81732
  node.scrollTop = scrollTop;
81571
81733
  if (scrollTop !== cur) node.pendingScrollDelta = void 0;
81572
81734
  if (node.pendingScrollDelta !== void 0) scrollDrainNode = node;
81573
- scrollTop = clamped;
81735
+ scrollTop = clamped2;
81574
81736
  if (content && contentYoga) {
81575
81737
  const contentX = x2 + contentYoga.getComputedLeft();
81576
81738
  const contentY = y2 + contentYoga.getComputedTop() - scrollTop;
@@ -83528,8 +83690,8 @@ var Box2 = Box_default;
83528
83690
  var ScrollBox2 = ScrollBox_default;
83529
83691
 
83530
83692
  // src/main.tsx
83531
- var import_client_core40 = __toESM(require_dist(), 1);
83532
- var import_client_core41 = __toESM(require_dist(), 1);
83693
+ var import_client_core42 = __toESM(require_dist(), 1);
83694
+ var import_client_core43 = __toESM(require_dist(), 1);
83533
83695
  import { fileURLToPath as fileURLToPath3 } from "url";
83534
83696
  import * as os7 from "os";
83535
83697
  import { randomUUID as randomUUID3 } from "crypto";
@@ -84734,6 +84896,13 @@ async function readClipboardImage() {
84734
84896
 
84735
84897
  // src/commands/registry.ts
84736
84898
  var bare = (name2) => name2.replace(/^\//, "");
84899
+ var SOURCE_ORDER = {
84900
+ builtin: 0,
84901
+ skill: 1,
84902
+ plugin: 2,
84903
+ mcp: 3
84904
+ };
84905
+ var sourceRank = (cmd) => SOURCE_ORDER[cmd.source ?? "builtin"];
84737
84906
  var CommandRegistry = class {
84738
84907
  byName = /* @__PURE__ */ new Map();
84739
84908
  register(cmd) {
@@ -84786,7 +84955,9 @@ var CommandRegistry = class {
84786
84955
  * `/exit` finds quit). Deduped to the canonical command. Ranked by HOW the
84787
84956
  * match happened — name matches before alias matches before keyword-only
84788
84957
  * matches (so typing "model" puts /model first and the keyword-related
84789
- * /endpoint after it), alphabetical within a rank. */
84958
+ * /endpoint after it), then by catalog (SOURCE_ORDER — builtins lead), then
84959
+ * alphabetical. A bare "/" matches everything at rank 0, so the catalog key
84960
+ * is what groups that menu instead of leaving one flat alphabetical run. */
84790
84961
  complete(input) {
84791
84962
  if (!input.startsWith("/")) return [];
84792
84963
  const head = input.slice(1);
@@ -84798,7 +84969,9 @@ var CommandRegistry = class {
84798
84969
  if ((c3.keywords ?? []).some((k) => k.toLowerCase().startsWith(partial))) return 2;
84799
84970
  return -1;
84800
84971
  };
84801
- return this.all().filter((c3) => rank(c3) >= 0).sort((a, b2) => rank(a) - rank(b2) || a.name.localeCompare(b2.name));
84972
+ return this.all().filter((c3) => rank(c3) >= 0).sort(
84973
+ (a, b2) => rank(a) - rank(b2) || sourceRank(a) - sourceRank(b2) || a.name.localeCompare(b2.name)
84974
+ );
84802
84975
  }
84803
84976
  };
84804
84977
 
@@ -84960,13 +85133,13 @@ function initialTranscript() {
84960
85133
  };
84961
85134
  }
84962
85135
  function evictSettled(s, count) {
84963
- const clamped = Math.min(
85136
+ const clamped2 = Math.min(
84964
85137
  Math.max(s.evictedCount, Math.floor(count)),
84965
85138
  s.committedCount,
84966
85139
  s.settled.length
84967
85140
  );
84968
- if (clamped === s.evictedCount) return s;
84969
- return { ...s, evictedCount: clamped };
85141
+ if (clamped2 === s.evictedCount) return s;
85142
+ return { ...s, evictedCount: clamped2 };
84970
85143
  }
84971
85144
  function flushAssistant(s) {
84972
85145
  if (s.live && s.live.assistantText.trim().length > 0) {
@@ -88109,6 +88282,20 @@ function toWireAttachments(pending) {
88109
88282
  }
88110
88283
  var queuedSteer = (text, display) => display === void 0 ? { text, kind: "steer" } : { text, kind: "steer", display };
88111
88284
  var queuedCommand = (text) => ({ text, kind: "command" });
88285
+ var machineSteer = (text, display) => display === void 0 ? { text, kind: "steer", origin: "machine" } : { text, kind: "steer", display, origin: "machine" };
88286
+ var machineCommand = (text) => ({
88287
+ text,
88288
+ kind: "command",
88289
+ origin: "machine"
88290
+ });
88291
+ function clearParkedForStop(s) {
88292
+ return {
88293
+ pendingPermissions: s.pendingPermissions.filter((p) => p.agentLabel),
88294
+ pendingPlanApproval: null,
88295
+ pendingAskUser: null,
88296
+ pendingWorkPlan: null
88297
+ };
88298
+ }
88112
88299
  function initialAppState(partial) {
88113
88300
  return {
88114
88301
  provider: "openai",
@@ -88804,13 +88991,7 @@ function drainSteersForSegment(app, transcript) {
88804
88991
  );
88805
88992
  return steers.map((q2) => q2.text);
88806
88993
  }
88807
- function settleSteerQueue(outcome, deps2) {
88808
- if (outcome === "cancelled") {
88809
- if (deps2.app.getState().queuedMessages.length > 0) {
88810
- deps2.app.setState((s) => ({ ...s, queuedMessages: [] }));
88811
- }
88812
- return;
88813
- }
88994
+ function settleSteerQueue(deps2) {
88814
88995
  setTimeout(() => {
88815
88996
  void (async () => {
88816
88997
  if (deps2.isBusy()) return;
@@ -88829,10 +89010,7 @@ function settleSteerQueue(outcome, deps2) {
88829
89010
  if (deps2.isBusy()) return;
88830
89011
  const leftovers = deps2.app.getState().queuedMessages.filter((q2) => q2.kind === "steer");
88831
89012
  if (leftovers.length === 0) return;
88832
- const prompt = (0, import_client_core20.promoteLeftoverSteers)(
88833
- outcome,
88834
- leftovers.map((q2) => q2.text)
88835
- );
89013
+ const prompt = (0, import_client_core20.promoteLeftoverSteers)(leftovers.map((q2) => q2.text));
88836
89014
  deps2.app.setState((s) => ({
88837
89015
  ...s,
88838
89016
  queuedMessages: s.queuedMessages.filter((q2) => q2.kind !== "steer")
@@ -89328,7 +89506,7 @@ var WorkPlanApprovalBridge = class {
89328
89506
  };
89329
89507
 
89330
89508
  // src/main.tsx
89331
- var import_client_ui_core19 = __toESM(require_dist2(), 1);
89509
+ var import_client_ui_core20 = __toESM(require_dist2(), 1);
89332
89510
 
89333
89511
  // src/components/layout/Transcript.tsx
89334
89512
  var import_react27 = __toESM(require_react(), 1);
@@ -89338,13 +89516,25 @@ var import_react23 = __toESM(require_react(), 1);
89338
89516
 
89339
89517
  // src/components/messages/UserText.tsx
89340
89518
  var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
89341
- function UserText({ text }) {
89519
+ function UserText({
89520
+ text,
89521
+ pending = false
89522
+ }) {
89342
89523
  const theme = useTheme();
89343
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box2, { marginTop: 1, flexDirection: "row", paddingRight: 1, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box2, { flexGrow: 1, flexShrink: 1, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Text2, { backgroundColor: theme.userBg, color: theme.user, bold: true, wrap: "wrap", children: [
89344
- glyphs.user,
89345
- " ",
89346
- text
89347
- ] }) }) });
89524
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box2, { marginTop: 1, flexDirection: "row", paddingRight: 1, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box2, { flexGrow: 1, flexShrink: 1, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
89525
+ Text2,
89526
+ {
89527
+ backgroundColor: pending ? void 0 : theme.userBg,
89528
+ color: pending ? theme.dim : theme.user,
89529
+ bold: !pending,
89530
+ wrap: "wrap",
89531
+ children: [
89532
+ glyphs.user,
89533
+ " ",
89534
+ text
89535
+ ]
89536
+ }
89537
+ ) }) });
89348
89538
  }
89349
89539
 
89350
89540
  // src/components/messages/UserCommand.tsx
@@ -105670,7 +105860,7 @@ function OrionRing() {
105670
105860
 
105671
105861
  // src/services/version.ts
105672
105862
  function tuiVersion() {
105673
- return "0.1.18".length > 0 ? "0.1.18" : null;
105863
+ return "0.1.19".length > 0 ? "0.1.19" : null;
105674
105864
  }
105675
105865
 
105676
105866
  // src/components/layout/WelcomeCard.tsx
@@ -105944,6 +106134,9 @@ function Transcript({
105944
106134
  ] });
105945
106135
  }
105946
106136
 
106137
+ // src/components/layout/ReplFooter.tsx
106138
+ var import_react45 = __toESM(require_react(), 1);
106139
+
105947
106140
  // src/components/tools/PlanCard.tsx
105948
106141
  var import_react28 = __toESM(require_react(), 1);
105949
106142
  var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
@@ -106071,56 +106264,197 @@ function segmentSlice(text, offset, ranges) {
106071
106264
  }
106072
106265
 
106073
106266
  // src/components/input/Autocomplete.tsx
106267
+ var import_string_width4 = __toESM(require_string_width(), 1);
106074
106268
  var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
106075
- var MAX_VISIBLE2 = 6;
106269
+ var MAX_VISIBLE2 = 20;
106270
+ var ROWS_RESERVED = 8;
106271
+ var INDENT2 = 2;
106272
+ var MARKER_WIDTH = 2;
106273
+ var NAME_GAP = 2;
106274
+ var MIN_NAME_WIDTH = 8;
106275
+ var MIN_DESC_WRAP = 12;
106276
+ var MIN_DESC_CLIP = 8;
106277
+ var MIN_DESC_WIDTH = 20;
106278
+ var TAG_GAP = 2;
106279
+ var KEY_HINTS = "\u2191/\u2193 select \xB7 tab/enter complete \xB7 esc dismiss";
106280
+ var KEY_HINTS_TERSE = "\u2191/\u2193 \xB7 tab \xB7 esc";
106281
+ function commandLabel(item) {
106282
+ return `/${item.name}`;
106283
+ }
106284
+ function sourceTag(source2) {
106285
+ return !source2 || source2 === "builtin" ? "" : source2;
106286
+ }
106287
+ function clip(text, width) {
106288
+ if (width <= 0) return "";
106289
+ if ((0, import_string_width4.default)(text) <= width) return text;
106290
+ let out2 = "";
106291
+ let used = 0;
106292
+ for (const ch of text) {
106293
+ const w2 = (0, import_string_width4.default)(ch);
106294
+ if (used + w2 > width - 1) break;
106295
+ out2 += ch;
106296
+ used += w2;
106297
+ }
106298
+ return `${out2}\u2026`;
106299
+ }
106300
+ var padEnd = (text, width) => text + " ".repeat(Math.max(0, width - (0, import_string_width4.default)(text)));
106301
+ var padStart = (text, width) => " ".repeat(Math.max(0, width - (0, import_string_width4.default)(text))) + text;
106302
+ var join10 = (a, b2) => a !== "" && b2 !== "" ? `${a} \xB7 ${b2}` : a || b2;
106303
+ function wrapCells(text, width) {
106304
+ const words = text.split(/\s+/).filter(Boolean);
106305
+ if (width <= 0 || words.length === 0) return [text];
106306
+ const lines = [];
106307
+ let line = "";
106308
+ for (const word of words) {
106309
+ const candidate = line === "" ? word : `${line} ${word}`;
106310
+ if ((0, import_string_width4.default)(candidate) <= width) {
106311
+ line = candidate;
106312
+ continue;
106313
+ }
106314
+ if (line !== "") {
106315
+ lines.push(line);
106316
+ line = "";
106317
+ }
106318
+ let rest = word;
106319
+ while ((0, import_string_width4.default)(rest) > width) {
106320
+ let take = "";
106321
+ let used = 0;
106322
+ for (const ch of rest) {
106323
+ const w2 = (0, import_string_width4.default)(ch);
106324
+ if (used + w2 > width) break;
106325
+ take += ch;
106326
+ used += w2;
106327
+ }
106328
+ if (take === "") break;
106329
+ lines.push(take);
106330
+ rest = rest.slice(take.length);
106331
+ }
106332
+ line = rest;
106333
+ }
106334
+ if (line !== "") lines.push(line);
106335
+ return lines.length > 0 ? lines : [""];
106336
+ }
106337
+ function menuLayout(items, columns) {
106338
+ const avail = Math.max(0, columns - INDENT2 - MARKER_WIDTH);
106339
+ const longest = items.reduce((w2, item) => Math.max(w2, (0, import_string_width4.default)(commandLabel(item))), 0);
106340
+ const nameWidth = Math.min(
106341
+ longest + NAME_GAP,
106342
+ Math.max(MIN_NAME_WIDTH, avail - MIN_DESC_WRAP)
106343
+ );
106344
+ const tags = items.map((item) => sourceTag(item.source)).filter((tag) => tag.length > 0);
106345
+ const wanted = tags.length > 0 ? Math.max(...tags.map((tag) => (0, import_string_width4.default)(tag))) + TAG_GAP : 0;
106346
+ const room = Math.max(0, avail - nameWidth);
106347
+ const tagWidth = wanted > 0 && room - wanted >= MIN_DESC_WIDTH ? wanted : 0;
106348
+ const descWidth = Math.max(1, room - tagWidth);
106349
+ return { nameWidth, descWidth, tagWidth, wraps: descWidth >= MIN_DESC_CLIP };
106350
+ }
106351
+ function layoutItem(item, layout) {
106352
+ const { nameWidth, descWidth, tagWidth, wraps } = layout;
106353
+ const name2 = padEnd(clip(commandLabel(item), nameWidth - NAME_GAP), nameWidth);
106354
+ const tag = sourceTag(item.source);
106355
+ const tagged = tagWidth > 0 && tag.length > 0;
106356
+ const body2 = wraps ? wrapCells(item.description, descWidth) : [clip(item.description, descWidth)];
106357
+ return body2.map((text, i2) => ({
106358
+ // Continuation lines hang under the description column, so a wrapped
106359
+ // command still reads as one block against the command column's edge.
106360
+ name: i2 === 0 ? name2 : " ".repeat(nameWidth),
106361
+ description: i2 === 0 && tagged ? padEnd(text, descWidth) : text,
106362
+ tag: i2 === 0 && tagged ? padStart(tag, tagWidth) : ""
106363
+ }));
106364
+ }
106365
+ function menuWindow(total, heightAt, selected, maxItems, maxRows) {
106366
+ if (total === 0) return { start: 0, end: 0 };
106367
+ const sel = Math.max(0, Math.min(selected, total - 1));
106368
+ let start2 = sel;
106369
+ let end = sel + 1;
106370
+ let used = heightAt(sel);
106371
+ let count = 1;
106372
+ let forward = true;
106373
+ while (count < maxItems) {
106374
+ const fits = (i2) => i2 >= 0 && i2 < total && used + heightAt(i2) <= maxRows;
106375
+ const forwardOk = fits(end);
106376
+ const backOk = fits(start2 - 1);
106377
+ if (!forwardOk && !backOk) break;
106378
+ if (forward ? forwardOk : !backOk) {
106379
+ used += heightAt(end);
106380
+ end += 1;
106381
+ } else {
106382
+ start2 -= 1;
106383
+ used += heightAt(start2);
106384
+ }
106385
+ count += 1;
106386
+ forward = !forward;
106387
+ }
106388
+ return { start: start2, end };
106389
+ }
106390
+ function MenuLine({
106391
+ line,
106392
+ first,
106393
+ selected
106394
+ }) {
106395
+ const marker = selected && first ? "\u276F " : " ";
106396
+ if (selected) {
106397
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(GradientText, { text: `${marker}${line.name}${line.description}${line.tag}`, wrap: "truncate" });
106398
+ }
106399
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Text2, { wrap: "truncate", children: [
106400
+ marker,
106401
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ThemedText, { children: line.name }),
106402
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ThemedText, { dim: true, children: line.description }),
106403
+ line.tag ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ThemedText, { dim: true, children: line.tag }) : null
106404
+ ] });
106405
+ }
106076
106406
  function Autocomplete({
106077
106407
  suggestions,
106078
106408
  selectedIndex = 0
106079
106409
  }) {
106410
+ const { columns, rows } = useTerminalSize();
106080
106411
  if (suggestions.length === 0) return null;
106081
106412
  const sel = Math.max(0, Math.min(selectedIndex, suggestions.length - 1));
106082
- const start2 = Math.max(0, Math.min(sel - Math.floor(MAX_VISIBLE2 / 2), suggestions.length - MAX_VISIBLE2));
106083
- const end = Math.min(start2 + MAX_VISIBLE2, suggestions.length);
106084
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box2, { flexDirection: "column", marginLeft: 2, children: [
106085
- start2 > 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(ThemedText, { dim: true, children: [
106086
- "\u2191 ",
106087
- start2,
106088
- " more"
106089
- ] }) : null,
106090
- suggestions.slice(start2, end).map((s, vi) => {
106091
- const on = start2 + vi === sel;
106092
- if (on) {
106093
- const hint = s.argumentHint ? ` ${s.argumentHint}` : "";
106094
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box2, { flexDirection: "row", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box2, { flexGrow: 1, flexShrink: 1, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(GradientText, { text: `\u276F /${s.name}${hint} \u2014 ${s.description}`, wrap: "truncate-end" }) }) }, s.name);
106095
- }
106096
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box2, { flexDirection: "row", children: [
106097
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(ThemedText, { children: [
106098
- " ",
106099
- "/",
106100
- s.name
106101
- ] }),
106102
- s.argumentHint ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(ThemedText, { dim: true, children: [
106103
- "\xA0",
106104
- s.argumentHint
106105
- ] }) : null,
106106
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box2, { flexGrow: 1, flexShrink: 1, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(ThemedText, { dim: true, wrap: "truncate-end", children: [
106107
- "\xA0\u2014 ",
106108
- s.description
106109
- ] }) })
106110
- ] }, s.name);
106413
+ const layout = menuLayout(suggestions, columns);
106414
+ const laid = /* @__PURE__ */ new Map();
106415
+ const linesAt = (index) => {
106416
+ let lines = laid.get(index);
106417
+ if (lines === void 0) {
106418
+ lines = layoutItem(suggestions[index], layout);
106419
+ laid.set(index, lines);
106420
+ }
106421
+ return lines;
106422
+ };
106423
+ const budget = Math.max(1, rows - ROWS_RESERVED);
106424
+ const { start: start2, end } = menuWindow(
106425
+ suggestions.length,
106426
+ (index) => linesAt(index).length,
106427
+ sel,
106428
+ MAX_VISIBLE2,
106429
+ budget
106430
+ );
106431
+ const width = Math.max(1, columns - INDENT2);
106432
+ const current2 = suggestions[sel];
106433
+ const clipped = current2 !== void 0 && (0, import_string_width4.default)(commandLabel(current2)) > layout.nameWidth - NAME_GAP;
106434
+ const signature = current2 && (current2.argumentHint || clipped) ? `${commandLabel(current2)}${current2.argumentHint ? ` ${current2.argumentHint}` : ""}` : "";
106435
+ const position = end - start2 < suggestions.length ? `${sel + 1}/${suggestions.length}` : "";
106436
+ const showSignature = signature !== "" && (0, import_string_width4.default)(signature) <= width;
106437
+ const room = width - (showSignature ? (0, import_string_width4.default)(signature) + TAG_GAP : 0);
106438
+ const hints = [join10(position, KEY_HINTS), join10(position, KEY_HINTS_TERSE), position, ""].find(
106439
+ (candidate) => (0, import_string_width4.default)(candidate) <= room
106440
+ ) ?? "";
106441
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box2, { flexDirection: "column", marginLeft: INDENT2, width, children: [
106442
+ Array.from({ length: end - start2 }, (_2, i2) => start2 + i2).flatMap((index) => {
106443
+ const item = suggestions[index];
106444
+ const key = `${item.source ?? "builtin"}/${item.name}`;
106445
+ return linesAt(index).map((line, row) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(MenuLine, { line, first: row === 0, selected: index === sel }, `${key}#${row}`));
106111
106446
  }),
106112
- end < suggestions.length ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(ThemedText, { dim: true, children: [
106113
- "\u2193 ",
106114
- suggestions.length - end,
106115
- " more"
106116
- ] }) : null,
106117
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ThemedText, { dim: true, children: "\xA0\xA0\u2191/\u2193 select \xB7 tab/enter complete \xB7 esc dismiss" })
106447
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box2, { flexDirection: "row", justifyContent: showSignature ? "space-between" : "flex-end", children: [
106448
+ showSignature ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ThemedText, { dim: true, wrap: "truncate", children: signature }) : null,
106449
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ThemedText, { dim: true, wrap: "truncate", children: hints })
106450
+ ] })
106118
106451
  ] });
106119
106452
  }
106120
106453
 
106121
106454
  // src/components/input/ContextSuggestions.tsx
106455
+ var import_client_core25 = __toESM(require_dist(), 1);
106122
106456
  var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
106123
- var MAX_VISIBLE3 = 8;
106457
+ var MAX_VISIBLE3 = 12;
106124
106458
  function ContextSuggestions({
106125
106459
  files,
106126
106460
  selectedIndex = 0
@@ -106141,8 +106475,7 @@ function ContextSuggestions({
106141
106475
  // Unselected rows stay muted (menu chrome, not content) — `dim`, not a
106142
106476
  // tool color: tool text is primary-white, menus are not.
106143
106477
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(ThemedText, { colorKey: on ? "accent" : void 0, dim: !on, bold: on, children: [
106144
- on ? "\u276F " : " ",
106145
- "@",
106478
+ "+ ",
106146
106479
  f
106147
106480
  ] }, f)
106148
106481
  );
@@ -106154,14 +106487,8 @@ function ContextSuggestions({
106154
106487
  ] }) : null
106155
106488
  ] });
106156
106489
  }
106157
- function tokenAtCursor(value, cursor) {
106158
- let start2 = cursor;
106159
- while (start2 > 0 && !/\s/.test(value[start2 - 1])) start2--;
106160
- return { start: start2, token: value.slice(start2, cursor) };
106161
- }
106162
106490
  function mentionPrefix(value, cursor) {
106163
- const { token } = tokenAtCursor(value, cursor);
106164
- return token.startsWith("@") ? token.slice(1) : null;
106491
+ return (0, import_client_core25.findFileMentionQuery)(value, cursor)?.query ?? null;
106165
106492
  }
106166
106493
 
106167
106494
  // src/services/posture.ts
@@ -106227,6 +106554,71 @@ function createWheelAccel(opts = {}) {
106227
106554
  };
106228
106555
  }
106229
106556
 
106557
+ // src/services/promptHistory.ts
106558
+ var EMPTY_DRAFT = Object.freeze({ text: "", caret: 0 });
106559
+ var NOT_RECALLING = Object.freeze({ index: null, parked: EMPTY_DRAFT });
106560
+ var HISTORY_LIMIT = 500;
106561
+ function atEnd(text) {
106562
+ return { text, caret: text.length };
106563
+ }
106564
+ function clamped(draft) {
106565
+ const caret = Math.min(Math.max(0, draft.caret), draft.text.length);
106566
+ return caret === draft.caret ? draft : { text: draft.text, caret };
106567
+ }
106568
+ function moveCaretVertically(draft, dir) {
106569
+ const { text, caret } = draft;
106570
+ const lineStart2 = text.lastIndexOf("\n", caret - 1) + 1;
106571
+ const column = caret - lineStart2;
106572
+ if (dir === -1) {
106573
+ if (lineStart2 === 0) return null;
106574
+ const prevStart = text.lastIndexOf("\n", lineStart2 - 2) + 1;
106575
+ const prevLength = lineStart2 - 1 - prevStart;
106576
+ return prevStart + Math.min(column, prevLength);
106577
+ }
106578
+ const lineEnd2 = text.indexOf("\n", caret);
106579
+ if (lineEnd2 === -1) return null;
106580
+ const nextStart = lineEnd2 + 1;
106581
+ let nextEnd = text.indexOf("\n", nextStart);
106582
+ if (nextEnd === -1) nextEnd = text.length;
106583
+ return nextStart + Math.min(column, nextEnd - nextStart);
106584
+ }
106585
+ function arrowUp(draft, entries, state) {
106586
+ const caret = moveCaretVertically(draft, -1);
106587
+ if (caret !== null) return { kind: "caret", caret };
106588
+ if (entries.length === 0) return null;
106589
+ const starting = state.index === null;
106590
+ const index = starting ? 0 : Math.min(entries.length - 1, state.index + 1);
106591
+ return {
106592
+ kind: "recall",
106593
+ // Park on the way out, and only on the way out — every later step keeps the
106594
+ // draft the walk originally left behind.
106595
+ state: { index, parked: starting ? draft : state.parked },
106596
+ draft: atEnd(entries[index] ?? "")
106597
+ };
106598
+ }
106599
+ function arrowDown(draft, entries, state) {
106600
+ const caret = moveCaretVertically(draft, 1);
106601
+ if (caret !== null) return { kind: "caret", caret };
106602
+ if (state.index === null) return null;
106603
+ const index = state.index - 1;
106604
+ if (index < 0) {
106605
+ return { kind: "recall", state: NOT_RECALLING, draft: clamped(state.parked) };
106606
+ }
106607
+ return {
106608
+ kind: "recall",
106609
+ state: { index, parked: state.parked },
106610
+ draft: atEnd(entries[index] ?? "")
106611
+ };
106612
+ }
106613
+ function pushEntry(entries, text, limit = HISTORY_LIMIT) {
106614
+ if (text.trim().length === 0) return entries;
106615
+ if (entries[0] === text) return entries;
106616
+ return [text, ...entries].slice(0, Math.max(1, limit));
106617
+ }
106618
+
106619
+ // src/components/input/PromptInput.tsx
106620
+ var import_client_core26 = __toESM(require_dist(), 1);
106621
+
106230
106622
  // src/keybindings/match.ts
106231
106623
  function matchKeypress(input, key) {
106232
106624
  let k = "";
@@ -106615,26 +107007,11 @@ var RAIL_BORDER = {
106615
107007
  bottom: " ",
106616
107008
  bottomRight: "\u2590"
106617
107009
  };
106618
- function moveVertical2(value, cursor, dir) {
106619
- const lineStart2 = value.lastIndexOf("\n", cursor - 1) + 1;
106620
- const col = cursor - lineStart2;
106621
- if (dir === -1) {
106622
- if (lineStart2 === 0) return null;
106623
- const prevStart = value.lastIndexOf("\n", lineStart2 - 2) + 1;
106624
- const prevLen = lineStart2 - 1 - prevStart;
106625
- return prevStart + Math.min(col, prevLen);
106626
- }
106627
- const lineEnd2 = value.indexOf("\n", cursor);
106628
- if (lineEnd2 === -1) return null;
106629
- const nextStart = lineEnd2 + 1;
106630
- let nextEnd = value.indexOf("\n", nextStart);
106631
- if (nextEnd === -1) nextEnd = value.length;
106632
- return nextStart + Math.min(col, nextEnd - nextStart);
106633
- }
106634
107010
  var SLASH_TOKEN_COLOR = "#89CFF0";
106635
107011
  function PromptInput({
106636
107012
  indexBadge,
106637
107013
  onIndexBadgeActivate,
107014
+ onQueuePop,
106638
107015
  onSubmit,
106639
107016
  onInterrupt,
106640
107017
  onExit: onExit2,
@@ -106652,13 +107029,15 @@ function PromptInput({
106652
107029
  onPasteImage,
106653
107030
  onToggleVerbose,
106654
107031
  onCycleMode,
107032
+ onMenuOpenChange,
106655
107033
  mode,
106656
107034
  permissionMode
106657
107035
  }) {
106658
107036
  const [value, setValue2] = (0, import_react30.useState)("");
106659
107037
  const [cursor, setCursor] = (0, import_react30.useState)(0);
106660
- const [history, setHistory] = (0, import_react30.useState)(() => initialHistory ?? []);
106661
- const [histPos, setHistPos] = (0, import_react30.useState)(null);
107038
+ const [history, setHistory] = (0, import_react30.useState)(
107039
+ () => (initialHistory ?? []).slice(0, HISTORY_LIMIT)
107040
+ );
106662
107041
  const [vimState, setVimState] = (0, import_react30.useState)(() => initialVimState("insert"));
106663
107042
  const [menuIdx, setMenuIdx] = (0, import_react30.useState)(0);
106664
107043
  const [menuDismissed, setMenuDismissed] = (0, import_react30.useState)(false);
@@ -106674,6 +107053,7 @@ function PromptInput({
106674
107053
  const cursorRef = (0, import_react30.useRef)(cursor);
106675
107054
  cursorRef.current = cursor;
106676
107055
  const pasteLedger = (0, import_react30.useRef)({ nextId: 1, texts: /* @__PURE__ */ new Map() });
107056
+ const recall = (0, import_react30.useRef)(NOT_RECALLING);
106677
107057
  const wheelRef = (0, import_react30.useRef)(createWheelAccel());
106678
107058
  const flashTimer = (0, import_react30.useRef)(null);
106679
107059
  const firstPosture = (0, import_react30.useRef)(true);
@@ -106694,6 +107074,7 @@ function PromptInput({
106694
107074
  if (flashTimer.current) clearTimeout(flashTimer.current);
106695
107075
  };
106696
107076
  }, [mode, permissionMode]);
107077
+ const pickedMentions = (0, import_react30.useRef)(/* @__PURE__ */ new Set());
106697
107078
  const suggestionsFor = (v2) => v2.startsWith("/") && !v2.includes(" ") ? getCompletions?.(v2) ?? [] : [];
106698
107079
  const suggestions = suggestionsFor(value);
106699
107080
  const mPfx = mentionPrefix(value, cursor);
@@ -106701,6 +107082,17 @@ function PromptInput({
106701
107082
  const menuFiles = fileSuggestions.length > 0;
106702
107083
  const menuLen = menuFiles ? fileSuggestions.length : suggestions.length;
106703
107084
  const menuOpen = !menuDismissed && menuLen > 0 && (!vim || vimState.mode === "insert");
107085
+ const notifyMenuRef = (0, import_react30.useRef)(onMenuOpenChange);
107086
+ notifyMenuRef.current = onMenuOpenChange;
107087
+ (0, import_react30.useEffect)(() => {
107088
+ notifyMenuRef.current?.(menuOpen);
107089
+ }, [menuOpen]);
107090
+ (0, import_react30.useEffect)(() => () => notifyMenuRef.current?.(false), []);
107091
+ (0, import_react30.useEffect)(() => {
107092
+ for (const path13 of pickedMentions.current) {
107093
+ if (!value.includes(`${import_client_core26.FILE_MENTION_LEADER}${path13}`)) pickedMentions.current.delete(path13);
107094
+ }
107095
+ }, [value]);
106704
107096
  (0, import_react30.useEffect)(() => {
106705
107097
  setMenuIdx(0);
106706
107098
  setMenuDismissed(false);
@@ -106712,7 +107104,7 @@ function PromptInput({
106712
107104
  const c3 = cursorRef.current;
106713
107105
  setValue2(v2.slice(0, c3) + text + v2.slice(c3));
106714
107106
  setCursor(c3 + text.length);
106715
- setHistPos(null);
107107
+ recall.current = NOT_RECALLING;
106716
107108
  };
106717
107109
  const requestImagePaste = () => {
106718
107110
  if (!onPasteImage) return;
@@ -106730,10 +107122,12 @@ function PromptInput({
106730
107122
  const completeMenu = (idx) => {
106731
107123
  if (menuFiles) {
106732
107124
  const pick = fileSuggestions[Math.min(idx, fileSuggestions.length - 1)];
106733
- const { start: start2 } = tokenAtCursor(value, cursor);
106734
- const completed = `@${pick} `;
106735
- setValue2(value.slice(0, start2) + completed + value.slice(cursor));
106736
- setCursor(start2 + completed.length);
107125
+ const at2 = (0, import_client_core26.findFileMentionQuery)(value, cursor);
107126
+ if (!at2) return;
107127
+ const next = (0, import_client_core26.insertFileMention)(value, at2, pick);
107128
+ pickedMentions.current.add(pick);
107129
+ setValue2(next.text);
107130
+ setCursor(next.caret);
106737
107131
  } else if (suggestions.length > 0) {
106738
107132
  const pick = suggestions[Math.min(idx, suggestions.length - 1)];
106739
107133
  const completed = `/${pick.name} `;
@@ -106746,19 +107140,37 @@ function PromptInput({
106746
107140
  const commitSubmit = (override) => {
106747
107141
  const text = override ?? value;
106748
107142
  if (text.trim().length === 0) return;
106749
- setHistory((h) => h[0] === text ? h : [text, ...h].slice(0, 200));
107143
+ setHistory((h) => pushEntry(h, text));
106750
107144
  onHistoryAppend?.(text);
106751
- setHistPos(null);
107145
+ recall.current = NOT_RECALLING;
106752
107146
  setValue2("");
106753
107147
  setCursor(0);
106754
107148
  if (vim) setVimState(initialVimState("insert"));
106755
107149
  const outgoing = expandPastedText(text, pasteLedger.current.texts);
106756
107150
  onSubmit(outgoing);
106757
107151
  };
107152
+ const applyArrow = (outcome) => {
107153
+ if (!outcome) return;
107154
+ if (outcome.kind === "caret") {
107155
+ setCursor(outcome.caret);
107156
+ return;
107157
+ }
107158
+ recall.current = outcome.state;
107159
+ setValue2(outcome.draft.text);
107160
+ setCursor(outcome.draft.caret);
107161
+ };
107162
+ const popQueue = () => {
107163
+ const popped = onQueuePop?.({ text: value, cursor });
107164
+ if (!popped) return false;
107165
+ setValue2(popped.text);
107166
+ setCursor(popped.cursor);
107167
+ recall.current = NOT_RECALLING;
107168
+ return true;
107169
+ };
106758
107170
  const insertNewline = () => {
106759
107171
  setValue2(value.slice(0, cursor) + "\n" + value.slice(cursor));
106760
107172
  setCursor(cursor + 1);
106761
- if (histPos !== null) setHistPos(null);
107173
+ recall.current = NOT_RECALLING;
106762
107174
  };
106763
107175
  use_input_default(
106764
107176
  // The third argument is the production renderer's raw event (it carries the
@@ -106773,7 +107185,7 @@ function PromptInput({
106773
107185
  return;
106774
107186
  }
106775
107187
  const click = parseMouseClick(input);
106776
- if (click && indexBadge && onIndexBadgeActivate) {
107188
+ if (click && indexBadge && !menuOpen && onIndexBadgeActivate) {
106777
107189
  const cols = process.stdout.columns ?? 80;
106778
107190
  const rows2 = process.stdout.rows ?? 24;
106779
107191
  if (isIndexBadgeClick(click, cols, rows2, indexBadge.length)) {
@@ -106800,7 +107212,7 @@ function PromptInput({
106800
107212
  if (searchMatch !== void 0) {
106801
107213
  setValue2(searchMatch);
106802
107214
  setCursor(searchMatch.length);
106803
- setHistPos(null);
107215
+ recall.current = NOT_RECALLING;
106804
107216
  }
106805
107217
  setSearch(null);
106806
107218
  return;
@@ -106884,12 +107296,13 @@ function PromptInput({
106884
107296
  onInterrupt();
106885
107297
  return;
106886
107298
  }
107299
+ if (key.escape && !vim && !streaming && popQueue()) return;
106887
107300
  if (key.escape && !vim && !streaming && value.length > 0) {
106888
107301
  const t = Date.now();
106889
107302
  if (escArmed && t - escAtRef.current < 1e3) {
106890
107303
  setValue2("");
106891
107304
  setCursor(0);
106892
- setHistPos(null);
107305
+ recall.current = NOT_RECALLING;
106893
107306
  setEscArmed(false);
106894
107307
  } else {
106895
107308
  escAtRef.current = t;
@@ -106916,7 +107329,7 @@ function PromptInput({
106916
107329
  if (cursor === value.length && value.endsWith("\\")) {
106917
107330
  setValue2(value.slice(0, -1) + "\n");
106918
107331
  setCursor(value.length);
106919
- if (histPos !== null) setHistPos(null);
107332
+ recall.current = NOT_RECALLING;
106920
107333
  return;
106921
107334
  }
106922
107335
  commitSubmit();
@@ -106927,37 +107340,13 @@ function PromptInput({
106927
107340
  return;
106928
107341
  }
106929
107342
  if (action === "chat:historyPrev") {
106930
- const up = moveVertical2(value, cursor, -1);
106931
- if (up !== null) {
106932
- setCursor(up);
106933
- return;
106934
- }
106935
- if (history.length === 0) return;
106936
- const next = histPos === null ? 0 : Math.min(history.length - 1, histPos + 1);
106937
- const v2 = history[next] ?? "";
106938
- setHistPos(next);
106939
- setValue2(v2);
106940
- setCursor(v2.length);
107343
+ const outcome = arrowUp({ text: value, caret: cursor }, history, recall.current);
107344
+ if (outcome?.kind !== "caret" && popQueue()) return;
107345
+ applyArrow(outcome);
106941
107346
  return;
106942
107347
  }
106943
107348
  if (action === "chat:historyNext") {
106944
- const down = moveVertical2(value, cursor, 1);
106945
- if (down !== null) {
106946
- setCursor(down);
106947
- return;
106948
- }
106949
- if (histPos === null) return;
106950
- const next = histPos - 1;
106951
- if (next < 0) {
106952
- setHistPos(null);
106953
- setValue2("");
106954
- setCursor(0);
106955
- } else {
106956
- const v2 = history[next] ?? "";
106957
- setHistPos(next);
106958
- setValue2(v2);
106959
- setCursor(v2.length);
106960
- }
107349
+ applyArrow(arrowDown({ text: value, caret: cursor }, history, recall.current));
106961
107350
  return;
106962
107351
  }
106963
107352
  if (res.chord.pending.length > 0) return;
@@ -106975,7 +107364,7 @@ function PromptInput({
106975
107364
  if (cursor > ls) {
106976
107365
  setValue2(value.slice(0, ls) + value.slice(cursor));
106977
107366
  setCursor(ls);
106978
- if (histPos !== null) setHistPos(null);
107367
+ recall.current = NOT_RECALLING;
106979
107368
  }
106980
107369
  return;
106981
107370
  }
@@ -106984,7 +107373,7 @@ function PromptInput({
106984
107373
  const end = nl === -1 ? value.length : nl;
106985
107374
  if (end > cursor) {
106986
107375
  setValue2(value.slice(0, cursor) + value.slice(end));
106987
- if (histPos !== null) setHistPos(null);
107376
+ recall.current = NOT_RECALLING;
106988
107377
  }
106989
107378
  return;
106990
107379
  }
@@ -106995,7 +107384,7 @@ function PromptInput({
106995
107384
  if (i2 < cursor) {
106996
107385
  setValue2(value.slice(0, i2) + value.slice(cursor));
106997
107386
  setCursor(i2);
106998
- if (histPos !== null) setHistPos(null);
107387
+ recall.current = NOT_RECALLING;
106999
107388
  }
107000
107389
  return;
107001
107390
  }
@@ -107018,13 +107407,13 @@ function PromptInput({
107018
107407
  if (chip) {
107019
107408
  setValue2(value.slice(0, chip.start) + value.slice(cursor));
107020
107409
  setCursor(chip.start);
107021
- if (histPos !== null) setHistPos(null);
107410
+ recall.current = NOT_RECALLING;
107022
107411
  return;
107023
107412
  }
107024
107413
  if (cursor > 0) {
107025
107414
  setValue2(value.slice(0, cursor - 1) + value.slice(cursor));
107026
107415
  setCursor(cursor - 1);
107027
- if (histPos !== null) setHistPos(null);
107416
+ recall.current = NOT_RECALLING;
107028
107417
  }
107029
107418
  return;
107030
107419
  }
@@ -107037,7 +107426,7 @@ function PromptInput({
107037
107426
  if (chip) {
107038
107427
  setValue2(value.slice(0, chip.start) + text + value.slice(chip.end));
107039
107428
  setCursor(chip.start + text.length);
107040
- if (histPos !== null) setHistPos(null);
107429
+ recall.current = NOT_RECALLING;
107041
107430
  return;
107042
107431
  }
107043
107432
  const id = pasteLedger.current.nextId++;
@@ -107049,7 +107438,7 @@ function PromptInput({
107049
107438
  setValue2(value.slice(0, cursor) + text + value.slice(cursor));
107050
107439
  setCursor(cursor + text.length);
107051
107440
  }
107052
- if (histPos !== null) setHistPos(null);
107441
+ recall.current = NOT_RECALLING;
107053
107442
  } else if (pasted && process.platform === "darwin") {
107054
107443
  requestImagePaste();
107055
107444
  }
@@ -107060,9 +107449,13 @@ function PromptInput({
107060
107449
  const before = value.slice(0, cursor);
107061
107450
  const at = value[cursor] ?? " ";
107062
107451
  const after = value.slice(cursor + 1);
107063
- const tokenRanges = [...slashTokenRanges?.(value) ?? [], ...pasteTokenRanges(value)].sort(
107064
- (a, b2) => a.start - b2.start
107065
- );
107452
+ const tokenRanges = [
107453
+ ...slashTokenRanges?.(value) ?? [],
107454
+ ...pasteTokenRanges(value),
107455
+ // A picked `@file` is a recognized token too, and wears the same colour — the
107456
+ // IDE and the Power App paint theirs the same way.
107457
+ ...(0, import_client_core26.scanFileMentionRanges)(value, pickedMentions.current)
107458
+ ].sort((a, b2) => a.start - b2.start);
107066
107459
  const colored = (text, offset) => tokenRanges.length === 0 ? text : segmentSlice(text, offset, tokenRanges).map(
107067
107460
  (seg2, i2) => seg2.token ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text2, { color: SLASH_TOKEN_COLOR, children: seg2.text }, `${offset}-${i2}`) : seg2.text
107068
107461
  );
@@ -107217,7 +107610,7 @@ function IndexIndicator({
107217
107610
  }
107218
107611
 
107219
107612
  // src/components/status/StatusBar.tsx
107220
- var import_client_core25 = __toESM(require_dist(), 1);
107613
+ var import_client_core27 = __toESM(require_dist(), 1);
107221
107614
  var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
107222
107615
  var PERM_SHORT = {
107223
107616
  read_only: "read-only",
@@ -107263,7 +107656,7 @@ function StatusBar({
107263
107656
  case "persona":
107264
107657
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ThemedText, { dim: true, children: persona });
107265
107658
  case "tier":
107266
- return accountTier ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ThemedText, { dim: true, children: (0, import_client_core25.planLabel)(accountTier) }) : null;
107659
+ return accountTier ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ThemedText, { dim: true, children: (0, import_client_core27.planLabel)(accountTier) }) : null;
107267
107660
  case "workrun":
107268
107661
  return workRun ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ThemedText, { dim: true, children: `graph ${workRun.phasesDone}/${workRun.phasesTotal}` }) : null;
107269
107662
  case "cost":
@@ -107572,7 +107965,7 @@ function FeedbackPrompt({
107572
107965
  var import_react35 = __toESM(require_react(), 1);
107573
107966
  var import_client_ui_core13 = __toESM(require_dist2(), 1);
107574
107967
  var import_client_ui_core14 = __toESM(require_dist2(), 1);
107575
- var import_client_core26 = __toESM(require_dist(), 1);
107968
+ var import_client_core28 = __toESM(require_dist(), 1);
107576
107969
 
107577
107970
  // src/components/dialogs/SelectList.tsx
107578
107971
  var import_react34 = __toESM(require_react(), 1);
@@ -107822,12 +108215,12 @@ function PermissionPrompt({
107822
108215
  label: "Don't ask again for",
107823
108216
  value: stage.draft,
107824
108217
  error: (() => {
107825
- const verdict = (0, import_client_core26.validateRule)(stage.draft);
108218
+ const verdict = (0, import_client_core28.validateRule)(stage.draft);
107826
108219
  return verdict.ok ? null : verdict.reason;
107827
108220
  })(),
107828
108221
  onChange: (draft) => setStage({ ...stage, draft }),
107829
108222
  onSubmit: () => {
107830
- if (!(0, import_client_core26.validateRule)(stage.draft).ok) return;
108223
+ if (!(0, import_client_core28.validateRule)(stage.draft).ok) return;
107831
108224
  setStage({
107832
108225
  kind: "pick-destination",
107833
108226
  rule: stage.draft,
@@ -108415,7 +108808,7 @@ function EndpointsPanel({
108415
108808
 
108416
108809
  // src/components/dialogs/PermissionRulesPanel.tsx
108417
108810
  var import_react37 = __toESM(require_react(), 1);
108418
- var import_client_core27 = __toESM(require_dist(), 1);
108811
+ var import_client_core29 = __toESM(require_dist(), 1);
108419
108812
  var import_client_ui_core15 = __toESM(require_dist2(), 1);
108420
108813
  var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
108421
108814
  function PermissionRulesPanel({
@@ -108430,7 +108823,7 @@ function PermissionRulesPanel({
108430
108823
  if (stage.kind === "add-rule") {
108431
108824
  if (key.escape) return setStage({ kind: "list" });
108432
108825
  if (key.return) {
108433
- if ((0, import_client_core27.validateRule)(stage.draft).ok) setStage({ kind: "add-behavior", rule: stage.draft });
108826
+ if ((0, import_client_core29.validateRule)(stage.draft).ok) setStage({ kind: "add-behavior", rule: stage.draft });
108434
108827
  return;
108435
108828
  }
108436
108829
  if (key.backspace || key.delete)
@@ -108442,7 +108835,7 @@ function PermissionRulesPanel({
108442
108835
  if (input.toLowerCase() === "a") setStage({ kind: "add-rule", draft: "" });
108443
108836
  });
108444
108837
  if (stage.kind === "add-rule") {
108445
- const verdict = (0, import_client_core27.validateRule)(stage.draft);
108838
+ const verdict = (0, import_client_core29.validateRule)(stage.draft);
108446
108839
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
108447
108840
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ThemedText, { bold: true, children: "Add a permission rule" }),
108448
108841
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ThemedText, { colorKey: "toolArgs", children: `[ ${stage.draft}\u2588 ]` }),
@@ -108568,7 +108961,7 @@ function PlanApprovalPrompt({
108568
108961
 
108569
108962
  // src/components/dialogs/WorkPlanApprovalPrompt.tsx
108570
108963
  var import_react39 = __toESM(require_react(), 1);
108571
- var import_client_core28 = __toESM(require_dist(), 1);
108964
+ var import_client_core30 = __toESM(require_dist(), 1);
108572
108965
  var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
108573
108966
  function WorkPlanApprovalPrompt({
108574
108967
  pending,
@@ -108589,11 +108982,11 @@ function WorkPlanApprovalPrompt({
108589
108982
  if (c3 === "y") onRespond(requestId, true);
108590
108983
  else if (c3 === "n" || key.escape) onRespond(requestId, false);
108591
108984
  });
108592
- const worktreeCandidates = (0, import_client_core28.planWorktreeCount)(plan);
108985
+ const worktreeCandidates = (0, import_client_core30.planWorktreeCount)(plan);
108593
108986
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
108594
108987
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box2, { flexDirection: "row", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThemedText, { colorKey: "planMode", bold: true, children: "Work graph \u2014 run this plan in the background?" }) }),
108595
108988
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box2, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThemedText, { dim: true, children: plan.goal }) }),
108596
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box2, { flexDirection: "column", marginTop: 1, marginLeft: 2, children: (0, import_client_core28.planFlowLines)(plan).map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThemedText, { colorKey: "planMode", children: line }, index)) }),
108989
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box2, { flexDirection: "column", marginTop: 1, marginLeft: 2, children: (0, import_client_core30.planFlowLines)(plan).map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThemedText, { colorKey: "planMode", children: line }, index)) }),
108597
108990
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box2, { marginTop: 1, flexDirection: "column", children: plan.phases.map((phase) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(PhaseRow, { phase }, phase.id)) }),
108598
108991
  worktreeCandidates > 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box2, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThemedText, { dim: true, children: `${worktreeCandidates} isolated worktree${worktreeCandidates === 1 ? "" : "s"} will be created; changed ones are kept for review.` }) }),
108599
108992
  /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Box2, { marginTop: 1, flexDirection: "row", children: [
@@ -108609,8 +109002,8 @@ function PhaseRow({ phase }) {
108609
109002
  const heading = phase.title && phase.title !== phase.id ? `${phase.id} \u2014 ${phase.title}` : phase.id;
108610
109003
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Box2, { flexDirection: "column", marginLeft: 2, marginTop: 1, children: [
108611
109004
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThemedText, { bold: true, children: heading }),
108612
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box2, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThemedText, { dim: true, children: (0, import_client_core28.phaseTraits)(phase).join(" \xB7 ") }) }),
108613
- phase.gate && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box2, { marginLeft: 2, flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThemedText, { colorKey: "planMode", children: `gate: ${phase.gate.cmd}${(0, import_client_core28.gateRetrySuffix)(phase.gate)}` }) })
109005
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box2, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThemedText, { dim: true, children: (0, import_client_core30.phaseTraits)(phase).join(" \xB7 ") }) }),
109006
+ phase.gate && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box2, { marginLeft: 2, flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThemedText, { colorKey: "planMode", children: `gate: ${phase.gate.cmd}${(0, import_client_core30.gateRetrySuffix)(phase.gate)}` }) })
108614
109007
  ] });
108615
109008
  }
108616
109009
 
@@ -108653,19 +109046,19 @@ function matcherLabel(m2) {
108653
109046
  const parts2 = Object.entries(m2).map(([k, v2]) => `${k}=${String(v2)}`);
108654
109047
  return parts2.length ? parts2.join(", ") : "(any)";
108655
109048
  }
108656
- function commandLabel(c3) {
109049
+ function commandLabel2(c3) {
108657
109050
  if (Array.isArray(c3)) return c3.join(" ");
108658
109051
  return typeof c3 === "string" ? c3 : "";
108659
109052
  }
108660
109053
  function hookSummary(h) {
108661
- const action = commandLabel(h.command) || h.url || h.model || h.agent_kind || "\u2014";
109054
+ const action = commandLabel2(h.command) || h.url || h.model || h.agent_kind || "\u2014";
108662
109055
  return `${h.type ?? "command"}: ${action}`;
108663
109056
  }
108664
109057
  function HookDetail({ hook, onBack }) {
108665
109058
  use_input_default((_input, key) => {
108666
109059
  if (key.escape || key.return) onBack();
108667
109060
  });
108668
- const cmd = commandLabel(hook.command);
109061
+ const cmd = commandLabel2(hook.command);
108669
109062
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
108670
109063
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ThemedText, { colorKey: "listSelection", bold: true, children: "Hook detail" }),
108671
109064
  /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
@@ -108770,7 +109163,7 @@ function HooksBrowser({
108770
109163
 
108771
109164
  // src/components/dialogs/PluginManager.tsx
108772
109165
  var import_react41 = __toESM(require_react(), 1);
108773
- var import_client_core29 = __toESM(require_dist(), 1);
109166
+ var import_client_core31 = __toESM(require_dist(), 1);
108774
109167
  var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
108775
109168
  function pluginId(p) {
108776
109169
  return p.id ?? p.name ?? "";
@@ -108845,7 +109238,7 @@ function PluginManager({
108845
109238
  {
108846
109239
  dialog: {
108847
109240
  kind: "confirm",
108848
- title: `${import_client_core29.PLUGIN_TRUST_NOTICE}
109241
+ title: `${import_client_core31.PLUGIN_TRUST_NOTICE}
108849
109242
 
108850
109243
  Install "${view.id}" from "${view.catalog}" (${scope} scope)?`,
108851
109244
  options: [],
@@ -109169,7 +109562,7 @@ function ModalFrame({ children }) {
109169
109562
  }
109170
109563
 
109171
109564
  // src/components/dialogs/UsageMetricsPanel.tsx
109172
- var import_client_core30 = __toESM(require_dist(), 1);
109565
+ var import_client_core32 = __toESM(require_dist(), 1);
109173
109566
  var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
109174
109567
  function compactInt(value) {
109175
109568
  if (value >= 1e6) return `${(value / 1e6).toFixed(1)}m`;
@@ -109184,7 +109577,7 @@ function tokenLine(s) {
109184
109577
  `out ${compactInt(t.output_tokens ?? 0)}`,
109185
109578
  `visible ${compactInt(t.visible_output_tokens ?? 0)}`,
109186
109579
  `reason ${compactInt(t.reasoning_tokens ?? 0)}`,
109187
- `cache ${compactInt((0, import_client_core30.cacheHitTokens)(t))}`,
109580
+ `cache ${compactInt((0, import_client_core32.cacheHitTokens)(t))}`,
109188
109581
  // `read`/`write`, not `hit`: this is the cache READ share. A write-heavy turn reads 0% while
109189
109582
  // still paying the 1.25x-2x write premium, so both rates are shown.
109190
109583
  `read ${Math.round(s.cacheHitPercent)}%`,
@@ -109193,7 +109586,7 @@ function tokenLine(s) {
109193
109586
  ].join(" \xB7 ");
109194
109587
  }
109195
109588
  function topRows(group, limit = 4) {
109196
- return Object.entries(group).sort((a, b2) => (0, import_client_core30.meteredTokens)(b2[1].tokens) - (0, import_client_core30.meteredTokens)(a[1].tokens) || b2[1].calls - a[1].calls).slice(0, limit);
109589
+ return Object.entries(group).sort((a, b2) => (0, import_client_core32.meteredTokens)(b2[1].tokens) - (0, import_client_core32.meteredTokens)(a[1].tokens) || b2[1].calls - a[1].calls).slice(0, limit);
109197
109590
  }
109198
109591
  function topContextRows(group, limit = 5) {
109199
109592
  return Object.entries(group).filter(([, value]) => value > 0).sort((a, b2) => b2[1] - a[1]).slice(0, limit);
@@ -109279,11 +109672,11 @@ function BreakdownRows({
109279
109672
  }) {
109280
109673
  const rows = topRows(group);
109281
109674
  if (rows.length === 0) return null;
109282
- const max = Math.max(...rows.map(([, item]) => (0, import_client_core30.meteredTokens)(item.tokens)), 1);
109675
+ const max = Math.max(...rows.map(([, item]) => (0, import_client_core32.meteredTokens)(item.tokens)), 1);
109283
109676
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
109284
109677
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ThemedText, { bold: true, children: title }),
109285
109678
  rows.map(([key, item], index) => {
109286
- const tokens = (0, import_client_core30.meteredTokens)(item.tokens);
109679
+ const tokens = (0, import_client_core32.meteredTokens)(item.tokens);
109287
109680
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(BarRow, { label: key, value: tokens, max, tone: index, children: [
109288
109681
  item.calls,
109289
109682
  " calls \xB7 in ",
@@ -109416,10 +109809,10 @@ function RecentTurns({ rows }) {
109416
109809
  function DailyRows({ summary }) {
109417
109810
  const rows = summary.daily.slice(-5);
109418
109811
  if (rows.length === 0) return null;
109419
- const max = Math.max(...rows.map((day) => (0, import_client_core30.meteredTokens)(day.tokens)), 1);
109812
+ const max = Math.max(...rows.map((day) => (0, import_client_core32.meteredTokens)(day.tokens)), 1);
109420
109813
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
109421
109814
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ThemedText, { bold: true, children: "Daily history" }),
109422
- rows.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(BarRow, { label: day.date, value: (0, import_client_core30.meteredTokens)(day.tokens), max, tone: index, children: [
109815
+ rows.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(BarRow, { label: day.date, value: (0, import_client_core32.meteredTokens)(day.tokens), max, tone: index, children: [
109423
109816
  day.calls,
109424
109817
  " calls \xB7 in ",
109425
109818
  compactInt(day.tokens.input_tokens ?? 0),
@@ -109512,15 +109905,41 @@ function WorkingStatus({
109512
109905
  ] });
109513
109906
  }
109514
109907
 
109908
+ // src/state/inputQueue.ts
109909
+ var import_client_ui_core16 = __toESM(require_dist2(), 1);
109910
+ function isEditable(entry) {
109911
+ return (0, import_client_ui_core16.isEditableSteer)(entry);
109912
+ }
109913
+ function popEditableQueue(app, draft) {
109914
+ const queued = app.getState().queuedMessages;
109915
+ const merged = (0, import_client_ui_core16.mergeIntoDraft)(
109916
+ queued.filter(isEditable).map((entry) => entry.text),
109917
+ draft
109918
+ );
109919
+ if (merged === null) return null;
109920
+ app.setState((s) => ({ ...s, queuedMessages: s.queuedMessages.filter((q2) => !isEditable(q2)) }));
109921
+ return merged;
109922
+ }
109923
+ function queueRows(queued) {
109924
+ const { shown, hidden } = (0, import_client_ui_core16.capMachineRows)(queued);
109925
+ const rows = shown.map((entry) => ({ kind: "entry", entry }));
109926
+ if (hidden > 0) rows.push({ kind: "overflow", hidden });
109927
+ return rows;
109928
+ }
109929
+
109515
109930
  // src/components/input/QueuedMessages.tsx
109516
109931
  var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
109517
109932
  function QueuedMessages({ store }) {
109518
109933
  const queued = useStoreSelector(store, (s) => s.queuedMessages);
109519
109934
  if (queued.length === 0) return null;
109520
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Box2, { flexDirection: "column", children: queued.map((m2, i2) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Box2, { flexDirection: "column", children: [
109521
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(UserText, { text: queuedInputLabel(m2) }),
109522
- m2.kind === "command" ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Text2, { dimColor: true, children: " runs when this turn ends" }) : null
109523
- ] }, i2)) });
109935
+ const rows = queueRows(queued);
109936
+ if (rows.length === 0) return null;
109937
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Box2, { flexDirection: "column", children: rows.map(
109938
+ (row, i2) => row.kind === "overflow" ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ThemedText, { colorKey: "dim", children: ` +${row.hidden} more queued` }, `overflow-${i2}`) : /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Box2, { flexDirection: "column", children: [
109939
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(UserText, { text: queuedInputLabel(row.entry), pending: true }),
109940
+ row.entry.kind === "command" ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ThemedText, { colorKey: "dim", children: " runs when this turn ends" }) : null
109941
+ ] }, i2)
109942
+ ) });
109524
109943
  }
109525
109944
 
109526
109945
  // src/components/input/PendingAttachments.tsx
@@ -109543,7 +109962,7 @@ function PendingAttachments({ items: all }) {
109543
109962
  }
109544
109963
 
109545
109964
  // src/components/layout/ReplFooter.tsx
109546
- var import_client_core31 = __toESM(require_dist(), 1);
109965
+ var import_client_core33 = __toESM(require_dist(), 1);
109547
109966
  var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
109548
109967
  function ReplFooter({
109549
109968
  appStore,
@@ -109588,7 +110007,7 @@ function ReplFooter({
109588
110007
  const indexPhase = useStoreSelector(appStore, (s) => s.indexPhase);
109589
110008
  const indexBadgeText = useStoreSelector(
109590
110009
  appStore,
109591
- (s) => (0, import_client_core31.formatIndexBadge)({
110010
+ (s) => (0, import_client_core33.formatIndexBadge)({
109592
110011
  mode: s.indexMode,
109593
110012
  phase: s.indexPhase,
109594
110013
  percent: s.indexPercent,
@@ -109603,6 +110022,11 @@ function ReplFooter({
109603
110022
  (s) => s.pendingPermissions.length > 0 || !!s.pendingPlanApproval || !!s.pendingAskUser || !!s.pendingWorkPlan
109604
110023
  );
109605
110024
  const closePanel = () => appStore.setState((s) => ({ ...s, activePanel: null }));
110025
+ const onQueuePop = import_react45.default.useCallback(
110026
+ (draft) => popEditableQueue(appStore, draft),
110027
+ [appStore]
110028
+ );
110029
+ const [menuOpen, setMenuOpen] = import_react45.default.useState(false);
109606
110030
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
109607
110031
  streaming && !parked && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(WorkingStatus, { store: appStore }),
109608
110032
  plan && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(PlanCard, { plan }),
@@ -109700,22 +110124,24 @@ function ReplFooter({
109700
110124
  onPasteImage,
109701
110125
  onToggleVerbose,
109702
110126
  onCycleMode,
110127
+ onMenuOpenChange: setMenuOpen,
109703
110128
  onScroll,
109704
110129
  mode,
109705
110130
  permissionMode,
109706
110131
  indexBadge,
109707
- onIndexBadgeActivate: openIndexChooser
110132
+ onIndexBadgeActivate: openIndexChooser,
110133
+ onQueuePop
109708
110134
  }
109709
110135
  )
109710
110136
  ] }),
109711
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(StatusBar, { store: appStore, indexBadge }),
110137
+ menuOpen ? null : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(StatusBar, { store: appStore, indexBadge }),
109712
110138
  workRun ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(WorkRunGraph, { view: workRun.view }) : null,
109713
110139
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(SubAgentList, { agents: subAgents, awaiting: subagentsAwaiting > 0 })
109714
110140
  ] });
109715
110141
  }
109716
110142
 
109717
110143
  // src/components/layout/FullscreenLayout.tsx
109718
- var import_react45 = __toESM(require_react(), 1);
110144
+ var import_react46 = __toESM(require_react(), 1);
109719
110145
  var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
109720
110146
  function FullscreenLayout({
109721
110147
  appStore,
@@ -109737,7 +110163,7 @@ function FullscreenLayout({
109737
110163
  onCycleMode
109738
110164
  }) {
109739
110165
  const { columns, rows } = useTerminalSize();
109740
- const scrollRef = (0, import_react45.useRef)(null);
110166
+ const scrollRef = (0, import_react46.useRef)(null);
109741
110167
  const onScroll = (delta) => {
109742
110168
  const sb = scrollRef.current;
109743
110169
  if (!sb) return;
@@ -109772,9 +110198,9 @@ function FullscreenLayout({
109772
110198
  }
109773
110199
 
109774
110200
  // src/components/dialogs/AgentsDashboard.tsx
109775
- var import_react46 = __toESM(require_react(), 1);
109776
- var import_client_core32 = __toESM(require_dist(), 1);
109777
- var import_client_ui_core16 = __toESM(require_dist2(), 1);
110201
+ var import_react47 = __toESM(require_react(), 1);
110202
+ var import_client_core34 = __toESM(require_dist(), 1);
110203
+ var import_client_ui_core17 = __toESM(require_dist2(), 1);
109778
110204
  var import_strip_ansi4 = __toESM(require_strip_ansi(), 1);
109779
110205
  var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
109780
110206
  var POLL_MS = 2500;
@@ -109819,51 +110245,51 @@ function AgentsDashboard({
109819
110245
  onClose
109820
110246
  }) {
109821
110247
  const { rows } = useTerminalSize();
109822
- const [screen, setScreen] = (0, import_react46.useState)({ kind: "list" });
109823
- const [cursor, setCursor] = (0, import_react46.useState)(0);
109824
- const [busy, setBusy] = (0, import_react46.useState)(false);
109825
- const [error, setError] = (0, import_react46.useState)(null);
109826
- const [liveJob, setLiveJob] = (0, import_react46.useState)(null);
109827
- const [events, setEvents] = (0, import_react46.useState)([]);
109828
- const [pollError, setPollError] = (0, import_react46.useState)(null);
109829
- const [diff3, setDiff] = (0, import_react46.useState)(null);
109830
- const diffFetchedFor = (0, import_react46.useRef)(null);
109831
- const [liveItems, setLiveItems] = (0, import_react46.useState)([]);
109832
- const [liveTerm, setLiveTerm] = (0, import_react46.useState)("");
109833
- const [liveFrames, setLiveFrames] = (0, import_react46.useState)(0);
109834
- const liveIdRef = (0, import_react46.useRef)(0);
109835
- const [messaging, setMessaging] = (0, import_react46.useState)(false);
109836
- const [messageText, setMessageText] = (0, import_react46.useState)("");
109837
- const [messageNote, setMessageNote] = (0, import_react46.useState)(null);
109838
- const [tokenStatus, setTokenStatus] = (0, import_react46.useState)(null);
109839
- const [tokenBusy, setTokenBusy] = (0, import_react46.useState)(false);
109840
- const [tokenNote, setTokenNote] = (0, import_react46.useState)(null);
109841
- const [tokenInput, setTokenInput] = (0, import_react46.useState)(false);
109842
- const [tokenDraft, setTokenDraft] = (0, import_react46.useState)("");
109843
- const [jiraStatus, setJiraStatus] = (0, import_react46.useState)(null);
109844
- const [jiraBusy, setJiraBusy] = (0, import_react46.useState)(false);
109845
- const [jiraNote, setJiraNote] = (0, import_react46.useState)(null);
109846
- const [jiraInput, setJiraInput] = (0, import_react46.useState)(null);
109847
- const [form, setForm] = (0, import_react46.useState)(EMPTY_FORM);
109848
- const [field2, setField] = (0, import_react46.useState)(0);
110248
+ const [screen, setScreen] = (0, import_react47.useState)({ kind: "list" });
110249
+ const [cursor, setCursor] = (0, import_react47.useState)(0);
110250
+ const [busy, setBusy] = (0, import_react47.useState)(false);
110251
+ const [error, setError] = (0, import_react47.useState)(null);
110252
+ const [liveJob, setLiveJob] = (0, import_react47.useState)(null);
110253
+ const [events, setEvents] = (0, import_react47.useState)([]);
110254
+ const [pollError, setPollError] = (0, import_react47.useState)(null);
110255
+ const [diff3, setDiff] = (0, import_react47.useState)(null);
110256
+ const diffFetchedFor = (0, import_react47.useRef)(null);
110257
+ const [liveItems, setLiveItems] = (0, import_react47.useState)([]);
110258
+ const [liveTerm, setLiveTerm] = (0, import_react47.useState)("");
110259
+ const [liveFrames, setLiveFrames] = (0, import_react47.useState)(0);
110260
+ const liveIdRef = (0, import_react47.useRef)(0);
110261
+ const [messaging, setMessaging] = (0, import_react47.useState)(false);
110262
+ const [messageText, setMessageText] = (0, import_react47.useState)("");
110263
+ const [messageNote, setMessageNote] = (0, import_react47.useState)(null);
110264
+ const [tokenStatus, setTokenStatus] = (0, import_react47.useState)(null);
110265
+ const [tokenBusy, setTokenBusy] = (0, import_react47.useState)(false);
110266
+ const [tokenNote, setTokenNote] = (0, import_react47.useState)(null);
110267
+ const [tokenInput, setTokenInput] = (0, import_react47.useState)(false);
110268
+ const [tokenDraft, setTokenDraft] = (0, import_react47.useState)("");
110269
+ const [jiraStatus, setJiraStatus] = (0, import_react47.useState)(null);
110270
+ const [jiraBusy, setJiraBusy] = (0, import_react47.useState)(false);
110271
+ const [jiraNote, setJiraNote] = (0, import_react47.useState)(null);
110272
+ const [jiraInput, setJiraInput] = (0, import_react47.useState)(null);
110273
+ const [form, setForm] = (0, import_react47.useState)(EMPTY_FORM);
110274
+ const [field2, setField] = (0, import_react47.useState)(0);
109849
110275
  const jobs = panel.jobs;
109850
110276
  const safeCursor = Math.min(cursor, Math.max(0, jobs.length - 1));
109851
110277
  const detailId = screen.kind === "detail" ? screen.id : null;
109852
110278
  const detailJob = detailId ? liveJob ?? jobs.find((j2) => j2.id === detailId) ?? null : null;
109853
- const panelRef = (0, import_react46.useRef)(panel);
110279
+ const panelRef = (0, import_react47.useRef)(panel);
109854
110280
  panelRef.current = panel;
109855
- const screenRef = (0, import_react46.useRef)(screen);
110281
+ const screenRef = (0, import_react47.useRef)(screen);
109856
110282
  screenRef.current = screen;
109857
- const oauthAlive = (0, import_react46.useRef)(true);
109858
- const oauthTimer = (0, import_react46.useRef)(null);
109859
- (0, import_react46.useEffect)(
110283
+ const oauthAlive = (0, import_react47.useRef)(true);
110284
+ const oauthTimer = (0, import_react47.useRef)(null);
110285
+ (0, import_react47.useEffect)(
109860
110286
  () => () => {
109861
110287
  oauthAlive.current = false;
109862
110288
  if (oauthTimer.current) clearTimeout(oauthTimer.current);
109863
110289
  },
109864
110290
  []
109865
110291
  );
109866
- (0, import_react46.useEffect)(() => {
110292
+ (0, import_react47.useEffect)(() => {
109867
110293
  if (!detailId) return;
109868
110294
  let cancelled = false;
109869
110295
  let timer = null;
@@ -109890,11 +110316,11 @@ function AgentsDashboard({
109890
110316
  setEvents((prev) => [...prev, ...fresh]);
109891
110317
  }
109892
110318
  setPollError(null);
109893
- if (!(0, import_client_core32.isTerminal)(job.status)) timer = setTimeout(tick, POLL_MS);
110319
+ if (!(0, import_client_core34.isTerminal)(job.status)) timer = setTimeout(tick, POLL_MS);
109894
110320
  } catch (e) {
109895
110321
  if (cancelled) return;
109896
- setPollError((0, import_client_core32.formatMissionsError)(e));
109897
- if (latest && (0, import_client_core32.isTerminal)(latest.status)) return;
110322
+ setPollError((0, import_client_core34.formatMissionsError)(e));
110323
+ if (latest && (0, import_client_core34.isTerminal)(latest.status)) return;
109898
110324
  timer = setTimeout(tick, POLL_MS);
109899
110325
  }
109900
110326
  };
@@ -109905,7 +110331,7 @@ function AgentsDashboard({
109905
110331
  };
109906
110332
  }, [detailId]);
109907
110333
  const branchName = detailJob?.branch_name ?? null;
109908
- (0, import_react46.useEffect)(() => {
110334
+ (0, import_react47.useEffect)(() => {
109909
110335
  if (!detailId || !branchName) return;
109910
110336
  const key = `${detailId}:${branchName}`;
109911
110337
  if (diffFetchedFor.current === key) return;
@@ -109922,8 +110348,8 @@ function AgentsDashboard({
109922
110348
  cancelled = true;
109923
110349
  };
109924
110350
  }, [detailId, branchName]);
109925
- const liveSessionId = detailJob && !(0, import_client_core32.isTerminal)(detailJob.status) && detailJob.session_id ? detailJob.session_id : null;
109926
- (0, import_react46.useEffect)(() => {
110351
+ const liveSessionId = detailJob && !(0, import_client_core34.isTerminal)(detailJob.status) && detailJob.session_id ? detailJob.session_id : null;
110352
+ (0, import_react47.useEffect)(() => {
109927
110353
  if (!liveSessionId) return;
109928
110354
  liveIdRef.current = 0;
109929
110355
  setLiveItems([]);
@@ -109931,20 +110357,20 @@ function AgentsDashboard({
109931
110357
  setLiveFrames(0);
109932
110358
  const nextId = () => liveIdRef.current += 1;
109933
110359
  const sub = panelRef.current.watch(liveSessionId, (env3) => {
109934
- if ((0, import_client_core32.desktopFrameOf)(env3) !== null) {
110360
+ if ((0, import_client_core34.desktopFrameOf)(env3) !== null) {
109935
110361
  setLiveFrames((n) => n + 1);
109936
110362
  return;
109937
110363
  }
109938
- const chunk = (0, import_client_core32.terminalChunkOf)(env3);
110364
+ const chunk = (0, import_client_core34.terminalChunkOf)(env3);
109939
110365
  if (chunk !== null) {
109940
- setLiveTerm((tail) => (0, import_client_core32.appendTerminalTail)(tail, (0, import_strip_ansi4.default)(chunk)));
110366
+ setLiveTerm((tail) => (0, import_client_core34.appendTerminalTail)(tail, (0, import_strip_ansi4.default)(chunk)));
109941
110367
  return;
109942
110368
  }
109943
- setLiveItems((prev) => (0, import_client_core32.applyLiveThreadEvent)(prev, env3, nextId));
110369
+ setLiveItems((prev) => (0, import_client_core34.applyLiveThreadEvent)(prev, env3, nextId));
109944
110370
  });
109945
110371
  return () => sub.dispose();
109946
110372
  }, [liveSessionId]);
109947
- (0, import_react46.useEffect)(() => {
110373
+ (0, import_react47.useEffect)(() => {
109948
110374
  let cancelled = false;
109949
110375
  void (async () => {
109950
110376
  try {
@@ -109972,7 +110398,7 @@ function AgentsDashboard({
109972
110398
  const runAction = (action) => {
109973
110399
  setBusy(true);
109974
110400
  setError(null);
109975
- void action().catch((e) => setError((0, import_client_core32.formatMissionsError)(e))).finally(() => setBusy(false));
110401
+ void action().catch((e) => setError((0, import_client_core34.formatMissionsError)(e))).finally(() => setBusy(false));
109976
110402
  };
109977
110403
  const submitMessage = (id) => {
109978
110404
  const text = messageText.trim();
@@ -109988,7 +110414,7 @@ function AgentsDashboard({
109988
110414
  setMessaging(false);
109989
110415
  setMessageNote("Follow-up started.");
109990
110416
  setScreen({ kind: "detail", id: created.job_id });
109991
- }).catch((e) => setMessageNote((0, import_client_core32.formatMissionsError)(e))).finally(() => setBusy(false));
110417
+ }).catch((e) => setMessageNote((0, import_client_core34.formatMissionsError)(e))).finally(() => setBusy(false));
109992
110418
  return;
109993
110419
  }
109994
110420
  if (detailJob?.status === "needs_human_input") {
@@ -109998,7 +110424,7 @@ function AgentsDashboard({
109998
110424
  setMessageText("");
109999
110425
  setMessaging(false);
110000
110426
  setMessageNote("Resumed.");
110001
- }).catch((e) => setMessageNote((0, import_client_core32.formatMissionsError)(e))).finally(() => setBusy(false));
110427
+ }).catch((e) => setMessageNote((0, import_client_core34.formatMissionsError)(e))).finally(() => setBusy(false));
110002
110428
  return;
110003
110429
  }
110004
110430
  if (!text) {
@@ -110011,7 +110437,7 @@ function AgentsDashboard({
110011
110437
  setMessageText("");
110012
110438
  setMessaging(false);
110013
110439
  setMessageNote(res.delivered ? "Sent to the agent." : "Queued for the next phase.");
110014
- }).catch((e) => setMessageNote((0, import_client_core32.formatMissionsError)(e))).finally(() => setBusy(false));
110440
+ }).catch((e) => setMessageNote((0, import_client_core34.formatMissionsError)(e))).finally(() => setBusy(false));
110015
110441
  };
110016
110442
  const tokenHost = tokenStatus?.host || "github.com";
110017
110443
  const startConnect = () => {
@@ -110092,7 +110518,7 @@ function AgentsDashboard({
110092
110518
  setTokenInput(false);
110093
110519
  setTokenDraft("");
110094
110520
  setTokenNote("Token saved.");
110095
- }).catch((e) => setTokenNote((0, import_client_core32.formatMissionsError)(e))).finally(() => setTokenBusy(false));
110521
+ }).catch((e) => setTokenNote((0, import_client_core34.formatMissionsError)(e))).finally(() => setTokenBusy(false));
110096
110522
  };
110097
110523
  const submitJiraStep = () => {
110098
110524
  if (!jiraInput) return;
@@ -110121,7 +110547,7 @@ function AgentsDashboard({
110121
110547
  );
110122
110548
  setJiraInput(null);
110123
110549
  setJiraNote("Jira connected \u2014 the launch form's Ticket field is live.");
110124
- }).catch((e) => setJiraNote((0, import_client_core32.formatMissionsError)(e))).finally(() => setJiraBusy(false));
110550
+ }).catch((e) => setJiraNote((0, import_client_core34.formatMissionsError)(e))).finally(() => setJiraBusy(false));
110125
110551
  };
110126
110552
  const removeJira = () => {
110127
110553
  if (jiraBusy) return;
@@ -110130,7 +110556,7 @@ function AgentsDashboard({
110130
110556
  void panel.clearTicketConnection().then(() => {
110131
110557
  setJiraStatus((p) => p ? { ...p, configured: false, base_url: null, hint: null } : p);
110132
110558
  setJiraNote("Jira connection removed.");
110133
- }).catch((e) => setJiraNote((0, import_client_core32.formatMissionsError)(e))).finally(() => setJiraBusy(false));
110559
+ }).catch((e) => setJiraNote((0, import_client_core34.formatMissionsError)(e))).finally(() => setJiraBusy(false));
110134
110560
  };
110135
110561
  const removeToken = () => {
110136
110562
  if (tokenBusy) return;
@@ -110139,7 +110565,7 @@ function AgentsDashboard({
110139
110565
  void panel.clearToken().then(() => {
110140
110566
  setTokenStatus((p) => p ? { ...p, configured: false, hint: null } : p);
110141
110567
  setTokenNote("Token removed.");
110142
- }).catch((e) => setTokenNote((0, import_client_core32.formatMissionsError)(e))).finally(() => setTokenBusy(false));
110568
+ }).catch((e) => setTokenNote((0, import_client_core34.formatMissionsError)(e))).finally(() => setTokenBusy(false));
110143
110569
  };
110144
110570
  const submitLaunch = () => {
110145
110571
  const repo_url = form.repo_url.trim();
@@ -110159,7 +110585,7 @@ function AgentsDashboard({
110159
110585
  setForm(EMPTY_FORM);
110160
110586
  setField(0);
110161
110587
  setScreen({ kind: "list" });
110162
- }).catch((e) => setError((0, import_client_core32.formatMissionsError)(e))).finally(() => setBusy(false));
110588
+ }).catch((e) => setError((0, import_client_core34.formatMissionsError)(e))).finally(() => setBusy(false));
110163
110589
  };
110164
110590
  use_input_default((input, key) => {
110165
110591
  if (busy) return;
@@ -110198,14 +110624,14 @@ function AgentsDashboard({
110198
110624
  return;
110199
110625
  }
110200
110626
  if (key.escape || input === "q") return setScreen({ kind: "list" });
110201
- if (input === "m" && job && (!(0, import_client_core32.isTerminal)(job.status) || job.status === "complete")) {
110627
+ if (input === "m" && job && (!(0, import_client_core34.isTerminal)(job.status) || job.status === "complete")) {
110202
110628
  setMessageNote(null);
110203
110629
  return setMessaging(true);
110204
110630
  }
110205
- if (input === "i" && job && !(0, import_client_core32.isTerminal)(job.status) && job.status !== "needs_human_input") {
110631
+ if (input === "i" && job && !(0, import_client_core34.isTerminal)(job.status) && job.status !== "needs_human_input") {
110206
110632
  return runAction(() => panel.interrupt(screen.id).then(() => void 0));
110207
110633
  }
110208
- if (input === "c" && job && !(0, import_client_core32.isTerminal)(job.status)) {
110634
+ if (input === "c" && job && !(0, import_client_core34.isTerminal)(job.status)) {
110209
110635
  return runAction(() => panel.cancel(screen.id));
110210
110636
  }
110211
110637
  if (input === "r") return runAction(() => panel.refresh().then(() => void 0));
@@ -110278,7 +110704,7 @@ function AgentsDashboard({
110278
110704
  setError(null);
110279
110705
  return setScreen({ kind: "detail", id: here.id });
110280
110706
  }
110281
- if (input === "c" && !(0, import_client_core32.isTerminal)(here.status)) {
110707
+ if (input === "c" && !(0, import_client_core34.isTerminal)(here.status)) {
110282
110708
  return runAction(() => panel.cancel(here.id));
110283
110709
  }
110284
110710
  });
@@ -110305,7 +110731,7 @@ function AgentsDashboard({
110305
110731
  // point. This MUST match the `m`-key gate (which allows complete): if the
110306
110732
  // key opens messaging but the render gate stays !isTerminal, the user types
110307
110733
  // blind and errors never paint.
110308
- live: !!(detailJob && (!(0, import_client_core32.isTerminal)(detailJob.status) || detailJob.status === "complete")),
110734
+ live: !!(detailJob && (!(0, import_client_core34.isTerminal)(detailJob.status) || detailJob.status === "complete")),
110309
110735
  messaging,
110310
110736
  text: messageText,
110311
110737
  note: messageNote,
@@ -110357,10 +110783,10 @@ function footerHint(screen, job, messaging, conn) {
110357
110783
  }
110358
110784
  if (parked) return "m resume \xB7 c cancel \xB7 r refresh \xB7 q back";
110359
110785
  if (job?.status === "complete") return "m follow-up \xB7 r refresh \xB7 q back";
110360
- const steer = job && !(0, import_client_core32.isTerminal)(job.status) ? "m message \xB7 i interrupt \xB7 c cancel \xB7 " : "";
110786
+ const steer = job && !(0, import_client_core34.isTerminal)(job.status) ? "m message \xB7 i interrupt \xB7 c cancel \xB7 " : "";
110361
110787
  return `${steer}r refresh \xB7 q back`;
110362
110788
  }
110363
- const cancel = job && !(0, import_client_core32.isTerminal)(job.status) ? "c cancel \xB7 " : "";
110789
+ const cancel = job && !(0, import_client_core34.isTerminal)(job.status) ? "c cancel \xB7 " : "";
110364
110790
  return `\u2191/\u2193 move \xB7 enter open \xB7 n new \xB7 s connections \xB7 ${cancel}r refresh \xB7 q close`;
110365
110791
  }
110366
110792
  function ConnectionsView({
@@ -110494,7 +110920,7 @@ function JobDetailView({
110494
110920
  composer
110495
110921
  }) {
110496
110922
  if (!job) return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ThemedText, { dim: true, children: "Job not found." });
110497
- const terminal = (0, import_client_core32.isTerminal)(job.status);
110923
+ const terminal = (0, import_client_core34.isTerminal)(job.status);
110498
110924
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(Box2, { flexDirection: "column", children: [
110499
110925
  /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ThemedText, { colorKey: "listSelection", bold: true, children: jobTitle(job) }),
110500
110926
  /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
@@ -110546,7 +110972,7 @@ function JobDetailView({
110546
110972
  // terminal tail is showing, the thread cedes rows to it so yoga never has to
110547
110973
  // shrink the section headers away on a small terminal.
110548
110974
  live.slice(term ? -4 : -8).map(
110549
- (it) => it.kind === "text" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ThemedText, { wrap: "truncate-end", children: it.text.length > 500 ? `\u2026${it.text.slice(-500)}` : it.text }, it.id) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ThemedText, { dim: true, children: `\u2192 ${(0, import_client_ui_core16.toolDisplayName)(it.name)}` }, it.id)
110975
+ (it) => it.kind === "text" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ThemedText, { wrap: "truncate-end", children: it.text.length > 500 ? `\u2026${it.text.slice(-500)}` : it.text }, it.id) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ThemedText, { dim: true, children: `\u2192 ${(0, import_client_ui_core17.toolDisplayName)(it.name)}` }, it.id)
110550
110976
  )
110551
110977
  ),
110552
110978
  frames > 0 ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ThemedText, { dim: true, children: `\u{1F5A5} screen streaming \xB7 ${frames} frame${frames === 1 ? "" : "s"} (view in the desktop app)` }) : null,
@@ -110600,14 +111026,14 @@ function LaunchFormView({ form, field: field2 }) {
110600
111026
  }
110601
111027
 
110602
111028
  // src/components/layout/TerminalTitle.tsx
110603
- var import_react48 = __toESM(require_react(), 1);
111029
+ var import_react49 = __toESM(require_react(), 1);
110604
111030
 
110605
111031
  // src/vendor/ink/hooks/use-terminal-title.ts
110606
- var import_react47 = __toESM(require_react(), 1);
111032
+ var import_react48 = __toESM(require_react(), 1);
110607
111033
  var import_strip_ansi5 = __toESM(require_strip_ansi(), 1);
110608
111034
  function useTerminalTitle(title) {
110609
- const writeRaw = (0, import_react47.useContext)(TerminalWriteContext);
110610
- (0, import_react47.useEffect)(() => {
111035
+ const writeRaw = (0, import_react48.useContext)(TerminalWriteContext);
111036
+ (0, import_react48.useEffect)(() => {
110611
111037
  if (title === null || !writeRaw) return;
110612
111038
  const clean = (0, import_strip_ansi5.default)(title);
110613
111039
  if (process.platform === "win32") {
@@ -110633,8 +111059,8 @@ function composeTerminalTitle(sessionTitle, streaming, frame) {
110633
111059
  function TerminalTitle({ appStore }) {
110634
111060
  const sessionTitle = useStoreSelector(appStore, (s) => s.sessionTitle);
110635
111061
  const streaming = useStoreSelector(appStore, (s) => s.status === "streaming");
110636
- const [frame, setFrame] = (0, import_react48.useState)(0);
110637
- (0, import_react48.useEffect)(() => {
111062
+ const [frame, setFrame] = (0, import_react49.useState)(0);
111063
+ (0, import_react49.useEffect)(() => {
110638
111064
  if (!streaming) return;
110639
111065
  const id = setInterval(
110640
111066
  () => setFrame((f) => (f + 1) % TITLE_ANIMATION_FRAMES.length),
@@ -110733,11 +111159,11 @@ function Root({
110733
111159
  }
110734
111160
 
110735
111161
  // src/components/layout/SignInScreen.tsx
110736
- var import_react50 = __toESM(require_react(), 1);
110737
- var import_client_core33 = __toESM(require_dist(), 1);
111162
+ var import_react51 = __toESM(require_react(), 1);
111163
+ var import_client_core35 = __toESM(require_dist(), 1);
110738
111164
 
110739
111165
  // src/components/layout/splash/Splash.tsx
110740
- var import_react49 = __toESM(require_react(), 1);
111166
+ var import_react50 = __toESM(require_react(), 1);
110741
111167
 
110742
111168
  // src/components/layout/splash/halfblock.ts
110743
111169
  var BLOCK = [" ", "\u2580", "\u2584", "\u2588"];
@@ -111056,7 +111482,7 @@ var TONE = {
111056
111482
  function Splash({ columns, rows, frame, copy }) {
111057
111483
  const theme = useTheme();
111058
111484
  const height = splashHeight(rows);
111059
- const shell2 = import_react49.default.useMemo(() => orbShell(), []);
111485
+ const shell2 = import_react50.default.useMemo(() => orbShell(), []);
111060
111486
  const grid = splashFrame({ width: columns, rows: height, frame, shell: shell2, copy });
111061
111487
  return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Box2, { flexDirection: "column", children: grid.map((spans, y2) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Text2, { wrap: "truncate", children: spans.length === 0 ? " " : spans.map((span, i2) => renderSpan(span, i2, theme)) }, y2)) });
111062
111488
  }
@@ -111102,15 +111528,15 @@ function SignInScreen({
111102
111528
  onSignedIn
111103
111529
  }) {
111104
111530
  const { exit } = use_app_default();
111105
- const [phase, setPhase] = import_react50.default.useState("idle");
111106
- const [url, setUrl] = import_react50.default.useState(null);
111107
- const [error, setError] = import_react50.default.useState(null);
111108
- const [frame, setFrame] = import_react50.default.useState(0);
111531
+ const [phase, setPhase] = import_react51.default.useState("idle");
111532
+ const [url, setUrl] = import_react51.default.useState(null);
111533
+ const [error, setError] = import_react51.default.useState(null);
111534
+ const [frame, setFrame] = import_react51.default.useState(0);
111109
111535
  const { columns, rows } = useTerminalSize();
111110
- const caps = import_react50.default.useMemo(() => detectTerminal2(), []);
111536
+ const caps = import_react51.default.useMemo(() => detectTerminal2(), []);
111111
111537
  const copy = splashCopy(phase, error, url, columns);
111112
111538
  const useSplash = !splashDisabled() && caps.unicode && splashFits(columns, rows, copy.length);
111113
- import_react50.default.useEffect(() => {
111539
+ import_react51.default.useEffect(() => {
111114
111540
  if (!useSplash || phase !== "idle") return;
111115
111541
  const t = setInterval(() => setFrame((f) => f + 1), TICK_MS);
111116
111542
  return () => clearInterval(t);
@@ -111120,7 +111546,7 @@ function SignInScreen({
111120
111546
  setUrl(null);
111121
111547
  setError(null);
111122
111548
  try {
111123
- await (0, import_client_core33.signInViaBrowser)(
111549
+ await (0, import_client_core35.signInViaBrowser)(
111124
111550
  session,
111125
111551
  { accountsUrl, accountsApiUrl, client: "tui" },
111126
111552
  {
@@ -111229,16 +111655,16 @@ function SignInCard({
111229
111655
  }
111230
111656
 
111231
111657
  // src/services/presenceHost.ts
111232
- var import_client_core34 = __toESM(require_dist(), 1);
111658
+ var import_client_core36 = __toESM(require_dist(), 1);
111233
111659
  function startTuiPresence(opts) {
111234
- const registry = opts.registry ?? new import_client_core34.PresenceRegistry({ clientType: "tui" });
111660
+ const registry = opts.registry ?? new import_client_core36.PresenceRegistry({ clientType: "tui" });
111235
111661
  let currentSid = null;
111236
111662
  let lastStatus = "idle";
111237
111663
  const statusFromApp = (s) => s.pendingPermissions.length > 0 ? "waiting" : s.status === "streaming" ? "busy" : "idle";
111238
111664
  const stampGit = () => {
111239
111665
  if (!opts.workspaceRoot || !currentSid) return;
111240
111666
  const sid = currentSid;
111241
- void (0, import_client_core34.getGitInfo)(opts.workspaceRoot).then((info2) => {
111667
+ void (0, import_client_core36.getGitInfo)(opts.workspaceRoot).then((info2) => {
111242
111668
  if (sid !== currentSid) return;
111243
111669
  registry.updateSession(sid, {
111244
111670
  gitRoot: info2.gitRoot ?? void 0,
@@ -111274,11 +111700,11 @@ function startTuiPresence(opts) {
111274
111700
  ownSessionId: currentSid ?? void 0,
111275
111701
  fresh: true
111276
111702
  });
111277
- return peers.map((p) => `${(0, import_client_core34.describePeer)(p)} \u2014 ${p.session.status}`);
111703
+ return peers.map((p) => `${(0, import_client_core36.describePeer)(p)} \u2014 ${p.session.status}`);
111278
111704
  },
111279
111705
  async liveElsewhere(sessionId) {
111280
111706
  const peer = await registry.isSessionLiveElsewhere(sessionId);
111281
- return peer ? (0, import_client_core34.describePeer)(peer) : null;
111707
+ return peer ? (0, import_client_core36.describePeer)(peer) : null;
111282
111708
  },
111283
111709
  dispose() {
111284
111710
  unsubscribe();
@@ -111288,7 +111714,7 @@ function startTuiPresence(opts) {
111288
111714
  }
111289
111715
 
111290
111716
  // src/services/remoteControlHost.ts
111291
- var import_client_core35 = __toESM(require_dist(), 1);
111717
+ var import_client_core37 = __toESM(require_dist(), 1);
111292
111718
  import os5 from "os";
111293
111719
  var REMOTE_DENIED = /* @__PURE__ */ new Set([
111294
111720
  // Session/process-scoped.
@@ -111338,17 +111764,17 @@ function flattenInfoView(view) {
111338
111764
  function startTuiRemoteControl(opts) {
111339
111765
  let currentSid = null;
111340
111766
  const stateFromApp = (s) => s.pendingPermissions.length > 0 || s.pendingPlanApproval !== null || s.pendingAskUser !== null ? "needs_you" : s.status === "streaming" ? "running" : "idle";
111341
- const requireCurrent = (sessionId) => sessionId === currentSid ? null : (0, import_client_core35.rcRefuse)("unknown_session", "this terminal is on a different session");
111767
+ const requireCurrent = (sessionId) => sessionId === currentSid ? null : (0, import_client_core37.rcRefuse)("unknown_session", "this terminal is on a different session");
111342
111768
  const deliverText = (text, attachments) => {
111343
111769
  if (opts.appStore.getState().status === "streaming") {
111344
111770
  if (attachments !== void 0 && attachments.length > 0) {
111345
- return (0, import_client_core35.rcRefusePhotosMidTurn)();
111771
+ return (0, import_client_core37.rcRefusePhotosMidTurn)();
111346
111772
  }
111347
111773
  opts.verbs.steer(text);
111348
- return import_client_core35.RC_OK;
111774
+ return import_client_core37.RC_OK;
111349
111775
  }
111350
111776
  const sent = attachments !== void 0 && attachments.length > 0 ? opts.verbs.send(text, attachments) : opts.verbs.send(text);
111351
- return sent ? import_client_core35.RC_OK : (0, import_client_core35.rcRefuse)("signed_out", "sign in on this machine first");
111777
+ return sent ? import_client_core37.RC_OK : (0, import_client_core37.rcRefuse)("signed_out", "sign in on this machine first");
111352
111778
  };
111353
111779
  const commandCatalog = () => opts.commands === void 0 ? [] : opts.commands.registry.all().filter((command) => !REMOTE_DENIED.has(command.name)).map((command) => ({
111354
111780
  name: command.name,
@@ -111357,15 +111783,15 @@ function startTuiRemoteControl(opts) {
111357
111783
  }));
111358
111784
  const runRemoteCommand = async (text) => {
111359
111785
  const wired = opts.commands;
111360
- if (wired === void 0) return (0, import_client_core35.rcRefuse)("unsupported", "commands are not wired");
111786
+ if (wired === void 0) return (0, import_client_core37.rcRefuse)("unsupported", "commands are not wired");
111361
111787
  const parsed = wired.registry.parse(text);
111362
- if (parsed === null) return (0, import_client_core35.rcRefuse)("unsupported", "unknown command");
111788
+ if (parsed === null) return (0, import_client_core37.rcRefuse)("unsupported", "unknown command");
111363
111789
  const { command, args: args2 } = parsed;
111364
111790
  if (REMOTE_DENIED.has(command.name)) {
111365
- return (0, import_client_core35.rcRefuse)("unsupported", "this command runs at the terminal only");
111791
+ return (0, import_client_core37.rcRefuse)("unsupported", "this command runs at the terminal only");
111366
111792
  }
111367
111793
  if (REMOTE_ARG_REQUIRED.has(command.name) && args2.trim() === "") {
111368
- return (0, import_client_core35.rcRefuse)(
111794
+ return (0, import_client_core37.rcRefuse)(
111369
111795
  "unsupported",
111370
111796
  `add a value: /${command.name} ${command.argumentHint ?? "<value>"}`
111371
111797
  );
@@ -111391,11 +111817,11 @@ function startTuiRemoteControl(opts) {
111391
111817
  try {
111392
111818
  await command.run(args2, ctx);
111393
111819
  } catch (error) {
111394
- return (0, import_client_core35.rcRefuse)("internal", error instanceof Error ? error.message : String(error));
111820
+ return (0, import_client_core37.rcRefuse)("internal", error instanceof Error ? error.message : String(error));
111395
111821
  }
111396
111822
  return { ok: true, ...lines.length > 0 ? { output: lines.join("\n") } : {} };
111397
111823
  };
111398
- const host = (0, import_client_core35.createRemoteControlHost)({
111824
+ const host = (0, import_client_core37.createRemoteControlHost)({
111399
111825
  clientType: "tui",
111400
111826
  bridge: opts.bridge,
111401
111827
  machineId: os5.hostname(),
@@ -111427,18 +111853,18 @@ function startTuiRemoteControl(opts) {
111427
111853
  const refusal = requireCurrent(sessionId);
111428
111854
  if (refusal) return refusal;
111429
111855
  opts.verbs.deliverAgentMessage(message);
111430
- return import_client_core35.RC_OK;
111856
+ return import_client_core37.RC_OK;
111431
111857
  },
111432
111858
  resolvePermission: (sessionId, requestId, decision) => {
111433
111859
  const refusal = requireCurrent(sessionId);
111434
111860
  if (refusal) return refusal;
111435
- return opts.verbs.resolvePermission(requestId, decision, sessionId) ? import_client_core35.RC_OK : (0, import_client_core35.rcRefuse)("no_pending_permission", "that prompt was already answered");
111861
+ return opts.verbs.resolvePermission(requestId, decision, sessionId) ? import_client_core37.RC_OK : (0, import_client_core37.rcRefuse)("no_pending_permission", "that prompt was already answered");
111436
111862
  },
111437
111863
  interrupt: (sessionId) => {
111438
111864
  const refusal = requireCurrent(sessionId);
111439
111865
  if (refusal) return refusal;
111440
111866
  opts.verbs.interrupt();
111441
- return import_client_core35.RC_OK;
111867
+ return import_client_core37.RC_OK;
111442
111868
  },
111443
111869
  runCommand: (sessionId, text) => {
111444
111870
  const refusal = requireCurrent(sessionId);
@@ -111450,14 +111876,14 @@ function startTuiRemoteControl(opts) {
111450
111876
  if (refusal) return refusal;
111451
111877
  const ok2 = await opts.verbs.setModel(
111452
111878
  model,
111453
- effort === void 0 ? void 0 : (0, import_client_core35.rcEffortToLocal)(effort)
111879
+ effort === void 0 ? void 0 : (0, import_client_core37.rcEffortToLocal)(effort)
111454
111880
  );
111455
- return ok2 ? import_client_core35.RC_OK : (0, import_client_core35.rcRefuse)("internal", "couldn't switch the model");
111881
+ return ok2 ? import_client_core37.RC_OK : (0, import_client_core37.rcRefuse)("internal", "couldn't switch the model");
111456
111882
  },
111457
111883
  setMode: (sessionId, mode) => {
111458
111884
  const refusal = requireCurrent(sessionId);
111459
111885
  if (refusal) return refusal;
111460
- return opts.verbs.setMode(mode) ? import_client_core35.RC_OK : (0, import_client_core35.rcRefuse)("internal", "couldn't switch permissions");
111886
+ return opts.verbs.setMode(mode) ? import_client_core37.RC_OK : (0, import_client_core37.rcRefuse)("internal", "couldn't switch permissions");
111461
111887
  },
111462
111888
  committedMessages: (sessionId) => sessionId === currentSid ? opts.committedMessages() : [],
111463
111889
  // Cards parked before anyone was watching: replayed at the end of an attach
@@ -111468,7 +111894,7 @@ function startTuiRemoteControl(opts) {
111468
111894
  const now2 = Date.now() / 1e3;
111469
111895
  return [
111470
111896
  ...app.pendingPermissions.map(
111471
- (parked) => (0, import_client_core35.parkedPermissionEvent)(
111897
+ (parked) => (0, import_client_core37.parkedPermissionEvent)(
111472
111898
  sessionId,
111473
111899
  {
111474
111900
  requestId: parked.data.request_id,
@@ -111483,7 +111909,7 @@ function startTuiRemoteControl(opts) {
111483
111909
  // The other two parked-decision cards ride the backfill tail the same way —
111484
111910
  // a phone arriving mid-plan (or mid-question) has something to answer.
111485
111911
  ...app.pendingPlanApproval !== null ? [
111486
- (0, import_client_core35.parkedPlanApprovalEvent)(
111912
+ (0, import_client_core37.parkedPlanApprovalEvent)(
111487
111913
  sessionId,
111488
111914
  {
111489
111915
  requestId: app.pendingPlanApproval.requestId,
@@ -111493,7 +111919,7 @@ function startTuiRemoteControl(opts) {
111493
111919
  )
111494
111920
  ] : [],
111495
111921
  ...app.pendingAskUser !== null ? [
111496
- (0, import_client_core35.parkedAskUserEvent)(
111922
+ (0, import_client_core37.parkedAskUserEvent)(
111497
111923
  sessionId,
111498
111924
  {
111499
111925
  requestId: app.pendingAskUser.requestId,
@@ -111507,7 +111933,7 @@ function startTuiRemoteControl(opts) {
111507
111933
  resolvePlanApproval: (sessionId, requestId, approved) => {
111508
111934
  const refusal = requireCurrent(sessionId);
111509
111935
  if (refusal) return refusal;
111510
- return opts.verbs.resolvePlanApproval(requestId, approved, sessionId) ? import_client_core35.RC_OK : (0, import_client_core35.rcRefuse)("no_pending_permission", "that plan was already answered");
111936
+ return opts.verbs.resolvePlanApproval(requestId, approved, sessionId) ? import_client_core37.RC_OK : (0, import_client_core37.rcRefuse)("no_pending_permission", "that plan was already answered");
111511
111937
  },
111512
111938
  answerQuestions: (sessionId, requestId, answers) => {
111513
111939
  const refusal = requireCurrent(sessionId);
@@ -111516,7 +111942,7 @@ function startTuiRemoteControl(opts) {
111516
111942
  requestId,
111517
111943
  answers,
111518
111944
  sessionId
111519
- ) ? import_client_core35.RC_OK : (0, import_client_core35.rcRefuse)("no_pending_permission", "those questions were already answered");
111945
+ ) ? import_client_core37.RC_OK : (0, import_client_core37.rcRefuse)("no_pending_permission", "those questions were already answered");
111520
111946
  }
111521
111947
  }
111522
111948
  });
@@ -111541,7 +111967,7 @@ function startTuiRemoteControl(opts) {
111541
111967
  host.updateSession(currentSid, {
111542
111968
  ...model !== void 0 ? { model } : {},
111543
111969
  mode: app.permissionMode,
111544
- effort: (0, import_client_core35.rcEffortToWire)(app.reasoning)
111970
+ effort: (0, import_client_core37.rcEffortToWire)(app.reasoning)
111545
111971
  });
111546
111972
  }
111547
111973
  const next = stateFromApp(app);
@@ -111575,7 +112001,7 @@ function startTuiRemoteControl(opts) {
111575
112001
  ...app.sessionTitle !== "" ? { title: app.sessionTitle } : {},
111576
112002
  ...lastModel !== void 0 ? { model: lastModel } : {},
111577
112003
  mode: lastMode,
111578
- effort: (0, import_client_core35.rcEffortToWire)(lastEffort)
112004
+ effort: (0, import_client_core37.rcEffortToWire)(lastEffort)
111579
112005
  });
111580
112006
  },
111581
112007
  status: () => host.status(),
@@ -111590,7 +112016,6 @@ function startTuiRemoteControl(opts) {
111590
112016
  // src/services/history.ts
111591
112017
  import * as fs12 from "fs";
111592
112018
  import * as path10 from "path";
111593
- var MAX_ENTRIES = 500;
111594
112019
  function historyFile() {
111595
112020
  return path10.join(orionHome(), "history.json");
111596
112021
  }
@@ -111603,11 +112028,9 @@ function loadHistory() {
111603
112028
  }
111604
112029
  }
111605
112030
  function appendHistory(text) {
111606
- const t = text.trim();
111607
- if (!t) return;
111608
- const cur = loadHistory();
111609
- if (cur[0] === t) return;
111610
- const next = [t, ...cur].slice(0, MAX_ENTRIES);
112031
+ const current2 = loadHistory();
112032
+ const next = pushEntry(current2, text);
112033
+ if (next === current2) return;
111611
112034
  try {
111612
112035
  fs12.mkdirSync(orionHome(), { recursive: true });
111613
112036
  const tmp = `${historyFile()}.tmp`;
@@ -111619,19 +112042,19 @@ function appendHistory(text) {
111619
112042
  }
111620
112043
 
111621
112044
  // src/services/indexer.ts
111622
- var import_client_core37 = __toESM(require_dist(), 1);
112045
+ var import_client_core39 = __toESM(require_dist(), 1);
111623
112046
 
111624
112047
  // src/services/nodeFileSource.ts
111625
- var import_client_core36 = __toESM(require_dist(), 1);
112048
+ var import_client_core38 = __toESM(require_dist(), 1);
111626
112049
 
111627
112050
  // src/services/indexer.ts
111628
112051
  import { fileURLToPath as fileURLToPath2 } from "url";
111629
112052
  import * as fs13 from "fs";
111630
112053
  import * as path11 from "path";
111631
- var INDEX_WATCH_INCLUDE = `**/*.{${import_client_core37.INDEX_FILE_EXTENSIONS.join(",")}}`;
111632
- var EXCLUDE = "{" + [...import_client_core37.IGNORE_DIRS].map((d2) => `**/${d2}/**`).join(",") + "}";
112054
+ var INDEX_WATCH_INCLUDE = `**/*.{${import_client_core39.INDEX_FILE_EXTENSIONS.join(",")}}`;
112055
+ var EXCLUDE = "{" + [...import_client_core39.IGNORE_DIRS].map((d2) => `**/${d2}/**`).join(",") + "}";
111633
112056
  function createIndexer(bridge, workspaceRoot, store, onStatus, onFileEvent, options = {}) {
111634
- const fileSource = new import_client_core36.NodeFileSource(workspaceRoot, {
112057
+ const fileSource = new import_client_core38.NodeFileSource(workspaceRoot, {
111635
112058
  watchInclude: INDEX_WATCH_INCLUDE,
111636
112059
  watchExclude: EXCLUDE
111637
112060
  });
@@ -111647,9 +112070,9 @@ function createIndexer(bridge, workspaceRoot, store, onStatus, onFileEvent, opti
111647
112070
  setFileCount: (n) => onStatus?.("orion.index.files", n)
111648
112071
  };
111649
112072
  const workerScriptPath = options.workerScriptPath ?? bundledIndexWorkerPath();
111650
- const controller = new import_client_core37.IndexModeController({
111651
- initialMode: (0, import_client_core37.normalizeIndexMode)(options.mode, "on"),
111652
- create: (defer) => new import_client_core37.ProcessWorkspaceIndexer({
112073
+ const controller = new import_client_core39.IndexModeController({
112074
+ initialMode: (0, import_client_core39.normalizeIndexMode)(options.mode, "on"),
112075
+ create: (defer) => new import_client_core39.ProcessWorkspaceIndexer({
111653
112076
  getRoot: () => workspaceRoot,
111654
112077
  indexConfig,
111655
112078
  progress,
@@ -111658,7 +112081,7 @@ function createIndexer(bridge, workspaceRoot, store, onStatus, onFileEvent, opti
111658
112081
  rgPath: options.rgPath ?? null,
111659
112082
  deferBuildUntilFirstQuery: defer,
111660
112083
  fallback: {
111661
- indexer: new import_client_core37.WorkspaceIndexer(bridge, fileSource, indexConfig, progress, grammarDir, store),
112084
+ indexer: new import_client_core39.WorkspaceIndexer(bridge, fileSource, indexConfig, progress, grammarDir, store),
111662
112085
  reader: store
111663
112086
  },
111664
112087
  log: (message, error) => {
@@ -111667,7 +112090,7 @@ function createIndexer(bridge, workspaceRoot, store, onStatus, onFileEvent, opti
111667
112090
  }
111668
112091
  })
111669
112092
  });
111670
- const safety = (0, import_client_core37.classifyWorkspaceRootForIndexing)(workspaceRoot);
112093
+ const safety = (0, import_client_core39.classifyWorkspaceRootForIndexing)(workspaceRoot);
111671
112094
  if (!safety.safe) {
111672
112095
  onStatus?.("orion.index.state", "idle");
111673
112096
  onStatus?.("orion.index.percent", 0);
@@ -111736,6 +112159,52 @@ function indexOnFileModified(indexer, data) {
111736
112159
  }
111737
112160
  }
111738
112161
 
112162
+ // src/services/fileMentionIndex.ts
112163
+ var MENTION_MENU_LIMIT = 12;
112164
+ function withDirectories(files) {
112165
+ const dirs = /* @__PURE__ */ new Set();
112166
+ for (const file of files) {
112167
+ for (let cut = file.indexOf("/"); cut >= 0; cut = file.indexOf("/", cut + 1)) {
112168
+ dirs.add(`${file.slice(0, cut)}/`);
112169
+ }
112170
+ }
112171
+ return [...dirs, ...files];
112172
+ }
112173
+ function depthOf(entry) {
112174
+ let depth = 0;
112175
+ for (let i2 = 0; i2 < entry.length - 1; i2++) {
112176
+ if (entry[i2] === "/") depth++;
112177
+ }
112178
+ return depth;
112179
+ }
112180
+ function basenameOf(entry) {
112181
+ const body2 = entry.endsWith("/") ? entry.slice(0, -1) : entry;
112182
+ return body2.slice(body2.lastIndexOf("/") + 1);
112183
+ }
112184
+ function scoreOf(entry, query) {
112185
+ if (query.length === 0) return 0;
112186
+ const lowerEntry = entry.toLowerCase();
112187
+ const base = basenameOf(lowerEntry);
112188
+ if (base.startsWith(query)) return 0;
112189
+ if (base.includes(query)) return 1;
112190
+ if (lowerEntry.includes(query)) return 2;
112191
+ return null;
112192
+ }
112193
+ function rankFileMentions(entries, query, limit = MENTION_MENU_LIMIT) {
112194
+ const needle = query.toLowerCase();
112195
+ const scored = [];
112196
+ for (const entry of entries) {
112197
+ if (entry.endsWith("/") && entry.toLowerCase() === needle) continue;
112198
+ const score = scoreOf(entry, needle);
112199
+ if (score === null) continue;
112200
+ scored.push({ entry, score, depth: depthOf(entry), dir: entry.endsWith("/") ? 0 : 1 });
112201
+ }
112202
+ scored.sort(
112203
+ (a, b2) => a.score - b2.score || a.depth - b2.depth || a.dir - b2.dir || a.entry.localeCompare(b2.entry)
112204
+ );
112205
+ return scored.slice(0, Math.max(0, limit)).map((s) => s.entry);
112206
+ }
112207
+
111739
112208
  // src/main.tsx
111740
112209
  import * as path12 from "path";
111741
112210
 
@@ -111760,8 +112229,8 @@ function shouldAutoApprove(fullyAutomatic, configAutoApprove) {
111760
112229
  }
111761
112230
 
111762
112231
  // src/headless/runHeadless.ts
111763
- var import_client_core38 = __toESM(require_dist(), 1);
111764
- var import_client_ui_core17 = __toESM(require_dist2(), 1);
112232
+ var import_client_core40 = __toESM(require_dist(), 1);
112233
+ var import_client_ui_core18 = __toESM(require_dist2(), 1);
111765
112234
  import * as os6 from "os";
111766
112235
  import { randomUUID } from "crypto";
111767
112236
  var HEADLESS_RESULT_PREFIX = "ORION_HEADLESS_RESULT ";
@@ -111805,7 +112274,7 @@ function extractFinalAssistantText(data) {
111805
112274
  }
111806
112275
  async function runGoalLoop(deps2) {
111807
112276
  let turns = 0;
111808
- const runner = new import_client_core38.GoalRunner({
112277
+ const runner = new import_client_core40.GoalRunner({
111809
112278
  // An explicit `--max-turns` overrides; without one this run takes the same default
111810
112279
  // ceiling every other host does. An unattended fleet is the LAST place that should be
111811
112280
  // the only caller running unbounded.
@@ -111823,7 +112292,7 @@ async function runHeadless(flags2) {
111823
112292
  const config = loadConfig();
111824
112293
  if (flags2.workspace) config.workspaceRoot = flags2.workspace;
111825
112294
  const secrets = createSecretStore();
111826
- const session = (0, import_client_core38.createAgentSession)(secrets, config);
112295
+ const session = (0, import_client_core40.createAgentSession)(secrets, config);
111827
112296
  const signedIn = await session.isSignedIn();
111828
112297
  if (!signedIn && !process.env.ORION_AUTH_TOKEN) {
111829
112298
  throw new Error(
@@ -111848,15 +112317,15 @@ async function runHeadless(flags2) {
111848
112317
  reasoning: flags2.reasoning ?? ""
111849
112318
  });
111850
112319
  const authToken = async () => await session.currentAccessToken() ?? process.env.ORION_AUTH_TOKEN ?? null;
111851
- const bridge = new import_client_core38.OrionBridge(
112320
+ const bridge = new import_client_core40.OrionBridge(
111852
112321
  () => config.apiUrl,
111853
112322
  authToken,
111854
- import_client_core38.nodeEmitterFactory,
112323
+ import_client_core40.nodeEmitterFactory,
111855
112324
  () => session.refresh().then(() => true, () => false)
111856
112325
  );
111857
- const brain = (0, import_client_core38.createHostBrain)({
112326
+ const brain = (0, import_client_core40.createHostBrain)({
111858
112327
  topology: config.brainTopology,
111859
- resolveBinary: () => (0, import_client_core38.resolveBrainBinary)({
112328
+ resolveBinary: () => (0, import_client_core40.resolveBrainBinary)({
111860
112329
  configPath: config.brainPath,
111861
112330
  env: process.env,
111862
112331
  bundledCandidates: bundledBrainCandidates()
@@ -111867,19 +112336,19 @@ async function runHeadless(flags2) {
111867
112336
  renewBearer: async () => await session.currentFreshAccessToken() ?? process.env.ORION_AUTH_TOKEN ?? null,
111868
112337
  log: (message, error) => console.error(`[orion-brain] ${message}${error ? `: ${String(error)}` : ""}`)
111869
112338
  });
111870
- const turnTransport = (0, import_client_core38.createTurnTransport)({
112339
+ const turnTransport = (0, import_client_core40.createTurnTransport)({
111871
112340
  mode: config.brain,
111872
112341
  bridge,
111873
- makeLocal: () => new import_client_core38.LocalBrainTransport({
112342
+ makeLocal: () => new import_client_core40.LocalBrainTransport({
111874
112343
  // Proactive freshness for the segment-holding bearer (the interactive TUI's twin).
111875
112344
  authToken: async () => await session.currentFreshAccessToken() ?? process.env.ORION_AUTH_TOKEN ?? null,
111876
112345
  gatewayUrl: () => config.apiUrl,
111877
112346
  connect: () => brain.connect()
111878
112347
  })
111879
112348
  });
111880
- const codebaseIndexFallback = new import_client_core38.WorkspaceIndexStore();
111881
- const ripgrep = new import_client_core38.NodeRipgrepLocator({
111882
- bundledCandidates: () => (0, import_client_core38.vscodeRipgrepCandidates)((specifier) => __require.resolve(specifier))
112349
+ const codebaseIndexFallback = new import_client_core40.WorkspaceIndexStore();
112350
+ const ripgrep = new import_client_core40.NodeRipgrepLocator({
112351
+ bundledCandidates: () => (0, import_client_core40.vscodeRipgrepCandidates)((specifier) => __require.resolve(specifier))
111883
112352
  });
111884
112353
  const indexer = createIndexer(bridge, config.workspaceRoot, codebaseIndexFallback, void 0, void 0, {
111885
112354
  rgPath: ripgrep.locate(),
@@ -111889,13 +112358,13 @@ async function runHeadless(flags2) {
111889
112358
  mode: "on-demand"
111890
112359
  });
111891
112360
  void indexer.start().catch(() => void 0);
111892
- const permissionStore = new import_client_core38.PermissionSettingsStore({ workspaceRoot: config.workspaceRoot });
112361
+ const permissionStore = new import_client_core40.PermissionSettingsStore({ workspaceRoot: config.workspaceRoot });
111893
112362
  await permissionStore.load();
111894
- const executor = new import_client_core38.ToolExecutor(
112363
+ const executor = new import_client_core40.ToolExecutor(
111895
112364
  () => config.workspaceRoot,
111896
112365
  () => appStore.getState().permissionMode,
111897
112366
  secrets,
111898
- new import_client_core38.NullLspProvider(),
112367
+ new import_client_core40.NullLspProvider(),
111899
112368
  ripgrep,
111900
112369
  nullFrameSinkFactory,
111901
112370
  fallbackBrowserConfig,
@@ -111918,7 +112387,7 @@ async function runHeadless(flags2) {
111918
112387
  workspaceRoot: config.workspaceRoot,
111919
112388
  homeDir: os6.homedir()
111920
112389
  });
111921
- const sandboxAvailable = (0, import_client_core38.probeSandboxAvailable)();
112390
+ const sandboxAvailable = (0, import_client_core40.probeSandboxAvailable)();
111922
112391
  await (0, import_client_core8.refreshEndpointRouting)(appStore.getState().provider, {
111923
112392
  workspaceRoot: config.workspaceRoot
111924
112393
  });
@@ -111944,7 +112413,7 @@ async function runHeadless(flags2) {
111944
112413
  };
111945
112414
  const sessionId = randomUUID();
111946
112415
  let messages = [];
111947
- const clientState = (0, import_client_ui_core17.emptyClientState)();
112416
+ const clientState = (0, import_client_ui_core18.emptyClientState)();
111948
112417
  const runTurn = async (prompt) => {
111949
112418
  const ac = new AbortController();
111950
112419
  const snapshot = [...messages];
@@ -111952,7 +112421,7 @@ async function runHeadless(flags2) {
111952
112421
  const onEvent = (ev) => {
111953
112422
  lastEvent = ev;
111954
112423
  };
111955
- const outcome = await (0, import_client_core38.driveTurn)(
112424
+ const outcome = await (0, import_client_core40.driveTurn)(
111956
112425
  turnTransport,
111957
112426
  {
111958
112427
  sessionId,
@@ -111962,7 +112431,7 @@ async function runHeadless(flags2) {
111962
112431
  routing: routing(),
111963
112432
  clientCapabilities: [],
111964
112433
  drainQueuedInput: () => [],
111965
- getOrionResources: () => (0, import_client_core38.buildOrionSnapshot)(config.workspaceRoot, void 0, sessionId),
112434
+ getOrionResources: () => (0, import_client_core40.buildOrionSnapshot)(config.workspaceRoot, void 0, sessionId),
111966
112435
  getFileHistoryManifest: () => executor.fileHistoryManifest(sessionId)
111967
112436
  },
111968
112437
  {
@@ -111994,8 +112463,8 @@ async function runHeadless(flags2) {
111994
112463
  }
111995
112464
 
111996
112465
  // src/services/feedbackGate.ts
111997
- var import_client_core39 = __toESM(require_dist(), 1);
111998
- var import_client_ui_core18 = __toESM(require_dist2(), 1);
112466
+ var import_client_core41 = __toESM(require_dist(), 1);
112467
+ var import_client_ui_core19 = __toESM(require_dist2(), 1);
111999
112468
  import { randomUUID as randomUUID2 } from "crypto";
112000
112469
  var TuiFeedbackGate = class {
112001
112470
  constructor(deps2) {
@@ -112015,13 +112484,13 @@ var TuiFeedbackGate = class {
112015
112484
  maybeOffer(sessionId, turnId) {
112016
112485
  const now2 = this.now();
112017
112486
  const config = this.deps.loadConfig();
112018
- let state = (0, import_client_ui_core18.feedbackStateFromScalars)(config, now2);
112487
+ let state = (0, import_client_ui_core19.feedbackStateFromScalars)(config, now2);
112019
112488
  if (config.feedbackFirstSeenAt <= 0 || config.feedbackSeed === 0) {
112020
- state = { ...state, seed: (0, import_client_ui_core18.mintFeedbackSeed)() };
112021
- this.safeSave((0, import_client_ui_core18.feedbackScalarsFromState)(state));
112489
+ state = { ...state, seed: (0, import_client_ui_core19.mintFeedbackSeed)() };
112490
+ this.safeSave((0, import_client_ui_core19.feedbackScalarsFromState)(state));
112022
112491
  }
112023
112492
  const pendings = this.deps.getPendings();
112024
- const offer = (0, import_client_ui_core18.shouldOfferFeedback)(state, {
112493
+ const offer = (0, import_client_ui_core19.shouldOfferFeedback)(state, {
112025
112494
  now: now2,
112026
112495
  completedTurnsThisSession: this.turnsBySession.get(sessionId) ?? 0,
112027
112496
  turnCompletedCleanly: true,
@@ -112032,8 +112501,8 @@ var TuiFeedbackGate = class {
112032
112501
  forced: this.deps.forced
112033
112502
  });
112034
112503
  if (!offer) return;
112035
- state = (0, import_client_ui_core18.applyFeedbackShown)(state, now2);
112036
- this.safeSave((0, import_client_ui_core18.feedbackScalarsFromState)(state));
112504
+ state = (0, import_client_ui_core19.applyFeedbackShown)(state, now2);
112505
+ this.safeSave((0, import_client_ui_core19.feedbackScalarsFromState)(state));
112037
112506
  const routing = this.deps.getRouting();
112038
112507
  const requestId = randomUUID2();
112039
112508
  this.pendingId = requestId;
@@ -112044,7 +112513,7 @@ var TuiFeedbackGate = class {
112044
112513
  model: routing.model,
112045
112514
  provider: routing.provider
112046
112515
  });
112047
- void (0, import_client_core39.sendFeedbackImpression)(this.deps.submit, "shown", "tui");
112516
+ void (0, import_client_core41.sendFeedbackImpression)(this.deps.submit, "shown", "tui");
112048
112517
  }
112049
112518
  /** The user rated. Snapshot the transcript SYNCHRONOUSLY (before any await), then
112050
112519
  * scrub + assemble + send off the interactive path. Idempotent per requestId. */
@@ -112055,10 +112524,10 @@ var TuiFeedbackGate = class {
112055
112524
  const snapshot = this.deps.getMessages().slice();
112056
112525
  const now2 = this.now();
112057
112526
  const config = this.deps.loadConfig();
112058
- const state = (0, import_client_ui_core18.applyFeedbackSubmitted)((0, import_client_ui_core18.feedbackStateFromScalars)(config, now2), now2);
112059
- this.safeSave((0, import_client_ui_core18.feedbackScalarsFromState)(state));
112060
- const card = (0, import_client_ui_core18.feedbackSetWhy)((0, import_client_ui_core18.feedbackSelectScore)((0, import_client_ui_core18.createFeedbackCard)(), score), why);
112061
- const body2 = (0, import_client_ui_core18.buildFeedbackSubmission)(card, {
112527
+ const state = (0, import_client_ui_core19.applyFeedbackSubmitted)((0, import_client_ui_core19.feedbackStateFromScalars)(config, now2), now2);
112528
+ this.safeSave((0, import_client_ui_core19.feedbackScalarsFromState)(state));
112529
+ const card = (0, import_client_ui_core19.feedbackSetWhy)((0, import_client_ui_core19.feedbackSelectScore)((0, import_client_ui_core19.createFeedbackCard)(), score), why);
112530
+ const body2 = (0, import_client_ui_core19.buildFeedbackSubmission)(card, {
112062
112531
  submissionId: randomUUID2(),
112063
112532
  sessionId: meta.sessionId,
112064
112533
  turnId: meta.turnId,
@@ -112067,13 +112536,13 @@ var TuiFeedbackGate = class {
112067
112536
  model: meta.model,
112068
112537
  provider: meta.provider
112069
112538
  });
112070
- const { conversation, truncated } = (0, import_client_core39.scrubFeedbackConversation)(snapshot);
112071
- void (0, import_client_core39.sendFeedbackSubmission)(this.deps.submit, {
112539
+ const { conversation, truncated } = (0, import_client_core41.scrubFeedbackConversation)(snapshot);
112540
+ void (0, import_client_core41.sendFeedbackSubmission)(this.deps.submit, {
112072
112541
  ...body2,
112073
112542
  conversation,
112074
112543
  conversation_truncated: truncated
112075
112544
  });
112076
- this.deps.appendNote(import_client_ui_core18.FEEDBACK_WORDING.transcriptNote);
112545
+ this.deps.appendNote(import_client_ui_core19.FEEDBACK_WORDING.transcriptNote);
112077
112546
  return true;
112078
112547
  }
112079
112548
  /** The session/transcript under a pending card is going away (new chat, resume) —
@@ -112092,12 +112561,12 @@ var TuiFeedbackGate = class {
112092
112561
  this.deps.setPendingFeedback(null);
112093
112562
  if (explicit) {
112094
112563
  const now2 = this.now();
112095
- const state = (0, import_client_ui_core18.applyFeedbackDismissed)(
112096
- (0, import_client_ui_core18.feedbackStateFromScalars)(this.deps.loadConfig(), now2),
112564
+ const state = (0, import_client_ui_core19.applyFeedbackDismissed)(
112565
+ (0, import_client_ui_core19.feedbackStateFromScalars)(this.deps.loadConfig(), now2),
112097
112566
  now2
112098
112567
  );
112099
- this.safeSave((0, import_client_ui_core18.feedbackScalarsFromState)(state));
112100
- void (0, import_client_core39.sendFeedbackImpression)(this.deps.submit, "dismissed", "tui");
112568
+ this.safeSave((0, import_client_ui_core19.feedbackScalarsFromState)(state));
112569
+ void (0, import_client_core41.sendFeedbackImpression)(this.deps.submit, "dismissed", "tui");
112101
112570
  }
112102
112571
  return true;
112103
112572
  }
@@ -112111,7 +112580,7 @@ var TuiFeedbackGate = class {
112111
112580
 
112112
112581
  // src/main.tsx
112113
112582
  var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
112114
- var SANDBOX_AVAILABLE = (0, import_client_core40.probeSandboxAvailable)();
112583
+ var SANDBOX_AVAILABLE = (0, import_client_core42.probeSandboxAvailable)();
112115
112584
  async function main() {
112116
112585
  let headlessFlags = null;
112117
112586
  try {
@@ -112163,8 +112632,8 @@ async function main() {
112163
112632
  }
112164
112633
  });
112165
112634
  void (0, import_client_core8.refreshEndpointRouting)(config.provider, { workspaceRoot: config.workspaceRoot });
112166
- void (0, import_client_core41.prewarmInterimModels)(config.workspaceRoot);
112167
- void (0, import_client_core41.prewarmRepoIdentity)(config.workspaceRoot);
112635
+ void (0, import_client_core43.prewarmInterimModels)(config.workspaceRoot);
112636
+ void (0, import_client_core43.prewarmRepoIdentity)(config.workspaceRoot);
112168
112637
  const setSessionTitle = (title) => {
112169
112638
  appStore.setState((s) => s.sessionTitle === title ? s : { ...s, sessionTitle: title });
112170
112639
  };
@@ -112188,8 +112657,8 @@ async function main() {
112188
112657
  }
112189
112658
  });
112190
112659
  const secrets = createSecretStore();
112191
- const session = (0, import_client_core41.createAgentSession)(secrets, config);
112192
- const outcomes = new import_client_core41.OutcomeReporter({
112660
+ const session = (0, import_client_core43.createAgentSession)(secrets, config);
112661
+ const outcomes = new import_client_core43.OutcomeReporter({
112193
112662
  apiBaseUrl: () => config.accountsApiUrl,
112194
112663
  accessToken: () => session.currentAccessToken()
112195
112664
  });
@@ -112241,10 +112710,10 @@ async function main() {
112241
112710
  }
112242
112711
  }
112243
112712
  const authToken = async () => await session.currentAccessToken() ?? process.env.ORION_AUTH_TOKEN ?? null;
112244
- const bridge = new import_client_core40.OrionBridge(
112713
+ const bridge = new import_client_core42.OrionBridge(
112245
112714
  () => config.apiUrl,
112246
112715
  authToken,
112247
- import_client_core41.nodeEmitterFactory,
112716
+ import_client_core43.nodeEmitterFactory,
112248
112717
  // Seamless refresh: a 401 coalesces ONE refresh through the AgentSession (single-flight), so a
112249
112718
  // token cycling mid-chat never logs the user out. `refreshAndSyncGate` also re-syncs the cached
112250
112719
  // gate flag so a definitively-revoked session re-gates the chat cleanly (no stale "signed in").
@@ -112252,9 +112721,9 @@ async function main() {
112252
112721
  );
112253
112722
  let brainInstance;
112254
112723
  const brain = () => {
112255
- brainInstance ??= (0, import_client_core41.createHostBrain)({
112724
+ brainInstance ??= (0, import_client_core43.createHostBrain)({
112256
112725
  topology: config.brainTopology,
112257
- resolveBinary: () => (0, import_client_core41.resolveBrainBinary)({
112726
+ resolveBinary: () => (0, import_client_core43.resolveBrainBinary)({
112258
112727
  configPath: config.brainPath,
112259
112728
  env: process.env,
112260
112729
  bundledCandidates: bundledBrainCandidates()
@@ -112269,10 +112738,10 @@ async function main() {
112269
112738
  });
112270
112739
  return brainInstance;
112271
112740
  };
112272
- const turnTransport = (0, import_client_core41.createTurnTransport)({
112741
+ const turnTransport = (0, import_client_core43.createTurnTransport)({
112273
112742
  mode: config.brain,
112274
112743
  bridge,
112275
- makeLocal: () => new import_client_core41.LocalBrainTransport({
112744
+ makeLocal: () => new import_client_core43.LocalBrainTransport({
112276
112745
  // Proactive freshness: the brain holds this bearer for a whole segment and cannot
112277
112746
  // ride the bridge's reactive 401-refresh — so validate-or-refresh before hand-off.
112278
112747
  authToken: async () => await session.currentFreshAccessToken() ?? process.env.ORION_AUTH_TOKEN ?? null,
@@ -112280,14 +112749,14 @@ async function main() {
112280
112749
  connect: () => brain().connect()
112281
112750
  })
112282
112751
  });
112283
- const codebaseIndexFallback = new import_client_core40.WorkspaceIndexStore();
112284
- const ripgrep = new import_client_core41.NodeRipgrepLocator({
112752
+ const codebaseIndexFallback = new import_client_core42.WorkspaceIndexStore();
112753
+ const ripgrep = new import_client_core43.NodeRipgrepLocator({
112285
112754
  // Bundled-first rg: ships as an optionalDependency of this package, so an
112286
112755
  // `npm i -g` user gets fast search with nothing else installed. Resolved
112287
112756
  // from THIS package's node_modules via require.resolve (nested and hoisted
112288
112757
  // layouts both work); absent (install offline / postinstall failed) → the
112289
112758
  // locator falls through to PATH + well-known paths exactly as before.
112290
- bundledCandidates: () => (0, import_client_core41.vscodeRipgrepCandidates)((specifier) => __require.resolve(specifier))
112759
+ bundledCandidates: () => (0, import_client_core43.vscodeRipgrepCandidates)((specifier) => __require.resolve(specifier))
112291
112760
  });
112292
112761
  const indexer = createIndexer(
112293
112762
  bridge,
@@ -112312,28 +112781,28 @@ async function main() {
112312
112781
  // the store's referential stability: unchanged state returns the same object.
112313
112782
  (relPath) => transcriptStore.setState((s) => {
112314
112783
  const clientState = { ...s.clientState };
112315
- if (!(0, import_client_ui_core19.dropSeenPath)(clientState, relPath)) return s;
112784
+ if (!(0, import_client_ui_core20.dropSeenPath)(clientState, relPath)) return s;
112316
112785
  return { ...s, clientState };
112317
112786
  }),
112318
112787
  { rgPath: ripgrep.locate(), mode: config.indexMode }
112319
112788
  );
112320
112789
  void indexer.start().catch(() => void 0);
112321
112790
  initIndexModeService({ appStore, setMode: (m2) => indexer.setMode(m2) });
112322
- const permissionStore = new import_client_core41.PermissionSettingsStore({ workspaceRoot: config.workspaceRoot });
112791
+ const permissionStore = new import_client_core43.PermissionSettingsStore({ workspaceRoot: config.workspaceRoot });
112323
112792
  await permissionStore.load();
112324
- const executor = new import_client_core40.ToolExecutor(
112793
+ const executor = new import_client_core42.ToolExecutor(
112325
112794
  () => config.workspaceRoot,
112326
112795
  // The session's EFFECTIVE mode — the same turbo⇒full_access law the wire rides
112327
112796
  // (`currentRouting`), never the bare store mode: the executor's membership
112328
112797
  // backstop must agree with the gate that already ruled on each call. Loop-run
112329
112798
  // sessions never enable turbo on the bridge, so they keep the configured mode
112330
112799
  // their own wire rides.
112331
- (sessionId2) => (0, import_client_core41.effectiveWirePermissionMode)(
112800
+ (sessionId2) => (0, import_client_core43.effectiveWirePermissionMode)(
112332
112801
  sessionId2 !== void 0 && bridge.isTurboModeEnabledForSession(sessionId2),
112333
112802
  appStore.getState().permissionMode
112334
112803
  ),
112335
112804
  secrets,
112336
- new import_client_core41.NullLspProvider(),
112805
+ new import_client_core43.NullLspProvider(),
112337
112806
  ripgrep,
112338
112807
  nullFrameSinkFactory,
112339
112808
  fallbackBrowserConfig,
@@ -112456,11 +112925,11 @@ async function main() {
112456
112925
  }
112457
112926
  renderLane(transcriptStore, appStore, ev);
112458
112927
  if (ev.event === "usage_recorded") {
112459
- (0, import_client_core40.recordTurnMetrics)({
112928
+ (0, import_client_core42.recordTurnMetrics)({
112460
112929
  app: "tui",
112461
112930
  sessionId,
112462
112931
  workspaceRoot: currentRouting().workspaceRoot,
112463
- turn: (0, import_client_core40.turnMetricsFromUsageRecorded)(ev.data ?? {})
112932
+ turn: (0, import_client_core42.turnMetricsFromUsageRecorded)(ev.data ?? {})
112464
112933
  });
112465
112934
  }
112466
112935
  if (ev.event === "file_modified") {
@@ -112484,7 +112953,7 @@ async function main() {
112484
112953
  sessionSub = bridge.onSessionEvent(sid, onSessionStreamEvent);
112485
112954
  };
112486
112955
  let goalRunner = null;
112487
- const cronController = new import_client_core41.CronController({
112956
+ const cronController = new import_client_core43.CronController({
112488
112957
  submitTurn: (prompt) => sendTurn(prompt, "\u27F3 scheduled", void 0, "system"),
112489
112958
  isBusy: () => appStore.getState().status === "streaming",
112490
112959
  persistence: fileCronPersistence(config.workspaceRoot)
@@ -112492,6 +112961,15 @@ async function main() {
112492
112961
  const resetTransient = () => {
112493
112962
  goalRunner?.stop();
112494
112963
  goalRunner = null;
112964
+ const dropped = appStore.getState().queuedMessages.length;
112965
+ if (dropped > 0) {
112966
+ transcriptStore.setState(
112967
+ (s) => appendNote(
112968
+ s,
112969
+ `${dropped} pending ${dropped === 1 ? "message was" : "messages were"} not carried into this chat.`
112970
+ )
112971
+ );
112972
+ }
112495
112973
  appStore.setState((s) => ({
112496
112974
  ...s,
112497
112975
  contextTokens: 0,
@@ -112507,8 +112985,11 @@ async function main() {
112507
112985
  pendingPermissions: [],
112508
112986
  pendingPlanApproval: null,
112509
112987
  pendingAttachments: [],
112988
+ // The ONE place queued input is discarded rather than delivered: a new
112989
+ // chat is a different conversation, so the old one's pending text cannot
112990
+ // ride into it. The note above says so — a silent drop is what every other
112991
+ // path here was rewritten to stop doing.
112510
112992
  queuedMessages: [],
112511
- // the old chat's pending input must never ride into the new one
112512
112993
  scrollBack: 0
112513
112994
  // snap to bottom on session swap
112514
112995
  }));
@@ -112658,15 +113139,18 @@ async function main() {
112658
113139
  return registry.complete(input).map((c3) => ({
112659
113140
  name: c3.name,
112660
113141
  argumentHint: c3.argumentHint,
112661
- description: c3.description
113142
+ description: c3.description,
113143
+ // Carried so the menu can tag a contributed command with the catalog it
113144
+ // came from; builtins render untagged.
113145
+ source: c3.source
112662
113146
  }));
112663
113147
  };
112664
113148
  const slashTokenRanges = (v2) => {
112665
113149
  const anywhere = new Set(
112666
113150
  registry.all().filter((c3) => c3.source === "skill").map((c3) => c3.name)
112667
113151
  );
112668
- const ranges = (0, import_client_core41.scanSlashTokenRanges)(v2, anywhere);
112669
- const lead = (0, import_client_core41.matchSlashToken)(v2);
113152
+ const ranges = (0, import_client_core43.scanSlashTokenRanges)(v2, anywhere);
113153
+ const lead = (0, import_client_core43.matchSlashToken)(v2);
112670
113154
  if (lead && !anywhere.has(lead.name) && registry.get(lead.name)) {
112671
113155
  const start2 = v2.indexOf("/");
112672
113156
  ranges.unshift({ start: start2, end: start2 + lead.name.length + 1 });
@@ -112674,18 +113158,13 @@ async function main() {
112674
113158
  }
112675
113159
  return ranges;
112676
113160
  };
112677
- let fileCache = [];
112678
- let fileCacheBuilt = false;
112679
- const getFileSuggestions = (prefix) => {
112680
- if (!fileCacheBuilt) {
112681
- fileCacheBuilt = true;
112682
- void new import_client_core36.NodeFileSource(config.workspaceRoot).findFiles("**/*", "{**/node_modules/**,**/.git/**,**/dist/**,**/build/**}", 5e3).then((abs) => {
112683
- fileCache = abs.map((p2) => path12.relative(config.workspaceRoot, p2).split(path12.sep).join("/"));
112684
- }).catch(() => void 0);
112685
- }
112686
- const p = prefix.toLowerCase();
112687
- return (p ? fileCache.filter((f) => f.toLowerCase().includes(p)) : fileCache).slice(0, 8);
112688
- };
113161
+ let fileEntries = [];
113162
+ void new import_client_core38.NodeFileSource(config.workspaceRoot).findFiles("**/*", "{**/node_modules/**,**/.git/**,**/dist/**,**/build/**}", 5e3).then((abs) => {
113163
+ fileEntries = withDirectories(
113164
+ abs.map((p) => path12.relative(config.workspaceRoot, p).split(path12.sep).join("/"))
113165
+ );
113166
+ }).catch(() => void 0);
113167
+ const getFileSuggestions = (prefix) => rankFileMentions(fileEntries, prefix);
112689
113168
  let app = null;
112690
113169
  const exit = () => {
112691
113170
  presence.dispose();
@@ -112707,23 +113186,11 @@ async function main() {
112707
113186
  if (turn && streaming && !turn.cancelRequested && turn.phase === "stream") {
112708
113187
  turn.cancelRequested = true;
112709
113188
  outcomes.report({ kind: "cancel_context", kept_edits: turn.hadEdits });
112710
- turn.disposeFallback = (0, import_client_core41.armGracefulCancel)({
113189
+ turn.disposeFallback = (0, import_client_core43.armGracefulCancel)({
112711
113190
  controller: turn.abort,
112712
113191
  sendCancel: () => turnTransport.cancelTurn(turn.sessionId)
112713
113192
  });
112714
- appStore.setState((s) => ({
112715
- ...s,
112716
- statusText: "stopping\u2026",
112717
- // Parked MAIN-turn prompts are moot the moment the user stops the turn;
112718
- // queued steering must not leak into a later turn via drainQueuedInput.
112719
- // A SUB-AGENT's prompt (agentLabel) survives — stopping the turn spares
112720
- // running children, so their questions still need an answer.
112721
- pendingPermissions: s.pendingPermissions.filter((p) => p.agentLabel),
112722
- pendingPlanApproval: null,
112723
- pendingAskUser: null,
112724
- pendingWorkPlan: null,
112725
- queuedMessages: []
112726
- }));
113193
+ appStore.setState((s) => ({ ...s, statusText: "stopping\u2026", ...clearParkedForStop(s) }));
112727
113194
  rejectPendingWorkPlan();
112728
113195
  return;
112729
113196
  }
@@ -112732,16 +113199,12 @@ async function main() {
112732
113199
  rejectPendingWorkPlan();
112733
113200
  appStore.setState((s) => ({
112734
113201
  ...s,
112735
- // Keep sub-agent prompts (agentLabel) — children outlive the turn.
112736
- pendingPermissions: s.pendingPermissions.filter((p) => p.agentLabel),
112737
- pendingPlanApproval: null,
112738
- pendingAskUser: null,
112739
- pendingWorkPlan: null,
113202
+ ...clearParkedForStop(s),
113203
+ // same one definition as the graceful branch
112740
113204
  status: "idle",
112741
113205
  statusText: "",
112742
- turnStartedAt: 0,
113206
+ turnStartedAt: 0
112743
113207
  // an interrupted turn stamps no Orbited line
112744
- queuedMessages: []
112745
113208
  }));
112746
113209
  };
112747
113210
  const onScroll = (delta) => {
@@ -112779,7 +113242,7 @@ async function main() {
112779
113242
  };
112780
113243
  const heldAgentReports = [];
112781
113244
  let inboundPeerHop = null;
112782
- const agentManager = new import_client_core41.AgentManager((0, import_client_core41.brainAwareAgentTransport)(bridge, turnTransport), executor, async () => {
113245
+ const agentManager = new import_client_core43.AgentManager((0, import_client_core43.brainAwareAgentTransport)(bridge, turnTransport), executor, async () => {
112783
113246
  const result = await bridge.rpc("list_personas", {});
112784
113247
  return result.personas ?? [];
112785
113248
  });
@@ -112789,8 +113252,8 @@ async function main() {
112789
113252
  agentManager.attachOutcomeSink((outcome) => {
112790
113253
  oVaultSessions.for(outcome.parentSessionId, currentRouting().workspaceRoot)?.recordSiblingOutcome(outcome);
112791
113254
  });
112792
- void (0, import_client_core41.loadAgentDefs)(config.workspaceRoot).then((defs) => agentManager.prime(defs));
112793
- const workGraphManager = new import_client_core41.WorkGraphManager({ agents: agentManager, tools: executor });
113255
+ void (0, import_client_core43.loadAgentDefs)(config.workspaceRoot).then((defs) => agentManager.prime(defs));
113256
+ const workGraphManager = new import_client_core43.WorkGraphManager({ agents: agentManager, tools: executor });
112794
113257
  workGraphManager.registerTools(executor);
112795
113258
  const workPlanApproval = new WorkPlanApprovalBridge();
112796
113259
  function rejectPendingWorkPlan() {
@@ -112813,7 +113276,7 @@ async function main() {
112813
113276
  workRunTicker = setInterval(() => {
112814
113277
  const record = liveRunRecord;
112815
113278
  if (!record) return stopWorkRunTicker();
112816
- const view = (0, import_client_core41.buildRunGraphView)(record, agentManager.agentsFor(sessionId), Date.now(), tuiFlowBudget());
113279
+ const view = (0, import_client_core43.buildRunGraphView)(record, agentManager.agentsFor(sessionId), Date.now(), tuiFlowBudget());
112817
113280
  appStore.setState(
112818
113281
  (s) => s.workRun ? { ...s, workRun: { ...s.workRun, view } } : s
112819
113282
  );
@@ -112837,11 +113300,11 @@ async function main() {
112837
113300
  const status = appStore.getState().status;
112838
113301
  if (status !== "idle" && status !== "error") return;
112839
113302
  if (heldAgentReports.length === 0) return;
112840
- sendTurn(import_client_core41.SUBAGENT_WAKE_PROMPT, void 0, void 0, "system");
113303
+ sendTurn(import_client_core43.SUBAGENT_WAKE_PROMPT, void 0, void 0, "system");
112841
113304
  },
112842
113305
  onRunUpdate: (record) => {
112843
113306
  liveRunRecord = record;
112844
- const view = (0, import_client_core41.buildRunGraphView)(record, agentManager.agentsFor(sessionId), Date.now(), tuiFlowBudget());
113307
+ const view = (0, import_client_core43.buildRunGraphView)(record, agentManager.agentsFor(sessionId), Date.now(), tuiFlowBudget());
112845
113308
  if (view.live) {
112846
113309
  startWorkRunTicker();
112847
113310
  appStore.setState((s) => ({
@@ -112882,7 +113345,7 @@ async function main() {
112882
113345
  agentManager.attachParent(sid, {
112883
113346
  routing: () => currentRouting(),
112884
113347
  clientCapabilities: () => [
112885
- ...(0, import_client_core40.platformCapabilities)(),
113348
+ ...(0, import_client_core42.platformCapabilities)(),
112886
113349
  ...appStore.getState().subagentsEnabled ? ["subagents"] : []
112887
113350
  ],
112888
113351
  transcript: () => transcriptStore.getState().messages,
@@ -112891,7 +113354,7 @@ async function main() {
112891
113354
  const status = appStore.getState().status;
112892
113355
  if (status !== "idle" && status !== "error") return;
112893
113356
  if (heldAgentReports.length === 0) return;
112894
- sendTurn(import_client_core41.SUBAGENT_WAKE_PROMPT, void 0, void 0, "system");
113357
+ sendTurn(import_client_core43.SUBAGENT_WAKE_PROMPT, void 0, void 0, "system");
112895
113358
  },
112896
113359
  onLifecycle: (ev) => onRenderEvent({
112897
113360
  event: "agent_lifecycle",
@@ -112927,7 +113390,7 @@ async function main() {
112927
113390
  timestamp: Date.now(),
112928
113391
  data
112929
113392
  }),
112930
- getOrionResources: () => (0, import_client_core40.buildOrionSnapshot)(config.workspaceRoot, void 0, sid),
113393
+ getOrionResources: () => (0, import_client_core42.buildOrionSnapshot)(config.workspaceRoot, void 0, sid),
112931
113394
  // Full-dose source for review-persona children (lesson dosing) — the same
112932
113395
  // attention payload the parent turn itself ships.
112933
113396
  oVaultAttention: () => {
@@ -112967,7 +113430,7 @@ async function main() {
112967
113430
  // the /turbo-toggle vs --fully-automatic gap: the flag already overrides the
112968
113431
  // store mode at launch (launchPermissionMode); the toggle now buys the same
112969
113432
  // backend posture, so no ask is ever born and batch-mates stop deferring.
112970
- permissionMode: (0, import_client_core41.effectiveWirePermissionMode)(
113433
+ permissionMode: (0, import_client_core43.effectiveWirePermissionMode)(
112971
113434
  bridge.isTurboModeEnabledForSession(sessionId),
112972
113435
  a.permissionMode
112973
113436
  ),
@@ -112987,8 +113450,8 @@ async function main() {
112987
113450
  sandboxAvailable: SANDBOX_AVAILABLE
112988
113451
  };
112989
113452
  };
112990
- const oVaultSessions = new import_client_core40.OVaultSessions(() => process.env.ORION_OVAULT_CAPTURE !== "0");
112991
- oVaultSessions.syncRunner = new import_client_core40.OVaultSyncRunner({
113453
+ const oVaultSessions = new import_client_core42.OVaultSessions(() => process.env.ORION_OVAULT_CAPTURE !== "0");
113454
+ oVaultSessions.syncRunner = new import_client_core42.OVaultSyncRunner({
112992
113455
  auth: {
112993
113456
  apiBaseUrl: () => config.accountsApiUrl,
112994
113457
  accessToken: () => session.currentAccessToken(),
@@ -113046,7 +113509,7 @@ async function main() {
113046
113509
  return;
113047
113510
  }
113048
113511
  }
113049
- if (lastTurnComplete?.sessionId === sid && Date.now() - lastTurnComplete.at < import_client_core41.REPHRASE_WINDOW_MS) {
113512
+ if (lastTurnComplete?.sessionId === sid && Date.now() - lastTurnComplete.at < import_client_core43.REPHRASE_WINDOW_MS) {
113050
113513
  outcomes.report({ kind: "rephrase" });
113051
113514
  }
113052
113515
  triggerSecurityCapabilitiesRefresh(bridge, appStore);
@@ -113064,7 +113527,7 @@ async function main() {
113064
113527
  };
113065
113528
  try {
113066
113529
  const peerAgents = await presence.registry.peersForWire(sid).catch(() => []);
113067
- const outcome = await (0, import_client_core40.driveTurn)(
113530
+ const outcome = await (0, import_client_core42.driveTurn)(
113068
113531
  turnTransport,
113069
113532
  {
113070
113533
  sessionId: sid,
@@ -113085,7 +113548,7 @@ async function main() {
113085
113548
  // `workgraph` rides the same switch as the fan-out family: a work graph IS a
113086
113549
  // fan-out (its phases are sub-agents), so turning sub-agents off must hide both.
113087
113550
  clientCapabilities: [
113088
- ...(0, import_client_core40.platformCapabilities)(),
113551
+ ...(0, import_client_core42.platformCapabilities)(),
113089
113552
  ...appStore.getState().subagentsEnabled ? ["scheduling", "subagents", "workgraph"] : ["scheduling"],
113090
113553
  // This terminal can RECEIVE a peer message, so it may also address them.
113091
113554
  "agent_messaging"
@@ -113105,7 +113568,7 @@ async function main() {
113105
113568
  // Ship the `.orion` snapshot so the backend's begin-turn loaders read
113106
113569
  // config / sub-agent defs / skills / hooks / memory / plugins from the
113107
113570
  // body — no live client-read channel in the stateless segment model.
113108
- getOrionResources: () => (0, import_client_core40.buildOrionSnapshot)(currentRouting().workspaceRoot, void 0, sid),
113571
+ getOrionResources: () => (0, import_client_core42.buildOrionSnapshot)(currentRouting().workspaceRoot, void 0, sid),
113109
113572
  getFileHistoryManifest: () => executor.fileHistoryManifest(sid),
113110
113573
  // Lesson-recall anchors: the TUI has no editor attention, so recently-touched
113111
113574
  // paths from the capture observer are the attention set.
@@ -113115,7 +113578,7 @@ async function main() {
113115
113578
  return { active: null, open: [], touched, related: executor.oVaultRelatedPaths?.(touched) ?? [] };
113116
113579
  }
113117
113580
  },
113118
- (0, import_client_core40.withOVault)(
113581
+ (0, import_client_core42.withOVault)(
113119
113582
  {
113120
113583
  ...boundary.makeHandlers(sid, ac.signal, onEvent),
113121
113584
  // Stops the driver from POSTING the next segment when the user cancelled at a
@@ -113127,7 +113590,7 @@ async function main() {
113127
113590
  onToolResult: (payload) => {
113128
113591
  if (payload.terminal_savings) {
113129
113592
  terminalSavings.push(payload.terminal_savings);
113130
- (0, import_client_core40.recordTurnMetrics)({
113593
+ (0, import_client_core42.recordTurnMetrics)({
113131
113594
  app: "tui",
113132
113595
  sessionId: sid,
113133
113596
  workspaceRoot: currentRouting().workspaceRoot,
@@ -113161,12 +113624,12 @@ async function main() {
113161
113624
  settleOutcome = "completed";
113162
113625
  lastTurnComplete = { sessionId: sid, at: Date.now() };
113163
113626
  const data = outcome.event.data ?? {};
113164
- endSettle = { kind: "complete", finalText: (0, import_client_core41.finalAssistantTextFromWire)(data.messages) };
113165
- (0, import_client_core40.recordTurnMetrics)({
113627
+ endSettle = { kind: "complete", finalText: (0, import_client_core43.finalAssistantTextFromWire)(data.messages) };
113628
+ (0, import_client_core42.recordTurnMetrics)({
113166
113629
  app: "tui",
113167
113630
  sessionId: sid,
113168
113631
  workspaceRoot: currentRouting().workspaceRoot,
113169
- turn: (0, import_client_core40.turnMetricsFromComplete)(data),
113632
+ turn: (0, import_client_core42.turnMetricsFromComplete)(data),
113170
113633
  terminalSavings
113171
113634
  });
113172
113635
  void oVaultSessions.reflectorFor(sid, currentRouting().workspaceRoot, bridge)?.run("turn_complete").finally(
@@ -113210,7 +113673,7 @@ async function main() {
113210
113673
  } finally {
113211
113674
  turn.disposeFallback?.();
113212
113675
  if (currentTurn === turn) {
113213
- settleSteerQueue(settleOutcome, {
113676
+ settleSteerQueue({
113214
113677
  app: appStore,
113215
113678
  isBusy: () => currentTurn !== null || goalRunner !== null,
113216
113679
  send: sendTurn,
@@ -113232,7 +113695,13 @@ async function main() {
113232
113695
  if (remoteAttachments !== void 0 && remoteAttachments.length > 0) return "declined";
113233
113696
  appStore.setState((s) => ({
113234
113697
  ...s,
113235
- queuedMessages: [...s.queuedMessages, queuedSteer(text, display)]
113698
+ queuedMessages: [
113699
+ ...s.queuedMessages,
113700
+ // `origin` is the caller's own: a keyboard send that lost the race to
113701
+ // a starting turn stays the reader's to pull back, while a phone or
113702
+ // cron send is machine-owned and stays put.
113703
+ origin === "user" ? queuedSteer(text, display) : machineSteer(text, display)
113704
+ ]
113236
113705
  }));
113237
113706
  return "queued";
113238
113707
  }
@@ -113271,7 +113740,7 @@ async function main() {
113271
113740
  ...s,
113272
113741
  queuedMessages: [
113273
113742
  ...s.queuedMessages,
113274
- queuedCommand(`/skills ${name2}${args2 ? ` ${args2}` : ""}`)
113743
+ machineCommand(`/skills ${name2}${args2 ? ` ${args2}` : ""}`)
113275
113744
  ]
113276
113745
  }));
113277
113746
  return;
@@ -113297,8 +113766,8 @@ async function main() {
113297
113766
  executor.registerHostTool("schedule_task", makeScheduleTaskHandler(cronController));
113298
113767
  const loopService = new LoopService({
113299
113768
  workspaceRoot: config.workspaceRoot,
113300
- schedulePath: loopSchedulePathFor((0, import_client_core41.runsRootFor)("loops", config.workspaceRoot)),
113301
- transport: (0, import_client_core41.brainAwareAgentTransport)(bridge, turnTransport),
113769
+ schedulePath: loopSchedulePathFor((0, import_client_core43.runsRootFor)("loops", config.workspaceRoot)),
113770
+ transport: (0, import_client_core43.brainAwareAgentTransport)(bridge, turnTransport),
113302
113771
  tools: executor,
113303
113772
  // The CONFIGURED mode rides here deliberately, not the turbo-effective one
113304
113773
  // (currentRouting applies the turbo→full_access law): a loop is standing
@@ -113341,17 +113810,17 @@ async function main() {
113341
113810
  if (sessionBusy()) {
113342
113811
  appStore.setState((s) => ({
113343
113812
  ...s,
113344
- queuedMessages: [...s.queuedMessages, queuedCommand(`/goal ${goal}`)]
113813
+ queuedMessages: [...s.queuedMessages, machineCommand(`/goal ${goal}`)]
113345
113814
  }));
113346
113815
  return;
113347
113816
  }
113348
- const runner = new import_client_core41.GoalRunner({ runTurn: runGoalTurn });
113817
+ const runner = new import_client_core43.GoalRunner({ runTurn: runGoalTurn });
113349
113818
  goalRunner = runner;
113350
113819
  transcriptStore.setState((s) => appendNote(s, `Goal started \u2014 working until complete: ${goal}`));
113351
113820
  void runner.run(goal).then((reason) => {
113352
113821
  if (goalRunner === runner) goalRunner = null;
113353
- transcriptStore.setState((s) => appendNote(s, (0, import_client_core41.describeGoalEnd)(reason)));
113354
- settleSteerQueue("completed", {
113822
+ transcriptStore.setState((s) => appendNote(s, (0, import_client_core43.describeGoalEnd)(reason)));
113823
+ settleSteerQueue({
113355
113824
  app: appStore,
113356
113825
  isBusy: () => currentTurn !== null || goalRunner !== null,
113357
113826
  send: sendTurn,
@@ -113368,6 +113837,9 @@ async function main() {
113368
113837
  queuedMessages: [...s.queuedMessages, queuedCommand(text)]
113369
113838
  }));
113370
113839
  };
113840
+ const enqueueMachineSteer = (text) => {
113841
+ appStore.setState((s) => ({ ...s, queuedMessages: [...s.queuedMessages, machineSteer(text)] }));
113842
+ };
113371
113843
  const drainQueuedInput = () => drainSteersForSegment(appStore, transcriptStore);
113372
113844
  rc = startTuiRemoteControl({
113373
113845
  bridge,
@@ -113384,13 +113856,13 @@ async function main() {
113384
113856
  const outcome = sendTurn(text, void 0, attachments, "system");
113385
113857
  return outcome === "started" || outcome === "queued";
113386
113858
  },
113387
- steer: (text) => enqueueSteer(text),
113859
+ steer: (text) => enqueueMachineSteer(text),
113388
113860
  deliverAgentMessage: (message) => {
113389
113861
  inboundPeerHop = Math.max(inboundPeerHop ?? 0, message.hop);
113390
- heldAgentReports.push((0, import_client_core41.formatAgentMessage)(message));
113862
+ heldAgentReports.push((0, import_client_core43.formatAgentMessage)(message));
113391
113863
  const status = appStore.getState().status;
113392
113864
  if (status !== "idle" && status !== "error") return;
113393
- sendTurn((0, import_client_core41.peerMessageWakePrompt)(message), void 0, void 0, "system");
113865
+ sendTurn((0, import_client_core43.peerMessageWakePrompt)(message), void 0, void 0, "system");
113394
113866
  },
113395
113867
  resolvePermission: (requestId, decision, sid) => {
113396
113868
  const pending = appStore.getState().pendingPermissions.some((p) => p.data.request_id === requestId);
@@ -113553,25 +114025,25 @@ async function main() {
113553
114025
  defaultApiUrl: config.apiUrl,
113554
114026
  entries,
113555
114027
  add: async (entry) => {
113556
- await (0, import_client_core41.saveCustomProvider)(entry, "user", opts);
113557
- (0, import_client_core41.clearEndpointCatalog)(entry.baseUrl);
113558
- panel(await (0, import_client_core41.loadCustomProviders)(opts));
114028
+ await (0, import_client_core43.saveCustomProvider)(entry, "user", opts);
114029
+ (0, import_client_core43.clearEndpointCatalog)(entry.baseUrl);
114030
+ panel(await (0, import_client_core43.loadCustomProviders)(opts));
113559
114031
  },
113560
114032
  remove: async (name2) => {
113561
114033
  for (const tier of ["user", "project", "local"]) {
113562
- if (await (0, import_client_core41.removeCustomProvider)(name2, tier, opts)) break;
114034
+ if (await (0, import_client_core43.removeCustomProvider)(name2, tier, opts)) break;
113563
114035
  }
113564
114036
  (0, import_client_core8.clearEndpointRouting)();
113565
- (0, import_client_core41.clearEndpointCatalog)();
113566
- panel(await (0, import_client_core41.loadCustomProviders)(opts));
114037
+ (0, import_client_core43.clearEndpointCatalog)();
114038
+ panel(await (0, import_client_core43.loadCustomProviders)(opts));
113567
114039
  },
113568
- probe: (baseUrl, apiKey) => (0, import_client_core41.probeModels)(baseUrl, apiKey),
114040
+ probe: (baseUrl, apiKey) => (0, import_client_core43.probeModels)(baseUrl, apiKey),
113569
114041
  // A saved endpoint's models come from the CACHED catalog — opening one costs no
113570
114042
  // network, so limits stay editable long after the endpoint was added.
113571
114043
  modelsOf: (entry) => (0, import_client_core8.endpointModelViews)(entry),
113572
114044
  updateModels: async (name2, update) => {
113573
114045
  await (0, import_client_core8.updateCustomProviderModels)(name2, update, "user", opts);
113574
- panel(await (0, import_client_core41.loadCustomProviders)(opts));
114046
+ panel(await (0, import_client_core43.loadCustomProviders)(opts));
113575
114047
  },
113576
114048
  use: async (name2, model) => {
113577
114049
  const provider = `custom:${name2}`;
@@ -113589,7 +114061,7 @@ async function main() {
113589
114061
  }
113590
114062
  }
113591
114063
  }));
113592
- void (0, import_client_core41.loadCustomProviders)(opts).then(panel);
114064
+ void (0, import_client_core43.loadCustomProviders)(opts).then(panel);
113593
114065
  }
113594
114066
  };
113595
114067
  const routeInput = (text) => routeChatInput(text, {
@@ -113598,7 +114070,7 @@ async function main() {
113598
114070
  addMemory: (note) => void addMemoryLine(note),
113599
114071
  resolveCommand: async (line) => {
113600
114072
  let parsed = registry.parse(line);
113601
- if (!parsed && (0, import_client_core41.matchSlashToken)(line)) {
114073
+ if (!parsed && (0, import_client_core43.matchSlashToken)(line)) {
113602
114074
  await skillSlash.refresh().catch(() => void 0);
113603
114075
  parsed = registry.parse(line);
113604
114076
  }