instar 1.3.1219 → 1.3.1221

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 (72) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +25 -2
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/core/AspAuthorshipJoin.d.ts +1 -0
  5. package/dist/core/AspAuthorshipJoin.d.ts.map +1 -1
  6. package/dist/core/AspAuthorshipJoin.js +9 -1
  7. package/dist/core/AspAuthorshipJoin.js.map +1 -1
  8. package/dist/core/AspInboundClassifier.d.ts +22 -0
  9. package/dist/core/AspInboundClassifier.d.ts.map +1 -1
  10. package/dist/core/AspInboundClassifier.js +33 -0
  11. package/dist/core/AspInboundClassifier.js.map +1 -1
  12. package/dist/core/ForwardedTopicContext.d.ts +3 -0
  13. package/dist/core/ForwardedTopicContext.d.ts.map +1 -1
  14. package/dist/core/ForwardedTopicContext.js +2 -1
  15. package/dist/core/ForwardedTopicContext.js.map +1 -1
  16. package/dist/core/MessagingToneGate.d.ts.map +1 -1
  17. package/dist/core/MessagingToneGate.js +5 -1
  18. package/dist/core/MessagingToneGate.js.map +1 -1
  19. package/dist/core/PostUpdateMigrator.d.ts +9 -1
  20. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  21. package/dist/core/PostUpdateMigrator.js +37 -3
  22. package/dist/core/PostUpdateMigrator.js.map +1 -1
  23. package/dist/core/SessionManager.d.ts +7 -0
  24. package/dist/core/SessionManager.d.ts.map +1 -1
  25. package/dist/core/SessionManager.js +2 -2
  26. package/dist/core/SessionManager.js.map +1 -1
  27. package/dist/core/StageBActivationGate.d.ts +31 -1
  28. package/dist/core/StageBActivationGate.d.ts.map +1 -1
  29. package/dist/core/StageBActivationGate.js +69 -10
  30. package/dist/core/StageBActivationGate.js.map +1 -1
  31. package/dist/core/aspClassifierRef.d.ts +14 -0
  32. package/dist/core/aspClassifierRef.d.ts.map +1 -0
  33. package/dist/core/aspClassifierRef.js +8 -0
  34. package/dist/core/aspClassifierRef.js.map +1 -0
  35. package/dist/data/stageBCertifiedSet.d.ts +271 -0
  36. package/dist/data/stageBCertifiedSet.d.ts.map +1 -0
  37. package/dist/data/stageBCertifiedSet.js +366 -0
  38. package/dist/data/stageBCertifiedSet.js.map +1 -0
  39. package/dist/data/standards-guard-index.json +1 -1
  40. package/dist/data/standards-guard-index.meta.json +2 -2
  41. package/dist/data/standards-registry.meta.json +1 -1
  42. package/dist/messaging/TelegramAdapter.d.ts +2 -0
  43. package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
  44. package/dist/messaging/TelegramAdapter.js.map +1 -1
  45. package/dist/messaging/shared/signedInbound.d.ts +59 -0
  46. package/dist/messaging/shared/signedInbound.d.ts.map +1 -0
  47. package/dist/messaging/shared/signedInbound.js +67 -0
  48. package/dist/messaging/shared/signedInbound.js.map +1 -0
  49. package/dist/server/AgentServer.d.ts.map +1 -1
  50. package/dist/server/AgentServer.js +2 -0
  51. package/dist/server/AgentServer.js.map +1 -1
  52. package/dist/server/routes.d.ts +2 -0
  53. package/dist/server/routes.d.ts.map +1 -1
  54. package/dist/server/routes.js +21 -8
  55. package/dist/server/routes.js.map +1 -1
  56. package/dist/types/pipeline.d.ts +1 -1
  57. package/dist/types/pipeline.d.ts.map +1 -1
  58. package/dist/types/pipeline.js +13 -10
  59. package/dist/types/pipeline.js.map +1 -1
  60. package/package.json +1 -1
  61. package/scripts/stage-b-certified-fingerprint.mjs +177 -0
  62. package/scripts/verify-codex-stage-b-release-evidence.mjs +9 -0
  63. package/src/data/builtin-manifest.json +65 -65
  64. package/src/data/stageBCertifiedSet.ts +367 -0
  65. package/src/data/standards-guard-index.json +1 -1
  66. package/src/data/standards-guard-index.meta.json +2 -2
  67. package/src/data/standards-registry.meta.json +1 -1
  68. package/upgrades/1.3.1220.md +87 -0
  69. package/upgrades/1.3.1221.md +24 -0
  70. package/upgrades/side-effects/asp-signed-inbound-label.md +117 -0
  71. package/upgrades/side-effects/file-path-advisory-default.md +82 -0
  72. package/upgrades/side-effects/stage-b-evidence-code-binding.md +93 -0
