@tbox.cn/app-contracts 0.9.0 → 0.10.0

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.
@@ -0,0 +1,27 @@
1
+ /**
2
+ * 客户端槽位契约(单一模板统一化 W1-②):壳渲染受控扩展点词汇。
3
+ *
4
+ * 应用形态由槽存在性派生(home 槽注册 = home-first 主屏;缺席 = chat 流 + kit 欢迎态)。
5
+ * 槽 id 为 TIER0 封闭集(新槽 = same-change 本文件 + kit/模块消费方 + docs);
6
+ * 槽值 = 渲染函数(域模块自持数据与实现,壳传跨域回调——模块不 import 壳/kit 代码)。
7
+ *
8
+ * 与服务端 context-slot.ts(attributes ContextSlot 协议)无关——同名不同物:
9
+ * 本文件是「客户端渲染槽」,彼处是「服务端 attributes 槽」。
10
+ */
11
+ import type { ReactNode } from 'react';
12
+ /** 槽 id 封闭集(未知 id 注册:SDK runtime warn + 照常注册——版本偏斜前向兼容)。 */
13
+ export declare const KNOWN_CLIENT_SLOT_IDS: readonly ["home"];
14
+ export type ClientSlotId = (typeof KNOWN_CLIENT_SLOT_IDS)[number];
15
+ /** 壳 → home 槽渲染 props(跨域回调由壳提供;域自持数据在模块内解析)。 */
16
+ export interface HomeSlotRenderProps {
17
+ /** 发送文本(占位推荐句/快捷入口 → 壳 send 链) */
18
+ readonly onSend: (text: string) => void;
19
+ /** 品牌名(HelloAck.mallScope.mallName 回显;存在即可渲染——kit ChatHeader 同源约定) */
20
+ readonly mallName?: string;
21
+ }
22
+ /** home 槽值:自持渲染(kit 空态主屏调用;模块提供含数据自持的渲染函数)。 */
23
+ export type HomeSlotValue = (props: HomeSlotRenderProps) => ReactNode;
24
+ /** 槽值映射(id → 值类型;register/resolve 类型收窄单源)。 */
25
+ export interface ClientSlotValueMap {
26
+ home: HomeSlotValue;
27
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 域装配契约(单一模板统一化 W1-③):域模块注册、SDK/装配层惰性查表的域装配单元。
3
+ *
4
+ * 消费点(全部运行期查表,register 顺序无关——registerAll 先于 listen,
5
+ * authExchanges 同款「晚于构造仍生效」先例):
6
+ * - SDK ctx.scopeDefaults 读取视图(scopeDefaults 成员——SDK 唯一直接消费面);
7
+ * - 模板装配点:validateContext / scopeSessions / instanceIdOf 等由域装配消费方
8
+ * 按 TIER1 具体形状(如 contracts-mall 的 MallRuntimeAssembly 组合)resolve 读取。
9
+ *
10
+ * SDK 零域语义:本文件仅声明 kind 词汇与 SDK 消费面形状;域细节在 TIER1/域模块。
11
+ */
12
+ /** 域装配 kind:scope 域装配(首期唯一 kind;新 kind = same-change 本文件 + 消费方)。 */
13
+ export declare const SCOPE_ASSEMBLY_KIND = "scope-assembly";
14
+ /**
15
+ * scope-assembly 的 SDK 消费面形状(ctx.scopeDefaults 视图读取口)。
16
+ * 完整域装配形状(buildScope/validateScope/controlPlane 等)由 TIER1 具体化,
17
+ * 装配点以泛型断言读取——本接口只承载 SDK 直接消费成员。
18
+ */
19
+ export interface ScopeAssemblyContract {
20
+ /** 域默认值(如 defaultMallId)——域模块注册,provider getter 登录期求值读取 */
21
+ readonly scopeDefaults?: Readonly<Record<string, unknown>>;
22
+ }
package/dist/index.d.ts CHANGED
@@ -13,3 +13,5 @@ export * from './no-inline-secrets';
13
13
  export * from './host-effect';
14
14
  export * from './memory';
15
15
  export * from './context-slot';
16
+ export * from './client-slot';
17
+ export * from './domain-assembly';
@@ -181,6 +181,12 @@ export interface DeploymentInstance {
181
181
  /** 域属性袋(TIER0 opaque;TIER1 投影 zod 赋义) */
182
182
  attributes?: Record<string, unknown>;
183
183
  }
184
+ /**
185
+ * provider 实例声明快照(SDK declareProviderInstances 产物 / 域装配惰性融合消费形态):
186
+ * 键 = provider 厂商名;值 = 该 provider 的隐式部署实例(register 期声明;COW——
187
+ * 快照为拷贝并冻结,快照引用变更即「声明发生变化」信号,下游据此失效投影缓存)。
188
+ */
189
+ export type ProviderInstanceDeclarations = Readonly<Record<string, readonly DeploymentInstance[]>>;
184
190
  /** normalizeInstances 产物(模板装配 / CLI doctor / 根脚本共用消费形态) */
185
191
  export interface NormalizedInstances {
186
192
  instances: readonly DeploymentInstance[];
package/dist/runtime.d.ts CHANGED
@@ -16,3 +16,5 @@ export * from './memory';
16
16
  export * from './memory-tool';
17
17
  export { TBOX_EFFECT_EVENT_NAME } from './host-effect';
18
18
  export { KEEPALIVE_MISS_LIMIT, nextKeepaliveAction } from './protocol';
19
+ export { KNOWN_CLIENT_SLOT_IDS } from './client-slot';
20
+ export { SCOPE_ASSEMBLY_KIND } from './domain-assembly';
package/dist/runtime.js CHANGED
@@ -504,10 +504,17 @@ function nextKeepaliveAction(idleMs, intervalMs) {
504
504
  if (idleMs >= intervalMs * KEEPALIVE_MISS_LIMIT) return "dead";
505
505
  return idleMs >= intervalMs ? "ping" : "none";
506
506
  }
507
+
508
+ // src/client-slot.ts
509
+ var KNOWN_CLIENT_SLOT_IDS = ["home"];
510
+
511
+ // src/domain-assembly.ts
512
+ var SCOPE_ASSEMBLY_KIND = "scope-assembly";
507
513
  export {
508
514
  AUTH_ERROR_CODES,
509
515
  EventType2 as EventType,
510
516
  KEEPALIVE_MISS_LIMIT,
517
+ KNOWN_CLIENT_SLOT_IDS,
511
518
  MEMORY_ERROR_CODES,
512
519
  MEMORY_RECORD_PREVIEW_MAX_CHARS,
513
520
  MEMORY_REMINDER_ATTR,
@@ -516,6 +523,7 @@ export {
516
523
  PRE_TOOL_NAME_PATTERN,
517
524
  PROVIDER_ERROR_CODES,
518
525
  RESOURCE_TYPE_IDS,
526
+ SCOPE_ASSEMBLY_KIND,
519
527
  SKILL_NAME_PATTERN,
520
528
  SKILL_TOOL_CALL_NAME,
521
529
  TBOX_CARD_EVENT_NAME,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-contracts",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "平台契约(TIER0,types-only 为主 + 协议常量运行时值):卡片协议 / SDK adapter / 平台 DTO。",
6
6
  "exports": {