deepspace 0.33.1 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +5 -1
  3. package/dist/{chunk-PZDVKSLI.js → chunk-ESEI3MMY.js} +2 -2
  4. package/dist/{chunk-PZDVKSLI.js.map → chunk-ESEI3MMY.js.map} +1 -1
  5. package/dist/chunk-ESYXTIV2.js +1957 -0
  6. package/dist/chunk-ESYXTIV2.js.map +1 -0
  7. package/dist/cli.js +151 -53
  8. package/dist/cli.js.map +1 -1
  9. package/dist/documentation-client-core.js +1 -1
  10. package/dist/documentation-default-renderer.cjs +1 -1
  11. package/dist/documentation-react.js +1 -1
  12. package/dist/documentation-runtime.js +10 -10
  13. package/dist/documentation-server-core.js +1 -1
  14. package/dist/documentation.js +47 -22
  15. package/dist/documentation.js.map +1 -1
  16. package/dist/expo.d.ts +83 -0
  17. package/dist/expo.js +242 -0
  18. package/dist/expo.js.map +1 -0
  19. package/dist/index.d.ts +110 -23
  20. package/dist/index.js +134 -53
  21. package/dist/index.js.map +1 -1
  22. package/dist/server.d.ts +205 -37
  23. package/dist/server.js +290 -97
  24. package/dist/server.js.map +1 -1
  25. package/dist/testing.js +45 -3
  26. package/dist/testing.js.map +1 -1
  27. package/dist/worker.d.ts +348 -48
  28. package/dist/worker.js +547 -110
  29. package/dist/worker.js.map +1 -1
  30. package/features/documents/feature.json +15 -0
  31. package/features/documents/src/DocumentsListPage.tsx +22 -8
  32. package/features/documents/src/InviteDialog.tsx +63 -42
  33. package/features/documents/src/__tests__/documents-find-invitee-action.test.ts +131 -0
  34. package/features/documents/src/__tests__/documents-invitee-lookup.test.ts +67 -0
  35. package/features/documents/src/documents-find-invitee-action.ts +56 -0
  36. package/features/documents/src/documents-invitee-lookup.ts +38 -0
  37. package/features/documents/src/documents-ui.css +10 -0
  38. package/package.json +29 -9
