deepspace 0.9.2 → 0.10.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.
@@ -0,0 +1,230 @@
1
+ import { ReactNode, ReactElement, ComponentType } from 'react';
2
+
3
+ type DocsAssistantAccess = 'disabled' | 'public' | 'authenticated';
4
+ type DocsMcpAccess = 'disabled' | 'public';
5
+ declare const DOCS_CONTEXTUAL_ACTIONS: readonly ["copy", "view", "assistant", "chatgpt", "claude", "mcp", "add-mcp", "cursor", "vscode"];
6
+ type DocsContextualAction = (typeof DOCS_CONTEXTUAL_ACTIONS)[number];
7
+ interface DocsFontConfig {
8
+ family: string;
9
+ weight?: number | string;
10
+ source?: string;
11
+ format?: string;
12
+ }
13
+ interface DocsThemeConfig {
14
+ preset?: string;
15
+ accent?: string;
16
+ background?: string;
17
+ backgroundDark?: string;
18
+ backgroundDecoration?: 'none' | 'gradient' | 'grid';
19
+ bodyFont?: DocsFontConfig;
20
+ headingFont?: DocsFontConfig;
21
+ monoFont?: DocsFontConfig;
22
+ codeBlockMode?: 'dark' | 'system';
23
+ eyebrowStyle?: 'section' | 'breadcrumbs' | 'none';
24
+ logo?: string;
25
+ logoDark?: string;
26
+ logoHref?: string;
27
+ favicon?: string;
28
+ defaultMode?: 'light' | 'dark' | 'system';
29
+ strictMode?: boolean;
30
+ }
31
+ interface DocsLinkConfig {
32
+ label: string;
33
+ href: string;
34
+ }
35
+ interface DocsNavGroup {
36
+ group: string;
37
+ pages: DocsNavigationItem[];
38
+ }
39
+ type DocsNavigationItem = string | DocsLinkConfig | DocsNavGroup;
40
+ declare const DOCS_OPENAPI_SAMPLE_LANGUAGES: readonly ["curl", "javascript", "python", "go"];
41
+ type DocsOpenApiSampleLanguage = (typeof DOCS_OPENAPI_SAMPLE_LANGUAGES)[number];
42
+ type DocsOpenApiSampleDefaults = 'required' | 'all';
43
+ interface DocsOpenApiExamplesConfig {
44
+ languages: DocsOpenApiSampleLanguage[];
45
+ defaults: DocsOpenApiSampleDefaults;
46
+ autogenerate: boolean;
47
+ }
48
+ interface DocsOpenApiConfig {
49
+ source: string;
50
+ route?: string;
51
+ label?: string;
52
+ playground?: boolean;
53
+ baseUrl?: string;
54
+ examples?: DocsOpenApiExamplesConfig;
55
+ }
56
+ interface DocsAssistantConfig {
57
+ access: DocsAssistantAccess;
58
+ model?: string;
59
+ suggestions?: string[];
60
+ }
61
+ interface DocsMcpConfig {
62
+ access: DocsMcpAccess;
63
+ }
64
+ interface DocsContextualConfig {
65
+ actions: DocsContextualAction[];
66
+ }
67
+ interface DocsSeoConfig {
68
+ noindex?: boolean;
69
+ ogImage?: string;
70
+ metaTags?: Record<string, string>;
71
+ }
72
+ interface DocsConfig {
73
+ $schema?: string;
74
+ name: string;
75
+ description?: string;
76
+ source: string;
77
+ output: string;
78
+ url?: string;
79
+ theme: DocsThemeConfig;
80
+ navigation?: DocsNavigationItem[];
81
+ links: DocsLinkConfig[];
82
+ footer: DocsLinkConfig[];
83
+ redirects: Record<string, string>;
84
+ openapi: DocsOpenApiConfig[];
85
+ assistant: DocsAssistantConfig;
86
+ mcp: DocsMcpConfig;
87
+ contextual: DocsContextualConfig;
88
+ seo: DocsSeoConfig;
89
+ }
90
+ interface DocsHeading {
91
+ depth: number;
92
+ id: string;
93
+ text: string;
94
+ }
95
+ interface DocsPage {
96
+ sourcePath: string;
97
+ relativePath: string;
98
+ route: string;
99
+ title: string;
100
+ description?: string;
101
+ hidden: boolean;
102
+ noindex: boolean;
103
+ markdown: string;
104
+ html: string;
105
+ text: string;
106
+ headings: DocsHeading[];
107
+ sourceFormat: 'markdown' | 'mdx' | 'generated';
108
+ kind: 'page' | 'openapi';
109
+ openapi?: DocsOpenApiOperation;
110
+ }
111
+ interface DocsNavigationPage {
112
+ kind: 'page';
113
+ route: string;
114
+ label: string;
115
+ }
116
+ interface DocsNavigationLink {
117
+ kind: 'link';
118
+ href: string;
119
+ label: string;
120
+ }
121
+ interface DocsNavigationGroup {
122
+ kind: 'group';
123
+ label: string;
124
+ items: DocsNavigationNode[];
125
+ }
126
+ type DocsNavigationNode = DocsNavigationPage | DocsNavigationLink | DocsNavigationGroup;
127
+ interface DocsOpenApiParameter {
128
+ name: string;
129
+ in: string;
130
+ required: boolean;
131
+ description?: string;
132
+ schema?: unknown;
133
+ example?: unknown;
134
+ }
135
+ interface DocsOpenApiResponse {
136
+ status: string;
137
+ description: string;
138
+ schema?: unknown;
139
+ }
140
+ interface DocsOpenApiCodeSample {
141
+ language: string;
142
+ label: string;
143
+ syntax: string;
144
+ code: string;
145
+ generated: boolean;
146
+ }
147
+ interface DocsOpenApiOperation {
148
+ method: string;
149
+ path: string;
150
+ operationId: string;
151
+ summary: string;
152
+ description?: string;
153
+ tags: string[];
154
+ parameters: DocsOpenApiParameter[];
155
+ requestBody?: unknown;
156
+ responses: DocsOpenApiResponse[];
157
+ security?: unknown;
158
+ baseUrl?: string;
159
+ playground: boolean;
160
+ codeSamples: DocsOpenApiCodeSample[];
161
+ }
162
+ interface DocsRuntimePageLink {
163
+ route: string;
164
+ title: string;
165
+ }
166
+ interface DocsRuntimePage {
167
+ route: string;
168
+ title: string;
169
+ description?: string;
170
+ html: string;
171
+ headings: DocsHeading[];
172
+ kind: DocsPage['kind'];
173
+ markdownUrl: string;
174
+ openapi?: DocsOpenApiOperation;
175
+ }
176
+ interface DocsRuntimeData {
177
+ config: Pick<DocsConfig, 'name' | 'description' | 'theme' | 'links' | 'footer' | 'assistant' | 'mcp' | 'contextual'>;
178
+ page: DocsRuntimePage;
179
+ navigation: DocsNavigationNode[];
180
+ breadcrumbs: string[];
181
+ previous?: DocsRuntimePageLink;
182
+ next?: DocsRuntimePageLink;
183
+ }
184
+
185
+ interface DocsAppProps {
186
+ data: DocsRuntimeData;
187
+ /** Rendered page body. Omit children to use the compiler's static HTML. */
188
+ children?: ReactNode;
189
+ navigating?: boolean;
190
+ onNavigate?: (href: string) => void;
191
+ onPrefetch?: (href: string) => void;
192
+ }
193
+ declare function DocsApp({ data, children, navigating, onNavigate, }: DocsAppProps): ReactElement;
194
+
195
+ interface TitledProps {
196
+ children?: ReactNode;
197
+ label?: string;
198
+ title?: string;
199
+ }
200
+ declare function Note(props: TitledProps): ReactElement;
201
+ declare function Tip(props: TitledProps): ReactElement;
202
+ declare function Warning(props: TitledProps): ReactElement;
203
+ declare function Info(props: TitledProps): ReactElement;
204
+ declare function Card({ children, href, label, title }: TitledProps & {
205
+ href?: string;
206
+ }): ReactElement;
207
+ declare function Accordion({ children, label, title }: TitledProps): ReactElement;
208
+ declare function AccordionGroup({ children }: TitledProps): ReactElement;
209
+ declare function Step({ children, label, title }: TitledProps): ReactElement;
210
+ declare function Steps({ children }: TitledProps): ReactElement;
211
+ declare function Tab({ children, label, title }: TitledProps): ReactElement;
212
+ declare function Tabs({ children }: TitledProps): ReactElement;
213
+ declare function CodeGroup({ children, label, title }: TitledProps): ReactElement;
214
+
215
+ type DocsPageComponent = ComponentType<{
216
+ components?: Record<string, ComponentType<never>>;
217
+ }>;
218
+ interface DocsSiteProps extends DocsAppProps {
219
+ /** The current compiled Markdown or MDX page. */
220
+ children: ReactNode;
221
+ }
222
+ type DocsSiteComponent = ComponentType<DocsSiteProps>;
223
+ /** The polished SDK-owned documentation shell. */
224
+ declare const DefaultDocs: typeof DocsApp;
225
+ declare function DocsContent({ data, Page, }: {
226
+ data: DocsRuntimeData;
227
+ Page?: DocsPageComponent;
228
+ }): ReactElement;
229
+
230
+ export { Accordion as A, Card as C, type DocsRuntimeData as D, Info as I, Note as N, Step as S, Tab as T, Warning as W, type DocsPageComponent as a, type DocsSiteComponent as b, AccordionGroup as c, CodeGroup as d, DefaultDocs as e, DocsApp as f, type DocsAppProps as g, DocsContent as h, type DocsSiteProps as i, Steps as j, Tabs as k, Tip as l };
package/dist/server.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { LanguageModel, ToolSet, ModelMessage } from 'ai';
1
+ import { LanguageModel, ToolSet, StreamTextResult, streamText, ModelMessage } from 'ai';
2
+ import { Hono, Context } from 'hono';
2
3
  import * as Y from 'yjs';
