Commit graph

32 commits

Author SHA1 Message Date
Bryan Helmkamp
4976358260 Replace fake relative time strings with ISO 8601 timestamps in API
The API was returning human-readable strings like "2h ago" and "in 4 hours"
instead of real timestamps. The frontend now formats these for display using
timeAgo() and a new timeUntil() helper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-06 13:35:36 -05:00
Bryan Helmkamp
736d4f8ba6 Restructure API schemas: nest flat fields into typed sub-objects
Add 17 new sub-schemas (ModelReference, WorkflowReference, RunReference,
RepositoryReference, CategoryReference, TokenUsage, CodeLocation, RunError,
RunPullRequest, RunTimings, SandboxResources, RunSandbox, RunQuestion,
AggregateUsageTotals, WorkflowSchedule, WorkflowLastRun, UsageStageRef)
and restructure 11 existing schemas to use them, improving evolvability
by grouping related fields into nested objects.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-06 13:11:17 -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
b2b25fbe6c Apply API design guidelines to all non-Session endpoints
Enrich the entire OpenAPI spec with descriptions, examples, format
annotations, extracted parameters, discriminated unions, and richer
response schemas — matching the patterns already established for
Sessions.

Structural changes:
- Extract CancelRunResponse and SteerRunResponse from inline schemas
- Change POST /runs/{id}/steer from 200 to 202 (async fire-and-forget)
- Split StageTurn into discriminated union (SystemStageTurn,
  AssistantStageTurn, ToolStageTurn) with oneOf + discriminator
- Add status + created_at to StartRunResponse
- Add created_at to RunListItem and RunStatusResponse
- Add created_at + updated_at to SavedQuery
- Add format: date-time on RetroListItem.timestamp
- Extract 7 new reusable parameters (StageId, QuestionId, WorkflowName,
  VerificationSlug, InsightQueryId, ProjectId, CheckpointFilter)
- Enrich existing RunId, PageLimit, PageOffset parameters
- Add descriptions + examples to all ~66 schemas and ~200+ properties
- Add operation descriptions to all ~35 endpoints

Rust handler updates:
- Change ManagedRun.created_at from Instant to chrono::DateTime<Utc>
- Populate new fields in StartRunResponse, RunStatusResponse
- Use new StageTurn discriminated union variants in demo data
- Update demo data timestamps to use DateTime<Utc>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 10:30:33 -05:00
Bryan Helmkamp
a9645132fc Add Last-Event-ID support to Sessions SSE endpoint
Each SSE frame now includes a sequential numeric id: field. Clients can
reconnect with the Last-Event-ID header to resume the stream after the
last received event, skipping already-processed events.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 10:00:07 -05:00
Bryan Helmkamp
c738d45c1c Use model slugs in Sessions API examples instead of display names
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 09:55:31 -05:00
Bryan Helmkamp
92dc29eb6f Sessions API review fixes: add updated_at to create response, UUID session IDs, remove misleading SSE schemas
- Add updated_at to CreateSessionResponse for consistency with SessionListItem/SessionDetail
- Add format: uuid to session ID fields and parameter across the OpenAPI spec
- Remove SessionEvent discriminated union and SessionEvent* wrapper schemas that conflated
  SSE transport-level event names with JSON data payload fields
- Update demo data to use proper UUIDs instead of string IDs
- Add uuid dependency to arc-types crate

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 09:51:50 -05:00
Bryan Helmkamp
a637a90ec6 Enrich Sessions API: timestamps on all turns, SSE event docs, richer responses
- Add created_at to AssistantTurn and ToolTurn schemas (matching UserTurn)
- Document SSE event types (assistant_turn, tool_turn, done, error) with
  SessionEvent discriminated union schema
