@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
@@ -5,7 +5,8 @@
5
5
  * following logs, and assembling results.
6
6
  */
7
7
 
8
- const { spawn, exec, execSync } = require('child_process');
8
+ const { spawn } = require('child_process');
9
+ const { exec, execSync } = require('./lib/safe-exec'); // Enforces timeouts
9
10
  const fs = require('fs');
10
11
  const TaskRunner = require('./task-runner');
11
12
  const { loadSettings } = require('../lib/settings');
@@ -61,23 +62,19 @@ class ClaudeTaskRunner extends TaskRunner {
61
62
 
62
63
  const settings = loadSettings();
63
64
  const providerName = normalizeProviderName(provider || settings.defaultProvider || 'claude');
64
- const providerModule = getProvider(providerName);
65
- const providerSettings = settings.providerSettings?.[providerName] || {};
66
- const levelOverrides = providerSettings.levelOverrides || {};
67
-
68
- let resolvedModelSpec = explicitModelSpec;
69
- if (!resolvedModelSpec) {
70
- if (model) {
71
- resolvedModelSpec = { model, reasoningEffort };
72
- } else {
73
- const level =
74
- modelLevel || providerSettings.defaultLevel || providerModule.getDefaultLevel();
75
- resolvedModelSpec = providerModule.resolveModelSpec(level, levelOverrides);
76
- if (reasoningEffort) {
77
- resolvedModelSpec = { ...resolvedModelSpec, reasoningEffort };
78
- }
79
- }
80
- }
65
+ const { providerModule, providerSettings, levelOverrides } = this._getProviderContext(
66
+ providerName,
67
+ settings
68
+ );
69
+ const resolvedModelSpec = this._resolveModelSpec({
70
+ explicitModelSpec,
71
+ model,
72
+ reasoningEffort,
73
+ modelLevel,
74
+ providerModule,
75
+ providerSettings,
76
+ levelOverrides,
77
+ });
81
78
 
82
79
  // Isolation mode delegates to separate method
83
80
  if (isolation?.enabled) {
@@ -90,15 +87,74 @@ class ClaudeTaskRunner extends TaskRunner {
90
87
 
91
88
  const ctPath = 'zeroshot';
92
89
 
93
- // Build args.
90
+ const runOutputFormat = this._resolveOutputFormat({
91
+ outputFormat,
92
+ jsonSchema,
93
+ strictSchema,
94
+ });
95
+ const args = this._buildRunArgs({
96
+ context,
97
+ providerName,
98
+ runOutputFormat,
99
+ resolvedModelSpec,
100
+ jsonSchema,
101
+ });
102
+
103
+ // Spawn and get task ID
104
+ const spawnEnv = this._buildSpawnEnv(providerName, resolvedModelSpec);
105
+
106
+ const taskId = await this._spawnAndGetTaskId(ctPath, args, cwd, spawnEnv, agentId);
107
+
108
+ this._log(`📋 [${agentId}]: Following zeroshot logs for ${taskId}`);
109
+
110
+ // Wait for task registration
111
+ await this._waitForTaskReady(ctPath, taskId);
112
+
113
+ // Follow logs until completion
114
+ return this._followLogs(ctPath, taskId, agentId);
115
+ }
116
+
117
+ _getProviderContext(providerName, settings) {
118
+ const providerModule = getProvider(providerName);
119
+ const providerSettings = settings.providerSettings?.[providerName] || {};
120
+ const levelOverrides = providerSettings.levelOverrides || {};
121
+ return { providerModule, providerSettings, levelOverrides };
122
+ }
123
+
124
+ _resolveModelSpec({
125
+ explicitModelSpec,
126
+ model,
127
+ reasoningEffort,
128
+ modelLevel,
129
+ providerModule,
130
+ providerSettings,
131
+ levelOverrides,
132
+ }) {
133
+ if (explicitModelSpec) {
134
+ return explicitModelSpec;
135
+ }
136
+
137
+ if (model) {
138
+ return { model, reasoningEffort };
139
+ }
140
+
141
+ const level = modelLevel || providerSettings.defaultLevel || providerModule.getDefaultLevel();
142
+ let resolvedModelSpec = providerModule.resolveModelSpec(level, levelOverrides);
143
+ if (reasoningEffort) {
144
+ resolvedModelSpec = { ...resolvedModelSpec, reasoningEffort };
145
+ }
146
+
147
+ return resolvedModelSpec;
148
+ }
149
+
150
+ _resolveOutputFormat({ outputFormat, jsonSchema, strictSchema }) {
94
151
  // json output does not stream; if a jsonSchema is configured we run stream-json
95
152
  // for live logs and validate/parse JSON after completion.
96
153
  // Set strictSchema=true to disable live streaming and use CLI's native schema enforcement.
97
- const desiredOutputFormat = outputFormat;
98
- const runOutputFormat =
99
- jsonSchema && desiredOutputFormat === 'json' && !strictSchema
100
- ? 'stream-json'
101
- : desiredOutputFormat;
154
+ return jsonSchema && outputFormat === 'json' && !strictSchema ? 'stream-json' : outputFormat;
155
+ }
156
+
157
+ _buildRunArgs({ context, providerName, runOutputFormat, resolvedModelSpec, jsonSchema }) {
102
158
  const args = ['task', 'run', '--output-format', runOutputFormat, '--provider', providerName];
103
159
 
104
160
  if (resolvedModelSpec?.model) {
@@ -116,7 +172,10 @@ class ClaudeTaskRunner extends TaskRunner {
116
172
 
117
173
  args.push(context);
118
174
 
119
- // Spawn and get task ID
175
+ return args;
176
+ }
177
+
178
+ _buildSpawnEnv(providerName, resolvedModelSpec) {
120
179
  const spawnEnv = {
121
180
  ...process.env,
122
181
  };
@@ -124,15 +183,7 @@ class ClaudeTaskRunner extends TaskRunner {
124
183
  spawnEnv.ANTHROPIC_MODEL = resolvedModelSpec.model;
125
184
  }
126
185
 
127
- const taskId = await this._spawnAndGetTaskId(ctPath, args, cwd, spawnEnv, agentId);
128
-
129
- this._log(`📋 [${agentId}]: Following zeroshot logs for ${taskId}`);
130
-
131
- // Wait for task registration
132
- await this._waitForTaskReady(ctPath, taskId);
133
-
134
- // Follow logs until completion
135
- return this._followLogs(ctPath, taskId, agentId);
186
+ return spawnEnv;
136
187
  }
137
188
 
138
189
  /**