Commit graph

21 commits

Author SHA1 Message Date
Bryan Helmkamp
d2c6b50c90 Add POST /models/{id}/test endpoint for server-mode model testing
Enables `arc models test` to work in server mode by adding an API
endpoint that sends "Say OK" (max_tokens=16, 30s timeout) to a model
and reports pass/fail. Dry-run mode returns synthetic "ok" status.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:17:10 -05:00
Bryan Helmkamp
116046502c Add GET /models endpoint returning paginated LLM catalog
Exposes the embedded model catalog (same data as `arc models list`) via
a new authenticated API endpoint so the web UI can display available models.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 10:12:21 -05:00
Bryan Helmkamp
72c1e0759f Rename verification API: categories → criteria, separate controls endpoints
Restructure the verification API from a flat `/verifications` namespace to
`/verification/criteria` and `/verification/controls` as distinct resources.
Singularize the run sub-resource path to `/runs/{id}/verification`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-07 09:49:18 -05:00
Bryan Helmkamp
566bef0220 Clean up API spec: remove redundant response types, add pagination, fix naming
- Delete StartRunResponse, CancelRunResponse, SteerRunResponse, SubmitAnswerResponse;
  reuse RunStatusResponse for startRun/cancelRun, empty 202 for steerRun, 204/409 for
  submitRunAnswer
- Make SubmitAnswerRequest.value and SteerRequest file/line optional
- Type untyped schemas (checkpoint, retro, context) with oneOf/additionalProperties
- Add pagination params to listRunQuestions, listRunStages, listRunVerifications
- Rename retrieveRunSvg→retrieveRunGraph, listRunCompare→retrieveRunDiff,
  RunListItemStatus→BoardColumn
- Preview URL response: 200→201
- Regenerate Rust types and TypeScript client

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 12:44:39 -05:00
Bryan Helmkamp
5eaa653d1f Move OpenAPI spec from openapi/ into docs/api-reference/
Mintlify requires all referenced files under docs/, so consolidate to a
single copy and eliminate the symlink and the copy step in the generate
script.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 08:35:28 -05:00
Bryan Helmkamp
b601df47e5 Per-request demo mode with UI toggle
Replace the server-level `--demo` flag with per-request demo dispatch.
The Rust API builds both a demo and real router; incoming requests with
the `X-Arc-Demo: 1` header hit the demo router (auth disabled, static
data), all others hit the real router with normal auth.

The React web app gets a beaker icon toggle in the top nav bar (next to
the theme toggle) that sets an `arc-demo` cookie. Loaders read the
cookie to decide whether to send the `X-Arc-Demo: 1` header to the API.
The `ARC_DEMO=1` env var still works as a default when no cookie is set.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 07:30:23 -05:00
Bryan Helmkamp
059a50e1b3 Rename handler types: agent_loop → agent, one_shot → prompt
Keep legacy aliases (agent_loop, one_shot) in the handler registry
and validation rules for backwards compatibility. Add codergen_mode
attribute support in the DOT parser, translating legacy values to
the new type names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 07:44:33 -05:00
Bryan Helmkamp
4bb072884c Rename handler types and split one_shot into its own handler
- Rename handler type strings: codergen → agent_loop, wait.human → human,
  script → command, wait.timer → wait
- Rename handler modules/structs to match: AgentHandler, HumanHandler,
  CommandHandler, WaitHandler
- Split one_shot into PromptHandler (handler/prompt.rs) with shape=tab mapping
- Remove CodergenMode enum and codergen_mode attribute — one_shot is now its
  own handler type, not a mode flag on the agent loop handler
- Update all demo DOT files: codergen_mode="one_shot" → shape=tab
- Update spec, README, validation rules, preamble, and hook tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 07:22:17 -05:00
Bryan Helmkamp
14322f40c2 Wrap non-paginated list endpoints in paginated response shape
Wrap 4 list endpoints that returned bare arrays in the standard
paginated `{ data, meta: { has_more } }` shape so adding real
pagination later is additive rather than a breaking change.

Endpoints: GET /runs/{id}/questions, /runs/{id}/stages,
/runs/{id}/verifications, and /verifications.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 00:41:32 -05:00
Bryan Helmkamp
af12b0b697 Add offset-based pagination to 9 list endpoints
Apply the same page[limit]/page[offset] pagination pattern from
GET /runs to: workflows, workflow runs, retros, sessions, projects,
branches, saved queries, query history, and stage turns.

