flavor-code 1.2.7 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +405 -369
  2. package/README.zh-CN.md +387 -356
  3. package/dist/agent/loop.d.ts +4 -0
  4. package/dist/agent/types.d.ts +10 -0
  5. package/dist/{app-R3SDG2OH.js → app-USAFQVSX.js} +379 -12
  6. package/dist/{chunk-NVLYFU6P.js → chunk-F2HMO5Q2.js} +28 -11
  7. package/dist/{chunk-WN2EZV3Y.js → chunk-G32MCAZA.js} +1 -1
  8. package/dist/{chunk-N2S7USST.js → chunk-RQTYHUMK.js} +2 -1
  9. package/dist/{chunk-5RHJ3PQN.js → chunk-WGYNTR4Q.js} +1834 -495
  10. package/dist/{chunk-HFR2WS6T.js → chunk-XFCJXRJ2.js} +18 -5
  11. package/dist/{claude-ink-WPWPEL5A.js → claude-ink-ORUA7GWG.js} +2 -2
  12. package/dist/cli.js +9 -8
  13. package/dist/config/protected-file.d.ts +6 -0
  14. package/dist/config/schema.d.ts +2 -0
  15. package/dist/context/manager.d.ts +2 -0
  16. package/dist/context/workspace-instructions.d.ts +10 -0
  17. package/dist/desktop/main.js +12736 -5178
  18. package/dist/desktop/pixel-worker.js +73 -0
  19. package/dist/desktop/preload.cjs +80 -2
  20. package/dist/desktop-renderer/assets/index-D-s27J39.js +151 -0
  21. package/dist/desktop-renderer/assets/index-DMZBSGrp.css +1 -0
  22. package/dist/desktop-renderer/index.html +3 -4
  23. package/dist/harness/local.d.ts +4 -1
  24. package/dist/jobs/registry.d.ts +48 -0
  25. package/dist/{load-XC5JYYBQ.js → load-6ZMEBHSG.js} +1 -1
  26. package/dist/models/anthropic.d.ts +4 -0
  27. package/dist/permissions/engine.d.ts +7 -0
  28. package/dist/production.d.ts +13 -1
  29. package/dist/sdk/index.js +4 -4
  30. package/dist/terminal/service.d.ts +57 -0
  31. package/dist/tools/files.d.ts +10 -0
  32. package/dist/tools/jobs.d.ts +4 -0
  33. package/dist/tools/runtime.d.ts +2 -0
  34. package/dist/tools/shell.d.ts +13 -3
  35. package/dist/tools/terminal.d.ts +3 -0
  36. package/dist/tools/types.d.ts +76 -4
  37. package/dist/tools/web.d.ts +53 -0
  38. package/package.json +13 -2
  39. package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +752 -1
  40. package/dist/desktop-renderer/assets/index-CLrVaR9H.js +0 -143
  41. package/dist/desktop-renderer/assets/index-Cm_ktmXm.css +0 -1
@@ -19,13 +19,17 @@ export interface AgentLoopOptions {
19
19
  maxExtensions?: number;
20
20
  hasActiveProgress?(): boolean;
21
21
  agent?: "main" | "subagent";
22
+ ownerId?: string;
22
23
  hallucinationGuard?: HallucinationGuard;
23
24
  }
24
25
  export declare class AgentLoop {
25
26
  #private;
26
27
  constructor(options: AgentLoopOptions);
27
28
  get modelId(): string;
29
+ get iterationLimitMode(): "standard" | "d2c";
28
30
  setModel(modelId: string): void;
29
31
  setFallbackModel(modelId: string): void;
32
+ /** D2C keeps a hard cap, but may automatically expand it up to ten times. */
33
+ setIterationLimitMode(mode: "standard" | "d2c"): void;
30
34
  run(request: AgentRunRequest): AsyncIterable<AgentEvent>;
31
35
  }
@@ -32,6 +32,12 @@ export interface TaskSnapshot {
32
32
  };
33
33
  foregroundTaskId?: string;
34
34
  }
