Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/presentation/dashboard/src/data/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,17 @@ export const runRecordSchema = z.object({
project_map: projectMapSchema.optional().nullable(),
});

const goalArtifactLifecycleSchema = z.object({
schema_version: z.literal("goal_artifact_lifecycle_projection_v0"),
goal_id: z.string(),
guards: z.array(z.object({
id: z.string(), kind: z.string(), owner: z.string(), blocked: z.boolean(),
})),
});
export type GoalArtifactLifecycle = z.infer<typeof goalArtifactLifecycleSchema>;

export const runGoalSchema = z.object({
artifact_lifecycle: goalArtifactLifecycleSchema.optional().nullable().catch(null),
source_access: z.object({namespace: z.string(), label: z.string(), read_only: z.literal(true), original_goal_id: z.string().optional()}).optional(),
parent_goal_id: z.string().nullable().optional().catch(null),
goal_objective: z.string().nullable().optional().catch(null),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ function relativeLookLabel(iso: string, locale: string): string {
return new Intl.DateTimeFormat(locale === "zh-CN" ? "zh-CN" : "en", { month: "short", day: "numeric" }).format(then);
}

export function GoalOverview({ active, goal, items, userTodos, readOnly, onOpenDetails, onSelect, onView, selectedTodoId, board, proposals, onPreview, historyRefreshRevision, review, digest, railOpen, onCloseRail, onOpenAgentConversation, sinceYouLooked, onMarkSeen }: {
export function GoalOverview({ active, goal, items, userTodos, readOnly, onOpenDetails, onSelect, onView, onOpenVerification, selectedTodoId, board, proposals, onPreview, historyRefreshRevision, review, digest, railOpen, onCloseRail, onOpenAgentConversation, sinceYouLooked, onMarkSeen }: {
onOpenVerification: () => void;
onOpenAgentConversation?: (agentId: string) => void;
/** Material changes since the owner's last acknowledged look; null when none. */
sinceYouLooked?: SinceYouLookedDelta | null; onMarkSeen?: () => void;
Expand Down Expand Up @@ -109,8 +110,14 @@ export function GoalOverview({ active, goal, items, userTodos, readOnly, onOpenD
{moreAttention ? <button className="goal-overview-more" type="button" onClick={() => onView("tasks")}>{copy.tasks}{totalAttention !== null ? ` (${totalAttention})` : ""}<ArrowRight aria-hidden size={14} /></button> : null}
</section> : null}
map={readOnly ? <ContextHelp label={locale === "zh-CN" ? "来源读取范围" : "Source reading scope"} icon={CircleHelp}><p className="goal-work-scope">{copy.remote}</p></ContextHelp> : <DeliveryWorkMap goal={goal} userTodos={userTodos} review={review} onSelect={onSelect} selectedTodoId={selectedTodoId}/>}/>
{readOnly ? <GoalAcceptanceObservationCard goal={goal} overview />
{readOnly ? <><GoalAcceptanceObservationCard goal={goal} overview />
{goal.sourceAccess ? <button className="goal-overview-more" type="button" onClick={onOpenVerification}>
{locale === "zh-CN" ? "在研究中查看验证证据" : "Read verification evidence in Research"}<ArrowRight size={14} aria-hidden />
</button> : null}</>
: <OverviewDeliveryEvidence key={`delivery:${goal.goalId}`} review={review} zh={locale === "zh-CN"}>
<button className="goal-overview-more" type="button" onClick={onOpenVerification}>
{locale === "zh-CN" ? "在研究中查看验证证据" : "Read verification evidence in Research"}<ArrowRight size={14} aria-hidden />
</button>
<DeliveryReviewContent review={review} hideWorkMap hideAcceptanceContract active={active} goal={goal} items={items} userTodos={userTodos} onSelect={onSelect} />
</OverviewDeliveryEvidence>}
</section>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {ExecutionObservationReadback, WorkYardstickReadback} from "./work-yardst
import {GoalSourceStrategies, useGoalStrategyLocation} from "./goal-source-strategies";
import {exploreFindingCopy} from "./explore-finding-copy";
import {AlertCircle, ArrowLeft, ArrowRight, Circle, CircleHelp, FlaskConical, GitBranch, RefreshCw, Search} from "lucide-react";
import {GoalVerificationWorkbench, type GoalVerificationSources} from "./goal-verification-workbench";
import {Fragment, useEffect, useId, useLayoutEffect, useMemo, useRef, useState} from "react";
import {defaultParseSearch} from "@tanstack/react-router";
import {ResearchRecordSearch, useResearchRecordsLocation} from "./research-record-browser";
Expand Down Expand Up @@ -53,9 +54,11 @@ const viewFromUrl = (goal: string) => {

/** An effect-free history consumer. Its source is Explore, not raw sessions or
* a judge. All recorded updates survive; unsupported analysis stays unavailable. */
export function GoalResearchHistory({goalId, originalGoalId = goalId, preferHistory = false, active, zh, refreshRevision = 0, readSourceUrl, onOpenSourceTasks}: {
export function GoalResearchHistory({goalId, originalGoalId = goalId, preferHistory = false, active, zh, refreshRevision = 0, readSourceUrl, onOpenSourceTasks, verification, showVerification}: {
goalId: string; originalGoalId?: string; preferHistory?: boolean; active: boolean; zh: boolean; refreshRevision?: number; readSourceUrl?: string;
onOpenSourceTasks?: () => void;
verification?: GoalVerificationSources;
showVerification?: number;
}) {
const strategies = useGoalStrategyLocation(goalId, readSourceUrl);
const analysis = useResearchAnalysis(goalId, active, zh, readSourceUrl);
Expand All @@ -75,7 +78,15 @@ export function GoalResearchHistory({goalId, originalGoalId = goalId, preferHist
const deferHistory = requestedCase === true && caseViewAvailable;
const historySource = JSON.stringify([goalId, originalGoalId, readSourceUrl]);
const [openedHistorySource, setOpenedHistorySource] = useState<string | null>(null);
const readHistory = active && (!deferHistory || openedHistorySource === historySource);
const [openVerificationSource, setOpenVerificationSource] = useState<string | null>(null);
const verificationOpen = openVerificationSource === historySource;
const verificationEntry = useRef<HTMLDetailsElement>(null);
useEffect(() => {
if (!active || !showVerification) return;
setOpenVerificationSource(historySource);
verificationEntry.current?.querySelector("summary")?.focus();
}, [active, showVerification, historySource]);
const readHistory = active && (verificationOpen || !deferHistory || openedHistorySource === historySource);
useEffect(() => {
const changed = () => setCaseReading(readCaseMode());
changed(); window.addEventListener("popstate", changed);
Expand Down Expand Up @@ -302,6 +313,11 @@ export function GoalResearchHistory({goalId, originalGoalId = goalId, preferHist
? findingVersions.find(finding => finding.event_id === selection.event && (!selection.finding || finding.result_id === selection.finding))
: selection.finding ? selected.findings.find(finding => finding.result_id === selection.finding)
: defaultFinding(selected));
const verificationFinding = selectedFinding
? history.canonical?.events.find(item => item.event_id === selectedFinding.event_id)
: !selection.nodes.length && selection.day === null
? history.canonical?.findings.filter(item => item.status === "confirmed" && (item.work_yardstick || item.execution_observation)).at(-1)
: undefined;
const hasSeparateQuestion = Boolean(selected?.findings.length && selectedFinding?.title !== selected.latest.title);
const selectedGroup = selection.day !== null ? grouped.groups.find(group => group.day === selection.day) : undefined;
const selectedMembers = selectedGroup?.nodes ?? (selection.nodes.length > 1 ? value?.nodes.filter(node => selection.nodes.includes(node.id)) : undefined);
Expand Down Expand Up @@ -527,6 +543,13 @@ export function GoalResearchHistory({goalId, originalGoalId = goalId, preferHist
sourceUrl={readSourceUrl} zh={zh} selection={selectedStrategy}
onSelect={strategies.choose} onClose={() => strategies.choose(null)}/> : null;
return <>
{verification ? <details className="goal-verification-entry" ref={verificationEntry} key={historySource} open={verificationOpen}
onToggle={event => setOpenVerificationSource(event.currentTarget.open ? historySource : null)}>
<summary>{zh ? "验证证据包" : "Verification evidence packet"}</summary>
{verificationOpen ? <GoalVerificationWorkbench key={selectedFinding?.event_id ?? historySource} {...verification} zh={zh} goalId={goalId}
finding={verificationFinding} findings={history.canonical?.findings ?? []} complete={read.complete && !busy}
unavailable={Boolean(error || history.error)}/> : null}
</details> : null}
{caseViewAvailable ? <div className="research-reading-views" role="group" aria-label={zh ? "研究视图" : "Research view"}>
<button type="button" aria-pressed={!readingCase} onClick={() => {
if (readingCase) {analysis.closeCitation(); setCaseMode(false);}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type {GoalVerificationSources} from "./goal-verification-workbench";
import {useState, type ReactNode} from "react";
import {GoalResearchHistory} from "./goal-research-history";
import {GoalExploreResults} from "./goal-explore-results";
Expand Down Expand Up @@ -32,7 +33,7 @@ function ResearchGoalNavigation({goalId, goals, zh, onSelect, directoryUrl, acti
}

/** One read surface for the selected original Goal; opening it never starts research. */
export function GoalResearchWorkbench(props: {goalId: string; active: boolean; zh: boolean; refreshRevision: number; readSourceUrl?: string; directoryReadSourceUrl?: string; goals?: ResearchGoal[]; onSelectGoal?: (goalId: string) => void; onOpenTasks?: () => void; statusNotice?: ReactNode}) {
export function GoalResearchWorkbench(props: {goalId: string; active: boolean; zh: boolean; refreshRevision: number; readSourceUrl?: string; directoryReadSourceUrl?: string; goals?: ResearchGoal[]; onSelectGoal?: (goalId: string) => void; onOpenTasks?: () => void; statusNotice?: ReactNode; verification?: GoalVerificationSources; showVerification?: number}) {
const selected = props.goals?.find(goal => goal.goalId === props.goalId);
const source = selected?.sourceAccess;
const [evidenceOpen, setEvidenceOpen] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.goal-verification-entry {
min-width: 0;
margin: 16px 0 0;
border: 1px solid var(--pw-line);
border-radius: 8px;
}
.goal-verification-entry > summary {
min-height: 44px;
padding: 12px 16px;
cursor: pointer;
font-weight: 600;
}
.goal-verification-body {
padding: 8px 16px 16px;
overflow-wrap: anywhere;
font-size: var(--text-body);
}
.goal-verification-select {
display: grid;
gap: 4px;
margin-bottom: 12px;
max-width: 480px;
}
.goal-verification-select select {
min-height: 44px;
width: 100%;
border: 1px solid var(--pw-line);
border-radius: 6px;
padding-inline: 8px;
}
.goal-verification-body p { margin: 0 0 12px; }
.goal-verification-body code,
.goal-verification-body dd > small { display: block; margin-top: 3px; color: var(--pw-muted); }
.goal-verification-body dl { margin: 0; }
.goal-verification-body dt { color: var(--pw-muted); }
.goal-verification-body dd { margin: 0; }
.goal-verification-body dd ul { margin: 4px 0; padding-inline-start: 16px; }
.goal-verification-body h3 { margin: 0 0 12px; font-size: var(--text-body); font-weight: 600; }
.goal-verification-profile,
.goal-verification-packet {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px 20px;
}
.goal-verification-packet { margin-top: 16px; }
.goal-verification-packet > section { min-width: 0; padding: 12px 0; border-top: 1px solid var(--pw-line); }
.goal-verification-packet dl > div + div { margin-top: 8px; }
.goal-verification-packet ul { margin: 0; padding-inline-start: 16px; }
.goal-verification-packet li + li { margin-top: 8px; }
@media (max-width: 640px) {
.goal-verification-packet { grid-template-columns: minmax(0, 1fr); }
}
Loading
Loading