wabachi 0.1.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.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +84 -0
  3. package/dist/architecture/canon/authority.d.ts +35 -0
  4. package/dist/architecture/canon/authority.js +76 -0
  5. package/dist/architecture/canon/authority.js.map +1 -0
  6. package/dist/architecture/canon/boundaries.d.ts +31 -0
  7. package/dist/architecture/canon/boundaries.js +73 -0
  8. package/dist/architecture/canon/boundaries.js.map +1 -0
  9. package/dist/architecture/canon/codec.d.ts +10 -0
  10. package/dist/architecture/canon/codec.js +516 -0
  11. package/dist/architecture/canon/codec.js.map +1 -0
  12. package/dist/architecture/canon/constraints.d.ts +60 -0
  13. package/dist/architecture/canon/constraints.js +116 -0
  14. package/dist/architecture/canon/constraints.js.map +1 -0
  15. package/dist/architecture/canon/decisions.d.ts +62 -0
  16. package/dist/architecture/canon/decisions.js +192 -0
  17. package/dist/architecture/canon/decisions.js.map +1 -0
  18. package/dist/architecture/canon/deployment.d.ts +89 -0
  19. package/dist/architecture/canon/deployment.js +156 -0
  20. package/dist/architecture/canon/deployment.js.map +1 -0
  21. package/dist/architecture/canon/document.d.ts +60 -0
  22. package/dist/architecture/canon/document.js +106 -0
  23. package/dist/architecture/canon/document.js.map +1 -0
  24. package/dist/architecture/canon/elements.d.ts +21 -0
  25. package/dist/architecture/canon/elements.js +87 -0
  26. package/dist/architecture/canon/elements.js.map +1 -0
  27. package/dist/architecture/canon/flows.d.ts +37 -0
  28. package/dist/architecture/canon/flows.js +82 -0
  29. package/dist/architecture/canon/flows.js.map +1 -0
  30. package/dist/architecture/canon/identity.d.ts +45 -0
  31. package/dist/architecture/canon/identity.js +83 -0
  32. package/dist/architecture/canon/identity.js.map +1 -0
  33. package/dist/architecture/canon/relationships.d.ts +48 -0
  34. package/dist/architecture/canon/relationships.js +181 -0
  35. package/dist/architecture/canon/relationships.js.map +1 -0
  36. package/dist/architecture/canon/repository-mappings.d.ts +51 -0
  37. package/dist/architecture/canon/repository-mappings.js +134 -0
  38. package/dist/architecture/canon/repository-mappings.js.map +1 -0
  39. package/dist/architecture/canon/responsibilities.d.ts +40 -0
  40. package/dist/architecture/canon/responsibilities.js +89 -0
  41. package/dist/architecture/canon/responsibilities.js.map +1 -0
  42. package/dist/architecture/canon/validate.d.ts +14 -0
  43. package/dist/architecture/canon/validate.js +389 -0
  44. package/dist/architecture/canon/validate.js.map +1 -0
  45. package/dist/architecture/canon/views.d.ts +101 -0
  46. package/dist/architecture/canon/views.js +182 -0
  47. package/dist/architecture/canon/views.js.map +1 -0
  48. package/dist/architecture/cli.d.ts +2 -0
  49. package/dist/architecture/cli.js +158 -0
  50. package/dist/architecture/cli.js.map +1 -0
  51. package/dist/architecture/documentation/html.d.ts +3 -0
  52. package/dist/architecture/documentation/html.js +143 -0
  53. package/dist/architecture/documentation/html.js.map +1 -0
  54. package/dist/architecture/documentation/model.d.ts +46 -0
  55. package/dist/architecture/documentation/model.js +13 -0
  56. package/dist/architecture/documentation/model.js.map +1 -0
  57. package/dist/architecture/documentation/project.d.ts +4 -0
  58. package/dist/architecture/documentation/project.js +166 -0
  59. package/dist/architecture/documentation/project.js.map +1 -0
  60. package/dist/architecture/documentation/site.d.ts +43 -0
  61. package/dist/architecture/documentation/site.js +147 -0
  62. package/dist/architecture/documentation/site.js.map +1 -0
  63. package/dist/architecture/projection/structurizr-export.d.ts +65 -0
  64. package/dist/architecture/projection/structurizr-export.js +136 -0
  65. package/dist/architecture/projection/structurizr-export.js.map +1 -0
  66. package/dist/architecture/projection/structurizr.d.ts +34 -0
  67. package/dist/architecture/projection/structurizr.js +667 -0
  68. package/dist/architecture/projection/structurizr.js.map +1 -0
  69. package/dist/cli.d.ts +1 -0
  70. package/dist/cli.js +143 -0
  71. package/dist/cli.js.map +1 -0
  72. package/dist/index.d.ts +2 -0
  73. package/dist/index.js +6 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/runtime/correlation.d.ts +143 -0
  76. package/dist/runtime/correlation.js +919 -0
  77. package/dist/runtime/correlation.js.map +1 -0
  78. package/dist/runtime/facts.d.ts +138 -0
  79. package/dist/runtime/facts.js +614 -0
  80. package/dist/runtime/facts.js.map +1 -0
  81. package/dist/runtime/fixtureProvider.d.ts +10 -0
  82. package/dist/runtime/fixtureProvider.js +30 -0
  83. package/dist/runtime/fixtureProvider.js.map +1 -0
  84. package/dist/runtime/graftProvider.d.ts +8 -0
  85. package/dist/runtime/graftProvider.js +107 -0
  86. package/dist/runtime/graftProvider.js.map +1 -0
  87. package/dist/runtime/graftWiring.d.ts +30 -0
  88. package/dist/runtime/graftWiring.js +3 -0
  89. package/dist/runtime/graftWiring.js.map +1 -0
  90. package/dist/runtime/manifest.d.ts +17 -0
  91. package/dist/runtime/manifest.js +39 -0
  92. package/dist/runtime/manifest.js.map +1 -0
  93. package/dist/runtime/matrix.d.ts +337 -0
  94. package/dist/runtime/matrix.js +1485 -0
  95. package/dist/runtime/matrix.js.map +1 -0
  96. package/dist/runtime/observation.d.ts +36 -0
  97. package/dist/runtime/observation.js +3 -0
  98. package/dist/runtime/observation.js.map +1 -0
  99. package/dist/runtime/provider.d.ts +34 -0
  100. package/dist/runtime/provider.js +2 -0
  101. package/dist/runtime/provider.js.map +1 -0
  102. package/dist/runtime/repository.d.ts +20 -0
  103. package/dist/runtime/repository.js +55 -0
  104. package/dist/runtime/repository.js.map +1 -0
  105. package/dist/runtime/run.d.ts +21 -0
  106. package/dist/runtime/run.js +80 -0
  107. package/dist/runtime/run.js.map +1 -0
  108. package/dist/runtime/scipProvider.d.ts +11 -0
  109. package/dist/runtime/scipProvider.js +126 -0
  110. package/dist/runtime/scipProvider.js.map +1 -0
  111. package/dist/runtime/typescriptProvider.d.ts +10 -0
  112. package/dist/runtime/typescriptProvider.js +289 -0
  113. package/dist/runtime/typescriptProvider.js.map +1 -0
  114. package/dist/runtime/workflow.d.ts +30 -0
  115. package/dist/runtime/workflow.js +153 -0
  116. package/dist/runtime/workflow.js.map +1 -0
  117. package/package.json +72 -0
