@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.
- package/LICENSE +1 -1
- package/README.md +8 -385
- package/cli/index.js +108 -4615
- package/package.json +16 -125
- package/CHANGELOG.md +0 -537
- package/cli/commands/providers.js +0 -150
- package/cli/lib/first-run.js +0 -211
- package/cli/lib/update-checker.js +0 -281
- package/cli/message-formatter-utils.js +0 -75
- package/cli/message-formatters-normal.js +0 -253
- package/cli/message-formatters-watch.js +0 -181
- package/cluster-templates/base-templates/debug-workflow.json +0 -375
- package/cluster-templates/base-templates/full-workflow.json +0 -697
- package/cluster-templates/base-templates/single-worker.json +0 -63
- package/cluster-templates/base-templates/worker-validator.json +0 -152
- package/cluster-templates/conductor-bootstrap.json +0 -124
- package/docker/zeroshot-cluster/Dockerfile +0 -152
- package/docker/zeroshot-cluster/pre-baked-deps.json +0 -28
- package/lib/completion.js +0 -174
- package/lib/docker-config.js +0 -212
- package/lib/id-detector.js +0 -53
- package/lib/provider-detection.js +0 -59
- package/lib/provider-names.js +0 -56
- package/lib/settings.js +0 -405
- package/lib/stream-json-parser.js +0 -10
- package/scripts/fix-node-pty-permissions.js +0 -75
- package/scripts/record-demo.sh +0 -279
- package/scripts/test-install.sh +0 -40
- package/scripts/validate-templates.js +0 -100
- package/src/agent/agent-config.js +0 -193
- package/src/agent/agent-context-builder.js +0 -335
- package/src/agent/agent-hook-executor.js +0 -402
- package/src/agent/agent-lifecycle.js +0 -683
- package/src/agent/agent-stuck-detector.js +0 -256
- package/src/agent/agent-task-executor.js +0 -1431
- package/src/agent/agent-trigger-evaluator.js +0 -67
- package/src/agent/output-extraction.js +0 -200
- package/src/agent/output-reformatter.js +0 -175
- package/src/agent/schema-utils.js +0 -111
- package/src/agent-wrapper.js +0 -570
- package/src/agents/git-pusher-agent.json +0 -20
- package/src/attach/attach-client.js +0 -438
- package/src/attach/attach-server.js +0 -543
- package/src/attach/index.js +0 -35
- package/src/attach/protocol.js +0 -220
- package/src/attach/ring-buffer.js +0 -121
- package/src/attach/socket-discovery.js +0 -267
- package/src/claude-task-runner.js +0 -523
- package/src/config-router.js +0 -80
- package/src/config-validator.js +0 -1660
- package/src/copy-worker.js +0 -43
- package/src/github.js +0 -139
- package/src/isolation-manager.js +0 -1381
- package/src/ledger.js +0 -614
- package/src/logic-engine.js +0 -223
- package/src/message-bus-bridge.js +0 -139
- package/src/message-bus.js +0 -249
- package/src/name-generator.js +0 -232
- package/src/orchestrator.js +0 -2519
- package/src/preflight.js +0 -485
- package/src/process-metrics.js +0 -566
- package/src/providers/anthropic/cli-builder.js +0 -45
- package/src/providers/anthropic/index.js +0 -134
- package/src/providers/anthropic/models.js +0 -23
- package/src/providers/anthropic/output-parser.js +0 -159
- package/src/providers/base-provider.js +0 -181
- package/src/providers/capabilities.js +0 -51
- package/src/providers/google/cli-builder.js +0 -55
- package/src/providers/google/index.js +0 -116
- package/src/providers/google/models.js +0 -24
- package/src/providers/google/output-parser.js +0 -92
- package/src/providers/index.js +0 -75
- package/src/providers/openai/cli-builder.js +0 -122
- package/src/providers/openai/index.js +0 -135
- package/src/providers/openai/models.js +0 -21
- package/src/providers/openai/output-parser.js +0 -129
- package/src/schemas/sub-cluster.js +0 -156
- package/src/status-footer.js +0 -980
- package/src/sub-cluster-wrapper.js +0 -560
- package/src/task-runner.js +0 -30
- package/src/template-resolver.js +0 -369
- package/src/tui/CHANGES.txt +0 -133
- package/src/tui/LAYOUT.md +0 -261
- package/src/tui/README.txt +0 -192
- package/src/tui/TWO-LEVEL-NAVIGATION.md +0 -186
- package/src/tui/data-poller.js +0 -325
- package/src/tui/demo.js +0 -208
- package/src/tui/formatters.js +0 -128
- package/src/tui/index.js +0 -193
- package/src/tui/keybindings.js +0 -383
- package/src/tui/layout.js +0 -334
- package/src/tui/renderer.js +0 -194
- package/task-lib/attachable-watcher.js +0 -272
- package/task-lib/claude-recovery.js +0 -119
- package/task-lib/commands/clean.js +0 -50
- package/task-lib/commands/get-log-path.js +0 -23
- package/task-lib/commands/kill.js +0 -32
- package/task-lib/commands/list.js +0 -105
- package/task-lib/commands/logs.js +0 -411
- package/task-lib/commands/resume.js +0 -42
- package/task-lib/commands/run.js +0 -57
- package/task-lib/commands/schedule.js +0 -105
- package/task-lib/commands/scheduler-cmd.js +0 -96
- package/task-lib/commands/schedules.js +0 -98
- package/task-lib/commands/status.js +0 -44
- package/task-lib/commands/unschedule.js +0 -16
- package/task-lib/completion.js +0 -9
- package/task-lib/config.js +0 -10
- package/task-lib/name-generator.js +0 -230
- package/task-lib/package.json +0 -3
- package/task-lib/runner.js +0 -144
- package/task-lib/scheduler.js +0 -252
- package/task-lib/store.js +0 -230
- package/task-lib/tui/formatters.js +0 -166
- package/task-lib/tui/index.js +0 -197
- package/task-lib/tui/layout.js +0 -111
- package/task-lib/tui/renderer.js +0 -119
- package/task-lib/tui.js +0 -384
- package/task-lib/watcher.js +0 -188
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
const BaseProvider = require('../base-provider');
|
|
2
|
-
const { getClaudeCommand } = require('../../../lib/settings');
|
|
3
|
-
const { commandExists, getCommandPath, getHelpOutput } = require('../../../lib/provider-detection');
|
|
4
|
-
const { buildCommand } = require('./cli-builder');
|
|
5
|
-
const { parseEvent } = require('./output-parser');
|
|
6
|
-
const {
|
|
7
|
-
MODEL_CATALOG,
|
|
8
|
-
LEVEL_MAPPING,
|
|
9
|
-
DEFAULT_LEVEL,
|
|
10
|
-
DEFAULT_MAX_LEVEL,
|
|
11
|
-
DEFAULT_MIN_LEVEL,
|
|
12
|
-
} = require('./models');
|
|
13
|
-
|
|
14
|
-
const warned = new Set();
|
|
15
|
-
|
|
16
|
-
class AnthropicProvider extends BaseProvider {
|
|
17
|
-
constructor() {
|
|
18
|
-
super({ name: 'claude', displayName: 'Claude', cliCommand: 'claude' });
|
|
19
|
-
this._cliFeatures = null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// SDK not implemented - uses CLI only
|
|
23
|
-
// See BaseProvider for SDK extension point documentation
|
|
24
|
-
|
|
25
|
-
isAvailable() {
|
|
26
|
-
const { command } = getClaudeCommand();
|
|
27
|
-
return commandExists(command);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
getCliPath() {
|
|
31
|
-
const { command } = getClaudeCommand();
|
|
32
|
-
return getCommandPath(command) || command;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
getInstallInstructions() {
|
|
36
|
-
return ['npm install -g @anthropic-ai/claude-code', 'Or (macOS): brew install claude'].join(
|
|
37
|
-
'\n'
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
getAuthInstructions() {
|
|
42
|
-
return 'claude login';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
getCliFeatures() {
|
|
46
|
-
if (this._cliFeatures) return this._cliFeatures;
|
|
47
|
-
|
|
48
|
-
const { command, args } = getClaudeCommand();
|
|
49
|
-
const help = getHelpOutput(command, args);
|
|
50
|
-
const unknown = !help;
|
|
51
|
-
|
|
52
|
-
const features = {
|
|
53
|
-
supportsOutputFormat: unknown ? true : /--output-format/.test(help),
|
|
54
|
-
supportsStreamJson: unknown ? true : /stream-json/.test(help),
|
|
55
|
-
supportsJsonSchema: unknown ? true : /--json-schema/.test(help),
|
|
56
|
-
supportsAutoApprove: unknown ? true : /--dangerously-skip-permissions/.test(help),
|
|
57
|
-
supportsIncludePartials: unknown ? true : /--include-partial-messages/.test(help),
|
|
58
|
-
supportsVerbose: unknown ? true : /--verbose/.test(help),
|
|
59
|
-
supportsModel: unknown ? true : /--model/.test(help),
|
|
60
|
-
unknown,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
this._cliFeatures = features;
|
|
64
|
-
return features;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
getCredentialPaths() {
|
|
68
|
-
return ['~/.claude'];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
buildCommand(context, options) {
|
|
72
|
-
const { command, args } = getClaudeCommand();
|
|
73
|
-
const cliFeatures = options.cliFeatures || {};
|
|
74
|
-
|
|
75
|
-
if (options.jsonSchema && options.outputFormat !== 'json' && !options.strictSchema) {
|
|
76
|
-
this._warnOnce(
|
|
77
|
-
'claude-jsonschema-stream',
|
|
78
|
-
'jsonSchema requested with stream output; schema enforcement will be post-validated.'
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (
|
|
83
|
-
options.jsonSchema &&
|
|
84
|
-
options.outputFormat === 'json' &&
|
|
85
|
-
cliFeatures.supportsJsonSchema === false
|
|
86
|
-
) {
|
|
87
|
-
this._warnOnce(
|
|
88
|
-
'claude-jsonschema-flag',
|
|
89
|
-
'Claude CLI does not support --json-schema; skipping schema flag.'
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (options.autoApprove && cliFeatures.supportsAutoApprove === false) {
|
|
94
|
-
this._warnOnce(
|
|
95
|
-
'claude-auto-approve',
|
|
96
|
-
'Claude CLI does not support --dangerously-skip-permissions; continuing without auto-approve.'
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return buildCommand(context, { ...options, cliFeatures }, { command, args });
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
parseEvent(line) {
|
|
104
|
-
return parseEvent(line);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
getModelCatalog() {
|
|
108
|
-
return MODEL_CATALOG;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
getLevelMapping() {
|
|
112
|
-
return LEVEL_MAPPING;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
getDefaultLevel() {
|
|
116
|
-
return DEFAULT_LEVEL;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
getDefaultMaxLevel() {
|
|
120
|
-
return DEFAULT_MAX_LEVEL;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
getDefaultMinLevel() {
|
|
124
|
-
return DEFAULT_MIN_LEVEL;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
_warnOnce(key, message) {
|
|
128
|
-
if (warned.has(key)) return;
|
|
129
|
-
warned.add(key);
|
|
130
|
-
console.warn(`⚠️ ${message}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
module.exports = AnthropicProvider;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const MODEL_CATALOG = {
|
|
2
|
-
haiku: { rank: 1 },
|
|
3
|
-
sonnet: { rank: 2 },
|
|
4
|
-
opus: { rank: 3 },
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const LEVEL_MAPPING = {
|
|
8
|
-
level1: { rank: 1, model: 'haiku' },
|
|
9
|
-
level2: { rank: 2, model: 'sonnet' },
|
|
10
|
-
level3: { rank: 3, model: 'opus' },
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const DEFAULT_LEVEL = 'level2';
|
|
14
|
-
const DEFAULT_MAX_LEVEL = 'level3';
|
|
15
|
-
const DEFAULT_MIN_LEVEL = 'level1';
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
MODEL_CATALOG,
|
|
19
|
-
LEVEL_MAPPING,
|
|
20
|
-
DEFAULT_LEVEL,
|
|
21
|
-
DEFAULT_MAX_LEVEL,
|
|
22
|
-
DEFAULT_MIN_LEVEL,
|
|
23
|
-
};
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stream JSON Parser for Claude Code output
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Parse a single JSON line and extract displayable content
|
|
7
|
-
* @param {string} line
|
|
8
|
-
* @returns {Object|null}
|
|
9
|
-
*/
|
|
10
|
-
function parseEvent(line) {
|
|
11
|
-
const trimmed = line.trim();
|
|
12
|
-
if (!trimmed || !trimmed.startsWith('{') || !trimmed.endsWith('}')) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
let event;
|
|
17
|
-
try {
|
|
18
|
-
event = JSON.parse(trimmed);
|
|
19
|
-
} catch {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (event.type === 'stream_event' && event.event) {
|
|
24
|
-
return parseStreamEvent(event.event);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (event.type === 'assistant' && event.message?.content) {
|
|
28
|
-
return parseAssistantMessage(event.message);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (event.type === 'user' && event.message?.content) {
|
|
32
|
-
return parseUserMessage(event.message);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (event.type === 'result') {
|
|
36
|
-
const usage = event.usage || {};
|
|
37
|
-
return {
|
|
38
|
-
type: 'result',
|
|
39
|
-
success: event.subtype === 'success',
|
|
40
|
-
result: event.result,
|
|
41
|
-
error: event.is_error ? event.result : null,
|
|
42
|
-
cost: event.total_cost_usd,
|
|
43
|
-
duration: event.duration_ms,
|
|
44
|
-
inputTokens: usage.input_tokens || 0,
|
|
45
|
-
outputTokens: usage.output_tokens || 0,
|
|
46
|
-
cacheReadInputTokens: usage.cache_read_input_tokens || 0,
|
|
47
|
-
cacheCreationInputTokens: usage.cache_creation_input_tokens || 0,
|
|
48
|
-
modelUsage: event.modelUsage || null,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (event.type === 'system') {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function parseStreamEvent(inner) {
|
|
60
|
-
if (inner.type === 'content_block_delta' && inner.delta) {
|
|
61
|
-
const delta = inner.delta;
|
|
62
|
-
|
|
63
|
-
if (delta.type === 'text_delta' && delta.text) {
|
|
64
|
-
return {
|
|
65
|
-
type: 'text',
|
|
66
|
-
text: delta.text,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (delta.type === 'thinking_delta' && delta.thinking) {
|
|
71
|
-
return {
|
|
72
|
-
type: 'thinking',
|
|
73
|
-
text: delta.thinking,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function parseAssistantMessage(message) {
|
|
82
|
-
const results = [];
|
|
83
|
-
|
|
84
|
-
for (const block of message.content) {
|
|
85
|
-
if (block.type === 'tool_use') {
|
|
86
|
-
results.push({
|
|
87
|
-
type: 'tool_call',
|
|
88
|
-
toolName: block.name,
|
|
89
|
-
toolId: block.id,
|
|
90
|
-
input: block.input,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (block.type === 'thinking' && block.thinking) {
|
|
95
|
-
results.push({
|
|
96
|
-
type: 'thinking',
|
|
97
|
-
text: block.thinking,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (results.length === 1) {
|
|
103
|
-
return results[0];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (results.length > 1) {
|
|
107
|
-
return results;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function parseUserMessage(message) {
|
|
114
|
-
const results = [];
|
|
115
|
-
|
|
116
|
-
for (const block of message.content) {
|
|
117
|
-
if (block.type === 'tool_result') {
|
|
118
|
-
results.push({
|
|
119
|
-
type: 'tool_result',
|
|
120
|
-
toolId: block.tool_use_id,
|
|
121
|
-
content: typeof block.content === 'string' ? block.content : JSON.stringify(block.content),
|
|
122
|
-
isError: block.is_error || false,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (results.length === 1) {
|
|
128
|
-
return results[0];
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (results.length > 1) {
|
|
132
|
-
return results;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function parseChunk(chunk) {
|
|
139
|
-
const events = [];
|
|
140
|
-
const lines = chunk.split('\n');
|
|
141
|
-
|
|
142
|
-
for (const line of lines) {
|
|
143
|
-
const event = parseEvent(line);
|
|
144
|
-
if (event) {
|
|
145
|
-
if (Array.isArray(event)) {
|
|
146
|
-
events.push(...event);
|
|
147
|
-
} else {
|
|
148
|
-
events.push(event);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return events;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
module.exports = {
|
|
157
|
-
parseEvent,
|
|
158
|
-
parseChunk,
|
|
159
|
-
};
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BaseProvider - Abstract provider interface
|
|
3
|
-
*
|
|
4
|
-
* All providers support two execution paths:
|
|
5
|
-
* 1. SDK (fast) - Direct API calls using provider's SDK (requires API key)
|
|
6
|
-
* 2. CLI (slower) - Spawns provider's CLI tool (uses OAuth/login auth)
|
|
7
|
-
*
|
|
8
|
-
* Use callSimple() for simple prompts - it tries SDK first, falls back to CLI.
|
|
9
|
-
*/
|
|
10
|
-
class BaseProvider {
|
|
11
|
-
constructor(options = {}) {
|
|
12
|
-
this.name = options.name || 'base';
|
|
13
|
-
this.displayName = options.displayName || 'Base';
|
|
14
|
-
this.cliCommand = options.cliCommand || null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// ============================================================================
|
|
18
|
-
// SDK SUPPORT (Future Extension Point)
|
|
19
|
-
// ============================================================================
|
|
20
|
-
//
|
|
21
|
-
// SDK support is NOT IMPLEMENTED. These methods exist for future extension.
|
|
22
|
-
// Currently, all providers use CLI (claude, codex, gemini) for execution.
|
|
23
|
-
//
|
|
24
|
-
// To add SDK support for a provider:
|
|
25
|
-
// 1. Override getSDKEnvVar() to return the API key env var
|
|
26
|
-
// 2. Override callSDK() to implement the actual API call
|
|
27
|
-
// 3. The callSimple() method will then work automatically
|
|
28
|
-
//
|
|
29
|
-
// ============================================================================
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Get the environment variable name for the API key
|
|
33
|
-
* @returns {string} Environment variable name (e.g., 'ANTHROPIC_API_KEY')
|
|
34
|
-
*/
|
|
35
|
-
getSDKEnvVar() {
|
|
36
|
-
throw new Error(`${this.name}: SDK not implemented. Use CLI instead.`);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Check if SDK is configured (API key is set)
|
|
41
|
-
* @returns {boolean} True if API key is available
|
|
42
|
-
*/
|
|
43
|
-
isSDKConfigured() {
|
|
44
|
-
try {
|
|
45
|
-
const envVar = this.getSDKEnvVar();
|
|
46
|
-
return !!process.env[envVar];
|
|
47
|
-
} catch {
|
|
48
|
-
// getSDKEnvVar() throws if not implemented
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Make a simple API call via SDK (fast path)
|
|
55
|
-
* NOT IMPLEMENTED - exists for future extension.
|
|
56
|
-
*
|
|
57
|
-
* @param {string} _prompt - The prompt to send
|
|
58
|
-
* @param {Object} _options - Call options
|
|
59
|
-
* @returns {Promise<{success: boolean, text: string, usage?: Object, error?: string}>}
|
|
60
|
-
*/
|
|
61
|
-
callSDK(_prompt, _options) {
|
|
62
|
-
return Promise.reject(new Error(`${this.name}: SDK not implemented. Use CLI instead.`));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Make a simple API call via SDK
|
|
67
|
-
* NOT IMPLEMENTED - exists for future extension.
|
|
68
|
-
*
|
|
69
|
-
* @param {string} _prompt - The prompt to send
|
|
70
|
-
* @param {Object} _options - Call options
|
|
71
|
-
* @returns {Promise<{success: boolean, text: string, usage?: Object, error?: string}>}
|
|
72
|
-
*/
|
|
73
|
-
callSimple(_prompt, _options = {}) {
|
|
74
|
-
return Promise.reject(new Error(`${this.name}: SDK not implemented. Use CLI instead.`));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
isAvailable() {
|
|
78
|
-
throw new Error('Not implemented');
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
getCliPath() {
|
|
82
|
-
throw new Error('Not implemented');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
getInstallInstructions() {
|
|
86
|
-
throw new Error('Not implemented');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
getAuthInstructions() {
|
|
90
|
-
throw new Error('Not implemented');
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
getCliFeatures() {
|
|
94
|
-
throw new Error('Not implemented');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
getCredentialPaths() {
|
|
98
|
-
return [];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
buildCommand(_context, _options) {
|
|
102
|
-
throw new Error('Not implemented');
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
parseEvent(_line) {
|
|
106
|
-
throw new Error('Not implemented');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
getModelCatalog() {
|
|
110
|
-
throw new Error('Not implemented');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
getLevelMapping() {
|
|
114
|
-
throw new Error('Not implemented');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
resolveModelSpec(level, overrides = {}) {
|
|
118
|
-
const mapping = this.getLevelMapping();
|
|
119
|
-
const base = mapping[level] || mapping[this.getDefaultLevel()];
|
|
120
|
-
if (!base) {
|
|
121
|
-
throw new Error(`Unknown level "${level}" for provider "${this.name}"`);
|
|
122
|
-
}
|
|
123
|
-
const override = overrides[level] || {};
|
|
124
|
-
return {
|
|
125
|
-
level,
|
|
126
|
-
model: override.model || base.model,
|
|
127
|
-
reasoningEffort: override.reasoningEffort || base.reasoningEffort,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
validateLevel(level, minLevel, maxLevel) {
|
|
132
|
-
const mapping = this.getLevelMapping();
|
|
133
|
-
const rank = (key) => mapping[key]?.rank;
|
|
134
|
-
|
|
135
|
-
if (!mapping[level]) {
|
|
136
|
-
throw new Error(`Invalid level "${level}" for provider "${this.name}"`);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (minLevel && !mapping[minLevel]) {
|
|
140
|
-
throw new Error(`Invalid minLevel "${minLevel}" for provider "${this.name}"`);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (maxLevel && !mapping[maxLevel]) {
|
|
144
|
-
throw new Error(`Invalid maxLevel "${maxLevel}" for provider "${this.name}"`);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (minLevel && maxLevel && rank(minLevel) > rank(maxLevel)) {
|
|
148
|
-
throw new Error(
|
|
149
|
-
`minLevel "${minLevel}" exceeds maxLevel "${maxLevel}" for provider "${this.name}"`
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (maxLevel && rank(level) > rank(maxLevel)) {
|
|
154
|
-
throw new Error(
|
|
155
|
-
`Level "${level}" exceeds maxLevel "${maxLevel}" for provider "${this.name}"`
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (minLevel && rank(level) < rank(minLevel)) {
|
|
160
|
-
throw new Error(
|
|
161
|
-
`Level "${level}" is below minLevel "${minLevel}" for provider "${this.name}"`
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return level;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
validateModelId(modelId) {
|
|
169
|
-
const catalog = this.getModelCatalog();
|
|
170
|
-
if (modelId && !catalog[modelId]) {
|
|
171
|
-
throw new Error(`Invalid model "${modelId}" for provider "${this.name}"`);
|
|
172
|
-
}
|
|
173
|
-
return modelId;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
getDefaultLevel() {
|
|
177
|
-
throw new Error('Not implemented');
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
module.exports = BaseProvider;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
const { normalizeProviderName } = require('../../lib/provider-names');
|
|
2
|
-
|
|
3
|
-
const CAPABILITIES = {
|
|
4
|
-
claude: {
|
|
5
|
-
dockerIsolation: true,
|
|
6
|
-
worktreeIsolation: true,
|
|
7
|
-
mcpServers: true,
|
|
8
|
-
jsonSchema: true,
|
|
9
|
-
streamJson: true,
|
|
10
|
-
thinkingMode: true,
|
|
11
|
-
reasoningEffort: false,
|
|
12
|
-
},
|
|
13
|
-
codex: {
|
|
14
|
-
dockerIsolation: true,
|
|
15
|
-
worktreeIsolation: true,
|
|
16
|
-
mcpServers: true,
|
|
17
|
-
jsonSchema: true,
|
|
18
|
-
streamJson: true,
|
|
19
|
-
thinkingMode: true,
|
|
20
|
-
reasoningEffort: true,
|
|
21
|
-
},
|
|
22
|
-
gemini: {
|
|
23
|
-
dockerIsolation: true,
|
|
24
|
-
worktreeIsolation: true,
|
|
25
|
-
mcpServers: true,
|
|
26
|
-
jsonSchema: 'experimental',
|
|
27
|
-
streamJson: true,
|
|
28
|
-
thinkingMode: true,
|
|
29
|
-
reasoningEffort: false,
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
function checkCapability(provider, capability) {
|
|
34
|
-
const caps = CAPABILITIES[normalizeProviderName(provider)];
|
|
35
|
-
if (!caps) return false;
|
|
36
|
-
return caps[capability] === true;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function warnIfExperimental(provider, capability) {
|
|
40
|
-
const normalized = normalizeProviderName(provider);
|
|
41
|
-
const caps = CAPABILITIES[normalized];
|
|
42
|
-
if (caps?.[capability] === 'experimental') {
|
|
43
|
-
console.warn(`⚠️ ${capability} is experimental for ${normalized} and may not work reliably`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
module.exports = {
|
|
48
|
-
CAPABILITIES,
|
|
49
|
-
checkCapability,
|
|
50
|
-
warnIfExperimental,
|
|
51
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
function buildCommand(context, options = {}) {
|
|
2
|
-
const { modelSpec, outputFormat, jsonSchema, cwd, autoApprove, cliFeatures = {} } = options;
|
|
3
|
-
|
|
4
|
-
// Augment context with schema if provided (Gemini CLI doesn't support native schema enforcement)
|
|
5
|
-
let finalContext = context;
|
|
6
|
-
if (jsonSchema) {
|
|
7
|
-
// CRITICAL: Inject schema into prompt since Gemini CLI has no --output-schema flag
|
|
8
|
-
// Without this, model outputs free-form text instead of JSON
|
|
9
|
-
const schemaStr =
|
|
10
|
-
typeof jsonSchema === 'string' ? jsonSchema : JSON.stringify(jsonSchema, null, 2);
|
|
11
|
-
finalContext =
|
|
12
|
-
context +
|
|
13
|
-
`\n\n## OUTPUT FORMAT (CRITICAL - REQUIRED)
|
|
14
|
-
|
|
15
|
-
You MUST respond with a JSON object that exactly matches this schema. NO markdown, NO explanation, NO code blocks. ONLY the raw JSON object.
|
|
16
|
-
|
|
17
|
-
Schema:
|
|
18
|
-
\`\`\`json
|
|
19
|
-
${schemaStr}
|
|
20
|
-
\`\`\`
|
|
21
|
-
|
|
22
|
-
Your response must be ONLY valid JSON. Start with { and end with }. Nothing else.`;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const args = ['-p', finalContext];
|
|
26
|
-
|
|
27
|
-
if (
|
|
28
|
-
(outputFormat === 'stream-json' || outputFormat === 'json') &&
|
|
29
|
-
cliFeatures.supportsStreamJson
|
|
30
|
-
) {
|
|
31
|
-
args.push('--output-format', 'stream-json');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (modelSpec?.model) {
|
|
35
|
-
args.push('-m', modelSpec.model);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (cwd && cliFeatures.supportsCwd) {
|
|
39
|
-
args.push('--cwd', cwd);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (autoApprove && cliFeatures.supportsAutoApprove) {
|
|
43
|
-
args.push('--yolo');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
binary: 'gemini',
|
|
48
|
-
args,
|
|
49
|
-
env: {},
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
module.exports = {
|
|
54
|
-
buildCommand,
|
|
55
|
-
};
|