@thyn-ai/sqai 0.1.3 → 0.1.5
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/dist/index.cjs +255 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -12
- package/dist/index.d.ts +44 -12
- package/dist/index.js +215 -36
- package/dist/index.js.map +1 -1
- package/dist/unsafe.cjs +6 -3
- package/dist/unsafe.cjs.map +1 -1
- package/dist/unsafe.d.cts +5 -3
- package/dist/unsafe.d.ts +5 -3
- package/dist/unsafe.js +4 -2
- package/dist/unsafe.js.map +1 -1
- package/package.json +9 -9
package/dist/index.d.cts
CHANGED
|
@@ -235,12 +235,14 @@ declare class RuntimeProvisioner {
|
|
|
235
235
|
|
|
236
236
|
/** Contract-derived wire value: everything the computation plane can
|
|
237
237
|
* transport. The wire schema transports; the capability contract authorizes. */
|
|
238
|
-
type
|
|
239
|
-
[key: string]:
|
|
238
|
+
type SqaiValue = null | boolean | number | string | SqaiValue[] | {
|
|
239
|
+
[key: string]: SqaiValue;
|
|
240
240
|
} | {
|
|
241
241
|
type: "decimal" | "bigint";
|
|
242
242
|
value: string;
|
|
243
243
|
};
|
|
244
|
+
/** @deprecated Renamed to {@link SqaiValue}. Kept as a non-breaking alias. */
|
|
245
|
+
type AlgentaWireValue = SqaiValue;
|
|
244
246
|
interface SqaiSource {
|
|
245
247
|
name: string;
|
|
246
248
|
source_id: string | null;
|
|
@@ -291,8 +293,8 @@ type ComputationBinding = {
|
|
|
291
293
|
interface ComputationSpec {
|
|
292
294
|
module: string;
|
|
293
295
|
function: string;
|
|
294
|
-
args?:
|
|
295
|
-
kwargs?: Record<string,
|
|
296
|
+
args?: SqaiValue[];
|
|
297
|
+
kwargs?: Record<string, SqaiValue>;
|
|
296
298
|
bindings?: ComputationBinding[];
|
|
297
299
|
seed?: number | string;
|
|
298
300
|
}
|
|
@@ -325,7 +327,7 @@ interface BindingProvenance {
|
|
|
325
327
|
}
|
|
326
328
|
interface ComputeResult {
|
|
327
329
|
status: "ok";
|
|
328
|
-
value:
|
|
330
|
+
value: SqaiValue;
|
|
329
331
|
value_type: string;
|
|
330
332
|
module: string;
|
|
331
333
|
function: string;
|
|
@@ -485,11 +487,11 @@ declare function createSQAI(config?: SqaiConfig): SQAI;
|
|
|
485
487
|
|
|
486
488
|
/** SQAI failure contract.
|
|
487
489
|
*
|
|
488
|
-
* Algenta error codes pass through verbatim (`source: "
|
|
490
|
+
* Algenta error codes pass through verbatim (`source: "engine"`); SQAI adds
|
|
489
491
|
* its own codes in the same snake_case vocabulary (`source: "sqai"`). A code
|
|
490
492
|
* is never renamed and the same condition never gets two codes.
|
|
491
493
|
*/
|
|
492
|
-
type SqaiErrorSource = "
|
|
494
|
+
type SqaiErrorSource = "engine" | "sqai";
|
|
493
495
|
interface SqaiErrorOptions {
|
|
494
496
|
retryable?: boolean;
|
|
495
497
|
requestId?: string | null;
|
|
@@ -532,8 +534,8 @@ declare const SQAI_ERROR_CODES: readonly ["unsupported_operation", "seed_require
|
|
|
532
534
|
interface InvocationIdentity {
|
|
533
535
|
module: string;
|
|
534
536
|
function: string;
|
|
535
|
-
args:
|
|
536
|
-
kwargs: Record<string,
|
|
537
|
+
args: SqaiValue[];
|
|
538
|
+
kwargs: Record<string, SqaiValue>;
|
|
537
539
|
resolved_bindings: Array<{
|
|
538
540
|
parameter: string | number;
|
|
539
541
|
source_name: string;
|
|
@@ -573,6 +575,36 @@ declare class ResultStore {
|
|
|
573
575
|
private evictOldestForTenant;
|
|
574
576
|
}
|
|
575
577
|
|
|
578
|
+
/**
|
|
579
|
+
* `sqai login` — device onboarding for the SQAI runtime (JS/TS side; mirrors the Python sqai._login).
|
|
580
|
+
*
|
|
581
|
+
* Authenticates via the shared accounts portal (OAuth 2.0 device grant, RFC 8628), resolves-or-creates
|
|
582
|
+
* the caller's org on the free `sqai_developer` tier, and mints a control-plane API key. The key is
|
|
583
|
+
* cached under ~/.sqai and handed to the local runtime daemon (as ALGENTA_API_KEY), which exchanges it
|
|
584
|
+
* once for a platform-signed, device-bound offline license — then everything runs locally, no query-time
|
|
585
|
+
* network. Same device tech telys/algenta use; only the product literals differ.
|
|
586
|
+
*
|
|
587
|
+
* Free forever on 1 machine. Paid tiers (sqai_pro / sqai_team) add devices/seats/commercial use via the
|
|
588
|
+
* accounts billing portal — never a cloud service. Login is licensing-only; no data leaves the machine.
|
|
589
|
+
*/
|
|
590
|
+
declare class LoginError extends Error {
|
|
591
|
+
}
|
|
592
|
+
declare function sqaiHome(): string;
|
|
593
|
+
/** Resolve the SQAI API key for the runtime: $SQAI_API_KEY / $ALGENTA_API_KEY, else the cached key. */
|
|
594
|
+
declare function readCachedApiKey(): Promise<string | undefined>;
|
|
595
|
+
interface LoginResult {
|
|
596
|
+
device_id: string;
|
|
597
|
+
plan: string;
|
|
598
|
+
api_key_prefix: string;
|
|
599
|
+
}
|
|
600
|
+
declare function login(opts?: {
|
|
601
|
+
plan?: string;
|
|
602
|
+
accessToken?: string;
|
|
603
|
+
openBrowser?: boolean;
|
|
604
|
+
}): Promise<LoginResult>;
|
|
605
|
+
/** Remove cached token + API key (keeps the device identity so a re-login rebinds the same device). */
|
|
606
|
+
declare function logout(): void;
|
|
607
|
+
|
|
576
608
|
/** Computation-plane validation: dynamic, against the embedded capability
|
|
577
609
|
* contract. The zod wire schema (in @thyn-ai/sqai-ai-sdk) only transports values;
|
|
578
610
|
* everything here authorizes them. SQAI computes nothing — a validated
|
|
@@ -586,17 +618,17 @@ declare class ResultStore {
|
|
|
586
618
|
|
|
587
619
|
interface ResolvedBindingValue {
|
|
588
620
|
parameter: string | number;
|
|
589
|
-
values:
|
|
621
|
+
values: SqaiValue;
|
|
590
622
|
provenance: BindingProvenance;
|
|
591
623
|
}
|
|
592
624
|
interface ValidatedComputation {
|
|
593
625
|
entry: CapabilityEntry;
|
|
594
626
|
/** Final positional argument vector, ordered by the signature params. */
|
|
595
|
-
argsVector:
|
|
627
|
+
argsVector: SqaiValue[];
|
|
596
628
|
seed: number | string | null;
|
|
597
629
|
bindings: ResolvedBindingValue[];
|
|
598
630
|
}
|
|
599
631
|
declare function lookupCapability(index: ContractIndex, module: string, functionName: string): CapabilityEntry;
|
|
600
632
|
declare function validateComputation(spec: ComputationSpec, index: ContractIndex, policy: SqaiPolicy | undefined, resolvedBindings: ResolvedBindingValue[]): ValidatedComputation;
|
|
601
633
|
|
|
602
|
-
export { type AlgentaWireValue, type AskOutcome, type BindingProvenance, type CapabilityContract, type CapabilityEntry, type CapabilityMatch, type ColumnExtract, type ComputationBinding, type ComputationSpec, type ComputeResult, ContractIndex, type DeterminismEnvelope, type InvocationIdentity, type QueryFilterCondition, type QueryFilterSpec, type QuerySpec, type ResolvedBindingValue, ResultStore, type ResultStoreConfig, RuntimeProvisioner, type RuntimeStatus, SQAI, SQAI_ERROR_CODES, type SqaiConfig, SqaiError, type SqaiErrorSource, type SqaiIntent, type SqaiOutcome, type SqaiPolicy, type SqaiResultRecord, type SqaiSource, type ValidatedComputation, computationHash, createSQAI, currentPlatformKey, invocationHash, isReadOnlyEligible, lookupCapability, runtimeCacheDir, validateComputation };
|
|
634
|
+
export { type AlgentaWireValue, 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_ERROR_CODES, type SqaiConfig, SqaiError, type SqaiErrorSource, type SqaiIntent, 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
|
@@ -235,12 +235,14 @@ declare class RuntimeProvisioner {
|
|
|
235
235
|
|
|
236
236
|
/** Contract-derived wire value: everything the computation plane can
|
|
237
237
|
* transport. The wire schema transports; the capability contract authorizes. */
|
|
238
|
-
type
|
|
239
|
-
[key: string]:
|
|
238
|
+
type SqaiValue = null | boolean | number | string | SqaiValue[] | {
|
|
239
|
+
[key: string]: SqaiValue;
|
|
240
240
|
} | {
|
|
241
241
|
type: "decimal" | "bigint";
|
|
242
242
|
value: string;
|
|
243
243
|
};
|
|
244
|
+
/** @deprecated Renamed to {@link SqaiValue}. Kept as a non-breaking alias. */
|
|
245
|
+
type AlgentaWireValue = SqaiValue;
|
|
244
246
|
interface SqaiSource {
|
|
245
247
|
name: string;
|
|
246
248
|
source_id: string | null;
|
|
@@ -291,8 +293,8 @@ type ComputationBinding = {
|
|
|
291
293
|
interface ComputationSpec {
|
|
292
294
|
module: string;
|
|
293
295
|
function: string;
|
|
294
|
-
args?:
|
|
295
|
-
kwargs?: Record<string,
|
|
296
|
+
args?: SqaiValue[];
|
|
297
|
+
kwargs?: Record<string, SqaiValue>;
|
|
296
298
|
bindings?: ComputationBinding[];
|
|
297
299
|
seed?: number | string;
|
|
298
300
|
}
|
|
@@ -325,7 +327,7 @@ interface BindingProvenance {
|
|
|
325
327
|
}
|
|
326
328
|
interface ComputeResult {
|
|
327
329
|
status: "ok";
|
|
328
|
-
value:
|
|
330
|
+
value: SqaiValue;
|
|
329
331
|
value_type: string;
|
|
330
332
|
module: string;
|
|
331
333
|
function: string;
|
|
@@ -485,11 +487,11 @@ declare function createSQAI(config?: SqaiConfig): SQAI;
|
|
|
485
487
|
|
|
486
488
|
/** SQAI failure contract.
|
|
487
489
|
*
|
|
488
|
-
* Algenta error codes pass through verbatim (`source: "
|
|
490
|
+
* Algenta error codes pass through verbatim (`source: "engine"`); SQAI adds
|
|
489
491
|
* its own codes in the same snake_case vocabulary (`source: "sqai"`). A code
|
|
490
492
|
* is never renamed and the same condition never gets two codes.
|
|
491
493
|
*/
|
|
492
|
-
type SqaiErrorSource = "
|
|
494
|
+
type SqaiErrorSource = "engine" | "sqai";
|
|
493
495
|
interface SqaiErrorOptions {
|
|
494
496
|
retryable?: boolean;
|
|
495
497
|
requestId?: string | null;
|
|
@@ -532,8 +534,8 @@ declare const SQAI_ERROR_CODES: readonly ["unsupported_operation", "seed_require
|
|
|
532
534
|
interface InvocationIdentity {
|
|
533
535
|
module: string;
|
|
534
536
|
function: string;
|
|
535
|
-
args:
|
|
536
|
-
kwargs: Record<string,
|
|
537
|
+
args: SqaiValue[];
|
|
538
|
+
kwargs: Record<string, SqaiValue>;
|
|
537
539
|
resolved_bindings: Array<{
|
|
538
540
|
parameter: string | number;
|
|
539
541
|
source_name: string;
|
|
@@ -573,6 +575,36 @@ declare class ResultStore {
|
|
|
573
575
|
private evictOldestForTenant;
|
|
574
576
|
}
|
|
575
577
|
|
|
578
|
+
/**
|
|
579
|
+
* `sqai login` — device onboarding for the SQAI runtime (JS/TS side; mirrors the Python sqai._login).
|
|
580
|
+
*
|
|
581
|
+
* Authenticates via the shared accounts portal (OAuth 2.0 device grant, RFC 8628), resolves-or-creates
|
|
582
|
+
* the caller's org on the free `sqai_developer` tier, and mints a control-plane API key. The key is
|
|
583
|
+
* cached under ~/.sqai and handed to the local runtime daemon (as ALGENTA_API_KEY), which exchanges it
|
|
584
|
+
* once for a platform-signed, device-bound offline license — then everything runs locally, no query-time
|
|
585
|
+
* network. Same device tech telys/algenta use; only the product literals differ.
|
|
586
|
+
*
|
|
587
|
+
* Free forever on 1 machine. Paid tiers (sqai_pro / sqai_team) add devices/seats/commercial use via the
|
|
588
|
+
* accounts billing portal — never a cloud service. Login is licensing-only; no data leaves the machine.
|
|
589
|
+
*/
|
|
590
|
+
declare class LoginError extends Error {
|
|
591
|
+
}
|
|
592
|
+
declare function sqaiHome(): string;
|
|
593
|
+
/** Resolve the SQAI API key for the runtime: $SQAI_API_KEY / $ALGENTA_API_KEY, else the cached key. */
|
|
594
|
+
declare function readCachedApiKey(): Promise<string | undefined>;
|
|
595
|
+
interface LoginResult {
|
|
596
|
+
device_id: string;
|
|
597
|
+
plan: string;
|
|
598
|
+
api_key_prefix: string;
|
|
599
|
+
}
|
|
600
|
+
declare function login(opts?: {
|
|
601
|
+
plan?: string;
|
|
602
|
+
accessToken?: string;
|
|
603
|
+
openBrowser?: boolean;
|
|
604
|
+
}): Promise<LoginResult>;
|
|
605
|
+
/** Remove cached token + API key (keeps the device identity so a re-login rebinds the same device). */
|
|
606
|
+
declare function logout(): void;
|
|
607
|
+
|
|
576
608
|
/** Computation-plane validation: dynamic, against the embedded capability
|
|
577
609
|
* contract. The zod wire schema (in @thyn-ai/sqai-ai-sdk) only transports values;
|
|
578
610
|
* everything here authorizes them. SQAI computes nothing — a validated
|
|
@@ -586,17 +618,17 @@ declare class ResultStore {
|
|
|
586
618
|
|
|
587
619
|
interface ResolvedBindingValue {
|
|
588
620
|
parameter: string | number;
|
|
589
|
-
values:
|
|
621
|
+
values: SqaiValue;
|
|
590
622
|
provenance: BindingProvenance;
|
|
591
623
|
}
|
|
592
624
|
interface ValidatedComputation {
|
|
593
625
|
entry: CapabilityEntry;
|
|
594
626
|
/** Final positional argument vector, ordered by the signature params. */
|
|
595
|
-
argsVector:
|
|
627
|
+
argsVector: SqaiValue[];
|
|
596
628
|
seed: number | string | null;
|
|
597
629
|
bindings: ResolvedBindingValue[];
|
|
598
630
|
}
|
|
599
631
|
declare function lookupCapability(index: ContractIndex, module: string, functionName: string): CapabilityEntry;
|
|
600
632
|
declare function validateComputation(spec: ComputationSpec, index: ContractIndex, policy: SqaiPolicy | undefined, resolvedBindings: ResolvedBindingValue[]): ValidatedComputation;
|
|
601
633
|
|
|
602
|
-
export { type AlgentaWireValue, type AskOutcome, type BindingProvenance, type CapabilityContract, type CapabilityEntry, type CapabilityMatch, type ColumnExtract, type ComputationBinding, type ComputationSpec, type ComputeResult, ContractIndex, type DeterminismEnvelope, type InvocationIdentity, type QueryFilterCondition, type QueryFilterSpec, type QuerySpec, type ResolvedBindingValue, ResultStore, type ResultStoreConfig, RuntimeProvisioner, type RuntimeStatus, SQAI, SQAI_ERROR_CODES, type SqaiConfig, SqaiError, type SqaiErrorSource, type SqaiIntent, type SqaiOutcome, type SqaiPolicy, type SqaiResultRecord, type SqaiSource, type ValidatedComputation, computationHash, createSQAI, currentPlatformKey, invocationHash, isReadOnlyEligible, lookupCapability, runtimeCacheDir, validateComputation };
|
|
634
|
+
export { type AlgentaWireValue, 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_ERROR_CODES, type SqaiConfig, SqaiError, type SqaiErrorSource, type SqaiIntent, type SqaiOutcome, type SqaiPolicy, type SqaiResultRecord, type SqaiSource, type SqaiValue, type ValidatedComputation, computationHash, createSQAI, currentPlatformKey, invocationHash, isReadOnlyEligible, login, logout, lookupCapability, readCachedApiKey, runtimeCacheDir, sqaiHome, validateComputation };
|