@blade-hq/agent-react 2612.0.0-beta.66 → 2612.0.0-beta.68

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 (34) hide show
  1. package/README.md +4 -0
  2. package/dist/{chunk-MAFNMG2O.js → chunk-2DPLLZOU.js} +18 -13
  3. package/dist/{chunk-MAFNMG2O.js.map → chunk-2DPLLZOU.js.map} +1 -1
  4. package/dist/{chunk-N576N2XO.js → chunk-7MCGQH34.js} +12 -9
  5. package/dist/chunk-7MCGQH34.js.map +1 -0
  6. package/dist/{chunk-X66C66OQ.js → chunk-J72ZLILV.js} +287 -67
  7. package/dist/chunk-J72ZLILV.js.map +1 -0
  8. package/dist/{chunk-HS5G33FO.js → chunk-QIR73CES.js} +1031 -8
  9. package/dist/chunk-QIR73CES.js.map +1 -0
  10. package/dist/{chunk-UC7SY3G5.js → chunk-SA2U6KC5.js} +13 -13
  11. package/dist/{chunk-U3RHQHI6.js → chunk-SK5LWVRX.js} +48 -48
  12. package/dist/{chunk-VSIUEXGV.js → chunk-WRIMPZPN.js} +12 -962
  13. package/dist/chunk-WRIMPZPN.js.map +1 -0
  14. package/dist/{chunk-XV6AO37F.js → chunk-XJ6ZA6LN.js} +9 -9
  15. package/dist/components/AccountConnectors.d.ts +1 -1
  16. package/dist/components/ManagedConnection.d.ts +0 -1
  17. package/dist/components/SessionPluginIcon.d.ts +1 -0
  18. package/dist/connectors.js +2 -2
  19. package/dist/index.js +7 -7
  20. package/dist/internal.js +8 -8
  21. package/dist/questions.js +4 -5
  22. package/dist/questions.js.map +1 -1
  23. package/dist/rich-input.js +20 -20
  24. package/dist/style.full.css +1 -1
  25. package/dist/tool-details.js +4 -4
  26. package/package.json +2 -2
  27. package/public-api.md +7 -1
  28. package/dist/chunk-HS5G33FO.js.map +0 -1
  29. package/dist/chunk-N576N2XO.js.map +0 -1
  30. package/dist/chunk-VSIUEXGV.js.map +0 -1
  31. package/dist/chunk-X66C66OQ.js.map +0 -1
  32. /package/dist/{chunk-UC7SY3G5.js.map → chunk-SA2U6KC5.js.map} +0 -0
  33. /package/dist/{chunk-U3RHQHI6.js.map → chunk-SK5LWVRX.js.map} +0 -0
  34. /package/dist/{chunk-XV6AO37F.js.map → chunk-XJ6ZA6LN.js.map} +0 -0
package/README.md CHANGED
@@ -508,6 +508,8 @@ Questionnaire 负责必答校验、原生单选/多选、自填和前后分页
508
508
 
509
509
  ## 飞书授权接入
510
510
 
511
+ `ConnectorConnection` 通过 `type="device"` 或 `type="managed"` 选择连接方式,并接收对应连接组件的宿主回调。
512
+
511
513
  `DeviceConnection` 接收宿主的 `read`、`act`、`onChanged` 回调及可选 `onDisable`、`diagnostics`。宿主可用 `initialPage="manage"` 在首次挂载时直达管理页;尚未关联应用时仍进入连接入口,不会自动创建应用或授权。初始权限采用飞书平台默认模板及官方 CLI 推荐清单,不以机器人/本人身份或 SW 已实现能力筛选。权限状态按企业侧开通、本人授权分别展示,未知不等于拒绝;工作能力目录另外说明当前能执行的操作。
512
514
 
513
515
  首次关联应用后继续确认官方推荐的本人授权,允许两次扫码。企业审核要求以飞书页面为准;添加能力仍按当前操作核验和补充,核验失败保留连接与错误。统一授权流程按 `authorize` / `poll` 逐步展示当前飞书官方二维码,完成后显式 `finish`;PA 通过 `bindDelivery` 接入机器人消息,接入失败保留授权,可单独重试。完整分类选择在完成时替换启用集合,局部补权保留其他已选项;取消申请保留已有授权。增加能力时保留此助手原有停用状态,按钮显示“授权并保存”,暂停推送也不会被自动恢复。日志、历史步骤和原生错误编号放在连接帮助的高级排查内。
@@ -518,3 +520,5 @@ PA 等只需要授权界面的宿主可从 `@blade-hq/agent-react/connectors`
518
520
  ### 聊天中的飞书连接
519
521
 
520
522
  `@blade-hq/agent-react/connectors` 的 `DeviceConnection` 可传 `autoAuthorize`:仅在用户主动打开聊天授权卡片时开始准备官方二维码,设置页默认仍手动发起。`authorizationCapabilities` 用于只补当前操作需要的能力;已有有效二维码会继续使用,不重复生成。生成二维码不代表用户授权或企业审核已通过。
