mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-16 05:17:41 +02:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The native runner must support project work, delegation, hiring, and service access. > - Browser tests exposed lost connection access, rejected helper events, and stalled recovery. > - Some eval failures also came from incorrect fixtures and decision controls. > - This pull request fixes those paths and adds eight everyday workflow stories. > - The tests retain observed failures and verify delivered files independently. > - The benefit is repeatable evidence for common user tasks and their remaining gaps. ## Linked Issues or Issue Description Related work: #13404 contains earlier workflow fixes. #13300 and #13470 changed the CI contracts used by the harness security tests. Merged companion: [paperclip-evals#22](https://github.com/paperclipai/paperclip-evals/pull/22). **What happened?** Native ACPX sessions did not receive the assigned connection gateway. Codex helper events could arrive before their spawn receipt and fail thread validation. A parent continuation could take a shared workspace before its child retried. A failed native continuation could leave the task status without a clear recovery blocker. The eval harness also confused tool approvals with new connection requests and could reject a valid delegated download. **Expected behavior** Keep assigned gateway access and its approval checks. Verify helper lineage before accepting helper progress. Let a waiting child proceed before automatic parent recovery. Preserve a failed task's recovery ownership. Grade the actual requested workflow and its delivered files. **Steps to reproduce** Run the everyday workflow suite with the native Codex and Claude profiles. Exercise service approval, connection refusal, delegated project work, and teammate reuse. The commands and case requirements are in `tests/runner-e2e/EVERYDAY-WORKFLOWS.md`. Use `pnpm test:runner-recovery` for controlled crash and replacement cases. ## What Changed - Pass the scoped connection gateway binding through the native ACPX host and sidecar. - Recognize Codex helper lineage from parent metadata and spawn receipts. Verify early helper events with `thread/read`. Keep helper events separate from root completion authority. - Guide agents to use persistent hiring, child tasks, dependency records, and a blocked handoff while waiting for a child. - Defer automatic parent recovery while a child has an active execution path in the same shared workspace. Allow parent recovery when the child needs review. - Record Blocked status and recovery evidence when a failed native continuation needs reconciliation, including existing active or escalated incidents. Preserve their owner and retry budget. - Add eight browser-driven workflow cases. Use real decision controls, explicit child feedback delivery, managed hiring credentials, and independent ZIP checks inside a bounded Docker sandbox. Verify sandbox availability before task creation. Record screenshot SHA-256 at capture. - Keep runner crash probes in controlled recovery tests. Preserve the original failure when cleanup also fails. - Display missing accounting and replay revisions as unavailable. Align harness security assertions with the approved CI changes. - Make the channel-rejection browser fixture bind its file after the send captures its payload. This prevents live refresh from removing the file before the simulated race. ## Verification - Full workspace `pnpm -r typecheck` passed after merging current master. - Runner E2E typecheck passed. Harness unit tests passed: 216/216. - Wake-queue database tests passed: 55/55. The two added existing-incident tests failed before the fix and pass after it. - Docker artifact calibration passed: 12/12. Host-file and host-loopback isolation tests failed before the fix and pass after it. Read-only delivery and output limits are also verified. - Full `pnpm build` passed. Targeted recovery tests passed: 83/83. - The channel-rejection browser test passed five consecutive runs after fixing the fixture race found in CI. - Local general-server (12,351 tests), UI (6,250), CLI (485), and workspace package groups passed. The monolithic run stopped at an unchanged lock-heartbeat fixture race; the isolated workspace group passed on rerun (shared: 747/747). A separate local serialized run passed 97 files before two socket errors in the unchanged issue-list route suite; that suite passed 15/15 on isolated rerun. These local full commands did not finish uninterrupted; the complete CI matrix below covers the remaining suites. - Final head `0fb293733fe307be7e6667ae8f1364077d0c6455`: **34 successful checks, 2 expected skips**, including every server/workspace shard, browser shard, native runner verification, build, and typecheck. [Final CI run](https://github.com/paperclipai/paperclip/actions/runs/34989136700). - Greptile reviewed this exact head at **5/5**; all review threads are resolved. Both Superagent security checks are successful. - ACPX credential-boundary tests passed: 118/118. Superagent accepted the runner/sidecar versus provider-environment trace and cleared its finding. - The latest paid local campaign on source `f6a2fdf7ac2af859826a2ae627ff4125a5478529` passed 22/24 cases: Sol 8/8, Claude 7/8, Mini 7/8. These results predate the merge with current master. - The two remaining failures are in `hire-reuse`: Claude exceeded the attempt deadline during final review; Mini made invalid deliverable tool calls and remained Blocked. - Six Daytona cases were not run because the matching immutable runner image was unavailable. This PR does not claim new remote model results. ## Risks The changes affect connection admission, helper identity, and recovery scheduling. Assigned gateway grants and user approval still govern service calls. The workspace admission gate still exists; the broader folder-sync design is separate work. Provider behavior can still cause the two recorded hiring failures. No database migration is required. Paid cases are opt-in and have bounded attempt deadlines. Project stories now require Docker and the documented pinned Python image on the harness host. ## Model Used OpenAI `gpt-6-astra` performed implementation, diagnosis, and substantive review. OpenAI `gpt-5.6-luna` assisted with verification, PR preparation, and review tracking. Both used repository tools and code execution. Context-window sizes were not recorded. ## 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 (focused checks and isolated reruns; full-run limitations are documented above) - [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: OpenAI GPT-5.6 Luna <noreply@openai.com> Co-authored-by: Paperclip <noreply@paperclip.ing>
678 lines
21 KiB
TypeScript
678 lines
21 KiB
TypeScript
import { useEffect, useMemo, useState } from "react";
|
|
|
|
import type { CapabilityDevtoolsSnapshot } from "../../../src/devtools";
|
|
import { Icon, type IconName } from "./Icons";
|
|
import { EvalAssertions, type EvalAssertion } from "./ThreadItems";
|
|
|
|
export type CapabilityDevtoolsTab =
|
|
| "eval"
|
|
| "evidence"
|
|
| "timeline"
|
|
| "state"
|
|
| "diff"
|
|
| "documents"
|
|
| "protocol"
|
|
| "trace"
|
|
| "runtime"
|
|
| "authority";
|
|
type Json = null | boolean | number | string | Json[] | { [key: string]: Json };
|
|
|
|
export interface EvalInspectorReport {
|
|
attemptId: string;
|
|
caseId: string;
|
|
disposition: string;
|
|
passed: boolean;
|
|
checks: EvalAssertion[];
|
|
publication?: { schema: string; notice: string };
|
|
run: {
|
|
model: string;
|
|
provider: string;
|
|
driver: string;
|
|
providerVersion: string | null;
|
|
runnerProvider: string;
|
|
configuration: string;
|
|
sessionId: string;
|
|
providerSessionId: string | null;
|
|
agentVersion: string | null;
|
|
retainedSession: boolean | null;
|
|
retainedSessionStatus: string | null;
|
|
fixtureDigest: string;
|
|
runnerPackageDigest: string;
|
|
runnerdDigest: string;
|
|
runnerBuild: string;
|
|
startedAt: string;
|
|
finishedAt: string;
|
|
durationMs: number | null;
|
|
initialRevision: number | null;
|
|
finalRevision: number | null;
|
|
usage: {
|
|
agentTurns: number;
|
|
providerRequests: number | null;
|
|
inputTokens?: number;
|
|
outputTokens?: number;
|
|
cachedInputTokens?: number;
|
|
reasoningTokens?: number;
|
|
providerReportedCostNanodollars?: number;
|
|
estimatedCostNanodollars?: number;
|
|
pricingVersion?: string;
|
|
} | null;
|
|
};
|
|
}
|
|
|
|
function JsonTree({ value, name = "root" }: { value: Json; name?: string }) {
|
|
if (value === null || typeof value !== "object") {
|
|
return <span className="pit-json-value">{JSON.stringify(value)}</span>;
|
|
}
|
|
const entries = Array.isArray(value)
|
|
? value.map((entry, index) => [String(index), entry] as const)
|
|
: Object.entries(value);
|
|
return (
|
|
<details className="pit-json-node" open={name === "root"}>
|
|
<summary>
|
|
{name}{" "}
|
|
<span className="pit-muted">
|
|
{Array.isArray(value) ? `[${entries.length}]` : `{${entries.length}}`}
|
|
</span>
|
|
</summary>
|
|
<div className="pit-json-children">
|
|
{entries.map(([key, entry]) => (
|
|
<div className="pit-json-row" key={key}>
|
|
<span className="pit-json-key">{key}</span>
|
|
{entry !== null && typeof entry === "object" ? (
|
|
<JsonTree value={entry as Json} name={key} />
|
|
) : (
|
|
<JsonTree value={entry as Json} />
|
|
)}
|
|
</div>
|
|
))}
|
|
</div>
|
|
</details>
|
|
);
|
|
}
|
|
|
|
interface DiffRow {
|
|
path: string;
|
|
before: Json | undefined;
|
|
after: Json | undefined;
|
|
}
|
|
|
|
function diff(
|
|
before: Json | undefined,
|
|
after: Json | undefined,
|
|
path = "state",
|
|
): DiffRow[] {
|
|
if (JSON.stringify(before) === JSON.stringify(after)) return [];
|
|
if (
|
|
before !== null &&
|
|
after !== null &&
|
|
typeof before === "object" &&
|
|
typeof after === "object" &&
|
|
!Array.isArray(before) &&
|
|
!Array.isArray(after)
|
|
) {
|
|
const keys = new Set([...Object.keys(before), ...Object.keys(after)]);
|
|
return [...keys].flatMap((key) =>
|
|
diff(before[key], after[key], `${path}.${key}`),
|
|
);
|
|
}
|
|
return [{ path, before, after }];
|
|
}
|
|
|
|
function download(snapshot: CapabilityDevtoolsSnapshot) {
|
|
const blob = new Blob([JSON.stringify(snapshot, null, 2)], {
|
|
type: "application/json",
|
|
});
|
|
const url = URL.createObjectURL(blob);
|
|
const anchor = document.createElement("a");
|
|
anchor.href = url;
|
|
anchor.download = `paperclip-devtools-r${snapshot.currentRevision}.json`;
|
|
anchor.click();
|
|
URL.revokeObjectURL(url);
|
|
}
|
|
|
|
const TABS: ReadonlyArray<{
|
|
id: CapabilityDevtoolsTab;
|
|
icon: IconName;
|
|
label: string;
|
|
}> = [
|
|
{ id: "evidence", icon: "evidence", label: "Evidence" },
|
|
{ id: "timeline", icon: "timeline", label: "Timeline" },
|
|
{ id: "state", icon: "state", label: "State" },
|
|
{ id: "diff", icon: "diff", label: "Diff" },
|
|
{ id: "documents", icon: "documents", label: "Documents" },
|
|
{ id: "protocol", icon: "protocol", label: "Protocol" },
|
|
{ id: "trace", icon: "protocol", label: "Provider trace" },
|
|
{ id: "runtime", icon: "terminal", label: "Runtime" },
|
|
{ id: "authority", icon: "authority", label: "Authority" },
|
|
];
|
|
|
|
function documentsOf(state: Json): Array<{
|
|
id: string;
|
|
key: string;
|
|
title: string;
|
|
revisions: Array<{
|
|
id: string;
|
|
revision: number;
|
|
body: string;
|
|
changeSummary: string | null;
|
|
createdAt: string;
|
|
}>;
|
|
}> {
|
|
if (state === null || typeof state !== "object" || Array.isArray(state))
|
|
return [];
|
|
const documents = state.documents;
|
|
if (!Array.isArray(documents)) return [];
|
|
return documents.flatMap((value) => {
|
|
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
return [];
|
|
const revisions = Array.isArray(value.revisions)
|
|
? value.revisions.flatMap((candidate) => {
|
|
if (
|
|
candidate === null ||
|
|
typeof candidate !== "object" ||
|
|
Array.isArray(candidate)
|
|
)
|
|
return [];
|
|
return [
|
|
{
|
|
id: String(candidate.id ?? ""),
|
|
revision: Number(candidate.revision ?? 0),
|
|
body: String(candidate.body ?? ""),
|
|
changeSummary:
|
|
candidate.changeSummary === null
|
|
? null
|
|
: String(candidate.changeSummary ?? ""),
|
|
createdAt: String(candidate.createdAt ?? ""),
|
|
},
|
|
];
|
|
})
|
|
: [];
|
|
return [
|
|
{
|
|
id: String(value.id ?? ""),
|
|
key: String(value.key ?? ""),
|
|
title: String(value.title ?? "Untitled"),
|
|
revisions,
|
|
},
|
|
];
|
|
});
|
|
}
|
|
|
|
export function EvalReportInspector({
|
|
evalReport,
|
|
}: {
|
|
evalReport: EvalInspectorReport;
|
|
}) {
|
|
const isPublic = Boolean(evalReport.publication);
|
|
return (
|
|
<div className="pit-devtools-pane pit-eval-inspector">
|
|
<div className="pit-eval-summary-head">
|
|
<a href="../../index.html">← Eval suite</a>
|
|
<strong>
|
|
{evalReport.passed
|
|
? "PASS"
|
|
: evalReport.disposition.replaceAll("_", " ").toUpperCase()}
|
|
</strong>
|
|
<code>{evalReport.attemptId}</code>
|
|
</div>
|
|
<dl className="pit-eval-run-facts">
|
|
<div>
|
|
<dt>Model</dt>
|
|
<dd>
|
|
{evalReport.run.model.startsWith(`${evalReport.run.provider}/`)
|
|
? evalReport.run.model
|
|
: `${evalReport.run.provider}/${evalReport.run.model}`}
|
|
</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Configuration</dt>
|
|
<dd>{evalReport.run.configuration}</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Session</dt>
|
|
<dd>
|
|
{isPublic
|
|
? "Withheld from public replay"
|
|
: evalReport.run.sessionId}
|
|
</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Provider session</dt>
|
|
<dd>
|
|
{isPublic
|
|
? "Withheld from public replay"
|
|
: (evalReport.run.providerSessionId ?? "unavailable")}
|
|
</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Driver</dt>
|
|
<dd>
|
|
{evalReport.run.driver}
|
|
{evalReport.run.providerVersion
|
|
? ` · ${evalReport.run.providerVersion}`
|
|
: ""}
|
|
</dd>
|
|
</div>
|
|
{evalReport.run.agentVersion ? (
|
|
<div>
|
|
<dt>Agent version</dt>
|
|
<dd>{evalReport.run.agentVersion}</dd>
|
|
</div>
|
|
) : null}
|
|
<div>
|
|
<dt>Retained session</dt>
|
|
<dd>
|
|
{isPublic
|
|
? "Withheld from public replay"
|
|
: evalReport.run.retainedSession === true
|
|
? (evalReport.run.retainedSessionStatus ?? "retained")
|
|
: "not applicable"}
|
|
</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Duration</dt>
|
|
<dd>
|
|
{evalReport.run.durationMs == null
|
|
? "unavailable"
|
|
: `${evalReport.run.durationMs} ms`}
|
|
</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Fixture</dt>
|
|
<dd>{evalReport.run.fixtureDigest}</dd>
|
|
</div>
|
|
<div>
|
|
<dt>State</dt>
|
|
<dd>
|
|
{isPublic
|
|
? "Withheld from public replay"
|
|
: evalReport.run.initialRevision == null || evalReport.run.finalRevision == null
|
|
? "unavailable"
|
|
: `r${evalReport.run.initialRevision} → r${evalReport.run.finalRevision}`}
|
|
</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Tokens</dt>
|
|
<dd>
|
|
{evalReport.run.usage == null
|
|
? "unavailable"
|
|
: `${evalReport.run.usage.inputTokens ?? "unavailable"} in · ${evalReport.run.usage.outputTokens ?? "unavailable"} out · ${evalReport.run.usage.cachedInputTokens ?? "unavailable"} cached`}
|
|
</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Agent turns</dt>
|
|
<dd>{evalReport.run.usage?.agentTurns ?? "unknown"}</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Provider requests</dt>
|
|
<dd>{evalReport.run.usage?.providerRequests ?? "unavailable"}</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Estimated cost</dt>
|
|
<dd>
|
|
{evalReport.run.usage?.estimatedCostNanodollars == null
|
|
? "unavailable"
|
|
: `$${(evalReport.run.usage.estimatedCostNanodollars / 1_000_000_000).toFixed(6)}${evalReport.run.usage.pricingVersion ? ` · ${evalReport.run.usage.pricingVersion}` : ""}`}
|
|
</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Provider list cost</dt>
|
|
<dd>
|
|
{typeof evalReport.run.usage?.providerReportedCostNanodollars !==
|
|
"number"
|
|
? "unknown"
|
|
: `$${(evalReport.run.usage.providerReportedCostNanodollars / 1_000_000_000).toFixed(6)}`}
|
|
</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Runner</dt>
|
|
<dd>{evalReport.run.runnerPackageDigest}</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Runner build</dt>
|
|
<dd>{evalReport.run.runnerBuild}</dd>
|
|
</div>
|
|
<div>
|
|
<dt>runnerd</dt>
|
|
<dd>{evalReport.run.runnerdDigest}</dd>
|
|
</div>
|
|
</dl>
|
|
<h3>Assertions</h3>
|
|
<EvalAssertions assertions={evalReport.checks} />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function DevtoolsInspector({
|
|
snapshot,
|
|
onFork,
|
|
tab,
|
|
onTabChange,
|
|
evalReport,
|
|
}: {
|
|
snapshot: CapabilityDevtoolsSnapshot;
|
|
onFork: (revision: number) => void;
|
|
tab: CapabilityDevtoolsTab;
|
|
onTabChange: (tab: CapabilityDevtoolsTab) => void;
|
|
evalReport?: EvalInspectorReport | null;
|
|
}) {
|
|
const [query, setQuery] = useState("");
|
|
const latest = snapshot.revisions.at(-1)!;
|
|
const [revision, setRevision] = useState(latest.revision);
|
|
const [following, setFollowing] = useState(true);
|
|
const [compareRevision, setCompareRevision] = useState(
|
|
snapshot.revisions[0]!.revision,
|
|
);
|
|
const selected =
|
|
snapshot.revisions.find((entry) => entry.revision === revision) ?? latest;
|
|
const compared =
|
|
snapshot.revisions.find((entry) => entry.revision === compareRevision) ??
|
|
snapshot.revisions[0]!;
|
|
const rows = useMemo(
|
|
() => diff(compared.state as Json, selected.state as Json),
|
|
[compared.state, selected.state],
|
|
);
|
|
const normalized = query.trim().toLowerCase();
|
|
const revisions = snapshot.revisions.filter(
|
|
(entry) =>
|
|
normalized.length === 0 ||
|
|
JSON.stringify(entry).toLowerCase().includes(normalized),
|
|
);
|
|
const protocol = snapshot.protocol.filter(
|
|
(entry) =>
|
|
normalized.length === 0 ||
|
|
JSON.stringify(entry).toLowerCase().includes(normalized),
|
|
);
|
|
const documents = useMemo(
|
|
() => documentsOf(selected.state as Json),
|
|
[selected.state],
|
|
);
|
|
const [documentId, setDocumentId] = useState("");
|
|
const document =
|
|
documents.find((entry) => entry.id === documentId) ?? documents[0] ?? null;
|
|
const [documentRevision, setDocumentRevision] = useState(0);
|
|
const visibleDocumentRevision =
|
|
document?.revisions.find((entry) => entry.revision === documentRevision) ??
|
|
document?.revisions.at(-1) ??
|
|
null;
|
|
useEffect(() => {
|
|
if (following) setRevision(latest.revision);
|
|
}, [following, latest.revision]);
|
|
|
|
return (
|
|
<section className="pit-devtools" data-testid="devtools-inspector">
|
|
<div className="pit-devtools-toolbar">
|
|
<span className="pit-devtools-brand">
|
|
<Icon name="activity" /> State monitor
|
|
</span>
|
|
<input
|
|
id="devtools-search"
|
|
className="pit-input"
|
|
value={query}
|
|
onChange={(event) => setQuery(event.target.value)}
|
|
placeholder="operation, entity, turn…"
|
|
/>
|
|
<button
|
|
className="pit-icon-button"
|
|
type="button"
|
|
aria-pressed={!following}
|
|
onClick={() => setFollowing((value) => !value)}
|
|
title={following ? "Pause live updates" : "Follow latest revision"}
|
|
aria-label={
|
|
following ? "Pause live updates" : "Follow latest revision"
|
|
}
|
|
>
|
|
<Icon name={following ? "pause" : "play"} />
|
|
</button>
|
|
<button
|
|
className="pit-icon-button"
|
|
type="button"
|
|
onClick={() => download(snapshot)}
|
|
title="Export redacted snapshot"
|
|
aria-label="Export redacted snapshot"
|
|
>
|
|
<Icon name="download" />
|
|
</button>
|
|
<button
|
|
className="pit-button"
|
|
type="button"
|
|
onClick={() => onFork(revision)}
|
|
disabled={evalReport != null}
|
|
title={evalReport ? "Eval reports are read-only" : undefined}
|
|
>
|
|
<Icon name="branch" /> Fork r{revision}
|
|
</button>
|
|
</div>
|
|
<div
|
|
className="pit-devtools-tabs"
|
|
role="tablist"
|
|
aria-label="Developer tools"
|
|
>
|
|
{[
|
|
...(evalReport
|
|
? [
|
|
{
|
|
id: "eval" as const,
|
|
icon: "evidence" as const,
|
|
label: "Eval",
|
|
},
|
|
]
|
|
: []),
|
|
...TABS,
|
|
].map(({ id, icon, label }) => (
|
|
<button
|
|
key={id}
|
|
type="button"
|
|
role="tab"
|
|
aria-selected={tab === id}
|
|
className="pit-tab"
|
|
onClick={() => onTabChange(id)}
|
|
>
|
|
<span className="pit-tab-glyph">
|
|
<Icon name={icon} />
|
|
</span>
|
|
<span>{label}</span>
|
|
</button>
|
|
))}
|
|
</div>
|
|
{tab === "eval" && evalReport ? (
|
|
<EvalReportInspector evalReport={evalReport} />
|
|
) : null}
|
|
{tab === "timeline" ? (
|
|
<div className="pit-devtools-list">
|
|
{revisions.map((entry) => (
|
|
<button
|
|
type="button"
|
|
className="pit-devtools-event"
|
|
data-selected={entry.revision === revision}
|
|
key={entry.revision}
|
|
onClick={() => {
|
|
setFollowing(false);
|
|
setRevision(entry.revision);
|
|
}}
|
|
>
|
|
<strong>r{entry.revision}</strong>
|
|
<span>{entry.operationId}</span>
|
|
<span className="pit-muted">{entry.turnId ?? "session"}</span>
|
|
</button>
|
|
))}
|
|
</div>
|
|
) : null}
|
|
{tab === "state" ? (
|
|
<div className="pit-devtools-pane">
|
|
<label className="pit-card-meta" htmlFor="devtools-revision">
|
|
Revision
|
|
</label>
|
|
<select
|
|
id="devtools-revision"
|
|
className="pit-select"
|
|
value={revision}
|
|
onChange={(event) => setRevision(Number(event.target.value))}
|
|
>
|
|
{snapshot.revisions.map((entry) => (
|
|
<option key={entry.revision} value={entry.revision}>
|
|
r{entry.revision} · {entry.operationId}
|
|
</option>
|
|
))}
|
|
</select>
|
|
<JsonTree value={selected.state as Json} />
|
|
</div>
|
|
) : null}
|
|
{tab === "diff" ? (
|
|
<div className="pit-devtools-pane">
|
|
<div className="pit-button-row">
|
|
<select
|
|
className="pit-select"
|
|
aria-label="Compare from revision"
|
|
value={compareRevision}
|
|
onChange={(event) =>
|
|
setCompareRevision(Number(event.target.value))
|
|
}
|
|
>
|
|
{snapshot.revisions.map((entry) => (
|
|
<option key={entry.revision} value={entry.revision}>
|
|
from r{entry.revision}
|
|
</option>
|
|
))}
|
|
</select>
|
|
<select
|
|
className="pit-select"
|
|
aria-label="Compare to revision"
|
|
value={revision}
|
|
onChange={(event) => setRevision(Number(event.target.value))}
|
|
>
|
|
{snapshot.revisions.map((entry) => (
|
|
<option key={entry.revision} value={entry.revision}>
|
|
to r{entry.revision}
|
|
</option>
|
|
))}
|
|
</select>
|
|
</div>
|
|
{rows.map((row) => (
|
|
<div className="pit-diff-row" key={row.path}>
|
|
<strong>{row.path}</strong>
|
|
<del>{JSON.stringify(row.before)}</del>
|
|
<ins>{JSON.stringify(row.after)}</ins>
|
|
</div>
|
|
))}
|
|
{rows.length === 0 ? (
|
|
<p className="pit-muted">No changes between these revisions.</p>
|
|
) : null}
|
|
</div>
|
|
) : null}
|
|
{tab === "documents" ? (
|
|
documents.length === 0 ? (
|
|
<div className="pit-devtools-empty">
|
|
<span aria-hidden="true">▤</span>
|
|
<p>No documents exist at r{selected.revision}.</p>
|
|
</div>
|
|
) : (
|
|
<div className="pit-document-browser">
|
|
<div className="pit-document-sidebar">
|
|
{documents.map((entry) => (
|
|
<button
|
|
type="button"
|
|
key={entry.id}
|
|
data-selected={entry.id === document?.id}
|
|
onClick={() => {
|
|
setDocumentId(entry.id);
|
|
setDocumentRevision(0);
|
|
}}
|
|
>
|
|
<strong>{entry.key}</strong>
|
|
<span>{entry.title}</span>
|
|
<small>
|
|
{entry.revisions.length} revision
|
|
{entry.revisions.length === 1 ? "" : "s"}
|
|
</small>
|
|
</button>
|
|
))}
|
|
</div>
|
|
{document !== null && visibleDocumentRevision !== null ? (
|
|
<article className="pit-document-viewer">
|
|
<header>
|
|
<div>
|
|
<span className="pit-card-meta">{document.key}</span>
|
|
<h4>{document.title}</h4>
|
|
</div>
|
|
<select
|
|
className="pit-select"
|
|
aria-label="Document revision"
|
|
value={visibleDocumentRevision.revision}
|
|
onChange={(event) =>
|
|
setDocumentRevision(Number(event.target.value))
|
|
}
|
|
>
|
|
{document.revisions.map((entry) => (
|
|
<option key={entry.id} value={entry.revision}>
|
|
r{entry.revision}
|
|
</option>
|
|
))}
|
|
</select>
|
|
</header>
|
|
{visibleDocumentRevision.changeSummary ? (
|
|
<p className="pit-document-summary">
|
|
{visibleDocumentRevision.changeSummary}
|
|
</p>
|
|
) : null}
|
|
<pre className="pit-document-body">
|
|
{visibleDocumentRevision.body}
|
|
</pre>
|
|
</article>
|
|
) : null}
|
|
</div>
|
|
)
|
|
) : null}
|
|
{tab === "protocol" ? (
|
|
<div className="pit-devtools-list">
|
|
{protocol.map((entry) => (
|
|
<details className="pit-runner-event" key={entry.id}>
|
|
<summary>
|
|
<strong>{entry.boundary}</strong> · {entry.event}
|
|
</summary>
|
|
<JsonTree value={entry.detail as Json} />
|
|
</details>
|
|
))}
|
|
</div>
|
|
) : null}
|
|
{tab === "trace" ? (
|
|
snapshot.providerTrace ? (
|
|
<div className="pit-devtools-pane">
|
|
<p>
|
|
<strong>{snapshot.providerTrace.status}</strong> · expires{" "}
|
|
{snapshot.providerTrace.expiresAt}
|
|
</p>
|
|
<h3>Raw frame → Interpretation → PRP events → Presentation</h3>
|
|
<JsonTree
|
|
value={
|
|
{
|
|
frames: snapshot.providerTrace.frames,
|
|
interpretations: snapshot.providerTrace.interpretations,
|
|
} as Json
|
|
}
|
|
/>
|
|
</div>
|
|
) : (
|
|
<div className="pit-devtools-empty">
|
|
<span aria-hidden="true">◇</span>
|
|
<p>
|
|
Raw provider capture was off for this run. Canonical protocol
|
|
records remain available in Protocol.
|
|
</p>
|
|
</div>
|
|
)
|
|
) : null}
|
|
{tab === "runtime" ? (
|
|
<div className="pit-devtools-pane">
|
|
<JsonTree value={snapshot.runtime as Json} />
|
|
</div>
|
|
) : null}
|
|
{tab === "authority" ? (
|
|
<div className="pit-devtools-pane">
|
|
<JsonTree value={snapshot.authority as Json} />
|
|
</div>
|
|
) : null}
|
|
</section>
|
|
);
|
|
}
|