Commit graph

111 commits

Author SHA1 Message Date
Nathan Flurry
4629299d1a Isolate v1 API test env setup 2026-03-15 17:55:19 -07:00
Nathan Flurry
15dc2dc375 Stabilize ACP lazy install test 2026-03-15 17:55:19 -07:00
Nathan Flurry
153480256a Use real desktop stack in tests 2026-03-15 17:55:19 -07:00
Nathan Flurry
5e20011fd1 Stabilize Docker test PATH mounting in CI 2026-03-15 17:55:19 -07:00
Nathan Flurry
abf9b1858f Add Docker-backed integration test rig 2026-03-15 17:55:19 -07:00
Nathan Flurry
c74d8c9179 Add desktop runtime API and SDK support 2026-03-15 17:54:16 -07:00
Nathan Flurry
99abb9d42e
chore(foundry): workbench action responsiveness (#254)
* wip

* wip
2026-03-14 20:42:18 -07:00
Nathan Flurry
d8b8b49f37
Fix Foundry UI bugs: org names, sessions, and repo selection (#250)
* Fix Foundry auth: migrate to Better Auth adapter, fix access token retrieval

- Remove @ts-nocheck from better-auth.ts, auth-user/index.ts, app-shell.ts
  and fix all type errors
- Fix getAccessTokenForSession: read GitHub token directly from account
  record instead of calling Better Auth's internal /get-access-token
  endpoint which returns 403 on server-side calls
- Re-implement workspaceAuth helper functions (workspaceAuthColumn,
  normalizeAuthValue, workspaceAuthClause, workspaceAuthWhere) that were
  accidentally deleted
- Remove all retry logic (withRetries, isRetryableAppActorError)
- Implement CORS origin allowlist from configured environment
- Document cachedAppWorkspace singleton pattern
- Add inline org sync fallback in buildAppSnapshot for post-OAuth flow
- Add no-retry rule to CLAUDE.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add Foundry dev panel from fix-git-data branch

Port the dev panel component that was left out when PR #243 was replaced
by PR #247. Adapted to remove runtime/mock-debug references that don't
exist on the current branch.

- Toggle with Shift+D, persists visibility to localStorage
- Shows context, session, GitHub sync status sections
- Dev-only (import.meta.env.DEV)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add full Docker image defaults, fix actor deadlocks, and improve dev experience

- Add Dockerfile.full and --all flag to install-agent CLI for pre-built images
- Centralize Docker image constant (FULL_IMAGE) pinned to 0.3.1-full
- Remove examples/shared/Dockerfile{,.dev} and daytona snapshot example
- Expand Docker docs with full runnable Dockerfile
- Fix self-deadlock in createWorkbenchSession (fire-and-forget provisioning)
- Audit and convert 12 task actions from wait:true to wait:false
- Add bun --hot for dev backend hot reload
- Remove --force from pnpm install in dev Dockerfile for faster startup
- Add env_file support to compose.dev.yaml for automatic credential loading
- Add mock frontend compose config and dev panel
- Update CLAUDE.md with wait:true policy and dev environment setup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* WIP: async action fixes and interest manager

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix Foundry UI bugs: org names, hanging sessions, and wrong repo creation

- Fix org display name using GitHub description instead of name field
- Fix createWorkbenchSession hanging when sandbox is provisioning
- Fix auto-session creation retry storm on errors
- Fix task creation using wrong repo due to React state race conditions
- Remove Bun hot-reload from backend Dockerfile (causes port drift)
- Add GitHub sync/install status to dev panel

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:48:22 -07:00
Nathan Flurry
d2346bafb3
Configure lefthook formatter checks (#231)
* Add lefthook formatter checks

* Fix SDK mode hydration

* Stabilize SDK mode integration test
2026-03-10 23:03:11 -07:00
Nathan Flurry
76586f409f
Add ACP permission mode support to the SDK (#224)
* chore: recover hamburg workspace state

* chore: drop workspace context files

* refactor: generalize permissions example

* refactor: parse permissions example flags

* docs: clarify why fs and terminal stay native

* feat: add interactive permission prompt UI to Inspector

Add permission request handling to the Inspector UI so users can
Allow, Always Allow, or Reject tool calls that require permissions
instead of having them auto-cancelled. Wires up SDK
onPermissionRequest/respondPermission through App → ChatPanel →
ChatMessages with proper toolCallId-to-pendingId mapping.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: prevent permission reply from silently escalating "once" to "always"

Remove allow_always from the fallback chain when the user replies "once",
aligning with the ACP spec which says "map by option kind first" with no
fallback for allow_once. Also fix Inspector to use rawSend, revert
hydration guard to accept empty configOptions, and handle respondPermission
errors by rejecting the pending promise.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:52:43 -07:00
Nathan Flurry
febe8601f6
feat: add process management support (#207)
* feat: improve inspector UI for processes and fix PTY terminal

- Simplify ProcessRunTab layout: compact form with collapsible Advanced section for timeout/maxOutputBytes
- Rewrite ProcessesTab: collapsible create form, lightweight list items with status dots, clean detail panel with tabs
- Extract error details: use problem.detail instead of generic "Stream Error" title for better error messages
- Fix GhosttyTerminal binary frame parsing: handle server's binary ArrayBuffer control frames (ready/exit/error)
- Enable WebSocket proxying in Vite dev server with ws: true
- Set TERM=xterm-256color default for TTY processes so tools like tmux, vim, htop work out of the box
- Remove orange gradient background from terminal container for cleaner look
- Remove orange left border from selected process list items
- Update inspector CSS with new process/terminal styles

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: address review issues and add processes documentation

- Fix unstable onExit callback in ProcessesTab (useCallback)
- Fix SSE follow stream race condition (subscribe before history read)
- Update inspector.mdx with new process management features
- Change observability icon to avoid conflict with processes
- Add docs/processes.mdx covering the full process management API

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: simplify processes doc — rename sections, remove low-level protocol

- Rename "Interactive terminals" to "Terminals" with "Connect to a terminal" sub-heading
- Add TTY process creation step at top of Terminals section
- Remove low-level WebSocket protocol table and raw WebSocket example
- Keep browser terminal emulator reference with Ghostty link

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: update GhosttyTerminal permalink to latest commit

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: use main branch permalink for GhosttyTerminal reference

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: refine process API — WebSocket binary protocol, SDK terminal session, updated tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: update GhosttyTerminal permalink to 636eefb

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* inspector: use websocket terminal API

* sdk: restore high-level terminal session

* docs: update inspector terminal permalink

* inspector: update run once placeholder

* Fix lazy install v1 API test fixture

* Add reusable React terminal component

* Fix terminal WebSocket ready state checks

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-07 17:58:31 -08:00
Nathan Flurry
e7656d78f0
perf: improve startup instrumentation and replace npx with npm install (#208)
Add comprehensive tracing instrumentation across the entire agent startup path (gigacode CLI, ACP HTTP adapter, agent installation, and process spawning) to enable detailed performance profiling. Replace npm-based agent process launchers that use npx (incurring resolution overhead on every spawn) with pre-installed npm packages, reducing startup latency. Improve error diagnostics when agent processes crash by capturing exit codes and stderr tails. Update error handling to map exited processes to dedicated error variants with actionable error messages.

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-06 12:05:19 -08:00
Nathan Flurry
9ada842cf2 chore(release): update version to 0.2.2 2026-03-06 00:28:08 -08:00
Nathan Flurry
c91791f88d
feat: add configuration for model, mode, and thought level (#205)
* feat: add configuration for model, mode, and thought level

* docs: document Claude effort-level filesystem config

* fix: prevent panic on empty modes/thoughtLevels in parse_agent_config

Use `.first()` with safe fallback instead of direct `[0]` index access,
which would panic if the Vec is empty and no default is set.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: harden session lifecycle and align cli.mdx example with claude.json

- destroySession: wrap session/cancel RPC in try/catch so local cleanup
  always succeeds even when the agent is unreachable
- createSession/resumeOrCreateSession: clean up the remote session if
  post-creation config calls (setMode/setModel/setThoughtLevel) fail,
  preventing leaked orphan sessions
- cli.mdx: fix example output to match current claude.json (model name,
  model order, and populated modes)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: harden session lifecycle and align config persistence logic

- resumeOrCreateSession: Remove destroy-on-error for the resume path. Config
  errors now propagate without destroying a pre-existing session. The destroy
  pattern remains in createSession (where the session is newly created and has
  no prior state to preserve).

- setSessionMode fallback: When session/set_mode returns -32601 and the
  fallback uses session/set_config_option, now keep modes.currentModeId
  in sync with the updated currentValue. Prevents stale cached state in
  getModes() when the fallback path is used.

- persistSessionStateFromMethod: Re-read the record from persistence instead
  of using a stale pre-await snapshot. Prevents race conditions where
  concurrent session/update events (processed by persistSessionStateFromEvent)
  are silently overwritten by optimistic updates.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: correct doc examples with valid Codex modes and update stable API list

- Replace invalid Codex mode values ("plan", "build") with valid ones
  ("auto", "full-access") in agent-sessions.mdx and sdk-overview.mdx
- Update CLAUDE.md stable method enumerations to include new session
  config methods (setSessionMode, setSessionModel, etc.)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add OpenAPI annotations for process endpoints and fix config persistence race

Add summary/description to all process management endpoint specs and the
not_found error type. Fix hydrateSessionConfigOptions to re-read from
persistence after the network call, and sync mode-category configOptions
on session/update current_mode_update events.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 00:24:32 -08:00
Nathan Flurry
4335ef6af6
feat: add process management API (#203)
* feat: add process management API

Introduces a complete Process Management API for Sandbox Agent with process lifecycle management (start, stop, kill, delete), one-shot command execution, log streaming via SSE and WebSocket, stdin input, and PTY/terminal support. Includes new process_runtime module for managing process state, HTTP route handlers, OpenAPI documentation, and integration tests.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: address review issues in process management API

- Add doc comments to all 13 new #[utoipa::path] handlers (CLAUDE.md compliance)
- Fix send_signal ESRCH check: use raw_os_error() == Some(libc::ESRCH) instead of ErrorKind::NotFound
- Add max_input_bytes_per_request enforcement in WebSocket terminal handler
- URL-decode access_token query parameter for WebSocket auth
- Replace fragile string prefix matching with proper SandboxError::NotFound variant

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* feat: add TypeScript SDK support for process management

Add process CRUD operations (create, get, list, update, delete) and
event streaming to the TypeScript SDK. Includes integration tests,
mock agent updates, and test environment fixes for cross-platform
home directory handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: provide WebSocket impl for process terminal test on Node 20

Node 20 lacks globalThis.WebSocket. Add ws as a devDependency and
pass it to connectProcessTerminalWebSocket in the integration test
so CI no longer fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-05 18:20:20 -08:00
Nathan Flurry
94353f7696 chore: fix bad merge 2026-02-11 07:57:02 -08:00
Nathan Flurry
b9efe971ff chore: fix bad merge 2026-02-11 07:33:19 -08:00
NathanFlurry
e72eb9f611
acp spec (#155) 2026-02-11 14:47:41 +00:00
Nathan Flurry
4c6c5983c0 Merge branch 'main' into feat/support-pi 2026-02-10 22:27:03 -08:00
WellDunDun
9c7a08a165 fix: OpenCode event streaming + bypass permission mode
Three independent fixes for the OpenCode agent adapter:

1. Wrong API endpoints: /event/subscribe → /event, /session/{id}/prompt → /session/{id}/message
2. Untagged enum mis-dispatch: replace serde_json::from_value with manual type-field dispatch
3. Wire permissionMode "bypass" for OpenCode: allow in normalize_permission_mode() and pass
   --dangerously-skip-permissions to CLI (both spawn and spawn_streaming)

Tested with OpenCode 1.1.48 + Kimi K2.5.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 22:13:17 -08:00
Nathan Flurry
87a4e81d31
Merge pull request #153 from soilSpoon/feature/ampcode
feature(ampcode): Enhances ampcode schema with new message types and fields
2026-02-10 22:12:08 -08:00
Nathan Flurry
4322cb1d8e
Merge pull request #148 from bobbythelobster/add-cursor-agent-support
Add cursor-agent support
2026-02-10 22:11:57 -08:00
Nathan Flurry
edf5c5d299
Merge pull request #59 from gregce/fix/spawn-streaming-env-vars
fix(agent-management): pass env vars to agent in spawn_streaming
2026-02-10 22:11:45 -08:00
이대희
9486343f4c feature(ampcode): Enhances ampcode schema with new message types and fields
Adds support for system, user, assistant, and result message types to the AMP schema, along with associated fields like subtype, session_id, tools, and duration metrics. Updates the schema validation and adds corresponding test cases. Also improves the command-line argument handling in the agent management package to accommodate the new message types and streamlined permission flags.

The changes enhance the schema's flexibility for different interaction patterns and provide better tracking of agent operations.
2026-02-10 22:20:51 +09:00
Nathan Flurry
ee61645498 chore(release): update version to 0.1.11 2026-02-09 02:20:00 -08:00
NathanFlurry
4c8d93e077
docs: add mcp and skill session config (#106) 2026-02-09 10:13:25 +00:00
Bobby The Lobster
2cb2c07c6f Add cursor-agent support (#118)
- Add Cursor to AgentId enum
- Implement install_cursor() function for binary installation
- Add Cursor spawn logic with JSON format support
- Update README to mention Cursor support in all relevant sections

Cursor-agent runs on localhost:32123 and uses OpenCode-compatible format.
Based on opencode-cursor-auth pattern for Cursor Pro integration.

Resolves #118
2026-02-09 00:01:10 +00:00
Nathan Flurry
48749ef3bf fix: stop precreating opencode session and harden session lookup 2026-02-08 12:49:58 -08:00
Nathan Flurry
fc7abd13f0 fix: simplify opencode turn lifecycle handling 2026-02-08 11:59:43 -08:00
Nathan Flurry
3ba4c54c0c chore: commit remaining workspace updates 2026-02-08 11:51:47 -08:00
Nathan Flurry
98964f80ff refactor: use codex model list as source of truth 2026-02-08 11:48:47 -08:00
Nathan Flurry
a97b15e19a fix: stabilize codex model handling and initialization 2026-02-08 11:47:16 -08:00
Nathan Flurry
91cac052b8 fix: add native turn lifecycle and stabilize opencode session flow 2026-02-07 20:24:21 -08:00
Nathan Flurry
2b0507c3f5 feat: add session metadata (timestamps, directory, title) and use v1 SessionManager for OpenCode compat 2026-02-07 14:47:14 -08:00
Nathan Flurry
783e2d6692 feat(opencode): add SSE event replay with Last-Event-ID support 2026-02-07 12:58:20 -08:00
Nathan Flurry
52f5d07185 fix(ui): return helpful message at /ui when inspector frontend is not embedded 2026-02-07 12:43:55 -08:00
Nathan Flurry
37247587c4 fix(daemon): find and stop orphaned daemons on macOS when PID file is missing 2026-02-07 12:03:15 -08:00
Nathan Flurry
63625ee48f fix: wire gigacode --yolo through opencode session permissionMode 2026-02-07 03:08:07 -08:00
NathanFlurry
4bdd2416d1
fix(opencode-compat): preserve chronological part ordering across interleaved tool and text streams (#133) 2026-02-07 09:09:49 +00:00
NathanFlurry
479c8468e8
fix: delay idle event until turn finishes (#132) 2026-02-07 09:09:49 +00:00
NathanFlurry
54d537fb23
refactor: improve build ID generation with consistent timestamp format (#130)
refactor: improve build ID generation with consistent timestamp format

fix: lazy-start native opencode and simplify binary resolution
2026-02-07 07:56:07 +00:00
NathanFlurry
77f741ff62
feat: add native OpenCode proxy for TUI/config endpoints (#129) 2026-02-07 07:56:06 +00:00
NathanFlurry
c54f83e1a6
fix: credential detection and provider auth status (#120)
## Summary

Fix credential detection bugs and add credential availability status to the API. Consolidate Claude fallback models and add `sonnet` alias.

Builds on #109 (OAuth token support).

Related issues:
- Fixes #117 (Claude, Codex not showing up in gigacode)
- Related to #113 (Default agent should be Claude Code)

## Changes

### Credential detection fixes
- **`agent-credentials/src/lib.rs`**: Fix `?` operator bug in `extract_claude_credentials` - now continues to next config path if one is missing instead of returning early

### API credential status
- **`sandbox-agent/src/router.rs`**: Add `credentialsAvailable` field to `AgentInfo` struct
- **`/v1/agents`** endpoint now reports whether each agent has valid credentials

### OpenCode provider improvements
- **`sandbox-agent/src/opencode_compat.rs`**: Build `connected` array based on actual credential availability, not just model presence
- Check provider-specific credentials for OpenCode groups (e.g., `opencode:anthropic` only connected if Anthropic creds available)
- Add logging when credential extraction fails in model cache building

### Fallback model consolidation
- Renamed `claude_oauth_fallback_models()` → `claude_fallback_models()` (used for all fallback cases, not just OAuth)
- Added `sonnet` to fallback models (confirmed working via headless CLI test)
- Added `codex_fallback_models()` for Codex when credentials missing
- Added comment explaining aliases work for both API and OAuth users

### Documentation
- **`docs/credentials.mdx`**: New reference doc covering credential sources, extraction behavior, and error handling
- Documents that extraction failures are silent (not errors)
- Documents that agents spawn without credential pre-validation

### Inspector UI
- **`AgentsTab.tsx`**: Added credential status pill showing "Authenticated" or "No Credentials"

## Error Handling Philosophy

- **Extraction failures are silent**: Missing/malformed config files don't error, just continue to next source
- **Agents spawn without credential validation**: No pre-flight auth check; agent's native error surfaces if credentials are missing
- **Fallback models for UI**: When credentials missing, show alias-based models so users can still configure sessions

## Validation

- Tested Claude Code model aliases via headless CLI:
  - `claude --model default --print "say hi"` ✓
  - `claude --model sonnet --print "say hi"` ✓
  - `claude --model haiku --print "say hi"` ✓
- Build passes
- TypeScript types regenerated with `credentialsAvailable` field
2026-02-07 07:56:06 +00:00
NathanFlurry
915d484845
fix: end opencode turn on errors to avoid hangs (#126) 2026-02-07 06:52:28 +00:00
NathanFlurry
2f1e30f85a
fix: stop cargo build cache invalidation (#128) 2026-02-07 06:46:06 +00:00
NathanFlurry
bdf9b7cadd
fix: route Claude AskUserQuestion answers via permission control response (#127) 2026-02-07 06:43:45 +00:00
Franklin
8b068eb1ae Merge remote-tracking branch 'origin/main' into feat/support-pi 2026-02-06 23:22:50 -05:00
Franklin
e37bde0103 adding pi for gigacode 2026-02-06 23:20:50 -05:00
financialvice
a5a6492165
fix: support Claude OAuth token for model listing (#109) 2026-02-06 20:17:01 -08:00
Franklin
bd030904bc pi tests 2026-02-06 19:16:53 -05:00