acpus 0.0.2 → 0.1.0

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 (47) hide show
  1. package/README.md +6 -103
  2. package/dist/catalog.d.ts +27 -0
  3. package/dist/catalog.d.ts.map +1 -0
  4. package/dist/catalog.js +189 -0
  5. package/dist/catalog.js.map +1 -0
  6. package/dist/follow.d.ts +23 -0
  7. package/dist/follow.d.ts.map +1 -0
  8. package/dist/follow.js +109 -0
  9. package/dist/follow.js.map +1 -0
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +414 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/io.d.ts +4 -0
  15. package/dist/io.d.ts.map +1 -0
  16. package/dist/io.js +38 -0
  17. package/dist/io.js.map +1 -0
  18. package/dist/observations.d.ts +26 -0
  19. package/dist/observations.d.ts.map +1 -0
  20. package/dist/observations.js +60 -0
  21. package/dist/observations.js.map +1 -0
  22. package/dist/output.d.ts +9 -0
  23. package/dist/output.d.ts.map +1 -0
  24. package/dist/output.js +51 -0
  25. package/dist/output.js.map +1 -0
  26. package/dist/runs-show.d.ts +5 -0
  27. package/dist/runs-show.d.ts.map +1 -0
  28. package/dist/runs-show.js +83 -0
  29. package/dist/runs-show.js.map +1 -0
  30. package/dist/supervisor-client.d.ts +9 -0
  31. package/dist/supervisor-client.d.ts.map +1 -0
  32. package/dist/supervisor-client.js +8 -0
  33. package/dist/supervisor-client.js.map +1 -0
  34. package/dist/supervisor.d.ts +18 -0
  35. package/dist/supervisor.d.ts.map +1 -0
  36. package/dist/supervisor.js +24 -0
  37. package/dist/supervisor.js.map +1 -0
  38. package/package.json +30 -44
  39. package/dist/cli.d.mts +0 -1
  40. package/dist/cli.mjs +0 -4017
  41. package/dist/index.d.mts +0 -2194
  42. package/dist/index.mjs +0 -243
  43. package/dist/monitor-app-CPlEcyHR.mjs +0 -369
  44. package/dist/monitor-rendering-LGr9Ebd_.mjs +0 -78
  45. package/dist/run-picker-app-utJ2f5CU.mjs +0 -104
  46. package/dist/run-workflow-DdIAC8Zu.mjs +0 -12922
  47. package/schemas/workflow-spec.schema.json +0 -2649
