Jessedbrown Claude Fable 5 commited on
Commit
c25f0fd
·
1 Parent(s): df44ad6

acer: seed component 3 - token-cube catalog binder (references, never material)

Browse files

- tools/behcs/token-cube-catalog-binder.mjs: deterministic time-free
contract binding crypto/hash token REFERENCES (token_id, kind,
digest_sha16, scope, catalog) to vantage-qualified cube BH addresses
- HARD RULES: tokens are references, never material - material-shaped
rejects (32+ hex, key-block markers, bearer shapes, base64 runs) are
REDACTED from rows, not echoed; digest exactly 16 lowercase hex kills
length spoofing; every row executable=0
- BH addresses MUST be vantage-qualified (BH-ACER-942, never BH-942) per
hilbert-collision canon; disputed band 930-1229 DEFERS to operator
regardless of vantage or scope (bilateral-ack pending)
- mint/write scopes and mode=live cap at DEFER_TO_OPERATOR; 12-rung ladder
- registries (6 kinds, 6 catalogs) declared DRAFT_ASSUMPTION; exact-match
case-sensitive - hilbert-omni-47D keeps its canonical capital D
- self-correction in receipt: acer's own test wrongly claimed all-lowercase
registries; fixed the test to exact-match semantics, not the registry
- sealed parity baseline 22 cases, time-free (no clock in any row);
pyramid 88/88 on acer; no live publish, no cube mutation, apex-T0 held

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

README.md CHANGED
@@ -40,6 +40,7 @@ Every agent: (1) sees its **PID/device/timestamp-scoped dashboard**, (2) **trans
40
  - `tools/behcs/d22-verb-adapter.mjs` — thin D22 verb surface over the deterministic router/core.
41
  - `tools/behcs/dashboard-resolver.mjs` — component-1 resolver: `(pid, device, ts)` → tightest-scoped dashboard route, 8-rung demotion ladder.
42
  - `tools/behcs/watcher-supervisor-suggestion-emitter.mjs` — component-5 suggestion-row contract: watcher → supervisor draft rows, `executable=0` invariant, live actions cap at DEFER_TO_OPERATOR.
 
43
  - `tools/behcs/supervisor-collision-router.mjs` — Liris canonical implementation for Acer convergence.
44
  - `tests/supervisor-collision-router.unit.test.mjs` — executable router contract tests.
45
 
 
40
  - `tools/behcs/d22-verb-adapter.mjs` — thin D22 verb surface over the deterministic router/core.
41
  - `tools/behcs/dashboard-resolver.mjs` — component-1 resolver: `(pid, device, ts)` → tightest-scoped dashboard route, 8-rung demotion ladder.
42
  - `tools/behcs/watcher-supervisor-suggestion-emitter.mjs` — component-5 suggestion-row contract: watcher → supervisor draft rows, `executable=0` invariant, live actions cap at DEFER_TO_OPERATOR.
43
+ - `tools/behcs/token-cube-catalog-binder.mjs` — component-3 binder: crypto/hash tokens as references bound to vantage-qualified cube BH addresses; material redacted, disputed band 930–1229 defers.
44
  - `tools/behcs/supervisor-collision-router.mjs` — Liris canonical implementation for Acer convergence.
45
  - `tests/supervisor-collision-router.unit.test.mjs` — executable router contract tests.
46
 
README.md.sha256 CHANGED
@@ -1 +1 @@
1
- 39D0D3BB8F907463DC9713D64EFABCA6A85DF804D49B7ACA13306B38E1F936D6 README.md
 
1
+ FDE9D25CE10E017E223172FD13E023E30BC2D8A19534A9017BB4243A476835F4 README.md
docs/ACER-TOKEN-CUBE-CATALOG-SEED-2026-06-11.hbp ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ ACERTOKCUBESEEDHDR|host=acer|date=2026-06-11|component=architecture-component-3|topic=token-cube-catalog-binder-seed|lane=operator-relayed-liris-recommendation-acer-seeds-liris-attacks|json=0
2
+ ACERTOKCUBESEEDSCOPE|repo_side_draft_only=1|untouched=live-MCP+fabric+cubes+keys|tokens=REFERENCES-ONLY(token_id+kind+digest_sha16+cube_bh+scope+catalog)|no-material-no-secrets-no-bearers-ever-inlined|json=0
3
+ ACERTOKCUBESEEDDEFENSE|material-guard=long-hex+key-block-markers+bearer-shapes+base64-runs-REDACTED-not-echoed|digest=exactly-16-lowercase-hex-kills-length-spoofing|cube_bh=vantage-qualified-REQUIRED-per-hilbert-collision-canon|disputed-band-930-1229-DEFERS-always(bilateral-ack-pending)|scope-mint-write-DEFERS|mode-live-DEFERS|json=0
4
+ ACERTOKCUBESEEDPROOF|determinism=double-run-byte-identical|parity_cases=22|time_free_contract=no-clock-in-any-row|binder_tests=12of12_PASS|selftest=9of9_PASS|json=0
5
+ ACERTOKCUBESEEDSELFCORRECT|acer-own-test-initially-claimed-all-registries-lowercase|hilbert-omni-47D-carries-canonical-capital-D-from-real-artifact|fixed-test-to-exact-match-semantics-not-the-registry|json=0
6
+ ACERTOKCUBESEEDOPEN|registry_membership=DRAFT_ASSUMPTION-declared(kinds+catalogs-from-fabric-canon)|live-binding+mint+write=gated-follow-up-operator-signoff|json=0
7
+ ACERTOKCUBESEEDFTR|state=COMPONENT_3_SEED_READY_FOR_LIRIS_ADVERSARIAL_READBACK|mutates=receipt-files-only|mints=0|launches=0|usb_writes=0|engine_edits=0|json=0
docs/ACER-TOKEN-CUBE-CATALOG-SEED-2026-06-11.hbp.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ 3A61C7758B9347E2B89DB5D5896E65CCA16BE3BE04E86F9CCDF807E8EDD20BB2 ACER-TOKEN-CUBE-CATALOG-SEED-2026-06-11.hbp
docs/TARGET-ARCHITECTURE-VISION-2026-06-10.hbp CHANGED
@@ -15,6 +15,7 @@ PROGRESS|2|F5_D22_adapter=tools/behcs/d22-verb-adapter.mjs|verbs=tuple_to_englis
15
  COMPONENT|3|name=60D+-CATALOGS+CRYPTO-TOKENS-IN-MCP-PIPES-CONNECTED-TO-CUBES|vision=47D-expanded-to-60D+-catalogs+newest-binary/sha/hash/crypto-as-TOKENS-in-the-MCP-pipes-wired-to-the-cubes
16
  PROVEN|3|60D-already-HELD(coord64,atlas-v55/v56,tuple_dim=60,3-vantage-verified-2026-06-01)+HBP-hot-path(sha256/hex/tuple-rows)+MCP-tuple-text(tupleResult-sha-per-row)+cube-of-cubes-addressing
