owlrunkit 0.19.1 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +71 -0
  3. package/docs/architecture/OWLCODA_RUNKIT_0191_PROFILE_RECONCILE_PATCH_PRODUCT_DECISION_20260813.md +11 -5
  4. package/docs/architecture/OWLCODA_RUNKIT_0192_FORMAL_USABILITY_PRODUCT_DECISION_20260813.md +141 -0
  5. package/integrations/codex/skills/owlcoda-runkit/SKILL.md +50 -7
  6. package/integrations/codex/skills/owlcoda-runkit/assets/templates/config.json +3 -3
  7. package/package.json +1 -1
  8. package/packages/attest/distribution-manifest-v1.json +5 -0
  9. package/packages/attest/src/quick.mjs +37 -4
  10. package/registry-release-policy-v1.json +5 -5
  11. package/sbom.spdx.json +5 -5
  12. package/scripts/runkit-contract/core-contract.mjs +35 -2
  13. package/scripts/runkit-contract/efficiency-metrics.mjs +9 -7
  14. package/scripts/runkit-contract/formal-preflight.mjs +352 -0
  15. package/scripts/runkit-contract/formal-supplemental-evidence.mjs +713 -0
  16. package/scripts/runkit-contract/formal-workflow.mjs +529 -59
  17. package/scripts/runkit-contract/onboarding-doctor.mjs +32 -13
  18. package/scripts/runkit-contract/project-cli-resolver.mjs +30 -3
  19. package/scripts/runkit-contract/project-external-delivery.mjs +16 -9
  20. package/scripts/runkit-contract/quick-attest.mjs +24 -0
  21. package/scripts/runkit-contract/runkit-cli.mjs +365 -49
  22. package/scripts/runkit-contract/schemas/formal-check-v2.schema.json +231 -0
  23. package/scripts/runkit-contract/schemas/formal-envelope-preflight-v1.schema.json +212 -0
  24. package/scripts/runkit-contract/schemas/formal-evidence-summary-v1.schema.json +114 -0
  25. package/scripts/runkit-contract/schemas/formal-supplemental-evidence-v1.schema.json +103 -0
  26. package/scripts/runkit-contract/schemas/team-project-event-v5.schema.json +89 -0
  27. package/scripts/runkit-contract/schemas/team-project-status-v3.schema.json +173 -0
  28. package/scripts/runkit-contract/snapshot.mjs +125 -5
  29. package/scripts/runkit-contract/source-candidate.mjs +271 -69
  30. package/scripts/runkit-contract/sync-release-identity.mjs +39 -4
  31. package/scripts/runkit-contract/team-project-successor.mjs +7 -4
  32. package/scripts/runkit-contract/team-project.mjs +440 -28
  33. package/scripts/runkit-contract/usage-mode.mjs +9 -3
  34. package/scripts/runkit-contract/verification-envelope.mjs +425 -37
