deepspace 0.4.4 → 0.4.5
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/cli.js +229 -1306
- package/dist/cli.js.map +1 -1
- package/dist/server.d.ts +2 -86
- package/dist/server.js +9 -495
- package/dist/server.js.map +1 -1
- package/dist/testing.d.ts +115 -0
- package/dist/worker.d.ts +2 -86
- package/dist/worker.js +9 -495
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as _playwright_test from '@playwright/test';
|
|
2
|
+
import { BrowserContext, Page, Browser } from '@playwright/test';
|
|
3
|
+
export { expect } from '@playwright/test';
|
|
4
|
+
|
|
5
|
+
interface MultiplayerUser {
|
|
6
|
+
context: BrowserContext;
|
|
7
|
+
page: Page;
|
|
8
|
+
email: string;
|
|
9
|
+
name: string;
|
|
10
|
+
/** Test account user ID, if known from the accounts registry. */
|
|
11
|
+
userId?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Fixture function signature. Pass either a count (`users(2)`) or an
|
|
15
|
+
* array of account names (`users(['Alice', 'Bob'])`). Returns one entry
|
|
16
|
+
* per requested user.
|
|
17
|
+
*/
|
|
18
|
+
type UsersFixture = (selector: number | string[], options?: {
|
|
19
|
+
label?: string;
|
|
20
|
+
}) => Promise<MultiplayerUser[]>;
|
|
21
|
+
interface MultiplayerFixtures {
|
|
22
|
+
users: UsersFixture;
|
|
23
|
+
}
|
|
24
|
+
declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & MultiplayerFixtures, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Account-credential plumbing for the testing module.
|
|
28
|
+
*
|
|
29
|
+
* Reads test accounts from `~/.deepspace/test-accounts.json` (the same
|
|
30
|
+
* file `deepspace test-accounts create` writes). Each account has at
|
|
31
|
+
* minimum `{email, password}`; `name` and `label` are optional.
|
|
32
|
+
*
|
|
33
|
+
* Used by the multi-user Playwright fixture in `./fixtures.ts` and is
|
|
34
|
+
* also exported standalone in case suites want to do their own
|
|
35
|
+
* orchestration.
|
|
36
|
+
*/
|
|
37
|
+
interface TestAccount {
|
|
38
|
+
email: string;
|
|
39
|
+
password: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
label?: string | null;
|
|
42
|
+
id?: string;
|
|
43
|
+
userId?: string;
|
|
44
|
+
createdAt?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Load all test accounts the developer has created. Returns an empty
|
|
48
|
+
* array if the file doesn't exist yet.
|
|
49
|
+
*/
|
|
50
|
+
declare function loadAllTestAccounts(): TestAccount[];
|
|
51
|
+
/**
|
|
52
|
+
* Pick `count` test accounts from the local registry, optionally
|
|
53
|
+
* filtered by `label`. Order-stable: sorted by `createdAt` ascending so
|
|
54
|
+
* the first test account you created is always the first one returned.
|
|
55
|
+
*
|
|
56
|
+
* Throws with a helpful message if not enough accounts exist.
|
|
57
|
+
*/
|
|
58
|
+
declare function pickTestAccounts(count: number, options?: {
|
|
59
|
+
label?: string;
|
|
60
|
+
}): TestAccount[];
|
|
61
|
+
/**
|
|
62
|
+
* Find a single account by name. Used by `users(['Alice', 'Bob'])`.
|
|
63
|
+
* Throws if not found.
|
|
64
|
+
*/
|
|
65
|
+
declare function findTestAccountByName(name: string): TestAccount;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Per-account `storageState` cache for Playwright.
|
|
69
|
+
*
|
|
70
|
+
* Better Auth applies a per-IP rate limit on `/api/auth/sign-in/email`
|
|
71
|
+
* (~5 sign-ins / 60s / endpoint). A multiplayer suite that spins up
|
|
72
|
+
* 5+ users per spec would hit the limit and start failing in non-obvious
|
|
73
|
+
* ways. This module signs each account in *once*, persists the
|
|
74
|
+
* resulting browser cookies + storage to disk, and reuses the file on
|
|
75
|
+
* subsequent runs.
|
|
76
|
+
*
|
|
77
|
+
* Cache layout:
|
|
78
|
+
* ~/.deepspace/playwright-states/<sha256(email)>.json
|
|
79
|
+
*
|
|
80
|
+
* Validity: a cached file is reused if Playwright successfully loads it
|
|
81
|
+
* AND the resulting context produces a non-anonymous session on the
|
|
82
|
+
* target app. If validation fails, we fall back to a fresh sign-in and
|
|
83
|
+
* overwrite the cache.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
interface EnsureStorageStateOptions {
|
|
87
|
+
/** Max age of a cached state file before we re-sign-in. Default 7 days. */
|
|
88
|
+
maxAgeMs?: number;
|
|
89
|
+
/** Force a fresh sign-in even if the cache is fresh. */
|
|
90
|
+
force?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Ensure a Playwright `storageState` file exists for `account` and
|
|
94
|
+
* return its path. Signs in once if the cache is missing, stale, or
|
|
95
|
+
* `force: true`.
|
|
96
|
+
*/
|
|
97
|
+
declare function ensureStorageState(browser: Browser, account: {
|
|
98
|
+
email: string;
|
|
99
|
+
password: string;
|
|
100
|
+
}, baseURL: string, options?: EnsureStorageStateOptions): Promise<string>;
|
|
101
|
+
/**
|
|
102
|
+
* Convenience: open a fresh `BrowserContext` for `account` using the
|
|
103
|
+
* cached storage state (signing in if needed). The caller is responsible
|
|
104
|
+
* for closing the context.
|
|
105
|
+
*/
|
|
106
|
+
declare function newSignedInContext(browser: Browser, account: {
|
|
107
|
+
email: string;
|
|
108
|
+
password: string;
|
|
109
|
+
}, baseURL: string, options?: EnsureStorageStateOptions): Promise<BrowserContext>;
|
|
110
|
+
/** Read a cached storageState file (mostly for debugging). */
|
|
111
|
+
declare function readCachedState(email: string): unknown | null;
|
|
112
|
+
/** Where the cache for `email` lives. Useful for diagnostics. */
|
|
113
|
+
declare function getStatePathForEmail(email: string): string;
|
|
114
|
+
|
|
115
|
+
export { type EnsureStorageStateOptions, type MultiplayerUser, type TestAccount, type UsersFixture, ensureStorageState, findTestAccountByName, getStatePathForEmail, loadAllTestAccounts, newSignedInContext, pickTestAccounts, readCachedState, test };
|
package/dist/worker.d.ts
CHANGED
|
@@ -1748,49 +1748,6 @@ declare abstract class CronRoom<E = Record<string, unknown>> extends BaseRoom<E>
|
|
|
1748
1748
|
protected abstract onTask(taskName: string): void | Promise<void>;
|
|
1749
1749
|
}
|
|
1750
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
|
-
|
|
1794
1751
|
/**
|
|
1795
1752
|
* JobRoom — Per-app durable background-job execution Durable Object.
|
|
1796
1753
|
*
|
|
@@ -2092,7 +2049,7 @@ declare const ALLOWED_BINDING_TYPES: Set<string>;
|
|
|
2092
2049
|
*
|
|
2093
2050
|
* Includes:
|
|
2094
2051
|
* - Static-asset + service bindings the platform sets up automatically.
|
|
2095
|
-
* - SDK-managed env (auth, identity, owner JWT
|
|
2052
|
+
* - SDK-managed env (auth, identity, owner JWT).
|
|
2096
2053
|
* - The auto-attached cost-tracking AE dataset (`USAGE_EVENTS`).
|
|
2097
2054
|
*
|
|
2098
2055
|
* DO binding names (RECORD_ROOMS, YJS_ROOMS, etc.) are NOT in this set
|
|
@@ -4406,47 +4363,6 @@ declare function createDeepSpaceAuth(config: DeepSpaceAuthConfig): better_auth.A
|
|
|
4406
4363
|
}>;
|
|
4407
4364
|
type DeepSpaceAuth = ReturnType<typeof createDeepSpaceAuth>;
|
|
4408
4365
|
|
|
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
|
-
|
|
4450
4366
|
/**
|
|
4451
4367
|
* Yjs collaborative editing handlers for RecordRoom
|
|
4452
4368
|
*/
|
|
@@ -4454,4 +4370,4 @@ declare function createSecrets(env: SecretsEnv, options?: CreateSecretsOptions):
|
|
|
4454
4370
|
/** Collections that bypass schema checks (permissive access) */
|
|
4455
4371
|
declare const SYSTEM_COLLECTIONS: Set<string>;
|
|
4456
4372
|
|
|
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
|
|
4373
|
+
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, 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, 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 };
|