paperclip/scripts
Dotta 2083bf6f9a
feat(connections): add AgentMail inboxes and email tasks (#13256)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Connections give agents controlled access to external services.
> - Experimental channels already map conversations to tasks and durable
work queues.
> - Email needs inbox ownership, recipient envelopes, delivery records,
and explicit sends.
> - This pull request adds AgentMail to that infrastructure and keeps
the provider key in the server vault.
> - Agents can receive and send email from local or sandbox execution
while the board follows each conversation in its task.

## Linked Issues or Issue Description

**Problem or motivation**

Agents need dedicated email addresses. Incoming email should become
assigned work. Internal task comments and progress must never become
outgoing email by accident.

**Proposed solution**

Add experimental AgentMail connections, an inbox assignment wizard,
durable email intake and publication, task email cards, and
authenticated API, CLI, and native runtime actions. Agents use Paperclip
credentials to request sends. Paperclip owns the provider key and
enforces access and task authority.

**Alternatives considered**

A general mailbox MCP connector does not provide durable task binding or
publication boundaries. A separate mailbox application duplicates task
collaboration. The board instead directs the agent through the normal
task conversation.

**Roadmap alignment**

This extends the existing experimental connections and task
infrastructure. Product scope and interaction design were reviewed with
the maintainer. Related connection authority work: #11831 and #11818.
The duplicate search found no competing task-based AgentMail
integration.

## What Changed

- Add AgentMail catalog data, shared contracts, company-scoped email
records, and an additive migration.
- Add vaulted setup, inbox assignment, access grants, trust guidance,
and provider-side allowlist guidance.
- Support WebSocket and signed-webhook intake through a shared durable
pipeline, deduplication, catch-up, and task wakeups.
- Queue explicit new conversations and replies with immutable send
intents, idempotency, delivery state, and uncertain-send resolution.
- Show inbound and outbound email cards in normal task conversations.
Keep internal messages internal.
- Add task-scoped CLI actions and the sandbox callback routes required
for Daytona execution.
- Provide a dedicated AgentMail skill automatically only to agents with
active authorized inbox assignments. Keep email instructions out of the
universal Paperclip skill.
- Advertise connector-owned `agentmail_inboxes`,
`agentmail_read_thread`, `agentmail_send`, and `agentmail_delivery`
tools only in eligible native sessions. Recheck live authority on
execution.
- Isolate Codex CLI connector skills by agent and skill revision.
Deliver the assigned skill in the run prompt for adapters that use
shared skill directories, including resumed turns. Keep automatic skills
out of manual persistent sync. Show them as read-only and document the
pattern in the connector playbook.
- Fix AgentMail health checks that entered local-stdio validation and
optional missing Codex credential cleanup in sandboxes.
- Add API, pipeline, authorization, sandbox, browser, and Storybook
coverage.

## Verification

- Live AgentMail testing covered WebSocket intake, signed webhooks,
restart catch-up, and a full receive → task → Daytona Codex CLI →
explicit reply → Delivered round trip. The reply was verified in the
other inbox. The normal task composer also initiated an outgoing email
child task.
- The connector-skill change was verified in the browser: AgentMail
appears once as an automatic, read-only skill with its assigned address.
Disabling experimental chat connections removes it; re-enabling restores
it. A regression test covers assignment data arriving after library
data.
- Connector regression coverage passed 178 runtime utility, email
integration, skill-route, and heartbeat tests. All 17 Codex execution
tests passed, including per-agent skill isolation, model identity,
revision changes, removal, and prompt delivery without shared skill
files.
- After rebasing onto master, all 44 focused email, heartbeat, and
native-authority tests passed. All 313 native-session executor tests
passed. The UI regression suite passed all 3 tests. These test sets
overlap earlier focused runs.
- Full workspace typecheck and build passed after the rebase. Token
gates passed. Earlier focused Playwright task/setup coverage and the
Storybook build also passed.
- Native connector tool execution uses deterministic integration tests.
Live Daytona qualification used the Codex CLI adapter; the new
shared-home prompt fallback has deterministic coverage.
- The full repository suite is run by CI. The earlier unsharded local
full-suite attempt was stopped after the equivalent CI suites passed and
is not reported as a completed local run. Greptile reviewed
`7e57dc267a8446d3c906e3cc5b8abc94fb8860eb` at 5/5 with no unresolved
threads. All server, workspace, serialized server, and browser suites
passed in CI. The build job hit a five-second timeout in a runner
transport test; both variants and the full 80-test file passed locally
with unchanged timeouts. The build passed on retry on the same commit
without code or timeout changes. All required CI gates, including the
final `ci / verify` and `ci / e2e` summaries, are green on
`7e57dc267a8446d3c906e3cc5b8abc94fb8860eb`.

## Risks

- Email from external senders can start normal agent work. Setup
recommends a low-trust agent and AgentMail sender controls. Sender
addresses never grant board membership.
- Provider timeouts can leave uncertain sends. Retries retain their
idempotency key; expired windows require reconciliation or operator
resolution.
- Connector skills and native tools are assignment-dependent and require
current access. Revocation denies retained calls; assignment changes
select a new runtime context.
- Activation remains behind the experimental-channel setting. The native
runner path has deterministic coverage; live Daytona qualification used
the Codex CLI adapter.
- Schema changes are additive. Inbox ownership is unique across
companies. Disconnect preserves provider inboxes and task history.

## Model Used

OpenAI GPT-6 (Codex). Used reasoning, repository tools, code execution,
and browser testing. The exact deployment model ID and context-window
size were not exposed in this session.

## 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 (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
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-09-11 16:56:38 -05:00
..
__tests__ fix(ci): reuse cloud source verification for npm canaries (#13233) 2026-09-11 09:26:26 -07:00
install-sh-fixtures feat(cli): add managed install, update, and service lifecycle (#10045) 2026-07-31 18:52:23 -07:00
lib feat: add experimental native chat connectors (#13038) 2026-09-10 10:06:45 -05:00
mcp-fixtures fix: continue interrupted task conversations with bounded retries (#13237) 2026-09-11 12:16:04 -05:00
smoke feat: add experimental native chat connectors (#13038) 2026-09-10 10:06:45 -05:00
tests feat: add experimental native chat connectors (#13038) 2026-09-10 10:06:45 -05:00
acpx-patch-packaging.test.mjs fix(paperclip-runner): bump claude-agent-acp pin to 0.73.0 (#13162) 2026-09-10 11:35:33 -07:00
assert-cloud-image-sentry.mjs Install the declared Sentry server package into the hosted image (#12330) 2026-08-27 19:10:49 -07:00
assert-orphan-reaping.sh fix(docker): make tini PID 1 in the server image so adopted orphans are reaped (#12137) 2026-08-25 09:52:39 -07:00
backfill-issue-reference-mentions.ts Add first-class issue references (#4214) 2026-04-21 10:02:52 -05:00
backup-db.sh Add paperclipai db:backup CLI command 2026-03-05 06:02:12 -06:00
benchmark-skill-preparation.ts fix(skills): reuse validated runtime revisions during preparation (#13042) 2026-09-08 09:35:32 -05:00
bootstrap-npm-package.mjs feat(release): bootstrap new npm packages with a placeholder publish (#11757) 2026-08-19 19:38:17 -07:00
bootstrap-npm-package.test.mjs feat(release): bootstrap new npm packages with a placeholder publish (#11757) 2026-08-19 19:38:17 -07:00
build-npm.sh feat(cli): add managed install, update, and service lifecycle (#10045) 2026-07-31 18:52:23 -07:00
build-standalone-public-packages.mjs perf(ci): build standalone public packages concurrently (#8567) 2026-06-23 17:52:12 -07:00
capture-pap-2351-binding-picker.mjs Add secrets provider vaults and remote import (#5429) 2026-05-09 18:22:17 -05:00
chat-adapter-patch-packaging.test.mjs feat: add opt-in chat provider and data foundation (#13100) 2026-09-09 13:49:12 -05:00
check-docker-deps-stage.mjs Add E2B sandbox provider plugin (#4452) 2026-04-25 11:01:11 -07:00
check-forbidden-tokens.mjs Redact current user in comments and token checks 2026-03-11 22:17:21 -05:00
check-module-boundaries.mjs refactor(server): move the admission half of the deferred wake state machine into the wake-queue module (#13136) 2026-09-10 00:55:48 -07:00
check-module-boundaries.test.mjs refactor(server): move the admission half of the deferred wake state machine into the wake-queue module (#13136) 2026-09-10 00:55:48 -07:00
check-no-git-push.mjs PAPA-430: workspace finalize gates + no-remote-git enforcement (#6969) 2026-05-29 08:25:29 -07:00
check-no-git-push.test.mjs PAPA-430: workspace finalize gates + no-remote-git enforcement (#6969) 2026-05-29 08:25:29 -07:00
check-node-version-policy.mjs fix(build): enforce Node 24 across Paperclip (#11792) 2026-08-21 10:17:52 -07:00
check-release-package-bootstrap.mjs fix(ci): gate new release packages on npm bootstrap (#5146) 2026-05-03 19:31:28 -07:00
check-release-package-bootstrap.test.mjs fix(ci): gate new release packages on npm bootstrap (#5146) 2026-05-03 19:31:28 -07:00
check-task-chat-motion.mjs feat(ui): chat-style task view behind an experimental flag (#10606) 2026-08-01 02:26:47 -07:00
check-token-gates.mjs fix(ui): align the mobile task chat composer with the thread (#11296) 2026-08-14 12:53:11 -04:00
clean-install-git.sh feat(cli): add managed install, update, and service lifecycle (#10045) 2026-07-31 18:52:23 -07:00
clean-install-npm.sh feat(cli): add managed install, update, and service lifecycle (#10045) 2026-07-31 18:52:23 -07:00
clean-onboard-git.sh http clone 2026-03-09 10:03:45 -05:00
clean-onboard-npm.sh scripts 2026-03-03 14:00:10 -06:00
clean-onboard-ref.sh feat: add committed-ref onboarding smoke script 2026-03-09 09:59:43 -05:00
cli-bundled-npm-dependencies.mjs feat(cli): add managed install, update, and service lifecycle (#10045) 2026-07-31 18:52:23 -07:00
cloud-readiness.mjs fix(ci): verify deployable cloud artifacts independently (#13192) 2026-09-10 21:08:29 -07:00
cloud-source-verification.mjs fix(ci): reuse cloud source verification for npm canaries (#13233) 2026-09-11 09:26:26 -07:00
cloud-source-verification.test.mjs fix(ci): reuse cloud source verification for npm canaries (#13233) 2026-09-11 09:26:26 -07:00
codemod-extract-colors.mjs feat(ui): single-source design tokens, visual regression suite, and theme retune (#9134) 2026-07-07 16:22:16 -05:00
codemod-extract-misc.mjs feat(ui): single-source design tokens, visual regression suite, and theme retune (#9134) 2026-07-07 16:22:16 -05:00
codemod-extract-sizes.mjs feat(ui): single-source design tokens, visual regression suite, and theme retune (#9134) 2026-07-07 16:22:16 -05:00
codemod-extract-type.mjs feat(ui): single-source design tokens, visual regression suite, and theme retune (#9134) 2026-07-07 16:22:16 -05:00
codemod-type-ladder.mjs feat(ui): single-source design tokens, visual regression suite, and theme retune (#9134) 2026-07-07 16:22:16 -05:00
codex-acp-network-policy.test.mjs fix(adapters): prevent engine fallback and preserve usable runtime defaults (#13105) 2026-09-09 13:27:24 -05:00
create-github-release.sh feat(release): draft stable notes at beta publish, read them from master at promotion (#11567) 2026-08-17 20:47:23 -07:00
dev-both.mjs feat(dev): add pnpm dev:mobile and dev:both for prebuilt UI preview (#10718) 2026-08-02 20:26:03 -07:00
dev-runner-native-binary.mjs feat(runner): integrate Codex native execution (#12616) 2026-08-31 22:51:17 -05:00
dev-runner-options.ts fix(dev): honor --data-dir isolation (#12193) 2026-08-26 09:08:31 -05:00
dev-runner-output.mjs Guard dev health JSON parsing 2026-04-06 21:23:33 -05:00
dev-runner-output.ts fix(runtime): handle empty dev runner responses 2026-04-06 21:56:13 -05:00
dev-runner-paths.mjs [codex] Add backup endpoint and dev runtime hardening (#4087) 2026-04-20 06:08:55 -05:00
dev-runner-snapshot.mjs Address dev runner snapshot review feedback 2026-06-01 22:03:51 +00:00
dev-runner.mjs [codex] Add skills CLI and catalog management (#6782) 2026-05-28 07:33:51 -10:00
dev-runner.ts fix(runner): recover native sessions across restarts (#12845) 2026-09-04 15:03:53 -05:00
dev-service-profile.ts Introduce bind presets for deployment setup 2026-04-11 07:09:07 -05:00
dev-service.ts fix(dev): honor --data-dir isolation (#12193) 2026-08-26 09:08:31 -05:00
discord-daily-digest.sh [codex] Harden heartbeat scheduling and runtime controls (#4223) 2026-04-21 12:24:11 -05:00
docker-build-test.sh fix(docker): make tini PID 1 in the server image so adopted orphans are reaped (#12137) 2026-08-25 09:52:39 -07:00
docker-entrypoint.sh Ensure app-home ownership before the privilege drop, not only on remap (#10530) 2026-07-30 21:34:45 -07:00
docker-onboard-smoke.sh Follow the current onboarding arc in the release smoke (#12423) 2026-08-28 07:21:08 -07:00
docker-onboard-smoke.test.mjs Follow the current onboarding arc in the release smoke (#12423) 2026-08-28 07:21:08 -07:00
draft-stable-notes.sh feat(release): thorough notes skeletons — nest each PR's summary at creation (#12124) 2026-08-24 20:51:33 -07:00
draft-stable-notes.test.mjs feat(release): thorough notes skeletons — nest each PR's summary at creation (#12124) 2026-08-24 20:51:33 -07:00
e2e-install-lifecycle.sh fix(build): enforce Node 24 across Paperclip (#11792) 2026-08-21 10:17:52 -07:00
e2e-mcp-user-stories.mjs feat(mcp) [split 8/8]: add e2e coverage and operator docs (#9563) 2026-07-14 15:48:57 -05:00
e2e-shard-durations.json test(e2e): shorten and split Smoke Lab coverage (#12506) 2026-08-31 10:15:39 -05:00
e2e-shard.mjs feat(connections): connect services from native task feeds (#13058) 2026-09-08 15:55:26 -05:00
e2e-update-migrations.sh test(installer): cover cross-version update migrations (#10587) 2026-07-31 18:53:34 -07:00
ensure-plugin-build-deps.mjs [codex] Add skills CLI and catalog management (#6782) 2026-05-28 07:33:51 -10:00
ensure-workspace-package-links.ts [codex] fix worktree dev dependency ergonomics (#3743) 2026-04-15 09:47:29 -05:00
extract-proposed-events.mjs Add telemetry proposal extractor (#9544) 2026-07-13 23:47:27 -07:00
extract-proposed-events.test.mjs Add telemetry proposal extractor (#9544) 2026-07-13 23:47:27 -07:00
general-server-shard-durations.json refactor: remove automatic productivity reviews (#13263) 2026-09-11 15:46:35 -05:00
general-server-shard.mjs perf(ci): balance general-server test shards by recorded suite duration (#9516) 2026-07-13 12:25:54 -07:00
generate-company-assets.ts Address Greptile review on portability PR 2026-03-23 17:23:59 -05:00
generate-feature-catalog.ts Add a feature catalog build artifact derived from the experimental settings schema (#10055) 2026-07-22 18:12:56 -07:00
generate-npm-package-json.mjs fix(build): enforce Node 24 across Paperclip (#11792) 2026-08-21 10:17:52 -07:00
generate-org-chart-images.ts Add standalone Playwright-based org chart image generator 2026-03-20 05:55:33 -05:00
generate-org-chart-satori-comparison.ts feat: multi-style pure SVG org chart renderer (no Playwright needed) 2026-03-20 06:33:29 -05:00
generate-plugin-package-json.mjs Add E2B sandbox provider plugin (#4452) 2026-04-25 11:01:11 -07:00
generate-runner-api-reference.mjs feat(runner): add guarded API search and call fallback (#13003) 2026-09-07 14:14:43 -05:00
generate-runner-experimental-api-metadata.mjs feat(runner): add guarded API search and call fallback (#13003) 2026-09-07 14:14:43 -05:00
generate-ui-package-json.mjs Publish @paperclipai/ui from release automation 2026-03-26 11:13:11 -05:00
ingest-app-definitions.mjs feat(connections): add AgentMail inboxes and email tasks (#13256) 2026-09-11 16:56:38 -05:00
install.sh fix(build): enforce Node 24 across Paperclip (#11792) 2026-08-21 10:17:52 -07:00
kill-agent-browsers.sh [codex] Stabilize tests and local maintenance assets (#4423) 2026-04-24 15:11:42 -05:00
kill-dev.sh kill chrome test servers too 2026-04-09 06:14:12 -05:00
kill-vitest.sh [codex] Harden heartbeat scheduling and runtime controls (#4223) 2026-04-21 12:24:11 -05:00
kill-workspaces.sh Add workspace runtime kill script 2026-06-05 03:28:07 +00:00
link-plugin-dev-sdk.mjs fix(plugins): move dev SDK linking out of plugin postinstall scripts (#8255) 2026-06-18 07:45:53 -07:00
link-plugin-dev-sdk.test.js fix(plugins): move dev SDK linking out of plugin postinstall scripts (#8255) 2026-06-18 07:45:53 -07:00
measure-issue-chat-long-thread.mjs Improve issue thread scale and markdown polish (#4861) 2026-04-30 13:18:01 -05:00
migrate-inline-env-secrets.ts refactor: rename packages to @paperclipai and CLI binary to paperclipai 2026-03-03 08:45:26 -06:00
paperclip-commit-metrics.ts feat: implement multi-user access and invite flows (#3784) 2026-04-17 09:44:19 -05:00
paperclip-issue-update.sh fix: verify issue-update writes instead of inferring success (#12051) 2026-08-23 16:56:51 -07:00
prepare-bundled-package.mjs Build isolated preview artifacts for exact-source deployments (#13041) 2026-09-08 09:21:58 -05:00
prepare-server-ui-dist.sh ci: speed up PR verify workflow (#6137) 2026-05-16 11:28:25 -07:00
preview-artifacts.mjs fix(release): publish exact-source cloud migrators on merge (#13188) 2026-09-10 21:07:38 -07:00
preview-artifacts.test.mjs fix(ci): bake the managed runtime identity into cloud images (#13210) 2026-09-11 00:58:27 -07:00
provision-worktree-runtime.sh fix(scripts): silence pnpm DEP0169 at provisioning install call sites (#12228) 2026-08-26 10:42:13 -07:00
provision-worktree.sh fix(workspaces): preserve dependency provisioning failures (#13093) 2026-09-09 10:14:58 -05:00
release-lib.sh fix(release): skip lifecycle scripts for bundle staging (#12585) 2026-08-31 09:14:08 -05:00
release-lib.test.mjs fix(release): skip lifecycle scripts for bundle staging (#12585) 2026-08-31 09:14:08 -05:00
release-package-manifest.json feat: add kimi-local adapter for Kimi Code CLI (CLI + ACP engines) (#9967) 2026-08-20 12:06:33 -07:00
release-package-map.mjs feat(cli): add managed install, update, and service lifecycle (#10045) 2026-07-31 18:52:23 -07:00
release-package-map.test.mjs feat(cli): add managed install, update, and service lifecycle (#10045) 2026-07-31 18:52:23 -07:00
release-registry-versions.mjs perf(release): batch npm registry version queries (#9202) 2026-07-08 08:04:39 -07:00
release-registry-versions.test.mjs feat(release): add human-gated beta channel with stable soak enforcement (#11008) 2026-08-10 16:52:59 -07:00
release.sh feat(release): draft stable notes at beta publish, read them from master at promotion (#11567) 2026-08-17 20:47:23 -07:00
repair-pr-prep-workspace-attachment.mjs fix(workspaces): attach PR preparation to existing branches (#11703) 2026-08-21 17:23:18 -05:00
request-hot-restart.ts fix(server): preserve hot restart intent across path upgrade (#10593) 2026-07-31 21:55:59 -07:00
rollback-latest.sh chore: switch release calver to mdd patch 2026-03-18 07:57:36 -05:00
run-typecheck-build-gaps.mjs Add runtime asset build-gap guard 2026-07-13 08:35:30 -07:00
run-vitest-stable.mjs fix(ci): split release chat verification into test shards (#13198) 2026-09-10 20:30:30 -07:00
runner-api-eval-worker.ts feat(connections): connect services from native task feeds (#13058) 2026-09-08 15:55:26 -05:00
screenshot-blocked-inbox.mjs [codex] Add blocked inbox attention view (#5603) 2026-05-13 16:41:36 -05:00
screenshot-file-viewer.mjs Add workspace file viewer and artifact links (#7681) 2026-06-09 17:17:43 -05:00
screenshot-fork-flow.mjs Skill Studio: three-pane skill IDE with sandboxed test runs (#9241) 2026-07-09 13:08:56 -05:00
screenshot-notion-connect-flow.mjs feat(apps): connect Notion through MCP OAuth (#11009) 2026-08-06 22:18:08 -05:00
screenshot-one.mjs Add workspace file viewer and artifact links (#7681) 2026-06-09 17:17:43 -05:00
screenshot-pap2373.mjs Cancel stale queued heartbeats when issue graph changes (PAP-2314) (#4534) 2026-04-26 21:17:38 -05:00
screenshot-recovery-card.cjs [codex] Add source-scoped recovery actions (#5599) 2026-05-12 09:37:15 -05:00
screenshot-subissues.mjs Present ordered sub-issues as a workflow checklist (#4523) 2026-04-26 07:36:49 -05:00
screenshot-verdicts.mjs feat: add attention queue and Decisions surface (#9380) 2026-07-10 17:09:57 -05:00
screenshot.cjs feat: add authenticated screenshot utility (#2622) 2026-04-03 10:51:26 -07:00
serialized-shard-durations.json refactor: balance serialized server shards by recorded suite duration (#11528) 2026-08-17 20:30:44 -07:00
serve-storybook-static.mjs [codex] Document Storybook visual baseline platform lock (#9216) 2026-07-08 07:23:02 -05:00
service-onboard-smoke.sh test(release-smoke): cover the background-service leg of onboarding (#12151) 2026-08-25 01:05:27 -07:00
service-onboard-smoke.test.mjs test(release-smoke): cover the background-service leg of onboarding (#12151) 2026-08-25 01:05:27 -07:00
storybook-visual-baseline.mjs feat(ui): single-source design tokens, visual regression suite, and theme retune (#9134) 2026-07-07 16:22:16 -05:00
test-install-sh-docker.sh fix(build): enforce Node 24 across Paperclip (#11792) 2026-08-21 10:17:52 -07:00
test-line-shard.mjs fix(ci): split release chat verification into test shards (#13198) 2026-09-10 20:30:30 -07:00
verify-release-registry-state.mjs feat(release): add human-gated beta channel with stable soak enforcement (#11008) 2026-08-10 16:52:59 -07:00
verify-release-registry-state.test.mjs feat(release): add human-gated beta channel with stable soak enforcement (#11008) 2026-08-10 16:52:59 -07:00