deepspace 0.4.5 → 0.5.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 (37) hide show
  1. package/README.md +90 -0
  2. package/dist/cli.js +3590 -1485
  3. package/dist/cli.js.map +1 -1
  4. package/dist/index.d.ts +876 -3664
  5. package/dist/index.js +511 -366
  6. package/dist/index.js.map +1 -1
  7. package/dist/server.d.ts +132 -61
  8. package/dist/server.js +149 -110
  9. package/dist/server.js.map +1 -1
  10. package/dist/testing.js.map +1 -1
  11. package/dist/worker.d.ts +128 -59
  12. package/dist/worker.js +144 -99
  13. package/dist/worker.js.map +1 -1
  14. package/features/admin-page/src/AdminPage.tsx +3 -5
  15. package/features/canvas/src/CanvasEditorPage.tsx +0 -2
  16. package/features/canvas/src/components/CanvasView.tsx +1 -1
  17. package/features/docs/src/LibrarySidebar.tsx +7 -1
  18. package/features/docs/src/editor/useDocEditor.ts +5 -1
  19. package/features/docs/src/use-yjs-room-with-awareness.ts +4 -0
  20. package/features/file-attachments/src/AttachmentsPage.tsx +7 -1
  21. package/features/file-attachments/src/useFilePreview.ts +7 -5
  22. package/features/file-manager/src/FileManagerPage.tsx +2 -3
  23. package/features/integration-test/feature.json +10 -3
  24. package/features/integration-test/src/IntegrationTestPage.tsx +15 -12
  25. package/features/landing/src/LandingPage.tsx +1 -1
  26. package/features/landing/src/sections/FeaturesGridSection.tsx +0 -92
  27. package/features/messaging/src/ChatPage.tsx +6 -1
  28. package/features/messaging/src/components/chat/MessageItem.tsx +5 -1
  29. package/features/messaging/src/hooks/useChatChannel.ts +23 -7
  30. package/features/presence-test/feature.json +2 -1
  31. package/features/sidebar/src/AppSidebar.tsx +1 -1
  32. package/features/tasks/src/TasksPage.tsx +1 -1
  33. package/features/testing/feature.json +2 -1
  34. package/features/testing/src/TestPage.tsx +8 -8
  35. package/package.json +8 -4
  36. package/scripts/add-feature.cjs +296 -282
  37. package/dist/testing.d.ts +0 -115
package/dist/server.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { LanguageModel, ToolSet, ModelMessage } from 'ai';
2
2
  import * as Y from 'yjs';
3
+ import * as zod_v4_core from 'zod/v4/core';
4
+ import * as zod from 'zod';
3
5
  import * as better_auth from 'better-auth';
4
6
  import { betterAuth } from 'better-auth';
5
7
  import * as better_auth_plugins from 'better-auth/plugins';
@@ -488,10 +490,10 @@ interface CronContext {
488
490
  query(collection: string, opts?: {
489
491
  where?: Record<string, unknown>;
490
492
  limit?: number;
491
- }): Promise<any[]>;
492
- create(collection: string, data: Record<string, unknown>): Promise<any>;
493
- update(collection: string, recordId: string, data: Record<string, unknown>): Promise<any>;
494
- delete(collection: string, recordId: string): Promise<any>;
493
+ }): Promise<unknown[]>;
494
+ create(collection: string, data: Record<string, unknown>): Promise<unknown>;
495
+ update(collection: string, recordId: string, data: Record<string, unknown>): Promise<unknown>;
496
+ delete(collection: string, recordId: string): Promise<unknown>;
495
497
  };
496
498
  /**
497
499
  * Call a platform integration endpoint (e.g. "openai/chat-completion",
@@ -499,7 +501,7 @@ interface CronContext {
499
501
  * APP_OWNER_JWT the rest of the SDK uses for server-side billed calls.
500
502
  */
501
503
  integrations: {
502
- call(endpoint: string, params?: Record<string, unknown>): Promise<any>;
504
+ call(endpoint: string, params?: Record<string, unknown>): Promise<unknown>;
503
505
  };
504
506
  /** App owner's user ID */
505
507
  ownerUserId: string;
@@ -669,7 +671,8 @@ interface ScreenshotOptions {
669
671
  }
670
672
  interface ScreenshotEnv extends PlatformWorkerEnv {
671
673
  APP_NAME: string;
672
- APP_IDENTITY_TOKEN: string;
674
+ /** Absent until the app's first deploy registers it — see appendAppIdentity. */
675
+ APP_IDENTITY_TOKEN?: string;
673
676
  }
