deepspace 0.6.2 → 0.7.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/dist/worker.d.ts CHANGED
@@ -5,6 +5,7 @@ import * as zod from 'zod';
5
5
  import * as better_auth from 'better-auth';
6
6
  import { betterAuth } from 'better-auth';
7
7
  import * as better_auth_plugins from 'better-auth/plugins';
8
+ import { Hono } from 'hono';
8
9
 
9
10
  /**
10
11
  * Wire protocol constants.
@@ -4498,4 +4499,148 @@ type DeepSpaceAuth = ReturnType<typeof createDeepSpaceAuth>;
4498
4499
  /** Collections that bypass schema checks (permissive access) */
4499
4500
  declare const SYSTEM_COLLECTIONS: Set<string>;
4500
4501
 
4501
- 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 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 ServerMessage, type SharedConnection, type StoredRecord, type Summarizer, type SyncResult, TEST_ACCOUNT_EMAIL_SUFFIX, 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, 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, dataToColumnValues, decodeJwtPayload, deleteChatCascade, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, enqueueJob, getChat, getGlobalDOSchemas, getGlobalDOType, getMessageType, getRolePermissions, handleAwarenessMessage, handleSyncMessage, hasContent, isAutoProvision, isOwner, isTestAccountClaims, isTestAccountEmail, isTestAccountTier, lintSchema, loadMessages, makeDefaultSummarizer, meterAi, meterUsage, meterVectorize, noopPermissionContext, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, readVarUint, readVarUint8Array, resolveAppName, resolveColumn, rowToData, runMigrations, serverBuild, timingSafeEqualHex, timingSafeEqualStrings, toUint8Array, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema, writeVarUint, writeVarUint8Array };
4502
+ /**
4503
+ * Client-error ingestion route (opt-in) — the Worker half of client-side
4504
+ * error reporting.
4505
+ *
4506
+ * Mount it in your app Worker with a single line:
4507
+ *
4508
+ * import { registerClientErrorRoute } from 'deepspace/worker'
4509
+ * registerClientErrorRoute(app) // BEFORE the app.all('/_deepspace/*') proxy
4510
+ *
4511
+ * Then, in the browser, `installClientErrorReporter()` (from 'deepspace')
4512
+ * forwards uncaught errors here. The handler runs in the app's OWN Worker, so
4513
+ * the `console.error` it emits is tagged by Cloudflare with this app's id —
4514
+ * meaning a browser can only ever write to its own app's log stream, never
4515
+ * another tenant's or the platform's. Reports then surface in `deepspace logs`
4516
+ * (and the dashboard) tagged `CLIENT`.
4517
+ *
4518
+ * Anonymous by design (logged-out visitors hit client errors too), so the
4519
+ * defenses are size caps (normalizeClientErrorReport) + a best-effort
4520
+ * per-isolate throttle. It never blocks the page: it returns 204 and swallows
4521
+ * work quickly.
4522
+ */
4523
+
4524
+ /**
4525
+ * Handle one client-error report. Framework-agnostic — pass a raw `Request`.
4526
+ * Returns 204 on success, 400 on a malformed/empty body, 429 when throttled.
4527
+ */
4528
+ declare function handleClientErrorReport(request: Request): Promise<Response>;
4529
+ /**
4530
+ * Register `POST /_deepspace/client-errors` on your Hono app. Mount it BEFORE
4531
+ * the `app.all('/_deepspace/*')` proxy so the specific route wins the match.
4532
+ */
4533
+ declare function registerClientErrorRoute(app: Hono<any, any, any>): void;
4534
+
4535
+ /**
4536
+ * Client-side error reporting — shared contract.
4537
+ *
4538
+ * Browser JS errors never invoke the app's Worker, so they never reach
4539
+ * Workers Logs and are invisible to `deepspace logs`. The opt-in reporter
4540
+ * (`installClientErrorReporter`, client entry) forwards them to the app's own
4541
+ * Worker via `registerClientErrorRoute` (worker entry), which `console.error`s
4542
+ * a marker-prefixed envelope. The platform log reader recognises the marker
4543
+ * and tags the event `source: 'client'`.
4544
+ *
4545
+ * This module is isomorphic — no DOM, no Hono — so both halves import the
4546
+ * exact same marker, caps, and normaliser and can never drift.
4547
+ */
4548
+ /**
4549
+ * Prefix the Worker route prepends before JSON-stringifying a report into a
4550
+ * single `console.error` line. The platform mapper
4551
+ * (platform/deploy-worker/src/lib/workers-logs.ts) detects this prefix to set
4552
+ * `source: 'client'`. Deliberately distinctive so an ordinary app log is
4553
+ * vanishingly unlikely to collide. The marker is added SERVER-SIDE by the app
4554
+ * Worker — a browser cannot forge it onto a genuine server log.
4555
+ *
4556
+ * The platform copy is kept in sync by a drift test; if you change this
4557
+ * string, that test fails until the platform const matches.
4558
+ */
4559
+ declare const CLIENT_LOG_MARKER = "[deepspace:client-error]";
4560
+ type ClientErrorKind = 'error' | 'unhandledrejection' | 'react';
4561
+ /** A sanitized, capped browser-error report — the wire + log-line payload. */
4562
+ interface ClientErrorReport {
4563
+ kind: ClientErrorKind;
4564
+ message: string;
4565
+ name?: string;
4566
+ stack?: string;
4567
+ /** Page URL where it fired (href or the script filename). */
4568
+ url?: string;
4569
+ line?: number;
4570
+ col?: number;
4571
+ }
4572
+
4573
+ /**
4574
+ * `deepspace logs` wire DTO — the single source of truth for the whitelisted
4575
+ * shape the platform telemetry reader emits and every consumer reads.
4576
+ *
4577
+ * The producer is `platform/deploy-worker/src/lib/workers-logs.ts` (which
4578
+ * rebuilds each event field-by-field from a raw Cloudflare row — see the
4579
+ * security invariant there). The consumers are the CLI tail
4580
+ * (`cli/commands/logs.ts`), the dashboard Logs panel
4581
+ * (`apps/dashboard/src/lib/types.ts`), and the e2e whitelist assertion
4582
+ * (`tests/e2e/tests/logs.spec.ts`). This module used to be hand-mirrored in
4583
+ * all four places; `source` was added to three of them and missed in the
4584
+ * e2e whitelist, so it now lives here once and they import it.
4585
+ *
4586
+ * Isomorphic — no DOM, no Hono, no platform types — so it re-exports cleanly
4587
+ * from both `deepspace` (client) and `deepspace/worker` and is safe to import
4588
+ * from the private deploy-worker.
4589
+ */
4590
+ declare const LOG_LEVELS: readonly ["debug", "log", "info", "warn", "error"];
4591
+ type LogLevel = (typeof LOG_LEVELS)[number];
4592
+ /** One log / request / exception event, rebuilt field-by-field from a CF row. */
4593
+ interface AppLogEvent {
4594
+ /** `$metadata.id` — unique per event; the client's dedupe key. */
4595
+ id: string;
4596
+ /** Unix ms. */
4597
+ timestamp: number;
4598
+ level: LogLevel;
4599
+ eventType: 'log' | 'request' | 'exception' | 'other';
4600
+ message: string;
4601
+ /**
4602
+ * Present (= `'client'`) only for a browser-forwarded error the app's own
4603
+ * Worker re-logged via `registerClientErrorRoute`. Absent means the log was
4604
+ * emitted server-side — there is no explicit `'server'` value, so consumers
4605
+ * branch on `source === 'client'`, never on a truthy/other check.
4606
+ */
4607
+ source?: 'client';
4608
+ /** Invocation outcome (`ok`, `exception`, `exceededCpu`, …) when present. */
4609
+ outcome?: string;
4610
+ request?: {
4611
+ method: string;
4612
+ path: string;
4613
+ status?: number;
4614
+ };
4615
+ exception?: {
4616
+ name: string;
4617
+ message: string;
4618
+ stack?: string;
4619
+ };
4620
+ }
4621
+ interface AppLogsResponse {
4622
+ /** Ascending by timestamp (CF returns newest-first; the reader flips). */
4623
+ events: AppLogEvent[];
4624
+ /** Max event timestamp in ms — pass back as `since` to poll; null when empty. */
4625
+ cursor: number | null;
4626
+ /** True when the window returned `limit` events (older events were cut). */
4627
+ truncated: boolean;
4628
+ pollIntervalMs: number;
4629
+ }
4630
+ /**
4631
+ * Runtime tuple of every key a whitelisted `AppLogEvent` may carry — the
4632
+ * canonical whitelist the e2e suite mirrors when asserting no event leaks a key
4633
+ * outside this set. The two type-level assertions below fail compilation if
4634
+ * this tuple and the `AppLogEvent` interface disagree in either direction, so
4635
+ * adding an interface field forces a matching key here.
4636
+ *
4637
+ * NOTE: the e2e spec keeps its OWN copy of this set (it can't import the SDK —
4638
+ * `@deepspace/e2e` has no `deepspace` dependency), kept in step by a comment,
4639
+ * not by these compile-time guards. So this tuple hardens the code copies
4640
+ * (deploy-worker/CLI/dashboard, which import it), while the e2e mirror remains a
4641
+ * knowingly-accepted duplicate.
4642
+ */
4643
+ declare const APP_LOG_EVENT_KEYS: readonly ["id", "timestamp", "level", "eventType", "message", "source", "outcome", "request", "exception"];
4644
+ type AppLogEventKey = (typeof APP_LOG_EVENT_KEYS)[number];
4645
+
4646
+ export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, ALLOWED_BINDING_TYPES, APP_LOG_EVENT_KEYS, APP_NAME_RULES, AUTO_PROVISIONABLE_TYPES, AUTO_PROVISION_SENTINEL, type ActionContext, type ActionHandler, type ActionResult, type ActionTools, type ApiWorkerEnv, type AppLogEvent, type AppLogEventKey, type AppLogsResponse, 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, 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, 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, LOG_LEVELS, type LogLevel, 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, TEST_ACCOUNT_EMAIL_SUFFIX, 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, 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, dataToColumnValues, decodeJwtPayload, deleteChatCascade, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, enqueueJob, getChat, getGlobalDOSchemas, getGlobalDOType, getMessageType, getRolePermissions, handleAwarenessMessage, handleClientErrorReport, handleSyncMessage, hasContent, isAutoProvision, isOwner, isTestAccountClaims, isTestAccountEmail, isTestAccountTier, lintSchema, loadMessages, makeDefaultSummarizer, meterAi, meterUsage, meterVectorize, noopPermissionContext, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, readVarUint, readVarUint8Array, registerClientErrorRoute, resolveAppName, resolveColumn, rowToData, runMigrations, serverBuild, timingSafeEqualHex, timingSafeEqualStrings, toUint8Array, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema, writeVarUint, writeVarUint8Array };
package/dist/worker.js CHANGED
@@ -7317,10 +7317,111 @@ async function generateAppleClientSecret(apple) {
7317
7317
  cachedAppleSecret = { keyId: apple.keyId, token, expiresAt };
7318
7318
  return token;
7319
7319
  }
