@infersec/conduit 1.28.1 → 1.29.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.
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-DtAR3bT0.js';
9
+ import { a as asError, s as startInferenceAgent } from './start-CyERvKjg.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-DtAR3bT0.js';
8
+ import { s as startInferenceAgent, a as asError } from './start-CyERvKjg.js';
9
9
  import 'argon2';
10
10
  import 'node:child_process';
11
11
  import 'node:stream';
@@ -0,0 +1,92 @@
1
+ import { type Logger } from "@infersec/logger";
2
+ import { ModelManager } from "../modelManagement/ModelManager.js";
3
+ import { ConduitStateManager } from "../state/ConduitStateManager.js";
4
+ interface CreateConduitGeneralAPIReferenceHandlersOptions {
5
+ cycleEngine: () => Promise<void>;
6
+ conduitStateManager: ConduitStateManager;
7
+ getModelManager: () => ModelManager;
8
+ logger: Logger;
9
+ setErrorState: ({ error }: {
10
+ error: string;
11
+ }) => void;
12
+ startEngine: () => Promise<void>;
13
+ stopEngine: ({ reason }: {
14
+ reason: string;
15
+ }) => Promise<void>;
16
+ stopRequestedByControl: () => boolean;
17
+ }
18
+ export declare function createConduitGeneralAPIReferenceHandlers({ cycleEngine, conduitStateManager, getModelManager, logger, setErrorState, startEngine, stopEngine, stopRequestedByControl }: CreateConduitGeneralAPIReferenceHandlersOptions): {
19
+ "/conduit/engine/start": {
20
+ POST: () => Promise<{
21
+ status: number;
22
+ statusText: string;
23
+ body?: undefined;
24
+ } | {
25
+ body: {
26
+ acknowledged: true;
27
+ };
28
+ status: number;
29
+ statusText?: undefined;
30
+ }>;
31
+ };
32
+ "/conduit/engine/stop": {
33
+ POST: () => Promise<{
34
+ status: number;
35
+ statusText: string;
36
+ body?: undefined;
37
+ } | {
38
+ body: {
39
+ acknowledged: true;
40
+ };
41
+ status: number;
42
+ statusText?: undefined;
43
+ }>;
44
+ };
45
+ "/conduit/engine/cycle": {
46
+ POST: () => Promise<{
47
+ status: number;
48
+ statusText: string;
49
+ body?: undefined;
50
+ } | {
51
+ body: {
52
+ acknowledged: true;
53
+ };
54
+ status: number;
55
+ statusText?: undefined;
56
+ }>;
57
+ };
58
+ };
59
+ export declare function createPostCycleEngineHandler(options: CreateConduitGeneralAPIReferenceHandlersOptions): () => Promise<{
60
+ status: number;
61
+ statusText: string;
62
+ body?: undefined;
63
+ } | {
64
+ body: {
65
+ acknowledged: true;
66
+ };
67
+ status: number;
68
+ statusText?: undefined;
69
+ }>;
70
+ export declare function createPostStartEngineHandler(options: CreateConduitGeneralAPIReferenceHandlersOptions): () => Promise<{
71
+ status: number;
72
+ statusText: string;
73
+ body?: undefined;
74
+ } | {
75
+ body: {
76
+ acknowledged: true;
77
+ };
78
+ status: number;
79
+ statusText?: undefined;
80
+ }>;
81
+ export declare function createPostStopEngineHandler(options: CreateConduitGeneralAPIReferenceHandlersOptions): () => Promise<{
82
+ status: number;
83
+ statusText: string;
84
+ body?: undefined;
85
+ } | {
86
+ body: {
87
+ acknowledged: true;
88
+ };
89
+ status: number;
90
+ statusText?: undefined;
91
+ }>;
92
+ export {};
@@ -0,0 +1,208 @@
1
+ import { API_CLIENT_CONDUIT_OPENAI_REFERENCE } from "@infersec/definitions";
2
+ import { implementAPIReference } from "@infersec/fetch";
3
+ import { Logger } from "@infersec/logger";
4
+ import { APIClient } from "../apiClient/index.js";
5
+ import { Configuration } from "../configuration.js";
6
+ import { ModelManager } from "../modelManagement/ModelManager.js";
7
+ type ConduitOpenAIAPIReferenceHandlers = Parameters<typeof implementAPIReference<typeof API_CLIENT_CONDUIT_OPENAI_REFERENCE>>[0]["api"];
8
+ export declare function createConduitOpenAIAPIReferenceHandlers({ apiClient, configuration, getModelID, getModelManager, logger, startup }: {
9
+ apiClient: APIClient;
10
+ configuration: Configuration;
11
+ getModelID: () => string;
12
+ getModelManager: () => ModelManager;
13
+ logger: Logger;
14
+ startup: number;
15
+ }): ConduitOpenAIAPIReferenceHandlers;
16
+ export declare function createGetModelsHandler(options: {
17
+ apiClient: APIClient;
18
+ configuration: Configuration;
19
+ getModelID: () => string;
20
+ getModelManager: () => ModelManager;
21
+ logger: Logger;
22
+ startup: number;
23
+ }): (params: {
24
+ req: import("@infersec/fetch").APIRequest;
25
+ res: import("@infersec/fetch").APIResponse;
26
+ parameters: Record<string, never>;
27
+ query: Record<string, never>;
28
+ body: never;
29
+ responseSchema: import("zod").ZodObject<{
30
+ object: import("zod").ZodLiteral<"list">;
31
+ data: import("zod").ZodArray<import("zod").ZodObject<{
32
+ id: import("zod").ZodString;
33
+ object: import("zod").ZodLiteral<"model">;
34
+ created: import("zod").ZodNumber;
35
+ owned_by: import("zod").ZodString;
36
+ limit: import("zod").ZodOptional<import("zod").ZodObject<{
37
+ context: import("zod").ZodNullable<import("zod").ZodNumber>;
38
+ }, import("zod/v4/core").$strip>>;
39
+ }, import("zod/v4/core").$strip>>;
40
+ }, import("zod/v4/core").$strip>;
41
+ }) => Promise<{
42
+ body: {
43
+ object: "list";
44
+ data: {
45
+ id: string;
46
+ object: "model";
47
+ created: number;
48
+ owned_by: string;
49
+ limit?: {
50
+ context: number | null;
51
+ } | undefined;
52
+ }[];
53
+ };
54
+ headers?: Record<string, string>;
55
+ status: number;
56
+ } | {
57
+ headers?: Record<string, string>;
58
+ status: number;
59
+ statusText: string;
60
+ }>;
61
+ export declare function createPostChatCompletionsHandler(options: {
62
+ apiClient: APIClient;
63
+ configuration: Configuration;
64
+ getModelID: () => string;
65
+ getModelManager: () => ModelManager;
66
+ logger: Logger;
67
+ startup: number;
68
+ }): (params: {
69
+ req: import("@infersec/fetch").APIRequest;
70
+ res: import("@infersec/fetch").APIResponse;
71
+ parameters: Record<string, never>;
72
+ query: Record<string, never>;
73
+ body: {
74
+ messages: ({
75
+ role: "system";
76
+ content: string;
77
+ name?: string | undefined;
78
+ } | {
79
+ role: "user";
80
+ content: string | ({
81
+ type: "text";
82
+ text: string;
83
+ } | {
84
+ type: "image_url";
85
+ image_url: {
86
+ url: string;
87
+ detail?: "auto" | "low" | "high" | undefined;
88
+ };
89
+ })[];
90
+ name?: string | undefined;
91
+ } | {
92
+ role: "assistant";
93
+ content?: string | null | undefined;
94
+ name?: string | undefined;
95
+ tool_calls?: {
96
+ id: string;
97
+ type: "function";
98
+ function: {
99
+ name: string;
100
+ arguments: string;
101
+ };
102
+ }[] | undefined;
103
+ function_call?: {
104
+ name: string;
105
+ arguments: string;
106
+ } | undefined;
107
+ refusal?: string | null | undefined;
108
+ } | {
109
+ role: "tool";
110
+ content: string;
111
+ tool_call_id: string;
112
+ } | {
113
+ role: "function";
114
+ content: string | null;
115
+ name: string;
116
+ })[];
117
+ model: string;
118
+ frequency_penalty?: number | null | undefined;
119
+ function_call?: "none" | "auto" | {
120
+ name: string;
121
+ } | undefined;
122
+ functions?: {
123
+ name: string;
124
+ description?: string | undefined;
125
+ parameters?: Record<string, any> | undefined;
126
+ }[] | undefined;
127
+ logit_bias?: Record<string, number> | null | undefined;
128
+ logprobs?: boolean | null | undefined;
129
+ top_logprobs?: number | null | undefined;
130
+ max_tokens?: number | null | undefined;
131
+ n?: number | null | undefined;
132
+ presence_penalty?: number | null | undefined;
133
+ response_format?: {
134
+ type: "text" | "json_object";
135
+ } | undefined;
136
+ seed?: number | null | undefined;
137
+ stop?: string | string[] | null | undefined;
138
+ stream?: boolean | null | undefined;
139
+ temperature?: number | null | undefined;
140
+ tool_choice?: "none" | "auto" | {
141
+ type: "function";
142
+ function: {
143
+ name: string;
144
+ };
145
+ } | undefined;
146
+ tools?: {
147
+ type: "function";
148
+ function: {
149
+ name: string;
150
+ description?: string | undefined;
151
+ parameters?: Record<string, any> | undefined;
152
+ };
153
+ }[] | undefined;
154
+ top_p?: number | null | undefined;
155
+ user?: string | undefined;
156
+ };
157
+ responseSchema: undefined;
158
+ }) => Promise<{
159
+ body: import("stream").Readable;
160
+ headers?: Record<string, string>;
161
+ status: number;
162
+ } | {
163
+ headers?: Record<string, string>;
164
+ status: number;
165
+ statusText: string;
166
+ }>;
167
+ export declare function createPostCompletionsHandler(options: {
168
+ apiClient: APIClient;
169
+ configuration: Configuration;
170
+ getModelID: () => string;
171
+ getModelManager: () => ModelManager;
172
+ logger: Logger;
173
+ startup: number;
174
+ }): (params: {
175
+ req: import("@infersec/fetch").APIRequest;
176
+ res: import("@infersec/fetch").APIResponse;
177
+ parameters: Record<string, never>;
178
+ query: Record<string, never>;
179
+ body: {
180
+ model: string;
181
+ prompt: string | number[] | string[] | number[][] | null;
182
+ best_of?: number | null | undefined;
183
+ echo?: boolean | null | undefined;
184
+ frequency_penalty?: number | null | undefined;
185
+ logit_bias?: Record<string, number> | null | undefined;
186
+ logprobs?: number | null | undefined;
187
+ max_tokens?: number | null | undefined;
188
+ n?: number | null | undefined;
189
+ presence_penalty?: number | null | undefined;
190
+ seed?: number | null | undefined;
191
+ stop?: string | string[] | null | undefined;
192
+ stream?: boolean | null | undefined;
193
+ suffix?: string | null | undefined;
194
+ temperature?: number | null | undefined;
195
+ top_p?: number | null | undefined;
196
+ user?: string | undefined;
197
+ };
198
+ responseSchema: undefined;
199
+ }) => Promise<{
200
+ body: import("stream").Readable;
201
+ headers?: Record<string, string>;
202
+ status: number;
203
+ } | {
204
+ headers?: Record<string, string>;
205
+ status: number;
206
+ statusText: string;
207
+ }>;
208
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Request, Response } from "express";
2
+ export declare function createHealthHandler(): (_req: Request, res: Response) => void;