@nudojs/core 1.0.1 → 2.0.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 CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Abs, P as Phi, a as AstEnv, C as Confidence, b as Pred, S as Shape, T as Term, c as AbsModuleExports, d as PrimName, R as RelSource, H as HofSite } from './index-FITqyJ8v.js';
2
- export { $ as $add, e as $arr, f as $async, g as $asyncReturn, h as $await, i as $call, j as $callNamed, k as $catchVal, l as $class, m as $concat, n as $div, o as $elems, p as $eq, q as $fnVal, r as $for, s as $forIter, t as $forOf, u as $fork, v as $ge, w as $gen, x as $get, y as $gt, z as $idx, B as $idxSet, D as $invoke, E as $invokeSuper, F as $join, G as $le, I as $len, J as $lit, K as $lt, L as $mod, M as $mul, N as $ne, O as $neg, Q as $new, U as $not, V as $obj, W as $optionalGet, X as $optionalInvoke, Y as $orDefault, Z as $regex, _ as $set, a0 as $setKey, a1 as $spread, a2 as $staticInvoke, a3 as $sub, a4 as $super, a5 as $switch, a6 as $thisGet, a7 as $thisSet, a8 as $throw, a9 as $typeof, aa as $while, ab as $whileSeq, ac as $yield, ad as BCallRecord, ae as BClassSpec, af as BMemberDiag, ag as DEFAULT_MAX_LOOP_ITERS, ah as HofCollectCtx, ai as LiteralValue, aj as NudoThrow, ak as RunTranspiledOptions, al as TranspileOptions, am as TranspiledCallResult, an as abs, ao as absToString, ap as alphaOf, aq as and, ar as anyVar, as as app, at as applyCallbackAbs, au as asAbs, av as asAbsVal, aw as betaOf, ax as bindImports, ay as bool, az as boolLit, aA as callTranspiledExport, aB as callTranspiledExportFull, aC as clearBClasses, aD as collectAbsExports, aE as confJoin, aF as createHofCollectCtx, aG as currentExecPhi, aH as emptyPhi, aI as eq, aJ as ge, aK as geNum, aL as getAbsOrigin, aM as getBCallCollector, aN as getBClass, aO as gt, aP as gtNum, aQ as implies, aR as instantiateReturn, aS as isDefinitelyFalse, aT as isDefinitelyTrue, aU as isExactLit, aV as isNudoThrow, aW as isNumPrim, aX as isRelFn, aY as isStrPrim, aZ as le, a_ as leNum, a$ as lit, b0 as litTruth, b1 as litValue, b2 as lt, b3 as ltNum, b4 as mapElementFallback, b5 as namespaceNameOf, b6 as ne, b7 as never, b8 as not, b9 as noteMemberDispatchMiss, ba as notePrimMemberMissing, bb as noteUnknownMemberMissing, bc as num, bd as numLit, be as numVar, bf as obj, bg as or, bh as pFalse, bi as pTrue, bj as phiAnd, bk as predEquals, bl as predToString, bm as predVars, bn as projectFlatMapResult, bo as promoteParamShape, bp as ptypeof, bq as recordMemberDiag, br as registerBClass, bs as runTranspiled, bt as setApplyCallbackHost, bu as setBCallCollector, bv as setMemberDiagCollector, bw as shapeOfTerm, bx as shapeToString, by as simplifyTerm, bz as snapshotAbs, bA as str, bB as strLit, bC as substAbs, bD as substPred, bE as substPredAbs, bF as tagAbsOrigin, bG as termEquals, bH as termToString, bI as transpile, bJ as transpileExpression, bK as transpileFile, bL as transpileSource, bM as tryPromoteDirectCall, bN as tryPromoteForOfIteratee, bO as tryPromoteHofCallback, bP as tryPromoteReceiverAsArr, bQ as undefAbs, bR as unknown, bS as v, bT as withExecPhi } from './index-FITqyJ8v.js';
1
+ import { A as Abs, P as Phi, a as AstEnv, C as Confidence, b as Pred, S as Shape, T as Term, c as AbsModuleExports, d as PrimName, R as RelSource, H as HofSite } from './index-DxjxtxOJ.js';
2
+ export { $ as $add, e as $arr, f as $arrMutContainer, g as $arrRest, h as $async, i as $asyncReturn, j as $await, k as $call, l as $callNamed, m as $catchVal, n as $class, o as $concat, p as $div, q as $elems, r as $eq, s as $eqLoose, t as $fnVal, u as $for, v as $forIter, w as $forOf, x as $fork, y as $ge, z as $gen, B as $get, D as $gt, E as $idx, F as $idxSet, G as $invoke, I as $invokeSuper, J as $isForkExit, K as $join, L as $le, M as $len, N as $lit, O as $loopReturn, Q as $lt, U as $mod, V as $mul, W as $ne, X as $neLoose, Y as $neg, Z as $new, _ as $not, a0 as $nullishTest, a1 as $obj, a2 as $objRest, a3 as $optionalGet, a4 as $optionalInvoke, a5 as $orDefault, a6 as $pushLoopExit, a7 as $regex, a8 as $rethrowIfNudoReturn, a9 as $set, aa as $setKey, ab as $spread, ac as $staticInvoke, ad as $sub, ae as $super, af as $switch, ag as $thisGet, ah as $thisSet, ai as $throw, aj as $tryCurrentMark, ak as $tryMark, al as $tryPopMark, am as $tryTakeSince, an as $typeof, ao as $while, ap as $whileSeq, aq as $yield, ar as BCallRecord, as as BClassSpec, at as BMemberDiag, au as DEFAULT_MAX_LOOP_ITERS, av as HofCollectCtx, aw as LiteralValue, ax as NudoReturn, ay as NudoThrow, az as RunTranspiledOptions, aA as TranspileOptions, aB as TranspiledCallResult, aC as abs, aD as absToString, aE as alphaOf, aF as and, aG as anyVar, aH as app, aI as applyCallbackAbs, aJ as asAbs, aK as asAbsVal, aL as betaOf, aM as bindImports, aN as bool, aO as boolLit, aP as callAtFunctionBoundary, aQ as callTranspiledExport, aR as callTranspiledExportFull, aS as clearBClasses, aT as collectAbsExports, aU as confJoin, aV as createHofCollectCtx, aW as currentExecPhi, aX as emptyPhi, aY as eq, aZ as ge, a_ as geNum, a$ as getAbsOrigin, b0 as getBCallCollector, b1 as getBClass, b2 as gt, b3 as gtNum, b4 as implies, b5 as instantiateReturn, b6 as isArrMutator, b7 as isDefinitelyFalse, b8 as isDefinitelyTrue, b9 as isEvalMissingSlotEnabled, ba as isExactLit, bb as isNudoReturn, bc as isNudoThrow, bd as isNumPrim, be as isRelFn, bf as isStrPrim, bg as le, bh as leNum, bi as lit, bj as litTruth, bk as litValue, bl as lt, bm as ltNum, bn as mapElementFallback, bo as namespaceNameOf, bp as ne, bq as never, br as not, bs as noteMemberDispatchMiss, bt as noteObjSlotMissing, bu as notePrimMemberMissing, bv as noteUnknownMemberMissing, bw as num, bx as numLit, by as numVar, bz as obj, bA as or, bB as pFalse, bC as pTrue, bD as phiAnd, bE as predEquals, bF as predToString, bG as predVars, bH as projectFlatMapResult, bI as promoteParamShape, bJ as ptypeof, bK as pushLoopExit, bL as pushThrowExit, bM as recordMemberDiag, bN as registerBClass, bO as runTranspiled, bP as runWithEvalMissingSlot, bQ as runWithLoopExits, bR as setApplyCallbackHost, bS as setBCallCollector, bT as setEvalMissingSlotEnabled, bU as setMemberDiagCollector, bV as shapeOfTerm, bW as shapeToString, bX as simplifyTerm, bY as snapshotAbs, bZ as str, b_ as strLit, b$ as substAbs, c0 as substPred, c1 as substPredAbs, c2 as tagAbsOrigin, c3 as takeLoopExits, c4 as takeThrowExits, c5 as termEquals, c6 as termToString, c7 as transpile, c8 as transpileExpression, c9 as transpileFile, ca as transpileSource, cb as tryPromoteDirectCall, cc as tryPromoteForOfIteratee, cd as tryPromoteHofCallback, ce as tryPromoteReceiverAsArr, cf as undefAbs, cg as unknown, ch as v, ci as withExecPhi } from './index-DxjxtxOJ.js';
3
3
  import { Node, File } from '@babel/types';
