@volter-ai-dev/supercode-ui 0.1.54 → 0.1.55

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/messenger.mjs CHANGED
@@ -65,6 +65,7 @@ var EMPTY_UI_STATE = Object.freeze({
65
65
  savedDraft: "",
66
66
  attention: Object.freeze([]),
67
67
  sessions: Object.freeze([]),
68
+ subagentInspector: null,
68
69
  attached: null,
69
70
  owned: null,
70
71
  attachError: null
@@ -571,10 +572,25 @@ function readSessions(value) {
571
572
  active: row.active === true,
572
573
  writable: row.writable === true,
573
574
  live: row.live === true,
574
- runtimeStatus: row.runtimeStatus === "running" || row.runtimeStatus === "busy" || row.runtimeStatus === "idle" ? row.runtimeStatus : null
575
+ runtimeStatus: row.runtimeStatus === "running" || row.runtimeStatus === "busy" || row.runtimeStatus === "idle" ? row.runtimeStatus : null,
576
+ ...Number.isSafeInteger(row.subagentCount) && row.subagentCount > 0 ? { subagentCount: row.subagentCount } : {},
577
+ activity: ACTIVITY_PRIORITY[row.activity] !== void 0 ? row.activity : void 0
575
578
  }];
576
579
  });
577
580
  }
581
+ function readSubagentInspector(value) {
582
+ const inspector = record(value);
583
+ if (!inspector || typeof inspector.parentKey !== "string" || !inspector.parentKey) return null;
584
+ return {
585
+ parentKey: inspector.parentKey,
586
+ parentTitle: boundedString(string(inspector.parentTitle), 500),
587
+ status: ["loading", "ready", "error"].includes(inspector.status) ? inspector.status : "loading",
588
+ items: readSessions(inspector.items).slice(0, 100),
589
+ selectedKey: typeof inspector.selectedKey === "string" && inspector.selectedKey ? inspector.selectedKey : null,
590
+ transcript: readTranscript(inspector.transcript).slice(-120),
591
+ error: typeof inspector.error === "string" ? boundedString(inspector.error) : null
592
+ };
593
+ }
578
594
  function readAttached(value) {
579
595
  const item = record(value);
580
596
  if (!item || typeof item.harness !== "string") return null;
@@ -789,6 +805,7 @@ function normalizeUiState(value) {
789
805
  return item && typeof item.key === "string" && ["unseen", "finished", "failed"].includes(item.kind) ? [{ key: item.key, kind: item.kind, ...typeof item.preview === "string" ? { preview: item.preview } : {}, ...Number.isSafeInteger(item.afterMessages) && item.afterMessages >= 0 ? { afterMessages: item.afterMessages } : {}, ...Number.isSafeInteger(item.unreadCount) && item.unreadCount > 0 ? { unreadCount: item.unreadCount } : {} }] : [];
790
806
  }) : [],
791
807
  sessions: readSessions(raw.sessions),
808
+ subagentInspector: readSubagentInspector(raw.subagentInspector),
792
809
  attached: readAttached(raw.attached),
793
810
  owned: readAttached(raw.owned),
794
811
  attachError: attachError && typeof attachError.key === "string" && typeof attachError.message === "string" ? { key: attachError.key, message: attachError.message } : null
@@ -802,6 +819,7 @@ function sessionDisplayName(session) {
802
819
  return title && title !== session.name ? title : session.name || "Untitled chat";
803
820
  }
