@igorjpimenta/manifold 0.0.0-bootstrap.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.migrations/ops/0000_futuristic_karma.sql +111 -0
- package/.migrations/ops/0001_low_maximus.sql +7 -0
- package/.migrations/ops/meta/0000_snapshot.json +763 -0
- package/.migrations/ops/meta/0001_snapshot.json +173 -0
- package/.migrations/ops/meta/_journal.json +20 -0
- package/.migrations/runtime/0000_real_boomer.sql +180 -0
- package/.migrations/runtime/0001_hot_dakota_north.sql +2 -0
- package/.migrations/runtime/0002_breezy_vertigo.sql +8 -0
- package/.migrations/runtime/0003_dashing_jack_flag.sql +5 -0
- package/.migrations/runtime/0004_panoramic_ego.sql +1 -0
- package/.migrations/runtime/0005_tidy_ben_grimm.sql +10 -0
- package/.migrations/runtime/0006_wet_nightmare.sql +57 -0
- package/.migrations/runtime/0007_ambiguous_chronomancer.sql +8 -0
- package/.migrations/runtime/0008_wealthy_thundra.sql +301 -0
- package/.migrations/runtime/0009_lying_shocker.sql +96 -0
- package/.migrations/runtime/0010_solid_phantom_reporter.sql +160 -0
- package/.migrations/runtime/0011_windy_demogoblin.sql +175 -0
- package/.migrations/runtime/0012_restore_harness_fks.sql +103 -0
- package/.migrations/runtime/meta/0000_snapshot.json +1181 -0
- package/.migrations/runtime/meta/0001_snapshot.json +1209 -0
- package/.migrations/runtime/meta/0002_snapshot.json +1261 -0
- package/.migrations/runtime/meta/0003_snapshot.json +1292 -0
- package/.migrations/runtime/meta/0004_snapshot.json +1240 -0
- package/.migrations/runtime/meta/0006_snapshot.json +1310 -0
- package/.migrations/runtime/meta/0007_snapshot.json +1362 -0
- package/.migrations/runtime/meta/0008_snapshot.json +1742 -0
- package/.migrations/runtime/meta/0009_snapshot.json +2413 -0
- package/.migrations/runtime/meta/0010_snapshot.json +2562 -0
- package/.migrations/runtime/meta/0011_snapshot.json +2812 -0
- package/.migrations/runtime/meta/0012_snapshot.json +2812 -0
- package/.migrations/runtime/meta/_journal.json +97 -0
- package/README.md +1584 -0
- package/RELEASING.md +89 -0
- package/agent/fleet.js +100 -0
- package/bin/cli.js +854 -0
- package/bin/manifold.js +4 -0
- package/boot/flow-revival.js +536 -0
- package/budget/index.js +495 -0
- package/budget/lib.js +59 -0
- package/dashboard/cost.js +528 -0
- package/dashboard/dist/assets/index-CUfp63sj.css +1 -0
- package/dashboard/dist/assets/index-Qy9JMpma.js +371 -0
- package/dashboard/dist/index.html +13 -0
- package/dashboard/event-log.js +267 -0
- package/dashboard/index.html +12 -0
- package/dashboard/package-lock.json +2877 -0
- package/dashboard/package.json +37 -0
- package/dashboard/pipeline-graph.js +131 -0
- package/dashboard/postcss.config.js +6 -0
- package/dashboard/search.js +183 -0
- package/dashboard/server.js +1015 -0
- package/dashboard/src/App.tsx +42 -0
- package/dashboard/src/api/client.ts +118 -0
- package/dashboard/src/api/types.ts +510 -0
- package/dashboard/src/api/ws.tsx +112 -0
- package/dashboard/src/components/CancelButton.tsx +63 -0
- package/dashboard/src/components/ClickToCopy.tsx +68 -0
- package/dashboard/src/components/CopyButton.tsx +61 -0
- package/dashboard/src/components/DailyCostTrend.tsx +85 -0
- package/dashboard/src/components/DailyTimeTrend.tsx +94 -0
- package/dashboard/src/components/Funnel.tsx +149 -0
- package/dashboard/src/components/GateForm.tsx +158 -0
- package/dashboard/src/components/GraphView.tsx +302 -0
- package/dashboard/src/components/GroupPathsSummary.tsx +47 -0
- package/dashboard/src/components/Histogram.tsx +292 -0
- package/dashboard/src/components/Layout.tsx +28 -0
- package/dashboard/src/components/NeedsAttention.tsx +98 -0
- package/dashboard/src/components/NodeContextCard.tsx +132 -0
- package/dashboard/src/components/PathTrail.tsx +35 -0
- package/dashboard/src/components/PipelineCostBreakdown.tsx +277 -0
- package/dashboard/src/components/RerunButton.tsx +46 -0
- package/dashboard/src/components/RunComparison.tsx +53 -0
- package/dashboard/src/components/Sparkline.tsx +94 -0
- package/dashboard/src/components/StatStrip.tsx +147 -0
- package/dashboard/src/components/StateTree.tsx +84 -0
- package/dashboard/src/components/StatusBadge.tsx +18 -0
- package/dashboard/src/components/SubflowPathPills.tsx +38 -0
- package/dashboard/src/components/SubflowSummary.tsx +24 -0
- package/dashboard/src/components/SubflowsCard.tsx +327 -0
- package/dashboard/src/components/TodayStrip.tsx +86 -0
- package/dashboard/src/components/TranscriptPane.tsx +99 -0
- package/dashboard/src/components/TranscriptRow.tsx +69 -0
- package/dashboard/src/components/ui/badge.tsx +38 -0
- package/dashboard/src/components/ui/button.tsx +28 -0
- package/dashboard/src/components/ui/card.tsx +42 -0
- package/dashboard/src/components/ui/skeleton.tsx +9 -0
- package/dashboard/src/components/ui/table.tsx +62 -0
- package/dashboard/src/index.css +26 -0
- package/dashboard/src/lib/anomaly.ts +42 -0
- package/dashboard/src/lib/format.ts +30 -0
- package/dashboard/src/lib/step-history.ts +13 -0
- package/dashboard/src/lib/subflow.ts +154 -0
- package/dashboard/src/lib/use-click-outside.ts +28 -0
- package/dashboard/src/lib/use-ignored-clusters.ts +67 -0
- package/dashboard/src/lib/utils.ts +6 -0
- package/dashboard/src/main.tsx +10 -0
- package/dashboard/src/types/shims.d.ts +4 -0
- package/dashboard/src/views/Home.tsx +478 -0
- package/dashboard/src/views/PipelineDetail.tsx +1185 -0
- package/dashboard/src/views/PipelinesList.tsx +111 -0
- package/dashboard/src/views/RunDetail.tsx +248 -0
- package/dashboard/src/views/Search.tsx +196 -0
- package/dashboard/stats.js +668 -0
- package/dashboard/tailwind.config.ts +43 -0
- package/dashboard/tree-stats.js +12 -0
- package/dashboard/tsconfig.json +25 -0
- package/dashboard/views.js +231 -0
- package/dashboard/vite.config.ts +34 -0
- package/drizzle.config.js +12 -0
- package/drizzle.config.ops.js +12 -0
- package/elevation.js +116 -0
- package/engine/admission-promotion-resume.js +127 -0
- package/engine/agent-dispatch.js +64 -0
- package/engine/child-resume-trigger.js +315 -0
- package/engine/executor-budget.js +87 -0
- package/engine/executor-cancel.js +83 -0
- package/engine/executor-errors.js +122 -0
- package/engine/executor-helpers.js +254 -0
- package/engine/executor-nodes.js +292 -0
- package/engine/executor-persist.js +212 -0
- package/engine/executor-subflow-children.js +275 -0
- package/engine/executor.js +1013 -0
- package/engine/global-concurrency.js +33 -0
- package/engine/loader.js +528 -0
- package/engine/needs-resolver.js +229 -0
- package/engine/pipelines-watcher.js +133 -0
- package/engine/result-replay.js +34 -0
- package/engine/revival-messages.js +11 -0
- package/engine/spawn-child.js +55 -0
- package/engine/wait-for-flow-settlement.js +109 -0
- package/events/catalog.js +26 -0
- package/events/emit.js +44 -0
- package/events/kinds.js +118 -0
- package/events/serve-ws.js +74 -0
- package/events/stream.js +35 -0
- package/events/ws-dialog.js +257 -0
- package/events/ws-frame.js +194 -0
- package/events/ws-run-events.js +70 -0
- package/events.js +32 -0
- package/gates/gate-resolver.js +576 -0
- package/gates/paused-flows.js +55 -0
- package/graphql/columns.js +67 -0
- package/graphql/schema.js +333 -0
- package/index.js +49 -0
- package/mcp/http.js +159 -0
- package/mcp/identity.js +94 -0
- package/mcp/stdio.js +80 -0
- package/mcp/tools.js +245 -0
- package/mcp/wire-ops.js +178 -0
- package/package.json +51 -0
- package/routes/bearer-auth.js +57 -0
- package/routes/discuss-audio.js +87 -0
- package/routes/discuss-component.js +39 -0
- package/routes/discuss-draft.js +159 -0
- package/routes/discuss-helpers.js +20 -0
- package/routes/discuss.js +848 -0
- package/routes/failures.js +104 -0
- package/routes/graphql.js +61 -0
- package/routes/health.js +54 -0
- package/routes/operator-discuss.js +193 -0
- package/routes/operator-resume.js +32 -0
- package/routes/operator-retry.js +301 -0
- package/routes/operator.js +539 -0
- package/routes/pipelines.js +118 -0
- package/routes/runs.js +1129 -0
- package/scripts/ci/import-check.mjs +50 -0
- package/scripts/link-core-self.mjs +31 -0
- package/scripts/with-guard.sh +24 -0
- package/server/app.js +503 -0
- package/server/registry.js +53 -0
- package/server/serve.js +163 -0
- package/state/admission-queue-store.js +325 -0
- package/state/attribution-registries.js +102 -0
- package/state/batch-writer.js +162 -0
- package/state/db-guard.js +63 -0
- package/state/db-health.js +27 -0
- package/state/db.js +122 -0
- package/state/discuss-store.js +299 -0
- package/state/failure-store.js +427 -0
- package/state/migrate.js +104 -0
- package/state/node-cost.js +67 -0
- package/state/node-executions.js +775 -0
- package/state/node-health-store.js +124 -0
- package/state/ops-merge.js +93 -0
- package/state/paths.js +146 -0
- package/state/pipeline-dirs.js +99 -0
- package/state/pipeline-registry.js +449 -0
- package/state/run-store.js +697 -0
- package/state/schema.js +438 -0
- package/state/schema.ops.js +44 -0
- package/state/session-index.js +177 -0
- package/state/session-keys.js +39 -0
- package/state/state-store.js +311 -0
- package/state/subflow-state.js +126 -0
- package/state/tool-handoff.js +169 -0
- package/telemetry/budget-alert.js +353 -0
- package/telemetry/cli.js +331 -0
- package/telemetry/grammar.js +119 -0
- package/telemetry/http-budget.js +132 -0
- package/telemetry/http-cost.js +670 -0
- package/telemetry/http-helpers.js +134 -0
- package/telemetry/http-tree.js +349 -0
- package/telemetry/http.js +44 -0
- package/telemetry/index.js +307 -0
- package/telemetry/ingest.js +134 -0
- package/telemetry/labels.js +115 -0
- package/telemetry/pricer.js +77 -0
- package/telemetry/resolver.js +314 -0
- package/telemetry/store.js +147 -0
- package/utils/run-patch.js +43 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { Card } from "@/components/ui/card";
|
|
3
|
+
import { Badge } from "@/components/ui/badge";
|
|
4
|
+
import { Table, THead, TBody, TR, TH, TD } from "@/components/ui/table";
|
|
5
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
6
|
+
import { api } from "@/api/client";
|
|
7
|
+
import { useWs } from "@/api/ws";
|
|
8
|
+
import { cn } from "@/lib/utils";
|
|
9
|
+
import type { Pipeline } from "@/api/types";
|
|
10
|
+
|
|
11
|
+
export function PipelinesList() {
|
|
12
|
+
// Nullable until first fetch lands — distinguishes "still loading"
|
|
13
|
+
// (skeleton) from "loaded, empty" (the no-pipelines-loaded copy).
|
|
14
|
+
const [pipelines, setPipelines] = useState<Pipeline[] | null>(null);
|
|
15
|
+
|
|
16
|
+
const load = () => { api.pipelines().then(setPipelines); };
|
|
17
|
+
useEffect(load, []);
|
|
18
|
+
useWs((evt) => { if (evt.kind === "pipeline.catalog.updated") load(); });
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<h2 className="text-[15px] font-semibold uppercase tracking-[0.5px] text-fg-dim mt-6 mb-2.5">pipelines</h2>
|
|
23
|
+
<Card>
|
|
24
|
+
{pipelines === null
|
|
25
|
+
? (
|
|
26
|
+
<div className="space-y-2">
|
|
27
|
+
{[0, 1, 2, 3, 4].map((i) => (
|
|
28
|
+
<div key={i} className="flex items-center gap-3 py-1">
|
|
29
|
+
<Skeleton className="h-3 w-60" />
|
|
30
|
+
<Skeleton className="h-3 w-8" />
|
|
31
|
+
<Skeleton className="h-3 w-72" />
|
|
32
|
+
<Skeleton className="h-3 w-24 ml-auto" />
|
|
33
|
+
<Skeleton className="h-4 w-20" />
|
|
34
|
+
</div>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
: pipelines.length === 0
|
|
39
|
+
? <div className="text-fg-dim italic">no pipelines loaded</div>
|
|
40
|
+
: (
|
|
41
|
+
<>
|
|
42
|
+
{/*
|
|
43
|
+
Mobile-first card list: <sm operators get a stack of
|
|
44
|
+
tap-targets, each with the load-bearing info (id, goal,
|
|
45
|
+
status) and no horizontal scroll. The desktop table
|
|
46
|
+
below is hidden at this breakpoint.
|
|
47
|
+
*/}
|
|
48
|
+
<div className="sm:hidden flex flex-col gap-2">
|
|
49
|
+
{pipelines.map((p) => (
|
|
50
|
+
<a
|
|
51
|
+
key={p.id}
|
|
52
|
+
href={`#/pipelines/${encodeURIComponent(p.id)}`}
|
|
53
|
+
className={cn(
|
|
54
|
+
"block rounded border border-border bg-bg-elev2/30 hover:bg-bg-elev2 px-3 py-2",
|
|
55
|
+
p.historical && "opacity-65 italic",
|
|
56
|
+
)}
|
|
57
|
+
>
|
|
58
|
+
<div className="flex items-baseline gap-2">
|
|
59
|
+
<span className="font-mono text-sm truncate flex-1">{p.id}</span>
|
|
60
|
+
{p.historical
|
|
61
|
+
? <Badge variant="historical">historical</Badge>
|
|
62
|
+
: <span className="text-[10px] font-mono text-fg-dim shrink-0">{p.nodes.length - 2} nodes</span>}
|
|
63
|
+
</div>
|
|
64
|
+
<div className="text-xs text-fg-dim mt-0.5 line-clamp-2">
|
|
65
|
+
{p.historical
|
|
66
|
+
? <>no longer on disk · {p.runs} run{p.runs === 1 ? "" : "s"} in DB</>
|
|
67
|
+
: (p.goal ?? "")}
|
|
68
|
+
</div>
|
|
69
|
+
</a>
|
|
70
|
+
))}
|
|
71
|
+
</div>
|
|
72
|
+
{/* Desktop / tablet table — unchanged. */}
|
|
73
|
+
<div className="hidden sm:block">
|
|
74
|
+
<Table>
|
|
75
|
+
<THead>
|
|
76
|
+
<TR><TH>id</TH><TH>nodes</TH><TH>goal</TH><TH>file</TH><TH>status</TH></TR>
|
|
77
|
+
</THead>
|
|
78
|
+
<TBody>
|
|
79
|
+
{pipelines.map((p) => (
|
|
80
|
+
<TR
|
|
81
|
+
key={p.id}
|
|
82
|
+
className={cn("cursor-pointer hover:bg-bg-elev2", p.historical && "opacity-65 italic")}
|
|
83
|
+
onClick={() => { window.location.hash = `#/pipelines/${encodeURIComponent(p.id)}`; }}
|
|
84
|
+
>
|
|
85
|
+
<TD className="font-mono"><a href={`#/pipelines/${encodeURIComponent(p.id)}`}>{p.id}</a></TD>
|
|
86
|
+
<TD className="text-fg-dim">{p.historical ? "—" : p.nodes.length - 2}</TD>
|
|
87
|
+
<TD className="text-fg-dim">
|
|
88
|
+
{p.historical
|
|
89
|
+
? <span className="text-fg-dim">no longer on disk · {p.runs} run(s) in DB</span>
|
|
90
|
+
: (p.goal ?? "").slice(0, 100)}
|
|
91
|
+
</TD>
|
|
92
|
+
<TD className="font-mono text-fg-dim text-xs">
|
|
93
|
+
{p.historical ? "—" : (p.file ?? "").replace(/^.*\//, "")}
|
|
94
|
+
</TD>
|
|
95
|
+
<TD>
|
|
96
|
+
{p.historical
|
|
97
|
+
? <Badge variant="historical">historical</Badge>
|
|
98
|
+
: <Badge variant="succeeded">implemented</Badge>}
|
|
99
|
+
</TD>
|
|
100
|
+
</TR>
|
|
101
|
+
))}
|
|
102
|
+
</TBody>
|
|
103
|
+
</Table>
|
|
104
|
+
</div>
|
|
105
|
+
</>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
</Card>
|
|
109
|
+
</>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { Fragment, useEffect, useState } from "react";
|
|
2
|
+
import { Card, CardHeader, CardTitle } from "@/components/ui/card";
|
|
3
|
+
import { GraphView } from "@/components/GraphView";
|
|
4
|
+
import { PathTrail } from "@/components/PathTrail";
|
|
5
|
+
import { SubflowsCard } from "@/components/SubflowsCard";
|
|
6
|
+
import { RunComparison } from "@/components/RunComparison";
|
|
7
|
+
import { TranscriptPane } from "@/components/TranscriptPane";
|
|
8
|
+
import { GateForm } from "@/components/GateForm";
|
|
9
|
+
import { CancelButton } from "@/components/CancelButton";
|
|
10
|
+
import { RerunButton } from "@/components/RerunButton";
|
|
11
|
+
import { StatusBadge } from "@/components/StatusBadge";
|
|
12
|
+
import { StateTree } from "@/components/StateTree";
|
|
13
|
+
import { CopyButton } from "@/components/CopyButton";
|
|
14
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
15
|
+
import { api, artifactUrl } from "@/api/client";
|
|
16
|
+
import { useWs } from "@/api/ws";
|
|
17
|
+
import { formatBytes, formatTime } from "@/lib/format";
|
|
18
|
+
import type { ArtifactEntry, SubflowData, FlowRunFull, FlowTreeItem, Pipeline, RunCompare, RunCost, LiveEvent, Transcript } from "@/api/types";
|
|
19
|
+
|
|
20
|
+
export function RunDetail({ flowId }: { flowId: string }) {
|
|
21
|
+
const [run, setRun] = useState<FlowRunFull | null>(null);
|
|
22
|
+
const [pipeline, setPipeline] = useState<Pipeline | null>(null);
|
|
23
|
+
const [events, setEvents] = useState<LiveEvent[]>([]);
|
|
24
|
+
const [artifacts, setArtifacts] = useState<ArtifactEntry[]>([]);
|
|
25
|
+
const [transcripts, setTranscripts] = useState<Transcript[] | null>(null);
|
|
26
|
+
const [compare, setCompare] = useState<RunCompare | null>(null);
|
|
27
|
+
const [cost, setCost] = useState<RunCost | null>(null);
|
|
28
|
+
const [subflows, setSubflows] = useState<Record<string, Record<string, SubflowData>> | null>(null);
|
|
29
|
+
const [tree, setTree] = useState<FlowTreeItem[] | null>(null);
|
|
30
|
+
const [error, setError] = useState<string | null>(null);
|
|
31
|
+
|
|
32
|
+
const loadAll = async () => {
|
|
33
|
+
try {
|
|
34
|
+
const r = await api.run(flowId);
|
|
35
|
+
setRun(r);
|
|
36
|
+
setError(null);
|
|
37
|
+
if (r.pipelineId && (!pipeline || pipeline.id !== r.pipelineId)) {
|
|
38
|
+
api.pipeline(r.pipelineId).then(setPipeline).catch(() => setPipeline(null));
|
|
39
|
+
}
|
|
40
|
+
api.runEvents(flowId).then((evs) => setEvents(evs.slice().reverse())).catch(() => setEvents([]));
|
|
41
|
+
api.runArtifacts(flowId).then(setArtifacts).catch(() => setArtifacts([]));
|
|
42
|
+
api.runTranscripts(flowId).then(setTranscripts).catch(() => setTranscripts([]));
|
|
43
|
+
api.runCompare(flowId).then(setCompare).catch(() => setCompare(null));
|
|
44
|
+
api.runCost(flowId).then(setCost).catch(() => setCost(null));
|
|
45
|
+
api.runSubflows(flowId).then(setSubflows).catch(() => setSubflows(null));
|
|
46
|
+
api.runTree(flowId).then((r) => setTree(r.items)).catch(() => setTree(null));
|
|
47
|
+
} catch (e) {
|
|
48
|
+
setError(e instanceof Error ? e.message : String(e));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
useEffect(() => { loadAll(); /* eslint-disable-line react-hooks/exhaustive-deps */ }, [flowId]);
|
|
53
|
+
|
|
54
|
+
useWs((evt) => {
|
|
55
|
+
if (!("flowId" in evt) || evt.flowId !== flowId) return;
|
|
56
|
+
setEvents((prev) => [evt, ...prev]);
|
|
57
|
+
if (evt.kind !== "run.created") loadAll();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (error) {
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
<a href="#/" className="text-fg-dim">← runs</a>
|
|
64
|
+
<p className="text-status-red mt-2">{error}</p>
|
|
65
|
+
</>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
if (!run) {
|
|
69
|
+
return (
|
|
70
|
+
<>
|
|
71
|
+
<a href="#/" className="text-fg-dim">← runs</a>
|
|
72
|
+
<Skeleton className="h-6 w-80 mt-2 mb-4" />
|
|
73
|
+
<Card>
|
|
74
|
+
<div className="grid grid-cols-[100px_1fr] sm:grid-cols-[140px_1fr] gap-y-2 gap-x-3">
|
|
75
|
+
{[0, 1, 2, 3, 4].map((i) => (
|
|
76
|
+
<Fragment key={i}>
|
|
77
|
+
<Skeleton className="h-3 w-20" />
|
|
78
|
+
<Skeleton className="h-3 w-3/4" />
|
|
79
|
+
</Fragment>
|
|
80
|
+
))}
|
|
81
|
+
</div>
|
|
82
|
+
</Card>
|
|
83
|
+
<Card><Skeleton className="h-4 w-32 mb-3" />{[0, 1, 2, 3].map((i) => <Skeleton key={i} className="h-3 w-full mb-2" />)}</Card>
|
|
84
|
+
<Card><Skeleton className="h-4 w-40 mb-3" /><Skeleton className="h-40 w-full" /></Card>
|
|
85
|
+
</>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
<a href="#/" className="text-fg-dim">← runs</a>
|
|
92
|
+
<div className="flex items-center justify-between gap-3 mt-2 mb-4 flex-wrap">
|
|
93
|
+
<h1 className="font-mono text-lg font-semibold break-all min-w-0">
|
|
94
|
+
{flowId}
|
|
95
|
+
<CopyButton value={flowId} label="copy flowId" className="ml-2" />
|
|
96
|
+
</h1>
|
|
97
|
+
{(run.status === "running" || run.status === "blocked") && (
|
|
98
|
+
<CancelButton flowId={flowId} />
|
|
99
|
+
)}
|
|
100
|
+
{(run.status === "succeeded" || run.status === "failed" || run.status === "cancelled") && (
|
|
101
|
+
<RerunButton flowId={flowId} />
|
|
102
|
+
)}
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<Card>
|
|
106
|
+
<dl className="grid grid-cols-[100px_1fr] sm:grid-cols-[140px_1fr] gap-y-1 gap-x-3 text-sm">
|
|
107
|
+
<dt className="text-fg-dim">pipeline</dt>
|
|
108
|
+
<dd>
|
|
109
|
+
<a href={`#/pipelines/${encodeURIComponent(run.pipelineId ?? "")}`} className="font-mono">{run.pipelineId ?? "?"}</a>
|
|
110
|
+
{run.pipelineId && <CopyButton value={run.pipelineId} label="copy pipelineId" className="ml-2" />}
|
|
111
|
+
</dd>
|
|
112
|
+
<dt className="text-fg-dim">status</dt><dd><StatusBadge status={run.status} /></dd>
|
|
113
|
+
<dt className="text-fg-dim">current step</dt><dd className="font-mono">{run.currentStep ?? "?"}</dd>
|
|
114
|
+
<dt className="text-fg-dim">revision</dt><dd className="font-mono text-fg-dim">{run.revision}</dd>
|
|
115
|
+
<dt className="text-fg-dim">runId</dt>
|
|
116
|
+
<dd className="font-mono text-fg-dim text-xs break-all">
|
|
117
|
+
{run.runId ?? "?"}
|
|
118
|
+
{run.runId && <CopyButton value={run.runId} label="copy runId" className="ml-2" />}
|
|
119
|
+
</dd>
|
|
120
|
+
{cost && cost.total > 0 && (
|
|
121
|
+
<>
|
|
122
|
+
<dt className="text-fg-dim">cost</dt>
|
|
123
|
+
<dd className="font-mono" title={`models: ${Object.keys(cost.byModel).join(", ")} · sessions: ${cost.bySession.length}`}>
|
|
124
|
+
${cost.total.toFixed(4)}
|
|
125
|
+
<span className="text-fg-dim text-xs ml-2">
|
|
126
|
+
{cost.bySession.length} session{cost.bySession.length === 1 ? "" : "s"} · {(cost.tokens.input + cost.tokens.output + cost.tokens.cacheRead).toLocaleString()} tokens
|
|
127
|
+
</span>
|
|
128
|
+
</dd>
|
|
129
|
+
</>
|
|
130
|
+
)}
|
|
131
|
+
<dt className="text-fg-dim">created</dt><dd className="text-fg-dim">{formatTime(run.createdAt)}</dd>
|
|
132
|
+
<dt className="text-fg-dim">updated</dt><dd className="text-fg-dim">{formatTime(run.updatedAt)}</dd>
|
|
133
|
+
{run.endedAt && <><dt className="text-fg-dim">ended</dt><dd className="text-fg-dim">{formatTime(run.endedAt)}</dd></>}
|
|
134
|
+
</dl>
|
|
135
|
+
</Card>
|
|
136
|
+
|
|
137
|
+
<RunComparison compare={compare} run={run} />
|
|
138
|
+
|
|
139
|
+
{run.waitJson && (
|
|
140
|
+
<Card>
|
|
141
|
+
<CardHeader><CardTitle>waiting on {run.waitJson.kind ?? "?"}</CardTitle></CardHeader>
|
|
142
|
+
<dl className="grid grid-cols-[100px_1fr] sm:grid-cols-[140px_1fr] gap-y-1 gap-x-3 text-sm">
|
|
143
|
+
<dt className="text-fg-dim">node</dt><dd className="font-mono">{run.waitJson.nodeId ?? "?"}</dd>
|
|
144
|
+
{run.waitJson.reason && <><dt className="text-fg-dim">reason</dt><dd>{run.waitJson.reason}</dd></>}
|
|
145
|
+
{Array.isArray(run.waitJson.needed) && run.waitJson.needed.length > 0 && <>
|
|
146
|
+
<dt className="text-fg-dim">needed</dt>
|
|
147
|
+
<dd>{run.waitJson.needed.map((n) => <kbd key={n} className="font-mono bg-bg-elev2 border border-border px-1.5 rounded text-xs mr-1">{n}</kbd>)}</dd>
|
|
148
|
+
</>}
|
|
149
|
+
{run.waitJson.hint && <><dt className="text-fg-dim">hint</dt><dd>{run.waitJson.hint}</dd></>}
|
|
150
|
+
{Array.isArray(run.waitJson.pending) && run.waitJson.pending.length > 0 && <>
|
|
151
|
+
<dt className="text-fg-dim">pending</dt>
|
|
152
|
+
<dd>{run.waitJson.pending.map((p, i) => {
|
|
153
|
+
const id = typeof p === "string" ? p : (p as { id?: unknown })?.id;
|
|
154
|
+
const label = typeof id === "string" ? id : `(unnamed-${i})`;
|
|
155
|
+
return <kbd key={`${label}-${i}`} className="font-mono bg-bg-elev2 border border-border px-1.5 rounded text-xs mr-1">{label}</kbd>;
|
|
156
|
+
})}</dd>
|
|
157
|
+
</>}
|
|
158
|
+
</dl>
|
|
159
|
+
{Array.isArray(run.waitJson.pending) && run.waitJson.pending.length > 0 && (
|
|
160
|
+
<GateForm flowId={flowId} pending={run.waitJson.pending as unknown[]} />
|
|
161
|
+
)}
|
|
162
|
+
</Card>
|
|
163
|
+
)}
|
|
164
|
+
|
|
165
|
+
<Card>
|
|
166
|
+
<CardHeader>
|
|
167
|
+
<CardTitle>graph</CardTitle>
|
|
168
|
+
<span className="text-fg-dim font-mono text-xs">current: {run.currentStep ?? "?"}</span>
|
|
169
|
+
</CardHeader>
|
|
170
|
+
{pipeline && <GraphView pipeline={pipeline} run={run} tree={tree} />}
|
|
171
|
+
<PathTrail history={tree?.map((i) => i.nodeId)} />
|
|
172
|
+
</Card>
|
|
173
|
+
|
|
174
|
+
<SubflowsCard subflows={subflows} pipeline={pipeline} transcripts={transcripts} />
|
|
175
|
+
|
|
176
|
+
<TranscriptPane flowId={flowId} transcripts={transcripts} />
|
|
177
|
+
|
|
178
|
+
<div className="flex flex-col lg:flex-row gap-3 lg:gap-5">
|
|
179
|
+
<div className="flex-1 min-w-0">
|
|
180
|
+
<Card>
|
|
181
|
+
<CardHeader><CardTitle>state</CardTitle></CardHeader>
|
|
182
|
+
<StateTree value={run.stateJson} label="state" defaultOpen />
|
|
183
|
+
</Card>
|
|
184
|
+
<Card>
|
|
185
|
+
<CardHeader><CardTitle>errors</CardTitle></CardHeader>
|
|
186
|
+
{(run.errorEntries ?? []).length === 0
|
|
187
|
+
? <div className="text-fg-dim italic">none</div>
|
|
188
|
+
: (
|
|
189
|
+
<div>
|
|
190
|
+
{(run.errorEntries ?? []).slice(-30).map((e, i) => (
|
|
191
|
+
<div key={i} className="py-1 border-b border-dashed border-border last:border-b-0">
|
|
192
|
+
<span className="font-mono text-fg-dim">{e.nodeId}</span> {e.message}
|
|
193
|
+
</div>
|
|
194
|
+
))}
|
|
195
|
+
</div>
|
|
196
|
+
)}
|
|
197
|
+
</Card>
|
|
198
|
+
</div>
|
|
199
|
+
<div className="flex-1 min-w-0">
|
|
200
|
+
<Card>
|
|
201
|
+
<CardHeader><CardTitle>events</CardTitle></CardHeader>
|
|
202
|
+
{events.length === 0
|
|
203
|
+
? <div className="text-fg-dim italic">none yet — events accrue while the dashboard is running</div>
|
|
204
|
+
: (
|
|
205
|
+
<div className="font-mono text-xs max-h-96 overflow-auto">
|
|
206
|
+
{events.map((evt, i) => (
|
|
207
|
+
<div key={i} className="grid grid-cols-[56px_90px_1fr] sm:grid-cols-[80px_110px_1fr] gap-2 py-1 border-b border-dashed border-border last:border-b-0">
|
|
208
|
+
<span className="text-fg-dim">{formatTime((evt as any).at).split(" ")[1] ?? ""}</span>
|
|
209
|
+
<span className={evt.kind === "run.ended" ? "text-status-green" : evt.kind === "run.created" ? "text-status-amber" : "text-accent"}>{evt.kind}</span>
|
|
210
|
+
<span>{formatEventBody(evt)}</span>
|
|
211
|
+
</div>
|
|
212
|
+
))}
|
|
213
|
+
</div>
|
|
214
|
+
)}
|
|
215
|
+
</Card>
|
|
216
|
+
<Card>
|
|
217
|
+
<CardHeader><CardTitle>artifacts</CardTitle></CardHeader>
|
|
218
|
+
{artifacts.length === 0
|
|
219
|
+
? <div className="text-fg-dim italic">none</div>
|
|
220
|
+
: artifacts.map((a) => (
|
|
221
|
+
<div key={a.name} className="flex justify-between py-1">
|
|
222
|
+
<a href={artifactUrl(flowId, a.name)} target="_blank" rel="noreferrer" className="font-mono">{a.name}</a>
|
|
223
|
+
<span className="text-fg-dim">{formatBytes(a.size)}</span>
|
|
224
|
+
</div>
|
|
225
|
+
))}
|
|
226
|
+
</Card>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
</>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function formatEventBody(evt: LiveEvent): string {
|
|
234
|
+
switch (evt.kind) {
|
|
235
|
+
case "run.created": return `created at ${evt.currentStep ?? "?"} (${evt.status})`;
|
|
236
|
+
case "run.ended": return `terminated (${evt.status})`;
|
|
237
|
+
case "run.updated": {
|
|
238
|
+
const step = evt.prevStep !== evt.currStep ? `step ${evt.prevStep ?? "?"} → ${evt.currStep ?? "?"}` : `rev ${evt.revision}`;
|
|
239
|
+
const status = evt.prevStatus !== evt.currStatus ? ` · ${evt.prevStatus} → ${evt.currStatus}` : "";
|
|
240
|
+
const keys = (evt.stateKeysAdded?.length || evt.stateKeysRemoved?.length)
|
|
241
|
+
? ` · keys ${(evt.stateKeysAdded ?? []).map((k) => `+${k}`).join(" ")} ${(evt.stateKeysRemoved ?? []).map((k) => `-${k}`).join(" ")}`
|
|
242
|
+
: "";
|
|
243
|
+
const wait = evt.waitKind ? ` · ${evt.waitKind}` : "";
|
|
244
|
+
return `${step}${status}${keys}${wait}`;
|
|
245
|
+
}
|
|
246
|
+
case "pipeline.catalog.updated": return `pipelines: ${evt.ids.join(", ")}`;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// Deep search across runs — covers structured fields, state.errors[],
|
|
2
|
+
// and top-level state JSON keys. See dashboard/search.js for the
|
|
3
|
+
// indexed surface. Query lives in the URL hash (`#/search?q=...`) so
|
|
4
|
+
// results are sharable and survive refresh.
|
|
5
|
+
|
|
6
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { Card, CardHeader, CardTitle } from "@/components/ui/card";
|
|
8
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
9
|
+
import { StatusBadge } from "@/components/StatusBadge";
|
|
10
|
+
import { ClickToCopy } from "@/components/ClickToCopy";
|
|
11
|
+
import { api } from "@/api/client";
|
|
12
|
+
import type { SearchResponse } from "@/api/types";
|
|
13
|
+
|
|
14
|
+
function fmtRel(ts: number | null): string {
|
|
15
|
+
if (!ts) return "";
|
|
16
|
+
const d = Date.now() - ts;
|
|
17
|
+
if (d < 60_000) return `${Math.floor(d / 1000)}s ago`;
|
|
18
|
+
if (d < 3_600_000) return `${Math.floor(d / 60_000)}m ago`;
|
|
19
|
+
if (d < 86_400_000) return `${Math.floor(d / 3_600_000)}h ago`;
|
|
20
|
+
return `${Math.floor(d / 86_400_000)}d ago`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function readHashState(): { q: string; status: string } {
|
|
24
|
+
const hash = window.location.hash || "";
|
|
25
|
+
const i = hash.indexOf("?");
|
|
26
|
+
if (i < 0) return { q: "", status: "" };
|
|
27
|
+
const params = new URLSearchParams(hash.slice(i + 1));
|
|
28
|
+
return { q: params.get("q") ?? "", status: params.get("status") ?? "" };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function writeHashState({ q, status }: { q: string; status: string }) {
|
|
32
|
+
const qp = new URLSearchParams();
|
|
33
|
+
if (q) qp.set("q", q);
|
|
34
|
+
if (status) qp.set("status", status);
|
|
35
|
+
const next = qp.toString() ? `#/search?${qp.toString()}` : "#/search";
|
|
36
|
+
if (window.location.hash !== next) window.history.replaceState(null, "", next);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function Search() {
|
|
40
|
+
const initial = readHashState();
|
|
41
|
+
const [draft, setDraft] = useState<string>(initial.q);
|
|
42
|
+
const [committed, setCommitted] = useState<string>(initial.q);
|
|
43
|
+
// Structured status filter — applied server-side, exact equality.
|
|
44
|
+
// Reads from `?status=…` so deep links from elsewhere (PipelineDetail's
|
|
45
|
+
// RUNS sub-counts) hydrate the filter on first load.
|
|
46
|
+
const [status, setStatus] = useState<string>(initial.status);
|
|
47
|
+
const [result, setResult] = useState<SearchResponse | null>(null);
|
|
48
|
+
const [loading, setLoading] = useState(false);
|
|
49
|
+
const [error, setError] = useState<string | null>(null);
|
|
50
|
+
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
51
|
+
|
|
52
|
+
// Debounce keystrokes → committed query → fetch. 200ms feels live but
|
|
53
|
+
// doesn't fire on every character; matches the home-filter cadence.
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
const t = setTimeout(() => setCommitted(draft.trim()), 200);
|
|
56
|
+
return () => clearTimeout(t);
|
|
57
|
+
}, [draft]);
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
writeHashState({ q: committed, status });
|
|
61
|
+
if (!committed && !status) { setResult(null); setError(null); return; }
|
|
62
|
+
setLoading(true);
|
|
63
|
+
setError(null);
|
|
64
|
+
let cancelled = false;
|
|
65
|
+
api.search(committed, { limit: 100, status })
|
|
66
|
+
.then((r) => { if (!cancelled) setResult(r); })
|
|
67
|
+
.catch((e) => { if (!cancelled) setError(e?.message ?? String(e)); })
|
|
68
|
+
.finally(() => { if (!cancelled) setLoading(false); });
|
|
69
|
+
return () => { cancelled = true; };
|
|
70
|
+
}, [committed, status]);
|
|
71
|
+
|
|
72
|
+
// Focus on mount — primary verb for this page is typing a query.
|
|
73
|
+
useEffect(() => { inputRef.current?.focus(); }, []);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
<h1 className="font-mono mt-2 text-lg font-semibold">search</h1>
|
|
78
|
+
<Card>
|
|
79
|
+
<input
|
|
80
|
+
ref={inputRef}
|
|
81
|
+
type="search"
|
|
82
|
+
value={draft}
|
|
83
|
+
onChange={(e) => setDraft(e.target.value)}
|
|
84
|
+
placeholder="search errors, state, IDs… (e.g. 'shortlist budget' — all tokens must match)"
|
|
85
|
+
className="w-full bg-bg border border-border rounded px-3 py-2 text-sm font-mono outline-none focus:border-accent"
|
|
86
|
+
autoComplete="off"
|
|
87
|
+
/>
|
|
88
|
+
{status && (
|
|
89
|
+
<div className="mt-2 flex items-center gap-2 text-xs font-mono">
|
|
90
|
+
<span className="text-fg-dim">status:</span>
|
|
91
|
+
<span className="inline-flex items-center gap-1.5 bg-bg-elev2 text-fg border border-border rounded-[10px] px-2 py-0.5">
|
|
92
|
+
{status}
|
|
93
|
+
<button
|
|
94
|
+
type="button"
|
|
95
|
+
onClick={() => setStatus("")}
|
|
96
|
+
className="text-fg-dim hover:text-fg"
|
|
97
|
+
aria-label="clear status filter"
|
|
98
|
+
title="clear status filter"
|
|
99
|
+
>
|
|
100
|
+
×
|
|
101
|
+
</button>
|
|
102
|
+
</span>
|
|
103
|
+
</div>
|
|
104
|
+
)}
|
|
105
|
+
<SearchHelp />
|
|
106
|
+
</Card>
|
|
107
|
+
|
|
108
|
+
{error && <p className="text-status-red text-sm">{error}</p>}
|
|
109
|
+
|
|
110
|
+
{!committed && !status && !error && (
|
|
111
|
+
<p className="italic text-fg-dim text-sm">enter a query to begin.</p>
|
|
112
|
+
)}
|
|
113
|
+
|
|
114
|
+
{(committed || status) && loading && !result && (
|
|
115
|
+
<div className="space-y-2 mt-2">
|
|
116
|
+
{[0, 1, 2, 3].map((i) => (
|
|
117
|
+
<Card key={i} className="mb-0">
|
|
118
|
+
<Skeleton className="h-3 w-40 mb-2" />
|
|
119
|
+
<Skeleton className="h-3 w-full mb-1" />
|
|
120
|
+
<Skeleton className="h-3 w-2/3" />
|
|
121
|
+
</Card>
|
|
122
|
+
))}
|
|
123
|
+
</div>
|
|
124
|
+
)}
|
|
125
|
+
|
|
126
|
+
{result && <Results result={result} />}
|
|
127
|
+
</>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function SearchHelp() {
|
|
132
|
+
return (
|
|
133
|
+
<p className="text-xs text-fg-dim mt-2">
|
|
134
|
+
Tokens must all appear (AND). Searched: flowId, pipelineId, status, currentStep, statusReason, goal,
|
|
135
|
+
waitJson hint/reason, state.errors[*], and top-level state.* values. Not searched (yet): agent transcripts.
|
|
136
|
+
</p>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function Results({ result }: { result: SearchResponse }) {
|
|
141
|
+
const summary = useMemo(() => {
|
|
142
|
+
if (result.totalHits === 0) return "no matches.";
|
|
143
|
+
const shown = result.hits.length;
|
|
144
|
+
const total = result.totalHits;
|
|
145
|
+
if (result.truncated) return `${shown} of ${total} matches (showing most-recent ${shown}). refine to narrow.`;
|
|
146
|
+
return `${total} match${total === 1 ? "" : "es"}.`;
|
|
147
|
+
}, [result]);
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Card>
|
|
151
|
+
<CardHeader><CardTitle>results — {summary}</CardTitle></CardHeader>
|
|
152
|
+
{result.hits.length === 0 ? (
|
|
153
|
+
<p className="italic text-fg-dim text-sm">try a shorter query, drop a token, or check for typos.</p>
|
|
154
|
+
) : (
|
|
155
|
+
<ul className="flex flex-col gap-3">
|
|
156
|
+
{result.hits.map((h) => (
|
|
157
|
+
<li
|
|
158
|
+
key={h.flowId}
|
|
159
|
+
className="border border-border rounded p-2 cursor-pointer hover:bg-bg-elev2"
|
|
160
|
+
onClick={() => { window.location.hash = `#/runs/${h.flowId}`; }}
|
|
161
|
+
>
|
|
162
|
+
<div className="flex flex-wrap items-baseline gap-x-3 gap-y-1 text-sm">
|
|
163
|
+
<ClickToCopy value={h.flowId} label="copy flowId" className="font-mono text-fg">
|
|
164
|
+
{h.flowId.slice(0, 12)}…
|
|
165
|
+
</ClickToCopy>
|
|
166
|
+
<StatusBadge status={h.status} />
|
|
167
|
+
{h.pipelineId && (
|
|
168
|
+
<a
|
|
169
|
+
href={`#/pipelines/${encodeURIComponent(h.pipelineId)}`}
|
|
170
|
+
onClick={(e) => e.stopPropagation()}
|
|
171
|
+
className="font-mono text-xs text-fg-dim hover:text-fg hover:underline"
|
|
172
|
+
>
|
|
173
|
+
{h.pipelineId}
|
|
174
|
+
</a>
|
|
175
|
+
)}
|
|
176
|
+
{h.currentStep && <span className="font-mono text-xs text-fg-dim">@ {h.currentStep}</span>}
|
|
177
|
+
<span className="text-xs text-fg-dim ml-auto">{fmtRel(h.updatedAt)}</span>
|
|
178
|
+
</div>
|
|
179
|
+
<ul className="mt-2 flex flex-col gap-1">
|
|
180
|
+
{h.matches.slice(0, 5).map((m, i) => (
|
|
181
|
+
<li key={i} className="font-mono text-xs leading-snug">
|
|
182
|
+
<span className="text-fg-dim">{m.field}:</span>{" "}
|
|
183
|
+
<span className="text-fg">{m.snippet}</span>
|
|
184
|
+
</li>
|
|
185
|
+
))}
|
|
186
|
+
{h.matches.length > 5 && (
|
|
187
|
+
<li className="text-xs text-fg-dim italic">… {h.matches.length - 5} more match{h.matches.length - 5 === 1 ? "" : "es"} in this run.</li>
|
|
188
|
+
)}
|
|
189
|
+
</ul>
|
|
190
|
+
</li>
|
|
191
|
+
))}
|
|
192
|
+
</ul>
|
|
193
|
+
)}
|
|
194
|
+
</Card>
|
|
195
|
+
);
|
|
196
|
+
}
|