diff --git a/asyncapi.agent-plane.patch.yaml b/asyncapi.agent-plane.patch.yaml index a3d3cc7..0ef1df9 100644 --- a/asyncapi.agent-plane.patch.yaml +++ b/asyncapi.agent-plane.patch.yaml @@ -152,3 +152,82 @@ channels: type: string description: The `objectId` URN of the ReleaseReceipt. + srcos.v2.artifact.events: + description: Events emitted when shell artifacts are derived, signed, or validated. + bindings: + kafka: + topic: srcos.v2.artifact.events + partitions: 3 + replicas: 3 + topicConfiguration: + retention.ms: 2592000000 + cleanup.policy: delete + publish: + operationId: publishArtifactEvent + summary: Publish an artifact lifecycle event + description: Publishes an event for ArtifactManifest upsert, signing, and validation outcomes. + message: + name: ArtifactEvent + title: Artifact Lifecycle Event + contentType: application/json + payload: { $ref: './schemas/EventEnvelope.json' } + + srcos.v2.annotation.events: + description: Events emitted when annotation exports are recorded. + bindings: + kafka: + topic: srcos.v2.annotation.events + partitions: 3 + replicas: 3 + topicConfiguration: + retention.ms: 604800000 + cleanup.policy: delete + publish: + operationId: publishAnnotationEvent + summary: Publish an annotation export event + description: Publishes an event whenever an AnnotationExport is recorded. + message: + name: AnnotationEvent + title: Annotation Export Event + contentType: application/json + payload: { $ref: './schemas/EventEnvelope.json' } + + srcos.v2.run.events: + description: Events emitted when run reports or Noether diagnostics are recorded. + bindings: + kafka: + topic: srcos.v2.run.events + partitions: 3 + replicas: 3 + topicConfiguration: + retention.ms: 2592000000 + cleanup.policy: delete + publish: + operationId: publishRunEvent + summary: Publish a run/report event + description: Publishes events for RunReport and NoetherDiagnostic objects. + message: + name: RunEvent + title: Run Report Event + contentType: application/json + payload: { $ref: './schemas/EventEnvelope.json' } + + srcos.v2.publish.events: + description: Events emitted when publish decisions or mirror receipts are recorded. + bindings: + kafka: + topic: srcos.v2.publish.events + partitions: 3 + replicas: 3 + topicConfiguration: + retention.ms: 2592000000 + cleanup.policy: delete + publish: + operationId: publishPublishEvent + summary: Publish a publish/mirror event + description: Publishes events for PublishDecision and MirrorReceipt objects. + message: + name: PublishEvent + title: Publish and Mirror Event + contentType: application/json + payload: { $ref: './schemas/EventEnvelope.json' } diff --git a/docs/adr/0002-sourceos-shell-api-event-backlog.md b/docs/adr/0002-sourceos-shell-api-event-backlog.md new file mode 100644 index 0000000..d4be3e9 --- /dev/null +++ b/docs/adr/0002-sourceos-shell-api-event-backlog.md @@ -0,0 +1,24 @@ +# ADR 0002 — sourceos-shell API and event backlog + +## Status +Accepted + +## Context + +The shell/document/provenance workflow now has an initial schema cut, but downstream implementations also need a clear backlog for the API and event surfaces that should be added to OpenAPI and AsyncAPI. + +## Decision + +Queue the following surfaces for future OpenAPI/AsyncAPI additions: + +- artifact sign/validate status +- annotation export +- run-report publication +- publish decisions +- mirror receipts +- Noether diagnostic publication +- search route decisions + +## Consequences + +The schema layer can land incrementally while API/event surfaces are added in follow-on patches without re-defining the objects elsewhere. diff --git a/examples/annotation-export.json b/examples/annotation-export.json new file mode 100644 index 0000000..9f622a7 --- /dev/null +++ b/examples/annotation-export.json @@ -0,0 +1,9 @@ +{ + "exportId": "ann-export-001", + "target": "demo-report", + "format": "w3c-web-annotation", + "annotations": [ + {"id": "ann-1", "type": "Annotation", "body": {"type": "TextualBody", "value": "needs evidence"}} + ], + "exportedAt": "2026-04-18T01:30:00Z" +} diff --git a/examples/mirror-receipt.json b/examples/mirror-receipt.json new file mode 100644 index 0000000..c5150f3 --- /dev/null +++ b/examples/mirror-receipt.json @@ -0,0 +1,8 @@ +{ + "receiptId": "mirror-001", + "artifactId": "demo-report", + "channel": "urbit", + "status": "mirrored", + "mirroredAt": "2026-04-18T01:34:00Z", + "detail": "Mirrored to ship-local Clay cache." +} diff --git a/examples/noether-diagnostic.json b/examples/noether-diagnostic.json new file mode 100644 index 0000000..ced4945 --- /dev/null +++ b/examples/noether-diagnostic.json @@ -0,0 +1,9 @@ +{ + "diagnosticId": "diag-001", + "layer": "h_block_1", + "charge": "angular_momentum", + "value": 0.998, + "measuredAt": "2026-04-18T01:32:00Z", + "tolerance": 0.01, + "pass": true +} diff --git a/examples/publish-decision.json b/examples/publish-decision.json new file mode 100644 index 0000000..9ac815a --- /dev/null +++ b/examples/publish-decision.json @@ -0,0 +1,8 @@ +{ + "decisionId": "pub-001", + "artifactId": "demo-report", + "knowledge": "open", + "value": "restricted", + "ecosystem": "open", + "decidedAt": "2026-04-18T01:33:00Z" +} diff --git a/examples/run-report.json b/examples/run-report.json new file mode 100644 index 0000000..6b37fd2 --- /dev/null +++ b/examples/run-report.json @@ -0,0 +1,7 @@ +{ + "runId": "run-001", + "workflowId": "wf-search-summarize", + "artifacts": ["demo-report", "demo-report.signed.pdf"], + "generatedAt": "2026-04-18T01:31:00Z", + "summary": "Search and summarize run completed successfully." +} diff --git a/openapi.agent-plane.patch.yaml b/openapi.agent-plane.patch.yaml index 5b40cb5..3c729ae 100644 --- a/openapi.agent-plane.patch.yaml +++ b/openapi.agent-plane.patch.yaml @@ -128,3 +128,122 @@ paths: '422': description: Request body is valid JSON but fails schema validation. + /v2/artifacts/manifest: + post: + operationId: upsertArtifactManifest + summary: Upsert an ArtifactManifest + description: Creates or updates a shell/document artifact manifest for a derived artifact such as a PDF. + tags: [Agent Plane] + requestBody: + required: true + content: + application/json: + schema: { $ref: './schemas/ArtifactManifest.json' } + responses: + '200': + description: ArtifactManifest recorded successfully. + + /v2/artifacts/signature: + post: + operationId: recordSignedArtifact + summary: Record a SignedArtifact + description: Persists the signature metadata associated with a signed artifact. + tags: [Agent Plane] + requestBody: + required: true + content: + application/json: + schema: { $ref: './schemas/SignedArtifact.json' } + responses: + '200': + description: SignedArtifact recorded successfully. + + /v2/artifacts/validation: + post: + operationId: recordPdfValidationReport + summary: Record a PdfValidationReport + description: Persists a PDF validation report for an artifact. + tags: [Agent Plane] + requestBody: + required: true + content: + application/json: + schema: { $ref: './schemas/PdfValidationReport.json' } + responses: + '200': + description: PdfValidationReport recorded successfully. + + /v2/annotations/export: + post: + operationId: recordAnnotationExport + summary: Record an AnnotationExport + description: Persists an annotation export from PDF or HTML review surfaces. + tags: [Agent Plane] + requestBody: + required: true + content: + application/json: + schema: { $ref: './schemas/AnnotationExport.json' } + responses: + '200': + description: AnnotationExport recorded successfully. + + /v2/runs/report: + post: + operationId: recordRunReport + summary: Record a RunReport + description: Persists a run report describing workflow artifacts and publication outputs. + tags: [Agent Plane] + requestBody: + required: true + content: + application/json: + schema: { $ref: './schemas/RunReport.json' } + responses: + '200': + description: RunReport recorded successfully. + + /v2/diagnostics/noether: + post: + operationId: recordNoetherDiagnostic + summary: Record a NoetherDiagnostic + description: Persists a Noether diagnostic reading for a model layer or run. + tags: [Agent Plane] + requestBody: + required: true + content: + application/json: + schema: { $ref: './schemas/NoetherDiagnostic.json' } + responses: + '200': + description: NoetherDiagnostic recorded successfully. + + /v2/publish/decisions: + post: + operationId: recordPublishDecision + summary: Record a PublishDecision + description: Persists a publish decision across knowledge, value, and ecosystem openness lanes. + tags: [Agent Plane] + requestBody: + required: true + content: + application/json: + schema: { $ref: './schemas/PublishDecision.json' } + responses: + '200': + description: PublishDecision recorded successfully. + + /v2/mirror/receipts: + post: + operationId: recordMirrorReceipt + summary: Record a MirrorReceipt + description: Persists a receipt for an artifact mirrored to a downstream channel. + tags: [Agent Plane] + requestBody: + required: true + content: + application/json: + schema: { $ref: './schemas/MirrorReceipt.json' } + responses: + '200': + description: MirrorReceipt recorded successfully. diff --git a/schemas/AnnotationExport.json b/schemas/AnnotationExport.json new file mode 100644 index 0000000..f7ce779 --- /dev/null +++ b/schemas/AnnotationExport.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "urn:srcos:schema:AnnotationExport", + "title": "AnnotationExport", + "type": "object", + "required": ["exportId", "target", "format", "annotations"], + "properties": { + "exportId": {"type": "string"}, + "target": {"type": "string"}, + "format": {"type": "string", "enum": ["w3c-web-annotation", "rdf-jsonld"]}, + "annotations": {"type": "array", "items": {"type": "object"}}, + "exportedAt": {"type": ["string", "null"], "format": "date-time"} + }, + "additionalProperties": false +} diff --git a/schemas/MirrorReceipt.json b/schemas/MirrorReceipt.json new file mode 100644 index 0000000..305a844 --- /dev/null +++ b/schemas/MirrorReceipt.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "urn:srcos:schema:MirrorReceipt", + "title": "MirrorReceipt", + "type": "object", + "required": ["receiptId", "artifactId", "channel", "status"], + "properties": { + "receiptId": {"type": "string"}, + "artifactId": {"type": "string"}, + "channel": {"type": "string"}, + "status": {"type": "string"}, + "mirroredAt": {"type": ["string", "null"], "format": "date-time"}, + "detail": {"type": ["string", "null"]} + }, + "additionalProperties": false +} diff --git a/schemas/NoetherDiagnostic.json b/schemas/NoetherDiagnostic.json new file mode 100644 index 0000000..b31732a --- /dev/null +++ b/schemas/NoetherDiagnostic.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "urn:srcos:schema:NoetherDiagnostic", + "title": "NoetherDiagnostic", + "type": "object", + "required": ["diagnosticId", "layer", "charge", "value", "measuredAt"], + "properties": { + "diagnosticId": {"type": "string"}, + "layer": {"type": "string"}, + "charge": {"type": "string"}, + "value": {"type": "number"}, + "measuredAt": {"type": "string", "format": "date-time"}, + "tolerance": {"type": ["number", "null"]}, + "pass": {"type": ["boolean", "null"]} + }, + "additionalProperties": false +} diff --git a/schemas/PublishDecision.json b/schemas/PublishDecision.json new file mode 100644 index 0000000..d2fe1d5 --- /dev/null +++ b/schemas/PublishDecision.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "urn:srcos:schema:PublishDecision", + "title": "PublishDecision", + "type": "object", + "required": ["decisionId", "artifactId", "knowledge", "value", "ecosystem"], + "properties": { + "decisionId": {"type": "string"}, + "artifactId": {"type": "string"}, + "knowledge": {"type": "string", "enum": ["open", "restricted", "sealed"]}, + "value": {"type": "string", "enum": ["open", "restricted", "sealed"]}, + "ecosystem": {"type": "string", "enum": ["open", "restricted", "sealed"]}, + "decidedAt": {"type": ["string", "null"], "format": "date-time"} + }, + "additionalProperties": false +} diff --git a/schemas/RunReport.json b/schemas/RunReport.json new file mode 100644 index 0000000..9f67635 --- /dev/null +++ b/schemas/RunReport.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "urn:srcos:schema:RunReport", + "title": "RunReport", + "type": "object", + "required": ["runId", "workflowId", "artifacts", "generatedAt"], + "properties": { + "runId": {"type": "string"}, + "workflowId": {"type": "string"}, + "artifacts": {"type": "array", "items": {"type": "string"}}, + "generatedAt": {"type": "string", "format": "date-time"}, + "summary": {"type": ["string", "null"]} + }, + "additionalProperties": false +}