@infersec/conduit 1.31.0 → 1.31.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/dist/cli.js CHANGED
@@ -6,7 +6,7 @@ const __dirname = __pathDirname(__filename);
6
6
 
7
7
  import { parseArgs } from 'node:util';
8
8
  import 'node:crypto';
9
- import { a as asError, s as startInferenceAgent } from './start-CC3HzuZU.js';
9
+ import { a as asError, s as startInferenceAgent } from './start-DvkkeCrj.js';
10
10
  import 'argon2';
11
11
  import 'node:child_process';
12
12
  import 'node:stream';
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ const __filename = __fileURLToPath(import.meta.url);
5
5
  const __dirname = __pathDirname(__filename);
6
6
 
7
7
  import 'node:crypto';
8
- import { s as startInferenceAgent, a as asError } from './start-CC3HzuZU.js';
8
+ import { s as startInferenceAgent, a as asError } from './start-DvkkeCrj.js';
9
9
  import 'argon2';
10
10
  import 'node:child_process';
11
11
  import 'node:stream';
@@ -108429,6 +108429,8 @@ async function startLlamacpp({ targetDirectory }) {
108429
108429
  return processManager;
108430
108430
  }
108431
108431
 
108432
+ // 2 hours
108433
+ const ENGINE_FETCH_TIMEOUT_MS = 7200000;
108432
108434
  class ModelManager extends EventEmitter {
108433
108435
  engine;
108434
108436
  model;
@@ -108472,9 +108474,28 @@ class ModelManager extends EventEmitter {
108472
108474
  async fetchOpenAI(path, opts) {
108473
108475
  switch (this.engine) {
108474
108476
  case "llama.cpp":
108475
- case "vllm":
108476
- console.log("FETCH", path, opts);
108477
- return undiciExports.fetch(joinURL("http://localhost:8000", path), opts);
108477
+ case "vllm": {
108478
+ this.logger.debug(`Fetching from engine: ${path}`);
108479
+ const callerSignal = opts?.signal;
108480
+ const controller = new AbortController();
108481
+ const timeout = setTimeout(() => {
108482
+ controller.abort(new Error("Inference request timeout"));
108483
+ }, ENGINE_FETCH_TIMEOUT_MS);
108484
+ const effectiveSignal = callerSignal ?? controller.signal;
108485
+ try {
108486
+ return await undiciExports.fetch(joinURL("http://localhost:8000", path), {
108487
+ ...opts,
108488
+ headers: {
108489
+ ...opts?.headers,
108490
+ Connection: "keep-alive"
108491
+ },
108492
+ signal: effectiveSignal
108493
+ });
108494
+ }
108495
+ finally {
108496
+ clearTimeout(timeout);
108497
+ }
108498
+ }
108478
108499
  // case "ollama":
108479
108500
  // console.log("FETCH", path, opts);
108480
108501
  // return fetch(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@infersec/conduit",
3
3
  "description": "End user conduit agent for connecting local LLMs to the cloud.",
4
- "version": "1.31.0",
4
+ "version": "1.31.1",
5
5
  "bin": {
6
6
  "infersec-conduit": "./dist/cli.js"
7
7
  },