Skip to content

feat(api): /executions list, get, tool-calls endpoints#11

Draft
aryasaatvik wants to merge 1 commit intofeat/app-drizzle-schemas-executionsfrom
feat/api-executions-list-endpoints
Draft

feat(api): /executions list, get, tool-calls endpoints#11
aryasaatvik wants to merge 1 commit intofeat/app-drizzle-schemas-executionsfrom
feat/api-executions-list-endpoints

Conversation

@aryasaatvik
Copy link
Copy Markdown
Owner

Stacked review copy of upstream RhysSullivan#401 · stacked on RhysSullivan#400.

Prev: feat/app-drizzle-schemas-executions
Next: feat/react-runs-page


See upstream PR #401 for full description.

Extends the existing `/executions` group with the three read
endpoints the runs UI needs. Handlers delegate to
`executor.executions.*` (added in RhysSullivan#396 / RhysSullivan#398) and scope each read
to the innermost executor scope — same rule the engine applies
when writing.

**Endpoints:**
- `GET /executions` — list with filter + cursor + optional meta.
  Query params: `limit`, `cursor`, `status` (CSV), `trigger` (CSV),
  `tool` (CSV of paths/globs), `from`/`to` (epoch ms), `after`,
  `code` (substring), `sort` (`<field>,<dir>`), `elicitation`
  (`"true"` / `"false"`). Meta bundles facets + timeline buckets;
  handler only asks for it when the request isn't paginated
  (no `cursor` / `after`), so cheap "first page, full facets" is
  the default call shape.
- `GET /executions/:id` — single execution detail +
  `pendingInteraction`. 404 on unknown id via
  `ExecutionNotFoundError` (already declared on the group).
- `GET /executions/:id/tool-calls` — tool-call timeline. 404 on
  unknown execution (guard rail so empty arrays don't mask typos).

**Response shape:** every `Date` is serialized to epoch ms at the
handler edge (`.getTime()`) so the wire format stays numeric. The
schemas in `api.ts` mirror the SDK's row projections one-to-one
modulo that transform.

**CSV + enum handling:** `splitCsv`, `parseSortParam`,
`parseElicitationParam` live in the handler file because they're
edge concerns — the SDK takes typed arrays and enums. Invalid sort
fields / directions drop back to defaults (no 400).

No new tests — the handlers are thin wrappers over the SDK store,
which already has round-trip + filter + meta coverage in
`packages/core/sdk/src/executions.test.ts`. The CSV/enum parsers
are small enough to validate by inspection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant