@blade-hq/agent-react 2612.0.0-beta.98 → 2612.0.0-beta.99

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 (84) hide show
  1. package/README.md +3 -2
  2. package/dist/McpAppCard-ADVDKC2C.js +171 -0
  3. package/dist/McpAppCard-ADVDKC2C.js.map +1 -0
  4. package/dist/McpAppFrame-VEOUJL5E.js +9 -0
  5. package/dist/PlanGraph-3D5PCSIJ.js +189 -0
  6. package/dist/PlanGraph-3D5PCSIJ.js.map +1 -0
  7. package/dist/{chunk-FTBMG7TK.js → SessionPluginConfigForm-DWVDFK6A.js} +2 -3
  8. package/dist/chat/AskUserQuestionBlock.d.ts +2 -1
  9. package/dist/chat/ChatPanel.d.ts +3 -1
  10. package/dist/chat/CurrentPlanPanel.d.ts +2 -1
  11. package/dist/chat/LightComposer.d.ts +1 -1
  12. package/dist/chat/LiteMessageList.d.ts +9 -0
  13. package/dist/chat/RelatedWork.d.ts +24 -0
  14. package/dist/chat/index.d.ts +1 -0
  15. package/dist/chat/plan/PlanGraph.d.ts +26 -0
  16. package/dist/chat/plan/PlanSurface.d.ts +9 -0
  17. package/dist/chat/plan/presentation.d.ts +18 -0
  18. package/dist/chat/runtime/actions.d.ts +1 -0
  19. package/dist/chat/runtime/environment.d.ts +5 -0
  20. package/dist/chat/runtime/session-source.d.ts +2 -0
  21. package/dist/chat.css +181 -0
  22. package/dist/{chunk-CJQINCIP.js → chunk-3RFYXI6V.js} +51 -71
  23. package/dist/chunk-3RFYXI6V.js.map +1 -0
  24. package/dist/chunk-5JAFIDDP.js +1386 -0
  25. package/dist/chunk-5JAFIDDP.js.map +1 -0
  26. package/dist/{chunk-RULD2XDA.js → chunk-67JW6ASD.js} +1561 -1199
  27. package/dist/chunk-67JW6ASD.js.map +1 -0
  28. package/dist/chunk-7WR2KG5O.js +50 -0
  29. package/dist/chunk-7WR2KG5O.js.map +1 -0
  30. package/dist/chunk-FR3ON5R4.js +30 -0
  31. package/dist/chunk-FR3ON5R4.js.map +1 -0
  32. package/dist/chunk-GRUDJLWG.js +8 -0
  33. package/dist/chunk-GRUDJLWG.js.map +1 -0
  34. package/dist/{chunk-Q5NLUZAK.js → chunk-GZHQQXYI.js} +8 -9
  35. package/dist/chunk-GZHQQXYI.js.map +1 -0
  36. package/dist/{chunk-RHUJ77ZZ.js → chunk-IOIKCFRO.js} +36 -1566
  37. package/dist/chunk-IOIKCFRO.js.map +1 -0
  38. package/dist/{chunk-IOKIQSWP.js → chunk-J6BSKVVK.js} +37 -19
  39. package/dist/chunk-J6BSKVVK.js.map +1 -0
  40. package/dist/{chunk-AGCHJFE7.js → chunk-MG4RF573.js} +4 -4
  41. package/dist/{chunk-AGCHJFE7.js.map → chunk-MG4RF573.js.map} +1 -1
  42. package/dist/{chunk-KJDDAZZY.js → chunk-SVCTJ4VS.js} +145 -25
  43. package/dist/chunk-SVCTJ4VS.js.map +1 -0
  44. package/dist/{chunk-FXTAY3LE.js → chunk-WEOW475M.js} +17 -17
  45. package/dist/{chunk-FXTAY3LE.js.map → chunk-WEOW475M.js.map} +1 -1
  46. package/dist/{chunk-6Z7T6BOB.js → chunk-YBTELD7P.js} +7 -5
  47. package/dist/{chunk-6Z7T6BOB.js.map → chunk-YBTELD7P.js.map} +1 -1
  48. package/dist/components/AgentChat.d.ts +3 -0
  49. package/dist/components/McpAppCard.d.ts +1 -7
  50. package/dist/components/ReplayBar.d.ts +7 -1
  51. package/dist/components/lazy-mcp-app-card.d.ts +1 -0
  52. package/dist/components/lazy-mcp-app-frame.d.ts +1 -0
  53. package/dist/components/lazy-session-plugin-config-form.d.ts +1 -0
  54. package/dist/components/mcp-app-context.d.ts +7 -0
  55. package/dist/connectors.js +3 -3
  56. package/dist/embed/entry.d.ts +4 -0
  57. package/dist/embed/load-plan-graph.d.ts +2 -0
  58. package/dist/embed/plan-graph-chunk.d.ts +1 -0
  59. package/dist/index.d.ts +2 -0
  60. package/dist/index.js +14 -9
  61. package/dist/internal.d.ts +4 -4
  62. package/dist/internal.js +29 -17
  63. package/dist/internal.js.map +1 -1
  64. package/dist/questions.js +5 -4
  65. package/dist/questions.js.map +1 -1
  66. package/dist/rich-input/ChatInput.d.ts +3 -1
  67. package/dist/rich-input/ComposerControls.d.ts +21 -0
  68. package/dist/rich-input/index.d.ts +1 -0
  69. package/dist/rich-input.js +315 -258
  70. package/dist/rich-input.js.map +1 -1
  71. package/dist/style.full.css +182 -1
  72. package/dist/tool-details.js +6 -5
  73. package/dist/tool-details.js.map +1 -1
  74. package/package.json +2 -2
  75. package/public-api.md +31 -2
  76. package/dist/SessionPluginConfigForm-DWLJEYBY.js +0 -9
  77. package/dist/chunk-CJQINCIP.js.map +0 -1
  78. package/dist/chunk-IOKIQSWP.js.map +0 -1
  79. package/dist/chunk-KJDDAZZY.js.map +0 -1
  80. package/dist/chunk-Q5NLUZAK.js.map +0 -1
  81. package/dist/chunk-RHUJ77ZZ.js.map +0 -1
  82. package/dist/chunk-RULD2XDA.js.map +0 -1
  83. /package/dist/{SessionPluginConfigForm-DWLJEYBY.js.map → McpAppFrame-VEOUJL5E.js.map} +0 -0
  84. /package/dist/{chunk-FTBMG7TK.js.map → SessionPluginConfigForm-DWVDFK6A.js.map} +0 -0