4
4
 
5
5
  type Environment = {
@@ -117,6 +117,12 @@ type AbsFnImpl = {
117
117
  kind?: string;
118
118
  /** 调用时直接派发(mock withArgs 等),优先于 body */
119
119
  apply?: (args: Abs[]) => Abs;
120
+ /**
121
+ * 对象方法(ObjectMethod / 方法型 FunctionExpression):$invoke 时把
122
+ * receiver 作为 apply 的**首参**注入。shape.params 仍是用户可见形参
123
+ * (不含 receiver),自由调用不注入 → this 为 unbound(JS 语义)。
124
+ */
125
+ bindThis?: boolean;
120
126
  /**
121
127
  * Optional content key for cache fingerprints. formatAbs cannot see
122
128
  * WeakMap-side mock semantics (returns/withArgs/callsFake), so hosts that
@@ -223,12 +229,18 @@ declare function negAbs(a: Abs, _phi?: Phi): Abs;
223
229
  declare function notAbs(a: Abs): Abs;
224
230
  /** 该 shape 在 JS 上一定不是 null/undefined */
225
231
  declare function definitelyNotNullishShape(s: Shape): boolean;
232
+ /** 仅当 term 确为 lit null/undefined 时为 true;非 lit 的 litValue===undefined 不得当 nullish */
226
233
  declare function isNullishLitAbs(a: Abs): boolean;
227
234
  /**
228
235
  * 严格相等(Abs):双字面量折叠;nullish 与 definitely-not-nullish → false。
229
236
  * 返回 undefined = 无法判定(交给 boolean + 调用方)。
230
237
  */
231
238
  declare function strictEqAbs(a: Abs, b: Abs): boolean | undefined;
239
+ /**
240
+ * 宽松相等 `==`(C2.3):双 lit 走 Abstract Equality;否则回落严格相等判定。
241
+ * 返回 undefined = 无法判定。
242
+ */
243
+ declare function looseEqAbs(a: Abs, b: Abs): boolean | undefined;
232
244
 
233
245
  /**
234
246
  * Abs 侧常用 builtin:shape 级运算,不依赖 TypeValue host 库。
@@ -259,6 +271,12 @@ declare function evalPromiseCtor(_args: Abs[]): Abs;
259
271
  declare function evalPromiseStatic(name: string, args: Abs[]): Abs | undefined;
260
272
  /** 命名空间分派入口 */
261
273
  declare function evalNamespaceCall(ns: string, method: string, args: Abs[]): Abs | undefined;
274
+ declare function isErrorCtorName(name: string | undefined): boolean;
275
+ /**
276
+ * Error brand:shape 带 name/message(字面量 message 保精确)。
277
+ * $new 与 ast-eval 的 new Error 共用——catch 形参成员访问可解。
278
+ */
279
+ declare function errorBrandAbs(name: string, messageArg?: Abs): Abs;
262
280
  /** new X(...) */
263
281
  declare function evalBuiltinNew(className: string, args: Abs[]): Abs | undefined;
264
282
  /** brand 实例方法(Date/RegExp/Map/Set) */
@@ -349,7 +367,7 @@ declare function spread(base: Abs, over: Abs): Abs;
349
367
  * 同 key 集:槽位级 join(字面量并);异 key 集:保持 sum。
350
368
  */
351
369
  declare function joinObjects(a: Abs, b: Abs): Abs;
352
- /** 值级 join:字面量保留为… Phase A 对 prim 做 term 保留策略 */
370
+ /** 值级 join:同型双字面量保留为枚举 sum;其余 prim 同型收成 path */
353
371
  declare function joinValues(a: Abs, b: Abs): Abs;
354
372
  declare function makeSum(a: Abs, b: Abs): Abs;
355
373
  declare function absShapeKey(a: Abs, seen?: Set<object>): string;
@@ -372,6 +390,86 @@ declare function joinFunctions(a: Abs, b: Abs): Abs;
372
390
  /** 通用 join:分派到对象/函数/值 */
373
391
  declare function joinAbs(a: Abs, b: Abs): Abs;
374
392
 
393
+ /**
394
+ * Map / Set 字面量条目追踪(C1.1 / C1.2)。
395
+ * 按 Abs 对象身份挂 side table:`m.set("k", v)` 后同 identity 的 `m.get("k")`
396
+ * 可回查。非字面量 key 不入表;get/has 对未知 key 保守回落。
397
+ */
398
+
399
+ type LitKey = string | number | boolean | null | undefined;
400
+ type MapTable = {
401
+ byLit: Map<LitKey, Abs>;
402
+ /** 非字面量 key 写入的值(get 未知 key 时 join 用) */
403
+ shadowValues: Abs[];
404
+ /** 抽象分支并入后「可能不存在」的字面量键(get/has 需保守) */
405
+ maybeAbsent?: Set<LitKey>;
406
+ };
407
+ type SetTable = {
408
+ elements: Abs[];
409
+ /**
410
+ * fork 后 membership 不确定。
411
+ * - `true`:整表不确定(未知 delete / 非字面量元素混杂)
412
+ * - `Set<LitKey>`:这些字面 key 可能在部分臂缺失(跨臂 delete 不同元素时,长度启发式不够)
413
+ */
414
+ maybeAbsent?: true | Set<LitKey>;
415
+ };
416
+ /** $fork 抽象分支:每侧独立 overlay,避免身份表被另一侧 set 污染 */
417
+ type ArmOverlay = WeakMap<object, {
418
+ map?: MapTable;
419
+ set?: SetTable;
420
+ }>;
421
+ declare function pushCollectionArm(): void;
422
+ declare function popCollectionArm(): ArmOverlay | undefined;
423
+ /**
424
+ * 合并 fork 各臂 overlay → 全局表(由 endCollectionFork 实现)。
425
+ * 保留导出名以免外部测试/调用点漂移。
426
+ */
427
+ declare function mergeCollectionArms(arms: Array<ArmOverlay | undefined>): void;
428
+ declare function beginCollectionFork(): void;
429
+ declare function noteCollectionWrite(id: object): void;
430
+ declare function endCollectionFork(arms: Array<ArmOverlay | undefined>): void;
431
+ declare function isMapAbs(a: Abs | undefined): boolean;
432
+ declare function isSetAbs(a: Abs | undefined): boolean;
433
+ declare function makeMapAbs(iterable?: Abs): Abs;
434
+ declare function makeSetAbs(iterable?: Abs): Abs;
435
+ /** Map#set:fork 内写 overlay;否则原地。返回同一 Abs(JS 可变语义) */
436
+ declare function mapSetEntry(mapAbs: Abs, key: Abs | undefined, value: Abs): Abs;
437
+ /** Map#delete:fork overlay 内移除字面量键;未知 key 仅标 shadow 不确定 */
438
+ declare function mapDeleteEntry(mapAbs: Abs, key: Abs | undefined): Abs;
439
+ /** Map#clear:清空条目;fork 下仍走 overlay */
440
+ declare function mapClearEntries(mapAbs: Abs): Abs;
441
+ /** Map#get:命中字面量 key → 精确;miss / 未知 key / maybeAbsent / shadow 并 undefined */
442
+ declare function mapGetEntry(mapAbs: Abs, key: Abs | undefined): Abs;
443
+ /** Map#has:字面量 miss 折 exact false 时,get 必须是 undefined(不可再并 value) */
444
+ declare function mapHasEntry(mapAbs: Abs, key: Abs | undefined): Abs;
445
+ declare function mapSizeAbs(mapAbs: Abs): Abs;
446
+ declare function mapValuesAbs(mapAbs: Abs): Abs[];
447
+ /**
448
+ * Map 迭代条目:JS `for (const [k,v] of map)` / `Array.from(map)` 产出
449
+ * `[key, value]` 元组 Abs。字面量 key 精确;shadow 写入 key 为 unknown。
450
+ */
451
+ declare function mapEntriesAbs(mapAbs: Abs): Abs[];
452
+ /** Set#add:fork 内写 overlay;返回同一 Abs */
453
+ declare function setAddEntry(setAbs: Abs, value: Abs): Abs;
454
+ /** Set#delete:按字面量元素移除;fork overlay 内生效。
455
+ * 字面量删除且无残留非字面量元素 → 该臂可精确 miss;
456
+ * 臂间分歧由 endCollectionFork 按元素数差标 maybeAbsent。 */
457
+ declare function setDeleteEntry(setAbs: Abs, value: Abs): Abs;
458
+ /** Set#clear */
459
+ declare function setClearEntries(setAbs: Abs): Abs;
460
+ declare function setHasEntry(setAbs: Abs, value: Abs): Abs;
461
+ declare function setSizeAbs(setAbs: Abs): Abs;
462
+ declare function setElementsAbs(setAbs: Abs): Abs[];
463
+ /**
464
+ * 确切条目数:Set 无 maybeAbsent / Map 无 shadow+maybeAbsent 时返回长度;
465
+ * 否则 undefined(for-of 不得假装有界)。
466
+ */
467
+ declare function collectionExactLen(c: Abs): number | undefined;
468
+ /** 元素联合(for-of / Array.from);无表 → unknown。
469
+ * Map 语义是 entry `[k,v]` 元组联合,不是裸 value。 */
470
+ declare function collectionElementJoin(c: Abs): Abs;
471
+ declare function clearCollectionTables(): void;
472
+
375
473
  /**
376
474
  * 结构可赋值:src ≤ tgt(Abs 上的 leq)。
377
475
  *
@@ -472,6 +570,9 @@ type EvalResult = {
472
570
  * 假分支 fall-through 仍可能走后续语句。evalBlock 需与后续结果 join。
473
571
  */
474
572
  partialReturn?: boolean;
573
+ /** 抽象分支可能 throw(另一侧继续)— try 需并 catch 路径 */
574
+ partialThrow?: boolean;
575
+ throwValue?: Abs;
475
576
  };
476
577
  /**
477
578
  * 分析一段 JS 源码。
@@ -694,6 +795,8 @@ declare function isIntFlag(c: NudoConstraint): boolean;
694
795
  declare function number(): ConstraintBuilder;
695
796
  declare function string(): ConstraintBuilder;
696
797
  declare function boolean(): ConstraintBuilder;
798
+ /** any() —— 无约束;formatConstraint / draft import 与显示同源 */
799
+ declare function any(): ConstraintBuilder;
697
800
  /** array(item) —— 数组,元素满足 item */
698
801
  declare function array(item: NudoConstraint | ConstraintBuilder): ConstraintBuilder;
699
802
  /**
@@ -865,11 +968,15 @@ declare function takeInterfaceDiagsSince(since: number): InterfaceDiag[];
865
968
  /** 有效契约来源:手写(源码 refine ∪ 侧车手写绑定)> 生成段 > 隐式 */
866
969
  type InterfaceSource = "handwritten" | "generated" | "implicit";
867
970
  /**
868
- * 源文件本地 named export 表:收集本文件声明并导出的名字——
869
- * `export function/const/let/var/class` 声明形式,以及本地列表
870
- * `export { x }` / `export { local as exported }`(按**导出名**绑定,
871
- * 与侧车同名自动绑定口径一致)。
872
- * 排除 re-export(`export {x} from` / `export *`)与 `export default`。
971
+ * 源文件本地导出名表(侧车自动绑定边界):
972
+ * - ESM:`export function/const/let/var/class` 与本地 `export { x }` /
973
+ * `export { local as exported }`(按**导出名**绑定);
974
+ * - `export default function add` / `const add = …; export default add`:
975
+ * 按**本地名** `add` 绑定(侧车可 `export const add = fn(…)`);
976
+ * 同时登记 `"default"`,供侧车 `export default fn(…)` 对齐;
977
+ * - CJS(C4.3):`module.exports = { a, b }`、`module.exports.a = …`、
978
+ * `exports.a = …`、`module.exports = localFn`(登记 localFn 名)。
979
+ * 排除 re-export(`export {x} from` / `export *`)。
873
980
  */
874
981
  declare function localNamedExports(source: string): Set<string>;
875
982
  /**
@@ -917,10 +1024,109 @@ declare function effectiveInterface(source: string, fnName: string, opts?: Effec
917
1024
  declare function sidecarClosureFingerprint(fromFile: string, opts: EffectiveInterfaceOpts): string | undefined;
918
1025
  /** 组合式显示:重建构建器调用形态(number().gt(0) / union(…) / fn(…)) */
919
1026
  declare function formatConstraint(c: NudoConstraint): string;
1027
+ /** EffectiveInterface → 契约展示串(与 CLI interface 打印同口径,不含函数名) */
1028
+ declare function formatEffectiveInterfaceDisplay(eff: EffectiveInterface): string;
1029
+ /** CodeLens / hover 首行标题(design-refine-derivation §8):`● interface / <source>` */
1030
+ declare function formatInterfaceTierLine(source: InterfaceSource): string;
1031
+ type InterfaceTierInfo = {
1032
+ source: InterfaceSource;
1033
+ /** handwritten/generated 时的契约展示;implicit 为 undefined */
1034
+ display?: string;
1035
+ };
1036
+ type InterfaceTierOpts = EffectiveInterfaceOpts;
1037
+ /**
1038
+ * interface 档单一读取口(A7):CodeLens `● interface`、hover、inlay、
1039
+ * semantic tokens 共用本函数,保证「同源」。
1040
+ *
1041
+ * 与 computeInterfaceLenses 同口径:仅源文件 **本地 named export** 进档;
1042
+ * 私有名 / 非导出 → undefined(不进 interface 档,不假装 implicit 契约)。
1043
+ */
1044
+ declare function interfaceTierOf(source: string, fnName: string, fromFile: string, opts?: InterfaceTierOpts): InterfaceTierInfo | undefined;
1045
+ /** interfaceTierOf 的来源投影;非导出 → undefined */
1046
+ declare function interfaceSourceOf(source: string, fnName: string, fromFile: string, opts?: InterfaceTierOpts): InterfaceSource | undefined;
1047
+
1048
+ /**
1049
+ * C4.1:函数形参表面(contract surface)——
1050
+ * 侧车 `fn({…})` / `@nudo:refine` 参数名与求值形参的对齐基线。
1051
+ *
1052
+ * - Identifier / 默认参(AssignmentPattern left)→ 绑定名
1053
+ * - RestElement → 契约名用裸名(`args`),展示名 `...args`
1054
+ * - ObjectPattern / ArrayPattern → 求值占位 `_p{i}`;契约面 = 顶层绑定名
1055
+ * (对象属性 / 数组元素 Identifier)。嵌套 pattern 的绑定名标 `nested`,
1056
+ * 消费方可显式降级(C4.5 param-mismatch / 不执法)。
1057
+ */
1058
+ type FormalParam = {
1059
+ kind: "id";
1060
+ name: string;
1061
+ index: number;
1062
+ } | {
1063
+ kind: "default";
1064
+ name: string;
1065
+ index: number;
1066
+ } | {
1067
+ kind: "rest";
1068
+ name: string;
1069
+ display: string;
1070
+ index: number;
1071
+ } | {
1072
+ kind: "pattern";
1073
+ /** 求值/签名占位名(generalize 与 dts 用) */
1074
+ placeholder: string;
1075
+ /** 顶层可表达绑定名(侧车契约面) */
1076
+ bound: string[];
1077
+ /**
1078
+ * 契约名 → 对象属性键。rename `{a: b}` 时契约可写 a 或 b,
1079
+ * 投影必须用属性键 a(Abs 对象只有 slot a)。
1080
+ */
1081
+ propKey: Record<string, string>;
1082
+ /** 仅嵌套内出现、顶层不可单独表达的名(降级用) */
1083
+ nested: string[];
1084
+ index: number;
1085
+ };
1086
+ type AstParam = {
1087
+ type: string;
1088
+ name?: string;
1089
+ left?: AstParam;
1090
+ right?: unknown;
1091
+ argument?: AstParam;
1092
+ properties?: Array<{
1093
+ key?: AstParam;
1094
+ value?: AstParam;
1095
+ type?: string;
1096
+ argument?: AstParam;
1097
+ }>;
1098
+ elements?: Array<AstParam | null | undefined>;
1099
+ };
1100
+ declare function formalParamsFromNodes(params: AstParam[] | undefined | null): FormalParam[];
1101
+ /** 求值/签名用形参名(与 analyzer extractParamNames / dts 对齐) */
1102
+ declare function formalParamDisplayNames(formals: FormalParam[]): string[];
1103
+ /** 侧车契约可绑定的参数名全集 */
1104
+ declare function contractParamNameSet(formals: FormalParam[]): Set<string>;
1105
+ /**
1106
+ * 契约参数名 → 形参定位。
1107
+ * - 命中 id/default/rest → 该 index(执法按整参)
1108
+ * - 命中 pattern 顶层 bound 名 → 该 pattern index + field
1109
+ * - 命中 placeholder / `_` → pattern index(整对象)
1110
+ * - 未命中 → undefined(C4.5 param-mismatch)
1111
+ */
1112
+ declare function locateContractParam(formals: FormalParam[], contractName: string): {
1113
+ index: number;
1114
+ field?: string;
1115
+ rest?: boolean;
1116
+ } | undefined;
920
1117
 
921
1118
  type LoadDepsFingerprint = {
922
1119
  fp: string;
923
1120
  paths: string[];
1121
+ /**
1122
+ * path + loadModule-resolved content(miss → null)。调用方(磁盘缓存键)
1123
+ * 必须优先用这里的 content,不得回读磁盘——否则 buffer-aware loadModule
1124
+ * 与磁盘不一致时键会分叉。
1125
+ */
1126
+ contents: Array<{
1127
+ path: string;
1128
+ content: string | null;
1129
+ }>;
924
1130
  /** BFS 撞到节点上限:剩余 dep 未进指纹,键不可信 */
925
1131
  truncated: boolean;
926
1132
  };
@@ -958,6 +1164,8 @@ declare function getGeneralizeMemoSize(): number;
958
1164
  * 返回删除的条目数。路径需与 generalize 时 resolveDepPath 形态一致(建议先 norm)。
959
1165
  */
960
1166
  declare function evictGeneralizeMemoForPaths(paths: string[]): number;
1167
+ /** 公开:收集 Abs 自由 term 变元(dts 泛型投影 / α 作用域判定复用 L2 基建)。 */
1168
+ declare function collectAbsFreeVars(a: Abs): Set<string>;
961
1169
  type TypeParam = {
962
1170
  id: string;
963
1171
  value: Abs;
@@ -974,6 +1182,11 @@ type PolyFn = {
974
1182
  param: string;
975
1183
  pred: Pred;
976
1184
  }>;
1185
+ /**
1186
+ * 形参表面(C4.1):默认/rest/解构的契约可绑定名。
1187
+ * 与 params(求值展示名)并列;检查/侧车匹配走 formals。
1188
+ */
1189
+ formals?: FormalParam[];
977
1190
  /**
978
1191
  * 函数形参的符号外延(与 typeParams 同 α 空间)。
979
1192
  * symbolic 一次跑正常结束时从 env 快照拷出;instantiate 重跑不写。
@@ -996,6 +1209,7 @@ declare function extractFn(source: string, fnName: string, fileAst?: ReturnType<
996
1209
  params: string[];
997
1210
  body: Node;
998
1211
  env: AstEnv;
1212
+ formals: FormalParam[];
999
1213
  } | undefined;
1000
1214
  declare function generalizeFromAst(fnName: string, source: string, opts?: {
1001
1215
  budget?: LeakBudget;
@@ -1356,7 +1570,12 @@ declare function literalMeetsConstraint(lv: number | string | boolean | null, c:
1356
1570
  *
1357
1571
  * 参数侧只展示显式 `@nudo:refine` 契约(entryReqs)——
1358
1572
  * 不从函数体 `if` 反推前置条件(那是控制流,不是对外契约)。
1573
+ *
1574
+ * A7(design-refine-derivation §8):default 走 symbolic + entryReqs;
1575
+ * 与 CodeLens `● interface` 同源——interfaceTierOf 标注来源;
1576
+ * implicit 导出的返回 inlay 标明 `derived`(展示档,非义务契约)。
1359
1577
  */
1578
+
1360
1579
  type AbsInlay = {
1361
1580
  /** 1-based 行号 */
1362
1581
  line: number;
@@ -1364,16 +1583,22 @@ type AbsInlay = {
1364
1583
  character: number;
1365
1584
  label: string;
1366
1585
  kind: "type" | "parameter";
1586
+ /** interface 档来源(与 CodeLens `● interface` 同源);非导出缺省 */
1587
+ interfaceSource?: InterfaceSource;
1588
+ /** true = 隐式推导展示(非义务契约),label 已带 `· derived` */
1589
+ derived?: boolean;
1590
+ };
1591
+ type CollectAbsInlaysOpts = InterfaceTierOpts & {
1592
+ loadModule?: (spec: string, fromFile: string) => string | undefined;
1593
+ fromFile?: string;
1367
1594
  };
1368
1595
  /**
1369
1596
  * 收集源码中函数签名的 Abs inlay:
1370
- * - 参数后:仅 `@nudo:refine` 声明的前置契约
1597
+ * - 参数后:仅 `@nudo:refine` / 侧车显式契约(entryReqs)
1371
1598
  * - `{` 前:返回计算形(`x | x * 2`),无 term 时退回 shape
1599
+ * - interface 档:导出函数带 `interfaceSource`;implicit 返回标 `derived`
1372
1600
  */
1373
- declare function collectAbsInlays(source: string, refineOpts?: {
1374
- loadModule?: (spec: string, fromFile: string) => string | undefined;
1375
- fromFile?: string;
1376
- }): AbsInlay[];
1601
+ declare function collectAbsInlays(source: string, opts?: CollectAbsInlaysOpts): AbsInlay[];
1377
1602
 
1378
1603
  /**
1379
1604
  * 指称:Abs → 运行时谓词(设计 §2.7)。
@@ -1568,4 +1793,4 @@ type InjectedDomainEvidenceOpts = {
1568
1793
  */
1569
1794
  declare function checkInjectedDomainEvidence(fnName: string, source: string, records: InjectedDomainRecord[], opts: InjectedDomainEvidenceOpts): CheckIssue[];
1570
1795
 
1571
- export { Abs, type AbsAssignRecord, type AbsCallRecord, type AbsFnImpl, type AbsInlay, AbsModuleExports, type AbsSigImpl, type ArgDerivation, AstEnv, type CheckIssue, type CheckJson, type CheckOptions, type CheckReport, type ClassDef, Confidence, type ConstraintBuilder, type DerivationNode, type Diagnostic, type EffectiveInterface, type EffectiveInterfaceOpts, type Environment, type EvalOptions, type EvalResult, type FnAbs, type FnFp, type FormatOptions, HofSite, type InjectedDomainRecord, type InterfaceDiag, type InterfaceSource, type LeakBudget, type LeqResult, type LoadDepsFingerprint, MAX_CALL_DEPTH, MAX_TOTAL_CALLS, type MethodDef, type MockHelper, type NamedImport, type NudoConstraint, type NudoField, type NudoFnConstraint, NudoSidecarError, type NudoSig, type ObjShape, Phi, type PolyFn, Pred, PrimName, type RefineDiag, type RefineEntry, type RefineResolveOpts, RelSource, SELF, Shape, type Slot, type TemplateMeta, type TemplatePartDesc, type TemplatePartView, type TemplatePredicateDecision, Term, type TypeParam, abortDerivationSession, absFunction, absShapeKey, absTemplateViews, absToConstraint, add, allFixedTextOfViews, analyzeFn, analyzeFnFull, applyAbsFn, array, attachFnImpl, awaitAbs, beginDerivationSession, boolean, buildArgsFromAssume, callAbsMethod, callFunction, callFunctionFull, canSkipLiteralCallScan, checkArg, checkCall, checkInjectedDomainEvidence, checkSource, classFromMethods, cmp, coerceAsyncReturn, collectAbsInlays, collectAbsNodeTypes, concatString, constraintToEntryAbs, createEnvironment, createTemplateAbs, currentPhi, decideEndsWith, decideIncludes, decideStartsWith, defaultLeakBudget, defineClass, definitelyNotNullishShape, denoteGuard, derivationChain, describePhi, div, effectiveInterface, emptyEnv, endDerivationSession, evalArrayStatic, evalBuiltinInstanceMethod, evalBuiltinNew, evalDateCtor, evalDateMethod, evalDateStatic, evalGlobalFn, evalJsonMethod, evalMathMethod, evalMethodBody, evalNamespaceCall, evalNode, evalNumberStatic, evalObjectMethod, evalProgramAbs, evalPromiseCtor, evalPromiseStatic, evalRegExpCtor, evalRegExpMethod, evalSource, evictCheckSourceMemoForPaths, evictGeneralizeMemoForPaths, exceedsBudget, execNudoModule, extractAllLoadSpecs, extractFn, extractNudoImports, extractRefineReturnFromSource, extractRefinesFromSource, falseConstraint, findAbsAtPosition, fixedLengthOfViews, fn, fnConstraintToEntryReqs, fnFingerprints, fnOf, formatAbs, formatAbsMultiline, formatCheckReport, formatConstraint, formatDiagnostics, formatShape, formatShapeSlot, formatTemplateNameViews, generalizeAll, generalizeFromAst, generalizeSourceKeyPart, generatedExportNames, getAbsProperty, getClass, getClassChain, getDerivation, getFnImpl, getFnNameAndBodies, getGeneralizeMemoSize, getParseSourceCacheSize, getSlot, getTerm, hasDerivationSession, hashSource, instanceOf, instantiateClass, instantiateConstraint, interfaceDiagCount, isIntFlag, isNodeModulesPath, isNudoConstraint, isNullishLitAbs, isObj, isTemplateLike, joinAbs, joinFunctions, joinObjects, joinThenProject, joinValues, knownPrefixOfViews, knownSuffixOfViews, leakIfNeeded, lenTerm, leqAbs, listFunctionNames, literalMeetsConstraint, loadModuleDepsFingerprint, localNamedExports, lookupMethod, lookupMethodWithOwner, lookupSuperMethod, makeSum, matchRelIdentLit, maybeLeak, mergeAdjacentFixedViews, mock, mod, mul, negAbs, normPath, notAbs, noteDerivationAdd, noteDerivationJoin, number, objOf, omit, parseSource, partial, pick, popPhi, projectBrand, projectDerivationDsl, pushPhi, refineAbsForRelTrue, refineDiagCount, refineToIndexedFull, relationFingerprint, relationFn, resetAbsCallBudget, resetCheckSourceMemo, resetFnFpCache, resetGeneralizeMemo, resetHashSourceCache, resetLeakCounter, resetNudoModuleExecCache, resetParseSourceCache, resetPhi, resolveDepPath, serializeCheckJson, setAbsAssignCollector, setAbsCallCollector, setAbsNodeCollector, setAbsTruncationCollector, setDerivation, setDerivationCollector, setInterfaceDiagCollector, setRefineDiagCollector, shape, shapeOnlyFn, sidecarClosureFingerprint, sidecarPathOf, sidecarSpecsOf, spread, spy, stableAnalyzeKeySource, strictEqAbs, string, stripTypes, stub, sub, superNameOf, tagDerivationRoot, takeInterfaceDiags, takeInterfaceDiagsSince, takeRefineDiags, takeRefineDiagsSince, templateMatchesValue, templatePartsOf, termDepth, termKey, termNodes, trueConstraint, typeofAbs, union, viewTemplateParts, withPhiConstraint, withVar, wrapPromise };
1796
+ export { Abs, type AbsAssignRecord, type AbsCallRecord, type AbsFnImpl, type AbsInlay, AbsModuleExports, type AbsSigImpl, type ArgDerivation, AstEnv, type CheckIssue, type CheckJson, type CheckOptions, type CheckReport, type ClassDef, type CollectAbsInlaysOpts, Confidence, type ConstraintBuilder, type DerivationNode, type Diagnostic, type EffectiveInterface, type EffectiveInterfaceOpts, type Environment, type EvalOptions, type EvalResult, type FnAbs, type FnFp, type FormalParam, type FormatOptions, HofSite, type InjectedDomainRecord, type InterfaceDiag, type InterfaceSource, type InterfaceTierInfo, type InterfaceTierOpts, type LeakBudget, type LeqResult, type LoadDepsFingerprint, MAX_CALL_DEPTH, MAX_TOTAL_CALLS, type MethodDef, type MockHelper, type NamedImport, type NudoConstraint, type NudoField, type NudoFnConstraint, NudoSidecarError, type NudoSig, type ObjShape, Phi, type PolyFn, Pred, PrimName, type RefineDiag, type RefineEntry, type RefineResolveOpts, RelSource, SELF, Shape, type Slot, type TemplateMeta, type TemplatePartDesc, type TemplatePartView, type TemplatePredicateDecision, Term, type TypeParam, abortDerivationSession, absFunction, absShapeKey, absTemplateViews, absToConstraint, add, allFixedTextOfViews, analyzeFn, analyzeFnFull, any, applyAbsFn, array, attachFnImpl, awaitAbs, beginCollectionFork, beginDerivationSession, boolean, buildArgsFromAssume, callAbsMethod, callFunction, callFunctionFull, canSkipLiteralCallScan, checkArg, checkCall, checkInjectedDomainEvidence, checkSource, classFromMethods, clearCollectionTables, cmp, coerceAsyncReturn, collectAbsFreeVars, collectAbsInlays, collectAbsNodeTypes, collectionElementJoin, collectionExactLen, concatString, constraintToEntryAbs, contractParamNameSet, createEnvironment, createTemplateAbs, currentPhi, decideEndsWith, decideIncludes, decideStartsWith, defaultLeakBudget, defineClass, definitelyNotNullishShape, denoteGuard, derivationChain, describePhi, div, effectiveInterface, emptyEnv, endCollectionFork, endDerivationSession, errorBrandAbs, evalArrayStatic, evalBuiltinInstanceMethod, evalBuiltinNew, evalDateCtor, evalDateMethod, evalDateStatic, evalGlobalFn, evalJsonMethod, evalMathMethod, evalMethodBody, evalNamespaceCall, evalNode, evalNumberStatic, evalObjectMethod, evalProgramAbs, evalPromiseCtor, evalPromiseStatic, evalRegExpCtor, evalRegExpMethod, evalSource, evictCheckSourceMemoForPaths, evictGeneralizeMemoForPaths, exceedsBudget, execNudoModule, extractAllLoadSpecs, extractFn, extractNudoImports, extractRefineReturnFromSource, extractRefinesFromSource, falseConstraint, findAbsAtPosition, fixedLengthOfViews, fn, fnConstraintToEntryReqs, fnFingerprints, fnOf, formalParamDisplayNames, formalParamsFromNodes, formatAbs, formatAbsMultiline, formatCheckReport, formatConstraint, formatDiagnostics, formatEffectiveInterfaceDisplay, formatInterfaceTierLine, formatShape, formatShapeSlot, formatTemplateNameViews, generalizeAll, generalizeFromAst, generalizeSourceKeyPart, generatedExportNames, getAbsProperty, getClass, getClassChain, getDerivation, getFnImpl, getFnNameAndBodies, getGeneralizeMemoSize, getParseSourceCacheSize, getSlot, getTerm, hasDerivationSession, hashSource, instanceOf, instantiateClass, instantiateConstraint, interfaceDiagCount, interfaceSourceOf, interfaceTierOf, isErrorCtorName, isIntFlag, isMapAbs, isNodeModulesPath, isNudoConstraint, isNullishLitAbs, isObj, isSetAbs, isTemplateLike, joinAbs, joinFunctions, joinObjects, joinThenProject, joinValues, knownPrefixOfViews, knownSuffixOfViews, leakIfNeeded, lenTerm, leqAbs, listFunctionNames, literalMeetsConstraint, loadModuleDepsFingerprint, localNamedExports, locateContractParam, lookupMethod, lookupMethodWithOwner, lookupSuperMethod, looseEqAbs, makeMapAbs, makeSetAbs, makeSum, mapClearEntries, mapDeleteEntry, mapEntriesAbs, mapGetEntry, mapHasEntry, mapSetEntry, mapSizeAbs, mapValuesAbs, matchRelIdentLit, maybeLeak, mergeAdjacentFixedViews, mergeCollectionArms, mock, mod, mul, negAbs, normPath, notAbs, noteCollectionWrite, noteDerivationAdd, noteDerivationJoin, number, objOf, omit, parseSource, partial, pick, popCollectionArm, popPhi, projectBrand, projectDerivationDsl, pushCollectionArm, pushPhi, refineAbsForRelTrue, refineDiagCount, refineToIndexedFull, relationFingerprint, relationFn, resetAbsCallBudget, resetCheckSourceMemo, resetFnFpCache, resetGeneralizeMemo, resetHashSourceCache, resetLeakCounter, resetNudoModuleExecCache, resetParseSourceCache, resetPhi, resolveDepPath, serializeCheckJson, setAbsAssignCollector, setAbsCallCollector, setAbsNodeCollector, setAbsTruncationCollector, setAddEntry, setClearEntries, setDeleteEntry, setDerivation, setDerivationCollector, setElementsAbs, setHasEntry, setInterfaceDiagCollector, setRefineDiagCollector, setSizeAbs, shape, shapeOnlyFn, sidecarClosureFingerprint, sidecarPathOf, sidecarSpecsOf, spread, spy, stableAnalyzeKeySource, strictEqAbs, string, stripTypes, stub, sub, superNameOf, tagDerivationRoot, takeInterfaceDiags, takeInterfaceDiagsSince, takeRefineDiags, takeRefineDiagsSince, templateMatchesValue, templatePartsOf, termDepth, termKey, termNodes, trueConstraint, typeofAbs, union, viewTemplateParts, withPhiConstraint, withVar, wrapPromise };