@tbox.cn/app-contracts 0.13.1 → 0.13.3

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/cards.d.ts CHANGED
@@ -39,11 +39,16 @@ export interface CardMeta<TSchema extends ZodTypeAny = ZodTypeAny> {
39
39
  /** 卡片数据契约版本(一期启用;缺省视为 1) */
40
40
  schemaVersion?: number;
41
41
  /**
42
- * 不出卡标记(additive,缺席合法):当前不在任何出卡链路(工具暂停/下线、流水改文本事实等)。
43
- * - 仅影响 dev 卡片预览目录(/_tbox/api/cards 默认过滤,?includeHidden=true 可见并携带徽标);
44
- * - 注册态完整(dataSchema/动作/渲染器照常)——非 CardRegistry.disable(provider 能力边界,
45
- * 物理不注册、破坏 doctor 一致性);与 CardAction.hidden(动作不进按钮条)语义无关;
46
- * - 标记原因须写明类型:暂停型(工具恢复时移除标记)或永久型(注明决策出处)。
42
+ * 预览隐藏标记(additive,缺席合法):dev 卡片预览目录默认过滤。
43
+ * 两类用途——
44
+ * - 不出卡事实标记:当前不在任何出卡链路(工具暂停/下线、流水改文本事实等),
45
+ * 须写明类型:暂停型(工具恢复时移除标记)或永久型(注明决策出处);
46
+ * - 降噪型:活跃出卡卡的预览策展排除(2026-10-19 裁决,member/parking 五卡首用)——
47
+ * 出卡链路照常,meta 注释须写明降噪型与裁决日期。
48
+ * - 共同边界:仅影响 dev 卡片预览目录(/_tbox/api/cards 默认过滤,?includeHidden=true 可见并携带徽标;
49
+ * 徽标不区分上述两类);注册态完整(dataSchema/动作/渲染器照常)——非 CardRegistry.disable
50
+ * (provider 能力边界,物理不注册、破坏 doctor 一致性);与 CardAction.hidden
51
+ * (动作不进按钮条)语义无关。
47
52
  */
48
53
  hidden?: boolean;
49
54
  /**
@@ -1,3 +1,432 @@
1
+ /**
2
+ * Integrations 配置解析(integrations v6:模块所有权模型 + 绑定组整组继承 + catalog 派生 +
3
+ * 部署实例注册表)。zod 单源纯函数:三模板 I/O 壳共用(base/mall 壳展开占位后传入;support 壳
4
+ * 无展开通道直传)。断言顺序固定:assertNoInlineSecrets(防线单点)→ zod strict(拼错键启动即报)
5
+ * ——与既有 loader 链序一致(展开归调用方壳层,本函数只管 断言 → 校验)。
6
+ * 绑定组语义:implementation 需伴随 provider(impl-only 非法——provider 是绑定组头);
7
+ * 内联厂商声明仅槽级且必带 implementation(内联无派生源)。
8
+ * v4 部署实例注册表:instances 非空数组(无表 = 键缺席唯一写法);id 查重 + 禁 '*';
9
+ * defaultInstanceId ∈ ids(无表时独立在场 = env 注入动态默认形态,免 ∈ 校验)。
10
+ * v6:modules 节 = 模块集成位三键 {provider?, config?, resources?}(归属模型——service →
11
+ * owner 归属表由装配期 buildOwnershipMap 注入,本文件只管形状);顶层 domains 键退役
12
+ * (legacy 防线拒收 + migrate 指引)。
13
+ */
14
+ import { z } from 'zod';
1
15
  import type { IntegrationsConfig } from './providers';
16
+ /** integrations.json 根形状(唯一 ByInstance 层 = root 四字段;v4 实例注册表;v6 modules 集成位)。
17
+ * 元键($comment/$schema):类型可选、行为惰性——供 CLI/文档写入 schema 指针;求值路径零消费,
18
+ * 根级 `$comment` 子树不参与机密形态检查(注释里的普通词不误触 boot;嵌套 `$comment` 照常扫描)。
19
+ * 其他文件(strictObject 的 agent.jsonc / 外部插件面)不种入元键——避免 fail-soft 静默回退或外部包拒收。 */
20
+ export declare const integrationsSchema: z.ZodEffects<z.ZodObject<{
21
+ $comment: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
22
+ $schema: z.ZodOptional<z.ZodString>;
23
+ provider: z.ZodOptional<z.ZodString>;
24
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
25
+ configByInstance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
26
+ credentialRef: z.ZodOptional<z.ZodString>;
27
+ credentialRefByInstance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
28
+ instances: z.ZodOptional<z.ZodArray<z.ZodObject<{
29
+ id: z.ZodString;
30
+ name: z.ZodString;
31
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
32
+ }, "strict", z.ZodTypeAny, {
33
+ name: string;
34
+ id: string;
35
+ attributes?: Record<string, unknown> | undefined;
36
+ }, {
37
+ name: string;
38
+ id: string;
39
+ attributes?: Record<string, unknown> | undefined;
40
+ }>, "many">>;
41
+ defaultInstanceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
+ modules: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
43
+ provider: z.ZodOptional<z.ZodString>;
44
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
45
+ resources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
46
+ type: z.ZodLiteral<"knowledge">;
47
+ datasetId: z.ZodOptional<z.ZodString>;
48
+ ref: z.ZodOptional<z.ZodString>;
49
+ topK: z.ZodOptional<z.ZodNumber>;
50
+ scoreThreshold: z.ZodOptional<z.ZodNumber>;
51
+ }, "strict", z.ZodTypeAny, {
52
+ type: "knowledge";
53
+ topK?: number | undefined;
54
+ datasetId?: string | undefined;
55
+ ref?: string | undefined;
56
+ scoreThreshold?: number | undefined;
57
+ }, {
58
+ type: "knowledge";
59
+ topK?: number | undefined;
60
+ datasetId?: string | undefined;
61
+ ref?: string | undefined;
62
+ scoreThreshold?: number | undefined;
63
+ }>]>, {
64
+ type: "knowledge";
65
+ topK?: number | undefined;
66
+ datasetId?: string | undefined;
67
+ ref?: string | undefined;
68
+ scoreThreshold?: number | undefined;
69
+ }, {
70
+ type: "knowledge";
71
+ topK?: number | undefined;
72
+ datasetId?: string | undefined;
73
+ ref?: string | undefined;
74
+ scoreThreshold?: number | undefined;
75
+ }>>>;
76
+ }, "strict", z.ZodTypeAny, {
77
+ provider?: string | undefined;
78
+ config?: Record<string, unknown> | undefined;
79
+ resources?: Record<string, {
80
+ type: "knowledge";
81
+ topK?: number | undefined;
82
+ datasetId?: string | undefined;
83
+ ref?: string | undefined;
84
+ scoreThreshold?: number | undefined;
85
+ }> | undefined;
86
+ }, {
87
+ provider?: string | undefined;
88
+ config?: Record<string, unknown> | undefined;
89
+ resources?: Record<string, {
90
+ type: "knowledge";
91
+ topK?: number | undefined;
92
+ datasetId?: string | undefined;
93
+ ref?: string | undefined;
94
+ scoreThreshold?: number | undefined;
95
+ }> | undefined;
96
+ }>, {
97
+ provider?: string | undefined;
98
+ config?: Record<string, unknown> | undefined;
99
+ resources?: Record<string, {
100
+ type: "knowledge";
101
+ topK?: number | undefined;
102
+ datasetId?: string | undefined;
103
+ ref?: string | undefined;
104
+ scoreThreshold?: number | undefined;
105
+ }> | undefined;
106
+ }, {
107
+ provider?: string | undefined;
108
+ config?: Record<string, unknown> | undefined;
109
+ resources?: Record<string, {
110
+ type: "knowledge";
111
+ topK?: number | undefined;
112
+ datasetId?: string | undefined;
113
+ ref?: string | undefined;
114
+ scoreThreshold?: number | undefined;
115
+ }> | undefined;
116
+ }>>>;
117
+ services: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodEffects<z.ZodObject<{
118
+ provider: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
119
+ provider: z.ZodString;
120
+ credentialType: z.ZodString;
121
+ configSchema: z.ZodOptional<z.ZodString>;
122
+ }, "strict", z.ZodTypeAny, {
123
+ provider: string;
124
+ credentialType: string;
125
+ configSchema?: string | undefined;
126
+ }, {
127
+ provider: string;
128
+ credentialType: string;
129
+ configSchema?: string | undefined;
130
+ }>]>>;
131
+ implementation: z.ZodOptional<z.ZodString>;
132
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
133
+ credentialRef: z.ZodOptional<z.ZodString>;
134
+ instances: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
135
+ provider: z.ZodOptional<z.ZodString>;
136
+ implementation: z.ZodOptional<z.ZodString>;
137
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
138
+ credentialRef: z.ZodOptional<z.ZodString>;
139
+ enabled: z.ZodOptional<z.ZodBoolean>;
140
+ }, "strict", z.ZodTypeAny, {
141
+ provider?: string | undefined;
142
+ credentialRef?: string | undefined;
143
+ config?: Record<string, unknown> | undefined;
144
+ implementation?: string | undefined;
145
+ enabled?: boolean | undefined;
146
+ }, {
147
+ provider?: string | undefined;
148
+ credentialRef?: string | undefined;
149
+ config?: Record<string, unknown> | undefined;
150
+ implementation?: string | undefined;
151
+ enabled?: boolean | undefined;
152
+ }>, {
153
+ provider?: string | undefined;
154
+ credentialRef?: string | undefined;
155
+ config?: Record<string, unknown> | undefined;
156
+ implementation?: string | undefined;
157
+ enabled?: boolean | undefined;
158
+ }, {
159
+ provider?: string | undefined;
160
+ credentialRef?: string | undefined;
161
+ config?: Record<string, unknown> | undefined;
162
+ implementation?: string | undefined;
163
+ enabled?: boolean | undefined;
164
+ }>>>;
165
+ }, "strict", z.ZodTypeAny, {
166
+ provider?: string | {
167
+ provider: string;
168
+ credentialType: string;
169
+ configSchema?: string | undefined;
170
+ } | undefined;
171
+ credentialRef?: string | undefined;
172
+ instances?: Record<string, {
173
+ provider?: string | undefined;
174
+ credentialRef?: string | undefined;
175
+ config?: Record<string, unknown> | undefined;
176
+ implementation?: string | undefined;
177
+ enabled?: boolean | undefined;
178
+ }> | undefined;
179
+ config?: Record<string, unknown> | undefined;
180
+ implementation?: string | undefined;
181
+ }, {
182
+ provider?: string | {
183
+ provider: string;
184
+ credentialType: string;
185
+ configSchema?: string | undefined;
186
+ } | undefined;
187
+ credentialRef?: string | undefined;
188
+ instances?: Record<string, {
189
+ provider?: string | undefined;
190
+ credentialRef?: string | undefined;
191
+ config?: Record<string, unknown> | undefined;
192
+ implementation?: string | undefined;
193
+ enabled?: boolean | undefined;
194
+ }> | undefined;
195
+ config?: Record<string, unknown> | undefined;
196
+ implementation?: string | undefined;
197
+ }>, {
198
+ provider?: string | {
199
+ provider: string;
200
+ credentialType: string;
201
+ configSchema?: string | undefined;
202
+ } | undefined;
203
+ credentialRef?: string | undefined;
204
+ instances?: Record<string, {
205
+ provider?: string | undefined;
206
+ credentialRef?: string | undefined;
207
+ config?: Record<string, unknown> | undefined;
208
+ implementation?: string | undefined;
209
+ enabled?: boolean | undefined;
210
+ }> | undefined;
211
+ config?: Record<string, unknown> | undefined;
212
+ implementation?: string | undefined;
213
+ }, {
214
+ provider?: string | {
215
+ provider: string;
216
+ credentialType: string;
217
+ configSchema?: string | undefined;
218
+ } | undefined;
219
+ credentialRef?: string | undefined;
220
+ instances?: Record<string, {
221
+ provider?: string | undefined;
222
+ credentialRef?: string | undefined;
223
+ config?: Record<string, unknown> | undefined;
224
+ implementation?: string | undefined;
225
+ enabled?: boolean | undefined;
226
+ }> | undefined;
227
+ config?: Record<string, unknown> | undefined;
228
+ implementation?: string | undefined;
229
+ }>, {
230
+ provider?: string | {
231
+ provider: string;
232
+ credentialType: string;
233
+ configSchema?: string | undefined;
234
+ } | undefined;
235
+ credentialRef?: string | undefined;
236
+ instances?: Record<string, {
237
+ provider?: string | undefined;
238
+ credentialRef?: string | undefined;
239
+ config?: Record<string, unknown> | undefined;
240
+ implementation?: string | undefined;
241
+ enabled?: boolean | undefined;
242
+ }> | undefined;
243
+ config?: Record<string, unknown> | undefined;
244
+ implementation?: string | undefined;
245
+ }, {
246
+ provider?: string | {
247
+ provider: string;
248
+ credentialType: string;
249
+ configSchema?: string | undefined;
250
+ } | undefined;
251
+ credentialRef?: string | undefined;
252
+ instances?: Record<string, {
253
+ provider?: string | undefined;
254
+ credentialRef?: string | undefined;
255
+ config?: Record<string, unknown> | undefined;
256
+ implementation?: string | undefined;
257
+ enabled?: boolean | undefined;
258
+ }> | undefined;
259
+ config?: Record<string, unknown> | undefined;
260
+ implementation?: string | undefined;
261
+ }>>;
262
+ }, "strict", z.ZodTypeAny, {
263
+ services: Record<string, {
264
+ provider?: string | {
265
+ provider: string;
266
+ credentialType: string;
267
+ configSchema?: string | undefined;
268
+ } | undefined;
269
+ credentialRef?: string | undefined;
270
+ instances?: Record<string, {
271
+ provider?: string | undefined;
272
+ credentialRef?: string | undefined;
273
+ config?: Record<string, unknown> | undefined;
274
+ implementation?: string | undefined;
275
+ enabled?: boolean | undefined;
276
+ }> | undefined;
277
+ config?: Record<string, unknown> | undefined;
278
+ implementation?: string | undefined;
279
+ }>;
280
+ provider?: string | undefined;
281
+ credentialRef?: string | undefined;
282
+ instances?: {
283
+ name: string;
284
+ id: string;
285
+ attributes?: Record<string, unknown> | undefined;
286
+ }[] | undefined;
287
+ defaultInstanceId?: string | null | undefined;
288
+ config?: Record<string, unknown> | undefined;
289
+ configByInstance?: Record<string, Record<string, unknown>> | undefined;
290
+ credentialRefByInstance?: Record<string, string> | undefined;
291
+ modules?: Record<string, {
292
+ provider?: string | undefined;
293
+ config?: Record<string, unknown> | undefined;
294
+ resources?: Record<string, {
295
+ type: "knowledge";
296
+ topK?: number | undefined;
297
+ datasetId?: string | undefined;
298
+ ref?: string | undefined;
299
+ scoreThreshold?: number | undefined;
300
+ }> | undefined;
301
+ }> | undefined;
302
+ $comment?: string | Record<string, unknown> | undefined;
303
+ $schema?: string | undefined;
304
+ }, {
305
+ services: Record<string, {
306
+ provider?: string | {
307
+ provider: string;
308
+ credentialType: string;
309
+ configSchema?: string | undefined;
310
+ } | undefined;
311
+ credentialRef?: string | undefined;
312
+ instances?: Record<string, {
313
+ provider?: string | undefined;
314
+ credentialRef?: string | undefined;
315
+ config?: Record<string, unknown> | undefined;
316
+ implementation?: string | undefined;
317
+ enabled?: boolean | undefined;
318
+ }> | undefined;
319
+ config?: Record<string, unknown> | undefined;
320
+ implementation?: string | undefined;
321
+ }>;
322
+ provider?: string | undefined;
323
+ credentialRef?: string | undefined;
324
+ instances?: {
325
+ name: string;
326
+ id: string;
327
+ attributes?: Record<string, unknown> | undefined;
328
+ }[] | undefined;
329
+ defaultInstanceId?: string | null | undefined;
330
+ config?: Record<string, unknown> | undefined;
331
+ configByInstance?: Record<string, Record<string, unknown>> | undefined;
332
+ credentialRefByInstance?: Record<string, string> | undefined;
333
+ modules?: Record<string, {
334
+ provider?: string | undefined;
335
+ config?: Record<string, unknown> | undefined;
336
+ resources?: Record<string, {
337
+ type: "knowledge";
338
+ topK?: number | undefined;
339
+ datasetId?: string | undefined;
340
+ ref?: string | undefined;
341
+ scoreThreshold?: number | undefined;
342
+ }> | undefined;
343
+ }> | undefined;
344
+ $comment?: string | Record<string, unknown> | undefined;
345
+ $schema?: string | undefined;
346
+ }>, {
347
+ services: Record<string, {
348
+ provider?: string | {
349
+ provider: string;
350
+ credentialType: string;
351
+ configSchema?: string | undefined;
352
+ } | undefined;
353
+ credentialRef?: string | undefined;
354
+ instances?: Record<string, {
355
+ provider?: string | undefined;
356
+ credentialRef?: string | undefined;
357
+ config?: Record<string, unknown> | undefined;
358
+ implementation?: string | undefined;
359
+ enabled?: boolean | undefined;
360
+ }> | undefined;
361
+ config?: Record<string, unknown> | undefined;
362
+ implementation?: string | undefined;
363
+ }>;
364
+ provider?: string | undefined;
365
+ credentialRef?: string | undefined;
366
+ instances?: {
367
+ name: string;
368
+ id: string;
369
+ attributes?: Record<string, unknown> | undefined;
370
+ }[] | undefined;
371
+ defaultInstanceId?: string | null | undefined;
372
+ config?: Record<string, unknown> | undefined;
373
+ configByInstance?: Record<string, Record<string, unknown>> | undefined;
374
+ credentialRefByInstance?: Record<string, string> | undefined;
375
+ modules?: Record<string, {
376
+ provider?: string | undefined;
377
+ config?: Record<string, unknown> | undefined;
378
+ resources?: Record<string, {
379
+ type: "knowledge";
380
+ topK?: number | undefined;
381
+ datasetId?: string | undefined;
382
+ ref?: string | undefined;
383
+ scoreThreshold?: number | undefined;
384
+ }> | undefined;
385
+ }> | undefined;
386
+ $comment?: string | Record<string, unknown> | undefined;
387
+ $schema?: string | undefined;
388
+ }, {
389
+ services: Record<string, {
390
+ provider?: string | {
391
+ provider: string;
392
+ credentialType: string;
393
+ configSchema?: string | undefined;
394
+ } | undefined;
395
+ credentialRef?: string | undefined;
396
+ instances?: Record<string, {
397
+ provider?: string | undefined;
398
+ credentialRef?: string | undefined;
399
+ config?: Record<string, unknown> | undefined;
400
+ implementation?: string | undefined;
401
+ enabled?: boolean | undefined;
402
+ }> | undefined;
403
+ config?: Record<string, unknown> | undefined;
404
+ implementation?: string | undefined;
405
+ }>;
406
+ provider?: string | undefined;
407
+ credentialRef?: string | undefined;
408
+ instances?: {
409
+ name: string;
410
+ id: string;
411
+ attributes?: Record<string, unknown> | undefined;
412
+ }[] | undefined;
413
+ defaultInstanceId?: string | null | undefined;
414
+ config?: Record<string, unknown> | undefined;
415
+ configByInstance?: Record<string, Record<string, unknown>> | undefined;
416
+ credentialRefByInstance?: Record<string, string> | undefined;
417
+ modules?: Record<string, {
418
+ provider?: string | undefined;
419
+ config?: Record<string, unknown> | undefined;
420
+ resources?: Record<string, {
421
+ type: "knowledge";
422
+ topK?: number | undefined;
423
+ datasetId?: string | undefined;
424
+ ref?: string | undefined;
425
+ scoreThreshold?: number | undefined;
426
+ }> | undefined;
427
+ }> | undefined;
428
+ $comment?: string | Record<string, unknown> | undefined;
429
+ $schema?: string | undefined;
430
+ }>;
2
431
  /** 断言无内联密钥 → 旧键直切防线 → zod strict 校验(调用方负责占位展开先行) */
