@synaplink/orqlaude 0.5.6 → 0.7.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.
- package/README.md +36 -3
- package/dist/__tests__/v06.test.d.ts +1 -0
- package/dist/__tests__/v06.test.js +74 -0
- package/dist/__tests__/v06.test.js.map +1 -0
- package/dist/__tests__/v07.test.d.ts +1 -0
- package/dist/__tests__/v07.test.js +124 -0
- package/dist/__tests__/v07.test.js.map +1 -0
- package/dist/cli/about.d.ts +5 -0
- package/dist/cli/about.js +27 -0
- package/dist/cli/about.js.map +1 -0
- package/dist/cli/doctor.d.ts +1 -0
- package/dist/cli/doctor.js +180 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/easter_egg.d.ts +1 -0
- package/dist/cli/easter_egg.js +92 -0
- package/dist/cli/easter_egg.js.map +1 -0
- package/dist/cli/open.d.ts +6 -0
- package/dist/cli/open.js +57 -0
- package/dist/cli/open.js.map +1 -0
- package/dist/cli/taglines.d.ts +12 -0
- package/dist/cli/taglines.js +163 -0
- package/dist/cli/taglines.js.map +1 -0
- package/dist/cli/tail.d.ts +7 -0
- package/dist/cli/tail.js +87 -0
- package/dist/cli/tail.js.map +1 -0
- package/dist/cli/watch.d.ts +1 -0
- package/dist/cli/watch.js +169 -0
- package/dist/cli/watch.js.map +1 -0
- package/dist/cli.js +234 -43
- package/dist/cli.js.map +1 -1
- package/dist/lib/error_ui.d.ts +21 -0
- package/dist/lib/error_ui.js +59 -0
- package/dist/lib/error_ui.js.map +1 -0
- package/dist/lib/json_out.d.ts +9 -0
- package/dist/lib/json_out.js +15 -0
- package/dist/lib/json_out.js.map +1 -0
- package/dist/lib/notifications.d.ts +14 -0
- package/dist/lib/notifications.js +37 -0
- package/dist/lib/notifications.js.map +1 -0
- package/dist/lib/picker.d.ts +6 -0
- package/dist/lib/picker.js +50 -0
- package/dist/lib/picker.js.map +1 -0
- package/dist/lib/preferences.d.ts +25 -0
- package/dist/lib/preferences.js +32 -0
- package/dist/lib/preferences.js.map +1 -0
- package/dist/lib/process_lib.d.ts +8 -0
- package/dist/lib/process_lib.js +26 -0
- package/dist/lib/process_lib.js.map +1 -0
- package/dist/lib/spawn_cli.d.ts +31 -40
- package/dist/lib/spawn_cli.js +101 -55
- package/dist/lib/spawn_cli.js.map +1 -1
- package/dist/lib/state.d.ts +14 -1
- package/dist/lib/state.js.map +1 -1
- package/dist/lib/update_check.d.ts +1 -0
- package/dist/lib/update_check.js +78 -0
- package/dist/lib/update_check.js.map +1 -0
- package/dist/server.js +1 -1
- package/dist/telegram/notifier.js +30 -0
- package/dist/telegram/notifier.js.map +1 -1
- package/dist/tools/dispatch.js +66 -10
- package/dist/tools/dispatch.js.map +1 -1
- package/dist/tools/ping.js +1 -1
- package/package.json +1 -1
package/dist/cli/open.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
import { StateStore } from "../lib/state.js";
|
|
3
|
+
import { style } from "../lib/style.js";
|
|
4
|
+
/**
|
|
5
|
+
* `orql open <plan_id>` — open every PR URL the fleet produced in the
|
|
6
|
+
* default browser, plus print worktree paths for tasks that don't yet
|
|
7
|
+
* have PRs.
|
|
8
|
+
*/
|
|
9
|
+
export async function openPlan(stateDir, planId) {
|
|
10
|
+
const store = new StateStore(stateDir);
|
|
11
|
+
let plan;
|
|
12
|
+
try {
|
|
13
|
+
plan = await store.read((s) => {
|
|
14
|
+
const p = s.plans[planId] ?? Object.values(s.plans).find((x) => x.id.startsWith(planId));
|
|
15
|
+
if (!p)
|
|
16
|
+
throw new Error(`Plan not found: ${planId}`);
|
|
17
|
+
return p;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
process.stderr.write(style.crimson(`✗ ${err.message}\n`));
|
|
22
|
+
return 1;
|
|
23
|
+
}
|
|
24
|
+
const withPr = plan.tasks.filter((t) => t.prUrl);
|
|
25
|
+
const withoutPr = plan.tasks.filter((t) => !t.prUrl);
|
|
26
|
+
if (withPr.length === 0 && withoutPr.length === 0) {
|
|
27
|
+
process.stdout.write(style.sand("Plan has no tasks.\n"));
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
if (withPr.length > 0) {
|
|
31
|
+
process.stdout.write(`${style.bold(style.cream("Opening"))} ${withPr.length} PR(s) in your default browser:\n`);
|
|
32
|
+
for (const t of withPr) {
|
|
33
|
+
process.stdout.write(` ${style.coral("→")} ${t.prUrl} ${style.dim(`(${t.agnetName ? "Agnet " + t.agnetName : t.title})`)}\n`);
|
|
34
|
+
openUrl(t.prUrl);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (withoutPr.length > 0) {
|
|
38
|
+
process.stdout.write("\n" + style.sand("Tasks without PRs yet:") + "\n");
|
|
39
|
+
for (const t of withoutPr) {
|
|
40
|
+
const agnet = t.agnetName ? "Agnet " + t.agnetName : "Agnet";
|
|
41
|
+
process.stdout.write(` ${style.sand("·")} ${agnet} ${style.dim(t.title)}\n`);
|
|
42
|
+
if (t.worktreePath)
|
|
43
|
+
process.stdout.write(` ${style.sand("worktree:")} ${t.worktreePath}\n`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
function openUrl(url) {
|
|
49
|
+
try {
|
|
50
|
+
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
51
|
+
execSync(`${cmd} "${url}"`, { stdio: "ignore" });
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
/* swallow */
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../src/cli/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,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/E,IAAI,CAAC,CAAC,YAAY;gBAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC;QAClG,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,OAAO,CAAC,GAAW;IAC1B,IAAI,CAAC;QACH,MAAM,GAAG,GACP,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;QAC/F,QAAQ,CAAC,GAAG,GAAG,KAAK,GAAG,GAAG,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,aAAa;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 149 creative variants of the orqlaude tagline.
|
|
3
|
+
*
|
|
4
|
+
* Used by the bare-`orql` easter egg (src/cli/easter_egg.ts): a random
|
|
5
|
+
* tagline is typed out, paused, erased, and the cycle repeats. The
|
|
6
|
+
* picker guarantees consecutive picks are never the same string.
|
|
7
|
+
*
|
|
8
|
+
* Index 0 is the "canonical" descriptive tagline used elsewhere as a
|
|
9
|
+
* watermark fallback. The rest are intentionally varied — technical,
|
|
10
|
+
* playful, poetic, self-aware — to keep the easter egg interesting.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TAGLINES: readonly string[];
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 149 creative variants of the orqlaude tagline.
|
|
3
|
+
*
|
|
4
|
+
* Used by the bare-`orql` easter egg (src/cli/easter_egg.ts): a random
|
|
5
|
+
* tagline is typed out, paused, erased, and the cycle repeats. The
|
|
6
|
+
* picker guarantees consecutive picks are never the same string.
|
|
7
|
+
*
|
|
8
|
+
* Index 0 is the "canonical" descriptive tagline used elsewhere as a
|
|
9
|
+
* watermark fallback. The rest are intentionally varied — technical,
|
|
10
|
+
* playful, poetic, self-aware — to keep the easter egg interesting.
|
|
11
|
+
*/
|
|
12
|
+
export const TAGLINES = [
|
|
13
|
+
"multi-agent orchestrator for Claude Code",
|
|
14
|
+
"a fleet of Agnets, one tame Claude",
|
|
15
|
+
"parallel Claudes, sane budget",
|
|
16
|
+
"herding cats — but the cats are Claudes",
|
|
17
|
+
"like git, but for Claude sessions",
|
|
18
|
+
"one approval, N pull requests",
|
|
19
|
+
"tmux for the AI age",
|
|
20
|
+
"the conductor your fleet was missing",
|
|
21
|
+
"teaching Claude to delegate",
|
|
22
|
+
"one Claude, many Agnets",
|
|
23
|
+
"because one Claude is never enough",
|
|
24
|
+
"fan-out, fan-in, ship",
|
|
25
|
+
"parallel thought, serial commits",
|
|
26
|
+
"branching by intent, not just by git",
|
|
27
|
+
"concurrency for cognition",
|
|
28
|
+
"orchestration, with budget caps",
|
|
29
|
+
"plans, prompts, Agnets, PRs",
|
|
30
|
+
"for when one window isn't enough",
|
|
31
|
+
"spawn → broker → collect",
|
|
32
|
+
"let Claude split itself",
|
|
33
|
+
"cap your fleet, watch them ship",
|
|
34
|
+
"coral-colored coordination",
|
|
35
|
+
"the foreman your repo needed",
|
|
36
|
+
"distributed thinking, atomic commits",
|
|
37
|
+
"a brokerage for Agnets",
|
|
38
|
+
"budget-aware parallelism",
|
|
39
|
+
"an MCP that orchestrates other MCPs",
|
|
40
|
+
"tasks in, branches out",
|
|
41
|
+
"Agnets shipping in formation",
|
|
42
|
+
"one master Claude, many apprentices",
|
|
43
|
+
"the swarm protocol",
|
|
44
|
+
"structured chaos",
|
|
45
|
+
"when one Claude meets many problems",
|
|
46
|
+
"parallel coding, serial review",
|
|
47
|
+
"let Claude phone a friend (and a friend, and a friend)",
|
|
48
|
+
"multi-process minds",
|
|
49
|
+
"fan-out PRs for grown-ups",
|
|
50
|
+
"token budgets and worktree isolation",
|
|
51
|
+
"each Agnet in its own room",
|
|
52
|
+
"orchestration without the spreadsheet",
|
|
53
|
+
"ten Agnets, one approval",
|
|
54
|
+
'the answer to "this would be faster with five Claudes"',
|
|
55
|
+
"herd your AI like livestock",
|
|
56
|
+
"for tasks too big for one mind",
|
|
57
|
+
"supervised parallelism",
|
|
58
|
+
"Claude × N, with rails",
|
|
59
|
+
"one Claude conducts, the rest perform",
|
|
60
|
+
"parallel reads, parallel writes, single source of truth",
|
|
61
|
+
"multi-track recording for code",
|
|
62
|
+
"the band conductor for your AI orchestra",
|
|
63
|
+
"divide, conquer, merge",
|
|
64
|
+
"distributed cognition, concentrated effort",
|
|
65
|
+
"Agnets work in parallel; you stay in control",
|
|
66
|
+
"less waiting, more shipping",
|
|
67
|
+
"let Claude scale horizontally",
|
|
68
|
+
"think wider, ship faster",
|
|
69
|
+
"parallel Claudes without the chaos",
|
|
70
|
+
"the missing primitive for AI fleets",
|
|
71
|
+
"token-budget orchestration",
|
|
72
|
+
"spawn N Claudes, get N PRs",
|
|
73
|
+
"broker, observer, conductor",
|
|
74
|
+
"the choir director for code-writing",
|
|
75
|
+
"simultaneous reasoning, sequential merges",
|
|
76
|
+
"multi-Agnet fleets that don't collide",
|
|
77
|
+
"one fleet, no friction",
|
|
78
|
+
'when "let me also do X" needs a budget',
|
|
79
|
+
"mass-produced thinking, hand-finished code",
|
|
80
|
+
"concurrent Claudes, atomic merges",
|
|
81
|
+
"one orchestrator, many soloists",
|
|
82
|
+
"coordinated Agnets, isolated worktrees",
|
|
83
|
+
"a fleet manager for the AI age",
|
|
84
|
+
"teach Claude to fan-out",
|
|
85
|
+
"multi-window thinking, single-window approval",
|
|
86
|
+
"one Claude can't, so we spawn more",
|
|
87
|
+
"fleet command for code",
|
|
88
|
+
"shipping at the speed of N",
|
|
89
|
+
"the air-traffic control for your Agnets",
|
|
90
|
+
"one approval gate, many ships",
|
|
91
|
+
"orchestrated minds, isolated workspaces",
|
|
92
|
+
"budget the fleet, watch them fly",
|
|
93
|
+
"distributed Claudes, focused work",
|
|
94
|
+
"one human, one approval, N Claudes",
|
|
95
|
+
"Agnet management, not micromanagement",
|
|
96
|
+
"Claude clone army (but tame)",
|
|
97
|
+
"parallel intent, serialized merges",
|
|
98
|
+
"the conductor for your Claude symphony",
|
|
99
|
+
"one mind sets direction, many minds execute",
|
|
100
|
+
"concurrent Claudes, harmonious git",
|
|
101
|
+
"fleet-as-a-pattern",
|
|
102
|
+
"multi-Claude scaffolding",
|
|
103
|
+
"parallel coding with safety rails",
|
|
104
|
+
"one ledger, many Agnets",
|
|
105
|
+
"ship more, supervise less",
|
|
106
|
+
"distributed reasoning, focused output",
|
|
107
|
+
"let Claude scale you, not stress you",
|
|
108
|
+
"fan-out, fan-in, applaud",
|
|
109
|
+
"multi-tab thinking for code",
|
|
110
|
+
"parallel Claudes that actually finish",
|
|
111
|
+
"concurrent thinking, ordered shipping",
|
|
112
|
+
"fleet captain for your AI",
|
|
113
|
+
"one approval gate, ten ships",
|
|
114
|
+
"parallel Claudes, single source of truth",
|
|
115
|
+
"multi-Claude with worktree isolation",
|
|
116
|
+
"fan-out is easy; fan-in is what we do",
|
|
117
|
+
"budgeted parallelism, predictable cost",
|
|
118
|
+
"coordinated Agnets, isolated repos",
|
|
119
|
+
"Claude scaling for grown-ups",
|
|
120
|
+
"structured parallelism for AI",
|
|
121
|
+
"distributed thinking, concentrated approval",
|
|
122
|
+
"multi-window minds, single-window decision",
|
|
123
|
+
"concurrent coding, atomic commits",
|
|
124
|
+
"orchestrated minds, isolated bodies",
|
|
125
|
+
"parallel reasoning with budgets",
|
|
126
|
+
"fleet protocol for Claude",
|
|
127
|
+
"one approval, many merges",
|
|
128
|
+
"parallel Agnets that share what matters",
|
|
129
|
+
"structured ways to spawn Claudes",
|
|
130
|
+
"concurrent Claudes with manners",
|
|
131
|
+
"the missing layer for AI fleets",
|
|
132
|
+
"parallel intent, structured shipping",
|
|
133
|
+
"coordinated minds, isolated worktrees",
|
|
134
|
+
"fleet-mode for Claude",
|
|
135
|
+
"one Claude reads, many Claudes write",
|
|
136
|
+
"multi-Claude scaffolding with budgets",
|
|
137
|
+
"structured fan-out for AI",
|
|
138
|
+
"orchestrated Claudes, predictable output",
|
|
139
|
+
"parallel coding with broker rails",
|
|
140
|
+
"fleet management for the new age",
|
|
141
|
+
"multi-Claude coordination",
|
|
142
|
+
"one approval, N parallel shipments",
|
|
143
|
+
"distributed Claudes, central authority",
|
|
144
|
+
"parallel Agnets, central ledger",
|
|
145
|
+
"structured AI parallelism",
|
|
146
|
+
"fleet-shape for Claude work",
|
|
147
|
+
"parallel coding with one foreman",
|
|
148
|
+
"one ledger, many parallel ships",
|
|
149
|
+
"orchestrated reasoning at scale",
|
|
150
|
+
"concurrent Claudes with safety nets",
|
|
151
|
+
"parallel intent, ordered execution",
|
|
152
|
+
"fleet-aware Claude orchestration",
|
|
153
|
+
"coordinated AI workers, isolated workspaces",
|
|
154
|
+
"structured ways to spawn N Claudes",
|
|
155
|
+
"parallel Agnets with shared awareness",
|
|
156
|
+
"fleet command, AI-flavored",
|
|
157
|
+
"orchestrated minds with budget caps",
|
|
158
|
+
"parallel Claudes, single approval",
|
|
159
|
+
"ship N PRs in the time it takes for one",
|
|
160
|
+
"the multi-Claude pattern, productized",
|
|
161
|
+
"designed for the kind of task that wants a swarm",
|
|
162
|
+
];
|
|
163
|
+
//# sourceMappingURL=taglines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taglines.js","sourceRoot":"","sources":["../../src/cli/taglines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAsB;IACzC,0CAA0C;IAC1C,oCAAoC;IACpC,+BAA+B;IAC/B,yCAAyC;IACzC,mCAAmC;IACnC,+BAA+B;IAC/B,qBAAqB;IACrB,sCAAsC;IACtC,6BAA6B;IAC7B,yBAAyB;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IAC3B,uCAAuC;IACvC,sCAAsC;IACtC,0BAA0B;IAC1B,6BAA6B;IAC7B,uCAAuC;IACvC,uCAAuC;IACvC,2BAA2B;IAC3B,8BAA8B;IAC9B,0CAA0C;IAC1C,sCAAsC;IACtC,uCAAuC;IACvC,wCAAwC;IACxC,oCAAoC;IACpC,8BAA8B;IAC9B,+BAA+B;IAC/B,6CAA6C;IAC7C,4CAA4C;IAC5C,mCAAmC;IACnC,qCAAqC;IACrC,iCAAiC;IACjC,2BAA2B;IAC3B,2BAA2B;IAC3B,yCAAyC;IACzC,kCAAkC;IAClC,iCAAiC;IACjC,iCAAiC;IACjC,sCAAsC;IACtC,uCAAuC;IACvC,uBAAuB;IACvB,sCAAsC;IACtC,uCAAuC;IACvC,2BAA2B;IAC3B,0CAA0C;IAC1C,mCAAmC;IACnC,kCAAkC;IAClC,2BAA2B;IAC3B,oCAAoC;IACpC,wCAAwC;IACxC,iCAAiC;IACjC,2BAA2B;IAC3B,6BAA6B;IAC7B,kCAAkC;IAClC,iCAAiC;IACjC,iCAAiC;IACjC,qCAAqC;IACrC,oCAAoC;IACpC,kCAAkC;IAClC,6CAA6C;IAC7C,oCAAoC;IACpC,uCAAuC;IACvC,4BAA4B;IAC5B,qCAAqC;IACrC,mCAAmC;IACnC,yCAAyC;IACzC,uCAAuC;IACvC,kDAAkD;CACnD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `orql tail` — live stream of audit log events.
|
|
3
|
+
*
|
|
4
|
+
* Prints existing events on start, then watches the file for appends and
|
|
5
|
+
* renders new lines as they land. Colored by status (ok/err) + tool.
|
|
6
|
+
*/
|
|
7
|
+
export declare function tailAudit(stateDir: string, planFilter?: string): Promise<number>;
|
package/dist/cli/tail.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { promises as fs, watch, existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { style } from "../lib/style.js";
|
|
4
|
+
import { AuditLog } from "../lib/audit.js";
|
|
5
|
+
/**
|
|
6
|
+
* `orql tail` — live stream of audit log events.
|
|
7
|
+
*
|
|
8
|
+
* Prints existing events on start, then watches the file for appends and
|
|
9
|
+
* renders new lines as they land. Colored by status (ok/err) + tool.
|
|
10
|
+
*/
|
|
11
|
+
export async function tailAudit(stateDir, planFilter) {
|
|
12
|
+
const auditPath = path.join(stateDir, "audit.jsonl");
|
|
13
|
+
if (!existsSync(auditPath)) {
|
|
14
|
+
process.stdout.write(style.sand("(no audit log yet; run an orqlaude tool first)\n"));
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
// Print existing tail (last 30 events).
|
|
18
|
+
const audit = new AuditLog(stateDir);
|
|
19
|
+
const existing = await audit.tail(30);
|
|
20
|
+
for (const e of existing) {
|
|
21
|
+
if (planFilter && e.planId && !e.planId.startsWith(planFilter))
|
|
22
|
+
continue;
|
|
23
|
+
process.stdout.write(formatEvent(e));
|
|
24
|
+
}
|
|
25
|
+
// Watch for appends.
|
|
26
|
+
let lastSize = (await fs.stat(auditPath)).size;
|
|
27
|
+
process.stdout.write(style.dim(`\n(watching ${auditPath} — Ctrl-C to exit)\n`));
|
|
28
|
+
const watcher = watch(auditPath, async () => {
|
|
29
|
+
try {
|
|
30
|
+
const stat = await fs.stat(auditPath);
|
|
31
|
+
if (stat.size <= lastSize)
|
|
32
|
+
return;
|
|
33
|
+
const fh = await fs.open(auditPath, "r");
|
|
34
|
+
try {
|
|
35
|
+
const buf = Buffer.alloc(stat.size - lastSize);
|
|
36
|
+
await fh.read({ buffer: buf, position: lastSize });
|
|
37
|
+
const text = buf.toString("utf8");
|
|
38
|
+
for (const line of text.split("\n")) {
|
|
39
|
+
if (!line.trim())
|
|
40
|
+
continue;
|
|
41
|
+
try {
|
|
42
|
+
const evt = JSON.parse(line);
|
|
43
|
+
if (planFilter && evt.planId && !evt.planId.startsWith(planFilter))
|
|
44
|
+
continue;
|
|
45
|
+
process.stdout.write(formatEvent(evt));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
/* malformed line; skip */
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
await fh.close();
|
|
54
|
+
}
|
|
55
|
+
lastSize = stat.size;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
/* file rotated or transient error; recover next tick */
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return new Promise((resolve) => {
|
|
62
|
+
process.on("SIGINT", () => {
|
|
63
|
+
watcher.close();
|
|
64
|
+
process.stdout.write(style.dim("\n goodbye.\n"));
|
|
65
|
+
resolve(0);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function formatEvent(e) {
|
|
70
|
+
const ts = style.dim(new Date(e.ts).toISOString().slice(11, 19));
|
|
71
|
+
const status = e.ok ? style.coral(" ok") : style.crimson("ERR ");
|
|
72
|
+
const tool = style.cream(e.tool.padEnd(22));
|
|
73
|
+
const dur = style.dim(`${e.durationMs.toString().padStart(4)}ms`);
|
|
74
|
+
const ids = e.planId
|
|
75
|
+
? style.sand(` plan=${e.planId.slice(0, 8)}`)
|
|
76
|
+
: e.sessionId
|
|
77
|
+
? style.sand(` sess=${e.sessionId.slice(0, 8)}`)
|
|
78
|
+
: "";
|
|
79
|
+
const detail = e.resultSummary ? truncate(e.resultSummary, 80) : e.error ?? "";
|
|
80
|
+
return `${ts} ${status} ${tool} ${dur}${ids} ${detail}\n`;
|
|
81
|
+
}
|
|
82
|
+
function truncate(s, n) {
|
|
83
|
+
if (s.length <= n)
|
|
84
|
+
return s;
|
|
85
|
+
return s.slice(0, n - 1) + "…";
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=tail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tail.js","sourceRoot":"","sources":["../../src/cli/tail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IA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C,CAAC,EAAE,CAAC;IACP,MAAM,MAAM,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;IAC/E,OAAO,GAAG,EAAE,KAAK,MAAM,KAAK,IAAI,IAAI,GAAG,GAAG,GAAG,KAAK,MAAM,IAAI,CAAC;AAC/D,CAAC;AAED,SAAS,QAAQ,CAAC,CAAS,EAAE,CAAS;IACpC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAC5B,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function watchPlan(stateDir: string, planId: string): Promise<number>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { StateStore } from "../lib/state.js";
|
|
2
|
+
import { snapshotSession, jsonlPathFor } from "../lib/jsonl_tail.js";
|
|
3
|
+
import { detectHallucination, extractToolUses } from "../lib/hallucination.js";
|
|
4
|
+
import { style, styleStatus, banner } from "../lib/style.js";
|
|
5
|
+
import { agnetLabel } from "../lib/agnet.js";
|
|
6
|
+
import { errorLine } from "../lib/error_ui.js";
|
|
7
|
+
/**
|
|
8
|
+
* `orql watch <plan_id>` — live-updating fleet dashboard.
|
|
9
|
+
*
|
|
10
|
+
* Polls state + JSONL every second, redraws in place via ANSI cursor
|
|
11
|
+
* controls. Hides the terminal cursor while running and restores it on
|
|
12
|
+
* Ctrl-C. Lines are kept stable-height so each refresh just moves the
|
|
13
|
+
* cursor up and rewrites — no scrollback churn.
|
|
14
|
+
*/
|
|
15
|
+
const REFRESH_MS = 1000;
|
|
16
|
+
const ESC = "\x1b[";
|
|
17
|
+
const HIDE_CURSOR = `${ESC}?25l`;
|
|
18
|
+
const SHOW_CURSOR = `${ESC}?25h`;
|
|
19
|
+
const CLEAR_LINE = `${ESC}2K`;
|
|
20
|
+
const cursorUp = (n) => `${ESC}${n}A`;
|
|
21
|
+
export async function watchPlan(stateDir, planId) {
|
|
22
|
+
// First render builds the canvas; subsequent renders move up and rewrite.
|
|
23
|
+
let drawnLines = 0;
|
|
24
|
+
let stopped = false;
|
|
25
|
+
const onSig = () => {
|
|
26
|
+
stopped = true;
|
|
27
|
+
};
|
|
28
|
+
process.on("SIGINT", onSig);
|
|
29
|
+
process.stdout.write(HIDE_CURSOR);
|
|
30
|
+
try {
|
|
31
|
+
while (!stopped) {
|
|
32
|
+
const frame = await renderFrame(stateDir, planId);
|
|
33
|
+
if (drawnLines > 0) {
|
|
34
|
+
process.stdout.write(cursorUp(drawnLines));
|
|
35
|
+
}
|
|
36
|
+
// Clear each line as we redraw to avoid stale trailing characters.
|
|
37
|
+
const lines = frame.split("\n");
|
|
38
|
+
for (const line of lines) {
|
|
39
|
+
process.stdout.write(CLEAR_LINE + "\r" + line + "\n");
|
|
40
|
+
}
|
|
41
|
+
drawnLines = lines.length;
|
|
42
|
+
await sleep(REFRESH_MS);
|
|
43
|
+
}
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
process.stdout.write(SHOW_CURSOR);
|
|
48
|
+
process.stderr.write(errorLine(err.message));
|
|
49
|
+
return 1;
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
process.stdout.write(SHOW_CURSOR);
|
|
53
|
+
process.removeListener("SIGINT", onSig);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function renderFrame(stateDir, planId) {
|
|
57
|
+
const store = new StateStore(stateDir);
|
|
58
|
+
let plan;
|
|
59
|
+
try {
|
|
60
|
+
plan = await store.read((s) => {
|
|
61
|
+
const p = s.plans[planId] ?? Object.values(s.plans).find((x) => x.id.startsWith(planId));
|
|
62
|
+
if (!p)
|
|
63
|
+
throw new Error(`Plan not found: ${planId}`);
|
|
64
|
+
return p;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
return errorLine(err.message);
|
|
69
|
+
}
|
|
70
|
+
const lines = [];
|
|
71
|
+
lines.push(banner());
|
|
72
|
+
lines.push("");
|
|
73
|
+
lines.push(`${style.bold(style.coral("Plan"))} ${style.dim(plan.id.slice(0, 8))} ${styleStatus(plan.status)(plan.status)} ${style.dim(new Date().toLocaleTimeString())}`);
|
|
74
|
+
lines.push(` ${style.sand(truncate(plan.rootTask, 90))}`);
|
|
75
|
+
lines.push("");
|
|
76
|
+
let totalTokens = 0;
|
|
77
|
+
const cwd = process.cwd();
|
|
78
|
+
for (const t of plan.tasks) {
|
|
79
|
+
const agnet = style.coral(agnetLabel(t.agnetName).padEnd(16));
|
|
80
|
+
const status = styleStatus(t.status)(glyphFor(t.status) + " " + t.status.padEnd(10));
|
|
81
|
+
let activity = "";
|
|
82
|
+
let tokens = "";
|
|
83
|
+
if (t.spawnedSessionId) {
|
|
84
|
+
try {
|
|
85
|
+
const snap = await snapshotSession(cwd, t.spawnedSessionId);
|
|
86
|
+
totalTokens += snap.totalEffectiveTokens;
|
|
87
|
+
const tk = Math.round(snap.totalEffectiveTokens / 1000);
|
|
88
|
+
tokens = style.dim(`${tk.toString().padStart(4)}k`);
|
|
89
|
+
if (snap.terminated) {
|
|
90
|
+
activity = style.coral("✓ terminated");
|
|
91
|
+
}
|
|
92
|
+
else if (snap.lastToolUse) {
|
|
93
|
+
activity = style.cream(snap.lastToolUse.name);
|
|
94
|
+
}
|
|
95
|
+
else if (snap.lastEventType) {
|
|
96
|
+
activity = style.sand(snap.lastEventType);
|
|
97
|
+
}
|
|
98
|
+
// Per-task budget hint warning
|
|
99
|
+
if (t.budgetHintTokens && snap.totalEffectiveTokens > 0.7 * t.budgetHintTokens) {
|
|
100
|
+
const pct = Math.round((snap.totalEffectiveTokens / t.budgetHintTokens) * 100);
|
|
101
|
+
activity += " " + style.crimson(`⚠ ${pct}% of hint`);
|
|
102
|
+
}
|
|
103
|
+
// Hallucination peek
|
|
104
|
+
try {
|
|
105
|
+
const tu = await extractToolUses(jsonlPathFor(cwd, t.spawnedSessionId));
|
|
106
|
+
const hallu = await detectHallucination(tu, cwd);
|
|
107
|
+
if (hallu.level === "moderate")
|
|
108
|
+
activity += " " + style.crimson("⚠ hallu?");
|
|
109
|
+
else if (hallu.level === "severe")
|
|
110
|
+
activity += " " + style.crimson("⚠⚠ severe");
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
/* skip */
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
activity = style.sand("?");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
lines.push(` ${status} ${agnet} ${truncate(t.title, 36).padEnd(36)} ${tokens} ${activity}`);
|
|
121
|
+
if (t.prUrl)
|
|
122
|
+
lines.push(` ${style.sand("PR:")} ${style.cream(t.prUrl)}`);
|
|
123
|
+
}
|
|
124
|
+
lines.push("");
|
|
125
|
+
const tk = totalTokens.toLocaleString();
|
|
126
|
+
const cap = plan.budgetCapTokens.toLocaleString();
|
|
127
|
+
const pct = Math.min(100, Math.round((totalTokens / plan.budgetCapTokens) * 100));
|
|
128
|
+
const bar = renderBar(pct, 30);
|
|
129
|
+
lines.push(` ${style.sand("budget:")} ${bar} ${style.cream(tk)} / ${cap} (${pct}%)`);
|
|
130
|
+
if (plan.notes.length > 0)
|
|
131
|
+
lines.push(` ${style.sand("notes:")} ${plan.notes.length}`);
|
|
132
|
+
if (plan.claims.length > 0)
|
|
133
|
+
lines.push(` ${style.sand("claims:")} ${plan.claims.length}`);
|
|
134
|
+
lines.push("");
|
|
135
|
+
lines.push(style.dim(`(refreshing every ${REFRESH_MS}ms — Ctrl-C to exit)`));
|
|
136
|
+
return lines.join("\n");
|
|
137
|
+
}
|
|
138
|
+
function renderBar(pct, width) {
|
|
139
|
+
const filled = Math.round((pct / 100) * width);
|
|
140
|
+
const empty = width - filled;
|
|
141
|
+
const color = pct >= 100 ? style.crimson : pct >= 80 ? style.crimson : style.coral;
|
|
142
|
+
return color("█".repeat(filled)) + style.dim("░".repeat(empty));
|
|
143
|
+
}
|
|
144
|
+
function glyphFor(status) {
|
|
145
|
+
switch (status) {
|
|
146
|
+
case "running":
|
|
147
|
+
case "dispatched":
|
|
148
|
+
return "⏵";
|
|
149
|
+
case "done":
|
|
150
|
+
case "collected":
|
|
151
|
+
return "✓";
|
|
152
|
+
case "failed":
|
|
153
|
+
return "✗";
|
|
154
|
+
case "cancelled":
|
|
155
|
+
case "cancelled_overbudget":
|
|
156
|
+
return "🛑";
|
|
157
|
+
default:
|
|
158
|
+
return "·";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function truncate(s, n) {
|
|
162
|
+
if (s.length <= n)
|
|
163
|
+
return s;
|
|
164
|
+
return s.slice(0, n - 1) + "…";
|
|
165
|
+
}
|
|
166
|
+
function sleep(ms) {
|
|
167
|
+
return new Promise((res) => setTimeout(res, ms));
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/cli/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;;;;GAOG;AAEH,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,MAAM,GAAG,GAAG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