deepspace 0.26.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/{chunk-LPXWXF6R.js → chunk-YBXIUDZJ.js} +2 -2
  3. package/dist/{chunk-LPXWXF6R.js.map → chunk-YBXIUDZJ.js.map} +1 -1
  4. package/dist/cli.js +80 -45
  5. package/dist/cli.js.map +1 -1
  6. package/dist/documentation-client-core.js +1 -1
  7. package/dist/documentation-default-renderer.cjs +1 -1
  8. package/dist/documentation-react.js +1 -1
  9. package/dist/documentation-runtime.js +1 -1
  10. package/dist/documentation-server-core.js +1 -1
  11. package/dist/documentation.js +1 -1
  12. package/dist/documentation.js.map +1 -1
  13. package/dist/index.d.ts +26 -434
  14. package/dist/index.js +99 -864
  15. package/dist/index.js.map +1 -1
  16. package/dist/schema.d.ts +4 -41
  17. package/dist/schema.js +2 -242
  18. package/dist/schema.js.map +1 -1
  19. package/dist/server.d.ts +6 -162
  20. package/dist/server.js +13 -281
  21. package/dist/server.js.map +1 -1
  22. package/dist/worker.d.ts +4 -160
  23. package/dist/worker.js +15 -281
  24. package/dist/worker.js.map +1 -1
  25. package/features/messaging/feature.json +3 -43
  26. package/features/messaging/src/ChatPage.tsx +12 -16
  27. package/features/messaging/src/components/chat/ChatHeader.tsx +5 -13
  28. package/features/messaging/src/components/chat/MessageItem.tsx +7 -9
  29. package/features/messaging/src/components/chat/MessageList.tsx +57 -40
  30. package/features/messaging/src/components/chat/ThreadPanel.tsx +25 -11
  31. package/features/messaging/src/components/chat/UserProfilePopover.tsx +10 -29
  32. package/features/messaging/src/hooks/useChatChannel.ts +18 -23
  33. package/features/messaging/src/messaging-schema.ts +0 -2
  34. package/features/search-bar/feature.json +9 -20
  35. package/features/search-bar/src/InlineSearch.tsx +101 -0
  36. package/features/search-bar/src/__tests__/search-model.test.tsx +38 -0
  37. package/features/search-bar/src/search-model.ts +2 -149
  38. package/package.json +1 -1
  39. package/features/messaging/src/ChatMultiPage.tsx +0 -298
  40. package/features/messaging/src/components/chat-multi/AddMemberModal.tsx +0 -188
  41. package/features/messaging/src/components/chat-multi/BrowseGroupsModal.tsx +0 -163
  42. package/features/messaging/src/components/chat-multi/ChannelListItem.tsx +0 -147
  43. package/features/messaging/src/components/chat-multi/ChannelSettingsPanel.tsx +0 -344
  44. package/features/messaging/src/components/chat-multi/ChannelSidebar.tsx +0 -460
  45. package/features/messaging/src/components/chat-multi/CreateGroupModal.tsx +0 -190
  46. package/features/messaging/src/components/chat-multi/InvitationList.tsx +0 -149
  47. package/features/messaging/src/components/chat-multi/NewMessageModal.tsx +0 -159
  48. package/features/messaging/src/hooks/useMultiChannel.ts +0 -142
  49. package/features/search-bar/src/SearchOverlay.tsx +0 -566
  50. package/features/search-bar/src/__tests__/search-model.test.ts +0 -40
  51. package/features/sidebar/feature.json +0 -19
  52. package/features/sidebar/src/AppSidebar.tsx +0 -558
package/dist/worker.d.ts CHANGED
@@ -1112,90 +1112,6 @@ interface RecordResult {
1112
1112
  createdAt: string;
1113
1113
  updatedAt: string;
1114
1114
  }
