@tailor-platform/sdk 1.65.0 → 1.66.0
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/CHANGELOG.md +11 -0
- package/dist/{application-76hhIhnJ.mjs → application-DGDmL8i_.mjs} +31 -5
- package/dist/application-DGDmL8i_.mjs.map +1 -0
- package/dist/application-nTydHJm8.mjs +4 -0
- package/dist/cli/index.mjs +6 -6
- package/dist/cli/lib.d.mts +363 -356
- package/dist/cli/lib.mjs +3 -3
- package/dist/{client-CobIRHl-.mjs → client-F0a4cWUM.mjs} +3 -2
- package/dist/client-F0a4cWUM.mjs.map +1 -0
- package/dist/{client-C68VWo4g.mjs → client-boxXYevx.mjs} +1 -1
- package/dist/completion/zsh-worker.zsh +4043 -0
- package/dist/configure/index.d.mts +3 -3
- package/dist/configure/index.mjs +17 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crashreport-BhD0y14F.mjs → crashreport-0EHy-ayY.mjs} +2 -2
- package/dist/{crashreport-BhD0y14F.mjs.map → crashreport-0EHy-ayY.mjs.map} +1 -1
- package/dist/{crashreport-D1wKBJ8N.mjs → crashreport-Bf6uT6mf.mjs} +1 -1
- package/dist/{index-DcXIjt9F.d.mts → index-BdLqzJDu.d.mts} +16 -3
- package/dist/{runtime-C7qTBDD2.mjs → runtime-2nzOZCUb.mjs} +240 -89
- package/dist/runtime-2nzOZCUb.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-CCDsY0ce.d.mts → workflow.generated--1Qc15Et.d.mts} +22 -3
- package/docs/cli/completion.md +3 -0
- package/docs/services/aigateway.md +97 -0
- package/package.json +3 -3
- package/dist/application-76hhIhnJ.mjs.map +0 -1
- package/dist/application-av2raLs6.mjs +0 -4
- package/dist/client-CobIRHl-.mjs.map +0 -1
- package/dist/runtime-C7qTBDD2.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as TailorInvoker } from "../../tailordb-C-ar4XCX.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Z as TailorDBType } from "../../workflow.generated--1Qc15Et.mjs";
|
|
3
|
+
import { jt as TailorField, n as output, wt as WORKFLOW_TEST_ENV_KEY } from "../../index-BdLqzJDu.mjs";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/test/mock.d.ts
|
|
@@ -784,6 +784,22 @@ type AuthServiceInputLoose = AuthServiceInput<any, any, any, string, any>;
|
|
|
784
784
|
type AuthOwnConfig = DefinedAuth<string, AuthServiceInputLoose, string>;
|
|
785
785
|
type AuthConfig = AuthOwnConfig | AuthExternalConfig;
|
|
786
786
|
//#endregion
|
|
787
|
+
//#region src/types/aigateway.generated.d.ts
|
|
788
|
+
type AIGateway = {
|
|
789
|
+
/** AI Gateway name */name: string; /** Auth namespace used to resolve request tokens against the workspace's auth */
|
|
790
|
+
authNamespace: string; /** Allowed CORS origins for browser-based clients. Each entry is `*`, `http(s)://*`, `http(s)://*.example.com`, or `http(s)://app.example.com`, optionally with `:port`. Empty list disables cross-origin access. */
|
|
791
|
+
cors?: string[] | undefined;
|
|
792
|
+
};
|
|
793
|
+
type AIGatewayInput = AIGateway;
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region src/types/aigateway-config.d.ts
|
|
796
|
+
declare const aiGatewayDefinitionBrand: unique symbol;
|
|
797
|
+
type AIGatewayDefinitionBrand = {
|
|
798
|
+
readonly [aiGatewayDefinitionBrand]: true;
|
|
799
|
+
};
|
|
800
|
+
/** Type accepted by `AppConfig.aiGateways`. Only values returned by `defineAIGateway()` satisfy this. */
|
|
801
|
+
type AIGatewayConfig = AIGatewayInput & AIGatewayDefinitionBrand;
|
|
802
|
+
//#endregion
|
|
787
803
|
//#region src/types/app-config.generated.d.ts
|
|
788
804
|
type LogLevelEnum = "DEBUG" | "INFO" | "WARN" | "ERROR" | "SILENT";
|
|
789
805
|
//#endregion
|
|
@@ -1368,9 +1384,10 @@ type WorkflowServiceInput = WorkflowServiceConfig;
|
|
|
1368
1384
|
* - `auth`: Single auth config object (not an array)
|
|
1369
1385
|
* - `idp`: Array of IdP configs, e.g. `[myIdp]`
|
|
1370
1386
|
* - `staticWebsites`: Array of static website configs, e.g. `[website]`
|
|
1387
|
+
* - `aiGateways`: Array of AI Gateway configs, e.g. `[gateway]`
|
|
1371
1388
|
* - `db`, `resolver`, `executor`, `workflow`: Service configs with file globs
|
|
1372
1389
|
*/
|
|
1373
|
-
interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[], Env extends Record<string, string | number | boolean> = Record<string, string | number | boolean>> {
|
|
1390
|
+
interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[], AIGateways extends AIGatewayConfig[] = AIGatewayConfig[], Env extends Record<string, string | number | boolean> = Record<string, string | number | boolean>> {
|
|
1374
1391
|
/** Application name (required). */
|
|
1375
1392
|
name: string;
|
|
1376
1393
|
/**
|
|
@@ -1407,6 +1424,8 @@ interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[
|
|
|
1407
1424
|
httpAdapter?: HttpAdapterServiceInput;
|
|
1408
1425
|
/** Static website configurations. Must be an array, e.g. `[website]`. */
|
|
1409
1426
|
staticWebsites?: StaticWebsites;
|
|
1427
|
+
/** AI Gateway configurations. Must be an array, e.g. `[gateway]`. */
|
|
1428
|
+
aiGateways?: AIGateways;
|
|
1410
1429
|
/** Secret Manager vault configurations. Keys are vault names, values are records of secret names to values. */
|
|
1411
1430
|
secrets?: SecretsConfig;
|
|
1412
1431
|
/**
|
|
@@ -1448,5 +1467,5 @@ type ConcurrencyPolicy = {
|
|
|
1448
1467
|
/** Maximum number of concurrent executions (1-1000) */maxConcurrentExecutions: number;
|
|
1449
1468
|
};
|
|
1450
1469
|
//#endregion
|
|
1451
|
-
export {
|
|
1452
|
-
//# sourceMappingURL=workflow.generated
|
|
1470
|
+
export { PermissionCondition as $, AuthExternalConfig as A, SCIMAttributeType as B, IdPGqlOperationsInput as C, AIGatewayInput as D, AIGatewayDefinitionBrand as E, DefinedAuth as F, AuthConnectionConfig as G, UserAttributeListKey as H, FederatedIdentity as I, TailorAnyDBType as J, AuthConnectionOAuth2Config as K, FederatedIdentityClaims as L, AuthServiceInput as M, BeforeLoginClaims as N, AuthConfig as O, BeforeLoginHookArgs as P, db as Q, FederatedIdentityProvider as R, IdPGqlOperations as S, AIGatewayConfig as T, UserAttributeMap as U, UserAttributeKey as V, UsernameFieldKey as W, TailorDBInstance as X, TailorDBField as Y, TailorDBType as Z, IdPConfig as _, ExecutorServiceConfig as a, AllowedValuesOutput as at, IdpDefinitionBrand as b, ResolverServiceConfig as c, WorkflowServiceInput as d, TailorTypeGqlPermission as et, StaticWebsiteConfig as f, SecretsDefinitionBrand as g, SecretsConfig as h, AppConfig as i, AllowedValues as it, AuthOwnConfig as j, AuthConnectionTokenResult as k, ResolverServiceInput as l, StaticWebsiteInput as m, RetryPolicy as n, unsafeAllowAllGqlPermission as nt, ExecutorServiceInput as o, StaticWebsiteDefinitionBrand as p, TailorAnyDBField as q, HttpAdapterConfigInput as r, unsafeAllowAllTypePermission as rt, ResolverExternalConfig as s, ConcurrencyPolicy as t, TailorTypePermission as tt, WorkflowServiceConfig as u, IdPExternalConfig as v, IdPInput as w, IdPEmailConfig as x, IdPUserField as y, OAuth2ClientGrantType as z };
|
|
1471
|
+
//# sourceMappingURL=workflow.generated--1Qc15Et.d.mts.map
|
package/docs/cli/completion.md
CHANGED
|
@@ -41,6 +41,9 @@ tailor-sdk completion [options] [shell]
|
|
|
41
41
|
| `--instructions` | `-i` | Show installation instructions | No | `false` |
|
|
42
42
|
| `--loader` | - | Print just the rc loader snippet (bash/zsh). Add it to ~/.bashrc or ~/.zshrc; it auto-regenerates the cache when the binary changes. | No | `false` |
|
|
43
43
|
| `--install` | - | Write the completion script to its on-disk cache (bash/zsh) or autoload location (fish) instead of printing it. | No | `false` |
|
|
44
|
+
| `--static` | - | Generate the legacy static completion script with command metadata baked in. | No | `false` |
|
|
45
|
+
| `--dispatcher` | - | Generate the runtime dispatcher completion script. This is the default. | No | `false` |
|
|
46
|
+
| `--worker` | - | Generate an internal static worker artifact for dispatcher mode. | No | `false` |
|
|
44
47
|
|
|
45
48
|
<!-- politty:command:completion:options:end -->
|
|
46
49
|
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# AI Gateway
|
|
2
|
+
|
|
3
|
+
AI Gateway provides a unified endpoint for accessing multiple LLM providers (Azure OpenAI, Google Vertex AI Gemini, Anthropic via Vertex AI) through a single OpenAI-compatible API, with platform-managed credentials and workspace-scoped authentication.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
AI Gateway provides:
|
|
8
|
+
|
|
9
|
+
- A unified, OpenAI-compatible endpoint for multiple LLM providers
|
|
10
|
+
- Mandatory authentication via your workspace's auth (request tokens are resolved against the configured auth namespace)
|
|
11
|
+
- Per-workspace isolation: each gateway is provisioned with its own platform-assigned URL
|
|
12
|
+
- Optional CORS allow-list for browser-based clients
|
|
13
|
+
- Built-in usage tracking and rate limiting (configured platform-side)
|
|
14
|
+
|
|
15
|
+
## Configuration
|
|
16
|
+
|
|
17
|
+
Configure an AI Gateway using `defineAIGateway()`:
|
|
18
|
+
|
|
19
|
+
**Definition Rules:**
|
|
20
|
+
|
|
21
|
+
- **Multiple gateways allowed**: You can define multiple AI Gateways in your config file
|
|
22
|
+
- **Configuration location**: Define in `tailor.config.ts` and add to the `aiGateways` array
|
|
23
|
+
- **Uniqueness**: Gateway names must be unique across all AI Gateways
|
|
24
|
+
- **Name pattern**: `name` must match `^[a-z0-9][a-z0-9-]{1,28}[a-z0-9]$` (lowercase alphanumeric and hyphens, 3-30 characters)
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { defineAIGateway, defineConfig } from "@tailor-platform/sdk";
|
|
28
|
+
|
|
29
|
+
const aiGateway = defineAIGateway("my-aigateway", {
|
|
30
|
+
authNamespace: "default",
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export default defineConfig({
|
|
34
|
+
aiGateways: [aiGateway],
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Options
|
|
39
|
+
|
|
40
|
+
### authNamespace
|
|
41
|
+
|
|
42
|
+
The auth namespace used to resolve request tokens against your workspace's auth configuration. Must match an existing auth namespace.
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
defineAIGateway("my-aigateway", {
|
|
46
|
+
authNamespace: "default",
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### cors
|
|
51
|
+
|
|
52
|
+
Optional list of allowed origins for browser-based clients. Each entry is one of:
|
|
53
|
+
|
|
54
|
+
- `*` — any origin (any scheme, any host)
|
|
55
|
+
- `http(s)://*` — any host on the given scheme
|
|
56
|
+
- `http(s)://*.example.com` — any subdomain of `example.com` on the given scheme
|
|
57
|
+
- `http(s)://app.example.com` — an exact origin
|
|
58
|
+
|
|
59
|
+
An optional `:port` may be appended in all URL forms. Omitting `cors` (or passing `[]`) disables cross-origin access — browsers will block any cross-origin reads.
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
defineAIGateway("my-aigateway", {
|
|
63
|
+
authNamespace: "default",
|
|
64
|
+
cors: ["https://app.example.com", "https://*.example.com"],
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Complete Example
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import {
|
|
72
|
+
defineAIGateway,
|
|
73
|
+
defineAuth,
|
|
74
|
+
defineConfig,
|
|
75
|
+
defineStaticWebSite,
|
|
76
|
+
} from "@tailor-platform/sdk";
|
|
77
|
+
|
|
78
|
+
const website = defineStaticWebSite("my-frontend", {
|
|
79
|
+
description: "Frontend application",
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const aiGateway = defineAIGateway("my-aigateway", {
|
|
83
|
+
authNamespace: "default",
|
|
84
|
+
cors: [website.url],
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const auth = defineAuth("my-auth", {
|
|
88
|
+
// ...auth configuration...
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export default defineConfig({
|
|
92
|
+
name: "my-app",
|
|
93
|
+
auth,
|
|
94
|
+
staticWebsites: [website],
|
|
95
|
+
aiGateways: [aiGateway],
|
|
96
|
+
});
|
|
97
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.66.0",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
"pathe": "2.0.3",
|
|
175
175
|
"pgsql-ast-parser": "12.0.2",
|
|
176
176
|
"pkg-types": "2.3.1",
|
|
177
|
-
"politty": "0.
|
|
177
|
+
"politty": "0.6.0",
|
|
178
178
|
"rolldown": "1.1.0",
|
|
179
179
|
"semver": "7.8.3",
|
|
180
180
|
"sql-highlight": "6.1.0",
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
"test:coverage": "vitest --coverage",
|
|
228
228
|
"docs:check": "vitest run --project=unit* src/cli/docs.test.ts",
|
|
229
229
|
"docs:update": "POLITTY_DOCS_UPDATE=true vitest run --project=unit* src/cli/docs.test.ts",
|
|
230
|
-
"build": "tsdown",
|
|
230
|
+
"build": "tsdown && politty generate-worker --bin dist/cli/index.mjs --program tailor-sdk --shell zsh --verify",
|
|
231
231
|
"lint": "oxlint --type-aware .",
|
|
232
232
|
"check:public-api-jsdoc": "tsx scripts/check-public-api-jsdoc.ts",
|
|
233
233
|
"lint:fix": "oxlint --type-aware . --fix",
|