Commit Graph

51 Commits

Author SHA1 Message Date
Richard Anaya
aa854e7efe fix: include toolName in tool_result transcript entries for Pi adapter
When tool_result entries arrive without a matching tool_call, the transcript
was showing generic 'tool' as the name. Now pl-local parses toolName from
tool_execution_end events and passes it through, so the UI can display
the actual tool name (e.g., 'bash', 'Read', 'Ls') instead of 'tool'.
2026-03-18 20:51:59 -07:00
dotta
0036f0e9a1 fix: add npm provenance package metadata 2026-03-17 16:01:48 -05:00
Dotta
4d9769c620 fix: address review feedback on skills and session compaction 2026-03-17 09:21:44 -05:00
Dotta
fee3df2e62 Make session compaction adapter-aware
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-17 09:10:46 -05:00
Dotta
76e6cc08a6 feat(costs): add billing, quota, and budget control plane 2026-03-16 15:11:01 -05:00
Sai Shankar
656b4659fc refactor(quota): move provider quota logic into adapter layer, add unit tests
- Extract all Anthropic credential/API logic into claude-local/src/server/quota.ts
- Extract all OpenAI/WHAM credential/API logic into codex-local/src/server/quota.ts
- Add optional getQuotaWindows() to ServerAdapterModule in adapter-utils
- Rewrite quota-windows.ts as a 29-line thin aggregator with zero provider knowledge
- Wire getQuotaWindows into adapter registry for claude-local and codex-local
- Add 47 unit tests covering toPercent, secondsToWindowLabel, WHAM normalization,
  readClaudeToken, readCodexToken, fetchClaudeQuota, fetchCodexQuota, fetchWithTimeout
- Add 8 unit tests covering parseDateRange validation and byProvider pro-rata math

Adding a third provider now requires only touching that provider's adapter.
2026-03-16 15:08:54 -05:00
Dotta
dcd8a47d4f Merge pull request #713 from paperclipai/release/0.3.1
Release/0.3.1
2026-03-14 11:00:24 -05:00
Dotta
7d1748b3a7 feat: optimize heartbeat token usage
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-13 09:40:43 -05:00
Dotta
29a743cb9e fix: keep runtime skills scoped to ./skills
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-13 08:49:25 -05:00
Dotta
4e759da070 fix: prefer .agents skills and repair codex symlink targets\n\nCo-Authored-By: Paperclip <noreply@paperclip.ing> 2026-03-13 08:49:25 -05:00
Dotta
63c62e3ada chore: release v0.3.1 2026-03-12 13:09:22 -05:00
Dotta
44396be7c1 Merge remote-tracking branch 'public-gh/master'
* public-gh/master:
  Default Gemini adapter to yolo mode and add API access prompt note
  fix: remove Cmd+1..9 company-switch shortcut
  fix(ui): prevent IME composition Enter from moving focus in new issue title
  fix(cli): add restart hint after allowed-hostname change
  docs: remove obsolete TODO for CONTRIBUTING.md
  fix: default dangerouslySkipPermissions to true for unattended agents
  fix: route heartbeat cost recording through costService
  Show issue creator in properties sidebar
2026-03-12 08:09:06 -05:00
Dotta
ee3d8c1890 Redact home paths in transcript views
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-11 20:56:47 -05:00
Aaron
6bfe0b8422 Default Gemini adapter to yolo mode and add API access prompt note
Gemini CLI only registers run_shell_command in --approval-mode yolo.
Non-yolo modes don't expose it at all, making Paperclip API calls
impossible. Always pass --approval-mode yolo and remove the now-unused
policy engine code, approval mode config, and UI toggles.

Add a "Paperclip API access note" to the prompt with curl examples
via run_shell_command, since the universal SKILL.md is tool-agnostic.

