@llm4ts/flow 2.37.0 → 2.38.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/Survey.d.ts CHANGED
@@ -1,30 +1,113 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import * as Schema from "effect/Schema";
3
+ import { PlanParseError } from "./FlowError.ts";
4
+ import { type GraphRules } from "./GraphRules.ts";
3
5
  import type { CoverageRule } from "./SpecChecks.ts";
4
6
  import type { WorkspaceError, WorkspaceShape } from "./Workspace.ts";
7
+ export declare const GraphOrigin: Schema.Literals<readonly ["scanner", "llm", "external"]>;
8
+ export type GraphOrigin = typeof GraphOrigin.Type;
9
+ export declare const GraphConfidence: Schema.Literals<readonly ["exact", "inferred"]>;
10
+ export type GraphConfidence = typeof GraphConfidence.Type;
11
+ export declare const GraphMechanism: Schema.Literals<readonly ["capture", "join:exact", "join:url", "contraction", "llm", "codegraph"]>;
12
+ export type GraphMechanism = typeof GraphMechanism.Type;
13
+ export declare const JoinMatch: Schema.Literals<readonly ["exact", "prefix", "extension"]>;
14
+ export type JoinMatch = typeof JoinMatch.Type;
15
+ declare const GraphEvidence_base: Schema.Class<GraphEvidence, Schema.Struct<{
16
+ readonly file: Schema.String;
17
+ readonly line: Schema.Int;
18
+ readonly snippet: Schema.String;
19
+ }>, {}>;
20
+ export declare class GraphEvidence extends GraphEvidence_base {
21
+ }
5
22
  declare const SurveyNode_base: Schema.Class<SurveyNode, Schema.Struct<{
6
23
  readonly path: Schema.String;
7
24
  readonly name: Schema.String;
8
25
  readonly lines: Schema.Int;
9
26
  readonly units: Schema.Int;
27
+ readonly id: Schema.optionalKey<Schema.String>;
28
+ readonly kind: Schema.optionalKey<Schema.String>;
29
+ readonly label: Schema.optionalKey<Schema.String>;
30
+ readonly lineStart: Schema.optionalKey<Schema.Int>;
31
+ readonly lineEnd: Schema.optionalKey<Schema.Int>;
32
+ readonly attrs: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
33
+ readonly origin: Schema.optionalKey<Schema.Literals<readonly ["scanner", "llm", "external"]>>;
34
+ /** A wiring record (a `web.xml` mapping), not a unit: contracted by the file projection. */
35
+ readonly descriptor: Schema.optionalKey<Schema.Boolean>;
36
+ /** The attr naming the unit this node stands for (a declaration's class). */
37
+ readonly anchor: Schema.optionalKey<Schema.String>;
10
38
  }>, {}>;
39
+ /**
40
+ * A node of the estate graph. The four original fields describe a FILE node;
41
+ * the ADR 0030 fields are optional on the wire so a pre-0030 `graph.json`
42
+ * decodes and the four-field constructor keeps compiling — read them through
43
+ * `nodeId`, `nodeKind` and the other helpers below, never directly.
44
+ */
11
45
  export declare class SurveyNode extends SurveyNode_base {
12
46
  }
13
47
  declare const SurveyEdge_base: Schema.Class<SurveyEdge, Schema.Struct<{
14
48
  readonly from: Schema.String;
15
49
  readonly to: Schema.String;
16
50
  readonly kind: Schema.String;
51
+ readonly origin: Schema.optionalKey<Schema.Literals<readonly ["scanner", "llm", "external"]>>;
52
+ readonly confidence: Schema.optionalKey<Schema.Literals<readonly ["exact", "inferred"]>>;
53
+ /** The pack section that produced the edge. */
54
+ readonly rule: Schema.optionalKey<Schema.String>;
55
+ readonly mechanism: Schema.optionalKey<Schema.Literals<readonly ["capture", "join:exact", "join:url", "contraction", "llm", "codegraph"]>>;
56
+ readonly join: Schema.optionalKey<Schema.Literals<readonly ["exact", "prefix", "extension"]>>;
57
+ readonly evidence: Schema.optionalKey<typeof GraphEvidence>;
17
58
  }>, {}>;
