totalum-sdk 0.1.0-dev.8 → 1.0.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 (42) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/_types/{billing.d-C1exPLN6.d.ts → billing.d-BcRcDH4Y.d.ts} +1 -1
  3. package/dist/_types/{coerce.d-RtY2zQyw.d.ts → coerce.d-BXj_o-j6.d.ts} +1 -1
  4. package/dist/_types/{errors.d-yrue1e9O.d.ts → errors.d-Dtt-BIwJ.d.ts} +62 -2
  5. package/dist/_types/{integrations.d-BKPWost0.d.ts → integrations.d-DjOeFaYn.d.ts} +2 -2
  6. package/dist/_types/{ops.d-BOMT9yln.d.ts → ops.d-BKBWL6Qf.d.ts} +2 -2
  7. package/dist/ai/index.d.ts +42 -26
  8. package/dist/ai/index.js +13 -9
  9. package/dist/analytics/index.d.ts +4 -4
  10. package/dist/browser/index.d.ts +114 -5
  11. package/dist/browser/index.js +22 -5
  12. package/dist/cron/index.d.ts +5 -5
  13. package/dist/cron/index.js +2 -10
  14. package/dist/d1/index.d.ts +6 -4
  15. package/dist/d1/lazy.js +21 -3
  16. package/dist/d1/session.js +83 -15
  17. package/dist/deprecate.js +16 -0
  18. package/dist/email/index.d.ts +12 -6
  19. package/dist/email/index.js +4 -3
  20. package/dist/files/index.d.ts +11 -9
  21. package/dist/files/index.js +10 -5
  22. package/dist/index.d.ts +11 -8
  23. package/dist/index.js +3 -0
  24. package/dist/logs/index.d.ts +5 -5
  25. package/dist/payments/index.d.ts +5 -5
  26. package/dist/pdf/index.d.ts +5 -5
  27. package/dist/react/index.d.ts +91 -0
  28. package/dist/react/index.js +178 -0
  29. package/dist/realtime/index.d.ts +2 -2
  30. package/dist/scan/index.d.ts +14 -6
  31. package/dist/scan/index.js +5 -1
  32. package/dist/seo/index.d.ts +4 -4
  33. package/dist/speech/index.d.ts +26 -13
  34. package/dist/speech/index.js +24 -12
  35. package/dist/vectors/index.d.ts +167 -0
  36. package/dist/vectors/index.js +28 -0
  37. package/dist/web/index.d.ts +6 -6
  38. package/dist/web/index.js +1 -1
  39. package/dist/webhooks/index.d.ts +4 -4
  40. package/package.json +24 -4
  41. package/totalum-sdk.md +152 -24
  42. package/totalum-sdk.signatures.json +313 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,60 @@
