Files
PaperClipAI/packages/paperclip-runner/src/protocol-actions/call-api.ts
T
DottaandPaperclip fc3b15537b fix(runner): match call_api to existing agent REST permissions (#16040)
Route native call_api through existing agent REST permissions. Preserve admitted credentials across restarts, protect sensitive replies and private snapshots, and compare saved completion with provider history through the same redaction projection. Add permission, privacy and recovery regressions and update the access map and run-log guide.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-13 07:34:15 -05:00

156 lines
5.7 KiB
TypeScript

/** Canonical production API fallback contract. */
export const callApiAction = {
"id": "call_api",
"canonical": {
"operationId": "call_api",
"surfaces": [
"live"
],
"placement": "optional_agent_tool",
"optionalGroup": "discovery",
"requiredClaims": [
"api:call"
],
"taskModes": [
"standard",
"ask",
"planning",
"skill_test"
],
"sideEffectClass": "company_write",
"idempotency": "none",
"disabledByDefault": false,
"realBindingStatus": "live_codex",
"realServiceBinding": "PaperclipRunnerToolAuthority",
"prpEvidence": "Authenticated PRP tool input/result and existing HTTP route authorization/activity records.",
"prpBindingStatus": "bound",
"legacyAliases": []
},
"documentation": {
"title": "Call the Paperclip API",
"description": "Fallback only: call a discovered Paperclip API operation when dedicated tools lack the required operation or parameters. Uses the same route permissions as agent REST access. Prefer dedicated tools for common workflows; route denials still apply. For large text responses, read the returned artifact with GET /api/assets/{assetId}/content and responseText; follow nextOffsetBytes until null.",
"note": "Production HTTP fallback; does not grant privileges or replace dedicated tools."
},
"examples": {
"call": {
"operationId": "call_api",
"input": {
"operationId": "GET /api/companies/{companyId}/projects"
}
},
"success": {
"ok": true,
"operationId": "call_api",
"result": {}
}
},
"live": {
"order": 41,
"descriptor": {
"schema": "paperclip.semantic-tool.v1",
"operationId": "call_api",
"version": 1,
"title": "Call the Paperclip API",
"description": "Fallback only: call a discovered Paperclip API operation when dedicated tools lack the required operation or parameters. Uses the same route permissions as agent REST access. Prefer dedicated tools for common workflows; route denials still apply. For large text responses, read the returned artifact with GET /api/assets/{assetId}/content and responseText; follow nextOffsetBytes until null.",
"exposure": "optional",
"requiredClaims": [
"api:call"
],
"allowedModes": [
"standard",
"ask",
"planning",
"skill_test"
],
"inputSchema": {
"type": "object",
"properties": {
"operationId": {
"description": "Exact operationId returned by search_api, for example GET /api/projects/{id}. Do not guess identifiers.",
"type": "string",
"minLength": 1,
"maxLength": 500
},
"pathParams": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"query": {
"type": "object",
"additionalProperties": true
},
"body": {
"description": "Request value matching the discovered schema. For JSON object or array requests, pass the object or array directly, never a JSON-encoded string. Strings are for text bodies or endpoints whose schema explicitly accepts a string.",
"anyOf": [
{ "type": "object", "additionalProperties": true },
{ "type": "array", "items": {} },
{ "type": "string" },
{ "type": "number" },
{ "type": "boolean" },
{ "type": "null" }
]
},
"contentType": {
"type": "string",
"maxLength": 120
},
"responseText": {
"description": "GET only: return a bounded UTF-8 text window inline, including JSON as text, without saving another artifact. Offsets and limits are bytes. Use the returned nextOffsetBytes to continue; null means complete. Prefer reading a saved artifact for a stable snapshot. New live responses have a 1 GiB capture limit and a 4 GiB per-run capture budget. Existing larger assets remain readable in bounded pages. If a live response returns an artifact, continue on its content operation for a stable snapshot.",
"type": "object",
"properties": {
"offsetBytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991, "default": 0 },
"limitBytes": { "type": "integer", "minimum": 4, "maximum": 24576, "default": 24576 }
},
"additionalProperties": false
},
"files": {
"type": "array",
"maxItems": 10,
"items": {
"type": "object",
"properties": {
"field": {
"type": "string"
},
"artifactId": {
"type": "string"
},
"path": {
"type": "string",
"description": "File relative to the active issue workspace. Remote files must first be uploaded as an artifact."
}
},
"additionalProperties": false,
"oneOf": [
{
"properties": { "artifactId": {} },
"required": [
"artifactId"
]
},
{
"properties": { "path": {} },
"required": [
"path"
]
}
]
}
}
},
"required": [
"operationId"
],
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"additionalProperties": true
}
}
},
"scenario": null
} as const;