gitarsenal-cli 1.9.102 → 1.9.105
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:10:07.073Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
|
package/lib/e2b-sandbox.js
CHANGED
|
@@ -41,13 +41,40 @@ 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
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
44
72
|
/**
|
|
45
73
|
* Fetch E2B API key directly from the server
|
|
46
74
|
* @returns {Promise<string>} - The E2B API key
|
|
47
75
|
*/
|
|
48
76
|
async function fetchE2BApiKey() {
|
|
49
77
|
try {
|
|
50
|
-
console.log(chalk.blue('🔄 Fetching E2B API key directly from server...'));
|
|
51
78
|
|
|
52
79
|
const pythonExecutable = getPythonExecutable();
|
|
53
80
|
const fetchTokensScript = path.join(__dirname, '..', 'python', 'fetch_modal_tokens.py');
|
|
@@ -151,8 +178,17 @@ async function runE2BSandbox(options) {
|
|
|
151
178
|
|
|
152
179
|
// Get OpenAI and Anthropic API keys from environment or apiKeys
|
|
153
180
|
const openaiApiKey = apiKeys.OPENAI_API_KEY || process.env.OPENAI_API_KEY;
|
|
154
|
-
|
|
155
|
-
|
|
181
|
+
let anthropicApiKey = apiKeys.ANTHROPIC_API_KEY || process.env.ANTHROPIC_API_KEY;
|
|
182
|
+
|
|
183
|
+
// If Anthropic API key is not found, try to fetch it directly from the server
|
|
184
|
+
if (!anthropicApiKey) {
|
|
185
|
+
anthropicApiKey = await fetchAnthropicApiKey();
|
|
186
|
+
if (anthropicApiKey) {
|
|
187
|
+
// Add it to apiKeys so it gets passed to the Python script
|
|
188
|
+
apiKeys.ANTHROPIC_API_KEY = anthropicApiKey;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
156
192
|
// Run the e2b_sandbox_agent.py script with the repository URL
|
|
157
193
|
const scriptPath = path.join(__dirname, '..', 'python', 'e2b_sandbox_agent.py');
|
|
158
194
|
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -490,8 +490,14 @@ def run_e2b_sandbox(repo_url, setup_commands=None, api_keys=None):
|
|
|
490
490
|
else:
|
|
491
491
|
print("⚠️ Could not get valid E2B API key from server")
|
|
492
492
|
e2b_api_key = None
|
|
493
|
+
|
|
494
|
+
# Also set the Anthropic API key if available
|
|
495
|
+
if anthropic_api_key and anthropic_api_key != "your_anthropic_api_key" and not anthropic_api_key.startswith("placeholder"):
|
|
496
|
+
if api_keys is None:
|
|
497
|
+
api_keys = {}
|
|
498
|
+
api_keys["ANTHROPIC_API_KEY"] = anthropic_api_key
|
|
493
499
|
except Exception as e:
|
|
494
|
-
print(f"⚠️ Could not fetch
|
|
500
|
+
print(f"⚠️ Could not fetch API keys from server: {e}")
|
|
495
501
|
e2b_api_key = None
|
|
496
502
|
|
|
497
503
|
# If we couldn't fetch the key directly, check if it's in api_keys
|
|
@@ -619,6 +625,18 @@ os.environ['{key_name}'] = '{key_value}'
|
|
|
619
625
|
print(f"✅ Set {key_name} in sandbox environment")
|
|
620
626
|
""")
|
|
621
627
|
|
|
628
|
+
# Double-check that the Anthropic API key is set in the sandbox environment
|
|
629
|
+
if api_keys and 'ANTHROPIC_API_KEY' in api_keys:
|
|
630
|
+
anthropic_key = api_keys['ANTHROPIC_API_KEY']
|
|
631
|
+
# Verify the key is set in the sandbox environment
|
|
632
|
+
sandbox.run_code("""
|
|
633
|
+
import os
|
|
634
|
+
if 'ANTHROPIC_API_KEY' in os.environ:
|
|
635
|
+
print(f"✅ Verified ANTHROPIC_API_KEY is set in sandbox environment (format: {os.environ['ANTHROPIC_API_KEY'][:5]}...)")
|
|
636
|
+
else:
|
|
637
|
+
print("❌ ANTHROPIC_API_KEY is not set in sandbox environment")
|
|
638
|
+
""")
|
|
639
|
+
|
|
622
640
|
print("\n" + "="*80)
|
|
623
641
|
print("🤖 CLAUDE AGENT REPOSITORY SETUP")
|
|
624
642
|
print("="*80)
|
|
@@ -684,7 +702,6 @@ except Exception as e:
|
|
|
684
702
|
|
|
685
703
|
# Try with a simpler approach - just the query subcommand
|
|
686
704
|
debug_cmd = f"cd /home/user && ANTHROPIC_API_KEY=\"{anthropic_key}\" python /home/user/kill_claude/claude_code_agent.py query \"{claude_prompt}\""
|
|
687
|
-
print("Command to execute:", debug_cmd)
|
|
688
705
|
|
|
689
706
|
# Define stdout and stderr handlers to stream output in real-time
|
|
690
707
|
def on_stdout(data):
|
|
@@ -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}")
|