35
+ export interface TurnDeliverable {
36
+ path: string;
37
+ operation: "create" | "update" | "delete";
38
+ added: number;
39
+ removed: number;
40
+ }
35
41
  export type AgentEvent = {
36
42
  type: "model-start";
37
43
  id: string;
@@ -48,6 +54,7 @@ export type AgentEvent = {
48
54
  input: unknown;
49
55
  label?: string;
50
56
  hint?: string;
57
+ presentation?: import("../tools/types.js").ToolPresentation;
51
58
  } | {
52
59
  type: "tool-end";
53
60
  id: string;
@@ -60,6 +67,9 @@ export type AgentEvent = {
60
67
  snapshot: TaskSnapshot;
61
68
  } | {
62
69
  type: "tasks-cleared";
70
+ } | {
71
+ type: "deliverables";
72
+ files: readonly TurnDeliverable[];
63
73
  } | {
64
74
  type: "usage";
65
75
  inputTokens: number;
@@ -15,8 +15,8 @@ import {
15
15
  packageVersion,
16
16
  redactErrorText,
17
17
  transcriptReducer
18
- } from "./chunk-5RHJ3PQN.js";
19
- import "./chunk-HFR2WS6T.js";
18
+ } from "./chunk-WGYNTR4Q.js";
19
+ import "./chunk-XFCJXRJ2.js";
20
20
  import {
21
21
  Box_default,
22
22
  ClockContext,
@@ -33,10 +33,10 @@ import {
33
33
  useStdout,
34
34
  use_app_default,
35
35
  use_input_default
36
- } from "./chunk-NVLYFU6P.js";
36
+ } from "./chunk-F2HMO5Q2.js";
37
37
  import {
38
38
  execFileNoThrow
39
- } from "./chunk-N2S7USST.js";
39
+ } from "./chunk-RQTYHUMK.js";
40
40
  import "./chunk-S32JRDZK.js";
41
41
 
42
42
  // src/ui/app.tsx
@@ -2452,11 +2452,11 @@ function TerminalLayout({
2452
2452
  /* @__PURE__ */ jsx5(Box_default, { height: 1 }),
2453
2453
  completed.map((turn, index) => /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", children: [
2454
2454
  index > 0 ? /* @__PURE__ */ jsx5(TurnSeparator, { width: columns }) : null,
2455
- /* @__PURE__ */ jsx5(TurnView, { turn, interactive: false })
2455
+ /* @__PURE__ */ jsx5(TurnView, { turn, interactive: false, workspaceName })
2456
2456
  ] }, turn.id)),
2457
2457
  activeWithoutTasks === void 0 ? null : /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", children: [
2458
2458
  completed.length > 0 ? /* @__PURE__ */ jsx5(TurnSeparator, { width: columns }) : null,
2459
- /* @__PURE__ */ jsx5(TurnView, { turn: activeWithoutTasks, interactive: activeSession })
2459
+ /* @__PURE__ */ jsx5(TurnView, { turn: activeWithoutTasks, interactive: activeSession, workspaceName })
2460
2460
  ] })
2461
2461
  ] }),
2462
2462
  /* @__PURE__ */ jsx5(
@@ -2708,11 +2708,15 @@ function scrollUp(scroll, amount) {
2708
2708
  function TurnSeparator({ width }) {
2709
2709
  return /* @__PURE__ */ jsx5(Text, { dimColor: true, children: "\u2500".repeat(Math.max(1, width - 1)) });
2710
2710
  }
2711
- function TurnView({ turn, interactive }) {
2711
+ function TurnView({
2712
+ turn,
2713
+ interactive,
2714
+ workspaceName
2715
+ }) {
2712
2716
  if (turn.kind === "compaction") {
2713
2717
  return /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", marginBottom: 1, borderStyle: "round", borderColor: "ansi:yellowBright", paddingX: 1, children: [
2714
2718
  /* @__PURE__ */ jsx5(Text, { color: "ansi:yellowBright", bold: true, children: turn.prompt }),
2715
- turn.blocks.map((block, index) => block.kind === "status" ? /* @__PURE__ */ jsx5(StatusBlockView, { block, interactive }, block.id) : /* @__PURE__ */ jsx5(Box_default, { children: /* @__PURE__ */ jsx5(AssistantText, { text: block.text }) }, `${turn.id}-text-${index}`))
2719
+ turn.blocks.map((block, index) => block.kind === "status" ? /* @__PURE__ */ jsx5(StatusBlockView, { block, interactive, workspaceName }, block.id) : /* @__PURE__ */ jsx5(Box_default, { children: /* @__PURE__ */ jsx5(AssistantText, { text: block.text }) }, `${turn.id}-text-${index}`))
2716
2720
  ] });
2717
2721
  }
2718
2722
  return /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", marginBottom: 1, children: [
@@ -2723,7 +2727,7 @@ function TurnView({ turn, interactive }) {
2723
2727
  turn.prompt
2724
2728
  ] })
2725
2729
  ] }),
2726
- /* @__PURE__ */ jsx5(Box_default, { flexDirection: "column", paddingLeft: 2, marginTop: 1, children: turn.blocks.map((block, index) => block.kind === "status" ? /* @__PURE__ */ jsx5(StatusBlockView, { block, interactive }, block.id) : /* @__PURE__ */ jsx5(Box_default, { marginBottom: 1, children: /* @__PURE__ */ jsx5(AssistantText, { text: block.text }) }, `${turn.id}-text-${index}`)) })
2730
+ /* @__PURE__ */ jsx5(Box_default, { flexDirection: "column", paddingLeft: 2, marginTop: 1, children: turn.blocks.map((block, index) => block.kind === "status" ? /* @__PURE__ */ jsx5(StatusBlockView, { block, interactive, workspaceName }, block.id) : /* @__PURE__ */ jsx5(Box_default, { marginBottom: 1, children: /* @__PURE__ */ jsx5(AssistantText, { text: block.text }) }, `${turn.id}-text-${index}`)) })
2727
2731
  ] });
2728
2732
  }
2729
2733
  var DIFF_CONTENT = fileDiffLineStyle("context").contentColor;
@@ -2901,20 +2905,383 @@ function PromptLine({
2901
2905
  }
2902
2906
  function StatusBlockView({
2903
2907
  block,
2904
- interactive
2908
+ interactive,
2909
+ workspaceName
2905
2910
  }) {
2906
2911
  const visibleBlock = cliToolTitle(block);
2907
2912
  const outcome = cliToolOutcome(block);
2908
- const primary = visibleBlock.activity === "model" || visibleBlock.task !== void 0 ? /* @__PURE__ */ jsx5(TaskStatusLine, { block: visibleBlock, interactive }) : visibleBlock.state === "completed" && visibleBlock.presentation !== void 0 ? /* @__PURE__ */ jsx5(FileDiffView, { presentation: visibleBlock.presentation }) : /* @__PURE__ */ jsx5(StatusLine, { block: visibleBlock, interactive });
2913
+ const primary = visibleBlock.activity === "model" || visibleBlock.task !== void 0 ? /* @__PURE__ */ jsx5(TaskStatusLine, { block: visibleBlock, interactive }) : visibleBlock.state === "completed" && visibleBlock.presentation !== void 0 ? /* @__PURE__ */ jsx5(ToolPresentationView, { presentation: visibleBlock.presentation, workspaceName }) : /* @__PURE__ */ jsx5(StatusLine, { block: visibleBlock, interactive });
2909
2914
  return /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", children: [
2910
2915
  primary,
2911
2916
  outcome === void 0 ? null : /* @__PURE__ */ jsx5(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs4(Text, { dimColor: true, children: [
2912
2917
  "\u2514 ",
2913
2918
  outcome
2914
2919
  ] }) }),
2915
- block.details === void 0 ? null : /* @__PURE__ */ jsx5(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsx5(AssistantText, { text: block.details }) })
2920
+ block.details === void 0 || block.presentation?.kind === "changeset" ? null : /* @__PURE__ */ jsx5(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsx5(AssistantText, { text: block.details }) })
2921
+ ] });
2922
+ }
2923
+ function ToolPresentationView({
2924
+ presentation,
2925
+ workspaceName
2926
+ }) {
2927
+ if (presentation.kind === "changeset") return /* @__PURE__ */ jsx5(ChangeSetPresentationView, { presentation, workspaceName });
2928
+ if (presentation.kind === "file-change") return /* @__PURE__ */ jsx5(FileDiffView, { presentation });
2929
+ if (presentation.kind === "terminal") return /* @__PURE__ */ jsx5(CommandPresentationView, { presentation });
2930
+ if (presentation.kind === "web") return /* @__PURE__ */ jsx5(WebPresentationView, { presentation });
2931
+ if (presentation.kind === "job") return /* @__PURE__ */ jsx5(JobPresentationView, { presentation });
2932
+ return /* @__PURE__ */ jsx5(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ jsxs4(Text, { children: [
2933
+ presentation.title,
2934
+ presentation.summary ? ` \xB7 ${presentation.summary}` : ""
2935
+ ] }) });
2936
+ }
2937
+ var CLI_CHANGESET_FILE_LIMIT = 8;
2938
+ var CHANGESET_TONE = "#b99bf8";
2939
+ function ChangeSetPresentationView({
2940
+ presentation,
2941
+ workspaceName
2942
+ }) {
2943
+ const visibleFiles = presentation.files.slice(0, CLI_CHANGESET_FILE_LIMIT);
2944
+ const added = presentation.files.reduce((total, file) => total + file.added, 0);
2945
+ const removed = presentation.files.reduce((total, file) => total + file.removed, 0);
2946
+ const fileLabel = presentation.files.length === 1 ? "FILE" : "FILES";
2947
+ const showing = presentation.files.length > visibleFiles.length ? ` \xB7 Showing ${visibleFiles.length} of ${presentation.files.length}` : "";
2948
+ return /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", paddingLeft: 2, marginBottom: 1, children: [
2949
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
2950
+ /* @__PURE__ */ jsx5(Text, { color: CHANGESET_TONE, children: "\u250C\u2500 " }),
2951
+ /* @__PURE__ */ jsxs4(Text, { color: CHANGESET_TONE, bold: true, children: [
2952
+ "CHANGESET \xB7 ",
2953
+ presentation.files.length,
2954
+ " ",
2955
+ fileLabel
2956
+ ] })
2957
+ ] }),
2958
+ visibleFiles.map((file) => {
2959
+ const operation = file.operation.toUpperCase();
2960
+ const stats = `+${file.added} -${file.removed}`;
2961
+ return /* @__PURE__ */ jsxs4(Box_default, { children: [
2962
+ /* @__PURE__ */ jsx5(Text, { color: CHANGESET_TONE, children: "\u2502 " }),
2963
+ /* @__PURE__ */ jsx5(Text, { color: changeSetOperationColor(file.operation), bold: true, children: operation.padEnd(8) }),
2964
+ /* @__PURE__ */ jsxs4(Text, { children: [
2965
+ /* @__PURE__ */ jsxs4(Text, { color: "ansi:green", children: [
2966
+ "+",
2967
+ file.added
2968
+ ] }),
2969
+ " ",
2970
+ /* @__PURE__ */ jsxs4(Text, { color: "#e06c50", children: [
2971
+ "-",
2972
+ file.removed
2973
+ ] }),
2974
+ " ".repeat(Math.max(1, 9 - stats.length))
2975
+ ] }),
2976
+ /* @__PURE__ */ jsx5(Text, { color: "ansi:whiteBright", wrap: "truncate-end", children: workspaceRelativePath(file.path, workspaceName) })
2977
+ ] }, `${file.operation}:${file.path}`);
2978
+ }),
2979
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
2980
+ /* @__PURE__ */ jsx5(Text, { color: CHANGESET_TONE, children: "\u2514\u2500 " }),
2981
+ /* @__PURE__ */ jsxs4(Text, { children: [
2982
+ /* @__PURE__ */ jsxs4(Text, { color: "ansi:green", children: [
2983
+ "+",
2984
+ added
2985
+ ] }),
2986
+ " ",
2987
+ /* @__PURE__ */ jsxs4(Text, { color: "#e06c50", children: [
2988
+ "-",
2989
+ removed
2990
+ ] }),
2991
+ /* @__PURE__ */ jsx5(Text, { dimColor: true, children: showing })
2992
+ ] })
2993
+ ] })
2994
+ ] });
2995
+ }
2996
+ function changeSetOperationColor(operation) {
2997
+ if (operation === "create") return "ansi:green";
2998
+ if (operation === "delete") return "#e06c50";
2999
+ return "ansi:cyanBright";
3000
+ }
3001
+ function workspaceRelativePath(value, workspaceName) {
3002
+ const normalized = value.replace(/\\/gu, "/");
3003
+ const marker = `/${workspaceName}/`;
3004
+ const markerIndex = normalized.toLocaleLowerCase().lastIndexOf(marker.toLocaleLowerCase());
3005
+ if (markerIndex >= 0) return normalized.slice(markerIndex + marker.length);
3006
+ const rootPrefix = `${workspaceName}/`;
3007
+ if (normalized.toLocaleLowerCase().startsWith(rootPrefix.toLocaleLowerCase())) return normalized.slice(rootPrefix.length);
3008
+ return normalized;
3009
+ }
3010
+ var CLI_COMMAND_OUTPUT_LINE_LIMIT = 16;
3011
+ function CommandPresentationView({
3012
+ presentation
3013
+ }) {
3014
+ const state = presentation.state ?? commandState(presentation.exitCode);
3015
+ const tone = jobStateColor(state);
3016
+ const label = presentation.variant === "terminal" ? "TERMINAL" : "COMMAND";
3017
+ const hasStdout = jobOutputLines(presentation.stdout ?? "").length > 0;
3018
+ const hasStderr = jobOutputLines(presentation.stderr ?? "").length > 0;
3019
+ const perStreamLimit = hasStdout && hasStderr ? Math.floor(CLI_COMMAND_OUTPUT_LINE_LIMIT / 2) : CLI_COMMAND_OUTPUT_LINE_LIMIT;
3020
+ const stdout = boundedCommandLines(presentation.stdout ?? "", perStreamLimit);
3021
+ const stderr = boundedCommandLines(presentation.stderr ?? "", perStreamLimit);
3022
+ return /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", paddingLeft: 2, marginBottom: 1, children: [
3023
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3024
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u250C\u2500 " }),
3025
+ /* @__PURE__ */ jsxs4(Text, { color: tone, bold: true, children: [
3026
+ label,
3027
+ " \xB7 ",
3028
+ state.toUpperCase()
3029
+ ] })
3030
+ ] }),
3031
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3032
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u2502 " }),
3033
+ /* @__PURE__ */ jsx5(Text, { color: "ansi:whiteBright", bold: true, wrap: "truncate-end", children: presentation.command ?? presentation.title })
3034
+ ] }),
3035
+ stdout.total === 0 ? null : /* @__PURE__ */ jsx5(CommandOutputSection, { label: "OUTPUT", value: stdout, tone, error: false }),
3036
+ stderr.total === 0 ? null : /* @__PURE__ */ jsx5(CommandOutputSection, { label: "ERROR", value: stderr, tone, error: true }),
3037
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3038
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u2514\u2500 " }),
3039
+ /* @__PURE__ */ jsx5(Text, { dimColor: true, children: commandFooter(presentation, state) })
3040
+ ] })
3041
+ ] });
3042
+ }
3043
+ function CommandOutputSection({
3044
+ label,
3045
+ value,
3046
+ tone,
3047
+ error
3048
+ }) {
3049
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
3050
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3051
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u251C\u2500 " }),
3052
+ /* @__PURE__ */ jsx5(Text, { color: error ? "#e06c50" : tone, bold: true, children: label }),
3053
+ /* @__PURE__ */ jsx5(Text, { dimColor: true, children: ` \xB7 ${value.total} ${value.total === 1 ? "LINE" : "LINES"}` })
3054
+ ] }),
3055
+ value.head.map((line, index) => /* @__PURE__ */ jsx5(CommandOutputLine, { line, tone, error }, `head:${index}`)),
3056
+ value.hidden === 0 ? null : /* @__PURE__ */ jsxs4(Box_default, { children: [
3057
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u2502 " }),
3058
+ /* @__PURE__ */ jsxs4(Text, { dimColor: true, children: [
3059
+ "\u2026 ",
3060
+ value.hidden,
3061
+ " ",
3062
+ value.hidden === 1 ? "line" : "lines",
3063
+ " hidden"
3064
+ ] })
3065
+ ] }),
3066
+ value.tail.map((line, index) => /* @__PURE__ */ jsx5(CommandOutputLine, { line, tone, error }, `tail:${index}`))
3067
+ ] });
3068
+ }
3069
+ function CommandOutputLine({ line, tone, error }) {
3070
+ return /* @__PURE__ */ jsxs4(Box_default, { children: [
3071
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u2502 " }),
3072
+ /* @__PURE__ */ jsx5(Text, { color: error ? "#e06c50" : "#b8bcc2", wrap: "truncate-end", children: line === "" ? " " : line })
3073
+ ] });
3074
+ }
3075
+ function boundedCommandLines(output, limit) {
3076
+ const lines = jobOutputLines(output);
3077
+ if (lines.length <= limit) return { total: lines.length, head: lines, tail: [], hidden: 0 };
3078
+ const headCount = Math.ceil(limit / 2);
3079
+ const tailCount = Math.floor(limit / 2);
3080
+ return {
3081
+ total: lines.length,
3082
+ head: lines.slice(0, headCount),
3083
+ tail: lines.slice(-tailCount),
3084
+ hidden: lines.length - headCount - tailCount
3085
+ };
3086
+ }
3087
+ function commandState(exitCode) {
3088
+ if (exitCode === void 0) return "running";
3089
+ return exitCode === 0 ? "completed" : "failed";
3090
+ }
3091
+ function commandFooter(presentation, state) {
3092
+ const parts = [presentation.exitCode === void 0 ? state : presentation.exitCode === null ? "no exit code" : `exit ${presentation.exitCode}`];
3093
+ if (presentation.truncated === true) parts.push("output truncated");
3094
+ return parts.join(" \xB7 ");
3095
+ }
3096
+ var CLI_WEB_RESULT_LIMIT = 5;
3097
+ function WebPresentationView({
3098
+ presentation
3099
+ }) {
3100
+ const items = presentation.items ?? [];
3101
+ if (presentation.items === void 0) return /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", paddingLeft: 2, marginBottom: 1, children: [
3102
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3103
+ /* @__PURE__ */ jsx5(Text, { color: "#5f87af", children: "\u250C\u2500 " }),
3104
+ /* @__PURE__ */ jsx5(Text, { color: "ansi:cyanBright", bold: true, children: "WEB FETCH" }),
3105
+ presentation.summary === void 0 ? null : /* @__PURE__ */ jsx5(Text, { dimColor: true, children: ` \xB7 ${presentation.summary}` })
3106
+ ] }),
3107
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3108
+ /* @__PURE__ */ jsx5(Text, { color: "#5f87af", children: "\u2502 " }),
3109
+ /* @__PURE__ */ jsx5(Text, { color: "ansi:whiteBright", wrap: "truncate-end", children: presentation.url ?? presentation.title })
3110
+ ] }),
3111
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3112
+ /* @__PURE__ */ jsx5(Text, { color: "#5f87af", children: "\u2514\u2500 " }),
3113
+ /* @__PURE__ */ jsx5(Text, { dimColor: true, children: "Page content added to context" })
3114
+ ] })
3115
+ ] });
3116
+ const visibleItems = items.slice(0, CLI_WEB_RESULT_LIMIT);
3117
+ const query = presentation.title.replace(/^Search:\s*/iu, "").trim();
3118
+ return /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", paddingLeft: 2, marginBottom: 1, children: [
3119
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3120
+ /* @__PURE__ */ jsx5(Text, { color: "#5f87af", children: "\u250C\u2500 " }),
3121
+ /* @__PURE__ */ jsx5(Text, { color: "ansi:cyanBright", bold: true, children: "WEB SEARCH" }),
3122
+ /* @__PURE__ */ jsx5(Text, { dimColor: true, children: ` \xB7 ${items.length} ${items.length === 1 ? "RESULT" : "RESULTS"}` })
3123
+ ] }),
3124
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3125
+ /* @__PURE__ */ jsx5(Text, { color: "#5f87af", children: "\u2502 " }),
3126
+ /* @__PURE__ */ jsx5(Text, { color: "ansi:whiteBright", bold: true, wrap: "truncate-end", children: query })
3127
+ ] }),
3128
+ /* @__PURE__ */ jsx5(Text, { color: "#5f87af", children: "\u2502" }),
3129
+ visibleItems.map((item, index) => /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", children: [
3130
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3131
+ /* @__PURE__ */ jsx5(Text, { color: "#5f87af", children: "\u2502 " }),
3132
+ /* @__PURE__ */ jsx5(Text, { color: "ansi:cyanBright", bold: true, children: String(index + 1).padStart(2, "0") }),
3133
+ /* @__PURE__ */ jsxs4(Text, { color: "ansi:whiteBright", wrap: "truncate-end", children: [
3134
+ " ",
3135
+ item.title
3136
+ ] })
3137
+ ] }),
3138
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3139
+ /* @__PURE__ */ jsx5(Text, { color: "#5f87af", children: "\u2502 " }),
3140
+ /* @__PURE__ */ jsx5(Text, { dimColor: true, wrap: "truncate-end", children: compactWebSource(item.url) })
3141
+ ] })
3142
+ ] }, item.url)),
3143
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3144
+ /* @__PURE__ */ jsx5(Text, { color: "#5f87af", children: "\u2514\u2500 " }),
3145
+ /* @__PURE__ */ jsx5(Text, { dimColor: true, children: items.length > visibleItems.length ? `Showing ${visibleItems.length} of ${items.length}` : `${items.length} ${items.length === 1 ? "source" : "sources"}` })
3146
+ ] })
3147
+ ] });
3148
+ }
3149
+ function compactWebSource(value) {
3150
+ try {
3151
+ const url = new URL(value);
3152
+ const hostname = url.hostname.replace(/^www\./iu, "");
3153
+ const path = url.pathname === "/" ? "" : url.pathname.replace(/\/$/u, "");
3154
+ return `${hostname}${path}`;
3155
+ } catch {
3156
+ return value;
3157
+ }
3158
+ }
3159
+ var CLI_JOB_LOG_LINE_LIMIT = 12;
3160
+ var CLI_JOB_LIST_LIMIT = 8;
3161
+ function JobPresentationView({
3162
+ presentation
3163
+ }) {
3164
+ if (presentation.action === "list") return /* @__PURE__ */ jsx5(JobListPresentationView, { presentation });
3165
+ const state = presentation.state ?? "running";
3166
+ const tone = jobStateColor(state);
3167
+ const lines = jobOutputLines(presentation.output ?? "");
3168
+ const visibleLines = lines.slice(-CLI_JOB_LOG_LINE_LIMIT);
3169
+ const hiddenLines = lines.length - visibleLines.length;
3170
+ const showLog = presentation.action === "read" || presentation.action === "kill" || lines.length > 0;
3171
+ return /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", paddingLeft: 2, marginBottom: 1, children: [
3172
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3173
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u250C\u2500 " }),
3174
+ /* @__PURE__ */ jsxs4(Text, { color: tone, bold: true, children: [
3175
+ "JOB \xB7 ",
3176
+ state.toUpperCase()
3177
+ ] })
3178
+ ] }),
3179
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3180
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u2502 " }),
3181
+ /* @__PURE__ */ jsx5(Text, { color: "ansi:whiteBright", bold: true, children: presentation.id ?? "unknown job" }),
3182
+ presentation.jobKind === void 0 ? null : /* @__PURE__ */ jsx5(Text, { dimColor: true, children: ` \xB7 ${presentation.jobKind}` })
3183
+ ] }),
3184
+ presentation.label === void 0 ? null : /* @__PURE__ */ jsxs4(Box_default, { children: [
3185
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u2502 " }),
3186
+ /* @__PURE__ */ jsx5(Text, { color: "ansi:whiteBright", wrap: "truncate-end", children: presentation.label })
3187
+ ] }),
3188
+ presentation.error === void 0 ? null : /* @__PURE__ */ jsxs4(Box_default, { children: [
3189
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u2502 " }),
3190
+ /* @__PURE__ */ jsx5(Text, { color: "#e06c50", wrap: "truncate-end", children: presentation.error })
3191
+ ] }),
3192
+ showLog ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
3193
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3194
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u251C\u2500 " }),
3195
+ /* @__PURE__ */ jsx5(Text, { color: tone, bold: true, children: "LOG" }),
3196
+ /* @__PURE__ */ jsx5(Text, { dimColor: true, children: lines.length === 0 ? " \xB7 NO NEW OUTPUT" : ` \xB7 ${lines.length} ${lines.length === 1 ? "LINE" : "LINES"}` })
3197
+ ] }),
3198
+ hiddenLines > 0 ? /* @__PURE__ */ jsxs4(Box_default, { children: [
3199
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u2502 " }),
3200
+ /* @__PURE__ */ jsxs4(Text, { dimColor: true, children: [
3201
+ "\u2026 ",
3202
+ hiddenLines,
3203
+ " earlier ",
3204
+ hiddenLines === 1 ? "line" : "lines",
3205
+ " hidden"
3206
+ ] })
3207
+ ] }) : null,
3208
+ visibleLines.map((line, index) => /* @__PURE__ */ jsx5(JobLogLine, { line, tone }, `${index}:${line}`))
3209
+ ] }) : null,
3210
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3211
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u2514\u2500 " }),
3212
+ /* @__PURE__ */ jsx5(Text, { dimColor: true, children: jobFooter(presentation) })
3213
+ ] })
2916
3214
  ] });
2917
3215
  }
3216
+ function JobListPresentationView({
3217
+ presentation
3218
+ }) {
3219
+ const jobs = presentation.jobs ?? [];
3220
+ const visibleJobs = jobs.slice(0, CLI_JOB_LIST_LIMIT);
3221
+ return /* @__PURE__ */ jsxs4(Box_default, { flexDirection: "column", paddingLeft: 2, marginBottom: 1, children: [
3222
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3223
+ /* @__PURE__ */ jsx5(Text, { color: "#d7a657", children: "\u250C\u2500 " }),
3224
+ /* @__PURE__ */ jsxs4(Text, { color: "#d7a657", bold: true, children: [
3225
+ "JOBS \xB7 ",
3226
+ jobs.length
3227
+ ] })
3228
+ ] }),
3229
+ jobs.length === 0 ? /* @__PURE__ */ jsxs4(Box_default, { children: [
3230
+ /* @__PURE__ */ jsx5(Text, { color: "#d7a657", children: "\u2502 " }),
3231
+ /* @__PURE__ */ jsx5(Text, { dimColor: true, children: "No background jobs" })
3232
+ ] }) : visibleJobs.map((job) => /* @__PURE__ */ jsxs4(Box_default, { children: [
3233
+ /* @__PURE__ */ jsx5(Text, { color: "#d7a657", children: "\u2502 " }),
3234
+ /* @__PURE__ */ jsx5(Text, { color: jobStateColor(job.state), bold: true, children: job.state.toUpperCase().padEnd(9) }),
3235
+ /* @__PURE__ */ jsxs4(Text, { color: "ansi:whiteBright", children: [
3236
+ " ",
3237
+ job.id
3238
+ ] }),
3239
+ /* @__PURE__ */ jsxs4(Text, { dimColor: true, wrap: "truncate-end", children: [
3240
+ " \xB7 ",
3241
+ job.label
3242
+ ] })
3243
+ ] }, job.id)),
3244
+ /* @__PURE__ */ jsxs4(Box_default, { children: [
3245
+ /* @__PURE__ */ jsx5(Text, { color: "#d7a657", children: "\u2514\u2500 " }),
3246
+ /* @__PURE__ */ jsx5(Text, { dimColor: true, children: jobs.length > visibleJobs.length ? `Showing ${visibleJobs.length} of ${jobs.length}` : `${jobs.length} ${jobs.length === 1 ? "job" : "jobs"}` })
3247
+ ] })
3248
+ ] });
3249
+ }
3250
+ function JobLogLine({ line, tone }) {
3251
+ const error = /^(?:\[stderr\]|ERR(?:OR)?(?:!|:|\s)|npm ERR!)/iu.test(line.trimStart());
3252
+ const stage = /^={3}.*={3}$/u.test(line.trim());
3253
+ return /* @__PURE__ */ jsxs4(Box_default, { children: [
3254
+ /* @__PURE__ */ jsx5(Text, { color: tone, children: "\u2502 " }),
3255
+ /* @__PURE__ */ jsx5(
3256
+ Text,
3257
+ {
3258
+ ...error ? { color: "#e06c50" } : stage ? { color: "ansi:cyanBright", bold: true } : { dimColor: true },
3259
+ wrap: "truncate-end",
3260
+ children: line === "" ? " " : line
3261
+ }
3262
+ )
3263
+ ] });
3264
+ }
3265
+ function jobOutputLines(output) {
3266
+ if (output === "") return [];
3267
+ const lines = output.replace(/\r\n?/gu, "\n").split("\n");
3268
+ if (lines.at(-1) === "") lines.pop();
3269
+ return lines;
3270
+ }
3271
+ function jobStateColor(state) {
3272
+ if (state === "completed") return "ansi:green";
3273
+ if (state === "failed") return "#e06c50";
3274
+ if (state === "cancelled") return "#858585";
3275
+ return "#d7a657";
3276
+ }
3277
+ function jobFooter(presentation) {
3278
+ const parts = [];
3279
+ if (presentation.exitCode !== void 0) parts.push(presentation.exitCode === null ? "no exit code" : `exit ${presentation.exitCode}`);
3280
+ else parts.push(presentation.state ?? "running");
3281
+ if (presentation.cursor !== void 0) parts.push(`cursor ${presentation.cursor}`);
3282
+ if (presentation.truncated === true) parts.push("output truncated");
3283
+ return parts.join(" \xB7 ");
3284
+ }
2918
3285
  function cliToolTitle(block) {
2919
3286
  if (block.tool === void 0 || block.presentation !== void 0) return block;
2920
3287
  const input = record(block.tool.input);
@@ -5,7 +5,7 @@ import {
5
5
  getGraphemeSegmenter,
6
6
  isEnvTruthy,
7
7
  logError
8
- } from "./chunk-N2S7USST.js";
8
+ } from "./chunk-RQTYHUMK.js";
9
9
  import {
10
10
  __commonJS,
11
11
  __require,
@@ -28628,38 +28628,51 @@ async function setClipboard(text) {
28628
28628
  return raw;
28629
28629
  }
28630
28630
  var linuxCopy;
28631
- function copyNative(text) {
28631
+ var WRITE_WINDOWS_CLIPBOARD_TEXT = String.raw`
28632
+ $inputStream = [Console]::OpenStandardInput()
28633
+ $memoryStream = New-Object System.IO.MemoryStream
28634
+ try {
28635
+ $inputStream.CopyTo($memoryStream)
28636
+ $text = [System.Text.Encoding]::UTF8.GetString($memoryStream.ToArray())
28637
+ Add-Type -AssemblyName System.Windows.Forms
28638
+ [System.Windows.Forms.Clipboard]::SetText($text)
28639
+ } finally {
28640
+ $memoryStream.Dispose()
28641
+ }
28642
+ `;
28643
+ function copyNative(text, options = {}) {
28632
28644
  const opts = { input: text, useCwd: false, timeout: 2e3 };
28633
- switch (process.platform) {
28645
+ const run = options.run ?? execFileNoThrow;
28646
+ switch (options.platform ?? process.platform) {
28634
28647
  case "darwin":
28635
- void execFileNoThrow("pbcopy", [], opts);
28648
+ void run("pbcopy", [], opts);
28636
28649
  return;
28637
28650
  case "linux": {
28638
28651
  if (linuxCopy === null) return;
28639
28652
  if (linuxCopy === "wl-copy") {
28640
- void execFileNoThrow("wl-copy", [], opts);
28653
+ void run("wl-copy", [], opts);
28641
28654
  return;
28642
28655
  }
28643
28656
  if (linuxCopy === "xclip") {
28644
- void execFileNoThrow("xclip", ["-selection", "clipboard"], opts);
28657
+ void run("xclip", ["-selection", "clipboard"], opts);
28645
28658
  return;
28646
28659
  }
28647
28660
  if (linuxCopy === "xsel") {
28648
- void execFileNoThrow("xsel", ["--clipboard", "--input"], opts);
28661
+ void run("xsel", ["--clipboard", "--input"], opts);
28649
28662
  return;
28650
28663
  }
28651
- void execFileNoThrow("wl-copy", [], opts).then((r) => {
28664
+ void run("wl-copy", [], opts).then((r) => {
28652
28665
  if (r.code === 0) {
28653
28666
  linuxCopy = "wl-copy";
28654
28667
  return;
28655
28668
  }
28656
- void execFileNoThrow("xclip", ["-selection", "clipboard"], opts).then(
28669
+ void run("xclip", ["-selection", "clipboard"], opts).then(
28657
28670
  (r2) => {
28658
28671
  if (r2.code === 0) {
28659
28672
  linuxCopy = "xclip";
28660
28673
  return;
28661
28674
  }
28662
- void execFileNoThrow("xsel", ["--clipboard", "--input"], opts).then(
28675
+ void run("xsel", ["--clipboard", "--input"], opts).then(
28663
28676
  (r3) => {
28664
28677
  linuxCopy = r3.code === 0 ? "xsel" : null;
28665
28678
  }
@@ -28670,7 +28683,11 @@ function copyNative(text) {
28670
28683
  return;
28671
28684
  }
28672
28685
  case "win32":
28673
- void execFileNoThrow("clip", [], opts);
28686
+ void run(
28687
+ "powershell.exe",
28688
+ ["-NoProfile", "-NonInteractive", "-STA", "-Command", WRITE_WINDOWS_CLIPBOARD_TEXT],
28689
+ opts
28690
+ );
28674
28691
  return;
28675
28692
  }
28676
28693
  }
@@ -4,7 +4,7 @@ import {
4
4
  message,
5
5
  redactErrorText,
6
6
  redactSecrets
7
- } from "./chunk-5RHJ3PQN.js";
7
+ } from "./chunk-WGYNTR4Q.js";
8
8
 
9
9
  // src/rpc/server.ts
10
10
  import { createInterface } from "readline";
@@ -9,7 +9,8 @@ function execFileNoThrow(file, args, options = {}) {
9
9
  timeout: options.timeout,
10
10
  cwd: options.useCwd === false ? void 0 : process.cwd(),
11
11
  env: options.env,
12
- encoding: "utf8"
12
+ encoding: "utf8",
13
+ windowsHide: true
13
14
  }, (error, stdout, stderr) => {
14
15
  resolve2({
15
16
  stdout,