@pat-lewczuk/cezar 0.1.2 → 0.1.4
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 +249 -45
- package/dist/config.d.ts +8 -0
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-runner.d.ts +44 -2
- package/dist/core/agent-runner.js +8 -2
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +6 -4
- package/dist/core/backend-detect.js +44 -4
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +3 -25
- package/dist/core/claude-cli-runner.js +2 -19
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/claude-ui-mapper.d.ts +57 -0
- package/dist/core/claude-ui-mapper.js +370 -0
- package/dist/core/claude-ui-mapper.js.map +1 -0
- package/dist/core/codex-app-server-runner.d.ts +29 -0
- package/dist/core/codex-app-server-runner.js +452 -0
- package/dist/core/codex-app-server-runner.js.map +1 -0
- package/dist/core/codex-ui-mapper.d.ts +53 -0
- package/dist/core/codex-ui-mapper.js +411 -0
- package/dist/core/codex-ui-mapper.js.map +1 -0
- package/dist/core/ndjson.d.ts +6 -0
- package/dist/core/ndjson.js +23 -0
- package/dist/core/ndjson.js.map +1 -0
- package/dist/core/opencode-server-runner.d.ts +30 -0
- package/dist/core/opencode-server-runner.js +451 -0
- package/dist/core/opencode-server-runner.js.map +1 -0
- package/dist/core/opencode-ui-mapper.d.ts +105 -0
- package/dist/core/opencode-ui-mapper.js +578 -0
- package/dist/core/opencode-ui-mapper.js.map +1 -0
- package/dist/core/process-usage.d.ts +63 -0
- package/dist/core/process-usage.js +181 -0
- package/dist/core/process-usage.js.map +1 -0
- package/dist/core/runner-factory.d.ts +8 -0
- package/dist/core/runner-factory.js +22 -0
- package/dist/core/runner-factory.js.map +1 -0
- package/dist/core/tool-display.d.ts +27 -0
- package/dist/core/tool-display.js +150 -0
- package/dist/core/tool-display.js.map +1 -0
- package/dist/core/ui-events.d.ts +294 -0
- package/dist/core/ui-events.js +25 -0
- package/dist/core/ui-events.js.map +1 -0
- package/dist/index.js +0 -0
- package/dist/pack-check.d.ts +17 -0
- package/dist/pack-check.js +27 -0
- package/dist/pack-check.js.map +1 -0
- package/dist/planner.js +7 -3
- package/dist/planner.js.map +1 -1
- package/dist/runs/store.d.ts +5 -0
- package/dist/runs/store.js +3 -0
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/title-summary.d.ts +15 -0
- package/dist/runs/title-summary.js +84 -0
- package/dist/runs/title-summary.js.map +1 -0
- package/dist/runs/ui-event-sink.d.ts +81 -0
- package/dist/runs/ui-event-sink.js +210 -0
- package/dist/runs/ui-event-sink.js.map +1 -0
- package/dist/server/capabilities.d.ts +18 -0
- package/dist/server/capabilities.js +23 -0
- package/dist/server/capabilities.js.map +1 -0
- package/dist/server/forge/github.d.ts +39 -0
- package/dist/server/forge/github.js +369 -0
- package/dist/server/forge/github.js.map +1 -0
- package/dist/server/forge/index.d.ts +24 -0
- package/dist/server/forge/index.js +45 -0
- package/dist/server/forge/index.js.map +1 -0
- package/dist/server/forge/types.d.ts +80 -0
- package/dist/server/forge/types.js +2 -0
- package/dist/server/forge/types.js.map +1 -0
- package/dist/server/git-changes.d.ts +182 -0
- package/dist/server/git-changes.js +424 -0
- package/dist/server/git-changes.js.map +1 -0
- package/dist/server/open-in-app.d.ts +19 -0
- package/dist/server/open-in-app.js +134 -0
- package/dist/server/open-in-app.js.map +1 -0
- package/dist/server/server.js +34 -10
- package/dist/server/server.js.map +1 -1
- package/dist/server/static-ui.d.ts +49 -0
- package/dist/server/static-ui.js +92 -0
- package/dist/server/static-ui.js.map +1 -0
- package/dist/update-check.d.ts +12 -0
- package/dist/update-check.js +41 -0
- package/dist/update-check.js.map +1 -0
- package/dist/workflows/run.d.ts +3 -0
- package/dist/workflows/run.js +22 -7
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +16 -0
- package/dist/workflows/types.js +3 -1
- package/dist/workflows/types.js.map +1 -1
- package/package.json +1 -1
- package/web/app/node_modules/.vite/vitest/ca84d1343b96baa8137c943ed1860e522cacb238/results.json +1 -0
- package/web/app/src/components/app-shell-container.tsx +76 -0
- package/web/app.js +145 -18
- package/web/dist/assets/arrow-left-BE957rJs.js +1 -0
- package/web/dist/assets/bundle-mjs-DLPpRFyl.js +1 -0
- package/web/dist/assets/chunk-BO2N2NFS-f5igTtpB.js +131 -0
- package/web/dist/assets/compare-variants-D6fPL9cS.js +1 -0
- package/web/dist/assets/core-BuMqAF_1.js +12 -0
- package/web/dist/assets/css-BsVw1vtW.js +1 -0
- package/web/dist/assets/dialog-BEgEWFDS.js +1 -0
- package/web/dist/assets/diff-view-CctnJHWe.js +4 -0
- package/web/dist/assets/diff-woXpYk--.js +1 -0
- package/web/dist/assets/dist-CW7M_Jhs.js +1 -0
- package/web/dist/assets/ellipsis-vertical-DJPAfccS.js +1 -0
- package/web/dist/assets/engine-javascript-FQvzRocB.js +141 -0
- package/web/dist/assets/folder-RbRLfIX-.js +1 -0
- package/web/dist/assets/git-pull-request-DJkAMT0f.js +1 -0
- package/web/dist/assets/git-toolbar-D8OPPqBP.js +1 -0
- package/web/dist/assets/github-BYIHwIJB.js +1 -0
- package/web/dist/assets/go-rLFTqkRN.js +1 -0
- package/web/dist/assets/highlighted-body-OFNGDK62-DGHHie_q.js +1 -0
- package/web/dist/assets/highlighter-BKVEsACy.js +3 -0
- package/web/dist/assets/html-BY76lXLH.js +1 -0
- package/web/dist/assets/index-9qG98Orw.js +11 -0
- package/web/dist/assets/index-Bz_r8Jt3.css +2 -0
- package/web/dist/assets/input-BRsSo4xH.js +1 -0
- package/web/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/web/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/web/dist/assets/javascript-BgS3c2Ky.js +1 -0
- package/web/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/web/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/web/dist/assets/json-qhed-kSA.js +1 -0
- package/web/dist/assets/jsonc-CYpm1nAK.js +1 -0
- package/web/dist/assets/jsx-Bz0zcwM4.js +1 -0
- package/web/dist/assets/lib-CNGa3Dig.js +1 -0
- package/web/dist/assets/loader-circle-BV3DO9mE.js +1 -0
- package/web/dist/assets/markdown-BYOwaDjH.js +1 -0
- package/web/dist/assets/markdown-CR_HLGTs.js +1 -0
- package/web/dist/assets/mermaid-GHXKKRXX-DM2VsGBG.js +1 -0
- package/web/dist/assets/open-mercato-toBr6SOa.svg +11 -0
- package/web/dist/assets/python-gzcpVVnB.js +1 -0
- package/web/dist/assets/react-dom-Ddtik4qM.js +1 -0
- package/web/dist/assets/refresh-cw-DCa-Rlwz.js +1 -0
- package/web/dist/assets/repo-git-XTqlVOl2.js +1 -0
- package/web/dist/assets/run-diff-C7mfxj7f.js +3 -0
- package/web/dist/assets/run-header-CfVeY3uM.js +1 -0
- package/web/dist/assets/rust-Cfkwpbl8.js +1 -0
- package/web/dist/assets/search-x-CoCyl7zT.js +1 -0
- package/web/dist/assets/shellscript-CLZ0U2zV.js +1 -0
- package/web/dist/assets/skill-detail-C9cniyId.js +1 -0
- package/web/dist/assets/skills-DXgY1uXJ.js +1 -0
- package/web/dist/assets/skills-ynuO5oCr.js +1 -0
- package/web/dist/assets/sql-BsFa4tDR.js +1 -0
- package/web/dist/assets/square-terminal-B6PZX4Qp.js +1 -0
- package/web/dist/assets/tab-link-phWEqSBy.js +1 -0
- package/web/dist/assets/task-changes-DYwnPnTN.js +1 -0
- package/web/dist/assets/task-commits-DZzxEzbn.js +1 -0
- package/web/dist/assets/task-files-FOAAz2FB.js +2 -0
- package/web/dist/assets/task-thread-Bncxe8Os.js +5 -0
- package/web/dist/assets/toaster-BS2E1bhz.js +43 -0
- package/web/dist/assets/trash-2-CDtxmmc8.js +1 -0
- package/web/dist/assets/triangle-alert-6su4Js5O.js +1 -0
- package/web/dist/assets/tsx-udAQXfEw.js +1 -0
- package/web/dist/assets/typescript-bsJCZSQ-.js +1 -0
- package/web/dist/assets/upload-Bp7hQxll.js +1 -0
- package/web/dist/assets/use-desktop-eHm2iTXX.js +3 -0
- package/web/dist/assets/utils-rQGbOrwc.js +1 -0
- package/web/dist/assets/workflows-Dg2wQg6i.js +11 -0
- package/web/dist/assets/x-Br_jIDBw.js +1 -0
- package/web/dist/assets/yaml-rwi0_p6S.js +1 -0
- package/web/dist/index.html +67 -0
- package/web/index.html +1 -0
- package/web/style.css +28 -8
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live process telemetry for the Runs table (#348): while any run has a
|
|
3
|
+
* registered backend process, ONE `ps` snapshot every ~2 s is aggregated per
|
|
4
|
+
* run over the process's full descendant tree (the CLI plus every Bash child
|
|
5
|
+
* an agent spawned) into `{ cpuPct, rssBytes, procCount }`.
|
|
6
|
+
*
|
|
7
|
+
* Design constraints, in order:
|
|
8
|
+
* - never affect a run — a missing/failing `ps` (Windows, exotic containers)
|
|
9
|
+
* degrades silently to "no data";
|
|
10
|
+
* - one shared sampler, not one per run — N parallel runs still cost a
|
|
11
|
+
* single `ps` every tick, and the timer is unref()ed and stopped the
|
|
12
|
+
* moment the registry empties, so an idle cockpit spawns nothing;
|
|
13
|
+
* - parsing + tree aggregation are pure functions, testable against canned
|
|
14
|
+
* `ps` output (scripts/test-process-usage.mjs).
|
|
15
|
+
*/
|
|
16
|
+
/** One aggregated sample for a run's process tree. */
|
|
17
|
+
export interface ProcessUsage {
|
|
18
|
+
/** Sum of `%cpu` across the tree — can exceed 100 on multi-core work. */
|
|
19
|
+
cpuPct: number;
|
|
20
|
+
/** Sum of resident set sizes, in bytes. */
|
|
21
|
+
rssBytes: number;
|
|
22
|
+
/** Number of live processes in the tree, the root included. */
|
|
23
|
+
procCount: number;
|
|
24
|
+
}
|
|
25
|
+
/** One parsed `ps` row (`pid ppid rss %cpu`; rss is in KB, ps's unit). */
|
|
26
|
+
export interface ProcStat {
|
|
27
|
+
pid: number;
|
|
28
|
+
ppid: number;
|
|
29
|
+
rssKb: number;
|
|
30
|
+
cpuPct: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse `ps -axo pid=,ppid=,rss=,%cpu=` output (the `=` suffixes suppress
|
|
34
|
+
* headers on darwin and linux alike). Malformed lines are skipped — `ps`
|
|
35
|
+
* racing process exits can truncate rows.
|
|
36
|
+
*/
|
|
37
|
+
export declare function parsePsOutput(text: string): ProcStat[];
|
|
38
|
+
/**
|
|
39
|
+
* Aggregate the full descendant tree rooted at `rootPid` from one `ps`
|
|
40
|
+
* snapshot. Null when the root is gone (process exited between register and
|
|
41
|
+
* sample) — callers treat that as "no data", not zero usage.
|
|
42
|
+
*/
|
|
43
|
+
export declare function aggregateTreeUsage(procs: ProcStat[], rootPid: number): ProcessUsage | null;
|
|
44
|
+
export declare const SAMPLE_INTERVAL_MS = 2000;
|
|
45
|
+
type UsageListener = (usage: Record<string, ProcessUsage>) => void;
|
|
46
|
+
/** Start tracking a run's process tree. A re-register (a run's next agent
|
|
47
|
+
* step) replaces the pid but keeps nothing else — peaks are per session and
|
|
48
|
+
* the engine maxes them into the run record on unregister. */
|
|
49
|
+
export declare function registerRunProcess(runId: string, pid: number): void;
|
|
50
|
+
/** Stop tracking; returns the session's peaks (undefined when no sample ever
|
|
51
|
+
* landed — `ps` unavailable, or the process died before the first tick). */
|
|
52
|
+
export declare function unregisterRunProcess(runId: string): {
|
|
53
|
+
peakRssBytes: number;
|
|
54
|
+
peakProcCount: number;
|
|
55
|
+
} | undefined;
|
|
56
|
+
/** Latest sample for one run, if any. */
|
|
57
|
+
export declare function currentUsage(runId: string): ProcessUsage | undefined;
|
|
58
|
+
/** Latest samples for every registered run that has data. */
|
|
59
|
+
export declare function allUsage(): Record<string, ProcessUsage>;
|
|
60
|
+
/** Subscribe to fresh samples (fires ~every 2 s while runs are registered);
|
|
61
|
+
* returns the unsubscribe. The SSE endpoint relays these to the GUI. */
|
|
62
|
+
export declare function onUsage(listener: UsageListener): () => void;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live process telemetry for the Runs table (#348): while any run has a
|
|
3
|
+
* registered backend process, ONE `ps` snapshot every ~2 s is aggregated per
|
|
4
|
+
* run over the process's full descendant tree (the CLI plus every Bash child
|
|
5
|
+
* an agent spawned) into `{ cpuPct, rssBytes, procCount }`.
|
|
6
|
+
*
|
|
7
|
+
* Design constraints, in order:
|
|
8
|
+
* - never affect a run — a missing/failing `ps` (Windows, exotic containers)
|
|
9
|
+
* degrades silently to "no data";
|
|
10
|
+
* - one shared sampler, not one per run — N parallel runs still cost a
|
|
11
|
+
* single `ps` every tick, and the timer is unref()ed and stopped the
|
|
12
|
+
* moment the registry empties, so an idle cockpit spawns nothing;
|
|
13
|
+
* - parsing + tree aggregation are pure functions, testable against canned
|
|
14
|
+
* `ps` output (scripts/test-process-usage.mjs).
|
|
15
|
+
*/
|
|
16
|
+
import { execFile } from 'node:child_process';
|
|
17
|
+
/**
|
|
18
|
+
* Parse `ps -axo pid=,ppid=,rss=,%cpu=` output (the `=` suffixes suppress
|
|
19
|
+
* headers on darwin and linux alike). Malformed lines are skipped — `ps`
|
|
20
|
+
* racing process exits can truncate rows.
|
|
21
|
+
*/
|
|
22
|
+
export function parsePsOutput(text) {
|
|
23
|
+
const out = [];
|
|
24
|
+
for (const line of text.split('\n')) {
|
|
25
|
+
const parts = line.trim().split(/\s+/);
|
|
26
|
+
if (parts.length < 4)
|
|
27
|
+
continue;
|
|
28
|
+
const pid = Number(parts[0]);
|
|
29
|
+
const ppid = Number(parts[1]);
|
|
30
|
+
const rssKb = Number(parts[2]);
|
|
31
|
+
const cpuPct = Number(parts[3]);
|
|
32
|
+
if (!Number.isInteger(pid) || !Number.isInteger(ppid))
|
|
33
|
+
continue;
|
|
34
|
+
out.push({
|
|
35
|
+
pid,
|
|
36
|
+
ppid,
|
|
37
|
+
rssKb: Number.isFinite(rssKb) && rssKb > 0 ? rssKb : 0,
|
|
38
|
+
cpuPct: Number.isFinite(cpuPct) && cpuPct > 0 ? cpuPct : 0,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Aggregate the full descendant tree rooted at `rootPid` from one `ps`
|
|
45
|
+
* snapshot. Null when the root is gone (process exited between register and
|
|
46
|
+
* sample) — callers treat that as "no data", not zero usage.
|
|
47
|
+
*/
|
|
48
|
+
export function aggregateTreeUsage(procs, rootPid) {
|
|
49
|
+
const byPid = new Map();
|
|
50
|
+
const children = new Map();
|
|
51
|
+
for (const p of procs) {
|
|
52
|
+
byPid.set(p.pid, p);
|
|
53
|
+
const siblings = children.get(p.ppid);
|
|
54
|
+
if (siblings)
|
|
55
|
+
siblings.push(p.pid);
|
|
56
|
+
else
|
|
57
|
+
children.set(p.ppid, [p.pid]);
|
|
58
|
+
}
|
|
59
|
+
if (!byPid.has(rootPid))
|
|
60
|
+
return null;
|
|
61
|
+
let cpuPct = 0;
|
|
62
|
+
let rssKb = 0;
|
|
63
|
+
let procCount = 0;
|
|
64
|
+
const queue = [rootPid];
|
|
65
|
+
const seen = new Set(); // pid-reuse in a torn snapshot can't loop us
|
|
66
|
+
while (queue.length > 0) {
|
|
67
|
+
const pid = queue.pop();
|
|
68
|
+
if (seen.has(pid))
|
|
69
|
+
continue;
|
|
70
|
+
seen.add(pid);
|
|
71
|
+
const p = byPid.get(pid);
|
|
72
|
+
if (!p)
|
|
73
|
+
continue;
|
|
74
|
+
cpuPct += p.cpuPct;
|
|
75
|
+
rssKb += p.rssKb;
|
|
76
|
+
procCount += 1;
|
|
77
|
+
for (const child of children.get(pid) ?? [])
|
|
78
|
+
queue.push(child);
|
|
79
|
+
}
|
|
80
|
+
return { cpuPct: Math.round(cpuPct * 10) / 10, rssBytes: rssKb * 1024, procCount };
|
|
81
|
+
}
|
|
82
|
+
// ---- registry + sampler -----------------------------------------------------
|
|
83
|
+
export const SAMPLE_INTERVAL_MS = 2_000;
|
|
84
|
+
const entries = new Map();
|
|
85
|
+
const listeners = new Set();
|
|
86
|
+
let timer = null;
|
|
87
|
+
let sampling = false;
|
|
88
|
+
/** Start tracking a run's process tree. A re-register (a run's next agent
|
|
89
|
+
* step) replaces the pid but keeps nothing else — peaks are per session and
|
|
90
|
+
* the engine maxes them into the run record on unregister. */
|
|
91
|
+
export function registerRunProcess(runId, pid) {
|
|
92
|
+
entries.set(runId, { pid, peakRssBytes: 0, peakProcCount: 0 });
|
|
93
|
+
if (!timer) {
|
|
94
|
+
timer = setInterval(() => void sample(), SAMPLE_INTERVAL_MS);
|
|
95
|
+
timer.unref?.();
|
|
96
|
+
void sample(); // first data point right away, not 2 s late
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/** Stop tracking; returns the session's peaks (undefined when no sample ever
|
|
100
|
+
* landed — `ps` unavailable, or the process died before the first tick). */
|
|
101
|
+
export function unregisterRunProcess(runId) {
|
|
102
|
+
const entry = entries.get(runId);
|
|
103
|
+
entries.delete(runId);
|
|
104
|
+
if (entries.size === 0 && timer) {
|
|
105
|
+
clearInterval(timer);
|
|
106
|
+
timer = null;
|
|
107
|
+
}
|
|
108
|
+
if (!entry || entry.peakProcCount === 0)
|
|
109
|
+
return undefined;
|
|
110
|
+
return { peakRssBytes: entry.peakRssBytes, peakProcCount: entry.peakProcCount };
|
|
111
|
+
}
|
|
112
|
+
/** Latest sample for one run, if any. */
|
|
113
|
+
export function currentUsage(runId) {
|
|
114
|
+
return entries.get(runId)?.last;
|
|
115
|
+
}
|
|
116
|
+
/** Latest samples for every registered run that has data. */
|
|
117
|
+
export function allUsage() {
|
|
118
|
+
const out = {};
|
|
119
|
+
for (const [runId, entry] of entries) {
|
|
120
|
+
if (entry.last)
|
|
121
|
+
out[runId] = entry.last;
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
/** Subscribe to fresh samples (fires ~every 2 s while runs are registered);
|
|
126
|
+
* returns the unsubscribe. The SSE endpoint relays these to the GUI. */
|
|
127
|
+
export function onUsage(listener) {
|
|
128
|
+
listeners.add(listener);
|
|
129
|
+
return () => listeners.delete(listener);
|
|
130
|
+
}
|
|
131
|
+
async function sample() {
|
|
132
|
+
if (sampling || entries.size === 0)
|
|
133
|
+
return;
|
|
134
|
+
sampling = true;
|
|
135
|
+
try {
|
|
136
|
+
const text = await runPs();
|
|
137
|
+
if (text === null)
|
|
138
|
+
return; // ps unavailable — degrade to no data
|
|
139
|
+
const procs = parsePsOutput(text);
|
|
140
|
+
for (const entry of entries.values()) {
|
|
141
|
+
const usage = aggregateTreeUsage(procs, entry.pid);
|
|
142
|
+
entry.last = usage ?? undefined;
|
|
143
|
+
if (usage) {
|
|
144
|
+
entry.peakRssBytes = Math.max(entry.peakRssBytes, usage.rssBytes);
|
|
145
|
+
entry.peakProcCount = Math.max(entry.peakProcCount, usage.procCount);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (listeners.size > 0) {
|
|
149
|
+
const snapshot = allUsage();
|
|
150
|
+
for (const listener of listeners) {
|
|
151
|
+
try {
|
|
152
|
+
listener(snapshot);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
// a broken SSE stream must not kill the sampler
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
sampling = false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/** One system-wide snapshot in the `pid ppid rssKb cpu` shape `parsePsOutput` expects; null on
|
|
165
|
+
* any failure. Unix uses `ps`; Windows uses PowerShell's Win32_Process (WorkingSetSize → KB,
|
|
166
|
+
* cpu reported as 0 — the memory guard only needs RSS). */
|
|
167
|
+
function runPs() {
|
|
168
|
+
if (process.platform === 'win32') {
|
|
169
|
+
return new Promise((resolve) => {
|
|
170
|
+
execFile('powershell', [
|
|
171
|
+
'-NoProfile',
|
|
172
|
+
'-Command',
|
|
173
|
+
"Get-CimInstance Win32_Process | ForEach-Object { \"$($_.ProcessId) $($_.ParentProcessId) $([math]::Round($_.WorkingSetSize/1024)) 0\" }",
|
|
174
|
+
], { maxBuffer: 16 * 1024 * 1024, windowsHide: true }, (err, stdout) => resolve(err ? null : stdout));
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return new Promise((resolve) => {
|
|
178
|
+
execFile('ps', ['-axo', 'pid=,ppid=,rss=,%cpu='], { maxBuffer: 16 * 1024 * 1024 }, (err, stdout) => resolve(err ? null : stdout));
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=process-usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-usage.js","sourceRoot":"","sources":["../../src/core/process-usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAoB9C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,MAAM,GAAG,GAAe,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,SAAS;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,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,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,QAAQ,GAAG,KAAK,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;4DAE4D;AAC5D,SAAS,KAAK;IACZ,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,QAAQ,CACN,YAAY,EACZ;gBACE,YAAY;gBACZ,UAAU;gBACV,yIAAyI;aAC1I,EACD,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EAClD,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAC9C,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,QAAQ,CACN,IAAI,EACJ,CAAC,MAAM,EAAE,uBAAuB,CAAC,EACjC,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,EAC/B,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAC9C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgentBackend, AgentRunner, RunnerId } from './agent-runner.js';
|
|
2
|
+
/**
|
|
3
|
+
* The single place that maps a backend id onto a concrete runner. Everything
|
|
4
|
+
* that used to `new ClaudeCliRunner()` (the planner and the workflow engine)
|
|
5
|
+
* goes through here so switching the agent backend is one function call.
|
|
6
|
+
* `claude-cli` is the legacy id for `claude`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createRunner(backend: AgentBackend | RunnerId | undefined): AgentRunner;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ClaudeCliRunner } from './claude-cli-runner.js';
|
|
2
|
+
import { CodexAppServerRunner } from './codex-app-server-runner.js';
|
|
3
|
+
import { OpencodeServerRunner } from './opencode-server-runner.js';
|
|
4
|
+
/**
|
|
5
|
+
* The single place that maps a backend id onto a concrete runner. Everything
|
|
6
|
+
* that used to `new ClaudeCliRunner()` (the planner and the workflow engine)
|
|
7
|
+
* goes through here so switching the agent backend is one function call.
|
|
8
|
+
* `claude-cli` is the legacy id for `claude`.
|
|
9
|
+
*/
|
|
10
|
+
export function createRunner(backend) {
|
|
11
|
+
switch (backend) {
|
|
12
|
+
case 'codex':
|
|
13
|
+
return new CodexAppServerRunner();
|
|
14
|
+
case 'opencode':
|
|
15
|
+
return new OpencodeServerRunner();
|
|
16
|
+
case 'claude':
|
|
17
|
+
case 'claude-cli':
|
|
18
|
+
default:
|
|
19
|
+
return new ClaudeCliRunner();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=runner-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-factory.js","sourceRoot":"","sources":["../../src/core/runner-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,OAA4C;IACvE,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,OAAO;YACV,OAAO,IAAI,oBAAoB,EAAE,CAAC;QACpC,KAAK,UAAU;YACb,OAAO,IAAI,oBAAoB,EAAE,CAAC;QACpC,KAAK,QAAQ,CAAC;QACd,KAAK,YAAY,CAAC;QAClB;YACE,OAAO,IAAI,eAAe,EAAE,CAAC;IACjC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool display model — turns a backend tool name + raw input into the
|
|
3
|
+
* `{toolKind, title, subtitle?}` a tool card renders. Computed ONCE here in
|
|
4
|
+
* the protocol layer (paseo's pattern), never in components, so the thread,
|
|
5
|
+
* activity groups and notifications all say the same thing.
|
|
6
|
+
*
|
|
7
|
+
* Pure function over untrusted input: tool inputs come off the wire and may
|
|
8
|
+
* be null, partial (streamed incrementally) or arbitrarily malformed —
|
|
9
|
+
* `toolDisplay` must never throw.
|
|
10
|
+
*
|
|
11
|
+
* Known names covered (matched case-insensitively so claude's `Bash` and
|
|
12
|
+
* opencode's `bash` share one row):
|
|
13
|
+
* - claude: Bash, Edit, Write, NotebookEdit, Read, Glob, Grep, WebFetch,
|
|
14
|
+
* WebSearch, Task, TodoWrite, mcp__server__tool
|
|
15
|
+
* - codex: commandExecution, fileChange, mcpToolCall, webSearch,
|
|
16
|
+
* todoList, plan
|
|
17
|
+
* - opencode: bash, edit, write, read, grep, glob, webfetch, task, todowrite
|
|
18
|
+
*/
|
|
19
|
+
import type { ToolKind } from './ui-events.js';
|
|
20
|
+
export interface ToolDisplay {
|
|
21
|
+
toolKind: ToolKind;
|
|
22
|
+
/** Human line for the card trigger, e.g. "Ran npm test". */
|
|
23
|
+
title: string;
|
|
24
|
+
/** Secondary detail, e.g. the claude Bash `description`. */
|
|
25
|
+
subtitle?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function toolDisplay(name: string, input?: unknown): ToolDisplay;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool display model — turns a backend tool name + raw input into the
|
|
3
|
+
* `{toolKind, title, subtitle?}` a tool card renders. Computed ONCE here in
|
|
4
|
+
* the protocol layer (paseo's pattern), never in components, so the thread,
|
|
5
|
+
* activity groups and notifications all say the same thing.
|
|
6
|
+
*
|
|
7
|
+
* Pure function over untrusted input: tool inputs come off the wire and may
|
|
8
|
+
* be null, partial (streamed incrementally) or arbitrarily malformed —
|
|
9
|
+
* `toolDisplay` must never throw.
|
|
10
|
+
*
|
|
11
|
+
* Known names covered (matched case-insensitively so claude's `Bash` and
|
|
12
|
+
* opencode's `bash` share one row):
|
|
13
|
+
* - claude: Bash, Edit, Write, NotebookEdit, Read, Glob, Grep, WebFetch,
|
|
14
|
+
* WebSearch, Task, TodoWrite, mcp__server__tool
|
|
15
|
+
* - codex: commandExecution, fileChange, mcpToolCall, webSearch,
|
|
16
|
+
* todoList, plan
|
|
17
|
+
* - opencode: bash, edit, write, read, grep, glob, webfetch, task, todowrite
|
|
18
|
+
*/
|
|
19
|
+
/** Longest title/subtitle we emit — display truncation belongs here, not in
|
|
20
|
+
* every component that renders a tool line. */
|
|
21
|
+
const MAX_LABEL = 120;
|
|
22
|
+
function isRecord(value) {
|
|
23
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
24
|
+
}
|
|
25
|
+
/** Collapse whitespace (multi-line commands become one line) and cap length. */
|
|
26
|
+
function oneLine(text) {
|
|
27
|
+
const collapsed = text.replace(/\s+/g, ' ').trim();
|
|
28
|
+
return collapsed.length > MAX_LABEL ? `${collapsed.slice(0, MAX_LABEL - 1)}…` : collapsed;
|
|
29
|
+
}
|
|
30
|
+
/** First non-empty string among `input[keys...]`, normalized for display. */
|
|
31
|
+
function field(input, ...keys) {
|
|
32
|
+
if (!isRecord(input))
|
|
33
|
+
return undefined;
|
|
34
|
+
for (const key of keys) {
|
|
35
|
+
const value = input[key];
|
|
36
|
+
if (typeof value === 'string' && value.trim() !== '')
|
|
37
|
+
return oneLine(value);
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
/** claude Bash carries `command: string`; codex commandExecution may carry
|
|
42
|
+
* a string or an argv array — join the string members. */
|
|
43
|
+
function commandText(input) {
|
|
44
|
+
if (!isRecord(input))
|
|
45
|
+
return undefined;
|
|
46
|
+
const command = input.command;
|
|
47
|
+
if (typeof command === 'string' && command.trim() !== '')
|
|
48
|
+
return oneLine(command);
|
|
49
|
+
if (Array.isArray(command)) {
|
|
50
|
+
const argv = command.filter((part) => typeof part === 'string');
|
|
51
|
+
if (argv.length > 0)
|
|
52
|
+
return oneLine(argv.join(' '));
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
/** File paths listed by a codex `fileChange` item (`changes: [{path}]`). */
|
|
57
|
+
function changePaths(input) {
|
|
58
|
+
if (!isRecord(input) || !Array.isArray(input.changes))
|
|
59
|
+
return [];
|
|
60
|
+
const paths = [];
|
|
61
|
+
for (const change of input.changes) {
|
|
62
|
+
if (isRecord(change) && typeof change.path === 'string' && change.path.trim() !== '') {
|
|
63
|
+
paths.push(change.path);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return paths;
|
|
67
|
+
}
|
|
68
|
+
/** The opencode research heuristic for unknown tools: the first plausible
|
|
69
|
+
* human label in the input, in a fixed priority order. */
|
|
70
|
+
function heuristicLabel(input) {
|
|
71
|
+
return field(input, 'description', 'query', 'url', 'filePath', 'file_path', 'path', 'pattern', 'name');
|
|
72
|
+
}
|
|
73
|
+
/** Verb + optional object → "Read src/a.ts", or just the verb when the
|
|
74
|
+
* input gave us nothing usable. */
|
|
75
|
+
function titled(verb, label) {
|
|
76
|
+
return label ? `${verb} ${label}` : verb;
|
|
77
|
+
}
|
|
78
|
+
export function toolDisplay(name, input) {
|
|
79
|
+
const key = typeof name === 'string' ? name.toLowerCase() : '';
|
|
80
|
+
switch (key) {
|
|
81
|
+
case 'bash':
|
|
82
|
+
case 'commandexecution':
|
|
83
|
+
return {
|
|
84
|
+
toolKind: 'execute',
|
|
85
|
+
title: titled('Ran', commandText(input)),
|
|
86
|
+
subtitle: field(input, 'description'),
|
|
87
|
+
};
|
|
88
|
+
case 'edit':
|
|
89
|
+
case 'multiedit':
|
|
90
|
+
return { toolKind: 'edit', title: titled('Edit', field(input, 'file_path', 'filePath', 'path')) };
|
|
91
|
+
case 'write':
|
|
92
|
+
return { toolKind: 'edit', title: titled('Write', field(input, 'file_path', 'filePath', 'path')) };
|
|
93
|
+
case 'notebookedit':
|
|
94
|
+
return {
|
|
95
|
+
toolKind: 'edit',
|
|
96
|
+
title: titled('Edit', field(input, 'notebook_path', 'notebookPath', 'file_path', 'filePath', 'path')),
|
|
97
|
+
};
|
|
98
|
+
case 'filechange': {
|
|
99
|
+
const paths = changePaths(input);
|
|
100
|
+
const label = paths.length === 1 ? paths[0] : paths.length > 1 ? `${paths.length} files` : undefined;
|
|
101
|
+
return { toolKind: 'edit', title: titled('Edit', label) };
|
|
102
|
+
}
|
|
103
|
+
case 'read':
|
|
104
|
+
return { toolKind: 'read', title: titled('Read', field(input, 'file_path', 'filePath', 'path')) };
|
|
105
|
+
case 'glob':
|
|
106
|
+
case 'grep':
|
|
107
|
+
return {
|
|
108
|
+
toolKind: 'search',
|
|
109
|
+
title: titled('Search', field(input, 'pattern', 'query')),
|
|
110
|
+
subtitle: field(input, 'path'),
|
|
111
|
+
};
|
|
112
|
+
case 'webfetch':
|
|
113
|
+
return { toolKind: 'fetch', title: titled('Fetch', field(input, 'url')) };
|
|
114
|
+
case 'websearch':
|
|
115
|
+
return { toolKind: 'fetch', title: titled('Web search', field(input, 'query')) };
|
|
116
|
+
case 'task': {
|
|
117
|
+
const description = field(input, 'description', 'prompt');
|
|
118
|
+
return {
|
|
119
|
+
toolKind: 'task',
|
|
120
|
+
title: description ? `Task: ${description}` : 'Task',
|
|
121
|
+
subtitle: field(input, 'subagent_type', 'subagentType'),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
case 'todowrite':
|
|
125
|
+
case 'todolist':
|
|
126
|
+
case 'plan':
|
|
127
|
+
return { toolKind: 'plan', title: 'Update plan' };
|
|
128
|
+
case 'mcptoolcall': {
|
|
129
|
+
const server = field(input, 'server');
|
|
130
|
+
const tool = field(input, 'tool');
|
|
131
|
+
if (server && tool)
|
|
132
|
+
return { toolKind: 'other', title: `${server}.${tool}` };
|
|
133
|
+
return { toolKind: 'other', title: 'MCP tool', subtitle: heuristicLabel(input) };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// claude/opencode MCP tools are named `mcp__server__tool` → "server.tool".
|
|
137
|
+
if (key.startsWith('mcp__')) {
|
|
138
|
+
const parts = name.split('__').filter((part) => part !== '');
|
|
139
|
+
if (parts.length >= 3) {
|
|
140
|
+
return { toolKind: 'other', title: `${parts[1]}.${parts.slice(2).join('__')}` };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// Unknown tool: keep the backend's name as the title, heuristic subtitle.
|
|
144
|
+
return {
|
|
145
|
+
toolKind: 'other',
|
|
146
|
+
title: typeof name === 'string' && name.trim() !== '' ? oneLine(name) : 'Tool',
|
|
147
|
+
subtitle: heuristicLabel(input),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=tool-display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-display.js","sourceRoot":"","sources":["../../src/core/tool-display.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAYH;gDACgD;AAChD,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,gFAAgF;AAChF,SAAS,OAAO,CAAC,IAAY;IAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACnD,OAAO,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,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