@inventarch/db 1.2.0 → 3.0.0
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/README.md +6 -2
- package/SPEC.md +49 -7
- package/dist/checks.d.ts +66 -0
- package/dist/checks.d.ts.map +1 -0
- package/dist/checks.js +143 -0
- package/dist/checks.js.map +1 -0
- package/dist/descriptors/codec.js +2 -2
- package/dist/descriptors/codec.js.map +1 -1
- package/dist/descriptors/envelope.js +2 -2
- package/dist/descriptors/envelope.js.map +1 -1
- package/dist/descriptors/index.d.ts +1 -1
- package/dist/descriptors/index.js +1 -1
- package/dist/distribution/codec.d.ts +7 -1
- package/dist/distribution/codec.d.ts.map +1 -1
- package/dist/distribution/codec.js +6 -0
- package/dist/distribution/codec.js.map +1 -1
- package/dist/distribution/contracts.d.ts +6 -1
- package/dist/distribution/contracts.d.ts.map +1 -1
- package/dist/distribution/contracts.js +14 -7
- package/dist/distribution/contracts.js.map +1 -1
- package/dist/distribution/implementations.d.ts +56 -0
- package/dist/distribution/implementations.d.ts.map +1 -0
- package/dist/distribution/implementations.js +148 -0
- package/dist/distribution/implementations.js.map +1 -0
- package/dist/distribution/index.d.ts +4 -1
- package/dist/distribution/index.d.ts.map +1 -1
- package/dist/distribution/index.js +3 -1
- package/dist/distribution/index.js.map +1 -1
- package/dist/distribution/reader.d.ts +1 -1
- package/dist/distribution/reader.d.ts.map +1 -1
- package/dist/distribution/reader.js +34 -8
- package/dist/distribution/reader.js.map +1 -1
- package/dist/distribution/release-control.d.ts +4 -0
- package/dist/distribution/release-control.d.ts.map +1 -0
- package/dist/distribution/release-control.js +46 -0
- package/dist/distribution/release-control.js.map +1 -0
- package/dist/editor/index.d.ts +13 -2
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/index.js +9 -4
- package/dist/editor/index.js.map +1 -1
- package/dist/evidence.d.ts +84 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +313 -0
- package/dist/evidence.js.map +1 -0
- package/dist/handle.d.ts +55 -8
- package/dist/handle.d.ts.map +1 -1
- package/dist/handle.js +85 -15
- package/dist/handle.js.map +1 -1
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/inputs.d.ts +47 -1
- package/dist/inputs.d.ts.map +1 -1
- package/dist/inputs.js +255 -19
- package/dist/inputs.js.map +1 -1
- package/dist/membership.d.ts +6 -0
- package/dist/membership.d.ts.map +1 -1
- package/dist/membership.js +7 -1
- package/dist/membership.js.map +1 -1
- package/dist/preview.d.ts +2 -2
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +9 -7
- package/dist/preview.js.map +1 -1
- package/dist/retention.d.ts +52 -15
- package/dist/retention.d.ts.map +1 -1
- package/dist/retention.js +102 -52
- package/dist/retention.js.map +1 -1
- package/dist/runner-evidence.d.ts +22 -0
- package/dist/runner-evidence.d.ts.map +1 -0
- package/dist/runner-evidence.js +388 -0
- package/dist/runner-evidence.js.map +1 -0
- package/dist/view.d.ts +85 -2
- package/dist/view.d.ts.map +1 -1
- package/dist/view.js +343 -42
- package/dist/view.js.map +1 -1
- package/package.json +8 -4
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { closeSync, fstatSync, lstatSync, mkdirSync, openSync, renameSync, unlinkSync } from 'node:fs';
|
|
3
|
+
import { canonical, digest } from '@inventarch/graph';
|
|
4
|
+
import { DbError } from './errors.js';
|
|
5
|
+
import { RUNNER_EVIDENCE_DIRECTORY, readWorkspaceBytes, safePath } from './inputs.js';
|
|
6
|
+
import { parseStrictJson } from './json.js';
|
|
7
|
+
import { discard, staged, syncDirectory } from './retention.js';
|
|
8
|
+
/** Local journal claims, not execution authorization or an attestation by an external observer. */
|
|
9
|
+
export const RUNNER_EVIDENCE_FORMAT = 'ia.runner-evidence.v1';
|
|
10
|
+
const BYTES = 4 * 1024 * 1024;
|
|
11
|
+
const EVENTS = 4096;
|
|
12
|
+
const HEX = /^[a-f0-9]{64}$/;
|
|
13
|
+
const ID = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/;
|
|
14
|
+
const NATIVE_ID = /^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/;
|
|
15
|
+
const STAMP = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
|
|
16
|
+
const TYPES = new Set([
|
|
17
|
+
'session.create',
|
|
18
|
+
'run.ready',
|
|
19
|
+
'attempt.prepare',
|
|
20
|
+
'attempt.dispatch',
|
|
21
|
+
'attempt.abandon',
|
|
22
|
+
'attempt.observe',
|
|
23
|
+
'action.accept',
|
|
24
|
+
'attempt.retry',
|
|
25
|
+
'model.repair',
|
|
26
|
+
'action.clear',
|
|
27
|
+
'run.wait',
|
|
28
|
+
'outcome.accept',
|
|
29
|
+
'question.reply',
|
|
30
|
+
'proposal.review',
|
|
31
|
+
'decision.record',
|
|
32
|
+
'child.create',
|
|
33
|
+
'child.return',
|
|
34
|
+
'control.submit',
|
|
35
|
+
'control.apply',
|
|
36
|
+
'session.rebind',
|
|
37
|
+
'session.renew',
|
|
38
|
+
'budget.extend',
|
|
39
|
+
'reaction.queue',
|
|
40
|
+
'reaction.settle',
|
|
41
|
+
'attempt.reconcile.start',
|
|
42
|
+
'attempt.reconcile',
|
|
43
|
+
]);
|
|
44
|
+
function fail(message) {
|
|
45
|
+
throw new DbError('IA-DB-SOURCE-UNAVAILABLE', `Runner evidence: ${message}`);
|
|
46
|
+
}
|
|
47
|
+
function row(value) {
|
|
48
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
49
|
+
fail('expected a data object');
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
function exact(value, keys) {
|
|
53
|
+
if (Object.keys(value).length !== keys.length || keys.some((key) => !Object.hasOwn(value, key)))
|
|
54
|
+
fail('unknown or missing receipt field');
|
|
55
|
+
}
|
|
56
|
+
function text(value, max = 1024) {
|
|
57
|
+
if (typeof value !== 'string' || !value || value.length > max || /[\u0000-\u001f]/.test(value))
|
|
58
|
+
fail('expected bounded single-line text');
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
function hash(value) {
|
|
62
|
+
const result = text(value, 64);
|
|
63
|
+
if (!HEX.test(result))
|
|
64
|
+
fail('expected SHA-256');
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
function identifier(value) {
|
|
68
|
+
const result = text(value, 128);
|
|
69
|
+
if (!ID.test(result) || ['__proto__', 'prototype', 'constructor'].includes(result))
|
|
70
|
+
fail('invalid journal identifier');
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
/** Copy bounded plain data without evaluating accessors, toJSON or custom instances. */
|
|
74
|
+
function data(value) {
|
|
75
|
+
let budget = BYTES, count = 0;
|
|
76
|
+
const seen = new Set();
|
|
77
|
+
const visit = (item, depth) => {
|
|
78
|
+
if (depth > 64 || ++count > 200_000 || (budget -= 8) < 0)
|
|
79
|
+
fail('receipt complexity limit');
|
|
80
|
+
if (item === null || typeof item === 'boolean' || (typeof item === 'number' && Number.isFinite(item)))
|
|
81
|
+
return item;
|
|
82
|
+
if (typeof item === 'string') {
|
|
83
|
+
if ((budget -= Buffer.byteLength(item)) < 0 || Buffer.from(item).toString('utf8') !== item)
|
|
84
|
+
fail('receipt byte or encoding limit');
|
|
85
|
+
return item;
|
|
86
|
+
}
|
|
87
|
+
if (!item || typeof item !== 'object' || seen.has(item))
|
|
88
|
+
fail('expected acyclic plain data');
|
|
89
|
+
seen.add(item);
|
|
90
|
+
const descriptors = Object.getOwnPropertyDescriptors(item), keys = Reflect.ownKeys(item);
|
|
91
|
+
if (Array.isArray(item)) {
|
|
92
|
+
if (keys.length !== item.length + 1 ||
|
|
93
|
+
keys.some((key) => typeof key !== 'string' || !Object.hasOwn(descriptors[key], 'value')))
|
|
94
|
+
fail('expected a dense data array');
|
|
95
|
+
return Array.from({ length: item.length }, (_, at) => visit(descriptors[String(at)].value, depth + 1));
|
|
96
|
+
}
|
|
97
|
+
if (![Object.prototype, null].includes(Object.getPrototypeOf(item)))
|
|
98
|
+
fail('expected plain data');
|
|
99
|
+
const result = Object.create(null);
|
|
100
|
+
for (const key of keys) {
|
|
101
|
+
if (typeof key !== 'string' ||
|
|
102
|
+
['__proto__', 'prototype', 'constructor'].includes(key) ||
|
|
103
|
+
!descriptors[key].enumerable ||
|
|
104
|
+
!Object.hasOwn(descriptors[key], 'value'))
|
|
105
|
+
fail('unsafe data field');
|
|
106
|
+
if ((budget -= Buffer.byteLength(key)) < 0)
|
|
107
|
+
fail('receipt byte limit');
|
|
108
|
+
result[key] = visit(descriptors[key].value, depth + 1);
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
};
|
|
112
|
+
return visit(value, 0);
|
|
113
|
+
}
|
|
114
|
+
/** Checks the journal envelope and hashes, never reimplements the session transition reducer. */
|
|
115
|
+
function receipt(value) {
|
|
116
|
+
const object = row(value);
|
|
117
|
+
exact(object, ['format', 'authoredRevision', 'events']);
|
|
118
|
+
if (object['format'] !== RUNNER_EVIDENCE_FORMAT)
|
|
119
|
+
fail('unsupported receipt format');
|
|
120
|
+
hash(object['authoredRevision']);
|
|
121
|
+
const events = object['events'];
|
|
122
|
+
if (!Array.isArray(events) || events.length === 0 || events.length > EVENTS)
|
|
123
|
+
fail('journal event limit');
|
|
124
|
+
let previous = '', sessionId = '', commandId = '', commandEvents = 0;
|
|
125
|
+
const ids = new Set();
|
|
126
|
+
for (let index = 0; index < events.length; index++) {
|
|
127
|
+
const event = row(events[index]), mutation = row(event['mutation']);
|
|
128
|
+
exact(event, ['version', 'id', 'sequence', 'sessionId', 'actor', 'at', 'cause', 'mutation', 'previous', 'hash']);
|
|
129
|
+
const type = text(mutation['type'], 64), id = identifier(event['id']);
|
|
130
|
+
if (!TYPES.has(type) || event['version'] !== (type === 'session.renew' ? 2 : 1))
|
|
131
|
+
fail('unknown event type/version');
|
|
132
|
+
// SessionStore uses the command ID for every event in one atomic command (at most 32).
|
|
133
|
+
if (id !== commandId) {
|
|
134
|
+
if (ids.has(id))
|
|
135
|
+
fail('noncontiguous command id reuse');
|
|
136
|
+
ids.add(id);
|
|
137
|
+
commandId = id;
|
|
138
|
+
commandEvents = 0;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
const preceding = row(events[index - 1]);
|
|
142
|
+
if (event['actor'] !== preceding['actor'] || event['cause'] !== preceding['cause'])
|
|
143
|
+
fail('atomic command attribution changed');
|
|
144
|
+
}
|
|
145
|
+
if (++commandEvents > 32)
|
|
146
|
+
fail('atomic command event limit');
|
|
147
|
+
const currentSession = identifier(event['sessionId']), at = text(event['at'], 24);
|
|
148
|
+
text(event['actor']);
|
|
149
|
+
if (!STAMP.test(at) ||
|
|
150
|
+
!Number.isFinite(Date.parse(at)) ||
|
|
151
|
+
new Date(at).toISOString() !== at ||
|
|
152
|
+
Date.parse(at) > Date.now() + 300_000)
|
|
153
|
+
fail('invalid journal time');
|
|
154
|
+
if (event['cause'] !== null)
|
|
155
|
+
identifier(event['cause']);
|
|
156
|
+
const { hash: eventHash, ...body } = event;
|
|
157
|
+
if (event['sequence'] !== index + 1 || event['previous'] !== previous || hash(eventHash) !== digest(body))
|
|
158
|
+
fail('journal chain mismatch');
|
|
159
|
+
if (index === 0) {
|
|
160
|
+
sessionId = currentSession;
|
|
161
|
+
if (type !== 'session.create' || mutation['sessionId'] !== sessionId || mutation['principal'] !== event['actor'])
|
|
162
|
+
fail('missing journal creation');
|
|
163
|
+
identifier(mutation['rootId']);
|
|
164
|
+
if (!NATIVE_ID.test(text(mutation['profile'])))
|
|
165
|
+
fail('expected a native profile identity');
|
|
166
|
+
}
|
|
167
|
+
else if (currentSession !== sessionId || type === 'session.create')
|
|
168
|
+
fail('journal session mismatch');
|
|
169
|
+
if (type === 'session.create' || type === 'session.rebind') {
|
|
170
|
+
const manifest = row(mutation['manifest']);
|
|
171
|
+
hash(manifest['sourceDigest']);
|
|
172
|
+
if (hash(mutation['manifestDigest']) !== digest(manifest))
|
|
173
|
+
fail('journal manifest mismatch');
|
|
174
|
+
}
|
|
175
|
+
previous = eventHash;
|
|
176
|
+
}
|
|
177
|
+
return object;
|
|
178
|
+
}
|
|
179
|
+
function decode(bytes) {
|
|
180
|
+
const value = parseStrictJson(new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes), { bytes: BYTES, depth: 64, nodes: 200_000 }, (_fault, message) => fail(message));
|
|
181
|
+
return receipt(value);
|
|
182
|
+
}
|
|
183
|
+
const sessionKey = (id) => createHash('sha256').update(id).digest('hex');
|
|
184
|
+
function receiptPath(value) {
|
|
185
|
+
return `${RUNNER_EVIDENCE_DIRECTORY}/${value.authoredRevision}-${sessionKey(value.events[0].sessionId)}.json`;
|
|
186
|
+
}
|
|
187
|
+
/** The exact whole-workspace capture used by apps/runner, independently bound to the current database inputs. */
|
|
188
|
+
function sourceDigest(input) {
|
|
189
|
+
return digest({
|
|
190
|
+
version: 1,
|
|
191
|
+
id: 'runner',
|
|
192
|
+
sources: input.sources,
|
|
193
|
+
folders: input.folders,
|
|
194
|
+
floorOrigin: input.floorOrigin,
|
|
195
|
+
...(input.activation ? { activation: input.activation } : {}),
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function directories(root) {
|
|
199
|
+
for (const path of ['.ia', '.ia/work', RUNNER_EVIDENCE_DIRECTORY]) {
|
|
200
|
+
const stat = lstatSync(safePath(root, path), { throwIfNoEntry: false });
|
|
201
|
+
if (stat && !stat.isDirectory())
|
|
202
|
+
throw new DbError('IA-DB-PATH-UNSAFE', `${path} is not a directory`, path);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The trusted runner calls this after reading its verified journal. It accepts no native source text. A receipt is
|
|
207
|
+
* an atomic local copy of that journal, not independent proof it executed. It never prunes other sessions/revisions.
|
|
208
|
+
* One runner owns a session; an older or divergent receipt cannot replace a newer receipt through this API.
|
|
209
|
+
*/
|
|
210
|
+
export function writeRunnerEvidence(root, input) {
|
|
211
|
+
const clean = row(data(input));
|
|
212
|
+
exact(clean, ['authoredRevision', 'events']);
|
|
213
|
+
const value = receipt({ format: RUNNER_EVIDENCE_FORMAT, ...clean }), path = receiptPath(value), bytes = Buffer.from(canonical(value) + '\n'), last = value.events.at(-1);
|
|
214
|
+
if (bytes.length > BYTES)
|
|
215
|
+
fail('receipt byte limit');
|
|
216
|
+
directories(root);
|
|
217
|
+
mkdirSync(safePath(root, RUNNER_EVIDENCE_DIRECTORY), { recursive: true });
|
|
218
|
+
directories(root);
|
|
219
|
+
// Serialize the compare-and-replace across processes. A held or abandoned lock refuses; it is never stolen.
|
|
220
|
+
const lock = safePath(root, `${path}.lock`), fd = openSync(lock, 'wx', 0o600), held = fstatSync(fd, { bigint: true });
|
|
221
|
+
let temporary;
|
|
222
|
+
try {
|
|
223
|
+
const stat = lstatSync(safePath(root, path), { throwIfNoEntry: false });
|
|
224
|
+
if (stat) {
|
|
225
|
+
const prior = decode(readWorkspaceBytes(root, path, BYTES));
|
|
226
|
+
if (receiptPath(prior) !== path ||
|
|
227
|
+
prior.events.length > value.events.length ||
|
|
228
|
+
prior.events.at(-1).hash !== value.events[prior.events.length - 1].hash)
|
|
229
|
+
fail('stale or divergent journal receipt');
|
|
230
|
+
if (prior.events.length === value.events.length)
|
|
231
|
+
return Object.freeze({ path, written: false, sequence: last.sequence, hash: last.hash });
|
|
232
|
+
}
|
|
233
|
+
temporary = staged(root, path, bytes);
|
|
234
|
+
renameSync(safePath(root, temporary), safePath(root, path));
|
|
235
|
+
temporary = undefined;
|
|
236
|
+
syncDirectory(safePath(root, RUNNER_EVIDENCE_DIRECTORY));
|
|
237
|
+
}
|
|
238
|
+
finally {
|
|
239
|
+
discard(root, temporary);
|
|
240
|
+
closeSync(fd);
|
|
241
|
+
const named = lstatSync(lock, { bigint: true, throwIfNoEntry: false });
|
|
242
|
+
if (named?.isFile() && named.nlink === 1n && named.dev === held.dev && named.ino === held.ino)
|
|
243
|
+
unlinkSync(lock);
|
|
244
|
+
}
|
|
245
|
+
return Object.freeze({ path, written: true, sequence: last.sequence, hash: last.hash });
|
|
246
|
+
}
|
|
247
|
+
const quote = (value) => `"${value.replace(/["\\\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, ' ')}"`;
|
|
248
|
+
/** Generated fixed-field native projection. Event payloads can never introduce declarations or relationships. */
|
|
249
|
+
function project(value, path, graph) {
|
|
250
|
+
const first = value.events[0], creation = first.mutation, profile = graph.nodes.get(String(creation['profile'])), agent = graph.nodes.get(String(creation['agent'])), records = [...graph.nodes.values()];
|
|
251
|
+
if (profile?.discriminator !== 'agent-profile' ||
|
|
252
|
+
agent?.discriminator !== 'agent' ||
|
|
253
|
+
!graph.referencesFrom
|
|
254
|
+
.get(profile.identity)
|
|
255
|
+
?.some((ref) => ref.field === 'composition.agent' && ref.to === agent.identity) ||
|
|
256
|
+
records.filter((node) => node.discriminator === 'agent' && node.name === agent.name).length !== 1 ||
|
|
257
|
+
records.filter((node) => node.discriminator === 'agent-profile' && node.name === profile.name).length !== 1 ||
|
|
258
|
+
!graph.registry.registrations.has('run') ||
|
|
259
|
+
!graph.registry.registrations.has('observation'))
|
|
260
|
+
return undefined;
|
|
261
|
+
const key = sessionKey(first.sessionId), run = `runner-${key}`, rootId = creation['rootId'], names = new Set(records.filter((node) => ['run', 'observation'].includes(node.discriminator)).map((node) => node.name));
|
|
262
|
+
if (names.has(run))
|
|
263
|
+
return undefined;
|
|
264
|
+
const blocks = [
|
|
265
|
+
[
|
|
266
|
+
`@run ${run}`,
|
|
267
|
+
' meaning',
|
|
268
|
+
` says ${quote(`Local journal ${first.sessionId} is recorded under profile ${profile.identity}; this projection does not report live engine state or phase.`)}`,
|
|
269
|
+
' answers "Which local runner journal does this record describe?"',
|
|
270
|
+
' execution',
|
|
271
|
+
' status recorded',
|
|
272
|
+
' phase recorded',
|
|
273
|
+
` owner @agent ${agent.name}`,
|
|
274
|
+
].join('\n'),
|
|
275
|
+
];
|
|
276
|
+
const attempts = new Map();
|
|
277
|
+
for (const event of value.events) {
|
|
278
|
+
const mutation = event.mutation, type = mutation['type'];
|
|
279
|
+
if (type === 'attempt.prepare') {
|
|
280
|
+
const attempt = row(mutation['attempt']);
|
|
281
|
+
attempts.set(identifier(attempt['id']), attempt);
|
|
282
|
+
}
|
|
283
|
+
let verdict = 'inconclusive', reason;
|
|
284
|
+
if (mutation['runId'] === rootId && type === 'outcome.accept') {
|
|
285
|
+
const outcome = row(mutation['outcome']);
|
|
286
|
+
verdict =
|
|
287
|
+
['refusal', 'failure'].includes(String(outcome['kind'])) || mutation['terminal'] === 'failed'
|
|
288
|
+
? 'refusal'
|
|
289
|
+
: mutation['terminal'] === 'completed' && outcome['kind'] !== 'blocked'
|
|
290
|
+
? 'success'
|
|
291
|
+
: 'inconclusive';
|
|
292
|
+
reason = `Journal event outcome.accept records ${text(outcome['kind'], 64)} with terminal ${String(mutation['terminal'])}.`;
|
|
293
|
+
}
|
|
294
|
+
else if (mutation['runId'] === rootId && type === 'run.wait') {
|
|
295
|
+
const wait = row(mutation['wait']), why = text(wait['reason'], 128);
|
|
296
|
+
verdict = ['limit', 'runner-limit-refusal', 'runner-authority-refusal'].includes(why)
|
|
297
|
+
? 'refusal'
|
|
298
|
+
: 'inconclusive';
|
|
299
|
+
reason = `Journal event run.wait records ${why}; a wait is not a terminal outcome.`;
|
|
300
|
+
}
|
|
301
|
+
else if (type === 'attempt.observe') {
|
|
302
|
+
const attempt = attempts.get(String(mutation['attemptId']));
|
|
303
|
+
if (attempt?.['kind'] === 'operation' && attempt['runId'] === rootId) {
|
|
304
|
+
const effect = text(mutation['effect'], 16);
|
|
305
|
+
if (!['none', 'applied', 'partial', 'unknown'].includes(effect))
|
|
306
|
+
fail('unknown journal effect');
|
|
307
|
+
verdict =
|
|
308
|
+
effect === 'partial' || effect === 'unknown'
|
|
309
|
+
? 'inconclusive'
|
|
310
|
+
: mutation['error'] === null
|
|
311
|
+
? 'success'
|
|
312
|
+
: 'refusal';
|
|
313
|
+
reason = `Journal event attempt.observe records operation ${text(attempt['target'])}, effect ${effect}, ${mutation['error'] === null ? 'no reported error' : 'a reported error'}.`;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (reason === undefined)
|
|
317
|
+
continue;
|
|
318
|
+
const name = `${run}-${event.sequence}`;
|
|
319
|
+
if (names.has(name))
|
|
320
|
+
return undefined;
|
|
321
|
+
blocks.push([
|
|
322
|
+
`@observation ${name}`,
|
|
323
|
+
' meaning',
|
|
324
|
+
` says ${quote(reason)}`,
|
|
325
|
+
' answers "What outcome does this local journal event report?"',
|
|
326
|
+
' evidence',
|
|
327
|
+
' origin runner-journal',
|
|
328
|
+
` actor ${quote(event.actor)}`,
|
|
329
|
+
` observed-at ${quote(event.at)}`,
|
|
330
|
+
` captured-at ${quote(event.at)}`,
|
|
331
|
+
' workspace "."',
|
|
332
|
+
` locator ${quote(`${first.sessionId}#${event.sequence}`)}`,
|
|
333
|
+
` revision ${quote(value.authoredRevision)}`,
|
|
334
|
+
` bundle ${quote(path)}`,
|
|
335
|
+
` digest ${quote(event.hash)}`,
|
|
336
|
+
' availability available',
|
|
337
|
+
` subject @run ${run}`,
|
|
338
|
+
` snapshot-revision ${quote(value.authoredRevision)}`,
|
|
339
|
+
' evaluator "ia runner journal projection v1"',
|
|
340
|
+
' move Execution',
|
|
341
|
+
` verdict ${verdict}`,
|
|
342
|
+
' interpretation',
|
|
343
|
+
' applies "One root-run journal event at the bound authored revision."',
|
|
344
|
+
' limits "Local journal claims only. Hashes check integrity, not external truth, identity, authorization or successful real-world effects. Session transition validation belongs to the runner."',
|
|
345
|
+
` reason ${quote(reason)}`,
|
|
346
|
+
' basis journal',
|
|
347
|
+
' retention',
|
|
348
|
+
' status retained',
|
|
349
|
+
].join('\n'));
|
|
350
|
+
}
|
|
351
|
+
const result = `#! ia 1.0\n\n${blocks.join('\n\n')}\n`;
|
|
352
|
+
return Buffer.byteLength(result) <= BYTES ? result : undefined;
|
|
353
|
+
}
|
|
354
|
+
/** Optional evidence fails closed without making authored data unavailable. No filesystem or journal code executes. */
|
|
355
|
+
export function runnerEvidenceSources(input, authoredRevision, graph) {
|
|
356
|
+
const candidates = (input.runnerEvidence ?? []).filter((item) => item.path.startsWith(`${RUNNER_EVIDENCE_DIRECTORY}/${authoredRevision}-`));
|
|
357
|
+
if (candidates.length > 128 || candidates.reduce((sum, item) => sum + item.bytes, 0) > 16 * 1024 * 1024)
|
|
358
|
+
return [];
|
|
359
|
+
const expected = sourceDigest(input), sources = [];
|
|
360
|
+
let bytes = 0;
|
|
361
|
+
for (const candidate of candidates) {
|
|
362
|
+
try {
|
|
363
|
+
const data = readWorkspaceBytes(input.root, candidate.path, Math.min(BYTES, 16 * 1024 * 1024 - bytes));
|
|
364
|
+
bytes += data.length;
|
|
365
|
+
const value = decode(data);
|
|
366
|
+
if (value.authoredRevision !== authoredRevision ||
|
|
367
|
+
receiptPath(value) !== candidate.path ||
|
|
368
|
+
value.events.some((event) => ['session.create', 'session.rebind'].includes(String(event.mutation['type'])) &&
|
|
369
|
+
row(event.mutation['manifest'])['sourceDigest'] !== expected))
|
|
370
|
+
continue;
|
|
371
|
+
const text = project(value, candidate.path, graph);
|
|
372
|
+
if (text !== undefined)
|
|
373
|
+
sources.push(Object.freeze({
|
|
374
|
+
path: candidate.path,
|
|
375
|
+
text,
|
|
376
|
+
location: Object.freeze({
|
|
377
|
+
placement: Object.freeze({ kind: 'runtime', band: 0, reach: '' }),
|
|
378
|
+
provenance: 'runtime',
|
|
379
|
+
}),
|
|
380
|
+
}));
|
|
381
|
+
}
|
|
382
|
+
catch {
|
|
383
|
+
/* A malformed, stale, changed or unsafe optional receipt is not evidence. */
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return Object.freeze(sources);
|
|
387
|
+
}
|
|
388
|
+
//# sourceMappingURL=runner-evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-evidence.js","sourceRoot":"","sources":["../src/runner-evidence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEhE,mGAAmG;AACnG,MAAM,CAAC,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAC9D,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAC9B,MAAM,MAAM,GAAG,IAAI,CAAC;AACpB,MAAM,GAAG,GAAG,gBAAgB,CAAC;AAC7B,MAAM,EAAE,GAAG,oCAAoC,CAAC;AAChD,MAAM,SAAS,GAAG,sEAAsE,CAAC;AACzF,MAAM,KAAK,GAAG,+CAA+C,CAAC;AAC9D,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC;IACpB,gBAAgB;IAChB,WAAW;IACX,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,eAAe;IACf,eAAe;IACf,cAAc;IACd,cAAc;IACd,UAAU;IACV,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IA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CAAC,cAAc,CAAC,KAAK,QAAQ,CAC/D;gBAED,SAAS;YACX,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACnD,IAAI,IAAI,KAAK,SAAS;gBACpB,OAAO,CAAC,IAAI,CACV,MAAM,CAAC,MAAM,CAAC;oBACZ,IAAI,EAAE,SAAS,CAAC,IAAI;oBACpB,IAAI;oBACJ,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;wBACtB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;wBACjE,UAAU,EAAE,SAAS;qBACtB,CAAC;iBACH,CAAC,CACH,CAAC;QACN,CAAC;QAAC,MAAM,CAAC;YACP,6EAA6E;QAC/E,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC"}
|
package/dist/view.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompiledRecord, Phase } from '@inventarch/language';
|
|
1
|
+
import type { Band, CompiledRecord, Phase } from '@inventarch/language';
|
|
2
2
|
import type { Graph } from '@inventarch/graph';
|
|
3
3
|
import type { Report } from '@inventarch/compliance';
|
|
4
4
|
import type { InputSnapshot } from './inputs.js';
|
|
@@ -9,11 +9,76 @@ export interface RefusedRecord {
|
|
|
9
9
|
readonly line: number;
|
|
10
10
|
readonly reason: string;
|
|
11
11
|
}
|
|
12
|
+
/** The admission finding that refused an unadmitted occurrence: one diagnostic db already holds for it. */
|
|
13
|
+
export interface UnadmittedFinding {
|
|
14
|
+
readonly code: string;
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly line: number;
|
|
17
|
+
readonly message: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One record occurrence of a view's sources that the view does not admit (lane D, D1), with the band of the placement
|
|
21
|
+
* its source was read at, which is where capture membership and every band test read a record's band from, and its own
|
|
22
|
+
* admission finding:
|
|
23
|
+
* - an occurrence `refused` names (a compliance exclusion, a schema failure, a refused system join or a refused
|
|
24
|
+
* enclosing record), with the finding that excluded it: the assessment's or system check's own, the enclosing
|
|
25
|
+
* record's, or for a refused system join the finding that blocked its system;
|
|
26
|
+
* - an occurrence of an identity that another occurrence ties at the same band, with its IA-GRAPH-IDENTITY-TIE;
|
|
27
|
+
* - a record a file declares when the file is refused whole, by a language error or by a requirement id another
|
|
28
|
+
* occurrence declares too, before any graph is built, with the error inside its lines, else the file's first error,
|
|
29
|
+
* which refused the file. Each header the view's own parse of the file reads is one, with the identity the compile of
|
|
30
|
+
* the file gives the record or, where the compile refused it, the identity spec 3.1 gives its header under its word's
|
|
31
|
+
* registration. The file's captured text, split at every line terminator (CRLF, CR or LF), adds three readings the
|
|
32
|
+
* parse cannot give (review findings D-R3, D2-R2 and D2-N2): a line that opens with `@<word>` after any whitespace or
|
|
33
|
+
* Unicode format characters (a no-break space, a form feed, a zero-width space, a byte-order mark) and is no header
|
|
34
|
+
* the parse read is one, wherever it stands, inside a parsed record too, with the name token after it and no
|
|
35
|
+
* identity; on a line no parsed record spans, each `@<word>` token anywhere on it is one, with no name, unless the
|
|
36
|
+
* language scanner reads the whole line as a comment (`#` after ASCII spaces or tabs, in a file with no bare CR), as
|
|
37
|
+
* it reads the attribution `ia author` writes, so a file whose parse reads no record (no or another pragma) lists
|
|
38
|
+
* every word it mentions outside such comments; and a line the first reading names no header on is one with no word,
|
|
39
|
+
* a record db cannot identify, when it holds one of the file's errors and no
|
|
40
|
+
* parsed record spans it, when an at sign opens it wherever it stands, or, in a file refused at its pragma, when it
|
|
41
|
+
* stands at column 0 and is neither blank nor a comment (`refusedWhole`; review D2-R2 and its recheck F1, F2). The
|
|
42
|
+
* readings err towards listing: a non-header line so spelled in a file already refused is listed under its word, an
|
|
43
|
+
* error or at-sign line that declares nothing with no word. An error inside a parsed record's lines, on a line no at
|
|
44
|
+
* sign opens, is that record's alone.
|
|
45
|
+
*/
|
|
46
|
+
export interface UnadmittedRecord {
|
|
47
|
+
/**
|
|
48
|
+
* The canonical identity, when the view compiled the record or spec 3.1 names its parsed header; absent for a header
|
|
49
|
+
* only the source text shows, or whose word no admitted system registers.
|
|
50
|
+
*/
|
|
51
|
+
readonly identity?: string;
|
|
52
|
+
/**
|
|
53
|
+
* The word the header names, lowercased; absent for an error line of a file refused whole that no record db can
|
|
54
|
+
* identify accounts for (review D2-R2), which may declare a record of any word.
|
|
55
|
+
*/
|
|
56
|
+
readonly word?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The record's name as its header spells it, lowercased (lane D, D9: what a typed reference to it is matched by); absent
|
|
59
|
+
* for a header that spells none and for a token read past the start of a line.
|
|
60
|
+
*/
|
|
61
|
+
readonly name?: string;
|
|
62
|
+
readonly band: Band;
|
|
63
|
+
readonly path: string;
|
|
64
|
+
/** The header line. */
|
|
65
|
+
readonly line: number;
|
|
66
|
+
readonly endLine: number;
|
|
67
|
+
/** The admission finding that refused it (review finding D-N5). */
|
|
68
|
+
readonly finding: UnadmittedFinding;
|
|
69
|
+
}
|
|
12
70
|
/** Internal view; public reads project allowed nodes, never this candidate registry. */
|
|
13
71
|
export interface View {
|
|
14
72
|
readonly graph: Graph;
|
|
73
|
+
/**
|
|
74
|
+
* The authored revision of this view (graph `authoredRevisionOf`): `graph.revision` without the sources at runtime
|
|
75
|
+
* placement, the derived revision-only input (D03) kept, so it equals `graph.revision` while no source is placed so.
|
|
76
|
+
*/
|
|
77
|
+
readonly authoredRevision: string;
|
|
15
78
|
readonly report: Report;
|
|
16
79
|
readonly refused: readonly RefusedRecord[];
|
|
80
|
+
/** Every record occurrence of the view's sources it does not admit, `refused` among them, by path then line. */
|
|
81
|
+
readonly unadmitted: readonly UnadmittedRecord[];
|
|
17
82
|
readonly admittedSystems: readonly string[];
|
|
18
83
|
readonly blockedSystems: readonly string[];
|
|
19
84
|
readonly boundary: readonly string[];
|
|
@@ -25,5 +90,23 @@ export interface View {
|
|
|
25
90
|
readonly repository?: string;
|
|
26
91
|
}
|
|
27
92
|
export declare const occurrenceKey: (record: CompiledRecord) => string;
|
|
28
|
-
|
|
93
|
+
/** How a view admits: every existing reader takes the defaults. */
|
|
94
|
+
export interface ViewOptions {
|
|
95
|
+
/**
|
|
96
|
+
* D13 (plan amendments C15 and C21): `strict`, the default, admits a `@check` only when its runner is a built-in id
|
|
97
|
+
* (compliance validateCheck), so an unknown runner is IA-COMP-CHECK-UNKNOWN and the record is not admitted, as every
|
|
98
|
+
* released reader has it; `structural` admits any check that names one evaluator (validateCheckStructure), for the
|
|
99
|
+
* validate path that binds checks against a host's catalog.
|
|
100
|
+
*/
|
|
101
|
+
readonly checks?: 'strict' | 'structural';
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The views of `input`, admitted as `options` says. With evidence listed (D14), the authored view is built first; the
|
|
105
|
+
* one file named after its authored revision, and no other, is then read (review finding B3-N10) and admitted only when
|
|
106
|
+
* it is exactly the file the writer makes for that view's checks (`writerEvidence`, B3-R4, B4-RC1) and adding it changes
|
|
107
|
+
* nothing the authored records admit: their findings, verdicts, refusals and records stay as they were.
|
|
108
|
+
* Otherwise the authored view stands, as for a file that is not evidence. Evidence moves `revision`, never
|
|
109
|
+
* `authoredRevision`, and is never what a validation binds or reports admission from.
|
|
110
|
+
*/
|
|
111
|
+
export declare function viewBuilder(input: InputSnapshot, options?: ViewOptions): (location?: string, phase?: Phase) => View;
|
|
29
112
|
//# sourceMappingURL=view.d.ts.map
|
package/dist/view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAA8B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