1
+ # Changelog
2
+
3
+ `totalum-sdk` follows [semantic versioning](https://semver.org) from `1.0.0`. The public API is what
4
+ `api/totalum-sdk.api.md` lists (generated from the published `.d.ts`; CI fails when it changes without being
5
+ regenerated), plus the request each call sends to SDK-API (`compat/requests/*.json`).
6
+
7
+ ## Versioning and deprecation policy
8
+
9
+ - **Patch** (`1.0.x`): fixes that change no public type and no request shape.
10
+ - **Minor** (`1.x.0`): additions only — a new namespace, method, option or result field. An app written against
11
+ `1.a` compiles and runs unchanged on every later `1.b`.
12
+ - **Major** (`x.0.0`): the only place a public name is removed or changed incompatibly.
13
+ - **Deprecation:** a name that is replaced keeps working, as an alias of the new one, for **at least one major
14
+ version** — deprecated in `1.x`, removed no earlier than `2.0.0`. It carries a `@deprecated` JSDoc tag (editors
15
+ strike it through; `@typescript-eslint/no-deprecated` flags it), is marked **Deprecated** in `totalum-sdk.md`, and
16
+ logs one `console.warn` per process (per isolate in a Worker) naming its replacement the first time it is used.
17
+ - **Server side:** SDK-API keeps accepting every request shape any `1.x` release — and every `0.1.0-dev.N` prerelease
18
+ apps were built on — has sent (its `test/sdk-compat.test.ts` replays them). A new major may stop sending a shape;
19
+ SDK-API keeps accepting it while any supported release sends it.
20
+ - **Dist-tags:** `next` is the newest release; `latest` moves only by a decision at launch. `dev` holds the old
21
+ `0.1.0-dev.N` prereleases.
22
+
23
+ ## 1.0.0 — 2026-09-28
24
+
25
+ The first stable release: the `0.1.0-dev.14` surface, reviewed for consistency and frozen. Nothing was removed; every
26
+ renamed name still works as a deprecated alias. An app built on any `0.1.0-dev.N` compiles and runs on `1.0.0`
27
+ (`compat/fixtures/app-dev.ts`).
28
+
29
+ ### Changed (compatible)
30
+
31
+ - **Every paid call reports its cost as `usage.credits`.** Added `usage` to `email.send()`, `scan.document()` and
32
+ `speech.synthesize()` without `store` (the audio bytes); the other paid calls already had it.
33
+ - **Every subpath exports the same error and option types:** `TotalumError`, `isTotalumError`, `TotalumErrorCode`
34
+ and `TotalumClientOptions` from each of `totalum-sdk/<namespace>` (some lacked `TotalumErrorCode` or
35
+ `TotalumClientOptions`).
36
+ - `files.presign(keys, { expiresInSeconds })` — the same option name as `files.getSignedUrl()`; the request sent is
37
+ unchanged.
38
+ - `cron.runs()` and `browser.sessions.list()` build their query string with the shared helper: an unset filter is
39
+ no longer sent as the text `undefined`, and an empty filter sends no `?`.
40
+
41
+ ### Deprecated (removed no earlier than 2.0.0)
42
+
43
+ | Deprecated | Use instead |
44
+ |---|---|
45
+ | `files.getDownloadUrl(key, opts)` | `files.getSignedUrl(key, opts)` (the same call) |
46
+ | `files.presign(keys, { ttl })` | `files.presign(keys, { expiresInSeconds })` |
47
+ | `ai.speech.speak(input)` | `speech.synthesize(input)` (`totalum.speech`) |
48
+ | `ai.speech.transcribe(input)` | `speech.transcribe(input)` (`totalum.speech`) |
49
+ | `speech.synthesize(...)` → `.credits` | `.usage.credits` |
50
+ | type `TotalumD1ErrorCode` | `TotalumErrorCode` (the same type) |
51
+
52
+ ### Added
53
+
54
+ - `CHANGELOG.md` and this deprecation policy; `api/totalum-sdk.api.md`, the public API report (`pnpm api`,
55
+ `pnpm api:check`); `totalum-sdk.signatures.json`, one compact row per method, which the template renders its
56
+ recipe tables from; the compatibility suite (`pnpm compat`).
57
+
58
+ ## 0.1.0-dev.2 … 0.1.0-dev.14
59
+
60
+ Prereleases under the `dev` dist-tag, built wave by wave (the git history has each one).
@@ -1,4 +1,4 @@
1
- import { Z as ZodObject, k as ZodNumber, c as ZodOptional, d as ZodString, m as $strip, o as output, t as ZodISODateTime, f as ZodEnum, j as ZodBoolean, h as ZodRecord, g as ZodUnknown, v as ZodNullable, p as ZodURL } from './errors.d-yrue1e9O.js';
1
+ import { Z as ZodObject, k as ZodNumber, c as ZodOptional, d as ZodString, m as $strip, o as output, u as ZodISODateTime, f as ZodEnum, j as ZodBoolean, h as ZodRecord, g as ZodUnknown, w as ZodNullable, p as ZodURL } from './errors.d-Dtt-BIwJ.js';
2
2
 
3
3
  /** `usage` on every integration result (plan 11 §0.8): what the call cost, credits with 4 decimals. */
4
4
  declare const IntegrationUsage: ZodObject<{
@@ -1,4 +1,4 @@
1
- import { _ as _ZodNumber, x as $ZodNumberInternals } from './errors.d-yrue1e9O.js';
1
+ import { _ as _ZodNumber, z as $ZodNumberInternals } from './errors.d-Dtt-BIwJ.js';
2
2
 
3
3
  interface ZodCoercedNumber<T = unknown> extends _ZodNumber<$ZodNumberInternals<T>> {
4
4
  }
@@ -2335,6 +2335,7 @@ declare const ErrorCode: ZodEnum<{
2335
2335
  PLAN_REQUIRED: "PLAN_REQUIRED";
2336
2336
  FEATURE_LIMIT_REACHED: "FEATURE_LIMIT_REACHED";
2337
2337
  FEATURE_DISABLED: "FEATURE_DISABLED";
2338
+ VECTORS_LIMIT_REACHED: "VECTORS_LIMIT_REACHED";
2338
2339
  AGENT_ALREADY_RUNNING: "AGENT_ALREADY_RUNNING";
2339
2340
  IMPORT_IN_PROGRESS: "IMPORT_IN_PROGRESS";
2340
2341
  TOO_MANY_RUN_REQUESTS: "TOO_MANY_RUN_REQUESTS";
@@ -2347,8 +2348,12 @@ declare const ErrorCode: ZodEnum<{
2347
2348
  SECRET_ALREADY_EXISTS: "SECRET_ALREADY_EXISTS";
2348
2349
  SECRET_LIMIT_EXCEEDED: "SECRET_LIMIT_EXCEEDED";
2349
2350
  RESERVED_SECRET_NAME: "RESERVED_SECRET_NAME";
2351
+ DUMP_NOT_FOUND: "DUMP_NOT_FOUND";
2352
+ DUMP_INVALID: "DUMP_INVALID";
2353
+ RESTORE_TARGET_NOT_EMPTY: "RESTORE_TARGET_NOT_EMPTY";
2350
2354
  ENGINE_NOT_SUPPORTED: "ENGINE_NOT_SUPPORTED";
2351
2355
  ENGINE_V2_DISABLED: "ENGINE_V2_DISABLED";
2356
+ V2_TEMPORARILY_DISABLED: "V2_TEMPORARILY_DISABLED";
2352
2357
  ENGINE_REQUEST_NOT_ELIGIBLE: "ENGINE_REQUEST_NOT_ELIGIBLE";
2353
2358
  ENGINE_MISMATCH: "ENGINE_MISMATCH";
2354
2359
  INVALID_ENGINE_VERSION: "INVALID_ENGINE_VERSION";
@@ -2366,6 +2371,7 @@ declare const ErrorCode: ZodEnum<{
2366
2371
  KEY_ENV_MISMATCH: "KEY_ENV_MISMATCH";
2367
2372
  KEY_LIMIT_EXCEEDED: "KEY_LIMIT_EXCEEDED";
2368
2373
  LIVE_DB_READ_ONLY: "LIVE_DB_READ_ONLY";
2374
+ LIVE_WRITE_NEEDS_CONFIRMATION: "LIVE_WRITE_NEEDS_CONFIRMATION";
2369
2375
  DDL_NOT_ALLOWED: "DDL_NOT_ALLOWED";
2370
2376
  MIGRATION_IN_PROGRESS: "MIGRATION_IN_PROGRESS";
2371
2377
  MIGRATION_EDITED: "MIGRATION_EDITED";
@@ -2374,6 +2380,14 @@ declare const ErrorCode: ZodEnum<{
2374
2380
  DESTRUCTIVE_MIGRATION_NEEDS_CONFIRMATION: "DESTRUCTIVE_MIGRATION_NEEDS_CONFIRMATION";
2375
2381
  DEV_DATABASE_NOT_FOUND: "DEV_DATABASE_NOT_FOUND";
2376
2382
  DATABASE_ROLE_NOT_FOUND: "DATABASE_ROLE_NOT_FOUND";
2383
+ BOOKMARK_NOT_FOUND: "BOOKMARK_NOT_FOUND";
2384
+ BACKUP_NOT_FOUND: "BACKUP_NOT_FOUND";
2385
+ BACKUP_NOT_DELETABLE: "BACKUP_NOT_DELETABLE";
2386
+ BACKUP_RATE_LIMITED: "BACKUP_RATE_LIMITED";
2387
+ PRE_RESTORE_BACKUP_FAILED: "PRE_RESTORE_BACKUP_FAILED";
2388
+ RESTORE_VERIFY_FAILED: "RESTORE_VERIFY_FAILED";
2389
+ RUN_NOT_LATEST: "RUN_NOT_LATEST";
2390
+ DEV_DATABASE_EXISTS: "DEV_DATABASE_EXISTS";
2377
2391
  SQL_ERROR: "SQL_ERROR";
2378
2392
  SQL_MULTI_STATEMENT: "SQL_MULTI_STATEMENT";
2379
2393
  SQL_STATEMENT_TOO_LARGE: "SQL_STATEMENT_TOO_LARGE";
@@ -2386,6 +2400,7 @@ declare const ErrorCode: ZodEnum<{
2386
2400
  SYSTEM_TABLE_READ_ONLY: "SYSTEM_TABLE_READ_ONLY";
2387
2401
  SQL_READ_ONLY: "SQL_READ_ONLY";
2388
2402
  RESULT_TOO_LARGE: "RESULT_TOO_LARGE";
2403
+ NL_QUERY_UNANSWERABLE: "NL_QUERY_UNANSWERABLE";
2389
2404
  QUERY_TIMEOUT: "QUERY_TIMEOUT";
2390
2405
  DB_OVERLOADED: "DB_OVERLOADED";
2391
2406
  D1_TRANSIENT: "D1_TRANSIENT";
@@ -2428,6 +2443,10 @@ declare const ErrorCode: ZodEnum<{
2428
2443
  AM_UPDATE_FAILED: "AM_UPDATE_FAILED";
2429
2444
  RELEASE_CANARY_NOT_PASSED: "RELEASE_CANARY_NOT_PASSED";
2430
2445
  RELEASE_NOT_FOUND: "RELEASE_NOT_FOUND";
2446
+ RELEASE_ROLLOUT_ACTIVE: "RELEASE_ROLLOUT_ACTIVE";
2447
+ RELEASE_GUARD_PAUSED: "RELEASE_GUARD_PAUSED";
2448
+ RELEASE_BUILD_UNAVAILABLE: "RELEASE_BUILD_UNAVAILABLE";
2449
+ RELEASE_BELOW_MIN_SAFE_VERSION: "RELEASE_BELOW_MIN_SAFE_VERSION";
2431
2450
  VISUAL_EDIT_PREVIEW_DEPLOYING: "VISUAL_EDIT_PREVIEW_DEPLOYING";
2432
2451
  VISUAL_EDIT_NOT_PATCHABLE: "VISUAL_EDIT_NOT_PATCHABLE";
2433
2452
  VISUAL_EDIT_BASE_MISMATCH: "VISUAL_EDIT_BASE_MISMATCH";
@@ -2473,6 +2492,16 @@ declare const ErrorCode: ZodEnum<{
2473
2492
  MOBILE_ARTIFACT_INVALID: "MOBILE_ARTIFACT_INVALID";
2474
2493
  SIGNING_FINGERPRINT_MISMATCH: "SIGNING_FINGERPRINT_MISMATCH";
2475
2494
  AM_RESTARTED: "AM_RESTARTED";
2495
+ MOBILE_BUILD_NOT_SIGNED: "MOBILE_BUILD_NOT_SIGNED";
2496
+ STORE_NOT_CONFIGURED: "STORE_NOT_CONFIGURED";
2497
+ STORE_CREDENTIALS_INVALID: "STORE_CREDENTIALS_INVALID";
2498
+ STORE_APP_NOT_FOUND: "STORE_APP_NOT_FOUND";
2499
+ STORE_UPLOAD_RUNNING: "STORE_UPLOAD_RUNNING";
2500
+ STORE_UPLOAD_LIMIT_REACHED: "STORE_UPLOAD_LIMIT_REACHED";
2501
+ STORE_UPLOAD_NOT_FOUND: "STORE_UPLOAD_NOT_FOUND";
2502
+ STORE_UPLOAD_FAILED: "STORE_UPLOAD_FAILED";
2503
+ PLAY_FIRST_UPLOAD_MANUAL: "PLAY_FIRST_UPLOAD_MANUAL";
2504
+ STORE_PROCESSING_TIMEOUT: "STORE_PROCESSING_TIMEOUT";
2476
2505
  LIMIT_ABOVE_PLAN_CEILING: "LIMIT_ABOVE_PLAN_CEILING";
2477
2506
  UNKNOWN_FEATURE: "UNKNOWN_FEATURE";
2478
2507
  INVALID_LIMIT: "INVALID_LIMIT";
@@ -2655,6 +2684,7 @@ declare const ErrorCode: ZodEnum<{
2655
2684
  VERSION_NOT_FOUND: "VERSION_NOT_FOUND";
2656
2685
  INVALID_CODE_EDIT: "INVALID_CODE_EDIT";
2657
2686
  CODE_EDIT_FAILED: "CODE_EDIT_FAILED";
2687
+ BADGE_IN_SOURCE: "BADGE_IN_SOURCE";
2658
2688
  }>;
2659
2689
  type ErrorCode = output<typeof ErrorCode>;
2660
2690
  /**
@@ -2698,6 +2728,7 @@ declare const ErrorBody: ZodObject<{
2698
2728
  PLAN_REQUIRED: "PLAN_REQUIRED";
2699
2729
  FEATURE_LIMIT_REACHED: "FEATURE_LIMIT_REACHED";
2700
2730
  FEATURE_DISABLED: "FEATURE_DISABLED";
2731
+ VECTORS_LIMIT_REACHED: "VECTORS_LIMIT_REACHED";
2701
2732
  AGENT_ALREADY_RUNNING: "AGENT_ALREADY_RUNNING";
2702
2733
  IMPORT_IN_PROGRESS: "IMPORT_IN_PROGRESS";
2703
2734
  TOO_MANY_RUN_REQUESTS: "TOO_MANY_RUN_REQUESTS";
@@ -2710,8 +2741,12 @@ declare const ErrorBody: ZodObject<{
2710
2741
  SECRET_ALREADY_EXISTS: "SECRET_ALREADY_EXISTS";
2711
2742
  SECRET_LIMIT_EXCEEDED: "SECRET_LIMIT_EXCEEDED";
2712
2743
  RESERVED_SECRET_NAME: "RESERVED_SECRET_NAME";
2744
+ DUMP_NOT_FOUND: "DUMP_NOT_FOUND";
2745
+ DUMP_INVALID: "DUMP_INVALID";
2746
+ RESTORE_TARGET_NOT_EMPTY: "RESTORE_TARGET_NOT_EMPTY";
2713
2747
  ENGINE_NOT_SUPPORTED: "ENGINE_NOT_SUPPORTED";
2714
2748
  ENGINE_V2_DISABLED: "ENGINE_V2_DISABLED";
2749
+ V2_TEMPORARILY_DISABLED: "V2_TEMPORARILY_DISABLED";
2715
2750
  ENGINE_REQUEST_NOT_ELIGIBLE: "ENGINE_REQUEST_NOT_ELIGIBLE";
2716
2751
  ENGINE_MISMATCH: "ENGINE_MISMATCH";
2717
2752
  INVALID_ENGINE_VERSION: "INVALID_ENGINE_VERSION";
@@ -2729,6 +2764,7 @@ declare const ErrorBody: ZodObject<{
2729
2764
  KEY_ENV_MISMATCH: "KEY_ENV_MISMATCH";
2730
2765
  KEY_LIMIT_EXCEEDED: "KEY_LIMIT_EXCEEDED";
2731
2766
  LIVE_DB_READ_ONLY: "LIVE_DB_READ_ONLY";
2767
+ LIVE_WRITE_NEEDS_CONFIRMATION: "LIVE_WRITE_NEEDS_CONFIRMATION";
2732
2768
  DDL_NOT_ALLOWED: "DDL_NOT_ALLOWED";
2733
2769
  MIGRATION_IN_PROGRESS: "MIGRATION_IN_PROGRESS";
2734
2770
  MIGRATION_EDITED: "MIGRATION_EDITED";
@@ -2737,6 +2773,14 @@ declare const ErrorBody: ZodObject<{
2737
2773
  DESTRUCTIVE_MIGRATION_NEEDS_CONFIRMATION: "DESTRUCTIVE_MIGRATION_NEEDS_CONFIRMATION";
2738
2774
  DEV_DATABASE_NOT_FOUND: "DEV_DATABASE_NOT_FOUND";
2739
2775
  DATABASE_ROLE_NOT_FOUND: "DATABASE_ROLE_NOT_FOUND";
2776
+ BOOKMARK_NOT_FOUND: "BOOKMARK_NOT_FOUND";
2777
+ BACKUP_NOT_FOUND: "BACKUP_NOT_FOUND";
2778
+ BACKUP_NOT_DELETABLE: "BACKUP_NOT_DELETABLE";
2779
+ BACKUP_RATE_LIMITED: "BACKUP_RATE_LIMITED";
2780
+ PRE_RESTORE_BACKUP_FAILED: "PRE_RESTORE_BACKUP_FAILED";
2781
+ RESTORE_VERIFY_FAILED: "RESTORE_VERIFY_FAILED";
2782
+ RUN_NOT_LATEST: "RUN_NOT_LATEST";
2783
+ DEV_DATABASE_EXISTS: "DEV_DATABASE_EXISTS";
2740
2784
  SQL_ERROR: "SQL_ERROR";
2741
2785
  SQL_MULTI_STATEMENT: "SQL_MULTI_STATEMENT";
2742
2786
  SQL_STATEMENT_TOO_LARGE: "SQL_STATEMENT_TOO_LARGE";
@@ -2749,6 +2793,7 @@ declare const ErrorBody: ZodObject<{
2749
2793
  SYSTEM_TABLE_READ_ONLY: "SYSTEM_TABLE_READ_ONLY";
2750
2794
  SQL_READ_ONLY: "SQL_READ_ONLY";
2751
2795
  RESULT_TOO_LARGE: "RESULT_TOO_LARGE";
2796
+ NL_QUERY_UNANSWERABLE: "NL_QUERY_UNANSWERABLE";
2752
2797
  QUERY_TIMEOUT: "QUERY_TIMEOUT";
2753
2798
  DB_OVERLOADED: "DB_OVERLOADED";
2754
2799
  D1_TRANSIENT: "D1_TRANSIENT";
@@ -2791,6 +2836,10 @@ declare const ErrorBody: ZodObject<{
2791
2836
  AM_UPDATE_FAILED: "AM_UPDATE_FAILED";
2792
2837
  RELEASE_CANARY_NOT_PASSED: "RELEASE_CANARY_NOT_PASSED";
2793
2838
  RELEASE_NOT_FOUND: "RELEASE_NOT_FOUND";
2839
+ RELEASE_ROLLOUT_ACTIVE: "RELEASE_ROLLOUT_ACTIVE";
2840
+ RELEASE_GUARD_PAUSED: "RELEASE_GUARD_PAUSED";
2841
+ RELEASE_BUILD_UNAVAILABLE: "RELEASE_BUILD_UNAVAILABLE";
2842
+ RELEASE_BELOW_MIN_SAFE_VERSION: "RELEASE_BELOW_MIN_SAFE_VERSION";
2794
2843
  VISUAL_EDIT_PREVIEW_DEPLOYING: "VISUAL_EDIT_PREVIEW_DEPLOYING";
2795
2844
  VISUAL_EDIT_NOT_PATCHABLE: "VISUAL_EDIT_NOT_PATCHABLE";
2796
2845
  VISUAL_EDIT_BASE_MISMATCH: "VISUAL_EDIT_BASE_MISMATCH";
@@ -2836,6 +2885,16 @@ declare const ErrorBody: ZodObject<{
2836
2885
  MOBILE_ARTIFACT_INVALID: "MOBILE_ARTIFACT_INVALID";
2837
2886
  SIGNING_FINGERPRINT_MISMATCH: "SIGNING_FINGERPRINT_MISMATCH";
2838
2887
  AM_RESTARTED: "AM_RESTARTED";
2888
+ MOBILE_BUILD_NOT_SIGNED: "MOBILE_BUILD_NOT_SIGNED";
2889
+ STORE_NOT_CONFIGURED: "STORE_NOT_CONFIGURED";
2890
+ STORE_CREDENTIALS_INVALID: "STORE_CREDENTIALS_INVALID";
2891
+ STORE_APP_NOT_FOUND: "STORE_APP_NOT_FOUND";
2892
+ STORE_UPLOAD_RUNNING: "STORE_UPLOAD_RUNNING";
2893
+ STORE_UPLOAD_LIMIT_REACHED: "STORE_UPLOAD_LIMIT_REACHED";
2894
+ STORE_UPLOAD_NOT_FOUND: "STORE_UPLOAD_NOT_FOUND";
2895
+ STORE_UPLOAD_FAILED: "STORE_UPLOAD_FAILED";
2896
+ PLAY_FIRST_UPLOAD_MANUAL: "PLAY_FIRST_UPLOAD_MANUAL";
2897
+ STORE_PROCESSING_TIMEOUT: "STORE_PROCESSING_TIMEOUT";
2839
2898
  LIMIT_ABOVE_PLAN_CEILING: "LIMIT_ABOVE_PLAN_CEILING";
2840
2899
  UNKNOWN_FEATURE: "UNKNOWN_FEATURE";
2841
2900
  INVALID_LIMIT: "INVALID_LIMIT";
@@ -3018,6 +3077,7 @@ declare const ErrorBody: ZodObject<{
3018
3077
  VERSION_NOT_FOUND: "VERSION_NOT_FOUND";
3019
3078
  INVALID_CODE_EDIT: "INVALID_CODE_EDIT";
3020
3079
  CODE_EDIT_FAILED: "CODE_EDIT_FAILED";
3080
+ BADGE_IN_SOURCE: "BADGE_IN_SOURCE";
3021
3081
  }>;
3022
3082
  errorMessage: ZodString;
3023
3083
  errorDetails: ZodOptional<ZodUnknown>;
@@ -3053,5 +3113,5 @@ declare class TotalumError extends Error {
3053
3113
  }
3054
3114
  declare function isTotalumError(e: unknown): e is TotalumError;
3055
3115
 
3056
- export { ErrorBody as E, ZodObject as Z, TotalumError as a, ZodOptional as c, ZodString as d, ZodArray as e, ZodEnum as f, ZodUnknown as g, ZodRecord as h, isTotalumError as i, ZodBoolean as j, ZodNumber as k, ZodUnion as n, ZodURL as p, ZodLiteral as q, ZodType as r, ZodISODateTime as t, ZodNullable as v, ZodEmail as w };
3057
- export type { $loose as $, SdkClientErrorCode as S, TotalumClientOptions as T, _ZodNumber as _, TotalumErrorCode as b, ZodInt as l, $strip as m, output as o, $ZodTypeInternals as s, $catchall as u, $ZodNumberInternals as x };
3116
+ export { ErrorBody as E, ZodObject as Z, TotalumError as a, ZodOptional as c, ZodString as d, ZodArray as e, ZodEnum as f, ZodUnknown as g, ZodRecord as h, isTotalumError as i, ZodBoolean as j, ZodNumber as k, ZodUnion as n, ZodURL as p, ZodLiteral as r, ZodType as s, ZodISODateTime as u, ZodNullable as w, ZodEmail as y };
3117
+ export type { $loose as $, SdkClientErrorCode as S, TotalumClientOptions as T, _ZodNumber as _, TotalumErrorCode as b, ZodInt as l, $strip as m, output as o, $partial as q, $ZodTypeInternals as t, $catchall as v, $strict as x, $ZodNumberInternals as z };
@@ -1,5 +1,5 @@
1
- import { Z as ZodObject, d as ZodString, c as ZodOptional, f as ZodEnum, k as ZodNumber, j as ZodBoolean, m as $strip, o as output, p as ZodURL, e as ZodArray, n as ZodUnion, l as ZodInt, h as ZodRecord, v as ZodNullable, t as ZodISODateTime, w as ZodEmail, q as ZodLiteral, g as ZodUnknown } from './errors.d-yrue1e9O.js';
2
- import { Z as ZodCoercedNumber } from './coerce.d-RtY2zQyw.js';
1
+ import { Z as ZodObject, d as ZodString, c as ZodOptional, f as ZodEnum, k as ZodNumber, j as ZodBoolean, m as $strip, o as output, p as ZodURL, e as ZodArray, n as ZodUnion, l as ZodInt, h as ZodRecord, w as ZodNullable, u as ZodISODateTime, y as ZodEmail, r as ZodLiteral, g as ZodUnknown } from './errors.d-Dtt-BIwJ.js';
2
+ import { Z as ZodCoercedNumber } from './coerce.d-BXj_o-j6.js';
3
3
 
4
4
  /** `202` of every async integration call; `estimatedCredits` = the reserved estimate (settled to the real cost). */
5
5
  declare const JobCreated: ZodObject<{
@@ -1,5 +1,5 @@
1
- import { Z as ZodObject, c as ZodOptional, e as ZodArray, t as ZodISODateTime, u as $catchall, k as ZodNumber, d as ZodString, f as ZodEnum, m as $strip, q as ZodLiteral, j as ZodBoolean, o as output, v as ZodNullable, l as ZodInt } from './errors.d-yrue1e9O.js';
2
- import { Z as ZodCoercedNumber } from './coerce.d-RtY2zQyw.js';
1
+ import { Z as ZodObject, c as ZodOptional, e as ZodArray, u as ZodISODateTime, v as $catchall, k as ZodNumber, d as ZodString, f as ZodEnum, m as $strip, r as ZodLiteral, j as ZodBoolean, o as output, w as ZodNullable, l as ZodInt } from './errors.d-Dtt-BIwJ.js';
2
+ import { Z as ZodCoercedNumber } from './coerce.d-BXj_o-j6.js';
3
3
 
4
4
  declare const SiteMetric: ZodEnum<{
5
5
  bytes: "bytes";
@@ -1,9 +1,17 @@
1
- import { Z as ZodObject, c as ZodOptional, d as ZodString, e as ZodArray, f as ZodEnum, g as ZodUnknown, $ as $loose, h as ZodRecord, j as ZodBoolean, k as ZodNumber, l as ZodInt, m as $strip, o as output, n as ZodUnion, p as ZodURL, q as ZodLiteral, T as TotalumClientOptions } from '../_types/errors.d-yrue1e9O.js';
2
- export { a as TotalumError, i as isTotalumError } from '../_types/errors.d-yrue1e9O.js';
3
- import { I as IntegrationUsage } from '../_types/billing.d-C1exPLN6.js';
1
+ import { SpeechAudio } from '../speech/index.js';
2
+ import { Z as ZodObject, c as ZodOptional, d as ZodString, e as ZodArray, f as ZodEnum, g as ZodUnknown, $ as $loose, h as ZodRecord, j as ZodBoolean, k as ZodNumber, l as ZodInt, m as $strip, o as output, n as ZodUnion, p as ZodURL, q as $partial, r as ZodLiteral, T as TotalumClientOptions } from '../_types/errors.d-Dtt-BIwJ.js';
3
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-Dtt-BIwJ.js';
4
+ import { I as IntegrationUsage } from '../_types/billing.d-BcRcDH4Y.js';
4
5
  import { SpeakInput, StoredMedia, TranscribeInput } from '../index.js';
5
- import '../_types/coerce.d-RtY2zQyw.js';
6
+ import '../_types/coerce.d-BXj_o-j6.js';
6
7
 
8
+ /**
9
+ * Named model presets (A10.13): SDK-API resolves each to an OpenRouter slug from the CEO-editable `ai_model_aliases`
10
+ * table, refreshed from OpenRouter's catalogue to the newest non-deprecated model of the preset's family. A `model`
11
+ * field takes a preset or a pinned OpenRouter slug; a `:free` slug is never sent (20 req/min, shared by every tenant).
12
+ */
13
+ declare const AI_PRESETS: readonly ["fast", "smart", "reasoning", "vision", "image", "image-edit", "video", "tts", "stt", "embed", "embed-image"];
14
+ type AiPresetName = (typeof AI_PRESETS)[number];
7
15
  /** `POST /v1/ai/chat` (integration `ai_text`); `stream:true` answers SSE ending with `AiStreamCreditsChunk`. */
8
16
  declare const AiChatInput: ZodObject<{
9
17
  model: ZodOptional<ZodString>;
@@ -184,13 +192,21 @@ declare const AiTextOutput: ZodObject<{
184
192
  }, $strip>;
185
193
  }, $strip>;
186
194
  type AiTextOutput = output<typeof AiTextOutput>;
187
- /** `GET /v1/ai/models` (cached 1 h). */
195
+ /** `GET /v1/ai/models` (cached 1 h): each preset's current slug, and the catalogue the plan may call. */
188
196
  declare const AiModelsOutput: ZodObject<{
189
- aliases: ZodObject<{
190
- cheap: ZodString;
191
- normal: ZodString;
192
- best: ZodString;
193
- }, $strip>;
197
+ presets: ZodRecord<ZodEnum<{
198
+ fast: "fast";
199
+ smart: "smart";
200
+ reasoning: "reasoning";
201
+ vision: "vision";
202
+ image: "image";
203
+ "image-edit": "image-edit";
204
+ video: "video";
205
+ tts: "tts";
206
+ stt: "stt";
207
+ embed: "embed";
208
+ "embed-image": "embed-image";
209
+ }> & $partial, ZodString>;
194
210
  models: ZodArray<ZodObject<{
195
211
  slug: ZodString;
196
212
  name: ZodString;
@@ -237,8 +253,10 @@ interface ChatStream {
237
253
  result(): Promise<ChatResult>;
238
254
  }
239
255
  /**
240
- * `totalum.ai` (plan 05 §6.1, plan 04 §5.1) over SDK-API `/v1/ai/*` (scope `ai`): aliases `cheap|normal|best` or any
241
- * OpenRouter slug, every call priced `usage.cost × 28` and returned with its credits. No `ai.agent()` (A5.27) — the
256
+ * `totalum.ai` (plan 05 §6.1, plan 04 §5.1) over SDK-API `/v1/ai/*` (scope `ai`): a `model` is a preset (`fast`,
257
+ * `smart`, `reasoning`, `vision`, `image`, `image-edit`, `video`, `tts`, `stt`, `embed` — each follows the newest model
258
+ * of its family, resolved by Totalum) or a pinned OpenRouter id; every call priced `usage.cost × 4 / 0.07` and returned with
259
+ * its credits. No `ai.agent()` (A5.27) — the
242
260
  * agent loop is the template's `src/agents/` on the Vercel AI SDK, pointed at `gatewayConfig()`.
243
261
  */
244
262
  declare function totalumAi(options?: TotalumAiOptions): {
@@ -364,14 +382,16 @@ declare function totalumAi(options?: TotalumAiOptions): {
364
382
  };
365
383
  }>;
366
384
  };
385
+ /** @deprecated Since 1.0.0: use `totalum.speech` (the same calls). */
367
386
  speech: {
368
- /** Same as `speech.synthesize`. */
369
- speak: (input: SpeakInput) => Promise<StoredMedia | {
370
- audio: ArrayBuffer;
371
- contentType: string;
372
- credits: number;
373
- }>;
374
- /** Same as `speech.transcribe`. */
387
+ /** @deprecated Since 1.0.0: use `totalum.speech.synthesize` (the same call). */
388
+ speak: {
389
+ (input: SpeakInput & {
390
+ store: true;
391
+ }): Promise<StoredMedia>;
392
+ (input: SpeakInput): Promise<StoredMedia | SpeechAudio>;
393
+ };
394
+ /** @deprecated Since 1.0.0: use `totalum.speech.transcribe` (the same call). */
375
395
  transcribe: (input: TranscribeInput) => Promise<{
376
396
  text: string;
377
397
  durationSec: number;
@@ -395,13 +415,9 @@ declare function totalumAi(options?: TotalumAiOptions): {
395
415
  }>;
396
416
  };
397
417
  models: {
398
- /** The model aliases and the models a project may call, with their prices. */
418
+ /** Each preset's current model and the models a project may call, with their prices. */
399
419
  list: () => Promise<{
400
- aliases: {
401
- cheap: string;
402
- normal: string;
403
- best: string;
404
- };
420
+ presets: Partial<Record<"fast" | "reasoning" | "video" | "image" | "smart" | "vision" | "image-edit" | "tts" | "stt" | "embed" | "embed-image", string>>;
405
421
  models: {
406
422
  slug: string;
407
423
  name: string;
@@ -421,4 +437,4 @@ declare function totalumAi(options?: TotalumAiOptions): {
421
437
  type TotalumAi = ReturnType<typeof totalumAi>;
422
438
 
423
439
  export { AiChatInput, AiEmbedInput, AiEmbedOutput, AiImageEditInput, AiImageInput, AiImageOutput, AiModelsOutput, AiTextOutput, AiVideoCreated, AiVideoInput, AiVideoJob, AiVisionDescribeInput, TotalumClientOptions, totalumAi };
424
- export type { ChatResult, ChatStream, ChatUsage, TotalumAi, TotalumAiOptions };
440
+ export type { AiPresetName, ChatResult, ChatStream, ChatUsage, TotalumAi, TotalumAiOptions };
package/dist/ai/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { alias } from '../deprecate.js';
1
2
  import { assertNode, TotalumError } from '../errors.js';
2
3
  import { jsonClient, projectKey, rawClient, readEnv } from '../http.js';
3
4
  import { totalumSpeech } from '../speech/index.js';
@@ -87,8 +88,10 @@ function chatStream(body) {
87
88
  };
88
89
  }
89
90
  /**
90
- * `totalum.ai` (plan 05 §6.1, plan 04 §5.1) over SDK-API `/v1/ai/*` (scope `ai`): aliases `cheap|normal|best` or any
91
- * OpenRouter slug, every call priced `usage.cost × 28` and returned with its credits. No `ai.agent()` (A5.27) — the
91
+ * `totalum.ai` (plan 05 §6.1, plan 04 §5.1) over SDK-API `/v1/ai/*` (scope `ai`): a `model` is a preset (`fast`,
92
+ * `smart`, `reasoning`, `vision`, `image`, `image-edit`, `video`, `tts`, `stt`, `embed` — each follows the newest model
93
+ * of its family, resolved by Totalum) or a pinned OpenRouter id; every call priced `usage.cost × 4 / 0.07` and returned with
94
+ * its credits. No `ai.agent()` (A5.27) — the
92
95
  * agent loop is the template's `src/agents/` on the Vercel AI SDK, pointed at `gatewayConfig()`.
93
96
  */
94
97
  export function totalumAi(options = {}) {
@@ -96,10 +99,10 @@ export function totalumAi(options = {}) {
96
99
  const raw = rawClient(options);
97
100
  const speech = totalumSpeech(options);
98
101
  /**
99
- * A chat completion; `model` is an alias (`cheap`, `normal`, `best`) or any OpenRouter slug.
102
+ * A chat completion; `model` is a preset (`fast`, `smart` — the default — or `reasoning`) or a pinned OpenRouter id.
100
103
  *
101
104
  * @example
102
- * const { text } = await ai.chat({ model: 'cheap', messages: [{ role: 'user', content: 'Hi' }] });
105
+ * const { text } = await ai.chat({ model: 'fast', messages: [{ role: 'user', content: 'Hi' }] });
103
106
  */
104
107
  const chat = Object.assign(async (req) => resultOf(await call('POST', '/v1/ai/chat', { ...req, stream: false })), {
105
108
  /**
@@ -166,14 +169,15 @@ export function totalumAi(options = {}) {
166
169
  /** A text description of an image (URL, data URL or project file key). */
167
170
  describe: (req) => call('POST', '/v1/ai/vision/describe', req),
168
171
  },
172
+ /** @deprecated Since 1.0.0: use `totalum.speech` (the same calls). */
169
173
  speech: {
170
- /** Same as `speech.synthesize`. */
171
- speak: speech.synthesize,
172
- /** Same as `speech.transcribe`. */
173
- transcribe: speech.transcribe,
174
+ /** @deprecated Since 1.0.0: use `totalum.speech.synthesize` (the same call). */
175
+ speak: alias(speech.synthesize, 'ai.speech.speak()', 'totalum.speech.synthesize()'),
176
+ /** @deprecated Since 1.0.0: use `totalum.speech.transcribe` (the same call). */
177
+ transcribe: alias(speech.transcribe, 'ai.speech.transcribe()', 'totalum.speech.transcribe()'),
174
178
  },
175
179
  models: {
176
- /** The model aliases and the models a project may call, with their prices. */
180
+ /** Each preset's current model and the models a project may call, with their prices. */
177
181
  list: () => call('GET', '/v1/ai/models'),
178
182
  },
179
183
  /** The exact OpenRouter API for any OpenRouter/OpenAI client (A6.19): `new OpenAI(ai.gatewayConfig())`. Server-side only. */
@@ -1,7 +1,7 @@
1
- import { b as SiteMetric, a as SiteDimension, S as SiteAnalyticsOutput } from '../_types/ops.d-BOMT9yln.js';
2
- import { T as TotalumClientOptions } from '../_types/errors.d-yrue1e9O.js';
3
- export { a as TotalumError, i as isTotalumError } from '../_types/errors.d-yrue1e9O.js';
4
- import '../_types/coerce.d-RtY2zQyw.js';
1
+ import { b as SiteMetric, a as SiteDimension, S as SiteAnalyticsOutput } from '../_types/ops.d-BKBWL6Qf.js';
2
+ import { T as TotalumClientOptions } from '../_types/errors.d-Dtt-BIwJ.js';
3
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-Dtt-BIwJ.js';
4
+ import '../_types/coerce.d-BXj_o-j6.js';
5
5
 
6
6
  interface SiteAnalyticsQuery {
7
7
  /** ISO; default the last 7 days. */