@tailor-platform/sdk 2.29.2 → 2.32.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/ai/index.d.mts +112 -0
  3. package/dist/ai/index.mjs +2 -0
  4. package/dist/ai/index.mjs.map +1 -0
  5. package/dist/{application-Dm_21z-i.mjs → application-C2bPmmbh.mjs} +1 -1
  6. package/dist/{application-D8jruzwo.mjs → application-D0xNJbag.mjs} +32 -32
  7. package/dist/{application-D8jruzwo.mjs.map → application-D0xNJbag.mjs.map} +1 -1
  8. package/dist/cli/commands/machineuser/list.d.mts +2 -1
  9. package/dist/cli/lib.mjs +1 -1
  10. package/dist/cli/main.mjs +17 -17
  11. package/dist/cli/main.mjs.map +1 -1
  12. package/dist/cli/shared/error-json.d.mts +2 -0
  13. package/dist/completion/zsh-worker.zsh +6 -2
  14. package/dist/{crashreport-BAG8c7hB.mjs → crashreport-BCIy33Cz.mjs} +2 -2
  15. package/dist/{crashreport-BAG8c7hB.mjs.map → crashreport-BCIy33Cz.mjs.map} +1 -1
  16. package/dist/crashreport-IN6H7GX3.mjs +1 -0
  17. package/dist/errors-BOF68LJ5.mjs +5 -0
  18. package/dist/errors-BOF68LJ5.mjs.map +1 -0
  19. package/dist/{kysely-type-BWMfV301.mjs → kysely-type-CBwsdx16.mjs} +6 -3
  20. package/dist/kysely-type-CBwsdx16.mjs.map +1 -0
  21. package/dist/{logger-DuaT2zY3.mjs → logger-RgtbhJ83.mjs} +3 -3
  22. package/dist/logger-RgtbhJ83.mjs.map +1 -0
  23. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  24. package/dist/plugin/builtin/seed/index.mjs +1 -1
  25. package/dist/register-ts-hook-_dHIREtU.mjs +1050 -0
  26. package/dist/register-ts-hook-_dHIREtU.mjs.map +1 -0
  27. package/dist/seed/idp-user-password.d.mts +15 -0
  28. package/dist/seed/index.d.mts +19 -1
  29. package/dist/seed/index.mjs +6 -6
  30. package/dist/seed/index.mjs.map +1 -1
  31. package/dist/{seed-C3P_T_Eh.mjs → seed-Cn-3JApy.mjs} +12 -8
  32. package/dist/seed-Cn-3JApy.mjs.map +1 -0
  33. package/dist/{service-l_tEI8sS.mjs → service-9SBPNpK8.mjs} +2 -2
  34. package/dist/{service-l_tEI8sS.mjs.map → service-9SBPNpK8.mjs.map} +1 -1
  35. package/dist/{service-b1g22NN9.mjs → service-9rwi_I4d.mjs} +2 -2
  36. package/dist/{service-b1g22NN9.mjs.map → service-9rwi_I4d.mjs.map} +1 -1
  37. package/dist/service-Ca1WwyIt.mjs +1 -0
  38. package/dist/telemetry-DfT2UfI4.mjs +2 -0
  39. package/dist/telemetry-DfT2UfI4.mjs.map +1 -0
  40. package/dist/{telemetry-DpkFGBmu.mjs → telemetry-nqOtDWNO.mjs} +1 -1
  41. package/docs/ai.md +92 -0
  42. package/docs/cli/application.md +4 -0
  43. package/docs/cli/auth.md +4 -0
  44. package/docs/cli/completion.md +4 -0
  45. package/docs/cli/crashreport.md +4 -0
  46. package/docs/cli/data.md +4 -0
  47. package/docs/cli/executor.md +4 -0
  48. package/docs/cli/function.md +4 -0
  49. package/docs/cli/organization.md +4 -0
  50. package/docs/cli/plugin.md +4 -0
  51. package/docs/cli/query.md +4 -0
  52. package/docs/cli/secret.md +4 -0
  53. package/docs/cli/skills.md +4 -0
  54. package/docs/cli/staticwebsite.md +4 -0
  55. package/docs/cli/tailordb.md +21 -15
  56. package/docs/cli/upgrade.md +4 -0
  57. package/docs/cli/user.md +4 -0
  58. package/docs/cli/workflow.md +4 -0
  59. package/docs/cli/workspace.md +5 -1
  60. package/docs/cli-reference.md +4 -0
  61. package/docs/configuration.md +4 -0
  62. package/docs/data-clone.md +4 -0
  63. package/docs/github-actions.md +108 -11
  64. package/docs/migration/v2.md +4 -0
  65. package/docs/multi-environment.md +4 -0
  66. package/docs/plugin/custom.md +4 -0
  67. package/docs/plugin/frontend.md +4 -0
  68. package/docs/plugin/index.md +4 -0
  69. package/docs/quickstart.md +4 -0
  70. package/docs/runtime.md +4 -0
  71. package/docs/services/aigateway.md +4 -0
  72. package/docs/services/auth.md +4 -0
  73. package/docs/services/executor.md +4 -0
  74. package/docs/services/http-adapter.md +4 -0
  75. package/docs/services/idp.md +4 -0
  76. package/docs/services/resolver.md +4 -0
  77. package/docs/services/secret.md +4 -0
  78. package/docs/services/staticwebsite.md +4 -0
  79. package/docs/services/tailordb/index.md +4 -0
  80. package/docs/services/tailordb/migration.md +49 -31
  81. package/docs/services/workflow.md +4 -0
  82. package/docs/testing.md +6 -1
  83. package/package.json +16 -9
  84. package/dist/crashreport-BcXuocwI.mjs +0 -1
  85. package/dist/errors-D3qpNHR6.mjs +0 -7
  86. package/dist/errors-D3qpNHR6.mjs.map +0 -1
  87. package/dist/kysely-type-BWMfV301.mjs.map +0 -1
  88. package/dist/logger-DuaT2zY3.mjs.map +0 -1
  89. package/dist/register-ts-hook-B5ZbbJwS.mjs +0 -1012
  90. package/dist/register-ts-hook-B5ZbbJwS.mjs.map +0 -1
  91. package/dist/seed-C3P_T_Eh.mjs.map +0 -1
  92. package/dist/service-C_CogLQr.mjs +0 -1
  93. package/dist/telemetry-Xk7J829P.mjs +0 -2
  94. package/dist/telemetry-Xk7J829P.mjs.map +0 -1
  95. package/docs/migration/v3.md +0 -277
