@premai/api-sdk 1.0.46 → 1.0.48

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.
@@ -1,4 +1,6 @@
1
1
  import type { Application } from "express";
2
+ export declare const SERVER_MESSAGE = "Rvenc API Server";
3
+ export declare const SERVER_VERSION: any;
2
4
  export declare function registerApiDiscoveryRoute(app: Application, mount: {
3
5
  openai: boolean;
4
6
  anthropic: boolean;
@@ -0,0 +1,2 @@
1
+ import type { NextFunction, Request, Response } from "express";
2
+ export declare function requestDebugMiddleware(req: Request, res: Response, next: NextFunction): void;
@@ -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: string;
5
- export declare const DEFAULT_PORT: number;
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>;
@@ -0,0 +1,6 @@
1
+ import type { Express } from "express";
2
+ export type ShutdownHooks = {
3
+ token: string;
4
+ onShutdown: () => Promise<void>;
5
+ };
6
+ export declare function registerShutdownRoute(app: Express, hooks: ShutdownHooks): void;
@@ -1,4 +1,7 @@
1
- import type { ServerOptions } from "../types";
2
- export declare function startServer(options?: ServerOptions): Promise<{
3
- close: () => void;
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;
@@ -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 '../types';
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
  }
@@ -1,4 +1,4 @@
1
- import type { EncryptionKeys } from '../types';
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;
@@ -0,0 +1,5 @@
1
+ import winston from "winston";
2
+ declare const defaultLogFile: string;
3
+ export declare const logger: winston.Logger;
4
+ export declare function setLogLevel(level: string): void;
5
+ export { defaultLogFile as debugLogFile };
@@ -1,4 +1,4 @@
1
- import type { DEKStore } from '../types';
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,2 @@
1
+ export declare function isProxyRoot(baseUrl: string): Promise<boolean>;
2
+ export declare function pollForReadiness(baseUrl: string, timeoutMs?: number): Promise<void>;
@@ -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.46",
7
+ "version": "1.0.48",
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": {