@igorjpimenta/manifold 0.0.0-bootstrap.1 → 0.0.0-stage
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/README.md +2 -1583
- package/package.json +4 -49
- package/.migrations/ops/0000_futuristic_karma.sql +0 -111
- package/.migrations/ops/0001_low_maximus.sql +0 -7
- package/.migrations/ops/meta/0000_snapshot.json +0 -763
- package/.migrations/ops/meta/0001_snapshot.json +0 -173
- package/.migrations/ops/meta/_journal.json +0 -20
- package/.migrations/runtime/0000_real_boomer.sql +0 -180
- package/.migrations/runtime/0001_hot_dakota_north.sql +0 -2
- package/.migrations/runtime/0002_breezy_vertigo.sql +0 -8
- package/.migrations/runtime/0003_dashing_jack_flag.sql +0 -5
- package/.migrations/runtime/0004_panoramic_ego.sql +0 -1
- package/.migrations/runtime/0005_tidy_ben_grimm.sql +0 -10
- package/.migrations/runtime/0006_wet_nightmare.sql +0 -57
- package/.migrations/runtime/0007_ambiguous_chronomancer.sql +0 -8
- package/.migrations/runtime/0008_wealthy_thundra.sql +0 -301
- package/.migrations/runtime/0009_lying_shocker.sql +0 -96
- package/.migrations/runtime/0010_solid_phantom_reporter.sql +0 -160
- package/.migrations/runtime/0011_windy_demogoblin.sql +0 -175
- package/.migrations/runtime/0012_restore_harness_fks.sql +0 -103
- package/.migrations/runtime/meta/0000_snapshot.json +0 -1181
- package/.migrations/runtime/meta/0001_snapshot.json +0 -1209
- package/.migrations/runtime/meta/0002_snapshot.json +0 -1261
- package/.migrations/runtime/meta/0003_snapshot.json +0 -1292
- package/.migrations/runtime/meta/0004_snapshot.json +0 -1240
- package/.migrations/runtime/meta/0006_snapshot.json +0 -1310
- package/.migrations/runtime/meta/0007_snapshot.json +0 -1362
- package/.migrations/runtime/meta/0008_snapshot.json +0 -1742
- package/.migrations/runtime/meta/0009_snapshot.json +0 -2413
- package/.migrations/runtime/meta/0010_snapshot.json +0 -2562
- package/.migrations/runtime/meta/0011_snapshot.json +0 -2812
- package/.migrations/runtime/meta/0012_snapshot.json +0 -2812
- package/.migrations/runtime/meta/_journal.json +0 -97
- package/RELEASING.md +0 -89
- package/agent/fleet.js +0 -100
- package/bin/cli.js +0 -854
- package/bin/manifold.js +0 -4
- package/boot/flow-revival.js +0 -536
- package/budget/index.js +0 -495
- package/budget/lib.js +0 -59
- package/dashboard/cost.js +0 -528
- package/dashboard/dist/assets/index-CUfp63sj.css +0 -1
- package/dashboard/dist/assets/index-Qy9JMpma.js +0 -371
- package/dashboard/dist/index.html +0 -13
- package/dashboard/event-log.js +0 -267
- package/dashboard/index.html +0 -12
- package/dashboard/package-lock.json +0 -2877
- package/dashboard/package.json +0 -37
- package/dashboard/pipeline-graph.js +0 -131
- package/dashboard/postcss.config.js +0 -6
- package/dashboard/search.js +0 -183
- package/dashboard/server.js +0 -1015
- package/dashboard/src/App.tsx +0 -42
- package/dashboard/src/api/client.ts +0 -118
- package/dashboard/src/api/types.ts +0 -510
- package/dashboard/src/api/ws.tsx +0 -112
- package/dashboard/src/components/CancelButton.tsx +0 -63
- package/dashboard/src/components/ClickToCopy.tsx +0 -68
- package/dashboard/src/components/CopyButton.tsx +0 -61
- package/dashboard/src/components/DailyCostTrend.tsx +0 -85
- package/dashboard/src/components/DailyTimeTrend.tsx +0 -94
- package/dashboard/src/components/Funnel.tsx +0 -149
- package/dashboard/src/components/GateForm.tsx +0 -158
- package/dashboard/src/components/GraphView.tsx +0 -302
- package/dashboard/src/components/GroupPathsSummary.tsx +0 -47
- package/dashboard/src/components/Histogram.tsx +0 -292
- package/dashboard/src/components/Layout.tsx +0 -28
- package/dashboard/src/components/NeedsAttention.tsx +0 -98
- package/dashboard/src/components/NodeContextCard.tsx +0 -132
- package/dashboard/src/components/PathTrail.tsx +0 -35
- package/dashboard/src/components/PipelineCostBreakdown.tsx +0 -277
- package/dashboard/src/components/RerunButton.tsx +0 -46
- package/dashboard/src/components/RunComparison.tsx +0 -53
- package/dashboard/src/components/Sparkline.tsx +0 -94
- package/dashboard/src/components/StatStrip.tsx +0 -147
- package/dashboard/src/components/StateTree.tsx +0 -84
- package/dashboard/src/components/StatusBadge.tsx +0 -18
- package/dashboard/src/components/SubflowPathPills.tsx +0 -38
- package/dashboard/src/components/SubflowSummary.tsx +0 -24
- package/dashboard/src/components/SubflowsCard.tsx +0 -327
- package/dashboard/src/components/TodayStrip.tsx +0 -86
- package/dashboard/src/components/TranscriptPane.tsx +0 -99
- package/dashboard/src/components/TranscriptRow.tsx +0 -69
- package/dashboard/src/components/ui/badge.tsx +0 -38
- package/dashboard/src/components/ui/button.tsx +0 -28
- package/dashboard/src/components/ui/card.tsx +0 -42
- package/dashboard/src/components/ui/skeleton.tsx +0 -9
- package/dashboard/src/components/ui/table.tsx +0 -62
- package/dashboard/src/index.css +0 -26
- package/dashboard/src/lib/anomaly.ts +0 -42
- package/dashboard/src/lib/format.ts +0 -30
- package/dashboard/src/lib/step-history.ts +0 -13
- package/dashboard/src/lib/subflow.ts +0 -154
- package/dashboard/src/lib/use-click-outside.ts +0 -28
- package/dashboard/src/lib/use-ignored-clusters.ts +0 -67
- package/dashboard/src/lib/utils.ts +0 -6
- package/dashboard/src/main.tsx +0 -10
- package/dashboard/src/types/shims.d.ts +0 -4
- package/dashboard/src/views/Home.tsx +0 -478
- package/dashboard/src/views/PipelineDetail.tsx +0 -1185
- package/dashboard/src/views/PipelinesList.tsx +0 -111
- package/dashboard/src/views/RunDetail.tsx +0 -248
- package/dashboard/src/views/Search.tsx +0 -196
- package/dashboard/stats.js +0 -668
- package/dashboard/tailwind.config.ts +0 -43
- package/dashboard/tree-stats.js +0 -12
- package/dashboard/tsconfig.json +0 -25
- package/dashboard/views.js +0 -231
- package/dashboard/vite.config.ts +0 -34
- package/drizzle.config.js +0 -12
- package/drizzle.config.ops.js +0 -12
- package/elevation.js +0 -116
- package/engine/admission-promotion-resume.js +0 -127
- package/engine/agent-dispatch.js +0 -64
- package/engine/child-resume-trigger.js +0 -315
- package/engine/executor-budget.js +0 -87
- package/engine/executor-cancel.js +0 -83
- package/engine/executor-errors.js +0 -122
- package/engine/executor-helpers.js +0 -254
- package/engine/executor-nodes.js +0 -292
- package/engine/executor-persist.js +0 -212
- package/engine/executor-subflow-children.js +0 -275
- package/engine/executor.js +0 -1013
- package/engine/global-concurrency.js +0 -33
- package/engine/loader.js +0 -528
- package/engine/needs-resolver.js +0 -229
- package/engine/pipelines-watcher.js +0 -133
- package/engine/result-replay.js +0 -34
- package/engine/revival-messages.js +0 -11
- package/engine/spawn-child.js +0 -55
- package/engine/wait-for-flow-settlement.js +0 -109
- package/events/catalog.js +0 -26
- package/events/emit.js +0 -44
- package/events/kinds.js +0 -118
- package/events/serve-ws.js +0 -74
- package/events/stream.js +0 -35
- package/events/ws-dialog.js +0 -257
- package/events/ws-frame.js +0 -194
- package/events/ws-run-events.js +0 -70
- package/events.js +0 -32
- package/gates/gate-resolver.js +0 -576
- package/gates/paused-flows.js +0 -55
- package/graphql/columns.js +0 -67
- package/graphql/schema.js +0 -333
- package/index.js +0 -49
- package/mcp/http.js +0 -159
- package/mcp/identity.js +0 -94
- package/mcp/stdio.js +0 -80
- package/mcp/tools.js +0 -245
- package/mcp/wire-ops.js +0 -178
- package/routes/bearer-auth.js +0 -57
- package/routes/discuss-audio.js +0 -87
- package/routes/discuss-component.js +0 -39
- package/routes/discuss-draft.js +0 -159
- package/routes/discuss-helpers.js +0 -20
- package/routes/discuss.js +0 -848
- package/routes/failures.js +0 -104
- package/routes/graphql.js +0 -61
- package/routes/health.js +0 -54
- package/routes/operator-discuss.js +0 -193
- package/routes/operator-resume.js +0 -32
- package/routes/operator-retry.js +0 -301
- package/routes/operator.js +0 -539
- package/routes/pipelines.js +0 -118
- package/routes/runs.js +0 -1129
- package/scripts/ci/import-check.mjs +0 -50
- package/scripts/link-core-self.mjs +0 -31
- package/scripts/with-guard.sh +0 -24
- package/server/app.js +0 -503
- package/server/registry.js +0 -53
- package/server/serve.js +0 -163
- package/state/admission-queue-store.js +0 -325
- package/state/attribution-registries.js +0 -102
- package/state/batch-writer.js +0 -162
- package/state/db-guard.js +0 -63
- package/state/db-health.js +0 -27
- package/state/db.js +0 -122
- package/state/discuss-store.js +0 -299
- package/state/failure-store.js +0 -427
- package/state/migrate.js +0 -104
- package/state/node-cost.js +0 -67
- package/state/node-executions.js +0 -775
- package/state/node-health-store.js +0 -124
- package/state/ops-merge.js +0 -93
- package/state/paths.js +0 -146
- package/state/pipeline-dirs.js +0 -99
- package/state/pipeline-registry.js +0 -449
- package/state/run-store.js +0 -697
- package/state/schema.js +0 -438
- package/state/schema.ops.js +0 -44
- package/state/session-index.js +0 -177
- package/state/session-keys.js +0 -39
- package/state/state-store.js +0 -311
- package/state/subflow-state.js +0 -126
- package/state/tool-handoff.js +0 -169
- package/telemetry/budget-alert.js +0 -353
- package/telemetry/cli.js +0 -331
- package/telemetry/grammar.js +0 -119
- package/telemetry/http-budget.js +0 -132
- package/telemetry/http-cost.js +0 -670
- package/telemetry/http-helpers.js +0 -134
- package/telemetry/http-tree.js +0 -349
- package/telemetry/http.js +0 -44
- package/telemetry/index.js +0 -307
- package/telemetry/ingest.js +0 -134
- package/telemetry/labels.js +0 -115
- package/telemetry/pricer.js +0 -77
- package/telemetry/resolver.js +0 -314
- package/telemetry/store.js +0 -147
- package/utils/run-patch.js +0 -43
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// localStorage-backed suppression state for failure clusters.
|
|
2
|
-
//
|
|
3
|
-
// Cluster key = `${pipelineId}::${step}`. Per-signature suppression
|
|
4
|
-
// would be more precise but adds UI surface area; start coarse and
|
|
5
|
-
// only refine if the operator hits noise on novel signatures within
|
|
6
|
-
// a step they've already silenced. Per-browser by design — the
|
|
7
|
-
// dashboard is a personal tool and a Mac-vs-phone split between
|
|
8
|
-
// "what I've triaged" is fine.
|
|
9
|
-
|
|
10
|
-
import { useCallback, useEffect, useState } from "react";
|
|
11
|
-
|
|
12
|
-
const STORAGE_KEY = "gf-ignored-clusters-v1";
|
|
13
|
-
|
|
14
|
-
export type IgnoredMap = Record<string, { at: number }>;
|
|
15
|
-
|
|
16
|
-
function read(): IgnoredMap {
|
|
17
|
-
try {
|
|
18
|
-
const raw = localStorage.getItem(STORAGE_KEY);
|
|
19
|
-
if (!raw) return {};
|
|
20
|
-
const parsed = JSON.parse(raw);
|
|
21
|
-
return parsed && typeof parsed === "object" ? parsed : {};
|
|
22
|
-
} catch {
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function write(next: IgnoredMap) {
|
|
28
|
-
try { localStorage.setItem(STORAGE_KEY, JSON.stringify(next)); } catch {}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function clusterKey(pipelineId: string | undefined | null, step: string): string {
|
|
32
|
-
return `${pipelineId ?? "?"}::${step}`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function useIgnoredClusters() {
|
|
36
|
-
const [ignored, setIgnored] = useState<IgnoredMap>(() => read());
|
|
37
|
-
|
|
38
|
-
// Cross-tab sync: if the same browser has the dashboard open in two
|
|
39
|
-
// tabs, ignoring in one should reflect in the other.
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
function onStorage(e: StorageEvent) {
|
|
42
|
-
if (e.key !== STORAGE_KEY) return;
|
|
43
|
-
setIgnored(read());
|
|
44
|
-
}
|
|
45
|
-
window.addEventListener("storage", onStorage);
|
|
46
|
-
return () => window.removeEventListener("storage", onStorage);
|
|
47
|
-
}, []);
|
|
48
|
-
|
|
49
|
-
const ignore = useCallback((key: string) => {
|
|
50
|
-
setIgnored((prev) => {
|
|
51
|
-
const next = { ...prev, [key]: { at: Date.now() } };
|
|
52
|
-
write(next);
|
|
53
|
-
return next;
|
|
54
|
-
});
|
|
55
|
-
}, []);
|
|
56
|
-
|
|
57
|
-
const unignore = useCallback((key: string) => {
|
|
58
|
-
setIgnored((prev) => {
|
|
59
|
-
const next = { ...prev };
|
|
60
|
-
delete next[key];
|
|
61
|
-
write(next);
|
|
62
|
-
return next;
|
|
63
|
-
});
|
|
64
|
-
}, []);
|
|
65
|
-
|
|
66
|
-
return { ignored, ignore, unignore };
|
|
67
|
-
}
|
package/dashboard/src/main.tsx
DELETED
|
@@ -1,478 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from "react";
|
|
2
|
-
import { Card, CardHeader, CardTitle } from "@/components/ui/card";
|
|
3
|
-
import { Button } from "@/components/ui/button";
|
|
4
|
-
import { Table, THead, TBody, TR, TH, TD } from "@/components/ui/table";
|
|
5
|
-
import { StatusBadge } from "@/components/StatusBadge";
|
|
6
|
-
import { StatStrip } from "@/components/StatStrip";
|
|
7
|
-
import { Sparkline } from "@/components/Sparkline";
|
|
8
|
-
import { Histogram } from "@/components/Histogram";
|
|
9
|
-
import { PipelineCostBreakdown } from "@/components/PipelineCostBreakdown";
|
|
10
|
-
import { DailyCostTrend } from "@/components/DailyCostTrend";
|
|
11
|
-
import { DailyTimeTrend } from "@/components/DailyTimeTrend";
|
|
12
|
-
import { Skeleton } from "@/components/ui/skeleton";
|
|
13
|
-
import { TodayStrip, estimateLast24hSpent, DAY_MS as TODAY_DAY_MS } from "@/components/TodayStrip";
|
|
14
|
-
import { formatDuration } from "@/lib/format";
|
|
15
|
-
import { SubflowSummary } from "@/components/SubflowSummary";
|
|
16
|
-
import { NeedsAttention } from "@/components/NeedsAttention";
|
|
17
|
-
import { ClickToCopy } from "@/components/ClickToCopy";
|
|
18
|
-
import { api } from "@/api/client";
|
|
19
|
-
import { useWs } from "@/api/ws";
|
|
20
|
-
import { formatTime } from "@/lib/format";
|
|
21
|
-
import { cn } from "@/lib/utils";
|
|
22
|
-
import type { AllPipelinesCost, FlowRunSummary, GlobalStats, Pipeline } from "@/api/types";
|
|
23
|
-
|
|
24
|
-
// "waiting" is never actually written anywhere (confirmed repo-wide) — gate
|
|
25
|
-
// pauses are always persisted as "blocked" — so it's not offered as a filter.
|
|
26
|
-
const STATUS_FILTERS = ["", "running", "blocked", "succeeded", "failed", "cancelled"] as const;
|
|
27
|
-
const RANGES = { all: null, "1h": 3_600_000, "24h": 86_400_000, "7d": 604_800_000, "30d": 2_592_000_000 } as const;
|
|
28
|
-
type RangeKey = keyof typeof RANGES;
|
|
29
|
-
|
|
30
|
-
// Filter state lives in the URL hash query so a filtered view is shareable
|
|
31
|
-
// and survives a refresh. The route prefix is `#/` (Home); anything after
|
|
32
|
-
// `?` is parsed as query params.
|
|
33
|
-
function readHashFilters() {
|
|
34
|
-
const hash = window.location.hash || "#/";
|
|
35
|
-
const qIdx = hash.indexOf("?");
|
|
36
|
-
const qs = qIdx >= 0 ? hash.slice(qIdx + 1) : "";
|
|
37
|
-
const params = new URLSearchParams(qs);
|
|
38
|
-
const range = (params.get("range") ?? "all") as RangeKey;
|
|
39
|
-
return {
|
|
40
|
-
status: params.get("status") ?? "",
|
|
41
|
-
pipeline: params.get("pipeline") ?? "",
|
|
42
|
-
range: (range in RANGES) ? range : "all" as RangeKey,
|
|
43
|
-
query: params.get("q") ?? "",
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function writeHashFilters(f: { status: string; pipeline: string; range: RangeKey; query: string }) {
|
|
48
|
-
const params = new URLSearchParams();
|
|
49
|
-
if (f.status) params.set("status", f.status);
|
|
50
|
-
if (f.pipeline) params.set("pipeline", f.pipeline);
|
|
51
|
-
if (f.range !== "all") params.set("range", f.range);
|
|
52
|
-
if (f.query) params.set("q", f.query);
|
|
53
|
-
const qs = params.toString();
|
|
54
|
-
const next = qs ? `#/?${qs}` : "#/";
|
|
55
|
-
if (next !== window.location.hash) window.history.replaceState(null, "", next);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function Home() {
|
|
59
|
-
const [stats, setStats] = useState<GlobalStats | null>(null);
|
|
60
|
-
// Nullable until first fetch lands — lets the skeleton distinguish
|
|
61
|
-
// "still loading" from "loaded, empty" (which renders the existing
|
|
62
|
-
// empty-state copy instead of a placeholder).
|
|
63
|
-
const [pipelines, setPipelines] = useState<Pipeline[] | null>(null);
|
|
64
|
-
const [pipelinesCost, setPipelinesCost] = useState<AllPipelinesCost | null>(null);
|
|
65
|
-
const [runs, setRuns] = useState<FlowRunSummary[] | null>(null);
|
|
66
|
-
// Unfiltered recent window feeds NeedsAttention so the strip reflects
|
|
67
|
-
// system-level signals (stuck / failed) regardless of the table filters.
|
|
68
|
-
const [allRecent, setAllRecent] = useState<FlowRunSummary[] | null>(null);
|
|
69
|
-
// Day pinned on the runs/day Sparkline → filters the runs table to
|
|
70
|
-
// that UTC calendar day. Drop-in extension of the existing filter
|
|
71
|
-
// chain; range/status/pipeline/query all still apply on top.
|
|
72
|
-
const [pinnedDay, setPinnedDay] = useState<string | null>(null);
|
|
73
|
-
const initial = readHashFilters();
|
|
74
|
-
const [status, setStatus] = useState<string>(initial.status);
|
|
75
|
-
const [pipeline, setPipeline] = useState<string>(initial.pipeline);
|
|
76
|
-
const [range, setRange] = useState<RangeKey>(initial.range);
|
|
77
|
-
const [query, setQuery] = useState<string>(initial.query);
|
|
78
|
-
|
|
79
|
-
const loadStats = () => { api.stats().then(setStats); };
|
|
80
|
-
const loadPipelines = () => { api.pipelines().then(setPipelines); };
|
|
81
|
-
// When a day is pinned, scope the fetch to that UTC day so older
|
|
82
|
-
// days (outside the default top-200-by-updatedAt window) populate.
|
|
83
|
-
// Without this, pinning a 7-day-old day on the chart shows N>0 on
|
|
84
|
-
// the bar but an empty table — the runs simply weren't fetched.
|
|
85
|
-
const loadRuns = () => {
|
|
86
|
-
const params: { status?: string; pipelineId?: string; limit?: number; since?: number; until?: number } = {
|
|
87
|
-
status, pipelineId: pipeline || undefined, limit: 200,
|
|
88
|
-
};
|
|
89
|
-
if (pinnedDay) {
|
|
90
|
-
const lo = Date.UTC(
|
|
91
|
-
Number(pinnedDay.slice(0, 4)),
|
|
92
|
-
Number(pinnedDay.slice(5, 7)) - 1,
|
|
93
|
-
Number(pinnedDay.slice(8, 10)),
|
|
94
|
-
);
|
|
95
|
-
params.since = lo;
|
|
96
|
-
params.until = lo + 86_400_000;
|
|
97
|
-
params.limit = 1000;
|
|
98
|
-
}
|
|
99
|
-
api.runs(params).then(setRuns);
|
|
100
|
-
};
|
|
101
|
-
const loadRecent = () => { api.runs({ limit: 200 }).then(setAllRecent); };
|
|
102
|
-
// Cost roll-up walks session JSONLs per run — slow at scale, so we
|
|
103
|
-
// refresh only on mount + on pipeline.catalog.updated (rare). Visiting the
|
|
104
|
-
// detail page hydrates the same data fresh.
|
|
105
|
-
const loadPipelinesCost = () => { api.allPipelinesCost(30).then(setPipelinesCost).catch(() => setPipelinesCost(null)); };
|
|
106
|
-
|
|
107
|
-
useEffect(() => { loadStats(); loadPipelines(); loadRecent(); loadPipelinesCost(); }, []);
|
|
108
|
-
useEffect(() => {
|
|
109
|
-
writeHashFilters({ status, pipeline, range, query });
|
|
110
|
-
loadRuns();
|
|
111
|
-
/* eslint-disable-line react-hooks/exhaustive-deps */
|
|
112
|
-
}, [status, pipeline, range, query, pinnedDay]);
|
|
113
|
-
|
|
114
|
-
useWs((evt) => {
|
|
115
|
-
if (evt.kind === "run.created" || evt.kind === "run.updated" || evt.kind === "run.ended") {
|
|
116
|
-
loadRuns();
|
|
117
|
-
loadRecent();
|
|
118
|
-
loadStats();
|
|
119
|
-
} else if (evt.kind === "pipeline.catalog.updated") {
|
|
120
|
-
loadPipelines();
|
|
121
|
-
loadPipelinesCost();
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
// Date range + free-text are applied client-side over the already-fetched
|
|
126
|
-
// 200-row window (status + pipeline are pushed to the server). With 200
|
|
127
|
-
// rows, client-side filtering stays well under a frame.
|
|
128
|
-
const visibleRuns = useMemo(() => {
|
|
129
|
-
const cutoff = RANGES[range];
|
|
130
|
-
const sinceMs = cutoff != null ? Date.now() - cutoff : null;
|
|
131
|
-
const needle = query.trim().toLowerCase();
|
|
132
|
-
// pinned-day filter is a UTC calendar bucket (matches the
|
|
133
|
-
// Sparkline's day keys which are UTC YYYY-MM-DD).
|
|
134
|
-
const dayLo = pinnedDay ? Date.UTC(
|
|
135
|
-
Number(pinnedDay.slice(0, 4)),
|
|
136
|
-
Number(pinnedDay.slice(5, 7)) - 1,
|
|
137
|
-
Number(pinnedDay.slice(8, 10)),
|
|
138
|
-
) : null;
|
|
139
|
-
const dayHi = dayLo != null ? dayLo + 86_400_000 : null;
|
|
140
|
-
return (runs ?? []).filter((r) => {
|
|
141
|
-
if (sinceMs != null && (r.updatedAt ?? 0) < sinceMs) return false;
|
|
142
|
-
if (dayLo != null && dayHi != null) {
|
|
143
|
-
const t = r.createdAt ?? 0;
|
|
144
|
-
if (t < dayLo || t >= dayHi) return false;
|
|
145
|
-
}
|
|
146
|
-
if (needle) {
|
|
147
|
-
const hay = [r.pipelineId, r.currentStep, r.flowId, r.statusReason, r.waitKind]
|
|
148
|
-
.filter(Boolean).join(" ").toLowerCase();
|
|
149
|
-
if (!hay.includes(needle)) return false;
|
|
150
|
-
}
|
|
151
|
-
return true;
|
|
152
|
-
});
|
|
153
|
-
}, [runs, range, query, pinnedDay]);
|
|
154
|
-
|
|
155
|
-
const filtersActive = !!(status || pipeline || range !== "all" || query || pinnedDay);
|
|
156
|
-
const clearAll = () => { setStatus(""); setPipeline(""); setRange("all"); setQuery(""); setPinnedDay(null); };
|
|
157
|
-
|
|
158
|
-
return (
|
|
159
|
-
<>
|
|
160
|
-
<NeedsAttention runs={allRecent ?? []} />
|
|
161
|
-
|
|
162
|
-
{(() => {
|
|
163
|
-
const loading = allRecent === null || stats === null || pipelinesCost === null;
|
|
164
|
-
if (loading) return <TodayStrip loading runs={{ total: 0, ok: 0, failed: 0, active: 0 }} newFailures={0} spent={{ value: 0 }} />;
|
|
165
|
-
const since = Date.now() - TODAY_DAY_MS;
|
|
166
|
-
const rs = allRecent!.filter((r) => (r.updatedAt ?? 0) >= since);
|
|
167
|
-
return (
|
|
168
|
-
<TodayStrip
|
|
169
|
-
runs={{
|
|
170
|
-
total: rs.length,
|
|
171
|
-
ok: rs.filter((r) => r.status === "succeeded").length,
|
|
172
|
-
failed: rs.filter((r) => r.status === "failed").length,
|
|
173
|
-
active: rs.filter((r) => r.status === "running" || r.status === "blocked").length,
|
|
174
|
-
}}
|
|
175
|
-
newFailures={(stats!.failureStops ?? []).filter((c) => (c.lastFailedAt ?? 0) >= since).length}
|
|
176
|
-
spent={estimateLast24hSpent(pipelinesCost!.total.perDay)}
|
|
177
|
-
/>
|
|
178
|
-
);
|
|
179
|
-
})()}
|
|
180
|
-
|
|
181
|
-
<h2 className="text-[15px] font-semibold uppercase tracking-[0.5px] text-fg-dim mt-6 mb-2.5">overview</h2>
|
|
182
|
-
{stats
|
|
183
|
-
? <StatStrip stats={stats} />
|
|
184
|
-
: (
|
|
185
|
-
<div className="grid gap-3 mb-4 grid-cols-[repeat(auto-fit,minmax(150px,1fr))]">
|
|
186
|
-
{[0, 1, 2, 3].map((i) => (
|
|
187
|
-
<div key={i} className="bg-bg-elev border border-border rounded-md px-[14px] py-3">
|
|
188
|
-
<Skeleton className="h-3 w-16 mb-2" />
|
|
189
|
-
<Skeleton className="h-7 w-20" />
|
|
190
|
-
<Skeleton className="h-2 w-24 mt-2" />
|
|
191
|
-
</div>
|
|
192
|
-
))}
|
|
193
|
-
</div>
|
|
194
|
-
)}
|
|
195
|
-
|
|
196
|
-
{/* Portfolio-wide cost section — mirrors PipelineDetail's cost
|
|
197
|
-
card layout (tiles + by-X breakdown + daily charts), but at
|
|
198
|
-
the cross-pipeline level.
|
|
199
|
-
|
|
200
|
-
The cost API walks every session JSONL on disk, so it lands
|
|
201
|
-
seconds after the other endpoints. Render a skeleton in the
|
|
202
|
-
meantime so the home doesn't reflow when data arrives. */}
|
|
203
|
-
{pipelinesCost === null && (
|
|
204
|
-
<Card>
|
|
205
|
-
<CardHeader><CardTitle>cost (last 30d)</CardTitle></CardHeader>
|
|
206
|
-
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3">
|
|
207
|
-
{[0, 1, 2].map((i) => (
|
|
208
|
-
<div key={i} className="border border-border rounded p-2">
|
|
209
|
-
<Skeleton className="h-3 w-20 mb-1.5" />
|
|
210
|
-
<Skeleton className="h-6 w-24" />
|
|
211
|
-
<Skeleton className="h-2 w-32 mt-2" />
|
|
212
|
-
</div>
|
|
213
|
-
))}
|
|
214
|
-
</div>
|
|
215
|
-
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 mt-4">
|
|
216
|
-
<div className="border border-border rounded p-2">
|
|
217
|
-
<Skeleton className="h-3 w-28 mb-2" />
|
|
218
|
-
{[0, 1, 2, 3].map((i) => (
|
|
219
|
-
<div key={i} className="flex items-center gap-2 mb-1.5">
|
|
220
|
-
<Skeleton className="h-3 w-32" />
|
|
221
|
-
<Skeleton className="h-2 flex-1" />
|
|
222
|
-
<Skeleton className="h-3 w-12" />
|
|
223
|
-
</div>
|
|
224
|
-
))}
|
|
225
|
-
</div>
|
|
226
|
-
<div className="flex flex-col gap-3">
|
|
227
|
-
{[0, 1].map((i) => (
|
|
228
|
-
<div key={i} className="border border-border rounded p-2 flex-1">
|
|
229
|
-
<Skeleton className="h-3 w-20 mb-2" />
|
|
230
|
-
<Skeleton className="h-3 w-full mb-1" />
|
|
231
|
-
<div className="flex gap-[2px] h-12">
|
|
232
|
-
{[0, 1, 2, 3, 4, 5].map((j) => (
|
|
233
|
-
<Skeleton key={j} className="flex-1 rounded-[1px]" />
|
|
234
|
-
))}
|
|
235
|
-
</div>
|
|
236
|
-
</div>
|
|
237
|
-
))}
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
240
|
-
</Card>
|
|
241
|
-
)}
|
|
242
|
-
{pipelinesCost && pipelinesCost.total.spend > 0 && (
|
|
243
|
-
<Card>
|
|
244
|
-
<CardHeader><CardTitle>cost (last 30d)</CardTitle></CardHeader>
|
|
245
|
-
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3 text-sm">
|
|
246
|
-
<HomeCostTile
|
|
247
|
-
label="total spend"
|
|
248
|
-
value={`$${pipelinesCost.total.spend.toFixed(2)}`}
|
|
249
|
-
sub={`${pipelinesCost.total.runs} run${pipelinesCost.total.runs === 1 ? "" : "s"} across ${pipelinesCost.pipelines.length} pipeline${pipelinesCost.pipelines.length === 1 ? "" : "s"}`}
|
|
250
|
-
/>
|
|
251
|
-
<HomeCostTile
|
|
252
|
-
label="mean / run"
|
|
253
|
-
value={pipelinesCost.total.mean != null ? `$${pipelinesCost.total.mean.toFixed(2)}` : "—"}
|
|
254
|
-
sub={pipelinesCost.total.p95Cost != null ? `p95 $${pipelinesCost.total.p95Cost.toFixed(2)}` : undefined}
|
|
255
|
-
/>
|
|
256
|
-
<HomeCostTile
|
|
257
|
-
label="cost / success"
|
|
258
|
-
value={pipelinesCost.total.costPerSuccess != null ? `$${pipelinesCost.total.costPerSuccess.toFixed(2)}` : "—"}
|
|
259
|
-
sub={pipelinesCost.total.succeeded > 0 ? `${pipelinesCost.total.succeeded} succeeded` : "no successes yet"}
|
|
260
|
-
/>
|
|
261
|
-
</div>
|
|
262
|
-
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 mt-4">
|
|
263
|
-
<PipelineCostBreakdown entries={pipelinesCost.pipelines} pipelines={pipelines ?? []} />
|
|
264
|
-
<div className="flex flex-col gap-3">
|
|
265
|
-
<DailyCostTrend perDay={pipelinesCost.total.perDay} />
|
|
266
|
-
<DailyTimeTrend perDay={pipelinesCost.total.perDay} />
|
|
267
|
-
</div>
|
|
268
|
-
</div>
|
|
269
|
-
</Card>
|
|
270
|
-
)}
|
|
271
|
-
|
|
272
|
-
<div className="flex flex-col md:flex-row gap-3 md:gap-5">
|
|
273
|
-
<div className="flex-1 min-w-0">
|
|
274
|
-
<Card className="mb-0">
|
|
275
|
-
<CardHeader><CardTitle>runs / day (last 30d)</CardTitle></CardHeader>
|
|
276
|
-
{stats
|
|
277
|
-
? <Sparkline buckets={stats.perDay} pinned={pinnedDay} onPinChange={setPinnedDay} />
|
|
278
|
-
: (
|
|
279
|
-
<>
|
|
280
|
-
<Skeleton className="h-3 w-20 self-end mb-1 ml-auto" />
|
|
281
|
-
<div className="flex gap-[2px] h-9 mt-1.5">
|
|
282
|
-
{Array.from({ length: 14 }, (_, i) => (
|
|
283
|
-
<Skeleton key={i} className="flex-1 min-w-[4px] rounded-[1px]" />
|
|
284
|
-
))}
|
|
285
|
-
</div>
|
|
286
|
-
<div className="flex justify-between mt-1.5">
|
|
287
|
-
<Skeleton className="h-2.5 w-16" />
|
|
288
|
-
<Skeleton className="h-2.5 w-12" />
|
|
289
|
-
<Skeleton className="h-2.5 w-16" />
|
|
290
|
-
</div>
|
|
291
|
-
</>
|
|
292
|
-
)}
|
|
293
|
-
</Card>
|
|
294
|
-
</div>
|
|
295
|
-
<div className="flex-1 min-w-0">
|
|
296
|
-
<Card className="mb-0">
|
|
297
|
-
<CardHeader><CardTitle>top failure / cancel steps</CardTitle></CardHeader>
|
|
298
|
-
{stats
|
|
299
|
-
? <Histogram entries={stats.failureStops} showPipeline />
|
|
300
|
-
: (
|
|
301
|
-
<div className="space-y-2">
|
|
302
|
-
{[0, 1].map((g) => (
|
|
303
|
-
<div key={g} className="border border-border rounded">
|
|
304
|
-
<div className="px-2 py-1 border-b border-border/60">
|
|
305
|
-
<Skeleton className="h-3 w-40" />
|
|
306
|
-
</div>
|
|
307
|
-
<div className="px-2 py-1.5 space-y-1.5">
|
|
308
|
-
{[0, 1].map((r) => (
|
|
309
|
-
<div key={r} className="flex items-center gap-2">
|
|
310
|
-
<Skeleton className="h-3 w-32" />
|
|
311
|
-
<Skeleton className="h-3 flex-1" />
|
|
312
|
-
<Skeleton className="h-3 w-10" />
|
|
313
|
-
</div>
|
|
314
|
-
))}
|
|
315
|
-
</div>
|
|
316
|
-
</div>
|
|
317
|
-
))}
|
|
318
|
-
</div>
|
|
319
|
-
)}
|
|
320
|
-
</Card>
|
|
321
|
-
</div>
|
|
322
|
-
</div>
|
|
323
|
-
|
|
324
|
-
{/* Pipelines sidebar dropped — the cost-by-pipeline breakdown
|
|
325
|
-
card above is a strict superset (name + cost + tone + tap-
|
|
326
|
-
to-expand detail). Historical pipelines (in DB but no source
|
|
327
|
-
on disk) surface there too with a dim row + badge. */}
|
|
328
|
-
<div>
|
|
329
|
-
<div>
|
|
330
|
-
<div className="flex items-baseline justify-between mb-2.5 gap-3 flex-wrap">
|
|
331
|
-
<h2 className="text-[15px] font-semibold uppercase tracking-[0.5px] text-fg-dim">runs</h2>
|
|
332
|
-
<span className="font-mono text-xs text-fg-dim">
|
|
333
|
-
{runs === null
|
|
334
|
-
? "…"
|
|
335
|
-
: visibleRuns.length === runs.length ? `${runs.length}` : `${visibleRuns.length} / ${runs.length}`}
|
|
336
|
-
{filtersActive && (
|
|
337
|
-
<button onClick={clearAll} className="ml-2 underline hover:text-fg">clear filters</button>
|
|
338
|
-
)}
|
|
339
|
-
</span>
|
|
340
|
-
</div>
|
|
341
|
-
|
|
342
|
-
{/* Row 1: pipeline + range + search */}
|
|
343
|
-
<div className="flex gap-2 mb-2 flex-wrap">
|
|
344
|
-
<select
|
|
345
|
-
value={pipeline}
|
|
346
|
-
onChange={(e) => setPipeline(e.target.value)}
|
|
347
|
-
className="bg-bg-elev border border-border rounded px-2 py-1 text-sm font-mono text-fg min-w-0"
|
|
348
|
-
>
|
|
349
|
-
<option value="">all pipelines</option>
|
|
350
|
-
{(pipelines ?? []).map((p) => (
|
|
351
|
-
<option key={p.id} value={p.id}>{p.id}{p.historical ? " (historical)" : ""}</option>
|
|
352
|
-
))}
|
|
353
|
-
</select>
|
|
354
|
-
<select
|
|
355
|
-
value={range}
|
|
356
|
-
onChange={(e) => setRange(e.target.value as RangeKey)}
|
|
357
|
-
className="bg-bg-elev border border-border rounded px-2 py-1 text-sm font-mono text-fg"
|
|
358
|
-
>
|
|
359
|
-
{(Object.keys(RANGES) as RangeKey[]).map((r) => (
|
|
360
|
-
<option key={r} value={r}>{r === "all" ? "all time" : `last ${r}`}</option>
|
|
361
|
-
))}
|
|
362
|
-
</select>
|
|
363
|
-
<input
|
|
364
|
-
type="search"
|
|
365
|
-
value={query}
|
|
366
|
-
onChange={(e) => setQuery(e.target.value)}
|
|
367
|
-
placeholder="search step / pipeline / flowId…"
|
|
368
|
-
className="bg-bg-elev border border-border rounded px-2 py-1 text-sm text-fg flex-1 min-w-[160px]"
|
|
369
|
-
/>
|
|
370
|
-
</div>
|
|
371
|
-
|
|
372
|
-
{/* Row 2: status chips */}
|
|
373
|
-
<div className="flex gap-2 flex-wrap mb-3 items-center">
|
|
374
|
-
{STATUS_FILTERS.map((s) => (
|
|
375
|
-
<Button
|
|
376
|
-
key={s || "all"}
|
|
377
|
-
variant="chip"
|
|
378
|
-
onClick={() => setStatus(s)}
|
|
379
|
-
className={cn(status === s && "bg-bg-elev2 text-fg border-fg-dim")}
|
|
380
|
-
>
|
|
381
|
-
{s || "all"}
|
|
382
|
-
</Button>
|
|
383
|
-
))}
|
|
384
|
-
</div>
|
|
385
|
-
<Card>
|
|
386
|
-
{runs === null
|
|
387
|
-
? (
|
|
388
|
-
<div className="space-y-2">
|
|
389
|
-
{[0, 1, 2, 3, 4, 5].map((i) => (
|
|
390
|
-
<div key={i} className="flex items-center gap-3 py-1">
|
|
391
|
-
<Skeleton className="h-3 w-16" />
|
|
392
|
-
<Skeleton className="h-3 w-40" />
|
|
393
|
-
<Skeleton className="h-4 w-16" />
|
|
394
|
-
<Skeleton className="h-3 w-24" />
|
|
395
|
-
<Skeleton className="h-3 w-12 ml-auto" />
|
|
396
|
-
</div>
|
|
397
|
-
))}
|
|
398
|
-
</div>
|
|
399
|
-
)
|
|
400
|
-
: visibleRuns.length === 0
|
|
401
|
-
? <div className="text-fg-dim italic">
|
|
402
|
-
no runs{filtersActive && " matching the current filters"}
|
|
403
|
-
</div>
|
|
404
|
-
: (
|
|
405
|
-
<>
|
|
406
|
-
{/*
|
|
407
|
-
Mobile-first card list (<sm). Drops wait + subflows
|
|
408
|
-
columns — too low-signal for the vertical space they
|
|
409
|
-
eat at 390px. Status pill leads each card so the
|
|
410
|
-
operator can scan failures/blocks at a glance.
|
|
411
|
-
*/}
|
|
412
|
-
<div className="sm:hidden flex flex-col gap-2">
|
|
413
|
-
{visibleRuns.map((r) => (
|
|
414
|
-
<a
|
|
415
|
-
key={r.flowId}
|
|
416
|
-
href={`#/runs/${r.flowId}`}
|
|
417
|
-
className="block rounded border border-border bg-bg-elev2/30 hover:bg-bg-elev2 px-3 py-2"
|
|
418
|
-
>
|
|
419
|
-
<div className="flex items-center gap-2">
|
|
420
|
-
<StatusBadge status={r.status} />
|
|
421
|
-
<span className="font-mono text-sm truncate flex-1">{r.pipelineId ?? "?"}</span>
|
|
422
|
-
<span className="text-[10px] text-fg-dim shrink-0">{formatTime(r.updatedAt)}</span>
|
|
423
|
-
</div>
|
|
424
|
-
<div className="flex items-baseline gap-2 mt-0.5 text-xs text-fg-dim font-mono">
|
|
425
|
-
<span>{r.flowId.slice(0, 8)}</span>
|
|
426
|
-
{r.currentStep && <span>· {r.currentStep}</span>}
|
|
427
|
-
</div>
|
|
428
|
-
</a>
|
|
429
|
-
))}
|
|
430
|
-
</div>
|
|
431
|
-
{/* Desktop / tablet table — unchanged. */}
|
|
432
|
-
<div className="hidden sm:block">
|
|
433
|
-
<Table>
|
|
434
|
-
<THead>
|
|
435
|
-
<TR>
|
|
436
|
-
<TH>flow</TH><TH>pipeline</TH><TH>status</TH><TH>step</TH><TH>wait</TH><TH>subflows</TH><TH>updated</TH>
|
|
437
|
-
</TR>
|
|
438
|
-
</THead>
|
|
439
|
-
<TBody>
|
|
440
|
-
{visibleRuns.map((r) => (
|
|
441
|
-
<TR key={r.flowId} className="cursor-pointer hover:bg-bg-elev2" onClick={() => { window.location.hash = `#/runs/${r.flowId}`; }}>
|
|
442
|
-
<TD className="font-mono text-xs">
|
|
443
|
-
<ClickToCopy value={r.flowId} label="copy flowId">{r.flowId.slice(0, 8)}</ClickToCopy>
|
|
444
|
-
</TD>
|
|
445
|
-
<TD className="font-mono">{r.pipelineId ?? "?"}</TD>
|
|
446
|
-
<TD><StatusBadge status={r.status} /></TD>
|
|
447
|
-
<TD className="font-mono text-fg-dim">{r.currentStep ?? "?"}</TD>
|
|
448
|
-
<TD className="font-mono text-fg-dim">{r.waitKind ?? ""}</TD>
|
|
449
|
-
<TD><SubflowSummary groups={r.subflows} /></TD>
|
|
450
|
-
<TD className="text-fg-dim">{formatTime(r.updatedAt)}</TD>
|
|
451
|
-
</TR>
|
|
452
|
-
))}
|
|
453
|
-
</TBody>
|
|
454
|
-
</Table>
|
|
455
|
-
</div>
|
|
456
|
-
</>
|
|
457
|
-
)
|
|
458
|
-
}
|
|
459
|
-
</Card>
|
|
460
|
-
</div>
|
|
461
|
-
</div>
|
|
462
|
-
</>
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
// Cost tile for the overview's cost (last 30d) section. Same shape as
|
|
467
|
-
// PipelineDetail's CostTile but local to Home so the import surface
|
|
468
|
-
// stays small. Sub line accepts ReactNode so callers can colorize.
|
|
469
|
-
function HomeCostTile({ label, value, sub }: { label: string; value: string; sub?: React.ReactNode }) {
|
|
470
|
-
return (
|
|
471
|
-
<div className="border border-border rounded p-2">
|
|
472
|
-
<div className="text-xs text-fg-dim">{label}</div>
|
|
473
|
-
<div className="font-mono text-lg">{value}</div>
|
|
474
|
-
{sub && <div className="text-xs text-fg-dim mt-0.5">{sub}</div>}
|
|
475
|
-
</div>
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
|
-
|