@tbox.cn/app-sdk-client 1.0.0-alpha.1 → 1.0.0-alpha.11

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 CHANGED
@@ -6,4 +6,4 @@ chat 引擎、状态域(zustand)、桥协议 v2、WS 客户端(keepalive /
6
6
  真实外部依赖仅 react + react-dom + zustand(+ core/contracts)——client 树零 Node 内建、零 server 重依赖
7
7
  (2026-09 三包拆分;浏览器直连 o.tbox.cn 的能力已全部收口为同源代理)。
8
8
 
9
- 公开入口:`.` / `./client` / `./client/card-preview` / `./platform/code-inspect`(vite 页面微调 babel plugin)。
9
+ 公开入口:`.` / `./client` / `./app`(startApp 启动层)/ `./platform/code-inspect`(vite 页面微调 babel plugin)。
@@ -0,0 +1,36 @@
1
+ import { ReactNode, ComponentType } from 'react';
2
+ import { CardComponent } from '@tbox.cn/app-contracts';
3
+ import { A as AppClientModule } from '../app-module-dEGAU6l2.js';
4
+
5
+ interface AppConfig {
6
+ /** API base;对应 VITE_API_URL。空串 = 同源。SDK 零 Vite 依赖,由组装端读取后传入。 */
7
+ apiBaseUrl?: string;
8
+ /** 渲染前钩子(主题、chat 配置快照等);抛错 → 统一启动失败兜底。 */
9
+ setup?: () => void | Promise<void>;
10
+ /** 默认 true;false 关闭 ErrorBoundary(应用自带边界时)。 */
11
+ errorBoundary?: boolean;
12
+ /** 卡片预览面的装配根(预览页渲染 kit 卡片需要 provider);缺省不包。 */
13
+ wrapPreview?: (page: ReactNode) => ReactNode;
14
+ }
15
+ interface StartAppOptions {
16
+ config?: AppConfig;
17
+ /** 页面加载器;生成 entry 用动态 import 保留按路由 chunk。 */
18
+ page: () => Promise<{
19
+ default: ComponentType;
20
+ }>;
21
+ /** 客户端模块;startApp 统一注册。 */
22
+ modules?: readonly AppClientModule[];
23
+ /** 应用级卡片;startApp 统一注册。 */
24
+ cards?: Record<string, CardComponent>;
25
+ /** 通用包装钩子;agent 层用它注入 AgentAppShell。 */
26
+ wrap?: (page: ReactNode) => ReactNode;
27
+ }
28
+ /**
29
+ * 客户端通用启动层(单一装配入口)。
30
+ *
31
+ * 固定执行序:runtime → 全局错误上报 → URL 参数日志 → config.setup →
32
+ * 注册卡片/模块 → 加载页面 → 渲染。幂等;启动失败渲染可见兜底。
33
+ */
34
+ declare function startApp(options: StartAppOptions): Promise<void>;
35
+
36
+ export { type AppConfig, type StartAppOptions, startApp };
@@ -0,0 +1 @@
1
+ import{d as s,e as c,f as l,s as p,t as d}from"../chunk-S3Y64FNZ.js";import{StrictMode as w}from"react";import{createRoot as m}from"react-dom/client";import{createLogger as h}from"@tbox.cn/app-sdk-core";import{jsx as t,jsxs as P}from"react/jsx-runtime";var a=h("APP"),f=!1,i=null;function g(){return typeof document>"u"?null:document.getElementById("root")}function R(e){let r=g();if(r)try{i??=m(r),i.render(t(y,{message:e}))}catch(o){a.error("render startup fallback failed:",o)}}function y({message:e}){return P("main",{style:{padding:24,fontFamily:"system-ui, sans-serif"},children:[t("h1",{style:{fontSize:18},children:"页面暂时不可用"}),t("p",{style:{color:"#666"},children:e}),t("button",{type:"button",onClick:()=>window.location.reload(),children:"重新加载"})]})}var C=/^(code|token|auth_code|visitortoken|session)$/i;function u(e){let r={};return new URLSearchParams(e).forEach((o,n)=>{r[n]=C.test(n)?`${o.slice(0,6)}…(len=${o.length})`:o}),r}function A(){if(typeof window>"u")return;let e=window.location.hash.includes("?")?window.location.hash.slice(window.location.hash.indexOf("?")+1):"";a.info(`url params: ${JSON.stringify({search:u(window.location.search),hash:u(e)})}`)}async function v(e){if(f){a.warn("startApp 重复调用(已启动,忽略)");return}f=!0;try{l({apiBaseUrl:e.config?.apiBaseUrl}),s(),A(),await e.config?.setup?.(),p(e.cards),await d(e.modules??[]);let{default:r}=await e.page(),o=g();if(!o){a.error("未找到 #root,跳过挂载");return}i??=m(o);let n=e.wrap?e.wrap(t(r,{})):t(r,{});i.render(t(w,{children:e.config?.errorBoundary===!1?n:t(c,{fallback:t(y,{message:"页面渲染失败,请刷新重试"}),children:n})}))}catch(r){a.error("startup failed:",r),R(r instanceof Error?r.message:String(r))}}export{v as startApp};
@@ -0,0 +1,102 @@
1
+ import { CardComponent, TboxCardPayload, ClientSlotId, ClientSlotValueMap } from '@tbox.cn/app-contracts';
2
+
3
+ /** 内联流过滤器(域注册;复合序 = 注册序) */
4
+ type InlineCardFilter = (cards: readonly TboxCardPayload[]) => TboxCardPayload[];
5
+ /**
6
+ * ClientCardRegistry:客户端卡片组件注册表(cardType → CardComponent,无状态)。
7
+ * 模块在 clientModule.register(ctx) 内 ctx.cards.registerMap(map) 注册组件。
8
+ * 与 server 端 CardRegistry 对称:server 注册数据契约(CardMeta),client 注册渲染组件。
9
+ *
10
+ * 三通道(单一模板统一化):
11
+ * - 原始注册(registerMap):模块自有卡组件(RawCardRenderer 消费面);
12
+ * - 覆盖注册(registerOverride):聊天视图组合层覆盖(同 cardType 包装/替换——原始视图不受影响,
13
+ * 域模块包自持防嵌套语义,如 mall-core 包装 alipay-activity 的联单卡);
14
+ * - 内联过滤(registerInlineFilter):域声明哪些卡不进内联流(由域浮层自持;多域按注册序复合)。
15
+ * 应用组装端读取:`{...ctx.cards.getAll(), ...ctx.cards.getOverrides()}` 为聊天视图注册表;
16
+ * `ctx.cards.applyInlineFilters` 为 ChatPage filterInlineCards 注入值。
17
+ */
18
+ declare class ClientCardRegistry {
19
+ private cards;
20
+ private overrides;
21
+ private inlineFilters;
22
+ register(cardType: string, component: CardComponent): void;
23
+ /**
24
+ * 按 map 批量注册(模块 clientModule.cards 形态;key 即 cardType)。
25
+ * 幂等:重复注册同一 cardType 告警并覆盖(组装端多次 registerAll 安全)。
26
+ */
27
+ registerMap(map: Record<string, CardComponent>): void;
28
+ /**
29
+ * 聊天视图覆盖注册(组合层):同 cardType 覆盖原始注册在聊天流的渲染;
30
+ * 原始注册不受影响(RawCardRenderer/详情弹层仍取原始形态)。
31
+ * 幂等:重复覆盖告警并覆盖(组装端多次 registerAll 安全)。
32
+ */
33
+ registerOverride(cardType: string, component: CardComponent): void;
34
+ getOverrides(): Record<string, CardComponent>;
35
+ /** 内联流过滤注册(域浮层自持卡的剥离声明;复合序 = 注册序)。 */
36
+ registerInlineFilter(filter: InlineCardFilter): void;
37
+ /** 内联流过滤复合(无注册 → 恒等返回原数组引用)。 */
38
+ applyInlineFilters(cards: readonly TboxCardPayload[]): TboxCardPayload[];
39
+ resolve(cardType: string): CardComponent | undefined;
40
+ getAll(): Record<string, CardComponent>;
41
+ has(cardType: string): boolean;
42
+ get size(): number;
43
+ }
44
+ /**
45
+ * ClientSlotRegistry:客户端槽位注册表(slotId → 槽值,无状态)。
46
+ * 模块在 clientModule.register(ctx) 内注册(如 mall-core `ctx.slots.register('home', render)`);
47
+ * kit 壳按槽存在性派生应用形态(home 注册 = home-first 主屏;缺席 = chat 流)。
48
+ * 槽 id 词汇 = TIER0 contracts KNOWN_CLIENT_SLOT_IDS(封闭集);未知 id =
49
+ * 版本偏斜信号:warn + 照常注册(前向兼容——老壳消费新模块不炸,resolve 侧自然 miss 降级)。
50
+ */
51
+ declare class ClientSlotRegistry {
52
+ private slots;
53
+ register<K extends ClientSlotId>(slotId: K, value: ClientSlotValueMap[K]): void;
54
+ resolve<K extends ClientSlotId>(slotId: K): ClientSlotValueMap[K] | undefined;
55
+ has(slotId: ClientSlotId): boolean;
56
+ get size(): number;
57
+ }
58
+ /**
59
+ * ClientContext:模块 clientModule.register(ctx) 的上下文(组装端 createClientContext() 创建一次)。
60
+ * cards = 卡片组件注册表;slots = 壳渲染槽注册表(单一模板统一化 :应用形态派生位)。
61
+ */
62
+ interface ClientContext {
63
+ /** 卡片组件注册表(cardType → CardComponent) */
64
+ cards: ClientCardRegistry;
65
+ /** 壳渲染槽注册表(槽 id 契约 = KNOWN_CLIENT_SLOT_IDS) */
66
+ slots: ClientSlotRegistry;
67
+ }
68
+ /**
69
+ * 模块描述对象(客户端):模块包 client 入口 export 的 clientModule。
70
+ *
71
+ * - cards:卡片组件声明 map(key 约定 = cardType;数据 + 类型源,
72
+ * 供 `InferModuleCards` 从装配数组自动推导 app 端 CardType)。
73
+ * - register(ctx):注册期自注册(一期仅 ctx.cards.registerMap(cards))。
74
+ *
75
+ * 与服务端 `ServerModule` 逐行对称;组装端遍历 modules 调 register(ctx)。
76
+ * register 为函数签名声明:method shorthand 经 `satisfies` 检查(TS 方法 bivariance——
77
+ * 放行比契约更窄的参数,运行时无危害;缺字段的过宽参数会被拦截)。
78
+ * cards 为必填属性:无卡片模块写 `cards: {}`(keyof = never,不污染装配类型)。
79
+ */
80
+ interface ClientModule<C extends Record<string, CardComponent> = Record<string, CardComponent>> {
81
+ cards: C;
82
+ register: (ctx: ClientContext) => void | Promise<void>;
83
+ }
84
+ /**
85
+ * 创建客户端上下文(组装端调用一次,apps/client 模块加载期)。
86
+ */
87
+ declare function createClientContext(): ClientContext;
88
+
89
+ interface AppClientModule {
90
+ cards?: Record<string, CardComponent>;
91
+ register: (ctx: ClientContext) => void | Promise<void>;
92
+ }
93
+ declare function getClientContext(): ClientContext;
94
+ declare function registerClientCards(cards: Record<string, CardComponent> | undefined): void;
95
+ /**
96
+ * 注册全部客户端模块。promise 锁而非布尔锁:并发页面 entry 必须等同一次完成,
97
+ * 失败时释放锁允许下一轮(HMR/重试)重新注册。
98
+ */
99
+ declare function registerClientModules(modules: readonly AppClientModule[]): Promise<void>;
100
+ declare function getRegisteredClientCards(): Record<string, CardComponent>;
101
+
102
+ export { type AppClientModule as A, ClientCardRegistry as C, type ClientContext as a, type ClientModule as b, ClientSlotRegistry as c, createClientContext as d, getRegisteredClientCards as e, registerClientModules as f, getClientContext as g, registerClientCards as r };
@@ -0,0 +1 @@
1
+ import{createCoreLogger as S,resolveLevel as x,setLogContextProvider as I}from"@tbox.cn/app-sdk-core";var l=null;I(()=>l??void 0);function _(t){l=t?{requestId:t.runId,conversationId:t.conversationId}:null}function M(){try{if(typeof localStorage<"u")return x(localStorage.getItem("tbox:logLevel")??void 0,"info")}catch{}try{if(typeof location<"u"){let t=new URLSearchParams(location.search).get("logLevel");if(t)return x(t,"info")}}catch{}return"info"}function i(t){return S({tag:t,getLevel:M,getContext:()=>l??void 0})}var h;function j(t){h=t}function D(t){if(typeof window>"u"||typeof window.addEventListener!="function")return()=>{};let e=t??i("GLOBAL"),r=new Map,o=1e4,C=n=>{let s=Date.now();for(let[R,E]of r)s-E>=o&&r.delete(R);r.has(n)||(r.set(n,s),e.error(n),h?.send("error",n))},f=n=>{C(`uncaught: ${n.message} @ ${n.filename}:${n.lineno}`)},m=n=>{let s=n.reason instanceof Error?n.reason.message:String(n.reason);C(`unhandledrejection: ${s}`)};return window.addEventListener("error",f),window.addEventListener("unhandledrejection",m),()=>{window.removeEventListener("error",f),window.removeEventListener("unhandledrejection",m)}}import{Component as P}from"react";var O=i("ErrorBoundary"),w=class extends P{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){O.error("render error:",e)}render(){return this.state.hasError?this.props.fallback:this.props.children}};var v="";function V(t){v=(t.apiBaseUrl??"").trim().replace(/\/$/,"")}function T(){return v}function $(){let t=T();return t||(typeof window<"u"?`${window.location.protocol}//${window.location.host}`:"")}function Q(t="/ws"){return $().replace(/^http/,"ws")+t}var c=null;function k(){if(c)return c;let t={};return typeof window<"u"&&new URLSearchParams(window.location.search).forEach((r,o)=>{t[o]=r}),c=t,t}function F(t){return k()[t]}function N(){let t=F("container");return t==="alipay-miniapp"||t==="alipay"}function G(){if(typeof window>"u")return!1;let t=window.my;return!!(t&&typeof t.postMessage=="function")}function q(){return N()?"alipay-miniapp":"browser"}import{KNOWN_CLIENT_SLOT_IDS as A}from"@tbox.cn/app-contracts";var a=i("ClientCardRegistry"),y=i("ClientSlotRegistry"),p=class{cards=new Map;overrides=new Map;inlineFilters=[];register(e,r){if(!e){a.warn("register without cardType skipped");return}this.cards.get(e)!==r&&(this.cards.has(e)&&a.warn(`overwriting existing cardType: ${e}`),this.cards.set(e,r))}registerMap(e){for(let[r,o]of Object.entries(e))this.register(r,o)}registerOverride(e,r){if(!e){a.warn("registerOverride without cardType skipped");return}this.overrides.has(e)&&a.warn(`overwriting existing override: ${e}`),this.overrides.set(e,r)}getOverrides(){return Object.fromEntries(this.overrides)}registerInlineFilter(e){this.inlineFilters.push(e)}applyInlineFilters(e){return this.inlineFilters.length===0?[...e]:this.inlineFilters.reduce((r,o)=>o(r),[...e])}resolve(e){return this.cards.get(e)}getAll(){return Object.fromEntries(this.cards)}has(e){return this.cards.has(e)}get size(){return this.cards.size}},u=class{slots=new Map;register(e,r){A.includes(e)||y.warn(`unknown slot id: ${e}(KNOWN_CLIENT_SLOT_IDS 未含——版本偏斜?照常注册)`),this.slots.has(e)&&y.warn(`overwriting existing slot: ${e}`),this.slots.set(e,r)}resolve(e){return this.slots.get(e)}has(e){return this.slots.has(e)}get size(){return this.slots.size}};function L(){return{cards:new p,slots:new u}}var b,g;function d(){return b??=L(),b}function ee(t){t&&d().cards.registerMap(t)}function te(t){return g??=(async()=>{for(let e of t)e.cards&&d().cards.registerMap(e.cards),await e.register(d())})().catch(e=>{throw g=void 0,e}),g}function re(){return d().cards.getAll()}export{_ as a,i as b,j as c,D as d,w as e,V as f,T as g,$ as h,Q as i,k as j,F as k,N as l,G as m,q as n,p as o,u as p,L as q,d as r,ee as s,te as t,re as u};
@@ -2,7 +2,8 @@ import { TboxLogger } from '@tbox.cn/app-sdk-core';
2
2
  export { InferModuleCards, LogContext, LogLevel, TboxLogger, createLogger, detailForLog, sanitizeForLog, truncateForLog } from '@tbox.cn/app-sdk-core';
