@provian/mcp 0.0.0-stage → 1.2.1
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/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/README.md +266 -2
- package/bin/provian-mcp.mjs +18 -0
- package/dist/agent-wallet-registration.d.ts +34 -0
- package/dist/agent-wallet-registration.d.ts.map +1 -0
- package/dist/agent-wallet-registration.js +440 -0
- package/dist/agent-wallet-registration.js.map +1 -0
- package/dist/core/challenge.d.ts +187 -0
- package/dist/core/challenge.d.ts.map +1 -0
- package/dist/core/challenge.js +536 -0
- package/dist/core/challenge.js.map +1 -0
- package/dist/core/crypto.d.ts +44 -0
- package/dist/core/crypto.d.ts.map +1 -0
- package/dist/core/crypto.js +124 -0
- package/dist/core/crypto.js.map +1 -0
- package/dist/core/disclosure-request.d.ts +169 -0
- package/dist/core/disclosure-request.d.ts.map +1 -0
- package/dist/core/disclosure-request.js +400 -0
- package/dist/core/disclosure-request.js.map +1 -0
- package/dist/core/genesis-offer.d.ts +25 -0
- package/dist/core/genesis-offer.d.ts.map +1 -0
- package/dist/core/genesis-offer.js +34 -0
- package/dist/core/genesis-offer.js.map +1 -0
- package/dist/core/harness-tool-vocabulary.d.ts +55 -0
- package/dist/core/harness-tool-vocabulary.d.ts.map +1 -0
- package/dist/core/harness-tool-vocabulary.js +116 -0
- package/dist/core/harness-tool-vocabulary.js.map +1 -0
- package/dist/core/keccak256.d.ts +15 -0
- package/dist/core/keccak256.d.ts.map +1 -0
- package/dist/core/keccak256.js +111 -0
- package/dist/core/keccak256.js.map +1 -0
- package/dist/core/key-custody.d.ts +33 -0
- package/dist/core/key-custody.d.ts.map +1 -0
- package/dist/core/key-custody.js +59 -0
- package/dist/core/key-custody.js.map +1 -0
- package/dist/core/meter-hash.d.ts +2 -0
- package/dist/core/meter-hash.d.ts.map +1 -0
- package/dist/core/meter-hash.js +8 -0
- package/dist/core/meter-hash.js.map +1 -0
- package/dist/core/meter-wire.d.ts +193 -0
- package/dist/core/meter-wire.d.ts.map +1 -0
- package/dist/core/meter-wire.js +418 -0
- package/dist/core/meter-wire.js.map +1 -0
- package/dist/core/output-signature.d.ts +162 -0
- package/dist/core/output-signature.d.ts.map +1 -0
- package/dist/core/output-signature.js +367 -0
- package/dist/core/output-signature.js.map +1 -0
- package/dist/core/presentation.d.ts +141 -0
- package/dist/core/presentation.d.ts.map +1 -0
- package/dist/core/presentation.js +160 -0
- package/dist/core/presentation.js.map +1 -0
- package/dist/core/recovery-seal.d.ts +36 -0
- package/dist/core/recovery-seal.d.ts.map +1 -0
- package/dist/core/recovery-seal.js +122 -0
- package/dist/core/recovery-seal.js.map +1 -0
- package/dist/core/server.d.ts +38 -0
- package/dist/core/server.d.ts.map +1 -0
- package/dist/core/server.js +106 -0
- package/dist/core/server.js.map +1 -0
- package/dist/core/thread-reader.d.ts +8 -0
- package/dist/core/thread-reader.d.ts.map +1 -0
- package/dist/core/thread-reader.js +47 -0
- package/dist/core/thread-reader.js.map +1 -0
- package/dist/core/tool-set.d.ts +28 -0
- package/dist/core/tool-set.d.ts.map +1 -0
- package/dist/core/tool-set.js +71 -0
- package/dist/core/tool-set.js.map +1 -0
- package/dist/core/tools.d.ts +151 -0
- package/dist/core/tools.d.ts.map +1 -0
- package/dist/core/tools.js +3623 -0
- package/dist/core/tools.js.map +1 -0
- package/dist/core/types.d.ts +189 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +17 -0
- package/dist/core/types.js.map +1 -0
- package/dist/credentials.d.ts +46 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +213 -0
- package/dist/credentials.js.map +1 -0
- package/dist/device-credentials.d.ts +57 -0
- package/dist/device-credentials.d.ts.map +1 -0
- package/dist/device-credentials.js +403 -0
- package/dist/device-credentials.js.map +1 -0
- package/dist/eip191.d.ts +18 -0
- package/dist/eip191.d.ts.map +1 -0
- package/dist/eip191.js +41 -0
- package/dist/eip191.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime-env.d.ts +131 -0
- package/dist/runtime-env.d.ts.map +1 -0
- package/dist/runtime-env.js +328 -0
- package/dist/runtime-env.js.map +1 -0
- package/dist/stdio.d.ts +6 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +136 -0
- package/dist/stdio.js.map +1 -0
- package/package.json +60 -4
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* REQUESTER-NAMED DISCLOSURE — the second part of a signed challenge.
|
|
4
|
+
*
|
|
5
|
+
* Beyond predicates, a signed challenge may NAME what it wants to see from the presenter's own
|
|
6
|
+
* record: a specific PE by one of its output digests (`kind: 'pe'`), or PEs witnessed by a named
|
|
7
|
+
* issuer or signer (`kind: 'witness'`); each request may name specific FIELDS of the record (dotted
|
|
8
|
+
* paths into the act's pricing projection) and elect CONTENT (`description`, `intent`,
|
|
9
|
+
* `artifacts`, `fact_tier`). The predicate grammar is frozen; disclosure requests are a distinct
|
|
10
|
+
* part of the challenge, committed by their own `disclosures=` line in the signing string ONLY
|
|
11
|
+
* when present, so every pre-existing challenge signs byte-identical bytes.
|
|
12
|
+
*
|
|
13
|
+
* The presenter ELECTS per request: `disclosed` (with the matching records it holds, proven to the
|
|
14
|
+
* anchored root) or `declined` (signed as declined). Nothing is disclosed without an election; the
|
|
15
|
+
* floor of every disclosed record is METADATA (pe id, hash, action type, time, the witness facts
|
|
16
|
+
* the relay verified at issuance); fields and content appear only when requested AND elected.
|
|
17
|
+
* Standing is always present (disclosures ride the reputation tier). Disclosures travel only inside
|
|
18
|
+
* the requester-bound presentation; the relay retains nothing; nothing surfaces in the Commons.
|
|
19
|
+
*
|
|
20
|
+
* This module is the single source of the shapes, the canonical forms and the digests. Mirrored
|
|
21
|
+
* byte-for-byte (modulo the hash primitive import) in the SDK (`src/disclosure-request.ts`), the
|
|
22
|
+
* MCP core and the app (`src/core/presentation/disclosureRequest.ts`); the fixed vectors in
|
|
23
|
+
* `disclosure-request.test.ts` are pinned identically in each package.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.DISCLOSURE_ELECTIONS = exports.DISCLOSURE_CONTENT_ELECTIONS = exports.DISCLOSURE_RECORD_MAX_BYTES = exports.DISCLOSURE_RECORDS_MAX_TOTAL = exports.DISCLOSURE_RECORDS_MAX_LIMIT = exports.DISCLOSURE_RECORDS_DEFAULT_LIMIT = exports.DISCLOSURE_FIELD_PATH_MAX_DEPTH = exports.DISCLOSURE_FIELDS_MAX = exports.DISCLOSURE_REQUESTS_MAX = void 0;
|
|
27
|
+
exports.canonicalJson = canonicalJson;
|
|
28
|
+
exports.isDisclosureFieldPath = isDisclosureFieldPath;
|
|
29
|
+
exports.canonicalDisclosureRequest = canonicalDisclosureRequest;
|
|
30
|
+
exports.disclosureRequestKey = disclosureRequestKey;
|
|
31
|
+
exports.normalizeDisclosureRequests = normalizeDisclosureRequests;
|
|
32
|
+
exports.disclosureRequestMatches = disclosureRequestMatches;
|
|
33
|
+
exports.challengeDisclosuresDigest = challengeDisclosuresDigest;
|
|
34
|
+
exports.canonicalDisclosureAnswers = canonicalDisclosureAnswers;
|
|
35
|
+
exports.disclosureAnswersDigest = disclosureAnswersDigest;
|
|
36
|
+
exports.readFieldPath = readFieldPath;
|
|
37
|
+
exports.parseDisclosureAnswers = parseDisclosureAnswers;
|
|
38
|
+
exports.recordMatchesRequest = recordMatchesRequest;
|
|
39
|
+
exports.recordFloor = recordFloor;
|
|
40
|
+
exports.disclosureCommitment = disclosureCommitment;
|
|
41
|
+
exports.disclosureCommitmentDigest = disclosureCommitmentDigest;
|
|
42
|
+
const crypto_1 = require("crypto");
|
|
43
|
+
exports.DISCLOSURE_REQUESTS_MAX = 16;
|
|
44
|
+
exports.DISCLOSURE_FIELDS_MAX = 32;
|
|
45
|
+
exports.DISCLOSURE_FIELD_PATH_MAX_DEPTH = 6;
|
|
46
|
+
exports.DISCLOSURE_RECORDS_DEFAULT_LIMIT = 10;
|
|
47
|
+
exports.DISCLOSURE_RECORDS_MAX_LIMIT = 50;
|
|
48
|
+
/** Every disclosed record of one presentation, across requests. */
|
|
49
|
+
exports.DISCLOSURE_RECORDS_MAX_TOTAL = 50;
|
|
50
|
+
/** Canonical bytes of one disclosed record (fields + content), a hard cap against a data channel. */
|
|
51
|
+
exports.DISCLOSURE_RECORD_MAX_BYTES = 64 * 1024;
|
|
52
|
+
exports.DISCLOSURE_CONTENT_ELECTIONS = ['description', 'intent', 'artifacts', 'fact_tier'];
|
|
53
|
+
exports.DISCLOSURE_ELECTIONS = ['disclosed', 'declined'];
|
|
54
|
+
const HEX64_RE = /^[0-9a-f]{64}$/;
|
|
55
|
+
const FIELD_SEGMENT_RE = /^[A-Za-z0-9_-]{1,64}$/;
|
|
56
|
+
/** An issuer or signer name: a root fingerprint (64 hex), `chain:<name>`, a hostname, a device id. */
|
|
57
|
+
const WITNESS_NAME_RE = /^[A-Za-z0-9:._-]{1,128}$/;
|
|
58
|
+
function isRecord(v) {
|
|
59
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
60
|
+
}
|
|
61
|
+
function sha256hex(input) {
|
|
62
|
+
return (0, crypto_1.createHash)('sha256').update(input, 'utf8').digest('hex');
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Canonical JSON (sorted keys, no whitespace, undefined members dropped) — the same rule the meter
|
|
66
|
+
* wire uses, carried here so this module stays dependency-free in every package.
|
|
67
|
+
*/
|
|
68
|
+
function canonicalJson(value) {
|
|
69
|
+
if (value === null)
|
|
70
|
+
return 'null';
|
|
71
|
+
if (typeof value === 'number') {
|
|
72
|
+
if (!Number.isFinite(value))
|
|
73
|
+
throw new Error('canonical_json_non_finite_number');
|
|
74
|
+
return JSON.stringify(value);
|
|
75
|
+
}
|
|
76
|
+
if (typeof value === 'string' || typeof value === 'boolean')
|
|
77
|
+
return JSON.stringify(value);
|
|
78
|
+
if (Array.isArray(value))
|
|
79
|
+
return '[' + value.map((v) => (v === undefined ? 'null' : canonicalJson(v))).join(',') + ']';
|
|
80
|
+
if (typeof value === 'object') {
|
|
81
|
+
const obj = value;
|
|
82
|
+
const keys = Object.keys(obj).filter((k) => obj[k] !== undefined).sort();
|
|
83
|
+
return '{' + keys.map((k) => JSON.stringify(k) + ':' + canonicalJson(obj[k])).join(',') + '}';
|
|
84
|
+
}
|
|
85
|
+
throw new Error(`canonical_json_unsupported_type:${typeof value}`);
|
|
86
|
+
}
|
|
87
|
+
const FORBIDDEN_FIELD_SEGMENTS = new Set(['__proto__', 'constructor', 'prototype']);
|
|
88
|
+
/** A dotted field path into the pricing projection: 1..6 segments of `[A-Za-z0-9_-]{1,64}`. */
|
|
89
|
+
function isDisclosureFieldPath(path) {
|
|
90
|
+
if (typeof path !== 'string' || path.length === 0 || path.length > 256)
|
|
91
|
+
return false;
|
|
92
|
+
const segments = path.split('.');
|
|
93
|
+
// Prototype-chain names are refused in every path (Security Invariant #6), never read around.
|
|
94
|
+
return segments.length <= exports.DISCLOSURE_FIELD_PATH_MAX_DEPTH
|
|
95
|
+
&& segments.every((s) => FIELD_SEGMENT_RE.test(s) && !FORBIDDEN_FIELD_SEGMENTS.has(s));
|
|
96
|
+
}
|
|
97
|
+
function normalizeFields(raw) {
|
|
98
|
+
if (raw === undefined)
|
|
99
|
+
return undefined;
|
|
100
|
+
if (!Array.isArray(raw) || raw.length > exports.DISCLOSURE_FIELDS_MAX)
|
|
101
|
+
return null;
|
|
102
|
+
const out = new Set();
|
|
103
|
+
for (const f of raw) {
|
|
104
|
+
if (!isDisclosureFieldPath(f))
|
|
105
|
+
return null;
|
|
106
|
+
out.add(f);
|
|
107
|
+
}
|
|
108
|
+
return [...out].sort();
|
|
109
|
+
}
|
|
110
|
+
function normalizeContent(raw) {
|
|
111
|
+
if (raw === undefined)
|
|
112
|
+
return undefined;
|
|
113
|
+
if (!Array.isArray(raw) || raw.length > exports.DISCLOSURE_CONTENT_ELECTIONS.length)
|
|
114
|
+
return null;
|
|
115
|
+
const out = new Set();
|
|
116
|
+
for (const c of raw) {
|
|
117
|
+
if (typeof c !== 'string' || !exports.DISCLOSURE_CONTENT_ELECTIONS.includes(c))
|
|
118
|
+
return null;
|
|
119
|
+
out.add(c);
|
|
120
|
+
}
|
|
121
|
+
return [...out].sort();
|
|
122
|
+
}
|
|
123
|
+
function normalizeDigest(raw) {
|
|
124
|
+
if (typeof raw !== 'string')
|
|
125
|
+
return null;
|
|
126
|
+
const d = raw.trim().toLowerCase().replace(/^sha256:/, '').replace(/^0x/, '');
|
|
127
|
+
return HEX64_RE.test(d) ? d : null;
|
|
128
|
+
}
|
|
129
|
+
function normalizeWitnessName(raw) {
|
|
130
|
+
if (raw === undefined)
|
|
131
|
+
return undefined;
|
|
132
|
+
if (typeof raw !== 'string')
|
|
133
|
+
return null;
|
|
134
|
+
const n = raw.trim().toLowerCase();
|
|
135
|
+
return WITNESS_NAME_RE.test(n) ? n : null;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Parse ONE untrusted disclosure request into its canonical form, fail-closed (`null` on anything
|
|
139
|
+
* malformed: an unknown kind, a digest that is not 64 hex, a witness request naming neither issuer
|
|
140
|
+
* nor signer, a bad field path, an unknown content election, a limit outside 1..50).
|
|
141
|
+
*/
|
|
142
|
+
function canonicalDisclosureRequest(raw) {
|
|
143
|
+
if (!isRecord(raw))
|
|
144
|
+
return null;
|
|
145
|
+
const fields = normalizeFields(raw.fields);
|
|
146
|
+
if (fields === null)
|
|
147
|
+
return null;
|
|
148
|
+
const content = normalizeContent(raw.content);
|
|
149
|
+
if (content === null)
|
|
150
|
+
return null;
|
|
151
|
+
const tail = {
|
|
152
|
+
...(fields !== undefined && fields.length > 0 ? { fields } : {}),
|
|
153
|
+
...(content !== undefined && content.length > 0 ? { content } : {}),
|
|
154
|
+
};
|
|
155
|
+
if (raw.kind === 'pe') {
|
|
156
|
+
const digest = normalizeDigest(raw.output_digest);
|
|
157
|
+
if (digest === null)
|
|
158
|
+
return null;
|
|
159
|
+
const issuer = normalizeWitnessName(raw.issuer);
|
|
160
|
+
if (issuer === null)
|
|
161
|
+
return null;
|
|
162
|
+
for (const k of Object.keys(raw))
|
|
163
|
+
if (!['kind', 'output_digest', 'issuer', 'fields', 'content'].includes(k))
|
|
164
|
+
return null;
|
|
165
|
+
return { kind: 'pe', output_digest: digest, ...(issuer !== undefined ? { issuer } : {}), ...tail };
|
|
166
|
+
}
|
|
167
|
+
if (raw.kind === 'witness') {
|
|
168
|
+
const issuer = normalizeWitnessName(raw.issuer);
|
|
169
|
+
const signer = normalizeWitnessName(raw.signer);
|
|
170
|
+
if (issuer === null || signer === null)
|
|
171
|
+
return null;
|
|
172
|
+
if (issuer === undefined && signer === undefined)
|
|
173
|
+
return null;
|
|
174
|
+
let limit = exports.DISCLOSURE_RECORDS_DEFAULT_LIMIT;
|
|
175
|
+
if (raw.limit !== undefined) {
|
|
176
|
+
if (typeof raw.limit !== 'number' || !Number.isInteger(raw.limit) || raw.limit < 1 || raw.limit > exports.DISCLOSURE_RECORDS_MAX_LIMIT)
|
|
177
|
+
return null;
|
|
178
|
+
limit = raw.limit;
|
|
179
|
+
}
|
|
180
|
+
for (const k of Object.keys(raw))
|
|
181
|
+
if (!['kind', 'issuer', 'signer', 'limit', 'fields', 'content'].includes(k))
|
|
182
|
+
return null;
|
|
183
|
+
return { kind: 'witness', ...(issuer !== undefined ? { issuer } : {}), ...(signer !== undefined ? { signer } : {}), limit, ...tail };
|
|
184
|
+
}
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
/** The order-independent identity of a request (its canonical JSON). */
|
|
188
|
+
function disclosureRequestKey(req) {
|
|
189
|
+
return canonicalJson(req);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Parse an untrusted request list, fail-closed: `[]` for absent, `null` when it is not a list, is
|
|
193
|
+
* over the cap, carries a malformed entry, or names the same request twice.
|
|
194
|
+
*/
|
|
195
|
+
function normalizeDisclosureRequests(raw) {
|
|
196
|
+
if (raw === undefined || raw === null)
|
|
197
|
+
return [];
|
|
198
|
+
if (!Array.isArray(raw) || raw.length > exports.DISCLOSURE_REQUESTS_MAX)
|
|
199
|
+
return null;
|
|
200
|
+
const out = [];
|
|
201
|
+
const seen = new Set();
|
|
202
|
+
for (const entry of raw) {
|
|
203
|
+
const c = canonicalDisclosureRequest(entry);
|
|
204
|
+
if (c === null)
|
|
205
|
+
return null;
|
|
206
|
+
const key = disclosureRequestKey(c);
|
|
207
|
+
if (seen.has(key))
|
|
208
|
+
return null;
|
|
209
|
+
seen.add(key);
|
|
210
|
+
out.push(c);
|
|
211
|
+
}
|
|
212
|
+
return out.sort((a, b) => disclosureRequestKey(a).localeCompare(disclosureRequestKey(b)));
|
|
213
|
+
}
|
|
214
|
+
/** Two requests are the same when their canonical forms are byte-identical. */
|
|
215
|
+
function disclosureRequestMatches(a, b) {
|
|
216
|
+
return disclosureRequestKey(a) === disclosureRequestKey(b);
|
|
217
|
+
}
|
|
218
|
+
/** sha256 hex of the canonical, sorted request list — the `disclosures=` signing-string commitment. */
|
|
219
|
+
function challengeDisclosuresDigest(requests) {
|
|
220
|
+
const sorted = [...(requests ?? [])].sort((a, b) => disclosureRequestKey(a).localeCompare(disclosureRequestKey(b)));
|
|
221
|
+
return sha256hex(canonicalJson(sorted));
|
|
222
|
+
}
|
|
223
|
+
/** The canonical, order-independent form of the answers — what the presenter's proof of possession
|
|
224
|
+
* and the Provian signature commit to (elections AND records). */
|
|
225
|
+
function canonicalDisclosureAnswers(answers) {
|
|
226
|
+
return [...answers]
|
|
227
|
+
.map((a) => ({
|
|
228
|
+
request: a.request,
|
|
229
|
+
election: a.election,
|
|
230
|
+
...(a.election === 'disclosed' ? { records: [...(a.records ?? [])].sort((x, y) => x.pe_id.localeCompare(y.pe_id)) } : {}),
|
|
231
|
+
}))
|
|
232
|
+
.sort((a, b) => disclosureRequestKey(a.request).localeCompare(disclosureRequestKey(b.request)));
|
|
233
|
+
}
|
|
234
|
+
/** sha256 hex of the canonical answers — the `disclosures=` line of the claims digest. */
|
|
235
|
+
function disclosureAnswersDigest(answers) {
|
|
236
|
+
return sha256hex(canonicalJson(canonicalDisclosureAnswers(answers)));
|
|
237
|
+
}
|
|
238
|
+
/** Read a dotted path off a plain object; `null` when any segment is absent. */
|
|
239
|
+
function readFieldPath(source, path) {
|
|
240
|
+
let cur = source;
|
|
241
|
+
for (const seg of path.split('.')) {
|
|
242
|
+
if (Array.isArray(cur)) {
|
|
243
|
+
const i = Number(seg);
|
|
244
|
+
if (!Number.isInteger(i) || i < 0 || i >= cur.length)
|
|
245
|
+
return null;
|
|
246
|
+
cur = cur[i];
|
|
247
|
+
}
|
|
248
|
+
else if (isRecord(cur) && Object.prototype.hasOwnProperty.call(cur, seg)) {
|
|
249
|
+
cur = cur[seg];
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return cur === undefined ? null : cur;
|
|
256
|
+
}
|
|
257
|
+
/** Parse an untrusted answer list structurally (elections and record floors); `null` when malformed. */
|
|
258
|
+
function parseDisclosureAnswers(raw) {
|
|
259
|
+
if (raw === undefined || raw === null)
|
|
260
|
+
return [];
|
|
261
|
+
if (!Array.isArray(raw) || raw.length > exports.DISCLOSURE_REQUESTS_MAX)
|
|
262
|
+
return null;
|
|
263
|
+
const out = [];
|
|
264
|
+
const seen = new Set();
|
|
265
|
+
let total = 0;
|
|
266
|
+
for (const entry of raw) {
|
|
267
|
+
if (!isRecord(entry))
|
|
268
|
+
return null;
|
|
269
|
+
const request = canonicalDisclosureRequest(entry.request);
|
|
270
|
+
if (request === null)
|
|
271
|
+
return null;
|
|
272
|
+
const key = disclosureRequestKey(request);
|
|
273
|
+
if (seen.has(key))
|
|
274
|
+
return null;
|
|
275
|
+
seen.add(key);
|
|
276
|
+
if (entry.election !== 'disclosed' && entry.election !== 'declined')
|
|
277
|
+
return null;
|
|
278
|
+
if (entry.election === 'declined') {
|
|
279
|
+
if (entry.records !== undefined)
|
|
280
|
+
return null;
|
|
281
|
+
out.push({ request, election: 'declined' });
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
if (!Array.isArray(entry.records))
|
|
285
|
+
return null;
|
|
286
|
+
const limit = request.kind === 'witness' ? request.limit : 1;
|
|
287
|
+
if (entry.records.length > limit)
|
|
288
|
+
return null;
|
|
289
|
+
const records = [];
|
|
290
|
+
const ids = new Set();
|
|
291
|
+
for (const r of entry.records) {
|
|
292
|
+
const rec = parseDisclosedRecord(r);
|
|
293
|
+
if (rec === null || ids.has(rec.pe_id))
|
|
294
|
+
return null;
|
|
295
|
+
ids.add(rec.pe_id);
|
|
296
|
+
records.push(rec);
|
|
297
|
+
total += 1;
|
|
298
|
+
if (total > exports.DISCLOSURE_RECORDS_MAX_TOTAL)
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
out.push({ request, election: 'disclosed', records });
|
|
302
|
+
}
|
|
303
|
+
return out;
|
|
304
|
+
}
|
|
305
|
+
function parseDisclosedRecord(raw) {
|
|
306
|
+
if (!isRecord(raw))
|
|
307
|
+
return null;
|
|
308
|
+
if (typeof raw.pe_id !== 'string' || raw.pe_id.length === 0 || raw.pe_id.length > 256)
|
|
309
|
+
return null;
|
|
310
|
+
const hash = normalizeDigest(raw.pe_hash);
|
|
311
|
+
if (hash === null)
|
|
312
|
+
return null;
|
|
313
|
+
if (typeof raw.action_type !== 'string' || raw.action_type.length === 0 || raw.action_type.length > 128)
|
|
314
|
+
return null;
|
|
315
|
+
if (typeof raw.timestamp !== 'number' || !Number.isSafeInteger(raw.timestamp) || raw.timestamp < 0)
|
|
316
|
+
return null;
|
|
317
|
+
const w = raw.witness;
|
|
318
|
+
if (!isRecord(w) || (w.kind !== 'hardware' && w.kind !== 'chain' && w.kind !== 'device'))
|
|
319
|
+
return null;
|
|
320
|
+
const witness = { kind: w.kind };
|
|
321
|
+
for (const k of ['scheme', 'issuer', 'signer', 'measurement', 'region', 'ref']) {
|
|
322
|
+
if (w[k] === undefined)
|
|
323
|
+
continue;
|
|
324
|
+
if (typeof w[k] !== 'string' || w[k].length > 256)
|
|
325
|
+
return null;
|
|
326
|
+
witness[k] = w[k];
|
|
327
|
+
}
|
|
328
|
+
const rec = { pe_id: raw.pe_id, pe_hash: hash, action_type: raw.action_type, timestamp: raw.timestamp, witness };
|
|
329
|
+
if (raw.output_digest !== undefined) {
|
|
330
|
+
const d = normalizeDigest(raw.output_digest);
|
|
331
|
+
if (d === null)
|
|
332
|
+
return null;
|
|
333
|
+
rec.output_digest = d;
|
|
334
|
+
}
|
|
335
|
+
if (raw.fields !== undefined) {
|
|
336
|
+
if (!isRecord(raw.fields))
|
|
337
|
+
return null;
|
|
338
|
+
for (const k of Object.keys(raw.fields))
|
|
339
|
+
if (!isDisclosureFieldPath(k))
|
|
340
|
+
return null;
|
|
341
|
+
rec.fields = raw.fields;
|
|
342
|
+
}
|
|
343
|
+
if (raw.content !== undefined) {
|
|
344
|
+
if (!isRecord(raw.content))
|
|
345
|
+
return null;
|
|
346
|
+
for (const k of Object.keys(raw.content))
|
|
347
|
+
if (!exports.DISCLOSURE_CONTENT_ELECTIONS.includes(k))
|
|
348
|
+
return null;
|
|
349
|
+
rec.content = raw.content;
|
|
350
|
+
}
|
|
351
|
+
try {
|
|
352
|
+
if (canonicalJson(rec).length > exports.DISCLOSURE_RECORD_MAX_BYTES)
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
return rec;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Does a record satisfy the request it answers? `pe`: the record carries the named digest (and the
|
|
362
|
+
* issuer when named). `witness`: the record's witness carries the named issuer / signer.
|
|
363
|
+
*/
|
|
364
|
+
function recordMatchesRequest(record, request) {
|
|
365
|
+
if (request.kind === 'pe') {
|
|
366
|
+
if (record.output_digest !== request.output_digest)
|
|
367
|
+
return false;
|
|
368
|
+
if (request.issuer !== undefined && record.witness.issuer !== request.issuer)
|
|
369
|
+
return false;
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
if (request.issuer !== undefined && record.witness.issuer !== request.issuer)
|
|
373
|
+
return false;
|
|
374
|
+
if (request.signer !== undefined && record.witness.signer !== request.signer)
|
|
375
|
+
return false;
|
|
376
|
+
return true;
|
|
377
|
+
}
|
|
378
|
+
/** The floor-only view of a record: no fields, no content — what a declined-content request yields. */
|
|
379
|
+
function recordFloor(record) {
|
|
380
|
+
const { fields: _f, content: _c, ...floor } = record;
|
|
381
|
+
return floor;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* The PRESENTER'S commitment: what it elected and WHICH records (by id + hash) it put forward —
|
|
385
|
+
* everything the presenter can know before the relay derives the witness facts. Its sha256 is the
|
|
386
|
+
* `disclosures=` line of the claims digest the proof of possession signs; the relay-derived facts,
|
|
387
|
+
* fields and content are covered by the Provian signature over the payload, and a verifier checks
|
|
388
|
+
* every field against the anchored act record itself.
|
|
389
|
+
*/
|
|
390
|
+
function disclosureCommitment(answers) {
|
|
391
|
+
return canonicalDisclosureAnswers(answers).map((a) => ({
|
|
392
|
+
request: a.request,
|
|
393
|
+
election: a.election,
|
|
394
|
+
...(a.election === 'disclosed' ? { records: (a.records ?? []).map((r) => ({ pe_id: r.pe_id, pe_hash: r.pe_hash })) } : {}),
|
|
395
|
+
}));
|
|
396
|
+
}
|
|
397
|
+
function disclosureCommitmentDigest(answers) {
|
|
398
|
+
return sha256hex(canonicalJson(disclosureCommitment(answers)));
|
|
399
|
+
}
|
|
400
|
+
//# sourceMappingURL=disclosure-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disclosure-request.js","sourceRoot":"","sources":["../../src/core/disclosure-request.ts"],"names":[],"m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I,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC3F,OAAO,IAAI,CAAC;AACd,CAAC;AAED,uGAAuG;AACvG,SAAgB,WAAW,CAAC,MAAuB;IACjD,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;IACrD,OAAO,KAAK,CAAC;AACf,CAAC;AASD;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,OAAoC;IACvE,OAAO,0BAA0B,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACrD,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,GAAG,CAAC,CAAC,CAAC,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3H,CAAC,CAAC,CAAC;AACN,CAAC;AAED,SAAgB,0BAA0B,CAAC,OAAoC;IAC7E,OAAO,SAAS,CAAC,aAAa,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Genesis offer line — LEADS the MCP server's startup output (stdio banner on
|
|
3
|
+
* stderr) and its initialize `instructions` while the Genesis window is open, and
|
|
4
|
+
* is absent after it closes. A runtime date check: the line retires itself at the
|
|
5
|
+
* window's end with no republish or redeploy.
|
|
6
|
+
*
|
|
7
|
+
* SHARED CORE — canonical in `provian-mcp/src/core/`, mirrored into
|
|
8
|
+
* `provian-backend/src/mcp/core/` (scripts/sync-mcp-core.sh). Edit only the
|
|
9
|
+
* canonical copy. The relay's hosted bootstrap script builder also reads this
|
|
10
|
+
* constant from the mirror, so the backend defines it exactly once.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 2027-01-01T00:00:00Z in ms — the Genesis window's END (exclusive). This is the
|
|
14
|
+
* relay's checked-in Genesis campaign manifest `window.end_ms`
|
|
15
|
+
* (PROPOSED_GENESIS_CAMPAIGN_POLICY, open through December 31, 2026) and the
|
|
16
|
+
* live PVT9 kernel's on-chain `genesisEndsAt` (1798761600 s). If the manifest
|
|
17
|
+
* or the kernel ever moves the close, move this with it.
|
|
18
|
+
*/
|
|
19
|
+
export declare const GENESIS_WINDOW_END_MS = 1798761600000;
|
|
20
|
+
export declare const GENESIS_OFFER_LINE = "Genesis is open through December 31, 2026: a new agent wallet receives 74.25 PVT net from a 75 PVT gross grant.";
|
|
21
|
+
/** True while the Genesis window is open (strictly before its end instant). */
|
|
22
|
+
export declare function isGenesisWindowOpen(nowMs?: number): boolean;
|
|
23
|
+
/** The lines to lead the output with: the offer while open, nothing after. */
|
|
24
|
+
export declare function genesisOfferLines(nowMs?: number): string[];
|
|
25
|
+
//# sourceMappingURL=genesis-offer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genesis-offer.d.ts","sourceRoot":"","sources":["../../src/core/genesis-offer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,gBAAoB,CAAC;AAEvD,eAAO,MAAM,kBAAkB,oHACoF,CAAC;AAEpH,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,MAAmB,GAAG,OAAO,CAEvE;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,KAAK,GAAE,MAAmB,GAAG,MAAM,EAAE,CAEtE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The Genesis offer line — LEADS the MCP server's startup output (stdio banner on
|
|
4
|
+
* stderr) and its initialize `instructions` while the Genesis window is open, and
|
|
5
|
+
* is absent after it closes. A runtime date check: the line retires itself at the
|
|
6
|
+
* window's end with no republish or redeploy.
|
|
7
|
+
*
|
|
8
|
+
* SHARED CORE — canonical in `provian-mcp/src/core/`, mirrored into
|
|
9
|
+
* `provian-backend/src/mcp/core/` (scripts/sync-mcp-core.sh). Edit only the
|
|
10
|
+
* canonical copy. The relay's hosted bootstrap script builder also reads this
|
|
11
|
+
* constant from the mirror, so the backend defines it exactly once.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.GENESIS_OFFER_LINE = exports.GENESIS_WINDOW_END_MS = void 0;
|
|
15
|
+
exports.isGenesisWindowOpen = isGenesisWindowOpen;
|
|
16
|
+
exports.genesisOfferLines = genesisOfferLines;
|
|
17
|
+
/**
|
|
18
|
+
* 2027-01-01T00:00:00Z in ms — the Genesis window's END (exclusive). This is the
|
|
19
|
+
* relay's checked-in Genesis campaign manifest `window.end_ms`
|
|
20
|
+
* (PROPOSED_GENESIS_CAMPAIGN_POLICY, open through December 31, 2026) and the
|
|
21
|
+
* live PVT9 kernel's on-chain `genesisEndsAt` (1798761600 s). If the manifest
|
|
22
|
+
* or the kernel ever moves the close, move this with it.
|
|
23
|
+
*/
|
|
24
|
+
exports.GENESIS_WINDOW_END_MS = 1798761600000;
|
|
25
|
+
exports.GENESIS_OFFER_LINE = 'Genesis is open through December 31, 2026: a new agent wallet receives 74.25 PVT net from a 75 PVT gross grant.';
|
|
26
|
+
/** True while the Genesis window is open (strictly before its end instant). */
|
|
27
|
+
function isGenesisWindowOpen(nowMs = Date.now()) {
|
|
28
|
+
return Number.isFinite(nowMs) && nowMs < exports.GENESIS_WINDOW_END_MS;
|
|
29
|
+
}
|
|
30
|
+
/** The lines to lead the output with: the offer while open, nothing after. */
|
|
31
|
+
function genesisOfferLines(nowMs = Date.now()) {
|
|
32
|
+
return isGenesisWindowOpen(nowMs) ? [exports.GENESIS_OFFER_LINE] : [];
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=genesis-offer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genesis-offer.js","sourceRoot":"","sources":["../../src/core/genesis-offer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAeH,kDAEC;AAGD,8CAEC;AApBD;;;;;;GAMG;AACU,QAAA,qBAAqB,GAAG,aAAiB,CAAC;AAE1C,QAAA,kBAAkB,GAC7B,iHAAiH,CAAC;AAEpH,+EAA+E;AAC/E,SAAgB,mBAAmB,CAAC,QAAgB,IAAI,CAAC,GAAG,EAAE;IAC5D,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,6BAAqB,CAAC;AACjE,CAAC;AAED,8EAA8E;AAC9E,SAAgB,iBAAiB,CAAC,QAAgB,IAAI,CAAC,GAAG,EAAE;IAC1D,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,0BAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* harness-tool-vocabulary — the ONE list of tool names a self-report may seal
|
|
3
|
+
* verbatim (review 2: a tool NAME must never carry prose).
|
|
4
|
+
*
|
|
5
|
+
* WHY. On the self-report lanes (the loopback witness endpoint and the MCP
|
|
6
|
+
* report tools) the tool name is written by the agent. "Normalize to a token"
|
|
7
|
+
* was not enough: `refactored billing module for Acme Corp` became
|
|
8
|
+
* `refactored_billing_module_for_Acme_Corp` prose with underscores. So a name
|
|
9
|
+
* is sealed verbatim ONLY when it is a real harness tool name — one of the names
|
|
10
|
+
* the transcript extractors recognise from Claude Code, OpenClaw, Codex, Gemini
|
|
11
|
+
* CLI and Grok Build (the harnesses whose records the daemon reads). Any other
|
|
12
|
+
* name is sealed as `h:` + the first 12 hex of sha256(name): the same name
|
|
13
|
+
* always seals the same token (so counts and repeats stay meaningful), and the
|
|
14
|
+
* text never leaves the device.
|
|
15
|
+
*
|
|
16
|
+
* THE REPORTING APP TOO (review 3). A self-report's `source_app` (and the
|
|
17
|
+
* compute block's `framework`, which carries the same value) is agent-written as
|
|
18
|
+
* well: `refactored billing for acme` slugged to `refactored_billing_for_acme`
|
|
19
|
+
* was prose with underscores again. So `source_app` follows the same rule: a
|
|
20
|
+
* name in the app vocabulary below (harnesses, agent platforms, generic runners)
|
|
21
|
+
* is sealed verbatim as its lowercase slug, anything else as `h:` + 12 hex.
|
|
22
|
+
*
|
|
23
|
+
* ONE DEFINITION, CARRIED BYTE-IDENTICAL. This file lives in the SDK
|
|
24
|
+
* (`provian-agent-sdk/src/observer/`), the relay (`provian-backend/src/mcp/core/`,
|
|
25
|
+
* which the relay's self-report reduction and the hosted MCP tools both import)
|
|
26
|
+
* and the stdio MCP package (`provian-mcp/src/core/`). The packages cannot
|
|
27
|
+
* import one another, so `scripts/check-mcp-tool-parity.mjs` byte-compares the
|
|
28
|
+
* three and `harness-tool-vocabulary-parity.test.ts` (backend) pins them.
|
|
29
|
+
*/
|
|
30
|
+
/** Tool names the harness transcript extractors recognise, sealed verbatim. */
|
|
31
|
+
export declare const HARNESS_TOOL_NAMES: readonly string[];
|
|
32
|
+
/**
|
|
33
|
+
* Reporting-app names a self-report may seal verbatim as `source_app` /
|
|
34
|
+
* `compute.framework` — lowercase slugs of the agent harnesses the daemon reads,
|
|
35
|
+
* agent platforms, and generic runners. A label, never a sentence.
|
|
36
|
+
*/
|
|
37
|
+
export declare const HARNESS_APP_NAMES: readonly string[];
|
|
38
|
+
/** The source_app sealed when none is given. */
|
|
39
|
+
export declare const DEFAULT_SOURCE_APP = "local_process";
|
|
40
|
+
/** A name already sealed as a hash token (`h:` + 12 lowercase hex). */
|
|
41
|
+
export declare const HASHED_TOOL_NAME_RE: RegExp;
|
|
42
|
+
/**
|
|
43
|
+
* The name a self-report seals: a harness tool name verbatim, an already-hashed
|
|
44
|
+
* token as-is, anything else `h:` + the first 12 hex of sha256(trimmed name).
|
|
45
|
+
* Null for a non-string or empty name.
|
|
46
|
+
*/
|
|
47
|
+
export declare function sealedToolName(raw: unknown): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* The `source_app` a self-report seals (and its `compute.framework`): the
|
|
50
|
+
* lowercase slug when it is in the app vocabulary, an already-hashed token
|
|
51
|
+
* as-is, anything else `h:` + the first 12 hex of sha256(the full slug).
|
|
52
|
+
* A non-string or empty value is `local_process`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function sealedSourceApp(raw: unknown): string;
|
|
55
|
+
//# sourceMappingURL=harness-tool-vocabulary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-tool-vocabulary.d.ts","sourceRoot":"","sources":["../../src/core/harness-tool-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAkB9C,CAAC;AAIH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAY7C,CAAC;AAIH,gDAAgD;AAChD,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,QAAqB,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAM1D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CASpD"}
|