@@ -1,78 +0,0 @@
1
- //#region src/tui/monitor-rendering.ts
2
- function defaultStageIndex(stages) {
3
- const running = stages.findIndex((stage) => stage.status === "running");
4
- if (running >= 0) return running;
5
- const blocked = stages.findIndex((stage) => stage.status === "blocked" || stage.status === "failed");
6
- if (blocked >= 0) return blocked;
7
- const open = stages.findIndex((stage) => stage.status !== "completed" && stage.status !== "skipped");
8
- return open >= 0 ? open : 0;
9
- }
10
- function clampIndex(index, length) {
11
- if (length <= 0) return 0;
12
- return Math.min(Math.max(index, 0), length - 1);
13
- }
14
- function tasksForStage(view, stageId) {
15
- if (!view || !stageId) return [];
16
- return view.tasks.filter((task) => task.stageId === stageId);
17
- }
18
- function stageProgressLabel(stage) {
19
- const counts = stage.taskCounts;
20
- return `${counts.completed}/${counts.total}`;
21
- }
22
- function runProgressLabel(view) {
23
- return `${view.progress.completedTasks}/${view.progress.knownTasks} tasks`;
24
- }
25
- function runStatusLabel(view) {
26
- if ((view.run.status === "running" || view.run.status === "pending") && view.run.worker?.status === "stale") return "stale";
27
- return view.run.status;
28
- }
29
- function statusMark(status) {
30
- if (status === "completed") return "✔";
31
- if (status === "running" || status === "raw_received" || status === "parsing") return "●";
32
- if (status === "blocked" || status === "failed" || status === "cancelled" || status === "timed_out") return "!";
33
- if (status === "skipped") return "-";
34
- return " ";
35
- }
36
- function shorten(value, width) {
37
- if (!value) return "";
38
- if (width <= 0) return "";
39
- if (value.length <= width) return value;
40
- if (width <= 3) return value.slice(0, width);
41
- return `${value.slice(0, width - 3)}...`;
42
- }
43
- function detailSummary(detail) {
44
- if (!detail) return ["No task selected"];
45
- return [
46
- `${statusMark(detail.task.status)} ${detail.task.status} - ${detail.task.execution}${detail.task.agent ? ` - ${detail.task.agent}` : ""}`,
47
- detail.task.durationMs !== void 0 || detail.task.elapsedMs !== void 0 ? `Time: ${formatDuration(detail.task.durationMs ?? detail.task.elapsedMs ?? 0)}` : void 0,
48
- detail.task.blockedReason ? `Reason: ${detail.task.blockedReason}` : void 0,
49
- detail.task.lastRetryReason ? `Retry: ${detail.task.lastRetryReason} ${detail.task.retryBudgetUsed ?? 0}/${detail.task.retryBudgetLimit ?? "?"}` : void 0,
50
- detail.task.lastFailureCode ? `Last failure: ${detail.task.lastFailureCode}` : void 0,
51
- detail.outcome?.summary ? `Outcome: ${detail.outcome.summary}` : void 0,
52
- detail.outcome?.path ? `Output: ${detail.outcome.path}` : void 0,
53
- detail.prompt ? `Prompt: ${detail.prompt.lines} line(s)` : void 0,
54
- detail.prompt?.preview ? detail.prompt.preview : void 0,
55
- detail.activity.totalAttempts > 0 ? `Attempts: ${detail.activity.totalAttempts}` : "No agent attempts",
56
- ...detail.activity.attempts.map((attempt) => {
57
- const retry = attempt.isRetry ? ` retry=${attempt.retryReason ?? "unknown"}#${attempt.retryOrdinal ?? "?"}` : "";
58
- const failure = attempt.lastFailureCode ? ` last=${attempt.lastFailureCode}` : "";
59
- return `${attempt.id} ${attempt.status}${retry}${failure} ${attempt.path}`;
60
- })
61
- ].filter((line) => typeof line === "string" && line.length > 0);
62
- }
63
- function nextIndex(current, delta, length) {
64
- return clampIndex(current + delta, length);
65
- }
66
- function formatDuration(milliseconds) {
67
- if (milliseconds === void 0 || !Number.isFinite(milliseconds)) return "";
68
- const totalSeconds = Math.max(0, Math.floor(milliseconds / 1e3));
69
- const seconds = totalSeconds % 60;
70
- const totalMinutes = Math.floor(totalSeconds / 60);
71
- const minutes = totalMinutes % 60;
72
- const hours = Math.floor(totalMinutes / 60);
73
- if (hours > 0) return `${hours}h ${minutes}m ${seconds}s`;
74
- if (minutes > 0) return `${minutes}m ${seconds}s`;
75
- return `${seconds}s`;
76
- }
77
- //#endregion
78
- export { nextIndex as a, shorten as c, tasksForStage as d, formatDuration as i, stageProgressLabel as l, defaultStageIndex as n, runProgressLabel as o, detailSummary as r, runStatusLabel as s, clampIndex as t, statusMark as u };
@@ -1,104 +0,0 @@
1
- import { t as listRunSummaries } from "./cli.mjs";
2
- import { a as nextIndex, c as shorten, i as formatDuration, u as statusMark } from "./monitor-rendering-LGr9Ebd_.mjs";
3
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
- import { Box, Text, useApp, useInput, useStdout } from "ink";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- //#region src/tui/run-picker-app.tsx
7
- function RunPickerApp({ title, pollMs = 1e3, initialList, loadRuns = listRunSummaries, onSelect }) {
8
- const { exit } = useApp();
9
- const { stdout } = useStdout();
10
- const [list, setList] = useState(initialList);
11
- const [selectedIndex, setSelectedIndex] = useState(0);
12
- const [error, setError] = useState();
13
- const loadRunsRef = useRef(loadRuns);
14
- useEffect(() => {
15
- loadRunsRef.current = loadRuns;
16
- }, [loadRuns]);
17
- const refresh = useCallback(async () => {
18
- try {
19
- const next = await loadRunsRef.current();
20
- setList(next);
21
- setSelectedIndex((current) => Math.max(0, Math.min(current, Math.max(0, next.entries.length - 1))));
22
- setError(void 0);
23
- } catch (loadError) {
24
- setError(loadError instanceof Error ? loadError.message : String(loadError));
25
- }
26
- }, []);
27
- useEffect(() => {
28
- refresh();
29
- const timer = setInterval(() => void refresh(), pollMs);
30
- return () => clearInterval(timer);
31
- }, [pollMs, refresh]);
32
- useInput((input, key) => {
33
- if (input === "q" || key.ctrl && input === "c") {
34
- onSelect(void 0);
35
- exit();
36
- return;
37
- }
38
- if (input === "r") refresh();
39
- if (key.upArrow) setSelectedIndex((current) => nextIndex(current, -1, list?.entries.length ?? 0));
40
- if (key.downArrow) setSelectedIndex((current) => nextIndex(current, 1, list?.entries.length ?? 0));
41
- if (key.return) {
42
- const selected = list?.entries[selectedIndex];
43
- if (!selected || selected.invalid) return;
44
- onSelect(selected.runId);
45
- exit();
46
- }
47
- });
48
- const width = Math.max(80, stdout.columns ?? 120);
49
- const entries = useMemo(() => list?.entries ?? [], [list?.entries]);
50
- return /* @__PURE__ */ jsxs(Box, {
51
- flexDirection: "column",
52
- children: [
53
- /* @__PURE__ */ jsx(Text, {
54
- color: "blue",
55
- bold: true,
56
- children: title
57
- }),
58
- /* @__PURE__ */ jsx(Text, {
59
- dimColor: true,
60
- children: list ? `runs in ${list.dir}` : "Loading runs..."
61
- }),
62
- error ? /* @__PURE__ */ jsxs(Text, {
63
- color: "red",
64
- children: ["Error: ", error]
65
- }) : null,
66
- entries.length === 0 ? /* @__PURE__ */ jsx(Text, {
67
- dimColor: true,
68
- children: "No runs found."
69
- }) : null,
70
- /* @__PURE__ */ jsx(Box, {
71
- flexDirection: "column",
72
- marginTop: 1,
73
- children: entries.map((entry, index) => /* @__PURE__ */ jsxs(Box, { children: [
74
- /* @__PURE__ */ jsxs(Text, { children: [index === selectedIndex ? ">" : " ", " "] }),
75
- /* @__PURE__ */ jsxs(Text, {
76
- dimColor: entry.invalid,
77
- children: [statusMark(entry.status ?? "invalid"), " "]
78
- }),
79
- /* @__PURE__ */ jsxs(Text, { children: [shorten(entry.runId, 40), " "] }),
80
- /* @__PURE__ */ jsxs(Text, { children: [shorten(entry.status ?? "invalid", 10), " "] }),
81
- /* @__PURE__ */ jsxs(Text, {
82
- dimColor: true,
83
- children: [shorten(entry.progress?.label ?? "-", 12), " "]
84
- }),
85
- /* @__PURE__ */ jsxs(Text, {
86
- dimColor: true,
87
- children: [shorten(entry.worker ? `worker ${entry.worker.status}` : "", 16), " "]
88
- }),
89
- /* @__PURE__ */ jsxs(Text, { children: [shorten(entry.workflowName ?? "", Math.max(12, width - 100)), " "] }),
90
- /* @__PURE__ */ jsx(Text, {
91
- dimColor: true,
92
- children: formatDuration(entry.durationMs ?? entry.elapsedMs)
93
- })
94
- ] }, entry.runId))
95
- }),
96
- /* @__PURE__ */ jsx(Text, {
97
- dimColor: true,
98
- children: "up/down move - enter select - r refresh - q quit"
99
- })
100
- ]
101
- });
102
- }
103
- //#endregion
104
- export { RunPickerApp };