3
3
  import * as React from 'react';
4
4
  import React__default, { ReactNode, CSSProperties, Component } from 'react';
5
- import { TboxCardPayload, CardComponent, UiAction, ClientSlotId, ClientSlotValueMap } from '@tbox.cn/app-contracts';
5
+ import { TboxCardPayload, CardComponent, UiAction } from '@tbox.cn/app-contracts';
6
+ export { A as AppClientModule, C as ClientCardRegistry, a as ClientContext, b as ClientModule, c as ClientSlotRegistry, d as createClientContext, g as getClientContext, e as getRegisteredClientCards, r as registerClientCards, f as registerClientModules } from '../app-module-dEGAU6l2.js';
6
7
 
7
8
  /**
8
9
  * 客户端日志壳:client run 上下文(req/conv 尾缀)+ 全局错误兜底 + transport 扩展点(上报预留)。
@@ -52,7 +53,7 @@ declare function CardCarousel({ cards, renderItem, className, }: {
52
53
 
53
54
  /**
54
55
  * 卡片渲染基元(封顶 5 件——新增须走提案)。
55
- * 模块卡片组件唯一可消费的 SDK 视觉基元:仅依赖 `--tbox-*` CSS 变量 + antd-mobile,
56
+ * 模块卡片组件唯一可消费的 SDK 视觉基元:仅依赖 `--tbox-*` CSS 变量与 Tailwind 工具类,
56
57
  * 零业务样式。token 未定义时回退内置默认值(本地预览可用)。
57
58
  */
58
59
 