@@ -0,0 +1,18 @@
1
+ import type { PlanAgentRef, PlanDocument, PlanLeafStatus, PlanNode } from "@blade-hq/agent-client";
2
+ export declare function hasRealBranching(nodes: PlanNode[]): boolean;
3
+ export declare function selectPlanPresentation(plan: PlanDocument): "compact-bar" | "graph";
4
+ export declare function isTerminalPlanStatus(status?: PlanLeafStatus): boolean;
5
+ export declare function deriveParentStatus(children: PlanNode[]): PlanLeafStatus;
6
+ export declare const planStatusLabels: Record<PlanLeafStatus, string>;
7
+ export interface PlanAgentExecution {
8
+ child_session_id: string;
9
+ agent: string;
10
+ execution_id: string;
11
+ request_id?: string;
12
+ status: string;
13
+ }
14
+ export interface PlanAgentActions {
15
+ findExecution?: (ref: PlanAgentRef) => PlanAgentExecution | undefined;
16
+ openExecution?: (execution: PlanAgentExecution) => void;
17
+ }
18
+ export declare function matchingPlanExecution(ref: PlanAgentRef, execution?: PlanAgentExecution): PlanAgentExecution | undefined;
@@ -7,6 +7,7 @@ export declare function buildPendingAskUserAnswer(state: SessionState, message:
7
7
  /** 发送附加项(模型、推理档位、知识库等由富输入给出)。 */
8
8
  export interface ChatSendExtras {
9
9
  model?: string;
10
+ modeOverride?: SendOptions["modeOverride"];
10
11
  thinkingOverride?: boolean;
11
12
  reasoningLevel?: string;
12
13
  contextAttachments?: SendOptions["contextAttachments"];
@@ -6,6 +6,7 @@
6
6
  * hook 形式的注入点必须是稳定引用(模块常量),组件会无条件调用它们。
7
7
  */
8
8
  import type { PostChatFollowup, ResultFeedback, SessionInfo, ToolCallInfo, ToolUiCard, TurnProjection } from "@blade-hq/agent-client/internal";
9
+ import type { PlanAgentActions } from "../plan/presentation";
9
10
  import type { AskUserAnswerData } from "../AskUserQuestionBlock";
10
11
  import type { ComposerProps } from "../customization";
11
12
  import { type ComponentPropsWithoutRef, type ComponentType, type ReactNode } from "react";
@@ -102,8 +103,12 @@ export interface ChatEnvironment {
102
103
  card: ToolUiCard;
103
104
  title: string;
104
105
  }) => void;
106
+ /** 打开宿主自己的任务详情。 */
107
+ openBoardTask?: (projectId: number, taskId: string) => void;
105
108
  /** 打开「计划」侧栏。 */
106
109
  openPlanPanel?: (sessionId: string) => void;
110
+ /** Optional, session-scoped execution lookup and authorized read-only opener. */
111
+ getPlanAgentActions?: (sessionId: string) => PlanAgentActions | undefined;
107
112
  /** 在沙盒浏览器里打开链接(本机地址)。 */
108
113
  openInSandboxBrowser?: (sessionId: string, url: string) => void;
109
114
  /** 把文字放进输入框(跟进建议等);`separate` 为 true 时另起一段。不注入时走 `AgentSession.insertText`。 */
@@ -42,3 +42,5 @@ export declare function CurrentChatSessionProvider({ sessionId, children }: {
42
42
  children: ReactNode;
43
43
  }): import("react/jsx-runtime").JSX.Element;
44
44
  export declare function useCurrentChatSessionId(): string | null;
45
+ export declare const ReadOnlyChatProvider: import("react").Provider<boolean>;
46
+ export declare function useReadOnlyChat(): boolean;
package/dist/chat.css CHANGED
@@ -178,3 +178,184 @@
178
178
  }
