@infersec/conduit 1.112.1 → 1.114.0

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.
@@ -2,6 +2,7 @@ import type { CreateEngineBody, UpdateEngineBody } from "../managementClient/ind
2
2
  import type { ManagementCommandOptions } from "./managementOptions.js";
3
3
  export interface EngineCreateCommandOptions extends ManagementCommandOptions {
4
4
  arg?: string[];
5
+ baseUrl?: string;
5
6
  type?: string;
6
7
  }
7
8
  export declare function buildEngineCreateBody(options: EngineCreateCommandOptions): CreateEngineBody;
@@ -18,12 +18,16 @@ export declare class ModelManager extends EventEmitter<ModelManagerEvents> {
18
18
  private uniqueName;
19
19
  readonly contextLength: number | null;
20
20
  protected readonly logger: Logger;
21
+ private discoveredModelNames;
21
22
  private engineProcess;
22
23
  private healthPollInterval;
23
24
  private lastEngineError;
24
25
  private lifecycleState;
25
26
  private downloadLockHandle;
26
27
  private stopRequested;
28
+ private lastEngineExitCode;
29
+ private lastEngineExitSignal;
30
+ private reachedRunningState;
27
31
  protected readonly modelsDirectory: string;
28
32
  constructor({ contextLength, engineConfig, enginePort, engineType, logger, model, root }: {
29
33
  contextLength?: number | null;
@@ -43,8 +47,14 @@ export declare class ModelManager extends EventEmitter<ModelManagerEvents> {
43
47
  stop(): Promise<void>;
44
48
  get canStart(): boolean;
45
49
  get canStop(): boolean;
50
+ get lastExitCode(): number | null;
51
+ get lastExitSignal(): NodeJS.Signals | null;
46
52
  get state(): EngineLifecycleState;
53
+ get resolvedServedModelName(): string | null;
54
+ get wasRunning(): boolean;
55
+ private get customBaseURL();
47
56
  private checkEngineReadiness;
57
+ private checkCustomReadiness;
48
58
  private checkGenericHealthReadiness;
49
59
  private checkLlamacppReadiness;
50
60
  private checkVLLMReadiness;
@@ -54,6 +64,7 @@ export declare class ModelManager extends EventEmitter<ModelManagerEvents> {
54
64
  private get lockFilePath();
55
65
  private acquireDownloadLock;
56
66
  private recordEngineError;
67
+ private requireCustomBaseURL;
57
68
  private releaseDownloadLock;
58
69
  private bindEngineProcessEvents;
59
70
  private startEngineProcess;
@@ -0,0 +1,12 @@
1
+ import { EngineExecutionErrorType } from "@infersec/definitions";
2
+ /**
3
+ * Coarse engine-failure classification used only to fill `engine_execution.error_type`. Exit code and
4
+ * terminating signal are consulted FIRST (SIGKILL/SIGSEGV are reliable OOM signals regardless of
5
+ * how much stderr the engine produced); the message text then refines the category. Anything
6
+ * unrecognized is "unknown".
7
+ */
8
+ export declare function classifyEngineFailure({ error, exitCode, signal }: {
9
+ error: Error;
10
+ exitCode: number | null;
11
+ signal?: NodeJS.Signals | null;
12
+ }): EngineExecutionErrorType;
@@ -0,0 +1,55 @@
1
+ import { EngineExecutionErrorType, EngineExecutionReportPayload, LLMEngine } from "@infersec/definitions";
2
+ import { Logger } from "@infersec/logger";
3
+ export interface EngineExecutionReportSource {
4
+ durationMs: number;
5
+ errorDetail: string | null;
6
+ errorType: EngineExecutionErrorType | null;
7
+ ttftMs: number;
8
+ throughput: {
9
+ avgTps: number;
10
+ peakTps: number | null;
11
+ };
12
+ usage: {
13
+ completionTokens: number;
14
+ promptTokens: number;
15
+ totalTokens: number;
16
+ };
17
+ }
18
+ /**
19
+ * Flattens flat CLI extra-arg tokens into [arg, value] pairs, sorted by ARG NAME (ascending, ties by
20
+ * value). `--flag=value` pairs split on the first `=`; a bare `--flag` consumes the following token
21
+ * as its value when that token does not start with "-" (classic CLI convention); anything else
22
+ * (flags, non-strings) is dropped. Secret-like option values are masked before pairing so they
23
+ * never reach execution reports.
24
+ */
25
+ export declare function pairExtraArgs(tokens: unknown): Array<[string, string]>;
26
+ /**
27
+ * Files AT MOST ONE engine_execution report per engine startup. `beginStartup(runAt)` re-arms the
28
+ * latch on every fresh model start (initial boot or cycle) and stamps the startup epoch used as the
29
+ * row's `run_at`. Whichever of the three report* paths fires first wins: startup failure, in-flight
30
+ * crash, or first successful full prompt completion.
31
+ */
32
+ export declare class EngineExecutionReporter {
33
+ private readonly options;
34
+ private currentStartupAt;
35
+ private reportedForCurrentStartup;
36
+ constructor(options: {
37
+ buildContext: () => {
38
+ engineType: LLMEngine;
39
+ engineVersion: string | null;
40
+ extraArgsPairs: Array<[string, string]>;
41
+ };
42
+ logger: Logger;
43
+ report: (payload: EngineExecutionReportPayload) => Promise<void>;
44
+ sourceLabel: string;
45
+ });
46
+ /** Re-arms the latch; the stamp becomes the row's `run_at` (moment startup began). */
47
+ beginStartup(runAt: Date): void;
48
+ /** Reports a startup failure (rejected prepare/start, readiness timeout, pre-ready death). */
49
+ reportStartupFailure(report: EngineExecutionReportSource): Promise<void>;
50
+ /** Reports a spontaneous crash of an engine that had reached the running state. */
51
+ reportRuntimeCrash(report: EngineExecutionReportSource): Promise<void>;
52
+ /** Reports the first fully-responded, token-bearing prompt completion since startup. */
53
+ reportSuccess(report: EngineExecutionReportSource): Promise<void>;
54
+ private file;
55
+ }
@@ -0,0 +1 @@
1
+ export { EngineExecutionReporter, type EngineExecutionReportSource, pairExtraArgs } from "./engineExecutionReporter.js";
@@ -86,7 +86,7 @@ export declare function createPostMessagesHandler(options: {
86
86
  budget_tokens: number;
87
87
  type: "enabled";
88
88
  } | undefined;
89
- tool_choice?: "none" | "any" | "auto" | {
89
+ tool_choice?: "any" | "none" | "auto" | {
90
90
  type: "auto";
91
91
  disable_parallel_tool_use?: boolean | undefined;
92
92
  } | {
@@ -27,6 +27,7 @@ interface MonitorEngineResponseOptions extends EngineMetricsLoggerOptions {
27
27
  engineType: string;
28
28
  onComplete?: (result: EngineMetricsCompletion) => void | Promise<void>;
29
29
  requestStartedAt?: number;
30
+ responseModelName?: string | null;
30
31
  }
31
32
  interface EngineMetricsLogOptions extends EngineMetricsLoggerOptions {
32
33
  error?: Error;
@@ -37,7 +38,7 @@ interface EngineMetricsLogOptions extends EngineMetricsLoggerOptions {
37
38
  interface MonitorEngineResponseResult {
38
39
  stream: Readable;
39
40
  }
40
- export declare function monitorEngineResponseStream({ agentEngineType, body, contextLength, engineConfig, engineType, logger, onComplete, requestBodyBytes, requestPath, requestStartedAt }: MonitorEngineResponseOptions): MonitorEngineResponseResult;
41
- export declare function monitorEngineResponseSingle({ agentEngineType, body, contextLength, engineConfig, engineType, logger, onComplete, requestBodyBytes, requestPath, requestStartedAt }: MonitorEngineResponseOptions): MonitorEngineResponseResult;
41
+ export declare function monitorEngineResponseStream({ agentEngineType, body, contextLength, engineConfig, engineType, logger, onComplete, requestBodyBytes, requestPath, requestStartedAt, responseModelName }: MonitorEngineResponseOptions): MonitorEngineResponseResult;
42
+ export declare function monitorEngineResponseSingle({ agentEngineType, body, contextLength, engineConfig, engineType, logger, onComplete, requestBodyBytes, requestPath, requestStartedAt, responseModelName }: MonitorEngineResponseOptions): MonitorEngineResponseResult;
42
43
  export declare function logEngineMetrics({ agentEngineType, error, level, logger, requestBodyBytes, requestPath, responseBytes, usage }: EngineMetricsLogOptions): void;
43
44
  export {};
@@ -19,6 +19,14 @@ export declare function applyChatTemplateKwargs({ body, model }: {
19
19
  body: PlainObject;
20
20
  model: LLMModel;
21
21
  }): PlainObject;
22
+ export declare function serializeRequestBody(body: unknown, { model, path, servedModelName }?: {
23
+ model?: LLMModel;
24
+ path?: string;
25
+ servedModelName?: string | null;
26
+ }): {
27
+ bytes: number;
28
+ payload: string;
29
+ };
22
30
  export declare function proxyEmbeddingsRoute({ body, conduitConfiguration, endpointId, logger, modelID, modelManager, reportMetrics, signal }: {
23
31
  body: unknown;
24
32
  conduitConfiguration: InferenceAgentConfiguration;
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.112.1",
4
+ "version": "1.114.0",
5
5
  "bin": {
6
6
  "infersec-conduit": "./dist/cli.js"
7
7
  },