@covibes/zeroshot 5.3.0 → 5.4.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.
Files changed (82) hide show
  1. package/README.md +94 -14
  2. package/cli/commands/providers.js +8 -9
  3. package/cli/index.js +3032 -2409
  4. package/cli/message-formatters-normal.js +28 -6
  5. package/cluster-templates/base-templates/debug-workflow.json +1 -1
  6. package/cluster-templates/base-templates/full-workflow.json +72 -188
  7. package/cluster-templates/base-templates/worker-validator.json +59 -3
  8. package/cluster-templates/conductor-bootstrap.json +4 -4
  9. package/lib/docker-config.js +8 -0
  10. package/lib/git-remote-utils.js +165 -0
  11. package/lib/id-detector.js +10 -7
  12. package/lib/provider-defaults.js +62 -0
  13. package/lib/provider-names.js +2 -1
  14. package/lib/settings/claude-auth.js +78 -0
  15. package/lib/settings.js +161 -63
  16. package/package.json +7 -2
  17. package/scripts/setup-merge-queue.sh +170 -0
  18. package/src/agent/agent-config.js +135 -82
  19. package/src/agent/agent-context-builder.js +297 -188
  20. package/src/agent/agent-hook-executor.js +310 -113
  21. package/src/agent/agent-lifecycle.js +385 -325
  22. package/src/agent/agent-stuck-detector.js +7 -7
  23. package/src/agent/agent-task-executor.js +824 -565
  24. package/src/agent/output-extraction.js +41 -24
  25. package/src/agent/output-reformatter.js +1 -1
  26. package/src/agent/schema-utils.js +108 -73
  27. package/src/agent-wrapper.js +10 -1
  28. package/src/agents/git-pusher-template.js +285 -0
  29. package/src/claude-task-runner.js +85 -34
  30. package/src/config-validator.js +922 -657
  31. package/src/input-helpers.js +65 -0
  32. package/src/isolation-manager.js +289 -199
  33. package/src/issue-providers/README.md +305 -0
  34. package/src/issue-providers/azure-devops-provider.js +273 -0
  35. package/src/issue-providers/base-provider.js +232 -0
  36. package/src/issue-providers/github-provider.js +179 -0
  37. package/src/issue-providers/gitlab-provider.js +241 -0
  38. package/src/issue-providers/index.js +196 -0
  39. package/src/issue-providers/jira-provider.js +239 -0
  40. package/src/ledger.js +22 -5
  41. package/src/lib/safe-exec.js +88 -0
  42. package/src/orchestrator.js +1107 -811
  43. package/src/preflight.js +313 -159
  44. package/src/process-metrics.js +98 -56
  45. package/src/providers/anthropic/cli-builder.js +53 -25
  46. package/src/providers/anthropic/index.js +72 -2
  47. package/src/providers/anthropic/output-parser.js +32 -14
  48. package/src/providers/base-provider.js +70 -0
  49. package/src/providers/capabilities.js +9 -0
  50. package/src/providers/google/output-parser.js +47 -38
  51. package/src/providers/index.js +19 -3
  52. package/src/providers/openai/cli-builder.js +14 -3
  53. package/src/providers/openai/index.js +1 -0
  54. package/src/providers/openai/output-parser.js +44 -30
  55. package/src/providers/opencode/cli-builder.js +42 -0
  56. package/src/providers/opencode/index.js +103 -0
  57. package/src/providers/opencode/models.js +55 -0
  58. package/src/providers/opencode/output-parser.js +122 -0
  59. package/src/schemas/sub-cluster.js +68 -39
  60. package/src/status-footer.js +94 -48
  61. package/src/sub-cluster-wrapper.js +76 -35
  62. package/src/template-resolver.js +12 -9
  63. package/src/tui/data-poller.js +123 -99
  64. package/src/tui/formatters.js +4 -3
  65. package/src/tui/keybindings.js +259 -318
  66. package/src/tui/renderer.js +11 -21
  67. package/task-lib/attachable-watcher.js +118 -81
  68. package/task-lib/claude-recovery.js +61 -24
  69. package/task-lib/commands/episodes.js +105 -0
  70. package/task-lib/commands/list.js +2 -2
  71. package/task-lib/commands/logs.js +231 -189
  72. package/task-lib/commands/schedules.js +111 -61
  73. package/task-lib/config.js +0 -2
  74. package/task-lib/runner.js +84 -27
  75. package/task-lib/scheduler.js +1 -1
  76. package/task-lib/store.js +467 -168
  77. package/task-lib/tui/formatters.js +94 -45
  78. package/task-lib/tui/renderer.js +13 -3
  79. package/task-lib/tui.js +73 -32
  80. package/task-lib/watcher.js +128 -90
  81. package/src/agents/git-pusher-agent.json +0 -20
  82. package/src/github.js +0 -139
@@ -2,9 +2,7 @@ import { homedir } from 'os';
2
2
  import { join } from 'path';
3
3
 
4
4
  export const TASKS_DIR = join(homedir(), '.claude-zeroshot');
5
- export const TASKS_FILE = join(TASKS_DIR, 'tasks.json');
6
5
  export const LOGS_DIR = join(TASKS_DIR, 'logs');
7
- export const SCHEDULES_FILE = join(TASKS_DIR, 'schedules.json');
8
6
  export const SCHEDULER_PID_FILE = join(TASKS_DIR, 'scheduler.pid');
9
7
  export const SCHEDULER_LOG = join(TASKS_DIR, 'scheduler.log');
10
8
  export const DEFAULT_MODEL = 'sonnet';
@@ -20,45 +20,98 @@ export async function spawnTask(prompt, options = {}) {
20
20
  const cwd = options.cwd || process.cwd();
21
21
 
22
22
  const settings = loadSettings();
23
+ const { providerName, provider, providerSettings, levelOverrides } = resolveProviderContext(
24
+ options,
25
+ settings
26
+ );
27
+
28
+ const outputFormat = resolveOutputFormat(options);
29
+ const jsonSchema = resolveJsonSchema(options, outputFormat);
30
+ const modelSpec = resolveModelSpec(options, provider, providerSettings, levelOverrides);
31
+
32
+ const cliFeatures = await provider.getCliFeatures();
33
+ const commandSpec = provider.buildCommand(prompt, {
34
+ modelSpec,
35
+ outputFormat,
36
+ jsonSchema,
37
+ cwd,
38
+ autoApprove: true,
39
+ cliFeatures,
40
+ });
41
+
42
+ const finalArgs = resolveFinalArgs(commandSpec, providerName, options);
43
+ const task = buildTaskRecord({
44
+ id,
45
+ prompt,
46
+ cwd,
47
+ options,
48
+ logFile,
49
+ providerName,
50
+ modelSpec,
51
+ });
52
+
53
+ addTask(task);
54
+
55
+ const watcherConfig = buildWatcherConfig(
56
+ outputFormat,
57
+ jsonSchema,
58
+ options,
59
+ providerName,
60
+ commandSpec
61
+ );
62
+ const watcherScript = resolveWatcherScript(options);
63
+ spawnWatcher({
64
+ watcherScript,
65
+ id,
66
+ cwd,
67
+ logFile,
68
+ finalArgs,
69
+ watcherConfig,
70
+ });
71
+
72
+ return task;
73
+ }
74
+
75
+ function resolveProviderContext(options, settings) {
23
76
  const providerName = normalizeProviderName(
24
77
  options.provider || settings.defaultProvider || 'claude'
25
78
  );
26
79
  const provider = getProvider(providerName);
27
80
  const providerSettings = settings.providerSettings?.[providerName] || {};
28
81
  const levelOverrides = providerSettings.levelOverrides || {};
82
+ return { providerName, provider, providerSettings, levelOverrides };
83
+ }
29
84
 
30
- const outputFormat = options.outputFormat || 'stream-json';
85
+ function resolveOutputFormat(options) {
86
+ return options.outputFormat || 'stream-json';
87
+ }
31
88
 
89
+ function resolveJsonSchema(options, outputFormat) {
32
90
  let jsonSchema = options.jsonSchema || null;
33
91
  if (jsonSchema && outputFormat !== 'json') {
34
92
  console.warn('Warning: --json-schema requires --output-format json, ignoring schema');
35
93
  jsonSchema = null;
36
94
  }
95
+ return jsonSchema;
96
+ }
37
97
 
