@blade-hq/agent-react 2610.0.0-beta.50 → 2610.0.0-beta.51

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.
@@ -11,11 +11,12 @@ interface Props {
11
11
  placeholder?: string;
12
12
  className?: string;
13
13
  queueKey?: string;
14
+ hasAttachments?: boolean;
14
15
  }
15
16
  /**
16
17
  * 轻量聊天输入框:textarea(Enter 发送 / Shift+Enter 换行)+ 发送/停止按钮。
17
18
  * 不含第一方版本的富文本编辑、@ 补全、技能菜单、语音输入与模型选择。
18
19
  * 内容受控,session.attach() / insertText() 通过 ChatView 注入到这里。
19
20
  */
20
- export declare function ChatInput({ value, onValueChange, onSend, onAppend, onStop, isStreaming, isStopping, placeholder, className, queueKey, }: Props): import("react/jsx-runtime").JSX.Element;
21
+ export declare function ChatInput({ value, onValueChange, onSend, onAppend, onStop, isStreaming, isStopping, placeholder, className, queueKey, hasAttachments, }: Props): import("react/jsx-runtime").JSX.Element;
21
22
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { AskUserAnswerData, ChatMessage, ConnectionStatus, PostChatFollowup } from "@blade-hq/agent-client";
2
- import type { ReactNode } from "react";
2
+ import { type ReactNode } from "react";
3
3
  import type { ToolCallRenderer } from "./ToolCallBlock";
4
4
  import type { FollowupInteractionEvent } from "./PostChatFollowupBlock";
5
5
  import type { ResultFeedback } from "@blade-hq/agent-client";
