@thyn-ai/sqai 0.1.7 → 0.1.8
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/index.cjs +9 -11
- package/dist/index.d.cts +5 -7
- package/dist/index.d.ts +5 -7
- package/dist/index.js +9 -11
- package/dist/unsafe.cjs +1 -1
- package/dist/unsafe.d.cts +1 -1
- package/dist/unsafe.d.ts +1 -1
- package/dist/unsafe.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -194,20 +194,18 @@ var DEFAULT_BUILD_SERVICE_URL = "https://sqai-buildservice.fly.dev";
|
|
|
194
194
|
function readEnv(env = process.env) {
|
|
195
195
|
const apiKey = (env.SQAI_API_KEY ?? "").trim() || void 0;
|
|
196
196
|
const deploymentUrl = (env.SQAI_DEPLOYMENT_URL ?? "").trim() || void 0;
|
|
197
|
-
const legacyEngineUrl = (env.SQAI_ENGINE_URL ?? "").trim() || void 0;
|
|
198
|
-
const engineUrl = deploymentUrl ?? legacyEngineUrl;
|
|
199
197
|
const autoInstall = (env.SQAI_RUNTIME_AUTO_INSTALL ?? "").trim() !== "0";
|
|
200
198
|
const modulesRaw = (env.SQAI_RUNTIME_MODULES ?? "").split(",").map((m) => m.trim()).filter((m) => m.length > 0);
|
|
201
199
|
const runtimeModules = modulesRaw.length > 0 ? modulesRaw : void 0;
|
|
202
200
|
const buildServiceUrl = (env.SQAI_BUILD_SERVICE_URL ?? "").trim() || DEFAULT_BUILD_SERVICE_URL;
|
|
203
|
-
return { apiKey,
|
|
201
|
+
return { apiKey, deploymentUrl, autoInstall, runtimeModules, buildServiceUrl };
|
|
204
202
|
}
|
|
205
203
|
function inferMode(explicit, resolved) {
|
|
206
204
|
if (explicit) {
|
|
207
205
|
return explicit;
|
|
208
206
|
}
|
|
209
|
-
if (resolved.
|
|
210
|
-
return "
|
|
207
|
+
if (resolved.deploymentUrl) {
|
|
208
|
+
return "deployment";
|
|
211
209
|
}
|
|
212
210
|
return "local";
|
|
213
211
|
}
|
|
@@ -1975,7 +1973,7 @@ var SQAI = class {
|
|
|
1975
1973
|
rawRuntime;
|
|
1976
1974
|
policy;
|
|
1977
1975
|
tenantId;
|
|
1978
|
-
|
|
1976
|
+
deploymentUrl;
|
|
1979
1977
|
apiKey;
|
|
1980
1978
|
contractIndex;
|
|
1981
1979
|
resultStore;
|
|
@@ -1987,7 +1985,7 @@ var SQAI = class {
|
|
|
1987
1985
|
const env = readEnv();
|
|
1988
1986
|
this.mode = inferMode(config.mode, env);
|
|
1989
1987
|
this.apiKey = config.apiKey ?? env.apiKey;
|
|
1990
|
-
this.
|
|
1988
|
+
this.deploymentUrl = config.deploymentUrl ?? env.deploymentUrl;
|
|
1991
1989
|
this.tenantId = config.tenantId ?? null;
|
|
1992
1990
|
this.policy = config.policy;
|
|
1993
1991
|
this.configuredTarget = config.computeTarget;
|
|
@@ -2004,9 +2002,9 @@ var SQAI = class {
|
|
|
2004
2002
|
this.rawRuntime = config.runtime;
|
|
2005
2003
|
} else {
|
|
2006
2004
|
this.rawRuntime = new import_algenta_sdk3.Runtime({
|
|
2007
|
-
mode: this.mode === "
|
|
2005
|
+
mode: this.mode === "deployment" ? "self_hosted" : this.mode === "api" ? "api" : "local",
|
|
2008
2006
|
...this.apiKey ? { apiKey: this.apiKey } : {},
|
|
2009
|
-
...this.mode === "
|
|
2007
|
+
...this.mode === "deployment" && this.deploymentUrl ? { baseUrl: this.deploymentUrl } : {},
|
|
2010
2008
|
...config.enforceLimits !== void 0 ? { enforceLimits: config.enforceLimits } : {},
|
|
2011
2009
|
...config.timeout !== void 0 ? { timeout: config.timeout } : {},
|
|
2012
2010
|
...config.maxRetries !== void 0 ? { maxRetries: config.maxRetries } : {}
|
|
@@ -2292,8 +2290,8 @@ var SQAI = class {
|
|
|
2292
2290
|
if (this.configuredTarget) {
|
|
2293
2291
|
return this.configuredTarget;
|
|
2294
2292
|
}
|
|
2295
|
-
if (this.mode === "
|
|
2296
|
-
return { kind: "http", baseUrl: this.
|
|
2293
|
+
if (this.mode === "deployment" && this.deploymentUrl) {
|
|
2294
|
+
return { kind: "http", baseUrl: this.deploymentUrl, ...this.apiKey ? { apiKey: this.apiKey } : {} };
|
|
2297
2295
|
}
|
|
2298
2296
|
if (this.mode === "api") {
|
|
2299
2297
|
if (!this.apiKey) {
|
package/dist/index.d.cts
CHANGED
|
@@ -66,10 +66,10 @@ declare class ContractIndex {
|
|
|
66
66
|
/** SQAI_* environment mapping and zero-config mode inference.
|
|
67
67
|
*
|
|
68
68
|
* Inference order (explicit config always overrides):
|
|
69
|
-
* SQAI_DEPLOYMENT_URL
|
|
69
|
+
* SQAI_DEPLOYMENT_URL present -> "deployment"
|
|
70
70
|
* otherwise -> "local"
|
|
71
71
|
*/
|
|
72
|
-
type SqaiMode = "local" | "api" | "
|
|
72
|
+
type SqaiMode = "local" | "api" | "deployment";
|
|
73
73
|
|
|
74
74
|
/** Application policy: pre-execution validation the model can never override.
|
|
75
75
|
*
|
|
@@ -447,7 +447,7 @@ interface ResultStoreConfig {
|
|
|
447
447
|
/** Computation dispatch: delegate a validated computation to Algenta.
|
|
448
448
|
*
|
|
449
449
|
* Local mode → the managed runtime daemon via algenta-sdk's MojoRuntime.
|
|
450
|
-
*
|
|
450
|
+
* deployment / api mode → POST {baseUrl}/v1/libraries/execute.
|
|
451
451
|
* SQAI performs no calculation of its own in either path.
|
|
452
452
|
*/
|
|
453
453
|
|
|
@@ -474,10 +474,8 @@ type DispatchTarget = {
|
|
|
474
474
|
interface SqaiConfig {
|
|
475
475
|
mode?: SqaiMode;
|
|
476
476
|
apiKey?: string;
|
|
477
|
-
/** Public SQAI deployment URL.
|
|
477
|
+
/** Public SQAI deployment URL. */
|
|
478
478
|
deploymentUrl?: string;
|
|
479
|
-
/** @deprecated Use deploymentUrl. Kept for backward compatibility. */
|
|
480
|
-
engineUrl?: string;
|
|
481
479
|
tenantId?: string;
|
|
482
480
|
policy?: SqaiPolicy;
|
|
483
481
|
enforceLimits?: boolean;
|
|
@@ -507,7 +505,7 @@ declare class SQAI {
|
|
|
507
505
|
private readonly rawRuntime;
|
|
508
506
|
private readonly policy;
|
|
509
507
|
private readonly tenantId;
|
|
510
|
-
private readonly
|
|
508
|
+
private readonly deploymentUrl;
|
|
511
509
|
private readonly apiKey;
|
|
512
510
|
private readonly contractIndex;
|
|
513
511
|
private readonly resultStore;
|
package/dist/index.d.ts
CHANGED
|
@@ -66,10 +66,10 @@ declare class ContractIndex {
|
|
|
66
66
|
/** SQAI_* environment mapping and zero-config mode inference.
|
|
67
67
|
*
|
|
68
68
|
* Inference order (explicit config always overrides):
|
|
69
|
-
* SQAI_DEPLOYMENT_URL
|
|
69
|
+
* SQAI_DEPLOYMENT_URL present -> "deployment"
|
|
70
70
|
* otherwise -> "local"
|
|
71
71
|
*/
|
|
72
|
-
type SqaiMode = "local" | "api" | "
|
|
72
|
+
type SqaiMode = "local" | "api" | "deployment";
|
|
73
73
|
|
|
74
74
|
/** Application policy: pre-execution validation the model can never override.
|
|
75
75
|
*
|
|
@@ -447,7 +447,7 @@ interface ResultStoreConfig {
|
|
|
447
447
|
/** Computation dispatch: delegate a validated computation to Algenta.
|
|
448
448
|
*
|
|
449
449
|
* Local mode → the managed runtime daemon via algenta-sdk's MojoRuntime.
|
|
450
|
-
*
|
|
450
|
+
* deployment / api mode → POST {baseUrl}/v1/libraries/execute.
|
|
451
451
|
* SQAI performs no calculation of its own in either path.
|
|
452
452
|
*/
|
|
453
453
|
|
|
@@ -474,10 +474,8 @@ type DispatchTarget = {
|
|
|
474
474
|
interface SqaiConfig {
|
|
475
475
|
mode?: SqaiMode;
|
|
476
476
|
apiKey?: string;
|
|
477
|
-
/** Public SQAI deployment URL.
|
|
477
|
+
/** Public SQAI deployment URL. */
|
|
478
478
|
deploymentUrl?: string;
|
|
479
|
-
/** @deprecated Use deploymentUrl. Kept for backward compatibility. */
|
|
480
|
-
engineUrl?: string;
|
|
481
479
|
tenantId?: string;
|
|
482
480
|
policy?: SqaiPolicy;
|
|
483
481
|
enforceLimits?: boolean;
|
|
@@ -507,7 +505,7 @@ declare class SQAI {
|
|
|
507
505
|
private readonly rawRuntime;
|
|
508
506
|
private readonly policy;
|
|
509
507
|
private readonly tenantId;
|
|
510
|
-
private readonly
|
|
508
|
+
private readonly deploymentUrl;
|
|
511
509
|
private readonly apiKey;
|
|
512
510
|
private readonly contractIndex;
|
|
513
511
|
private readonly resultStore;
|
package/dist/index.js
CHANGED
|
@@ -138,20 +138,18 @@ var DEFAULT_BUILD_SERVICE_URL = "https://sqai-buildservice.fly.dev";
|
|
|
138
138
|
function readEnv(env = process.env) {
|
|
139
139
|
const apiKey = (env.SQAI_API_KEY ?? "").trim() || void 0;
|
|
140
140
|
const deploymentUrl = (env.SQAI_DEPLOYMENT_URL ?? "").trim() || void 0;
|
|
141
|
-
const legacyEngineUrl = (env.SQAI_ENGINE_URL ?? "").trim() || void 0;
|
|
142
|
-
const engineUrl = deploymentUrl ?? legacyEngineUrl;
|
|
143
141
|
const autoInstall = (env.SQAI_RUNTIME_AUTO_INSTALL ?? "").trim() !== "0";
|
|
144
142
|
const modulesRaw = (env.SQAI_RUNTIME_MODULES ?? "").split(",").map((m) => m.trim()).filter((m) => m.length > 0);
|
|
145
143
|
const runtimeModules = modulesRaw.length > 0 ? modulesRaw : void 0;
|
|
146
144
|
const buildServiceUrl = (env.SQAI_BUILD_SERVICE_URL ?? "").trim() || DEFAULT_BUILD_SERVICE_URL;
|
|
147
|
-
return { apiKey,
|
|
145
|
+
return { apiKey, deploymentUrl, autoInstall, runtimeModules, buildServiceUrl };
|
|
148
146
|
}
|
|
149
147
|
function inferMode(explicit, resolved) {
|
|
150
148
|
if (explicit) {
|
|
151
149
|
return explicit;
|
|
152
150
|
}
|
|
153
|
-
if (resolved.
|
|
154
|
-
return "
|
|
151
|
+
if (resolved.deploymentUrl) {
|
|
152
|
+
return "deployment";
|
|
155
153
|
}
|
|
156
154
|
return "local";
|
|
157
155
|
}
|
|
@@ -1919,7 +1917,7 @@ var SQAI = class {
|
|
|
1919
1917
|
rawRuntime;
|
|
1920
1918
|
policy;
|
|
1921
1919
|
tenantId;
|
|
1922
|
-
|
|
1920
|
+
deploymentUrl;
|
|
1923
1921
|
apiKey;
|
|
1924
1922
|
contractIndex;
|
|
1925
1923
|
resultStore;
|
|
@@ -1931,7 +1929,7 @@ var SQAI = class {
|
|
|
1931
1929
|
const env = readEnv();
|
|
1932
1930
|
this.mode = inferMode(config.mode, env);
|
|
1933
1931
|
this.apiKey = config.apiKey ?? env.apiKey;
|
|
1934
|
-
this.
|
|
1932
|
+
this.deploymentUrl = config.deploymentUrl ?? env.deploymentUrl;
|
|
1935
1933
|
this.tenantId = config.tenantId ?? null;
|
|
1936
1934
|
this.policy = config.policy;
|
|
1937
1935
|
this.configuredTarget = config.computeTarget;
|
|
@@ -1948,9 +1946,9 @@ var SQAI = class {
|
|
|
1948
1946
|
this.rawRuntime = config.runtime;
|
|
1949
1947
|
} else {
|
|
1950
1948
|
this.rawRuntime = new Runtime({
|
|
1951
|
-
mode: this.mode === "
|
|
1949
|
+
mode: this.mode === "deployment" ? "self_hosted" : this.mode === "api" ? "api" : "local",
|
|
1952
1950
|
...this.apiKey ? { apiKey: this.apiKey } : {},
|
|
1953
|
-
...this.mode === "
|
|
1951
|
+
...this.mode === "deployment" && this.deploymentUrl ? { baseUrl: this.deploymentUrl } : {},
|
|
1954
1952
|
...config.enforceLimits !== void 0 ? { enforceLimits: config.enforceLimits } : {},
|
|
1955
1953
|
...config.timeout !== void 0 ? { timeout: config.timeout } : {},
|
|
1956
1954
|
...config.maxRetries !== void 0 ? { maxRetries: config.maxRetries } : {}
|
|
@@ -2236,8 +2234,8 @@ var SQAI = class {
|
|
|
2236
2234
|
if (this.configuredTarget) {
|
|
2237
2235
|
return this.configuredTarget;
|
|
2238
2236
|
}
|
|
2239
|
-
if (this.mode === "
|
|
2240
|
-
return { kind: "http", baseUrl: this.
|
|
2237
|
+
if (this.mode === "deployment" && this.deploymentUrl) {
|
|
2238
|
+
return { kind: "http", baseUrl: this.deploymentUrl, ...this.apiKey ? { apiKey: this.apiKey } : {} };
|
|
2241
2239
|
}
|
|
2242
2240
|
if (this.mode === "api") {
|
|
2243
2241
|
if (!this.apiKey) {
|
package/dist/unsafe.cjs
CHANGED
|
@@ -27,7 +27,7 @@ module.exports = __toCommonJS(unsafe_exports);
|
|
|
27
27
|
var import_algenta_sdk = require("algenta-sdk");
|
|
28
28
|
function getUnsafeRuntime(options = {}) {
|
|
29
29
|
return new import_algenta_sdk.Runtime({
|
|
30
|
-
mode: options.mode ?? "local",
|
|
30
|
+
mode: options.mode === "deployment" ? "self_hosted" : options.mode ?? "local",
|
|
31
31
|
...options.apiKey ? { apiKey: options.apiKey } : {},
|
|
32
32
|
...options.baseUrl ? { baseUrl: options.baseUrl } : {}
|
|
33
33
|
});
|
package/dist/unsafe.d.cts
CHANGED
package/dist/unsafe.d.ts
CHANGED
package/dist/unsafe.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Runtime } from "algenta-sdk";
|
|
3
3
|
function getUnsafeRuntime(options = {}) {
|
|
4
4
|
return new Runtime({
|
|
5
|
-
mode: options.mode ?? "local",
|
|
5
|
+
mode: options.mode === "deployment" ? "self_hosted" : options.mode ?? "local",
|
|
6
6
|
...options.apiKey ? { apiKey: options.apiKey } : {},
|
|
7
7
|
...options.baseUrl ? { baseUrl: options.baseUrl } : {}
|
|
8
8
|
});
|
package/package.json
CHANGED