paperclip/packages/paperclip-runner
Dotta 4eb32d7532
Add collaboration action contracts (#12359)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Agents collaborate through discovery, delegation, dependencies, and
governed approvals
> - These optional operations need stable contracts before any run may
discover them
> - The core action contracts are already isolated in the lower stack
> - This pull request adds the 13 collaboration and governance action
definitions
> - It does not grant claims or bind production services
> - The benefit is a reviewable contract layer for later run-scoped
authorization

## Linked Issues or Issue Description

**Subsystem affected**

packages/paperclip-runner protocol action contracts

**Problem or motivation**

Optional collaboration operations need one provider-neutral definition
for policy metadata, documentation, live and scenario schemas, and
canonical examples.

**Proposed solution**

Add one immutable module for each discovery, delegation, dependency, and
governance action. Add a collaboration aggregate and validate all
examples with JSON Schema.

**Alternatives considered**

These contracts could land with executable authorization. That would
make contract review depend on runtime policy and server service
bindings.

**Roadmap alignment**

This supports the existing experimental Paperclip Runner rollout. It
does not make any optional operation discoverable or invocable.

## What Changed

- Add 13 collaboration and governance action definitions.
- Add immutable policy, schema, documentation, and example data.
- Add a collaboration-only aggregate.
- Validate every action example against its declared schema.

## Verification

- `pnpm --filter @paperclipai/paperclip-runner test:typescript`
- `pnpm --filter @paperclipai/paperclip-runner typecheck:typescript`
- `pnpm -r typecheck`
- `pnpm build`
- The branch changes 15 files relative to its declared base.

## Risks

Low production risk. The declarations do not grant claims or contain
executable service bindings. Tests require optional placement, immutable
metadata, stable identities, and schema-valid examples.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

OpenAI Codex, `gpt-5`, with agentic reasoning, tool use, and code
execution.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either linked an existing public issue or described the
issue in-PR
- [x] I have not referenced internal or instance-local Paperclip issues
or links
- [x] My branch name describes the change and contains no internal
Paperclip ticket id
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
2026-08-29 23:13:49 -05:00
..
generated Add canonical semantic action catalog to Paperclip Runner (#12121) 2026-08-24 16:26:21 -05:00
protocol Add durable semantic tool receipts (#12353) 2026-08-29 21:48:06 -05:00
runner feat(runner): project native runs into task threads (#12321) 2026-08-29 19:26:20 -05:00
scripts Add durable semantic tool receipts (#12353) 2026-08-29 21:48:06 -05:00
src Add collaboration action contracts (#12359) 2026-08-29 23:13:49 -05:00
test feat(runner): normalize provider event contracts (#12350) 2026-08-29 19:44:24 -05:00
.gitignore Add local fake runner supervision (#12095) 2026-08-24 12:16:48 -05:00
README.md feat(runner): add flagged Codex execution adapter (#12188) 2026-08-25 16:03:41 -05:00
SEMANTIC_ACTIONS.md feat(runner): authorize semantic tool dispatch (#12126) 2026-08-24 17:28:54 -05:00
package.json build(deps-dev): bump typescript from 5.9.3 to 7.0.2 (#11880) 2026-08-25 14:49:05 -07:00
rust-toolchain.toml feat(runner): define package API and verification boundary (#12129) 2026-08-25 09:31:48 -05:00
tsconfig.json Add TypeScript PRP replay contracts (#12091) 2026-08-24 10:43:53 -05:00
vitest.config.ts Add TypeScript PRP replay contracts (#12091) 2026-08-24 10:43:53 -05:00

README.md

Paperclip Runner

This private workspace package contains the staged Paperclip Runner work.

The package currently exposes the language-neutral PRP v1 TypeScript contract, provider-neutral structured questions and responses, deterministic fixture validation/replay, structured-result normalization, and the session reducer oracle. It also contains a package-local Rust runner, scripted fake harness, bounded process supervisor, cross-language replay oracle, and durable PRP transport. The transport authenticates and encrypts loopback WebSocket sessions, persists an ACK-driven outbox and command journal, and reconnects with a short-lived lease. The Rust runner now includes a Codex-only app-server provider bridge with durable thread resume, cancellation, structured questions, and provider-neutral event normalization. The root surface now also exposes an authenticated durable PRP authority for server-side use. It stores only bootstrap and reconnect credential digests, validates immutable run identity on every connection and event, and persists commands and cumulative event ACK state across server restarts. The package also publishes the canonical semantic action declarations and their input and output schemas. Its package-local dispatcher projects only bound, run-authorized actions and emits redacted semantic receipts.

The first and only installed provider is Codex. Dynamic semantic tools remain undiscoverable unless the hidden server coordinator projects one of the five same-task read bindings for an already persisted native Codex run. Catalog membership alone does not grant authority. The server can now create and start a Codex-backed native run only through the default-off paperclip_runner adapter. See SEMANTIC_ACTIONS.md for the catalog boundary.

The package has two initial public surfaces:

  • @paperclipai/paperclip-runner contains runtime contracts, validation, replay/reducer logic, the semantic catalog, the authorization dispatcher, and the Node-only durable server authority.
  • @paperclipai/paperclip-runner/testing adds Node-only fixture loading and a provider-neutral semantic conformance kit for deterministic test adapters.

No SDK, browser, React, eval, live-console, lab, or provider-experiment entry point is exported. The package remains private in this wave. The server route at /api/runner/v1/connect/:runId has no authority until the hidden coordinator registers an exact existing run binding. Fresh native starts are rejected unless the instance enableNativeRunner flag is enabled. Existing direct adapters keep their original execution path.

The package build compiles the release paperclip-runnerd executable and stages it under dist/bin. The normal server build vendors that directory, so an installed server does not depend on a separate system Rust installation or a manually copied binary. pnpm-lock.yaml remains under the repository's existing lockfile process.

Run the complete contract gate with:

pnpm --filter @paperclipai/paperclip-runner check:protocol

Run the Rust runner gate with:

pnpm --filter @paperclipai/paperclip-runner check:runner

This command checks Rust formatting, builds and tests the minimal workspace in release mode, verifies bounded process cleanup, launches the real paperclip-runnerd binary through the fake harness, and compares the Rust conformance and replay summaries with the shared fixtures. The checked-in Cargo lock and pinned Rust toolchain keep this verification reproducible.

Durability and failure semantics are documented in runner/DURABLE_TRANSPORT.md. The fault suite drops a connection before its event ACK, reconnects with the bound lease, replays the same event, and proves the duplicated command effect ran once. Codex launch, resume, cancellation, and normalization behavior is documented in runner/CODEX_PROVIDER.md.

Use generate:protocol-manifest after a schema or fixture change, generate:protocol-types after a schema change, and generate:replay-goldens after an intentional reducer change. Commit generated outputs with their sources; do not edit them by hand.

Use generate:semantic-action-catalog after changing a semantic action declaration. Its checked-in JSON inventory must land with the source change.

The gate compiles every schema with AJV 2020-12, validates accepted fixtures, rejects unsupported required versions, checks generated TypeScript schema drift, runs the TypeScript contract tests, and compares reducer snapshots and parity summaries byte-for-byte with their checked-in golden files.