17
  GAP|3|crypto/hash-tokens-as-FIRST-CLASS-MCP-pipe-tokens-connected-to-the-cubes-not-fully-wired|FIX=MCP-tools-emit-sha/hash-token-rows-keyed-to-cube-BH-addresses(token=cube-address-binding)|catalog-driven-tool-surface(verbs.hbp-overlay-pattern:73-verbs-added-zero-code)=the-60D-catalog-expansion-mechanism
 
18
 
19
  COMPONENT|4|name=INFINITE-NESTED-AGENTS-IN-OS-HARNESSES|vision=infinite-nested-agents-IN-the-operating-system-harness-for-ANY-agent
20
  PROVEN|4|N-Nest-Prime(depth-N-watcher-gate-proven-depth-16-over-2732-real-files,planted-confab-caught-at-EVERY-level,131071-nodes)+8-byte-agent-seed(sha256(seed)->glyph/cube/hilbert/prime,35TB/8B~=4.38T-slots)+intelligent-terminal-host-CMD-harness(wta-registry-fills-at-runtime)
 
15
  COMPONENT|3|name=60D+-CATALOGS+CRYPTO-TOKENS-IN-MCP-PIPES-CONNECTED-TO-CUBES|vision=47D-expanded-to-60D+-catalogs+newest-binary/sha/hash/crypto-as-TOKENS-in-the-MCP-pipes-wired-to-the-cubes
16
  PROVEN|3|60D-already-HELD(coord64,atlas-v55/v56,tuple_dim=60,3-vantage-verified-2026-06-01)+HBP-hot-path(sha256/hex/tuple-rows)+MCP-tuple-text(tupleResult-sha-per-row)+cube-of-cubes-addressing
17
  GAP|3|crypto/hash-tokens-as-FIRST-CLASS-MCP-pipe-tokens-connected-to-the-cubes-not-fully-wired|FIX=MCP-tools-emit-sha/hash-token-rows-keyed-to-cube-BH-addresses(token=cube-address-binding)|catalog-driven-tool-surface(verbs.hbp-overlay-pattern:73-verbs-added-zero-code)=the-60D-catalog-expansion-mechanism
18
+ PROGRESS|3|binder_seed=tools/behcs/token-cube-catalog-binder.mjs|tokens=references-never-material(redaction-on-material-shapes)|digest=16-lowercase-hex|cube_bh=vantage-qualified-per-hilbert-collision-canon|disputed-band-930-1229-DEFERS|mint-write-live=DEFER_TO_OPERATOR|parity_baseline=TOKEN-CUBE-CATALOG-PARITY-BASELINE-2026-06-11.hbp|draft_only=1|no_cube_mutation=1|json=0
19
 
20
  COMPONENT|4|name=INFINITE-NESTED-AGENTS-IN-OS-HARNESSES|vision=infinite-nested-agents-IN-the-operating-system-harness-for-ANY-agent
21
  PROVEN|4|N-Nest-Prime(depth-N-watcher-gate-proven-depth-16-over-2732-real-files,planted-confab-caught-at-EVERY-level,131071-nodes)+8-byte-agent-seed(sha256(seed)->glyph/cube/hilbert/prime,35TB/8B~=4.38T-slots)+intelligent-terminal-host-CMD-harness(wta-registry-fills-at-runtime)
docs/TARGET-ARCHITECTURE-VISION-2026-06-10.hbp.sha256 CHANGED
@@ -1 +1 @@
1
- 99EB46E4DC8B2DFE60D61B0DFAB638A12D7DC9FC791B3D70DCC6DC72D8D82A22 TARGET-ARCHITECTURE-VISION-2026-06-10.hbp
 
