[codex] add comprehensive UI Storybook coverage (#4132)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies.
> - The board UI is the main operator surface, so its component and
workflow coverage needs to stay reviewable as the product grows.
> - This branch adds Storybook as a dedicated UI reference surface for
core Paperclip screens and interaction patterns.
> - That work spans Storybook infrastructure, app-level provider wiring,
and a large fixture set that can render real control-plane states
without a live backend.
> - The branch also expands coverage across agents, budgets, issues,
chat, dialogs, navigation, projects, and data visualization so future UI
changes have a concrete visual baseline.
> - This pull request packages that Storybook work on top of the latest
`master`, excludes the lockfile from the final diff per repo policy, and
fixes one fixture contract drift caught during verification.
> - The benefit is a single reviewable PR that adds broad UI
documentation and regression-surfacing coverage without losing the
existing branch work.
## What Changed
- Added Storybook 10 wiring for the UI package, including root scripts,
UI package scripts, Storybook config, preview wrappers, Tailwind
entrypoints, and setup docs.
- Added a large fixture-backed data source for Storybook so complex
board states can render without a live server.
- Added story suites covering foundations, status language,
control-plane surfaces, overview, UX labs, agent management, budget and
finance, forms and editors, issue management, navigation and layout,
chat and comments, data visualization, dialogs and modals, and
projects/goals/workspaces.
- Adjusted several UI components for Storybook parity so dialogs, menus,
keyboard shortcuts, budget markers, markdown editing, and related
surfaces render correctly in isolation.
- Rebasing work for PR assembly: replayed the branch onto current
`master`, removed `pnpm-lock.yaml` from the final PR diff, and aligned
the dashboard fixture with the current `DashboardSummary.runActivity`
API contract.
## Verification
- `pnpm --filter @paperclipai/ui typecheck`
- `pnpm --filter @paperclipai/ui build-storybook`
- Manual diff audit after rebase: verified the PR no longer includes
`pnpm-lock.yaml` and now cleanly targets current `master`.
- Before/after UI note: before this branch there was no dedicated
Storybook surface for these Paperclip views; after this branch the local
Storybook build includes the new overview and domain story suites in
`ui/storybook-static`.
## Risks
- Large static fixture files can drift from shared types as dashboard
and UI contracts evolve; this PR already needed one fixture correction
for `runActivity`.
- Storybook bundle output includes some large chunks, so future growth
may need chunking work if build performance becomes an issue.
- Several component tweaks were made for isolated rendering parity, so
reviewers should spot-check key board surfaces against the live app
behavior.
## Model Used
- OpenAI Codex, GPT-5-based coding agent in the Paperclip harness; exact
serving model ID is not exposed in-runtime to the agent.
- Tool-assisted workflow with terminal execution, git operations, local
typecheck/build verification, and GitHub CLI PR creation.
- Context window/reasoning mode not surfaced by the harness.
## 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 run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-04-20 12:13:23 -05:00
|
|
|
import { useEffect, useState, type ReactNode } from "react";
|
|
|
|
|
import type { Preview } from "@storybook/react-vite";
|
|
|
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
|
|
|
import { MemoryRouter } from "@/lib/router";
|
|
|
|
|
import { BreadcrumbProvider } from "@/context/BreadcrumbContext";
|
|
|
|
|
import { CompanyProvider } from "@/context/CompanyContext";
|
|
|
|
|
import { DialogProvider } from "@/context/DialogContext";
|
|
|
|
|
import { EditorAutocompleteProvider } from "@/context/EditorAutocompleteContext";
|
|
|
|
|
import { PanelProvider } from "@/context/PanelContext";
|
|
|
|
|
import { SidebarProvider } from "@/context/SidebarContext";
|
|
|
|
|
import { ThemeProvider } from "@/context/ThemeContext";
|
|
|
|
|
import { ToastProvider } from "@/context/ToastContext";
|
|
|
|
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
|
|
|
import {
|
|
|
|
|
storybookAgents,
|
|
|
|
|
storybookApprovals,
|
|
|
|
|
storybookAuthSession,
|
|
|
|
|
storybookCompanies,
|
|
|
|
|
storybookDashboardSummary,
|
|
|
|
|
storybookIssues,
|
|
|
|
|
storybookLiveRuns,
|
|
|
|
|
storybookProjects,
|
|
|
|
|
storybookSidebarBadges,
|
|
|
|
|
} from "../fixtures/paperclipData";
|
|
|
|
|
import "@mdxeditor/editor/style.css";
|
|
|
|
|
import "./tailwind-entry.css";
|
|
|
|
|
import "./styles.css";
|
|
|
|
|
|
Add ACPX local adapter runtime (#4893)
## Thinking Path
> - Paperclip orchestrates AI-agent companies through a control plane
that can start, supervise, and recover agent runs.
> - Local adapters are the bridge between Paperclip issues and concrete
agent runtimes such as Claude, Codex, and other ACP-compatible tools.
> - The roadmap calls out broader “bring your own agent” and claw-style
agent support, and ACPX gives Paperclip one path to normalize multiple
ACP agents behind a single adapter.
> - The branch needed to become one reviewable PR against current
`paperclipai/paperclip:master`, without carrying stale base conflicts or
generated lockfile churn.
> - This pull request adds an experimental built-in `acpx_local`
adapter, integrates it through the server/CLI/UI adapter surfaces, and
adds regression coverage for runtime execution, skill sync, stream
parsing, diagnostics, and log redaction.
> - The benefit is that Paperclip can run Claude/Codex/custom ACP agents
through ACPX while keeping operator configuration, skills, logging, and
transcript rendering inside the existing adapter model.
## What Changed
- Added `@paperclipai/adapter-acpx-local` with server execution, config
schema, ACPX session handling, CLI formatting, UI config helpers, and
stdout parsing.
- Registered `acpx_local` across CLI, server, shared constants, UI
adapter metadata, adapter capabilities, and agent creation/editing
surfaces.
- Added ACPX runtime execution support with persistent sessions,
local-agent JWT environment handling, skill snapshots, runtime skill
materialization, and isolation/security regressions.
- Added ACPX adapter diagnostics and marked the adapter experimental in
the UI.
- Added command/env secret redaction for resolved command metadata in
adapter-utils, server event storage, and the Agent Detail invocation UI.
- Added Storybook coverage for ACPX config, transcript rendering, and
skill states, plus PR screenshots under `docs/pr-screenshots/pap-2944/`.
- Rebased the branch onto current `public-gh/master`; `pnpm-lock.yaml`
is intentionally not included and there are no migration/schema changes.
## Verification
- `pnpm exec vitest run
packages/adapters/acpx-local/src/server/execute.test.ts
packages/adapters/acpx-local/src/server/test.test.ts
packages/adapters/acpx-local/src/cli/format-event.test.ts
packages/adapters/acpx-local/src/ui/parse-stdout.test.ts
packages/adapter-utils/src/server-utils.test.ts
server/src/__tests__/redaction.test.ts
server/src/__tests__/acpx-local-execute.test.ts
server/src/__tests__/acpx-local-skill-sync.test.ts
server/src/__tests__/acpx-local-adapter-environment.test.ts
server/src/__tests__/adapter-routes.test.ts
server/src/__tests__/agent-skills-routes.test.ts
ui/src/adapters/metadata.test.ts` — 12 files, 87 tests passed.
- `pnpm --filter @paperclipai/adapter-acpx-local typecheck` — passed.
- `pnpm --filter @paperclipai/server typecheck` — passed.
- `pnpm --filter @paperclipai/ui typecheck` — passed.
- Confirmed PR diff does not include `pnpm-lock.yaml`, database schema
files, or migrations.
Screenshots:



## Risks
- Medium risk: this introduces a new built-in adapter package and
touches runtime execution, adapter registration, agent config, skills,
and transcript rendering.
- ACPX and ACP agent behavior can vary by installed tool versions; the
adapter is marked experimental to set operator expectations.
- `pnpm-lock.yaml` is excluded per repository PR policy, so dependency
lock refresh must be handled by the repo’s automation or maintainers.
- No database migration risk: no schema or migration files changed.
> 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 coding agent based on GPT-5, with repository tool use,
shell execution, git operations, and local verification. Exact hosted
context window was not exposed in this environment.
## 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 run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-04-30 19:57:05 -05:00
|
|
|
// Install fetch monkeypatch eagerly so any module-load-time fetches (e.g. schema
|
|
|
|
|
// caches in adapter config renderers) hit our fixtures before they reach the
|
|
|
|
|
// network. Some renderers issue a fetch from useEffect on first paint, which
|
|
|
|
|
// can otherwise race the StorybookProviders mount.
|
|
|
|
|
installStorybookApiFixtures();
|
|
|
|
|
|
[codex] add comprehensive UI Storybook coverage (#4132)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies.
> - The board UI is the main operator surface, so its component and
workflow coverage needs to stay reviewable as the product grows.
> - This branch adds Storybook as a dedicated UI reference surface for
core Paperclip screens and interaction patterns.
> - That work spans Storybook infrastructure, app-level provider wiring,
and a large fixture set that can render real control-plane states
without a live backend.
> - The branch also expands coverage across agents, budgets, issues,
chat, dialogs, navigation, projects, and data visualization so future UI
changes have a concrete visual baseline.
> - This pull request packages that Storybook work on top of the latest
`master`, excludes the lockfile from the final diff per repo policy, and
fixes one fixture contract drift caught during verification.
> - The benefit is a single reviewable PR that adds broad UI
documentation and regression-surfacing coverage without losing the
existing branch work.
## What Changed
- Added Storybook 10 wiring for the UI package, including root scripts,
UI package scripts, Storybook config, preview wrappers, Tailwind
entrypoints, and setup docs.
- Added a large fixture-backed data source for Storybook so complex
board states can render without a live server.
- Added story suites covering foundations, status language,
control-plane surfaces, overview, UX labs, agent management, budget and
finance, forms and editors, issue management, navigation and layout,
chat and comments, data visualization, dialogs and modals, and
projects/goals/workspaces.
- Adjusted several UI components for Storybook parity so dialogs, menus,
keyboard shortcuts, budget markers, markdown editing, and related
surfaces render correctly in isolation.
- Rebasing work for PR assembly: replayed the branch onto current
`master`, removed `pnpm-lock.yaml` from the final PR diff, and aligned
the dashboard fixture with the current `DashboardSummary.runActivity`
API contract.
## Verification
- `pnpm --filter @paperclipai/ui typecheck`
- `pnpm --filter @paperclipai/ui build-storybook`
- Manual diff audit after rebase: verified the PR no longer includes
`pnpm-lock.yaml` and now cleanly targets current `master`.
- Before/after UI note: before this branch there was no dedicated
Storybook surface for these Paperclip views; after this branch the local
Storybook build includes the new overview and domain story suites in
`ui/storybook-static`.
## Risks
- Large static fixture files can drift from shared types as dashboard
and UI contracts evolve; this PR already needed one fixture correction
for `runActivity`.
- Storybook bundle output includes some large chunks, so future growth
may need chunking work if build performance becomes an issue.
- Several component tweaks were made for isolated rendering parity, so
reviewers should spot-check key board surfaces against the live app
behavior.
## Model Used
- OpenAI Codex, GPT-5-based coding agent in the Paperclip harness; exact
serving model ID is not exposed in-runtime to the agent.
- Tool-assisted workflow with terminal execution, git operations, local
typecheck/build verification, and GitHub CLI PR creation.
- Context window/reasoning mode not surfaced by the harness.
## 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 run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-04-20 12:13:23 -05:00
|
|
|
function installStorybookApiFixtures() {
|
|
|
|
|
if (typeof window === "undefined") return;
|
|
|
|
|
const currentWindow = window as typeof window & {
|
|
|
|
|
__paperclipStorybookFetchInstalled?: boolean;
|
|
|
|
|
};
|
|
|
|
|
if (currentWindow.__paperclipStorybookFetchInstalled) return;
|
|
|
|
|
|
|
|
|
|
const originalFetch = window.fetch.bind(window);
|
|
|
|
|
currentWindow.__paperclipStorybookFetchInstalled = true;
|
|
|
|
|
|
|
|
|
|
window.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
|
|
|
|
|
const rawUrl =
|
|
|
|
|
typeof input === "string"
|
|
|
|
|
? input
|
|
|
|
|
: input instanceof URL
|
|
|
|
|
? input.href
|
|
|
|
|
: input.url;
|
|
|
|
|
const url = new URL(rawUrl, window.location.origin);
|
|
|
|
|
|
|
|
|
|
if (url.pathname === "/api/auth/get-session") {
|
|
|
|
|
return Response.json(storybookAuthSession);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (url.pathname === "/api/companies") {
|
|
|
|
|
return Response.json(storybookCompanies);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (url.pathname === "/api/companies/company-storybook/user-directory") {
|
|
|
|
|
return Response.json({
|
|
|
|
|
users: [
|
|
|
|
|
{
|
|
|
|
|
principalId: "user-board",
|
|
|
|
|
status: "active",
|
|
|
|
|
user: {
|
|
|
|
|
id: "user-board",
|
|
|
|
|
email: "board@paperclip.local",
|
|
|
|
|
name: "Board Operator",
|
|
|
|
|
image: null,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
principalId: "user-product",
|
|
|
|
|
status: "active",
|
|
|
|
|
user: {
|
|
|
|
|
id: "user-product",
|
|
|
|
|
email: "product@paperclip.local",
|
|
|
|
|
name: "Product Lead",
|
|
|
|
|
image: null,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (url.pathname === "/api/instance/settings/experimental") {
|
|
|
|
|
return Response.json({
|
|
|
|
|
enableIsolatedWorkspaces: true,
|
|
|
|
|
autoRestartDevServerWhenIdle: false,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
Add cheap model profiles for local adapters (#4881)
## Thinking Path
> - Paperclip is a control plane for autonomous AI companies, where
adapters are the boundary between the board, agents, and execution
runtimes.
> - Local adapters currently expose a primary runtime configuration, but
operators often need a cheaper model lane for routine or low-risk work.
> - That cheap lane has to stay adapter-owned: runtime profile settings
should not mutate the primary adapter config or bypass existing
auth/secret mediation.
> - Issue creation also needs an ergonomic way to request primary,
cheap, or custom model behavior for a selected assignee.
> - This pull request adds a first-class `cheap` model profile contract
across adapter capabilities, heartbeat config resolution, agent
configuration, and issue creation.
> - The benefit is cheaper task execution can be configured and
requested explicitly while preserving adapter boundaries, secret
handling, and audit visibility.
## What Changed
- Added adapter model-profile capability metadata and a `cheap` profile
contract for supported local adapters.
- Applied `runtimeConfig.modelProfiles.cheap.adapterConfig` during
heartbeat config resolution, including requested/applied/fallback run
metadata.
- Added agent configuration UI for cheap model profile settings without
writing those settings into primary `adapterConfig`.
- Added New Issue assignee model lane controls for Primary / Cheap /
Custom and request payload handling.
- Added run ledger profile badges and Storybook stories for the new
cheap-lane UI states.
- Added tests for validators, heartbeat model profile application,
permission/secret mediation, UI payload helpers, and run ledger
rendering.
- Added committed UI verification screenshots under
`docs/pr-screenshots/pap-2837/`.
- Addressed Greptile review feedback around cheap-profile defaults,
shared profile types, and fallback test data.
## Verification
Local:
- `pnpm exec vitest run packages/shared/src/validators/issue.test.ts
server/src/__tests__/adapter-registry.test.ts
server/src/__tests__/agent-permissions-routes.test.ts
server/src/__tests__/heartbeat-model-profile.test.ts
ui/src/components/IssueRunLedger.test.tsx
ui/src/lib/agent-config-patch.test.ts
ui/src/lib/issue-assignee-overrides.test.ts
ui/src/lib/new-agent-runtime-config.test.ts` — passed, 8 files / 103
tests.
- `pnpm exec vitest run ui/src/lib/new-agent-runtime-config.test.ts
ui/src/components/IssueRunLedger.test.tsx` — passed after
Greptile/rebase follow-up, 2 files / 17 tests.
- `pnpm --filter @paperclipai/ui typecheck` — passed after
Greptile/rebase follow-up.
- `pnpm -r typecheck` — passed.
- `pnpm build` — passed.
- `pnpm test:run` — did not complete successfully in this local
worktree: it stopped in pre-existing `@paperclipai/adapter-utils`
sandbox/SSH fixture suites outside this PR diff. Failures were 5s local
timeouts plus `git init -b` unsupported by this machine's Git 2.21.0.
The branch-specific targeted suites above passed.
- Branch was fetched/rebased onto `public-gh/master`; `git rev-list
--left-right --count public-gh/master...HEAD` reports `0 9`.
Remote PR checks on latest head
`e30bf399146451c86cee98ed528d51d33fa5af5a`:
- `policy` — passed.
- `verify` — passed.
- `e2e` — passed.
- `Greptile Review` — passed, confidence score 5/5; Greptile review
threads resolved.
- `security/snyk (cryppadotta)` — passed.
Screenshots:
- [New issue cheap lane
desktop](https://github.com/paperclipai/paperclip/blob/PAP-2837-plan-cheap-model-for-adapters-that-can-support-it/docs/pr-screenshots/pap-2837/newissue-cheap-desktop.png)
- [New issue custom lane
desktop](https://github.com/paperclipai/paperclip/blob/PAP-2837-plan-cheap-model-for-adapters-that-can-support-it/docs/pr-screenshots/pap-2837/newissue-custom-desktop.png)
- [New issue unsupported adapter
desktop](https://github.com/paperclipai/paperclip/blob/PAP-2837-plan-cheap-model-for-adapters-that-can-support-it/docs/pr-screenshots/pap-2837/newissue-unsupported-desktop.png)
- [Run ledger model profile badges
desktop](https://github.com/paperclipai/paperclip/blob/PAP-2837-plan-cheap-model-for-adapters-that-can-support-it/docs/pr-screenshots/pap-2837/runledger-profile-badges-desktop.png)
- Mobile variants are also in `docs/pr-screenshots/pap-2837/`.
## Risks
- Medium: heartbeat config mediation now merges runtime model profiles
into adapter configs, so adapter secret normalization and host-command
restrictions must keep covering nested config paths.
- Medium: the UI adds another issue creation choice; unsupported
adapters must keep hiding the cheap lane and preserve primary behavior.
- Low migration risk: no database migration is included.
> 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 coding agent using GPT-5-class reasoning with repo tool use
and command execution. Exact served model/context window was not exposed
by the runtime.
## 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
- [ ] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 15:32:04 -05:00
|
|
|
if (url.pathname === "/api/adapters") {
|
|
|
|
|
return Response.json([
|
|
|
|
|
{
|
|
|
|
|
type: "claude_local",
|
|
|
|
|
label: "Claude Local",
|
|
|
|
|
source: "builtin",
|
|
|
|
|
modelsCount: 2,
|
|
|
|
|
loaded: true,
|
|
|
|
|
disabled: false,
|
|
|
|
|
capabilities: {
|
|
|
|
|
supportsInstructionsBundle: true,
|
|
|
|
|
supportsSkills: true,
|
|
|
|
|
supportsLocalAgentJwt: true,
|
|
|
|
|
requiresMaterializedRuntimeSkills: false,
|
|
|
|
|
supportsModelProfiles: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: "codex_local",
|
|
|
|
|
label: "Codex Local",
|
|
|
|
|
source: "builtin",
|
|
|
|
|
modelsCount: 3,
|
|
|
|
|
loaded: true,
|
|
|
|
|
disabled: false,
|
|
|
|
|
capabilities: {
|
|
|
|
|
supportsInstructionsBundle: true,
|
|
|
|
|
supportsSkills: true,
|
|
|
|
|
supportsLocalAgentJwt: true,
|
|
|
|
|
requiresMaterializedRuntimeSkills: false,
|
|
|
|
|
supportsModelProfiles: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const adapterModelsMatch = url.pathname.match(
|
|
|
|
|
/^\/api\/companies\/[^/]+\/adapters\/([^/]+)\/(models|model-profiles)$/,
|
|
|
|
|
);
|
|
|
|
|
if (adapterModelsMatch) {
|
|
|
|
|
const [, , resource] = adapterModelsMatch;
|
|
|
|
|
if (resource === "models") {
|
|
|
|
|
return Response.json([
|
|
|
|
|
{ id: "claude-opus-4-7", label: "Claude Opus 4.7" },
|
|
|
|
|
{ id: "claude-sonnet-4-6", label: "Claude Sonnet 4.6" },
|
|
|
|
|
{ id: "claude-haiku-4-5", label: "Claude Haiku 4.5" },
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
return Response.json([
|
|
|
|
|
{
|
|
|
|
|
key: "cheap",
|
|
|
|
|
label: "Cheap",
|
|
|
|
|
adapterConfig: { model: "claude-sonnet-4-6" },
|
|
|
|
|
source: "adapter_default",
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
[codex] add comprehensive UI Storybook coverage (#4132)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies.
> - The board UI is the main operator surface, so its component and
workflow coverage needs to stay reviewable as the product grows.
> - This branch adds Storybook as a dedicated UI reference surface for
core Paperclip screens and interaction patterns.
> - That work spans Storybook infrastructure, app-level provider wiring,
and a large fixture set that can render real control-plane states
without a live backend.
> - The branch also expands coverage across agents, budgets, issues,
chat, dialogs, navigation, projects, and data visualization so future UI
changes have a concrete visual baseline.
> - This pull request packages that Storybook work on top of the latest
`master`, excludes the lockfile from the final diff per repo policy, and
fixes one fixture contract drift caught during verification.
> - The benefit is a single reviewable PR that adds broad UI
documentation and regression-surfacing coverage without losing the
existing branch work.
## What Changed
- Added Storybook 10 wiring for the UI package, including root scripts,
UI package scripts, Storybook config, preview wrappers, Tailwind
entrypoints, and setup docs.
- Added a large fixture-backed data source for Storybook so complex
board states can render without a live server.
- Added story suites covering foundations, status language,
control-plane surfaces, overview, UX labs, agent management, budget and
finance, forms and editors, issue management, navigation and layout,
chat and comments, data visualization, dialogs and modals, and
projects/goals/workspaces.
- Adjusted several UI components for Storybook parity so dialogs, menus,
keyboard shortcuts, budget markers, markdown editing, and related
surfaces render correctly in isolation.
- Rebasing work for PR assembly: replayed the branch onto current
`master`, removed `pnpm-lock.yaml` from the final PR diff, and aligned
the dashboard fixture with the current `DashboardSummary.runActivity`
API contract.
## Verification
- `pnpm --filter @paperclipai/ui typecheck`
- `pnpm --filter @paperclipai/ui build-storybook`
- Manual diff audit after rebase: verified the PR no longer includes
`pnpm-lock.yaml` and now cleanly targets current `master`.
- Before/after UI note: before this branch there was no dedicated
Storybook surface for these Paperclip views; after this branch the local
Storybook build includes the new overview and domain story suites in
`ui/storybook-static`.
## Risks
- Large static fixture files can drift from shared types as dashboard
and UI contracts evolve; this PR already needed one fixture correction
for `runActivity`.
- Storybook bundle output includes some large chunks, so future growth
may need chunking work if build performance becomes an issue.
- Several component tweaks were made for isolated rendering parity, so
reviewers should spot-check key board surfaces against the live app
behavior.
## Model Used
- OpenAI Codex, GPT-5-based coding agent in the Paperclip harness; exact
serving model ID is not exposed in-runtime to the agent.
- Tool-assisted workflow with terminal execution, git operations, local
typecheck/build verification, and GitHub CLI PR creation.
- Context window/reasoning mode not surfaced by the harness.
## 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 run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-04-20 12:13:23 -05:00
|
|
|
if (url.pathname === "/api/plugins/ui-contributions") {
|
|
|
|
|
return Response.json([]);
|
|
|
|
|
}
|
|
|
|
|
|
Add ACPX local adapter runtime (#4893)
## Thinking Path
> - Paperclip orchestrates AI-agent companies through a control plane
that can start, supervise, and recover agent runs.
> - Local adapters are the bridge between Paperclip issues and concrete
agent runtimes such as Claude, Codex, and other ACP-compatible tools.
> - The roadmap calls out broader “bring your own agent” and claw-style
agent support, and ACPX gives Paperclip one path to normalize multiple
ACP agents behind a single adapter.
> - The branch needed to become one reviewable PR against current
`paperclipai/paperclip:master`, without carrying stale base conflicts or
generated lockfile churn.
> - This pull request adds an experimental built-in `acpx_local`
adapter, integrates it through the server/CLI/UI adapter surfaces, and
adds regression coverage for runtime execution, skill sync, stream
parsing, diagnostics, and log redaction.
> - The benefit is that Paperclip can run Claude/Codex/custom ACP agents
through ACPX while keeping operator configuration, skills, logging, and
transcript rendering inside the existing adapter model.
## What Changed
- Added `@paperclipai/adapter-acpx-local` with server execution, config
schema, ACPX session handling, CLI formatting, UI config helpers, and
stdout parsing.
- Registered `acpx_local` across CLI, server, shared constants, UI
adapter metadata, adapter capabilities, and agent creation/editing
surfaces.
- Added ACPX runtime execution support with persistent sessions,
local-agent JWT environment handling, skill snapshots, runtime skill
materialization, and isolation/security regressions.
- Added ACPX adapter diagnostics and marked the adapter experimental in
the UI.
- Added command/env secret redaction for resolved command metadata in
adapter-utils, server event storage, and the Agent Detail invocation UI.
- Added Storybook coverage for ACPX config, transcript rendering, and
skill states, plus PR screenshots under `docs/pr-screenshots/pap-2944/`.
- Rebased the branch onto current `public-gh/master`; `pnpm-lock.yaml`
is intentionally not included and there are no migration/schema changes.
## Verification
- `pnpm exec vitest run
packages/adapters/acpx-local/src/server/execute.test.ts
packages/adapters/acpx-local/src/server/test.test.ts
packages/adapters/acpx-local/src/cli/format-event.test.ts
packages/adapters/acpx-local/src/ui/parse-stdout.test.ts
packages/adapter-utils/src/server-utils.test.ts
server/src/__tests__/redaction.test.ts
server/src/__tests__/acpx-local-execute.test.ts
server/src/__tests__/acpx-local-skill-sync.test.ts
server/src/__tests__/acpx-local-adapter-environment.test.ts
server/src/__tests__/adapter-routes.test.ts
server/src/__tests__/agent-skills-routes.test.ts
ui/src/adapters/metadata.test.ts` — 12 files, 87 tests passed.
- `pnpm --filter @paperclipai/adapter-acpx-local typecheck` — passed.
- `pnpm --filter @paperclipai/server typecheck` — passed.
- `pnpm --filter @paperclipai/ui typecheck` — passed.
- Confirmed PR diff does not include `pnpm-lock.yaml`, database schema
files, or migrations.
Screenshots:



## Risks
- Medium risk: this introduces a new built-in adapter package and
touches runtime execution, adapter registration, agent config, skills,
and transcript rendering.
- ACPX and ACP agent behavior can vary by installed tool versions; the
adapter is marked experimental to set operator expectations.
- `pnpm-lock.yaml` is excluded per repository PR policy, so dependency
lock refresh must be handled by the repo’s automation or maintainers.
- No database migration risk: no schema or migration files changed.
> 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 coding agent based on GPT-5, with repository tool use,
shell execution, git operations, and local verification. Exact hosted
context window was not exposed in this environment.
## 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 run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-04-30 19:57:05 -05:00
|
|
|
const adapterSchemaMatch = url.pathname.match(/^\/api\/adapters\/([^/]+)\/config-schema$/);
|
|
|
|
|
if (adapterSchemaMatch) {
|
|
|
|
|
const [, adapterType] = adapterSchemaMatch;
|
|
|
|
|
const schemas = (window as typeof window & {
|
|
|
|
|
__paperclipStorybookAdapterSchemas?: Record<string, unknown>;
|
|
|
|
|
}).__paperclipStorybookAdapterSchemas;
|
|
|
|
|
const schema = schemas?.[adapterType];
|
|
|
|
|
if (schema) return Response.json(schema);
|
|
|
|
|
}
|
|
|
|
|
|
[codex] add comprehensive UI Storybook coverage (#4132)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies.
> - The board UI is the main operator surface, so its component and
workflow coverage needs to stay reviewable as the product grows.
> - This branch adds Storybook as a dedicated UI reference surface for
core Paperclip screens and interaction patterns.
> - That work spans Storybook infrastructure, app-level provider wiring,
and a large fixture set that can render real control-plane states
without a live backend.
> - The branch also expands coverage across agents, budgets, issues,
chat, dialogs, navigation, projects, and data visualization so future UI
changes have a concrete visual baseline.
> - This pull request packages that Storybook work on top of the latest
`master`, excludes the lockfile from the final diff per repo policy, and
fixes one fixture contract drift caught during verification.
> - The benefit is a single reviewable PR that adds broad UI
documentation and regression-surfacing coverage without losing the
existing branch work.
## What Changed
- Added Storybook 10 wiring for the UI package, including root scripts,
UI package scripts, Storybook config, preview wrappers, Tailwind
entrypoints, and setup docs.
- Added a large fixture-backed data source for Storybook so complex
board states can render without a live server.
- Added story suites covering foundations, status language,
control-plane surfaces, overview, UX labs, agent management, budget and
finance, forms and editors, issue management, navigation and layout,
chat and comments, data visualization, dialogs and modals, and
projects/goals/workspaces.
- Adjusted several UI components for Storybook parity so dialogs, menus,
keyboard shortcuts, budget markers, markdown editing, and related
surfaces render correctly in isolation.
- Rebasing work for PR assembly: replayed the branch onto current
`master`, removed `pnpm-lock.yaml` from the final PR diff, and aligned
the dashboard fixture with the current `DashboardSummary.runActivity`
API contract.
## Verification
- `pnpm --filter @paperclipai/ui typecheck`
- `pnpm --filter @paperclipai/ui build-storybook`
- Manual diff audit after rebase: verified the PR no longer includes
`pnpm-lock.yaml` and now cleanly targets current `master`.
- Before/after UI note: before this branch there was no dedicated
Storybook surface for these Paperclip views; after this branch the local
Storybook build includes the new overview and domain story suites in
`ui/storybook-static`.
## Risks
- Large static fixture files can drift from shared types as dashboard
and UI contracts evolve; this PR already needed one fixture correction
for `runActivity`.
- Storybook bundle output includes some large chunks, so future growth
may need chunking work if build performance becomes an issue.
- Several component tweaks were made for isolated rendering parity, so
reviewers should spot-check key board surfaces against the live app
behavior.
## Model Used
- OpenAI Codex, GPT-5-based coding agent in the Paperclip harness; exact
serving model ID is not exposed in-runtime to the agent.
- Tool-assisted workflow with terminal execution, git operations, local
typecheck/build verification, and GitHub CLI PR creation.
- Context window/reasoning mode not surfaced by the harness.
## 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 run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-04-20 12:13:23 -05:00
|
|
|
const companyResourceMatch = url.pathname.match(/^\/api\/companies\/([^/]+)\/([^/]+)$/);
|
|
|
|
|
if (companyResourceMatch) {
|
|
|
|
|
const [, companyId, resource] = companyResourceMatch;
|
|
|
|
|
if (resource === "agents") {
|
|
|
|
|
return Response.json(companyId === "company-storybook" ? storybookAgents : []);
|
|
|
|
|
}
|
|
|
|
|
if (resource === "projects") {
|
|
|
|
|
return Response.json(companyId === "company-storybook" ? storybookProjects : []);
|
|
|
|
|
}
|
|
|
|
|
if (resource === "approvals") {
|
|
|
|
|
return Response.json(companyId === "company-storybook" ? storybookApprovals : []);
|
|
|
|
|
}
|
|
|
|
|
if (resource === "dashboard") {
|
|
|
|
|
return Response.json({
|
|
|
|
|
...storybookDashboardSummary,
|
|
|
|
|
companyId,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (resource === "heartbeat-runs") {
|
|
|
|
|
return Response.json([]);
|
|
|
|
|
}
|
|
|
|
|
if (resource === "live-runs") {
|
|
|
|
|
return Response.json(companyId === "company-storybook" ? storybookLiveRuns : []);
|
|
|
|
|
}
|
|
|
|
|
if (resource === "inbox-dismissals") {
|
|
|
|
|
return Response.json([]);
|
|
|
|
|
}
|
|
|
|
|
if (resource === "sidebar-badges") {
|
|
|
|
|
return Response.json(
|
|
|
|
|
companyId === "company-storybook"
|
|
|
|
|
? storybookSidebarBadges
|
|
|
|
|
: { inbox: 0, approvals: 0, failedRuns: 0, joinRequests: 0 },
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (resource === "join-requests") {
|
|
|
|
|
return Response.json([]);
|
|
|
|
|
}
|
|
|
|
|
if (resource === "issues") {
|
|
|
|
|
const query = url.searchParams.get("q")?.trim().toLowerCase();
|
|
|
|
|
const issues = companyId === "company-storybook" ? storybookIssues : [];
|
|
|
|
|
return Response.json(
|
|
|
|
|
query
|
|
|
|
|
? issues.filter((issue) =>
|
|
|
|
|
`${issue.identifier ?? ""} ${issue.title} ${issue.description ?? ""}`.toLowerCase().includes(query),
|
|
|
|
|
)
|
|
|
|
|
: issues,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (url.pathname.startsWith("/api/invites/") && url.pathname.endsWith("/logo")) {
|
|
|
|
|
return new Response(null, { status: 204 });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return originalFetch(input, init);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function applyStorybookTheme(theme: "light" | "dark") {
|
|
|
|
|
if (typeof document === "undefined") return;
|
|
|
|
|
document.documentElement.classList.toggle("dark", theme === "dark");
|
|
|
|
|
document.documentElement.style.colorScheme = theme;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function StorybookProviders({
|
|
|
|
|
children,
|
|
|
|
|
theme,
|
|
|
|
|
}: {
|
|
|
|
|
children: ReactNode;
|
|
|
|
|
theme: "light" | "dark";
|
|
|
|
|
}) {
|
|
|
|
|
const [queryClient] = useState(
|
|
|
|
|
() =>
|
|
|
|
|
new QueryClient({
|
|
|
|
|
defaultOptions: {
|
|
|
|
|
queries: {
|
|
|
|
|
retry: false,
|
|
|
|
|
staleTime: Number.POSITIVE_INFINITY,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
applyStorybookTheme(theme);
|
|
|
|
|
}, [theme]);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<QueryClientProvider client={queryClient}>
|
|
|
|
|
<ThemeProvider>
|
|
|
|
|
<MemoryRouter initialEntries={["/PAP/storybook"]}>
|
|
|
|
|
<CompanyProvider>
|
|
|
|
|
<EditorAutocompleteProvider>
|
|
|
|
|
<ToastProvider>
|
|
|
|
|
<TooltipProvider>
|
|
|
|
|
<BreadcrumbProvider>
|
|
|
|
|
<SidebarProvider>
|
|
|
|
|
<PanelProvider>
|
|
|
|
|
<DialogProvider>{children}</DialogProvider>
|
|
|
|
|
</PanelProvider>
|
|
|
|
|
</SidebarProvider>
|
|
|
|
|
</BreadcrumbProvider>
|
|
|
|
|
</TooltipProvider>
|
|
|
|
|
</ToastProvider>
|
|
|
|
|
</EditorAutocompleteProvider>
|
|
|
|
|
</CompanyProvider>
|
|
|
|
|
</MemoryRouter>
|
|
|
|
|
</ThemeProvider>
|
|
|
|
|
</QueryClientProvider>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const preview: Preview = {
|
|
|
|
|
decorators: [
|
|
|
|
|
(Story, context) => {
|
|
|
|
|
const theme = context.globals.theme === "light" ? "light" : "dark";
|
|
|
|
|
return (
|
|
|
|
|
<StorybookProviders key={theme} theme={theme}>
|
|
|
|
|
<Story />
|
|
|
|
|
</StorybookProviders>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
globalTypes: {
|
|
|
|
|
theme: {
|
|
|
|
|
description: "Paperclip color mode",
|
|
|
|
|
defaultValue: "dark",
|
|
|
|
|
toolbar: {
|
|
|
|
|
title: "Theme",
|
|
|
|
|
icon: "mirror",
|
|
|
|
|
items: [
|
|
|
|
|
{ value: "dark", title: "Dark" },
|
|
|
|
|
{ value: "light", title: "Light" },
|
|
|
|
|
],
|
|
|
|
|
dynamicTitle: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
parameters: {
|
|
|
|
|
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
|
|
|
a11y: {
|
|
|
|
|
test: "error",
|
|
|
|
|
},
|
|
|
|
|
backgrounds: {
|
|
|
|
|
disable: true,
|
|
|
|
|
},
|
|
|
|
|
controls: {
|
|
|
|
|
expanded: true,
|
|
|
|
|
matchers: {
|
|
|
|
|
color: /(background|color)$/i,
|
|
|
|
|
date: /Date$/i,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
docs: {
|
|
|
|
|
toc: true,
|
|
|
|
|
},
|
|
|
|
|
layout: "fullscreen",
|
|
|
|
|
viewport: {
|
|
|
|
|
viewports: {
|
|
|
|
|
mobile: {
|
|
|
|
|
name: "Mobile",
|
|
|
|
|
styles: { width: "390px", height: "844px" },
|
|
|
|
|
},
|
|
|
|
|
tablet: {
|
|
|
|
|
name: "Tablet",
|
|
|
|
|
styles: { width: "834px", height: "1112px" },
|
|
|
|
|
},
|
|
|
|
|
desktop: {
|
|
|
|
|
name: "Desktop",
|
|
|
|
|
styles: { width: "1440px", height: "960px" },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default preview;
|