@infersec/conduit 1.8.0 → 1.8.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-
|
|
9
|
+
import { a as asError, s as startInferenceAgent } from './start-ItMOqpI1.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-
|
|
8
|
+
import { s as startInferenceAgent, a as asError } from './start-ItMOqpI1.js';
|
|
9
9
|
import 'argon2';
|
|
10
10
|
import 'node:child_process';
|
|
11
11
|
import 'node:stream';
|
|
@@ -30,5 +30,7 @@ export declare class ModelManager extends EventEmitter<ModelManagerEvents> {
|
|
|
30
30
|
onDownloadProgress?: (update: ModelDownloadProgressUpdate) => void;
|
|
31
31
|
}): Promise<void>;
|
|
32
32
|
start(): Promise<void>;
|
|
33
|
+
private isEngineReady;
|
|
34
|
+
private waitForEngineReady;
|
|
33
35
|
}
|
|
34
36
|
export {};
|
|
@@ -105091,8 +105091,48 @@ class ModelManager extends EventEmitter {
|
|
|
105091
105091
|
this.logger.info("Started LLM engine", {
|
|
105092
105092
|
agentEngineType: this.engine
|
|
105093
105093
|
});
|
|
105094
|
+
try {
|
|
105095
|
+
await this.waitForEngineReady();
|
|
105096
|
+
}
|
|
105097
|
+
catch (error) {
|
|
105098
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
105099
|
+
this.emit("engineError", err);
|
|
105100
|
+
throw err;
|
|
105101
|
+
}
|
|
105094
105102
|
this.emit("engineReady");
|
|
105095
105103
|
}
|
|
105104
|
+
async isEngineReady() {
|
|
105105
|
+
switch (this.engine) {
|
|
105106
|
+
case "llama.cpp":
|
|
105107
|
+
case "vllm": {
|
|
105108
|
+
try {
|
|
105109
|
+
const response = await this.fetchOpenAI("/v1/models", {
|
|
105110
|
+
method: "GET",
|
|
105111
|
+
signal: AbortSignal.timeout(5000)
|
|
105112
|
+
});
|
|
105113
|
+
return response.ok;
|
|
105114
|
+
}
|
|
105115
|
+
catch (_error) {
|
|
105116
|
+
return false;
|
|
105117
|
+
}
|
|
105118
|
+
}
|
|
105119
|
+
default:
|
|
105120
|
+
return true;
|
|
105121
|
+
}
|
|
105122
|
+
}
|
|
105123
|
+
async waitForEngineReady() {
|
|
105124
|
+
const maxWaitMs = 5 * 60 * 1000;
|
|
105125
|
+
const pollIntervalMs = 2000;
|
|
105126
|
+
const start = Date.now();
|
|
105127
|
+
while (Date.now() - start < maxWaitMs) {
|
|
105128
|
+
const ready = await this.isEngineReady();
|
|
105129
|
+
if (ready) {
|
|
105130
|
+
return;
|
|
105131
|
+
}
|
|
105132
|
+
await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
|
|
105133
|
+
}
|
|
105134
|
+
throw new Error("LLM engine failed readiness checks within timeout");
|
|
105135
|
+
}
|
|
105096
105136
|
}
|
|
105097
105137
|
|
|
105098
105138
|
async function handleSSERequests({ apiURL, configuration, logger, onRequest, onRequestEnd, onRequestStart }) {
|