@uuidna/qpu 0.1.0 → 0.1.2
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.
- package/CITATION.cff +9 -0
- package/README.md +105 -1083
- package/dist/quantum/processing/unit/boot.js +42 -0
- package/dist/quantum/processing/unit/gate.js +134 -0
- package/dist/quantum/processing/unit/index.js +2081 -854
- package/dist/quantum/processing/unit/lean.js +4 -0
- package/dist/quantum/processing/unit/publish.js +69 -0
- package/dist/quantum/processing/unit/version.js +2 -0
- package/install.json +72 -3
- package/mcp.json +956 -52
- package/package.json +35 -13
- package/qpu.d.ts +12 -0
- package/src/quantum/processing/unit/index.lean +33 -38
- package/dist/quantum/processing/unit/index.d.ts +0 -32017
- package/worker.js +0 -2
- package/wrangler.toml +0 -26
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// boot — THE UNIT ON REAL HARDWARE (the captain, 2026-09-12: "make hardware bootable with qpu").
|
|
3
|
+
//
|
|
4
|
+
// The unit is a fetch handler that answers only when named: https scheme, host qpu.uuidna.com. On a machine it has no
|
|
5
|
+
// Cloudflare in front of it, so this adapter presents every local request AS the named origin — same bytes, same unit,
|
|
6
|
+
// no fork — and a Node http server carries the replies. The seat doctrine applies here first: the simulator inside is
|
|
7
|
+
// the reference, and this boot does not serve until the unit has proven itself on this machine (`qpu_prove` holds).
|
|
8
|
+
//
|
|
9
|
+
// node dist/quantum/processing/unit/boot.js → prove, then serve on $PORT (8787)
|
|
10
|
+
// node dist/quantum/processing/unit/boot.js --prove → prove and exit 0/1 (the boot's receipt; the container's HEALTHCHECK)
|
|
11
|
+
import { createServer } from 'node:http';
|
|
12
|
+
import worker from './index.js';
|
|
13
|
+
const ORIGIN = 'https://qpu.uuidna.com';
|
|
14
|
+
const env = { QPU_HOST: 'qpu.uuidna.com' };
|
|
15
|
+
const bodyOf = (req) => new Promise((resolve) => { const chunks = []; req.on('data', (d) => chunks.push(d)); req.on('end', () => resolve(Buffer.concat(chunks))); });
|
|
16
|
+
const toRequest = async (req) => {
|
|
17
|
+
const method = req.method ?? 'GET';
|
|
18
|
+
const headers = {};
|
|
19
|
+
for (const [k, v] of Object.entries(req.headers))
|
|
20
|
+
if (typeof v === 'string')
|
|
21
|
+
headers[k] = v;
|
|
22
|
+
const body = method === 'GET' || method === 'HEAD' || method === 'OPTIONS' ? undefined : new Uint8Array(await bodyOf(req));
|
|
23
|
+
return new Request(ORIGIN + (req.url ?? '/'), { method, headers, body });
|
|
24
|
+
};
|
|
25
|
+
const prove = async () => {
|
|
26
|
+
const r = await worker.fetch(new Request(`${ORIGIN}/mcp`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'qpu_prove', arguments: {} } }) }), env);
|
|
27
|
+
const j = (await r.json());
|
|
28
|
+
const holds = j.result?.structuredContent?.holds ?? j.result?.holds;
|
|
29
|
+
console.log(`qpu boot — ${holds === true ? '✓ qpu_prove holds' : '✗ qpu_prove does not hold'} on ${process.platform}/${process.arch}, node ${process.version}`);
|
|
30
|
+
return holds === true;
|
|
31
|
+
};
|
|
32
|
+
const proven = await prove();
|
|
33
|
+
if (process.argv.includes('--prove'))
|
|
34
|
+
process.exit(proven ? 0 : 1);
|
|
35
|
+
if (!proven)
|
|
36
|
+
process.exit(1);
|
|
37
|
+
const port = Number(process.env.PORT ?? '8787');
|
|
38
|
+
createServer(async (req, res) => {
|
|
39
|
+
const r = await worker.fetch(await toRequest(req), env);
|
|
40
|
+
res.writeHead(r.status, Object.fromEntries(r.headers.entries()));
|
|
41
|
+
res.end(Buffer.from(await r.arrayBuffer()));
|
|
42
|
+
}).listen(port, () => console.log(`qpu boot — serving ${ORIGIN} at http://localhost:${port} (every request presented to the unit as the named origin)`));
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// gate — A VERBATIM COPY of packages/uuidna/src/gate.ts from ceccec/millennium-solutions, the prose honesty gate that
|
|
2
|
+
// drains overclaims ("we prove", "quantum computer", "unbreakable", ...) and passes bounded refusals. Vendored because
|
|
3
|
+
// the published @uuidna/uuidna does not export it (0.1.1 has no ./gate subpath; 0.3.0's root import fails on a missing
|
|
4
|
+
// lean/leads.json). gate.test.ts compares this file byte for byte with the sibling checkout whenever one is present,
|
|
5
|
+
// so drift is caught on the machine that pushes. Everything below this header is the upstream file, untouched.
|
|
6
|
+
// upstream: ../../ceccec/millennium-solutions/packages/uuidna/src/gate.ts
|
|
7
|
+
// The prose honesty gate — a text computes TRUE iff it makes no unqualified claim that (a) the Millennium
|
|
8
|
+
// problems are proven/solved, or (b) it breaks physics/hardware/crypto limits. HONEST ABOUT ITSELF: this is
|
|
9
|
+
// a lexical TRIPWIRE, not comprehension. Passing means "matches no known red-flag shape" — NOT "true".
|
|
10
|
+
// Necessary, not sufficient. Bounded refusals ("this is NOT faster than light") pass by the negation guard.
|
|
11
|
+
// RED is the negation-BLIND floor — matches that carry their own imbalance and cannot be reprieved. A bare
|
|
12
|
+
// "proven" is NOT here: it has two-sided gravity ("we have proven X" boasts, "X is not proven; it remains
|
|
13
|
+
// open" is the floor), so it moved to the negation-AWARE OVERREACH where the floor can change the verdict.
|
|
14
|
+
export const RED = /\bwe prove\b|confidence\s*=?\s*1\.0|ready for peer review|sealed via universal|cannot be (hacked|broken|cracked|defeated)|(no ?one|nobody) can (break|crack|hack|beat|defeat)/i;
|
|
15
|
+
// HARD IN ALL 7 — the same "we prove / proven" tripwire, in the seven locales' languages, so a translated
|
|
16
|
+
// overclaim cannot hide from an English-only gate. Targets the ASSERTION forms only, never the honest
|
|
17
|
+
// "proof of concept" nouns present in localized descriptions. Negation-blind, like RED.
|
|
18
|
+
export const RED_INTL = /wir haben bewiesen|bewiesen|nous avons prouv|prouvée?s?|démontrée?s?|hemos demostrado|demostrad[oa]s?|мы доказали|доказан[оаи]|доказали|доказахме|已证明|我们证明了|证明了|abbiamo dimostrato|dimostrat[oi]|demonstrámos|provámos|証明した|証明しました|أثبتنا|برهنّا|सिद्ध कर|udowodni\w*|wij hebben bewezen|bewezen|증명했|증명됨|증명된|kanıtladık|kanıtlan\w*|ispatladık|αποδείξαμε|αποδεδειγμ\w*|הוכחנו|מוכח|vi har bevisat|bevisa[dt]|membuktikan|dibuktikan|terbukti|đã chứng minh|được chứng minh|am demonstrat|dovedit\w*/i;
|
|
19
|
+
// Named problems PLUS the gravity binding: "all six/seven problems|proofs|conjectures|hypotheses" gravitates
|
|
20
|
+
// to the disputed cluster even with no problem NAMED. Requires a problem WORD, so "the six units" / "all seven
|
|
21
|
+
// streams" stay clear.
|
|
22
|
+
const PROBLEM = '(clay|millennium|riemann|hodge|poincar[eé]|navier[- ]?stokes|yang[- ]?mills|birch|swinnerton|p ?vs\\.? ?np|p versus np|p ?= ?np|all (six|seven|6|7) [^.]{0,12}?(problems?|proofs?|conjectures?|hypoth\\w+|puzzles?))';
|
|
23
|
+
// CLAIM stays at prove/solve. Widening it to settle/resolve/advance/crack was tried and reverted: it
|
|
24
|
+
// drained three honest files that were denying or quoting the very shapes it matches, which is what careful
|
|
25
|
+
// writing looks like. The residual gap and the reason are recorded in TRIAL.md, under test, rather than
|
|
26
|
+
// argued here — this file is exempt from the prose self-gate so that patterns can be named, not so that
|
|
27
|
+
// prose can hide in it.
|
|
28
|
+
const CLAIM = '(prov(e|es|ed|en|ing)|proofs? of|solv(e|es|ed|ing))';
|
|
29
|
+
const CRYPTO = '(rsa|aes|ecdsa|sha-?\\d+|discrete log(arithm)?|encryption|crypto\\w*)';
|
|
30
|
+
const BREAK = '(factor(s|ed|ing)?|break(s)?|broke(n)?|crack(s|ed)?|defeat(s|ed)?|reversed|replac(e|es|ed|ing)|supersed(e|es|ed|ing)|obsolet\\w*)';
|
|
31
|
+
const near = (a, b, n = 24) => '\\b' + a + '\\b[^.]{0,' + n + '}\\b' + b + '\\b';
|
|
32
|
+
export const OVERREACH = new RegExp([
|
|
33
|
+
'\\b(faster[ -]than[ -]light|superluminal|ftl|quantum (speedup|supremacy|advantage|at scale)|quantum (processor|computer)|quantum (encryption|cryptograph\\w*)|quantum (is (free|real|here|now|solved|magic)|for free)|the qpu|fastest (known|ever|in the world)|unbreakable|unhackable|impossible to (crack|break|violate|reverse|hack|defeat|forge|counterfeit)|prov(e|es|ed|ing) quantum|perpetual motion|over[- ]?unity|infinite energy|cold fusion|time travel|time machine|theory of everything|immortality|reverses? aging|defeats? death|cur(e|es|ed) (cancer|all diseases?|everything)|achieved (agi|superintelligence|sentience|consciousness)|is (sentient|self[- ]aware)|solv\\w* the halting problem|halting problem solved)\\b',
|
|
34
|
+
'\\b((thousands|millions|billions) of (orders of magnitude|magnitudes)|(thousands|millions|billions) of times (faster|speedup|quicker)|orders of magnitude faster)\\b',
|
|
35
|
+
'\\b(state[ -]?of[ -]?the[ -]?art|military[ -]?grade|bank[ -]?grade|world[ -]?class|enterprise[ -]?grade|next[ -]?gen(eration)?|best[ -]?in[ -]?class)\\b',
|
|
36
|
+
'\\b(100 ?% ?secure|(absolutely|totally|completely|fully|perfectly) (secure|private|anonymous)|tamper[ -]?proof|(hack|crack|break|bullet|fool)[ -]?proof|uncrackable|undefeatable|invulnerable|impenetrable|indestructible|provably secure|mathematically proven secure|guaranteed (correct|secure|private|safe)|always correct)\\b',
|
|
37
|
+
'\\b((most|best|strongest) (secure|private|encryption|security|cipher|hash)|fastest (hash|encryption|cipher|digest)|(ultimate|strongest|flawless|foolproof|perfect|unbeatable) (encryption|security|cipher|hash|crypto)|strongest \\w+ ever|(beats|defeats) all attacks|immune to attack)\\b',
|
|
38
|
+
'\\b(post[ -]?quantum|quantum[ -]?resistant|zero[ -]?knowledge|zero[ -]?trust|end[ -]?to[ -]?end (encrypt\\w*|secure)|solv\\w* (all )?(cryptography|encryption)|(cryptography|encryption) (is |completely |entirely )?solved)\\b',
|
|
39
|
+
'\\b(irrefutabl\\w*|incontrovertibl\\w*|indisputabl\\w*|beyond (all )?doubt|beyond question|conclusively (prov\\w*|shown|demonstrat\\w*)|definitive(ly)? (prov\\w*|solv\\w*|answer\\w*)|definitive proof)\\b',
|
|
40
|
+
'\\b(100 ?% ?(guaranteed|certain|proven)|guaranteed (profit|returns?|results?|income|success|wins?)|risk[- ]?free|financial freedom)\\b',
|
|
41
|
+
'\\b(miracle cure|clinically proven|doctor recommended|snake oil)\\b',
|
|
42
|
+
'\\b(revolutionary|groundbreaking|game[- ]?chang\\w*|world[- ]?(first|leading)|world.s (best|first|leading|greatest)|unparalleled|unrivall?ed|cutting[- ]?edge|bleeding[- ]?edge|battle[- ]?tested|production[- ]?hardened|industry[- ]?leading|enterprise[- ]?ready)\\b',
|
|
43
|
+
'\\b(antigravity|anti[- ]?gravity|warp[- ]?drive|free[- ]?energy|reactionless)\\b',
|
|
44
|
+
'\\b(superintelligen\\w*|artificial general intelligence|autonomous agi|conscious machine|sentient (ai|machine|system|program))\\b',
|
|
45
|
+
'\\b((hacker|nsa|zero[- ]?day|bullet)[- ]?proof)\\b',
|
|
46
|
+
'\\bproven\\b',
|
|
47
|
+
'all (six|seven|6|7) [^.]{0,16}?proven',
|
|
48
|
+
near(CLAIM, PROBLEM),
|
|
49
|
+
near(PROBLEM, CLAIM),
|
|
50
|
+
near(CRYPTO, BREAK, 20),
|
|
51
|
+
near(BREAK, CRYPTO, 20),
|
|
52
|
+
].join('|'), 'i');
|
|
53
|
+
// Whatever is negated is DEEP-RESEARCHED in trial, never waved through. A claim reprieves ONLY if it BECAME A
|
|
54
|
+
// SOLUTION, two ways: SOLUTION = a floor marker naming the answer (0/7, unsolved, remains open, refused,
|
|
55
|
+
// bounded), carrying a little past the match so "solved: 0/7" holds; PARITY = the claim's own CLAUSE holds an
|
|
56
|
+
// ODD (uncancelled) count of negators. An EVEN count cancels back to a boast ("not failed to prove" → drains);
|
|
57
|
+
// a negator across a clause break (. , ; : — –) is in another clause and never reaches this one (decoy treason).
|
|
58
|
+
const SOLUTION = /\b(refus\w*|drain(s|ed|ing)?|bounded( by)?|unsolved|unproven|open problem|remains? (open|unsolved|unproven)|only claims?)\b|0\s*\/\s*[679]|[:=]\s*0\b|\b0 of (the )?(six|seven|7)\b/i;
|
|
59
|
+
const NEG = /\b(not|never|no|none|nothing|neither|nor|without|cannot|can'?t|isn'?t|aren'?t|does ?n'?t|do ?n'?t|fail(s|ed|ing)?|impossible)\b/gi;
|
|
60
|
+
// The CONJUNCT around the claim: bounded on BOTH sides by a clause break OR coordinating conjunction
|
|
61
|
+
// (and/or/but/yet). Parallel honest negations each keep their own scope ("breaks NO cipher and replaces NONE"
|
|
62
|
+
// = two one-negator conjuncts, not one two-negator cancel); a double-negative stacked on one claim cancels
|
|
63
|
+
// ("not failed to prove" → drains). Both-sided bounding also captures negation AFTER the claim ("'most secure'
|
|
64
|
+
// is NOT a claim") while keeping a decoy across a break out.
|
|
65
|
+
const BOUND = /[.,;:—–]|\b(?:and|or|but|yet)\b/gi;
|
|
66
|
+
// The conjunct around the claim, with the MATCHED SPAN BLANKED OUT. A claim cannot bound itself: a
|
|
67
|
+
// negator that is part of the matched phrase ("impossible to crack") is the claim's own wording, not a
|
|
68
|
+
// limit placed on it, so it must not buy a reprieve. Only negators OUTSIDE the match are counted.
|
|
69
|
+
const conjunctOf = (t, i, j) => {
|
|
70
|
+
let s = 0;
|
|
71
|
+
for (const b of t.matchAll(BOUND)) {
|
|
72
|
+
const k = b.index, q = k + b[0].length;
|
|
73
|
+
if (q <= i)
|
|
74
|
+
s = q;
|
|
75
|
+
else if (k >= i)
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
const span = t.slice(i, j);
|
|
79
|
+
// Blank the span ONLY when the overclaim pattern itself STARTS with a negator ("impossible to crack"):
|
|
80
|
+
// there the negator is the claim's own wording. In a proximity match ("solves no Clay") the negator is
|
|
81
|
+
// real text between two anchors and genuinely bounds the claim, so it must still count.
|
|
82
|
+
const selfNegating = /^(?:not|never|no|none|nothing|neither|nor|without|cannot|can'?t|impossible)\b/i.test(span);
|
|
83
|
+
// BACKWARD-ONLY, deliberately. Including the text AFTER the match lets an incidental trailing negator
|
|
84
|
+
// reprieve a boast that has nothing to do with it: "unbreakable at no cost" would hold, because "no"
|
|
85
|
+
// lands in the conjunct. The governing clause therefore ends at the match. (Measured, not assumed: the
|
|
86
|
+
// deposit's own gate scoped this way, and collapsing the two copies onto the looser rule flipped two
|
|
87
|
+
// sealed theorems from PASS to FAIL.)
|
|
88
|
+
return t.slice(s, i) + (selfNegating ? ' '.repeat(j - i) : span);
|
|
89
|
+
};
|
|
90
|
+
// A copula negation immediately AFTER the claim negates it just as a preceding negator would
|
|
91
|
+
// ("'most secure' is NOT a claim we make"). The governing clause ends at the match, so this is checked
|
|
92
|
+
// separately against the text that follows it — otherwise the whole trailing clause would be pulled in
|
|
93
|
+
// and an incidental negator ("unbreakable at no cost") would reprieve the boast.
|
|
94
|
+
const COPULA_NEG = /^[\s"'’)\]]*\b(is|are|was|were|be|been|being|remains?|stays?|would|could|should|does|do|did|will|wo|ca|can|may|might|must|has|have|had)\b\s*(not|never|no|n['’]?t)\b/i;
|
|
95
|
+
export const PREDICT = /\b(guaranteed to|will (certainly|surely|inevitably|definitely|always)|is (inevitable|guaranteed|certain to)|bound to (hold|win|succeed) forever|roll(s)? (with it )?unchanged|absolutely proven)\b/i;
|
|
96
|
+
const NEGATOR_WORD = /\b(not|no|never|isn'?t|won'?t|will not|cannot|can'?t|without|neither|nor)\b/i;
|
|
97
|
+
// THE ROSETTA — Glagolitic (oldest Slavic script, U+2C00–U+2C5E) crosslinked to Cyrillic via a declared
|
|
98
|
+
// transliteration table, so a Slavic proof-boast in Glagolitic reaches the same detector as its Cyrillic
|
|
99
|
+
// twin. One message, many scripts. Uppercase folds to lowercase by the −0x30 offset before lookup.
|
|
100
|
+
const GLAG = {
|
|
101
|
+
'ⰰ': 'а', 'ⰱ': 'б', 'ⰲ': 'в', 'ⰳ': 'г', 'ⰴ': 'д', 'ⰵ': 'е', 'ⰶ': 'ж',
|
|
102
|
+
'ⰸ': 'з', 'ⰹ': 'и', 'ⰽ': 'к', 'ⰾ': 'л', 'ⰿ': 'м', 'ⱀ': 'н', 'ⱁ': 'о',
|
|
103
|
+
'ⱂ': 'п', 'ⱃ': 'р', 'ⱄ': 'с', 'ⱅ': 'т', 'ⱆ': 'у', 'ⱇ': 'ф', 'ⱈ': 'х',
|
|
104
|
+
'ⱋ': 'щ', 'ⱌ': 'ц', 'ⱍ': 'ч', 'ⱎ': 'ш',
|
|
105
|
+
};
|
|
106
|
+
export const rosetta = (t) => t.replace(/[Ⰰ-ⱞ]/g, (c) => GLAG[c] ?? GLAG[String.fromCodePoint(c.codePointAt(0) - 0x30)] ?? c);
|
|
107
|
+
/** The binary. true = honest (stays); false = overclaim (drained). `hit` is the exact prose that failed. */
|
|
108
|
+
export const computes = (text) => {
|
|
109
|
+
const r = text.match(RED);
|
|
110
|
+
if (r)
|
|
111
|
+
return { binary: 0, hit: r[0] };
|
|
112
|
+
const ri = text.match(RED_INTL) ?? rosetta(text).match(RED_INTL);
|
|
113
|
+
if (ri)
|
|
114
|
+
return { binary: 0, hit: ri[0] };
|
|
115
|
+
const re = new RegExp(OVERREACH.source, 'gi');
|
|
116
|
+
let m;
|
|
117
|
+
while ((m = re.exec(text))) {
|
|
118
|
+
const mEnd = m.index + m[0].length;
|
|
119
|
+
const win = text.slice(Math.max(0, m.index - 48), mEnd + 40);
|
|
120
|
+
const copula = COPULA_NEG.test(text.slice(mEnd, mEnd + 24)) ? 1 : 0;
|
|
121
|
+
const negs = (conjunctOf(text, m.index, mEnd).match(NEG) || []).length + copula;
|
|
122
|
+
const idiom = /\b(or not|whether)\b/i.test(text.slice(Math.max(0, m.index - 12), m.index + m[0].length + 10)); // "ftl or not" dismisses as hypothetical
|
|
123
|
+
if (!(SOLUTION.test(win) || negs % 2 === 1 || idiom))
|
|
124
|
+
return { binary: 0, hit: m[0] };
|
|
125
|
+
}
|
|
126
|
+
const pe = new RegExp(PREDICT.source, 'gi');
|
|
127
|
+
let pm;
|
|
128
|
+
while ((pm = pe.exec(text))) {
|
|
129
|
+
const win = text.slice(Math.max(0, pm.index - 48), pm.index + pm[0].length + 24);
|
|
130
|
+
if (!NEGATOR_WORD.test(win))
|
|
131
|
+
return { binary: 0, hit: pm[0] };
|
|
132
|
+
}
|
|
133
|
+
return { binary: 1, hit: null };
|
|
134
|
+
};
|