mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-31 22:24:16 +01:00
3285 lines
69 KiB
TypeScript
3285 lines
69 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"
|
|
},
|
|
"typedEventFamilies": {
|
|
"type": "array",
|
|
"maxItems": 64,
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"family",
|
|
"version",
|
|
"availability",
|
|
"detailLevel"
|
|
],
|
|
"properties": {
|
|
"family": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160,
|
|
"pattern": "^[a-z][a-z0-9_.-]*$"
|
|
},
|
|
"version": {
|
|
"const": 1
|
|
},
|
|
"availability": {
|
|
"enum": [
|
|
"available",
|
|
"unsupported",
|
|
"policy_disabled"
|
|
]
|
|
},
|
|
"detailLevel": {
|
|
"enum": [
|
|
"summary",
|
|
"structured"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"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",
|
|
"session.budget.increase",
|
|
"session.destroy",
|
|
"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 providerDescriptorSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json",
|
|
"title": "PRP provider runtime descriptor",
|
|
"type": "object",
|
|
"required": [
|
|
"provider",
|
|
"driver",
|
|
"model",
|
|
"executionKind",
|
|
"providerVersion"
|
|
],
|
|
"properties": {
|
|
"provider": {
|
|
"enum": [
|
|
"codex",
|
|
"opencode",
|
|
"claude_managed"
|
|
]
|
|
},
|
|
"driver": {
|
|
"enum": [
|
|
"codex_app_server",
|
|
"opencode_server",
|
|
"claude_managed_agents_api"
|
|
]
|
|
},
|
|
"model": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 240
|
|
},
|
|
"executionKind": {
|
|
"enum": [
|
|
"local_process",
|
|
"remote_service"
|
|
]
|
|
},
|
|
"providerVersion": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 120
|
|
},
|
|
"service": {
|
|
"enum": [
|
|
"anthropic_managed_agents"
|
|
]
|
|
},
|
|
"providerSessionId": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 240
|
|
},
|
|
"processId": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 1
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"executionKind": {
|
|
"const": "remote_service"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"required": [
|
|
"service"
|
|
],
|
|
"properties": {
|
|
"processId": {
|
|
"const": null
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"executionKind": {
|
|
"const": "local_process"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"service": false
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"additionalProperties": false
|
|
} as const;
|
|
|
|
export const providerEventSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json",
|
|
"title": "Provider-neutral runner activity payload",
|
|
"oneOf": [
|
|
{
|
|
"$ref": "#/$defs/plan"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/toolExecution"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/research"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/delegation"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/modelRoute"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/modelVerification"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/contextCompacted"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/artifactViewed"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/artifactGenerated"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/reviewMode"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/hook"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/memoryCitation"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/safetyReview"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/terminalInput"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/wait"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/providerNotice"
|
|
}
|
|
],
|
|
"$defs": {
|
|
"id": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160,
|
|
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
|
|
},
|
|
"shortText": {
|
|
"type": "string",
|
|
"maxLength": 4000
|
|
},
|
|
"nullableShortText": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 4000
|
|
},
|
|
"safePath": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 4096,
|
|
"pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"
|
|
},
|
|
"safeUrl": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 8192,
|
|
"pattern": "^https?://"
|
|
},
|
|
"plan": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"planId",
|
|
"revision",
|
|
"steps",
|
|
"complete",
|
|
"syncStatus"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.plan.updated.v1"
|
|
},
|
|
"planId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"revision": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"explanation": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
},
|
|
"steps": {
|
|
"type": "array",
|
|
"maxItems": 256,
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"stepId",
|
|
"body",
|
|
"status"
|
|
],
|
|
"properties": {
|
|
"stepId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"body": {
|
|
"$ref": "#/$defs/shortText"
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"pending",
|
|
"in_progress",
|
|
"completed",
|
|
"blocked"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"complete": {
|
|
"type": "boolean"
|
|
},
|
|
"syncStatus": {
|
|
"enum": [
|
|
"streaming",
|
|
"pending",
|
|
"synchronized",
|
|
"conflict",
|
|
"not_applicable"
|
|
]
|
|
},
|
|
"documentRevision": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 1
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"toolExecution": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"executionId",
|
|
"transport",
|
|
"operation",
|
|
"status",
|
|
"output",
|
|
"outputBytes",
|
|
"outputTruncated",
|
|
"outputDigest"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.tool.execution.v1"
|
|
},
|
|
"executionId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"transport": {
|
|
"enum": [
|
|
"process",
|
|
"mcp",
|
|
"dynamic",
|
|
"builtin"
|
|
]
|
|
},
|
|
"operation": {
|
|
"enum": [
|
|
"read",
|
|
"search",
|
|
"list",
|
|
"execute",
|
|
"edit",
|
|
"unknown"
|
|
]
|
|
},
|
|
"name": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
},
|
|
"target": {
|
|
"$ref": "#/$defs/safePath"
|
|
},
|
|
"namespace": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 240
|
|
},
|
|
"readOnly": {
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"running",
|
|
"completed",
|
|
"failed",
|
|
"cancelled",
|
|
"interrupted"
|
|
]
|
|
},
|
|
"durationMs": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 0
|
|
},
|
|
"exitCode": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
]
|
|
},
|
|
"progress": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
},
|
|
"output": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 65536
|
|
},
|
|
"outputBytes": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"outputTruncated": {
|
|
"type": "boolean"
|
|
},
|
|
"outputDigest": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"research": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"researchId",
|
|
"action",
|
|
"status",
|
|
"sources"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.research.v1"
|
|
},
|
|
"researchId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"action": {
|
|
"enum": [
|
|
"search",
|
|
"open_page",
|
|
"find_in_page",
|
|
"other"
|
|
]
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"running",
|
|
"completed",
|
|
"failed",
|
|
"cancelled"
|
|
]
|
|
},
|
|
"query": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
},
|
|
"url": {
|
|
"$ref": "#/$defs/safeUrl"
|
|
},
|
|
"pattern": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
},
|
|
"sources": {
|
|
"type": "array",
|
|
"maxItems": 64,
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"sourceId",
|
|
"title",
|
|
"url",
|
|
"snippet"
|
|
],
|
|
"properties": {
|
|
"sourceId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"title": {
|
|
"$ref": "#/$defs/shortText"
|
|
},
|
|
"url": {
|
|
"$ref": "#/$defs/safeUrl"
|
|
},
|
|
"snippet": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"delegation": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"delegationId",
|
|
"action",
|
|
"status",
|
|
"children"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.delegation.v1"
|
|
},
|
|
"delegationId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"action": {
|
|
"enum": [
|
|
"spawn",
|
|
"message",
|
|
"resume",
|
|
"wait",
|
|
"close"
|
|
]
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"running",
|
|
"waiting",
|
|
"completed",
|
|
"failed",
|
|
"interrupted",
|
|
"closed"
|
|
]
|
|
},
|
|
"children": {
|
|
"type": "array",
|
|
"maxItems": 64,
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"childId",
|
|
"role",
|
|
"model",
|
|
"status",
|
|
"summary",
|
|
"activitySummary"
|
|
],
|
|
"properties": {
|
|
"childId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"role": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 160
|
|
},
|
|
"model": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 240
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"running",
|
|
"waiting",
|
|
"completed",
|
|
"failed",
|
|
"interrupted",
|
|
"closed"
|
|
]
|
|
},
|
|
"summary": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
},
|
|
"activitySummary": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"modelRoute": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"routeId",
|
|
"provider",
|
|
"requestedModel",
|
|
"fromModel",
|
|
"effectiveModel",
|
|
"reason"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.model.route_changed.v1"
|
|
},
|
|
"routeId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"provider": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"requestedModel": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 240
|
|
},
|
|
"fromModel": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 240
|
|
},
|
|
"effectiveModel": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 240
|
|
},
|
|
"reason": {
|
|
"$ref": "#/$defs/shortText"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"modelVerification": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"verificationId",
|
|
"status",
|
|
"classes",
|
|
"buffering",
|
|
"summary"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.model.verification.v1"
|
|
},
|
|
"verificationId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"running",
|
|
"completed",
|
|
"failed"
|
|
]
|
|
},
|
|
"classes": {
|
|
"type": "array",
|
|
"maxItems": 32,
|
|
"items": {
|
|
"type": "string",
|
|
"maxLength": 160
|
|
}
|
|
},
|
|
"buffering": {
|
|
"type": "boolean"
|
|
},
|
|
"summary": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"contextCompacted": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"compactionId",
|
|
"reason",
|
|
"preTokens",
|
|
"postTokens",
|
|
"sameSession"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.context.compacted.v1"
|
|
},
|
|
"compactionId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"reason": {
|
|
"enum": [
|
|
"context_window",
|
|
"manual",
|
|
"provider",
|
|
"unknown"
|
|
]
|
|
},
|
|
"preTokens": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 0
|
|
},
|
|
"postTokens": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 0
|
|
},
|
|
"sameSession": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"artifactViewed": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"artifactId",
|
|
"reference",
|
|
"mediaType",
|
|
"title"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.artifact.viewed.v1"
|
|
},
|
|
"artifactId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"reference": {
|
|
"$ref": "#/$defs/safePath"
|
|
},
|
|
"mediaType": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 160
|
|
},
|
|
"title": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"artifactGenerated": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"artifactId",
|
|
"status",
|
|
"reference",
|
|
"mediaType",
|
|
"registered",
|
|
"failure"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.artifact.generated.v1"
|
|
},
|
|
"artifactId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"running",
|
|
"completed",
|
|
"failed"
|
|
]
|
|
},
|
|
"reference": {
|
|
"$ref": "#/$defs/safePath"
|
|
},
|
|
"mediaType": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 160
|
|
},
|
|
"registered": {
|
|
"type": "boolean"
|
|
},
|
|
"transparentBackground": {
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"failure": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"reviewMode": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"reviewId",
|
|
"state",
|
|
"scope"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.review.mode_changed.v1"
|
|
},
|
|
"reviewId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"state": {
|
|
"enum": [
|
|
"entered",
|
|
"exited"
|
|
]
|
|
},
|
|
"scope": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"hook": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"hookId",
|
|
"event",
|
|
"scope",
|
|
"status",
|
|
"blocking",
|
|
"durationMs",
|
|
"summary"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.hook.v1"
|
|
},
|
|
"hookId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"event": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"scope": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"running",
|
|
"completed",
|
|
"failed",
|
|
"cancelled"
|
|
]
|
|
},
|
|
"blocking": {
|
|
"type": "boolean"
|
|
},
|
|
"durationMs": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 0
|
|
},
|
|
"summary": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"memoryCitation": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"citationId",
|
|
"messageItemId",
|
|
"label",
|
|
"available",
|
|
"reference"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.memory.citation.v1"
|
|
},
|
|
"citationId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"messageItemId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"label": {
|
|
"$ref": "#/$defs/shortText"
|
|
},
|
|
"available": {
|
|
"type": "boolean"
|
|
},
|
|
"reference": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 4096
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"safetyReview": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"reviewId",
|
|
"targetExecutionId",
|
|
"status",
|
|
"decision",
|
|
"summary"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.safety.review.v1"
|
|
},
|
|
"reviewId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"targetExecutionId": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"running",
|
|
"completed",
|
|
"failed"
|
|
]
|
|
},
|
|
"decision": {
|
|
"enum": [
|
|
"pending",
|
|
"allowed",
|
|
"denied",
|
|
"user_required",
|
|
"unknown"
|
|
]
|
|
},
|
|
"summary": {
|
|
"$ref": "#/$defs/nullableShortText"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"terminalInput": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"executionId",
|
|
"origin",
|
|
"inputClass",
|
|
"byteCount"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.terminal.input_sent.v1"
|
|
},
|
|
"executionId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"origin": {
|
|
"enum": [
|
|
"agent",
|
|
"user",
|
|
"system"
|
|
]
|
|
},
|
|
"inputClass": {
|
|
"enum": [
|
|
"text",
|
|
"control",
|
|
"eof"
|
|
]
|
|
},
|
|
"byteCount": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"wait": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"waitId",
|
|
"reason",
|
|
"status",
|
|
"plannedDurationMs",
|
|
"elapsedDurationMs"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.wait.v1"
|
|
},
|
|
"waitId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"reason": {
|
|
"enum": [
|
|
"timer",
|
|
"provider",
|
|
"rate_limit",
|
|
"unknown"
|
|
]
|
|
},
|
|
"status": {
|
|
"enum": [
|
|
"running",
|
|
"completed",
|
|
"interrupted",
|
|
"cancelled"
|
|
]
|
|
},
|
|
"plannedDurationMs": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 0
|
|
},
|
|
"elapsedDurationMs": {
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"minimum": 0
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"providerNotice": {
|
|
"type": "object",
|
|
"required": [
|
|
"schema",
|
|
"noticeId",
|
|
"severity",
|
|
"category",
|
|
"scope",
|
|
"recoverable",
|
|
"userActionable",
|
|
"summary"
|
|
],
|
|
"properties": {
|
|
"schema": {
|
|
"const": "paperclip.provider.notice.v1"
|
|
},
|
|
"noticeId": {
|
|
"$ref": "#/$defs/id"
|
|
},
|
|
"severity": {
|
|
"enum": [
|
|
"info",
|
|
"warning",
|
|
"error"
|
|
]
|
|
},
|
|
"category": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 160
|
|
},
|
|
"scope": {
|
|
"enum": [
|
|
"turn",
|
|
"session",
|
|
"environment",
|
|
"account"
|
|
]
|
|
},
|
|
"recoverable": {
|
|
"type": "boolean"
|
|
},
|
|
"userActionable": {
|
|
"type": "boolean"
|
|
},
|
|
"summary": {
|
|
"$ref": "#/$defs/shortText"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
} 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 usageSchema = {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://paperclip.dev/schemas/prp/v1/usage.schema.json",
|
|
"title": "PRP provider usage receipt",
|
|
"type": "object",
|
|
"required": [
|
|
"provider",
|
|
"model",
|
|
"cumulative",
|
|
"runDelta"
|
|
],
|
|
"properties": {
|
|
"provider": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 80
|
|
},
|
|
"model": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 240
|
|
},
|
|
"providerSessionId": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 240
|
|
},
|
|
"providerRequestId": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"maxLength": 240
|
|
},
|
|
"cumulative": {
|
|
"$ref": "#/$defs/measurement"
|
|
},
|
|
"runDelta": {
|
|
"$ref": "#/$defs/measurement"
|
|
}
|
|
},
|
|
"additionalProperties": false,
|
|
"$defs": {
|
|
"measurement": {
|
|
"type": "object",
|
|
"required": [
|
|
"inputTokens",
|
|
"outputTokens",
|
|
"cacheReadTokens",
|
|
"cacheWriteTokens",
|
|
"activeSeconds",
|
|
"requests",
|
|
"providerCostUsd"
|
|
],
|
|
"properties": {
|
|
"inputTokens": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"outputTokens": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"cacheReadTokens": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"cacheWriteTokens": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"activeSeconds": {
|
|
"type": "number",
|
|
"minimum": 0
|
|
},
|
|
"requests": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"providerCostUsd": {
|
|
"type": "number",
|
|
"minimum": 0
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
} 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",
|
|
"plan.updated",
|
|
"tool.execution.started",
|
|
"tool.execution.progressed",
|
|
"tool.execution.completed",
|
|
"research.started",
|
|
"research.progressed",
|
|
"research.completed",
|
|
"delegation.started",
|
|
"delegation.updated",
|
|
"delegation.completed",
|
|
"model.route.changed",
|
|
"model.verification.updated",
|
|
"context.compacted",
|
|
"artifact.viewed",
|
|
"artifact.generated",
|
|
"review.mode.changed",
|
|
"hook.started",
|
|
"hook.completed",
|
|
"memory.citation.referenced",
|
|
"safety.review.started",
|
|
"safety.review.completed",
|
|
"terminal.input.sent",
|
|
"wait.started",
|
|
"wait.completed",
|
|
"provider.notice.recorded",
|
|
"session.starting",
|
|
"session.started",
|
|
"session.resuming",
|
|
"session.resumed",
|
|
"session.reconciled",
|
|
"session.updated",
|
|
"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",
|
|
"usage.reported",
|
|
"semantic_tool.input",
|
|
"semantic_tool.result",
|
|
"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": "plan.updated"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/plan"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"enum": [
|
|
"tool.execution.started",
|
|
"tool.execution.progressed",
|
|
"tool.execution.completed"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/toolExecution"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"enum": [
|
|
"research.started",
|
|
"research.progressed",
|
|
"research.completed"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/research"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"enum": [
|
|
"delegation.started",
|
|
"delegation.updated",
|
|
"delegation.completed"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/delegation"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "model.route.changed"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/modelRoute"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "model.verification.updated"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/modelVerification"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "context.compacted"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/contextCompacted"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "artifact.viewed"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/artifactViewed"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "artifact.generated"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/artifactGenerated"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "review.mode.changed"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/reviewMode"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"enum": [
|
|
"hook.started",
|
|
"hook.completed"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/hook"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "memory.citation.referenced"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/memoryCitation"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"enum": [
|
|
"safety.review.started",
|
|
"safety.review.completed"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/safetyReview"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "terminal.input.sent"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/terminalInput"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"enum": [
|
|
"wait.started",
|
|
"wait.completed"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/wait"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"eventType": {
|
|
"const": "provider.notice.recorded"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/providerNotice"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"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": {
|
|
"enum": [
|
|
"semantic_tool.input",
|
|
"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": {
|
|
"enum": [
|
|
"semantic_tool.result",
|
|
"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,
|
|
"provider-descriptor": providerDescriptorSchema,
|
|
"provider-event": providerEventSchema,
|
|
"workspace-diff": workspaceDiffSchema,
|
|
"workspace-file-reference": workspaceFileReferenceSchema,
|
|
"semantic-tool": semanticToolSchema,
|
|
"usage": usageSchema,
|
|
"stop-reason": stopReasonSchema,
|
|
"terminal": terminalSchema,
|
|
"request": requestSchema,
|
|
"result": resultSchema,
|
|
"event": eventSchema,
|
|
"fixture": fixtureSchema,
|
|
} as const;
|