knodin 0.7.6 → 0.8.3

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 (134) hide show
  1. package/README.md +41 -12
  2. package/benchmarks/competitors/SYNTHESIS.md +66 -0
  3. package/dist/bin/cli.js +2181 -108
  4. package/dist/bin/launcher.js +25 -3
  5. package/dist/src/agent-integration.js +304 -0
  6. package/dist/src/artifact-refresh.js +82 -0
  7. package/dist/src/cli-args.js +292 -0
  8. package/dist/src/cli-model.js +384 -0
  9. package/dist/src/codeflow-replay.js +81 -0
  10. package/dist/src/compact-structural.js +96 -0
  11. package/dist/src/compare.js +39 -0
  12. package/dist/src/competitive-cold-mcp.js +40 -0
  13. package/dist/src/competitive-constraints.js +21 -0
  14. package/dist/src/competitive-manifest.js +411 -0
  15. package/dist/src/competitive-measurement.js +183 -0
  16. package/dist/src/competitive-runner.js +487 -0
  17. package/dist/src/competitive-sandbox.js +108 -0
  18. package/dist/src/context-export.js +423 -0
  19. package/dist/src/context.js +102 -0
  20. package/dist/src/deterministic-random.js +34 -0
  21. package/dist/src/diagnostics-write-helper.js +473 -0
  22. package/dist/src/diagnostics.js +1476 -0
  23. package/dist/src/docs-sections.js +142 -0
  24. package/dist/src/doctor.js +382 -0
  25. package/dist/src/engine/ann-hnsw.js +261 -0
  26. package/dist/src/engine/embeddings.js +193 -0
  27. package/dist/src/engine/file-walker.js +49 -0
  28. package/dist/src/engine/git-history.js +289 -0
  29. package/dist/src/engine/index.js +15094 -0
  30. package/dist/src/engine/perf.js +115 -0
  31. package/dist/src/engine/prune.js +112 -0
  32. package/dist/src/engine/sarif-import.js +341 -0
  33. package/dist/src/engine/scip-import.js +423 -0
  34. package/dist/src/engine/source-policy.js +85 -0
  35. package/dist/src/engine/sqlite.js +71 -0
  36. package/dist/src/engine/state-paths.js +175 -0
  37. package/dist/src/engine/symbol-delete.js +58 -0
  38. package/dist/src/execution-profile.js +208 -0
  39. package/dist/src/failure-diagnosis.js +655 -0
  40. package/dist/src/fleet.js +7 -0
  41. package/dist/src/git-executable.js +31 -0
  42. package/dist/src/graph-layout.js +173 -0
  43. package/dist/src/graph-query-health.js +115 -0
  44. package/dist/src/hook-manager-integration.js +156 -0
  45. package/dist/src/index-activity.js +126 -0
  46. package/dist/src/init-progress-worker.js +70 -2
  47. package/dist/src/init-progress.js +155 -0
  48. package/dist/src/init.js +1295 -0
  49. package/dist/src/lifecycle-health.js +282 -0
  50. package/dist/src/lsp-readonly.js +217 -0
  51. package/dist/src/mcp-graph-worker.js +69 -0
  52. package/dist/src/mcp-reliability.js +154 -0
  53. package/dist/src/mcp-worker-supervisor.js +350 -0
  54. package/dist/src/mirror.js +290 -0
  55. package/dist/src/node-runtime.js +157 -0
  56. package/dist/src/output-compression.js +630 -0
  57. package/dist/src/output-telemetry.js +368 -0
  58. package/dist/src/pr-triage.js +638 -0
  59. package/dist/src/progress-worker-runtime.js +46 -0
  60. package/dist/src/progressive-evidence.js +477 -0
  61. package/dist/src/pure-compression-cli.js +102 -0
  62. package/dist/src/relationship-adapters.js +377 -0
  63. package/dist/src/release-attestation.js +533 -0
  64. package/dist/src/release-preflight.js +513 -0
  65. package/dist/src/repair-lease.js +85 -0
  66. package/dist/src/repair-progress-worker.js +83 -2
  67. package/dist/src/repair-progress.js +262 -0
  68. package/dist/src/repository-init-process.js +177 -0
  69. package/dist/src/repository-management.js +1261 -0
  70. package/dist/src/resource-reachability.js +456 -0
  71. package/dist/src/response-budget.js +200 -0
  72. package/dist/src/server.js +217 -0
  73. package/dist/src/structural-fast-path.js +344 -0
  74. package/dist/src/structural-snapshot.js +37 -0
  75. package/dist/src/system-config.js +638 -0
  76. package/dist/src/terminal-help.js +83 -0
  77. package/dist/src/tools/knodin-tools.js +1645 -0
  78. package/dist/src/update-ceremony.js +162 -0
  79. package/dist/src/update-policy.js +944 -0
  80. package/dist/src/update-trust.js +504 -0
  81. package/dist/src/version.js +13 -0
  82. package/dist/src/visualization.js +515 -0
  83. package/dist/src/wait-for-fresh.js +98 -0
  84. package/dist/src/worktree-lifecycle.js +234 -0
  85. package/docs/BEHAVIORAL-CONTRACT.md +114 -0
  86. package/docs/CLI.md +30 -1
  87. package/docs/COMPARISON.md +413 -0
  88. package/docs/COMPETITIVE-LANDSCAPE-2026-08.md +267 -0
  89. package/docs/CONTAINED-EXECUTION.md +77 -0
  90. package/docs/DEMO.md +49 -0
  91. package/docs/DIAGNOSTICS.md +80 -0
  92. package/docs/GIT-HISTORY-REVIEW.md +39 -0
  93. package/docs/HANDOFF.md +180 -0
  94. package/docs/INSTALLATION.md +21 -18
  95. package/docs/MCP.md +64 -8
  96. package/docs/PROGRESSIVE-EVIDENCE.md +37 -0
  97. package/docs/PT-ACCESS-RECOMMENDATION.md +89 -0
  98. package/docs/RELEASE-0.3-EVIDENCE.md +73 -0
  99. package/docs/REPOSITORIES-AND-WORKTREES.md +18 -6
  100. package/docs/SCIP-IMPORT.md +62 -0
  101. package/docs/SIGNED-UPDATES.md +151 -0
  102. package/docs/TELEMETRY.md +46 -0
  103. package/docs/TOKEN-OPTIMIZER-SCORECARD.md +79 -0
  104. package/docs/assets/knodin-favicon.svg +4 -0
  105. package/docs/releases/0.3.0.md +46 -0
  106. package/docs/releases/0.4.0.md +68 -0
  107. package/docs/releases/0.4.1.md +28 -0
  108. package/docs/releases/0.4.2.md +27 -0
  109. package/docs/releases/0.4.3.md +23 -0
  110. package/docs/releases/0.5.0.md +29 -0
  111. package/docs/releases/0.5.1.md +17 -0
  112. package/docs/releases/0.6.0.md +18 -0
  113. package/docs/releases/0.7.0.md +24 -0
  114. package/docs/releases/0.7.1.md +21 -0
  115. package/docs/releases/0.7.2.md +21 -0
  116. package/docs/releases/0.7.3.md +23 -0
  117. package/docs/releases/0.7.4.md +17 -0
  118. package/docs/releases/0.7.5.md +20 -0
  119. package/docs/releases/0.8.0.md +74 -0
  120. package/docs/releases/0.8.2.md +34 -0
  121. package/docs/releases/0.8.3.md +47 -0
  122. package/package.json +139 -4
  123. package/roadmap/competitive-roadmap.md +3896 -0
  124. package/schemas/release-attestation-v1.schema.json +210 -0
  125. package/schemas/support-bundle-v2.schema.json +212 -0
  126. package/dist/chunks/chunk-DMQAGX77.js +0 -654
  127. package/dist/chunks/chunk-F4Z3Z766.js +0 -4
  128. package/dist/chunks/chunk-SIJAQVSX.js +0 -3
  129. package/dist/chunks/chunk-X6M4HUUE.js +0 -2
  130. package/dist/chunks/chunk-YPRMY2LP.js +0 -8
  131. package/dist/chunks/pure-compression-cli-4TA2TQD5.js +0 -5
  132. package/dist/chunks/server-7EDF4CBY.js +0 -14
  133. package/dist/chunks/structural-fast-path-KD5KQSPX.js +0 -4
  134. package/docs/releases/0.7.6.md +0 -25
@@ -0,0 +1,155 @@
1
+ const HEARTBEAT_MS = 15_000;
2
+ const TTY_THROTTLE_MS = 100;
3
+ const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
4
+ const CLEAR_TTY_LINE = "\r\x1b[2K";
5
+ export function normalizeTerminalDimension(value, fallback) {
6
+ return Number.isFinite(value) && (value ?? 0) > 0 ? Math.floor(value) : fallback;
7
+ }
8
+ function formatCount(value) {
9
+ return value.toLocaleString();
10
+ }
11
+ function formatBytes(value) {
12
+ if (value < 1024 * 1024)
13
+ return `${Math.round(value / 1024)} KB`;
14
+ return `${(value / (1024 * 1024)).toFixed(1)} MB`;
15
+ }
16
+ function formatDuration(seconds) {
17
+ if (seconds < 1)
18
+ return "<1s";
19
+ if (seconds < 60)
20
+ return `${Math.ceil(seconds)}s`;
21
+ return `${Math.floor(seconds / 60)}m ${Math.ceil(seconds % 60)}s`;
22
+ }
23
+ export function formatProgress(event, ratePerSecond, operation = "init") {
24
+ const model = event.modelFile ? ` (${event.modelFile})` : "";
25
+ const total = event.phaseTotal;
26
+ if (total === undefined)
27
+ return `[${operation}:${event.phase}] ${event.message}${model}`;
28
+ const counter = event.phase === "embedding-model"
29
+ ? `${formatBytes(event.phaseCompleted)} / ${formatBytes(total)}`
30
+ : `${formatCount(event.phaseCompleted)} / ${formatCount(total)}`;
31
+ const percent = total > 0 ? ` (${Math.floor((event.phaseCompleted / total) * 100)}%)` : "";
32
+ const eta = ratePerSecond && total > event.phaseCompleted
33
+ ? ` • ~${formatDuration((total - event.phaseCompleted) / ratePerSecond)} remaining`
34
+ : "";
35
+ const rate = ratePerSecond && event.phase !== "embedding-model"
36
+ ? ` • ${ratePerSecond.toFixed(ratePerSecond >= 10 ? 0 : 1)}/s`
37
+ : "";
38
+ return `[${operation}:${event.phase}] ${counter}${percent} ${event.message}${model}${rate}${eta}`;
39
+ }
40
+ /**
41
+ * Human-only init feedback. It writes to stderr, leaving stdout stable for the
42
+ * final result, redraws a TTY at most 10 times/sec, and heartbeats a quiet phase.
43
+ */
44
+ export function createInitProgressRenderer(options) {
45
+ const operation = options.operation ?? "init";
46
+ const now = options.now ?? Date.now;
47
+ const schedule = options.setTimeout ??
48
+ ((callback, intervalMs) => setTimeout(callback, intervalMs));
49
+ const unschedule = options.clearTimeout ?? ((handle) => clearTimeout(handle));
50
+ const tty = options.stderr.isTTY === true;
51
+ let started = false;
52
+ let stopped = false;
53
+ let hasTtyLine = false;
54
+ let startedAt = 0;
55
+ let heartbeat;
56
+ let spinner;
57
+ let spinnerFrame = 0;
58
+ let displayLine = `[${operation}:starting] Opening local graph database`;
59
+ let lastWriteAt = Number.NEGATIVE_INFINITY;
60
+ let lastPhase = "starting";
61
+ let lastPercentBucket = -1;
62
+ let phaseStartedElapsedMs = 0;
63
+ let phaseStartedCompleted = 0;
64
+ const scheduleHeartbeat = () => {
65
+ if (heartbeat !== undefined || stopped)
66
+ return;
67
+ heartbeat = schedule(() => {
68
+ heartbeat = undefined;
69
+ if (stopped)
70
+ return;
71
+ write(`${displayLine} (still working; ${Math.floor((now() - startedAt) / 1000)}s elapsed)`, false);
72
+ scheduleHeartbeat();
73
+ }, HEARTBEAT_MS);
74
+ if (typeof heartbeat === "object" && heartbeat !== null && "unref" in heartbeat) {
75
+ heartbeat.unref();
76
+ }
77
+ };
78
+ const scheduleSpinner = () => {
79
+ if (!tty || spinner !== undefined || stopped)
80
+ return;
81
+ spinner = schedule(() => {
82
+ spinner = undefined;
83
+ if (stopped)
84
+ return;
85
+ spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES.length;
86
+ options.stderr.write(`${CLEAR_TTY_LINE}${SPINNER_FRAMES[spinnerFrame]} ${displayLine} (${Math.floor((now() - startedAt) / 1000)}s elapsed)`);
87
+ hasTtyLine = true;
88
+ scheduleSpinner();
89
+ }, TTY_THROTTLE_MS);
90
+ if (typeof spinner === "object" && spinner !== null && "unref" in spinner) {
91
+ spinner.unref();
92
+ }
93
+ };
94
+ const write = (line, updateDisplay = true) => {
95
+ if (updateDisplay)
96
+ displayLine = line;
97
+ if (tty) {
98
+ options.stderr.write(`${CLEAR_TTY_LINE}${SPINNER_FRAMES[spinnerFrame]} ${line} (${Math.floor((now() - startedAt) / 1000)}s elapsed)`);
99
+ hasTtyLine = true;
100
+ }
101
+ else {
102
+ options.stderr.write(`${line}\n`);
103
+ }
104
+ lastWriteAt = now();
105
+ scheduleHeartbeat();
106
+ };
107
+ return {
108
+ start() {
109
+ if (started || stopped)
110
+ return;
111
+ started = true;
112
+ startedAt = now();
113
+ scheduleSpinner();
114
+ write(displayLine);
115
+ },
116
+ onProgress(event) {
117
+ if (stopped)
118
+ return;
119
+ if (!started)
120
+ this.start();
121
+ const percentage = event.phaseTotal && event.phaseTotal > 0
122
+ ? Math.floor((event.phaseCompleted / event.phaseTotal) * 100)
123
+ : undefined;
124
+ const bucket = percentage === undefined ? -1 : Math.floor(percentage / 5);
125
+ const phaseChanged = event.phase !== lastPhase;
126
+ if (phaseChanged) {
127
+ phaseStartedElapsedMs = event.elapsedMs;
128
+ phaseStartedCompleted = event.phaseCompleted;
129
+ }
130
+ const phaseElapsedSeconds = Math.max(0, event.elapsedMs - phaseStartedElapsedMs) / 1_000;
131
+ const ratePerSecond = phaseElapsedSeconds > 0 && event.phaseCompleted > phaseStartedCompleted
132
+ ? (event.phaseCompleted - phaseStartedCompleted) / phaseElapsedSeconds
133
+ : undefined;
134
+ const completed = event.phaseTotal !== undefined && event.phaseCompleted >= event.phaseTotal;
135
+ if (tty && !phaseChanged && !completed && now() - lastWriteAt < TTY_THROTTLE_MS)
136
+ return;
137
+ if (!tty && !phaseChanged && bucket <= lastPercentBucket && !completed)
138
+ return;
139
+ write(formatProgress(event, ratePerSecond, operation));
140
+ lastPhase = event.phase;
141
+ lastPercentBucket = Math.max(lastPercentBucket, bucket);
142
+ },
143
+ stop() {
144
+ if (stopped)
145
+ return;
146
+ stopped = true;
147
+ if (heartbeat !== undefined)
148
+ unschedule(heartbeat);
149
+ if (spinner !== undefined)
150
+ unschedule(spinner);
151
+ if (tty && hasTtyLine)
152
+ options.stderr.write(`${CLEAR_TTY_LINE}\n`);
153
+ },
154
+ };
155
+ }