@@ -210,7 +210,7 @@ export declare const RE_DELIVERY_MARKER = "RE-DELIVERED \u2014 no reply was reco
210
210
  * ADDITIVE ONLY — when `reDelivered` is falsy the returned bytes are identical
211
211
  * to the pre-marker output.
212
212
  */
213
- export declare function buildInjectionTag(topicId: number, topicName?: string, senderName?: string, telegramUserId?: number, reDelivered?: boolean): string;
213
+ export declare function buildInjectionTag(topicId: number, topicName?: string, senderName?: string, telegramUserId?: number, reDelivered?: boolean, signedByAgent?: string): string;
214
214
  /**
215
215
  * Convert a PipelineMessage to a log entry.
216
216
  * All identity fields are preserved for historical search.
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/types/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,MAAM,EAAE,cAAc,CAAC;IACvB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB;IACnB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;IAC9C,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,KAAK,CAAC,EAAE;QACN,0CAA0C;QAC1C,QAAQ,CAAC,EAA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AAgB,CAAC,EAAE;QAAE,mBAAmB,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CAC/D,EACD,IAAI,EAAE;IACJ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;IAC9C,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;CAClC,GACA,eAAe,CAejB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,eAAe,CAUpE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,MAAM,GAClB,gBAAgB,CAkBlB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,+DAC0B,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,OAAO,EACrB,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,CAmBR;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,gBAAgB,CAYlB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAKjE"}
@@ -128,21 +128,24 @@ export const RE_DELIVERY_MARKER = 'RE-DELIVERED — no reply was recorded for th
128
128
  * ADDITIVE ONLY — when `reDelivered` is falsy the returned bytes are identical
129
129
  * to the pre-marker output.
130
130
  */