@@ -64,6 +65,8 @@ declare function CardCarousel({ cards, renderItem, className, }: {
64
65
  type CardComponentWithFlag = CardComponent & {
65
66
  /** 置位后 CardRenderer 不渲染 payload.actions 按钮条(卡内自行处理动作) */
66
67
  selfRendersActions?: boolean;
68
+ /** 动作所有权来源(defineCard 写入;default 表示未显式声明) */
69
+ actionsMode?: 'default' | 'auto' | 'self';
67
70
  };
68
71
  /**
69
72
  * 标记卡片为自渲染动作(富卡范式:卡内写按钮 + 交互状态,禁用 SDK 默认按钮条)。
@@ -247,92 +250,6 @@ declare function closePlateKeyboard(): Promise<{
247
250
  closed: boolean;
248
251
  }>;
249
252
 
250
- /** 内联流过滤器(域注册;复合序 = 注册序) */
251
- type InlineCardFilter = (cards: readonly TboxCardPayload[]) => TboxCardPayload[];
252
- /**
253
- * ClientCardRegistry:客户端卡片组件注册表(cardType → CardComponent,无状态)。
254
- * 模块在 clientModule.register(ctx) 内 ctx.cards.registerMap(map) 注册组件。
255
- * 与 server 端 CardRegistry 对称:server 注册数据契约(CardMeta),client 注册渲染组件。
256
- *
257
- * 三通道(单一模板统一化):
258
- * - 原始注册(registerMap):模块自有卡组件(RawCardRenderer 消费面);
259
- * - 覆盖注册(registerOverride):聊天视图组合层覆盖(同 cardType 包装/替换——原始视图不受影响,
260
- * 域模块包自持防嵌套语义,如 mall-core 包装 alipay-activity 的联单卡);
261
- * - 内联过滤(registerInlineFilter):域声明哪些卡不进内联流(由域浮层自持;多域按注册序复合)。
262
- * 应用组装端读取:`{...ctx.cards.getAll(), ...ctx.cards.getOverrides()}` 为聊天视图注册表;
263
- * `ctx.cards.applyInlineFilters` 为 ChatPage filterInlineCards 注入值。
264
- */
265
- declare class ClientCardRegistry {
266
- private cards;
267
- private overrides;
268
- private inlineFilters;
269
- register(cardType: string, component: CardComponent): void;
270
- /**
271
- * 按 map 批量注册(模块 clientModule.cards 形态;key 即 cardType)。
272
- * 幂等:重复注册同一 cardType 告警并覆盖(组装端多次 registerAll 安全)。
273
- */
274
- registerMap(map: Record<string, CardComponent>): void;
275
- /**
276
- * 聊天视图覆盖注册(组合层):同 cardType 覆盖原始注册在聊天流的渲染;
277
- * 原始注册不受影响(RawCardRenderer/详情弹层仍取原始形态)。
278
- * 幂等:重复覆盖告警并覆盖(组装端多次 registerAll 安全)。
279
- */
280
- registerOverride(cardType: string, component: CardComponent): void;
281
- getOverrides(): Record<string, CardComponent>;
282
- /** 内联流过滤注册(域浮层自持卡的剥离声明;复合序 = 注册序)。 */
283
- registerInlineFilter(filter: InlineCardFilter): void;
284
- /** 内联流过滤复合(无注册 → 恒等返回原数组引用)。 */
285
- applyInlineFilters(cards: readonly TboxCardPayload[]): TboxCardPayload[];
286
- resolve(cardType: string): CardComponent | undefined;
287
- getAll(): Record<string, CardComponent>;
288
- has(cardType: string): boolean;
289
- get size(): number;
290
- }
291
- /**
292
- * ClientSlotRegistry:客户端槽位注册表(slotId → 槽值,无状态)。
293
- * 模块在 clientModule.register(ctx) 内注册(如 mall-core `ctx.slots.register('home', render)`);
294
- * kit 壳按槽存在性派生应用形态(home 注册 = home-first 主屏;缺席 = chat 流)。
295
- * 槽 id 词汇 = TIER0 contracts KNOWN_CLIENT_SLOT_IDS(封闭集);未知 id =
296
- * 版本偏斜信号:warn + 照常注册(前向兼容——老壳消费新模块不炸,resolve 侧自然 miss 降级)。
297
- */
298
- declare class ClientSlotRegistry {
299
- private slots;
300
- register<K extends ClientSlotId>(slotId: K, value: ClientSlotValueMap[K]): void;
301
- resolve<K extends ClientSlotId>(slotId: K): ClientSlotValueMap[K] | undefined;
302
- has(slotId: ClientSlotId): boolean;
303
- get size(): number;
304
- }
305
- /**
306
- * ClientContext:模块 clientModule.register(ctx) 的上下文(组装端 createClientContext() 创建一次)。
307
- * cards = 卡片组件注册表;slots = 壳渲染槽注册表(单一模板统一化 :应用形态派生位)。
308
- */
309
- interface ClientContext {
310
- /** 卡片组件注册表(cardType → CardComponent) */
311
- cards: ClientCardRegistry;
312
- /** 壳渲染槽注册表(槽 id 契约 = KNOWN_CLIENT_SLOT_IDS) */
313
- slots: ClientSlotRegistry;
314
- }
315
- /**
316
- * 模块描述对象(客户端):模块包 client 入口 export 的 clientModule。
317
- *
318
- * - cards:卡片组件声明 map(key 约定 = cardType;数据 + 类型源,
319
- * 供 `InferModuleCards` 从装配数组自动推导 app 端 CardType)。
320
- * - register(ctx):注册期自注册(一期仅 ctx.cards.registerMap(cards))。
321
- *
322
- * 与服务端 `ServerModule` 逐行对称;组装端遍历 modules 调 register(ctx)。
323
- * register 为函数签名声明:method shorthand 经 `satisfies` 检查(TS 方法 bivariance——
324
- * 放行比契约更窄的参数,运行时无危害;缺字段的过宽参数会被拦截)。
325
- * cards 为必填属性:无卡片模块写 `cards: {}`(keyof = never,不污染装配类型)。
326
- */
327
- interface ClientModule<C extends Record<string, CardComponent> = Record<string, CardComponent>> {
328
- cards: C;
329
- register: (ctx: ClientContext) => void | Promise<void>;
330
- }
331
- /**
332
- * 创建客户端上下文(组装端调用一次,apps/client 模块加载期)。
333
- */
334
- declare function createClientContext(): ClientContext;
335
-
336
253
  /**
337
254
  * 运行环境识别 + API/WS 地址推导 + 启动参数读取(client 平台轴)。
338
255
  *
@@ -476,19 +393,6 @@ interface UseRequestResult<T, Input> {
476
393
  }
477
394
  declare function useRequest<T, Input = void>(fn: (input: Input) => Promise<T>, deps?: readonly unknown[], options?: UseRequestOptions): UseRequestResult<T, Input>;
478
395
 
479
- interface AppClientModule {
480
- cards?: Record<string, CardComponent>;
481
- register: (ctx: ClientContext) => void | Promise<void>;
482
- }
483
- declare function getClientContext(): ClientContext;
484
- declare function registerClientCards(cards: Record<string, CardComponent> | undefined): void;
485
- /**
486
- * 注册全部客户端模块。promise 锁而非布尔锁:并发页面 entry 必须等同一次完成,
487
- * 失败时释放锁允许下一轮(HMR/重试)重新注册。
488
- */
489
- declare function registerClientModules(modules: readonly AppClientModule[]): Promise<void>;
490
- declare function getRegisteredClientCards(): Record<string, CardComponent>;
491
-
492
396
  interface PageMeta {
493
397
  title: string;
494
398
  meta?: Record<string, unknown>;
@@ -511,4 +415,4 @@ interface AlipayWebViewMy {
511
415
  */
512
416
  declare function ensureAlipayJSSDK(): Promise<AlipayWebViewMy | null>;
513
417
 
514
- export { type AlipayNavigation, type AlipayWebViewMy, type AppClientModule, BRIDGE_NAME, BRIDGE_VERSION, type BridgeMediaFile, type BridgeReceipt, type BridgeRequest, CardCarousel, type CardComponentWithFlag, CardFrame, CardRenderer, ClientCardRegistry, type ClientContext, type ClientLogTransport, type ClientModule, ClientSlotRegistry, type CreateServiceOptions, ErrorBoundary, type HttpResult, type JsapiMode, type LoginGateReceipt, MY_ACTION, MY_CALL_ACTION, type PageMeta, type PlateKeyboardOptions, type PlateKeyboardResult, type Query, type QueryValue, RequestError, type RequestOptions, type RuntimeContainer, type ServiceClient, StatusPill, type StatusPillTone, TBOX_ACTION, type UseRequestOptions, type UseRequestResult, ValueText, callCapability, callJsapi, chooseImage, chooseVideo, closePlateKeyboard, configureAuthErrorHandler, configureAuthToken, configureRequestAuth, configureRuntime, createClientContext, createClientLogger, createService, defaultService, ensureAlipayJSSDK, getApiBaseUrl, getApiOrigin, getAuthCode, getClientContext, getContainer, getLocation, getLoginState, getQueryParam, getRegisteredClientCards, getRuntimeQuery, getWsUrl, hasAlipayBridge, httpGet, httpPost, httpPostBinary, installGlobalErrorReporting, isBridgeReceipt, isInAlipayShell, markSelfRendering, navigateToAlipayPage, openPlateKeyboard, registerClientCards, registerClientModules, request, requestPayment, resolveAlipayNavigation, setClientLogTransport, setClientRunContext, useRequest };
418
+ export { type AlipayNavigation, type AlipayWebViewMy, BRIDGE_NAME, BRIDGE_VERSION, type BridgeMediaFile, type BridgeReceipt, type BridgeRequest, CardCarousel, type CardComponentWithFlag, CardFrame, CardRenderer, type ClientLogTransport, type CreateServiceOptions, ErrorBoundary, type HttpResult, type JsapiMode, type LoginGateReceipt, MY_ACTION, MY_CALL_ACTION, type PageMeta, type PlateKeyboardOptions, type PlateKeyboardResult, type Query, type QueryValue, RequestError, type RequestOptions, type RuntimeContainer, type ServiceClient, StatusPill, type StatusPillTone, TBOX_ACTION, type UseRequestOptions, type UseRequestResult, ValueText, callCapability, callJsapi, chooseImage, chooseVideo, closePlateKeyboard, configureAuthErrorHandler, configureAuthToken, configureRequestAuth, configureRuntime, createClientLogger, createService, defaultService, ensureAlipayJSSDK, getApiBaseUrl, getApiOrigin, getAuthCode, getContainer, getLocation, getLoginState, getQueryParam, getRuntimeQuery, getWsUrl, hasAlipayBridge, httpGet, httpPost, httpPostBinary, installGlobalErrorReporting, isBridgeReceipt, isInAlipayShell, markSelfRendering, navigateToAlipayPage, openPlateKeyboard, request, requestPayment, resolveAlipayNavigation, setClientLogTransport, setClientRunContext, useRequest };
@@ -1 +1 @@
1
- import{createLogger as mr}from"@tbox.cn/app-sdk-core";import{createCoreLogger as Le,resolveLevel as ae,setLogContextProvider as Oe}from"@tbox.cn/app-sdk-core";var W=null;Oe(()=>W??void 0);function Me(e){W=e?{requestId:e.runId,conversationId:e.conversationId}:null}function qe(){try{if(typeof localStorage<"u")return ae(localStorage.getItem("tbox:logLevel")??void 0,"info")}catch{}try{if(typeof location<"u"){let e=new URLSearchParams(location.search).get("logLevel");if(e)return ae(e,"info")}}catch{}return"info"}function f(e){return Le({tag:e,getLevel:qe,getContext:()=>W??void 0})}var le;function Be(e){le=e}function Ne(e){if(typeof window>"u"||typeof window.addEventListener!="function")return()=>{};let t=e??f("GLOBAL"),r=new Map,n=1e4,a=d=>{let o=Date.now();for(let[p,u]of r)o-u>=n&&r.delete(p);r.has(d)||(r.set(d,o),t.error(d),le?.send("error",d))},s=d=>{a(`uncaught: ${d.message} @ ${d.filename}:${d.lineno}`)},l=d=>{let o=d.reason instanceof Error?d.reason.message:String(d.reason);a(`unhandledrejection: ${o}`)};return window.addEventListener("error",s),window.addEventListener("unhandledrejection",l),()=>{window.removeEventListener("error",s),window.removeEventListener("unhandledrejection",l)}}import{Component as $e}from"react";var _e=f("ErrorBoundary"),A=class extends $e{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){_e.error("render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};import{jsx as h,jsxs as We}from"react/jsx-runtime";var L={info:{bg:"rgba(22,119,255,0.08)",color:"#1677ff"},warning:{bg:"rgba(250,140,22,0.10)",color:"#d46b08"},error:{bg:"rgba(255,77,79,0.08)",color:"#ff4d4f"}};function De({notices:e}){return e.length?h("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8},children:e.map(t=>h("div",{style:{fontSize:12,lineHeight:"18px",padding:"4px 10px",borderRadius:8,background:L[t.level]?.bg??L.info.bg,color:L[t.level]?.color??L.info.color},children:t.message},`${t.code}:${t.message}`))}):null}function Ue({card:e,registry:t,onAction:r}){let n=e.status!=="error"?t[e.cardType]:void 0,a=e.status==="error"||!n,s=n?.selfRendersActions===!0,l=!e.isHistory&&!s&&e.actions?.length?e.actions:[],d=typeof e.expiresAt=="number"&&Date.now()>=e.expiresAt;return We("div",{className:`tbox-card${a?" tbox-card--fallback":""}${d?" tbox-card--stale":""}`,style:d?{opacity:.55,filter:"grayscale(1)"}:void 0,children:[h(De,{notices:e.notices??[]}),e.status==="error"?`卡片渲染失败${e.error?`:${e.error}`:""}`:n?h(A,{fallback:"卡片渲染出错",children:h(n,{data:e.data,cardId:e.id,isHistory:!!e.isHistory,actionTokens:e.actionTokens})}):`未知卡片类型:${e.cardType}`,l.length>0&&h("div",{style:{display:"flex",gap:8,marginTop:8,flexWrap:"wrap"},children:l.map(o=>{let p=!o.kind||o.kind==="moduleAction",u=p?e.actionTokens?.[o.actionId]:void 0,i=o.enabled===!1,c=i||!r||p&&!u,g=()=>o.kind==="sendMessage"?{type:"sendMessage",value:o.value??o.label??o.actionId,visible:o.visible??!0}:o.kind==="openLink"?{type:"openLink",url:o.url??""}:{type:"moduleAction",actionId:o.actionId,contextToken:u??""},y=()=>o.style==="primary"?{fontSize:13,padding:"6px 14px",borderRadius:18,border:"1px solid var(--tbox-primary, #1677ff)",color:"#fff",background:"var(--tbox-primary, #1677ff)"}:o.style==="link"?{fontSize:13,padding:"6px 4px",borderRadius:4,border:"none",color:"var(--tbox-primary, #1677ff)",background:"transparent",textDecoration:"underline"}:{fontSize:13,padding:"6px 14px",borderRadius:18,border:"1px solid var(--tbox-primary, #1677ff)",color:"var(--tbox-primary, #1677ff)",background:"transparent"};return h("button",{type:"button",disabled:c,title:i?o.disabledReason:void 0,onClick:()=>!c&&r?.(g()),style:{...y(),cursor:c?"not-allowed":"pointer",opacity:c?.5:1},children:o.label??o.actionId},o.actionId)})})]})}import{Fragment as Fe,jsx as H}from"react/jsx-runtime";function He({cards:e,renderItem:t,className:r}){if(e.length<=1)return H(Fe,{children:e.length===1?t(e[0]):null});let n=["tbox-card-stack",r].filter(Boolean).join(" ");return H("div",{className:n,style:{display:"flex",flexDirection:"column"},children:e.map(a=>H("div",{children:t(a)},a.id))})}import{jsx as P,jsxs as F}from"react/jsx-runtime";var R=(e,t)=>`var(--${e}, ${t})`;function Ve(e){return e.selfRendersActions=!0,e}function Ge(e){return F("div",{style:{borderRadius:12,background:R("tbox-card-bg","#ffffff"),padding:"12px 16px",boxShadow:`0 1px 4px ${R("tbox-shadow","rgba(0,0,0,0.06)")}`,...e.style},children:[(e.title||e.subtitle)&&F("div",{style:{marginBottom:8},children:[e.title&&P("div",{style:{fontSize:15,fontWeight:600,color:R("tbox-text-primary","#1a1a1a"),lineHeight:"20px"},children:e.title}),e.subtitle&&P("div",{style:{fontSize:12,color:R("tbox-text-secondary","#888888"),marginTop:2},children:e.subtitle})]}),e.children]})}function Ke(e){return F("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 0",gap:12},children:[P("span",{style:{fontSize:13,color:R("tbox-text-secondary","#888888"),flexShrink:0},children:e.label}),P("span",{style:{fontSize:13,color:R("tbox-text-primary","#1a1a1a"),textAlign:"right",wordBreak:"break-all",...e.valueStyle},children:e.value})]})}var Je={success:{fg:"#0f8a5f",bg:"#e6f7f0"},warning:{fg:"#b26a00",bg:"#fff4e0"},neutral:{fg:"#666666",bg:"#f2f3f5"}};function ze(e){let t=Je[e.tone];return P("span",{style:{display:"inline-block",fontSize:11,lineHeight:"18px",padding:"0 8px",borderRadius:9,color:t.fg,background:t.bg,whiteSpace:"nowrap"},children:e.text})}var de="";function je(e){de=(e.apiBaseUrl??"").trim().replace(/\/$/,"")}function w(){return de}function ue(){let e=w();return e||(typeof window<"u"?`${window.location.protocol}//${window.location.host}`:"")}function Qe(e="/ws"){return ue().replace(/^http/,"ws")+e}var V=null;function ce(){if(V)return V;let e={};return typeof window<"u"&&new URLSearchParams(window.location.search).forEach((r,n)=>{e[n]=r}),V=e,e}function pe(e){return ce()[e]}function O(){let e=pe("container");return e==="alipay-miniapp"||e==="alipay"}function Ye(){if(typeof window>"u")return!1;let e=window.my;return!!(e&&typeof e.postMessage=="function")}function Xe(){return O()?"alipay-miniapp":"browser"}var ge=f("bridge"),G="https://appx/web-view.min.js",T=null;function fe(){return typeof window>"u"?null:window.my&&typeof window.my.postMessage=="function"?window.my:null}function K(){if(typeof window>"u")return Promise.resolve(null);let e=fe();return e?Promise.resolve(e):O()?T||(T=new Promise(t=>{let r=!1,n=null,a=null,s=()=>{n&&clearInterval(n),a&&clearTimeout(a),document.removeEventListener("AlipayJSBridgeReady",d)},l=p=>{r||(r=!0,s(),t(p))},d=()=>{let p=fe();p&&l(p)};document.addEventListener("AlipayJSBridgeReady",d);let o=document.querySelector(`script[src="${G}"]`);o||(o=document.createElement("script"),o.src=G,document.head.appendChild(o)),o.addEventListener("load",d,{once:!0}),o.addEventListener("error",()=>{ge.warn("加载支付宝 JSSDK 失败:",G),o?.remove(),l(null)},{once:!0}),n=setInterval(d,50),a=setTimeout(()=>{ge.warn("支付宝 JSSDK 已加载,但 my.postMessage 未就绪"),l(null)},5e3),d()}),T.then(t=>{t||(T=null)}),T):Promise.resolve(null)}import{detailForLog as Q}from"@tbox.cn/app-sdk-core";var M="open-mini-webview-bridge",Ze="1.0.0",J="my",z="my.call",j="tbox";function q(e){return!!e&&typeof e=="object"&&e.bridge===M&&typeof e.requestId=="string"}var v=f("bridge"),B=new Map,ye=0,me=!1,Ce=300*1e3;function et(){return ye+=1,`h5_${Date.now()}_${ye}`}function tt(e){if(q(e)){xe(e);return}let t=e,r=e;if(r&&typeof r=="object"&&(r.detail!==void 0?t=r.detail:r.data!==void 0&&(t=r.data)),typeof t=="string")try{t=JSON.parse(t)}catch{return}q(t)&&xe(t)}function xe(e){let t=B.get(e.requestId);if(!t){v.debug(`收到无 pending 回执 req=${e.requestId} action=${e.action}`);return}clearTimeout(t.timer),B.delete(e.requestId);let r=Date.now()-t.startedAt;e.success?(v.info(`← ${t.apiName} ok ${r}ms req=${e.requestId}`),t.resolve(e.data)):(v.warn(`← ${t.apiName} fail code=${e.code||"BRIDGE_ERROR"} ${r}ms params=${Q(t.params)} req=${e.requestId}`),t.reject({code:e.code||"BRIDGE_ERROR",errorMessage:e.errorMessage||"桥调用失败"}))}async function be(){let e=await K();return e&&!me&&(e.onMessage=tt,me=!0),e}function he(e,t,r,n,a){let s=et();return new Promise((l,d)=>{let o=setTimeout(()=>{B.delete(s),v.warn(`← ${r} fail code=BRIDGE_TIMEOUT ${a}ms params=${Q(n)} req=${s}`),d({code:"BRIDGE_TIMEOUT",errorMessage:`桥调用超时: ${r}`})},a);B.set(s,{resolve:l,reject:d,timer:o,apiName:r,params:n,startedAt:Date.now()}),v.info(`→ ${t} ${r} req=${s}`),v.debug(`params=${Q(n)} req=${s}`),e.postMessage({bridge:M,action:t,apiName:r,params:n,requestId:s})})}async function m(e,t={},r="invoke",n=Ce){let a=await be();if(!a)throw{code:"BRIDGE_UNAVAILABLE",errorMessage:"支付宝 WebView 桥未就绪"};return he(a,r==="call"?z:"my",e,t,n)}async function S(e,t={},r=Ce){let n=await be();if(!n)throw{code:"BRIDGE_UNAVAILABLE",errorMessage:"支付宝 WebView 桥未就绪"};return he(n,j,e,t,r)}var X=/^[A-Za-z0-9._-]{1,80}$/u,Re=/[\u0000-\u001F\u007F]/u,we=/^[A-Za-z][A-Za-z0-9+.-]*:/u;function rt(e,t){if(!t||!X.test(t))return;let r;try{r=Te(e)}catch{return}if(r.protocol!=="alipays"&&r.protocol!=="alipayrisk"||r.host!=="platformapi"||r.path!=="/startapp")return;let n=(r.appId||r.query.appId||"").trim(),a=(r.query.page||"").trim(),s=(r.query.query||"").trim()||void 0,l=a.replace(/^\/+/,"");if(!(!X.test(n)||!l||Re.test(l)||we.test(l)||l.split("/").includes(".."))){if(n===t){let d=l.includes("?")?"&":"?";return{apiName:"navigateTo",params:{url:`/${l}${s?`${d}${s}`:""}`}}}return{apiName:"navigateToMiniProgram",params:{appId:n,path:l,...s?{query:s}:{}}}}}function Y(e){try{return decodeURIComponent(e)}catch{return e}}function Te(e){if(!e||typeof e!="string")throw new Error("Invalid URL");let t={protocol:"",host:"",path:"",query:{page:"",appId:""},appId:"",page:{path:"",query:{}}},r=e.match(/^([a-zA-Z]+):\/\//),n=e;r&&(t.protocol=r[1],n=n.slice(r[0].length));let a=n.indexOf("?"),s=a===-1?n:n.slice(0,a),l=a===-1?"":n.slice(a+1),d=s.indexOf("/");if(d>0?(t.host=s.slice(0,d),t.path=s.slice(d)):t.host=s,l){let o="",p={};for(let u of l.split("&")){if(u.startsWith("page=")){o=u.slice(5);continue}let i=u.indexOf("="),c=i>=0?u.slice(0,i):u;if(!c)continue;let g=i>=0?u.slice(i+1):"";p[c]=Y(g)}if(t.query=p,o){t.query.page=Y(o),t.query.appId&&(t.appId=t.query.appId);let u=o.indexOf("?"),i=u>=0?o.slice(0,u):o;t.page.path=Y(i)}}return t}function ve(e){if(typeof e!="string")return;let t;try{t=Te(e)}catch{return}if(t.protocol!=="alipays"&&t.protocol!=="alipayrisk"||t.host!=="platformapi"||t.path!=="/startapp")return;let r=(t.appId||t.query.appId||"").trim(),n=(t.query.page||"").trim(),a=(t.query.query||"").trim()||void 0,s=n.replace(/^\/+/,"");if(!X.test(r)||!s||Re.test(s)||we.test(s)||s.split("/").includes(".."))return;let l=s.includes("?")?"&":"?";return{appId:r,url:`/${s}${a?`${l}${a}`:""}`}}function nt(e=9,t){return m("chooseImage",t?{count:e,sourceType:t}:{count:e},"invoke")}function ot(){return m("chooseVideo",{},"invoke")}async function it(){let e=await m("getLocation",{type:0});return{...e,longitude:Number(e.longitude),latitude:Number(e.latitude)}}function st(e=["auth_base"]){return m("getAuthCode",{scopes:e})}function at(e){return m("tradePay",{tradeNO:e,orderStr:e})}function lt(e){let t=ve(e);return t?m("navigateTo",{url:t.url}):Promise.reject({code:"INVALID_PARAMS",errorMessage:"支付宝小程序跳转链接无效"})}function dt(e,t=300*1e3){return S("getLoginState",e??{},t)}function ut(e={}){return S("openPlateKeyboard",{...e})}function ct(){return S("closePlateKeyboard")}import{KNOWN_CLIENT_SLOT_IDS as pt}from"@tbox.cn/app-contracts";var N=f("ClientCardRegistry"),Ae=f("ClientSlotRegistry"),$=class{cards=new Map;overrides=new Map;inlineFilters=[];register(t,r){if(!t){N.warn("register without cardType skipped");return}this.cards.has(t)&&N.warn(`overwriting existing cardType: ${t}`),this.cards.set(t,r)}registerMap(t){for(let[r,n]of Object.entries(t))this.register(r,n)}registerOverride(t,r){if(!t){N.warn("registerOverride without cardType skipped");return}this.overrides.has(t)&&N.warn(`overwriting existing override: ${t}`),this.overrides.set(t,r)}getOverrides(){return Object.fromEntries(this.overrides)}registerInlineFilter(t){this.inlineFilters.push(t)}applyInlineFilters(t){return this.inlineFilters.length===0?[...t]:this.inlineFilters.reduce((r,n)=>n(r),[...t])}resolve(t){return this.cards.get(t)}getAll(){return Object.fromEntries(this.cards)}has(t){return this.cards.has(t)}get size(){return this.cards.size}},_=class{slots=new Map;register(t,r){pt.includes(t)||Ae.warn(`unknown slot id: ${t}(KNOWN_CLIENT_SLOT_IDS 未含——版本偏斜?照常注册)`),this.slots.has(t)&&Ae.warn(`overwriting existing slot: ${t}`),this.slots.set(t,r)}resolve(t){return this.slots.get(t)}has(t){return this.slots.has(t)}get size(){return this.slots.size}};function Z(){return{cards:new $,slots:new _}}var x=class extends Error{status;code;body;constructor(t,r,n,a){super(n),this.name="RequestError",this.status=t,this.code=r,this.body=a}},ee=null,te=null;function D(e){e.getToken&&(ee=e.getToken),e.refresh&&(te=e.refresh)}function gt(e,t){if(!t)return e;let r=new URLSearchParams;for(let[a,s]of Object.entries(t))if(s!=null)if(Array.isArray(s))for(let l of s)l!=null&&r.append(a,String(l));else r.append(a,String(s));let n=r.toString();return n?`${e}${e.includes("?")?"&":"?"}${n}`:e}function ft(e){return/^https?:\/\//.test(e)?e:`${w().replace(/\/$/,"")}${e.startsWith("/")?e:`/${e}`}`}async function yt(e,t){if(e.status===204)return;if(t==="response")return e;if(t==="text")return e.text();let r=await e.text();if(r)try{return JSON.parse(r)}catch{return r}}async function mt(e,t={}){let r=t.method??"GET";if((r==="GET"||r==="DELETE")&&t.body!==void 0)throw new x(0,"REQUEST_BODY_NOT_ALLOWED",`${r} 请求不能携带 body`);let n={...t.headers},a=t.body===void 0?void 0:JSON.stringify(t.body);a!==void 0&&!n["Content-Type"]&&(n["Content-Type"]="application/json");let s=t.auth??!0;if(s&&ee){let i=ee();i&&!n.Authorization&&(n.Authorization=`Bearer ${i}`)}let l=new AbortController,d=t.timeoutMs??3e4,o=d>0?setTimeout(()=>l.abort(new Error("REQUEST_TIMEOUT")),d):void 0,p=()=>l.abort(t.signal?.reason);t.signal?.addEventListener("abort",p,{once:!0});let u=async()=>fetch(gt(ft(e),t.query),{method:r,headers:n,body:a,signal:l.signal,credentials:s?"include":"same-origin",cache:t.cache});try{let i=await u();if(i.status===401&&s&&te){try{await te()}catch{}i=await u()}let c=t.responseType??"json",g=await yt(i,c);if(!i.ok){let y=g&&typeof g=="object"?g.error:void 0;throw new x(i.status,y?.code??`HTTP_${i.status}`,y?.message??`请求失败(HTTP ${i.status})`,g)}return g}catch(i){throw i instanceof x?i:i.name==="AbortError"?new x(0,"REQUEST_ABORTED","请求已取消",i):new x(0,"REQUEST_FAILED",i.message,i)}finally{o&&clearTimeout(o),t.signal?.removeEventListener("abort",p)}}var xt=f("HTTP"),re=null;function Ct(e){re=e,D({getToken:e})}var ne=null;function bt(e){ne=e,D({refresh:e})}function ht(e,t){if(e!==401)return!1;let r=t?.code;return r==="AUTH_UNAUTHORIZED"||r==="AUTH_TOKEN_EXPIRED"}function Rt(e){return e.startsWith("/api/auth/")}function Pe(e="",t,r={}){let n=e.replace(/\/$/,""),a=r.auth??!1,s=r.dynamicBase??!1,l=u=>({...t?.headers,...u?.headers});function d(){return s?w():n}function o(u){let i=l(u);if(a){let c=re?re():null;c&&!i.Authorization&&(i.Authorization=`Bearer ${c}`)}return i}async function p(u,i,c,g,y=0){let I=u==="POST"&&c instanceof Blob?o(g):u==="POST"?{"Content-Type":"application/json",...o(g)}:o(g),C=await fetch(d()+i,{method:u,headers:I,body:u==="POST"&&c!==void 0?c instanceof Blob?c:JSON.stringify(c):void 0,signal:g?.signal,cache:g?.cache}),b=await C.json().catch(()=>null);if(a&&y===0&&!Rt(i)&&ht(C.status,b)&&ne){try{await ne()}catch(Ie){xt.warn("401 refresh failed:",Ie.message)}return p(u,i,c,g,1)}return{status:C.status,data:b}}return{get:(u,i)=>p("GET",u,void 0,i),post:(u,i,c)=>p("POST",u,i,c),postBinary:(u,i,c)=>p("POST",u,i,c)}}var U=Pe("",void 0,{auth:!0,dynamicBase:!0}),wt=U.get,Tt=U.post,vt=U.postBinary;import{useCallback as Se,useEffect as Ee,useRef as E,useState as oe}from"react";function At(e,t=[],r={}){let[n,a]=oe(void 0),[s,l]=oe(void 0),[d,o]=oe(!1),p=E(void 0),u=E(!1),i=E(!0),c=E(0),g=E(e);g.current=e,Ee(()=>(i.current=!0,()=>{i.current=!1,c.current+=1}),[]);let y=Se(async I=>{p.current=I,u.current=!0;let C=++c.current;o(!0),l(void 0);try{let b=await g.current(I);return i.current&&c.current===C&&a(b),b}catch(b){i.current&&c.current===C&&l(b);return}finally{i.current&&c.current===C&&o(!1)}},[]),se=Se(async()=>{if(u.current)return y(p.current)},[y]);return Ee(()=>{r.immediate===!1||u.current||y(void 0)},t),{data:n,error:s,loading:d,run:y,refresh:se}}var ke,ie;function k(){return ke??=Z(),ke}function Pt(e){e&&k().cards.registerMap(e)}function St(e){return ie??=(async()=>{for(let t of e)t.cards&&k().cards.registerMap(t.cards),await t.register(k())})().catch(t=>{throw ie=void 0,t}),ie}function Et(){return k().cards.getAll()}import{sanitizeForLog as Br,detailForLog as Nr,truncateForLog as $r}from"@tbox.cn/app-sdk-core";export{M as BRIDGE_NAME,Ze as BRIDGE_VERSION,He as CardCarousel,Ge as CardFrame,Ue as CardRenderer,$ as ClientCardRegistry,_ as ClientSlotRegistry,A as ErrorBoundary,J as MY_ACTION,z as MY_CALL_ACTION,x as RequestError,ze as StatusPill,j as TBOX_ACTION,Ke as ValueText,S as callCapability,m as callJsapi,nt as chooseImage,ot as chooseVideo,ct as closePlateKeyboard,bt as configureAuthErrorHandler,Ct as configureAuthToken,D as configureRequestAuth,je as configureRuntime,Z as createClientContext,f as createClientLogger,mr as createLogger,Pe as createService,U as defaultService,Nr as detailForLog,K as ensureAlipayJSSDK,w as getApiBaseUrl,ue as getApiOrigin,st as getAuthCode,k as getClientContext,Xe as getContainer,it as getLocation,dt as getLoginState,pe as getQueryParam,Et as getRegisteredClientCards,ce as getRuntimeQuery,Qe as getWsUrl,Ye as hasAlipayBridge,wt as httpGet,Tt as httpPost,vt as httpPostBinary,Ne as installGlobalErrorReporting,q as isBridgeReceipt,O as isInAlipayShell,Ve as markSelfRendering,lt as navigateToAlipayPage,ut as openPlateKeyboard,Pt as registerClientCards,St as registerClientModules,mt as request,at as requestPayment,rt as resolveAlipayNavigation,Br as sanitizeForLog,Be as setClientLogTransport,Me as setClientRunContext,$r as truncateForLog,At as useRequest};
1
+ import{a as me,b as h,c as be,d as xe,e as N,f as he,g as A,h as Te,i as Re,j as ve,k as we,l as L,m as Ae,n as Ce,o as Pe,p as Se,q as Ee,r as ke,s as Ie,t as qe,u as Oe}from"../chunk-S3Y64FNZ.js";import{createLogger as Ft}from"@tbox.cn/app-sdk-core";import{jsx as T,jsxs as Ne}from"react/jsx-runtime";var Z=new Set,k={info:{bg:"color-mix(in srgb, var(--tbox-primary, #1677ff) 8%, var(--tbox-bg-card, #ffffff))",color:"var(--tbox-primary, #1677ff)"},warning:{bg:"color-mix(in srgb, var(--tbox-warning, #fa8c16) 12%, var(--tbox-bg-card, #ffffff))",color:"var(--tbox-warning, #d46b08)"},error:{bg:"color-mix(in srgb, var(--tbox-error, #ff4d4f) 8%, var(--tbox-bg-card, #ffffff))",color:"var(--tbox-error, #ff4d4f)"}};function Be({notices:e}){return e.length?T("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8},children:e.map(t=>T("div",{style:{fontSize:12,lineHeight:"18px",padding:"4px 10px",borderRadius:8,background:k[t.level]?.bg??k.info.bg,color:k[t.level]?.color??k.info.color},children:t.message},`${t.code}:${t.message}`))}):null}function Me({card:e,registry:t,onAction:r}){let n=e.status!=="error"?t[e.cardType]:void 0,s=e.status==="error"||!n,a=n?.selfRendersActions===!0,u=!e.isHistory&&!a&&e.actions?.length?e.actions:[];u.length>0&&n?.actionsMode==="default"&&globalThis.process?.env?.NODE_ENV==="development"&&!Z.has(e.cardType)&&(Z.add(e.cardType),console.warn('[tbox] 卡片 "'+e.cardType+`" 未显式声明动作所有权,按 SDK 默认条渲染;若卡内已用 ActionList,请写 defineCard({ type, actions: 'self' }),否则会出现两条动作。`));let c=typeof e.expiresAt=="number"&&Date.now()>=e.expiresAt;return Ne("div",{className:`tbox-card${s?" tbox-card--fallback":""}${c?" tbox-card--stale":""}`,style:c?{opacity:.55}:void 0,children:[T(Be,{notices:e.notices??[]}),e.status==="error"?`卡片渲染失败${e.error?`:${e.error}`:""}`:n?T(N,{fallback:"卡片渲染出错",children:T(n,{data:e.data,cardId:e.id,isHistory:!!e.isHistory,actionTokens:e.actionTokens})}):`未知卡片类型:${e.cardType}`,u.length>0&&T("div",{style:{display:"flex",gap:8,marginTop:8,flexWrap:"wrap"},children:u.map(i=>{let p=!i.kind||i.kind==="moduleAction",l=p?e.actionTokens?.[i.actionId]:void 0,o=i.enabled===!1,d=o||!r||p&&!l,f=()=>i.kind==="sendMessage"?{type:"sendMessage",value:i.value??i.label??i.actionId,visible:i.visible??!0}:i.kind==="openLink"?{type:"openLink",url:i.url??""}:{type:"moduleAction",actionId:i.actionId,contextToken:l??""},g=()=>i.style==="primary"?{fontSize:14,minHeight:44,padding:"0 18px",borderRadius:22,border:"1px solid var(--tbox-primary, #1677ff)",color:"var(--tbox-primary-foreground, #fff)",background:"var(--tbox-primary, #1677ff)",cursor:d?"not-allowed":"pointer"}:i.style==="link"?{fontSize:14,minHeight:44,padding:"0 4px",borderRadius:4,border:"none",color:"var(--tbox-primary, #1677ff)",background:"transparent",textDecoration:"underline"}:{fontSize:13,padding:"6px 14px",borderRadius:18,border:"1px solid var(--tbox-primary, #1677ff)",color:"var(--tbox-primary, #1677ff)",background:"transparent"};return T("button",{type:"button",disabled:d,title:o?i.disabledReason:void 0,onClick:()=>!d&&r?.(f()),style:{...g(),cursor:d?"not-allowed":"pointer",opacity:d?.5:1},children:i.label??i.actionId},i.actionId)})})]})}import{Fragment as _e,jsx as _}from"react/jsx-runtime";function Le({cards:e,renderItem:t,className:r}){if(e.length<=1)return _(_e,{children:e.length===1?t(e[0]):null});let n=["tbox-card-stack",r].filter(Boolean).join(" ");return _("div",{className:n,style:{display:"flex",flexDirection:"column"},children:e.map(s=>_("div",{children:t(s)},s.id))})}import{jsx as C,jsxs as $}from"react/jsx-runtime";var R=(e,t)=>`var(--${e}, ${t})`;function $e(e){return e.selfRendersActions=!0,e}function De(e){return $("div",{style:{borderRadius:12,background:R("tbox-card-bg","#ffffff"),padding:"12px 16px",boxShadow:`0 1px 4px ${R("tbox-shadow","rgba(0,0,0,0.06)")}`,...e.style},children:[(e.title||e.subtitle)&&$("div",{style:{marginBottom:8},children:[e.title&&C("div",{style:{fontSize:15,fontWeight:600,color:R("tbox-text-primary","#1a1a1a"),lineHeight:"20px"},children:e.title}),e.subtitle&&C("div",{style:{fontSize:12,color:R("tbox-text-secondary","#888888"),marginTop:2},children:e.subtitle})]}),e.children]})}function He(e){return $("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 0",gap:12},children:[C("span",{style:{fontSize:13,color:R("tbox-text-secondary","#888888"),flexShrink:0},children:e.label}),C("span",{style:{fontSize:13,color:R("tbox-text-primary","#1a1a1a"),textAlign:"right",wordBreak:"break-all",...e.valueStyle},children:e.value})]})}var Ue={success:{fg:"#0f8a5f",bg:"#e6f7f0"},warning:{fg:"#b26a00",bg:"#fff4e0"},neutral:{fg:"#666666",bg:"#f2f3f5"}};function Ve(e){let t=Ue[e.tone];return C("span",{style:{display:"inline-block",fontSize:11,lineHeight:"18px",padding:"0 8px",borderRadius:9,color:t.fg,background:t.bg,whiteSpace:"nowrap"},children:e.text})}var ee=h("bridge"),D="https://appx/web-view.min.js",v=null;function te(){return typeof window>"u"?null:window.my&&typeof window.my.postMessage=="function"?window.my:null}function H(){if(typeof window>"u")return Promise.resolve(null);let e=te();return e?Promise.resolve(e):L()?v||(v=new Promise(t=>{let r=!1,n=null,s=null,a=()=>{n&&clearInterval(n),s&&clearTimeout(s),document.removeEventListener("AlipayJSBridgeReady",c)},u=p=>{r||(r=!0,a(),t(p))},c=()=>{let p=te();p&&u(p)};document.addEventListener("AlipayJSBridgeReady",c);let i=document.querySelector(`script[src="${D}"]`);i||(i=document.createElement("script"),i.src=D,document.head.appendChild(i)),i.addEventListener("load",c,{once:!0}),i.addEventListener("error",()=>{ee.warn("加载支付宝 JSSDK 失败:",D),i?.remove(),u(null)},{once:!0}),n=setInterval(c,50),s=setTimeout(()=>{ee.warn("支付宝 JSSDK 已加载,但 my.postMessage 未就绪"),u(null)},5e3),c()}),v.then(t=>{t||(v=null)}),v):Promise.resolve(null)}import{detailForLog as W}from"@tbox.cn/app-sdk-core";var I="open-mini-webview-bridge",Ge="1.0.0",U="my",V="my.call",G="tbox";function q(e){return!!e&&typeof e=="object"&&e.bridge===I&&typeof e.requestId=="string"}var w=h("bridge"),O=new Map,re=0,ne=!1,ie=300*1e3;function We(){return re+=1,`h5_${Date.now()}_${re}`}function Fe(e){if(q(e)){oe(e);return}let t=e,r=e;if(r&&typeof r=="object"&&(r.detail!==void 0?t=r.detail:r.data!==void 0&&(t=r.data)),typeof t=="string")try{t=JSON.parse(t)}catch{return}q(t)&&oe(t)}function oe(e){let t=O.get(e.requestId);if(!t){w.debug(`收到无 pending 回执 req=${e.requestId} action=${e.action}`);return}clearTimeout(t.timer),O.delete(e.requestId);let r=Date.now()-t.startedAt;e.success?(w.info(`← ${t.apiName} ok ${r}ms req=${e.requestId}`),t.resolve(e.data)):(w.warn(`← ${t.apiName} fail code=${e.code||"BRIDGE_ERROR"} ${r}ms params=${W(t.params)} req=${e.requestId}`),t.reject({code:e.code||"BRIDGE_ERROR",errorMessage:e.errorMessage||"桥调用失败"}))}async function ae(){let e=await H();return e&&!ne&&(e.onMessage=Fe,ne=!0),e}function se(e,t,r,n,s){let a=We();return new Promise((u,c)=>{let i=setTimeout(()=>{O.delete(a),w.warn(`← ${r} fail code=BRIDGE_TIMEOUT ${s}ms params=${W(n)} req=${a}`),c({code:"BRIDGE_TIMEOUT",errorMessage:`桥调用超时: ${r}`})},s);O.set(a,{resolve:u,reject:c,timer:i,apiName:r,params:n,startedAt:Date.now()}),w.info(`→ ${t} ${r} req=${a}`),w.debug(`params=${W(n)} req=${a}`),e.postMessage({bridge:I,action:t,apiName:r,params:n,requestId:a})})}async function y(e,t={},r="invoke",n=ie){let s=await ae();if(!s)throw{code:"BRIDGE_UNAVAILABLE",errorMessage:"支付宝 WebView 桥未就绪"};return se(s,r==="call"?V:"my",e,t,n)}async function P(e,t={},r=ie){let n=await ae();if(!n)throw{code:"BRIDGE_UNAVAILABLE",errorMessage:"支付宝 WebView 桥未就绪"};return se(n,G,e,t,r)}var J=/^[A-Za-z0-9._-]{1,80}$/u,ue=/[\u0000-\u001F\u007F]/u,le=/^[A-Za-z][A-Za-z0-9+.-]*:/u;function Je(e,t){if(!t||!J.test(t))return;let r;try{r=de(e)}catch{return}if(r.protocol!=="alipays"&&r.protocol!=="alipayrisk"||r.host!=="platformapi"||r.path!=="/startapp")return;let n=(r.appId||r.query.appId||"").trim(),s=(r.query.page||"").trim(),a=(r.query.query||"").trim()||void 0,u=s.replace(/^\/+/,"");if(!(!J.test(n)||!u||ue.test(u)||le.test(u)||u.split("/").includes(".."))){if(n===t){let c=u.includes("?")?"&":"?";return{apiName:"navigateTo",params:{url:`/${u}${a?`${c}${a}`:""}`}}}return{apiName:"navigateToMiniProgram",params:{appId:n,path:u,...a?{query:a}:{}}}}}function F(e){try{return decodeURIComponent(e)}catch{return e}}function de(e){if(!e||typeof e!="string")throw new Error("Invalid URL");let t={protocol:"",host:"",path:"",query:{page:"",appId:""},appId:"",page:{path:"",query:{}}},r=e.match(/^([a-zA-Z]+):\/\//),n=e;r&&(t.protocol=r[1],n=n.slice(r[0].length));let s=n.indexOf("?"),a=s===-1?n:n.slice(0,s),u=s===-1?"":n.slice(s+1),c=a.indexOf("/");if(c>0?(t.host=a.slice(0,c),t.path=a.slice(c)):t.host=a,u){let i="",p={};for(let l of u.split("&")){if(l.startsWith("page=")){i=l.slice(5);continue}let o=l.indexOf("="),d=o>=0?l.slice(0,o):l;if(!d)continue;let f=o>=0?l.slice(o+1):"";p[d]=F(f)}if(t.query=p,i){t.query.page=F(i),t.query.appId&&(t.appId=t.query.appId);let l=i.indexOf("?"),o=l>=0?i.slice(0,l):i;t.page.path=F(o)}}return t}function ce(e){if(typeof e!="string")return;let t;try{t=de(e)}catch{return}if(t.protocol!=="alipays"&&t.protocol!=="alipayrisk"||t.host!=="platformapi"||t.path!=="/startapp")return;let r=(t.appId||t.query.appId||"").trim(),n=(t.query.page||"").trim(),s=(t.query.query||"").trim()||void 0,a=n.replace(/^\/+/,"");if(!J.test(r)||!a||ue.test(a)||le.test(a)||a.split("/").includes(".."))return;let u=a.includes("?")?"&":"?";return{appId:r,url:`/${a}${s?`${u}${s}`:""}`}}function Ke(e=9,t){return y("chooseImage",t?{count:e,sourceType:t}:{count:e},"invoke")}function ze(){return y("chooseVideo",{},"invoke")}async function Qe(){let e=await y("getLocation",{type:0});return{...e,longitude:Number(e.longitude),latitude:Number(e.latitude)}}function je(e=["auth_base"]){return y("getAuthCode",{scopes:e})}function Ye(e){return y("tradePay",{tradeNO:e,orderStr:e})}function Xe(e){let t=ce(e);return t?y("navigateTo",{url:t.url}):Promise.reject({code:"INVALID_PARAMS",errorMessage:"支付宝小程序跳转链接无效"})}function Ze(e,t=300*1e3){return P("getLoginState",e??{},t)}function et(e={}){return P("openPlateKeyboard",{...e})}function tt(){return P("closePlateKeyboard")}var m=class extends Error{status;code;body;constructor(t,r,n,s){super(n),this.name="RequestError",this.status=t,this.code=r,this.body=s}},K=null,z=null;function B(e){e.getToken&&(K=e.getToken),e.refresh&&(z=e.refresh)}function rt(e,t){if(!t)return e;let r=new URLSearchParams;for(let[s,a]of Object.entries(t))if(a!=null)if(Array.isArray(a))for(let u of a)u!=null&&r.append(s,String(u));else r.append(s,String(a));let n=r.toString();return n?`${e}${e.includes("?")?"&":"?"}${n}`:e}function nt(e){return/^https?:\/\//.test(e)?e:`${A().replace(/\/$/,"")}${e.startsWith("/")?e:`/${e}`}`}async function ot(e,t){if(e.status===204)return;if(t==="response")return e;if(t==="text")return e.text();let r=await e.text();if(r)try{return JSON.parse(r)}catch{return r}}async function it(e,t={}){let r=t.method??"GET";if((r==="GET"||r==="DELETE")&&t.body!==void 0)throw new m(0,"REQUEST_BODY_NOT_ALLOWED",`${r} 请求不能携带 body`);let n={...t.headers},s=t.body===void 0?void 0:JSON.stringify(t.body);s!==void 0&&!n["Content-Type"]&&(n["Content-Type"]="application/json");let a=t.auth??!0;if(a&&K){let o=K();o&&!n.Authorization&&(n.Authorization=`Bearer ${o}`)}let u=new AbortController,c=t.timeoutMs??3e4,i=c>0?setTimeout(()=>u.abort(new Error("REQUEST_TIMEOUT")),c):void 0,p=()=>u.abort(t.signal?.reason);t.signal?.addEventListener("abort",p,{once:!0});let l=async()=>fetch(rt(nt(e),t.query),{method:r,headers:n,body:s,signal:u.signal,credentials:a?"include":"same-origin",cache:t.cache});try{let o=await l();if(o.status===401&&a&&z){try{await z()}catch{}o=await l()}let d=t.responseType??"json",f=await ot(o,d);if(!o.ok){let g=f&&typeof f=="object"?f.error:void 0;throw new m(o.status,g?.code??`HTTP_${o.status}`,g?.message??`请求失败(HTTP ${o.status})`,f)}return f}catch(o){throw o instanceof m?o:o.name==="AbortError"?new m(0,"REQUEST_ABORTED","请求已取消",o):new m(0,"REQUEST_FAILED",o.message,o)}finally{i&&clearTimeout(i),t.signal?.removeEventListener("abort",p)}}var at=h("HTTP"),Q=null;function st(e){Q=e,B({getToken:e})}var j=null;function ut(e){j=e,B({refresh:e})}function lt(e,t){if(e!==401)return!1;let r=t?.code;return r==="AUTH_UNAUTHORIZED"||r==="AUTH_TOKEN_EXPIRED"}function dt(e){return e.startsWith("/api/auth/")}function pe(e="",t,r={}){let n=e.replace(/\/$/,""),s=r.auth??!1,a=r.dynamicBase??!1,u=l=>({...t?.headers,...l?.headers});function c(){return a?A():n}function i(l){let o=u(l);if(s){let d=Q?Q():null;d&&!o.Authorization&&(o.Authorization=`Bearer ${d}`)}return o}async function p(l,o,d,f,g=0){let E=l==="POST"&&d instanceof Blob?i(f):l==="POST"?{"Content-Type":"application/json",...i(f)}:i(f),b=await fetch(c()+o,{method:l,headers:E,body:l==="POST"&&d!==void 0?d instanceof Blob?d:JSON.stringify(d):void 0,signal:f?.signal,cache:f?.cache}),x=await b.json().catch(()=>null);if(s&&g===0&&!dt(o)&&lt(b.status,x)&&j){try{await j()}catch(ye){at.warn("401 refresh failed:",ye.message)}return p(l,o,d,f,1)}return{status:b.status,data:x}}return{get:(l,o)=>p("GET",l,void 0,o),post:(l,o,d)=>p("POST",l,o,d),postBinary:(l,o,d)=>p("POST",l,o,d)}}var M=pe("",void 0,{auth:!0,dynamicBase:!0}),ct=M.get,pt=M.post,ft=M.postBinary;import{useCallback as fe,useEffect as ge,useRef as S,useState as Y}from"react";function gt(e,t=[],r={}){let[n,s]=Y(void 0),[a,u]=Y(void 0),[c,i]=Y(!1),p=S(void 0),l=S(!1),o=S(!0),d=S(0),f=S(e);f.current=e,ge(()=>(o.current=!0,()=>{o.current=!1,d.current+=1}),[]);let g=fe(async E=>{p.current=E,l.current=!0;let b=++d.current;i(!0),u(void 0);try{let x=await f.current(E);return o.current&&d.current===b&&s(x),x}catch(x){o.current&&d.current===b&&u(x);return}finally{o.current&&d.current===b&&i(!1)}},[]),X=fe(async()=>{if(l.current)return g(p.current)},[g]);return ge(()=>{r.immediate===!1||l.current||g(void 0)},t),{data:n,error:a,loading:c,run:g,refresh:X}}import{sanitizeForLog as dr,detailForLog as cr,truncateForLog as pr}from"@tbox.cn/app-sdk-core";export{I as BRIDGE_NAME,Ge as BRIDGE_VERSION,Le as CardCarousel,De as CardFrame,Me as CardRenderer,Pe as ClientCardRegistry,Se as ClientSlotRegistry,N as ErrorBoundary,U as MY_ACTION,V as MY_CALL_ACTION,m as RequestError,Ve as StatusPill,G as TBOX_ACTION,He as ValueText,P as callCapability,y as callJsapi,Ke as chooseImage,ze as chooseVideo,tt as closePlateKeyboard,ut as configureAuthErrorHandler,st as configureAuthToken,B as configureRequestAuth,he as configureRuntime,Ee as createClientContext,h as createClientLogger,Ft as createLogger,pe as createService,M as defaultService,cr as detailForLog,H as ensureAlipayJSSDK,A as getApiBaseUrl,Te as getApiOrigin,je as getAuthCode,ke as getClientContext,Ce as getContainer,Qe as getLocation,Ze as getLoginState,we as getQueryParam,Oe as getRegisteredClientCards,ve as getRuntimeQuery,Re as getWsUrl,Ae as hasAlipayBridge,ct as httpGet,pt as httpPost,ft as httpPostBinary,xe as installGlobalErrorReporting,q as isBridgeReceipt,L as isInAlipayShell,$e as markSelfRendering,Xe as navigateToAlipayPage,et as openPlateKeyboard,Ie as registerClientCards,qe as registerClientModules,it as request,Ye as requestPayment,Je as resolveAlipayNavigation,dr as sanitizeForLog,be as setClientLogTransport,me as setClientRunContext,pr as truncateForLog,gt as useRequest};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-sdk-client",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.11",
4
4
  "type": "module",
5
5
  "description": "tbox 应用平台 SDK client 轴:runtime/http/logger/error-boundary、桥接(支付宝 web-view)、client-context、卡片渲染基元。agent 前端运行时在 @tbox.cn/app-agent-sdk-client。",
6
6
  "exports": {
@@ -12,6 +12,10 @@
12
12
  "types": "./dist/client/index.d.ts",
13
13
  "import": "./dist/client/index.js"
14
14
  },
15
+ "./app": {
16
+ "types": "./dist/app/index.d.ts",
17
+ "import": "./dist/app/index.js"
18
+ },
15
19
  "./platform/code-inspect": {
16
20
  "types": "./platform/code-inspect.d.cts",
17
21
  "default": "./platform/code-inspect.cjs"
@@ -30,10 +34,10 @@
30
34
  "access": "public"
31
35
  },
32
36
  "dependencies": {
33
- "@tbox.cn/app-contracts": "1.0.0-alpha.1",
34
- "@tbox.cn/app-sdk-core": "1.0.0-alpha.1",
35
37
  "react": "18.3.1",
36
- "react-dom": "18.3.1"
38
+ "react-dom": "18.3.1",
39
+ "@tbox.cn/app-sdk-core": "1.0.0-alpha.11",
40
+ "@tbox.cn/app-contracts": "1.0.0-alpha.11"
37
41
  },
38
42
  "devDependencies": {
39
43
  "@types/node": "24.13.3",