knodin 0.7.4 → 0.7.6

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 (104) hide show
  1. package/README.md +4 -1
  2. package/dist/bin/cli.js +108 -1859
  3. package/dist/bin/launcher.js +3 -10
  4. package/dist/chunks/chunk-DMQAGX77.js +654 -0
  5. package/dist/chunks/chunk-F4Z3Z766.js +4 -0
  6. package/dist/chunks/chunk-SIJAQVSX.js +3 -0
  7. package/dist/chunks/chunk-X6M4HUUE.js +2 -0
  8. package/dist/chunks/chunk-YPRMY2LP.js +8 -0
  9. package/dist/chunks/pure-compression-cli-4TA2TQD5.js +5 -0
  10. package/dist/chunks/server-7EDF4CBY.js +14 -0
  11. package/dist/chunks/structural-fast-path-KD5KQSPX.js +4 -0
  12. package/dist/src/init-progress-worker.js +2 -106
  13. package/dist/src/repair-progress-worker.js +2 -120
  14. package/docs/INSTALLATION.md +17 -1
  15. package/docs/releases/0.7.6.md +25 -0
  16. package/package.json +1 -110
  17. package/dist/src/agent-integration.js +0 -238
  18. package/dist/src/artifact-refresh.js +0 -81
  19. package/dist/src/cli-args.js +0 -274
  20. package/dist/src/cli-model.js +0 -358
  21. package/dist/src/codeflow-replay.js +0 -80
  22. package/dist/src/compact-structural.js +0 -96
  23. package/dist/src/competitive-cold-mcp.js +0 -40
  24. package/dist/src/competitive-constraints.js +0 -20
  25. package/dist/src/competitive-manifest.js +0 -411
  26. package/dist/src/competitive-measurement.js +0 -183
  27. package/dist/src/competitive-runner.js +0 -487
  28. package/dist/src/competitive-sandbox.js +0 -108
  29. package/dist/src/context-export.js +0 -422
  30. package/dist/src/context.js +0 -102
  31. package/dist/src/diagnostics.js +0 -449
  32. package/dist/src/docs-sections.js +0 -141
  33. package/dist/src/doctor.js +0 -380
  34. package/dist/src/engine/ann-hnsw.js +0 -271
  35. package/dist/src/engine/embeddings.js +0 -193
  36. package/dist/src/engine/file-walker.js +0 -43
  37. package/dist/src/engine/git-history.js +0 -289
  38. package/dist/src/engine/index.js +0 -13377
  39. package/dist/src/engine/perf.js +0 -115
  40. package/dist/src/engine/prune.js +0 -112
  41. package/dist/src/engine/scip-import.js +0 -408
  42. package/dist/src/engine/source-policy.js +0 -69
  43. package/dist/src/engine/sqlite.js +0 -71
  44. package/dist/src/engine/symbol-delete.js +0 -58
  45. package/dist/src/execution-profile.js +0 -203
  46. package/dist/src/failure-diagnosis.js +0 -649
  47. package/dist/src/fleet.js +0 -7
  48. package/dist/src/git-executable.js +0 -31
  49. package/dist/src/graph-query-health.js +0 -115
  50. package/dist/src/hook-manager-integration.js +0 -156
  51. package/dist/src/index-activity.js +0 -125
  52. package/dist/src/init-progress.js +0 -155
  53. package/dist/src/init.js +0 -1254
  54. package/dist/src/lifecycle-health.js +0 -250
  55. package/dist/src/lsp-readonly.js +0 -217
  56. package/dist/src/output-compression.js +0 -629
  57. package/dist/src/output-telemetry.js +0 -363
  58. package/dist/src/pr-triage.js +0 -638
  59. package/dist/src/progressive-evidence.js +0 -473
  60. package/dist/src/pure-compression-cli.js +0 -101
  61. package/dist/src/relationship-adapters.js +0 -370
  62. package/dist/src/release-attestation.js +0 -533
  63. package/dist/src/release-preflight.js +0 -510
  64. package/dist/src/repair-progress.js +0 -262
  65. package/dist/src/repository-init-process.js +0 -173
  66. package/dist/src/repository-management.js +0 -1231
  67. package/dist/src/response-budget.js +0 -194
  68. package/dist/src/server.js +0 -73
  69. package/dist/src/structural-fast-path.js +0 -338
  70. package/dist/src/structural-snapshot.js +0 -33
  71. package/dist/src/system-config.js +0 -615
  72. package/dist/src/terminal-help.js +0 -83
  73. package/dist/src/tools/knodin-tools.js +0 -1529
  74. package/dist/src/update-ceremony.js +0 -158
  75. package/dist/src/update-policy.js +0 -944
  76. package/dist/src/update-trust.js +0 -503
  77. package/dist/src/version.js +0 -13
  78. package/dist/src/visualization.js +0 -162
  79. package/dist/src/wait-for-fresh.js +0 -98
  80. package/dist/src/worktree-lifecycle.js +0 -231
  81. package/docs/CONTAINED-EXECUTION.md +0 -77
  82. package/docs/DIAGNOSTICS.md +0 -45
  83. package/docs/GIT-HISTORY-REVIEW.md +0 -39
  84. package/docs/PROGRESSIVE-EVIDENCE.md +0 -37
  85. package/docs/PT-ACCESS-RECOMMENDATION.md +0 -91
  86. package/docs/RELEASE-0.3-EVIDENCE.md +0 -73
  87. package/docs/SCIP-IMPORT.md +0 -57
  88. package/docs/SIGNED-UPDATES.md +0 -151
  89. package/docs/TELEMETRY.md +0 -46
  90. package/docs/assets/knodin-favicon.svg +0 -4
  91. package/docs/releases/0.3.0.md +0 -46
  92. package/docs/releases/0.4.0.md +0 -68
  93. package/docs/releases/0.4.1.md +0 -28
  94. package/docs/releases/0.4.2.md +0 -27
  95. package/docs/releases/0.4.3.md +0 -23
  96. package/docs/releases/0.5.0.md +0 -29
  97. package/docs/releases/0.5.1.md +0 -17
  98. package/docs/releases/0.6.0.md +0 -18
  99. package/docs/releases/0.7.0.md +0 -24
  100. package/docs/releases/0.7.1.md +0 -21
  101. package/docs/releases/0.7.2.md +0 -21
  102. package/docs/releases/0.7.3.md +0 -23
  103. package/docs/releases/0.7.4.md +0 -17
  104. package/schemas/release-attestation-v1.schema.json +0 -210