- Add title and model to CreateSessionResponse
- Add model and last_message_preview to SessionListItem
- Update demo data with timestamps, model, and preview fields
- Regenerate TypeScript API client

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 09:32:49 -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
e569770c36 Enrich Sessions API: add ToolUse fields, timestamps, descriptions, and flatten list endpoint
- Add id, is_error, duration_ms to ToolUse; rename args to input
- Add created_at/updated_at timestamps to session schemas; replace time/date display strings
- Add descriptions and examples to all Sessions API fields and endpoints
- Flatten List Sessions response from grouped SessionGroup[] to SessionListItem[]
- Move date grouping (Today/Yesterday/etc.) to React client via groupSessionsByDate()
- Symlink docs/api-reference/arc-api.yaml to canonical openapi/arc-api.yaml
- Update React ToolRow components with duration display and error styling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 08:01:55 -05:00
Bryan Helmkamp
9fe17c9a7e Redesign session schemas: replace repo/time with timestamps
Replace `repo` and `time` with ISO 8601 `created_at`/`updated_at`
timestamps across session schemas. Remove `project`/`branch` from
CreateSessionRequest and add optional `model`. Add descriptions and
examples to all session-related OpenAPI schemas and endpoints.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 07:34:18 -05:00
Bryan Helmkamp
7696644d7e Add "Using the API" section to API Reference docs
Add three new pages under a "Using the API" group in the API Reference
tab: API Overview (base URL, authentication, errors, pagination,
versioning), Demo Mode, and Client SDKs. Nest "Run Internals" as an
expandable sub-group under "Run Outputs" in the nav.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 07:32:29 -05:00
Bryan Helmkamp
26f08a904e Rename GET /runs/{id}/files to GET /runs/{id}/compare
Rename the endpoint, schema (RunFiles -> RunCompare), operation ID,
handlers, and frontend route across the full stack.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 00:53:45 -05:00
Bryan Helmkamp
a40c6bdd29 Add QuestionType enum to OpenAPI spec replacing stringly-typed field
The question_type field on ApiQuestion was a bare string serialized via
Debug formatting. Define a proper enum in the spec so typify generates a
typed QuestionType, then map from the workflow enum in the handler.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 00:49:03 -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
1d0e45ffdf Add offset-based pagination to GET /runs
Introduce page[limit]/page[offset] query params and { data, meta: { hasMore } }
response wrapper for the /runs endpoint, establishing the pagination pattern
for all future list endpoints.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 22:32:57 -05:00
Bryan Helmkamp
43a0c18161 Add GET /usage endpoint for aggregate token/cost accounting across runs
Tracks total runs, input/output tokens, cost, and runtime in-memory
(resets on server restart). Accumulates from checkpoint node_outcomes
when runs complete. Includes per-model breakdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 21:56:50 -05:00
Bryan Helmkamp
3e68c41f4e Adopt uniform error response format across Arc API
All API errors now return a consistent JSON shape:
{"errors": [{"status": "4xx", "title": "...", "detail": "..."}]}

Introduces ApiError type with IntoResponse impl, replaces bare
StatusCode returns and ad-hoc {"error": "..."} responses in all
handlers and auth extractors. Updates OpenAPI spec and regenerates
TypeScript client.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 21:32:24 -05:00
Bryan Helmkamp
bb0fdfe972 Add /, /health, /openapi.json, /user endpoints to Arc API
Add discovery, health check, OpenAPI spec, and current user endpoints.
The first three are public; /user requires authentication and returns
the login extracted from JWT sub claim, mTLS CN, or "demo" in demo mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 21:10:59 -05:00
Bryan Helmkamp
169da74f0e Reorder API tags: HIL before Run Internals, Run Outputs before Retros, Projects before Settings
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 16:55:15 -05:00
Bryan Helmkamp
64dd9b925b Move Preview URL to Human-in-the-Loop, Retrieve Run Usage to Run Outputs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 16:52:38 -05:00
Bryan Helmkamp
8f684e6c48 Reorder OpenAPI tags for Mintlify nav sidebar
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 16:46:26 -05:00
Bryan Helmkamp
5164b73c58 Move List Run Files and Verifications to Run Outputs tag, rename Retrieve Run SVG to Render SVG
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 16:40:55 -05:00
Bryan Helmkamp
3d27d1fb72 Move preview URL endpoint to new Sandbox tag and shorten summary
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 16:40:12 -05:00
Bryan Helmkamp
4fdcd77dde Auto-copy OpenAPI spec to docs when generating API client
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 16:38:48 -05:00
Bryan Helmkamp
7df7a1e8de Replace docs OpenAPI spec copy with symlink to source of truth
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 16:36:08 -05:00
Bryan Helmkamp
4cd601833a Sync Mintlify docs OpenAPI spec with source of truth
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 16:33:44 -05:00
Bryan Helmkamp
1fa26aa1ec Rename API operationIds and summaries to follow consistent conventions
Use List/Retrieve/Start/Stream/Cancel naming. Add new tags: Run Internals,
Human-in-the-Loop, Usage. Regenerate TypeScript client.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 12:24:32 -05:00
Bryan Helmkamp
802727ac07 docs 2026-03-02 11:01:38 -05:00
Bryan Helmkamp
5c54f37a7c Add mintlify docs 2026-03-02 09:59:44 -05:00