deepspace 0.8.2 → 0.9.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.
- package/CHANGELOG.md +38 -0
- package/README.md +54 -4
- package/dist/cli.js +1599 -273
- package/dist/cli.js.map +1 -1
- package/dist/server.d.ts +5 -3
- package/dist/server.js +17 -5
- package/dist/server.js.map +1 -1
- package/dist/testing.d.ts +115 -0
- package/dist/worker.d.ts +5 -3
- package/dist/worker.js +17 -5
- package/dist/worker.js.map +1 -1
- package/package.json +6 -21
package/dist/server.d.ts
CHANGED
|
@@ -70,10 +70,11 @@ declare function parseQuotaLimit(raw: string | undefined, fallback: number): num
|
|
|
70
70
|
*/
|
|
71
71
|
/** The singleton registry instance — one DO holds every app/route/collaborator. */
|
|
72
72
|
declare const REGISTRY_INSTANCE = "v1:global";
|
|
73
|
-
/**
|
|
73
|
+
/** Public app ids have one canonical ULID-minted shape. */
|
|
74
74
|
declare const APP_ID_RE: RegExp;
|
|
75
|
-
/** ONLY a ULID-minted id — surfaces that must not accept a legacy name. */
|
|
76
75
|
declare const STRICT_APP_ID_RE: RegExp;
|
|
76
|
+
/** Internal physical locators survive identity migration and are not public ids. */
|
|
77
|
+
declare const RESOURCE_ID_RE: RegExp;
|
|
77
78
|
declare class RegistryClientError extends Error {
|
|
78
79
|
readonly code: string;
|
|
79
80
|
readonly status: number;
|
|
@@ -1062,6 +1063,7 @@ declare function appendMessage(stub: DurableObjectStub, msg: {
|
|
|
1062
1063
|
interface MeteringEnv {
|
|
1063
1064
|
USAGE_EVENTS?: AnalyticsEngineDataset;
|
|
1064
1065
|
OWNER_USER_ID?: string;
|
|
1066
|
+
DEEPSPACE_RESOURCE_ID?: string;
|
|
1065
1067
|
APP_NAME?: string;
|
|
1066
1068
|
}
|
|
1067
1069
|
/**
|
|
@@ -4434,4 +4436,4 @@ declare class RefundError extends Error {
|
|
|
4434
4436
|
constructor(message: string, status: number);
|
|
4435
4437
|
}
|
|
4436
4438
|
|
|
4437
|
-
export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, ALLOWED_BINDING_TYPES, APP_ID_RE, 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, BASE_USERS_SCHEMA, BUILT_IN_TOOLS, BaseRoom, CHANNELS_SCHEMA, CHANNEL_INVITATIONS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, CONVERSATION_SCHEMAS, COST_RATES, CancelSubscriptionError, type CancelSubscriptionOpts, type CancelSubscriptionResult, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type CollectionPermissionSummary, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ComposioToolsOptions, 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, DEPLOYED_APPS_DEFAULTS, DIRECTORY_SCHEMAS, type DOBindings, type DOManifest, type DOManifestEntry, type DebugApiContext, 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 Job, type JobContext, JobRoom, type JobRoomConfig, type JobStatus, type JwtClaims, type JwtVerifierConfig, MESSAGES_SCHEMA, type MutateActionData, type PermissionAnalysis, type PermissionContext, type PermissionLevel, type PermissionSource, type PlanInfo, type PlatformWorkerEnv, type Player, type PrefixResult, type PresencePeer, PresenceRoom, type QueryActionData, REACTIONS_SCHEMA, READ_RECEIPTS_SCHEMA, REGISTRY_INSTANCE, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_NAMES, type RecordContext, RecordRoom, type RecordRoomConfig, RefundError, type RefundOpts, type RefundResult, RegistryClientError, type ResolvedColumn, type ResolvedPermission, type RolePermissions, type RunMigrationsResult, STRICT_APP_ID_RE, SYSTEM_COLLECTION_SCHEMAS, SYSTEM_MANAGED_COLUMNS, SchemaRegistry, type ScopeContext, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, type ScreenshotResult, type SharedConnection, type StoredRecord, SubscriptionAuthError, type SubscriptionContext, type SubscriptionRead, SubscriptionRequiredError, type SubscriptionStatus, type Summarizer, TEST_ACCOUNT_EMAIL_SUFFIX, type TokenDebugInfo, type ToolResult, type ToolSchema, type ToolsApiContext, USERS_COLUMNS, type User, type UserAttachment, type UserContext, VOTING_SCHEMAS, type ValidationError, type VerifiedAuth, type VerifyOutcome, type VerifyResult, type Viewport, WORKSPACE_SCHEMAS, type YjsContext, YjsRoom, analyzePermissions, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, authWorkerFetch, bindingManifestFromOutputConfig, broadcastChange, broadcastYjsUpdate, buildCronContext, buildTableSelect, buildUiParts, callRegistry, canCreate, canDelete, canRead, canUpdate, cancelSubscription, capToolResultSize, captureScreenshot, checkFieldPermissions, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDeepSpaceAI, createDeepSpaceAuth, createScopedR2Handler, dataToColumnValues, decodeJwtPayload, deleteChatCascade, deleteRecord, enqueueJob, executeQuery, getAllUsers, getChat, getGlobalDOSchemas, getGlobalDOType, getOrCreateYjsDoc, getRecord, getRolePermissions, getSubscription, getUser, getYjsDocKey, handleApiRequest, handleDelete, handlePut, handleSetRole, handleSubscribe, handleToolsRequest, handleUnsubscribe, handleUserList, handleUserUpdate, handleYjsBinaryMessage, handleYjsJoin, handleYjsLeave, isAutoProvision, isOwner, isTestAccountClaims, isTestAccountEmail, isTestAccountTier, lintSchema, loadMessages, makeDefaultSummarizer, matchOrigin, meterAi, meterUsage, meterVectorize, noopPermissionContext, parseQuotaLimit, platformCorsPatterns, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, putRecord, readRecord, recordMatchesSubscription, refundInvoice, registerUser, registryErrorJson, registryStub, requireSubscription, resolveAppName, resolveColumn, rowToData, runMigrations, saveYjsDoc, timingSafeEqualHex, timingSafeEqualStrings, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema };
|
|
4439
|
+
export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, ALLOWED_BINDING_TYPES, APP_ID_RE, 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, BASE_USERS_SCHEMA, BUILT_IN_TOOLS, BaseRoom, CHANNELS_SCHEMA, CHANNEL_INVITATIONS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, CONVERSATION_SCHEMAS, COST_RATES, CancelSubscriptionError, type CancelSubscriptionOpts, type CancelSubscriptionResult, CanvasRoom, type CanvasShape, type ChatContextConfig, type ChatMessageRow, type ChatRow, type ChatTurn, type CollectionPermissionSummary, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, type ComposioToolsOptions, 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, DEPLOYED_APPS_DEFAULTS, DIRECTORY_SCHEMAS, type DOBindings, type DOManifest, type DOManifestEntry, type DebugApiContext, 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 Job, type JobContext, JobRoom, type JobRoomConfig, type JobStatus, type JwtClaims, type JwtVerifierConfig, MESSAGES_SCHEMA, type MutateActionData, type PermissionAnalysis, type PermissionContext, type PermissionLevel, type PermissionSource, type PlanInfo, type PlatformWorkerEnv, type Player, type PrefixResult, type PresencePeer, PresenceRoom, type QueryActionData, REACTIONS_SCHEMA, READ_RECEIPTS_SCHEMA, REGISTRY_INSTANCE, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_NAMES, RESOURCE_ID_RE, type RecordContext, RecordRoom, type RecordRoomConfig, RefundError, type RefundOpts, type RefundResult, RegistryClientError, type ResolvedColumn, type ResolvedPermission, type RolePermissions, type RunMigrationsResult, STRICT_APP_ID_RE, SYSTEM_COLLECTION_SCHEMAS, SYSTEM_MANAGED_COLUMNS, SchemaRegistry, type ScopeContext, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, type ScreenshotResult, type SharedConnection, type StoredRecord, SubscriptionAuthError, type SubscriptionContext, type SubscriptionRead, SubscriptionRequiredError, type SubscriptionStatus, type Summarizer, TEST_ACCOUNT_EMAIL_SUFFIX, type TokenDebugInfo, type ToolResult, type ToolSchema, type ToolsApiContext, USERS_COLUMNS, type User, type UserAttachment, type UserContext, VOTING_SCHEMAS, type ValidationError, type VerifiedAuth, type VerifyOutcome, type VerifyResult, type Viewport, WORKSPACE_SCHEMAS, type YjsContext, YjsRoom, analyzePermissions, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, authWorkerFetch, bindingManifestFromOutputConfig, broadcastChange, broadcastYjsUpdate, buildCronContext, buildTableSelect, buildUiParts, callRegistry, canCreate, canDelete, canRead, canUpdate, cancelSubscription, capToolResultSize, captureScreenshot, checkFieldPermissions, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDeepSpaceAI, createDeepSpaceAuth, createScopedR2Handler, dataToColumnValues, decodeJwtPayload, deleteChatCascade, deleteRecord, enqueueJob, executeQuery, getAllUsers, getChat, getGlobalDOSchemas, getGlobalDOType, getOrCreateYjsDoc, getRecord, getRolePermissions, getSubscription, getUser, getYjsDocKey, handleApiRequest, handleDelete, handlePut, handleSetRole, handleSubscribe, handleToolsRequest, handleUnsubscribe, handleUserList, handleUserUpdate, handleYjsBinaryMessage, handleYjsJoin, handleYjsLeave, isAutoProvision, isOwner, isTestAccountClaims, isTestAccountEmail, isTestAccountTier, lintSchema, loadMessages, makeDefaultSummarizer, matchOrigin, meterAi, meterUsage, meterVectorize, noopPermissionContext, parseQuotaLimit, platformCorsPatterns, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, putRecord, readRecord, recordMatchesSubscription, refundInvoice, registerUser, registryErrorJson, registryStub, requireSubscription, resolveAppName, resolveColumn, rowToData, runMigrations, saveYjsDoc, timingSafeEqualHex, timingSafeEqualStrings, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema };
|
package/dist/server.js
CHANGED
|
@@ -31,8 +31,9 @@ function parseQuotaLimit(raw, fallback) {
|
|
|
31
31
|
|
|
32
32
|
// src/server/utils/registry-client.ts
|
|
33
33
|
var REGISTRY_INSTANCE = "v1:global";
|
|
34
|
-
var APP_ID_RE = /^
|
|
35
|
-
var STRICT_APP_ID_RE =
|
|
34
|
+
var APP_ID_RE = /^app_[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
35
|
+
var STRICT_APP_ID_RE = APP_ID_RE;
|
|
36
|
+
var RESOURCE_ID_RE = /^(app_[0-9A-HJKMNP-TV-Z]{26}|[a-z0-9][a-z0-9_-]{0,63})$/;
|
|
36
37
|
var RegistryClientError = class extends Error {
|
|
37
38
|
constructor(message, code, status) {
|
|
38
39
|
super(message);
|
|
@@ -1192,7 +1193,12 @@ function meterUsage(env, kind, fields = {}) {
|
|
|
1192
1193
|
try {
|
|
1193
1194
|
ds.writeDataPoint({
|
|
1194
1195
|
indexes: [env.OWNER_USER_ID ?? "unknown"],
|
|
1195
|
-
blobs: [
|
|
1196
|
+
blobs: [
|
|
1197
|
+
env.DEEPSPACE_RESOURCE_ID ?? env.APP_NAME ?? "unknown",
|
|
1198
|
+
kind,
|
|
1199
|
+
fields.id ?? "",
|
|
1200
|
+
fields.op ?? ""
|
|
1201
|
+
],
|
|
1196
1202
|
doubles: [fields.units ?? 0, fields.count ?? 0]
|
|
1197
1203
|
});
|
|
1198
1204
|
return true;
|
|
@@ -5991,6 +5997,8 @@ var RESERVED_BINDING_NAMES = /* @__PURE__ */ new Set([
|
|
|
5991
5997
|
"ASSETS",
|
|
5992
5998
|
"PLATFORM_WORKER",
|
|
5993
5999
|
"API_WORKER",
|
|
6000
|
+
"DEEPSPACE_APP_ID",
|
|
6001
|
+
"DEEPSPACE_RESOURCE_ID",
|
|
5994
6002
|
"APP_NAME",
|
|
5995
6003
|
"OWNER_USER_ID",
|
|
5996
6004
|
"AUTH_JWT_PUBLIC_KEY",
|
|
@@ -6008,7 +6016,9 @@ function validateBindingManifest(manifest) {
|
|
|
6008
6016
|
const seenNames = /* @__PURE__ */ new Set();
|
|
6009
6017
|
for (const entry of manifest) {
|
|
6010
6018
|
if (!entry || typeof entry !== "object") {
|
|
6011
|
-
errors.push({
|
|
6019
|
+
errors.push({
|
|
6020
|
+
reason: `Entry must be an object (got ${entry === null ? "null" : typeof entry})`
|
|
6021
|
+
});
|
|
6012
6022
|
continue;
|
|
6013
6023
|
}
|
|
6014
6024
|
const e = entry;
|
|
@@ -6057,7 +6067,8 @@ function requiredFieldError(b) {
|
|
|
6057
6067
|
case "r2_bucket":
|
|
6058
6068
|
return b.bucket_name ? null : `r2_bucket binding "${b.name}" missing bucket_name (or "auto")`;
|
|
6059
6069
|
case "kv_namespace": {
|
|
6060
|
-
if (!b.namespace_id)
|
|
6070
|
+
if (!b.namespace_id)
|
|
6071
|
+
return `kv_namespace binding "${b.name}" missing namespace_id (or "auto")`;
|
|
6061
6072
|
if (b.namespace_id === AUTO_PROVISION_SENTINEL && !b.title) {
|
|
6062
6073
|
return `kv_namespace binding "${b.name}" with namespace_id="auto" requires "title"`;
|
|
6063
6074
|
}
|
|
@@ -7323,6 +7334,7 @@ export {
|
|
|
7323
7334
|
REGISTRY_INSTANCE,
|
|
7324
7335
|
RESERVED_BINDING_NAMES,
|
|
7325
7336
|
RESERVED_COLLECTION_NAMES,
|
|
7337
|
+
RESOURCE_ID_RE,
|
|
7326
7338
|
RecordRoom,
|
|
7327
7339
|
RefundError,
|
|
7328
7340
|
RegistryClientError,
|