mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-27 11:20:42 +01:00
1784 lines
37 KiB
TypeScript
1784 lines
37 KiB
TypeScript
// Generated by scripts/generate-protocol-schema-module.mjs. Do not edit.
|
|
|
|
export const identitySchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/identity.schema.json",
|
|
"title": "PRP identity graph",
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"companyId",
|
|
"issueId",
|
|
"runId",
|
|
"environmentLeaseId",
|
|
"runnerInstanceId",
|
|
"normalizedSessionId",
|
|
"driverSessionId"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.prp.identity.v1"
|
|
},
|
|
"companyId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"issueId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"runId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"environmentLeaseId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"runnerInstanceId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"normalizedSessionId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"driverSessionId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"providerSessionId": {
|
|
"$ref": "#/$defs/stableId"
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"$defs": {
|
|
"stableId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160,
|
|
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
|
|
}
|
|
}
|
|
} as const;
|
|
|
|
export const capabilitiesSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/capabilities.schema.json",
|
|
"title": "PRP negotiated capabilities",
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"sessionReusePolicy",
|
|
"driver",
|
|
"steer",
|
|
"interrupt",
|
|
"resume",
|
|
"runtimeRequests",
|
|
"structuredResult",
|
|
"typedEvents"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.prp.capabilities.v1"
|
|
},
|
|
"sessionReusePolicy": {
|
|
"enum": [
|
|
"new_per_run",
|
|
"reuse_per_issue",
|
|
"reuse_per_workspace"
|
|
]
|
|
},
|
|
"driver": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"version"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 80
|
|
},
|
|
"version": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 80
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"steer": {
|
|
"type": "boolean"
|
|
},
|
|
"interrupt": {
|
|
"type": "boolean"
|
|
},
|
|
"resume": {
|
|
"type": "boolean"
|
|
},
|
|
"runtimeRequests": {
|
|
"type": "boolean"
|
|
},
|
|
"structuredResult": {
|
|
"type": "boolean"
|
|
},
|
|
"typedEvents": {
|
|
"type": "boolean"
|
|
},
|
|
"semanticTools": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"schemaVersion",
|
|
"operations"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.prp.semantic_tools.v1"
|
|
},
|
|
"schemaVersion": {
|
|
"const": 1
|
|
},
|
|
"operations": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"operationId",
|
|
"version",
|
|
"availability",
|
|
"redactionDisposition"
|
|
],
|
|
"properties": {
|
|
"operationId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160,
|
|
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
|
|
},
|
|
"version": {
|
|
"const": 1
|
|
},
|
|
"availability": {
|
|
"enum": [
|
|
"available",
|
|
"denied",
|
|
"unsupported"
|
|
]
|
|
},
|
|
"redactionDisposition": {
|
|
"const": "digest_only"
|
|
},
|
|
"requiredClaims": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"uniqueItems": true
|
|
},
|
|
"reasonCode": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160,
|
|
"pattern": "^[a-z][a-z0-9_.:-]*$"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"unsupported": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"uniqueItems": true
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
} as const;
|
|
|
|
export const commandSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/command.schema.json",
|
|
"title": "PRP runner command",
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"commandId",
|
|
"controllerSeq",
|
|
"type",
|
|
"issuedAt",
|
|
"payload"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.prp.command.v1"
|
|
},
|
|
"commandId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"controllerSeq": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"type": {
|
|
"enum": [
|
|
"run.prepare",
|
|
"run.attach",
|
|
"session.open",
|
|
"turn.start",
|
|
"turn.steer",
|
|
"turn.interrupt",
|
|
"turn.stop",
|
|
"request.resolve",
|
|
"interaction.receipt",
|
|
"semantic_tool.result",
|
|
"session.snapshot",
|
|
"session.close",
|
|
"run.cancel",
|
|
"runner.drain",
|
|
"runner.suspend",
|
|
"runner.shutdown"
|
|
]
|
|
},
|
|
"issuedAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"deadlineAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"precondition": {
|
|
"type": "object",
|
|
"properties": {
|
|
"runnerState": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"runState": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"sessionState": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"activeTurnId": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
} as const;
|
|
|
|
export const workspaceDiffSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json",
|
|
"title": "Paperclip workspace diff",
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"changeSetId",
|
|
"revision",
|
|
"source",
|
|
"complete",
|
|
"files",
|
|
"totals",
|
|
"patchArtifactRef"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.workspace.diff.v1"
|
|
},
|
|
"changeSetId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 200
|
|
},
|
|
"revision": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"source": {
|
|
"enum": [
|
|
"harness_reported",
|
|
"runner_verified"
|
|
]
|
|
},
|
|
"complete": {
|
|
"type": "boolean"
|
|
},
|
|
"files": {
|
|
"type": "array",
|
|
"maxItems": 2000,
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"path",
|
|
"operation",
|
|
"previousPath",
|
|
"additions",
|
|
"deletions",
|
|
"binary",
|
|
"diff"
|
|
],
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 1024,
|
|
"pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
|
|
},
|
|
"operation": {
|
|
"enum": [
|
|
"create",
|
|
"modify",
|
|
"delete",
|
|
"rename",
|
|
"mode_change"
|
|
]
|
|
},
|
|
"previousPath": {
|
|
"oneOf": [
|
|
{
|
|
"type": "null"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 1024,
|
|
"pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
|
|
}
|
|
]
|
|
},
|
|
"additions": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 0
|
|
},
|
|
"deletions": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 0
|
|
},
|
|
"binary": {
|
|
"type": "boolean"
|
|
},
|
|
"diff": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 262144
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"totals": {
|
|
"type": "object",
|
|
"required": [
|
|
"files",
|
|
"additions",
|
|
"deletions"
|
|
],
|
|
"properties": {
|
|
"files": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"additions": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 0
|
|
},
|
|
"deletions": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 0
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"patchArtifactRef": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 2048
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
} as const;
|
|
|
|
export const workspaceFileReferenceSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json",
|
|
"title": "Paperclip workspace file reference",
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"referenceId",
|
|
"source",
|
|
"path",
|
|
"displayName",
|
|
"mediaType",
|
|
"presentation",
|
|
"line",
|
|
"preview",
|
|
"previewTruncated",
|
|
"contentDigest"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.workspace.file_reference.v1"
|
|
},
|
|
"referenceId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 240
|
|
},
|
|
"source": {
|
|
"enum": [
|
|
"harness_reported",
|
|
"runner_verified"
|
|
]
|
|
},
|
|
"path": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 1024,
|
|
"pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
|
|
},
|
|
"displayName": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 255
|
|
},
|
|
"mediaType": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 160
|
|
},
|
|
"presentation": {
|
|
"enum": [
|
|
"document",
|
|
"code",
|
|
"image",
|
|
"generic"
|
|
]
|
|
},
|
|
"line": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 1
|
|
},
|
|
"preview": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 262144
|
|
},
|
|
"previewTruncated": {
|
|
"type": "boolean"
|
|
},
|
|
"contentDigest": {
|
|
"oneOf": [
|
|
{
|
|
"type": "null"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
} as const;
|
|
|
|
export const semanticToolSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json",
|
|
"title": "PRP provider-neutral semantic tool envelope",
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"schemaVersion",
|
|
"phase",
|
|
"operationId",
|
|
"callId",
|
|
"correlation",
|
|
"idempotencyKey",
|
|
"content"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.prp.semantic_tool.v1"
|
|
},
|
|
"schemaVersion": {
|
|
"const": 1
|
|
},
|
|
"phase": {
|
|
"enum": [
|
|
"input",
|
|
"result"
|
|
]
|
|
},
|
|
"operationId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"callId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"correlation": {
|
|
"type": "object",
|
|
"required": [
|
|
"runId",
|
|
"normalizedSessionId",
|
|
"turnId",
|
|
"itemId"
|
|
],
|
|
"properties": {
|
|
"runId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"normalizedSessionId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"turnId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"itemId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"requestId": {
|
|
"$ref": "#/$defs/stableId"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"idempotencyKey": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"minLength": 1,
|
|
"maxLength": 240
|
|
},
|
|
"content": {
|
|
"$ref": "#/$defs/safeContent"
|
|
},
|
|
"outcome": {
|
|
"enum": [
|
|
"succeeded",
|
|
"denied",
|
|
"conflict",
|
|
"duplicate",
|
|
"unavailable",
|
|
"failed"
|
|
]
|
|
},
|
|
"code": {
|
|
"$ref": "#/$defs/stableCode"
|
|
},
|
|
"retryable": {
|
|
"type": "boolean"
|
|
},
|
|
"authorizationBoundary": {
|
|
"enum": [
|
|
"company",
|
|
"actor",
|
|
"active_task",
|
|
"grant",
|
|
"governed_action",
|
|
"lock",
|
|
"revision"
|
|
]
|
|
},
|
|
"operationReceiptId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"auditReceiptId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"currentRevision": {
|
|
"oneOf": [
|
|
{
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
{
|
|
"$ref": "#/$defs/stableId"
|
|
}
|
|
]
|
|
},
|
|
"duplicateOfReceiptId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"artifactRefs": {
|
|
"type": "array",
|
|
"items": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/$defs/safeReference"
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"artifact",
|
|
"work_product"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"uniqueItems": true
|
|
},
|
|
"targets": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/immutableTarget"
|
|
},
|
|
"uniqueItems": true
|
|
},
|
|
"causalRefs": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/safeReference"
|
|
},
|
|
"uniqueItems": true
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"phase": {
|
|
"const": "result"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"required": [
|
|
"outcome",
|
|
"code",
|
|
"retryable",
|
|
"authorizationBoundary",
|
|
"operationReceiptId"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"additionalProperties": true,
|
|
"$defs": {
|
|
"stableId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 240,
|
|
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
|
|
},
|
|
"stableCode": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160,
|
|
"pattern": "^[a-z][a-z0-9_.:-]*$"
|
|
},
|
|
"safeContent": {
|
|
"type": "object",
|
|
"required": [
|
|
"digest",
|
|
"redactionDisposition",
|
|
"references"
|
|
],
|
|
"properties": {
|
|
"digest": {
|
|
"type": "string",
|
|
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
},
|
|
"redactionDisposition": {
|
|
"enum": [
|
|
"digest_only",
|
|
"allowlisted_references",
|
|
"redacted"
|
|
]
|
|
},
|
|
"references": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/safeReference"
|
|
},
|
|
"uniqueItems": true
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"safeReference": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"id"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"task",
|
|
"document_revision",
|
|
"interaction",
|
|
"approval",
|
|
"decision",
|
|
"artifact",
|
|
"work_product",
|
|
"wake",
|
|
"monitor",
|
|
"audit",
|
|
"operation"
|
|
]
|
|
},
|
|
"id": {
|
|
"$ref": "#/$defs/stableId"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"immutableTarget": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"id",
|
|
"immutable"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"document_revision",
|
|
"interaction",
|
|
"approval",
|
|
"decision"
|
|
]
|
|
},
|
|
"id": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"immutable": {
|
|
"const": true
|
|
},
|
|
"revisionId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"decisionId": {
|
|
"$ref": "#/$defs/stableId"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
}
|
|
} as const;
|
|
|
|
export const stopReasonSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/stop-reason.schema.json",
|
|
"title": "PRP terminal stop reason receipt",
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"schemaVersion",
|
|
"receiptId",
|
|
"kind",
|
|
"code",
|
|
"retryable",
|
|
"decisionId",
|
|
"limitClass",
|
|
"aggregate"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.prp.stop_reason.v1"
|
|
},
|
|
"schemaVersion": {
|
|
"const": 1
|
|
},
|
|
"receiptId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"kind": {
|
|
"enum": [
|
|
"budget",
|
|
"cost"
|
|
]
|
|
},
|
|
"code": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160,
|
|
"pattern": "^[a-z][a-z0-9_.:-]*$"
|
|
},
|
|
"retryable": {
|
|
"type": "boolean"
|
|
},
|
|
"decisionId": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"limitClass": {
|
|
"enum": [
|
|
"company_monthly",
|
|
"actor_monthly",
|
|
"project_monthly",
|
|
"run_cost",
|
|
"provider_quota"
|
|
]
|
|
},
|
|
"aggregate": {
|
|
"type": "object",
|
|
"required": [
|
|
"unit",
|
|
"observed",
|
|
"limit",
|
|
"window"
|
|
],
|
|
"properties": {
|
|
"unit": {
|
|
"enum": [
|
|
"cents",
|
|
"usd_micros",
|
|
"tokens"
|
|
]
|
|
},
|
|
"observed": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"limit": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"window": {
|
|
"enum": [
|
|
"run",
|
|
"monthly_utc",
|
|
"provider_window"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"relatedReceiptIds": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/stableId"
|
|
},
|
|
"uniqueItems": true
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"$defs": {
|
|
"stableId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 240,
|
|
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
|
|
}
|
|
}
|
|
} as const;
|
|
|
|
export const terminalSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/terminal.schema.json",
|
|
"title": "PRP run terminal state",
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"turnTerminalState",
|
|
"runTerminalState",
|
|
"reportedWorkDisposition"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.prp.terminal.v1"
|
|
},
|
|
"turnTerminalState": {
|
|
"enum": [
|
|
"completed",
|
|
"failed",
|
|
"interrupted",
|
|
"cancelled"
|
|
]
|
|
},
|
|
"runTerminalState": {
|
|
"enum": [
|
|
"succeeded",
|
|
"failed",
|
|
"cancelled"
|
|
]
|
|
},
|
|
"reportedWorkDisposition": {
|
|
"enum": [
|
|
"done",
|
|
"blocked",
|
|
"needs_review",
|
|
"yielded"
|
|
]
|
|
},
|
|
"workAssessmentId": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"statusDecisionId": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"stopReason": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/stop-reason.schema.json"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
} as const;
|
|
|
|
export const requestSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/request.schema.json",
|
|
"title": "PRP request",
|
|
"oneOf": [
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"requestKind",
|
|
"requestId",
|
|
"type",
|
|
"status",
|
|
"prompt"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.runtime_request.v1"
|
|
},
|
|
"requestKind": {
|
|
"const": "runtime"
|
|
},
|
|
"requestId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"type": {
|
|
"enum": [
|
|
"permission",
|
|
"input"
|
|
]
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"pending",
|
|
"resolved",
|
|
"expired",
|
|
"cancelled"
|
|
]
|
|
},
|
|
"prompt": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 4000
|
|
},
|
|
"choices": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"key",
|
|
"label"
|
|
],
|
|
"properties": {
|
|
"key": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"label": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
{
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"requestKind",
|
|
"requestId",
|
|
"kind",
|
|
"blocking",
|
|
"payload"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.interaction_request.v1"
|
|
},
|
|
"requestKind": {
|
|
"const": "issue_thread"
|
|
},
|
|
"requestId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"kind": {
|
|
"enum": [
|
|
"request_confirmation",
|
|
"request_checkbox_confirmation",
|
|
"request_item_verdicts",
|
|
"ask_user_questions",
|
|
"suggest_tasks"
|
|
]
|
|
},
|
|
"blocking": {
|
|
"type": "boolean"
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
]
|
|
} as const;
|
|
|
|
export const resultSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/result.schema.json",
|
|
"title": "PRP structured run result",
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"reportedWorkDisposition",
|
|
"summary",
|
|
"completionClaim",
|
|
"evidence",
|
|
"verification",
|
|
"attentionRequests",
|
|
"artifacts"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.run_result.v1"
|
|
},
|
|
"reportedWorkDisposition": {
|
|
"enum": [
|
|
"done",
|
|
"blocked",
|
|
"needs_review",
|
|
"yielded"
|
|
]
|
|
},
|
|
"summary": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 12000
|
|
},
|
|
"completionClaim": {
|
|
"type": "object",
|
|
"required": [
|
|
"contractRevision",
|
|
"objectiveSatisfied",
|
|
"criteria",
|
|
"remainingWork"
|
|
],
|
|
"properties": {
|
|
"contractRevision": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"objectiveSatisfied": {
|
|
"type": "boolean"
|
|
},
|
|
"criteria": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"criterionId",
|
|
"status",
|
|
"evidenceRefs"
|
|
],
|
|
"properties": {
|
|
"criterionId": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"satisfied",
|
|
"not_satisfied",
|
|
"unknown"
|
|
]
|
|
},
|
|
"evidenceRefs": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"explanation": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"remainingWork": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"description",
|
|
"blocksCompletion"
|
|
],
|
|
"properties": {
|
|
"description": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"blocksCompletion": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"evidence": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"verification": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"commandOrCheck",
|
|
"status"
|
|
],
|
|
"properties": {
|
|
"commandOrCheck": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"passed",
|
|
"failed",
|
|
"not_run"
|
|
]
|
|
},
|
|
"detail": {
|
|
"type": "string"
|
|
},
|
|
"artifactRef": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"blocker": {
|
|
"type": "object",
|
|
"required": [
|
|
"reasonCode",
|
|
"owner",
|
|
"unblockAction",
|
|
"scope"
|
|
],
|
|
"properties": {
|
|
"reasonCode": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"owner": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
},
|
|
"unblockAction": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"scope": {
|
|
"enum": [
|
|
"current_track",
|
|
"task_wide"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"attentionRequests": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"artifacts": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"ref"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"ref": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"continuation": {
|
|
"type": "object",
|
|
"required": [
|
|
"kind",
|
|
"summary",
|
|
"idempotencyKey"
|
|
],
|
|
"properties": {
|
|
"kind": {
|
|
"enum": [
|
|
"same_agent",
|
|
"retry",
|
|
"delegated_issue",
|
|
"response_wake",
|
|
"monitor"
|
|
]
|
|
},
|
|
"summary": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"idempotencyKey": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"reportedWorkDisposition": {
|
|
"const": "blocked"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"required": [
|
|
"blocker"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"reportedWorkDisposition": {
|
|
"const": "yielded"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"required": [
|
|
"continuation"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"additionalProperties": true
|
|
} as const;
|
|
|
|
export const eventSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/event.schema.json",
|
|
"title": "PRP native event",
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"sourceEventId",
|
|
"sourceSeq",
|
|
"sourceInstanceId",
|
|
"sourceKind",
|
|
"runId",
|
|
"eventType",
|
|
"schemaVersion",
|
|
"priority",
|
|
"emittedAt",
|
|
"payload"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.prp.event.v1"
|
|
},
|
|
"sourceEventId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"sourceSeq": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"sourceInstanceId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"sourceKind": {
|
|
"enum": [
|
|
"runner",
|
|
"control_plane"
|
|
]
|
|
},
|
|
"runId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"normalizedSessionId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"turnId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"itemId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"eventType": {
|
|
"enum": [
|
|
"runner.connected",
|
|
"runner.reconnected",
|
|
"runner.reconciled",
|
|
"runner.disconnected",
|
|
"runner.draining",
|
|
"runner.suspending",
|
|
"runner.suspended",
|
|
"runner.stopped",
|
|
"runner.diagnostic",
|
|
"runtime.phase.changed",
|
|
"sandbox.metric",
|
|
"workspace.ready",
|
|
"workspace.change.updated",
|
|
"workspace.diff.recorded",
|
|
"workspace.file.referenced",
|
|
"harness.starting",
|
|
"harness.ready",
|
|
"harness.exited",
|
|
"harness.diagnostic",
|
|
"session.starting",
|
|
"session.started",
|
|
"session.resuming",
|
|
"session.resumed",
|
|
"session.reconciled",
|
|
"session.closed",
|
|
"session.failed",
|
|
"turn.submitted",
|
|
"turn.accepted",
|
|
"turn.started",
|
|
"turn.completed",
|
|
"turn.failed",
|
|
"turn.interrupted",
|
|
"turn.cancelled",
|
|
"item.started",
|
|
"item.delta",
|
|
"item.completed",
|
|
"item.failed",
|
|
"mcp_app.discovered",
|
|
"mcp_app.resource.resolved",
|
|
"mcp_app.initializing",
|
|
"mcp_app.ready",
|
|
"mcp_app.tool_input",
|
|
"mcp_app.tool_result",
|
|
"mcp_app.action.requested",
|
|
"mcp_app.action.resolved",
|
|
"mcp_app.host_context.changed",
|
|
"mcp_app.failed",
|
|
"mcp_app.teardown",
|
|
"runtime_request.created",
|
|
"runtime_request.resolved",
|
|
"runtime_request.expired",
|
|
"runtime_request.cancelled",
|
|
"interaction.request.proposed",
|
|
"interaction.request.materialized",
|
|
"interaction.request.rejected",
|
|
"interaction.response.progressed",
|
|
"interaction.response.resolved",
|
|
"interaction.response.delivered",
|
|
"run.attached",
|
|
"run.detached",
|
|
"run.result.proposed",
|
|
"run.result.accepted",
|
|
"run.result.rejected",
|
|
"attention.request.proposed",
|
|
"attention.request.routed",
|
|
"attention.request.resolved",
|
|
"attention.request.expired",
|
|
"attention.request.superseded",
|
|
"work.assessment.recorded",
|
|
"issue.status.decision.recorded",
|
|
"issue.status.decision.applied",
|
|
"issue.status.decision.rejected",
|
|
"issue.status.decision.superseded",
|
|
"run.terminal"
|
|
]
|
|
},
|
|
"schemaVersion": {
|
|
"const": 1
|
|
},
|
|
"priority": {
|
|
"enum": [
|
|
0,
|
|
1,
|
|
2
|
|
]
|
|
},
|
|
"emittedAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"observedAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"properties": {
|
|
"channel": {
|
|
"enum": [
|
|
"progress",
|
|
"final",
|
|
"summary",
|
|
"detail",
|
|
"unknown"
|
|
]
|
|
},
|
|
"providerPhase": {
|
|
"type": "string"
|
|
},
|
|
"providerMethod": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"debug": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "workspace.file.referenced"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"enum": [
|
|
"workspace.change.updated",
|
|
"workspace.diff.recorded"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "workspace.diff.recorded"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json"
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"complete": {
|
|
"const": true
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "mcp_app.tool_input"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"type": "object",
|
|
"properties": {
|
|
"semantic_tool": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json"
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"phase": {
|
|
"const": "input"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "mcp_app.tool_result"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"type": "object",
|
|
"properties": {
|
|
"semantic_tool": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json"
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"phase": {
|
|
"const": "result"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "run.terminal"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/terminal.schema.json"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "run.result.proposed"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/result.schema.json"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"additionalProperties": true
|
|
} as const;
|
|
|
|
export const fixtureSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/fixture.schema.json",
|
|
"title": "PRP scripted replay fixture",
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"fixtureVersion",
|
|
"protocolVersion",
|
|
"name",
|
|
"description",
|
|
"identity",
|
|
"capabilities",
|
|
"commands",
|
|
"events",
|
|
"result"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.prp.fixture.v1"
|
|
},
|
|
"fixtureVersion": {
|
|
"const": 1
|
|
},
|
|
"protocolVersion": {
|
|
"const": 1
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 120
|
|
},
|
|
"description": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 1000
|
|
},
|
|
"identity": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/identity.schema.json"
|
|
},
|
|
"capabilities": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/capabilities.schema.json"
|
|
},
|
|
"commands": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/command.schema.json"
|
|
}
|
|
},
|
|
"events": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"items": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/event.schema.json"
|
|
}
|
|
},
|
|
"requests": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/request.schema.json"
|
|
}
|
|
},
|
|
"result": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/result.schema.json"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
} as const;
|
|
|
|
export const prpSchemaBundle = {
|
|
"identity": identitySchema,
|
|
"capabilities": capabilitiesSchema,
|
|
"command": commandSchema,
|
|
"workspace-diff": workspaceDiffSchema,
|
|
"workspace-file-reference": workspaceFileReferenceSchema,
|
|
"semantic-tool": semanticToolSchema,
|
|
"stop-reason": stopReasonSchema,
|
|
"terminal": terminalSchema,
|
|
"request": requestSchema,
|
|
"result": resultSchema,
|
|
"event": eventSchema,
|
|
"fixture": fixtureSchema,
|
|
} as const;
|