deepspace 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/worker.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as Y from 'yjs';
2
- import { LanguageModel, ModelMessage } from 'ai';
2
+ import { LanguageModel, ToolSet, ModelMessage } from 'ai';
3
3
  import * as better_auth from 'better-auth';
4
+ import { betterAuth } from 'better-auth';
4
5
  import * as better_auth_plugins from 'better-auth/plugins';
5
6
 
6
7
  /**
@@ -1747,6 +1748,49 @@ declare abstract class CronRoom<E = Record<string, unknown>> extends BaseRoom<E>
1747
1748
  protected abstract onTask(taskName: string): void | Promise<void>;
1748
1749
  }
1749
1750
 
1751
+ interface SecretMetadata {
1752
+ name: string;
1753
+ version: number;
1754
+ createdAt: string;
1755
+ updatedAt: string;
1756
+ updatedBy: string | null;
1757
+ }
1758
+ declare class SecretsRoom<E extends {
1759
+ APP_SECRETS_KEY?: string;
1760
+ } = {
1761
+ APP_SECRETS_KEY?: string;
1762
+ }> extends BaseRoom<E> {
1763
+ private initialized;
1764
+ protected onMessage(_ws: WebSocket, _user: UserAttachment, _message: {
1765
+ type: string;
1766
+ }): void;
1767
+ fetch(request: Request): Promise<Response>;
1768
+ protected onRequest(request: Request): Promise<Response>;
1769
+ list(): Promise<SecretMetadata[]>;
1770
+ pull(): Promise<Record<string, string>>;
1771
+ patch(body: {
1772
+ set?: Record<string, string>;
1773
+ delete?: string[];
1774
+ updatedBy?: string;
1775
+ }): Promise<{
1776
+ version: number;
1777
+ secrets: SecretMetadata[];
1778
+ }>;
1779
+ replace(body: {
1780
+ secrets?: Record<string, string>;
1781
+ updatedBy?: string;
1782
+ }): Promise<{
1783
+ version: number;
1784
+ secrets: SecretMetadata[];
1785
+ }>;
1786
+ private transaction;
1787
+ private migrateLegacyProductionSecrets;
1788
+ private ensureInitialized;
1789
+ private requireKey;
1790
+ private storeVersion;
1791
+ private bumpStoreVersion;
1792
+ }
1793
+
1750
1794
  /**
1751
1795
  * JobRoom — Per-app durable background-job execution Durable Object.
1752
1796
  *
@@ -2048,7 +2092,7 @@ declare const ALLOWED_BINDING_TYPES: Set<string>;
2048
2092
  *
2049
2093
  * Includes:
2050
2094
  * - Static-asset + service bindings the platform sets up automatically.
2051
- * - SDK-managed env (auth, identity, owner JWT).
2095
+ * - SDK-managed env (auth, identity, owner JWT, app-secret encryption root).
2052
2096
  * - The auto-attached cost-tracking AE dataset (`USAGE_EVENTS`).
2053
2097
  *
2054
2098
  * DO binding names (RECORD_ROOMS, YJS_ROOMS, etc.) are NOT in this set
@@ -2507,6 +2551,30 @@ type ToolResult = {
2507
2551
  success: false;
2508
2552
  error: string;
2509
2553
  };
2554
+ /**
2555
+ * Page size the assistant defaults to for `records.query` when it omits
2556
+ * `limit`. Keeps a model-issued unbounded scan from blowing the tool-result
2557
+ * byte cap and gives the model a usable first page. Raise `limit` to page
2558
+ * through more (still subject to the cap; see
2559
+ * `DEFAULT_CONTEXT_CONFIG.toolResultCap` / `capToolResultSize`, which truncates
2560
+ * oversized pages gracefully rather than dropping them).
2561
+ *
2562
+ * Applied by the AI tool layer via `applyAiToolDefaults`, never by the shared
2563
+ * tools-api dispatch, so internal record readers (chat history, cron, app
2564
+ * `actions.query`) stay unbounded.
2565
+ */
2566
+ declare const DEFAULT_QUERY_LIMIT = 50;
2567
+ /**
2568
+ * Fill in assistant-only parameter defaults for a built-in tool call.
2569
+ *
2570
+ * Applied by the AI tool layer (`buildTools`) before a model-issued tool call
2571
+ * is dispatched, so the default only affects calls the assistant makes.
2572
+ * `records.query` doubles as the SDK's general record-read primitive (chat
2573
+ * history, cron, app `actions.query`); those callers reach the tools dispatch
2574
+ * directly and must return every row, so this default must not live in the
2575
+ * dispatch itself. Pure and non-mutating.
2576
+ */
2577
+ declare function applyAiToolDefaults(toolName: string, params: Record<string, unknown>): Record<string, unknown>;
2510
2578
  /**
2511
2579
  * Built-in tool definitions for storage, record, schema, user, and backup operations
2512
2580
  */
