@premai/api-sdk 1.0.49 → 1.0.51
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-claude.mjs +3 -7
- package/dist/cli.mjs +6 -8
- package/dist/index.cjs +15 -17
- package/dist/index.mjs +5 -7
- package/dist/server/discovery.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli-claude.mjs
CHANGED
|
@@ -271,12 +271,8 @@ var logger = winston.createLogger({
|
|
|
271
271
|
level,
|
|
272
272
|
transports: [fileTransport, consoleTransport]
|
|
273
273
|
});
|
|
274
|
-
|
|
275
274
|
// src/server/discovery.ts
|
|
276
|
-
import { readFileSync } from "node:fs";
|
|
277
|
-
var pkg = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
|
|
278
275
|
var SERVER_MESSAGE = "Rvenc API Server";
|
|
279
|
-
var SERVER_VERSION = pkg.version;
|
|
280
276
|
|
|
281
277
|
// src/utils/poll-ready.ts
|
|
282
278
|
async function isProxyRoot(baseUrl) {
|
|
@@ -308,7 +304,7 @@ async function pollForReadiness(baseUrl, timeoutMs = 30000) {
|
|
|
308
304
|
import {
|
|
309
305
|
existsSync as existsSync2,
|
|
310
306
|
mkdirSync as mkdirSync2,
|
|
311
|
-
readFileSync
|
|
307
|
+
readFileSync,
|
|
312
308
|
unlinkSync,
|
|
313
309
|
writeFileSync
|
|
314
310
|
} from "node:fs";
|
|
@@ -320,7 +316,7 @@ function defaultStateFile() {
|
|
|
320
316
|
}
|
|
321
317
|
function readStateFile(path) {
|
|
322
318
|
try {
|
|
323
|
-
const raw =
|
|
319
|
+
const raw = readFileSync(path, "utf-8");
|
|
324
320
|
const parsed = JSON.parse(raw);
|
|
325
321
|
if (typeof parsed.pid !== "number" || typeof parsed.host !== "string" || typeof parsed.port !== "number" || typeof parsed.token !== "string") {
|
|
326
322
|
return null;
|
|
@@ -350,7 +346,7 @@ function isProcessAlive(pid) {
|
|
|
350
346
|
|
|
351
347
|
// src/launcher/proxy-subprocess.ts
|
|
352
348
|
function resolveCliScript() {
|
|
353
|
-
return new URL(import.meta.resolve("../cli")).pathname;
|
|
349
|
+
return new URL(import.meta.resolve(import.meta.url.endsWith(".ts") ? "../cli" : "./cli")).pathname;
|
|
354
350
|
}
|
|
355
351
|
async function postShutdown(host, port, token, timeoutMs = 5000) {
|
|
356
352
|
try {
|
package/dist/cli.mjs
CHANGED
|
@@ -2740,9 +2740,8 @@ function setLogLevel(level2) {
|
|
|
2740
2740
|
t.level = level2;
|
|
2741
2741
|
});
|
|
2742
2742
|
}
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
import { readFileSync } from "node:fs";
|
|
2743
|
+
// package.json
|
|
2744
|
+
var version = "1.0.50";
|
|
2746
2745
|
|
|
2747
2746
|
// src/server/route-prefix.ts
|
|
2748
2747
|
function normalizeRoutePrefix(raw) {
|
|
@@ -2778,9 +2777,8 @@ function prefixedRoute(prefix, path) {
|
|
|
2778
2777
|
}
|
|
2779
2778
|
|
|
2780
2779
|
// src/server/discovery.ts
|
|
2781
|
-
var pkg = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
|
|
2782
2780
|
var SERVER_MESSAGE = "Rvenc API Server";
|
|
2783
|
-
var SERVER_VERSION =
|
|
2781
|
+
var SERVER_VERSION = version;
|
|
2784
2782
|
function registerApiDiscoveryRoute(app, mount) {
|
|
2785
2783
|
const {
|
|
2786
2784
|
openai: mountOpenAI,
|
|
@@ -3140,7 +3138,7 @@ async function pollForReadiness(baseUrl, timeoutMs = 30000) {
|
|
|
3140
3138
|
import {
|
|
3141
3139
|
existsSync as existsSync2,
|
|
3142
3140
|
mkdirSync as mkdirSync2,
|
|
3143
|
-
readFileSync
|
|
3141
|
+
readFileSync,
|
|
3144
3142
|
unlinkSync,
|
|
3145
3143
|
writeFileSync
|
|
3146
3144
|
} from "node:fs";
|
|
@@ -3159,7 +3157,7 @@ function writeStateFile(path, state) {
|
|
|
3159
3157
|
}
|
|
3160
3158
|
function readStateFile(path) {
|
|
3161
3159
|
try {
|
|
3162
|
-
const raw =
|
|
3160
|
+
const raw = readFileSync(path, "utf-8");
|
|
3163
3161
|
const parsed = JSON.parse(raw);
|
|
3164
3162
|
if (typeof parsed.pid !== "number" || typeof parsed.host !== "string" || typeof parsed.port !== "number" || typeof parsed.token !== "string") {
|
|
3165
3163
|
return null;
|
|
@@ -3194,7 +3192,7 @@ function acquireDaemonLock(stateFile) {
|
|
|
3194
3192
|
} catch (err) {
|
|
3195
3193
|
if (err.code !== "EEXIST")
|
|
3196
3194
|
throw err;
|
|
3197
|
-
const lockPid = parseInt(
|
|
3195
|
+
const lockPid = parseInt(readFileSync(lockFile, "utf-8").trim(), 10);
|
|
3198
3196
|
if (Number.isFinite(lockPid) && lockPid > 0 && isProcessAlive(lockPid)) {
|
|
3199
3197
|
throw new Error(`Daemon lock is held by PID ${lockPid}. Another instance may already be running.`);
|
|
3200
3198
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -2846,9 +2846,8 @@ var logger = import_winston.default.createLogger({
|
|
|
2846
2846
|
level,
|
|
2847
2847
|
transports: [fileTransport, consoleTransport]
|
|
2848
2848
|
});
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
var import_node_fs2 = require("node:fs");
|
|
2849
|
+
// package.json
|
|
2850
|
+
var version = "1.0.50";
|
|
2852
2851
|
|
|
2853
2852
|
// src/server/route-prefix.ts
|
|
2854
2853
|
function normalizeRoutePrefix(raw) {
|
|
@@ -2884,9 +2883,8 @@ function prefixedRoute(prefix, path) {
|
|
|
2884
2883
|
}
|
|
2885
2884
|
|
|
2886
2885
|
// src/server/discovery.ts
|
|
2887
|
-
var pkg = JSON.parse(import_node_fs2.readFileSync(new URL("../../package.json", "file:///home/runner/_work/api-sdk-ts/api-sdk-ts/src/server/discovery.ts"), "utf8"));
|
|
2888
2886
|
var SERVER_MESSAGE = "Rvenc API Server";
|
|
2889
|
-
var SERVER_VERSION =
|
|
2887
|
+
var SERVER_VERSION = version;
|
|
2890
2888
|
function registerApiDiscoveryRoute(app, mount) {
|
|
2891
2889
|
const {
|
|
2892
2890
|
openai: mountOpenAI,
|
|
@@ -3243,7 +3241,7 @@ async function pollForReadiness(baseUrl, timeoutMs = 30000) {
|
|
|
3243
3241
|
}
|
|
3244
3242
|
|
|
3245
3243
|
// src/utils/state-file.ts
|
|
3246
|
-
var
|
|
3244
|
+
var import_node_fs2 = require("node:fs");
|
|
3247
3245
|
var import_node_path2 = require("node:path");
|
|
3248
3246
|
var import_utils8 = require("@noble/ciphers/utils.js");
|
|
3249
3247
|
var import_env_paths2 = __toESM(require("env-paths"));
|
|
@@ -3253,14 +3251,14 @@ function defaultStateFile() {
|
|
|
3253
3251
|
}
|
|
3254
3252
|
function writeStateFile(path, state) {
|
|
3255
3253
|
const dir2 = import_node_path2.dirname(path);
|
|
3256
|
-
if (!
|
|
3257
|
-
|
|
3258
|
-
|
|
3254
|
+
if (!import_node_fs2.existsSync(dir2))
|
|
3255
|
+
import_node_fs2.mkdirSync(dir2, { recursive: true });
|
|
3256
|
+
import_node_fs2.writeFileSync(path, JSON.stringify(state), { mode: 384 });
|
|
3259
3257
|
}
|
|
3260
3258
|
function removeStateFile(path) {
|
|
3261
3259
|
try {
|
|
3262
|
-
if (
|
|
3263
|
-
|
|
3260
|
+
if (import_node_fs2.existsSync(path))
|
|
3261
|
+
import_node_fs2.unlinkSync(path);
|
|
3264
3262
|
} catch {}
|
|
3265
3263
|
}
|
|
3266
3264
|
function generateShutdownToken() {
|
|
@@ -3276,22 +3274,22 @@ function isProcessAlive(pid) {
|
|
|
3276
3274
|
}
|
|
3277
3275
|
function acquireDaemonLock(stateFile) {
|
|
3278
3276
|
const lockFile = `${stateFile}.lock`;
|
|
3279
|
-
|
|
3277
|
+
import_node_fs2.mkdirSync(import_node_path2.dirname(lockFile), { recursive: true });
|
|
3280
3278
|
try {
|
|
3281
|
-
|
|
3279
|
+
import_node_fs2.writeFileSync(lockFile, String(process.pid), { flag: "wx" });
|
|
3282
3280
|
} catch (err) {
|
|
3283
3281
|
if (err.code !== "EEXIST")
|
|
3284
3282
|
throw err;
|
|
3285
|
-
const lockPid = parseInt(
|
|
3283
|
+
const lockPid = parseInt(import_node_fs2.readFileSync(lockFile, "utf-8").trim(), 10);
|
|
3286
3284
|
if (Number.isFinite(lockPid) && lockPid > 0 && isProcessAlive(lockPid)) {
|
|
3287
3285
|
throw new Error(`Daemon lock is held by PID ${lockPid}. Another instance may already be running.`);
|
|
3288
3286
|
}
|
|
3289
|
-
|
|
3290
|
-
|
|
3287
|
+
import_node_fs2.unlinkSync(lockFile);
|
|
3288
|
+
import_node_fs2.writeFileSync(lockFile, String(process.pid), { flag: "wx" });
|
|
3291
3289
|
}
|
|
3292
3290
|
return () => {
|
|
3293
3291
|
try {
|
|
3294
|
-
|
|
3292
|
+
import_node_fs2.unlinkSync(lockFile);
|
|
3295
3293
|
} catch {}
|
|
3296
3294
|
};
|
|
3297
3295
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2766,9 +2766,8 @@ var logger = winston.createLogger({
|
|
|
2766
2766
|
level,
|
|
2767
2767
|
transports: [fileTransport, consoleTransport]
|
|
2768
2768
|
});
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
import { readFileSync } from "node:fs";
|
|
2769
|
+
// package.json
|
|
2770
|
+
var version = "1.0.50";
|
|
2772
2771
|
|
|
2773
2772
|
// src/server/route-prefix.ts
|
|
2774
2773
|
function normalizeRoutePrefix(raw) {
|
|
@@ -2804,9 +2803,8 @@ function prefixedRoute(prefix, path) {
|
|
|
2804
2803
|
}
|
|
2805
2804
|
|
|
2806
2805
|
// src/server/discovery.ts
|
|
2807
|
-
var pkg = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
|
|
2808
2806
|
var SERVER_MESSAGE = "Rvenc API Server";
|
|
2809
|
-
var SERVER_VERSION =
|
|
2807
|
+
var SERVER_VERSION = version;
|
|
2810
2808
|
function registerApiDiscoveryRoute(app, mount) {
|
|
2811
2809
|
const {
|
|
2812
2810
|
openai: mountOpenAI,
|
|
@@ -3166,7 +3164,7 @@ async function pollForReadiness(baseUrl, timeoutMs = 30000) {
|
|
|
3166
3164
|
import {
|
|
3167
3165
|
existsSync as existsSync2,
|
|
3168
3166
|
mkdirSync as mkdirSync2,
|
|
3169
|
-
readFileSync
|
|
3167
|
+
readFileSync,
|
|
3170
3168
|
unlinkSync,
|
|
3171
3169
|
writeFileSync
|
|
3172
3170
|
} from "node:fs";
|
|
@@ -3208,7 +3206,7 @@ function acquireDaemonLock(stateFile) {
|
|
|
3208
3206
|
} catch (err) {
|
|
3209
3207
|
if (err.code !== "EEXIST")
|
|
3210
3208
|
throw err;
|
|
3211
|
-
const lockPid = parseInt(
|
|
3209
|
+
const lockPid = parseInt(readFileSync(lockFile, "utf-8").trim(), 10);
|
|
3212
3210
|
if (Number.isFinite(lockPid) && lockPid > 0 && isProcessAlive(lockPid)) {
|
|
3213
3211
|
throw new Error(`Daemon lock is held by PID ${lockPid}. Another instance may already be running.`);
|
|
3214
3212
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Application } from "express";
|
|
2
2
|
export declare const SERVER_MESSAGE = "Rvenc API Server";
|
|
3
|
-
export declare const SERVER_VERSION:
|
|
3
|
+
export declare const SERVER_VERSION: string;
|
|
4
4
|
export declare function registerApiDiscoveryRoute(app: Application, mount: {
|
|
5
5
|
openai: boolean;
|
|
6
6
|
anthropic: boolean;
|