Files
PaperClipAI/packages/paperclip-runner/src/protocol/generated/schema-bundle.ts
T
Dotta 1ee738cf48 feat(runner): project durable ACPX events (#12424)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The Rust runner now owns validated, scoped ACPX reducer events and
safe session suspension
> - Durable PRP transport must receive provider-neutral events rather
than sidecar-native envelopes
> - Semantic calls and questions must retain the exact run, session,
turn, item, and provider-request authority used by the durable command
stream
> - Terminal, result, assistant, process, and diagnostic events also
need one reviewed projection boundary
> - Permission requests remain impossible under the pinned Codex policy
and must fail closed if they reach projection
> - This pull request adds only that package-local projection without
selecting ACPX in runnerd

## Linked Issues or Issue Description

Refs #12422

## What Changed

- Add a validated durable ACPX event projection context bound to one
run, normalized session, turn, and item.
- Pass already normalized activity events through without reintroducing
provider-native envelopes.
- Project authorized tool calls into canonical semantic input receipts
with exact correlation and content digests.
- Project structured questions into provider-neutral
`paperclip.runtime_request.v2` events.
- Preserve both the public projected request identity and the original
provider request identity so responses resolve the exact sidecar
request.
- Project dynamic semantic operation results as `semantic_tool.result`;
only reserved finish/block operations may propose the run result.
- Project semantic completion results into `run.result.proposed`.
- Project terminal-flushed assistant messages on the final channel and
turn terminal states into existing provider-neutral event families.
- Project sanitized process metadata and diagnostics into bounded
harness diagnostics.
- Validate runtime-request origins against their strict durable shape
and fall back from empty optional titles to a valid question prompt.
- Reject invalid identities, projected-identity collisions, unstable
semantic receipt identities, permission requests, and cross-turn
projection fail closed.
- Add integration coverage across reducer event families, correlation,
identity validation, projected question resolution, and pinned-policy
denial.
- Document the durable projection boundary.
- Do not change dependencies, lockfiles, workflows, runnerd selection,
server behavior, UI, or migrations.

## Verification

- Replay base: `80639f4f69c8938eb74bdc0833df93e0ed91dab3` (`master`
after #12422 merged).
- Exact replay head: `3cb29581d2bcbc4b47f8069baffd721c6ce4e444`.
- Stable patch ID: `92910b56575e67ae83960177d467a565019ba282`.
- The exact delta is 22 files, 1,206 additions, and 59 deletions, all in
`packages/paperclip-runner`; it contains no lockfile, workflow, server,
UI, dependency, or migration change.
- `git diff --check` and the Cargo formatting check pass on the replayed
delta.
- Exact-head GitHub Actions run `33372209037` (attempt 2): **PASSED**
with 23/23 jobs passed.
- Greptile reviewed exact head
`3cb29581d2bcbc4b47f8069baffd721c6ce4e444`: **5/5**, with zero
unresolved review threads.
- Superagent, contributor trust, Socket, and Snyk security checks:
**PASSED**.
- No local test result is claimed. GitHub Actions is the authoritative
verification environment for this replayed revision.

## Risks

- This function accepts reducer output, not raw sidecar frames. Callers
must preserve the existing scope-first decode and reduction order.
- Semantic input includes the already sanitized provider input while its
content receipt uses the same canonical digest.
- Structured input preserves the validated provider-neutral question set
and sanitized origin.
- Noncanonical provider request identities are deterministically
projected for PRP while the original identity remains authoritative for
the sidecar resolution command.
- Existing PRP v1 identifiers remain schema-compatible; the only public
ID-schema change widens turn/item limits from 160 to 240 characters. The
internal ACPX sidecar wire schema now mirrors the stable IDs its Rust
transport already enforced.
- The projector verifies event-carried terminal and assistant turn
identifiers against the durable context.
- No production path invokes this projector in this pull request.
Durable command execution remains the next slice.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

- OpenAI Codex with GPT-5.6, agentic reasoning, tool use, and code
execution.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used with version and capability
details
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have linked the preceding public PR or described the issue in-PR
- [x] I have not referenced internal or instance-local Paperclip issues
or links
- [x] My branch name describes the change and contains no internal
Paperclip ticket id
- [ ] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
2026-08-31 03:33:38 -05:00

3995 lines
85 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",
"aws_agentcore",
"acpx"
]
},
"driver": {
"enum": [
"codex_app_server",
"opencode_server",
"claude_managed_agents_api",
"aws_agentcore_harness_api",
"acpx_runtime"
]
},
"model": {
"type": [
"string",
"null"
],
"maxLength": 240
},
"executionKind": {
"enum": [
"local_process",
"remote_service"
]
},
"providerVersion": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"service": {
"enum": [
"anthropic_managed_agents",
"aws_bedrock_agentcore_harness"
]
},
"providerSessionId": {
"type": [
"string",
"null"
],
"maxLength": 240
},
"processId": {
"type": [
"integer",
"null"
],
"minimum": 1
},
"agentProcessId": {
"type": [
"integer",
"null"
],
"minimum": 1
},
"endpointArn": {
"type": "string",
"minLength": 1,
"maxLength": 2048
},
"endpointQualifier": {
"type": "string",
"minLength": 1,
"maxLength": 240
},
"memoryId": {
"type": "string",
"minLength": 1,
"maxLength": 240
},
"eventExpiryDays": {
"const": 90
},
"agent": {
"enum": [
"pi",
"claude",
"codex"
]
},
"requestedModel": {
"type": "string",
"minLength": 1,
"maxLength": 240
},
"acpProtocolVersion": {
"const": 1
},
"agentServerPackage": {
"type": "string",
"minLength": 1,
"maxLength": 240
},
"agentServerVersion": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"agentRuntimePackage": {
"type": [
"string",
"null"
],
"maxLength": 240
},
"agentRuntimeVersion": {
"type": [
"string",
"null"
],
"maxLength": 120
},
"acpxRecordId": {
"type": [
"string",
"null"
],
"maxLength": 240
}
},
"allOf": [
{
"oneOf": [
{
"properties": {
"provider": {
"const": "codex"
},
"driver": {
"const": "codex_app_server"
},
"executionKind": {
"const": "local_process"
}
}
},
{
"properties": {
"provider": {
"const": "opencode"
},
"driver": {
"const": "opencode_server"
},
"executionKind": {
"const": "local_process"
}
}
},
{
"properties": {
"provider": {
"const": "claude_managed"
},
"driver": {
"const": "claude_managed_agents_api"
},
"executionKind": {
"const": "remote_service"
}
}
},
{
"properties": {
"provider": {
"const": "aws_agentcore"
},
"driver": {
"const": "aws_agentcore_harness_api"
},
"executionKind": {
"const": "remote_service"
}
}
},
{
"properties": {
"provider": {
"const": "acpx"
},
"driver": {
"const": "acpx_runtime"
},
"executionKind": {
"const": "local_process"
}
}
}
]
},
{
"if": {
"properties": {
"executionKind": {
"const": "remote_service"
}
}
},
"then": {
"required": [
"service"
],
"properties": {
"processId": {
"const": null
}
}
}
},
{
"if": {
"properties": {
"executionKind": {
"const": "local_process"
}
}
},
"then": {
"properties": {
"service": false
}
}
},
{
"if": {
"properties": {
"provider": {
"const": "claude_managed"
}
},
"required": [
"provider"
]
},
"then": {
"properties": {
"service": {
"const": "anthropic_managed_agents"
}
},
"required": [
"service"
]
}
},
{
"if": {
"properties": {
"provider": {
"const": "aws_agentcore"
}
},
"required": [
"provider"
]
},
"then": {
"properties": {
"service": {
"const": "aws_bedrock_agentcore_harness"
}
},
"required": [
"service",
"endpointArn",
"endpointQualifier",
"memoryId",
"eventExpiryDays"
]
}
},
{
"if": {
"properties": {
"provider": {
"const": "acpx"
}
},
"required": [
"provider"
]
},
"then": {
"required": [
"agent",
"requestedModel",
"acpProtocolVersion",
"agentServerPackage",
"agentServerVersion",
"acpxRecordId",
"agentProcessId"
]
}
}
],
"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",
"description": "A complete provider-authored within-turn checklist snapshot. Consumers replace the prior snapshot with the same planId in PRP sourceSeq order; this is not Paperclip's durable Plan document.",
"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": {
"description": "Legacy compatibility field. Within-turn checklist snapshots use not_applicable.",
"enum": [
"streaming",
"pending",
"synchronized",
"conflict",
"not_applicable"
]
},
"documentRevision": {
"description": "Legacy compatibility field. Within-turn checklist snapshots use null.",
"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",
"reconciled"
]
},
"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": {
"enum": [
"result",
"reconciled"
]
}
},
"required": [
"phase"
]
},
"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"
},
"runDeltaAvailable": {
"type": "boolean"
},
"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 questionSetSchema = {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://paperclip.dev/schemas/prp/v1/question-set.schema.json",
"title": "Paperclip question set",
"type": "object",
"required": [
"schema",
"questions"
],
"properties": {
"schema": {
"const": "paperclip.question_set.v1"
},
"title": {
"type": "string",
"maxLength": 1000
},
"description": {
"type": "string",
"maxLength": 4000
},
"submitLabel": {
"type": "string",
"maxLength": 200
},
"questions": {
"type": "array",
"minItems": 1,
"maxItems": 64,
"items": {
"$ref": "#/$defs/question"
}
}
},
"$defs": {
"option": {
"type": "object",
"required": [
"id",
"label"
],
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 1000
},
"description": {
"type": "string",
"maxLength": 4000
},
"recommended": {
"type": "boolean"
}
},
"additionalProperties": false
},
"customAnswer": {
"type": "object",
"required": [
"enabled"
],
"properties": {
"enabled": {
"const": true
},
"label": {
"type": "string",
"maxLength": 1000
},
"placeholder": {
"type": "string",
"maxLength": 1000
}
},
"additionalProperties": false
},
"textValidation": {
"type": "object",
"properties": {
"minLength": {
"type": "integer",
"minimum": 0,
"maximum": 100000
},
"maxLength": {
"type": "integer",
"minimum": 0,
"maximum": 100000
},
"pattern": {
"type": "string",
"maxLength": 1000
},
"inputType": {
"enum": [
"text",
"number",
"integer"
]
},
"minimum": {
"type": "number"
},
"maximum": {
"type": "number"
}
},
"additionalProperties": false
},
"question": {
"type": "object",
"required": [
"id",
"prompt",
"required",
"answerMode"
],
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"header": {
"type": "string",
"maxLength": 1000
},
"prompt": {
"type": "string",
"minLength": 1,
"maxLength": 4000
},
"helpText": {
"type": "string",
"maxLength": 4000
},
"required": {
"type": "boolean"
},
"answerMode": {
"enum": [
"single_select",
"multi_select",
"text"
]
},
"options": {
"type": "array",
"maxItems": 128,
"items": {
"$ref": "#/$defs/option"
}
},
"customAnswer": {
"$ref": "#/$defs/customAnswer"
},
"textValidation": {
"$ref": "#/$defs/textValidation"
}
},
"allOf": [
{
"if": {
"properties": {
"answerMode": {
"const": "text"
}
},
"required": [
"answerMode"
]
},
"then": {
"properties": {
"options": {
"type": "array",
"maxItems": 0
}
},
"not": {
"required": [
"customAnswer"
]
}
}
},
{
"if": {
"properties": {
"answerMode": {
"enum": [
"single_select",
"multi_select"
]
}
},
"required": [
"answerMode"
]
},
"then": {
"required": [
"options"
],
"properties": {
"options": {
"type": "array",
"minItems": 1
}
}
}
}
],
"additionalProperties": false
}
},
"additionalProperties": false
} as const;
export const questionResponseSchema = {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://paperclip.dev/schemas/prp/v1/question-response.schema.json",
"title": "Paperclip question response",
"type": "object",
"required": [
"schema",
"answers"
],
"properties": {
"schema": {
"const": "paperclip.question_response.v1"
},
"answers": {
"type": "object",
"propertyNames": {
"minLength": 1,
"maxLength": 160
},
"additionalProperties": {
"type": "object",
"properties": {
"selectedOptionIds": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 160
}
},
"text": {
"type": "string",
"maxLength": 100000
},
"customText": {
"type": "string",
"maxLength": 100000
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
} as const;
export const questionAdapterFixtureSchema = {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://paperclip.dev/schemas/prp/v1/question-adapter-fixture.schema.json",
"title": "Harness question adapter conformance fixture",
"type": "object",
"required": [
"schema",
"adapter",
"nativeRequest",
"canonicalQuestionSet",
"canonicalResponse",
"nativeResponse"
],
"properties": {
"schema": {
"const": "paperclip.question_adapter_fixture.v1"
},
"adapter": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"nativeRequest": {},
"canonicalQuestionSet": {
"$ref": "https://paperclip.dev/schemas/prp/v1/question-set.schema.json"
},
"canonicalResponse": {
"$ref": "https://paperclip.dev/schemas/prp/v1/question-response.schema.json"
},
"nativeResponse": {}
},
"additionalProperties": false
} 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",
"input"
],
"properties": {
"schema": {
"const": "paperclip.runtime_request.v2"
},
"requestKind": {
"const": "runtime"
},
"requestId": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"type": {
"const": "input"
},
"status": {
"enum": [
"pending",
"resolved",
"expired",
"cancelled"
]
},
"prompt": {
"type": "string",
"minLength": 1,
"maxLength": 4000
},
"input": {
"$ref": "https://paperclip.dev/schemas/prp/v1/question-set.schema.json"
},
"origin": {
"type": "object",
"required": [
"adapter"
],
"properties": {
"adapter": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"provider": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"method": {
"type": "string",
"minLength": 1,
"maxLength": 500
}
},
"additionalProperties": false
},
"turnId": {
"type": "string",
"minLength": 1,
"maxLength": 240
},
"itemId": {
"type": "string",
"minLength": 1,
"maxLength": 240
}
},
"additionalProperties": false
},
{
"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",
"description": "Checks used to verify the work. Use failed only when the check actually ran and found a defect in the work. If a check could not run or complete because the environment, tool, dependency, permission, credential, policy, external service, or budget was unavailable, use not_run with reasonCode even when the attempted command exited non-zero.",
"items": {
"type": "object",
"required": [
"commandOrCheck",
"status"
],
"properties": {
"commandOrCheck": {
"type": "string",
"minLength": 1
},
"status": {
"enum": [
"passed",
"failed",
"not_run"
],
"description": "passed means the check ran and succeeded; failed means it ran to a meaningful verdict and found the work incorrect; not_run means no meaningful verdict was possible because the check was not attempted or could not complete."
},
"reasonCode": {
"description": "Required for not_run; identify why the check had no meaningful verdict.",
"enum": [
"environment_unavailable",
"tool_unavailable",
"dependency_missing",
"permission_denied",
"credential_missing",
"policy_restricted",
"external_service_unavailable",
"budget_exhausted",
"other"
]
},
"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",
"required": [
"kind",
"name"
],
"properties": {
"kind": {
"enum": [
"agent",
"user",
"system",
"external"
]
},
"name": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": true
},
"unblockAction": {
"type": "string",
"minLength": 1
},
"scope": {
"enum": [
"current_track",
"task_wide"
]
}
},
"additionalProperties": true
},
"attentionRequests": {
"type": "array",
"items": {
"type": "object",
"properties": {
"kind": {
"type": "string",
"minLength": 1
},
"summary": {
"type": "string",
"minLength": 1
},
"ownerClass": {
"enum": [
"human",
"agent",
"external_system"
]
},
"targetAgentId": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": true
}
},
"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,
"maximum": 9007199254740991
},
"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": 240
},
"itemId": {
"type": "string",
"minLength": 1,
"maxLength": 240
},
"eventType": {
"enum": [
"runner.connected",
"runner.reconnected",
"runner.reconciled",
"runner.disconnected",
"runner.draining",
"runner.backpressure",
"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",
"semantic_tool.reconciled",
"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": "semantic_tool.reconciled"
}
}
},
"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": "reconciled"
}
}
}
]
}
},
"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,
"question-set": questionSetSchema,
"question-response": questionResponseSchema,
"question-adapter-fixture": questionAdapterFixtureSchema,
"request": requestSchema,
"result": resultSchema,
"event": eventSchema,
"fixture": fixtureSchema,
} as const;