knodin 0.12.2 → 0.13.1

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 (58) hide show
  1. package/README.md +16 -1
  2. package/dist/bin/cli.js +245 -18
  3. package/dist/src/agent-events.js +25 -7
  4. package/dist/src/authenticated-cursor.js +81 -0
  5. package/dist/src/backup-retention.js +345 -12
  6. package/dist/src/class-consumer-contract.js +18 -0
  7. package/dist/src/class-consumer-cursor.js +91 -0
  8. package/dist/src/class-consumer-delivery.js +22 -0
  9. package/dist/src/class-consumer-page.js +148 -0
  10. package/dist/src/cli-model.js +21 -3
  11. package/dist/src/docs-sections.js +1 -0
  12. package/dist/src/engine/apex-class-uses.js +430 -0
  13. package/dist/src/engine/apex-entry-points.js +98 -0
  14. package/dist/src/engine/apex-receiver.js +301 -0
  15. package/dist/src/engine/candidate-database.js +624 -66
  16. package/dist/src/engine/embedding-reuse.js +57 -0
  17. package/dist/src/engine/embeddings.js +22 -0
  18. package/dist/src/engine/index-coverage.js +215 -0
  19. package/dist/src/engine/index.js +3854 -448
  20. package/dist/src/engine/salesforce-components.js +460 -0
  21. package/dist/src/engine/seal.js +3 -0
  22. package/dist/src/engine/sqlite.js +44 -0
  23. package/dist/src/engine/state-paths.js +192 -31
  24. package/dist/src/evidence-bundle.js +283 -0
  25. package/dist/src/evidence-graph.js +163 -0
  26. package/dist/src/failure-diagnosis.js +80 -5
  27. package/dist/src/file-dependency.js +35 -0
  28. package/dist/src/graph-query-health.js +47 -1
  29. package/dist/src/implementation-search.js +69 -0
  30. package/dist/src/index-coverage-read.js +33 -0
  31. package/dist/src/investigation.js +195 -0
  32. package/dist/src/manager-update.js +9 -10
  33. package/dist/src/mcp-reliability.js +4 -0
  34. package/dist/src/mcp-worker-supervisor.js +122 -6
  35. package/dist/src/mirror.js +2 -0
  36. package/dist/src/progressive-evidence.js +4 -4
  37. package/dist/src/response-budget.js +129 -3
  38. package/dist/src/server.js +18 -5
  39. package/dist/src/shared-index/publisher.js +41 -1
  40. package/dist/src/shared-index/restore.js +16 -6
  41. package/dist/src/storage-budget.js +146 -0
  42. package/dist/src/storage-inventory.js +263 -0
  43. package/dist/src/storage-management.js +204 -0
  44. package/dist/src/storage-policy-contract.js +121 -0
  45. package/dist/src/tools/knodin-tools.js +224 -41
  46. package/dist/src/worktree-seed.js +7 -1
  47. package/docs/BACKUP-RETENTION.md +46 -2
  48. package/docs/CLI.md +98 -2
  49. package/docs/MCP.md +75 -0
  50. package/docs/PROGRESSIVE-EVIDENCE.md +62 -0
  51. package/docs/SALESFORCE-BINDINGS.md +121 -0
  52. package/docs/SALESFORCE-DEAD-CODE.md +45 -0
  53. package/docs/SCOPED-INDEXING.md +76 -0
  54. package/docs/apex-receiver-resolution.md +41 -0
  55. package/docs/releases/0.13.0.md +62 -0
  56. package/docs/releases/0.13.1.md +216 -0
  57. package/docs/structural-only-indexing.md +20 -0
  58. package/package.json +12 -4
@@ -0,0 +1,216 @@
1
+ # knodin 0.13.1
2
+
3
+ Compatible patch release for KNODIN-47 and KNODIN-48: correct false stale
4
+ evidence after repair and bound managed graph storage.
5
+
6
+ ## Fixed
7
+
8
+ - Align freshness probes with source-indexing eligibility. Non-source files and
9
+ collapsed untracked directories no longer make an unchanged, repaired graph
10
+ appear stale.
11
+ - Preserve exact Git paths, including renames and names containing whitespace,
12
+ and exclude canonical pruned trees before expanding untracked files.
13
+ - Track relevant `.gitignore` rules, including tracked policy files omitted by
14
+ Git's stat cache, Git's local exclude file, and its
15
+ effective global exclude file with bounded reads. Retain previously indexed
16
+ paths for deletion detection and respect scoped-index path safety.
17
+ - Encode dirty path sets without newline collisions. Failed Git or ignore-policy
18
+ checks remain unknown, including Git checkouts without their first commit.
19
+ - Reindex relevant dirty or committed-diff source before accepting a repaired
20
+ baseline, so restored file sizes and timestamps cannot hide source changes.
21
+ Repair's initial audit also checks change times against the completed source snapshot,
22
+ covering source edits omitted by Git's stat-cache shortcuts.
23
+ Verify source and Git stability before publishing the baseline; unresolved
24
+ historical evidence requires explicit recovery rather than a false success.
25
+ - Preserve first-time repair of an empty graph while refusing to guess missing
26
+ history or refresh timestamps for an existing graph.
27
+ - Preserve completed-file resume behavior in direct-engine repairs with content
28
+ proofs that are invalidated by later index writes. Public repair retains its
29
+ atomic candidate cancellation behavior.
30
+ - Separate repair's content-proof epoch from ordinary reconciliation timestamps.
31
+ Existing non-empty Git graphs need a one-time `knodin index --clean` before
32
+ this versioned proof is established. Status, query freshness, and repair
33
+ refuse to certify missing, malformed, or future-dated provenance rather than
34
+ trusting a legacy timestamp.
35
+ - Force-reindex paths that Git reports changed, even when size and timestamp
36
+ match the indexed tuple, so ordinary reconciliation cannot retain old symbols.
37
+ - Establish Knodin's existing repository-local state exclusion before candidate
38
+ indexing and repair record their policy baseline.
39
+ - Accept the platform null device as an empty global Git exclude policy, and
40
+ retain the documented bounded stat fallback for verified nested Git paths.
41
+ - Bound new manifest eligibility reads together with ignore-policy reads. When
42
+ the freshness budget is exceeded, report unknown; explicitly index a large
43
+ new manifest before relying on automatic freshness for it.
44
+ - Revalidate already-dirty source content with a bounded proof (at most 256
45
+ paths and 1 MiB per probe). Over-budget content or unreliable Git stat settings
46
+ remain unknown on the cheap freshness path. A complete deep audit can verify
47
+ the retained source snapshot; unknown is not evidence that nothing changed.
48
+ - Validate clean-build resume provenance strictly, preserve the original HEAD,
49
+ recheck equal-stat source edits, and remove deleted paths before promotion.
50
+ Source/Git changes during clean indexing or final promotion refuse publication
51
+ of the candidate rather than minting a proof over a mixed snapshot.
52
+ - Preserve verified parsed-source proofs when seeding an unchanged linked
53
+ worktree. Missing, malformed, or mismatched copied proofs require extraction;
54
+ omitted equal-stat source edits cannot retain stale sibling symbols.
55
+ - Reuse scoped, canonically pruned Git enumeration for cold reconciliation,
56
+ including unborn repositories. Failed or over-budget working-tree/commit-diff
57
+ enumeration cannot advance the stored HEAD or freshness baseline. Missing
58
+ shallow/foreign commit history requires explicit clean-index recovery rather
59
+ than a stat-only fallback that misses equal-stat source edits.
60
+ - Withhold a first scoped content-proof epoch after unhealthy verification or
61
+ an exception, including failures after the deep audit completes. Existing
62
+ verified epochs are not deleted by failed scope widening.
63
+ - Preserve structural revisions and Apex consumer paging snapshots across
64
+ unchanged cold opens, including unborn Git repositories. Canonical discovery
65
+ and relationship/semantic maintenance always run; only unchanged file
66
+ extraction is skipped using an exact retained parsed-source proof. Missing,
67
+ malformed, or changed per-file evidence forces extraction. The extraction
68
+ fence also retains proof before a repository epoch exists, using bounded-memory
69
+ streaming reads before and after parsing (additional source I/O, not a measured
70
+ performance gain). Failed extraction cannot publish a new per-file proof;
71
+ aggregate completion still requires healthy verification.
72
+ Worker-queued inputs also retain pre/post-parse source fences; per-queued-file
73
+ metadata scales with the source inventory, while streaming uses a 64 KiB read
74
+ buffer. Successful batched writes retain their parsed proofs; rolled-back
75
+ file writes cannot regain a proof at the batch boundary.
76
+ Stable unparsed/skipped source reads also retain their consumed-source proof
77
+ after pre/post-read verification; extraction and database-write errors do not.
78
+ Batch write failures retain successful per-file work but refuse aggregate
79
+ completion before publishing an epoch or baseline; resolve the write error
80
+ and retry indexing. A failed candidate is not promoted over the active graph.
81
+
82
+ ## Storage stewardship (KNODIN-48)
83
+
84
+ New successfully indexed stores receive a repository-local storage policy:
85
+ one recoverable promotion backup, a 1 GiB allocated-backup budget, and a
86
+ 512 MiB free-space reserve. Count/byte budgets override the age grace period.
87
+ Cleanup runs after durable promotion and operation-lease release; cleanup
88
+ failures are reported without rolling back the committed graph. The newest
89
+ snapshot and an integrity-checked rollback remain protected, even when that
90
+ requires reporting an over-budget condition instead of deleting recovery data.
91
+
92
+ Existing unmanaged stores are not silently migrated. Run
93
+ `knodin backups policy preview /path/to/repo --json`, inspect exact candidates,
94
+ then `knodin backups policy apply /path/to/repo --json` to consent. Existing
95
+ explicit dry-run/disabled policies remain respected. Configure limits with
96
+ `--max-count`, `--max-bytes`, and `--reserve-bytes`; `--mode preview` or
97
+ `--mode disabled` records the corresponding maintenance choice.
98
+
99
+ Automatic cleanup rechecks effective policy under its lease before deletion.
100
+ New-store initialization eligibility is durably recorded in the graph before
101
+ publication and survives later clean replacement if policy publication fails;
102
+ successful initialization clears it, so deliberate policy removal stays unmanaged.
103
+ Clearing this internal marker preserves an already validated graph audit and its
104
+ original timestamp across clean close/reopen; concurrent database changes refuse
105
+ audit carry-forward rather than being labeled as previously verified.
106
+ Policy reads use the shared external-state resolver for registered mirrors;
107
+ policy initialization, apply, and automatic cleanup refuse mirror source writes,
108
+ including source aliases. Unsupported Windows directory syncing does not turn
109
+ an already file-synced policy publication into failure; other I/O errors remain visible.
110
+
111
+ Candidate creation and repair's VACUUM preflight require conservatively
112
+ estimated scratch space plus the reserve. Unknown capacity or allocated-size
113
+ measurements fail closed before allocating scratch. This is an estimate, not
114
+ a disk reservation; ENOSPC and concurrent writers can still cause refusal.
115
+ Bounded candidate sweeping removes only managed empty/audit-only residue with
116
+ a validated marker and confirmed exited owner. Unknown legacy owners and
117
+ DB-bearing resumable candidates are preserved. Inventory distinguishes apparent from
118
+ allocated bytes; APFS shared extents mean allocated totals are not guaranteed
119
+ physical reclamation. External source mirrors and development acceptance
120
+ directories are not graph backups and are not blanket-deleted by this policy.
121
+ Candidate allocation revalidates the managed root and new directory before any
122
+ owner or database write. JSON-manifest eligibility uses a no-follow descriptor
123
+ with final pathname identity checks. Shared-index restore always releases its
124
+ lifecycle lease and invokes post-promotion storage finalization even when cache
125
+ lease release or candidate cleanup fails.
126
+
127
+ The release auto-merge dispatch retains exact-SHA, unresolved-conversation,
128
+ local final-gate, approval, and atomic-merge protections when Copilot review is
129
+ unavailable because its AI-credit budget is exhausted. The explicit fallback
130
+ reason is opt-in; ordinary dispatches still require a clean exact-head review.
131
+ The exhausted-credit path also covers a new PR for which Copilot cannot create
132
+ any review object; an exact-head review containing findings still blocks merge.
133
+ The dispatch runs on the organization's approved self-hosted Linux pool so IP
134
+ allow-list enforcement does not prevent it from reading or merging its own PR.
135
+ The tagged release verifier allows 45 minutes for the same full-suite workload,
136
+ preventing a successful test run from being cancelled by the former 30-minute cap.
137
+
138
+ ## Release verification
139
+
140
+ Release-candidate pushes run full coverage without repeatedly scanning Sonar. After the current
141
+ PR head has completed review, maintainers run `npm run release:verify` locally; it runs full
142
+ coverage and the local Sonar quality gate, refuses a dirty tracked tree or remote-head mismatch,
143
+ and records the exact verified SHA in Git-local metadata. Any later commit invalidates that result.
144
+ The gate also refuses branch changes and ambiguous remote references. Isolated
145
+ subprocess regressions cover preflight refusals, verification failures, SHA drift,
146
+ and the evidence payload without invoking real scans.
147
+
148
+ Ordinary PR pushes no longer enable auto-merge. Maintainers explicitly dispatch
149
+ the auto-merge workflow with the PR number and exact SHA only after independently
150
+ verifying clean current-head review and successful local final-gate evidence.
151
+ The dispatch checks the live open PR head; it does not authenticate local evidence
152
+ or replace protected-branch checks.
153
+
154
+ Regression coverage includes repeated cold status checks after repair, genuine
155
+ source edits, ignore-policy changes, scoped paths, symlinks, JSON eligibility,
156
+ and unusual filenames. A freshness-only development build was also verified
157
+ against SalesforceCI's approximately 903,000-file graph: repair completed, then
158
+ two separate-process status checks reported healthy and fresh without changing
159
+ repository source files or existing working-tree edits.
160
+
161
+ That acceptance establishes the reported repair/status defect, not a complete
162
+ cross-repository init/repair/status certification or a general performance gain.
163
+ Real source changes still require graph refresh. After upgrading an affected
164
+ checkout, run `knodin repair`. If it reports that content provenance is missing,
165
+ run the requested one-time `knodin index --clean`; then run `knodin status`.
166
+
167
+ ## Additional review safety fixes
168
+
169
+ Already-dirty source proofs reject symlinked paths and recheck held-file identity
170
+ and change time; an unverifiable path reports unknown rather than false freshness.
171
+ Candidate reads and promotion fences retain no-follow descriptor evidence.
172
+ Interrupted candidates with unknown/live owners or nonselected databases are
173
+ preserved rather than recursively discarded. Failed promotion rollback preserves
174
+ uncertain files and a repair-needed marker for manual inspection instead of
175
+ automatically accepting a substituted graph. These are boundary checks, not an
176
+ atomic filesystem reservation against concurrent pathname changes.
177
+
178
+ Mirror identities use the generated `repo_<20 hexadecimal characters>` format.
179
+ Malformed/unreadable registries fail closed; registry writes reject unsafe targets
180
+ and publish through an exclusive temporary file. Managed staging/source guards
181
+ refuse symlink escapes and reject an unrelated clone path before it can be cached
182
+ as that mirror. Canonical aliases remain supported, and a missing clone remains
183
+ registered only at its deterministic managed path. Mirror indexing keeps graph
184
+ state out of source but does not opt read-only mirrors into managed backup-policy
185
+ initialization or report that intentional omission as failed maintenance.
186
+ Duplicate mirror identities or canonical clone paths are rejected before routing.
187
+ Owner-proven audit-only
188
+ quarantines remain discoverable and retryable after cleanup failure; unknown or
189
+ database-bearing quarantines remain preserved.
190
+
191
+ The local final gate uses the existing npm coverage command without requiring Bun.
192
+ The privileged merge action is pinned to an immutable upstream commit.
193
+
194
+ Repair snapshot proofs now use component-wise no-follow source checks and bind
195
+ the opened descriptor to the final pathname across the complete read. Storage
196
+ policy reads similarly reject atomic pathname replacement, and applied policy
197
+ changes share the cleanup lifecycle lease so deletion cannot continue under
198
+ superseded consent.
199
+
200
+ Opportunistic global retention respects configured roots and depth and revalidates
201
+ installed consent under its deletion lease. Direct candidate cleanup refuses
202
+ read-only mirrors. Seeded worktree promotions run the same post-audit storage
203
+ finalizer, with durable retry after policy publication failure. Read-only mirror
204
+ inventory measures exact backups in resolved external state, not source decoys.
205
+
206
+ Global policy resolution and opportunistic retention share the same bounded scope
207
+ check; scheduled and opportunistic deletion share lease-time consent validation.
208
+ Mirror aliases resolve through one canonical identity seam. Mirror allocation
209
+ previews external backup quotas, while deletion remains refused. Any skipped or
210
+ unverified rollback inventory blocks managed allocation. Failed policy writes
211
+ clean their unpublished temporary files. A healthy applicable bounded global
212
+ policy can manage a new store without materializing a local policy file.
213
+ Shared-index restores and committed worktree seeds now finalize pending storage
214
+ policy and maintenance after promotion, including a failed post-promotion status
215
+ check. Release dispatch uses GitHub's exact-SHA merge precondition rather than
216
+ arming unbound auto-merge; a changed head requires fresh review and verification.
@@ -0,0 +1,20 @@
1
+ # Structural-only indexing
2
+
3
+ Use `knodin index --skip-embeddings` to build native structure without running
4
+ semantic inference. It also works with `--clean`/`--force`, explicit file paths,
5
+ and `--under <directory>`. Scoped indexing still discovers the repository file
6
+ inventory before filtering; it is not a constant-time directory operation.
7
+
8
+ Intentional deferral is persisted in the local graph. Reopening the graph for a
9
+ structural query, read-side reconciliation, or watcher updates does not silently
10
+ complete the semantic backlog. Semantic readiness remains `absent` or `partial`
11
+ until the missing vectors are built; semantic retrieval may under-return.
12
+
13
+ Run an explicit `knodin index` without `--skip-embeddings` to resume inference.
14
+ An explicit-file index without the flag also completes the missing-vector pass,
15
+ including deferred symbols outside those files. Existing vectors are retained.
16
+
17
+ A deferred clean candidate must still pass SQLite, source coverage, source
18
+ snapshot, and orphan checks before promotion. Only the requirement for complete
19
+ semantic coverage is waived for an intentionally deferred graph. An interrupted
20
+ ordinary semantic build does not gain that exemption.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knodin",
3
- "version": "0.12.2",
3
+ "version": "0.13.1",
4
4
  "knodin": {
5
5
  "compatibility": "compatible"
6
6
  },
