copilot-liku-cli 0.0.4 → 0.0.8

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 (46) hide show
  1. package/QUICKSTART.md +24 -0
  2. package/README.md +85 -33
  3. package/package.json +23 -14
  4. package/scripts/postinstall.js +63 -0
  5. package/src/cli/commands/window.js +66 -0
  6. package/src/main/agents/base-agent.js +15 -7
  7. package/src/main/agents/builder.js +211 -0
  8. package/src/main/agents/index.js +7 -4
  9. package/src/main/agents/orchestrator.js +13 -0
  10. package/src/main/agents/producer.js +891 -0
  11. package/src/main/agents/researcher.js +78 -0
  12. package/src/main/agents/state-manager.js +134 -2
  13. package/src/main/agents/verifier.js +201 -0
  14. package/src/main/ai-service.js +349 -35
  15. package/src/main/index.js +680 -110
  16. package/src/main/inspect-service.js +24 -1
  17. package/src/main/python-bridge.js +395 -0
  18. package/src/main/system-automation.js +849 -131
  19. package/src/main/ui-automation/core/ui-provider.js +99 -0
  20. package/src/main/ui-automation/core/uia-host.js +214 -0
  21. package/src/main/ui-automation/index.js +30 -0
  22. package/src/main/ui-automation/interactions/element-click.js +6 -6
  23. package/src/main/ui-automation/interactions/high-level.js +28 -6
  24. package/src/main/ui-automation/interactions/index.js +21 -0
  25. package/src/main/ui-automation/interactions/pattern-actions.js +236 -0
  26. package/src/main/ui-automation/window/index.js +6 -0
  27. package/src/main/ui-automation/window/manager.js +173 -26
  28. package/src/main/ui-watcher.js +401 -58
  29. package/src/main/visual-awareness.js +18 -1
  30. package/src/native/windows-uia/Program.cs +89 -0
  31. package/src/native/windows-uia/build.ps1 +24 -0
  32. package/src/native/windows-uia-dotnet/Program.cs +920 -0
  33. package/src/native/windows-uia-dotnet/WindowsUIA.csproj +11 -0
  34. package/src/native/windows-uia-dotnet/build.ps1 +24 -0
  35. package/src/renderer/chat/chat.js +915 -671
  36. package/src/renderer/chat/index.html +2 -4
  37. package/src/renderer/chat/preload.js +8 -1
  38. package/src/renderer/overlay/overlay.js +157 -8
  39. package/src/renderer/overlay/preload.js +4 -0
  40. package/src/shared/inspect-types.js +82 -6
  41. package/ARCHITECTURE.md +0 -411
  42. package/CONFIGURATION.md +0 -302
  43. package/CONTRIBUTING.md +0 -225
  44. package/ELECTRON_README.md +0 -121
  45. package/PROJECT_STATUS.md +0 -229
  46. package/TESTING.md +0 -274
package/QUICKSTART.md CHANGED
@@ -42,6 +42,27 @@ liku start
42
42
  npm start
