@tbox.cn/app-toolkit 0.1.0 → 0.2.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @tbox.cn/app-toolkit
2
2
 
3
- tbox 应用**工具面**包(与 `@tbox.cn/app-sdk` 运行面/工具面对仗:sdk 给运行的应用用,toolkit 给操作应用的工具用——22 个工厂方法全部以 appDir 为首参)。
3
+ tbox 应用**工具面**包(与 `@tbox.cn/app-sdk` 运行面/工具面对仗:sdk 给运行的应用用,toolkit 给操作应用的工具用——24 个工厂方法全部以 appDir 为首参(v4.4))。
4
4
 
5
5
  模块解析、集成配置求值/校验/写入内核。**contracts 求值与校验语义由应用自己的 `@tbox.cn/app-contracts` 版本动态驱动**(`core/contracts-resolver`)——沙箱镜像内 toolkit 与目标应用版本节奏解耦,呈现给用户的求值结果与写出的文件恒由应用自身 contracts 求值/校验。
6
6
 
@@ -41,7 +41,7 @@ views/ 视图装配:modules / app / service-detail / service-resolutio
41
41
  | 层 | 载体 | 覆盖 |
42
42
  |---|---|---|
43
43
  | ① src 态守卫 | `tests/error-name-safety.test.ts` + 全测试矩阵(随 `pnpm -r test` 进根 verify 链) | 导出面/字面量约定/行为矩阵 |
44
- | ② minified dist 冒烟 | `pnpm --filter @tbox.cn/app-toolkit smoke:dist`(`scripts/smoke-dist.mjs`——纯 node:22 方法 typeof + AppToolkitError.name + resolver 命中 + file-cache 快测) | dist 产物直调(mangle 后) |
44
+ | ② minified dist 冒烟 | `pnpm --filter @tbox.cn/app-toolkit smoke:dist`(`scripts/smoke-dist.mjs`——纯 node:24 方法 typeof + AppToolkitError.name + resolver 命中 + file-cache 快测) | dist 产物直调(mangle 后) |
45
45
  | ③ 发布形态门禁 | `pnpm --filter @tbox.cn/app-toolkit pack --check`(prepack 内建 build,tgz 内即 minified dist) | 打包完整性 |
46
46
  | ④ 跨仓 file: tgz 联调 | agtcodingbox 联调(`file:` tgz 消费——真实宿主) | 消费面全链路 |
47
47
 