3
432
  export declare function parseIntegrationsConfig(raw: unknown): IntegrationsConfig;
package/dist/runtime.d.ts CHANGED
@@ -7,7 +7,7 @@ export { EventType } from '@ag-ui/core';
7
7
  export { TBOX_CARD_EVENT_NAME, TBOX_CARD_UPDATE_EVENT_NAME, TBOX_NOTICE_EVENT_NAME, } from './cards';
8
8
  export { AUTH_ERROR_CODES, authCodeToStatus } from './identity';
9
9
  export { stableSerializeScope, PROVIDER_ERROR_CODES, resolveEffectiveService, WILDCARD_INSTANCE_KEY, moduleDomainOf, buildSupplyLookup, normalizeInstances, isExpectedProviderAbsence, RESOURCE_TYPE_IDS, OWNERSHIP_BINDING_V6, } from './providers';
10
- export { parseIntegrationsConfig } from './integrations-config';
10
+ export { parseIntegrationsConfig, integrationsSchema } from './integrations-config';
11
11
  export { assertNoInlineSecrets } from './no-inline-secrets';
12
12
  export { defineContextSlot } from './context-slot';
13
13
  export * from './skill';
package/dist/runtime.js CHANGED
@@ -200,6 +200,7 @@ function assertNoInlineSecrets(config, path = "$") {
200
200
  }
