Commit Graph

81 Commits

Author SHA1 Message Date
Dotta
4292c28654 feat: auto-open browser after onboard completes
Set PAPERCLIP_OPEN_ON_LISTEN env flag when onboard triggers a run, and
open the browser to the UI URL once the server starts listening. Uses
the `open` package for cross-platform browser launching.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 11:22:18 -06:00
Dotta
996a6fcd57 server: seed first company and inline startup log fields 2026-03-03 11:11:04 -06:00
Dotta
11d42256a8 server: buffer embedded postgres logs and simplify startup message 2026-03-03 10:56:07 -06:00
Dotta
c77e2b3c19 server: auto-apply embedded postgres migrations on first run 2026-03-03 10:49:18 -06:00
Dotta
20737e2a11 cli/server: harden run startup for port conflicts and entrypoint loading 2026-03-03 10:41:31 -06:00
Dotta
f60c1001ec refactor: rename packages to @paperclipai and CLI binary to paperclipai
Rename all workspace packages from @paperclip/* to @paperclipai/* and
the CLI binary from `paperclip` to `paperclipai` in preparation for
npm publishing. Bump CLI version to 0.1.0 and add package metadata
(description, keywords, license, repository, files). Update all
imports, documentation, user-facing messages, and tests accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 08:45:26 -06:00
Dotta
dab5737b41 feat(agents): resolve agent shortnames to UUIDs in route params
Add router.param middleware that normalizes agent references, allowing
shortnames to be used in place of UUIDs in agent API routes. Includes
company-scoped lookup with ambiguity detection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 17:02:08 -06:00
Dotta
90dfa2e9cd feat(auth): add get-session endpoint and harden session resolution
Add /api/auth/get-session for board actors to retrieve their session
info. Wrap resolveSession in try/catch to prevent unhandled errors from
crashing requests when auth headers are missing or malformed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 17:02:01 -06:00
Dotta
ae5c85adb9 feat(agents): sort recent issues by most recent activity including comments
Update addComment to touch issue updatedAt so comment activity is
reflected in recency sorting. Sort assigned issues on agent detail
page by updatedAt desc so the most recently active issues appear first.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 16:55:37 -06:00
Dotta
83be94361c feat(core): merge backup core changes with post-split functionality 2026-03-02 16:43:59 -06:00
Dotta
bcc64f6533 feat: agent instructions path API with chain-of-command authz
Add PATCH /agents/:id/instructions-path endpoint for setting or clearing
an agent's instructions file path. Supports relative path resolution
against adapterConfig.cwd. Enforce chain-of-command authorization —
only the agent itself, board members, or ancestor managers can update.
Guard instructions path keys in the general agent update endpoint too.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 14:21:24 -06:00
Dotta
633885b57a fix: remove stale port 5173 references from board mutation guard
Update dev origin allowlist and tests to use port 3100 only, matching
the unified dev server setup. Fix AGENTS.md and README accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 14:21:09 -06:00
Dotta
ff472af343 feat: project workspace clear/update UX and creation docs
Add granular workspace management — clear local folder or repo URL
independently instead of deleting the whole workspace. Fix project
create route typing. Document inline workspace creation in API docs
and skill references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 14:21:03 -06:00
Dotta
ba388dc382 feat: create project workspace alongside project in single request
Allow passing an optional workspace object when creating a project,
creating both the project and its workspace in one API call.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 13:32:31 -06:00
Dotta
2488dc703c feat: @project mentions with colored chips in markdown and editors
Add project mention system using project:// URI scheme with optional
color parameter. Mentions render as colored pill chips in markdown
bodies and the WYSIWYG editor. Autocomplete in editors shows both
agents and projects. Server extracts mentioned project IDs from issue
content and returns them in the issue detail response.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 13:31:58 -06:00
Forgotten
ce3b31d2c3 feat: prune default values from company portability exports
Add default-value pruning for runtime config and adapter config during
export, producing cleaner bundles. Includes per-adapter defaults for
claude_local, codex_local, and openclaw.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 10:31:48 -06:00
Forgotten
cc2c724ad2 feat: company portability — export/import companies and agents
Add company export, import preview, and import endpoints with manifest-
based bundle format. Includes URL key utilities for agents and projects,
collision detection/rename strategies, and secret requirement tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 09:06:58 -06:00
Forgotten
e7de580aba fix: remove personal path from codex adapter test fixture
Replace personal home directory path with generic /home/user/project/... path
in test data to avoid leaking usernames into the repository.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 08:58:02 -06:00
Forgotten
c2709687b8 feat: server-side issue search, dashboard charts, and inbox badges
Add ILIKE-based issue search across title, identifier, description,
and comments with relevance ranking. Add assigneeUserId filter and
allow agents to return issues to creator. Show assigned issue count
in sidebar badges. Add minCount param to live-runs endpoint. Add
activity charts (run activity, priority, status, success rate) to
dashboard. Improve active agents panel with recent run cards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:33:39 -06:00
Forgotten
e2c5b6698c feat: join request claim secrets, onboarding API, and company branding
Add secure claim secret flow for agent join requests with timing-safe
comparison, expiry, and one-time use. Expose machine-readable onboarding
manifests and skill index API endpoints. Add company brand color with
hex validation, pattern icon generation, and settings page integration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:33:20 -06:00
Forgotten
9e89ca4a9e feat(adapter): claude local chrome flag and max-turns session handling
Add --chrome flag support for Claude adapter. Detect max-turns
exhaustion (via subtype, stop_reason, or result text) and clear
the session to prevent stale session re-use. Add unit tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:33:10 -06:00
Forgotten
b0f3f04ac6 feat: add OpenClaw adapter type
Introduce openclaw adapter package with server execution, CLI stream
formatting, and UI config fields. Register the adapter across CLI,
server, and UI registries. Add adapter label in all relevant pages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:32:59 -06:00
Forgotten
e4e5609132 feat: per-issue assignee adapter overrides (model, effort, workspace)
Add assigneeAdapterOverrides JSONB column to issues, allowing per-issue
model, thinking effort, and workspace overrides when assigning to agents.
Heartbeat service merges overrides into adapter config at runtime. New
Issue dialog exposes these options for Claude and Codex adapters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 10:32:44 -06:00
Forgotten
45c4df7b8a feat: add billing type tracking and cost enhancements
Add AdapterBillingType (api/subscription/unknown) to adapter execution results
so the system can distinguish API-billed vs subscription-billed runs. Enhance
cost service to aggregate subscription vs API run counts and token breakdowns.
Add limit param to heartbeat runs list API and client.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 21:35:44 -06:00
Forgotten
20a4ca08a5 feat: workspace improvements - nullable cwd, repo-only workspaces, and resolution refactor
Make workspace cwd optional to support repo-only workspaces that don't require
a local directory. Refactor workspace resolution in heartbeat service to pass
all workspace hints to adapters, add fallback logic when project workspaces
have no valid local cwd, and improve workspace name derivation. Also adds limit
param to heartbeat runs list endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 21:35:33 -06:00
Forgotten
32cbdbc0b9 feat: authenticate WebSocket upgrades in authenticated mode
Resolve Better Auth sessions from raw headers for WS upgrade
requests. Verify instance admin or company membership before
allowing live-events connections in authenticated mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 08:39:20 -06:00
Forgotten
1c2873d22a feat: enforce agent icon enum and expose via LLM endpoint
Move icon name list to shared constants with strict enum validation.
Add /llms/agent-icons.txt endpoint, pass icon through hire flow,
and update skills to reference icon discovery step.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 08:39:11 -06:00
Forgotten
9f049aa4f3 feat: resolve agent workspace from session/project/fallback
Heartbeat service resolves cwd from task session, project primary
workspace, or agent home directory (~/.paperclip/instances/.../workspaces/).
Adapters receive workspace context and forward it as env vars and
session params. cwd is now optional in adapter config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 08:38:58 -06:00
Forgotten
29af525167 feat: add project workspaces (DB, API, service, and UI)
New project_workspaces table with primary workspace designation.
Full CRUD routes, service with auto-primary promotion on delete,
workspace management UI in project properties panel, and workspace
data included in project/issue ancestor responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 08:38:46 -06:00
Forgotten
6f7172c028 feat: add issue labels (DB schema, API, and service)
New labels and issue_labels tables with cascade deletes, unique
per-company name constraint. CRUD routes for labels, label filtering
on issue list, and label sync on issue create/update. All issue
responses now include labels array.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 08:38:37 -06:00
Forgotten
85c0b9a3dc feat: private hostname guard for authenticated/private mode
Reject requests from unrecognised Host headers when running
authenticated/private. Adds server middleware, CLI `allowed-hostname`
command, config-schema field, and prompt support for configuring
allowed hostnames during onboard/configure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 19:43:52 -06:00
Forgotten
390e4dd839 feat: add board-claim flow for local_trusted -> authenticated migration
One-time high-entropy claim URL printed at startup when the only
instance admin is local-board. Signed-in user claims ownership,
gets promoted to instance_admin, and receives active memberships
across all existing companies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 16:25:31 -06:00
Forgotten
d2d927bd2f feat(db): enforce globally unique issue prefixes and identifiers
Derive issue_prefix from first 3 letters of company name with
deterministic suffixes on collision. Migration rebuilds existing
prefixes, reassigns issue numbers, and adds unique indexes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 16:08:10 -06:00
Forgotten
e1f2be7ecf feat(server): integrate Better Auth, access control, and deployment mode startup
Wire up Better Auth for session-based authentication. Add actor middleware
that resolves local_trusted mode to an implicit board actor and authenticated
mode to Better Auth sessions. Add access service with membership, permission,
invite, and join-request management. Register access routes for member/invite/
join-request CRUD. Update health endpoint to report deployment mode and
bootstrap status. Enforce tasks:assign and agents:create permissions in issue
and agent routes. Add deployment mode validation at startup with guardrails
(loopback-only for local_trusted, auth config required for authenticated).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:40:32 -06:00
Forgotten
60d6122271 feat: add auth/access foundation - deps, DB schema, shared types, and config
Add Better Auth, drizzle-orm, @dnd-kit, and remark-gfm dependencies.
Introduce DB schema for auth tables (user, session, account, verification),
company memberships, instance user roles, permission grants, invites, and
join requests. Add assigneeUserId to issues. Extend shared config schema
with deployment mode/exposure/auth settings, add access types and validators,
and wire up new API path constants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:40:16 -06:00
Forgotten
a57d3427f7 feat: foldable PROJECTS section in sidebar with color support
- Add `color` (text) and `archivedAt` (timestamp) columns to projects table
- Add PROJECT_COLORS palette constant (10 colors) in shared package
- Add color/archivedAt to Project type interface and Zod validators
- Auto-assign next available color from palette on project creation
- New SidebarProjects component with:
  - Collapsible PROJECTS header above WORK section
  - Caret toggle visible on hover (left of header)
  - Always-visible plus button (right of header) opens NewProjectDialog
  - Lists non-archived projects with colored rounded squares
  - Active project highlighted based on URL match
- Remove Projects nav item from WORK section in sidebar

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 09:14:08 -06:00
Forgotten
fe63c10d69 Include issue identifier in all activity log details for notifications
Activity log events for issue.created and issue.updated were missing
the identifier field in their details, causing toast notifications to
fall back to showing a truncated UUID hash instead of the shortname
(e.g. PAP-47). Also includes checkout lock adoption and activity
query improvements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 08:23:44 -06:00
Forgotten
9906a5ba06 Support issue identifiers (PAP-39) in URLs and prefer them throughout
Backend:
- Add router.param middleware in issues, activity, and agents routes to
  resolve identifiers (e.g. PAP-39) to UUIDs before handlers run
- Simplify GET /issues/:id now that param middleware handles resolution
- Include identifier in getAncestors response and issuesForRun query
- Add identifier field to IssueAncestor shared type

Frontend:
- Update all issue navigation links across 15+ files to use
  issue.identifier ?? issue.id instead of bare UUIDs
- Add URL redirect in IssueDetail: navigating via UUID automatically
  replaces the URL with the human-readable identifier
- Fix childIssues filter to use issue.id (UUID) instead of URL param
  so it works correctly with identifier-based URLs
- Add issueUrl() utility in lib/utils.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:04:05 -06:00
Forgotten
0c0c308594 Make toast notifications more informative
- Server: Add bodySnippet, identifier, issueTitle to comment_added
  activity details so the UI can show comment content
- Client: Show comment snippet in comment toasts instead of just
  "posted a comment on PAP-39"
- Client: Add agent title/role as body text in agent status toasts
- Client: Show trigger detail in run status toasts for context

PAP-31

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 15:52:53 -06:00
Forgotten
82da8739c1 Add board mutation guard middleware
Require trusted browser origin (Origin or Referer header) for
mutating requests from board actors, preventing cross-origin
mutation attempts against the local-trusted API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 15:48:30 -06:00
Forgotten
49e15f056d Implement issue execution lock with deferred wake promotion
Add per-issue execution lock (executionRunId, executionAgentNameKey,
executionLockedAt) to prevent concurrent runs on the same issue.
Same-name wakes are coalesced into the active run; different-name
wakes are deferred and promoted when the lock holder finishes.

Includes checkout/release run ownership enforcement, agent run ID
propagation from JWT claims, wakeup deduplication across assignee
and mention wakes, and claimQueuedRun extraction for reuse. Adds
two DB migrations for checkoutRunId and execution lock columns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 15:48:22 -06:00
Forgotten
b459668009 fix: derive costs by-project from run usage instead of cost events
Joins heartbeat runs to issues via activity log to attribute costs to
projects. Shows project names instead of raw IDs in the UI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:47:21 -06:00
Forgotten
ef700c2391 feat: add project_goals many-to-many join table
Create project_goals join table with composite PK (project_id, goal_id),
backfill from existing projects.goal_id, and update the project service
to read/write through the join table. Shared types now include goalIds
and goals arrays on Project. Legacy goalId column is kept in sync.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:43:25 -06:00
Forgotten
a621b55e90 Refine mention-triggered wake behavior and self-assign rules
Update agent skill to allow self-assign only on explicit @-mention
handoff with PAPERCLIP_WAKE_COMMENT_ID. Enrich wake contextSnapshot
with taskId, wakeCommentId, and wakeReason fields so agents can
identify mention-triggered runs. Clarify api-reference exception
for handoff-by-mention pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:50:56 -06:00
Forgotten
a4ba4a72cd Add MarkdownEditor component, asset image upload, and rich description editing
Introduce MarkdownEditor built on @mdxeditor/editor with headings,
lists, links, quotes, image upload with drag-and-drop, and themed CSS
integration. Add asset image upload API (routes, service, storage) and
wire image upload into InlineEditor multiline mode, NewIssueDialog,
NewProjectDialog, GoalDetail, IssueDetail, and ProjectDetail
description fields. Tighten prompt template editor styling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:50:45 -06:00
Forgotten
0131cf3449 Support concurrent heartbeat runs with maxConcurrentRuns policy
Add per-agent maxConcurrentRuns (1-10) controlling how many runs
execute simultaneously. Implements agent-level start lock, optimistic
claim-then-execute flow, atomic token accounting via SQL expressions,
and proper status resolution when parallel runs finish. Updates UI
config form, live run count display, and SSE invalidation to avoid
unnecessary refetches on run event streams.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:50:34 -06:00
Forgotten
f80a802592 Add adapter environment testing infrastructure
Introduce testEnvironment() on ServerAdapterModule with structured
pass/warn/fail diagnostics for all four adapter types (claude_local,
codex_local, process, http). Adds POST test-environment endpoint,
shared types/validators, adapter test implementations, and UI API
client. Includes asset type foundations used by related features.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:50:23 -06:00
Forgotten
8d5525d0da Add live badge to issues with active runs on /issues/active
Server: the /companies/:companyId/live-runs endpoint now returns
issueId extracted from contextSnapshot, so the UI can match runs
to issues without N+1 queries.

UI (Issues.tsx): fetches company live runs (with 5s polling), builds
a set of issue IDs with active runs, and shows a pulsing "Live" badge
in each matching issue row — matching the existing blue live indicator
style from AgentDetail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:24:38 -06:00
Forgotten
a22af8f72f Clean up attachment objects on issue delete and suppress responseTime in logs
Delete storage objects for each attachment when an issue is removed.
Hide responseTime from pino-pretty console output to reduce noise.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:29:03 -06:00
Forgotten
6d0f58d559 fix: storage S3 stream conversion, API client FormData support, and attachment API
Fix S3 provider to use async generator for web stream conversion instead
of Readable.fromWeb, add postForm helper and attachment API methods to
the UI client, and add local disk storage provider tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:33:10 -06:00