804
821
  function sessionActivity(state, row) {
822
+ if (row.activity && ACTIVITY_PRIORITY[row.activity] !== void 0) return row.activity;
805
823
  if (state.needsInput && row.active) return "needs-input";
806
824
  if (state.busy && row.active) return "working";
807
825
  if (row.runtimeStatus === "busy") return "working";
@@ -904,6 +922,12 @@ function boundedSet(map, key, value) {
904
922
  // src/icon.jsx
905
923
  import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
906
924
  var ICONS = {
925
+ agents: () => /* @__PURE__ */ jsxs(Fragment, { children: [
926
+ /* @__PURE__ */ jsx("circle", { cx: "6", cy: "6.5", r: "2" }),
927
+ /* @__PURE__ */ jsx("path", { d: "M2.75 13c.45-2 1.55-3 3.25-3s2.8 1 3.25 3" }),
928
+ /* @__PURE__ */ jsx("circle", { cx: "12.25", cy: "7", r: "1.5" }),
929
+ /* @__PURE__ */ jsx("path", { d: "M10.5 10.75c1.95-.65 3.45.1 4 2.25" })
930
+ ] }),
907
931
  attach: () => /* @__PURE__ */ jsx("path", { d: "M6.25 9.75 10.6 5.4a2.1 2.1 0 0 1 2.97 2.97l-5.4 5.4a3.3 3.3 0 0 1-4.67-4.66l5.52-5.52" }),
908
932
  back: () => /* @__PURE__ */ jsx("path", { d: "m11.5 4.5-4.5 4.5 4.5 4.5" }),
909
933
  check: () => /* @__PURE__ */ jsx("path", { d: "m4 9 3.25 3.25L14 5.5" }),
@@ -2221,7 +2245,7 @@ function sessionPathParts(value) {
2221
2245
  trailing: complete.slice(boundary + 1)
2222
2246
  };
2223
2247
  }
2224
- function SessionRow({ row, state, onOpen, now = Date.now() }) {
2248
+ function SessionRow({ row, state, onOpen, onOpenSubagents, now = Date.now() }) {
2225
2249
  const activity = sessionActivity(state, row);
2226
2250
  const working = activity === "working";
2227
2251
  const attention = state.attention.find((item) => item.key === row.key);
@@ -2231,32 +2255,40 @@ function SessionRow({ row, state, onOpen, now = Date.now() }) {
2231
2255
  const unreadCount = attention?.unreadCount ?? 0;
2232
2256
  const unreadLabel = unreadCount > 99 ? "99+" : String(unreadCount);
2233
2257
  const age = relativeAge(row.previewUpdatedAt ?? row.updatedAt, now) || row.age;
2234
- return /* @__PURE__ */ jsxs6("button", { className: "scui-session", "data-active": row.active, "data-activity": activity, "data-writable": row.writable, "data-session-key": row.key, type: "button", "aria-label": `${title} \xB7 ${harnessDisplayName(row.harness)}${row.writable ? "" : " \xB7 Read-only"}${working ? " \xB7 Working" : ""}${path.complete ? ` \xB7 ${path.complete}` : ""}${preview ? ` \xB7 ${preview}` : ""}${unreadCount ? ` \xB7 ${unreadCount} unread` : ""}${age ? ` \xB7 ${age}` : ""}`, "aria-current": row.active ? "true" : void 0, onClick: () => onOpen(row), children: [
2235
- /* @__PURE__ */ jsx7(HarnessLogo, { id: row.harness, activity, size: 34 }),
2236
- /* @__PURE__ */ jsxs6("span", { className: "scui-session-copy", children: [
2237
- /* @__PURE__ */ jsxs6("span", { className: "scui-session-title", children: [
2238
- /* @__PURE__ */ jsx7("strong", { children: title }),
2239
- /* @__PURE__ */ jsx7("span", { className: "scui-session-meta", children: age ? /* @__PURE__ */ jsx7("time", { children: age }) : null })
2240
- ] }),
2241
- path.complete ? /* @__PURE__ */ jsxs6("small", { className: "scui-session-path", title: row.cwd, children: [
2242
- /* @__PURE__ */ jsx7("span", { className: "scui-session-path-leading", children: path.leading }),
2243
- path.separator ? /* @__PURE__ */ jsx7("span", { className: "scui-session-path-separator", children: path.separator }) : null,
2244
- path.trailing ? /* @__PURE__ */ jsx7("span", { className: "scui-session-path-trailing", children: path.trailing }) : null
2245
- ] }) : null,
2246
- working || preview || unreadCount ? /* @__PURE__ */ jsxs6("span", { className: "scui-session-preview", children: [
2247
- working ? /* @__PURE__ */ jsxs6("span", { className: "scui-session-working", "aria-hidden": "true", children: [
2248
- /* @__PURE__ */ jsx7("i", {}),
2249
- /* @__PURE__ */ jsx7("i", {}),
2250
- /* @__PURE__ */ jsx7("i", {})
2258
+ return /* @__PURE__ */ jsxs6("article", { className: "scui-session", "data-active": row.active, "data-activity": activity, "data-writable": row.writable, children: [
2259
+ /* @__PURE__ */ jsxs6("button", { className: "scui-session-main", "data-session-key": row.key, type: "button", "aria-label": `${title} \xB7 ${harnessDisplayName(row.harness)}${row.writable ? "" : " \xB7 Read-only"}${working ? " \xB7 Working" : ""}${path.complete ? ` \xB7 ${path.complete}` : ""}${preview ? ` \xB7 ${preview}` : ""}${unreadCount ? ` \xB7 ${unreadCount} unread` : ""}${age ? ` \xB7 ${age}` : ""}`, "aria-current": row.active ? "true" : void 0, onClick: () => onOpen(row), children: [
2260
+ /* @__PURE__ */ jsx7(HarnessLogo, { id: row.harness, activity, size: 34 }),
2261
+ /* @__PURE__ */ jsxs6("span", { className: "scui-session-copy", children: [
2262
+ /* @__PURE__ */ jsxs6("span", { className: "scui-session-title", children: [
2263
+ /* @__PURE__ */ jsx7("strong", { children: title }),
2264
+ /* @__PURE__ */ jsx7("span", { className: "scui-session-meta", children: age ? /* @__PURE__ */ jsx7("time", { children: age }) : null })
2265
+ ] }),
2266
+ path.complete ? /* @__PURE__ */ jsxs6("small", { className: "scui-session-path", title: row.cwd, children: [
2267
+ /* @__PURE__ */ jsx7("span", { className: "scui-session-path-leading", children: path.leading }),
2268
+ path.separator ? /* @__PURE__ */ jsx7("span", { className: "scui-session-path-separator", children: path.separator }) : null,
2269
+ path.trailing ? /* @__PURE__ */ jsx7("span", { className: "scui-session-path-trailing", children: path.trailing }) : null
2251
2270
  ] }) : null,
2252
- preview || working ? /* @__PURE__ */ jsx7("small", { children: preview || "Working\u2026" }) : null,
2253
- unreadCount ? /* @__PURE__ */ jsx7("b", { "aria-label": `${unreadCount} unread messages`, children: unreadLabel }) : null
2254
- ] }) : null,
2255
- state.attachError?.key === row.key ? /* @__PURE__ */ jsx7("em", { children: state.attachError.message }) : null
2256
- ] })
2271
+ working || preview || unreadCount ? /* @__PURE__ */ jsxs6("span", { className: "scui-session-preview", children: [
2272
+ working ? /* @__PURE__ */ jsxs6("span", { className: "scui-session-working", "aria-hidden": "true", children: [
2273
+ /* @__PURE__ */ jsx7("i", {}),
2274
+ /* @__PURE__ */ jsx7("i", {}),
2275
+ /* @__PURE__ */ jsx7("i", {})
2276
+ ] }) : null,
2277
+ preview || working ? /* @__PURE__ */ jsx7("small", { children: preview || "Working\u2026" }) : null,
2278
+ unreadCount ? /* @__PURE__ */ jsx7("b", { "aria-label": `${unreadCount} unread messages`, children: unreadLabel }) : null
2279
+ ] }) : null,
2280
+ state.attachError?.key === row.key ? /* @__PURE__ */ jsx7("em", { children: state.attachError.message }) : null
2281
+ ] })
2282
+ ] }),
2283
+ row.subagentCount ? /* @__PURE__ */ jsxs6("button", { className: "scui-session-agents", type: "button", "aria-label": `Inspect ${row.subagentCount} subagents in ${title}`, onClick: () => onOpenSubagents?.(row), children: [
2284
+ /* @__PURE__ */ jsx7(UiIcon, { name: "agents", size: 14 }),
2285
+ row.subagentCount,
2286
+ " ",
2287
+ row.subagentCount === 1 ? "agent" : "agents"
2288
+ ] }) : null
2257
2289
  ] });
2258
2290
  }
2259
- function SessionList({ state, adapter, onOpen, onNew, onClose, components = {}, slots = {}, labels = DEFAULT_LABELS, focusKey = null, memoryKey = state.workspace || "@default", headerActions: HeaderActions }) {
2291
+ function SessionList({ state, adapter, onOpen, onOpenSubagents, onNew, onClose, components = {}, slots = {}, labels = DEFAULT_LABELS, focusKey = null, memoryKey = state.workspace || "@default", headerActions: HeaderActions }) {
2260
2292
  const remembered = sessionListMemory.get(memoryKey) ?? { query: "", top: 0 };
2261
2293
  const [query, setQuery] = useState4(remembered.query);
2262
2294
  const [loadingMore, setLoadingMore] = useState4(false);
@@ -2322,26 +2354,86 @@ function SessionList({ state, adapter, onOpen, onNew, onClose, components = {},
2322
2354
  /* @__PURE__ */ jsxs6("div", { className: "scui-session-rows", ref: rowScroller, onScroll: (event) => boundedSet(sessionListMemory, memoryKey, { query, top: event.currentTarget.scrollTop }), children: [
2323
2355
  BeforeSessions ? /* @__PURE__ */ jsx7(BeforeSessions, { state, adapter, value: { query, rows } }) : null,
2324
2356
  !rows.length && state.startup === "ready" ? /* @__PURE__ */ jsx7("div", { className: "scui-empty", children: query ? "No chats match your search." : state.error ?? "No coding chats found." }) : null,
2325
- rows.map((row) => /* @__PURE__ */ jsx7(Row, { value: row, row, state, adapter, onOpen, now }, row.key)),
2357
+ rows.map((row) => /* @__PURE__ */ jsx7(Row, { value: row, row, state, adapter, onOpen, onOpenSubagents, now }, row.key)),
2326
2358
  state.history.hasMoreSessions ? /* @__PURE__ */ jsx7("button", { className: "scui-load", type: "button", disabled: loadingMore, onClick: loadMore, children: loadingMore ? "Loading older chats\u2026" : "Load older chats" }) : null,
2327
2359
  AfterSessions ? /* @__PURE__ */ jsx7(AfterSessions, { state, adapter, value: { query, rows } }) : null
2328
2360
  ] })
2329
2361
  ] });
2330
2362
  }
2331
2363
 
2364
+ // src/subagents.jsx
2365
+ import { jsx as jsx8, jsxs as jsxs7 } from "preact/jsx-runtime";
2366
+ function SubagentInspector({ state, adapter, onClose }) {
2367
+ const inspector = state.subagentInspector;
2368
+ if (!inspector) return null;
2369
+ const selected = inspector.items.find((row) => row.key === inspector.selectedKey) ?? null;
2370
+ const detailState = selected ? {
2371
+ ...state,
2372
+ transcript: inspector.transcript,
2373
+ busy: selected.activity === "working",
2374
+ needsInput: selected.activity === "needs-input",
2375
+ harness: selected.harness,
2376
+ mode: "mirror",
2377
+ canSend: false,
2378
+ canSteer: false,
2379
+ canInterrupt: false,
2380
+ canRespond: false,
2381
+ taskPlan: { source: "none", items: [], residueCount: 0, observedAt: null },
2382
+ semantics: { fidelity: null, residue: [], residueCount: 0, parseErrors: 0, rawRecords: 0, subagents: [] },
2383
+ history: { ...state.history, hasEarlier: false }
2384
+ } : null;
2385
+ const leave = () => {
2386
+ adapter.onIntent({ action: "closeSubagents" });
2387
+ onClose();
2388
+ };
2389
+ const back = () => selected ? adapter.onIntent({ action: "openSubagents", key: inspector.parentKey }) : leave();
2390
+ return /* @__PURE__ */ jsxs7("section", { className: "scui-subagents", "aria-label": `Subagents for ${inspector.parentTitle}`, children: [
2391
+ /* @__PURE__ */ jsxs7("header", { className: "scui-head", children: [
2392
+ /* @__PURE__ */ jsx8("button", { type: "button", "aria-label": selected ? "Back to subagents" : "Back to chats", onClick: back, children: /* @__PURE__ */ jsx8(UiIcon, { name: "back", size: 17 }) }),
2393
+ /* @__PURE__ */ jsx8(UiIcon, { name: "agents", size: 20 }),
2394
+ /* @__PURE__ */ jsxs7("span", { className: "scui-head-copy", children: [
2395
+ /* @__PURE__ */ jsx8("strong", { children: selected ? sessionDisplayName(selected) : `${inspector.items.length || ""} ${inspector.items.length === 1 ? "agent" : "agents"}`.trim() }),
2396
+ /* @__PURE__ */ jsx8("small", { children: selected ? `${harnessDisplayName(selected.harness)} \xB7 Read-only` : inspector.parentTitle })
2397
+ ] }),
2398
+ /* @__PURE__ */ jsx8("button", { type: "button", "aria-label": "Close subagent inspector", onClick: leave, children: /* @__PURE__ */ jsx8(UiIcon, { name: "close", size: 18 }) })
2399
+ ] }),
2400
+ inspector.status === "loading" ? /* @__PURE__ */ jsxs7("div", { className: "scui-subagents-loading", role: "status", children: [
2401
+ /* @__PURE__ */ jsx8("i", {}),
2402
+ /* @__PURE__ */ jsxs7("span", { children: [
2403
+ /* @__PURE__ */ jsx8("strong", { children: selected ? "Loading subagent" : "Finding subagents" }),
2404
+ /* @__PURE__ */ jsx8("small", { children: selected ? "Reading a bounded recent transcript\u2026" : "Reading native session relationships\u2026" })
2405
+ ] })
2406
+ ] }) : null,
2407
+ inspector.error ? /* @__PURE__ */ jsx8("div", { className: "scui-error", role: "alert", children: inspector.error }) : null,
2408
+ !selected && inspector.status === "ready" ? /* @__PURE__ */ jsx8("div", { className: "scui-subagent-rows", children: inspector.items.map((row) => /* @__PURE__ */ jsxs7("button", { type: "button", "data-activity": row.activity ?? "idle", onClick: () => adapter.onIntent({ action: "openSubagent", parentKey: inspector.parentKey, key: row.key }), children: [
2409
+ /* @__PURE__ */ jsx8(HarnessLogo, { id: row.harness, activity: row.activity, size: 30 }),
2410
+ /* @__PURE__ */ jsxs7("span", { children: [
2411
+ /* @__PURE__ */ jsx8("strong", { children: sessionDisplayName(row) }),
2412
+ /* @__PURE__ */ jsx8("small", { children: row.preview || (row.activity === "working" ? "Working\u2026" : row.cwd) })
2413
+ ] }),
2414
+ /* @__PURE__ */ jsxs7("span", { children: [
2415
+ /* @__PURE__ */ jsx8("small", { children: row.activity === "needs-input" ? "Needs input" : row.activity === "working" ? "Working" : row.age }),
2416
+ /* @__PURE__ */ jsx8(UiIcon, { name: "chevron", size: 14 })
2417
+ ] })
2418
+ ] }, row.key)) }) : null,
2419
+ !selected && inspector.status === "ready" && !inspector.items.length ? /* @__PURE__ */ jsx8("div", { className: "scui-empty", children: "No native child sessions were found." }) : null,
2420
+ selected && inspector.status === "ready" && detailState ? /* @__PURE__ */ jsx8(Conversation, { state: detailState, adapter, memoryKey: `subagent:${selected.key}` }) : null
2421
+ ] });
2422
+ }
2423
+
2332
2424
  // src/settings.jsx
2333
2425
  import { useEffect as useEffect7, useId as useId2, useMemo as useMemo2, useRef as useRef6, useState as useState5 } from "preact/hooks";
2334
- import { jsx as jsx8, jsxs as jsxs7 } from "preact/jsx-runtime";
2426
+ import { jsx as jsx9, jsxs as jsxs8 } from "preact/jsx-runtime";
2335
2427
  function HarnessAdvisory({ state, onReview }) {
2336
2428
  const advisory = state.interopSettings?.advisories[0];
2337
2429
  if (!advisory && !state.interopSettingsError) return null;
2338
- return /* @__PURE__ */ jsxs7("div", { className: "scui-advisory", "data-severity": advisory?.severity ?? "error", role: advisory?.severity === "error" || !advisory ? "alert" : "status", children: [
2339
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: "!" }),
2340
- /* @__PURE__ */ jsxs7("span", { children: [
2341
- /* @__PURE__ */ jsx8("strong", { children: advisory?.title ?? "Could not inspect harness settings" }),
2342
- /* @__PURE__ */ jsx8("small", { children: advisory?.message ?? state.interopSettingsError })
2430
+ return /* @__PURE__ */ jsxs8("div", { className: "scui-advisory", "data-severity": advisory?.severity ?? "error", role: advisory?.severity === "error" || !advisory ? "alert" : "status", children: [
2431
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "!" }),
2432
+ /* @__PURE__ */ jsxs8("span", { children: [
2433
+ /* @__PURE__ */ jsx9("strong", { children: advisory?.title ?? "Could not inspect harness settings" }),
2434
+ /* @__PURE__ */ jsx9("small", { children: advisory?.message ?? state.interopSettingsError })
2343
2435
  ] }),
2344
- advisory && state.canConfigureSettings ? /* @__PURE__ */ jsx8("button", { type: "button", onClick: () => onReview(advisory.recommendation.change), children: "Review" }) : null
2436
+ advisory && state.canConfigureSettings ? /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => onReview(advisory.recommendation.change), children: "Review" }) : null
2345
2437
  ] });
2346
2438
  }
2347
2439
  function initialValues(report, recommendedChange) {
@@ -2369,11 +2461,11 @@ function HarnessSettingsPanel({ state, adapter, onClose, recommendedChange = nul
2369
2461
  document.addEventListener("keydown", dismiss);
2370
2462
  return () => document.removeEventListener("keydown", dismiss);
2371
2463
  }, [onClose]);
2372
- if (!report) return /* @__PURE__ */ jsx8("section", { ref: panel, className: "scui-settings", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, children: /* @__PURE__ */ jsxs7("header", { children: [
2373
- /* @__PURE__ */ jsx8("button", { type: "button", "aria-label": "Close settings", onClick: onClose, children: /* @__PURE__ */ jsx8(UiIcon, { name: "close", size: 18 }) }),
2374
- /* @__PURE__ */ jsxs7("span", { children: [
2375
- /* @__PURE__ */ jsx8("strong", { id: titleId, children: "Harness settings" }),
2376
- /* @__PURE__ */ jsx8("small", { children: state.interopSettingsError ?? "No interoperability controls are available." })
2464
+ if (!report) return /* @__PURE__ */ jsx9("section", { ref: panel, className: "scui-settings", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, children: /* @__PURE__ */ jsxs8("header", { children: [
2465
+ /* @__PURE__ */ jsx9("button", { type: "button", "aria-label": "Close settings", onClick: onClose, children: /* @__PURE__ */ jsx9(UiIcon, { name: "close", size: 18 }) }),
2466
+ /* @__PURE__ */ jsxs8("span", { children: [
2467
+ /* @__PURE__ */ jsx9("strong", { id: titleId, children: "Harness settings" }),
2468
+ /* @__PURE__ */ jsx9("small", { children: state.interopSettingsError ?? "No interoperability controls are available." })
2377
2469
  ] })
2378
2470
  ] }) });
2379
2471
  const changed = report.controls.flatMap((control) => values[control.key] !== (control.configuredValue ?? control.effectiveValue ?? control.choices[0]?.value ?? null) ? [{ key: control.key, value: values[control.key] ?? null }] : []);
@@ -2382,45 +2474,45 @@ function HarnessSettingsPanel({ state, adapter, onClose, recommendedChange = nul
2382
2474
  if (!changed.length || !state.canConfigureSettings) return;
2383
2475
  adapter.onIntent({ action: "configureHarness", harness: report.harness, changes: changed, expectedRevision: report.revision });
2384
2476
  };
2385
- return /* @__PURE__ */ jsxs7("section", { ref: panel, className: "scui-settings", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, children: [
2386
- /* @__PURE__ */ jsxs7("header", { children: [
2387
- /* @__PURE__ */ jsx8("button", { type: "button", "aria-label": "Close settings", onClick: onClose, children: /* @__PURE__ */ jsx8(UiIcon, { name: "close", size: 18 }) }),
2388
- /* @__PURE__ */ jsxs7("span", { children: [
2389
- /* @__PURE__ */ jsxs7("strong", { id: titleId, children: [
2477
+ return /* @__PURE__ */ jsxs8("section", { ref: panel, className: "scui-settings", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, children: [
2478
+ /* @__PURE__ */ jsxs8("header", { children: [
2479
+ /* @__PURE__ */ jsx9("button", { type: "button", "aria-label": "Close settings", onClick: onClose, children: /* @__PURE__ */ jsx9(UiIcon, { name: "close", size: 18 }) }),
2480
+ /* @__PURE__ */ jsxs8("span", { children: [
2481
+ /* @__PURE__ */ jsxs8("strong", { id: titleId, children: [
2390
2482
  harnessDisplayName(report.harness),
2391
2483
  " interoperability"
2392
2484
  ] }),
2393
- /* @__PURE__ */ jsx8("small", { children: "Native harness settings used by Supercode" })
2485
+ /* @__PURE__ */ jsx9("small", { children: "Native harness settings used by Supercode" })
2394
2486
  ] })
2395
2487
  ] }),
2396
- /* @__PURE__ */ jsxs7("form", { onSubmit: submit, children: [
2488
+ /* @__PURE__ */ jsxs8("form", { onSubmit: submit, children: [
2397
2489
  report.controls.map((control) => {
2398
2490
  const choice = control.choices.find((item) => item.value === values[control.key]);
2399
2491
  const recommendation = report.advisories.map((advisory) => advisory.recommendation).find((item) => item.change.key === control.key && item.change.value === values[control.key]);
2400
2492
  const consequence = choice?.risk ?? recommendation?.consequence;
2401
- return /* @__PURE__ */ jsxs7("fieldset", { disabled: !control.writable || Boolean(state.operation), children: [
2402
- /* @__PURE__ */ jsxs7("label", { htmlFor: `scui-setting-${control.key}`, children: [
2403
- /* @__PURE__ */ jsx8("strong", { children: control.label }),
2404
- /* @__PURE__ */ jsx8("small", { children: control.description })
2493
+ return /* @__PURE__ */ jsxs8("fieldset", { disabled: !control.writable || Boolean(state.operation), children: [
2494
+ /* @__PURE__ */ jsxs8("label", { htmlFor: `scui-setting-${control.key}`, children: [
2495
+ /* @__PURE__ */ jsx9("strong", { children: control.label }),
2496
+ /* @__PURE__ */ jsx9("small", { children: control.description })
2405
2497
  ] }),
2406
- /* @__PURE__ */ jsxs7("select", { id: `scui-setting-${control.key}`, value: values[control.key] ?? "@default", onChange: (event) => setValues((current) => ({ ...current, [control.key]: event.currentTarget.value === "@default" ? null : event.currentTarget.value })), children: [
2407
- control.resettable ? /* @__PURE__ */ jsx8("option", { value: "@default", children: "Use harness default" }) : null,
2408
- control.choices.map((item) => /* @__PURE__ */ jsx8("option", { value: item.value, children: item.label }, item.value))
2498
+ /* @__PURE__ */ jsxs8("select", { id: `scui-setting-${control.key}`, value: values[control.key] ?? "@default", onChange: (event) => setValues((current) => ({ ...current, [control.key]: event.currentTarget.value === "@default" ? null : event.currentTarget.value })), children: [
2499
+ control.resettable ? /* @__PURE__ */ jsx9("option", { value: "@default", children: "Use harness default" }) : null,
2500
+ control.choices.map((item) => /* @__PURE__ */ jsx9("option", { value: item.value, children: item.label }, item.value))
2409
2501
  ] }),
2410
- choice ? /* @__PURE__ */ jsx8("p", { children: choice.description }) : null,
2411
- consequence ? /* @__PURE__ */ jsxs7("p", { className: "scui-setting-risk", children: [
2412
- /* @__PURE__ */ jsx8("strong", { children: "Security consequence" }),
2502
+ choice ? /* @__PURE__ */ jsx9("p", { children: choice.description }) : null,
2503
+ consequence ? /* @__PURE__ */ jsxs8("p", { className: "scui-setting-risk", children: [
2504
+ /* @__PURE__ */ jsx9("strong", { children: "Security consequence" }),
2413
2505
  consequence
2414
2506
  ] }) : null,
2415
- /* @__PURE__ */ jsxs7("small", { className: "scui-setting-source", children: [
2507
+ /* @__PURE__ */ jsxs8("small", { className: "scui-setting-source", children: [
2416
2508
  control.effectiveNote,
2417
2509
  control.sourcePath ? ` Source: ${control.sourcePath}` : ""
2418
2510
  ] })
2419
2511
  ] }, control.key);
2420
2512
  }),
2421
- /* @__PURE__ */ jsxs7("footer", { children: [
2422
- /* @__PURE__ */ jsx8("button", { type: "button", onClick: onClose, children: "Cancel" }),
2423
- /* @__PURE__ */ jsx8("button", { type: "submit", disabled: !changed.length || !state.canConfigureSettings || Boolean(state.operation), children: state.operation === "configureHarness" ? "Applying\u2026" : "Apply changes" })
2513
+ /* @__PURE__ */ jsxs8("footer", { children: [
2514
+ /* @__PURE__ */ jsx9("button", { type: "button", onClick: onClose, children: "Cancel" }),
2515
+ /* @__PURE__ */ jsx9("button", { type: "submit", disabled: !changed.length || !state.canConfigureSettings || Boolean(state.operation), children: state.operation === "configureHarness" ? "Applying\u2026" : "Apply changes" })
2424
2516
  ] })
2425
2517
  ] })
2426
2518
  ] });
@@ -2428,20 +2520,20 @@ function HarnessSettingsPanel({ state, adapter, onClose, recommendedChange = nul
2428
2520
  function HarnessReadiness({ harnesses, adapter }) {
2429
2521
  const blocked = harnesses.filter((item) => !item.startable);
2430
2522
  if (!blocked.length || harnesses.some((item) => item.startable)) return null;
2431
- return /* @__PURE__ */ jsxs7("details", { className: "scui-readiness", open: true, children: [
2432
- /* @__PURE__ */ jsx8("summary", { children: "No coding harness is ready" }),
2433
- /* @__PURE__ */ jsx8("div", { children: blocked.map((item) => /* @__PURE__ */ jsxs7("section", { children: [
2434
- /* @__PURE__ */ jsx8(HarnessLogo, { id: item.id, size: 25 }),
2435
- /* @__PURE__ */ jsxs7("span", { children: [
2436
- /* @__PURE__ */ jsx8("strong", { children: item.label }),
2437
- /* @__PURE__ */ jsx8("small", { children: item.reason || (item.auth === "required" ? "Authentication required" : "Unavailable") }),
2438
- item.protocol ? /* @__PURE__ */ jsxs7("em", { children: [
2523
+ return /* @__PURE__ */ jsxs8("details", { className: "scui-readiness", open: true, children: [
2524
+ /* @__PURE__ */ jsx9("summary", { children: "No coding harness is ready" }),
2525
+ /* @__PURE__ */ jsx9("div", { children: blocked.map((item) => /* @__PURE__ */ jsxs8("section", { children: [
2526
+ /* @__PURE__ */ jsx9(HarnessLogo, { id: item.id, size: 25 }),
2527
+ /* @__PURE__ */ jsxs8("span", { children: [
2528
+ /* @__PURE__ */ jsx9("strong", { children: item.label }),
2529
+ /* @__PURE__ */ jsx9("small", { children: item.reason || (item.auth === "required" ? "Authentication required" : "Unavailable") }),
2530
+ item.protocol ? /* @__PURE__ */ jsxs8("em", { children: [
2439
2531
  item.protocol,
2440
2532
  " \xB7 ",
2441
2533
  item.runtime
2442
2534
  ] }) : null
2443
2535
  ] }),
2444
- item.repair ? /* @__PURE__ */ jsx8("button", { type: "button", onClick: () => adapter.copyText?.(item.repair), children: "Copy fix" }) : null
2536
+ item.repair ? /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => adapter.copyText?.(item.repair), children: "Copy fix" }) : null
2445
2537
  ] }, item.id)) })
2446
2538
  ] });
2447
2539
  }
@@ -2489,30 +2581,30 @@ function HarnessPicker({ harnesses, value, disabled = false, adapter, onChange,
2489
2581
  onChange(id);
2490
2582
  close();
2491
2583
  };
2492
- return /* @__PURE__ */ jsxs7("div", { className: "scui-harness-menu", ref: root, onBlur: (event) => {
2584
+ return /* @__PURE__ */ jsxs8("div", { className: "scui-harness-menu", ref: root, onBlur: (event) => {
2493
2585
  if (event.relatedTarget && !event.currentTarget.contains(event.relatedTarget)) setOpen(false);
2494
2586
  }, children: [
2495
- /* @__PURE__ */ jsxs7("button", { ref: trigger, className: "scui-harness-trigger", type: "button", disabled: disabled || !selected, "aria-label": selected ? `Coding harness: ${selected.label}` : "No coding harness available", "aria-haspopup": "dialog", "aria-expanded": open, "aria-controls": open ? menuId : void 0, onClick: () => setOpen((current) => !current), children: [
2496
- selected ? /* @__PURE__ */ jsx8(Logo, { id: selected.id, size: 20 }) : null,
2497
- /* @__PURE__ */ jsx8("strong", { children: selected?.label ?? "No harness available" }),
2498
- /* @__PURE__ */ jsx8(UiIcon, { name: "chevron", size: 13 })
2587
+ /* @__PURE__ */ jsxs8("button", { ref: trigger, className: "scui-harness-trigger", type: "button", disabled: disabled || !selected, "aria-label": selected ? `Coding harness: ${selected.label}` : "No coding harness available", "aria-haspopup": "dialog", "aria-expanded": open, "aria-controls": open ? menuId : void 0, onClick: () => setOpen((current) => !current), children: [
2588
+ selected ? /* @__PURE__ */ jsx9(Logo, { id: selected.id, size: 20 }) : null,
2589
+ /* @__PURE__ */ jsx9("strong", { children: selected?.label ?? "No harness available" }),
2590
+ /* @__PURE__ */ jsx9(UiIcon, { name: "chevron", size: 13 })
2499
2591
  ] }),
2500
- open ? /* @__PURE__ */ jsxs7("div", { ref: panel, id: menuId, className: "scui-harness-popover", role: "dialog", "aria-label": "Choose coding harness", onKeyDown: navigate, children: [
2501
- /* @__PURE__ */ jsx8("strong", { className: "scui-harness-popover-title", children: "Choose coding harness" }),
2502
- /* @__PURE__ */ jsx8("div", { className: "scui-harness-options", role: "listbox", "aria-label": "Available coding harnesses", children: available.map((item) => /* @__PURE__ */ jsxs7("button", { type: "button", role: "option", "aria-selected": item.id === selected?.id, onClick: () => select(item.id), children: [
2503
- /* @__PURE__ */ jsx8(Logo, { id: item.id, size: 24 }),
2504
- /* @__PURE__ */ jsx8("strong", { children: item.label }),
2505
- /* @__PURE__ */ jsx8("span", { children: item.id === selected?.id ? /* @__PURE__ */ jsx8(UiIcon, { name: "check", size: 15 }) : null })
2592
+ open ? /* @__PURE__ */ jsxs8("div", { ref: panel, id: menuId, className: "scui-harness-popover", role: "dialog", "aria-label": "Choose coding harness", onKeyDown: navigate, children: [
2593
+ /* @__PURE__ */ jsx9("strong", { className: "scui-harness-popover-title", children: "Choose coding harness" }),
2594
+ /* @__PURE__ */ jsx9("div", { className: "scui-harness-options", role: "listbox", "aria-label": "Available coding harnesses", children: available.map((item) => /* @__PURE__ */ jsxs8("button", { type: "button", role: "option", "aria-selected": item.id === selected?.id, onClick: () => select(item.id), children: [
2595
+ /* @__PURE__ */ jsx9(Logo, { id: item.id, size: 24 }),
2596
+ /* @__PURE__ */ jsx9("strong", { children: item.label }),
2597
+ /* @__PURE__ */ jsx9("span", { children: item.id === selected?.id ? /* @__PURE__ */ jsx9(UiIcon, { name: "check", size: 15 }) : null })
2506
2598
  ] }, item.id)) }),
2507
- unavailable.length ? /* @__PURE__ */ jsxs7("details", { className: "scui-harness-manage", children: [
2508
- /* @__PURE__ */ jsx8("summary", { children: "Manage additional harnesses" }),
2509
- /* @__PURE__ */ jsx8("div", { children: unavailable.map((item) => /* @__PURE__ */ jsxs7("section", { children: [
2510
- /* @__PURE__ */ jsx8(Logo, { id: item.id, size: 24 }),
2511
- /* @__PURE__ */ jsxs7("span", { children: [
2512
- /* @__PURE__ */ jsx8("strong", { children: item.label }),
2513
- /* @__PURE__ */ jsx8("small", { children: item.reason || (item.auth === "required" ? "Authentication required" : "Unavailable") })
2599
+ unavailable.length ? /* @__PURE__ */ jsxs8("details", { className: "scui-harness-manage", children: [
2600
+ /* @__PURE__ */ jsx9("summary", { children: "Manage additional harnesses" }),
2601
+ /* @__PURE__ */ jsx9("div", { children: unavailable.map((item) => /* @__PURE__ */ jsxs8("section", { children: [
2602
+ /* @__PURE__ */ jsx9(Logo, { id: item.id, size: 24 }),
2603
+ /* @__PURE__ */ jsxs8("span", { children: [
2604
+ /* @__PURE__ */ jsx9("strong", { children: item.label }),
2605
+ /* @__PURE__ */ jsx9("small", { children: item.reason || (item.auth === "required" ? "Authentication required" : "Unavailable") })
2514
2606
  ] }),
2515
- item.repair ? /* @__PURE__ */ jsx8("button", { type: "button", onClick: () => adapter?.copyText?.(item.repair), children: "Copy fix" }) : null
2607
+ item.repair ? /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => adapter?.copyText?.(item.repair), children: "Copy fix" }) : null
2516
2608
  ] }, item.id)) })
2517
2609
  ] }) : null
2518
2610
  ] }) : null
@@ -2520,16 +2612,16 @@ function HarnessPicker({ harnesses, value, disabled = false, adapter, onChange,
2520
2612
  }
2521
2613
 
2522
2614
  // src/messenger.jsx
2523
- import { jsx as jsx9, jsxs as jsxs8 } from "preact/jsx-runtime";
2615
+ import { jsx as jsx10, jsxs as jsxs9 } from "preact/jsx-runtime";
2524
2616
  var pendingMessageMemory = /* @__PURE__ */ new Map();
2525
2617
  var messengerViewMemory = /* @__PURE__ */ new Map();
2526
2618
  var newChatMemory = /* @__PURE__ */ new Map();
2527
2619
  var TRACKED_ACTIONS = /* @__PURE__ */ new Set(["resume", "join", "detach", "branch", "reduce", "terminal", "export", "steer", "interrupt", "respond", "configureHarness", "refresh", "loadEarlier", "loadSessions"]);
2528
2620
  function Receipt({ state, adapter }) {
2529
2621
  const receipt = state.reductionReceipt;
2530
- if (receipt) return /* @__PURE__ */ jsx9("div", { className: "scui-receipt", children: /* @__PURE__ */ jsxs8("span", { children: [
2531
- /* @__PURE__ */ jsx9("strong", { children: "Reduced and verified" }),
2532
- /* @__PURE__ */ jsxs8("small", { children: [
2622
+ if (receipt) return /* @__PURE__ */ jsx10("div", { className: "scui-receipt", children: /* @__PURE__ */ jsxs9("span", { children: [
2623
+ /* @__PURE__ */ jsx10("strong", { children: "Reduced and verified" }),
2624
+ /* @__PURE__ */ jsxs9("small", { children: [
2533
2625
  receipt.sourceTokens.toLocaleString(),
2534
2626
  " \u2192 ",
2535
2627
  receipt.reducedTokens.toLocaleString(),
@@ -2538,27 +2630,27 @@ function Receipt({ state, adapter }) {
2538
2630
  "\xD7 \xB7 reversible"
2539
2631
  ] })
2540
2632
  ] }) });
2541
- if (state.exportReceipt) return /* @__PURE__ */ jsxs8("div", { className: "scui-receipt", children: [
2542
- /* @__PURE__ */ jsxs8("span", { children: [
2543
- /* @__PURE__ */ jsxs8("strong", { children: [
2633
+ if (state.exportReceipt) return /* @__PURE__ */ jsxs9("div", { className: "scui-receipt", children: [
2634
+ /* @__PURE__ */ jsxs9("span", { children: [
2635
+ /* @__PURE__ */ jsxs9("strong", { children: [
2544
2636
  "Lossless export ready \xB7 ",
2545
2637
  harnessDisplayName(state.exportReceipt.targetHarness)
2546
2638
  ] }),
2547
- /* @__PURE__ */ jsxs8("small", { children: [
2639
+ /* @__PURE__ */ jsxs9("small", { children: [
2548
2640
  state.exportReceipt.path,
2549
2641
  " \xB7 ",
2550
2642
  state.exportReceipt.files,
2551
2643
  " files"
2552
2644
  ] })
2553
2645
  ] }),
2554
- /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => adapter.copyText?.(state.exportReceipt.path), children: "Copy path" })
2646
+ /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => adapter.copyText?.(state.exportReceipt.path), children: "Copy path" })
2555
2647
  ] });
2556
- if (state.terminalHandoff) return /* @__PURE__ */ jsxs8("div", { className: "scui-receipt", children: [
2557
- /* @__PURE__ */ jsxs8("span", { children: [
2558
- /* @__PURE__ */ jsx9("strong", { children: "Terminal handoff ready" }),
2559
- /* @__PURE__ */ jsx9("small", { children: state.terminalHandoff.cwd })
2648
+ if (state.terminalHandoff) return /* @__PURE__ */ jsxs9("div", { className: "scui-receipt", children: [
2649
+ /* @__PURE__ */ jsxs9("span", { children: [
2650
+ /* @__PURE__ */ jsx10("strong", { children: "Terminal handoff ready" }),
2651
+ /* @__PURE__ */ jsx10("small", { children: state.terminalHandoff.cwd })
2560
2652
  ] }),
2561
- /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => adapter.copyText?.(terminalCommand(state.terminalHandoff)), children: "Copy command" })
2653
+ /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => adapter.copyText?.(terminalCommand(state.terminalHandoff)), children: "Copy command" })
2562
2654
  ] });
2563
2655
  return null;
2564
2656
  }
@@ -2630,13 +2722,13 @@ function ConversationActions({ state, adapter, actionPending, onNew, onSettings
2630
2722
  const index = event.key === "Home" ? 0 : event.key === "End" ? items.length - 1 : event.key === "ArrowDown" ? (current + 1) % items.length : (current <= 0 ? items.length : current) - 1;
2631
2723
  items[index].focus({ preventScroll: true });
2632
2724
  };
2633
- return /* @__PURE__ */ jsxs8("div", { className: "scui-menu", ref: root, onBlur: (event) => {
2725
+ return /* @__PURE__ */ jsxs9("div", { className: "scui-menu", ref: root, onBlur: (event) => {
2634
2726
  if (event.relatedTarget && !event.currentTarget.contains(event.relatedTarget)) setOpen(false);
2635
2727
  }, children: [
2636
- /* @__PURE__ */ jsx9("button", { ref: trigger, className: "scui-menu-trigger", type: "button", "aria-label": "Conversation actions", "aria-haspopup": "menu", "aria-expanded": open, "aria-controls": open ? menuId : void 0, onClick: () => setOpen((value) => !value), children: /* @__PURE__ */ jsx9(UiIcon, { name: "menu", size: 18 }) }),
2637
- open ? /* @__PURE__ */ jsx9("div", { ref: panel, id: menuId, className: "scui-menu-panel", role: "menu", "aria-label": "Conversation actions", onKeyDown: navigate, children: groups.map((group) => /* @__PURE__ */ jsxs8("section", { role: "group", "aria-label": group.label, children: [
2638
- /* @__PURE__ */ jsx9("strong", { children: group.label }),
2639
- group.items.map((item) => /* @__PURE__ */ jsx9("button", { role: "menuitem", type: "button", disabled: actionPending, onClick: () => dispatch(item), children: item.label }, item.key))
2728
+ /* @__PURE__ */ jsx10("button", { ref: trigger, className: "scui-menu-trigger", type: "button", "aria-label": "Conversation actions", "aria-haspopup": "menu", "aria-expanded": open, "aria-controls": open ? menuId : void 0, onClick: () => setOpen((value) => !value), children: /* @__PURE__ */ jsx10(UiIcon, { name: "menu", size: 18 }) }),
2729
+ open ? /* @__PURE__ */ jsx10("div", { ref: panel, id: menuId, className: "scui-menu-panel", role: "menu", "aria-label": "Conversation actions", onKeyDown: navigate, children: groups.map((group) => /* @__PURE__ */ jsxs9("section", { role: "group", "aria-label": group.label, children: [
2730
+ /* @__PURE__ */ jsx10("strong", { children: group.label }),
2731
+ group.items.map((item) => /* @__PURE__ */ jsx10("button", { role: "menuitem", type: "button", disabled: actionPending, onClick: () => dispatch(item), children: item.label }, item.key))
2640
2732
  ] }, group.label)) }) : null
2641
2733
  ] });
2642
2734
  }
@@ -2648,20 +2740,20 @@ function ChatHeader({ state, adapter, pendingStatus, actionPending, onBack, onNe
2648
2740
  useEffect8(() => {
2649
2741
  if (state.mode === "mirror" && !state.canSend) back.current?.focus({ preventScroll: true });
2650
2742
  }, []);
2651
- return /* @__PURE__ */ jsxs8("header", { className: "scui-head scui-chat-head", children: [
2652
- /* @__PURE__ */ jsx9("button", { ref: back, type: "button", "aria-label": "Back to chats", onClick: onBack, children: /* @__PURE__ */ jsx9(UiIcon, { name: "back", size: 17 }) }),
2653
- /* @__PURE__ */ jsx9(HarnessLogo, { id: harness, size: 24 }),
2654
- /* @__PURE__ */ jsxs8("span", { className: "scui-head-copy", children: [
2655
- /* @__PURE__ */ jsx9("strong", { children: title }),
2656
- /* @__PURE__ */ jsxs8("small", { children: [
2743
+ return /* @__PURE__ */ jsxs9("header", { className: "scui-head scui-chat-head", children: [
2744
+ /* @__PURE__ */ jsx10("button", { ref: back, type: "button", "aria-label": "Back to chats", onClick: onBack, children: /* @__PURE__ */ jsx10(UiIcon, { name: "back", size: 17 }) }),
2745
+ /* @__PURE__ */ jsx10(HarnessLogo, { id: harness, size: 24 }),
2746
+ /* @__PURE__ */ jsxs9("span", { className: "scui-head-copy", children: [
2747
+ /* @__PURE__ */ jsx10("strong", { children: title }),
2748
+ /* @__PURE__ */ jsxs9("small", { children: [
2657
2749
  harnessDisplayName(harness),
2658
2750
  " \xB7 ",
2659
2751
  status
2660
2752
  ] })
2661
2753
  ] }),
2662
- HeaderActions ? /* @__PURE__ */ jsx9(HeaderActions, { state, adapter, value: "chat" }) : null,
2663
- /* @__PURE__ */ jsx9(ConversationActions, { state, adapter, actionPending, onNew, onSettings }),
2664
- onClose ? /* @__PURE__ */ jsx9("button", { type: "button", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx9(UiIcon, { name: "close", size: 18 }) }) : null
2754
+ HeaderActions ? /* @__PURE__ */ jsx10(HeaderActions, { state, adapter, value: "chat" }) : null,
2755
+ /* @__PURE__ */ jsx10(ConversationActions, { state, adapter, actionPending, onNew, onSettings }),
2756
+ onClose ? /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx10(UiIcon, { name: "close", size: 18 }) }) : null
2665
2757
  ] });
2666
2758
  }
2667
2759
  function Chat({ state, adapter, onBack, onNew, onClose, components, slots, labels, contextCandidates, navigation, composerCommand }) {
@@ -2777,22 +2869,22 @@ function Chat({ state, adapter, onBack, onNew, onClose, components, slots, label
2777
2869
  const unreadAfterMessages = state.attention.find((item) => item.key === state.attached?.key)?.afterMessages ?? null;
2778
2870
  const Advisory = components.HarnessAdvisory ?? HarnessAdvisory;
2779
2871
  const SettingsPanel = components.HarnessSettingsPanel ?? HarnessSettingsPanel;
2780
- return /* @__PURE__ */ jsxs8("section", { className: "scui-chat", children: [
2781
- Header ? /* @__PURE__ */ jsx9(Header, { state: actionState, adapter: trackedAdapter, value: null }) : /* @__PURE__ */ jsx9(ChatHeader, { state: actionState, adapter: trackedAdapter, pendingStatus: pending?.status ?? null, actionPending: Boolean(action), onBack, onNew, onClose, onSettings: () => setSettings({ recommendedChange: null }), headerActions: HeaderActions }),
2782
- actionLabel ? /* @__PURE__ */ jsxs8("div", { className: "scui-operation", role: "status", children: [
2783
- /* @__PURE__ */ jsx9("i", {}),
2872
+ return /* @__PURE__ */ jsxs9("section", { className: "scui-chat", children: [
2873
+ Header ? /* @__PURE__ */ jsx10(Header, { state: actionState, adapter: trackedAdapter, value: null }) : /* @__PURE__ */ jsx10(ChatHeader, { state: actionState, adapter: trackedAdapter, pendingStatus: pending?.status ?? null, actionPending: Boolean(action), onBack, onNew, onClose, onSettings: () => setSettings({ recommendedChange: null }), headerActions: HeaderActions }),
2874
+ actionLabel ? /* @__PURE__ */ jsxs9("div", { className: "scui-operation", role: "status", children: [
2875
+ /* @__PURE__ */ jsx10("i", {}),
2784
2876
  actionLabel
2785
2877
  ] }) : null,
2786
- state.error ? /* @__PURE__ */ jsxs8("div", { className: "scui-error", role: "alert", children: [
2787
- /* @__PURE__ */ jsx9("span", { children: state.error }),
2788
- state.recoverable ? /* @__PURE__ */ jsx9("button", { type: "button", disabled: Boolean(action), onClick: () => trackedAdapter.onIntent({ action: "refresh" }), children: "Retry" }) : null
2878
+ state.error ? /* @__PURE__ */ jsxs9("div", { className: "scui-error", role: "alert", children: [
2879
+ /* @__PURE__ */ jsx10("span", { children: state.error }),
2880
+ state.recoverable ? /* @__PURE__ */ jsx10("button", { type: "button", disabled: Boolean(action), onClick: () => trackedAdapter.onIntent({ action: "refresh" }), children: "Retry" }) : null
2789
2881
  ] }) : null,
2790
- /* @__PURE__ */ jsx9(Receipt, { state, adapter }),
2791
- /* @__PURE__ */ jsx9(Conversation, { state: actionState, adapter: trackedAdapter, components, slots, memoryKey, pending: pendingMessage, unreadAfterMessages }, memoryKey),
2792
- /* @__PURE__ */ jsx9(ContinuationBar, { state: actionState, adapter: trackedAdapter, labels }),
2793
- /* @__PURE__ */ jsx9(Advisory, { state: actionState, adapter: trackedAdapter, value: state.interopSettings?.advisories[0] ?? null, onReview: (recommendedChange) => setSettings({ recommendedChange }) }),
2794
- state.mode !== "mirror" || state.canSend ? /* @__PURE__ */ jsx9(Composer, { state: actionState, adapter: trackedAdapter, labels, memoryKey, pendingStatus: pending?.status ?? null, restoreDraft, command: composerCommand, contextCandidates, components, onDraftRestored: (id) => setRestoreDraft((value) => value?.id === id ? null : value), onPending: beginPending }, memoryKey) : null,
2795
- settings ? /* @__PURE__ */ jsx9(SettingsPanel, { state: actionState, adapter: trackedAdapter, value: state.interopSettings, recommendedChange: settings.recommendedChange, onClose: () => setSettings(null) }) : null
2882
+ /* @__PURE__ */ jsx10(Receipt, { state, adapter }),
2883
+ /* @__PURE__ */ jsx10(Conversation, { state: actionState, adapter: trackedAdapter, components, slots, memoryKey, pending: pendingMessage, unreadAfterMessages }, memoryKey),
2884
+ /* @__PURE__ */ jsx10(ContinuationBar, { state: actionState, adapter: trackedAdapter, labels }),
2885
+ /* @__PURE__ */ jsx10(Advisory, { state: actionState, adapter: trackedAdapter, value: state.interopSettings?.advisories[0] ?? null, onReview: (recommendedChange) => setSettings({ recommendedChange }) }),
2886
+ state.mode !== "mirror" || state.canSend ? /* @__PURE__ */ jsx10(Composer, { state: actionState, adapter: trackedAdapter, labels, memoryKey, pendingStatus: pending?.status ?? null, restoreDraft, command: composerCommand, contextCandidates, components, onDraftRestored: (id) => setRestoreDraft((value) => value?.id === id ? null : value), onPending: beginPending }, memoryKey) : null,
2887
+ settings ? /* @__PURE__ */ jsx10(SettingsPanel, { state: actionState, adapter: trackedAdapter, value: state.interopSettings, recommendedChange: settings.recommendedChange, onClose: () => setSettings(null) }) : null
2796
2888
  ] });
2797
2889
  }
2798
2890
  function NewChat({ state, adapter, onBack, onClose, onStarted, labels, memoryKey, headerActions: HeaderActions, contextCandidates, components, navigation, composerCommand }) {
@@ -2955,40 +3047,40 @@ function NewChat({ state, adapter, onBack, onClose, onStarted, labels, memoryKey
2955
3047
  Promise.resolve(result).catch(() => setStarting((current) => current?.id === id ? null : current));
2956
3048
  }
2957
3049
  };
2958
- return /* @__PURE__ */ jsxs8("section", { className: "scui-chat", children: [
2959
- /* @__PURE__ */ jsxs8("header", { className: "scui-head", children: [
2960
- /* @__PURE__ */ jsx9("button", { type: "button", "aria-label": "Back", onClick: onBack, children: /* @__PURE__ */ jsx9(UiIcon, { name: "back", size: 18 }) }),
2961
- /* @__PURE__ */ jsxs8("span", { className: "scui-head-copy", children: [
2962
- /* @__PURE__ */ jsx9("strong", { children: labels.newChat }),
2963
- /* @__PURE__ */ jsx9("small", { children: "No session is created until you send" })
3050
+ return /* @__PURE__ */ jsxs9("section", { className: "scui-chat", children: [
3051
+ /* @__PURE__ */ jsxs9("header", { className: "scui-head", children: [
3052
+ /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Back", onClick: onBack, children: /* @__PURE__ */ jsx10(UiIcon, { name: "back", size: 18 }) }),
3053
+ /* @__PURE__ */ jsxs9("span", { className: "scui-head-copy", children: [
3054
+ /* @__PURE__ */ jsx10("strong", { children: labels.newChat }),
3055
+ /* @__PURE__ */ jsx10("small", { children: "No session is created until you send" })
2964
3056
  ] }),
2965
- HeaderActions ? /* @__PURE__ */ jsx9(HeaderActions, { state, adapter, value: "new" }) : null,
2966
- onClose ? /* @__PURE__ */ jsx9("button", { type: "button", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx9(UiIcon, { name: "close", size: 18 }) }) : null
3057
+ HeaderActions ? /* @__PURE__ */ jsx10(HeaderActions, { state, adapter, value: "new" }) : null,
3058
+ onClose ? /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx10(UiIcon, { name: "close", size: 18 }) }) : null
2967
3059
  ] }),
2968
- starting ? /* @__PURE__ */ jsxs8("div", { className: "scui-operation", role: "status", children: [
2969
- /* @__PURE__ */ jsx9("i", {}),
3060
+ starting ? /* @__PURE__ */ jsxs9("div", { className: "scui-operation", role: "status", children: [
3061
+ /* @__PURE__ */ jsx10("i", {}),
2970
3062
  mode === "terminal" ? "Opening terminal\u2026" : operationLabel("start")
2971
3063
  ] }) : null,
2972
- /* @__PURE__ */ jsxs8("div", { className: "scui-new", children: [
2973
- /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u2726" }),
2974
- /* @__PURE__ */ jsx9("strong", { children: "What should the agent build or fix?" }),
2975
- /* @__PURE__ */ jsx9("small", { children: "Choose a coding harness and send the first message." })
3064
+ /* @__PURE__ */ jsxs9("div", { className: "scui-new", children: [
3065
+ /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u2726" }),
3066
+ /* @__PURE__ */ jsx10("strong", { children: "What should the agent build or fix?" }),
3067
+ /* @__PURE__ */ jsx10("small", { children: "Choose a coding harness and send the first message." })
2976
3068
  ] }),
2977
- /* @__PURE__ */ jsxs8("div", { className: "scui-compose", children: [
2978
- /* @__PURE__ */ jsx9(Readiness, { harnesses: state.harnesses, state, adapter }),
2979
- mode !== "terminal" ? /* @__PURE__ */ jsx9(ContextCandidates, { items: contextCandidates, context, images, state, adapter, onAttach: attachCandidate, component: components.ContextCandidate }) : null,
2980
- /* @__PURE__ */ jsx9(ImageTray, { items: images, onRemove: (index) => setImages((items) => {
3069
+ /* @__PURE__ */ jsxs9("div", { className: "scui-compose", children: [
3070
+ /* @__PURE__ */ jsx10(Readiness, { harnesses: state.harnesses, state, adapter }),
3071
+ mode !== "terminal" ? /* @__PURE__ */ jsx10(ContextCandidates, { items: contextCandidates, context, images, state, adapter, onAttach: attachCandidate, component: components.ContextCandidate }) : null,
3072
+ /* @__PURE__ */ jsx10(ImageTray, { items: images, onRemove: (index) => setImages((items) => {
2981
3073
  const next = items.filter((_, itemIndex) => itemIndex !== index);
2982
3074
  remember({ images: next });
2983
3075
  return next;
2984
3076
  }) }),
2985
- /* @__PURE__ */ jsx9(ContextTray, { items: context, onRemove: (index) => setContext((items) => {
3077
+ /* @__PURE__ */ jsx10(ContextTray, { items: context, onRemove: (index) => setContext((items) => {
2986
3078
  const next = items.filter((_, itemIndex) => itemIndex !== index);
2987
3079
  remember({ context: next });
2988
3080
  return next;
2989
3081
  }) }),
2990
- terminalAttachments ? /* @__PURE__ */ jsx9("small", { className: "scui-context-error", role: "alert", children: "Terminal starts currently accept text only. Remove attachments or choose Headless." }) : pickerError ? /* @__PURE__ */ jsx9("small", { className: "scui-context-error", role: "alert", children: pickerError }) : null,
2991
- /* @__PURE__ */ jsxs8("div", { className: `scui-envelope scui-new-envelope${dragging ? " scui-drop-target" : ""}`, onDragEnter: (event) => {
3082
+ terminalAttachments ? /* @__PURE__ */ jsx10("small", { className: "scui-context-error", role: "alert", children: "Terminal starts currently accept text only. Remove attachments or choose Headless." }) : pickerError ? /* @__PURE__ */ jsx10("small", { className: "scui-context-error", role: "alert", children: pickerError }) : null,
3083
+ /* @__PURE__ */ jsxs9("div", { className: `scui-envelope scui-new-envelope${dragging ? " scui-drop-target" : ""}`, onDragEnter: (event) => {
2992
3084
  if (Array.from(event.dataTransfer?.types ?? []).includes("Files")) {
2993
3085
  event.preventDefault();
2994
3086
  setDragging(true);
@@ -2998,7 +3090,7 @@ function NewChat({ state, adapter, onBack, onClose, onStarted, labels, memoryKey
2998
3090
  }, onDragLeave: (event) => {
2999
3091
  if (!event.currentTarget.contains(event.relatedTarget)) setDragging(false);
3000
3092
  }, onDrop: dropImages, children: [
3001
- /* @__PURE__ */ jsx9("textarea", { ref: textarea, rows: 3, "aria-label": "Message coding agent", placeholder: startable.length ? "What should the agent do?" : "No coding harness is available", value: draft, disabled: !startable.length || Boolean(starting), onPaste: pasteImages, onInput: (event) => {
3093
+ /* @__PURE__ */ jsx10("textarea", { ref: textarea, rows: 3, "aria-label": "Message coding agent", placeholder: startable.length ? "What should the agent do?" : "No coding harness is available", value: draft, disabled: !startable.length || Boolean(starting), onPaste: pasteImages, onInput: (event) => {
3002
3094
  const value = event.currentTarget.value;
3003
3095
  setDraft(value);
3004
3096
  remember({ draft: value });
@@ -3008,19 +3100,19 @@ function NewChat({ state, adapter, onBack, onClose, onStarted, labels, memoryKey
3008
3100
  send();
3009
3101
  }
3010
3102
  } }),
3011
- /* @__PURE__ */ jsxs8("footer", { className: "scui-new-envelope-controls", children: [
3012
- adapter.pickContext ? /* @__PURE__ */ jsx9("button", { className: "scui-attach", type: "button", "aria-label": labels.attachContext ?? DEFAULT_LABELS.attachContext, disabled: mode === "terminal" || picking || context.length >= MAX_CONTEXT_ITEMS && images.length >= MAX_IMAGE_ITEMS || Boolean(starting), onClick: pickContext, children: picking ? /* @__PURE__ */ jsx9("i", { className: "scui-control-spinner" }) : /* @__PURE__ */ jsx9(UiIcon, { name: "attach", size: 17 }) }) : null,
3013
- /* @__PURE__ */ jsx9(Picker, { harnesses: state.harnesses, value: harness, disabled: Boolean(starting), adapter, logo: components.HarnessLogo, onChange: (value) => {
3103
+ /* @__PURE__ */ jsxs9("footer", { className: "scui-new-envelope-controls", children: [
3104
+ adapter.pickContext ? /* @__PURE__ */ jsx10("button", { className: "scui-attach", type: "button", "aria-label": labels.attachContext ?? DEFAULT_LABELS.attachContext, disabled: mode === "terminal" || picking || context.length >= MAX_CONTEXT_ITEMS && images.length >= MAX_IMAGE_ITEMS || Boolean(starting), onClick: pickContext, children: picking ? /* @__PURE__ */ jsx10("i", { className: "scui-control-spinner" }) : /* @__PURE__ */ jsx10(UiIcon, { name: "attach", size: 17 }) }) : null,
3105
+ /* @__PURE__ */ jsx10(Picker, { harnesses: state.harnesses, value: harness, disabled: Boolean(starting), adapter, logo: components.HarnessLogo, onChange: (value) => {
3014
3106
  setHarness(value);
3015
3107
  remember({ harness: value });
3016
3108
  } }),
3017
- /* @__PURE__ */ jsx9(ExecutionModeSelect, { modes: launchModes, value: mode, disabled: Boolean(starting) || mode !== requestedMode, onChange: (item) => {
3109
+ /* @__PURE__ */ jsx10(ExecutionModeSelect, { modes: launchModes, value: mode, disabled: Boolean(starting) || mode !== requestedMode, onChange: (item) => {
3018
3110
  const next = { ...modes, [harness]: item };
3019
3111
  setModes(next);
3020
3112
  setPickerError(null);
3021
3113
  remember({ modes: next });
3022
3114
  } }),
3023
- /* @__PURE__ */ jsx9("span", { children: /* @__PURE__ */ jsx9("button", { type: "button", className: "scui-send", "aria-label": mode === "terminal" ? "Start terminal session" : "Start headless session", disabled: !draft.trim() && !images.length || !harness || Boolean(starting) || terminalAttachments || mode === "terminal" && !draft.trim(), onClick: send, children: starting ? /* @__PURE__ */ jsx9("i", { className: "scui-control-spinner" }) : /* @__PURE__ */ jsx9(UiIcon, { name: "send", size: 17 }) }) })
3115
+ /* @__PURE__ */ jsx10("span", { children: /* @__PURE__ */ jsx10("button", { type: "button", className: "scui-send", "aria-label": mode === "terminal" ? "Start terminal session" : "Start headless session", disabled: !draft.trim() && !images.length || !harness || Boolean(starting) || terminalAttachments || mode === "terminal" && !draft.trim(), onClick: send, children: starting ? /* @__PURE__ */ jsx10("i", { className: "scui-control-spinner" }) : /* @__PURE__ */ jsx10(UiIcon, { name: "send", size: 17 }) }) })
3024
3116
  ] })
3025
3117
  ] })
3026
3118
  ] })
@@ -3036,6 +3128,7 @@ function SupercodeMessenger({ state: stateInput, adapter, class: className = "",
3036
3128
  const [newNavigation, setNewNavigation] = useState6(null);
3037
3129
  const [chatNavigation, setChatNavigation] = useState6(null);
3038
3130
  const [listFocus, setListFocus] = useState6(null);
3131
+ const [inspecting, setInspecting] = useState6(null);
3039
3132
  const lastNavigation = useRef7(null);
3040
3133
  const setView = (next) => {
3041
3134
  boundedSet(messengerViewMemory, memoryKey, next);
@@ -3087,18 +3180,28 @@ function SupercodeMessenger({ state: stateInput, adapter, class: className = "",
3087
3180
  setOpening(row);
3088
3181
  adapter.onIntent({ action: "attach", key: row.key });
3089
3182
  };
3183
+ const openSubagents = (row) => {
3184
+ setListFocus(row.key);
3185
+ setInspecting(row);
3186
+ adapter.onIntent({ action: "openSubagents", key: row.key });
3187
+ };
3090
3188
  const close = () => adapter.onClose?.();
3091
3189
  const Footer = slots.footer;
3092
3190
  const HeaderActions = slots.headerActions;
3093
- return /* @__PURE__ */ jsxs8("main", { className: `scui-root ${className}`, "data-view": view, "data-mode": state.mode, "aria-label": "Supercode messenger", children: [
3094
- view === "list" ? /* @__PURE__ */ jsx9(SessionList, { state, adapter, focusKey: listFocus, onOpen: open, onNew: () => {
3191
+ const inspectorParent = inspecting ?? (state.subagentInspector ? state.sessions.find((row) => row.key === state.subagentInspector.parentKey) ?? { key: state.subagentInspector.parentKey, title: state.subagentInspector.parentTitle } : null);
3192
+ const inspectorState = inspectorParent ? {
3193
+ ...state,
3194
+ subagentInspector: state.subagentInspector?.parentKey === inspectorParent.key ? state.subagentInspector : { parentKey: inspectorParent.key, parentTitle: sessionDisplayName(inspectorParent), status: "loading", items: [], selectedKey: null, transcript: [], error: null }
3195
+ } : null;
3196
+ return /* @__PURE__ */ jsxs9("main", { className: `scui-root ${className}`, "data-view": view, "data-mode": state.mode, "aria-label": "Supercode messenger", children: [
3197
+ view === "list" ? /* @__PURE__ */ jsx10(SessionList, { state, adapter, focusKey: listFocus, onOpen: open, onOpenSubagents: openSubagents, onNew: () => {
3095
3198
  setListFocus("@new");
3096
3199
  setChatNavigation(null);
3097
3200
  setNewNavigation(null);
3098
3201
  setView("new");
3099
3202
  }, onClose: adapter.onClose ? close : void 0, components, labels: copy, memoryKey, slots, headerActions: HeaderActions }) : null,
3100
- view === "new" ? /* @__PURE__ */ jsx9(NewChat, { state, adapter, onBack: () => setView("list"), onClose: adapter.onClose ? close : void 0, onStarted: (mode) => setView(mode === "terminal" ? "list" : "chat"), labels: copy, memoryKey, headerActions: HeaderActions, contextCandidates, components, navigation: newNavigation, composerCommand }) : null,
3101
- view === "chat" ? /* @__PURE__ */ jsx9(Chat, { state, adapter, onBack: () => {
3203
+ view === "new" ? /* @__PURE__ */ jsx10(NewChat, { state, adapter, onBack: () => setView("list"), onClose: adapter.onClose ? close : void 0, onStarted: (mode) => setView(mode === "terminal" ? "list" : "chat"), labels: copy, memoryKey, headerActions: HeaderActions, contextCandidates, components, navigation: newNavigation, composerCommand }) : null,
3204
+ view === "chat" ? /* @__PURE__ */ jsx10(Chat, { state, adapter, onBack: () => {
3102
3205
  setListFocus(state.attached?.key ?? listFocus);
3103
3206
  setView("list");
3104
3207
  }, onNew: () => {
@@ -3107,18 +3210,19 @@ function SupercodeMessenger({ state: stateInput, adapter, class: className = "",
3107
3210
  setNewNavigation(null);
3108
3211
  setView("new");
3109
3212
  }, onClose: adapter.onClose ? close : void 0, components, slots, labels: copy, contextCandidates, navigation: chatNavigation?.sessionKey === state.attached?.key ? chatNavigation : null, composerCommand }) : null,
3110
- opening ? /* @__PURE__ */ jsxs8("div", { className: "scui-opening", role: "status", "aria-busy": "true", children: [
3111
- /* @__PURE__ */ jsx9(HarnessLogo, { id: opening.harness, size: 34 }),
3112
- /* @__PURE__ */ jsxs8("span", { children: [
3113
- /* @__PURE__ */ jsxs8("strong", { children: [
3213
+ opening ? /* @__PURE__ */ jsxs9("div", { className: "scui-opening", role: "status", "aria-busy": "true", children: [
3214
+ /* @__PURE__ */ jsx10(HarnessLogo, { id: opening.harness, size: 34 }),
3215
+ /* @__PURE__ */ jsxs9("span", { children: [
3216
+ /* @__PURE__ */ jsxs9("strong", { children: [
3114
3217
  "Opening ",
3115
3218
  sessionDisplayName(opening)
3116
3219
  ] }),
3117
- /* @__PURE__ */ jsx9("small", { children: "Loading the latest transcript window\u2026" })
3220
+ /* @__PURE__ */ jsx10("small", { children: "Loading the latest transcript window\u2026" })
3118
3221
  ] }),
3119
- /* @__PURE__ */ jsx9("i", {})
3222
+ /* @__PURE__ */ jsx10("i", {})
3120
3223
  ] }) : null,
3121
- Footer ? /* @__PURE__ */ jsx9(Footer, { state, adapter, value: copy }) : null
3224
+ inspectorState ? /* @__PURE__ */ jsx10(SubagentInspector, { state: inspectorState, adapter, onClose: () => setInspecting(null) }) : null,
3225
+ Footer ? /* @__PURE__ */ jsx10(Footer, { state, adapter, value: copy }) : null
3122
3226
  ] });
3123
3227
  }
3124
3228
  export {