43
43
  ```
44
44
 
45
+ ## Quick Verify (Recommended)
46
+
47
+ After install, run these checks in order:
48
+
49
+ ```bash
50
+ # 1) Deterministic runtime smoke test (default)
51
+ npm run smoke:shortcuts
52
+
53
+ # 2) Direct chat visibility smoke (no keyboard emulation)
54
+ npm run smoke:chat-direct
55
+
56
+ # 3) UI automation baseline checks
57
+ npm run test:ui
58
+ ```
59
+
60
+ This order gives clearer pass/fail signals by validating runtime health first,
61
+ then shortcut routing, then module-level UI automation.
62
+
63
+ `smoke:shortcuts` intentionally validates chat visibility via direct in-app
64
+ toggle and validates keyboard routing on overlay with target gating.
65
+
45
66
  ## First Use
46
67
 
47
68
  ### 1. Application Launch
@@ -79,6 +100,9 @@ To make the overlay click-through again:
79
100
 
80
101
  ## Keyboard Shortcuts
81
102
 
103
+ Source-of-truth for these mappings is the current main-process registration in
104
+ `src/main/index.js`.
105
+
82
106
  | Shortcut | Action |
83
107
  |----------|--------|
84
108
  | `Ctrl+Alt+Space` (macOS: `Cmd+Alt+Space`) | Toggle chat window |
package/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # GitHub Copilot CLI: Liku Edition (Public Preview)
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/copilot-liku-cli.svg)](https://www.npmjs.com/package/copilot-liku-cli)
4
- [![Node.js](https://img.shields.io/badge/node-%3E%3D22.0.0-brightgreen.svg)](https://nodejs.org/)
4
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE.md)
6
+ [![Package Size](https://img.shields.io/badge/package-~196KB-blue.svg)](https://www.npmjs.com/package/copilot-liku-cli)
6
7
 
7
8
  The power of GitHub Copilot, now with visual-spatial awareness and advanced automation.
8
9
 
@@ -20,6 +21,7 @@ We're bringing the power of GitHub Copilot coding agent directly to your termina
20
21
  - **Ultra-Thin Overlay:** A transparent Electron layer for high-performance UI element detection and interaction.
21
22
  - **Multi-Agent Orchestration:** A sophisticated **Supervisor-Builder-Verifier** pattern for complex, multi-step task execution.
22
23
  - **Liku CLI Suite:** A comprehensive set of automation tools (`click`, `find`, `type`, `keys`, `screenshot`) available from any shell.
24
+ - **Event-Driven UI Watcher:** Real-time UI state tracking via Windows UI Automation events with automatic polling fallback.
23
25
  - **Defensive AI Architecture:** Engineered for minimal footprint ($<300$MB memory) and zero-intrusion workflows.
24
26
 
25
27
  ## 🛠️ The Liku CLI (`liku`)
@@ -34,6 +36,8 @@ liku
34
36
  ```
35
37
  This launches the Electron-based visual agent including the chat interface and the transparent overlay.
36
38
 
39
+ > **Note:** The visual overlay requires Electron (installed automatically as an optional dependency). All headless CLI commands (`click`, `find`, `type`, `keys`, `screenshot`, etc.) work without Electron.
40
+
37
41
  ### Automation Commands
38
42
  | Command | Usage | Description |
39
43
  | :--- | :--- | :--- |
@@ -43,12 +47,27 @@ This launches the Electron-based visual agent including the chat interface and t
43
47
  | `keys` | `liku keys ctrl+s` | Send complex keyboard combinations. |
44
48
  | `window` | `liku window "VS Code"` | Focus a specific application window. |
45
49
  | `screenshot`| `liku screenshot` | Capture the current screen state for analysis. |
50
+ | `mouse` | `liku mouse 500 300` | Move the mouse to screen coordinates. |
51
+ | `scroll` | `liku scroll down` | Scroll the active window or element. |
52
+ | `drag` | `liku drag 100,200 400,500` | Drag from one point to another. |
53
+ | `wait` | `liku wait "Loading..." --gone` | Wait for an element to appear or disappear. |
46
54
  | `repl` | `liku repl` | Launch an interactive automation shell. |
55
+ | `agent` | `liku agent "Refactor login"` | Start a multi-agent task. |
47
56
 
48
57
  ### Power User Examples
49
- - **Chained Automation**: `liku window "Notepad" && liku type "Done!" && liku keys ctrl+s`
50
- - **Coordinate Precision**: `liku click 500,300 --right`
51
- - **JSON Processing**: `liku find "*" --json | jq '.[0].name'`
58
+ ```bash
59
+ # Chained automation
60
+ liku window "Notepad" && liku type "Done!" && liku keys ctrl+s
61
+
62
+ # Coordinate precision
63
+ liku click 500,300 --right
64
+
65
+ # JSON processing
66
+ liku find "*" --json | jq '.[0].name'
67
+
68
+ # Wait for UI state
69
+ liku wait "Submit" --timeout 5000 && liku click "Submit"
70
+ ```
52
71
 