@@ -0,0 +1,30 @@
1
+ import { readdir, writeFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ /**
4
+ * Minimal deterministic provider used to exercise the provider contract in
5
+ * tests and as a template for future concrete providers. It writes one raw
6
+ * artifact listing the workspace's top-level entries.
7
+ */
8
+ export function createFixtureProvider(options = {}) {
9
+ const id = options.id ?? "fixture";
10
+ const available = options.available ?? true;
11
+ return {
12
+ identity: { id, version: "0.0.1", determinism: "deterministic" },
13
+ async isAvailable() {
14
+ return available;
15
+ },
16
+ async execute(context) {
17
+ const startedAt = new Date().toISOString();
18
+ const entries = await readdir(context.workspaceRoot);
19
+ const artifactRelativePath = "entries.json";
20
+ await writeFile(path.join(context.artifactRoot, artifactRelativePath), `${JSON.stringify({ entries }, null, 2)}\n`, "utf8");
21
+ return {
22
+ status: "ok",
23
+ artifacts: [artifactRelativePath],
24
+ startedAt,
25
+ finishedAt: new Date().toISOString(),
26
+ };
27
+ },
28
+ };
29
+ }
30
+ //# sourceMappingURL=fixtureProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtureProvider.js","sourceRoot":"","sources":["../../src/runtime/fixtureProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkE,EAAE;IACxG,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,SAAS,CAAC;IACnC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC;IAE5C,OAAO;QACL,QAAQ,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE;QAChE,KAAK,CAAC,WAAW;YACf,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,OAAwB;YACpC,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAC3C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YAErD,MAAM,oBAAoB,GAAG,cAAc,CAAC;YAC5C,MAAM,SAAS,CACb,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,oBAAoB,CAAC,EACrD,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAC3C,MAAM,CACP,CAAC;YAEF,OAAO;gBACL,MAAM,EAAE,IAAI;gBACZ,SAAS,EAAE,CAAC,oBAAoB,CAAC;gBACjC,SAAS;gBACT,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACrC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Provider } from "./provider.js";
2
+ export interface GraftProviderOptions {
3
+ /** Override the `graft` executable, e.g. for tests that stub the CLI. */
4
+ readonly binary?: string;
5
+ /** File extensions passed through to `graft build --extensions`. */
6
+ readonly extensions?: readonly string[];
7
+ }
8
+ export declare function createGraftProvider(options?: GraftProviderOptions): Provider;
@@ -0,0 +1,107 @@
1
+ import { execFile } from "node:child_process";
2
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { promisify } from "node:util";
5
+ import { OBSERVATION_SCHEMA_VERSION } from "./observation.js";
6
+ const execFileAsync = promisify(execFile);
7
+ /**
8
+ * Deterministic structural relations `graft build` (without `--deep`) can
9
+ * emit that map onto a common observation predicate. Any edge relation not
10
+ * listed here has no safe common predicate and is only preserved as raw,
11
+ * provider-native evidence in wiring.json rather than forced into the
12
+ * common envelope.
13
+ */
14
+ const RELATION_TO_PREDICATE = {
15
+ calls: "calls",
16
+ imports: "imports",
17
+ extends: "extends",
18
+ implements: "implements",
19
+ references: "references",
20
+ };
21
+ const GRAFT_BINARY = "graft";
22
+ export function createGraftProvider(options = {}) {
23
+ const binary = options.binary ?? GRAFT_BINARY;
24
+ let resolvedVersion = "unknown";
25
+ return {
26
+ get identity() {
27
+ return { id: "graft", version: resolvedVersion, determinism: "deterministic" };
28
+ },
29
+ async isAvailable(_context) {
30
+ try {
31
+ resolvedVersion = await resolveVersion(binary);
32
+ return true;
33
+ }
34
+ catch {
35
+ return false;
36
+ }
37
+ },
38
+ async execute(context) {
39
+ const startedAt = new Date().toISOString();
40
+ const graftDir = path.join(context.artifactRoot, "graft");
41
+ const buildArgs = ["build", context.workspaceRoot, "--dir", graftDir];
42
+ if (options.extensions && options.extensions.length > 0) {
43
+ buildArgs.push("--extensions", ...options.extensions);
44
+ }
45
+ resolvedVersion = await resolveVersion(binary);
46
+ const version = resolvedVersion;
47
+ const invocation = { binary, args: buildArgs, version, deep: false };
48
+ const invocationRelativePath = "invocation.json";
49
+ await writeFile(path.join(context.artifactRoot, invocationRelativePath), `${JSON.stringify(invocation, null, 2)}\n`, "utf8");
50
+ await mkdir(graftDir, { recursive: true });
51
+ await execFileAsync(binary, buildArgs);
52
+ const wiringRelativePath = "graft/.graph/wiring.json";
53
+ const wiring = JSON.parse(await readFile(path.join(context.artifactRoot, wiringRelativePath), "utf8"));
54
+ const identity = { id: "graft", version, determinism: "deterministic" };
55
+ const observations = adaptWiringGraph(wiring, identity, context);
56
+ const observationsRelativePath = "observations.json";
57
+ await writeFile(path.join(context.artifactRoot, observationsRelativePath), `${JSON.stringify(observations, null, 2)}\n`, "utf8");
58
+ return {
59
+ status: "ok",
60
+ artifacts: [invocationRelativePath, wiringRelativePath, observationsRelativePath],
61
+ observationArtifacts: [observationsRelativePath],
62
+ startedAt,
63
+ finishedAt: new Date().toISOString(),
64
+ };
65
+ },
66
+ };
67
+ }
68
+ async function resolveVersion(binary) {
69
+ const { stdout } = await execFileAsync(binary, ["--version"]);
70
+ return stdout.trim();
71
+ }
72
+ /**
73
+ * Adapts Graft's wiring graph into the common observation envelope where a
74
+ * safe predicate mapping exists. Nodes/edges without a safe mapping (e.g.
75
+ * the file-contains-symbol structural edge, or any future Graft-specific
76
+ * relation) are not force-normalized — they remain available only in the
77
+ * raw wiring.json artifact retained alongside these observations.
78
+ */
79
+ function adaptWiringGraph(wiring, provider, context) {
80
+ const nodesById = new Map(wiring.nodes.map((node) => [node.id, node]));
81
+ const observations = [];
82
+ for (const edge of wiring.edges) {
83
+ const predicate = RELATION_TO_PREDICATE[edge.relation];
84
+ if (!predicate)
85
+ continue;
86
+ const sourceNode = nodesById.get(edge.source);
87
+ const targetNode = nodesById.get(edge.target);
88
+ if (!sourceNode || !targetNode)
89
+ continue;
90
+ observations.push(toObservation(edge, sourceNode, targetNode, predicate, provider, context));
91
+ }
92
+ return observations;
93
+ }
94
+ function toObservation(edge, sourceNode, targetNode, predicate, provider, context) {
95
+ return {
96
+ schemaVersion: OBSERVATION_SCHEMA_VERSION,
97
+ subject: { id: sourceNode.id, kind: sourceNode.kind },
98
+ predicate,
99
+ object: { id: targetNode.id, kind: targetNode.kind },
100
+ provider,
101
+ repository: context.repository,
102
+ source: { path: sourceNode.path, span: sourceNode.span ?? undefined },
103
+ determinism: "deterministic",
104
+ providerNative: { node: sourceNode, sourceNode, targetNode, edge },
105
+ };
106
+ }
107
+ //# sourceMappingURL=graftProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graftProvider.js","sourceRoot":"","sources":["../../src/runtime/graftProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,0BAA0B,EAA+C,MAAM,kBAAkB,CAAC;A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B,CAAC;AAED,SAAS,aAAa,CACpB,IAAqB,EACrB,UAA2B,EAC3B,UAA2B,EAC3B,SAA+B,EAC/B,QAAuE,EACvE,OAAwB;IAExB,OAAO;QACL,aAAa,EAAE,0BAA0B;QACzC,OAAO,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE;QACrD,SAAS;QACT,MAAM,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE;QACpD,QAAQ;QACR,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,SAAS,EAAE;QACrE,WAAW,EAAE,eAAe;QAC5B,cAAc,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE;KACnE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ /** Shape of graft/.graph/wiring.json as produced by `graft build` (deterministic, non-`--deep` mode). */
2
+ export interface GraftWiringNode {
3
+ readonly id: string;
4
+ readonly name: string;
5
+ readonly kind: string;
6
+ readonly path: string;
7
+ readonly span: string | null;
8
+ readonly signature: string | null;
9
+ readonly exported: boolean;
10
+ readonly origin: string;
11
+ readonly [key: string]: unknown;
12
+ }
13
+ export interface GraftWiringEdge {
14
+ readonly source: string;
15
+ readonly target: string;
16
+ readonly relation: string;
17
+ readonly confidence: string;
18
+ readonly [key: string]: unknown;
19
+ }
20
+ export interface GraftWiringGraph {
21
+ readonly meta: {
22
+ readonly version: number;
23
+ readonly nodeCount: number;
24
+ readonly edgeCount: number;
25
+ readonly languages: readonly string[];
26
+ readonly [key: string]: unknown;
27
+ };
28
+ readonly nodes: readonly GraftWiringNode[];
29
+ readonly edges: readonly GraftWiringEdge[];
30
+ }
@@ -0,0 +1,3 @@
1
+ /** Shape of graft/.graph/wiring.json as produced by `graft build` (deterministic, non-`--deep` mode). */
2
+ export {};
3
+ //# sourceMappingURL=graftWiring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graftWiring.js","sourceRoot":"","sources":["../../src/runtime/graftWiring.ts"],"names":[],"mappings":"AAAA,yGAAyG"}
@@ -0,0 +1,17 @@
1
+ import type { ProviderExecutionResult, ProviderIdentity, ResolvedRepository } from "./provider.js";
2
+ export interface ManifestProviderEntry {
3
+ readonly identity: ProviderIdentity;
4
+ readonly result: ProviderExecutionResult;
5
+ }
6
+ export interface RunManifest {
7
+ readonly runId: string;
8
+ readonly repository: ResolvedRepository;
9
+ readonly startedAt: string;
10
+ readonly finishedAt: string;
11
+ /** Runtime and command-line tool versions used by the experiment. */
12
+ readonly toolchain: Readonly<Record<string, string>>;
13
+ readonly providers: readonly ManifestProviderEntry[];
14
+ }
15
+ /** Collects versions that are outside an individual provider identity. */
16
+ export declare function collectToolchainVersions(): Promise<Readonly<Record<string, string>>>;
17
+ export declare function writeManifest(runRoot: string, manifest: RunManifest): Promise<string>;
@@ -0,0 +1,39 @@
1
+ import { mkdir, writeFile } from "node:fs/promises";
2
+ import { execFile } from "node:child_process";
3
+ import path from "node:path";
4
+ import { promisify } from "node:util";
5
+ const execFileAsync = promisify(execFile);
6
+ /** Collects versions that are outside an individual provider identity. */
7
+ export async function collectToolchainVersions() {
8
+ const versions = {
9
+ node: process.version,
10
+ platform: `${process.platform}/${process.arch}`,
11
+ };
12
+ for (const [name, command, args] of [
13
+ ["git", "git", ["--version"]],
14
+ ["pnpm", "pnpm", ["--version"]],
15
+ ["tar", "tar", ["--version"]],
16
+ ["graft", "graft", ["--version"]],
17
+ ]) {
18
+ versions[name] = await commandVersion(command, args);
19
+ }
20
+ versions.tsx = await commandVersion("pnpm", ["exec", "tsx", "--version"], process.cwd());
21
+ return versions;
22
+ }
23
+ async function commandVersion(command, args, cwd) {
24
+ try {
25
+ const options = { encoding: "utf8", ...(cwd === undefined ? {} : { cwd }) };
26
+ const { stdout } = await execFileAsync(command, [...args], options);
27
+ return stdout.trim().split("\n")[0] ?? "unknown";
28
+ }
29
+ catch {
30
+ return "unavailable";
31
+ }
32
+ }
33
+ export async function writeManifest(runRoot, manifest) {
34
+ await mkdir(runRoot, { recursive: true });
35
+ const manifestPath = path.join(runRoot, "manifest.json");
36
+ await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
37
+ return manifestPath;
38
+ }
39
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/runtime/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAiB1C,0EAA0E;AAC1E,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,MAAM,QAAQ,GAA2B;QACvC,IAAI,EAAE,OAAO,CAAC,OAAO;QACrB,QAAQ,EAAE,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE;KAChD,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI;QAClC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC;QAC7B,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC;QAC7B,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,WAAW,CAAC,CAAC;KACzB,EAAE,CAAC;QACX,QAAQ,CA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 import { FACT_SCHEMA_VERSION, type FactEnvelope, type FactComparison, type FactNormalizationResult, type UnsupportedProviderEvidence } from "./facts.js";
3
+ import type { CorrelationResult, CorrelationStatus, NormalizedSourceRange } from "./correlation.js";
4
+ import type { ProviderIdentity, ResolvedRepository } from "./provider.js";
5
+ /** Version of the deterministic Provider Matrix artifact. */
6
+ export declare const PROVIDER_MATRIX_SCHEMA_VERSION: 1;
7
+ export type ProviderMatrixSchemaVersion = typeof PROVIDER_MATRIX_SCHEMA_VERSION;
8
+ /**
9
+ * A matrix state describes the comparison result, not provider quality.
10
+ * Correlation status is retained separately on every fact row.
11
+ */
12
+ export type MatrixFactState = "overlap" | "provider-only" | "conflict" | "unsupported" | "ambiguous" | "unmatched";
13
+ export type MatrixProviderFactState = "present" | "missing" | "unsupported" | "ambiguous" | "unmatched";
14
+ export interface MatrixMetricDefinition {
15
+ readonly id: string;
16
+ readonly numerator: string;
17
+ readonly denominator: string;
18
+ readonly meaning: string;
19
+ }
20
+ export interface MatrixRatio {
21
+ readonly numerator: number;
22
+ readonly denominator: number;
23
+ /** Null means the denominator is zero and the metric is not applicable. */
24
+ readonly value: number | null;
25
+ }
26
+ export interface NormalizedFactsArtifact {
27
+ readonly schemaVersion: typeof FACT_SCHEMA_VERSION;
28
+ readonly facts: readonly FactEnvelope[];
29
+ readonly unsupported: readonly UnsupportedProviderEvidence[];
30
+ readonly correlation: CorrelationResult;
31
+ /** Optional original #11 comparison projection, retained when persisted. */
32
+ readonly comparisons?: readonly FactComparison[];
33
+ }
34
+ export interface ProviderMatrixOptions {
35
+ /**
36
+ * Providers expected in the matrix, including providers with no facts.
37
+ * When omitted, providers are collected from facts, unsupported evidence,
38
+ * correlation metrics, and then sorted by identity.
39
+ */
40
+ readonly providers?: readonly ProviderIdentity[];
41
+ /**
42
+ * Explicit order for the incremental information-gain experiment. If
43
+ * omitted, the canonical provider identity order is used.
44
+ */
45
+ readonly additionOrder?: readonly ProviderIdentity[];
46
+ }
47
+ export interface MatrixEntityReference {
48
+ readonly provider: ProviderIdentity;
49
+ readonly nativeId: string;
50
+ readonly kind: string;
51
+ readonly canonicalId?: string;
52
+ readonly candidateCanonicalIds: readonly string[];
53
+ readonly correlationStatus: CorrelationStatus;
54
+ readonly path?: string;
55
+ readonly range?: NormalizedSourceRange;
56
+ }
57
+ export type MatrixFactObject = {
58
+ readonly kind: "entity";
59
+ readonly entity: MatrixEntityReference;
60
+ } | {
61
+ readonly kind: "value";
62
+ readonly value: string;
63
+ };
64
+ export interface MatrixFactVariant {
65
+ /** Exact normalized fact identity, or an evidence identity for unsupported records. */
66
+ readonly key: string;
67
+ readonly factIds: readonly string[];
68
+ readonly evidenceIds: readonly string[];
69
+ readonly providers: readonly ProviderIdentity[];
70
+ readonly subject: MatrixEntityReference;
71
+ readonly predicate: string;
72
+ readonly object: MatrixFactObject;
73
+ }
74
+ export interface MatrixProviderFactStatus {
75
+ readonly provider: ProviderIdentity;
76
+ readonly state: MatrixProviderFactState;
77
+ readonly factIds: readonly string[];
78
+ readonly evidenceIds: readonly string[];
79
+ }
80
+ export interface MatrixFactRecord {
81
+ /** Stable row identity. */
82
+ readonly key: string;
83
+ /** Stable comparable subject/predicate identity when correlation permits it. */
84
+ readonly logicalKey: string;
85
+ readonly repository: ResolvedRepository;
86
+ readonly factClass: string;
87
+ readonly predicate: string;
88
+ readonly state: MatrixFactState;
89
+ readonly comparisonPossible: boolean;
90
+ readonly correlationStatus: CorrelationStatus | "not-applicable";
91
+ readonly variants: readonly MatrixFactVariant[];
92
+ /** Includes an explicit missing state for every expected provider. */
93
+ readonly providerStates: readonly MatrixProviderFactStatus[];
94
+ readonly observedProviders: readonly ProviderIdentity[];
95
+ readonly missingProviders: readonly ProviderIdentity[];
96
+ }
97
+ export interface MatrixFactCorrelationCounts {
98
+ readonly matched: number;
99
+ readonly probable: number;
100
+ readonly correlated: number;
101
+ readonly ambiguous: number;
102
+ readonly unmatched: number;
103
+ readonly matchedCoverage: MatrixRatio;
104
+ readonly correlatedCoverage: MatrixRatio;
105
+ }
106
+ export interface MatrixEntityCorrelationCounts {
107
+ readonly total: number;
108
+ readonly matched: number;
109
+ readonly probable: number;
110
+ readonly correlated: number;
111
+ readonly ambiguous: number;
112
+ readonly unmatched: number;
113
+ readonly matchedCoverage: MatrixRatio;
114
+ readonly correlatedCoverage: MatrixRatio;
115
+ }
116
+ export interface FactClassCoverage {
117
+ readonly factClass: string;
118
+ /** Fact records plus unsupported provider evidence records. */
119
+ readonly rawObservedFactCount: number;
120
+ readonly normalizedFactCount: number;
121
+ readonly unsupportedFactCount: number;
122
+ readonly factCorrelation: MatrixFactCorrelationCounts;
123
+ readonly normalizationCoverage: MatrixRatio;
124
+ readonly uniqueFactCount: number;
125
+ readonly uniqueCoverage: MatrixRatio;
126
+ /** Distinct comparable logical fact keys observed by this provider only. */
127
+ readonly uniqueFactKeys: readonly string[];
128
+ }
129
+ export interface ProviderCoverage extends FactClassCoverage {
130
+ readonly provider: ProviderIdentity;
131
+ readonly factClasses: readonly FactClassCoverage[];
132
+ readonly entityCorrelation: MatrixEntityCorrelationCounts;
133
+ }
134
+ export interface PairwiseOverlap {
135
+ readonly left: ProviderIdentity;
136
+ readonly right: ProviderIdentity;
137
+ readonly factClass: string;
138
+ readonly leftComparableFactCount: number;
139
+ readonly rightComparableFactCount: number;
140
+ readonly comparedLogicalFactCount: number;
141
+ /** Distinct exact comparable fact keys observed by both providers. */
142
+ readonly overlapFactCount: number;
143
+ /** Logical keys observed only by the left/right provider. */
144
+ readonly leftOnlyFactCount: number;
145
+ readonly rightOnlyFactCount: number;
146
+ /** Logical keys where the two providers expose different exact values/relations. */
147
+ readonly conflictFactCount: number;
148
+ readonly overlapCoverage: MatrixRatio;
149
+ readonly overlapFactKeys: readonly string[];
150
+ readonly conflictLogicalKeys: readonly string[];
151
+ }
152
+ export interface AllProviderOverlap {
153
+ readonly factClass: string;
154
+ readonly providers: readonly ProviderIdentity[];
155
+ readonly providerCount: number;
156
+ readonly comparableFactUnionCount: number;
157
+ /** Distinct exact comparable fact keys present for every selected provider. */
158
+ readonly allProviderOverlapFactCount: number;
159
+ readonly allProviderOverlapCoverage: MatrixRatio;
160
+ readonly overlapFactKeys: readonly string[];
161
+ }
162
+ export interface ProviderMatrixOverlap {
163
+ readonly pairwise: readonly PairwiseOverlap[];
164
+ readonly allProviders: readonly AllProviderOverlap[];
165
+ readonly facts: readonly MatrixFactRecord[];
166
+ }
167
+ export interface ProviderMatrixUnmatched {
168
+ /** Rows whose entity correlation has competing candidates. */
169
+ readonly ambiguous: readonly MatrixFactRecord[];
170
+ /** Rows with no canonical entity identity. */
171
+ readonly unmatched: readonly MatrixFactRecord[];
172
+ /** Rows retained because the predicate has no normalized mapping. */
173
+ readonly unsupported: readonly MatrixFactRecord[];
174
+ readonly records: readonly MatrixFactRecord[];
175
+ }
176
+ export interface InformationGainClassCount {
177
+ readonly factClass: string;
178
+ readonly newComparableFactCount: number;
179
+ readonly newComparableFactKeys: readonly string[];
180
+ }
181
+ export interface InformationGain {
182
+ readonly provider: ProviderIdentity;
183
+ /** Providers already present when this provider is added. */
184
+ readonly existingProviders: readonly ProviderIdentity[];
185
+ readonly newComparableFactCount: number;
186
+ readonly newComparableFactKeys: readonly string[];
187
+ readonly newFactClasses: readonly InformationGainClassCount[];
188
+ readonly uniqueFactCount: number;
189
+ readonly uniqueFactKeys: readonly string[];
190
+ readonly informationGainCoverage: MatrixRatio;
191
+ readonly newUnsupportedFactCount: number;
192
+ readonly newUnsupportedEvidenceIds: readonly string[];
193
+ readonly newAmbiguousFactCount: number;
194
+ readonly newAmbiguousFactIds: readonly string[];
195
+ readonly newUnmatchedFactCount: number;
196
+ readonly newUnmatchedFactIds: readonly string[];
197
+ }
198
+ export interface ProviderMatrix {
199
+ readonly schemaVersion: ProviderMatrixSchemaVersion;
200
+ readonly inputFactSchemaVersion: typeof FACT_SCHEMA_VERSION;
201
+ readonly generatedBy: "deterministic-rules";
202
+ readonly repositories: readonly ResolvedRepository[];
203
+ readonly providers: readonly ProviderIdentity[];
204
+ readonly additionOrder: readonly ProviderIdentity[];
205
+ readonly metricDefinitions: readonly MatrixMetricDefinition[];
206
+ readonly coverage: readonly ProviderCoverage[];
207
+ readonly overlap: ProviderMatrixOverlap;
208
+ readonly conflicts: readonly MatrixFactRecord[];
209
+ readonly unmatched: ProviderMatrixUnmatched;
210
+ readonly informationGain: readonly InformationGain[];
211
+ /** Complete row set; the derived artifact files are projections of this set. */
212
+ readonly facts: readonly MatrixFactRecord[];
213
+ }
214
+ export interface ProviderMatrixArtifactPaths {
215
+ readonly matrixPath: string;
216
+ readonly coveragePath: string;
217
+ readonly overlapPath: string;
218
+ readonly conflictsPath: string;
219
+ readonly unmatchedPath: string;
220
+ readonly informationGainPath: string;
221
+ readonly reportPath: string;
222
+ }
223
+ /**
224
+ * A `MatrixEntityReference` reduced to the identity fields needed to read a
225
+ * row without re-embedding the full entity (path/range/kind), which is
226
+ * already persisted once in normalized/facts.json and reachable through
227
+ * `factIds`/`evidenceIds`.
228
+ */
229
+ export interface MatrixEntityRefProjection {
230
+ readonly provider: ProviderIdentity;
231
+ readonly nativeId: string;
232
+ readonly canonicalId?: string;
233
+ readonly candidateCanonicalIds: readonly string[];
234
+ }
235
+ export type MatrixFactObjectProjection = {
236
+ readonly kind: "entity";
237
+ readonly entity: MatrixEntityRefProjection;
238
+ } | {
239
+ readonly kind: "value";
240
+ readonly value: string;
241
+ };
242
+ /** `MatrixFactVariant` reduced to identity references; see `MatrixEntityRefProjection`. */
243
+ export interface MatrixFactVariantProjection {
244
+ readonly key: string;
245
+ readonly factIds: readonly string[];
246
+ readonly evidenceIds: readonly string[];
247
+ readonly providers: readonly ProviderIdentity[];
248
+ readonly subject: MatrixEntityRefProjection;
249
+ readonly predicate: string;
250
+ readonly object: MatrixFactObjectProjection;
251
+ }
252
+ /**
253
+ * `MatrixFactRecord` projected for persistence: variants are reduced to
254
+ * identity references instead of full entity/object copies. Readers resolve
255
+ * `factIds`/`evidenceIds` against normalized/facts.json for full detail.
256
+ */
257
+ export interface MatrixFactRecordProjection {
258
+ readonly key: string;
259
+ readonly logicalKey: string;
260
+ readonly repository: ResolvedRepository;
261
+ readonly factClass: string;
262
+ readonly predicate: string;
263
+ readonly state: MatrixFactState;
264
+ readonly comparisonPossible: boolean;
265
+ readonly correlationStatus: CorrelationStatus | "not-applicable";
266
+ readonly variants: readonly MatrixFactVariantProjection[];
267
+ readonly providerStates: readonly MatrixProviderFactStatus[];
268
+ readonly observedProviders: readonly ProviderIdentity[];
269
+ readonly missingProviders: readonly ProviderIdentity[];
270
+ }
271
+ export declare const MATRIX_METRIC_DEFINITIONS: readonly MatrixMetricDefinition[];
272
+ /**
273
+ * Builds all matrix views from normalized/persisted facts. It only consumes
274
+ * artifacts; provider execution and observation generation are intentionally
275
+ * outside this function.
276
+ */
277
+ export declare function buildProviderMatrix(input: NormalizedFactsArtifact | FactNormalizationResult, options?: ProviderMatrixOptions): ProviderMatrix;
278
+ /** Alias for callers that use the generation vocabulary. */
279
+ export declare const generateProviderMatrix: typeof buildProviderMatrix;
280
+ /** Renders the matrix without consulting a model or changing any matrix state. */
281
+ export declare function renderProviderMatrixReport(matrix: ProviderMatrix): string;
282
+ /**
283
+ * Writes aggregate and sliced machine-readable artifacts plus the report.
284
+ * The writer performs no provider execution and no normalization.
285
+ *
286
+ * `normalized/facts.json` is the source of truth for full fact/evidence
287
+ * detail. Every persisted row here carries only aggregate counts plus
288
+ * `factIds`/`evidenceIds`/`canonicalId` references back to it -- no fact
289
+ * envelope (path/range/provider-native payload) is re-embedded. `matrix.json`
290
+ * itself omits the full row set and per-state row slices, since those are
291
+ * exactly what `overlap.json`/`conflicts.json`/`unmatched.json` persist.
292
+ */
293
+ export declare function writeProviderMatrixArtifacts(runRoot: string, matrix: ProviderMatrix): Promise<ProviderMatrixArtifactPaths>;
294
+ /** Builds then persists a matrix, accepting either normalized facts or a matrix. */
295
+ export declare function writeProviderMatrix(runRoot: string, input: NormalizedFactsArtifact | FactNormalizationResult | ProviderMatrix, options?: ProviderMatrixOptions): Promise<ProviderMatrixArtifactPaths>;
296
+ /** Persists the exact normalized artifact consumed by the matrix builder. */
297
+ export declare function writeNormalizedFactsArtifact(filePath: string, input: NormalizedFactsArtifact | FactNormalizationResult): Promise<string>;
298
+ /**
299
+ * Reads a persisted #11 normalized-facts artifact without running providers.
300
+ *
301
+ * Mottainai-scale artifacts exceed V8's ~1GB single-string limit, so this
302
+ * never materializes the whole file as one string (unlike `JSON.parse(await
303
+ * readFile(filePath, "utf8"))`). It streams the file in chunks and parses
304
+ * each top-level array element (`facts[i]`, `unsupported[i]`) as its own
305
+ * JSON string instead, relying on the fixed top-level key order
306
+ * (`schemaVersion`, `facts`, `unsupported`, `correlation`) that
307
+ * `writeNormalizedFactsArtifact` always writes.
308
+ */
309
+ export declare function readNormalizedFactsArtifact(filePath: string): Promise<NormalizedFactsArtifact>;
310
+ /** Reads a persisted normalized artifact and generates its deterministic matrix. */
311
+ export declare function buildProviderMatrixFromArtifact(filePath: string, options?: ProviderMatrixOptions): Promise<ProviderMatrix>;
312
+ /**
313
+ * Streams a value to disk through `JsonArtifactWriter` instead of building
314
+ * one `JSON.stringify(value)` string first. Exported so every large
315
+ * generated artifact (not just the ones matrix.ts itself writes) can avoid
316
+ * the same V8 string-length limit.
317
+ */
318
+ export declare function writeStreamingJson(filePath: string, value: unknown): Promise<void>;
319
+ /**
320
+ * Serializes large generated artifacts without first constructing one giant
321
+ * JSON string. Mottainai's TypeScript observation set is large enough for a
322
+ * single JSON.stringify(matrix) call to exceed V8's string limit.
323
+ */
324
+ export declare class JsonArtifactWriter {
325
+ private readonly handle;
326
+ private buffer;
327
+ constructor(handle: Awaited<ReturnType<typeof open>>);
328
+ write(value: string): Promise<void>;
329
+ flush(): Promise<void>;
330
+ /**
331
+ * Streams a possibly-large array by transforming and serializing one
332
+ * element at a time, so the whole transformed array is never held in
333
+ * memory at once (unlike `writeValue(values.map(transform))`).
334
+ */
335
+ writeArray<T>(values: readonly T[], transform: (value: T) => unknown): Promise<void>;
336
+ writeValue(value: unknown): Promise<void>;
337
+ }