131
- export function buildInjectionTag(topicId, topicName, senderName, telegramUserId, reDelivered) {
131
+ export function buildInjectionTag(topicId, topicName, senderName, telegramUserId, reDelivered, signedByAgent) {
132
132
  const uidSuffix = telegramUserId ? ` (uid:${telegramUserId})` : '';
133
133
  const reDeliverySuffix = reDelivered === true ? ` — ${RE_DELIVERY_MARKER}` : '';
134
- if (topicName && senderName) {
135
- return `[telegram:${topicId} "${topicName}" from ${senderName}${uidSuffix}${reDeliverySuffix}]`;
136
- }
137
- else if (topicName) {
138
- return `[telegram:${topicId} "${topicName}"${reDeliverySuffix}]`;
134
+ const topicPart = topicName ? ` "${topicName}"` : '';
135
+ // Agent-signed provenance (ASP). `signedByAgent` is an IN-PROCESS parameter
136
+ // carried from the classifier's own verdict — never parsed from content, so a
137
+ // body that merely claims a signature cannot mint this label. The human whose
138
+ // account carried the message is still named: the session must know the
139
+ // channel, and must NOT read the message as that human speaking.
140
+ const safeAgent = signedByAgent && /^[A-Za-z0-9_-]{1,64}$/.test(signedByAgent) ? signedByAgent : undefined;
141
+ let fromPart = '';
142
+ if (safeAgent) {
143
+ fromPart = ` from agent ${safeAgent} (signed)` + (senderName ? ` via ${senderName}'s account${uidSuffix}` : '');
139
144
  }
140
145
  else if (senderName) {
141
- return `[telegram:${topicId} from ${senderName}${uidSuffix}${reDeliverySuffix}]`;
142
- }
143
- else {
144
- return `[telegram:${topicId}${reDeliverySuffix}]`;
146
+ fromPart = ` from ${senderName}${uidSuffix}`;
145
147
  }
148
+ return `[telegram:${topicId}${topicPart}${fromPart}${reDeliverySuffix}]`;
146
149
  }
147
150
  /**
148
151
  * Convert a PipelineMessage to a log entry.
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/types/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAuH7E,qEAAqE;AAErE;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,GAOC,E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AAa,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAClH,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACtB,QAAQ,GAAG,SAAS,UAAU,GAAG,SAAS,EAAE,CAAC;IAC/C,CAAC;IAED,OAAO,aAAa,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,gBAAgB,GAAG,CAAC;AAC3E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,QAAyB,EACzB,WAA0B;IAE1B,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QACvD,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,IAAI,EAAE,QAAQ,CAAC,OAAO;QACtB,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,WAAW;QACX,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS;QACrC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ;QACxC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc;KAC/C,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAuB;IACvD,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ;QAC3B,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,IAAI,MAAM,CAAC;QAC9B,CAAC,CAAC,OAAO,CAAC;IACZ,OAAO,GAAG,MAAM,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instar",
3
- "version": "1.3.1219",
3
+ "version": "1.3.1221",
4
4
  "description": "Coherence infrastructure for self-evolving AI agents — on the Claude Code or Codex subscription you already have.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,177 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Stage-B certified-set fingerprint (spec: stage-b-evidence-code-binding).
4
+ *
5
+ * The release gate binds the approved canary evidence to the CODE it certified,
6
+ * not to a version number. This tool owns the code side of that binding:
7
+ *
8
+ * --check Recompute the certified set's transitive relative-import closure
9
+ * and fingerprint; fail (exit 1) naming per-file drift, any closure
10
+ * member that is neither certified nor excluded-with-reason, and
11
+ * any stale manifest entry. Run by the publish gate and pre-push.
12
+ * --write Rebind the manifest. STRUCTURALLY refuses the dishonest rebind:
13
+ * if the fingerprint changed, the bundled artifact's canonical
14
+ * digest must ALSO have changed (fresh evidence) — old evidence can
15
+ * never be re-stamped onto changed code.
16
+ *
17
+ * The fingerprint has no adversarial value (everything here is editable in one
18
+ * PR, exactly like the verifier itself); it exists to catch HONEST drift and to
19
+ * make every coverage cut an enumerated, reviewed record.
20
+ */
21
+ import crypto from 'node:crypto';
22
+ import fs from 'node:fs';
23
+ import path from 'node:path';
24
+ import { fileURLToPath } from 'node:url';
25
+
26
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
27
+ const MANIFEST = path.join(root, 'src', 'data', 'stageBCertifiedSet.ts');
28
+
29
+ function sha256(buf) { return crypto.createHash('sha256').update(buf).digest('hex'); }
30
+
31
+ export function relativeImportClosure(rootDir, roots) {
32
+ const seen = new Set();
33
+ const work = [...roots];
34
+ while (work.length) {
35
+ const rel = work.pop();
36
+ if (seen.has(rel)) continue;
37
+ const abs = path.join(rootDir, rel);
38
+ if (!fs.existsSync(abs)) { seen.add(rel); continue; } // reported by the partition check
39
+ seen.add(rel);
40
+ const src = fs.readFileSync(abs, 'utf8');
41
+ // Every relative-specifier form: static import/export-from (either quote),
42
+ // side-effect import, dynamic import(), and require(). Fail-closed claim
43
+ // depends on this breadth — a form the matcher misses escapes coverage.
44
+ const specs = [];
45
+ for (const m of src.matchAll(/(?:from|import)\s*\(?\s*(['"])(\.[^'"]+)\1/g)) specs.push(m[2]);
46
+ for (const m of src.matchAll(/require\s*\(\s*(['"])(\.[^'"]+)\1\s*\)/g)) specs.push(m[2]);
47
+ for (const spec of specs) {
48
+ let dep = spec.replace(/\.js$/, '.ts');
49
+ let depAbs = path.normalize(path.join(path.dirname(abs), dep));
50
+ if (!fs.existsSync(depAbs) && fs.existsSync(depAbs.replace(/\.ts$/, '/index.ts'))) {
51
+ depAbs = depAbs.replace(/\.ts$/, '/index.ts');
52
+ }
53
+ work.push(path.relative(rootDir, depAbs).split(path.sep).join('/'));
54
+ }
55
+ }
56
+ return [...seen].sort();
57
+ }
58
+
59
+ export function certifiedFingerprint(rootDir, certified) {
60
+ const h = crypto.createHash('sha256');
61
+ for (const rel of [...certified].sort()) {
62
+ h.update(sha256(Buffer.from(rel, 'utf8')));
63
+ h.update(sha256(fs.readFileSync(path.join(rootDir, rel))));
64
+ }
65
+ return h.digest('hex');
66
+ }
67
+
68
+ async function loadGateFromDist() {
69
+ const dist = path.join(root, 'dist', 'core', 'StageBActivationGate.js');
70
+ if (!fs.existsSync(dist)) {
71
+ console.error('[stage-b-fingerprint] dist/core/StageBActivationGate.js missing — run npm run build first');
72
+ process.exit(1);
73
+ }
74
+ return import(dist);
75
+ }
76
+
77
+ function readManifest() {
78
+ // The manifest is a TS data module; parse its JSON payload between markers.
79
+ const src = fs.readFileSync(MANIFEST, 'utf8');
80
+ const m = src.match(/STAGE_B_CERTIFIED_SET[^=]*=\s*(\{[\s\S]*\})\s*as const/);
81
+ if (!m) throw new Error(`cannot parse ${MANIFEST}`);
82
+ return JSON.parse(m[1]);
83
+ }
84
+
85
+ function writeManifest(data) {
86
+ const body = JSON.stringify(data, null, 2);
87
+ fs.writeFileSync(MANIFEST, `/**
88
+ * Stage-B certified-set manifest (spec: stage-b-evidence-code-binding).
89
+ * Maintained ONLY by scripts/stage-b-certified-fingerprint.mjs --write, which
90
+ * refuses to rebind old evidence onto changed code. Every closure member is
91
+ * either certified (fingerprinted) or excluded with a written reason; the
92
+ * --check partition is fail-closed for anything new.
93
+ */
94
+ export const STAGE_B_CERTIFIED_SET = ${body} as const;
95
+
96
+ export type StageBCertifiedSet = typeof STAGE_B_CERTIFIED_SET;
97
+ `);
98
+ }
99
+
100
+ function partitionProblems(man, closure) {
101
+ const problems = [];
102
+ const certified = new Set(man.certified);
103
+ const excluded = new Set(man.excluded.map((e) => e.file));
104
+ for (const f of closure) {
105
+ if (!certified.has(f) && !excluded.has(f)) problems.push(`unclassified closure member: ${f} — add it to certified, or to excluded with a reason`);
106
+ if (certified.has(f) && excluded.has(f)) problems.push(`${f} is both certified and excluded`);
107
+ }
108
+ for (const f of man.certified) {
109
+ if (!fs.existsSync(path.join(root, f))) problems.push(`certified file missing on disk: ${f}`);
110
+ if (!closure.includes(f)) problems.push(`certified file no longer in the closure: ${f} — remove or re-root`);
111
+ }
112
+ for (const e of man.excluded) {
113
+ if (!e.reason || e.reason.trim().length < 8) problems.push(`excluded entry without a real reason: ${e.file}`);
114
+ if (!closure.includes(e.file)) problems.push(`excluded entry no longer in the closure: ${e.file} — remove the stale exclusion`);
115
+ }
116
+ return problems;
117
+ }
118
+
119
+ const mode = process.argv[2];
120
+ if (!['--check', '--write', '--init'].includes(mode ?? '')) {
121
+ console.error('usage: stage-b-certified-fingerprint.mjs --check | --write | --init');
122
+ process.exit(2);
123
+ }
124
+
125
+ const gateMod = await loadGateFromDist();
126
+ const shipped = gateMod.bundledStageBReleaseEvidence();
127
+ if (!shipped) { console.error('[stage-b-fingerprint] no bundled evidence'); process.exit(1); }
128
+ const evidenceDigest = gateMod.canonicalShippedArtifactDigest(shipped.artifact);
129
+
130
+ if (mode === '--init') {
131
+ if (fs.existsSync(MANIFEST)) { console.error('[stage-b-fingerprint] manifest exists; use --write'); process.exit(1); }
132
+ console.error('[stage-b-fingerprint] --init requires a hand-authored partition first; see the spec');
133
+ process.exit(1);
134
+ }
135
+
136
+ const man = readManifest();
137
+ const closure = relativeImportClosure(root, man.roots);
138
+ const problems = partitionProblems(man, closure);
139
+ const fingerprint = certifiedFingerprint(root, man.certified.filter((f) => fs.existsSync(path.join(root, f))));
140
+
141
+ if (mode === '--check') {
142
+ if (fingerprint !== man.fingerprint) {
143
+ for (const f of man.certified) {
144
+ const abs = path.join(root, f);
145
+ if (fs.existsSync(abs) && man.fileHashes && man.fileHashes[f] && man.fileHashes[f] !== sha256(fs.readFileSync(abs))) {
146
+ problems.push(`certified source drifted: ${f}`);
147
+ }
148
+ }
149
+ problems.push(`fingerprint mismatch: manifest ${man.fingerprint.slice(0, 12)}… vs computed ${fingerprint.slice(0, 12)}… — the certified Stage-B code changed since the approved canary. Run and approve a fresh canary, embed its evidence, then rebind with --write.`);
150
+ }
151
+ if (evidenceDigest !== man.artifactDigest) {
152
+ problems.push(`bundled evidence is not the artifact this manifest vouches for (digest ${evidenceDigest.slice(0, 12)}… vs manifest ${man.artifactDigest.slice(0, 12)}…) — rebind with --write.`);
153
+ }
154
+ if (problems.length) {
155
+ console.error(`[stage-b-fingerprint] CHECK FAILED (${problems.length}):`);
156
+ for (const p of problems) console.error(' - ' + p);
157
+ process.exit(1);
158
+ }
159
+ console.log(`[stage-b-fingerprint] OK — ${man.certified.length} certified, ${man.excluded.length} excluded (each with a reason), closure ${closure.length}, evidence ${evidenceDigest.slice(0, 12)}…`);
160
+ process.exit(0);
161
+ }
162
+
163
+ // --write: rebind. Refuse re-stamping old evidence onto changed code.
164
+ if (problems.length) {
165
+ console.error('[stage-b-fingerprint] refusing to write over an unresolved partition:');
166
+ for (const p of problems) console.error(' - ' + p);
167
+ process.exit(1);
168
+ }
169
+ if (fingerprint !== man.fingerprint && evidenceDigest === man.artifactDigest) {
170
+ console.error('[stage-b-fingerprint] REFUSED: the certified code changed but the bundled evidence is the same artifact this manifest already vouches for.');
171
+ console.error(' Old canary evidence cannot be re-stamped onto changed code. Run and approve a fresh canary, embed its signed evidence, then --write.');
172
+ process.exit(1);
173
+ }
174
+ const fileHashes = {};
175
+ for (const f of man.certified) fileHashes[f] = sha256(fs.readFileSync(path.join(root, f)));
176
+ writeManifest({ ...man, fingerprint, artifactDigest: evidenceDigest, fileHashes, boundAt: new Date().toISOString().slice(0, 10) });
177
+ console.log(`[stage-b-fingerprint] manifest rebound: fingerprint ${fingerprint.slice(0, 12)}…, evidence ${evidenceDigest.slice(0, 12)}…`);
@@ -8,6 +8,7 @@
8
8
  * blocks npm publication.
9
9
  */
10
10
  import fs from 'node:fs';
11
+ import { spawnSync } from 'node:child_process';
11
12
  import path from 'node:path';
12
13
  import { fileURLToPath } from 'node:url';
13
14
  import {
@@ -26,4 +27,12 @@ if (!evidence || failure) {
26
27
  process.exit(1);
27
28
  }
28
29
 
30
+ // Code-binding spec: the certified Stage-B sources must match the manifest the
31
+ // evidence is bound to. Drift blocks publishing until a fresh canary rebinds.
32
+ const fp = spawnSync(process.execPath, [path.join(root, 'scripts', 'stage-b-certified-fingerprint.mjs'), '--check'], { stdio: 'inherit' });
33
+ if (fp.status !== 0) {
34
+ console.error('[codex-stage-b-release] BLOCKED: certified-source drift (see above).');
35
+ process.exit(1);
36
+ }
37
+
29
38
  console.log(`[codex-stage-b-release] verified ${evidence.artifact.deliveryCount} deliveries over ${Math.floor((evidence.artifact.endedAt - evidence.artifact.startedAt) / 60_000)} minutes; signer=${evidence.artifact.echoMachineId}`);