From e987f46e1d224ee9a42a82b3cfa728915e44d378 Mon Sep 17 00:00:00 2001 From: MortalSnow <3352221860@qq.com> Date: Thu, 11 Jun 2026 13:02:04 +0800 Subject: [PATCH 1/7] docs: design trust workbench session --- ...26-06-11-trust-workbench-session-design.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 docs/superpowers/specs/2026-06-11-trust-workbench-session-design.md diff --git a/docs/superpowers/specs/2026-06-11-trust-workbench-session-design.md b/docs/superpowers/specs/2026-06-11-trust-workbench-session-design.md new file mode 100644 index 0000000..8c3b372 --- /dev/null +++ b/docs/superpowers/specs/2026-06-11-trust-workbench-session-design.md @@ -0,0 +1,108 @@ +# Trust Workbench 2.1 Session Design + +## Goal + +Trust Workbench 2.1 keeps the current Trust Center feature set intact while making the same review work feel more guided, lower pressure, and easier to finish. The user still reviews AI-inferred save reasons, inspects evidence, updates open loops, and checks diagnostics. The change is in the interaction model: the screen should help the user decide what to review first, why that item matters, what action is safest, and what changed after the decision. + +This is deliberately not a new top-level module. It is a deeper version of the existing trust module. + +## User Problem + +The current trust workbench reduced visual density, but a user can still feel uncertain about three things: + +- where to start when many items are waiting +- what confidence, risk, evidence, open loops, and review status mean in practical terms +- whether a confirmation, rewrite, rejection, or deferral is the right decision + +The design should preserve information depth while staging it across a review session. + +## Recommended Approach + +Use a "review session" layer inside the existing Trust Center: + +1. A compact session planner at the top lets the user choose a review mode, see the queue scope, and understand the next best action. +2. Review cards expose richer but compact decision signals: trust boundary, risk reason, evidence count, open-loop pressure, and recommended action. +3. The detail panel becomes a decision cockpit: brief, evidence, risk explanation, rewrite guidance, decision note, and action preview. +4. A small progress/summary area shows what has been selected or acted on in the current session. +5. Diagnostics and open loops remain secondary and progressively disclosed. + +This creates substantial code because the current components need richer typed view models, helper utilities, UI sections, tests, and styles, but it stays inside the existing module. + +## Non-Goals + +- Do not add a new top-level route or sidebar item. +- Do not add a new database table for sessions. +- Do not change the semantics of existing review actions. +- Do not require a real LLM or external API. +- Do not upload or store API keys. + +## Frontend Design + +Add new Trust Center subcomponents: + +- `TrustSessionPlanner.vue`: chooses review mode and explains the current session goal. +- `TrustReviewProgress.vue`: summarizes selected count, high-priority remaining count, and suggested next step. +- `TrustDecisionCoach.vue`: explains each action and validates rewrite/note intent before submit. +- `TrustRiskLens.vue`: shows why a selected item is risky without forcing users to open all raw evidence. +- `TrustReviewSignals.vue`: reusable compact signal strip for cards and detail panels. + +Existing components stay in place and become orchestrators: + +- `TrustCenterView.vue` owns session mode and passes derived context down. +- `TrustReviewInbox.vue` renders richer cards and emits the same selection/review events. +- `TrustReviewDetail.vue` uses coach/lens components while still emitting the existing `batchAction` payload. +- `TrustBatchActionBar.vue`, `TrustOpenLoopPanel.vue`, and `TrustDiagnosticsPanel.vue` gain clearer microcopy and summary helpers. + +## Backend Design + +Keep existing endpoints and payloads. Add derived fields to review items where useful: + +- `risk_reasons`: human-readable reasons for risk level +- `decision_options`: action labels, descriptions, and whether a rewrite is required +- `review_focus`: the recommended next thing the user should inspect +- `trust_signals`: normalized counts and booleans for frontend display + +These fields are computed from existing source, cognitive context, graph, lifecycle, and review data. They do not change stored data. + +## Data Flow + +The frontend continues to load: + +- `/api/trust/review` +- `/api/trust/review/{source_id}` +- `/api/trust/open-loops` +- `/api/trust/diagnostics` + +The Trust Center builds a local session state: + +- selected mode: high risk, quick clear, open loops, or all +- selected source ids +- current focused source +- local draft notes and rewrites + +Submitting still calls `/api/trust/review/batch` or `/api/trust/open-loops/{loop_id}`. + +## Error Handling + +- If no review item exists, the session planner shows an empty-state next step. +- If rewrite is selected without text, the decision coach blocks submit locally and the backend still enforces the existing validation. +- If diagnostics are missing, the UI uses neutral fallback text. +- If a selected item disappears after refresh, the existing detail reset behavior remains. + +## Testing + +Add or expand tests for: + +- review payload exposes derived decision and signal fields +- risk reasons are deterministic and match existing data +- rewrite action remains blocked without replacement text +- Trust Center renders session planner, progress, decision coach, risk lens, and signal strip +- compact mode still uses progressive disclosure and mobile-safe layout + +## Success Criteria + +- The Trust module has more code because the review workflow is better decomposed and tested, not because logic is duplicated. +- The user can review the same items with fewer context switches. +- Information remains available but is staged by priority. +- All existing trust API tests continue to pass. +- Frontend build and lint/test commands remain green. From a07a379805e23af329e3d1e58dcec23d61864bca Mon Sep 17 00:00:00 2001 From: MortalSnow <3352221860@qq.com> Date: Thu, 11 Jun 2026 13:04:30 +0800 Subject: [PATCH 2/7] docs: plan trust workbench session --- ...2026-06-11-trust-workbench-session-plan.md | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 docs/superpowers/plans/2026-06-11-trust-workbench-session-plan.md diff --git a/docs/superpowers/plans/2026-06-11-trust-workbench-session-plan.md b/docs/superpowers/plans/2026-06-11-trust-workbench-session-plan.md new file mode 100644 index 0000000..40ed43d --- /dev/null +++ b/docs/superpowers/plans/2026-06-11-trust-workbench-session-plan.md @@ -0,0 +1,208 @@ +# Trust Workbench Session Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use subagent-driven-development (recommended) or executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Turn the existing Trust Center into a guided review workbench without adding a new top-level module or changing the semantics of existing review actions. + +**Architecture:** Keep the current `/api/trust/*` endpoints and enrich their existing payloads with deterministic derived fields. Split the Vue Trust Center into small subcomponents for session planning, progress, signals, risk explanation, and decision coaching. + +**Tech Stack:** Python/FastAPI/SQLite backend helpers, Vue 3 ` diff --git a/frontend/src/components/TrustSessionPlanner.vue b/frontend/src/components/TrustSessionPlanner.vue new file mode 100644 index 0000000..8b58101 --- /dev/null +++ b/frontend/src/components/TrustSessionPlanner.vue @@ -0,0 +1,91 @@ + + + diff --git a/frontend/src/styles.css b/frontend/src/styles.css index 032c0fa..6028c4a 100644 --- a/frontend/src/styles.css +++ b/frontend/src/styles.css @@ -7109,6 +7109,103 @@ button:not(:disabled):hover { min-width: 0; } +.trust-session-planner { + display: grid; + grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 1.4fr) minmax(220px, 0.8fr); + gap: 10px; + align-items: stretch; + border: 1px solid rgba(44, 53, 68, 0.12); + border-radius: 8px; + background: rgba(255, 255, 255, 0.74); + padding: 10px; +} + +.trust-session-copy, +.trust-session-next-step { + display: grid; + align-content: center; + gap: 5px; + min-width: 0; +} + +.trust-session-copy h2, +.trust-session-next-step strong { + margin: 0; + font-family: var(--snap-title); + font-size: 1.03rem; + font-weight: 560; + letter-spacing: 0; +} + +.trust-session-copy p, +.trust-session-next-step p, +.trust-review-progress p { + margin: 0; + color: var(--muted-foreground); + line-height: 1.45; +} + +.trust-session-modes { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + gap: 7px; + min-width: 0; +} + +.trust-session-modes button { + border: 1px solid rgba(44, 53, 68, 0.12); + border-radius: 8px; + background: color-mix(in srgb, var(--paper) 88%, white); + color: var(--foreground); + padding: 9px; + display: grid; + gap: 3px; + text-align: left; + cursor: pointer; + min-width: 0; +} + +.trust-session-modes button.active { + border-color: rgba(53, 99, 91, 0.44); + background: color-mix(in srgb, var(--secondary) 78%, white); + box-shadow: inset 0 0 0 1px rgba(53, 99, 91, 0.14); +} + +.trust-session-modes strong { + font-size: 0.88rem; + line-height: 1.2; +} + +.trust-session-modes span, +.trust-review-progress span, +.trust-session-next-step span { + color: var(--muted-foreground); + font-size: 0.74rem; + text-transform: uppercase; + letter-spacing: 0.04em; +} + +.trust-review-progress { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 10px; +} + +.trust-review-progress > div { + border: 1px solid rgba(44, 53, 68, 0.1); + border-radius: 8px; + background: color-mix(in srgb, var(--paper) 86%, white); + padding: 10px; + display: grid; + gap: 4px; + min-width: 0; +} + +.trust-review-progress strong { + font-size: 1.1rem; + line-height: 1.2; +} + .trust-summary-grid article { min-height: 96px; border: 1px solid var(--line); diff --git a/tests/trust_operations_ui.test.ts b/tests/trust_operations_ui.test.ts index c617ae5..677ea6f 100644 --- a/tests/trust_operations_ui.test.ts +++ b/tests/trust_operations_ui.test.ts @@ -114,3 +114,25 @@ test('Trust Center defines session types and shared decision copy helpers', () = assert.match(copy, /sessionModeDescription/) assert.match(copy, /confidenceLabel/) }) + +test('Trust Center adds a guided review session planner and progress strip', () => { + const view = read('frontend/src/components/TrustCenterView.vue') + const planner = read('frontend/src/components/TrustSessionPlanner.vue') + const progress = read('frontend/src/components/TrustReviewProgress.vue') + const styles = read('frontend/src/styles.css') + + assert.match(view, /TrustSessionPlanner/) + assert.match(view, /TrustReviewProgress/) + assert.match(view, /TrustReviewSessionMode/) + assert.match(view, /selectedSessionMode/) + assert.match(view, /sessionItems/) + assert.match(planner, /trust-session-planner/) + assert.match(planner, /sessionModeLabel/) + assert.match(planner, /sessionModeDescription/) + assert.match(progress, /trust-review-progress/) + assert.match(progress, /selectedCount/) + assert.match(progress, /nextStep/) + assert.match(styles, /\.trust-session-planner/) + assert.match(styles, /\.trust-review-progress/) + assert.match(styles, /\.trust-session-modes/) +}) From b23b6d82ba045697d8f92161449794587014ec12 Mon Sep 17 00:00:00 2001 From: MortalSnow <3352221860@qq.com> Date: Thu, 11 Jun 2026 13:27:46 +0800 Subject: [PATCH 6/7] feat: add trust decision coaching UI --- .../src/components/TrustDecisionCoach.vue | 117 +++++++++++ frontend/src/components/TrustReviewDetail.vue | 63 ++---- frontend/src/components/TrustReviewInbox.vue | 2 + .../src/components/TrustReviewSignals.vue | 26 +++ frontend/src/components/TrustRiskLens.vue | 49 +++++ frontend/src/styles.css | 183 ++++++++++++++++++ tests/trust_operations_ui.test.ts | 24 +++ 7 files changed, 415 insertions(+), 49 deletions(-) create mode 100644 frontend/src/components/TrustDecisionCoach.vue create mode 100644 frontend/src/components/TrustReviewSignals.vue create mode 100644 frontend/src/components/TrustRiskLens.vue diff --git a/frontend/src/components/TrustDecisionCoach.vue b/frontend/src/components/TrustDecisionCoach.vue new file mode 100644 index 0000000..abdf62a --- /dev/null +++ b/frontend/src/components/TrustDecisionCoach.vue @@ -0,0 +1,117 @@ +