deepspace 0.33.0 → 0.34.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 +41 -0
- package/README.md +5 -1
- package/dist/build.js.map +1 -1
- package/dist/{chunk-BRES7ZWJ.js → chunk-KELQ7OD5.js} +2 -2
- package/dist/{chunk-BRES7ZWJ.js.map → chunk-KELQ7OD5.js.map} +1 -1
- package/dist/{chunk-PIYDVPUE.js → chunk-SINBB5BQ.js} +2 -2
- package/dist/{chunk-PIYDVPUE.js.map → chunk-SINBB5BQ.js.map} +1 -1
- package/dist/cli.js +74 -15
- package/dist/cli.js.map +1 -1
- package/dist/documentation-client-core.js +1 -1
- package/dist/documentation-default-renderer.cjs +1 -1
- package/dist/documentation-react.js +1 -1
- package/dist/documentation-runtime.js +10 -10
- package/dist/documentation-server-core.js +1 -1
- package/dist/documentation.js +47 -22
- package/dist/documentation.js.map +1 -1
- package/dist/expo.d.ts +73 -0
- package/dist/expo.js +233 -0
- package/dist/expo.js.map +1 -0
- package/dist/index.d.ts +105 -22
- package/dist/index.js +50 -23
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +205 -37
- package/dist/server.js +290 -97
- package/dist/server.js.map +1 -1
- package/dist/worker.d.ts +312 -48
- package/dist/worker.js +499 -110
- package/dist/worker.js.map +1 -1
- package/features/documents/feature.json +15 -0
- package/features/documents/src/DocumentsListPage.tsx +22 -8
- package/features/documents/src/InviteDialog.tsx +63 -42
- package/features/documents/src/__tests__/documents-find-invitee-action.test.ts +131 -0
- package/features/documents/src/__tests__/documents-invitee-lookup.test.ts +67 -0
- package/features/documents/src/documents-find-invitee-action.ts +56 -0
- package/features/documents/src/documents-invitee-lookup.ts +38 -0
- package/features/documents/src/documents-ui.css +10 -0
- package/package.json +28 -8
package/dist/expo.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
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://veriluma.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
|
+
declare function createDeepSpaceExpoClient(options: DeepSpaceExpoClientOptions): DeepSpaceExpoClient;
|
|
49
|
+
declare class DeepSpaceExpoClient {
|
|
50
|
+
private readonly baseUrl;
|
|
51
|
+
private readonly redirectUri;
|
|
52
|
+
private readonly storage;
|
|
53
|
+
private readonly storageKey;
|
|
54
|
+
private readonly paths;
|
|
55
|
+
private readonly fetcher;
|
|
56
|
+
private readonly timeoutMs;
|
|
57
|
+
private session;
|
|
58
|
+
constructor(options: DeepSpaceExpoClientOptions);
|
|
59
|
+
getSession(): Promise<DeepSpaceExpoSession | null>;
|
|
60
|
+
signIn(provider?: ExpoAuthProvider, state?: string): Promise<DeepSpaceExpoUser>;
|
|
61
|
+
signInWithGoogle(state?: string): Promise<DeepSpaceExpoUser>;
|
|
62
|
+
refresh(): Promise<string | null>;
|
|
63
|
+
getAuthToken(): Promise<string | null>;
|
|
64
|
+
me(): Promise<DeepSpaceExpoUser>;
|
|
65
|
+
request<T>(path: string, init?: RequestInit, retried?: boolean): Promise<T>;
|
|
66
|
+
signOut(): Promise<void>;
|
|
67
|
+
private json;
|
|
68
|
+
private saveSession;
|
|
69
|
+
private clearSession;
|
|
70
|
+
private fetchWithTimeout;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { DeepSpaceExpoClient, type DeepSpaceExpoClientOptions, DeepSpaceExpoError, type DeepSpaceExpoSession, type DeepSpaceExpoUser, type ExpoAuthPaths, type ExpoAuthProvider, type ExpoAuthStorage, buildExpoOAuthStartUrl, codeFromExpoRedirect, createDeepSpaceExpoClient, normalizeExpoBaseUrl, stateFromExpoRedirect };
|
package/dist/expo.js
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
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 DEFAULT_PATHS = {
|
|
49
|
+
start: "/api/auth/native-start",
|
|
50
|
+
exchange: "/api/auth/native-exchange",
|
|
51
|
+
token: "/api/auth/native-token",
|
|
52
|
+
me: "/api/auth/native-me",
|
|
53
|
+
signOut: "/api/auth/native-signout"
|
|
54
|
+
};
|
|
55
|
+
var defaultStorage = {
|
|
56
|
+
getItem: (key) => SecureStore.getItemAsync(key),
|
|
57
|
+
setItem: (key, value) => SecureStore.setItemAsync(key, value),
|
|
58
|
+
deleteItem: (key) => SecureStore.deleteItemAsync(key)
|
|
59
|
+
};
|
|
60
|
+
function createDeepSpaceExpoClient(options) {
|
|
61
|
+
return new DeepSpaceExpoClient(options);
|
|
62
|
+
}
|
|
63
|
+
var DeepSpaceExpoClient = class {
|
|
64
|
+
baseUrl;
|
|
65
|
+
redirectUri;
|
|
66
|
+
storage;
|
|
67
|
+
storageKey;
|
|
68
|
+
paths;
|
|
69
|
+
fetcher;
|
|
70
|
+
timeoutMs;
|
|
71
|
+
session;
|
|
72
|
+
constructor(options) {
|
|
73
|
+
if (!options.baseUrl) throw new Error("DeepSpace Expo client requires baseUrl");
|
|
74
|
+
this.baseUrl = normalizeExpoBaseUrl(options.baseUrl);
|
|
75
|
+
this.redirectUri = options.redirectUri ?? Linking.createURL("auth/callback");
|
|
76
|
+
this.storage = options.storage ?? defaultStorage;
|
|
77
|
+
this.storageKey = options.storageKey ?? `deepspace.session.${encodeURIComponent(this.baseUrl)}`;
|
|
78
|
+
this.paths = { ...DEFAULT_PATHS, ...options.paths };
|
|
79
|
+
this.fetcher = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
80
|
+
this.timeoutMs = options.timeoutMs ?? 15e3;
|
|
81
|
+
}
|
|
82
|
+
async getSession() {
|
|
83
|
+
if (this.session !== void 0) return this.session;
|
|
84
|
+
const raw = await this.storage.getItem(this.storageKey);
|
|
85
|
+
if (!raw) return this.session = null;
|
|
86
|
+
try {
|
|
87
|
+
const value = JSON.parse(raw);
|
|
88
|
+
if (typeof value.sessionToken !== "string" || typeof value.accessToken !== "string") throw new Error("invalid session");
|
|
89
|
+
return this.session = value;
|
|
90
|
+
} catch {
|
|
91
|
+
await this.storage.deleteItem(this.storageKey);
|
|
92
|
+
return this.session = null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async signIn(provider = "google", state) {
|
|
96
|
+
const expectedState = state ?? createOAuthState();
|
|
97
|
+
const codeVerifier = createCodeVerifier();
|
|
98
|
+
const codeChallenge = await createCodeChallenge(codeVerifier);
|
|
99
|
+
const startUrl = buildExpoOAuthStartUrl(
|
|
100
|
+
this.baseUrl,
|
|
101
|
+
provider,
|
|
102
|
+
this.redirectUri,
|
|
103
|
+
expectedState,
|
|
104
|
+
this.paths.start,
|
|
105
|
+
codeChallenge
|
|
106
|
+
);
|
|
107
|
+
const result = await WebBrowser.openAuthSessionAsync(startUrl, this.redirectUri);
|
|
108
|
+
if (result.type !== "success" || !result.url) throw new Error("DeepSpace sign-in was cancelled");
|
|
109
|
+
const code = codeFromExpoRedirect(result.url);
|
|
110
|
+
if (!code) throw new Error("DeepSpace sign-in returned no exchange code");
|
|
111
|
+
if (stateFromExpoRedirect(result.url) !== expectedState) {
|
|
112
|
+
throw new Error("DeepSpace sign-in returned an invalid state");
|
|
113
|
+
}
|
|
114
|
+
const session = await this.json(this.paths.exchange, {
|
|
115
|
+
method: "POST",
|
|
116
|
+
body: JSON.stringify({ code, code_verifier: codeVerifier })
|
|
117
|
+
});
|
|
118
|
+
await this.saveSession(session);
|
|
119
|
+
return this.me();
|
|
120
|
+
}
|
|
121
|
+
signInWithGoogle(state) {
|
|
122
|
+
return this.signIn("google", state);
|
|
123
|
+
}
|
|
124
|
+
async refresh() {
|
|
125
|
+
const session = await this.getSession();
|
|
126
|
+
if (!session) return null;
|
|
127
|
+
try {
|
|
128
|
+
const next = await this.json(this.paths.token, { method: "POST", body: JSON.stringify({ sessionToken: session.sessionToken }) });
|
|
129
|
+
const accessToken = next.accessToken ?? next.token;
|
|
130
|
+
if (!accessToken) throw new Error("DeepSpace did not issue an access token");
|
|
131
|
+
await this.saveSession({ ...session, accessToken });
|
|
132
|
+
return accessToken;
|
|
133
|
+
} catch (error) {
|
|
134
|
+
if (error instanceof DeepSpaceExpoError && error.status === 401) await this.clearSession();
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async getAuthToken() {
|
|
139
|
+
const session = await this.getSession();
|
|
140
|
+
return session?.accessToken || await this.refresh();
|
|
141
|
+
}
|
|
142
|
+
async me() {
|
|
143
|
+
const result = await this.request(this.paths.me);
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
async request(path, init = {}, retried = false) {
|
|
147
|
+
const token = await this.getAuthToken();
|
|
148
|
+
const headers = new Headers(init.headers);
|
|
149
|
+
if (!headers.has("Content-Type") && init.body != null && isJsonBody(init.body)) {
|
|
150
|
+
headers.set("Content-Type", "application/json");
|
|
151
|
+
}
|
|
152
|
+
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
153
|
+
const response = await this.fetchWithTimeout(`${this.baseUrl}${path}`, { ...init, headers });
|
|
154
|
+
const body = await response.json().catch(() => ({}));
|
|
155
|
+
if (response.status === 401 && !retried && isReplayableBody(init.body) && (await this.getSession())?.sessionToken) {
|
|
156
|
+
const refreshed = await this.refresh();
|
|
157
|
+
if (refreshed) return this.request(path, init, true);
|
|
158
|
+
}
|
|
159
|
+
if (!response.ok) throw new DeepSpaceExpoError(typeof body.error === "string" ? body.error : `DeepSpace request failed (${response.status})`, response.status, body);
|
|
160
|
+
return body;
|
|
161
|
+
}
|
|
162
|
+
async signOut() {
|
|
163
|
+
const session = await this.getSession();
|
|
164
|
+
if (session) {
|
|
165
|
+
await this.fetchWithTimeout(`${this.baseUrl}${this.paths.signOut}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ sessionToken: session.sessionToken }) }).catch(() => void 0);
|
|
166
|
+
}
|
|
167
|
+
await this.clearSession();
|
|
168
|
+
}
|
|
169
|
+
async json(path, init) {
|
|
170
|
+
const response = await this.fetchWithTimeout(`${this.baseUrl}${path}`, { ...init, headers: { "Content-Type": "application/json", ...init.headers ?? {} } });
|
|
171
|
+
const body = await response.json().catch(() => ({}));
|
|
172
|
+
if (!response.ok) throw new DeepSpaceExpoError(typeof body.error === "string" ? body.error : `DeepSpace auth failed (${response.status})`, response.status, body);
|
|
173
|
+
return body;
|
|
174
|
+
}
|
|
175
|
+
async saveSession(session) {
|
|
176
|
+
this.session = session;
|
|
177
|
+
await this.storage.setItem(this.storageKey, JSON.stringify(session));
|
|
178
|
+
}
|
|
179
|
+
async clearSession() {
|
|
180
|
+
this.session = null;
|
|
181
|
+
await this.storage.deleteItem(this.storageKey);
|
|
182
|
+
}
|
|
183
|
+
async fetchWithTimeout(input, init = {}) {
|
|
184
|
+
if (!this.timeoutMs || this.timeoutMs <= 0) return this.fetcher(input, init);
|
|
185
|
+
const controller = new AbortController();
|
|
186
|
+
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
187
|
+
const signal = init.signal;
|
|
188
|
+
if (signal) {
|
|
189
|
+
if (signal.aborted) controller.abort();
|
|
190
|
+
else signal.addEventListener("abort", () => controller.abort(), { once: true });
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
return await this.fetcher(input, { ...init, signal: controller.signal });
|
|
194
|
+
} finally {
|
|
195
|
+
clearTimeout(timer);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
function createOAuthState() {
|
|
200
|
+
return Crypto.randomUUID();
|
|
201
|
+
}
|
|
202
|
+
function createCodeVerifier() {
|
|
203
|
+
return `${Crypto.randomUUID().replaceAll("-", "")}${Crypto.randomUUID().replaceAll("-", "")}`;
|
|
204
|
+
}
|
|
205
|
+
async function createCodeChallenge(verifier) {
|
|
206
|
+
const digest = await Crypto.digestStringAsync(
|
|
207
|
+
Crypto.CryptoDigestAlgorithm.SHA256,
|
|
208
|
+
verifier,
|
|
209
|
+
{ encoding: Crypto.CryptoEncoding.BASE64 }
|
|
210
|
+
);
|
|
211
|
+
return digest.replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
212
|
+
}
|
|
213
|
+
function isJsonBody(body) {
|
|
214
|
+
return typeof body === "string";
|
|
215
|
+
}
|
|
216
|
+
function isReplayableBody(body) {
|
|
217
|
+
if (body == null || typeof body === "string") return true;
|
|
218
|
+
if (typeof FormData !== "undefined" && body instanceof FormData) return true;
|
|
219
|
+
if (typeof URLSearchParams !== "undefined" && body instanceof URLSearchParams) return true;
|
|
220
|
+
if (typeof Blob !== "undefined" && body instanceof Blob) return true;
|
|
221
|
+
if (body instanceof ArrayBuffer || ArrayBuffer.isView(body)) return true;
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
export {
|
|
225
|
+
DeepSpaceExpoClient,
|
|
226
|
+
DeepSpaceExpoError,
|
|
227
|
+
buildExpoOAuthStartUrl,
|
|
228
|
+
codeFromExpoRedirect,
|
|
229
|
+
createDeepSpaceExpoClient,
|
|
230
|
+
normalizeExpoBaseUrl,
|
|
231
|
+
stateFromExpoRedirect
|
|
232
|
+
};
|
|
233
|
+
//# sourceMappingURL=expo.js.map
|
package/dist/expo.js.map
ADDED
|
@@ -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://veriluma.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\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 !== 'success' || !result.url) throw new Error('DeepSpace sign-in was cancelled')\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;AA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,EAAE;AAC3E;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
|
@@ -229,6 +229,11 @@ interface DeepSpaceAIModel {
|
|
|
229
229
|
transport: 'messages' | 'chat-completions';
|
|
230
230
|
recommendation: 'frontier' | 'balanced' | 'fast' | 'available' | 'limited';
|
|
231
231
|
note?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Superseded: still resolvable by id, so an app that saved it keeps working,
|
|
234
|
+
* but left out of pickers and model lists.
|
|
235
|
+
*/
|
|
236
|
+
legacy?: true;
|
|
232
237
|
}
|
|
233
238
|
interface DeepSpaceAgentProfile {
|
|
234
239
|
id: DeepSpaceAgentProfileId;
|
|
@@ -244,8 +249,8 @@ interface DeepSpaceAgentProfile {
|
|
|
244
249
|
* deployed app underneath a commit.
|
|
245
250
|
*/
|
|
246
251
|
declare const DEEPSPACE_MODEL_CATALOG_PROVENANCE: {
|
|
247
|
-
readonly version: "2026-
|
|
248
|
-
readonly verifiedAt: "2026-
|
|
252
|
+
readonly version: "2026-09-24";
|
|
253
|
+
readonly verifiedAt: "2026-09-24";
|
|
249
254
|
readonly sources: {
|
|
250
255
|
readonly anthropic: "https://platform.claude.com/docs/en/api/beta/models/list";
|
|
251
256
|
readonly openai: "https://developers.openai.com/api/docs/models/all";
|
|
@@ -253,8 +258,8 @@ declare const DEEPSPACE_MODEL_CATALOG_PROVENANCE: {
|
|
|
253
258
|
};
|
|
254
259
|
};
|
|
255
260
|
declare const DEEPSPACE_AI_MODELS: readonly [{
|
|
256
|
-
readonly id: "claude-
|
|
257
|
-
readonly label: "Claude
|
|
261
|
+
readonly id: "claude-opus-5-5";
|
|
262
|
+
readonly label: "Claude Opus 5.5";
|
|
258
263
|
readonly family: "Claude 5";
|
|
259
264
|
readonly recommendation: "frontier";
|
|
260
265
|
} & {
|
|
@@ -265,8 +270,8 @@ declare const DEEPSPACE_AI_MODELS: readonly [{
|
|
|
265
270
|
agentSupport: "multi-step";
|
|
266
271
|
agentProfiles: readonly ["application", "documentation"];
|
|
267
272
|
}, {
|
|
268
|
-
readonly id: "claude-
|
|
269
|
-
readonly label: "Claude
|
|
273
|
+
readonly id: "claude-fable-5-1";
|
|
274
|
+
readonly label: "Claude Fable 5.1";
|
|
270
275
|
readonly family: "Claude 5";
|
|
271
276
|
readonly recommendation: "frontier";
|
|
272
277
|
} & {
|
|
@@ -300,11 +305,95 @@ declare const DEEPSPACE_AI_MODELS: readonly [{
|
|
|
300
305
|
} & {
|
|
301
306
|
agentSupport: "multi-step";
|
|
302
307
|
agentProfiles: readonly ["application", "documentation"];
|
|
308
|
+
}, {
|
|
309
|
+
readonly id: "gpt-6-sol";
|
|
310
|
+
readonly label: "GPT-6 Sol";
|
|
311
|
+
readonly family: "GPT-6";
|
|
312
|
+
readonly recommendation: "balanced";
|
|
313
|
+
} & {
|
|
314
|
+
readonly provider: "openai";
|
|
315
|
+
readonly providerLabel: "OpenAI";
|
|
316
|
+
readonly transport: "chat-completions";
|
|
317
|
+
} & {
|
|
318
|
+
agentSupport: "multi-step";
|
|
319
|
+
agentProfiles: readonly ["application", "documentation"];
|
|
320
|
+
}, {
|
|
321
|
+
readonly id: "gpt-6-luna";
|
|
322
|
+
readonly label: "GPT-6 Luna";
|
|
323
|
+
readonly family: "GPT-6";
|
|
324
|
+
readonly recommendation: "fast";
|
|
325
|
+
} & {
|
|
326
|
+
readonly provider: "openai";
|
|
327
|
+
readonly providerLabel: "OpenAI";
|
|
328
|
+
readonly transport: "chat-completions";
|
|
329
|
+
} & {
|
|
330
|
+
agentSupport: "multi-step";
|
|
331
|
+
agentProfiles: readonly ["application", "documentation"];
|
|
332
|
+
}, {
|
|
333
|
+
readonly id: "gpt-6-astra";
|
|
334
|
+
readonly label: "GPT-6 Astra";
|
|
335
|
+
readonly provider: "openai";
|
|
336
|
+
readonly providerLabel: "OpenAI";
|
|
337
|
+
readonly family: "GPT-6";
|
|
338
|
+
readonly agentSupport: "none";
|
|
339
|
+
readonly agentProfiles: readonly [];
|
|
340
|
+
readonly transport: "chat-completions";
|
|
341
|
+
readonly recommendation: "limited";
|
|
342
|
+
readonly note: "Available for direct generation; its tool calling requires the Responses API, which the DeepSpace proxy does not serve.";
|
|
343
|
+
}, {
|
|
344
|
+
readonly id: "gpt-oss-120b";
|
|
345
|
+
readonly label: "GPT-OSS 120B";
|
|
346
|
+
readonly provider: "cerebras";
|
|
347
|
+
readonly providerLabel: "Cerebras";
|
|
348
|
+
readonly family: "GPT-OSS";
|
|
349
|
+
readonly agentSupport: "single-step";
|
|
350
|
+
readonly agentProfiles: readonly [];
|
|
351
|
+
readonly transport: "chat-completions";
|
|
352
|
+
readonly recommendation: "limited";
|
|
353
|
+
readonly note: "Available for direct generation; the current proxy adapter has not passed multi-step tool-result continuation.";
|
|
354
|
+
}, {
|
|
355
|
+
readonly id: "qwen-3.8-27b";
|
|
356
|
+
readonly label: "Qwen 3.8 27B";
|
|
357
|
+
readonly provider: "cerebras";
|
|
358
|
+
readonly providerLabel: "Cerebras";
|
|
359
|
+
readonly family: "Qwen 3.8";
|
|
360
|
+
readonly agentSupport: "single-step";
|
|
361
|
+
readonly agentProfiles: readonly [];
|
|
362
|
+
readonly transport: "chat-completions";
|
|
363
|
+
readonly recommendation: "limited";
|
|
364
|
+
readonly note: "Available for direct generation; the current proxy adapter has not passed multi-step tool-result continuation.";
|
|
365
|
+
}, {
|
|
366
|
+
readonly id: "claude-opus-5";
|
|
367
|
+
readonly label: "Claude Opus 5";
|
|
368
|
+
readonly family: "Claude 5";
|
|
369
|
+
readonly recommendation: "frontier";
|
|
370
|
+
readonly legacy: true;
|
|
371
|
+
} & {
|
|
372
|
+
readonly provider: "anthropic";
|
|
373
|
+
readonly providerLabel: "Anthropic";
|
|
374
|
+
readonly transport: "messages";
|
|
375
|
+
} & {
|
|
376
|
+
agentSupport: "multi-step";
|
|
377
|
+
agentProfiles: readonly ["application", "documentation"];
|
|
378
|
+
}, {
|
|
379
|
+
readonly id: "claude-fable-5";
|
|
380
|
+
readonly label: "Claude Fable 5";
|
|
381
|
+
readonly family: "Claude 5";
|
|
382
|
+
readonly recommendation: "frontier";
|
|
383
|
+
readonly legacy: true;
|
|
384
|
+
} & {
|
|
385
|
+
readonly provider: "anthropic";
|
|
386
|
+
readonly providerLabel: "Anthropic";
|
|
387
|
+
readonly transport: "messages";
|
|
388
|
+
} & {
|
|
389
|
+
agentSupport: "multi-step";
|
|
390
|
+
agentProfiles: readonly ["application", "documentation"];
|
|
303
391
|
}, {
|
|
304
392
|
readonly id: "gpt-5.6-sol";
|
|
305
393
|
readonly label: "GPT-5.6 Sol";
|
|
306
394
|
readonly family: "GPT-5.6";
|
|
307
395
|
readonly recommendation: "frontier";
|
|
396
|
+
readonly legacy: true;
|
|
308
397
|
} & {
|
|
309
398
|
readonly provider: "openai";
|
|
310
399
|
readonly providerLabel: "OpenAI";
|
|
@@ -317,6 +406,7 @@ declare const DEEPSPACE_AI_MODELS: readonly [{
|
|
|
317
406
|
readonly label: "GPT-5.6 Terra";
|
|
318
407
|
readonly family: "GPT-5.6";
|
|
319
408
|
readonly recommendation: "balanced";
|
|
409
|
+
readonly legacy: true;
|
|
320
410
|
} & {
|
|
321
411
|
readonly provider: "openai";
|
|
322
412
|
readonly providerLabel: "OpenAI";
|
|
@@ -329,6 +419,7 @@ declare const DEEPSPACE_AI_MODELS: readonly [{
|
|
|
329
419
|
readonly label: "GPT-5.6 Luna";
|
|
330
420
|
readonly family: "GPT-5.6";
|
|
331
421
|
readonly recommendation: "fast";
|
|
422
|
+
readonly legacy: true;
|
|
332
423
|
} & {
|
|
333
424
|
readonly provider: "openai";
|
|
334
425
|
readonly providerLabel: "OpenAI";
|
|
@@ -336,34 +427,23 @@ declare const DEEPSPACE_AI_MODELS: readonly [{
|
|
|
336
427
|
} & {
|
|
337
428
|
agentSupport: "multi-step";
|
|
338
429
|
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
430
|
}];
|
|
351
431
|
declare const DEEPSPACE_AI_DEFAULTS: {
|
|
352
|
-
readonly agent: "claude-
|
|
353
|
-
readonly directGeneration: "claude-
|
|
432
|
+
readonly agent: "claude-opus-5-5";
|
|
433
|
+
readonly directGeneration: "claude-opus-5-5";
|
|
354
434
|
readonly summarization: "claude-haiku-4-5";
|
|
355
435
|
};
|
|
356
436
|
declare const DEEPSPACE_AGENT_PROFILES: {
|
|
357
437
|
readonly application: {
|
|
358
438
|
readonly id: "application";
|
|
359
|
-
readonly defaultModel: "claude-
|
|
439
|
+
readonly defaultModel: "claude-opus-5-5";
|
|
360
440
|
readonly maxSteps: 21;
|
|
361
441
|
readonly maxToolCalls: 20;
|
|
362
442
|
readonly allowedTools: "application-defined";
|
|
363
443
|
};
|
|
364
444
|
readonly documentation: {
|
|
365
445
|
readonly id: "documentation";
|
|
366
|
-
readonly defaultModel: "claude-
|
|
446
|
+
readonly defaultModel: "claude-opus-5-5";
|
|
367
447
|
readonly maxSteps: 21;
|
|
368
448
|
readonly maxToolCalls: 20;
|
|
369
449
|
readonly allowedTools: readonly ["documentation_search", "documentation_read"];
|
|
@@ -1375,6 +1455,9 @@ declare const ACTION_ROUTES_BEARER_GUARD_MIGRATION_ID = "2026-08-action-routes-b
|
|
|
1375
1455
|
* `<audio>`, or `<video>` load) by the app-origin session cookie, so private
|
|
1376
1456
|
* file URLs render for the signed-in user without tokens or signed URLs. */
|
|
1377
1457
|
declare const FILES_SESSION_COOKIE_READS_MIGRATION_ID = "2026-09-files-session-cookie-reads";
|
|
1458
|
+
/** The SDK moved to AI SDK 7 (`ai` 7, `@ai-sdk/anthropic` 4). Apps pin their
|
|
1459
|
+
* own `ai`, and their chat route persists and streams through its API. */
|
|
1460
|
+
declare const AI_SDK_7_MIGRATION_ID = "2026-09-ai-sdk-7";
|
|
1378
1461
|
type AppMigrationIdsValidation = {
|
|
1379
1462
|
valid: true;
|
|
1380
1463
|
ids: string[];
|
|
@@ -4663,4 +4746,4 @@ declare const ACCOUNT_STORAGE_LIMIT_BYTES: {
|
|
|
4663
4746
|
declare function storageLimitForTier(tier: string | null | undefined): number;
|
|
4664
4747
|
declare function formatBytes(bytes: number): string;
|
|
4665
4748
|
|
|
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 };
|
|
4749
|
+
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 };
|