@makinbakin/sdk 0.0.0-bootstrap.0 → 0.0.1-rc.2

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.
@@ -1921,18 +1921,31 @@ var __iconNode = [
1921
1921
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
1922
1922
  ];
1923
1923
  var CircleAlert = createLucideIcon("circle-alert", __iconNode);
1924
- // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/circle-question-mark.js
1924
+ // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/circle-check.js
1925
1925
  var __iconNode2 = [
1926
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
1927
+ ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
1928
+ ];
1929
+ var CircleCheck = createLucideIcon("circle-check", __iconNode2);
1930
+ // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/circle-question-mark.js
1931
+ var __iconNode3 = [
1926
1932
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
1927
1933
  ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
1928
1934
  ["path", { d: "M12 17h.01", key: "p32p05" }]
1929
1935
  ];
1930
- var CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode2);
1936
+ var CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode3);
1937
+ // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/circle-x.js
1938
+ var __iconNode4 = [
1939
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
1940
+ ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
1941
+ ["path", { d: "m9 9 6 6", key: "z0biqf" }]
1942
+ ];
1943
+ var CircleX = createLucideIcon("circle-x", __iconNode4);
1931
1944
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/loader-circle.js
1932
- var __iconNode3 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
1933
- var LoaderCircle = createLucideIcon("loader-circle", __iconNode3);
1945
+ var __iconNode5 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
1946
+ var LoaderCircle = createLucideIcon("loader-circle", __iconNode5);
1934
1947
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/sparkles.js
1935
- var __iconNode4 = [
1948
+ var __iconNode6 = [
1936
1949
  [
1937
1950
  "path",
1938
1951
  {
@@ -1944,52 +1957,80 @@ var __iconNode4 = [
1944
1957
  ["path", { d: "M22 4h-4", key: "gwowj6" }],
1945
1958
  ["circle", { cx: "4", cy: "20", r: "2", key: "6kqj1y" }]
1946
1959
  ];
1947
- var Sparkles = createLucideIcon("sparkles", __iconNode4);
1960
+ var Sparkles = createLucideIcon("sparkles", __iconNode6);
1961
+ // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/triangle-alert.js
1962
+ var __iconNode7 = [
1963
+ [
1964
+ "path",
1965
+ {
1966
+ d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
1967
+ key: "wmoenq"
1968
+ }
1969
+ ],
1970
+ ["path", { d: "M12 9v4", key: "juzpu7" }],
1971
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
1972
+ ];
1973
+ var TriangleAlert = createLucideIcon("triangle-alert", __iconNode7);
1948
1974
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/arrow-left.js
1949
- var __iconNode5 = [
1975
+ var __iconNode8 = [
1950
1976
  ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
1951
1977
  ["path", { d: "M19 12H5", key: "x3x0zl" }]
1952
1978
  ];
1953
- var ArrowLeft = createLucideIcon("arrow-left", __iconNode5);
1979
+ var ArrowLeft = createLucideIcon("arrow-left", __iconNode8);
1954
1980
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/arrow-up-down.js
1955
- var __iconNode6 = [
1981
+ var __iconNode9 = [
1956
1982
  ["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
1957
1983
  ["path", { d: "M17 20V4", key: "1ejh1v" }],
1958
1984
  ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
1959
1985
  ["path", { d: "M7 4v16", key: "1glfcx" }]
1960
1986
  ];
1961
- var ArrowUpDown = createLucideIcon("arrow-up-down", __iconNode6);
1987
+ var ArrowUpDown = createLucideIcon("arrow-up-down", __iconNode9);
1962
1988
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/check.js
1963
- var __iconNode7 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
1964
- var Check = createLucideIcon("check", __iconNode7);
1989
+ var __iconNode10 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
1990
+ var Check = createLucideIcon("check", __iconNode10);
1965
1991
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/chevron-down.js
1966
- var __iconNode8 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
1967
- var ChevronDown = createLucideIcon("chevron-down", __iconNode8);
1992
+ var __iconNode11 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
1993
+ var ChevronDown = createLucideIcon("chevron-down", __iconNode11);
1994
+ // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/chevron-right.js
1995
+ var __iconNode12 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
1996
+ var ChevronRight = createLucideIcon("chevron-right", __iconNode12);
1968
1997
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/chevron-up.js
1969
- var __iconNode9 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
1970
- var ChevronUp = createLucideIcon("chevron-up", __iconNode9);
1998
+ var __iconNode13 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
1999
+ var ChevronUp = createLucideIcon("chevron-up", __iconNode13);
2000
+ // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/circle-dot.js
2001
+ var __iconNode14 = [
2002
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
2003
+ ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }]
2004
+ ];
2005
+ var CircleDot = createLucideIcon("circle-dot", __iconNode14);
2006
+ // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/clock-3.js
2007
+ var __iconNode15 = [
2008
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
2009
+ ["path", { d: "M12 6v6h4", key: "135r8i" }]
2010
+ ];
2011
+ var Clock3 = createLucideIcon("clock-3", __iconNode15);
1971
2012
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/instagram.js
1972
- var __iconNode10 = [
2013
+ var __iconNode16 = [
1973
2014
  ["rect", { width: "20", height: "20", x: "2", y: "2", rx: "5", ry: "5", key: "2e1cvw" }],
1974
2015
  ["path", { d: "M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z", key: "9exkf1" }],
1975
2016
  ["line", { x1: "17.5", x2: "17.51", y1: "6.5", y2: "6.5", key: "r4j83e" }]
1976
2017
  ];
1977
- var Instagram = createLucideIcon("instagram", __iconNode10);
2018
+ var Instagram = createLucideIcon("instagram", __iconNode16);
1978
2019
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/list-filter.js
1979
- var __iconNode11 = [
2020
+ var __iconNode17 = [
1980
2021
  ["path", { d: "M2 5h20", key: "1fs1ex" }],
1981
2022
  ["path", { d: "M6 12h12", key: "8npq4p" }],
1982
2023
  ["path", { d: "M9 19h6", key: "456am0" }]
1983
2024
  ];
1984
- var ListFilter = createLucideIcon("list-filter", __iconNode11);
2025
+ var ListFilter = createLucideIcon("list-filter", __iconNode17);
1985
2026
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/mail.js
1986
- var __iconNode12 = [
2027
+ var __iconNode18 = [
1987
2028
  ["path", { d: "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7", key: "132q7q" }],
1988
2029
  ["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }]
1989
2030
  ];
1990
- var Mail = createLucideIcon("mail", __iconNode12);
2031
+ var Mail = createLucideIcon("mail", __iconNode18);
1991
2032
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/message-square.js
1992
- var __iconNode13 = [
2033
+ var __iconNode19 = [
1993
2034
  [
1994
2035
  "path",
1995
2036
  {
@@ -1998,27 +2039,27 @@ var __iconNode13 = [
1998
2039
  }
1999
2040
  ]
2000
2041
  ];
2001
- var MessageSquare = createLucideIcon("message-square", __iconNode13);
2042
+ var MessageSquare = createLucideIcon("message-square", __iconNode19);
2002
2043
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/music-2.js
2003
- var __iconNode14 = [
2044
+ var __iconNode20 = [
2004
2045
  ["circle", { cx: "8", cy: "18", r: "4", key: "1fc0mg" }],
2005
2046
  ["path", { d: "M12 18V2l7 4", key: "g04rme" }]
2006
2047
  ];
2007
- var Music2 = createLucideIcon("music-2", __iconNode14);
2048
+ var Music2 = createLucideIcon("music-2", __iconNode20);
2008
2049
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/plus.js
2009
- var __iconNode15 = [
2050
+ var __iconNode21 = [
2010
2051
  ["path", { d: "M5 12h14", key: "1ays0h" }],
2011
2052
  ["path", { d: "M12 5v14", key: "s699le" }]
2012
2053
  ];
2013
- var Plus = createLucideIcon("plus", __iconNode15);
2054
+ var Plus = createLucideIcon("plus", __iconNode21);
2014
2055
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/search.js
2015
- var __iconNode16 = [
2056
+ var __iconNode22 = [
2016
2057
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
2017
2058
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
2018
2059
  ];
2019
- var Search = createLucideIcon("search", __iconNode16);
2060
+ var Search = createLucideIcon("search", __iconNode22);
2020
2061
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/send.js
2021
- var __iconNode17 = [
2062
+ var __iconNode23 = [
2022
2063
  [
2023
2064
  "path",
2024
2065
  {
@@ -2028,18 +2069,18 @@ var __iconNode17 = [
2028
2069
  ],
2029
2070
  ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
2030
2071
  ];
2031
- var Send = createLucideIcon("send", __iconNode17);
2072
+ var Send = createLucideIcon("send", __iconNode23);
2032
2073
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/trash-2.js
2033
- var __iconNode18 = [
2074
+ var __iconNode24 = [
2034
2075
  ["path", { d: "M10 11v6", key: "nco0om" }],
2035
2076
  ["path", { d: "M14 11v6", key: "outv1u" }],
2036
2077
  ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
2037
2078
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
2038
2079
  ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
2039
2080
  ];
2040
- var Trash2 = createLucideIcon("trash-2", __iconNode18);
2081
+ var Trash2 = createLucideIcon("trash-2", __iconNode24);
2041
2082
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/twitter.js
2042
- var __iconNode19 = [
2083
+ var __iconNode25 = [
2043
2084
  [
2044
2085
  "path",
2045
2086
  {
@@ -2048,21 +2089,32 @@ var __iconNode19 = [
2048
2089
  }
2049
2090
  ]
2050
2091
  ];
2051
- var Twitter = createLucideIcon("twitter", __iconNode19);
2092
+ var Twitter = createLucideIcon("twitter", __iconNode25);
2052
2093
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/user.js
2053
- var __iconNode20 = [
2094
+ var __iconNode26 = [
2054
2095
  ["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
2055
2096
  ["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
2056
2097
  ];
2057
- var User = createLucideIcon("user", __iconNode20);
2098
+ var User = createLucideIcon("user", __iconNode26);
2099
+ // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/wrench.js
2100
+ var __iconNode27 = [
2101
+ [
2102
+ "path",
2103
+ {
2104
+ d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",
2105
+ key: "1ngwbx"
2106
+ }
2107
+ ]
2108
+ ];
2109
+ var Wrench = createLucideIcon("wrench", __iconNode27);
2058
2110
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/x.js
2059
- var __iconNode21 = [
2111
+ var __iconNode28 = [
2060
2112
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
2061
2113
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
2062
2114
  ];
2063
- var X = createLucideIcon("x", __iconNode21);
2115
+ var X = createLucideIcon("x", __iconNode28);
2064
2116
  // node_modules/.bun/lucide-react@0.577.0+b1ab299f0a400331/node_modules/lucide-react/dist/esm/icons/youtube.js
2065
- var __iconNode22 = [
2117
+ var __iconNode29 = [
2066
2118
  [
2067
2119
  "path",
2068
2120
  {
@@ -2072,7 +2124,7 @@ var __iconNode22 = [
2072
2124
  ],
2073
2125
  ["path", { d: "m10 15 5-3-5-3z", key: "1jp15x" }]
2074
2126
  ];
2075
- var Youtube = createLucideIcon("youtube", __iconNode22);
2127
+ var Youtube = createLucideIcon("youtube", __iconNode29);
2076
2128
  // node_modules/.bun/@base-ui+react@1.4.1+0ea9ec2a211d4613/node_modules/@base-ui/react/esm/avatar/index.parts.js
2077
2129
  var exports_index_parts = {};
2078
2130
  __export(exports_index_parts, {
@@ -4963,8 +5015,18 @@ var create = (createState) => createState ? createImpl(createState) : createImpl
4963
5015
  function isNoisyEvent(evt) {
4964
5016
  if (evt.agent === "system" && evt.message.startsWith("Dispatch failed"))
4965
5017
  return true;
5018
+ if (evt.eventName && isReadOnlyExecOk(evt.eventName))
5019
+ return true;
4966
5020
  return false;
4967
5021
  }
5022
+ function isReadOnlyExecOk(eventName) {
5023
+ if (!eventName.startsWith("exec.") || !eventName.endsWith(".ok"))
5024
+ return false;
5025
+ const toolName = eventName.replace(/^exec\./, "").replace(/\.ok$/, "");
5026
+ if (toolName === "bakin_exec_get_paths" || toolName === "bakin_exec_heartbeat")
5027
+ return true;
5028
+ return /_(list|get|query|search)$/.test(toolName);
5029
+ }
4968
5030
 
4969
5031
  // src/hooks/use-content-store.ts
4970
5032
  var useContentStore = create((set2, get) => ({
@@ -24610,16 +24672,24 @@ var InputRow = forwardRef72(function InputRow2({ placeholder, disabled: disabled
24610
24672
  import { jsxDEV as jsxDEV25 } from "react/jsx-dev-runtime";
24611
24673
  "use client";
24612
24674
  function MessageList({ messages, defaultAgentId, transform }) {
24675
+ const items = groupActivityMessages(messages);
24613
24676
  return /* @__PURE__ */ jsxDEV25("div", {
24614
24677
  "data-testid": "brainstorm-message-list",
24615
24678
  className: "space-y-2",
24616
- children: messages.map((msg, idx) => {
24679
+ children: items.map((item, idx) => {
24680
+ const msg = item.message;
24617
24681
  if (msg.role === "user") {
24618
24682
  return /* @__PURE__ */ jsxDEV25(UserBubble, {
24619
24683
  content: msg.content
24620
24684
  }, msg.id, false, undefined, this);
24621
24685
  }
24622
- const prev = idx > 0 ? messages[idx - 1] : null;
24686
+ if (msg.role === "activity") {
24687
+ return /* @__PURE__ */ jsxDEV25(ActivityBubble, {
24688
+ group: item,
24689
+ agentId: defaultAgentId
24690
+ }, item.key, false, undefined, this);
24691
+ }
24692
+ const prev = idx > 0 ? items[idx - 1]?.message : null;
24623
24693
  const isConsecutive = prev?.role === "assistant";
24624
24694
  const transformed = transform ? transform(msg.content) : { text: msg.content };
24625
24695
  return /* @__PURE__ */ jsxDEV25(AssistantBubble, {
@@ -24631,6 +24701,315 @@ function MessageList({ messages, defaultAgentId, transform }) {
24631
24701
  })
24632
24702
  }, undefined, false, undefined, this);
24633
24703
  }
24704
+ var TOOL_DATA_KEYS = new Set([
24705
+ "phase",
24706
+ "callId",
24707
+ "toolCallId",
24708
+ "toolName",
24709
+ "name",
24710
+ "tool",
24711
+ "status",
24712
+ "summary",
24713
+ "purpose",
24714
+ "displayLabel",
24715
+ "inputPreview",
24716
+ "argumentsPreview",
24717
+ "outputPreview",
24718
+ "resultPreview",
24719
+ "durationMs",
24720
+ "exitCode"
24721
+ ]);
24722
+ function groupActivityMessages(messages) {
24723
+ const items = [];
24724
+ for (let i = 0;i < messages.length; i++) {
24725
+ const message = messages[i];
24726
+ if (message.role === "activity") {
24727
+ const next = messages[i + 1];
24728
+ if (next?.role === "activity" && shouldGroupToolActivities(message, next)) {
24729
+ items.push({ key: `${message.id}:${next.id}`, message, result: next });
24730
+ i++;
24731
+ continue;
24732
+ }
24733
+ }
24734
+ items.push({ key: message.id, message });
24735
+ }
24736
+ return items;
24737
+ }
24738
+ function shouldGroupToolActivities(call, result) {
24739
+ const callView = toolActivityView(call);
24740
+ const resultView = toolActivityView(result);
24741
+ return Boolean(callView && resultView && callView.phase === "call" && resultView.phase === "result" && callView.callId && callView.callId === resultView.callId);
24742
+ }
24743
+ function ActivityBubble({ group, agentId }) {
24744
+ const color = useAgentColor(agentId);
24745
+ const view = activityView(group);
24746
+ const isError = view.kind === "error" || view.kind === "tool" && isFailedTool(view);
24747
+ const Icon2 = view.kind === "tool" ? isFailedTool(view) ? CircleX : view.phase === "result" ? CircleCheck : Wrench : view.kind === "error" ? TriangleAlert : CircleDot;
24748
+ return /* @__PURE__ */ jsxDEV25("div", {
24749
+ "data-testid": "activity-bubble",
24750
+ className: "flex items-start gap-2",
24751
+ children: [
24752
+ /* @__PURE__ */ jsxDEV25(AgentAvatar, {
24753
+ agentId,
24754
+ size: "sm",
24755
+ className: "mt-0.5 shrink-0 opacity-85"
24756
+ }, undefined, false, undefined, this),
24757
+ /* @__PURE__ */ jsxDEV25("div", {
24758
+ className: "min-w-[50%] max-w-[90%] rounded-lg border-l-2 bg-[rgba(255,255,255,0.03)] px-3 py-2 text-sm",
24759
+ style: { borderLeftColor: isError ? "rgba(248, 113, 113, 0.8)" : `${color}80` },
24760
+ children: view.kind === "tool" ? /* @__PURE__ */ jsxDEV25(ToolActivityContent, {
24761
+ view,
24762
+ icon: /* @__PURE__ */ jsxDEV25(Icon2, {
24763
+ className: "size-3.5 shrink-0",
24764
+ "aria-hidden": "true"
24765
+ }, undefined, false, undefined, this)
24766
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV25(GenericActivityContent, {
24767
+ view,
24768
+ icon: /* @__PURE__ */ jsxDEV25(Icon2, {
24769
+ className: "size-3.5 shrink-0",
24770
+ "aria-hidden": "true"
24771
+ }, undefined, false, undefined, this)
24772
+ }, undefined, false, undefined, this)
24773
+ }, undefined, false, undefined, this)
24774
+ ]
24775
+ }, undefined, true, undefined, this);
24776
+ }
24777
+ function ToolActivityContent({ view, icon }) {
24778
+ const details = toolDetailSections(view);
24779
+ const hasDetails = details.length > 0;
24780
+ return /* @__PURE__ */ jsxDEV25("div", {
24781
+ className: hasDetails ? "relative min-w-0 pr-20" : "min-w-0",
24782
+ children: [
24783
+ /* @__PURE__ */ jsxDEV25("div", {
24784
+ className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs",
24785
+ children: [
24786
+ /* @__PURE__ */ jsxDEV25("span", {
24787
+ className: isFailedTool(view) ? "text-red-400" : "text-zinc-500",
24788
+ children: icon
24789
+ }, undefined, false, undefined, this),
24790
+ /* @__PURE__ */ jsxDEV25("span", {
24791
+ className: "font-medium uppercase tracking-wide text-zinc-500",
24792
+ children: "Tool"
24793
+ }, undefined, false, undefined, this),
24794
+ /* @__PURE__ */ jsxDEV25("span", {
24795
+ className: "font-medium text-zinc-300",
24796
+ children: view.toolName
24797
+ }, undefined, false, undefined, this),
24798
+ /* @__PURE__ */ jsxDEV25("span", {
24799
+ className: statusClassName(view),
24800
+ children: statusLabel(view)
24801
+ }, undefined, false, undefined, this),
24802
+ view.durationMs !== undefined && /* @__PURE__ */ jsxDEV25("span", {
24803
+ className: "inline-flex items-center gap-1 text-[11px] text-zinc-500",
24804
+ children: [
24805
+ /* @__PURE__ */ jsxDEV25(Clock3, {
24806
+ className: "size-3",
24807
+ "aria-hidden": "true"
24808
+ }, undefined, false, undefined, this),
24809
+ formatDuration(view.durationMs)
24810
+ ]
24811
+ }, undefined, true, undefined, this)
24812
+ ]
24813
+ }, undefined, true, undefined, this),
24814
+ view.summary && /* @__PURE__ */ jsxDEV25("div", {
24815
+ "data-testid": "tool-activity-summary",
24816
+ className: "mt-1 break-words text-xs leading-5 text-zinc-400",
24817
+ children: view.summary
24818
+ }, undefined, false, undefined, this),
24819
+ hasDetails && /* @__PURE__ */ jsxDEV25(InlineActivityDetails, {
24820
+ children: details.map((section) => /* @__PURE__ */ jsxDEV25(ActivityDetailSection, {
24821
+ label: section.label,
24822
+ value: section.value
24823
+ }, section.label, false, undefined, this))
24824
+ }, undefined, false, undefined, this)
24825
+ ]
24826
+ }, undefined, true, undefined, this);
24827
+ }
24828
+ function GenericActivityContent({ view, icon }) {
24829
+ const hasDetails = view.data !== undefined;
24830
+ return /* @__PURE__ */ jsxDEV25("div", {
24831
+ className: hasDetails ? "relative min-w-0 pr-20" : "min-w-0",
24832
+ children: [
24833
+ /* @__PURE__ */ jsxDEV25("div", {
24834
+ className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs",
24835
+ children: [
24836
+ /* @__PURE__ */ jsxDEV25("span", {
24837
+ className: view.kind === "error" ? "text-red-400" : "text-zinc-500",
24838
+ children: icon
24839
+ }, undefined, false, undefined, this),
24840
+ /* @__PURE__ */ jsxDEV25("span", {
24841
+ className: "font-medium uppercase tracking-wide text-zinc-500",
24842
+ children: view.label
24843
+ }, undefined, false, undefined, this),
24844
+ /* @__PURE__ */ jsxDEV25("span", {
24845
+ className: "break-words text-zinc-400",
24846
+ children: view.summary
24847
+ }, undefined, false, undefined, this)
24848
+ ]
24849
+ }, undefined, true, undefined, this),
24850
+ hasDetails && /* @__PURE__ */ jsxDEV25(InlineActivityDetails, {
24851
+ children: /* @__PURE__ */ jsxDEV25(ActivityDetailSection, {
24852
+ label: "Data",
24853
+ value: view.data
24854
+ }, undefined, false, undefined, this)
24855
+ }, undefined, false, undefined, this)
24856
+ ]
24857
+ }, undefined, true, undefined, this);
24858
+ }
24859
+ function InlineActivityDetails({ children }) {
24860
+ return /* @__PURE__ */ jsxDEV25("details", {
24861
+ className: "group",
24862
+ children: [
24863
+ /* @__PURE__ */ jsxDEV25("summary", {
24864
+ "data-testid": "activity-details-toggle",
24865
+ className: "absolute right-0 top-0 inline-flex min-w-[4.5rem] cursor-pointer list-none items-center justify-end gap-1 rounded-sm text-[11px] leading-5 text-zinc-500 hover:text-zinc-300 focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-blue-400 [&::-webkit-details-marker]:hidden",
24866
+ children: [
24867
+ /* @__PURE__ */ jsxDEV25(ChevronRight, {
24868
+ className: "size-3 transition-transform group-open:rotate-90",
24869
+ "aria-hidden": "true"
24870
+ }, undefined, false, undefined, this),
24871
+ /* @__PURE__ */ jsxDEV25("span", {
24872
+ children: "Details"
24873
+ }, undefined, false, undefined, this)
24874
+ ]
24875
+ }, undefined, true, undefined, this),
24876
+ /* @__PURE__ */ jsxDEV25("div", {
24877
+ className: "mt-2 space-y-2",
24878
+ children
24879
+ }, undefined, false, undefined, this)
24880
+ ]
24881
+ }, undefined, true, undefined, this);
24882
+ }
24883
+ function ActivityDetailSection({ label, value }) {
24884
+ return /* @__PURE__ */ jsxDEV25("div", {
24885
+ children: [
24886
+ /* @__PURE__ */ jsxDEV25("div", {
24887
+ className: "mb-1 text-[10px] font-medium uppercase tracking-wide text-zinc-500",
24888
+ children: label
24889
+ }, undefined, false, undefined, this),
24890
+ /* @__PURE__ */ jsxDEV25("pre", {
24891
+ className: "max-h-44 overflow-auto whitespace-pre-wrap break-words rounded border border-[rgba(255,255,255,0.06)] bg-zinc-950/60 p-2 text-[10px] leading-4 text-zinc-400",
24892
+ children: formatDetailValue(value)
24893
+ }, undefined, false, undefined, this)
24894
+ ]
24895
+ }, undefined, true, undefined, this);
24896
+ }
24897
+ function activityView(group) {
24898
+ const resultTool = group.result ? toolActivityView(group.result) : null;
24899
+ const callTool = toolActivityView(group.message);
24900
+ if (resultTool || callTool) {
24901
+ const active = resultTool ?? callTool;
24902
+ return {
24903
+ ...active,
24904
+ summary: callTool?.summary || active.summary,
24905
+ inputPreview: callTool?.inputPreview ?? active.inputPreview,
24906
+ metadata: { ...callTool?.metadata ?? {}, ...active.metadata }
24907
+ };
24908
+ }
24909
+ const kind = group.message.kind === "error" ? "error" : "status";
24910
+ return {
24911
+ kind,
24912
+ label: kind === "error" ? "Error" : "Status",
24913
+ summary: group.message.content,
24914
+ data: group.message.data
24915
+ };
24916
+ }
24917
+ function toolActivityView(message) {
24918
+ if (message.kind !== "tool_call" && !looksLikeToolData(message.data))
24919
+ return null;
24920
+ const data = isRecord(message.data) ? message.data : {};
24921
+ const phase = data.phase === "result" ? "result" : "call";
24922
+ const toolName = stringField(data.toolName) ?? stringField(data.name) ?? stringField(data.tool) ?? inferToolName(message.content);
24923
+ if (!toolName)
24924
+ return null;
24925
+ const status = stringField(data.status) ?? (phase === "call" ? "running" : "completed");
24926
+ return {
24927
+ kind: "tool",
24928
+ phase,
24929
+ callId: stringField(data.callId) ?? stringField(data.toolCallId) ?? stringField(data.id),
24930
+ toolName,
24931
+ status,
24932
+ summary: stringField(data.summary) ?? stringField(data.purpose) ?? stringField(data.displayLabel) ?? message.content,
24933
+ inputPreview: stringField(data.inputPreview) ?? stringField(data.argumentsPreview),
24934
+ outputPreview: stringField(data.outputPreview) ?? stringField(data.resultPreview),
24935
+ durationMs: numberField(data.durationMs),
24936
+ exitCode: numberField(data.exitCode),
24937
+ metadata: activityMetadata(data)
24938
+ };
24939
+ }
24940
+ function looksLikeToolData(data) {
24941
+ if (!isRecord(data))
24942
+ return false;
24943
+ return Boolean(data.toolName || data.name || data.tool || data.phase === "call" || data.phase === "result");
24944
+ }
24945
+ function activityMetadata(data) {
24946
+ const out = {};
24947
+ for (const [key, value] of Object.entries(data)) {
24948
+ if (!TOOL_DATA_KEYS.has(key))
24949
+ out[key] = value;
24950
+ }
24951
+ if (typeof data.exitCode === "number")
24952
+ out.exitCode = data.exitCode;
24953
+ if (typeof data.callId === "string")
24954
+ out.callId = data.callId;
24955
+ if (typeof data.toolCallId === "string")
24956
+ out.callId = data.toolCallId;
24957
+ return out;
24958
+ }
24959
+ function toolDetailSections(view) {
24960
+ const sections = [];
24961
+ if (view.inputPreview)
24962
+ sections.push({ label: "Input", value: view.inputPreview });
24963
+ if (view.outputPreview)
24964
+ sections.push({ label: "Output", value: view.outputPreview });
24965
+ if (Object.keys(view.metadata).length > 0)
24966
+ sections.push({ label: "Metadata", value: view.metadata });
24967
+ return sections;
24968
+ }
24969
+ function statusLabel(view) {
24970
+ if (isFailedTool(view))
24971
+ return "failed";
24972
+ return view.status || (view.phase === "call" ? "running" : "completed");
24973
+ }
24974
+ function statusClassName(view) {
24975
+ const base = "rounded-full px-1.5 py-0.5 text-[10px] font-medium";
24976
+ if (isFailedTool(view))
24977
+ return `${base} bg-red-500/10 text-red-300`;
24978
+ if (view.phase === "call")
24979
+ return `${base} bg-yellow-400/10 text-yellow-300`;
24980
+ return `${base} bg-emerald-500/10 text-emerald-300`;
24981
+ }
24982
+ function isFailedTool(view) {
24983
+ const status = view.status.toLowerCase();
24984
+ return status.includes("fail") || status.includes("error") || view.exitCode !== undefined && view.exitCode !== 0;
24985
+ }
24986
+ function formatDuration(durationMs) {
24987
+ if (durationMs < 1000)
24988
+ return `${durationMs}ms`;
24989
+ return `${(durationMs / 1000).toFixed(1)}s`;
24990
+ }
24991
+ function formatDetailValue(value) {
24992
+ if (typeof value === "string")
24993
+ return value;
24994
+ try {
24995
+ return JSON.stringify(value, null, 2);
24996
+ } catch {
24997
+ return String(value);
24998
+ }
24999
+ }
25000
+ function inferToolName(content) {
25001
+ const match = content.match(/^([a-zA-Z0-9_.-]+)(?::|\s)/);
25002
+ return match?.[1];
25003
+ }
25004
+ function isRecord(value) {
25005
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
25006
+ }
25007
+ function stringField(value) {
25008
+ return typeof value === "string" && value.length > 0 ? value : undefined;
25009
+ }
25010
+ function numberField(value) {
25011
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined;
25012
+ }
24634
25013
  function UserBubble({ content }) {
24635
25014
  return /* @__PURE__ */ jsxDEV25("div", {
24636
25015
  className: "flex justify-end",
@@ -24710,7 +25089,7 @@ function ThinkingIndicator({ agentId, verb }) {
24710
25089
  const name = agent?.name ?? agentId;
24711
25090
  return /* @__PURE__ */ jsxDEV26("div", {
24712
25091
  "data-testid": "thinking-indicator",
24713
- className: "flex items-center gap-2.5 text-muted-foreground",
25092
+ className: "mt-[5px] flex items-center gap-2.5 text-muted-foreground",
24714
25093
  "aria-live": "polite",
24715
25094
  children: [
24716
25095
  /* @__PURE__ */ jsxDEV26(AgentAvatar, {
@@ -24780,6 +25159,167 @@ function AbortedNotice() {
24780
25159
 
24781
25160
  // src/components/integrated-brainstorm/use-brainstorm-state.ts
24782
25161
  import { useCallback as useCallback36, useRef as useRef66, useState as useState48 } from "react";
25162
+
25163
+ // src/components/integrated-brainstorm/session.ts
25164
+ var ACTIVITY_CONTENT_MAX_CHARS = 500;
25165
+ var ACTIVITY_PREVIEW_MAX_CHARS = 2000;
25166
+ var ACTIVITY_METADATA_MAX_CHARS = 4000;
25167
+ var ACTIVITY_DATA_MAX_KEYS = 24;
25168
+ function brainstormThreadId(scope, entityId, agentId) {
25169
+ return [scope, entityId, agentId].map(threadIdPart).join(":");
25170
+ }
25171
+ function normalizeBrainstormActivityForStorage(activity) {
25172
+ const content = typeof activity.content === "string" ? truncate(activity.content.trim(), ACTIVITY_CONTENT_MAX_CHARS) : "";
25173
+ if (!content)
25174
+ return null;
25175
+ const data = normalizeActivityData(activity.data);
25176
+ return {
25177
+ kind: typeof activity.kind === "string" && activity.kind ? activity.kind : "runtime_status",
25178
+ content,
25179
+ ...data !== undefined ? { data } : {}
25180
+ };
25181
+ }
25182
+ function normalizeBrainstormActivityMessageForStorage(activity) {
25183
+ const normalized = normalizeBrainstormActivityForStorage(activity);
25184
+ if (!normalized)
25185
+ return null;
25186
+ return {
25187
+ role: "activity",
25188
+ kind: normalized.kind,
25189
+ content: normalized.content,
25190
+ ...normalized.data !== undefined ? { data: normalized.data } : {}
25191
+ };
25192
+ }
25193
+ function threadIdPart(value) {
25194
+ const trimmed = value.trim();
25195
+ return encodeURIComponent(trimmed || "default");
25196
+ }
25197
+ function normalizeActivityData(data) {
25198
+ if (data === undefined)
25199
+ return;
25200
+ if (!isRecord2(data))
25201
+ return normalizeActivityValue(data, "value");
25202
+ const out = {};
25203
+ let count3 = 0;
25204
+ for (const [key, value] of Object.entries(data)) {
25205
+ if (count3 >= ACTIVITY_DATA_MAX_KEYS) {
25206
+ out.truncatedKeys = Object.keys(data).length - count3;
25207
+ break;
25208
+ }
25209
+ out[key] = normalizeActivityValue(value, key);
25210
+ count3 += 1;
25211
+ }
25212
+ return out;
25213
+ }
25214
+ function normalizeActivityValue(value, key) {
25215
+ if (typeof value === "string") {
25216
+ const max2 = isPreviewKey(key) ? ACTIVITY_PREVIEW_MAX_CHARS : ACTIVITY_METADATA_MAX_CHARS;
25217
+ return truncate(value, max2);
25218
+ }
25219
+ if (typeof value === "number" || typeof value === "boolean" || value === null)
25220
+ return value;
25221
+ if (value === undefined)
25222
+ return;
25223
+ return truncate(stringify(value), ACTIVITY_METADATA_MAX_CHARS);
25224
+ }
25225
+ function isPreviewKey(key) {
25226
+ return key === "inputPreview" || key === "argumentsPreview" || key === "outputPreview" || key === "resultPreview";
25227
+ }
25228
+ function stringify(value) {
25229
+ try {
25230
+ return JSON.stringify(value);
25231
+ } catch {
25232
+ return String(value);
25233
+ }
25234
+ }
25235
+ function truncate(value, maxChars) {
25236
+ if (value.length <= maxChars)
25237
+ return value;
25238
+ return `${value.slice(0, Math.max(0, maxChars - 3))}...`;
25239
+ }
25240
+ function isRecord2(value) {
25241
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
25242
+ }
25243
+
25244
+ // src/components/integrated-brainstorm/activity.ts
25245
+ function newActivityId() {
25246
+ return `act-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
25247
+ }
25248
+ function runtimeChunkToBrainstormActivity(chunk) {
25249
+ if (chunk.type === "status") {
25250
+ return {
25251
+ kind: "runtime_status",
25252
+ content: chunk.content || "Agent status update",
25253
+ data: chunk.data
25254
+ };
25255
+ }
25256
+ if (chunk.type === "tool") {
25257
+ return {
25258
+ kind: "tool_call",
25259
+ content: chunk.content || "Tool call",
25260
+ data: chunk.data
25261
+ };
25262
+ }
25263
+ if (chunk.type === "error") {
25264
+ return {
25265
+ kind: "error",
25266
+ content: chunk.content || "Runtime stream error",
25267
+ data: chunk.data
25268
+ };
25269
+ }
25270
+ return null;
25271
+ }
25272
+ function brainstormActivityMessageFromCustom(name, data) {
25273
+ if (name !== "activity")
25274
+ return null;
25275
+ const payload = data && typeof data === "object" && "activity" in data ? data.activity : data;
25276
+ if (!payload || typeof payload !== "object")
25277
+ return null;
25278
+ const activity = payload;
25279
+ const content = typeof activity.content === "string" ? activity.content : "";
25280
+ if (!content)
25281
+ return null;
25282
+ const normalized = normalizeBrainstormActivityForStorage({
25283
+ kind: typeof activity.kind === "string" ? activity.kind : "runtime_status",
25284
+ content,
25285
+ data: activity.data
25286
+ });
25287
+ if (!normalized)
25288
+ return null;
25289
+ return {
25290
+ id: typeof activity.id === "string" ? activity.id : newActivityId(),
25291
+ role: "activity",
25292
+ kind: normalized.kind,
25293
+ content: normalized.content,
25294
+ ...normalized.data !== undefined ? { data: normalized.data } : {},
25295
+ timestamp: typeof activity.timestamp === "string" ? activity.timestamp : new Date().toISOString()
25296
+ };
25297
+ }
25298
+ function toBrainstormTimeline(agentId, input) {
25299
+ return [
25300
+ ...input.messages.map((message) => ({
25301
+ id: message.id,
25302
+ role: message.role === "user" ? "user" : "assistant",
25303
+ content: message.content,
25304
+ agentId: message.role === "user" ? undefined : agentId,
25305
+ timestamp: message.timestamp
25306
+ })),
25307
+ ...(input.activities ?? []).map((activity) => ({
25308
+ id: activity.id,
25309
+ role: "activity",
25310
+ kind: activity.kind,
25311
+ content: activity.content,
25312
+ data: activity.data,
25313
+ timestamp: activity.timestamp
25314
+ }))
25315
+ ].sort((a, b) => {
25316
+ const aTime = a.timestamp ? Date.parse(a.timestamp) : 0;
25317
+ const bTime = b.timestamp ? Date.parse(b.timestamp) : 0;
25318
+ return aTime - bTime;
25319
+ });
25320
+ }
25321
+
25322
+ // src/components/integrated-brainstorm/use-brainstorm-state.ts
24783
25323
  "use client";
24784
25324
  function pickVerb() {
24785
25325
  return THINKING_VERBS[Math.floor(Math.random() * THINKING_VERBS.length)];
@@ -24823,6 +25363,7 @@ function useBrainstormState({
24823
25363
  const controller = new AbortController;
24824
25364
  abortRef.current = controller;
24825
25365
  let accumulated = "";
25366
+ const customMessages = [];
24826
25367
  try {
24827
25368
  const result = await onSend(trimmed, messages, {
24828
25369
  signal: controller.signal,
@@ -24831,7 +25372,14 @@ function useBrainstormState({
24831
25372
  setStreamingContent(accumulated);
24832
25373
  setStatus("streaming");
24833
25374
  },
24834
- onCustom: options2?.onCustom
25375
+ onCustom: (name, data) => {
25376
+ const activityMessage = brainstormActivityMessageFromCustom(name, data);
25377
+ if (activityMessage) {
25378
+ customMessages.push(activityMessage);
25379
+ onMessagesChange([...historyWithUser, ...customMessages]);
25380
+ }
25381
+ options2?.onCustom?.(name, data);
25382
+ }
24835
25383
  });
24836
25384
  const resolvedContent = result?.content?.trim() ?? "";
24837
25385
  const finalContent = resolvedContent.length > 0 ? resolvedContent : accumulated.trim();
@@ -24843,7 +25391,7 @@ function useBrainstormState({
24843
25391
  agentId: defaultAgentId,
24844
25392
  timestamp: new Date().toISOString()
24845
25393
  };
24846
- onMessagesChange([...historyWithUser, assistantMsg]);
25394
+ onMessagesChange([...historyWithUser, ...customMessages, assistantMsg]);
24847
25395
  }
24848
25396
  } catch (err) {
24849
25397
  if (controller.signal.aborted) {
@@ -24857,7 +25405,7 @@ function useBrainstormState({
24857
25405
  agentId: defaultAgentId,
24858
25406
  timestamp: new Date().toISOString()
24859
25407
  };
24860
- onMessagesChange([...historyWithUser, assistantMsg]);
25408
+ onMessagesChange([...historyWithUser, ...customMessages, assistantMsg]);
24861
25409
  }
24862
25410
  } else {
24863
25411
  setErrorMessage(err instanceof Error ? err.message : String(err));
@@ -24874,6 +25422,109 @@ function useBrainstormState({
24874
25422
  }, []);
24875
25423
  return { status, streamingContent, thinkingVerb, errorMessage, wasAborted, send, abort };
24876
25424
  }
25425
+ // src/components/integrated-brainstorm/sse.ts
25426
+ async function readBrainstormSseResponse(response, ctx, options2 = {}) {
25427
+ if (!response.ok || !response.body) {
25428
+ const text = await response.text().catch(() => "");
25429
+ throw new Error(text || `Server returned ${response.status}`);
25430
+ }
25431
+ const reader = response.body.getReader();
25432
+ const abort = () => {
25433
+ reader.cancel().catch(() => {});
25434
+ };
25435
+ ctx.signal.addEventListener("abort", abort, { once: true });
25436
+ const decoder = new TextDecoder;
25437
+ let buffer = "";
25438
+ let accumulated = "";
25439
+ let finalContent = "";
25440
+ const dispatch = (frame) => {
25441
+ if (frame.event === "token") {
25442
+ const text = textField(frame.data, "text");
25443
+ accumulated += text;
25444
+ ctx.onToken(text);
25445
+ return;
25446
+ }
25447
+ if (frame.event === "activity") {
25448
+ ctx.onCustom?.("activity", frame.data);
25449
+ return;
25450
+ }
25451
+ if (frame.event === "done") {
25452
+ finalContent = textField(frame.data, "content") || accumulated;
25453
+ return;
25454
+ }
25455
+ if (frame.event === "error") {
25456
+ throw new Error(textField(frame.data, "message") || "Unknown error");
25457
+ }
25458
+ if (options2.onCustomEvent?.(frame.event, frame.data) === true)
25459
+ return;
25460
+ ctx.onCustom?.(frame.event, frame.data);
25461
+ };
25462
+ try {
25463
+ while (true) {
25464
+ if (ctx.signal.aborted)
25465
+ throw abortError();
25466
+ const { done, value } = await reader.read();
25467
+ if (done)
25468
+ break;
25469
+ buffer += decoder.decode(value, { stream: true });
25470
+ const parsed2 = drainSseFrames(buffer);
25471
+ buffer = parsed2.remainder;
25472
+ for (const frame of parsed2.frames)
25473
+ dispatch(frame);
25474
+ }
25475
+ buffer += decoder.decode();
25476
+ const parsed = drainSseFrames(buffer, true);
25477
+ for (const frame of parsed.frames)
25478
+ dispatch(frame);
25479
+ } finally {
25480
+ ctx.signal.removeEventListener("abort", abort);
25481
+ reader.releaseLock();
25482
+ }
25483
+ return { content: finalContent || accumulated };
25484
+ }
25485
+ function drainSseFrames(input, flush = false) {
25486
+ const parts = input.split(/\r?\n\r?\n/);
25487
+ const remainder = flush ? "" : parts.pop() ?? "";
25488
+ const frames = parts.map(parseSseFrame).filter((frame) => frame !== null);
25489
+ if (flush && parts.length === 0 && input.trim()) {
25490
+ const frame = parseSseFrame(input);
25491
+ if (frame)
25492
+ frames.push(frame);
25493
+ }
25494
+ return { frames, remainder };
25495
+ }
25496
+ function parseSseFrame(frame) {
25497
+ let event = "message";
25498
+ const dataLines = [];
25499
+ for (const rawLine of frame.split(/\r?\n/)) {
25500
+ const line = rawLine.trimEnd();
25501
+ if (line.startsWith("event:")) {
25502
+ event = line.slice("event:".length).trim();
25503
+ } else if (line.startsWith("data:")) {
25504
+ dataLines.push(line.slice("data:".length).trimStart());
25505
+ }
25506
+ }
25507
+ if (dataLines.length === 0)
25508
+ return null;
25509
+ const rawData = dataLines.join(`
25510
+ `);
25511
+ let data = rawData;
25512
+ try {
25513
+ data = JSON.parse(rawData);
25514
+ } catch {}
25515
+ return { event, data };
25516
+ }
25517
+ function textField(data, key) {
25518
+ if (!data || typeof data !== "object")
25519
+ return "";
25520
+ const value = data[key];
25521
+ return typeof value === "string" ? value : "";
25522
+ }
25523
+ function abortError() {
25524
+ const err = new Error("Aborted");
25525
+ err.name = "AbortError";
25526
+ return err;
25527
+ }
24877
25528
 
24878
25529
  // src/components/integrated-brainstorm/index.tsx
24879
25530
  import { jsxDEV as jsxDEV27 } from "react/jsx-dev-runtime";
@@ -24890,8 +25541,8 @@ function IntegratedBrainstorm({
24890
25541
  emptyState,
24891
25542
  collapsible = true,
24892
25543
  defaultOpen = true,
24893
- conversationStartHeight = 400,
24894
- minHeight = 100,
25544
+ defaultHeight = 480,
25545
+ minHeight = 260,
24895
25546
  maxHeight = 720,
24896
25547
  maxInputHeight = 200,
24897
25548
  storageKey,
@@ -24908,13 +25559,12 @@ function IntegratedBrainstorm({
24908
25559
  const wasOpenRef = useRef67(defaultOpen);
24909
25560
  const agent = useAgent(agentId);
24910
25561
  const agentName = agent?.name ?? agentId;
24911
- const { height, setHeight, handleProps } = useVerticalResize({
24912
- defaultHeight: minHeight,
25562
+ const { height, handleProps } = useVerticalResize({
25563
+ defaultHeight,
24913
25564
  minHeight,
24914
25565
  maxHeight,
24915
25566
  storageKey: fitParent ? undefined : storageKey
24916
25567
  });
24917
- const didAutoExpandRef = useRef67(fitParent || height > minHeight + 10 || messages.length > 0);
24918
25568
  const { status, streamingContent, thinkingVerb, errorMessage, wasAborted, send, abort } = useBrainstormState({
24919
25569
  messages,
24920
25570
  onMessagesChange,
@@ -24922,12 +25572,8 @@ function IntegratedBrainstorm({
24922
25572
  defaultAgentId: agentId
24923
25573
  });
24924
25574
  const handleSend = useCallback37((prompt) => {
24925
- if (!didAutoExpandRef.current) {
24926
- didAutoExpandRef.current = true;
24927
- setHeight(conversationStartHeight);
24928
- }
24929
25575
  return send(prompt);
24930
- }, [send, setHeight, conversationStartHeight]);
25576
+ }, [send]);
24931
25577
  const replyCount = messages.filter((m2) => m2.role === "assistant").length;
24932
25578
  const isOpen = collapsible ? open : true;
24933
25579
  const resolvedPlaceholder = placeholder ?? `Ask ${agentName}\u2026`;
@@ -25064,7 +25710,7 @@ function assert(bool, actual, expected, operator, defaultMessage, userMessage) {
25064
25710
  }
25065
25711
 
25066
25712
  // node_modules/.bun/comma-separated-tokens@2.0.3/node_modules/comma-separated-tokens/index.js
25067
- function stringify(values, options2) {
25713
+ function stringify2(values, options2) {
25068
25714
  const settings = options2 || {};
25069
25715
  const input = values[values.length - 1] === "" ? [...values, ""] : values;
25070
25716
  return input.join((settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")).trim();
@@ -26226,7 +26872,7 @@ var html2 = merge([aria, html, xlink, xmlns, xml], "html");
26226
26872
  var svg2 = merge([aria, svg, xlink, xmlns, xml], "svg");
26227
26873
 
26228
26874
  // node_modules/.bun/space-separated-tokens@2.0.2/node_modules/space-separated-tokens/index.js
26229
- function stringify2(values) {
26875
+ function stringify3(values) {
26230
26876
  return values.join(" ").trim();
26231
26877
  }
26232
26878
 
@@ -26610,7 +27256,7 @@ function createProperty(state, prop, value) {
26610
27256
  return;
26611
27257
  }
26612
27258
  if (Array.isArray(value)) {
26613
- value = info.commaSeparated ? stringify(value) : stringify2(value);
27259
+ value = info.commaSeparated ? stringify2(value) : stringify3(value);
26614
27260
  }
26615
27261
  if (info.property === "style") {
26616
27262
  let styleObject = typeof value === "object" ? value : parseStyle(state, String(value));
@@ -35147,10 +35793,10 @@ function wrap2(middleware, callback) {
35147
35793
  }
35148
35794
  }
35149
35795
  // node_modules/.bun/vfile@6.0.3/node_modules/vfile/lib/minpath.js
35150
- import { default as default5764 } from "path";
35796
+ import { default as default5734 } from "path";
35151
35797
 
35152
35798
  // node_modules/.bun/vfile@6.0.3/node_modules/vfile/lib/minproc.js
35153
- import { default as default5765 } from "process";
35799
+ import { default as default5735 } from "process";
35154
35800
 
35155
35801
  // node_modules/.bun/vfile@6.0.3/node_modules/vfile/lib/minurl.js
35156
35802
  import { fileURLToPath } from "url";
@@ -35181,7 +35827,7 @@ class VFile {
35181
35827
  } else {
35182
35828
  options2 = value;
35183
35829
  }
35184
- this.cwd = "cwd" in options2 ? "" : default5765.cwd();
35830
+ this.cwd = "cwd" in options2 ? "" : default5735.cwd();
35185
35831
  this.data = {};
35186
35832
  this.history = [];
35187
35833
  this.messages = [];
@@ -35204,22 +35850,22 @@ class VFile {
35204
35850
  }
35205
35851
  }
35206
35852
  get basename() {
35207
- return typeof this.path === "string" ? default5764.basename(this.path) : undefined;
35853
+ return typeof this.path === "string" ? default5734.basename(this.path) : undefined;
35208
35854
  }
35209
35855
  set basename(basename) {
35210
35856
  assertNonEmpty(basename, "basename");
35211
35857
  assertPart(basename, "basename");
35212
- this.path = default5764.join(this.dirname || "", basename);
35858
+ this.path = default5734.join(this.dirname || "", basename);
35213
35859
  }
35214
35860
  get dirname() {
35215
- return typeof this.path === "string" ? default5764.dirname(this.path) : undefined;
35861
+ return typeof this.path === "string" ? default5734.dirname(this.path) : undefined;
35216
35862
  }
35217
35863
  set dirname(dirname) {
35218
35864
  assertPath(this.basename, "dirname");
35219
- this.path = default5764.join(dirname || "", this.basename);
35865
+ this.path = default5734.join(dirname || "", this.basename);
35220
35866
  }
35221
35867
  get extname() {
35222
- return typeof this.path === "string" ? default5764.extname(this.path) : undefined;
35868
+ return typeof this.path === "string" ? default5734.extname(this.path) : undefined;
35223
35869
  }
35224
35870
  set extname(extname) {
35225
35871
  assertPart(extname, "extname");
@@ -35232,7 +35878,7 @@ class VFile {
35232
35878
  throw new Error("`extname` cannot contain multiple dots");
35233
35879
  }
35234
35880
  }
35235
- this.path = default5764.join(this.dirname, this.stem + (extname || ""));
35881
+ this.path = default5734.join(this.dirname, this.stem + (extname || ""));
35236
35882
  }
35237
35883
  get path() {
35238
35884
  return this.history[this.history.length - 1];
@@ -35247,12 +35893,12 @@ class VFile {
35247
35893
  }
35248
35894
  }
35249
35895
  get stem() {
35250
- return typeof this.path === "string" ? default5764.basename(this.path, this.extname) : undefined;
35896
+ return typeof this.path === "string" ? default5734.basename(this.path, this.extname) : undefined;
35251
35897
  }
35252
35898
  set stem(stem) {
35253
35899
  assertNonEmpty(stem, "stem");
35254
35900
  assertPart(stem, "stem");
35255
- this.path = default5764.join(this.dirname || "", stem + (this.extname || ""));
35901
+ this.path = default5734.join(this.dirname || "", stem + (this.extname || ""));
35256
35902
  }
35257
35903
  fail(causeOrReason, optionsOrParentOrPlace, origin) {
35258
35904
  const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
@@ -35286,8 +35932,8 @@ class VFile {
35286
35932
  }
35287
35933
  }
35288
35934
  function assertPart(part, name2) {
35289
- if (part && part.includes(default5764.sep)) {
35290
- throw new Error("`" + name2 + "` cannot be a path: did not expect `" + default5764.sep + "`");
35935
+ if (part && part.includes(default5734.sep)) {
35936
+ throw new Error("`" + name2 + "` cannot be a path: did not expect `" + default5734.sep + "`");
35291
35937
  }
35292
35938
  }
35293
35939
  function assertNonEmpty(part, name2) {
@@ -39498,6 +40144,13 @@ function ChannelIcon({ channelId, className }) {
39498
40144
  }, undefined, false, undefined, this);
39499
40145
  }
39500
40146
  export {
40147
+ toBrainstormTimeline,
40148
+ runtimeChunkToBrainstormActivity,
40149
+ readBrainstormSseResponse,
40150
+ normalizeBrainstormActivityMessageForStorage,
40151
+ normalizeBrainstormActivityForStorage,
40152
+ brainstormThreadId,
40153
+ brainstormActivityMessageFromCustom,
39501
40154
  UnderlineTabs,
39502
40155
  SortableHead,
39503
40156
  PluginSettingsRenderer,