179
179
  }
180
180
  }
181
+
182
+ /* Shared by Web, the extension and the embedded chat. */
183
+ .blade-plan-surface {
184
+ color: hsl(var(--foreground));
185
+ background: hsl(var(--card));
186
+ border: 1px solid hsl(var(--border));
187
+ border-radius: 12px;
188
+ overflow: hidden;
189
+ }
190
+
191
+ .blade-plan-header {
192
+ display: flex;
193
+ align-items: center;
194
+ gap: .75rem;
195
+ width: 100%;
196
+ padding: .6rem .8rem;
197
+ text-align: start;
198
+ }
199
+
200
+ .blade-plan-header:hover, .blade-plan-dialog-header button:hover {
201
+ background: hsl(var(--muted) / .55);
202
+ }
203
+
204
+ .blade-plan-heading {
205
+ display: grid;
206
+ flex: 1;
207
+ min-width: 0;
208
+ gap: .1rem;
209
+ font-size: .82rem;
210
+ }
211
+
212
+ .blade-plan-heading strong, .blade-plan-current {
213
+ overflow: hidden;
214
+ text-overflow: ellipsis;
215
+ white-space: nowrap;
216
+ }
217
+
218
+ .blade-plan-caption, .blade-plan-current, .blade-plan-count, .blade-plan-loading {
219
+ color: hsl(var(--muted-foreground));
220
+ font-size: .72rem;
221
+ }
222
+
223
+ .blade-plan-count {
224
+ display: grid;
225
+ gap: .25rem;
226
+ text-align: end;
227
+ white-space: nowrap;
228
+ }
229
+
230
+ .blade-plan-count progress {
231
+ width: 100%;
232
+ height: 4px;
233
+ accent-color: hsl(var(--primary));
234
+ }
235
+
236
+ .blade-plan-inline {
237
+ max-height: min(14rem, 30vh);
238
+ display: flex;
239
+ border-top: 1px solid hsl(var(--border));
240
+ }
241
+
242
+ .blade-plan-surface[data-sidebar] .blade-plan-inline { max-height: 62vh; }
243
+
244
+ .blade-plan-dialog {
245
+ position: fixed;
246
+ inset: 0;
247
+ margin: auto;
248
+ width: min(68rem, calc(100% - 1.5rem));
249
+ max-height: calc(100% - 1.5rem);
250
+ padding: 0;
251
+ color: hsl(var(--foreground));
252
+ background: hsl(var(--card));
253
+ border: 1px solid hsl(var(--border));
254
+ border-radius: 14px;
255
+ }
256
+
257
+ .blade-plan-dialog[open] { display: flex; flex-direction: column; }
258
+ .blade-plan-dialog::backdrop { background: rgb(0 0 0 / .5); }
259
+ .blade-plan-dialog-header {
260
+ display: flex;
261
+ justify-content: space-between;
262
+ align-items: center;
263
+ padding: .7rem 1rem;
264
+ gap: .5rem;
265
+ border-bottom: 1px solid hsl(var(--border));
266
+ }
267
+
268
+ .blade-plan-dialog-header h2 { margin: 0; font-size: 1rem; font-weight: 600; }
269
+ .blade-plan-dialog-header button { padding: .25rem; border-radius: 6px; }
270
+ .blade-plan-loading { display: block; min-height: 5rem; padding: 1rem; }
271
+ .blade-plan-approval {
272
+ display: flex;
273
+ align-items: center;
274
+ flex-wrap: wrap;
275
+ gap: .6rem;
276
+ padding: .55rem .8rem;
277
+ border-top: 1px solid hsl(var(--border));
278
+ font-size: .8rem;
279
+ }
280
+
281
+ .blade-plan-approval button {
282
+ background: hsl(var(--primary));
283
+ color: hsl(var(--primary-foreground));
284
+ border-radius: 7px;
285
+ padding: .4rem .7rem;
286
+ font-weight: 600;
287
+ }
288
+
289
+ .blade-plan-approval button:disabled { opacity: .55; }
290
+ .blade-plan-approval [role="alert"] { color: hsl(var(--destructive)); }
291
+
292
+ .blade-plan-scroll {
293
+ min-height: 0;
294
+ width: 100%;
295
+ overflow: auto;
296
+ background: hsl(var(--background));
297
+ }
298
+
299
+ .blade-plan-canvas {
300
+ position: relative;
301
+ isolation: isolate;
302
+ background-image: radial-gradient(hsl(var(--border)) 1px, transparent 1px);
303
+ background-size: 16px 16px;
304
+ }
305
+
306
+ .blade-plan-edges, .blade-plan-nodes, .blade-plan-stage, .blade-plan-node { position: absolute; }
307
+ .blade-plan-nodes { inset: 0; margin: 0; padding: 0; list-style: none; pointer-events: none; }
308
+ .blade-plan-node { inset: 0 auto auto 0; transition: transform .3s ease; pointer-events: auto; }
309
+ .blade-plan-stage { background: hsl(var(--muted) / .5); border: 1px dashed hsl(var(--border)); border-radius: 12px; }
310
+ .blade-plan-edge, .blade-plan-flow { fill: none; stroke: hsl(var(--muted-foreground)); stroke-width: 1.5px; }
311
+ .blade-plan-flow { stroke: hsl(var(--primary)); stroke-width: 2.5px; stroke-dasharray: 8 15; animation: blade-plan-flow 1.4s linear infinite; }
312
+ .blade-plan-node-body {
313
+ display: flex;
314
+ flex-direction: column;
315
+ gap: 3px;
316
+ height: 100%;
317
+ padding: 9px 11px;
318
+ background: hsl(var(--card));
319
+ border: 1px solid hsl(var(--border));
320
+ border-radius: 9px;
321
+ overflow-wrap: anywhere;
322
+ overflow: auto;
323
+ }
324
+ .blade-plan-node[data-stage] .blade-plan-node-body { background: hsl(var(--muted)); }
325
+ .blade-plan-node-label { font-size: .84rem; font-weight: 600; }
326
+ .blade-plan-node-note, .blade-plan-binding, .blade-plan-node-status { font-size: .72rem; color: hsl(var(--muted-foreground)); }
327
+ .blade-plan-binding { text-align: start; }
328
+ button.blade-plan-binding { text-decoration: underline; }
329
+ .blade-plan-node-status { display: flex; align-items: center; gap: .4rem; }
330
+ .blade-plan-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
331
+ .blade-plan-node[data-status="done"] .blade-plan-node-status { color: hsl(var(--primary)); }
332
+ .blade-plan-node[data-status="failed"] .blade-plan-node-status { color: hsl(var(--destructive)); }
333
+ .blade-plan-node[data-status="running"] .blade-plan-node-status, .blade-plan-node[data-agent-running] .blade-plan-binding { color: hsl(var(--primary)); }
334
+ .blade-plan-canvas[data-live] :is(.blade-plan-node[data-status="running"], .blade-plan-node[data-agent-running]) .blade-plan-node-body {
335
+ border-color: hsl(var(--primary) / .55);
336
+ animation: blade-plan-pulse 2s ease-in-out infinite;
337
+ }
338
+ .blade-plan-node[data-enter] { animation: blade-plan-enter .28s ease both; }
339
+ .blade-plan-check { stroke-dasharray: 1; animation: blade-plan-check .35s ease-out both; }
340
+
341
+ @keyframes blade-plan-enter { from { opacity: 0; } to { opacity: 1; } }
342
+ @keyframes blade-plan-pulse { 50% { box-shadow: 0 0 12px hsl(var(--primary) / .36); } }
343
+ @keyframes blade-plan-check { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
344
+ @keyframes blade-plan-flow { to { stroke-dashoffset: -23; } }
345
+
346
+ @media (prefers-reduced-motion: reduce) {
347
+ .blade-plan-canvas *, .blade-plan-canvas *::before, .blade-plan-canvas *::after { animation: none !important; transition: none !important; }
348
+ }
349
+
350
+ .blade-plan-mode-toggle {
351
+ flex-shrink: 0;
352
+ border-radius: 6px;
353
+ padding: .28rem .48rem;
354
+ font-size: .72rem;
355
+ }
356
+
357
+ .blade-plan-mode-toggle:hover { background: hsl(var(--muted)); }
358
+ .blade-plan-mode-toggle[aria-pressed="true"] {
359
+ color: hsl(var(--primary));
360
+ background: hsl(var(--primary) / .12);
361
+ }
@@ -5,7 +5,7 @@ import {
5
5
  DialogContent,
6
6
  DialogTitle,
7
7
  clsx
8
- } from "./chunk-FXTAY3LE.js";
8
+ } from "./chunk-WEOW475M.js";
9
9
  import {
10
10
  Check,
11
11
  ChevronDown,
@@ -13,30 +13,7 @@ import {
13
13
  CircleDot,
14
14
  ListChecks,
15
15
  LoaderCircle
16
- } from "./chunk-IOKIQSWP.js";
17
-
18
- // src/context.tsx
19
- import { createContext, useContext } from "react";
20
- import { jsx } from "react/jsx-runtime";
21
- var BladeClientContext = createContext(null);
22
- var EMPTY_HOST = {};
23
- var BladeHostContext = createContext(EMPTY_HOST);
24
- function BladeProvider({ client, host, children }) {
25
- return /* @__PURE__ */ jsx(BladeClientContext.Provider, { value: client, children: /* @__PURE__ */ jsx(BladeHostContext.Provider, { value: host ?? EMPTY_HOST, children }) });
26
- }
27
- function useBladeClient() {
28
- const client = useContext(BladeClientContext);
29
- if (!client) {
30
- throw new Error("useBladeClient \u5FC5\u987B\u5728 <BladeProvider> \u5185\u4F7F\u7528");
31
- }
32
- return client;
33
- }
34
- function useOptionalBladeClient() {
35
- return useContext(BladeClientContext);
36
- }
37
- function useBladeHost() {
38
- return useContext(BladeHostContext);
39
- }
16
+ } from "./chunk-J6BSKVVK.js";
40
17
 
