Skip to content

The open-source app everyone uses to manage agents at work

19.4 KB
Raw Blame
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://paperclip.dev/schemas/prp/v3/event.schema.json",
  "title": "PRP v3 native event",
  "type": "object",
  "required": [
    "schema",
    "sourceEventId",
    "sourceSeq",
    "sourceInstanceId",
    "sourceKind",
    "runId",
    "eventType",
    "schemaVersion",
    "priority",
    "emittedAt",
    "payload"
  ],
  "properties": {
    "schema": {
      "const": "paperclip.prp.event.v3"
    },
    "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": 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",
        "session.capabilities.updated",
        "session.goal.snapshot",
        "session.goal.updated",
        "session.goal.cleared",
        "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",
        "external_provider.dispatch_requested",
        "external_provider.operation_settled",
        "external_provider.input_available",
        "auth.credentials.updated"
      ]
    },
    "schemaVersion": {
      "const": 3
    },
    "priority": {
      "enum": [
        0,
        1,
        2
      ]
    },
    "emittedAt": {
      "type": "string",
      "format": "date-time"
    },
    "observedAt": {
      "type": "string",
      "format": "date-time"
    },
    "payload": {
      "type": "object",
      "additionalProperties": true
    },
    "debug": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "eventType": {
            "enum": [
              "session.goal.snapshot",
              "session.goal.updated"
            ]
          }
        },
        "type": "object"
      },
      "then": {
        "properties": {
          "payload": {
            "type": "object",
            "required": [
              "goal"
            ],
            "properties": {
              "goal": {
                "oneOf": [
                  {
                    "$ref": "https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "additionalProperties": true
          }
        },
        "type": "object"
      }
    },
    {
      "if": {
        "properties": {
          "eventType": {
            "const": "session.capabilities.updated"
          }
        },
        "type": "object"
      },
      "then": {
        "properties": {
          "payload": {
            "type": "object",
            "required": [
              "sessionGoals"
            ],
            "properties": {
              "sessionGoals": {
                "$ref": "https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability"
              },
              "turnControls": {
                "$ref": "https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls"
              }
            },
            "additionalProperties": true
          }
        },
        "type": "object"
      }
    },
    {
      "if": {
        "properties": {
          "eventType": {
            "const": "external_provider.dispatch_requested"
          }
        },
        "type": "object"
      },
      "then": {
        "properties": {
          "payload": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "binding": {
                    "type": "object",
                    "properties": {
                      "companyId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "agentId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "bindingId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "runId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "normalizedSessionId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "turnId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "bindingGeneration": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "assignmentRevision": {
                        "type": "integer",
                        "minimum": 1
                      }
                    },
                    "additionalProperties": false,
                    "required": [
                      "companyId",
                      "agentId",
                      "bindingId",
                      "runId",
                      "normalizedSessionId",
                      "turnId",
                      "bindingGeneration",
                      "assignmentRevision"
                    ]
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1048576
                  },
                  "instructions": {
                    "type": "string",
                    "maxLength": 1048576
                  },
                  "acceptByUnixMs": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "expiresAtUnixMs": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "completionContract": {
                    "type": "object",
                    "properties": {
                      "revision": {
                        "type": "string",
                        "minLength": 1
                      },
                      "criterionIds": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 256,
                        "uniqueItems": true,
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "revision",
                      "criterionIds"
                    ],
                    "additionalProperties": false
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "maxItems": 512
                  }
                },
                "additionalProperties": false,
                "required": [
                  "binding",
                  "text",
                  "instructions",
                  "acceptByUnixMs",
                  "expiresAtUnixMs",
                  "completionContract",
                  "tools"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "binding": {
                    "type": "object",
                    "properties": {
                      "companyId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "agentId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "bindingId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "runId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "normalizedSessionId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "turnId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      },
                      "bindingGeneration": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "assignmentRevision": {
                        "type": "integer",
                        "minimum": 1
                      }
                    },
                    "additionalProperties": false,
                    "required": [
                      "companyId",
                      "agentId",
                      "bindingId",
                      "runId",
                      "normalizedSessionId",
                      "turnId",
                      "bindingGeneration",
                      "assignmentRevision"
                    ]
                  },
                  "kind": {
                    "const": "authority_revoked"
                  },
                  "reason": {
                    "type": "string"
                  },
                  "externalStopConfirmed": {
                    "const": false
                  }
                },
                "required": [
                  "binding",
                  "kind",
                  "externalStopConfirmed"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "type": "object"
      }
    },
    {
      "if": {
        "properties": {
          "eventType": {
            "const": "external_provider.operation_settled"
          }
        },
        "type": "object"
      },
      "then": {
        "properties": {
          "payload": {
            "type": "object",
            "properties": {
              "binding": {
                "type": "object",
                "properties": {
                  "companyId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "agentId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "bindingId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "runId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "normalizedSessionId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "turnId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "bindingGeneration": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "assignmentRevision": {
                    "type": "integer",
                    "minimum": 1
                  }
                },
                "additionalProperties": false,
                "required": [
                  "companyId",
                  "agentId",
                  "bindingId",
                  "runId",
                  "normalizedSessionId",
                  "turnId",
                  "bindingGeneration",
                  "assignmentRevision"
                ]
              },
              "requestId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 240
              },
              "outcome": {
                "type": "object"
              }
            },
            "required": [
              "binding",
              "requestId",
              "outcome"
            ],
            "additionalProperties": false
          }
        },
        "type": "object"
      }
    },
    {
      "if": {
        "properties": {
          "eventType": {
            "const": "external_provider.input_available"
          }
        },
        "type": "object"
      },
      "then": {
        "properties": {
          "payload": {
            "type": "object",
            "properties": {
              "binding": {
                "type": "object",
                "properties": {
                  "companyId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "agentId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "bindingId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "runId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "normalizedSessionId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "turnId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 240
                  },
                  "bindingGeneration": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "assignmentRevision": {
                    "type": "integer",
                    "minimum": 1
                  }
                },
                "additionalProperties": false,
                "required": [
                  "companyId",
                  "agentId",
                  "bindingId",
                  "runId",
                  "normalizedSessionId",
                  "turnId",
                  "bindingGeneration",
                  "assignmentRevision"
                ]
              },
              "requestId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 240
              },
              "turnId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 240
              },
              "inputDigest": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$"
              },
              "response": {
                "$ref": "https://paperclip.dev/schemas/prp/v1/question-response.schema.json"
              }
            },
            "required": [
              "binding",
              "requestId",
              "turnId",
              "inputDigest",
              "response"
            ],
            "additionalProperties": false
          }
        },
        "type": "object"
      }
    },
    {
      "if": {
        "properties": {
          "eventType": {
            "const": "auth.credentials.updated"
          }
        }
      },
      "then": {
        "properties": {
          "sourceKind": {
            "const": "runner"
          },
          "priority": {
            "const": 0
          },
          "payload": {
            "$ref": "https://paperclip.dev/schemas/prp/v1/auth-credentials.schema.json"
          }
        }
      }
    }
  ],
  "additionalProperties": true
}