@tbox.cn/app-toolkit 0.3.0 → 0.5.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.
Files changed (41) hide show
  1. package/dist/chunk-WUULQDOV.js +1 -0
  2. package/dist/contracts-resolver-PS2UH2G6.js +1 -0
  3. package/dist/index.d.ts +382 -129
  4. package/dist/index.js +9 -8
  5. package/package.json +2 -2
  6. package/src/assembly/provider-catalog.ts +1 -1
  7. package/src/assembly/resolve-key.ts +75 -0
  8. package/src/assembly/walk-manifests.ts +216 -96
  9. package/src/core/contracts-expected.ts +2 -2
  10. package/src/core/contracts-resolver.ts +12 -1
  11. package/src/core/env-expansion.ts +14 -12
  12. package/src/core/module-schema.ts +88 -12
  13. package/src/dto.ts +53 -25
  14. package/src/factory.ts +62 -18
  15. package/src/index.ts +18 -7
  16. package/src/integrations/evaluate-app.ts +41 -0
  17. package/src/integrations/mock-bindings.ts +1 -1
  18. package/src/integrations/module-binding.ts +60 -0
  19. package/src/integrations/predicate-io.ts +26 -5
  20. package/src/integrations/predicate.ts +97 -57
  21. package/src/integrations/prune-bindings.ts +205 -0
  22. package/src/integrations/write.ts +43 -27
  23. package/src/views/app.ts +8 -4
  24. package/src/views/context.ts +26 -7
  25. package/src/views/integration-schemas.ts +61 -17
  26. package/src/views/modules.ts +45 -27
  27. package/src/views/providers.ts +13 -1
  28. package/src/views/service-detail.ts +5 -3
  29. package/src/views/service-resolutions.ts +14 -13
  30. package/tests/credentials-view.test.ts +2 -2
  31. package/tests/demo-app.ts +34 -5
  32. package/tests/dev-manifest-catalog.test.ts +86 -6
  33. package/tests/file-cache.test.ts +5 -5
  34. package/tests/module-schema.test.ts +117 -16
  35. package/tests/resolve-key.test.ts +154 -0
  36. package/tests/vendor-schema-keywords.test.ts +86 -0
  37. package/tests/views.test.ts +425 -139
  38. package/tests/write-core.test.ts +83 -0
  39. package/dist/chunk-KPD3LUH4.js +0 -1
  40. package/dist/contracts-resolver-E4SECBOG.js +0 -1
  41. package/src/integrations/domain-binding.ts +0 -81
package/dist/index.d.ts CHANGED
@@ -1,16 +1,30 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  /**
4
- * tbox.module.json schema v1(001 §3.6 字段名,003 §4.1 schema v1 定版)。
4
+ * tbox.module.json schema v1(001 §3.6 字段名,003 §4.1 schema v1 定版;v6 声明面翻转)。
5
5
  * app-toolkit 单一校验源(自 CLI module-schema.ts 迁入;CLI 经 re-export 消费)。
6
6
  *
7
7
  * 迁移改造(ai-build C2-5):
8
8
  * - resourceNeedContribSchema 的 type 由 `z.enum(RESOURCE_TYPE_IDS)` 放宽为 `z.string()`——
9
9
  * 词汇校验移谓词、经 contracts 动态解析取 RESOURCE_TYPE_IDS(比静态 enum 更忠实应用版本);
10
- * - demand meta additive:serviceNeedContribSchematitle?/description?(服务展示元数据,
10
+ * - demand meta additive:serviceConsumeContribSchemaname?/description?(服务展示元数据,
11
11
  * manifest demand 侧 additive 扩展,catalog 聚合顺带携带——api.md ServiceDemand 对齐);
12
12
  * - 安全钉子(H9b):provider 名与 instance id 进凭据 stem 派生,字符集 pattern
13
13
  * `/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/` 为第一道防线(stem 派生处另有断言防线——纵深防御)。
14
+ *
15
+ * v6 声明面翻转(integrations v6 所有权模型):
16
+ * - `contributes` → `declare`(声明/行为分离——owns/consumes 语义对仗);
17
+ * - `declare.services` → `declare.consumes`(无向"服务" → 消费关系,多对多);
18
+ * - += `declare.owns`:薄数组(strictObject 单键——互斥事实无元数据;元数据恒在
19
+ * consumes 防双数组漂移)。服务归属唯一真源;双 owner = walk OWNERSHIP_CONFLICT;
20
+ * - 旧键 `contributes` / `declare.services`:parseModuleDescriptor 定向检测(N1——
21
+ * 报错含三路径升级指引,拒 loose 静默兜底)。
22
+ *
23
+ * v7 词汇统一(标识/展示名分轴,对齐实例轴 DeploymentInstance {id, name}):
24
+ * - 根键 `name` → `id`(标识键:唯一、寻址);根键 `title` → `name`(展示名:中文、可选);
25
+ * - `declare.consumes[].title` → `name`(demand meta 同步跟随);
26
+ * - 旧键 parseModuleDescriptor 定向检测(legacy? 标志——walk 据此拒 loose 兜底、
27
+ * CLI sync 据此拒装配改写)。
14
28
  */
15
29
  /** 输入字符集(安全钉子①):provider 名 / instanceId 恒经此 pattern(进凭据 stem 派生的输入) */
16
30
  declare const SAFE_NAME_PATTERN: RegExp;
@@ -63,7 +77,7 @@ declare const moduleDependencySchema: z.ZodObject<{
63
77
  range?: string | undefined;
64
78
  required?: boolean | undefined;
65
79
  }>;
66
- /** provider 供给槽声明(integrations v2:contributes.providers.slots 元素;
80
+ /** provider 供给槽声明(integrations v2:declare.providers.slots 元素;
67
81
  * provider = 厂商名(catalog 嵌套第一轴)、implementation = 'id@version'(第二轴)) */