package/dist/expo.d.ts ADDED
@@ -0,0 +1,83 @@
1
+ /** Pure URL helpers shared by the Expo auth client and its tests. */
2
+ declare function buildExpoOAuthStartUrl(baseUrl: string, provider: string, redirectUri: string, state?: string, startPath?: string, codeChallenge?: string): string;
3
+ declare function codeFromExpoRedirect(url: string): string | null;
4
+ declare function stateFromExpoRedirect(url: string): string | null;
5
+ declare function normalizeExpoBaseUrl(baseUrl: string): string;
6
+
7
+ type ExpoAuthProvider = 'google' | (string & {});
8
+ interface DeepSpaceExpoSession {
9
+ sessionToken: string;
10
+ accessToken: string;
11
+ }
12
+ interface DeepSpaceExpoUser {
13
+ userId: string;
14
+ claims: Record<string, unknown>;
15
+ }
16
+ interface ExpoAuthStorage {
17
+ getItem(key: string): Promise<string | null>;
18
+ setItem(key: string, value: string): Promise<void>;
19
+ deleteItem(key: string): Promise<void>;
20
+ }
21
+ interface DeepSpaceExpoClientOptions {
22
+ /** Deployed app origin, for example `https://example.app.space`. */
23
+ baseUrl: string;
24
+ /** Defaults to Expo's `createURL('auth/callback')`. */
25
+ redirectUri?: string;
26
+ /** SecureStore-backed by default; inject a test store when unit testing. */
27
+ storage?: ExpoAuthStorage;
28
+ /** Namespaced storage key so multiple apps can share one device. */
29
+ storageKey?: string;
30
+ /** Worker endpoint overrides for apps with a custom auth route. */
31
+ paths?: Partial<ExpoAuthPaths>;
32
+ fetch?: typeof globalThis.fetch;
33
+ /** Abort stalled auth/API requests after this many milliseconds. */
34
+ timeoutMs?: number;
35
+ }
36
+ interface ExpoAuthPaths {
37
+ start: string;
38
+ exchange: string;
39
+ token: string;
40
+ me: string;
41
+ signOut: string;
42
+ }
43
+ declare class DeepSpaceExpoError extends Error {
44
+ readonly status: number;
45
+ readonly body: unknown;
46
+ constructor(message: string, status: number, body: unknown);
47
+ }
48
+ /**
49
+ * Thrown by `signIn` when the person closes the sign-in sheet. It isn't a
50
+ * failure, so apps usually return to where they were without showing an error.
51
+ * Check `code`: `instanceof` fails if the bundler includes two copies of
52
+ * this package.
53
+ */
54
+ declare class DeepSpaceSignInCancelledError extends Error {
55
+ readonly code: "sign_in_cancelled";
56
+ constructor();
57
+ }
58
+ declare function createDeepSpaceExpoClient(options: DeepSpaceExpoClientOptions): DeepSpaceExpoClient;
59
+ declare class DeepSpaceExpoClient {
60
+ private readonly baseUrl;
61
+ private readonly redirectUri;
62
+ private readonly storage;
63
+ private readonly storageKey;
64
+ private readonly paths;
65
+ private readonly fetcher;
66
+ private readonly timeoutMs;
67
+ private session;
68
+ constructor(options: DeepSpaceExpoClientOptions);
69
+ getSession(): Promise<DeepSpaceExpoSession | null>;
70
+ signIn(provider?: ExpoAuthProvider, state?: string): Promise<DeepSpaceExpoUser>;
71
+ signInWithGoogle(state?: string): Promise<DeepSpaceExpoUser>;
72
+ refresh(): Promise<string | null>;
73
+ getAuthToken(): Promise<string | null>;
74
+ me(): Promise<DeepSpaceExpoUser>;
75
+ request<T>(path: string, init?: RequestInit, retried?: boolean): Promise<T>;
76
+ signOut(): Promise<void>;
77
+ private json;
78
+ private saveSession;
79
+ private clearSession;
80
+ private fetchWithTimeout;
81
+ }
82
+
83
+ export { DeepSpaceExpoClient, type DeepSpaceExpoClientOptions, DeepSpaceExpoError, type DeepSpaceExpoSession, type DeepSpaceExpoUser, DeepSpaceSignInCancelledError, type ExpoAuthPaths, type ExpoAuthProvider, type ExpoAuthStorage, buildExpoOAuthStartUrl, codeFromExpoRedirect, createDeepSpaceExpoClient, normalizeExpoBaseUrl, stateFromExpoRedirect };
package/dist/expo.js ADDED
@@ -0,0 +1,242 @@
1
+ // src/expo.ts
2
+ import * as Linking from "expo-linking";
3
+ import * as Crypto from "expo-crypto";
4
+ import * as SecureStore from "expo-secure-store";
5
+ import * as WebBrowser from "expo-web-browser";
6
+
7
+ // src/expo-url.ts
8
+ function buildExpoOAuthStartUrl(baseUrl, provider, redirectUri, state, startPath = "/api/auth/native-start", codeChallenge) {
9
+ const url = new URL(startPath, baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`);
10
+ url.searchParams.set("provider", provider);
11
+ url.searchParams.set("redirect_uri", redirectUri);
12
+ if (state) url.searchParams.set("state", state);
13
+ if (codeChallenge) {
14
+ url.searchParams.set("code_challenge", codeChallenge);
15
+ url.searchParams.set("code_challenge_method", "S256");
16
+ }
17
+ return url.toString();
18
+ }
19
+ function codeFromExpoRedirect(url) {
20
+ try {
21
+ return new URL(url).searchParams.get("code");
22
+ } catch {
23
+ return null;
24
+ }
25
+ }
26
+ function stateFromExpoRedirect(url) {
27
+ try {
28
+ return new URL(url).searchParams.get("state");
29
+ } catch {
30
+ return null;
31
+ }
32
+ }
33
+ function normalizeExpoBaseUrl(baseUrl) {
34
+ return baseUrl.replace(/\/+$/, "");
35
+ }
36
+
37
+ // src/expo.ts
38
+ var DeepSpaceExpoError = class extends Error {
39
+ status;
40
+ body;
41
+ constructor(message, status, body) {
42
+ super(message);
43
+ this.name = "DeepSpaceExpoError";
44
+ this.status = status;
45
+ this.body = body;
46
+ }
47
+ };
48
+ var DeepSpaceSignInCancelledError = class extends Error {
49
+ code = "sign_in_cancelled";
50
+ constructor() {
51
+ super("DeepSpace sign-in was cancelled");
52
+ this.name = "DeepSpaceSignInCancelledError";
53
+ }
54
+ };
55
+ var DEFAULT_PATHS = {
56
+ start: "/api/auth/native-start",
57
+ exchange: "/api/auth/native-exchange",
58
+ token: "/api/auth/native-token",
59
+ me: "/api/auth/native-me",
60
+ signOut: "/api/auth/native-signout"
61
+ };
62
+ var defaultStorage = {
63
+ getItem: (key) => SecureStore.getItemAsync(key),
64
+ setItem: (key, value) => SecureStore.setItemAsync(key, value),
65
+ deleteItem: (key) => SecureStore.deleteItemAsync(key)
66
+ };
67
+ function createDeepSpaceExpoClient(options) {
68
+ return new DeepSpaceExpoClient(options);
69
+ }
70
+ var DeepSpaceExpoClient = class {
71
+ baseUrl;
72
+ redirectUri;
73
+ storage;
74
+ storageKey;
75
+ paths;
76
+ fetcher;
77
+ timeoutMs;
78
+ session;
79
+ constructor(options) {
80
+ if (!options.baseUrl) throw new Error("DeepSpace Expo client requires baseUrl");
81
+ this.baseUrl = normalizeExpoBaseUrl(options.baseUrl);
82
+ this.redirectUri = options.redirectUri ?? Linking.createURL("auth/callback");
83
+ this.storage = options.storage ?? defaultStorage;
84
+ this.storageKey = options.storageKey ?? `deepspace.session.${encodeURIComponent(this.baseUrl)}`;
85
+ this.paths = { ...DEFAULT_PATHS, ...options.paths };
86
+ this.fetcher = options.fetch ?? globalThis.fetch.bind(globalThis);
87
+ this.timeoutMs = options.timeoutMs ?? 15e3;
88
+ }
89
+ async getSession() {
90
+ if (this.session !== void 0) return this.session;
91
+ const raw = await this.storage.getItem(this.storageKey);
92
+ if (!raw) return this.session = null;
93
+ try {
94
+ const value = JSON.parse(raw);
95
+ if (typeof value.sessionToken !== "string" || typeof value.accessToken !== "string") throw new Error("invalid session");
96
+ return this.session = value;
97
+ } catch {
98
+ await this.storage.deleteItem(this.storageKey);
99
+ return this.session = null;
100
+ }
101
+ }
102
+ async signIn(provider = "google", state) {
103
+ const expectedState = state ?? createOAuthState();
104
+ const codeVerifier = createCodeVerifier();
105
+ const codeChallenge = await createCodeChallenge(codeVerifier);
106
+ const startUrl = buildExpoOAuthStartUrl(
107
+ this.baseUrl,
108
+ provider,
109
+ this.redirectUri,
110
+ expectedState,
111
+ this.paths.start,
112
+ codeChallenge
113
+ );
114
+ const result = await WebBrowser.openAuthSessionAsync(startUrl, this.redirectUri);
115
+ if (result.type === "cancel" || result.type === "dismiss") throw new DeepSpaceSignInCancelledError();
116
+ if (result.type !== "success" || !result.url) throw new Error("DeepSpace sign-in did not finish");
117
+ const code = codeFromExpoRedirect(result.url);
118
+ if (!code) throw new Error("DeepSpace sign-in returned no exchange code");
119
+ if (stateFromExpoRedirect(result.url) !== expectedState) {
120
+ throw new Error("DeepSpace sign-in returned an invalid state");
121
+ }
122
+ const session = await this.json(this.paths.exchange, {
123
+ method: "POST",
124
+ body: JSON.stringify({ code, code_verifier: codeVerifier })
125
+ });
126
+ await this.saveSession(session);
127
+ return this.me();
128
+ }
129
+ signInWithGoogle(state) {
130
+ return this.signIn("google", state);
131
+ }
132
+ async refresh() {
133
+ const session = await this.getSession();
134
+ if (!session) return null;
135
+ try {
136
+ const next = await this.json(this.paths.token, { method: "POST", body: JSON.stringify({ sessionToken: session.sessionToken }) });
137
+ const accessToken = next.accessToken ?? next.token;
138
+ if (!accessToken) throw new Error("DeepSpace did not issue an access token");
139
+ await this.saveSession({ ...session, accessToken });
140
+ return accessToken;
141
+ } catch (error) {
142
+ if (error instanceof DeepSpaceExpoError && error.status === 401) await this.clearSession();
143
+ return null;
144
+ }
145
+ }
146
+ async getAuthToken() {
147
+ const session = await this.getSession();
148
+ return session?.accessToken || await this.refresh();
149
+ }
150
+ async me() {
151
+ const result = await this.request(this.paths.me);
152
+ return result;
153
+ }
154
+ async request(path, init = {}, retried = false) {
155
+ const token = await this.getAuthToken();
156
+ const headers = new Headers(init.headers);
157
+ if (!headers.has("Content-Type") && init.body != null && isJsonBody(init.body)) {
158
+ headers.set("Content-Type", "application/json");
159
+ }
160
+ if (token) headers.set("Authorization", `Bearer ${token}`);
161
+ const response = await this.fetchWithTimeout(`${this.baseUrl}${path}`, { ...init, headers });
162
+ const body = await response.json().catch(() => ({}));
163
+ if (response.status === 401 && !retried && isReplayableBody(init.body) && (await this.getSession())?.sessionToken) {
164
+ const refreshed = await this.refresh();
165
+ if (refreshed) return this.request(path, init, true);
166
+ }
167
+ if (!response.ok) throw new DeepSpaceExpoError(typeof body.error === "string" ? body.error : `DeepSpace request failed (${response.status})`, response.status, body);
168
+ return body;
169
+ }
170
+ async signOut() {
171
+ const session = await this.getSession();
172
+ if (session) {
173
+ await this.fetchWithTimeout(`${this.baseUrl}${this.paths.signOut}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ sessionToken: session.sessionToken }) }).catch(() => void 0);
174
+ }
175
+ await this.clearSession();
176
+ }
177
+ async json(path, init) {
178
+ const response = await this.fetchWithTimeout(`${this.baseUrl}${path}`, { ...init, headers: { "Content-Type": "application/json", ...init.headers ?? {} } });
179
+ const body = await response.json().catch(() => ({}));
180
+ if (!response.ok) throw new DeepSpaceExpoError(typeof body.error === "string" ? body.error : `DeepSpace auth failed (${response.status})`, response.status, body);
181
+ return body;
182
+ }
183
+ async saveSession(session) {
184
+ this.session = session;
185
+ await this.storage.setItem(this.storageKey, JSON.stringify(session));
186
+ }
187
+ async clearSession() {
188
+ this.session = null;
189
+ await this.storage.deleteItem(this.storageKey);
190
+ }
191
+ async fetchWithTimeout(input, init = {}) {
192
+ if (!this.timeoutMs || this.timeoutMs <= 0) return this.fetcher(input, init);
193
+ const controller = new AbortController();
194
+ const timer = setTimeout(() => controller.abort(), this.timeoutMs);
195
+ const signal = init.signal;
196
+ if (signal) {
197
+ if (signal.aborted) controller.abort();
198
+ else signal.addEventListener("abort", () => controller.abort(), { once: true });
199
+ }
200
+ try {
201
+ return await this.fetcher(input, { ...init, signal: controller.signal });
202
+ } finally {
203
+ clearTimeout(timer);
204
+ }
205
+ }
206
+ };
207
+ function createOAuthState() {
208
+ return Crypto.randomUUID();
209
+ }
210
+ function createCodeVerifier() {
211
+ return `${Crypto.randomUUID().replaceAll("-", "")}${Crypto.randomUUID().replaceAll("-", "")}`;
212
+ }
213
+ async function createCodeChallenge(verifier) {
214
+ const digest = await Crypto.digestStringAsync(
215
+ Crypto.CryptoDigestAlgorithm.SHA256,
216
+ verifier,
217
+ { encoding: Crypto.CryptoEncoding.BASE64 }
218
+ );
219
+ return digest.replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
220
+ }
221
+ function isJsonBody(body) {
222
+ return typeof body === "string";
223
+ }
224
+ function isReplayableBody(body) {
225
+ if (body == null || typeof body === "string") return true;
226
+ if (typeof FormData !== "undefined" && body instanceof FormData) return true;
227
+ if (typeof URLSearchParams !== "undefined" && body instanceof URLSearchParams) return true;
228
+ if (typeof Blob !== "undefined" && body instanceof Blob) return true;
229
+ if (body instanceof ArrayBuffer || ArrayBuffer.isView(body)) return true;
230
+ return false;
231
+ }
232
+ export {
233
+ DeepSpaceExpoClient,
234
+ DeepSpaceExpoError,
235
+ DeepSpaceSignInCancelledError,
236
+ buildExpoOAuthStartUrl,
237
+ codeFromExpoRedirect,
238
+ createDeepSpaceExpoClient,
239
+ normalizeExpoBaseUrl,
240
+ stateFromExpoRedirect
241
+ };
242
+ //# sourceMappingURL=expo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/expo.ts","../src/expo-url.ts"],"sourcesContent":["/**\n * DeepSpace Expo client.\n *\n * This entry is intentionally separate from `deepspace`: the browser client\n * uses Better Auth cookies and browser globals, while an Expo app needs the\n * system browser, a custom-scheme callback, and SecureStore-backed sessions.\n * The Worker still owns auth and JWT issuance; this package only transports the\n * one-time OAuth code and refreshes the short-lived bearer.\n */\nimport * as Linking from 'expo-linking'\nimport * as Crypto from 'expo-crypto'\nimport * as SecureStore from 'expo-secure-store'\nimport * as WebBrowser from 'expo-web-browser'\nimport {\n buildExpoOAuthStartUrl,\n codeFromExpoRedirect,\n normalizeExpoBaseUrl,\n stateFromExpoRedirect,\n} from './expo-url'\n\nexport type ExpoAuthProvider = 'google' | (string & {})\n\nexport interface DeepSpaceExpoSession {\n sessionToken: string\n accessToken: string\n}\n\nexport interface DeepSpaceExpoUser {\n userId: string\n claims: Record<string, unknown>\n}\n\nexport interface ExpoAuthStorage {\n getItem(key: string): Promise<string | null>\n setItem(key: string, value: string): Promise<void>\n deleteItem(key: string): Promise<void>\n}\n\nexport interface DeepSpaceExpoClientOptions {\n /** Deployed app origin, for example `https://example.app.space`. */\n baseUrl: string\n /** Defaults to Expo's `createURL('auth/callback')`. */\n redirectUri?: string\n /** SecureStore-backed by default; inject a test store when unit testing. */\n storage?: ExpoAuthStorage\n /** Namespaced storage key so multiple apps can share one device. */\n storageKey?: string\n /** Worker endpoint overrides for apps with a custom auth route. */\n paths?: Partial<ExpoAuthPaths>\n fetch?: typeof globalThis.fetch\n /** Abort stalled auth/API requests after this many milliseconds. */\n timeoutMs?: number\n}\n\nexport interface ExpoAuthPaths {\n start: string\n exchange: string\n token: string\n me: string\n signOut: string\n}\n\nexport class DeepSpaceExpoError extends Error {\n readonly status: number\n readonly body: unknown\n\n constructor(message: string, status: number, body: unknown) {\n super(message)\n this.name = 'DeepSpaceExpoError'\n this.status = status\n this.body = body\n }\n}\n\n/**\n * Thrown by `signIn` when the person closes the sign-in sheet. It isn't a\n * failure, so apps usually return to where they were without showing an error.\n * Check `code`: `instanceof` fails if the bundler includes two copies of\n * this package.\n */\nexport class DeepSpaceSignInCancelledError extends Error {\n readonly code = 'sign_in_cancelled' as const\n\n constructor() {\n super('DeepSpace sign-in was cancelled')\n this.name = 'DeepSpaceSignInCancelledError'\n }\n}\n\nconst DEFAULT_PATHS: ExpoAuthPaths = {\n start: '/api/auth/native-start',\n exchange: '/api/auth/native-exchange',\n token: '/api/auth/native-token',\n me: '/api/auth/native-me',\n signOut: '/api/auth/native-signout',\n}\n\nconst defaultStorage: ExpoAuthStorage = {\n getItem: (key) => SecureStore.getItemAsync(key),\n setItem: (key, value) => SecureStore.setItemAsync(key, value),\n deleteItem: (key) => SecureStore.deleteItemAsync(key),\n}\n\nexport function createDeepSpaceExpoClient(options: DeepSpaceExpoClientOptions): DeepSpaceExpoClient {\n return new DeepSpaceExpoClient(options)\n}\n\nexport class DeepSpaceExpoClient {\n private readonly baseUrl: string\n private readonly redirectUri: string\n private readonly storage: ExpoAuthStorage\n private readonly storageKey: string\n private readonly paths: ExpoAuthPaths\n private readonly fetcher: typeof globalThis.fetch\n private readonly timeoutMs: number\n private session: DeepSpaceExpoSession | null | undefined\n\n constructor(options: DeepSpaceExpoClientOptions) {\n if (!options.baseUrl) throw new Error('DeepSpace Expo client requires baseUrl')\n this.baseUrl = normalizeExpoBaseUrl(options.baseUrl)\n this.redirectUri = options.redirectUri ?? Linking.createURL('auth/callback')\n this.storage = options.storage ?? defaultStorage\n this.storageKey = options.storageKey ?? `deepspace.session.${encodeURIComponent(this.baseUrl)}`\n this.paths = { ...DEFAULT_PATHS, ...options.paths }\n this.fetcher = options.fetch ?? globalThis.fetch.bind(globalThis)\n this.timeoutMs = options.timeoutMs ?? 15_000\n }\n\n async getSession(): Promise<DeepSpaceExpoSession | null> {\n if (this.session !== undefined) return this.session\n const raw = await this.storage.getItem(this.storageKey)\n if (!raw) return (this.session = null)\n try {\n const value = JSON.parse(raw) as Partial<DeepSpaceExpoSession>\n if (typeof value.sessionToken !== 'string' || typeof value.accessToken !== 'string') throw new Error('invalid session')\n return (this.session = value as DeepSpaceExpoSession)\n } catch {\n await this.storage.deleteItem(this.storageKey)\n return (this.session = null)\n }\n }\n\n async signIn(provider: ExpoAuthProvider = 'google', state?: string): Promise<DeepSpaceExpoUser> {\n const expectedState = state ?? createOAuthState()\n const codeVerifier = createCodeVerifier()\n const codeChallenge = await createCodeChallenge(codeVerifier)\n const startUrl = buildExpoOAuthStartUrl(\n this.baseUrl,\n provider,\n this.redirectUri,\n expectedState,\n this.paths.start,\n codeChallenge,\n )\n const result = await WebBrowser.openAuthSessionAsync(startUrl, this.redirectUri)\n if (result.type === 'cancel' || result.type === 'dismiss') throw new DeepSpaceSignInCancelledError()\n if (result.type !== 'success' || !result.url) throw new Error('DeepSpace sign-in did not finish')\n const code = codeFromExpoRedirect(result.url)\n if (!code) throw new Error('DeepSpace sign-in returned no exchange code')\n if (stateFromExpoRedirect(result.url) !== expectedState) {\n throw new Error('DeepSpace sign-in returned an invalid state')\n }\n const session = await this.json<DeepSpaceExpoSession>(this.paths.exchange, {\n method: 'POST',\n body: JSON.stringify({ code, code_verifier: codeVerifier }),\n })\n await this.saveSession(session)\n return this.me()\n }\n\n signInWithGoogle(state?: string): Promise<DeepSpaceExpoUser> { return this.signIn('google', state) }\n\n async refresh(): Promise<string | null> {\n const session = await this.getSession()\n if (!session) return null\n try {\n const next = await this.json<{ accessToken?: string; token?: string }>(this.paths.token, { method: 'POST', body: JSON.stringify({ sessionToken: session.sessionToken }) })\n const accessToken = next.accessToken ?? next.token\n if (!accessToken) throw new Error('DeepSpace did not issue an access token')\n await this.saveSession({ ...session, accessToken })\n return accessToken\n } catch (error) {\n if (error instanceof DeepSpaceExpoError && error.status === 401) await this.clearSession()\n return null\n }\n }\n\n async getAuthToken(): Promise<string | null> {\n const session = await this.getSession()\n return session?.accessToken || (await this.refresh())\n }\n\n async me(): Promise<DeepSpaceExpoUser> {\n const result = await this.request<DeepSpaceExpoUser>(this.paths.me)\n return result\n }\n\n async request<T>(path: string, init: RequestInit = {}, retried = false): Promise<T> {\n const token = await this.getAuthToken()\n const headers = new Headers(init.headers)\n if (!headers.has('Content-Type') && init.body != null && isJsonBody(init.body)) {\n headers.set('Content-Type', 'application/json')\n }\n if (token) headers.set('Authorization', `Bearer ${token}`)\n const response = await this.fetchWithTimeout(`${this.baseUrl}${path}`, { ...init, headers })\n const body = await response.json().catch(() => ({})) as T & { error?: string }\n if (response.status === 401 && !retried && isReplayableBody(init.body) && (await this.getSession())?.sessionToken) {\n const refreshed = await this.refresh()\n if (refreshed) return this.request<T>(path, init, true)\n }\n if (!response.ok) throw new DeepSpaceExpoError(typeof body.error === 'string' ? body.error : `DeepSpace request failed (${response.status})`, response.status, body)\n return body\n }\n\n async signOut(): Promise<void> {\n const session = await this.getSession()\n if (session) {\n await this.fetchWithTimeout(`${this.baseUrl}${this.paths.signOut}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ sessionToken: session.sessionToken }) }).catch(() => undefined)\n }\n await this.clearSession()\n }\n\n private async json<T>(path: string, init: RequestInit): Promise<T> {\n const response = await this.fetchWithTimeout(`${this.baseUrl}${path}`, { ...init, headers: { 'Content-Type': 'application/json', ...(init.headers ?? {}) } })\n const body = await response.json().catch(() => ({})) as T & { error?: string }\n if (!response.ok) throw new DeepSpaceExpoError(typeof body.error === 'string' ? body.error : `DeepSpace auth failed (${response.status})`, response.status, body)\n return body\n }\n\n private async saveSession(session: DeepSpaceExpoSession) { this.session = session; await this.storage.setItem(this.storageKey, JSON.stringify(session)) }\n private async clearSession() { this.session = null; await this.storage.deleteItem(this.storageKey) }\n\n private async fetchWithTimeout(input: RequestInfo | URL, init: RequestInit = {}): Promise<Response> {\n if (!this.timeoutMs || this.timeoutMs <= 0) return this.fetcher(input, init)\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(), this.timeoutMs)\n const signal = init.signal\n if (signal) {\n if (signal.aborted) controller.abort()\n else signal.addEventListener('abort', () => controller.abort(), { once: true })\n }\n try {\n return await this.fetcher(input, { ...init, signal: controller.signal })\n } finally {\n clearTimeout(timer)\n }\n }\n}\n\nexport {\n buildExpoOAuthStartUrl,\n codeFromExpoRedirect,\n normalizeExpoBaseUrl,\n stateFromExpoRedirect,\n}\n\nfunction createOAuthState(): string {\n return Crypto.randomUUID()\n}\n\nfunction createCodeVerifier(): string {\n return `${Crypto.randomUUID().replaceAll('-', '')}${Crypto.randomUUID().replaceAll('-', '')}`\n}\n\nasync function createCodeChallenge(verifier: string): Promise<string> {\n const digest = await Crypto.digestStringAsync(\n Crypto.CryptoDigestAlgorithm.SHA256,\n verifier,\n { encoding: Crypto.CryptoEncoding.BASE64 },\n )\n return digest.replaceAll('+', '-').replaceAll('/', '_').replace(/=+$/, '')\n}\n\nfunction isJsonBody(body: BodyInit): boolean {\n return typeof body === 'string'\n}\n\nfunction isReplayableBody(body: BodyInit | null | undefined): boolean {\n if (body == null || typeof body === 'string') return true\n if (typeof FormData !== 'undefined' && body instanceof FormData) return true\n if (typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams) return true\n if (typeof Blob !== 'undefined' && body instanceof Blob) return true\n if (body instanceof ArrayBuffer || ArrayBuffer.isView(body)) return true\n return false\n}\n","/** Pure URL helpers shared by the Expo auth client and its tests. */\nexport function buildExpoOAuthStartUrl(\n baseUrl: string,\n provider: string,\n redirectUri: string,\n state?: string,\n startPath = '/api/auth/native-start',\n codeChallenge?: string,\n): string {\n const url = new URL(startPath, baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`)\n url.searchParams.set('provider', provider)\n url.searchParams.set('redirect_uri', redirectUri)\n if (state) url.searchParams.set('state', state)\n if (codeChallenge) {\n url.searchParams.set('code_challenge', codeChallenge)\n url.searchParams.set('code_challenge_method', 'S256')\n }\n return url.toString()\n}\n\nexport function codeFromExpoRedirect(url: string): string | null {\n try {\n return new URL(url).searchParams.get('code')\n } catch {\n return null\n }\n}\n\nexport function stateFromExpoRedirect(url: string): string | null {\n try {\n return new URL(url).searchParams.get('state')\n } catch {\n return null\n }\n}\n\nexport function normalizeExpoBaseUrl(baseUrl: string): string {\n return baseUrl.replace(/\\/+$/, '')\n}\n"],"mappings":";AASA,YAAY,aAAa;AACzB,YAAY,YAAY;AACxB,YAAY,iBAAiB;AAC7B,YAAY,gBAAgB;;;ACXrB,SAAS,uBACd,SACA,UACA,aACA,OACA,YAAY,0BACZ,eACQ;AACR,QAAM,MAAM,IAAI,IAAI,WAAW,QAAQ,SAAS,GAAG,IAAI,UAAU,GAAG,OAAO,GAAG;AAC9E,MAAI,aAAa,IAAI,YAAY,QAAQ;AACzC,MAAI,aAAa,IAAI,gBAAgB,WAAW;AAChD,MAAI,MAAO,KAAI,aAAa,IAAI,SAAS,KAAK;AAC9C,MAAI,eAAe;AACjB,QAAI,aAAa,IAAI,kBAAkB,aAAa;AACpD,QAAI,aAAa,IAAI,yBAAyB,MAAM;AAAA,EACtD;AACA,SAAO,IAAI,SAAS;AACtB;AAEO,SAAS,qBAAqB,KAA4B;AAC/D,MAAI;AACF,WAAO,IAAI,IAAI,GAAG,EAAE,aAAa,IAAI,MAAM;AAAA,EAC7C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,sBAAsB,KAA4B;AAChE,MAAI;AACF,WAAO,IAAI,IAAI,GAAG,EAAE,aAAa,IAAI,OAAO;AAAA,EAC9C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,qBAAqB,SAAyB;AAC5D,SAAO,QAAQ,QAAQ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;AAEA,SAAS,WAAW,MAAyB;AAC3C,SAAO,OAAO,SAAS;AACzB;AAEA,SAAS,iBAAiB,MAA4C;AACpE,MAAI,QAAQ,QAAQ,OAAO,SAAS,SAAU,QAAO;AACrD,MAAI,OAAO,aAAa,eAAe,gBAAgB,SAAU,QAAO;AACxE,MAAI,OAAO,oBAAoB,eAAe,gBAAgB,gBAAiB,QAAO;AACtF,MAAI,OAAO,SAAS,eAAe,gBAAgB,KAAM,QAAO;AAChE,MAAI,gBAAgB,eAAe,YAAY,OAAO,IAAI,EAAG,QAAO;AACpE,SAAO;AACT;","names":[]}
package/dist/index.d.ts CHANGED
@@ -141,7 +141,7 @@ interface YjsSubscription {
141
141
  * 3. Server-side process.env.DEEPSPACE_ENV
142
142
  * 4. Hostname detection (fallback)
143
143
  */
144
- type Environment = 'dev' | 'staging' | 'prod';
144
+ type Environment = 'dev' | 'staging' | 'medical' | 'prod';
145
145
  interface EnvironmentConfig {
146
146
  name: Environment;
147
147
  /** Platform API worker URL */
@@ -158,6 +158,8 @@ interface EnvironmentConfig {
158
158
  mainAppUrl: string;
159
159
  /** Builder dashboard URL */
160
160
  dashboardUrl: string;
161
+ /** Privacy policy that sign-in screens link to */
162
+ privacyPolicyUrl: string;
161
163
  }
162
164
  declare function detectEnvironment(): Environment;
163
165
  declare function getEnvironmentConfig(): EnvironmentConfig;
@@ -165,6 +167,8 @@ declare function getApiUrl(): string;
165
167
  declare function getPlatformWorkerUrl(): string;
166
168
  declare function getAuthUrl(): string;
167
169
  declare function isLocalDev(): boolean;
170
+ /** True only on production. DeepSpace Medical (`medical`) is its own plane,
171
+ * so this is false there; check `detectEnvironment()` to tell the planes apart. */
168
172
  declare function isProduction(): boolean;
169
173
  /** Reset cached environment (useful for testing) */
170
174
  declare function resetEnvironmentCache(): void;
@@ -229,6 +233,11 @@ interface DeepSpaceAIModel {
229
233
  transport: 'messages' | 'chat-completions';
230
234
  recommendation: 'frontier' | 'balanced' | 'fast' | 'available' | 'limited';
231
235
  note?: string;
236
+ /**
237
+ * Superseded: still resolvable by id, so an app that saved it keeps working,
238
+ * but left out of pickers and model lists.
239
+ */
240
+ legacy?: true;
232
241
  }
233
242
  interface DeepSpaceAgentProfile {
234
243
  id: DeepSpaceAgentProfileId;
@@ -244,8 +253,8 @@ interface DeepSpaceAgentProfile {
244
253
  * deployed app underneath a commit.
245
254
  */
246
255
  declare const DEEPSPACE_MODEL_CATALOG_PROVENANCE: {
247
- readonly version: "2026-08-04";
248
- readonly verifiedAt: "2026-08-04";
256
+ readonly version: "2026-09-24";
257
+ readonly verifiedAt: "2026-09-24";
249
258
  readonly sources: {
250
259
  readonly anthropic: "https://platform.claude.com/docs/en/api/beta/models/list";
251
260
  readonly openai: "https://developers.openai.com/api/docs/models/all";
@@ -253,8 +262,8 @@ declare const DEEPSPACE_MODEL_CATALOG_PROVENANCE: {
253
262
  };
254
263
  };
255
264
  declare const DEEPSPACE_AI_MODELS: readonly [{
256
- readonly id: "claude-fable-5";
257
- readonly label: "Claude Fable 5";
265
+ readonly id: "claude-opus-5-5";
266
+ readonly label: "Claude Opus 5.5";
258
267
  readonly family: "Claude 5";
259
268
  readonly recommendation: "frontier";
260
269
  } & {
@@ -265,8 +274,8 @@ declare const DEEPSPACE_AI_MODELS: readonly [{
265
274
  agentSupport: "multi-step";
266
275
  agentProfiles: readonly ["application", "documentation"];
267
276
  }, {
268
- readonly id: "claude-opus-5";
269
- readonly label: "Claude Opus 5";
277
+ readonly id: "claude-fable-5-1";
278
+ readonly label: "Claude Fable 5.1";
270
279
  readonly family: "Claude 5";
271
280
  readonly recommendation: "frontier";
272
281
  } & {
@@ -300,11 +309,95 @@ declare const DEEPSPACE_AI_MODELS: readonly [{
300
309
  } & {
301
310
  agentSupport: "multi-step";
302
311
  agentProfiles: readonly ["application", "documentation"];
312
+ }, {
313
+ readonly id: "gpt-6-sol";
314
+ readonly label: "GPT-6 Sol";
315
+ readonly family: "GPT-6";
316
+ readonly recommendation: "balanced";
317
+ } & {
318
+ readonly provider: "openai";
319
+ readonly providerLabel: "OpenAI";
320
+ readonly transport: "chat-completions";
321
+ } & {
322
+ agentSupport: "multi-step";
323
+ agentProfiles: readonly ["application", "documentation"];
324
+ }, {
325
+ readonly id: "gpt-6-luna";
326
+ readonly label: "GPT-6 Luna";
327
+ readonly family: "GPT-6";
328
+ readonly recommendation: "fast";
329
+ } & {
330
+ readonly provider: "openai";
331
+ readonly providerLabel: "OpenAI";
332
+ readonly transport: "chat-completions";
333
+ } & {
334
+ agentSupport: "multi-step";
335
+ agentProfiles: readonly ["application", "documentation"];
336
+ }, {
337
+ readonly id: "gpt-6-astra";
338
+ readonly label: "GPT-6 Astra";
339
+ readonly provider: "openai";
340
+ readonly providerLabel: "OpenAI";
341
+ readonly family: "GPT-6";
342
+ readonly agentSupport: "none";
343
+ readonly agentProfiles: readonly [];
344
+ readonly transport: "chat-completions";
345
+ readonly recommendation: "limited";
346
+ readonly note: "Available for direct generation; its tool calling requires the Responses API, which the DeepSpace proxy does not serve.";
347
+ }, {
348
+ readonly id: "gpt-oss-120b";
349
+ readonly label: "GPT-OSS 120B";
350
+ readonly provider: "cerebras";
351
+ readonly providerLabel: "Cerebras";
352
+ readonly family: "GPT-OSS";
353
+ readonly agentSupport: "single-step";
354
+ readonly agentProfiles: readonly [];
355
+ readonly transport: "chat-completions";
356
+ readonly recommendation: "limited";
357
+ readonly note: "Available for direct generation; the current proxy adapter has not passed multi-step tool-result continuation.";
358
+ }, {
359
+ readonly id: "qwen-3.8-27b";
360
+ readonly label: "Qwen 3.8 27B";
361
+ readonly provider: "cerebras";
362
+ readonly providerLabel: "Cerebras";
363
+ readonly family: "Qwen 3.8";
364
+ readonly agentSupport: "single-step";
365
+ readonly agentProfiles: readonly [];
366
+ readonly transport: "chat-completions";
367
+ readonly recommendation: "limited";
368
+ readonly note: "Available for direct generation; the current proxy adapter has not passed multi-step tool-result continuation.";
369
+ }, {
370
+ readonly id: "claude-opus-5";
371
+ readonly label: "Claude Opus 5";
372
+ readonly family: "Claude 5";
373
+ readonly recommendation: "frontier";
374
+ readonly legacy: true;
375
+ } & {
376
+ readonly provider: "anthropic";
377
+ readonly providerLabel: "Anthropic";
378
+ readonly transport: "messages";
379
+ } & {
380
+ agentSupport: "multi-step";
381
+ agentProfiles: readonly ["application", "documentation"];
382
+ }, {
383
+ readonly id: "claude-fable-5";
384
+ readonly label: "Claude Fable 5";
385
+ readonly family: "Claude 5";
386
+ readonly recommendation: "frontier";
387
+ readonly legacy: true;
388
+ } & {
389
+ readonly provider: "anthropic";
390
+ readonly providerLabel: "Anthropic";
391
+ readonly transport: "messages";
392
+ } & {
393
+ agentSupport: "multi-step";
394
+ agentProfiles: readonly ["application", "documentation"];
303
395
  }, {
304
396
  readonly id: "gpt-5.6-sol";
305
397
  readonly label: "GPT-5.6 Sol";
306
398
  readonly family: "GPT-5.6";
307
399
  readonly recommendation: "frontier";
400
+ readonly legacy: true;
308
401
  } & {
309
402
  readonly provider: "openai";
310
403
  readonly providerLabel: "OpenAI";
@@ -317,6 +410,7 @@ declare const DEEPSPACE_AI_MODELS: readonly [{
317
410
  readonly label: "GPT-5.6 Terra";
318
411
  readonly family: "GPT-5.6";
319
412
  readonly recommendation: "balanced";
413
+ readonly legacy: true;
320
414
  } & {
321
415
  readonly provider: "openai";
322
416
  readonly providerLabel: "OpenAI";
@@ -329,6 +423,7 @@ declare const DEEPSPACE_AI_MODELS: readonly [{
329
423
  readonly label: "GPT-5.6 Luna";
330
424
  readonly family: "GPT-5.6";
331
425
  readonly recommendation: "fast";
426
+ readonly legacy: true;
332
427
  } & {
333
428
  readonly provider: "openai";
334
429
  readonly providerLabel: "OpenAI";
@@ -336,34 +431,23 @@ declare const DEEPSPACE_AI_MODELS: readonly [{
336
431
  } & {
337
432
  agentSupport: "multi-step";
338
433
  agentProfiles: readonly ["application", "documentation"];
339
- }, {
340
- readonly id: "gpt-oss-120b";
341
- readonly label: "GPT-OSS 120B";
342
- readonly provider: "cerebras";
343
- readonly providerLabel: "Cerebras";
344
- readonly family: "GPT-OSS";
345
- readonly agentSupport: "single-step";
346
- readonly agentProfiles: readonly [];
347
- readonly transport: "chat-completions";
348
- readonly recommendation: "limited";
349
- readonly note: "Available for direct generation; the current proxy adapter has not passed multi-step tool-result continuation.";
350
434
  }];
351
435
  declare const DEEPSPACE_AI_DEFAULTS: {
352
- readonly agent: "claude-sonnet-5";
353
- readonly directGeneration: "claude-sonnet-5";
436
+ readonly agent: "claude-opus-5-5";
437
+ readonly directGeneration: "claude-opus-5-5";
354
438
  readonly summarization: "claude-haiku-4-5";
355
439
  };
356
440
  declare const DEEPSPACE_AGENT_PROFILES: {
357
441
  readonly application: {
358
442
  readonly id: "application";
359
- readonly defaultModel: "claude-sonnet-5";
443
+ readonly defaultModel: "claude-opus-5-5";
360
444
  readonly maxSteps: 21;
361
445
  readonly maxToolCalls: 20;
362
446
  readonly allowedTools: "application-defined";
363
447
  };
364
448
  readonly documentation: {
365
449
  readonly id: "documentation";
366
- readonly defaultModel: "claude-sonnet-5";
450
+ readonly defaultModel: "claude-opus-5-5";
367
451
  readonly maxSteps: 21;
368
452
  readonly maxToolCalls: 20;
369
453
  readonly allowedTools: readonly ["documentation_search", "documentation_read"];
@@ -1375,6 +1459,9 @@ declare const ACTION_ROUTES_BEARER_GUARD_MIGRATION_ID = "2026-08-action-routes-b
1375
1459
  * `<audio>`, or `<video>` load) by the app-origin session cookie, so private
1376
1460
  * file URLs render for the signed-in user without tokens or signed URLs. */
1377
1461
  declare const FILES_SESSION_COOKIE_READS_MIGRATION_ID = "2026-09-files-session-cookie-reads";
1462
+ /** The SDK moved to AI SDK 7 (`ai` 7, `@ai-sdk/anthropic` 4). Apps pin their
1463
+ * own `ai`, and their chat route persists and streams through its API. */
1464
+ declare const AI_SDK_7_MIGRATION_ID = "2026-09-ai-sdk-7";
1378
1465
  type AppMigrationIdsValidation = {
1379
1466
  valid: true;
1380
1467
  ids: string[];
@@ -4663,4 +4750,4 @@ declare const ACCOUNT_STORAGE_LIMIT_BYTES: {
4663
4750
  declare function storageLimitForTier(tier: string | null | undefined): number;
4664
4751
  declare function formatBytes(bytes: number): string;
4665
4752
 
4666
- export { ACCOUNT_STORAGE_LIMIT_BYTES, ACTION_ROUTES_BEARER_GUARD_MIGRATION_ID, ACTION_TOOLS_DELETE_WHERE_MIGRATION_ID, ANONYMOUS_USER_ID_PREFIX, APP_LOG_EVENT_KEYS, ASYNC_RESOURCE_DEFAULTS, type AdHocChargeOpts, type AiStreamAction, type AiStreamChunk, type ApiErrorIssue, type AppLogEvent, type AppLogEventKey, type AppLogsResponse, type AppMigrationIdsValidation, type AsyncResourceDefaults, type AsyncResourceState, type AsyncResourceStatus, AuthGate, type AuthGateProps, AuthOverlay, Awareness, type AwarenessState, type AwarenessStates, BUILD_INJECTED_APP_ID_MIGRATION_ID, type BaseMessage, type CanvasShapeClient, type Channel, type ChannelMember, type ChargeOnceOpts, type ChargeOnceResult, type ClientMessage, type CollectionSchema, type ConnectionAttachment, type ConnectionStatus, type CronHistoryEntry, type CronMutationResult, type CronTaskState, DEEPSPACE_AGENT_PROFILES, DEEPSPACE_AI_DEFAULTS, DEEPSPACE_AI_MODELS, DEEPSPACE_MODEL_CATALOG_PROVENANCE, DEEPSPACE_THEME_PROPERTIES, DEFAULT_USER_COLORS, type DeepSpaceAIModel, type DeepSpaceAIModelId, type DeepSpaceAIProvider, type DeepSpaceAgentProfile, type DeepSpaceAgentProfileId, type DeepSpaceAgentSupport, DeepSpaceAuthProvider, type DeepSpaceThemeConfig, DeepSpaceThemeProvider, type DeepSpaceThemeProviderProps, type DeriveLoadStateInput, ENV, type Environment, FILES_SESSION_COOKIE_READS_MIGRATION_ID, type FileAttachment, type GroupedReaction, GuestBanner, type HandlerContext, type IntegrationResponse, type JobStatusView, type JobView, LOG_LEVELS, type LoadState, type LoadStateAuthInput, type LoadStateStatusInput, type LogLevel, MAX_LOG_TEXT_LENGTH, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type Message, type MessageHandlers, type MsgType, type NormalizedApiError, type PagedResourceFetchArgs, type PagedResourcePage, type PagedResourceState, type PagedResourceStatus, type PlanInfo, PlatformApiError, type PresencePeerClient, PricingTable, type PricingTablePlan, type PricingTablePrice, type ProductChargeOpts, type ProtocolMessage, type Purchase, type Query, type R2FileInfo, type R2FileListPage, type R2Scope, type R2UploadResult, RECORD_NOT_FOUND, ROLES, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_CONFIG, ROLE_DEFAULT, type Reaction, type ReadReceipt, type RecordData, RecordProvider, type RecordProviderProps, RecordRoomNotReadyError, RecordScope, type RequestOptions, type ResolvedDeepSpaceAgentModel, type Role, type RoomUser, SECURE_ROOM_BOUNDARIES_MIGRATION_ID, type ScopeEntry, ScopeRegistryProvider, type ServerMessage, SignedIn, SignedOut, type SubscribeOpts, type SubscribeResult, type SubscriptionState, type SubscriptionStatus, type SyncResult, type UseAsyncResourceOptions, type UseAuthProfileReadyOptions, type UseAuthStatusOptions, type UseCanvasResult, type UseCheckoutOpts, type UseCronMonitorResult, type UseJobsResult, type UsePagedResourceOptions, type UsePresenceRoomResult, type UseR2FilesReturn, type UseVoiceAgentOptions, type UseVoiceAgentResult, type UseYjsFieldResult, type UseYjsRoomResult, type UseYjsTextResult, type User, type UserCredits, type UserInfo, type UserKarma, type UserProfile, type ViewportClient, type VoiceStatus, type VoiceTranscriptEntry, WORKER_OWNED_NOT_FOUND_MIGRATION_ID, type WriteError, applyDeepSpaceTheme, applyUIThemeTokens, authClient, canAutoLoadPagedResource, clampPagedResourceItems, clearAuthToken, clearDeepSpaceTheme, clientBuild, createDecoder, createEncoder, decodeAiStreamChunk, deriveLoadState, detectEnvironment, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, formatBytes, formatFileSize, getApiUrl, getAuthToken, getAuthUrl, getDeepSpaceAIModel, getEnvironmentConfig, getMessageType, getPagedResourceCooldownMs, getPlatformWorkerUrl, getUserColor, handleAwarenessMessage, handleSyncMessage, hasContent, integration, isAnonymousUserId, isAsyncResourceSlow, isDarkColor, isImageFile, isLocalDev, isProduction, isWriterRole, listDeepSpaceAgentModels, logEventText, loggableError, parseSseLine, readThemeFromDOM, readVarUint, readVarUint8Array, resetEnvironmentCache, resolveDeepSpaceAgentModel, serverBuild, signIn, signOut, storageLimitForTier, toConnectionStatus, toUint8Array, truncateLogText, useAsyncResource, useAuth, useAuthProfileReady, useAuthStatus, useAuthUser, useCanvas, useChannelMembers, useChannels, useCheckout, useCronMonitor, useDisplayName, useIsDarkTheme, useJobs, useMessages, useMutations, usePagedResource, usePresence, usePresenceRoom, useQuery, useR2Files, useReactions, useReadReceipts, useRecordContext, useSession, useSubscription, useUser, useUserLookup, useUsers, useVoiceAgent, useYjsField, useYjsRoom, useYjsText, validateAppMigrationIds, writeVarUint, writeVarUint8Array };
4753
+ export { ACCOUNT_STORAGE_LIMIT_BYTES, ACTION_ROUTES_BEARER_GUARD_MIGRATION_ID, ACTION_TOOLS_DELETE_WHERE_MIGRATION_ID, AI_SDK_7_MIGRATION_ID, ANONYMOUS_USER_ID_PREFIX, APP_LOG_EVENT_KEYS, ASYNC_RESOURCE_DEFAULTS, type AdHocChargeOpts, type AiStreamAction, type AiStreamChunk, type ApiErrorIssue, type AppLogEvent, type AppLogEventKey, type AppLogsResponse, type AppMigrationIdsValidation, type AsyncResourceDefaults, type AsyncResourceState, type AsyncResourceStatus, AuthGate, type AuthGateProps, AuthOverlay, Awareness, type AwarenessState, type AwarenessStates, BUILD_INJECTED_APP_ID_MIGRATION_ID, type BaseMessage, type CanvasShapeClient, type Channel, type ChannelMember, type ChargeOnceOpts, type ChargeOnceResult, type ClientMessage, type CollectionSchema, type ConnectionAttachment, type ConnectionStatus, type CronHistoryEntry, type CronMutationResult, type CronTaskState, DEEPSPACE_AGENT_PROFILES, DEEPSPACE_AI_DEFAULTS, DEEPSPACE_AI_MODELS, DEEPSPACE_MODEL_CATALOG_PROVENANCE, DEEPSPACE_THEME_PROPERTIES, DEFAULT_USER_COLORS, type DeepSpaceAIModel, type DeepSpaceAIModelId, type DeepSpaceAIProvider, type DeepSpaceAgentProfile, type DeepSpaceAgentProfileId, type DeepSpaceAgentSupport, DeepSpaceAuthProvider, type DeepSpaceThemeConfig, DeepSpaceThemeProvider, type DeepSpaceThemeProviderProps, type DeriveLoadStateInput, ENV, type Environment, FILES_SESSION_COOKIE_READS_MIGRATION_ID, type FileAttachment, type GroupedReaction, GuestBanner, type HandlerContext, type IntegrationResponse, type JobStatusView, type JobView, LOG_LEVELS, type LoadState, type LoadStateAuthInput, type LoadStateStatusInput, type LogLevel, MAX_LOG_TEXT_LENGTH, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type Message, type MessageHandlers, type MsgType, type NormalizedApiError, type PagedResourceFetchArgs, type PagedResourcePage, type PagedResourceState, type PagedResourceStatus, type PlanInfo, PlatformApiError, type PresencePeerClient, PricingTable, type PricingTablePlan, type PricingTablePrice, type ProductChargeOpts, type ProtocolMessage, type Purchase, type Query, type R2FileInfo, type R2FileListPage, type R2Scope, type R2UploadResult, RECORD_NOT_FOUND, ROLES, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_CONFIG, ROLE_DEFAULT, type Reaction, type ReadReceipt, type RecordData, RecordProvider, type RecordProviderProps, RecordRoomNotReadyError, RecordScope, type RequestOptions, type ResolvedDeepSpaceAgentModel, type Role, type RoomUser, SECURE_ROOM_BOUNDARIES_MIGRATION_ID, type ScopeEntry, ScopeRegistryProvider, type ServerMessage, SignedIn, SignedOut, type SubscribeOpts, type SubscribeResult, type SubscriptionState, type SubscriptionStatus, type SyncResult, type UseAsyncResourceOptions, type UseAuthProfileReadyOptions, type UseAuthStatusOptions, type UseCanvasResult, type UseCheckoutOpts, type UseCronMonitorResult, type UseJobsResult, type UsePagedResourceOptions, type UsePresenceRoomResult, type UseR2FilesReturn, type UseVoiceAgentOptions, type UseVoiceAgentResult, type UseYjsFieldResult, type UseYjsRoomResult, type UseYjsTextResult, type User, type UserCredits, type UserInfo, type UserKarma, type UserProfile, type ViewportClient, type VoiceStatus, type VoiceTranscriptEntry, WORKER_OWNED_NOT_FOUND_MIGRATION_ID, type WriteError, applyDeepSpaceTheme, applyUIThemeTokens, authClient, canAutoLoadPagedResource, clampPagedResourceItems, clearAuthToken, clearDeepSpaceTheme, clientBuild, createDecoder, createEncoder, decodeAiStreamChunk, deriveLoadState, detectEnvironment, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, formatBytes, formatFileSize, getApiUrl, getAuthToken, getAuthUrl, getDeepSpaceAIModel, getEnvironmentConfig, getMessageType, getPagedResourceCooldownMs, getPlatformWorkerUrl, getUserColor, handleAwarenessMessage, handleSyncMessage, hasContent, integration, isAnonymousUserId, isAsyncResourceSlow, isDarkColor, isImageFile, isLocalDev, isProduction, isWriterRole, listDeepSpaceAgentModels, logEventText, loggableError, parseSseLine, readThemeFromDOM, readVarUint, readVarUint8Array, resetEnvironmentCache, resolveDeepSpaceAgentModel, serverBuild, signIn, signOut, storageLimitForTier, toConnectionStatus, toUint8Array, truncateLogText, useAsyncResource, useAuth, useAuthProfileReady, useAuthStatus, useAuthUser, useCanvas, useChannelMembers, useChannels, useCheckout, useCronMonitor, useDisplayName, useIsDarkTheme, useJobs, useMessages, useMutations, usePagedResource, usePresence, usePresenceRoom, useQuery, useR2Files, useReactions, useReadReceipts, useRecordContext, useSession, useSubscription, useUser, useUserLookup, useUsers, useVoiceAgent, useYjsField, useYjsRoom, useYjsText, validateAppMigrationIds, writeVarUint, writeVarUint8Array };