7320
+
7321
+ // src/shared/client-errors.ts
7322
+ var CLIENT_LOG_MARKER = "[deepspace:client-error]";
7323
+ var CLIENT_ERROR_PATH = "/_deepspace/client-errors";
7324
+ var CLIENT_ERROR_CAPS = {
7325
+ message: 1024,
7326
+ stack: 4096,
7327
+ name: 256,
7328
+ url: 512
7329
+ };
7330
+ function capText(value, max) {
7331
+ if (typeof value !== "string") return void 0;
7332
+ return value.length > max ? value.slice(0, max) : value;
7333
+ }
7334
+ function finiteNumber(value) {
7335
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
7336
+ }
7337
+ function normalizeClientErrorReport(raw) {
7338
+ if (typeof raw !== "object" || raw === null) return null;
7339
+ const o = raw;
7340
+ const kind = o.kind === "unhandledrejection" || o.kind === "react" ? o.kind : "error";
7341
+ const message = capText(o.message, CLIENT_ERROR_CAPS.message) ?? "";
7342
+ const name = capText(o.name, CLIENT_ERROR_CAPS.name);
7343
+ const stack = capText(o.stack, CLIENT_ERROR_CAPS.stack);
7344
+ const url = capText(o.url, CLIENT_ERROR_CAPS.url);
7345
+ const line = finiteNumber(o.line);
7346
+ const col = finiteNumber(o.col);
7347
+ if (!message && !stack) return null;
7348
+ const report = { kind, message: message || (name ?? "Error") };
7349
+ if (name) report.name = name;
7350
+ if (stack) report.stack = stack;
7351
+ if (url) report.url = url;
7352
+ if (line !== void 0) report.line = line;
7353
+ if (col !== void 0) report.col = col;
7354
+ return report;
7355
+ }
7356
+ function clientErrorToLogLine(report) {
7357
+ return `${CLIENT_LOG_MARKER} ${JSON.stringify(report)}`;
7358
+ }
7359
+
7360
+ // src/server/client-errors.ts
7361
+ var THROTTLE_WINDOW_MS = 1e3;
7362
+ var THROTTLE_MAX = 20;
7363
+ var windowStart = 0;
7364
+ var windowCount = 0;
7365
+ var MAX_BODY_BYTES = 64 * 1024;
7366
+ function shouldThrottleClientError(now = Date.now()) {
7367
+ if (now - windowStart >= THROTTLE_WINDOW_MS) {
7368
+ windowStart = now;
7369
+ windowCount = 0;
7370
+ }
7371
+ windowCount += 1;
7372
+ return windowCount > THROTTLE_MAX;
7373
+ }
7374
+ function jsonResponse(body, status) {
7375
+ return new Response(JSON.stringify(body), {
7376
+ status,
7377
+ headers: { "Content-Type": "application/json" }
7378
+ });
7379
+ }
7380
+ async function handleClientErrorReport(request) {
7381
+ const site = request.headers.get("sec-fetch-site");
7382
+ if (site && site !== "same-origin" && site !== "none") {
7383
+ return new Response(null, { status: 403 });
7384
+ }
7385
+ if (shouldThrottleClientError()) {
7386
+ return new Response(null, { status: 429, headers: { "Retry-After": "1" } });
7387
+ }
7388
+ const declared = Number(request.headers.get("content-length"));
7389
+ if (Number.isFinite(declared) && declared > MAX_BODY_BYTES) {
7390
+ return jsonResponse({ error: "payload_too_large" }, 413);
7391
+ }
7392
+ let body;
7393
+ try {
7394
+ body = await request.json();
7395
+ } catch {
7396
+ return jsonResponse({ error: "invalid_json" }, 400);
7397
+ }
7398
+ const report = normalizeClientErrorReport(body);
7399
+ if (!report) return jsonResponse({ error: "invalid_report" }, 400);
7400
+ console.error(clientErrorToLogLine(report));
7401
+ return new Response(null, { status: 204 });
7402
+ }
7403
+ function registerClientErrorRoute(app) {
7404
+ app.post(CLIENT_ERROR_PATH, (c) => handleClientErrorReport(c.req.raw));
7405
+ }
7406
+
7407
+ // src/shared/log-events.ts
7408
+ var LOG_LEVELS = ["debug", "log", "info", "warn", "error"];
7409
+ var APP_LOG_EVENT_KEYS = [
7410
+ "id",
7411
+ "timestamp",
7412
+ "level",
7413
+ "eventType",
7414
+ "message",
7415
+ "source",
7416
+ "outcome",
7417
+ "request",
7418
+ "exception"
7419
+ ];
7320
7420
  export {
7321
7421
  AI_CHATS_SCHEMA,
7322
7422
  AI_MESSAGES_SCHEMA,
7323
7423
  ALLOWED_BINDING_TYPES,
7424
+ APP_LOG_EVENT_KEYS,
7324
7425
  APP_NAME_RULES,
7325
7426
  AUTO_PROVISIONABLE_TYPES,
7326
7427
  AUTO_PROVISION_SENTINEL,
@@ -7331,6 +7432,7 @@ export {
7331
7432
  CHANNELS_SCHEMA,
7332
7433
  CHANNEL_INVITATIONS_SCHEMA,
7333
7434
  CHANNEL_MEMBERS_SCHEMA,
7435
+ CLIENT_LOG_MARKER,
7334
7436
  CONVERSATION_SCHEMAS,
7335
7437
  COST_RATES,
7336
7438
  CanvasRoom,
@@ -7343,6 +7445,7 @@ export {
7343
7445
  GLOBAL_DO_TYPE_NAMES,
7344
7446
  GameRoom,
7345
7447
  JobRoom,
7448
+ LOG_LEVELS,
7346
7449
  MESSAGES_SCHEMA,
7347
7450
  MSG,
7348
7451
  MSG_AWARENESS,
@@ -7415,6 +7518,7 @@ export {
7415
7518
  getMessageType,
7416
7519
  getRolePermissions,
7417
7520
  handleAwarenessMessage,
7521
+ handleClientErrorReport,
7418
7522
  handleSyncMessage,
7419
7523
  hasContent,
7420
7524
  isAutoProvision,
@@ -7434,6 +7538,7 @@ export {
7434
7538
  priceBindingUsageEvent,
7435
7539
  readVarUint,
7436
7540
  readVarUint8Array,
7541
+ registerClientErrorRoute,
7437
7542
  resolveAppName,
7438
7543
  resolveColumn,
7439
7544
  rowToData,