@thyn-ai/sqai 0.1.4 → 0.1.6
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/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +13 -0
- package/dist/index.cjs +426 -82
- package/dist/index.d.cts +122 -21
- package/dist/index.d.ts +122 -21
- package/dist/index.js +384 -57
- package/dist/unsafe.cjs +0 -1
- package/dist/unsafe.js +0 -1
- package/package.json +9 -10
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/unsafe.cjs.map +0 -1
- package/dist/unsafe.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ export { QueryResponse, ResolveResponse, ResolvedPlan } from 'algenta-sdk';
|
|
|
3
3
|
|
|
4
4
|
/** Capability contract: the generated, hash-pinned inventory of everything
|
|
5
5
|
* SQAI exposes. Loaded from the vendored contracts/algenta-capabilities.json
|
|
6
|
-
* (synced hash-verified from the
|
|
6
|
+
* (synced hash-verified from the generator). SQAI keeps no
|
|
7
7
|
* handwritten operation lists — this file is the only authority. */
|
|
8
8
|
interface CapabilitySignatureParam {
|
|
9
9
|
name: string;
|
|
@@ -66,8 +66,7 @@ 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_ENGINE_URL present -> "self_hosted"
|
|
70
|
-
* SQAI_API_KEY present -> "api"
|
|
69
|
+
* SQAI_DEPLOYMENT_URL / SQAI_ENGINE_URL present -> "self_hosted"
|
|
71
70
|
* otherwise -> "local"
|
|
72
71
|
*/
|
|
73
72
|
type SqaiMode = "local" | "api" | "self_hosted";
|
|
@@ -187,6 +186,7 @@ declare class RuntimeProvisioner {
|
|
|
187
186
|
status(): Promise<RuntimeStatus>;
|
|
188
187
|
stop(): Promise<void>;
|
|
189
188
|
private newRuntime;
|
|
189
|
+
private ensureLocalLoginKey;
|
|
190
190
|
private cacheDir;
|
|
191
191
|
/** Normalized module filter (sorted, unique, non-empty) or null for the default bundle. */
|
|
192
192
|
private filterModules;
|
|
@@ -225,13 +225,7 @@ declare class RuntimeProvisioner {
|
|
|
225
225
|
private spawnInstalled;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
/** Public SQAI types.
|
|
229
|
-
*
|
|
230
|
-
* Vocabulary rule: Algenta envelope field names pass through verbatim
|
|
231
|
-
* (plan_hash, schema_revision, intent_signature, deterministic_scope,
|
|
232
|
-
* decision_path, validated, engine_used, ...). SQAI never invents parallel
|
|
233
|
-
* names for the same concept.
|
|
234
|
-
*/
|
|
228
|
+
/** Public SQAI types. */
|
|
235
229
|
|
|
236
230
|
/** Contract-derived wire value: everything the computation plane can
|
|
237
231
|
* transport. The wire schema transports; the capability contract authorizes. */
|
|
@@ -241,8 +235,6 @@ type SqaiValue = null | boolean | number | string | SqaiValue[] | {
|
|
|
241
235
|
type: "decimal" | "bigint";
|
|
242
236
|
value: string;
|
|
243
237
|
};
|
|
244
|
-
/** @deprecated Renamed to {@link SqaiValue}. Kept as a non-breaking alias. */
|
|
245
|
-
type AlgentaWireValue = SqaiValue;
|
|
246
238
|
interface SqaiSource {
|
|
247
239
|
name: string;
|
|
248
240
|
source_id: string | null;
|
|
@@ -256,6 +248,74 @@ interface SqaiSource {
|
|
|
256
248
|
schema_revision: string | null;
|
|
257
249
|
status: string;
|
|
258
250
|
}
|
|
251
|
+
type SqaiConnectorConfig = Record<string, unknown>;
|
|
252
|
+
declare const SQAI_CONNECTOR_TYPES: readonly ["s3", "gcs", "azure", "clickhouse", "bigquery", "snowflake", "redshift", "postgres", "postgresql", "sqlite", "mysql", "mssql", "oracle", "neo4j", "redis", "elastic", "elasticsearch", "rest", "rest_api", "file", "file_upload", "github_repo", "gitlab_repo", "bitbucket_repo", "local_repo", "repo_archive"];
|
|
253
|
+
type SqaiConnectorType = (typeof SQAI_CONNECTOR_TYPES)[number];
|
|
254
|
+
declare const SQAI_CONNECTOR_TYPE_ALIASES: Readonly<Record<string, SqaiConnectorType>>;
|
|
255
|
+
interface SqaiConnectorPreview {
|
|
256
|
+
type?: SqaiConnectorType | string;
|
|
257
|
+
connector_type?: SqaiConnectorType | string;
|
|
258
|
+
provider?: string;
|
|
259
|
+
[key: string]: unknown;
|
|
260
|
+
}
|
|
261
|
+
interface SqaiManagedConnectOptions {
|
|
262
|
+
name?: string;
|
|
263
|
+
description?: string;
|
|
264
|
+
connectorId?: string;
|
|
265
|
+
connector?: SqaiConnectorPreview;
|
|
266
|
+
selection?: Record<string, unknown>;
|
|
267
|
+
datasetName?: string;
|
|
268
|
+
persist?: boolean;
|
|
269
|
+
visibility?: string;
|
|
270
|
+
connectionName?: string;
|
|
271
|
+
}
|
|
272
|
+
interface SqaiConnectorCreateRequest {
|
|
273
|
+
name: string;
|
|
274
|
+
connectorType: SqaiConnectorType | string;
|
|
275
|
+
config?: SqaiConnectorConfig;
|
|
276
|
+
description?: string;
|
|
277
|
+
visibility?: string;
|
|
278
|
+
}
|
|
279
|
+
interface SqaiConnectorUpdateRequest {
|
|
280
|
+
name?: string;
|
|
281
|
+
description?: string;
|
|
282
|
+
visibility?: string;
|
|
283
|
+
config?: SqaiConnectorConfig;
|
|
284
|
+
}
|
|
285
|
+
interface SqaiConnectorInfo {
|
|
286
|
+
id: string;
|
|
287
|
+
name: string;
|
|
288
|
+
connector_type: string;
|
|
289
|
+
status: string;
|
|
290
|
+
visibility: string;
|
|
291
|
+
description?: string | null;
|
|
292
|
+
last_tested_at?: string | null;
|
|
293
|
+
error_message?: string | null;
|
|
294
|
+
created_at?: string;
|
|
295
|
+
}
|
|
296
|
+
interface SqaiConnectorListResult {
|
|
297
|
+
connectors: SqaiConnectorInfo[];
|
|
298
|
+
total: number;
|
|
299
|
+
page: number;
|
|
300
|
+
limit: number;
|
|
301
|
+
pages: number;
|
|
302
|
+
}
|
|
303
|
+
interface SqaiConnectorTestResult {
|
|
304
|
+
success: boolean;
|
|
305
|
+
message: string;
|
|
306
|
+
latency_ms?: number | null;
|
|
307
|
+
status?: string | null;
|
|
308
|
+
error_type?: string | null;
|
|
309
|
+
recoverable?: boolean | null;
|
|
310
|
+
}
|
|
311
|
+
interface SqaiConnectorBrowseResult {
|
|
312
|
+
connector_type: string;
|
|
313
|
+
items: Array<Record<string, unknown>>;
|
|
314
|
+
total: number;
|
|
315
|
+
message: string;
|
|
316
|
+
labels: Record<string, unknown>;
|
|
317
|
+
discovery: Record<string, unknown>;
|
|
318
|
+
}
|
|
259
319
|
interface QueryFilterCondition {
|
|
260
320
|
column?: string;
|
|
261
321
|
dimension_hint?: string;
|
|
@@ -414,6 +474,9 @@ type DispatchTarget = {
|
|
|
414
474
|
interface SqaiConfig {
|
|
415
475
|
mode?: SqaiMode;
|
|
416
476
|
apiKey?: string;
|
|
477
|
+
/** Public SQAI deployment URL. Prefer this over engineUrl in new code. */
|
|
478
|
+
deploymentUrl?: string;
|
|
479
|
+
/** @deprecated Use deploymentUrl. Kept for backward compatibility. */
|
|
417
480
|
engineUrl?: string;
|
|
418
481
|
tenantId?: string;
|
|
419
482
|
policy?: SqaiPolicy;
|
|
@@ -435,7 +498,7 @@ interface SqaiConfig {
|
|
|
435
498
|
buildServiceUrl?: string;
|
|
436
499
|
/** BYO substrate (tests). */
|
|
437
500
|
runtime?: Runtime;
|
|
438
|
-
/** BYO computation dispatch target (tests / custom
|
|
501
|
+
/** BYO computation dispatch target (tests / custom SQAI deployments). */
|
|
439
502
|
computeTarget?: DispatchTarget;
|
|
440
503
|
}
|
|
441
504
|
declare class SQAI {
|
|
@@ -453,9 +516,17 @@ declare class SQAI {
|
|
|
453
516
|
private readonly timeoutMs;
|
|
454
517
|
private readonly sources;
|
|
455
518
|
constructor(config?: SqaiConfig);
|
|
456
|
-
connect(source
|
|
457
|
-
|
|
458
|
-
|
|
519
|
+
connect(source?: string | Array<Record<string, unknown>> | Record<string, unknown> | null, options?: SqaiManagedConnectOptions): Promise<SqaiSource>;
|
|
520
|
+
createConnector(request: SqaiConnectorCreateRequest): Promise<SqaiConnectorInfo>;
|
|
521
|
+
listConnectors(options?: {
|
|
522
|
+
page?: number;
|
|
523
|
+
limit?: number;
|
|
524
|
+
}): Promise<SqaiConnectorListResult>;
|
|
525
|
+
getConnector(connectorId: string): Promise<SqaiConnectorInfo>;
|
|
526
|
+
updateConnector(connectorId: string, request: SqaiConnectorUpdateRequest): Promise<SqaiConnectorInfo>;
|
|
527
|
+
testConnector(connectorIdOrConnector: string | SqaiConnectorPreview): Promise<SqaiConnectorTestResult>;
|
|
528
|
+
browseConnector(connectorIdOrConnector: string | SqaiConnectorPreview): Promise<SqaiConnectorBrowseResult>;
|
|
529
|
+
deleteConnector(connectorId: string): Promise<void>;
|
|
459
530
|
listSources(): SqaiSource[];
|
|
460
531
|
resolve(spec: QuerySpec): Promise<ResolveResponse>;
|
|
461
532
|
query(plan: ResolvedPlan | ResolveResponse): Promise<QueryResponse>;
|
|
@@ -487,9 +558,9 @@ declare function createSQAI(config?: SqaiConfig): SQAI;
|
|
|
487
558
|
|
|
488
559
|
/** SQAI failure contract.
|
|
489
560
|
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
*
|
|
561
|
+
* Engine error codes pass through verbatim (`source: "engine"`); SQAI adds its
|
|
562
|
+
* own codes in the same snake_case vocabulary (`source: "sqai"`). A code is
|
|
563
|
+
* never renamed and the same condition never gets two codes.
|
|
493
564
|
*/
|
|
494
565
|
type SqaiErrorSource = "engine" | "sqai";
|
|
495
566
|
interface SqaiErrorOptions {
|
|
@@ -513,7 +584,7 @@ declare class SqaiError extends Error {
|
|
|
513
584
|
request_id: string | null;
|
|
514
585
|
};
|
|
515
586
|
}
|
|
516
|
-
/**
|
|
587
|
+
/** SQAI error codes surfaced by the SDK. */
|
|
517
588
|
declare const SQAI_ERROR_CODES: readonly ["unsupported_operation", "seed_required", "duplicate_argument_binding", "policy_denied_source", "policy_denied_field", "policy_denied_function", "source_already_registered", "runtime_provision_failed", "daemon_port_conflict", "unsupported_platform", "compute_runtime_unavailable", "result_not_found", "contract_mismatch", "invalid_intent"];
|
|
518
589
|
|
|
519
590
|
/** Two-hash determinism contract.
|
|
@@ -575,6 +646,36 @@ declare class ResultStore {
|
|
|
575
646
|
private evictOldestForTenant;
|
|
576
647
|
}
|
|
577
648
|
|
|
649
|
+
/**
|
|
650
|
+
* `sqai login` — device onboarding for the SQAI runtime (JS/TS side; mirrors the Python sqai._login).
|
|
651
|
+
*
|
|
652
|
+
* Authenticates via the shared accounts portal (OAuth 2.0 device grant, RFC 8628), resolves-or-creates
|
|
653
|
+
* the caller's org on the free `sqai_developer` tier, and mints a control-plane API key. The key is
|
|
654
|
+
* cached under ~/.sqai and handed to the local runtime daemon (as ALGENTA_API_KEY), which exchanges it
|
|
655
|
+
* once for a platform-signed, device-bound offline license — then everything runs locally, no query-time
|
|
656
|
+
* network. Same device tech telys/algenta use; only the product literals differ.
|
|
657
|
+
*
|
|
658
|
+
* Free forever on 1 machine. Paid tiers (sqai_pro / sqai_team) add devices/seats/commercial use via the
|
|
659
|
+
* accounts billing portal — never a cloud service. Login is licensing-only; no data leaves the machine.
|
|
660
|
+
*/
|
|
661
|
+
declare class LoginError extends Error {
|
|
662
|
+
}
|
|
663
|
+
declare function sqaiHome(): string;
|
|
664
|
+
/** Resolve the SQAI API key for the runtime: $SQAI_API_KEY / $ALGENTA_API_KEY, else the cached key. */
|
|
665
|
+
declare function readCachedApiKey(): Promise<string | undefined>;
|
|
666
|
+
interface LoginResult {
|
|
667
|
+
device_id: string;
|
|
668
|
+
plan: string;
|
|
669
|
+
api_key_prefix: string;
|
|
670
|
+
}
|
|
671
|
+
declare function login(opts?: {
|
|
672
|
+
plan?: string;
|
|
673
|
+
accessToken?: string;
|
|
674
|
+
openBrowser?: boolean;
|
|
675
|
+
}): Promise<LoginResult>;
|
|
676
|
+
/** Remove cached token + API key (keeps the device identity so a re-login rebinds the same device). */
|
|
677
|
+
declare function logout(): void;
|
|
678
|
+
|
|
578
679
|
/** Computation-plane validation: dynamic, against the embedded capability
|
|
579
680
|
* contract. The zod wire schema (in @thyn-ai/sqai-ai-sdk) only transports values;
|
|
580
681
|
* everything here authorizes them. SQAI computes nothing — a validated
|
|
@@ -601,4 +702,4 @@ interface ValidatedComputation {
|
|
|
601
702
|
declare function lookupCapability(index: ContractIndex, module: string, functionName: string): CapabilityEntry;
|
|
602
703
|
declare function validateComputation(spec: ComputationSpec, index: ContractIndex, policy: SqaiPolicy | undefined, resolvedBindings: ResolvedBindingValue[]): ValidatedComputation;
|
|
603
704
|
|
|
604
|
-
export { type
|
|
705
|
+
export { type AskOutcome, type BindingProvenance, type CapabilityContract, type CapabilityEntry, type CapabilityMatch, type ColumnExtract, type ComputationBinding, type ComputationSpec, type ComputeResult, ContractIndex, type DeterminismEnvelope, type InvocationIdentity, LoginError, type LoginResult, type QueryFilterCondition, type QueryFilterSpec, type QuerySpec, type ResolvedBindingValue, ResultStore, type ResultStoreConfig, RuntimeProvisioner, type RuntimeStatus, SQAI, SQAI_CONNECTOR_TYPES, SQAI_CONNECTOR_TYPE_ALIASES, SQAI_ERROR_CODES, type SqaiConfig, type SqaiConnectorBrowseResult, type SqaiConnectorConfig, type SqaiConnectorCreateRequest, type SqaiConnectorInfo, type SqaiConnectorListResult, type SqaiConnectorPreview, type SqaiConnectorTestResult, type SqaiConnectorType, type SqaiConnectorUpdateRequest, SqaiError, type SqaiErrorSource, type SqaiIntent, type SqaiManagedConnectOptions, type SqaiOutcome, type SqaiPolicy, type SqaiResultRecord, type SqaiSource, type SqaiValue, type ValidatedComputation, computationHash, createSQAI, currentPlatformKey, invocationHash, isReadOnlyEligible, login, logout, lookupCapability, readCachedApiKey, runtimeCacheDir, sqaiHome, validateComputation };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { QueryResponse, ResolveResponse, ResolvedPlan } from 'algenta-sdk';
|
|
|
3
3
|
|
|
4
4
|
/** Capability contract: the generated, hash-pinned inventory of everything
|
|
5
5
|
* SQAI exposes. Loaded from the vendored contracts/algenta-capabilities.json
|
|
6
|
-
* (synced hash-verified from the
|
|
6
|
+
* (synced hash-verified from the generator). SQAI keeps no
|
|
7
7
|
* handwritten operation lists — this file is the only authority. */
|
|
8
8
|
interface CapabilitySignatureParam {
|
|
9
9
|
name: string;
|
|
@@ -66,8 +66,7 @@ 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_ENGINE_URL present -> "self_hosted"
|
|
70
|
-
* SQAI_API_KEY present -> "api"
|
|
69
|
+
* SQAI_DEPLOYMENT_URL / SQAI_ENGINE_URL present -> "self_hosted"
|
|
71
70
|
* otherwise -> "local"
|
|
72
71
|
*/
|
|
73
72
|
type SqaiMode = "local" | "api" | "self_hosted";
|
|
@@ -187,6 +186,7 @@ declare class RuntimeProvisioner {
|
|
|
187
186
|
status(): Promise<RuntimeStatus>;
|
|
188
187
|
stop(): Promise<void>;
|
|
189
188
|
private newRuntime;
|
|
189
|
+
private ensureLocalLoginKey;
|
|
190
190
|
private cacheDir;
|
|
191
191
|
/** Normalized module filter (sorted, unique, non-empty) or null for the default bundle. */
|
|
192
192
|
private filterModules;
|
|
@@ -225,13 +225,7 @@ declare class RuntimeProvisioner {
|
|
|
225
225
|
private spawnInstalled;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
/** Public SQAI types.
|
|
229
|
-
*
|
|
230
|
-
* Vocabulary rule: Algenta envelope field names pass through verbatim
|
|
231
|
-
* (plan_hash, schema_revision, intent_signature, deterministic_scope,
|
|
232
|
-
* decision_path, validated, engine_used, ...). SQAI never invents parallel
|
|
233
|
-
* names for the same concept.
|
|
234
|
-
*/
|
|
228
|
+
/** Public SQAI types. */
|
|
235
229
|
|
|
236
230
|
/** Contract-derived wire value: everything the computation plane can
|
|
237
231
|
* transport. The wire schema transports; the capability contract authorizes. */
|
|
@@ -241,8 +235,6 @@ type SqaiValue = null | boolean | number | string | SqaiValue[] | {
|
|
|
241
235
|
type: "decimal" | "bigint";
|
|
242
236
|
value: string;
|
|
243
237
|
};
|
|
244
|
-
/** @deprecated Renamed to {@link SqaiValue}. Kept as a non-breaking alias. */
|
|
245
|
-
type AlgentaWireValue = SqaiValue;
|
|
246
238
|
interface SqaiSource {
|
|
247
239
|
name: string;
|
|
248
240
|
source_id: string | null;
|
|
@@ -256,6 +248,74 @@ interface SqaiSource {
|
|
|
256
248
|
schema_revision: string | null;
|
|
257
249
|
status: string;
|
|
258
250
|
}
|
|
251
|
+
type SqaiConnectorConfig = Record<string, unknown>;
|
|
252
|
+
declare const SQAI_CONNECTOR_TYPES: readonly ["s3", "gcs", "azure", "clickhouse", "bigquery", "snowflake", "redshift", "postgres", "postgresql", "sqlite", "mysql", "mssql", "oracle", "neo4j", "redis", "elastic", "elasticsearch", "rest", "rest_api", "file", "file_upload", "github_repo", "gitlab_repo", "bitbucket_repo", "local_repo", "repo_archive"];
|
|
253
|
+
type SqaiConnectorType = (typeof SQAI_CONNECTOR_TYPES)[number];
|
|
254
|
+
declare const SQAI_CONNECTOR_TYPE_ALIASES: Readonly<Record<string, SqaiConnectorType>>;
|
|
255
|
+
interface SqaiConnectorPreview {
|
|
256
|
+
type?: SqaiConnectorType | string;
|
|
257
|
+
connector_type?: SqaiConnectorType | string;
|
|
258
|
+
provider?: string;
|
|
259
|
+
[key: string]: unknown;
|
|
260
|
+
}
|
|
261
|
+
interface SqaiManagedConnectOptions {
|
|
262
|
+
name?: string;
|
|
263
|
+
description?: string;
|
|
264
|
+
connectorId?: string;
|
|
265
|
+
connector?: SqaiConnectorPreview;
|
|
266
|
+
selection?: Record<string, unknown>;
|
|
267
|
+
datasetName?: string;
|
|
268
|
+
persist?: boolean;
|
|
269
|
+
visibility?: string;
|
|
270
|
+
connectionName?: string;
|
|
271
|
+
}
|
|
272
|
+
interface SqaiConnectorCreateRequest {
|
|
273
|
+
name: string;
|
|
274
|
+
connectorType: SqaiConnectorType | string;
|
|
275
|
+
config?: SqaiConnectorConfig;
|
|
276
|
+
description?: string;
|
|
277
|
+
visibility?: string;
|
|
278
|
+
}
|
|
279
|
+
interface SqaiConnectorUpdateRequest {
|
|
280
|
+
name?: string;
|
|
281
|
+
description?: string;
|
|
282
|
+
visibility?: string;
|
|
283
|
+
config?: SqaiConnectorConfig;
|
|
284
|
+
}
|
|
285
|
+
interface SqaiConnectorInfo {
|
|
286
|
+
id: string;
|
|
287
|
+
name: string;
|
|
288
|
+
connector_type: string;
|
|
289
|
+
status: string;
|
|
290
|
+
visibility: string;
|
|
291
|
+
description?: string | null;
|
|
292
|
+
last_tested_at?: string | null;
|
|
293
|
+
error_message?: string | null;
|
|
294
|
+
created_at?: string;
|
|
295
|
+
}
|
|
296
|
+
interface SqaiConnectorListResult {
|
|
297
|
+
connectors: SqaiConnectorInfo[];
|
|
298
|
+
total: number;
|
|
299
|
+
page: number;
|
|
300
|
+
limit: number;
|
|
301
|
+
pages: number;
|
|
302
|
+
}
|
|
303
|
+
interface SqaiConnectorTestResult {
|
|
304
|
+
success: boolean;
|
|
305
|
+
message: string;
|
|
306
|
+
latency_ms?: number | null;
|
|
307
|
+
status?: string | null;
|
|
308
|
+
error_type?: string | null;
|
|
309
|
+
recoverable?: boolean | null;
|
|
310
|
+
}
|
|
311
|
+
interface SqaiConnectorBrowseResult {
|
|
312
|
+
connector_type: string;
|
|
313
|
+
items: Array<Record<string, unknown>>;
|
|
314
|
+
total: number;
|
|
315
|
+
message: string;
|
|
316
|
+
labels: Record<string, unknown>;
|
|
317
|
+
discovery: Record<string, unknown>;
|
|
318
|
+
}
|
|
259
319
|
interface QueryFilterCondition {
|
|
260
320
|
column?: string;
|
|
261
321
|
dimension_hint?: string;
|
|
@@ -414,6 +474,9 @@ type DispatchTarget = {
|
|
|
414
474
|
interface SqaiConfig {
|
|
415
475
|
mode?: SqaiMode;
|
|
416
476
|
apiKey?: string;
|
|
477
|
+
/** Public SQAI deployment URL. Prefer this over engineUrl in new code. */
|
|
478
|
+
deploymentUrl?: string;
|
|
479
|
+
/** @deprecated Use deploymentUrl. Kept for backward compatibility. */
|
|
417
480
|
engineUrl?: string;
|
|
418
481
|
tenantId?: string;
|
|
419
482
|
policy?: SqaiPolicy;
|
|
@@ -435,7 +498,7 @@ interface SqaiConfig {
|
|
|
435
498
|
buildServiceUrl?: string;
|
|
436
499
|
/** BYO substrate (tests). */
|
|
437
500
|
runtime?: Runtime;
|
|
438
|
-
/** BYO computation dispatch target (tests / custom
|
|
501
|
+
/** BYO computation dispatch target (tests / custom SQAI deployments). */
|
|
439
502
|
computeTarget?: DispatchTarget;
|
|
440
503
|
}
|
|
441
504
|
declare class SQAI {
|
|
@@ -453,9 +516,17 @@ declare class SQAI {
|
|
|
453
516
|
private readonly timeoutMs;
|
|
454
517
|
private readonly sources;
|
|
455
518
|
constructor(config?: SqaiConfig);
|
|
456
|
-
connect(source
|
|
457
|
-
|
|
458
|
-
|
|
519
|
+
connect(source?: string | Array<Record<string, unknown>> | Record<string, unknown> | null, options?: SqaiManagedConnectOptions): Promise<SqaiSource>;
|
|
520
|
+
createConnector(request: SqaiConnectorCreateRequest): Promise<SqaiConnectorInfo>;
|
|
521
|
+
listConnectors(options?: {
|
|
522
|
+
page?: number;
|
|
523
|
+
limit?: number;
|
|
524
|
+
}): Promise<SqaiConnectorListResult>;
|
|
525
|
+
getConnector(connectorId: string): Promise<SqaiConnectorInfo>;
|
|
526
|
+
updateConnector(connectorId: string, request: SqaiConnectorUpdateRequest): Promise<SqaiConnectorInfo>;
|
|
527
|
+
testConnector(connectorIdOrConnector: string | SqaiConnectorPreview): Promise<SqaiConnectorTestResult>;
|
|
528
|
+
browseConnector(connectorIdOrConnector: string | SqaiConnectorPreview): Promise<SqaiConnectorBrowseResult>;
|
|
529
|
+
deleteConnector(connectorId: string): Promise<void>;
|
|
459
530
|
listSources(): SqaiSource[];
|
|
460
531
|
resolve(spec: QuerySpec): Promise<ResolveResponse>;
|
|
461
532
|
query(plan: ResolvedPlan | ResolveResponse): Promise<QueryResponse>;
|
|
@@ -487,9 +558,9 @@ declare function createSQAI(config?: SqaiConfig): SQAI;
|
|
|
487
558
|
|
|
488
559
|
/** SQAI failure contract.
|
|
489
560
|
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
*
|
|
561
|
+
* Engine error codes pass through verbatim (`source: "engine"`); SQAI adds its
|
|
562
|
+
* own codes in the same snake_case vocabulary (`source: "sqai"`). A code is
|
|
563
|
+
* never renamed and the same condition never gets two codes.
|
|
493
564
|
*/
|
|
494
565
|
type SqaiErrorSource = "engine" | "sqai";
|
|
495
566
|
interface SqaiErrorOptions {
|
|
@@ -513,7 +584,7 @@ declare class SqaiError extends Error {
|
|
|
513
584
|
request_id: string | null;
|
|
514
585
|
};
|
|
515
586
|
}
|
|
516
|
-
/**
|
|
587
|
+
/** SQAI error codes surfaced by the SDK. */
|
|
517
588
|
declare const SQAI_ERROR_CODES: readonly ["unsupported_operation", "seed_required", "duplicate_argument_binding", "policy_denied_source", "policy_denied_field", "policy_denied_function", "source_already_registered", "runtime_provision_failed", "daemon_port_conflict", "unsupported_platform", "compute_runtime_unavailable", "result_not_found", "contract_mismatch", "invalid_intent"];
|
|
518
589
|
|
|
519
590
|
/** Two-hash determinism contract.
|
|
@@ -575,6 +646,36 @@ declare class ResultStore {
|
|
|
575
646
|
private evictOldestForTenant;
|
|
576
647
|
}
|
|
577
648
|
|
|
649
|
+
/**
|
|
650
|
+
* `sqai login` — device onboarding for the SQAI runtime (JS/TS side; mirrors the Python sqai._login).
|
|
651
|
+
*
|
|
652
|
+
* Authenticates via the shared accounts portal (OAuth 2.0 device grant, RFC 8628), resolves-or-creates
|
|
653
|
+
* the caller's org on the free `sqai_developer` tier, and mints a control-plane API key. The key is
|
|
654
|
+
* cached under ~/.sqai and handed to the local runtime daemon (as ALGENTA_API_KEY), which exchanges it
|
|
655
|
+
* once for a platform-signed, device-bound offline license — then everything runs locally, no query-time
|
|
656
|
+
* network. Same device tech telys/algenta use; only the product literals differ.
|
|
657
|
+
*
|
|
658
|
+
* Free forever on 1 machine. Paid tiers (sqai_pro / sqai_team) add devices/seats/commercial use via the
|
|
659
|
+
* accounts billing portal — never a cloud service. Login is licensing-only; no data leaves the machine.
|
|
660
|
+
*/
|
|
661
|
+
declare class LoginError extends Error {
|
|
662
|
+
}
|
|
663
|
+
declare function sqaiHome(): string;
|
|
664
|
+
/** Resolve the SQAI API key for the runtime: $SQAI_API_KEY / $ALGENTA_API_KEY, else the cached key. */
|
|
665
|
+
declare function readCachedApiKey(): Promise<string | undefined>;
|
|
666
|
+
interface LoginResult {
|
|
667
|
+
device_id: string;
|
|
668
|
+
plan: string;
|
|
669
|
+
api_key_prefix: string;
|
|
670
|
+
}
|
|
671
|
+
declare function login(opts?: {
|
|
672
|
+
plan?: string;
|
|
673
|
+
accessToken?: string;
|
|
674
|
+
openBrowser?: boolean;
|
|
675
|
+
}): Promise<LoginResult>;
|
|
676
|
+
/** Remove cached token + API key (keeps the device identity so a re-login rebinds the same device). */
|
|
677
|
+
declare function logout(): void;
|
|
678
|
+
|
|
578
679
|
/** Computation-plane validation: dynamic, against the embedded capability
|
|
579
680
|
* contract. The zod wire schema (in @thyn-ai/sqai-ai-sdk) only transports values;
|
|
580
681
|
* everything here authorizes them. SQAI computes nothing — a validated
|
|
@@ -601,4 +702,4 @@ interface ValidatedComputation {
|
|
|
601
702
|
declare function lookupCapability(index: ContractIndex, module: string, functionName: string): CapabilityEntry;
|
|
602
703
|
declare function validateComputation(spec: ComputationSpec, index: ContractIndex, policy: SqaiPolicy | undefined, resolvedBindings: ResolvedBindingValue[]): ValidatedComputation;
|
|
603
704
|
|
|
604
|
-
export { type
|
|
705
|
+
export { type AskOutcome, type BindingProvenance, type CapabilityContract, type CapabilityEntry, type CapabilityMatch, type ColumnExtract, type ComputationBinding, type ComputationSpec, type ComputeResult, ContractIndex, type DeterminismEnvelope, type InvocationIdentity, LoginError, type LoginResult, type QueryFilterCondition, type QueryFilterSpec, type QuerySpec, type ResolvedBindingValue, ResultStore, type ResultStoreConfig, RuntimeProvisioner, type RuntimeStatus, SQAI, SQAI_CONNECTOR_TYPES, SQAI_CONNECTOR_TYPE_ALIASES, SQAI_ERROR_CODES, type SqaiConfig, type SqaiConnectorBrowseResult, type SqaiConnectorConfig, type SqaiConnectorCreateRequest, type SqaiConnectorInfo, type SqaiConnectorListResult, type SqaiConnectorPreview, type SqaiConnectorTestResult, type SqaiConnectorType, type SqaiConnectorUpdateRequest, SqaiError, type SqaiErrorSource, type SqaiIntent, type SqaiManagedConnectOptions, type SqaiOutcome, type SqaiPolicy, type SqaiResultRecord, type SqaiSource, type SqaiValue, type ValidatedComputation, computationHash, createSQAI, currentPlatformKey, invocationHash, isReadOnlyEligible, login, logout, lookupCapability, readCachedApiKey, runtimeCacheDir, sqaiHome, validateComputation };
|