paperclip/ui/src/api
Dotta 051ae4d102
feat: restore decision training library and inspector (#9779)
## Thinking Path

> - Paperclip is the open source control plane people use to manage
AI-agent companies and supervise governed work.
> - Decisions capture high-value operator judgment, and the
decision-training foundation merged in #9702 freezes that evidence for
later evaluation and learning.
> - Operators still need the UI from the closed stacked PR #9718 to
intentionally capture examples and inspect the resulting dataset.
> - GitHub automatically closed #9718 when its stacked base branch was
deleted after #9702 merged, leaving the server foundation on `master`
without the corresponding UI.
> - This pull request restores the final UI and its still-required
supporting API fields directly on current `master`, while excluding the
obsolete migration and duplicated server-foundation diffs.
> - The benefit is a reviewable replacement PR that preserves the
completed decision-training workflow without replaying stale stack
history.

## Linked Issues or Issue Description

- Refs #9718
- Refs #9702

## What Changed

- Restored the top-level `/training` library and record inspector with
search, filters, JSONL export, notes editing, and evidence tabs.
- Restored the Decisions-row training affordance and capture drawer,
including preview, provenance, deletion, cache refresh, and approval
consistency behavior.
- Restored the shared types and focused server support needed by the UI
without reintroducing decision-training migrations or the already-merged
server foundation.
- Restored focused UI and attention-service tests from the final #9718
state.
- Credit to the authors and reviewers of #9718; this recovery
transplants their final reviewed delta after the stacked base deletion.

## Verification

- `pnpm exec vitest run ui/src/pages/Training.test.tsx
ui/src/components/DecisionTrainingDrawer.test.tsx
ui/src/components/AttentionQueueRow.test.tsx
server/src/__tests__/attention-service.test.ts
server/src/__tests__/decision-training.test.ts` — 5 files, 48 tests
passed.
- `pnpm --filter @paperclipai/shared typecheck` — passed.
- `pnpm --filter @paperclipai/server typecheck` — passed.
- `pnpm --filter @paperclipai/ui typecheck` — passed.
- `pnpm exec vitest run server/src/__tests__/openapi-routes.test.ts` — 3
tests passed; confirms exact route/OpenAPI parity for the restored
preview endpoint.
- `pnpm check:token-gates` — the restored files are clean; the
repository-wide command currently reports five pre-existing false
positives where comments reference GitHub issue `#9627` as if it were a
color literal.

## Risks

- Low migration risk: this PR contains no database migrations and is
based directly on current `master`.
- The main behavioral risk is cache invalidation across Decisions and
Training views; focused tests cover capture, update, deletion, row
state, and approval refresh behavior.
- The token-gate baseline remains red on unrelated `#9627` comment
references; this PR does not modify those files.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

- OpenAI Codex, GPT-5.3-Codex, reasoning with repository/tool access and
code execution. Context window not exposed by the runtime.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-07-17 13:27:32 -05:00
..
access.ts [codex] Add private browser first-admin claim flow (#6755) 2026-05-27 21:15:01 -10:00
activity.ts Fix request storm polling and issue-list coalescing (#9190) 2026-07-09 17:38:34 -05:00
adapters.ts Make ACP the default engine for local adapters (#9238) 2026-07-08 19:05:03 -07:00
agents.ts [codex] Add built-in Hermes adapters (#8543) 2026-06-26 16:04:58 -05:00
approvals.ts refactor: rename packages to @paperclipai and CLI binary to paperclipai 2026-03-03 08:45:26 -06:00
artifacts.test.ts PAP-10440: group artifacts by task stacks (#7654) 2026-06-06 10:22:47 -05:00
artifacts.ts PAP-10440: group artifacts by task stacks (#7654) 2026-06-06 10:22:47 -05:00
assets.ts Address Greptile company logo feedback 2026-03-16 10:05:14 -05:00
attention.ts feat: add attention queue and Decisions surface (#9380) 2026-07-10 17:09:57 -05:00
auth.ts feat(mcp) [split 6/8]: add Tools and Profiles UI foundation (#9561) 2026-07-14 15:31:12 -05:00
budgets.ts feat(costs): add billing, quota, and budget control plane 2026-03-16 15:11:01 -05:00
builtInAgents.ts feat: add built-in summarizer and summary slots (#9713) 2026-07-17 11:03:07 -05:00
cases.ts Cases: experimental first-class case object (#9198) 2026-07-09 22:11:03 -05:00
client.test.ts Fix request storm polling and issue-list coalescing (#9190) 2026-07-09 17:38:34 -05:00
client.ts feat(mcp) [split 6/8]: add Tools and Profiles UI foundation (#9561) 2026-07-14 15:31:12 -05:00
cloudUpstreams.ts [codex] Add local Cloud Upstream sync (#6548) 2026-05-22 09:56:22 -05:00
companies-query.test.ts feat(mcp) [split 6/8]: add Tools and Profiles UI foundation (#9561) 2026-07-14 15:31:12 -05:00
companies-query.ts feat(mcp) [split 6/8]: add Tools and Profiles UI foundation (#9561) 2026-07-14 15:31:12 -05:00
companies.ts Polish board settings and skills workflow (#4863) 2026-04-30 15:28:11 -05:00
companySkills.ts Skill Studio: three-pane skill IDE with sandboxed test runs (#9241) 2026-07-09 13:08:56 -05:00
costs.ts feat(costs): add billing, quota, and budget control plane 2026-03-16 15:11:01 -05:00
dashboard.ts refactor: rename packages to @paperclipai and CLI binary to paperclipai 2026-03-03 08:45:26 -06:00
decisionTraining.ts feat: restore decision training library and inspector (#9779) 2026-07-17 13:27:32 -05:00
document-annotations.ts Cases: experimental first-class case object (#9198) 2026-07-09 22:11:03 -05:00
environments.ts fix(sandbox): keep custom-image snapshots applied to config tests, probes, and saves (#9385) 2026-07-10 14:32:47 -07:00
execution-workspaces.test.ts feat(recovery-card): W7 reconcile-forward + break-glass actions 2026-07-07 15:17:16 -07:00
execution-workspaces.ts fix: repair dirty/foreign-branch execution worktrees (#9297) 2026-07-09 18:19:49 -05:00
externalObjects.ts External object references across issue surfaces (#8512) 2026-06-23 08:27:19 -05:00
file-resources.ts Add workspace file downloads 2026-06-26 06:05:57 -05:00
folders.ts feat: organize skills with nested folders and My Skills (#9633) 2026-07-16 15:50:45 -05:00
goals.ts refactor: rename packages to @paperclipai and CLI binary to paperclipai 2026-03-03 08:45:26 -06:00
health.ts Add experimental server info debug view (#8676) 2026-06-26 14:47:01 -07:00
heartbeats.test.ts fix: upstream deployed document-comment, routine-annotation, workspace & board-polling fixes (#8536) 2026-06-23 09:00:14 -05:00
heartbeats.ts Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
inbox-agent-policy.ts feat(inbox): let agents safely tidy user inboxes (#9724) 2026-07-16 16:49:18 -05:00
inboxDismissals.ts feat: add attention queue and Decisions surface (#9380) 2026-07-10 17:09:57 -05:00
index.ts External object references across issue surfaces (#8512) 2026-06-23 08:27:19 -05:00
instanceSettings.ts Add dependency wake reconciliation backstop (#8943) 2026-07-03 18:30:51 -07:00
issues.test.ts Fix request storm polling and issue-list coalescing (#9190) 2026-07-09 17:38:34 -05:00
issues.ts feat: add attention queue and Decisions surface (#9380) 2026-07-10 17:09:57 -05:00
pipelines.ts Add pipeline workflow primitives and operator UI (#7903) 2026-06-26 12:02:44 -05:00
plugins.test.ts Expand plugin host surface (#5205) 2026-05-05 07:42:57 -05:00
plugins.ts feat(mcp) [split 6/8]: add Tools and Profiles UI foundation (#9561) 2026-07-14 15:31:12 -05:00
projects.ts [codex] Improve workspace runtime and navigation ergonomics (#3680) 2026-04-14 12:57:11 -05:00
resourceMemberships.ts [codex] Add resource membership controls (#6677) 2026-05-25 13:12:41 -05:00
routines.ts Add routine revision history and restore flow (#5285) 2026-05-05 11:54:52 -05:00
search.ts feat(search): filters, sorting, operators & command-palette parity (#9327) 2026-07-09 19:32:58 -05:00
secrets.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
sidebarBadges.ts refactor: rename packages to @paperclipai and CLI binary to paperclipai 2026-03-03 08:45:26 -06:00
sidebarPreferences.ts [codex] Improve workspace runtime and navigation ergonomics (#3680) 2026-04-14 12:57:11 -05:00
smokeLab.ts feat(mcp) [split 6/8]: add Tools and Profiles UI foundation (#9561) 2026-07-14 15:31:12 -05:00
summarySlots.ts feat: add built-in summarizer and summary slots (#9713) 2026-07-17 11:03:07 -05:00
teamCatalog.ts [codex] Add teams catalog extraction (#7550) 2026-06-05 12:55:49 -05:00
tools.ts feat(mcp) [split 6/8]: add Tools and Profiles UI foundation (#9561) 2026-07-14 15:31:12 -05:00
userProfiles.ts [codex] Add access cleanup and user profile page (#4088) 2026-04-20 06:10:20 -05:00
workTimeline.ts [codex] Add work timeline page (#8938) 2026-07-06 07:57:23 -05:00
workspace-runtime-control.test.ts [codex] Improve workspace runtime and navigation ergonomics (#3680) 2026-04-14 12:57:11 -05:00
workspace-runtime-control.ts [codex] Improve workspace runtime and navigation ergonomics (#3680) 2026-04-14 12:57:11 -05:00