@infersec/conduit 1.46.1 → 1.48.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 +30 -22
- package/dist/state/ConduitStateManager.d.ts +3 -0
- package/package.json +3 -1
package/dist/cli.js
CHANGED
|
@@ -18502,22 +18502,6 @@ const ULIDSchema = string$1().refine(isValid, { message: "Invalid ULID" });
|
|
|
18502
18502
|
//
|
|
18503
18503
|
// irid://SERVICE/ACCOUNT_ID/RESOURCE_ID::RESOURCE_SUB_SPECIFIER
|
|
18504
18504
|
const IRID_MAX_LENGTH = 2048;
|
|
18505
|
-
// export const IRIDSchema = z.custom<`irid://${string}/${string}/${string}:${string}`>((irid) => {
|
|
18506
|
-
// if (typeof irid !== "string") return false;
|
|
18507
|
-
// if (!/^irid:\/\//.test(irid)) return false;
|
|
18508
|
-
// const prefixStripped = irid.replace(/^irid:\/\//, "");
|
|
18509
|
-
// if (irid.length > IRID_MAX_LENGTH) {
|
|
18510
|
-
// return false;
|
|
18511
|
-
// }
|
|
18512
|
-
// if (!/:[a-z0-9:.-]+$/.test(prefixStripped)) return false;
|
|
18513
|
-
// const [components] = prefixStripped.split(":");
|
|
18514
|
-
// const [service, accountID, resourceID] = components.split("/");
|
|
18515
|
-
// if (!/^[a-z0-9-]+$/.test(service)) return false;
|
|
18516
|
-
// if (!isValid(accountID)) return false;
|
|
18517
|
-
// if (!/^[a-z0-9-]+$/.test(resourceID)) return false;
|
|
18518
|
-
// return true;
|
|
18519
|
-
// }, "Invalid IRID value");
|
|
18520
|
-
// export const IRIDSchema = z.string().brand<`irid://${string}/${string}/${string}:${string}`>();
|
|
18521
18505
|
const IRIDSchema = string$1()
|
|
18522
18506
|
.refine(irid => /^irid:\/\//.test(irid), { message: "Bad IRID prefix" })
|
|
18523
18507
|
.refine(irid => irid.length <= IRID_MAX_LENGTH, {
|
|
@@ -18965,6 +18949,7 @@ const ConduitStateSchema = z
|
|
|
18965
18949
|
})
|
|
18966
18950
|
])
|
|
18967
18951
|
.and(z.object({
|
|
18952
|
+
activeRequestCount: z.number().int().nonnegative().optional(),
|
|
18968
18953
|
timestamp: z.iso.datetime()
|
|
18969
18954
|
}));
|
|
18970
18955
|
const ConduitState = z.preprocess(value => {
|
|
@@ -19666,6 +19651,17 @@ const API_CLIENT_CONDUIT_OPENAI_REFERENCE = {
|
|
|
19666
19651
|
}
|
|
19667
19652
|
});
|
|
19668
19653
|
|
|
19654
|
+
var RoutingMethod;
|
|
19655
|
+
(function (RoutingMethod) {
|
|
19656
|
+
RoutingMethod["FirstAvailable"] = "first-available";
|
|
19657
|
+
RoutingMethod["RoundRobin"] = "round-robin";
|
|
19658
|
+
})(RoutingMethod || (RoutingMethod = {}));
|
|
19659
|
+
RoutingMethod.FirstAvailable;
|
|
19660
|
+
({
|
|
19661
|
+
[RoutingMethod.FirstAvailable]: "First Available",
|
|
19662
|
+
[RoutingMethod.RoundRobin]: "Round Robin"
|
|
19663
|
+
});
|
|
19664
|
+
|
|
19669
19665
|
object({
|
|
19670
19666
|
accountID: ULIDSchema.optional(),
|
|
19671
19667
|
email: string$1().email(),
|
|
@@ -19741,7 +19737,7 @@ custom((perm) => {
|
|
|
19741
19737
|
});
|
|
19742
19738
|
// #endregion
|
|
19743
19739
|
|
|
19744
|
-
// @ts-
|
|
19740
|
+
// @ts-expect-error Cannot find name "window" in VSCode
|
|
19745
19741
|
const isBrowser = typeof window !== "undefined";
|
|
19746
19742
|
|
|
19747
19743
|
const APIRequestSchema = object({
|
|
@@ -114910,6 +114906,7 @@ class ConduitStateReportManager {
|
|
|
114910
114906
|
}
|
|
114911
114907
|
|
|
114912
114908
|
class ConduitStateManager {
|
|
114909
|
+
activeRequestCount = 0;
|
|
114913
114910
|
currentState;
|
|
114914
114911
|
constructor({ initialState }) {
|
|
114915
114912
|
this.currentState = {
|
|
@@ -114917,22 +114914,31 @@ class ConduitStateManager {
|
|
|
114917
114914
|
timestamp: new Date().toISOString()
|
|
114918
114915
|
};
|
|
114919
114916
|
}
|
|
114917
|
+
decrementActiveRequestCount() {
|
|
114918
|
+
this.activeRequestCount = Math.max(0, this.activeRequestCount - 1);
|
|
114919
|
+
}
|
|
114920
114920
|
getState() {
|
|
114921
|
-
return
|
|
114921
|
+
return {
|
|
114922
|
+
...this.currentState,
|
|
114923
|
+
activeRequestCount: this.activeRequestCount
|
|
114924
|
+
};
|
|
114925
|
+
}
|
|
114926
|
+
incrementActiveRequestCount() {
|
|
114927
|
+
this.activeRequestCount += 1;
|
|
114922
114928
|
}
|
|
114923
114929
|
setState(state) {
|
|
114924
114930
|
this.currentState = {
|
|
114925
114931
|
...state,
|
|
114926
114932
|
timestamp: new Date().toISOString()
|
|
114927
114933
|
};
|
|
114928
|
-
return this.
|
|
114934
|
+
return this.getState();
|
|
114929
114935
|
}
|
|
114930
114936
|
touch() {
|
|
114931
114937
|
this.currentState = {
|
|
114932
114938
|
...this.currentState,
|
|
114933
114939
|
timestamp: new Date().toISOString()
|
|
114934
114940
|
};
|
|
114935
|
-
return this.
|
|
114941
|
+
return this.getState();
|
|
114936
114942
|
}
|
|
114937
114943
|
}
|
|
114938
114944
|
|
|
@@ -124708,10 +124714,12 @@ async function createApplication({ abortController, apiClient, configuration, lo
|
|
|
124708
124714
|
});
|
|
124709
124715
|
},
|
|
124710
124716
|
onRequestEnd: () => {
|
|
124711
|
-
|
|
124717
|
+
conduitStateManager.decrementActiveRequestCount();
|
|
124718
|
+
conduitStateReportManager.reportStateChange();
|
|
124712
124719
|
},
|
|
124713
124720
|
onRequestStart: () => {
|
|
124714
|
-
|
|
124721
|
+
conduitStateManager.incrementActiveRequestCount();
|
|
124722
|
+
conduitStateReportManager.reportStateChange();
|
|
124715
124723
|
},
|
|
124716
124724
|
reportMetrics: apiClient.reportPromptMetrics,
|
|
124717
124725
|
signal: abortController.signal
|
|
@@ -3,11 +3,14 @@ type ConduitStateInput = Record<string, unknown> & {
|
|
|
3
3
|
state: ConduitState["state"];
|
|
4
4
|
};
|
|
5
5
|
export declare class ConduitStateManager {
|
|
6
|
+
private activeRequestCount;
|
|
6
7
|
private currentState;
|
|
7
8
|
constructor({ initialState }: {
|
|
8
9
|
initialState: ConduitStateInput;
|
|
9
10
|
});
|
|
11
|
+
decrementActiveRequestCount(): void;
|
|
10
12
|
getState(): ConduitState;
|
|
13
|
+
incrementActiveRequestCount(): void;
|
|
11
14
|
setState(state: ConduitStateInput): ConduitState;
|
|
12
15
|
touch(): ConduitState;
|
|
13
16
|
}
|
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.
|
|
4
|
+
"version": "1.48.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"infersec-conduit": "./dist/cli.js"
|
|
7
7
|
},
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"format": "prettier --write .",
|
|
23
23
|
"prepublishOnly": "npm run build",
|
|
24
24
|
"start": "npm run build && node ./dist/cli.js inference start",
|
|
25
|
+
"start-2": "npm run build && node ./dist/cli.js inference start --source 01k1p3rgt1wdq8k43rev1dg4mh --port 9506",
|
|
26
|
+
"start-3": "npm run build && node ./dist/cli.js inference start --source 01k1p3rgt1wdq8k43rev1dg4mj --port 9507",
|
|
25
27
|
"test": "npm run test:types && npm run test:lint && npm run test:format && npm run test:unit",
|
|
26
28
|
"test:format": "prettier --check .",
|
|
27
29
|
"test:lint": "eslint source/**/*.ts",
|