3
4
  import * as zod_v4_core from 'zod/v4/core';
4
5
  import * as zod from 'zod';
5
6
  import * as better_auth_plugins from 'better-auth/plugins';
6
7
  import * as better_auth from 'better-auth';
7
8
  import { betterAuth } from 'better-auth';
8
- import { Context } from 'hono';
9
9
 
10
10
  /**
11
11
  * Wildcard-aware CORS origin matching for the platform workers.
@@ -704,6 +704,46 @@ interface CronEnv extends ApiWorkerEnv {
704
704
  */
705
705
  declare function buildCronContext(env: CronEnv, ownerUserId: string, roomId?: string): CronContext;
706
706
 
707
+ /**
708
+ * Canonical DeepSpace model catalog and agent policy.
709
+ *
710
+ * Provider catalogs are discovery inputs, not a safe runtime allowlist: a
711
+ * model is promoted here only after its tool loop, transport, pricing, and
712
+ * streaming contract have been verified end to end through the DeepSpace
713
+ * proxy. Every client picker and server agent profile consumes this module.
714
+ */
715
+ type DeepSpaceAIProvider = 'anthropic' | 'openai' | 'cerebras';
716
+ type DeepSpaceAgentProfileId = 'application' | 'documentation';
717
+ type DeepSpaceAgentSupport = 'multi-step' | 'single-step' | 'none';
718
+ interface DeepSpaceAIModel {
719
+ id: string;
720
+ label: string;
721
+ provider: DeepSpaceAIProvider;
722
+ providerLabel: string;
723
+ family: string;
724
+ /** Whether the model is eligible for DeepSpace's server-owned agent loop. */
725
+ agentSupport: DeepSpaceAgentSupport;
726
+ /** Profiles in which the model has passed the complete runtime contract. */
727
+ agentProfiles: readonly DeepSpaceAgentProfileId[];
728
+ /** Provider transport currently used by the DeepSpace proxy adapter. */
729
+ transport: 'messages' | 'chat-completions';
730
+ recommendation: 'frontier' | 'balanced' | 'fast' | 'available' | 'limited';
731
+ note?: string;
732
+ }
733
+ interface DeepSpaceAgentProfile {
734
+ id: DeepSpaceAgentProfileId;
735
+ defaultModel: string;
736
+ maxSteps: number;
737
+ maxToolCalls?: number;
738
+ allowedTools: 'application-defined' | readonly string[];
739
+ }
740
+ interface ResolvedDeepSpaceAgentModel {
741
+ modelId: string;
742
+ provider: DeepSpaceAIProvider;
743
+ model: DeepSpaceAIModel;
744
+ profile: DeepSpaceAgentProfile;
745
+ }
746
+
707
747
  /**
708
748
  * AI provider helpers — create Vercel AI SDK providers that route through
709
749
  * the DeepSpace API worker proxy for per-user billing.
@@ -729,9 +769,10 @@ declare function buildCronContext(env: CronEnv, ownerUserId: string, roomId?: st
729
769
  * Usage:
730
770
  *
731
771
  * // Server-side autonomous — no auth config needed
732
- * import { createDeepSpaceAI } from 'deepspace/worker'
733
- * const cerebras = createDeepSpaceAI(env, 'cerebras')
734
- * const result = await generateText({ model: cerebras('llama-3.3-70b'), ... })
772
+ * import { createDeepSpaceAI, DEEPSPACE_AI_DEFAULTS, getDeepSpaceAIModel } from 'deepspace/worker'
773
+ * const selected = getDeepSpaceAIModel(DEEPSPACE_AI_DEFAULTS.directGeneration)!
774
+ * const provider = createDeepSpaceAI(env, selected.provider)
775
+ * const result = await generateText({ model: provider(selected.id), ... })
735
776
  *
736
777
  * // User-initiated (inside a request handler)
737
778
  * const jwt = c.req.header('Authorization')!.slice(7)
@@ -744,7 +785,6 @@ declare function buildCronContext(env: CronEnv, ownerUserId: string, roomId?: st
744
785
  * paths into the published `dist/index.d.ts`.
745
786
  */
