paperclip/packages/adapter-utils/src
Dotta b3343dbd64
feat(connections): add self-serve intent runtime (#12345)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Agents need a governed way to request app connections during issue
work.
> - The catalog now describes the available providers and setup methods.
> - A request must become a durable, company-scoped intent before an
operator acts on it.
> - This pull request adds that intent runtime across server, agent,
CLI, and shared contracts.
> - The benefit is a safe bridge from agent need to operator-approved
setup.

## Linked Issues or Issue Description

Refs #11965

This is stack 7 of 11. It depends on stack 6 and replaces another
reviewable part of #11965.

## What Changed

- Add connection intent types, validation, service logic, and routes.
- Add agent runtime tools and CLI support for connection requests.
- Add issue-thread interaction support for connection intents.
- Add runtime, route, adapter, and contract tests.
- Hold the final resolved-continuation row lock through asynchronous
adapter preparation until an actual process spawn, so parking or
reassignment cannot cross that boundary.
- Report Hermes Gateway's first remote run request through the shared
dispatch hook so the resolved-intent lock is released at the true
dispatch boundary.
- Revalidate the addressed user's live non-viewer membership and
connection-management authority for every intent mutation, including
OAuth completion.

## Verification

- `pnpm --filter @paperclipai/server typecheck`
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/tool-access-service.test.ts`
- Result: 176 tests passed.
- `pnpm build`
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/heartbeat-stale-queue-invalidation.test.ts` (32 passed;
includes non-process dispatch lock-release coverage)
- `pnpm exec vitest run --project @paperclipai/server
server/src/__tests__/connection-intents-service.test.ts -t
"addressed-user mutation"` (1 passed)
- `pnpm exec vitest run --project @paperclipai/server
server/src/__tests__/tool-access-service.test.ts -t "binds OAuth
callback completion to the initiating board session"` (1 passed)
- `pnpm --filter @paperclipai/hermes-paperclip-adapter test --
src/gateway/server/execute.test.ts` (23 passed; includes dispatch-hook
ordering and exactly-once coverage)
- `pnpm --filter @paperclipai/hermes-paperclip-adapter typecheck`

## Risks

- A malformed intent could create an unusable operator request.
- Validators and company checks reject invalid or cross-company
requests.
- The final continuation gate holds the issue row lock through adapter
preparation until process or remote dispatch; later operator changes use
the normal active-run interruption path.
- The change does not add a database migration.

> I checked `ROADMAP.md`. This stack continues the existing app
connection work from #11965 and does not duplicate another planned item.

## Model Used

OpenAI Codex, GPT-5. The runtime model ID and context window were not
exposed. The model used 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 linked the public source pull request with `Refs #`
- [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 or instance-derived details
- [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

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-08-29 12:08:34 -05:00
..
acpx-engine feat(apps): add secure remote MCP and PostHog setup (#12339) 2026-08-29 12:08:32 -05:00
test-support
…
billing.test.ts
…
billing.ts
…
bridge-transport-contract.ts refactor(adapter-utils): remove the retired duplex_v1 sandbox bridge transport (#12171) 2026-08-25 08:47:43 -07:00
command-managed-runtime.test.ts Write mode-constrained inbound files directly to their target (#12320) 2026-08-27 10:54:11 -07:00
command-managed-runtime.ts Write mode-constrained inbound files directly to their target (#12320) 2026-08-27 10:54:11 -07:00
command-redaction.test.ts feat: Claude login on the new-agent page before agent creation (#11347) 2026-08-17 13:42:51 -07:00
command-redaction.ts feat: Claude login on the new-agent page before agent creation (#11347) 2026-08-17 13:42:51 -07:00
duplex-frame-codec.test.ts refactor(adapter-utils): delete the dead duplex body-chunk protocol code (#12186) 2026-08-25 14:33:38 -07:00
duplex-frame-codec.ts refactor(adapter-utils): replace the process-wide byte ledger with route-local byte bounds (#12465) 2026-08-28 14:36:18 -07:00
duplex-frame-vectors.json refactor(adapter-utils): replace the process-wide byte ledger with route-local byte bounds (#12465) 2026-08-28 14:36:18 -07:00
duplex-observability.test.ts feat(duplex): run the Daytona sandbox callback bridge over Node HTTP/2 (#12120) 2026-08-25 07:35:39 -07:00
duplex-observability.ts refactor(adapter-utils): replace the process-wide byte ledger with route-local byte bounds (#12465) 2026-08-28 14:36:18 -07:00
env-bindings.test.ts fix(adapters): keep user-scoped env bindings on the agent Test action (#10926) 2026-08-05 17:18:41 -07:00
env-bindings.ts fix(adapters): keep user-scoped env bindings on the agent Test action (#10926) 2026-08-05 17:18:41 -07:00
exclude-patterns.ts
…
execution-target-sandbox.test.ts refactor(adapter-utils): replace the process-wide byte ledger with route-local byte bounds (#12465) 2026-08-28 14:36:18 -07:00
execution-target-stdin-race.test.ts fix(adapter-utils): allow process sessions without birthtime (#12451) 2026-08-28 10:33:22 -07:00
execution-target.test.ts
…
execution-target.ts refactor(adapter-utils): replace the process-wide byte ledger with route-local byte bounds (#12465) 2026-08-28 14:36:18 -07:00
git-workspace-sync.test.ts fix(adapter-utils): harden the referenced-project ignore scan (#12214) 2026-08-26 08:30:42 -07:00
git-workspace-sync.ts fix(adapter-utils): harden the referenced-project ignore scan (#12214) 2026-08-26 08:30:42 -07:00
http2-bridge-server.test.ts refactor(adapter-utils): replace the process-wide byte ledger with route-local byte bounds (#12465) 2026-08-28 14:36:18 -07:00
http2-bridge-server.ts refactor(adapter-utils): replace the process-wide byte ledger with route-local byte bounds (#12465) 2026-08-28 14:36:18 -07:00
index.ts feat(connections): add self-serve intent runtime (#12345) 2026-08-29 12:08:34 -05:00
local-process-sandbox.test.ts
…
local-process-sandbox.ts
…
log-redaction.ts
…
login-capability.test.ts feat(login): use the login pseudo-terminal for Codex device login and de-Claude the shared channel (#12020) 2026-08-23 09:44:59 -07:00
login-capability.ts feat(login): use the login pseudo-terminal for Codex device login and de-Claude the shared channel (#12020) 2026-08-23 09:44:59 -07:00
login-pty-transport.test.ts feat(login): use the login pseudo-terminal for Codex device login and de-Claude the shared channel (#12020) 2026-08-23 09:44:59 -07:00
login-pty-transport.ts feat(login): use the login pseudo-terminal for Codex device login and de-Claude the shared channel (#12020) 2026-08-23 09:44:59 -07:00
login-runner-lifecycle.test.ts feat(auth): normalize agent login in the sandbox onto one session table and a capability contract (#11730) 2026-08-19 11:51:31 -07:00
login-runner-lifecycle.ts feat(auth): normalize agent login in the sandbox onto one session table and a capability contract (#11730) 2026-08-19 11:51:31 -07:00
mcp-isolation.integration.test.ts
…
published-exports.test.ts refactor: disambiguate the Telemetry and Observability data paths (#12128) 2026-08-24 16:42:33 -07:00
remote-execution-env.ts
…
remote-managed-runtime.test.ts fix(adapter-utils): harden the referenced-project ignore scan (#12214) 2026-08-26 08:30:42 -07:00
remote-managed-runtime.ts fix(adapter-utils): honor .gitignore for referenced-project staging (#12184) 2026-08-25 14:22:47 -07:00
runtime-progress.test.ts feat(environments): refer to the managed default environment by name, not the sandbox driver key (#11838) 2026-08-21 12:51:22 -07:00
runtime-progress.ts feat(environments): refer to the managed default environment by name, not the sandbox driver key (#11838) 2026-08-21 12:51:22 -07:00
sandbox-callback-bridge.test.ts perf(gateway): remove the whole-body string round trip on the HTTP/2 send path (#12189) 2026-08-25 14:56:17 -07:00
sandbox-callback-bridge.ts perf(gateway): remove the whole-body string round trip on the HTTP/2 send path (#12189) 2026-08-25 14:56:17 -07:00
sandbox-file-sync.test.ts fix(adapter-utils): honor .gitignore for referenced-project staging (#12184) 2026-08-25 14:22:47 -07:00
sandbox-install-command.test.ts fix(build): enforce Node 24 across Paperclip (#11792) 2026-08-21 10:17:52 -07:00
sandbox-install-command.ts fix(build): enforce Node 24 across Paperclip (#11792) 2026-08-21 10:17:52 -07:00
sandbox-managed-runtime.test.ts fix(adapter-utils): harden the referenced-project ignore scan (#12214) 2026-08-26 08:30:42 -07:00
sandbox-managed-runtime.ts fix(adapter-utils): harden the referenced-project ignore scan (#12214) 2026-08-26 08:30:42 -07:00
sandbox-run-log-stream.ts
…
sandbox-shell.ts
…
server-utils-env.test.ts
…
server-utils.test.ts feat(connections): add self-serve intent runtime (#12345) 2026-08-29 12:08:34 -05:00
server-utils.ts feat(connections): add self-serve intent runtime (#12345) 2026-08-29 12:08:34 -05:00
session-compaction.ts feat: add kimi-local adapter for Kimi Code CLI (CLI + ACP engines) (#9967) 2026-08-20 12:06:33 -07:00
skill-library-manifest.test.ts feat: agents see the company skill library at runtime (#12147) 2026-08-25 14:01:52 -07:00
skill-library-manifest.ts feat: agents see the company skill library at runtime (#12147) 2026-08-25 14:01:52 -07:00
ssh-fixture.test.ts fix(adapter-utils): make SSH env-lab fixture teardown deterministic (#12238) 2026-08-26 14:03:47 -07:00
ssh.ts fix(adapter-utils): make SSH env-lab fixture teardown deterministic (#12238) 2026-08-26 14:03:47 -07:00
sync-operation-schedule.test.ts feat: parallelize sandbox file-sync behind a provider opt-in capability (#11736) 2026-08-19 12:34:11 -07:00
sync-operation-schedule.ts feat: parallelize sandbox file-sync behind a provider opt-in capability (#11736) 2026-08-19 12:34:11 -07:00
types.ts feat(connections): add self-serve intent runtime (#12345) 2026-08-29 12:08:34 -05:00
workspace-restore-merge.test.ts fix(adapter-utils): move the workspace-restore merge lock to an instance-scoped root and surface restore failures on the run (#12187) 2026-08-25 14:32:14 -07:00
workspace-restore-merge.ts fix(adapter-utils): move the workspace-restore merge lock to an instance-scoped root and surface restore failures on the run (#12187) 2026-08-25 14:32:14 -07:00
workspace-restore-teardown.test.ts refactor(adapter-utils): extract the shared workspace-restore teardown factory (#12196) 2026-08-25 21:38:27 -07:00
workspace-restore-teardown.ts refactor(adapter-utils): extract the shared workspace-restore teardown factory (#12196) 2026-08-25 21:38:27 -07:00