18
59
  export declare class SurveyEdge extends SurveyEdge_base {
19
60
  }
61
+ export declare const UnresolvedReason: Schema.Literals<readonly ["edge-target", "missing-attr", "join-from", "join-to", "isolated"]>;
62
+ export type UnresolvedReason = typeof UnresolvedReason.Type;
63
+ declare const Unresolved_base: Schema.Class<Unresolved, Schema.Struct<{
64
+ readonly reason: Schema.Literals<readonly ["edge-target", "missing-attr", "join-from", "join-to", "isolated"]>;
65
+ readonly rule: Schema.String;
66
+ readonly node: Schema.String;
67
+ readonly reference: Schema.optionalKey<Schema.String>;
68
+ readonly file: Schema.String;
69
+ readonly line: Schema.Int;
70
+ }>, {}>;
71
+ export declare class Unresolved extends Unresolved_base {
72
+ }
73
+ declare const Fill_base: Schema.Class<Fill, Schema.Struct<{
74
+ readonly node: Schema.String;
75
+ readonly key: Schema.String;
76
+ readonly value: Schema.String;
77
+ readonly evidence: typeof GraphEvidence;
78
+ }>, {}>;
79
+ /** An attr the LLM pass filled on an existing node, with the line that justifies it. */
80
+ export declare class Fill extends Fill_base {
81
+ }
20
82
  declare const SurveyGraph_base: Schema.Class<SurveyGraph, Schema.Struct<{
21
83
  readonly nodes: Schema.$Array<typeof SurveyNode>;
22
84
  readonly edges: Schema.$Array<typeof SurveyEdge>;
85
+ readonly unresolved: Schema.withConstructorDefault<Schema.withDecodingDefaultKey<Schema.$Array<typeof Unresolved>, never>>;
86
+ readonly fills: Schema.withConstructorDefault<Schema.withDecodingDefaultKey<Schema.$Array<typeof Fill>, never>>;
23
87
  }>, {}>;
24
88
  export declare class SurveyGraph extends SurveyGraph_base {
25
- incoming(name: string): ReadonlyArray<SurveyEdge>;
26
- outgoing(name: string): ReadonlyArray<SurveyEdge>;
89
+ incoming(id: string): ReadonlyArray<SurveyEdge>;
90
+ outgoing(id: string): ReadonlyArray<SurveyEdge>;
91
+ node(id: string): SurveyNode | undefined;
27
92
  }
93
+ export declare const nodeId: (node: SurveyNode) => string;
94
+ export declare const nodeKind: (node: SurveyNode) => string;
95
+ export declare const nodeLabel: (node: SurveyNode) => string;
96
+ export declare const nodeAttrs: (node: SurveyNode) => Readonly<Record<string, string>>;
97
+ export declare const nodeLineStart: (node: SurveyNode) => number;
98
+ export declare const nodeLineEnd: (node: SurveyNode) => number;
99
+ export declare const isDescriptor: (node: SurveyNode) => boolean;
100
+ export declare const edgeOrigin: (edge: SurveyEdge) => GraphOrigin;
101
+ export declare const edgeConfidence: (edge: SurveyEdge) => GraphConfidence;
102
+ /**
103
+ * The file-level view every pre-ADR-0030 consumer expects. Each node folds onto
104
+ * a unit (its `anchor` attr when that names a known unit, else its file's
105
+ * unit); descriptor nodes with outgoing edges are contracted (`a → d → b`
106
+ * becomes `a → b` under `a → d`'s kind); self loops drop; duplicates by
107
+ * (from, to, kind) drop. On a file-only graph this is the identity.
108
+ */
109
+ export declare const projectToFiles: (graph: SurveyGraph) => SurveyGraph;
110
+ export declare const graphFromJson: (text: string) => Effect.Effect<SurveyGraph, PlanParseError>;
28
111
  /**
29
112
  * The transitive dependency closure of `program` as repo-relative paths,
30
113
  * breadth-first, excluding the program itself. The `seen` set is required, not
@@ -54,9 +137,35 @@ export interface SurveyGraphOptions {
54
137
  /** Regex over repo-relative paths to leave out even when `sources` matches. */
