@tailor-platform/sdk 1.65.0 → 1.66.1

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/{application-76hhIhnJ.mjs → application-DGDmL8i_.mjs} +31 -5
  3. package/dist/application-DGDmL8i_.mjs.map +1 -0
  4. package/dist/application-nTydHJm8.mjs +4 -0
  5. package/dist/cli/index.mjs +6 -6
  6. package/dist/cli/lib.d.mts +363 -356
  7. package/dist/cli/lib.mjs +3 -3
  8. package/dist/{client-CobIRHl-.mjs → client-F0a4cWUM.mjs} +3 -2
  9. package/dist/client-F0a4cWUM.mjs.map +1 -0
  10. package/dist/{client-C68VWo4g.mjs → client-boxXYevx.mjs} +1 -1
  11. package/dist/completion/zsh-worker.zsh +4043 -0
  12. package/dist/configure/index.d.mts +3 -3
  13. package/dist/configure/index.mjs +17 -1
  14. package/dist/configure/index.mjs.map +1 -1
  15. package/dist/{crashreport-BhD0y14F.mjs → crashreport-0EHy-ayY.mjs} +2 -2
  16. package/dist/{crashreport-BhD0y14F.mjs.map → crashreport-0EHy-ayY.mjs.map} +1 -1
  17. package/dist/{crashreport-D1wKBJ8N.mjs → crashreport-Bf6uT6mf.mjs} +1 -1
  18. package/dist/{index-DcXIjt9F.d.mts → index-BdLqzJDu.d.mts} +16 -3
  19. package/dist/{runtime-C7qTBDD2.mjs → runtime-2nzOZCUb.mjs} +240 -89
  20. package/dist/runtime-2nzOZCUb.mjs.map +1 -0
  21. package/dist/utils/test/index.d.mts +2 -2
  22. package/dist/{workflow.generated-CCDsY0ce.d.mts → workflow.generated--1Qc15Et.d.mts} +22 -3
  23. package/docs/cli/completion.md +3 -0
  24. package/docs/services/aigateway.md +97 -0
  25. package/package.json +5 -5
  26. package/dist/application-76hhIhnJ.mjs.map +0 -1
  27. package/dist/application-av2raLs6.mjs +0 -4
  28. package/dist/client-CobIRHl-.mjs.map +0 -1
  29. 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 { J as TailorDBType } from "../../workflow.generated-CCDsY0ce.mjs";
3
- import { At as TailorField, Ct as WORKFLOW_TEST_ENV_KEY, n as output } from "../../index-DcXIjt9F.mjs";
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 { unsafeAllowAllGqlPermission as $, BeforeLoginClaims as A, UserAttributeMap as B, IdPGqlOperationsInput as C, AuthExternalConfig as D, AuthConnectionTokenResult as E, FederatedIdentityProvider as F, TailorAnyDBType as G, AuthConnectionConfig as H, OAuth2ClientGrantType as I, TailorDBType as J, TailorDBField as K, SCIMAttributeType as L, DefinedAuth as M, FederatedIdentity as N, AuthOwnConfig as O, FederatedIdentityClaims as P, TailorTypePermission as Q, UserAttributeKey as R, IdPGqlOperations as S, AuthConfig as T, AuthConnectionOAuth2Config as U, UsernameFieldKey as V, TailorAnyDBField as W, PermissionCondition as X, db as Y, TailorTypeGqlPermission as Z, IdPConfig as _, ExecutorServiceConfig as a, IdpDefinitionBrand as b, ResolverServiceConfig as c, WorkflowServiceInput as d, unsafeAllowAllTypePermission as et, StaticWebsiteConfig as f, SecretsDefinitionBrand as g, SecretsConfig as h, AppConfig as i, BeforeLoginHookArgs as j, AuthServiceInput as k, ResolverServiceInput as l, StaticWebsiteInput as m, RetryPolicy as n, AllowedValuesOutput as nt, ExecutorServiceInput as o, StaticWebsiteDefinitionBrand as p, TailorDBInstance as q, HttpAdapterConfigInput as r, ResolverExternalConfig as s, ConcurrencyPolicy as t, AllowedValues as tt, WorkflowServiceConfig as u, IdPExternalConfig as v, IdPInput as w, IdPEmailConfig as x, IdPUserField as y, UserAttributeListKey as z };
1452
- //# sourceMappingURL=workflow.generated-CCDsY0ce.d.mts.map
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
@@ -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.65.0",
3
+ "version": "1.66.1",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -174,9 +174,9 @@
174
174
  "pathe": "2.0.3",
175
175
  "pgsql-ast-parser": "12.0.2",
176
176
  "pkg-types": "2.3.1",
177
- "politty": "0.5.1",
177
+ "politty": "0.6.0",
178
178
  "rolldown": "1.1.0",
179
- "semver": "7.8.3",
179
+ "semver": "7.8.4",
180
180
  "sql-highlight": "6.1.0",
181
181
  "std-env": "4.1.0",
182
182
  "table": "6.9.0",
@@ -191,7 +191,7 @@
191
191
  "@opentelemetry/sdk-trace-base": "2.8.0",
192
192
  "@types/madge": "5.0.3",
193
193
  "@types/mime-types": "3.0.1",
194
- "@types/node": "24.13.1",
194
+ "@types/node": "24.13.2",
195
195
  "@types/semver": "7.7.1",
196
196
  "@typescript/native-preview": "7.0.0-dev.20260612.1",
197
197
  "@vitest/coverage-v8": "4.1.8",
@@ -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",