From 4e04198a793be7650d0ccf545a89019e48ad8f16 Mon Sep 17 00:00:00 2001 From: shangzh0 <97216392+shangzh0@users.noreply.github.com> Date: Sun, 1 Nov 2026 01:12:45 +0800 Subject: [PATCH 1/3] feat(trajectory): expose captured LoopX tool context in research usage Signed-off-by: shangzh0 <97216392+shangzh0@users.noreply.github.com> --- .../goal-research-progress.tsx | 3 +- .../personal-workspace/goal-tool-context.tsx | 31 +++++ docs/reference/trajectory-assessment.md | 30 +++++ examples/personal-workspace-browser-smoke.mjs | 2 + .../research-history-backend.py | 3 + .../research-tool-context.mjs | 110 ++++++++++++++++ .../trajectory_assessment_store.py | 10 ++ .../trajectory_tool_context.py | 118 ++++++++++++++++++ loopx/cli_commands/benchmark_trajectory.py | 5 + .../trajectory_assessment_types.ts | 9 ++ .../capabilities/trajectory_codex_usage.ts | 3 + .../capabilities/trajectory_tool_context.ts | 72 +++++++++++ .../test_trajectory_input_capture.py | 24 +++- .../test_trajectory_tool_context.py | 71 +++++++++++ .../trajectory_codex_usage.test.ts | 7 ++ .../trajectory_tool_context.test.ts | 48 +++++++ 16 files changed, 544 insertions(+), 2 deletions(-) create mode 100644 apps/presentation/dashboard/src/features/personal-workspace/goal-tool-context.tsx create mode 100644 examples/personal-workspace-browser/research-tool-context.mjs create mode 100644 loopx/capabilities/benchmark_toolkit/trajectory_tool_context.py create mode 100644 loopx/control_plane/capabilities/trajectory_tool_context.ts create mode 100644 tests/capabilities/test_trajectory_tool_context.py create mode 100644 tests/control_plane_ts/trajectory_tool_context.test.ts diff --git a/apps/presentation/dashboard/src/features/personal-workspace/goal-research-progress.tsx b/apps/presentation/dashboard/src/features/personal-workspace/goal-research-progress.tsx index ddcfccdaf3..80e117af02 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/goal-research-progress.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/goal-research-progress.tsx @@ -5,6 +5,7 @@ import type {AssessmentCitation, AssessmentVerdict, TrajectoryAssessment, Trajec import type {TrajectoryNativeOutcomes} from "../../../../../../loopx/control_plane/capabilities/trajectory_native_outcomes.js"; import {ContextHelp} from "./context-help"; import {ResearchSynthesis} from "./goal-research-synthesis"; +import {ToolContextInventory} from "./goal-tool-context"; import "./goal-research-progress.css"; // Read models from benchmark-toolkit. This view formats existing counts and @@ -306,7 +307,7 @@ export function ResearchProgress({pack: p, packs, selectedId, zh, onSelect, onCi
{zh ? "其中输入" : "Of which input"} {incomplete.usage ? number(incomplete.usage.input_tokens) : "—"} · {zh ? "输出" : "output"} {incomplete.usage ? number(incomplete.usage.output_tokens) : "—"} tokens
: null} -{zh ? "分母是捕获中追加的用户、系统、开发者文本及工具返回;分子仅识别简单 LoopX CLI 调用的返回。复合脚本、间接调用、文件读取和其他内容保持未归因,图片等非文本内容不计字节。" : "The denominator is appended user, system, developer text and tool returns. Only returns from simple LoopX CLI calls are assigned. Compound scripts, indirect calls, file reads and other content remain unassigned; non-text content such as images has no byte count."}
+{zh ? "这是已记录内容的组成,不是逐请求重放的上下文或计费 token 占比。重复内容不等于无益重复,LoopX 返回也可能携带有用研究证据;不能据此推断净成本或提分。" : "This describes recorded content, not per-request replay or billable token share. Repeated content need not be waste; LoopX returns can carry useful research evidence. It does not establish net cost or score benefit."}
+{zh ? "捕获未通过核对 · 占比未知" : "Capture could not be reconciled · share unknown"}
: <> +{percent}{zh ? "占已记录输入文本" : "of recorded input text"}
+