@@ -1,158 +0,0 @@
1
- import { createHash, createPublicKey } from "node:crypto";
2
- import { canonicalizeUpdateMetadata, verifyUpdateRootChain, } from "./update-trust.js";
3
- const SHA256 = /^[0-9a-f]{64}$/;
4
- const ID = /^[A-Za-z0-9][A-Za-z0-9._-]{2,63}$/;
5
- function exactKeys(value, expected, label) {
6
- const actual = Object.keys(value).sort();
7
- const wanted = [...expected].sort();
8
- if (actual.join("\0") !== wanted.join("\0"))
9
- throw new Error(`${label} contains missing or unknown fields`);
10
- }
11
- function rejectPrivateMaterial(value, path = "input") {
12
- if (typeof value === "string" && /PRIVATE KEY|recovery secret|seed phrase/i.test(value))
13
- throw new Error(`${path} contains private material`);
14
- if (!value || typeof value !== "object")
15
- return;
16
- for (const [key, child] of Object.entries(value)) {
17
- if (/private|secret|seed|mnemonic|password|token/i.test(key))
18
- throw new Error(`${path}.${key} is forbidden`);
19
- rejectPrivateMaterial(child, `${path}.${key}`);
20
- }
21
- }
22
- export function validateRootCeremonyManifest(value) {
23
- rejectPrivateMaterial(value);
24
- if (!value || typeof value !== "object" || Array.isArray(value))
25
- throw new Error("manifest must be an object");
26
- const manifest = value;
27
- exactKeys(manifest, [
28
- "schemaVersion",
29
- "ceremonyId",
30
- "purpose",
31
- "productionActivation",
32
- "custodians",
33
- "roleKeyIds",
34
- "thresholds",
35
- ], "manifest");
36
- if (manifest.schemaVersion !== 1 ||
37
- !ID.test(manifest.ceremonyId) ||
38
- !["rehearsal", "production"].includes(manifest.purpose) ||
39
- manifest.productionActivation !== false)
40
- throw new Error("invalid fail-closed ceremony header");
41
- if (!Array.isArray(manifest.custodians) ||
42
- manifest.custodians.length < 3 ||
43
- new Set(manifest.custodians.map((c) => c.id)).size !== manifest.custodians.length ||
44
- manifest.custodians.some((c) => {
45
- exactKeys(c, c.role === "root-signer"
46
- ? ["id", "role", "publicKeyId"]
47
- : ["id", "role", "recoveryKeyIds", "evidenceId"], "custodian");
48
- return (!ID.test(c.id) ||
49
- !["root-signer", "recovery"].includes(c.role) ||
50
- (c.role === "root-signer" && !SHA256.test(c.publicKeyId ?? "")) ||
51
- (c.role === "recovery" &&
52
- (!ID.test(c.evidenceId ?? "") ||
53
- !Array.isArray(c.recoveryKeyIds) ||
54
- c.recoveryKeyIds.some((id) => !SHA256.test(id)))));
55
- }))
56
- throw new Error("at least three distinct named custodians are required");
57
- const roles = ["root", "targets", "snapshot", "timestamp"];
58
- exactKeys(manifest.roleKeyIds, roles, "roleKeyIds");
59
- exactKeys(manifest.thresholds, roles, "thresholds");
60
- const all = new Set();
61
- for (const role of roles) {
62
- const ids = manifest.roleKeyIds?.[role];
63
- const threshold = manifest.thresholds?.[role];
64
- if (!Array.isArray(ids) ||
65
- ids.length === 0 ||
66
- ids.some((id) => !SHA256.test(id) || all.has(id)))
67
- throw new Error("role keys must be valid and disjoint");
68
- for (const id of ids)
69
- all.add(id);
70
- if (!Number.isInteger(threshold) ||
71
- threshold < (role === "root" || role === "targets" ? 2 : 1) ||
72
- threshold > ids.length)
73
- throw new Error(`invalid ${role} threshold`);
74
- }
75
- if (manifest.custodians.filter((c) => c.role === "root-signer").length < manifest.thresholds.root ||
76
- !manifest.custodians.some((c) => c.role === "recovery"))
77
- throw new Error("custodian roles do not satisfy threshold and recovery separation");
78
- const assigned = manifest.custodians
79
- .filter((c) => c.role === "root-signer")
80
- .map((c) => c.publicKeyId)
81
- .sort();
82
- if (assigned.join("\0") !== [...manifest.roleKeyIds.root].sort().join("\0"))
83
- throw new Error("root signer assignments must exactly match root role keys");
84
- const recovery = manifest.custodians.filter((c) => c.role === "recovery");
85
- if (recovery.length < manifest.thresholds.root ||
86
- new Set(recovery.map((c) => c.evidenceId)).size !== recovery.length ||
87
- recovery.some((c) => !c.recoveryKeyIds?.length ||
88
- new Set(c.recoveryKeyIds).size !== c.recoveryKeyIds.length ||
89
- c.recoveryKeyIds.length >= manifest.thresholds.root))
90
- throw new Error("recovery sets must preserve root threshold independence");
91
- const recovered = new Set(recovery.flatMap((c) => c.recoveryKeyIds ?? []));
92
- if (manifest.roleKeyIds.root.some((id) => !recovered.has(id)))
93
- throw new Error("recovery assignments must cover every root role key");
94
- return manifest;
95
- }
96
- export function validateRootPinReviewReceipt(value, manifest) {
97
- rejectPrivateMaterial(value);
98
- if (!value || typeof value !== "object" || Array.isArray(value))
99
- throw new Error("receipt must be an object");
100
- const receipt = value;
101
- exactKeys(receipt, [
102
- "schemaVersion",
103
- "ceremonyId",
104
- "rootEnvelopeSha256",
105
- "reviewerId",
106
- "reviewedAt",
107
- "decision",
108
- "authentication",
109
- "productionActivation",
110
- ], "receipt");
111
- if (receipt.schemaVersion !== 1 ||
112
- receipt.ceremonyId !== manifest.ceremonyId ||
113
- !SHA256.test(receipt.rootEnvelopeSha256) ||
114
- !ID.test(receipt.reviewerId) ||
115
- manifest.custodians.some((c) => c.id === receipt.reviewerId) ||
116
- receipt.decision !== "approved" ||
117
- receipt.authentication !== "rehearsal-unsigned" ||
118
- receipt.productionActivation !== false ||
119
- !Number.isFinite(Date.parse(receipt.reviewedAt)) ||
120
- new Date(receipt.reviewedAt).toISOString() !== receipt.reviewedAt)
121
- throw new Error("invalid or non-independent pin-review receipt");
122
- return receipt;
123
- }
124
- export function preparePublicRootImport(envelope, pin, manifestValue, receiptValue, now = new Date()) {
125
- rejectPrivateMaterial(envelope, "rootEnvelope");
126
- const manifest = validateRootCeremonyManifest(manifestValue);
127
- if (manifest.purpose === "production")
128
- throw new Error("production import requires externally authenticated review and remains blocked");
129
- const receipt = validateRootPinReviewReceipt(receiptValue, manifest);
130
- if (Date.parse(receipt.reviewedAt) > now.getTime())
131
- throw new Error("pin-review receipt cannot be future-dated");
132
- const roles = ["root", "targets", "snapshot", "timestamp"];
133
- for (const role of roles) {
134
- const expected = manifest.roleKeyIds[role];
135
- const actual = envelope.signed.roles[role];
136
- if (actual.threshold !== manifest.thresholds[role] ||
137
- [...actual.keyids].sort().join("\0") !== [...expected].sort().join("\0"))
138
- throw new Error(`manifest ${role} role does not match root envelope`);
139
- }
140
- for (const key of Object.values(envelope.signed.keys)) {
141
- let canonical = "";
142
- try {
143
- canonical = createPublicKey(key.keyval.public)
144
- .export({ type: "spki", format: "pem" })
145
- .toString();
146
- }
147
- catch {
148
- /* fail below */
149
- }
150
- if (canonical !== key.keyval.public)
151
- throw new Error("root envelope keys must use canonical public SPKI PEM only");
152
- }
153
- const digest = createHash("sha256").update(canonicalizeUpdateMetadata(envelope)).digest("hex");
154
- if (pin !== digest || receipt.rootEnvelopeSha256 !== digest)
155
- throw new Error("root envelope, pin, and independent review receipt disagree");
156
- verifyUpdateRootChain(envelope, pin, [], now);
157
- return { rootEnvelope: envelope, rootEnvelopeSha256: digest, productionActivation: false };
158
- }