@tbox.cn/app-toolkit 0.4.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.
- package/dist/chunk-WUULQDOV.js +1 -0
- package/dist/contracts-resolver-PS2UH2G6.js +1 -0
- package/dist/index.d.ts +315 -144
- package/dist/index.js +9 -9
- package/package.json +2 -2
- package/src/assembly/provider-catalog.ts +1 -1
- package/src/assembly/resolve-key.ts +75 -0
- package/src/assembly/walk-manifests.ts +138 -85
- package/src/core/contracts-expected.ts +2 -2
- package/src/core/contracts-resolver.ts +12 -1
- package/src/core/module-schema.ts +87 -14
- package/src/dto.ts +48 -33
- package/src/factory.ts +62 -18
- package/src/index.ts +14 -7
- package/src/integrations/mock-bindings.ts +1 -1
- package/src/integrations/module-binding.ts +60 -0
- package/src/integrations/predicate-io.ts +26 -5
- package/src/integrations/predicate.ts +97 -57
- package/src/integrations/prune-bindings.ts +33 -14
- package/src/integrations/write.ts +43 -27
- package/src/views/app.ts +4 -4
- package/src/views/context.ts +11 -12
- package/src/views/integration-schemas.ts +61 -17
- package/src/views/modules.ts +29 -23
- package/src/views/providers.ts +5 -5
- package/src/views/service-detail.ts +1 -1
- package/src/views/service-resolutions.ts +14 -13
- package/tests/credentials-view.test.ts +2 -2
- package/tests/demo-app.ts +11 -6
- package/tests/dev-manifest-catalog.test.ts +14 -14
- package/tests/file-cache.test.ts +5 -5
- package/tests/module-schema.test.ts +106 -20
- package/tests/resolve-key.test.ts +154 -0
- package/tests/vendor-schema-keywords.test.ts +74 -0
- package/tests/views.test.ts +296 -166
- package/tests/write-core.test.ts +83 -0
- package/dist/chunk-KPD3LUH4.js +0 -1
- package/dist/contracts-resolver-E4SECBOG.js +0 -1
- 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:
|
|
10
|
+
* - demand meta additive:serviceConsumeContribSchema 增 name?/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:
|
|
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
|
-
/**
|
|
94
|
-
declare const
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
139
|
+
name?: string | undefined;
|
|
126
140
|
description?: string | undefined;
|
|
127
141
|
}>;
|
|
128
|
-
/**
|
|
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,8 +160,8 @@ declare const resourceNeedContribSchema: z.ZodObject<{
|
|
|
138
160
|
}>;
|
|
139
161
|
declare const moduleDescriptorSchema: z.ZodObject<{
|
|
140
162
|
schemaVersion: z.ZodDefault<z.ZodNumber>;
|
|
141
|
-
|
|
142
|
-
|
|
163
|
+
id: z.ZodString;
|
|
164
|
+
name: z.ZodOptional<z.ZodString>;
|
|
143
165
|
description: z.ZodOptional<z.ZodString>;
|
|
144
166
|
version: z.ZodDefault<z.ZodString>;
|
|
145
167
|
kind: z.ZodDefault<z.ZodEnum<["platform", "business", "third-party"]>>;
|
|
@@ -160,7 +182,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
160
182
|
}, {
|
|
161
183
|
defaultMode?: "local" | "hybrid" | "sdk" | "codegen" | undefined;
|
|
162
184
|
}>>;
|
|
163
|
-
|
|
185
|
+
declare: z.ZodDefault<z.ZodObject<{
|
|
164
186
|
handlers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
165
187
|
tools: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
166
188
|
cards: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -247,7 +269,14 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
247
269
|
credentialSchema?: string | undefined;
|
|
248
270
|
}[] | undefined;
|
|
249
271
|
}>>;
|
|
250
|
-
|
|
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<{
|
|
251
280
|
service: z.ZodString;
|
|
252
281
|
optional: z.ZodDefault<z.ZodBoolean>;
|
|
253
282
|
defaults: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -260,7 +289,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
260
289
|
provider: string;
|
|
261
290
|
implementation: string;
|
|
262
291
|
}>, "many">>;
|
|
263
|
-
|
|
292
|
+
name: z.ZodOptional<z.ZodString>;
|
|
264
293
|
description: z.ZodOptional<z.ZodString>;
|
|
265
294
|
}, "strip", z.ZodTypeAny, {
|
|
266
295
|
service: string;
|
|
@@ -269,7 +298,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
269
298
|
provider: string;
|
|
270
299
|
implementation: string;
|
|
271
300
|
}[];
|
|
272
|
-
|
|
301
|
+
name?: string | undefined;
|
|
273
302
|
description?: string | undefined;
|
|
274
303
|
}, {
|
|
275
304
|
service: string;
|
|
@@ -278,7 +307,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
278
307
|
provider: string;
|
|
279
308
|
implementation: string;
|
|
280
309
|
}[] | undefined;
|
|
281
|
-
|
|
310
|
+
name?: string | undefined;
|
|
282
311
|
description?: string | undefined;
|
|
283
312
|
}>, "many">>;
|
|
284
313
|
resources: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -320,14 +349,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
320
349
|
credentialSchema?: string | undefined;
|
|
321
350
|
}[];
|
|
322
351
|
};
|
|
323
|
-
|
|
352
|
+
owns: {
|
|
353
|
+
service: string;
|
|
354
|
+
}[];
|
|
355
|
+
consumes: {
|
|
324
356
|
service: string;
|
|
325
357
|
optional: boolean;
|
|
326
358
|
defaults: {
|
|
327
359
|
provider: string;
|
|
328
360
|
implementation: string;
|
|
329
361
|
}[];
|
|
330
|
-
|
|
362
|
+
name?: string | undefined;
|
|
331
363
|
description?: string | undefined;
|
|
332
364
|
}[];
|
|
333
365
|
resources: {
|
|
@@ -363,14 +395,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
363
395
|
credentialSchema?: string | undefined;
|
|
364
396
|
}[] | undefined;
|
|
365
397
|
} | undefined;
|
|
366
|
-
|
|
398
|
+
owns?: {
|
|
399
|
+
service: string;
|
|
400
|
+
}[] | undefined;
|
|
401
|
+
consumes?: {
|
|
367
402
|
service: string;
|
|
368
403
|
optional?: boolean | undefined;
|
|
369
404
|
defaults?: {
|
|
370
405
|
provider: string;
|
|
371
406
|
implementation: string;
|
|
372
407
|
}[] | undefined;
|
|
373
|
-
|
|
408
|
+
name?: string | undefined;
|
|
374
409
|
description?: string | undefined;
|
|
375
410
|
}[] | undefined;
|
|
376
411
|
resources?: {
|
|
@@ -408,7 +443,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
408
443
|
env: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
409
444
|
}, "strict", z.ZodTypeAny, {
|
|
410
445
|
schemaVersion: number;
|
|
411
|
-
|
|
446
|
+
id: string;
|
|
412
447
|
version: string;
|
|
413
448
|
kind: "platform" | "business" | "third-party";
|
|
414
449
|
risk: {
|
|
@@ -418,7 +453,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
418
453
|
distribution: {
|
|
419
454
|
defaultMode: "local" | "hybrid" | "sdk" | "codegen";
|
|
420
455
|
};
|
|
421
|
-
|
|
456
|
+
declare: {
|
|
422
457
|
handlers: string[];
|
|
423
458
|
tools: string[];
|
|
424
459
|
cards: {
|
|
@@ -447,14 +482,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
447
482
|
credentialSchema?: string | undefined;
|
|
448
483
|
}[];
|
|
449
484
|
};
|
|
450
|
-
|
|
485
|
+
owns: {
|
|
486
|
+
service: string;
|
|
487
|
+
}[];
|
|
488
|
+
consumes: {
|
|
451
489
|
service: string;
|
|
452
490
|
optional: boolean;
|
|
453
491
|
defaults: {
|
|
454
492
|
provider: string;
|
|
455
493
|
implementation: string;
|
|
456
494
|
}[];
|
|
457
|
-
|
|
495
|
+
name?: string | undefined;
|
|
458
496
|
description?: string | undefined;
|
|
459
497
|
}[];
|
|
460
498
|
resources: {
|
|
@@ -470,12 +508,12 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
470
508
|
}[];
|
|
471
509
|
};
|
|
472
510
|
env: string[];
|
|
473
|
-
|
|
511
|
+
name?: string | undefined;
|
|
474
512
|
description?: string | undefined;
|
|
475
513
|
}, {
|
|
476
|
-
|
|
514
|
+
id: string;
|
|
477
515
|
schemaVersion?: number | undefined;
|
|
478
|
-
|
|
516
|
+
name?: string | undefined;
|
|
479
517
|
description?: string | undefined;
|
|
480
518
|
version?: string | undefined;
|
|
481
519
|
kind?: "platform" | "business" | "third-party" | undefined;
|
|
@@ -486,7 +524,7 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
486
524
|
distribution?: {
|
|
487
525
|
defaultMode?: "local" | "hybrid" | "sdk" | "codegen" | undefined;
|
|
488
526
|
} | undefined;
|
|
489
|
-
|
|
527
|
+
declare?: {
|
|
490
528
|
handlers?: string[] | undefined;
|
|
491
529
|
tools?: string[] | undefined;
|
|
492
530
|
cards?: {
|
|
@@ -515,14 +553,17 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
515
553
|
credentialSchema?: string | undefined;
|
|
516
554
|
}[] | undefined;
|
|
517
555
|
} | undefined;
|
|
518
|
-
|
|
556
|
+
owns?: {
|
|
557
|
+
service: string;
|
|
558
|
+
}[] | undefined;
|
|
559
|
+
consumes?: {
|
|
519
560
|
service: string;
|
|
520
561
|
optional?: boolean | undefined;
|
|
521
562
|
defaults?: {
|
|
522
563
|
provider: string;
|
|
523
564
|
implementation: string;
|
|
524
565
|
}[] | undefined;
|
|
525
|
-
|
|
566
|
+
name?: string | undefined;
|
|
526
567
|
description?: string | undefined;
|
|
527
568
|
}[] | undefined;
|
|
528
569
|
resources?: {
|
|
@@ -542,7 +583,8 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
542
583
|
type ModuleDescriptor = z.infer<typeof moduleDescriptorSchema>;
|
|
543
584
|
type CardContrib = z.infer<typeof cardContribSchema>;
|
|
544
585
|
type ProviderSlotContrib = z.infer<typeof providerSlotContribSchema>;
|
|
545
|
-
type
|
|
586
|
+
type ServiceConsumeContrib = z.infer<typeof serviceConsumeContribSchema>;
|
|
587
|
+
type ServiceOwnContrib = z.infer<typeof serviceOwnContribSchema>;
|
|
546
588
|
type ResourceNeedContrib = z.infer<typeof resourceNeedContribSchema>;
|
|
547
589
|
type ParseModuleResult = {
|
|
548
590
|
ok: true;
|
|
@@ -550,6 +592,7 @@ type ParseModuleResult = {
|
|
|
550
592
|
} | {
|
|
551
593
|
ok: false;
|
|
552
594
|
errors: string[];
|
|
595
|
+
legacy?: true;
|
|
553
596
|
};
|
|
554
597
|
declare function parseModuleDescriptor(raw: unknown): ParseModuleResult;
|
|
555
598
|
|
|
@@ -697,14 +740,17 @@ interface ConfiguredService {
|
|
|
697
740
|
instances?: Record<string, ServiceInstanceConfig>;
|
|
698
741
|
}
|
|
699
742
|
/**
|
|
700
|
-
*
|
|
701
|
-
*
|
|
743
|
+
* 模块资源配置(integrations v6:modules 节 = 模块集成位——provider 绑定默认 + config
|
|
744
|
+
* 级联层 + v5 资源节三键合一;键 = install id(.tbox/app.json entry.id / packages/ 目录名;
|
|
745
|
+
* 仓内家族包恒等 manifest name 属规约)。provider/config 至少其一(空节点无意义)。
|
|
702
746
|
*/
|
|
703
|
-
interface
|
|
704
|
-
/**
|
|
747
|
+
interface ModuleConfig {
|
|
748
|
+
/** 模块级默认厂商(v6 绑定组继承层——作用于该模块 declare.owns 的全部服务槽) */
|
|
705
749
|
provider?: string;
|
|
706
|
-
/**
|
|
750
|
+
/** 模块级共享配置(config 五层级联第三层:root ByInstance 之后、slot 之前) */
|
|
707
751
|
config?: Record<string, unknown>;
|
|
752
|
+
/** resourceId → 类型化资源声明(resourceId 词汇真源 = 模块 manifest declare.resources) */
|
|
753
|
+
resources?: Record<string, ResourceSpec>;
|
|
708
754
|
}
|
|
709
755
|
/**
|
|
710
756
|
* 部署实例(业务主体拓扑条目;root instances 注册表元素——v4 参考表)。
|
|
@@ -746,15 +792,12 @@ interface IntegrationsConfig {
|
|
|
746
792
|
credentialRef?: string;
|
|
747
793
|
/** 部署级 per-instance 默认凭据表(键 = instanceId;商户级凭据主写位) */
|
|
748
794
|
credentialRefByInstance?: Record<string, string>;
|
|
749
|
-
/** 模块域全局层(键 = moduleDomainOf(service);无 ByInstance——全链唯一 ByInstance 层恒 root) */
|
|
750
|
-
domains?: Record<string, DomainConfig>;
|
|
751
795
|
/** 部署实例注册表(参考表);缺席 = 无参考表;空数组非法(zod 拒——无表 = 键缺席唯一写法) */
|
|
752
796
|
instances?: DeploymentInstance[];
|
|
753
797
|
/** 默认实例 id(单实例免填;∈instances ids;无表时独立在场 = 动态默认形态) */
|
|
754
798
|
defaultInstanceId?: string | null;
|
|
755
|
-
/**
|
|
756
|
-
*
|
|
757
|
-
* 无 per-instance 层(扩展位词汇预选 resourcesByInstance——instances 词恒属 services 激活语义) */
|
|
799
|
+
/** 模块集成位(v6:provider 绑定默认 + config 级联层 + v5 资源节三键合一;
|
|
800
|
+
* 顶层 domains 键已退役——旧键经 zod 防线拒收并指引 migrate 至 modules[owner]) */
|
|
758
801
|
modules?: Record<string, ModuleConfig>;
|
|
759
802
|
services: Record<string, ConfiguredService>;
|
|
760
803
|
}
|
|
@@ -762,7 +805,7 @@ interface IntegrationsConfig {
|
|
|
762
805
|
interface EffectiveService {
|
|
763
806
|
provider: string | InlineVendorDeclaration$1;
|
|
764
807
|
implementation: string;
|
|
765
|
-
/** 五层浅合并一层:root.config → root.configByInstance[k] →
|
|
808
|
+
/** 五层浅合并一层:root.config → root.configByInstance[k] → modules[owner].config → slot.config → inst.config */
|
|
766
809
|
config: Readonly<Record<string, unknown>>;
|
|
767
810
|
credentialRef?: string;
|
|
768
811
|
}
|
|
@@ -779,26 +822,34 @@ type EffectiveServiceResolution = {
|
|
|
779
822
|
status: 'binding-unresolved';
|
|
780
823
|
message: string;
|
|
781
824
|
};
|
|
782
|
-
/**
|
|
825
|
+
/**
|
|
826
|
+
* 槽位域前缀(首个点号前段;无点号取整串)。**v6 起退出级联**(modules[ownerOf] 取代
|
|
827
|
+
* domains 键控)——保留导出仅供词汇组织用途(guard/doctor 诊断消息按域聚合展示)。
|
|
828
|
+
* 域 ≠ 模块名(auth 域由登录链消费);归属语义唯一真源 = 模块 manifest declare.owns。
|
|
829
|
+
* @deprecated 级联键控已退役(v6 ownership 模型);新消费方禁用——归属查询走 ownerOf。
|
|
830
|
+
*/
|
|
783
831
|
declare function moduleDomainOf(service: string): string;
|
|
784
832
|
/** 派生查表(buildSupplyLookup 产物):键 `${provider}\u0000${service}` → implementation 清单('id@version')。 */
|
|
785
833
|
type SupplyLookup$1 = Record<string, readonly string[]>;
|
|
786
834
|
/**
|
|
787
835
|
* 级联细则(一句话:层序优先于 scope 特异度;层内 per-instance 胜标量):
|
|
788
|
-
* - 绑定组(provider + implementation):最特异层整组取(inst > slot >
|
|
836
|
+
* - 绑定组(provider + implementation):最特异层整组取(inst > slot > modules[owner] > root)——
|
|
789
837
|
* 独立 `??` 继承会产生跨层非法组合(inst.provider=wanda + 继承 slot 的 joycity impl),
|
|
790
838
|
* 故组不可拆;组内 implementation 缺席 → supplies 派生(唯一命中;
|
|
791
839
|
* 零命中/歧义/未注入查表 → binding-unresolved);双字段显式在场 = 显式即真值(不派生,
|
|
792
840
|
* 存量全显式文件零影响)。内联声明仅槽级且必带 implementation(防御分支兜底)。
|
|
793
|
-
* -
|
|
794
|
-
*
|
|
795
|
-
*
|
|
841
|
+
* - ownerOf(v6):service → moduleId 归属表(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 全部服务槽,与绑定来源层无关)
|
|
796
847
|
* - credentialRef:inst ?? slot ?? root.credentialRefByInstance[k] ?? root.credentialRef(v3 零改动;
|
|
797
|
-
*
|
|
848
|
+
* module 层无 credentialRef——链位预留 slot 后、root ByInstance 前)
|
|
798
849
|
* 不抛领域错误;status 由 SDK registry 映射 PROVIDER_* 错误码
|
|
799
850
|
* (binding-unresolved → PROVIDER_BINDING_UNRESOLVED;hasProviderBinding 点查 status !== 'ok' → false)。
|
|
800
851
|
*/
|
|
801
|
-
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;
|
|
802
853
|
/**
|
|
803
854
|
* root 部署实例注册表归一化(v4 wire → 消费形态单源):
|
|
804
855
|
* - instances 缺席 = 空表(无参考表——wanda 动态形态;空数组已在 zod 拒,此处纯防御);
|
|
@@ -827,7 +878,7 @@ interface CatalogProviderEntry {
|
|
|
827
878
|
/** 供给槽清单(service id) */
|
|
828
879
|
services: string[];
|
|
829
880
|
}
|
|
830
|
-
/** catalog 需求侧聚合条目(模块 manifest
|
|
881
|
+
/** catalog 需求侧聚合条目(模块 manifest declare.consumes 元素聚合;services 键 = service id) */
|
|
831
882
|
interface CatalogServiceEntry {
|
|
832
883
|
/** 可选槽(未配置不 error——doctor warning 级) */
|
|
833
884
|
optional: boolean;
|
|
@@ -868,11 +919,6 @@ interface KnowledgeResourceSpec {
|
|
|
868
919
|
}
|
|
869
920
|
/** 资源声明(discriminated by type;SDK zod / CLI doctor / 未来 app-toolkit 共用 wire 形状) */
|
|
870
921
|
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
922
|
|
|
877
923
|
/**
|
|
878
924
|
* contracts 期望面编译期锁(satisfies 语义防接口漂移——contracts 加名/改签名即编译红)。
|
|
@@ -880,11 +926,11 @@ interface ModuleConfig {
|
|
|
880
926
|
* contracts 恒 devDep 且限 import type——运行时全经 resolver 动态 import(版本解耦,D3)。
|
|
881
927
|
*/
|
|
882
928
|
interface EvaluationExports {
|
|
883
|
-
/** 求值单源(TIER0;v3 显式激活 vs v4
|
|
929
|
+
/** 求值单源(TIER0;v3 显式激活 vs v4 通配语义随应用版本;v6 第五参 ownerOf) */
|
|
884
930
|
resolveEffectiveService: typeof resolveEffectiveService;
|
|
885
931
|
/** 供给查表派生(谓词 #12 与视图供给轴共用输入) */
|
|
886
932
|
buildSupplyLookup: typeof buildSupplyLookup;
|
|
887
|
-
/** service →
|
|
933
|
+
/** service → 首点段域前缀(v6 deprecated——级联键控退役,仅词汇组织消费) */
|
|
888
934
|
moduleDomainOf: typeof moduleDomainOf;
|
|
889
935
|
/** 部署实例注册表归一(默认实例委托——null → '*' 通配口径) */
|
|
890
936
|
normalizeInstances: typeof normalizeInstances;
|
|
@@ -929,6 +975,9 @@ interface ResolvedContracts {
|
|
|
929
975
|
evaluation: boolean;
|
|
930
976
|
/** 严格 zod 面可用(parseIntegrationsConfig 在场——≥0.9 门控判据) */
|
|
931
977
|
strictValidation: boolean;
|
|
978
|
+
/** v6 形状标记在场(OWNERSHIP_BINDING_V6——modules[owner] 绑定形状支持;标记门 P1:
|
|
979
|
+
* v5 contracts + v6 toolkit 偏斜 → 503 第四分支,防静默忽略 ownerOf) */
|
|
980
|
+
ownershipBindingV6: boolean;
|
|
932
981
|
/** 动态 import 产物(命名导出子集——Partial<EvaluationExports>) */
|
|
933
982
|
module: ResolvedModule;
|
|
934
983
|
/** 解析诊断(N1 构建指引 message 三分支的输入:未安装 / 版本 <0.9 / 源码态未构建) */
|
|
@@ -958,19 +1007,24 @@ declare function invalidateContractsResolver(appDir?: string): void;
|
|
|
958
1007
|
* IMPL_WITHOUT_PROVIDER #5/#13 error impl-only(implementation 缺 provider 绑定组头)
|
|
959
1008
|
* INLINE_PROVIDER_INVALID #5 error 内联厂商声明超受控形状(槽级/实例级)
|
|
960
1009
|
* SCHEMA_FILE_MISSING #6 error credentialType schema 引用不存在
|
|
961
|
-
* DOMAIN_CONFIG_INVALID #7 error root/
|
|
1010
|
+
* DOMAIN_CONFIG_INVALID #7 error root/modules 死配置(键 ∉ 引用厂商 schema properties;
|
|
962
1011
|
* api.md DOMAIN_CONFIG_UNUSED 行预留 warning 级,
|
|
963
1012
|
* 现行为 error 恒等旧谓词——doctor 门控等价)
|
|
964
1013
|
* INSTANCE_KEY_NOT_REGISTERED #8 error ByInstance 键/实例键 ∉ 注册表白名单
|
|
965
1014
|
* REALM_SWITCH_HINT #9 warning 实现覆盖跨厂商(凭据域切换确认)
|
|
966
1015
|
* WILDCARD_ALIGNMENT #10 warning 通配形态齐步提示
|
|
967
1016
|
* MULTI_INSTANCE_NO_DEFAULT v4 warning 多实例无 defaultInstanceId(无 scope 访问落全局会话)
|
|
968
|
-
* VENDOR_NOT_INSTALLED #11 error root/
|
|
1017
|
+
* VENDOR_NOT_INSTALLED #11 error root/modules 厂商未命中已装供给
|
|
969
1018
|
* BINDING_UNRESOLVED #12 error 绑定不可解析(resolveEffectiveService 求值失败)
|
|
970
|
-
*
|
|
1019
|
+
* IMPL_WITHOUT_PROVIDER #5/#13 error impl-only(implementation 缺 provider 绑定组头)
|
|
971
1020
|
* RESOURCE_TYPE_UNKNOWN #15 error modules 资源节 type ∉ 词汇表
|
|
972
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)
|
|
973
1026
|
* ORPHANED_CREDENTIAL 写后对账 warning 凭据文件不再被引用(toolkit 写路径产出,非本谓词)
|
|
1027
|
+
* (v6 退役:DOMAIN_KEY_UNMATCHED #14——domains 键随归属模型退场)
|
|
974
1028
|
*
|
|
975
1029
|
* 输入形状(调用方负责装载):
|
|
976
1030
|
* - integrations:config/integrations.json 解析产物(宽松 Record 透传——严格 zod 校验归模板 loader)
|
|
@@ -987,33 +1041,32 @@ declare function invalidateContractsResolver(appDir?: string): void;
|
|
|
987
1041
|
* 继承绑定(槽级 provider 缺席)经 effective 求值取厂商——supplies 在场时)
|
|
988
1042
|
* #5 实例 impl-only 禁止 + 覆盖命中供给(含槽级内联形状;provider-only = 派生位,合法)
|
|
989
1043
|
* #6 manifest configSchema/credentialSchema 引用文件存在性(内联与 manifest 绑定同查)
|
|
990
|
-
* #7 root/
|
|
991
|
-
* 各槽 schema properties——引用面 = root.provider ∪
|
|
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)
|
|
992
1047
|
* #8 ByInstance/实例键 ∈ malls 白名单(v4:源 = root instances 注册表 ids——参考表在场时
|
|
993
|
-
* 激活;'**' 通配键豁免;注册表缺席 → 跳过;
|
|
1048
|
+
* 激活;'**' 通配键豁免;注册表缺席 → 跳过;modules 键 = install id 非 instanceId,不适用)
|
|
994
1049
|
* #9 实现覆盖跨厂商提示(realm switch——凭据域切换确认)
|
|
995
|
-
* #11 root/
|
|
1050
|
+
* #11 root/modules 厂商未命中已装供给(vendor 集合 = suppliedProviders 键前缀展开)
|
|
996
1051
|
* #12 绑定可解析性:逐 (service, instanceId) 经 contracts resolveEffectiveService 求值
|
|
997
|
-
*
|
|
1052
|
+
* (级联单源复用,谓词零级联实现;v6 ownerOf=ownership 显式参透传),binding-unresolved → error
|
|
998
1053
|
* #13 槽级/实例级 impl-only(implementation 需伴随 provider——provider 是绑定组头;
|
|
999
1054
|
* zod 之外的第二道防线——doctor 读裸 JSON)
|
|
1000
|
-
*
|
|
1001
|
-
*
|
|
1002
|
-
*
|
|
1003
|
-
*
|
|
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
|
|
1004
1061
|
*/
|
|
1005
1062
|
|
|
1006
1063
|
/** contracts 注入面(resolver 装配产物运行时视图 = EvaluationExports 求值子集) */
|
|
1007
|
-
type PredicateContracts = Pick<EvaluationExports, 'resolveEffectiveService' | 'buildSupplyLookup' | '
|
|
1064
|
+
type PredicateContracts = Pick<EvaluationExports, 'resolveEffectiveService' | 'buildSupplyLookup' | 'normalizeInstances' | 'RESOURCE_TYPE_IDS'>;
|
|
1008
1065
|
/** 派生查表形状(contracts buildSupplyLookup 产物;结构等价 TIER0 SupplyLookup——谓词零 contracts 静态依赖) */
|
|
1009
1066
|
type SupplyLookup = Record<string, readonly string[]>;
|
|
1010
1067
|
interface IntegrationServicePredicateInput {
|
|
1011
1068
|
integrations: {
|
|
1012
1069
|
provider?: string;
|
|
1013
|
-
domains?: Record<string, {
|
|
1014
|
-
provider?: string;
|
|
1015
|
-
config?: Record<string, unknown>;
|
|
1016
|
-
}>;
|
|
1017
1070
|
config?: Record<string, unknown>;
|
|
1018
1071
|
configByInstance?: Record<string, Record<string, unknown>>;
|
|
1019
1072
|
credentialRef?: string;
|
|
@@ -1038,8 +1091,10 @@ interface IntegrationServicePredicateInput {
|
|
|
1038
1091
|
}>;
|
|
1039
1092
|
/** v4 默认实例(normalizeInstances 解析语义:显式 ?? 单候选唯一解) */
|
|
1040
1093
|
defaultInstanceId?: string | null;
|
|
1041
|
-
/**
|
|
1094
|
+
/** v6 模块集成位(modules 节三键——宽松透传;严格 zod 归模板 loader) */
|
|
1042
1095
|
modules?: Record<string, {
|
|
1096
|
+
provider?: string;
|
|
1097
|
+
config?: Record<string, unknown>;
|
|
1043
1098
|
resources?: Record<string, {
|
|
1044
1099
|
type?: unknown;
|
|
1045
1100
|
}>;
|
|
@@ -1058,12 +1113,20 @@ interface IntegrationServicePredicateInput {
|
|
|
1058
1113
|
}>;
|
|
1059
1114
|
/** 派生查表(buildSupplyLookup 产物;缺席 → #12 跳过 + #2 继承绑定不查 credentialType) */
|
|
1060
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>;
|
|
1061
1121
|
/** malls 白名单(deployments 控制面 extract;缺席 → ByInstance 键检查跳过) */
|
|
1062
1122
|
malls?: string[];
|
|
1063
1123
|
/** credentialType → schema 文件引用缺失(manifest 声明指向缺失文件;#6) */
|
|
1064
1124
|
credentialSchemaMissing?: Record<string, boolean>;
|
|
1065
1125
|
/** 厂商 → 槽 schema properties 键集(#7 用;调用方从 manifest configSchema 引用解析) */
|
|
1066
1126
|
vendorConfigKeys?: Record<string, Set<string>>;
|
|
1127
|
+
/** G 批:厂商 → x-tbox-global 标记键集(#17 用;#7 同循环收集——零新增 IO);
|
|
1128
|
+
* 缺席/空集 = 该厂商零声明 → #17 对其键整体跳过 */
|
|
1129
|
+
vendorGlobalConfigKeys?: Record<string, Set<string>>;
|
|
1067
1130
|
/** 厂商 → configSchema 引用文件缺失(#7 跳过该厂商——无 schema 不能判死配置) */
|
|
1068
1131
|
vendorConfigSchemaMissing?: Record<string, boolean>;
|
|
1069
1132
|
/** 凭据文件缺失(#1:credentialRef stem → 档内 credentials/<stem>.json 在场;域中立注入) */
|
|
@@ -1072,7 +1135,7 @@ interface IntegrationServicePredicateInput {
|
|
|
1072
1135
|
credentialFileType?: Record<string, string | undefined>;
|
|
1073
1136
|
/** #9:实现覆盖跨厂商提示位(CLI 侧组装) */
|
|
1074
1137
|
realmSwitchHints?: string[];
|
|
1075
|
-
/** v5:已装模块 id → manifest
|
|
1138
|
+
/** v5:已装模块 id → manifest declare.resources 声明 id 集(值空集 = 无声明,资源级跳过;
|
|
1076
1139
|
* 缺席 = 无需求面信息——键未知/资源未声明检查跳过,type 检查恒跑) */
|
|
1077
1140
|
moduleResourceNeeds?: Record<string, ReadonlySet<string>>;
|
|
1078
1141
|
}
|
|
@@ -1107,7 +1170,7 @@ declare function evaluateIntegrationServices(input: IntegrationServicePredicateI
|
|
|
1107
1170
|
*
|
|
1108
1171
|
* manifest 候选路径探测(packages/<id>/tbox.module.json 优先 → node_modules/<pkg>/tbox.module.json;
|
|
1109
1172
|
* tbox-app dev 真身经 .tbox-dev.local/dev-manifest.json redirects 独立 catalog 通道直达)一次遍历同时产出:
|
|
1110
|
-
* 1. modules:已装模块清单(declared;demand meta
|
|
1173
|
+
* 1. modules:已装模块清单(declared;demand meta name/description 透传)
|
|
1111
1174
|
* 2. catalog(富形态):providers 嵌套(vendor→impl→entry,per-service {implementation, credentialType}
|
|
1112
1175
|
* 保真——同厂商异构/多实现合法,D25/H1)+ 需求侧聚合
|
|
1113
1176
|
* 3. serviceSchemas:per-service schema 复合键表——键 `${provider}\u0000${service}`(H2,同一服务
|
|
@@ -1118,10 +1181,12 @@ declare function evaluateIntegrationServices(input: IntegrationServicePredicateI
|
|
|
1118
1181
|
* ③ 候选自身 {service-slots.json, src/service-slots.json}(local/codegen 全量副本——
|
|
1119
1182
|
* mall 生成应用主形态,不依赖 install);零缓存枚举,与 manifest 探测同机制;
|
|
1120
1183
|
* 多行业 contracts-* 天然扩展 F8);缺席 → [](退化 demanded ∪ configured)
|
|
1121
|
-
* 5. slotMeta:词汇 meta 节(per-service {
|
|
1184
|
+
* 5. slotMeta:词汇 meta 节(per-service {name,description} 展示元数据——消费端兜底链
|
|
1122
1185
|
* 词汇 > demand > id,views/context resolveServiceDisplay 单源);多包发现序首声明胜出
|
|
1123
1186
|
* (与 catalog addSlots 同语义);contracts-mall 词汇锁保证 mall 域全量覆盖;缺席 → {}
|
|
1124
|
-
* 6.
|
|
1187
|
+
* 6. ownership:service → moduleId 归属表(v6——declare.owns 聚合;install id 键控;
|
|
1188
|
+
* 双 owner 冲突 → declarationIssues OWNERSHIP_CONFLICT + 先声明胜出)
|
|
1189
|
+
* 7. declarationIssues:声明面诊断(OWNERSHIP_CONFLICT / OLD_MANIFEST_KEY——P3 通道)
|
|
1125
1190
|
*
|
|
1126
1191
|
* **约束(D26;FX-3/F7 边界)**:目录枚举零缓存——readdir / node_modules 候选探测 / `.tbox/app.json` 读取 /
|
|
1127
1192
|
* dev-manifest 读取每次执行(枚举输入保持 fresh——agent 装卸模块下一笔即见);manifest/service-slots
|
|
@@ -1129,6 +1194,18 @@ declare function evaluateIntegrationServices(input: IntegrationServicePredicateI
|
|
|
1129
1194
|
* CLI 传 undefined 即全 fresh)。
|
|
1130
1195
|
* 宽松解析语义(坏文件静默 + 重复键首声明保留)零改动。
|
|
1131
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
|
+
};
|
|
1132
1209
|
interface WalkManifestsResult {
|
|
1133
1210
|
/** declared 产物(install id + descriptor;demand meta 透传) */
|
|
1134
1211
|
modules: WalkModuleInfo[];
|
|
@@ -1142,19 +1219,17 @@ interface WalkManifestsResult {
|
|
|
1142
1219
|
}>;
|
|
1143
1220
|
/** 服务词汇 = 所有携带 service-slots.json 的已装契约包 `.slots` 键并集(缺席 → []) */
|
|
1144
1221
|
vocabulary: string[];
|
|
1145
|
-
/** 词汇 meta 节:per-service {
|
|
1222
|
+
/** 词汇 meta 节:per-service {name,description} 展示元数据(多包首声明胜出;缺席 → {}) */
|
|
1146
1223
|
slotMeta: Record<string, SlotMeta>;
|
|
1147
|
-
/**
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
module?: string;
|
|
1153
|
-
}>;
|
|
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[];
|
|
1154
1229
|
}
|
|
1155
|
-
/** 槽位展示元数据(service-slots.json meta
|
|
1230
|
+
/** 槽位展示元数据(service-slots.json meta 节元素——宽松提取,字段皆可选;v7 词汇统一 title→name) */
|
|
1156
1231
|
interface SlotMeta {
|
|
1157
|
-
|
|
1232
|
+
name?: string;
|
|
1158
1233
|
description?: string;
|
|
1159
1234
|
}
|
|
1160
1235
|
interface WalkModuleInfo {
|
|
@@ -1167,15 +1242,15 @@ interface WalkModuleInfo {
|
|
|
1167
1242
|
descriptor: ModuleDescriptor;
|
|
1168
1243
|
}
|
|
1169
1244
|
/** 富形态供给条目:per-service {implementation, credentialType} 恒数组保真(H1);
|
|
1170
|
-
*
|
|
1171
|
-
* 首声明胜出,与 owner 同语义;B1 walk
|
|
1245
|
+
* name/description = 厂商展示元数据(strict manifest descriptor 透传——多包同厂商
|
|
1246
|
+
* 首声明胜出,与 owner 同语义;B1 walk 层传播;v7 词汇统一 title→name) */
|
|
1172
1247
|
interface WalkProviderEntry {
|
|
1173
1248
|
provider: string;
|
|
1174
1249
|
implementation: string;
|
|
1175
1250
|
credentialType: string;
|
|
1176
1251
|
owner: string;
|
|
1177
|
-
/** 厂商展示名(manifest
|
|
1178
|
-
|
|
1252
|
+
/** 厂商展示名(manifest name——多包首声明;缺席 = undefined) */
|
|
1253
|
+
name?: string;
|
|
1179
1254
|
description?: string;
|
|
1180
1255
|
local?: boolean;
|
|
1181
1256
|
configSchema?: string;
|
|
@@ -1190,8 +1265,8 @@ interface WalkCatalog {
|
|
|
1190
1265
|
provider: string;
|
|
1191
1266
|
implementation: string;
|
|
1192
1267
|
}>;
|
|
1193
|
-
/** demand meta(
|
|
1194
|
-
|
|
1268
|
+
/** demand meta(name/description 首声明保留——模块 manifest demand 侧 additive;v7 title→name) */
|
|
1269
|
+
name?: string;
|
|
1195
1270
|
description?: string;
|
|
1196
1271
|
owners: string[];
|
|
1197
1272
|
}>;
|
|
@@ -1247,16 +1322,18 @@ interface PredicateIoInputs {
|
|
|
1247
1322
|
credentialSchemaMissing: Record<string, boolean>;
|
|
1248
1323
|
/** #7:厂商 → configSchema properties 键集并集 */
|
|
1249
1324
|
vendorConfigKeys: Record<string, Set<string>>;
|
|
1325
|
+
/** #17(G 批):厂商 → x-tbox-global 标记键集(与 vendorConfigKeys 同循环收集——零新增 IO) */
|
|
1326
|
+
vendorGlobalConfigKeys: Record<string, Set<string>>;
|
|
1250
1327
|
/** #7:厂商 → configSchema 引用缺失(跳过该厂商死配置判定) */
|
|
1251
1328
|
vendorConfigSchemaMissing: Record<string, boolean>;
|
|
1252
1329
|
/** #9:实现覆盖跨厂商提示文案(已成形——谓词直投) */
|
|
1253
1330
|
realmSwitchHints: string[];
|
|
1254
1331
|
/** #8:root instances 注册表 ids(在场才传;缺席 → 键检查跳过) */
|
|
1255
1332
|
malls?: string[];
|
|
1256
|
-
/** #15-#16:已装模块 id → manifest
|
|
1333
|
+
/** #15-#16:已装模块 id → manifest declare.resources 声明 id 集 */
|
|
1257
1334
|
moduleResourceNeeds: Record<string, ReadonlySet<string>>;
|
|
1258
1335
|
}
|
|
1259
|
-
/** 装配全产物(= PredicateIoInputs +
|
|
1336
|
+
/** 装配全产物(= PredicateIoInputs + 供给/需求/归属聚合——喂 evaluateIntegrationServices 的
|
|
1260
1337
|
* 非 contracts/integrations 入参全集,两消费方 spread 直投,零各自组装) */
|
|
1261
1338
|
interface PredicateAssembly extends PredicateIoInputs {
|
|
1262
1339
|
suppliedProviders: Record<string, {
|
|
@@ -1268,6 +1345,9 @@ interface PredicateAssembly extends PredicateIoInputs {
|
|
|
1268
1345
|
optional: boolean;
|
|
1269
1346
|
owners: string[];
|
|
1270
1347
|
}>;
|
|
1348
|
+
/** v6:服务归属表 + 已装模块 id 集(MODULE_CONFIG_DEAD / #12 ownerOf 透传) */
|
|
1349
|
+
ownership?: Record<string, string>;
|
|
1350
|
+
installedModuleIds?: ReadonlySet<string>;
|
|
1271
1351
|
}
|
|
1272
1352
|
/** stem → env 键(kebab → UPPER_SNAKE;与 SDK/provider-secret env 兜底同公式) */
|
|
1273
1353
|
declare function refToEnvKey(stem: string): string;
|
|
@@ -1296,14 +1376,16 @@ declare function evaluateAppIntegrationIssues(appDir: string, integrations: Reco
|
|
|
1296
1376
|
*
|
|
1297
1377
|
* 不变式:**删除判据 ≡ doctor integration-services 报错判据(构造性同源)**——消费 doctor 同一
|
|
1298
1378
|
* 共享求值器 evaluateAppIntegrationIssues 的结构化 issue,code 白名单
|
|
1299
|
-
* {VENDOR_NOT_INSTALLED, BINDING_UNRESOLVED} + 守卫(绑定引用链候选
|
|
1300
|
-
* 即保留,排除活厂商错配)→ 删除域严格 = "供给载体消亡"。
|
|
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 为判据源)。
|
|
1301
1383
|
*
|
|
1302
1384
|
* 由此推论(均已实证):需求侧孤儿绑定(demand 消失、供给在场)保留——doctor 判其合法;用户
|
|
1303
1385
|
* 预配置绑定受保护;一次 remove 自愈全文件历史死债;凭据类 issue(CREDENTIAL_FILE_MISSING 等)
|
|
1304
1386
|
* 刻意不进白名单,原样保留。
|
|
1305
1387
|
*
|
|
1306
|
-
* 写侧三防线(镜像 write core
|
|
1388
|
+
* 写侧三防线(镜像 write core):归一化(空节点删键)→ parseIntegrationsConfig
|
|
1307
1389
|
* 严格校验(失败弃写)→ writeAtomic。凭据孤儿只报告不清理(D9——与 DELETE 管线现行为一致)。
|
|
1308
1390
|
* 全空(无任何存活绑定)→ 删文件——ensureMockBindings(缺席即生成)在重装供给时再生闭环。
|
|
1309
1391
|
*
|
|
@@ -1320,6 +1402,23 @@ interface PruneResult {
|
|
|
1320
1402
|
}
|
|
1321
1403
|
declare function pruneIntegrationBindings(appDir: string): Promise<PruneResult>;
|
|
1322
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
|
+
|
|
1323
1422
|
/**
|
|
1324
1423
|
* .tbox/app.json npmModules 读写(自 CLI manifest.ts 迁入——assembly 层目录知识单源)。
|
|
1325
1424
|
* npmModules 登记 = sdk 包双语义磁盘足迹之一(业务包 = packages/<id>/ 目录,sdk 包 = 本清单登记)。
|
|
@@ -1410,7 +1509,7 @@ interface BridgeProviderCatalog {
|
|
|
1410
1509
|
}
|
|
1411
1510
|
/** 富形态(工厂迁移面):walkManifests 产物直通 */
|
|
1412
1511
|
declare function loadProviderCatalogRaw(appDir: string): WalkCatalog;
|
|
1413
|
-
/** 桥源(形态冻结):富形态 → 桥形状投影(demand meta
|
|
1512
|
+
/** 桥源(形态冻结):富形态 → 桥形状投影(demand meta name/description 剥离——桥面无此字段,
|
|
1414
1513
|
* additive 差异声明见 app-sdk 桥 golden) */
|
|
1415
1514
|
declare function loadProviderCatalog(appDir: string): BridgeProviderCatalog;
|
|
1416
1515
|
interface ProviderServiceSchemas {
|
|
@@ -1540,7 +1639,8 @@ interface WriteCore {
|
|
|
1540
1639
|
warmup(): Promise<void>;
|
|
1541
1640
|
/** PUT /app/integration(root 节点全集) */
|
|
1542
1641
|
applyApp(node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
|
|
1543
|
-
/** PUT /modules/:module/integration(
|
|
1642
|
+
/** PUT /modules/:module/integration(v6 modules[owner] 集成位;键集纪律见 MODULE_INTEGRATION_NODE_KEYS;
|
|
1643
|
+
* N1 {} 清 provider/config 保 resources;moduleOwnershipWritable 写守卫单源) */
|
|
1544
1644
|
applyModule(moduleId: string, node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
|
|
1545
1645
|
/** PUT /services/:service/integration(整节点含 instances map;N3 {} 不归一化;v4.4 A2 身份判据) */
|
|
1546
1646
|
applyService(service: string, node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
|
|
@@ -1568,6 +1668,44 @@ interface MockBindingsResult {
|
|
|
1568
1668
|
}
|
|
1569
1669
|
declare function ensureMockBindings(appDir: string): MockBindingsResult;
|
|
1570
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
|
+
|
|
1571
1709
|
/**
|
|
1572
1710
|
* AppToolkitError(领域 6 码 + 壳层 2 码分界——toolkit 只产领域码):
|
|
1573
1711
|
* VALIDATION_FAILED(400) / SERVICE_NOT_FOUND(404) / MODULE_NOT_FOUND(404) /
|
|
@@ -1601,6 +1739,11 @@ declare function contractsNotResolvedMessage(contracts: {
|
|
|
1601
1739
|
* agtcodingbox / tbox-ai-coding 经 `import type` 消费(L2 DTO 单源——API 层零类型镜像)。
|
|
1602
1740
|
* 词汇七概念:app / module / service / instance / provider / integration / resolution。
|
|
1603
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 / 运行时读)需同窗迁移。
|
|
1604
1747
|
*/
|
|
1605
1748
|
/** contracts 求值五态原样(EffectiveServiceResolution.status) */
|
|
1606
1749
|
type ServiceStatus = 'ok' | 'service-not-configured' | 'instance-not-found' | 'instance-disabled' | 'binding-unresolved';
|
|
@@ -1615,58 +1758,57 @@ interface ModulesView {
|
|
|
1615
1758
|
interface ModuleDeclaration {
|
|
1616
1759
|
/** install id(packages/ 目录名 / .tbox/app.json entry.id)——恒业务模块(provider 家族不在本清单) */
|
|
1617
1760
|
id: string;
|
|
1618
|
-
/**
|
|
1761
|
+
/** 展示名(v7 词汇统一:manifest name ?? id——恒有值) */
|
|
1619
1762
|
name: string;
|
|
1620
|
-
title: string;
|
|
1621
1763
|
description: string;
|
|
1622
1764
|
}
|
|
1623
1765
|
/** 服务需求声明(模块 demand 单元 / 平台服务条目——v4.4 D29 双端点同型;defaults 唯一落位 ServiceDetail) */
|
|
1624
1766
|
interface ServiceDemand {
|
|
1625
1767
|
service: string;
|
|
1626
|
-
/** manifest demand meta
|
|
1627
|
-
|
|
1768
|
+
/** manifest demand meta(v7 title→name);缺席 UI 回退 service id */
|
|
1769
|
+
name?: string;
|
|
1628
1770
|
description?: string;
|
|
1629
1771
|
/** demand optional === false(多模块 OR 聚合见 resolution echo;平台服务条目恒 false) */
|
|
1630
1772
|
required: boolean;
|
|
1631
1773
|
}
|
|
1632
1774
|
/** GET /modules/:module(模块静态一站式 · PUT 读对偶) */
|
|
1633
1775
|
interface ModuleDetailView {
|
|
1634
|
-
/**
|
|
1635
|
-
|
|
1776
|
+
/** 模块展示名(v7 词汇统一:manifest name ?? id——恒有值) */
|
|
1777
|
+
name: string;
|
|
1636
1778
|
/** B1 additive:模块 meta 描述(manifest description;兜底 '') */
|
|
1637
1779
|
description: string;
|
|
1638
|
-
/**
|
|
1639
|
-
|
|
1640
|
-
|
|
1780
|
+
/** v6 所有权模型:模块归属服务(declare.owns 展平,排序;零归属 = [])——
|
|
1781
|
+
* v5 domainKeys 退役(破坏性更名;面板 presence-detection 双读义务见 api.md §3) */
|
|
1782
|
+
ownedServices: string[];
|
|
1783
|
+
/** modules[install id] 集成位原值(provider/config;resources 不投影);未配置 = null */
|
|
1641
1784
|
integration: ModuleIntegrationNode | null;
|
|
1642
|
-
/**
|
|
1643
|
-
|
|
1644
|
-
|
|
1785
|
+
/** v6 单数化(v5 providerBindings[] 退役):模块级厂商绑定解析(resolveModuleBinding 单源;
|
|
1786
|
+
* 单值作用于全部 ownedServices) */
|
|
1787
|
+
binding: ModuleBinding | null;
|
|
1788
|
+
/** v6:owns.length > 0(moduleOwnershipWritable 单源——读标志与写守卫共用) */
|
|
1645
1789
|
configEditable: boolean;
|
|
1646
|
-
/** 本模块 demand
|
|
1790
|
+
/** 本模块 demand(declare.consumes;卡片展开 + 编辑器静态上下文自足) */
|
|
1647
1791
|
services: ServiceDemand[];
|
|
1648
1792
|
/** v4.4 D31:include=serviceResolutions 内嵌(demand 服务过滤 ≡ 批量 ?service= 语义;<0.9/形态异常 → null——永不 503) */
|
|
1649
1793
|
serviceResolutions?: ServiceResolutionsView | null;
|
|
1650
|
-
/** v4.4 D32:include=integrationSchemas
|
|
1794
|
+
/** v4.4 D32:include=integrationSchemas 层级富化(零归属/未绑定 → null) */
|
|
1651
1795
|
integrationSchemas?: LayerIntegrationSchemas | null;
|
|
1652
1796
|
/** v4.6 D36:include=integrationFieldRegistry 集成字段注册表(null 语义镜像 integrationSchemas;
|
|
1653
1797
|
* 未知厂商/零足迹 → 非 null 空集 + unsupplied 回填——D37 轴参假想计算同此) */
|
|
1654
1798
|
integrationFieldRegistry?: IntegrationFieldRegistryView | null;
|
|
1655
1799
|
}
|
|
1656
|
-
/**
|
|
1657
|
-
interface
|
|
1658
|
-
/**
|
|
1659
|
-
|
|
1660
|
-
/** domains[domain].provider ?? root.provider(双缺 = null) */
|
|
1661
|
-
effective: string | null;
|
|
1800
|
+
/** 模块级厂商绑定解析(v6——静态文件事实;规则 ≡ 谓词 #7 模块层,resolveModuleBinding 单源) */
|
|
1801
|
+
interface ModuleBinding {
|
|
1802
|
+
/** modules[install id].provider ?? root.provider(双缺 = null) */
|
|
1803
|
+
provider: string | null;
|
|
1662
1804
|
/** 生效来源层(双缺 = null) */
|
|
1663
1805
|
layer: 'module' | 'app' | null;
|
|
1664
1806
|
}
|
|
1665
1807
|
/** 层级 config schema 计算(v4.4 D32——静态轴富化,零 contracts) */
|
|
1666
1808
|
interface LayerIntegrationSchemas {
|
|
1667
|
-
/** 层生效厂商(
|
|
1809
|
+
/** 层生效厂商(resolveModuleBinding 单源) */
|
|
1668
1810
|
provider: string;
|
|
1669
|
-
/** 模块级 = 本模块
|
|
1811
|
+
/** 模块级 = 本模块 ownedServices ∩ 该厂商供给;应用级 = 供给足迹全量(configSchema = raw draft 2020-12 原文;供给在场未声明 = null) */
|
|
1670
1812
|
services: Record<string, {
|
|
1671
1813
|
configSchema: object | null;
|
|
1672
1814
|
}>;
|
|
@@ -1682,7 +1824,7 @@ interface IntegrationFieldRegistryView {
|
|
|
1682
1824
|
unsupplied: string[];
|
|
1683
1825
|
/** 作用域内全部非 null schema 的 additionalProperties 均 ≠ false(聚合;空真) */
|
|
1684
1826
|
additionalPropertiesAllowed: boolean;
|
|
1685
|
-
/** 逐 key 合并产物(首声明插入序 = scope 遍历序:app 字母序 / module
|
|
1827
|
+
/** 逐 key 合并产物(首声明插入序 = scope 遍历序:app 字母序 / module ownedServices 序) */
|
|
1686
1828
|
fields: Array<{
|
|
1687
1829
|
key: string;
|
|
1688
1830
|
/** null = 类型不可调和(R3/R2 异构/R1 enum 不等——冲突折叠,客户端 RawJson 保真) */
|
|
@@ -1692,6 +1834,9 @@ interface IntegrationFieldRegistryView {
|
|
|
1692
1834
|
service: string;
|
|
1693
1835
|
required: boolean;
|
|
1694
1836
|
}>;
|
|
1837
|
+
/** G 批:x-tbox-global 聚合旗标(sources.some——任一来源声明即 true;app/module 轴表单
|
|
1838
|
+
* 仅渲染 true 字段,非全局键落 ExtraFields;service 轴全量透传) */
|
|
1839
|
+
global: boolean;
|
|
1695
1840
|
}>;
|
|
1696
1841
|
}
|
|
1697
1842
|
/** GET /app(应用静态视图:平台服务 + root 原值) */
|
|
@@ -1723,11 +1868,14 @@ interface ServiceDetail extends ServiceDemand {
|
|
|
1723
1868
|
/** v4.7 D38:include=integrationSchemas 生效绑定富化(三态:null 全链未绑定 /
|
|
1724
1869
|
* 绑定无可计算 schema / 含 schema;malformed 节点 → null——不放行域级联) */
|
|
1725
1870
|
integrationSchemas?: ServiceIntegrationSchemas | null;
|
|
1871
|
+
/** G 批:include=integrationFieldRegistry 服务轴注册表(loadServiceFieldRegistry——
|
|
1872
|
+
* 四分支链推导复用 D38;fields = 该 schema 全部字段带 global 旗标;null 语义镜像 D38) */
|
|
1873
|
+
integrationFieldRegistry?: IntegrationFieldRegistryView | null;
|
|
1726
1874
|
}
|
|
1727
1875
|
/** 服务级生效绑定 schema(v4.7 D38 静态轴富化——零 contracts,永不 503;实例层无条件排除:
|
|
1728
1876
|
* node 级口径 ≠ resolution 默认实例口径,api.md §4.4 注) */
|
|
1729
1877
|
interface ServiceIntegrationSchemas {
|
|
1730
|
-
/** 生效厂商:显式(含内联声明名)??
|
|
1878
|
+
/** 生效厂商:显式(含内联声明名)?? modules[ownerOf].provider ?? root.provider */
|
|
1731
1879
|
provider: string;
|
|
1732
1880
|
/** catalog 复合键(多 impl 声明序首个)> 内联 ref;miss(未知厂商/未供给/内联缺 ref)→ null(富化非门控) */
|
|
1733
1881
|
configSchema: object | null;
|
|
@@ -1792,14 +1940,18 @@ interface AppIntegrationNode {
|
|
|
1792
1940
|
defaultInstanceId?: string | null;
|
|
1793
1941
|
}
|
|
1794
1942
|
/** AppIntegrationNode 键集单源(runtime const——write applyApp 全量替换白名单
|
|
1795
|
-
* (缺席根键删除;services/
|
|
1796
|
-
* D21/L1——文件含 services/
|
|
1943
|
+
* (缺席根键删除;services/modules 域不在其中;v6 domains 键退役)+ views/app 投影
|
|
1944
|
+
* (GET 预填 ≡ PUT body,D21/L1——文件含 services/modules 但 root 节点投影只含本键集)) */
|
|
1797
1945
|
declare const APP_INTEGRATION_NODE_KEYS: readonly ["provider", "config", "configByInstance", "credentialRef", "credentialRefByInstance", "instances", "defaultInstanceId"];
|
|
1798
|
-
/**
|
|
1946
|
+
/** 模块集成位节点(v6——provider 绑定默认 + config 级联层;resources 不投影不写——
|
|
1947
|
+
* 集成位编辑恒保全资源节,N2) */
|
|
1799
1948
|
interface ModuleIntegrationNode {
|
|
1800
1949
|
provider?: string;
|
|
1801
1950
|
config?: Record<string, unknown>;
|
|
1802
1951
|
}
|
|
1952
|
+
/** ModuleIntegrationNode 可写键集单源(v6——write applyModule 全量替换白名单
|
|
1953
|
+
* (键集外 400;resources 恒随既有节点保全)+ views/modules 投影(GET ≡ PUT,三同构)) */
|
|
1954
|
+
declare const MODULE_INTEGRATION_NODE_KEYS: readonly ["provider", "config"];
|
|
1803
1955
|
/** services[s] 整节点 */
|
|
1804
1956
|
interface ServiceIntegrationNode {
|
|
1805
1957
|
/** 对象 = 自定义 API(仅槽级,P2) */
|
|
@@ -1849,8 +2001,8 @@ interface ProviderEntry {
|
|
|
1849
2001
|
local: boolean;
|
|
1850
2002
|
/** 供给声明来源包名 */
|
|
1851
2003
|
owner: string;
|
|
1852
|
-
/**
|
|
1853
|
-
|
|
2004
|
+
/** 厂商展示名(v7 title→name:manifest name——多包首声明;缺席 = undefined) */
|
|
2005
|
+
name?: string;
|
|
1854
2006
|
description?: string;
|
|
1855
2007
|
}
|
|
1856
2008
|
/** GET /providers/:provider:供给足迹 */
|
|
@@ -1858,8 +2010,8 @@ interface ProviderDetail {
|
|
|
1858
2010
|
provider: string;
|
|
1859
2011
|
local: boolean;
|
|
1860
2012
|
owner: string;
|
|
1861
|
-
/**
|
|
1862
|
-
|
|
2013
|
+
/** 厂商展示名(同 ProviderEntry——首声明透传) */
|
|
2014
|
+
name?: string;
|
|
1863
2015
|
description?: string;
|
|
1864
2016
|
/** per (provider, service) 保真,同厂商异构合法;★ implementations 恒数组(H1——
|
|
1865
2017
|
* 多元素 = 升级窗口,UI 出 impl 选择器,PUT 显式钉版) */
|
|
@@ -1868,8 +2020,8 @@ interface ProviderDetail {
|
|
|
1868
2020
|
implementation: string;
|
|
1869
2021
|
credentialType: string;
|
|
1870
2022
|
}>;
|
|
1871
|
-
/**
|
|
1872
|
-
|
|
2023
|
+
/** 服务展示名(resolveServiceDisplay——词汇 > demand > id;恒发) */
|
|
2024
|
+
name?: string;
|
|
1873
2025
|
description?: string;
|
|
1874
2026
|
/** v4.4 F5:include=integrationSchemas 切换态批量(纯 config——凭据结构归 /credential-types) */
|
|
1875
2027
|
integrationSchemas?: {
|
|
@@ -1957,7 +2109,7 @@ interface IntegrationIssue {
|
|
|
1957
2109
|
|
|
1958
2110
|
/**
|
|
1959
2111
|
* 视图装配共享上下文(五投影共用;目录枚举零缓存——walkManifests 每次调用执行)。
|
|
1960
|
-
*
|
|
2112
|
+
* v6:域前缀换算退役(domainOfService 随归属模型退场)——模块占用判定改 declare 三键直读。
|
|
1961
2113
|
*/
|
|
1962
2114
|
interface ViewContext {
|
|
1963
2115
|
appDir: string;
|
|
@@ -1975,16 +2127,16 @@ interface ViewSnapshot {
|
|
|
1975
2127
|
declare function loadModulesView(snapshot: ViewSnapshot): {
|
|
1976
2128
|
modules: ModuleDeclaration[];
|
|
1977
2129
|
};
|
|
1978
|
-
/** GET /modules/:module:模块静态一站式(
|
|
2130
|
+
/** GET /modules/:module:模块静态一站式(modules[install id] 集成位原值 + demand;PUT 读对偶) */
|
|
1979
2131
|
declare function loadModuleDetailView(snapshot: ViewSnapshot, moduleId: string): ModuleDetailView;
|
|
1980
2132
|
|
|
1981
2133
|
/**
|
|
1982
2134
|
* 应用静态投影(views/app;C4;FX-1c B10——root 节点投影修;v4.4 D29——services 双端点同型)。
|
|
1983
2135
|
* /app = 平台服务 + root 节点原值(纯静态):services = 服务词汇 − 模块占用
|
|
1984
|
-
* (ServiceDemand[]——平台条目 required 恒 false、
|
|
2136
|
+
* (ServiceDemand[]——平台条目 required 恒 false、name/description 缺席,D29);
|
|
1985
2137
|
* 平台服务状态不在此(→ /service-resolutions);模块服务不在此(→ /modules/:m)。
|
|
1986
2138
|
* integration = **root 节点投影**(APP_INTEGRATION_NODE_KEYS——D21/L1:GET 预填 ≡ PUT body;
|
|
1987
|
-
* 文件另含 services/
|
|
2139
|
+
* 文件另含 services/modules 域键,不进 root 节点投影——原实现整文件透传,
|
|
1988
2140
|
* PUT 回会级联写回域键);文件缺席 = null,文件在场 → 投影对象(可为空)。
|
|
1989
2141
|
*/
|
|
1990
2142
|
declare function loadAppView(snapshot: ViewSnapshot): AppView;
|
|
@@ -2038,19 +2190,34 @@ declare function loadServiceResolutionDetail(service: string, snapshot: ViewSnap
|
|
|
2038
2190
|
* 复合解析——v4.7 D38 收口,零新读取路径;供给在场未声明 = null,mock 合法) */
|
|
2039
2191
|
declare function resolveLayerIntegrationSchemas(snapshot: ViewSnapshot, provider: string, services: readonly string[]): LayerIntegrationSchemas;
|
|
2040
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;
|
|
2041
2203
|
/** app 级 loader(v4.6 委托化——签名零改动,公开面保持;假想态归 loadAppFormViews override 参) */
|
|
2042
2204
|
declare function loadAppIntegrationSchemas(snapshot: ViewSnapshot): LayerIntegrationSchemas | null;
|
|
2043
2205
|
/** module 级 loader(v4.6 委托化——同上;多域/零域/共享键/未绑定 → 整字段 null,表单降级 = ExtraFields) */
|
|
2044
2206
|
declare function loadModuleIntegrationSchemas(snapshot: ViewSnapshot, moduleId: string): LayerIntegrationSchemas | null;
|
|
2045
2207
|
/** 服务级 loader(v4.7 D38):四分支穷举(node.provider = 文件 services[s].provider 逐字原值;
|
|
2046
2208
|
* 实例层无条件排除——node 级口径);非空三分支归约一次复合解析。
|
|
2047
|
-
* ① undefined/'' →
|
|
2209
|
+
* ① undefined/'' → 模块级联(v6:modules[ownerOf[s]] → root 双缺 → 整字段 null)
|
|
2048
2210
|
* ② 非空 string → bare:catalog miss(未知厂商/未供给)→ configSchema:null 不 404(富化非门控)
|
|
2049
2211
|
* ③ 受控内联(isControlledInlineProvider 单源)→ 名 = p.provider;catalog 复合键 > p.configSchema ref
|
|
2050
2212
|
* (H9 逃逸 400 照抛——readInlineSchema 共享路径)
|
|
2051
2213
|
* ④ 其余(null/数组/原始值/坏对象)→ 整字段 null(≡ 谓词 #5 INLINE_PROVIDER_INVALID 同判——
|
|
2052
2214
|
* 不放行域级联,防错误 schema 污染坏节点) */
|
|
2053
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;
|
|
2054
2221
|
|
|
2055
2222
|
/**
|
|
2056
2223
|
* 凭据状态轴投影(views/credentials;v4.4 D33 独立端点 GET /credentials):
|
|
@@ -2101,10 +2268,13 @@ interface AppToolkitOptions {
|
|
|
2101
2268
|
/** 写成功(实际落盘且非 dryRun/no-diff)→ 调用一次(宿主闭包内防抖/守卫);CLI 不传恒 false */
|
|
2102
2269
|
onApplied?: () => void;
|
|
2103
2270
|
}
|
|
2104
|
-
/** ── 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。 */
|
|
2105
2274
|
interface AppToolkitRead {
|
|
2106
2275
|
loadModules(): Promise<ModulesView>;
|
|
2107
|
-
/** v4.6 D37:moduleProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include
|
|
2276
|
+
/** v4.6 D37:moduleProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include 键同现)。
|
|
2277
|
+
* moduleId = 双键(id 优先、唯一展示名兜底)。 */
|
|
2108
2278
|
loadModule(moduleId: string, o?: {
|
|
2109
2279
|
include?: string[];
|
|
2110
2280
|
moduleProvider?: string;
|
|
@@ -2129,7 +2299,8 @@ interface AppToolkitRead {
|
|
|
2129
2299
|
/** GET /credential-types[?provider=](v4.4 D33——供给轴静态;零门控,永不 503) */
|
|
2130
2300
|
loadCredentialTypes(provider?: string): Promise<CredentialTypesView>;
|
|
2131
2301
|
}
|
|
2132
|
-
/** ── HTTP 直通面(4 写;body ≡ 文件节点全量替换;DELETE 无 dryRun/无 options)──
|
|
2302
|
+
/** ── HTTP 直通面(4 写;body ≡ 文件节点全量替换;DELETE 无 dryRun/无 options)──
|
|
2303
|
+
* 双键契约(v7):路径键双键寻址(写侧 enqueue 闭包内解析——落盘键恒真实 id)。 */
|
|
2133
2304
|
interface AppToolkitWrite {
|
|
2134
2305
|
writeAppIntegration(node: AppIntegrationNode, o?: {
|
|
2135
2306
|
dryRun?: boolean;
|
|
@@ -2179,4 +2350,4 @@ interface AppToolkitInternals {
|
|
|
2179
2350
|
type AppToolkit = AppToolkitRead & AppToolkitWrite & AppToolkitInternals;
|
|
2180
2351
|
declare function createAppToolkit(appDir: string, options?: AppToolkitOptions): AppToolkit;
|
|
2181
2352
|
|
|
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
|
|
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 };
|