knodin 0.14.0 → 0.14.2

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.
@@ -138,8 +138,9 @@ function findRelated(root, target, lines) {
138
138
  const names = outlineSource(lines)
139
139
  .map(({ signature }) => /\b(?:function|class|interface|type|enum|const|let|var)\s+([\w$]+)/.exec(signature)?.[1])
140
140
  .filter((name) => Boolean(name));
141
- if (names.length === 0)
142
- return [];
141
+ const targetStem = target.replace(/\.[^./]+$/, "");
142
+ const targetBase = path.posix.basename(target);
143
+ const targetBaseStem = path.posix.basename(targetStem);
143
144
  const results = [];
144
145
  const visit = (directory) => {
145
146
  for (const entry of fs
@@ -158,7 +159,14 @@ function findRelated(root, target, lines) {
158
159
  if (!entry.isFile() || file === target || !/\.(?:[cm]?[jt]sx?|py|java|cs|go|rs)$/.test(file))
159
160
  continue;
160
161
  for (const [index, evidence] of fs.readFileSync(absolute, "utf8").split("\n").entries()) {
161
- if (!names.some((name) => new RegExp(String.raw `\b${name}\b`).test(evidence)))
162
+ const matchesSymbol = names.some((name) => new RegExp(String.raw `\b${name}\b`).test(evidence));
163
+ const matchesModuleImport = /\b(?:import|export|require)\b/.test(evidence) &&
164
+ (evidence.includes(`/${targetBase}`) ||
165
+ evidence.includes(`/${targetBaseStem}"`) ||
166
+ evidence.includes(`/${targetBaseStem}'`) ||
167
+ evidence.includes(`/${targetBaseStem}.js"`) ||
168
+ evidence.includes(`/${targetBaseStem}.js'`));
169
+ if (!matchesSymbol && !matchesModuleImport)
162
170
  continue;
163
171
  results.push({
164
172
  file,
@@ -239,6 +247,7 @@ export function deliverProgressiveEvidence(request) {
239
247
  let more = request.level !== "expand";
240
248
  let outline;
241
249
  let related;
250
+ let dependentsSummary;
242
251
  let source;
243
252
  let sourceRange;
244
253
  let nextLine = 1;
@@ -304,22 +313,35 @@ export function deliverProgressiveEvidence(request) {
304
313
  }
305
314
  totalItems = lines.length;
306
315
  }
307
- if (request.level === "expand") {
316
+ if (request.level === "expand" || request.includeDependentsSummary) {
308
317
  const allRelated = findRelated(root, relative, lines);
309
- const offset = pagingHandle?.relatedOffset ?? 0;
310
- const sourceItems = sourceRange ? sourceRange.endLine - sourceRange.startLine + 1 : 0;
311
- const remainingItems = Math.max(0, itemLimit - sourceItems);
312
- related = nextLine > lines.length ? allRelated.slice(offset, offset + remainingItems) : [];
313
- if (related.length > 0) {
314
- returned = [...returned, "related"];
315
- confidence = "heuristic";
318
+ if (request.includeDependentsSummary) {
319
+ dependentsSummary = {
320
+ sourceFiles: [
321
+ ...new Set(allRelated.filter((r) => r.kind === "source-reference").map((r) => r.file)),
322
+ ],
323
+ testFiles: [
324
+ ...new Set(allRelated.filter((r) => r.kind === "test-reference").map((r) => r.file)),
325
+ ],
326
+ totalReferences: allRelated.length,
327
+ };
316
328
  }
317
- if (offset + related.length < allRelated.length) {
318
- omitted = [...omitted, "related-tail"];
319
- more = true;
320
- reason = "hard-item-budget";
329
+ if (request.level === "expand") {
330
+ const offset = pagingHandle?.relatedOffset ?? 0;
331
+ const sourceItems = sourceRange ? sourceRange.endLine - sourceRange.startLine + 1 : 0;
332
+ const remainingItems = Math.max(0, itemLimit - sourceItems);
333
+ related = nextLine > lines.length ? allRelated.slice(offset, offset + remainingItems) : [];
334
+ if (related.length > 0) {
335
+ returned = [...returned, "related"];
336
+ confidence = "heuristic";
337
+ }
338
+ if (offset + related.length < allRelated.length) {
339
+ omitted = [...omitted, "related-tail"];
340
+ more = true;
341
+ reason = "hard-item-budget";
342
+ }
343
+ totalItems = lines.length + allRelated.length;
321
344
  }
322
- totalItems = lines.length + allRelated.length;
323
345
  }
324
346
  }
325
347
  let nextLevel;
@@ -370,6 +392,7 @@ export function deliverProgressiveEvidence(request) {
370
392
  location: { path: relative, lines: lines.length },
371
393
  ...(outline ? { outline } : {}),
372
394
  ...(related ? { related } : {}),
395
+ ...(dependentsSummary ? { dependentsSummary } : {}),
373
396
  ...(source !== undefined ? { source, sourceRange } : {}),
374
397
  budget: {
375
398
  byteLimit,
@@ -154,6 +154,31 @@ export function sessionTelemetryStatus(repo, retentionDays) {
154
154
  adoption: summarizeAdoption(records),
155
155
  };
156
156
  }
157
+ export function hasTurnEvidenceBeforeEdit(repo, sessionId) {
158
+ if (!enabled(repo) || !sessionId)
159
+ return false;
160
+ const targetSession = sessionHash(repo, sessionId);
161
+ const events = readSessionEvents(repo);
162
+ const evidenceOperations = new Set(["context", "explain", "review", "map", "search", "query"]);
163
+ let hasEvidence = false;
164
+ for (const event of events) {
165
+ if (event.session !== targetSession)
166
+ continue;
167
+ if (event.event === "turn_start" || event.event === "turn_end") {
168
+ hasEvidence = false;
169
+ }
170
+ else if ((event.event === "tool_start" || event.event === "tool_success") &&
171
+ event.toolCategory === "knodin" &&
172
+ event.operation !== undefined &&
173
+ evidenceOperations.has(event.operation)) {
174
+ hasEvidence = true;
175
+ }
176
+ }
177
+ return hasEvidence;
178
+ }
179
+ export function isSessionTelemetryEnabled(repo) {
180
+ return enabled(repo);
181
+ }
157
182
  export function clearSessionTelemetry(repo) {
158
183
  const filePath = target(repo, EVENTS);
159
184
  const records = readSessionEvents(repo).length;
@@ -9,6 +9,7 @@
9
9
  import fs from "node:fs";
10
10
  import nodePath from "node:path";
11
11
  import { fileURLToPath } from "node:url";
12
+ import { deriveStatusNextAction } from "../agent-events.js";
12
13
  import { ClassConsumerQueryError, } from "../class-consumer-contract.js";
13
14
  import { readClassConsumerCursor } from "../class-consumer-cursor.js";
14
15
  import { validateClassConsumerDelivery } from "../class-consumer-delivery.js";
@@ -1644,6 +1645,7 @@ async function dispatchKnodinTool(args, qualifiedCompactFallback = false) {
1644
1645
  case "status":
1645
1646
  return engine.status(repo, { audit: statusAudit }).then((result) => bounded({
1646
1647
  ...attachLifecycleHealth(repo, result),
1648
+ nextAction: deriveStatusNextAction(result),
1647
1649
  integration: inspectRepositoryIntegrationStatus(repo),
1648
1650
  update: {
1649
1651
  ...trustedUpdateStatus({
@@ -0,0 +1,30 @@
1
+ # knodin 0.14.1
2
+
3
+ Compatible security patch release for EASFDC-8539, EASFDC-8540,
4
+ EASFDC-8541, EASFDC-8546, EASFDC-8547, EASFDC-8549, EASFDC-8551,
5
+ EASFDC-8559, and EASFDC-8687.
6
+
7
+ ## Security dependency updates
8
+
9
+ - Require `adm-zip` 0.6.1 or newer, removing the vulnerable 0.6.0 transitive
10
+ resolution used by `onnxruntime-node`.
11
+ - Require `fast-uri` 4.1.3 or newer; the resolved version is 4.2.1.
12
+ - Require `qs` 6.16.0 or newer for the MCP SDK, Express, and body-parser
13
+ dependency paths.
14
+ - Update the cross-repository Fastify fixture to 5.12.1 so security scanning
15
+ no longer reports the intentionally indexed fixture as vulnerable.
16
+
17
+ `npm audit` reports zero known vulnerabilities for the release lockfile.
18
+
19
+ ## Performance regression evidence
20
+
21
+ The malformed-MSBuild regression now measures the production reference parser
22
+ directly at Knodin's 1 MiB indexing limit. The parser completes in milliseconds
23
+ under the 2.5-second ceiling, and a separate scaling assertion rejects the old
24
+ quadratic behavior. End-to-end graph persistence remains covered independently
25
+ so database and engine startup do not distort the parser security gate.
26
+
27
+ ## Compatibility
28
+
29
+ This patch changes no CLI, MCP, graph schema, or stored-data contract. Existing
30
+ 0.14.0 graphs remain compatible and require no migration.
@@ -0,0 +1,72 @@
1
+ # knodin 0.14.2
2
+
3
+ Compatible feature and governance release for KNODIN-61, KNODIN-62, KNODIN-52,
4
+ KNODIN-60, KNODIN-63, KNODIN-53, KNODIN-58, KNODIN-57, KNODIN-54, and KNODIN-59.
5
+
6
+ ## Typed target uncertainty & affected-test attribution (KNODIN-61, ADR 008)
7
+
8
+ - `explain` (`affectedTests` and `testCoverage`) and `query impact` now emit a
9
+ typed `targetUncertainty` envelope (`exact-resolved`, `ambiguous-candidates`,
10
+ `dynamic-or-unresolved`, `stale-or-partial-scope`) preserving candidate
11
+ declarations, unknown call sites, and confidence qualifications across hops.
12
+ - Indirect test callers are traced through enclosing helper symbols up to 4 hops
13
+ with `hopDistance`, `confidence`, and `viaSymbols` provenance.
14
+ - `testCoverage.untested` is `true` only when `targetUncertainty.status === "exact-resolved"`
15
+ and zero direct or indirect test callers exist; under ambiguity, dynamic
16
+ targets, or partial index scope, `untested` is `null` with an explicit
17
+ `uncertaintyReason`.
18
+
19
+ ## Module-importer blast radius & progressive evidence dependents (KNODIN-62, KNODIN-52)
20
+
21
+ - `search` (`expandBy > 0`) and `explain` (`blastRadius`) now expand across
22
+ `dependencies` (`importers_of`) when an importing module references the target
23
+ symbol as an identifier token, surfacing non-call consumers of exported
24
+ constants, types, and schemas.
25
+ - `deliverProgressiveEvidence` supports `includeDependentsSummary?: boolean` and
26
+ attaches `dependentsSummary` (`sourceFiles`, `testFiles`, `totalReferences`) to
27
+ `L0` and `L1` slices without requiring `L2` body expansion.
28
+ - Added the historical pre-fix retrieval evaluation engine
29
+ (`src/engine/historical-retrieval-eval.ts`) enforcing pre-fix parent-SHA
30
+ isolation, leaky-prompt rejection, and hit@k/recall@k/MRR scoring against a
31
+ lexical baseline.
32
+
33
+ ## Semantic graph-delta review (KNODIN-60)
34
+
35
+ - `review` now computes a `semanticDelta` report (`src/engine/semantic-graph-delta.ts`)
36
+ comparing pre-revision and post-revision AST symbol snapshots across changed
37
+ files.
38
+ - Entities are classified into `id-churn` (`semanticallyUnchanged: true` for
39
+ line-number, whitespace, or comment shifts), `renamed`, `modified`, `added`,
40
+ `removed`, and `ambiguous-same-label` (quarantined rather than guessed), with
41
+ `edge-retargeted` detection, `split-suggestion` and `merge-suggestion`
42
+ heuristics, and `baselineComparison` metrics against raw file-diff review.
43
+
44
+ ## Multi-client lifecycle hooks, PreToolUse nudges & status guidance (KNODIN-63)
45
+
46
+ - `knodin agent-hooks install|status|uninstall --client <client>` now supports
47
+ `claude`, `gemini`, `codex`, `copilot`, and `antigravity` user-global hook
48
+ configurations with atomic writes, backups, idempotent merging, and symlink
49
+ refusal.
50
+ - `knodin agent-event pre-tool` emits a non-blocking `PreToolUse`
51
+ `additionalContext` tip when an edit tool (`Edit`, `Write`, `NotebookEdit`,
52
+ `MultiEdit`) is invoked in a session with opt-in local telemetry enabled and
53
+ no prior `knodin` evidence call in the current turn.
54
+ - CLI and MCP `status` responses now include context-sensitive `nextAction`
55
+ guidance.
56
+
57
+ ## Direct-index memory envelope & governance evaluators (KNODIN-53, KNODIN-58, KNODIN-57, KNODIN-54, KNODIN-59)
58
+
59
+ - `resolveParsePoolSize` (`src/engine/parse-pool-resources.ts`) enforces
60
+ `memoryBudgetBytes` (or `KNODIN_PARSE_POOL_MEMORY_BUDGET_MB`) and
61
+ `parentHeadroomBytes`, clamping `KNODIN_PARSE_POOL_MAX_WORKERS` so an override
62
+ cannot defeat an explicit memory budget, paired with
63
+ `evaluateDirectIndexMemoryEnvelope` for typed `budget-exceeded` reporting.
64
+ - Added `src/engine/retrieval-governance-eval.ts` covering caller-deadline
65
+ retrieval delivery scoring (`KNODIN-58`), behavior-preserving refactor and
66
+ observed side-effect coverage (`KNODIN-57`), and source-linked learning-path
67
+ and body-hash journey freshness evaluation (`KNODIN-54`, `KNODIN-59`).
68
+
69
+ ## Compatibility
70
+
71
+ This release is backward-compatible with existing 0.14.x graphs and requires no
72
+ database migration.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "knodin",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "knodin": {
5
- "compatibility": "breaking"
5
+ "compatibility": "compatible"
6
6
  },
7
7
  "description": "knodin — source-evidenced local code intelligence with known bounds. Stable identity, fresh evidence, truthful budgets, and recoverable bounded views.",
8
8
  "license": "MIT",
@@ -75,6 +75,8 @@
75
75
  "docs/releases/0.13.0.md",
76
76
  "docs/releases/0.13.1.md",
77
77
  "docs/releases/0.14.0.md",
78
+ "docs/releases/0.14.1.md",
79
+ "docs/releases/0.14.2.md",
78
80
  "docs/releases/0.3.0.md",
79
81
  "docs/releases/0.4.0.md",
80
82
  "docs/releases/0.4.1.md",
@@ -194,8 +196,9 @@
194
196
  },
195
197
  "overrides": {
196
198
  "@hono/node-server": "^2.0.5",
197
- "adm-zip": "^0.6.0",
198
- "fast-uri": "^4.1.1",
199
+ "adm-zip": "^0.6.1",
200
+ "fast-uri": "^4.1.3",
201
+ "qs": "^6.16.0",
199
202
  "sharp": "^0.35.4"
200
203
  },
201
204
  "devDependencies": {
@@ -199,18 +199,18 @@ new items or strengthen existing ones; they do not reopen the archived roadmap.
199
199
  - Priority: P1
200
200
  - DependsOn: C3, C16, C61, C93, C95
201
201
  - Evidence: `src/agent-hooks.ts`, `src/agent-events.ts`,
202
- `src/session-telemetry.ts`, focused unit/CLI tests, and
202
+ `src/session-telemetry.ts`, `src/__tests__/unit/agent-hooks.spec.ts`,
203
+ `src/__tests__/unit/agent-events.spec.ts`, and
203
204
  `benchmarks/evaluations/c102-session-adoption/README.md`.
204
- - Implementation: an explicit user-global Claude hook installer atomically
205
+ - Implementation: an explicit user-global hook installer (`knodin agent-hooks install --client claude|gemini|codex|copilot|antigravity`, `KNODIN-63`) atomically
205
206
  preserves unrelated settings and supports status, dry-run, and targeted
206
- uninstall. SessionStart injects cached, freshness-aware orientation under
207
- 600 tokens, 8 KiB, and 12 items. Separate repository-local telemetry opt-in
207
+ uninstall across all 5 supported coding-agent clients. SessionStart injects cached, freshness-aware orientation under
208
+ 600 tokens, 8 KiB, and 12 items. PreToolUse emits a non-blocking evidence nudge when an edit tool (`Edit`, `Write`, `NotebookEdit`, `MultiEdit`) is invoked without a prior `knodin` evidence operation in the current turn (`KNODIN-63`). Separate repository-local telemetry opt-in
208
209
  records private lifecycle categories and extends the existing local report.
209
210
  - Bounds: ordinary hooks prove neither task success nor why a follow-up turn
210
211
  occurred. The dashboard labels corrective round trips unavailable, stores no
211
212
  prompt/source/command/transcript/tool-output bodies, and authorizes no
212
- productivity or superiority claim. Claude is the only supported client for
213
- this adapter; the event model remains client-neutral for later evaluation.
213
+ productivity or superiority claim.
214
214
 
215
215
  ## Roadmap completion contract
216
216
 
@@ -706,6 +706,8 @@ The durable handoff index is
706
706
  hotspots, entry points, languages, and path scope.
707
707
  4. Results satisfy C11 precision fixtures and C3 budgets.
708
708
 
709
+ Target-uncertainty and affected-test extension: [KNODIN-61 — typed target uncertainty through affected-test selection](typed-target-uncertainty-test-selection-acceptance.md). Implemented in `src/engine/target-uncertainty.ts` and `src/__tests__/unit/target-uncertainty.spec.ts`; preserves exact, possible-set, and unknown call/test distinctions across C11/C13 and ADR 008.
710
+
709
711
  ---
710
712
 
711
713
  ## C14 — Portable budgeted context export
@@ -1186,6 +1188,8 @@ workflow correction before any new surface area is added.
1186
1188
  4. A replay declares success only when knodin meets the oracle and normalized
1187
1189
  budget; any competitor prerequisite failure is preserved as a blocker.
1188
1190
 
1191
+ Semantic graph-delta review extension: [KNODIN-60 — before/after entity identity and ambiguity alignment](semantic-graph-delta-acceptance.md). Implemented in `src/engine/semantic-graph-delta.ts` and `src/__tests__/unit/semantic-graph-delta.spec.ts`; classifies harmless ID churn, true renames, edge retargets, ambiguous same-label nodes, and split/merge suggestions.
1192
+
1189
1193
  ### C27 — Prove architecture and community-analysis leadership
1190
1194
 
1191
1195
  - Status: implemented
@@ -1252,6 +1256,8 @@ workflow correction before any new surface area is added.
1252
1256
  4. The replay establishes a win only with oracle parity or better and no
1253
1257
  regression to C3 budgets.
1254
1258
 
1259
+ Historical-task extension: [KNODIN-52 — issue-derived pre-fix retrieval evaluation](historical-retrieval-evaluation.md) and [KNODIN-62 — module importer and non-call dependent expansion](https://docusign.atlassian.net/browse/KNODIN-62). Implemented in `src/engine/historical-retrieval-eval.ts`, `src/engine/index.ts`, `src/progressive-evidence.ts`, and `src/__tests__/unit/historical-retrieval.spec.ts`; reuses C28 and separately judges unchanged helper/test relevance.
1260
+
1255
1261
  ### C29 — Prove context-packing and export leadership
1256
1262
 
1257
1263
  - Status: implemented
@@ -1716,7 +1722,9 @@ workflow correction before any new surface area is added.
1716
1722
  - Evidence: `benchmarks/competitors/MEASUREMENT-CONTRACT.md` and shared sampling
1717
1723
  record three warmups, at least 20 warm samples, raw values, p50/p95/range,
1718
1724
  independently attributed RSS, descendant cleanup, and atomic partial
1719
- summaries across all 11 adapters.
1725
+ summaries across all 11 adapters. Caller-deadline retrieval delivery scoring
1726
+ (`KNODIN-58`) is specified in `roadmap/caller-deadline-retrieval-evidence.md`
1727
+ and verified in `src/__tests__/unit/parse-pool-resources.spec.ts`.
1720
1728
  - Touches: shared competitive measurement helper, competitor adapters,
1721
1729
  `scripts/competitive-bakeoff.ts`, lifecycle runner, normalized summaries and
1722
1730
  tests
@@ -2716,7 +2724,11 @@ remains explicitly reported as a persistent-graph tradeoff.
2716
2724
  commit `c981480db89ffbbb646206a73660e9ab842686ba`
2717
2725
  - Scope: portfolio discovery, selection, initialization, lifecycle truth,
2718
2726
  diagnostics, and Salesforce metadata candidate quality.
2719
- - C75 Evidence: `docs/evidence/portfolio-initialization-2026-07-31.md`
2727
+ - C75 Evidence: `docs/evidence/portfolio-initialization-2026-07-31.md`,
2728
+ `roadmap/direct-index-memory-envelope.md` (`KNODIN-53`),
2729
+ `roadmap/behavior-preserving-refactor-contract.md` (`KNODIN-57`),
2730
+ `roadmap/source-linked-learning-path-evaluation.md` (`KNODIN-54`), and
2731
+ `roadmap/source-linked-journey-explanation-evaluation.md` (`KNODIN-59`).
2720
2732
 
2721
2733
  The candidate commit proves that a 256 MiB subprocess buffer, early selection,
2722
2734
  and sequential inventory can discover the current 61-repository portfolio, but
@@ -3704,7 +3716,7 @@ evidence, not an outcome or superiority benchmark. Client UI labels may vary by
3704
3716
  version and must name the version actually checked.
3705
3717
 
3706
3718
  Parking decision: C94 remains open behind C91. The existing local help and
3707
- documentation remain available, but no fixture is promoted into the missing
3719
+ documentation remain available (including `nextAction` guidance on CLI and MCP `status` responses via `deriveStatusNextAction` in `KNODIN-63`), but no fixture is promoted into the missing
3708
3720
  native client demonstration or certification evidence.
3709
3721
 
3710
3722
  ### C95 — Defensible behavioral-contract replay