@@ -2804,7 +2872,7 @@ interface CronContext {
2804
2872
  };
2805
2873
  /**
2806
2874
  * Call a platform integration endpoint (e.g. "openai/chat-completion",
2807
- * "freepik/text-to-image-classic"). Billed to the app owner — the same
2875
+ * "fal/run-model"). Billed to the app owner using the same
2808
2876
  * APP_OWNER_JWT the rest of the SDK uses for server-side billed calls.
2809
2877
  */
2810
2878
  integrations: {
@@ -2903,6 +2971,49 @@ interface DeepSpaceAIOptions {
2903
2971
  */
2904
2972
  declare function createDeepSpaceAI(env: DeepSpaceAIEnv, provider: Provider, options?: DeepSpaceAIOptions): DeepSpaceModelFactory;
2905
2973
 
2974
+ /**
2975
+ * Composio tools for the Vercel AI SDK.
2976
+ *
2977
+ * Turns the platform's Composio integration into ready-to-use Vercel AI SDK
2978
+ * tools, so an agent (or the DeepSpace AI chat) can take actions on a user's
2979
+ * connected apps. Each returned tool's `execute()` calls our own
2980
+ * `composio/execute-tool` endpoint through the api-worker proxy, so our auth
2981
+ * and per-user billing apply. This is the managed-proxy equivalent of
2982
+ * Composio's `@composio/vercel` provider, which talks straight to Composio.
2983
+ *
2984
+ * `authToken` must be the END USER's JWT: Composio resolves the user's
2985
+ * connected accounts by the JWT subject, and that user is billed.
2986
+ *
2987
+ * Usage (inside a request handler, e.g. /api/ai/chat):
2988
+ *
2989
+ * import { composioTools, createDeepSpaceAI } from 'deepspace/worker'
2990
+ * const jwt = c.req.header('Authorization')!.slice(7)
2991
+ * const tools = await composioTools(c.env, { toolkit: 'gmail', authToken: jwt })
2992
+ * const ai = createDeepSpaceAI(c.env, 'anthropic', { authToken: jwt })
2993
+ * const result = streamText({ model: ai('claude-sonnet-4-6'), prompt, tools })
2994
+ *
2995
+ * Merge with your own tools: `tools: { ...buildTools(executor), ...composio }`.
2996
+ */
2997
+
2998
+ interface ComposioToolsOptions {
2999
+ /** End user's JWT. Required: the tools run as this user and bill them. */
3000
+ authToken: string;
3001
+ /** Restrict to one toolkit (e.g. 'gmail', 'github'). */
3002
+ toolkit?: string;
3003
+ /** Explicit tool slugs to expose (e.g. ['GMAIL_SEND_EMAIL']). */
3004
+ tools?: string[];
3005
+ /** Natural-language search to pick relevant tools. */
3006
+ search?: string;
3007
+ /** Cap how many tools are exposed (default 20). Keep small: the LLM sees them all. */
3008
+ limit?: number;
3009
+ }
3010
+ /**
3011
+ * Fetch Composio tools for the given scope and return them as a Vercel AI SDK
3012
+ * `ToolSet`. One `list-tools` call provides each tool's JSON Schema; each tool
3013
+ * executes via `composio/execute-tool` as the authenticated user.
3014
+ */
3015
+ declare function composioTools(env: ApiWorkerEnv, options: ComposioToolsOptions): Promise<ToolSet>;
3016
+
2906
3017
  /**
2907
3018
  * captureScreenshot — call platform-worker /internal/screenshot.
2908
3019
  *
@@ -2991,8 +3102,17 @@ declare function truncateOldToolResults(messages: ChatTurn[], keepRecent: number
2991
3102
  */
2992
3103
  declare function applySlidingWindow(messages: ChatTurn[], charCap: number, minKept: number): ChatTurn[];
2993
3104
  /**
2994
- * Replace oversized tool results with an error telling the agent to narrow
2995
- * its query. Keeps a small preview so the agent can see what it got.
3105
+ * Keep an individual tool result under `byteCap`.
3106
+ *
3107
+ * If the payload carries a list of items (e.g. a `records.query` result), it is
3108
+ * degraded gracefully: as many leading items as fit under the cap are returned,
3109
+ * the `success: true` shape is preserved, and `{ truncated, returned, total }`
3110
+ * flags are merged in next to the array so callers can still use the partial
3111
+ * data and paginate for the rest.
3112
+ *
3113
+ * Only when there is no array to trim (or even an empty list still overflows
3114
+ * because of oversized sibling fields) does it fall back to replacing the
3115
+ * result with an error + small preview telling the agent to narrow its query.
2996
3116
  */
2997
3117
  declare function capToolResultSize(result: unknown, byteCap: number): unknown;
2998
3118
  /**
@@ -3421,11 +3541,6 @@ declare function timingSafeEqualHex(a: string, b: string): Promise<boolean>;
3421
3541
 
3422
3542
  declare function decodeJwtPayload(token: string | null | undefined): TokenDebugInfo | undefined;
3423
3543
 
3424
- /**
3425
- * Better Auth configuration factory for DeepSpace
3426
- *
3427
- * Provides pre-configured Better Auth instances for Cloudflare Workers + D1.
3428
- */
3429
3544
  interface DeepSpaceAuthConfig {
3430
3545
  /** D1 database binding */
3431
3546
  database: D1Database;
@@ -3443,29 +3558,28 @@ interface DeepSpaceAuthConfig {
3443
3558
  clientId: string;
3444
3559
  clientSecret: string;
3445
3560
  };
3561
+ /** Microsoft (Entra ID) OAuth credentials (optional) */
3562
+ microsoft?: {
3563
+ clientId: string;
3564
+ clientSecret: string;
3565
+ };
3566
+ /**
3567
+ * Apple (Sign in with Apple) credentials (optional). Pass the raw
3568
+ * Sign-in-with-Apple key material; the ES256 client-secret JWT is minted
3569
+ * on demand, so there is no six-month token to rotate by hand.
3570
+ */
3571
+ apple?: {
3572
+ clientId: string;
3573
+ teamId: string;
3574
+ keyId: string;
3575
+ privateKey: string;
3576
+ };
3446
3577
  /** Enable email/password authentication */
3447
3578
  emailAndPassword?: boolean;
3448
3579
  /** Trusted origins for CORS */
3449
3580
  trustedOrigins?: string[];
3450
3581
  }
3451
- /**
3452
- * Create a Better Auth instance configured for DeepSpace.
3453
- *
3454
- * This is called per-request in the auth worker since D1 bindings
3455
- * are request-scoped in Cloudflare Workers.
3456
- */
3457
3582
  declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.Auth<{
3458
- database: D1Database;
3459
- baseURL: string;
3460
- secret: string;
3461
- emailAndPassword: {
3462
- enabled: boolean;
3463
- };
3464
- socialProviders: Record<string, {
3465
- clientId: string;
3466
- clientSecret: string;
3467
- }>;
3468
- trustedOrigins: string[];
3469
3583
  plugins: [{
3470
3584
  id: "organization";
3471
3585
  endpoints: better_auth_plugins.OrganizationEndpoints<better_auth_plugins.OrganizationOptions & {
@@ -4265,9 +4379,74 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
4265
4379
  INVALID_TWO_FACTOR_COOKIE: better_auth.RawError<"INVALID_TWO_FACTOR_COOKIE">;
4266
4380
  };
4267
4381
  }];
4382
+ advanced?: {
4383
+ cookies: {
4384
+ state: {
4385
+ attributes: {
4386
+ sameSite: "none";
4387
+ secure: true;
4388
+ };
4389
+ };
4390
+ oauth_state: {
4391
+ attributes: {
4392
+ sameSite: "none";
4393
+ secure: true;
4394
+ };
4395
+ };
4396
+ };
4397
+ } | undefined;
4398
+ database: D1Database;
4399
+ baseURL: string;
4400
+ secret: string;
4401
+ emailAndPassword: {
4402
+ enabled: boolean;
4403
+ };
4404
+ socialProviders: Parameters<typeof betterAuth>[0]["socialProviders"];
4405
+ trustedOrigins: string[];
4268
4406
  }>;
4269
4407
  type DeepSpaceAuth = ReturnType<typeof createDeepSpaceAuth>;
4270
4408
 
4409
+ interface SecretsEnv {
4410
+ SECRETS_ROOMS?: DurableObjectNamespace;
4411
+ APP_SECRETS_KEY?: string;
4412
+ APP_SECRETS_LOCAL_FALLBACK?: string;
4413
+ }
4414
+ interface SecretRefreshResult {
4415
+ changed: boolean;
4416
+ version: number;
4417
+ }
4418
+ interface WithFreshSecretsContext {
4419
+ secrets: SecretsClient;
4420
+ attempt: number;
4421
+ refreshed: boolean;
4422
+ }
4423
+ interface WithFreshSecretsOptions {
4424
+ /**
4425
+ * By default the operation retries only when a forced refresh observes a
4426
+ * changed secret version after an auth-like failure. Set this for idempotent
4427
+ * operations that should retry after a successful refresh even when the
4428
+ * version is unchanged.
4429
+ */
4430
+ retryWhenUnchanged?: boolean;
4431
+ }
4432
+ interface SecretsClient {
4433
+ get(name: string): Promise<string | undefined>;
4434
+ require(name: string): Promise<string>;
4435
+ getMany(names: string[]): Promise<Record<string, string | undefined>>;
4436
+ preload(names: string[]): Promise<void>;
4437
+ refresh(options?: {
4438
+ force?: boolean;
4439
+ }): Promise<SecretRefreshResult>;
4440
+ checkForUpdates(): Promise<SecretRefreshResult>;
4441
+ invalidate(): void;
4442
+ withFreshSecrets<T>(operation: (ctx: WithFreshSecretsContext) => Promise<T>, options?: WithFreshSecretsOptions): Promise<T>;
4443
+ }
4444
+ interface CreateSecretsOptions {
4445
+ refreshIntervalMs?: number;
4446
+ now?: () => number;
4447
+ }
4448
+ declare function createSecrets(env: SecretsEnv, options?: CreateSecretsOptions): SecretsClient;
4449
+
4271
4450
  /**
4272
4451
  * Yjs collaborative editing handlers for RecordRoom
4273
4452
  */
@@ -4275,4 +4454,4 @@ type DeepSpaceAuth = ReturnType<typeof createDeepSpaceAuth>;
4275
4454
  /** Collections that bypass schema checks (permissive access) */
4276
4455
  declare const SYSTEM_COLLECTIONS: Set<string>;
4277
4456
 
4278
- export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, ALLOWED_BINDING_TYPES, APP_NAME_RULES, AUTO_PROVISIONABLE_TYPES, AUTO_PROVISION_SENTINEL, type ActionContext, type ActionHandler, type ActionResult, type ActionTools, type ApiWorkerEnv, type AppNameResolution, type AppNameValidation, type AuthWorkerEnv, Awareness, type AwarenessState, type AwarenessStates, BASE_USERS_SCHEMA, BUILT_IN_TOOLS, type BaseMessage, BaseRoom, CHANNELS_SCHEMA, CHANNEL_INVITATIONS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, CONVERSATION_SCHEMAS, COST_RATES, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type ClientMessage, type CollectionPermissionSummary, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ConnectionAttachment, type ConvMemberData, type ConvMessageData, type ConvReactionData, type ConvReadCursorData, type ConvVoteData, type ConversationStateData, type CronContext, type CronExecution, CronRoom, type CronRoomConfig, type CronTask, type CustomBinding, type CustomBindingManifest, DEFAULT_CONTEXT_CONFIG, DEFAULT_DO_MANIFEST, DIRECTORY_SCHEMAS, type DOBindings, type DOManifest, type DOManifestEntry, type DeepSpaceAIEnv, type DeepSpaceAIOptions, type DeepSpaceAuth, type DeepSpaceAuthConfig, type DirectoryCommunityData, type DirectoryConversationData, type DirectoryMembershipData, type DirectoryPostData, type DoMigrationDirective, type DoMigrationPlan, type ExistingDOBinding, GLOBAL_DO_TYPES, GLOBAL_DO_TYPE_NAMES, type GameInput, GameRoom, type GameRoomConfig, type GetActionData, type GlobalDOType, type HandlerContext, type Job, type JobContext, JobRoom, type JobRoomConfig, type JobStatus, type JwtClaims, type JwtVerifierConfig, MESSAGES_SCHEMA, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type MessageHandlers, type MsgType, type MutateActionData, type PermissionAnalysis, type PermissionContext, type PermissionLevel, type PermissionSource, type PlatformWorkerEnv, type Player, type PrefixResult, type PresencePeer, PresenceRoom, type ProtocolMessage, type QueryActionData, REACTIONS_SCHEMA, READ_RECEIPTS_SCHEMA, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_NAMES, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_DEFAULT, RecordRoom, type RecordRoomConfig, type ResolvedColumn, type ResolvedPermission, type RolePermissions, type RunMigrationsResult, SYSTEM_COLLECTIONS, SYSTEM_MANAGED_COLUMNS, SchemaRegistry, type ScopeContext, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, type ScreenshotOptions, type ScreenshotResult, type ServerMessage, type SharedConnection, type StoredRecord, type Summarizer, type SyncResult, type TokenDebugInfo, type ToolResult, type ToolSchema, USERS_COLUMNS, type User, type UserAttachment, VOTING_SCHEMAS, type ValidationError, type VerifiedAuth, type VerifyOutcome, type VerifyResult, type Viewport, WORKSPACE_SCHEMAS, YjsRoom, analyzePermissions, apiWorkerFetch, appendMessage, applySlidingWindow, authWorkerFetch, bindingManifestFromOutputConfig, buildCronContext, buildTableSelect, buildUiParts, canCreate, canDelete, canRead, canUpdate, capToolResultSize, captureScreenshot, checkFieldPermissions, clientBuild, coerceValue, collectionTableName, columnId, computeDoMigration, computeHmacHex, createChat, createDecoder, createDeepSpaceAI, createDeepSpaceAuth, createEncoder, createScopedR2Handler, dataToColumnValues, decodeJwtPayload, deleteChatCascade, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, enqueueJob, getChat, getGlobalDOSchemas, getGlobalDOType, getMessageType, getRolePermissions, handleAwarenessMessage, handleSyncMessage, hasContent, isAutoProvision, isOwner, lintSchema, loadMessages, makeDefaultSummarizer, meterAi, meterUsage, meterVectorize, noopPermissionContext, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, readVarUint, readVarUint8Array, resolveAppName, resolveColumn, rowToData, runMigrations, serverBuild, timingSafeEqualHex, toUint8Array, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema, writeVarUint, writeVarUint8Array };
4457
+ export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, ALLOWED_BINDING_TYPES, APP_NAME_RULES, AUTO_PROVISIONABLE_TYPES, AUTO_PROVISION_SENTINEL, type ActionContext, type ActionHandler, type ActionResult, type ActionTools, type ApiWorkerEnv, type AppNameResolution, type AppNameValidation, type AuthWorkerEnv, Awareness, type AwarenessState, type AwarenessStates, BASE_USERS_SCHEMA, BUILT_IN_TOOLS, type BaseMessage, BaseRoom, CHANNELS_SCHEMA, CHANNEL_INVITATIONS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, CONVERSATION_SCHEMAS, COST_RATES, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type ClientMessage, type CollectionPermissionSummary, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ComposioToolsOptions, type ConnectionAttachment, type ConvMemberData, type ConvMessageData, type ConvReactionData, type ConvReadCursorData, type ConvVoteData, type ConversationStateData, type CreateSecretsOptions, type CronContext, type CronExecution, CronRoom, type CronRoomConfig, type CronTask, type CustomBinding, type CustomBindingManifest, DEFAULT_CONTEXT_CONFIG, DEFAULT_DO_MANIFEST, DEFAULT_QUERY_LIMIT, DIRECTORY_SCHEMAS, type DOBindings, type DOManifest, type DOManifestEntry, type DeepSpaceAIEnv, type DeepSpaceAIOptions, type DeepSpaceAuth, type DeepSpaceAuthConfig, type DirectoryCommunityData, type DirectoryConversationData, type DirectoryMembershipData, type DirectoryPostData, type DoMigrationDirective, type DoMigrationPlan, type ExistingDOBinding, GLOBAL_DO_TYPES, GLOBAL_DO_TYPE_NAMES, type GameInput, GameRoom, type GameRoomConfig, type GetActionData, type GlobalDOType, type HandlerContext, type Job, type JobContext, JobRoom, type JobRoomConfig, type JobStatus, type JwtClaims, type JwtVerifierConfig, MESSAGES_SCHEMA, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type MessageHandlers, type MsgType, type MutateActionData, type PermissionAnalysis, type PermissionContext, type PermissionLevel, type PermissionSource, type PlatformWorkerEnv, type Player, type PrefixResult, type PresencePeer, PresenceRoom, type ProtocolMessage, type QueryActionData, REACTIONS_SCHEMA, READ_RECEIPTS_SCHEMA, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_NAMES, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_DEFAULT, RecordRoom, type RecordRoomConfig, type ResolvedColumn, type ResolvedPermission, type RolePermissions, type RunMigrationsResult, SYSTEM_COLLECTIONS, SYSTEM_MANAGED_COLUMNS, SchemaRegistry, type ScopeContext, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, type ScreenshotOptions, type ScreenshotResult, type SecretMetadata, type SecretRefreshResult, type SecretsClient, type SecretsEnv, SecretsRoom, type ServerMessage, type SharedConnection, type StoredRecord, type Summarizer, type SyncResult, type TokenDebugInfo, type ToolResult, type ToolSchema, USERS_COLUMNS, type User, type UserAttachment, VOTING_SCHEMAS, type ValidationError, type VerifiedAuth, type VerifyOutcome, type VerifyResult, type Viewport, WORKSPACE_SCHEMAS, type WithFreshSecretsContext, type WithFreshSecretsOptions, YjsRoom, analyzePermissions, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, authWorkerFetch, bindingManifestFromOutputConfig, buildCronContext, buildTableSelect, buildUiParts, canCreate, canDelete, canRead, canUpdate, capToolResultSize, captureScreenshot, checkFieldPermissions, clientBuild, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDecoder, createDeepSpaceAI, createDeepSpaceAuth, createEncoder, createScopedR2Handler, createSecrets, dataToColumnValues, decodeJwtPayload, deleteChatCascade, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, enqueueJob, getChat, getGlobalDOSchemas, getGlobalDOType, getMessageType, getRolePermissions, handleAwarenessMessage, handleSyncMessage, hasContent, isAutoProvision, isOwner, lintSchema, loadMessages, makeDefaultSummarizer, meterAi, meterUsage, meterVectorize, noopPermissionContext, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, readVarUint, readVarUint8Array, resolveAppName, resolveColumn, rowToData, runMigrations, serverBuild, timingSafeEqualHex, toUint8Array, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema, writeVarUint, writeVarUint8Array };