super-agent-sdk 1.0.19 → 1.0.20

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/dist/widget.d.ts CHANGED
@@ -212,7 +212,6 @@ export declare interface ComposerProps {
212
212
 
213
213
  declare interface Conversation {
214
214
  sessionId: string;
215
- botId: number;
216
215
  title: string | null;
217
216
  createTime: string;
218
217
  updateTime: string;
@@ -568,8 +567,8 @@ export declare interface Slots {
568
567
  }
569
568
 
570
569
  declare interface SuperAgentSDK {
571
- /** 当前 Bot ID(只读) */
572
- readonly botId: number;
570
+ /** 当前 Bot Code(只读,bots.code,跨环境稳定) */
571
+ readonly botCode: string;
573
572
  /** 确保持有 token:已持直接返回缓存;否则 POST {tokenGateway}/v2/token/generate 签发
574
573
  *(多 widget 并发挂载合并为一次请求),自动设置内部凭证。401 重签走重试链路 */
575
574
  getToken(): Promise<string>;
@@ -590,7 +589,7 @@ declare interface SuperAgentSDK {
590
589
  }): Promise<void>;
591
590
  /** 取消消息反馈,DELETE /chat/messages/{messageId}/feedback */
592
591
  cancelFeedback(messageId: string): Promise<void>;
593
- /** 获取当前 bot 绑定的 skill 列表,GET /chat/bots/{botId}/skills(含归属与可选性) */
592
+ /** 获取当前 bot 绑定的 skill 列表,GET /chat/bots/{botCode}/skills(含归属与可选性) */
594
593
  listSkills(): Promise<SkillInfo[]>;
595
594
  /** 停止生成(双信号:POST /chat/stop 广播 + abort SSE),半截回复保留 */
596
595
  stopGeneration(sessionId: string): Promise<void>;
package/dist/widget.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import Ke, { useState as G, useRef as J, useCallback as $, useEffect as ae, createContext as oa, useMemo as Je, useContext as la, isValidElement as sa, cloneElement as ua, createElement as ca } from "react";
2
2
  import { createRoot as da } from "react-dom/client";
3
3
  import { jsx as h, jsxs as T, Fragment as Ie } from "react/jsx-runtime";
4
- import { a as pa, b as zt, g as $r, c as fa } from "./nosUploader-CnYDALPr.js";
4
+ import { a as pa, b as zt, g as $r, c as fa } from "./nosUploader-DjJ7u2B1.js";
5
5
  function ha(e) {
6
6
  const { sdk: t, sessionId: n, onSessionCreated: r, onRoundStart: i, onStreamStart: o, onStreamEnd: a, onError: l, onMessageSend: s } = e, [u, d] = G([]), [c, f] = G("ready"), [p, m] = G(null), w = J(/* @__PURE__ */ new Map()), v = J(/* @__PURE__ */ new Map()), b = J(n), C = J(!0), S = J(u);
7
7
  b.current = n, C.current = u.length === 0, S.current = u;
@@ -296,7 +296,7 @@ function ga(e, t) {
296
296
  }
297
297
  }
298
298
  function ma(e) {
299
- const { sdk: t, onConversationChange: n } = e, r = t.botId, [i, o] = G([]), [a, l] = G(
299
+ const { sdk: t, onConversationChange: n } = e, r = t.botCode, [i, o] = G([]), [a, l] = G(
300
300
  () => _n(r)
301
301
  ), [s, u] = G(!1), [d, c] = G(!0), f = J(!0), p = J(1), m = J(!1);
302
302
  ae(() => () => {
@@ -340,7 +340,8 @@ function ma(e) {
340
340
  try {
341
341
  const L = await t.createSession(), O = (/* @__PURE__ */ new Date()).toISOString();
342
342
  o((B) => [
343
- { sessionId: L, botId: 0, title: "新对话", createTime: O, updateTime: O },
343
+ // 占位会话:bot 外部标识统一 botCode(会话创建不落内部 bot 标识字段)
344
+ { sessionId: L, title: "新对话", createTime: O, updateTime: O },
344
345
  ...B
345
346
  ]), w(L);
346
347
  } catch {
@@ -10890,7 +10891,7 @@ function Kp({ artifact: e }) {
10890
10891
  if (e.type === "docx") {
10891
10892
  const c = await fetch(e.url);
10892
10893
  if (!c.ok) throw new Error(`HTTP ${c.status}`);
10893
- const f = await c.arrayBuffer(), m = await (await import("./mammoth.browser-BmR8YfeV.js").then((v) => v.m)).convertToHtml({ arrayBuffer: f }), w = (await import("./purify.es-C-6FFqDW.js")).default;
10894
+ const f = await c.arrayBuffer(), m = await (await import("./mammoth.browser-xkqZbK20.js").then((v) => v.m)).convertToHtml({ arrayBuffer: f }), w = (await import("./purify.es-C-6FFqDW.js")).default;
10894
10895
  u || (n(w.sanitize(m.value, { FORCE_BODY: !0, ADD_ATTR: ["target"] })), a(!1));
10895
10896
  return;
10896
10897
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "super-agent-sdk",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "Super Agent Web SDK — API + 嵌入式聊天组件",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",