201
201
  if (config && typeof config === "object") {
202
202
  for (const [k, v] of Object.entries(config)) {
203
+ if (k === "$comment" && path === "$") continue;
203
204
  if (SECRET_KEY_PATTERN.test(k) && !SECRET_KEY_ALLOWLIST.has(k)) {
204
205
  throw new Error(`\u90E8\u7F72\u914D\u7F6E\u542B\u7591\u4F3C\u5185\u8054\u5BC6\u94A5\u5B57\u6BB5\uFF1A${path}.${k}\uFF08\u673A\u5BC6\u53EA\u5141\u8BB8\u7ECF credentialRef \u5F15\u7528\u73AF\u5883\u53D8\u91CF\uFF09`);
205
206
  }
@@ -257,6 +258,8 @@ var moduleConfigSchema = z.strictObject({
257
258
  message: "modules \u8282\u70B9 provider/config/resources \u81F3\u5C11\u5176\u4E00\uFF08\u7A7A\u8282\u70B9\u65E0\u610F\u4E49\u2014\u2014\u5220\u9664\u8BE5\u952E\uFF09"
258
259
  });
259
260
  var integrationsSchema = z.strictObject({
261
+ $comment: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
262
+ $schema: z.string().optional(),
260
263
  provider: z.string().min(1).optional(),
261
264
  config: z.record(z.string(), z.unknown()).optional(),
262
265
  configByInstance: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),
@@ -564,6 +567,7 @@ export {
564
567
  buildSkillToolCallPayload,
565
568
  buildSupplyLookup,
566
569
  defineContextSlot,
570
+ integrationsSchema,
567
571
  isExpectedProviderAbsence,
568
572
  moduleDomainOf,
569
573
  nextKeepaliveAction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-contracts",
3
- "version": "0.13.1",
3
+ "version": "0.13.3",
4
4
  "type": "module",
5
5
  "description": "平台契约(TIER0,types-only 为主 + 协议常量运行时值):卡片协议 / SDK adapter / 平台 DTO。",
6
6
  "exports": {
@@ -283,3 +283,28 @@ describe('assertNoInlineSecrets(011 L2 迁移;自 component-config.test.ts
283
283
  expect(() => assertNoInlineSecrets({ a: [{ b: { password: 'x' } }] })).toThrow(/\.a\[0\]\.b\.password/);
284
284
  });
285
285
  });
286
+
287
+
288
+ describe('元键($comment / $schema)', () => {
289
+ it('字符串形态 $comment 通过', () => {
290
+ expect(() => parseIntegrationsConfig(base({ $comment: '形状: npx --yes @tbox.cn/app-cli schema config/integrations.json' }))).not.toThrow();
291
+ });
292
+
293
+ it('record 形态 $comment 通过(分文件指针)', () => {
294
+ expect(() => parseIntegrationsConfig(base({ $comment: { services: '槽位绑定' } }))).not.toThrow();
295
+ });
296
+
297
+ it('record 形态 $comment 的内部键不参与机密形态检查(行为惰性)', () => {
298
+ expect(() => parseIntegrationsConfig(base({ $comment: { token: '文档章节名', secret: '说明' } }))).not.toThrow();
299
+ });
300
+
301
+ it('嵌套 $comment(节点级——非容忍面)照常参与机密形态检查', () => {
302
+ expect(() => assertNoInlineSecrets({ config: { $comment: { password: 'x' } } })).toThrow(/config\.\$comment\.password/);
303
+ expect(() => assertNoInlineSecrets({ services: { 'mall.info': { $comment: { apiKey: 'x' } } } })).toThrow(/\$comment\.apiKey/);
304
+ });
305
+
306
+ it('$schema 字符串通过;拼错真键仍拒', () => {
307
+ expect(() => parseIntegrationsConfig(base({ $schema: 'https://example.com/schema.json' }))).not.toThrow();
308
+ expect(() => parseIntegrationsConfig(base({ $coment: 'typo' }))).toThrow();
309
+ });
310
+ });