@the-agenticflow/openflows 0.1.23 → 0.1.26
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/bin/agentflow-bin +0 -0
- package/bin/anthropic-proxy-bin +0 -0
- package/bin/openflows.js +48 -11
- package/package.json +1 -1
package/bin/agentflow-bin
CHANGED
|
Binary file
|
package/bin/anthropic-proxy-bin
CHANGED
|
Binary file
|
package/bin/openflows.js
CHANGED
|
@@ -55,7 +55,7 @@ loadEnvFile();
|
|
|
55
55
|
|
|
56
56
|
const binaryPath = path.join(__dirname, '..', 'bin', 'agentflow-bin');
|
|
57
57
|
const PROXY_PORT = process.env.PROXY_PORT || 8765;
|
|
58
|
-
const PROXY_STARTUP_TIMEOUT =
|
|
58
|
+
const PROXY_STARTUP_TIMEOUT = 10000;
|
|
59
59
|
|
|
60
60
|
// Check if a port is in use
|
|
61
61
|
function isPortInUse(port) {
|
|
@@ -150,27 +150,59 @@ async function startProxy() {
|
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
let proxyReady = false;
|
|
153
|
+
let resolved = false;
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
// Fallback: check if proxy is actually listening on the port
|
|
156
|
+
const portCheckInterval = setInterval(async () => {
|
|
157
|
+
if (proxyReady || resolved) return;
|
|
158
|
+
const isListening = await isPortInUse(PROXY_PORT);
|
|
159
|
+
if (isListening) {
|
|
160
|
+
proxyReady = true;
|
|
161
|
+
resolved = true;
|
|
162
|
+
clearInterval(portCheckInterval);
|
|
163
|
+
clearTimeout(timeout);
|
|
164
|
+
console.log(`[openflows] ✓ Proxy detected on port ${PROXY_PORT} (port check)`);
|
|
165
|
+
resolve(proxy);
|
|
166
|
+
}
|
|
167
|
+
}, 500);
|
|
168
|
+
|
|
169
|
+
return new Promise((resolveInner, reject) => {
|
|
155
170
|
const timeout = setTimeout(() => {
|
|
171
|
+
clearInterval(portCheckInterval);
|
|
156
172
|
if (!proxyReady) {
|
|
157
173
|
console.warn('[openflows] Proxy startup timeout, continuing without proxy');
|
|
158
|
-
|
|
174
|
+
resolved = true;
|
|
175
|
+
resolveInner(null);
|
|
159
176
|
}
|
|
160
177
|
}, PROXY_STARTUP_TIMEOUT);
|
|
161
178
|
|
|
162
179
|
proxy.stdout.on('data', (data) => {
|
|
163
180
|
const line = data.toString();
|
|
164
181
|
if (line.includes('listening') || line.includes('Proxy') || line.includes('started')) {
|
|
165
|
-
proxyReady
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
182
|
+
if (!proxyReady) {
|
|
183
|
+
proxyReady = true;
|
|
184
|
+
resolved = true;
|
|
185
|
+
clearInterval(portCheckInterval);
|
|
186
|
+
clearTimeout(timeout);
|
|
187
|
+
console.log(`[openflows] ✓ Proxy started on port ${PROXY_PORT}`);
|
|
188
|
+
resolveInner(proxy);
|
|
189
|
+
}
|
|
169
190
|
}
|
|
170
191
|
});
|
|
171
192
|
|
|
172
193
|
proxy.stderr.on('data', (data) => {
|
|
173
194
|
const line = data.toString();
|
|
195
|
+
// Check for ready signal on stderr too (Rust tracing logs go to stderr)
|
|
196
|
+
if (line.includes('listening') || line.includes('Proxy') || line.includes('started')) {
|
|
197
|
+
if (!proxyReady) {
|
|
198
|
+
proxyReady = true;
|
|
199
|
+
resolved = true;
|
|
200
|
+
clearInterval(portCheckInterval);
|
|
201
|
+
clearTimeout(timeout);
|
|
202
|
+
console.log(`[openflows] ✓ Proxy started on port ${PROXY_PORT}`);
|
|
203
|
+
resolveInner(proxy);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
174
206
|
// Log proxy errors but don't fail
|
|
175
207
|
if (line.includes('ERROR') || line.includes('error')) {
|
|
176
208
|
console.error('[openflows proxy]', line.trim());
|
|
@@ -178,15 +210,19 @@ async function startProxy() {
|
|
|
178
210
|
});
|
|
179
211
|
|
|
180
212
|
proxy.on('error', (err) => {
|
|
213
|
+
clearInterval(portCheckInterval);
|
|
181
214
|
clearTimeout(timeout);
|
|
182
215
|
console.warn(`[openflows] Proxy failed to start: ${err.message}`);
|
|
183
|
-
|
|
216
|
+
resolved = true;
|
|
217
|
+
resolveInner(null);
|
|
184
218
|
});
|
|
185
219
|
|
|
186
220
|
proxy.on('exit', (code) => {
|
|
187
221
|
if (!proxyReady) {
|
|
222
|
+
clearInterval(portCheckInterval);
|
|
188
223
|
clearTimeout(timeout);
|
|
189
|
-
|
|
224
|
+
resolved = true;
|
|
225
|
+
resolveInner(null);
|
|
190
226
|
} else {
|
|
191
227
|
console.log(`[openflows] Proxy exited with code ${code}`);
|
|
192
228
|
}
|
|
@@ -323,9 +359,10 @@ Documentation: https://openflows.dev
|
|
|
323
359
|
|
|
324
360
|
// Set ANTHROPIC_MODEL for Claude CLI when using proxy
|
|
325
361
|
// The proxy will map this to PROXY_TARGET_MODEL
|
|
362
|
+
// Use 'sonnet' alias which is valid for Claude CLI (not claude-sonnet-4-5)
|
|
326
363
|
if (!process.env.ANTHROPIC_MODEL && !process.env.CLAUDE_MODEL) {
|
|
327
|
-
env.ANTHROPIC_MODEL = '
|
|
328
|
-
console.log(`[openflows] ✓ Set ANTHROPIC_MODEL=
|
|
364
|
+
env.ANTHROPIC_MODEL = 'sonnet';
|
|
365
|
+
console.log(`[openflows] ✓ Set ANTHROPIC_MODEL=sonnet for proxy compatibility`);
|
|
329
366
|
}
|
|
330
367
|
} else {
|
|
331
368
|
console.log(`[openflows] Mode: ${reason}`);
|