@@ -0,0 +1,89 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://owlcoda.com/schemas/runkit/team-project-event-v5.schema.json",
4
+ "title": "OwlCoda RunKit Team Project Event V5",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "eventId",
10
+ "type",
11
+ "occurredAt",
12
+ "revisionId",
13
+ "assignmentId",
14
+ "workItemId",
15
+ "ownerAgentId",
16
+ "previousOwnedPaths",
17
+ "ownedPaths",
18
+ "previousMeasurable",
19
+ "measurable",
20
+ "reason",
21
+ "evidenceRefs"
22
+ ],
23
+ "properties": {
24
+ "schemaVersion": { "const": "OwlCodaRunKitTeamProjectEventV5" },
25
+ "eventId": { "$ref": "#/$defs/id" },
26
+ "type": { "const": "work_item_scope_revised" },
27
+ "occurredAt": {
28
+ "type": "string",
29
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
30
+ },
31
+ "revisionId": { "$ref": "#/$defs/id" },
32
+ "supersedesRevisionId": { "$ref": "#/$defs/id" },
33
+ "assignmentId": { "$ref": "#/$defs/id" },
34
+ "workItemId": { "$ref": "#/$defs/id" },
35
+ "ownerAgentId": { "$ref": "#/$defs/id" },
36
+ "previousOwnedPaths": { "$ref": "#/$defs/paths" },
37
+ "ownedPaths": { "$ref": "#/$defs/paths" },
38
+ "previousMeasurable": { "$ref": "#/$defs/nullableMeasurable" },
39
+ "measurable": { "$ref": "#/$defs/nullableMeasurable" },
40
+ "reason": { "type": "string", "minLength": 1 },
41
+ "evidenceRefs": {
42
+ "type": "array",
43
+ "uniqueItems": true,
44
+ "items": { "type": "string", "minLength": 1 }
45
+ }
46
+ },
47
+ "examples": [
48
+ {
49
+ "schemaVersion": "OwlCodaRunKitTeamProjectEventV5",
50
+ "eventId": "scope-revision-001",
51
+ "type": "work_item_scope_revised",
52
+ "occurredAt": "2026-08-13T05:57:10.000Z",
53
+ "revisionId": "revision-001",
54
+ "assignmentId": "assignment-001",
55
+ "workItemId": "canonical-adapter",
56
+ "ownerAgentId": "luna-max",
57
+ "previousOwnedPaths": ["src/adapter/**"],
58
+ "ownedPaths": ["src/adapter/**", "src/canonical-store/**"],
59
+ "previousMeasurable": { "unit": "interface", "total": 1 },
60
+ "measurable": { "unit": "interface", "total": 2 },
61
+ "reason": "Diagnosis proved the canonical store is part of the same bounded fix.",
62
+ "evidenceRefs": ["docs/decisions/scope-revision.md"]
63
+ }
64
+ ],
65
+ "$defs": {
66
+ "id": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$" },
67
+ "paths": {
68
+ "type": "array",
69
+ "minItems": 1,
70
+ "uniqueItems": true,
71
+ "items": { "type": "string", "minLength": 1 }
72
+ },
73
+ "measurable": {
74
+ "type": "object",
75
+ "additionalProperties": false,
76
+ "required": ["unit", "total"],
77
+ "properties": {
78
+ "unit": { "type": "string", "minLength": 1 },
79
+ "total": { "type": "integer", "minimum": 1 }
80
+ }
81
+ },
82
+ "nullableMeasurable": {
83
+ "oneOf": [
84
+ { "$ref": "#/$defs/measurable" },
85
+ { "type": "null" }
86
+ ]
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,173 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://owlcoda.com/schemas/runkit/team-project-status-v3.schema.json",
4
+ "title": "OwlCoda RunKit Team Project Status V3",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "status",
10
+ "projectId",
11
+ "objective",
12
+ "overall",
13
+ "counts",
14
+ "milestones",
15
+ "workstreams",
16
+ "workItems",
17
+ "agents",
18
+ "readyQueue",
19
+ "criticalWorkItems",
20
+ "openDecisions",
21
+ "resolvedDecisions",
22
+ "deferredVerifications",
23
+ "openDeferredVerificationIds",
24
+ "integrationGates",
25
+ "dataCandidates",
26
+ "sourceDeliveries",
27
+ "warnings",
28
+ "projectTruthHash",
29
+ "authorizationGranted",
30
+ "deliveryDisposition",
31
+ "headline",
32
+ "dominantGap",
33
+ "nextAction",
34
+ "nextActorId",
35
+ "exitCode"
36
+ ],
37
+ "properties": {
38
+ "schemaVersion": { "const": "OwlCodaRunKitTeamProjectStatusV3" },
39
+ "status": { "const": "team_project_status" },
40
+ "projectId": { "type": "string", "minLength": 1 },
41
+ "objective": { "type": "string", "minLength": 1 },
42
+ "overall": { "enum": ["planned", "active", "active_with_blockers", "completed"] },
43
+ "counts": { "type": "object" },
44
+ "milestones": { "type": "array", "items": { "type": "object" } },
45
+ "workstreams": { "type": "array", "items": { "type": "object" } },
46
+ "workItems": { "type": "array", "items": { "type": "object" } },
47
+ "agents": { "type": "array", "items": { "type": "object" } },
48
+ "readyQueue": { "type": "array", "items": { "type": "string" } },
49
+ "criticalWorkItems": { "type": "array", "items": { "type": "string" } },
50
+ "openDecisions": { "type": "array", "items": { "type": "object" } },
51
+ "resolvedDecisions": { "type": "array", "items": { "type": "object" } },
52
+ "deferredVerifications": { "type": "array", "items": { "type": "object" } },
53
+ "openDeferredVerificationIds": { "type": "array", "items": { "type": "string" } },
54
+ "integrationGates": { "type": "array", "items": { "type": "object" } },
55
+ "dataCandidates": { "type": "array", "items": { "type": "object" } },
56
+ "sourceDeliveries": { "type": "array", "items": { "type": "object" } },
57
+ "warnings": {
58
+ "type": "array",
59
+ "items": {
60
+ "type": "object",
61
+ "additionalProperties": false,
62
+ "required": ["code", "workItemId", "message", "truthRefs"],
63
+ "properties": {
64
+ "code": { "const": "no_bound_verification_receipt" },
65
+ "workItemId": { "type": "string", "minLength": 1 },
66
+ "message": { "type": "string", "minLength": 1 },
67
+ "truthRefs": {
68
+ "type": "array",
69
+ "uniqueItems": true,
70
+ "items": { "type": "string", "minLength": 1 }
71
+ }
72
+ }
73
+ }
74
+ },
75
+ "projectTruthHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
76
+ "authorizationGranted": { "const": false },
77
+ "deliveryDisposition": {
78
+ "enum": ["work_in_progress", "code_complete_without_release_authority"]
79
+ },
80
+ "headline": { "type": "string", "minLength": 1 },
81
+ "dominantGap": {
82
+ "type": "object",
83
+ "additionalProperties": false,
84
+ "required": ["kind", "id", "title", "workItemId", "agentId", "reason", "truthRefs"],
85
+ "properties": {
86
+ "kind": {
87
+ "enum": [
88
+ "decision",
89
+ "failed_work",
90
+ "work_item",
91
+ "deferred_verification",
92
+ "integration_gate",
93
+ "release_authority",
94
+ "none"
95
+ ]
96
+ },
97
+ "id": { "type": ["string", "null"] },
98
+ "title": { "type": ["string", "null"] },
99
+ "workItemId": { "type": ["string", "null"] },
100
+ "agentId": { "type": ["string", "null"] },
101
+ "reason": { "type": ["string", "null"] },
102
+ "truthRefs": {
103
+ "type": "array",
104
+ "uniqueItems": true,
105
+ "items": { "type": "string", "minLength": 1 }
106
+ }
107
+ }
108
+ },
109
+ "nextAction": { "type": ["string", "null"] },
110
+ "nextActorId": { "type": ["string", "null"] },
111
+ "exitCode": { "const": 0 }
112
+ },
113
+ "examples": [
114
+ {
115
+ "schemaVersion": "OwlCodaRunKitTeamProjectStatusV3",
116
+ "status": "team_project_status",
117
+ "projectId": "g13-canary",
118
+ "objective": "Repair the bounded G13 canary contract",
119
+ "overall": "planned",
120
+ "counts": {},
121
+ "milestones": [],
122
+ "workstreams": [],
123
+ "workItems": [],
124
+ "agents": [],
125
+ "readyQueue": [],
126
+ "criticalWorkItems": [],
127
+ "openDecisions": [],
128
+ "resolvedDecisions": [],
129
+ "deferredVerifications": [],
130
+ "openDeferredVerificationIds": [],
131
+ "integrationGates": [],
132
+ "dataCandidates": [],
133
+ "sourceDeliveries": [],
134
+ "warnings": [],
135
+ "projectTruthHash": "0000000000000000000000000000000000000000000000000000000000000000",
136
+ "authorizationGranted": false,
137
+ "deliveryDisposition": "work_in_progress",
138
+ "headline": "Project is planned; assign the first ready WorkItem.",
139
+ "dominantGap": {
140
+ "kind": "none",
141
+ "id": null,
142
+ "title": null,
143
+ "workItemId": null,
144
+ "agentId": null,
145
+ "reason": null,
146
+ "truthRefs": []
147
+ },
148
+ "nextAction": null,
149
+ "nextActorId": null,
150
+ "exitCode": 0
151
+ }
152
+ ],
153
+ "allOf": [
154
+ {
155
+ "if": {
156
+ "properties": { "overall": { "const": "completed" } },
157
+ "required": ["overall"]
158
+ },
159
+ "then": {
160
+ "properties": {
161
+ "deliveryDisposition": { "const": "code_complete_without_release_authority" },
162
+ "nextAction": { "type": "string", "minLength": 1 },
163
+ "dominantGap": {
164
+ "properties": { "kind": { "const": "release_authority" } }
165
+ }
166
+ }
167
+ },
168
+ "else": {
169
+ "properties": { "deliveryDisposition": { "const": "work_in_progress" } }
170
+ }
171
+ }
172
+ ]
173
+ }
@@ -8,6 +8,7 @@ import {
8
8
  } from "node:fs";
