@skill-harness/adapters 0.17.0 → 0.18.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/dist/index.d.ts +0 -30
- package/dist/index.js +0 -30
- package/dist/pi.js +21 -133
- package/package.json +2 -3
- package/dist/archive-access.d.ts +0 -58
- package/dist/archive-access.js +0 -61
- package/dist/archive-checkpoint.d.ts +0 -47
- package/dist/archive-checkpoint.js +0 -116
- package/dist/archive-facts.d.ts +0 -19
- package/dist/archive-facts.js +0 -20
- package/dist/archive-observer.d.ts +0 -21
- package/dist/archive-observer.js +0 -79
- package/dist/archive-policy.d.ts +0 -107
- package/dist/archive-policy.js +0 -135
- package/dist/archive-read-capability.d.ts +0 -49
- package/dist/archive-read-capability.js +0 -45
- package/dist/archive-retention-policy.d.ts +0 -52
- package/dist/archive-retention-policy.js +0 -49
- package/dist/archived-work.d.ts +0 -45
- package/dist/archived-work.js +0 -78
- package/dist/blind-intervention.d.ts +0 -35
- package/dist/blind-intervention.js +0 -218
- package/dist/codex-diagnostic-model.d.ts +0 -14
- package/dist/codex-diagnostic-model.js +0 -39
- package/dist/codex-host-observer.d.ts +0 -111
- package/dist/codex-host-observer.js +0 -309
- package/dist/codex-https.d.ts +0 -7
- package/dist/codex-https.js +0 -221
- package/dist/codex-model-profile.d.ts +0 -38
- package/dist/codex-model-profile.js +0 -54
- package/dist/codex-producer-ipc.d.ts +0 -55
- package/dist/codex-producer-ipc.js +0 -67
- package/dist/codex-sdk-transport.d.ts +0 -50
- package/dist/codex-sdk-transport.js +0 -294
- package/dist/codex-subscription.d.ts +0 -114
- package/dist/codex-subscription.js +0 -268
- package/dist/evidence-archive.d.ts +0 -65
- package/dist/evidence-archive.js +0 -225
- package/dist/execution-projection-schema.d.ts +0 -10
- package/dist/execution-projection-schema.js +0 -30
- package/dist/execution-retention-archive.d.ts +0 -69
- package/dist/execution-retention-archive.js +0 -154
- package/dist/generated/retention-v2-contract.d.ts +0 -72
- package/dist/generated/retention-v2-contract.js +0 -105
- package/dist/generated/retention-v2-json.d.ts +0 -24
- package/dist/generated/retention-v2-json.js +0 -268
- package/dist/generated/retention-v2-native-json.d.ts +0 -2
- package/dist/generated/retention-v2-native-json.js +0 -33
- package/dist/generated/retention-v2-native.d.ts +0 -58
- package/dist/generated/retention-v2-native.js +0 -155
- package/dist/generated/retention-v2-pin.d.ts +0 -2
- package/dist/generated/retention-v2-pin.js +0 -4
- package/dist/generated/retention-v2-types.d.ts +0 -49
- package/dist/generated/retention-v2-types.js +0 -2
- package/dist/generated/retention-v2-work-types.d.ts +0 -260
- package/dist/generated/retention-v2-work-types.js +0 -13
- package/dist/generated/work-v4/execution-id.d.ts +0 -5
- package/dist/generated/work-v4/execution-id.js +0 -14
- package/dist/generated/work-v4/json.d.ts +0 -24
- package/dist/generated/work-v4/json.js +0 -268
- package/dist/generated/work-v4/occurrences.d.ts +0 -226
- package/dist/generated/work-v4/occurrences.js +0 -116
- package/dist/generated/work-v4/pin.d.ts +0 -1
- package/dist/generated/work-v4/pin.js +0 -3
- package/dist/generated/work-v4/projection.d.ts +0 -294
- package/dist/generated/work-v4/projection.js +0 -238
- package/dist/generated/work-v4/reader.d.ts +0 -24
- package/dist/generated/work-v4/reader.js +0 -109
- package/dist/generated/work-v4/snapshot.d.ts +0 -28
- package/dist/generated/work-v4/snapshot.js +0 -268
- package/dist/generated/work-v4/types.d.ts +0 -260
- package/dist/generated/work-v4/types.js +0 -13
- package/dist/generated/work-v4/validation.d.ts +0 -13
- package/dist/generated/work-v4/validation.js +0 -227
- package/dist/installed-review-session.d.ts +0 -28
- package/dist/installed-review-session.js +0 -166
- package/dist/intervention-run.d.ts +0 -403
- package/dist/intervention-run.js +0 -169
- package/dist/learning-case.d.ts +0 -12
- package/dist/learning-case.js +0 -15
- package/dist/learning-journal.d.ts +0 -18
- package/dist/learning-journal.js +0 -256
- package/dist/learning-lifecycle.d.ts +0 -28
- package/dist/learning-lifecycle.js +0 -66
- package/dist/learning-trust-setup.d.ts +0 -64
- package/dist/learning-trust-setup.js +0 -55
- package/dist/learning-workspace.d.ts +0 -1084
- package/dist/learning-workspace.js +0 -705
- package/dist/principal-payload-port.d.ts +0 -25
- package/dist/principal-payload-port.js +0 -40
- package/dist/producer-product.d.ts +0 -70
- package/dist/producer-product.js +0 -186
- package/dist/producer-review.d.ts +0 -53
- package/dist/producer-review.js +0 -207
- package/dist/prompt-capture-extension.d.ts +0 -10
- package/dist/prompt-capture-extension.js +0 -26
- package/dist/prompt-provenance.d.ts +0 -22
- package/dist/prompt-provenance.js +0 -146
- package/dist/reviewed-archive-export.d.ts +0 -42
- package/dist/reviewed-archive-export.js +0 -78
- package/dist/session-observation.d.ts +0 -50
- package/dist/session-observation.js +0 -186
- package/dist/session-retention.d.ts +0 -48
- package/dist/session-retention.js +0 -121
- package/dist/trust-lifecycle.d.ts +0 -152
- package/dist/trust-lifecycle.js +0 -209
- package/dist/weekly-investigation.d.ts +0 -237
- package/dist/weekly-investigation.js +0 -330
- package/dist/work-candidates.d.ts +0 -29
- package/dist/work-candidates.js +0 -78
- package/dist/work-case-archive.d.ts +0 -25
- package/dist/work-case-archive.js +0 -63
- package/dist/work-case-review.d.ts +0 -45
- package/dist/work-case-review.js +0 -220
- package/dist/work-signal-cases.d.ts +0 -15
- package/dist/work-signal-cases.js +0 -54
- package/dist/work-signal-observation.d.ts +0 -23
- package/dist/work-signal-observation.js +0 -89
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
// GENERATED from pi-daddy 7c78769c47177b1972b09e1f5c5474ad44cd2cac by scripts/vendor-work-v4-reader.mjs. Do not hand-edit.
|
|
2
|
-
import { indexWorkLedgerText, workEventConflictSources, workRevisionConflictSources } from "./projection.js";
|
|
3
|
-
import { canonicalWorkJson, copyWorkJson, freezeWork } from "./json.js";
|
|
4
|
-
import { validateWorkSelection } from "./validation.js";
|
|
5
|
-
import { WorkInputError, } from "./types.js";
|
|
6
|
-
const key = canonicalWorkJson;
|
|
7
|
-
const entity = (ref) => `${ref.kind}:${ref.id}`;
|
|
8
|
-
const reference = (ref) => ({ type: "revision", ref });
|
|
9
|
-
function unique(values) {
|
|
10
|
-
const rows = new Map(values.map(value => [key(value), value]));
|
|
11
|
-
return [...rows].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([, value]) => value);
|
|
12
|
-
}
|
|
13
|
-
function diagnosticKey(row) {
|
|
14
|
-
// Internally built output collections may exceed the wire array bound (e.g. 300 conflicting
|
|
15
|
-
// deliveries). Only their validated scalar/reference constituents use the wire canonicalizer.
|
|
16
|
-
const affected = key(row.affectedObligations);
|
|
17
|
-
return "code" in row
|
|
18
|
-
? `{"affectedObligations":${affected},"code":${JSON.stringify(row.code)},"reference":${key(row.reference)}}`
|
|
19
|
-
: `{"affectedObligations":${affected},"digests":${JSON.stringify(row.digests)},"id":${JSON.stringify(row.id)},"kind":${JSON.stringify(row.kind)}}`;
|
|
20
|
-
}
|
|
21
|
-
function sortedDiagnostics(rows) {
|
|
22
|
-
return rows.map(value => ({ value, key: diagnosticKey(value) }))
|
|
23
|
-
.sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0).map(row => row.value);
|
|
24
|
-
}
|
|
25
|
-
/** @internal Real builder/text/index/selector path. No unchecked parsed-object projection entry. */
|
|
26
|
-
export function resolveWorkSnapshotText(text, requested = null) {
|
|
27
|
-
const index = indexWorkLedgerText(text);
|
|
28
|
-
const errors = [...index.ingestion.errors];
|
|
29
|
-
let selection = null;
|
|
30
|
-
try {
|
|
31
|
-
const copied = copyWorkJson(requested);
|
|
32
|
-
validateWorkSelection(copied);
|
|
33
|
-
selection = copied;
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
if (!(error instanceof WorkInputError))
|
|
37
|
-
throw error;
|
|
38
|
-
errors.push({ line: null, code: "WORK_CONTEXT_INVALID" });
|
|
39
|
-
}
|
|
40
|
-
const problems = new Map();
|
|
41
|
-
const conflicts = new Map();
|
|
42
|
-
for (const ref of index.conflictingEvents) {
|
|
43
|
-
const row = conflicts.get(ref.eventId) ?? { digests: [], affected: [] };
|
|
44
|
-
row.digests.push(ref.digest);
|
|
45
|
-
conflicts.set(ref.eventId, row);
|
|
46
|
-
}
|
|
47
|
-
function problem(code, ref, affected = []) {
|
|
48
|
-
const id = `${code}:${key(ref)}`;
|
|
49
|
-
const old = problems.get(id);
|
|
50
|
-
problems.set(id, { code, reference: ref, affectedObligations: unique([...(old?.affectedObligations ?? []), ...affected]) });
|
|
51
|
-
}
|
|
52
|
-
function conflict(id, affected) {
|
|
53
|
-
const row = conflicts.get(id);
|
|
54
|
-
if (!row)
|
|
55
|
-
return;
|
|
56
|
-
row.affected = unique([...row.affected, ...affected]);
|
|
57
|
-
for (const digest of row.digests)
|
|
58
|
-
problem("EVENT_CONFLICT", { type: "event", ref: { eventId: id, digest } }, affected);
|
|
59
|
-
}
|
|
60
|
-
function reports() {
|
|
61
|
-
return {
|
|
62
|
-
problems: sortedDiagnostics([...problems.values()]),
|
|
63
|
-
conflicts: sortedDiagnostics([...conflicts].map(([id, row]) => ({
|
|
64
|
-
kind: "event", id, digests: [...row.digests].sort(), affectedObligations: unique(row.affected),
|
|
65
|
-
}))), errors,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function empty(scopeState) {
|
|
69
|
-
return freezeWork({ scopeState, selectedSnapshot: selection?.snapshot ?? null,
|
|
70
|
-
snapshot: null, scope: null, revisions: [], obligations: [], ...reports() });
|
|
71
|
-
}
|
|
72
|
-
if (errors.length) {
|
|
73
|
-
problem("INPUT_INCOMPLETE", null);
|
|
74
|
-
return empty("unresolved");
|
|
75
|
-
}
|
|
76
|
-
if (!selection) {
|
|
77
|
-
problem("NO_SELECTION", null);
|
|
78
|
-
return empty("unselected");
|
|
79
|
-
}
|
|
80
|
-
// Exact event AND nested snapshot identity: never elect a head from candidate order or time.
|
|
81
|
-
const nominated = index.candidates.find(event => event.eventId === selection.event.eventId && event.digest === selection.event.digest);
|
|
82
|
-
const exactSnapshot = nominated?.event === "work_snapshot" &&
|
|
83
|
-
nominated.payload.snapshot.snapshotId === selection.snapshot.id && nominated.payload.snapshot.digest === selection.snapshot.digest
|
|
84
|
-
? nominated.payload.snapshot : null;
|
|
85
|
-
// A nominated inventory is diagnostic evidence only until ALL conflicting source IDs have been
|
|
86
|
-
// checked. Nested identity, not delivery ID/time, connects an alias to the selected closure.
|
|
87
|
-
const affected = exactSnapshot?.revisions.filter(ref => ref.kind === "obligation") ?? [];
|
|
88
|
-
const snapshotSources = workEventConflictSources(index, exactSnapshot ? nominated : selection.event);
|
|
89
|
-
for (const source of snapshotSources)
|
|
90
|
-
conflict(source.eventId, affected);
|
|
91
|
-
// An empty selected inventory is still quarantined: affected.length is not a validity test.
|
|
92
|
-
if (snapshotSources.length)
|
|
93
|
-
return empty("unresolved");
|
|
94
|
-
if (!nominated) {
|
|
95
|
-
problem("REFERENCE_MISSING", { type: "event", ref: selection.event });
|
|
96
|
-
return empty("unresolved");
|
|
97
|
-
}
|
|
98
|
-
if (!exactSnapshot) {
|
|
99
|
-
problem("SCOPE_INVALID", { type: "snapshot", ref: selection.snapshot });
|
|
100
|
-
return empty("invalid");
|
|
101
|
-
}
|
|
102
|
-
const snapshot = exactSnapshot;
|
|
103
|
-
const selected = new Map();
|
|
104
|
-
let invalid = false, missing = false;
|
|
105
|
-
function reject(code, ref, affected = []) {
|
|
106
|
-
invalid = true;
|
|
107
|
-
problem(code, reference(ref), affected);
|
|
108
|
-
}
|
|
109
|
-
for (const ref of [snapshot.scope, ...snapshot.revisions]) {
|
|
110
|
-
if (selected.has(entity(ref)))
|
|
111
|
-
reject("REVISION_INVALID", ref);
|
|
112
|
-
selected.set(entity(ref), ref); // Diagnostic lookup only if invalid; no rows will be exposed.
|
|
113
|
-
}
|
|
114
|
-
const obligationRefs = snapshot.revisions.filter(ref => ref.kind === "obligation");
|
|
115
|
-
const allAffected = unique(obligationRefs);
|
|
116
|
-
const records = new Map();
|
|
117
|
-
const quarantineSources = new Map();
|
|
118
|
-
for (const event of index.candidates)
|
|
119
|
-
if (event.event === "work_revision") {
|
|
120
|
-
const r = event.payload.revision;
|
|
121
|
-
const ref = { kind: r.kind, id: r.id, revision: r.revision, digest: r.digest };
|
|
122
|
-
if (!records.has(key(ref))) {
|
|
123
|
-
const sources = workRevisionConflictSources(index, ref);
|
|
124
|
-
if (sources.length)
|
|
125
|
-
quarantineSources.set(key(ref), sources);
|
|
126
|
-
}
|
|
127
|
-
records.set(key(ref), r);
|
|
128
|
-
}
|
|
129
|
-
const isSelected = (ref) => key(selected.get(entity(ref)) ?? null) === key(ref);
|
|
130
|
-
function lookup(ref, affected, localArtifact = false) {
|
|
131
|
-
// A scope revision's ID is its scopeId by the validated wire contract. This contradiction
|
|
132
|
-
// is already known from the reference; absent bytes must not downgrade it to a mere gap.
|
|
133
|
-
if (ref.kind === "scope" && ref.id !== snapshot.scope.id)
|
|
134
|
-
reject("SCOPE_INVALID", ref, affected);
|
|
135
|
-
const sources = quarantineSources.get(key(ref));
|
|
136
|
-
if (sources) {
|
|
137
|
-
for (const source of sources)
|
|
138
|
-
conflict(source.eventId, affected);
|
|
139
|
-
if (!localArtifact)
|
|
140
|
-
missing = true;
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
const r = records.get(key(ref));
|
|
144
|
-
if (!r) {
|
|
145
|
-
problem("REFERENCE_MISSING", reference(ref), affected);
|
|
146
|
-
if (!localArtifact)
|
|
147
|
-
missing = true;
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
if (r.scopeId !== snapshot.scope.id)
|
|
151
|
-
reject("REVISION_INVALID", ref, affected);
|
|
152
|
-
return r;
|
|
153
|
-
}
|
|
154
|
-
function walk(root, affected, localArtifact = false) {
|
|
155
|
-
const stack = [{ ref: root, current: true, local: localArtifact }];
|
|
156
|
-
const done = new Set(), active = new Set();
|
|
157
|
-
while (stack.length) {
|
|
158
|
-
const frame = stack.pop(), id = `${frame.current}:${key(frame.ref)}`;
|
|
159
|
-
if (frame.exit) {
|
|
160
|
-
active.delete(id);
|
|
161
|
-
done.add(id);
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
if (active.has(id)) {
|
|
165
|
-
reject("CYCLE", frame.ref, affected);
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
if (done.has(id))
|
|
169
|
-
continue;
|
|
170
|
-
if (frame.current && selected.has(entity(frame.ref)) && !isSelected(frame.ref))
|
|
171
|
-
reject("REVISION_INVALID", frame.ref, affected);
|
|
172
|
-
if (frame.current && frame.ref.kind === "scope" && key(frame.ref) !== key(snapshot.scope))
|
|
173
|
-
reject("SCOPE_INVALID", frame.ref, affected);
|
|
174
|
-
const r = lookup(frame.ref, affected, frame.local);
|
|
175
|
-
if (!r)
|
|
176
|
-
continue;
|
|
177
|
-
active.add(id);
|
|
178
|
-
stack.push({ ...frame, exit: true });
|
|
179
|
-
if (r.predecessor) {
|
|
180
|
-
const prior = lookup(r.predecessor, affected);
|
|
181
|
-
if (prior && (prior.kind !== r.kind || prior.id !== r.id || prior.scopeId !== r.scopeId || prior.revision + 1 !== r.revision)) {
|
|
182
|
-
reject("REVISION_INVALID", frame.ref, affected);
|
|
183
|
-
}
|
|
184
|
-
stack.push({ ref: r.predecessor, current: false });
|
|
185
|
-
}
|
|
186
|
-
if (r.parent) {
|
|
187
|
-
if (entity(r.parent) === entity(frame.ref))
|
|
188
|
-
reject("CYCLE", frame.ref, affected);
|
|
189
|
-
stack.push({ ref: r.parent, current: frame.current });
|
|
190
|
-
}
|
|
191
|
-
if (r.policy) {
|
|
192
|
-
if (frame.current && !isSelected(r.policy))
|
|
193
|
-
reject("REVISION_INVALID", r.policy, affected);
|
|
194
|
-
stack.push({ ref: r.policy, current: frame.current });
|
|
195
|
-
}
|
|
196
|
-
for (const dep of r.dependencies) {
|
|
197
|
-
if (entity(dep) === entity(frame.ref))
|
|
198
|
-
reject("CYCLE", frame.ref, affected);
|
|
199
|
-
if (frame.current && !isSelected(dep))
|
|
200
|
-
reject("DEPENDENCY_INVALID", dep, affected);
|
|
201
|
-
stack.push({ ref: dep, current: frame.current });
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
// Structural roots must be checked even when no obligation names them. Then walk each obligation
|
|
206
|
-
// independently to accumulate exact affected-obligation reachability, including shared ancestors.
|
|
207
|
-
walk(snapshot.scope, allAffected);
|
|
208
|
-
for (const ref of snapshot.revisions) {
|
|
209
|
-
const affected = ref.kind === "obligation" ? [ref] : snapshot.bindings.filter(binding => [binding.intent, binding.policy, binding.artifact].some(value => value && key(value) === key(ref))).map(binding => binding.obligation).filter(isSelected);
|
|
210
|
-
walk(ref, affected, ref.kind === "artifact");
|
|
211
|
-
}
|
|
212
|
-
function ancestor(obligation, intent) {
|
|
213
|
-
const seen = new Set();
|
|
214
|
-
let cursor = obligation;
|
|
215
|
-
while (cursor) {
|
|
216
|
-
const id = key(cursor);
|
|
217
|
-
if (seen.has(id) || quarantineSources.has(id))
|
|
218
|
-
return null;
|
|
219
|
-
seen.add(id);
|
|
220
|
-
const r = records.get(id);
|
|
221
|
-
if (!r)
|
|
222
|
-
return null;
|
|
223
|
-
cursor = r.parent;
|
|
224
|
-
if (cursor && key(cursor) === key(intent))
|
|
225
|
-
return true;
|
|
226
|
-
}
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
for (const ref of obligationRefs) {
|
|
230
|
-
if (snapshot.bindings.filter(binding => key(binding.obligation) === key(ref)).length !== 1)
|
|
231
|
-
reject("SCOPE_INVALID", ref, [ref]);
|
|
232
|
-
}
|
|
233
|
-
for (const binding of snapshot.bindings) {
|
|
234
|
-
const affected = isSelected(binding.obligation) ? [binding.obligation] : [];
|
|
235
|
-
if (!isSelected(binding.obligation))
|
|
236
|
-
reject("SCOPE_INVALID", binding.obligation);
|
|
237
|
-
if (!isSelected(binding.intent))
|
|
238
|
-
reject("SCOPE_INVALID", binding.intent, affected);
|
|
239
|
-
if (!isSelected(binding.policy))
|
|
240
|
-
reject("REVISION_INVALID", binding.policy, affected);
|
|
241
|
-
const r = lookup(binding.obligation, affected);
|
|
242
|
-
if (r && key(r.policy) !== key(binding.policy))
|
|
243
|
-
reject("REVISION_INVALID", binding.policy, affected);
|
|
244
|
-
if (r && ancestor(binding.obligation, binding.intent) === false)
|
|
245
|
-
reject("SCOPE_INVALID", binding.intent, affected);
|
|
246
|
-
if (binding.artifact && !isSelected(binding.artifact))
|
|
247
|
-
reject("ARTIFACT_UNSELECTED", binding.artifact, affected);
|
|
248
|
-
}
|
|
249
|
-
if (invalid)
|
|
250
|
-
return empty("invalid");
|
|
251
|
-
if (missing)
|
|
252
|
-
return empty("unresolved");
|
|
253
|
-
const diagnostics = reports();
|
|
254
|
-
return freezeWork({
|
|
255
|
-
scopeState: "valid", selectedSnapshot: selection.snapshot, snapshot,
|
|
256
|
-
scope: records.get(key(snapshot.scope)),
|
|
257
|
-
revisions: unique(snapshot.revisions.flatMap(ref => {
|
|
258
|
-
const r = quarantineSources.has(key(ref)) ? undefined : records.get(key(ref));
|
|
259
|
-
return r ? [r] : [];
|
|
260
|
-
})),
|
|
261
|
-
obligations: snapshot.bindings.map(binding => ({
|
|
262
|
-
binding, revision: records.get(key(binding.obligation)),
|
|
263
|
-
artifact: binding.artifact && !quarantineSources.has(key(binding.artifact)) ? records.get(key(binding.artifact)) ?? null : null,
|
|
264
|
-
problems: diagnostics.problems.filter(p => p.affectedObligations.some(ref => key(ref) === key(binding.obligation))),
|
|
265
|
-
})), ...diagnostics,
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
//# sourceMappingURL=snapshot.js.map
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
/** Opt-in work-v4 wire identities; none of these declarations grants authority. */
|
|
2
|
-
export type WorkFrozen<T> = T extends ReadonlyArray<infer E> ? ReadonlyArray<WorkFrozen<E>> : T extends object ? {
|
|
3
|
-
readonly [K in keyof T]: WorkFrozen<T[K]>;
|
|
4
|
-
} : T;
|
|
5
|
-
export type WorkInputCode = "WORK_JSON_INVALID" | "WORK_DUPLICATE_MEMBER" | "WORK_LIMIT_EXCEEDED" | "WORK_VERSION_UNSUPPORTED" | "WORK_SCHEMA_INVALID" | "WORK_DIGEST_MISMATCH" | "WORK_CONTEXT_INVALID";
|
|
6
|
-
export declare class WorkInputError extends TypeError {
|
|
7
|
-
readonly code: WorkInputCode;
|
|
8
|
-
constructor(code: WorkInputCode);
|
|
9
|
-
}
|
|
10
|
-
export type WorkWriteCode = "WORK_DESTINATION_INVALID" | "WORK_DESTINATION_ALIAS" | "WORK_LEDGER_WRITE_FAILED";
|
|
11
|
-
export declare class WorkLedgerWriteError extends Error {
|
|
12
|
-
readonly code: WorkWriteCode;
|
|
13
|
-
constructor(code: WorkWriteCode);
|
|
14
|
-
}
|
|
15
|
-
export type WorkInspectionCode = "WORK_INSPECTION_PATH_INVALID" | "WORK_INSPECTION_NOT_REGULAR" | "WORK_INSPECTION_READ_FAILED";
|
|
16
|
-
export interface WorkInspectionDiagnostic {
|
|
17
|
-
readonly line: null;
|
|
18
|
-
readonly code: WorkInputCode | WorkInspectionCode;
|
|
19
|
-
}
|
|
20
|
-
export interface WorkLedgerInspection {
|
|
21
|
-
readonly version: 4;
|
|
22
|
-
readonly status: "read" | "missing" | "error";
|
|
23
|
-
readonly exists: boolean | null;
|
|
24
|
-
readonly ingestion: WorkIngestion | null;
|
|
25
|
-
readonly projection: WorkProjection | null;
|
|
26
|
-
readonly errors: ReadonlyArray<WorkInspectionDiagnostic>;
|
|
27
|
-
}
|
|
28
|
-
export type RevisionKind = "scope" | "goal" | "node" | "obligation" | "artifact" | "policy";
|
|
29
|
-
export type WorkEventKind = "work_revision" | "work_snapshot" | "work_occurrence" | "work_acceptance";
|
|
30
|
-
export interface RevisionRef {
|
|
31
|
-
kind: RevisionKind;
|
|
32
|
-
id: string;
|
|
33
|
-
revision: number;
|
|
34
|
-
digest: string;
|
|
35
|
-
}
|
|
36
|
-
export interface EventRef {
|
|
37
|
-
eventId: string;
|
|
38
|
-
digest: string;
|
|
39
|
-
}
|
|
40
|
-
export interface Identity {
|
|
41
|
-
id: string;
|
|
42
|
-
digest: string;
|
|
43
|
-
}
|
|
44
|
-
export interface WorkRevision {
|
|
45
|
-
kind: RevisionKind;
|
|
46
|
-
id: string;
|
|
47
|
-
revision: number;
|
|
48
|
-
scopeId: string;
|
|
49
|
-
predecessor: RevisionRef | null;
|
|
50
|
-
contentDigest: string;
|
|
51
|
-
parent: RevisionRef | null;
|
|
52
|
-
dependencies: RevisionRef[];
|
|
53
|
-
ownerId: string;
|
|
54
|
-
permittedEffects: string[];
|
|
55
|
-
policy: RevisionRef | null;
|
|
56
|
-
digest: string;
|
|
57
|
-
}
|
|
58
|
-
export interface ObligationBinding {
|
|
59
|
-
intent: RevisionRef;
|
|
60
|
-
obligation: RevisionRef;
|
|
61
|
-
artifact: RevisionRef | null;
|
|
62
|
-
policy: RevisionRef;
|
|
63
|
-
}
|
|
64
|
-
export interface WorkSnapshot {
|
|
65
|
-
snapshotId: string;
|
|
66
|
-
scope: RevisionRef;
|
|
67
|
-
revisions: RevisionRef[];
|
|
68
|
-
bindings: ObligationBinding[];
|
|
69
|
-
digest: string;
|
|
70
|
-
}
|
|
71
|
-
export interface WorkOccurrencePayload {
|
|
72
|
-
scope: RevisionRef;
|
|
73
|
-
obligation: RevisionRef;
|
|
74
|
-
executionId: string;
|
|
75
|
-
parentExecutionId: string | null;
|
|
76
|
-
childId: string | null;
|
|
77
|
-
variantId: string | null;
|
|
78
|
-
artifact: RevisionRef | null;
|
|
79
|
-
provenance: "declared" | "observed";
|
|
80
|
-
state: "unknown" | "starting" | "running" | "completed" | "failed";
|
|
81
|
-
labels: {
|
|
82
|
-
sessionId: string | null;
|
|
83
|
-
branchLeafId: string | null;
|
|
84
|
-
toolCallId: string | null;
|
|
85
|
-
taskId: string | null;
|
|
86
|
-
workspaceId: string | null;
|
|
87
|
-
definitionDigest: string | null;
|
|
88
|
-
configurationDigest: string | null;
|
|
89
|
-
modelId: string | null;
|
|
90
|
-
effortId: string | null;
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
export interface EvidenceRef {
|
|
94
|
-
id: string;
|
|
95
|
-
digest: string;
|
|
96
|
-
event: EventRef | null;
|
|
97
|
-
}
|
|
98
|
-
export interface AcceptanceBinding {
|
|
99
|
-
snapshot: Identity;
|
|
100
|
-
scope: RevisionRef;
|
|
101
|
-
intent: RevisionRef;
|
|
102
|
-
obligation: RevisionRef;
|
|
103
|
-
artifact: RevisionRef;
|
|
104
|
-
artifactDigest: string;
|
|
105
|
-
policy: RevisionRef;
|
|
106
|
-
evidence: EvidenceRef[];
|
|
107
|
-
}
|
|
108
|
-
export interface WorkAcceptancePayload {
|
|
109
|
-
authorityId: string;
|
|
110
|
-
binding: AcceptanceBinding;
|
|
111
|
-
}
|
|
112
|
-
interface WorkEvent<K extends WorkEventKind, P> {
|
|
113
|
-
ledgerVersion: 4;
|
|
114
|
-
event: K;
|
|
115
|
-
eventId: string;
|
|
116
|
-
ts: string;
|
|
117
|
-
payload: P;
|
|
118
|
-
digest: string;
|
|
119
|
-
}
|
|
120
|
-
export type WorkRevisionEvent = WorkEvent<"work_revision", {
|
|
121
|
-
revision: WorkRevision;
|
|
122
|
-
}>;
|
|
123
|
-
export type WorkSnapshotEvent = WorkEvent<"work_snapshot", {
|
|
124
|
-
snapshot: WorkSnapshot;
|
|
125
|
-
}>;
|
|
126
|
-
export type WorkOccurrenceEvent = WorkEvent<"work_occurrence", WorkOccurrencePayload>;
|
|
127
|
-
export type WorkAcceptanceEvent = WorkEvent<"work_acceptance", WorkAcceptancePayload>;
|
|
128
|
-
export type WorkLedgerEvent = WorkRevisionEvent | WorkSnapshotEvent | WorkOccurrenceEvent | WorkAcceptanceEvent;
|
|
129
|
-
export interface WorkDiagnostic {
|
|
130
|
-
readonly line: number | null;
|
|
131
|
-
readonly code: WorkInputCode;
|
|
132
|
-
}
|
|
133
|
-
export interface WorkIngestion {
|
|
134
|
-
readonly events: ReadonlyArray<WorkLedgerEvent>;
|
|
135
|
-
readonly errors: ReadonlyArray<WorkDiagnostic>;
|
|
136
|
-
readonly complete: boolean;
|
|
137
|
-
}
|
|
138
|
-
export type WorkResolutionCode = "INPUT_INCOMPLETE" | "NO_SELECTION" | "REFERENCE_MISSING" | "SCOPE_INVALID" | "REVISION_INVALID" | "CYCLE" | "DEPENDENCY_INVALID" | "EVENT_CONFLICT" | "ARTIFACT_UNSELECTED" | "ARTIFACT_DIGEST_MISMATCH" | "NO_CLAIM" | "SUPERSEDED_BINDING" | "AUTHORITY_MISSING" | "RECEIPT_MISSING" | "RECEIPT_MISMATCH" | "RECEIPT_CONFLICT" | "DECISION_CONFLICT" | "TRUSTED_REJECTION" | "AVAILABILITY_MISSING" | "BYTES_UNAVAILABLE" | "AVAILABILITY_CONFLICT" | "OCCURRENCE_CONFLICT" | "PARENT_MISSING" | "PARENT_CYCLE" | "OBSERVATION_CONFLICT" | "BRANCH_UNKNOWN";
|
|
139
|
-
export type WorkReference = {
|
|
140
|
-
readonly type: "revision";
|
|
141
|
-
readonly ref: RevisionRef;
|
|
142
|
-
} | {
|
|
143
|
-
readonly type: "event";
|
|
144
|
-
readonly ref: EventRef;
|
|
145
|
-
} | {
|
|
146
|
-
readonly type: "snapshot" | "authority" | "artifact-bytes" | "evidence-bytes";
|
|
147
|
-
readonly ref: Identity;
|
|
148
|
-
} | {
|
|
149
|
-
readonly type: "execution";
|
|
150
|
-
readonly id: string;
|
|
151
|
-
};
|
|
152
|
-
export interface WorkProblem {
|
|
153
|
-
readonly code: WorkResolutionCode;
|
|
154
|
-
readonly reference: WorkReference | null;
|
|
155
|
-
readonly affectedObligations: ReadonlyArray<RevisionRef>;
|
|
156
|
-
}
|
|
157
|
-
export interface WorkConflict {
|
|
158
|
-
readonly kind: "event" | "receipt";
|
|
159
|
-
readonly id: string;
|
|
160
|
-
readonly digests: ReadonlyArray<string>;
|
|
161
|
-
readonly affectedObligations: ReadonlyArray<RevisionRef>;
|
|
162
|
-
}
|
|
163
|
-
/** Explicit trusted-host declarations, never constructed from wire evidence by production code. */
|
|
164
|
-
export interface WorkProjectionContext {
|
|
165
|
-
selectedSnapshot: {
|
|
166
|
-
snapshot: Identity;
|
|
167
|
-
event: EventRef;
|
|
168
|
-
} | null;
|
|
169
|
-
authority: {
|
|
170
|
-
snapshot: Identity;
|
|
171
|
-
decisions: Array<{
|
|
172
|
-
receiptId: string;
|
|
173
|
-
authorityId: string;
|
|
174
|
-
claim: EventRef;
|
|
175
|
-
binding: AcceptanceBinding;
|
|
176
|
-
decision: "accept" | "reject";
|
|
177
|
-
}>;
|
|
178
|
-
availability: Array<{
|
|
179
|
-
kind: "artifact" | "evidence";
|
|
180
|
-
id: string;
|
|
181
|
-
digest: string;
|
|
182
|
-
available: boolean;
|
|
183
|
-
}>;
|
|
184
|
-
} | null;
|
|
185
|
-
}
|
|
186
|
-
export type WorkAvailability = "available" | "unavailable" | "unknown" | "conflicted";
|
|
187
|
-
export interface WorkCoverageItem {
|
|
188
|
-
readonly kind: "artifact" | "evidence";
|
|
189
|
-
readonly identity: Identity;
|
|
190
|
-
readonly state: WorkAvailability;
|
|
191
|
-
}
|
|
192
|
-
export interface WorkCoverage {
|
|
193
|
-
readonly state: WorkAvailability | "unselected";
|
|
194
|
-
readonly items: ReadonlyArray<WorkCoverageItem>;
|
|
195
|
-
}
|
|
196
|
-
export type WorkAcceptanceState = "accepted-under-supplied-authority" | "unaccepted" | "unresolved";
|
|
197
|
-
export interface WorkClaimResult {
|
|
198
|
-
readonly claim: EventRef;
|
|
199
|
-
readonly obligation: RevisionRef;
|
|
200
|
-
readonly applicability: WorkAcceptanceState | "superseded";
|
|
201
|
-
readonly matchedReceiptIds: ReadonlyArray<string>;
|
|
202
|
-
readonly problems: ReadonlyArray<WorkProblem>;
|
|
203
|
-
}
|
|
204
|
-
export interface WorkObligationResult {
|
|
205
|
-
readonly binding: ObligationBinding;
|
|
206
|
-
readonly acceptance: WorkAcceptanceState;
|
|
207
|
-
readonly artifactCoverage: WorkCoverage;
|
|
208
|
-
readonly evidenceCoverage: WorkCoverage;
|
|
209
|
-
readonly claims: ReadonlyArray<EventRef>;
|
|
210
|
-
readonly problems: ReadonlyArray<WorkProblem>;
|
|
211
|
-
}
|
|
212
|
-
export interface WorkOccurrenceView {
|
|
213
|
-
readonly event: EventRef;
|
|
214
|
-
readonly payload: WorkOccurrencePayload;
|
|
215
|
-
}
|
|
216
|
-
export interface WorkAttemptBinding {
|
|
217
|
-
readonly scope: RevisionRef;
|
|
218
|
-
readonly obligation: RevisionRef;
|
|
219
|
-
readonly variantIds: ReadonlyArray<string>;
|
|
220
|
-
readonly artifacts: ReadonlyArray<RevisionRef>;
|
|
221
|
-
}
|
|
222
|
-
export interface WorkAttempt {
|
|
223
|
-
readonly executionId: string;
|
|
224
|
-
readonly bindings: ReadonlyArray<WorkAttemptBinding>;
|
|
225
|
-
readonly parentExecutionId: string | null;
|
|
226
|
-
readonly childId: string | null;
|
|
227
|
-
readonly declaredLabels: ReadonlyArray<WorkOccurrencePayload["labels"]>;
|
|
228
|
-
readonly observedLabels: ReadonlyArray<WorkOccurrencePayload["labels"]>;
|
|
229
|
-
readonly effectiveLabels: WorkOccurrencePayload["labels"];
|
|
230
|
-
readonly state: WorkOccurrencePayload["state"] | "conflicted";
|
|
231
|
-
readonly resolution: "resolved" | "unresolved";
|
|
232
|
-
readonly problems: ReadonlyArray<WorkProblem>;
|
|
233
|
-
}
|
|
234
|
-
export interface WorkRuntimeCounts {
|
|
235
|
-
readonly attempts: number;
|
|
236
|
-
readonly variants: number;
|
|
237
|
-
readonly observedCompletedAttempts: number;
|
|
238
|
-
}
|
|
239
|
-
export interface WorkRuntime {
|
|
240
|
-
readonly counts: WorkRuntimeCounts;
|
|
241
|
-
readonly occurrences: ReadonlyArray<WorkOccurrenceView>;
|
|
242
|
-
readonly attempts: ReadonlyArray<WorkAttempt>;
|
|
243
|
-
}
|
|
244
|
-
export interface WorkProjection {
|
|
245
|
-
readonly selectedSnapshot: Identity | null;
|
|
246
|
-
readonly authoritySnapshot: Identity | null;
|
|
247
|
-
readonly scopeState: "unselected" | "valid" | "unresolved" | "invalid";
|
|
248
|
-
readonly progress: Readonly<{
|
|
249
|
-
accepted: number;
|
|
250
|
-
total: number;
|
|
251
|
-
}> | null;
|
|
252
|
-
readonly obligations: ReadonlyArray<WorkObligationResult>;
|
|
253
|
-
readonly claims: ReadonlyArray<WorkClaimResult>;
|
|
254
|
-
readonly supersededClaims: number;
|
|
255
|
-
readonly conflicts: ReadonlyArray<WorkConflict>;
|
|
256
|
-
readonly problems: ReadonlyArray<WorkProblem>;
|
|
257
|
-
readonly errors: ReadonlyArray<WorkDiagnostic>;
|
|
258
|
-
readonly runtime: WorkRuntime | null;
|
|
259
|
-
}
|
|
260
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export class WorkInputError extends TypeError {
|
|
2
|
-
code;
|
|
3
|
-
constructor(code) {
|
|
4
|
-
super(code);
|
|
5
|
-
this.name = "WorkInputError";
|
|
6
|
-
this.code = code;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export class WorkLedgerWriteError extends Error {
|
|
10
|
-
code;
|
|
11
|
-
constructor(code) { super(code); this.name = "WorkLedgerWriteError"; this.code = code; }
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type WorkJson } from "./json.js";
|
|
2
|
-
import { type WorkLedgerEvent } from "./types.js";
|
|
3
|
-
type ObjectValue = {
|
|
4
|
-
[key: string]: WorkJson;
|
|
5
|
-
};
|
|
6
|
-
export declare function workObject(value: WorkJson): ObjectValue;
|
|
7
|
-
/** Internal validation for the exact out-of-band selectedSnapshot shape; no authority is constructed. */
|
|
8
|
-
export declare function validateWorkSelection(value: WorkJson): void;
|
|
9
|
-
/** Validate a detached host context. Receipt/availability order and duplicate deliveries have no priority. */
|
|
10
|
-
export declare function validateWorkContext(value: WorkJson): void;
|
|
11
|
-
/** All closed shapes/domain checks finish before any own digest is computed or verified. */
|
|
12
|
-
export declare function validateWorkEvent(value: WorkJson, building?: boolean): WorkLedgerEvent;
|
|
13
|
-
export {};
|