Also extract structured question events from Gemini assistant messages
to support interactive approval flows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 01:45:08 +00:00
Dotta
87b8e21701 Humanize run transcripts across run detail and live surfaces
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-11 10:35:41 -05:00
Dotta
3120c72372 Add worktree-aware workspace runtime support 2026-03-10 10:58:38 -05:00
Dotta
1a53567cb6 Apply suggestions from code review
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-10 07:24:48 -05:00
Jayakrishnan
9248881d42 fix(adapter-utils): strip Claude Code env vars from child processes
When the Paperclip server is started from within a Claude Code session
(e.g. `npx paperclipai run` in a Claude Code terminal), the `CLAUDECODE`
and related env vars (`CLAUDE_CODE_ENTRYPOINT`, `CLAUDE_CODE_SESSION`,
`CLAUDE_CODE_PARENT_SESSION`) leak into `process.env`. Since
`runChildProcess()` spreads `process.env` into the child environment,
every spawned `claude` CLI process inherits these vars and immediately
exits with: "Claude Code cannot be launched inside another Claude Code
session."

This is particularly disruptive for the `claude-local` adapter, where
every agent run spawns a `claude` child process. A single contaminated
server start (or cron job that inherits the env) silently breaks all
agent executions until the server is restarted in a clean environment.

The fix deletes the four known Claude Code nesting-guard env vars from
the merged environment before passing it to `spawn()`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 12:01:46 +00:00
Dotta
7e8908afa2 chore: release v0.3.0 2026-03-09 16:31:12 -05:00
Dotta
5dd1e6335a Fix root TypeScript solution config 2026-03-09 14:09:30 -05:00
online5880
f4a9788f2d fix: tighten Windows adapter command handling 2026-03-09 22:08:50 +09:00
online5880
d7b98a72b4 fix: support Windows command wrappers for local adapters 2026-03-09 21:52:06 +09:00
Dotta
cbce8bfbc3 Merge remote-tracking branch 'public-gh/master'
* public-gh/master:
  fix(ui): wrap failed run card actions on mobile
  feat(codex): add gpt-5.4 to codex_local model list
  persist paperclip data in a named volume
  add support to `cursor` and `opencode` in containerized instances
  force `@types/node@24` in the server
  Add artifact-check to fail fast on broken builds
  remove an insecure default auth secret
  expose `PAPERCLIP_ALLOWED_HOSTNAMES` in compose files
  wait for a health db
  update lock file
  update typing to node v24 from v20
  add missing `openclaw` adapter from deps stage
  fix incorrect pkg scope
  update docker base image
  move docker into `authenticated` deployment mode