@@ -46,12 +46,17 @@
46
46
  "docs/PT-ACCESS-RECOMMENDATION.md",
47
47
  "docs/RELEASE-0.3-EVIDENCE.md",
48
48
  "docs/REPOSITORIES-AND-WORKTREES.md",
49
+ "docs/SALESFORCE-BINDINGS.md",
50
+ "docs/SALESFORCE-DEAD-CODE.md",
51
+ "docs/SCOPED-INDEXING.md",
49
52
  "docs/SCIP-IMPORT.md",
50
53
  "docs/SHARED-INDEX-CONTRACT.md",
51
54
  "docs/SIGNED-UPDATES.md",
52
55
  "docs/SYSTEMS-AND-RELATIONSHIPS.md",
53
56
  "docs/TELEMETRY.md",
54
57
  "docs/TOKEN-OPTIMIZER-SCORECARD.md",
58
+ "docs/apex-receiver-resolution.md",
59
+ "docs/structural-only-indexing.md",
55
60
  "docs/assets/knodin-favicon.svg",
56
61
  "docs/prompts/declare-multi-repository-system.md",
57
62
  "docs/releases/0.10.0.md",
@@ -67,6 +72,8 @@
67
72
  "docs/releases/0.12.0.md",
68
73
  "docs/releases/0.12.1.md",
