@tbox.cn/app-toolkit 0.4.0 → 0.6.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 (40) 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 +374 -150
  4. package/dist/index.js +9 -9
  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 +138 -85
  9. package/src/core/contracts-expected.ts +2 -2
  10. package/src/core/contracts-resolver.ts +12 -1
  11. package/src/core/module-schema.ts +90 -14
  12. package/src/dto.ts +80 -33
  13. package/src/factory.ts +78 -26
  14. package/src/index.ts +16 -7
  15. package/src/integrations/mock-bindings.ts +1 -1
  16. package/src/integrations/module-binding.ts +60 -0
  17. package/src/integrations/predicate-io.ts +26 -5
  18. package/src/integrations/predicate.ts +97 -57
  19. package/src/integrations/prune-bindings.ts +33 -14
  20. package/src/integrations/write.ts +47 -27
  21. package/src/views/app.ts +4 -4
  22. package/src/views/context.ts +15 -14
  23. package/src/views/integration-schemas.ts +76 -18
  24. package/src/views/modules.ts +93 -25
  25. package/src/views/providers.ts +5 -5
  26. package/src/views/service-detail.ts +1 -1
  27. package/src/views/service-resolutions.ts +14 -13
  28. package/tests/credentials-view.test.ts +2 -2
  29. package/tests/demo-app.ts +11 -6
  30. package/tests/dev-manifest-catalog.test.ts +14 -14
  31. package/tests/file-cache.test.ts +5 -5
  32. package/tests/module-resources.test.ts +148 -0
  33. package/tests/module-schema.test.ts +120 -20
  34. package/tests/resolve-key.test.ts +154 -0
  35. package/tests/vendor-schema-keywords.test.ts +74 -0
  36. package/tests/views.test.ts +585 -247
  37. package/tests/write-core.test.ts +117 -0
  38. package/dist/chunk-KPD3LUH4.js +0 -1
  39. package/dist/contracts-resolver-E4SECBOG.js +0 -1
  40. 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,9 +160,10 @@ 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;
142
- title: z.ZodOptional<z.ZodString>;
163
+ id: z.ZodString;
164
+ name: z.ZodOptional<z.ZodString>;
143
165
  description: z.ZodOptional<z.ZodString>;
166
+ hidden: z.ZodOptional<z.ZodBoolean>;
144
167
  version: z.ZodDefault<z.ZodString>;
145
168
  kind: z.ZodDefault<z.ZodEnum<["platform", "business", "third-party"]>>;
146
169
  risk: z.ZodDefault<z.ZodObject<{
@@ -160,7 +183,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
160
183
  }, {
161
184
  defaultMode?: "local" | "hybrid" | "sdk" | "codegen" | undefined;
162
185
  }>>;
163
- contributes: z.ZodDefault<z.ZodObject<{
186
+ declare: z.ZodDefault<z.ZodObject<{
164
187
  handlers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
165
188
  tools: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
166
189
  cards: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -247,7 +270,14 @@ declare const moduleDescriptorSchema: z.ZodObject<{
247
270
  credentialSchema?: string | undefined;
248
271
  }[] | undefined;
249
272
  }>>;
250
- services: z.ZodDefault<z.ZodArray<z.ZodObject<{
273
+ owns: z.ZodDefault<z.ZodArray<z.ZodObject<{
274
+ service: z.ZodString;
275
+ }, "strict", z.ZodTypeAny, {
276
+ service: string;
277
+ }, {
278
+ service: string;
279
+ }>, "many">>;
280
+ consumes: z.ZodDefault<z.ZodArray<z.ZodObject<{
251
281
  service: z.ZodString;
252
282
  optional: z.ZodDefault<z.ZodBoolean>;
253
283
  defaults: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -260,7 +290,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
260
290
  provider: string;
261
291
  implementation: string;
262
292
  }>, "many">>;
263
- title: z.ZodOptional<z.ZodString>;
293
+ name: z.ZodOptional<z.ZodString>;
264
294
  description: z.ZodOptional<z.ZodString>;
265
295
  }, "strip", z.ZodTypeAny, {
266
296
  service: string;
@@ -269,7 +299,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
269
299
  provider: string;
270
300
  implementation: string;
271
301
  }[];
272
- title?: string | undefined;
302
+ name?: string | undefined;
273
303
  description?: string | undefined;
274
304
  }, {
275
305
  service: string;
@@ -278,7 +308,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
278
308
  provider: string;
279
309
  implementation: string;
280
310
  }[] | undefined;
281
- title?: string | undefined;
311
+ name?: string | undefined;
282
312
  description?: string | undefined;
283
313
  }>, "many">>;
284
314
  resources: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -320,14 +350,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
320
350
  credentialSchema?: string | undefined;
321
351
  }[];
322
352
  };
323
- services: {
353
+ owns: {
354
+ service: string;
355
+ }[];
356
+ consumes: {
324
357
  service: string;
325
358
  optional: boolean;
326
359
  defaults: {
327
360
  provider: string;
328
361
  implementation: string;
329
362
  }[];
330
- title?: string | undefined;
363
+ name?: string | undefined;
331
364
  description?: string | undefined;
332
365
  }[];
333
366
  resources: {
@@ -363,14 +396,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
363
396
  credentialSchema?: string | undefined;
364
397
  }[] | undefined;
365
398
  } | undefined;