1115
- interface DirectoryConversationData {
1116
- Name: string;
1117
- Description: string;
1118
- Type: string;
1119
- Visibility: string;
1120
- CreatedBy: string;
1121
- ParticipantHash: string;
1122
- ParticipantIds: string;
1123
- Status: string;
1124
- AssigneeId: string;
1125
- LinkedRef: string;
1126
- LastMessageAt: string;
1127
- LastMessagePreview: string;
1128
- LastMessageAuthor: string;
1129
- MessageCount: number;
1130
- }
1131
- interface ConversationStateData {
1132
- ConversationId: string;
1133
- UserId: string;
1134
- LastReadAt: string;
1135
- LastReadMessageCount: number;
1136
- Starred: number;
1137
- Archived: number;
1138
- Trashed: number;
1139
- Labels: string;
1140
- Folder: string;
1141
- }
1142
- interface DirectoryCommunityData {
1143
- Name: string;
1144
- Description: string;
1145
- CreatedBy: string;
1146
- Type: string;
1147
- Visibility: string;
1148
- MemberCount: number;
1149
- Rules: string;
1150
- IconUrl: string;
1151
- CoverUrl: string;
1152
- }
1153
- interface DirectoryMembershipData {
1154
- CommunityId: string;
1155
- UserId: string;
1156
- UserName: string;
1157
- Role: string;
1158
- JoinedAt: string;
1159
- }
1160
- interface DirectoryPostData {
1161
- Title: string;
1162
- Content: string;
1163
- AuthorId: string;
1164
- Type: string;
1165
- CommunityId: string;
1166
- ParentId: string;
1167
- ConversationId: string;
1168
- Status: string;
1169
- Tags: string;
1170
- LinkUrl: string;
1171
- }
1172
- interface ConvMessageData {
1173
- Content: string;
1174
- AuthorId: string;
1175
- ParentId: string;
1176
- Edited: number;
1177
- MessageType: string;
1178
- Metadata: string;
1179
- }
1180
- interface ConvReactionData {
1181
- MessageId: string;
1182
- Emoji: string;
1183
- UserId: string;
1184
- }
1185
- interface ConvMemberData {
1186
- UserId: string;
1187
- UserName: string;
1188
- Role: string;
1189
- }
1190
- interface ConvReadCursorData {
1191
- UserId: string;
1192
- LastReadAt: string;
1193
- }
1194
- interface ConvVoteData {
1195
- TargetId: string;
1196
- UserId: string;
1197
- Direction: number;
1198
- }
1199
1115
 