69
74
  "docs/releases/0.12.2.md",
75
+ "docs/releases/0.13.0.md",
76
+ "docs/releases/0.13.1.md",
70
77
  "docs/releases/0.3.0.md",
71
78
  "docs/releases/0.4.0.md",
72
79
  "docs/releases/0.4.1.md",
@@ -115,6 +122,7 @@
115
122
  "test:watch": "vitest --watch",
116
123
  "test:coverage": "tsx scripts/run-vitest-shards.ts --coverage",
117
124
  "scan:sonar": "npm run test:coverage && sh scripts/run-sonar-scan.sh",
125
+ "release:verify": "tsx scripts/release-final-gate.ts",
118
126
  "mirror:sync": "sh tools/hooks/sync-ghes-mirror.sh",
119
127
  "test:pack-install": "tsx scripts/pack-install-smoke.ts",
120
128
  "test:package-managers": "tsx scripts/package-manager-smoke.ts",
@@ -187,17 +195,17 @@
187
195
  "@hono/node-server": "^2.0.5",
188
196
  "adm-zip": "^0.6.0",
189
197
  "fast-uri": "^4.1.1",
190
- "sharp": "^0.35.3"
198
+ "sharp": "^0.35.4"
191
199
  },
192
200
  "devDependencies": {
193
201
  "@biomejs/biome": "2.4.6",
194
202
  "@types/bun": "^1.3.14",
195
203
  "@types/node": "^24.10.0",
196
- "@vitest/coverage-v8": "^4.1.10",
204
+ "@vitest/coverage-v8": "^4.1.11",
197
205
  "ajv": "8.20.0",
198
206
  "lefthook": "^2.1.5",
199
207
  "tsx": "^4.21.0",
200
208
  "typescript": "^5.9.3",
201
- "vitest": "^4.1.3"
209
+ "vitest": "^4.1.11"
202
210
  }
203
211
  }