forge-workflow 0.1.0-beta.5 → 0.1.0-beta.7
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/AGENTS.md +4 -0
- package/CHANGELOG.md +48 -0
- package/CLAUDE.md +0 -12
- package/CODING_STANDARDS.md +72 -0
- package/bin/forge.js +12 -1
- package/docs/guides/MIGRATION.md +3 -3
- package/docs/reference/FORGE_KERNEL_STORAGE_MODEL.md +4 -0
- package/docs/reference/INSTALL.md +4 -0
- package/docs/reference/LEGACY_CLAIM_REPAIR.md +112 -0
- package/docs/reference/RELEASE.md +4 -4
- package/docs/reference/github-accounts.md +134 -0
- package/docs/reference/shepherd.md +63 -13
- package/lib/adapters/pr-state-adapter.js +15 -2
- package/lib/base-remote.js +138 -0
- package/lib/beta5-compatibility-evidence.js +1093 -0
- package/lib/bun-lockfile-proof.js +413 -0
- package/lib/bun-workflow-pins.js +461 -0
- package/lib/capabilities/index.js +9 -0
- package/lib/capabilities/model.js +141 -0
- package/lib/capabilities/probes.js +347 -0
- package/lib/codex-skills.js +2 -2
- package/lib/commands/_manifest.js +1 -0
- package/lib/commands/_registry.js +48 -18
- package/lib/commands/clean.js +57 -1
- package/lib/commands/doctor.js +37 -6
- package/lib/commands/gate.js +197 -27
- package/lib/commands/github.js +215 -0
- package/lib/commands/hooks.js +54 -6
- package/lib/commands/memory.js +66 -2
- package/lib/commands/merge.js +720 -73
- package/lib/commands/plan.js +33 -2
- package/lib/commands/pr.js +2 -0
- package/lib/commands/preflight.js +10 -2
- package/lib/commands/push.js +120 -9
- package/lib/commands/recall.js +95 -61
- package/lib/commands/release.js +23 -2
- package/lib/commands/remember.js +28 -4
- package/lib/commands/serve.js +26 -9
- package/lib/commands/setup.js +132 -4
- package/lib/commands/shepherd.js +578 -72
- package/lib/commands/ship.js +15 -69
- package/lib/commands/skill.js +8 -0
- package/lib/commands/team.js +47 -8
- package/lib/commands/test.js +163 -4
- package/lib/commands/validate.js +78 -22
- package/lib/commands/worktree.js +155 -19
- package/lib/fixtures/beta5-corpus/v1/README.md +9 -0
- package/lib/fixtures/beta5-corpus/v1/contract/command-contract.json +26 -0
- package/lib/fixtures/beta5-corpus/v1/contract/package-contract.json +13 -0
- package/lib/fixtures/beta5-corpus/v1/contract/workflow-stage-matrix.json +8 -0
- package/lib/fixtures/beta5-corpus/v1/manifest.json +25 -0
- package/lib/fixtures/beta5-corpus/v1/state/comments.jsonl +1 -0
- package/lib/fixtures/beta5-corpus/v1/state/config.yaml +6 -0
- package/lib/fixtures/beta5-corpus/v1/state/dependencies.jsonl +1 -0
- package/lib/fixtures/beta5-corpus/v1/state/issues.jsonl +2 -0
- package/lib/fixtures/beta5-corpus/v1/state/kernel.sql +20 -0
- package/lib/forge-issues.js +78 -0
- package/lib/gate-events.js +98 -10
- package/lib/github-context.js +308 -0
- package/lib/global-flags.js +1 -0
- package/lib/hook-renderer.js +29 -1
- package/lib/issue-render.js +19 -0
- package/lib/kernel/broker.js +723 -31
- package/lib/kernel/claim-reconciler.js +238 -0
- package/lib/kernel/lease-enforcer.js +9 -4
- package/lib/kernel/legacy-claim-repair.js +442 -0
- package/lib/kernel/live-claim-projection.js +26 -0
- package/lib/kernel/migrations.js +118 -3
- package/lib/kernel/readiness-model.js +184 -12
- package/lib/kernel/schema.js +49 -1
- package/lib/kernel/sqlite-driver.js +3322 -183
- package/lib/kernel/taxonomy-validator.js +4 -1
- package/lib/kernel/windows-private-acl.js +239 -0
- package/lib/memory/hygiene.js +191 -0
- package/lib/memory/router.js +94 -27
- package/lib/memory/usage-evidence.js +4 -0
- package/lib/memory-digest.js +59 -0
- package/lib/merge-rules.js +135 -17
- package/lib/npm-publish-workflow.js +233 -40
- package/lib/package-root.js +2 -0
- package/lib/pr-monitor/auto-actions.js +169 -28
- package/lib/pr-monitor/differ.js +110 -4
- package/lib/pr-monitor/events.js +0 -0
- package/lib/pr-monitor/flow-monitor.js +1424 -0
- package/lib/pr-monitor/gather.js +251 -44
- package/lib/pr-monitor/journal.js +0 -37
- package/lib/pr-monitor/monitor.js +117 -10
- package/lib/pr-monitor/process-identity.js +117 -0
- package/lib/pr-monitor/reconcile-executor.js +1101 -625
- package/lib/pr-monitor/reconcile.js +0 -0
- package/lib/pr-monitor/render-summary.js +121 -24
- package/lib/pr-monitor/review-preflight.js +269 -0
- package/lib/pr-monitor/shepherd-lease.js +28 -19
- package/lib/pr-monitor/verdict.js +438 -0
- package/lib/pr-monitor/watch-lifecycle.js +144 -38
- package/lib/pr-monitor/watch-owner.js +1414 -0
- package/lib/pr-monitor/watch.js +129 -58
- package/lib/pr-shepherd.js +17 -3
- package/lib/project-memory.js +145 -3
- package/lib/protected-state-authority.js +799 -4
- package/lib/protected-state-surfaces.js +181 -3
- package/lib/release-readiness.js +2 -3
- package/lib/review-adapter.js +65 -0
- package/lib/skills-sync.js +65 -32
- package/lib/validation/risk-manifest.js +339 -0
- package/lib/validation-receipt.js +190 -0
- package/lib/workflow/enforce-stage.js +44 -0
- package/lib/workflow/plan-authority.js +225 -0
- package/node_modules/@forge/contracts/compatibility-matrix.v1.json +1 -0
- package/node_modules/@forge/contracts/contract-baseline.v1.json +134 -0
- package/node_modules/@forge/contracts/fixtures/v1/canonical-hash.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/contract-inputs.v1.json +71 -0
- package/node_modules/@forge/contracts/fixtures/v1/feedback-secret-reject.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/identity-conflict.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/malformed-envelope-inputs.v1.json +16 -0
- package/node_modules/@forge/contracts/fixtures/v1/malformed-missing-required.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/monitor-bounds-reject.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/monitor-receipt-privacy-reject.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/not-executed-receipt.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/privacy-redaction.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/retry-identical.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/stale-authority-reject.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/structured-error-privacy-reject.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/structured-error-stripe-live-reject.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/structured-error-stripe-test-reject.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/unknown-advisory-roundtrip.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/unknown-consequential-reject.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/valid-full.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/valid-minimal.json +1 -0
- package/node_modules/@forge/contracts/fixtures/v1/wrong-capability-digest.json +1 -0
- package/node_modules/@forge/contracts/index.js +32 -0
- package/node_modules/@forge/contracts/package.json +35 -0
- package/node_modules/@forge/contracts/schemas/v1/capability-manifest.schema.json +1 -0
- package/node_modules/@forge/contracts/schemas/v1/claim-request.schema.json +1 -0
- package/node_modules/@forge/contracts/schemas/v1/context-packet.schema.json +1 -0
- package/node_modules/@forge/contracts/schemas/v1/delivery-receipt.schema.json +1 -0
- package/node_modules/@forge/contracts/schemas/v1/feedback-report.schema.json +1 -0
- package/node_modules/@forge/contracts/schemas/v1/lease-receipt.schema.json +1 -0
- package/node_modules/@forge/contracts/schemas/v1/monitor-event.schema.json +1 -0
- package/node_modules/@forge/contracts/schemas/v1/monitor-receipt.schema.json +1 -0
- package/node_modules/@forge/contracts/schemas/v1/run-receipt.schema.json +1 -0
- package/node_modules/@forge/contracts/schemas/v1/structured-error.schema.json +1 -0
- package/node_modules/@forge/contracts/schemas/v1/work-packet.schema.json +1 -0
- package/node_modules/@forge/contracts/src/baseline.js +23 -0
- package/node_modules/@forge/contracts/src/canonical.js +151 -0
- package/node_modules/@forge/contracts/src/definitions.js +176 -0
- package/node_modules/@forge/contracts/src/identity.js +42 -0
- package/node_modules/@forge/contracts/src/schema.js +72 -0
- package/node_modules/@forge/contracts/src/validate.js +305 -0
- package/node_modules/@forge/flow/index.js +114 -0
- package/node_modules/@forge/flow/package.json +34 -0
- package/node_modules/@forge/flow/src/bounded-loop.js +415 -0
- package/node_modules/@forge/flow/src/efficiency-supervisor.js +89 -0
- package/node_modules/@forge/flow/src/executor.js +279 -0
- package/node_modules/@forge/flow/src/monitor-durability.js +419 -0
- package/node_modules/@forge/flow/src/monitor-runtime.js +460 -0
- package/node_modules/@forge/flow/src/process-lifecycle.js +469 -0
- package/node_modules/@forge/flow/src/skill-runtime.js +343 -0
- package/node_modules/@forge/memory/index.js +331 -0
- package/node_modules/@forge/memory/package.json +34 -0
- package/node_modules/@forge/memory/src/authority-provider.js +67 -0
- package/node_modules/@forge/memory/src/backend-registry.js +166 -0
- package/node_modules/@forge/memory/src/feedback-intake.js +243 -0
- package/node_modules/@forge/memory/src/pr-lifecycle-authority.js +946 -0
- package/node_modules/@forge/memory/src/usage-evidence.js +205 -0
- package/package.json +16 -4
- package/packages/flow/node_modules/@forge/contracts/compatibility-matrix.v1.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/contract-baseline.v1.json +134 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/canonical-hash.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/contract-inputs.v1.json +71 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/feedback-secret-reject.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/identity-conflict.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/malformed-envelope-inputs.v1.json +16 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/malformed-missing-required.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/monitor-bounds-reject.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/monitor-receipt-privacy-reject.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/not-executed-receipt.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/privacy-redaction.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/retry-identical.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/stale-authority-reject.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/structured-error-privacy-reject.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/structured-error-stripe-live-reject.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/structured-error-stripe-test-reject.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/unknown-advisory-roundtrip.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/unknown-consequential-reject.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/valid-full.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/valid-minimal.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/fixtures/v1/wrong-capability-digest.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/index.js +32 -0
- package/packages/flow/node_modules/@forge/contracts/package.json +35 -0
- package/packages/flow/node_modules/@forge/contracts/schemas/v1/capability-manifest.schema.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/schemas/v1/claim-request.schema.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/schemas/v1/context-packet.schema.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/schemas/v1/delivery-receipt.schema.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/schemas/v1/feedback-report.schema.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/schemas/v1/lease-receipt.schema.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/schemas/v1/monitor-event.schema.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/schemas/v1/monitor-receipt.schema.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/schemas/v1/run-receipt.schema.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/schemas/v1/structured-error.schema.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/schemas/v1/work-packet.schema.json +1 -0
- package/packages/flow/node_modules/@forge/contracts/src/baseline.js +23 -0
- package/packages/flow/node_modules/@forge/contracts/src/canonical.js +151 -0
- package/packages/flow/node_modules/@forge/contracts/src/definitions.js +176 -0
- package/packages/flow/node_modules/@forge/contracts/src/identity.js +42 -0
- package/packages/flow/node_modules/@forge/contracts/src/schema.js +72 -0
- package/packages/flow/node_modules/@forge/contracts/src/validate.js +305 -0
- package/packages/memory/node_modules/@forge/contracts/compatibility-matrix.v1.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/contract-baseline.v1.json +134 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/canonical-hash.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/contract-inputs.v1.json +71 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/feedback-secret-reject.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/identity-conflict.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/malformed-envelope-inputs.v1.json +16 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/malformed-missing-required.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/monitor-bounds-reject.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/monitor-receipt-privacy-reject.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/not-executed-receipt.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/privacy-redaction.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/retry-identical.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/stale-authority-reject.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/structured-error-privacy-reject.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/structured-error-stripe-live-reject.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/structured-error-stripe-test-reject.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/unknown-advisory-roundtrip.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/unknown-consequential-reject.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/valid-full.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/valid-minimal.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/fixtures/v1/wrong-capability-digest.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/index.js +32 -0
- package/packages/memory/node_modules/@forge/contracts/package.json +35 -0
- package/packages/memory/node_modules/@forge/contracts/schemas/v1/capability-manifest.schema.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/schemas/v1/claim-request.schema.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/schemas/v1/context-packet.schema.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/schemas/v1/delivery-receipt.schema.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/schemas/v1/feedback-report.schema.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/schemas/v1/lease-receipt.schema.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/schemas/v1/monitor-event.schema.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/schemas/v1/monitor-receipt.schema.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/schemas/v1/run-receipt.schema.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/schemas/v1/structured-error.schema.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/schemas/v1/work-packet.schema.json +1 -0
- package/packages/memory/node_modules/@forge/contracts/src/baseline.js +23 -0
- package/packages/memory/node_modules/@forge/contracts/src/canonical.js +151 -0
- package/packages/memory/node_modules/@forge/contracts/src/definitions.js +176 -0
- package/packages/memory/node_modules/@forge/contracts/src/identity.js +42 -0
- package/packages/memory/node_modules/@forge/contracts/src/schema.js +72 -0
- package/packages/memory/node_modules/@forge/contracts/src/validate.js +305 -0
- package/scripts/commitlint.js +13 -15
- package/scripts/generate-risk-manifest.js +91 -0
- package/scripts/github-context-bridge.sh +10 -0
- package/scripts/legacy-claim-repair.js +145 -0
- package/scripts/lib/behavioral-eval-runtime.js +3 -2
- package/scripts/process-tree.js +14 -2
- package/scripts/protected-state-check.js +440 -17
- package/scripts/sync-agent-skills.js +333 -34
- package/scripts/test-full-suite.js +704 -18
- package/scripts/test-profile.js +13 -3
- package/scripts/test.js +96 -15
- package/skills/coverage.json +1 -0
- package/skills/review/SKILL.md +2 -0
- package/skills/review/evals/scorecard.json +2 -2
- package/skills/setup/SKILL.md +18 -0
- package/skills/setup/evals/scorecard.json +3 -3
- package/skills/shepherd/SKILL.md +19 -2
- package/skills/shepherd/evals/scorecard.json +3 -3
- package/skills/validate/SKILL.md +3 -0
- package/skills/validate/evals/scorecard.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
CONTRACTS,
|
|
5
|
+
EXTENSION_ID_MAX_LENGTH,
|
|
6
|
+
EXTENSION_ID_PATTERN,
|
|
7
|
+
PAYLOAD_FIELDS,
|
|
8
|
+
} = require("./definitions.js");
|
|
9
|
+
|
|
10
|
+
function generateJsonSchema(schemaId) {
|
|
11
|
+
const definition = Object.hasOwn(CONTRACTS, schemaId) ? CONTRACTS[schemaId] : undefined;
|
|
12
|
+
if (!definition) throw new TypeError(`Unsupported schema_id: ${schemaId}`);
|
|
13
|
+
const payloadProperties = {};
|
|
14
|
+
for (const field of [...definition.required, ...definition.optional]) payloadProperties[field] = structuredClone(PAYLOAD_FIELDS[schemaId][field]);
|
|
15
|
+
return {
|
|
16
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
17
|
+
$id: schemaId,
|
|
18
|
+
title: definition.name,
|
|
19
|
+
type: "object",
|
|
20
|
+
required: ["schema_id", "schema_version", "object_id", "created_at", "producer", "capabilities_used", "provenance", "content_hash", "payload", "extensions"],
|
|
21
|
+
properties: {
|
|
22
|
+
schema_id: { const: schemaId },
|
|
23
|
+
schema_version: { const: 1 },
|
|
24
|
+
object_id: { type: "string", format: "uuid" },
|
|
25
|
+
created_at: { type: "string", format: "date-time" },
|
|
26
|
+
producer: {
|
|
27
|
+
type: "object",
|
|
28
|
+
required: ["product_id", "product_version", "instance_id"],
|
|
29
|
+
properties: { product_id: { type: "string", minLength: 1 }, product_version: { type: "string", minLength: 1 }, instance_id: { type: "string", minLength: 1 } },
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
},
|
|
32
|
+
capabilities_used: {
|
|
33
|
+
type: "array",
|
|
34
|
+
items: {
|
|
35
|
+
type: "object",
|
|
36
|
+
required: ["capability_id", "manifest_digest"],
|
|
37
|
+
properties: { capability_id: { type: "string", minLength: 1 }, manifest_digest: { type: "string", pattern: "^[0-9a-f]{64}$" } },
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
provenance: {
|
|
42
|
+
type: "object",
|
|
43
|
+
required: ["source_kind", "actor_class", "actor_id"],
|
|
44
|
+
properties: { source_kind: { type: "string", minLength: 1 }, actor_class: { type: "string", minLength: 1 }, actor_id: { type: "string", minLength: 1 } },
|
|
45
|
+
additionalProperties: false,
|
|
46
|
+
},
|
|
47
|
+
content_hash: { type: "string", pattern: "^[0-9a-f]{64}$" },
|
|
48
|
+
payload: { type: "object", required: definition.required, properties: payloadProperties, additionalProperties: false },
|
|
49
|
+
extensions: {
|
|
50
|
+
type: "object",
|
|
51
|
+
propertyNames: { pattern: EXTENSION_ID_PATTERN, maxLength: EXTENSION_ID_MAX_LENGTH },
|
|
52
|
+
additionalProperties: {
|
|
53
|
+
type: "object",
|
|
54
|
+
required: ["impact", "schema_version", "value"],
|
|
55
|
+
properties: {
|
|
56
|
+
impact: { const: "advisory" },
|
|
57
|
+
schema_version: { type: "integer", minimum: 1 },
|
|
58
|
+
value: {},
|
|
59
|
+
},
|
|
60
|
+
additionalProperties: false,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
additionalProperties: false,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function supportedSchemaVersions(schemaId) {
|
|
69
|
+
return Object.hasOwn(CONTRACTS, schemaId) ? [1] : [];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
module.exports = { generateJsonSchema, supportedSchemaVersions };
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { canonicalize, computeContentHash, preflightCanonicalValue } = require("./canonical.js");
|
|
4
|
+
const {
|
|
5
|
+
CONTRACTS,
|
|
6
|
+
EXTENSION_ID_MAX_LENGTH,
|
|
7
|
+
EXTENSION_ID_PATTERN,
|
|
8
|
+
PAYLOAD_FIELDS,
|
|
9
|
+
} = require("./definitions.js");
|
|
10
|
+
|
|
11
|
+
const ENVELOPE_FIELDS = Object.freeze([
|
|
12
|
+
"schema_id", "schema_version", "object_id", "created_at", "producer",
|
|
13
|
+
"capabilities_used", "provenance", "content_hash", "payload", "extensions",
|
|
14
|
+
]);
|
|
15
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
16
|
+
const SHA256 = /^[0-9a-f]{64}$/;
|
|
17
|
+
const RFC3339_UTC = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/;
|
|
18
|
+
const LIVE_EVIDENCE_FIELDS = Object.freeze({
|
|
19
|
+
"forge.memory.work-packet.v1": ["issueRevision", "workflowConfigRevision", "capabilityManifestDigest", "exactHead"],
|
|
20
|
+
"forge.memory.context-packet.v1": ["workPacketHash", "privacyScopeHash", "redactionPolicyRevision", "allowedDisclosureClasses"],
|
|
21
|
+
"forge.memory.claim-request.v1": ["issueRevision", "actorId"],
|
|
22
|
+
"forge.memory.lease-receipt.v1": ["issueRevision", "actorId", "leaseEpoch", "observedAt"],
|
|
23
|
+
"forge.memory.capability-manifest.v1": ["providerId", "configRevision", "observedAt"],
|
|
24
|
+
"forge.memory.run-receipt.v1": ["packetHash", "workflowConfigRevision", "capabilityManifestDigest", "exactHead"],
|
|
25
|
+
"forge.memory.feedback-report.v1": ["consentEventId", "redactionPolicyRevision"],
|
|
26
|
+
"forge.memory.structured-error.v1": ["parentObjectHash"],
|
|
27
|
+
"forge.memory.monitor-event.v1": ["monitorId", "subjectRevision"],
|
|
28
|
+
"forge.memory.delivery-receipt.v1": ["eventId", "target"],
|
|
29
|
+
"forge.memory.monitor-receipt.v1": ["monitorId", "ownerRunId"],
|
|
30
|
+
});
|
|
31
|
+
const EXTENSION_ID = new RegExp(EXTENSION_ID_PATTERN);
|
|
32
|
+
const SECRET_PATTERN = /(?:gh[pousr]_[A-Za-z0-9]{20,}|sk_(?:live|test)_[A-Za-z0-9]{16,}|sk-[A-Za-z0-9]{16,}|AKIA[0-9A-Z]{16}|(?:api[_-]?key|token|secret|password)\s*[:=]\s*\S{8,})/i;
|
|
33
|
+
const ABSOLUTE_USER_PATH = /(?:[A-Za-z]:\\Users\\[^\\\s]+|\/(?:Users|home)\/[^/\s]+\/)/i;
|
|
34
|
+
const BOUNDED_LIMITS = Object.freeze({ maxDepth: 8, maxItems: 128, maxProperties: 64, maxBytes: 16_384 });
|
|
35
|
+
|
|
36
|
+
function error(errors, path, code) {
|
|
37
|
+
errors.push({ path, code });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function validateEnvelope(value, options = {}) {
|
|
41
|
+
const errors = [];
|
|
42
|
+
try {
|
|
43
|
+
preflightCanonicalValue(value);
|
|
44
|
+
} catch {
|
|
45
|
+
return { ok: false, errors: [{ path: "$", code: "NON_CANONICAL_VALUE" }] };
|
|
46
|
+
}
|
|
47
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
48
|
+
return { ok: false, errors: [{ path: "$", code: "INVALID_ENVELOPE" }] };
|
|
49
|
+
}
|
|
50
|
+
for (const field of ENVELOPE_FIELDS) {
|
|
51
|
+
if (!Object.hasOwn(value, field)) error(errors, `$.${field}`, "MISSING_REQUIRED");
|
|
52
|
+
}
|
|
53
|
+
if (errors.length > 0) return { ok: false, errors };
|
|
54
|
+
if (!Object.hasOwn(CONTRACTS, value.schema_id)) error(errors, "$.schema_id", "UNSUPPORTED_SCHEMA");
|
|
55
|
+
if (value.schema_version !== 1) error(errors, "$.schema_version", "UNSUPPORTED_VERSION");
|
|
56
|
+
if (typeof value.schema_id !== "string" || value.schema_id.length === 0) error(errors, "$.schema_id", "INVALID_TYPE");
|
|
57
|
+
if (!UUID.test(value.object_id)) error(errors, "$.object_id", "INVALID_UUID");
|
|
58
|
+
if (typeof value.created_at !== "string" || !RFC3339_UTC.test(value.created_at) || Number.isNaN(Date.parse(value.created_at))) error(errors, "$.created_at", "INVALID_TIMESTAMP");
|
|
59
|
+
if (!value.producer || typeof value.producer !== "object" || Array.isArray(value.producer)) error(errors, "$.producer", "INVALID_TYPE");
|
|
60
|
+
else for (const field of ["product_id", "product_version", "instance_id"]) if (typeof value.producer[field] !== "string" || value.producer[field].length === 0) error(errors, `$.producer.${field}`, "MISSING_REQUIRED");
|
|
61
|
+
if (!Array.isArray(value.capabilities_used)) error(errors, "$.capabilities_used", "INVALID_TYPE");
|
|
62
|
+
else {
|
|
63
|
+
const keys = value.capabilities_used.map((item) => `${item?.capability_id ?? ""}:${item?.manifest_digest ?? ""}`);
|
|
64
|
+
if (value.capabilities_used.some((item) => !item || typeof item !== "object" || Array.isArray(item) || typeof item.capability_id !== "string" || item.capability_id.length === 0 || !SHA256.test(item.manifest_digest))) {
|
|
65
|
+
error(errors, "$.capabilities_used", "INVALID_CAPABILITY_BINDING");
|
|
66
|
+
}
|
|
67
|
+
if (keys.join("\0") !== [...keys].sort().join("\0")) error(errors, "$.capabilities_used", "NOT_SORTED");
|
|
68
|
+
}
|
|
69
|
+
if (!value.provenance || typeof value.provenance !== "object" || Array.isArray(value.provenance)) error(errors, "$.provenance", "INVALID_TYPE");
|
|
70
|
+
else for (const field of ["source_kind", "actor_class", "actor_id"]) if (typeof value.provenance[field] !== "string" || value.provenance[field].length === 0) error(errors, `$.provenance.${field}`, "MISSING_REQUIRED");
|
|
71
|
+
if (!SHA256.test(value.content_hash)) error(errors, "$.content_hash", "INVALID_CONTENT_HASH");
|
|
72
|
+
if (!value.payload || typeof value.payload !== "object" || Array.isArray(value.payload)) error(errors, "$.payload", "INVALID_TYPE");
|
|
73
|
+
if (!value.extensions || typeof value.extensions !== "object" || Array.isArray(value.extensions)) error(errors, "$.extensions", "INVALID_TYPE");
|
|
74
|
+
if (options.verifyHash !== false && SHA256.test(value.content_hash)) {
|
|
75
|
+
try {
|
|
76
|
+
if (computeContentHash(value) !== value.content_hash) error(errors, "$.content_hash", "CONTENT_HASH_MISMATCH");
|
|
77
|
+
} catch {
|
|
78
|
+
error(errors, "$", "NON_CANONICAL_VALUE");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return { ok: errors.length === 0, errors };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function validateExtensions(extensions, errors) {
|
|
85
|
+
if (!extensions || typeof extensions !== "object" || Array.isArray(extensions)) return;
|
|
86
|
+
for (const [extensionId, extension] of Object.entries(extensions)) {
|
|
87
|
+
const path = `$.extensions[${JSON.stringify(extensionId)}]`;
|
|
88
|
+
if (extensionId.length > EXTENSION_ID_MAX_LENGTH || !EXTENSION_ID.test(extensionId)) error(errors, path, "INVALID_EXTENSION_ID");
|
|
89
|
+
if (!extension || typeof extension !== "object" || Array.isArray(extension)) {
|
|
90
|
+
error(errors, path, "INVALID_EXTENSION");
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (extension.impact === "consequential") error(errors, path, "UNKNOWN_CONSEQUENTIAL_EXTENSION");
|
|
94
|
+
const allowed = new Set(["impact", "schema_version", "value"]);
|
|
95
|
+
const hasExtra = Object.keys(extension).some((field) => !allowed.has(field));
|
|
96
|
+
if (extension.impact !== "advisory" || !Number.isInteger(extension.schema_version) || extension.schema_version < 1 || !Object.hasOwn(extension, "value") || hasExtra) error(errors, path, "INVALID_EXTENSION");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function compare(errors, actual, expected, path, code) {
|
|
101
|
+
if (expected !== undefined && actual !== expected) error(errors, path, code);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function isType(value, type) {
|
|
105
|
+
if (type === "integer") return Number.isInteger(value);
|
|
106
|
+
if (type === "array") return Array.isArray(value);
|
|
107
|
+
if (type === "object") return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
108
|
+
return typeof value === type;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function validateShape(value, shape, path, errors) {
|
|
112
|
+
if (!isType(value, shape.type)) {
|
|
113
|
+
error(errors, path, "INVALID_TYPE");
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (shape.enum && !shape.enum.includes(value)) error(errors, path, "INVALID_ENUM");
|
|
117
|
+
if (shape.minLength !== undefined && value.length < shape.minLength) error(errors, path, "INVALID_LENGTH");
|
|
118
|
+
if (shape.maxLength !== undefined && value.length > shape.maxLength) error(errors, path, "BOUNDED_VALUE_TOO_LARGE");
|
|
119
|
+
if (shape.minimum !== undefined && value < shape.minimum) error(errors, path, "OUT_OF_RANGE");
|
|
120
|
+
if (shape.pattern && !new RegExp(shape.pattern).test(value)) error(errors, path, "INVALID_FORMAT");
|
|
121
|
+
if (shape.not?.pattern && new RegExp(shape.not.pattern, "i").test(value)) error(errors, path, "PRIVACY_PATTERN_REJECTED");
|
|
122
|
+
if (shape.format === "date-time" && (!RFC3339_UTC.test(value) || Number.isNaN(Date.parse(value)))) error(errors, path, "INVALID_TIMESTAMP");
|
|
123
|
+
if (shape.type === "array" && shape.maxItems !== undefined && value.length > shape.maxItems) error(errors, path, "BOUNDED_VALUE_TOO_MANY_ITEMS");
|
|
124
|
+
if (shape.type === "array" && shape.items) value.forEach((item, index) => validateShape(item, shape.items, `${path}[${index}]`, errors));
|
|
125
|
+
if (shape.type === "object") {
|
|
126
|
+
if (shape.maxProperties !== undefined && Object.keys(value).length > shape.maxProperties) error(errors, path, "BOUNDED_VALUE_TOO_MANY_PROPERTIES");
|
|
127
|
+
for (const field of shape.required ?? []) {
|
|
128
|
+
if (!Object.hasOwn(value, field)) error(errors, `${path}.${field}`, "MISSING_REQUIRED");
|
|
129
|
+
}
|
|
130
|
+
for (const [field, fieldShape] of Object.entries(shape.properties ?? {})) {
|
|
131
|
+
if (Object.hasOwn(value, field)) validateShape(value[field], fieldShape, `${path}.${field}`, errors);
|
|
132
|
+
}
|
|
133
|
+
if (shape.additionalProperties === false) {
|
|
134
|
+
const allowed = new Set(Object.keys(shape.properties ?? {}));
|
|
135
|
+
for (const field of Object.keys(value)) if (!allowed.has(field)) error(errors, `${path}.${field}`, "UNKNOWN_FIELD");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function inspectPrivacyString(value, path, errors) {
|
|
141
|
+
if (SECRET_PATTERN.test(value)) error(errors, path, "PRIVACY_SECRET_PATTERN");
|
|
142
|
+
if (ABSOLUTE_USER_PATH.test(value)) error(errors, path, "PRIVACY_ABSOLUTE_PATH");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function inspectBoundedValue(value, path, errors, depth = 0) {
|
|
146
|
+
if (depth > BOUNDED_LIMITS.maxDepth) {
|
|
147
|
+
error(errors, path, "BOUNDED_VALUE_TOO_DEEP");
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (typeof value === "string") {
|
|
151
|
+
inspectPrivacyString(value, path, errors);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (Array.isArray(value)) {
|
|
155
|
+
if (value.length > BOUNDED_LIMITS.maxItems) error(errors, path, "BOUNDED_VALUE_TOO_MANY_ITEMS");
|
|
156
|
+
value.forEach((item, index) => inspectBoundedValue(item, `${path}[${index}]`, errors, depth + 1));
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (!value || typeof value !== "object") return;
|
|
160
|
+
const entries = Object.entries(value);
|
|
161
|
+
if (entries.length > BOUNDED_LIMITS.maxProperties) error(errors, path, "BOUNDED_VALUE_TOO_MANY_PROPERTIES");
|
|
162
|
+
entries.forEach(([field, item]) => inspectBoundedValue(item, `${path}.${field}`, errors, depth + 1));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function validateBoundedPrivacy(value, errors) {
|
|
166
|
+
const targets = [];
|
|
167
|
+
if (value?.schema_id === "forge.memory.feedback-report.v1") {
|
|
168
|
+
targets.push([value.payload?.redacted_reproduction_steps, "$.payload.redacted_reproduction_steps"]);
|
|
169
|
+
if (value.payload?.proposed_fix !== undefined) targets.push([value.payload.proposed_fix, "$.payload.proposed_fix"]);
|
|
170
|
+
if (value.payload?.return_channel !== undefined) targets.push([value.payload.return_channel, "$.payload.return_channel"]);
|
|
171
|
+
} else if (value?.schema_id === "forge.memory.context-packet.v1") {
|
|
172
|
+
if (value.payload?.references !== undefined) targets.push([value.payload.references, "$.payload.references"]);
|
|
173
|
+
if (value.payload?.summaries !== undefined) targets.push([value.payload.summaries, "$.payload.summaries"]);
|
|
174
|
+
} else if (value?.schema_id === "forge.memory.monitor-event.v1" && value.payload?.bounded_payload !== undefined) {
|
|
175
|
+
targets.push([value.payload.bounded_payload, "$.payload.bounded_payload"]);
|
|
176
|
+
} else if (value?.schema_id === "forge.memory.monitor-receipt.v1") {
|
|
177
|
+
targets.push([value.payload?.process_cleanup, "$.payload.process_cleanup"], [value.payload?.lease_cleanup, "$.payload.lease_cleanup"]);
|
|
178
|
+
} else if (value?.schema_id === "forge.memory.structured-error.v1") {
|
|
179
|
+
targets.push([value.payload?.safe_details, "$.payload.safe_details"]);
|
|
180
|
+
} else if (value?.schema_id === "forge.memory.run-receipt.v1") {
|
|
181
|
+
targets.push(
|
|
182
|
+
[value.payload?.validation, "$.payload.validation"],
|
|
183
|
+
[value.payload?.cleanup, "$.payload.cleanup"],
|
|
184
|
+
);
|
|
185
|
+
if (value.payload?.structured_error !== undefined) targets.push([value.payload.structured_error, "$.payload.structured_error"]);
|
|
186
|
+
}
|
|
187
|
+
for (const [target, path] of targets) {
|
|
188
|
+
if (target === undefined) continue;
|
|
189
|
+
inspectBoundedValue(target, path, errors);
|
|
190
|
+
try {
|
|
191
|
+
canonicalize(target, { maxDepth: 64, maxNodes: 100_000, maxBytes: BOUNDED_LIMITS.maxBytes });
|
|
192
|
+
} catch (failure) {
|
|
193
|
+
if (failure.code === "CANONICAL_BYTE_LIMIT") error(errors, path, "BOUNDED_VALUE_TOO_LARGE");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function isStale(expiresAt, observedAt) {
|
|
199
|
+
const expires = Date.parse(expiresAt);
|
|
200
|
+
const observed = Date.parse(observedAt);
|
|
201
|
+
return Number.isNaN(expires) || Number.isNaN(observed) || expires <= observed;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function validateConsequentialEvidence(value, expected, errors) {
|
|
205
|
+
if (!value?.payload) return;
|
|
206
|
+
if (value.schema_id === "forge.memory.run-receipt.v1" && value.payload.status === "NOT_EXECUTED") {
|
|
207
|
+
error(errors, "$.payload.status", "NOT_EXECUTED_NO_TRANSITION");
|
|
208
|
+
}
|
|
209
|
+
const requiredEvidence = LIVE_EVIDENCE_FIELDS[value.schema_id] ?? [];
|
|
210
|
+
for (const field of requiredEvidence) {
|
|
211
|
+
if (!expected || !Object.hasOwn(expected, field)) error(errors, `$.live_expected.${field}`, "MISSING_LIVE_EVIDENCE");
|
|
212
|
+
}
|
|
213
|
+
if (!expected) return;
|
|
214
|
+
const payload = value.payload;
|
|
215
|
+
if (value.schema_id === "forge.memory.work-packet.v1") {
|
|
216
|
+
compare(errors, payload.expected_issue_revision, expected.issueRevision, "$.payload.expected_issue_revision", "STALE_ISSUE_REVISION");
|
|
217
|
+
compare(errors, payload.workflow_config_revision, expected.workflowConfigRevision, "$.payload.workflow_config_revision", "STALE_WORKFLOW_CONFIG");
|
|
218
|
+
compare(errors, payload.capability_manifest_digest, expected.capabilityManifestDigest, "$.payload.capability_manifest_digest", "WRONG_CAPABILITY_DIGEST");
|
|
219
|
+
compare(errors, payload.target_head, expected.exactHead, "$.payload.target_head", "STALE_EXACT_HEAD");
|
|
220
|
+
} else if (value.schema_id === "forge.memory.context-packet.v1") {
|
|
221
|
+
compare(errors, payload.work_packet_hash, expected.workPacketHash, "$.payload.work_packet_hash", "STALE_WORK_PACKET");
|
|
222
|
+
compare(errors, payload.privacy_scope_hash, expected.privacyScopeHash, "$.payload.privacy_scope_hash", "STALE_PRIVACY_SCOPE");
|
|
223
|
+
compare(errors, payload.redaction_policy_revision, expected.redactionPolicyRevision, "$.payload.redaction_policy_revision", "STALE_REDACTION_POLICY");
|
|
224
|
+
if (expected.allowedDisclosureClasses && !expected.allowedDisclosureClasses.includes(payload.disclosure_class)) {
|
|
225
|
+
error(errors, "$.payload.disclosure_class", "DISCLOSURE_NOT_ALLOWED");
|
|
226
|
+
}
|
|
227
|
+
} else if (value.schema_id === "forge.memory.run-receipt.v1") {
|
|
228
|
+
compare(errors, payload.packet_hash, expected.packetHash, "$.payload.packet_hash", "STALE_WORK_PACKET");
|
|
229
|
+
compare(errors, payload.workflow_config_revision, expected.workflowConfigRevision, "$.payload.workflow_config_revision", "STALE_WORKFLOW_CONFIG");
|
|
230
|
+
compare(errors, payload.manifest_digest, expected.capabilityManifestDigest, "$.payload.manifest_digest", "WRONG_CAPABILITY_DIGEST");
|
|
231
|
+
compare(errors, payload.exact_head, expected.exactHead, "$.payload.exact_head", "STALE_EXACT_HEAD");
|
|
232
|
+
compare(errors, payload.lease_epoch, expected.leaseEpoch, "$.payload.lease_epoch", "STALE_LEASE_EPOCH");
|
|
233
|
+
} else if (value.schema_id === "forge.memory.claim-request.v1") {
|
|
234
|
+
compare(errors, payload.expected_issue_revision, expected.issueRevision, "$.payload.expected_issue_revision", "STALE_ISSUE_REVISION");
|
|
235
|
+
compare(errors, payload.actor_id, expected.actorId, "$.payload.actor_id", "STALE_ACTOR");
|
|
236
|
+
} else if (value.schema_id === "forge.memory.lease-receipt.v1") {
|
|
237
|
+
compare(errors, payload.issue_revision, expected.issueRevision, "$.payload.issue_revision", "STALE_ISSUE_REVISION");
|
|
238
|
+
compare(errors, payload.actor_id, expected.actorId, "$.payload.actor_id", "STALE_ACTOR");
|
|
239
|
+
compare(errors, payload.lease_epoch, expected.leaseEpoch, "$.payload.lease_epoch", "STALE_LEASE_EPOCH");
|
|
240
|
+
if (isStale(payload.expires_at, expected.observedAt)) error(errors, "$.payload.expires_at", "STALE_LEASE");
|
|
241
|
+
} else if (value.schema_id === "forge.memory.capability-manifest.v1") {
|
|
242
|
+
compare(errors, payload.provider_id, expected.providerId, "$.payload.provider_id", "STALE_PROVIDER");
|
|
243
|
+
compare(errors, payload.config_revision, expected.configRevision, "$.payload.config_revision", "STALE_CAPABILITY_CONFIG");
|
|
244
|
+
if (isStale(payload.expires_at, expected.observedAt)) error(errors, "$.payload.expires_at", "STALE_CAPABILITY_MANIFEST");
|
|
245
|
+
} else if (value.schema_id === "forge.memory.feedback-report.v1") {
|
|
246
|
+
compare(errors, payload.consent_event_id, expected.consentEventId, "$.payload.consent_event_id", "STALE_CONSENT");
|
|
247
|
+
compare(errors, payload.redaction_policy_revision, expected.redactionPolicyRevision, "$.payload.redaction_policy_revision", "STALE_REDACTION_POLICY");
|
|
248
|
+
} else if (value.schema_id === "forge.memory.structured-error.v1") {
|
|
249
|
+
compare(errors, payload.parent_object_hash, expected.parentObjectHash, "$.payload.parent_object_hash", "STALE_PARENT_OBJECT");
|
|
250
|
+
} else if (value.schema_id === "forge.memory.monitor-event.v1") {
|
|
251
|
+
compare(errors, payload.monitor_id, expected.monitorId, "$.payload.monitor_id", "STALE_MONITOR");
|
|
252
|
+
compare(errors, payload.subject_revision, expected.subjectRevision, "$.payload.subject_revision", "STALE_SUBJECT");
|
|
253
|
+
} else if (value.schema_id === "forge.memory.delivery-receipt.v1") {
|
|
254
|
+
compare(errors, payload.event_id, expected.eventId, "$.payload.event_id", "STALE_EVENT");
|
|
255
|
+
compare(errors, payload.target, expected.target, "$.payload.target", "STALE_DELIVERY_TARGET");
|
|
256
|
+
} else if (value.schema_id === "forge.memory.monitor-receipt.v1") {
|
|
257
|
+
compare(errors, payload.monitor_id, expected.monitorId, "$.payload.monitor_id", "STALE_MONITOR");
|
|
258
|
+
compare(errors, payload.owner_run_id, expected.ownerRunId, "$.payload.owner_run_id", "STALE_OWNER_RUN");
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function validateContractStructure(value, options = {}) {
|
|
263
|
+
const envelope = validateEnvelope(value, options);
|
|
264
|
+
if (envelope.errors.some((item) => item.code === "NON_CANONICAL_VALUE")) return envelope;
|
|
265
|
+
const errors = [...envelope.errors];
|
|
266
|
+
const definition = Object.hasOwn(CONTRACTS, value?.schema_id) ? CONTRACTS[value.schema_id] : undefined;
|
|
267
|
+
if (definition && value?.payload && typeof value.payload === "object" && !Array.isArray(value.payload)) {
|
|
268
|
+
for (const field of definition.required) {
|
|
269
|
+
if (!Object.hasOwn(value.payload, field)) error(errors, `$.payload.${field}`, "MISSING_REQUIRED");
|
|
270
|
+
}
|
|
271
|
+
const allowed = new Set([...definition.required, ...definition.optional]);
|
|
272
|
+
for (const field of Object.keys(value.payload)) {
|
|
273
|
+
if (!allowed.has(field)) error(errors, `$.payload.${field}`, "UNKNOWN_PAYLOAD_FIELD");
|
|
274
|
+
else validateShape(value.payload[field], PAYLOAD_FIELDS[value.schema_id][field], `$.payload.${field}`, errors);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
validateExtensions(value?.extensions, errors);
|
|
278
|
+
if (!errors.some((item) => item.code === "NON_CANONICAL_VALUE")) validateBoundedPrivacy(value, errors);
|
|
279
|
+
return { ok: errors.length === 0, errors };
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function validateContract(value, options = {}) {
|
|
283
|
+
const structural = validateContractStructure(value, options);
|
|
284
|
+
if (structural.errors.some((item) => item.code === "NON_CANONICAL_VALUE")) return structural;
|
|
285
|
+
const errors = [...structural.errors];
|
|
286
|
+
validateConsequentialEvidence(value, options.expected, errors);
|
|
287
|
+
return { ok: errors.length === 0, errors };
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
class ContractValidationError extends Error {
|
|
291
|
+
constructor(errors) {
|
|
292
|
+
super("Contract validation failed");
|
|
293
|
+
this.name = "ContractValidationError";
|
|
294
|
+
this.errors = errors;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function parseContract(json, options = {}) {
|
|
299
|
+
const value = JSON.parse(json);
|
|
300
|
+
const result = validateContract(value, options);
|
|
301
|
+
if (!result.ok) throw new ContractValidationError(result.errors);
|
|
302
|
+
return value;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
module.exports = { ContractValidationError, ENVELOPE_FIELDS, parseContract, validateContract, validateContractStructure, validateEnvelope };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"matrix_version":1,"readers":{"0.1.0-beta.6":{"accepted":{"forge.memory.work-packet.v1":[1],"forge.memory.context-packet.v1":[1],"forge.memory.claim-request.v1":[1],"forge.memory.lease-receipt.v1":[1],"forge.memory.capability-manifest.v1":[1],"forge.memory.run-receipt.v1":[1],"forge.memory.feedback-report.v1":[1],"forge.memory.structured-error.v1":[1],"forge.memory.monitor-event.v1":[1],"forge.memory.delivery-receipt.v1":[1],"forge.memory.monitor-receipt.v1":[1]},"validation_surfaces":{"structural":"no_authority_or_freshness_claim","consequential":"requires_independent_live_expected"},"schema_annotations":{"generic_json_schema_enforces_x_forge":false,"conformance_helper":"validateContractStructure","requirement":"x-forge bounds and privacy annotations require the Forge runtime validator"},"run_receipt_non_authoritative_statuses":["NOT_EXECUTED"],"unknown_advisory":"preserve","unknown_consequential":"reject","unknown_schema_version":"reject"}}}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
{
|
|
2
|
+
"baseline_version": 1,
|
|
3
|
+
"generator_version": "contracts-schema-gen/7",
|
|
4
|
+
"artifacts": [
|
|
5
|
+
{
|
|
6
|
+
"path": "compatibility-matrix.v1.json",
|
|
7
|
+
"sha256": "4ca93d10ae9bff80dd3785bb5ebfc77610cf19e928b9b9ae3f6a1ad9c2fea18e"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"path": "fixtures/v1/canonical-hash.json",
|
|
11
|
+
"sha256": "469c5b83ebe5e02601cd41b83f35f013f8fb4b118b8e213dc1790bb61301dc3c"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"path": "fixtures/v1/contract-inputs.v1.json",
|
|
15
|
+
"sha256": "40f28821f77ea153259a43e0ca8a5d6611f3e5e0ec4e4e47114d4cddeadac3fc"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "fixtures/v1/feedback-secret-reject.json",
|
|
19
|
+
"sha256": "d2a8762a169617a6c98f5654e1d5265732485037e55af107018d139895b47869"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"path": "fixtures/v1/identity-conflict.json",
|
|
23
|
+
"sha256": "c703733d89f8adb079fb0e0ffe01ad35238d9a5f3ae725af54bca8b518fd6039"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"path": "fixtures/v1/malformed-envelope-inputs.v1.json",
|
|
27
|
+
"sha256": "17354a1178523332645f27d506eeabaa39eb6ea6bfa448807f7d0b8d4a1226f2"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "fixtures/v1/malformed-missing-required.json",
|
|
31
|
+
"sha256": "e4031505309e8b172d274ef7c4ef617e71217742ff2b7285f37859db0eea42b9"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"path": "fixtures/v1/monitor-bounds-reject.json",
|
|
35
|
+
"sha256": "36594e37f3707572ec73c60134f24f5fb3ae17a41d804c409fc03a83e9716c26"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"path": "fixtures/v1/monitor-receipt-privacy-reject.json",
|
|
39
|
+
"sha256": "e2c53bc43d727d3583f9f2da6538c127a08997fe279f9e74d585c5b95983b4bf"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "fixtures/v1/not-executed-receipt.json",
|
|
43
|
+
"sha256": "4582002c36cca422ac1ad9a5858558234d5ed162dbe72b36665fe09ab098099f"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"path": "fixtures/v1/privacy-redaction.json",
|
|
47
|
+
"sha256": "be4bae1d68db334875b3d198525dcd46f3efb46dbeea62de03399a915b716e20"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"path": "fixtures/v1/retry-identical.json",
|
|
51
|
+
"sha256": "41c944e15725d45a19bd97015c4bf7fb6ca1a4740426225426bc38799046bd8a"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "fixtures/v1/stale-authority-reject.json",
|
|
55
|
+
"sha256": "700173546cff08486df201316472921d8304ea892c29770b5f199e63c92601b3"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"path": "fixtures/v1/structured-error-privacy-reject.json",
|
|
59
|
+
"sha256": "008186d22ed5048e4926c7b56c08a71802392886425944d0e1a22b10c7433d58"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"path": "fixtures/v1/structured-error-stripe-live-reject.json",
|
|
63
|
+
"sha256": "6e7e0d865ccab874fed66cefd15943bbaf51e4be37bfc99cd38f2e8cd6cafce6"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "fixtures/v1/structured-error-stripe-test-reject.json",
|
|
67
|
+
"sha256": "ab9d748875e4688299a8678a551a2d3f13eb85c6f852ccbaaf102b870b3da82c"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"path": "fixtures/v1/unknown-advisory-roundtrip.json",
|
|
71
|
+
"sha256": "674e1dd9585d86ed7c8851a3d7e2b0ce81427a3dbc59c149409ee87375f9e879"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "fixtures/v1/unknown-consequential-reject.json",
|
|
75
|
+
"sha256": "4228ce85d8f92d6eea61802fd34a410eab778314c70c8315cd1d9c9ba8ef2813"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"path": "fixtures/v1/valid-full.json",
|
|
79
|
+
"sha256": "2ba47dfcd5bc6dc4fae83160b05eeca480b51b065d251a0f531ca2c3effb0397"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"path": "fixtures/v1/valid-minimal.json",
|
|
83
|
+
"sha256": "e7d4e7d5cb11b4de809140d572c6f40a5ed4fc813f0044983930a6fbaab99444"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"path": "fixtures/v1/wrong-capability-digest.json",
|
|
87
|
+
"sha256": "8599acc3eebfba3883ec05e496cfc66e08e79877c8193c24db75540b4549062a"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"path": "schemas/v1/capability-manifest.schema.json",
|
|
91
|
+
"sha256": "8435c1ec9ebfd0f9b9b6d06f490dcfdac4696f002a83692899e1e172f17cd6dd"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"path": "schemas/v1/claim-request.schema.json",
|
|
95
|
+
"sha256": "eb9a6aa46c51550fa5505caeeff6e7773fce128e940fdb85a851cfd13cbf1375"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"path": "schemas/v1/context-packet.schema.json",
|
|
99
|
+
"sha256": "36f422011e03fafe07de5fb16a1e9c745015b4257f640e77f1ae1f4ba70971eb"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"path": "schemas/v1/delivery-receipt.schema.json",
|
|
103
|
+
"sha256": "1e505c9a790d2e5a3ccf1cd227b7a708924f9d92a61c2220964f7cb05a9d8f4c"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"path": "schemas/v1/feedback-report.schema.json",
|
|
107
|
+
"sha256": "6f9f272b831d30574ecf56601307a361544f022c7690fd8077aeae8ca5913e37"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"path": "schemas/v1/lease-receipt.schema.json",
|
|
111
|
+
"sha256": "e7b3c1f6857e4ebad930518236011b8346054b1fa7d38607def4a42c1ba9a739"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"path": "schemas/v1/monitor-event.schema.json",
|
|
115
|
+
"sha256": "df270f5b7e280c10293f2c964727d13baa0488c9e1cc87037ba1307bc76958dc"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"path": "schemas/v1/monitor-receipt.schema.json",
|
|
119
|
+
"sha256": "555dba3db355498a1813bfcf045fe2c3f10057789539918e3303c11191048b33"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"path": "schemas/v1/run-receipt.schema.json",
|
|
123
|
+
"sha256": "de55aca54248a208560fffade7bcfdc555e83daf330f37fe482bb8068495ece6"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"path": "schemas/v1/structured-error.schema.json",
|
|
127
|
+
"sha256": "ea8b6d40528634743efa91a550d27d8191adc8ce95e630356dadce98ba864d64"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"path": "schemas/v1/work-packet.schema.json",
|
|
131
|
+
"sha256": "82f149e5ceedf004a5c129f264d0cb94e6704a7eadae8f02dbd40a62b75a556c"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fixture_id":"canonical-hash","input_ref":{"file":"contract-inputs.v1.json","schema_id":"forge.memory.work-packet.v1"},"operation":"canonical-hash","expected":{"stable_under_key_reordering":true,"content_hash_excluded":true}}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"corpus_version": 1,
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"schema_id": "forge.memory.work-packet.v1", "schema_version": 1, "object_id": "00000000-0000-4000-8000-000000000001", "created_at": "2026-08-09T12:00:00.000Z",
|
|
6
|
+
"producer": { "product_id": "forge-memory", "product_version": "0.1.0-beta.6", "instance_id": "fixture" }, "capabilities_used": [],
|
|
7
|
+
"provenance": { "source_kind": "fixture", "actor_class": "system", "actor_id": "fixture" }, "content_hash": "b5b6527735acceed41f41cb4b7ae778ad8e3d3fd517832c4936e8c632881c10c",
|
|
8
|
+
"payload": { "issue_id": "issue-1", "expected_issue_revision": 1, "packet_id": "packet-1", "packet_revision": 1, "repository_id": "github.com/example/forge", "target_head": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "objective": "fixture objective", "authority": { "kind": "kernel", "issue_revision": 1 }, "allowed_mutations": ["files"], "workflow_config_revision": "config-1", "capability_manifest_digest": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" }, "extensions": {}
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"schema_id": "forge.memory.context-packet.v1", "schema_version": 1, "object_id": "00000000-0000-4000-8000-000000000002", "created_at": "2026-08-09T12:00:00.000Z",
|
|
12
|
+
"producer": { "product_id": "forge-memory", "product_version": "0.1.0-beta.6", "instance_id": "fixture" }, "capabilities_used": [],
|
|
13
|
+
"provenance": { "source_kind": "fixture", "actor_class": "system", "actor_id": "fixture" }, "content_hash": "278663383d458667b71eb25f6bed8c5828445e070b5af2369a46bc2953b34999",
|
|
14
|
+
"payload": { "work_packet_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "context_selection_revision": 1, "privacy_scope_hash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "retention_class": "local_sensitive", "disclosure_class": "remote_redacted", "redaction_policy_revision": "redaction-1", "summaries": [{ "kind": "issue", "text": "redacted fixture" }] }, "extensions": {}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"schema_id": "forge.memory.claim-request.v1", "schema_version": 1, "object_id": "00000000-0000-4000-8000-000000000003", "created_at": "2026-08-09T12:00:00.000Z",
|
|
18
|
+
"producer": { "product_id": "forge-memory", "product_version": "0.1.0-beta.6", "instance_id": "fixture" }, "capabilities_used": [],
|
|
19
|
+
"provenance": { "source_kind": "fixture", "actor_class": "agent", "actor_id": "agent-1" }, "content_hash": "aa1972081945dbfff1b9a800ce139968f6bc8581f19d5f243906181565a665aa",
|
|
20
|
+
"payload": { "issue_id": "issue-1", "expected_issue_revision": 1, "actor_id": "agent-1", "request_id": "request-1", "requested_scope": { "mutations": ["files"] }, "idempotency_key": "claim-1" }, "extensions": {}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"schema_id": "forge.memory.lease-receipt.v1", "schema_version": 1, "object_id": "00000000-0000-4000-8000-000000000004", "created_at": "2026-08-09T12:00:00.000Z",
|
|
24
|
+
"producer": { "product_id": "forge-memory", "product_version": "0.1.0-beta.6", "instance_id": "fixture" }, "capabilities_used": [],
|
|
25
|
+
"provenance": { "source_kind": "kernel", "actor_class": "authority", "actor_id": "kernel" }, "content_hash": "f3fdc336f2da33d69ed4e1e360e455d9903123add962464062d29f373cabe3d0",
|
|
26
|
+
"payload": { "claim_request_id": "request-1", "lease_id": "lease-1", "lease_epoch": 1, "issue_revision": 1, "actor_id": "agent-1", "scope": { "mutations": ["files"] }, "expires_at": "2026-08-09T13:00:00.000Z", "durable": true, "authority_signature": "fixture-signature" }, "extensions": {}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"schema_id": "forge.memory.capability-manifest.v1", "schema_version": 1, "object_id": "00000000-0000-4000-8000-000000000005", "created_at": "2026-08-09T12:00:00.000Z",
|
|
30
|
+
"producer": { "product_id": "forge-flow", "product_version": "0.1.0-beta.6", "instance_id": "fixture" }, "capabilities_used": [],
|
|
31
|
+
"provenance": { "source_kind": "probe", "actor_class": "system", "actor_id": "probe" }, "content_hash": "296ff678e04103e339231fef672db2220f5bd23981fefdc96dcfcd6f338f355e",
|
|
32
|
+
"payload": { "provider_id": "codex", "manifest_revision": 1, "config_revision": "config-1", "executable_identity": { "path_hash": "fixture" }, "provider_version": "1.0.0", "probe_revision": "probe-1", "result_hash": "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd", "capabilities": [{ "capability_id": "flow.execute", "available": true }], "evaluator_status": "approved", "probed_at": "2026-08-09T12:00:00.000Z", "expires_at": "2026-08-09T13:00:00.000Z" }, "extensions": {}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"schema_id": "forge.memory.run-receipt.v1", "schema_version": 1, "object_id": "00000000-0000-4000-8000-000000000006", "created_at": "2026-08-09T12:30:00.000Z",
|
|
36
|
+
"producer": { "product_id": "forge-flow", "product_version": "0.1.0-beta.6", "instance_id": "run-1" }, "capabilities_used": [],
|
|
37
|
+
"provenance": { "source_kind": "execution", "actor_class": "agent", "actor_id": "agent-1" }, "content_hash": "4f919795d2c62ad6520b54fc526c215621ef046a59326f673aa6e41a1f6fc751",
|
|
38
|
+
"payload": { "packet_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "run_id": "run-1", "attempt_id": "attempt-1", "exact_head": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "packet_revision": 1, "manifest_digest": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "workflow_config_revision": "config-1", "status": "PASS", "executor": { "product": "forge-flow" }, "started_at": "2026-08-09T12:00:00.000Z", "ended_at": "2026-08-09T12:30:00.000Z", "evidence_refs": [], "validation": { "status": "PASS" }, "cleanup": { "status": "PASS" } }, "extensions": {}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"schema_id": "forge.memory.feedback-report.v1", "schema_version": 1, "object_id": "00000000-0000-4000-8000-000000000007", "created_at": "2026-08-09T12:00:00.000Z",
|
|
42
|
+
"producer": { "product_id": "forge-memory", "product_version": "0.1.0-beta.6", "instance_id": "fixture" }, "capabilities_used": [],
|
|
43
|
+
"provenance": { "source_kind": "feedback", "actor_class": "anonymous-user", "actor_id": "report-1" }, "content_hash": "3adb5b3f1b726b7b67032bf607ab89e54aee3f9eeefa6d4cdbd29340bee555c1",
|
|
44
|
+
"payload": { "report_id": "report-1", "product_version": "0.1.0-beta.6", "contract_version": 1, "stable_error_code": "FORGE_FIXTURE", "affected_capability": "flow.execute", "redacted_reproduction_steps": ["run fixture"], "expected_classification": "PASS", "actual_classification": "FAIL", "occurrence_count": 1, "content_fingerprint": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "consent_event_id": "consent-1", "redaction_policy_revision": "redaction-1" }, "extensions": {}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"schema_id": "forge.memory.structured-error.v1", "schema_version": 1, "object_id": "00000000-0000-4000-8000-000000000008", "created_at": "2026-08-09T12:00:00.000Z",
|
|
48
|
+
"producer": { "product_id": "forge-memory", "product_version": "0.1.0-beta.6", "instance_id": "fixture" }, "capabilities_used": [],
|
|
49
|
+
"provenance": { "source_kind": "execution", "actor_class": "system", "actor_id": "forge" }, "content_hash": "50d181d71714a308539f5612fee7dfa854a4abe9591981842303de24db64982d",
|
|
50
|
+
"payload": { "parent_object_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "error_occurrence_id": "error-1", "code": "FORGE_FIXTURE", "terminal_classification": "FAIL", "safe_details": { "summary": "fixture failure" } }, "extensions": {}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"schema_id": "forge.memory.monitor-event.v1", "schema_version": 1, "object_id": "00000000-0000-4000-8000-000000000009", "created_at": "2026-08-09T12:00:00.000Z",
|
|
54
|
+
"producer": { "product_id": "forge-flow", "product_version": "0.1.0-beta.6", "instance_id": "monitor-1" }, "capabilities_used": [],
|
|
55
|
+
"provenance": { "source_kind": "monitor", "actor_class": "system", "actor_id": "monitor" }, "content_hash": "01b1e7086a5ba2ddf521ad8e8901db925d9f9e8fe2db75c43ca5eea941d68559",
|
|
56
|
+
"payload": { "monitor_id": "monitor-1", "event_id": "event-1", "sequence": 0, "subject_revision": "head-1", "type": "check.completed", "actionability": "advisory", "observed_at": "2026-08-09T12:00:00.000Z", "bounded_payload": { "status": "PASS" } }, "extensions": {}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"schema_id": "forge.memory.delivery-receipt.v1", "schema_version": 1, "object_id": "00000000-0000-4000-8000-000000000010", "created_at": "2026-08-09T12:00:00.000Z",
|
|
60
|
+
"producer": { "product_id": "forge-flow", "product_version": "0.1.0-beta.6", "instance_id": "delivery-1" }, "capabilities_used": [],
|
|
61
|
+
"provenance": { "source_kind": "delivery", "actor_class": "system", "actor_id": "adapter" }, "content_hash": "0bfe86d8a48be6ac271c92c1e767ec53ce0f7bfc2e228a47832522eefa44b40a",
|
|
62
|
+
"payload": { "event_id": "event-1", "target": "agent-1", "transport_tier": "T1", "attempt": 1, "delivered_at": "2026-08-09T12:00:00.000Z", "acknowledged": true, "outcome": "acknowledged" }, "extensions": {}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"schema_id": "forge.memory.monitor-receipt.v1", "schema_version": 1, "object_id": "00000000-0000-4000-8000-000000000011", "created_at": "2026-08-09T12:00:00.000Z",
|
|
66
|
+
"producer": { "product_id": "forge-flow", "product_version": "0.1.0-beta.6", "instance_id": "monitor-1" }, "capabilities_used": [],
|
|
67
|
+
"provenance": { "source_kind": "monitor", "actor_class": "system", "actor_id": "monitor" }, "content_hash": "01da8754bae5d5a17501a7e20bfc93959e274227add6a31e451424b2c1ac7251",
|
|
68
|
+
"payload": { "monitor_id": "monitor-1", "owner_run_id": "run-1", "terminal_state": "PASS", "terminal_reason": "predicate satisfied", "last_sequence": 0, "evidence_digest": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "cancellation_acknowledged": true, "process_cleanup": { "status": "PASS" }, "lease_cleanup": { "status": "PASS" } }, "extensions": {}
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fixture_id":"feedback-secret-reject","input_ref":{"file":"contract-inputs.v1.json","schema_id":"forge.memory.feedback-report.v1"},"mutation":{"operation":"replace","path":"payload.redacted_reproduction_steps","value":["token=ghp_123456789012345678901234567890"],"rehash":true},"operation":"validate-structure","expected":{"ok":false,"code":"PRIVACY_SECRET_PATTERN"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fixture_id":"identity-conflict","accepted_ref":{"file":"contract-inputs.v1.json","schema_id":"forge.memory.work-packet.v1"},"candidate_ref":{"file":"contract-inputs.v1.json","schema_id":"forge.memory.work-packet.v1"},"candidate_mutation":{"operation":"replace","path":"payload.objective","value":"conflicting objective","rehash":true},"operation":"classify-semantic-attempt","expected":{"status":"identity-conflict"}}
|
package/packages/memory/node_modules/@forge/contracts/fixtures/v1/malformed-envelope-inputs.v1.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"corpus_version": 1,
|
|
3
|
+
"base_input": { "ref": "contract-inputs.v1.json", "schema_id": "forge.memory.work-packet.v1" },
|
|
4
|
+
"cases": [
|
|
5
|
+
{ "missing_field": "schema_id", "operation": "remove", "expected_code": "MISSING_REQUIRED" },
|
|
6
|
+
{ "missing_field": "schema_version", "operation": "remove", "expected_code": "MISSING_REQUIRED" },
|
|
7
|
+
{ "missing_field": "object_id", "operation": "remove", "expected_code": "MISSING_REQUIRED" },
|
|
8
|
+
{ "missing_field": "created_at", "operation": "remove", "expected_code": "MISSING_REQUIRED" },
|
|
9
|
+
{ "missing_field": "producer", "operation": "remove", "expected_code": "MISSING_REQUIRED" },
|
|
10
|
+
{ "missing_field": "capabilities_used", "operation": "remove", "expected_code": "MISSING_REQUIRED" },
|
|
11
|
+
{ "missing_field": "provenance", "operation": "remove", "expected_code": "MISSING_REQUIRED" },
|
|
12
|
+
{ "missing_field": "content_hash", "operation": "remove", "expected_code": "MISSING_REQUIRED" },
|
|
13
|
+
{ "missing_field": "payload", "operation": "remove", "expected_code": "MISSING_REQUIRED" },
|
|
14
|
+
{ "missing_field": "extensions", "operation": "remove", "expected_code": "MISSING_REQUIRED" }
|
|
15
|
+
]
|
|
16
|
+
}
|
package/packages/memory/node_modules/@forge/contracts/fixtures/v1/malformed-missing-required.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fixture_id":"malformed-missing-required","input_ref":{"file":"malformed-envelope-inputs.v1.json"},"operation":"materialize-cases","expected":{"case_count":10,"code":"MISSING_REQUIRED"}}
|