deepspace 0.7.0 → 0.8.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.
- package/CHANGELOG.md +30 -0
- package/README.md +22 -8
- package/dist/cli.js +10306 -5256
- package/dist/cli.js.map +1 -1
- package/dist/feature-installer.js +638 -0
- package/dist/feature-installer.js.map +1 -0
- package/dist/index.d.ts +107 -117
- package/dist/index.js +610 -779
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +403 -167
- package/dist/server.js +498 -367
- package/dist/server.js.map +1 -1
- package/dist/testing.d.ts +115 -0
- package/dist/testing.js +3 -3
- package/dist/testing.js.map +1 -1
- package/dist/worker.d.ts +397 -160
- package/dist/worker.js +506 -367
- package/dist/worker.js.map +1 -1
- package/features/ai-chat/feature.json +2 -0
- package/features/ai-chat/src/AiChatPage.tsx +2 -3
- package/features/ai-chat/src/ChatPanel.messages.tsx +344 -0
- package/features/ai-chat/src/ChatPanel.stream.ts +397 -0
- package/features/ai-chat/src/ChatPanel.tsx +158 -862
- package/features/ai-chat/src/__tests__/ChatPanel.stream.test.ts +163 -0
- package/features/canvas/src/CanvasListPage.tsx +1 -1
- package/features/docs/feature.json +4 -8
- package/features/docs/src/DocsEditorPage.tsx +33 -326
- package/features/docs/src/DocsListPage.tsx +33 -29
- package/features/docs/src/InviteDialog.tsx +11 -40
- package/features/docs/src/__tests__/docs-presence-access.test.ts +71 -0
- package/features/docs/src/docs-library-types.ts +28 -3
- package/features/docs/src/docs-ui.css +1 -4
- package/features/docs/src/use-docs-presence-access.ts +330 -0
- package/features/file-attachments/feature.json +2 -2
- package/features/file-attachments/src/AttachmentPreview.tsx +428 -0
- package/features/file-attachments/src/AttachmentsPage.tsx +100 -462
- package/features/file-attachments/src/useFilePreview.ts +54 -68
- package/features/file-manager/src/FileManagerPage.tsx +1 -1
- package/features/integration-test/src/integration.spec.ts +1 -1
- package/features/items/feature.json +1 -5
- package/features/items/src/ItemsPage.tsx +207 -135
- package/features/landing/feature.json +3 -0
- package/features/landing/src/LandingPage.tsx +4 -18
- package/features/leaderboard/feature.json +1 -5
- package/features/leaderboard/src/LeaderboardPage.tsx +333 -198
- package/features/messaging/feature.json +0 -4
- package/features/messaging/src/ChatMultiPage.tsx +1 -3
- package/features/messaging/src/ChatPage.tsx +1 -3
- package/features/messaging/src/components/chat/MessageActionSheet.tsx +40 -16
- package/features/search-bar/feature.json +8 -3
- package/features/search-bar/src/SearchOverlay.tsx +108 -252
- package/features/search-bar/src/__tests__/search-model.test.ts +40 -0
- package/features/search-bar/src/search-model.ts +223 -0
- package/features/tasks/src/TasksPage.tsx +3 -3
- package/features/topbar/src/Topbar.tsx +0 -17
- package/package.json +1 -2
- package/features/docs/src/docs-favorites.ts +0 -18
- package/features/docs/src/use-yjs-room-with-awareness.ts +0 -289
- package/features/file-attachments/src/attachments-constants.ts +0 -9
- package/features/items/src/items-constants.ts +0 -10
- package/features/leaderboard/src/leaderboard-constants.ts +0 -21
- package/features/messaging/src/components/chat/ReactionPicker.tsx +0 -2
- package/scripts/add-feature.cjs +0 -807
package/dist/worker.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import * as Y from 'yjs';
|
|
|
2
2
|
import { LanguageModel, ToolSet, ModelMessage } from 'ai';
|
|
3
3
|
import * as zod_v4_core from 'zod/v4/core';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
|
+
import * as better_auth_plugins from 'better-auth/plugins';
|
|
5
6
|
import * as better_auth from 'better-auth';
|
|
6
7
|
import { betterAuth } from 'better-auth';
|
|
7
|
-
import * as better_auth_plugins from 'better-auth/plugins';
|
|
8
8
|
import { Hono } from 'hono';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -938,7 +938,7 @@ declare abstract class BaseRoom<E = Record<string, unknown>> {
|
|
|
938
938
|
private handleWebSocketUpgrade;
|
|
939
939
|
webSocketMessage(ws: WebSocket, message: ArrayBuffer | string): Promise<void>;
|
|
940
940
|
webSocketClose(ws: WebSocket, _code: number, _reason: string): Promise<void>;
|
|
941
|
-
webSocketError(
|
|
941
|
+
webSocketError(_ws: WebSocket, error: unknown): Promise<void>;
|
|
942
942
|
alarm(): Promise<void>;
|
|
943
943
|
/**
|
|
944
944
|
* Called when a new WebSocket connects (after auth parsing).
|
|
@@ -1036,6 +1036,95 @@ declare abstract class BaseRoom<E = Record<string, unknown>> {
|
|
|
1036
1036
|
protected broadcastBinary(data: Uint8Array | ArrayBuffer, exclude?: WebSocket): void;
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
1039
|
+
/**
|
|
1040
|
+
* Shared type definitions for the DeepSpace SDK
|
|
1041
|
+
*
|
|
1042
|
+
* Types used by both client-side SDK and server-side workers.
|
|
1043
|
+
*/
|
|
1044
|
+
type ColumnInterpretation = {
|
|
1045
|
+
kind: 'plain';
|
|
1046
|
+
} | {
|
|
1047
|
+
kind: 'currency';
|
|
1048
|
+
symbol: string;
|
|
1049
|
+
decimals: number;
|
|
1050
|
+
} | {
|
|
1051
|
+
kind: 'date';
|
|
1052
|
+
format?: string;
|
|
1053
|
+
} | {
|
|
1054
|
+
kind: 'datetime';
|
|
1055
|
+
format?: string;
|
|
1056
|
+
} | {
|
|
1057
|
+
kind: 'boolean';
|
|
1058
|
+
trueLabel?: string;
|
|
1059
|
+
falseLabel?: string;
|
|
1060
|
+
} | {
|
|
1061
|
+
kind: 'percent';
|
|
1062
|
+
decimals?: number;
|
|
1063
|
+
} | {
|
|
1064
|
+
kind: 'select';
|
|
1065
|
+
options: string[];
|
|
1066
|
+
} | {
|
|
1067
|
+
kind: 'multiselect';
|
|
1068
|
+
options: string[];
|
|
1069
|
+
} | {
|
|
1070
|
+
kind: 'url';
|
|
1071
|
+
} | {
|
|
1072
|
+
kind: 'email';
|
|
1073
|
+
} | {
|
|
1074
|
+
kind: 'json';
|
|
1075
|
+
} | {
|
|
1076
|
+
kind: 'reference';
|
|
1077
|
+
targetTable: string;
|
|
1078
|
+
displayColumn: string;
|
|
1079
|
+
};
|
|
1080
|
+
interface ColumnDefinition {
|
|
1081
|
+
/** Stable ID override (survives renames). Falls back to `col_{name}`. */
|
|
1082
|
+
id?: string;
|
|
1083
|
+
name: string;
|
|
1084
|
+
storage: 'number' | 'text';
|
|
1085
|
+
interpretation: ColumnInterpretation | string;
|
|
1086
|
+
expression?: string;
|
|
1087
|
+
userBound?: boolean;
|
|
1088
|
+
immutable?: boolean;
|
|
1089
|
+
required?: boolean;
|
|
1090
|
+
default?: unknown;
|
|
1091
|
+
timestampTrigger?: {
|
|
1092
|
+
field: string;
|
|
1093
|
+
value?: unknown;
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
type PermissionLevel = boolean | 'own' | 'unclaimed-or-own' | 'collaborator' | 'team' | 'access' | 'published' | 'shared';
|
|
1097
|
+
interface RolePermissions {
|
|
1098
|
+
read: PermissionLevel;
|
|
1099
|
+
/** Create has no existing record to evaluate, so it is an explicit grant. */
|
|
1100
|
+
create: boolean;
|
|
1101
|
+
update: PermissionLevel;
|
|
1102
|
+
delete: PermissionLevel;
|
|
1103
|
+
/** If set, only these columns can be updated by this role. */
|
|
1104
|
+
writableFields?: string[];
|
|
1105
|
+
}
|
|
1106
|
+
interface CollectionSchema {
|
|
1107
|
+
name: string;
|
|
1108
|
+
/** Every collection is stored in typed SQL columns. */
|
|
1109
|
+
columns: ColumnDefinition[];
|
|
1110
|
+
/** Composite uniqueness constraint (for example `['userId', 'taskId']`). */
|
|
1111
|
+
uniqueOn?: string[];
|
|
1112
|
+
/** Ownership column; defaults to the row creator. */
|
|
1113
|
+
ownerField?: string;
|
|
1114
|
+
/** Column containing a JSON array of collaborator user ids. */
|
|
1115
|
+
collaboratorsField?: string;
|
|
1116
|
+
/** Column containing the team id used by team permission rules. */
|
|
1117
|
+
teamField?: string;
|
|
1118
|
+
/** A string is public when equal to `public`; an object supplies an exact value. */
|
|
1119
|
+
visibilityField?: string | {
|
|
1120
|
+
field: string;
|
|
1121
|
+
value: unknown;
|
|
1122
|
+
};
|
|
1123
|
+
/** Permissions per role; `*` is the catch-all role. */
|
|
1124
|
+
permissions: Record<string, RolePermissions>;
|
|
1125
|
+
/** Default role assigned on the `users` collection. */
|
|
1126
|
+
defaultRole?: string;
|
|
1127
|
+
}
|
|
1039
1128
|
interface Query {
|
|
1040
1129
|
collection: string;
|
|
1041
1130
|
where?: Record<string, unknown>;
|
|
@@ -1159,8 +1248,6 @@ interface ConnectionAttachment extends UserAttachment {
|
|
|
1159
1248
|
subscriptions: Subscription[];
|
|
1160
1249
|
/** Yjs docs this connection is editing */
|
|
1161
1250
|
yjsSubscriptions: YjsSubscription[];
|
|
1162
|
-
/** Yjs client ID for awareness */
|
|
1163
|
-
yjsClientId?: number;
|
|
1164
1251
|
/** Client-side Yjs awareness clientId (extracted from first awareness message) */
|
|
1165
1252
|
awarenessClientId?: number;
|
|
1166
1253
|
}
|
|
@@ -1185,63 +1272,7 @@ interface HandlerContext {
|
|
|
1185
1272
|
*
|
|
1186
1273
|
* All collections use typed SQL columns. No document-mode / fields-based storage.
|
|
1187
1274
|
*/
|
|
1188
|
-
|
|
1189
|
-
kind: 'plain';
|
|
1190
|
-
} | {
|
|
1191
|
-
kind: 'currency';
|
|
1192
|
-
symbol: string;
|
|
1193
|
-
decimals: number;
|
|
1194
|
-
} | {
|
|
1195
|
-
kind: 'date';
|
|
1196
|
-
format?: string;
|
|
1197
|
-
} | {
|
|
1198
|
-
kind: 'datetime';
|
|
1199
|
-
format?: string;
|
|
1200
|
-
} | {
|
|
1201
|
-
kind: 'boolean';
|
|
1202
|
-
trueLabel?: string;
|
|
1203
|
-
falseLabel?: string;
|
|
1204
|
-
} | {
|
|
1205
|
-
kind: 'percent';
|
|
1206
|
-
decimals?: number;
|
|
1207
|
-
} | {
|
|
1208
|
-
kind: 'select';
|
|
1209
|
-
options: string[];
|
|
1210
|
-
} | {
|
|
1211
|
-
kind: 'multiselect';
|
|
1212
|
-
options: string[];
|
|
1213
|
-
} | {
|
|
1214
|
-
kind: 'url';
|
|
1215
|
-
} | {
|
|
1216
|
-
kind: 'email';
|
|
1217
|
-
} | {
|
|
1218
|
-
kind: 'json';
|
|
1219
|
-
} | {
|
|
1220
|
-
kind: 'reference';
|
|
1221
|
-
targetTable: string;
|
|
1222
|
-
displayColumn: string;
|
|
1223
|
-
};
|
|
1224
|
-
interface ColumnDefinition {
|
|
1225
|
-
/** Stable ID override (survives renames). Falls back to `col_{name}`. */
|
|
1226
|
-
id?: string;
|
|
1227
|
-
name: string;
|
|
1228
|
-
storage: 'number' | 'text';
|
|
1229
|
-
interpretation: ColumnInterpretation | string;
|
|
1230
|
-
expression?: string;
|
|
1231
|
-
/** Auto-populate with current user ID on create. */
|
|
1232
|
-
userBound?: boolean;
|
|
1233
|
-
/** Cannot be changed after initial creation. */
|
|
1234
|
-
immutable?: boolean;
|
|
1235
|
-
/** Must be provided on create (non-null). */
|
|
1236
|
-
required?: boolean;
|
|
1237
|
-
/** Default value if not provided on create. */
|
|
1238
|
-
default?: unknown;
|
|
1239
|
-
/** Auto-set ISO timestamp when the named field changes (optionally to a specific value). */
|
|
1240
|
-
timestampTrigger?: {
|
|
1241
|
-
field: string;
|
|
1242
|
-
value?: unknown;
|
|
1243
|
-
};
|
|
1244
|
-
}
|
|
1275
|
+
|
|
1245
1276
|
interface ResolvedColumn {
|
|
1246
1277
|
id: string;
|
|
1247
1278
|
name: string;
|
|
@@ -1265,41 +1296,6 @@ declare function rowToData(row: Record<string, unknown>, columns: ResolvedColumn
|
|
|
1265
1296
|
declare function dataToColumnValues(data: Record<string, unknown>, columns: ResolvedColumn[]): Record<string, unknown>;
|
|
1266
1297
|
declare function coerceValue(value: unknown, storage: 'number' | 'text', interpretation: ColumnInterpretation): unknown;
|
|
1267
1298
|
declare function buildTableSelect(collectionName: string, columns: ResolvedColumn[]): string;
|
|
1268
|
-
type PermissionLevel = boolean | 'own' | 'unclaimed-or-own' | 'collaborator' | 'team' | 'access' | 'published' | 'shared';
|
|
1269
|
-
interface RolePermissions {
|
|
1270
|
-
read: PermissionLevel;
|
|
1271
|
-
create: boolean;
|
|
1272
|
-
update: PermissionLevel;
|
|
1273
|
-
delete: PermissionLevel;
|
|
1274
|
-
/** If set, only these columns can be updated by this role. */
|
|
1275
|
-
writableFields?: string[];
|
|
1276
|
-
}
|
|
1277
|
-
interface CollectionSchema {
|
|
1278
|
-
name: string;
|
|
1279
|
-
/** Column definitions — every collection is stored in a typed SQL table. */
|
|
1280
|
-
columns: ColumnDefinition[];
|
|
1281
|
-
/** Composite uniqueness constraint (e.g., ['userId', 'taskId']). */
|
|
1282
|
-
uniqueOn?: string[];
|
|
1283
|
-
/** Column name used for ownership checks (default: `_created_by`). */
|
|
1284
|
-
ownerField?: string;
|
|
1285
|
-
/** Column containing JSON array of collaborator user IDs. */
|
|
1286
|
-
collaboratorsField?: string;
|
|
1287
|
-
/** Column containing team ID for team-based access. */
|
|
1288
|
-
teamField?: string;
|
|
1289
|
-
/**
|
|
1290
|
-
* Column controlling per-record read visibility.
|
|
1291
|
-
* String: visible when `data[field] === 'public'`.
|
|
1292
|
-
* Object: visible when `data[field] === value`.
|
|
1293
|
-
*/
|
|
1294
|
-
visibilityField?: string | {
|
|
1295
|
-
field: string;
|
|
1296
|
-
value: unknown;
|
|
1297
|
-
};
|
|
1298
|
-
/** Permissions per role. Use '*' for a catch-all fallback. */
|
|
1299
|
-
permissions: Record<string, RolePermissions>;
|
|
1300
|
-
/** Default role for new users (only on 'users' collection). */
|
|
1301
|
-
defaultRole?: string;
|
|
1302
|
-
}
|
|
1303
1299
|
interface User {
|
|
1304
1300
|
id: string;
|
|
1305
1301
|
email: string;
|
|
@@ -1434,8 +1430,6 @@ declare class RecordRoom<E = Record<string, unknown>> extends BaseRoom<E> {
|
|
|
1434
1430
|
private initPromise;
|
|
1435
1431
|
/** Yjs docs loaded in memory (key: collection:recordId:fieldName) */
|
|
1436
1432
|
private yjsDocs;
|
|
1437
|
-
/** Next Yjs client ID counter */
|
|
1438
|
-
private nextYjsClientId;
|
|
1439
1433
|
/** Owner user ID — gets admin role automatically */
|
|
1440
1434
|
private ownerUserId;
|
|
1441
1435
|
/** True until the first fetch() completes — detects hibernation wake-up */
|
|
@@ -1450,7 +1444,7 @@ declare class RecordRoom<E = Record<string, unknown>> extends BaseRoom<E> {
|
|
|
1450
1444
|
* The HTTP debug API (`/api/debug/*`) runs arbitrary SQL and role changes
|
|
1451
1445
|
* with no auth of its own, so it is gated here at the DO's single ingress.
|
|
1452
1446
|
* Off unless a deployment opts in with `ALLOW_DEBUG_ROUTES=true`
|
|
1453
|
-
* (`deepspace dev`/`test` set it automatically). Deployments holding shared
|
|
1447
|
+
* (`deepspace dev start`/`test run` set it automatically). Deployments holding shared
|
|
1454
1448
|
* data override this to always return false.
|
|
1455
1449
|
*/
|
|
1456
1450
|
protected get debugRoutesEnabled(): boolean;
|
|
@@ -1475,7 +1469,7 @@ declare class RecordRoom<E = Record<string, unknown>> extends BaseRoom<E> {
|
|
|
1475
1469
|
protected onMessage(): void;
|
|
1476
1470
|
webSocketMessage(ws: WebSocket, message: ArrayBuffer | string): Promise<void>;
|
|
1477
1471
|
webSocketClose(ws: WebSocket, code: number, reason: string): Promise<void>;
|
|
1478
|
-
webSocketError(
|
|
1472
|
+
webSocketError(_ws: WebSocket, error: unknown): Promise<void>;
|
|
1479
1473
|
private handleRecordMessage;
|
|
1480
1474
|
private handleListSchemas;
|
|
1481
1475
|
private createHandlerContext;
|
|
@@ -1520,7 +1514,7 @@ declare class YjsRoom<E = Record<string, unknown>> extends BaseRoom<E> {
|
|
|
1520
1514
|
type: string;
|
|
1521
1515
|
[key: string]: unknown;
|
|
1522
1516
|
}): void;
|
|
1523
|
-
protected onBinaryMessage(ws: WebSocket,
|
|
1517
|
+
protected onBinaryMessage(ws: WebSocket, _user: UserAttachment, data: ArrayBuffer): void;
|
|
1524
1518
|
protected onDisconnect(ws: WebSocket, _user: UserAttachment): void;
|
|
1525
1519
|
private handleSync;
|
|
1526
1520
|
private handleAwareness;
|
|
@@ -1587,7 +1581,7 @@ declare abstract class GameRoom<E = Record<string, unknown>> extends BaseRoom<E>
|
|
|
1587
1581
|
type: string;
|
|
1588
1582
|
[key: string]: unknown;
|
|
1589
1583
|
}): Promise<void>;
|
|
1590
|
-
protected onDisconnect(
|
|
1584
|
+
protected onDisconnect(_ws: WebSocket, user: UserAttachment): void;
|
|
1591
1585
|
protected onAlarm(): Promise<void>;
|
|
1592
1586
|
private checkAutoStart;
|
|
1593
1587
|
private startGame;
|
|
@@ -1687,7 +1681,7 @@ declare class CanvasRoom<E = Record<string, unknown>> extends BaseRoom<E> {
|
|
|
1687
1681
|
type: string;
|
|
1688
1682
|
[key: string]: unknown;
|
|
1689
1683
|
}): Promise<void>;
|
|
1690
|
-
protected onDisconnect(
|
|
1684
|
+
protected onDisconnect(_ws: WebSocket, user: UserAttachment): void;
|
|
1691
1685
|
private pushUndo;
|
|
1692
1686
|
private clearRedo;
|
|
1693
1687
|
private handleUndo;
|
|
@@ -1741,6 +1735,19 @@ declare class PresenceRoom<E = Record<string, unknown>> extends BaseRoom<E> {
|
|
|
1741
1735
|
protected onDisconnect(ws: WebSocket, user: UserAttachment): void;
|
|
1742
1736
|
}
|
|
1743
1737
|
|
|
1738
|
+
/** Pure validation and evaluation for CronRoom schedules. */
|
|
1739
|
+
interface CronTask {
|
|
1740
|
+
name: string;
|
|
1741
|
+
/** Interval in minutes (interval mode) — mutually exclusive with `schedule`. */
|
|
1742
|
+
intervalMinutes?: number;
|
|
1743
|
+
/** 5-field cron expression (cron mode) — requires `timezone`. */
|
|
1744
|
+
schedule?: string;
|
|
1745
|
+
/** IANA timezone string (e.g. "America/New_York"). Required with `schedule`. */
|
|
1746
|
+
timezone?: string;
|
|
1747
|
+
/** Whether the task starts paused. */
|
|
1748
|
+
paused?: boolean;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1744
1751
|
/**
|
|
1745
1752
|
* CronRoom — Per-app scheduled task execution Durable Object.
|
|
1746
1753
|
*
|
|
@@ -1759,17 +1766,6 @@ declare class PresenceRoom<E = Record<string, unknown>> extends BaseRoom<E> {
|
|
|
1759
1766
|
* Message types: cron.*
|
|
1760
1767
|
*/
|
|
1761
1768
|
|
|
1762
|
-
interface CronTask {
|
|
1763
|
-
name: string;
|
|
1764
|
-
/** Interval in minutes (interval mode) — mutually exclusive with `schedule`. */
|
|
1765
|
-
intervalMinutes?: number;
|
|
1766
|
-
/** 5-field cron expression (cron mode) — requires `timezone`. */
|
|
1767
|
-
schedule?: string;
|
|
1768
|
-
/** IANA timezone string (e.g. "America/New_York"). Required with `schedule`. */
|
|
1769
|
-
timezone?: string;
|
|
1770
|
-
/** Whether the task starts paused. */
|
|
1771
|
-
paused?: boolean;
|
|
1772
|
-
}
|
|
1773
1769
|
interface CronRoomConfig {
|
|
1774
1770
|
tasks: CronTask[];
|
|
1775
1771
|
}
|
|
@@ -2524,6 +2520,8 @@ declare class Awareness {
|
|
|
2524
2520
|
* Remove awareness states for disconnected clients
|
|
2525
2521
|
*/
|
|
2526
2522
|
removeStates(clientIds: number[]): void;
|
|
2523
|
+
/** Release all state and listeners owned by this awareness instance. */
|
|
2524
|
+
destroy(): void;
|
|
2527
2525
|
}
|
|
2528
2526
|
/**
|
|
2529
2527
|
* Encode a full awareness message
|
|
@@ -2542,11 +2540,99 @@ declare function handleAwarenessMessage(awareness: Awareness, data: Uint8Array):
|
|
|
2542
2540
|
*/
|
|
2543
2541
|
declare function getMessageType(data: Uint8Array): number;
|
|
2544
2542
|
|
|
2543
|
+
/**
|
|
2544
|
+
* Wildcard-aware CORS origin matching for the platform workers.
|
|
2545
|
+
*
|
|
2546
|
+
* Hono's array form of `cors({ origin: [...] })` is an exact `includes()` — it
|
|
2547
|
+
* never expands `*`. Every worker that listed `https://*.app.space` or
|
|
2548
|
+
* `http://localhost:*` in an array had a dead entry: the wildcard rows matched
|
|
2549
|
+
* nothing, silently narrowing the effective CORS surface to the literal
|
|
2550
|
+
* entries. This helper is the single implementation both the api and deploy
|
|
2551
|
+
* workers pass to Hono's function-form `origin`, so the pattern semantics
|
|
2552
|
+
* can't drift between them.
|
|
2553
|
+
*
|
|
2554
|
+
* `*` stands for exactly one host label or a port: it never crosses a dot or
|
|
2555
|
+
* a slash, so `https://*.app.space` matches `https://x.app.space` but neither
|
|
2556
|
+
* `https://a.b.app.space` nor `https://x.app.space.evil.com`.
|
|
2557
|
+
*/
|
|
2558
|
+
declare function matchOrigin(origin: string, patterns: string[]): string | null;
|
|
2559
|
+
/**
|
|
2560
|
+
* The platform's standard browser-origin allow-list, derived from the
|
|
2561
|
+
* environment's apexes so a second constellation (staging) trusts its own
|
|
2562
|
+
* hosts and only its own. Both values are explicit deployment-plane config.
|
|
2563
|
+
* Dedupes for environments that serve both roles from one apex.
|
|
2564
|
+
*/
|
|
2565
|
+
declare function platformCorsPatterns(env: {
|
|
2566
|
+
APP_DOMAIN: string;
|
|
2567
|
+
PLATFORM_DOMAIN: string;
|
|
2568
|
+
}): string[];
|
|
2569
|
+
|
|
2570
|
+
/**
|
|
2571
|
+
* Deployed-app quota defaults — the ONE copy.
|
|
2572
|
+
*
|
|
2573
|
+
* Two workers use these numbers for different jobs: the deploy worker
|
|
2574
|
+
* ENFORCES them at registration time, the api worker DISPLAYS them via
|
|
2575
|
+
* GET /api/plan-limits. They used to be independent literal sets (plus the
|
|
2576
|
+
* same numbers again in six wrangler [vars] blocks as overrides) and had
|
|
2577
|
+
* already diverged once — the display copy was missing the admin tier
|
|
2578
|
+
* entirely. The env vars remain the per-plane override mechanism; only the
|
|
2579
|
+
* fallbacks live here.
|
|
2580
|
+
*/
|
|
2581
|
+
declare const DEPLOYED_APPS_DEFAULTS: {
|
|
2582
|
+
readonly free: 1;
|
|
2583
|
+
readonly starter: 4;
|
|
2584
|
+
readonly premium: 10;
|
|
2585
|
+
readonly admin: 100;
|
|
2586
|
+
};
|
|
2587
|
+
/** Parse a quota env override; anything non-integer/negative = fallback. */
|
|
2588
|
+
declare function parseQuotaLimit(raw: string | undefined, fallback: number): number;
|
|
2589
|
+
|
|
2590
|
+
/**
|
|
2591
|
+
* The ONE registry client. Every platform worker reaches the app-registry
|
|
2592
|
+
* Durable Object (hosted by the deploy worker, singleton `v1:global`) through
|
|
2593
|
+
* a cross-script REGISTRY binding — and before this module, each of the five
|
|
2594
|
+
* workers hand-rolled its own copy of the same mechanics: the instance name
|
|
2595
|
+
* appeared in 6 places, the `https://registry/` URL in 6, `APP_ID_RE` in 5,
|
|
2596
|
+
* and `RegistryClientError` + `registryErrorJson` existed byte-identical in
|
|
2597
|
+
* two workers. Copies that must agree and nothing enforcing it.
|
|
2598
|
+
*
|
|
2599
|
+
* This module owns the MECHANICS: instance name, stub lookup, the wire call,
|
|
2600
|
+
* the error type, and the standard route mapping. Each worker still declares
|
|
2601
|
+
* its own typed convenience wrapper listing only the actions it uses — that
|
|
2602
|
+
* subset is genuinely per-worker; the plumbing is not.
|
|
2603
|
+
*/
|
|
2604
|
+
/** The singleton registry instance — one DO holds every app/route/collaborator. */
|
|
2605
|
+
declare const REGISTRY_INSTANCE = "v1:global";
|
|
2606
|
+
/** App id shape: a ULID-minted `app_…` id, or a legacy name-as-id. */
|
|
2607
|
+
declare const APP_ID_RE: RegExp;
|
|
2608
|
+
/** ONLY a ULID-minted id — surfaces that must not accept a legacy name. */
|
|
2609
|
+
declare const STRICT_APP_ID_RE: RegExp;
|
|
2610
|
+
declare class RegistryClientError extends Error {
|
|
2611
|
+
readonly code: string;
|
|
2612
|
+
readonly status: number;
|
|
2613
|
+
constructor(message: string, code: string, status: number);
|
|
2614
|
+
}
|
|
2615
|
+
declare function registryStub(ns: DurableObjectNamespace): DurableObjectStub;
|
|
2616
|
+
/**
|
|
2617
|
+
* One registry action over the wire. Non-2xx answers throw
|
|
2618
|
+
* {@link RegistryClientError} carrying the DO's structured `code` (or
|
|
2619
|
+
* `'error'` for a transport-shaped body) — callers distinguish a registry-
|
|
2620
|
+
* REPORTED miss (`code === 'not_found'`) from an outage by that code, never
|
|
2621
|
+
* by treating every throw as "not found".
|
|
2622
|
+
*/
|
|
2623
|
+
declare function callRegistry<T>(stub: DurableObjectStub, body: {
|
|
2624
|
+
action: string;
|
|
2625
|
+
} & Record<string, unknown>): Promise<T>;
|
|
2626
|
+
/** Standard mapping of a registry failure onto a route response. */
|
|
2627
|
+
declare function registryErrorJson(c: {
|
|
2628
|
+
json: (body: unknown, status?: number) => Response;
|
|
2629
|
+
}, err: unknown): Response;
|
|
2630
|
+
|
|
2545
2631
|
/**
|
|
2546
2632
|
* Tools API Types and Definitions
|
|
2547
2633
|
*
|
|
2548
2634
|
* MCP-like interface for agent tool calls.
|
|
2549
|
-
* Built-in tools for
|
|
2635
|
+
* Built-in tools for records, schemas, users, and Yjs documents.
|
|
2550
2636
|
*/
|
|
2551
2637
|
interface ToolSchema {
|
|
2552
2638
|
name: string;
|
|
@@ -2594,7 +2680,7 @@ declare const DEFAULT_QUERY_LIMIT = 50;
|
|
|
2594
2680
|
*/
|
|
2595
2681
|
declare function applyAiToolDefaults(toolName: string, params: Record<string, unknown>): Record<string, unknown>;
|
|
2596
2682
|
/**
|
|
2597
|
-
* Built-in tool definitions for
|
|
2683
|
+
* Built-in tool definitions for record, schema, user, and Yjs operations.
|
|
2598
2684
|
*/
|
|
2599
2685
|
declare const BUILT_IN_TOOLS: ToolSchema[];
|
|
2600
2686
|
|
|
@@ -2790,7 +2876,7 @@ type ActionHandler<TEnv = Record<string, unknown>> = (ctx: ActionContext<TEnv>)
|
|
|
2790
2876
|
* in deployed apps.
|
|
2791
2877
|
*
|
|
2792
2878
|
* 2. **HTTPS URL** (`env.API_WORKER_URL` / `env.PLATFORM_WORKER_URL`) — the
|
|
2793
|
-
* fallback used in local development. `deepspace dev` writes these
|
|
2879
|
+
* fallback used in local development. `deepspace dev start` writes these
|
|
2794
2880
|
* into `.dev.vars`, which `wrangler dev` exposes as env vars. Service
|
|
2795
2881
|
* bindings don't work cross-process under `wrangler dev` for SDK apps,
|
|
2796
2882
|
* so the URL is the only working path in dev.
|
|
@@ -2808,7 +2894,7 @@ type ActionHandler<TEnv = Record<string, unknown>> = (ctx: ActionContext<TEnv>)
|
|
|
2808
2894
|
* History: a previous in-tree helper folded the binding/URL fallback into
|
|
2809
2895
|
* the AI module's `resolveTransport`. Inline call sites in the starter
|
|
2810
2896
|
* template (integrations, files, debug) used `c.env.X.fetch(...)` directly,
|
|
2811
|
-
* which broke `npx deepspace dev` for any app calling those routes — the
|
|
2897
|
+
* which broke `npx deepspace dev start` for any app calling those routes — the
|
|
2812
2898
|
* binding is undefined locally, so the fetch threw. These helpers
|
|
2813
2899
|
* standardize on the same shape `resolveTransport` had, so every upstream
|
|
2814
2900
|
* call works in both dev and prod.
|
|
@@ -2929,13 +3015,13 @@ declare function buildCronContext(env: CronEnv, ownerUserId: string, roomId?: st
|
|
|
2929
3015
|
* - Service binding `env.API_WORKER` (Cloudflare Fetcher) — preferred in
|
|
2930
3016
|
* production if the app has declared the binding in wrangler.toml.
|
|
2931
3017
|
* - HTTPS URL `env.API_WORKER_URL` — used in local dev and in production
|
|
2932
|
-
* for apps that don't declare the binding. `deepspace dev` writes this
|
|
3018
|
+
* for apps that don't declare the binding. `deepspace dev start` writes this
|
|
2933
3019
|
* into `.dev.vars` automatically.
|
|
2934
3020
|
*
|
|
2935
3021
|
* Auth is automatic by default:
|
|
2936
3022
|
* - For server-side autonomous calls (cron, DO alarms, background agents),
|
|
2937
3023
|
* the helper reads the long-lived `env.APP_OWNER_JWT` minted at deploy
|
|
2938
|
-
* time (or by `deepspace dev` in local development) and uses it for the
|
|
3024
|
+
* time (or by `deepspace dev start` in local development) and uses it for the
|
|
2939
3025
|
* proxy auth header. The owner is billed automatically via the JWT sub.
|
|
2940
3026
|
* - For user-initiated calls (e.g. an `/api/ai/chat` route handling a
|
|
2941
3027
|
* browser request), pass `options.authToken` explicitly with the user's
|
|
@@ -2962,7 +3048,7 @@ type DeepSpaceModelFactory = (modelId: string) => LanguageModel;
|
|
|
2962
3048
|
type Provider = 'anthropic' | 'openai' | 'cerebras';
|
|
2963
3049
|
interface DeepSpaceAIEnv extends ApiWorkerEnv {
|
|
2964
3050
|
/**
|
|
2965
|
-
* Long-lived owner-scoped JWT minted at deploy time (or by `deepspace dev`).
|
|
3051
|
+
* Long-lived owner-scoped JWT minted at deploy time (or by `deepspace dev start`).
|
|
2966
3052
|
* Used as the default proxy auth token when `options.authToken` is absent.
|
|
2967
3053
|
* Bills the app owner.
|
|
2968
3054
|
*/
|
|
@@ -3039,10 +3125,9 @@ declare function composioTools(env: ApiWorkerEnv, options: ComposioToolsOptions)
|
|
|
3039
3125
|
* own bundle. The platform holds the binding; consumers call this
|
|
3040
3126
|
* helper to get PNG bytes for a URL.
|
|
3041
3127
|
*
|
|
3042
|
-
* The platform enforces
|
|
3043
|
-
*
|
|
3044
|
-
*
|
|
3045
|
-
* and surface their own fallback UX.
|
|
3128
|
+
* The platform enforces HTTPS, a DeepSpace host allowlist, a per-app rate
|
|
3129
|
+
* limit, and one fixed viewport-only capture profile. Returns `null` on any
|
|
3130
|
+
* non-2xx — callers should treat that as "no preview available".
|
|
3046
3131
|
*
|
|
3047
3132
|
* Auth is the same HMAC-of-appId pattern `/internal/files` uses:
|
|
3048
3133
|
* x-app-identity-token = hmac(PLATFORM_IDENTITY_SECRET, DEEPSPACE_APP_ID)
|
|
@@ -3052,16 +3137,6 @@ declare function composioTools(env: ApiWorkerEnv, options: ComposioToolsOptions)
|
|
|
3052
3137
|
* so this helper is a thin wrapper — no extra secrets to manage.
|
|
3053
3138
|
*/
|
|
3054
3139
|
|
|
3055
|
-
interface ScreenshotOptions {
|
|
3056
|
-
url: string;
|
|
3057
|
-
viewport?: {
|
|
3058
|
-
width: number;
|
|
3059
|
-
height: number;
|
|
3060
|
-
};
|
|
3061
|
-
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
|
|
3062
|
-
timeoutMs?: number;
|
|
3063
|
-
fullPage?: boolean;
|
|
3064
|
-
}
|
|
3065
3140
|
interface ScreenshotEnv extends PlatformWorkerEnv {
|
|
3066
3141
|
/** Immutable app id — the identity the platform verifies (HMAC input). */
|
|
3067
3142
|
DEEPSPACE_APP_ID: string;
|
|
@@ -3075,14 +3150,13 @@ interface ScreenshotResult {
|
|
|
3075
3150
|
contentType: string;
|
|
3076
3151
|
}
|
|
3077
3152
|
/**
|
|
3078
|
-
* Capture a screenshot of `
|
|
3153
|
+
* Capture a screenshot of `url` and return the PNG bytes.
|
|
3079
3154
|
*
|
|
3080
3155
|
* Returns null on capture failure (target unreachable, timeout, BR
|
|
3081
|
-
* binding misconfigured platform-side). The platform
|
|
3082
|
-
*
|
|
3083
|
-
* and surface their own UX fallback.
|
|
3156
|
+
* binding misconfigured platform-side). The platform logs a generic failure
|
|
3157
|
+
* without target details; callers should surface their own fallback UX.
|
|
3084
3158
|
*/
|
|
3085
|
-
declare function captureScreenshot(env: ScreenshotEnv,
|
|
3159
|
+
declare function captureScreenshot(env: ScreenshotEnv, url: string): Promise<ScreenshotResult | null>;
|
|
3086
3160
|
|
|
3087
3161
|
/**
|
|
3088
3162
|
* Chat context pipeline — keeps the per-request payload to the LLM bounded.
|
|
@@ -3226,23 +3300,8 @@ declare function makeDefaultSummarizer(env: DeepSpaceAIEnv, options?: {
|
|
|
3226
3300
|
* The tools API returns records as `{ recordId, data, createdAt, updatedAt }`
|
|
3227
3301
|
* envelopes; helpers below flatten them into ChatRow / ChatMessageRow.
|
|
3228
3302
|
*/
|
|
3229
|
-
/**
|
|
3230
|
-
* Canonical chat row.
|
|
3231
|
-
*
|
|
3232
|
-
* `recordId` is the primary identifier — same envelope shape as every
|
|
3233
|
-
* other DeepSpace data type (records.* tools, useQuery results, etc.).
|
|
3234
|
-
*
|
|
3235
|
-
* `id` is kept as a deprecated alias so existing callers don't break,
|
|
3236
|
-
* but every new caller should prefer `recordId`. Without this rename
|
|
3237
|
-
* an integrator who reads `chat.recordId` (the obvious thing given the
|
|
3238
|
-
* rest of the SDK) silently gets `undefined`, then ships code that
|
|
3239
|
-
* sends `{"chatId": undefined}` to `/api/ai/chat` and gets back a 400
|
|
3240
|
-
* with a misleading error.
|
|
3241
|
-
*/
|
|
3242
3303
|
type ChatRow = {
|
|
3243
3304
|
recordId: string;
|
|
3244
|
-
/** @deprecated Use `recordId`. Retained for backward compatibility. */
|
|
3245
|
-
id: string;
|
|
3246
3305
|
userId: string;
|
|
3247
3306
|
title: string;
|
|
3248
3307
|
model?: string;
|
|
@@ -3253,8 +3312,6 @@ type ChatRow = {
|
|
|
3253
3312
|
};
|
|
3254
3313
|
type ChatMessageRow = {
|
|
3255
3314
|
recordId: string;
|
|
3256
|
-
/** @deprecated Use `recordId`. Retained for backward compatibility. */
|
|
3257
|
-
id: string;
|
|
3258
3315
|
chatId: string;
|
|
3259
3316
|
userId: string;
|
|
3260
3317
|
role: 'user' | 'assistant' | 'system';
|
|
@@ -3569,7 +3626,7 @@ declare function decodeJwtPayload(token: string | null | undefined): TokenDebugI
|
|
|
3569
3626
|
/**
|
|
3570
3627
|
* Test-account identification, shared by every platform worker.
|
|
3571
3628
|
*
|
|
3572
|
-
* Test accounts (created via `deepspace test
|
|
3629
|
+
* Test accounts (created via `deepspace test accounts`) are real Better Auth
|
|
3573
3630
|
* users demarcated three ways, and a caller may present as any of them
|
|
3574
3631
|
* depending on where the check runs:
|
|
3575
3632
|
* - their email always ends with @deepspace.test (enforced at creation)
|
|
@@ -3630,8 +3687,184 @@ interface DeepSpaceAuthConfig {
|
|
|
3630
3687
|
emailAndPassword?: boolean;
|
|
3631
3688
|
/** Trusted origins for CORS */
|
|
3632
3689
|
trustedOrigins?: string[];
|
|
3690
|
+
/**
|
|
3691
|
+
* Called after a new user row is created (any flow: social OAuth callback,
|
|
3692
|
+
* email/password, server-side `auth.api.signUpEmail`). When the signup came
|
|
3693
|
+
* in over HTTP, `ctx.request` exposes the inbound request; some better-auth
|
|
3694
|
+
* entry points carry standalone `ctx.headers` instead of (or as well as) a
|
|
3695
|
+
* request, so both are forwarded. For server-side creations (`auth.api.*`
|
|
3696
|
+
* calls) an endpoint context usually still exists but may carry NEITHER —
|
|
3697
|
+
* guard every field.
|
|
3698
|
+
*
|
|
3699
|
+
* Better Auth awaits `user.create.after` hooks inline before the response
|
|
3700
|
+
* is sent, so keep this cheap (e.g. a single D1 write) and hand slow work
|
|
3701
|
+
* to `ctx.waitUntil` at the call site. Exceptions are caught and logged so
|
|
3702
|
+
* a failing observer can never break signup itself.
|
|
3703
|
+
*/
|
|
3704
|
+
onUserCreated?: (user: {
|
|
3705
|
+
id: string;
|
|
3706
|
+
email: string;
|
|
3707
|
+
name: string;
|
|
3708
|
+
}, ctx: {
|
|
3709
|
+
request?: Request;
|
|
3710
|
+
headers?: Headers;
|
|
3711
|
+
} | null) => Promise<void>;
|
|
3633
3712
|
}
|
|
3634
3713
|
declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.Auth<{
|
|
3714
|
+
databaseHooks: {
|
|
3715
|
+
user?: {
|
|
3716
|
+
create?: {
|
|
3717
|
+
before?: (user: better_auth.User & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void | {
|
|
3718
|
+
data: {
|
|
3719
|
+
id?: string | undefined;
|
|
3720
|
+
createdAt?: Date | undefined;
|
|
3721
|
+
updatedAt?: Date | undefined;
|
|
3722
|
+
email?: string | undefined;
|
|
3723
|
+
emailVerified?: boolean | undefined;
|
|
3724
|
+
name?: string | undefined;
|
|
3725
|
+
image?: string | null | undefined;
|
|
3726
|
+
} & Record<string, any>;
|
|
3727
|
+
}>;
|
|
3728
|
+
after?: (user: better_auth.User & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3729
|
+
};
|
|
3730
|
+
update?: {
|
|
3731
|
+
before?: (user: Partial<better_auth.User> & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void | {
|
|
3732
|
+
data: {
|
|
3733
|
+
[x: string]: any;
|
|
3734
|
+
id?: string | undefined;
|
|
3735
|
+
createdAt?: Date | undefined;
|
|
3736
|
+
updatedAt?: Date | undefined;
|
|
3737
|
+
email?: string | undefined;
|
|
3738
|
+
emailVerified?: boolean | undefined;
|
|
3739
|
+
name?: string | undefined;
|
|
3740
|
+
image?: string | null | undefined;
|
|
3741
|
+
};
|
|
3742
|
+
}>;
|
|
3743
|
+
after?: (user: better_auth.User & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3744
|
+
};
|
|
3745
|
+
delete?: {
|
|
3746
|
+
before?: (user: better_auth.User & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void>;
|
|
3747
|
+
after?: (user: better_auth.User & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3748
|
+
};
|
|
3749
|
+
};
|
|
3750
|
+
session?: {
|
|
3751
|
+
create?: {
|
|
3752
|
+
before?: (session: better_auth.Session & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void | {
|
|
3753
|
+
data: {
|
|
3754
|
+
id?: string | undefined;
|
|
3755
|
+
createdAt?: Date | undefined;
|
|
3756
|
+
updatedAt?: Date | undefined;
|
|
3757
|
+
userId?: string | undefined;
|
|
3758
|
+
expiresAt?: Date | undefined;
|
|
3759
|
+
token?: string | undefined;
|
|
3760
|
+
ipAddress?: string | null | undefined;
|
|
3761
|
+
userAgent?: string | null | undefined;
|
|
3762
|
+
} & Record<string, any>;
|
|
3763
|
+
}>;
|
|
3764
|
+
after?: (session: better_auth.Session & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3765
|
+
};
|
|
3766
|
+
update?: {
|
|
3767
|
+
before?: (session: Partial<better_auth.Session> & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void | {
|
|
3768
|
+
data: {
|
|
3769
|
+
[x: string]: any;
|
|
3770
|
+
id?: string | undefined;
|
|
3771
|
+
createdAt?: Date | undefined;
|
|
3772
|
+
updatedAt?: Date | undefined;
|
|
3773
|
+
userId?: string | undefined;
|
|
3774
|
+
expiresAt?: Date | undefined;
|
|
3775
|
+
token?: string | undefined;
|
|
3776
|
+
ipAddress?: string | null | undefined;
|
|
3777
|
+
userAgent?: string | null | undefined;
|
|
3778
|
+
};
|
|
3779
|
+
}>;
|
|
3780
|
+
after?: (session: better_auth.Session & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3781
|
+
};
|
|
3782
|
+
delete?: {
|
|
3783
|
+
before?: (session: better_auth.Session & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void>;
|
|
3784
|
+
after?: (session: better_auth.Session & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3785
|
+
};
|
|
3786
|
+
};
|
|
3787
|
+
account?: {
|
|
3788
|
+
create?: {
|
|
3789
|
+
before?: (account: better_auth.Account, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void | {
|
|
3790
|
+
data: {
|
|
3791
|
+
id?: string | undefined;
|
|
3792
|
+
createdAt?: Date | undefined;
|
|
3793
|
+
updatedAt?: Date | undefined;
|
|
3794
|
+
providerId?: string | undefined;
|
|
3795
|
+
accountId?: string | undefined;
|
|
3796
|
+
userId?: string | undefined;
|
|
3797
|
+
accessToken?: string | null | undefined;
|
|
3798
|
+
refreshToken?: string | null | undefined;
|
|
3799
|
+
idToken?: string | null | undefined;
|
|
3800
|
+
accessTokenExpiresAt?: Date | null | undefined;
|
|
3801
|
+
refreshTokenExpiresAt?: Date | null | undefined;
|
|
3802
|
+
scope?: string | null | undefined;
|
|
3803
|
+
password?: string | null | undefined;
|
|
3804
|
+
} & Record<string, any>;
|
|
3805
|
+
}>;
|
|
3806
|
+
after?: (account: better_auth.Account, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3807
|
+
};
|
|
3808
|
+
update?: {
|
|
3809
|
+
before?: (account: Partial<better_auth.Account> & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void | {
|
|
3810
|
+
data: {
|
|
3811
|
+
[x: string]: any;
|
|
3812
|
+
id?: string | undefined;
|
|
3813
|
+
createdAt?: Date | undefined;
|
|
3814
|
+
updatedAt?: Date | undefined;
|
|
3815
|
+
providerId?: string | undefined;
|
|
3816
|
+
accountId?: string | undefined;
|
|
3817
|
+
userId?: string | undefined;
|
|
3818
|
+
accessToken?: string | null | undefined;
|
|
3819
|
+
refreshToken?: string | null | undefined;
|
|
3820
|
+
idToken?: string | null | undefined;
|
|
3821
|
+
accessTokenExpiresAt?: Date | null | undefined;
|
|
3822
|
+
refreshTokenExpiresAt?: Date | null | undefined;
|
|
3823
|
+
scope?: string | null | undefined;
|
|
3824
|
+
password?: string | null | undefined;
|
|
3825
|
+
};
|
|
3826
|
+
}>;
|
|
3827
|
+
after?: (account: better_auth.Account & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3828
|
+
};
|
|
3829
|
+
delete?: {
|
|
3830
|
+
before?: (account: better_auth.Account & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void>;
|
|
3831
|
+
after?: (account: better_auth.Account & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3832
|
+
};
|
|
3833
|
+
};
|
|
3834
|
+
verification?: {
|
|
3835
|
+
create?: {
|
|
3836
|
+
before?: (verification: better_auth.Verification & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void | {
|
|
3837
|
+
data: {
|
|
3838
|
+
id?: string | undefined;
|
|
3839
|
+
createdAt?: Date | undefined;
|
|
3840
|
+
updatedAt?: Date | undefined;
|
|
3841
|
+
value?: string | undefined;
|
|
3842
|
+
expiresAt?: Date | undefined;
|
|
3843
|
+
identifier?: string | undefined;
|
|
3844
|
+
} & Record<string, any>;
|
|
3845
|
+
}>;
|
|
3846
|
+
after?: (verification: better_auth.Verification & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3847
|
+
};
|
|
3848
|
+
update?: {
|
|
3849
|
+
before?: (verification: Partial<better_auth.Verification> & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void | {
|
|
3850
|
+
data: {
|
|
3851
|
+
[x: string]: any;
|
|
3852
|
+
id?: string | undefined;
|
|
3853
|
+
createdAt?: Date | undefined;
|
|
3854
|
+
updatedAt?: Date | undefined;
|
|
3855
|
+
value?: string | undefined;
|
|
3856
|
+
expiresAt?: Date | undefined;
|
|
3857
|
+
identifier?: string | undefined;
|
|
3858
|
+
};
|
|
3859
|
+
}>;
|
|
3860
|
+
after?: (verification: better_auth.Verification & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3861
|
+
};
|
|
3862
|
+
delete?: {
|
|
3863
|
+
before?: (verification: better_auth.Verification & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<boolean | void>;
|
|
3864
|
+
after?: (verification: better_auth.Verification & Record<string, unknown>, context: better_auth.GenericEndpointContext | null) => Promise<void>;
|
|
3865
|
+
};
|
|
3866
|
+
};
|
|
3867
|
+
} | undefined;
|
|
3635
3868
|
plugins: [{
|
|
3636
3869
|
id: "organization";
|
|
3637
3870
|
version: string;
|
|
@@ -4484,6 +4717,10 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
4484
4717
|
database: D1Database;
|
|
4485
4718
|
baseURL: string;
|
|
4486
4719
|
secret: string;
|
|
4720
|
+
session: {
|
|
4721
|
+
expiresIn: number;
|
|
4722
|
+
updateAge: number;
|
|
4723
|
+
};
|
|
4487
4724
|
emailAndPassword: {
|
|
4488
4725
|
enabled: boolean;
|
|
4489
4726
|
};
|
|
@@ -4578,7 +4815,7 @@ interface ClientErrorReport {
|
|
|
4578
4815
|
* rebuilds each event field-by-field from a raw Cloudflare row — see the
|
|
4579
4816
|
* security invariant there). The consumers are the CLI tail
|
|
4580
4817
|
* (`cli/commands/logs.ts`), the dashboard Logs panel
|
|
4581
|
-
* (`apps/dashboard/src/lib/
|
|
4818
|
+
* (`apps/dashboard/src/lib/apps.ts`), and the e2e whitelist assertion
|
|
4582
4819
|
* (`tests/e2e/tests/logs.spec.ts`). This module used to be hand-mirrored in
|
|
4583
4820
|
* all four places; `source` was added to three of them and missed in the
|
|
4584
4821
|
* e2e whitelist, so it now lives here once and they import it.
|
|
@@ -4643,4 +4880,4 @@ interface AppLogsResponse {
|
|
|
4643
4880
|
declare const APP_LOG_EVENT_KEYS: readonly ["id", "timestamp", "level", "eventType", "message", "source", "outcome", "request", "exception"];
|
|
4644
4881
|
type AppLogEventKey = (typeof APP_LOG_EVENT_KEYS)[number];
|
|
4645
4882
|
|
|
4646
|
-
export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, ALLOWED_BINDING_TYPES, APP_LOG_EVENT_KEYS, APP_NAME_RULES, AUTO_PROVISIONABLE_TYPES, AUTO_PROVISION_SENTINEL, type ActionContext, type ActionHandler, type ActionResult, type ActionTools, type ApiWorkerEnv, type AppLogEvent, type AppLogEventKey, type AppLogsResponse, type AppNameResolution, type AppNameValidation, type AuthWorkerEnv, Awareness, type AwarenessState, type AwarenessStates, BASE_USERS_SCHEMA, BUILT_IN_TOOLS, type BaseMessage, BaseRoom, CHANNELS_SCHEMA, CHANNEL_INVITATIONS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, CLIENT_LOG_MARKER, CONVERSATION_SCHEMAS, COST_RATES, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type ClientErrorKind, type ClientErrorReport, type ClientMessage, type CollectionPermissionSummary, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ComposioToolsOptions, type ConnectionAttachment, 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 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 HandlerContext, type Job, type JobContext, JobRoom, type JobRoomConfig, type JobStatus, type JwtClaims, type JwtVerifierConfig, LOG_LEVELS, type LogLevel, MESSAGES_SCHEMA, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type MessageHandlers, type MsgType, type MutateActionData, type PermissionAnalysis, type PermissionContext, type PermissionLevel, type PermissionSource, type PlatformWorkerEnv, type Player, type PrefixResult, type PresencePeer, PresenceRoom, type ProtocolMessage, type QueryActionData, REACTIONS_SCHEMA, READ_RECEIPTS_SCHEMA, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_NAMES, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_DEFAULT, RecordRoom, type RecordRoomConfig, type ResolvedColumn, type ResolvedPermission, type RolePermissions, type RunMigrationsResult, SYSTEM_COLLECTIONS, SYSTEM_MANAGED_COLUMNS, SchemaRegistry, type ScopeContext, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, type
|
|
4883
|
+
export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, ALLOWED_BINDING_TYPES, APP_ID_RE, APP_LOG_EVENT_KEYS, APP_NAME_RULES, AUTO_PROVISIONABLE_TYPES, AUTO_PROVISION_SENTINEL, type ActionContext, type ActionHandler, type ActionResult, type ActionTools, type ApiWorkerEnv, type AppLogEvent, type AppLogEventKey, type AppLogsResponse, type AppNameResolution, type AppNameValidation, type AuthWorkerEnv, Awareness, type AwarenessState, type AwarenessStates, BASE_USERS_SCHEMA, BUILT_IN_TOOLS, type BaseMessage, BaseRoom, CHANNELS_SCHEMA, CHANNEL_INVITATIONS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, CLIENT_LOG_MARKER, CONVERSATION_SCHEMAS, COST_RATES, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type ClientErrorKind, type ClientErrorReport, type ClientMessage, type CollectionPermissionSummary, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ComposioToolsOptions, type ConnectionAttachment, 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, DEPLOYED_APPS_DEFAULTS, DIRECTORY_SCHEMAS, type DOBindings, type DOManifest, type DOManifestEntry, 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 HandlerContext, type Job, type JobContext, JobRoom, type JobRoomConfig, type JobStatus, type JwtClaims, type JwtVerifierConfig, LOG_LEVELS, type LogLevel, MESSAGES_SCHEMA, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type MessageHandlers, type MsgType, type MutateActionData, type PermissionAnalysis, type PermissionContext, type PermissionLevel, type PermissionSource, type PlatformWorkerEnv, type Player, type PrefixResult, type PresencePeer, PresenceRoom, type ProtocolMessage, type QueryActionData, REACTIONS_SCHEMA, READ_RECEIPTS_SCHEMA, REGISTRY_INSTANCE, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_NAMES, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_DEFAULT, RecordRoom, type RecordRoomConfig, RegistryClientError, type ResolvedColumn, type ResolvedPermission, type RolePermissions, type RunMigrationsResult, STRICT_APP_ID_RE, SYSTEM_COLLECTIONS, SYSTEM_MANAGED_COLUMNS, SchemaRegistry, type ScopeContext, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, type ScreenshotResult, type ServerMessage, type SharedConnection, type StoredRecord, type Summarizer, type SyncResult, TEST_ACCOUNT_EMAIL_SUFFIX, type TokenDebugInfo, type ToolResult, type ToolSchema, USERS_COLUMNS, type User, type UserAttachment, VOTING_SCHEMAS, type ValidationError, type VerifiedAuth, type VerifyOutcome, type VerifyResult, type Viewport, WORKSPACE_SCHEMAS, YjsRoom, analyzePermissions, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, authWorkerFetch, bindingManifestFromOutputConfig, buildCronContext, buildTableSelect, buildUiParts, callRegistry, canCreate, canDelete, canRead, canUpdate, capToolResultSize, captureScreenshot, checkFieldPermissions, clientBuild, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDecoder, createDeepSpaceAI, createDeepSpaceAuth, createEncoder, createScopedR2Handler, dataToColumnValues, decodeJwtPayload, deleteChatCascade, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, enqueueJob, getChat, getGlobalDOSchemas, getGlobalDOType, getMessageType, getRolePermissions, handleAwarenessMessage, handleClientErrorReport, handleSyncMessage, hasContent, isAutoProvision, isOwner, isTestAccountClaims, isTestAccountEmail, isTestAccountTier, lintSchema, loadMessages, makeDefaultSummarizer, matchOrigin, meterAi, meterUsage, meterVectorize, noopPermissionContext, parseQuotaLimit, platformCorsPatterns, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, readVarUint, readVarUint8Array, registerClientErrorRoute, registryErrorJson, registryStub, resolveAppName, resolveColumn, rowToData, runMigrations, serverBuild, timingSafeEqualHex, timingSafeEqualStrings, toUint8Array, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema, writeVarUint, writeVarUint8Array };
|