aoaoe 2.0.0 → 3.0.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.
@@ -0,0 +1,23 @@
1
+ import type { TaskState, TaskDefinition } from "./types.js";
2
+ export interface CloneOptions {
3
+ sourceTitle: string;
4
+ cloneTitle: string;
5
+ goalOverride?: string;
6
+ toolOverride?: string;
7
+ modeOverride?: string;
8
+ }
9
+ export interface CloneResult {
10
+ original: string;
11
+ clone: string;
12
+ goal: string;
13
+ tool: string;
14
+ }
15
+ /**
16
+ * Create a clone task definition from an existing task.
17
+ */
18
+ export declare function cloneSession(source: TaskState, options: CloneOptions): TaskDefinition;
19
+ /**
20
+ * Format clone result for TUI display.
21
+ */
22
+ export declare function formatCloneResult(result: CloneResult): string[];
23
+ //# sourceMappingURL=session-clone.d.ts.map
@@ -0,0 +1,26 @@
1
+ // session-clone.ts — clone a session to try alternative approaches in parallel.
2
+ // creates a new task definition from an existing session's config + goal,
3
+ // allowing A/B experimentation on the same problem.
4
+ /**
5
+ * Create a clone task definition from an existing task.
6
+ */
7
+ export function cloneSession(source, options) {
8
+ return {
9
+ repo: source.repo,
10
+ sessionTitle: options.cloneTitle,
11
+ sessionMode: (options.modeOverride ?? source.sessionMode),
12
+ tool: options.toolOverride ?? source.tool,
13
+ goal: options.goalOverride ?? source.goal,
14
+ dependsOn: undefined, // clone runs independently
15
+ };
16
+ }
17
+ /**
18
+ * Format clone result for TUI display.
19
+ */
20
+ export function formatCloneResult(result) {
21
+ return [
22
+ ` Cloned "${result.original}" → "${result.clone}"`,
23
+ ` Tool: ${result.tool} Goal: ${result.goal.length > 60 ? result.goal.slice(0, 57) + "..." : result.goal}`,
24
+ ];
25
+ }
26
+ //# sourceMappingURL=session-clone.js.map
@@ -0,0 +1,24 @@
1
+ export interface TailOptions {
2
+ sessionTitle: string;
3
+ lineCount: number;
4
+ highlightPattern?: string;
5
+ stripAnsi: boolean;
6
+ }
7
+ /**
8
+ * Extract the last N lines from session output, optionally highlighting matches.
9
+ */
10
+ export declare function tailSession(output: string[], options: Partial<TailOptions> & {
11
+ sessionTitle: string;
12
+ }): string[];
13
+ /**
14
+ * Format tail output for TUI display.
15
+ */
16
+ export declare function formatTail(sessionTitle: string, lines: string[], total: number): string[];
17
+ /**
18
+ * Parse tail command arguments.
19
+ * Format: /tail <session> [count] [pattern]
20
+ */
21
+ export declare function parseTailArgs(args: string): Partial<TailOptions> & {
22
+ sessionTitle: string;
23
+ };
24
+ //# sourceMappingURL=session-tail.d.ts.map
@@ -0,0 +1,52 @@
1
+ // session-tail.ts — live tail of any session's output from the TUI.
2
+ // provides a filtered view of a specific session's recent output lines
3
+ // with optional pattern highlighting.
4
+ const DEFAULT_OPTIONS = {
5
+ lineCount: 30,
6
+ stripAnsi: true,
7
+ };
8
+ /**
9
+ * Extract the last N lines from session output, optionally highlighting matches.
10
+ */
11
+ export function tailSession(output, options) {
12
+ const opts = { ...DEFAULT_OPTIONS, ...options };
13
+ let lines = output.slice(-opts.lineCount);
14
+ if (opts.stripAnsi) {
15
+ lines = lines.map((l) => l.replace(/\x1b\[[0-9;]*[mABCDHJKST]/g, ""));
16
+ }
17
+ if (opts.highlightPattern) {
18
+ try {
19
+ const regex = new RegExp(opts.highlightPattern, "gi");
20
+ lines = lines.map((l) => l.replace(regex, (match) => `>>>${match}<<<`));
21
+ }
22
+ catch { /* invalid regex, skip highlighting */ }
23
+ }
24
+ return lines;
25
+ }
26
+ /**
27
+ * Format tail output for TUI display.
28
+ */
29
+ export function formatTail(sessionTitle, lines, total) {
30
+ const header = ` tail: "${sessionTitle}" (last ${lines.length} of ${total} lines)`;
31
+ const sep = " " + "─".repeat(70);
32
+ return [header, sep, ...lines.map((l) => ` ${l}`), sep];
33
+ }
34
+ /**
35
+ * Parse tail command arguments.
36
+ * Format: /tail <session> [count] [pattern]
37
+ */
38
+ export function parseTailArgs(args) {
39
+ const parts = args.split(/\s+/);
40
+ const sessionTitle = parts[0];
41
+ let lineCount = 30;
42
+ let highlightPattern;
43
+ for (let i = 1; i < parts.length; i++) {
44
+ const num = parseInt(parts[i], 10);
45
+ if (!isNaN(num) && num > 0)
46
+ lineCount = num;
47
+ else
48
+ highlightPattern = parts[i];
49
+ }
50
+ return { sessionTitle, lineCount, highlightPattern };
51
+ }
52
+ //# sourceMappingURL=session-tail.js.map
@@ -0,0 +1,15 @@
1
+ import type { WorkflowState } from "./workflow-engine.js";
2
+ import type { WorkflowChain } from "./workflow-chain.js";
3
+ /**
4
+ * Render a workflow as an ASCII pipeline diagram.
5
+ */
6
+ export declare function renderWorkflowDag(workflow: WorkflowState): string[];
7
+ /**
8
+ * Render a workflow chain as an ASCII dependency DAG.
9
+ */
10
+ export declare function renderChainDag(chain: WorkflowChain): string[];
11
+ /**
12
+ * Render a compact workflow summary (single-line per stage).
13
+ */
14
+ export declare function renderWorkflowCompact(workflow: WorkflowState): string;
15
+ //# sourceMappingURL=workflow-viz.d.ts.map
@@ -0,0 +1,74 @@
1
+ // workflow-viz.ts — ASCII DAG rendering for workflows and workflow chains.
2
+ // produces a visual graph of stage/task dependencies with status icons.
3
+ /**
4
+ * Render a workflow as an ASCII pipeline diagram.
5
+ */
6
+ export function renderWorkflowDag(workflow) {
7
+ const lines = [];
8
+ lines.push(` ┌─ Workflow: ${workflow.name} ─┐`);
9
+ for (let i = 0; i < workflow.stages.length; i++) {
10
+ const stage = workflow.stages[i];
11
+ const icon = stage.status === "completed" ? "✓" : stage.status === "active" ? "▶" : stage.status === "failed" ? "✗" : "○";
12
+ const current = i === workflow.currentStage ? " ◄" : "";
13
+ lines.push(` │`);
14
+ lines.push(` ├─[${icon}] ${stage.name}${current}`);
15
+ for (const task of stage.tasks) {
16
+ const tIcon = task.status === "completed" ? "✓" : task.status === "active" ? "~" : task.status === "failed" ? "!" : ".";
17
+ lines.push(` │ └─[${tIcon}] ${task.sessionTitle}`);
18
+ }
19
+ if (i < workflow.stages.length - 1) {
20
+ lines.push(` │ ↓`);
21
+ }
22
+ }
23
+ lines.push(` └${"─".repeat(40)}┘`);
24
+ return lines;
25
+ }
26
+ /**
27
+ * Render a workflow chain as an ASCII dependency DAG.
28
+ */
29
+ export function renderChainDag(chain) {
30
+ const lines = [];
31
+ lines.push(` ╔═ Chain: ${chain.name} ═╗`);
32
+ // group by depth (entries with no deps = depth 0, etc.)
33
+ const depths = new Map();
34
+ const getDepth = (name, visited = new Set()) => {
35
+ if (depths.has(name))
36
+ return depths.get(name);
37
+ if (visited.has(name))
38
+ return 0;
39
+ visited.add(name);
40
+ const entry = chain.entries.find((e) => e.workflowName === name);
41
+ if (!entry || entry.dependsOn.length === 0) {
42
+ depths.set(name, 0);
43
+ return 0;
44
+ }
45
+ const maxDep = Math.max(...entry.dependsOn.map((d) => getDepth(d, visited)));
46
+ const depth = maxDep + 1;
47
+ depths.set(name, depth);
48
+ return depth;
49
+ };
50
+ for (const e of chain.entries)
51
+ getDepth(e.workflowName);
52
+ const maxDepth = Math.max(0, ...depths.values());
53
+ for (let d = 0; d <= maxDepth; d++) {
54
+ const atDepth = chain.entries.filter((e) => (depths.get(e.workflowName) ?? 0) === d);
55
+ if (d > 0)
56
+ lines.push(` ║ ↓`);
57
+ const indent = " ║" + " ".repeat(d);
58
+ for (const e of atDepth) {
59
+ const icon = e.status === "completed" ? "✓" : e.status === "active" ? "▶" : e.status === "failed" ? "✗" : "○";
60
+ const deps = e.dependsOn.length > 0 ? ` ← ${e.dependsOn.join(",")}` : "";
61
+ lines.push(`${indent} [${icon}] ${e.workflowName}${deps}`);
62
+ }
63
+ }
64
+ lines.push(` ╚${"═".repeat(40)}╝`);
65
+ return lines;
66
+ }
67
+ /**
68
+ * Render a compact workflow summary (single-line per stage).
69
+ */
70
+ export function renderWorkflowCompact(workflow) {
71
+ const icons = workflow.stages.map((s) => s.status === "completed" ? "✓" : s.status === "active" ? "▶" : s.status === "failed" ? "✗" : "○");
72
+ return `[${icons.join("→")}] ${workflow.name}`;
73
+ }
74
+ //# sourceMappingURL=workflow-viz.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aoaoe",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Autonomous supervisor for agent-of-empires sessions using OpenCode or Claude Code",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",