746
787
  type DeepSpaceModelFactory = (modelId: string) => LanguageModel;
747
- type Provider = 'anthropic' | 'openai' | 'cerebras';
748
788
  interface DeepSpaceAIEnv extends ApiWorkerEnv {
749
789
  /**
750
790
  * Long-lived owner-scoped JWT minted at deploy time (or by `deepspace dev start`).
@@ -772,7 +812,43 @@ interface DeepSpaceAIOptions {
772
812
  * (explicit or `env.APP_OWNER_JWT`) automatically. Throws a clear error if
773
813
  * either is unconfigured.
774
814
  */
775
- declare function createDeepSpaceAI(env: DeepSpaceAIEnv, provider: Provider, options?: DeepSpaceAIOptions): DeepSpaceModelFactory;
815
+ declare function createDeepSpaceAI(env: DeepSpaceAIEnv, provider: DeepSpaceAIProvider, options?: DeepSpaceAIOptions): DeepSpaceModelFactory;
816
+
817
+ type StreamTextOptions<TOOLS extends ToolSet> = Parameters<typeof streamText<TOOLS>>[0];
818
+ type DeepSpaceAgentStreamOptions<TOOLS extends ToolSet> = Omit<StreamTextOptions<TOOLS>, 'model' | 'providerOptions' | 'stopWhen'> & {
819
+ profile: DeepSpaceAgentProfileId;
820
+ modelId?: unknown;
821
+ authToken?: string;
822
+ };
823
+ interface DeepSpaceAgentStream<TOOLS extends ToolSet> {
824
+ selection: ResolvedDeepSpaceAgentModel;
825
+ result: StreamTextResult<TOOLS, never>;
826
+ }
827
+ declare class DeepSpaceAgentModelError extends Error {
828
+ readonly modelId: unknown;
829
+ readonly profile: DeepSpaceAgentProfileId;
830
+ readonly code = "unsupported_agent_model";
831
+ constructor(modelId: unknown, profile: DeepSpaceAgentProfileId);
832
+ }
833
+ declare class DeepSpaceAgentProfileError extends Error {
834
+ readonly profile: DeepSpaceAgentProfileId;
835
+ readonly toolName: string;
836
+ readonly code = "agent_profile_violation";
837
+ constructor(profile: DeepSpaceAgentProfileId, toolName: string);
838
+ }
839
+ /**
840
+ * Run every DeepSpace text agent through one provider, model, and tool-loop
841
+ * implementation. Agent surfaces supply only their profile-specific prompt,
842
+ * messages, tools, persistence callbacks, and access token.
843
+ */
844
+ declare function streamDeepSpaceAgent<TOOLS extends ToolSet>(env: DeepSpaceAIEnv, options: DeepSpaceAgentStreamOptions<TOOLS>): DeepSpaceAgentStream<TOOLS>;
845
+ interface DeepSpaceAgentDiagnosticContext {
846
+ profile?: DeepSpaceAgentProfileId;
847
+ provider?: string;
848
+ modelId?: string;
849
+ }
850
+ /** Preserve safe structured provider diagnostics in bounded Worker logs. */
851
+ declare function deepSpaceAgentErrorSummary(error: unknown, context?: DeepSpaceAgentDiagnosticContext): string;
776
852
 
777
853
  /**
778
854
  * Composio tools for the Vercel AI SDK.
@@ -789,11 +865,12 @@ declare function createDeepSpaceAI(env: DeepSpaceAIEnv, provider: Provider, opti
789
865
  *
790
866
  * Usage (inside a request handler, e.g. /api/ai/chat):
791
867
  *
792
- * import { composioTools, createDeepSpaceAI } from 'deepspace/worker'
868
+ * import { composioTools, streamDeepSpaceAgent } from 'deepspace/worker'
793
869
  * const jwt = c.req.header('Authorization')!.slice(7)
794
870
  * const tools = await composioTools(c.env, { toolkit: 'gmail', authToken: jwt })
795
- * const ai = createDeepSpaceAI(c.env, 'anthropic', { authToken: jwt })
796
- * const result = streamText({ model: ai('claude-sonnet-5'), prompt, tools })
871
+ * const { result } = streamDeepSpaceAgent(c.env, {
872
+ * profile: 'application', authToken: jwt, prompt, tools,
873
+ * })
797
874
  *
798
875
  * Merge with your own tools: `tools: { ...buildTools(executor), ...composio }`.
799
876
  */
@@ -1035,6 +1112,155 @@ declare function appendMessage(stub: DurableObjectStub, msg: {
1035
1112
  parts?: unknown[];
1036
1113
  }): Promise<void>;
1037
1114
 
1115
+ interface DocsCorpusChunk {
1116
+ id: string;
1117
+ route: string;
1118
+ title: string;
1119
+ heading?: string;
1120
+ text: string;
1121
+ }
1122
+ interface DocsSearchResult {
1123
+ route: string;
1124
+ title: string;
1125
+ heading?: string;
1126
+ excerpt: string;
1127
+ score: number;
1128
+ }
1129
+ /** Validate the generated assistant index before any content reaches a model. */
1130
+ declare function parseDocsCorpus(value: unknown): DocsCorpusChunk[];
1131
+ /** Deterministic local lexical retrieval used by the docs agent tools. */
1132
+ declare function searchDocsCorpus(corpus: DocsCorpusChunk[], query: string, limit?: number): DocsSearchResult[];
1133
+ declare function readDocsRoute(corpus: DocsCorpusChunk[], route: string): Array<Pick<DocsCorpusChunk, 'route' | 'title' | 'heading' | 'text'>>;
1134
+ declare function buildDocsAssistantTools(corpus: DocsCorpusChunk[]): ToolSet;
1135
+ declare function buildDocsAssistantPrompt(appName: string, currentRoute: string | undefined): string;
1136
+ declare function normalizeDocsRoute(value: string): string;
1137
+
1138
+ /**
1139
+ * Durable, per-app abuse boundary for the public documentation assistant.
1140
+ * Bind one SQLite Durable Object instance per immutable app id.
1141
+ */
1142
+ declare class DocsAssistantLimiter {
1143
+ private readonly sql;
1144
+ constructor(state: DurableObjectState);
1145
+ fetch(request: Request): Promise<Response>;
1146
+ private acquire;
1147
+ private release;
1148
+ private consumeWindow;
1149
+ }
1150
+
1151
+ interface DocsAssistantRouteEnv extends DeepSpaceAIEnv {
1152
+ ASSETS: Fetcher;
1153
+ APP_NAME: string;
1154
+ DEEPSPACE_APP_ID: string;
1155
+ DOCS_ASSISTANT_LIMITER: DurableObjectNamespace;
1156
+ }
1157
+ /** Register the standard, read-only documentation assistant endpoint. */
1158
+ declare function registerDocsAssistantRoutes<Env extends DocsAssistantRouteEnv>(app: Hono<{
1159
+ Bindings: Env;
1160
+ }>, resolveAuth: (request: Request, env: Env) => Promise<unknown | null>): void;
1161
+ /** Preserve useful provider diagnostics in Workers-for-Platforms string logs. */
1162
+ declare const docsAssistantErrorSummary: typeof deepSpaceAgentErrorSummary;
1163
+ interface DocsAssistantHistoryMessage {
1164
+ role: 'user' | 'assistant';
1165
+ content: string;
1166
+ }
1167
+ /**
1168
+ * Accept only the completed, alternating UI turns that precede the current
1169
+ * question. The browser remains stateless; the shared agent runner receives a
1170
+ * bounded ephemeral transcript on each request.
1171
+ */
1172
+ declare function normalizeDocsAssistantHistory(value: unknown): DocsAssistantHistoryMessage[];
1173
+ /**
1174
+ * Own the reserved docs namespace before an existing app's SPA wildcard.
1175
+ * The dispatcher rewrites public docs requests into this namespace.
1176
+ */
1177
+ declare function registerDocsStaticRoutes<Env extends Pick<DocsAssistantRouteEnv, 'ASSETS'>>(app: Hono<{
1178
+ Bindings: Env;
1179
+ }>): void;
1180
+
1181
+ interface DocsMcpRouteEnv {
1182
+ ASSETS: Fetcher;
1183
+ DEEPSPACE_APP_ID: string;
1184
+ DOCS_ASSISTANT_LIMITER: DurableObjectNamespace;
1185
+ }
1186
+ /** Register the public, stateless MCP endpoint for a documentation surface. */
1187
+ declare function registerDocsMcpRoutes<Env extends DocsMcpRouteEnv>(app: Hono<{
1188
+ Bindings: Env;
1189
+ }>): void;
1190
+
1191
+ interface DeepSpaceDocsRouteEnv extends DocsAssistantRouteEnv, DocsMcpRouteEnv {
1192
+ }
1193
+ interface DeepSpaceDocsRouteOptions<Env extends DeepSpaceDocsRouteEnv> {
1194
+ resolveAuth: (request: Request, env: Env) => Promise<unknown | null>;
1195
+ }
1196
+ /** Register the complete native docs protocol surface in its required order. */
1197
+ declare function registerDeepSpaceDocs<Env extends DeepSpaceDocsRouteEnv>(app: Hono<{
1198
+ Bindings: Env;
1199
+ }>, options: DeepSpaceDocsRouteOptions<Env>): void;
1200
+ /** Canonical manifest entry for the public docs assistant/MCP concurrency limiter. */
1201
+ declare function docsAssistantLimiterManifestEntry<ClassName extends string>(className: ClassName): {
1202
+ readonly binding: "DOCS_ASSISTANT_LIMITER";
1203
+ readonly className: ClassName;
1204
+ readonly sqlite: true;
1205
+ };
1206
+
1207
+ interface DocsPublishedManifest {
1208
+ sourceHash: string;
1209
+ name: string;
1210
+ assistant: {
1211
+ access: 'disabled' | 'public' | 'authenticated';
1212
+ model?: string;
1213
+ };
1214
+ mcp: {
1215
+ access: 'disabled' | 'public';
1216
+ };
1217
+ }
1218
+ interface DocsPublishedEnv {
1219
+ ASSETS: Fetcher;
1220
+ }
1221
+ interface DocsPublishedPage {
1222
+ route: string;
1223
+ title: string;
1224
+ markdown: string;
1225
+ }
1226
+ type DocsPublishedCorpusResult = {
1227
+ ok: true;
1228
+ chunks: DocsCorpusChunk[];
1229
+ } | {
1230
+ ok: false;
1231
+ error: unknown;
1232
+ };
1233
+ /** Read the small, generated policy manifest shared by docs runtime features. */
1234
+ declare function loadDocsPublishedManifest(env: DocsPublishedEnv, requestUrl?: string): Promise<DocsPublishedManifest | null>;
1235
+ /** Load and validate the generated corpus once per docs source hash. */
1236
+ declare function loadDocsPublishedCorpus(env: DocsPublishedEnv, sourceHash: string, requestUrl?: string): Promise<DocsCorpusChunk[]>;
1237
+ /** Convert asset and validation failures into one explicit route-level result. */
1238
+ declare function resolveDocsPublishedCorpus(env: DocsPublishedEnv, sourceHash: string, requestUrl?: string): Promise<DocsPublishedCorpusResult>;
1239
+ /** Read the complete generated Markdown only for a route in the public corpus. */
1240
+ declare function readDocsPublishedPage(env: DocsPublishedEnv, corpus: DocsCorpusChunk[], requestedRoute: string, requestUrl?: string): Promise<DocsPublishedPage | null>;
1241
+
1242
+ interface DocsPublicLimiterEnv {
1243
+ DEEPSPACE_APP_ID: string;
1244
+ DOCS_ASSISTANT_LIMITER: DurableObjectNamespace;
1245
+ }
1246
+ interface DocsPublicLease {
1247
+ leaseId: string;
1248
+ stub: DurableObjectStub;
1249
+ }
1250
+ type DocsPublicLeaseResult = {
1251
+ ok: true;
1252
+ lease: DocsPublicLease;
1253
+ } | {
1254
+ ok: false;
1255
+ status: 429 | 503;
1256
+ };
1257
+ /** Hash the edge client address before it reaches durable limiter storage. */
1258
+ declare function docsPublicClientKey(value: string): Promise<string>;
1259
+ /** Acquire one bounded public docs operation from the per-app limiter. */
1260
+ declare function acquireDocsPublicLease(env: DocsPublicLimiterEnv, clientKey: string, logPrefix: string): Promise<DocsPublicLeaseResult>;
1261
+ /** Release a concurrency lease; window usage remains consumed. */
1262
+ declare function releaseDocsPublicLease(lease: DocsPublicLease | undefined, logPrefix: string): Promise<void>;
1263
+
1038
1264
  /**
1039
1265
  * Per-binding usage metering — record Vectorize / Workers AI / etc. costs
1040
1266
  * to the auto-attached `USAGE_EVENTS` Analytics Engine dataset.
@@ -1677,6 +1903,9 @@ interface ConnectionAttachment extends UserAttachment {
1677
1903
  awarenessClientId?: number;
1678
1904
  }
1679
1905
 
1906
+ /** Standard system-managed user columns shared by browser and Worker schemas. */
1907
+ declare const USERS_COLUMNS: readonly ColumnDefinition[];
1908
+
1680
1909
  /**
1681
1910
  * Collection Schema Definitions & Validation
1682
1911
  *
@@ -1752,8 +1981,6 @@ declare function canDelete(schema: CollectionSchema, role: string, record: {
1752
1981
  declare function checkFieldPermissions(schema: CollectionSchema, role: string, newData: Record<string, unknown>, existingData?: Record<string, unknown>): string | null;
1753
1982
  /** Names of columns managed by the system (registerUser), not client mutations. */
1754
1983
  declare const SYSTEM_MANAGED_COLUMNS: Set<string>;
1755
- /** Standard user columns. Apps spread these into their users schema. */
1756
- declare const USERS_COLUMNS: ColumnDefinition[];
1757
1984
  declare const BASE_USERS_SCHEMA: CollectionSchema;
1758
1985
  /**
1759
1986
  * Lint a CollectionSchema for declarations that look like they should
@@ -4436,4 +4663,4 @@ declare class RefundError extends Error {
4436
4663
  constructor(message: string, status: number);
4437
4664
  }
4438
4665
 
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 };
4666
+ 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 DeepSpaceAgentDiagnosticContext, DeepSpaceAgentModelError, DeepSpaceAgentProfileError, type DeepSpaceAgentStream, type DeepSpaceAgentStreamOptions, type DeepSpaceAuth, type DeepSpaceAuthConfig, type DeepSpaceDocsRouteEnv, type DeepSpaceDocsRouteOptions, type DirectoryCommunityData, type DirectoryConversationData, type DirectoryMembershipData, type DirectoryPostData, type DoMigrationDirective, type DoMigrationPlan, type DocsAssistantHistoryMessage, DocsAssistantLimiter, type DocsAssistantRouteEnv, type DocsCorpusChunk, type DocsMcpRouteEnv, type DocsPublicLease, type DocsPublicLeaseResult, type DocsPublicLimiterEnv, type DocsPublishedCorpusResult, type DocsPublishedEnv, type DocsPublishedManifest, type DocsPublishedPage, type DocsSearchResult, 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, acquireDocsPublicLease, analyzePermissions, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, authWorkerFetch, bindingManifestFromOutputConfig, broadcastChange, broadcastYjsUpdate, buildCronContext, buildDocsAssistantPrompt, buildDocsAssistantTools, buildTableSelect, buildUiParts, callRegistry, canCreate, canDelete, canRead, canUpdate, cancelSubscription, capToolResultSize, captureScreenshot, checkFieldPermissions, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDeepSpaceAI, createDeepSpaceAuth, createScopedR2Handler, dataToColumnValues, decodeJwtPayload, deepSpaceAgentErrorSummary, deleteChatCascade, deleteRecord, docsAssistantErrorSummary, docsAssistantLimiterManifestEntry, docsPublicClientKey, 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, loadDocsPublishedCorpus, loadDocsPublishedManifest, loadMessages, makeDefaultSummarizer, matchOrigin, meterAi, meterUsage, meterVectorize, noopPermissionContext, normalizeDocsAssistantHistory, normalizeDocsRoute, parseDocsCorpus, parseQuotaLimit, platformCorsPatterns, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, putRecord, readDocsPublishedPage, readDocsRoute, readRecord, recordMatchesSubscription, refundInvoice, registerDeepSpaceDocs, registerDocsAssistantRoutes, registerDocsMcpRoutes, registerDocsStaticRoutes, registerUser, registryErrorJson, registryStub, releaseDocsPublicLease, requireSubscription, resolveAppName, resolveColumn, resolveDocsPublishedCorpus, rowToData, runMigrations, saveYjsDoc, searchDocsCorpus, streamDeepSpaceAgent, timingSafeEqualHex, timingSafeEqualStrings, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema };