@blade-hq/agent-react 2612.0.0-beta.77 → 2612.0.0-beta.78

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 (56) hide show
  1. package/README.md +12 -2
  2. package/dist/SessionPluginConfigForm-7LJ5SUNY.js +9 -0
  3. package/dist/SessionPluginConfigForm-7LJ5SUNY.js.map +1 -0
  4. package/dist/chat/LiteMessageList.d.ts +4 -0
  5. package/dist/{chunk-IVGTMWRV.js → chunk-66JXSDLB.js} +284 -289
  6. package/dist/chunk-66JXSDLB.js.map +1 -0
  7. package/dist/{chunk-VBHHFIII.js → chunk-C3LBNHVM.js} +12 -10
  8. package/dist/{chunk-VBHHFIII.js.map → chunk-C3LBNHVM.js.map} +1 -1
  9. package/dist/chunk-F4MWGSKX.js +1308 -0
  10. package/dist/chunk-F4MWGSKX.js.map +1 -0
  11. package/dist/{chunk-ZIECHNZA.js → chunk-FBGCDXRK.js} +110 -115
  12. package/dist/chunk-FBGCDXRK.js.map +1 -0
  13. package/dist/{chunk-26NE55SJ.js → chunk-FDB3J5QF.js} +8 -6
  14. package/dist/{chunk-26NE55SJ.js.map → chunk-FDB3J5QF.js.map} +1 -1
  15. package/dist/{chunk-WO2VCQ5N.js → chunk-FH5HA3GW.js} +551 -455
  16. package/dist/chunk-FH5HA3GW.js.map +1 -0
  17. package/dist/chunk-KHJEIHMJ.js +973 -0
  18. package/dist/chunk-KHJEIHMJ.js.map +1 -0
  19. package/dist/{chunk-XBEN2ASY.js → chunk-MWILWSPG.js} +4262 -3186
  20. package/dist/chunk-MWILWSPG.js.map +1 -0
  21. package/dist/{chunk-EQOKPZI2.js → chunk-NRYLAO3X.js} +87 -154
  22. package/dist/chunk-NRYLAO3X.js.map +1 -0
  23. package/dist/{chunk-F2IJZX2Z.js → chunk-SK43YNRX.js} +151 -1442
  24. package/dist/chunk-SK43YNRX.js.map +1 -0
  25. package/dist/components/BrowserConnectionDialog.d.ts +3 -2
  26. package/dist/components/ConfigConnection.d.ts +16 -0
  27. package/dist/components/ConnectorDetail.d.ts +46 -0
  28. package/dist/components/ConnectorRulesPanel.d.ts +2 -1
  29. package/dist/components/ConnectorRuntimeDiagnostics.d.ts +2 -2
  30. package/dist/components/DeviceConnection.d.ts +3 -1
  31. package/dist/components/FeishuPermissionStatus.d.ts +3 -1
  32. package/dist/components/ManagedConnection.d.ts +5 -2
  33. package/dist/components/PackEventNotice.d.ts +3 -0
  34. package/dist/components/SessionPluginConfigForm.d.ts +2 -1
  35. package/dist/connectors.d.ts +3 -0
  36. package/dist/connectors.js +7 -2
  37. package/dist/embed/entry.d.ts +4 -0
  38. package/dist/index.d.ts +3 -0
  39. package/dist/index.js +13 -7
  40. package/dist/internal.js +16 -9
  41. package/dist/internal.js.map +1 -1
  42. package/dist/questions.js +8 -6
  43. package/dist/questions.js.map +1 -1
  44. package/dist/rich-input.js +16 -13
  45. package/dist/rich-input.js.map +1 -1
  46. package/dist/style.full.css +1 -1
  47. package/dist/tool-details.js +5 -4
  48. package/dist/tool-details.js.map +1 -1
  49. package/package.json +2 -2
  50. package/public-api.md +41 -3
  51. package/dist/chunk-EQOKPZI2.js.map +0 -1
  52. package/dist/chunk-F2IJZX2Z.js.map +0 -1
  53. package/dist/chunk-IVGTMWRV.js.map +0 -1
  54. package/dist/chunk-WO2VCQ5N.js.map +0 -1
  55. package/dist/chunk-XBEN2ASY.js.map +0 -1
  56. package/dist/chunk-ZIECHNZA.js.map +0 -1
