@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.
- package/README.md +94 -14
- package/cli/commands/providers.js +8 -9
- package/cli/index.js +3032 -2409
- package/cli/message-formatters-normal.js +28 -6
- package/cluster-templates/base-templates/debug-workflow.json +1 -1
- package/cluster-templates/base-templates/full-workflow.json +72 -188
- package/cluster-templates/base-templates/worker-validator.json +59 -3
- package/cluster-templates/conductor-bootstrap.json +4 -4
- package/lib/docker-config.js +8 -0
- package/lib/git-remote-utils.js +165 -0
- package/lib/id-detector.js +10 -7
- package/lib/provider-defaults.js +62 -0
- package/lib/provider-names.js +2 -1
- package/lib/settings/claude-auth.js +78 -0
- package/lib/settings.js +161 -63
- package/package.json +7 -2
- package/scripts/setup-merge-queue.sh +170 -0
- package/src/agent/agent-config.js +135 -82
- package/src/agent/agent-context-builder.js +297 -188
- package/src/agent/agent-hook-executor.js +310 -113
- package/src/agent/agent-lifecycle.js +385 -325
- package/src/agent/agent-stuck-detector.js +7 -7
- package/src/agent/agent-task-executor.js +824 -565
- package/src/agent/output-extraction.js +41 -24
- package/src/agent/output-reformatter.js +1 -1
- package/src/agent/schema-utils.js +108 -73
- package/src/agent-wrapper.js +10 -1
- package/src/agents/git-pusher-template.js +285 -0
- package/src/claude-task-runner.js +85 -34
- package/src/config-validator.js +922 -657
- package/src/input-helpers.js +65 -0
- package/src/isolation-manager.js +289 -199
- package/src/issue-providers/README.md +305 -0
- package/src/issue-providers/azure-devops-provider.js +273 -0
- package/src/issue-providers/base-provider.js +232 -0
- package/src/issue-providers/github-provider.js +179 -0
- package/src/issue-providers/gitlab-provider.js +241 -0
- package/src/issue-providers/index.js +196 -0
- package/src/issue-providers/jira-provider.js +239 -0
- package/src/ledger.js +22 -5
- package/src/lib/safe-exec.js +88 -0
- package/src/orchestrator.js +1107 -811
- package/src/preflight.js +313 -159
- package/src/process-metrics.js +98 -56
- package/src/providers/anthropic/cli-builder.js +53 -25
- package/src/providers/anthropic/index.js +72 -2
- package/src/providers/anthropic/output-parser.js +32 -14
- package/src/providers/base-provider.js +70 -0
- package/src/providers/capabilities.js +9 -0
- package/src/providers/google/output-parser.js +47 -38
- package/src/providers/index.js +19 -3
- package/src/providers/openai/cli-builder.js +14 -3
- package/src/providers/openai/index.js +1 -0
- package/src/providers/openai/output-parser.js +44 -30
- package/src/providers/opencode/cli-builder.js +42 -0
- package/src/providers/opencode/index.js +103 -0
- package/src/providers/opencode/models.js +55 -0
- package/src/providers/opencode/output-parser.js +122 -0
- package/src/schemas/sub-cluster.js +68 -39
- package/src/status-footer.js +94 -48
- package/src/sub-cluster-wrapper.js +76 -35
- package/src/template-resolver.js +12 -9
- package/src/tui/data-poller.js +123 -99
- package/src/tui/formatters.js +4 -3
- package/src/tui/keybindings.js +259 -318
- package/src/tui/renderer.js +11 -21
- package/task-lib/attachable-watcher.js +118 -81
- package/task-lib/claude-recovery.js +61 -24
- package/task-lib/commands/episodes.js +105 -0
- package/task-lib/commands/list.js +2 -2
- package/task-lib/commands/logs.js +231 -189
- package/task-lib/commands/schedules.js +111 -61
- package/task-lib/config.js +0 -2
- package/task-lib/runner.js +84 -27
- package/task-lib/scheduler.js +1 -1
- package/task-lib/store.js +467 -168
- package/task-lib/tui/formatters.js +94 -45
- package/task-lib/tui/renderer.js +13 -3
- package/task-lib/tui.js +73 -32
- package/task-lib/watcher.js +128 -90
- package/src/agents/git-pusher-agent.json +0 -20
- package/src/github.js +0 -139
|
@@ -37,8 +37,44 @@
|
|
|
37
37
|
"role": "implementation",
|
|
38
38
|
"modelLevel": "{{worker_level}}",
|
|
39
39
|
"timeout": "{{timeout}}",
|
|
40
|
+
"outputFormat": "json",
|
|
41
|
+
"jsonSchema": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"properties": {
|
|
44
|
+
"summary": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Brief description of work done this iteration"
|
|
47
|
+
},
|
|
48
|
+
"completionStatus": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"description": "Self-assessment of completion state",
|
|
51
|
+
"properties": {
|
|
52
|
+
"canValidate": {
|
|
53
|
+
"type": "boolean",
|
|
54
|
+
"description": "true if work is ready for validator review, false if more work needed"
|
|
55
|
+
},
|
|
56
|
+
"percentComplete": {
|
|
57
|
+
"type": "number",
|
|
58
|
+
"description": "Estimated completion percentage (0-100)"
|
|
59
|
+
},
|
|
60
|
+
"blockers": {
|
|
61
|
+
"type": "array",
|
|
62
|
+
"items": { "type": "string" },
|
|
63
|
+
"description": "Issues preventing completion (empty if canValidate=true)"
|
|
64
|
+
},
|
|
65
|
+
"nextSteps": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"items": { "type": "string" },
|
|
68
|
+
"description": "Remaining work items (empty if canValidate=true)"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"required": ["canValidate", "percentComplete"]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"required": ["summary", "completionStatus"]
|
|
75
|
+
},
|
|
40
76
|
"prompt": {
|
|
41
|
-
"system": "## 🚫 YOU CANNOT ASK QUESTIONS\n\nYou are running non-interactively. There is NO USER to answer.\n- NEVER use AskUserQuestion tool\n- NEVER say \"Should I...\" or \"Would you like...\"\n- When unsure: Make the SAFER choice and proceed.\n\nYou are an implementation agent for a SIMPLE {{task_type}} task.\n\n## FIRST ITERATION\n\n{{#if task_type == 'TASK'}}\nImplement the requested feature/change:\n- Well-defined scope (one feature, one fix)\n- Standard patterns apply\n- Complete the implementation fully\n{{/if}}\n\n{{#if task_type == 'DEBUG'}}\nInvestigate and fix the issue:\n- Reproduce the problem\n- Find the root cause (not just symptoms)\n- Apply the fix\n- Verify it works\n{{/if}}\n\n{{#if task_type == 'INQUIRY'}}\nResearch and provide detailed answers:\n- Explore relevant code and documentation\n- Explain how things work\n- Provide accurate, complete information\n{{/if}}\n\n## SUBSEQUENT ITERATIONS (after rejection)\n\nYou are being called back because validators REJECTED your implementation. This is NOT a minor issue.\n\n### FIX LIKE A SENIOR ENGINEER\n\n1. **STOP AND UNDERSTAND FIRST**\n - Read ALL VALIDATION_RESULT messages completely\n - Understand WHY each issue exists, not just WHAT it is\n - Trace the root cause - don't patch symptoms\n\n2. **FIX PROPERLY - NO SHORTCUTS**\n - Fix the ACTUAL problem, not the error message\n - If your approach was wrong, redesign it - don't add band-aids\n - Consider architectural implications of your fix\n - A senior dev would be embarrassed to submit a half-fix\n\n3. **VERIFY YOUR FIX**\n - Test your changes actually work\n - Check you didn't break anything else\n - If unsure, investigate before committing\n\n### MINDSET\n- Validators are senior engineers reviewing your code\n- They found REAL problems - take them seriously\n- Shortcuts will be caught and rejected again"
|
|
77
|
+
"system": "## 🚫 YOU CANNOT ASK QUESTIONS\n\nYou are running non-interactively. There is NO USER to answer.\n- NEVER use AskUserQuestion tool\n- NEVER say \"Should I...\" or \"Would you like...\"\n- When unsure: Make the SAFER choice and proceed.\n\nYou are an implementation agent for a SIMPLE {{task_type}} task.\n\n## FIRST ITERATION\n\n{{#if task_type == 'TASK'}}\nImplement the requested feature/change:\n- Well-defined scope (one feature, one fix)\n- Standard patterns apply\n- Complete the implementation fully\n{{/if}}\n\n{{#if task_type == 'DEBUG'}}\nInvestigate and fix the issue:\n- Reproduce the problem\n- Find the root cause (not just symptoms)\n- Apply the fix\n- Verify it works\n{{/if}}\n\n{{#if task_type == 'INQUIRY'}}\nResearch and provide detailed answers:\n- Explore relevant code and documentation\n- Explain how things work\n- Provide accurate, complete information\n{{/if}}\n\n## SUBSEQUENT ITERATIONS (after rejection)\n\nYou are being called back because validators REJECTED your implementation. This is NOT a minor issue.\n\n### FIX LIKE A SENIOR ENGINEER\n\n1. **STOP AND UNDERSTAND FIRST**\n - Read ALL VALIDATION_RESULT messages completely\n - Understand WHY each issue exists, not just WHAT it is\n - Trace the root cause - don't patch symptoms\n\n2. **FIX PROPERLY - NO SHORTCUTS**\n - Fix the ACTUAL problem, not the error message\n - If your approach was wrong, redesign it - don't add band-aids\n - Consider architectural implications of your fix\n - A senior dev would be embarrassed to submit a half-fix\n\n3. **VERIFY YOUR FIX**\n - Test your changes actually work\n - Check you didn't break anything else\n - If unsure, investigate before committing\n\n### MINDSET\n- Validators are senior engineers reviewing your code\n- They found REAL problems - take them seriously\n- Shortcuts will be caught and rejected again\n\n## 🔴 COMPLETION SELF-ASSESSMENT (REQUIRED)\n\nYour output MUST include a `completionStatus` object with honest self-assessment:\n\n**Set canValidate: true** when:\n- All work for this iteration is complete\n- Code compiles/runs without errors\n- You would be confident submitting for review\n\n**Set canValidate: false** when:\n- Work is partially complete\n- Blocked by an issue you're working around\n- Code doesn't compile or has obvious bugs\n\nValidators cost money. If you're not done, say so - your WORKER_PROGRESS message will let you continue."
|
|
42
78
|
},
|
|
43
79
|
"contextStrategy": {
|
|
44
80
|
"sources": [
|
|
@@ -46,6 +82,11 @@
|
|
|
46
82
|
"topic": "ISSUE_OPENED",
|
|
47
83
|
"limit": 1
|
|
48
84
|
},
|
|
85
|
+
{
|
|
86
|
+
"topic": "WORKER_PROGRESS",
|
|
87
|
+
"since": "last_task_end",
|
|
88
|
+
"limit": 3
|
|
89
|
+
},
|
|
49
90
|
{
|
|
50
91
|
"topic": "VALIDATION_RESULT",
|
|
51
92
|
"since": "last_task_end",
|
|
@@ -60,6 +101,14 @@
|
|
|
60
101
|
"topic": "ISSUE_OPENED",
|
|
61
102
|
"action": "execute_task"
|
|
62
103
|
},
|
|
104
|
+
{
|
|
105
|
+
"topic": "WORKER_PROGRESS",
|
|
106
|
+
"logic": {
|
|
107
|
+
"engine": "javascript",
|
|
108
|
+
"script": "return message.sender === 'worker';"
|
|
109
|
+
},
|
|
110
|
+
"action": "execute_task"
|
|
111
|
+
},
|
|
63
112
|
{
|
|
64
113
|
"topic": "VALIDATION_RESULT",
|
|
65
114
|
"logic": {
|
|
@@ -75,8 +124,15 @@
|
|
|
75
124
|
"config": {
|
|
76
125
|
"topic": "IMPLEMENTATION_READY",
|
|
77
126
|
"content": {
|
|
78
|
-
"text": "
|
|
127
|
+
"text": "{{result.summary}}",
|
|
128
|
+
"data": {
|
|
129
|
+
"completionStatus": "{{result.completionStatus}}"
|
|
130
|
+
}
|
|
79
131
|
}
|
|
132
|
+
},
|
|
133
|
+
"logic": {
|
|
134
|
+
"engine": "javascript",
|
|
135
|
+
"script": "if (!result.completionStatus?.canValidate) return { topic: 'WORKER_PROGRESS' };"
|
|
80
136
|
}
|
|
81
137
|
}
|
|
82
138
|
},
|
|
@@ -110,7 +166,7 @@
|
|
|
110
166
|
"required": ["approved", "summary", "errors"]
|
|
111
167
|
},
|
|
112
168
|
"prompt": {
|
|
113
|
-
"system": "## 🚫 YOU CANNOT ASK QUESTIONS\n\nYou are running non-interactively. There is NO USER to answer.\n- NEVER use AskUserQuestion tool\n- NEVER say \"Should I...\" or \"Would you like...\"\n- When unsure: Make the SAFER choice and proceed.\n\nYou are a validator for a SIMPLE {{task_type}} task.\n\n## 🔴 VERIFICATION PROTOCOL (REQUIRED - PREVENTS FALSE CLAIMS)\n\nBefore making ANY claim about missing functionality or code issues:\n\n1. **SEARCH FIRST** - Use Glob to find ALL relevant files\n2. **READ THE CODE** - Use Read to inspect actual implementation\n3. **GREP FOR PATTERNS** - Use Grep to search for specific code (function names, endpoints, etc.)\n\n**NEVER claim something doesn't exist without FIRST searching for it.**\n\nThe worker may have implemented features in different files than originally planned. If you claim '/api/metrics endpoint is missing' without searching, you may miss that it exists in 'server/routes/health.ts' instead of 'server/routes/api.ts'.\n\n### Example Verification Flow:\n```\n1. Claim: 'Missing error handling for network failures'\n2. BEFORE claiming → Grep for 'catch', 'error', 'try' in relevant files\n3. BEFORE claiming → Read the actual implementation\n4. ONLY IF NOT FOUND → Add to errors array\n```\n\n## VALIDATION CRITERIA\n\n**APPROVE** if:\n- Core functionality works as requested\n- Implementation is correct and complete\n- No obvious bugs or critical issues\n\n**REJECT** if:\n- Major functionality is missing or broken (VERIFIED by searching)\n- Implementation doesn't match requirements (VERIFIED by reading code)\n- Critical bugs present (VERIFIED by inspection)\n\n## TASK TYPE: {{task_type}}\n\n{{#if task_type == 'TASK'}}\nVerify the feature/change works correctly.\n{{/if}}\n\n{{#if task_type == 'DEBUG'}}\nVerify the bug is actually fixed at root cause.\n{{/if}}\n\n{{#if task_type == 'INQUIRY'}}\nVerify the information is accurate and complete.\n{{/if}}\n\nFor SIMPLE tasks, don't nitpick. Focus on: Does it work and meet requirements?\n\n## 🔴 DEBUGGING METHODOLOGY CHECK\n\nBefore approving, verify the worker didn't take shortcuts:\n\n### Ad Hoc Fix Detection\n- Did worker fix ONE instance? → Grep for similar patterns. If N > 1 exists, REJECT.\n- Example: Fixed null check in `auth.ts:42`? → `grep -r \"similar pattern\" .` - are there others?\n\n### Root Cause vs Symptom\n- Did worker add a workaround? → Find the ACTUAL bug. If workaround hides real issue, REJECT.\n- Example: Added `|| []` fallback? → WHY is it undefined? Fix THAT.\n\n### Lazy Debugging Red Flags (INSTANT REJECT)\n- Worker suggests \"restart the service\" → REJECT (hides the bug)\n- Worker suggests \"clear the cache\" → REJECT (hides the bug)\n- Worker says \"works on my machine\" → REJECT (not a fix)\n- Worker blames the test → REJECT unless they PROVE test is wrong with evidence"
|
|
169
|
+
"system": "## 🔴 OUTPUT FORMAT (CRITICAL - READ FIRST)\n\nYour output MUST be MINIMAL and STRUCTURED:\n- Output ONLY the required JSON schema fields\n- NO preambles (\"Here is my analysis...\", \"Let me explain...\")\n- NO verbose summaries - be CONCISE (max 100 chars per string field)\n- NO redundant information\n- NO explanations before or after the JSON\n\n## 🚫 YOU CANNOT ASK QUESTIONS\n\nYou are running non-interactively. There is NO USER to answer.\n- NEVER use AskUserQuestion tool\n- NEVER say \"Should I...\" or \"Would you like...\"\n- When unsure: Make the SAFER choice and proceed.\n\nYou are a validator for a SIMPLE {{task_type}} task.\n\n## 🔴 VERIFICATION PROTOCOL (REQUIRED - PREVENTS FALSE CLAIMS)\n\nBefore making ANY claim about missing functionality or code issues:\n\n1. **SEARCH FIRST** - Use Glob to find ALL relevant files\n2. **READ THE CODE** - Use Read to inspect actual implementation\n3. **GREP FOR PATTERNS** - Use Grep to search for specific code (function names, endpoints, etc.)\n\n**NEVER claim something doesn't exist without FIRST searching for it.**\n\nThe worker may have implemented features in different files than originally planned. If you claim '/api/metrics endpoint is missing' without searching, you may miss that it exists in 'server/routes/health.ts' instead of 'server/routes/api.ts'.\n\n### Example Verification Flow:\n```\n1. Claim: 'Missing error handling for network failures'\n2. BEFORE claiming → Grep for 'catch', 'error', 'try' in relevant files\n3. BEFORE claiming → Read the actual implementation\n4. ONLY IF NOT FOUND → Add to errors array\n```\n\n## VALIDATION CRITERIA\n\n**APPROVE** if:\n- Core functionality works as requested\n- Implementation is correct and complete\n- No obvious bugs or critical issues\n\n**REJECT** if:\n- Major functionality is missing or broken (VERIFIED by searching)\n- Implementation doesn't match requirements (VERIFIED by reading code)\n- Critical bugs present (VERIFIED by inspection)\n\n## TASK TYPE: {{task_type}}\n\n{{#if task_type == 'TASK'}}\nVerify the feature/change works correctly.\n{{/if}}\n\n{{#if task_type == 'DEBUG'}}\nVerify the bug is actually fixed at root cause.\n{{/if}}\n\n{{#if task_type == 'INQUIRY'}}\nVerify the information is accurate and complete.\n{{/if}}\n\nFor SIMPLE tasks, don't nitpick. Focus on: Does it work and meet requirements?\n\n## 🔴 DEBUGGING METHODOLOGY CHECK\n\nBefore approving, verify the worker didn't take shortcuts:\n\n### Ad Hoc Fix Detection\n- Did worker fix ONE instance? → Grep for similar patterns. If N > 1 exists, REJECT.\n- Example: Fixed null check in `auth.ts:42`? → `grep -r \"similar pattern\" .` - are there others?\n\n### Root Cause vs Symptom\n- Did worker add a workaround? → Find the ACTUAL bug. If workaround hides real issue, REJECT.\n- Example: Added `|| []` fallback? → WHY is it undefined? Fix THAT.\n\n### Lazy Debugging Red Flags (INSTANT REJECT)\n- Worker suggests \"restart the service\" → REJECT (hides the bug)\n- Worker suggests \"clear the cache\" → REJECT (hides the bug)\n- Worker says \"works on my machine\" → REJECT (not a fix)\n- Worker blames the test → REJECT unless they PROVE test is wrong with evidence"
|
|
114
170
|
},
|
|
115
171
|
"contextStrategy": {
|
|
116
172
|
"sources": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"taskType": {
|
|
20
20
|
"type": "string",
|
|
21
21
|
"enum": ["INQUIRY", "TASK", "DEBUG"],
|
|
22
|
-
"description": "Type of work: INQUIRY (
|
|
22
|
+
"description": "Type of work: INQUIRY (read-only), TASK (implement / known fix), DEBUG (investigate unknown root cause)"
|
|
23
23
|
},
|
|
24
24
|
"reasoning": {
|
|
25
25
|
"type": "string",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"required": ["complexity", "taskType", "reasoning"]
|
|
30
30
|
},
|
|
31
31
|
"prompt": {
|
|
32
|
-
"system": "You are the JUNIOR CONDUCTOR - fast task classification.\n\n## Your Job\nClassify the task on TWO dimensions.\n\n## COMPLEXITY (pick ONE)\n- TRIVIAL - One
|
|
32
|
+
"system": "You are the JUNIOR CONDUCTOR - fast task classification.\n\n## Your Job\nClassify the task on TWO dimensions.\n\n## 🔴 COST REMINDER\n- CRITICAL uses Opus ($15/M tokens) + 4 validators = EXPENSIVE\n- STANDARD uses Sonnet ($3/M tokens) + 2 validators = NORMAL\n- Don't waste money on false positives. CRITICAL is rare.\n\n## COMPLEXITY (pick ONE)\n- TRIVIAL - One file, mechanical change; no behavior change.\n- SIMPLE - Small change, 1-2 files, low risk.\n- STANDARD - Multi-file work or user-visible behavior. **DEFAULT CHOICE.**\n- CRITICAL - ONLY when code DIRECTLY modifies: (1) authentication/authorization LOGIC, (2) payment processing/billing calculations, (3) secrets/credentials handling, (4) destructive database operations (DROP, DELETE), (5) production deployment or live infrastructure, (6) PII processing (not just displaying it).\n- UNCERTAIN - Escalate to senior conductor.\n\n**🔴 BIAS: If unsure between STANDARD and CRITICAL, choose STANDARD.** CRITICAL is expensive. Reserve it for actual risk.\n\n## NOT CRITICAL (Common False Positives)\n\nThese are STANDARD, not CRITICAL:\n- Refactoring code that MENTIONS auth/billing/security (not MODIFYING the logic)\n- Adding TypeScript types for existing structures\n- Code cleanup in infra-related files\n- Read-only queries to production data\n- Tests for auth/billing code (tests don't touch prod)\n- Extracting modules or services (code organization)\n- Factory patterns, dependency injection (architecture)\n- Config file reorganization (not production config values)\n\n## TASK TYPE (pick ONE)\n- INQUIRY - Questions, exploration, read-only\n- TASK - Implement something new\n- DEBUG - Fix something broken\n\n## Examples\n\nTask: \"Explain current auth flow (read-only)\"\n```json\n{\"complexity\": \"SIMPLE\", \"taskType\": \"INQUIRY\", \"reasoning\": \"Read-only explanation\"}\n```\n\nTask: \"Refactor auth service into smaller modules\"\n```json\n{\"complexity\": \"STANDARD\", \"taskType\": \"TASK\", \"reasoning\": \"Refactoring code organization, not modifying auth logic\"}\n```\n\nTask: \"Add TypeScript types to payment types\"\n```json\n{\"complexity\": \"STANDARD\", \"taskType\": \"TASK\", \"reasoning\": \"Adding types, not modifying billing logic\"}\n```\n\nTask: \"Fix bug in password validation logic\"\n```json\n{\"complexity\": \"CRITICAL\", \"taskType\": \"DEBUG\", \"reasoning\": \"Directly modifying authentication logic\"}\n```\n\nTask: \"Add new payment method integration\"\n```json\n{\"complexity\": \"CRITICAL\", \"taskType\": \"TASK\", \"reasoning\": \"New billing/payment processing code\"}\n```\n\nTask: \"Rotate production API keys\"\n```json\n{\"complexity\": \"CRITICAL\", \"taskType\": \"TASK\", \"reasoning\": \"Modifying production secrets\"}\n```\n\nTask: \"DROP TABLE users migration\"\n```json\n{\"complexity\": \"CRITICAL\", \"taskType\": \"TASK\", \"reasoning\": \"Destructive database operation\"}\n```\n\n## Critical Rules\n1. Output ONLY valid JSON - no other text\n2. complexity must be EXACTLY one of: TRIVIAL, SIMPLE, STANDARD, CRITICAL, UNCERTAIN\n3. taskType must be EXACTLY one of: INQUIRY, TASK, DEBUG\n\nTask: {{ISSUE_OPENED.content.text}}"
|
|
33
33
|
},
|
|
34
34
|
"contextStrategy": {
|
|
35
35
|
"sources": [{ "topic": "ISSUE_OPENED", "limit": 1 }],
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"taskType": {
|
|
74
74
|
"type": "string",
|
|
75
75
|
"enum": ["INQUIRY", "TASK", "DEBUG"],
|
|
76
|
-
"description": "Type of work after analysis"
|
|
76
|
+
"description": "Type of work after analysis (INQUIRY/TASK/DEBUG)"
|
|
77
77
|
},
|
|
78
78
|
"reasoning": {
|
|
79
79
|
"type": "string",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"required": ["complexity", "taskType", "reasoning"]
|
|
84
84
|
},
|
|
85
85
|
"prompt": {
|
|
86
|
-
"system": "You are the SENIOR CONDUCTOR - expert task analyzer.\n\nThe junior conductor was uncertain. Make a definitive classification.\n\n## COMPLEXITY (pick ONE - no UNCERTAIN allowed)\n- TRIVIAL - One
|
|
86
|
+
"system": "You are the SENIOR CONDUCTOR - expert task analyzer.\n\nThe junior conductor was uncertain. Make a definitive classification.\n\n## 🔴 COST REMINDER\n- CRITICAL uses Opus ($15/M tokens) + 4 validators = EXPENSIVE\n- STANDARD uses Sonnet ($3/M tokens) + 2 validators = NORMAL\n- Don't waste money on false positives.\n\n## COMPLEXITY (pick ONE - no UNCERTAIN allowed)\n- TRIVIAL - One file, mechanical change; no behavior change.\n- SIMPLE - Small change, 1-2 files, low risk.\n- STANDARD - Multi-file work or user-visible behavior. **DEFAULT CHOICE.**\n- CRITICAL - ONLY when code DIRECTLY modifies: (1) authentication/authorization LOGIC, (2) payment processing/billing calculations, (3) secrets/credentials handling, (4) destructive database operations (DROP, DELETE), (5) production deployment or live infrastructure, (6) PII processing.\n\n**🔴 BIAS: If unsure between STANDARD and CRITICAL, choose STANDARD.** CRITICAL is expensive.\n\n## NOT CRITICAL (Common False Positives)\n- Refactoring code that MENTIONS auth/billing/security (not MODIFYING the logic)\n- Adding TypeScript types, tests, code organization\n- Read-only queries, config reorganization\n- Factory patterns, dependency injection\n\n## TASK TYPE (pick ONE)\n- INQUIRY - Questions, exploration (read-only)\n- TASK - Implement something new\n- DEBUG - Fix something broken\n\n## Examples\n\nTask: \"Refactor auth service into smaller modules\"\n```json\n{\"complexity\": \"STANDARD\", \"taskType\": \"TASK\", \"reasoning\": \"Code refactor, not modifying auth logic\"}\n```\n\nTask: \"Fix bug in password validation\"\n```json\n{\"complexity\": \"CRITICAL\", \"taskType\": \"DEBUG\", \"reasoning\": \"Directly modifying auth logic\"}\n```\n\nTask: \"Add payment method\"\n```json\n{\"complexity\": \"CRITICAL\", \"taskType\": \"TASK\", \"reasoning\": \"New billing code\"}\n```\n\n## Rules\n1. Output ONLY valid JSON - no other text\n2. YOU MUST DECIDE - pick exactly one value for each field\n3. When unsure between STANDARD and CRITICAL → STANDARD\n\nJunior was uncertain. Original task follows."
|
|
87
87
|
},
|
|
88
88
|
"contextStrategy": {
|
|
89
89
|
"sources": [
|
package/lib/docker-config.js
CHANGED
|
@@ -21,6 +21,11 @@ const MOUNT_PRESETS = {
|
|
|
21
21
|
claude: { host: '~/.claude', container: '$HOME/.claude', readonly: true },
|
|
22
22
|
codex: { host: '~/.config/codex', container: '$HOME/.config/codex', readonly: true },
|
|
23
23
|
gemini: { host: '~/.config/gemini', container: '$HOME/.config/gemini', readonly: true },
|
|
24
|
+
opencode: {
|
|
25
|
+
host: '~/.local/share/opencode',
|
|
26
|
+
container: '$HOME/.local/share/opencode',
|
|
27
|
+
readonly: true,
|
|
28
|
+
},
|
|
24
29
|
};
|
|
25
30
|
|
|
26
31
|
/**
|
|
@@ -31,12 +36,15 @@ const MOUNT_PRESETS = {
|
|
|
31
36
|
* - Forced: 'VAR=value' (always set to value)
|
|
32
37
|
* - Empty: 'VAR=' (always set to empty string)
|
|
33
38
|
*/
|
|
39
|
+
const { CLAUDE_AUTH_ENV_VARS } = require('./settings/claude-auth');
|
|
40
|
+
|
|
34
41
|
const ENV_PRESETS = {
|
|
35
42
|
aws: ['AWS_REGION', 'AWS_DEFAULT_REGION', 'AWS_PROFILE', 'AWS_PAGER='],
|
|
36
43
|
azure: ['AZURE_SUBSCRIPTION_ID', 'AZURE_TENANT_ID', 'AZURE_CLIENT_ID'],
|
|
37
44
|
gcloud: ['CLOUDSDK_CORE_PROJECT', 'GOOGLE_CLOUD_PROJECT'],
|
|
38
45
|
kube: ['KUBECONFIG'],
|
|
39
46
|
terraform: ['TF_VAR_*'],
|
|
47
|
+
claude: CLAUDE_AUTH_ENV_VARS,
|
|
40
48
|
};
|
|
41
49
|
|
|
42
50
|
/**
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git remote URL parsing and provider detection.
|
|
3
|
+
* Automatically detects issue provider from git remote URL.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const { execSync } = require('../src/lib/safe-exec');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Parse git remote URL into structured provider context.
|
|
10
|
+
* Supports GitHub, GitLab, and Azure DevOps (cloud + self-hosted).
|
|
11
|
+
* Handles both HTTPS and SSH URL formats.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} remoteUrl - Git remote URL
|
|
14
|
+
* @returns {Object|null} Provider context or null if unparseable
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* parseGitRemoteUrl('https://github.com/org/repo.git')
|
|
18
|
+
* // → { provider: 'github', host: 'github.com', org: 'org', repo: 'repo', fullRepo: 'org/repo' }
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* parseGitRemoteUrl('git@gitlab.com:org/repo.git')
|
|
22
|
+
* // → { provider: 'gitlab', host: 'gitlab.com', org: 'org', repo: 'repo', fullRepo: 'org/repo' }
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* parseGitRemoteUrl('https://dev.azure.com/myorg/myproject/_git/myrepo')
|
|
26
|
+
* // → { provider: 'azure-devops', host: 'dev.azure.com', azureOrg: 'https://dev.azure.com/myorg', azureProject: 'myproject', repo: 'myrepo' }
|
|
27
|
+
*/
|
|
28
|
+
function parseGitRemoteUrl(remoteUrl) {
|
|
29
|
+
if (!remoteUrl || typeof remoteUrl !== 'string') {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const url = remoteUrl.trim();
|
|
34
|
+
|
|
35
|
+
// Normalize SSH URLs to HTTPS format for easier parsing
|
|
36
|
+
// git@host:path → https://host/path
|
|
37
|
+
let normalizedUrl = url;
|
|
38
|
+
const sshMatch = url.match(/^git@([^:]+):(.+)$/);
|
|
39
|
+
if (sshMatch) {
|
|
40
|
+
const [, host, path] = sshMatch;
|
|
41
|
+
normalizedUrl = `https://${host}/${path}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Remove .git suffix if present
|
|
45
|
+
normalizedUrl = normalizedUrl.replace(/\.git$/, '');
|
|
46
|
+
|
|
47
|
+
// Azure DevOps: https://dev.azure.com/org/project/_git/repo
|
|
48
|
+
// Azure Legacy: https://org.visualstudio.com/project/_git/repo
|
|
49
|
+
// Azure SSH: git@ssh.dev.azure.com:v3/org/project/repo
|
|
50
|
+
const azureMatch =
|
|
51
|
+
normalizedUrl.match(/https:\/\/dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)/) ||
|
|
52
|
+
normalizedUrl.match(/https:\/\/([^.]+)\.visualstudio\.com\/([^/]+)\/_git\/([^/]+)/) ||
|
|
53
|
+
// After normalization, `git@ssh.dev.azure.com:v3/org/project/repo` becomes
|
|
54
|
+
// `https://ssh.dev.azure.com/v3/org/project/repo`
|
|
55
|
+
normalizedUrl.match(/https:\/\/ssh\.dev\.azure\.com\/v3\/([^/]+)\/([^/]+)\/([^/]+)/);
|
|
56
|
+
|
|
57
|
+
if (azureMatch) {
|
|
58
|
+
const [, orgPart, project, repo] = azureMatch;
|
|
59
|
+
// For dev.azure.com, org is the first path segment
|
|
60
|
+
// For visualstudio.com, org is the subdomain
|
|
61
|
+
const isLegacy = normalizedUrl.includes('visualstudio.com');
|
|
62
|
+
const azureOrg = isLegacy
|
|
63
|
+
? `https://${orgPart}.visualstudio.com`
|
|
64
|
+
: `https://dev.azure.com/${orgPart}`;
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
provider: 'azure-devops',
|
|
68
|
+
host: isLegacy ? `${orgPart}.visualstudio.com` : 'dev.azure.com',
|
|
69
|
+
azureOrg,
|
|
70
|
+
azureProject: project,
|
|
71
|
+
repo,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// GitHub: https://github.com/org/repo
|
|
76
|
+
// GitLab: https://gitlab.com/org/repo (or self-hosted)
|
|
77
|
+
// Generic: https://host/org/repo
|
|
78
|
+
const httpsMatch = normalizedUrl.match(/https?:\/\/([^/]+)\/([^/]+)\/([^/]+)/);
|
|
79
|
+
if (httpsMatch) {
|
|
80
|
+
const [, host, org, repo] = httpsMatch;
|
|
81
|
+
|
|
82
|
+
let provider = null;
|
|
83
|
+
if (host === 'github.com') {
|
|
84
|
+
provider = 'github';
|
|
85
|
+
} else if (host.includes('gitlab')) {
|
|
86
|
+
// Matches gitlab.com or any gitlab.* subdomain or *gitlab* in hostname
|
|
87
|
+
provider = 'gitlab';
|
|
88
|
+
} else {
|
|
89
|
+
// Unknown provider - could be self-hosted GitLab or other
|
|
90
|
+
// Return null to fall back to settings
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
provider,
|
|
96
|
+
host,
|
|
97
|
+
org,
|
|
98
|
+
repo,
|
|
99
|
+
fullRepo: `${org}/${repo}`,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Detect git repository context from current working directory.
|
|
108
|
+
* Returns provider context extracted from git remote URL.
|
|
109
|
+
*
|
|
110
|
+
* @param {string} [cwd=process.cwd()] - Directory to check
|
|
111
|
+
* @returns {Object|null} Git context or null
|
|
112
|
+
*
|
|
113
|
+
* Gracefully returns null for:
|
|
114
|
+
* - Not in git repository
|
|
115
|
+
* - No remote configured
|
|
116
|
+
* - Remote URL unparseable
|
|
117
|
+
* - Git command fails
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* // In a GitHub repo with remote
|
|
121
|
+
* detectGitContext()
|
|
122
|
+
* // → { provider: 'github', host: 'github.com', org: 'myorg', repo: 'myrepo', fullRepo: 'myorg/myrepo' }
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* // Not in git repo or no remote
|
|
126
|
+
* detectGitContext()
|
|
127
|
+
* // → null
|
|
128
|
+
*/
|
|
129
|
+
function detectGitContext(cwd = process.cwd()) {
|
|
130
|
+
try {
|
|
131
|
+
// Check if we're in a git repository
|
|
132
|
+
execSync('git rev-parse --git-dir', {
|
|
133
|
+
cwd,
|
|
134
|
+
stdio: 'pipe',
|
|
135
|
+
encoding: 'utf8',
|
|
136
|
+
});
|
|
137
|
+
} catch {
|
|
138
|
+
// Not a git repository
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
try {
|
|
143
|
+
// Try to get remote URL (origin by default)
|
|
144
|
+
const remoteUrl = execSync('git remote get-url origin', {
|
|
145
|
+
cwd,
|
|
146
|
+
stdio: 'pipe',
|
|
147
|
+
encoding: 'utf8',
|
|
148
|
+
}).trim();
|
|
149
|
+
|
|
150
|
+
if (!remoteUrl) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Parse the remote URL to extract provider context
|
|
155
|
+
return parseGitRemoteUrl(remoteUrl);
|
|
156
|
+
} catch {
|
|
157
|
+
// No remote configured or command failed
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
module.exports = {
|
|
163
|
+
parseGitRemoteUrl,
|
|
164
|
+
detectGitContext,
|
|
165
|
+
};
|
package/lib/id-detector.js
CHANGED
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Strategy:
|
|
5
5
|
* 1. Check if ID exists in cluster storage
|
|
6
|
-
* 2. If not, check if ID exists in task storage
|
|
6
|
+
* 2. If not, check if ID exists in task storage (SQLite)
|
|
7
7
|
* 3. Return type: 'cluster', 'task', or null
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
const path = require('path');
|
|
11
11
|
const fs = require('fs');
|
|
12
12
|
const os = require('os');
|
|
13
|
+
const Database = require('better-sqlite3');
|
|
13
14
|
|
|
14
15
|
// Storage paths
|
|
15
16
|
const CLUSTER_DIR = path.join(os.homedir(), '.zeroshot');
|
|
16
17
|
const TASK_DIR = path.join(os.homedir(), '.claude-zeroshot');
|
|
18
|
+
const TASK_DB_FILE = path.join(TASK_DIR, 'store.db');
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* Detect if ID is a cluster or task
|
|
@@ -34,16 +36,17 @@ function detectIdType(id) {
|
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
// Check tasks
|
|
38
|
-
|
|
39
|
-
if (fs.existsSync(taskFile)) {
|
|
39
|
+
// Check tasks in SQLite
|
|
40
|
+
if (fs.existsSync(TASK_DB_FILE)) {
|
|
40
41
|
try {
|
|
41
|
-
const
|
|
42
|
-
|
|
42
|
+
const db = new Database(TASK_DB_FILE, { readonly: true, timeout: 5000 });
|
|
43
|
+
const row = db.prepare('SELECT id FROM tasks WHERE id = ?').get(id);
|
|
44
|
+
db.close();
|
|
45
|
+
if (row) {
|
|
43
46
|
return 'task';
|
|
44
47
|
}
|
|
45
48
|
} catch {
|
|
46
|
-
// Ignore
|
|
49
|
+
// Ignore DB errors
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
52
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider defaults module
|
|
3
|
+
*
|
|
4
|
+
* Separated from settings.js to break circular dependency:
|
|
5
|
+
* - settings.js requires provider defaults
|
|
6
|
+
* - providers require settings.js (for loadSettings, getClaudeCommand, etc.)
|
|
7
|
+
*
|
|
8
|
+
* CRITICAL: This module should NOT import from settings.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// Cache provider defaults to avoid repeated instantiation
|
|
12
|
+
let _providerDefaultsCache = null;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Build provider default settings by instantiating each provider
|
|
16
|
+
* and calling getDefaultSettings()
|
|
17
|
+
* @returns {Object} Map of provider name to default settings
|
|
18
|
+
*/
|
|
19
|
+
function buildProviderDefaults() {
|
|
20
|
+
const { listProviders, getProvider } = require('../src/providers');
|
|
21
|
+
|
|
22
|
+
const defaults = {};
|
|
23
|
+
for (const providerName of listProviders()) {
|
|
24
|
+
try {
|
|
25
|
+
const provider = getProvider(providerName);
|
|
26
|
+
defaults[providerName] = provider.getDefaultSettings();
|
|
27
|
+
} catch (error) {
|
|
28
|
+
// If provider fails to instantiate, use basic defaults
|
|
29
|
+
console.warn(`Warning: Could not get defaults for ${providerName}: ${error.message}`);
|
|
30
|
+
defaults[providerName] = {
|
|
31
|
+
maxLevel: 'level3',
|
|
32
|
+
minLevel: 'level1',
|
|
33
|
+
defaultLevel: 'level2',
|
|
34
|
+
levelOverrides: {},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return defaults;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get or build cached provider defaults
|
|
43
|
+
* @returns {Object} Provider defaults
|
|
44
|
+
*/
|
|
45
|
+
function getProviderDefaults() {
|
|
46
|
+
if (!_providerDefaultsCache) {
|
|
47
|
+
_providerDefaultsCache = buildProviderDefaults();
|
|
48
|
+
}
|
|
49
|
+
return _providerDefaultsCache;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Clear the provider defaults cache (primarily for testing)
|
|
54
|
+
*/
|
|
55
|
+
function clearProviderDefaultsCache() {
|
|
56
|
+
_providerDefaultsCache = null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = {
|
|
60
|
+
getProviderDefaults,
|
|
61
|
+
clearProviderDefaultsCache,
|
|
62
|
+
};
|
package/lib/provider-names.js
CHANGED
|
@@ -5,9 +5,10 @@ const PROVIDER_ALIASES = {
|
|
|
5
5
|
claude: 'claude',
|
|
6
6
|
codex: 'codex',
|
|
7
7
|
gemini: 'gemini',
|
|
8
|
+
opencode: 'opencode',
|
|
8
9
|
};
|
|
9
10
|
|
|
10
|
-
const VALID_PROVIDERS = ['claude', 'codex', 'gemini'];
|
|
11
|
+
const VALID_PROVIDERS = ['claude', 'codex', 'gemini', 'opencode'];
|
|
11
12
|
|
|
12
13
|
function normalizeProviderName(name) {
|
|
13
14
|
if (!name || typeof name !== 'string') return name;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude authentication settings and helpers
|
|
3
|
+
* Extracted from settings.js for provider-specific isolation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Anthropic API key prefix for validation
|
|
8
|
+
*/
|
|
9
|
+
const ANTHROPIC_KEY_PREFIX = 'sk-ant-';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Environment variables used for Claude authentication
|
|
13
|
+
*/
|
|
14
|
+
const CLAUDE_AUTH_ENV_VARS = [
|
|
15
|
+
'ANTHROPIC_API_KEY',
|
|
16
|
+
'AWS_BEARER_TOKEN_BEDROCK',
|
|
17
|
+
'AWS_REGION',
|
|
18
|
+
'CLAUDE_CODE_USE_BEDROCK',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Validate an Anthropic API key format
|
|
23
|
+
* @param {string|null|undefined} key - API key to validate
|
|
24
|
+
* @returns {boolean} True if key is falsy OR starts with valid prefix
|
|
25
|
+
*/
|
|
26
|
+
function isValidAnthropicKey(key) {
|
|
27
|
+
return !key || key.startsWith(ANTHROPIC_KEY_PREFIX);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Check if Bedrock mode is active based on env and overrides
|
|
32
|
+
* @param {Object} [envOverrides={}] - Environment variable overrides to check
|
|
33
|
+
* @returns {boolean} True if Bedrock mode is active
|
|
34
|
+
*/
|
|
35
|
+
function isBedrockMode(envOverrides = {}) {
|
|
36
|
+
return (
|
|
37
|
+
envOverrides.CLAUDE_CODE_USE_BEDROCK === '1' || process.env.CLAUDE_CODE_USE_BEDROCK === '1'
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Resolve Claude authentication environment variables from settings
|
|
43
|
+
* Bedrock takes priority over direct Anthropic API key AND OAuth session
|
|
44
|
+
* @param {Object} settings - Settings object from loadSettings()
|
|
45
|
+
* @returns {Object} Environment variables to set for Claude auth
|
|
46
|
+
*/
|
|
47
|
+
function resolveClaudeAuth(settings) {
|
|
48
|
+
const claudeSettings = settings.providerSettings?.claude || {};
|
|
49
|
+
const env = {};
|
|
50
|
+
|
|
51
|
+
// Bedrock takes priority over everything (including OAuth)
|
|
52
|
+
if (!process.env.AWS_BEARER_TOKEN_BEDROCK && claudeSettings.bedrockApiKey) {
|
|
53
|
+
env.AWS_BEARER_TOKEN_BEDROCK = claudeSettings.bedrockApiKey;
|
|
54
|
+
env.CLAUDE_CODE_USE_BEDROCK = '1';
|
|
55
|
+
if (claudeSettings.bedrockRegion && !process.env.AWS_REGION) {
|
|
56
|
+
env.AWS_REGION = claudeSettings.bedrockRegion;
|
|
57
|
+
}
|
|
58
|
+
} else if (process.env.AWS_BEARER_TOKEN_BEDROCK && !process.env.CLAUDE_CODE_USE_BEDROCK) {
|
|
59
|
+
// Auto-set CLAUDE_CODE_USE_BEDROCK if token present in env
|
|
60
|
+
env.CLAUDE_CODE_USE_BEDROCK = '1';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Anthropic API key only if no Bedrock
|
|
64
|
+
const hasBedrock = env.AWS_BEARER_TOKEN_BEDROCK || process.env.AWS_BEARER_TOKEN_BEDROCK;
|
|
65
|
+
if (!process.env.ANTHROPIC_API_KEY && !hasBedrock && claudeSettings.anthropicApiKey) {
|
|
66
|
+
env.ANTHROPIC_API_KEY = claudeSettings.anthropicApiKey;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return env;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
module.exports = {
|
|
73
|
+
ANTHROPIC_KEY_PREFIX,
|
|
74
|
+
CLAUDE_AUTH_ENV_VARS,
|
|
75
|
+
isValidAnthropicKey,
|
|
76
|
+
isBedrockMode,
|
|
77
|
+
resolveClaudeAuth,
|
|
78
|
+
};
|