deepspace 0.5.0 → 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.
- package/dist/cli.js +142 -42
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +837 -3652
- package/dist/server.d.ts +105 -39
- package/dist/server.js +32 -16
- package/dist/server.js.map +1 -1
- package/dist/worker.d.ts +101 -37
- package/dist/worker.js +27 -5
- package/dist/worker.js.map +1 -1
- package/features/docs/src/editor/useDocEditor.ts +5 -1
- package/features/messaging/src/ChatPage.tsx +6 -1
- package/features/messaging/src/hooks/useChatChannel.ts +18 -6
- package/package.json +7 -3
- package/scripts/add-feature.cjs +25 -16
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';
|
|
@@ -669,7 +671,8 @@ interface ScreenshotOptions {
|
|
|
669
671
|
}
|
|
670
672
|
interface ScreenshotEnv extends PlatformWorkerEnv {
|
|
671
673
|
APP_NAME: string;
|
|
672
|
-
|
|
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. */
|
|
@@ -3053,6 +3056,33 @@ declare function timingSafeEqualHex(a: string, b: string): Promise<boolean>;
|
|
|
3053
3056
|
|
|
3054
3057
|
declare function decodeJwtPayload(token: string | null | undefined): TokenDebugInfo | undefined;
|
|
3055
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
|
+
|
|
3056
3086
|
interface DeepSpaceAuthConfig {
|
|
3057
3087
|
/** D1 database binding */
|
|
3058
3088
|
database: D1Database;
|
|
@@ -3094,6 +3124,7 @@ interface DeepSpaceAuthConfig {
|
|
|
3094
3124
|
declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.Auth<{
|
|
3095
3125
|
plugins: [{
|
|
3096
3126
|
id: "organization";
|
|
3127
|
+
version: string;
|
|
3097
3128
|
endpoints: better_auth_plugins.OrganizationEndpoints<better_auth_plugins.OrganizationOptions & {
|
|
3098
3129
|
teams: {
|
|
3099
3130
|
enabled: true;
|
|
@@ -3230,6 +3261,7 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3230
3261
|
INVITATION_NOT_FOUND: better_auth.RawError<"INVITATION_NOT_FOUND">;
|
|
3231
3262
|
YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION: better_auth.RawError<"YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION">;
|
|
3232
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">;
|
|
3233
3265
|
YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION">;
|
|
3234
3266
|
INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION: better_auth.RawError<"INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION">;
|
|
3235
3267
|
YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE">;
|
|
@@ -3264,6 +3296,7 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3264
3296
|
ROLE_NAME_IS_ALREADY_TAKEN: better_auth.RawError<"ROLE_NAME_IS_ALREADY_TAKEN">;
|
|
3265
3297
|
CANNOT_DELETE_A_PRE_DEFINED_ROLE: better_auth.RawError<"CANNOT_DELETE_A_PRE_DEFINED_ROLE">;
|
|
3266
3298
|
ROLE_IS_ASSIGNED_TO_MEMBERS: better_auth.RawError<"ROLE_IS_ASSIGNED_TO_MEMBERS">;
|
|
3299
|
+
INVALID_TEAM_ID: better_auth.RawError<"INVALID_TEAM_ID">;
|
|
3267
3300
|
};
|
|
3268
3301
|
options: NoInfer<better_auth_plugins.OrganizationOptions & {
|
|
3269
3302
|
teams: {
|
|
@@ -3275,13 +3308,17 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3275
3308
|
}>;
|
|
3276
3309
|
}, {
|
|
3277
3310
|
id: "two-factor";
|
|
3311
|
+
version: string;
|
|
3278
3312
|
endpoints: {
|
|
3279
3313
|
enableTwoFactor: better_auth.StrictEndpoint<"/two-factor/enable", {
|
|
3280
3314
|
method: "POST";
|
|
3281
|
-
body:
|
|
3282
|
-
password:
|
|
3283
|
-
issuer:
|
|
3284
|
-
},
|
|
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>;
|
|
3285
3322
|
use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
3286
3323
|
session: {
|
|
3287
3324
|
session: Record<string, any> & {
|
|
@@ -3342,9 +3379,11 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3342
3379
|
}>;
|
|
3343
3380
|
disableTwoFactor: better_auth.StrictEndpoint<"/two-factor/disable", {
|
|
3344
3381
|
method: "POST";
|
|
3345
|
-
body:
|
|
3346
|
-
password:
|
|
3347
|
-
},
|
|
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>;
|
|
3348
3387
|
use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
3349
3388
|
session: {
|
|
3350
3389
|
session: Record<string, any> & {
|
|
@@ -3396,11 +3435,11 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3396
3435
|
}>;
|
|
3397
3436
|
verifyBackupCode: better_auth.StrictEndpoint<"/two-factor/verify-backup-code", {
|
|
3398
3437
|
method: "POST";
|
|
3399
|
-
body:
|
|
3400
|
-
code:
|
|
3401
|
-
disableSession:
|
|
3402
|
-
trustDevice:
|
|
3403
|
-
},
|
|
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>;
|
|
3404
3443
|
metadata: {
|
|
3405
3444
|
openapi: {
|
|
3406
3445
|
description: string;
|
|
@@ -3507,9 +3546,11 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3507
3546
|
}>;
|
|
3508
3547
|
generateBackupCodes: better_auth.StrictEndpoint<"/two-factor/generate-backup-codes", {
|
|
3509
3548
|
method: "POST";
|
|
3510
|
-
body:
|
|
3511
|
-
password:
|
|
3512
|
-
},
|
|
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>;
|
|
3513
3554
|
use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
3514
3555
|
session: {
|
|
3515
3556
|
session: Record<string, any> & {
|
|
@@ -3571,18 +3612,18 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3571
3612
|
}>;
|
|
3572
3613
|
viewBackupCodes: better_auth.StrictEndpoint<string, {
|
|
3573
3614
|
method: "POST";
|
|
3574
|
-
body:
|
|
3575
|
-
userId:
|
|
3576
|
-
},
|
|
3615
|
+
body: zod.ZodObject<{
|
|
3616
|
+
userId: zod.ZodCoercedString<unknown>;
|
|
3617
|
+
}, zod_v4_core.$strip>;
|
|
3577
3618
|
}, {
|
|
3578
3619
|
status: boolean;
|
|
3579
3620
|
backupCodes: string[];
|
|
3580
3621
|
}>;
|
|
3581
3622
|
sendTwoFactorOTP: better_auth.StrictEndpoint<"/two-factor/send-otp", {
|
|
3582
3623
|
method: "POST";
|
|
3583
|
-
body:
|
|
3584
|
-
trustDevice:
|
|
3585
|
-
},
|
|
3624
|
+
body: zod.ZodOptional<zod.ZodObject<{
|
|
3625
|
+
trustDevice: zod.ZodOptional<zod.ZodBoolean>;
|
|
3626
|
+
}, zod_v4_core.$strip>>;
|
|
3586
3627
|
metadata: {
|
|
3587
3628
|
openapi: {
|
|
3588
3629
|
summary: string;
|
|
@@ -3611,10 +3652,10 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3611
3652
|
}>;
|
|
3612
3653
|
verifyTwoFactorOTP: better_auth.StrictEndpoint<"/two-factor/verify-otp", {
|
|
3613
3654
|
method: "POST";
|
|
3614
|
-
body:
|
|
3615
|
-
code:
|
|
3616
|
-
trustDevice:
|
|
3617
|
-
},
|
|
3655
|
+
body: zod.ZodObject<{
|
|
3656
|
+
code: zod.ZodString;
|
|
3657
|
+
trustDevice: zod.ZodOptional<zod.ZodBoolean>;
|
|
3658
|
+
}, zod_v4_core.$strip>;
|
|
3618
3659
|
metadata: {
|
|
3619
3660
|
openapi: {
|
|
3620
3661
|
summary: string;
|
|
@@ -3700,9 +3741,9 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3700
3741
|
}>;
|
|
3701
3742
|
generateTOTP: better_auth.StrictEndpoint<string, {
|
|
3702
3743
|
method: "POST";
|
|
3703
|
-
body:
|
|
3704
|
-
secret:
|
|
3705
|
-
},
|
|
3744
|
+
body: zod.ZodObject<{
|
|
3745
|
+
secret: zod.ZodString;
|
|
3746
|
+
}, zod_v4_core.$strip>;
|
|
3706
3747
|
metadata: {
|
|
3707
3748
|
openapi: {
|
|
3708
3749
|
summary: string;
|
|
@@ -3754,9 +3795,11 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3754
3795
|
};
|
|
3755
3796
|
};
|
|
3756
3797
|
}>)[];
|
|
3757
|
-
body:
|
|
3758
|
-
password:
|
|
3759
|
-
},
|
|
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>;
|
|
3760
3803
|
metadata: {
|
|
3761
3804
|
openapi: {
|
|
3762
3805
|
summary: string;
|
|
@@ -3785,10 +3828,10 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3785
3828
|
}>;
|
|
3786
3829
|
verifyTOTP: better_auth.StrictEndpoint<"/two-factor/verify-totp", {
|
|
3787
3830
|
method: "POST";
|
|
3788
|
-
body:
|
|
3789
|
-
code:
|
|
3790
|
-
trustDevice:
|
|
3791
|
-
},
|
|
3831
|
+
body: zod.ZodObject<{
|
|
3832
|
+
code: zod.ZodString;
|
|
3833
|
+
trustDevice: zod.ZodOptional<zod.ZodBoolean>;
|
|
3834
|
+
}, zod_v4_core.$strip>;
|
|
3792
3835
|
metadata: {
|
|
3793
3836
|
openapi: {
|
|
3794
3837
|
summary: string;
|
|
@@ -3834,6 +3877,7 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3834
3877
|
matcher(context: better_auth.HookEndpointContext): boolean;
|
|
3835
3878
|
handler: (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
3836
3879
|
twoFactorRedirect: boolean;
|
|
3880
|
+
twoFactorMethods: string[];
|
|
3837
3881
|
} | undefined>;
|
|
3838
3882
|
}[];
|
|
3839
3883
|
};
|
|
@@ -3871,6 +3915,25 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3871
3915
|
};
|
|
3872
3916
|
index: true;
|
|
3873
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
|
+
};
|
|
3874
3937
|
};
|
|
3875
3938
|
};
|
|
3876
3939
|
};
|
|
@@ -3888,6 +3951,7 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
3888
3951
|
INVALID_BACKUP_CODE: better_auth.RawError<"INVALID_BACKUP_CODE">;
|
|
3889
3952
|
INVALID_CODE: better_auth.RawError<"INVALID_CODE">;
|
|
3890
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">;
|
|
3891
3955
|
INVALID_TWO_FACTOR_COOKIE: better_auth.RawError<"INVALID_TWO_FACTOR_COOKIE">;
|
|
3892
3956
|
};
|
|
3893
3957
|
}];
|
|
@@ -3961,7 +4025,8 @@ interface SubscriptionRead {
|
|
|
3961
4025
|
plans: PlanInfo[];
|
|
3962
4026
|
}
|
|
3963
4027
|
interface StarterAppEnv$1 extends ApiWorkerEnv {
|
|
3964
|
-
|
|
4028
|
+
/** Absent until the app's first deploy registers it — see appendAppIdentity. */
|
|
4029
|
+
APP_IDENTITY_TOKEN?: string;
|
|
3965
4030
|
APP_NAME: string;
|
|
3966
4031
|
}
|
|
3967
4032
|
declare function getSubscription(c: Context<{
|
|
@@ -4048,7 +4113,8 @@ declare class CancelSubscriptionError extends Error {
|
|
|
4048
4113
|
}
|
|
4049
4114
|
|
|
4050
4115
|
interface StarterAppEnv extends ApiWorkerEnv {
|
|
4051
|
-
|
|
4116
|
+
/** Absent until the app's first deploy registers it — see appendAppIdentity. */
|
|
4117
|
+
APP_IDENTITY_TOKEN?: string;
|
|
4052
4118
|
APP_NAME: string;
|
|
4053
4119
|
}
|
|
4054
4120
|
interface RefundResult {
|
|
@@ -4071,4 +4137,4 @@ declare class RefundError extends Error {
|
|
|
4071
4137
|
constructor(message: string, status: number);
|
|
4072
4138
|
}
|
|
4073
4139
|
|
|
4074
|
-
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 };
|
package/dist/server.js
CHANGED
|
@@ -669,13 +669,19 @@ async function composioTools(env, options) {
|
|
|
669
669
|
return tools;
|
|
670
670
|
}
|
|
671
671
|
|
|
672
|
+
// src/server/utils/app-identity.ts
|
|
673
|
+
function appendAppIdentity(headers, env) {
|
|
674
|
+
headers.delete("x-app-identity-token");
|
|
675
|
+
headers.delete("x-app-name");
|
|
676
|
+
if (!env.APP_IDENTITY_TOKEN) return;
|
|
677
|
+
headers.set("x-app-identity-token", env.APP_IDENTITY_TOKEN);
|
|
678
|
+
headers.set("x-app-name", env.APP_NAME);
|
|
679
|
+
}
|
|
680
|
+
|
|
672
681
|
// src/server/utils/screenshot.ts
|
|
673
682
|
async function captureScreenshot(env, opts) {
|
|
674
|
-
const headers = new Headers({
|
|
675
|
-
|
|
676
|
-
"x-app-identity-token": env.APP_IDENTITY_TOKEN,
|
|
677
|
-
"x-app-name": env.APP_NAME
|
|
678
|
-
});
|
|
683
|
+
const headers = new Headers({ "content-type": "application/json" });
|
|
684
|
+
appendAppIdentity(headers, env);
|
|
679
685
|
const res = await platformWorkerFetch(
|
|
680
686
|
env,
|
|
681
687
|
new Request("https://platform-internal/internal/screenshot", {
|
|
@@ -6840,6 +6846,18 @@ async function timingSafeEqualHex(a, b) {
|
|
|
6840
6846
|
return diff === 0;
|
|
6841
6847
|
}
|
|
6842
6848
|
|
|
6849
|
+
// src/server/auth/testAccounts.ts
|
|
6850
|
+
var TEST_ACCOUNT_EMAIL_SUFFIX = "@deepspace.test";
|
|
6851
|
+
function isTestAccountEmail(email) {
|
|
6852
|
+
return !!email && email.trim().toLowerCase().endsWith(TEST_ACCOUNT_EMAIL_SUFFIX);
|
|
6853
|
+
}
|
|
6854
|
+
function isTestAccountClaims(claims) {
|
|
6855
|
+
return claims?.isTestAccount === true;
|
|
6856
|
+
}
|
|
6857
|
+
function isTestAccountTier(tier) {
|
|
6858
|
+
return tier === "test";
|
|
6859
|
+
}
|
|
6860
|
+
|
|
6843
6861
|
// src/server/auth/betterAuth.ts
|
|
6844
6862
|
import { betterAuth } from "better-auth";
|
|
6845
6863
|
import { organization, twoFactor } from "better-auth/plugins";
|
|
@@ -6927,11 +6945,8 @@ function isEntitled(tier, status) {
|
|
|
6927
6945
|
|
|
6928
6946
|
// src/server/subscription.ts
|
|
6929
6947
|
function appIdentityHeaders(c, extra) {
|
|
6930
|
-
const h = new Headers({
|
|
6931
|
-
|
|
6932
|
-
"x-app-name": c.env.APP_NAME,
|
|
6933
|
-
...extra ?? {}
|
|
6934
|
-
});
|
|
6948
|
+
const h = new Headers(extra ?? {});
|
|
6949
|
+
appendAppIdentity(h, c.env);
|
|
6935
6950
|
const authz = c.req.header("authorization");
|
|
6936
6951
|
if (authz) h.set("authorization", authz);
|
|
6937
6952
|
return h;
|
|
@@ -7029,12 +7044,9 @@ var CancelSubscriptionError = class extends Error {
|
|
|
7029
7044
|
async function refundInvoice(c, opts) {
|
|
7030
7045
|
const authz = c.req.header("authorization");
|
|
7031
7046
|
const nonce = opts.requestNonce ?? crypto.randomUUID();
|
|
7032
|
-
const headers = {
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
"x-app-name": c.env.APP_NAME
|
|
7036
|
-
};
|
|
7037
|
-
if (authz) headers["authorization"] = authz;
|
|
7047
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
7048
|
+
appendAppIdentity(headers, c.env);
|
|
7049
|
+
if (authz) headers.set("authorization", authz);
|
|
7038
7050
|
const res = await apiWorkerFetch(c.env, "/api/refunds/create", {
|
|
7039
7051
|
method: "POST",
|
|
7040
7052
|
headers,
|
|
@@ -7098,6 +7110,7 @@ export {
|
|
|
7098
7110
|
SchemaRegistry,
|
|
7099
7111
|
SubscriptionAuthError,
|
|
7100
7112
|
SubscriptionRequiredError,
|
|
7113
|
+
TEST_ACCOUNT_EMAIL_SUFFIX,
|
|
7101
7114
|
USERS_COLUMNS,
|
|
7102
7115
|
VOTING_SCHEMAS,
|
|
7103
7116
|
WORKSPACE_SCHEMAS,
|
|
@@ -7162,6 +7175,9 @@ export {
|
|
|
7162
7175
|
handleYjsLeave,
|
|
7163
7176
|
isAutoProvision,
|
|
7164
7177
|
isOwner,
|
|
7178
|
+
isTestAccountClaims,
|
|
7179
|
+
isTestAccountEmail,
|
|
7180
|
+
isTestAccountTier,
|
|
7165
7181
|
lintSchema,
|
|
7166
7182
|
loadMessages,
|
|
7167
7183
|
makeDefaultSummarizer,
|