@codexview/react 0.2.3 → 0.3.1

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/index.js CHANGED
@@ -429,12 +429,12 @@ class ItemErrorBoundary extends Component {
429
429
  }
430
430
  const turn = "cv-TurnContainer-module_turn_K9u-z";
431
431
  const axis = "cv-TurnContainer-module_axis_l5p4N";
432
- const styles$c = {
432
+ const styles$d = {
433
433
  turn,
434
434
  axis
435
435
  };
436
436
  function TurnContainer({ turn: turn2, children }) {
437
- return /* @__PURE__ */ jsx("section", { className: styles$c.turn, "data-turn-id": turn2.turnId, "data-turn-status": turn2.status, children: /* @__PURE__ */ jsx("div", { className: styles$c.axis, children }) });
437
+ return /* @__PURE__ */ jsx("section", { className: styles$d.turn, "data-turn-id": turn2.turnId, "data-turn-status": turn2.status, children: /* @__PURE__ */ jsx("div", { className: styles$d.axis, children }) });
438
438
  }
439
439
  function ok$1() {
440
440
  }
@@ -2940,7 +2940,7 @@ const attention = {
2940
2940
  function resolveAllAttention(events, context) {
2941
2941
  let index2 = -1;
2942
2942
  let open;
2943
- let group;
2943
+ let group2;
2944
2944
  let text2;
2945
2945
  let openingSequence;
2946
2946
  let closingSequence;
@@ -2988,7 +2988,7 @@ function resolveAllAttention(events, context) {
2988
2988
  ...events[index2][1].start
2989
2989
  }
2990
2990
  };
2991
- group = {
2991
+ group2 = {
2992
2992
  type: use > 1 ? "strong" : "emphasis",
2993
2993
  start: {
2994
2994
  ...openingSequence.start
@@ -3007,9 +3007,9 @@ function resolveAllAttention(events, context) {
3007
3007
  if (events[open][1].end.offset - events[open][1].start.offset) {
3008
3008
  nextEvents = push(nextEvents, [["enter", events[open][1], context], ["exit", events[open][1], context]]);
3009
3009
  }
3010
- nextEvents = push(nextEvents, [["enter", group, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter", text2, context]]);
3010
+ nextEvents = push(nextEvents, [["enter", group2, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter", text2, context]]);
3011
3011
  nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index2), context));
3012
- nextEvents = push(nextEvents, [["exit", text2, context], ["enter", closingSequence, context], ["exit", closingSequence, context], ["exit", group, context]]);
3012
+ nextEvents = push(nextEvents, [["exit", text2, context], ["enter", closingSequence, context], ["exit", closingSequence, context], ["exit", group2, context]]);
3013
3013
  if (events[index2][1].end.offset - events[index2][1].start.offset) {
3014
3014
  offset = 2;
3015
3015
  nextEvents = push(nextEvents, [["enter", events[index2][1], context], ["exit", events[index2][1], context]]);
@@ -5306,7 +5306,7 @@ function resolveToLabelEnd(events, context) {
5306
5306
  close = index2;
5307
5307
  }
5308
5308
  }
5309
- const group = {
5309
+ const group2 = {
5310
5310
  type: events[open][1].type === "labelLink" ? "link" : "image",
5311
5311
  start: {
5312
5312
  ...events[open][1].start
@@ -5333,13 +5333,13 @@ function resolveToLabelEnd(events, context) {
5333
5333
  ...events[close - 2][1].start
5334
5334
  }
5335
5335
  };
5336
- media = [["enter", group, context], ["enter", label2, context]];
5336
+ media = [["enter", group2, context], ["enter", label2, context]];
5337
5337
  media = push(media, events.slice(open + 1, open + offset + 3));
5338
5338
  media = push(media, [["enter", text2, context]]);
5339
5339
  media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));
5340
5340
  media = push(media, [["exit", text2, context], events[close - 2], events[close - 1], ["exit", label2, context]]);
5341
5341
  media = push(media, events.slice(close + 1));
5342
- media = push(media, [["exit", group, context]]);
5342
+ media = push(media, [["exit", group2, context]]);
5343
5343
  splice(events, open, events.length, media);
5344
5344
  return events;
5345
5345
  }
@@ -12987,7 +12987,7 @@ const directive = "cv-Markdown-module_directive_oMfF9";
12987
12987
  const directiveIcon = "cv-Markdown-module_directiveIcon_p2NKB";
12988
12988
  const directiveLabel = "cv-Markdown-module_directiveLabel_sCtAz";
12989
12989
  const directiveCwd = "cv-Markdown-module_directiveCwd_lctnI";
12990
- const styles$b = {
12990
+ const styles$c = {
12991
12991
  md,
12992
12992
  plain,
12993
12993
  directive,
@@ -12998,12 +12998,12 @@ const styles$b = {
12998
12998
  function MarkdownInner({ children, asPlain, className }) {
12999
12999
  const segments2 = useMemo(() => asPlain ? null : splitDirectives(children), [children, asPlain]);
13000
13000
  if (asPlain) {
13001
- return /* @__PURE__ */ jsx("span", { className: [styles$b.plain, className].filter(Boolean).join(" "), children });
13001
+ return /* @__PURE__ */ jsx("span", { className: [styles$c.plain, className].filter(Boolean).join(" "), children });
13002
13002
  }
13003
13003
  if (!segments2 || segments2.length === 1 && segments2[0].kind === "md") {
13004
- return /* @__PURE__ */ jsx("div", { className: [styles$b.md, className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx(Markdown$1, { remarkPlugins: [remarkGfm], children }) });
13004
+ return /* @__PURE__ */ jsx("div", { className: [styles$c.md, className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx(Markdown$1, { remarkPlugins: [remarkGfm], children }) });
13005
13005
  }
13006
- return /* @__PURE__ */ jsx("div", { className: [styles$b.md, className].filter(Boolean).join(" "), children: segments2.map((seg, i) => seg.kind === "md" ? /* @__PURE__ */ jsx(Markdown$1, { remarkPlugins: [remarkGfm], children: seg.text }, i) : /* @__PURE__ */ jsx(DirectiveBadge, { name: seg.name, params: seg.params }, i)) });
13006
+ return /* @__PURE__ */ jsx("div", { className: [styles$c.md, className].filter(Boolean).join(" "), children: segments2.map((seg, i) => seg.kind === "md" ? /* @__PURE__ */ jsx(Markdown$1, { remarkPlugins: [remarkGfm], children: seg.text }, i) : /* @__PURE__ */ jsx(DirectiveBadge, { name: seg.name, params: seg.params }, i)) });
13007
13007
  }
13008
13008
  const Markdown = memo(MarkdownInner);
13009
13009
  const DIRECTIVE_LINE_RE = /^[ \t]*::([a-z][a-z0-9-]*)\{([^}\n]*)\}[ \t]*$/gm;
@@ -13051,15 +13051,15 @@ function DirectiveBadge({ name: name2, params }) {
13051
13051
  const href = typeof params.url === "string" ? params.url : null;
13052
13052
  const cwd2 = typeof params.cwd === "string" ? params.cwd.split("/").pop() : null;
13053
13053
  const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
13054
- /* @__PURE__ */ jsx("span", { className: styles$b.directiveIcon, children: icon2 }),
13055
- /* @__PURE__ */ jsx("span", { className: styles$b.directiveLabel, children: label2 }),
13056
- cwd2 && /* @__PURE__ */ jsx("span", { className: styles$b.directiveCwd, children: cwd2 })
13054
+ /* @__PURE__ */ jsx("span", { className: styles$c.directiveIcon, children: icon2 }),
13055
+ /* @__PURE__ */ jsx("span", { className: styles$c.directiveLabel, children: label2 }),
13056
+ cwd2 && /* @__PURE__ */ jsx("span", { className: styles$c.directiveCwd, children: cwd2 })
13057
13057
  ] });
13058
- return href ? /* @__PURE__ */ jsx("a", { className: styles$b.directive, href, target: "_blank", rel: "noopener noreferrer", children: inner }) : /* @__PURE__ */ jsx("span", { className: styles$b.directive, children: inner });
13058
+ return href ? /* @__PURE__ */ jsx("a", { className: styles$c.directive, href, target: "_blank", rel: "noopener noreferrer", children: inner }) : /* @__PURE__ */ jsx("span", { className: styles$c.directive, children: inner });
13059
13059
  }
13060
13060
  const bubble = "cv-MessageBubble-module_bubble_p3YO4";
13061
13061
  const caret = "cv-MessageBubble-module_caret_X01-n";
13062
- const styles$a = {
13062
+ const styles$b = {
13063
13063
  bubble,
13064
13064
  caret
13065
13065
  };
@@ -13071,12 +13071,12 @@ function MessageBubble({ item, smoothStream = true, markdown = true }) {
13071
13071
  return /* @__PURE__ */ jsxs(
13072
13072
  "div",
13073
13073
  {
13074
- className: styles$a.bubble,
13074
+ className: styles$b.bubble,
13075
13075
  "data-role": isUser ? "user" : "assistant",
13076
13076
  "data-status": item.status,
13077
13077
  children: [
13078
13078
  /* @__PURE__ */ jsx(Markdown, { asPlain: !useMd, children: text2 }),
13079
- item.status === "running" && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: styles$a.caret, children: "▋" })
13079
+ item.status === "running" && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: styles$b.caret, children: "▋" })
13080
13080
  ]
13081
13081
  }
13082
13082
  );
@@ -13091,11 +13091,11 @@ const ICONS = {
13091
13091
  };
13092
13092
  const block$7 = "cv-ReasoningBlock-module_block_TXeXs";
13093
13093
  const summary$2 = "cv-ReasoningBlock-module_summary_0DCmn";
13094
- const body$3 = "cv-ReasoningBlock-module_body_hXsT2";
13095
- const styles$9 = {
13094
+ const body$4 = "cv-ReasoningBlock-module_body_hXsT2";
13095
+ const styles$a = {
13096
13096
  block: block$7,
13097
13097
  summary: summary$2,
13098
- body: body$3
13098
+ body: body$4
13099
13099
  };
13100
13100
  function durationLabel(ms) {
13101
13101
  if (ms < 1e3) return `${ms}ms`;
@@ -13107,12 +13107,12 @@ function ReasoningBlock({ item, defaultOpen = false, smoothStream = true, markdo
13107
13107
  const text2 = useSmoothStream(item.text, { enabled: smoothStream && live });
13108
13108
  const elapsed = item.updatedAt - item.startedAt;
13109
13109
  const useMd = markdown && !live;
13110
- return /* @__PURE__ */ jsxs("details", { className: styles$9.block, open: defaultOpen || live, children: [
13111
- /* @__PURE__ */ jsxs("summary", { className: styles$9.summary, children: [
13110
+ return /* @__PURE__ */ jsxs("details", { className: styles$a.block, open: defaultOpen || live, children: [
13111
+ /* @__PURE__ */ jsxs("summary", { className: styles$a.summary, children: [
13112
13112
  /* @__PURE__ */ jsx(Icon, { size: 14, "aria-hidden": true }),
13113
13113
  /* @__PURE__ */ jsx("span", { children: live ? "思考中…" : `思考 (${durationLabel(elapsed)})` })
13114
13114
  ] }),
13115
- /* @__PURE__ */ jsx("div", { className: styles$9.body, children: /* @__PURE__ */ jsx(Markdown, { asPlain: !useMd, children: text2 }) })
13115
+ /* @__PURE__ */ jsx("div", { className: styles$a.body, children: /* @__PURE__ */ jsx(Markdown, { asPlain: !useMd, children: text2 }) })
13116
13116
  ] });
13117
13117
  }
13118
13118
  function safeStringify(value) {
@@ -13123,21 +13123,21 @@ function safeStringify(value) {
13123
13123
  }
13124
13124
  }
13125
13125
  const block$6 = "cv-ToolCallBlock-module_block_dNRp9";
13126
- const header$3 = "cv-ToolCallBlock-module_header_--wWa";
13127
- const title = "cv-ToolCallBlock-module_title_F75hj";
13126
+ const header$4 = "cv-ToolCallBlock-module_header_--wWa";
13127
+ const title$1 = "cv-ToolCallBlock-module_title_F75hj";
13128
13128
  const statusChip = "cv-ToolCallBlock-module_statusChip_srL2P";
13129
13129
  const label$1 = "cv-ToolCallBlock-module_label_T8ftn";
13130
- const body$2 = "cv-ToolCallBlock-module_body_4IH9O";
13130
+ const body$3 = "cv-ToolCallBlock-module_body_4IH9O";
13131
13131
  const code$1 = "cv-ToolCallBlock-module_code_4TYxX";
13132
13132
  const error = "cv-ToolCallBlock-module_error_n7qO-";
13133
13133
  const result = "cv-ToolCallBlock-module_result_BmMtL";
13134
- const styles$8 = {
13134
+ const styles$9 = {
13135
13135
  block: block$6,
13136
- header: header$3,
13137
- title,
13136
+ header: header$4,
13137
+ title: title$1,
13138
13138
  statusChip,
13139
13139
  label: label$1,
13140
- body: body$2,
13140
+ body: body$3,
13141
13141
  code: code$1,
13142
13142
  error,
13143
13143
  result
@@ -13147,42 +13147,42 @@ function phrase(name2, server) {
13147
13147
  }
13148
13148
  function ResultBody({ value }) {
13149
13149
  if (typeof value === "string") return /* @__PURE__ */ jsx(Markdown, { children: value });
13150
- return /* @__PURE__ */ jsx("pre", { className: styles$8.code, children: safeStringify(value) });
13150
+ return /* @__PURE__ */ jsx("pre", { className: styles$9.code, children: safeStringify(value) });
13151
13151
  }
13152
13152
  function ToolCallBlock({ item, defaultOpen = false }) {
13153
13153
  const Icon = ICONS.tool;
13154
13154
  const open = defaultOpen || item.status === "pending" || item.status === "running";
13155
- return /* @__PURE__ */ jsxs("details", { className: styles$8.block, "data-status": item.status, open, children: [
13156
- /* @__PURE__ */ jsxs("summary", { className: styles$8.header, children: [
13155
+ return /* @__PURE__ */ jsxs("details", { className: styles$9.block, "data-status": item.status, open, children: [
13156
+ /* @__PURE__ */ jsxs("summary", { className: styles$9.header, children: [
13157
13157
  /* @__PURE__ */ jsx(Icon, { size: 14, "aria-hidden": true }),
13158
- /* @__PURE__ */ jsx("span", { className: styles$8.title, children: phrase(item.name, item.server) }),
13159
- /* @__PURE__ */ jsx("span", { className: styles$8.statusChip, children: item.status })
13158
+ /* @__PURE__ */ jsx("span", { className: styles$9.title, children: phrase(item.name, item.server) }),
13159
+ /* @__PURE__ */ jsx("span", { className: styles$9.statusChip, children: item.status })
13160
13160
  ] }),
13161
- /* @__PURE__ */ jsxs("div", { className: styles$8.body, children: [
13162
- /* @__PURE__ */ jsxs("div", { className: styles$8.args, children: [
13163
- /* @__PURE__ */ jsx("div", { className: styles$8.label, children: "args" }),
13164
- /* @__PURE__ */ jsx("pre", { className: styles$8.code, children: safeStringify(item.args) })
13161
+ /* @__PURE__ */ jsxs("div", { className: styles$9.body, children: [
13162
+ /* @__PURE__ */ jsxs("div", { className: styles$9.args, children: [
13163
+ /* @__PURE__ */ jsx("div", { className: styles$9.label, children: "args" }),
13164
+ /* @__PURE__ */ jsx("pre", { className: styles$9.code, children: safeStringify(item.args) })
13165
13165
  ] }),
13166
- item.error !== void 0 && /* @__PURE__ */ jsx("div", { className: styles$8.error, children: item.error }),
13167
- item.result !== void 0 && /* @__PURE__ */ jsxs("div", { className: styles$8.result, children: [
13168
- /* @__PURE__ */ jsx("div", { className: styles$8.label, children: "result" }),
13166
+ item.error !== void 0 && /* @__PURE__ */ jsx("div", { className: styles$9.error, children: item.error }),
13167
+ item.result !== void 0 && /* @__PURE__ */ jsxs("div", { className: styles$9.result, children: [
13168
+ /* @__PURE__ */ jsx("div", { className: styles$9.label, children: "result" }),
13169
13169
  /* @__PURE__ */ jsx(ResultBody, { value: item.result })
13170
13170
  ] })
13171
13171
  ] })
13172
13172
  ] });
13173
13173
  }
13174
13174
  const block$5 = "cv-ExecBlock-module_block_GHBDd";
13175
- const header$2 = "cv-ExecBlock-module_header_-s9DN";
13176
- const body$1 = "cv-ExecBlock-module_body_cKLAV";
13175
+ const header$3 = "cv-ExecBlock-module_header_-s9DN";
13176
+ const body$2 = "cv-ExecBlock-module_body_cKLAV";
13177
13177
  const cmd = "cv-ExecBlock-module_cmd_KpfNN";
13178
13178
  const exit = "cv-ExecBlock-module_exit_H-E6L";
13179
13179
  const stdout = "cv-ExecBlock-module_stdout_IHwS1";
13180
13180
  const stderr = "cv-ExecBlock-module_stderr_-DESS";
13181
13181
  const shimmer = "cv-ExecBlock-module_shimmer_e98BB";
13182
- const styles$7 = {
13182
+ const styles$8 = {
13183
13183
  block: block$5,
13184
- header: header$2,
13185
- body: body$1,
13184
+ header: header$3,
13185
+ body: body$2,
13186
13186
  cmd,
13187
13187
  exit,
13188
13188
  stdout,
@@ -13194,33 +13194,33 @@ function ExecBlock({ item, defaultOpen = false }) {
13194
13194
  const running = item.status === "running";
13195
13195
  const open = defaultOpen || running;
13196
13196
  const exitText = item.exit != null ? `(exit ${item.exit}, ${item.durationMs ?? "?"}ms)` : "";
13197
- return /* @__PURE__ */ jsxs("details", { className: styles$7.block, "data-status": item.status, open, children: [
13198
- /* @__PURE__ */ jsxs("summary", { className: styles$7.header, children: [
13197
+ return /* @__PURE__ */ jsxs("details", { className: styles$8.block, "data-status": item.status, open, children: [
13198
+ /* @__PURE__ */ jsxs("summary", { className: styles$8.header, children: [
13199
13199
  /* @__PURE__ */ jsx(Icon, { size: 14, "aria-hidden": true }),
13200
- /* @__PURE__ */ jsxs("code", { className: styles$7.cmd, children: [
13200
+ /* @__PURE__ */ jsxs("code", { className: styles$8.cmd, children: [
13201
13201
  "$ ",
13202
13202
  item.command
13203
13203
  ] }),
13204
- /* @__PURE__ */ jsx("span", { className: styles$7.exit, children: exitText })
13204
+ /* @__PURE__ */ jsx("span", { className: styles$8.exit, children: exitText })
13205
13205
  ] }),
13206
- /* @__PURE__ */ jsxs("div", { className: styles$7.body, children: [
13207
- running && /* @__PURE__ */ jsx("div", { className: styles$7.shimmer, "aria-hidden": true }),
13208
- item.stdout && /* @__PURE__ */ jsx("pre", { className: styles$7.stdout, children: item.stdout }),
13209
- item.stderr && /* @__PURE__ */ jsx("pre", { className: styles$7.stderr, children: item.stderr })
13206
+ /* @__PURE__ */ jsxs("div", { className: styles$8.body, children: [
13207
+ running && /* @__PURE__ */ jsx("div", { className: styles$8.shimmer, "aria-hidden": true }),
13208
+ item.stdout && /* @__PURE__ */ jsx("pre", { className: styles$8.stdout, children: item.stdout }),
13209
+ item.stderr && /* @__PURE__ */ jsx("pre", { className: styles$8.stderr, children: item.stderr })
13210
13210
  ] })
13211
13211
  ] });
13212
13212
  }
13213
13213
  const block$4 = "cv-SearchBlock-module_block_1e-lg";
13214
- const header$1 = "cv-SearchBlock-module_header_US9Dx";
13215
- const body = "cv-SearchBlock-module_body_ejMnH";
13214
+ const header$2 = "cv-SearchBlock-module_header_US9Dx";
13215
+ const body$1 = "cv-SearchBlock-module_body_ejMnH";
13216
13216
  const query = "cv-SearchBlock-module_query_-MKAZ";
13217
13217
  const results = "cv-SearchBlock-module_results_98bPq";
13218
13218
  const snippet = "cv-SearchBlock-module_snippet_5UfAk";
13219
13219
  const more = "cv-SearchBlock-module_more_87QEd";
13220
- const styles$6 = {
13220
+ const styles$7 = {
13221
13221
  block: block$4,
13222
- header: header$1,
13223
- body,
13222
+ header: header$2,
13223
+ body: body$1,
13224
13224
  query,
13225
13225
  results,
13226
13226
  snippet,
@@ -13233,17 +13233,17 @@ function SearchBlock({ item, initialVisible = 3, defaultOpen = false }) {
13233
13233
  const visible = showAll ? results2 : results2.slice(0, initialVisible);
13234
13234
  const remaining = results2.length - visible.length;
13235
13235
  const open = defaultOpen || item.status === "pending" || item.status === "running";
13236
- return /* @__PURE__ */ jsxs("details", { className: styles$6.block, "data-status": item.status, open, children: [
13237
- /* @__PURE__ */ jsxs("summary", { className: styles$6.header, children: [
13236
+ return /* @__PURE__ */ jsxs("details", { className: styles$7.block, "data-status": item.status, open, children: [
13237
+ /* @__PURE__ */ jsxs("summary", { className: styles$7.header, children: [
13238
13238
  /* @__PURE__ */ jsx(Icon, { size: 14, "aria-hidden": true }),
13239
- /* @__PURE__ */ jsx("span", { className: styles$6.query, children: item.query })
13239
+ /* @__PURE__ */ jsx("span", { className: styles$7.query, children: item.query })
13240
13240
  ] }),
13241
- /* @__PURE__ */ jsxs("div", { className: styles$6.body, children: [
13242
- results2.length > 0 && /* @__PURE__ */ jsx("ol", { className: styles$6.results, children: visible.map((r) => /* @__PURE__ */ jsxs("li", { children: [
13241
+ /* @__PURE__ */ jsxs("div", { className: styles$7.body, children: [
13242
+ results2.length > 0 && /* @__PURE__ */ jsx("ol", { className: styles$7.results, children: visible.map((r) => /* @__PURE__ */ jsxs("li", { children: [
13243
13243
  /* @__PURE__ */ jsx("a", { href: r.url, target: "_blank", rel: "noreferrer", children: r.title }),
13244
- r.snippet && /* @__PURE__ */ jsx("p", { className: styles$6.snippet, children: r.snippet })
13244
+ r.snippet && /* @__PURE__ */ jsx("p", { className: styles$7.snippet, children: r.snippet })
13245
13245
  ] }, r.url)) }),
13246
- remaining > 0 && /* @__PURE__ */ jsxs("button", { type: "button", className: styles$6.more, onClick: (e) => {
13246
+ remaining > 0 && /* @__PURE__ */ jsxs("button", { type: "button", className: styles$7.more, onClick: (e) => {
13247
13247
  e.preventDefault();
13248
13248
  setShowAll(true);
13249
13249
  }, children: [
@@ -13255,15 +13255,15 @@ function SearchBlock({ item, initialVisible = 3, defaultOpen = false }) {
13255
13255
  ] });
13256
13256
  }
13257
13257
  const block$3 = "cv-PatchBlock-module_block_hODNV";
13258
- const header = "cv-PatchBlock-module_header_hKbgB";
13258
+ const header$1 = "cv-PatchBlock-module_header_hKbgB";
13259
13259
  const files = "cv-PatchBlock-module_files_RTnl0";
13260
13260
  const tag = "cv-PatchBlock-module_tag_9PGRP";
13261
13261
  const diff = "cv-PatchBlock-module_diff_zboyM";
13262
13262
  const add = "cv-PatchBlock-module_add_Y2VHb";
13263
13263
  const del = "cv-PatchBlock-module_del_i2akI";
13264
- const styles$5 = {
13264
+ const styles$6 = {
13265
13265
  block: block$3,
13266
- header,
13266
+ header: header$1,
13267
13267
  files,
13268
13268
  tag,
13269
13269
  diff,
@@ -13273,8 +13273,8 @@ const styles$5 = {
13273
13273
  function colorLines(diff2) {
13274
13274
  return diff2.split("\n").map((line, i) => {
13275
13275
  let cls = "";
13276
- if (line.startsWith("+") && !line.startsWith("+++")) cls = styles$5.add;
13277
- else if (line.startsWith("-") && !line.startsWith("---")) cls = styles$5.del;
13276
+ if (line.startsWith("+") && !line.startsWith("+++")) cls = styles$6.add;
13277
+ else if (line.startsWith("-") && !line.startsWith("---")) cls = styles$6.del;
13278
13278
  return /* @__PURE__ */ jsxs("span", { className: cls, children: [
13279
13279
  line,
13280
13280
  "\n"
@@ -13283,8 +13283,8 @@ function colorLines(diff2) {
13283
13283
  }
13284
13284
  function PatchBlock({ item, defaultOpen = false }) {
13285
13285
  const Icon = ICONS.patch;
13286
- return /* @__PURE__ */ jsxs("details", { className: styles$5.block, "data-status": item.status, open: defaultOpen, children: [
13287
- /* @__PURE__ */ jsxs("summary", { className: styles$5.header, children: [
13286
+ return /* @__PURE__ */ jsxs("details", { className: styles$6.block, "data-status": item.status, open: defaultOpen, children: [
13287
+ /* @__PURE__ */ jsxs("summary", { className: styles$6.header, children: [
13288
13288
  /* @__PURE__ */ jsx(Icon, { size: 14, "aria-hidden": true }),
13289
13289
  /* @__PURE__ */ jsxs("span", { children: [
13290
13290
  item.files.length,
@@ -13293,12 +13293,12 @@ function PatchBlock({ item, defaultOpen = false }) {
13293
13293
  ")"
13294
13294
  ] })
13295
13295
  ] }),
13296
- /* @__PURE__ */ jsx("ul", { className: styles$5.files, children: item.files.map((f) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("details", { children: [
13296
+ /* @__PURE__ */ jsx("ul", { className: styles$6.files, children: item.files.map((f) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("details", { children: [
13297
13297
  /* @__PURE__ */ jsxs("summary", { children: [
13298
13298
  /* @__PURE__ */ jsx("code", { children: f.path }),
13299
- /* @__PURE__ */ jsx("span", { className: styles$5.tag, "data-kind": f.status, children: f.status })
13299
+ /* @__PURE__ */ jsx("span", { className: styles$6.tag, "data-kind": f.status, children: f.status })
13300
13300
  ] }),
13301
- f.diff && /* @__PURE__ */ jsx("pre", { className: styles$5.diff, children: colorLines(f.diff) })
13301
+ f.diff && /* @__PURE__ */ jsx("pre", { className: styles$6.diff, children: colorLines(f.diff) })
13302
13302
  ] }) }, f.path)) })
13303
13303
  ] });
13304
13304
  }
@@ -13309,7 +13309,7 @@ const list$1 = "cv-TodoListBlock-module_list_YIRUN";
13309
13309
  const entry = "cv-TodoListBlock-module_entry_KfZlY";
13310
13310
  const text = "cv-TodoListBlock-module_text_SxUVW";
13311
13311
  const check = "cv-TodoListBlock-module_check_t7lTt";
13312
- const styles$4 = {
13312
+ const styles$5 = {
13313
13313
  block: block$2,
13314
13314
  summary: summary$1,
13315
13315
  icon,
@@ -13322,34 +13322,34 @@ function TodoListBlock({ item, defaultOpen = false }) {
13322
13322
  const total = item.items.length;
13323
13323
  const done = item.items.filter((e) => e.completed).length;
13324
13324
  const summary2 = total === 0 ? "计划" : `计划 (${done}/${total})`;
13325
- return /* @__PURE__ */ jsxs("details", { className: styles$4.block, "data-status": item.status, open: defaultOpen || item.status === "running", children: [
13326
- /* @__PURE__ */ jsxs("summary", { className: styles$4.summary, children: [
13327
- /* @__PURE__ */ jsx("span", { className: styles$4.icon, "aria-hidden": true, children: "📋" }),
13325
+ return /* @__PURE__ */ jsxs("details", { className: styles$5.block, "data-status": item.status, open: defaultOpen || item.status === "running", children: [
13326
+ /* @__PURE__ */ jsxs("summary", { className: styles$5.summary, children: [
13327
+ /* @__PURE__ */ jsx("span", { className: styles$5.icon, "aria-hidden": true, children: "📋" }),
13328
13328
  /* @__PURE__ */ jsx("span", { children: summary2 })
13329
13329
  ] }),
13330
- /* @__PURE__ */ jsx("ul", { className: styles$4.list, children: item.items.map((entry2, i) => /* @__PURE__ */ jsxs("li", { className: styles$4.entry, "data-completed": entry2.completed, children: [
13331
- /* @__PURE__ */ jsx("span", { className: styles$4.check, "aria-hidden": true, children: entry2.completed ? "☑" : "☐" }),
13332
- /* @__PURE__ */ jsx("span", { className: styles$4.text, children: entry2.text })
13330
+ /* @__PURE__ */ jsx("ul", { className: styles$5.list, children: item.items.map((entry2, i) => /* @__PURE__ */ jsxs("li", { className: styles$5.entry, "data-completed": entry2.completed, children: [
13331
+ /* @__PURE__ */ jsx("span", { className: styles$5.check, "aria-hidden": true, children: entry2.completed ? "☑" : "☐" }),
13332
+ /* @__PURE__ */ jsx("span", { className: styles$5.text, children: entry2.text })
13333
13333
  ] }, i)) })
13334
13334
  ] });
13335
13335
  }
13336
13336
  const block$1 = "cv-ErrorBlock-module_block_TlAYA";
13337
13337
  const message = "cv-ErrorBlock-module_message_hJ57N";
13338
- const styles$3 = {
13338
+ const styles$4 = {
13339
13339
  block: block$1,
13340
13340
  message
13341
13341
  };
13342
13342
  function ErrorBlock({ item }) {
13343
13343
  const Icon = ICONS.warn;
13344
- return /* @__PURE__ */ jsxs("div", { className: styles$3.block, role: "alert", children: [
13344
+ return /* @__PURE__ */ jsxs("div", { className: styles$4.block, role: "alert", children: [
13345
13345
  /* @__PURE__ */ jsx(Icon, { size: 14, "aria-hidden": true }),
13346
- /* @__PURE__ */ jsx("span", { className: styles$3.message, children: item.message })
13346
+ /* @__PURE__ */ jsx("span", { className: styles$4.message, children: item.message })
13347
13347
  ] });
13348
13348
  }
13349
13349
  const block = "cv-RawEventBlock-module_block_SSjbJ";
13350
13350
  const summary = "cv-RawEventBlock-module_summary_cjM7J";
13351
13351
  const code = "cv-RawEventBlock-module_code_WK6CT";
13352
- const styles$2 = {
13352
+ const styles$3 = {
13353
13353
  block,
13354
13354
  summary,
13355
13355
  code
@@ -13361,22 +13361,22 @@ function RawEventBlock({ item }) {
13361
13361
  if (p && typeof p === "object" && "type" in p) return String(p.type);
13362
13362
  return "unknown";
13363
13363
  })();
13364
- return /* @__PURE__ */ jsxs("details", { className: styles$2.block, children: [
13365
- /* @__PURE__ */ jsxs("summary", { className: styles$2.summary, children: [
13364
+ return /* @__PURE__ */ jsxs("details", { className: styles$3.block, children: [
13365
+ /* @__PURE__ */ jsxs("summary", { className: styles$3.summary, children: [
13366
13366
  /* @__PURE__ */ jsx(Icon, { size: 14, "aria-hidden": true }),
13367
13367
  /* @__PURE__ */ jsxs("span", { children: [
13368
13368
  "未知事件: ",
13369
13369
  typeLabel
13370
13370
  ] })
13371
13371
  ] }),
13372
- /* @__PURE__ */ jsx("pre", { className: styles$2.code, children: safeStringify(item.payload) })
13372
+ /* @__PURE__ */ jsx("pre", { className: styles$3.code, children: safeStringify(item.payload) })
13373
13373
  ] });
13374
13374
  }
13375
13375
  const bar = "cv-StatusBar-module_bar_fBXHf";
13376
13376
  const pulse = "cv-StatusBar-module_pulse_t8PkB";
13377
13377
  const label = "cv-StatusBar-module_label_4CK2X";
13378
13378
  const errorDetails = "cv-StatusBar-module_errorDetails_MEtRk";
13379
- const styles$1 = {
13379
+ const styles$2 = {
13380
13380
  bar,
13381
13381
  pulse,
13382
13382
  label,
@@ -13392,15 +13392,100 @@ const LABELS = {
13392
13392
  function StatusBar({ status, label: label2, error: error2 }) {
13393
13393
  if (status === "idle") return null;
13394
13394
  const text2 = label2 ?? LABELS[status];
13395
- return /* @__PURE__ */ jsxs("div", { className: styles$1.bar, "data-status": status, role: "status", "aria-live": "polite", children: [
13396
- status === "working" && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: styles$1.pulse }),
13397
- /* @__PURE__ */ jsx("span", { className: styles$1.label, children: text2 }),
13398
- error2 && /* @__PURE__ */ jsxs("details", { className: styles$1.errorDetails, children: [
13395
+ return /* @__PURE__ */ jsxs("div", { className: styles$2.bar, "data-status": status, role: "status", "aria-live": "polite", children: [
13396
+ status === "working" && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: styles$2.pulse }),
13397
+ /* @__PURE__ */ jsx("span", { className: styles$2.label, children: text2 }),
13398
+ error2 && /* @__PURE__ */ jsxs("details", { className: styles$2.errorDetails, children: [
13399
13399
  /* @__PURE__ */ jsx("summary", { children: error2.message }),
13400
13400
  error2.details && /* @__PURE__ */ jsx("pre", { children: error2.details })
13401
13401
  ] })
13402
13402
  ] });
13403
13403
  }
13404
+ const group = "cv-ToolGroup-module_group_WufLG";
13405
+ const header = "cv-ToolGroup-module_header_ycctp";
13406
+ const title = "cv-ToolGroup-module_title_qIalM";
13407
+ const body = "cv-ToolGroup-module_body_G35LW";
13408
+ const styles$1 = {
13409
+ group,
13410
+ header,
13411
+ title,
13412
+ body
13413
+ };
13414
+ const GROUPABLE_KINDS = /* @__PURE__ */ new Set([
13415
+ "tool_call",
13416
+ "exec",
13417
+ "search",
13418
+ "patch",
13419
+ "todo_list",
13420
+ "raw"
13421
+ ]);
13422
+ function isGroupableKind(kind) {
13423
+ return GROUPABLE_KINDS.has(kind);
13424
+ }
13425
+ function partitionForGrouping(items) {
13426
+ const slices = [];
13427
+ let buffer = [];
13428
+ const flush = () => {
13429
+ if (buffer.length === 0) return;
13430
+ slices.push({ kind: "group", items: buffer });
13431
+ buffer = [];
13432
+ };
13433
+ for (const item of items) {
13434
+ if (isGroupableKind(item.kind)) buffer.push(item);
13435
+ else {
13436
+ flush();
13437
+ slices.push({ kind: "single", item });
13438
+ }
13439
+ }
13440
+ flush();
13441
+ return slices;
13442
+ }
13443
+ function summarize(items) {
13444
+ let exec = 0;
13445
+ let patch2 = 0;
13446
+ let toolCall = 0;
13447
+ let search2 = 0;
13448
+ let todo = 0;
13449
+ let raw = 0;
13450
+ for (const it of items) {
13451
+ switch (it.kind) {
13452
+ case "exec":
13453
+ exec++;
13454
+ break;
13455
+ case "patch":
13456
+ patch2++;
13457
+ break;
13458
+ case "tool_call":
13459
+ toolCall++;
13460
+ break;
13461
+ case "search":
13462
+ search2++;
13463
+ break;
13464
+ case "todo_list":
13465
+ todo++;
13466
+ break;
13467
+ case "raw":
13468
+ raw++;
13469
+ break;
13470
+ }
13471
+ }
13472
+ const parts = [];
13473
+ if (todo > 0) parts.push("更新待办");
13474
+ if (exec > 0) parts.push(`执行 ${exec} 个命令`);
13475
+ if (patch2 > 0) parts.push(`修改 ${patch2} 个文件`);
13476
+ if (toolCall > 0) parts.push(`调用 ${toolCall} 个工具`);
13477
+ if (search2 > 0) parts.push(`搜索 ${search2} 次`);
13478
+ if (raw > 0) parts.push(`${raw} 个事件`);
13479
+ return parts.length === 0 ? "工具操作" : parts.join("、");
13480
+ }
13481
+ function ToolGroup({ items, children, defaultOpen = false }) {
13482
+ const live = items.some((i) => i.status === "pending" || i.status === "running");
13483
+ const open = defaultOpen || live;
13484
+ return /* @__PURE__ */ jsxs("details", { className: styles$1.group, open, children: [
13485
+ /* @__PURE__ */ jsx("summary", { className: styles$1.header, children: /* @__PURE__ */ jsx("span", { className: styles$1.title, children: summarize(items) }) }),
13486
+ /* @__PURE__ */ jsx("div", { className: styles$1.body, children })
13487
+ ] });
13488
+ }
13404
13489
  const root$1 = "cv-reset-module_root_dBpwH";
13405
13490
  const resetStyles = {
13406
13491
  root: root$1
@@ -13425,7 +13510,8 @@ const DEFAULTS = {
13425
13510
  PatchBlock,
13426
13511
  TodoListBlock,
13427
13512
  ErrorBlock,
13428
- RawEventBlock
13513
+ RawEventBlock,
13514
+ ToolGroup
13429
13515
  };
13430
13516
  function flatItems(turns) {
13431
13517
  const out = [];
@@ -13467,7 +13553,14 @@ function CodexTranscript(props) {
13467
13553
  truncated.omitted,
13468
13554
  " 条"
13469
13555
  ] }),
13470
- /* @__PURE__ */ jsx("ol", { className: styles.list, role: "log", "aria-live": "polite", "aria-relevant": "additions text", children: turnsToRender.map((turn2) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(TurnContainer, { turn: turn2, children: (byTurn.get(turn2.turnId) ?? []).map((item) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(ItemErrorBoundary, { fallback: /* @__PURE__ */ jsx(components.RawEventBlock, { item: { id: item.id, kind: "raw", status: item.status, startedAt: item.startedAt, updatedAt: item.updatedAt, payload: item } }), children: /* @__PURE__ */ jsx("div", { onClick: handleClick(item.id), children: renderItem(item, components, props.disableSmoothStream) }) }) }, item.id)) }) }, turn2.turnId)) })
13556
+ /* @__PURE__ */ jsx("ol", { className: styles.list, role: "log", "aria-live": "polite", "aria-relevant": "additions text", children: turnsToRender.map((turn2) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(TurnContainer, { turn: turn2, children: partitionForGrouping(byTurn.get(turn2.turnId) ?? []).map((slice, idx) => {
13557
+ var _a;
13558
+ if (slice.kind === "single") {
13559
+ const item = slice.item;
13560
+ return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(ItemErrorBoundary, { fallback: /* @__PURE__ */ jsx(components.RawEventBlock, { item: { id: item.id, kind: "raw", status: item.status, startedAt: item.startedAt, updatedAt: item.updatedAt, payload: item } }), children: /* @__PURE__ */ jsx("div", { onClick: handleClick(item.id), children: renderItem(item, components, props.disableSmoothStream) }) }) }, item.id);
13561
+ }
13562
+ return /* @__PURE__ */ jsx(components.ToolGroup, { items: slice.items, children: slice.items.map((item) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(ItemErrorBoundary, { fallback: /* @__PURE__ */ jsx(components.RawEventBlock, { item: { id: item.id, kind: "raw", status: item.status, startedAt: item.startedAt, updatedAt: item.updatedAt, payload: item } }), children: /* @__PURE__ */ jsx("div", { onClick: handleClick(item.id), children: renderItem(item, components, props.disableSmoothStream) }) }) }, item.id)) }, `group-${idx}-${((_a = slice.items[0]) == null ? void 0 : _a.id) ?? ""}`);
13563
+ }) }) }, turn2.turnId)) })
13471
13564
  ] });
13472
13565
  }
13473
13566
  function renderItem(item, c, disableSmoothStream) {
@@ -13494,7 +13587,7 @@ function renderItem(item, c, disableSmoothStream) {
13494
13587
  return /* @__PURE__ */ jsx(c.RawEventBlock, { item });
13495
13588
  }
13496
13589
  }
13497
- const VERSION = "0.1.4";
13590
+ const VERSION = "0.3.1";
13498
13591
  export {
13499
13592
  CodexTranscript,
13500
13593
  EMPTY_MODEL,
@@ -13510,10 +13603,14 @@ export {
13510
13603
  StatusBar,
13511
13604
  TodoListBlock,
13512
13605
  ToolCallBlock,
13606
+ ToolGroup,
13513
13607
  TurnContainer,
13514
13608
  VERSION,
13515
13609
  inferStatus,
13610
+ isGroupableKind,
13611
+ partitionForGrouping,
13516
13612
  reduceTranscript,
13613
+ summarize as summarizeToolGroup,
13517
13614
  useCodexTranscript,
13518
13615
  useSmoothStream
13519
13616
  };