9
9
  import path from "node:path";
10
10
 
11
+ import { validateReplayableEvidence } from "./acceptance-evidence.mjs";
11
12
  import { canonicalSourceFingerprint } from "./source-fingerprint.mjs";
12
13
  import {
13
14
  assertAllowedKeys,
@@ -185,21 +186,140 @@ function validateRequest(request) {
185
186
  if (!context.valid) throw new Error(`Snapshot verification context is invalid: ${context.issues.join("; ")}`);
186
187
  }
187
188
 
188
- export function verifySnapshotEvidence({ workspaceRoot, runId, snapshot }) {
189
+ function exactKeys(value, label, keys, { optional = [] } = {}) {
190
+ assertAllowedKeys(value, label, [...keys, ...optional]);
191
+ if (!isRecord(value) || keys.some(key => !Object.hasOwn(value, key))) {
192
+ throw new Error(`${label} is missing required fields.`);
193
+ }
194
+ }
195
+
196
+ function validRepositoryState(state, label) {
197
+ try {
198
+ exactKeys(state, label, [
199
+ "head",
200
+ "statusMode",
201
+ "statusSha256",
202
+ "statusByteCount",
203
+ "statusEntryCount",
204
+ "selectedFiles",
205
+ "manifestFingerprint",
206
+ ]);
207
+ const files = normalizedFileMap(state.selectedFiles);
208
+ return typeof state.head === "string"
209
+ && state.head.length > 0
210
+ && state.statusMode === STATUS_MODE
211
+ && /^[a-f0-9]{64}$/u.test(state.statusSha256)
212
+ && Number.isSafeInteger(state.statusByteCount)
213
+ && state.statusByteCount >= 0
214
+ && Number.isSafeInteger(state.statusEntryCount)
215
+ && state.statusEntryCount >= 0
216
+ && files !== null
217
+ && canonicalSourceFingerprint(files) === state.manifestFingerprint;
218
+ } catch {
219
+ return false;
220
+ }
221
+ }
222
+
223
+ function snapshotContractIssues(snapshot) {
189
224
  const issues = [];
190
- if (!isRecord(snapshot) || snapshot.schemaVersion !== "OwlCodaRunKitSnapshotV1") {
191
- return { valid: false, issues: ["Unsupported snapshot schemaVersion."] };
225
+ try {
226
+ exactKeys(snapshot, "Snapshot", [
227
+ "schemaVersion",
228
+ "runId",
229
+ "snapshotId",
230
+ "status",
231
+ "mode",
232
+ "targetRoot",
233
+ "verificationContextFingerprint",
234
+ "repositoryBefore",
235
+ "repositoryAfter",
236
+ "command",
237
+ "authorizationGranted",
238
+ ], { optional: ["visual"] });
239
+ exactKeys(snapshot.command, "Snapshot command", [
240
+ "startedAt",
241
+ "endedAt",
242
+ "durationMs",
243
+ "exitCode",
244
+ "stdoutPath",
245
+ "stdoutSha256",
246
+ "stdoutLineCount",
247
+ "stderrPath",
248
+ "stderrSha256",
249
+ "stderrLineCount",
250
+ "evidence",
251
+ ]);
252
+ } catch (error) {
253
+ return [error instanceof Error ? error.message : String(error)];
254
+ }
255
+ if (
256
+ snapshot.schemaVersion !== "OwlCodaRunKitSnapshotV1"
257
+ || typeof snapshot.runId !== "string"
258
+ || snapshot.runId.length === 0
259
+ || typeof snapshot.snapshotId !== "string"
260
+ || snapshot.snapshotId.length === 0
261
+ || !new Set(["project", "foreign_readonly"]).has(snapshot.mode)
262
+ || typeof snapshot.targetRoot !== "string"
263
+ || snapshot.targetRoot.length === 0
264
+ || !/^[a-f0-9]{64}$/u.test(snapshot.verificationContextFingerprint)
265
+ || snapshot.authorizationGranted !== false
266
+ || !validRepositoryState(snapshot.repositoryBefore, "repositoryBefore")
267
+ || !validRepositoryState(snapshot.repositoryAfter, "repositoryAfter")
268
+ || typeof snapshot.command.startedAt !== "string"
269
+ || typeof snapshot.command.endedAt !== "string"
270
+ || !Number.isSafeInteger(snapshot.command.durationMs)
271
+ || snapshot.command.durationMs < 0
272
+ || !Number.isInteger(snapshot.command.exitCode)
273
+ || typeof snapshot.command.stdoutPath !== "string"
274
+ || typeof snapshot.command.stderrPath !== "string"
275
+ || !/^[a-f0-9]{64}$/u.test(snapshot.command.stdoutSha256)
276
+ || !/^[a-f0-9]{64}$/u.test(snapshot.command.stderrSha256)
277
+ || !Number.isSafeInteger(snapshot.command.stdoutLineCount)
278
+ || snapshot.command.stdoutLineCount < 0
279
+ || !Number.isSafeInteger(snapshot.command.stderrLineCount)
280
+ || snapshot.command.stderrLineCount < 0
281
+ ) {
282
+ issues.push("Snapshot contract is invalid.");
192
283
  }
284
+ const evidence = validateReplayableEvidence(snapshot.command.evidence);
285
+ if (!evidence.valid) issues.push(...evidence.issues);
286
+ const stable = stableTarget(snapshot.repositoryBefore, snapshot.repositoryAfter);
287
+ const expectedStatus = !stable
288
+ ? "invalidated_by_target_write"
289
+ : snapshot.command.exitCode === 0
290
+ ? "snapshot_passed"
291
+ : "snapshot_failed";
292
+ if (snapshot.status !== expectedStatus) {
293
+ issues.push("Snapshot status does not match its command and repository state.");
294
+ }
295
+ return issues;
296
+ }
297
+
298
+ export function verifySnapshotEvidence({
299
+ workspaceRoot,
300
+ runId,
301
+ snapshot,
302
+ requirePassed = true,
303
+ }) {
304
+ const issues = [];
305
+ issues.push(...snapshotContractIssues(snapshot));
306
+ if (issues.length > 0) return { valid: false, issues };
193
307
  if (snapshot.runId !== runId) issues.push("Snapshot runId does not match the execution.");
194
- if (snapshot.status !== "snapshot_passed") issues.push("Snapshot did not pass.");
308
+ if (requirePassed && snapshot.status !== "snapshot_passed") {
309
+ issues.push("Snapshot did not pass.");
310
+ }
195
311
  for (const [label, relativePath, expected] of [
196
312
  ["stdout", snapshot.command?.stdoutPath, snapshot.command?.stdoutSha256],
197
313
  ["stderr", snapshot.command?.stderrPath, snapshot.command?.stderrSha256],
198
314
  ]) {
199
315
  try {
200
316
  const absolutePath = resolveWithinRoot(workspaceRoot, relativePath, `${label} evidence path`);
201
- const actual = sha256(readFileSync(absolutePath));
317
+ const bytes = readFileSync(absolutePath);
318
+ const actual = sha256(bytes);
202
319
  if (actual !== expected) issues.push(`${label} evidence hash mismatch.`);
320
+ if (lineCount(bytes) !== snapshot.command[`${label}LineCount`]) {
321
+ issues.push(`${label} evidence line count mismatch.`);
322
+ }
203
323
  } catch (error) {
204
324
  issues.push(error instanceof Error ? error.message : String(error));
205
325
  }