2026-03-06 10:14:11 -06:00
Dotta
3369a9e685 feat(openclaw): add adapter hire-approved hooks 2026-03-06 08:17:42 -06:00
Dotta
81bc8c7313 Improve OpenClaw SSE transcript parsing and stream readability 2026-03-05 17:26:00 -06:00
zvictor
e5049a448e update typing to node v24 from v20 2026-03-05 14:36:00 -03:00
Dotta
1c9b7ef918 coalesce cursor thinking deltas in run log streaming 2026-03-05 08:35:00 -06:00
Dotta
358467a506 chore: release v0.2.7 2026-03-04 14:51:33 -06:00
Dotta
5dffdbb382 chore: release v0.2.6 2026-03-04 10:24:03 -06:00
Dotta
6141d5c3f2 chore: release v0.2.5
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 16:14:33 -06:00
Dotta
ab3b9ab19f chore: bump all packages to 0.2.4
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 16:10:52 -06:00
Dotta
28bf5e9e9b chore: release v0.2.3 2026-03-03 15:39:13 -06:00
Dotta
b2737b9571 chore: release v0.2.2 2026-03-03 15:10:25 -06:00
Dotta
52e936a770 chore: bump all packages to 0.2.1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 15:08:09 -06:00
Dotta
defccdd4d9 feat: integrate Changesets for multi-package npm publishing
Migrate from single-bundle CLI publishing to publishing all @paperclipai/*
packages individually via Changesets. This fixes the "Cannot find package
@paperclipai/server" error when installing from npm.

Changes:
- Add @changesets/cli with fixed versioning (all packages share version)
- Make 7 packages publishable (shared, adapter-utils, db, 3 adapters, server)
- Add build scripts, publishConfig, and files fields to all packages
- Mark @paperclipai/server as external in CLI esbuild config
- Simplify CLI importServerEntry() to use string-literal dynamic import
- Add generate-npm-package-json support for external workspace packages
- Create scripts/release.sh for one-command releases
- Remove old bump-and-publish.sh and version-bump.sh
- All packages start at version 0.2.0

Usage: ./scripts/release.sh patch|minor|major [--dry-run]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 14:46:16 -06:00
Dotta
778fc3416f Fix agent API URL injection for auto-selected server ports 2026-03-03 13:13:47 -06:00
Dotta
8351f7f1bd Auto-create missing cwd for claude_local and codex_local 2026-03-03 12:29:32 -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
83be94361c feat(core): merge backup core changes with post-split functionality 2026-03-02 16:43:59 -06:00
Forgotten
614974f81c feat(adapter): add instructionsFilePath to config types and UI builders
Wire up instructionsFilePath in CreateConfigValues, adapter docs, and
UI config builders for both Claude and Codex adapters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:34:29 -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
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
2ddf6213fd feat(adapter): detect claude-login-required errors and expose errorCode/errorMeta
Add detectClaudeLoginRequired and extractClaudeLoginUrl to parse module.
Extract buildClaudeRuntimeConfig for reuse by both execute and the new
runClaudeLogin helper. Include errorCode: "claude_auth_required" and
errorMeta: { loginUrl } in execution results when login is needed.
Export runClaudeLogin from the package index.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:40:44 -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
2c3c2cf724 feat: adapter model discovery, reasoning effort, and improved codex formatting
Add dynamic OpenAI model list fetching for codex adapter with caching,
async listModels interface, reasoning effort support for both claude and
codex adapters, optional timeouts (default to unlimited), wakeCommentId
context propagation, and richer codex stdout event parsing/formatting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:32:07 -06:00
Forgotten
d26b67ebc3 Add secrets infrastructure: DB tables, shared types, env binding model, and migration improvements
Introduce company_secrets and company_secret_versions tables for
encrypted secret storage. Add EnvBinding discriminated union (plain vs
secret_ref) to replace raw string env values in adapter configs. Add
hiddenAt column to issues for soft-hiding. Improve migration system
with journal-ordered application and manual fallback when Drizzle
migrator can't reconcile history.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:43:43 -06:00
Forgotten
d56618e9fe Add adapter session codecs with cwd-aware resume and unknown-session retry
Introduce AdapterSessionCodec interface for structured session serialization,
deserialization, and display ID extraction. Implement codecs for claude_local
and codex_local adapters with cwd validation — sessions saved for a different
working directory are not resumed. Both adapters now return sessionParams and
sessionDisplayId alongside legacy sessionId.

Add isCodexUnknownSessionError detection and automatic retry with fresh session
for codex_local (matching existing claude_local behavior). Inject approval
context env vars (PAPERCLIP_APPROVAL_ID, PAPERCLIP_APPROVAL_STATUS,
PAPERCLIP_LINKED_ISSUE_IDS) into adapter environments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:01:58 -06:00
Forgotten
0d73e1b407 Add adapter config docs, approval context env vars, and paperclip-create-agent skill
Export agentConfigurationDoc from all adapters for LLM reflection. Inject
PAPERCLIP_APPROVAL_ID, PAPERCLIP_APPROVAL_STATUS, and PAPERCLIP_LINKED_ISSUE_IDS
into local adapter environments. Update SKILL.md with approval handling procedure,
issue-approval linking, and config revision documentation. Add new
paperclip-create-agent skill for CEO-driven agent hiring workflows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:02:53 -06:00
Forgotten
fe6a8687c1 Implement local agent JWT authentication for adapters
Add HS256 JWT-based authentication for local adapters (claude_local, codex_local)
so agents authenticate automatically without manual API key configuration. The
server mints short-lived JWTs per heartbeat run and injects them as PAPERCLIP_API_KEY.
The auth middleware verifies JWTs alongside existing static API keys.

Includes: CLI onboard/doctor JWT secret management, env command for deployment,
config path resolution from ancestor directories, dotenv loading on server startup,
event payload secret redaction, multi-status issue filtering, and adapter transcript
parsing for thinking/user message kinds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 16:46:45 -06:00
Forgotten
35880c8a1e Improve claude-local adapter execution and shared utils
Enhance claude-local server executor with better process management
and output handling. Improve stdout parser for UI transcript display.
Update adapter-utils types and server utilities.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:29:24 -06:00