farai 0.2.2 → 0.2.3

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/dist/cli/index.js CHANGED
@@ -7206,8 +7206,8 @@ var init_grep = __esm(() => {
7206
7206
  // src/version.ts
7207
7207
  import { readFileSync as readFileSync4 } from "fs";
7208
7208
  function resolveFaraiVersion() {
7209
- if ("0.2.2")
7210
- return "0.2.2";
7209
+ if ("0.2.3")
7210
+ return "0.2.3";
7211
7211
  try {
7212
7212
  const parsed = JSON.parse(readFileSync4(new URL("../package.json", import.meta.url), "utf8"));
7213
7213
  if (typeof parsed.version === "string" && parsed.version)
@@ -33884,6 +33884,54 @@ function mergeProps(...sources) {
33884
33884
  }
33885
33885
  return target;
33886
33886
  }
33887
+ function splitProps(props, ...keys) {
33888
+ const len = keys.length;
33889
+ if (SUPPORTS_PROXY && $PROXY in props) {
33890
+ const blocked = len > 1 ? keys.flat() : keys[0];
33891
+ const res = keys.map((k) => {
33892
+ return new Proxy({
33893
+ get(property) {
33894
+ return k.includes(property) ? props[property] : undefined;
33895
+ },
33896
+ has(property) {
33897
+ return k.includes(property) && property in props;
33898
+ },
33899
+ keys() {
33900
+ return k.filter((property) => (property in props));
33901
+ }
33902
+ }, propTraps);
33903
+ });
33904
+ res.push(new Proxy({
33905
+ get(property) {
33906
+ return blocked.includes(property) ? undefined : props[property];
33907
+ },
33908
+ has(property) {
33909
+ return blocked.includes(property) ? false : (property in props);
33910
+ },
33911
+ keys() {
33912
+ return Object.keys(props).filter((k) => !blocked.includes(k));
33913
+ }
33914
+ }, propTraps));
33915
+ return res;
33916
+ }
33917
+ const objects = [];
33918
+ for (let i = 0;i <= len; i++) {
33919
+ objects[i] = {};
33920
+ }
33921
+ for (const propName of Object.getOwnPropertyNames(props)) {
33922
+ let keyIndex = len;
33923
+ for (let i = 0;i < keys.length; i++) {
33924
+ if (keys[i].includes(propName)) {
33925
+ keyIndex = i;
33926
+ break;
33927
+ }
33928
+ }
33929
+ const desc = Object.getOwnPropertyDescriptor(props, propName);
33930
+ const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
33931
+ isDefaultDesc ? objects[keyIndex][propName] = desc.value : Object.defineProperty(objects[keyIndex], propName, desc);
33932
+ }
33933
+ return objects;
33934
+ }
33887
33935
  function For(props) {
33888
33936
  const fallback = "fallback" in props && {
33889
33937
  fallback: () => props.fallback
@@ -34378,6 +34426,26 @@ function _getParentNode(childNode) {
34378
34426
  }
34379
34427
  return parent;
34380
34428
  }
34429
+ function createDynamic(component, props) {
34430
+ const cached = createMemo(component);
34431
+ return createMemo(() => {
34432
+ const component2 = cached();
34433
+ switch (typeof component2) {
34434
+ case "function":
34435
+ return untrack(() => component2(props));
34436
+ case "string":
34437
+ const el = createElement(component2);
34438
+ spread(el, props);
34439
+ return el;
34440
+ default:
34441
+ break;
34442
+ }
34443
+ });
34444
+ }
34445
+ function Dynamic(props) {
34446
+ const [, others] = splitProps(props, ["component"]);
34447
+ return createDynamic(() => props.component, others);
34448
+ }
34381
34449
  function getLayoutNodeConstructor(parent) {
34382
34450
  const parentLayoutNode = parent?.getLayoutNode?.();
34383
34451
  return parentLayoutNode?.constructor;
@@ -39267,24 +39335,6 @@ function toolInputKind(_toolName, input) {
39267
39335
  return "write";
39268
39336
  return "json";
39269
39337
  }
39270
- function isWorkspaceExplorationTool(toolName) {
39271
- const definition = toolDefinition(toolName);
39272
- if (!definition || definition.mutates)
39273
- return false;
39274
- const action = toolActionKey(toolName);
39275
- if (action !== "read" && action !== "list" && action !== "grep" && action !== "search")
39276
- return false;
39277
- const props = schemaPropertyNames(definition);
39278
- return props.has("path") || props.has("pattern") || props.has("include");
39279
- }
39280
- function explorationVerb(toolName) {
39281
- const action = toolActionKey(toolName);
39282
- if (action === "list")
39283
- return "list";
39284
- if (action === "grep" || action === "search")
39285
- return "search";
39286
- return "read";
39287
- }
39288
39338
  function isActiveToolStatus(status2) {
39289
39339
  return status2 === "running" || status2 === "pending";
39290
39340
  }
@@ -39399,6 +39449,10 @@ function browserToolTitle(tool, input, active) {
39399
39449
  return;
39400
39450
  }
39401
39451
  function nativeToolTitle(tool, input, active) {
39452
+ if (tool === "callback_host_info")
39453
+ return active ? "inspecting host network" : "inspected host network";
39454
+ if (tool === "callback_oast")
39455
+ return active ? "starting oast session" : "started oast session";
39402
39456
  if (tool === "notebook_edit") {
39403
39457
  const operation = typeof input.operation === "string" ? input.operation : "edit";
39404
39458
  const path = typeof input.path === "string" ? ` in ${input.path}` : "";
@@ -39514,6 +39568,12 @@ var init_tool_presentation = __esm(() => {
39514
39568
  agent_followup: ["continued agent", "continuing agent"],
39515
39569
  agent_interrupt: ["interrupted agent", "interrupting agent"],
39516
39570
  agent_close: ["closed agent", "closing agent"],
39571
+ skill_load: ["loaded skill", "loading skill"],
39572
+ callback_host_info: ["inspected host network", "inspecting host network"],
39573
+ callback_listen: ["started callback listener", "starting callback listener"],
39574
+ callback_oast: ["started oast session", "starting oast session"],
39575
+ callback_stop: ["stopped callback listener", "stopping callback listener"],
39576
+ session_rename: ["renamed session", "renaming session"],
39517
39577
  request_user_input: ["asked user", "asking user"],
39518
39578
  internet_search: ["searched the web", "searching the web"],
39519
39579
  internet_fetch: ["fetched page", "fetching page"],
@@ -39582,6 +39642,487 @@ var init_tool_presentation = __esm(() => {
39582
39642
  };
39583
39643
  });
39584
39644
 
39645
+ // src/agent-tui/tool-renderers.ts
39646
+ function parseNmap(text) {
39647
+ const rows = [];
39648
+ for (const line of text.split(`
39649
+ `)) {
39650
+ const match = line.trim().match(/^(\d+)\/(tcp|udp)\s+(open|closed|filtered|open\|filtered)\s+(\S+)(?:\s+(.*))?$/i);
39651
+ if (!match)
39652
+ continue;
39653
+ rows.push({
39654
+ port: match[1],
39655
+ proto: match[2],
39656
+ state: match[3],
39657
+ service: match[4],
39658
+ version: match[5] ?? ""
39659
+ });
39660
+ }
39661
+ return rows;
39662
+ }
39663
+ function parseDirectoryResults(text) {
39664
+ try {
39665
+ const parsed = JSON.parse(text);
39666
+ return (parsed.results ?? []).map((item) => ({
39667
+ url: String(item.url ?? item.input ?? ""),
39668
+ status: Number(item.status ?? 0),
39669
+ size: Number(item.length ?? item.size ?? 0)
39670
+ })).filter((row) => row.url).sort((a, b) => a.status - b.status || b.size - a.size);
39671
+ } catch {
39672
+ return [];
39673
+ }
39674
+ }
39675
+ function splitHttpResponse2(text) {
39676
+ const normalized = text.replaceAll(`\r
39677
+ `, `
39678
+ `);
39679
+ const boundary = normalized.indexOf(`
39680
+
39681
+ `);
39682
+ if (boundary < 0 || !normalized.startsWith("HTTP/"))
39683
+ return {
39684
+ headers: "",
39685
+ body: text
39686
+ };
39687
+ const headers = normalized.slice(0, boundary);
39688
+ const status2 = headers.split(`
39689
+ `)[0];
39690
+ const contentTypeLine = headers.split(`
39691
+ `).find((line) => /^content-type:/i.test(line));
39692
+ const contentType = contentTypeLine?.slice(contentTypeLine.indexOf(":") + 1).trim();
39693
+ return {
39694
+ headers,
39695
+ body: normalized.slice(boundary + 2),
39696
+ ...status2 ? {
39697
+ status: status2
39698
+ } : {},
39699
+ ...contentType ? {
39700
+ contentType
39701
+ } : {}
39702
+ };
39703
+ }
39704
+ function unifiedEditDiff(path, oldText, newText) {
39705
+ const oldLines = oldText.split(`
39706
+ `);
39707
+ const newLines = newText.split(`
39708
+ `);
39709
+ return [`--- a/${path}`, `+++ b/${path}`, `@@ -1,${oldLines.length} +1,${newLines.length} @@`, ...oldLines.map((line) => `-${line}`), ...newLines.map((line) => `+${line}`)].join(`
39710
+ `);
39711
+ }
39712
+
39713
+ // src/agent-tui/tool-activity.ts
39714
+ function presentToolActivity(input) {
39715
+ const tool = canonicalToolName(input.tool) || "tool";
39716
+ const args = inputObject(input.args);
39717
+ const active = isActiveToolStatus(input.status);
39718
+ const text = active ? input.liveOutput ?? input.result ?? "" : input.result ?? input.fullResult ?? "";
39719
+ const metadata = input.toolResult?.metadata ?? {};
39720
+ const family = toolFamily(tool);
39721
+ const title = toolTitle(tool, args, input.status, 240);
39722
+ const warning = hasWarning(input.toolResult, text);
39723
+ const preview = toolPreview(tool, args, text, metadata, active);
39724
+ const outcome = toolOutcome(tool, args, text, metadata, input.toolResult, active);
39725
+ const grouping = activityGrouping(tool, family, args, metadata);
39726
+ const standalone = toolStandalone(tool, input, warning, family);
39727
+ return {
39728
+ family,
39729
+ title,
39730
+ compact: compactActivityLabel(tool, args, title),
39731
+ ...outcome ? {
39732
+ outcome
39733
+ } : {},
39734
+ preview,
39735
+ ...grouping ? grouping : {},
39736
+ standalone,
39737
+ warning
39738
+ };
39739
+ }
39740
+ function activityStatus(items) {
39741
+ if (items.some((item) => isActiveToolStatus(item.status)))
39742
+ return "running";
39743
+ if (items.some((item) => item.status === "error" || item.toolResult?.ok === false))
39744
+ return "error";
39745
+ return "done";
39746
+ }
39747
+ function activityDuration(items) {
39748
+ const values = items.flatMap((item) => typeof item.durationMs === "number" && Number.isFinite(item.durationMs) ? [item.durationMs] : []);
39749
+ return values.length === items.length && values.length > 0 ? values.reduce((total, value) => total + value, 0) : undefined;
39750
+ }
39751
+ function formatActivityDuration(durationMs) {
39752
+ if (durationMs === undefined || !Number.isFinite(durationMs) || durationMs < 0)
39753
+ return;
39754
+ if (durationMs < 1000)
39755
+ return `${Math.max(1, Math.round(durationMs))}ms`;
39756
+ if (durationMs < 60000) {
39757
+ const seconds2 = durationMs / 1000;
39758
+ return `${seconds2 < 10 ? seconds2.toFixed(1) : Math.round(seconds2)}s`;
39759
+ }
39760
+ const seconds = Math.round(durationMs / 1000);
39761
+ return `${Math.floor(seconds / 60)}m ${String(seconds % 60).padStart(2, "0")}s`;
39762
+ }
39763
+ function toolFamily(tool) {
39764
+ if (tool === "shell_exec" || tool === "session_poll" || tool === "session_stop")
39765
+ return "command";
39766
+ if (WORKSPACE_TOOLS.has(tool))
39767
+ return "workspace";
39768
+ if (tool === "browser_context" || BROWSER_TOOLS.has(tool))
39769
+ return "browser";
39770
+ if (HTTP_TOOLS.has(tool))
39771
+ return "http";
39772
+ if (tool.startsWith("proxy_"))
39773
+ return "proxy";
39774
+ if (RECON_TOOLS.has(tool))
39775
+ return "recon";
39776
+ if (tool.startsWith("knowledge_") || tool.startsWith("memory_") || tool.startsWith("notes_") || tool.startsWith("evidence_"))
39777
+ return "knowledge";
39778
+ if (tool.startsWith("campaign_") || tool.startsWith("report_"))
39779
+ return "campaign";
39780
+ if (tool.startsWith("agent_"))
39781
+ return "agent";
39782
+ if (tool.startsWith("mcp_"))
39783
+ return "mcp";
39784
+ if (tool === "image_view")
39785
+ return "media";
39786
+ return "generic";
39787
+ }
39788
+ function activityGrouping(tool, family, args, metadata) {
39789
+ if (tool === "shell_exec")
39790
+ return {
39791
+ groupKey: "command",
39792
+ groupPast: "ran",
39793
+ groupActive: "running"
39794
+ };
39795
+ if (family === "workspace")
39796
+ return {
39797
+ groupKey: "workspace",
39798
+ groupPast: "inspected",
39799
+ groupActive: "inspecting"
39800
+ };
39801
+ if (family === "browser" && tool !== "browser_context") {
39802
+ const context = stringValue(metadata.browserContextName) ?? stringValue(args.browser) ?? "default";
39803
+ return {
39804
+ groupKey: `browser:${context}`,
39805
+ groupPast: `browsed \xB7 ${context}`,
39806
+ groupActive: `browsing \xB7 ${context}`
39807
+ };
39808
+ }
39809
+ if (tool === "http_request") {
39810
+ const origin = urlOrigin(stringValue(args.url));
39811
+ return {
39812
+ groupKey: `http:${origin ?? "requests"}`,
39813
+ groupPast: origin ? `probed \xB7 ${origin}` : "probed endpoints",
39814
+ groupActive: origin ? `probing \xB7 ${origin}` : "probing endpoints"
39815
+ };
39816
+ }
39817
+ if (family === "proxy" && !toolDefinition(tool)?.mutates) {
39818
+ const host = stringValue(metadata.host) ?? stringValue(args.host) ?? stringValue(args.filter) ?? "traffic";
39819
+ return {
39820
+ groupKey: `proxy:${host}`,
39821
+ groupPast: `inspected proxy \xB7 ${host}`,
39822
+ groupActive: `inspecting proxy \xB7 ${host}`
39823
+ };
39824
+ }
39825
+ if (family === "knowledge" && !toolDefinition(tool)?.mutates)
39826
+ return {
39827
+ groupKey: "knowledge",
39828
+ groupPast: "queried knowledge",
39829
+ groupActive: "querying knowledge"
39830
+ };
39831
+ if (family === "mcp" && !toolDefinition(tool)?.mutates) {
39832
+ const server = stringValue(args.server) ?? "mcp";
39833
+ return {
39834
+ groupKey: `mcp:${server}`,
39835
+ groupPast: `queried ${server}`,
39836
+ groupActive: `querying ${server}`
39837
+ };
39838
+ }
39839
+ return;
39840
+ }
39841
+ function toolStandalone(tool, input, warning, family) {
39842
+ if (input.status === "error" || input.toolResult?.ok === false || input.status === "running_background")
39843
+ return true;
39844
+ if (input.toolResult?.attachments?.length || input.toolResult?.evidence?.length || input.toolResult?.outputArtifactId)
39845
+ return true;
39846
+ if (warning)
39847
+ return true;
39848
+ if (family === "recon" || family === "campaign" || family === "agent" || family === "media")
39849
+ return true;
39850
+ if (tool === "browser_context" || tool === "internet_search" || tool === "internet_fetch")
39851
+ return true;
39852
+ if (family === "browser")
39853
+ return false;
39854
+ const definition = toolDefinition(tool);
39855
+ return definition?.mutates === true && tool !== "shell_exec";
39856
+ }
39857
+ function compactActivityLabel(tool, args, title) {
39858
+ if (tool === "shell_exec")
39859
+ return (stringValue(args.command) ?? title).replace(/\s+/g, " ").trim();
39860
+ if (tool === "http_request") {
39861
+ const method = (stringValue(args.method) ?? "get").toLowerCase();
39862
+ return `${method} ${stringValue(args.url) ?? "request"}`;
39863
+ }
39864
+ if (tool === "browser_navigate")
39865
+ return `opened ${stringValue(args.url) ?? "page"}`;
39866
+ if (tool === "proxy_flow_get")
39867
+ return `flow ${stringValue(args.flowId) ?? "request"}`;
39868
+ return title;
39869
+ }
39870
+ function toolOutcome(tool, args, text, metadata, result, active) {
39871
+ if (active)
39872
+ return liveOutcome(text);
39873
+ if (result?.ok === false)
39874
+ return firstMeaningfulLine(text) ?? result.summary;
39875
+ if (tool === "port_scan" || tool === "nmap_scan" || tool === "shell_exec" && /^\s*(?:sudo\s+)?nmap\b/i.test(stringValue(args.command) ?? "")) {
39876
+ const ports = parseNmap(text);
39877
+ if (ports.length > 0)
39878
+ return ports.slice(0, 6).map((row) => `${row.port}/${row.service}`).join(", ") + (ports.length > 6 ? ` \xB7 +${ports.length - 6}` : "");
39879
+ const discovered = arrayValue(metadata.discoveredPorts);
39880
+ if (discovered.length > 0)
39881
+ return `${discovered.length} open port${discovered.length === 1 ? "" : "s"}`;
39882
+ }
39883
+ if (tool === "subdomain_enum") {
39884
+ const names = arrayValue(metadata.discoveredSubdomains);
39885
+ const sources = arrayValue(metadata.sources);
39886
+ const warnings = sources.filter((value) => objectValue(value)?.status !== "ok").length;
39887
+ return `${names.length} subdomain${names.length === 1 ? "" : "s"}${warnings ? ` \xB7 ${warnings} source warning${warnings === 1 ? "" : "s"}` : ""}`;
39888
+ }
39889
+ if (tool === "dir_enum") {
39890
+ const dirs = parseDirectoryResults(text);
39891
+ if (dirs.length > 0)
39892
+ return `${dirs.length} path${dirs.length === 1 ? "" : "s"}`;
39893
+ const summarized = text.split(`
39894
+ `).filter((line) => /^\d{3}\s+https?:\/\//.test(line.trim()));
39895
+ if (summarized.length > 0)
39896
+ return `${summarized.length} path${summarized.length === 1 ? "" : "s"}`;
39897
+ }
39898
+ if (tool === "http_request") {
39899
+ const http = splitHttpResponse2(text);
39900
+ if (http.status)
39901
+ return http.status.replace(/^HTTP\/\S+\s+/, "").toLowerCase();
39902
+ }
39903
+ if (tool === "internet_search") {
39904
+ const results = arrayValue(metadata.results);
39905
+ const provider = stringValue(metadata.provider);
39906
+ return `${results.length} result${results.length === 1 ? "" : "s"}${provider ? ` \xB7 ${provider}` : ""}`;
39907
+ }
39908
+ if (tool === "internet_fetch") {
39909
+ const contentType = stringValue(metadata.contentType)?.split(";", 1)[0];
39910
+ const bytes = numberValue(metadata.bytes);
39911
+ return [contentType, bytes !== undefined ? formatBytes(bytes) : undefined].filter(Boolean).join(" \xB7 ") || result?.summary;
39912
+ }
39913
+ if (tool === "browser_context") {
39914
+ const action = stringValue(metadata.browserContextAction) ?? stringValue(args.action);
39915
+ if (action === "list")
39916
+ return `${arrayValue(metadata.browserContexts).length} browser context${arrayValue(metadata.browserContexts).length === 1 ? "" : "s"}`;
39917
+ return stringValue(metadata.browserContextName) ?? result?.summary;
39918
+ }
39919
+ if (tool === "fs_read")
39920
+ return cleanSummary(result?.summary) ?? `${semanticLines(text, Number.MAX_SAFE_INTEGER).length} lines`;
39921
+ if (tool === "fs_list") {
39922
+ const count2 = semanticLines(text, Number.MAX_SAFE_INTEGER).length;
39923
+ return `${count2} ${count2 === 1 ? "entry" : "entries"}`;
39924
+ }
39925
+ if (tool === "fs_grep") {
39926
+ const count2 = semanticLines(text, Number.MAX_SAFE_INTEGER).filter((line) => line !== "No matches").length;
39927
+ return `${count2} match${count2 === 1 ? "" : "es"}`;
39928
+ }
39929
+ if (tool === "git_status") {
39930
+ const count2 = semanticLines(text, Number.MAX_SAFE_INTEGER).filter((line) => !/^on branch\b|^your branch\b|^nothing to commit/i.test(line)).length;
39931
+ return count2 ? `${count2} changed line${count2 === 1 ? "" : "s"}` : "clean";
39932
+ }
39933
+ if (tool === "git_diff") {
39934
+ const lines = text.split(`
39935
+ `);
39936
+ const added = lines.filter((line) => line.startsWith("+") && !line.startsWith("+++")).length;
39937
+ const removed = lines.filter((line) => line.startsWith("-") && !line.startsWith("---")).length;
39938
+ return added || removed ? `+${added} \u2212${removed}` : "no diff";
39939
+ }
39940
+ if (tool.startsWith("browser_"))
39941
+ return browserOutcome(text, metadata) ?? cleanSummary(result?.summary);
39942
+ if (tool.startsWith("proxy_"))
39943
+ return proxyOutcome(metadata, result?.summary, text);
39944
+ if (tool === "image_view")
39945
+ return result?.summary?.replace(/^image\s+/i, "") ?? firstMeaningfulLine(text);
39946
+ if (tool === "shell_exec") {
39947
+ const first = firstMeaningfulLine(text);
39948
+ if (first)
39949
+ return first;
39950
+ const exit = result?.summary?.match(/\bexit=(\d+)/)?.[1];
39951
+ return exit ? `exit ${exit}` : cleanSummary(result?.summary);
39952
+ }
39953
+ return cleanSummary(result?.summary) ?? firstMeaningfulLine(text);
39954
+ }
39955
+ function toolPreview(tool, args, text, metadata, active) {
39956
+ if (!text && !Object.keys(metadata).length)
39957
+ return [];
39958
+ if (tool === "port_scan" || tool === "nmap_scan" || tool === "shell_exec" && /^\s*(?:sudo\s+)?nmap\b/i.test(stringValue(args.command) ?? "")) {
39959
+ const rows = parseNmap(text);
39960
+ if (rows.length > 0)
39961
+ return withMore(rows.slice(0, 5).map((row) => `${row.port}/${row.proto} ${row.service}${row.version ? ` ${row.version}` : ""}`), rows.length, 5);
39962
+ }
39963
+ if (tool === "subdomain_enum") {
39964
+ const names = arrayValue(metadata.discoveredSubdomains).map(String);
39965
+ const errors = arrayValue(metadata.sources).flatMap((value) => {
39966
+ const source = objectValue(value);
39967
+ return source && source.status !== "ok" ? [`warning: ${String(source.source ?? "source")} ${String(source.error ?? source.status)}`] : [];
39968
+ });
39969
+ return [...withMore(names.slice(0, 4), names.length, 4), ...errors.slice(0, 2)];
39970
+ }
39971
+ if (tool === "dir_enum") {
39972
+ const rows = parseDirectoryResults(text);
39973
+ if (rows.length > 0)
39974
+ return withMore(rows.slice(0, 5).map((row) => `${row.status} ${row.url}`), rows.length, 5);
39975
+ }
39976
+ if (tool === "internet_search") {
39977
+ const results = arrayValue(metadata.results);
39978
+ const lines = results.slice(0, 5).flatMap((value) => {
39979
+ const result = objectValue(value);
39980
+ return result ? [`${String(result.title ?? result.url ?? "result")} \xB7 ${hostFromUrl(stringValue(result.url)) ?? String(result.source ?? "web")}`] : [];
39981
+ });
39982
+ return withMore(lines, results.length, 5);
39983
+ }
39984
+ if (tool === "browser_context")
39985
+ return browserContextPreview(metadata);
39986
+ if (tool.startsWith("proxy_")) {
39987
+ const flow = proxyOutcome(metadata, undefined, text);
39988
+ if (flow)
39989
+ return [flow, ...semanticLines(text, 3).filter((line) => line !== flow)];
39990
+ }
39991
+ if (active)
39992
+ return boundedTailLines(text, 4);
39993
+ return boundedPreviewLines(text, 5);
39994
+ }
39995
+ function browserOutcome(text, metadata) {
39996
+ const url = text.match(/(?:final url|page url):\s*(\S+)/i)?.[1];
39997
+ const title = text.match(/(?:page title|title):\s*(.+)/i)?.[1]?.trim();
39998
+ const warning = metadata.exactProtocolVerificationRequired === true ? "protocol warning" : undefined;
39999
+ return [title ?? url, warning].filter(Boolean).join(" \xB7 ") || undefined;
40000
+ }
40001
+ function browserContextPreview(metadata) {
40002
+ const contexts = arrayValue(metadata.browserContexts);
40003
+ if (contexts.length > 0)
40004
+ return withMore(contexts.slice(0, 6).flatMap((value) => {
40005
+ const context2 = objectValue(value);
40006
+ if (!context2)
40007
+ return [];
40008
+ return [`${String(context2.name ?? "browser")} \xB7 ${String(context2.status ?? "ready")}`];
40009
+ }), contexts.length, 6);
40010
+ const context = objectValue(metadata.browserContext);
40011
+ if (!context)
40012
+ return [];
40013
+ return [`${String(context.name ?? "browser")} \xB7 isolated context`];
40014
+ }
40015
+ function proxyOutcome(metadata, summary2, text) {
40016
+ const method = stringValue(metadata.method)?.toLowerCase();
40017
+ const path = stringValue(metadata.path);
40018
+ const status2 = numberValue(metadata.status);
40019
+ if (method || path || status2 !== undefined)
40020
+ return `${method ?? "request"} ${path ?? ""}${status2 !== undefined ? ` \u2192 ${status2}` : ""}`.trim();
40021
+ const count2 = numberValue(metadata.count);
40022
+ if (count2 !== undefined)
40023
+ return `${count2} captured flow${count2 === 1 ? "" : "s"}`;
40024
+ return cleanSummary(summary2) ?? firstMeaningfulLine(text);
40025
+ }
40026
+ function hasWarning(result, text) {
40027
+ if (!result)
40028
+ return false;
40029
+ if (result.metadata?.exactProtocolVerificationRequired === true || result.metadata?.snapshotError)
40030
+ return true;
40031
+ if (arrayValue(result.metadata?.failures).length > 0)
40032
+ return true;
40033
+ if (arrayValue(result.metadata?.sources).some((value) => objectValue(value)?.status !== "ok"))
40034
+ return true;
40035
+ return /^(?:warning|source error):/im.test(text);
40036
+ }
40037
+ function liveOutcome(text) {
40038
+ const lines = tailSemanticLines(text, 1);
40039
+ return lines[0];
40040
+ }
40041
+ function semanticLines(text, limit) {
40042
+ return text.split(`
40043
+ `).map((line) => line.trimEnd()).filter((line) => line.trim().length > 0).slice(0, limit);
40044
+ }
40045
+ function tailSemanticLines(text, limit) {
40046
+ return text.split(`
40047
+ `).map((line) => line.trimEnd()).filter((line) => line.trim().length > 0).slice(-limit);
40048
+ }
40049
+ function boundedPreviewLines(text, limit) {
40050
+ const lines = semanticLines(text, Number.MAX_SAFE_INTEGER);
40051
+ if (lines.length <= limit)
40052
+ return lines;
40053
+ const head = Math.max(1, Math.floor(limit / 2));
40054
+ const tail = Math.max(1, limit - head - 1);
40055
+ return [...lines.slice(0, head), `\u2026 +${lines.length - head - tail} lines`, ...lines.slice(-tail)];
40056
+ }
40057
+ function boundedTailLines(text, limit) {
40058
+ const lines = semanticLines(text, Number.MAX_SAFE_INTEGER);
40059
+ if (lines.length <= limit)
40060
+ return lines;
40061
+ return [`\u2026 ${lines.length - limit} earlier lines`, ...lines.slice(-limit)];
40062
+ }
40063
+ function withMore(lines, total, shown) {
40064
+ return total > shown ? [...lines, `\u2026 +${total - shown} more`] : lines;
40065
+ }
40066
+ function firstMeaningfulLine(text) {
40067
+ return semanticLines(text, 1)[0];
40068
+ }
40069
+ function cleanSummary(summary2) {
40070
+ if (!summary2?.trim())
40071
+ return;
40072
+ if (/^(?:exit=\d+\s+)?duration=\d+ms(?:\s+timedOut=\w+)?$/i.test(summary2.trim()))
40073
+ return;
40074
+ return summary2.trim().replace(/\bprocessId=[^\s]+/g, "").replace(/\bjobId=[^\s]+/g, "").replace(/\s+/g, " ").trim();
40075
+ }
40076
+ function inputObject(value) {
40077
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
40078
+ }
40079
+ function objectValue(value) {
40080
+ return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
40081
+ }
40082
+ function arrayValue(value) {
40083
+ return Array.isArray(value) ? value : [];
40084
+ }
40085
+ function stringValue(value) {
40086
+ return typeof value === "string" && value.trim() ? value.trim() : undefined;
40087
+ }
40088
+ function numberValue(value) {
40089
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined;
40090
+ }
40091
+ function urlOrigin(value) {
40092
+ if (!value)
40093
+ return;
40094
+ try {
40095
+ return new URL(value).host;
40096
+ } catch {
40097
+ return;
40098
+ }
40099
+ }
40100
+ function hostFromUrl(value) {
40101
+ if (!value)
40102
+ return;
40103
+ try {
40104
+ return new URL(value).hostname;
40105
+ } catch {
40106
+ return;
40107
+ }
40108
+ }
40109
+ function formatBytes(bytes) {
40110
+ if (bytes < 1024)
40111
+ return `${bytes} b`;
40112
+ if (bytes < 1024 * 1024)
40113
+ return `${(bytes / 1024).toFixed(bytes < 10 * 1024 ? 1 : 0)} kb`;
40114
+ return `${(bytes / (1024 * 1024)).toFixed(1)} mb`;
40115
+ }
40116
+ var BROWSER_TOOLS, WORKSPACE_TOOLS, RECON_TOOLS, HTTP_TOOLS;
40117
+ var init_tool_activity = __esm(() => {
40118
+ init_tool_names();
40119
+ init_tool_presentation();
40120
+ BROWSER_TOOLS = new Set(["browser_navigate", "browser_snapshot", "browser_find", "browser_click", "browser_fill_form", "browser_type", "browser_press_key", "browser_wait_for", "browser_tabs", "browser_network_requests", "browser_network_request"]);
40121
+ WORKSPACE_TOOLS = new Set(["fs_read", "fs_list", "fs_grep", "fs_write", "fs_edit", "patch_apply", "notebook_edit", "git_status", "git_diff", "lsp_inspect", "tool_output_read", "code_write_script"]);
40122
+ RECON_TOOLS = new Set(["port_scan", "nmap_scan", "subdomain_enum", "dir_enum", "exploit_search", "kali_tool_search"]);
40123
+ HTTP_TOOLS = new Set(["http_request", "internet_search", "internet_fetch"]);
40124
+ });
40125
+
39585
40126
  // src/agent-tui/renderers.ts
39586
40127
  function truncateLine2(line, maxWidth) {
39587
40128
  return truncateTerminal(line, Math.max(maxWidth, 1));
@@ -39789,17 +40330,65 @@ function projectMessagesToRows(messages, width = DEFAULT_WIDTH, runningTurnId, l
39789
40330
  continue;
39790
40331
  const tool = preview.tool || "tool";
39791
40332
  const args = previewArguments(preview.rawArguments);
39792
- rows.push({
40333
+ const row = {
39793
40334
  kind: "tool",
39794
40335
  tool,
39795
40336
  args,
39796
40337
  argsSummary: summarizeToolArgs(tool, args, 80),
39797
40338
  status: "pending",
39798
40339
  toolCallId: preview.providerToolCallId,
39799
- id: preview.providerToolCallId ? toolTimelineRowId(preview.turnId, preview.providerToolCallId) : preview.id
39800
- });
40340
+ id: preview.providerToolCallId ? toolTimelineRowId(preview.turnId, preview.providerToolCallId) : preview.id,
40341
+ presentation: presentToolActivity({
40342
+ tool,
40343
+ args,
40344
+ status: "pending"
40345
+ })
40346
+ };
40347
+ rows.push(row);
39801
40348
  }
39802
- return groupExplorationRows(rows);
40349
+ return groupActivityRows(rows);
40350
+ }
40351
+ function reconcileTimelineRows(rows) {
40352
+ const jobs = new Map;
40353
+ const processes = new Map;
40354
+ for (let index = 0;index < rows.length; index += 1) {
40355
+ const row = rows[index];
40356
+ if (row.kind !== "tool")
40357
+ continue;
40358
+ if (row.jobId)
40359
+ jobs.set(row.jobId, index);
40360
+ if (row.processId)
40361
+ processes.set(row.processId, index);
40362
+ }
40363
+ const suppressed = new Set;
40364
+ const replacements = new Map;
40365
+ for (let index = 0;index < rows.length; index += 1) {
40366
+ const row = rows[index];
40367
+ if (row.kind !== "artifact")
40368
+ continue;
40369
+ const completion = row[BACKGROUND_COMPLETION];
40370
+ if (!completion)
40371
+ continue;
40372
+ const targetIndex = completion.jobId ? jobs.get(completion.jobId) : completion.processId ? processes.get(completion.processId) : undefined;
40373
+ if (targetIndex === undefined)
40374
+ continue;
40375
+ const target = replacements.get(targetIndex) ?? rows[targetIndex];
40376
+ if (target.kind !== "tool")
40377
+ continue;
40378
+ const status2 = completion.status === "succeeded" ? "done" : "error";
40379
+ const updated = {
40380
+ ...target,
40381
+ status: status2,
40382
+ result: row.body ?? row.detail,
40383
+ fullResult: row.body ?? row.detail
40384
+ };
40385
+ updated.presentation = presentToolActivity(updated);
40386
+ replacements.set(targetIndex, updated);
40387
+ suppressed.add(index);
40388
+ }
40389
+ if (suppressed.size === 0)
40390
+ return rows;
40391
+ return rows.flatMap((row, index) => suppressed.has(index) ? [] : [replacements.get(index) ?? row]);
39803
40392
  }
39804
40393
  function hoistLateThinking(rows, start) {
39805
40394
  const messageRows = rows.slice(start);
@@ -39916,7 +40505,18 @@ function partToRow(message, part, width, streaming, toolRows, latestToolRecords,
39916
40505
  jobId
39917
40506
  } : {},
39918
40507
  toolCallId,
39919
- id: providerToolCallId ? toolTimelineRowId(message.turnId, providerToolCallId) : part.id
40508
+ id: providerToolCallId ? toolTimelineRowId(message.turnId, providerToolCallId) : part.id,
40509
+ ...part.createdAt ? {
40510
+ startedAt: part.createdAt
40511
+ } : {},
40512
+ presentation: presentToolActivity({
40513
+ tool,
40514
+ args,
40515
+ status: status2,
40516
+ ...liveOutput ? {
40517
+ liveOutput
40518
+ } : {}
40519
+ })
39920
40520
  };
39921
40521
  if (toolCallId)
39922
40522
  toolRows.set(toolCallId, row);
@@ -39943,12 +40543,22 @@ function partToRow(message, part, width, streaming, toolRows, latestToolRecords,
39943
40543
  linked.mcp = mcp2;
39944
40544
  if (toolResult?.processId)
39945
40545
  linked.processId = toolResult.processId;
39946
- if (linked.status === "pending" || linked.status === "running")
40546
+ if (toolResult?.jobId)
40547
+ linked.jobId = toolResult.jobId;
40548
+ if (toolResult?.status)
40549
+ linked.status = toolResult.status;
40550
+ else if (toolResult?.ok === false)
40551
+ linked.status = "error";
40552
+ else if (linked.status === "pending" || linked.status === "running")
39947
40553
  linked.status = "done";
40554
+ const durationMs = elapsedMs(linked.startedAt, part.createdAt);
40555
+ if (durationMs !== undefined)
40556
+ linked.durationMs = durationMs;
40557
+ linked.presentation = presentToolActivity(linked);
39948
40558
  return null;
39949
40559
  }
39950
40560
  const mcp = mcpToolRowData(toolResult);
39951
- return {
40561
+ const row = {
39952
40562
  kind: "tool",
39953
40563
  tool: extractField(part.payload, "tool") ?? "tool",
39954
40564
  args: undefined,
@@ -39968,8 +40578,21 @@ function partToRow(message, part, width, streaming, toolRows, latestToolRecords,
39968
40578
  toolResult
39969
40579
  } : {},
39970
40580
  toolCallId,
39971
- id: part.id
40581
+ id: part.id,
40582
+ presentation: presentToolActivity({
40583
+ tool: extractField(part.payload, "tool") ?? "tool",
40584
+ args: undefined,
40585
+ status: "done",
40586
+ result: truncatePayload(display, width * 4),
40587
+ ...fullResult !== undefined ? {
40588
+ fullResult
40589
+ } : {},
40590
+ ...toolResult ? {
40591
+ toolResult
40592
+ } : {}
40593
+ })
39972
40594
  };
40595
+ return row;
39973
40596
  }
39974
40597
  case "planner_attempt":
39975
40598
  case "provider_context":
@@ -39977,7 +40600,39 @@ function partToRow(message, part, width, streaming, toolRows, latestToolRecords,
39977
40600
  return null;
39978
40601
  case "tool_started":
39979
40602
  return null;
39980
- case "tool_progress":
40603
+ case "tool_progress": {
40604
+ const toolCallId = extractField(part.payload, "toolCallId");
40605
+ const linked = toolCallId ? toolRows.get(toolCallId) : undefined;
40606
+ if (linked) {
40607
+ const artifactId = extractField(part.payload, "artifactId");
40608
+ const path = extractField(part.payload, "path");
40609
+ const bytes = field(part.payload, "bytes");
40610
+ linked.toolResult = {
40611
+ ...linked.toolResult ?? {
40612
+ ok: true,
40613
+ summary: linked.result ?? "tool output saved"
40614
+ },
40615
+ ...artifactId ? {
40616
+ outputArtifactId: artifactId
40617
+ } : {},
40618
+ metadata: {
40619
+ ...linked.toolResult?.metadata ?? {},
40620
+ outputArtifact: {
40621
+ ...artifactId ? {
40622
+ id: artifactId
40623
+ } : {},
40624
+ ...path ? {
40625
+ path
40626
+ } : {},
40627
+ ...typeof bytes === "number" ? {
40628
+ bytes
40629
+ } : {}
40630
+ }
40631
+ }
40632
+ };
40633
+ linked.presentation = presentToolActivity(linked);
40634
+ return null;
40635
+ }
39981
40636
  return {
39982
40637
  kind: "progress",
39983
40638
  title: "tool progress",
@@ -39985,6 +40640,7 @@ function partToRow(message, part, width, streaming, toolRows, latestToolRecords,
39985
40640
  status: progressStatus(part.payload),
39986
40641
  id: part.id
39987
40642
  };
40643
+ }
39988
40644
  case "phase_change":
39989
40645
  return {
39990
40646
  kind: "phase",
@@ -39997,6 +40653,18 @@ function partToRow(message, part, width, streaming, toolRows, latestToolRecords,
39997
40653
  return planRow(part, width, streaming);
39998
40654
  if (extractField(part.payload, "kind") === "mcp_inventory")
39999
40655
  return mcpInventoryRow(part, width);
40656
+ if (extractField(part.payload, "kind") === "background_job_completion") {
40657
+ const linked = backgroundCompletionToolRow(part.payload, toolRows);
40658
+ if (linked) {
40659
+ const status2 = extractField(part.payload, "status");
40660
+ const summary2 = extractField(part.payload, "summary") ?? "background job completed";
40661
+ linked.status = status2 === "succeeded" ? "done" : "error";
40662
+ linked.result = summary2;
40663
+ linked.fullResult = summary2;
40664
+ linked.presentation = presentToolActivity(linked);
40665
+ return null;
40666
+ }
40667
+ }
40000
40668
  return artifactRow(part, width);
40001
40669
  case "finding":
40002
40670
  return findingRow(part, width);
@@ -40014,6 +40682,26 @@ function partToRow(message, part, width, streaming, toolRows, latestToolRecords,
40014
40682
  id: part.id
40015
40683
  };
40016
40684
  case "error":
40685
+ {
40686
+ const toolCallId = extractField(part.payload, "toolCallId");
40687
+ const linked = toolCallId ? toolRows.get(toolCallId) : undefined;
40688
+ if (linked) {
40689
+ const error = extractField(part.payload, "error") ?? extractField(part.payload, "message") ?? extractField(part.payload, "text") ?? "tool failed";
40690
+ linked.status = "error";
40691
+ linked.result = error;
40692
+ linked.fullResult = error;
40693
+ linked.toolResult = {
40694
+ ok: false,
40695
+ summary: error,
40696
+ output: error
40697
+ };
40698
+ const durationMs = elapsedMs(linked.startedAt, part.createdAt);
40699
+ if (durationMs !== undefined)
40700
+ linked.durationMs = durationMs;
40701
+ linked.presentation = presentToolActivity(linked);
40702
+ return null;
40703
+ }
40704
+ }
40017
40705
  return errorRow(part, width);
40018
40706
  case "planner_error":
40019
40707
  return part.payload?.retrying === true ? null : errorRow(part, width);
@@ -40112,7 +40800,22 @@ function toolTimelineRowId(turnId, providerToolCallId) {
40112
40800
  function providerToolCallKey(turnId, providerToolCallId) {
40113
40801
  return `${turnId}\x00${providerToolCallId}`;
40114
40802
  }
40115
- function groupExplorationRows(rows) {
40803
+ function elapsedMs(startedAt, finishedAt) {
40804
+ if (!startedAt || !finishedAt)
40805
+ return;
40806
+ const started = Date.parse(startedAt);
40807
+ const finished = Date.parse(finishedAt);
40808
+ if (!Number.isFinite(started) || !Number.isFinite(finished) || finished < started)
40809
+ return;
40810
+ return finished - started;
40811
+ }
40812
+ function backgroundCompletionToolRow(payload, toolRows) {
40813
+ const jobId = extractField(payload, "jobId");
40814
+ const processId = extractField(payload, "processId");
40815
+ const candidates = [...toolRows.values()].reverse();
40816
+ return candidates.find((row) => jobId && row.jobId === jobId || processId && row.processId === processId);
40817
+ }
40818
+ function groupActivityRows(rows) {
40116
40819
  const grouped = [];
40117
40820
  let pending = [];
40118
40821
  let activeTodoRow;
@@ -40122,7 +40825,7 @@ function groupExplorationRows(rows) {
40122
40825
  if (pending.length === 1)
40123
40826
  grouped.push(pending[0]);
40124
40827
  else
40125
- grouped.push(toExplorationRow(pending));
40828
+ grouped.push(toActivityRow(pending));
40126
40829
  pending = [];
40127
40830
  };
40128
40831
  for (const row of rows) {
@@ -40133,8 +40836,12 @@ function groupExplorationRows(rows) {
40133
40836
  activeTodoRow = appendTodoRow(grouped, row, activeTodoRow);
40134
40837
  continue;
40135
40838
  }
40136
- if (row.kind === "tool" && isExplorationTool(row.tool)) {
40839
+ if (row.kind === "tool" && canGroupToolRow(row)) {
40840
+ if (pending.length > 0 && !canJoinActivity(pending[0], row))
40841
+ flush();
40137
40842
  pending.push(row);
40843
+ if (pending.length >= 8)
40844
+ flush();
40138
40845
  continue;
40139
40846
  }
40140
40847
  flush();
@@ -40143,6 +40850,33 @@ function groupExplorationRows(rows) {
40143
40850
  flush();
40144
40851
  return grouped;
40145
40852
  }
40853
+ function canGroupToolRow(row) {
40854
+ return Boolean(row.presentation.groupKey) && !row.presentation.standalone;
40855
+ }
40856
+ function canJoinActivity(first, next) {
40857
+ return first.presentation.groupKey === next.presentation.groupKey;
40858
+ }
40859
+ function toActivityRow(rows) {
40860
+ const status2 = activityStatus(rows);
40861
+ const durationMs = activityDuration(rows);
40862
+ return {
40863
+ kind: "activity",
40864
+ status: status2,
40865
+ label: activityLabel(rows[0], rows.length, status2 === "running"),
40866
+ items: rows,
40867
+ ...durationMs !== undefined ? {
40868
+ durationMs
40869
+ } : {},
40870
+ id: rows[0].id
40871
+ };
40872
+ }
40873
+ function activityLabel(first, count2, active) {
40874
+ const presentation = first.presentation;
40875
+ const verb = active ? presentation.groupActive ?? "running" : presentation.groupPast ?? "ran";
40876
+ const [action = verb, qualifier] = verb.split(" \xB7 ", 2);
40877
+ const noun = presentation.family === "command" ? "command" : presentation.family === "workspace" ? "workspace item" : presentation.family === "browser" ? "browser action" : presentation.family === "http" ? "endpoint" : presentation.family === "proxy" ? "proxy action" : presentation.family === "knowledge" ? "knowledge source" : presentation.family === "mcp" ? "mcp call" : "operation";
40878
+ return `${action} ${count2} ${noun}${count2 === 1 ? "" : "s"}${qualifier ? ` \xB7 ${qualifier}` : ""}`;
40879
+ }
40146
40880
  function appendTodoRow(rows, row, current) {
40147
40881
  const items = todoItemsFromToolRow(row);
40148
40882
  if (items.length === 0) {
@@ -40173,36 +40907,6 @@ function upsertTodoItem(items, next) {
40173
40907
  else
40174
40908
  items.push(next);
40175
40909
  }
40176
- function toExplorationRow(rows) {
40177
- return {
40178
- kind: "exploration",
40179
- status: explorationStatus(rows),
40180
- id: rows.map((row) => row.id).join(":"),
40181
- items: rows.map((row) => ({
40182
- tool: row.tool,
40183
- verb: explorationVerb(row.tool),
40184
- target: summarizeToolArgs(row.tool, row.args, 120) || shortToolName(row.tool),
40185
- status: row.status,
40186
- ...row.result ? {
40187
- result: firstResultLine(row.result, 120)
40188
- } : {},
40189
- ...row.fullResult || row.result ? {
40190
- fullResult: row.fullResult ?? row.result
40191
- } : {},
40192
- toolCallId: row.toolCallId
40193
- }))
40194
- };
40195
- }
40196
- function explorationStatus(rows) {
40197
- if (rows.some((row) => row.status === "running" || row.status === "pending"))
40198
- return "running";
40199
- if (rows.some((row) => row.status === "failed" || row.status === "error"))
40200
- return "failed";
40201
- return "done";
40202
- }
40203
- function isExplorationTool(tool) {
40204
- return isWorkspaceExplorationTool(tool);
40205
- }
40206
40910
  function isTodoTool(tool) {
40207
40911
  return tool === "todo_add" || tool === "todo_update" || tool === "todo_list";
40208
40912
  }
@@ -40413,7 +41117,9 @@ function artifactRow(part, width) {
40413
41117
  };
40414
41118
  }
40415
41119
  const summary2 = extractField(payload, "summary") ?? "background job completed.";
40416
- return {
41120
+ const jobId = extractField(payload, "jobId");
41121
+ const processId = extractField(payload, "processId");
41122
+ const row = {
40417
41123
  kind: "artifact",
40418
41124
  title: status2 === "succeeded" ? "background job completed" : `background job ${status2}`,
40419
41125
  detail: truncateLine2(singleLine(summary2), width),
@@ -40421,6 +41127,19 @@ function artifactRow(part, width) {
40421
41127
  bodyFormat: "text",
40422
41128
  id: part.id
40423
41129
  };
41130
+ Object.defineProperty(row, BACKGROUND_COMPLETION, {
41131
+ value: {
41132
+ ...jobId ? {
41133
+ jobId
41134
+ } : {},
41135
+ ...processId ? {
41136
+ processId
41137
+ } : {},
41138
+ status: status2
41139
+ },
41140
+ enumerable: false
41141
+ });
41142
+ return row;
40424
41143
  }
40425
41144
  const note = extractObject(payload, "note");
40426
41145
  const artifact = extractObject(payload, "artifact") ?? extractObject(payload, "outputArtifact");
@@ -40536,13 +41255,15 @@ ${value.trim()}` : undefined;
40536
41255
  function summarizeToolArgs(tool, args, max = 80) {
40537
41256
  return summarizeToolInput(tool, args, max);
40538
41257
  }
40539
- var MAX_PAYLOAD_BYTES = 200000, HEAD_BUDGET = 4096, TAIL_BUDGET = 1024, TOOL_DETAIL_MAX_BYTES, DEFAULT_WIDTH = 120;
41258
+ var MAX_PAYLOAD_BYTES = 200000, HEAD_BUDGET = 4096, TAIL_BUDGET = 1024, TOOL_DETAIL_MAX_BYTES, BACKGROUND_COMPLETION, DEFAULT_WIDTH = 120;
40540
41259
  var init_renderers2 = __esm(() => {
40541
41260
  init_reasoning();
40542
41261
  init_reasoning_summary();
40543
41262
  init_tool_presentation();
40544
41263
  init_terminal_text();
41264
+ init_tool_activity();
40545
41265
  TOOL_DETAIL_MAX_BYTES = 32 * 1024;
41266
+ BACKGROUND_COMPLETION = Symbol("backgroundCompletion");
40546
41267
  });
40547
41268
 
40548
41269
  // src/agent-tui/transcript/projection.ts
@@ -40566,7 +41287,7 @@ function createTranscriptProjection(store, width) {
40566
41287
  });
40567
41288
  const historyRows = createMemo(() => projectMessagesToRows(historyMessages(), width(), undefined, historyToolCalls()));
40568
41289
  const activeRows = createMemo(() => projectMessagesToRows(activeMessages(), width(), store.snapshot.runningTurnId, activeToolCalls(), store.snapshot.toolInputPreviews));
40569
- return createMemo(() => [...historyRows(), ...activeRows()]);
41290
+ return createMemo(() => reconcileTimelineRows([...historyRows(), ...activeRows()]));
40570
41291
  }
40571
41292
  var init_projection = __esm(() => {
40572
41293
  init_solid();
@@ -45142,8 +45863,8 @@ input: ${row.argsSummary}` : ""}`;
45142
45863
 
45143
45864
  ${result}` : header;
45144
45865
  }
45145
- case "exploration":
45146
- return [`## ${row.status === "running" ? "exploring" : "explored"}`, "", ...row.items.flatMap((item) => [`### ${item.verb} ${item.target}`, "", item.fullResult ?? item.result ?? "no output"])].join(`
45866
+ case "activity":
45867
+ return [`## ${row.label}`, "", ...row.items.flatMap((item) => [`### ${item.presentation.compact}`, "", `status: ${item.status}`, ...item.fullResult ?? item.result ? ["", item.fullResult ?? item.result ?? ""] : []])].join(`
45147
45868
  `);
45148
45869
  case "plan":
45149
45870
  return [`## ${row.title}`, "", row.explanation ?? "", ...row.items.map((item) => `- [${item.status === "completed" ? "x" : " "}] ${item.step}`), row.markdown ?? ""].filter((line) => line.length > 0).join(`
@@ -45993,6 +46714,54 @@ function styleTaskGlyphs(chunks) {
45993
46714
  });
45994
46715
  });
45995
46716
  }
46717
+ function styleUnorderedListGlyphs(chunks) {
46718
+ const text = chunks.map((chunk) => chunk.text).join("");
46719
+ const replacements = new Map;
46720
+ let lineStart = 0;
46721
+ for (const line of text.split(`
46722
+ `)) {
46723
+ const match = line.match(/^([ \t]*)([-+*])(?=[ \t]+)/);
46724
+ if (match) {
46725
+ const indent = match[1].replace(/\t/g, " ").length;
46726
+ const depth = Math.floor(indent / 2) % unorderedListMarkers.length;
46727
+ replacements.set(lineStart + match[1].length, {
46728
+ text: unorderedListMarkers[depth],
46729
+ fg: unorderedListMarkerColors[depth]
46730
+ });
46731
+ }
46732
+ lineStart += line.length + 1;
46733
+ }
46734
+ if (replacements.size === 0)
46735
+ return chunks;
46736
+ let offset = 0;
46737
+ return chunks.flatMap((chunk) => {
46738
+ const parts = [];
46739
+ let start = 0;
46740
+ for (let index = 0;index < chunk.text.length; index += 1) {
46741
+ const replacement = replacements.get(offset + index);
46742
+ if (!replacement)
46743
+ continue;
46744
+ if (index > start)
46745
+ parts.push({
46746
+ ...chunk,
46747
+ text: chunk.text.slice(start, index)
46748
+ });
46749
+ parts.push({
46750
+ ...chunk,
46751
+ text: replacement.text,
46752
+ fg: replacement.fg
46753
+ });
46754
+ start = index + 1;
46755
+ }
46756
+ if (start < chunk.text.length)
46757
+ parts.push({
46758
+ ...chunk,
46759
+ text: chunk.text.slice(start)
46760
+ });
46761
+ offset += chunk.text.length;
46762
+ return parts.length > 0 ? parts : chunk;
46763
+ });
46764
+ }
45996
46765
  function mermaidLineStyle(line) {
45997
46766
  const trimmed = line.trimStart();
45998
46767
  if (trimmed.startsWith("%%"))
@@ -46038,11 +46807,13 @@ function styleMermaidContent(chunks, content) {
46038
46807
  return transformed;
46039
46808
  }));
46040
46809
  }
46041
- var checkedTaskColor, uncheckedTaskColor, mermaidKeywordAttributes, mermaidCommentAttributes, mermaidDimColor, mermaidAccentColor, mermaidWarningColor, mermaidEdgeColor;
46810
+ var checkedTaskColor, uncheckedTaskColor, unorderedListMarkerColors, unorderedListMarkers, mermaidKeywordAttributes, mermaidCommentAttributes, mermaidDimColor, mermaidAccentColor, mermaidWarningColor, mermaidEdgeColor;
46042
46811
  var init_markdown_content = __esm(() => {
46043
46812
  init_theme();
46044
46813
  checkedTaskColor = parseColor3(COLOR.success);
46045
46814
  uncheckedTaskColor = parseColor3(COLOR.dim);
46815
+ unorderedListMarkerColors = [parseColor3(COLOR.accent), parseColor3(COLOR.muted), parseColor3(COLOR.dim)];
46816
+ unorderedListMarkers = ["\u2022", "\u203A", "\xB7"];
46046
46817
  mermaidKeywordAttributes = createTextAttributes3({
46047
46818
  bold: true
46048
46819
  });
@@ -46248,72 +47019,8 @@ var init_markdown_diff = __esm(() => {
46248
47019
  decoratedDiffRenderables = new WeakSet;
46249
47020
  });
46250
47021
 
46251
- // src/agent-tui/markdown-finalize.ts
46252
- function createMarkdownFinalizeScheduler(delayMs = 70, clock = systemClock) {
46253
- const queue = new Map;
46254
- let timer;
46255
- let timerDeadline = 0;
46256
- function setTimer(deadline) {
46257
- if (timer)
46258
- clock.clearTimer(timer);
46259
- timerDeadline = deadline;
46260
- timer = clock.setTimer(flush, Math.max(0, Math.ceil(deadline - clock.now())));
46261
- }
46262
- function flush() {
46263
- timer = undefined;
46264
- timerDeadline = 0;
46265
- const now = clock.now();
46266
- const callbacks = [];
46267
- let nextDeadline = Number.POSITIVE_INFINITY;
46268
- for (const [callback, deadline] of queue) {
46269
- if (deadline <= now) {
46270
- queue.delete(callback);
46271
- callbacks.push(callback);
46272
- } else {
46273
- nextDeadline = Math.min(nextDeadline, deadline);
46274
- }
46275
- }
46276
- if (callbacks.length > 0) {
46277
- batch(() => {
46278
- for (const finalize of callbacks)
46279
- finalize();
46280
- });
46281
- }
46282
- if (Number.isFinite(nextDeadline))
46283
- setTimer(nextDeadline);
46284
- }
46285
- function schedule(callback) {
46286
- const deadline = clock.now() + delayMs;
46287
- queue.set(callback, deadline);
46288
- if (!timer || deadline < timerDeadline)
46289
- setTimer(deadline);
46290
- return () => {
46291
- if (!queue.delete(callback))
46292
- return;
46293
- if (queue.size > 0 || !timer)
46294
- return;
46295
- clock.clearTimer(timer);
46296
- timer = undefined;
46297
- timerDeadline = 0;
46298
- };
46299
- }
46300
- return {
46301
- schedule
46302
- };
46303
- }
46304
- var systemClock, scheduleMarkdownFinalize;
46305
- var init_markdown_finalize = __esm(() => {
46306
- init_solid();
46307
- systemClock = {
46308
- now: () => Date.now(),
46309
- setTimer: (callback, delayMs) => setTimeout(callback, delayMs),
46310
- clearTimer: (timer) => clearTimeout(timer)
46311
- };
46312
- scheduleMarkdownFinalize = createMarkdownFinalizeScheduler().schedule;
46313
- });
46314
-
46315
47022
  // src/agent-tui/markdown-layout.ts
46316
- import { StyledText, TextRenderable as TextRenderable4, TextTableRenderable, createTextAttributes as createTextAttributes4, parseColor as parseColor5 } from "@opentui/core";
47023
+ import { TextTableRenderable, createTextAttributes as createTextAttributes4, parseColor as parseColor5 } from "@opentui/core";
46317
47024
  function tableCellText(cell) {
46318
47025
  return cell?.map((chunk) => chunk.text).join("") ?? "";
46319
47026
  }
@@ -46383,37 +47090,18 @@ function applyTableHeaderRule(table) {
46383
47090
  });
46384
47091
  };
46385
47092
  }
46386
- function decorateUnorderedListMarker(renderable) {
46387
- if (!renderable.id.endsWith("-marker"))
46388
- return;
46389
- if (renderable.chunks.map((chunk) => chunk.text).join("").trim() !== "-")
46390
- return;
46391
- const depth = Math.max(0, (renderable.id.match(/-item-\d+/g)?.length ?? 1) - 1);
46392
- const index = depth % unorderedListMarkers.length;
46393
- renderable.content = new StyledText([{
46394
- __isChunk: true,
46395
- text: `${unorderedListMarkers[index]} `,
46396
- fg: unorderedListMarkerColors[index]
46397
- }]);
46398
- }
46399
47093
  function decorateMarkdownLayout(renderable) {
46400
47094
  if (renderable instanceof TextTableRenderable) {
46401
47095
  applyTableHeaderRule(renderable);
46402
47096
  return true;
46403
47097
  }
46404
- if (renderable instanceof TextRenderable4) {
46405
- decorateUnorderedListMarker(renderable);
46406
- return true;
46407
- }
46408
47098
  return false;
46409
47099
  }
46410
- var tableRuleColor, unorderedListMarkerColors, unorderedListMarkers, tableResizeHooks, enhancedTables;
47100
+ var tableRuleColor, tableResizeHooks, enhancedTables;
46411
47101
  var init_markdown_layout = __esm(() => {
46412
47102
  init_terminal_text();
46413
47103
  init_theme();
46414
47104
  tableRuleColor = parseColor5(COLOR.dim);
46415
- unorderedListMarkerColors = [parseColor5(COLOR.accent), parseColor5(COLOR.muted), parseColor5(COLOR.dim)];
46416
- unorderedListMarkers = ["\u2022", "\u203A", "\xB7"];
46417
47105
  tableResizeHooks = new WeakSet;
46418
47106
  enhancedTables = new WeakMap;
46419
47107
  });
@@ -46775,7 +47463,8 @@ function enhanceMarkdownChunks(renderable) {
46775
47463
  fg: renderable.fg,
46776
47464
  attributes: (chunk.attributes ?? 0) | strikethroughAttributes
46777
47465
  } : chunk);
46778
- return styleTaskGlyphs(struck);
47466
+ const tasks = styleTaskGlyphs(struck);
47467
+ return context.filetype === "markdown" ? styleUnorderedListGlyphs(tasks) : tasks;
46779
47468
  };
46780
47469
  }
46781
47470
  function enableTextFallback(renderable) {
@@ -46786,6 +47475,7 @@ function enableTextFallback(renderable) {
46786
47475
  if (resetStreaming) {
46787
47476
  renderable.streaming = false;
46788
47477
  renderable.streaming = true;
47478
+ renderable.requestRender();
46789
47479
  }
46790
47480
  return;
46791
47481
  }
@@ -46797,20 +47487,9 @@ function enableTextFallback(renderable) {
46797
47487
  enableTextFallback(child);
46798
47488
  }
46799
47489
  function MarkdownView(props) {
46800
- const [renderStreaming, setRenderStreaming] = createSignal(true);
46801
- let cancelFinalize = () => {};
46802
47490
  let markdownRef;
46803
47491
  let fallbackGeneration = 0;
46804
- createEffect(() => {
46805
- props.content;
46806
- cancelFinalize();
46807
- cancelFinalize = () => {};
46808
- setRenderStreaming(true);
46809
- if (props.streaming) {
46810
- return;
46811
- }
46812
- cancelFinalize = scheduleMarkdownFinalize(() => setRenderStreaming(false));
46813
- });
47492
+ const renderStreaming = () => props.streaming === true;
46814
47493
  createEffect(() => {
46815
47494
  props.content;
46816
47495
  renderStreaming();
@@ -46825,25 +47504,20 @@ function MarkdownView(props) {
46825
47504
  if (!markdownRef || markdownRef.isDestroyed)
46826
47505
  return;
46827
47506
  markdownRef.refreshStyles();
46828
- enableTextFallback(markdownRef);
46829
47507
  });
46830
47508
  onCleanup(() => {
46831
47509
  fallbackGeneration += 1;
46832
- cancelFinalize();
46833
47510
  });
46834
47511
  return (() => {
46835
47512
  var _el$ = createElement("markdown");
46836
47513
  use((renderable) => {
46837
47514
  markdownRef = renderable;
46838
- enableTextFallback(renderable);
46839
47515
  }, _el$);
46840
47516
  spread(_el$, mergeProps3(() => props.id ? {
46841
47517
  id: props.id
46842
47518
  } : {}, {
46843
47519
  width: "100%",
46844
- get internalBlockMode() {
46845
- return props.variant === "document" ? "coalesced" : "top-level";
46846
- },
47520
+ internalBlockMode: "coalesced",
46847
47521
  conceal: true,
46848
47522
  concealCode: false,
46849
47523
  get syntaxStyle() {
@@ -46854,11 +47528,11 @@ function MarkdownView(props) {
46854
47528
  get fg() {
46855
47529
  return props.fg ?? COLOR.markdownText;
46856
47530
  },
46857
- get streaming() {
46858
- return renderStreaming();
46859
- },
46860
47531
  get content() {
46861
47532
  return normalizeTaskListMarkers(props.content);
47533
+ },
47534
+ get streaming() {
47535
+ return renderStreaming();
46862
47536
  }
46863
47537
  }), false);
46864
47538
  return _el$;
@@ -46875,7 +47549,6 @@ var init_markdown = __esm(() => {
46875
47549
  init_code_highlighter();
46876
47550
  init_markdown_content();
46877
47551
  init_markdown_diff();
46878
- init_markdown_finalize();
46879
47552
  init_markdown_layout();
46880
47553
  init_syntax();
46881
47554
  init_theme();
@@ -46903,7 +47576,8 @@ var init_markdown = __esm(() => {
46903
47576
  renderable.conceal = false;
46904
47577
  renderable.filetype = "markdown";
46905
47578
  }
46906
- enableTextFallback(renderable);
47579
+ if (renderable instanceof CodeRenderable2)
47580
+ enhanceMarkdownChunks(renderable);
46907
47581
  return renderable;
46908
47582
  }, {
46909
47583
  codeBlockOnly: true
@@ -47295,88 +47969,47 @@ var init_filetype = __esm(() => {
47295
47969
  };
47296
47970
  });
47297
47971
 
47298
- // src/agent-tui/tool-renderers.ts
47299
- function parseNmap(text) {
47300
- const rows = [];
47301
- for (const line of text.split(`
47302
- `)) {
47303
- const match = line.trim().match(/^(\d+)\/(tcp|udp)\s+(open|closed|filtered|open\|filtered)\s+(\S+)(?:\s+(.*))?$/i);
47304
- if (!match)
47305
- continue;
47306
- rows.push({
47307
- port: match[1],
47308
- proto: match[2],
47309
- state: match[3],
47310
- service: match[4],
47311
- version: match[5] ?? ""
47312
- });
47313
- }
47314
- return rows;
47315
- }
47316
- function parseDirectoryResults(text) {
47317
- try {
47318
- const parsed = JSON.parse(text);
47319
- return (parsed.results ?? []).map((item) => ({
47320
- url: String(item.url ?? item.input ?? ""),
47321
- status: Number(item.status ?? 0),
47322
- size: Number(item.length ?? item.size ?? 0)
47323
- })).filter((row) => row.url).sort((a, b) => a.status - b.status || b.size - a.size);
47324
- } catch {
47325
- return [];
47326
- }
47327
- }
47328
- function splitHttpResponse2(text) {
47329
- const normalized = text.replaceAll(`\r
47330
- `, `
47331
- `);
47332
- const boundary = normalized.indexOf(`
47333
-
47334
- `);
47335
- if (boundary < 0 || !normalized.startsWith("HTTP/"))
47336
- return {
47337
- headers: "",
47338
- body: text
47339
- };
47340
- const headers = normalized.slice(0, boundary);
47341
- const status2 = headers.split(`
47342
- `)[0];
47343
- const contentTypeLine = headers.split(`
47344
- `).find((line) => /^content-type:/i.test(line));
47345
- const contentType = contentTypeLine?.slice(contentTypeLine.indexOf(":") + 1).trim();
47346
- return {
47347
- headers,
47348
- body: normalized.slice(boundary + 2),
47349
- ...status2 ? {
47350
- status: status2
47351
- } : {},
47352
- ...contentType ? {
47353
- contentType
47354
- } : {}
47355
- };
47356
- }
47357
- function unifiedEditDiff(path, oldText, newText) {
47358
- const oldLines = oldText.split(`
47359
- `);
47360
- const newLines = newText.split(`
47361
- `);
47362
- return [`--- a/${path}`, `+++ b/${path}`, `@@ -1,${oldLines.length} +1,${newLines.length} @@`, ...oldLines.map((line) => `-${line}`), ...newLines.map((line) => `+${line}`)].join(`
47363
- `);
47364
- }
47365
-
47366
47972
  // src/agent-tui/transcript/cells/tool-cell.tsx
47367
47973
  function ToolRow(props) {
47974
+ return createComponent2(Show, {
47975
+ get when() {
47976
+ return ["agent_task", "agent_spawn", "agent_followup"].includes(props.row.tool);
47977
+ },
47978
+ get fallback() {
47979
+ return createComponent2(StandardToolRow, {
47980
+ get row() {
47981
+ return props.row;
47982
+ },
47983
+ get animated() {
47984
+ return props.animated;
47985
+ }
47986
+ });
47987
+ },
47988
+ get children() {
47989
+ return createComponent2(AgentTaskRow, {
47990
+ get row() {
47991
+ return props.row;
47992
+ },
47993
+ get animated() {
47994
+ return props.animated;
47995
+ }
47996
+ });
47997
+ }
47998
+ });
47999
+ }
48000
+ function StandardToolRow(props) {
47368
48001
  const tui = useTuiStore();
47369
48002
  const dims = useTuiDimensions();
47370
48003
  const contentWidth = () => Math.max(1, dims().width - 6);
47371
48004
  const input = () => args(props.row.args);
47372
48005
  const expanded = () => Boolean(tui.store.ui.expandedCells[props.row.id]);
47373
- const title = () => toolTitle(props.row.tool, input(), props.row.status, Math.max(1, dims().width - 4));
47374
48006
  const result = () => props.row.result ?? "";
47375
48007
  const fullResult = () => props.row.fullResult ?? result();
47376
48008
  const mcpInvocation = () => props.row.mcp ? `${props.row.mcp.server}.${props.row.mcp.tool}${props.row.argsSummary ? ` \xB7 ${props.row.argsSummary}` : ""}` : "";
47377
48009
  const mcpResult = () => props.row.mcp ? mcpContentLines(props.row.mcp.result) : [];
47378
48010
  const isMcp = () => Boolean(props.row.mcp);
47379
48011
  const active = () => isActiveToolStatus(props.row.status);
48012
+ const presentation = () => props.row.presentation ?? presentToolActivity(props.row);
47380
48013
  const visibleOutput = () => active() ? props.row.liveOutput ?? "" : result();
47381
48014
  const detailOutput = () => {
47382
48015
  if (isMcp() && mcpResult().length > 0)
@@ -47387,20 +48020,16 @@ function ToolRow(props) {
47387
48020
  return fullResult();
47388
48021
  };
47389
48022
  const hasInput = () => Object.keys(input()).length > 0;
47390
- const headerLabel = () => truncateLine2(isMcp() ? `${active() ? "calling" : "called"} ${mcpInvocation()}` : title(), Math.max(1, dims().width - 4));
48023
+ const header = () => {
48024
+ const title = isMcp() ? `${active() ? "calling" : "called"} ${mcpInvocation()}` : presentation().title;
48025
+ const right = [presentation().outcome, formatActivityDuration(props.row.durationMs)].filter(Boolean).join(" \xB7 ");
48026
+ return fitTerminalPair(title, right, Math.max(1, dims().width - 4), 8, 2);
48027
+ };
47391
48028
  const headerColor = () => active() ? COLOR.accent : toolColor(props.row.status);
47392
48029
  const toggleClick = createPrimaryClickGesture(() => tui.actions.cellExpandedToggle(props.row.id));
47393
48030
  const previewClick = createPrimaryClickGesture(() => tui.actions.cellExpandedToggle(props.row.id));
47394
- const visibleOutputLines = () => active() ? tailLines(visibleOutput(), 3) : previewOutputLines(visibleOutput(), TOOL_OUTPUT_PREVIEW_LINES);
47395
- if (["agent_task", "agent_spawn", "agent_followup"].includes(props.row.tool))
47396
- return createComponent2(AgentTaskRow, {
47397
- get row() {
47398
- return props.row;
47399
- },
47400
- get animated() {
47401
- return props.animated;
47402
- }
47403
- });
48031
+ const semanticPreview = () => presentation().preview.filter((line) => line.trim() !== presentation().outcome?.trim());
48032
+ const visibleOutputLines = () => presentation().preview.length > 0 ? semanticPreview() : active() ? tailLines(visibleOutput(), 3) : previewOutputLines(visibleOutput(), TOOL_OUTPUT_PREVIEW_LINES);
47404
48033
  return (() => {
47405
48034
  var _el$ = createElement("box"), _el$2 = createElement("box"), _el$3 = createElement("text");
47406
48035
  insertNode(_el$, _el$2);
@@ -47424,30 +48053,41 @@ function ToolRow(props) {
47424
48053
  return props.animated;
47425
48054
  }
47426
48055
  }), _el$3);
47427
- insert(_el$3, headerLabel);
48056
+ insert(_el$3, () => header().left);
48057
+ insert(_el$2, createComponent2(Show, {
48058
+ get when() {
48059
+ return header().right;
48060
+ },
48061
+ get children() {
48062
+ var _el$4 = createElement("text");
48063
+ insert(_el$4, () => ` ${header().right}`);
48064
+ effect((_$p) => setProp(_el$4, "fg", presentation().warning ? COLOR.warning : COLOR.dim, _$p));
48065
+ return _el$4;
48066
+ }
48067
+ }), null);
47428
48068
  insert(_el$, createComponent2(Show, {
47429
48069
  get when() {
47430
48070
  return memo2(() => !!(!expanded() && !isMcp()))() && visibleOutput();
47431
48071
  },
47432
48072
  get children() {
47433
- var _el$4 = createElement("box");
47434
- setProp(_el$4, "style", {
48073
+ var _el$5 = createElement("box");
48074
+ setProp(_el$5, "style", {
47435
48075
  flexDirection: "column",
47436
48076
  paddingLeft: 2
47437
48077
  });
47438
- spread(_el$4, previewClick, true);
47439
- insert(_el$4, createComponent2(Index, {
48078
+ spread(_el$5, previewClick, true);
48079
+ insert(_el$5, createComponent2(Index, {
47440
48080
  get each() {
47441
48081
  return visibleOutputLines();
47442
48082
  },
47443
48083
  children: (line, index) => (() => {
47444
- var _el$11 = createElement("text");
47445
- insert(_el$11, () => `${active() ? "\u2502 " : index === 0 ? "\u2514 " : " "}${truncateLine2(line(), contentWidth())}`);
47446
- effect((_$p) => setProp(_el$11, "fg", COLOR.dim, _$p));
47447
- return _el$11;
48084
+ var _el$12 = createElement("text");
48085
+ insert(_el$12, () => `${active() ? "\u2502 " : index === 0 ? "\u2514 " : " "}${truncateLine2(line(), contentWidth())}`);
48086
+ effect((_$p) => setProp(_el$12, "fg", COLOR.dim, _$p));
48087
+ return _el$12;
47448
48088
  })()
47449
48089
  }));
47450
- return _el$4;
48090
+ return _el$5;
47451
48091
  }
47452
48092
  }), null);
47453
48093
  insert(_el$, createComponent2(Show, {
@@ -47455,25 +48095,25 @@ function ToolRow(props) {
47455
48095
  return memo2(() => !!(!expanded() && isMcp()))() && mcpResult().length > 0;
47456
48096
  },
47457
48097
  get children() {
47458
- var _el$5 = createElement("box");
47459
- setProp(_el$5, "style", {
48098
+ var _el$6 = createElement("box");
48099
+ setProp(_el$6, "style", {
47460
48100
  flexDirection: "column",
47461
48101
  paddingLeft: 2
47462
48102
  });
47463
- spread(_el$5, previewClick, true);
47464
- insert(_el$5, createComponent2(For, {
48103
+ spread(_el$6, previewClick, true);
48104
+ insert(_el$6, createComponent2(For, {
47465
48105
  get each() {
47466
48106
  return previewOutputLines(mcpResult().join(`
47467
48107
  `), TOOL_OUTPUT_PREVIEW_LINES);
47468
48108
  },
47469
48109
  children: (line, index) => (() => {
47470
- var _el$12 = createElement("text");
47471
- insert(_el$12, () => `${index() === 0 ? "\u2514 " : " "}${truncateLine2(line, contentWidth())}`);
47472
- effect((_$p) => setProp(_el$12, "fg", COLOR.dim, _$p));
47473
- return _el$12;
48110
+ var _el$13 = createElement("text");
48111
+ insert(_el$13, () => `${index() === 0 ? "\u2514 " : " "}${truncateLine2(line, contentWidth())}`);
48112
+ effect((_$p) => setProp(_el$13, "fg", COLOR.dim, _$p));
48113
+ return _el$13;
47474
48114
  })()
47475
48115
  }));
47476
- return _el$5;
48116
+ return _el$6;
47477
48117
  }
47478
48118
  }), null);
47479
48119
  insert(_el$, createComponent2(Show, {
@@ -47481,15 +48121,15 @@ function ToolRow(props) {
47481
48121
  return memo2(() => !!props.row.processId)() && props.row.status === "running_background";
47482
48122
  },
47483
48123
  get children() {
47484
- var _el$6 = createElement("box"), _el$7 = createElement("text");
47485
- insertNode(_el$6, _el$7);
47486
- setProp(_el$6, "style", {
48124
+ var _el$7 = createElement("box"), _el$8 = createElement("text");
48125
+ insertNode(_el$7, _el$8);
48126
+ setProp(_el$7, "style", {
47487
48127
  flexDirection: "column",
47488
48128
  paddingLeft: 2
47489
48129
  });
47490
- insertNode(_el$7, createTextNode(`\u2514 running in background`));
47491
- effect((_$p) => setProp(_el$7, "fg", COLOR.dim, _$p));
47492
- return _el$6;
48130
+ insertNode(_el$8, createTextNode(`\u2514 running in background`));
48131
+ effect((_$p) => setProp(_el$8, "fg", COLOR.dim, _$p));
48132
+ return _el$7;
47493
48133
  }
47494
48134
  }), null);
47495
48135
  insert(_el$, createComponent2(Show, {
@@ -47500,20 +48140,20 @@ function ToolRow(props) {
47500
48140
  return createComponent2(ExpandedPanel, {
47501
48141
  get children() {
47502
48142
  return [(() => {
47503
- var _el$9 = createElement("text");
47504
- insert(_el$9, () => active() ? "live output" : "result");
47505
- effect((_$p) => setProp(_el$9, "fg", COLOR.dim, _$p));
47506
- return _el$9;
48143
+ var _el$0 = createElement("text");
48144
+ insert(_el$0, () => active() ? "live output" : "result");
48145
+ effect((_$p) => setProp(_el$0, "fg", COLOR.dim, _$p));
48146
+ return _el$0;
47507
48147
  })(), createComponent2(Show, {
47508
48148
  get when() {
47509
48149
  return detailOutput();
47510
48150
  },
47511
48151
  get fallback() {
47512
48152
  return (() => {
47513
- var _el$13 = createElement("text");
47514
- insert(_el$13, () => toolEmptyState(props.row.status));
47515
- effect((_$p) => setProp(_el$13, "fg", COLOR.dim, _$p));
47516
- return _el$13;
48153
+ var _el$14 = createElement("text");
48154
+ insert(_el$14, () => toolEmptyState(props.row.status));
48155
+ effect((_$p) => setProp(_el$14, "fg", COLOR.dim, _$p));
48156
+ return _el$14;
47517
48157
  })();
47518
48158
  },
47519
48159
  children: (output) => createComponent2(ToolResult, {
@@ -47535,14 +48175,14 @@ function ToolRow(props) {
47535
48175
  return hasInput();
47536
48176
  },
47537
48177
  get children() {
47538
- var _el$0 = createElement("box"), _el$1 = createElement("text");
47539
- insertNode(_el$0, _el$1);
47540
- setProp(_el$0, "style", {
48178
+ var _el$1 = createElement("box"), _el$10 = createElement("text");
48179
+ insertNode(_el$1, _el$10);
48180
+ setProp(_el$1, "style", {
47541
48181
  flexDirection: "column",
47542
48182
  marginTop: 1
47543
48183
  });
47544
- insertNode(_el$1, createTextNode(`input`));
47545
- insert(_el$0, createComponent2(ToolInput, {
48184
+ insertNode(_el$10, createTextNode(`input`));
48185
+ insert(_el$1, createComponent2(ToolInput, {
47546
48186
  get tool() {
47547
48187
  return props.row.tool;
47548
48188
  },
@@ -47550,8 +48190,12 @@ function ToolRow(props) {
47550
48190
  return input();
47551
48191
  }
47552
48192
  }), null);
47553
- effect((_$p) => setProp(_el$1, "fg", COLOR.dim, _$p));
47554
- return _el$0;
48193
+ effect((_$p) => setProp(_el$10, "fg", COLOR.dim, _$p));
48194
+ return _el$1;
48195
+ }
48196
+ }), createComponent2(ToolResultContext, {
48197
+ get row() {
48198
+ return props.row;
47555
48199
  }
47556
48200
  })];
47557
48201
  }
@@ -47562,6 +48206,369 @@ function ToolRow(props) {
47562
48206
  return _el$;
47563
48207
  })();
47564
48208
  }
48209
+ function ActivityRow(props) {
48210
+ const tui = useTuiStore();
48211
+ const dims = useTuiDimensions();
48212
+ const expanded = () => Boolean(tui.store.ui.expandedCells[props.row.id]);
48213
+ const active = () => props.row.status === "running";
48214
+ const color = () => props.row.status === "error" ? COLOR.error : active() ? COLOR.accent : COLOR.text;
48215
+ const duration = () => formatActivityDuration(props.row.durationMs);
48216
+ const headline = () => fitTerminalPair(props.row.label, duration() ?? "", Math.max(1, dims().width - 4), 8, 2);
48217
+ const width = () => Math.max(1, dims().width - 8);
48218
+ const toggleClick = createPrimaryClickGesture(() => tui.actions.cellExpandedToggle(props.row.id));
48219
+ return (() => {
48220
+ var _el$15 = createElement("box"), _el$16 = createElement("box"), _el$17 = createElement("text");
48221
+ insertNode(_el$15, _el$16);
48222
+ setProp(_el$15, "style", {
48223
+ flexDirection: "column",
48224
+ marginBottom: 1
48225
+ });
48226
+ insertNode(_el$16, _el$17);
48227
+ setProp(_el$16, "style", {
48228
+ flexDirection: "row"
48229
+ });
48230
+ spread(_el$16, toggleClick, true);
48231
+ insert(_el$16, createComponent2(TranscriptMarker, {
48232
+ get color() {
48233
+ return color();
48234
+ },
48235
+ get spinning() {
48236
+ return active();
48237
+ },
48238
+ get animated() {
48239
+ return props.animated;
48240
+ }
48241
+ }), _el$17);
48242
+ insert(_el$17, () => headline().left);
48243
+ insert(_el$16, createComponent2(Show, {
48244
+ get when() {
48245
+ return headline().right;
48246
+ },
48247
+ get children() {
48248
+ var _el$18 = createElement("text");
48249
+ insert(_el$18, () => ` ${headline().right}`);
48250
+ effect((_$p) => setProp(_el$18, "fg", COLOR.dim, _$p));
48251
+ return _el$18;
48252
+ }
48253
+ }), null);
48254
+ insert(_el$15, createComponent2(Show, {
48255
+ get when() {
48256
+ return !expanded();
48257
+ },
48258
+ get children() {
48259
+ var _el$19 = createElement("box");
48260
+ setProp(_el$19, "style", {
48261
+ flexDirection: "column",
48262
+ paddingLeft: 2
48263
+ });
48264
+ spread(_el$19, toggleClick, true);
48265
+ insert(_el$19, createComponent2(For, {
48266
+ get each() {
48267
+ return props.row.items;
48268
+ },
48269
+ children: (item, index) => {
48270
+ const presentation = () => item.presentation ?? presentToolActivity(item);
48271
+ const pair = () => fitTerminalPair(presentation().compact, presentation().outcome ?? "", width(), 8, 3);
48272
+ return (() => {
48273
+ var _el$20 = createElement("box"), _el$21 = createElement("text"), _el$22 = createElement("text");
48274
+ insertNode(_el$20, _el$21);
48275
+ insertNode(_el$20, _el$22);
48276
+ setProp(_el$20, "style", {
48277
+ flexDirection: "row"
48278
+ });
48279
+ insert(_el$21, () => index() === 0 ? "\u2514 " : " ");
48280
+ insert(_el$22, () => pair().left);
48281
+ insert(_el$20, createComponent2(Show, {
48282
+ get when() {
48283
+ return pair().right;
48284
+ },
48285
+ get children() {
48286
+ var _el$23 = createElement("text");
48287
+ insert(_el$23, () => ` \u2192 ${pair().right}`);
48288
+ effect((_$p) => setProp(_el$23, "fg", presentation().warning ? COLOR.warning : COLOR.dim, _$p));
48289
+ return _el$23;
48290
+ }
48291
+ }), null);
48292
+ effect((_p$) => {
48293
+ var _v$ = COLOR.dim, _v$2 = COLOR.dim;
48294
+ _v$ !== _p$.e && (_p$.e = setProp(_el$21, "fg", _v$, _p$.e));
48295
+ _v$2 !== _p$.t && (_p$.t = setProp(_el$22, "fg", _v$2, _p$.t));
48296
+ return _p$;
48297
+ }, {
48298
+ e: undefined,
48299
+ t: undefined
48300
+ });
48301
+ return _el$20;
48302
+ })();
48303
+ }
48304
+ }));
48305
+ return _el$19;
48306
+ }
48307
+ }), null);
48308
+ insert(_el$15, createComponent2(Show, {
48309
+ get when() {
48310
+ return expanded();
48311
+ },
48312
+ get children() {
48313
+ return createComponent2(ExpandedPanel, {
48314
+ get children() {
48315
+ return createComponent2(For, {
48316
+ get each() {
48317
+ return props.row.items;
48318
+ },
48319
+ children: (item, index) => {
48320
+ const itemInput = () => args(item.args);
48321
+ const output = () => item.fullResult ?? item.result ?? item.liveOutput ?? "";
48322
+ const presentation = () => item.presentation ?? presentToolActivity(item);
48323
+ return (() => {
48324
+ var _el$24 = createElement("box"), _el$25 = createElement("text");
48325
+ insertNode(_el$24, _el$25);
48326
+ insert(_el$25, () => presentation().compact);
48327
+ insert(_el$24, createComponent2(Show, {
48328
+ get when() {
48329
+ return presentation().outcome;
48330
+ },
48331
+ get children() {
48332
+ var _el$26 = createElement("text");
48333
+ insert(_el$26, () => presentation().outcome);
48334
+ effect((_$p) => setProp(_el$26, "fg", presentation().warning ? COLOR.warning : COLOR.dim, _$p));
48335
+ return _el$26;
48336
+ }
48337
+ }), null);
48338
+ insert(_el$24, createComponent2(Show, {
48339
+ get when() {
48340
+ return output();
48341
+ },
48342
+ get fallback() {
48343
+ return (() => {
48344
+ var _el$30 = createElement("text");
48345
+ insert(_el$30, () => toolEmptyState(item.status));
48346
+ effect((_$p) => setProp(_el$30, "fg", COLOR.dim, _$p));
48347
+ return _el$30;
48348
+ })();
48349
+ },
48350
+ children: (value) => createComponent2(ToolResult, {
48351
+ get tool() {
48352
+ return item.tool;
48353
+ },
48354
+ get input() {
48355
+ return itemInput();
48356
+ },
48357
+ get text() {
48358
+ return value();
48359
+ },
48360
+ get width() {
48361
+ return dims().width;
48362
+ }
48363
+ })
48364
+ }), null);
48365
+ insert(_el$24, createComponent2(Show, {
48366
+ get when() {
48367
+ return Object.keys(itemInput()).length > 0;
48368
+ },
48369
+ get children() {
48370
+ var _el$27 = createElement("box"), _el$28 = createElement("text");
48371
+ insertNode(_el$27, _el$28);
48372
+ setProp(_el$27, "style", {
48373
+ flexDirection: "column",
48374
+ marginTop: 1
48375
+ });
48376
+ insertNode(_el$28, createTextNode(`input`));
48377
+ insert(_el$27, createComponent2(ToolInput, {
48378
+ get tool() {
48379
+ return item.tool;
48380
+ },
48381
+ get input() {
48382
+ return itemInput();
48383
+ }
48384
+ }), null);
48385
+ effect((_$p) => setProp(_el$28, "fg", COLOR.dim, _$p));
48386
+ return _el$27;
48387
+ }
48388
+ }), null);
48389
+ insert(_el$24, createComponent2(ToolResultContext, {
48390
+ row: item
48391
+ }), null);
48392
+ effect((_p$) => {
48393
+ var _v$3 = {
48394
+ flexDirection: "column",
48395
+ marginTop: index() === 0 ? 0 : 1
48396
+ }, _v$4 = COLOR.text;
48397
+ _v$3 !== _p$.e && (_p$.e = setProp(_el$24, "style", _v$3, _p$.e));
48398
+ _v$4 !== _p$.t && (_p$.t = setProp(_el$25, "fg", _v$4, _p$.t));
48399
+ return _p$;
48400
+ }, {
48401
+ e: undefined,
48402
+ t: undefined
48403
+ });
48404
+ return _el$24;
48405
+ })();
48406
+ }
48407
+ });
48408
+ }
48409
+ });
48410
+ }
48411
+ }), null);
48412
+ effect((_$p) => setProp(_el$17, "fg", color(), _$p));
48413
+ return _el$15;
48414
+ })();
48415
+ }
48416
+ function ToolResultContext(props) {
48417
+ const dims = useTuiDimensions();
48418
+ const result = () => props.row.toolResult;
48419
+ const evidence = () => result()?.evidence ?? [];
48420
+ const attachments = () => result()?.attachments ?? [];
48421
+ const metadata = () => result()?.metadata ?? {};
48422
+ const artifact = () => {
48423
+ const value = metadata().outputArtifact;
48424
+ return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
48425
+ };
48426
+ return createComponent2(Show, {
48427
+ get when() {
48428
+ return result();
48429
+ },
48430
+ get children() {
48431
+ var _el$31 = createElement("box");
48432
+ setProp(_el$31, "style", {
48433
+ flexDirection: "column"
48434
+ });
48435
+ insert(_el$31, createComponent2(Show, {
48436
+ get when() {
48437
+ return evidence().length > 0;
48438
+ },
48439
+ get children() {
48440
+ var _el$32 = createElement("box"), _el$33 = createElement("text");
48441
+ insertNode(_el$32, _el$33);
48442
+ setProp(_el$32, "style", {
48443
+ flexDirection: "column",
48444
+ marginTop: 1
48445
+ });
48446
+ insertNode(_el$33, createTextNode(`evidence`));
48447
+ insert(_el$32, createComponent2(For, {
48448
+ get each() {
48449
+ return evidence();
48450
+ },
48451
+ children: (item) => (() => {
48452
+ var _el$44 = createElement("text");
48453
+ insert(_el$44, () => [item.id, item.title, item.summary, item.path].filter(Boolean).join(" \xB7 "));
48454
+ effect((_$p) => setProp(_el$44, "fg", COLOR.text, _$p));
48455
+ return _el$44;
48456
+ })()
48457
+ }), null);
48458
+ effect((_$p) => setProp(_el$33, "fg", COLOR.dim, _$p));
48459
+ return _el$32;
48460
+ }
48461
+ }), null);
48462
+ insert(_el$31, createComponent2(Show, {
48463
+ get when() {
48464
+ return result()?.outputArtifactId || artifact();
48465
+ },
48466
+ get children() {
48467
+ var _el$35 = createElement("box"), _el$36 = createElement("text");
48468
+ insertNode(_el$35, _el$36);
48469
+ setProp(_el$35, "style", {
48470
+ flexDirection: "column",
48471
+ marginTop: 1
48472
+ });
48473
+ insertNode(_el$36, createTextNode(`artifact`));
48474
+ insert(_el$35, createComponent2(For, {
48475
+ get each() {
48476
+ return toolInputDetailLines({
48477
+ ...result()?.outputArtifactId ? {
48478
+ id: result()?.outputArtifactId
48479
+ } : {},
48480
+ ...artifact() ?? {}
48481
+ });
48482
+ },
48483
+ children: (line) => (() => {
48484
+ var _el$45 = createElement("text");
48485
+ insert(_el$45, line);
48486
+ effect((_$p) => setProp(_el$45, "fg", COLOR.text, _$p));
48487
+ return _el$45;
48488
+ })()
48489
+ }), null);
48490
+ effect((_$p) => setProp(_el$36, "fg", COLOR.dim, _$p));
48491
+ return _el$35;
48492
+ }
48493
+ }), null);
48494
+ insert(_el$31, createComponent2(Show, {
48495
+ get when() {
48496
+ return attachments().length > 0;
48497
+ },
48498
+ get children() {
48499
+ var _el$38 = createElement("box"), _el$39 = createElement("text");
48500
+ insertNode(_el$38, _el$39);
48501
+ setProp(_el$38, "style", {
48502
+ flexDirection: "column",
48503
+ marginTop: 1
48504
+ });
48505
+ insertNode(_el$39, createTextNode(`attachments`));
48506
+ insert(_el$38, createComponent2(For, {
48507
+ get each() {
48508
+ return attachments();
48509
+ },
48510
+ children: (item) => (() => {
48511
+ var _el$46 = createElement("box"), _el$47 = createElement("text"), _el$48 = createElement("image");
48512
+ insertNode(_el$46, _el$47);
48513
+ insertNode(_el$46, _el$48);
48514
+ setProp(_el$46, "style", {
48515
+ flexDirection: "column"
48516
+ });
48517
+ insert(_el$47, () => [item.name ?? "image", item.mediaType, item.detail].filter(Boolean).join(" \xB7 "));
48518
+ setProp(_el$48, "fit", "fit");
48519
+ setProp(_el$48, "protocol", "auto");
48520
+ effect((_p$) => {
48521
+ var _v$5 = COLOR.text, _v$6 = attachmentBytes(item.data), _v$7 = {
48522
+ width: Math.max(1, dims().width - 10),
48523
+ height: Math.max(3, Math.min(12, Math.floor(dims().height / 3)))
48524
+ };
48525
+ _v$5 !== _p$.e && (_p$.e = setProp(_el$47, "fg", _v$5, _p$.e));
48526
+ _v$6 !== _p$.t && (_p$.t = setProp(_el$48, "source", _v$6, _p$.t));
48527
+ _v$7 !== _p$.a && (_p$.a = setProp(_el$48, "style", _v$7, _p$.a));
48528
+ return _p$;
48529
+ }, {
48530
+ e: undefined,
48531
+ t: undefined,
48532
+ a: undefined
48533
+ });
48534
+ return _el$46;
48535
+ })()
48536
+ }), null);
48537
+ effect((_$p) => setProp(_el$39, "fg", COLOR.dim, _$p));
48538
+ return _el$38;
48539
+ }
48540
+ }), null);
48541
+ insert(_el$31, createComponent2(Show, {
48542
+ get when() {
48543
+ return Object.keys(metadata()).length > 0;
48544
+ },
48545
+ get children() {
48546
+ var _el$41 = createElement("box"), _el$42 = createElement("text");
48547
+ insertNode(_el$41, _el$42);
48548
+ setProp(_el$41, "style", {
48549
+ flexDirection: "column",
48550
+ marginTop: 1
48551
+ });
48552
+ insertNode(_el$42, createTextNode(`metadata`));
48553
+ insert(_el$41, createComponent2(For, {
48554
+ get each() {
48555
+ return toolInputDetailLines(metadata());
48556
+ },
48557
+ children: (line) => (() => {
48558
+ var _el$49 = createElement("text");
48559
+ insert(_el$49, line);
48560
+ effect((_$p) => setProp(_el$49, "fg", COLOR.text, _$p));
48561
+ return _el$49;
48562
+ })()
48563
+ }), null);
48564
+ effect((_$p) => setProp(_el$42, "fg", COLOR.dim, _$p));
48565
+ return _el$41;
48566
+ }
48567
+ }), null);
48568
+ return _el$31;
48569
+ }
48570
+ });
48571
+ }
47565
48572
  function AgentTaskRow(props) {
47566
48573
  const tui = useTuiStore();
47567
48574
  const dims = useTuiDimensions();
@@ -47588,19 +48595,19 @@ function AgentTaskRow(props) {
47588
48595
  const toggle = () => tui.actions.cellExpandedToggle(props.row.id);
47589
48596
  const toggleClick = createPrimaryClickGesture(toggle);
47590
48597
  return (() => {
47591
- var _el$14 = createElement("box"), _el$15 = createElement("box"), _el$16 = createElement("text"), _el$18 = createElement("box"), _el$19 = createElement("text");
47592
- insertNode(_el$14, _el$15);
47593
- insertNode(_el$14, _el$18);
47594
- setProp(_el$14, "style", {
48598
+ var _el$50 = createElement("box"), _el$51 = createElement("box"), _el$52 = createElement("text"), _el$54 = createElement("box"), _el$55 = createElement("text");
48599
+ insertNode(_el$50, _el$51);
48600
+ insertNode(_el$50, _el$54);
48601
+ setProp(_el$50, "style", {
47595
48602
  flexDirection: "column",
47596
48603
  marginBottom: 1
47597
48604
  });
47598
- insertNode(_el$15, _el$16);
47599
- setProp(_el$15, "style", {
48605
+ insertNode(_el$51, _el$52);
48606
+ setProp(_el$51, "style", {
47600
48607
  flexDirection: "row"
47601
48608
  });
47602
- spread(_el$15, toggleClick, true);
47603
- insert(_el$15, createComponent2(TranscriptMarker, {
48609
+ spread(_el$51, toggleClick, true);
48610
+ insert(_el$51, createComponent2(TranscriptMarker, {
47604
48611
  get color() {
47605
48612
  return delegationColor(status2());
47606
48613
  },
@@ -47613,25 +48620,25 @@ function AgentTaskRow(props) {
47613
48620
  get animated() {
47614
48621
  return props.animated;
47615
48622
  }
47616
- }), _el$16);
47617
- insert(_el$16, () => headline().left);
47618
- insert(_el$15, createComponent2(Show, {
48623
+ }), _el$52);
48624
+ insert(_el$52, () => headline().left);
48625
+ insert(_el$51, createComponent2(Show, {
47619
48626
  get when() {
47620
48627
  return headline().right;
47621
48628
  },
47622
48629
  get children() {
47623
- var _el$17 = createElement("text");
47624
- insert(_el$17, () => ` ${headline().right}`);
47625
- effect((_$p) => setProp(_el$17, "fg", delegationColor(status2()), _$p));
47626
- return _el$17;
48630
+ var _el$53 = createElement("text");
48631
+ insert(_el$53, () => ` ${headline().right}`);
48632
+ effect((_$p) => setProp(_el$53, "fg", delegationColor(status2()), _$p));
48633
+ return _el$53;
47627
48634
  }
47628
48635
  }), null);
47629
- insertNode(_el$18, _el$19);
47630
- setProp(_el$18, "style", {
48636
+ insertNode(_el$54, _el$55);
48637
+ setProp(_el$54, "style", {
47631
48638
  paddingLeft: 2
47632
48639
  });
47633
- insert(_el$19, () => truncateLine2([lane(), mode(), duration()].filter(Boolean).join(" \xB7 "), width()));
47634
- insert(_el$14, createComponent2(Show, {
48640
+ insert(_el$55, () => truncateLine2([lane(), mode(), duration()].filter(Boolean).join(" \xB7 "), width()));
48641
+ insert(_el$50, createComponent2(Show, {
47635
48642
  get when() {
47636
48643
  return expanded();
47637
48644
  },
@@ -47639,20 +48646,20 @@ function AgentTaskRow(props) {
47639
48646
  return createComponent2(ExpandedPanel, {
47640
48647
  get children() {
47641
48648
  return [(() => {
47642
- var _el$20 = createElement("text");
47643
- insert(_el$20, () => active() ? "live result" : "result");
47644
- effect((_$p) => setProp(_el$20, "fg", COLOR.dim, _$p));
47645
- return _el$20;
48649
+ var _el$56 = createElement("text");
48650
+ insert(_el$56, () => active() ? "live result" : "result");
48651
+ effect((_$p) => setProp(_el$56, "fg", COLOR.dim, _$p));
48652
+ return _el$56;
47646
48653
  })(), createComponent2(Show, {
47647
48654
  get when() {
47648
48655
  return result();
47649
48656
  },
47650
48657
  get fallback() {
47651
48658
  return (() => {
47652
- var _el$21 = createElement("text");
47653
- insert(_el$21, () => active() ? "work is still in progress" : "no result available");
47654
- effect((_$p) => setProp(_el$21, "fg", COLOR.dim, _$p));
47655
- return _el$21;
48659
+ var _el$57 = createElement("text");
48660
+ insert(_el$57, () => active() ? "work is still in progress" : "no result available");
48661
+ effect((_$p) => setProp(_el$57, "fg", COLOR.dim, _$p));
48662
+ return _el$57;
47656
48663
  })();
47657
48664
  },
47658
48665
  children: (value) => createComponent2(For, {
@@ -47661,10 +48668,10 @@ function AgentTaskRow(props) {
47661
48668
  `);
47662
48669
  },
47663
48670
  children: (line) => (() => {
47664
- var _el$22 = createElement("text");
47665
- insert(_el$22, line || " ");
47666
- effect((_$p) => setProp(_el$22, "fg", activity()?.error ? COLOR.error : COLOR.text, _$p));
47667
- return _el$22;
48671
+ var _el$58 = createElement("text");
48672
+ insert(_el$58, line || " ");
48673
+ effect((_$p) => setProp(_el$58, "fg", activity()?.error ? COLOR.error : COLOR.text, _$p));
48674
+ return _el$58;
47668
48675
  })()
47669
48676
  })
47670
48677
  }), createComponent2(Show, {
@@ -47672,27 +48679,27 @@ function AgentTaskRow(props) {
47672
48679
  return prompt();
47673
48680
  },
47674
48681
  children: (value) => (() => {
47675
- var _el$23 = createElement("box"), _el$24 = createElement("text");
47676
- insertNode(_el$23, _el$24);
47677
- setProp(_el$23, "style", {
48682
+ var _el$59 = createElement("box"), _el$60 = createElement("text");
48683
+ insertNode(_el$59, _el$60);
48684
+ setProp(_el$59, "style", {
47678
48685
  flexDirection: "column",
47679
48686
  paddingTop: 1
47680
48687
  });
47681
- insertNode(_el$24, createTextNode(`task`));
47682
- insert(_el$23, createComponent2(For, {
48688
+ insertNode(_el$60, createTextNode(`task`));
48689
+ insert(_el$59, createComponent2(For, {
47683
48690
  get each() {
47684
48691
  return value().split(`
47685
48692
  `);
47686
48693
  },
47687
48694
  children: (line) => (() => {
47688
- var _el$26 = createElement("text");
47689
- insert(_el$26, line || " ");
47690
- effect((_$p) => setProp(_el$26, "fg", COLOR.dim, _$p));
47691
- return _el$26;
48695
+ var _el$62 = createElement("text");
48696
+ insert(_el$62, line || " ");
48697
+ effect((_$p) => setProp(_el$62, "fg", COLOR.dim, _$p));
48698
+ return _el$62;
47692
48699
  })()
47693
48700
  }), null);
47694
- effect((_$p) => setProp(_el$24, "fg", COLOR.dim, _$p));
47695
- return _el$23;
48701
+ effect((_$p) => setProp(_el$60, "fg", COLOR.dim, _$p));
48702
+ return _el$59;
47696
48703
  })()
47697
48704
  })];
47698
48705
  }
@@ -47700,15 +48707,15 @@ function AgentTaskRow(props) {
47700
48707
  }
47701
48708
  }), null);
47702
48709
  effect((_p$) => {
47703
- var _v$ = delegationColor(status2()), _v$2 = COLOR.dim;
47704
- _v$ !== _p$.e && (_p$.e = setProp(_el$16, "fg", _v$, _p$.e));
47705
- _v$2 !== _p$.t && (_p$.t = setProp(_el$19, "fg", _v$2, _p$.t));
48710
+ var _v$8 = delegationColor(status2()), _v$9 = COLOR.dim;
48711
+ _v$8 !== _p$.e && (_p$.e = setProp(_el$52, "fg", _v$8, _p$.e));
48712
+ _v$9 !== _p$.t && (_p$.t = setProp(_el$55, "fg", _v$9, _p$.t));
47706
48713
  return _p$;
47707
48714
  }, {
47708
48715
  e: undefined,
47709
48716
  t: undefined
47710
48717
  });
47711
- return _el$14;
48718
+ return _el$50;
47712
48719
  })();
47713
48720
  }
47714
48721
  function delegationStatus(status2, metadataStatus, mode) {
@@ -47763,156 +48770,40 @@ function agentDuration(startedAt, completedAt) {
47763
48770
  const seconds = totalSeconds % 60;
47764
48771
  return `${minutes}m ${String(seconds).padStart(2, "0")}s`;
47765
48772
  }
47766
- function ExplorationRow(props) {
47767
- const tui = useTuiStore();
47768
- const dims = useTuiDimensions();
47769
- const expanded = () => Boolean(tui.store.ui.expandedCells[props.row.id]);
47770
- const active = () => isActiveToolStatus(props.row.status);
47771
- const toggleClick = createPrimaryClickGesture(() => tui.actions.cellExpandedToggle(props.row.id));
47772
- return (() => {
47773
- var _el$27 = createElement("box"), _el$28 = createElement("box"), _el$29 = createElement("text"), _el$30 = createElement("box");
47774
- insertNode(_el$27, _el$28);
47775
- insertNode(_el$27, _el$30);
47776
- setProp(_el$27, "style", {
47777
- flexDirection: "column",
47778
- marginBottom: 1
47779
- });
47780
- insertNode(_el$28, _el$29);
47781
- setProp(_el$28, "style", {
47782
- flexDirection: "row"
47783
- });
47784
- spread(_el$28, toggleClick, true);
47785
- insert(_el$28, createComponent2(TranscriptMarker, {
47786
- get color() {
47787
- return memo2(() => !!active())() ? COLOR.accent : COLOR.text;
47788
- },
47789
- get spinning() {
47790
- return active();
47791
- },
47792
- get animated() {
47793
- return props.animated;
47794
- }
47795
- }), _el$29);
47796
- insert(_el$29, () => active() ? "exploring" : "explored");
47797
- setProp(_el$30, "style", {
47798
- flexDirection: "column",
47799
- paddingLeft: 2
47800
- });
47801
- insert(_el$30, createComponent2(For, {
47802
- get each() {
47803
- return props.row.items;
47804
- },
47805
- children: (item, index) => createComponent2(ExplorationItemRow, {
47806
- item,
47807
- get expanded() {
47808
- return expanded();
47809
- },
47810
- get last() {
47811
- return index() === props.row.items.length - 1;
47812
- },
47813
- get width() {
47814
- return dims().width;
47815
- }
47816
- })
47817
- }));
47818
- effect((_$p) => setProp(_el$29, "fg", active() ? COLOR.accent : COLOR.text, _$p));
47819
- return _el$27;
47820
- })();
47821
- }
47822
- function ExplorationItemRow(props) {
47823
- return (() => {
47824
- var _el$31 = createElement("box"), _el$32 = createElement("text");
47825
- insertNode(_el$31, _el$32);
47826
- setProp(_el$31, "style", {
47827
- flexDirection: "column"
47828
- });
47829
- insert(_el$32, () => truncateLine2(`\u2514 ${props.item.verb} ${props.item.target}`, Math.max(1, props.width - 4)));
47830
- insert(_el$31, createComponent2(Show, {
47831
- get when() {
47832
- return props.expanded;
47833
- },
47834
- get children() {
47835
- return createComponent2(ExpandedPanel, {
47836
- get marginBottom() {
47837
- return props.last ? 0 : 1;
47838
- },
47839
- get children() {
47840
- return [(() => {
47841
- var _el$33 = createElement("text");
47842
- insertNode(_el$33, createTextNode(`result`));
47843
- effect((_$p) => setProp(_el$33, "fg", COLOR.dim, _$p));
47844
- return _el$33;
47845
- })(), createComponent2(Show, {
47846
- get when() {
47847
- return props.item.fullResult ?? props.item.result;
47848
- },
47849
- get fallback() {
47850
- return (() => {
47851
- var _el$35 = createElement("text");
47852
- insert(_el$35, () => isActiveToolStatus(props.item.status) ? "waiting for output" : "no output");
47853
- effect((_$p) => setProp(_el$35, "fg", COLOR.dim, _$p));
47854
- return _el$35;
47855
- })();
47856
- },
47857
- children: (result) => (() => {
47858
- var _el$36 = createElement("code");
47859
- setProp(_el$36, "filetype", "text");
47860
- effect((_p$) => {
47861
- var _v$3 = result(), _v$4 = syntax(), _v$5 = COLOR.text;
47862
- _v$3 !== _p$.e && (_p$.e = setProp(_el$36, "content", _v$3, _p$.e));
47863
- _v$4 !== _p$.t && (_p$.t = setProp(_el$36, "syntaxStyle", _v$4, _p$.t));
47864
- _v$5 !== _p$.a && (_p$.a = setProp(_el$36, "fg", _v$5, _p$.a));
47865
- return _p$;
47866
- }, {
47867
- e: undefined,
47868
- t: undefined,
47869
- a: undefined
47870
- });
47871
- return _el$36;
47872
- })()
47873
- })];
47874
- }
47875
- });
47876
- }
47877
- }), null);
47878
- effect((_$p) => setProp(_el$32, "fg", COLOR.dim, _$p));
47879
- return _el$31;
47880
- })();
47881
- }
47882
48773
  function ToolInput(props) {
47883
48774
  const path = String(props.input.path ?? props.input.file ?? props.input.filename ?? "");
47884
48775
  const kind = toolInputKind(props.tool, props.input);
47885
48776
  let body;
47886
48777
  if (kind === "shell") {
47887
48778
  body = (() => {
47888
- var _el$37 = createElement("code");
47889
- setProp(_el$37, "filetype", "bash");
48779
+ var _el$63 = createElement("code");
48780
+ setProp(_el$63, "filetype", "bash");
47890
48781
  effect((_p$) => {
47891
- var _v$6 = String(props.input.command ?? props.input.cmd ?? ""), _v$7 = syntax(), _v$8 = COLOR.text;
47892
- _v$6 !== _p$.e && (_p$.e = setProp(_el$37, "content", _v$6, _p$.e));
47893
- _v$7 !== _p$.t && (_p$.t = setProp(_el$37, "syntaxStyle", _v$7, _p$.t));
47894
- _v$8 !== _p$.a && (_p$.a = setProp(_el$37, "fg", _v$8, _p$.a));
48782
+ var _v$0 = String(props.input.command ?? props.input.cmd ?? ""), _v$1 = syntax(), _v$10 = COLOR.text;
48783
+ _v$0 !== _p$.e && (_p$.e = setProp(_el$63, "content", _v$0, _p$.e));
48784
+ _v$1 !== _p$.t && (_p$.t = setProp(_el$63, "syntaxStyle", _v$1, _p$.t));
48785
+ _v$10 !== _p$.a && (_p$.a = setProp(_el$63, "fg", _v$10, _p$.a));
47895
48786
  return _p$;
47896
48787
  }, {
47897
48788
  e: undefined,
47898
48789
  t: undefined,
47899
48790
  a: undefined
47900
48791
  });
47901
- return _el$37;
48792
+ return _el$63;
47902
48793
  })();
47903
48794
  } else if (kind === "edit") {
47904
48795
  body = (() => {
47905
- var _el$38 = createElement("diff");
47906
- setProp(_el$38, "view", "unified");
47907
- setProp(_el$38, "showLineNumbers", true);
48796
+ var _el$64 = createElement("diff");
48797
+ setProp(_el$64, "view", "unified");
48798
+ setProp(_el$64, "showLineNumbers", true);
47908
48799
  effect((_p$) => {
47909
- var _v$9 = unifiedEditDiff(path, String(props.input.oldString ?? ""), String(props.input.newString ?? "")), _v$0 = inferFiletype(path), _v$1 = syntax(), _v$10 = COLOR.diffAddedBg, _v$11 = COLOR.diffRemovedBg, _v$12 = COLOR.diffContextBg;
47910
- _v$9 !== _p$.e && (_p$.e = setProp(_el$38, "diff", _v$9, _p$.e));
47911
- _v$0 !== _p$.t && (_p$.t = setProp(_el$38, "filetype", _v$0, _p$.t));
47912
- _v$1 !== _p$.a && (_p$.a = setProp(_el$38, "syntaxStyle", _v$1, _p$.a));
47913
- _v$10 !== _p$.o && (_p$.o = setProp(_el$38, "addedBg", _v$10, _p$.o));
47914
- _v$11 !== _p$.i && (_p$.i = setProp(_el$38, "removedBg", _v$11, _p$.i));
47915
- _v$12 !== _p$.n && (_p$.n = setProp(_el$38, "contextBg", _v$12, _p$.n));
48800
+ var _v$11 = unifiedEditDiff(path, String(props.input.oldString ?? ""), String(props.input.newString ?? "")), _v$12 = inferFiletype(path), _v$13 = syntax(), _v$14 = COLOR.diffAddedBg, _v$15 = COLOR.diffRemovedBg, _v$16 = COLOR.diffContextBg;
48801
+ _v$11 !== _p$.e && (_p$.e = setProp(_el$64, "diff", _v$11, _p$.e));
48802
+ _v$12 !== _p$.t && (_p$.t = setProp(_el$64, "filetype", _v$12, _p$.t));
48803
+ _v$13 !== _p$.a && (_p$.a = setProp(_el$64, "syntaxStyle", _v$13, _p$.a));
48804
+ _v$14 !== _p$.o && (_p$.o = setProp(_el$64, "addedBg", _v$14, _p$.o));
48805
+ _v$15 !== _p$.i && (_p$.i = setProp(_el$64, "removedBg", _v$15, _p$.i));
48806
+ _v$16 !== _p$.n && (_p$.n = setProp(_el$64, "contextBg", _v$16, _p$.n));
47916
48807
  return _p$;
47917
48808
  }, {
47918
48809
  e: undefined,
@@ -47922,17 +48813,17 @@ function ToolInput(props) {
47922
48813
  i: undefined,
47923
48814
  n: undefined
47924
48815
  });
47925
- return _el$38;
48816
+ return _el$64;
47926
48817
  })();
47927
48818
  } else if (kind === "write") {
47928
48819
  body = (() => {
47929
- var _el$39 = createElement("code");
48820
+ var _el$65 = createElement("code");
47930
48821
  effect((_p$) => {
47931
- var _v$13 = String(props.input.content ?? ""), _v$14 = inferFiletype(path), _v$15 = syntax(), _v$16 = COLOR.text;
47932
- _v$13 !== _p$.e && (_p$.e = setProp(_el$39, "content", _v$13, _p$.e));
47933
- _v$14 !== _p$.t && (_p$.t = setProp(_el$39, "filetype", _v$14, _p$.t));
47934
- _v$15 !== _p$.a && (_p$.a = setProp(_el$39, "syntaxStyle", _v$15, _p$.a));
47935
- _v$16 !== _p$.o && (_p$.o = setProp(_el$39, "fg", _v$16, _p$.o));
48822
+ var _v$17 = String(props.input.content ?? ""), _v$18 = inferFiletype(path), _v$19 = syntax(), _v$20 = COLOR.text;
48823
+ _v$17 !== _p$.e && (_p$.e = setProp(_el$65, "content", _v$17, _p$.e));
48824
+ _v$18 !== _p$.t && (_p$.t = setProp(_el$65, "filetype", _v$18, _p$.t));
48825
+ _v$19 !== _p$.a && (_p$.a = setProp(_el$65, "syntaxStyle", _v$19, _p$.a));
48826
+ _v$20 !== _p$.o && (_p$.o = setProp(_el$65, "fg", _v$20, _p$.o));
47936
48827
  return _p$;
47937
48828
  }, {
47938
48829
  e: undefined,
@@ -47940,52 +48831,52 @@ function ToolInput(props) {
47940
48831
  a: undefined,
47941
48832
  o: undefined
47942
48833
  });
47943
- return _el$39;
48834
+ return _el$65;
47944
48835
  })();
47945
48836
  } else if (kind === "patch") {
47946
48837
  body = (() => {
47947
- var _el$40 = createElement("code");
47948
- setProp(_el$40, "filetype", "diff");
48838
+ var _el$66 = createElement("code");
48839
+ setProp(_el$66, "filetype", "diff");
47949
48840
  effect((_p$) => {
47950
- var _v$17 = String(props.input.patch ?? ""), _v$18 = syntax(), _v$19 = COLOR.text;
47951
- _v$17 !== _p$.e && (_p$.e = setProp(_el$40, "content", _v$17, _p$.e));
47952
- _v$18 !== _p$.t && (_p$.t = setProp(_el$40, "syntaxStyle", _v$18, _p$.t));
47953
- _v$19 !== _p$.a && (_p$.a = setProp(_el$40, "fg", _v$19, _p$.a));
48841
+ var _v$21 = String(props.input.patch ?? ""), _v$22 = syntax(), _v$23 = COLOR.text;
48842
+ _v$21 !== _p$.e && (_p$.e = setProp(_el$66, "content", _v$21, _p$.e));
48843
+ _v$22 !== _p$.t && (_p$.t = setProp(_el$66, "syntaxStyle", _v$22, _p$.t));
48844
+ _v$23 !== _p$.a && (_p$.a = setProp(_el$66, "fg", _v$23, _p$.a));
47954
48845
  return _p$;
47955
48846
  }, {
47956
48847
  e: undefined,
47957
48848
  t: undefined,
47958
48849
  a: undefined
47959
48850
  });
47960
- return _el$40;
48851
+ return _el$66;
47961
48852
  })();
47962
48853
  } else {
47963
48854
  body = (() => {
47964
- var _el$41 = createElement("box");
47965
- setProp(_el$41, "style", {
48855
+ var _el$67 = createElement("box");
48856
+ setProp(_el$67, "style", {
47966
48857
  flexDirection: "column"
47967
48858
  });
47968
- insert(_el$41, createComponent2(For, {
48859
+ insert(_el$67, createComponent2(For, {
47969
48860
  get each() {
47970
48861
  return toolInputDetailLines(props.input);
47971
48862
  },
47972
48863
  children: (line) => (() => {
47973
- var _el$42 = createElement("text");
47974
- insert(_el$42, line);
47975
- effect((_$p) => setProp(_el$42, "fg", COLOR.text, _$p));
47976
- return _el$42;
48864
+ var _el$68 = createElement("text");
48865
+ insert(_el$68, line);
48866
+ effect((_$p) => setProp(_el$68, "fg", COLOR.text, _$p));
48867
+ return _el$68;
47977
48868
  })()
47978
48869
  }));
47979
- return _el$41;
48870
+ return _el$67;
47980
48871
  })();
47981
48872
  }
47982
48873
  return (() => {
47983
- var _el$43 = createElement("box");
47984
- setProp(_el$43, "style", {
48874
+ var _el$69 = createElement("box");
48875
+ setProp(_el$69, "style", {
47985
48876
  flexDirection: "column"
47986
48877
  });
47987
- insert(_el$43, body);
47988
- return _el$43;
48878
+ insert(_el$69, body);
48879
+ return _el$69;
47989
48880
  })();
47990
48881
  }
47991
48882
  function ToolResult(props) {
@@ -47999,32 +48890,32 @@ function ToolResult(props) {
47999
48890
  const hasDiff = () => !hasNmap() && !hasDirs() && !hasHttp() && (looksLikeDiff(props.text) || shortToolName(props.tool).endsWith("diff"));
48000
48891
  const fallback = () => !hasNmap() && !hasDirs() && !hasHttp() && !hasDiff();
48001
48892
  return (() => {
48002
- var _el$44 = createElement("box");
48003
- setProp(_el$44, "style", {
48893
+ var _el$70 = createElement("box");
48894
+ setProp(_el$70, "style", {
48004
48895
  flexDirection: "column"
48005
48896
  });
48006
- insert(_el$44, createComponent2(Show, {
48897
+ insert(_el$70, createComponent2(Show, {
48007
48898
  get when() {
48008
48899
  return hasNmap();
48009
48900
  },
48010
48901
  get children() {
48011
- var _el$45 = createElement("code");
48012
- setProp(_el$45, "filetype", "text");
48902
+ var _el$71 = createElement("code");
48903
+ setProp(_el$71, "filetype", "text");
48013
48904
  effect((_p$) => {
48014
- var _v$20 = props.text, _v$21 = syntax(), _v$22 = COLOR.text;
48015
- _v$20 !== _p$.e && (_p$.e = setProp(_el$45, "content", _v$20, _p$.e));
48016
- _v$21 !== _p$.t && (_p$.t = setProp(_el$45, "syntaxStyle", _v$21, _p$.t));
48017
- _v$22 !== _p$.a && (_p$.a = setProp(_el$45, "fg", _v$22, _p$.a));
48905
+ var _v$24 = props.text, _v$25 = syntax(), _v$26 = COLOR.text;
48906
+ _v$24 !== _p$.e && (_p$.e = setProp(_el$71, "content", _v$24, _p$.e));
48907
+ _v$25 !== _p$.t && (_p$.t = setProp(_el$71, "syntaxStyle", _v$25, _p$.t));
48908
+ _v$26 !== _p$.a && (_p$.a = setProp(_el$71, "fg", _v$26, _p$.a));
48018
48909
  return _p$;
48019
48910
  }, {
48020
48911
  e: undefined,
48021
48912
  t: undefined,
48022
48913
  a: undefined
48023
48914
  });
48024
- return _el$45;
48915
+ return _el$71;
48025
48916
  }
48026
48917
  }), null);
48027
- insert(_el$44, createComponent2(Show, {
48918
+ insert(_el$70, createComponent2(Show, {
48028
48919
  get when() {
48029
48920
  return hasDirs();
48030
48921
  },
@@ -48034,47 +48925,47 @@ function ToolResult(props) {
48034
48925
  return dirs();
48035
48926
  },
48036
48927
  children: (row) => (() => {
48037
- var _el$51 = createElement("text");
48038
- insert(_el$51, () => `${String(row.status).padEnd(5)} ${String(row.size).padStart(8)} ${row.url}`);
48039
- effect((_$p) => setProp(_el$51, "fg", row.status < 400 ? COLOR.success : COLOR.warning, _$p));
48040
- return _el$51;
48928
+ var _el$77 = createElement("text");
48929
+ insert(_el$77, () => `${String(row.status).padEnd(5)} ${String(row.size).padStart(8)} ${row.url}`);
48930
+ effect((_$p) => setProp(_el$77, "fg", row.status < 400 ? COLOR.success : COLOR.warning, _$p));
48931
+ return _el$77;
48041
48932
  })()
48042
48933
  });
48043
48934
  }
48044
48935
  }), null);
48045
- insert(_el$44, createComponent2(Show, {
48936
+ insert(_el$70, createComponent2(Show, {
48046
48937
  get when() {
48047
48938
  return hasHttp();
48048
48939
  },
48049
48940
  get children() {
48050
48941
  return [(() => {
48051
- var _el$46 = createElement("text");
48052
- insert(_el$46, () => http().status ?? "HTTP response");
48053
- effect((_$p) => setProp(_el$46, "fg", COLOR.text, _$p));
48054
- return _el$46;
48942
+ var _el$72 = createElement("text");
48943
+ insert(_el$72, () => http().status ?? "HTTP response");
48944
+ effect((_$p) => setProp(_el$72, "fg", COLOR.text, _$p));
48945
+ return _el$72;
48055
48946
  })(), (() => {
48056
- var _el$47 = createElement("code");
48057
- setProp(_el$47, "filetype", "text");
48947
+ var _el$73 = createElement("code");
48948
+ setProp(_el$73, "filetype", "text");
48058
48949
  effect((_p$) => {
48059
- var _v$23 = http().headers, _v$24 = syntax(), _v$25 = COLOR.dim;
48060
- _v$23 !== _p$.e && (_p$.e = setProp(_el$47, "content", _v$23, _p$.e));
48061
- _v$24 !== _p$.t && (_p$.t = setProp(_el$47, "syntaxStyle", _v$24, _p$.t));
48062
- _v$25 !== _p$.a && (_p$.a = setProp(_el$47, "fg", _v$25, _p$.a));
48950
+ var _v$27 = http().headers, _v$28 = syntax(), _v$29 = COLOR.dim;
48951
+ _v$27 !== _p$.e && (_p$.e = setProp(_el$73, "content", _v$27, _p$.e));
48952
+ _v$28 !== _p$.t && (_p$.t = setProp(_el$73, "syntaxStyle", _v$28, _p$.t));
48953
+ _v$29 !== _p$.a && (_p$.a = setProp(_el$73, "fg", _v$29, _p$.a));
48063
48954
  return _p$;
48064
48955
  }, {
48065
48956
  e: undefined,
48066
48957
  t: undefined,
48067
48958
  a: undefined
48068
48959
  });
48069
- return _el$47;
48960
+ return _el$73;
48070
48961
  })(), (() => {
48071
- var _el$48 = createElement("code");
48962
+ var _el$74 = createElement("code");
48072
48963
  effect((_p$) => {
48073
- var _v$26 = http().body, _v$27 = inferFiletype(undefined, http().contentType), _v$28 = syntax(), _v$29 = COLOR.text;
48074
- _v$26 !== _p$.e && (_p$.e = setProp(_el$48, "content", _v$26, _p$.e));
48075
- _v$27 !== _p$.t && (_p$.t = setProp(_el$48, "filetype", _v$27, _p$.t));
48076
- _v$28 !== _p$.a && (_p$.a = setProp(_el$48, "syntaxStyle", _v$28, _p$.a));
48077
- _v$29 !== _p$.o && (_p$.o = setProp(_el$48, "fg", _v$29, _p$.o));
48964
+ var _v$30 = http().body, _v$31 = inferFiletype(undefined, http().contentType), _v$32 = syntax(), _v$33 = COLOR.text;
48965
+ _v$30 !== _p$.e && (_p$.e = setProp(_el$74, "content", _v$30, _p$.e));
48966
+ _v$31 !== _p$.t && (_p$.t = setProp(_el$74, "filetype", _v$31, _p$.t));
48967
+ _v$32 !== _p$.a && (_p$.a = setProp(_el$74, "syntaxStyle", _v$32, _p$.a));
48968
+ _v$33 !== _p$.o && (_p$.o = setProp(_el$74, "fg", _v$33, _p$.o));
48078
48969
  return _p$;
48079
48970
  }, {
48080
48971
  e: undefined,
@@ -48082,26 +48973,26 @@ function ToolResult(props) {
48082
48973
  a: undefined,
48083
48974
  o: undefined
48084
48975
  });
48085
- return _el$48;
48976
+ return _el$74;
48086
48977
  })()];
48087
48978
  }
48088
48979
  }), null);
48089
- insert(_el$44, createComponent2(Show, {
48980
+ insert(_el$70, createComponent2(Show, {
48090
48981
  get when() {
48091
48982
  return hasDiff();
48092
48983
  },
48093
48984
  get children() {
48094
- var _el$49 = createElement("diff");
48095
- setProp(_el$49, "showLineNumbers", true);
48985
+ var _el$75 = createElement("diff");
48986
+ setProp(_el$75, "showLineNumbers", true);
48096
48987
  effect((_p$) => {
48097
- var _v$30 = props.text.replace(/^```diff\n?|```$/g, ""), _v$31 = inferFiletype(path()), _v$32 = props.width > 120 ? "split" : "unified", _v$33 = syntax(), _v$34 = COLOR.diffAddedBg, _v$35 = COLOR.diffRemovedBg, _v$36 = COLOR.diffContextBg;
48098
- _v$30 !== _p$.e && (_p$.e = setProp(_el$49, "diff", _v$30, _p$.e));
48099
- _v$31 !== _p$.t && (_p$.t = setProp(_el$49, "filetype", _v$31, _p$.t));
48100
- _v$32 !== _p$.a && (_p$.a = setProp(_el$49, "view", _v$32, _p$.a));
48101
- _v$33 !== _p$.o && (_p$.o = setProp(_el$49, "syntaxStyle", _v$33, _p$.o));
48102
- _v$34 !== _p$.i && (_p$.i = setProp(_el$49, "addedBg", _v$34, _p$.i));
48103
- _v$35 !== _p$.n && (_p$.n = setProp(_el$49, "removedBg", _v$35, _p$.n));
48104
- _v$36 !== _p$.s && (_p$.s = setProp(_el$49, "contextBg", _v$36, _p$.s));
48988
+ var _v$34 = props.text.replace(/^```diff\n?|```$/g, ""), _v$35 = inferFiletype(path()), _v$36 = props.width > 120 ? "split" : "unified", _v$37 = syntax(), _v$38 = COLOR.diffAddedBg, _v$39 = COLOR.diffRemovedBg, _v$40 = COLOR.diffContextBg;
48989
+ _v$34 !== _p$.e && (_p$.e = setProp(_el$75, "diff", _v$34, _p$.e));
48990
+ _v$35 !== _p$.t && (_p$.t = setProp(_el$75, "filetype", _v$35, _p$.t));
48991
+ _v$36 !== _p$.a && (_p$.a = setProp(_el$75, "view", _v$36, _p$.a));
48992
+ _v$37 !== _p$.o && (_p$.o = setProp(_el$75, "syntaxStyle", _v$37, _p$.o));
48993
+ _v$38 !== _p$.i && (_p$.i = setProp(_el$75, "addedBg", _v$38, _p$.i));
48994
+ _v$39 !== _p$.n && (_p$.n = setProp(_el$75, "removedBg", _v$39, _p$.n));
48995
+ _v$40 !== _p$.s && (_p$.s = setProp(_el$75, "contextBg", _v$40, _p$.s));
48105
48996
  return _p$;
48106
48997
  }, {
48107
48998
  e: undefined,
@@ -48112,21 +49003,21 @@ function ToolResult(props) {
48112
49003
  n: undefined,
48113
49004
  s: undefined
48114
49005
  });
48115
- return _el$49;
49006
+ return _el$75;
48116
49007
  }
48117
49008
  }), null);
48118
- insert(_el$44, createComponent2(Show, {
49009
+ insert(_el$70, createComponent2(Show, {
48119
49010
  get when() {
48120
49011
  return fallback();
48121
49012
  },
48122
49013
  get children() {
48123
- var _el$50 = createElement("code");
49014
+ var _el$76 = createElement("code");
48124
49015
  effect((_p$) => {
48125
- var _v$37 = props.text, _v$38 = resultFiletype(props.text, path()), _v$39 = syntax(), _v$40 = COLOR.text;
48126
- _v$37 !== _p$.e && (_p$.e = setProp(_el$50, "content", _v$37, _p$.e));
48127
- _v$38 !== _p$.t && (_p$.t = setProp(_el$50, "filetype", _v$38, _p$.t));
48128
- _v$39 !== _p$.a && (_p$.a = setProp(_el$50, "syntaxStyle", _v$39, _p$.a));
48129
- _v$40 !== _p$.o && (_p$.o = setProp(_el$50, "fg", _v$40, _p$.o));
49016
+ var _v$41 = props.text, _v$42 = resultFiletype(props.text, path()), _v$43 = syntax(), _v$44 = COLOR.text;
49017
+ _v$41 !== _p$.e && (_p$.e = setProp(_el$76, "content", _v$41, _p$.e));
49018
+ _v$42 !== _p$.t && (_p$.t = setProp(_el$76, "filetype", _v$42, _p$.t));
49019
+ _v$43 !== _p$.a && (_p$.a = setProp(_el$76, "syntaxStyle", _v$43, _p$.a));
49020
+ _v$44 !== _p$.o && (_p$.o = setProp(_el$76, "fg", _v$44, _p$.o));
48130
49021
  return _p$;
48131
49022
  }, {
48132
49023
  e: undefined,
@@ -48134,10 +49025,10 @@ function ToolResult(props) {
48134
49025
  a: undefined,
48135
49026
  o: undefined
48136
49027
  });
48137
- return _el$50;
49028
+ return _el$76;
48138
49029
  }
48139
49030
  }), null);
48140
- return _el$44;
49031
+ return _el$70;
48141
49032
  })();
48142
49033
  }
48143
49034
  function previewOutputLines(text, limit) {
@@ -48215,10 +49106,15 @@ function resultFiletype(text, path) {
48215
49106
  function mcpContentLines(result) {
48216
49107
  if (!result || typeof result !== "object")
48217
49108
  return [];
48218
- const content = result.content;
48219
- if (!Array.isArray(content))
48220
- return [JSON.stringify(result)];
48221
- return content.map(mcpContentLine).filter((line) => line.trim().length > 0);
49109
+ const record2 = result;
49110
+ const content = record2.content;
49111
+ const contentLines = Array.isArray(content) ? content.map(mcpContentLine).filter((line) => line.trim().length > 0) : [];
49112
+ const structured = record2.structuredContent;
49113
+ const structuredLines = structured === undefined ? [] : semanticValueLines("structured content", structured, 0);
49114
+ const errorLine = record2.isError === true ? ["mcp result reported an error"] : [];
49115
+ if (contentLines.length || structuredLines.length || errorLine.length)
49116
+ return [...errorLine, ...contentLines, ...structuredLines];
49117
+ return Object.entries(record2).flatMap(([key, value]) => semanticValueLines(key, value, 0));
48222
49118
  }
48223
49119
  function mcpContentLine(part) {
48224
49120
  if (!part || typeof part !== "object" || Array.isArray(part))
@@ -48249,6 +49145,9 @@ function mcpContentLine(part) {
48249
49145
  return String(record2);
48250
49146
  }
48251
49147
  }
49148
+ function attachmentBytes(data) {
49149
+ return Uint8Array.from(Buffer.from(data, "base64"));
49150
+ }
48252
49151
  var TOOL_OUTPUT_PREVIEW_LINES = 5;
48253
49152
  var init_tool_cell = __esm(() => {
48254
49153
  init_solid2();
@@ -48268,6 +49167,7 @@ var init_tool_cell = __esm(() => {
48268
49167
  init_terminal();
48269
49168
  init_store4();
48270
49169
  init_tool_presentation();
49170
+ init_tool_activity();
48271
49171
  init_session_title();
48272
49172
  init_expanded_panel();
48273
49173
  init_transcript_marker();
@@ -48903,112 +49803,16 @@ var init_progress_cell = __esm(() => {
48903
49803
 
48904
49804
  // src/agent-tui/transcript/cells.tsx
48905
49805
  function FaraiRow(props) {
48906
- switch (props.row.kind) {
48907
- case "user":
48908
- return createComponent2(UserPrompt, {
48909
- get row() {
48910
- return props.row;
48911
- }
48912
- });
48913
- case "assistant":
48914
- return createComponent2(AssistantMessage, {
48915
- get row() {
48916
- return props.row;
48917
- },
48918
- get streamedText() {
48919
- return props.streamedText;
48920
- }
48921
- });
48922
- case "thinking":
48923
- return createComponent2(ReasoningRow, {
48924
- get row() {
48925
- return props.row;
48926
- },
48927
- get streamedReasoning() {
48928
- return props.streamedReasoning;
48929
- },
48930
- get animated() {
48931
- return props.animated;
48932
- }
48933
- });
48934
- case "tool":
48935
- return createComponent2(ToolRow, {
48936
- get row() {
48937
- return props.row;
48938
- },
48939
- get animated() {
48940
- return props.animated;
48941
- }
48942
- });
48943
- case "exploration":
48944
- return createComponent2(ExplorationRow, {
48945
- get row() {
48946
- return props.row;
48947
- },
48948
- get animated() {
48949
- return props.animated;
48950
- }
48951
- });
48952
- case "plan":
48953
- return createComponent2(PlanRow, {
48954
- get row() {
48955
- return props.row;
48956
- },
48957
- get animated() {
48958
- return props.animated;
48959
- }
48960
- });
48961
- case "todo_list":
48962
- return createComponent2(TodoListRow, {
48963
- get row() {
48964
- return props.row;
48965
- }
48966
- });
48967
- case "mcp_inventory":
48968
- return createComponent2(McpInventoryRow, {
48969
- get row() {
48970
- return props.row;
48971
- }
48972
- });
48973
- case "artifact":
48974
- return createComponent2(ArtifactRow, {
48975
- get row() {
48976
- return props.row;
48977
- }
48978
- });
48979
- case "finding":
48980
- return createComponent2(FindingRow, {
48981
- get row() {
48982
- return props.row;
48983
- }
48984
- });
48985
- case "progress":
48986
- return createComponent2(ProgressRow, {
48987
- get row() {
48988
- return props.row;
48989
- },
48990
- get animated() {
48991
- return props.animated;
48992
- }
48993
- });
48994
- case "phase":
48995
- return createComponent2(PhaseRow, {
48996
- get row() {
48997
- return props.row;
48998
- }
48999
- });
49000
- case "loop_stop":
49001
- case "compaction":
49002
- case "error":
49003
- case "notice":
49004
- return createComponent2(NoticeRow, {
49005
- get row() {
49006
- return props.row;
49007
- }
49008
- });
49009
- }
49806
+ return createComponent2(Dynamic, mergeProps3({
49807
+ get component() {
49808
+ return ROW_COMPONENTS[props.row.kind];
49809
+ }
49810
+ }, props));
49010
49811
  }
49812
+ var ROW_COMPONENTS;
49011
49813
  var init_cells = __esm(() => {
49814
+ init_solid2();
49815
+ init_solid2();
49012
49816
  init_solid2();
49013
49817
  init_user_cell();
49014
49818
  init_assistant_cell();
@@ -49019,6 +49823,109 @@ var init_cells = __esm(() => {
49019
49823
  init_plan_cell();
49020
49824
  init_todo_list_cell();
49021
49825
  init_progress_cell();
49826
+ ROW_COMPONENTS = {
49827
+ user: (props) => createComponent2(UserPrompt, {
49828
+ get row() {
49829
+ return props.row;
49830
+ }
49831
+ }),
49832
+ assistant: (props) => createComponent2(AssistantMessage, {
49833
+ get row() {
49834
+ return props.row;
49835
+ },
49836
+ get streamedText() {
49837
+ return props.streamedText;
49838
+ }
49839
+ }),
49840
+ thinking: (props) => createComponent2(ReasoningRow, {
49841
+ get row() {
49842
+ return props.row;
49843
+ },
49844
+ get streamedReasoning() {
49845
+ return props.streamedReasoning;
49846
+ },
49847
+ get animated() {
49848
+ return props.animated;
49849
+ }
49850
+ }),
49851
+ tool: (props) => createComponent2(ToolRow, {
49852
+ get row() {
49853
+ return props.row;
49854
+ },
49855
+ get animated() {
49856
+ return props.animated;
49857
+ }
49858
+ }),
49859
+ activity: (props) => createComponent2(ActivityRow, {
49860
+ get row() {
49861
+ return props.row;
49862
+ },
49863
+ get animated() {
49864
+ return props.animated;
49865
+ }
49866
+ }),
49867
+ plan: (props) => createComponent2(PlanRow, {
49868
+ get row() {
49869
+ return props.row;
49870
+ },
49871
+ get animated() {
49872
+ return props.animated;
49873
+ }
49874
+ }),
49875
+ todo_list: (props) => createComponent2(TodoListRow, {
49876
+ get row() {
49877
+ return props.row;
49878
+ }
49879
+ }),
49880
+ mcp_inventory: (props) => createComponent2(McpInventoryRow, {
49881
+ get row() {
49882
+ return props.row;
49883
+ }
49884
+ }),
49885
+ artifact: (props) => createComponent2(ArtifactRow, {
49886
+ get row() {
49887
+ return props.row;
49888
+ }
49889
+ }),
49890
+ finding: (props) => createComponent2(FindingRow, {
49891
+ get row() {
49892
+ return props.row;
49893
+ }
49894
+ }),
49895
+ progress: (props) => createComponent2(ProgressRow, {
49896
+ get row() {
49897
+ return props.row;
49898
+ },
49899
+ get animated() {
49900
+ return props.animated;
49901
+ }
49902
+ }),
49903
+ phase: (props) => createComponent2(PhaseRow, {
49904
+ get row() {
49905
+ return props.row;
49906
+ }
49907
+ }),
49908
+ loop_stop: (props) => createComponent2(NoticeRow, {
49909
+ get row() {
49910
+ return props.row;
49911
+ }
49912
+ }),
49913
+ compaction: (props) => createComponent2(NoticeRow, {
49914
+ get row() {
49915
+ return props.row;
49916
+ }
49917
+ }),
49918
+ error: (props) => createComponent2(NoticeRow, {
49919
+ get row() {
49920
+ return props.row;
49921
+ }
49922
+ }),
49923
+ notice: (props) => createComponent2(NoticeRow, {
49924
+ get row() {
49925
+ return props.row;
49926
+ }
49927
+ })
49928
+ };
49022
49929
  });
49023
49930
 
49024
49931
  // src/agent-tui/transcript/transcript.tsx
@@ -49271,7 +50178,28 @@ function nextNavigationIndex(direction, currentIndex, itemCount) {
49271
50178
  return Math.max(0, currentIndex - 1);
49272
50179
  }
49273
50180
  function timelineRowsEqual(left, right) {
49274
- return left.kind === right.kind && left.id === right.id && valuesEqual(left, right, new WeakMap);
50181
+ if (left.kind !== right.kind || left.id !== right.id)
50182
+ return false;
50183
+ if (left.kind === "tool" && right.kind === "tool")
50184
+ return toolRowsEqual(left, right);
50185
+ if (left.kind === "activity" && right.kind === "activity") {
50186
+ if (left.status !== right.status || left.label !== right.label || left.durationMs !== right.durationMs || left.items.length !== right.items.length)
50187
+ return false;
50188
+ return left.items.every((item, index) => toolRowsEqual(item, right.items[index]));
50189
+ }
50190
+ return valuesEqual(left, right, new WeakMap);
50191
+ }
50192
+ function toolRowsEqual(left, right) {
50193
+ return left.id === right.id && left.tool === right.tool && left.status === right.status && left.liveOutput === right.liveOutput && left.result === right.result && left.fullResult === right.fullResult && left.processId === right.processId && left.jobId === right.jobId && left.toolCallId === right.toolCallId && left.durationMs === right.durationMs && presentationEqual(left.presentation, right.presentation) && valuesEqual(left.args, right.args, new WeakMap) && valuesEqual(left.toolResult, right.toolResult, new WeakMap) && valuesEqual(left.mcp, right.mcp, new WeakMap);
50194
+ }
50195
+ function presentationEqual(left, right) {
50196
+ if (left === right)
50197
+ return true;
50198
+ if (!left || !right)
50199
+ return false;
50200
+ if (left.family !== right.family || left.title !== right.title || left.compact !== right.compact || left.outcome !== right.outcome || left.groupKey !== right.groupKey || left.groupPast !== right.groupPast || left.groupActive !== right.groupActive || left.standalone !== right.standalone || left.warning !== right.warning || left.preview.length !== right.preview.length)
50201
+ return false;
50202
+ return left.preview.every((line, index) => line === right.preview[index]);
49275
50203
  }
49276
50204
  function valuesEqual(left, right, seen) {
49277
50205
  if (Object.is(left, right))
@@ -49311,11 +50239,12 @@ function valuesEqual(left, right, seen) {
49311
50239
  return true;
49312
50240
  }
49313
50241
  function TranscriptRow(props) {
50242
+ const row = () => normalizeTimelineRow(props.row);
49314
50243
  return (() => {
49315
50244
  var _el$9 = createElement("box");
49316
50245
  insert(_el$9, createComponent2(FaraiRow, {
49317
50246
  get row() {
49318
- return props.row;
50247
+ return row();
49319
50248
  },
49320
50249
  get streamedText() {
49321
50250
  return props.streamedText;
@@ -49328,10 +50257,10 @@ function TranscriptRow(props) {
49328
50257
  }
49329
50258
  }));
49330
50259
  effect((_p$) => {
49331
- var _v$3 = props.row.id, _v$4 = {
50260
+ var _v$3 = row().id, _v$4 = {
49332
50261
  flexDirection: "column",
49333
50262
  flexShrink: 0,
49334
- paddingRight: props.row.kind === "user" ? 0 : 1
50263
+ paddingRight: row().kind === "user" ? 0 : 1
49335
50264
  };
49336
50265
  _v$3 !== _p$.e && (_p$.e = setProp(_el$9, "id", _v$3, _p$.e));
49337
50266
  _v$4 !== _p$.t && (_p$.t = setProp(_el$9, "style", _v$4, _p$.t));
@@ -49343,6 +50272,22 @@ function TranscriptRow(props) {
49343
50272
  return _el$9;
49344
50273
  })();
49345
50274
  }
50275
+ function normalizeTimelineRow(row) {
50276
+ if (row.kind === "tool" && !row.presentation)
50277
+ return {
50278
+ ...row,
50279
+ presentation: presentToolActivity(row)
50280
+ };
50281
+ if (row.kind !== "activity" || row.items.every((item) => item.presentation))
50282
+ return row;
50283
+ return {
50284
+ ...row,
50285
+ items: row.items.map((item) => item.presentation ? item : {
50286
+ ...item,
50287
+ presentation: presentToolActivity(item)
50288
+ })
50289
+ };
50290
+ }
49346
50291
  var init_transcript = __esm(() => {
49347
50292
  init_solid2();
49348
50293
  init_solid2();
@@ -49359,26 +50304,36 @@ var init_transcript = __esm(() => {
49359
50304
  init_cells();
49360
50305
  init_branding();
49361
50306
  init_terminal();
50307
+ init_tool_activity();
49362
50308
  });
49363
50309
 
49364
50310
  // src/agent-tui/surfaces/center-surface.tsx
49365
50311
  function CenterSurfaceView(props) {
49366
50312
  const tui = useTuiStore();
49367
50313
  const dims = useTuiDimensions();
49368
- const loader = createSurfaceLoader(() => props.frame);
49369
- const title = () => surfaceTitle(props.frame);
49370
- const kindLabel = () => props.frame.kind;
49371
- const subtitle = () => surfaceSubtitle(props.frame);
50314
+ const frame = () => props.frame();
50315
+ const loader = createSurfaceLoader(frame);
50316
+ const title = () => surfaceTitle(frame());
50317
+ const kindLabel = () => frame().kind;
50318
+ const subtitle = () => surfaceSubtitle(frame());
49372
50319
  const compact = () => dims().height < 16;
49373
50320
  const header = () => fitTerminalPair(title(), kindLabel(), Math.max(1, dims().width - 6), 4, 2);
49374
50321
  let scrollRef;
49375
50322
  let lastScrollSequence = 0;
50323
+ createEffect(on(frame, () => {
50324
+ lastScrollSequence = 0;
50325
+ queueMicrotask(() => {
50326
+ if (!scrollRef || scrollRef.isDestroyed || frame().kind === "proxy_flow")
50327
+ return;
50328
+ scrollRef.scrollTo(0);
50329
+ });
50330
+ }));
49376
50331
  createEffect(() => {
49377
50332
  const request = tui.store.ui.centerScroll;
49378
50333
  if (request.sequence === 0 || request.sequence === lastScrollSequence)
49379
50334
  return;
49380
50335
  lastScrollSequence = request.sequence;
49381
- if (!scrollRef || untrack(() => props.frame.kind) === "proxy_flow")
50336
+ if (!scrollRef || untrack(() => frame().kind) === "proxy_flow")
49382
50337
  return;
49383
50338
  applyScroll(scrollRef, request.action);
49384
50339
  });
@@ -49421,7 +50376,7 @@ function CenterSurfaceView(props) {
49421
50376
  }), null);
49422
50377
  insert(_el$, createComponent2(Show, {
49423
50378
  get when() {
49424
- return props.frame.kind === "proxy_flow";
50379
+ return frame().kind === "proxy_flow";
49425
50380
  },
49426
50381
  get fallback() {
49427
50382
  return (() => {
@@ -49438,6 +50393,7 @@ function CenterSurfaceView(props) {
49438
50393
  get fallback() {
49439
50394
  return (() => {
49440
50395
  var _el$1 = createElement("code");
50396
+ setProp(_el$1, "id", "center-surface-code");
49441
50397
  effect((_p$) => {
49442
50398
  var _v$5 = loader.body(), _v$6 = loader.filetype(), _v$7 = syntax(), _v$8 = COLOR.text;
49443
50399
  _v$5 !== _p$.e && (_p$.e = setProp(_el$1, "content", _v$5, _p$.e));
@@ -49456,10 +50412,10 @@ function CenterSurfaceView(props) {
49456
50412
  },
49457
50413
  get children() {
49458
50414
  return createComponent2(MarkdownView, {
50415
+ id: "center-surface-markdown",
49459
50416
  get content() {
49460
50417
  return loader.body();
49461
- },
49462
- variant: "document"
50418
+ }
49463
50419
  });
49464
50420
  }
49465
50421
  }));
@@ -49475,7 +50431,7 @@ function CenterSurfaceView(props) {
49475
50431
  get children() {
49476
50432
  return createComponent2(ProxyFlowSplitView, {
49477
50433
  get flow() {
49478
- return props.frame.flow;
50434
+ return frame().flow;
49479
50435
  },
49480
50436
  get compact() {
49481
50437
  return compact();
@@ -50946,7 +51902,7 @@ function statusColor(status2) {
50946
51902
  return COLOR.accent;
50947
51903
  return COLOR.success;
50948
51904
  }
50949
- function formatBytes(value) {
51905
+ function formatBytes2(value) {
50950
51906
  if (value === undefined)
50951
51907
  return "-";
50952
51908
  if (value < 1024)
@@ -51112,7 +52068,7 @@ function ProxyRow(props) {
51112
52068
  })(), (() => {
51113
52069
  var _el$36 = createElement("text");
51114
52070
  setProp(_el$36, "selectable", false);
51115
- insert(_el$36, () => pad(formatBytes(props.flow.responseBytes ?? props.flow.requestBytes), 8));
52071
+ insert(_el$36, () => pad(formatBytes2(props.flow.responseBytes ?? props.flow.requestBytes), 8));
51116
52072
  effect((_$p) => setProp(_el$36, "fg", COLOR.dim, _$p));
51117
52073
  return _el$36;
51118
52074
  })(), (() => {
@@ -51167,9 +52123,46 @@ var init_command_registry_signal = __esm(() => {
51167
52123
  });
51168
52124
 
51169
52125
  // src/agent-tui/bottom-pane/composer.tsx
52126
+ import { RGBA } from "@opentui/core";
51170
52127
  function composerHeightFromVisualLines(visualLines) {
51171
52128
  return Math.min(6, Math.max(1, visualLines));
51172
52129
  }
52130
+ function composerFocusTintColor(progress) {
52131
+ const amount = Math.max(0, Math.min(1, progress));
52132
+ return RGBA.fromInts(Math.round(focusTintStart[0] + (focusTintEnd[0] - focusTintStart[0]) * amount), Math.round(focusTintStart[1] + (focusTintEnd[1] - focusTintStart[1]) * amount), Math.round(focusTintStart[2] + (focusTintEnd[2] - focusTintStart[2]) * amount));
52133
+ }
52134
+ function composerFocusTintPalette(size) {
52135
+ const cached = focusTintPalettes.get(size);
52136
+ if (cached)
52137
+ return cached;
52138
+ const palette = Array.from({
52139
+ length: size
52140
+ }, (_, index) => composerFocusTintColor(size <= 1 ? 0 : index / (size - 1)));
52141
+ focusTintPalettes.set(size, palette);
52142
+ return palette;
52143
+ }
52144
+ function composerEdgeRun(width) {
52145
+ const cached = composerEdgeRuns.get(width);
52146
+ if (cached)
52147
+ return cached;
52148
+ const run2 = {
52149
+ top: "\u2584".repeat(width),
52150
+ bottom: "\u2580".repeat(width)
52151
+ };
52152
+ composerEdgeRuns.set(width, run2);
52153
+ return run2;
52154
+ }
52155
+ function paintComposerBand(buffer, x, y, width, height, color) {
52156
+ if (height <= 1) {
52157
+ buffer.fillRect(x, y, width, height, color);
52158
+ return;
52159
+ }
52160
+ const edge = composerEdgeRun(width);
52161
+ buffer.drawText(edge.top, x, y, color, composerPageBackground);
52162
+ if (height > 2)
52163
+ buffer.fillRect(x, y + 1, width, height - 2, color);
52164
+ buffer.drawText(edge.bottom, x, y + height - 1, color, composerPageBackground);
52165
+ }
51173
52166
  function Composer(props = {}) {
51174
52167
  const tui = useTuiStore();
51175
52168
  const composer = useComposerControl();
@@ -51212,7 +52205,23 @@ function Composer(props = {}) {
51212
52205
  const popupWidth = () => Math.max(1, dims().width);
51213
52206
  const commandWidth = () => Math.min(Math.max(1, popupWidth() - 2), Math.min(28, Math.max(8, ...slashOptions().map((option) => terminalWidth(option.title) + 2))));
51214
52207
  const descWidth = () => Math.max(0, popupWidth() - commandWidth() - 2);
51215
- const rule = () => "\u2500".repeat(Math.max(1, dims().width));
52208
+ const paintComposerBackground = function(buffer) {
52209
+ const width = Math.max(1, Math.floor(this.width));
52210
+ const height = Math.max(1, Math.floor(this.height));
52211
+ const x = Math.floor(this.x);
52212
+ const y = Math.floor(this.y);
52213
+ if (!inputActive()) {
52214
+ paintComposerBand(buffer, x, y, width, height, inactiveComposerBackground);
52215
+ return;
52216
+ }
52217
+ const bands = Math.min(width, 48);
52218
+ const palette = composerFocusTintPalette(bands);
52219
+ for (let band = 0;band < bands; band += 1) {
52220
+ const left = Math.floor(band * width / bands);
52221
+ const right = Math.floor((band + 1) * width / bands);
52222
+ paintComposerBand(buffer, x + left, y, Math.max(1, right - left), height, palette[band]);
52223
+ }
52224
+ };
51216
52225
  createEffect(() => {
51217
52226
  dims().width;
51218
52227
  if (surfaceVisible())
@@ -51229,6 +52238,7 @@ function Composer(props = {}) {
51229
52238
  textareaRef.focus();
51230
52239
  else
51231
52240
  textareaRef.blur();
52241
+ renderer.requestRender();
51232
52242
  });
51233
52243
  onMount(() => {
51234
52244
  const draft = composer.text();
@@ -51259,29 +52269,36 @@ function Composer(props = {}) {
51259
52269
  textareaRef?.blur();
51260
52270
  });
51261
52271
  return (() => {
51262
- var _el$ = createElement("box"), _el$2 = createElement("text"), _el$3 = createElement("box"), _el$4 = createElement("text"), _el$6 = createElement("textarea"), _el$8 = createElement("text");
52272
+ var _el$ = createElement("box"), _el$2 = createElement("box"), _el$3 = createElement("box"), _el$4 = createElement("box"), _el$5 = createElement("textarea");
51263
52273
  insertNode(_el$, _el$2);
51264
- insertNode(_el$, _el$3);
51265
- insertNode(_el$, _el$8);
51266
52274
  setProp(_el$, "id", "composer-surface");
51267
52275
  setProp(_el$, "style", {
51268
52276
  flexShrink: 0,
51269
52277
  flexDirection: "column",
51270
52278
  paddingTop: 0
51271
52279
  });
51272
- insert(_el$2, rule);
51273
- insertNode(_el$3, _el$4);
51274
- insertNode(_el$3, _el$6);
51275
- insertNode(_el$4, createTextNode(`\u203A `));
52280
+ insertNode(_el$2, _el$3);
52281
+ insertNode(_el$2, _el$4);
52282
+ setProp(_el$3, "shouldFill", false);
52283
+ setProp(_el$3, "renderBefore", paintComposerBackground);
52284
+ setProp(_el$3, "style", {
52285
+ position: "absolute",
52286
+ left: 0,
52287
+ top: 0,
52288
+ width: "100%",
52289
+ height: "100%",
52290
+ zIndex: 0
52291
+ });
52292
+ insertNode(_el$4, _el$5);
51276
52293
  use((node) => {
51277
52294
  textareaRef = node;
51278
52295
  composer.setRef(node);
51279
52296
  scheduleComposerHeightRefresh();
51280
- }, _el$6);
51281
- setProp(_el$6, "id", "composer-input");
51282
- setProp(_el$6, "placeholder", "ask farai to do anything");
51283
- setProp(_el$6, "wrapMode", "word");
51284
- setProp(_el$6, "onContentChange", () => {
52297
+ }, _el$5);
52298
+ setProp(_el$5, "id", "composer-input");
52299
+ setProp(_el$5, "placeholder", "what should we investigate?");
52300
+ setProp(_el$5, "wrapMode", "word");
52301
+ setProp(_el$5, "onContentChange", () => {
51285
52302
  const value = textareaRef?.plainText ?? "";
51286
52303
  composer.setText(value);
51287
52304
  if (tui.store.ui.lastError)
@@ -51299,8 +52316,8 @@ function Composer(props = {}) {
51299
52316
  return slashActive2();
51300
52317
  },
51301
52318
  get children() {
51302
- var _el$7 = createElement("box");
51303
- insert(_el$7, createComponent2(For, {
52319
+ var _el$6 = createElement("box");
52320
+ insert(_el$6, createComponent2(For, {
51304
52321
  get each() {
51305
52322
  return slashMatches2();
51306
52323
  },
@@ -51309,71 +52326,76 @@ function Composer(props = {}) {
51309
52326
  const command = () => fitTerminal(option.title, commandWidth());
51310
52327
  const desc = () => descWidth() >= 8 ? truncateLine2(option.description ?? "", descWidth()) : "";
51311
52328
  return (() => {
51312
- var _el$9 = createElement("box"), _el$0 = createElement("text"), _el$1 = createElement("text"), _el$10 = createElement("text");
51313
- insertNode(_el$9, _el$0);
51314
- insertNode(_el$9, _el$1);
51315
- insertNode(_el$9, _el$10);
51316
- setProp(_el$9, "style", {
52329
+ var _el$7 = createElement("box"), _el$8 = createElement("text"), _el$9 = createElement("text"), _el$0 = createElement("text");
52330
+ insertNode(_el$7, _el$8);
52331
+ insertNode(_el$7, _el$9);
52332
+ insertNode(_el$7, _el$0);
52333
+ setProp(_el$7, "style", {
51317
52334
  flexDirection: "row"
51318
52335
  });
51319
- setProp(_el$9, "onMouseUp", (event) => {
52336
+ setProp(_el$7, "onMouseUp", (event) => {
51320
52337
  if (!isPrimaryClick(event))
51321
52338
  return;
51322
52339
  composer.setDraft(`${option.title} `);
51323
52340
  tui.actions.slashSuppress(undefined);
51324
52341
  composer.focus();
51325
52342
  });
52343
+ setProp(_el$8, "selectable", false);
52344
+ insert(_el$8, () => active() ? "\u203A " : " ");
52345
+ setProp(_el$9, "selectable", false);
52346
+ insert(_el$9, command);
51326
52347
  setProp(_el$0, "selectable", false);
51327
- insert(_el$0, () => active() ? "\u203A " : " ");
51328
- setProp(_el$1, "selectable", false);
51329
- insert(_el$1, command);
51330
- setProp(_el$10, "selectable", false);
51331
- insert(_el$10, desc);
52348
+ insert(_el$0, desc);
51332
52349
  effect((_p$) => {
51333
- var _v$1 = active() ? COLOR.accent : COLOR.dim, _v$10 = active() ? COLOR.accent : COLOR.text, _v$11 = COLOR.dim;
51334
- _v$1 !== _p$.e && (_p$.e = setProp(_el$0, "fg", _v$1, _p$.e));
51335
- _v$10 !== _p$.t && (_p$.t = setProp(_el$1, "fg", _v$10, _p$.t));
51336
- _v$11 !== _p$.a && (_p$.a = setProp(_el$10, "fg", _v$11, _p$.a));
52350
+ var _v$9 = active() ? COLOR.accent : COLOR.dim, _v$0 = active() ? COLOR.accent : COLOR.text, _v$1 = COLOR.dim;
52351
+ _v$9 !== _p$.e && (_p$.e = setProp(_el$8, "fg", _v$9, _p$.e));
52352
+ _v$0 !== _p$.t && (_p$.t = setProp(_el$9, "fg", _v$0, _p$.t));
52353
+ _v$1 !== _p$.a && (_p$.a = setProp(_el$0, "fg", _v$1, _p$.a));
51337
52354
  return _p$;
51338
52355
  }, {
51339
52356
  e: undefined,
51340
52357
  t: undefined,
51341
52358
  a: undefined
51342
52359
  });
51343
- return _el$9;
52360
+ return _el$7;
51344
52361
  })();
51345
52362
  }
51346
52363
  }));
51347
- effect((_$p) => setProp(_el$7, "style", {
52364
+ effect((_$p) => setProp(_el$6, "style", {
51348
52365
  width: popupWidth(),
51349
52366
  height: slashRowLimit(),
51350
52367
  flexDirection: "column",
51351
52368
  overflow: "hidden"
51352
52369
  }, _$p));
51353
- return _el$7;
52370
+ return _el$6;
51354
52371
  }
51355
- }), _el$8);
51356
- insert(_el$8, rule);
52372
+ }), null);
51357
52373
  effect((_p$) => {
51358
- var _v$ = surfaceVisible(), _v$2 = COLOR.border, _v$3 = {
51359
- flexDirection: "row",
52374
+ var _v$ = surfaceVisible(), _v$2 = {
52375
+ position: "relative",
52376
+ height: composer.height() + 2,
52377
+ flexShrink: 0
52378
+ }, _v$3 = {
52379
+ position: "absolute",
52380
+ left: 2,
52381
+ right: 1,
52382
+ top: 1,
51360
52383
  height: composer.height(),
51361
- backgroundColor: COLOR.panel
51362
- }, _v$4 = COLOR.dim, _v$5 = COLOR.dim, _v$6 = COLOR.text, _v$7 = COLOR.text, _v$8 = COLOR.accent, _v$9 = {
52384
+ zIndex: 1,
52385
+ flexDirection: "row"
52386
+ }, _v$4 = COLOR.dim, _v$5 = COLOR.text, _v$6 = COLOR.text, _v$7 = COLOR.accent, _v$8 = {
51363
52387
  height: composer.height(),
51364
52388
  flexGrow: 1,
51365
- backgroundColor: COLOR.panel
51366
- }, _v$0 = COLOR.border;
52389
+ backgroundColor: "transparent"
52390
+ };
51367
52391
  _v$ !== _p$.e && (_p$.e = setProp(_el$, "visible", _v$, _p$.e));
51368
- _v$2 !== _p$.t && (_p$.t = setProp(_el$2, "fg", _v$2, _p$.t));
51369
- _v$3 !== _p$.a && (_p$.a = setProp(_el$3, "style", _v$3, _p$.a));
51370
- _v$4 !== _p$.o && (_p$.o = setProp(_el$4, "fg", _v$4, _p$.o));
51371
- _v$5 !== _p$.i && (_p$.i = setProp(_el$6, "placeholderColor", _v$5, _p$.i));
51372
- _v$6 !== _p$.n && (_p$.n = setProp(_el$6, "textColor", _v$6, _p$.n));
51373
- _v$7 !== _p$.s && (_p$.s = setProp(_el$6, "focusedTextColor", _v$7, _p$.s));
51374
- _v$8 !== _p$.h && (_p$.h = setProp(_el$6, "cursorColor", _v$8, _p$.h));
51375
- _v$9 !== _p$.r && (_p$.r = setProp(_el$6, "style", _v$9, _p$.r));
51376
- _v$0 !== _p$.d && (_p$.d = setProp(_el$8, "fg", _v$0, _p$.d));
52392
+ _v$2 !== _p$.t && (_p$.t = setProp(_el$2, "style", _v$2, _p$.t));
52393
+ _v$3 !== _p$.a && (_p$.a = setProp(_el$4, "style", _v$3, _p$.a));
52394
+ _v$4 !== _p$.o && (_p$.o = setProp(_el$5, "placeholderColor", _v$4, _p$.o));
52395
+ _v$5 !== _p$.i && (_p$.i = setProp(_el$5, "textColor", _v$5, _p$.i));
52396
+ _v$6 !== _p$.n && (_p$.n = setProp(_el$5, "focusedTextColor", _v$6, _p$.n));
52397
+ _v$7 !== _p$.s && (_p$.s = setProp(_el$5, "cursorColor", _v$7, _p$.s));
52398
+ _v$8 !== _p$.h && (_p$.h = setProp(_el$5, "style", _v$8, _p$.h));
51377
52399
  return _p$;
51378
52400
  }, {
51379
52401
  e: undefined,
@@ -51383,13 +52405,12 @@ function Composer(props = {}) {
51383
52405
  i: undefined,
51384
52406
  n: undefined,
51385
52407
  s: undefined,
51386
- h: undefined,
51387
- r: undefined,
51388
- d: undefined
52408
+ h: undefined
51389
52409
  });
51390
52410
  return _el$;
51391
52411
  })();
51392
52412
  }
52413
+ var focusTintStart, focusTintEnd, inactiveComposerBackground, composerPageBackground, focusTintPalettes, composerEdgeRuns;
51393
52414
  var init_composer2 = __esm(() => {
51394
52415
  init_solid2();
51395
52416
  init_solid2();
@@ -51399,7 +52420,6 @@ var init_composer2 = __esm(() => {
51399
52420
  init_solid2();
51400
52421
  init_solid2();
51401
52422
  init_solid2();
51402
- init_solid2();
51403
52423
  init_solid();
51404
52424
  init_solid2();
51405
52425
  init_store4();
@@ -51411,6 +52431,12 @@ var init_composer2 = __esm(() => {
51411
52431
  init_terminal_text();
51412
52432
  init_terminal();
51413
52433
  init_command_registry_signal();
52434
+ focusTintStart = [22, 33, 38];
52435
+ focusTintEnd = [16, 16, 16];
52436
+ inactiveComposerBackground = RGBA.fromInts(...focusTintEnd);
52437
+ composerPageBackground = RGBA.fromInts(0, 0, 0);
52438
+ focusTintPalettes = new Map;
52439
+ composerEdgeRuns = new Map;
51414
52440
  });
51415
52441
 
51416
52442
  // src/agent-tui/bottom-pane/time.ts
@@ -51894,7 +52920,8 @@ function StatusIndicator(props) {
51894
52920
  insertNode(_el$, _el$2);
51895
52921
  setProp(_el$, "style", {
51896
52922
  flexDirection: "row",
51897
- flexShrink: 0
52923
+ flexShrink: 0,
52924
+ paddingTop: 1
51898
52925
  });
51899
52926
  insert(_el$2, text);
51900
52927
  effect((_$p) => setProp(_el$2, "fg", COLOR.text, _$p));
@@ -54520,7 +55547,7 @@ function BottomPane() {
54520
55547
  const questionNoticeVisible = () => composerChromeVisible() && inputRequestPending();
54521
55548
  const questionNotice = () => truncateLine2(dims().width >= 64 ? "\u2022 question pending \xB7 ctrl+q answer \xB7 chat input remains available" : "\u2022 question pending \xB7 ctrl+q answer", Math.max(1, dims().width));
54522
55549
  const previewMaxRows = () => {
54523
- const fixedRows = 5 + composer.height() + (statusVisible() ? 1 : 0) + (questionNoticeVisible() ? 1 : 0) + (statusVisible() && (pendingPreviewVisible() || questionNoticeVisible()) ? 1 : 0) + (pendingPreviewVisible() && questionNoticeVisible() ? 1 : 0);
55550
+ const fixedRows = 5 + composer.height() + (statusVisible() ? 2 : 0) + (questionNoticeVisible() ? 1 : 0) + (statusVisible() && (pendingPreviewVisible() || questionNoticeVisible()) ? 1 : 0) + (pendingPreviewVisible() && questionNoticeVisible() ? 1 : 0);
54524
55551
  return Math.min(10, Math.max(0, dims().height - fixedRows));
54525
55552
  };
54526
55553
  const previewRendered = () => pendingPreviewVisible() && previewMaxRows() > 0;
@@ -54861,6 +55888,47 @@ var init_bottom_pane = __esm(() => {
54861
55888
  init_command_registry_signal();
54862
55889
  });
54863
55890
 
55891
+ // src/agent-tui/ui/surface-layer.tsx
55892
+ import { BoxRenderable as BoxRenderable3 } from "@opentui/core";
55893
+ function SurfaceLayer(props) {
55894
+ return (() => {
55895
+ var _el$ = createElement("surface_layer");
55896
+ spread(_el$, props, false);
55897
+ return _el$;
55898
+ })();
55899
+ }
55900
+ var SurfaceLayerRenderable;
55901
+ var init_surface_layer = __esm(() => {
55902
+ init_solid2();
55903
+ init_solid2();
55904
+ init_solid2();
55905
+ SurfaceLayerRenderable = class SurfaceLayerRenderable extends BoxRenderable3 {
55906
+ _renderChildren = true;
55907
+ constructor(ctx, options) {
55908
+ super(ctx, options);
55909
+ this._renderChildren = options.renderChildren ?? true;
55910
+ }
55911
+ get renderChildren() {
55912
+ return this._renderChildren;
55913
+ }
55914
+ set renderChildren(value) {
55915
+ if (this._renderChildren === value)
55916
+ return;
55917
+ this._renderChildren = value;
55918
+ this.requestRender();
55919
+ }
55920
+ _hasVisibleChildFilter() {
55921
+ return !this._renderChildren;
55922
+ }
55923
+ _getVisibleChildren() {
55924
+ return this._renderChildren ? super._getVisibleChildren() : [];
55925
+ }
55926
+ };
55927
+ extend({
55928
+ surface_layer: SurfaceLayerRenderable
55929
+ });
55930
+ });
55931
+
54864
55932
  // src/agent-tui/shell/app-shell.tsx
54865
55933
  function AppShell() {
54866
55934
  const tui = useTuiStore();
@@ -54927,14 +55995,12 @@ ${note.text}`).join(`
54927
55995
  return createComponent2(ComposerProvider, {
54928
55996
  get children() {
54929
55997
  return [createComponent2(KeyboardController, {}), (() => {
54930
- var _el$ = createElement("box"), _el$2 = createElement("box"), _el$3 = createElement("box"), _el$4 = createElement("box");
55998
+ var _el$ = createElement("box"), _el$2 = createElement("box");
54931
55999
  insertNode(_el$, _el$2);
54932
56000
  setProp(_el$, "minHeight", 0);
54933
56001
  setProp(_el$, "overflow", "hidden");
54934
56002
  setProp(_el$, "flexDirection", "column");
54935
56003
  insert(_el$, createComponent2(MainTabs, {}), _el$2);
54936
- insertNode(_el$2, _el$3);
54937
- insertNode(_el$2, _el$4);
54938
56004
  setProp(_el$2, "id", "main-surface-viewport");
54939
56005
  setProp(_el$2, "style", {
54940
56006
  flexGrow: 1,
@@ -54943,38 +56009,88 @@ ${note.text}`).join(`
54943
56009
  overflow: "hidden",
54944
56010
  flexDirection: "column"
54945
56011
  });
54946
- setProp(_el$3, "id", "chat-surface");
54947
- setProp(_el$3, "style", {
54948
- flexGrow: 1,
54949
- flexShrink: 1,
54950
- minHeight: 0,
54951
- flexDirection: "column"
54952
- });
54953
- insert(_el$3, createComponent2(Transcript, {
54954
- get active() {
56012
+ insert(_el$2, createComponent2(SurfaceLayer, {
56013
+ id: "chat-surface",
56014
+ get renderChildren() {
54955
56015
  return chatActive();
56016
+ },
56017
+ get zIndex() {
56018
+ return chatActive() ? 1 : 0;
56019
+ },
56020
+ get backgroundColor() {
56021
+ return COLOR.bg;
56022
+ },
56023
+ style: {
56024
+ position: "absolute",
56025
+ left: 0,
56026
+ top: 0,
56027
+ width: "100%",
56028
+ height: "100%",
56029
+ minHeight: 0,
56030
+ overflow: "hidden",
56031
+ flexDirection: "column"
56032
+ },
56033
+ get children() {
56034
+ return createComponent2(Transcript, {
56035
+ get active() {
56036
+ return chatActive();
56037
+ }
56038
+ });
54956
56039
  }
54957
- }));
54958
- setProp(_el$4, "id", "proxy-surface");
54959
- setProp(_el$4, "style", {
54960
- flexGrow: 1,
54961
- flexShrink: 1,
54962
- minHeight: 0,
54963
- flexDirection: "column"
54964
- });
54965
- insert(_el$4, createComponent2(ProxyLogView, {
54966
- get active() {
56040
+ }), null);
56041
+ insert(_el$2, createComponent2(SurfaceLayer, {
56042
+ id: "proxy-surface",
56043
+ get renderChildren() {
54967
56044
  return proxyActive();
56045
+ },
56046
+ get zIndex() {
56047
+ return proxyActive() ? 1 : 0;
56048
+ },
56049
+ get backgroundColor() {
56050
+ return COLOR.bg;
56051
+ },
56052
+ style: {
56053
+ position: "absolute",
56054
+ left: 0,
56055
+ top: 0,
56056
+ width: "100%",
56057
+ height: "100%",
56058
+ minHeight: 0,
56059
+ overflow: "hidden",
56060
+ flexDirection: "column"
56061
+ },
56062
+ get children() {
56063
+ return createComponent2(ProxyLogView, {
56064
+ get active() {
56065
+ return proxyActive();
56066
+ }
56067
+ });
54968
56068
  }
54969
- }));
56069
+ }), null);
54970
56070
  insert(_el$2, createComponent2(Show, {
54971
56071
  get when() {
54972
56072
  return centerFrame();
54973
56073
  },
54974
- keyed: true,
54975
- children: (surface) => createComponent2(CenterSurfaceView, {
54976
- frame: surface
54977
- })
56074
+ get children() {
56075
+ var _el$3 = createElement("box");
56076
+ setProp(_el$3, "id", "center-surface-layer");
56077
+ setProp(_el$3, "zIndex", 2);
56078
+ setProp(_el$3, "style", {
56079
+ position: "absolute",
56080
+ left: 0,
56081
+ top: 0,
56082
+ width: "100%",
56083
+ height: "100%",
56084
+ minHeight: 0,
56085
+ overflow: "hidden",
56086
+ flexDirection: "column"
56087
+ });
56088
+ insert(_el$3, createComponent2(CenterSurfaceView, {
56089
+ frame: () => centerFrame()
56090
+ }));
56091
+ effect((_$p) => setProp(_el$3, "backgroundColor", COLOR.bg, _$p));
56092
+ return _el$3;
56093
+ }
54978
56094
  }), null);
54979
56095
  insert(_el$, createComponent2(Show, {
54980
56096
  get when() {
@@ -54988,19 +56104,15 @@ ${note.text}`).join(`
54988
56104
  }
54989
56105
  }), null);
54990
56106
  effect((_p$) => {
54991
- var _v$ = dims().width, _v$2 = dims().height, _v$3 = COLOR.bg, _v$4 = chatActive(), _v$5 = proxyActive();
56107
+ var _v$ = dims().width, _v$2 = dims().height, _v$3 = COLOR.bg;
54992
56108
  _v$ !== _p$.e && (_p$.e = setProp(_el$, "width", _v$, _p$.e));
54993
56109
  _v$2 !== _p$.t && (_p$.t = setProp(_el$, "height", _v$2, _p$.t));
54994
56110
  _v$3 !== _p$.a && (_p$.a = setProp(_el$, "backgroundColor", _v$3, _p$.a));
54995
- _v$4 !== _p$.o && (_p$.o = setProp(_el$3, "visible", _v$4, _p$.o));
54996
- _v$5 !== _p$.i && (_p$.i = setProp(_el$4, "visible", _v$5, _p$.i));
54997
56111
  return _p$;
54998
56112
  }, {
54999
56113
  e: undefined,
55000
56114
  t: undefined,
55001
- a: undefined,
55002
- o: undefined,
55003
- i: undefined
56115
+ a: undefined
55004
56116
  });
55005
56117
  return _el$;
55006
56118
  })()];
@@ -55010,17 +56122,17 @@ ${note.text}`).join(`
55010
56122
  function ExitStatus() {
55011
56123
  const dims = useTuiDimensions();
55012
56124
  return (() => {
55013
- var _el$5 = createElement("box"), _el$6 = createElement("text");
55014
- insertNode(_el$5, _el$6);
55015
- setProp(_el$5, "id", "exit-status");
55016
- setProp(_el$5, "style", {
56125
+ var _el$4 = createElement("box"), _el$5 = createElement("text");
56126
+ insertNode(_el$4, _el$5);
56127
+ setProp(_el$4, "id", "exit-status");
56128
+ setProp(_el$4, "style", {
55017
56129
  height: 2,
55018
56130
  flexShrink: 0,
55019
56131
  paddingTop: 1
55020
56132
  });
55021
- insert(_el$6, () => exitStatusText(dims().width));
55022
- effect((_$p) => setProp(_el$6, "fg", COLOR.dim, _$p));
55023
- return _el$5;
56133
+ insert(_el$5, () => exitStatusText(dims().width));
56134
+ effect((_$p) => setProp(_el$5, "fg", COLOR.dim, _$p));
56135
+ return _el$4;
55024
56136
  })();
55025
56137
  }
55026
56138
  function exitStatusText(width) {
@@ -55044,41 +56156,41 @@ function MainTabs() {
55044
56156
  tui.refreshProxyFlows();
55045
56157
  };
55046
56158
  return (() => {
55047
- var _el$7 = createElement("box"), _el$8 = createElement("text"), _el$9 = createElement("text"), _el$0 = createElement("text");
55048
- insertNode(_el$7, _el$8);
55049
- insertNode(_el$7, _el$9);
55050
- insertNode(_el$7, _el$0);
55051
- setProp(_el$7, "id", "main-tabs");
55052
- setProp(_el$7, "style", {
56159
+ var _el$6 = createElement("box"), _el$7 = createElement("text"), _el$8 = createElement("text"), _el$9 = createElement("text");
56160
+ insertNode(_el$6, _el$7);
56161
+ insertNode(_el$6, _el$8);
56162
+ insertNode(_el$6, _el$9);
56163
+ setProp(_el$6, "id", "main-tabs");
56164
+ setProp(_el$6, "style", {
55053
56165
  height: 2,
55054
56166
  flexShrink: 0,
55055
56167
  flexDirection: "row"
55056
56168
  });
55057
- setProp(_el$8, "selectable", false);
55058
- setProp(_el$8, "onMouseUp", (event) => {
56169
+ setProp(_el$7, "selectable", false);
56170
+ setProp(_el$7, "onMouseUp", (event) => {
55059
56171
  if (isPrimaryClick(event))
55060
56172
  openChat();
55061
56173
  });
55062
- insert(_el$8, () => labels().chat);
55063
- insert(_el$9, () => labels().gap);
55064
- setProp(_el$0, "selectable", false);
55065
- setProp(_el$0, "onMouseUp", (event) => {
56174
+ insert(_el$7, () => labels().chat);
56175
+ insert(_el$8, () => labels().gap);
56176
+ setProp(_el$9, "selectable", false);
56177
+ setProp(_el$9, "onMouseUp", (event) => {
55066
56178
  if (isPrimaryClick(event))
55067
56179
  openProxy();
55068
56180
  });
55069
- insert(_el$0, () => labels().proxy);
56181
+ insert(_el$9, () => labels().proxy);
55070
56182
  effect((_p$) => {
55071
- var _v$6 = active() === "chat" ? COLOR.accent : COLOR.dim, _v$7 = COLOR.dim, _v$8 = active() === "proxy" ? COLOR.accent : COLOR.dim;
55072
- _v$6 !== _p$.e && (_p$.e = setProp(_el$8, "fg", _v$6, _p$.e));
55073
- _v$7 !== _p$.t && (_p$.t = setProp(_el$9, "fg", _v$7, _p$.t));
55074
- _v$8 !== _p$.a && (_p$.a = setProp(_el$0, "fg", _v$8, _p$.a));
56183
+ var _v$4 = active() === "chat" ? COLOR.accent : COLOR.dim, _v$5 = COLOR.dim, _v$6 = active() === "proxy" ? COLOR.accent : COLOR.dim;
56184
+ _v$4 !== _p$.e && (_p$.e = setProp(_el$7, "fg", _v$4, _p$.e));
56185
+ _v$5 !== _p$.t && (_p$.t = setProp(_el$8, "fg", _v$5, _p$.t));
56186
+ _v$6 !== _p$.a && (_p$.a = setProp(_el$9, "fg", _v$6, _p$.a));
55075
56187
  return _p$;
55076
56188
  }, {
55077
56189
  e: undefined,
55078
56190
  t: undefined,
55079
56191
  a: undefined
55080
56192
  });
55081
- return _el$7;
56193
+ return _el$6;
55082
56194
  })();
55083
56195
  }
55084
56196
  function mainTabLabels(width, proxyCount) {
@@ -55109,6 +56221,7 @@ var init_app_shell = __esm(() => {
55109
56221
  init_solid2();
55110
56222
  init_solid2();
55111
56223
  init_solid2();
56224
+ init_solid2();
55112
56225
  init_solid();
55113
56226
  init_store4();
55114
56227
  init_exit();
@@ -55123,6 +56236,7 @@ var init_app_shell = __esm(() => {
55123
56236
  init_theme();
55124
56237
  init_mouse();
55125
56238
  init_terminal();
56239
+ init_surface_layer();
55126
56240
  });
55127
56241
 
55128
56242
  // src/agent-tui/app.tsx
@@ -56672,15 +57786,19 @@ class BenchmarkDockerLifecycle {
56672
57786
  this.runner = runner;
56673
57787
  }
56674
57788
  async start() {
56675
- const inspected = await this.runner("docker", ["image", "inspect", "--format", "{{.Id}}", DEFAULT_KALI_IMAGE]);
56676
- if (inspected.exitCode !== 0)
56677
- throw new Error(inspected.stderr || `benchmark agent image is missing: ${DEFAULT_KALI_IMAGE}`);
56678
- const agentImageId = inspected.stdout.trim();
57789
+ const processRunner = (command, args2) => this.runner(command, args2);
57790
+ const image = await new KaliContainerBackend({
57791
+ workspace: this.workspace,
57792
+ image: DEFAULT_KALI_IMAGE,
57793
+ processRunner
57794
+ }).resolveImage();
57795
+ if (!image.exists)
57796
+ throw new Error(`benchmark agent image is missing: ${DEFAULT_KALI_IMAGE}`);
57797
+ const agentImageId = image.id?.trim() ?? "";
56679
57798
  if (!/^sha256:[a-f0-9]{64}$/i.test(agentImageId))
56680
57799
  throw new Error(`docker returned an unpinned agent image id: ${agentImageId || "empty"}`);
56681
- const contractResult = await this.runner("docker", ["image", "inspect", "--format", `{{index .Config.Labels "${KALI_IMAGE_CONTRACT_LABEL}"}}`, agentImageId]);
56682
- const agentImageContract = contractResult.stdout.trim();
56683
- if (contractResult.exitCode !== 0 || agentImageContract !== KALI_IMAGE_CONTRACT)
57800
+ const agentImageContract = image.contract?.trim() ?? "";
57801
+ if (agentImageContract !== KALI_IMAGE_CONTRACT)
56684
57802
  throw new Error(`benchmark agent image does not satisfy the current capability contract: ${agentImageContract || "missing"}`);
56685
57803
  const plan = buildBenchmarkDockerPlan(this.manifest, this.workspace, this.runId, agentImageId);
56686
57804
  this.planValue = plan;
@@ -56709,7 +57827,6 @@ class BenchmarkDockerLifecycle {
56709
57827
  }
56710
57828
  await this.requiredDocker(plan.agentStart, "start benchmark agent");
56711
57829
  state.started = true;
56712
- const processRunner = (command, args2) => this.runner(command, args2);
56713
57830
  return {
56714
57831
  backend: new KaliContainerBackend({
56715
57832
  workspace: this.workspace,
@@ -58161,5 +59278,5 @@ Examples:
58161
59278
  `);
58162
59279
  }
58163
59280
 
58164
- //# debugId=6C2DD0A83CC2860864756E2164756E21
59281
+ //# debugId=1ABB7A88DC937DFE64756E2164756E21
58165
59282
  //# sourceMappingURL=index.js.map