@@ -1 +1 @@
1
- import{existsSync as l,readdirSync as F,realpathSync as m}from"fs";import{join as c}from"path";import{pathToFileURL as w}from"url";import{existsSync as T,readFileSync as k,statSync as x}from"fs";function p(){let e=new Map,n=0;function r(t){if(!T(t))return null;let i=x(t);return`${i.mtimeMs}:${i.size}`}return{read(t,i){let o=r(t);if(o===null){e.delete(t);return}let s=e.get(t);if(s&&s.fingerprint===o)return s.value;n+=1;let a=i(k(t,"utf8"));return e.set(t,{fingerprint:o,value:a}),a},invalidate(t){if(t===void 0){e.clear();return}for(let i of t)e.delete(i)},get parseCount(){return n}}}var g=["resolveEffectiveService","buildSupplyLookup","moduleDomainOf","normalizeInstances","RESOURCE_TYPE_IDS"],M="parseIntegrationsConfig",v={version:null,evaluation:!1,strictValidation:!1,module:{},notes:[]};function C(e){let n=[e];for(let r of["apps","packages"]){let t=c(e,r);if(!l(t))continue;let i=F(t,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>o.name);r==="apps"?i.sort((o,s)=>o==="server"?-1:s==="server"?1:o.localeCompare(s)):i.sort((o,s)=>o.localeCompare(s));for(let o of i)n.push(c(t,o))}return n}var d=new Map,h=p();function y(e){return h.read(e,n=>{let r=JSON.parse(n);return typeof r.version=="string"?r.version:null})??null}function b(e){if(!l(e))return"gone";let n;try{n=m(e)}catch{n=e}return l(c(n,"dist","runtime.js"))?"dist":l(c(n,"src","runtime.ts"))?"src":"none"}function R(e){let n=c(e,"package.json");return{pkgPath:n,candidateDir:e,version:y(n),artifact:b(e)}}function E(e){for(let n of C(e)){let r=c(n,"node_modules","@tbox.cn","app-contracts"),t=c(r,"package.json");if(l(t))return{pkgPath:t,candidateDir:r,version:y(t),artifact:b(r)}}return null}function u(e){return e===null?"none":`${e.pkgPath}|${e.version??"null"}|${e.artifact}`}function $(e,n){let r=E(e);if(u(r)!==u(n.first))return!1;if(n.resolved===null)return!0;let t=r!==null&&r.candidateDir===n.resolved.candidateDir?r:R(n.resolved.candidateDir);return u(t)===u(n.resolved)}async function O(e,n){if(!l(e))return null;let r;try{r=m(e)}catch{return null}let i=[c(r,"dist","runtime.js"),c(r,"src","runtime.ts")].find(s=>l(s)),o=h.read(c(e,"package.json"),s=>{let a=JSON.parse(s);return typeof a.version=="string"?a.version:null})??null;if(i===void 0)return n.push(`contracts ${o??"(版本未知)"} 探测命中但无构建产物(dist/runtime.js 缺失)——workspace 源码态未构建:执行 pnpm --filter @tbox.cn/app-contracts build 后重试`),null;try{let s=o!==null?`?v=${encodeURIComponent(o)}`:"",a=await import(w(i).href+s),f=g.every(S=>a[S]!==void 0),P=a[M]!==void 0;return{version:o,evaluation:f,strictValidation:P,module:a,notes:f?[]:[`${i} 命中但求值面具名导出缺席(${g.join("/")})——契约包形态异常`]}}catch(s){return n.push(`contracts ${o??"(版本未知)"} 构建产物导入失败(${s instanceof Error?s.message:String(s)})——workspace 源码态未构建或产物损坏:执行 pnpm --filter @tbox.cn/app-contracts build 后重试`),null}}function U(e){let n=d.get(e);if(n&&$(e,n))return n.promise;let r=E(e),t={promise:Promise.resolve({...v}),first:r,resolved:r};return t.promise=(async()=>{let i=[];for(let o of C(e)){let s=c(o,"node_modules","@tbox.cn","app-contracts"),a=await O(s,i);if(a)return a.version!==null&&!a.strictValidation&&a.notes.push(`contracts ${a.version} 无严格校验面(需 ≥0.9)——升级应用 @tbox.cn/app-contracts 依赖后可用`),t.resolved=R(s),a}return t.resolved=null,i.length===0&&i.push("contracts 不可解析(未安装)——检查应用依赖安装后重试"),{...v,notes:i}})(),d.set(e,t),t.promise}function L(e){e===void 0?d.clear():d.delete(e)}export{p as a,U as b,L as c};
1
+ import{existsSync as l,readdirSync as F,realpathSync as m}from"fs";import{join as c}from"path";import{pathToFileURL as w}from"url";import{existsSync as T,readFileSync as k,statSync as x}from"fs";function p(){let e=new Map,n=0;function r(t){if(!T(t))return null;let i=x(t);return`${i.mtimeMs}:${i.size}`}return{read(t,i){let o=r(t);if(o===null){e.delete(t);return}let s=e.get(t);if(s&&s.fingerprint===o)return s.value;n+=1;let a=i(k(t,"utf8"));return e.set(t,{fingerprint:o,value:a}),a},invalidate(t){if(t===void 0){e.clear();return}for(let i of t)e.delete(i)},get parseCount(){return n}}}var g=["resolveEffectiveService","buildSupplyLookup","moduleDomainOf","normalizeInstances","RESOURCE_TYPE_IDS"],M="parseIntegrationsConfig",v={version:null,evaluation:!1,strictValidation:!1,module:{},notes:[]};function C(e){let n=[e];for(let r of["apps","packages"]){let t=c(e,r);if(!l(t))continue;let i=F(t,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>o.name);r==="apps"?i.sort((o,s)=>o==="server"?-1:s==="server"?1:o.localeCompare(s)):i.sort((o,s)=>o.localeCompare(s));for(let o of i)n.push(c(t,o))}return n}var d=new Map,h=p();function y(e){return h.read(e,n=>{let r=JSON.parse(n);return typeof r.version=="string"?r.version:null})??null}function b(e){if(!l(e))return"gone";let n;try{n=m(e)}catch{n=e}return l(c(n,"dist","runtime.js"))?"dist":l(c(n,"src","runtime.ts"))?"src":"none"}function R(e){let n=c(e,"package.json");return{pkgPath:n,candidateDir:e,version:y(n),artifact:b(e)}}function E(e){for(let n of C(e)){let r=c(n,"node_modules","@tbox.cn","app-contracts"),t=c(r,"package.json");if(l(t))return{pkgPath:t,candidateDir:r,version:y(t),artifact:b(r)}}return null}function u(e){return e===null?"none":`${e.pkgPath}|${e.version??"null"}|${e.artifact}`}function $(e,n){let r=E(e);if(u(r)!==u(n.first))return!1;if(n.resolved===null)return!0;let t=r!==null&&r.candidateDir===n.resolved.candidateDir?r:R(n.resolved.candidateDir);return u(t)===u(n.resolved)}async function O(e,n){if(!l(e))return null;let r;try{r=m(e)}catch{return null}let i=[c(r,"dist","runtime.js"),c(r,"src","runtime.ts")].find(s=>l(s)),o=h.read(c(e,"package.json"),s=>{let a=JSON.parse(s);return typeof a.version=="string"?a.version:null})??null;if(i===void 0)return n.push(`contracts ${o??"(版本未知)"} 探测命中但无构建产物(dist/runtime.js 缺失)——workspace 源码态未构建:执行 pnpm --filter @tbox.cn/app-contracts build 后重试`),null;try{let s=o!==null?`?v=${encodeURIComponent(o)}`:"",a=await import(w(i).href+s),f=g.every(S=>a[S]!==void 0),P=a[M]!==void 0;return{version:o,evaluation:f,strictValidation:P,module:a,notes:f?[]:[`${i} 命中但求值面具名导出缺席(${g.join("/")})——契约包形态异常`]}}catch(s){return n.push(`contracts ${o??"(版本未知)"} 构建产物导入失败(${s instanceof Error?s.message:String(s)})——workspace 源码态未构建或产物损坏:执行 pnpm --filter @tbox.cn/app-contracts build 后重试`),null}}function U(e){let n=d.get(e);if(n&&$(e,n))return n.promise;let r=E(e),t={promise:Promise.resolve({...v}),first:r,resolved:r};return t.promise=(async()=>{let i=[];for(let o of C(e)){let s=c(o,"node_modules","@tbox.cn","app-contracts"),a=await O(s,i);if(a)return a.version!==null&&!a.strictValidation&&a.notes.push(`contracts ${a.version} 无严格校验面(需 ≥0.9.0)——升级应用 @tbox.cn/app-contracts 依赖后可用`),t.resolved=R(s),a}return t.resolved=null,i.length===0&&i.push("contracts 不可解析(未安装)——检查应用依赖安装后重试"),{...v,notes:i}})(),d.set(e,t),t.promise}function L(e){e===void 0?d.clear():d.delete(e)}export{p as a,U as b,L as c};
@@ -0,0 +1 @@
1
+ import{b as a,c as b}from"./chunk-KPD3LUH4.js";export{b as invalidateContractsResolver,a as resolveContractsForApp};
package/dist/index.d.ts CHANGED
@@ -1171,6 +1171,7 @@ interface WalkCatalog {
1171
1171
  }>;