1200
1116
  /**
1201
1117
  * Server-specific protocol types
@@ -2234,7 +2150,9 @@ declare const AI_MESSAGES_SCHEMA: CollectionSchema;
2234
2150
  * Messaging Schemas
2235
2151
  *
2236
2152
  * Pre-built collection schemas for messaging functionality.
2237
- * Any app can import these to add channels, messages, reactions, etc.
2153
+ * These schemas intentionally model public channels only. RecordRoom row
2154
+ * permissions cannot make a channel private by themselves; advertising DMs
2155
+ * or private groups here would expose their records to every room member.
2238
2156
  *
2239
2157
  * @example
2240
2158
  * ```typescript
@@ -2247,82 +2165,8 @@ declare const CHANNELS_SCHEMA: CollectionSchema;
2247
2165
  declare const MESSAGES_SCHEMA: CollectionSchema;
2248
2166
  declare const REACTIONS_SCHEMA: CollectionSchema;
2249
2167
  declare const CHANNEL_MEMBERS_SCHEMA: CollectionSchema;
2250
- declare const CHANNEL_INVITATIONS_SCHEMA: CollectionSchema;
2251
2168
  declare const READ_RECEIPTS_SCHEMA: CollectionSchema;
2252
2169
 
2253
- /**
2254
- * Shared conversation schemas for RecordRoom-based conversations.
2255
- *
2256
- * These define the collections inside a per-conversation RecordRoom DO.
2257
- * Used by apps that have messaging/conversation features (slack-clone,
2258
- * helpdesk, mail, reddit-clone, etc.).
2259
- *
2260
- * Each conversation gets its own RecordRoom DO keyed by `conv:{id}`.
2261
- */
2262
-
2263
- declare const CONVERSATION_SCHEMAS: CollectionSchema[];
2264
- /**
2265
- * Voting schemas for Reddit-style apps.
2266
- * Add these alongside CONVERSATION_SCHEMAS for apps that need voting.
2267
- */
2268
- declare const VOTING_SCHEMAS: CollectionSchema[];
2269
-
2270
- /**
2271
- * Directory DO Schemas
2272
- *
2273
- * Purpose-built collections for the `dir:{appName}` global DO type.
2274
- * This is the cross-app-visible directory layer — any app can subscribe
2275
- * to another app's directory in real-time via SHARED_CONNECTIONS.
2276
- *
2277
- * Five collections covering all standard communication/social patterns:
2278
- * - conversations: channels, DMs, email threads, support chats
2279
- * - conversation_state: per-user metadata (read cursor, stars, labels, folders)
2280
- * - communities: groups, forums, boards, projects
2281
- * - memberships: user membership in communities
2282
- * - posts: feed items, tweets, Q&A questions, announcements
2283
- *
2284
- * Domain-specific data (tickets, CRM, procurement) stays in app DOs.
2285
- * Message content stays in conv:{id} DOs (CONVERSATION_SCHEMAS).
2286
- */
2287
-
2288
- /** All directory schemas for the `dir:{appName}` global DO type. */
2289
- declare const DIRECTORY_SCHEMAS: CollectionSchema[];
2290
-
2291
- /**
2292
- * Shared Durable Object Schemas
2293
- *
2294
- * Central registry of global DO types with fixed schemas.
2295
- * Apps connect to shared DOs via SHARED_CONNECTIONS in constants.ts.
2296
- * The ScopeRegistry resolves collection names to the correct scope automatically.
2297
- *
2298
- * Scope tiers:
2299
- * - App DO (app:{appHandle}) — private to each app, app defines tables
2300
- * - Dir DO (dir:{appHandle}) — cross-app directory (conversations, communities, posts)
2301
- * - Conv DO (conv:{id}) — single conversation (messages, reactions, members)
2302
- *
2303
- * There is no platform-wide singleton scope: every global room is keyed by
2304
- * a conversation or an app, so no one DO holds data shared by all apps.
2305
- */
2306
-
2307
- interface SharedConnection {
2308
- type: string;
2309
- instanceId?: string;
2310
- }
2311
- interface GlobalDOType {
2312
- name: string;
2313
- schemas: CollectionSchema[];
2314
- description: string;
2315
- }
2316
- declare const GLOBAL_DO_TYPES: GlobalDOType[];
2317
- /** All valid global DO type names. */
2318
- declare const GLOBAL_DO_TYPE_NAMES: string[];
2319
- /** Look up a global DO type by name, returns null if not found. */
2320
- declare function getGlobalDOType(name: string): GlobalDOType | null;
2321
- /** Get the fixed schemas for a global DO type. Returns empty array if unknown type. */
2322
- declare function getGlobalDOSchemas(typeName: string): CollectionSchema[];
2323
- /** All collection names reserved by global DO types. Apps must not reuse these. */
2324
- declare const RESERVED_COLLECTION_NAMES: Set<string>;
2325
-
2326
2170
  /**
2327
2171
  * Yjs Sync Protocol Implementation
2328
2172
  *
@@ -5538,4 +5382,4 @@ interface AppLogsResponse {
5538
5382
  declare const APP_LOG_EVENT_KEYS: readonly ["id", "timestamp", "level", "eventType", "message", "source", "outcome", "request", "exception"];
5539
5383
  type AppLogEventKey = (typeof APP_LOG_EVENT_KEYS)[number];
5540
5384
 
5541
- export { ACCOUNT_STORAGE_LIMIT_BYTES, ACTION_ROUTES_BEARER_GUARD_MIGRATION_ID, ACTION_TOOLS_DELETE_WHERE_MIGRATION_ID, AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, 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 ApiWorkerEnv, type AppLogEvent, type AppLogEventKey, type AppLogsResponse, 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, CHANNELS_SCHEMA, CHANNEL_INVITATIONS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, CLIENT_LOG_MARKER, CONVERSATION_SCHEMAS, COST_RATES, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type ClientErrorKind, type ClientErrorReport, type ClientMessage, type CollectionPermissionSummary, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ComposioToolsOptions, type ConnectionAttachment, type ConvMemberData, type ConvMessageData, type ConvReactionData, type ConvReadCursorData, type ConvVoteData, type ConversationStateData, type CronContext, type CronExecution, CronRoom, type CronRoomConfig, type CronTask, type CustomBinding, type CustomBindingManifest, 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, DIRECTORY_SCHEMAS, 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 DirectoryCommunityData, type DirectoryConversationData, type DirectoryMembershipData, type DirectoryPostData, type DoMigrationDirective, type DoMigrationPlan, type ExistingDOBinding, GLOBAL_DO_TYPES, GLOBAL_DO_TYPE_NAMES, type GetActionData, type GlobalDOType, 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_DELETE_WHERE_LIMIT, MAX_DEPLOY_ASSET_FILE_BYTES, MAX_ENV_VAR_BYTES, 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 PermissionAnalysis, type PermissionContext, type PermissionLevel, type PermissionSource, 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_COLLECTION_NAMES, RESERVED_RUN_WORKER_FIRST, RESOURCE_ID_RE, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_DEFAULT, RecordRoom, type RecordRoomConfig, RegistryClientError, type ResolvedColumn, type ResolvedDeepSpaceAgentModel, type ResolvedPermission, type RolePermissions, type RunMigrationsResult, SDK_RUN_WORKER_FIRST, SECURE_ROOM_BOUNDARIES_MIGRATION_ID, STRICT_APP_ID_RE, SYSTEM_ASSIGNED_COLUMNS, SYSTEM_COLLECTIONS, SYSTEM_MAINTAINED_COLUMNS, SYSTEM_MANAGED_COLUMNS, SchemaRegistry, type ScopeContext, type ScopedKnowledgeClient, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, type ScreenshotResult, type ServerMessage, type SharedConnection, 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, VOTING_SCHEMAS, type ValidationError, type VerifiedAuth, type VerifyOutcome, type VerifyResult, type Viewport, WORKER_OWNED_NOT_FOUND_MIGRATION_ID, YjsRoom, analyzePermissions, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, armCronRoom, authWorkerFetch, authenticatedRoomRequest, bindingManifestFromOutputConfig, buildCronContext, buildTableSelect, buildUiParts, callRegistry, canCreate, canDelete, canRead, canUpdate, capToolResultSize, captureScreenshot, checkFieldPermissions, checkUnclaimedOwnerTransition, clientBuild, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDecoder, createDeepSpaceAI, createDeepSpaceAuth, createEncoder, createScopedR2Handler, dataToColumnValues, decodeJwtPayload, deepSpaceAgentErrorSummary, deleteChatCascade, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, enqueueJob, epochSeconds, folderFilter, formatBytes, getChat, getDeepSpaceAIModel, getGlobalDOSchemas, getGlobalDOType, getMessageType, getRolePermissions, handleAwarenessMessage, handleClientErrorReport, handleSyncMessage, hasContent, isAnonymousUserId, isAssetNotFoundHandling, isAutoProvision, isFilesVerbPath, isOwner, isPlatformReservedPath, isTestAccountClaims, isTestAccountEmail, isTestAccountTier, knowledge, lintSchema, lintSchemaSet, lintSchemas, listDeepSpaceAgentModels, loadMessages, makeDefaultSummarizer, matchOrigin, meterAi, meterUsage, meterVectorize, mintAppId, mintUlid, noopPermissionContext, normalizeKnowledgeFolder, parseQuotaLimit, platformCorsPatterns, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, readVarUint, readVarUint8Array, registerClientErrorRoute, registerDeepSpaceDocumentation, registryErrorJson, registryStub, resolveAppName, resolveAppRole, resolveColumn, resolveCompatibilityFlags, resolveDeepSpaceAgentModel, rowToData, runMigrations, serverBuild, storageLimitForTier, storageQuotaMessage, streamDeepSpaceAgent, timingSafeEqualHex, timingSafeEqualStrings, toUint8Array, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppMigrationIds, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, writeVarUint, writeVarUint8Array };
5385
+ export { ACCOUNT_STORAGE_LIMIT_BYTES, ACTION_ROUTES_BEARER_GUARD_MIGRATION_ID, ACTION_TOOLS_DELETE_WHERE_MIGRATION_ID, AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, 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 ApiWorkerEnv, type AppLogEvent, type AppLogEventKey, type AppLogsResponse, 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, CHANNELS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, CLIENT_LOG_MARKER, COST_RATES, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type ClientErrorKind, type ClientErrorReport, type ClientMessage, type CollectionPermissionSummary, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ComposioToolsOptions, type ConnectionAttachment, type 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 DoMigrationDirective, type DoMigrationPlan, type ExistingDOBinding, 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_DELETE_WHERE_LIMIT, MAX_DEPLOY_ASSET_FILE_BYTES, MAX_ENV_VAR_BYTES, 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 PermissionAnalysis, type PermissionContext, type PermissionLevel, type PermissionSource, 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 ResolvedPermission, type RolePermissions, type RunMigrationsResult, SDK_RUN_WORKER_FIRST, SECURE_ROOM_BOUNDARIES_MIGRATION_ID, STRICT_APP_ID_RE, SYSTEM_ASSIGNED_COLUMNS, SYSTEM_COLLECTIONS, SYSTEM_MAINTAINED_COLUMNS, SYSTEM_MANAGED_COLUMNS, 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 ValidationError, type VerifiedAuth, type VerifyOutcome, type VerifyResult, type Viewport, WORKER_OWNED_NOT_FOUND_MIGRATION_ID, YjsRoom, analyzePermissions, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, armCronRoom, authWorkerFetch, authenticatedRoomRequest, bindingManifestFromOutputConfig, buildCronContext, buildTableSelect, buildUiParts, callRegistry, canCreate, canDelete, canRead, canUpdate, capToolResultSize, captureScreenshot, checkFieldPermissions, checkUnclaimedOwnerTransition, clientBuild, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDecoder, createDeepSpaceAI, createDeepSpaceAuth, createEncoder, createScopedR2Handler, dataToColumnValues, decodeJwtPayload, deepSpaceAgentErrorSummary, deleteChatCascade, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, enqueueJob, epochSeconds, folderFilter, formatBytes, getChat, getDeepSpaceAIModel, getMessageType, getRolePermissions, handleAwarenessMessage, handleClientErrorReport, handleSyncMessage, hasContent, isAnonymousUserId, isAssetNotFoundHandling, isAutoProvision, isFilesVerbPath, isOwner, isPlatformReservedPath, isTestAccountClaims, isTestAccountEmail, isTestAccountTier, knowledge, lintSchema, lintSchemaSet, lintSchemas, listDeepSpaceAgentModels, loadMessages, makeDefaultSummarizer, matchOrigin, meterAi, meterUsage, meterVectorize, mintAppId, mintUlid, noopPermissionContext, normalizeKnowledgeFolder, parseQuotaLimit, platformCorsPatterns, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, readVarUint, readVarUint8Array, registerClientErrorRoute, registerDeepSpaceDocumentation, registryErrorJson, registryStub, resolveAppName, resolveAppRole, resolveColumn, resolveCompatibilityFlags, resolveDeepSpaceAgentModel, rowToData, runMigrations, serverBuild, storageLimitForTier, storageQuotaMessage, streamDeepSpaceAgent, timingSafeEqualHex, timingSafeEqualStrings, toUint8Array, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppMigrationIds, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, writeVarUint, writeVarUint8Array };
package/dist/worker.js CHANGED
@@ -3398,6 +3398,18 @@ var RecordRoom = class extends BaseRoom {
3398
3398
 
3399
3399
  // src/server/rooms/yjs-room.ts
3400
3400
  import * as Y4 from "yjs";
3401
+
3402
+ // src/shared/roles.ts
3403
+ var ROLES = {
3404
+ VIEWER: "viewer",
3405
+ MEMBER: "member",
3406
+ ADMIN: "admin"
3407
+ };
3408
+ function isWriterRole(role) {
3409
+ return role === ROLES.ADMIN || role === ROLES.MEMBER;
3410
+ }
3411
+
3412
+ // src/server/rooms/yjs-room.ts
3401
3413
  var YjsRoom = class extends BaseRoom {
3402
3414
  doc = null;
3403
3415
  initialized = false;
@@ -3448,7 +3460,7 @@ var YjsRoom = class extends BaseRoom {
3448
3460
  // --------------------------------------------------------------------------
3449
3461
  onConnect(ws, user) {
3450
3462
  const role = user.role ?? "viewer";
3451
- const canWrite = role === "member" || role === "admin";
3463
+ const canWrite = isWriterRole(role);
3452
3464
  const attachment = {
3453
3465
  ...user,
3454
3466
  role,
@@ -3611,15 +3623,6 @@ var YjsRoom = class extends BaseRoom {
3611
3623
 
3612
3624
  // src/server/rooms/canvas-room.ts
3613
3625
  import * as Y5 from "yjs";
3614
-
3615
- // src/shared/roles.ts
3616
- var ROLES = {
3617
- VIEWER: "viewer",
3618
- MEMBER: "member",
3619
- ADMIN: "admin"
3620
- };
3621
-
3622
- // src/server/rooms/canvas-room.ts
3623
3626
  var CANVAS_WRITE_TYPES = /* @__PURE__ */ new Set([
3624
3627
  MSG.CANVAS_ADD,
3625
3628
  MSG.CANVAS_MOVE,
@@ -5626,7 +5629,7 @@ var CHANNELS_SCHEMA = {
5626
5629
  {
5627
5630
  name: "type",
5628
5631
  storage: "text",
5629
- interpretation: { kind: "select", options: ["public", "private", "dm"] }
5632
+ interpretation: { kind: "select", options: ["public"] }
5630
5633
  },
5631
5634
  {
5632
5635
  name: "createdBy",
@@ -5702,44 +5705,6 @@ var CHANNEL_MEMBERS_SCHEMA = {
5702
5705
  viewer: { read: true, create: false, update: false, delete: false }
5703
5706
  }
5704
5707
  };
5705
- var CHANNEL_INVITATIONS_SCHEMA = {
5706
- name: "channel-invitations",
5707
- columns: [
5708
- {
5709
- name: "channelId",
5710
- storage: "text",
5711
- interpretation: "plain",
5712
- required: true,
5713
- immutable: true
5714
- },
5715
- {
5716
- name: "invitedUserId",
5717
- storage: "text",
5718
- interpretation: "plain",
5719
- required: true,
5720
- immutable: true
5721
- },
5722
- {
5723
- name: "invitedBy",
5724
- storage: "text",
5725
- interpretation: "plain",
5726
- userBound: true,
5727
- immutable: true
5728
- },
5729
- {
5730
- name: "status",
5731
- storage: "text",
5732
- interpretation: { kind: "select", options: ["pending", "accepted", "declined"] },
5733
- required: true
5734
- }
5735
- ],
5736
- uniqueOn: ["channelId", "invitedUserId"],
5737
- permissions: {
5738
- admin: { read: true, create: true, update: true, delete: true },
5739
- member: { read: true, create: true, update: true, delete: false },
5740
- viewer: { read: true, create: false, update: false, delete: false }
5741
- }
5742
- };
5743
5708
  var READ_RECEIPTS_SCHEMA = {
5744
5709
  name: "read-receipts",
5745
5710
  columns: [
@@ -5756,228 +5721,6 @@ var READ_RECEIPTS_SCHEMA = {
5756
5721
  }
5757
5722
  };
5758
5723
 
5759
- // src/server/schemas/conversation.ts
5760
- var CONVERSATION_SCHEMAS = [
5761
- {
5762
- name: "conv_messages",
5763
- columns: [
5764
- { name: "Content", storage: "text", interpretation: "plain" },
5765
- { name: "AuthorId", storage: "text", interpretation: "plain" },
5766
- { name: "ParentId", storage: "text", interpretation: "plain" },
5767
- { name: "Edited", storage: "number", interpretation: "boolean" },
5768
- { name: "MessageType", storage: "text", interpretation: "plain" },
5769
- { name: "Metadata", storage: "text", interpretation: "json" }
5770
- ],
5771
- permissions: {
5772
- viewer: { read: true, create: false, update: false, delete: false },
5773
- member: { read: true, create: true, update: "own", delete: "own" },
5774
- admin: { read: true, create: true, update: true, delete: true }
5775
- },
5776
- ownerField: "AuthorId"
5777
- },
5778
- {
5779
- name: "conv_reactions",
5780
- columns: [
5781
- { name: "MessageId", storage: "text", interpretation: "plain" },
5782
- { name: "Emoji", storage: "text", interpretation: "plain" },
5783
- { name: "UserId", storage: "text", interpretation: "plain" }
5784
- ],
5785
- uniqueOn: ["MessageId", "Emoji", "UserId"],
5786
- permissions: {
5787
- viewer: { read: true, create: false, update: false, delete: false },
5788
- member: { read: true, create: true, update: false, delete: "own" },
5789
- admin: { read: true, create: true, update: false, delete: true }
5790
- },
5791
- ownerField: "UserId"
5792
- },
5793
- {
5794
- name: "conv_members",
5795
- columns: [
5796
- { name: "UserId", storage: "text", interpretation: "plain" },
5797
- { name: "UserName", storage: "text", interpretation: "plain" },
5798
- { name: "Role", storage: "text", interpretation: "plain" }
5799
- ],
5800
- uniqueOn: ["UserId"],
5801
- permissions: {
5802
- viewer: { read: true, create: false, update: false, delete: false },
5803
- member: { read: true, create: true, update: "own", delete: false },
5804
- admin: { read: true, create: true, update: true, delete: true }
5805
- },
5806
- ownerField: "UserId"
5807
- },
5808
- {
5809
- name: "conv_read_cursors",
5810
- columns: [
5811
- { name: "UserId", storage: "text", interpretation: "plain" },
5812
- { name: "LastReadAt", storage: "text", interpretation: "plain" }
5813
- ],
5814
- uniqueOn: ["UserId"],
5815
- permissions: {
5816
- viewer: { read: true, create: false, update: false, delete: false },
5817
- member: { read: true, create: true, update: "own", delete: false },
5818
- admin: { read: true, create: true, update: true, delete: true }
5819
- },
5820
- ownerField: "UserId"
5821
- }
5822
- ];
5823
- var VOTING_SCHEMAS = [
5824
- {
5825
- name: "conv_votes",
5826
- columns: [
5827
- { name: "TargetId", storage: "text", interpretation: "plain" },
5828
- { name: "UserId", storage: "text", interpretation: "plain" },
5829
- { name: "Direction", storage: "number", interpretation: "plain" }
5830
- ],
5831
- uniqueOn: ["TargetId", "UserId"],
5832
- permissions: {
5833
- viewer: { read: true, create: false, update: false, delete: false },
5834
- member: { read: true, create: true, update: "own", delete: "own" },
5835
- admin: { read: true, create: true, update: true, delete: true }
5836
- },
5837
- ownerField: "UserId"
5838
- }
5839
- ];
5840
-
5841
- // src/server/schemas/directory.ts
5842
- var conversationsSchema = {
5843
- name: "conversations",
5844
- columns: [
5845
- { name: "Name", storage: "text", interpretation: "plain" },
5846
- { name: "Description", storage: "text", interpretation: "plain" },
5847
- { name: "Type", storage: "text", interpretation: { kind: "select", options: ["public", "private", "dm", "group", "email", "outbound-email", "support", "announcement"] } },
5848
- { name: "Visibility", storage: "text", interpretation: { kind: "select", options: ["public", "private", "restricted"] } },
5849
- { name: "CreatedBy", storage: "text", interpretation: "plain" },
5850
- { name: "ParticipantHash", storage: "text", interpretation: "plain" },
5851
- { name: "ParticipantIds", storage: "text", interpretation: "json" },
5852
- { name: "Status", storage: "text", interpretation: { kind: "select", options: ["active", "archived", "resolved", "closed"] } },
5853
- { name: "AssigneeId", storage: "text", interpretation: "plain" },
5854
- { name: "LinkedRef", storage: "text", interpretation: "json" },
5855
- { name: "LastMessageAt", storage: "text", interpretation: { kind: "datetime" } },
5856
- { name: "LastMessagePreview", storage: "text", interpretation: "plain" },
5857
- { name: "LastMessageAuthor", storage: "text", interpretation: "plain" },
5858
- { name: "MessageCount", storage: "number", interpretation: "plain" }
5859
- ],
5860
- collaboratorsField: "ParticipantIds",
5861
- visibilityField: "Visibility",
5862
- permissions: {
5863
- viewer: { read: "shared", create: false, update: false, delete: false },
5864
- member: { read: "shared", create: true, update: true, delete: "own" },
5865
- admin: { read: true, create: true, update: true, delete: true }
5866
- },
5867
- ownerField: "CreatedBy"
5868
- };
5869
- var conversationStateSchema = {
5870
- name: "conversation_state",
5871
- columns: [
5872
- { name: "ConversationId", storage: "text", interpretation: "plain" },
5873
- { name: "UserId", storage: "text", interpretation: "plain" },
5874
- { name: "LastReadAt", storage: "text", interpretation: { kind: "datetime" } },
5875
- { name: "LastReadMessageCount", storage: "number", interpretation: "plain" },
5876
- { name: "Starred", storage: "number", interpretation: "boolean" },
5877
- { name: "Archived", storage: "number", interpretation: "boolean" },
5878
- { name: "Trashed", storage: "number", interpretation: "boolean" },
5879
- { name: "Labels", storage: "text", interpretation: "json" },
5880
- { name: "Folder", storage: "text", interpretation: "plain" }
5881
- ],
5882
- uniqueOn: ["ConversationId", "UserId"],
5883
- ownerField: "UserId",
5884
- permissions: {
5885
- viewer: { read: false, create: false, update: false, delete: false },
5886
- member: { read: "own", create: true, update: "own", delete: false },
5887
- admin: { read: true, create: true, update: true, delete: true }
5888
- }
5889
- };
5890
- var communitiesSchema = {
5891
- name: "communities",
5892
- columns: [
5893
- { name: "Name", storage: "text", interpretation: "plain" },
5894
- { name: "Description", storage: "text", interpretation: "plain" },
5895
- { name: "CreatedBy", storage: "text", interpretation: "plain" },
5896
- { name: "Type", storage: "text", interpretation: { kind: "select", options: ["community", "forum", "board", "project", "server"] } },
5897
- { name: "Visibility", storage: "text", interpretation: { kind: "select", options: ["public", "private", "restricted"] } },
5898
- { name: "MemberCount", storage: "number", interpretation: "plain" },
5899
- { name: "Rules", storage: "text", interpretation: "json" },
5900
- { name: "IconUrl", storage: "text", interpretation: "plain" },
5901
- { name: "CoverUrl", storage: "text", interpretation: "plain" }
5902
- ],
5903
- uniqueOn: ["Name"],
5904
- permissions: {
5905
- viewer: { read: true, create: false, update: false, delete: false },
5906
- member: { read: true, create: true, update: "own", delete: false },
5907
- admin: { read: true, create: true, update: true, delete: true }
5908
- },
5909
- ownerField: "CreatedBy"
5910
- };
5911
- var membershipsSchema = {
5912
- name: "memberships",
5913
- columns: [
5914
- { name: "CommunityId", storage: "text", interpretation: "plain" },
5915
- { name: "UserId", storage: "text", interpretation: "plain" },
5916
- { name: "UserName", storage: "text", interpretation: "plain" },
5917
- { name: "Role", storage: "text", interpretation: { kind: "select", options: ["member", "moderator", "admin"] } },
5918
- { name: "JoinedAt", storage: "text", interpretation: { kind: "datetime" } }
5919
- ],
5920
- uniqueOn: ["CommunityId", "UserId"],
5921
- permissions: {
5922
- viewer: { read: true, create: false, update: false, delete: false },
5923
- member: { read: true, create: true, update: "own", delete: "own" },
5924
- admin: { read: true, create: true, update: true, delete: true }
5925
- },
5926
- ownerField: "UserId"
5927
- };
5928
- var postsSchema = {
5929
- name: "posts",
5930
- columns: [
5931
- { name: "Title", storage: "text", interpretation: "plain" },
5932
- { name: "Content", storage: "text", interpretation: "plain" },
5933
- { name: "AuthorId", storage: "text", interpretation: "plain" },
5934
- { name: "Type", storage: "text", interpretation: { kind: "select", options: ["post", "question", "answer", "tweet", "announcement", "link"] } },
5935
- { name: "CommunityId", storage: "text", interpretation: "plain" },
5936
- { name: "ParentId", storage: "text", interpretation: "plain" },
5937
- { name: "ConversationId", storage: "text", interpretation: "plain" },
5938
- { name: "Status", storage: "text", interpretation: { kind: "select", options: ["draft", "published", "pinned", "archived", "accepted"] } },
5939
- { name: "Tags", storage: "text", interpretation: "json" },
5940
- { name: "LinkUrl", storage: "text", interpretation: "plain" }
5941
- ],
5942
- permissions: {
5943
- viewer: { read: true, create: false, update: false, delete: false },
5944
- member: { read: true, create: true, update: "own", delete: "own" },
5945
- admin: { read: true, create: true, update: true, delete: true }
5946
- },
5947
- ownerField: "AuthorId"
5948
- };
5949
- var DIRECTORY_SCHEMAS = [
5950
- conversationsSchema,
5951
- conversationStateSchema,
5952
- communitiesSchema,
5953
- membershipsSchema,
5954
- postsSchema
5955
- ];
5956
-
5957
- // src/server/schemas/shared-do.ts
5958
- var GLOBAL_DO_TYPES = [
5959
- {
5960
- name: "conv",
5961
- schemas: [...CONVERSATION_SCHEMAS, ...VOTING_SCHEMAS],
5962
- description: "Conversations (messages, reactions, members, voting)"
5963
- },
5964
- {
5965
- name: "dir",
5966
- schemas: DIRECTORY_SCHEMAS,
5967
- description: "App directory (conversations, communities, posts) \u2014 cross-app accessible"
5968
- }
5969
- ];
5970
- var GLOBAL_DO_TYPE_NAMES = GLOBAL_DO_TYPES.map((t) => t.name);
5971
- function getGlobalDOType(name) {
5972
- return GLOBAL_DO_TYPES.find((t) => t.name === name) ?? null;
5973
- }
5974
- function getGlobalDOSchemas(typeName) {
5975
- return getGlobalDOType(typeName)?.schemas ?? [];
5976
- }
5977
- var RESERVED_COLLECTION_NAMES = new Set(
5978
- GLOBAL_DO_TYPES.flatMap((t) => t.schemas.map((s) => s.name))
5979
- );
5980
-
5981
5724
  // src/shared/protocol/app-migrations.ts
5982
5725
  var APP_MIGRATION_ID_RE = /^[a-z0-9][a-z0-9._-]{0,127}$/;
5983
5726
  var MAX_APP_MIGRATION_IDS = 256;
@@ -7778,7 +7521,7 @@ async function resolveAppRole(env, userId) {
7778
7521
  );
7779
7522
  const json = await res.json();
7780
7523
  const role = json.data?.record?.data?.role;
7781
- return json.success && (role === "admin" || role === "member") ? role : "viewer";
7524
+ return json.success && isWriterRole(role) ? role : "viewer";
7782
7525
  } catch {
7783
7526
  return "viewer";
7784
7527
  }
@@ -10548,10 +10291,8 @@ export {
10548
10291
  BUILT_IN_TOOLS,
10549
10292
  BaseRoom,
10550
10293
  CHANNELS_SCHEMA,
10551
- CHANNEL_INVITATIONS_SCHEMA,
10552
10294
  CHANNEL_MEMBERS_SCHEMA,
10553
10295
  CLIENT_LOG_MARKER,
10554
- CONVERSATION_SCHEMAS,
10555
10296
  COST_RATES,
10556
10297
  CanvasRoom,
10557
10298
  CronRoom,
@@ -10564,11 +10305,8 @@ export {
10564
10305
  DEFAULT_DO_MANIFEST,
10565
10306
  DEFAULT_QUERY_LIMIT,
10566
10307
  DEPLOYED_APPS_DEFAULTS,
10567
- DIRECTORY_SCHEMAS,
10568
10308
  DeepSpaceAgentModelError,
10569
10309
  DeepSpaceAgentProfileError,
10570
- GLOBAL_DO_TYPES,
10571
- GLOBAL_DO_TYPE_NAMES,
10572
10310
  JobRoom,
10573
10311
  KnowledgeError,
10574
10312
  LOG_LEVELS,
@@ -10596,7 +10334,6 @@ export {
10596
10334
  REPO_STORE_LIMIT_BYTES,
10597
10335
  REQUIRED_COMPATIBILITY_FLAGS,
10598
10336
  RESERVED_BINDING_NAMES,
10599
- RESERVED_COLLECTION_NAMES,
10600
10337
  RESERVED_RUN_WORKER_FIRST,
10601
10338
  RESOURCE_ID_RE,
10602
10339
  ROLE_ADMIN,
@@ -10616,7 +10353,6 @@ export {
10616
10353
  UNDECLARED_ASSET_NOT_FOUND_HANDLING,
10617
10354
  UPLOAD_PART_BYTES,
10618
10355
  USERS_COLUMNS,
10619
- VOTING_SCHEMAS,
10620
10356
  WORKER_OWNED_NOT_FOUND_MIGRATION_ID,
10621
10357
  YjsRoom,
10622
10358
  analyzePermissions,
@@ -10669,8 +10405,6 @@ export {
10669
10405
  formatBytes,
10670
10406
  getChat,
10671
10407
  getDeepSpaceAIModel,
10672
- getGlobalDOSchemas,
10673
- getGlobalDOType,
10674
10408
  getMessageType,
10675
10409
  getRolePermissions,
10676
10410
  handleAwarenessMessage,