@tbox.cn/app-toolkit 0.7.2 → 0.7.4
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/index.d.ts +114 -114
- package/dist/index.js +1 -1
- package/package.json +2 -3
- package/src/assembly/app-manifest.ts +1 -1
- package/src/assembly/provider-catalog.ts +4 -4
- package/src/assembly/resolve-key.ts +1 -1
- package/src/assembly/walk-manifests.ts +8 -8
- package/src/core/contracts-expected.ts +1 -1
- package/src/core/contracts-resolver.ts +9 -9
- package/src/core/file-cache.ts +3 -3
- package/src/core/module-schema.ts +1 -1
- package/src/dto.ts +30 -30
- package/src/factory.ts +31 -31
- package/src/index.ts +1 -1
- package/src/integrations/credentials.ts +4 -4
- package/src/integrations/evaluate-app.ts +2 -2
- package/src/integrations/mock-bindings.ts +1 -1
- package/src/integrations/module-binding.ts +4 -4
- package/src/integrations/predicate-io.ts +1 -1
- package/src/integrations/predicate.ts +9 -9
- package/src/integrations/prune-bindings.ts +6 -6
- package/src/integrations/read.ts +3 -3
- package/src/integrations/write.ts +17 -17
- package/src/views/app.ts +3 -3
- package/src/views/credential-types.ts +1 -1
- package/src/views/credentials.ts +2 -2
- package/src/views/integration-schemas.ts +28 -28
- package/src/views/modules.ts +1 -1
- package/src/views/providers.ts +8 -8
- package/src/views/service-detail.ts +3 -3
- package/src/views/service-resolutions.ts +17 -17
- package/tests/views.test.ts +5 -5
package/src/dto.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface ModuleDeclaration {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/** 服务需求声明(模块 demand 单元 / 平台服务条目 / owned-not-consumed 投影条目——
|
|
51
|
-
* v4.4
|
|
51
|
+
* v4.4 双端点同型;defaults 唯一落位 ServiceDetail) */
|
|
52
52
|
export interface ServiceDemand {
|
|
53
53
|
service: string;
|
|
54
54
|
/** manifest demand meta(v7 title→name);缺席 UI 回退 service id */
|
|
@@ -87,12 +87,12 @@ export interface ModuleDetailView {
|
|
|
87
87
|
* 空判特例:consume 条目胜出[声明序原样、required = optional === false];owned-not-consumed
|
|
88
88
|
* 追加[ownedServices 排序序、Set 去重,required 恒 false]。卡片展开 + 编辑器静态上下文自足) */
|
|
89
89
|
services: ServiceDemand[];
|
|
90
|
-
/** v4.4
|
|
90
|
+
/** v4.4 include=serviceResolutions 内嵌(v6.1 键集 = owned ∪ demand 服务过滤 ≡ 批量 ?service= 语义;<0.9/形态异常 → null——永不 503) */
|
|
91
91
|
serviceResolutions?: ServiceResolutionsView | null;
|
|
92
|
-
/** v4.4
|
|
92
|
+
/** v4.4 include=integrationSchemas 层级富化(零归属/未绑定 → null) */
|
|
93
93
|
integrationSchemas?: LayerIntegrationSchemas | null;
|
|
94
|
-
/** v4.6
|
|
95
|
-
* 未知厂商/零足迹 → 非 null 空集 + unsupplied 回填——
|
|
94
|
+
/** v4.6 include=integrationFieldRegistry 集成字段注册表(null 语义镜像 integrationSchemas;
|
|
95
|
+
* 未知厂商/零足迹 → 非 null 空集 + unsupplied 回填—— 轴参假想计算同此) */
|
|
96
96
|
integrationFieldRegistry?: IntegrationFieldRegistryView | null;
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -104,7 +104,7 @@ export interface ModuleBinding {
|
|
|
104
104
|
layer: 'module' | 'app' | null;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
/** 层级 config schema 计算(v4.4
|
|
107
|
+
/** 层级 config schema 计算(v4.4——静态轴富化,零 contracts) */
|
|
108
108
|
export interface LayerIntegrationSchemas {
|
|
109
109
|
/** 层生效厂商(resolveModuleBinding 单源) */
|
|
110
110
|
provider: string;
|
|
@@ -112,10 +112,10 @@ export interface LayerIntegrationSchemas {
|
|
|
112
112
|
services: Record<string, { configSchema: object | null }>;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
/** v4.6
|
|
115
|
+
/** v4.6 集成字段注册表(层级表单服务端预计算——合并代数// 服务端单源;
|
|
116
116
|
* 消费 resolveLayerIntegrationSchemas 产物构造,禁旁路直取 serviceSchemas) */
|
|
117
117
|
export interface IntegrationFieldRegistryView {
|
|
118
|
-
/** echo:本注册表计算口径(假想时 =
|
|
118
|
+
/** echo:本注册表计算口径(假想时 = 轴参值——) */
|
|
119
119
|
provider: string;
|
|
120
120
|
/** 作用域内 configSchema === null 的服务(UI「未提供参数模板」提示行) */
|
|
121
121
|
schemaless: string[];
|
|
@@ -127,7 +127,7 @@ export interface IntegrationFieldRegistryView {
|
|
|
127
127
|
/** 逐 key 合并产物(首声明插入序 = scope 遍历序:app 字母序 / module ownedServices 序) */
|
|
128
128
|
fields: Array<{
|
|
129
129
|
key: string;
|
|
130
|
-
/** null =
|
|
130
|
+
/** null = 类型不可调和(/ 异构/ enum 不等——冲突折叠,客户端 RawJson 保真) */
|
|
131
131
|
schema: object | null;
|
|
132
132
|
/** required 聚合 = sources.some(s => s.required);conflict 字段照常聚合 */
|
|
133
133
|
sources: Array<{ service: string; required: boolean }>;
|
|
@@ -139,17 +139,17 @@ export interface IntegrationFieldRegistryView {
|
|
|
139
139
|
|
|
140
140
|
/** GET /app(应用静态视图:平台服务 + root 原值) */
|
|
141
141
|
export interface AppView {
|
|
142
|
-
/** 平台服务(v4.4
|
|
142
|
+
/** 平台服务(v4.4 服务词汇 − 模块占用——与模块 demand 同型 ServiceDemand[];
|
|
143
143
|
* title/description 缺席 = UI 回退 service id;required 恒 false——平台服务无 demand 源) */
|
|
144
144
|
services: ServiceDemand[];
|
|
145
145
|
/** root 节点原值;文件缺席 = null */
|
|
146
146
|
integration: AppIntegrationNode | null;
|
|
147
|
-
/** v4.4
|
|
147
|
+
/** v4.4 include=serviceResolutions 内嵌(全量键集 ≡ 批量无参;<0.9/形态异常 → null——永不 503) */
|
|
148
148
|
serviceResolutions?: ServiceResolutionsView | null;
|
|
149
|
-
/** v4.4
|
|
149
|
+
/** v4.4 include=integrationSchemas 层级富化(root.provider 缺席 → null) */
|
|
150
150
|
integrationSchemas?: LayerIntegrationSchemas | null;
|
|
151
|
-
/** v4.6
|
|
152
|
-
* 未知厂商/零足迹 → 非 null 空集——
|
|
151
|
+
/** v4.6 include=integrationFieldRegistry 集成字段注册表(root.provider 缺席且无轴参 → null;
|
|
152
|
+
* 未知厂商/零足迹 → 非 null 空集—— 轴参假想计算同此) */
|
|
153
153
|
integrationFieldRegistry?: IntegrationFieldRegistryView | null;
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -161,21 +161,21 @@ export interface ServiceDetail extends ServiceDemand {
|
|
|
161
161
|
integration: ServiceIntegrationNode | null;
|
|
162
162
|
/** 供给该服务的厂商名单(catalog 静态切片——picker 数据源) */
|
|
163
163
|
suppliedBy: string[];
|
|
164
|
-
/** v4.7
|
|
164
|
+
/** v4.7 include=integrationSchemas 生效绑定富化(三态:null 全链未绑定 /
|
|
165
165
|
* 绑定无可计算 schema / 含 schema;malformed 节点 → null——不放行域级联) */
|
|
166
166
|
integrationSchemas?: ServiceIntegrationSchemas | null;
|
|
167
167
|
/** G 批:include=integrationFieldRegistry 服务轴注册表(loadServiceFieldRegistry——
|
|
168
|
-
* 四分支链推导复用
|
|
169
|
-
* v5.1
|
|
168
|
+
* 四分支链推导复用 fields = 该 schema 全部字段带 global 旗标;null 语义镜像 。
|
|
169
|
+
* v5.1 serviceProvider 轴参 = 假想重定向——仅表单投影按 X 计算,带非空轴参时
|
|
170
170
|
* registry 恒非 null(豁免链③不镜像实际态 null);同构 ≡ PUT 改写 provider 后实读) */
|
|
171
171
|
integrationFieldRegistry?: IntegrationFieldRegistryView | null;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
/** 服务级生效绑定 schema(v4.7
|
|
174
|
+
/** 服务级生效绑定 schema(v4.7 静态轴富化——零 contracts,永不 503;实例层无条件排除:
|
|
175
175
|
* node 级口径 ≠ resolution 默认实例口径,api.md §4.4 注) */
|
|
176
176
|
export interface ServiceIntegrationSchemas {
|
|
177
177
|
/** 生效厂商:显式(含内联声明名)?? modules[ownerOf].provider ?? root.provider;
|
|
178
|
-
* v5.1
|
|
178
|
+
* v5.1 serviceProvider 轴参在场时 = 假想短路值(非链解析产物) */
|
|
179
179
|
provider: string;
|
|
180
180
|
/** catalog 复合键(多 impl 声明序首个)> 内联 ref;miss(未知厂商/未供给/内联缺 ref)→ null(富化非门控) */
|
|
181
181
|
configSchema: object | null;
|
|
@@ -185,7 +185,7 @@ export interface ServiceIntegrationSchemas {
|
|
|
185
185
|
|
|
186
186
|
/** GET /service-resolutions(批量求值 · 唯一求值集合面) */
|
|
187
187
|
export interface ServiceResolutionsView {
|
|
188
|
-
/**
|
|
188
|
+
/** contracts echo(仅求值轴两端点携带) */
|
|
189
189
|
contracts: ContractsResolution;
|
|
190
190
|
/** 键集 = 服务词汇 ∪ 已配置 ∪ 归属(v6.1 += 归属——owned 服务恒可求值;模块/平台/孤儿全量) */
|
|
191
191
|
resolutions: Record<string, ServiceResolutionEntry>;
|
|
@@ -193,7 +193,7 @@ export interface ServiceResolutionsView {
|
|
|
193
193
|
issues: IntegrationIssue[];
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
/** 求值摘要单元(行内嵌;
|
|
196
|
+
/** 求值摘要单元(行内嵌; 单一形状) */
|
|
197
197
|
export interface ServiceResolutionEntry {
|
|
198
198
|
/** 默认实例口径(normalizeInstances 委托) */
|
|
199
199
|
status: ServiceStatus;
|
|
@@ -212,9 +212,9 @@ export interface ServiceResolutionEntry {
|
|
|
212
212
|
required?: boolean;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
/** 求值完整结构(extends = 列表项 ⊂
|
|
215
|
+
/** 求值完整结构(extends = 列表项 ⊂ 单体的编译期保证——) */
|
|
216
216
|
export interface ServiceResolution extends ServiceResolutionEntry {
|
|
217
|
-
/**
|
|
217
|
+
/** 枚举规则(全实例逐一;默认实例求值 = 摘要基,不重复头部) */
|
|
218
218
|
instances: ResolvedInstance[];
|
|
219
219
|
inheritance: Array<{ layer: BindingLayer; provider?: string; implementation?: string }>;
|
|
220
220
|
}
|
|
@@ -244,7 +244,7 @@ export interface AppIntegrationNode {
|
|
|
244
244
|
|
|
245
245
|
/** AppIntegrationNode 键集单源(runtime const——write applyApp 全量替换白名单
|
|
246
246
|
* (缺席根键删除;services/modules 域不在其中;v6 domains 键退役)+ views/app 投影
|
|
247
|
-
* (GET 预填 ≡ PUT body
|
|
247
|
+
* (GET 预填 ≡ PUT body,/L1——文件含 services/modules 但 root 节点投影只含本键集)) */
|
|
248
248
|
export const APP_INTEGRATION_NODE_KEYS = [
|
|
249
249
|
'provider',
|
|
250
250
|
'config',
|
|
@@ -288,7 +288,7 @@ export type ModuleResourcesEcho = Record<string, ModuleResourceEcho>;
|
|
|
288
288
|
|
|
289
289
|
/** services[s] 整节点 */
|
|
290
290
|
export interface ServiceIntegrationNode {
|
|
291
|
-
/** 对象 = 自定义 API
|
|
291
|
+
/** 对象 = 自定义 API(仅槽级) */
|
|
292
292
|
provider?: string | InlineVendorDeclaration;
|
|
293
293
|
/** 内联 provider 时必填 */
|
|
294
294
|
implementation?: string;
|
|
@@ -332,7 +332,7 @@ export interface ResolvedInstance {
|
|
|
332
332
|
statusMessage?: string;
|
|
333
333
|
/** 该实例合并结果 */
|
|
334
334
|
effective?: EffectiveBinding;
|
|
335
|
-
// v4.4
|
|
335
|
+
// v4.4 credential(掩码回显)删净——凭据状态归 GET /credentials(求值路径零凭据文件 I/O)
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
// ===== 供给轴(静态)=====
|
|
@@ -370,7 +370,7 @@ export interface ProviderDetail {
|
|
|
370
370
|
/** 服务展示名(resolveServiceDisplay——词汇 > demand > id;恒发) */
|
|
371
371
|
name?: string;
|
|
372
372
|
description?: string;
|
|
373
|
-
/** v4.4
|
|
373
|
+
/** v4.4 include=integrationSchemas 切换态批量(纯 config——凭据结构归 /credential-types) */
|
|
374
374
|
integrationSchemas?: { configSchema: object | null };
|
|
375
375
|
}
|
|
376
376
|
>;
|
|
@@ -382,14 +382,14 @@ export interface ProviderServiceDetail {
|
|
|
382
382
|
service: string;
|
|
383
383
|
/** ★ 恒数组(通常 1);credentialType 保留(/credential-types 寻址键) */
|
|
384
384
|
implementations: Array<{ implementation: string; credentialType: string }>;
|
|
385
|
-
/** 厂商集成该服务的表单 schema(integration 域专属)——v4.4
|
|
385
|
+
/** 厂商集成该服务的表单 schema(integration 域专属)——v4.4 纯 config(credentialSchema 删净) */
|
|
386
386
|
integrationSchemas: {
|
|
387
387
|
/** raw draft 2020-12 原文零转换;供给在场未声明 = null(mock 合法);解析自默认 impl */
|
|
388
388
|
configSchema: object | null;
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
// ===== 凭据域(v4.4
|
|
392
|
+
// ===== 凭据域(v4.4 独立端点)=====
|
|
393
393
|
|
|
394
394
|
/** GET /credentials:绑定位全量掩码回显(应用状态轴;GET 永无真值) */
|
|
395
395
|
export interface CredentialsView {
|
|
@@ -470,7 +470,7 @@ export interface SaveResult {
|
|
|
470
470
|
written: boolean;
|
|
471
471
|
/** 恒 false 当 dryRun / no-diff / 应用未运行(onApplied 协作点回填) */
|
|
472
472
|
restartScheduled: boolean;
|
|
473
|
-
/** 触碰清单;dryRun =
|
|
473
|
+
/** 触碰清单;dryRun = 将触碰预览(——与同 body 真实写逐字对称,含凭据工件路径;
|
|
474
474
|
* no-diff 早退 = 预览零触碰) */
|
|
475
475
|
files: string[];
|
|
476
476
|
/** 凭据工件(0..n;dryRun = 将创建的工件——确定性 stem 派生预览) */
|
package/src/factory.ts
CHANGED
|
@@ -50,8 +50,8 @@ import type {
|
|
|
50
50
|
/**
|
|
51
51
|
* createAppToolkit(C4 工厂;v4.4——24 方法 = 11 读(含 credentials/credential-types 双端点)
|
|
52
52
|
* + 4 写 + 9 迁移面;loadApp/loadModule/loadProvider 增 include 选项;v4.6——loadApp/loadModule
|
|
53
|
-
* += 轴向假想绑定选项(appProvider/moduleProvider
|
|
54
|
-
* v4.7——loadService 增 include 选项(服务级生效绑定 schema 单体);v5.1
|
|
53
|
+
* += 轴向假想绑定选项(appProvider/moduleProvider);表单双投影经 formViews 单点装配;
|
|
54
|
+
* v4.7——loadService 增 include 选项(服务级生效绑定 schema 单体);v5.1——loadService
|
|
55
55
|
* += serviceProvider 轴参(服务轴向假想绑定,三轴收口))。
|
|
56
56
|
* AppToolkit = AppToolkitRead & AppToolkitWrite & AppToolkitInternals——
|
|
57
57
|
* Read+Write = HTTP 直通面 additive 冻结(L1 端点↔方法 1:1,L3 命名镜像:Integration=节点级 /
|
|
@@ -61,12 +61,12 @@ import type {
|
|
|
61
61
|
* ensureMockBindings / writeIntegrationsConfig / evaluateIntegrationServices 入口
|
|
62
62
|
* assertContractsUsable——strictValidation === false → 503 CONTRACTS_NOT_RESOLVED;静态方法不门控
|
|
63
63
|
* (永不 503——铁律 #3);**读求值轴(loadServiceResolutions/loadServiceResolution 及 include 装配)
|
|
64
|
-
* v7 起不再 503**——contracts 不可用 → 200 降级骨架(evaluation-unavailable,doctor 分级/
|
|
64
|
+
* v7 起不再 503**——contracts 不可用 → 200 降级骨架(evaluation-unavailable,doctor 分级/ 先例
|
|
65
65
|
* 对齐;依据链与裁决见 Agent Note evaluation-axis-degrade);**include 装配为条件分支非门控**
|
|
66
|
-
* (
|
|
66
|
+
* (null 分支退役——三条件门 + 内嵌轴同步降级,四面统一骨架);integrations/ views/ 机制层保持纯函数。
|
|
67
67
|
*
|
|
68
|
-
* 并发:进程内写串行(per-factory promise chain)+ 原子写 +
|
|
69
|
-
* onApplied
|
|
68
|
+
* 并发:进程内写串行(per-factory promise chain)+ 原子写 + 写后本实例缓存即刻失效。
|
|
69
|
+
* onApplied:toolkit 判定「需要重启」(实际落盘且非 dryRun/no-diff)→ 调用一次 +
|
|
70
70
|
* restartScheduled 回填——通知闭包非控制,执行者恒为宿主 RunManager;CLI 不传恒 false。
|
|
71
71
|
*/
|
|
72
72
|
|
|
@@ -75,9 +75,9 @@ export interface AppToolkitOptions {
|
|
|
75
75
|
onApplied?: () => void;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
/** include 协议白名单(v4.4
|
|
79
|
-
* v4.6
|
|
80
|
-
* v4.7
|
|
78
|
+
/** include 协议白名单(v4.4/5——键名 = 产出字段名 1:1;per 端点;注册表 additive-only;
|
|
79
|
+
* v4.6 += integrationFieldRegistry:app/module 三键,provider 轴不加——YAGNI;
|
|
80
|
+
* v4.7 += service 键——服务级生效绑定 schema;
|
|
81
81
|
* G 批 += service 轴 integrationFieldRegistry——服务轴注册表(x-tbox-global 旗标全量透传)) */
|
|
82
82
|
const INCLUDE_WHITELIST = {
|
|
83
83
|
app: ['serviceResolutions', 'integrationSchemas', 'integrationFieldRegistry'],
|
|
@@ -86,7 +86,7 @@ const INCLUDE_WHITELIST = {
|
|
|
86
86
|
service: ['integrationSchemas', 'integrationFieldRegistry'],
|
|
87
87
|
} as const;
|
|
88
88
|
|
|
89
|
-
/** include
|
|
89
|
+
/** include 校验(单点在 toolkit 方法内——壳层仅解析可重复参数,零校验纪律不变):
|
|
90
90
|
* 未知/越权键 → 400 VALIDATION_FAILED fields ['include'];重复键静默去重。 */
|
|
91
91
|
function validateInclude(kind: keyof typeof INCLUDE_WHITELIST, include?: string[]): Set<string> {
|
|
92
92
|
if (!include || include.length === 0) return new Set();
|
|
@@ -103,12 +103,12 @@ function validateInclude(kind: keyof typeof INCLUDE_WHITELIST, include?: string[
|
|
|
103
103
|
return new Set(include);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
/** 表单层 include
|
|
106
|
+
/** 表单层 include 键(轴参严检依据——serviceResolutions 不算) */
|
|
107
107
|
const FORM_INCLUDE_KEYS = ['integrationSchemas', 'integrationFieldRegistry'] as const;
|
|
108
108
|
|
|
109
|
-
/** v4.6
|
|
109
|
+
/** v4.6 轴参严检(400 先于 404——镜像输入校验先行):非空轴参需与表单 include 键同现;
|
|
110
110
|
* 缺席/空串 ≡ 按实际配置解析(I3——不触发严检);错轴参数由壳层按名读取,天然静默忽略。
|
|
111
|
-
* v5.1
|
|
111
|
+
* v5.1 联合类型 += serviceProvider(service 轴同律)。 */
|
|
112
112
|
function assertAxisProviderUsable(
|
|
113
113
|
paramName: 'appProvider' | 'moduleProvider' | 'serviceProvider',
|
|
114
114
|
value: string | undefined,
|
|
@@ -131,12 +131,12 @@ function assertAxisProviderUsable(
|
|
|
131
131
|
export interface AppToolkitRead {
|
|
132
132
|
/** GET /modules:hidden 模块默认过滤(includeHidden = true 可见——对齐 ?dryRun 布尔参数先例) */
|
|
133
133
|
loadModules(o?: { includeHidden?: boolean }): Promise<ModulesView>;
|
|
134
|
-
/** v4.6
|
|
134
|
+
/** v4.6 moduleProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include 键同现)。
|
|
135
135
|
* moduleId = 双键(id 优先、唯一展示名兜底)。 */
|
|
136
136
|
loadModule(moduleId: string, o?: { include?: string[]; moduleProvider?: string }): Promise<ModuleDetailView>;
|
|
137
|
-
/** v4.6
|
|
137
|
+
/** v4.6 appProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include 键同现) */
|
|
138
138
|
loadApp(o?: { include?: string[]; appProvider?: string }): Promise<AppView>;
|
|
139
|
-
/** v5.1
|
|
139
|
+
/** v5.1 serviceProvider = 服务轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include
|
|
140
140
|
* 键同现)——假想重定向仅表单双投影,integration/suppliedBy/defaults 恒实际态(I2) */
|
|
141
141
|
loadService(service: string, o?: { include?: string[]; serviceProvider?: string }): Promise<ServiceDetail>;
|
|
142
142
|
loadServiceResolutions(services?: string[]): Promise<ServiceResolutionsView>;
|
|
@@ -144,9 +144,9 @@ export interface AppToolkitRead {
|
|
|
144
144
|
loadProviders(): Promise<ProvidersView>;
|
|
145
145
|
loadProvider(provider: string, o?: { include?: string[] }): Promise<ProviderDetail>;
|
|
146
146
|
loadProviderService(provider: string, service: string): Promise<ProviderServiceDetail>;
|
|
147
|
-
/** GET /credentials(v4.4
|
|
147
|
+
/** GET /credentials(v4.4——应用状态轴;零门控,永不 503) */
|
|
148
148
|
loadCredentials(): Promise<CredentialsView>;
|
|
149
|
-
/** GET /credential-types[?provider=](v4.4
|
|
149
|
+
/** GET /credential-types[?provider=](v4.4——供给轴静态;零门控,永不 503) */
|
|
150
150
|
loadCredentialTypes(provider?: string): Promise<CredentialTypesView>;
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -194,7 +194,7 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
194
194
|
const viewCtx = { appDir, cache };
|
|
195
195
|
|
|
196
196
|
/** 门控断言(policy at edge)——strictValidation false → 503(message 三分支 N1);
|
|
197
|
-
* v6
|
|
197
|
+
* v6 标记门:ownershipBindingV6 false → 503 第四分支(v5 contracts + v6 toolkit 偏斜
|
|
198
198
|
* ——防静默忽略 ownerOf;门控范围 = 求值 + 写 + migrate 全体,本函数为唯一调用点)。 */
|
|
199
199
|
function assertContractsUsable(contracts: ResolvedContracts): void {
|
|
200
200
|
if (!contracts.strictValidation) {
|
|
@@ -256,19 +256,19 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
256
256
|
const contracts = await resolveContractsForApp(appDir);
|
|
257
257
|
return loadModulesView(snapshot(contracts), o);
|
|
258
258
|
},
|
|
259
|
-
// v4.4
|
|
259
|
+
// v4.4 门控与内嵌分离——静态方法零门控分支;include=serviceResolutions 按
|
|
260
260
|
// evaluation && strictValidation 双条件装配(<0.9/形态异常 → null,永不 503——技术方案 §2.4:
|
|
261
261
|
// 仅判 strictValidation 会被「严格面在场+求值面缺席」畸形包击穿)
|
|
262
262
|
async loadModule(moduleId: string, o?: { include?: string[]; moduleProvider?: string }): Promise<ModuleDetailView> {
|
|
263
263
|
const include = validateInclude('module', o?.include); // ① 输入校验先行(400 先于 404)
|
|
264
|
-
assertAxisProviderUsable('moduleProvider', o?.moduleProvider, include); // ①'
|
|
264
|
+
assertAxisProviderUsable('moduleProvider', o?.moduleProvider, include); // ①' 轴参严检(先于 404)
|
|
265
265
|
const contracts = await resolveContractsForApp(appDir);
|
|
266
266
|
const snap = snapshot(contracts);
|
|
267
267
|
// ② 双键寻址(v7 词汇统一):路径参数 id 优先、唯一展示名兜底 → 真实 id(404 面)
|
|
268
268
|
const mod = resolveModuleKey(snap.walk, moduleId);
|
|
269
269
|
const view = loadModuleDetailView(snap, mod.id);
|
|
270
270
|
if (include.has('serviceResolutions')) {
|
|
271
|
-
// v7:三条件门 + 内嵌轴同步降级(
|
|
271
|
+
// v7:三条件门 + 内嵌轴同步降级((b) 四面统一骨架—— null 分支退役:
|
|
272
272
|
// include 请求了即恒返回视图;老消费方 null 分支保留为兼容死码)
|
|
273
273
|
// 过滤键 = owned ∪ demand(v6.1——v4.4 demand-only 遗留;owned 服务是模块页
|
|
274
274
|
// 集成面一半,mall-core 形态 owns>0/consumes=0 时 demand-only 内嵌恒空)
|
|
@@ -278,7 +278,7 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
278
278
|
: loadServiceResolutionsDegradeView(snap, contracts, resolutionFilter); // owned ∪ demand 服务过滤(≡ 批量 ?service= 语义)
|
|
279
279
|
}
|
|
280
280
|
if (include.has('integrationSchemas') || include.has('integrationFieldRegistry')) {
|
|
281
|
-
// v4.6
|
|
281
|
+
// v4.6 表单层双投影同源一次计算(双取单算 + I1——假想重定向天然同步)
|
|
282
282
|
const form = loadModuleFormViews(snap, mod.id, o?.moduleProvider);
|
|
283
283
|
if (include.has('integrationSchemas')) view.integrationSchemas = form.integrationSchemas;
|
|
284
284
|
if (include.has('integrationFieldRegistry')) view.integrationFieldRegistry = form.integrationFieldRegistry;
|
|
@@ -287,12 +287,12 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
287
287
|
},
|
|
288
288
|
async loadApp(o?: { include?: string[]; appProvider?: string }): Promise<AppView> {
|
|
289
289
|
const include = validateInclude('app', o?.include);
|
|
290
|
-
assertAxisProviderUsable('appProvider', o?.appProvider, include); //
|
|
290
|
+
assertAxisProviderUsable('appProvider', o?.appProvider, include); // 轴参严检(先于任何计算)
|
|
291
291
|
const contracts = await resolveContractsForApp(appDir);
|
|
292
292
|
const snap = snapshot(contracts);
|
|
293
293
|
const view = loadAppView(snap);
|
|
294
294
|
if (include.has('serviceResolutions')) {
|
|
295
|
-
// v7:内嵌轴同步降级(同 loadModule——
|
|
295
|
+
// v7:内嵌轴同步降级(同 loadModule—— null 退役,app = 全量键集)
|
|
296
296
|
view.serviceResolutions = contractsEvaluable(contracts)
|
|
297
297
|
? await predicateIssues().then((issues) => loadServiceResolutionsView(snap, issues)) // app = 全量键集
|
|
298
298
|
: loadServiceResolutionsDegradeView(snap, contracts);
|
|
@@ -304,13 +304,13 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
304
304
|
}
|
|
305
305
|
return view;
|
|
306
306
|
},
|
|
307
|
-
// v4.7
|
|
308
|
-
// G 批:service 轴 += integrationFieldRegistry(loadServiceFieldRegistry——
|
|
309
|
-
// v5.1
|
|
307
|
+
// v4.7 include 镜像 loadModule 三段式——① 输入校验 400 先于 404 ② 视图 ③ 静态富化(永不 503)
|
|
308
|
+
// G 批:service 轴 += integrationFieldRegistry(loadServiceFieldRegistry—— 四分支链复用)
|
|
309
|
+
// v5.1 loadService += serviceProvider 轴参(三段式序对齐 loadModule——①' 严检先于 resolveContracts,
|
|
310
310
|
// 即先于 404 也先于 503;I1 双投影同源一次计算经单源链透传)
|
|
311
311
|
async loadService(service: string, o?: { include?: string[]; serviceProvider?: string }): Promise<ServiceDetail> {
|
|
312
312
|
const include = validateInclude('service', o?.include);
|
|
313
|
-
assertAxisProviderUsable('serviceProvider', o?.serviceProvider, include); // ①'
|
|
313
|
+
assertAxisProviderUsable('serviceProvider', o?.serviceProvider, include); // ①' 轴参严检(先于 404)
|
|
314
314
|
const contracts = await resolveContractsForApp(appDir);
|
|
315
315
|
const snap = snapshot(contracts); // 单快照——detail 与 include 装配共享
|
|
316
316
|
// 双键寻址(v7):id 优先、唯一展示名兜底 → 真实 service id(404 面)
|
|
@@ -358,7 +358,7 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
358
358
|
const serviceId = resolveServiceKey(snap.walk, configuredServiceKeys(snap), service);
|
|
359
359
|
return loadProviderServiceDetailView(snap, provider, serviceId);
|
|
360
360
|
},
|
|
361
|
-
// v4.4
|
|
361
|
+
// v4.4 凭据域双端点(应用状态轴 / 供给轴静态——零门控零求值,永不 503)
|
|
362
362
|
async loadCredentials(): Promise<CredentialsView> {
|
|
363
363
|
const contracts = await resolveContractsForApp(appDir);
|
|
364
364
|
return loadCredentialsView(snapshot(contracts));
|
|
@@ -460,7 +460,7 @@ export function createAppToolkit(appDir: string, options: AppToolkitOptions = {}
|
|
|
460
460
|
};
|
|
461
461
|
|
|
462
462
|
function loadProviderCatalogRawWalk(dir: string): WalkManifestsResult {
|
|
463
|
-
// walkManifests 直通(Internals 面——枚举零缓存契约载体;文件内容经本实例 cache,FX-3
|
|
463
|
+
// walkManifests 直通(Internals 面——枚举零缓存契约载体;文件内容经本实例 cache,FX-3/)
|
|
464
464
|
return internalsWalk(dir, cache);
|
|
465
465
|
}
|
|
466
466
|
|
package/src/index.ts
CHANGED
|
@@ -55,7 +55,7 @@ export type {
|
|
|
55
55
|
PredicateContracts,
|
|
56
56
|
SupplyLookup,
|
|
57
57
|
} from './integrations/predicate.js';
|
|
58
|
-
// ── 谓词装配单源(FX-2b/
|
|
58
|
+
// ── 谓词装配单源(FX-2b/CLI doctor 规则与 toolkit 工厂同装配面——双通道 walkManifests)──
|
|
59
59
|
export { buildPredicateAssembly, refToEnvKey } from './integrations/predicate-io.js';
|
|
60
60
|
export type { PredicateAssembly, PredicateIoInputs } from './integrations/predicate-io.js';
|
|
61
61
|
// ── 应用级求值单源(cli-remove-prune-and-new:doctor integration-services 与 prune 同一求值)──
|
|
@@ -3,12 +3,12 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { deriveStem, readCredentialFile, stemToFilePath, writeCredentialFile } from '../core/credential-format.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* 凭据双工件·写端(
|
|
6
|
+
* 凭据双工件·写端(credentials;FX-1c 拆分—— 定序):
|
|
7
7
|
* credentials / credentialsByInstance(body 唯一非文件字段)→ **纯派生 plan(零 I/O)**
|
|
8
8
|
* → 消费方(write.ts)ref 回填节点(先于 no-diff 判定)→ 严格校验通过后 `writeCredentialArtifacts`
|
|
9
9
|
* 落盘(dryRun → 零写盘 + existsSync 预览)。同 stem 已在场 → 重写 + overwrote:true。
|
|
10
10
|
* 孤儿凭据 = **写后对账**(扫描文件全量 credentialRef 引用 vs 凭据目录全集 →
|
|
11
|
-
* ORPHANED_CREDENTIAL warning——统一覆盖 DELETE 与 PUT
|
|
11
|
+
* ORPHANED_CREDENTIAL warning——统一覆盖 DELETE 与 PUT 替换两类来源,只报告不自动清理)。
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export interface CredentialInput {
|
|
@@ -77,7 +77,7 @@ export function planServiceCredentialArtifacts(
|
|
|
77
77
|
return plan;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
/**
|
|
80
|
+
/** 凭据工件落盘(第 8 步——消费方保证已于严格校验通过后调用);
|
|
81
81
|
* dryRun → 零写盘,overwrote = existsSync 预览(「将创建工件」语义)。 */
|
|
82
82
|
export function writeCredentialArtifacts(
|
|
83
83
|
appDir: string,
|
|
@@ -113,7 +113,7 @@ function collectRefs(value: unknown, out: Set<string>): void {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
/**
|
|
116
|
+
/** 孤儿凭据写后对账:凭据目录全集 − integrations.json 全量引用 = 孤儿(只报告不清理) */
|
|
117
117
|
export function reconcileOrphanCredentials(appDir: string): OrphanIssue[] {
|
|
118
118
|
const credentialsDir = join(appDir, 'config', 'credentials');
|
|
119
119
|
const referenced = new Set<string>();
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
} from './predicate.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* 应用级 integrations 求值(cli-remove-prune-and-new
|
|
14
|
-
* "装配+求值"序列的单源抽取(FX-2b/
|
|
13
|
+
* 应用级 integrations 求值(cli-remove-prune-and-new.4):doctor integration-services 规则内
|
|
14
|
+
* "装配+求值"序列的单源抽取(FX-2b/ 轨迹延续——此前 buildPredicateAssembly 已单源,本函数
|
|
15
15
|
* 将 walk→supplies→assembly→evaluate 全序列收口)。
|
|
16
16
|
*
|
|
17
17
|
* 消费方:
|
|
@@ -4,7 +4,7 @@ import { walkManifests } from '../assembly/walk-manifests.js';
|
|
|
4
4
|
import { writeAtomic } from '../core/fskit.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* mock 槽绑定生成器(自 CLI mock-bindings.ts 迁入;provider 拆包
|
|
7
|
+
* mock 槽绑定生成器(自 CLI mock-bindings.ts 迁入;provider 拆包 收敛 · B 方案;integrations v4 零拓扑形态):
|
|
8
8
|
* 应用内 config/integrations.json 缺席时,从已装模块 manifest 的 local:true 槽派生全槽 mock 绑定。
|
|
9
9
|
*
|
|
10
10
|
* 语义边界(零改动迁移):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { walkManifests, type WalkCatalog, type WalkManifestsResult, type WalkModuleInfo } from '../assembly/walk-manifests.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* 模块级联绑定单源(integrations v6 所有权模型——原 domain-binding.ts v4.4
|
|
4
|
+
* 模块级联绑定单源(integrations v6 所有权模型——原 domain-binding.ts v4.4/ 重写)。
|
|
5
5
|
* integrations 层落位依据:谓词(同层)/ 写核(同层)/ views(下层可向上 import)三向消费
|
|
6
6
|
* 的唯一公共下层;import 前缀 guard 覆盖。
|
|
7
7
|
*
|
|
@@ -13,7 +13,7 @@ import { walkManifests, type WalkCatalog, type WalkManifestsResult, type WalkMod
|
|
|
13
13
|
* registry 显式参 / 谓词 / 写守卫 / views 四消费方零第二实现)
|
|
14
14
|
* 来源层四层推导 = deriveBindingLayer(views/service-resolutions,模块级段改调本文件)
|
|
15
15
|
* 写通道可用性 = moduleOwnershipWritable —— configEditable 读标志 / applyModule 400 守卫
|
|
16
|
-
* 共用(owns>0 唯一判据——多域归属合法化、共享键/多域判据随
|
|
16
|
+
* 共用(owns>0 唯一判据——多域归属合法化、共享键/多域判据随 退役)
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
/** 归属表构建(walk 单源直通——sdk 桥 re-export 消费;appDir 直入对齐 loadProviderCatalog
|
|
@@ -40,7 +40,7 @@ export function resolveModuleBinding(
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/** 模块集成位可写性(v6 判别联合——configEditable 读标志与 applyModule 写守卫共用单源):
|
|
43
|
-
* owns>0
|
|
43
|
+
* owns>0 唯一判据(多域/shared-key 判据随 v6 退役——服务归属唯一真源 = declare.owns)。 */
|
|
44
44
|
export type ModuleOwnershipWritability =
|
|
45
45
|
| { writable: true; ownedServices: string[] }
|
|
46
46
|
| { writable: false; reason: 'zero-ownership'; ownedServices: [] };
|
|
@@ -54,7 +54,7 @@ export function moduleOwnershipWritable(
|
|
|
54
54
|
return { writable: true, ownedServices };
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
/** 供给足迹(该厂商全部供给服务并集——应用级 integrationSchemas
|
|
57
|
+
/** 供给足迹(该厂商全部供给服务并集——应用级 integrationSchemas 作用域) */
|
|
58
58
|
export function providerFootprint(catalog: WalkCatalog, provider: string): string[] {
|
|
59
59
|
return [...new Set(Object.values(catalog.providers[provider] ?? {}).flatMap((e) => e.services))].sort();
|
|
60
60
|
}
|
|
@@ -3,7 +3,7 @@ import { join } from 'node:path';
|
|
|
3
3
|
import type { WalkManifestsResult } from '../assembly/walk-manifests.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* 谓词装配单源(FX-2b
|
|
6
|
+
* 谓词装配单源(FX-2b/):CLI doctor 规则 与 toolkit 工厂(求值轴 / SaveResult.issues)
|
|
7
7
|
* 共用同一 I/O 装配与供给/需求聚合——「面板 issues ≡ doctor issues」的机制保证。
|
|
8
8
|
*
|
|
9
9
|
* 迁移源:cli/src/doctor/schema-reader.ts(collectVendorSchemaProfiles,105 行)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* integration-services 谓词单源(integrations v4;自 CLI doctor/integration-services.ts 迁入——
|
|
3
3
|
* doctor 第 19 条与 toolkit 工厂 evaluateIntegrationServices 共用此函数,单源不变)。
|
|
4
|
-
* 纯函数、零副作用、零 I/O——contracts 经 input.contracts 注入(resolver
|
|
4
|
+
* 纯函数、零副作用、零 I/O——contracts 经 input.contracts 注入(resolver 装配,版本解耦)。
|
|
5
5
|
*
|
|
6
6
|
* 结构化输出(H7 v4.3):IntegrationIssue { severity, code, message, service?, module?, instance? }——
|
|
7
|
-
* 检查逻辑零改动(~24 处 push 机械加 code/定位字段;level→severity 字段同名随
|
|
7
|
+
* 检查逻辑零改动(~24 处 push 机械加 code/定位字段;level→severity 字段同名随 班车,
|
|
8
8
|
* severity 取值恒等旧 level——doctor 门控行为等价)。
|
|
9
9
|
* **code 枚举单源 = 本文件头映射表(additive-only;api.md §5 表与本表同步)**:
|
|
10
10
|
* CREDENTIAL_FILE_MISSING #1 error effective credentialRef 引用凭据文件不在场
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
* RESOURCE_TYPE_UNKNOWN #15 error modules 资源节 type ∉ 词汇表
|
|
30
30
|
* RESOURCE_NOT_DECLARED #16 warning 资源键/资源 id ∉ 模块声明集
|
|
31
31
|
* MODULE_CONFIG_DEAD v6 error modules[m](未安装 ∨ owns=0)携带 provider/config
|
|
32
|
-
* (统一吸收原「#16 升级」特例——
|
|
32
|
+
* (统一吸收原「#16 升级」特例—— 一码一义)
|
|
33
33
|
* GLOBAL_FIELD_UNDECLARED #17 warning 全局层键过 #7 但 ∉ 引用厂商 x-tbox-global 并集(G 批;
|
|
34
|
-
* 零声明厂商整体跳过——#7
|
|
34
|
+
* 零声明厂商整体跳过——#7 同遍历双判定)
|
|
35
35
|
* ORPHANED_CREDENTIAL 写后对账 warning 凭据文件不再被引用(toolkit 写路径产出,非本谓词)
|
|
36
36
|
* (v6 退役:DOMAIN_KEY_UNMATCHED #14——domains 键随归属模型退场)
|
|
37
37
|
*
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
* zod 之外的第二道防线——doctor 读裸 JSON)
|
|
64
64
|
* MODULE_CONFIG_DEAD:modules[m] 携带 provider/config 且(m ∉ installedModuleIds ∨ ownership
|
|
65
65
|
* 无任何 service 归属 m)→ error(键级 #16 warning 与本检查可同节点共发——键级 vs 值级不同断言面)
|
|
66
|
-
* #17(G 批):与 #7
|
|
66
|
+
* #17(G 批):与 #7 同遍历双判定——键 ∈ schema properties 但 ∉ x-tbox-global 并集 →
|
|
67
67
|
* warning;引用厂商零全局声明(集空/缺席)→ 该厂商键整体跳过;检查序在 MODULE_CONFIG_DEAD 后
|
|
68
68
|
* #15-#16 modules 资源节对账(v5 延续):type ∉ RESOURCE_TYPE_IDS → error;键 ∉ 已装模块 id 集 /
|
|
69
69
|
* 资源 id ∉ 模块 manifest declare.resources 声明集 → warning
|
|
@@ -435,7 +435,7 @@ export function evaluateIntegrationServices(
|
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
// #11:root/modules 厂商存在性(继承层声明必须命中已装供给——vendor 集合 = 供给键前缀展开;
|
|
438
|
-
// 槽级内联声明不在本检查范围——
|
|
438
|
+
// 槽级内联声明不在本检查范围—— 先声明后实施闭环归 #2/#6 形状检查)
|
|
439
439
|
for (const [where, vendor] of [
|
|
440
440
|
['root', integrations.provider],
|
|
441
441
|
...Object.entries(integrations.modules ?? {}).map(([m, cfg]): [string, string | undefined] => [`modules.${m}`, cfg?.provider]),
|
|
@@ -452,7 +452,7 @@ export function evaluateIntegrationServices(
|
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
// #12:绑定可解析性(级联单源复用 contracts resolveEffectiveService——谓词零级联实现;
|
|
455
|
-
// supplies 缺席 → 整体跳过,M3 降级兼容
|
|
455
|
+
// supplies 缺席 → 整体跳过,M3 降级兼容 页面无 catalog 形态。
|
|
456
456
|
// v4:instances 键缺席槽 = 通配激活——以 '' 探测求值(继承链可解析性仍需覆盖);
|
|
457
457
|
// v6:ownership 作 ownerOf 显式参透传——modules 层绑定/配置纳入求值与 fail-visible)
|
|
458
458
|
if (supplies) {
|
|
@@ -480,7 +480,7 @@ export function evaluateIntegrationServices(
|
|
|
480
480
|
}
|
|
481
481
|
|
|
482
482
|
// MODULE_CONFIG_DEAD(v6):modules[m] 携带 provider/config 且(未安装 ∨ owns=0)→ error。
|
|
483
|
-
// 统一定义吸收原「#16
|
|
483
|
+
// 统一定义吸收原「#16 升级」特例(一码一义);与 #16 可同节点共发(键级 vs 值级不同断言面)。
|
|
484
484
|
// 依赖面双保险:installedModuleIds/ownership 缺席 → 对应分支跳过(谓词纯函数——面信息由调用方喂)。
|
|
485
485
|
for (const [moduleId, cfg] of Object.entries(integrations.modules ?? {})) {
|
|
486
486
|
const carriesBinding = cfg?.provider !== undefined || cfg?.config !== undefined;
|
|
@@ -510,7 +510,7 @@ export function evaluateIntegrationServices(
|
|
|
510
510
|
// 或被绑定但零 configSchema 声明(如 local 供给未声明 configSchema——无 schema 知识。
|
|
511
511
|
// 注:provider-mock 0.5.0 起零 configSchema(保守跳过);config 检查对 mocktest 绑定
|
|
512
512
|
// 生效(全槽 schema——2026-09-20 拆分迁入 provider-mocktest)。
|
|
513
|
-
// #17(G 批,与 #7
|
|
513
|
+
// #17(G 批,与 #7 同遍历双判定):键 ∈ schema properties 但 ∉ 该层生效厂商
|
|
514
514
|
// x-tbox-global 并集 → GLOBAL_FIELD_UNDECLARED warning;生效厂商零声明(集空/缺席)→
|
|
515
515
|
// 整体跳过(零声明厂商不告警)。检查序:#7 判定先行,过 #7 才进 #17(N5)。
|
|
516
516
|
if (vendorConfigKeys) {
|
|
@@ -11,13 +11,13 @@ import { reconcileOrphanCredentials } from './credentials.js';
|
|
|
11
11
|
import { evaluateAppIntegrationIssues } from './evaluate-app.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* integrations.json 死绑定清理(cli-remove-prune-and-new
|
|
14
|
+
* integrations.json 死绑定清理(cli-remove-prune-and-new 核心件)。
|
|
15
15
|
*
|
|
16
16
|
* 不变式:**删除判据 ≡ doctor integration-services 报错判据(构造性同源)**——消费 doctor 同一
|
|
17
17
|
* 共享求值器 evaluateAppIntegrationIssues 的结构化 issue,code 白名单
|
|
18
18
|
* {VENDOR_NOT_INSTALLED, BINDING_UNRESOLVED, MODULE_CONFIG_DEAD} + 守卫(绑定引用链候选
|
|
19
19
|
* provider ∈ installedVendors 即保留,排除活厂商错配)→ 删除域严格 = "供给载体消亡"。
|
|
20
|
-
* v6:模块卸载 → modules[m] **整节点确定性清理**(provider+config+resources——
|
|
20
|
+
* v6:模块卸载 → modules[m] **整节点确定性清理**(provider+config+resources——
|
|
21
21
|
* 模块消亡清理 vs 集成位编辑保全不矛盾;MODULE_CONFIG_DEAD 为判据源)。
|
|
22
22
|
*
|
|
23
23
|
* 由此推论(均已实证):需求侧孤儿绑定(demand 消失、供给在场)保留——doctor 判其合法;用户
|
|
@@ -25,7 +25,7 @@ import { evaluateAppIntegrationIssues } from './evaluate-app.js';
|
|
|
25
25
|
* 刻意不进白名单,原样保留。
|
|
26
26
|
*
|
|
27
27
|
* 写侧三防线(镜像 write core):归一化(空节点删键)→ parseIntegrationsConfig
|
|
28
|
-
* 严格校验(失败弃写)→ writeAtomic
|
|
28
|
+
* 严格校验(失败弃写)→ writeAtomic。凭据孤儿只报告不清理(——与 DELETE 管线现行为一致)。
|
|
29
29
|
* 全空(无任何存活绑定)→ 删文件——ensureMockBindings(缺席即生成)在重装供给时再生闭环。
|
|
30
30
|
*
|
|
31
31
|
* 最佳努力语义:谓词不可用(contracts 未安装/降级、env 缺失、求值 throw)→ skipped 返回 +
|
|
@@ -35,7 +35,7 @@ import { evaluateAppIntegrationIssues } from './evaluate-app.js';
|
|
|
35
35
|
export interface PruneResult {
|
|
36
36
|
/** 被清除的绑定节点描述(remove 日志行,如 'root.provider=mock' / 'services.member.account') */
|
|
37
37
|
removed: string[];
|
|
38
|
-
/**
|
|
38
|
+
/** 孤儿凭据(只报告不清理——reconcileOrphanCredentials 产物 message) */
|
|
39
39
|
orphanCredentials: string[];
|
|
40
40
|
/** 跳过原因(正常路径 undefined;not-configured = integrations.json 缺席,兼容态零动作) */
|
|
41
41
|
skipped?: 'predicate-unavailable' | 'validation-failed' | 'not-configured';
|
|
@@ -127,7 +127,7 @@ export async function pruneIntegrationBindings(appDir: string): Promise<PruneRes
|
|
|
127
127
|
delete next.provider;
|
|
128
128
|
}
|
|
129
129
|
} else if (issue.code === 'MODULE_CONFIG_DEAD' && issue.module) {
|
|
130
|
-
// v6
|
|
130
|
+
// v6 模块卸载 → modules[m] 整节点确定性清理(provider+config+resources)
|
|
131
131
|
const modulesNode = (next.modules ?? {}) as Record<string, Record<string, unknown>>;
|
|
132
132
|
if (modulesNode[issue.module]) {
|
|
133
133
|
const node = modulesNode[issue.module];
|
|
@@ -192,7 +192,7 @@ export async function pruneIntegrationBindings(appDir: string): Promise<PruneRes
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
// ⑤⑥ 写 +
|
|
195
|
+
// ⑤⑥ 写 + 孤儿报告;空 → 删文件(ensureMockBindings 重装再生闭环)
|
|
196
196
|
let orphanCredentials: string[] = [];
|
|
197
197
|
if (empty) {
|
|
198
198
|
if (existsSync(file)) rmSync(file, { force: true });
|