41
18
  // src/chat/display-utils.ts
42
19
  var TOOL_NAME_ALIASES = {
@@ -3630,7 +3607,7 @@ async function copyToClipboard(text) {
3630
3607
  }
3631
3608
 
3632
3609
  // src/components/PlanUpdateBlock.tsx
3633
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
3610
+ import { jsx, jsxs } from "react/jsx-runtime";
3634
3611
  var PLAN_STEP_STATUSES = /* @__PURE__ */ new Set(["pending", "in_progress", "completed"]);
3635
3612
  var PLAN_AUTO_COLLAPSE_MS = 5e3;
3636
3613
  function isPlanUpdateTool(toolCall) {
@@ -3685,12 +3662,12 @@ function PlanStepIcon({
3685
3662
  running = false
3686
3663
  }) {
3687
3664
  if (status === "completed") {
3688
- return /* @__PURE__ */ jsx2(Check, { size, strokeWidth: 2, className: "shrink-0 text-emerald-500" });
3665
+ return /* @__PURE__ */ jsx(Check, { size, strokeWidth: 2, className: "shrink-0 text-emerald-500" });
3689
3666
  }
3690
3667
  if (status === "in_progress") {
3691
- return running ? /* @__PURE__ */ jsx2(LoaderCircle, { size, className: "shrink-0 animate-spin text-[hsl(var(--muted-foreground))]" }) : /* @__PURE__ */ jsx2(CircleDot, { size, className: "shrink-0 text-amber-500" });
3668
+ return running ? /* @__PURE__ */ jsx(LoaderCircle, { size, className: "shrink-0 animate-spin text-[hsl(var(--muted-foreground))]" }) : /* @__PURE__ */ jsx(CircleDot, { size, className: "shrink-0 text-amber-500" });
3692
3669
  }
3693
- return /* @__PURE__ */ jsx2(Circle, { size, className: "shrink-0 text-[hsl(var(--muted-foreground))]/60" });
3670
+ return /* @__PURE__ */ jsx(Circle, { size, className: "shrink-0 text-[hsl(var(--muted-foreground))]/60" });
3694
3671
  }
3695
3672
  function PlanUpdateBlock({
3696
3673
  toolCall,
@@ -3741,20 +3718,20 @@ function PlanUpdateBlock({
3741
3718
  ),
3742
3719
  children: [
3743
3720
  collapsed && currentStep ? /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-1.5 text-xs text-[hsl(var(--foreground))]", children: [
3744
- /* @__PURE__ */ jsx2(PlanStepIcon, { status: currentStep.status, size: 14, running }),
3745
- /* @__PURE__ */ jsx2("span", { className: "truncate", children: currentStep.step }),
3746
- pausedAtCurrentStep ? /* @__PURE__ */ jsx2("span", { className: "shrink-0 text-[11px] text-amber-500", children: "\u5DF2\u6682\u505C" }) : null
3721
+ /* @__PURE__ */ jsx(PlanStepIcon, { status: currentStep.status, size: 14, running }),
3722
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: currentStep.step }),
3723
+ pausedAtCurrentStep ? /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[11px] text-amber-500", children: "\u5DF2\u6682\u505C" }) : null
3747
3724
  ] }) : /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-1.5 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
3748
- /* @__PURE__ */ jsx2(ListChecks, { size: 14, className: "shrink-0", "aria-hidden": "true" }),
3749
- /* @__PURE__ */ jsx2("span", { className: "truncate", children: "\u4EFB\u52A1\u8FDB\u5EA6" }),
3750
- pausedAtCurrentStep ? /* @__PURE__ */ jsx2("span", { className: "shrink-0 text-amber-500", children: "\u5DF2\u6682\u505C" }) : null
3725
+ /* @__PURE__ */ jsx(ListChecks, { size: 14, className: "shrink-0", "aria-hidden": "true" }),
3726
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: "\u4EFB\u52A1\u8FDB\u5EA6" }),
3727
+ pausedAtCurrentStep ? /* @__PURE__ */ jsx("span", { className: "shrink-0 text-amber-500", children: "\u5DF2\u6682\u505C" }) : null
3751
3728
  ] }),
