@premai/api-sdk 1.0.47 → 1.0.49
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/README.md +57 -7
- package/dist/anthropic/from-openai.d.ts +8 -1
- package/dist/bare.cjs +20 -5
- package/dist/bare.mjs +20 -5
- package/dist/cli-claude.mjs +419 -3008
- package/dist/cli.mjs +2776 -2202
- package/dist/core.browser.cjs +26 -6
- package/dist/core.browser.mjs +20 -5
- package/dist/core.d.ts +2 -2
- package/dist/files/index.d.ts +3 -3
- package/dist/index.cjs +465 -36
- package/dist/index.mjs +477 -37
- package/dist/launcher/proxy-subprocess.d.ts +4 -2
- package/dist/server/create-app.d.ts +1 -0
- package/dist/server/create-drain-wrapper.d.ts +5 -0
- package/dist/server/discovery.d.ts +2 -0
- package/dist/server/request-debug.d.ts +2 -0
- package/dist/server/runtime.d.ts +2 -2
- package/dist/server/shutdown-route.d.ts +6 -0
- package/dist/server/start.d.ts +7 -4
- package/dist/server.d.ts +2 -0
- package/dist/tools/index.d.ts +1 -1
- package/dist/types.d.ts +17 -1
- package/dist/utils/crypto.d.ts +1 -1
- package/dist/utils/debug.d.ts +5 -0
- package/dist/utils/dek-store.d.ts +1 -1
- package/dist/utils/poll-ready.d.ts +2 -0
- package/dist/utils/state-file.d.ts +13 -0
- package/package.json +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import express from "express";
|
|
2
2
|
import type { RvencClient } from "../core";
|
|
3
3
|
import type { CreateServerAppOptions, ServerCompatMode } from "../types";
|
|
4
|
+
export declare function setDraining(value: boolean): void;
|
|
4
5
|
export type RvencServerDeps = {
|
|
5
6
|
getOrCreateClient: (apiKey: string) => Promise<RvencClient>;
|
|
6
7
|
};
|
package/dist/server/runtime.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import multer from "multer";
|
|
2
2
|
import { type RvencClient } from "../core";
|
|
3
3
|
import type { ServerOptions } from "../types";
|
|
4
|
-
export declare const DEFAULT_HOST
|
|
5
|
-
export declare const DEFAULT_PORT
|
|
4
|
+
export declare const DEFAULT_HOST = "127.0.0.1";
|
|
5
|
+
export declare const DEFAULT_PORT = 8787;
|
|
6
6
|
export declare const audioUpload: multer.Multer;
|
|
7
7
|
export declare function applyServerOptions(options: ServerOptions): void;
|
|
8
8
|
export declare function getOrCreateRvencClient(apiKey: string): Promise<RvencClient>;
|
package/dist/server/start.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type { ServerOptions } from "../types";
|
|
2
|
-
export declare function startServer(options?: ServerOptions
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { ProxyServerHandle, ServerOptions } from "../types";
|
|
2
|
+
export declare function startServer(options?: ServerOptions & {
|
|
3
|
+
daemon?: boolean;
|
|
4
|
+
stateFile?: string;
|
|
5
|
+
logFile?: string;
|
|
6
|
+
shutdownTimeoutMs?: number;
|
|
7
|
+
}): Promise<ProxyServerHandle>;
|
package/dist/server.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { createServerApp } from "./server/create-app";
|
|
|
2
2
|
export type { RvencServerDeps } from "./server/create-app";
|
|
3
3
|
export { DEFAULT_ANTHROPIC_ROUTE_PREFIX_BOTH, DEFAULT_OPENAI_ROUTE_PREFIX_BOTH, normalizeRoutePrefix, resolvePrefixesForCompat, } from "./server/route-prefix";
|
|
4
4
|
export { createServerApp };
|
|
5
|
+
export { createDrainingServer } from "./server/create-drain-wrapper";
|
|
5
6
|
export { startServer } from "./server/start";
|
|
7
|
+
export type { ProxyServerHandle } from "./types";
|
|
6
8
|
declare const _default: import("express").Application;
|
|
7
9
|
export default _default;
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AudioDiarizationDecrypted, AudioDiarizationParams, AudioGenerateFromTextParams, CreateFileParams, DataFileContentDecrypted, DEKStore, DecryptedFile, GenerateImageParams, GetDataFileContentParams, GetFileContentOCRParams, GetPDFContentParams, GetSpreadsheetContentParams, GetTextDocumentContentParams, GetTimeDecrypted, GetTimeParams, ImageDescribeAndCaptionFallbackParams, ImageDescribeAndCaptionParams, PDFContentDecrypted, PowerPointContentDecrypted, PowerPointParams, SearchRagParams, SpreadsheetContentDecrypted, TextDocumentContentDecrypted, TranscribeAudioDecrypted, TranscribeParams, TranscribeWithDiarizationDecrypted, VideoDescribeAndCaptionParams, WebScraperParams, WebSearchParams } from
|
|
1
|
+
import type { AudioDiarizationDecrypted, AudioDiarizationParams, AudioGenerateFromTextParams, CreateFileParams, DataFileContentDecrypted, DEKStore, DecryptedFile, GenerateImageParams, GetDataFileContentParams, GetFileContentOCRParams, GetPDFContentParams, GetSpreadsheetContentParams, GetTextDocumentContentParams, GetTimeDecrypted, GetTimeParams, ImageDescribeAndCaptionFallbackParams, ImageDescribeAndCaptionParams, PDFContentDecrypted, PowerPointContentDecrypted, PowerPointParams, SearchRagParams, SpreadsheetContentDecrypted, TextDocumentContentDecrypted, TranscribeAudioDecrypted, TranscribeParams, TranscribeWithDiarizationDecrypted, VideoDescribeAndCaptionParams, WebScraperParams, WebSearchParams } from "../types";
|
|
2
2
|
export interface ToolsClient {
|
|
3
3
|
generateImage: (params: GenerateImageParams) => Promise<DecryptedFile>;
|
|
4
4
|
audioGenerateFromText: (params: AudioGenerateFromTextParams) => Promise<DecryptedFile>;
|
package/dist/types.d.ts
CHANGED
|
@@ -341,7 +341,23 @@ export type ServerOptions = {
|
|
|
341
341
|
anthropicRoutePrefix?: string;
|
|
342
342
|
jsonBodyLimit?: string;
|
|
343
343
|
};
|
|
344
|
-
export type CreateServerAppOptions = Pick<ServerOptions, "compat" | "openaiRoutePrefix" | "anthropicRoutePrefix" | "jsonBodyLimit"
|
|
344
|
+
export type CreateServerAppOptions = Pick<ServerOptions, "compat" | "openaiRoutePrefix" | "anthropicRoutePrefix" | "jsonBodyLimit"> & {
|
|
345
|
+
shutdown?: {
|
|
346
|
+
token: string;
|
|
347
|
+
onShutdown: () => Promise<void>;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
export type ProxyServerHandle = {
|
|
351
|
+
port: number;
|
|
352
|
+
close: () => void;
|
|
353
|
+
shutdown: (timeoutMs?: number) => Promise<void>;
|
|
354
|
+
};
|
|
355
|
+
export type DaemonOptions = {
|
|
356
|
+
daemon?: boolean;
|
|
357
|
+
stateFile?: string;
|
|
358
|
+
logFile?: string;
|
|
359
|
+
shutdownTimeoutMs?: number;
|
|
360
|
+
};
|
|
345
361
|
export interface ListModelsParams {
|
|
346
362
|
type?: string;
|
|
347
363
|
}
|
package/dist/utils/crypto.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EncryptionKeys } from
|
|
1
|
+
import type { EncryptionKeys } from "../types";
|
|
2
2
|
export declare function createMLKEMEncapsulation(publicKeyHex: string): EncryptionKeys;
|
|
3
3
|
export declare function encryptPayload(sharedSecret: Uint8Array, data: Uint8Array | string | object): {
|
|
4
4
|
encrypted: Uint8Array;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DEKStore } from
|
|
1
|
+
import type { DEKStore } from "../types";
|
|
2
2
|
export declare function initializeDEKStore(clientKEK?: string): DEKStore;
|
|
3
3
|
export declare function serializeDEKStore(store: DEKStore): string;
|
|
4
4
|
export declare function deserializeDEKStore(serialized: string): DEKStore;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function defaultStateFile(): string;
|
|
2
|
+
export type DaemonState = {
|
|
3
|
+
pid: number;
|
|
4
|
+
host: string;
|
|
5
|
+
port: number;
|
|
6
|
+
token: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function writeStateFile(path: string, state: DaemonState): void;
|
|
9
|
+
export declare function readStateFile(path: string): DaemonState | null;
|
|
10
|
+
export declare function removeStateFile(path: string): void;
|
|
11
|
+
export declare function generateShutdownToken(): string;
|
|
12
|
+
export declare function isProcessAlive(pid: number): boolean;
|
|
13
|
+
export declare function acquireDaemonLock(stateFile: string): () => void;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
},
|
|
5
5
|
"homepage": "https://github.com/premai-io/api-sdk-ts",
|
|
6
6
|
"name": "@premai/api-sdk",
|
|
7
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.49",
|
|
8
8
|
"main": "./dist/index.cjs",
|
|
9
9
|
"bin": {
|
|
10
10
|
"confidential-proxy": "./dist/cli.mjs",
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
"openai": "^6.9.1",
|
|
90
90
|
"react": "^19.2.6",
|
|
91
91
|
"typescript": "^5.9.3",
|
|
92
|
+
"winston": "^3.19.0",
|
|
92
93
|
"zod": "^4.2.1"
|
|
93
94
|
},
|
|
94
95
|
"devDependencies": {
|