@covibes/zeroshot 5.3.0 → 5.4.1

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 (119) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +8 -385
  3. package/cli/index.js +108 -4615
  4. package/package.json +16 -125
  5. package/CHANGELOG.md +0 -537
  6. package/cli/commands/providers.js +0 -150
  7. package/cli/lib/first-run.js +0 -211
  8. package/cli/lib/update-checker.js +0 -281
  9. package/cli/message-formatter-utils.js +0 -75
  10. package/cli/message-formatters-normal.js +0 -253
  11. package/cli/message-formatters-watch.js +0 -181
  12. package/cluster-templates/base-templates/debug-workflow.json +0 -375
  13. package/cluster-templates/base-templates/full-workflow.json +0 -697
  14. package/cluster-templates/base-templates/single-worker.json +0 -63
  15. package/cluster-templates/base-templates/worker-validator.json +0 -152
  16. package/cluster-templates/conductor-bootstrap.json +0 -124
  17. package/docker/zeroshot-cluster/Dockerfile +0 -152
  18. package/docker/zeroshot-cluster/pre-baked-deps.json +0 -28
  19. package/lib/completion.js +0 -174
  20. package/lib/docker-config.js +0 -212
  21. package/lib/id-detector.js +0 -53
  22. package/lib/provider-detection.js +0 -59
  23. package/lib/provider-names.js +0 -56
  24. package/lib/settings.js +0 -405
  25. package/lib/stream-json-parser.js +0 -10
  26. package/scripts/fix-node-pty-permissions.js +0 -75
  27. package/scripts/record-demo.sh +0 -279
  28. package/scripts/test-install.sh +0 -40
  29. package/scripts/validate-templates.js +0 -100
  30. package/src/agent/agent-config.js +0 -193
  31. package/src/agent/agent-context-builder.js +0 -335
  32. package/src/agent/agent-hook-executor.js +0 -402
  33. package/src/agent/agent-lifecycle.js +0 -683
  34. package/src/agent/agent-stuck-detector.js +0 -256
  35. package/src/agent/agent-task-executor.js +0 -1431
  36. package/src/agent/agent-trigger-evaluator.js +0 -67
  37. package/src/agent/output-extraction.js +0 -200
  38. package/src/agent/output-reformatter.js +0 -175
  39. package/src/agent/schema-utils.js +0 -111
  40. package/src/agent-wrapper.js +0 -570
  41. package/src/agents/git-pusher-agent.json +0 -20
  42. package/src/attach/attach-client.js +0 -438
  43. package/src/attach/attach-server.js +0 -543
  44. package/src/attach/index.js +0 -35
  45. package/src/attach/protocol.js +0 -220
  46. package/src/attach/ring-buffer.js +0 -121
  47. package/src/attach/socket-discovery.js +0 -267
  48. package/src/claude-task-runner.js +0 -523
  49. package/src/config-router.js +0 -80
  50. package/src/config-validator.js +0 -1660
  51. package/src/copy-worker.js +0 -43
  52. package/src/github.js +0 -139
  53. package/src/isolation-manager.js +0 -1381
  54. package/src/ledger.js +0 -614
  55. package/src/logic-engine.js +0 -223
  56. package/src/message-bus-bridge.js +0 -139
  57. package/src/message-bus.js +0 -249
  58. package/src/name-generator.js +0 -232
  59. package/src/orchestrator.js +0 -2519
  60. package/src/preflight.js +0 -485
  61. package/src/process-metrics.js +0 -566
  62. package/src/providers/anthropic/cli-builder.js +0 -45
  63. package/src/providers/anthropic/index.js +0 -134
  64. package/src/providers/anthropic/models.js +0 -23
  65. package/src/providers/anthropic/output-parser.js +0 -159
  66. package/src/providers/base-provider.js +0 -181
  67. package/src/providers/capabilities.js +0 -51
  68. package/src/providers/google/cli-builder.js +0 -55
  69. package/src/providers/google/index.js +0 -116
  70. package/src/providers/google/models.js +0 -24
  71. package/src/providers/google/output-parser.js +0 -92
  72. package/src/providers/index.js +0 -75
  73. package/src/providers/openai/cli-builder.js +0 -122
  74. package/src/providers/openai/index.js +0 -135
  75. package/src/providers/openai/models.js +0 -21
  76. package/src/providers/openai/output-parser.js +0 -129
  77. package/src/schemas/sub-cluster.js +0 -156
  78. package/src/status-footer.js +0 -980
  79. package/src/sub-cluster-wrapper.js +0 -560
  80. package/src/task-runner.js +0 -30
  81. package/src/template-resolver.js +0 -369
  82. package/src/tui/CHANGES.txt +0 -133
  83. package/src/tui/LAYOUT.md +0 -261
  84. package/src/tui/README.txt +0 -192
  85. package/src/tui/TWO-LEVEL-NAVIGATION.md +0 -186
  86. package/src/tui/data-poller.js +0 -325
  87. package/src/tui/demo.js +0 -208
  88. package/src/tui/formatters.js +0 -128
  89. package/src/tui/index.js +0 -193
  90. package/src/tui/keybindings.js +0 -383
  91. package/src/tui/layout.js +0 -334
  92. package/src/tui/renderer.js +0 -194
  93. package/task-lib/attachable-watcher.js +0 -272
  94. package/task-lib/claude-recovery.js +0 -119
  95. package/task-lib/commands/clean.js +0 -50
  96. package/task-lib/commands/get-log-path.js +0 -23
  97. package/task-lib/commands/kill.js +0 -32
  98. package/task-lib/commands/list.js +0 -105
  99. package/task-lib/commands/logs.js +0 -411
  100. package/task-lib/commands/resume.js +0 -42
  101. package/task-lib/commands/run.js +0 -57
  102. package/task-lib/commands/schedule.js +0 -105
  103. package/task-lib/commands/scheduler-cmd.js +0 -96
  104. package/task-lib/commands/schedules.js +0 -98
  105. package/task-lib/commands/status.js +0 -44
  106. package/task-lib/commands/unschedule.js +0 -16
  107. package/task-lib/completion.js +0 -9
  108. package/task-lib/config.js +0 -10
  109. package/task-lib/name-generator.js +0 -230
  110. package/task-lib/package.json +0 -3
  111. package/task-lib/runner.js +0 -144
  112. package/task-lib/scheduler.js +0 -252
  113. package/task-lib/store.js +0 -230
  114. package/task-lib/tui/formatters.js +0 -166
  115. package/task-lib/tui/index.js +0 -197
  116. package/task-lib/tui/layout.js +0 -111
  117. package/task-lib/tui/renderer.js +0 -119
  118. package/task-lib/tui.js +0 -384
  119. package/task-lib/watcher.js +0 -188