3752
3729
  /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-[11px] tabular-nums text-[hsl(var(--muted-foreground))]", children: [
3753
3730
  completed,
3754
3731
  "/",
3755
3732
  data.plan.length
3756
3733
  ] }),
3757
- /* @__PURE__ */ jsx2(
3734
+ /* @__PURE__ */ jsx(
3758
3735
  ChevronDown,
3759
3736
  {
3760
3737
  size: 14,
@@ -3767,7 +3744,7 @@ function PlanUpdateBlock({
3767
3744
  ]
3768
3745
  }
3769
3746
  ),
3770
- /* @__PURE__ */ jsx2(
3747
+ /* @__PURE__ */ jsx(
3771
3748
  "div",
3772
3749
  {
3773
3750
  "aria-hidden": collapsed,
@@ -3775,9 +3752,9 @@ function PlanUpdateBlock({
3775
3752
  "grid transition-[grid-template-rows,opacity] duration-300 ease-out motion-reduce:transition-none",
3776
3753
  collapsed ? "grid-rows-[0fr] opacity-0" : "grid-rows-[1fr] opacity-100"
3777
3754
  ),
3778
- children: /* @__PURE__ */ jsx2("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ jsx2("div", { className: "flex max-h-40 flex-col gap-0.5 overflow-y-auto px-3 py-2", children: data.plan.length === 0 ? /* @__PURE__ */ jsx2("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u6682\u65E0\u4EFB\u52A1\u6B65\u9AA4" }) : data.plan.map((item, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 py-0.5", children: [
3779
- /* @__PURE__ */ jsx2("span", { className: "mt-[3px] flex shrink-0", children: /* @__PURE__ */ jsx2(PlanStepIcon, { status: item.status, size: 14, running }) }),
3780
- /* @__PURE__ */ jsx2(
3755
+ children: /* @__PURE__ */ jsx("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex max-h-40 flex-col gap-0.5 overflow-y-auto px-3 py-2", children: data.plan.length === 0 ? /* @__PURE__ */ jsx("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u6682\u65E0\u4EFB\u52A1\u6B65\u9AA4" }) : data.plan.map((item, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 py-0.5", children: [
3756
+ /* @__PURE__ */ jsx("span", { className: "mt-[3px] flex shrink-0", children: /* @__PURE__ */ jsx(PlanStepIcon, { status: item.status, size: 14, running }) }),
3757
+ /* @__PURE__ */ jsx(
3781
3758
  "span",
3782
3759
  {
3783
3760
  className: cn(
@@ -3796,8 +3773,8 @@ function PlanUpdateBlock({
3796
3773
  // src/chat/runtime/session-source.tsx
3797
3774
  import { createInitialSessionState } from "@blade-hq/agent-client/internal";
3798
3775
  import {
3799
- createContext as createContext2,
3800
- useContext as useContext2,
3776
+ createContext,
3777
+ useContext,
3801
3778
  useEffect as useEffect2,
3802
3779
  useLayoutEffect,
3803
3780
  useMemo,
@@ -3805,7 +3782,7 @@ import {
3805
3782
  useState as useState2,
3806
3783
  useSyncExternalStore
3807
3784
  } from "react";
3808
- import { jsx as jsx3 } from "react/jsx-runtime";
3785
+ import { jsx as jsx2 } from "react/jsx-runtime";
3809
3786
  var EMPTY_SOURCE = {
3810
3787
  subscribe: () => () => {
3811
3788
  },
@@ -3813,12 +3790,12 @@ var EMPTY_SOURCE = {
3813
3790
  isHistoryLoading: () => false,
3814
3791
  planRevealRevision: () => 0
3815
3792
  };
3816
- var SessionSourceContext = createContext2(EMPTY_SOURCE);
3793
+ var SessionSourceContext = createContext(EMPTY_SOURCE);
3817
3794
  function SessionSourceProvider({ source, children }) {
3818
- return /* @__PURE__ */ jsx3(SessionSourceContext.Provider, { value: source, children });
3795
+ return /* @__PURE__ */ jsx2(SessionSourceContext.Provider, { value: source, children });
3819
3796
  }
3820
3797
  function useSessionSource() {
3821
- return useContext2(SessionSourceContext);
3798
+ return useContext(SessionSourceContext);
3822
3799
  }
3823
3800
  var SingleSessionSource = class {
3824
3801
  session = null;
@@ -3920,24 +3897,29 @@ function usePlanRevealRevision(sessionId) {
3920
3897
  () => source.planRevealRevision(sessionId)
3921
3898
  );
3922
3899
  }
3923
- var CurrentChatSessionContext = createContext2(null);
3900
+ var CurrentChatSessionContext = createContext(null);
3924
3901
  function CurrentChatSessionProvider({ sessionId, children }) {
3925
- return /* @__PURE__ */ jsx3(CurrentChatSessionContext.Provider, { value: sessionId, children });
3902
+ return /* @__PURE__ */ jsx2(CurrentChatSessionContext.Provider, { value: sessionId, children });
3926
3903
  }
3927
3904
  function useCurrentChatSessionId() {
3928
- return useContext2(CurrentChatSessionContext);
3905
+ return useContext(CurrentChatSessionContext);
3906
+ }
3907
+ var ReadOnlyChatContext = createContext(false);
3908
+ var ReadOnlyChatProvider = ReadOnlyChatContext.Provider;
3909
+ function useReadOnlyChat() {
3910
+ return useContext(ReadOnlyChatContext);
3929
3911
  }
3930
3912
 
3931
3913
  // src/chat/runtime/environment.tsx
3932
- import { createContext as createContext3, useContext as useContext3, useMemo as useMemo2 } from "react";
3933
- import { jsx as jsx4 } from "react/jsx-runtime";
3914
+ import { createContext as createContext2, useContext as useContext2, useMemo as useMemo2 } from "react";
3915
+ import { jsx as jsx3 } from "react/jsx-runtime";
3934
3916
  var EMPTY_ENVIRONMENT = {};
3935
- var ChatEnvironmentContext = createContext3(EMPTY_ENVIRONMENT);
3917
+ var ChatEnvironmentContext = createContext2(EMPTY_ENVIRONMENT);
3936
3918
  function ChatEnvironmentProvider({ value, children }) {
3937
- return /* @__PURE__ */ jsx4(ChatEnvironmentContext.Provider, { value, children });
3919
+ return /* @__PURE__ */ jsx3(ChatEnvironmentContext.Provider, { value, children });
3938
3920
  }
3939
3921
  function useChatEnvironment() {
3940
- return useContext3(ChatEnvironmentContext);
3922
+ return useContext2(ChatEnvironmentContext);
3941
3923
  }
3942
3924
  var NO_HIGHLIGHT = { highlightedHtml: null };
3943
3925
  function usePlainCode() {
@@ -4011,16 +3993,16 @@ function useChatVirtualizer(options) {
4011
3993
 
4012
3994
  // src/components/AccountConnectorRules.tsx
4013
3995
  import { useCallback } from "react";
4014
- import { jsx as jsx5 } from "react/jsx-runtime";
3996
+ import { jsx as jsx4 } from "react/jsx-runtime";
4015
3997
  function AccountConnectorRules({ client, name, refresh = 0 }) {
4016
3998
  const read = useCallback(() => client.connectors.rules(name), [client, name]);
4017
3999
  const update = useCallback((set) => client.connectors.updateRules(name, set), [client, name]);
4018
- return /* @__PURE__ */ jsx5(ConnectorRulesPanel, { compact: true, read, update, refresh }, name);
4000
+ return /* @__PURE__ */ jsx4(ConnectorRulesPanel, { compact: true, read, update, refresh }, name);
4019
4001
  }
4020
4002
 
4021
4003
  // src/components/BrowserConnectionDialog.tsx
4022
4004
  import { useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
4023
- import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
4005
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
4024
4006
  function BrowserConnectionDialog({ client, name, label = "\u4E1A\u52A1\u8D26\u53F7", connector, onClose }) {
4025
4007
  const [connection, setConnection] = useState3(connector?.connection);
4026
4008
  const [editing, setEditing] = useState3(false);
@@ -4049,21 +4031,21 @@ function BrowserConnectionDialog({ client, name, label = "\u4E1A\u52A1\u8D26\u53
4049
4031
  return () => window.removeEventListener("message", receive);
4050
4032
  }, [origin, onClose, frame]);
4051
4033
  const login = /* @__PURE__ */ jsxs2("div", { className: "space-y-3", children: [
4052
- /* @__PURE__ */ jsx6("p", { className: "text-xs opacity-70", children: "\u5728\u4E0B\u65B9\u9875\u9762\u5B8C\u6210\u767B\u5F55\u6216\u626B\u7801\uFF0C\u7136\u540E\u786E\u8BA4\u767B\u5F55\u3002\u9700\u8981\u9000\u51FA\u65F6\u53EF\u8FD4\u56DE\u8FDE\u63A5\u5668\u3002" }),
4053
- /* @__PURE__ */ jsx6("iframe", { ref: setFrame, title: `${label}\u767B\u5F55\u9875\u9762`, className: "h-[min(560px,60dvh)] w-full border-0" })
4034
+ /* @__PURE__ */ jsx5("p", { className: "text-xs opacity-70", children: "\u5728\u4E0B\u65B9\u9875\u9762\u5B8C\u6210\u767B\u5F55\u6216\u626B\u7801\uFF0C\u7136\u540E\u786E\u8BA4\u767B\u5F55\u3002\u9700\u8981\u9000\u51FA\u65F6\u53EF\u8FD4\u56DE\u8FDE\u63A5\u5668\u3002" }),
4035
+ /* @__PURE__ */ jsx5("iframe", { ref: setFrame, title: `${label}\u767B\u5F55\u9875\u9762`, className: "h-[min(560px,60dvh)] w-full border-0" })
4054
4036
  ] });
4055
- return /* @__PURE__ */ jsx6(Dialog, { open: true, onOpenChange: (open) => {
4037
+ return /* @__PURE__ */ jsx5(Dialog, { open: true, onOpenChange: (open) => {
4056
4038
  if (!open) onClose();
4057
4039
  }, children: /* @__PURE__ */ jsxs2(DialogContent, { "aria-describedby": void 0, className: "max-h-[90dvh] overflow-y-auto sm:max-w-[800px]", children: [
4058
4040
  /* @__PURE__ */ jsxs2(DialogTitle, { className: "sr-only", children: [
4059
4041
  "\u8FDE\u63A5 ",
4060
4042
  label
4061
4043
  ] }),
4062
- /* @__PURE__ */ jsx6(
4044
+ /* @__PURE__ */ jsx5(
4063
4045
  ConfigConnection,
4064
4046
  {
4065
4047
  editDescription: "\u91CD\u65B0\u767B\u5F55\u4E1A\u52A1\u8D26\u53F7",
4066
- detail: { title: label, rules: /* @__PURE__ */ jsx6(AccountConnectorRules, { client, name, refresh }) },
4048
+ detail: { title: label, rules: /* @__PURE__ */ jsx5(AccountConnectorRules, { client, name, refresh }) },
4067
4049
  status,
4068
4050
  account: connection?.account_label,
4069
4051
  verifiedAt: connection?.verified_at,
@@ -4086,22 +4068,18 @@ function BrowserConnectionDialog({ client, name, label = "\u4E1A\u52A1\u8D26\u53
4086
4068
  }
4087
4069
  }
4088
4070
  ),
4089
- editing && status === "connected" && /* @__PURE__ */ jsx6(Dialog, { open: true, onOpenChange: (open) => {
4071
+ editing && status === "connected" && /* @__PURE__ */ jsx5(Dialog, { open: true, onOpenChange: (open) => {
4090
4072
  if (!open) setEditing(false);
4091
4073
  }, children: /* @__PURE__ */ jsxs2(DialogContent, { "aria-describedby": void 0, className: "max-h-[90dvh] overflow-y-auto sm:max-w-[800px]", children: [
4092
- /* @__PURE__ */ jsx6(DialogTitle, { children: "\u66F4\u6362\u8D26\u53F7" }),
4093
- /* @__PURE__ */ jsx6("p", { children: "\u5B8C\u6210\u767B\u5F55\u5E76\u9A8C\u8BC1\u540E\u66FF\u6362\u5F53\u524D\u8D26\u53F7\uFF0C\u4F7F\u7528\u89C4\u5219\u4FDD\u7559\u3002" }),
4074
+ /* @__PURE__ */ jsx5(DialogTitle, { children: "\u66F4\u6362\u8D26\u53F7" }),
4075
+ /* @__PURE__ */ jsx5("p", { children: "\u5B8C\u6210\u767B\u5F55\u5E76\u9A8C\u8BC1\u540E\u66FF\u6362\u5F53\u524D\u8D26\u53F7\uFF0C\u4F7F\u7528\u89C4\u5219\u4FDD\u7559\u3002" }),
4094
4076
  login
4095
4077
  ] }) }),
4096
- /* @__PURE__ */ jsx6("button", { type: "button", className: "min-h-10 rounded-lg border px-4 text-sm", onClick: onClose, children: "\u8FD4\u56DE\u8FDE\u63A5\u5668" })
4078
+ /* @__PURE__ */ jsx5("button", { type: "button", className: "min-h-10 rounded-lg border px-4 text-sm", onClick: onClose, children: "\u8FD4\u56DE\u8FDE\u63A5\u5668" })
4097
4079
  ] }) });
4098
4080
  }
4099
4081
 
4100
4082
  export {
4101
- BladeProvider,
4102
- useBladeClient,
4103
- useOptionalBladeClient,
4104
- useBladeHost,
4105
4083
  cn,
4106
4084
  copyToClipboard,
4107
4085
  getToolDescription,
@@ -4142,6 +4120,8 @@ export {
4142
4120
  usePlanRevealRevision,
4143
4121
  CurrentChatSessionProvider,
4144
4122
  useCurrentChatSessionId,
4123
+ ReadOnlyChatProvider,
4124
+ useReadOnlyChat,
4145
4125
  ChatEnvironmentProvider,
4146
4126
  useChatEnvironment,
4147
4127
  useHighlightedCode,
@@ -4154,4 +4134,4 @@ export {
4154
4134
  AccountConnectorRules,
4155
4135
  BrowserConnectionDialog
4156
4136
  };
4157
- //# sourceMappingURL=chunk-CJQINCIP.js.map
4137
+ //# sourceMappingURL=chunk-3RFYXI6V.js.map