@@ -1,18 +1,19 @@
1
+ import {
2
+ ConfigConnection,
3
+ ConnectorRulesPanel,
4
+ Dialog,
5
+ DialogContent,
6
+ DialogTitle,
7
+ clsx
8
+ } from "./chunk-MWILWSPG.js";
1
9
  import {
2
10
  Check,
3
11
  ChevronDown,
4
12
  Circle,
5
13
  CircleDot,
6
- ConnectorRulesPanel,
7
14
  ListChecks,
8
- LoaderCircle,
9
- X,
10
- clsx,
11
- cn,
12
- dist_exports3 as dist_exports,
13
- loopTabInShadowRoot,
14
- useOverlayRoot
15
- } from "./chunk-XBEN2ASY.js";
15
+ LoaderCircle
16
+ } from "./chunk-KHJEIHMJ.js";
16
17
 
17
18
  // src/context.tsx
18
19
  import { createContext, useContext } from "react";
@@ -3436,7 +3437,7 @@ var getDefaultConfig = () => {
3436
3437
  var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
3437
3438
 
3438
3439
  // src/lib/utils.ts
3439
- function cn2(...inputs) {
3440
+ function cn(...inputs) {
3440
3441
  return twMerge(clsx(inputs));
3441
3442
  }
3442
3443
  async function copyToClipboard(text) {
@@ -3557,7 +3558,7 @@ function PlanUpdateBlock({
3557
3558
  const completed = data.plan.filter((item) => item.status === "completed").length;
3558
3559
  const currentStep = pickCurrentPlanStep(data.plan);
3559
3560
  const pausedAtCurrentStep = !running && currentStep?.status === "in_progress";
3560
- return /* @__PURE__ */ jsxs("section", { part: "plan-block", className: cn2("blade-chat-plan-block overflow-hidden", className), children: [
3561
+ return /* @__PURE__ */ jsxs("section", { part: "plan-block", className: cn("blade-chat-plan-block overflow-hidden", className), children: [
3561
3562
  /* @__PURE__ */ jsxs(
3562
3563
  "button",
3563
3564
  {
@@ -3570,7 +3571,7 @@ function PlanUpdateBlock({
3570
3571
  }
3571
3572
  setCollapsed((value) => !value);
3572
3573
  },
3573
- className: cn2(
3574
+ className: cn(
3574
3575
  "flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[hsl(var(--muted)/0.3)]",
3575
3576
  !collapsed && "border-b border-[hsl(var(--border))]"
3576
3577
  ),
@@ -3593,7 +3594,7 @@ function PlanUpdateBlock({
3593
3594
  ChevronDown,
3594
3595
  {
3595
3596
  size: 14,
3596
- className: cn2(
3597
+ className: cn(
3597
3598
  "shrink-0 text-[hsl(var(--muted-foreground))] transition-transform duration-300 ease-out motion-reduce:transition-none",
3598
3599
  !collapsed && "rotate-180"
3599
3600
  )
@@ -3606,7 +3607,7 @@ function PlanUpdateBlock({
3606
3607
  "div",
3607
3608
  {
3608
3609
  "aria-hidden": collapsed,
3609
- className: cn2(
3610
+ className: cn(
3610
3611
  "grid transition-[grid-template-rows,opacity] duration-300 ease-out motion-reduce:transition-none",
3611
3612
  collapsed ? "grid-rows-[0fr] opacity-0" : "grid-rows-[1fr] opacity-100"
3612
3613
  ),
@@ -3615,7 +3616,7 @@ function PlanUpdateBlock({
3615
3616
  /* @__PURE__ */ jsx2(
3616
3617
  "span",
3617
3618
  {
3618
- className: cn2(
3619
+ className: cn(
3619
3620
  "min-w-0 flex-1 break-words text-[13px] leading-5",
3620
3621
  item.status === "completed" ? "text-[hsl(var(--muted-foreground))]" : item.status === "in_progress" ? "font-medium text-[hsl(var(--foreground))]" : "text-[hsl(var(--muted-foreground))]"
3621
3622
  ),
@@ -3634,52 +3635,85 @@ import { jsx as jsx3 } from "react/jsx-runtime";
3634
3635
  function AccountConnectorRules({ client, name, refresh = 0 }) {
3635
3636
  const read = useCallback(() => client.connectors.rules(name), [client, name]);
3636
3637
  const update = useCallback((set) => client.connectors.updateRules(name, set), [client, name]);
3637
- return /* @__PURE__ */ jsx3(ConnectorRulesPanel, { read, update, refresh }, name);
3638
+ return /* @__PURE__ */ jsx3(ConnectorRulesPanel, { compact: true, read, update, refresh }, name);
3638
3639
  }
3639
3640
 
3640
3641
  // src/components/BrowserConnectionDialog.tsx
3641
- import { useEffect as useEffect2, useRef as useRef2 } from "react";
3642
+ import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
3642
3643
  import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
3643
- function BrowserConnectionDialog({ client, name, label = "\u4E1A\u52A1\u8D26\u53F7", onClose }) {
3644
- const dialog = useRef2(null);
3645
- const frame = useRef2(null);
3646
- const url = new URL(client.connectors.browserAuthorizationUrl(name), window.location.href);
3647
- url.searchParams.set("embedded", "1");
3648
- const origin = url.origin;
3644
+ function BrowserConnectionDialog({ client, name, label = "\u4E1A\u52A1\u8D26\u53F7", connector, onClose }) {
3645
+ const [connection, setConnection] = useState2(connector?.connection);
3646
+ const [editing, setEditing] = useState2(false);
3647
+ const [refresh, setRefresh] = useState2(0);
3648
+ const [frame, setFrame] = useState2(null);
3649
+ const alive = useRef2(false);
3649
3650
  useEffect2(() => {
3650
- const element = dialog.current;
3651
- element?.showModal();
3652
- return () => element?.close();
3651
+ alive.current = true;
3652
+ return () => {
3653
+ alive.current = false;
3654
+ };
3653
3655
  }, []);
3656
+ const status = connection?.status ?? "disconnected";
3657
+ const showLogin = status !== "connected" || editing;
3658
+ const url = new URL(client.connectors.browserAuthorizationUrl(name), window.location.href);
3659
+ const origin = url.origin;
3654
3660
  useEffect2(() => {
3655
- if (!frame.current) return;
3656
- return client.connectors.bindBrowserAuthorizationFrame(frame.current, name);
3657
- }, [client, name]);
3661
+ if (!showLogin || !frame) return;
3662
+ return client.connectors.bindBrowserAuthorizationFrame(frame, name);
3663
+ }, [client, name, showLogin, frame]);
3658
3664
  useEffect2(() => {
3659
3665
  const receive = (event) => {
3660
- if (event.origin === origin && event.source === frame.current?.contentWindow && event.data?.type === "blade:connector-auth-close") onClose();
3666
+ if (event.origin === origin && event.source === frame?.contentWindow && event.data?.type === "blade:connector-auth-close") onClose();
3661
3667
  };
3662
3668
  window.addEventListener("message", receive);
3663
3669
  return () => window.removeEventListener("message", receive);
3664
- }, [origin, onClose]);
3665
- return /* @__PURE__ */ jsx4("dialog", { ref: dialog, "aria-label": `\u8FDE\u63A5 ${label}`, onCancel: (event) => {
3666
- event.preventDefault();
3667
- onClose();
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: [
3669
- /* @__PURE__ */ jsxs2("header", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-[hsl(var(--border))] px-4 py-3", children: [
3670
- /* @__PURE__ */ jsxs2("h2", { className: "text-sm font-medium", children: [
3671
- "\u8FDE\u63A5 ",
3672
- label
3673
- ] }),
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: [
3675
- /* @__PURE__ */ jsx4(X, { size: 14, "aria-hidden": "true" }),
3676
- "\u8FD4\u56DE\u8FDE\u63A5\u5668"
3677
- ] })
3670
+ }, [origin, onClose, frame]);
3671
+ const login = /* @__PURE__ */ jsxs2("div", { className: "space-y-3", children: [
3672
+ /* @__PURE__ */ jsx4("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" }),
3673
+ /* @__PURE__ */ jsx4("iframe", { ref: setFrame, title: `${label}\u767B\u5F55\u9875\u9762`, className: "h-[min(560px,60dvh)] w-full border-0" })
3674
+ ] });
3675
+ return /* @__PURE__ */ jsx4(Dialog, { open: true, onOpenChange: (open) => {
3676
+ if (!open) onClose();
3677
+ }, children: /* @__PURE__ */ jsxs2(DialogContent, { "aria-describedby": void 0, className: "max-h-[90dvh] overflow-y-auto sm:max-w-[800px]", children: [
3678
+ /* @__PURE__ */ jsxs2(DialogTitle, { className: "sr-only", children: [
3679
+ "\u8FDE\u63A5 ",
3680
+ label
3678
3681
  ] }),
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
- ] })
3682
+ /* @__PURE__ */ jsx4(
3683
+ ConfigConnection,
3684
+ {
3685
+ editDescription: "\u91CD\u65B0\u767B\u5F55\u4E1A\u52A1\u8D26\u53F7",
3686
+ detail: { title: label, rules: /* @__PURE__ */ jsx4(AccountConnectorRules, { client, name, refresh }) },
3687
+ status,
3688
+ account: connection?.account_label,
3689
+ verifiedAt: connection?.verified_at,
3690
+ onEdit: () => setEditing(true),
3691
+ connection: login,
3692
+ onDisconnect: async () => {
3693
+ const view = await client.connectors.disconnect(name);
3694
+ if (alive.current) {
3695
+ setConnection(view.connection);
3696
+ setEditing(false);
3697
+ setRefresh((value) => value + 1);
3698
+ }
3699
+ },
3700
+ onVerify: async () => {
3701
+ const view = await client.connectors.verify(name);
3702
+ if (alive.current) {
3703
+ setConnection(view.connection);
3704
+ setRefresh((value) => value + 1);
3705
+ }
3706
+ }
3707
+ }
3708
+ ),
3709
+ editing && status === "connected" && /* @__PURE__ */ jsx4(Dialog, { open: true, onOpenChange: (open) => {
3710
+ if (!open) setEditing(false);
3711
+ }, children: /* @__PURE__ */ jsxs2(DialogContent, { "aria-describedby": void 0, className: "max-h-[90dvh] overflow-y-auto sm:max-w-[800px]", children: [
3712
+ /* @__PURE__ */ jsx4(DialogTitle, { children: "\u66F4\u6362\u8D26\u53F7" }),
3713
+ /* @__PURE__ */ jsx4("p", { children: "\u5B8C\u6210\u767B\u5F55\u5E76\u9A8C\u8BC1\u540E\u66FF\u6362\u5F53\u524D\u8D26\u53F7\uFF0C\u4F7F\u7528\u89C4\u5219\u4FDD\u7559\u3002" }),
3714
+ login
3715
+ ] }) }),
3716
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "min-h-10 rounded-lg border px-4 text-sm", onClick: onClose, children: "\u8FD4\u56DE\u8FDE\u63A5\u5668" })
3683
3717
  ] }) });
3684
3718
  }
3685
3719
 
@@ -3692,7 +3726,7 @@ import {
3692
3726
  useLayoutEffect,
3693
3727
  useMemo,
3694
3728
  useRef as useRef3,
3695
- useState as useState2,
3729
+ useState as useState3,
3696
3730
  useSyncExternalStore
3697
3731
  } from "react";
3698
3732
  import { jsx as jsx5 } from "react/jsx-runtime";
@@ -3750,7 +3784,7 @@ var SingleSessionSource = class {
3750
3784
  }
3751
3785
  };
3752
3786
  function useSingleSessionSource(session, loading) {
3753
- const [source] = useState2(() => new SingleSessionSource());
3787
+ const [source] = useState3(() => new SingleSessionSource());
3754
3788
  useLayoutEffect(() => {
3755
3789
  source.update(session, loading);
3756
3790
  }, [source, session, loading]);
@@ -3899,108 +3933,12 @@ function useChatVirtualizer(options) {
3899
3933
  return { virtualizer, enabled: Boolean(injected) };
3900
3934
  }
3901
3935
 
3902
- // ../ui/src/components/dialog.tsx
3903
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
3904
- function Dialog({
3905
- ...props
3906
- }) {
3907
- return /* @__PURE__ */ jsx7(dist_exports.Root, { "data-slot": "dialog", ...props });
3908
- }
3909
- function DialogClose({
3910
- ...props
3911
- }) {
3912
- return /* @__PURE__ */ jsx7(dist_exports.Close, { "data-slot": "dialog-close", ...props });
3913
- }
3914
-
3915
- // ../ui/src/composites/dialog.tsx
3916
- import { forwardRef } from "react";
3917
- import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
3918
- var DialogOverlay = forwardRef(function DialogOverlay2({ className, ...props }, ref) {
3919
- return /* @__PURE__ */ jsx8(
3920
- dist_exports.Overlay,
3921
- {
3922
- ref,
3923
- "data-slot": "dialog-overlay",
3924
- className: cn(
3925
- "fixed inset-0 z-50 bg-black/45 backdrop-blur-sm duration-(--motion-duration-fast) data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",
3926
- className
3927
- ),
3928
- ...props
3929
- }
3930
- );
3931
- });
3932
- function DialogContent({
3933
- className,
3934
- children,
3935
- onKeyDown,
3936
- showCloseButton = true,
3937
- overlayClassName,
3938
- ...props
3939
- }) {
3940
- const overlayRoot = useOverlayRoot();
3941
- return /* @__PURE__ */ jsxs4(dist_exports.Portal, { "data-slot": "dialog-portal", container: overlayRoot, children: [
3942
- /* @__PURE__ */ jsx8(DialogOverlay, { className: overlayClassName }),
3943
- /* @__PURE__ */ jsxs4(
3944
- dist_exports.Content,
3945
- {
3946
- onKeyDown: (event) => {
3947
- onKeyDown?.(event);
3948
- loopTabInShadowRoot(event);
3949
- },
3950
- "data-slot": "dialog-content",
3951
- className: cn(
3952
- "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-[12px] border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-6 shadow-[var(--swf-shadow-overlay)] duration-(--motion-duration-fast) data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
3953
- className
3954
- ),
3955
- ...props,
3956
- children: [
3957
- children,
3958
- showCloseButton && /* @__PURE__ */ jsxs4(
3959
- dist_exports.Close,
3960
- {
3961
- "data-slot": "dialog-close",
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",
3963
- children: [
3964
- /* @__PURE__ */ jsx8(X, { size: 16 }),
3965
- /* @__PURE__ */ jsx8("span", { className: "sr-only", children: "\u5173\u95ED" })
3966
- ]
3967
- }
3968
- )
3969
- ]
3970
- }
3971
- )
3972
- ] });
3973
- }
3974
- function DialogTitle({ className, ...props }) {
3975
- return /* @__PURE__ */ jsx8(
3976
- dist_exports.Title,
3977
- {
3978
- "data-slot": "dialog-title",
3979
- className: cn("text-lg font-semibold text-[hsl(var(--foreground))]", className),
3980
- ...props
3981
- }
3982
- );
3983
- }
3984
- function DialogDescription({
3985
- className,
3986
- ...props
3987
- }) {
3988
- return /* @__PURE__ */ jsx8(
3989
- dist_exports.Description,
3990
- {
3991
- "data-slot": "dialog-description",
3992
- className: cn("text-sm text-[hsl(var(--muted-foreground))]", className),
3993
- ...props
3994
- }
3995
- );
3996
- }
3997
-
3998
3936
  export {
3999
3937
  BladeProvider,
4000
3938
  useBladeClient,
4001
3939
  useOptionalBladeClient,
4002
3940
  useBladeHost,
4003
- cn2 as cn,
3941
+ cn,
4004
3942
  copyToClipboard,
4005
3943
  getToolDescription,
4006
3944
  formatToolFileName,
@@ -4035,11 +3973,6 @@ export {
4035
3973
  useComposerBridge,
4036
3974
  useChatVirtualizer,
4037
3975
  AccountConnectorRules,
4038
- BrowserConnectionDialog,
4039
- Dialog,
4040
- DialogClose,
4041
- DialogContent,
4042
- DialogTitle,
4043
- DialogDescription
3976
+ BrowserConnectionDialog
4044
3977
  };
4045
- //# sourceMappingURL=chunk-EQOKPZI2.js.map
3978
+ //# sourceMappingURL=chunk-NRYLAO3X.js.map