@infersec/conduit 1.4.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.
@@ -0,0 +1,4 @@
1
+ import { ConfigurationOverrides } from "./configuration.js";
2
+ export declare function startInferenceAgent({ configurationOverrides }: {
3
+ configurationOverrides?: ConfigurationOverrides;
4
+ }): Promise<void>;
@@ -0,0 +1,36 @@
1
+ import { Readable } from "node:stream";
2
+ import { Logger } from "@infersec/logger";
3
+ import { LLMEngine } from "@infersec/definitions";
4
+ export interface EngineUsageMetrics {
5
+ completionTokens: number | null;
6
+ promptTokens: number | null;
7
+ totalTokens: number | null;
8
+ }
9
+ interface EngineMetricsLoggerOptions {
10
+ agentEngineType: LLMEngine;
11
+ logger: Logger;
12
+ requestBodyBytes: number;
13
+ requestPath: string;
14
+ }
15
+ interface EngineMetricsCompletion {
16
+ error: Error | null;
17
+ requestBodyBytes: number;
18
+ responseBytes: number;
19
+ usage: EngineUsageMetrics | null;
20
+ }
21
+ interface MonitorEngineResponseOptions extends EngineMetricsLoggerOptions {
22
+ body: Readable;
23
+ onComplete?: (result: EngineMetricsCompletion) => void;
24
+ }
25
+ interface EngineMetricsLogOptions extends EngineMetricsLoggerOptions {
26
+ error?: Error;
27
+ level: "info" | "error";
28
+ responseBytes: number;
29
+ usage?: EngineUsageMetrics | null;
30
+ }
31
+ interface MonitorEngineResponseResult {
32
+ stream: Readable;
33
+ }
34
+ export declare function logEngineMetrics({ agentEngineType, error, level, logger, requestBodyBytes, requestPath, responseBytes, usage }: EngineMetricsLogOptions): void;
35
+ export declare function monitorEngineResponseStream({ agentEngineType, body, logger, onComplete, requestBodyBytes, requestPath }: MonitorEngineResponseOptions): MonitorEngineResponseResult;
36
+ export {};
@@ -0,0 +1,2 @@
1
+ import { InferenceAgentMachineMetadata } from "@infersec/definitions";
2
+ export declare function collectMachineMetadata(): Promise<InferenceAgentMachineMetadata>;
@@ -0,0 +1,20 @@
1
+ import { Readable } from "node:stream";
2
+ import { InferenceAgentLLMMetricsPayload } from "@infersec/definitions";
3
+ import { Logger } from "@infersec/logger";
4
+ import { Configuration } from "../configuration.js";
5
+ import { ModelManager } from "../modelManagement/ModelManager.js";
6
+ export declare function proxyOpenAIStreamingRoute({ body, configuration, logger, modelManager, path, reportMetrics }: {
7
+ body: unknown;
8
+ configuration: Configuration;
9
+ logger: Logger;
10
+ modelManager: ModelManager;
11
+ path: "/v1/chat/completions" | "/v1/completions";
12
+ reportMetrics: (payload: InferenceAgentLLMMetricsPayload) => Promise<void>;
13
+ }): Promise<{
14
+ body: Readable;
15
+ headers: Record<string, string>;
16
+ status: number;
17
+ } | {
18
+ status: number;
19
+ statusText: string;
20
+ }>;
@@ -0,0 +1 @@
1
+ export declare function sleep(ms: number): Promise<void>;
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@infersec/conduit",
3
+ "description": "End user inference agent for connecting local LLMs to the cloud.",
4
+ "version": "1.4.1",
5
+ "bin": {
6
+ "infersec-conduit": "./dist/cli.js"
7
+ },
8
+ "exports": {
9
+ ".": {
10
+ "default": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "type": "module",
19
+ "scripts": {
20
+ "build": "npm run clean && npm run build:bundle",
21
+ "build:bundle": "rollup -c",
22
+ "clean": "rm -rf ./dist",
23
+ "format": "prettier --write .",
24
+ "prepublishOnly": "npm run build",
25
+ "start": "npm run build && node ./dist/index.js",
26
+ "test": "npm run test:types && npm run test:lint && npm run test:format",
27
+ "test:format": "prettier --check .",
28
+ "test:lint": "eslint source/**/*.ts",
29
+ "test:types": "tsc -p tsconfig.json --noEmit"
30
+ },
31
+ "prettier": "@infersec/prettier",
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "types": "./dist/index.d.ts",
36
+ "devDependencies": {
37
+ "@infersec/definitions": "*",
38
+ "@infersec/fetch": "*",
39
+ "@infersec/logger": "*",
40
+ "@infersec/prettier": "*",
41
+ "@infersec/tsconfig": "*",
42
+ "@infersec/utils": "*",
43
+ "@rollup/plugin-commonjs": "^28.0.6",
44
+ "@rollup/plugin-json": "^6.1.0",
45
+ "@rollup/plugin-node-resolve": "^16.0.1",
46
+ "@rollup/plugin-typescript": "^12.1.4",
47
+ "@types/express": "^4.17.23",
48
+ "@types/supertest": "^6.0.3",
49
+ "rollup": "^4.46.2",
50
+ "tslib": "^2.8.1"
51
+ },
52
+ "dependencies": {
53
+ "@huggingface/hub": "^2.5.2",
54
+ "eventemitter3": "^5.0.1",
55
+ "execa": "^9.6.0",
56
+ "express": "^4.21.2",
57
+ "express-promise-router": "^4.1.1",
58
+ "glob": "^11.0.3",
59
+ "supertest": "^7.1.4",
60
+ "systeminformation": "^5.30.3",
61
+ "undici": "^7.13.0",
62
+ "zod": "^4.2.1"
63
+ }
64
+ }