53
72
  ## 👁️ Visual Awareness & Grid System
54
73
 
@@ -57,6 +76,7 @@ Liku perceives your workspace through a dual-mode interaction layer.
57
76
  - **Passive Mode:** Fully click-through, remaining dormant until needed.
58
77
  - **Dot-Grid Targeting:** When the agent needs to target a specific point, it generates a coordinate grid (Coarse ~100px or Fine ~25px) using alphanumeric labels (e.g., `A1`, `C3.21`).
59
78
  - **Live UI Inspection:** Uses native accessibility trees (Windows UI Automation) to highlight and "lock onto" buttons, menus, and text fields in real-time.
79
+ - **Event-Driven Updates:** The UI watcher uses a 4-state machine (POLLING → EVENT_MODE → FALLBACK) to stream live focus, structure, and property changes with automatic health monitoring.
60
80
 
61
81
  ### Global Shortcuts (Overlay)
62
82
  - `Ctrl+Alt+Space`: Toggle the Chat Interface.
@@ -84,83 +104,115 @@ The Liku Edition moves beyond single-turn responses with a specialized team of a
84
104
 
85
105
  ### Prerequisites
86
106
 
87
- - **Node.js** v22 or higher
88
- - **npm** v10 or higher
89
- - (On Windows) **PowerShell** v6 or higher
90
- - An **active Copilot subscription**.
107
+ - **Node.js** v18 or higher (v22 recommended)
108
+ - **npm** v9 or higher
109
+
110
+ #### Platform-Specific
111
+
112
+ | Platform | UI Automation | Requirements |
113
+ | :--- | :--- | :--- |
114
+ | **Windows** | Full (UIA + events) | PowerShell v5.1+; [.NET 9 SDK](https://dotnet.microsoft.com/download) for building the UIA host |
115
+ | **macOS** | Partial | Accessibility permissions required |
116
+ | **Linux** | Partial | AT-SPI2 recommended |
117
+
118
+ > **Windows UI Automation:** On `npm install`, a postinstall script automatically builds the .NET 9 UIA host binary if the .NET SDK is detected. If skipped, you can build it manually with `npm run build:uia`.
91
119
 
92
120
  ### Installation
93
121
 
94
- #### Global Installation (Recommended for Users)
122
+ #### Global Install (Recommended)
95
123
 
96
- Install globally from npm:
97
124
  ```bash
98
125
  npm install -g copilot-liku-cli
99
126
  ```
100
127
 
101
- This will make the `liku` command available globally from any directory.
102
-
103
- To verify installation:
128
+ Verify:
104
129
  ```bash
105
130
  liku --version
131
+ liku --help
106
132
  ```
107
133
 
108
- To update to the latest version:
134
+ Update:
109
135
  ```bash
110
136
  npm update -g copilot-liku-cli
111
137
  ```
112
138
 
113
- #### Local Development Installation
139
+ #### From Source
114
140
 
115
- To install the Liku Edition for local development and contributing:
116
141
  ```bash
117
142
  git clone https://github.com/TayDa64/copilot-Liku-cli
118
143
  cd copilot-Liku-cli
119
144
  npm install
120
145
  npm link
121
- ```
122
- This will make the `liku` command available globally, linked to your local development copy.
123
146
 
124
- **Note for contributors:** Use `npm link` during development so changes are immediately reflected without reinstalling.
147
+ # Build the .NET UIA host (Windows only)
148
+ npm run build:uia
149
+ ```
125
150
 
126
151
  ### Authenticate
127
152
 
128
- If you're not logged in, launch the agent and use the `/login` slash command, or set a personal access token (PAT):
153
+ Set a GitHub personal access token with Copilot permissions:
129
154
  1. Visit [GitHub PAT Settings](https://github.com/settings/personal-access-tokens/new)
130
155
  2. Enable "Copilot Requests" permission.
131
156
  3. Export `GH_TOKEN` or `GITHUB_TOKEN` in your environment.
132
157
 
158
+ Or launch the agent and use the `/login` slash command.
159
+
160
+ ## ✅ Quick Verify
161
+
162
+ ```bash
163
+ # Full smoke suite (233 assertions)
164
+ npm run smoke
165
+
166
+ # Individual checks
167
+ npm run smoke:shortcuts # Runtime + shortcut diagnostics
168
+ npm run smoke:chat-direct # Chat visibility (no keyboard emulation)
169
+ npm run test:ui # UI automation baseline
170
+ ```
171
+
133
172
  ## 🛠️ Technical Architecture
134
173
 
135
- GitHub Copilot-Liku CLI is built on a "Defensive AI" architecture—a design philosophy focused on minimal footprint, secure execution, and zero-intrusion workflows.
174
+ GitHub Copilot-Liku CLI is built on a "Defensive AI" architecture — minimal footprint, secure execution, and zero-intrusion workflows.
175
+
176
+ ### Key Systems
177
+
178
+ | Layer | Description |
179
+ | :--- | :--- |
180
+ | **CLI** | 13 headless commands via `src/cli/liku.js` (CJS, no Electron required) |
181
+ | **.NET UIA Host** | Persistent JSONL process for Windows UI Automation (9 commands, thread-safe, event streaming) |
182
+ | **UI Watcher** | 4-state machine: POLLING ↔ EVENT_MODE ↔ FALLBACK with 10s health check |
183
+ | **Overlay** | Transparent Electron window with grid, inspect regions, and click-through passthrough |
184
+ | **Agent System** | Supervisor → Builder / Researcher → Verifier pipeline |
136
185
 
137
186
  ### Performance Benchmarks
138
187
 
139
- Engineered for performance and stability, the system hits the following metrics:
140
188
  - **Memory Footprint**: $< 300$MB steady-state (~150MB baseline).
141
189
  - **CPU Usage**: $< 0.5\%$ idle; $< 2\%$ in selection mode.
142
190
  - **Startup Latency**: $< 3$ seconds from launch to functional state.
191
+ - **Package Size**: ~196 KB (npm tarball).
143
192
 
144
193
  ### Security & Isolation
145
194
 
146
195
  - **Hardened Electron Environment**: Uses `contextIsolation` and `sandbox` modes to prevent prototype pollution.
147
196
  - **Content Security Policy (CSP)**: Strict headers to disable unauthorized external resources.
148
197
  - **Isolated Preload Bridges**: Secure IPC routing where renderers only have access to necessary system APIs.
198
+ - **No bundled secrets**: API keys read from environment variables only; tokens stored in `~/.liku-cli/`.
149
199
 
150
- ## 🚧 Overlay Development
200
+ ## 📚 Documentation
151
201
 
152
- See `docs/inspect-overlay-plan.md` for the inspect overlay plan and acceptance criteria.
202
+ - **[Installation Guide](INSTALLATION.md)** Detailed installation instructions for all platforms
203
+ - **[Quick Start Guide](QUICKSTART.md)** — Get up and running quickly
153
204
 
154
- ## 📚 Documentation
205
+ <details>
206
+ <summary>Developer docs (available in the repo, not shipped with npm)</summary>
207
+
208
+ - **[Contributing Guide](CONTRIBUTING.md)** — How to contribute to the project
209
+ - **[Publishing Guide](PUBLISHING.md)** — How to publish the package to npm
210
+ - **[Release Process](RELEASE_PROCESS.md)** — How to create and manage releases
211
+ - **[Architecture](ARCHITECTURE.md)** — System design and architecture
212
+ - **[Configuration](CONFIGURATION.md)** — Configuration options
213
+ - **[Testing](TESTING.md)** — Testing guide and practices
155
214
 
156
- - **[Installation Guide](INSTALLATION.md)** - Detailed installation instructions for all platforms
157
- - **[Quick Start Guide](QUICKSTART.md)** - Get up and running quickly
158
- - **[Contributing Guide](CONTRIBUTING.md)** - How to contribute to the project
159
- - **[Publishing Guide](PUBLISHING.md)** - How to publish the package to npm
160
- - **[Release Process](RELEASE_PROCESS.md)** - How to create and manage releases
161
- - **[Architecture](ARCHITECTURE.md)** - System design and architecture
162
- - **[Configuration](CONFIGURATION.md)** - Configuration options
163
- - **[Testing](TESTING.md)** - Testing guide and practices
215
+ </details>
164
216
 
165
217
  ## 📢 Feedback and Participation
166
218
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copilot-liku-cli",
3
- "version": "0.0.4",
3
+ "version": "0.0.8",
4
4
  "description": "GitHub Copilot CLI with headless agent + ultra-thin overlay architecture",
5
5
  "main": "src/main/index.js",
6
6
  "bin": {
@@ -10,7 +10,12 @@
10
10
  "start": "node scripts/start.js",
11
11
  "test": "node scripts/test-grid.js",
12
12
  "test:ui": "node scripts/test-ui-automation-baseline.js",
13
- "liku": "node src/cli/liku.js"
13
+ "smoke:shortcuts": "node scripts/smoke-shortcuts.js",
14
+ "smoke:chat-direct": "node scripts/smoke-chat-direct.js",
15
+ "smoke": "node scripts/smoke-command-system.js",
16
+ "liku": "node src/cli/liku.js",
17
+ "build:uia": "powershell -ExecutionPolicy Bypass -File src/native/windows-uia-dotnet/build.ps1",
18
+ "postinstall": "node scripts/postinstall.js"
14
19
  },
15
20
  "keywords": [
16
21
  "copilot",
@@ -22,7 +27,7 @@
22
27
  "ui-automation",
23
28
  "ai"
24
29
  ],
25
- "author": "GitHub",
30
+ "author": "TayDa64",
26
31
  "license": "MIT",
27
32
  "repository": {
28
33
  "type": "git",
@@ -33,8 +38,8 @@
33
38
  },
34
39
  "homepage": "https://github.com/TayDa64/copilot-Liku-cli#readme",
35
40
  "engines": {
36
- "node": ">=22.0.0",
37
- "npm": ">=10.0.0"
41
+ "node": ">=18.0.0",
42
+ "npm": ">=9.0.0"
38
43
  },
39
44
  "os": [
40
45
  "darwin",
@@ -42,20 +47,24 @@
42
47
  "linux"
43
48
  ],
44
49
  "files": [
45
- "src/",
50
+ "src/cli/",
51
+ "src/main/",
52
+ "src/shared/",
53
+ "src/renderer/",
54
+ "src/assets/",
55
+ "src/native/windows-uia/Program.cs",
56
+ "src/native/windows-uia/build.ps1",
57
+ "src/native/windows-uia-dotnet/Program.cs",
58
+ "src/native/windows-uia-dotnet/WindowsUIA.csproj",
59
+ "src/native/windows-uia-dotnet/build.ps1",
46
60
  "scripts/start.js",
61
+ "scripts/postinstall.js",
47
62
  "README.md",
48
63
  "LICENSE.md",
49
64
  "QUICKSTART.md",
50
- "INSTALLATION.md",
51
- "CONTRIBUTING.md",
52
- "ARCHITECTURE.md",
53
- "CONFIGURATION.md",
54
- "TESTING.md",
55
- "ELECTRON_README.md",
56
- "PROJECT_STATUS.md"
65
+ "INSTALLATION.md"
57
66
  ],
58
- "dependencies": {
67
+ "optionalDependencies": {
59
68
  "electron": "^35.7.5"
60
69
  }
61
70
  }
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * postinstall — attempt to build the .NET UIA host binary on Windows.
4
+ * Gracefully skips on non-Windows platforms or if .NET SDK is absent.
5
+ */
6
+ const { execSync } = require('child_process');
7
+ const path = require('path');
8
+ const fs = require('fs');
9
+
10
+ const ROOT = path.resolve(__dirname, '..');
11
+ const BIN_DIR = path.join(ROOT, 'bin');
12
+ const EXE = path.join(BIN_DIR, 'WindowsUIA.exe');
13
+ const BUILD_SCRIPT = path.join(ROOT, 'src', 'native', 'windows-uia-dotnet', 'build.ps1');
14
+
15
+ // Skip on non-Windows
16
+ if (process.platform !== 'win32') {
17
+ console.log('[postinstall] Not Windows — skipping UIA host build (headless CLI commands still work).');
18
+ process.exit(0);
19
+ }
20
+
21
+ // Already built?
22
+ if (fs.existsSync(EXE)) {
23
+ console.log('[postinstall] WindowsUIA.exe already exists — skipping build.');
24
+ process.exit(0);
25
+ }
26
+
27
+ // Check for .NET SDK
28
+ try {
29
+ const ver = execSync('dotnet --version', { encoding: 'utf-8', timeout: 10000 }).trim();
30
+ const major = parseInt(ver.split('.')[0], 10);
31
+ if (major < 9) {
32
+ console.log(`[postinstall] .NET SDK ${ver} found but v9+ required for UIA host. Skipping build.`);
33
+ console.log(' Install .NET 9 SDK from https://dotnet.microsoft.com/download and run: npm run build:uia');
34
+ process.exit(0);
35
+ }
36
+ } catch {
37
+ console.log('[postinstall] .NET SDK not found — skipping UIA host build.');
38
+ console.log(' UI-automation features require the .NET 9 host. Install .NET 9 SDK and run: npm run build:uia');
39
+ process.exit(0);
40
+ }
41
+
42
+ // Check for build script
43
+ if (!fs.existsSync(BUILD_SCRIPT)) {
44
+ console.log('[postinstall] Build script not found — skipping UIA host build.');
45
+ process.exit(0);
46
+ }
47
+
48
+ // Build
49
+ console.log('[postinstall] Building WindowsUIA.exe...');
50
+ try {
51
+ execSync(
52
+ `powershell -ExecutionPolicy Bypass -File "${BUILD_SCRIPT}"`,
53
+ { cwd: ROOT, stdio: 'inherit', timeout: 120000 }
54
+ );
55
+ if (fs.existsSync(EXE)) {
56
+ console.log('[postinstall] WindowsUIA.exe built successfully.');
57
+ } else {
58
+ console.warn('[postinstall] Build completed but WindowsUIA.exe not found. Run manually: npm run build:uia');
59
+ }
60
+ } catch (err) {
61
+ console.warn('[postinstall] UIA host build failed (non-fatal). Run manually: npm run build:uia');
62
+ console.warn(' ' + (err.message || err));
63
+ }
@@ -23,9 +23,25 @@ function loadUI() {
23
23
  * liku window # List all windows
24
24
  * liku window "Visual Studio" # Focus window by title
25
25
  * liku window --active # Show active window info
26
+ * liku window --front "Notepad" # Bring window to front
27
+ * liku window --back "Notepad" # Send window to back
28
+ * liku window --minimize "Notepad"
29
+ * liku window --restore "Notepad"
26
30
  */
27
31
  async function run(args, options) {
28
32
  loadUI();
33
+
34
+ const titleFromArgs = args.length > 0 ? args.join(' ') : null;
35
+ const getTarget = (preferredTitle = null) => {
36
+ const title = preferredTitle || titleFromArgs || options.title || null;
37
+ if (options.hwnd) {
38
+ return { hwnd: Number(options.hwnd) };
39
+ }
40
+ if (title) {
41
+ return { title };
42
+ }
43
+ return null;
44
+ };
29
45
 
30
46
  // Show active window info
31
47
  if (options.active) {
@@ -49,6 +65,56 @@ ${highlight('Active Window:')}
49
65
  }
50
66
  return { success: true, window: win };
51
67
  }
68
+
69
+ if (options.front || options.back || options.minimize || options.restore || options.maximize) {
70
+ const operation = options.front ? 'front'
71
+ : options.back ? 'back'
72
+ : options.minimize ? 'minimize'
73
+ : options.maximize ? 'maximize'
74
+ : 'restore';
75
+
76
+ const preferredTitle =
77
+ typeof options.front === 'string' ? options.front
78
+ : typeof options.back === 'string' ? options.back
79
+ : typeof options.minimize === 'string' ? options.minimize
80
+ : typeof options.maximize === 'string' ? options.maximize
81
+ : typeof options.restore === 'string' ? options.restore
82
+ : null;
83
+
84
+ const target = getTarget(preferredTitle);
85
+ if (!target) {
86
+ error('No target window specified. Pass title text or --hwnd <handle>.');
87
+ return { success: false, error: 'No target window specified' };
88
+ }
89
+
90
+ if (!options.quiet) {
91
+ info(`Window op: ${operation} (${target.hwnd ? `hwnd=${target.hwnd}` : `title="${target.title}"`})`);
92
+ }
93
+
94
+ let result;
95
+ if (operation === 'front') {
96
+ result = await ui.bringWindowToFront(target);
97
+ } else if (operation === 'back') {
98
+ result = await ui.sendWindowToBack(target);
99
+ } else if (operation === 'minimize') {
100
+ result = await ui.minimizeWindow(target);
101
+ } else if (operation === 'maximize') {
102
+ result = await ui.maximizeWindow(target);
103
+ } else {
104
+ result = await ui.restoreWindow(target);
105
+ }
106
+
107
+ if (!result?.success) {
108
+ error(`Window operation failed: ${operation}`);
109
+ return { success: false, error: `window ${operation} failed`, operation };
110
+ }
111
+
112
+ if (!options.quiet) {
113
+ success(`Window operation complete: ${operation}`);
114
+ }
115
+
116
+ return { success: true, operation, target, result };
117
+ }
52
118
 
53
119
  // Focus window by title
54
120
  if (args.length > 0) {
@@ -12,7 +12,8 @@ const AgentRole = {
12
12
  SUPERVISOR: 'supervisor',
13
13
  BUILDER: 'builder',
14
14
  VERIFIER: 'verifier',
15
- RESEARCHER: 'researcher'
15
+ RESEARCHER: 'researcher',
16
+ PRODUCER: 'producer'
16
17
  };
17
18
 
18
19
  // Agent capabilities
@@ -115,12 +116,19 @@ class BaseAgent extends EventEmitter {
115
116
  });
116
117
 
117
118
  const systemPrompt = this.getSystemPrompt();
118
- const response = await this.aiService.chat(message, {
119
- systemPrompt,
120
- history: this.conversationHistory,
121
- model: options.model,
122
- ...options
123
- });
119
+ const CHAT_TIMEOUT_MS = 60000;
120
+
121
+ const response = await Promise.race([
122
+ this.aiService.chat(message, {
123
+ systemPrompt,
124
+ history: this.conversationHistory,
125
+ model: options.model,
126
+ ...options
127
+ }),
128
+ new Promise((_, reject) =>
129
+ setTimeout(() => reject(new Error(`AI chat timed out after ${CHAT_TIMEOUT_MS / 1000}s`)), CHAT_TIMEOUT_MS)
130
+ )
131
+ ]);
124
132
 
125
133
  // Add response to history
126
134
  this.conversationHistory.push({