Skip to content

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

7.8 KB
Raw Blame
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://paperclip.dev/schemas/acpx-sidecar/v2/message.schema.json",
  "title": "Paperclip ACPX sidecar message",
  "oneOf": [
    { "$ref": "#/$defs/request" },
    { "$ref": "#/$defs/response" },
    { "$ref": "#/$defs/event" }
  ],
  "$defs": {
    "protocolVersion": { "const": 2 },
    "command": {
      "enum": [
        "initialize",
        "session.open",
        "run.attach",
        "turn.start",
        "turn.cancel",
        "turn.steer",
        "permission.resolve",
        "input.resolve",
        "tool.resolve",
        "session.read",
        "session.snapshot",
        "session.goal.get",
        "session.goal.set",
        "session.goal.clear",
        "session.suspend",
        "session.close"
      ]
    },
    "eventType": {
      "enum": [
        "runtime.event",
        "runtime.rich_event",
        "runtime.permission_requested",
        "runtime.input_requested",
        "runtime.tool_called",
        "runtime.turn_terminal",
        "runtime.process",
        "runtime.diagnostic",
        "runtime.goal"
      ]
    },
    "request": {
      "type": "object",
      "required": ["protocolVersion", "id", "command", "params"],
      "properties": {
        "protocolVersion": { "$ref": "#/$defs/protocolVersion" },
        "id": { "type": "integer", "minimum": 1 },
        "command": { "$ref": "#/$defs/command" },
        "params": { "type": "object" }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "if": { "properties": { "command": { "const": "turn.steer" } } },
          "then": { "properties": { "params": { "$ref": "#/$defs/turnControl" } } }
        },
        {
          "if": { "properties": { "command": { "const": "session.open" } } },
          "then": { "properties": { "params": { "allOf": [{ "$ref": "#/$defs/sessionOpenThinkingLevel" }, { "$ref": "#/$defs/sessionOpenClaudeEffort" }] } } }
        }
      ]
    },
    "piThinkingLevel": { "enum": ["off", "low", "high", "max"] },
    "sessionOpenThinkingLevel": {
      "type": "object",
      "properties": {
        "agent": { "type": "string" },
        "piThinkingLevel": { "$ref": "#/$defs/piThinkingLevel" }
      },
      "if": { "properties": { "agent": { "const": "pi" } }, "required": ["agent"] },
      "then": {
        "required": ["piThinkingLevel"],
        "properties": {
          "piThinkingLevel": { "$ref": "#/$defs/piThinkingLevel" },
          "expectedIdentity": {
            "type": ["object", "null"],
            "properties": { "piThinkingLevel": { "$ref": "#/$defs/piThinkingLevel" } },
            "required": ["piThinkingLevel"]
          }
        }
      },
      "else": {
        "properties": {
          "piThinkingLevel": false,
          "expectedIdentity": { "type": ["object", "null"], "properties": { "piThinkingLevel": false } }
        }
      }
    },
    "claudeEffort": { "enum": ["low", "medium", "high", "xhigh", "max"] },
    "sessionOpenClaudeEffort": {
      "type": "object",
      "properties": { "claudeEffort": { "$ref": "#/$defs/claudeEffort" } },
      "if": { "properties": { "agent": { "const": "claude" } }, "required": ["agent"] },
      "then": { "properties": { "expectedIdentity": {
        "type": ["object", "null"], "properties": { "claudeEffort": { "$ref": "#/$defs/claudeEffort" } }
      } } },
      "else": { "properties": {
        "claudeEffort": false,
        "expectedIdentity": { "type": ["object", "null"], "properties": { "claudeEffort": false } }
      } }
    },
    "response": {
      "type": "object",
      "required": ["protocolVersion", "id", "ok"],
      "oneOf": [
        {
          "properties": {
            "ok": { "const": true },
            "result": { "type": "object" },
            "error": false
          },
          "required": ["result"]
        },
        {
          "properties": {
            "ok": { "const": false },
            "result": false,
            "error": { "type": "object" }
          },
          "required": ["error"]
        }
      ],
      "properties": {
        "protocolVersion": { "$ref": "#/$defs/protocolVersion" },
        "id": { "type": "integer", "minimum": 1 },
        "ok": { "type": "boolean" },
        "result": { "type": "object" },
        "error": {
          "type": "object",
          "required": ["code", "message", "retryable"],
          "properties": {
            "code": { "type": "string", "minLength": 1, "maxLength": 160 },
            "message": { "type": "string", "maxLength": 8192 },
            "retryable": { "type": "boolean" }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "event": {
      "type": "object",
      "required": [
        "protocolVersion",
        "sequence",
        "eventType",
        "runId",
        "turnId",
        "payload"
      ],
      "properties": {
        "protocolVersion": { "$ref": "#/$defs/protocolVersion" },
        "sequence": { "type": "integer", "minimum": 1 },
        "eventType": { "$ref": "#/$defs/eventType" },
        "runId": { "type": ["string", "null"], "maxLength": 160, "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$" },
        "turnId": { "type": ["string", "null"], "maxLength": 240, "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$" },
        "payload": { "type": "object" }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "if": { "properties": { "eventType": { "const": "runtime.rich_event" } } },
          "then": {
            "properties": {
              "runId": { "type": "string" },
              "turnId": { "type": "string" },
              "payload": { "$ref": "#/$defs/richEvent" }
            }
          }
        }
      ]
    },
    "richEvent": {
      "type": "object",
      "required": [
        "eventType",
        "itemId",
        "payload"
      ],
      "properties": {
        "eventType": {
          "enum": [
            "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"
          ]
        },
        "itemId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
        },
        "payload": {
          "type": "object"
        }
      },
      "additionalProperties": false
    },
    "turnControl": {
      "type": "object",
      "required": [
        "turnId",
        "controlId",
        "mode",
        "message"
      ],
      "properties": {
        "turnId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 240,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
        },
        "controlId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
        },
        "mode": {
          "enum": [
            "steer",
            "follow_up"
          ]
        },
        "message": {
          "type": "string",
          "minLength": 1,
          "maxLength": 65536
        }
      },
      "additionalProperties": false
    }
  }
}