Files
paperclip-docs/docs/reference/api/instance-admin.md
c65bc9a9bf Release docs for paperclip v2026.916.0 (#125)
Brings **paperclip-docs** in line with paperclip **v2026.916.0**,
shipping the `v2026.831.1 → v2026.916.0` cycle drafted on `nightly`,
stamped to the release tag, with a documentation changelog entry.

This branch was cut from `nightly` **after** merging `origin/main` into
it, so it sits on top of the operator-first connectors catalog (#124)
rather than reverting it.

## Manifest

**New pages (4)**
- `docs/reference/api/connection-intents.md` — Connection Intents API
- `docs/reference/cli/connections.md` — `connections` command
- `docs/reference/cli/managed-agent.md` — `managed-agent` command
- `docs/reference/cli/test-drive.md` — `test-drive` command

**Updated pages (17)**
- Roles & Permissions + Company Administration — `tools:*` role-default
changes
- Connect an Agent to GitHub — managed GitHub connection (Connectors),
Option C
- Agents API — Managed/Remote Agent Profiles, `***REDACTED***` env
serialization
- Tool Gateway API — agent self-authorization (`start-authorization`,
`token`)
- Instance Admin API — instance-settings + task-drain routes
- Plugin SDK — `ctx.access` + `ctx.authorization` clients,
login-PTY/duplex streaming
- Environment Variables — Paperclip ID Connector block + HTTP adapter
allowlist var
- Adapters: Codex (`gpt-5.6-sol` default, Fast mode, auth cache), Claude
Code (Fable 5.1 + CLI floor), Grok Local (SuperGrok subscription auth),
HTTP (SSRF guard), Sandbox Providers (Daytona warm runner), OpenCode
(model pre-flight)
- CLI: `adapter detect-model`, `onboard` tool-action signing secret
- Command palette — recent tasks in sidebar
- `docs/reference/changelog.md` — new `v2026.916.0` accordion entry

All 21 touched pages stamped `paperclip_version: v2026.916.0`.

## Verification

**Tag-accuracy gate (Phase 5.7)** — `check-tag-accuracy.mjs --tag
v2026.916.0 --base main --head nightly` flagged 5 pages, **every one
verified present in the code at the release tag** and cleared as known
`verify-edit` false-positive classes. No content was quarantined; **no
post-tag leaks**:

| Page | Flagged claim(s) | Verified at tag |
|---|---|---|
| `cli/connections.md` | `PAPERCLIP_RUNTIME_TOOLS_*` (3) | present in
`cli/src/commands/client/connections.ts` (runtime-injected env) |
| `cli/managed-agent.md` | `--profile-key`, `--api-key-secret-id` |
present in `cli/src/commands/managed-agent.ts`
(`.requiredOption`/`.option`) |
| `cli/test-drive.md` | `--harness` | present in
`cli/src/commands/test-drive.ts` (`new Option`) |
| `deploy/environment-variables.md` | `PAPERCLIP_ID_CONNECTOR_*` (5) |
present in `.env.example` at tag |
| `plugins/sdk.md` | `PLUGIN_*` (6) | present in
`packages/plugins/sdk/src/index.ts` (exported constants) |

Rationale: nightly's drafts were authored from parent `af8439a`, **226
commits inside the tag**, so they document in-tag surfaces by
construction.

### ⚠ Drift
`check-drift.mjs --against v2026.916.0` returned 14 records — **all
verified present at the tag** (checker false positives), listed here for
the reviewer to confirm:

- **env-var (9, high-confidence in the tool, verified present):**
`PAPERCLIP_WORKSPACE_GIT_SCAN_{CONCURRENCY,QUEUE_CAPACITY,TIMEOUT_MS,CACHE_TTL_MS}`
and
`PAPERCLIP_ID_CONNECTOR_{BASE_URL,ENVIRONMENT,INSTANCE_ID,SIGN_PRIVATE_KEY,SEAL_PRIVATE_KEY}`
— all present in `.env.example` at the tag; the drift scanner's scoped
file scan missed them.
- **Verify: rest-route (5, medium-confidence):** `POST/PUT/GET
/api/companies/import/transfers*` — present at the tag in
`server/src/routes/companies.ts`, registered via the
`COMPANY_IMPORT_TRANSFERS_ROUTE_PATH` prefix constant (the documented
prefix/dynamic-registration blind spot).

### ⚠ Verification Failures
None. All tag-accuracy and drift flags above were verified present at
the tag.

### ↻ Renames detected
None. The connectors catalog (`docs/connectors/**`) arrived via the
`main` merge (#124), not as a renamed surface; no new top-level draft
directories were introduced this cycle.

## Screenshots
**238 of 342 screenshots** flagged stale across 50 routes (see
`SCREENSHOTS_PENDING.md`). This is a wide 16-day window touching ~921 UI
files, so most are dependency-touch flags rather than confirmed visual
changes. Recommend `npm run screenshots:refresh` on this release branch
as a dedicated follow-up before merge; PNGs go to a separate PR for
human review.

## Build gates (all green on this branch)
- `npm run docs:build` — 257 pages
- `npm run docs:test` — SEO metadata, crawlable-links (71,749 links
resolve), doc-link-resolution, skill-source-blocks, static-routes,
hierarchical-nav

## Post-merge checklist (Phase 9 — do NOT skip)
- [ ] Squash-merge this PR (repo is squash-only)
- [ ] `git checkout main && git pull`
- [ ] `git tag docs/v2026.916.0 && git push --tags`
- [ ] `node scripts/sync/realign-nightly.mjs release/v2026.916.0 --push`
(restore ancestry; keep nightly post-tag drafts)
- [ ] Flip `nightly` `.sync-state.json` back to `"branch_mode":
"nightly"` (leave `base_release_tag` at `v2026.916.0`)
- [ ] Verify `docs.paperclip.ing` serves the release: a new page
(`/reference/cli/test-drive/`), a changed page, and the changelog top
entry reads `Docs for v2026.916.0`
- [ ] If production is stale, republish: `npm run docs:build && npx
wrangler pages deploy .site --project-name paperclip-docs --branch main`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: DevRel Gemini <[email protected]>
Co-authored-by: Paperclip <[email protected]>
Co-authored-by: Dotta <[email protected]>
Co-authored-by: ClaudeCoder <[email protected]>
2026-09-17 11:15:48 +02:00

138 lines
8.7 KiB
Markdown

---
paperclip_version: v2026.916.0
seo_title: Instance Admin API
seo_description: Instance-scoped endpoints that fit nowhere else: general and experimental settings, on-demand database backups, and the LLM reflection endpoint.
---
# Instance Admin API
A grab-bag of instance-scoped REST endpoints that don't fit neatly into the other API pages: general and experimental instance settings, on-demand database backups, the LLM reflection endpoints, environments (sandbox/runtime drivers), and execution-workspace lifecycle.
These surfaces are stable enough to call from your own tooling, but they are intentionally narrow — most operators reach them through the UI, the CLI, or via the `paperclipai doctor` command rather than by hand.
> All routes are mounted under `/api`. Most require instance-admin or board authentication; per-route notes call out exceptions.
---
## Instance settings
| Endpoint | Purpose |
|---|---|
| `GET /api/instance/settings` | Read the full instance-settings record (general and experimental blocks together, plus the instance default environment). Readable by any authenticated org member. |
| `PATCH /api/instance/settings` | Update the settings record. Body is validated against `patchInstanceSettingsSchema`. Setting `defaultEnvironmentId` picks the instance default execution environment. |
| `GET /api/instance/settings/general` | Read general instance settings (display name, defaults, etc.). |
| `PATCH /api/instance/settings/general` | Update general settings. Body is validated against `patchInstanceGeneralSettingsSchema`. |
| `GET /api/instance/settings/experimental` | Read the experimental-features block. |
| `PATCH /api/instance/settings/experimental` | Toggle experimental features. Body is validated against `patchInstanceExperimentalSettingsSchema`. |
The two `GET` routes only need authenticated org access; every `PATCH` requires instance-admin (a `local_implicit` board session in local trusted mode also passes). On a cloud-managed instance the platform pins `executionMode` in general settings, so an attempt to change it returns `403` with code `execution_mode_platform_managed`; settings the hosting operator has hidden are likewise floored with code `settings_operator_managed`, though a same-value write always passes.
The experimental-settings response and patch body include `enableBuiltInAgents` as a boolean. Set it to `true` before using the [Built-in Agents API](./built-in-agents.md); while it is off, those routes return `404 Not Found`.
---
## Task drain
Task drain is an instance-wide pause on picking up new work: while it is on, agents stop being handed fresh tasks so you can wind the instance down cleanly (before a restart or maintenance window, say) without cancelling what is already running.
| Endpoint | Purpose |
|---|---|
| `GET /api/instance/task-drain` | Read the current drain status (whether draining, and when it started/expires). Readable by any authenticated org member. |
| `POST /api/instance/task-drain` | Start (or refresh) a drain. Body is validated against `startTaskDrainRequestSchema`; pass an optional `ttlMs` to have the drain expire automatically after that many milliseconds, or omit it for a drain that stays on until you stop it. Returns the resulting drain state. |
| `DELETE /api/instance/task-drain` | Stop draining. Returns `{ "wasActive": <boolean> }` — whether a drain was in effect when you called. |
Reading the status needs only authenticated org access; starting and stopping a drain require instance-admin. Overlapping start/stop calls are serialised, so the audit log and the live drain state always agree.
---
## Database backups
```
POST /api/instance/database-backups
```
Trigger a manual database backup. Returns a structured result that includes the backup directory, retention policy, and timing. Scheduled backups follow the same code path but are not exposed as a separate route.
Instance-admin only.
---
## Claim first instance admin
```
POST /api/bootstrap/claim
```
On a brand-new private instance that requires login, this lets the first person to sign in promote themselves to `instance_admin` — no manual database seeding. The first caller to claim wins; everyone after them is locked out.
**Availability.** This route only exists when the instance runs with `deploymentMode` set to `authenticated` **and** `deploymentExposure` set to `private`. On any other configuration it returns `404` with `Browser first-admin claim is not available`.
**Cloud-managed instances.** If your instance is managed by a Paperclip control plane rather than run by you, you never meet this claim screen at all — the instance comes up ready to use. The control plane owns identity there, and the users it signs in are deliberately never given the `instance_admin` role, so `GET /api/health` skips the first-admin check entirely and always reports `bootstrapStatus: "ready"`. Self-hosted instances are unaffected: if you run the server yourself, the claim flow behaves exactly as described here.
**Authentication.** The caller must be a signed-in browser session (a board actor whose session source is the browser). Other callers — agents, CLI tokens, unauthenticated requests — get `401` with `Sign in from a browser session before claiming first admin`.
**Behaviour.** If no `instance_admin` exists yet, the signed-in user is promoted to `instance_admin`. The claim is atomic — the table is locked so exactly one user can win. If the instance has already been claimed, the route returns `409` with `Someone else has already claimed this instance`.
The request takes no body. On success the response is:
```json
{ "claimed": true, "userId": "<the promoted user's id>" }
```
---
## LLM agent-configuration reflection
These endpoints exist so agents can introspect what server-side adapters and icons are available to them.
| Endpoint | Purpose |
|---|---|
| `GET /api/llms/agent-configuration.txt` | Plain-text dump of available agent adapters and their declared shape. |
| `GET /api/llms/agent-configuration/:adapterType.txt` | Same, scoped to one adapter type. |
| `GET /api/llms/agent-icons.txt` | List of supported agent-icon names (`AGENT_ICON_NAMES`). |
Access is limited to board callers and agents whose permissions include `canCreateAgents` — the routes return `403` otherwise.
---
## Environments
Environments are the plugin-managed execution backends declared by environment-driver plugins (custom sandboxes, runners, etc.).
| Endpoint | Purpose |
|---|---|
| `GET /api/companies/:companyId/environments` | List configured environments for the company. |
| `GET /api/companies/:companyId/environments/capabilities` | List the capabilities reported by available environment drivers. |
| `POST /api/companies/:companyId/environments` | Create an environment. Body validated against `createEnvironmentSchema`. |
| `POST /api/companies/:companyId/environments/probe-config` | Probe a candidate environment config without persisting. Body validated against `probeEnvironmentConfigSchema`. |
| `GET /api/environments/:id` | Read one environment. |
| `PATCH /api/environments/:id` | Update an environment. Body validated against `updateEnvironmentSchema`. |
| `DELETE /api/environments/:id` | Delete an environment. |
| `POST /api/environments/:id/probe` | Probe an existing environment (driver health check). |
| `GET /api/environments/:id/leases` | List active leases on the environment. |
| `GET /api/environment-leases/:leaseId` | Read a single lease. |
---
## Execution workspaces
Execution workspaces are the materialised working directories Paperclip creates for an issue run.
| Endpoint | Purpose |
|---|---|
| `GET /api/companies/:companyId/execution-workspaces` | List execution workspaces for the company. |
| `GET /api/execution-workspaces/:id` | Read one workspace. |
| `GET /api/execution-workspaces/:id/close-readiness` | Whether the workspace is safe to close (no pending operations, no dirty state). |
| `GET /api/execution-workspaces/:id/workspace-operations` | List the operations recorded against the workspace. |
| `PATCH /api/execution-workspaces/:id` | Update a workspace. Body validated against `updateExecutionWorkspaceSchema`. |
| `POST /api/execution-workspaces/:id/runtime-services/:action` | Run a runtime-service control action against the workspace. |
| `POST /api/execution-workspaces/:id/runtime-commands/:action` | Run a runtime-command control action against the workspace. Both routes share the `workspaceRuntimeControlTargetSchema` body and the same handler. |
---
## Related
- [Reference → Adapters API](./adapters.md) — adapter registry endpoints.
- [Reference → Plugins API](./plugins.md) — plugin install and lifecycle.
- [Reference → Deployment → Environment Variables](../deploy/environment-variables.md) — the env-vars these admin surfaces interact with.