@jini-ai/devops 0.5.2 → 0.5.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @jini-ai/devops
2
2
 
3
+ ## 0.5.3 — 2026-10-08
4
+
5
+ - Desktop 0.1.13 release fixes: see commits a2659d24 (admin), 5695a7c3 (chat, agent-runtime), 8ad4ac5c (devops).
6
+
3
7
  ## 0.5.2
4
8
 
5
9
  ### Patch Changes
@@ -7,6 +7,8 @@ export interface LcovCounters {
7
7
  fnh: number;
8
8
  }
9
9
  export type CoverageAxis = "line" | "branch" | "funcs";
10
+ /** One entry of `coverage-floors.json`'s `areas`, as far as this file reads it. `dirs`,
11
+ * `excludeDirs` and `extensions` are read by `scripts/check-coverage.ts` to build `onDisk`. */
10
12
  export interface CoverageArea {
11
13
  id: string;
12
14
  dirs?: readonly string[];
@@ -37,16 +39,29 @@ export interface DiskAreaResult {
37
39
  export declare function isMeasurableSource({ file: relPath }: {
38
40
  file: string;
39
41
  }): boolean;
40
- /** Match excluded directories on segment boundaries. */
42
+ /** Whether `relPath` is one of `excludeDirs` or lies anywhere beneath one. Anchored at the start and
43
+ * matched on a whole directory segment, so `src/renderer` excludes `src/renderer/x.ts` but never
44
+ * `src/renderer-foo/x.js`: a bare `startsWith` would move a main-process file out of its area with
45
+ * no failure. Both sides are desktop-root-relative and `/`-separated; a trailing `/` on a
46
+ * configured directory is ignored.
47
+ * @complexity O(d) in excluded directories. */
41
48
  export declare function isInExcludedDir({ file: relPath, excludeDirs }: {
42
49
  file: string;
43
50
  excludeDirs: readonly string[];
44
51
  }): boolean;
45
- /** Read a chain of node test commands into runner/glob records; reject other commands. */
52
+ /** Splits an npm script of `&&`-chained `node [args] --test <globs>` commands into
53
+ * `{ nodeArgs, globs }` passes, with double quotes stripped. Every token after `--test` counts as a
54
+ * glob, so a flag placed there shows up as drift rather than being skipped. Any other command
55
+ * throws, so a script this cannot read fails loudly instead of comparing as zero globs.
56
+ * @complexity O(n) in script length. */
46
57
  export declare function parseNodeTestScript({ script }: {
47
58
  script: string;
48
59
  }): RunnerGlobs[];
49
- /** Report every runner/glob mismatch between two explicitly supplied inventories. */
60
+ /** Every glob that `TEST_PASSES` and `package.json`'s parsed `test` script disagree on, one message
61
+ * per glob per side; empty when they agree. Globs are compared per runner as literal strings: order
62
+ * is ignored, a glob moved between runners is reported on both, and two spellings of one pattern
63
+ * count as drift.
64
+ * @complexity O(g) in globs. */
50
65
  export declare function runnerSplitDrift({ passes, scriptPasses }: {
51
66
  passes: readonly RunnerGlobs[];
52
67
  scriptPasses: readonly RunnerGlobs[];
@@ -57,9 +72,13 @@ export declare function evaluateDiskArea({ area, onDisk, coverage }: {
57
72
  onDisk: readonly string[];
58
73
  coverage: ReadonlyMap<string, LcovCounters>;
59
74
  }): DiskAreaResult;
60
- /** Render floors and every measured/unmeasured source path in an area. */
75
+ /** One area's result, rendered. The unmeasured files are named on EVERY run — a gap nobody is told
76
+ * about is the trap; a gap printed every run is a decision.
77
+ * @complexity O(n). */
61
78
  export declare function formatDiskArea({ result, area }: {
62
79
  result: DiskAreaResult;
63
80
  area: CoverageArea;
81
+ }, optional?: {
82
+ noFloorMessage?: string;
64
83
  }): string;
65
84
  //# sourceMappingURL=disk.d.ts.map
@@ -1,3 +1,5 @@
1
+ // evaluateArea and formatArea in the preserved rationale below are now evaluateDiskArea and
2
+ // formatDiskArea; scripts/check-coverage.ts and coverage-floors.json are host-owned consumers.
1
3
  import { pct } from './lcov.js';
2
4
  /** Exclude test and declaration filenames from a production-source inventory. */
3
5
  export function isMeasurableSource({ file: relPath }) {
@@ -7,14 +9,23 @@ export function isMeasurableSource({ file: relPath }) {
7
9
  return false;
8
10
  return true;
9
11
  }
10
- /** Match excluded directories on segment boundaries. */
12
+ /** Whether `relPath` is one of `excludeDirs` or lies anywhere beneath one. Anchored at the start and
13
+ * matched on a whole directory segment, so `src/renderer` excludes `src/renderer/x.ts` but never
14
+ * `src/renderer-foo/x.js`: a bare `startsWith` would move a main-process file out of its area with
15
+ * no failure. Both sides are desktop-root-relative and `/`-separated; a trailing `/` on a
16
+ * configured directory is ignored.
17
+ * @complexity O(d) in excluded directories. */
11
18
  export function isInExcludedDir({ file: relPath, excludeDirs }) {
12
19
  return excludeDirs.some((dir) => {
13
20
  const base = dir.replace(/\/+$/, "");
14
21
  return relPath === base || relPath.startsWith(`${base}/`);
15
22
  });
16
23
  }
17
- /** Read a chain of node test commands into runner/glob records; reject other commands. */
24
+ /** Splits an npm script of `&&`-chained `node [args] --test <globs>` commands into
25
+ * `{ nodeArgs, globs }` passes, with double quotes stripped. Every token after `--test` counts as a
26
+ * glob, so a flag placed there shows up as drift rather than being skipped. Any other command
27
+ * throws, so a script this cannot read fails loudly instead of comparing as zero globs.
28
+ * @complexity O(n) in script length. */
18
29
  export function parseNodeTestScript({ script }) {
19
30
  return script.split("&&").map((command) => {
20
31
  const tokens = [...command.matchAll(/"([^"]*)"|(\S+)/g)].map((match) => match[1] ?? match[2]);
@@ -45,7 +56,11 @@ function unmatchedGlobs(side, other) {
45
56
  }
46
57
  return unmatched;
47
58
  }
48
- /** Report every runner/glob mismatch between two explicitly supplied inventories. */
59
+ /** Every glob that `TEST_PASSES` and `package.json`'s parsed `test` script disagree on, one message
60
+ * per glob per side; empty when they agree. Globs are compared per runner as literal strings: order
61
+ * is ignored, a glob moved between runners is reported on both, and two spellings of one pattern
62
+ * count as drift.
63
+ * @complexity O(g) in globs. */
49
64
  export function runnerSplitDrift({ passes, scriptPasses }) {
50
65
  const inPasses = globsByRunner(passes);
51
66
  const inScript = globsByRunner(scriptPasses);
@@ -66,6 +81,12 @@ function total(records) {
66
81
  }
67
82
  return sum;
68
83
  }
84
+ /**
85
+ * Which declared floors this area misses. Only the axes the area actually configures are checked:
86
+ * an axis with no floor is still reported, but never fails.
87
+ *
88
+ * @complexity O(1).
89
+ */
69
90
  function floorFailures(area, measured) {
70
91
  const actual = {
71
92
  line: pct({ hit: measured.lh, found: measured.lf }),
@@ -89,16 +110,22 @@ export function evaluateDiskArea({ area, onDisk, coverage }) {
89
110
  const unmeasured = diskPaths.filter((p) => !coverage.has(p));
90
111
  const measured = total(measuredPaths.map((p) => coverage.get(p)));
91
112
  const { actual, failures } = floorFailures(area, measured);
113
+ // A file with no coverage record that nobody declared. This is the check the percentages cannot
114
+ // make, and the reason this function takes `onDisk` at all.
92
115
  const newlyUnmeasured = unmeasured.filter((p) => !known.has(p));
93
116
  if (newlyUnmeasured.length > 0) {
94
117
  failures.push(`${newlyUnmeasured.length} file(s) have NO coverage record and are not in knownUnmeasured: ` +
95
118
  `${newlyUnmeasured.join(", ")}. Add a test, or grandfather them explicitly with a reason.`);
96
119
  }
120
+ // Zero files on disk is never a legitimate pass — it means a directory was renamed or a glob went
121
+ // stale, which is precisely how four scopes in `check-src-complexity-drift.ts` went quiet.
97
122
  const minOnDisk = area.minFilesOnDisk ?? 1;
98
123
  if (diskPaths.length < minOnDisk) {
99
124
  failures.push(`only ${diskPaths.length} file(s) found on disk, expected at least ${minOnDisk}. ` +
100
125
  `The glob is stale (directory renamed?) or the scan is broken — this is NOT a pass.`);
101
126
  }
127
+ // A declared gap that now HAS coverage: good news, but the list must shrink or it rots into a
128
+ // permanent exemption nobody revisits.
102
129
  const recovered = [...known].filter((p) => coverage.has(p));
103
130
  return {
104
131
  id: area.id,
@@ -111,14 +138,16 @@ export function evaluateDiskArea({ area, onDisk, coverage }) {
111
138
  failures,
112
139
  };
113
140
  }
114
- /** Render floors and every measured/unmeasured source path in an area. */
115
- export function formatDiskArea({ result, area }) {
141
+ /** One area's result, rendered. The unmeasured files are named on EVERY run — a gap nobody is told
142
+ * about is the trap; a gap printed every run is a decision.
143
+ * @complexity O(n). */
144
+ export function formatDiskArea({ result, area }, optional = {}) {
116
145
  const lines = [` ${result.failures.length === 0 ? "OK " : "FAIL"} ${result.id}`];
117
146
  const floors = area.floors ?? {};
118
147
  for (const axis of ["line", "branch", "funcs"]) {
119
148
  const floor = floors[axis];
120
149
  const shown = `${result.actual[axis].toFixed(2)}%`;
121
- lines.push(` ${axis.padEnd(6)} ${shown.padStart(7)} ${typeof floor === "number" ? `(floor ${floor}%)` : "(no floor configured)"}`);
150
+ lines.push(` ${axis.padEnd(6)} ${shown.padStart(7)} ${typeof floor === "number" ? `(floor ${floor}%)` : (optional.noFloorMessage ?? "(no floor configured)")}`);
122
151
  }
123
152
  lines.push(` files: ${result.measuredCount} measured of ${result.onDiskCount} on disk`);
124
153
  if (result.unmeasured.length > 0) {
@@ -19,6 +19,10 @@ export type SourceClassifier = (args: {
19
19
  file: string;
20
20
  }) => boolean;
21
21
  /** LCOV's empty denominator is vacuously 100%; area checks separately reject empty scopes. */
22
+ /** `pct(0, 0)` is 100: a file with no branches is fully branch-covered. Correct per file, and
23
+ * dangerous per area — which is why {@link evaluateArea} never relies on it to decide whether an
24
+ * area was measured at all.
25
+ * @complexity O(1). */
22
26
  export declare function pct({ hit, found }: {
23
27
  hit: number;
24
28
  found: number;
@@ -1,4 +1,9 @@
1
1
  /** LCOV's empty denominator is vacuously 100%; area checks separately reject empty scopes. */
2
+ /** `pct(0, 0)` is 100: a file with no branches is fully branch-covered. Correct per file, and
3
+ * dangerous per area — which is why {@link evaluateArea} never relies on it to decide whether an
4
+ * area was measured at all.
5
+ * @complexity O(1). */
6
+ // evaluateArea is the disk inventory owner, now evaluateDiskArea in ./disk.ts.
2
7
  export function pct({ hit, found }) { return found === 0 ? 100 : 100 * hit / found; }
3
8
  /** Normalize paths with a directory boundary check, including Windows paths on non-Windows hosts. */
4
9
  export function toRepoRelative({ sourceFile, repoRoot }) {
@@ -0,0 +1,43 @@
1
+ import type ts from 'typescript';
2
+ import type { HardwiringViolation } from './hardwiring.js';
3
+ /** Authored inventory excludes generated output, fixtures and tests. O(directory entries). */
4
+ export declare function sourceFiles({ directory, declarations }: {
5
+ directory: string;
6
+ declarations?: boolean;
7
+ }, _options?: Record<string, never>): string[];
8
+ /** Runtime compiler resolution denies declarations which can erase React edges.
9
+ * Resolution failures omit the specifier because import literals may contain secrets.
10
+ */
11
+ export declare function createResolver({ root, compiler: c, runtime, aliases }: {
12
+ root: string;
13
+ compiler: typeof ts;
14
+ runtime?: boolean;
15
+ aliases?: Readonly<Record<string, string>>;
16
+ }, _options?: Record<string, never>): (specifier: string, file: string) => string | undefined;
17
+ /** Debt stops at dependency package ownership; authored apps/content keep file identities.
18
+ * Realpaths can point at sibling workspace packages locally and node_modules in CI.
19
+ * Normalize dependency ownership to the manifest name so publishing cannot move its waiver.
20
+ */
21
+ export declare function displayGraphFile({ file, root, authoredDirectories }: {
22
+ file: string;
23
+ root: string;
24
+ authoredDirectories?: readonly string[];
25
+ }, _options?: Record<string, never>): string;
26
+ /** HW5 reads only installed package export entries, including aliases and re-export barrels.
27
+ * TypeScript's checker owns symbol resolution; no source checkout or private dist scan is used.
28
+ * Parsing errors fail closed; this creates an analysis program without running a typecheck.
29
+ */
30
+ export declare function installedPublicFunctions({ root, compiler: c }: {
31
+ root: string;
32
+ compiler: typeof ts;
33
+ }, _options?: Record<string, never>): ReadonlySet<string>;
34
+ /** Shared occurrence ratchet and the sole debt generator. Never regenerate baselines in CI. */
35
+ export declare function runHardwiring({ collect, debtPath, baselineComment, logger }: {
36
+ collect: () => readonly HardwiringViolation[] | Promise<readonly HardwiringViolation[]>;
37
+ debtPath: string;
38
+ baselineComment: string;
39
+ logger?: Pick<Console, 'log' | 'error'>;
40
+ }, { writeBaseline }?: {
41
+ writeBaseline?: boolean;
42
+ }): Promise<HardwiringViolation[]>;
43
+ //# sourceMappingURL=hardwiring-node.d.ts.map
@@ -0,0 +1,177 @@
1
+ /** Node adapters for hardwiring inventories, resolution, package identities and debt generation.
2
+ * Host policy supplies aliases, scan inputs and the debt path; the compiler remains an injected port.
3
+ */
4
+ import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
5
+ import { dirname, join, relative, resolve } from 'node:path';
6
+ import { isBuiltin } from 'node:module';
7
+ import { diffHardwiringDebt, HARDWIRING_RULES } from './hardwiring.js';
8
+ /** Authored inventory excludes generated output, fixtures and tests. O(directory entries). */
9
+ export function sourceFiles({ directory, declarations = false }, _options = {}) {
10
+ const found = [];
11
+ function visit(dir) {
12
+ if (!existsSync(dir))
13
+ return;
14
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
15
+ if (['node_modules', 'dist', 'build', 'coverage', 'release', 'release-verify', 'staging', '__tests__', '__measurements__', 'fixtures', 'vendor', '.git', '.build'].includes(entry.name))
16
+ continue;
17
+ const file = join(dir, entry.name);
18
+ if (entry.isDirectory())
19
+ visit(file);
20
+ else if (/\.[cm]?[jt]sx?$/.test(file) && !/\.(?:test|spec)\./.test(file) && (declarations || !/\.d\.[cm]?ts$/.test(file)))
21
+ found.push(file);
22
+ }
23
+ }
24
+ visit(directory);
25
+ return found.sort();
26
+ }
27
+ /** Runtime compiler resolution denies declarations which can erase React edges.
28
+ * Resolution failures omit the specifier because import literals may contain secrets.
29
+ */
30
+ export function createResolver({ root, compiler: c, runtime = false, aliases = {} }, _options = {}) {
31
+ const options = { moduleResolution: c.ModuleResolutionKind.Bundler, module: c.ModuleKind.ESNext, allowJs: true, resolveJsonModule: true, customConditions: ['browser'] };
32
+ // A declaration entry can erase every React edge while its executable imports React.
33
+ // Keep browser/export resolution in the maintained compiler, but deny declaration candidates.
34
+ const host = runtime ? { ...c.sys, fileExists: (file) => !/\.d\.[cm]?ts$/.test(file) && c.sys.fileExists(file) } : c.sys;
35
+ return (specifier, file) => {
36
+ if (isBuiltin(specifier) || /\.(?:css|scss|sass|less|svg|png|jpg|woff2?|json)(?:\?|$)/.test(specifier))
37
+ return undefined;
38
+ for (const [prefix, directory] of Object.entries(aliases)) {
39
+ if (specifier.startsWith(prefix)) {
40
+ specifier = join(directory, specifier.slice(prefix.length));
41
+ break;
42
+ }
43
+ }
44
+ const resolved = c.resolveModuleName(specifier, file, options, host).resolvedModule?.resolvedFileName;
45
+ if (!resolved)
46
+ throw new Error(`Unresolved code import in ${relative(root, file)} (specifier omitted); refusing an incomplete public/plugin graph.`);
47
+ // Prefer executable published JS over its paired declaration file for bundle reachability.
48
+ if (resolved.endsWith('.d.ts')) {
49
+ for (const candidate of [resolved.slice(0, -5) + '.js', resolved.slice(0, -5) + '.mjs'])
50
+ if (existsSync(candidate))
51
+ return candidate;
52
+ }
53
+ return resolved;
54
+ };
55
+ }
56
+ /** Debt stops at dependency package ownership; authored apps/content keep file identities.
57
+ * Realpaths can point at sibling workspace packages locally and node_modules in CI.
58
+ * Normalize dependency ownership to the manifest name so publishing cannot move its waiver.
59
+ */
60
+ export function displayGraphFile({ file, root, authoredDirectories = ['apps', 'content'] }, _options = {}) {
61
+ if (authoredDirectories.some(directory => file.startsWith(join(root, directory) + '/')))
62
+ return relative(root, file).replaceAll('\\', '/');
63
+ for (let dir = dirname(file); dirname(dir) !== dir; dir = dirname(dir)) {
64
+ const manifest = join(dir, 'package.json');
65
+ if (!existsSync(manifest))
66
+ continue;
67
+ const data = JSON.parse(readFileSync(manifest, 'utf8'));
68
+ if (data.name)
69
+ return `node_modules/${data.name}`;
70
+ }
71
+ return relative(root, file).replaceAll('\\', '/');
72
+ }
73
+ /** Select installed public targets, favouring declarations without executing package code. */
74
+ function publicTargets(directory, exports) {
75
+ const targets = [];
76
+ function select(value) {
77
+ if (typeof value === 'string') {
78
+ if (!value.startsWith('./'))
79
+ throw new Error(`Invalid public export target in ${directory}.`);
80
+ const file = resolve(directory, value);
81
+ if (value.includes('*')) {
82
+ const [prefix, suffix] = file.split('*');
83
+ // Export maps may expose wildcard entries; private declarations stay excluded.
84
+ const scanDir = dirname(prefix);
85
+ for (const candidate of sourceFiles({ directory: scanDir, declarations: true })) {
86
+ if (candidate.startsWith(prefix) && candidate.endsWith(suffix ?? ''))
87
+ targets.push(candidate);
88
+ }
89
+ }
90
+ else if (existsSync(file))
91
+ targets.push(file);
92
+ else
93
+ throw new Error(`Missing installed public entry in ${directory}.`);
94
+ }
95
+ else if (Array.isArray(value)) {
96
+ const candidate = value.find(item => item !== null);
97
+ if (candidate !== undefined)
98
+ select(candidate);
99
+ }
100
+ else if (value && typeof value === 'object') {
101
+ const record = value;
102
+ const entryKeys = Object.keys(record).filter(key => key.startsWith('.'));
103
+ if (entryKeys.length)
104
+ for (const key of entryKeys)
105
+ select(record[key]);
106
+ else {
107
+ const condition = ['types', 'import', 'default', 'node', 'browser', 'require'].find(key => record[key] !== undefined);
108
+ if (condition)
109
+ select(record[condition]);
110
+ }
111
+ }
112
+ }
113
+ select(exports);
114
+ return targets;
115
+ }
116
+ /** HW5 reads only installed package export entries, including aliases and re-export barrels.
117
+ * TypeScript's checker owns symbol resolution; no source checkout or private dist scan is used.
118
+ * Parsing errors fail closed; this creates an analysis program without running a typecheck.
119
+ */
120
+ export function installedPublicFunctions({ root, compiler: c }, _options = {}) {
121
+ const installed = join(root, 'node_modules/@jini-ai');
122
+ if (!existsSync(installed))
123
+ throw new Error('Jini export inventory unavailable; install the declared packages.');
124
+ const entries = [];
125
+ for (const item of readdirSync(installed)) {
126
+ const directory = join(installed, item);
127
+ const manifest = join(directory, 'package.json');
128
+ if (!existsSync(manifest))
129
+ continue;
130
+ const data = JSON.parse(readFileSync(manifest, 'utf8'));
131
+ if (!data.name?.startsWith('@jini-ai/'))
132
+ continue;
133
+ const legacy = data.types ?? data.main;
134
+ entries.push(...publicTargets(directory, data.exports ?? (legacy?.startsWith("./") ? legacy : legacy ? "./" + legacy : undefined)));
135
+ }
136
+ const program = c.createProgram(entries, { moduleResolution: c.ModuleResolutionKind.Bundler, module: c.ModuleKind.ESNext, allowJs: true, noEmit: true, skipLibCheck: true });
137
+ const checker = program.getTypeChecker();
138
+ const found = new Set();
139
+ for (const file of program.getSourceFiles()) {
140
+ const diagnostics = file.parseDiagnostics;
141
+ if (diagnostics.length)
142
+ throw new Error(`Cannot parse ${file.fileName}: syntax error at line ${file.getLineAndCharacterOfPosition(diagnostics[0].start ?? 0).line + 1}.`);
143
+ }
144
+ for (const entry of entries) {
145
+ const tree = program.getSourceFile(entry);
146
+ const module = tree && checker.getSymbolAtLocation(tree);
147
+ if (!module || !tree)
148
+ continue;
149
+ for (const item of checker.getExportsOfModule(module)) {
150
+ const symbol = item.flags & c.SymbolFlags.Alias ? checker.getAliasedSymbol(item) : item;
151
+ // Interfaces with call signatures are types, not public runtime functions.
152
+ if (!(symbol.flags & c.SymbolFlags.Value))
153
+ continue;
154
+ if (checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration ?? tree).getCallSignatures().length)
155
+ found.add(item.name);
156
+ }
157
+ }
158
+ if (!found.size)
159
+ throw new Error('Jini export inventory is empty; refusing a vacuous duplication check.');
160
+ return found;
161
+ }
162
+ /** Shared occurrence ratchet and the sole debt generator. Never regenerate baselines in CI. */
163
+ export async function runHardwiring({ collect, debtPath, baselineComment, logger = console }, { writeBaseline = false } = {}) {
164
+ const violations = await collect();
165
+ if (writeBaseline)
166
+ writeFileSync(debtPath, JSON.stringify({ _comment: baselineComment, violations }, null, 2) + '\n');
167
+ const debt = JSON.parse(readFileSync(debtPath, 'utf8'));
168
+ const { added, removed } = diffHardwiringDebt({ baseline: debt.violations, current: violations });
169
+ for (const rule of HARDWIRING_RULES)
170
+ logger.log(`[hardwiring] ${rule}: ${violations.filter(v => v.rule === rule).length} total; ${added.filter(v => v.rule === rule).length} new`);
171
+ if (removed.length)
172
+ logger.log(`[hardwiring] ${removed.length} stale debt occurrences; remove them from ${debtPath}.`);
173
+ for (const v of added)
174
+ logger.error(`[hardwiring] ${v.rule} ${v.file}:${v.line}: ${v.reason}`);
175
+ return added;
176
+ }
177
+ //# sourceMappingURL=hardwiring-node.js.map
@@ -0,0 +1,68 @@
1
+ import type ts from 'typescript';
2
+ export interface HardwiringViolation {
3
+ rule: string;
4
+ file: string;
5
+ line: number;
6
+ reason: string;
7
+ fingerprint: string;
8
+ }
9
+ export interface RuntimeImport {
10
+ specifier: string;
11
+ node: ts.Node;
12
+ }
13
+ export interface HardwiringSource {
14
+ file: string;
15
+ source: string;
16
+ mode: 'jini' | 'consumer';
17
+ server?: boolean;
18
+ jiniExports?: ReadonlySet<string>;
19
+ /** Host verifies these env keys against the production refusal gate, not comments. */
20
+ bootCoveredEnv?: ReadonlySet<string>;
21
+ /** Host-owned plugin identities, including separately installed plugins. */
22
+ pluginIdentity?: (file: string) => string | undefined;
23
+ resolveImport?: (specifier: string, file: string) => string | undefined;
24
+ }
25
+ export declare const HARDWIRING_RULES: readonly ["HW1-env-default", "HW2-vendor-adapter", "HW3-module-state", "HW4-injected-fetch", "HW5-jini-export", "HW6-boot-default", "HW7-public-react", "HW8-provider-url", "HW9-plugin-import"];
26
+ /** Bind the installed compiler, keeping this optional parser out of the runtime dependency graph.
27
+ * Inspection is O(n) AST nodes, plus lexical-scope scans for bare fetch calls; no external I/O.
28
+ * Only the rule-identifying value is hashed for debt identity and never included in diagnostics (it may contain secrets).
29
+ */
30
+ export declare function createHardwiringInspector({ compiler: c }: {
31
+ compiler: typeof ts;
32
+ }, _options?: Record<string, never>): {
33
+ inspect: (input: HardwiringSource, _options?: Record<string, never>) => HardwiringViolation[];
34
+ inspectPublicGraph: ({ entries, readSource, resolveImport, displayFile }: {
35
+ entries: readonly string[];
36
+ readSource: (file: string) => string;
37
+ resolveImport: (specifier: string, file: string) => string | undefined;
38
+ displayFile: (file: string) => string;
39
+ }, _options?: Record<string, never>) => HardwiringViolation[];
40
+ parse: ({ file, source }: {
41
+ file: string;
42
+ source: string;
43
+ }, _options?: Record<string, never>) => ts.SourceFile;
44
+ imports: ({ tree, includeTypeOnly }: {
45
+ tree: ts.SourceFile;
46
+ includeTypeOnly?: boolean;
47
+ }, _options?: Record<string, never>) => RuntimeImport[];
48
+ exportedFunctions: ({ tree }: {
49
+ tree: ts.SourceFile;
50
+ }, _options?: Record<string, never>) => {
51
+ name: string;
52
+ node: ts.Node;
53
+ }[];
54
+ envKey: ({ node }: {
55
+ node: ts.Node;
56
+ }, _options?: Record<string, never>) => string | undefined;
57
+ };
58
+ /** Occurrence-based debt ratchet: adding a duplicate in an already listed file still fails.
59
+ * Line shifts and body edits do not create debt; new identifying values cannot inherit waivers. O(n) time/space.
60
+ */
61
+ export declare function diffHardwiringDebt({ baseline, current }: {
62
+ baseline: readonly HardwiringViolation[];
63
+ current: readonly HardwiringViolation[];
64
+ }, _options?: Record<string, never>): {
65
+ added: HardwiringViolation[];
66
+ removed: HardwiringViolation[];
67
+ };
68
+ //# sourceMappingURL=hardwiring.d.ts.map