forge-workflow 0.1.0-beta.6 → 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/CHANGELOG.md +12 -0
- package/docs/guides/MIGRATION.md +3 -3
- package/docs/reference/RELEASE.md +3 -3
- package/lib/commands/merge.js +2 -2
- package/lib/commands/push.js +13 -4
- package/lib/commands/shepherd.js +1 -1
- package/lib/commands/validate.js +13 -1
- package/lib/kernel/migrations.js +1 -1
- package/lib/kernel/sqlite-driver.js +1 -1
- package/lib/memory/router.js +1 -1
- package/lib/memory/usage-evidence.js +1 -1
- package/lib/pr-monitor/flow-monitor.js +2 -2
- package/lib/pr-monitor/reconcile-executor.js +1 -1
- package/lib/project-memory.js +1 -1
- package/lib/validation-receipt.js +190 -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 +9 -1
- 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/test.js +1 -1
package/packages/flow/node_modules/@forge/contracts/schemas/v1/capability-manifest.schema.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"forge.memory.capability-manifest.v1","title":"CapabilityManifest","type":"object","required":["schema_id","schema_version","object_id","created_at","producer","capabilities_used","provenance","content_hash","payload","extensions"],"properties":{"schema_id":{"const":"forge.memory.capability-manifest.v1"},"schema_version":{"const":1},"object_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"producer":{"type":"object","required":["product_id","product_version","instance_id"],"properties":{"product_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"instance_id":{"type":"string","minLength":1}},"additionalProperties":false},"capabilities_used":{"type":"array","items":{"type":"object","required":["capability_id","manifest_digest"],"properties":{"capability_id":{"type":"string","minLength":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false}},"provenance":{"type":"object","required":["source_kind","actor_class","actor_id"],"properties":{"source_kind":{"type":"string","minLength":1},"actor_class":{"type":"string","minLength":1},"actor_id":{"type":"string","minLength":1}},"additionalProperties":false},"content_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"payload":{"type":"object","required":["provider_id","manifest_revision","config_revision","executable_identity","provider_version","probe_revision","result_hash","capabilities","evaluator_status","probed_at","expires_at"],"properties":{"provider_id":{"type":"string","minLength":1},"manifest_revision":{"type":"integer","minimum":1},"config_revision":{"type":"string","minLength":1},"executable_identity":{"type":"object"},"provider_version":{"type":"string","minLength":1},"probe_revision":{"type":"string","minLength":1},"result_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"capabilities":{"type":"array","items":{"type":"object","required":["capability_id","available"],"properties":{"capability_id":{"type":"string","minLength":1},"available":{"type":"boolean"}}}},"evaluator_status":{"type":"string","enum":["approved","unavailable","quarantined"]},"probed_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"}},"additionalProperties":false},"extensions":{"type":"object","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$","maxLength":255},"additionalProperties":{"type":"object","required":["impact","schema_version","value"],"properties":{"impact":{"const":"advisory"},"schema_version":{"type":"integer","minimum":1},"value":{}},"additionalProperties":false}}},"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"forge.memory.claim-request.v1","title":"ClaimRequest","type":"object","required":["schema_id","schema_version","object_id","created_at","producer","capabilities_used","provenance","content_hash","payload","extensions"],"properties":{"schema_id":{"const":"forge.memory.claim-request.v1"},"schema_version":{"const":1},"object_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"producer":{"type":"object","required":["product_id","product_version","instance_id"],"properties":{"product_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"instance_id":{"type":"string","minLength":1}},"additionalProperties":false},"capabilities_used":{"type":"array","items":{"type":"object","required":["capability_id","manifest_digest"],"properties":{"capability_id":{"type":"string","minLength":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false}},"provenance":{"type":"object","required":["source_kind","actor_class","actor_id"],"properties":{"source_kind":{"type":"string","minLength":1},"actor_class":{"type":"string","minLength":1},"actor_id":{"type":"string","minLength":1}},"additionalProperties":false},"content_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"payload":{"type":"object","required":["issue_id","expected_issue_revision","actor_id","request_id","requested_scope","idempotency_key"],"properties":{"issue_id":{"type":"string","minLength":1},"expected_issue_revision":{"type":"integer","minimum":0},"actor_id":{"type":"string","minLength":1},"request_id":{"type":"string","minLength":1},"requested_scope":{"type":"object"},"idempotency_key":{"type":"string","minLength":1}},"additionalProperties":false},"extensions":{"type":"object","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$","maxLength":255},"additionalProperties":{"type":"object","required":["impact","schema_version","value"],"properties":{"impact":{"const":"advisory"},"schema_version":{"type":"integer","minimum":1},"value":{}},"additionalProperties":false}}},"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"forge.memory.context-packet.v1","title":"ContextPacket","type":"object","required":["schema_id","schema_version","object_id","created_at","producer","capabilities_used","provenance","content_hash","payload","extensions"],"properties":{"schema_id":{"const":"forge.memory.context-packet.v1"},"schema_version":{"const":1},"object_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"producer":{"type":"object","required":["product_id","product_version","instance_id"],"properties":{"product_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"instance_id":{"type":"string","minLength":1}},"additionalProperties":false},"capabilities_used":{"type":"array","items":{"type":"object","required":["capability_id","manifest_digest"],"properties":{"capability_id":{"type":"string","minLength":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false}},"provenance":{"type":"object","required":["source_kind","actor_class","actor_id"],"properties":{"source_kind":{"type":"string","minLength":1},"actor_class":{"type":"string","minLength":1},"actor_id":{"type":"string","minLength":1}},"additionalProperties":false},"content_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"payload":{"type":"object","required":["work_packet_hash","context_selection_revision","privacy_scope_hash","retention_class","disclosure_class"],"properties":{"work_packet_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"context_selection_revision":{"type":"integer","minimum":1},"privacy_scope_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"retention_class":{"type":"string","enum":["public_metadata","local_sensitive","remote_redacted","restricted"]},"disclosure_class":{"type":"string","enum":["public_metadata","local_sensitive","remote_redacted","restricted"]},"references":{"type":"array","maxItems":128,"items":{"type":"object","maxProperties":64,"x-forge-max-depth":8,"x-forge-max-items":128,"x-forge-max-serialized-bytes":16384,"x-forge-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,})","x-forge-absolute-user-path-pattern":"(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"}},"summaries":{"type":"array","maxItems":128,"items":{"type":"object","maxProperties":64,"x-forge-max-depth":8,"x-forge-max-items":128,"x-forge-max-serialized-bytes":16384,"x-forge-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,})","x-forge-absolute-user-path-pattern":"(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"}},"redaction_policy_revision":{"type":"string","minLength":1}},"additionalProperties":false},"extensions":{"type":"object","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$","maxLength":255},"additionalProperties":{"type":"object","required":["impact","schema_version","value"],"properties":{"impact":{"const":"advisory"},"schema_version":{"type":"integer","minimum":1},"value":{}},"additionalProperties":false}}},"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"forge.memory.delivery-receipt.v1","title":"DeliveryReceipt","type":"object","required":["schema_id","schema_version","object_id","created_at","producer","capabilities_used","provenance","content_hash","payload","extensions"],"properties":{"schema_id":{"const":"forge.memory.delivery-receipt.v1"},"schema_version":{"const":1},"object_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"producer":{"type":"object","required":["product_id","product_version","instance_id"],"properties":{"product_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"instance_id":{"type":"string","minLength":1}},"additionalProperties":false},"capabilities_used":{"type":"array","items":{"type":"object","required":["capability_id","manifest_digest"],"properties":{"capability_id":{"type":"string","minLength":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false}},"provenance":{"type":"object","required":["source_kind","actor_class","actor_id"],"properties":{"source_kind":{"type":"string","minLength":1},"actor_class":{"type":"string","minLength":1},"actor_id":{"type":"string","minLength":1}},"additionalProperties":false},"content_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"payload":{"type":"object","required":["event_id","target","transport_tier","attempt","delivered_at","acknowledged","outcome"],"properties":{"event_id":{"type":"string","minLength":1},"target":{"type":"string","minLength":1},"transport_tier":{"type":"string","enum":["T0","T1","T2","T3","T4"]},"attempt":{"type":"integer","minimum":1},"delivered_at":{"type":"string","format":"date-time"},"acknowledged":{"type":"boolean"},"outcome":{"type":"string","enum":["delivered","pending","failed","acknowledged"]}},"additionalProperties":false},"extensions":{"type":"object","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$","maxLength":255},"additionalProperties":{"type":"object","required":["impact","schema_version","value"],"properties":{"impact":{"const":"advisory"},"schema_version":{"type":"integer","minimum":1},"value":{}},"additionalProperties":false}}},"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"forge.memory.feedback-report.v1","title":"FeedbackReport","type":"object","required":["schema_id","schema_version","object_id","created_at","producer","capabilities_used","provenance","content_hash","payload","extensions"],"properties":{"schema_id":{"const":"forge.memory.feedback-report.v1"},"schema_version":{"const":1},"object_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"producer":{"type":"object","required":["product_id","product_version","instance_id"],"properties":{"product_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"instance_id":{"type":"string","minLength":1}},"additionalProperties":false},"capabilities_used":{"type":"array","items":{"type":"object","required":["capability_id","manifest_digest"],"properties":{"capability_id":{"type":"string","minLength":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false}},"provenance":{"type":"object","required":["source_kind","actor_class","actor_id"],"properties":{"source_kind":{"type":"string","minLength":1},"actor_class":{"type":"string","minLength":1},"actor_id":{"type":"string","minLength":1}},"additionalProperties":false},"content_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"payload":{"type":"object","required":["report_id","product_version","contract_version","stable_error_code","affected_capability","redacted_reproduction_steps","expected_classification","actual_classification","occurrence_count","content_fingerprint","consent_event_id","redaction_policy_revision"],"properties":{"report_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"contract_version":{"type":"integer","minimum":1},"stable_error_code":{"type":"string","minLength":1},"affected_capability":{"type":"string","minLength":1},"redacted_reproduction_steps":{"type":"array","maxItems":64,"items":{"type":"string","minLength":1,"maxLength":4096,"not":{"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,})|(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"}}},"expected_classification":{"type":"string","minLength":1},"actual_classification":{"type":"string","minLength":1},"occurrence_count":{"type":"integer","minimum":1},"content_fingerprint":{"type":"string","pattern":"^[0-9a-f]{64}$"},"consent_event_id":{"type":"string","minLength":1},"redaction_policy_revision":{"type":"string","minLength":1},"proposed_fix":{"type":"string","minLength":1,"maxLength":4096,"not":{"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,})|(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"}},"return_channel":{"type":"object","maxProperties":64,"x-forge-max-depth":8,"x-forge-max-items":128,"x-forge-max-serialized-bytes":16384,"x-forge-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,})","x-forge-absolute-user-path-pattern":"(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"}},"additionalProperties":false},"extensions":{"type":"object","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$","maxLength":255},"additionalProperties":{"type":"object","required":["impact","schema_version","value"],"properties":{"impact":{"const":"advisory"},"schema_version":{"type":"integer","minimum":1},"value":{}},"additionalProperties":false}}},"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"forge.memory.lease-receipt.v1","title":"LeaseReceipt","type":"object","required":["schema_id","schema_version","object_id","created_at","producer","capabilities_used","provenance","content_hash","payload","extensions"],"properties":{"schema_id":{"const":"forge.memory.lease-receipt.v1"},"schema_version":{"const":1},"object_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"producer":{"type":"object","required":["product_id","product_version","instance_id"],"properties":{"product_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"instance_id":{"type":"string","minLength":1}},"additionalProperties":false},"capabilities_used":{"type":"array","items":{"type":"object","required":["capability_id","manifest_digest"],"properties":{"capability_id":{"type":"string","minLength":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false}},"provenance":{"type":"object","required":["source_kind","actor_class","actor_id"],"properties":{"source_kind":{"type":"string","minLength":1},"actor_class":{"type":"string","minLength":1},"actor_id":{"type":"string","minLength":1}},"additionalProperties":false},"content_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"payload":{"type":"object","required":["claim_request_id","lease_id","lease_epoch","issue_revision","actor_id","scope","expires_at","durable","authority_signature"],"properties":{"claim_request_id":{"type":"string","minLength":1},"lease_id":{"type":"string","minLength":1},"lease_epoch":{"type":"integer","minimum":1},"issue_revision":{"type":"integer","minimum":0},"actor_id":{"type":"string","minLength":1},"scope":{"type":"object"},"expires_at":{"type":"string","format":"date-time"},"durable":{"type":"boolean"},"authority_signature":{"type":"string","minLength":1}},"additionalProperties":false},"extensions":{"type":"object","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$","maxLength":255},"additionalProperties":{"type":"object","required":["impact","schema_version","value"],"properties":{"impact":{"const":"advisory"},"schema_version":{"type":"integer","minimum":1},"value":{}},"additionalProperties":false}}},"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"forge.memory.monitor-event.v1","title":"MonitorEvent","type":"object","required":["schema_id","schema_version","object_id","created_at","producer","capabilities_used","provenance","content_hash","payload","extensions"],"properties":{"schema_id":{"const":"forge.memory.monitor-event.v1"},"schema_version":{"const":1},"object_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"producer":{"type":"object","required":["product_id","product_version","instance_id"],"properties":{"product_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"instance_id":{"type":"string","minLength":1}},"additionalProperties":false},"capabilities_used":{"type":"array","items":{"type":"object","required":["capability_id","manifest_digest"],"properties":{"capability_id":{"type":"string","minLength":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false}},"provenance":{"type":"object","required":["source_kind","actor_class","actor_id"],"properties":{"source_kind":{"type":"string","minLength":1},"actor_class":{"type":"string","minLength":1},"actor_id":{"type":"string","minLength":1}},"additionalProperties":false},"content_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"payload":{"type":"object","required":["monitor_id","event_id","sequence","subject_revision","type","actionability","observed_at"],"properties":{"monitor_id":{"type":"string","minLength":1},"event_id":{"type":"string","minLength":1},"sequence":{"type":"integer","minimum":0},"subject_revision":{"type":"string","minLength":1},"type":{"type":"string","minLength":1},"actionability":{"type":"string","enum":["advisory","action_required","terminal"]},"observed_at":{"type":"string","format":"date-time"},"bounded_payload":{"type":"object","maxProperties":64,"x-forge-max-depth":8,"x-forge-max-items":128,"x-forge-max-serialized-bytes":16384,"x-forge-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,})","x-forge-absolute-user-path-pattern":"(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"},"artifact_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false},"extensions":{"type":"object","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$","maxLength":255},"additionalProperties":{"type":"object","required":["impact","schema_version","value"],"properties":{"impact":{"const":"advisory"},"schema_version":{"type":"integer","minimum":1},"value":{}},"additionalProperties":false}}},"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"forge.memory.monitor-receipt.v1","title":"MonitorReceipt","type":"object","required":["schema_id","schema_version","object_id","created_at","producer","capabilities_used","provenance","content_hash","payload","extensions"],"properties":{"schema_id":{"const":"forge.memory.monitor-receipt.v1"},"schema_version":{"const":1},"object_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"producer":{"type":"object","required":["product_id","product_version","instance_id"],"properties":{"product_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"instance_id":{"type":"string","minLength":1}},"additionalProperties":false},"capabilities_used":{"type":"array","items":{"type":"object","required":["capability_id","manifest_digest"],"properties":{"capability_id":{"type":"string","minLength":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false}},"provenance":{"type":"object","required":["source_kind","actor_class","actor_id"],"properties":{"source_kind":{"type":"string","minLength":1},"actor_class":{"type":"string","minLength":1},"actor_id":{"type":"string","minLength":1}},"additionalProperties":false},"content_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"payload":{"type":"object","required":["monitor_id","owner_run_id","terminal_state","terminal_reason","last_sequence","evidence_digest","cancellation_acknowledged","process_cleanup","lease_cleanup"],"properties":{"monitor_id":{"type":"string","minLength":1},"owner_run_id":{"type":"string","minLength":1},"terminal_state":{"type":"string","enum":["PASS","FAIL","INCOMPLETE","CANCELLED"]},"terminal_reason":{"type":"string","minLength":1},"last_sequence":{"type":"integer","minimum":0},"evidence_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"cancellation_acknowledged":{"type":"boolean"},"process_cleanup":{"type":"object","maxProperties":64,"x-forge-max-depth":8,"x-forge-max-items":128,"x-forge-max-serialized-bytes":16384,"x-forge-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,})","x-forge-absolute-user-path-pattern":"(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"},"lease_cleanup":{"type":"object","maxProperties":64,"x-forge-max-depth":8,"x-forge-max-items":128,"x-forge-max-serialized-bytes":16384,"x-forge-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,})","x-forge-absolute-user-path-pattern":"(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"},"undelivered_cursor":{"type":"integer","minimum":0}},"additionalProperties":false},"extensions":{"type":"object","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$","maxLength":255},"additionalProperties":{"type":"object","required":["impact","schema_version","value"],"properties":{"impact":{"const":"advisory"},"schema_version":{"type":"integer","minimum":1},"value":{}},"additionalProperties":false}}},"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"forge.memory.run-receipt.v1","title":"RunReceipt","type":"object","required":["schema_id","schema_version","object_id","created_at","producer","capabilities_used","provenance","content_hash","payload","extensions"],"properties":{"schema_id":{"const":"forge.memory.run-receipt.v1"},"schema_version":{"const":1},"object_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"producer":{"type":"object","required":["product_id","product_version","instance_id"],"properties":{"product_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"instance_id":{"type":"string","minLength":1}},"additionalProperties":false},"capabilities_used":{"type":"array","items":{"type":"object","required":["capability_id","manifest_digest"],"properties":{"capability_id":{"type":"string","minLength":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false}},"provenance":{"type":"object","required":["source_kind","actor_class","actor_id"],"properties":{"source_kind":{"type":"string","minLength":1},"actor_class":{"type":"string","minLength":1},"actor_id":{"type":"string","minLength":1}},"additionalProperties":false},"content_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"payload":{"type":"object","required":["packet_hash","run_id","attempt_id","exact_head","packet_revision","manifest_digest","workflow_config_revision","status","executor","started_at","ended_at","evidence_refs","validation","cleanup"],"properties":{"packet_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"run_id":{"type":"string","minLength":1},"attempt_id":{"type":"string","minLength":1},"exact_head":{"type":"string","pattern":"^[0-9a-f]{40}(?:[0-9a-f]{24})?$"},"packet_revision":{"type":"integer","minimum":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"workflow_config_revision":{"type":"string","minLength":1},"status":{"type":"string","enum":["PASS","FAIL","INCOMPLETE","NOT_EXECUTED"]},"executor":{"type":"object"},"started_at":{"type":"string","format":"date-time"},"ended_at":{"type":"string","format":"date-time"},"evidence_refs":{"type":"array","items":{"type":"object"}},"validation":{"type":"object","maxProperties":64,"x-forge-max-depth":8,"x-forge-max-items":128,"x-forge-max-serialized-bytes":16384,"x-forge-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,})","x-forge-absolute-user-path-pattern":"(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"},"cleanup":{"type":"object","maxProperties":64,"x-forge-max-depth":8,"x-forge-max-items":128,"x-forge-max-serialized-bytes":16384,"x-forge-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,})","x-forge-absolute-user-path-pattern":"(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"},"lease_epoch":{"type":"integer","minimum":1},"tokens":{"type":"object"},"retries":{"type":"integer","minimum":0},"corrections":{"type":"integer","minimum":0},"mutations_attempted":{"type":"array","items":{"type":"string"}},"mutations_authorized":{"type":"array","items":{"type":"string"}},"structured_error":{"type":"object","maxProperties":64,"x-forge-max-depth":8,"x-forge-max-items":128,"x-forge-max-serialized-bytes":16384,"x-forge-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,})","x-forge-absolute-user-path-pattern":"(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"},"active_time_ms":{"type":"integer","minimum":0},"passive_time_ms":{"type":"integer","minimum":0}},"additionalProperties":false},"extensions":{"type":"object","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$","maxLength":255},"additionalProperties":{"type":"object","required":["impact","schema_version","value"],"properties":{"impact":{"const":"advisory"},"schema_version":{"type":"integer","minimum":1},"value":{}},"additionalProperties":false}}},"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"forge.memory.structured-error.v1","title":"StructuredError","type":"object","required":["schema_id","schema_version","object_id","created_at","producer","capabilities_used","provenance","content_hash","payload","extensions"],"properties":{"schema_id":{"const":"forge.memory.structured-error.v1"},"schema_version":{"const":1},"object_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"producer":{"type":"object","required":["product_id","product_version","instance_id"],"properties":{"product_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"instance_id":{"type":"string","minLength":1}},"additionalProperties":false},"capabilities_used":{"type":"array","items":{"type":"object","required":["capability_id","manifest_digest"],"properties":{"capability_id":{"type":"string","minLength":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false}},"provenance":{"type":"object","required":["source_kind","actor_class","actor_id"],"properties":{"source_kind":{"type":"string","minLength":1},"actor_class":{"type":"string","minLength":1},"actor_id":{"type":"string","minLength":1}},"additionalProperties":false},"content_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"payload":{"type":"object","required":["parent_object_hash","error_occurrence_id","code","terminal_classification","safe_details"],"properties":{"parent_object_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"error_occurrence_id":{"type":"string","minLength":1},"code":{"type":"string","minLength":1},"terminal_classification":{"type":"string","enum":["FAIL","INCOMPLETE"]},"safe_details":{"type":"object","maxProperties":64,"x-forge-max-depth":8,"x-forge-max-items":128,"x-forge-max-serialized-bytes":16384,"x-forge-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,})","x-forge-absolute-user-path-pattern":"(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)"},"retryable":{"type":"boolean"},"evidence_refs":{"type":"array","items":{"type":"object"}}},"additionalProperties":false},"extensions":{"type":"object","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$","maxLength":255},"additionalProperties":{"type":"object","required":["impact","schema_version","value"],"properties":{"impact":{"const":"advisory"},"schema_version":{"type":"integer","minimum":1},"value":{}},"additionalProperties":false}}},"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"forge.memory.work-packet.v1","title":"WorkPacket","type":"object","required":["schema_id","schema_version","object_id","created_at","producer","capabilities_used","provenance","content_hash","payload","extensions"],"properties":{"schema_id":{"const":"forge.memory.work-packet.v1"},"schema_version":{"const":1},"object_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"producer":{"type":"object","required":["product_id","product_version","instance_id"],"properties":{"product_id":{"type":"string","minLength":1},"product_version":{"type":"string","minLength":1},"instance_id":{"type":"string","minLength":1}},"additionalProperties":false},"capabilities_used":{"type":"array","items":{"type":"object","required":["capability_id","manifest_digest"],"properties":{"capability_id":{"type":"string","minLength":1},"manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false}},"provenance":{"type":"object","required":["source_kind","actor_class","actor_id"],"properties":{"source_kind":{"type":"string","minLength":1},"actor_class":{"type":"string","minLength":1},"actor_id":{"type":"string","minLength":1}},"additionalProperties":false},"content_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"payload":{"type":"object","required":["issue_id","expected_issue_revision","packet_id","packet_revision","repository_id","target_head","objective","authority","allowed_mutations","workflow_config_revision","capability_manifest_digest"],"properties":{"issue_id":{"type":"string","minLength":1},"expected_issue_revision":{"type":"integer","minimum":0},"packet_id":{"type":"string","minLength":1},"packet_revision":{"type":"integer","minimum":1},"repository_id":{"type":"string","minLength":1},"target_head":{"type":"string","pattern":"^[0-9a-f]{40}(?:[0-9a-f]{24})?$"},"objective":{"type":"string","minLength":1},"authority":{"type":"object","required":["kind","issue_revision"],"properties":{"kind":{"type":"string","minLength":1},"issue_revision":{"type":"integer","minimum":0}}},"allowed_mutations":{"type":"array","items":{"type":"string"}},"workflow_config_revision":{"type":"string","minLength":1},"capability_manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"acceptance_criteria":{"type":"array","items":{"type":"string"}},"prohibited_actions":{"type":"array","items":{"type":"string"}},"dependencies":{"type":"array","items":{"type":"string"}},"constraints":{"type":"object"},"risk":{"type":"object"},"platform":{"type":"object"},"context_references":{"type":"array","items":{"type":"object"}},"expected_outputs":{"type":"array","items":{"type":"string"}},"target":{"type":"object"},"receipt_requirements":{"type":"object"},"idempotency_key":{"type":"string","minLength":1},"token_budget":{"type":"integer","minimum":1},"budget_metric":{"type":"string","enum":["provider_reported_total_tokens"]},"risk_manifest_digest":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"additionalProperties":false},"extensions":{"type":"object","propertyNames":{"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$","maxLength":255},"additionalProperties":{"type":"object","required":["impact","schema_version","value"],"properties":{"impact":{"const":"advisory"},"schema_version":{"type":"integer","minimum":1},"value":{}},"additionalProperties":false}}},"additionalProperties":false}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { createHash } = require("node:crypto");
|
|
4
|
+
const { readFileSync } = require("node:fs");
|
|
5
|
+
const { join } = require("node:path");
|
|
6
|
+
|
|
7
|
+
const PACKAGE_ROOT = join(__dirname, "..");
|
|
8
|
+
|
|
9
|
+
function sha256File(path) {
|
|
10
|
+
return createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function verifyContractBaseline() {
|
|
14
|
+
const baseline = JSON.parse(readFileSync(join(PACKAGE_ROOT, "contract-baseline.v1.json"), "utf8"));
|
|
15
|
+
const mismatches = [];
|
|
16
|
+
for (const entry of baseline.artifacts) {
|
|
17
|
+
const actual = sha256File(join(PACKAGE_ROOT, ...entry.path.split("/")));
|
|
18
|
+
if (actual !== entry.sha256) mismatches.push({ path: entry.path, expected: entry.sha256, actual });
|
|
19
|
+
}
|
|
20
|
+
return { ok: mismatches.length === 0, mismatches };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = { verifyContractBaseline };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { createHash } = require("node:crypto");
|
|
4
|
+
const { types } = require("node:util");
|
|
5
|
+
|
|
6
|
+
const DEFAULT_LIMITS = Object.freeze({ maxDepth: 64, maxNodes: 100_000, maxBytes: 1_048_576 });
|
|
7
|
+
|
|
8
|
+
class CanonicalizationError extends TypeError {
|
|
9
|
+
constructor(code, message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "CanonicalizationError";
|
|
12
|
+
this.code = code;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function fail(code, message) {
|
|
17
|
+
throw new CanonicalizationError(code, message);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function assertUnicode(value) {
|
|
21
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
22
|
+
const code = value.charCodeAt(index);
|
|
23
|
+
if (code >= 0xd800 && code <= 0xdbff) {
|
|
24
|
+
const next = value.charCodeAt(index + 1);
|
|
25
|
+
if (!(next >= 0xdc00 && next <= 0xdfff)) fail("CANONICAL_UNICODE", "Canonical JSON rejects unpaired UTF-16 surrogates");
|
|
26
|
+
index += 1;
|
|
27
|
+
} else if (code >= 0xdc00 && code <= 0xdfff) {
|
|
28
|
+
fail("CANONICAL_UNICODE", "Canonical JSON rejects unpaired UTF-16 surrogates");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function limits(options) {
|
|
34
|
+
const resolved = { ...DEFAULT_LIMITS, ...options };
|
|
35
|
+
for (const field of Object.keys(DEFAULT_LIMITS)) {
|
|
36
|
+
if (!Number.isInteger(resolved[field]) || resolved[field] < 1) fail("CANONICAL_INVALID_LIMIT", `${field} must be a positive integer`);
|
|
37
|
+
}
|
|
38
|
+
return resolved;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function append(state, text) {
|
|
42
|
+
state.bytes += Buffer.byteLength(text, "utf8");
|
|
43
|
+
if (state.bytes > state.limits.maxBytes) fail("CANONICAL_BYTE_LIMIT", "Canonical JSON byte limit exceeded");
|
|
44
|
+
return text;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function enter(state, depth) {
|
|
48
|
+
if (depth > state.limits.maxDepth) fail("CANONICAL_DEPTH_LIMIT", "Canonical JSON depth limit exceeded");
|
|
49
|
+
state.nodes += 1;
|
|
50
|
+
if (state.nodes > state.limits.maxNodes) fail("CANONICAL_NODE_LIMIT", "Canonical JSON node limit exceeded");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function descriptorsForPlainObject(value) {
|
|
54
|
+
if (types.isProxy(value)) fail("CANONICAL_PROXY", "Canonical JSON rejects Proxy inputs");
|
|
55
|
+
if (Object.getPrototypeOf(value) !== Object.prototype) fail("CANONICAL_NON_PLAIN", "Canonical JSON requires plain objects");
|
|
56
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
57
|
+
for (const key of Reflect.ownKeys(descriptors)) {
|
|
58
|
+
if (typeof key === "symbol") fail("CANONICAL_SYMBOL", "Canonical JSON rejects symbol keys");
|
|
59
|
+
const descriptor = descriptors[key];
|
|
60
|
+
if (!Object.hasOwn(descriptor, "value")) fail("CANONICAL_ACCESSOR", "Canonical JSON rejects accessors");
|
|
61
|
+
if (!descriptor.enumerable) fail("CANONICAL_NON_ENUMERABLE", "Canonical JSON rejects non-enumerable data properties");
|
|
62
|
+
assertUnicode(key);
|
|
63
|
+
}
|
|
64
|
+
return descriptors;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function descriptorsForArray(value) {
|
|
68
|
+
if (types.isProxy(value)) fail("CANONICAL_PROXY", "Canonical JSON rejects Proxy inputs");
|
|
69
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
70
|
+
for (const key of Reflect.ownKeys(descriptors)) {
|
|
71
|
+
if (typeof key === "symbol") fail("CANONICAL_SYMBOL", "Canonical JSON rejects symbol keys");
|
|
72
|
+
if (key === "length") continue;
|
|
73
|
+
const index = Number(key);
|
|
74
|
+
if (!Number.isInteger(index) || index < 0 || String(index) !== key || index >= value.length) fail("CANONICAL_ARRAY_PROPERTY", "Canonical JSON arrays cannot have named properties");
|
|
75
|
+
const descriptor = descriptors[key];
|
|
76
|
+
if (!Object.hasOwn(descriptor, "value")) fail("CANONICAL_ACCESSOR", "Canonical JSON rejects accessors");
|
|
77
|
+
if (!descriptor.enumerable) fail("CANONICAL_NON_ENUMERABLE", "Canonical JSON rejects non-enumerable array items");
|
|
78
|
+
}
|
|
79
|
+
return descriptors;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function serialize(value, state, depth) {
|
|
83
|
+
enter(state, depth);
|
|
84
|
+
if (value === null || typeof value === "boolean") return append(state, JSON.stringify(value));
|
|
85
|
+
if (typeof value === "string") {
|
|
86
|
+
assertUnicode(value);
|
|
87
|
+
return append(state, JSON.stringify(value));
|
|
88
|
+
}
|
|
89
|
+
if (typeof value === "number") {
|
|
90
|
+
if (!Number.isFinite(value)) fail("CANONICAL_NUMBER", "Canonical JSON requires finite numbers");
|
|
91
|
+
return append(state, JSON.stringify(value));
|
|
92
|
+
}
|
|
93
|
+
if (!value || typeof value !== "object") fail("CANONICAL_TYPE", `Canonical JSON cannot encode ${typeof value}`);
|
|
94
|
+
if (types.isProxy(value)) fail("CANONICAL_PROXY", "Canonical JSON rejects Proxy inputs");
|
|
95
|
+
if (state.active.has(value)) fail("CANONICAL_CYCLE", "Canonical JSON rejects cyclic values");
|
|
96
|
+
|
|
97
|
+
state.active.add(value);
|
|
98
|
+
try {
|
|
99
|
+
if (Array.isArray(value)) {
|
|
100
|
+
const descriptors = descriptorsForArray(value);
|
|
101
|
+
let output = append(state, "[");
|
|
102
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
103
|
+
const descriptor = descriptors[String(index)];
|
|
104
|
+
if (!descriptor) fail("CANONICAL_SPARSE_ARRAY", "Canonical JSON rejects sparse arrays");
|
|
105
|
+
if (index > 0) output += append(state, ",");
|
|
106
|
+
output += serialize(descriptor.value, state, depth + 1);
|
|
107
|
+
}
|
|
108
|
+
return output + append(state, "]");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const descriptors = descriptorsForPlainObject(value);
|
|
112
|
+
const keys = Object.keys(descriptors).sort();
|
|
113
|
+
let output = append(state, "{");
|
|
114
|
+
keys.forEach((key, index) => {
|
|
115
|
+
if (index > 0) output += append(state, ",");
|
|
116
|
+
output += append(state, JSON.stringify(key));
|
|
117
|
+
output += append(state, ":");
|
|
118
|
+
output += serialize(descriptors[key].value, state, depth + 1);
|
|
119
|
+
});
|
|
120
|
+
return output + append(state, "}");
|
|
121
|
+
} finally {
|
|
122
|
+
state.active.delete(value);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function canonicalize(value, options = {}) {
|
|
127
|
+
const state = { limits: limits(options), nodes: 0, bytes: 0, active: new WeakSet() };
|
|
128
|
+
return serialize(value, state, 0);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function preflightCanonicalValue(value, options = {}) {
|
|
132
|
+
canonicalize(value, options);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function withoutContentHash(value) {
|
|
136
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) fail("CANONICAL_CONTRACT_OBJECT", "Contract object must be a plain JSON object");
|
|
137
|
+
const descriptors = descriptorsForPlainObject(value);
|
|
138
|
+
const copy = {};
|
|
139
|
+
for (const [key, descriptor] of Object.entries(descriptors)) {
|
|
140
|
+
if (key !== "content_hash") copy[key] = descriptor.value;
|
|
141
|
+
}
|
|
142
|
+
return copy;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function computeContentHash(value, options = {}) {
|
|
146
|
+
return createHash("sha256")
|
|
147
|
+
.update(canonicalize(withoutContentHash(value), options), "utf8")
|
|
148
|
+
.digest("hex");
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
module.exports = { CanonicalizationError, canonicalize, computeContentHash, preflightCanonicalValue };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function deepFreeze(value, seen = new WeakSet()) {
|
|
4
|
+
if (!value || typeof value !== "object" || seen.has(value)) return value;
|
|
5
|
+
seen.add(value);
|
|
6
|
+
for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(value))) {
|
|
7
|
+
if (Object.hasOwn(descriptor, "value")) deepFreeze(descriptor.value, seen);
|
|
8
|
+
}
|
|
9
|
+
return Object.freeze(value);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const CONTRACTS = deepFreeze({
|
|
13
|
+
"forge.memory.work-packet.v1": {
|
|
14
|
+
name: "WorkPacket",
|
|
15
|
+
identity: ["issue_id", "expected_issue_revision", "packet_id", "packet_revision", "repository_id", "target_head"],
|
|
16
|
+
required: ["issue_id", "expected_issue_revision", "packet_id", "packet_revision", "repository_id", "target_head", "objective", "authority", "allowed_mutations", "workflow_config_revision", "capability_manifest_digest"],
|
|
17
|
+
optional: ["acceptance_criteria", "prohibited_actions", "dependencies", "constraints", "risk", "platform", "context_references", "expected_outputs", "target", "receipt_requirements", "idempotency_key", "token_budget", "budget_metric", "risk_manifest_digest"],
|
|
18
|
+
},
|
|
19
|
+
"forge.memory.context-packet.v1": {
|
|
20
|
+
name: "ContextPacket",
|
|
21
|
+
identity: ["work_packet_hash", "context_selection_revision", "privacy_scope_hash"],
|
|
22
|
+
required: ["work_packet_hash", "context_selection_revision", "privacy_scope_hash", "retention_class", "disclosure_class"],
|
|
23
|
+
optional: ["references", "summaries", "redaction_policy_revision"],
|
|
24
|
+
},
|
|
25
|
+
"forge.memory.claim-request.v1": {
|
|
26
|
+
name: "ClaimRequest",
|
|
27
|
+
identity: ["issue_id", "expected_issue_revision", "actor_id", "request_id"],
|
|
28
|
+
required: ["issue_id", "expected_issue_revision", "actor_id", "request_id", "requested_scope", "idempotency_key"],
|
|
29
|
+
optional: [],
|
|
30
|
+
},
|
|
31
|
+
"forge.memory.lease-receipt.v1": {
|
|
32
|
+
name: "LeaseReceipt",
|
|
33
|
+
identity: ["claim_request_id", "lease_id", "lease_epoch"],
|
|
34
|
+
required: ["claim_request_id", "lease_id", "lease_epoch", "issue_revision", "actor_id", "scope", "expires_at", "durable", "authority_signature"],
|
|
35
|
+
optional: [],
|
|
36
|
+
},
|
|
37
|
+
"forge.memory.capability-manifest.v1": {
|
|
38
|
+
name: "CapabilityManifest",
|
|
39
|
+
identity: ["provider_id", "manifest_revision", "config_revision"],
|
|
40
|
+
required: ["provider_id", "manifest_revision", "config_revision", "executable_identity", "provider_version", "probe_revision", "result_hash", "capabilities", "evaluator_status", "probed_at", "expires_at"],
|
|
41
|
+
optional: [],
|
|
42
|
+
},
|
|
43
|
+
"forge.memory.run-receipt.v1": {
|
|
44
|
+
name: "RunReceipt",
|
|
45
|
+
identity: ["packet_hash", "run_id", "attempt_id", "exact_head"],
|
|
46
|
+
required: ["packet_hash", "run_id", "attempt_id", "exact_head", "packet_revision", "manifest_digest", "workflow_config_revision", "status", "executor", "started_at", "ended_at", "evidence_refs", "validation", "cleanup"],
|
|
47
|
+
optional: ["lease_epoch", "tokens", "retries", "corrections", "mutations_attempted", "mutations_authorized", "structured_error", "active_time_ms", "passive_time_ms"],
|
|
48
|
+
},
|
|
49
|
+
"forge.memory.feedback-report.v1": {
|
|
50
|
+
name: "FeedbackReport",
|
|
51
|
+
identity: ["report_id", "product_version", "content_fingerprint"],
|
|
52
|
+
required: ["report_id", "product_version", "contract_version", "stable_error_code", "affected_capability", "redacted_reproduction_steps", "expected_classification", "actual_classification", "occurrence_count", "content_fingerprint", "consent_event_id", "redaction_policy_revision"],
|
|
53
|
+
optional: ["proposed_fix", "return_channel"],
|
|
54
|
+
},
|
|
55
|
+
"forge.memory.structured-error.v1": {
|
|
56
|
+
name: "StructuredError",
|
|
57
|
+
identity: ["parent_object_hash", "error_occurrence_id"],
|
|
58
|
+
required: ["parent_object_hash", "error_occurrence_id", "code", "terminal_classification", "safe_details"],
|
|
59
|
+
optional: ["retryable", "evidence_refs"],
|
|
60
|
+
},
|
|
61
|
+
"forge.memory.monitor-event.v1": {
|
|
62
|
+
name: "MonitorEvent",
|
|
63
|
+
identity: ["monitor_id", "event_id", "sequence"],
|
|
64
|
+
required: ["monitor_id", "event_id", "sequence", "subject_revision", "type", "actionability", "observed_at"],
|
|
65
|
+
optional: ["bounded_payload", "artifact_digest"],
|
|
66
|
+
},
|
|
67
|
+
"forge.memory.delivery-receipt.v1": {
|
|
68
|
+
name: "DeliveryReceipt",
|
|
69
|
+
identity: ["event_id", "target", "attempt"],
|
|
70
|
+
required: ["event_id", "target", "transport_tier", "attempt", "delivered_at", "acknowledged", "outcome"],
|
|
71
|
+
optional: [],
|
|
72
|
+
},
|
|
73
|
+
"forge.memory.monitor-receipt.v1": {
|
|
74
|
+
name: "MonitorReceipt",
|
|
75
|
+
identity: ["monitor_id", "owner_run_id", "last_sequence"],
|
|
76
|
+
required: ["monitor_id", "owner_run_id", "terminal_state", "terminal_reason", "last_sequence", "evidence_digest", "cancellation_acknowledged", "process_cleanup", "lease_cleanup"],
|
|
77
|
+
optional: ["undelivered_cursor"],
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const STRING = Object.freeze({ type: "string", minLength: 1 });
|
|
82
|
+
const INTEGER = Object.freeze({ type: "integer", minimum: 0 });
|
|
83
|
+
const POSITIVE_INTEGER = Object.freeze({ type: "integer", minimum: 1 });
|
|
84
|
+
const BOOLEAN = Object.freeze({ type: "boolean" });
|
|
85
|
+
const OBJECT = Object.freeze({ type: "object" });
|
|
86
|
+
const STRING_ARRAY = Object.freeze({ type: "array", items: { type: "string" } });
|
|
87
|
+
const OBJECT_ARRAY = Object.freeze({ type: "array", items: { type: "object" } });
|
|
88
|
+
const HASH = Object.freeze({ type: "string", pattern: "^[0-9a-f]{64}$" });
|
|
89
|
+
const HEAD = Object.freeze({ type: "string", pattern: "^[0-9a-f]{40}(?:[0-9a-f]{24})?$" });
|
|
90
|
+
const TIMESTAMP = Object.freeze({ type: "string", format: "date-time" });
|
|
91
|
+
const EXTENSION_ID_PATTERN = "^[A-Za-z0-9][A-Za-z0-9_-]*(?:[./][A-Za-z0-9][A-Za-z0-9_-]*)+$";
|
|
92
|
+
const EXTENSION_ID_MAX_LENGTH = 255;
|
|
93
|
+
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,})";
|
|
94
|
+
const ABSOLUTE_USER_PATH_PATTERN = "(?:[A-Za-z]:\\\\Users\\\\[^\\\\\\s]+|/(?:Users|home)/[^/\\s]+/)";
|
|
95
|
+
const SAFE_REDACTED_STRING = Object.freeze({ type: "string", minLength: 1, maxLength: 4096, not: { pattern: `${SECRET_PATTERN}|${ABSOLUTE_USER_PATH_PATTERN}` } });
|
|
96
|
+
const SAFE_REDACTED_STEPS = Object.freeze({ type: "array", maxItems: 64, items: SAFE_REDACTED_STRING });
|
|
97
|
+
const BOUNDED_OBJECT = Object.freeze({
|
|
98
|
+
type: "object",
|
|
99
|
+
maxProperties: 64,
|
|
100
|
+
"x-forge-max-depth": 8,
|
|
101
|
+
"x-forge-max-items": 128,
|
|
102
|
+
"x-forge-max-serialized-bytes": 16384,
|
|
103
|
+
"x-forge-secret-pattern": SECRET_PATTERN,
|
|
104
|
+
"x-forge-absolute-user-path-pattern": ABSOLUTE_USER_PATH_PATTERN,
|
|
105
|
+
});
|
|
106
|
+
const BOUNDED_OBJECT_ARRAY = Object.freeze({ type: "array", maxItems: 128, items: BOUNDED_OBJECT });
|
|
107
|
+
|
|
108
|
+
const PAYLOAD_FIELDS = deepFreeze({
|
|
109
|
+
"forge.memory.work-packet.v1": {
|
|
110
|
+
issue_id: STRING, expected_issue_revision: INTEGER, packet_id: STRING, packet_revision: POSITIVE_INTEGER,
|
|
111
|
+
repository_id: STRING, target_head: HEAD, objective: STRING,
|
|
112
|
+
authority: { type: "object", required: ["kind", "issue_revision"], properties: { kind: STRING, issue_revision: INTEGER } },
|
|
113
|
+
allowed_mutations: STRING_ARRAY, workflow_config_revision: STRING, capability_manifest_digest: HASH,
|
|
114
|
+
acceptance_criteria: STRING_ARRAY, prohibited_actions: STRING_ARRAY, dependencies: STRING_ARRAY,
|
|
115
|
+
constraints: OBJECT, risk: OBJECT, platform: OBJECT, context_references: OBJECT_ARRAY,
|
|
116
|
+
expected_outputs: STRING_ARRAY, target: OBJECT, receipt_requirements: OBJECT, idempotency_key: STRING,
|
|
117
|
+
token_budget: POSITIVE_INTEGER, budget_metric: { type: "string", enum: ["provider_reported_total_tokens"] }, risk_manifest_digest: HASH,
|
|
118
|
+
},
|
|
119
|
+
"forge.memory.context-packet.v1": {
|
|
120
|
+
work_packet_hash: HASH, context_selection_revision: POSITIVE_INTEGER, privacy_scope_hash: HASH,
|
|
121
|
+
retention_class: { type: "string", enum: ["public_metadata", "local_sensitive", "remote_redacted", "restricted"] },
|
|
122
|
+
disclosure_class: { type: "string", enum: ["public_metadata", "local_sensitive", "remote_redacted", "restricted"] },
|
|
123
|
+
references: BOUNDED_OBJECT_ARRAY, summaries: BOUNDED_OBJECT_ARRAY, redaction_policy_revision: STRING,
|
|
124
|
+
},
|
|
125
|
+
"forge.memory.claim-request.v1": {
|
|
126
|
+
issue_id: STRING, expected_issue_revision: INTEGER, actor_id: STRING, request_id: STRING,
|
|
127
|
+
requested_scope: OBJECT, idempotency_key: STRING,
|
|
128
|
+
},
|
|
129
|
+
"forge.memory.lease-receipt.v1": {
|
|
130
|
+
claim_request_id: STRING, lease_id: STRING, lease_epoch: POSITIVE_INTEGER, issue_revision: INTEGER,
|
|
131
|
+
actor_id: STRING, scope: OBJECT, expires_at: TIMESTAMP, durable: BOOLEAN, authority_signature: STRING,
|
|
132
|
+
},
|
|
133
|
+
"forge.memory.capability-manifest.v1": {
|
|
134
|
+
provider_id: STRING, manifest_revision: POSITIVE_INTEGER, config_revision: STRING,
|
|
135
|
+
executable_identity: OBJECT, provider_version: STRING, probe_revision: STRING, result_hash: HASH,
|
|
136
|
+
capabilities: { type: "array", items: { type: "object", required: ["capability_id", "available"], properties: { capability_id: STRING, available: BOOLEAN } } },
|
|
137
|
+
evaluator_status: { type: "string", enum: ["approved", "unavailable", "quarantined"] }, probed_at: TIMESTAMP, expires_at: TIMESTAMP,
|
|
138
|
+
},
|
|
139
|
+
"forge.memory.run-receipt.v1": {
|
|
140
|
+
packet_hash: HASH, run_id: STRING, attempt_id: STRING, exact_head: HEAD, packet_revision: POSITIVE_INTEGER,
|
|
141
|
+
manifest_digest: HASH, workflow_config_revision: STRING, status: { type: "string", enum: ["PASS", "FAIL", "INCOMPLETE", "NOT_EXECUTED"] },
|
|
142
|
+
executor: OBJECT, started_at: TIMESTAMP, ended_at: TIMESTAMP, evidence_refs: OBJECT_ARRAY, validation: BOUNDED_OBJECT, cleanup: BOUNDED_OBJECT,
|
|
143
|
+
lease_epoch: POSITIVE_INTEGER, tokens: OBJECT, retries: INTEGER, corrections: INTEGER,
|
|
144
|
+
mutations_attempted: STRING_ARRAY, mutations_authorized: STRING_ARRAY, structured_error: BOUNDED_OBJECT,
|
|
145
|
+
active_time_ms: INTEGER, passive_time_ms: INTEGER,
|
|
146
|
+
},
|
|
147
|
+
"forge.memory.feedback-report.v1": {
|
|
148
|
+
report_id: STRING, product_version: STRING, contract_version: POSITIVE_INTEGER, stable_error_code: STRING,
|
|
149
|
+
affected_capability: STRING, redacted_reproduction_steps: SAFE_REDACTED_STEPS, expected_classification: STRING,
|
|
150
|
+
actual_classification: STRING, occurrence_count: POSITIVE_INTEGER, content_fingerprint: HASH,
|
|
151
|
+
consent_event_id: STRING, redaction_policy_revision: STRING, proposed_fix: SAFE_REDACTED_STRING, return_channel: BOUNDED_OBJECT,
|
|
152
|
+
},
|
|
153
|
+
"forge.memory.structured-error.v1": {
|
|
154
|
+
parent_object_hash: HASH, error_occurrence_id: STRING, code: STRING,
|
|
155
|
+
terminal_classification: { type: "string", enum: ["FAIL", "INCOMPLETE"] }, safe_details: BOUNDED_OBJECT,
|
|
156
|
+
retryable: BOOLEAN, evidence_refs: OBJECT_ARRAY,
|
|
157
|
+
},
|
|
158
|
+
"forge.memory.monitor-event.v1": {
|
|
159
|
+
monitor_id: STRING, event_id: STRING, sequence: INTEGER, subject_revision: STRING, type: STRING,
|
|
160
|
+
actionability: { type: "string", enum: ["advisory", "action_required", "terminal"] }, observed_at: TIMESTAMP,
|
|
161
|
+
bounded_payload: BOUNDED_OBJECT, artifact_digest: HASH,
|
|
162
|
+
},
|
|
163
|
+
"forge.memory.delivery-receipt.v1": {
|
|
164
|
+
event_id: STRING, target: STRING, transport_tier: { type: "string", enum: ["T0", "T1", "T2", "T3", "T4"] },
|
|
165
|
+
attempt: POSITIVE_INTEGER, delivered_at: TIMESTAMP, acknowledged: BOOLEAN,
|
|
166
|
+
outcome: { type: "string", enum: ["delivered", "pending", "failed", "acknowledged"] },
|
|
167
|
+
},
|
|
168
|
+
"forge.memory.monitor-receipt.v1": {
|
|
169
|
+
monitor_id: STRING, owner_run_id: STRING,
|
|
170
|
+
terminal_state: { type: "string", enum: ["PASS", "FAIL", "INCOMPLETE", "CANCELLED"] }, terminal_reason: STRING,
|
|
171
|
+
last_sequence: INTEGER, evidence_digest: HASH, cancellation_acknowledged: BOOLEAN,
|
|
172
|
+
process_cleanup: BOUNDED_OBJECT, lease_cleanup: BOUNDED_OBJECT, undelivered_cursor: INTEGER,
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
module.exports = { CONTRACTS, EXTENSION_ID_MAX_LENGTH, EXTENSION_ID_PATTERN, PAYLOAD_FIELDS };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { canonicalize, computeContentHash } = require("./canonical.js");
|
|
4
|
+
const { CONTRACTS } = require("./definitions.js");
|
|
5
|
+
|
|
6
|
+
function semanticIdentity(value) {
|
|
7
|
+
const definition = CONTRACTS[value?.schema_id];
|
|
8
|
+
if (!definition) throw new TypeError(`Unsupported schema_id: ${value?.schema_id}`);
|
|
9
|
+
const identity = {};
|
|
10
|
+
for (const field of definition.identity) {
|
|
11
|
+
if (!Object.hasOwn(value.payload ?? {}, field)) {
|
|
12
|
+
throw new TypeError(`Semantic identity requires payload.${field}`);
|
|
13
|
+
}
|
|
14
|
+
identity[field] = value.payload[field];
|
|
15
|
+
}
|
|
16
|
+
return `${value.schema_id}:${canonicalize(identity)}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function classifySemanticAttempt(accepted, candidate) {
|
|
20
|
+
const acceptedIdentity = semanticIdentity(accepted);
|
|
21
|
+
const candidateIdentity = semanticIdentity(candidate);
|
|
22
|
+
if (acceptedIdentity !== candidateIdentity) {
|
|
23
|
+
return { status: "new-identity", identity: candidateIdentity };
|
|
24
|
+
}
|
|
25
|
+
const acceptedHash = computeContentHash(accepted);
|
|
26
|
+
const candidateHash = computeContentHash(candidate);
|
|
27
|
+
if (acceptedHash === candidateHash) {
|
|
28
|
+
return {
|
|
29
|
+
status: "retry-identical",
|
|
30
|
+
identity: candidateIdentity,
|
|
31
|
+
content_hash: candidateHash,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
status: "identity-conflict",
|
|
36
|
+
identity: candidateIdentity,
|
|
37
|
+
accepted_hash: acceptedHash,
|
|
38
|
+
candidate_hash: candidateHash,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = { classifySemanticAttempt, semanticIdentity };
|
|
@@ -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 };
|