674
677
  interface ScreenshotResult {
675
678
  /** PNG bytes. */
@@ -1390,7 +1393,7 @@ declare abstract class BaseRoom<E = Record<string, unknown>> {
1390
1393
  fetch(request: Request): Promise<Response>;
1391
1394
  private handleWebSocketUpgrade;
1392
1395
  webSocketMessage(ws: WebSocket, message: ArrayBuffer | string): Promise<void>;
1393
- webSocketClose(ws: WebSocket, code: number, reason: string): Promise<void>;
1396
+ webSocketClose(ws: WebSocket, _code: number, _reason: string): Promise<void>;
1394
1397
  webSocketError(ws: WebSocket, error: unknown): Promise<void>;
1395
1398
  alarm(): Promise<void>;
1396
1399
  /**
@@ -1398,7 +1401,7 @@ declare abstract class BaseRoom<E = Record<string, unknown>> {
1398
1401
  * Return an augmented attachment to serialize on the WebSocket,
1399
1402
  * or void to use the default attachment.
1400
1403
  */
1401
- protected onConnect(ws: WebSocket, user: UserAttachment): UserAttachment | void | Promise<UserAttachment | void>;
1404
+ protected onConnect(_ws: WebSocket, _user: UserAttachment): UserAttachment | void | Promise<UserAttachment | void>;
1402
1405
  /**
1403
1406
  * Called for each parsed JSON message.
1404
1407
  */
@@ -1413,7 +1416,7 @@ declare abstract class BaseRoom<E = Record<string, unknown>> {
1413
1416
  /**
1414
1417
  * Called when a WebSocket disconnects.
1415
1418
  */
1416
- protected onDisconnect(ws: WebSocket, user: UserAttachment): void | Promise<void>;
1419
+ protected onDisconnect(_ws: WebSocket, _user: UserAttachment): void | Promise<void>;
1417
1420
  /**
1418
1421
  * Called for HTTP requests that are NOT WebSocket upgrades.
1419
1422
  */
@@ -1670,7 +1673,6 @@ declare class SchemaRegistry {
1670
1673
  registerTrusted(schema: CollectionSchema): void;
1671
1674
  get(name: string): CollectionSchema | undefined;
1672
1675
  has(name: string): boolean;
1673
- hasTrusted(name: string): boolean;
1674
1676
  all(): CollectionSchema[];
1675
1677
  names(): string[];
1676
1678
  }
@@ -1742,6 +1744,12 @@ declare class RecordRoom<E = Record<string, unknown>> extends BaseRoom<E> {
1742
1744
  private ownerUserId;
1743
1745
  /** True until the first fetch() completes — detects hibernation wake-up */
1744
1746
  private freshConstruct;
1747
+ /**
1748
+ * Per-connection `[DO Perf]` timing logs are noisy on every hot path, so
1749
+ * they're gated behind a `DEEPSPACE_DO_PERF` env binding (set it to any
1750
+ * truthy value on the worker to opt in). Off by default.
1751
+ */
1752
+ private get perfLogEnabled();
1745
1753
  constructor(state: DurableObjectState, env: unknown, schemas?: CollectionSchema[], config?: RecordRoomConfig);
1746
1754
  private getPermissionContext;
1747
1755
  fetch(request: Request): Promise<Response>;
@@ -1754,12 +1762,13 @@ declare class RecordRoom<E = Record<string, unknown>> extends BaseRoom<E> {
1754
1762
  private ensureCollectionTable;
1755
1763
  private ensureAllCollectionTables;
1756
1764
  protected onConnect(ws: WebSocket, user: UserAttachment): Promise<ConnectionAttachment>;
1757
- protected onMessage(ws: WebSocket, user: UserAttachment, msg: {
1758
- type: string;
1759
- [key: string]: unknown;
1760
- }): Promise<void>;
1761
- protected onBinaryMessage(ws: WebSocket, user: UserAttachment, data: ArrayBuffer): Promise<void>;
1762
- protected onDisconnect(ws: WebSocket, user: UserAttachment): void;
1765
+ /**
1766
+ * Required to satisfy BaseRoom's abstract contract, but never invoked:
1767
+ * RecordRoom overrides `webSocketMessage`/`webSocketClose` directly (below),
1768
+ * so the BaseRoom dispatch path that would call this never runs. All real
1769
+ * message handling lives in `handleRecordMessage`.
1770
+ */
1771
+ protected onMessage(): void;
1763
1772
  webSocketMessage(ws: WebSocket, message: ArrayBuffer | string): Promise<void>;
1764
1773
  webSocketClose(ws: WebSocket, code: number, reason: string): Promise<void>;
1765
1774
  webSocketError(ws: WebSocket, error: unknown): Promise<void>;
@@ -1803,12 +1812,12 @@ declare class YjsRoom<E = Record<string, unknown>> extends BaseRoom<E> {
1803
1812
  private getDoc;
1804
1813
  private persistDoc;
1805
1814
  protected onConnect(ws: WebSocket, user: UserAttachment): YjsAttachment;
1806
- protected onMessage(ws: WebSocket, user: UserAttachment, message: {
1815
+ protected onMessage(_ws: WebSocket, _user: UserAttachment, _message: {
1807
1816
  type: string;
1808
1817
  [key: string]: unknown;
1809
1818
  }): void;
1810
1819
  protected onBinaryMessage(ws: WebSocket, user: UserAttachment, data: ArrayBuffer): void;
1811
- protected onDisconnect(ws: WebSocket, user: UserAttachment): void;
1820
+ protected onDisconnect(ws: WebSocket, _user: UserAttachment): void;
1812
1821
  private handleSync;
1813
1822
  private handleAwareness;
1814
1823
  private readAwarenessUpdates;
@@ -1890,13 +1899,13 @@ declare abstract class GameRoom<E = Record<string, unknown>> extends BaseRoom<E>
1890
1899
  */
1891
1900
  protected abstract onTick(state: Record<string, unknown>, inputs: GameInput[], tick: number): Record<string, unknown> | undefined | Promise<Record<string, unknown> | undefined>;
1892
1901
  /** Called when a player connects */
1893
- protected onPlayerJoin(player: Player): void;
1902
+ protected onPlayerJoin(_player: Player): void;
1894
1903
  /** Called when a player disconnects */
1895
- protected onPlayerLeave(player: Player): void;
1904
+ protected onPlayerLeave(_player: Player): void;
1896
1905
  /** Called when the game starts */
1897
1906
  protected onGameStart(): void;
1898
1907
  /** Called when the game ends */
1899
- protected onGameEnd(finalState: Record<string, unknown>): void;
1908
+ protected onGameEnd(_finalState: Record<string, unknown>): void;
1900
1909
  /**
1901
1910
  * Called once when the DO first hydrates persisted state from storage.
1902
1911
  * Receives the parsed state blob as it was written by a previous build.
@@ -3005,8 +3014,7 @@ interface VerifiedAuth {
3005
3014
  userId: string;
3006
3015
  claims: JwtClaims;
3007
3016
  }
3008
- interface VerifyResult extends VerifiedAuth {
3009
- }
3017
+ type VerifyResult = VerifiedAuth;
3010
3018
  interface TokenDebugInfo {
3011
3019
  iss?: string | null;
3012
3020
  aud?: string | string[] | null;
@@ -3048,6 +3056,33 @@ declare function timingSafeEqualHex(a: string, b: string): Promise<boolean>;
3048
3056
 
3049
3057
  declare function decodeJwtPayload(token: string | null | undefined): TokenDebugInfo | undefined;
3050
3058
 
3059
+ /**
3060
+ * Test-account identification, shared by every platform worker.
3061
+ *
3062
+ * Test accounts (created via `deepspace test-accounts`) are real Better Auth
3063
+ * users demarcated three ways, and a caller may present as any of them
3064
+ * depending on where the check runs:
3065
+ * - their email always ends with @deepspace.test (enforced at creation)
3066
+ * - their JWTs carry `isTestAccount: true` (minted by the auth-worker,
3067
+ * the source of truth)
3068
+ * - their billing profile's subscription tier is 'test' (mirrored by the
3069
+ * api-worker on every authenticated request)
3070
+ *
3071
+ * Gate anything a test account must not do with these helpers rather than
3072
+ * hand-rolled string comparisons, so the policy stays in one place. Prefer
3073
+ * checking the claim when a verified JWT is at hand, and the tier as the
3074
+ * fallback for persisted state that may outlive a claim (e.g. rows written
3075
+ * before a guard existed).
3076
+ */
3077
+
3078
+ declare const TEST_ACCOUNT_EMAIL_SUFFIX = "@deepspace.test";
3079
+ /** True when the email belongs to a test account (case-insensitive). */
3080
+ declare function isTestAccountEmail(email: string | null | undefined): boolean;
3081
+ /** True when verified JWT claims identify the caller as a test account. */
3082
+ declare function isTestAccountClaims(claims: JwtClaims | Record<string, unknown> | null | undefined): boolean;
3083
+ /** True when a billing subscription tier marks a test account. */
3084
+ declare function isTestAccountTier(tier: string | null | undefined): boolean;
3085
+
3051
3086
  interface DeepSpaceAuthConfig {
3052
3087
  /** D1 database binding */
3053
3088
  database: D1Database;
@@ -3089,6 +3124,7 @@ interface DeepSpaceAuthConfig {
3089
3124
  declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.Auth<{
3090
3125
  plugins: [{
3091
3126
  id: "organization";
3127
+ version: string;
3092
3128
  endpoints: better_auth_plugins.OrganizationEndpoints<better_auth_plugins.OrganizationOptions & {
3093
3129
  teams: {
3094
3130
  enabled: true;
@@ -3225,6 +3261,7 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3225
3261
  INVITATION_NOT_FOUND: better_auth.RawError<"INVITATION_NOT_FOUND">;
3226
3262
  YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION: better_auth.RawError<"YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION">;
3227
3263
  EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION: better_auth.RawError<"EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION">;
3264
+ EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION: better_auth.RawError<"EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION">;
3228
3265
  YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION">;
3229
3266
  INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION: better_auth.RawError<"INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION">;
3230
3267
  YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE">;
@@ -3259,6 +3296,7 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3259
3296
  ROLE_NAME_IS_ALREADY_TAKEN: better_auth.RawError<"ROLE_NAME_IS_ALREADY_TAKEN">;
3260
3297
  CANNOT_DELETE_A_PRE_DEFINED_ROLE: better_auth.RawError<"CANNOT_DELETE_A_PRE_DEFINED_ROLE">;
3261
3298
  ROLE_IS_ASSIGNED_TO_MEMBERS: better_auth.RawError<"ROLE_IS_ASSIGNED_TO_MEMBERS">;
3299
+ INVALID_TEAM_ID: better_auth.RawError<"INVALID_TEAM_ID">;
3262
3300
  };
3263
3301
  options: NoInfer<better_auth_plugins.OrganizationOptions & {
3264
3302
  teams: {
@@ -3270,13 +3308,17 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3270
3308
  }>;
3271
3309
  }, {
3272
3310
  id: "two-factor";
3311
+ version: string;
3273
3312
  endpoints: {
3274
3313
  enableTwoFactor: better_auth.StrictEndpoint<"/two-factor/enable", {
3275
3314
  method: "POST";
3276
- body: better_auth.ZodObject<{
3277
- password: better_auth.ZodString;
3278
- issuer: better_auth.ZodOptional<better_auth.ZodString>;
3279
- }, better_auth.$strip>;
3315
+ body: zod.ZodObject<{
3316
+ password: zod.ZodOptional<zod.ZodString>;
3317
+ issuer: zod.ZodOptional<zod.ZodString>;
3318
+ }, zod_v4_core.$strip> | zod.ZodObject<{
3319
+ password: zod.ZodString;
3320
+ issuer: zod.ZodOptional<zod.ZodString>;
3321
+ }, zod_v4_core.$strip>;
3280
3322
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
3281
3323
  session: {
3282
3324
  session: Record<string, any> & {
@@ -3337,9 +3379,11 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3337
3379
  }>;
3338
3380
  disableTwoFactor: better_auth.StrictEndpoint<"/two-factor/disable", {
3339
3381
  method: "POST";
3340
- body: better_auth.ZodObject<{
3341
- password: better_auth.ZodString;
3342
- }, better_auth.$strip>;
3382
+ body: zod.ZodObject<{
3383
+ password: zod.ZodOptional<zod.ZodString>;
3384
+ }, zod_v4_core.$strip> | zod.ZodObject<{
3385
+ password: zod.ZodString;
3386
+ }, zod_v4_core.$strip>;
3343
3387
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
3344
3388
  session: {
3345
3389
  session: Record<string, any> & {
@@ -3391,11 +3435,11 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3391
3435
  }>;
3392
3436
  verifyBackupCode: better_auth.StrictEndpoint<"/two-factor/verify-backup-code", {
3393
3437
  method: "POST";
3394
- body: better_auth.ZodObject<{
3395
- code: better_auth.ZodString;
3396
- disableSession: better_auth.ZodOptional<better_auth.ZodBoolean>;
3397
- trustDevice: better_auth.ZodOptional<better_auth.ZodBoolean>;
3398
- }, better_auth.$strip>;
3438
+ body: zod.ZodObject<{
3439
+ code: zod.ZodString;
3440
+ disableSession: zod.ZodOptional<zod.ZodBoolean>;
3441
+ trustDevice: zod.ZodOptional<zod.ZodBoolean>;
3442
+ }, zod_v4_core.$strip>;
3399
3443
  metadata: {
3400
3444
  openapi: {
3401
3445
  description: string;
@@ -3502,9 +3546,11 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3502
3546
  }>;
3503
3547
  generateBackupCodes: better_auth.StrictEndpoint<"/two-factor/generate-backup-codes", {
3504
3548
  method: "POST";
3505
- body: better_auth.ZodObject<{
3506
- password: better_auth.ZodString;
3507
- }, better_auth.$strip>;
3549
+ body: zod.ZodObject<{
3550
+ password: zod.ZodOptional<zod.ZodString>;
3551
+ }, zod_v4_core.$strip> | zod.ZodObject<{
3552
+ password: zod.ZodString;
3553
+ }, zod_v4_core.$strip>;
3508
3554
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
3509
3555
  session: {
3510
3556
  session: Record<string, any> & {
@@ -3566,18 +3612,18 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3566
3612
  }>;
3567
3613
  viewBackupCodes: better_auth.StrictEndpoint<string, {
3568
3614
  method: "POST";
3569
- body: better_auth.ZodObject<{
3570
- userId: better_auth.ZodCoercedString<unknown>;
3571
- }, better_auth.$strip>;
3615
+ body: zod.ZodObject<{
3616
+ userId: zod.ZodCoercedString<unknown>;
3617
+ }, zod_v4_core.$strip>;
3572
3618
  }, {
3573
3619
  status: boolean;
3574
3620
  backupCodes: string[];
3575
3621
  }>;
3576
3622
  sendTwoFactorOTP: better_auth.StrictEndpoint<"/two-factor/send-otp", {
3577
3623
  method: "POST";
3578
- body: better_auth.ZodOptional<better_auth.ZodObject<{
3579
- trustDevice: better_auth.ZodOptional<better_auth.ZodBoolean>;
3580
- }, better_auth.$strip>>;
3624
+ body: zod.ZodOptional<zod.ZodObject<{
3625
+ trustDevice: zod.ZodOptional<zod.ZodBoolean>;
3626
+ }, zod_v4_core.$strip>>;
3581
3627
  metadata: {
3582
3628
  openapi: {
3583
3629
  summary: string;
@@ -3606,10 +3652,10 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3606
3652
  }>;
3607
3653
  verifyTwoFactorOTP: better_auth.StrictEndpoint<"/two-factor/verify-otp", {
3608
3654
  method: "POST";
3609
- body: better_auth.ZodObject<{
3610
- code: better_auth.ZodString;
3611
- trustDevice: better_auth.ZodOptional<better_auth.ZodBoolean>;
3612
- }, better_auth.$strip>;
3655
+ body: zod.ZodObject<{
3656
+ code: zod.ZodString;
3657
+ trustDevice: zod.ZodOptional<zod.ZodBoolean>;
3658
+ }, zod_v4_core.$strip>;
3613
3659
  metadata: {
3614
3660
  openapi: {
3615
3661
  summary: string;
@@ -3695,9 +3741,9 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3695
3741
  }>;
3696
3742
  generateTOTP: better_auth.StrictEndpoint<string, {
3697
3743
  method: "POST";
3698
- body: better_auth.ZodObject<{
3699
- secret: better_auth.ZodString;
3700
- }, better_auth.$strip>;
3744
+ body: zod.ZodObject<{
3745
+ secret: zod.ZodString;
3746
+ }, zod_v4_core.$strip>;
3701
3747
  metadata: {
3702
3748
  openapi: {
3703
3749
  summary: string;
@@ -3749,9 +3795,11 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3749
3795
  };
3750
3796
  };
3751
3797
  }>)[];
3752
- body: better_auth.ZodObject<{
3753
- password: better_auth.ZodString;
3754
- }, better_auth.$strip>;
3798
+ body: zod.ZodObject<{
3799
+ password: zod.ZodOptional<zod.ZodString>;
3800
+ }, zod_v4_core.$strip> | zod.ZodObject<{
3801
+ password: zod.ZodString;
3802
+ }, zod_v4_core.$strip>;
3755
3803
  metadata: {
3756
3804
  openapi: {
3757
3805
  summary: string;
@@ -3780,10 +3828,10 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3780
3828
  }>;
3781
3829
  verifyTOTP: better_auth.StrictEndpoint<"/two-factor/verify-totp", {
3782
3830
  method: "POST";
3783
- body: better_auth.ZodObject<{
3784
- code: better_auth.ZodString;
3785
- trustDevice: better_auth.ZodOptional<better_auth.ZodBoolean>;
3786
- }, better_auth.$strip>;
3831
+ body: zod.ZodObject<{
3832
+ code: zod.ZodString;
3833
+ trustDevice: zod.ZodOptional<zod.ZodBoolean>;
3834
+ }, zod_v4_core.$strip>;
3787
3835
  metadata: {
3788
3836
  openapi: {
3789
3837
  summary: string;
@@ -3829,6 +3877,7 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3829
3877
  matcher(context: better_auth.HookEndpointContext): boolean;
3830
3878
  handler: (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
3831
3879
  twoFactorRedirect: boolean;
3880
+ twoFactorMethods: string[];
3832
3881
  } | undefined>;
3833
3882
  }[];
3834
3883
  };
@@ -3866,6 +3915,25 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3866
3915
  };
3867
3916
  index: true;
3868
3917
  };
3918
+ verified: {
3919
+ type: "boolean";
3920
+ required: false;
3921
+ defaultValue: true;
3922
+ input: false;
3923
+ };
3924
+ failedVerificationCount: {
3925
+ type: "number";
3926
+ required: false;
3927
+ defaultValue: number;
3928
+ input: false;
3929
+ returned: false;
3930
+ };
3931
+ lockedUntil: {
3932
+ type: "date";
3933
+ required: false;
3934
+ input: false;
3935
+ returned: false;
3936
+ };
3869
3937
  };
3870
3938
  };
3871
3939
  };
@@ -3883,6 +3951,7 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
3883
3951
  INVALID_BACKUP_CODE: better_auth.RawError<"INVALID_BACKUP_CODE">;
3884
3952
  INVALID_CODE: better_auth.RawError<"INVALID_CODE">;
3885
3953
  TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: better_auth.RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
3954
+ ACCOUNT_TEMPORARILY_LOCKED: better_auth.RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
3886
3955
  INVALID_TWO_FACTOR_COOKIE: better_auth.RawError<"INVALID_TWO_FACTOR_COOKIE">;
3887
3956
  };
3888
3957
  }];
@@ -3956,7 +4025,8 @@ interface SubscriptionRead {
3956
4025
  plans: PlanInfo[];
3957
4026
  }
3958
4027
  interface StarterAppEnv$1 extends ApiWorkerEnv {
3959
- APP_IDENTITY_TOKEN: string;
4028
+ /** Absent until the app's first deploy registers it — see appendAppIdentity. */
4029
+ APP_IDENTITY_TOKEN?: string;
3960
4030
  APP_NAME: string;
3961
4031
  }
3962
4032
  declare function getSubscription(c: Context<{
@@ -4043,7 +4113,8 @@ declare class CancelSubscriptionError extends Error {
4043
4113
  }
4044
4114
 
4045
4115
  interface StarterAppEnv extends ApiWorkerEnv {
4046
- APP_IDENTITY_TOKEN: string;
4116
+ /** Absent until the app's first deploy registers it — see appendAppIdentity. */
4117
+ APP_IDENTITY_TOKEN?: string;
4047
4118
  APP_NAME: string;
4048
4119
  }
4049
4120
  interface RefundResult {
@@ -4066,4 +4137,4 @@ declare class RefundError extends Error {
4066
4137
  constructor(message: string, status: number);
4067
4138
  }
4068
4139
 
4069
- export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, ALLOWED_BINDING_TYPES, APP_NAME_RULES, AUTO_PROVISIONABLE_TYPES, AUTO_PROVISION_SENTINEL, type ActionContext, type ActionHandler, type ActionResult, type ActionTools, type ApiWorkerEnv, type AppNameResolution, type AppNameValidation, type AuthWorkerEnv, BASE_USERS_SCHEMA, BUILT_IN_TOOLS, BaseRoom, CHANNELS_SCHEMA, CHANNEL_INVITATIONS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, CONVERSATION_SCHEMAS, COST_RATES, CancelSubscriptionError, type CancelSubscriptionOpts, type CancelSubscriptionResult, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type CollectionPermissionSummary, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ComposioToolsOptions, type ConvMemberData, type ConvMessageData, type ConvReactionData, type ConvReadCursorData, type ConvVoteData, type ConversationStateData, type CronContext, type CronExecution, CronRoom, type CronRoomConfig, type CronTask, type CustomBinding, type CustomBindingManifest, DEFAULT_CONTEXT_CONFIG, DEFAULT_DO_MANIFEST, DEFAULT_QUERY_LIMIT, DIRECTORY_SCHEMAS, type DOBindings, type DOManifest, type DOManifestEntry, type DebugApiContext, type DeepSpaceAIEnv, type DeepSpaceAIOptions, type DeepSpaceAuth, type DeepSpaceAuthConfig, type DirectoryCommunityData, type DirectoryConversationData, type DirectoryMembershipData, type DirectoryPostData, type DoMigrationDirective, type DoMigrationPlan, type ExistingDOBinding, GLOBAL_DO_TYPES, GLOBAL_DO_TYPE_NAMES, type GameInput, GameRoom, type GameRoomConfig, type GetActionData, type GlobalDOType, type Job, type JobContext, JobRoom, type JobRoomConfig, type JobStatus, type JwtClaims, type JwtVerifierConfig, MESSAGES_SCHEMA, type MutateActionData, type PermissionAnalysis, type PermissionContext, type PermissionLevel, type PermissionSource, type PlanInfo, type PlatformWorkerEnv, type Player, type PrefixResult, type PresencePeer, PresenceRoom, type QueryActionData, REACTIONS_SCHEMA, READ_RECEIPTS_SCHEMA, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_NAMES, type RecordContext, RecordRoom, type RecordRoomConfig, RefundError, type RefundOpts, type RefundResult, type ResolvedColumn, type ResolvedPermission, type RolePermissions, type RunMigrationsResult, SYSTEM_COLLECTION_SCHEMAS, SYSTEM_MANAGED_COLUMNS, SchemaRegistry, type ScopeContext, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, type ScreenshotOptions, type ScreenshotResult, type SharedConnection, type StoredRecord, SubscriptionAuthError, type SubscriptionContext, type SubscriptionRead, SubscriptionRequiredError, type SubscriptionStatus, type Summarizer, type TokenDebugInfo, type ToolResult, type ToolSchema, type ToolsApiContext, USERS_COLUMNS, type User, type UserAttachment, type UserContext, VOTING_SCHEMAS, type ValidationError, type VerifiedAuth, type VerifyOutcome, type VerifyResult, type Viewport, WORKSPACE_SCHEMAS, type YjsContext, YjsRoom, analyzePermissions, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, authWorkerFetch, bindingManifestFromOutputConfig, broadcastChange, broadcastYjsUpdate, buildCronContext, buildTableSelect, buildUiParts, canCreate, canDelete, canRead, canUpdate, cancelSubscription, capToolResultSize, captureScreenshot, checkFieldPermissions, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDeepSpaceAI, createDeepSpaceAuth, createScopedR2Handler, dataToColumnValues, decodeJwtPayload, deleteChatCascade, deleteRecord, enqueueJob, executeQuery, getAllUsers, getChat, getGlobalDOSchemas, getGlobalDOType, getOrCreateYjsDoc, getRecord, getRolePermissions, getSubscription, getUser, getYjsDocKey, handleApiRequest, handleDelete, handlePut, handleSetRole, handleSubscribe, handleToolsRequest, handleUnsubscribe, handleUserList, handleUserUpdate, handleYjsBinaryMessage, handleYjsJoin, handleYjsLeave, isAutoProvision, isOwner, lintSchema, loadMessages, makeDefaultSummarizer, meterAi, meterUsage, meterVectorize, noopPermissionContext, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, putRecord, readRecord, recordMatchesSubscription, refundInvoice, registerUser, requireSubscription, resolveAppName, resolveColumn, rowToData, runMigrations, saveYjsDoc, timingSafeEqualHex, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema };
4140
+ export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, ALLOWED_BINDING_TYPES, APP_NAME_RULES, AUTO_PROVISIONABLE_TYPES, AUTO_PROVISION_SENTINEL, type ActionContext, type ActionHandler, type ActionResult, type ActionTools, type ApiWorkerEnv, type AppNameResolution, type AppNameValidation, type AuthWorkerEnv, BASE_USERS_SCHEMA, BUILT_IN_TOOLS, BaseRoom, CHANNELS_SCHEMA, CHANNEL_INVITATIONS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, CONVERSATION_SCHEMAS, COST_RATES, CancelSubscriptionError, type CancelSubscriptionOpts, type CancelSubscriptionResult, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type CollectionPermissionSummary, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ComposioToolsOptions, type ConvMemberData, type ConvMessageData, type ConvReactionData, type ConvReadCursorData, type ConvVoteData, type ConversationStateData, type CronContext, type CronExecution, CronRoom, type CronRoomConfig, type CronTask, type CustomBinding, type CustomBindingManifest, DEFAULT_CONTEXT_CONFIG, DEFAULT_DO_MANIFEST, DEFAULT_QUERY_LIMIT, DIRECTORY_SCHEMAS, type DOBindings, type DOManifest, type DOManifestEntry, type DebugApiContext, type DeepSpaceAIEnv, type DeepSpaceAIOptions, type DeepSpaceAuth, type DeepSpaceAuthConfig, type DirectoryCommunityData, type DirectoryConversationData, type DirectoryMembershipData, type DirectoryPostData, type DoMigrationDirective, type DoMigrationPlan, type ExistingDOBinding, GLOBAL_DO_TYPES, GLOBAL_DO_TYPE_NAMES, type GameInput, GameRoom, type GameRoomConfig, type GetActionData, type GlobalDOType, type Job, type JobContext, JobRoom, type JobRoomConfig, type JobStatus, type JwtClaims, type JwtVerifierConfig, MESSAGES_SCHEMA, type MutateActionData, type PermissionAnalysis, type PermissionContext, type PermissionLevel, type PermissionSource, type PlanInfo, type PlatformWorkerEnv, type Player, type PrefixResult, type PresencePeer, PresenceRoom, type QueryActionData, REACTIONS_SCHEMA, READ_RECEIPTS_SCHEMA, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_NAMES, type RecordContext, RecordRoom, type RecordRoomConfig, RefundError, type RefundOpts, type RefundResult, type ResolvedColumn, type ResolvedPermission, type RolePermissions, type RunMigrationsResult, SYSTEM_COLLECTION_SCHEMAS, SYSTEM_MANAGED_COLUMNS, SchemaRegistry, type ScopeContext, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, type ScreenshotOptions, type ScreenshotResult, type SharedConnection, type StoredRecord, SubscriptionAuthError, type SubscriptionContext, type SubscriptionRead, SubscriptionRequiredError, type SubscriptionStatus, type Summarizer, TEST_ACCOUNT_EMAIL_SUFFIX, type TokenDebugInfo, type ToolResult, type ToolSchema, type ToolsApiContext, USERS_COLUMNS, type User, type UserAttachment, type UserContext, VOTING_SCHEMAS, type ValidationError, type VerifiedAuth, type VerifyOutcome, type VerifyResult, type Viewport, WORKSPACE_SCHEMAS, type YjsContext, YjsRoom, analyzePermissions, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, authWorkerFetch, bindingManifestFromOutputConfig, broadcastChange, broadcastYjsUpdate, buildCronContext, buildTableSelect, buildUiParts, canCreate, canDelete, canRead, canUpdate, cancelSubscription, capToolResultSize, captureScreenshot, checkFieldPermissions, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDeepSpaceAI, createDeepSpaceAuth, createScopedR2Handler, dataToColumnValues, decodeJwtPayload, deleteChatCascade, deleteRecord, enqueueJob, executeQuery, getAllUsers, getChat, getGlobalDOSchemas, getGlobalDOType, getOrCreateYjsDoc, getRecord, getRolePermissions, getSubscription, getUser, getYjsDocKey, handleApiRequest, handleDelete, handlePut, handleSetRole, handleSubscribe, handleToolsRequest, handleUnsubscribe, handleUserList, handleUserUpdate, handleYjsBinaryMessage, handleYjsJoin, handleYjsLeave, isAutoProvision, isOwner, isTestAccountClaims, isTestAccountEmail, isTestAccountTier, lintSchema, loadMessages, makeDefaultSummarizer, meterAi, meterUsage, meterVectorize, noopPermissionContext, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, putRecord, readRecord, recordMatchesSubscription, refundInvoice, registerUser, requireSubscription, resolveAppName, resolveColumn, rowToData, runMigrations, saveYjsDoc, timingSafeEqualHex, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema };