@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.
Files changed (210) hide show
  1. package/README.md +2 -1583
  2. package/package.json +4 -49
  3. package/.migrations/ops/0000_futuristic_karma.sql +0 -111
  4. package/.migrations/ops/0001_low_maximus.sql +0 -7
  5. package/.migrations/ops/meta/0000_snapshot.json +0 -763
  6. package/.migrations/ops/meta/0001_snapshot.json +0 -173
  7. package/.migrations/ops/meta/_journal.json +0 -20
  8. package/.migrations/runtime/0000_real_boomer.sql +0 -180
  9. package/.migrations/runtime/0001_hot_dakota_north.sql +0 -2
  10. package/.migrations/runtime/0002_breezy_vertigo.sql +0 -8
  11. package/.migrations/runtime/0003_dashing_jack_flag.sql +0 -5
  12. package/.migrations/runtime/0004_panoramic_ego.sql +0 -1
  13. package/.migrations/runtime/0005_tidy_ben_grimm.sql +0 -10
  14. package/.migrations/runtime/0006_wet_nightmare.sql +0 -57
  15. package/.migrations/runtime/0007_ambiguous_chronomancer.sql +0 -8
  16. package/.migrations/runtime/0008_wealthy_thundra.sql +0 -301
  17. package/.migrations/runtime/0009_lying_shocker.sql +0 -96
  18. package/.migrations/runtime/0010_solid_phantom_reporter.sql +0 -160
  19. package/.migrations/runtime/0011_windy_demogoblin.sql +0 -175
  20. package/.migrations/runtime/0012_restore_harness_fks.sql +0 -103
  21. package/.migrations/runtime/meta/0000_snapshot.json +0 -1181
  22. package/.migrations/runtime/meta/0001_snapshot.json +0 -1209
  23. package/.migrations/runtime/meta/0002_snapshot.json +0 -1261
  24. package/.migrations/runtime/meta/0003_snapshot.json +0 -1292
  25. package/.migrations/runtime/meta/0004_snapshot.json +0 -1240
  26. package/.migrations/runtime/meta/0006_snapshot.json +0 -1310
  27. package/.migrations/runtime/meta/0007_snapshot.json +0 -1362
  28. package/.migrations/runtime/meta/0008_snapshot.json +0 -1742
  29. package/.migrations/runtime/meta/0009_snapshot.json +0 -2413
  30. package/.migrations/runtime/meta/0010_snapshot.json +0 -2562
  31. package/.migrations/runtime/meta/0011_snapshot.json +0 -2812
  32. package/.migrations/runtime/meta/0012_snapshot.json +0 -2812
  33. package/.migrations/runtime/meta/_journal.json +0 -97
  34. package/RELEASING.md +0 -89
  35. package/agent/fleet.js +0 -100
  36. package/bin/cli.js +0 -854
  37. package/bin/manifold.js +0 -4
  38. package/boot/flow-revival.js +0 -536
  39. package/budget/index.js +0 -495
  40. package/budget/lib.js +0 -59
  41. package/dashboard/cost.js +0 -528
  42. package/dashboard/dist/assets/index-CUfp63sj.css +0 -1
  43. package/dashboard/dist/assets/index-Qy9JMpma.js +0 -371
  44. package/dashboard/dist/index.html +0 -13
  45. package/dashboard/event-log.js +0 -267
  46. package/dashboard/index.html +0 -12
  47. package/dashboard/package-lock.json +0 -2877
  48. package/dashboard/package.json +0 -37
  49. package/dashboard/pipeline-graph.js +0 -131
  50. package/dashboard/postcss.config.js +0 -6
  51. package/dashboard/search.js +0 -183
  52. package/dashboard/server.js +0 -1015
  53. package/dashboard/src/App.tsx +0 -42
  54. package/dashboard/src/api/client.ts +0 -118
  55. package/dashboard/src/api/types.ts +0 -510
  56. package/dashboard/src/api/ws.tsx +0 -112
  57. package/dashboard/src/components/CancelButton.tsx +0 -63
  58. package/dashboard/src/components/ClickToCopy.tsx +0 -68
  59. package/dashboard/src/components/CopyButton.tsx +0 -61
  60. package/dashboard/src/components/DailyCostTrend.tsx +0 -85
  61. package/dashboard/src/components/DailyTimeTrend.tsx +0 -94
  62. package/dashboard/src/components/Funnel.tsx +0 -149
  63. package/dashboard/src/components/GateForm.tsx +0 -158
  64. package/dashboard/src/components/GraphView.tsx +0 -302
  65. package/dashboard/src/components/GroupPathsSummary.tsx +0 -47
  66. package/dashboard/src/components/Histogram.tsx +0 -292
  67. package/dashboard/src/components/Layout.tsx +0 -28
  68. package/dashboard/src/components/NeedsAttention.tsx +0 -98
  69. package/dashboard/src/components/NodeContextCard.tsx +0 -132
  70. package/dashboard/src/components/PathTrail.tsx +0 -35
  71. package/dashboard/src/components/PipelineCostBreakdown.tsx +0 -277
  72. package/dashboard/src/components/RerunButton.tsx +0 -46
  73. package/dashboard/src/components/RunComparison.tsx +0 -53
  74. package/dashboard/src/components/Sparkline.tsx +0 -94
  75. package/dashboard/src/components/StatStrip.tsx +0 -147
  76. package/dashboard/src/components/StateTree.tsx +0 -84
  77. package/dashboard/src/components/StatusBadge.tsx +0 -18
  78. package/dashboard/src/components/SubflowPathPills.tsx +0 -38
  79. package/dashboard/src/components/SubflowSummary.tsx +0 -24
  80. package/dashboard/src/components/SubflowsCard.tsx +0 -327
  81. package/dashboard/src/components/TodayStrip.tsx +0 -86
  82. package/dashboard/src/components/TranscriptPane.tsx +0 -99
  83. package/dashboard/src/components/TranscriptRow.tsx +0 -69
  84. package/dashboard/src/components/ui/badge.tsx +0 -38
  85. package/dashboard/src/components/ui/button.tsx +0 -28
  86. package/dashboard/src/components/ui/card.tsx +0 -42
  87. package/dashboard/src/components/ui/skeleton.tsx +0 -9
  88. package/dashboard/src/components/ui/table.tsx +0 -62
  89. package/dashboard/src/index.css +0 -26
  90. package/dashboard/src/lib/anomaly.ts +0 -42
  91. package/dashboard/src/lib/format.ts +0 -30
  92. package/dashboard/src/lib/step-history.ts +0 -13
  93. package/dashboard/src/lib/subflow.ts +0 -154
  94. package/dashboard/src/lib/use-click-outside.ts +0 -28
  95. package/dashboard/src/lib/use-ignored-clusters.ts +0 -67
  96. package/dashboard/src/lib/utils.ts +0 -6
  97. package/dashboard/src/main.tsx +0 -10
  98. package/dashboard/src/types/shims.d.ts +0 -4
  99. package/dashboard/src/views/Home.tsx +0 -478
  100. package/dashboard/src/views/PipelineDetail.tsx +0 -1185
  101. package/dashboard/src/views/PipelinesList.tsx +0 -111
  102. package/dashboard/src/views/RunDetail.tsx +0 -248
  103. package/dashboard/src/views/Search.tsx +0 -196
  104. package/dashboard/stats.js +0 -668
  105. package/dashboard/tailwind.config.ts +0 -43
  106. package/dashboard/tree-stats.js +0 -12
  107. package/dashboard/tsconfig.json +0 -25
  108. package/dashboard/views.js +0 -231
  109. package/dashboard/vite.config.ts +0 -34
  110. package/drizzle.config.js +0 -12
  111. package/drizzle.config.ops.js +0 -12
  112. package/elevation.js +0 -116
  113. package/engine/admission-promotion-resume.js +0 -127
  114. package/engine/agent-dispatch.js +0 -64
  115. package/engine/child-resume-trigger.js +0 -315
  116. package/engine/executor-budget.js +0 -87
  117. package/engine/executor-cancel.js +0 -83
  118. package/engine/executor-errors.js +0 -122
  119. package/engine/executor-helpers.js +0 -254
  120. package/engine/executor-nodes.js +0 -292
  121. package/engine/executor-persist.js +0 -212
  122. package/engine/executor-subflow-children.js +0 -275
  123. package/engine/executor.js +0 -1013
  124. package/engine/global-concurrency.js +0 -33
  125. package/engine/loader.js +0 -528
  126. package/engine/needs-resolver.js +0 -229
  127. package/engine/pipelines-watcher.js +0 -133
  128. package/engine/result-replay.js +0 -34
  129. package/engine/revival-messages.js +0 -11
  130. package/engine/spawn-child.js +0 -55
  131. package/engine/wait-for-flow-settlement.js +0 -109
  132. package/events/catalog.js +0 -26
  133. package/events/emit.js +0 -44
  134. package/events/kinds.js +0 -118
  135. package/events/serve-ws.js +0 -74
  136. package/events/stream.js +0 -35
  137. package/events/ws-dialog.js +0 -257
  138. package/events/ws-frame.js +0 -194
  139. package/events/ws-run-events.js +0 -70
  140. package/events.js +0 -32
  141. package/gates/gate-resolver.js +0 -576
  142. package/gates/paused-flows.js +0 -55
  143. package/graphql/columns.js +0 -67
  144. package/graphql/schema.js +0 -333
  145. package/index.js +0 -49
  146. package/mcp/http.js +0 -159
  147. package/mcp/identity.js +0 -94
  148. package/mcp/stdio.js +0 -80
  149. package/mcp/tools.js +0 -245
  150. package/mcp/wire-ops.js +0 -178
  151. package/routes/bearer-auth.js +0 -57
  152. package/routes/discuss-audio.js +0 -87
  153. package/routes/discuss-component.js +0 -39
  154. package/routes/discuss-draft.js +0 -159
  155. package/routes/discuss-helpers.js +0 -20
  156. package/routes/discuss.js +0 -848
  157. package/routes/failures.js +0 -104
  158. package/routes/graphql.js +0 -61
  159. package/routes/health.js +0 -54
  160. package/routes/operator-discuss.js +0 -193
  161. package/routes/operator-resume.js +0 -32
  162. package/routes/operator-retry.js +0 -301
  163. package/routes/operator.js +0 -539
  164. package/routes/pipelines.js +0 -118
  165. package/routes/runs.js +0 -1129
  166. package/scripts/ci/import-check.mjs +0 -50
  167. package/scripts/link-core-self.mjs +0 -31
  168. package/scripts/with-guard.sh +0 -24
  169. package/server/app.js +0 -503
  170. package/server/registry.js +0 -53
  171. package/server/serve.js +0 -163
  172. package/state/admission-queue-store.js +0 -325
  173. package/state/attribution-registries.js +0 -102
  174. package/state/batch-writer.js +0 -162
  175. package/state/db-guard.js +0 -63
  176. package/state/db-health.js +0 -27
  177. package/state/db.js +0 -122
  178. package/state/discuss-store.js +0 -299
  179. package/state/failure-store.js +0 -427
  180. package/state/migrate.js +0 -104
  181. package/state/node-cost.js +0 -67
  182. package/state/node-executions.js +0 -775
  183. package/state/node-health-store.js +0 -124
  184. package/state/ops-merge.js +0 -93
  185. package/state/paths.js +0 -146
  186. package/state/pipeline-dirs.js +0 -99
  187. package/state/pipeline-registry.js +0 -449
  188. package/state/run-store.js +0 -697
  189. package/state/schema.js +0 -438
  190. package/state/schema.ops.js +0 -44
  191. package/state/session-index.js +0 -177
  192. package/state/session-keys.js +0 -39
  193. package/state/state-store.js +0 -311
  194. package/state/subflow-state.js +0 -126
  195. package/state/tool-handoff.js +0 -169
  196. package/telemetry/budget-alert.js +0 -353
  197. package/telemetry/cli.js +0 -331
  198. package/telemetry/grammar.js +0 -119
  199. package/telemetry/http-budget.js +0 -132
  200. package/telemetry/http-cost.js +0 -670
  201. package/telemetry/http-helpers.js +0 -134
  202. package/telemetry/http-tree.js +0 -349
  203. package/telemetry/http.js +0 -44
  204. package/telemetry/index.js +0 -307
  205. package/telemetry/ingest.js +0 -134
  206. package/telemetry/labels.js +0 -115
  207. package/telemetry/pricer.js +0 -77
  208. package/telemetry/resolver.js +0 -314
  209. package/telemetry/store.js +0 -147
  210. package/utils/run-patch.js +0 -43
@@ -1,111 +0,0 @@
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
- }
@@ -1,248 +0,0 @@
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
- }
@@ -1,196 +0,0 @@
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
- }