Each endpoint now returns { data, meta: { has_more } } instead of
a bare array. Includes OpenAPI spec updates, demo handler changes,
regenerated TS client, updated frontend consumers, and a new
pagination conformance test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:56:32 -05:00
Bryan Helmkamp
b268efd85f Add global concurrency limiter with queued/starting run states
Runs now go through a state machine (queued → starting → running →
completed/failed/cancelled) instead of spawning immediately. A background
scheduler promotes queued runs when capacity is available, defaulting to
4 concurrent runs. Configurable via --max-concurrent-runs CLI flag or
max_concurrent_runs in server.toml.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 22:56:19 -05:00
Bryan Helmkamp
dc3867a3c4 Fix cargo fmt formatting across workspace
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 00:36:44 -05:00
Bryan Helmkamp
510d8b6df6 Add system dependency checks to arc doctor
Checks openssl, node, gh, and dot for presence, version, and command
success. Reports errors for missing/broken required tools and warnings
for optional ones. Also fixes pre-existing build break from
ApiAuthenticationStrategy -> ApiAuthStrategy rename.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 17:49:20 -05:00
Bryan Helmkamp
eb15b5254c Simplify mTLS implementation after code review
- Replace boolean params (mtls_enabled, mtls_optional) with ClientAuth enum
- Move serve_tls from serve.rs into tls module (encapsulate TLS internals)
- Derive client auth mode from AuthMode (eliminate duplicate strategy checks)
- Build JWT Validation once at startup, store in AuthStrategy (not per-request)
- Add tilde expansion for TLS cert paths (~/.arc/certs/...)
- Remove wasted String allocations from try_jwt/try_mtls return values
- Remove duplicate rustls dev-dependency from Cargo.toml
- Integration tests reuse tls::serve_tls instead of duplicating accept loop

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 17:43:14 -05:00
Bryan Helmkamp
e0b8da08f2 Add mTLS authentication to arc-api
Support mutual TLS as an authentication strategy alongside JWT.
The server accepts both auth methods on the same port — mTLS if a
client cert is presented, JWT via Bearer header otherwise.

Config changes:
- Replace `authentication_strategy` (singular) with
  `authentication_strategies` (list of "jwt" and/or "mtls")
- Add `[api.tls]` section for cert, key, and CA paths

New files: tls.rs (rustls ServerConfig builder)
Modified: server_config.rs, jwt_auth.rs, serve.rs, lib.rs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 17:36:22 -05:00
Bryan Helmkamp
49364b0843 Add demo API server and wire React app to fetch from API
Expand the OpenAPI spec from 11 to 39 endpoints covering Runs, Workflows,
Verifications, Retros, Sessions, Insights, Settings, and Projects with ~45
schemas. Add `--demo` flag to `arc serve` that serves static demo data for
all endpoints (auth disabled, read-only). Non-demo mode returns 501 for new
endpoints while existing run handlers continue working.

Regenerate the TypeScript API client and add `apiJson` helper. Wire all 19
React route files with server-side loaders that fetch from the API and map
snake_case responses to camelCase UI types. Mock data kept as fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 09:39:53 -05:00
Bryan Helmkamp
a566aa0352 Rename Pipeline to Run in arc-api server
- ManagedPipeline → ManagedRun, AppState.pipelines → AppState.runs
- All route paths: /pipelines/* → /runs/*
- Handler fns: list_pipelines → list_runs, start_pipeline → start_run,
  get_pipeline_status → get_run_status, cancel_pipeline → cancel_run
- Import renamed types: RunStatus, RunStatusResponse, StartRunRequest,
  StartRunResponse, WorkflowRunEngine, WorkflowRunEvent
- All test URIs, variable names, and test names updated

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 00:06:16 -05:00
Bryan Helmkamp
1334a952af Add spec-first OpenAPI for arc-api with generated types
- Create openapi/arc-api.yaml as source of truth for all API endpoints
- Add arc-types crate with build.rs using typify to generate Rust structs
  from the spec's component schemas
- Refactor server.rs to use generated types instead of hand-written ones
- Add route coverage conformance test validating router matches spec
- Add openapi-typescript to arc-web for TypeScript type generation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 21:43:49 -05:00
Bryan Helmkamp
c3d46c3885 Add SQLite persistence via sqlx with arc-db crate
Introduces durable storage so pipeline run data survives restarts.
The new arc-db crate provides SQLite connection helpers, a
PRAGMA user_version migration system, and a WorkflowRun model.
AppConfig (arc.toml) controls data_dir; the server initializes
the DB at startup and threads the pool through AppState.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 15:56:32 -05:00
Bryan Helmkamp
24cff30518 Fix clippy warnings, test failures, and apply cargo fmt
- Fix 4 test failures: add unconditional fallback edges to branching.dot
  and conditions.dot to satisfy all_conditional_edges validation rule
- Fix clippy await_holding_lock: scope MutexGuard before await in
  daytona_integration.rs
- Fix clippy unnecessary_get_then_check: use contains_key in script.rs
- Fix clippy expect_fun_call: use unwrap_or_else in integration.rs
- Run cargo fmt across entire workspace

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 13:02:16 -05:00
Bryan Helmkamp
99ad7ffe29 Extract server code into arc-api crate
Move HTTP server (Axum routes, JWT auth, serve CLI command, server
config) from arc-workflows into a dedicated arc-api crate. This
improves separation — arc-workflows is a pipeline engine library,
not a web server.

- Create crates/arc-api with server.rs, jwt_auth.rs, serve.rs,
  server_config.rs and their integration tests
- Remove server feature flag and optional deps from arc-workflows
- Update arc-cli to depend on arc-api for ServeArgs and serve_command

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:51:21 -05:00