package/CHANGELOG.md CHANGED
@@ -1,5 +1,75 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 2.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2697](https://github.com/tailor-platform/sdk/pull/2697) [`8706209`](https://github.com/tailor-platform/sdk/commit/870620945d19e068add0092c01c2bbbb68c2061b) Thanks [@dqn](https://github.com/dqn)! - Add a provider-independent System One client for boolean, choice, and ordered score decisions through AI Gateway.
8
+
9
+ - [#2727](https://github.com/tailor-platform/sdk/pull/2727) [`cc8a577`](https://github.com/tailor-platform/sdk/commit/cc8a5777314ac9daaf32b9659b182d1585f5a173) Thanks [@toiroakr](https://github.com/toiroakr)! - `tailordb migration test` now records a 24-hour expiry on every temporary workspace it creates, right after creating it. If the run is interrupted (for example, a cancelled CI job), the workspace stays and `tailor workspace prune --expired` deletes it once the expiry has passed. A workspace given with `--target-workspace-id` gets no expiry, and `--keep` without `--keep-ttl` still records none.
10
+
11
+ - [#2696](https://github.com/tailor-platform/sdk/pull/2696) [`dc605c2`](https://github.com/tailor-platform/sdk/commit/dc605c207e6af179dc000b747def7f41fefedc66) Thanks [@toiroakr](https://github.com/toiroakr)! - `kyselyTypePlugin`'s `pgliteSchemaPath` script now enforces relations: a row pointing at a parent that does not exist is rejected, as on the platform. Tests that insert child rows before their parents must create the parents first.
12
+
13
+ A relation to a field other than `id` that is not unique, or whose type differs from the referencing field, fails generation, as the platform rejects it on deploy.
14
+
15
+ ### Patch Changes
16
+
17
+ - [#2725](https://github.com/tailor-platform/sdk/pull/2725) [`c85d2d8`](https://github.com/tailor-platform/sdk/commit/c85d2d8f27be5a02117f1d6197390b159b36df15) Thanks [@dqn](https://github.com/dqn)! - Fix migration detection and Pre-phase relaxation for nested required and enum constraints, and reject unsupported nested shape changes and rename combinations.
18
+
19
+ - [#2724](https://github.com/tailor-platform/sdk/pull/2724) [`6152316`](https://github.com/tailor-platform/sdk/commit/615231674d129ca888b5c8be599b1f54bdea4fdc) Thanks [@dqn](https://github.com/dqn)! - `tailor deploy` and `tailor remove` no longer fail when deleting an IdP client whose Secret Manager vault (`idp-<namespace>-<client>`) has already been deleted.
20
+
21
+ - [`127454d`](https://github.com/tailor-platform/sdk/commit/127454d6cd9d4fe20ccc3504f44430650874df71) Thanks [@haru0017](https://github.com/haru0017)! - Re-apply rolldown 1.2.14
22
+
23
+ rolldown's output was fine; the crash came from another platform dependency, which has been fixed, so the temporary downgrade to 1.2.13 is no longer needed.
24
+
25
+ - [#2685](https://github.com/tailor-platform/sdk/pull/2685) [`3b21d1c`](https://github.com/tailor-platform/sdk/commit/3b21d1c36e8eaa282374b9e9601e95537ac00377) Thanks [@dqn](https://github.com/dqn)! - Split how `tailor deploy` applies TailorDB changes and migrations into smaller steps. No observable behavior change.
26
+
27
+ - [#2707](https://github.com/tailor-platform/sdk/pull/2707) [`ab7cb70`](https://github.com/tailor-platform/sdk/commit/ab7cb704ece975c7e3b7a2868ec71077643e26ac) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency kysely to v0.29.7
28
+
29
+ - [#2716](https://github.com/tailor-platform/sdk/pull/2716) [`698343b`](https://github.com/tailor-platform/sdk/commit/698343bbcc0fedfa790e2a3e085423f19b0e608c) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency execa to v10.2.0
30
+
31
+ - [#2726](https://github.com/tailor-platform/sdk/pull/2726) [`bfea8a3`](https://github.com/tailor-platform/sdk/commit/bfea8a3c5653017fc9b798e30e674b0e0a4f9859) Thanks [@dqn](https://github.com/dqn)! - Fix migration templates to replace removed enum values within array fields while preserving other elements.
32
+
33
+ ## 2.31.1
34
+
35
+ ### Patch Changes
36
+
37
+ - [#2714](https://github.com/tailor-platform/sdk/pull/2714) [`5db635d`](https://github.com/tailor-platform/sdk/commit/5db635dad2db0e333a94998c59b83ecffe696506) Thanks [@dragon3](https://github.com/dragon3)! - List `europe-west` in the workspace regions shown by `tailor workspace create --help`, matching the regions the Platform now offers for workspace creation (`asia-northeast, us-west, europe-west`).
38
+
39
+ ## 2.31.0
40
+
41
+ ### Minor Changes
42
+
43
+ - [#2563](https://github.com/tailor-platform/sdk/pull/2563) [`8fdb4e8`](https://github.com/tailor-platform/sdk/commit/8fdb4e81d1dd362f0ad1ad5608885d9df5c9651c) Thanks [@toiroakr](https://github.com/toiroakr)! - `tailor tailordb migration test` now accepts `--organization-id` and `--folder-id` to choose where the temporary workspace is created. With only `--organization-id` it is created at that organization's root; with `--folder-id` it is created in that folder, and the command fails before creating anything if the folder is not found in the organization (`--folder-id` alone also fails when the source workspace is not in an organization, so pass `--organization-id` with it). Without either option it still follows the source workspace's organization and folder. With `--target-workspace-id`, the given organization and folder must match the ones the target workspace is already in; otherwise the command fails and names the mismatch.
44
+
45
+ ### Patch Changes
46
+
47
+ - [#2705](https://github.com/tailor-platform/sdk/pull/2705) [`d579565`](https://github.com/tailor-platform/sdk/commit/d579565ff260258c0fa96b331204160539d28500) Thanks [@toiroakr](https://github.com/toiroakr)! - `tailor deploy` no longer reads an IdP client's `clientSecret` from the list response. When a deploy forced by an SDK version change finds that an IdP client's secret vault is missing, it now fetches the client with `getIdPClient` and creates the secret from that value. This keeps the deploy working when the platform stops returning `clientSecret` from the list API.
48
+
49
+ - [#2715](https://github.com/tailor-platform/sdk/pull/2715) [`6b9b5b2`](https://github.com/tailor-platform/sdk/commit/6b9b5b290ed7aae3a606263223d7863155fc61a5) Thanks [@toiroakr](https://github.com/toiroakr)! - Replace the `@opentelemetry/sdk-trace-node` dependency with `@opentelemetry/sdk-trace` for CLI telemetry.
50
+
51
+ ## 2.30.0
52
+
53
+ ### Minor Changes
54
+
55
+ - [#2686](https://github.com/tailor-platform/sdk/pull/2686) [`b77ebdd`](https://github.com/tailor-platform/sdk/commit/b77ebddfebc3e7472f17c31bb03f340ba4f21ce6) Thanks [@toiroakr](https://github.com/toiroakr)! - `tailor machineuser list` no longer outputs `clientSecret`, and `MachineUserInfo.clientSecret` returned by `listMachineUsers` is now an optional property that is never set and is marked `@deprecated`. The Platform is moving to return a machine user's secret only from the single-user get call, so that a read-only credential can list machine users. TypeScript code that reads `MachineUserInfo.clientSecret` keeps compiling but receives `undefined`; scripts that read `clientSecret` from the JSON output of `machineuser list` no longer find the key. Use `tailor machineuser token <name>` to obtain an access token for a machine user instead.
56
+
57
+ - [#2647](https://github.com/tailor-platform/sdk/pull/2647) [`e45ca2b`](https://github.com/tailor-platform/sdk/commit/e45ca2b23835ba8e86f8707f270ade8039ec30c6) Thanks [@toiroakr](https://github.com/toiroakr)! - The password of IdP users (`_User`) can now come from the `SEED_USER_PASSWORD` environment variable. A `_User` row without a `password` gets it from the variable: a plain string is used for every such user, and a JSON object such as `{"alice@example.com":"..."}` sets it per user name. A password written in `_User.jsonl` is kept, and with `--upsert` the variable only sets the password of users that do not exist yet. `tailor seed validate` and `tailor seed apply` both apply it, and the generated `_User.schema.ts` calls it from its `hook`, so run `tailor generate` to update existing projects. The workflows `tailor setup ci` generates pass the `SEED_USER_PASSWORD` secret to the seed steps; run `tailor setup update` to regenerate them.
58
+
59
+ ### Patch Changes
60
+
61
+ - [#2683](https://github.com/tailor-platform/sdk/pull/2683) [`2905c85`](https://github.com/tailor-platform/sdk/commit/2905c85821d7371ccda4c467460a2b1bd1364009) Thanks [@dqn](https://github.com/dqn)! - Hide secrets that contain a line break or a quote in CLI errors and suggested commands. Values the CLI masks as `<redacted>`, such as client secrets and access tokens, appeared unmasked in multi-line error details and suggestions, in suggested commands, and in the matching GitHub Actions annotation.
62
+
63
+ - [#2668](https://github.com/tailor-platform/sdk/pull/2668) [`ad679fa`](https://github.com/tailor-platform/sdk/commit/ad679fa432e9d50a714529bb68239dca495acabc) Thanks [@dqn](https://github.com/dqn)! - Hide secrets in CLI log output and `--json` error output when only part of the value is highlighted, and in progress spinner lines. Values the CLI masks as `<redacted>`, such as client secrets and access tokens, appeared unmasked in these cases. `--json` error output no longer includes color codes in its string values.
64
+
65
+ - [#2689](https://github.com/tailor-platform/sdk/pull/2689) [`9bffa6e`](https://github.com/tailor-platform/sdk/commit/9bffa6ed8a44d12c2ab8bdc607f8fcd53921e037) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency lines-db to v0.18.0
66
+
67
+ - [#2699](https://github.com/tailor-platform/sdk/pull/2699) [`ae44247`](https://github.com/tailor-platform/sdk/commit/ae44247178e8fabb21762f552e50525da046a2e0) Thanks [@haru0017](https://github.com/haru0017)! - Revert "fix(deps): update dependency rolldown to v1.2.14"
68
+
69
+ rolldown 1.2.14 can emit a malformed source map (a negative source line) for bundled functions, which can crash the platform runtime on debug builds while source-mapping a thrown error's stack trace. Downgrade to 1.2.13 as a temporary measure until the rolldown regression is resolved.
70
+
71
+ - [#2693](https://github.com/tailor-platform/sdk/pull/2693) [`373dafd`](https://github.com/tailor-platform/sdk/commit/373dafdac2b5da3bcf172f9a48a6c530b410f21b) Thanks [@toiroakr](https://github.com/toiroakr)! - Stop `tailor deploy` from reporting `Table '<name>' scripts differ between remote and snapshot` when machines with different system locales deploy the same schema. The TailorDB script hash ordered field names by the machine's default locale (for example, Czech sorts `ch` after `h`), so the same schema could hash differently and fail the deploy with remote schema drift. Hashes from en-US, ja-JP and C locales are unchanged. A table with scripts that was last deployed from a locale that orders its field names differently from English (for example cs-CZ, sk-SK, lt-LT or et-EE) may report this drift after upgrading, because the hash stored on the remote was computed in that locale's order.
72
+
3
73
  ## 2.29.2
4
74
 
5
75
  ### Patch Changes
@@ -0,0 +1,112 @@
1
+ //#region src/ai/index.d.ts
2
+ /**
3
+ * Client for semantic decisions through Tailor AI Gateway.
4
+ *
5
+ * @example
6
+ * import { createSystemOne } from "@tailor-platform/sdk/ai";
7
+ *
8
+ * const systemOne = createSystemOne({
9
+ * baseURL: "https://my-aigateway.example.com",
10
+ * token: accessToken,
11
+ * });
12
+ *
13
+ * const decision = await systemOne.choice({
14
+ * state: { subject: "Charged twice" },
15
+ * question: "Which department should handle this ticket?",
16
+ * choices: ["billing", "sales", "support"],
17
+ * });
18
+ */
19
+ /** Error codes returned for System One decisions. */
20
+ export type SystemOneErrorCode = "INVALID_REQUEST" | "INVALID_ANSWER_SPACE" | "UNAUTHORIZED" | "PROVIDER_UNAVAILABLE" | "PROVIDER_TIMEOUT" | "RATE_LIMITED" | "MODEL_ERROR";
21
+ /** Error returned when a System One decision cannot be completed. */
22
+ export declare class SystemOneError extends Error {
23
+ /** Stable, provider-independent error code. */
24
+ readonly code: SystemOneErrorCode;
25
+ /** HTTP status returned by AI Gateway, when available. */
26
+ readonly status?: number;
27
+ /**
28
+ * Create a System One error.
29
+ * @param message - Human-readable error message
30
+ * @param code - Stable error code
31
+ * @param options - Additional error details
32
+ */
33
+ constructor(message: string, code: SystemOneErrorCode, options?: ErrorOptions & {
34
+ status?: number;
35
+ });
36
+ }
37
+ /** Options used to connect a System One client to Tailor AI Gateway. */
38
+ export interface CreateSystemOneOptions {
39
+ /** AI Gateway base URL. */
40
+ baseURL: string | URL;
41
+ /** Access token issued by the AI Gateway's auth namespace. Omit this inside a Tailor Function. */
42
+ token?: string | (() => string | Promise<string>);
43
+ /** Milliseconds, as a non-negative integer, to wait for AI Gateway to respond before failing with `PROVIDER_TIMEOUT`. Omit to wait until AI Gateway responds. */
44
+ timeoutMs?: number;
45
+ /** Custom Fetch implementation. */
46
+ fetch?: typeof globalThis.fetch;
47
+ }
48
+ /** Common input shared by all System One decisions. */
49
+ export interface SystemOneInput {
50
+ /** Data used to make the decision: a JSON object, array, string, or `null`. */
51
+ state: unknown;
52
+ /** Natural-language question to answer. */
53
+ question: string;
54
+ /** Decision model. Defaults to `jev-1.13.0`. */
55
+ model?: string;
56
+ }
57
+ /** Input for a choice decision. */
58
+ export interface ChoiceInput<Choices extends readonly [string, ...string[]]> extends SystemOneInput {
59
+ /** Allowed answers. Each value must be unique. */
60
+ choices: Choices;
61
+ }
62
+ /** Result of a choice or score decision. */
63
+ export interface ChoiceResult<Value extends string> {
64
+ /** Selected answer. */
65
+ value: Value;
66
+ /** Probability for every allowed answer. */
67
+ probabilities: Record<Value, number>;
68
+ /** Provider-reported confidence in the selected answer. */
69
+ confidence: number;
70
+ }
71
+ /** Input for a boolean decision. */
72
+ export type BooleanInput = SystemOneInput;
73
+ /** Result of a boolean decision. */
74
+ export interface BooleanResult {
75
+ /** `true` when the probability of "yes" is at least 0.5. */
76
+ value: boolean;
77
+ /** Probability assigned to the selected answer. */
78
+ probability: number;
79
+ }
80
+ /** Input for an ordered score decision. */
81
+ export interface ScoreInput<Levels extends readonly [string, string, ...string[]]> extends SystemOneInput {
82
+ /** Ordered score levels, from lowest to highest. Each level must be unique. */
83
+ levels: Levels;
84
+ }
85
+ /** System One semantic decision client. */
86
+ export interface SystemOneClient {
87
+ /**
88
+ * Select one value from an answer space.
89
+ * @param input - State, question, and allowed choices
90
+ * @returns The selected value and its probability distribution
91
+ */
92
+ choice<const Choices extends readonly [string, ...string[]]>(input: ChoiceInput<Choices>): Promise<ChoiceResult<Choices[number]>>;
93
+ /**
94
+ * Answer a binary question.
95
+ * @param input - State and question
96
+ * @returns The boolean answer and its probability
97
+ */
98
+ boolean(input: BooleanInput): Promise<BooleanResult>;
99
+ /**
100
+ * Select one value from an ordered answer space. The level with the highest probability is selected.
101
+ * @param input - State, question, and ordered score levels
102
+ * @returns The selected level and its probability distribution
103
+ */
104
+ score<const Levels extends readonly [string, string, ...string[]]>(input: ScoreInput<Levels>): Promise<ChoiceResult<Levels[number]>>;
105
+ }
106
+ /**
107
+ * Create a System One client that makes decisions through Tailor AI Gateway.
108
+ * @param options - AI Gateway connection options
109
+ * @returns A semantic decision client
110
+ */
111
+ export declare function createSystemOne(options: CreateSystemOneOptions): SystemOneClient;
112
+ //#endregion
@@ -0,0 +1,2 @@
1
+ var SystemOneError=class extends Error{code;status;constructor(e,t,n={}){super(e,n),this.name=`SystemOneError`,this.code=t,this.status=n.status}};function endpoint(e){return`${String(e).replace(/\/+$/,``)}/v1/systemone`}async function resolveToken(e){return typeof e==`function`?e():e}function asObject(e){return typeof e==`object`&&e?e:void 0}function isProbability(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=1}function invalidResponse(e){return new SystemOneError(e,`MODEL_ERROR`)}function assertUniqueAnswers(e){if(new Set(e).size!==e.length)throw new SystemOneError(`System One answer values must be unique.`,`INVALID_ANSWER_SPACE`)}function invalidState(e){return new SystemOneError(`System One state must be a JSON object, array, string, or null.`,`INVALID_REQUEST`,e)}function toDecisionState(e){let t;try{let n=JSON.stringify(e);t=n===void 0?void 0:JSON.parse(n)}catch(e){throw invalidState({cause:e})}if(typeof t!=`string`&&typeof t!=`object`)throw invalidState();return t}function errorCode(e){return e===401||e===403?`UNAUTHORIZED`:e===408||e===504?`PROVIDER_TIMEOUT`:e===429?`RATE_LIMITED`:e>=500?`PROVIDER_UNAVAILABLE`:e>=400?`INVALID_REQUEST`:`MODEL_ERROR`}function errorMessage(e){if(typeof e==`string`)return e.trim()||void 0;let t=asObject(e),n=asObject(t?.error)?.message;if(typeof n==`string`)return n;if(typeof t?.message==`string`)return t.message;if(typeof t?.detail==`string`)return t.detail;if(Array.isArray(t?.detail)){let e=t.detail.map(e=>asObject(e)?.msg).filter(e=>typeof e==`string`);return e.length>0?e.join(`; `):void 0}}async function readErrorMessage(e){let t=await e.text().catch(()=>``);try{return errorMessage(JSON.parse(t))}catch{return errorMessage(t)}}function isTimeout(e){return e instanceof Error&&e.name===`TimeoutError`}function timeoutError(e,t){return new SystemOneError(`AI Gateway request timed out.`,`PROVIDER_TIMEOUT`,{cause:e,status:t})}async function readJSON(e){try{return await e.json()}catch(t){throw isTimeout(t)?timeoutError(t,e.status):new SystemOneError(`AI Gateway returned an invalid JSON response.`,`MODEL_ERROR`,{cause:t,status:e.status})}}async function evaluate(e,t,n){let r=JSON.stringify({model:t.model??`jev-1.13.0`,state:toDecisionState(t.state),questions:{decision:n}}),i=await resolveToken(e.token),a=new Headers({"content-type":`application/json`});i&&a.set(`authorization`,`Bearer ${i}`);let o=e.fetch??globalThis.fetch,s=e.timeoutMs===void 0?void 0:AbortSignal.timeout(e.timeoutMs),c;try{c=await o(endpoint(e.baseURL),{method:`POST`,headers:a,body:r,signal:s})}catch(e){throw isTimeout(e)?timeoutError(e):new SystemOneError(`Unable to reach AI Gateway.`,`PROVIDER_UNAVAILABLE`,{cause:e})}if(!c.ok)throw new SystemOneError(await readErrorMessage(c)??`System One decision request failed.`,errorCode(c.status),{status:c.status});let l=asObject(asObject(asObject(await readJSON(c))?.answers)?.decision);if(l?.type!==n.type)throw invalidResponse(`AI Gateway response did not contain a decision answer.`);return l}function parseChoiceAnswer(e,t){if(typeof e.choice!=`string`||!t.includes(e.choice))throw invalidResponse(`System One returned a value outside the requested answer space.`);let n=asObject(e.probabilities);if(!n)throw invalidResponse(`System One returned an invalid probability distribution.`);let r=Object.fromEntries(t.map(e=>{let t=n[e];if(!isProbability(t))throw invalidResponse(`System One returned an invalid probability for "${e}".`);return[e,t]}));if(!isProbability(e.confidence))throw invalidResponse(`System One returned an invalid confidence value.`);return{value:e.choice,probabilities:r,confidence:e.confidence}}function parseBooleanAnswer(e){if(!isProbability(e.noul))throw invalidResponse(`System One returned an invalid probability.`);let t=e.noul>=.5;return{value:t,probability:t?e.noul:1-e.noul}}function parseScoreAnswer(e,t){let n=asObject(e.probabilities);if(!n)throw invalidResponse(`System One returned an invalid probability distribution.`);let r=t.map((e,t)=>{let r=n[String(t)];if(!isProbability(r))throw invalidResponse(`System One returned an invalid probability for "${e}".`);return{level:e,probability:r}});if(!isProbability(e.confidence))throw invalidResponse(`System One returned an invalid confidence value.`);return{value:r.reduce((e,t)=>t.probability>e.probability?t:e).level,probabilities:Object.fromEntries(r.map(({level:e,probability:t})=>[e,t])),confidence:e.confidence}}function createSystemOne(e){return{choice:async t=>(assertUniqueAnswers(t.choices),parseChoiceAnswer(await evaluate(e,t,{type:`choice`,instructions:t.question,criteria:Object.fromEntries(t.choices.map(e=>[e,null]))}),t.choices)),boolean:async t=>parseBooleanAnswer(await evaluate(e,t,{type:`noul`,instructions:t.question})),score:async t=>(assertUniqueAnswers(t.levels),parseScoreAnswer(await evaluate(e,t,{type:`score`,instructions:t.question,criteria:t.levels}),t.levels))}}export{SystemOneError,createSystemOne};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["message","options","code","baseURL","token","value","values","serialized","state","cause","status","payload","root","nested","messages","detail","text","response","body","input","question","headers","fetchImplementation","signal","answer","choices","rawProbabilities","probabilities","probability","choice","scores","levels","index","level","score","selected"],"sources":["../../src/ai/index.ts"],"sourcesContent":["/**\n * Client for semantic decisions through Tailor AI Gateway.\n *\n * @example\n * import { createSystemOne } from \"@tailor-platform/sdk/ai\";\n *\n * const systemOne = createSystemOne({\n * baseURL: \"https://my-aigateway.example.com\",\n * token: accessToken,\n * });\n *\n * const decision = await systemOne.choice({\n * state: { subject: \"Charged twice\" },\n * question: \"Which department should handle this ticket?\",\n * choices: [\"billing\", \"sales\", \"support\"],\n * });\n */\n\n/** Error codes returned for System One decisions. */\nexport type SystemOneErrorCode =\n | \"INVALID_REQUEST\"\n | \"INVALID_ANSWER_SPACE\"\n | \"UNAUTHORIZED\"\n | \"PROVIDER_UNAVAILABLE\"\n | \"PROVIDER_TIMEOUT\"\n | \"RATE_LIMITED\"\n | \"MODEL_ERROR\";\n\n/** Error returned when a System One decision cannot be completed. */\nexport class SystemOneError extends Error {\n /** Stable, provider-independent error code. */\n readonly code: SystemOneErrorCode;\n\n /** HTTP status returned by AI Gateway, when available. */\n readonly status?: number;\n\n /**\n * Create a System One error.\n * @param message - Human-readable error message\n * @param code - Stable error code\n * @param options - Additional error details\n */\n constructor(\n message: string,\n code: SystemOneErrorCode,\n options: ErrorOptions & { status?: number } = {},\n ) {\n super(message, options);\n this.name = \"SystemOneError\";\n this.code = code;\n this.status = options.status;\n }\n}\n\n/** Options used to connect a System One client to Tailor AI Gateway. */\nexport interface CreateSystemOneOptions {\n /** AI Gateway base URL. */\n baseURL: string | URL;\n /** Access token issued by the AI Gateway's auth namespace. Omit this inside a Tailor Function. */\n token?: string | (() => string | Promise<string>);\n /** Milliseconds, as a non-negative integer, to wait for AI Gateway to respond before failing with `PROVIDER_TIMEOUT`. Omit to wait until AI Gateway responds. */\n timeoutMs?: number;\n /** Custom Fetch implementation. */\n fetch?: typeof globalThis.fetch;\n}\n\n/** Common input shared by all System One decisions. */\nexport interface SystemOneInput {\n /** Data used to make the decision: a JSON object, array, string, or `null`. */\n state: unknown;\n /** Natural-language question to answer. */\n question: string;\n /** Decision model. Defaults to `jev-1.13.0`. */\n model?: string;\n}\n\n/** Input for a choice decision. */\nexport interface ChoiceInput<\n Choices extends readonly [string, ...string[]],\n> extends SystemOneInput {\n /** Allowed answers. Each value must be unique. */\n choices: Choices;\n}\n\n/** Result of a choice or score decision. */\nexport interface ChoiceResult<Value extends string> {\n /** Selected answer. */\n value: Value;\n /** Probability for every allowed answer. */\n probabilities: Record<Value, number>;\n /** Provider-reported confidence in the selected answer. */\n confidence: number;\n}\n\n/** Input for a boolean decision. */\nexport type BooleanInput = SystemOneInput;\n\n/** Result of a boolean decision. */\nexport interface BooleanResult {\n /** `true` when the probability of \"yes\" is at least 0.5. */\n value: boolean;\n /** Probability assigned to the selected answer. */\n probability: number;\n}\n\n/** Input for an ordered score decision. */\nexport interface ScoreInput<\n Levels extends readonly [string, string, ...string[]],\n> extends SystemOneInput {\n /** Ordered score levels, from lowest to highest. Each level must be unique. */\n levels: Levels;\n}\n\n/** System One semantic decision client. */\nexport interface SystemOneClient {\n /**\n * Select one value from an answer space.\n * @param input - State, question, and allowed choices\n * @returns The selected value and its probability distribution\n */\n choice<const Choices extends readonly [string, ...string[]]>(\n input: ChoiceInput<Choices>,\n ): Promise<ChoiceResult<Choices[number]>>;\n\n /**\n * Answer a binary question.\n * @param input - State and question\n * @returns The boolean answer and its probability\n */\n boolean(input: BooleanInput): Promise<BooleanResult>;\n\n /**\n * Select one value from an ordered answer space. The level with the highest probability is selected.\n * @param input - State, question, and ordered score levels\n * @returns The selected level and its probability distribution\n */\n score<const Levels extends readonly [string, string, ...string[]]>(\n input: ScoreInput<Levels>,\n ): Promise<ChoiceResult<Levels[number]>>;\n}\n\ntype DecisionQuestion =\n | { type: \"noul\"; instructions: string }\n | { type: \"choice\"; instructions: string; criteria: Record<string, null> }\n | { type: \"score\"; instructions: string; criteria: readonly string[] };\n\ntype DecisionAnswer = Record<string, unknown>;\n\nconst defaultModel = \"jev-1.13.0\";\n\nfunction endpoint(baseURL: string | URL): string {\n return `${String(baseURL).replace(/\\/+$/, \"\")}/v1/systemone`;\n}\n\nasync function resolveToken(token: CreateSystemOneOptions[\"token\"]): Promise<string | undefined> {\n return typeof token === \"function\" ? token() : token;\n}\n\nfunction asObject(value: unknown): Record<string, unknown> | undefined {\n return typeof value === \"object\" && value !== null\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\nfunction isProbability(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value) && value >= 0 && value <= 1;\n}\n\nfunction invalidResponse(message: string): SystemOneError {\n return new SystemOneError(message, \"MODEL_ERROR\");\n}\n\nfunction assertUniqueAnswers(values: readonly string[]): void {\n if (new Set(values).size !== values.length) {\n throw new SystemOneError(\"System One answer values must be unique.\", \"INVALID_ANSWER_SPACE\");\n }\n}\n\nfunction invalidState(options?: ErrorOptions): SystemOneError {\n return new SystemOneError(\n \"System One state must be a JSON object, array, string, or null.\",\n \"INVALID_REQUEST\",\n options,\n );\n}\n\nfunction toDecisionState(state: unknown): unknown {\n let value: unknown;\n try {\n const serialized = JSON.stringify(state) as string | undefined;\n value = serialized === undefined ? undefined : JSON.parse(serialized);\n } catch (cause) {\n throw invalidState({ cause });\n }\n if (typeof value !== \"string\" && typeof value !== \"object\") {\n throw invalidState();\n }\n return value;\n}\n\nfunction errorCode(status: number): SystemOneErrorCode {\n if (status === 401 || status === 403) {\n return \"UNAUTHORIZED\";\n }\n if (status === 408 || status === 504) {\n return \"PROVIDER_TIMEOUT\";\n }\n if (status === 429) {\n return \"RATE_LIMITED\";\n }\n if (status >= 500) {\n return \"PROVIDER_UNAVAILABLE\";\n }\n if (status >= 400) {\n return \"INVALID_REQUEST\";\n }\n return \"MODEL_ERROR\";\n}\n\nfunction errorMessage(payload: unknown): string | undefined {\n if (typeof payload === \"string\") {\n return payload.trim() || undefined;\n }\n const root = asObject(payload);\n const nested = asObject(root?.error)?.message;\n if (typeof nested === \"string\") {\n return nested;\n }\n if (typeof root?.message === \"string\") {\n return root.message;\n }\n if (typeof root?.detail === \"string\") {\n return root.detail;\n }\n if (Array.isArray(root?.detail)) {\n const messages = root.detail\n .map((detail) => asObject(detail)?.msg)\n .filter((message) => typeof message === \"string\");\n return messages.length > 0 ? messages.join(\"; \") : undefined;\n }\n return undefined;\n}\n\nasync function readErrorMessage(response: Response): Promise<string | undefined> {\n const text = await response.text().catch(() => \"\");\n try {\n return errorMessage(JSON.parse(text));\n } catch {\n return errorMessage(text);\n }\n}\n\nfunction isTimeout(cause: unknown): boolean {\n return cause instanceof Error && cause.name === \"TimeoutError\";\n}\n\nfunction timeoutError(cause: unknown, status?: number): SystemOneError {\n return new SystemOneError(\"AI Gateway request timed out.\", \"PROVIDER_TIMEOUT\", {\n cause,\n status,\n });\n}\n\nasync function readJSON(response: Response): Promise<unknown> {\n try {\n return await response.json();\n } catch (cause) {\n if (isTimeout(cause)) {\n throw timeoutError(cause, response.status);\n }\n throw new SystemOneError(\"AI Gateway returned an invalid JSON response.\", \"MODEL_ERROR\", {\n cause,\n status: response.status,\n });\n }\n}\n\nasync function evaluate(\n options: CreateSystemOneOptions,\n input: SystemOneInput,\n question: DecisionQuestion,\n): Promise<DecisionAnswer> {\n const body = JSON.stringify({\n model: input.model ?? defaultModel,\n state: toDecisionState(input.state),\n questions: { decision: question },\n });\n\n const token = await resolveToken(options.token);\n const headers = new Headers({ \"content-type\": \"application/json\" });\n if (token) {\n headers.set(\"authorization\", `Bearer ${token}`);\n }\n\n const fetchImplementation = options.fetch ?? globalThis.fetch;\n const signal =\n options.timeoutMs === undefined ? undefined : AbortSignal.timeout(options.timeoutMs);\n let response: Response;\n try {\n response = await fetchImplementation(endpoint(options.baseURL), {\n method: \"POST\",\n headers,\n body,\n signal,\n });\n } catch (cause) {\n if (isTimeout(cause)) {\n throw timeoutError(cause);\n }\n throw new SystemOneError(\"Unable to reach AI Gateway.\", \"PROVIDER_UNAVAILABLE\", { cause });\n }\n\n if (!response.ok) {\n const message = (await readErrorMessage(response)) ?? \"System One decision request failed.\";\n throw new SystemOneError(message, errorCode(response.status), { status: response.status });\n }\n\n const answer = asObject(asObject(asObject(await readJSON(response))?.answers)?.decision);\n if (answer?.type !== question.type) {\n throw invalidResponse(\"AI Gateway response did not contain a decision answer.\");\n }\n return answer;\n}\n\nfunction parseChoiceAnswer<Choices extends readonly [string, ...string[]]>(\n answer: DecisionAnswer,\n choices: Choices,\n): ChoiceResult<Choices[number]> {\n if (typeof answer.choice !== \"string\" || !choices.includes(answer.choice)) {\n throw invalidResponse(\"System One returned a value outside the requested answer space.\");\n }\n\n const rawProbabilities = asObject(answer.probabilities);\n if (!rawProbabilities) {\n throw invalidResponse(\"System One returned an invalid probability distribution.\");\n }\n\n const probabilities = Object.fromEntries(\n choices.map((choice) => {\n const probability = rawProbabilities[choice];\n if (!isProbability(probability)) {\n throw invalidResponse(`System One returned an invalid probability for \"${choice}\".`);\n }\n return [choice, probability];\n }),\n ) as Record<Choices[number], number>;\n\n if (!isProbability(answer.confidence)) {\n throw invalidResponse(\"System One returned an invalid confidence value.\");\n }\n\n return { value: answer.choice, probabilities, confidence: answer.confidence };\n}\n\nfunction parseBooleanAnswer(answer: DecisionAnswer): BooleanResult {\n if (!isProbability(answer.noul)) {\n throw invalidResponse(\"System One returned an invalid probability.\");\n }\n const value = answer.noul >= 0.5;\n return { value, probability: value ? answer.noul : 1 - answer.noul };\n}\n\nfunction parseScoreAnswer<Levels extends readonly [string, string, ...string[]]>(\n answer: DecisionAnswer,\n levels: Levels,\n): ChoiceResult<Levels[number]> {\n const rawProbabilities = asObject(answer.probabilities);\n if (!rawProbabilities) {\n throw invalidResponse(\"System One returned an invalid probability distribution.\");\n }\n\n const scores = levels.map((level, index) => {\n const probability = rawProbabilities[String(index)];\n if (!isProbability(probability)) {\n throw invalidResponse(`System One returned an invalid probability for \"${level}\".`);\n }\n return { level, probability };\n });\n\n if (!isProbability(answer.confidence)) {\n throw invalidResponse(\"System One returned an invalid confidence value.\");\n }\n\n return {\n value: scores.reduce((selected, score) =>\n score.probability > selected.probability ? score : selected,\n ).level,\n probabilities: Object.fromEntries(\n scores.map(({ level, probability }) => [level, probability]),\n ) as Record<Levels[number], number>,\n confidence: answer.confidence,\n };\n}\n\n/**\n * Create a System One client that makes decisions through Tailor AI Gateway.\n * @param options - AI Gateway connection options\n * @returns A semantic decision client\n */\nexport function createSystemOne(options: CreateSystemOneOptions): SystemOneClient {\n const choice: SystemOneClient[\"choice\"] = async (input) => {\n assertUniqueAnswers(input.choices);\n const answer = await evaluate(options, input, {\n type: \"choice\",\n instructions: input.question,\n criteria: Object.fromEntries(input.choices.map((value) => [value, null])),\n });\n return parseChoiceAnswer(answer, input.choices);\n };\n\n const boolean: SystemOneClient[\"boolean\"] = async (input) => {\n const answer = await evaluate(options, input, {\n type: \"noul\",\n instructions: input.question,\n });\n return parseBooleanAnswer(answer);\n };\n\n const score: SystemOneClient[\"score\"] = async (input) => {\n assertUniqueAnswers(input.levels);\n const answer = await evaluate(options, input, {\n type: \"score\",\n instructions: input.question,\n criteria: input.levels,\n });\n return parseScoreAnswer(answer, input.levels);\n };\n\n return { choice, boolean, score };\n}\n"],"mappings":"AA6BA,IAAa,eAAb,cAAoC,KAAM,CAExC,KAGA,OAQA,YACE,EACA,EACA,EAA8C,CAAC,EAC/C,CACA,MAAMA,EAASC,CAAO,EACtB,KAAK,KAAO,iBACZ,KAAK,KAAOC,EACZ,KAAK,OAASD,EAAQ,MACxB,CACF,EAkGA,SAAS,SAAS,EAA+B,CAC/C,MAAO,GAAG,OAAOE,CAAO,CAAC,CAAC,QAAQ,OAAQ,EAAE,EAAE,cAChD,CAEA,eAAe,aAAa,EAAqE,CAC/F,OAAO,OAAOC,GAAU,WAAaA,EAAM,EAAIA,CACjD,CAEA,SAAS,SAAS,EAAqD,CACrE,OAAO,OAAOC,GAAU,UAAYA,EAC/BA,EACD,IAAA,EACN,CAEA,SAAS,cAAc,EAAiC,CACtD,OAAO,OAAOA,GAAU,UAAY,OAAO,SAASA,CAAK,GAAKA,GAAS,GAAKA,GAAS,CACvF,CAEA,SAAS,gBAAgB,EAAiC,CACxD,OAAO,IAAI,eAAeL,EAAS,aAAa,CAClD,CAEA,SAAS,oBA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EAAO,IAAU,CAC1C,IAAMH,EAAcF,EAAiB,OAAOM,CAAK,GACjD,GAAI,CAAC,cAAcJ,CAAW,EAC5B,MAAM,gBAAgB,mDAAmDK,EAAM,GAAG,EAEpF,MAAO,CAAE,QAAO,aAAY,CAC9B,CAAC,EAED,GAAI,CAAC,cAAcT,EAAO,UAAU,EAClC,MAAM,gBAAgB,kDAAkD,EAG1E,MAAO,CACL,MAAOM,EAAO,QAAQ,EAAU,IAC9BI,EAAM,YAAcC,EAAS,YAAcD,EAAQC,CACrD,CAAC,CAAC,MACF,cAAe,OAAO,YACpBL,EAAO,KAAK,CAAE,QAAO,iBAAkB,CAACG,EAAOL,CAAW,CAAC,CAC7D,EACA,WAAYJ,EAAO,UACrB,CACF,CAOA,SAAgB,gBAAgB,EAAkD,CA6BhF,MAAO,CAAE,YA5BwC,KAC/C,oBAAoBL,EAAM,OAAO,EAM1B,kBAAkB,MALJ,SAASlB,EAASkB,EAAO,CAC5C,KAAM,SACN,aAAcA,EAAM,SACpB,SAAU,OAAO,YAAYA,EAAM,QAAQ,IAAK,GAAU,CAACd,EAAO,IAAI,CAAC,CAAC,CAC1E,CAAC,EACgCc,EAAM,OAAO,GAqB/B,aAlBkC,IAK1C,mBAAmB,MAJL,SAASlB,EAASkB,EAAO,CAC5C,KAAM,OACN,aAAcA,EAAM,QACtB,CAAC,CAC+B,EAaR,WAVqB,KAC7C,oBAAoBA,EAAM,MAAM,EAMzB,iBAAiB,MALH,SAASlB,EAASkB,EAAO,CAC5C,KAAM,QACN,aAAcA,EAAM,SACpB,SAAUA,EAAM,MAClB,CAAC,EAC+BA,EAAM,MAAM,EAGd,CAClC,C"}
@@ -1 +1 @@
1
- export{t as defineApplication,n as generatePluginFilesIfNeeded}from"./application-D8jruzwo.mjs";
1
+ export{t as defineApplication,n as generatePluginFilesIfNeeded}from"./application-D0xNJbag.mjs";