1
+ B1D3A4D90896958A4A968F6A2AC92AD8FE6CAEBBA151AC934482FD33448CC3FA TARGET-ARCHITECTURE-VISION-2026-06-10.hbp
docs/TOKEN-CUBE-CATALOG-PARITY-BASELINE-2026-06-11.hbp ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ TOKCUBEPARITYHDR|component=3|cases=22|clock=none-time-free-contract|rule=rows-byte-identical-on-every-machine|json=0
2
+ TOKCUBEPARITY|case=01|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-754|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_READY|gate=none|executable=0|json=0
3
+ TOKCUBEPARITY|case=02|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-754|scope=attest|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_READY|gate=none|executable=0|json=0
4
+ TOKCUBEPARITY|case=03|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-754|scope=bind-draft|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_READY|gate=none|executable=0|json=0
5
+ TOKCUBEPARITY|case=04|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-754|scope=mint|source_catalog=atlas-v55|mode=draft|verdict=DEFER_TO_OPERATOR|gate=scope-escalation-requires-operator|executable=0|json=0
6
+ TOKCUBEPARITY|case=05|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-754|scope=write|source_catalog=atlas-v55|mode=draft|verdict=DEFER_TO_OPERATOR|gate=scope-escalation-requires-operator|executable=0|json=0
7
+ TOKCUBEPARITY|case=06|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-754|scope=read|source_catalog=atlas-v55|mode=live|verdict=DEFER_TO_OPERATOR|gate=live-binding-requires-operator|executable=0|json=0
8
+ TOKCUBEPARITY|case=07|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-942|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DEFER_TO_OPERATOR|gate=disputed-hilbert-band-930-1229-bilateral-ack-pending|executable=0|json=0
9
+ TOKCUBEPARITY|case=08|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-929|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_READY|gate=none|executable=0|json=0
10
+ TOKCUBEPARITY|case=09|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-930|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DEFER_TO_OPERATOR|gate=disputed-hilbert-band-930-1229-bilateral-ack-pending|executable=0|json=0
11
+ TOKCUBEPARITY|case=10|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-LIRIS-1229|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DEFER_TO_OPERATOR|gate=disputed-hilbert-band-930-1229-bilateral-ack-pending|executable=0|json=0
12
+ TOKCUBEPARITY|case=11|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-LIRIS-1230|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_READY|gate=none|executable=0|json=0
13
+ TOKCUBEPARITY|case=12|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=invalid|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_BLOCKED|gate=missing-or-unqualified-cube-address|executable=0|json=0
14
+ TOKCUBEPARITY|case=13|token_id=TOK-GNN-EDGE-0001|token_kind=invalid|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-754|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_BLOCKED|gate=unknown-token-kind|executable=0|json=0
15
+ TOKCUBEPARITY|case=14|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=redacted|cube_bh=BH-ACER-754|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_BLOCKED|gate=malformed-digest+material-not-reference-suspected|executable=0|json=0
16
+ TOKCUBEPARITY|case=15|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=invalid|cube_bh=BH-ACER-754|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_BLOCKED|gate=malformed-digest|executable=0|json=0
17
+ TOKCUBEPARITY|case=16|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=invalid|cube_bh=BH-ACER-754|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_BLOCKED|gate=malformed-digest|executable=0|json=0
18
+ TOKCUBEPARITY|case=17|token_id=invalid|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-754|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_BLOCKED|gate=dirty-token_id|executable=0|json=0
19
+ TOKCUBEPARITY|case=18|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-754|scope=read|source_catalog=invalid|mode=draft|verdict=DRAFT_BINDING_BLOCKED|gate=unknown-source-catalog|executable=0|json=0
20
+ TOKCUBEPARITY|case=19|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-754|scope=invalid|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_BLOCKED|gate=unknown-scope|executable=0|json=0
21
+ TOKCUBEPARITY|case=20|token_id=TOK-GNN-EDGE-0001|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=invalid|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_BLOCKED|gate=missing-or-unqualified-cube-address|executable=0|json=0
22
+ TOKCUBEPARITY|case=21|token_id=redacted|token_kind=sha16-row-hash|digest_sha16=794b8c68ec512f9e|cube_bh=BH-ACER-754|scope=read|source_catalog=atlas-v55|mode=draft|verdict=DRAFT_BINDING_BLOCKED|gate=malformed-token-id+material-not-reference-suspected|executable=0|json=0
23
+ TOKCUBEPARITY|case=22|token_id=TOK-GNN-EDGE-0001|token_kind=cosign-seal|digest_sha16=794b8c68ec512f9e|cube_bh=BH-SHARED-1|scope=read|source_catalog=d22-translation|mode=draft|verdict=DRAFT_BINDING_READY|gate=none|executable=0|json=0
24
+ TOKCUBEPARITYFTR|cases=22|exit=byte-match-when-regenerated-file-equals-sealed-baseline|json=0
docs/TOKEN-CUBE-CATALOG-PARITY-BASELINE-2026-06-11.hbp.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ 4C9814008D178AF175B77E406F459A92605CE218EB97DC3C0650A0931D699D74 TOKEN-CUBE-CATALOG-PARITY-BASELINE-2026-06-11.hbp
tests/supervisor-collision-router.system.test.mjs CHANGED
@@ -28,6 +28,8 @@ const sealedFiles = [
28
  'docs/ACER-READBACK-DASHBOARD-RESOLVER-2026-06-11.hbp',
29
  'docs/WATCHER-SUPERVISOR-SUGGESTION-PARITY-BASELINE-2026-06-11.hbp',
30
  'docs/ACER-WATCHER-SUPERVISOR-SEED-2026-06-11.hbp',
 
 
31
  'docs/LIRIS-WATCHER-SUPERVISOR-READBACK-2026-06-11.hbp',
32
  'docs/ACER-READBACK-WATCHER-SUPERVISOR-2026-06-11.hbp',
33
  'docs/LIRIS-STEP166-PARITY-CONFIRMED-2026-06-11.hbp',
@@ -48,11 +50,15 @@ const sealedFiles = [
48
  'tools/behcs/watcher-supervisor-suggestion-emitter.mjs',
49
  'tools/behcs/watcher-supervisor-suggestion-emitter.hbp',
50
  'tools/behcs/watcher-supervisor-suggestion-emitter.hbi',
 
 
 
51
  'tools/omni-processor/omnitranslator-v0.js',
52
  'tests/d22-verb-adapter.unit.test.mjs',
53
  'tests/d22-parity-probe.unit.test.mjs',
54
  'tests/dashboard-resolver.unit.test.mjs',
55
  'tests/watcher-supervisor-suggestion-emitter.unit.test.mjs',
 
56
  'tests/supervisor-collision-router.unit.test.mjs',
57
  'tests/supervisor-collision-router.integration.test.mjs',
58
  'tests/supervisor-collision-router.suite.test.mjs',
@@ -100,6 +106,12 @@ test('suggestion emitter descriptor records the current source and unit-test has
100
  assert.match(hbp, new RegExp(`test_sha256=${sha256('tests/watcher-supervisor-suggestion-emitter.unit.test.mjs')}`));
101
  });
102
 
 
 
 
 
 
 
103
  test('sidecar filenames point at their target basenames', () => {
104
  for (const rel of sealedFiles) {
105
  const text = readFileSync(join(repo, `${rel}.sha256`), 'utf8').trim();
 
28
  'docs/ACER-READBACK-DASHBOARD-RESOLVER-2026-06-11.hbp',
29
  'docs/WATCHER-SUPERVISOR-SUGGESTION-PARITY-BASELINE-2026-06-11.hbp',
30
  'docs/ACER-WATCHER-SUPERVISOR-SEED-2026-06-11.hbp',
31
+ 'docs/TOKEN-CUBE-CATALOG-PARITY-BASELINE-2026-06-11.hbp',
32
+ 'docs/ACER-TOKEN-CUBE-CATALOG-SEED-2026-06-11.hbp',
33
  'docs/LIRIS-WATCHER-SUPERVISOR-READBACK-2026-06-11.hbp',
34
  'docs/ACER-READBACK-WATCHER-SUPERVISOR-2026-06-11.hbp',
35
  'docs/LIRIS-STEP166-PARITY-CONFIRMED-2026-06-11.hbp',
 
50
  'tools/behcs/watcher-supervisor-suggestion-emitter.mjs',
51
  'tools/behcs/watcher-supervisor-suggestion-emitter.hbp',
52
  'tools/behcs/watcher-supervisor-suggestion-emitter.hbi',
53
+ 'tools/behcs/token-cube-catalog-binder.mjs',
54
+ 'tools/behcs/token-cube-catalog-binder.hbp',
55
+ 'tools/behcs/token-cube-catalog-binder.hbi',
56
  'tools/omni-processor/omnitranslator-v0.js',
57
  'tests/d22-verb-adapter.unit.test.mjs',
58
  'tests/d22-parity-probe.unit.test.mjs',
59
  'tests/dashboard-resolver.unit.test.mjs',
60
  'tests/watcher-supervisor-suggestion-emitter.unit.test.mjs',
61
+ 'tests/token-cube-catalog-binder.unit.test.mjs',
62
  'tests/supervisor-collision-router.unit.test.mjs',
63
  'tests/supervisor-collision-router.integration.test.mjs',
64
  'tests/supervisor-collision-router.suite.test.mjs',
 
106
  assert.match(hbp, new RegExp(`test_sha256=${sha256('tests/watcher-supervisor-suggestion-emitter.unit.test.mjs')}`));
107
  });
108
 
109
+ test('token-cube binder descriptor records the current source and unit-test hashes', () => {
110
+ const hbp = readFileSync(join(repo, 'tools/behcs/token-cube-catalog-binder.hbp'), 'utf8');
111
+ assert.match(hbp, new RegExp(`binder_sha256=${sha256('tools/behcs/token-cube-catalog-binder.mjs')}`));
112
+ assert.match(hbp, new RegExp(`test_sha256=${sha256('tests/token-cube-catalog-binder.unit.test.mjs')}`));
113
+ });
114
+
115
  test('sidecar filenames point at their target basenames', () => {
116
  for (const rel of sealedFiles) {
117
  const text = readFileSync(join(repo, `${rel}.sha256`), 'utf8').trim();
tests/supervisor-collision-router.system.test.mjs.sha256 CHANGED
@@ -1 +1 @@
1
- 07B3FCF17EAE1BA4EB3773E9B48D9AEFED38BFFAB5173803BFB73F016FEB52AB supervisor-collision-router.system.test.mjs
 
1
+ D555A102A27A58501D5193BFA4F7C2455AE12ACD6EAF9BD3A6485F401FF0AACA supervisor-collision-router.system.test.mjs
tests/token-cube-catalog-binder.unit.test.mjs ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import assert from 'node:assert/strict';
2
+ import { readFileSync } from 'node:fs';
3
+ import test from 'node:test';
4
+
5
+ import {
6
+ CATALOGS,
7
+ DISPUTED_BANDS,
8
+ SCOPES,
9
+ TOKEN_KINDS,
10
+ bindToken,
11
+ emitParityRows,
12
+ selfTest,
13
+ statusRows,
14
+ } from '../tools/behcs/token-cube-catalog-binder.mjs';
15
+
16
+ const GOOD = Object.freeze({
17
+ token_id: 'TOK-GNN-EDGE-0001',
18
+ token_kind: 'sha16-row-hash',
19
+ digest_sha16: '794b8c68ec512f9e',
20
+ cube_bh: 'BH-ACER-754',
21
+ scope: 'read',
22
+ source_catalog: 'atlas-v55',
23
+ });
24
+
25
+ const FULL_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855';
26
+
27
+ test('clean reference binding is DRAFT_BINDING_READY and never executable', () => {
28
+ const out = bindToken({ ...GOOD });
29
+ assert.equal(out.verdict, 'DRAFT_BINDING_READY');
30
+ assert.equal(out.executable, 0);
31
+ assert.ok(out.row.includes('|executable=0|'));
32
+ assert.equal(out.gate, 'none');
33
+ });
34
+
35
+ test('secret leakage: material-shaped values are redacted, never echoed', () => {
36
+ const longKey = bindToken({ ...GOOD, token_id: 'BEGIN-PRIVATE-KEY-MATERIAL-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' });
37
+ assert.equal(longKey.verdict, 'DRAFT_BINDING_BLOCKED');
38
+ assert.equal(longKey.token_id, 'redacted');
39
+ assert.ok(longKey.gate.includes('material-not-reference-suspected'));
40
+ assert.ok(!longKey.row.includes('PRIVATE'), 'key-block marker must not reach the row');
41
+
42
+ const fullHash = bindToken({ ...GOOD, digest_sha16: FULL_SHA256 });
43
+ assert.equal(fullHash.digest_sha16, 'redacted');
44
+ assert.ok(!fullHash.row.includes(FULL_SHA256), 'full sha256 material must not reach the row');
45
+ });
46
+
47
+ test('hash-length spoofing and digest normalization: exactly 16 lowercase hex or blocked', () => {
48
+ for (const digest of ['794b8c68ec512f9', '794b8c68ec512f9e0', '794B8C68EC512F9E', 'zz4b8c68ec512f9e', '', null]) {
49
+ const out = bindToken({ ...GOOD, digest_sha16: digest });
50
+ assert.equal(out.verdict, 'DRAFT_BINDING_BLOCKED', `digest=${digest}`);
51
+ assert.ok(out.gate.startsWith('malformed-digest') || out.gate.startsWith('dirty-'), out.gate);
52
+ }
53
+ assert.equal(bindToken({ ...GOOD, digest_sha16: FULL_SHA256 }).gate, 'malformed-digest+material-not-reference-suspected');
54
+ });
55
+
56
+ test('HBP injection: pipe/CR/LF in any field blocks before echo', () => {
57
+ for (const patch of [
58
+ { token_id: 'TOK-EVIL|json=1' },
59
+ { cube_bh: 'BH-ACER-754|mutates=1' },
60
+ { source_catalog: 'atlas-v55\nrow' },
61
+ { scope: 'read\r' },
62
+ ]) {
63
+ const out = bindToken({ ...GOOD, ...patch });
64
+ assert.equal(out.verdict, 'DRAFT_BINDING_BLOCKED');
65
+ assert.ok(out.gate.startsWith('dirty-'));
66
+ assert.ok(!out.row.includes('json=1') || !out.row.includes('mutates=1'));
67
+ assert.equal((out.row.match(/json=0/g) ?? []).length, 1, 'row carries exactly one json=0 terminator');
68
+ }
69
+ });
70
+
71
+ test('scope escalation: mint and write cap at DEFER_TO_OPERATOR, never READY', () => {
72
+ for (const [scope, meta] of Object.entries(SCOPES)) {
73
+ const out = bindToken({ ...GOOD, scope });
74
+ if (meta.escalates) {
75
+ assert.equal(out.verdict, 'DEFER_TO_OPERATOR', scope);
76
+ assert.equal(out.gate, 'scope-escalation-requires-operator');
77
+ } else {
78
+ assert.equal(out.verdict, 'DRAFT_BINDING_READY', scope);
79
+ }
80
+ assert.equal(out.executable, 0);
81
+ }
82
+ assert.equal(bindToken({ ...GOOD, scope: 'root' }).gate, 'unknown-scope');
83
+ });
84
+
85
+ test('live-binding semantics: mode=live defers, unknown mode blocks, default is draft', () => {
86
+ assert.equal(bindToken({ ...GOOD, mode: 'live' }).verdict, 'DEFER_TO_OPERATOR');
87
+ assert.equal(bindToken({ ...GOOD, mode: 'live' }).gate, 'live-binding-requires-operator');
88
+ assert.equal(bindToken({ ...GOOD, mode: 'yolo' }).gate, 'unknown-mode');
89
+ assert.equal(bindToken({ ...GOOD }).mode, 'draft');
90
+ });
91
+
92
+ test('cube address ambiguity: vantage qualification required per hilbert-collision canon', () => {
93
+ for (const cube_bh of ['BH-942', 'BH-acer-754', 'BH-OTHER-754', '754', 'BH-ACER-', 'BH-ACER-1234567', null]) {
94
+ const out = bindToken({ ...GOOD, cube_bh });
95
+ assert.equal(out.verdict, 'DRAFT_BINDING_BLOCKED', `cube_bh=${cube_bh}`);
96
+ assert.equal(out.gate, 'missing-or-unqualified-cube-address');
97
+ }
98
+ });
99
+
100
+ test('disputed hilbert band 930-1229 defers regardless of vantage, exact boundaries', () => {
101
+ assert.deepEqual(DISPUTED_BANDS.map((b) => [b.lo, b.hi]), [[930, 1229]]);
102
+ assert.equal(bindToken({ ...GOOD, cube_bh: 'BH-ACER-929' }).verdict, 'DRAFT_BINDING_READY');
103
+ assert.equal(bindToken({ ...GOOD, cube_bh: 'BH-ACER-930' }).verdict, 'DEFER_TO_OPERATOR');
104
+ assert.equal(bindToken({ ...GOOD, cube_bh: 'BH-LIRIS-1229' }).verdict, 'DEFER_TO_OPERATOR');
105
+ assert.equal(bindToken({ ...GOOD, cube_bh: 'BH-LIRIS-1230' }).verdict, 'DRAFT_BINDING_READY');
106
+ assert.equal(bindToken({ ...GOOD, cube_bh: 'BH-SHARED-1000' }).verdict, 'DEFER_TO_OPERATOR', 'SHARED vantage does not bypass the disputed band');
107
+ });
108
+
109
+ test('registry case sensitivity: exact-match only, case-flips rejected', () => {
110
+ assert.equal(bindToken({ ...GOOD, token_kind: 'SHA16-ROW-HASH' }).gate, 'unknown-token-kind');
111
+ assert.equal(bindToken({ ...GOOD, source_catalog: 'ATLAS-V55' }).gate, 'unknown-source-catalog');
112
+ assert.equal(bindToken({ ...GOOD, token_kind: 'jwt-bearer' }).gate, 'unknown-token-kind');
113
+ // hilbert-omni-47D carries its canonical capital D (matches the real
114
+ // fabric artifact name) -- exact bytes pass, case-flips fail.
115
+ assert.ok(CATALOGS.includes('hilbert-omni-47D'));
116
+ assert.equal(bindToken({ ...GOOD, source_catalog: 'hilbert-omni-47D' }).verdict, 'DRAFT_BINDING_READY');
117
+ assert.equal(bindToken({ ...GOOD, source_catalog: 'hilbert-omni-47d' }).gate, 'unknown-source-catalog');
118
+ assert.ok(TOKEN_KINDS.every((k) => k === k.toLowerCase()), 'kinds are all-lowercase by design');
119
+ });
120
+
121
+ test('blocked and deferred rows leak no extra context: closed verdict set, no host paths, no material', () => {
122
+ const allRows = [...statusRows(), ...emitParityRows()];
123
+ for (const row of allRows) {
124
+ assert.ok(!row.includes('executable=1'), row);
125
+ assert.ok(!/[\\]|C:|Users|rayss|home\/|PRIVATE/.test(row), `leak: ${row}`);
126
+ assert.ok(!row.includes(FULL_SHA256), 'material must not appear in any sealed row');
127
+ assert.ok(row.endsWith('json=0') && !row.includes('{"'));
128
+ }
129
+ for (const c of [{ ...GOOD }, { ...GOOD, mode: 'live' }, { ...GOOD, token_kind: 'nope' }]) {
130
+ const v = bindToken(c).verdict;
131
+ assert.ok(['DRAFT_BINDING_READY', 'DEFER_TO_OPERATOR', 'DRAFT_BINDING_BLOCKED'].includes(v));
132
+ }
133
+ });
134
+
135
+ // Component-3 parity, STEP|166 pattern: a green pyramid run on liris IS the
136
+ // bilateral byte-match. Contract is time-free, so no clock enters the rows.
137
+ test('component-3 parity: regenerated rows byte-match the sealed baseline', () => {
138
+ const regenerated = emitParityRows().join('\n') + '\n';
139
+ const baseline = readFileSync(
140
+ new URL('../docs/TOKEN-CUBE-CATALOG-PARITY-BASELINE-2026-06-11.hbp', import.meta.url),
141
+ 'utf8',
142
+ );
143
+ assert.equal(regenerated, baseline, 'this machine produced different bytes than the sealed baseline');
144
+ });
145
+
146
+ test('binder self-test passes', () => {
147
+ assert.equal(selfTest().ok, true);
148
+ });
tests/token-cube-catalog-binder.unit.test.mjs.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ 5CA3D173EEE52A1689BC56A7FC5BA889781A894F807585121C7DA7B333B7ED68 token-cube-catalog-binder.unit.test.mjs
tools/behcs/token-cube-catalog-binder.hbi ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ TOKCUBEINDEX|host=acer|target=token-cube-catalog-binder.hbp|tool=token-cube-catalog-binder.mjs|rows=11|json=0
2
+ INDEXROW|row=1|kind=header|component=architecture-component-3|json=0
3
+ INDEXROW|row=2|kind=law|tokens=references-never-material|invariant=executable-0|json=0
4
+ INDEXROW|row=3|kind=scope|repo_side_draft_only=1|no_live_binding=1|json=0
5
+ INDEXROW|row=4|kind=ladder|rungs=12|json=0
6
+ INDEXROW|row=5|kind=table|kinds=6|catalogs=6|membership=DRAFT_ASSUMPTION|json=0
7
+ INDEXROW|row=6|kind=format|digest=16-lowercase-hex|cube_bh=vantage-qualified|registries=exact-match|json=0
8
+ INDEXROW|row=7|kind=disputed|band=930-1229|verdict=DEFER_TO_OPERATOR|json=0
9
+ INDEXROW|row=8|kind=safety|mutates=0|pure_function=1|no_secret_material=1|json=0
10
+ INDEXROW|row=9|kind=verify|required=node-check+node-test+self-test+parity-byte-compare|json=0
11
+ INDEXROW|row=10|kind=sha|fields=binder_sha256+test_sha256|json=0
12
+ INDEXROW|row=11|kind=footer|state=COMPONENT_3_SEED_READY_FOR_LIRIS_ADVERSARIAL_READBACK|json=0
tools/behcs/token-cube-catalog-binder.hbi.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ 03FE77AE283BDC8AC5838852F540AC9FD9513ABA844A6DB7D36DCF27F70EFBA2 token-cube-catalog-binder.hbi
tools/behcs/token-cube-catalog-binder.hbp ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ TOKCUBEHDR|host=acer|component=architecture-component-3|tool=tools/behcs/token-cube-catalog-binder.mjs|purpose=crypto-hash-tokens-as-first-class-references-bound-to-cube-bh-addresses|json=0
2
+ TOKCUBELAW|rule=tokens-are-REFERENCES-never-material|invariant=every-row-executable-0|redaction=material-shaped-rejects-show-redacted-never-echoed|composes=TARGET-ARCHITECTURE-VISION-2026-06-10(COMPONENT-3)+hilbert-collision-canon(vantage-qualified-BH-ADDR)|json=0
3
+ TOKCUBESCOPE_DOC|repo_side_draft_only=1|never=live-MCP-publish+fabric-call+mint+cube-mutation+key-generation+secret-material|live_binding=SEPARATE-GATED-FOLLOW-UP-operator-signoff|json=0
4
+ TOKCUBELADDER|rungs=12|order=dirty-BLOCKED+malformed-token-id-BLOCKED(material-redacted)+unknown-kind-BLOCKED+malformed-digest-BLOCKED(material-redacted)+unqualified-cube-address-BLOCKED+unknown-catalog-BLOCKED+unknown-scope-BLOCKED+unknown-mode-BLOCKED+live-mode-DEFER+mint-write-scope-DEFER+disputed-band-DEFER+clean-DRAFT_BINDING_READY|json=0
5
+ TOKCUBETABLE|kinds=sha256-ref+sha16-row-hash+hex-envelope+ed25519-pubkey-fingerprint+cosign-seal+bh-tuple-digest|catalogs=hilbert-omni-47D+atlas-v55+atlas-v56+verbs-overlay-73+quant-bus-v48+d22-translation|membership=DRAFT_ASSUMPTION-declared-bilateral-contest-welcome|json=0
6
+ TOKCUBEFORMAT|token_id=TOK-prefix-bounded-4-to-40|digest=exactly-16-lowercase-hex(sha16-row-hash-convention)|cube_bh=BH-VANTAGE-INDEX(vantage=ACER+LIRIS+SHARED-REQUIRED-per-hilbert-collision-canon)|registries=exact-match-case-sensitive(hilbert-omni-47D-keeps-canonical-capital-D)|json=0
7
+ TOKCUBEDISPUTED_DOC|band=930-1229|why=acer-liris-hilbert-overlap-bilateral-ack-pending|rule=any-binding-in-band-DEFERS-regardless-of-vantage-or-scope|json=0
8
+ TOKCUBESAFETY|mutates=0|pure_function=1|time_free_contract=1|no_live_publish=1|no_fabric_call=1|no_mint=1|no_cube_mutation=1|no_key_generation=1|no_secret_material=1|usb_writes=0|engine_edits=0|external_calls=0|json=0
9
+ TOKCUBEVERIFY|required=node-check+node-test+self-test+parity-byte-compare|parity_baseline=docs/TOKEN-CUBE-CATALOG-PARITY-BASELINE-2026-06-11.hbp|clock=none-time-free|json=0
10
+ TOKCUBESHA|binder_sha256=CB410FB9F8FCD91DBF048A408AE9A7CBA92141323760BFC00D9BB9F61A526FAF|test_sha256=5CA3D173EEE52A1689BC56A7FC5BA889781A894F807585121C7DA7B333B7ED68|json=0
11
+ TOKCUBEFTR|state=COMPONENT_3_SEED_READY_FOR_LIRIS_ADVERSARIAL_READBACK|json=0
tools/behcs/token-cube-catalog-binder.hbp.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ 036F0C62CAEE71A1DF75FBEAFAFF5940597604F8F71A4D567F406D2586E20BFD token-cube-catalog-binder.hbp
tools/behcs/token-cube-catalog-binder.mjs ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ import { resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ // COMPONENT|3 seed: crypto/hash tokens as FIRST-CLASS references bound to
6
+ // cube BH addresses -- deterministic catalog + binder, repo-side DRAFT ONLY.
7
+ // No live MCP publish, no fabric call, no mint, no cube mutation, no key
8
+ // generation. Tokens are REFERENCES: a row carries a token_id, a kind, a
9
+ // 16-hex digest, and a cube address -- never token material, secrets,
10
+ // private keys, or bearer strings. Every field is format- or registry-
11
+ // validated before it can reach a row, and anything that LOOKS like raw
12
+ // material is redacted, not echoed. Every row carries executable=0.
13
+ // The contract is time-free: no clock enters any row, so parity is
14
+ // deterministic without a fixed-now.
15
+
16
+ export const BINDER_ID = 'token-cube-catalog-binder.v1';
17
+
18
+ // Registry membership is a DRAFT_ASSUMPTION (declared per lane rules) --
19
+ // kinds/catalogs drawn from fabric canon, bilateral contest welcome.
20
+ export const TOKEN_KINDS = Object.freeze([
21
+ 'sha256-ref',
22
+ 'sha16-row-hash',
23
+ 'hex-envelope',
24
+ 'ed25519-pubkey-fingerprint',
25
+ 'cosign-seal',
26
+ 'bh-tuple-digest',
27
+ ]);
28
+
29
+ export const CATALOGS = Object.freeze([
30
+ 'hilbert-omni-47D',
31
+ 'atlas-v55',
32
+ 'atlas-v56',
33
+ 'verbs-overlay-73',
34
+ 'quant-bus-v48',
35
+ 'd22-translation',
36
+ ]);
37
+
38
+ // mint and write scopes are cosign territory: they cap at DEFER_TO_OPERATOR
39
+ // no matter how clean the rest of the input is.
40
+ export const SCOPES = Object.freeze({
41
+ read: { escalates: 0 },
42
+ attest: { escalates: 0 },
43
+ 'bind-draft': { escalates: 0 },
44
+ mint: { escalates: 1 },
45
+ write: { escalates: 1 },
46
+ });
47
+
48
+ // Hilbert-collision canon: BH addresses MUST be vantage-qualified, and the
49
+ // acer/liris overlap band 930-1229 is DISPUTED pending bilateral ack --
50
+ // any binding into it defers to the operator regardless of scope/vantage.
51
+ export const BH_VANTAGES = Object.freeze(['ACER', 'LIRIS', 'SHARED']);
52
+ export const DISPUTED_BANDS = Object.freeze([Object.freeze({ lo: 930, hi: 1229, why: 'acer-liris-overlap-bilateral-ack-pending' })]);
53
+
54
+ const TOKEN_ID_RE = /^TOK-[A-Z0-9][A-Z0-9-]{2,38}$/;
55
+ const DIGEST_RE = /^[0-9a-f]{16}$/;
56
+ const CUBE_BH_RE = /^BH-(ACER|LIRIS|SHARED)-(\d{1,6})$/;
57
+ const DIRTY_RE = /[|\r\n]/;
58
+ // Material detectors: long contiguous hex, key-block markers, bearer shapes,
59
+ // long base64 runs. Anything matching is redacted from rows entirely.
60
+ const MATERIAL_RES = Object.freeze([
61
+ /[0-9a-fA-F]{32,}/,
62
+ /BEGIN[ -]?[A-Z -]*PRIVATE[ -]?KEY/i,
63
+ /bearer[ :=-]/i,
64
+ /[A-Za-z0-9+/]{40,}={0,2}/,
65
+ ]);
66
+
67
+ function looksLikeMaterial(value) {
68
+ return typeof value === 'string' && MATERIAL_RES.some((re) => re.test(value));
69
+ }
70
+
71
+ function cleanString(value) {
72
+ return typeof value === 'string' && !DIRTY_RE.test(value) ? value : null;
73
+ }
74
+
75
+ // Row echo policy: format/registry-valid value, or 'invalid', or 'redacted'
76
+ // when the rejected value looks like raw material. Raw input never passes.
77
+ function echoField(value, validator) {
78
+ const clean = cleanString(value);
79
+ if (clean == null) return 'invalid';
80
+ if (looksLikeMaterial(clean)) return 'redacted';
81
+ return validator(clean) ? clean : 'invalid';
82
+ }
83
+
84
+ function buildResult(inp, verdict, gates) {
85
+ const fields = {
86
+ token_id: echoField(inp.token_id, (v) => TOKEN_ID_RE.test(v)),
87
+ token_kind: echoField(inp.token_kind, (v) => TOKEN_KINDS.includes(v)),
88
+ digest_sha16: echoField(inp.digest_sha16, (v) => DIGEST_RE.test(v)),
89
+ cube_bh: echoField(inp.cube_bh, (v) => CUBE_BH_RE.test(v)),
90
+ scope: echoField(inp.scope, (v) => Object.hasOwn(SCOPES, v)),
91
+ source_catalog: echoField(inp.source_catalog, (v) => CATALOGS.includes(v)),
92
+ mode: echoField(inp.mode ?? 'draft', (v) => v === 'draft' || v === 'live'),
93
+ verdict,
94
+ gate: gates.length ? gates.join('+') : 'none',
95
+ };
96
+ const row = [
97
+ 'TOKCUBEBIND',
98
+ `token_id=${fields.token_id}`,
99
+ `token_kind=${fields.token_kind}`,
100
+ `digest_sha16=${fields.digest_sha16}`,
101
+ `cube_bh=${fields.cube_bh}`,
102
+ `scope=${fields.scope}`,
103
+ `source_catalog=${fields.source_catalog}`,
104
+ `mode=${fields.mode}`,
105
+ `verdict=${fields.verdict}`,
106
+ `gate=${fields.gate}`,
107
+ 'executable=0',
108
+ 'json=0',
109
+ ].join('|');
110
+ return { ...fields, ok: verdict !== 'DRAFT_BINDING_BLOCKED', executable: 0, row };
111
+ }
112
+
113
+ export function bindToken(input) {
114
+ const inp = input ?? {};
115
+ const blocked = (...gates) => buildResult(inp, 'DRAFT_BINDING_BLOCKED', gates);
116
+
117
+ // Rung 1: dirty input never reaches a row.
118
+ for (const field of ['token_id', 'token_kind', 'digest_sha16', 'cube_bh', 'scope', 'source_catalog', 'mode']) {
119
+ const value = inp[field];
120
+ if (value != null && (typeof value !== 'string' || DIRTY_RE.test(value))) {
121
+ return blocked(`dirty-${field}`);
122
+ }
123
+ }
124
+
125
+ // Rung 2: token_id is a bounded reference id -- material cannot hide in it.
126
+ const tokenId = inp.token_id ?? '';
127
+ if (!TOKEN_ID_RE.test(tokenId)) {
128
+ return looksLikeMaterial(tokenId)
129
+ ? blocked('malformed-token-id', 'material-not-reference-suspected')
130
+ : blocked('malformed-token-id');
131
+ }
132
+
133
+ // Rung 3: kind must be registered.
134
+ if (!TOKEN_KINDS.includes(inp.token_kind ?? '')) return blocked('unknown-token-kind');
135
+
136
+ // Rung 4: digest is EXACTLY 16 lowercase hex (sha16 row-hash convention).
137
+ // Longer hex is a length-spoof AND looks like material -> redact + flag.
138
+ const digest = inp.digest_sha16 ?? '';
139
+ if (!DIGEST_RE.test(digest)) {
140
+ return looksLikeMaterial(digest)
141
+ ? blocked('malformed-digest', 'material-not-reference-suspected')
142
+ : blocked('malformed-digest');
143
+ }
144
+
145
+ // Rung 5: cube address must be vantage-qualified per hilbert-collision canon.
146
+ const bhMatch = CUBE_BH_RE.exec(inp.cube_bh ?? '');
147
+ if (!bhMatch) return blocked('missing-or-unqualified-cube-address');
148
+
149
+ // Rungs 6-7: catalog and scope must be registered.
150
+ if (!CATALOGS.includes(inp.source_catalog ?? '')) return blocked('unknown-source-catalog');
151
+ if (!Object.hasOwn(SCOPES, inp.scope ?? '')) return blocked('unknown-scope');
152
+
153
+ // Rung 8: mode must be draft or live.
154
+ const mode = inp.mode ?? 'draft';
155
+ if (mode !== 'draft' && mode !== 'live') return blocked('unknown-mode');
156
+
157
+ // Rung 9: live binding is operator territory.
158
+ if (mode === 'live') return buildResult(inp, 'DEFER_TO_OPERATOR', ['live-binding-requires-operator']);
159
+
160
+ // Rung 10: scope escalation (mint/write) is cosign territory.
161
+ if (SCOPES[inp.scope].escalates) {
162
+ return buildResult(inp, 'DEFER_TO_OPERATOR', ['scope-escalation-requires-operator']);
163
+ }
164
+
165
+ // Rung 11: disputed hilbert band defers regardless of vantage or scope.
166
+ const index = Number(bhMatch[2]);
167
+ const disputed = DISPUTED_BANDS.find((band) => index >= band.lo && index <= band.hi);
168
+ if (disputed) {
169
+ return buildResult(inp, 'DEFER_TO_OPERATOR', [`disputed-hilbert-band-${disputed.lo}-${disputed.hi}-bilateral-ack-pending`]);
170
+ }
171
+
172
+ // Rung 12: clean draft binding, still executable=0 by contract.
173
+ return buildResult(inp, 'DRAFT_BINDING_READY', []);
174
+ }
175
+
176
+ export function statusRows() {
177
+ const rows = [
178
+ `TOKCUBEHDR|ok=1|id=${BINDER_ID}|component=3|kinds=${TOKEN_KINDS.length}|catalogs=${CATALOGS.length}|scopes=${Object.keys(SCOPES).length}|vantages=${BH_VANTAGES.length}|invariant=every-row-executable-0|state=DRAFT_CONTRACT_NO_LIVE_BINDING|json=0`,
179
+ 'TOKCUBELAW|rule=tokens-are-REFERENCES-never-material|redaction=material-shaped-rejects-show-redacted-not-echoed|address_rule=BH-vantage-qualified-per-hilbert-collision-canon|json=0',
180
+ ];
181
+ for (const kind of TOKEN_KINDS) rows.push(`TOKCUBEKIND|id=${kind}|json=0`);
182
+ for (const catalog of CATALOGS) rows.push(`TOKCUBECATALOG|id=${catalog}|membership=DRAFT_ASSUMPTION|json=0`);
183
+ for (const [id, meta] of Object.entries(SCOPES)) {
184
+ rows.push(`TOKCUBESCOPE|id=${id}|escalates=${meta.escalates}|max_verdict=${meta.escalates ? 'DEFER_TO_OPERATOR' : 'DRAFT_BINDING_READY'}|json=0`);
185
+ }
186
+ for (const band of DISPUTED_BANDS) {
187
+ rows.push(`TOKCUBEDISPUTED|lo=${band.lo}|hi=${band.hi}|why=${band.why}|verdict=DEFER_TO_OPERATOR|json=0`);
188
+ }
189
+ rows.push('TOKCUBESAFETY|mutates=0|pure_function=1|no_live_publish=1|no_fabric_call=1|no_mint=1|no_cube_mutation=1|no_key_generation=1|no_secret_material=1|json=0');
190
+ rows.push('TOKCUBEEND|state=COMPONENT_3_SEED_DRAFT_CONTRACT|json=0');
191
+ return rows;
192
+ }
193
+
194
+ // Parity baseline: fixed cases, time-free contract -- rows byte-identical
195
+ // on every machine with no clock input at all.
196
+ const BASE = Object.freeze({
197
+ token_id: 'TOK-GNN-EDGE-0001',
198
+ token_kind: 'sha16-row-hash',
199
+ digest_sha16: '794b8c68ec512f9e',
200
+ cube_bh: 'BH-ACER-754',
201
+ scope: 'read',
202
+ source_catalog: 'atlas-v55',
203
+ });
204
+ const PARITY_CASES = Object.freeze([
205
+ { id: '01', input: { ...BASE } },
206
+ { id: '02', input: { ...BASE, scope: 'attest' } },
207
+ { id: '03', input: { ...BASE, scope: 'bind-draft' } },
208
+ { id: '04', input: { ...BASE, scope: 'mint' } },
209
+ { id: '05', input: { ...BASE, scope: 'write' } },
210
+ { id: '06', input: { ...BASE, mode: 'live' } },
211
+ { id: '07', input: { ...BASE, cube_bh: 'BH-ACER-942' } },
212
+ { id: '08', input: { ...BASE, cube_bh: 'BH-ACER-929' } },
213
+ { id: '09', input: { ...BASE, cube_bh: 'BH-ACER-930' } },
214
+ { id: '10', input: { ...BASE, cube_bh: 'BH-LIRIS-1229' } },
215
+ { id: '11', input: { ...BASE, cube_bh: 'BH-LIRIS-1230' } },
216
+ { id: '12', input: { ...BASE, cube_bh: 'BH-942' } },
217
+ { id: '13', input: { ...BASE, token_kind: 'jwt-bearer' } },
218
+ { id: '14', input: { ...BASE, digest_sha16: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' } },
219
+ { id: '15', input: { ...BASE, digest_sha16: '794B8C68EC512F9E' } },
220
+ { id: '16', input: { ...BASE, digest_sha16: '794b8c68ec512f9' } },
221
+ { id: '17', input: { ...BASE, token_id: 'TOK-EVIL|json=1' } },
222
+ { id: '18', input: { ...BASE, source_catalog: 'catalog-of-doom' } },
223
+ { id: '19', input: { ...BASE, scope: 'root' } },
224
+ { id: '20', input: { ...BASE, cube_bh: null } },
225
+ { id: '21', input: { ...BASE, token_id: 'BEGIN-PRIVATE-KEY-MATERIAL-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' } },
226
+ { id: '22', input: { ...BASE, cube_bh: 'BH-SHARED-1', token_kind: 'cosign-seal', source_catalog: 'd22-translation' } },
227
+ ]);
228
+
229
+ export function emitParityRows() {
230
+ const rows = [
231
+ `TOKCUBEPARITYHDR|component=3|cases=${PARITY_CASES.length}|clock=none-time-free-contract|rule=rows-byte-identical-on-every-machine|json=0`,
232
+ ];
233
+ for (const probe of PARITY_CASES) {
234
+ const out = bindToken(probe.input);
235
+ rows.push(`TOKCUBEPARITY|case=${probe.id}|${out.row.slice('TOKCUBEBIND|'.length)}`);
236
+ }
237
+ rows.push(
238
+ `TOKCUBEPARITYFTR|cases=${PARITY_CASES.length}|exit=byte-match-when-regenerated-file-equals-sealed-baseline|json=0`,
239
+ );
240
+ return rows;
241
+ }
242
+
243
+ export function selfTest() {
244
+ const checks = [];
245
+ const add = (name, ok) => checks.push({ name, ok });
246
+
247
+ add('clean-draft-ready', bindToken({ ...BASE }).verdict === 'DRAFT_BINDING_READY');
248
+ add('mint-scope-defers', bindToken({ ...BASE, scope: 'mint' }).verdict === 'DEFER_TO_OPERATOR');
249
+ add('live-mode-defers', bindToken({ ...BASE, mode: 'live' }).verdict === 'DEFER_TO_OPERATOR');
250
+ add('disputed-band-defers', bindToken({ ...BASE, cube_bh: 'BH-ACER-942' }).gate.startsWith('disputed-hilbert-band'));
251
+ add('unqualified-bh-blocked', bindToken({ ...BASE, cube_bh: 'BH-942' }).verdict === 'DRAFT_BINDING_BLOCKED');
252
+ add('full-sha256-redacted', bindToken({ ...BASE, digest_sha16: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' }).digest_sha16 === 'redacted');
253
+ add('material-token-id-redacted', bindToken({ ...BASE, token_id: 'BEGIN-PRIVATE-KEY-MATERIAL-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' }).token_id === 'redacted');
254
+ add('every-row-executable-0', emitParityRows().slice(1, -1).every((row) => row.includes('|executable=0|')));
255
+ add('rows-hbp-only', [...statusRows(), ...emitParityRows()].every((row) => row.endsWith('json=0') && !row.includes('{"')));
256
+
257
+ return { ok: checks.every((check) => check.ok), checks };
258
+ }
259
+
260
+ const isMain = process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1]);
261
+
262
+ if (isMain) {
263
+ const cmd = process.argv[2] || '--status';
264
+ if (cmd === '--status') {
265
+ console.log(statusRows().join('\n'));
266
+ } else if (cmd === '--self-test') {
267
+ const result = selfTest();
268
+ for (const check of result.checks) console.log(`${check.ok ? 'PASS' : 'FAIL'} ${check.name}`);
269
+ process.exit(result.ok ? 0 : 1);
270
+ } else if (cmd === '--parity') {
271
+ process.stdout.write(emitParityRows().join('\n') + '\n');
272
+ } else {
273
+ console.error('usage: token-cube-catalog-binder.mjs --status | --self-test | --parity');
274
+ process.exit(1);
275
+ }
276
+ }
tools/behcs/token-cube-catalog-binder.mjs.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ CB410FB9F8FCD91DBF048A408AE9A7CBA92141323760BFC00D9BB9F61A526FAF token-cube-catalog-binder.mjs