38
- let modelSpec;
98
+ function resolveModelSpec(options, provider, providerSettings, levelOverrides) {
39
99
  if (options.model) {
40
- modelSpec = {
100
+ return {
41
101
  model: options.model,
42
102
  reasoningEffort: options.reasoningEffort,
43
103
  };
44
- } else {
45
- const level = options.modelLevel || providerSettings.defaultLevel || provider.getDefaultLevel();
46
- modelSpec = provider.resolveModelSpec(level, levelOverrides);
47
- if (options.reasoningEffort) {
48
- modelSpec = { ...modelSpec, reasoningEffort: options.reasoningEffort };
49
- }
50
104
  }
51
105
 
52
- const cliFeatures = await provider.getCliFeatures();
53
- const commandSpec = provider.buildCommand(prompt, {
54
- modelSpec,
55
- outputFormat,
56
- jsonSchema,
57
- cwd,
58
- autoApprove: true,
59
- cliFeatures,
60
- });
106
+ const level = options.modelLevel || providerSettings.defaultLevel || provider.getDefaultLevel();
107
+ let modelSpec = provider.resolveModelSpec(level, levelOverrides);
108
+ if (options.reasoningEffort) {
109
+ modelSpec = { ...modelSpec, reasoningEffort: options.reasoningEffort };
110
+ }
111
+ return modelSpec;
112
+ }
61
113
 
114
+ function resolveFinalArgs(commandSpec, providerName, options) {
62
115
  const finalArgs = [...commandSpec.args];
63
116
  if (providerName === 'claude') {
64
117
  const promptIndex = finalArgs.length - 1;
@@ -70,8 +123,11 @@ export async function spawnTask(prompt, options = {}) {
70
123
  } else if (options.resume || options.continue) {
71
124
  console.warn('Warning: resume/continue is only supported for Claude CLI; ignoring.');
72
125
  }
126
+ return finalArgs;
127
+ }
73
128
 
74
- const task = {
129
+ function buildTaskRecord({ id, prompt, cwd, options, logFile, providerName, modelSpec }) {
130
+ return {
75
131
  id,
76
132
  prompt: prompt.slice(0, 200) + (prompt.length > 200 ? '...' : ''),
77
133
  fullPrompt: prompt,
@@ -92,10 +148,10 @@ export async function spawnTask(prompt, options = {}) {
92
148
  socketPath: null,
93
149
  attachable: false,
94
150
  };
151
+ }
95
152
 
96
- addTask(task);
97
-
98
- const watcherConfig = {
153
+ function buildWatcherConfig(outputFormat, jsonSchema, options, providerName, commandSpec) {
154
+ return {
99
155
  outputFormat,
100
156
  jsonSchema,
101
157
  silentJsonOutput: options.silentJsonOutput || false,
@@ -103,12 +159,14 @@ export async function spawnTask(prompt, options = {}) {
103
159
  command: commandSpec.binary,
104
160
  env: commandSpec.env || {},
105
161
  };
162
+ }
106
163
 
164
+ function resolveWatcherScript(options) {
107
165
  const useAttachable = options.attachable !== false && !options.jsonSchema;
108
- const watcherScript = useAttachable
109
- ? join(__dirname, 'attachable-watcher.js')
110
- : join(__dirname, 'watcher.js');
166
+ return useAttachable ? join(__dirname, 'attachable-watcher.js') : join(__dirname, 'watcher.js');
167
+ }
111
168
 
169
+ function spawnWatcher({ watcherScript, id, cwd, logFile, finalArgs, watcherConfig }) {
112
170
  const watcher = fork(
113
171
  watcherScript,
114
172
  [id, cwd, logFile, JSON.stringify(finalArgs), JSON.stringify(watcherConfig)],
@@ -119,8 +177,7 @@ export async function spawnTask(prompt, options = {}) {
119
177
  );
120
178
 
121
179
  watcher.unref();
122
-
123
- return task;
180
+ watcher.disconnect(); // Close IPC channel so parent can exit
124
181
  }
125
182
 
126
183
  export function isProcessRunning(pid) {
@@ -17,7 +17,7 @@ const CHECK_INTERVAL = 60000; // 60 seconds
17
17
  * Supports: 30s, 5m, 2h, 1d, 1w
18
18
  */
19
19
  export function parseInterval(str) {
20
- const match = str.match(/^(\d+)(s|m|h|d|w)$/i);
20
+ const match = str.match(/^(\d+)([smhdw])$/i);
21
21
  if (!match) return null;
22
22
 
23
23
  const value = parseInt(match[1], 10);