68
82
  declare const providerSlotContribSchema: z.ZodObject<{
69
83
  service: z.ZodString;
@@ -90,8 +104,8 @@ declare const providerSlotContribSchema: z.ZodObject<{
90
104
  configSchema?: string | undefined;
91
105
  credentialSchema?: string | undefined;
92
106
  }>;
93
- /** 服务需求槽声明(contributes.services 元素;业务模块声明消费——catalog 需求侧聚合源) */
94
- declare const serviceNeedContribSchema: z.ZodObject<{
107
+ /** 服务消费槽声明(declare.consumes 元素;业务模块声明消费——catalog 需求侧聚合源) */
108
+ declare const serviceConsumeContribSchema: z.ZodObject<{
95
109
  service: z.ZodString;
96
110
  optional: z.ZodDefault<z.ZodBoolean>;
97
111
  defaults: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -104,7 +118,7 @@ declare const serviceNeedContribSchema: z.ZodObject<{
104
118
  provider: string;
105
119
  implementation: string;
106
120
  }>, "many">>;
107
- title: z.ZodOptional<z.ZodString>;
121
+ name: z.ZodOptional<z.ZodString>;
108
122
  description: z.ZodOptional<z.ZodString>;
109
123
  }, "strip", z.ZodTypeAny, {
110
124
  service: string;
@@ -113,7 +127,7 @@ declare const serviceNeedContribSchema: z.ZodObject<{
113
127
  provider: string;
114
128
  implementation: string;
115
129
  }[];
116
- title?: string | undefined;
130
+ name?: string | undefined;
117
131
  description?: string | undefined;
118
132
  }, {
119
133
  service: string;
@@ -122,10 +136,18 @@ declare const serviceNeedContribSchema: z.ZodObject<{
122
136
  provider: string;
123
137
  implementation: string;
124
138
  }[] | undefined;
125
- title?: string | undefined;
139
+ name?: string | undefined;
126
140
  description?: string | undefined;
127
141
  }>;
128
- /** 资源需求声明(contributes.resources 元素;type 放宽为 string——词汇校验移谓词经 resolver 取词表) */
142
+ /** 服务归属声明(declare.owns 元素;v6 薄形状——互斥事实无元数据,strict 单键防双数组漂移) */
143
+ declare const serviceOwnContribSchema: z.ZodObject<{
144
+ service: z.ZodString;
145
+ }, "strict", z.ZodTypeAny, {
146
+ service: string;
147
+ }, {
148
+ service: string;
149
+ }>;
150
+ /** 资源需求声明(declare.resources 元素;type 放宽为 string——词汇校验移谓词经 resolver 取词表) */
129
151
  declare const resourceNeedContribSchema: z.ZodObject<{
130
152
  id: z.ZodString;
131
153
  type: z.ZodString;
@@ -138,7 +160,9 @@ declare const resourceNeedContribSchema: z.ZodObject<{
138
160
  }>;
139
161
  declare const moduleDescriptorSchema: z.ZodObject<{
140
162
  schemaVersion: z.ZodDefault<z.ZodNumber>;
141
- name: z.ZodString;
163
+ id: z.ZodString;
164
+ name: z.ZodOptional<z.ZodString>;
165
+ description: z.ZodOptional<z.ZodString>;
142
166
  version: z.ZodDefault<z.ZodString>;
143
167
  kind: z.ZodDefault<z.ZodEnum<["platform", "business", "third-party"]>>;
144
168
  risk: z.ZodDefault<z.ZodObject<{
@@ -158,7 +182,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
158
182
  }, {
159
183
  defaultMode?: "local" | "hybrid" | "sdk" | "codegen" | undefined;
160
184
  }>>;
161
- contributes: z.ZodDefault<z.ZodObject<{
185
+ declare: z.ZodDefault<z.ZodObject<{
162
186
  handlers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
163
187
  tools: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
164
188
  cards: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -245,7 +269,14 @@ declare const moduleDescriptorSchema: z.ZodObject<{
245
269
  credentialSchema?: string | undefined;
246
270
  }[] | undefined;
247
271
  }>>;
248
- services: z.ZodDefault<z.ZodArray<z.ZodObject<{
272
+ owns: z.ZodDefault<z.ZodArray<z.ZodObject<{
273
+ service: z.ZodString;
274
+ }, "strict", z.ZodTypeAny, {
275
+ service: string;
276
+ }, {
277
+ service: string;
278
+ }>, "many">>;
279
+ consumes: z.ZodDefault<z.ZodArray<z.ZodObject<{
249
280
  service: z.ZodString;
250
281
  optional: z.ZodDefault<z.ZodBoolean>;
251
282
  defaults: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -258,7 +289,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
258
289
  provider: string;
259
290
  implementation: string;
260
291
  }>, "many">>;
261
- title: z.ZodOptional<z.ZodString>;
292
+ name: z.ZodOptional<z.ZodString>;
262
293
  description: z.ZodOptional<z.ZodString>;
263
294
  }, "strip", z.ZodTypeAny, {
264
295
  service: string;
@@ -267,7 +298,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
267
298
  provider: string;
268
299
  implementation: string;
269
300
  }[];
270
- title?: string | undefined;
301
+ name?: string | undefined;
271
302
  description?: string | undefined;
272
303
  }, {
273
304
  service: string;
@@ -276,7 +307,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
276
307
  provider: string;
277
308
  implementation: string;
278
309
  }[] | undefined;
279
- title?: string | undefined;
310
+ name?: string | undefined;
280
311
  description?: string | undefined;
281
312
  }>, "many">>;
282
313
  resources: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -318,14 +349,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
318
349
  credentialSchema?: string | undefined;
319
350
  }[];
320
351
  };
321
- services: {
352
+ owns: {
353
+ service: string;
354
+ }[];
355
+ consumes: {
322
356
  service: string;
323
357
  optional: boolean;
324
358
  defaults: {
325
359
  provider: string;
326
360
  implementation: string;
327
361
  }[];
328
- title?: string | undefined;
362
+ name?: string | undefined;
329
363
  description?: string | undefined;
330
364
  }[];
331
365
  resources: {
@@ -361,14 +395,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
361
395
  credentialSchema?: string | undefined;
362
396
  }[] | undefined;
363
397
  } | undefined;
364
- services?: {
398
+ owns?: {
399
+ service: string;
400
+ }[] | undefined;
401
+ consumes?: {
365
402
  service: string;
366
403
  optional?: boolean | undefined;
367
404
  defaults?: {
368
405
  provider: string;
369
406
  implementation: string;
370
407
  }[] | undefined;
371
- title?: string | undefined;
408
+ name?: string | undefined;
372
409
  description?: string | undefined;
373
410
  }[] | undefined;
374
411
  resources?: {
@@ -406,7 +443,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
406
443
  env: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
407
444
  }, "strict", z.ZodTypeAny, {
408
445
  schemaVersion: number;
409
- name: string;
446
+ id: string;
410
447
  version: string;
411
448
  kind: "platform" | "business" | "third-party";
412
449
  risk: {
@@ -416,7 +453,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
416
453
  distribution: {
417
454
  defaultMode: "local" | "hybrid" | "sdk" | "codegen";
418
455
  };
419
- contributes: {
456
+ declare: {
420
457
  handlers: string[];
421
458
  tools: string[];
422
459
  cards: {
@@ -445,14 +482,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
445
482
  credentialSchema?: string | undefined;
446
483
  }[];
447
484
  };
448
- services: {
485
+ owns: {
486
+ service: string;
487
+ }[];
488
+ consumes: {
449
489
  service: string;
450
490
  optional: boolean;
451
491
  defaults: {
452
492
  provider: string;
453
493
  implementation: string;
454
494
  }[];
455
- title?: string | undefined;
495
+ name?: string | undefined;
456
496
  description?: string | undefined;
457
497
  }[];
458
498
  resources: {
@@ -468,9 +508,13 @@ declare const moduleDescriptorSchema: z.ZodObject<{
468
508
  }[];
469
509
  };
470
510
  env: string[];
511
+ name?: string | undefined;
512
+ description?: string | undefined;
471
513
  }, {
472
- name: string;
514
+ id: string;
473
515
  schemaVersion?: number | undefined;
516
+ name?: string | undefined;
517
+ description?: string | undefined;
474
518
  version?: string | undefined;
475
519
  kind?: "platform" | "business" | "third-party" | undefined;
476
520
  risk?: {
@@ -480,7 +524,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
480
524
  distribution?: {
481
525
  defaultMode?: "local" | "hybrid" | "sdk" | "codegen" | undefined;
482
526
  } | undefined;
483
- contributes?: {
527
+ declare?: {
484
528
  handlers?: string[] | undefined;
485
529
  tools?: string[] | undefined;
486
530
  cards?: {
@@ -509,14 +553,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
509
553
  credentialSchema?: string | undefined;
510
554
  }[] | undefined;
511
555
  } | undefined;
512
- services?: {
556
+ owns?: {
557
+ service: string;
558
+ }[] | undefined;
559
+ consumes?: {
513
560
  service: string;
514
561
  optional?: boolean | undefined;
515
562
  defaults?: {
516
563
  provider: string;
517
564
  implementation: string;
518
565
  }[] | undefined;
519
- title?: string | undefined;
566
+ name?: string | undefined;
520
567
  description?: string | undefined;
521
568
  }[] | undefined;
522
569
  resources?: {
@@ -536,7 +583,8 @@ declare const moduleDescriptorSchema: z.ZodObject<{
536
583
  type ModuleDescriptor = z.infer<typeof moduleDescriptorSchema>;
537
584
  type CardContrib = z.infer<typeof cardContribSchema>;
538
585
  type ProviderSlotContrib = z.infer<typeof providerSlotContribSchema>;
539
- type ServiceNeedContrib = z.infer<typeof serviceNeedContribSchema>;
586
+ type ServiceConsumeContrib = z.infer<typeof serviceConsumeContribSchema>;
587
+ type ServiceOwnContrib = z.infer<typeof serviceOwnContribSchema>;
540
588
  type ResourceNeedContrib = z.infer<typeof resourceNeedContribSchema>;
541
589
  type ParseModuleResult = {
542
590
  ok: true;
@@ -544,20 +592,23 @@ type ParseModuleResult = {
544
592
  } | {
545
593
  ok: false;
546
594
  errors: string[];
595
+ legacy?: true;
547
596
  };
548
597
  declare function parseModuleDescriptor(raw: unknown): ParseModuleResult;
549
598
 
550
599
  /**
551
600
  * 配置 JSON 环境变量占位展开(纯数据形态——自 app-sdk env-expansion.ts 迁入改造)。
552
601
  *
553
- * 语法(与 SDK 版语义逐字一致,共享向量 test-fixtures/env-expansion-cases.json 防漂移):
554
- * ${NAME} 占位引用;NAME 限定 [A-Z][A-Z0-9_]*(UPPER_SNAKE,最小化与正文 `${...}` 误碰)
555
- * $${NAME} 转义为字面量 ${NAME}(原样保留一次 $)
602
+ * 语法(语义真源 = 本文件 + 共享向量 test-fixtures/env-expansion-cases.json 防漂移):
603
+ * ${NAME} 占位引用;NAME 限定 [A-Z][A-Z0-9_]*(UPPER_SNAKE,最小化与正文 `${...}` 误碰)
604
+ * ${NAME:def} POSIX 风格缺省值:NAME 未设置时用 def(字面量,不二次展开);设置时空串也算「已设置」
605
+ * $${NAME} 转义为字面量 ${NAME}(原样保留一次 $)
556
606
  *
557
607
  * 语义(评审 N1 钉死,壳层各自包装 throw/report):
558
608
  * - 单遍非递归:env 值内若含 `${OTHER}` 不被二次展开(注入防线);String.replace 回调形态天然单遍。
609
+ * 默认值内含 `${...}` 同样不展开(POSIX 同限);默认值含 `}` 不支持(同 POSIX 同限——正则 [^}] 截断)。
559
610
  * - 值经 JSON 字符串转义注入;不做数值/布尔强制转换。
560
- * - **本版为纯数据返回形态** `{ text?: string; missing: string[] }`——缺变量不 throw,
611
+ * - **本版为纯数据返回形态** `{ text?: string; missing: string[] }`——缺变量(无缺省值时)不 throw,
561
612
  * 由壳层(CLI doctor 壳 / app-sdk 桥 throw 壳 / 沙箱宿主)决定 fail-fast 还是降级:
562
613
  * SDK 桥壳 missing 非空即 throw(错误文案逐字等价 SDK 旧版);CLI 壳同款。
563
614
  * - 无 ${ 的文本快速路径:text 原文返回,零替换零开销。
@@ -689,14 +740,17 @@ interface ConfiguredService {
689
740
  instances?: Record<string, ServiceInstanceConfig>;
690
741
  }
691
742
  /**
692
- * 模块域全局配置(键 = 槽位域前缀,moduleDomainOf 派生;域 模块名——auth 域由登录链消费)。
693
- * 部署边界:单应用单厂商部署门禁不因 domains 表达力放开(混绑 die 原样)。
743
+ * 模块资源配置(integrations v6:modules 节 = 模块集成位——provider 绑定默认 + config
744
+ * 级联层 + v5 资源节三键合一;键 = install id(.tbox/app.json entry.id / packages/ 目录名;
745
+ * 仓内家族包恒等 manifest name 属规约)。provider/config 至少其一(空节点无意义)。
694
746
  */
695
- interface DomainConfig {
696
- /** 域级默认厂商(implementation 恒派生——域层无精确绑定语义) */
747
+ interface ModuleConfig {
748
+ /** 模块级默认厂商(v6 绑定组继承层——作用于该模块 declare.owns 的全部服务槽) */
697
749
  provider?: string;
698
- /** 域级共享配置(该域全部槽合并进 config 级联,与绑定来源层无关) */
750
+ /** 模块级共享配置(config 五层级联第三层:root ByInstance 之后、slot 之前) */
699
751
  config?: Record<string, unknown>;
752
+ /** resourceId → 类型化资源声明(resourceId 词汇真源 = 模块 manifest declare.resources) */
753
+ resources?: Record<string, ResourceSpec>;
700
754
  }
701
755
  /**
702
756
  * 部署实例(业务主体拓扑条目;root instances 注册表元素——v4 参考表)。
@@ -738,15 +792,12 @@ interface IntegrationsConfig {
738
792
  credentialRef?: string;
739
793
  /** 部署级 per-instance 默认凭据表(键 = instanceId;商户级凭据主写位) */
740
794
  credentialRefByInstance?: Record<string, string>;
741
- /** 模块域全局层(键 = moduleDomainOf(service);无 ByInstance——全链唯一 ByInstance 层恒 root) */
742
- domains?: Record<string, DomainConfig>;
743
795
  /** 部署实例注册表(参考表);缺席 = 无参考表;空数组非法(zod 拒——无表 = 键缺席唯一写法) */
744
796
  instances?: DeploymentInstance[];
745
797
  /** 默认实例 id(单实例免填;∈instances ids;无表时独立在场 = 动态默认形态) */
746
798
  defaultInstanceId?: string | null;
747
- /** 模块资源绑定(v5 新轴——与 domains 正交:domains = provider 绑定默认,modules = 资源绑定;
748
- * = install id(.tbox/app.json entry.id / packages/ 目录名;仓内家族包恒等 manifest name 属规约);
749
- * 无 per-instance 层(扩展位词汇预选 resourcesByInstance——instances 词恒属 services 激活语义) */
799
+ /** 模块集成位(v6:provider 绑定默认 + config 级联层 + v5 资源节三键合一;
800
+ * 顶层 domains 键已退役——旧键经 zod 防线拒收并指引 migrate modules[owner]) */
750
801
  modules?: Record<string, ModuleConfig>;
751
802
  services: Record<string, ConfiguredService>;
752
803
  }
@@ -754,7 +805,7 @@ interface IntegrationsConfig {
754
805
  interface EffectiveService {
755
806
  provider: string | InlineVendorDeclaration$1;
756
807
  implementation: string;
757
- /** 五层浅合并一层:root.config → root.configByInstance[k] → domain.config → slot.config → inst.config */
808
+ /** 五层浅合并一层:root.config → root.configByInstance[k] → modules[owner].config → slot.config → inst.config */
758
809
  config: Readonly<Record<string, unknown>>;
759
810
  credentialRef?: string;
760
811
  }
@@ -771,26 +822,34 @@ type EffectiveServiceResolution = {
771
822
  status: 'binding-unresolved';
772
823
  message: string;
773
824
  };
774
- /** 槽位域前缀(domains 键控轴):首个点号前段;无点号取整串。域 ≠ 模块名(auth 域由登录链消费)。 */
825
+ /**
826
+ * 槽位域前缀(首个点号前段;无点号取整串)。**v6 起退出级联**(modules[ownerOf] 取代
827
+ * domains 键控)——保留导出仅供词汇组织用途(guard/doctor 诊断消息按域聚合展示)。
828
+ * 域 ≠ 模块名(auth 域由登录链消费);归属语义唯一真源 = 模块 manifest declare.owns。
829
+ * @deprecated 级联键控已退役(v6 ownership 模型);新消费方禁用——归属查询走 ownerOf。
830
+ */
775
831
  declare function moduleDomainOf(service: string): string;
776
832
  /** 派生查表(buildSupplyLookup 产物):键 `${provider}\u0000${service}` → implementation 清单('id@version')。 */
777
833
  type SupplyLookup$1 = Record<string, readonly string[]>;
778
834
  /**
779
835
  * 级联细则(一句话:层序优先于 scope 特异度;层内 per-instance 胜标量):
780
- * - 绑定组(provider + implementation):最特异层整组取(inst > slot > domain > root)——
836
+ * - 绑定组(provider + implementation):最特异层整组取(inst > slot > modules[owner] > root)——
781
837
  * 独立 `??` 继承会产生跨层非法组合(inst.provider=wanda + 继承 slot 的 joycity impl),
782
838
  * 故组不可拆;组内 implementation 缺席 → supplies 派生(唯一命中;
783
839
  * 零命中/歧义/未注入查表 → binding-unresolved);双字段显式在场 = 显式即真值(不派生,
784
840
  * 存量全显式文件零影响)。内联声明仅槽级且必带 implementation(防御分支兜底)。
785
- * - config 五层浅合并:root.config root.configByInstance[k] domain.config → slot.config →
786
- * inst.config(service 标量胜 root ByInstance[k]——层序优先于 scope 特异度;
787
- * domain.config 恒参与该域全部槽,与绑定来源层无关)
841
+ * - ownerOf(v6):servicemoduleId 归属表(buildOwnershipMap 产物,装配期显式注入)。
842
+ * 服务无主 跳过 modules 层(≡ 平台槽语义);ownerOf 缺席且文件含 modules 级
843
+ * 绑定/配置 → binding-unresolved fail-visible(装配偏斜防线——防静默丢模块层语义)。
844
+ * - config 五层浅合并:root.config → root.configByInstance[k] → modules[owner].config →
845
+ * slot.config → inst.config(service 标量胜 root ByInstance[k]——层序优先于 scope 特异度;
846
+ * modules[owner].config 恒参与该模块 owns 全部服务槽,与绑定来源层无关)
788
847
  * - credentialRef:inst ?? slot ?? root.credentialRefByInstance[k] ?? root.credentialRef(v3 零改动;
789
- * domain 层无 credentialRef——链位预留 slot 后、root ByInstance 前)
848
+ * module 层无 credentialRef——链位预留 slot 后、root ByInstance 前)
790
849
  * 不抛领域错误;status 由 SDK registry 映射 PROVIDER_* 错误码
791
850
  * (binding-unresolved → PROVIDER_BINDING_UNRESOLVED;hasProviderBinding 点查 status !== 'ok' → false)。
792
851
  */
793
- declare function resolveEffectiveService(integrations: IntegrationsConfig, service: string, instanceId: string, supplies?: SupplyLookup$1): EffectiveServiceResolution;
852
+ declare function resolveEffectiveService(integrations: IntegrationsConfig, service: string, instanceId: string, supplies?: SupplyLookup$1, ownerOf?: Record<string, string>): EffectiveServiceResolution;
794
853
  /**
795
854
  * root 部署实例注册表归一化(v4 wire → 消费形态单源):
796
855
  * - instances 缺席 = 空表(无参考表——wanda 动态形态;空数组已在 zod 拒,此处纯防御);
@@ -819,7 +878,7 @@ interface CatalogProviderEntry {
819
878
  /** 供给槽清单(service id) */
820
879
  services: string[];
821
880
  }
822
- /** catalog 需求侧聚合条目(模块 manifest contributes.services 元素聚合;services 键 = service id) */
881
+ /** catalog 需求侧聚合条目(模块 manifest declare.consumes 元素聚合;services 键 = service id) */
823
882
  interface CatalogServiceEntry {
824
883
  /** 可选槽(未配置不 error——doctor warning 级) */
825
884
  optional: boolean;
@@ -860,11 +919,6 @@ interface KnowledgeResourceSpec {
860
919
  }
861
920
  /** 资源声明(discriminated by type;SDK zod / CLI doctor / 未来 app-toolkit 共用 wire 形状) */
862
921
  type ResourceSpec = KnowledgeResourceSpec;
863
- /** 模块资源配置(modules 节元素;strict 单字段——provider/config/instances 进 modules 即非法,防与 domains 双写位) */
864
- interface ModuleConfig {
865
- /** resourceId → 类型化资源声明(resourceId 词汇真源 = 模块 manifest contributes.resources) */
866
- resources: Record<string, ResourceSpec>;
867
- }
868
922
 
869
923
  /**
870
924
  * contracts 期望面编译期锁(satisfies 语义防接口漂移——contracts 加名/改签名即编译红)。
@@ -872,11 +926,11 @@ interface ModuleConfig {
872
926
  * contracts 恒 devDep 且限 import type——运行时全经 resolver 动态 import(版本解耦,D3)。
873
927
  */
874
928
  interface EvaluationExports {
875
- /** 求值单源(TIER0;v3 显式激活 vs v4 通配语义随应用版本) */
929
+ /** 求值单源(TIER0;v3 显式激活 vs v4 通配语义随应用版本;v6 第五参 ownerOf) */
876
930
  resolveEffectiveService: typeof resolveEffectiveService;
877
931
  /** 供给查表派生(谓词 #12 与视图供给轴共用输入) */
878
932
  buildSupplyLookup: typeof buildSupplyLookup;
879
- /** service → 首点段域前缀(谓词 #14 域键匹配) */
933
+ /** service → 首点段域前缀(v6 deprecated——级联键控退役,仅词汇组织消费) */
880
934
  moduleDomainOf: typeof moduleDomainOf;
881
935
  /** 部署实例注册表归一(默认实例委托——null → '*' 通配口径) */
882
936
  normalizeInstances: typeof normalizeInstances;
@@ -921,6 +975,9 @@ interface ResolvedContracts {
921
975
  evaluation: boolean;
922
976
  /** 严格 zod 面可用(parseIntegrationsConfig 在场——≥0.9 门控判据) */
923
977
  strictValidation: boolean;
978
+ /** v6 形状标记在场(OWNERSHIP_BINDING_V6——modules[owner] 绑定形状支持;标记门 P1:
979
+ * v5 contracts + v6 toolkit 偏斜 → 503 第四分支,防静默忽略 ownerOf) */
980
+ ownershipBindingV6: boolean;
924
981
  /** 动态 import 产物(命名导出子集——Partial<EvaluationExports>) */
925
982
  module: ResolvedModule;
926
983
  /** 解析诊断(N1 构建指引 message 三分支的输入:未安装 / 版本 <0.9 / 源码态未构建) */
@@ -950,19 +1007,24 @@ declare function invalidateContractsResolver(appDir?: string): void;
950
1007
  * IMPL_WITHOUT_PROVIDER #5/#13 error impl-only(implementation 缺 provider 绑定组头)
951
1008
  * INLINE_PROVIDER_INVALID #5 error 内联厂商声明超受控形状(槽级/实例级)
952
1009
  * SCHEMA_FILE_MISSING #6 error credentialType schema 引用不存在
953
- * DOMAIN_CONFIG_INVALID #7 error root/domains 死配置(键 ∉ 引用厂商 schema properties;
1010
+ * DOMAIN_CONFIG_INVALID #7 error root/modules 死配置(键 ∉ 引用厂商 schema properties;
954
1011
  * api.md DOMAIN_CONFIG_UNUSED 行预留 warning 级,
955
1012
  * 现行为 error 恒等旧谓词——doctor 门控等价)
956
1013
  * INSTANCE_KEY_NOT_REGISTERED #8 error ByInstance 键/实例键 ∉ 注册表白名单
957
1014
  * REALM_SWITCH_HINT #9 warning 实现覆盖跨厂商(凭据域切换确认)
958
1015
  * WILDCARD_ALIGNMENT #10 warning 通配形态齐步提示
959
1016
  * MULTI_INSTANCE_NO_DEFAULT v4 warning 多实例无 defaultInstanceId(无 scope 访问落全局会话)
960
- * VENDOR_NOT_INSTALLED #11 error root/domains 厂商未命中已装供给
1017
+ * VENDOR_NOT_INSTALLED #11 error root/modules 厂商未命中已装供给
961
1018
  * BINDING_UNRESOLVED #12 error 绑定不可解析(resolveEffectiveService 求值失败)
962
- * DOMAIN_KEY_UNMATCHED #14 warning domains 匹配域集(typo)
1019
+ * IMPL_WITHOUT_PROVIDER #5/#13 error impl-only(implementation provider 绑定组头)
963
1020
  * RESOURCE_TYPE_UNKNOWN #15 error modules 资源节 type ∉ 词汇表
964
1021
  * RESOURCE_NOT_DECLARED #16 warning 资源键/资源 id ∉ 模块声明集
1022
+ * MODULE_CONFIG_DEAD v6 error modules[m](未安装 ∨ owns=0)携带 provider/config
1023
+ * (统一吸收原「#16 升级」特例——P2 一码一义)
1024
+ * GLOBAL_FIELD_UNDECLARED #17 warning 全局层键过 #7 但 ∉ 引用厂商 x-tbox-global 并集(G 批;
1025
+ * 零声明厂商整体跳过——#7 同遍历双判定,P4)
965
1026
  * ORPHANED_CREDENTIAL 写后对账 warning 凭据文件不再被引用(toolkit 写路径产出,非本谓词)
1027
+ * (v6 退役:DOMAIN_KEY_UNMATCHED #14——domains 键随归属模型退场)
966
1028
  *
967
1029
  * 输入形状(调用方负责装载):
968
1030
  * - integrations:config/integrations.json 解析产物(宽松 Record 透传——严格 zod 校验归模板 loader)
@@ -979,33 +1041,32 @@ declare function invalidateContractsResolver(appDir?: string): void;
979
1041
  * 继承绑定(槽级 provider 缺席)经 effective 求值取厂商——supplies 在场时)
980
1042
  * #5 实例 impl-only 禁止 + 覆盖命中供给(含槽级内联形状;provider-only = 派生位,合法)
981
1043
  * #6 manifest configSchema/credentialSchema 引用文件存在性(内联与 manifest 绑定同查)
982
- * #7 root/domains 死配置:root.config/configByInstance/domains[d].config 键 ⊆ 引用厂商(并集)
983
- * 各槽 schema properties——引用面 = root.provider ∪ domains.*.provider ∪ 槽级(terse 化防退化)
1044
+ * #7 root/modules 死配置:root.config/configByInstance/modules[m].config 键 ⊆ 引用厂商(并集)
1045
+ * 各槽 schema properties——引用面 = root.provider ∪ modules.*.provider ∪ 槽级(terse 化防退化);
1046
+ * modules 层 per-module 生效厂商 = resolveModuleBinding 单源(≡ modules[m].provider ?? root.provider)
984
1047
  * #8 ByInstance/实例键 ∈ malls 白名单(v4:源 = root instances 注册表 ids——参考表在场时
985
- * 激活;'**' 通配键豁免;注册表缺席 → 跳过;domains 键 = 域前缀非 instanceId,不适用)
1048
+ * 激活;'**' 通配键豁免;注册表缺席 → 跳过;modules 键 = install id 非 instanceId,不适用)
986
1049
  * #9 实现覆盖跨厂商提示(realm switch——凭据域切换确认)
987
- * #11 root/domains 厂商未命中已装供给(vendor 集合 = suppliedProviders 键前缀展开)
1050
+ * #11 root/modules 厂商未命中已装供给(vendor 集合 = suppliedProviders 键前缀展开)
988
1051
  * #12 绑定可解析性:逐 (service, instanceId) 经 contracts resolveEffectiveService 求值
989
- * (级联单源复用,谓词零级联实现),binding-unresolved → error(supplies 缺席 → 跳过)
1052
+ * (级联单源复用,谓词零级联实现;v6 ownerOf=ownership 显式参透传),binding-unresolved → error
990
1053
  * #13 槽级/实例级 impl-only(implementation 需伴随 provider——provider 是绑定组头;
991
1054
  * zod 之外的第二道防线——doctor 读裸 JSON)
992
- * #14 domains 匹配域集(已配置槽 需求声明的 moduleDomainOf 并集;typo → warning)
993
- * #15-#16 modules 资源节对账(v5):type RESOURCE_TYPE_IDS error(裸 JSON 预启动反馈);
994
- * 已装模块 id / 资源 id模块 manifest contributes.resources 声明集(声明非空时)
995
- * warning(moduleResourceNeeds 缺席 需求面检查跳过,M3 降级先例)
1055
+ * MODULE_CONFIG_DEAD:modules[m] 携带 provider/config 且(m installedModuleIds ownership
1056
+ * 无任何 service 归属 m)→ error(键级 #16 warning 与本检查可同节点共发——键级 vs 值级不同断言面)
1057
+ * #17(G 批):与 #7 同遍历双判定(P4)——键 schema properties x-tbox-global 并集
1058
+ * warning;引用厂商零全局声明(集空/缺席)→ 该厂商键整体跳过;检查序在 MODULE_CONFIG_DEAD
1059
+ * #15-#16 modules 资源节对账(v5 延续):type ∉ RESOURCE_TYPE_IDS → error;键 ∉ 已装模块 id 集 /
1060
+ * 资源 id ∉ 模块 manifest declare.resources 声明集 → warning
996
1061
  */
997
1062
 
998
1063
  /** contracts 注入面(resolver 装配产物运行时视图 = EvaluationExports 求值子集) */
999
- type PredicateContracts = Pick<EvaluationExports, 'resolveEffectiveService' | 'buildSupplyLookup' | 'moduleDomainOf' | 'normalizeInstances' | 'RESOURCE_TYPE_IDS'>;
1064
+ type PredicateContracts = Pick<EvaluationExports, 'resolveEffectiveService' | 'buildSupplyLookup' | 'normalizeInstances' | 'RESOURCE_TYPE_IDS'>;
1000
1065
  /** 派生查表形状(contracts buildSupplyLookup 产物;结构等价 TIER0 SupplyLookup——谓词零 contracts 静态依赖) */
1001
1066
  type SupplyLookup = Record<string, readonly string[]>;
1002
1067
  interface IntegrationServicePredicateInput {
1003
1068
  integrations: {
1004
1069
  provider?: string;
1005
- domains?: Record<string, {
1006
- provider?: string;
1007
- config?: Record<string, unknown>;
1008
- }>;
1009
1070
  config?: Record<string, unknown>;
1010
1071
  configByInstance?: Record<string, Record<string, unknown>>;
1011
1072
  credentialRef?: string;
@@ -1030,8 +1091,10 @@ interface IntegrationServicePredicateInput {
1030
1091
  }>;
1031
1092
  /** v4 默认实例(normalizeInstances 解析语义:显式 ?? 单候选唯一解) */
1032
1093
  defaultInstanceId?: string | null;
1033
- /** v5 模块资源绑定(modules 节——宽松透传;严格 zod 归模板 loader) */
1094
+ /** v6 模块集成位(modules 节三键——宽松透传;严格 zod 归模板 loader) */
1034
1095
  modules?: Record<string, {
1096
+ provider?: string;
1097
+ config?: Record<string, unknown>;
1035
1098
  resources?: Record<string, {
1036
1099
  type?: unknown;
1037
1100
  }>;
@@ -1050,12 +1113,20 @@ interface IntegrationServicePredicateInput {
1050
1113
  }>;
1051
1114
  /** 派生查表(buildSupplyLookup 产物;缺席 → #12 跳过 + #2 继承绑定不查 credentialType) */
1052
1115
  supplies?: SupplyLookup;
1116
+ /** v6 服务归属表(walk.ownership——#12 ownerOf 透传 + MODULE_CONFIG_DEAD owns=0 判据;
1117
+ * 缺席 = 归属面不可判 → MODULE_CONFIG_DEAD 退化为仅「未安装」分支) */
1118
+ ownership?: Record<string, string>;
1119
+ /** v6 已装模块 id 集(.tbox/app.json entry.id ∪ packages/ 目录名;缺席 → 「未安装」分支跳过) */
1120
+ installedModuleIds?: ReadonlySet<string>;
1053
1121
  /** malls 白名单(deployments 控制面 extract;缺席 → ByInstance 键检查跳过) */
1054
1122
  malls?: string[];
1055
1123
  /** credentialType → schema 文件引用缺失(manifest 声明指向缺失文件;#6) */
1056
1124
  credentialSchemaMissing?: Record<string, boolean>;
1057
1125
  /** 厂商 → 槽 schema properties 键集(#7 用;调用方从 manifest configSchema 引用解析) */
1058
1126
  vendorConfigKeys?: Record<string, Set<string>>;
1127
+ /** G 批:厂商 → x-tbox-global 标记键集(#17 用;#7 同循环收集——零新增 IO);
1128
+ * 缺席/空集 = 该厂商零声明 → #17 对其键整体跳过 */
1129
+ vendorGlobalConfigKeys?: Record<string, Set<string>>;
1059
1130
  /** 厂商 → configSchema 引用文件缺失(#7 跳过该厂商——无 schema 不能判死配置) */
1060
1131
  vendorConfigSchemaMissing?: Record<string, boolean>;
1061
1132
  /** 凭据文件缺失(#1:credentialRef stem → 档内 credentials/<stem>.json 在场;域中立注入) */
@@ -1064,7 +1135,7 @@ interface IntegrationServicePredicateInput {
1064
1135
  credentialFileType?: Record<string, string | undefined>;
1065
1136
  /** #9:实现覆盖跨厂商提示位(CLI 侧组装) */
1066
1137
  realmSwitchHints?: string[];
1067
- /** v5:已装模块 id → manifest contributes.resources 声明 id 集(值空集 = 无声明,资源级跳过;
1138
+ /** v5:已装模块 id → manifest declare.resources 声明 id 集(值空集 = 无声明,资源级跳过;
1068
1139
  * 缺席 = 无需求面信息——键未知/资源未声明检查跳过,type 检查恒跑) */
1069
1140
  moduleResourceNeeds?: Record<string, ReadonlySet<string>>;
1070
1141
  }
@@ -1099,15 +1170,23 @@ declare function evaluateIntegrationServices(input: IntegrationServicePredicateI
1099
1170
  *
1100
1171
  * manifest 候选路径探测(packages/<id>/tbox.module.json 优先 → node_modules/<pkg>/tbox.module.json;
1101
1172
  * tbox-app dev 真身经 .tbox-dev.local/dev-manifest.json redirects 独立 catalog 通道直达)一次遍历同时产出:
1102
- * 1. modules:已装模块清单(declared;demand meta title/description 透传)
1173
+ * 1. modules:已装模块清单(declared;demand meta name/description 透传)
1103
1174
  * 2. catalog(富形态):providers 嵌套(vendor→impl→entry,per-service {implementation, credentialType}
1104
1175
  * 保真——同厂商异构/多实现合法,D25/H1)+ 需求侧聚合
1105
1176
  * 3. serviceSchemas:per-service schema 复合键表——键 `${provider}\u0000${service}`(H2,同一服务
1106
1177
  * 多厂商供给各自 schema 零碰撞);多 impl 同 (provider, service) 异 schema → 声明序首个
1107
1178
  * 4. vocabulary:所有携带 service-slots.json 的已装契约包该文件 `.slots` 键并集(fs 直读、
1108
- * `$comment` 忽略;探测链 = readdir(<候选>/node_modules/@tbox.cn) 过滤携带该文件的包——
1109
- * 零缓存枚举,与 manifest 探测同机制;多行业 contracts-* 天然扩展 F8);缺席 [](退化 demanded ∪ configured)
1110
- * 5. domainKeyIssues:跨模块域键冲突 issue(两模块派生同一 domains 键——P13)
1179
+ * `$comment` 忽略;探测三跳 = <候选>/node_modules/@tbox.cn/<pkg>/service-slots.json(包根)
1180
+ * 同包 src/service-slots.json(发布包 src 附带 / 模板 shim 链接)
1181
+ * 候选自身 {service-slots.json, src/service-slots.json}(local/codegen 全量副本——
1182
+ * mall 生成应用主形态,不依赖 install);零缓存枚举,与 manifest 探测同机制;
1183
+ * 多行业 contracts-* 天然扩展 F8);缺席 → [](退化 demanded ∪ configured)
1184
+ * 5. slotMeta:词汇 meta 节(per-service {name,description} 展示元数据——消费端兜底链
1185
+ * 词汇 > demand > id,views/context resolveServiceDisplay 单源);多包发现序首声明胜出
1186
+ * (与 catalog addSlots 同语义);contracts-mall 词汇锁保证 mall 域全量覆盖;缺席 → {}
1187
+ * 6. ownership:service → moduleId 归属表(v6——declare.owns 聚合;install id 键控;
1188
+ * 双 owner 冲突 → declarationIssues OWNERSHIP_CONFLICT + 先声明胜出)
1189
+ * 7. declarationIssues:声明面诊断(OWNERSHIP_CONFLICT / OLD_MANIFEST_KEY——P3 通道)
1111
1190
  *
1112
1191
  * **约束(D26;FX-3/F7 边界)**:目录枚举零缓存——readdir / node_modules 候选探测 / `.tbox/app.json` 读取 /
1113
1192
  * dev-manifest 读取每次执行(枚举输入保持 fresh——agent 装卸模块下一笔即见);manifest/service-slots
@@ -1115,6 +1194,18 @@ declare function evaluateIntegrationServices(input: IntegrationServicePredicateI
1115
1194
  * CLI 传 undefined 即全 fresh)。
1116
1195
  * 宽松解析语义(坏文件静默 + 重复键首声明保留)零改动。
1117
1196
  */
1197
+ /** 声明面诊断(v6 P3 通道——OWNERSHIP_CONFLICT / OLD_MANIFEST_KEY;error 级) */
1198
+ type DeclarationIssue = {
1199
+ severity: 'error';
1200
+ code: 'OWNERSHIP_CONFLICT';
1201
+ message: string;
1202
+ module?: string;
1203
+ } | {
1204
+ severity: 'error';
1205
+ code: 'OLD_MANIFEST_KEY';
1206
+ message: string;
1207
+ module?: string;
1208
+ };
1118
1209
  interface WalkManifestsResult {
1119
1210
  /** declared 产物(install id + descriptor;demand meta 透传) */
1120
1211
  modules: WalkModuleInfo[];
@@ -1128,13 +1219,18 @@ interface WalkManifestsResult {
1128
1219
  }>;
1129
1220
  /** 服务词汇 = 所有携带 service-slots.json 的已装契约包 `.slots` 键并集(缺席 → []) */
1130
1221
  vocabulary: string[];
1131
- /** 跨模块域键冲突(P13——两模块的 service 集派生同一 domains 键) */
1132
- domainKeyIssues: Array<{
1133
- severity: 'warning';
1134
- code: 'DOMAIN_KEY_CONFLICT';
1135
- message: string;
1136
- module?: string;
1137
- }>;
1222
+ /** 词汇 meta 节:per-service {name,description} 展示元数据(多包首声明胜出;缺席 {}) */
1223
+ slotMeta: Record<string, SlotMeta>;
1224
+ /** v6 服务归属表:service → moduleId(install id 键控——integrations modules 节键同轴;
1225
+ * 双 owner 冲突 → declarationIssues + 先声明胜出;dev 通道以 manifest id 参与归属) */
1226
+ ownership: Record<string, string>;
1227
+ /** 声明面诊断(OWNERSHIP_CONFLICT / OLD_MANIFEST_KEY) */
1228
+ declarationIssues: DeclarationIssue[];
1229
+ }
1230
+ /** 槽位展示元数据(service-slots.json meta 节元素——宽松提取,字段皆可选;v7 词汇统一 title→name) */
1231
+ interface SlotMeta {
1232
+ name?: string;
1233
+ description?: string;
1138
1234
  }
1139
1235
  interface WalkModuleInfo {
1140
1236
  /** install id(packages/ 目录名 / npmModules entry.id) */
@@ -1145,12 +1241,17 @@ interface WalkModuleInfo {
1145
1241
  pkg: string;
1146
1242
  descriptor: ModuleDescriptor;
1147
1243
  }
1148
- /** 富形态供给条目:per-service {implementation, credentialType} 恒数组保真(H1) */
1244
+ /** 富形态供给条目:per-service {implementation, credentialType} 恒数组保真(H1);
1245
+ * name/description = 厂商展示元数据(strict manifest descriptor 透传——多包同厂商
1246
+ * 首声明胜出,与 owner 同语义;B1 walk 层传播;v7 词汇统一 title→name) */
1149
1247
  interface WalkProviderEntry {
1150
1248
  provider: string;
1151
1249
  implementation: string;
1152
1250
  credentialType: string;
1153
1251
  owner: string;
1252
+ /** 厂商展示名(manifest name——多包首声明;缺席 = undefined) */
1253
+ name?: string;
1254
+ description?: string;
1154
1255
  local?: boolean;
1155
1256
  configSchema?: string;
1156
1257
  credentialSchema?: string;
@@ -1164,8 +1265,8 @@ interface WalkCatalog {
1164
1265
  provider: string;
1165
1266
  implementation: string;
1166
1267
  }>;
1167
- /** demand meta(title/description 首声明保留——模块 manifest demand 侧 additive) */
1168
- title?: string;
1268
+ /** demand meta(name/description 首声明保留——模块 manifest demand 侧 additive;v7 title→name) */
1269
+ name?: string;
1169
1270
  description?: string;
1170
1271
  owners: string[];
1171
1272
  }>;
@@ -1221,16 +1322,18 @@ interface PredicateIoInputs {
1221
1322
  credentialSchemaMissing: Record<string, boolean>;
1222
1323
  /** #7:厂商 → configSchema properties 键集并集 */
1223
1324
  vendorConfigKeys: Record<string, Set<string>>;
1325
+ /** #17(G 批):厂商 → x-tbox-global 标记键集(与 vendorConfigKeys 同循环收集——零新增 IO) */
1326
+ vendorGlobalConfigKeys: Record<string, Set<string>>;
1224
1327
  /** #7:厂商 → configSchema 引用缺失(跳过该厂商死配置判定) */
1225
1328
  vendorConfigSchemaMissing: Record<string, boolean>;
1226
1329
  /** #9:实现覆盖跨厂商提示文案(已成形——谓词直投) */
1227
1330
  realmSwitchHints: string[];
1228
1331
  /** #8:root instances 注册表 ids(在场才传;缺席 → 键检查跳过) */
1229
1332
  malls?: string[];
1230
- /** #15-#16:已装模块 id → manifest contributes.resources 声明 id 集 */
1333
+ /** #15-#16:已装模块 id → manifest declare.resources 声明 id 集 */
1231
1334
  moduleResourceNeeds: Record<string, ReadonlySet<string>>;
1232
1335
  }
1233
- /** 装配全产物(= PredicateIoInputs + 供给/需求聚合——喂 evaluateIntegrationServices 的
1336
+ /** 装配全产物(= PredicateIoInputs + 供给/需求/归属聚合——喂 evaluateIntegrationServices 的
1234
1337
  * 非 contracts/integrations 入参全集,两消费方 spread 直投,零各自组装) */
1235
1338
  interface PredicateAssembly extends PredicateIoInputs {
1236
1339
  suppliedProviders: Record<string, {
@@ -1242,6 +1345,9 @@ interface PredicateAssembly extends PredicateIoInputs {
1242
1345
  optional: boolean;
1243
1346
  owners: string[];
1244
1347
  }>;
1348
+ /** v6:服务归属表 + 已装模块 id 集(MODULE_CONFIG_DEAD / #12 ownerOf 透传) */
1349
+ ownership?: Record<string, string>;
1350
+ installedModuleIds?: ReadonlySet<string>;
1245
1351
  }
1246
1352
  /** stem → env 键(kebab → UPPER_SNAKE;与 SDK/provider-secret env 兜底同公式) */
1247
1353
  declare function refToEnvKey(stem: string): string;
@@ -1251,6 +1357,68 @@ declare function refToEnvKey(stem: string): string;
1251
1357
  */
1252
1358
  declare function buildPredicateAssembly(appDir: string, walk: WalkManifestsResult, integrations: Record<string, unknown>, env?: Readonly<Record<string, string | undefined>>): PredicateAssembly;
1253
1359
 
1360
+ /**
1361
+ * 应用级 integrations 求值(cli-remove-prune-and-new D2.4):doctor integration-services 规则内
1362
+ * "装配+求值"序列的单源抽取(FX-2b/F1 轨迹延续——此前 buildPredicateAssembly 已单源,本函数
1363
+ * 将 walk→supplies→assembly→evaluate 全序列收口)。
1364
+ *
1365
+ * 消费方:
1366
+ * - doctor integration-services 规则(外壳保留:stale 防线/文件读取/env 展开/形状守卫/分级投射)
1367
+ * - pruneIntegrationBindings(prune 判据 ≡ doctor 判据的构造性同源载体)
1368
+ *
1369
+ * 契约:调用方须先 `resolveContractsForApp` 并确保 `strictValidation`(本函数不再分级门控——
1370
+ * doctor 的 warning/error 升级指引与 prune 的 skip 语义分属两消费方,不收口)。
1371
+ */
1372
+ declare function evaluateAppIntegrationIssues(appDir: string, integrations: Record<string, unknown>, contracts: ResolvedContracts, env?: Readonly<Record<string, string | undefined>>): Promise<IntegrationServiceIssue[]>;
1373
+
1374
+ /**
1375
+ * integrations.json 死绑定清理(cli-remove-prune-and-new D2 核心件)。
1376
+ *
1377
+ * 不变式:**删除判据 ≡ doctor integration-services 报错判据(构造性同源)**——消费 doctor 同一
1378
+ * 共享求值器 evaluateAppIntegrationIssues 的结构化 issue,code 白名单
1379
+ * {VENDOR_NOT_INSTALLED, BINDING_UNRESOLVED, MODULE_CONFIG_DEAD} + 守卫(绑定引用链候选
1380
+ * provider ∈ installedVendors 即保留,排除活厂商错配)→ 删除域严格 = "供给载体消亡"。
1381
+ * v6:模块卸载 → modules[m] **整节点确定性清理**(provider+config+resources——D4:
1382
+ * 模块消亡清理 vs 集成位编辑保全不矛盾;MODULE_CONFIG_DEAD 为判据源)。
1383
+ *
1384
+ * 由此推论(均已实证):需求侧孤儿绑定(demand 消失、供给在场)保留——doctor 判其合法;用户
1385
+ * 预配置绑定受保护;一次 remove 自愈全文件历史死债;凭据类 issue(CREDENTIAL_FILE_MISSING 等)
1386
+ * 刻意不进白名单,原样保留。
1387
+ *
1388
+ * 写侧三防线(镜像 write core):归一化(空节点删键)→ parseIntegrationsConfig
1389
+ * 严格校验(失败弃写)→ writeAtomic。凭据孤儿只报告不清理(D9——与 DELETE 管线现行为一致)。
1390
+ * 全空(无任何存活绑定)→ 删文件——ensureMockBindings(缺席即生成)在重装供给时再生闭环。
1391
+ *
1392
+ * 最佳努力语义:谓词不可用(contracts 未安装/降级、env 缺失、求值 throw)→ skipped 返回 +
1393
+ * 文件原样,绝不阻断 remove 本体。
1394
+ */
1395
+ interface PruneResult {
1396
+ /** 被清除的绑定节点描述(remove 日志行,如 'root.provider=mock' / 'services.member.account') */
1397
+ removed: string[];
1398
+ /** 孤儿凭据(D9 只报告不清理——reconcileOrphanCredentials 产物 message) */
1399
+ orphanCredentials: string[];
1400
+ /** 跳过原因(正常路径 undefined;not-configured = integrations.json 缺席,兼容态零动作) */
1401
+ skipped?: 'predicate-unavailable' | 'validation-failed' | 'not-configured';
1402
+ }
1403
+ declare function pruneIntegrationBindings(appDir: string): Promise<PruneResult>;
1404
+
1405
+ /**
1406
+ * 双键寻址(v7 词汇统一):路径参数双键——id 精确优先 → 展示名唯一命中兜底 → 404
1407
+ * (多命中 fail-visible,message 列候选 + 指引改用 id;复用既有 404 码零新错误码)。
1408
+ *
1409
+ * **消费边界(O1——双键语义单点)**:仅 factory.ts 控制面七方法入口接入;
1410
+ * views / write-core / CLI 恒 id-only 纯函数。
1411
+ *
1412
+ * **纯参数式(F2)**:configuredKeys 由调用方注入——零 integrations 依赖、零 IO,
1413
+ * 解析输入恒为 walk 产物快照 + 调用方键集。
1414
+ */
1415
+ /** 模块双键解析:id 精确 → 展示名(descriptor.name ?? id)唯一命中 → 404。 */
1416
+ declare function resolveModuleKey(walk: WalkManifestsResult, key: string): WalkModuleInfo;
1417
+ /** 服务双键解析 → 真实 service id:服务键集(词汇 ∪ demand ∪ 供给足迹 ∪ configuredKeys)
1418
+ * 精确命中 → 展示名(slotMeta.name ?? catalog.services[].name)唯一命中 → 404。
1419
+ * configuredKeys = 当前集成配置 services 节键集(调用方注入)。 */
1420
+ declare function resolveServiceKey(walk: WalkManifestsResult, configuredKeys: readonly string[], key: string): string;
1421
+
1254
1422
  /**
1255
1423
  * .tbox/app.json npmModules 读写(自 CLI manifest.ts 迁入——assembly 层目录知识单源)。
1256
1424
  * npmModules 登记 = sdk 包双语义磁盘足迹之一(业务包 = packages/<id>/ 目录,sdk 包 = 本清单登记)。
@@ -1341,7 +1509,7 @@ interface BridgeProviderCatalog {
1341
1509
  }
1342
1510
  /** 富形态(工厂迁移面):walkManifests 产物直通 */
1343
1511
  declare function loadProviderCatalogRaw(appDir: string): WalkCatalog;
1344
- /** 桥源(形态冻结):富形态 → 桥形状投影(demand meta title/description 剥离——桥面无此字段,
1512
+ /** 桥源(形态冻结):富形态 → 桥形状投影(demand meta name/description 剥离——桥面无此字段,
1345
1513
  * additive 差异声明见 app-sdk 桥 golden) */
1346
1514
  declare function loadProviderCatalog(appDir: string): BridgeProviderCatalog;
1347
1515
  interface ProviderServiceSchemas {
@@ -1471,7 +1639,8 @@ interface WriteCore {
1471
1639
  warmup(): Promise<void>;
1472
1640
  /** PUT /app/integration(root 节点全集) */
1473
1641
  applyApp(node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
1474
- /** PUT /modules/:module/integration(domains 换算;N1 {} 删域键;v4.4 D34 写守卫单源) */
1642
+ /** PUT /modules/:module/integration(v6 modules[owner] 集成位;键集纪律见 MODULE_INTEGRATION_NODE_KEYS;
1643
+ * N1 {} 清 provider/config 保 resources;moduleOwnershipWritable 写守卫单源) */
1475
1644
  applyModule(moduleId: string, node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
1476
1645
  /** PUT /services/:service/integration(整节点含 instances map;N3 {} 不归一化;v4.4 A2 身份判据) */
1477
1646
  applyService(service: string, node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
@@ -1499,6 +1668,44 @@ interface MockBindingsResult {
1499
1668
  }
1500
1669
  declare function ensureMockBindings(appDir: string): MockBindingsResult;
1501
1670
 
1671
+ /**
1672
+ * 模块级联绑定单源(integrations v6 所有权模型——原 domain-binding.ts v4.4 F1/F3 重写)。
1673
+ * integrations 层落位依据:谓词(同层)/ 写核(同层)/ views(下层可向上 import)三向消费
1674
+ * 的唯一公共下层;import 前缀 guard 覆盖。
1675
+ *
1676
+ * 知识锚(module-tab note 单源锚表,v6 形态):
1677
+ * 模块级联(值 + 层) = resolveModuleBinding —— 谓词 #7(per-module 生效厂商 ≡
1678
+ * `modules[m].provider ?? root.provider`)/ deriveBindingLayer 模块级段 /
1679
+ * buildInheritance module 段 / binding(单数)
1680
+ * 归属表 = walk.ownership(单源聚合产物;buildOwnershipMap 桥直通——
1681
+ * registry 显式参 / 谓词 / 写守卫 / views 四消费方零第二实现)
1682
+ * 来源层四层推导 = deriveBindingLayer(views/service-resolutions,模块级段改调本文件)
1683
+ * 写通道可用性 = moduleOwnershipWritable —— configEditable 读标志 / applyModule 400 守卫
1684
+ * 共用(owns>0 唯一判据——多域归属合法化、共享键/多域判据随 D34 退役)
1685
+ */
1686
+ /** 归属表构建(walk 单源直通——sdk 桥 re-export 消费;appDir 直入对齐 loadProviderCatalog
1687
+ * 桥工效——模板装配第六行:`ownerOf: buildOwnershipMap(appDir)`)。 */
1688
+ declare function buildOwnershipMap(appDir: string): Record<string, string>;
1689
+ /** 模块级联绑定解析(值 + 来源层):provider 取非空字符串(模块级优先 → root 兜底;空串 = 缺席)。
1690
+ * layer:modules[moduleId].provider 声明 → 'module';root 兜底 → 'app';双缺 → null(binding 双缺诚实态)。 */
1691
+ declare function resolveModuleBinding(config: Record<string, unknown> | null, moduleId: string): {
1692
+ provider: string | null;
1693
+ layer: 'module' | 'app' | null;
1694
+ };
1695
+ /** 模块集成位可写性(v6 判别联合——configEditable 读标志与 applyModule 写守卫共用单源):
1696
+ * owns>0 唯一判据(D34 多域/shared-key 判据随 v6 退役——服务归属唯一真源 = declare.owns)。 */
1697
+ type ModuleOwnershipWritability = {
1698
+ writable: true;
1699
+ ownedServices: string[];
1700
+ } | {
1701
+ writable: false;
1702
+ reason: 'zero-ownership';
1703
+ ownedServices: [];
1704
+ };
1705
+ declare function moduleOwnershipWritable(_walk: Pick<WalkManifestsResult, 'modules' | 'catalog' | 'ownership'>, mod: WalkModuleInfo): ModuleOwnershipWritability;
1706
+ /** 供给足迹(该厂商全部供给服务并集——应用级 integrationSchemas 作用域,D32) */
1707
+ declare function providerFootprint(catalog: WalkCatalog, provider: string): string[];
1708
+
1502
1709
  /**
1503
1710
  * AppToolkitError(领域 6 码 + 壳层 2 码分界——toolkit 只产领域码):
1504
1711
  * VALIDATION_FAILED(400) / SERVICE_NOT_FOUND(404) / MODULE_NOT_FOUND(404) /
@@ -1532,6 +1739,11 @@ declare function contractsNotResolvedMessage(contracts: {
1532
1739
  * agtcodingbox / tbox-ai-coding 经 `import type` 消费(L2 DTO 单源——API 层零类型镜像)。
1533
1740
  * 词汇七概念:app / module / service / instance / provider / integration / resolution。
1534
1741
  * 弃用词汇清单见 api.md §3 尾(component/slot/scope/configMode/…——防复活)。
1742
+ *
1743
+ * **v7 词汇统一破例声明(一次性收敛,此后恢复 additive-only)**:标识/展示名分轴
1744
+ * (id = 标识、name = 展示名、description = 描述——对齐实例轴 {id, name}),
1745
+ * title 键全量退役(与 manifest name→id/title→name 同一变更);`.title` 消费方
1746
+ * (外部仓 import type / 运行时读)需同窗迁移。
1535
1747
  */
1536
1748
  /** contracts 求值五态原样(EffectiveServiceResolution.status) */
1537
1749
  type ServiceStatus = 'ok' | 'service-not-configured' | 'instance-not-found' | 'instance-disabled' | 'binding-unresolved';
@@ -1546,54 +1758,57 @@ interface ModulesView {
1546
1758
  interface ModuleDeclaration {
1547
1759
  /** install id(packages/ 目录名 / .tbox/app.json entry.id)——恒业务模块(provider 家族不在本清单) */
1548
1760
  id: string;
1549
- /** 包名 */
1761
+ /** 展示名(v7 词汇统一:manifest name ?? id——恒有值) */
1550
1762
  name: string;
1551
- title: string;
1552
1763
  description: string;
1553
1764
  }
1554
1765
  /** 服务需求声明(模块 demand 单元 / 平台服务条目——v4.4 D29 双端点同型;defaults 唯一落位 ServiceDetail) */
1555
1766
  interface ServiceDemand {
1556
1767
  service: string;
1557
- /** manifest demand meta;缺席 UI 回退 service id */
1558
- title?: string;
1768
+ /** manifest demand meta(v7 title→name);缺席 UI 回退 service id */
1769
+ name?: string;
1559
1770
  description?: string;
1560
1771
  /** demand optional === false(多模块 OR 聚合见 resolution echo;平台服务条目恒 false) */
1561
1772
  required: boolean;
1562
1773
  }
1563
1774
  /** GET /modules/:module(模块静态一站式 · PUT 读对偶) */
1564
1775
  interface ModuleDetailView {
1565
- /** v4.4 D34:demand 服务首段去重(排序;1..N;零域 = []) */
1566
- domainKeys: string[];
1567
- /** domains[换算键] 节点原值;未配置 = null;v4.4 D34:仅单域(writable)时在场——多域/零域/共享键无单键落点 */
1776
+ /** 模块展示名(v7 词汇统一:manifest name ?? id——恒有值) */
1777
+ name: string;
1778
+ /** B1 additive:模块 meta 描述(manifest description;兜底 '') */
1779
+ description: string;
1780
+ /** v6 所有权模型:模块归属服务(declare.owns 展平,排序;零归属 = [])——
1781
+ * v5 domainKeys 退役(破坏性更名;面板 presence-detection 双读义务见 api.md §3) */
1782
+ ownedServices: string[];
1783
+ /** modules[install id] 集成位原值(provider/config;resources 不投影);未配置 = null */
1568
1784
  integration: ModuleIntegrationNode | null;
1569
- /** v4.4 D34:每域一条厂商绑定解析(单域 = 单元素;零域 = [];resolveDomainBinding 单源) */
1570
- providerBindings: ProviderBinding[];
1571
- /** v4.4 D34:单域 && 域键无跨模块共享(moduleDomainWritable 单源——读标志与写守卫共用) */
1785
+ /** v6 单数化(v5 providerBindings[] 退役):模块级厂商绑定解析(resolveModuleBinding 单源;
1786
+ * 单值作用于全部 ownedServices) */
1787
+ binding: ModuleBinding | null;
1788
+ /** v6:owns.length > 0(moduleOwnershipWritable 单源——读标志与写守卫共用) */
1572
1789
  configEditable: boolean;
1573
- /** 本模块 demand(卡片展开 + 编辑器静态上下文自足) */
1790
+ /** 本模块 demand(declare.consumes;卡片展开 + 编辑器静态上下文自足) */
1574
1791
  services: ServiceDemand[];
1575
1792
  /** v4.4 D31:include=serviceResolutions 内嵌(demand 服务过滤 ≡ 批量 ?service= 语义;<0.9/形态异常 → null——永不 503) */
1576
1793
  serviceResolutions?: ServiceResolutionsView | null;
1577
- /** v4.4 D32:include=integrationSchemas 层级富化(多域/零域/共享键/未绑定 → null) */
1794
+ /** v4.4 D32:include=integrationSchemas 层级富化(零归属/未绑定 → null) */
1578
1795
  integrationSchemas?: LayerIntegrationSchemas | null;
1579
1796
  /** v4.6 D36:include=integrationFieldRegistry 集成字段注册表(null 语义镜像 integrationSchemas;
1580
1797
  * 未知厂商/零足迹 → 非 null 空集 + unsupplied 回填——D37 轴参假想计算同此) */
1581
1798
  integrationFieldRegistry?: IntegrationFieldRegistryView | null;
1582
1799
  }
1583
- /** 模块域厂商绑定解析(v4.4 D34——静态文件事实;规则 ≡ 谓词 #7 域级,resolveDomainBinding 单源) */
1584
- interface ProviderBinding {
1585
- /** 域键(= domainKeys 成员;多域模块每域一条) */
1586
- domain: string;
1587
- /** domains[domain].provider ?? root.provider(双缺 = null) */
1588
- effective: string | null;
1800
+ /** 模块级厂商绑定解析(v6——静态文件事实;规则 ≡ 谓词 #7 模块层,resolveModuleBinding 单源) */
1801
+ interface ModuleBinding {
1802
+ /** modules[install id].provider ?? root.provider(双缺 = null) */
1803
+ provider: string | null;
1589
1804
  /** 生效来源层(双缺 = null) */
1590
1805
  layer: 'module' | 'app' | null;
1591
1806
  }
1592
1807
  /** 层级 config schema 计算(v4.4 D32——静态轴富化,零 contracts) */
1593
1808
  interface LayerIntegrationSchemas {
1594
- /** 层生效厂商(resolveDomainBinding 单源) */
1809
+ /** 层生效厂商(resolveModuleBinding 单源) */
1595
1810
  provider: string;
1596
- /** 模块级 = 本模块 demand ∩ 该厂商供给;应用级 = 供给足迹全量(configSchema = raw draft 2020-12 原文;供给在场未声明 = null) */
1811
+ /** 模块级 = 本模块 ownedServices ∩ 该厂商供给;应用级 = 供给足迹全量(configSchema = raw draft 2020-12 原文;供给在场未声明 = null) */
1597
1812
  services: Record<string, {
1598
1813
  configSchema: object | null;
1599
1814
  }>;
@@ -1609,7 +1824,7 @@ interface IntegrationFieldRegistryView {
1609
1824
  unsupplied: string[];
1610
1825
  /** 作用域内全部非 null schema 的 additionalProperties 均 ≠ false(聚合;空真) */
1611
1826
  additionalPropertiesAllowed: boolean;
1612
- /** 逐 key 合并产物(首声明插入序 = scope 遍历序:app 字母序 / module demand 序) */
1827
+ /** 逐 key 合并产物(首声明插入序 = scope 遍历序:app 字母序 / module ownedServices 序) */
1613
1828
  fields: Array<{
1614
1829
  key: string;
1615
1830
  /** null = 类型不可调和(R3/R2 异构/R1 enum 不等——冲突折叠,客户端 RawJson 保真) */
@@ -1619,6 +1834,9 @@ interface IntegrationFieldRegistryView {
1619
1834
  service: string;
1620
1835
  required: boolean;
1621
1836
  }>;
1837
+ /** G 批:x-tbox-global 聚合旗标(sources.some——任一来源声明即 true;app/module 轴表单
1838
+ * 仅渲染 true 字段,非全局键落 ExtraFields;service 轴全量透传) */
1839
+ global: boolean;
1622
1840
  }>;
1623
1841
  }
1624
1842
  /** GET /app(应用静态视图:平台服务 + root 原值) */
@@ -1650,11 +1868,14 @@ interface ServiceDetail extends ServiceDemand {
1650
1868
  /** v4.7 D38:include=integrationSchemas 生效绑定富化(三态:null 全链未绑定 /
1651
1869
  * 绑定无可计算 schema / 含 schema;malformed 节点 → null——不放行域级联) */
1652
1870
  integrationSchemas?: ServiceIntegrationSchemas | null;
1871
+ /** G 批:include=integrationFieldRegistry 服务轴注册表(loadServiceFieldRegistry——
1872
+ * 四分支链推导复用 D38;fields = 该 schema 全部字段带 global 旗标;null 语义镜像 D38) */
1873
+ integrationFieldRegistry?: IntegrationFieldRegistryView | null;
1653
1874
  }
1654
1875
  /** 服务级生效绑定 schema(v4.7 D38 静态轴富化——零 contracts,永不 503;实例层无条件排除:
1655
1876
  * node 级口径 ≠ resolution 默认实例口径,api.md §4.4 注) */
1656
1877
  interface ServiceIntegrationSchemas {
1657
- /** 生效厂商:显式(含内联声明名)?? domains[首段].provider ?? root.provider */
1878
+ /** 生效厂商:显式(含内联声明名)?? modules[ownerOf].provider ?? root.provider */
1658
1879
  provider: string;
1659
1880
  /** catalog 复合键(多 impl 声明序首个)> 内联 ref;miss(未知厂商/未供给/内联缺 ref)→ null(富化非门控) */
1660
1881
  configSchema: object | null;
@@ -1719,14 +1940,18 @@ interface AppIntegrationNode {
1719
1940
  defaultInstanceId?: string | null;
1720
1941
  }
1721
1942
  /** AppIntegrationNode 键集单源(runtime const——write applyApp 全量替换白名单
1722
- * (缺席根键删除;services/domains/modules 域不在其中)+ views/app 投影(GET 预填 ≡ PUT body,
1723
- * D21/L1——文件含 services/domains 但 root 节点投影只含本键集)) */
1943
+ * (缺席根键删除;services/modules 域不在其中;v6 domains 键退役)+ views/app 投影
1944
+ * (GET 预填 ≡ PUT body,D21/L1——文件含 services/modules 但 root 节点投影只含本键集)) */
1724
1945
  declare const APP_INTEGRATION_NODE_KEYS: readonly ["provider", "config", "configByInstance", "credentialRef", "credentialRefByInstance", "instances", "defaultInstanceId"];
1725
- /** 模块域节点(恒字符串 provider——域层无凭据位,契约事实) */
1946
+ /** 模块集成位节点(v6——provider 绑定默认 + config 级联层;resources 不投影不写——
1947
+ * 集成位编辑恒保全资源节,N2) */
1726
1948
  interface ModuleIntegrationNode {
1727
1949
  provider?: string;
1728
1950
  config?: Record<string, unknown>;
1729
1951
  }
1952
+ /** ModuleIntegrationNode 可写键集单源(v6——write applyModule 全量替换白名单
1953
+ * (键集外 400;resources 恒随既有节点保全)+ views/modules 投影(GET ≡ PUT,三同构)) */
1954
+ declare const MODULE_INTEGRATION_NODE_KEYS: readonly ["provider", "config"];
1730
1955
  /** services[s] 整节点 */
1731
1956
  interface ServiceIntegrationNode {
1732
1957
  /** 对象 = 自定义 API(仅槽级,P2) */
@@ -1776,12 +2001,18 @@ interface ProviderEntry {
1776
2001
  local: boolean;
1777
2002
  /** 供给声明来源包名 */
1778
2003
  owner: string;
2004
+ /** 厂商展示名(v7 title→name:manifest name——多包首声明;缺席 = undefined) */
2005
+ name?: string;
2006
+ description?: string;
1779
2007
  }
1780
2008
  /** GET /providers/:provider:供给足迹 */
1781
2009
  interface ProviderDetail {
1782
2010
  provider: string;
1783
2011
  local: boolean;
1784
2012
  owner: string;
2013
+ /** 厂商展示名(同 ProviderEntry——首声明透传) */
2014
+ name?: string;
2015
+ description?: string;
1785
2016
  /** per (provider, service) 保真,同厂商异构合法;★ implementations 恒数组(H1——
1786
2017
  * 多元素 = 升级窗口,UI 出 impl 选择器,PUT 显式钉版) */
1787
2018
  services: Record<string, {
@@ -1789,6 +2020,9 @@ interface ProviderDetail {
1789
2020
  implementation: string;
1790
2021
  credentialType: string;
1791
2022
  }>;
2023
+ /** 服务展示名(resolveServiceDisplay——词汇 > demand > id;恒发) */
2024
+ name?: string;
2025
+ description?: string;
1792
2026
  /** v4.4 F5:include=integrationSchemas 切换态批量(纯 config——凭据结构归 /credential-types) */
1793
2027
  integrationSchemas?: {
1794
2028
  configSchema: object | null;
@@ -1875,7 +2109,7 @@ interface IntegrationIssue {
1875
2109
 
1876
2110
  /**
1877
2111
  * 视图装配共享上下文(五投影共用;目录枚举零缓存——walkManifests 每次调用执行)。
1878
- * 域前缀换算(service 首点段)自 v4.4 F1 迁 integrations/domain-binding.ts(本文件 re-export 保导入路径)。
2112
+ * v6:域前缀换算退役(domainOfService 随归属模型退场)——模块占用判定改 declare 三键直读。
1879
2113
  */
1880
2114
  interface ViewContext {
1881
2115
  appDir: string;
@@ -1893,16 +2127,16 @@ interface ViewSnapshot {
1893
2127
  declare function loadModulesView(snapshot: ViewSnapshot): {
1894
2128
  modules: ModuleDeclaration[];
1895
2129
  };
1896
- /** GET /modules/:module:模块静态一站式(integration 节点原值 + demand;PUT 读对偶) */
2130
+ /** GET /modules/:module:模块静态一站式(modules[install id] 集成位原值 + demand;PUT 读对偶) */
1897
2131
  declare function loadModuleDetailView(snapshot: ViewSnapshot, moduleId: string): ModuleDetailView;
1898
2132
 
1899
2133
  /**
1900
2134
  * 应用静态投影(views/app;C4;FX-1c B10——root 节点投影修;v4.4 D29——services 双端点同型)。
1901
2135
  * /app = 平台服务 + root 节点原值(纯静态):services = 服务词汇 − 模块占用
1902
- * (ServiceDemand[]——平台条目 required 恒 false、title/description 缺席,D29);
2136
+ * (ServiceDemand[]——平台条目 required 恒 false、name/description 缺席,D29);
1903
2137
  * 平台服务状态不在此(→ /service-resolutions);模块服务不在此(→ /modules/:m)。
1904
2138
  * integration = **root 节点投影**(APP_INTEGRATION_NODE_KEYS——D21/L1:GET 预填 ≡ PUT body;
1905
- * 文件另含 services/domains/modules 域键,不进 root 节点投影——原实现整文件透传,
2139
+ * 文件另含 services/modules 域键,不进 root 节点投影——原实现整文件透传,
1906
2140
  * PUT 回会级联写回域键);文件缺席 = null,文件在场 → 投影对象(可为空)。
1907
2141
  */
1908
2142
  declare function loadAppView(snapshot: ViewSnapshot): AppView;
@@ -1956,19 +2190,34 @@ declare function loadServiceResolutionDetail(service: string, snapshot: ViewSnap
1956
2190
  * 复合解析——v4.7 D38 收口,零新读取路径;供给在场未声明 = null,mock 合法) */
1957
2191
  declare function resolveLayerIntegrationSchemas(snapshot: ViewSnapshot, provider: string, services: readonly string[]): LayerIntegrationSchemas;
1958
2192
  declare function resolveLayerIntegrationSchemas(snapshot: ViewSnapshot, provider: string | null, services: readonly string[]): LayerIntegrationSchemas | null;
2193
+ /** D36 registry 构造(纯函数——消费 resolveLayerIntegrationSchemas 产物,禁旁路直取 serviceSchemas)。
2194
+ * fields 收集零过滤(布尔/非对象子 schema 入列,判定全权归 mergeFieldSources——S8 互证等式由
2195
+ * 收集定义结构性闭合);schemaless 仅 configSchema === null(布尔/畸形整 schema 防御跳过——
2196
+ * 不入 schemaless、零参与聚合;D32 运行时畸形,非契约面)。 */
2197
+ declare function buildIntegrationFieldRegistry(layer: LayerIntegrationSchemas, o?: {
2198
+ unsupplied?: string[];
2199
+ }): IntegrationFieldRegistryView;
2200
+ /** D37 生效厂商解析单源(实际/假想同径):override(非空串)?? 实际解析。
2201
+ * 空串归一(I3)单点;module 轴 v6 零归属 → null(override 不豁免——预览服务于保存)。 */
2202
+ declare function formProviderOf(axis: 'app' | 'module', snapshot: ViewSnapshot, moduleId?: string, override?: string): string | null;
1959
2203
  /** app 级 loader(v4.6 委托化——签名零改动,公开面保持;假想态归 loadAppFormViews override 参) */
1960
2204
  declare function loadAppIntegrationSchemas(snapshot: ViewSnapshot): LayerIntegrationSchemas | null;
1961
2205
  /** module 级 loader(v4.6 委托化——同上;多域/零域/共享键/未绑定 → 整字段 null,表单降级 = ExtraFields) */
1962
2206
  declare function loadModuleIntegrationSchemas(snapshot: ViewSnapshot, moduleId: string): LayerIntegrationSchemas | null;
1963
2207
  /** 服务级 loader(v4.7 D38):四分支穷举(node.provider = 文件 services[s].provider 逐字原值;
1964
2208
  * 实例层无条件排除——node 级口径);非空三分支归约一次复合解析。
1965
- * ① undefined/'' → resolveDomainBinding 域级联(域 + root 双缺 → 整字段 null)
2209
+ * ① undefined/'' → 模块级联(v6:modules[ownerOf[s]] root 双缺 → 整字段 null)
1966
2210
  * ② 非空 string → bare:catalog miss(未知厂商/未供给)→ configSchema:null 不 404(富化非门控)
1967
2211
  * ③ 受控内联(isControlledInlineProvider 单源)→ 名 = p.provider;catalog 复合键 > p.configSchema ref
1968
2212
  * (H9 逃逸 400 照抛——readInlineSchema 共享路径)
1969
2213
  * ④ 其余(null/数组/原始值/坏对象)→ 整字段 null(≡ 谓词 #5 INLINE_PROVIDER_INVALID 同判——
1970
2214
  * 不放行域级联,防错误 schema 污染坏节点) */
1971
2215
  declare function loadServiceIntegrationSchemas(snapshot: ViewSnapshot, service: string): ServiceIntegrationSchemas | null;
2216
+ /** G 批:服务轴字段注册表(D38 四分支链复用——消费 loadServiceIntegrationSchemas 单源;
2217
+ * 伪层 {provider, services: {[s]: {configSchema}}} → buildIntegrationFieldRegistry——
2218
+ * fields = 该 schema 全部字段带 global 旗标;configSchema null → schemaless=[service]
2219
+ * 非 null 空集;schemas 整体 null(全链未绑定/坏节点)→ registry null——镜像 D38 语义) */
2220
+ declare function loadServiceFieldRegistry(snapshot: ViewSnapshot, service: string): IntegrationFieldRegistryView | null;
1972
2221
 
1973
2222
  /**
1974
2223
  * 凭据状态轴投影(views/credentials;v4.4 D33 独立端点 GET /credentials):
@@ -2019,10 +2268,13 @@ interface AppToolkitOptions {
2019
2268
  /** 写成功(实际落盘且非 dryRun/no-diff)→ 调用一次(宿主闭包内防抖/守卫);CLI 不传恒 false */
2020
2269
  onApplied?: () => void;
2021
2270
  }
2022
- /** ── HTTP 直通面(11 读;L1 镜像律:方法名 = load + URL 资源段;query → 选项字段 L4)── */
2271
+ /** ── HTTP 直通面(11 读;L1 镜像律:方法名 = load + URL 资源段;query → 选项字段 L4)──
2272
+ * **双键契约(v7 词汇统一)**:资源路径参数双键寻址(id 优先、唯一展示名兜底——resolve-key
2273
+ * 单点;多命中 404 带候选);query 过滤参数(loadServiceResolutions services?)恒 id-only。 */
2023
2274
  interface AppToolkitRead {
2024
2275
  loadModules(): Promise<ModulesView>;
2025
- /** v4.6 D37:moduleProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include 键同现) */
2276
+ /** v4.6 D37:moduleProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include 键同现)。
2277
+ * moduleId = 双键(id 优先、唯一展示名兜底)。 */
2026
2278
  loadModule(moduleId: string, o?: {
2027
2279
  include?: string[];
2028
2280
  moduleProvider?: string;
@@ -2047,7 +2299,8 @@ interface AppToolkitRead {
2047
2299
  /** GET /credential-types[?provider=](v4.4 D33——供给轴静态;零门控,永不 503) */
2048
2300
  loadCredentialTypes(provider?: string): Promise<CredentialTypesView>;
2049
2301
  }
2050
- /** ── HTTP 直通面(4 写;body ≡ 文件节点全量替换;DELETE 无 dryRun/无 options)── */
2302
+ /** ── HTTP 直通面(4 写;body ≡ 文件节点全量替换;DELETE 无 dryRun/无 options)──
2303
+ * 双键契约(v7):路径键双键寻址(写侧 enqueue 闭包内解析——落盘键恒真实 id)。 */
2051
2304
  interface AppToolkitWrite {
2052
2305
  writeAppIntegration(node: AppIntegrationNode, o?: {
2053
2306
  dryRun?: boolean;
@@ -2097,4 +2350,4 @@ interface AppToolkitInternals {
2097
2350
  type AppToolkit = AppToolkitRead & AppToolkitWrite & AppToolkitInternals;
2098
2351
  declare function createAppToolkit(appDir: string, options?: AppToolkitOptions): AppToolkit;
2099
2352
 
2100
- export { APP_INTEGRATION_NODE_KEYS, type AppIntegrationNode, type AppManifest, type AppManifestFull, type AppToolkit, AppToolkitError, type AppToolkitErrorCode, type AppToolkitInternals, type AppToolkitOptions, type AppToolkitRead, type AppToolkitWrite, type AppView, type AppliedCredential, type BindingLayer, type BridgeProviderCatalog, type CardContrib, type ContractsResolution, type CredentialBindingEcho, type CredentialEcho, type CredentialFile, type CredentialInput, type CredentialTypeEntry, type CredentialTypesView, type CredentialValues, type CredentialsView, type DeclaredModuleInfo, type EffectiveBinding, type EnvExpansionResult, type EvaluationExports, type FileCache, type InlineVendorDeclaration, type IntegrationFieldRegistryView, type IntegrationIssue, type IntegrationServiceIssue, type IntegrationServicePredicateInput, type LayerIntegrationSchemas, type MiniappContainerEntry, type MockBindingsResult, type ModuleDeclaration, type ModuleDescriptor, type ModuleDetailView, type ModuleIntegrationNode, type ModuleMode, type ModulesView, type NpmModuleEntry, type OrphanIssue, type ParseModuleResult, type PlannedCredential, type PredicateAssembly, type PredicateContracts, type PredicateIoInputs, type ProviderBinding, type ProviderDetail, type ProviderEntry, type ProviderServiceDetail, type ProviderServiceSchemas, type ProviderServiceSchemasResult, type ProviderSlotContrib, type ProvidersView, type ReadIntegrationsResult, type ResolvedContracts, type ResolvedInstance, type ResolvedModule, type ResourceNeedContrib, SAFE_NAME_PATTERN, type SaveResult, type ServiceDemand, type ServiceDetail, type ServiceInstanceNode, type ServiceIntegrationNode, type ServiceIntegrationSchemas, type ServiceNeedContrib, type ServiceResolution, type ServiceResolutionDetail, type ServiceResolutionEntry, type ServiceResolutionsView, type ServiceStatus, type StemInput, type SupplyLookup, type ViewContext, type ViewSnapshot, type WalkCatalog, type WalkManifestsResult, type WalkModuleInfo, type WalkProviderEntry, type WriteCore, type WriteCoreOptions, type WriteOptions, assertValidModuleId, buildPredicateAssembly, checkInstanceKeys, collectDeclaredModules, contractsNotResolvedMessage, createAppToolkit, createFileCache, createWriteCore, credentialArtifactExists, deepEqual, deriveStem, echoForRef, ensureDir, ensureMockBindings, evaluateIntegrationServices, expandEnvVars, extractModuleIdFromSource, invalidateContractsResolver, isControlledInlineProvider, isValidModuleId, loadAppIntegrationSchemas, loadAppView, loadCredentialTypesView, loadCredentialsView, loadModuleDetailView, loadModuleIntegrationSchemas, loadModulesView, loadProviderCatalog, loadProviderCatalogRaw, loadProviderDetailView, loadProviderServiceDetailView, loadProvidersView, loadServiceDetailView, loadServiceIntegrationSchemas, loadServiceResolutionDetail, loadServiceResolutionsView, manifestPath, maskCredentialValues, moduleDependencySchema, moduleDescriptorSchema, pageContribSchema, parseModuleDescriptor, providerSlotContribSchema, readAppManifest, readAppManifestFull, readCredentialFile, readIntegrationsConfig, readIntegrationsStrict, reconcileOrphanCredentials, refToEnvKey, removeNpmModule, resolveContractsForApp, resolveContractsForApp as resolveContractsForAppExport, resolveLayerIntegrationSchemas, resolveServiceSummary, resourceNeedContribSchema, serviceNeedContribSchema, stemToFilePath, stemToRef, tabContribSchema, updateNpmModule, upsertMiniappContainer, upsertNpmModule, walkManifests, writeAppManifest, writeAtomic, writeCredentialFile };
2353
+ export { APP_INTEGRATION_NODE_KEYS, type AppIntegrationNode, type AppManifest, type AppManifestFull, type AppToolkit, AppToolkitError, type AppToolkitErrorCode, type AppToolkitInternals, type AppToolkitOptions, type AppToolkitRead, type AppToolkitWrite, type AppView, type AppliedCredential, type BindingLayer, type BridgeProviderCatalog, type CardContrib, type ContractsResolution, type CredentialBindingEcho, type CredentialEcho, type CredentialFile, type CredentialInput, type CredentialTypeEntry, type CredentialTypesView, type CredentialValues, type CredentialsView, type DeclarationIssue, type DeclaredModuleInfo, type EffectiveBinding, type EnvExpansionResult, type EvaluationExports, type FileCache, type InlineVendorDeclaration, type IntegrationFieldRegistryView, type IntegrationIssue, type IntegrationServiceIssue, type IntegrationServicePredicateInput, type LayerIntegrationSchemas, MODULE_INTEGRATION_NODE_KEYS, type MiniappContainerEntry, type MockBindingsResult, type ModuleBinding, type ModuleDeclaration, type ModuleDescriptor, type ModuleDetailView, type ModuleIntegrationNode, type ModuleMode, type ModuleOwnershipWritability, type ModulesView, type NpmModuleEntry, type OrphanIssue, type ParseModuleResult, type PlannedCredential, type PredicateAssembly, type PredicateContracts, type PredicateIoInputs, type ProviderDetail, type ProviderEntry, type ProviderServiceDetail, type ProviderServiceSchemas, type ProviderServiceSchemasResult, type ProviderSlotContrib, type ProvidersView, type PruneResult, type ReadIntegrationsResult, type ResolvedContracts, type ResolvedInstance, type ResolvedModule, type ResourceNeedContrib, SAFE_NAME_PATTERN, type SaveResult, type ServiceConsumeContrib, type ServiceDemand, type ServiceDetail, type ServiceInstanceNode, type ServiceIntegrationNode, type ServiceIntegrationSchemas, type ServiceOwnContrib, type ServiceResolution, type ServiceResolutionDetail, type ServiceResolutionEntry, type ServiceResolutionsView, type ServiceStatus, type SlotMeta, type StemInput, type SupplyLookup, type ViewContext, type ViewSnapshot, type WalkCatalog, type WalkManifestsResult, type WalkModuleInfo, type WalkProviderEntry, type WriteCore, type WriteCoreOptions, type WriteOptions, assertValidModuleId, buildIntegrationFieldRegistry, buildOwnershipMap, buildPredicateAssembly, checkInstanceKeys, collectDeclaredModules, contractsNotResolvedMessage, createAppToolkit, createFileCache, createWriteCore, credentialArtifactExists, deepEqual, deriveStem, echoForRef, ensureDir, ensureMockBindings, evaluateAppIntegrationIssues, evaluateIntegrationServices, expandEnvVars, extractModuleIdFromSource, formProviderOf, invalidateContractsResolver, isControlledInlineProvider, isValidModuleId, loadAppIntegrationSchemas, loadAppView, loadCredentialTypesView, loadCredentialsView, loadModuleDetailView, loadModuleIntegrationSchemas, loadModulesView, loadProviderCatalog, loadProviderCatalogRaw, loadProviderDetailView, loadProviderServiceDetailView, loadProvidersView, loadServiceDetailView, loadServiceFieldRegistry, loadServiceIntegrationSchemas, loadServiceResolutionDetail, loadServiceResolutionsView, manifestPath, maskCredentialValues, moduleDependencySchema, moduleDescriptorSchema, moduleOwnershipWritable, pageContribSchema, parseModuleDescriptor, providerFootprint, providerSlotContribSchema, pruneIntegrationBindings, readAppManifest, readAppManifestFull, readCredentialFile, readIntegrationsConfig, readIntegrationsStrict, reconcileOrphanCredentials, refToEnvKey, removeNpmModule, resolveContractsForApp, resolveContractsForApp as resolveContractsForAppExport, resolveLayerIntegrationSchemas, resolveModuleBinding, resolveModuleKey, resolveServiceKey, resolveServiceSummary, resourceNeedContribSchema, serviceConsumeContribSchema, serviceOwnContribSchema, stemToFilePath, stemToRef, tabContribSchema, updateNpmModule, upsertMiniappContainer, upsertNpmModule, walkManifests, writeAppManifest, writeAtomic, writeCredentialFile };