gitarsenal-cli 1.9.101 → 1.9.103
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/.venv_status.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"created":"2025-09-
|
|
1
|
+
{"created":"2025-09-14T11:00:57.034Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
|
package/lib/e2b-sandbox.js
CHANGED
|
@@ -41,13 +41,41 @@ function getPythonExecutable() {
|
|
|
41
41
|
return isWindows ? 'python' : 'python3';
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Fetch Anthropic API key directly from the server
|
|
46
|
+
* @returns {Promise<string>} - The Anthropic API key
|
|
47
|
+
*/
|
|
48
|
+
async function fetchAnthropicApiKey() {
|
|
49
|
+
try {
|
|
50
|
+
const pythonExecutable = getPythonExecutable();
|
|
51
|
+
const fetchTokensScript = path.join(__dirname, '..', 'python', 'fetch_modal_tokens.py');
|
|
52
|
+
|
|
53
|
+
// Run the fetch_modal_tokens.py script with --output-anthropic-key flag
|
|
54
|
+
const { stdout, stderr } = await execAsync(`${pythonExecutable} ${fetchTokensScript} --output-anthropic-key`, {
|
|
55
|
+
env: { ...process.env },
|
|
56
|
+
timeout: 30000 // 30 seconds timeout
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Parse the output to find the Anthropic API key
|
|
60
|
+
const anthropicKeyMatch = stdout.match(/ANTHROPIC_API_KEY=([a-zA-Z0-9\-_]+)/);
|
|
61
|
+
if (anthropicKeyMatch && anthropicKeyMatch[1]) {
|
|
62
|
+
const anthropicApiKey = anthropicKeyMatch[1];
|
|
63
|
+
return anthropicApiKey;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return null;
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error(chalk.red(`❌ Error fetching Anthropic API key: ${error.message}`));
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
44
73
|
/**
|
|
45
74
|
* Fetch E2B API key directly from the server
|
|
46
75
|
* @returns {Promise<string>} - The E2B API key
|
|
47
76
|
*/
|
|
48
77
|
async function fetchE2BApiKey() {
|
|
49
78
|
try {
|
|
50
|
-
console.log(chalk.blue('🔄 Fetching E2B API key directly from server...'));
|
|
51
79
|
|
|
52
80
|
const pythonExecutable = getPythonExecutable();
|
|
53
81
|
const fetchTokensScript = path.join(__dirname, '..', 'python', 'fetch_modal_tokens.py');
|
|
@@ -151,8 +179,19 @@ async function runE2BSandbox(options) {
|
|
|
151
179
|
|
|
152
180
|
// Get OpenAI and Anthropic API keys from environment or apiKeys
|
|
153
181
|
const openaiApiKey = apiKeys.OPENAI_API_KEY || process.env.OPENAI_API_KEY;
|
|
154
|
-
|
|
155
|
-
|
|
182
|
+
let anthropicApiKey = apiKeys.ANTHROPIC_API_KEY || process.env.ANTHROPIC_API_KEY;
|
|
183
|
+
|
|
184
|
+
// If Anthropic API key is not found, try to fetch it directly from the server
|
|
185
|
+
if (!anthropicApiKey) {
|
|
186
|
+
console.log(chalk.blue('🔄 Fetching Anthropic API key directly from server...'));
|
|
187
|
+
anthropicApiKey = await fetchAnthropicApiKey();
|
|
188
|
+
if (anthropicApiKey) {
|
|
189
|
+
console.log(chalk.green('✅ Successfully fetched Anthropic API key from server'));
|
|
190
|
+
// Add it to apiKeys so it gets passed to the Python script
|
|
191
|
+
apiKeys.ANTHROPIC_API_KEY = anthropicApiKey;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
156
195
|
// Run the e2b_sandbox_agent.py script with the repository URL
|
|
157
196
|
const scriptPath = path.join(__dirname, '..', 'python', 'e2b_sandbox_agent.py');
|
|
158
197
|
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -19,7 +19,6 @@ def install_dependencies_in_sandbox(sandbox):
|
|
|
19
19
|
"""
|
|
20
20
|
Install required packages in the sandbox
|
|
21
21
|
"""
|
|
22
|
-
print("📦 Installing required packages in sandbox...")
|
|
23
22
|
|
|
24
23
|
# Install Python packages
|
|
25
24
|
packages = [
|
|
@@ -154,7 +153,6 @@ with open('/home/user/kill_claude/requirements.txt', 'w') as f:
|
|
|
154
153
|
with open('/home/user/kill_claude/prompts/{prompt_file}', 'w') as f:
|
|
155
154
|
f.write({repr(prompt_content)})
|
|
156
155
|
""")
|
|
157
|
-
print(f"Preparing Agents...")
|
|
158
156
|
|
|
159
157
|
# Upload tools
|
|
160
158
|
tools_dir = os.path.join(kill_claude_dir, "tools")
|
|
@@ -168,7 +166,6 @@ with open('/home/user/kill_claude/prompts/{prompt_file}', 'w') as f:
|
|
|
168
166
|
with open('/home/user/kill_claude/tools/{tool_file}', 'w') as f:
|
|
169
167
|
f.write({repr(tool_content)})
|
|
170
168
|
""")
|
|
171
|
-
print(f"Preparing Tools...")
|
|
172
169
|
|
|
173
170
|
# Create __init__.py in tools directory
|
|
174
171
|
sandbox.run_code("""
|
|
@@ -484,18 +481,25 @@ def run_e2b_sandbox(repo_url, setup_commands=None, api_keys=None):
|
|
|
484
481
|
try:
|
|
485
482
|
# Fetch the E2B API key directly from the server
|
|
486
483
|
try:
|
|
487
|
-
print("🔄 Fetching E2B API key directly from server...")
|
|
488
484
|
from fetch_modal_tokens import fetch_default_tokens_from_gitarsenal
|
|
489
485
|
token_id, token_secret, e2b_api_key, openai_api_key, anthropic_api_key, openrouter_api_key, groq_api_key = fetch_default_tokens_from_gitarsenal()
|
|
490
486
|
|
|
491
487
|
if e2b_api_key and e2b_api_key != "your_e2b_api_key" and not e2b_api_key.startswith("placeholder"):
|
|
492
488
|
# Set it in the environment for the Sandbox.create() call
|
|
493
489
|
os.environ["E2B_API_KEY"] = e2b_api_key
|
|
490
|
+
print(f"✅ Successfully fetched E2B API key from server (format: {e2b_api_key[:6]}...)")
|
|
494
491
|
else:
|
|
495
492
|
print("⚠️ Could not get valid E2B API key from server")
|
|
496
493
|
e2b_api_key = None
|
|
494
|
+
|
|
495
|
+
# Also set the Anthropic API key if available
|
|
496
|
+
if anthropic_api_key and anthropic_api_key != "your_anthropic_api_key" and not anthropic_api_key.startswith("placeholder"):
|
|
497
|
+
if api_keys is None:
|
|
498
|
+
api_keys = {}
|
|
499
|
+
api_keys["ANTHROPIC_API_KEY"] = anthropic_api_key
|
|
500
|
+
print(f"✅ Successfully fetched Anthropic API key from server (format: {anthropic_api_key[:5]}...)")
|
|
497
501
|
except Exception as e:
|
|
498
|
-
print(f"⚠️ Could not fetch
|
|
502
|
+
print(f"⚠️ Could not fetch API keys from server: {e}")
|
|
499
503
|
e2b_api_key = None
|
|
500
504
|
|
|
501
505
|
# If we couldn't fetch the key directly, check if it's in api_keys
|
|
@@ -623,6 +627,18 @@ os.environ['{key_name}'] = '{key_value}'
|
|
|
623
627
|
print(f"✅ Set {key_name} in sandbox environment")
|
|
624
628
|
""")
|
|
625
629
|
|
|
630
|
+
# Double-check that the Anthropic API key is set in the sandbox environment
|
|
631
|
+
if api_keys and 'ANTHROPIC_API_KEY' in api_keys:
|
|
632
|
+
anthropic_key = api_keys['ANTHROPIC_API_KEY']
|
|
633
|
+
# Verify the key is set in the sandbox environment
|
|
634
|
+
sandbox.run_code("""
|
|
635
|
+
import os
|
|
636
|
+
if 'ANTHROPIC_API_KEY' in os.environ:
|
|
637
|
+
print(f"✅ Verified ANTHROPIC_API_KEY is set in sandbox environment (format: {os.environ['ANTHROPIC_API_KEY'][:5]}...)")
|
|
638
|
+
else:
|
|
639
|
+
print("❌ ANTHROPIC_API_KEY is not set in sandbox environment")
|
|
640
|
+
""")
|
|
641
|
+
|
|
626
642
|
print("\n" + "="*80)
|
|
627
643
|
print("🤖 CLAUDE AGENT REPOSITORY SETUP")
|
|
628
644
|
print("="*80)
|
|
@@ -191,6 +191,7 @@ if __name__ == "__main__":
|
|
|
191
191
|
parser.add_argument('--proxy-url', help='URL of the proxy server')
|
|
192
192
|
parser.add_argument('--proxy-api-key', help='API key for the proxy server')
|
|
193
193
|
parser.add_argument('--output-e2b-key', action='store_true', help='Output the E2B API key directly for JavaScript to use')
|
|
194
|
+
parser.add_argument('--output-anthropic-key', action='store_true', help='Output the Anthropic API key directly for JavaScript to use')
|
|
194
195
|
args = parser.parse_args()
|
|
195
196
|
|
|
196
197
|
# Set proxy URL and API key in environment variables if provided
|
|
@@ -210,6 +211,11 @@ if __name__ == "__main__":
|
|
|
210
211
|
print(f"E2B_API_KEY={e2b_api_key}")
|
|
211
212
|
sys.exit(0)
|
|
212
213
|
|
|
214
|
+
# If --output-anthropic-key is specified, output the Anthropic API key directly
|
|
215
|
+
if args.output_anthropic_key and anthropic_api_key:
|
|
216
|
+
print(f"ANTHROPIC_API_KEY={anthropic_api_key}")
|
|
217
|
+
sys.exit(0)
|
|
218
|
+
|
|
213
219
|
print(f"Token ID: {token_id}")
|
|
214
220
|
print(f"Token Secret: {token_secret}")
|
|
215
221
|
print(f"E2B API Key: {e2b_api_key[:5] + '...' if e2b_api_key else None}")
|