Merge master into SSH agent account support

Keep the SSH base branch current so the dependent Tailscale migration can
be regenerated after the newly landed upstream migration. Preserve the
managed SSH account selection and remote session cleanup changes.

Verified the focused SSH, routing, and account probe tests, server
typecheck, and adapter-utils, Codex, and Claude package typechecks.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Devin FoleyandPaperclip committed 2026-11-12 19:04:45 -08:00
commit d59f9bbcee
191 files changed
+15683 -4374

No files matched your search

+1 -1
View File
@@ -895,7 +895,7 @@ bootstrap credentials in Paperclip secrets.
Per-company provider vaults (multiple vault instances per provider, default
vault selection, coming-soon GCP/Vault) can be configured from the board UI under
`Organization Settings → Secrets → Provider vaults` or through the provider-config CLI
`Organization Settings → Secrets → Vaults` or through the provider-config CLI
commands above. See the
[secrets deploy guide](../docs/deploy/secrets.md#provider-vaults) and
[API reference](../docs/api/secrets.md#provider-vaults) for the contract.
+1 -1
View File
@@ -4271,7 +4271,7 @@ CLI configuration support:
- Provider health is available at `GET /api/companies/:companyId/secret-providers/health` and reports local key permission warnings plus backup guidance.
Per-company provider vaults are configured in the board UI under
`Company Settings → Secrets → Provider vaults`, backed by
`Company Settings → Secrets → Vaults`, backed by
`/api/companies/{companyId}/secret-provider-configs`. The CLI does not own
vault lifecycle today. See `docs/deploy/secrets.md` (`Provider Vaults` section)
for the operator model.
+10
View File
@@ -77,6 +77,16 @@ Downstream deployment tooling must verify [source proof](cloud-build-readiness.m
the standard image attestation, the exact-source migrator, and its own composed
image before rollout. Resolve immutable digests instead of deploying mutable tags.
## Runner image
The `runner-artifacts` target builds the Runner alone: the daemon, the Runner
package's build output, the remote provider pack and its transport archives.
It does not depend on the server or UI build, and no other target depends on
it yet. `.github/workflows/runner-image.yml` builds and checks it on pull
requests, for Linux AMD64 and ARM64. See
[`doc/runner-image-contract.md`](runner-image-contract.md) for the layout, the
identity rules and how to consume the image.
## One-liner (build + run)
```sh
+1 -1
View File
@@ -13,7 +13,7 @@ Operational contract for the hosted `aws_secrets_manager` secret provider used b
copy plaintext into Paperclip.
- Per-company AWS provider vaults (named instances of `aws_secrets_manager`
with their own region, namespace, prefix, KMS key id, and tags) are managed
in the board UI under `Company Settings → Secrets → Provider vaults`. See
in the board UI under `Company Settings → Secrets → Vaults`. See
[Provider Vaults](../docs/deploy/secrets.md#provider-vaults) for the operator
model and [Provider Vaults API](../docs/api/secrets.md#provider-vaults) for
the routes. The bootstrap trust model in this document still applies — vault
+124
View File
@@ -0,0 +1,124 @@
# MCP Skills: skills that connected apps publish
Some MCP servers publish **skills** next to their tools: a `SKILL.md` with
instructions and, often, supporting files. When a connected app does, its skills
appear on the Skills page under **Skills from connected apps**. The board
reviews each one. Approved skills reach the agents that can use that app.
The first public server Paperclip was checked against is Hugging Face
(`https://huggingface.co/mcp`, no sign-in needed). It publishes 25 skills.
## The standard
These skills follow the **MCP Skills extension**:
- Specification: [SEP-2640, beta](https://github.com/modelcontextprotocol/ext-skills/blob/main/specification/beta/skills.mdx)
([overview](https://modelcontextprotocol.io/extensions/skills/overview)).
- Extension id: `io.modelcontextprotocol/skills`. It is defined for stateless MCP
(2026-07-28), so Paperclip only uses it with servers on that version. See
[MCP-PROTOCOL-VERSIONS.md](./MCP-PROTOCOL-VERSIONS.md).
- Skill format: [Agent Skills](https://agentskills.io/specification).
The protocol works like this:
1. **The server declares the extension** in `server/discover`:
`capabilities.extensions["io.modelcontextprotocol/skills"]`.
2. **The client declares it too**, in each request's
`_meta["io.modelcontextprotocol/clientCapabilities"].extensions`.
3. **`skills/list`** returns one entry per skill: the URI of its `SKILL.md`, its
frontmatter verbatim, and a complete manifest of its files
(`{uri, digest: "sha256:…", size}`), or `"dynamic"` for generated content.
The result carries `ttlMs` and `cacheScope`.
4. **`skills/get {uri}`** returns one entry in the same shape.
5. **Files are read with `resources/read`.** `resources/directory/read` is
optional; Paperclip does not use it, because the manifest already lists every
file.
## How Paperclip implements it
| Layer | What happens | Code |
| --- | --- | --- |
| Client capability | Every stateless request declares `io.modelcontextprotocol/skills`. Handshake (legacy) sessions do not. | `mcpClientCapabilities` in `server/src/services/mcp-http.ts` |
| Server capability | What `server/discover` advertised is remembered beside the connection's protocol version, so a refresh knows whether the server serves skills without asking again. | `rememberMcpServerCapabilities` in `mcp-http.ts` |
| Discovery | A catalog refresh lists skills (`skills/list`, paged) after the tool catalog, only when the server declared the extension. A listing within its `ttlMs` is reused and changes nothing. A skills failure never fails the tool refresh. Nothing runs while an agent run starts. | `discoverSkills` in `server/src/services/tool-access/catalog/discovery.ts`, `refreshSkills` in `catalog/publication.ts` |
| Record | One `tool_mcp_skills` row per skill, keyed by company, connection and skill URI. The name is a label only. The row keeps the verbatim frontmatter, the manifest sorted by URI, and the manifest digest. | `packages/db/src/schema/tool_access.ts`, `server/src/services/mcp-skills.ts` |
| Review | New skills wait for review. Approving binds to the manifest digest the board saw; a request with any other digest is refused (409). A changed manifest or frontmatter moves an approved skill back to review. Reordering the manifest is not a change. | `mcpSkillsService.applyEntry` and `approve` |
| Run time | When a run starts, approved skills of the connections the agent can use (tools allowed or Ask first, and a grant that resolves) are loaded. `SKILL.md` is read with the agent's own grant, checked, and cached. Each becomes a per-run skill bundle on the connector skill path. | `resolveConnectionSkillsForRun` in `server/src/services/tool-gateway.ts`, `server/src/services/mcp-skill-runtime.ts`, `heartbeat/execution-configuration.ts` |
| Supporting files | Bundles contain only `SKILL.md`. Agents read other files with `GET /api/agents/me/mcp-skills/:skillId/files?path=…`, which needs an active run, access to the app, and a path in the approved manifest. The sandbox bridge allows this route. | `server/src/routes/mcp-skills.ts`, `readConnectionSkillFile` |
| API (board) | `GET /api/companies/:companyId/mcp-skills`, `GET …/:skillId/content` (read `SKILL.md` before deciding, with the viewer's own access), `POST …/:skillId/approve` with `{manifestDigest, allowTools}`, `POST …/:skillId/decline`. | `server/src/routes/mcp-skills.ts` |
| UI | The Skills page lists connected-app skills with their app, state, size, requested tools and a plain-language note. It renders nothing when there are none. | `ui/src/components/skills/ConnectedAppSkills.tsx` |
## Security requirements and how each is met
The spec's host requirements were treated as day-one requirements.
- **Identity is (server, URI).** Rows, approvals, the file cache, the agent file
route and bundle paths are keyed by connection and URI (or by the skill row,
which is). Two apps can serve `skill://refunds/SKILL.md`; they are two skills.
- **No silent shadowing.** A connected app's skill runs under a name in that
app's namespace (`<app>-<skill>`). A remaining clash gets a suffix derived from
the connection and URI. Nothing replaces a company skill or another app's
skill. The board sees a note when names collide.
- **Verification before use.** Every file read checks the byte size, then the
SHA-256, against the approved manifest. `SKILL.md` frontmatter is parsed with
the skills system's own parser and compared field by field with the listed
frontmatter. A YAML form that parser cannot read faithfully fails closed.
Content that fails is never used. Paperclip calls `skills/get`; if the
manifest changed the skill goes back to review, and if the same manifest
served different bytes the skill is taken out of use (`verification_failed`).
An unknown skill (`-32602`) is marked as removed.
- **Reads stay in the manifest and in the origin.** Only listed files are read,
and only through the skill's own connection. A path outside the skill root or
not in the manifest is refused.
- **Lazy retrieval.** Listing, approving and reviewing fetch no files. `SKILL.md`
is fetched when a run loads the skill (or when the board opens it to read);
a supporting file when an agent reads it.
- **Content-bound approval.** Approval binds to every `{uri, digest, size}` in the
manifest. Any other manifest revokes it and is logged
(`tool_mcp_skill.approval_revoked`).
- **Untrusted content, tagged origin.** Each bundle starts with a note naming the
app and the skill URI and saying the instructions come from that app. The
description ends with "(Skill from the <app> app.)".
- **No implicit permission grants.** Paperclip writes the bundle's frontmatter
itself: `name`, `description`, and `allowed-tools` only when the board ticked
"Also let it use" when approving. Other frontmatter fields from the app (hooks,
metadata and so on) never reach the agent's skill loader. A nested `SKILL.md`
is listed as a reference file, not a skill.
- **No implicit execution.** Approval is explicit and per skill. The approval
note says agents may follow the skill's instructions, including commands.
- **Cache integrity.** Verified bytes live in `tool_mcp_skill_files`, written only
by the server, keyed by connection, URI and digest, never changed in place, and
re-hashed on every read. Nothing scans it for skills. Deleting a connection
deletes its skills and cached files.
- **Dynamic skills are declined.** A `"dynamic"` skill has no digests, so it is
shown as not available with a note and cannot be approved. Skills over the
spec limits (512 files or 16 MiB) or with an invalid entry are shown the same
way with their reason.
## Governance
Approving or declining is a skill install decision. It needs board access, the
`skill_config:update` permission, and the company skill policy's
`skills.install` for source type `external_package` with source locator
`mcp-connection:<connectionId>`. A policy rule can therefore block skills from
one app or from all connected apps.
## Performance
A run in a company without an approved connected-app skill pays one indexed
read. With approved skills, loading runs in parallel with the other skill
preparation. Against Hugging Face, loading three approved skills took 135 ms
cold and 13 ms from the cache. A run waits at most 3 seconds for connected-app
skills. A skill that cannot load in that time, or at all, is left out with a run
warning (`skills.mcp_unavailable`); it never fails the run. A read still in
flight at the deadline finishes in the background and fills the cache, so the
next run has the skill.
## Not yet supported
- Opting in to dynamic skills per connection.
- Serving Paperclip's own company skills from its MCP endpoint
(`server/src/routes/public-mcp.ts`).
- `resources/directory/read`, and loading a skill by URI from server
instructions without a listing.
- Showing connected-app skills on an agent's skills tab.
+4
View File
@@ -17,6 +17,10 @@ Runtime authentication: [AI Connections](./AI-CONNECTIONS.md).
MCP protocol versions (2026-07-28 stateless MCP and older handshake servers):
[MCP-PROTOCOL-VERSIONS.md](./MCP-PROTOCOL-VERSIONS.md).
MCP extensions: [MCP Apps](./MCP-APPS.md) (interactive views in the task chat)
and [MCP Skills](./MCP-SKILLS.md) (skills that connected apps publish, reviewed
by the board and delivered to agents).
Long-term memory: [Experimental memory connectors](./MEMORY.md).
Provider notes: [Google Workspace](./GOOGLE-WORKSPACE.md),
+6
View File
@@ -1126,6 +1126,12 @@ evidence, unknown binding reasons, secret-provider failures, ambiguous missing
secret-definition lookups remain reportable. This filter does not change task
recovery, credentials, or execution policy.
Native `native_provider_usage_limit` failures also stay on the task when their
typed provider failure is `quota_exhausted` or `rate_limit`. The task keeps its
blocked state and quota cooldown. Setup failures, interrupted processes, missing
or malformed provider evidence, and other failure categories still report.
`all` mode also reports typed native usage limits.
AI account selection also stays local when the selection service proves a
missing responsible user, personal default, or selected connection; an
incompatible selection; an account that needs reconnection; or an active
+23
View File
@@ -1024,6 +1024,29 @@ comments one run read, with each read's time and the comment revision it saw,
whatever the run's outcome. A failure to write the event leaves the comment
owed in the same way.
When a run reads a finished child task, the server writes one
`child_task.read` event (`stream: "system"`, level `info`) to that run's log.
The reads that count are `get_task_context` on the parent task, and a
successful agent request with a run token for `GET /api/issues/:id`,
`GET /api/issues/:id/documents` or `GET /api/issues/:id/documents/:key` of a
child in `done`. The route writes the event only after the requested content
has loaded, so a 400 or 404 records nothing. The payload has `parentIssueId`
and `children`, which maps each finished child ID to the revision the run
received: its `status`, `updatedAt` and `statusDecisionId`. It contains no
titles, summaries or document bodies. The event creates no Telemetry or
OpenTelemetry export.
`hasPendingNativeChildCompletion` reads this event. A child-completion wake no
longer keeps the parent's done claim open when the finishing run received that
child in `done` at the completion the wake reports: the received
`statusDecisionId` is the wake's completion decision, or the received
`updatedAt` is at or after that decision was saved. The event's own write time
does not count, so a delayed write of an older revision cannot deliver a newer
completion. The wake is then cancelled at release instead of starting another
parent turn. A read while the child was still open, a read of an older
revision, a read by another run, or a failure to write the event leaves the
child result owed.
## Managed Agent File Save Receipts
The server writes `instruction_save` after managed file collection or a warm
+127
View File
@@ -0,0 +1,127 @@
# Runner image contract
The Runner image is the Runner built alone, as a plain file tree with no
entrypoint and no operating system: the `runner-artifacts` target of the
`Dockerfile`. An image build copies paths out of it instead of compiling the
Runner again. Its name is `ghcr.io/paperclipai/paperclip-runner`. Nothing in
this repository consumes it yet.
Nothing publishes it yet: `.github/workflows/runner-image.yml` builds and
checks it.
## Layout
Every path a consumer may copy (`RUNNER_IMAGE_PATHS` in
`scripts/runner-image-layout.mjs`). Every file is readable by every user.
| Path | Content |
| --- | --- |
| `/runner-image.json` | Identity and description of this image. |
| `/paperclip-runnerd` | The daemon. A stripped release binary, mode `0755`. |
| `/provider-pack/` | The remote provider pack, with `provider-pack.json`. |
| `/provider-pack.archive.json` | Receipt of the pack's transport archives. |
| `/provider-pack.archives/` | The transport archives the receipt lists. |
| `/runner-package/package.json` | The Runner package manifest. |
| `/runner-package/dist/` | The Runner's complete build output. `dist/bin/paperclip-runnerd` is the same file as `/paperclip-runnerd`. |
| `/runner-package/node_modules/.cache/paperclip-runner-build-inputs.json` | The build stamp the Runner's build recorded for that output. |
| `/runner-package/scripts/provision-grok.mjs` | Provisions the native Grok executable. Reads `platforms.json` by relative path. |
| `/runner-package/src/providers/grok/platforms.json` | The Grok release pins. |
| `/runner-package/src/live/runnerd-codex-transport.ts` | The transport source, as a contract file. It defines `RUNNER_CLIENT_VERSION`. |
| `/bundles/runnerd-codex-transport.mjs` | The pack's `dist/live/runnerd-codex-transport.js` as one module. It imports without `node_modules`. |
| `/pnpm-lock.yaml` | The lockfile the image was installed from. |
Paths under `/runner-package/` keep their place inside
`packages/paperclip-runner`. `runner-image.json` describes one platform:
- `inputsDigest` (the identity below) and `buildInputsDigest` (the digest in
the Runner's build stamp);
- `sourceRevision`: the commit given to the build, also in the pack as
`payload.runnerSourceRevision`;
- `publication`: `true` only for a build with the build argument
`PAPERCLIP_RUNNER_IMAGE_PUBLICATION=1`. Only then does the pack carry the
identity, as `payload.runnerInputsDigest`. Another image build that runs
the stage inline builds the same Runner but is not this image;
- `platform` (`linux`, `amd64` or `arm64`) and `libc`: the glibc the daemon
was compiled on (Debian bookworm, the oldest a consumer runs) and the
newest glibc version it needs;
- `providerPack`: the pack's digest and target;
- `paths` and `sha256`: the table above, and the digest of every single file.
## Identity
An image is named `inputs-<digest>`. `scripts/runner-image-identity.mjs`
computes the digest from:
- every file under the paths the build copies from the build context
(`RUNNER_IMAGE_CONTEXT_INPUTS`, which include `pnpm-lock.yaml`): path,
executable bit and content, and each symbolic link by its target;
- the whole `Dockerfile`: the recipe, the base image pinned by digest and the
toolchain pins. Any edit to it makes a new image;
- the two platforms, `linux/amd64` and `linux/arm64`.
The source revision is not part of it, and neither is the text of
`.dockerignore`: a rule changes the digest only when it changes which of
those files the build receives. The build computes the digest for itself:
```sh
docker buildx build --target runner-artifacts-identity --output type=local,dest=/tmp/identity .
jq -r .digest /tmp/identity/runner-image-identity.json
```
The install is frozen. It fails when the lockfile is behind the manifests the
build reads (the root one, `packages/paperclip-runner` and
`packages/paperclip-eval-kernel`). A contributor cannot edit the lockfile, so
pull-request runs resolve it first. For a local build, run
`pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile`.
## Checks
`node scripts/runner-image-layout.mjs check <tree>` runs in the build and
again on the exported tree. It fails unless:
- every documented path exists, matches its digest in `runner-image.json`,
and resolves inside the tree;
- the build stamp names the inputs the identity names;
- every artifact in `provider-pack.json` has its digest, the `dist` tree and
each provider asset tree match their tree digests, and the pack names this
image's revision and platform;
- the pack names the inputs digest in a publication build and in no other.
`--expect-inputs-digest` fails on any other build;
- every transport archive matches its receipt, and the archives
extract to the pack. The check extracts them as a sandbox does (GNU tar
with the options in `provider-pack-layers.ts`) and compares paths, content,
link targets and all twelve permission bits, after the `a+rX` grant the
build makes once the archives are written.
The build also runs `paperclip-runnerd --build-metadata` on every base image
in `docker/runner-image/Dockerfile.smoke`. Add a base there before a consumer
uses it.
## Consuming the image
Read the image only with `COPY --from`, and pin it by digest:
```dockerfile
FROM ghcr.io/paperclipai/paperclip-runner@sha256:<digest> AS runner-artifacts
FROM debian:trixie-slim
COPY --from=runner-artifacts /paperclip-runnerd /usr/local/bin/paperclip-runnerd
```
A Dockerfile with a `runner-artifacts` stage of its own, as in this
repository, can take a built image or tree in its place with
`--build-context runner-artifacts=<image or directory>`. The stage is then
not built.
## Known limits
- A build without `PAPERCLIP_RUNNER_SOURCE_REVISION` or
`PAPERCLIP_BUILD_COMMIT` has no pack. It is for local use.
- The build runs the steps of the Runner's `build` script that write output,
not its drift checks; repository CI runs those.
- A build that vendors `/runner-package/` reuses `dist` only when its own
Runner build-inputs digest equals the stamp's. The image computes that
digest in the `.dockerignore`-filtered context; a checkout gives another.
- `# syntax=docker/dockerfile:1.20` is a tag. A new frontend release under it
does not change the identity.
- The archive check does not tell a directory with its own archive member
from one created only as a file's parent.