366
- services?: {
399
+ owns?: {
400
+ service: string;
401
+ }[] | undefined;
402
+ consumes?: {
367
403
  service: string;
368
404
  optional?: boolean | undefined;
369
405
  defaults?: {
370
406
  provider: string;
371
407
  implementation: string;
372
408
  }[] | undefined;
373
- title?: string | undefined;
409
+ name?: string | undefined;
374
410
  description?: string | undefined;
375
411
  }[] | undefined;
376
412
  resources?: {
@@ -408,7 +444,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
408
444
  env: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
409
445
  }, "strict", z.ZodTypeAny, {
410
446
  schemaVersion: number;
411
- name: string;
447
+ id: string;
412
448
  version: string;
413
449
  kind: "platform" | "business" | "third-party";
414
450
  risk: {
@@ -418,7 +454,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
418
454
  distribution: {
419
455
  defaultMode: "local" | "hybrid" | "sdk" | "codegen";
420
456
  };
421
- contributes: {
457
+ declare: {
422
458
  handlers: string[];
423
459
  tools: string[];
424
460
  cards: {
@@ -447,14 +483,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
447
483
  credentialSchema?: string | undefined;
448
484
  }[];
449
485
  };
450
- services: {
486
+ owns: {
487
+ service: string;
488
+ }[];
489
+ consumes: {
451
490
  service: string;
452
491
  optional: boolean;
453
492
  defaults: {
454
493
  provider: string;
455
494
  implementation: string;
456
495
  }[];
457
- title?: string | undefined;
496
+ name?: string | undefined;
458
497
  description?: string | undefined;
459
498
  }[];
460
499
  resources: {
@@ -470,13 +509,15 @@ declare const moduleDescriptorSchema: z.ZodObject<{
470
509
  }[];
471
510
  };
472
511
  env: string[];
473
- title?: string | undefined;
512
+ name?: string | undefined;
474
513
  description?: string | undefined;
514
+ hidden?: boolean | undefined;
475
515
  }, {
476
- name: string;
516
+ id: string;
477
517
  schemaVersion?: number | undefined;
478
- title?: string | undefined;
518
+ name?: string | undefined;
479
519
  description?: string | undefined;
520
+ hidden?: boolean | undefined;
480
521
  version?: string | undefined;
481
522
  kind?: "platform" | "business" | "third-party" | undefined;
482
523
  risk?: {
@@ -486,7 +527,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
486
527
  distribution?: {
487
528
  defaultMode?: "local" | "hybrid" | "sdk" | "codegen" | undefined;
488
529
  } | undefined;
489
- contributes?: {
530
+ declare?: {
490
531
  handlers?: string[] | undefined;
491
532
  tools?: string[] | undefined;
492
533
  cards?: {
@@ -515,14 +556,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
515
556
  credentialSchema?: string | undefined;
516
557
  }[] | undefined;
517
558
  } | undefined;
518
- services?: {
559
+ owns?: {
560
+ service: string;
561
+ }[] | undefined;
562
+ consumes?: {
519
563
  service: string;
520
564
  optional?: boolean | undefined;
521
565
  defaults?: {
522
566
  provider: string;
523
567
  implementation: string;
524
568
  }[] | undefined;
525
- title?: string | undefined;
569
+ name?: string | undefined;
526
570
  description?: string | undefined;
527
571
  }[] | undefined;
528
572
  resources?: {
@@ -542,7 +586,8 @@ declare const moduleDescriptorSchema: z.ZodObject<{
542
586
  type ModuleDescriptor = z.infer<typeof moduleDescriptorSchema>;
543
587
  type CardContrib = z.infer<typeof cardContribSchema>;
544
588
  type ProviderSlotContrib = z.infer<typeof providerSlotContribSchema>;
545
- type ServiceNeedContrib = z.infer<typeof serviceNeedContribSchema>;
589
+ type ServiceConsumeContrib = z.infer<typeof serviceConsumeContribSchema>;
590
+ type ServiceOwnContrib = z.infer<typeof serviceOwnContribSchema>;
546
591
  type ResourceNeedContrib = z.infer<typeof resourceNeedContribSchema>;
547
592
  type ParseModuleResult = {
548
593
  ok: true;
@@ -550,6 +595,7 @@ type ParseModuleResult = {
550
595
  } | {
551
596
  ok: false;
552
597
  errors: string[];
598
+ legacy?: true;
553
599
  };
554
600
  declare function parseModuleDescriptor(raw: unknown): ParseModuleResult;
555
601
 
@@ -697,14 +743,17 @@ interface ConfiguredService {
697
743
  instances?: Record<string, ServiceInstanceConfig>;
698
744
  }
699
745
  /**
700
- * 模块域全局配置(键 = 槽位域前缀,moduleDomainOf 派生;域 模块名——auth 域由登录链消费)。
701
- * 部署边界:单应用单厂商部署门禁不因 domains 表达力放开(混绑 die 原样)。
746
+ * 模块资源配置(integrations v6:modules 节 = 模块集成位——provider 绑定默认 + config
747
+ * 级联层 + v5 资源节三键合一;键 = install id(.tbox/app.json entry.id / packages/ 目录名;
748
+ * 仓内家族包恒等 manifest name 属规约)。provider/config 至少其一(空节点无意义)。
702
749
  */
703
- interface DomainConfig {
704
- /** 域级默认厂商(implementation 恒派生——域层无精确绑定语义) */
750
+ interface ModuleConfig {
751
+ /** 模块级默认厂商(v6 绑定组继承层——作用于该模块 declare.owns 的全部服务槽) */
705
752
  provider?: string;
706
- /** 域级共享配置(该域全部槽合并进 config 级联,与绑定来源层无关) */
753
+ /** 模块级共享配置(config 五层级联第三层:root ByInstance 之后、slot 之前) */
707
754
  config?: Record<string, unknown>;
755
+ /** resourceId → 类型化资源声明(resourceId 词汇真源 = 模块 manifest declare.resources) */
756
+ resources?: Record<string, ResourceSpec>;
708
757
  }
709
758
  /**
710
759
  * 部署实例(业务主体拓扑条目;root instances 注册表元素——v4 参考表)。
@@ -746,15 +795,12 @@ interface IntegrationsConfig {
746
795
  credentialRef?: string;
747
796
  /** 部署级 per-instance 默认凭据表(键 = instanceId;商户级凭据主写位) */
748
797
  credentialRefByInstance?: Record<string, string>;
749
- /** 模块域全局层(键 = moduleDomainOf(service);无 ByInstance——全链唯一 ByInstance 层恒 root) */
750
- domains?: Record<string, DomainConfig>;
751
798
  /** 部署实例注册表(参考表);缺席 = 无参考表;空数组非法(zod 拒——无表 = 键缺席唯一写法) */
752
799
  instances?: DeploymentInstance[];
753
800
  /** 默认实例 id(单实例免填;∈instances ids;无表时独立在场 = 动态默认形态) */
754
801
  defaultInstanceId?: string | null;
755
- /** 模块资源绑定(v5 新轴——与 domains 正交:domains = provider 绑定默认,modules = 资源绑定;
756
- * = install id(.tbox/app.json entry.id / packages/ 目录名;仓内家族包恒等 manifest name 属规约);
757
- * 无 per-instance 层(扩展位词汇预选 resourcesByInstance——instances 词恒属 services 激活语义) */
802
+ /** 模块集成位(v6:provider 绑定默认 + config 级联层 + v5 资源节三键合一;
803
+ * 顶层 domains 键已退役——旧键经 zod 防线拒收并指引 migrate modules[owner]) */
758
804
  modules?: Record<string, ModuleConfig>;
759
805
  services: Record<string, ConfiguredService>;
760
806
  }
@@ -762,7 +808,7 @@ interface IntegrationsConfig {
762
808
  interface EffectiveService {
763
809
  provider: string | InlineVendorDeclaration$1;
764
810
  implementation: string;
765
- /** 五层浅合并一层:root.config → root.configByInstance[k] → domain.config → slot.config → inst.config */
811
+ /** 五层浅合并一层:root.config → root.configByInstance[k] → modules[owner].config → slot.config → inst.config */
766
812
  config: Readonly<Record<string, unknown>>;
767
813
  credentialRef?: string;
768
814
  }
@@ -779,26 +825,34 @@ type EffectiveServiceResolution = {
779
825
  status: 'binding-unresolved';
780
826
  message: string;
781
827
  };
782
- /** 槽位域前缀(domains 键控轴):首个点号前段;无点号取整串。域 ≠ 模块名(auth 域由登录链消费)。 */
828
+ /**
829
+ * 槽位域前缀(首个点号前段;无点号取整串)。**v6 起退出级联**(modules[ownerOf] 取代
830
+ * domains 键控)——保留导出仅供词汇组织用途(guard/doctor 诊断消息按域聚合展示)。
831
+ * 域 ≠ 模块名(auth 域由登录链消费);归属语义唯一真源 = 模块 manifest declare.owns。
832
+ * @deprecated 级联键控已退役(v6 ownership 模型);新消费方禁用——归属查询走 ownerOf。
833
+ */
783
834
  declare function moduleDomainOf(service: string): string;
784
835
  /** 派生查表(buildSupplyLookup 产物):键 `${provider}\u0000${service}` → implementation 清单('id@version')。 */
785
836
  type SupplyLookup$1 = Record<string, readonly string[]>;
786
837
  /**
787
838
  * 级联细则(一句话:层序优先于 scope 特异度;层内 per-instance 胜标量):
788
- * - 绑定组(provider + implementation):最特异层整组取(inst > slot > domain > root)——
839
+ * - 绑定组(provider + implementation):最特异层整组取(inst > slot > modules[owner] > root)——
789
840
  * 独立 `??` 继承会产生跨层非法组合(inst.provider=wanda + 继承 slot 的 joycity impl),
790
841
  * 故组不可拆;组内 implementation 缺席 → supplies 派生(唯一命中;
791
842
  * 零命中/歧义/未注入查表 → binding-unresolved);双字段显式在场 = 显式即真值(不派生,
792
843
  * 存量全显式文件零影响)。内联声明仅槽级且必带 implementation(防御分支兜底)。
793
- * - config 五层浅合并:root.config root.configByInstance[k] domain.config → slot.config →
794
- * inst.config(service 标量胜 root ByInstance[k]——层序优先于 scope 特异度;
795
- * domain.config 恒参与该域全部槽,与绑定来源层无关)
844
+ * - ownerOf(v6):servicemoduleId 归属表(buildOwnershipMap 产物,装配期显式注入)。
845
+ * 服务无主 跳过 modules 层(≡ 平台槽语义);ownerOf 缺席且文件含 modules 级
846
+ * 绑定/配置 → binding-unresolved fail-visible(装配偏斜防线——防静默丢模块层语义)。
847
+ * - config 五层浅合并:root.config → root.configByInstance[k] → modules[owner].config →
848
+ * slot.config → inst.config(service 标量胜 root ByInstance[k]——层序优先于 scope 特异度;
849
+ * modules[owner].config 恒参与该模块 owns 全部服务槽,与绑定来源层无关)
796
850
  * - credentialRef:inst ?? slot ?? root.credentialRefByInstance[k] ?? root.credentialRef(v3 零改动;
797
- * domain 层无 credentialRef——链位预留 slot 后、root ByInstance 前)
851
+ * module 层无 credentialRef——链位预留 slot 后、root ByInstance 前)
798
852
  * 不抛领域错误;status 由 SDK registry 映射 PROVIDER_* 错误码
799
853
  * (binding-unresolved → PROVIDER_BINDING_UNRESOLVED;hasProviderBinding 点查 status !== 'ok' → false)。
800
854
  */
801
- declare function resolveEffectiveService(integrations: IntegrationsConfig, service: string, instanceId: string, supplies?: SupplyLookup$1): EffectiveServiceResolution;
855
+ declare function resolveEffectiveService(integrations: IntegrationsConfig, service: string, instanceId: string, supplies?: SupplyLookup$1, ownerOf?: Record<string, string>): EffectiveServiceResolution;
802
856
  /**
803
857
  * root 部署实例注册表归一化(v4 wire → 消费形态单源):
804
858
  * - instances 缺席 = 空表(无参考表——wanda 动态形态;空数组已在 zod 拒,此处纯防御);
@@ -827,7 +881,7 @@ interface CatalogProviderEntry {
827
881
  /** 供给槽清单(service id) */
828
882
  services: string[];
829
883
  }
830
- /** catalog 需求侧聚合条目(模块 manifest contributes.services 元素聚合;services 键 = service id) */
884
+ /** catalog 需求侧聚合条目(模块 manifest declare.consumes 元素聚合;services 键 = service id) */
831
885
  interface CatalogServiceEntry {
832
886
  /** 可选槽(未配置不 error——doctor warning 级) */
833
887
  optional: boolean;
@@ -868,11 +922,6 @@ interface KnowledgeResourceSpec {
868
922
  }
869
923
  /** 资源声明(discriminated by type;SDK zod / CLI doctor / 未来 app-toolkit 共用 wire 形状) */
870
924
  type ResourceSpec = KnowledgeResourceSpec;
871
- /** 模块资源配置(modules 节元素;strict 单字段——provider/config/instances 进 modules 即非法,防与 domains 双写位) */
872
- interface ModuleConfig {
873
- /** resourceId → 类型化资源声明(resourceId 词汇真源 = 模块 manifest contributes.resources) */
874
- resources: Record<string, ResourceSpec>;
875
- }
876
925
 
877
926
  /**
878
927
  * contracts 期望面编译期锁(satisfies 语义防接口漂移——contracts 加名/改签名即编译红)。
@@ -880,11 +929,11 @@ interface ModuleConfig {
880
929
  * contracts 恒 devDep 且限 import type——运行时全经 resolver 动态 import(版本解耦,D3)。
881
930
  */
882
931
  interface EvaluationExports {
883
- /** 求值单源(TIER0;v3 显式激活 vs v4 通配语义随应用版本) */
932
+ /** 求值单源(TIER0;v3 显式激活 vs v4 通配语义随应用版本;v6 第五参 ownerOf) */
884
933
  resolveEffectiveService: typeof resolveEffectiveService;
885
934
  /** 供给查表派生(谓词 #12 与视图供给轴共用输入) */
886
935
  buildSupplyLookup: typeof buildSupplyLookup;
887
- /** service → 首点段域前缀(谓词 #14 域键匹配) */
936
+ /** service → 首点段域前缀(v6 deprecated——级联键控退役,仅词汇组织消费) */
888
937
  moduleDomainOf: typeof moduleDomainOf;
889
938
  /** 部署实例注册表归一(默认实例委托——null → '*' 通配口径) */
890
939
  normalizeInstances: typeof normalizeInstances;
@@ -929,6 +978,9 @@ interface ResolvedContracts {
929
978
  evaluation: boolean;
930
979
  /** 严格 zod 面可用(parseIntegrationsConfig 在场——≥0.9 门控判据) */
931
980
  strictValidation: boolean;
981
+ /** v6 形状标记在场(OWNERSHIP_BINDING_V6——modules[owner] 绑定形状支持;标记门 P1:
982
+ * v5 contracts + v6 toolkit 偏斜 → 503 第四分支,防静默忽略 ownerOf) */
983
+ ownershipBindingV6: boolean;
932
984
  /** 动态 import 产物(命名导出子集——Partial<EvaluationExports>) */
933
985
  module: ResolvedModule;
934
986
  /** 解析诊断(N1 构建指引 message 三分支的输入:未安装 / 版本 <0.9 / 源码态未构建) */
@@ -958,19 +1010,24 @@ declare function invalidateContractsResolver(appDir?: string): void;
958
1010
  * IMPL_WITHOUT_PROVIDER #5/#13 error impl-only(implementation 缺 provider 绑定组头)
959
1011
  * INLINE_PROVIDER_INVALID #5 error 内联厂商声明超受控形状(槽级/实例级)
960
1012
  * SCHEMA_FILE_MISSING #6 error credentialType schema 引用不存在
961
- * DOMAIN_CONFIG_INVALID #7 error root/domains 死配置(键 ∉ 引用厂商 schema properties;
1013
+ * DOMAIN_CONFIG_INVALID #7 error root/modules 死配置(键 ∉ 引用厂商 schema properties;
962
1014
  * api.md DOMAIN_CONFIG_UNUSED 行预留 warning 级,
963
1015
  * 现行为 error 恒等旧谓词——doctor 门控等价)
964
1016
  * INSTANCE_KEY_NOT_REGISTERED #8 error ByInstance 键/实例键 ∉ 注册表白名单
965
1017
  * REALM_SWITCH_HINT #9 warning 实现覆盖跨厂商(凭据域切换确认)
966
1018
  * WILDCARD_ALIGNMENT #10 warning 通配形态齐步提示
967
1019
  * MULTI_INSTANCE_NO_DEFAULT v4 warning 多实例无 defaultInstanceId(无 scope 访问落全局会话)
968
- * VENDOR_NOT_INSTALLED #11 error root/domains 厂商未命中已装供给
1020
+ * VENDOR_NOT_INSTALLED #11 error root/modules 厂商未命中已装供给
969
1021
  * BINDING_UNRESOLVED #12 error 绑定不可解析(resolveEffectiveService 求值失败)
970
- * DOMAIN_KEY_UNMATCHED #14 warning domains 匹配域集(typo)
1022
+ * IMPL_WITHOUT_PROVIDER #5/#13 error impl-only(implementation provider 绑定组头)
971
1023
  * RESOURCE_TYPE_UNKNOWN #15 error modules 资源节 type ∉ 词汇表
972
1024
  * RESOURCE_NOT_DECLARED #16 warning 资源键/资源 id ∉ 模块声明集
1025
+ * MODULE_CONFIG_DEAD v6 error modules[m](未安装 ∨ owns=0)携带 provider/config
1026
+ * (统一吸收原「#16 升级」特例——P2 一码一义)
1027
+ * GLOBAL_FIELD_UNDECLARED #17 warning 全局层键过 #7 但 ∉ 引用厂商 x-tbox-global 并集(G 批;
1028
+ * 零声明厂商整体跳过——#7 同遍历双判定,P4)
973
1029
  * ORPHANED_CREDENTIAL 写后对账 warning 凭据文件不再被引用(toolkit 写路径产出,非本谓词)
1030
+ * (v6 退役:DOMAIN_KEY_UNMATCHED #14——domains 键随归属模型退场)
974
1031
  *
975
1032
  * 输入形状(调用方负责装载):
976
1033
  * - integrations:config/integrations.json 解析产物(宽松 Record 透传——严格 zod 校验归模板 loader)
@@ -987,33 +1044,32 @@ declare function invalidateContractsResolver(appDir?: string): void;
987
1044
  * 继承绑定(槽级 provider 缺席)经 effective 求值取厂商——supplies 在场时)
988
1045
  * #5 实例 impl-only 禁止 + 覆盖命中供给(含槽级内联形状;provider-only = 派生位,合法)
989
1046
  * #6 manifest configSchema/credentialSchema 引用文件存在性(内联与 manifest 绑定同查)
990
- * #7 root/domains 死配置:root.config/configByInstance/domains[d].config 键 ⊆ 引用厂商(并集)
991
- * 各槽 schema properties——引用面 = root.provider ∪ domains.*.provider ∪ 槽级(terse 化防退化)
1047
+ * #7 root/modules 死配置:root.config/configByInstance/modules[m].config 键 ⊆ 引用厂商(并集)
1048
+ * 各槽 schema properties——引用面 = root.provider ∪ modules.*.provider ∪ 槽级(terse 化防退化);
1049
+ * modules 层 per-module 生效厂商 = resolveModuleBinding 单源(≡ modules[m].provider ?? root.provider)
992
1050
  * #8 ByInstance/实例键 ∈ malls 白名单(v4:源 = root instances 注册表 ids——参考表在场时
993
- * 激活;'**' 通配键豁免;注册表缺席 → 跳过;domains 键 = 域前缀非 instanceId,不适用)
1051
+ * 激活;'**' 通配键豁免;注册表缺席 → 跳过;modules 键 = install id 非 instanceId,不适用)
994
1052
  * #9 实现覆盖跨厂商提示(realm switch——凭据域切换确认)
995
- * #11 root/domains 厂商未命中已装供给(vendor 集合 = suppliedProviders 键前缀展开)
1053
+ * #11 root/modules 厂商未命中已装供给(vendor 集合 = suppliedProviders 键前缀展开)
996
1054
  * #12 绑定可解析性:逐 (service, instanceId) 经 contracts resolveEffectiveService 求值
997
- * (级联单源复用,谓词零级联实现),binding-unresolved → error(supplies 缺席 → 跳过)
1055
+ * (级联单源复用,谓词零级联实现;v6 ownerOf=ownership 显式参透传),binding-unresolved → error
998
1056
  * #13 槽级/实例级 impl-only(implementation 需伴随 provider——provider 是绑定组头;
999
1057
  * zod 之外的第二道防线——doctor 读裸 JSON)
1000
- * #14 domains 匹配域集(已配置槽 需求声明的 moduleDomainOf 并集;typo → warning)
1001
- * #15-#16 modules 资源节对账(v5):type RESOURCE_TYPE_IDS error(裸 JSON 预启动反馈);
1002
- * 已装模块 id / 资源 id模块 manifest contributes.resources 声明集(声明非空时)
1003
- * warning(moduleResourceNeeds 缺席 需求面检查跳过,M3 降级先例)
1058
+ * MODULE_CONFIG_DEAD:modules[m] 携带 provider/config 且(m installedModuleIds ownership
1059
+ * 无任何 service 归属 m)→ error(键级 #16 warning 与本检查可同节点共发——键级 vs 值级不同断言面)
1060
+ * #17(G 批):与 #7 同遍历双判定(P4)——键 schema properties x-tbox-global 并集
1061
+ * warning;引用厂商零全局声明(集空/缺席)→ 该厂商键整体跳过;检查序在 MODULE_CONFIG_DEAD
1062
+ * #15-#16 modules 资源节对账(v5 延续):type ∉ RESOURCE_TYPE_IDS → error;键 ∉ 已装模块 id 集 /
1063
+ * 资源 id ∉ 模块 manifest declare.resources 声明集 → warning
1004
1064
  */
1005
1065
 
1006
1066
  /** contracts 注入面(resolver 装配产物运行时视图 = EvaluationExports 求值子集) */
1007
- type PredicateContracts = Pick<EvaluationExports, 'resolveEffectiveService' | 'buildSupplyLookup' | 'moduleDomainOf' | 'normalizeInstances' | 'RESOURCE_TYPE_IDS'>;
1067
+ type PredicateContracts = Pick<EvaluationExports, 'resolveEffectiveService' | 'buildSupplyLookup' | 'normalizeInstances' | 'RESOURCE_TYPE_IDS'>;
1008
1068
  /** 派生查表形状(contracts buildSupplyLookup 产物;结构等价 TIER0 SupplyLookup——谓词零 contracts 静态依赖) */
1009
1069
  type SupplyLookup = Record<string, readonly string[]>;
1010
1070
  interface IntegrationServicePredicateInput {
1011
1071
  integrations: {
1012
1072
  provider?: string;
1013
- domains?: Record<string, {
1014
- provider?: string;
1015
- config?: Record<string, unknown>;
1016
- }>;
1017
1073
  config?: Record<string, unknown>;
1018
1074
  configByInstance?: Record<string, Record<string, unknown>>;
1019
1075
  credentialRef?: string;
@@ -1038,8 +1094,10 @@ interface IntegrationServicePredicateInput {
1038
1094
  }>;
1039
1095
  /** v4 默认实例(normalizeInstances 解析语义:显式 ?? 单候选唯一解) */
1040
1096
  defaultInstanceId?: string | null;
1041
- /** v5 模块资源绑定(modules 节——宽松透传;严格 zod 归模板 loader) */
1097
+ /** v6 模块集成位(modules 节三键——宽松透传;严格 zod 归模板 loader) */
1042
1098
  modules?: Record<string, {
1099
+ provider?: string;
1100
+ config?: Record<string, unknown>;
1043
1101
  resources?: Record<string, {
1044
1102
  type?: unknown;
1045
1103
  }>;
@@ -1058,12 +1116,20 @@ interface IntegrationServicePredicateInput {
1058
1116
  }>;
1059
1117
  /** 派生查表(buildSupplyLookup 产物;缺席 → #12 跳过 + #2 继承绑定不查 credentialType) */
1060
1118
  supplies?: SupplyLookup;
1119
+ /** v6 服务归属表(walk.ownership——#12 ownerOf 透传 + MODULE_CONFIG_DEAD owns=0 判据;
1120
+ * 缺席 = 归属面不可判 → MODULE_CONFIG_DEAD 退化为仅「未安装」分支) */
1121
+ ownership?: Record<string, string>;
1122
+ /** v6 已装模块 id 集(.tbox/app.json entry.id ∪ packages/ 目录名;缺席 → 「未安装」分支跳过) */
1123
+ installedModuleIds?: ReadonlySet<string>;
1061
1124
  /** malls 白名单(deployments 控制面 extract;缺席 → ByInstance 键检查跳过) */
1062
1125
  malls?: string[];
1063
1126
  /** credentialType → schema 文件引用缺失(manifest 声明指向缺失文件;#6) */
1064
1127
  credentialSchemaMissing?: Record<string, boolean>;
1065
1128
  /** 厂商 → 槽 schema properties 键集(#7 用;调用方从 manifest configSchema 引用解析) */
1066
1129
  vendorConfigKeys?: Record<string, Set<string>>;
1130
+ /** G 批:厂商 → x-tbox-global 标记键集(#17 用;#7 同循环收集——零新增 IO);
1131
+ * 缺席/空集 = 该厂商零声明 → #17 对其键整体跳过 */
1132
+ vendorGlobalConfigKeys?: Record<string, Set<string>>;
1067
1133
  /** 厂商 → configSchema 引用文件缺失(#7 跳过该厂商——无 schema 不能判死配置) */
1068
1134
  vendorConfigSchemaMissing?: Record<string, boolean>;
1069
1135
  /** 凭据文件缺失(#1:credentialRef stem → 档内 credentials/<stem>.json 在场;域中立注入) */
@@ -1072,7 +1138,7 @@ interface IntegrationServicePredicateInput {
1072
1138
  credentialFileType?: Record<string, string | undefined>;
1073
1139
  /** #9:实现覆盖跨厂商提示位(CLI 侧组装) */
1074
1140
  realmSwitchHints?: string[];
1075
- /** v5:已装模块 id → manifest contributes.resources 声明 id 集(值空集 = 无声明,资源级跳过;
1141
+ /** v5:已装模块 id → manifest declare.resources 声明 id 集(值空集 = 无声明,资源级跳过;
1076
1142
  * 缺席 = 无需求面信息——键未知/资源未声明检查跳过,type 检查恒跑) */
1077
1143
  moduleResourceNeeds?: Record<string, ReadonlySet<string>>;
1078
1144
  }
@@ -1107,7 +1173,7 @@ declare function evaluateIntegrationServices(input: IntegrationServicePredicateI
1107
1173
  *
1108
1174
  * manifest 候选路径探测(packages/<id>/tbox.module.json 优先 → node_modules/<pkg>/tbox.module.json;
1109
1175
  * tbox-app dev 真身经 .tbox-dev.local/dev-manifest.json redirects 独立 catalog 通道直达)一次遍历同时产出:
1110
- * 1. modules:已装模块清单(declared;demand meta title/description 透传)
1176
+ * 1. modules:已装模块清单(declared;demand meta name/description 透传)
1111
1177
  * 2. catalog(富形态):providers 嵌套(vendor→impl→entry,per-service {implementation, credentialType}
1112
1178
  * 保真——同厂商异构/多实现合法,D25/H1)+ 需求侧聚合
1113
1179
  * 3. serviceSchemas:per-service schema 复合键表——键 `${provider}\u0000${service}`(H2,同一服务
@@ -1118,10 +1184,12 @@ declare function evaluateIntegrationServices(input: IntegrationServicePredicateI
1118
1184
  * ③ 候选自身 {service-slots.json, src/service-slots.json}(local/codegen 全量副本——
1119
1185
  * mall 生成应用主形态,不依赖 install);零缓存枚举,与 manifest 探测同机制;
1120
1186
  * 多行业 contracts-* 天然扩展 F8);缺席 → [](退化 demanded ∪ configured)
1121
- * 5. slotMeta:词汇 meta 节(per-service {title,description} 展示元数据——消费端兜底链
1187
+ * 5. slotMeta:词汇 meta 节(per-service {name,description} 展示元数据——消费端兜底链
1122
1188
  * 词汇 > demand > id,views/context resolveServiceDisplay 单源);多包发现序首声明胜出
1123
1189
  * (与 catalog addSlots 同语义);contracts-mall 词汇锁保证 mall 域全量覆盖;缺席 → {}
1124
- * 6. domainKeyIssues:跨模块域键冲突 issue(两模块派生同一 domains 键——P13)
1190
+ * 6. ownership:service moduleId 归属表(v6——declare.owns 聚合;install id 键控;
1191
+ * 双 owner 冲突 → declarationIssues OWNERSHIP_CONFLICT + 先声明胜出)
1192
+ * 7. declarationIssues:声明面诊断(OWNERSHIP_CONFLICT / OLD_MANIFEST_KEY——P3 通道)
1125
1193
  *
1126
1194
  * **约束(D26;FX-3/F7 边界)**:目录枚举零缓存——readdir / node_modules 候选探测 / `.tbox/app.json` 读取 /
1127
1195
  * dev-manifest 读取每次执行(枚举输入保持 fresh——agent 装卸模块下一笔即见);manifest/service-slots
@@ -1129,6 +1197,18 @@ declare function evaluateIntegrationServices(input: IntegrationServicePredicateI
1129
1197
  * CLI 传 undefined 即全 fresh)。
1130
1198
  * 宽松解析语义(坏文件静默 + 重复键首声明保留)零改动。
1131
1199
  */
1200
+ /** 声明面诊断(v6 P3 通道——OWNERSHIP_CONFLICT / OLD_MANIFEST_KEY;error 级) */
1201
+ type DeclarationIssue = {
1202
+ severity: 'error';
1203
+ code: 'OWNERSHIP_CONFLICT';
1204
+ message: string;
1205
+ module?: string;
1206
+ } | {
1207
+ severity: 'error';
1208
+ code: 'OLD_MANIFEST_KEY';
1209
+ message: string;
1210
+ module?: string;
1211
+ };
1132
1212
  interface WalkManifestsResult {
1133
1213
  /** declared 产物(install id + descriptor;demand meta 透传) */
1134
1214
  modules: WalkModuleInfo[];
@@ -1142,19 +1222,17 @@ interface WalkManifestsResult {
1142
1222
  }>;
1143
1223
  /** 服务词汇 = 所有携带 service-slots.json 的已装契约包 `.slots` 键并集(缺席 → []) */
1144
1224
  vocabulary: string[];
1145
- /** 词汇 meta 节:per-service {title,description} 展示元数据(多包首声明胜出;缺席 → {}) */
1225
+ /** 词汇 meta 节:per-service {name,description} 展示元数据(多包首声明胜出;缺席 → {}) */
1146
1226
  slotMeta: Record<string, SlotMeta>;
1147
- /** 跨模块域键冲突(P13——两模块的 service 集派生同一 domains 键) */
1148
- domainKeyIssues: Array<{
1149
- severity: 'warning';
1150
- code: 'DOMAIN_KEY_CONFLICT';
1151
- message: string;
1152
- module?: string;
1153
- }>;
1227
+ /** v6 服务归属表:service moduleId(install id 键控——integrations modules 节键同轴;
1228
+ * 双 owner 冲突 → declarationIssues + 先声明胜出;dev 通道以 manifest id 参与归属) */
1229
+ ownership: Record<string, string>;
1230
+ /** 声明面诊断(OWNERSHIP_CONFLICT / OLD_MANIFEST_KEY) */
1231
+ declarationIssues: DeclarationIssue[];
1154
1232
  }
1155
- /** 槽位展示元数据(service-slots.json meta 节元素——宽松提取,字段皆可选) */
1233
+ /** 槽位展示元数据(service-slots.json meta 节元素——宽松提取,字段皆可选;v7 词汇统一 title→name) */
1156
1234
  interface SlotMeta {
1157
- title?: string;
1235
+ name?: string;
1158
1236
  description?: string;
1159
1237
  }
1160
1238
  interface WalkModuleInfo {
@@ -1167,15 +1245,15 @@ interface WalkModuleInfo {
1167
1245
  descriptor: ModuleDescriptor;
1168
1246
  }
1169
1247
  /** 富形态供给条目:per-service {implementation, credentialType} 恒数组保真(H1);
1170
- * title/description = 厂商展示元数据(strict manifest descriptor 透传——多包同厂商
1171
- * 首声明胜出,与 owner 同语义;B1 walk 层传播) */
1248
+ * name/description = 厂商展示元数据(strict manifest descriptor 透传——多包同厂商
1249
+ * 首声明胜出,与 owner 同语义;B1 walk 层传播;v7 词汇统一 title→name) */
1172
1250
  interface WalkProviderEntry {
1173
1251
  provider: string;
1174
1252
  implementation: string;
1175
1253
  credentialType: string;
1176
1254
  owner: string;
1177
- /** 厂商展示名(manifest 模块 meta——多包首声明;缺席 = undefined) */
1178
- title?: string;
1255
+ /** 厂商展示名(manifest name——多包首声明;缺席 = undefined) */
1256
+ name?: string;
1179
1257
  description?: string;
1180
1258
  local?: boolean;
1181
1259
  configSchema?: string;
@@ -1190,8 +1268,8 @@ interface WalkCatalog {
1190
1268
  provider: string;
1191
1269
  implementation: string;
1192
1270
  }>;
1193
- /** demand meta(title/description 首声明保留——模块 manifest demand 侧 additive) */
1194
- title?: string;
1271
+ /** demand meta(name/description 首声明保留——模块 manifest demand 侧 additive;v7 title→name) */
1272
+ name?: string;
1195
1273
  description?: string;
1196
1274
  owners: string[];
1197
1275
  }>;
@@ -1247,16 +1325,18 @@ interface PredicateIoInputs {
1247
1325
  credentialSchemaMissing: Record<string, boolean>;
1248
1326
  /** #7:厂商 → configSchema properties 键集并集 */
1249
1327
  vendorConfigKeys: Record<string, Set<string>>;
1328
+ /** #17(G 批):厂商 → x-tbox-global 标记键集(与 vendorConfigKeys 同循环收集——零新增 IO) */
1329
+ vendorGlobalConfigKeys: Record<string, Set<string>>;
1250
1330
  /** #7:厂商 → configSchema 引用缺失(跳过该厂商死配置判定) */
1251
1331
  vendorConfigSchemaMissing: Record<string, boolean>;
1252
1332
  /** #9:实现覆盖跨厂商提示文案(已成形——谓词直投) */
1253
1333
  realmSwitchHints: string[];
1254
1334
  /** #8:root instances 注册表 ids(在场才传;缺席 → 键检查跳过) */
1255
1335
  malls?: string[];
1256
- /** #15-#16:已装模块 id → manifest contributes.resources 声明 id 集 */
1336
+ /** #15-#16:已装模块 id → manifest declare.resources 声明 id 集 */
1257
1337
  moduleResourceNeeds: Record<string, ReadonlySet<string>>;
1258
1338
  }
1259
- /** 装配全产物(= PredicateIoInputs + 供给/需求聚合——喂 evaluateIntegrationServices 的
1339
+ /** 装配全产物(= PredicateIoInputs + 供给/需求/归属聚合——喂 evaluateIntegrationServices 的
1260
1340
  * 非 contracts/integrations 入参全集,两消费方 spread 直投,零各自组装) */
1261
1341
  interface PredicateAssembly extends PredicateIoInputs {
1262
1342
  suppliedProviders: Record<string, {
@@ -1268,6 +1348,9 @@ interface PredicateAssembly extends PredicateIoInputs {
1268
1348
  optional: boolean;
1269
1349
  owners: string[];
1270
1350
  }>;
1351
+ /** v6:服务归属表 + 已装模块 id 集(MODULE_CONFIG_DEAD / #12 ownerOf 透传) */
1352
+ ownership?: Record<string, string>;
1353
+ installedModuleIds?: ReadonlySet<string>;
1271
1354
  }
1272
1355
  /** stem → env 键(kebab → UPPER_SNAKE;与 SDK/provider-secret env 兜底同公式) */
1273
1356
  declare function refToEnvKey(stem: string): string;
@@ -1296,14 +1379,16 @@ declare function evaluateAppIntegrationIssues(appDir: string, integrations: Reco
1296
1379
  *
1297
1380
  * 不变式:**删除判据 ≡ doctor integration-services 报错判据(构造性同源)**——消费 doctor 同一
1298
1381
  * 共享求值器 evaluateAppIntegrationIssues 的结构化 issue,code 白名单
1299
- * {VENDOR_NOT_INSTALLED, BINDING_UNRESOLVED} + 守卫(绑定引用链候选 provider ∈ installedVendors
1300
- * 即保留,排除活厂商错配)→ 删除域严格 = "供给载体消亡"。
1382
+ * {VENDOR_NOT_INSTALLED, BINDING_UNRESOLVED, MODULE_CONFIG_DEAD} + 守卫(绑定引用链候选
1383
+ * provider ∈ installedVendors 即保留,排除活厂商错配)→ 删除域严格 = "供给载体消亡"。
1384
+ * v6:模块卸载 → modules[m] **整节点确定性清理**(provider+config+resources——D4:
1385
+ * 模块消亡清理 vs 集成位编辑保全不矛盾;MODULE_CONFIG_DEAD 为判据源)。
1301
1386
  *
1302
1387
  * 由此推论(均已实证):需求侧孤儿绑定(demand 消失、供给在场)保留——doctor 判其合法;用户
1303
1388
  * 预配置绑定受保护;一次 remove 自愈全文件历史死债;凭据类 issue(CREDENTIAL_FILE_MISSING 等)
1304
1389
  * 刻意不进白名单,原样保留。
1305
1390
  *
1306
- * 写侧三防线(镜像 write core):N1 归一化(空模块节点删 domains 键)→ parseIntegrationsConfig
1391
+ * 写侧三防线(镜像 write core):归一化(空节点删键)→ parseIntegrationsConfig
1307
1392
  * 严格校验(失败弃写)→ writeAtomic。凭据孤儿只报告不清理(D9——与 DELETE 管线现行为一致)。
1308
1393
  * 全空(无任何存活绑定)→ 删文件——ensureMockBindings(缺席即生成)在重装供给时再生闭环。
1309
1394
  *
@@ -1320,6 +1405,23 @@ interface PruneResult {
1320
1405
  }
1321
1406
  declare function pruneIntegrationBindings(appDir: string): Promise<PruneResult>;
1322
1407
 
1408
+ /**
1409
+ * 双键寻址(v7 词汇统一):路径参数双键——id 精确优先 → 展示名唯一命中兜底 → 404
1410
+ * (多命中 fail-visible,message 列候选 + 指引改用 id;复用既有 404 码零新错误码)。
1411
+ *
1412
+ * **消费边界(O1——双键语义单点)**:仅 factory.ts 控制面七方法入口接入;
1413
+ * views / write-core / CLI 恒 id-only 纯函数。
1414
+ *
1415
+ * **纯参数式(F2)**:configuredKeys 由调用方注入——零 integrations 依赖、零 IO,
1416
+ * 解析输入恒为 walk 产物快照 + 调用方键集。
1417
+ */
1418
+ /** 模块双键解析:id 精确 → 展示名(descriptor.name ?? id)唯一命中 → 404。 */
1419
+ declare function resolveModuleKey(walk: WalkManifestsResult, key: string): WalkModuleInfo;
1420
+ /** 服务双键解析 → 真实 service id:服务键集(词汇 ∪ demand ∪ 供给足迹 ∪ configuredKeys)
1421
+ * 精确命中 → 展示名(slotMeta.name ?? catalog.services[].name)唯一命中 → 404。
1422
+ * configuredKeys = 当前集成配置 services 节键集(调用方注入)。 */
1423
+ declare function resolveServiceKey(walk: WalkManifestsResult, configuredKeys: readonly string[], key: string): string;
1424
+
1323
1425
  /**
1324
1426
  * .tbox/app.json npmModules 读写(自 CLI manifest.ts 迁入——assembly 层目录知识单源)。
1325
1427
  * npmModules 登记 = sdk 包双语义磁盘足迹之一(业务包 = packages/<id>/ 目录,sdk 包 = 本清单登记)。
@@ -1410,7 +1512,7 @@ interface BridgeProviderCatalog {
1410
1512
  }
1411
1513
  /** 富形态(工厂迁移面):walkManifests 产物直通 */
1412
1514
  declare function loadProviderCatalogRaw(appDir: string): WalkCatalog;
1413
- /** 桥源(形态冻结):富形态 → 桥形状投影(demand meta title/description 剥离——桥面无此字段,
1515
+ /** 桥源(形态冻结):富形态 → 桥形状投影(demand meta name/description 剥离——桥面无此字段,
1414
1516
  * additive 差异声明见 app-sdk 桥 golden) */
1415
1517
  declare function loadProviderCatalog(appDir: string): BridgeProviderCatalog;
1416
1518
  interface ProviderServiceSchemas {
@@ -1540,7 +1642,8 @@ interface WriteCore {
1540
1642
  warmup(): Promise<void>;
1541
1643
  /** PUT /app/integration(root 节点全集) */
1542
1644
  applyApp(node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
1543
- /** PUT /modules/:module/integration(domains 换算;N1 {} 删域键;v4.4 D34 写守卫单源) */
1645
+ /** PUT /modules/:module/integration(v6 modules[owner] 集成位;键集纪律见 MODULE_INTEGRATION_NODE_KEYS;
1646
+ * N1 {} 清 provider/config 保 resources;moduleOwnershipWritable 写守卫单源) */
1544
1647
  applyModule(moduleId: string, node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
1545
1648
  /** PUT /services/:service/integration(整节点含 instances map;N3 {} 不归一化;v4.4 A2 身份判据) */
1546
1649
  applyService(service: string, node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
@@ -1568,6 +1671,44 @@ interface MockBindingsResult {
1568
1671
  }
1569
1672
  declare function ensureMockBindings(appDir: string): MockBindingsResult;
1570
1673
 
1674
+ /**
1675
+ * 模块级联绑定单源(integrations v6 所有权模型——原 domain-binding.ts v4.4 F1/F3 重写)。
1676
+ * integrations 层落位依据:谓词(同层)/ 写核(同层)/ views(下层可向上 import)三向消费
1677
+ * 的唯一公共下层;import 前缀 guard 覆盖。
1678
+ *
1679
+ * 知识锚(module-tab note 单源锚表,v6 形态):
1680
+ * 模块级联(值 + 层) = resolveModuleBinding —— 谓词 #7(per-module 生效厂商 ≡
1681
+ * `modules[m].provider ?? root.provider`)/ deriveBindingLayer 模块级段 /
1682
+ * buildInheritance module 段 / binding(单数)
1683
+ * 归属表 = walk.ownership(单源聚合产物;buildOwnershipMap 桥直通——
1684
+ * registry 显式参 / 谓词 / 写守卫 / views 四消费方零第二实现)
1685
+ * 来源层四层推导 = deriveBindingLayer(views/service-resolutions,模块级段改调本文件)
1686
+ * 写通道可用性 = moduleOwnershipWritable —— configEditable 读标志 / applyModule 400 守卫
1687
+ * 共用(owns>0 唯一判据——多域归属合法化、共享键/多域判据随 D34 退役)
1688
+ */
1689
+ /** 归属表构建(walk 单源直通——sdk 桥 re-export 消费;appDir 直入对齐 loadProviderCatalog
1690
+ * 桥工效——模板装配第六行:`ownerOf: buildOwnershipMap(appDir)`)。 */
1691
+ declare function buildOwnershipMap(appDir: string): Record<string, string>;
1692
+ /** 模块级联绑定解析(值 + 来源层):provider 取非空字符串(模块级优先 → root 兜底;空串 = 缺席)。
1693
+ * layer:modules[moduleId].provider 声明 → 'module';root 兜底 → 'app';双缺 → null(binding 双缺诚实态)。 */
1694
+ declare function resolveModuleBinding(config: Record<string, unknown> | null, moduleId: string): {
1695
+ provider: string | null;
1696
+ layer: 'module' | 'app' | null;
1697
+ };
1698
+ /** 模块集成位可写性(v6 判别联合——configEditable 读标志与 applyModule 写守卫共用单源):
1699
+ * owns>0 唯一判据(D34 多域/shared-key 判据随 v6 退役——服务归属唯一真源 = declare.owns)。 */
1700
+ type ModuleOwnershipWritability = {
1701
+ writable: true;
1702
+ ownedServices: string[];
1703
+ } | {
1704
+ writable: false;
1705
+ reason: 'zero-ownership';
1706
+ ownedServices: [];
1707
+ };
1708
+ declare function moduleOwnershipWritable(_walk: Pick<WalkManifestsResult, 'modules' | 'catalog' | 'ownership'>, mod: WalkModuleInfo): ModuleOwnershipWritability;
1709
+ /** 供给足迹(该厂商全部供给服务并集——应用级 integrationSchemas 作用域,D32) */
1710
+ declare function providerFootprint(catalog: WalkCatalog, provider: string): string[];
1711
+
1571
1712
  /**
1572
1713
  * AppToolkitError(领域 6 码 + 壳层 2 码分界——toolkit 只产领域码):
1573
1714
  * VALIDATION_FAILED(400) / SERVICE_NOT_FOUND(404) / MODULE_NOT_FOUND(404) /
@@ -1601,6 +1742,11 @@ declare function contractsNotResolvedMessage(contracts: {
1601
1742
  * agtcodingbox / tbox-ai-coding 经 `import type` 消费(L2 DTO 单源——API 层零类型镜像)。
1602
1743
  * 词汇七概念:app / module / service / instance / provider / integration / resolution。
1603
1744
  * 弃用词汇清单见 api.md §3 尾(component/slot/scope/configMode/…——防复活)。
1745
+ *
1746
+ * **v7 词汇统一破例声明(一次性收敛,此后恢复 additive-only)**:标识/展示名分轴
1747
+ * (id = 标识、name = 展示名、description = 描述——对齐实例轴 {id, name}),
1748
+ * title 键全量退役(与 manifest name→id/title→name 同一变更);`.title` 消费方
1749
+ * (外部仓 import type / 运行时读)需同窗迁移。
1604
1750
  */
1605
1751
  /** contracts 求值五态原样(EffectiveServiceResolution.status) */
1606
1752
  type ServiceStatus = 'ok' | 'service-not-configured' | 'instance-not-found' | 'instance-disabled' | 'binding-unresolved';
@@ -1615,58 +1761,66 @@ interface ModulesView {
1615
1761
  interface ModuleDeclaration {
1616
1762
  /** install id(packages/ 目录名 / .tbox/app.json entry.id)——恒业务模块(provider 家族不在本清单) */
1617
1763
  id: string;
1618
- /** 包名 */
1764
+ /** 展示名(v7 词汇统一:manifest name ?? id——恒有值) */
1619
1765
  name: string;
1620
- title: string;
1621
1766
  description: string;
1767
+ /** 隐藏模块(additive——manifest hidden === true 时携带;默认清单已过滤,本字段仅供
1768
+ * ?includeHidden=true 可见时徽标呈现) */
1769
+ hidden?: boolean;
1622
1770
  }
1623
1771
  /** 服务需求声明(模块 demand 单元 / 平台服务条目——v4.4 D29 双端点同型;defaults 唯一落位 ServiceDetail) */
1624
1772
  interface ServiceDemand {
1625
1773
  service: string;
1626
- /** manifest demand meta;缺席 UI 回退 service id */
1627
- title?: string;
1774
+ /** manifest demand meta(v7 title→name);缺席 UI 回退 service id */
1775
+ name?: string;
1628
1776
  description?: string;
1629
1777
  /** demand optional === false(多模块 OR 聚合见 resolution echo;平台服务条目恒 false) */
1630
1778
  required: boolean;
1631
1779
  }
1632
1780
  /** GET /modules/:module(模块静态一站式 · PUT 读对偶) */
1633
1781
  interface ModuleDetailView {
1634
- /** B1 additive:模块 meta 展示名(manifest title;视图层兜底 name——恒有值) */
1635
- title: string;
1782
+ /** 模块展示名(v7 词汇统一:manifest name ?? id——恒有值) */
1783
+ name: string;
1636
1784
  /** B1 additive:模块 meta 描述(manifest description;兜底 '') */
1637
1785
  description: string;
1638
- /** v4.4 D34:demand 服务首段去重(排序;1..N;零域 = []) */
1639
- domainKeys: string[];
1640
- /** domains[换算键] 节点原值;未配置 = null;v4.4 D34:仅单域(writable)时在场——多域/零域/共享键无单键落点 */
1786
+ /** 隐藏模块(additive——manifest hidden === true 时携带;详情恒 200 不受清单过滤影响,
1787
+ * 本字段仅供面板徽标呈现) */
1788
+ hidden?: boolean;
1789
+ /** v6 所有权模型:模块归属服务(declare.owns 展平,排序;零归属 = [])——
1790
+ * v5 domainKeys 退役(破坏性更名;面板 presence-detection 双读义务见 api.md §3) */
1791
+ ownedServices: string[];
1792
+ /** modules[install id] 集成位原值(provider/config;resources 不投影——见 resources 字段);未配置 = null */
1641
1793
  integration: ModuleIntegrationNode | null;
1642
- /** v4.4 D34:每域一条厂商绑定解析(单域 = 单元素;零域 = [];resolveDomainBinding 单源) */
1643
- providerBindings: ProviderBinding[];
1644
- /** v4.4 D34:单域 && 域键无跨模块共享(moduleDomainWritable 单源——读标志与写守卫共用) */
1794
+ /** 模块资源只读镜像(N2 读半边——写侧 resources 恒保全;含 ref 台账展开态 resolvedDatasetId);
1795
+ * 无模块键/无资源节 = null */
1796
+ resources?: ModuleResourcesEcho | null;
1797
+ /** v6 单数化(v5 providerBindings[] 退役):模块级厂商绑定解析(resolveModuleBinding 单源;
1798
+ * 单值作用于全部 ownedServices) */
1799
+ binding: ModuleBinding | null;
1800
+ /** v6:owns.length > 0(moduleOwnershipWritable 单源——读标志与写守卫共用) */
1645
1801
  configEditable: boolean;
1646
- /** 本模块 demand(卡片展开 + 编辑器静态上下文自足) */
1802
+ /** 本模块 demand(declare.consumes;卡片展开 + 编辑器静态上下文自足) */
1647
1803
  services: ServiceDemand[];
1648
1804
  /** v4.4 D31:include=serviceResolutions 内嵌(demand 服务过滤 ≡ 批量 ?service= 语义;<0.9/形态异常 → null——永不 503) */
1649
1805
  serviceResolutions?: ServiceResolutionsView | null;
1650
- /** v4.4 D32:include=integrationSchemas 层级富化(多域/零域/共享键/未绑定 → null) */
1806
+ /** v4.4 D32:include=integrationSchemas 层级富化(零归属/未绑定 → null) */
1651
1807
  integrationSchemas?: LayerIntegrationSchemas | null;
1652
1808
  /** v4.6 D36:include=integrationFieldRegistry 集成字段注册表(null 语义镜像 integrationSchemas;
1653
1809
  * 未知厂商/零足迹 → 非 null 空集 + unsupplied 回填——D37 轴参假想计算同此) */
1654
1810
  integrationFieldRegistry?: IntegrationFieldRegistryView | null;
1655
1811
  }
1656
- /** 模块域厂商绑定解析(v4.4 D34——静态文件事实;规则 ≡ 谓词 #7 域级,resolveDomainBinding 单源) */
1657
- interface ProviderBinding {
1658
- /** 域键(= domainKeys 成员;多域模块每域一条) */
1659
- domain: string;
1660
- /** domains[domain].provider ?? root.provider(双缺 = null) */
1661
- effective: string | null;
1812
+ /** 模块级厂商绑定解析(v6——静态文件事实;规则 ≡ 谓词 #7 模块层,resolveModuleBinding 单源) */
1813
+ interface ModuleBinding {
1814
+ /** modules[install id].provider ?? root.provider(双缺 = null) */
1815
+ provider: string | null;
1662
1816
  /** 生效来源层(双缺 = null) */
1663
1817
  layer: 'module' | 'app' | null;
1664
1818
  }
1665
1819
  /** 层级 config schema 计算(v4.4 D32——静态轴富化,零 contracts) */
1666
1820
  interface LayerIntegrationSchemas {
1667
- /** 层生效厂商(resolveDomainBinding 单源) */
1821
+ /** 层生效厂商(resolveModuleBinding 单源) */
1668
1822
  provider: string;
1669
- /** 模块级 = 本模块 demand ∩ 该厂商供给;应用级 = 供给足迹全量(configSchema = raw draft 2020-12 原文;供给在场未声明 = null) */
1823
+ /** 模块级 = 本模块 ownedServices ∩ 该厂商供给;应用级 = 供给足迹全量(configSchema = raw draft 2020-12 原文;供给在场未声明 = null) */
1670
1824
  services: Record<string, {
1671
1825
  configSchema: object | null;
1672
1826
  }>;
@@ -1682,7 +1836,7 @@ interface IntegrationFieldRegistryView {
1682
1836
  unsupplied: string[];
1683
1837
  /** 作用域内全部非 null schema 的 additionalProperties 均 ≠ false(聚合;空真) */
1684
1838
  additionalPropertiesAllowed: boolean;
1685
- /** 逐 key 合并产物(首声明插入序 = scope 遍历序:app 字母序 / module demand 序) */
1839
+ /** 逐 key 合并产物(首声明插入序 = scope 遍历序:app 字母序 / module ownedServices 序) */
1686
1840
  fields: Array<{
1687
1841
  key: string;
1688
1842
  /** null = 类型不可调和(R3/R2 异构/R1 enum 不等——冲突折叠,客户端 RawJson 保真) */
@@ -1692,6 +1846,9 @@ interface IntegrationFieldRegistryView {
1692
1846
  service: string;
1693
1847
  required: boolean;
1694
1848
  }>;
1849
+ /** G 批:x-tbox-global 聚合旗标(sources.some——任一来源声明即 true;app/module 轴表单
1850
+ * 仅渲染 true 字段,非全局键落 ExtraFields;service 轴全量透传) */
1851
+ global: boolean;
1695
1852
  }>;
1696
1853
  }
1697
1854
  /** GET /app(应用静态视图:平台服务 + root 原值) */
@@ -1723,11 +1880,17 @@ interface ServiceDetail extends ServiceDemand {
1723
1880
  /** v4.7 D38:include=integrationSchemas 生效绑定富化(三态:null 全链未绑定 /
1724
1881
  * 绑定无可计算 schema / 含 schema;malformed 节点 → null——不放行域级联) */
1725
1882
  integrationSchemas?: ServiceIntegrationSchemas | null;
1883
+ /** G 批:include=integrationFieldRegistry 服务轴注册表(loadServiceFieldRegistry——
1884
+ * 四分支链推导复用 D38;fields = 该 schema 全部字段带 global 旗标;null 语义镜像 D38。
1885
+ * v5.1 D39:serviceProvider 轴参 = 假想重定向——仅表单投影按 X 计算,带非空轴参时
1886
+ * registry 恒非 null(豁免链③不镜像实际态 null);同构 ≡ PUT 改写 provider 后实读) */
1887
+ integrationFieldRegistry?: IntegrationFieldRegistryView | null;
1726
1888
  }
1727
1889
  /** 服务级生效绑定 schema(v4.7 D38 静态轴富化——零 contracts,永不 503;实例层无条件排除:
1728
1890
  * node 级口径 ≠ resolution 默认实例口径,api.md §4.4 注) */
1729
1891
  interface ServiceIntegrationSchemas {
1730
- /** 生效厂商:显式(含内联声明名)?? domains[首段].provider ?? root.provider */
1892
+ /** 生效厂商:显式(含内联声明名)?? modules[ownerOf].provider ?? root.provider
1893
+ * v5.1 D39:serviceProvider 轴参在场时 = 假想短路值(非链解析产物) */
1731
1894
  provider: string;
1732
1895
  /** catalog 复合键(多 impl 声明序首个)> 内联 ref;miss(未知厂商/未供给/内联缺 ref)→ null(富化非门控) */
1733
1896
  configSchema: object | null;
@@ -1792,14 +1955,36 @@ interface AppIntegrationNode {
1792
1955
  defaultInstanceId?: string | null;
1793
1956
  }
1794
1957
  /** AppIntegrationNode 键集单源(runtime const——write applyApp 全量替换白名单
1795
- * (缺席根键删除;services/domains/modules 域不在其中)+ views/app 投影(GET 预填 ≡ PUT body,
1796
- * D21/L1——文件含 services/domains 但 root 节点投影只含本键集)) */
1958
+ * (缺席根键删除;services/modules 域不在其中;v6 domains 键退役)+ views/app 投影
1959
+ * (GET 预填 ≡ PUT body,D21/L1——文件含 services/modules 但 root 节点投影只含本键集)) */
1797
1960
  declare const APP_INTEGRATION_NODE_KEYS: readonly ["provider", "config", "configByInstance", "credentialRef", "credentialRefByInstance", "instances", "defaultInstanceId"];
1798
- /** 模块域节点(恒字符串 provider——域层无凭据位,契约事实) */
1961
+ /** 模块集成位节点(v6——provider 绑定默认 + config 级联层;resources 不投影不写——
1962
+ * 集成位编辑恒保全资源节,N2) */
1799
1963
  interface ModuleIntegrationNode {
1800
1964
  provider?: string;
1801
1965
  config?: Record<string, unknown>;
1802
1966
  }
1967
+ /** ModuleIntegrationNode 可写键集单源(v6——write applyModule 全量替换白名单
1968
+ * (键集外 400;resources 恒随既有节点保全)+ views/modules 投影(GET ≡ PUT,三同构)) */
1969
+ declare const MODULE_INTEGRATION_NODE_KEYS: readonly ["provider", "config"];
1970
+ /** 模块资源回显(只读投影——N2 读半边:写侧仍仅 provider/config,resources 恒保全)。
1971
+ * 原值文件镜像(L1)+ ref 台账展开态:`ref` 在场且同目录 knowledge.json 命中时
1972
+ * `resolvedDatasetId` = 台账 datasetId(镜像 SDK resolveKnowledge 展开语义),未命中/台账缺失 = null。
1973
+ * 路径锚定边界:视图恒读 `<appDir>/config/`(与 toolkit readIntegrationsConfig 同源——
1974
+ * `TBOX_INTEGRATIONS_FILE` 为 SDK 运行时逃生舱,视图不跟随,既有分叉)。 */
1975
+ interface ModuleResourceEcho {
1976
+ type: 'knowledge';
1977
+ /** 文件原值直填 datasetId(与 ref 互斥使用——并存时 SDK 侧 datasetId 优先) */
1978
+ datasetId?: string;
1979
+ /** 文件原值 ref(台账引用——knowledge.json knowledge_bases 键) */
1980
+ ref?: string;
1981
+ /** 展开态:datasetId 直填时 = 该值;ref 命中台账 = 台账 datasetId;ref 未命中/台账缺失 = null */
1982
+ resolvedDatasetId: string | null;
1983
+ topK?: number;
1984
+ scoreThreshold?: number;
1985
+ }
1986
+ /** modules[install id].resources 只读镜像(键 = 资源 id;无模块键/无资源 = null) */
1987
+ type ModuleResourcesEcho = Record<string, ModuleResourceEcho>;
1803
1988
  /** services[s] 整节点 */
1804
1989
  interface ServiceIntegrationNode {
1805
1990
  /** 对象 = 自定义 API(仅槽级,P2) */
@@ -1849,8 +2034,8 @@ interface ProviderEntry {
1849
2034
  local: boolean;
1850
2035
  /** 供给声明来源包名 */
1851
2036
  owner: string;
1852
- /** B1 additive:厂商展示名(manifest 模块 meta——多包首声明;缺席 = undefined) */
1853
- title?: string;
2037
+ /** 厂商展示名(v7 title→name:manifest name——多包首声明;缺席 = undefined) */
2038
+ name?: string;
1854
2039
  description?: string;
1855
2040
  }
1856
2041
  /** GET /providers/:provider:供给足迹 */
@@ -1858,8 +2043,8 @@ interface ProviderDetail {
1858
2043
  provider: string;
1859
2044
  local: boolean;
1860
2045
  owner: string;
1861
- /** B1 additive:厂商展示名(同 ProviderEntry——首声明透传) */
1862
- title?: string;
2046
+ /** 厂商展示名(同 ProviderEntry——首声明透传) */
2047
+ name?: string;
1863
2048
  description?: string;
1864
2049
  /** per (provider, service) 保真,同厂商异构合法;★ implementations 恒数组(H1——
1865
2050
  * 多元素 = 升级窗口,UI 出 impl 选择器,PUT 显式钉版) */
@@ -1868,8 +2053,8 @@ interface ProviderDetail {
1868
2053
  implementation: string;
1869
2054
  credentialType: string;
1870
2055
  }>;
1871
- /** B1 additive:服务展示名(resolveServiceDisplay——词汇 > demand > id;恒发) */
1872
- title?: string;
2056
+ /** 服务展示名(resolveServiceDisplay——词汇 > demand > id;恒发) */
2057
+ name?: string;
1873
2058
  description?: string;
1874
2059
  /** v4.4 F5:include=integrationSchemas 切换态批量(纯 config——凭据结构归 /credential-types) */
1875
2060
  integrationSchemas?: {
@@ -1957,7 +2142,7 @@ interface IntegrationIssue {
1957
2142
 
1958
2143
  /**
1959
2144
  * 视图装配共享上下文(五投影共用;目录枚举零缓存——walkManifests 每次调用执行)。
1960
- * 域前缀换算(service 首点段)自 v4.4 F1 迁 integrations/domain-binding.ts(本文件 re-export 保导入路径)。
2145
+ * v6:域前缀换算退役(domainOfService 随归属模型退场)——模块占用判定改 declare 三键直读。
1961
2146
  */
1962
2147
  interface ViewContext {
1963
2148
  appDir: string;
@@ -1969,22 +2154,27 @@ interface ViewSnapshot {
1969
2154
  catalog: WalkCatalog;
1970
2155
  integrations: Record<string, unknown> | null;
1971
2156
  contracts: ResolvedContracts;
2157
+ /** 文件读原语透传(可选——resources 台账惰性读等 stat 指纹缓存消费;缺席 = 调用方直读) */
2158
+ cache?: FileCache;
1972
2159
  }
1973
2160
 
1974
- /** GET /modules:纯模块清单(demand 不在——卡片展开 = GET /modules/:m;provider 家族包不在清单) */
1975
- declare function loadModulesView(snapshot: ViewSnapshot): {
2161
+ /** GET /modules:纯模块清单(demand 不在——卡片展开 = GET /modules/:m;provider 家族包不在清单;
2162
+ * hidden 模块默认过滤——includeHidden = true 可见并携带 hidden: true 徽标) */
2163
+ declare function loadModulesView(snapshot: ViewSnapshot, opts?: {
2164
+ includeHidden?: boolean;
2165
+ }): {
1976
2166
  modules: ModuleDeclaration[];
1977
2167
  };
1978
- /** GET /modules/:module:模块静态一站式(integration 节点原值 + demand;PUT 读对偶) */
2168
+ /** GET /modules/:module:模块静态一站式(modules[install id] 集成位原值 + demand;PUT 读对偶) */
1979
2169
  declare function loadModuleDetailView(snapshot: ViewSnapshot, moduleId: string): ModuleDetailView;
1980
2170
 
1981
2171
  /**
1982
2172
  * 应用静态投影(views/app;C4;FX-1c B10——root 节点投影修;v4.4 D29——services 双端点同型)。
1983
2173
  * /app = 平台服务 + root 节点原值(纯静态):services = 服务词汇 − 模块占用
1984
- * (ServiceDemand[]——平台条目 required 恒 false、title/description 缺席,D29);
2174
+ * (ServiceDemand[]——平台条目 required 恒 false、name/description 缺席,D29);
1985
2175
  * 平台服务状态不在此(→ /service-resolutions);模块服务不在此(→ /modules/:m)。
1986
2176
  * integration = **root 节点投影**(APP_INTEGRATION_NODE_KEYS——D21/L1:GET 预填 ≡ PUT body;
1987
- * 文件另含 services/domains/modules 域键,不进 root 节点投影——原实现整文件透传,
2177
+ * 文件另含 services/modules 域键,不进 root 节点投影——原实现整文件透传,
1988
2178
  * PUT 回会级联写回域键);文件缺席 = null,文件在场 → 投影对象(可为空)。
1989
2179
  */
1990
2180
  declare function loadAppView(snapshot: ViewSnapshot): AppView;
@@ -2038,19 +2228,42 @@ declare function loadServiceResolutionDetail(service: string, snapshot: ViewSnap
2038
2228
  * 复合解析——v4.7 D38 收口,零新读取路径;供给在场未声明 = null,mock 合法) */
2039
2229
  declare function resolveLayerIntegrationSchemas(snapshot: ViewSnapshot, provider: string, services: readonly string[]): LayerIntegrationSchemas;
2040
2230
  declare function resolveLayerIntegrationSchemas(snapshot: ViewSnapshot, provider: string | null, services: readonly string[]): LayerIntegrationSchemas | null;
2231
+ /** D36 registry 构造(纯函数——消费 resolveLayerIntegrationSchemas 产物,禁旁路直取 serviceSchemas)。
2232
+ * fields 收集零过滤(布尔/非对象子 schema 入列,判定全权归 mergeFieldSources——S8 互证等式由
2233
+ * 收集定义结构性闭合);schemaless 仅 configSchema === null(布尔/畸形整 schema 防御跳过——
2234
+ * 不入 schemaless、零参与聚合;D32 运行时畸形,非契约面)。 */
2235
+ declare function buildIntegrationFieldRegistry(layer: LayerIntegrationSchemas, o?: {
2236
+ unsupplied?: string[];
2237
+ }): IntegrationFieldRegistryView;
2238
+ /** D37 生效厂商解析单源(实际/假想同径):override(非空串)?? 实际解析。
2239
+ * 空串归一(I3)单点;module 轴 v6 零归属 → null(override 不豁免——预览服务于保存)。 */
2240
+ declare function formProviderOf(axis: 'app' | 'module', snapshot: ViewSnapshot, moduleId?: string, override?: string): string | null;
2041
2241
  /** app 级 loader(v4.6 委托化——签名零改动,公开面保持;假想态归 loadAppFormViews override 参) */
2042
2242
  declare function loadAppIntegrationSchemas(snapshot: ViewSnapshot): LayerIntegrationSchemas | null;
2043
2243
  /** module 级 loader(v4.6 委托化——同上;多域/零域/共享键/未绑定 → 整字段 null,表单降级 = ExtraFields) */
2044
2244
  declare function loadModuleIntegrationSchemas(snapshot: ViewSnapshot, moduleId: string): LayerIntegrationSchemas | null;
2045
2245
  /** 服务级 loader(v4.7 D38):四分支穷举(node.provider = 文件 services[s].provider 逐字原值;
2046
2246
  * 实例层无条件排除——node 级口径);非空三分支归约一次复合解析。
2047
- * ① undefined/'' → resolveDomainBinding 域级联(域 + root 双缺 → 整字段 null)
2247
+ * ① undefined/'' → 模块级联(v6:modules[ownerOf[s]] root 双缺 → 整字段 null)
2048
2248
  * ② 非空 string → bare:catalog miss(未知厂商/未供给)→ configSchema:null 不 404(富化非门控)
2049
2249
  * ③ 受控内联(isControlledInlineProvider 单源)→ 名 = p.provider;catalog 复合键 > p.configSchema ref
2050
2250
  * (H9 逃逸 400 照抛——readInlineSchema 共享路径)
2051
2251
  * ④ 其余(null/数组/原始值/坏对象)→ 整字段 null(≡ 谓词 #5 INLINE_PROVIDER_INVALID 同判——
2052
- * 不放行域级联,防错误 schema 污染坏节点) */
2053
- declare function loadServiceIntegrationSchemas(snapshot: ViewSnapshot, service: string): ServiceIntegrationSchemas | null;
2252
+ * 不放行域级联,防错误 schema 污染坏节点)
2253
+ * v5.1 D39:serviceProvider = 服务轴向假想绑定(缺席/空串 按实际解析——I3 归一单点在此头部,
2254
+ * registry 侧不重复归一);非空轴参 → 短路 bare 解析(镜像 formProviderOf「输入替换非分支复制」先例:
2255
+ * 任一原分支改写 provider 为 X 后实读都进 bare 分支,同构承诺 by construction)。短路在节点读取之前——
2256
+ * 豁免链三分支(D39 与 D38 四分支的有意分歧:预览与坏文件解耦):malformed(分支④)不污染假想 /
2257
+ * 内联 ref 不读取(假想态无 H9 逃逸 400;catalog 命中的 manifest 声明路径照读,与节点声明的
2258
+ * 用户可控路径不同性)/ 全链未绑定时假想仍非 null(服务轴恒可写,无 module 轴零归属对应物)。 */
2259
+ declare function loadServiceIntegrationSchemas(snapshot: ViewSnapshot, service: string, serviceProvider?: string): ServiceIntegrationSchemas | null;
2260
+ /** G 批:服务轴字段注册表(D38 四分支链复用——消费 loadServiceIntegrationSchemas 单源;
2261
+ * 伪层 {provider, services: {[s]: {configSchema}}} → buildIntegrationFieldRegistry——
2262
+ * fields = 该 schema 全部字段带 global 旗标;configSchema null → schemaless=[service]
2263
+ * 非 null 空集;schemas 整体 null(全链未绑定/坏节点)→ registry null——镜像 D38 语义)。
2264
+ * v5.1 D39:serviceProvider = 服务轴向假想绑定,纯透传(I1 单源——归一与短路都在链函数头部;
2265
+ * 轴参仅重定向表单层投影,global 旗标全量透传语义不变)。 */
2266
+ declare function loadServiceFieldRegistry(snapshot: ViewSnapshot, service: string, serviceProvider?: string): IntegrationFieldRegistryView | null;
2054
2267
 
2055
2268
  /**
2056
2269
  * 凭据状态轴投影(views/credentials;v4.4 D33 独立端点 GET /credentials):
@@ -2082,7 +2295,8 @@ declare function loadCredentialTypesView(snapshot: ViewSnapshot, provider?: stri
2082
2295
  * createAppToolkit(C4 工厂;v4.4——24 方法 = 11 读(含 credentials/credential-types 双端点)
2083
2296
  * + 4 写 + 9 迁移面;loadApp/loadModule/loadProvider 增 include 选项;v4.6——loadApp/loadModule
2084
2297
  * += 轴向假想绑定选项(appProvider/moduleProvider,D37);表单双投影经 formViews 单点装配;
2085
- * v4.7——loadService 增 include 选项(服务级生效绑定 schema 单体))。
2298
+ * v4.7——loadService 增 include 选项(服务级生效绑定 schema 单体);v5.1 D39——loadService
2299
+ * += serviceProvider 轴参(服务轴向假想绑定,三轴收口))。
2086
2300
  * AppToolkit = AppToolkitRead & AppToolkitWrite & AppToolkitInternals——
2087
2301
  * Read+Write = HTTP 直通面 additive 冻结(L1 端点↔方法 1:1,L3 命名镜像:Integration=节点级 /
2088
2302
  * Config=文件级);Internals = CLI/doctor/桥消费(自由演进)。
@@ -2101,10 +2315,16 @@ interface AppToolkitOptions {
2101
2315
  /** 写成功(实际落盘且非 dryRun/no-diff)→ 调用一次(宿主闭包内防抖/守卫);CLI 不传恒 false */
2102
2316
  onApplied?: () => void;
2103
2317
  }
2104
- /** ── HTTP 直通面(11 读;L1 镜像律:方法名 = load + URL 资源段;query → 选项字段 L4)── */
2318
+ /** ── HTTP 直通面(11 读;L1 镜像律:方法名 = load + URL 资源段;query → 选项字段 L4)──
2319
+ * **双键契约(v7 词汇统一)**:资源路径参数双键寻址(id 优先、唯一展示名兜底——resolve-key
2320
+ * 单点;多命中 404 带候选);query 过滤参数(loadServiceResolutions services?)恒 id-only。 */
2105
2321
  interface AppToolkitRead {
2106
- loadModules(): Promise<ModulesView>;
2107
- /** v4.6 D37:moduleProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include 键同现) */
2322
+ /** GET /modules:hidden 模块默认过滤(includeHidden = true 可见——对齐 ?dryRun 布尔参数先例) */
2323
+ loadModules(o?: {
2324
+ includeHidden?: boolean;
2325
+ }): Promise<ModulesView>;
2326
+ /** v4.6 D37:moduleProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include 键同现)。
2327
+ * moduleId = 双键(id 优先、唯一展示名兜底)。 */
2108
2328
  loadModule(moduleId: string, o?: {
2109
2329
  include?: string[];
2110
2330
  moduleProvider?: string;
@@ -2114,8 +2334,11 @@ interface AppToolkitRead {
2114
2334
  include?: string[];
2115
2335
  appProvider?: string;
2116
2336
  }): Promise<AppView>;
2337
+ /** v5.1 D39:serviceProvider = 服务轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include
2338
+ * 键同现)——假想重定向仅表单双投影,integration/suppliedBy/defaults 恒实际态(I2) */
2117
2339
  loadService(service: string, o?: {
2118
2340
  include?: string[];
2341
+ serviceProvider?: string;
2119
2342
  }): Promise<ServiceDetail>;
2120
2343
  loadServiceResolutions(services?: string[]): Promise<ServiceResolutionsView>;
2121
2344
  loadServiceResolution(service: string): Promise<ServiceResolutionDetail>;
@@ -2129,7 +2352,8 @@ interface AppToolkitRead {
2129
2352
  /** GET /credential-types[?provider=](v4.4 D33——供给轴静态;零门控,永不 503) */
2130
2353
  loadCredentialTypes(provider?: string): Promise<CredentialTypesView>;
2131
2354
  }
2132
- /** ── HTTP 直通面(4 写;body ≡ 文件节点全量替换;DELETE 无 dryRun/无 options)── */
2355
+ /** ── HTTP 直通面(4 写;body ≡ 文件节点全量替换;DELETE 无 dryRun/无 options)──
2356
+ * 双键契约(v7):路径键双键寻址(写侧 enqueue 闭包内解析——落盘键恒真实 id)。 */
2133
2357
  interface AppToolkitWrite {
2134
2358
  writeAppIntegration(node: AppIntegrationNode, o?: {
2135
2359
  dryRun?: boolean;
@@ -2179,4 +2403,4 @@ interface AppToolkitInternals {
2179
2403
  type AppToolkit = AppToolkitRead & AppToolkitWrite & AppToolkitInternals;
2180
2404
  declare function createAppToolkit(appDir: string, options?: AppToolkitOptions): AppToolkit;
2181
2405
 
2182
- 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 PruneResult, 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, evaluateAppIntegrationIssues, 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, pruneIntegrationBindings, 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 };
2406
+ 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 ModuleResourceEcho, type ModuleResourcesEcho, 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 };