1172
1172
  credentialTypes: Record<string, {
1173
1173
  owner: string;
1174
+ packageDir: string;
1174
1175
  credentialSchema?: string;
1175
1176
  }>;
1176
1177
  }
@@ -1463,14 +1464,12 @@ interface WriteCore {
1463
1464
  warmup(): Promise<void>;
1464
1465
  /** PUT /app/integration(root 节点全集) */
1465
1466
  applyApp(node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
1466
- /** PUT /modules/:module/integration(domains 换算;N1 {} 删域键) */
1467
+ /** PUT /modules/:module/integration(domains 换算;N1 {} 删域键;v4.4 D34 写守卫单源) */
1467
1468
  applyModule(moduleId: string, node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
1468
- /** PUT /services/:service/integration(整节点含 instances map;N3 {} 不归一化) */
1469
+ /** PUT /services/:service/integration(整节点含 instances map;N3 {} 不归一化;v4.4 A2 身份判据) */
1469
1470
  applyService(service: string, node: Record<string, unknown>, opts?: WriteOptions): SaveResult;
1470
- /** DELETE /services/:service/integration(恒整节点;幂等;无预演) */
1471
+ /** DELETE /services/:service/integration(恒整节点;幂等仅判据内成员;无预演) */
1471
1472
  deleteService(service: string): SaveResult;
1472
- /** 模块服务域键(module → domains 键 = 服务集派生域键集 upsert 位) */
1473
- moduleDomainKey(moduleId: string): string | undefined;
1474
1473
  }
1475
1474
  declare function createWriteCore(appDir: string, opts?: WriteCoreOptions): WriteCore;
1476
1475
 
@@ -1511,7 +1510,10 @@ declare class AppToolkitError extends Error {
1511
1510
  readonly fields?: string[];
1512
1511
  constructor(code: AppToolkitErrorCode, httpStatus: number, message: string, fields?: string[]);
1513
1512
  }
1514
- /** CONTRACTS_NOT_RESOLVED 三分支 message(N1 构建指引——api.md 错误信封示例) */
1513
+ /** CONTRACTS_NOT_RESOLVED message(N1 构建指引——api.md 错误信封示例)。
1514
+ * P-4:notes 优先——resolver 在全部不可解析路径均已 push 携带操作指引的 notes(导入失败/
1515
+ * 产物缺失/未安装/<0.9 升级);现行 version===null 分支会把 notes 内细分指引吞成通用文案。
1516
+ * 三分支保留为兜底(防御性——正常路径 notes 恒非空)。 */
1515
1517
  declare function contractsNotResolvedMessage(contracts: {
1516
1518
  version: string | null;
1517
1519
  strictValidation: boolean;
@@ -1540,28 +1542,61 @@ interface ModuleDeclaration {
1540
1542
  title: string;
1541
1543
  description: string;
1542
1544
  }
1543
- /** 服务需求声明(模块 demand 单元;defaults 唯一落位 ServiceDetail) */
1545
+ /** 服务需求声明(模块 demand 单元 / 平台服务条目——v4.4 D29 双端点同型;defaults 唯一落位 ServiceDetail) */
1544
1546
  interface ServiceDemand {
1545
1547
  service: string;
1546
1548
  /** manifest demand meta;缺席 UI 回退 service id */
1547
1549
  title?: string;
1548
1550
  description?: string;
1549
- /** demand optional !== false(多模块 OR 聚合见 resolution echo) */
1551
+ /** demand optional === false(多模块 OR 聚合见 resolution echo;平台服务条目恒 false) */
1550
1552
  required: boolean;
1551
1553
  }
1552
1554
  /** GET /modules/:module(模块静态一站式 · PUT 读对偶) */
1553
1555
  interface ModuleDetailView {
1554
- /** domains[换算键] 节点原值;未配置 = null */
1556
+ /** v4.4 D34:demand 服务首段去重(排序;1..N;零域 = []) */
1557
+ domainKeys: string[];
1558
+ /** domains[换算键] 节点原值;未配置 = null;v4.4 D34:仅单域(writable)时在场——多域/零域/共享键无单键落点 */
1555
1559
  integration: ModuleIntegrationNode | null;
1560
+ /** v4.4 D34:每域一条厂商绑定解析(单域 = 单元素;零域 = [];resolveDomainBinding 单源) */
1561
+ providerBindings: ProviderBinding[];
1562
+ /** v4.4 D34:单域 && 域键无跨模块共享(moduleDomainWritable 单源——读标志与写守卫共用) */
1563
+ configEditable: boolean;
1556
1564
  /** 本模块 demand(卡片展开 + 编辑器静态上下文自足) */
1557
1565
  services: ServiceDemand[];
1566
+ /** v4.4 D31:include=serviceResolutions 内嵌(demand 服务过滤 ≡ 批量 ?service= 语义;<0.9/形态异常 → null——永不 503) */
1567
+ serviceResolutions?: ServiceResolutionsView | null;
1568
+ /** v4.4 D32:include=integrationSchemas 层级富化(多域/零域/共享键/未绑定 → null) */
1569
+ integrationSchemas?: LayerIntegrationSchemas | null;
1570
+ }
1571
+ /** 模块域厂商绑定解析(v4.4 D34——静态文件事实;规则 ≡ 谓词 #7 域级,resolveDomainBinding 单源) */
1572
+ interface ProviderBinding {
1573
+ /** 域键(= domainKeys 成员;多域模块每域一条) */
1574
+ domain: string;
1575
+ /** domains[domain].provider ?? root.provider(双缺 = null) */
1576
+ effective: string | null;
1577
+ /** 生效来源层(双缺 = null) */
1578
+ layer: 'module' | 'app' | null;
1579
+ }
1580
+ /** 层级 config schema 计算(v4.4 D32——静态轴富化,零 contracts) */
1581
+ interface LayerIntegrationSchemas {
1582
+ /** 层生效厂商(resolveDomainBinding 单源) */
1583
+ provider: string;
1584
+ /** 模块级 = 本模块 demand ∩ 该厂商供给;应用级 = 供给足迹全量(configSchema = raw draft 2020-12 原文;供给在场未声明 = null) */
1585
+ services: Record<string, {
1586
+ configSchema: object | null;
1587
+ }>;
1558
1588
  }
1559
1589
  /** GET /app(应用静态视图:平台服务 + root 原值) */
1560
1590
  interface AppView {
1561
- /** 平台服务 id(服务词汇模块占用;owner/标题 UI 按首点段派生) */
1562
- services: string[];
1591
+ /** 平台服务(v4.4 D29:服务词汇模块占用——与模块 demand 同型 ServiceDemand[];
1592
+ * title/description 缺席 = UI 回退 service id;required 恒 false——平台服务无 demand 源) */
1593
+ services: ServiceDemand[];
1563
1594
  /** root 节点原值;文件缺席 = null */
1564
1595
  integration: AppIntegrationNode | null;
1596
+ /** v4.4 D31:include=serviceResolutions 内嵌(全量键集 ≡ 批量无参;<0.9/形态异常 → null——永不 503) */
1597
+ serviceResolutions?: ServiceResolutionsView | null;
1598
+ /** v4.4 D32:include=integrationSchemas 层级富化(root.provider 缺席 → null) */
1599
+ integrationSchemas?: LayerIntegrationSchemas | null;
1565
1600
  }
1566
1601
  /** GET /services/:service(服务静态单体) */
1567
1602
  interface ServiceDetail extends ServiceDemand {
@@ -1591,6 +1626,9 @@ interface ServiceResolutionEntry {
1591
1626
  statusMessage?: string;
1592
1627
  /** 最特异声明层厂商名(跨层事实) */
1593
1628
  provider?: string;
1629
+ /** v4.4:provider 来源声明层(默认实例口径,与 status 同轴);恒 = provider 字段来源层
1630
+ * (ok/binding-unresolved 取声明层;未配置双缺席);≡ 单体 inheritance 链逆序首个有 provider 的层 */
1631
+ layer?: BindingLayer;
1594
1632
  /** provider 在场时在场:(provider, service) ∈ 供给关系 */
1595
1633
  supplied?: boolean;
1596
1634
  /** owner 模块 install id;平台服务/孤儿缺席 */
@@ -1678,8 +1716,6 @@ interface ResolvedInstance {
1678
1716
  statusMessage?: string;
1679
1717
  /** 该实例合并结果 */
1680
1718
  effective?: EffectiveBinding;
1681
- /** 掩码回显 */
1682
- credential?: CredentialEcho;
1683
1719
  }
1684
1720
  /** GET /providers:厂商基本信息 */
1685
1721
  interface ProvidersView {
@@ -1704,24 +1740,53 @@ interface ProviderDetail {
1704
1740
  implementation: string;
1705
1741
  credentialType: string;
1706
1742
  }>;
1743
+ /** v4.4 F5:include=integrationSchemas 切换态批量(纯 config——凭据结构归 /credential-types) */
1744
+ integrationSchemas?: {
1745
+ configSchema: object | null;
1746
+ };
1707
1747
  }>;
1708
1748
  }
1709
1749
  /** GET /providers/:p/services/:s:表单 schema 唯一暴露面 */
1710
1750
  interface ProviderServiceDetail {
1711
1751
  provider: string;
1712
1752
  service: string;
1713
- /** ★ 恒数组(通常 1 */
1753
+ /** ★ 恒数组(通常 1);credentialType 保留(/credential-types 寻址键) */
1714
1754
  implementations: Array<{
1715
1755
  implementation: string;
1716
1756
  credentialType: string;
1717
1757
  }>;
1718
- /** 厂商集成该服务的表单 schema(integration 域专属) */
1758
+ /** 厂商集成该服务的表单 schema(integration 域专属)——v4.4 D33 纯 config(credentialSchema 删净) */
1719
1759
  integrationSchemas: {
1720
1760
  /** raw draft 2020-12 原文零转换;供给在场未声明 = null(mock 合法);解析自默认 impl */
1721
1761
  configSchema: object | null;
1722
- credentialSchema: object | null;
1723
1762
  };
1724
1763
  }
1764
+ /** GET /credentials:绑定位全量掩码回显(应用状态轴;GET 永无真值) */
1765
+ interface CredentialsView {
1766
+ /** root 位;byInstance 键集 = 注册表 ids ∩ 有 ref(无 ref 的注册实例不出现;未注册 ref 跳过不虚报) */
1767
+ app: CredentialBindingEcho;
1768
+ /** 键集 = 已配置服务;byInstance 键集 = 节点 instances map 全键(含 '*')——键域不对称 = 文件语义忠实镜像 */
1769
+ services: Record<string, CredentialBindingEcho>;
1770
+ }
1771
+ /** 一个形状两处(镜像文件层「标量 + ByInstance」模式) */
1772
+ interface CredentialBindingEcho {
1773
+ /** 本位 credentialRef(root.credentialRef / services[s].credentialRef);ref 缺席/文件缺失 → null */
1774
+ credential: CredentialEcho | null;
1775
+ /** 覆盖位(credentialRefByInstance / instances[k].credentialRef) */
1776
+ byInstance: Record<string, CredentialEcho | null>;
1777
+ }
1778
+ /** GET /credential-types[?provider=]:凭据结构清单(供给轴静态;?provider= 过滤语义 ≡ ?service=) */
1779
+ interface CredentialTypesView {
1780
+ types: CredentialTypeEntry[];
1781
+ }
1782
+ interface CredentialTypeEntry {
1783
+ /** '-' = 无凭据语义(mock/local——UI 判 '-' 不渲染凭据表单) */
1784
+ credentialType: string;
1785
+ /** 声明来源包名 */
1786
+ owner: string;
1787
+ /** raw draft 2020-12 原文;未声明 = null(ExtraFields 自由键值同轨) */
1788
+ credentialSchema: object | null;
1789
+ }
1725
1790
  interface EffectiveBinding {
1726
1791
  /** custom 时 provider = 内联声明厂商名 */
1727
1792
  provider: string;
@@ -1761,7 +1826,7 @@ interface IntegrationIssue {
1761
1826
 
1762
1827
  /**
1763
1828
  * 视图装配共享上下文(五投影共用;目录枚举零缓存——walkManifests 每次调用执行)。
1764
- * 域前缀换算(service → 首点段)= 本地一行 helper(文件格式词汇,静态面零 contracts 依赖)。
1829
+ * 域前缀换算(service → 首点段)自 v4.4 F1 integrations/domain-binding.ts(本文件 re-export 保导入路径)。
1765
1830
  */
1766
1831
  interface ViewContext {
1767
1832
  appDir: string;
@@ -1778,20 +1843,21 @@ interface ViewSnapshot {
1778
1843
  /**
1779
1844
  * 需求轴/模块静态投影(views/modules;C4)。静态端点结构性零求值(铁律 #3——
1780
1845
  * 无 resolution/issues/contracts 键,永不 503)。
1846
+ * v4.4 D34:domainKeys/providerBindings/configEditable 显式化;integration 仅单域
1847
+ * (writable)时在场——多域/零域/共享键无单键落点;多域回退兜底键机器拆除
1848
+ * (派生统一 = domainOfService 去重集合,moduleDomainWritable 单源)。
1781
1849
  */
1782
1850
  /** GET /modules:纯模块清单(demand 不在——卡片展开 = GET /modules/:m) */
1783
1851
  declare function loadModulesView(snapshot: ViewSnapshot): {
1784
1852
  modules: ModuleDeclaration[];
1785
1853
  };
1786
- /** 域键换算(模块服务集派生域键集;单域 = 该域,多域/零域 = 模块 id——与 write.moduleDomainKey 同约定) */
1787
- declare function moduleDomainKeyOf(services: ServiceDemand[], moduleId: string): string;
1788
1854
  /** GET /modules/:module:模块静态一站式(integration 节点原值 + demand;PUT 读对偶) */
1789
1855
  declare function loadModuleDetailView(snapshot: ViewSnapshot, moduleId: string): ModuleDetailView;
1790
1856
 
1791
1857
  /**
1792
- * 应用静态投影(views/app;C4;FX-1c B10——root 节点投影修)。
1793
- * /app = 平台服务 + root 节点原值(纯静态,D12):
1794
- * services = 服务词汇 模块占用(裸 string[]——owner/标题 UI 按首点段派生,F2);
1858
+ * 应用静态投影(views/app;C4;FX-1c B10——root 节点投影修;v4.4 D29——services 双端点同型)。
1859
+ * /app = 平台服务 + root 节点原值(纯静态):services = 服务词汇 − 模块占用
1860
+ * (ServiceDemand[]——平台条目 required false、title/description 缺席,D29);
1795
1861
  * 平台服务状态不在此(→ /service-resolutions);模块服务不在此(→ /modules/:m)。
1796
1862
  * integration = **root 节点投影**(APP_INTEGRATION_NODE_KEYS——D21/L1:GET 预填 ≡ PUT body;
1797
1863
  * 文件另含 services/domains/modules 域键,不进 root 节点投影——原实现整文件透传,
@@ -1813,8 +1879,9 @@ declare function loadServiceDetailView(snapshot: ViewSnapshot, service: string):
1813
1879
  */
1814
1880
  /** GET /providers:厂商基本信息(供给足迹不在本端点 → /providers/:p) */
1815
1881
  declare function loadProvidersView(snapshot: ViewSnapshot): ProvidersView;
1816
- /** GET /providers/:provider:供给足迹(implementations 恒数组——H1 多实现钉版数据源) */
1817
- declare function loadProviderDetailView(snapshot: ViewSnapshot, provider: string): ProviderDetail;
1882
+ /** GET /providers/:provider:供给足迹(implementations 恒数组——H1 多实现钉版数据源;
1883
+ * v4.4 F5:include=integrationSchemas 切换态批量——services[s] += { configSchema }(纯 config)) */
1884
+ declare function loadProviderDetailView(snapshot: ViewSnapshot, provider: string, include?: ReadonlySet<string>): ProviderDetail;
1818
1885
  /** 组合单体(GET /providers/:p/services/:s):catalog 供给与槽级内联声明统一解析(P10/P11) */
1819
1886
  declare function loadProviderServiceDetailView(snapshot: ViewSnapshot, provider: string, service: string): ProviderServiceDetail;
1820
1887
 
@@ -1826,15 +1893,63 @@ declare function loadServiceResolutionsView(snapshot: ViewSnapshot, issues: Inte
1826
1893
  declare function loadServiceResolutionDetail(service: string, snapshot: ViewSnapshot, allIssues: IntegrationIssue[]): ServiceResolutionDetail;
1827
1894
 
1828
1895
  /**
1829
- * createAppToolkit(C4 工厂):22 方法 = 9 读(HTTP 直通)+ 4 写(HTTP 直通)+ 9 迁移面(Internals)。
1896
+ * 层级 config schema 计算视图(v4.4 D32——静态轴富化,零 contracts 求值)。
1897
+ * config 表单结构三形态同源(P10):槽级组合单体(providers.ts)/ 层级内嵌(本文件——
1898
+ * /app、/modules/:m include)/ 供给轴批量(providers.ts include——切换态)。
1899
+ *
1900
+ * 计算规则(D32 裁决):禁交集——config 五层浅合并下「部分服务认识的字段」合法(谓词 #7
1901
+ * 并集键集同依据);禁合成单一 schema——required/title 冲突的有损代数;产物 = 扁平映射,
1902
+ * 分组归客户端纯呈现。层级 schema = 表单引导**非写入门禁**(P16——写路径校验权威恒在谓词
1903
+ * #7 键集 + ajv 凭据链;root 级口径差:#7 = 引用厂商并集,表单 = 层生效厂商单厂商作用域)。
1904
+ */
1905
+ /** 核心纯函数:显式作用域(provider null → 整字段 null;services 逐项 serviceSchemas 复合键 +
1906
+ * readSchemaRef——既有解析路径零新读;供给在场未声明 = null,mock 合法) */
1907
+ declare function resolveLayerIntegrationSchemas(snapshot: ViewSnapshot, provider: string | null, services: readonly string[]): LayerIntegrationSchemas | null;
1908
+ /** app 级 loader:生效厂商 = root.provider(非空字符串,缺席 → 整字段 null——D32「未绑定」);
1909
+ * 作用域 = 该厂商供给足迹全量(≠ AppView.services——root.config 流向包括模块服务在内的所有服务) */
1910
+ declare function loadAppIntegrationSchemas(snapshot: ViewSnapshot): LayerIntegrationSchemas | null;
1911
+ /** module 级 loader:仅 writable 单域;生效厂商 = resolveDomainBinding(D32/R4 单源);
1912
+ * 作用域 = demand ∩ 该厂商供给;多域/零域/共享键/未绑定 → 整字段 null(表单降级 = ExtraFields) */
1913
+ declare function loadModuleIntegrationSchemas(snapshot: ViewSnapshot, moduleId: string): LayerIntegrationSchemas | null;
1914
+
1915
+ /**
1916
+ * 凭据状态轴投影(views/credentials;v4.4 D33 独立端点 GET /credentials):
1917
+ * 绑定位全量掩码回显——应用状态轴(随配置失效、零求值零 contracts、永不 503)。
1918
+ * GET 永无真值(仅 ref/masked);掩码单源 maskCredentialValues;echoForRef 自
1919
+ * service-resolutions 迁入共享(求值单体 instances[].credential 已删净——求值路径零凭据 I/O)。
1920
+ *
1921
+ * 键集 = 文件语义忠实镜像(api.md §0「键域不对称」):
1922
+ * app.byInstance = 注册表 ids ∩ 有 ref(无 ref 的注册实例不出现;未注册 ref 跳过不虚报)
1923
+ * services[s].byInstance = 节点 instances map 全键(含 '*',无 ref 亦在场 → null)
1924
+ * null 语义:credential/byInstance 值 = 「未就绪」(ref 缺席或文件缺失)——缺失诊断归谓词 #1
1925
+ * (CREDENTIAL_FILE_MISSING),echo = 状态回显、issues = 诊断定位(P16 分工)。
1926
+ */
1927
+ /** 凭据文件掩码回显(ref 非 secret:// 或文件缺席 → undefined——调用方映射 null) */
1928
+ declare function echoForRef(appDir: string, ref: string | undefined): CredentialEcho | undefined;
1929
+ declare function loadCredentialsView(snapshot: ViewSnapshot): CredentialsView;
1930
+
1931
+ /**
1932
+ * 供给轴凭据结构清单(views/credential-types;v4.4 D33 独立端点 GET /credential-types[?provider=]):
1933
+ * 结构按 credentialType 键(wanda 全部槽共享同一 type 同一 schema 文件——(provider, service)
1934
+ * 组合寻址是错位键);源 = catalog.credentialTypes(既有聚合产物零新读取路径,聚合条目携
1935
+ * packageDir 供 schema 文件解析)。静态轴(稳定可缓存、永不 503)。
1936
+ * ?provider= 过滤 ≡ ?service= 先例(过滤非寻址;未知 provider → 空 types 不 404)。
1937
+ * '-' = 无凭据语义(mock/local——UI 判 '-' 不渲染凭据表单);credentialSchema null = 未声明。
1938
+ */
1939
+ declare function loadCredentialTypesView(snapshot: ViewSnapshot, provider?: string): CredentialTypesView;
1940
+
1941
+ /**
1942
+ * createAppToolkit(C4 工厂;v4.4——24 方法 = 11 读(含 credentials/credential-types 双端点)
1943
+ * + 4 写 + 9 迁移面;loadApp/loadModule/loadProvider 增 include 选项)。
1830
1944
  * AppToolkit = AppToolkitRead & AppToolkitWrite & AppToolkitInternals——
1831
1945
  * Read+Write = HTTP 直通面 additive 冻结(L1 端点↔方法 1:1,L3 命名镜像:Integration=节点级 /
1832
1946
  * Config=文件级);Internals = CLI/doctor/桥消费(自由演进)。
1833
1947
  *
1834
1948
  * **门控断言单点(policy at edge)**:求值(2)+ 写(4)+ ensureMockBindings / writeIntegrationsConfig /
1835
1949
  * evaluateIntegrationServices 入口 assertContractsUsable——strictValidation === false → 503
1836
- * CONTRACTS_NOT_RESOLVED(message 三分支);静态方法不门控(永不 503——铁律 #3);
1837
- * integrations/ views/ 机制层保持纯函数。
1950
+ * CONTRACTS_NOT_RESOLVED;静态方法不门控(永不 503——铁律 #3);**include 装配为条件分支非门控**
1951
+ * (D31——serviceResolutions evaluation && strictValidation 双条件装配,<0.9/形态异常 → null,
1952
+ * 静态端点永不 503;integrationSchemas 纯静态轴零 contracts);integrations/ views/ 机制层保持纯函数。
1838
1953
  *
1839
1954
  * 并发:进程内写串行(per-factory promise chain)+ 原子写 + 写后本实例缓存即刻失效(D26)。
1840
1955
  * onApplied(D7):toolkit 判定「需要重启」(实际落盘且非 dryRun/no-diff)→ 调用一次 +
@@ -1844,17 +1959,27 @@ interface AppToolkitOptions {
1844
1959
  /** 写成功(实际落盘且非 dryRun/no-diff)→ 调用一次(宿主闭包内防抖/守卫);CLI 不传恒 false */
1845
1960
  onApplied?: () => void;
1846
1961
  }
1847
- /** ── HTTP 直通面(9 读;L1 镜像律:方法名 = load + URL 资源段)── */
1962
+ /** ── HTTP 直通面(11 读;L1 镜像律:方法名 = load + URL 资源段;query → 选项字段 L4)── */
1848
1963
  interface AppToolkitRead {
1849
1964
  loadModules(): Promise<ModulesView>;
1850
- loadModule(moduleId: string): Promise<ModuleDetailView>;
1851
- loadApp(): Promise<AppView>;
1965
+ loadModule(moduleId: string, o?: {
1966
+ include?: string[];
1967
+ }): Promise<ModuleDetailView>;
1968
+ loadApp(o?: {
1969
+ include?: string[];
1970
+ }): Promise<AppView>;
1852
1971
  loadService(service: string): Promise<ServiceDetail>;
1853
1972
  loadServiceResolutions(services?: string[]): Promise<ServiceResolutionsView>;
1854
1973
  loadServiceResolution(service: string): Promise<ServiceResolutionDetail>;
1855
1974
  loadProviders(): Promise<ProvidersView>;
1856
- loadProvider(provider: string): Promise<ProviderDetail>;
1975
+ loadProvider(provider: string, o?: {
1976
+ include?: string[];
1977
+ }): Promise<ProviderDetail>;
1857
1978
  loadProviderService(provider: string, service: string): Promise<ProviderServiceDetail>;
1979
+ /** GET /credentials(v4.4 D33——应用状态轴;零门控,永不 503) */
1980
+ loadCredentials(): Promise<CredentialsView>;
1981
+ /** GET /credential-types[?provider=](v4.4 D33——供给轴静态;零门控,永不 503) */
1982
+ loadCredentialTypes(provider?: string): Promise<CredentialTypesView>;
1858
1983
  }
1859
1984
  /** ── HTTP 直通面(4 写;body ≡ 文件节点全量替换;DELETE 无 dryRun/无 options)── */
1860
1985
  interface AppToolkitWrite {
@@ -1906,4 +2031,4 @@ interface AppToolkitInternals {
1906
2031
  type AppToolkit = AppToolkitRead & AppToolkitWrite & AppToolkitInternals;
1907
2032
  declare function createAppToolkit(appDir: string, options?: AppToolkitOptions): AppToolkit;
1908
2033
 
1909
- 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 CredentialEcho, type CredentialFile, type CredentialInput, type CredentialValues, type DeclaredModuleInfo, type EffectiveBinding, type EnvExpansionResult, type EvaluationExports, type FileCache, type InlineVendorDeclaration, type IntegrationIssue, type IntegrationServiceIssue, type IntegrationServicePredicateInput, 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 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, ensureDir, ensureMockBindings, evaluateIntegrationServices, expandEnvVars, extractModuleIdFromSource, invalidateContractsResolver, isControlledInlineProvider, isValidModuleId, loadAppView, loadModuleDetailView, loadModulesView, loadProviderCatalog, loadProviderCatalogRaw, loadProviderDetailView, loadProviderServiceDetailView, loadProvidersView, loadServiceDetailView, loadServiceResolutionDetail, loadServiceResolutionsView, manifestPath, maskCredentialValues, moduleDependencySchema, moduleDescriptorSchema, moduleDomainKeyOf, pageContribSchema, parseModuleDescriptor, providerSlotContribSchema, readAppManifest, readAppManifestFull, readCredentialFile, readIntegrationsConfig, readIntegrationsStrict, reconcileOrphanCredentials, refToEnvKey, removeNpmModule, resolveContractsForApp, resolveContractsForApp as resolveContractsForAppExport, resolveServiceSummary, resourceNeedContribSchema, serviceNeedContribSchema, stemToFilePath, stemToRef, tabContribSchema, updateNpmModule, upsertMiniappContainer, upsertNpmModule, walkManifests, writeAppManifest, writeAtomic, writeCredentialFile };
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 };