@@ -1,438 +0,0 @@
1
- /**
2
- * AttachClient - Terminal client for attaching to running tasks/agents
3
- *
4
- * Key sequences:
5
- * - Ctrl+C: Clean detach (return to shell, task continues running)
6
- * - Ctrl+B d: Also detach (for tmux muscle memory)
7
- * - Ctrl+B ?: Show help
8
- * - Ctrl+B c: Send SIGINT to process (interrupt agent - USE WITH CAUTION)
9
- * - Ctrl+Z: Forward SIGTSTP to process
10
- *
11
- * Features:
12
- * - Raw terminal mode (passes through all input)
13
- * - Output history replay on attach
14
- * - Terminal resize forwarding
15
- * - Graceful cleanup on exit
16
- */
17
-
18
- const net = require('net');
19
- const EventEmitter = require('events');
20
- const crypto = require('crypto');
21
-
22
- const protocol = require('./protocol');
23
-
24
- // Key codes
25
- const CTRL_B = '\x02';
26
- const CTRL_C = '\x03';
27
- const CTRL_Z = '\x1a';
28
-
29
- // Detach timeout (ms) - how long to wait for second key after Ctrl+B
30
- const DETACH_TIMEOUT = 500;
31
-
32
- class AttachClient extends EventEmitter {
33
- /**
34
- * @param {object} options
35
- * @param {string} options.socketPath - Unix socket path to connect to
36
- * @param {object} [options.stdin] - Input stream (default process.stdin)
37
- * @param {object} [options.stdout] - Output stream (default process.stdout)
38
- */
39
- constructor(options) {
40
- super();
41
-
42
- if (!options.socketPath) {
43
- throw new Error('AttachClient: socketPath is required');
44
- }
45
-
46
- this.socketPath = options.socketPath;
47
- this.stdin = options.stdin || process.stdin;
48
- this.stdout = options.stdout || process.stdout;
49
-
50
- this.clientId = crypto.randomUUID();
51
- this.socket = null;
52
- this.decoder = new protocol.MessageDecoder();
53
- this.connected = false;
54
- this.wasRawMode = null;
55
-
56
- // Ctrl+B sequence detection
57
- this.ctrlBPressed = false;
58
- this.ctrlBTimeout = null;
59
-
60
- // Bind handlers
61
- this._onSocketData = this._onSocketData.bind(this);
62
- this._onSocketClose = this._onSocketClose.bind(this);
63
- this._onSocketError = this._onSocketError.bind(this);
64
- this._onStdinData = this._onStdinData.bind(this);
65
- this._onResize = this._onResize.bind(this);
66
- }
67
-
68
- /**
69
- * Connect to the attach server
70
- * @returns {Promise<void>}
71
- */
72
- connect() {
73
- if (this.connected) {
74
- throw new Error('AttachClient: Already connected');
75
- }
76
-
77
- return new Promise((resolve, reject) => {
78
- this.socket = net.createConnection(this.socketPath);
79
-
80
- this.socket.on('connect', () => {
81
- this.connected = true;
82
-
83
- // Send attach message with terminal dimensions
84
- const cols = this.stdout.columns || 80;
85
- const rows = this.stdout.rows || 24;
86
-
87
- this.socket.write(protocol.encode(protocol.createAttachMessage(this.clientId, cols, rows)));
88
-
89
- // Set up terminal
90
- this._setupTerminal();
91
-
92
- // Set up socket handlers
93
- this.socket.on('data', this._onSocketData);
94
- this.socket.on('close', this._onSocketClose);
95
- this.socket.on('error', this._onSocketError);
96
-
97
- resolve();
98
- });
99
-
100
- this.socket.on('error', (err) => {
101
- if (!this.connected) {
102
- reject(err);
103
- }
104
- });
105
-
106
- // Connection timeout
107
- const timeout = setTimeout(() => {
108
- if (!this.connected) {
109
- this.socket.destroy();
110
- reject(new Error('Connection timeout'));
111
- }
112
- }, 5000);
113
-
114
- this.socket.on('connect', () => clearTimeout(timeout));
115
- });
116
- }
117
-
118
- /**
119
- * Disconnect from the server
120
- */
121
- disconnect() {
122
- if (!this.connected) {
123
- return;
124
- }
125
-
126
- // Send detach message
127
- try {
128
- this.socket.write(protocol.encode(protocol.createDetachMessage(this.clientId)));
129
- } catch {
130
- // Ignore
131
- }
132
-
133
- this._cleanup();
134
- this.emit('detach');
135
- }
136
-
137
- /**
138
- * Send a signal to the remote process
139
- * @param {string} signal - Signal name
140
- */
141
- sendSignal(signal) {
142
- if (!this.connected) {
143
- return;
144
- }
145
-
146
- try {
147
- this.socket.write(protocol.encode(protocol.createSignalMessage(signal)));
148
- } catch {
149
- // Ignore
150
- }
151
- }
152
-
153
- // ─────────────────────────────────────────────────────────────────
154
- // Private methods
155
- // ─────────────────────────────────────────────────────────────────
156
-
157
- /**
158
- * Set up terminal for raw mode
159
- * @private
160
- */
161
- _setupTerminal() {
162
- // Enable raw mode if stdin is a TTY
163
- if (this.stdin.isTTY && this.stdin.setRawMode) {
164
- this.wasRawMode = this.stdin.isRaw;
165
- this.stdin.setRawMode(true);
166
- }
167
-
168
- // Resume stdin (may be paused)
169
- this.stdin.resume();
170
-
171
- // Listen for input
172
- this.stdin.on('data', this._onStdinData);
173
-
174
- // Listen for resize events
175
- if (this.stdout.isTTY) {
176
- this.stdout.on('resize', this._onResize);
177
- }
178
-
179
- // Handle process signals for cleanup
180
- process.on('SIGINT', () => {
181
- // Clean detach on Ctrl+C - task continues running
182
- this.disconnect();
183
- });
184
-
185
- process.on('SIGTERM', () => {
186
- this._cleanup();
187
- process.exit(0);
188
- });
189
- }
190
-
191
- /**
192
- * Restore terminal state
193
- * @private
194
- */
195
- _restoreTerminal() {
196
- // Restore raw mode
197
- if (this.stdin.isTTY && this.stdin.setRawMode && this.wasRawMode !== null) {
198
- this.stdin.setRawMode(this.wasRawMode);
199
- }
200
-
201
- // Remove listeners
202
- this.stdin.removeListener('data', this._onStdinData);
203
- if (this.stdout.isTTY) {
204
- this.stdout.removeListener('resize', this._onResize);
205
- }
206
-
207
- // Pause stdin
208
- this.stdin.pause();
209
- }
210
-
211
- /**
212
- * Handle data from socket
213
- * @private
214
- */
215
- _onSocketData(data) {
216
- try {
217
- const messages = this.decoder.feed(data);
218
- for (const msg of messages) {
219
- this._handleMessage(msg);
220
- }
221
- } catch (e) {
222
- this.emit('error', new Error(`Protocol error: ${e.message}`));
223
- this._cleanup();
224
- }
225
- }
226
-
227
- /**
228
- * Handle message from server
229
- * @private
230
- */
231
- _handleMessage(message) {
232
- switch (message.type) {
233
- case protocol.MessageType.OUTPUT: {
234
- const data = protocol.decodeData(message);
235
- if (data) {
236
- this.stdout.write(data);
237
- }
238
- break;
239
- }
240
-
241
- case protocol.MessageType.HISTORY: {
242
- const data = protocol.decodeData(message);
243
- if (data) {
244
- this.stdout.write(data);
245
- }
246
- break;
247
- }
248
-
249
- case protocol.MessageType.STATE: {
250
- this.emit('state', message);
251
- break;
252
- }
253
-
254
- case protocol.MessageType.EXIT: {
255
- const { code, signal } = message;
256
- this.emit('exit', { code, signal });
257
- this._cleanup();
258
- break;
259
- }
260
-
261
- case protocol.MessageType.ERROR: {
262
- this.emit('error', new Error(message.message));
263
- break;
264
- }
265
- }
266
- }
267
-
268
- /**
269
- * Handle stdin data
270
- * @private
271
- */
272
- _onStdinData(data) {
273
- const str = data.toString();
274
-
275
- // Handle Ctrl+B sequence
276
- if (this.ctrlBPressed) {
277
- this.ctrlBPressed = false;
278
- if (this.ctrlBTimeout) {
279
- clearTimeout(this.ctrlBTimeout);
280
- this.ctrlBTimeout = null;
281
- }
282
-
283
- // Check for command keys
284
- if (str === 'd' || str === 'D') {
285
- // Detach
286
- this.disconnect();
287
- return;
288
- }
289
-
290
- if (str === 'c' || str === 'C') {
291
- // Send SIGINT to process (interrupt agent - USE WITH CAUTION)
292
- this.stdout.write('\r\n⚠️ Sending SIGINT to agent (interrupting task)...\r\n');
293
- this.sendSignal('SIGINT');
294
- return;
295
- }
296
-
297
- if (str === '?') {
298
- // Show help
299
- this._showHelp();
300
- return;
301
- }
302
-
303
- // Not a recognized command, forward Ctrl+B + this key
304
- this._forwardInput(Buffer.from([0x02]));
305
- this._forwardInput(data);
306
- return;
307
- }
308
-
309
- // Check for Ctrl+B
310
- if (str === CTRL_B) {
311
- this.ctrlBPressed = true;
312
-
313
- // Set timeout to forward if no follow-up key
314
- this.ctrlBTimeout = setTimeout(() => {
315
- if (this.ctrlBPressed) {
316
- this.ctrlBPressed = false;
317
- this._forwardInput(data);
318
- }
319
- }, DETACH_TIMEOUT);
320
- return;
321
- }
322
-
323
- // Check for Ctrl+C - clean detach (task continues running)
324
- if (str === CTRL_C) {
325
- this.disconnect();
326
- return;
327
- }
328
-
329
- // Check for Ctrl+Z
330
- if (str === CTRL_Z) {
331
- this.sendSignal('SIGTSTP');
332
- return;
333
- }
334
-
335
- // Forward other input (future interactive mode)
336
- this._forwardInput(data);
337
- }
338
-
339
- /**
340
- * Forward input to remote process
341
- * @private
342
- */
343
- _forwardInput(data) {
344
- if (!this.connected) {
345
- return;
346
- }
347
-
348
- try {
349
- this.socket.write(protocol.encode(protocol.createStdinMessage(data)));
350
- } catch {
351
- // Ignore
352
- }
353
- }
354
-
355
- /**
356
- * Handle terminal resize
357
- * @private
358
- */
359
- _onResize() {
360
- if (!this.connected) {
361
- return;
362
- }
363
-
364
- const cols = this.stdout.columns;
365
- const rows = this.stdout.rows;
366
-
367
- try {
368
- this.socket.write(protocol.encode(protocol.createResizeMessage(cols, rows)));
369
- } catch {
370
- // Ignore
371
- }
372
- }
373
-
374
- /**
375
- * Handle socket close
376
- * @private
377
- */
378
- _onSocketClose() {
379
- if (this.connected) {
380
- this.emit('close');
381
- this._cleanup();
382
- }
383
- }
384
-
385
- /**
386
- * Handle socket error
387
- * @private
388
- */
389
- _onSocketError(err) {
390
- this.emit('error', err);
391
- this._cleanup();
392
- }
393
-
394
- /**
395
- * Show help message
396
- * @private
397
- */
398
- _showHelp() {
399
- const help = `
400
- \r\n╭──────────────────────────────────────────────────────────╮
401
- \r\n│ Vibe Attach - Key Bindings │
402
- \r\n├──────────────────────────────────────────────────────────┤
403
- \r\n│ Ctrl+C Detach (task continues running) │
404
- \r\n│ Ctrl+B d Also detach (for tmux muscle memory) │
405
- \r\n│ Ctrl+B ? Show this help │
406
- \r\n│ Ctrl+B c ⚠️ Interrupt agent (sends SIGINT) │
407
- \r\n│ Ctrl+Z Suspend process (sends SIGTSTP) │
408
- \r\n╰──────────────────────────────────────────────────────────╯
409
- \r\n`;
410
- this.stdout.write(help);
411
- }
412
-
413
- /**
414
- * Clean up resources
415
- * @private
416
- */
417
- _cleanup() {
418
- this.connected = false;
419
-
420
- // Clear Ctrl+B timeout
421
- if (this.ctrlBTimeout) {
422
- clearTimeout(this.ctrlBTimeout);
423
- this.ctrlBTimeout = null;
424
- }
425
-
426
- // Restore terminal
427
- this._restoreTerminal();
428
-
429
- // Close socket
430
- if (this.socket) {
431
- this.socket.removeAllListeners();
432
- this.socket.destroy();
433
- this.socket = null;
434
- }
435
- }
436
- }
437
-
438
- module.exports = AttachClient;