@blade-hq/agent-react 2612.0.0-beta.76 → 2612.0.0-beta.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/chat/TurnNavRail.d.ts +1 -4
- package/dist/chat/index.d.ts +2 -1
- package/dist/chat/turn-locate-channel.d.ts +53 -0
- package/dist/{chunk-HCW7SI5Q.js → chunk-26NE55SJ.js} +4 -4
- package/dist/{chunk-WRIMPZPN.js → chunk-EQOKPZI2.js} +35 -21
- package/dist/chunk-EQOKPZI2.js.map +1 -0
- package/dist/{chunk-2DPLLZOU.js → chunk-F2IJZX2Z.js} +3 -3
- package/dist/{chunk-XP6T6SHZ.js → chunk-IVGTMWRV.js} +908 -755
- package/dist/chunk-IVGTMWRV.js.map +1 -0
- package/dist/{chunk-XJ6ZA6LN.js → chunk-VBHHFIII.js} +3 -3
- package/dist/{chunk-J72ZLILV.js → chunk-WO2VCQ5N.js} +5 -2
- package/dist/chunk-WO2VCQ5N.js.map +1 -0
- package/dist/{chunk-QIR73CES.js → chunk-XBEN2ASY.js} +7776 -7140
- package/dist/chunk-XBEN2ASY.js.map +1 -0
- package/dist/{chunk-7MCGQH34.js → chunk-ZIECHNZA.js} +14 -7
- package/dist/chunk-ZIECHNZA.js.map +1 -0
- package/dist/components/AccountConnectorRules.d.ts +7 -0
- package/dist/components/ConnectorRulesPanel.d.ts +9 -0
- package/dist/connectors.d.ts +1 -0
- package/dist/connectors.js +5 -2
- package/dist/hooks/use-turn-navigation.d.ts +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -7
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +10 -8
- package/dist/internal.js.map +1 -1
- package/dist/questions.js +3 -3
- package/dist/rich-input.js +21 -5
- package/dist/rich-input.js.map +1 -1
- package/dist/style.full.css +1 -1
- package/dist/tool-details.js +4 -4
- package/package.json +2 -2
- package/public-api.md +7 -1
- package/dist/chunk-7MCGQH34.js.map +0 -1
- package/dist/chunk-J72ZLILV.js.map +0 -1
- package/dist/chunk-QIR73CES.js.map +0 -1
- package/dist/chunk-WRIMPZPN.js.map +0 -1
- package/dist/chunk-XP6T6SHZ.js.map +0 -1
- /package/dist/{chunk-HCW7SI5Q.js.map → chunk-26NE55SJ.js.map} +0 -0
- /package/dist/{chunk-2DPLLZOU.js.map → chunk-F2IJZX2Z.js.map} +0 -0
- /package/dist/{chunk-XJ6ZA6LN.js.map → chunk-VBHHFIII.js.map} +0 -0
package/README.md
CHANGED
|
@@ -522,3 +522,7 @@ PA 等只需要授权界面的宿主可从 `@blade-hq/agent-react/connectors`
|
|
|
522
522
|
`@blade-hq/agent-react/connectors` 的 `DeviceConnection` 可传 `autoAuthorize`:仅在用户主动打开聊天授权卡片时开始准备官方二维码,设置页默认仍手动发起。`authorizationCapabilities` 用于只补当前操作需要的能力;已有有效二维码会继续使用,不重复生成。生成二维码不代表用户授权或企业审核已通过。
|
|
523
523
|
|
|
524
524
|
首次连接默认只申请机器人能力;需要本人能力时按操作补充授权。已有连接的选择和授权不受影响。
|
|
525
|
+
|
|
526
|
+
### ConnectorRulesPanel
|
|
527
|
+
|
|
528
|
+
从 `@blade-hq/agent-react/connectors` 导入 `ConnectorRulesPanel`,传入稳定的 `read` 和 `update` 回调(调用 `client.connectors.rules/updateRules`)。组件展示分组、分类、三档设置与恢复默认;保存成功才替换当前值,失败保留原设置。宿主通过 `className` 与继承主题接入已有样式;`onCountChange` 返回可设置规则组数。
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -27,7 +27,8 @@ export { TextAttachmentPills } from "./TextAttachmentPills";
|
|
|
27
27
|
export { getFilePreviewName, ToolFilePreviewAction, ToolPreviewAction, resolveAskQuestionState, ToolCallBlock } from "./ToolCallBlock";
|
|
28
28
|
export { ToolUiCard } from "./ToolUiCard";
|
|
29
29
|
export { TurnNavRail } from "./TurnNavRail";
|
|
30
|
-
export
|
|
30
|
+
export { turnLocateChannel, useTurnLocateRequest, useTurnLocateStatus } from "./turn-locate-channel";
|
|
31
|
+
export type { TurnLocateRequest, TurnLocateStatus } from "./turn-locate-channel";
|
|
31
32
|
export { isUserMessage, isErrorMessage, USER_MESSAGE_MARKDOWN_CLASS, UserMessageBubble, ErrorMessageBlock } from "./UserMessageBubble";
|
|
32
33
|
export type { UserChatMessage, ErrorChatMessage } from "./UserMessageBubble";
|
|
33
34
|
export { WorkflowRunBlock } from "./WorkflowRunBlock";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 跨组件「定位到某条发言」的请求通道。
|
|
3
|
+
*
|
|
4
|
+
* 消息列表(MessageList)与右侧脉络面板不在同一棵组件树里,而定位到窗口外
|
|
5
|
+
* 的历史发言需要 MessageList 内部的虚拟列表状态(isEntryLoaded / revealEntry /
|
|
6
|
+
* 滚动容器),脉络面板拿不到这些。这里用一个模块级 store 把「点击脉络里的
|
|
7
|
+
* 某条发言」变成一条带序号的信令,MessageList 监听后在它自己的
|
|
8
|
+
* useTurnNavigation.selectEntry 里执行完整定位(跨页加载 + 滚动 + 高亮)。
|
|
9
|
+
*
|
|
10
|
+
* 与 composer-channels 同一模式:module singleton + 订阅回调,
|
|
11
|
+
* 不依赖任何宿主 store,SDK 内可复用。
|
|
12
|
+
*/
|
|
13
|
+
export interface TurnLocateRequest {
|
|
14
|
+
entryId: string;
|
|
15
|
+
/** 单调递增,避免「同一条发言点两次」或「晚到的旧信号」被误判成新请求。 */
|
|
16
|
+
seq: number;
|
|
17
|
+
}
|
|
18
|
+
/** 执行侧回传的进度:面板据此显示「正在定位」/失败提示。 */
|
|
19
|
+
export interface TurnLocateStatus {
|
|
20
|
+
seq: number;
|
|
21
|
+
entryId: string;
|
|
22
|
+
state: "pending" | "failed";
|
|
23
|
+
}
|
|
24
|
+
export declare const turnLocateChannel: {
|
|
25
|
+
getState: () => Record<string, TurnLocateRequest>;
|
|
26
|
+
getStatus: () => Record<string, TurnLocateStatus>;
|
|
27
|
+
request(sessionId: string, entryId: string): void;
|
|
28
|
+
/** 执行侧回传进度;只有最新一次请求的结果会被接受。 */
|
|
29
|
+
report(sessionId: string, seq: number, state: TurnLocateStatus["state"]): void;
|
|
30
|
+
/** 定位完成(成功):清掉进度,面板不再显示「正在定位」。 */
|
|
31
|
+
clearStatus(sessionId: string, seq: number): void;
|
|
32
|
+
subscribe(listener: () => void): () => void;
|
|
33
|
+
/** 某条信令已被消费:同 seq 不再重复定位(避免重新挂载时又跳一次)。 */
|
|
34
|
+
consume(sessionId: string, seq: number): void;
|
|
35
|
+
/** 只清进度、不动未消费的请求(列表卸载时用)。 */
|
|
36
|
+
clearStatusForSession(sessionId: string): void;
|
|
37
|
+
clearSession(sessionId: string): void;
|
|
38
|
+
reset(): void;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* 订阅某个会话的定位请求。
|
|
42
|
+
*
|
|
43
|
+
* 用「命令式订阅 + useState」而不是 useSyncExternalStore:每条信令都是一次
|
|
44
|
+
* **一次性事件**(点一下就执行一次),store 里不留状态,消费完立即清空。
|
|
45
|
+
* useSyncExternalStore 要的是「可重复读取的快照」,在这种事件通道上反而容易
|
|
46
|
+
* 因为快照被清空/重读而漏掉那一次更新。
|
|
47
|
+
*/
|
|
48
|
+
export declare function useTurnLocateRequest(sessionId: string | null | undefined): TurnLocateRequest | null;
|
|
49
|
+
/**
|
|
50
|
+
* 订阅某个会话最近一次定位的进度。面板用它显示「正在定位」和失败提示——
|
|
51
|
+
* 定位实际由消息列表执行,面板自己的 useTurnNavigation 拿不到这份状态。
|
|
52
|
+
*/
|
|
53
|
+
export declare function useTurnLocateStatus(sessionId: string | null | undefined): TurnLocateStatus | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MarkdownContent
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VBHHFIII.js";
|
|
4
4
|
import {
|
|
5
5
|
cn,
|
|
6
6
|
extractToolFilePath,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useBladeClient,
|
|
10
10
|
useHighlightedCode,
|
|
11
11
|
useOptionalBladeClient
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EQOKPZI2.js";
|
|
13
13
|
import {
|
|
14
14
|
ChevronLeft,
|
|
15
15
|
ChevronRight,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
RotateCcw,
|
|
28
28
|
X,
|
|
29
29
|
dist_exports3 as dist_exports
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-XBEN2ASY.js";
|
|
31
31
|
import {
|
|
32
32
|
__export
|
|
33
33
|
} from "./chunk-PR4QN5HX.js";
|
|
@@ -27373,4 +27373,4 @@ export {
|
|
|
27373
27373
|
* MIT Licensed
|
|
27374
27374
|
*)
|
|
27375
27375
|
*/
|
|
27376
|
-
//# sourceMappingURL=chunk-
|
|
27376
|
+
//# sourceMappingURL=chunk-26NE55SJ.js.map
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ChevronDown,
|
|
4
4
|
Circle,
|
|
5
5
|
CircleDot,
|
|
6
|
+
ConnectorRulesPanel,
|
|
6
7
|
ListChecks,
|
|
7
8
|
LoaderCircle,
|
|
8
9
|
X,
|
|
@@ -11,7 +12,7 @@ import {
|
|
|
11
12
|
dist_exports3 as dist_exports,
|
|
12
13
|
loopTabInShadowRoot,
|
|
13
14
|
useOverlayRoot
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XBEN2ASY.js";
|
|
15
16
|
|
|
16
17
|
// src/context.tsx
|
|
17
18
|
import { createContext, useContext } from "react";
|
|
@@ -3627,9 +3628,18 @@ function PlanUpdateBlock({
|
|
|
3627
3628
|
] });
|
|
3628
3629
|
}
|
|
3629
3630
|
|
|
3631
|
+
// src/components/AccountConnectorRules.tsx
|
|
3632
|
+
import { useCallback } from "react";
|
|
3633
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
3634
|
+
function AccountConnectorRules({ client, name, refresh = 0 }) {
|
|
3635
|
+
const read = useCallback(() => client.connectors.rules(name), [client, name]);
|
|
3636
|
+
const update = useCallback((set) => client.connectors.updateRules(name, set), [client, name]);
|
|
3637
|
+
return /* @__PURE__ */ jsx3(ConnectorRulesPanel, { read, update, refresh }, name);
|
|
3638
|
+
}
|
|
3639
|
+
|
|
3630
3640
|
// src/components/BrowserConnectionDialog.tsx
|
|
3631
3641
|
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
3632
|
-
import { jsx as
|
|
3642
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3633
3643
|
function BrowserConnectionDialog({ client, name, label = "\u4E1A\u52A1\u8D26\u53F7", onClose }) {
|
|
3634
3644
|
const dialog = useRef2(null);
|
|
3635
3645
|
const frame = useRef2(null);
|
|
@@ -3652,7 +3662,7 @@ function BrowserConnectionDialog({ client, name, label = "\u4E1A\u52A1\u8D26\u53
|
|
|
3652
3662
|
window.addEventListener("message", receive);
|
|
3653
3663
|
return () => window.removeEventListener("message", receive);
|
|
3654
3664
|
}, [origin, onClose]);
|
|
3655
|
-
return /* @__PURE__ */
|
|
3665
|
+
return /* @__PURE__ */ jsx4("dialog", { ref: dialog, "aria-label": `\u8FDE\u63A5 ${label}`, onCancel: (event) => {
|
|
3656
3666
|
event.preventDefault();
|
|
3657
3667
|
onClose();
|
|
3658
3668
|
}, className: "fixed inset-0 m-auto h-[min(820px,90dvh)] max-h-none w-[min(960px,calc(100%_-_32px))] max-w-none overflow-hidden rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--background))] p-0 text-[hsl(var(--foreground))] shadow-xl backdrop:bg-black/45", children: /* @__PURE__ */ jsxs2("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
@@ -3662,11 +3672,14 @@ function BrowserConnectionDialog({ client, name, label = "\u4E1A\u52A1\u8D26\u53
|
|
|
3662
3672
|
label
|
|
3663
3673
|
] }),
|
|
3664
3674
|
/* @__PURE__ */ jsxs2("button", { type: "button", className: "inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--background))] px-3 text-xs font-medium hover:bg-[hsl(var(--accent))]", onClick: onClose, children: [
|
|
3665
|
-
/* @__PURE__ */
|
|
3675
|
+
/* @__PURE__ */ jsx4(X, { size: 14, "aria-hidden": "true" }),
|
|
3666
3676
|
"\u8FD4\u56DE\u8FDE\u63A5\u5668"
|
|
3667
3677
|
] })
|
|
3668
3678
|
] }),
|
|
3669
|
-
/* @__PURE__ */
|
|
3679
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [
|
|
3680
|
+
/* @__PURE__ */ jsx4("iframe", { ref: frame, title: `${label}\u767B\u5F55\u9875\u9762`, className: "h-[min(560px,60dvh)] w-full border-0" }),
|
|
3681
|
+
/* @__PURE__ */ jsx4("div", { className: "px-4", children: /* @__PURE__ */ jsx4(AccountConnectorRules, { client, name }) })
|
|
3682
|
+
] })
|
|
3670
3683
|
] }) });
|
|
3671
3684
|
}
|
|
3672
3685
|
|
|
@@ -3682,7 +3695,7 @@ import {
|
|
|
3682
3695
|
useState as useState2,
|
|
3683
3696
|
useSyncExternalStore
|
|
3684
3697
|
} from "react";
|
|
3685
|
-
import { jsx as
|
|
3698
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
3686
3699
|
var EMPTY_SOURCE = {
|
|
3687
3700
|
subscribe: () => () => {
|
|
3688
3701
|
},
|
|
@@ -3692,7 +3705,7 @@ var EMPTY_SOURCE = {
|
|
|
3692
3705
|
};
|
|
3693
3706
|
var SessionSourceContext = createContext2(EMPTY_SOURCE);
|
|
3694
3707
|
function SessionSourceProvider({ source, children }) {
|
|
3695
|
-
return /* @__PURE__ */
|
|
3708
|
+
return /* @__PURE__ */ jsx5(SessionSourceContext.Provider, { value: source, children });
|
|
3696
3709
|
}
|
|
3697
3710
|
function useSessionSource() {
|
|
3698
3711
|
return useContext2(SessionSourceContext);
|
|
@@ -3799,7 +3812,7 @@ function usePlanRevealRevision(sessionId) {
|
|
|
3799
3812
|
}
|
|
3800
3813
|
var CurrentChatSessionContext = createContext2(null);
|
|
3801
3814
|
function CurrentChatSessionProvider({ sessionId, children }) {
|
|
3802
|
-
return /* @__PURE__ */
|
|
3815
|
+
return /* @__PURE__ */ jsx5(CurrentChatSessionContext.Provider, { value: sessionId, children });
|
|
3803
3816
|
}
|
|
3804
3817
|
function useCurrentChatSessionId() {
|
|
3805
3818
|
return useContext2(CurrentChatSessionContext);
|
|
@@ -3807,11 +3820,11 @@ function useCurrentChatSessionId() {
|
|
|
3807
3820
|
|
|
3808
3821
|
// src/chat/runtime/environment.tsx
|
|
3809
3822
|
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo2 } from "react";
|
|
3810
|
-
import { jsx as
|
|
3823
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
3811
3824
|
var EMPTY_ENVIRONMENT = {};
|
|
3812
3825
|
var ChatEnvironmentContext = createContext3(EMPTY_ENVIRONMENT);
|
|
3813
3826
|
function ChatEnvironmentProvider({ value, children }) {
|
|
3814
|
-
return /* @__PURE__ */
|
|
3827
|
+
return /* @__PURE__ */ jsx6(ChatEnvironmentContext.Provider, { value, children });
|
|
3815
3828
|
}
|
|
3816
3829
|
function useChatEnvironment() {
|
|
3817
3830
|
return useContext3(ChatEnvironmentContext);
|
|
@@ -3887,23 +3900,23 @@ function useChatVirtualizer(options) {
|
|
|
3887
3900
|
}
|
|
3888
3901
|
|
|
3889
3902
|
// ../ui/src/components/dialog.tsx
|
|
3890
|
-
import { jsx as
|
|
3903
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3891
3904
|
function Dialog({
|
|
3892
3905
|
...props
|
|
3893
3906
|
}) {
|
|
3894
|
-
return /* @__PURE__ */
|
|
3907
|
+
return /* @__PURE__ */ jsx7(dist_exports.Root, { "data-slot": "dialog", ...props });
|
|
3895
3908
|
}
|
|
3896
3909
|
function DialogClose({
|
|
3897
3910
|
...props
|
|
3898
3911
|
}) {
|
|
3899
|
-
return /* @__PURE__ */
|
|
3912
|
+
return /* @__PURE__ */ jsx7(dist_exports.Close, { "data-slot": "dialog-close", ...props });
|
|
3900
3913
|
}
|
|
3901
3914
|
|
|
3902
3915
|
// ../ui/src/composites/dialog.tsx
|
|
3903
3916
|
import { forwardRef } from "react";
|
|
3904
|
-
import { jsx as
|
|
3917
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3905
3918
|
var DialogOverlay = forwardRef(function DialogOverlay2({ className, ...props }, ref) {
|
|
3906
|
-
return /* @__PURE__ */
|
|
3919
|
+
return /* @__PURE__ */ jsx8(
|
|
3907
3920
|
dist_exports.Overlay,
|
|
3908
3921
|
{
|
|
3909
3922
|
ref,
|
|
@@ -3926,7 +3939,7 @@ function DialogContent({
|
|
|
3926
3939
|
}) {
|
|
3927
3940
|
const overlayRoot = useOverlayRoot();
|
|
3928
3941
|
return /* @__PURE__ */ jsxs4(dist_exports.Portal, { "data-slot": "dialog-portal", container: overlayRoot, children: [
|
|
3929
|
-
/* @__PURE__ */
|
|
3942
|
+
/* @__PURE__ */ jsx8(DialogOverlay, { className: overlayClassName }),
|
|
3930
3943
|
/* @__PURE__ */ jsxs4(
|
|
3931
3944
|
dist_exports.Content,
|
|
3932
3945
|
{
|
|
@@ -3948,8 +3961,8 @@ function DialogContent({
|
|
|
3948
3961
|
"data-slot": "dialog-close",
|
|
3949
3962
|
className: "absolute top-4 right-4 rounded-[8px] p-2 text-[hsl(var(--muted-foreground))] opacity-90 transition-colors hover:bg-[hsl(var(--accent))] hover:opacity-100 focus:outline-none disabled:pointer-events-none",
|
|
3950
3963
|
children: [
|
|
3951
|
-
/* @__PURE__ */
|
|
3952
|
-
/* @__PURE__ */
|
|
3964
|
+
/* @__PURE__ */ jsx8(X, { size: 16 }),
|
|
3965
|
+
/* @__PURE__ */ jsx8("span", { className: "sr-only", children: "\u5173\u95ED" })
|
|
3953
3966
|
]
|
|
3954
3967
|
}
|
|
3955
3968
|
)
|
|
@@ -3959,7 +3972,7 @@ function DialogContent({
|
|
|
3959
3972
|
] });
|
|
3960
3973
|
}
|
|
3961
3974
|
function DialogTitle({ className, ...props }) {
|
|
3962
|
-
return /* @__PURE__ */
|
|
3975
|
+
return /* @__PURE__ */ jsx8(
|
|
3963
3976
|
dist_exports.Title,
|
|
3964
3977
|
{
|
|
3965
3978
|
"data-slot": "dialog-title",
|
|
@@ -3972,7 +3985,7 @@ function DialogDescription({
|
|
|
3972
3985
|
className,
|
|
3973
3986
|
...props
|
|
3974
3987
|
}) {
|
|
3975
|
-
return /* @__PURE__ */
|
|
3988
|
+
return /* @__PURE__ */ jsx8(
|
|
3976
3989
|
dist_exports.Description,
|
|
3977
3990
|
{
|
|
3978
3991
|
"data-slot": "dialog-description",
|
|
@@ -4021,6 +4034,7 @@ export {
|
|
|
4021
4034
|
notifyChat,
|
|
4022
4035
|
useComposerBridge,
|
|
4023
4036
|
useChatVirtualizer,
|
|
4037
|
+
AccountConnectorRules,
|
|
4024
4038
|
BrowserConnectionDialog,
|
|
4025
4039
|
Dialog,
|
|
4026
4040
|
DialogClose,
|
|
@@ -4028,4 +4042,4 @@ export {
|
|
|
4028
4042
|
DialogTitle,
|
|
4029
4043
|
DialogDescription
|
|
4030
4044
|
};
|
|
4031
|
-
//# sourceMappingURL=chunk-
|
|
4045
|
+
//# sourceMappingURL=chunk-EQOKPZI2.js.map
|