55
138
  readonly exclude?: string;
56
139
  }
140
+ export interface CodeGraphOptions {
141
+ readonly sources: string;
142
+ readonly exclude?: string;
143
+ readonly coverage: ReadonlyArray<CoverageRule>;
144
+ readonly rules: GraphRules;
145
+ }
146
+ export interface CodeGraphBuild {
147
+ readonly graph: SurveyGraph;
148
+ /** path → sha256 of the scanned contents; the cache's staleness key. */
149
+ readonly files: Readonly<Record<string, string>>;
150
+ }
151
+ /** Nodes and captured edges only; joins and the unresolved summary come from `applyFillsAndJoins`. */
152
+ export declare const scanGraph: (paths: ReadonlyArray<string>, contents: ReadonlyMap<string, string>, options: CodeGraphOptions) => SurveyGraph;
153
+ /** Directories `D` with some scanned path under `D/WEB-INF/`, sorted; the per-app scope of url joins. */
154
+ export declare const appRoots: (paths: ReadonlyArray<string>) => ReadonlyArray<string>;
155
+ /** The longest app root that prefixes `path`, or "" for the estate scope. */
156
+ export declare const appOf: (path: string, roots: ReadonlyArray<string>) => string;
157
+ /**
158
+ * Pure re-derivation: every `join:*` edge is dropped and rebuilt from the
159
+ * current attrs plus `fills`; `unresolved` is recomputed from scratch except
160
+ * for `edge-target` entries, which only the scanner knows. `paths` defaults
161
+ * to the node paths; pass the scanned list to compute app roots precisely.
162
+ */
163
+ export declare const applyFillsAndJoins: (graph: SurveyGraph, fills: ReadonlyArray<Fill>, rules: GraphRules, paths?: ReadonlyArray<string>) => SurveyGraph;
164
+ export declare const buildCodeGraph: (workspace: WorkspaceShape, options: CodeGraphOptions) => Effect.Effect<CodeGraphBuild, WorkspaceError, never>;
165
+ /** The pre-ADR-0030 entry: Survey rules only, file nodes only. Delegates to `buildCodeGraph`. */
57
166
  export declare const surveyGraph: (workspace: WorkspaceShape, sources: string, units: readonly CoverageRule[], edgeRules: readonly CoverageRule[], options?: SurveyGraphOptions | undefined) => Effect.Effect<SurveyGraph, WorkspaceError, never>;
58
167
  export declare const mergeSurveyEdges: (graph: SurveyGraph, refined: ReadonlyArray<SurveyEdge>) => SurveyGraph;
59
- export declare const renderSurveyInventory: (graph: SurveyGraph) => string;
168
+ export declare const renderSurveyInventory: (full: SurveyGraph) => string;
60
169
  /** The `graph.json` artifact: the graph as it is read back by later phases. */
61
170
  export declare const renderSurveyGraphJson: (graph: SurveyGraph) => string;
62
171
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Survey.d.ts","sourceRoot":"","sources":["../src/Survey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;;;;;;;AAEpE,qBAAa,UAAW,SAAQ,eAK9B;CAAG;;;;;;AAEL,qBAAa,UAAW,SAAQ,eAI9B;CAAG;;;;;AAEL,qBAAa,WAAY,SAAQ,gBAG/B;IACA,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC;IAIjD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC;CAGlD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACrB,OAA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