523
+
524
+ 首次连接默认只申请机器人能力;需要本人能力时按操作补充授权。已有连接的选择和授权不受影响。
@@ -1,12 +1,14 @@
1
1
  import {
2
- LoaderCircle,
3
- Plus,
4
- Puzzle,
5
- Trash2,
6
2
  useBladeClient,
7
3
  useSessionHandle,
8
4
  useSessionState
9
- } from "./chunk-VSIUEXGV.js";
5
+ } from "./chunk-WRIMPZPN.js";
6
+ import {
7
+ LoaderCircle,
8
+ Plus,
9
+ Puzzle,
10
+ Trash2
11
+ } from "./chunk-QIR73CES.js";
10
12
  import {
11
13
  __commonJS,
12
14
  __toESM
@@ -14901,9 +14903,10 @@ function iconBlob(client, sessionId, name, token) {
14901
14903
  function SessionPluginIcon({ client, sessionId, plugin, size = 20, shape = "rounded", className }) {
14902
14904
  const [url, setUrl] = useState10(null);
14903
14905
  const token = plugin.icon;
14906
+ const inlineIcon = token && /^data:image\/(?:png|jpeg|gif|webp);base64,/.test(token) ? token : null;
14904
14907
  useEffect7(() => {
14905
14908
  setUrl(null);
14906
- if (!token) return;
14909
+ if (!token || inlineIcon) return;
14907
14910
  let alive = true;
14908
14911
  let objectUrl = null;
14909
14912
  void iconBlob(client, sessionId, plugin.name, token).then((blob) => {
@@ -14915,13 +14918,14 @@ function SessionPluginIcon({ client, sessionId, plugin, size = 20, shape = "roun
14915
14918
  alive = false;
14916
14919
  if (objectUrl) URL.revokeObjectURL(objectUrl);
14917
14920
  };
14918
- }, [client, sessionId, plugin.name, token]);
14921
+ }, [client, sessionId, plugin.name, token, inlineIcon]);
14919
14922
  const frame = `flex shrink-0 items-center justify-center overflow-hidden ${shape === "circle" ? "rounded-full" : "rounded"} ${className ?? ""}`;
14920
14923
  const frameStyle = { width: size, height: size };
14921
- if (!url) {
14924
+ const source = url === "" ? null : inlineIcon ?? url;
14925
+ if (!source) {
14922
14926
  return /* @__PURE__ */ jsx3("span", { className: `${frame} bg-[hsl(var(--muted))] text-[hsl(var(--muted-foreground))]`, style: frameStyle, "data-plugin-icon": "placeholder", children: /* @__PURE__ */ jsx3(Puzzle, { "aria-hidden": true, size: Math.round(size * 0.7) }) });
14923
14927
  }
14924
- return /* @__PURE__ */ jsx3("span", { className: frame, style: frameStyle, "data-plugin-icon": "image", children: /* @__PURE__ */ jsx3("img", { src: url, alt: "", "aria-hidden": true, className: "h-full w-full object-cover", onError: () => setUrl(null) }) });
14928
+ return /* @__PURE__ */ jsx3("span", { className: frame, style: frameStyle, "data-plugin-icon": "image", children: /* @__PURE__ */ jsx3("img", { src: source, alt: "", "aria-hidden": true, className: "h-full w-full object-cover", onError: () => setUrl("") }) });
14925
14929
  }
14926
14930
 
14927
14931
  // src/components/SessionPluginConfigDialog.tsx
@@ -14974,7 +14978,9 @@ function ConfigDialogState({
14974
14978
  const [host, setHost] = useState11(null);
14975
14979
  const [restarting, setRestarting] = useState11(false);
14976
14980
  const [scope, setScope] = useState11("personal");
14977
- const waitingForHost = host?.state === "starting" || host?.state === "updating";
14981
+ const [config, setConfig] = useState11(null);
14982
+ const pendingRevision = scope === "global" && host?.state === "ready" && config?.revision != null && host.revision !== config.revision;
14983
+ const waitingForHost = host?.state === "starting" || host?.state === "updating" || pendingRevision;
14978
14984
  useEffect8(() => {
14979
14985
  if (!waitingForHost) return;
14980
14986
  const abort = new AbortController();
@@ -14994,7 +15000,6 @@ function ConfigDialogState({
14994
15000
  };
14995
15001
  }, [client, sessionId, plugin.name, scope, waitingForHost]);
14996
15002
  const [canConfigureGlobal, setCanConfigureGlobal] = useState11(false);
14997
- const [config, setConfig] = useState11(null);
14998
15003
  const [loading, setLoading] = useState11(true);
14999
15004
  const [loadFailure, setLoadFailure] = useState11(null);
15000
15005
  const [saving, setSaving] = useState11(false);
@@ -15129,7 +15134,7 @@ function ConfigDialogState({
15129
15134
  host ? /* @__PURE__ */ jsxs2("div", { className: "mb-3 space-y-1 text-xs", children: [
15130
15135
  /* @__PURE__ */ jsxs2("p", { children: [
15131
15136
  "\u670D\u52A1\uFF1A",
15132
- host.reason,
15137
+ pendingRevision ? "\u6B63\u5728\u66F4\u65B0" : host.reason,
15133
15138
  " \xB7 \u5DF2\u6062\u590D ",
15134
15139
  host.restarts,
15135
15140
  " \u6B21"
@@ -15804,4 +15809,4 @@ react-is/cjs/react-is.development.js:
15804
15809
  * LICENSE file in the root directory of this source tree.
15805
15810
  *)
15806
15811
  */
15807
- //# sourceMappingURL=chunk-MAFNMG2O.js.map
15812
+ //# sourceMappingURL=chunk-2DPLLZOU.js.map