deepspace 0.36.0 → 0.37.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 +6 -0
- package/dist/{chunk-C6TBE6C4.js → chunk-2CXYYP3K.js} +2 -2
- package/dist/{chunk-C6TBE6C4.js.map → chunk-2CXYYP3K.js.map} +1 -1
- package/dist/cli.js +1 -1
- 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 +1 -1
- package/dist/documentation-server-core.js +1 -1
- package/dist/documentation.js +1 -1
- package/dist/documentation.js.map +1 -1
- package/dist/expo.d.ts +22 -1
- package/dist/expo.js +20 -0
- package/dist/expo.js.map +1 -1
- package/dist/server.d.ts +12 -0
- package/dist/server.js +18 -3
- package/dist/server.js.map +1 -1
- package/dist/worker.d.ts +24 -1
- package/dist/worker.js +70 -5
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/worker.d.ts
CHANGED
|
@@ -4479,6 +4479,18 @@ interface DeepSpaceAuthConfig {
|
|
|
4479
4479
|
keyId: string;
|
|
4480
4480
|
privateKey: string;
|
|
4481
4481
|
};
|
|
4482
|
+
/**
|
|
4483
|
+
* Extra OAuth client ids whose ID tokens may sign in through Better Auth's
|
|
4484
|
+
* `POST /sign-in/social` `{ provider, idToken }`: a native app's own Google
|
|
4485
|
+
* iOS/web client ids, or its iOS bundle id for Sign in with Apple. Tokens
|
|
4486
|
+
* are still checked for Google's or Apple's signature, issuer and expiry.
|
|
4487
|
+
* A provider listed here without its web credentials above accepts ID
|
|
4488
|
+
* tokens only; it can't start a browser sign-in.
|
|
4489
|
+
*/
|
|
4490
|
+
nativeIdTokenAudiences?: {
|
|
4491
|
+
google?: string[];
|
|
4492
|
+
apple?: string[];
|
|
4493
|
+
};
|
|
4482
4494
|
/** Enable email/password authentication */
|
|
4483
4495
|
emailAndPassword?: boolean;
|
|
4484
4496
|
/** Trusted origins for CORS */
|
|
@@ -5645,6 +5657,17 @@ interface ExpoAuthBridgeOptions {
|
|
|
5645
5657
|
declare function nativeAuthStart(request: Request, env: ExpoAuthWorkerEnv, options?: ExpoAuthBridgeOptions): Response;
|
|
5646
5658
|
declare function nativeAuthCallback(request: Request, _env: ExpoAuthWorkerEnv, options?: ExpoAuthBridgeOptions): Response;
|
|
5647
5659
|
declare function nativeAuthExchange(request: Request, env: ExpoAuthWorkerEnv): Promise<Response>;
|
|
5660
|
+
/**
|
|
5661
|
+
* Native sign-in with the platform's own Google or Apple SDK. The app sends
|
|
5662
|
+
* the ID token it received; the auth worker checks the token's signature,
|
|
5663
|
+
* issuer, expiry and audience (one of the plane's configured native client
|
|
5664
|
+
* ids) and accepts each token only once. A nonce, when the app sends one, is
|
|
5665
|
+
* checked against the token too, but it isn't a replay defense: the app
|
|
5666
|
+
* chooses it. Returns the same `{ sessionToken, accessToken }` as
|
|
5667
|
+
* `nativeAuthExchange`. Apple only shares a person's name on their first
|
|
5668
|
+
* sign-in, so the app may pass it along as `user.name`.
|
|
5669
|
+
*/
|
|
5670
|
+
declare function nativeAuthIdToken(request: Request, env: ExpoAuthWorkerEnv): Promise<Response>;
|
|
5648
5671
|
declare function nativeAuthToken(request: Request, env: ExpoAuthWorkerEnv): Promise<Response>;
|
|
5649
5672
|
declare function nativeAuthMe(request: Request, env: ExpoAuthWorkerEnv): Promise<Response>;
|
|
5650
5673
|
declare function nativeAuthSignOut(request: Request, env: ExpoAuthWorkerEnv): Promise<Response>;
|
|
@@ -5805,4 +5828,4 @@ declare const MAX_LOG_TEXT_LENGTH: number;
|
|
|
5805
5828
|
*/
|
|
5806
5829
|
declare function workerErrorHandler(prefix: string, respond?: (c: Context) => Response): ErrorHandler;
|
|
5807
5830
|
|
|
5808
|
-
export { ACCOUNT_STORAGE_LIMIT_BYTES, ACTION_ROUTES_BEARER_GUARD_MIGRATION_ID, ACTION_TOOLS_DELETE_WHERE_MIGRATION_ID, AGENT_TOKEN_SCOPE, AGENT_TOOL_REQUEST_BODY_CAP, AGENT_TOOL_RESPONSE_BODY_CAP, AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, AI_SDK_7_MIGRATION_ID, ALLOWED_BINDING_TYPES, ANONYMOUS_USER_ID_PREFIX, APP_ID_RE, APP_LOG_EVENT_KEYS, APP_NAME_RULES, ASSET_NOT_FOUND_HANDLING_VALUES, AUTO_PROVISIONABLE_TYPES, AUTO_PROVISION_SENTINEL, type ActionContext, type ActionHandler, type ActionResult, type ActionTools, type AgentTargetPolicy, type AgentToolAccessResult, type AgentToolRouteEnv, type AgentToolRouteOptions, type ApiErrorIssue, type ApiWorkerEnv, type AppLogEvent, type AppLogEventKey, type AppLogsResponse, type AppMembership, type AppMigrationIdsValidation, type AppNameResolution, type AppNameValidation, type AssetNotFoundHandling, type AuthWorkerEnv, Awareness, type AwarenessState, type AwarenessStates, BASE_USERS_SCHEMA, BROWSER_PROXY_ROUTES, BUILD_INJECTED_APP_ID_MIGRATION_ID, BUILT_IN_TOOLS, type BaseMessage, BaseRoom, type BindingJsonValue, BodyTooLargeError, CHANNELS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, COST_RATES, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type ClientMessage, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ComposioToolsOptions, type ConnectionAttachment, type CronContext, type CronExecution, CronRoom, type CronRoomConfig, type CronTask, type CustomBinding, type CustomBindingManifest, DEEPSPACE_AGENT_PROFILES, DEEPSPACE_AI_DEFAULTS, DEEPSPACE_AI_MODELS, DEEPSPACE_MODEL_CATALOG_PROVENANCE, DEFAULT_CONTEXT_CONFIG, DEFAULT_DELETE_WHERE_LIMIT, DEFAULT_DO_MANIFEST, DEFAULT_QUERY_LIMIT, DEPLOYED_APPS_DEFAULTS, type DOBindings, type DOManifest, type DOManifestEntry, type DeepSpaceAIEnv, type DeepSpaceAIModel, type DeepSpaceAIModelId, type DeepSpaceAIOptions, type DeepSpaceAIProvider, type DeepSpaceAgentDiagnosticContext, DeepSpaceAgentModelError, type DeepSpaceAgentProfile, DeepSpaceAgentProfileError, type DeepSpaceAgentProfileId, type DeepSpaceAgentStream, type DeepSpaceAgentStreamOptions, type DeepSpaceAgentSupport, type DeepSpaceAuth, type DeepSpaceAuthConfig, type DeepSpaceDocumentationRouteEnv, type DeepSpaceDocumentationRouteOptions, type DeepSpaceUserCreateContext, type DoMigrationDirective, type DoMigrationPlan, type ExistingDOBinding, type ExpoAuthBridgeOptions, type ExpoAuthWorkerEnv, FILES_SESSION_COOKIE_READS_MIGRATION_ID, type GetActionData, type HandlerContext, type Job, type JobContext, JobRoom, type JobRoomConfig, type JobStatus, type JwtClaims, type JwtVerifierConfig, type KnowledgeAddOptions, type KnowledgeAddResult, type KnowledgeClient, type KnowledgeEnv, KnowledgeError, type KnowledgeItem, type KnowledgeListOptions, type KnowledgeListResult, type KnowledgeSearchChunk, type KnowledgeSearchOptions, type KnowledgeSearchResult, type KnowledgeStatus, LOG_LEVELS, type LogLevel, MAX_APP_FILE_BYTES, MAX_BINDING_NAME_LENGTH, MAX_DELETE_WHERE_LIMIT, MAX_DEPLOY_ASSET_FILE_BYTES, MAX_ENV_VAR_BYTES, MAX_LOG_TEXT_LENGTH, MAX_UPLOAD_PARTS, MAX_UPLOAD_REQUEST_BYTES, MESSAGES_SCHEMA, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type MessageHandlers, type MsgType, type MutateActionData, type NormalizedApiError, PLANES, PRODUCTION_OFFICIAL_AGENT_ORIGINS, type PermissionContext, type PermissionLevel, type PlaneName, type PlaneUrls, type PlatformWorkerEnv, type PrefixResult, type PresencePeer, PresenceRoom, type ProtocolMessage, type ProxyRoute, type QueryActionData, REACTIONS_SCHEMA, READ_RECEIPTS_SCHEMA, RECORD_NOT_FOUND, REGISTRY_INSTANCE, RELEASE_STAMP_PATH, REPO_STORE_LIMIT_BYTES, REQUIRED_COMPATIBILITY_FLAGS, RESERVED_BINDING_NAMES, RESERVED_RUN_WORKER_FIRST, RESOURCE_ID_RE, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_DEFAULT, RecordRoom, type RecordRoomConfig, RegistryClientError, type ResolvedColumn, type ResolvedDeepSpaceAgentModel, type RolePermissions, type RunMigrationsResult, SANDBOX_SCOPES, SANDBOX_SCOPE_HEADER, SDK_RUN_WORKER_FIRST, SECRET_NAME_RE, SECURE_ROOM_BOUNDARIES_MIGRATION_ID, SESSION_COOKIE, STRICT_APP_ID_RE, SYSTEM_ASSIGNED_COLUMNS, SYSTEM_COLLECTIONS, SYSTEM_MAINTAINED_COLUMNS, SYSTEM_MANAGED_COLUMNS, type SandboxFile, SandboxFileError, type SandboxFileList, type SandboxFilesClient, type SandboxFilesOptions, type SandboxScope, type SandboxUploadOptions, SchemaRegistry, type ScopeContext, type ScopedKnowledgeClient, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, type ScreenshotResult, type ServerMessage, type StorageAdmission, type StoredRecord, type Summarizer, type SyncResult, TEST_ACCOUNT_EMAIL_SUFFIX, type TokenDebugInfo, type ToolResult, type ToolSchema, UNDECLARED_ASSET_NOT_FOUND_HANDLING, UPLOAD_PART_BYTES, USERS_COLUMNS, type User, type UserAttachment, type UserToolExecutorEnv, type ValidationError, type VerifiedAuth, type VerifyOutcome, type VerifyResult, type Viewport, WORKER_OWNED_NOT_FOUND_MIGRATION_ID, YjsRoom, agentTokenIssuer, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, armCronRoom, authWorkerFetch, authenticatedRoomRequest, bindingManifestFromOutputConfig, buildCronContext, buildTableSelect, buildUiParts, callRegistry, callableFromSandbox, canCreate, canDelete, canRead, canUpdate, capToolResultSize, captureScreenshot, checkFieldPermissions, checkUnclaimedOwnerTransition, clientBuild, codeExecutionTool, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDecoder, createDeepSpaceAI, createDeepSpaceAuth, createEncoder, createScopedR2Handler, createUserToolExecutor, dataToColumnValues, decodeJwtPayload, deepSpaceAgentErrorSummary, deleteChatCascade, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, enqueueJob, epochSeconds, folderFilter, formatBytes, forwardSandboxContainer, getChat, getDeepSpaceAIModel, getMessageType, getRolePermissions, handleAwarenessMessage, handleSyncMessage, hasContent, isAnonymousUserId, isAssetNotFoundHandling, isAutoProvision, isFilesVerbPath, isOwner, isPlatformReservedPath, isRestrictedPlane, isTestAccountClaims, isTestAccountEmail, isTestAccountTier, knowledge, lintSchema, lintSchemaSet, lintSchemas, listDeepSpaceAgentModels, loadMessages, logEventText, loggableError, makeDefaultSummarizer, matchOrigin, meterAi, meterUsage, meterVectorize, mintAppId, mintUlid, nativeAuthCallback, nativeAuthExchange, nativeAuthMe, nativeAuthSignOut, nativeAuthStart, nativeAuthToken, noopPermissionContext, normalizeAgentTargetOrigin, normalizeApiError, normalizeKnowledgeFolder, parseQuotaLimit, platformCorsPatterns, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, readBoundedBodyText, readVarUint, readVarUint8Array, registerAgentToolRoutes, registerDeepSpaceDocumentation, registryErrorJson, registryStub, resolveAppMembership, resolveAppName, resolveAppRole, resolveColumn, resolveCompatibilityFlags, resolveDeepSpaceAgentModel, resolveSessionReadAuth, reuseSandbox, rowToData, runMigrations, sandboxFiles, sandboxOutputs, sandboxUpload, serverBuild, storageLimitForTier, storageQuotaMessage, streamDeepSpaceAgent, timingSafeEqualHex, timingSafeEqualStrings, toUint8Array, totalChars, truncateLogText, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppMigrationIds, validateAppName, validateBindingManifest, validateDoManifest, verifyAgentToken, verifyJwt, workerErrorHandler, writeVarUint, writeVarUint8Array };
|
|
5831
|
+
export { ACCOUNT_STORAGE_LIMIT_BYTES, ACTION_ROUTES_BEARER_GUARD_MIGRATION_ID, ACTION_TOOLS_DELETE_WHERE_MIGRATION_ID, AGENT_TOKEN_SCOPE, AGENT_TOOL_REQUEST_BODY_CAP, AGENT_TOOL_RESPONSE_BODY_CAP, AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, AI_SDK_7_MIGRATION_ID, ALLOWED_BINDING_TYPES, ANONYMOUS_USER_ID_PREFIX, APP_ID_RE, APP_LOG_EVENT_KEYS, APP_NAME_RULES, ASSET_NOT_FOUND_HANDLING_VALUES, AUTO_PROVISIONABLE_TYPES, AUTO_PROVISION_SENTINEL, type ActionContext, type ActionHandler, type ActionResult, type ActionTools, type AgentTargetPolicy, type AgentToolAccessResult, type AgentToolRouteEnv, type AgentToolRouteOptions, type ApiErrorIssue, type ApiWorkerEnv, type AppLogEvent, type AppLogEventKey, type AppLogsResponse, type AppMembership, type AppMigrationIdsValidation, type AppNameResolution, type AppNameValidation, type AssetNotFoundHandling, type AuthWorkerEnv, Awareness, type AwarenessState, type AwarenessStates, BASE_USERS_SCHEMA, BROWSER_PROXY_ROUTES, BUILD_INJECTED_APP_ID_MIGRATION_ID, BUILT_IN_TOOLS, type BaseMessage, BaseRoom, type BindingJsonValue, BodyTooLargeError, CHANNELS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, COST_RATES, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type ClientMessage, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ComposioToolsOptions, type ConnectionAttachment, type CronContext, type CronExecution, CronRoom, type CronRoomConfig, type CronTask, type CustomBinding, type CustomBindingManifest, DEEPSPACE_AGENT_PROFILES, DEEPSPACE_AI_DEFAULTS, DEEPSPACE_AI_MODELS, DEEPSPACE_MODEL_CATALOG_PROVENANCE, DEFAULT_CONTEXT_CONFIG, DEFAULT_DELETE_WHERE_LIMIT, DEFAULT_DO_MANIFEST, DEFAULT_QUERY_LIMIT, DEPLOYED_APPS_DEFAULTS, type DOBindings, type DOManifest, type DOManifestEntry, type DeepSpaceAIEnv, type DeepSpaceAIModel, type DeepSpaceAIModelId, type DeepSpaceAIOptions, type DeepSpaceAIProvider, type DeepSpaceAgentDiagnosticContext, DeepSpaceAgentModelError, type DeepSpaceAgentProfile, DeepSpaceAgentProfileError, type DeepSpaceAgentProfileId, type DeepSpaceAgentStream, type DeepSpaceAgentStreamOptions, type DeepSpaceAgentSupport, type DeepSpaceAuth, type DeepSpaceAuthConfig, type DeepSpaceDocumentationRouteEnv, type DeepSpaceDocumentationRouteOptions, type DeepSpaceUserCreateContext, type DoMigrationDirective, type DoMigrationPlan, type ExistingDOBinding, type ExpoAuthBridgeOptions, type ExpoAuthWorkerEnv, FILES_SESSION_COOKIE_READS_MIGRATION_ID, type GetActionData, type HandlerContext, type Job, type JobContext, JobRoom, type JobRoomConfig, type JobStatus, type JwtClaims, type JwtVerifierConfig, type KnowledgeAddOptions, type KnowledgeAddResult, type KnowledgeClient, type KnowledgeEnv, KnowledgeError, type KnowledgeItem, type KnowledgeListOptions, type KnowledgeListResult, type KnowledgeSearchChunk, type KnowledgeSearchOptions, type KnowledgeSearchResult, type KnowledgeStatus, LOG_LEVELS, type LogLevel, MAX_APP_FILE_BYTES, MAX_BINDING_NAME_LENGTH, MAX_DELETE_WHERE_LIMIT, MAX_DEPLOY_ASSET_FILE_BYTES, MAX_ENV_VAR_BYTES, MAX_LOG_TEXT_LENGTH, MAX_UPLOAD_PARTS, MAX_UPLOAD_REQUEST_BYTES, MESSAGES_SCHEMA, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type MessageHandlers, type MsgType, type MutateActionData, type NormalizedApiError, PLANES, PRODUCTION_OFFICIAL_AGENT_ORIGINS, type PermissionContext, type PermissionLevel, type PlaneName, type PlaneUrls, type PlatformWorkerEnv, type PrefixResult, type PresencePeer, PresenceRoom, type ProtocolMessage, type ProxyRoute, type QueryActionData, REACTIONS_SCHEMA, READ_RECEIPTS_SCHEMA, RECORD_NOT_FOUND, REGISTRY_INSTANCE, RELEASE_STAMP_PATH, REPO_STORE_LIMIT_BYTES, REQUIRED_COMPATIBILITY_FLAGS, RESERVED_BINDING_NAMES, RESERVED_RUN_WORKER_FIRST, RESOURCE_ID_RE, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_DEFAULT, RecordRoom, type RecordRoomConfig, RegistryClientError, type ResolvedColumn, type ResolvedDeepSpaceAgentModel, type RolePermissions, type RunMigrationsResult, SANDBOX_SCOPES, SANDBOX_SCOPE_HEADER, SDK_RUN_WORKER_FIRST, SECRET_NAME_RE, SECURE_ROOM_BOUNDARIES_MIGRATION_ID, SESSION_COOKIE, STRICT_APP_ID_RE, SYSTEM_ASSIGNED_COLUMNS, SYSTEM_COLLECTIONS, SYSTEM_MAINTAINED_COLUMNS, SYSTEM_MANAGED_COLUMNS, type SandboxFile, SandboxFileError, type SandboxFileList, type SandboxFilesClient, type SandboxFilesOptions, type SandboxScope, type SandboxUploadOptions, SchemaRegistry, type ScopeContext, type ScopedKnowledgeClient, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, type ScreenshotResult, type ServerMessage, type StorageAdmission, type StoredRecord, type Summarizer, type SyncResult, TEST_ACCOUNT_EMAIL_SUFFIX, type TokenDebugInfo, type ToolResult, type ToolSchema, UNDECLARED_ASSET_NOT_FOUND_HANDLING, UPLOAD_PART_BYTES, USERS_COLUMNS, type User, type UserAttachment, type UserToolExecutorEnv, type ValidationError, type VerifiedAuth, type VerifyOutcome, type VerifyResult, type Viewport, WORKER_OWNED_NOT_FOUND_MIGRATION_ID, YjsRoom, agentTokenIssuer, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, armCronRoom, authWorkerFetch, authenticatedRoomRequest, bindingManifestFromOutputConfig, buildCronContext, buildTableSelect, buildUiParts, callRegistry, callableFromSandbox, canCreate, canDelete, canRead, canUpdate, capToolResultSize, captureScreenshot, checkFieldPermissions, checkUnclaimedOwnerTransition, clientBuild, codeExecutionTool, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDecoder, createDeepSpaceAI, createDeepSpaceAuth, createEncoder, createScopedR2Handler, createUserToolExecutor, dataToColumnValues, decodeJwtPayload, deepSpaceAgentErrorSummary, deleteChatCascade, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, enqueueJob, epochSeconds, folderFilter, formatBytes, forwardSandboxContainer, getChat, getDeepSpaceAIModel, getMessageType, getRolePermissions, handleAwarenessMessage, handleSyncMessage, hasContent, isAnonymousUserId, isAssetNotFoundHandling, isAutoProvision, isFilesVerbPath, isOwner, isPlatformReservedPath, isRestrictedPlane, isTestAccountClaims, isTestAccountEmail, isTestAccountTier, knowledge, lintSchema, lintSchemaSet, lintSchemas, listDeepSpaceAgentModels, loadMessages, logEventText, loggableError, makeDefaultSummarizer, matchOrigin, meterAi, meterUsage, meterVectorize, mintAppId, mintUlid, nativeAuthCallback, nativeAuthExchange, nativeAuthIdToken, nativeAuthMe, nativeAuthSignOut, nativeAuthStart, nativeAuthToken, noopPermissionContext, normalizeAgentTargetOrigin, normalizeApiError, normalizeKnowledgeFolder, parseQuotaLimit, platformCorsPatterns, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, readBoundedBodyText, readVarUint, readVarUint8Array, registerAgentToolRoutes, registerDeepSpaceDocumentation, registryErrorJson, registryStub, resolveAppMembership, resolveAppName, resolveAppRole, resolveColumn, resolveCompatibilityFlags, resolveDeepSpaceAgentModel, resolveSessionReadAuth, reuseSandbox, rowToData, runMigrations, sandboxFiles, sandboxOutputs, sandboxUpload, serverBuild, storageLimitForTier, storageQuotaMessage, streamDeepSpaceAgent, timingSafeEqualHex, timingSafeEqualStrings, toUint8Array, totalChars, truncateLogText, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppMigrationIds, validateAppName, validateBindingManifest, validateDoManifest, verifyAgentToken, verifyJwt, workerErrorHandler, writeVarUint, writeVarUint8Array };
|
package/dist/worker.js
CHANGED
|
@@ -10486,8 +10486,12 @@ import { organization, twoFactor } from "better-auth/plugins";
|
|
|
10486
10486
|
import { SignJWT, importPKCS8 } from "jose";
|
|
10487
10487
|
function createDeepSpaceAuth(config) {
|
|
10488
10488
|
const socialProviders = {};
|
|
10489
|
+
const googleAudiences = config.nativeIdTokenAudiences?.google ?? [];
|
|
10490
|
+
const appleAudiences = config.nativeIdTokenAudiences?.apple ?? [];
|
|
10489
10491
|
if (config.google) {
|
|
10490
|
-
socialProviders.google = config.google;
|
|
10492
|
+
socialProviders.google = googleAudiences.length ? { ...config.google, clientId: [config.google.clientId, ...googleAudiences] } : config.google;
|
|
10493
|
+
} else if (googleAudiences.length) {
|
|
10494
|
+
socialProviders.google = { clientId: googleAudiences, clientSecret: "" };
|
|
10491
10495
|
}
|
|
10492
10496
|
if (config.github) {
|
|
10493
10497
|
socialProviders.github = config.github;
|
|
@@ -10497,16 +10501,27 @@ function createDeepSpaceAuth(config) {
|
|
|
10497
10501
|
}
|
|
10498
10502
|
if (config.apple) {
|
|
10499
10503
|
const apple = config.apple;
|
|
10504
|
+
const audience = appleAudiences.length ? [apple.clientId, ...appleAudiences] : void 0;
|
|
10500
10505
|
socialProviders.apple = async () => {
|
|
10501
10506
|
try {
|
|
10502
|
-
return {
|
|
10507
|
+
return {
|
|
10508
|
+
clientId: apple.clientId,
|
|
10509
|
+
clientSecret: await generateAppleClientSecret(apple),
|
|
10510
|
+
...audience ? { audience } : {}
|
|
10511
|
+
};
|
|
10503
10512
|
} catch (err) {
|
|
10504
10513
|
console.error(
|
|
10505
10514
|
`[deepspace] failed to mint Apple client secret; Apple sign-in disabled: ${loggableError(err)}`
|
|
10506
10515
|
);
|
|
10507
|
-
return { clientId: apple.clientId, clientSecret: "" };
|
|
10516
|
+
return { clientId: apple.clientId, clientSecret: "", ...audience ? { audience } : {} };
|
|
10508
10517
|
}
|
|
10509
10518
|
};
|
|
10519
|
+
} else if (appleAudiences.length) {
|
|
10520
|
+
socialProviders.apple = {
|
|
10521
|
+
clientId: appleAudiences[0],
|
|
10522
|
+
clientSecret: "",
|
|
10523
|
+
audience: appleAudiences
|
|
10524
|
+
};
|
|
10510
10525
|
}
|
|
10511
10526
|
return betterAuth({
|
|
10512
10527
|
database: config.database,
|
|
@@ -10979,13 +10994,62 @@ async function nativeAuthExchange(request2, env) {
|
|
|
10979
10994
|
if (!exchanged || typeof exchanged.sessionToken !== "string") {
|
|
10980
10995
|
return Response.json({ error: "The auth service did not issue a session." }, { status: 502 });
|
|
10981
10996
|
}
|
|
10997
|
+
return nativeSession(env, exchanged.sessionToken);
|
|
10998
|
+
}
|
|
10999
|
+
var ID_TOKEN_PROVIDERS = /* @__PURE__ */ new Set(["google", "apple"]);
|
|
11000
|
+
async function nativeAuthIdToken(request2, env) {
|
|
11001
|
+
const body = await request2.json().catch(() => null);
|
|
11002
|
+
if (!body || typeof body.provider !== "string" || !ID_TOKEN_PROVIDERS.has(body.provider) || typeof body.idToken !== "string" || body.idToken.length < 16 || body.idToken.length > 8192 || body.nonce !== void 0 && (typeof body.nonce !== "string" || body.nonce.length < 16 || body.nonce.length > 256)) {
|
|
11003
|
+
return Response.json({ error: "A Google or Apple ID token is required." }, { status: 400 });
|
|
11004
|
+
}
|
|
11005
|
+
const name = body.user?.name;
|
|
11006
|
+
const text = (value) => typeof value === "string" ? value.trim().slice(0, 100) : void 0;
|
|
11007
|
+
const firstName = text(name?.firstName);
|
|
11008
|
+
const lastName = text(name?.lastName);
|
|
11009
|
+
let signIn;
|
|
11010
|
+
try {
|
|
11011
|
+
signIn = await authWorkerFetch(env, "/api/auth/sign-in/social", {
|
|
11012
|
+
method: "POST",
|
|
11013
|
+
headers: { "Content-Type": "application/json" },
|
|
11014
|
+
body: JSON.stringify({
|
|
11015
|
+
provider: body.provider,
|
|
11016
|
+
idToken: {
|
|
11017
|
+
token: body.idToken,
|
|
11018
|
+
...typeof body.nonce === "string" ? { nonce: body.nonce } : {},
|
|
11019
|
+
...firstName || lastName ? { user: { name: { firstName, lastName } } } : {}
|
|
11020
|
+
}
|
|
11021
|
+
})
|
|
11022
|
+
});
|
|
11023
|
+
} catch {
|
|
11024
|
+
return Response.json({ error: "The authentication service is unavailable." }, { status: 502 });
|
|
11025
|
+
}
|
|
11026
|
+
if (!signIn.ok) {
|
|
11027
|
+
if (signIn.status === 404) {
|
|
11028
|
+
return Response.json({ error: "Signing in this way is not set up for this app." }, { status: 503 });
|
|
11029
|
+
}
|
|
11030
|
+
if (signIn.status === 429) {
|
|
11031
|
+
return Response.json({ error: "Too many sign-in attempts. Try again shortly." }, { status: 429 });
|
|
11032
|
+
}
|
|
11033
|
+
const rejected = signIn.status >= 400 && signIn.status < 500;
|
|
11034
|
+
return Response.json(
|
|
11035
|
+
{ error: rejected ? "That sign-in could not be verified. Please try again." : "The authentication service is unavailable." },
|
|
11036
|
+
{ status: rejected ? 401 : 502 }
|
|
11037
|
+
);
|
|
11038
|
+
}
|
|
11039
|
+
const signedIn = await signIn.json().catch(() => null);
|
|
11040
|
+
if (!signedIn || typeof signedIn.token !== "string") {
|
|
11041
|
+
return Response.json({ error: "The auth service did not issue a session." }, { status: 502 });
|
|
11042
|
+
}
|
|
11043
|
+
return nativeSession(env, signedIn.token);
|
|
11044
|
+
}
|
|
11045
|
+
async function nativeSession(env, sessionToken) {
|
|
10982
11046
|
let tokenResponse = null;
|
|
10983
11047
|
let token = null;
|
|
10984
11048
|
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
10985
11049
|
try {
|
|
10986
11050
|
tokenResponse = await authWorkerFetch(env, "/api/auth/token", {
|
|
10987
11051
|
method: "POST",
|
|
10988
|
-
headers: { Cookie: `${SESSION_COOKIE}=${encodeURIComponent(
|
|
11052
|
+
headers: { Cookie: `${SESSION_COOKIE}=${encodeURIComponent(sessionToken)}` }
|
|
10989
11053
|
});
|
|
10990
11054
|
} catch {
|
|
10991
11055
|
tokenResponse = null;
|
|
@@ -11009,7 +11073,7 @@ async function nativeAuthExchange(request2, env) {
|
|
|
11009
11073
|
return Response.json({ error: "The auth service did not issue an access token." }, { status: 502 });
|
|
11010
11074
|
}
|
|
11011
11075
|
return Response.json(
|
|
11012
|
-
{ sessionToken
|
|
11076
|
+
{ sessionToken, accessToken: token.token },
|
|
11013
11077
|
{ headers: { "Cache-Control": "no-store" } }
|
|
11014
11078
|
);
|
|
11015
11079
|
}
|
|
@@ -11313,6 +11377,7 @@ export {
|
|
|
11313
11377
|
mintUlid,
|
|
11314
11378
|
nativeAuthCallback,
|
|
11315
11379
|
nativeAuthExchange,
|
|
11380
|
+
nativeAuthIdToken,
|
|
11316
11381
|
nativeAuthMe,
|
|
11317
11382
|
nativeAuthSignOut,
|
|
11318
11383
|
nativeAuthStart,
|