@@ -0,0 +1,14 @@
1
+ import type { BladeClient } from "@blade-hq/agent-client";
2
+ export interface McpAppMessage {
3
+ sessionId: string;
4
+ sourceId: string;
5
+ label: string;
6
+ content: string;
7
+ }
8
+ export declare const McpAppMessageContext: import("react").Context<((message: McpAppMessage) => void) | null>;
9
+ export declare function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: suppliedOnMessage }: {
10
+ sessionId: string;
11
+ sourceId: string;
12
+ client?: BladeClient;
13
+ onMessage?: (message: McpAppMessage) => void;
14
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import type { BladeClient, SessionPlugin, SessionPluginConfigState } from "@blade-hq/agent-client";
2
+ export interface SessionPluginConfigDialogProps {
3
+ client: BladeClient;
4
+ sessionId: string;
5
+ plugin: Pick<SessionPlugin, "name" | "display_name" | "icon">;
6
+ /** Called after every successful save with the freshly published state. */
7
+ onSaved?: (state: SessionPluginConfigState) => void;
8
+ onClose: () => void;
9
+ }
10
+ export declare function SessionPluginConfigDialog({ client, sessionId, plugin, ...props }: SessionPluginConfigDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import type { SessionPluginConfigError, SessionPluginConfigSet, SessionPluginConfigState } from "@blade-hq/agent-client";
2
+ export interface SessionPluginConfigDraft {
3
+ set: SessionPluginConfigSet[];
4
+ remove: string[];
5
+ }
6
+ export interface SessionPluginConfigFormProps {
7
+ config: SessionPluginConfigState;
8
+ submitting: boolean;
9
+ errors: SessionPluginConfigError[];
10
+ failure: string | null;
11
+ onSubmit: (draft: SessionPluginConfigDraft) => void;
12
+ onCancel: () => void;
13
+ }
14
+ export declare function SessionPluginConfigForm({ config, submitting, errors, failure, onSubmit, onCancel, }: SessionPluginConfigFormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import type { BladeClient, SessionPlugin } from "@blade-hq/agent-client";
2
+ export interface SessionPluginIconProps {
3
+ client: BladeClient;
4
+ sessionId: string;
5
+ plugin: Pick<SessionPlugin, "name" | "icon">;
6
+ className?: string;
7
+ }
8
+ export interface SessionPluginLabelProps {
9
+ plugin: Pick<SessionPlugin, "name" | "display_name">;
10
+ }
11
+ /**
12
+ * Business name for a plugin, falling back to the technical ID.
13
+ *
14
+ * The ID stays authoritative for paths, authorization, caching and calls; this
15
+ * helper only decides what a user reads. Keep it shared — one place decides.
16
+ */
17
+ export declare function sessionPluginLabel(plugin: Pick<SessionPlugin, "name" | "display_name">): string;
18
+ /** Package-local plugin icon, with a stable generic placeholder. */
19
+ export declare function SessionPluginIcon({ client, sessionId, plugin, className }: SessionPluginIconProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { type ToolUiCard } from "@blade-hq/agent-client";
2
+ /**
3
+ * MCP Apps 使用 SDK/Web 共享的 AppBridge;恢复只消费留档,不重读资源。
4
+ * 普通资源卡片仍使用 agent-client 的共享内容判定。
5
+ */
6
+ export declare function ToolUiCardView({ card, sessionId }: {
7
+ card: ToolUiCard;
8
+ sessionId?: string;
9
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,51 @@
1
+ import type { SessionPluginConfigState } from "@blade-hq/agent-client";
2
+ /**
3
+ * JSON Schema (Draft 2020-12) support surface for the shared plugin form.
4
+ *
5
+ * The platform validates with the full standard validator; the form only
6
+ * renders the constructs it can render honestly. Anything outside this list is
7
+ * reported with a located reason instead of being dropped or downgraded to a
8
+ * raw JSON editor — "不支持的呈现明确报错,不静默丢字段".
9
+ */
10
+ export type JsonSchema = Record<string, unknown>;
11
+ export interface Discriminator {
12
+ key: string;
13
+ label: string;
14
+ options: {
15
+ value: string;
16
+ label: string;
17
+ }[];
18
+ }
19
+ export declare function pointerOf(parts: (string | number)[]): string;
20
+ export declare function pointerParts(pointer: string): string[];
21
+ /** Follow intra-document `$ref` chains. Package-relative refs are refused. */
22
+ export declare function resolveNode(root: JsonSchema, node: JsonSchema): JsonSchema | null;
23
+ export declare function nodeTypes(node: JsonSchema): string[];
24
+ export declare function isSecret(node: JsonSchema): boolean;
25
+ export declare function optionsOf(node: JsonSchema): {
26
+ value: unknown;
27
+ label: string;
28
+ }[] | null;
29
+ export declare function labelOf(node: JsonSchema, fallback: string): string;
30
+ export declare function hintOf(node: JsonSchema): string | null;
31
+ /**
32
+ * Whether a branch keyword can be rendered, and why not when it cannot.
33
+ *
34
+ * `oneOf` is supported only in the shape a login form actually needs: every
35
+ * branch pins the same discriminator property with `const`. Anything else would
36
+ * mean guessing which fields to show.
37
+ */
38
+ export declare function unsupportedReason(root: JsonSchema, node: JsonSchema, pointer?: string, ancestors?: Set<JsonSchema>): string | null;
39
+ /**
40
+ * The switch a form can render: a property every `oneOf` branch pins with
41
+ * `const`, declared with an `enum` (or `const`) in `properties`.
42
+ */
43
+ export declare function discriminatorOf(root: JsonSchema, node: JsonSchema): Discriminator | null;
44
+ /** Required pointers for the whole document, following the active branch. */
45
+ export declare function requiredPointers(root: JsonSchema, values: Record<string, unknown>): Set<string>;
46
+ /** Whether a subtree holds `writeOnly` anywhere inside it. */
47
+ export declare function containsSecret(root: JsonSchema, node: JsonSchema): boolean;
48
+ export declare function readAt(document: Record<string, unknown>, pointer: string): unknown;
49
+ /** The form's support verdict for a whole declaration. */
50
+ export declare function formSupport(schema: JsonSchema | null): string | null;
51
+ export declare function configIsEditable(state: SessionPluginConfigState): boolean;
@@ -26,6 +26,7 @@ declare const BladeAgent: {
26
26
  SDK_VERSION: string;
27
27
  AgentSession: typeof AgentSession;
28
28
  SessionHub: typeof agentClient.SessionHub;
29
+ isMcpAppData: typeof agentClient.isMcpAppData;
29
30
  SessionSetupError: typeof agentClient.SessionSetupError;
30
31
  createInitialSessionState: typeof agentClient.createInitialSessionState;
31
32
  reconcileHistoricalUserTurns: typeof agentClient.reconcileHistoricalUserTurns;
@@ -60,6 +61,13 @@ declare const BladeAgent: {
60
61
  getContextGroupDisplayState: typeof agentClient.getContextGroupDisplayState;
61
62
  groupAdjacentContextRuns: typeof agentClient.groupAdjacentContextRuns;
62
63
  latestPostChatFollowup: typeof agentClient.latestPostChatFollowup;
64
+ buildToolUiCardKey: typeof agentClient.buildToolUiCardKey;
65
+ collectInlineToolUiCards: typeof agentClient.collectInlineToolUiCards;
66
+ collectPreviewToolUiCards: typeof agentClient.collectPreviewToolUiCards;
67
+ isAppDevToolUiCard: typeof agentClient.isAppDevToolUiCard;
68
+ isInternalStatusToolUiCard: typeof agentClient.isInternalStatusToolUiCard;
69
+ isToolUiCard: typeof agentClient.isToolUiCard;
70
+ resolveToolUiCardContent: typeof agentClient.resolveToolUiCardContent;
63
71
  prependOlder: typeof agentClient.prependOlder;
64
72
  replaceWindow: typeof agentClient.replaceWindow;
65
73
  DEFAULT_REPLAY_SPEED: agentClient.ReplaySpeed;
@@ -3,7 +3,8 @@ import {
3
3
  Ks,
4
4
  Qe,
5
5
  R
6
- } from "./chunk-ZXXLY4RM.js";
6
+ } from "./chunk-MAAMCOAU.js";
7
+ import "./chunk-G3PMV62Z.js";
7
8
 
8
9
  // ../../node_modules/.pnpm/streamdown@2.3.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js
9
10
  import { useContext, useState, useEffect } from "react";
@@ -24,4 +25,4 @@ var L = ({ code: s, language: t, raw: e, className: n, ...d$1 }) => {
24
25
  export {
25
26
  L as HighlightedCodeBlockBody
26
27
  };
27
- //# sourceMappingURL=highlighted-body-B3W2YXNL-YD7FAP6V.js.map
28
+ //# sourceMappingURL=highlighted-body-B3W2YXNL-IASCZDV2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/streamdown@2.3.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js"],"sourcesContent":["\"use client\";\nimport {k,d,c}from'./chunk-RLXIAIE6.js';import {useContext,useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';var L=({code:s,language:t,raw:e,className:n,...d$1})=>{let{shikiTheme:l}=useContext(k),o=d(),[m,i]=useState(e);return useEffect(()=>{if(!o){i(e);return}let g=o.highlight({code:s,language:t,themes:l},p=>{i(p);});g&&i(g);},[s,t,l,o,e]),jsx(c,{className:n,language:t,result:m,...d$1})};export{L as HighlightedCodeBlockBody};"],"mappings":";;;;;;;;AACwC,SAAQ,YAAW,UAAS,iBAAc;AAAQ,SAAQ,WAAQ;AAAoB,IAAI,IAAE,CAAC,EAAC,MAAK,GAAE,UAAS,GAAE,KAAI,GAAE,WAAU,GAAE,GAAG,IAAG,MAAI;AAAC,MAAG,EAAC,YAAW,EAAC,IAAE,WAAW,CAAC,GAAE,IAAE,GAAE,GAAE,CAAC,GAAE,CAAC,IAAE,SAAS,CAAC;AAAE,SAAO,UAAU,MAAI;AAAC,QAAG,CAAC,GAAE;AAAC,QAAE,CAAC;AAAE;AAAA,IAAM;AAAC,QAAI,IAAE,EAAE,UAAU,EAAC,MAAK,GAAE,UAAS,GAAE,QAAO,EAAC,GAAE,OAAG;AAAC,QAAE,CAAC;AAAA,IAAE,CAAC;AAAE,SAAG,EAAE,CAAC;AAAA,EAAE,GAAE,CAAC,GAAE,GAAE,GAAE,GAAE,CAAC,CAAC,GAAE,IAAI,IAAE,EAAC,WAAU,GAAE,UAAS,GAAE,QAAO,GAAE,GAAG,IAAG,CAAC;AAAC;","names":[]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/streamdown@2.3.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js"],"sourcesContent":["\"use client\";\nimport {k,d,c}from'./chunk-RLXIAIE6.js';import {useContext,useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';var L=({code:s,language:t,raw:e,className:n,...d$1})=>{let{shikiTheme:l}=useContext(k),o=d(),[m,i]=useState(e);return useEffect(()=>{if(!o){i(e);return}let g=o.highlight({code:s,language:t,themes:l},p=>{i(p);});g&&i(g);},[s,t,l,o,e]),jsx(c,{className:n,language:t,result:m,...d$1})};export{L as HighlightedCodeBlockBody};"],"mappings":";;;;;;;;;AACwC,SAAQ,YAAW,UAAS,iBAAc;AAAQ,SAAQ,WAAQ;AAAoB,IAAI,IAAE,CAAC,EAAC,MAAK,GAAE,UAAS,GAAE,KAAI,GAAE,WAAU,GAAE,GAAG,IAAG,MAAI;AAAC,MAAG,EAAC,YAAW,EAAC,IAAE,WAAW,CAAC,GAAE,IAAE,GAAE,GAAE,CAAC,GAAE,CAAC,IAAE,SAAS,CAAC;AAAE,SAAO,UAAU,MAAI;AAAC,QAAG,CAAC,GAAE;AAAC,QAAE,CAAC;AAAE;AAAA,IAAM;AAAC,QAAI,IAAE,EAAE,UAAU,EAAC,MAAK,GAAE,UAAS,GAAE,QAAO,EAAC,GAAE,OAAG;AAAC,QAAE,CAAC;AAAA,IAAE,CAAC;AAAE,SAAG,EAAE,CAAC;AAAA,EAAE,GAAE,CAAC,GAAE,GAAE,GAAE,GAAE,CAAC,CAAC,GAAE,IAAI,IAAE,EAAC,WAAU,GAAE,UAAS,GAAE,QAAO,GAAE,GAAG,IAAG,CAAC;AAAC;","names":[]}
package/dist/index.d.ts CHANGED
@@ -12,6 +12,12 @@ export { ChatView } from "./components/ChatView";
12
12
  export type { ChatViewClassNames, ChatViewProps, ChatViewRenderers, ChatViewSlots, FollowupInteractionEvent, } from "./components/ChatView";
13
13
  export { SessionPluginSelector } from "./components/SessionPluginSelector";
14
14
  export type { SessionPluginSelectorProps } from "./components/SessionPluginSelector";
15
+ export { SessionPluginIcon, sessionPluginLabel } from "./components/SessionPluginIcon";
16
+ export type { SessionPluginIconProps, SessionPluginLabelProps } from "./components/SessionPluginIcon";
17
+ export { SessionPluginConfigDialog } from "./components/SessionPluginConfigDialog";
18
+ export type { SessionPluginConfigDialogProps } from "./components/SessionPluginConfigDialog";
19
+ export { SessionPluginConfigForm } from "./components/SessionPluginConfigForm";
20
+ export type { SessionPluginConfigDraft, SessionPluginConfigFormProps, } from "./components/SessionPluginConfigForm";
15
21
  export { AgentChat } from "./components/AgentChat";
16
22
  export type { AgentChatProps } from "./components/AgentChat";
17
23
  export { LlmChat } from "./components/LlmChat";
@@ -34,6 +40,9 @@ export type { PlanStepStatus, PlanUpdateData, PlanUpdateDisplayState, } from "./
34
40
  export { ContextCard, ContextGroupCard } from "./components/ContextCard";
35
41
  export type { ContextCardProps, ContextGroupCardProps } from "./components/ContextCard";
36
42
  export { collectMemoryRefs, MemoryRefsHint } from "./components/AssistantTurnBlock";
43
+ export { ToolUiCardView } from "./components/ToolUiCardView";
44
+ export { McpAppCard } from "./components/McpAppCard";
45
+ export type { McpAppMessage } from "./components/McpAppCard";
37
46
  export { SessionMemoryToggle } from "./components/SessionMemoryToggle";
38
47
  export type { SessionMemoryToggleProps } from "./components/SessionMemoryToggle";
39
48
  export { isAgentComputerCommand, isAgentComputerToolCall, classifyAgentComputerLaunchOutcome, } from "./lib/agent-computer-command";