@tbox.cn/app-toolkit 0.2.0 → 0.4.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/index.d.ts +181 -33
- package/dist/index.js +8 -7
- package/package.json +2 -2
- package/src/assembly/app-manifest.ts +6 -0
- package/src/assembly/walk-manifests.ts +95 -28
- package/src/core/env-expansion.ts +14 -12
- package/src/core/module-schema.ts +3 -0
- package/src/dto.ts +59 -4
- package/src/factory.ts +58 -16
- package/src/index.ts +8 -2
- package/src/integrations/credentials.ts +1 -1
- package/src/integrations/evaluate-app.ts +41 -0
- package/src/integrations/predicate.ts +2 -1
- package/src/integrations/prune-bindings.ts +186 -0
- package/src/integrations/write.ts +15 -11
- package/src/views/app.ts +6 -2
- package/src/views/context.ts +20 -0
- package/src/views/integration-schemas.ts +197 -24
- package/src/views/modules.ts +42 -13
- package/src/views/providers.ts +39 -21
- package/src/views/service-detail.ts +5 -3
- package/tests/demo-app.ts +27 -3
- package/tests/dev-manifest-catalog.test.ts +81 -1
- package/tests/file-cache.test.ts +3 -1
- package/tests/module-schema.test.ts +15 -0
- package/tests/vendor-schema-keywords.test.ts +12 -0
- package/tests/views.test.ts +1098 -74
- package/tests/write-core.test.ts +26 -4
package/dist/index.d.ts
CHANGED
|
@@ -139,6 +139,8 @@ declare const resourceNeedContribSchema: z.ZodObject<{
|
|
|
139
139
|
declare const moduleDescriptorSchema: z.ZodObject<{
|
|
140
140
|
schemaVersion: z.ZodDefault<z.ZodNumber>;
|
|
141
141
|
name: z.ZodString;
|
|
142
|
+
title: z.ZodOptional<z.ZodString>;
|
|
143
|
+
description: z.ZodOptional<z.ZodString>;
|
|
142
144
|
version: z.ZodDefault<z.ZodString>;
|
|
143
145
|
kind: z.ZodDefault<z.ZodEnum<["platform", "business", "third-party"]>>;
|
|
144
146
|
risk: z.ZodDefault<z.ZodObject<{
|
|
@@ -468,9 +470,13 @@ declare const moduleDescriptorSchema: z.ZodObject<{
|
|
|
468
470
|
}[];
|
|
469
471
|
};
|
|
470
472
|
env: string[];
|
|
473
|
+
title?: string | undefined;
|
|
474
|
+
description?: string | undefined;
|
|
471
475
|
}, {
|
|
472
476
|
name: string;
|
|
473
477
|
schemaVersion?: number | undefined;
|
|
478
|
+
title?: string | undefined;
|
|
479
|
+
description?: string | undefined;
|
|
474
480
|
version?: string | undefined;
|
|
475
481
|
kind?: "platform" | "business" | "third-party" | undefined;
|
|
476
482
|
risk?: {
|
|
@@ -550,14 +556,16 @@ declare function parseModuleDescriptor(raw: unknown): ParseModuleResult;
|
|
|
550
556
|
/**
|
|
551
557
|
* 配置 JSON 环境变量占位展开(纯数据形态——自 app-sdk env-expansion.ts 迁入改造)。
|
|
552
558
|
*
|
|
553
|
-
*
|
|
554
|
-
* ${NAME}
|
|
555
|
-
*
|
|
559
|
+
* 语法(语义真源 = 本文件 + 共享向量 test-fixtures/env-expansion-cases.json 防漂移):
|
|
560
|
+
* ${NAME} 占位引用;NAME 限定 [A-Z][A-Z0-9_]*(UPPER_SNAKE,最小化与正文 `${...}` 误碰)
|
|
561
|
+
* ${NAME:def} POSIX 风格缺省值:NAME 未设置时用 def(字面量,不二次展开);设置时空串也算「已设置」
|
|
562
|
+
* $${NAME} 转义为字面量 ${NAME}(原样保留一次 $)
|
|
556
563
|
*
|
|
557
564
|
* 语义(评审 N1 钉死,壳层各自包装 throw/report):
|
|
558
565
|
* - 单遍非递归:env 值内若含 `${OTHER}` 不被二次展开(注入防线);String.replace 回调形态天然单遍。
|
|
566
|
+
* 默认值内含 `${...}` 同样不展开(POSIX 同限);默认值含 `}` 不支持(同 POSIX 同限——正则 [^}] 截断)。
|
|
559
567
|
* - 值经 JSON 字符串转义注入;不做数值/布尔强制转换。
|
|
560
|
-
* - **本版为纯数据返回形态** `{ text?: string; missing: string[] }
|
|
568
|
+
* - **本版为纯数据返回形态** `{ text?: string; missing: string[] }`——缺变量(无缺省值时)不 throw,
|
|
561
569
|
* 由壳层(CLI doctor 壳 / app-sdk 桥 throw 壳 / 沙箱宿主)决定 fail-fast 还是降级:
|
|
562
570
|
* SDK 桥壳 missing 非空即 throw(错误文案逐字等价 SDK 旧版);CLI 壳同款。
|
|
563
571
|
* - 无 ${ 的文本快速路径:text 原文返回,零替换零开销。
|
|
@@ -1105,9 +1113,15 @@ declare function evaluateIntegrationServices(input: IntegrationServicePredicateI
|
|
|
1105
1113
|
* 3. serviceSchemas:per-service schema 复合键表——键 `${provider}\u0000${service}`(H2,同一服务
|
|
1106
1114
|
* 多厂商供给各自 schema 零碰撞);多 impl 同 (provider, service) 异 schema → 声明序首个
|
|
1107
1115
|
* 4. vocabulary:所有携带 service-slots.json 的已装契约包该文件 `.slots` 键并集(fs 直读、
|
|
1108
|
-
* `$comment`
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1116
|
+
* `$comment` 忽略;探测三跳 = ① <候选>/node_modules/@tbox.cn/<pkg>/service-slots.json(包根)
|
|
1117
|
+
* ② 同包 src/service-slots.json(发布包 src 附带 / 模板 shim 链接)
|
|
1118
|
+
* ③ 候选自身 {service-slots.json, src/service-slots.json}(local/codegen 全量副本——
|
|
1119
|
+
* mall 生成应用主形态,不依赖 install);零缓存枚举,与 manifest 探测同机制;
|
|
1120
|
+
* 多行业 contracts-* 天然扩展 F8);缺席 → [](退化 demanded ∪ configured)
|
|
1121
|
+
* 5. slotMeta:词汇 meta 节(per-service {title,description} 展示元数据——消费端兜底链
|
|
1122
|
+
* 词汇 > demand > id,views/context resolveServiceDisplay 单源);多包发现序首声明胜出
|
|
1123
|
+
* (与 catalog addSlots 同语义);contracts-mall 词汇锁保证 mall 域全量覆盖;缺席 → {}
|
|
1124
|
+
* 6. domainKeyIssues:跨模块域键冲突 issue(两模块派生同一 domains 键——P13)
|
|
1111
1125
|
*
|
|
1112
1126
|
* **约束(D26;FX-3/F7 边界)**:目录枚举零缓存——readdir / node_modules 候选探测 / `.tbox/app.json` 读取 /
|
|
1113
1127
|
* dev-manifest 读取每次执行(枚举输入保持 fresh——agent 装卸模块下一笔即见);manifest/service-slots
|
|
@@ -1128,6 +1142,8 @@ interface WalkManifestsResult {
|
|
|
1128
1142
|
}>;
|
|
1129
1143
|
/** 服务词汇 = 所有携带 service-slots.json 的已装契约包 `.slots` 键并集(缺席 → []) */
|
|
1130
1144
|
vocabulary: string[];
|
|
1145
|
+
/** 词汇 meta 节:per-service {title,description} 展示元数据(多包首声明胜出;缺席 → {}) */
|
|
1146
|
+
slotMeta: Record<string, SlotMeta>;
|
|
1131
1147
|
/** 跨模块域键冲突(P13——两模块的 service 集派生同一 domains 键) */
|
|
1132
1148
|
domainKeyIssues: Array<{
|
|
1133
1149
|
severity: 'warning';
|
|
@@ -1136,6 +1152,11 @@ interface WalkManifestsResult {
|
|
|
1136
1152
|
module?: string;
|
|
1137
1153
|
}>;
|
|
1138
1154
|
}
|
|
1155
|
+
/** 槽位展示元数据(service-slots.json meta 节元素——宽松提取,字段皆可选) */
|
|
1156
|
+
interface SlotMeta {
|
|
1157
|
+
title?: string;
|
|
1158
|
+
description?: string;
|
|
1159
|
+
}
|
|
1139
1160
|
interface WalkModuleInfo {
|
|
1140
1161
|
/** install id(packages/ 目录名 / npmModules entry.id) */
|
|
1141
1162
|
id: string;
|
|
@@ -1145,12 +1166,17 @@ interface WalkModuleInfo {
|
|
|
1145
1166
|
pkg: string;
|
|
1146
1167
|
descriptor: ModuleDescriptor;
|
|
1147
1168
|
}
|
|
1148
|
-
/** 富形态供给条目:per-service {implementation, credentialType} 恒数组保真(H1
|
|
1169
|
+
/** 富形态供给条目:per-service {implementation, credentialType} 恒数组保真(H1);
|
|
1170
|
+
* title/description = 厂商展示元数据(strict manifest descriptor 透传——多包同厂商
|
|
1171
|
+
* 首声明胜出,与 owner 同语义;B1 walk 层传播) */
|
|
1149
1172
|
interface WalkProviderEntry {
|
|
1150
1173
|
provider: string;
|
|
1151
1174
|
implementation: string;
|
|
1152
1175
|
credentialType: string;
|
|
1153
1176
|
owner: string;
|
|
1177
|
+
/** 厂商展示名(manifest 模块 meta——多包首声明;缺席 = undefined) */
|
|
1178
|
+
title?: string;
|
|
1179
|
+
description?: string;
|
|
1154
1180
|
local?: boolean;
|
|
1155
1181
|
configSchema?: string;
|
|
1156
1182
|
credentialSchema?: string;
|
|
@@ -1251,6 +1277,49 @@ declare function refToEnvKey(stem: string): string;
|
|
|
1251
1277
|
*/
|
|
1252
1278
|
declare function buildPredicateAssembly(appDir: string, walk: WalkManifestsResult, integrations: Record<string, unknown>, env?: Readonly<Record<string, string | undefined>>): PredicateAssembly;
|
|
1253
1279
|
|
|
1280
|
+
/**
|
|
1281
|
+
* 应用级 integrations 求值(cli-remove-prune-and-new D2.4):doctor integration-services 规则内
|
|
1282
|
+
* "装配+求值"序列的单源抽取(FX-2b/F1 轨迹延续——此前 buildPredicateAssembly 已单源,本函数
|
|
1283
|
+
* 将 walk→supplies→assembly→evaluate 全序列收口)。
|
|
1284
|
+
*
|
|
1285
|
+
* 消费方:
|
|
1286
|
+
* - doctor integration-services 规则(外壳保留:stale 防线/文件读取/env 展开/形状守卫/分级投射)
|
|
1287
|
+
* - pruneIntegrationBindings(prune 判据 ≡ doctor 判据的构造性同源载体)
|
|
1288
|
+
*
|
|
1289
|
+
* 契约:调用方须先 `resolveContractsForApp` 并确保 `strictValidation`(本函数不再分级门控——
|
|
1290
|
+
* doctor 的 warning/error 升级指引与 prune 的 skip 语义分属两消费方,不收口)。
|
|
1291
|
+
*/
|
|
1292
|
+
declare function evaluateAppIntegrationIssues(appDir: string, integrations: Record<string, unknown>, contracts: ResolvedContracts, env?: Readonly<Record<string, string | undefined>>): Promise<IntegrationServiceIssue[]>;
|
|
1293
|
+
|
|
1294
|
+
/**
|
|
1295
|
+
* integrations.json 死绑定清理(cli-remove-prune-and-new D2 核心件)。
|
|
1296
|
+
*
|
|
1297
|
+
* 不变式:**删除判据 ≡ doctor integration-services 报错判据(构造性同源)**——消费 doctor 同一
|
|
1298
|
+
* 共享求值器 evaluateAppIntegrationIssues 的结构化 issue,code 白名单
|
|
1299
|
+
* {VENDOR_NOT_INSTALLED, BINDING_UNRESOLVED} + 守卫(绑定引用链候选 provider ∈ installedVendors
|
|
1300
|
+
* 即保留,排除活厂商错配)→ 删除域严格 = "供给载体消亡"。
|
|
1301
|
+
*
|
|
1302
|
+
* 由此推论(均已实证):需求侧孤儿绑定(demand 消失、供给在场)保留——doctor 判其合法;用户
|
|
1303
|
+
* 预配置绑定受保护;一次 remove 自愈全文件历史死债;凭据类 issue(CREDENTIAL_FILE_MISSING 等)
|
|
1304
|
+
* 刻意不进白名单,原样保留。
|
|
1305
|
+
*
|
|
1306
|
+
* 写侧三防线(镜像 write core):N1 归一化(空模块节点删 domains 键)→ parseIntegrationsConfig
|
|
1307
|
+
* 严格校验(失败弃写)→ writeAtomic。凭据孤儿只报告不清理(D9——与 DELETE 管线现行为一致)。
|
|
1308
|
+
* 全空(无任何存活绑定)→ 删文件——ensureMockBindings(缺席即生成)在重装供给时再生闭环。
|
|
1309
|
+
*
|
|
1310
|
+
* 最佳努力语义:谓词不可用(contracts 未安装/降级、env 缺失、求值 throw)→ skipped 返回 +
|
|
1311
|
+
* 文件原样,绝不阻断 remove 本体。
|
|
1312
|
+
*/
|
|
1313
|
+
interface PruneResult {
|
|
1314
|
+
/** 被清除的绑定节点描述(remove 日志行,如 'root.provider=mock' / 'services.member.account') */
|
|
1315
|
+
removed: string[];
|
|
1316
|
+
/** 孤儿凭据(D9 只报告不清理——reconcileOrphanCredentials 产物 message) */
|
|
1317
|
+
orphanCredentials: string[];
|
|
1318
|
+
/** 跳过原因(正常路径 undefined;not-configured = integrations.json 缺席,兼容态零动作) */
|
|
1319
|
+
skipped?: 'predicate-unavailable' | 'validation-failed' | 'not-configured';
|
|
1320
|
+
}
|
|
1321
|
+
declare function pruneIntegrationBindings(appDir: string): Promise<PruneResult>;
|
|
1322
|
+
|
|
1254
1323
|
/**
|
|
1255
1324
|
* .tbox/app.json npmModules 读写(自 CLI manifest.ts 迁入——assembly 层目录知识单源)。
|
|
1256
1325
|
* npmModules 登记 = sdk 包双语义磁盘足迹之一(业务包 = packages/<id>/ 目录,sdk 包 = 本清单登记)。
|
|
@@ -1268,6 +1337,12 @@ interface NpmModuleEntry {
|
|
|
1268
1337
|
mode: ModuleMode;
|
|
1269
1338
|
/** 3-way merge 基线(codegen 模式) */
|
|
1270
1339
|
baseVersion?: string;
|
|
1340
|
+
/**
|
|
1341
|
+
* 条目类别(单一模板统一化 W2-4):'ui-kit' = 壳 UI 组件包——create 全量继承后
|
|
1342
|
+
* 不再承担保留判据(模板 manifest = 出厂装配真源);现职 = update 三方合并锚 +
|
|
1343
|
+
* sync-agent-ui-kit 副本 identity 标记(由该脚本派生维护)。
|
|
1344
|
+
*/
|
|
1345
|
+
kind?: 'ui-kit';
|
|
1271
1346
|
}
|
|
1272
1347
|
interface AppManifest {
|
|
1273
1348
|
templateVersion: string;
|
|
@@ -1429,8 +1504,9 @@ declare function reconcileOrphanCredentials(appDir: string): OrphanIssue[];
|
|
|
1429
1504
|
* 7 严格整文档校验(contracts parseIntegrationsConfig——触发 = !noDiff ∥ 有凭据输入)
|
|
1430
1505
|
* 8 凭据工件落盘(**后置于校验通过**——防「凭据已写 + zod 拒绝」不一致态;
|
|
1431
1506
|
* dryRun → writeCredentialArtifacts 零写盘 + existsSync 预览)
|
|
1432
|
-
* 9 finalize
|
|
1433
|
-
* restartScheduled = written && onApplied(凭据影响 boot
|
|
1507
|
+
* 9 finalize(D35):planned = 将触碰(files 预览单源——dryRun 响应 ≡ 同 body 真实写,files 逐字对称);
|
|
1508
|
+
* written = 实写(!dryRun 派生,D-B2);restartScheduled = written && onApplied(凭据影响 boot 装配——
|
|
1509
|
+
* 重启正当);写后缓存失效
|
|
1434
1510
|
* 归一化:N1 模块节点 {} → 删 domains[键];N3 服务节点 {} 不归一化(显式通配激活 = 合法 TIER0 态);
|
|
1435
1511
|
* N2 已随 ?instance= 退役。dryRun(PUT only):复读完整管线不落盘不排程。
|
|
1436
1512
|
* DELETE:节点移除 + 孤儿凭据写后对账(覆盖 DELETE 与 PUT 替换两类来源,只报告不清理——D9)。
|
|
@@ -1521,7 +1597,7 @@ declare function contractsNotResolvedMessage(contracts: {
|
|
|
1521
1597
|
}): string;
|
|
1522
1598
|
|
|
1523
1599
|
/**
|
|
1524
|
-
* DTO 全量(api.md §3 字段级单源落源——
|
|
1600
|
+
* DTO 全量(api.md §3 字段级单源落源——36 类型;演进 additive-only,铁律 #8)。
|
|
1525
1601
|
* agtcodingbox / tbox-ai-coding 经 `import type` 消费(L2 DTO 单源——API 层零类型镜像)。
|
|
1526
1602
|
* 词汇七概念:app / module / service / instance / provider / integration / resolution。
|
|
1527
1603
|
* 弃用词汇清单见 api.md §3 尾(component/slot/scope/configMode/…——防复活)。
|
|
@@ -1530,12 +1606,14 @@ declare function contractsNotResolvedMessage(contracts: {
|
|
|
1530
1606
|
type ServiceStatus = 'ok' | 'service-not-configured' | 'instance-not-found' | 'instance-disabled' | 'binding-unresolved';
|
|
1531
1607
|
/** 四配置层(instance 为 map 字段层) */
|
|
1532
1608
|
type BindingLayer = 'app' | 'module' | 'service' | 'instance';
|
|
1533
|
-
/** 纯模块清单(无 services——卡片展开走 /modules/:m
|
|
1609
|
+
/** 纯模块清单(无 services——卡片展开走 /modules/:m);provider 家族包不在清单
|
|
1610
|
+
* (供给/实施载体非可配置业务模块——供给轴归 /providers;判定 = install id / 包名
|
|
1611
|
+
* basename 去 scope 后 `provider-` 前缀;已装 provider 详情 GET /modules/:m 仍 200) */
|
|
1534
1612
|
interface ModulesView {
|
|
1535
1613
|
modules: ModuleDeclaration[];
|
|
1536
1614
|
}
|
|
1537
1615
|
interface ModuleDeclaration {
|
|
1538
|
-
/** install id(packages/ 目录名 / .tbox/app.json entry.id
|
|
1616
|
+
/** install id(packages/ 目录名 / .tbox/app.json entry.id)——恒业务模块(provider 家族不在本清单) */
|
|
1539
1617
|
id: string;
|
|
1540
1618
|
/** 包名 */
|
|
1541
1619
|
name: string;
|
|
@@ -1553,6 +1631,10 @@ interface ServiceDemand {
|
|
|
1553
1631
|
}
|
|
1554
1632
|
/** GET /modules/:module(模块静态一站式 · PUT 读对偶) */
|
|
1555
1633
|
interface ModuleDetailView {
|
|
1634
|
+
/** B1 additive:模块 meta 展示名(manifest title;视图层兜底 name——恒有值) */
|
|
1635
|
+
title: string;
|
|
1636
|
+
/** B1 additive:模块 meta 描述(manifest description;兜底 '') */
|
|
1637
|
+
description: string;
|
|
1556
1638
|
/** v4.4 D34:demand 服务首段去重(排序;1..N;零域 = []) */
|
|
1557
1639
|
domainKeys: string[];
|
|
1558
1640
|
/** domains[换算键] 节点原值;未配置 = null;v4.4 D34:仅单域(writable)时在场——多域/零域/共享键无单键落点 */
|
|
@@ -1567,6 +1649,9 @@ interface ModuleDetailView {
|
|
|
1567
1649
|
serviceResolutions?: ServiceResolutionsView | null;
|
|
1568
1650
|
/** v4.4 D32:include=integrationSchemas 层级富化(多域/零域/共享键/未绑定 → null) */
|
|
1569
1651
|
integrationSchemas?: LayerIntegrationSchemas | null;
|
|
1652
|
+
/** v4.6 D36:include=integrationFieldRegistry 集成字段注册表(null 语义镜像 integrationSchemas;
|
|
1653
|
+
* 未知厂商/零足迹 → 非 null 空集 + unsupplied 回填——D37 轴参假想计算同此) */
|
|
1654
|
+
integrationFieldRegistry?: IntegrationFieldRegistryView | null;
|
|
1570
1655
|
}
|
|
1571
1656
|
/** 模块域厂商绑定解析(v4.4 D34——静态文件事实;规则 ≡ 谓词 #7 域级,resolveDomainBinding 单源) */
|
|
1572
1657
|
interface ProviderBinding {
|
|
@@ -1586,6 +1671,29 @@ interface LayerIntegrationSchemas {
|
|
|
1586
1671
|
configSchema: object | null;
|
|
1587
1672
|
}>;
|
|
1588
1673
|
}
|
|
1674
|
+
/** v4.6 D36:集成字段注册表(层级表单服务端预计算——合并代数 R1/R2/R3 服务端单源;
|
|
1675
|
+
* 消费 resolveLayerIntegrationSchemas 产物构造,禁旁路直取 serviceSchemas) */
|
|
1676
|
+
interface IntegrationFieldRegistryView {
|
|
1677
|
+
/** echo:本注册表计算口径(假想时 = 轴参值——D37) */
|
|
1678
|
+
provider: string;
|
|
1679
|
+
/** 作用域内 configSchema === null 的服务(UI「未提供参数模板」提示行) */
|
|
1680
|
+
schemaless: string[];
|
|
1681
|
+
/** module 轴 = demand − 该厂商供给(Set 去重保序);app 轴恒 [](结构性:足迹 ⊆ 供给) */
|
|
1682
|
+
unsupplied: string[];
|
|
1683
|
+
/** 作用域内全部非 null schema 的 additionalProperties 均 ≠ false(聚合;空真) */
|
|
1684
|
+
additionalPropertiesAllowed: boolean;
|
|
1685
|
+
/** 逐 key 合并产物(首声明插入序 = scope 遍历序:app 字母序 / module demand 序) */
|
|
1686
|
+
fields: Array<{
|
|
1687
|
+
key: string;
|
|
1688
|
+
/** null = 类型不可调和(R3/R2 异构/R1 enum 不等——冲突折叠,客户端 RawJson 保真) */
|
|
1689
|
+
schema: object | null;
|
|
1690
|
+
/** required 聚合 = sources.some(s => s.required);conflict 字段照常聚合 */
|
|
1691
|
+
sources: Array<{
|
|
1692
|
+
service: string;
|
|
1693
|
+
required: boolean;
|
|
1694
|
+
}>;
|
|
1695
|
+
}>;
|
|
1696
|
+
}
|
|
1589
1697
|
/** GET /app(应用静态视图:平台服务 + root 原值) */
|
|
1590
1698
|
interface AppView {
|
|
1591
1699
|
/** 平台服务(v4.4 D29:服务词汇 − 模块占用——与模块 demand 同型 ServiceDemand[];
|
|
@@ -1597,6 +1705,9 @@ interface AppView {
|
|
|
1597
1705
|
serviceResolutions?: ServiceResolutionsView | null;
|
|
1598
1706
|
/** v4.4 D32:include=integrationSchemas 层级富化(root.provider 缺席 → null) */
|
|
1599
1707
|
integrationSchemas?: LayerIntegrationSchemas | null;
|
|
1708
|
+
/** v4.6 D36:include=integrationFieldRegistry 集成字段注册表(root.provider 缺席且无轴参 → null;
|
|
1709
|
+
* 未知厂商/零足迹 → 非 null 空集——D37 轴参假想计算同此) */
|
|
1710
|
+
integrationFieldRegistry?: IntegrationFieldRegistryView | null;
|
|
1600
1711
|
}
|
|
1601
1712
|
/** GET /services/:service(服务静态单体) */
|
|
1602
1713
|
interface ServiceDetail extends ServiceDemand {
|
|
@@ -1609,6 +1720,17 @@ interface ServiceDetail extends ServiceDemand {
|
|
|
1609
1720
|
integration: ServiceIntegrationNode | null;
|
|
1610
1721
|
/** 供给该服务的厂商名单(catalog 静态切片——picker 数据源) */
|
|
1611
1722
|
suppliedBy: string[];
|
|
1723
|
+
/** v4.7 D38:include=integrationSchemas 生效绑定富化(三态:null 全链未绑定 /
|
|
1724
|
+
* 绑定无可计算 schema / 含 schema;malformed 节点 → null——不放行域级联) */
|
|
1725
|
+
integrationSchemas?: ServiceIntegrationSchemas | null;
|
|
1726
|
+
}
|
|
1727
|
+
/** 服务级生效绑定 schema(v4.7 D38 静态轴富化——零 contracts,永不 503;实例层无条件排除:
|
|
1728
|
+
* node 级口径 ≠ resolution 默认实例口径,api.md §4.4 注) */
|
|
1729
|
+
interface ServiceIntegrationSchemas {
|
|
1730
|
+
/** 生效厂商:显式(含内联声明名)?? domains[首段].provider ?? root.provider */
|
|
1731
|
+
provider: string;
|
|
1732
|
+
/** catalog 复合键(多 impl 声明序首个)> 内联 ref;miss(未知厂商/未供给/内联缺 ref)→ null(富化非门控) */
|
|
1733
|
+
configSchema: object | null;
|
|
1612
1734
|
}
|
|
1613
1735
|
/** GET /service-resolutions(批量求值 · 唯一求值集合面) */
|
|
1614
1736
|
interface ServiceResolutionsView {
|
|
@@ -1727,12 +1849,18 @@ interface ProviderEntry {
|
|
|
1727
1849
|
local: boolean;
|
|
1728
1850
|
/** 供给声明来源包名 */
|
|
1729
1851
|
owner: string;
|
|
1852
|
+
/** B1 additive:厂商展示名(manifest 模块 meta——多包首声明;缺席 = undefined) */
|
|
1853
|
+
title?: string;
|
|
1854
|
+
description?: string;
|
|
1730
1855
|
}
|
|
1731
1856
|
/** GET /providers/:provider:供给足迹 */
|
|
1732
1857
|
interface ProviderDetail {
|
|
1733
1858
|
provider: string;
|
|
1734
1859
|
local: boolean;
|
|
1735
1860
|
owner: string;
|
|
1861
|
+
/** B1 additive:厂商展示名(同 ProviderEntry——首声明透传) */
|
|
1862
|
+
title?: string;
|
|
1863
|
+
description?: string;
|
|
1736
1864
|
/** per (provider, service) 保真,同厂商异构合法;★ implementations 恒数组(H1——
|
|
1737
1865
|
* 多元素 = 升级窗口,UI 出 impl 选择器,PUT 显式钉版) */
|
|
1738
1866
|
services: Record<string, {
|
|
@@ -1740,6 +1868,9 @@ interface ProviderDetail {
|
|
|
1740
1868
|
implementation: string;
|
|
1741
1869
|
credentialType: string;
|
|
1742
1870
|
}>;
|
|
1871
|
+
/** B1 additive:服务展示名(resolveServiceDisplay——词汇 > demand > id;恒发) */
|
|
1872
|
+
title?: string;
|
|
1873
|
+
description?: string;
|
|
1743
1874
|
/** v4.4 F5:include=integrationSchemas 切换态批量(纯 config——凭据结构归 /credential-types) */
|
|
1744
1875
|
integrationSchemas?: {
|
|
1745
1876
|
configSchema: object | null;
|
|
@@ -1840,14 +1971,7 @@ interface ViewSnapshot {
|
|
|
1840
1971
|
contracts: ResolvedContracts;
|
|
1841
1972
|
}
|
|
1842
1973
|
|
|
1843
|
-
/**
|
|
1844
|
-
* 需求轴/模块静态投影(views/modules;C4)。静态端点结构性零求值(铁律 #3——
|
|
1845
|
-
* 无 resolution/issues/contracts 键,永不 503)。
|
|
1846
|
-
* v4.4 D34:domainKeys/providerBindings/configEditable 显式化;integration 仅单域
|
|
1847
|
-
* (writable)时在场——多域/零域/共享键无单键落点;多域回退兜底键机器拆除
|
|
1848
|
-
* (派生统一 = domainOfService 去重集合,moduleDomainWritable 单源)。
|
|
1849
|
-
*/
|
|
1850
|
-
/** GET /modules:纯模块清单(demand 不在——卡片展开 = GET /modules/:m) */
|
|
1974
|
+
/** GET /modules:纯模块清单(demand 不在——卡片展开 = GET /modules/:m;provider 家族包不在清单) */
|
|
1851
1975
|
declare function loadModulesView(snapshot: ViewSnapshot): {
|
|
1852
1976
|
modules: ModuleDeclaration[];
|
|
1853
1977
|
};
|
|
@@ -1893,24 +2017,40 @@ declare function loadServiceResolutionsView(snapshot: ViewSnapshot, issues: Inte
|
|
|
1893
2017
|
declare function loadServiceResolutionDetail(service: string, snapshot: ViewSnapshot, allIssues: IntegrationIssue[]): ServiceResolutionDetail;
|
|
1894
2018
|
|
|
1895
2019
|
/**
|
|
1896
|
-
*
|
|
1897
|
-
* config
|
|
1898
|
-
* /app、/modules/:m include)/ 供给轴批量(providers.ts include
|
|
2020
|
+
* 层级/服务级 config schema 计算视图(v4.4 D32——静态轴富化,零 contracts 求值;v4.7 D38 服务级)。
|
|
2021
|
+
* config 表单结构四形态同源(P10):槽级组合单体(providers.ts)/ 层级内嵌(本文件——
|
|
2022
|
+
* /app、/modules/:m include)/ 供给轴批量(providers.ts include——切换态)/ 服务级生效绑定
|
|
2023
|
+
* (本文件 loadServiceIntegrationSchemas——/services/:s include)。
|
|
1899
2024
|
*
|
|
1900
2025
|
* 计算规则(D32 裁决):禁交集——config 五层浅合并下「部分服务认识的字段」合法(谓词 #7
|
|
1901
2026
|
* 并集键集同依据);禁合成单一 schema——required/title 冲突的有损代数;产物 = 扁平映射,
|
|
1902
2027
|
* 分组归客户端纯呈现。层级 schema = 表单引导**非写入门禁**(P16——写路径校验权威恒在谓词
|
|
1903
2028
|
* #7 键集 + ajv 凭据链;root 级口径差:#7 = 引用厂商并集,表单 = 层生效厂商单厂商作用域)。
|
|
2029
|
+
*
|
|
2030
|
+
* v4.6(D36/D37 additive 精化):**原始投影**(loadApp/loadModuleIntegrationSchemas)原样保留
|
|
2031
|
+
* 为诊断面 / registry 输入;**消费投影** = buildIntegrationFieldRegistry(字段级合并代数
|
|
2032
|
+
* R1/R2/R3 服务端单源,conflict 折叠 schema:null);**轴向假想绑定** = formProviderOf
|
|
2033
|
+
* (override ?? 实际解析——双投影同源同口径,formViews 装配层一次计算两投影)。
|
|
2034
|
+
* 单源三锚:层级 schema 计算 = resolveLayerIntegrationSchemas / 生效厂商解析 = formProviderOf /
|
|
2035
|
+
* 合并代数 = buildIntegrationFieldRegistry。
|
|
1904
2036
|
*/
|
|
1905
|
-
/** 核心纯函数:显式作用域(provider null → 整字段 null;services 逐项
|
|
1906
|
-
*
|
|
2037
|
+
/** 核心纯函数:显式作用域(provider null → 整字段 null;services 逐项 resolveServiceConfigSchema
|
|
2038
|
+
* 复合解析——v4.7 D38 收口,零新读取路径;供给在场未声明 = null,mock 合法) */
|
|
2039
|
+
declare function resolveLayerIntegrationSchemas(snapshot: ViewSnapshot, provider: string, services: readonly string[]): LayerIntegrationSchemas;
|
|
1907
2040
|
declare function resolveLayerIntegrationSchemas(snapshot: ViewSnapshot, provider: string | null, services: readonly string[]): LayerIntegrationSchemas | null;
|
|
1908
|
-
/** app 级 loader
|
|
1909
|
-
* 作用域 = 该厂商供给足迹全量(≠ AppView.services——root.config 流向包括模块服务在内的所有服务) */
|
|
2041
|
+
/** app 级 loader(v4.6 委托化——签名零改动,公开面保持;假想态归 loadAppFormViews override 参) */
|
|
1910
2042
|
declare function loadAppIntegrationSchemas(snapshot: ViewSnapshot): LayerIntegrationSchemas | null;
|
|
1911
|
-
/** module 级 loader
|
|
1912
|
-
* 作用域 = demand ∩ 该厂商供给;多域/零域/共享键/未绑定 → 整字段 null(表单降级 = ExtraFields) */
|
|
2043
|
+
/** module 级 loader(v4.6 委托化——同上;多域/零域/共享键/未绑定 → 整字段 null,表单降级 = ExtraFields) */
|
|
1913
2044
|
declare function loadModuleIntegrationSchemas(snapshot: ViewSnapshot, moduleId: string): LayerIntegrationSchemas | null;
|
|
2045
|
+
/** 服务级 loader(v4.7 D38):四分支穷举(node.provider = 文件 services[s].provider 逐字原值;
|
|
2046
|
+
* 实例层无条件排除——node 级口径);非空三分支归约一次复合解析。
|
|
2047
|
+
* ① undefined/'' → resolveDomainBinding 域级联(域 + root 双缺 → 整字段 null)
|
|
2048
|
+
* ② 非空 string → bare:catalog miss(未知厂商/未供给)→ configSchema:null 不 404(富化非门控)
|
|
2049
|
+
* ③ 受控内联(isControlledInlineProvider 单源)→ 名 = p.provider;catalog 复合键 > p.configSchema ref
|
|
2050
|
+
* (H9 逃逸 400 照抛——readInlineSchema 共享路径)
|
|
2051
|
+
* ④ 其余(null/数组/原始值/坏对象)→ 整字段 null(≡ 谓词 #5 INLINE_PROVIDER_INVALID 同判——
|
|
2052
|
+
* 不放行域级联,防错误 schema 污染坏节点) */
|
|
2053
|
+
declare function loadServiceIntegrationSchemas(snapshot: ViewSnapshot, service: string): ServiceIntegrationSchemas | null;
|
|
1914
2054
|
|
|
1915
2055
|
/**
|
|
1916
2056
|
* 凭据状态轴投影(views/credentials;v4.4 D33 独立端点 GET /credentials):
|
|
@@ -1940,7 +2080,9 @@ declare function loadCredentialTypesView(snapshot: ViewSnapshot, provider?: stri
|
|
|
1940
2080
|
|
|
1941
2081
|
/**
|
|
1942
2082
|
* createAppToolkit(C4 工厂;v4.4——24 方法 = 11 读(含 credentials/credential-types 双端点)
|
|
1943
|
-
* + 4 写 + 9 迁移面;loadApp/loadModule/loadProvider 增 include
|
|
2083
|
+
* + 4 写 + 9 迁移面;loadApp/loadModule/loadProvider 增 include 选项;v4.6——loadApp/loadModule
|
|
2084
|
+
* += 轴向假想绑定选项(appProvider/moduleProvider,D37);表单双投影经 formViews 单点装配;
|
|
2085
|
+
* v4.7——loadService 增 include 选项(服务级生效绑定 schema 单体))。
|
|
1944
2086
|
* AppToolkit = AppToolkitRead & AppToolkitWrite & AppToolkitInternals——
|
|
1945
2087
|
* Read+Write = HTTP 直通面 additive 冻结(L1 端点↔方法 1:1,L3 命名镜像:Integration=节点级 /
|
|
1946
2088
|
* Config=文件级);Internals = CLI/doctor/桥消费(自由演进)。
|
|
@@ -1962,13 +2104,19 @@ interface AppToolkitOptions {
|
|
|
1962
2104
|
/** ── HTTP 直通面(11 读;L1 镜像律:方法名 = load + URL 资源段;query → 选项字段 L4)── */
|
|
1963
2105
|
interface AppToolkitRead {
|
|
1964
2106
|
loadModules(): Promise<ModulesView>;
|
|
2107
|
+
/** v4.6 D37:moduleProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include 键同现) */
|
|
1965
2108
|
loadModule(moduleId: string, o?: {
|
|
1966
2109
|
include?: string[];
|
|
2110
|
+
moduleProvider?: string;
|
|
1967
2111
|
}): Promise<ModuleDetailView>;
|
|
2112
|
+
/** v4.6 D37:appProvider = 轴向假想绑定(缺席/空串 ≡ 按实际配置解析;需与表单 include 键同现) */
|
|
1968
2113
|
loadApp(o?: {
|
|
1969
2114
|
include?: string[];
|
|
2115
|
+
appProvider?: string;
|
|
1970
2116
|
}): Promise<AppView>;
|
|
1971
|
-
loadService(service: string
|
|
2117
|
+
loadService(service: string, o?: {
|
|
2118
|
+
include?: string[];
|
|
2119
|
+
}): Promise<ServiceDetail>;
|
|
1972
2120
|
loadServiceResolutions(services?: string[]): Promise<ServiceResolutionsView>;
|
|
1973
2121
|
loadServiceResolution(service: string): Promise<ServiceResolutionDetail>;
|
|
1974
2122
|
loadProviders(): Promise<ProvidersView>;
|
|
@@ -2031,4 +2179,4 @@ interface AppToolkitInternals {
|
|
|
2031
2179
|
type AppToolkit = AppToolkitRead & AppToolkitWrite & AppToolkitInternals;
|
|
2032
2180
|
declare function createAppToolkit(appDir: string, options?: AppToolkitOptions): AppToolkit;
|
|
2033
2181
|
|
|
2034
|
-
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 IntegrationIssue, type IntegrationServiceIssue, type IntegrationServicePredicateInput, type LayerIntegrationSchemas, type MiniappContainerEntry, type MockBindingsResult, type ModuleDeclaration, type ModuleDescriptor, type ModuleDetailView, type ModuleIntegrationNode, type ModuleMode, type ModulesView, type NpmModuleEntry, type OrphanIssue, type ParseModuleResult, type PlannedCredential, type PredicateAssembly, type PredicateContracts, type PredicateIoInputs, type ProviderBinding, type ProviderDetail, type ProviderEntry, type ProviderServiceDetail, type ProviderServiceSchemas, type ProviderServiceSchemasResult, type ProviderSlotContrib, type ProvidersView, type ReadIntegrationsResult, type ResolvedContracts, type ResolvedInstance, type ResolvedModule, type ResourceNeedContrib, SAFE_NAME_PATTERN, type SaveResult, type ServiceDemand, type ServiceDetail, type ServiceInstanceNode, type ServiceIntegrationNode, type ServiceNeedContrib, type ServiceResolution, type ServiceResolutionDetail, type ServiceResolutionEntry, type ServiceResolutionsView, type ServiceStatus, type StemInput, type SupplyLookup, type ViewContext, type ViewSnapshot, type WalkCatalog, type WalkManifestsResult, type WalkModuleInfo, type WalkProviderEntry, type WriteCore, type WriteCoreOptions, type WriteOptions, assertValidModuleId, buildPredicateAssembly, checkInstanceKeys, collectDeclaredModules, contractsNotResolvedMessage, createAppToolkit, createFileCache, createWriteCore, credentialArtifactExists, deepEqual, deriveStem, echoForRef, ensureDir, ensureMockBindings, evaluateIntegrationServices, expandEnvVars, extractModuleIdFromSource, invalidateContractsResolver, isControlledInlineProvider, isValidModuleId, loadAppIntegrationSchemas, loadAppView, loadCredentialTypesView, loadCredentialsView, loadModuleDetailView, loadModuleIntegrationSchemas, loadModulesView, loadProviderCatalog, loadProviderCatalogRaw, loadProviderDetailView, loadProviderServiceDetailView, loadProvidersView, loadServiceDetailView, loadServiceResolutionDetail, loadServiceResolutionsView, manifestPath, maskCredentialValues, moduleDependencySchema, moduleDescriptorSchema, pageContribSchema, parseModuleDescriptor, providerSlotContribSchema, readAppManifest, readAppManifestFull, readCredentialFile, readIntegrationsConfig, readIntegrationsStrict, reconcileOrphanCredentials, refToEnvKey, removeNpmModule, resolveContractsForApp, resolveContractsForApp as resolveContractsForAppExport, resolveLayerIntegrationSchemas, resolveServiceSummary, resourceNeedContribSchema, serviceNeedContribSchema, stemToFilePath, stemToRef, tabContribSchema, updateNpmModule, upsertMiniappContainer, upsertNpmModule, walkManifests, writeAppManifest, writeAtomic, writeCredentialFile };
|
|
2182
|
+
export { APP_INTEGRATION_NODE_KEYS, type AppIntegrationNode, type AppManifest, type AppManifestFull, type AppToolkit, AppToolkitError, type AppToolkitErrorCode, type AppToolkitInternals, type AppToolkitOptions, type AppToolkitRead, type AppToolkitWrite, type AppView, type AppliedCredential, type BindingLayer, type BridgeProviderCatalog, type CardContrib, type ContractsResolution, type CredentialBindingEcho, type CredentialEcho, type CredentialFile, type CredentialInput, type CredentialTypeEntry, type CredentialTypesView, type CredentialValues, type CredentialsView, type DeclaredModuleInfo, type EffectiveBinding, type EnvExpansionResult, type EvaluationExports, type FileCache, type InlineVendorDeclaration, type IntegrationFieldRegistryView, type IntegrationIssue, type IntegrationServiceIssue, type IntegrationServicePredicateInput, type LayerIntegrationSchemas, type MiniappContainerEntry, type MockBindingsResult, type ModuleDeclaration, type ModuleDescriptor, type ModuleDetailView, type ModuleIntegrationNode, type ModuleMode, type ModulesView, type NpmModuleEntry, type OrphanIssue, type ParseModuleResult, type PlannedCredential, type PredicateAssembly, type PredicateContracts, type PredicateIoInputs, type ProviderBinding, type ProviderDetail, type ProviderEntry, type ProviderServiceDetail, type ProviderServiceSchemas, type ProviderServiceSchemasResult, type ProviderSlotContrib, type ProvidersView, type PruneResult, type ReadIntegrationsResult, type ResolvedContracts, type ResolvedInstance, type ResolvedModule, type ResourceNeedContrib, SAFE_NAME_PATTERN, type SaveResult, type ServiceDemand, type ServiceDetail, type ServiceInstanceNode, type ServiceIntegrationNode, type ServiceIntegrationSchemas, type ServiceNeedContrib, type ServiceResolution, type ServiceResolutionDetail, type ServiceResolutionEntry, type ServiceResolutionsView, type ServiceStatus, type StemInput, type SupplyLookup, type ViewContext, type ViewSnapshot, type WalkCatalog, type WalkManifestsResult, type WalkModuleInfo, type WalkProviderEntry, type WriteCore, type WriteCoreOptions, type WriteOptions, assertValidModuleId, buildPredicateAssembly, checkInstanceKeys, collectDeclaredModules, contractsNotResolvedMessage, createAppToolkit, createFileCache, createWriteCore, credentialArtifactExists, deepEqual, deriveStem, echoForRef, ensureDir, ensureMockBindings, evaluateAppIntegrationIssues, evaluateIntegrationServices, expandEnvVars, extractModuleIdFromSource, invalidateContractsResolver, isControlledInlineProvider, isValidModuleId, loadAppIntegrationSchemas, loadAppView, loadCredentialTypesView, loadCredentialsView, loadModuleDetailView, loadModuleIntegrationSchemas, loadModulesView, loadProviderCatalog, loadProviderCatalogRaw, loadProviderDetailView, loadProviderServiceDetailView, loadProvidersView, loadServiceDetailView, loadServiceIntegrationSchemas, loadServiceResolutionDetail, loadServiceResolutionsView, manifestPath, maskCredentialValues, moduleDependencySchema, moduleDescriptorSchema, pageContribSchema, parseModuleDescriptor, providerSlotContribSchema, pruneIntegrationBindings, readAppManifest, readAppManifestFull, readCredentialFile, readIntegrationsConfig, readIntegrationsStrict, reconcileOrphanCredentials, refToEnvKey, removeNpmModule, resolveContractsForApp, resolveContractsForApp as resolveContractsForAppExport, resolveLayerIntegrationSchemas, resolveServiceSummary, resourceNeedContribSchema, serviceNeedContribSchema, stemToFilePath, stemToRef, tabContribSchema, updateNpmModule, upsertMiniappContainer, upsertNpmModule, walkManifests, writeAppManifest, writeAtomic, writeCredentialFile };
|