deepspace 0.9.3 → 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.
- package/CHANGELOG.md +25 -0
- package/dist/chunk-DQ4G6VL6.js +1535 -0
- package/dist/chunk-DQ4G6VL6.js.map +1 -0
- package/dist/cli.js +5899 -379
- package/dist/cli.js.map +1 -1
- package/dist/docs-client-core.d.ts +18 -0
- package/dist/docs-client-core.js +386 -0
- package/dist/docs-client-core.js.map +1 -0
- package/dist/docs-react.d.ts +2 -0
- package/dist/docs-react.js +35 -0
- package/dist/docs-react.js.map +1 -0
- package/dist/docs-runtime.js +71 -0
- package/dist/docs-server-core.d.ts +11 -0
- package/dist/docs-server-core.js +48 -0
- package/dist/docs-server-core.js.map +1 -0
- package/dist/docs.d.ts +350 -0
- package/dist/docs.js +5139 -0
- package/dist/docs.js.map +1 -0
- package/dist/index.d.ts +179 -1
- package/dist/index.js +143 -0
- package/dist/index.js.map +1 -1
- package/dist/public-Cp1X8ZQ3.d.ts +230 -0
- package/dist/server.d.ts +240 -13
- package/dist/server.js +1313 -25
- package/dist/server.js.map +1 -1
- package/dist/worker.d.ts +378 -13
- package/dist/worker.js +1377 -29
- package/dist/worker.js.map +1 -1
- package/features/ai-chat/feature.json +1 -1
- package/features/ai-chat/src/ChatPanel.tsx +7 -11
- package/package.json +21 -1
package/dist/worker.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as Y from 'yjs';
|
|
2
|
-
import { LanguageModel, ToolSet, ModelMessage } from 'ai';
|
|
2
|
+
import { LanguageModel, ToolSet, StreamTextResult, streamText, ModelMessage } from 'ai';
|
|
3
|
+
import { Hono } from 'hono';
|
|
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 { Hono } from 'hono';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Wire protocol constants.
|
|
@@ -1267,6 +1267,9 @@ interface HandlerContext {
|
|
|
1267
1267
|
sendBinary(ws: WebSocket, data: Uint8Array): void;
|
|
1268
1268
|
}
|
|
1269
1269
|
|
|
1270
|
+
/** Standard system-managed user columns shared by browser and Worker schemas. */
|
|
1271
|
+
declare const USERS_COLUMNS: readonly ColumnDefinition[];
|
|
1272
|
+
|
|
1270
1273
|
/**
|
|
1271
1274
|
* Collection Schema Definitions & Validation
|
|
1272
1275
|
*
|
|
@@ -1342,8 +1345,6 @@ declare function canDelete(schema: CollectionSchema, role: string, record: {
|
|
|
1342
1345
|
declare function checkFieldPermissions(schema: CollectionSchema, role: string, newData: Record<string, unknown>, existingData?: Record<string, unknown>): string | null;
|
|
1343
1346
|
/** Names of columns managed by the system (registerUser), not client mutations. */
|
|
1344
1347
|
declare const SYSTEM_MANAGED_COLUMNS: Set<string>;
|
|
1345
|
-
/** Standard user columns. Apps spread these into their users schema. */
|
|
1346
|
-
declare const USERS_COLUMNS: ColumnDefinition[];
|
|
1347
1348
|
declare const BASE_USERS_SCHEMA: CollectionSchema;
|
|
1348
1349
|
/**
|
|
1349
1350
|
* Lint a CollectionSchema for declarations that look like they should
|
|
@@ -2552,6 +2553,184 @@ type AppMigrationIdsValidation = {
|
|
|
2552
2553
|
/** Validate the small, provider-neutral migration manifest shipped with an app bundle. */
|
|
2553
2554
|
declare function validateAppMigrationIds(value: unknown): AppMigrationIdsValidation;
|
|
2554
2555
|
|
|
2556
|
+
/**
|
|
2557
|
+
* Canonical DeepSpace model catalog and agent policy.
|
|
2558
|
+
*
|
|
2559
|
+
* Provider catalogs are discovery inputs, not a safe runtime allowlist: a
|
|
2560
|
+
* model is promoted here only after its tool loop, transport, pricing, and
|
|
2561
|
+
* streaming contract have been verified end to end through the DeepSpace
|
|
2562
|
+
* proxy. Every client picker and server agent profile consumes this module.
|
|
2563
|
+
*/
|
|
2564
|
+
type DeepSpaceAIProvider = 'anthropic' | 'openai' | 'cerebras';
|
|
2565
|
+
type DeepSpaceAgentProfileId = 'application' | 'documentation';
|
|
2566
|
+
type DeepSpaceAgentSupport = 'multi-step' | 'single-step' | 'none';
|
|
2567
|
+
interface DeepSpaceAIModel {
|
|
2568
|
+
id: string;
|
|
2569
|
+
label: string;
|
|
2570
|
+
provider: DeepSpaceAIProvider;
|
|
2571
|
+
providerLabel: string;
|
|
2572
|
+
family: string;
|
|
2573
|
+
/** Whether the model is eligible for DeepSpace's server-owned agent loop. */
|
|
2574
|
+
agentSupport: DeepSpaceAgentSupport;
|
|
2575
|
+
/** Profiles in which the model has passed the complete runtime contract. */
|
|
2576
|
+
agentProfiles: readonly DeepSpaceAgentProfileId[];
|
|
2577
|
+
/** Provider transport currently used by the DeepSpace proxy adapter. */
|
|
2578
|
+
transport: 'messages' | 'chat-completions';
|
|
2579
|
+
recommendation: 'frontier' | 'balanced' | 'fast' | 'available' | 'limited';
|
|
2580
|
+
note?: string;
|
|
2581
|
+
}
|
|
2582
|
+
interface DeepSpaceAgentProfile {
|
|
2583
|
+
id: DeepSpaceAgentProfileId;
|
|
2584
|
+
defaultModel: string;
|
|
2585
|
+
maxSteps: number;
|
|
2586
|
+
maxToolCalls?: number;
|
|
2587
|
+
allowedTools: 'application-defined' | readonly string[];
|
|
2588
|
+
}
|
|
2589
|
+
/**
|
|
2590
|
+
* Versioned provenance for the provider catalogs used during the latest
|
|
2591
|
+
* promotion review. Keeping this in the shipped artifact makes selection
|
|
2592
|
+
* policy auditable without allowing a mutable upstream list to change a
|
|
2593
|
+
* deployed app underneath a commit.
|
|
2594
|
+
*/
|
|
2595
|
+
declare const DEEPSPACE_MODEL_CATALOG_PROVENANCE: {
|
|
2596
|
+
readonly version: "2026-08-03";
|
|
2597
|
+
readonly verifiedAt: "2026-08-03";
|
|
2598
|
+
readonly sources: {
|
|
2599
|
+
readonly anthropic: "https://platform.claude.com/docs/en/api/beta/models/list";
|
|
2600
|
+
readonly openai: "https://developers.openai.com/api/docs/models/all";
|
|
2601
|
+
readonly cerebras: "https://inference-docs.cerebras.ai/models/overview";
|
|
2602
|
+
};
|
|
2603
|
+
};
|
|
2604
|
+
declare const DEEPSPACE_AI_MODELS: readonly [{
|
|
2605
|
+
readonly id: "claude-fable-5";
|
|
2606
|
+
readonly label: "Claude Fable 5";
|
|
2607
|
+
readonly family: "Claude 5";
|
|
2608
|
+
readonly recommendation: "frontier";
|
|
2609
|
+
} & {
|
|
2610
|
+
readonly provider: "anthropic";
|
|
2611
|
+
readonly providerLabel: "Anthropic";
|
|
2612
|
+
readonly transport: "messages";
|
|
2613
|
+
} & {
|
|
2614
|
+
agentSupport: "multi-step";
|
|
2615
|
+
agentProfiles: readonly ["application", "documentation"];
|
|
2616
|
+
}, {
|
|
2617
|
+
readonly id: "claude-opus-5";
|
|
2618
|
+
readonly label: "Claude Opus 5";
|
|
2619
|
+
readonly family: "Claude 5";
|
|
2620
|
+
readonly recommendation: "frontier";
|
|
2621
|
+
} & {
|
|
2622
|
+
readonly provider: "anthropic";
|
|
2623
|
+
readonly providerLabel: "Anthropic";
|
|
2624
|
+
readonly transport: "messages";
|
|
2625
|
+
} & {
|
|
2626
|
+
agentSupport: "multi-step";
|
|
2627
|
+
agentProfiles: readonly ["application", "documentation"];
|
|
2628
|
+
}, {
|
|
2629
|
+
readonly id: "claude-sonnet-5";
|
|
2630
|
+
readonly label: "Claude Sonnet 5";
|
|
2631
|
+
readonly family: "Claude 5";
|
|
2632
|
+
readonly recommendation: "balanced";
|
|
2633
|
+
} & {
|
|
2634
|
+
readonly provider: "anthropic";
|
|
2635
|
+
readonly providerLabel: "Anthropic";
|
|
2636
|
+
readonly transport: "messages";
|
|
2637
|
+
} & {
|
|
2638
|
+
agentSupport: "multi-step";
|
|
2639
|
+
agentProfiles: readonly ["application", "documentation"];
|
|
2640
|
+
}, {
|
|
2641
|
+
readonly id: "claude-haiku-4-5";
|
|
2642
|
+
readonly label: "Claude Haiku 4.5";
|
|
2643
|
+
readonly family: "Claude 4.5";
|
|
2644
|
+
readonly recommendation: "fast";
|
|
2645
|
+
} & {
|
|
2646
|
+
readonly provider: "anthropic";
|
|
2647
|
+
readonly providerLabel: "Anthropic";
|
|
2648
|
+
readonly transport: "messages";
|
|
2649
|
+
} & {
|
|
2650
|
+
agentSupport: "multi-step";
|
|
2651
|
+
agentProfiles: readonly ["application", "documentation"];
|
|
2652
|
+
}, {
|
|
2653
|
+
readonly id: "gpt-5.6-sol";
|
|
2654
|
+
readonly label: "GPT-5.6 Sol";
|
|
2655
|
+
readonly family: "GPT-5.6";
|
|
2656
|
+
readonly recommendation: "frontier";
|
|
2657
|
+
} & {
|
|
2658
|
+
readonly provider: "openai";
|
|
2659
|
+
readonly providerLabel: "OpenAI";
|
|
2660
|
+
readonly transport: "chat-completions";
|
|
2661
|
+
} & {
|
|
2662
|
+
agentSupport: "multi-step";
|
|
2663
|
+
agentProfiles: readonly ["application", "documentation"];
|
|
2664
|
+
}, {
|
|
2665
|
+
readonly id: "gpt-5.6-terra";
|
|
2666
|
+
readonly label: "GPT-5.6 Terra";
|
|
2667
|
+
readonly family: "GPT-5.6";
|
|
2668
|
+
readonly recommendation: "balanced";
|
|
2669
|
+
} & {
|
|
2670
|
+
readonly provider: "openai";
|
|
2671
|
+
readonly providerLabel: "OpenAI";
|
|
2672
|
+
readonly transport: "chat-completions";
|
|
2673
|
+
} & {
|
|
2674
|
+
agentSupport: "multi-step";
|
|
2675
|
+
agentProfiles: readonly ["application", "documentation"];
|
|
2676
|
+
}, {
|
|
2677
|
+
readonly id: "gpt-5.6-luna";
|
|
2678
|
+
readonly label: "GPT-5.6 Luna";
|
|
2679
|
+
readonly family: "GPT-5.6";
|
|
2680
|
+
readonly recommendation: "fast";
|
|
2681
|
+
} & {
|
|
2682
|
+
readonly provider: "openai";
|
|
2683
|
+
readonly providerLabel: "OpenAI";
|
|
2684
|
+
readonly transport: "chat-completions";
|
|
2685
|
+
} & {
|
|
2686
|
+
agentSupport: "multi-step";
|
|
2687
|
+
agentProfiles: readonly ["application", "documentation"];
|
|
2688
|
+
}, {
|
|
2689
|
+
readonly id: "gpt-oss-120b";
|
|
2690
|
+
readonly label: "GPT-OSS 120B";
|
|
2691
|
+
readonly provider: "cerebras";
|
|
2692
|
+
readonly providerLabel: "Cerebras";
|
|
2693
|
+
readonly family: "GPT-OSS";
|
|
2694
|
+
readonly agentSupport: "single-step";
|
|
2695
|
+
readonly agentProfiles: readonly [];
|
|
2696
|
+
readonly transport: "chat-completions";
|
|
2697
|
+
readonly recommendation: "limited";
|
|
2698
|
+
readonly note: "Available for direct generation; the current proxy adapter has not passed multi-step tool-result continuation.";
|
|
2699
|
+
}];
|
|
2700
|
+
declare const DEEPSPACE_AI_DEFAULTS: {
|
|
2701
|
+
readonly agent: "claude-sonnet-5";
|
|
2702
|
+
readonly directGeneration: "claude-sonnet-5";
|
|
2703
|
+
readonly summarization: "claude-haiku-4-5";
|
|
2704
|
+
};
|
|
2705
|
+
declare const DEEPSPACE_AGENT_PROFILES: {
|
|
2706
|
+
readonly application: {
|
|
2707
|
+
readonly id: "application";
|
|
2708
|
+
readonly defaultModel: "claude-sonnet-5";
|
|
2709
|
+
readonly maxSteps: 5;
|
|
2710
|
+
readonly allowedTools: "application-defined";
|
|
2711
|
+
};
|
|
2712
|
+
readonly documentation: {
|
|
2713
|
+
readonly id: "documentation";
|
|
2714
|
+
readonly defaultModel: "claude-sonnet-5";
|
|
2715
|
+
readonly maxSteps: 21;
|
|
2716
|
+
readonly maxToolCalls: 20;
|
|
2717
|
+
readonly allowedTools: readonly ["docs_search", "docs_read"];
|
|
2718
|
+
};
|
|
2719
|
+
};
|
|
2720
|
+
type DeepSpaceAIModelId = (typeof DEEPSPACE_AI_MODELS)[number]['id'];
|
|
2721
|
+
declare function getDeepSpaceAIModel(modelId: unknown): DeepSpaceAIModel | null;
|
|
2722
|
+
declare function listDeepSpaceAgentModels(profileId?: DeepSpaceAgentProfileId): readonly DeepSpaceAIModel[];
|
|
2723
|
+
interface ResolvedDeepSpaceAgentModel {
|
|
2724
|
+
modelId: string;
|
|
2725
|
+
provider: DeepSpaceAIProvider;
|
|
2726
|
+
model: DeepSpaceAIModel;
|
|
2727
|
+
profile: DeepSpaceAgentProfile;
|
|
2728
|
+
}
|
|
2729
|
+
declare function resolveDeepSpaceAgentModel(modelId: unknown, profileId?: DeepSpaceAgentProfileId): ResolvedDeepSpaceAgentModel | null;
|
|
2730
|
+
|
|
2731
|
+
/** Distinguish generated docs resources from authored page routes, including dotted slugs. */
|
|
2732
|
+
declare function isDocsResourcePath(pathname: string): boolean;
|
|
2733
|
+
|
|
2555
2734
|
/**
|
|
2556
2735
|
* Wildcard-aware CORS origin matching for the platform workers.
|
|
2557
2736
|
*
|
|
@@ -3043,9 +3222,10 @@ declare function buildCronContext(env: CronEnv, ownerUserId: string, roomId?: st
|
|
|
3043
3222
|
* Usage:
|
|
3044
3223
|
*
|
|
3045
3224
|
* // Server-side autonomous — no auth config needed
|
|
3046
|
-
* import { createDeepSpaceAI } from 'deepspace/worker'
|
|
3047
|
-
* const
|
|
3048
|
-
* const
|
|
3225
|
+
* import { createDeepSpaceAI, DEEPSPACE_AI_DEFAULTS, getDeepSpaceAIModel } from 'deepspace/worker'
|
|
3226
|
+
* const selected = getDeepSpaceAIModel(DEEPSPACE_AI_DEFAULTS.directGeneration)!
|
|
3227
|
+
* const provider = createDeepSpaceAI(env, selected.provider)
|
|
3228
|
+
* const result = await generateText({ model: provider(selected.id), ... })
|
|
3049
3229
|
*
|
|
3050
3230
|
* // User-initiated (inside a request handler)
|
|
3051
3231
|
* const jwt = c.req.header('Authorization')!.slice(7)
|
|
@@ -3058,7 +3238,6 @@ declare function buildCronContext(env: CronEnv, ownerUserId: string, roomId?: st
|
|
|
3058
3238
|
* paths into the published `dist/index.d.ts`.
|
|
3059
3239
|
*/
|
|
3060
3240
|
type DeepSpaceModelFactory = (modelId: string) => LanguageModel;
|
|
3061
|
-
type Provider = 'anthropic' | 'openai' | 'cerebras';
|
|
3062
3241
|
interface DeepSpaceAIEnv extends ApiWorkerEnv {
|
|
3063
3242
|
/**
|
|
3064
3243
|
* Long-lived owner-scoped JWT minted at deploy time (or by `deepspace dev start`).
|
|
@@ -3086,7 +3265,43 @@ interface DeepSpaceAIOptions {
|
|
|
3086
3265
|
* (explicit or `env.APP_OWNER_JWT`) automatically. Throws a clear error if
|
|
3087
3266
|
* either is unconfigured.
|
|
3088
3267
|
*/
|
|
3089
|
-
declare function createDeepSpaceAI(env: DeepSpaceAIEnv, provider:
|
|
3268
|
+
declare function createDeepSpaceAI(env: DeepSpaceAIEnv, provider: DeepSpaceAIProvider, options?: DeepSpaceAIOptions): DeepSpaceModelFactory;
|
|
3269
|
+
|
|
3270
|
+
type StreamTextOptions<TOOLS extends ToolSet> = Parameters<typeof streamText<TOOLS>>[0];
|
|
3271
|
+
type DeepSpaceAgentStreamOptions<TOOLS extends ToolSet> = Omit<StreamTextOptions<TOOLS>, 'model' | 'providerOptions' | 'stopWhen'> & {
|
|
3272
|
+
profile: DeepSpaceAgentProfileId;
|
|
3273
|
+
modelId?: unknown;
|
|
3274
|
+
authToken?: string;
|
|
3275
|
+
};
|
|
3276
|
+
interface DeepSpaceAgentStream<TOOLS extends ToolSet> {
|
|
3277
|
+
selection: ResolvedDeepSpaceAgentModel;
|
|
3278
|
+
result: StreamTextResult<TOOLS, never>;
|
|
3279
|
+
}
|
|
3280
|
+
declare class DeepSpaceAgentModelError extends Error {
|
|
3281
|
+
readonly modelId: unknown;
|
|
3282
|
+
readonly profile: DeepSpaceAgentProfileId;
|
|
3283
|
+
readonly code = "unsupported_agent_model";
|
|
3284
|
+
constructor(modelId: unknown, profile: DeepSpaceAgentProfileId);
|
|
3285
|
+
}
|
|
3286
|
+
declare class DeepSpaceAgentProfileError extends Error {
|
|
3287
|
+
readonly profile: DeepSpaceAgentProfileId;
|
|
3288
|
+
readonly toolName: string;
|
|
3289
|
+
readonly code = "agent_profile_violation";
|
|
3290
|
+
constructor(profile: DeepSpaceAgentProfileId, toolName: string);
|
|
3291
|
+
}
|
|
3292
|
+
/**
|
|
3293
|
+
* Run every DeepSpace text agent through one provider, model, and tool-loop
|
|
3294
|
+
* implementation. Agent surfaces supply only their profile-specific prompt,
|
|
3295
|
+
* messages, tools, persistence callbacks, and access token.
|
|
3296
|
+
*/
|
|
3297
|
+
declare function streamDeepSpaceAgent<TOOLS extends ToolSet>(env: DeepSpaceAIEnv, options: DeepSpaceAgentStreamOptions<TOOLS>): DeepSpaceAgentStream<TOOLS>;
|
|
3298
|
+
interface DeepSpaceAgentDiagnosticContext {
|
|
3299
|
+
profile?: DeepSpaceAgentProfileId;
|
|
3300
|
+
provider?: string;
|
|
3301
|
+
modelId?: string;
|
|
3302
|
+
}
|
|
3303
|
+
/** Preserve safe structured provider diagnostics in bounded Worker logs. */
|
|
3304
|
+
declare function deepSpaceAgentErrorSummary(error: unknown, context?: DeepSpaceAgentDiagnosticContext): string;
|
|
3090
3305
|
|
|
3091
3306
|
/**
|
|
3092
3307
|
* Composio tools for the Vercel AI SDK.
|
|
@@ -3103,11 +3318,12 @@ declare function createDeepSpaceAI(env: DeepSpaceAIEnv, provider: Provider, opti
|
|
|
3103
3318
|
*
|
|
3104
3319
|
* Usage (inside a request handler, e.g. /api/ai/chat):
|
|
3105
3320
|
*
|
|
3106
|
-
* import { composioTools,
|
|
3321
|
+
* import { composioTools, streamDeepSpaceAgent } from 'deepspace/worker'
|
|
3107
3322
|
* const jwt = c.req.header('Authorization')!.slice(7)
|
|
3108
3323
|
* const tools = await composioTools(c.env, { toolkit: 'gmail', authToken: jwt })
|
|
3109
|
-
* const
|
|
3110
|
-
*
|
|
3324
|
+
* const { result } = streamDeepSpaceAgent(c.env, {
|
|
3325
|
+
* profile: 'application', authToken: jwt, prompt, tools,
|
|
3326
|
+
* })
|
|
3111
3327
|
*
|
|
3112
3328
|
* Merge with your own tools: `tools: { ...buildTools(executor), ...composio }`.
|
|
3113
3329
|
*/
|
|
@@ -3349,6 +3565,155 @@ declare function appendMessage(stub: DurableObjectStub, msg: {
|
|
|
3349
3565
|
parts?: unknown[];
|
|
3350
3566
|
}): Promise<void>;
|
|
3351
3567
|
|
|
3568
|
+
interface DocsCorpusChunk {
|
|
3569
|
+
id: string;
|
|
3570
|
+
route: string;
|
|
3571
|
+
title: string;
|
|
3572
|
+
heading?: string;
|
|
3573
|
+
text: string;
|
|
3574
|
+
}
|
|
3575
|
+
interface DocsSearchResult {
|
|
3576
|
+
route: string;
|
|
3577
|
+
title: string;
|
|
3578
|
+
heading?: string;
|
|
3579
|
+
excerpt: string;
|
|
3580
|
+
score: number;
|
|
3581
|
+
}
|
|
3582
|
+
/** Validate the generated assistant index before any content reaches a model. */
|
|
3583
|
+
declare function parseDocsCorpus(value: unknown): DocsCorpusChunk[];
|
|
3584
|
+
/** Deterministic local lexical retrieval used by the docs agent tools. */
|
|
3585
|
+
declare function searchDocsCorpus(corpus: DocsCorpusChunk[], query: string, limit?: number): DocsSearchResult[];
|
|
3586
|
+
declare function readDocsRoute(corpus: DocsCorpusChunk[], route: string): Array<Pick<DocsCorpusChunk, 'route' | 'title' | 'heading' | 'text'>>;
|
|
3587
|
+
declare function buildDocsAssistantTools(corpus: DocsCorpusChunk[]): ToolSet;
|
|
3588
|
+
declare function buildDocsAssistantPrompt(appName: string, currentRoute: string | undefined): string;
|
|
3589
|
+
declare function normalizeDocsRoute(value: string): string;
|
|
3590
|
+
|
|
3591
|
+
/**
|
|
3592
|
+
* Durable, per-app abuse boundary for the public documentation assistant.
|
|
3593
|
+
* Bind one SQLite Durable Object instance per immutable app id.
|
|
3594
|
+
*/
|
|
3595
|
+
declare class DocsAssistantLimiter {
|
|
3596
|
+
private readonly sql;
|
|
3597
|
+
constructor(state: DurableObjectState);
|
|
3598
|
+
fetch(request: Request): Promise<Response>;
|
|
3599
|
+
private acquire;
|
|
3600
|
+
private release;
|
|
3601
|
+
private consumeWindow;
|
|
3602
|
+
}
|
|
3603
|
+
|
|
3604
|
+
interface DocsAssistantRouteEnv extends DeepSpaceAIEnv {
|
|
3605
|
+
ASSETS: Fetcher;
|
|
3606
|
+
APP_NAME: string;
|
|
3607
|
+
DEEPSPACE_APP_ID: string;
|
|
3608
|
+
DOCS_ASSISTANT_LIMITER: DurableObjectNamespace;
|
|
3609
|
+
}
|
|
3610
|
+
/** Register the standard, read-only documentation assistant endpoint. */
|
|
3611
|
+
declare function registerDocsAssistantRoutes<Env extends DocsAssistantRouteEnv>(app: Hono<{
|
|
3612
|
+
Bindings: Env;
|
|
3613
|
+
}>, resolveAuth: (request: Request, env: Env) => Promise<unknown | null>): void;
|
|
3614
|
+
/** Preserve useful provider diagnostics in Workers-for-Platforms string logs. */
|
|
3615
|
+
declare const docsAssistantErrorSummary: typeof deepSpaceAgentErrorSummary;
|
|
3616
|
+
interface DocsAssistantHistoryMessage {
|
|
3617
|
+
role: 'user' | 'assistant';
|
|
3618
|
+
content: string;
|
|
3619
|
+
}
|
|
3620
|
+
/**
|
|
3621
|
+
* Accept only the completed, alternating UI turns that precede the current
|
|
3622
|
+
* question. The browser remains stateless; the shared agent runner receives a
|
|
3623
|
+
* bounded ephemeral transcript on each request.
|
|
3624
|
+
*/
|
|
3625
|
+
declare function normalizeDocsAssistantHistory(value: unknown): DocsAssistantHistoryMessage[];
|
|
3626
|
+
/**
|
|
3627
|
+
* Own the reserved docs namespace before an existing app's SPA wildcard.
|
|
3628
|
+
* The dispatcher rewrites public docs requests into this namespace.
|
|
3629
|
+
*/
|
|
3630
|
+
declare function registerDocsStaticRoutes<Env extends Pick<DocsAssistantRouteEnv, 'ASSETS'>>(app: Hono<{
|
|
3631
|
+
Bindings: Env;
|
|
3632
|
+
}>): void;
|
|
3633
|
+
|
|
3634
|
+
interface DocsMcpRouteEnv {
|
|
3635
|
+
ASSETS: Fetcher;
|
|
3636
|
+
DEEPSPACE_APP_ID: string;
|
|
3637
|
+
DOCS_ASSISTANT_LIMITER: DurableObjectNamespace;
|
|
3638
|
+
}
|
|
3639
|
+
/** Register the public, stateless MCP endpoint for a documentation surface. */
|
|
3640
|
+
declare function registerDocsMcpRoutes<Env extends DocsMcpRouteEnv>(app: Hono<{
|
|
3641
|
+
Bindings: Env;
|
|
3642
|
+
}>): void;
|
|
3643
|
+
|
|
3644
|
+
interface DeepSpaceDocsRouteEnv extends DocsAssistantRouteEnv, DocsMcpRouteEnv {
|
|
3645
|
+
}
|
|
3646
|
+
interface DeepSpaceDocsRouteOptions<Env extends DeepSpaceDocsRouteEnv> {
|
|
3647
|
+
resolveAuth: (request: Request, env: Env) => Promise<unknown | null>;
|
|
3648
|
+
}
|
|
3649
|
+
/** Register the complete native docs protocol surface in its required order. */
|
|
3650
|
+
declare function registerDeepSpaceDocs<Env extends DeepSpaceDocsRouteEnv>(app: Hono<{
|
|
3651
|
+
Bindings: Env;
|
|
3652
|
+
}>, options: DeepSpaceDocsRouteOptions<Env>): void;
|
|
3653
|
+
/** Canonical manifest entry for the public docs assistant/MCP concurrency limiter. */
|
|
3654
|
+
declare function docsAssistantLimiterManifestEntry<ClassName extends string>(className: ClassName): {
|
|
3655
|
+
readonly binding: "DOCS_ASSISTANT_LIMITER";
|
|
3656
|
+
readonly className: ClassName;
|
|
3657
|
+
readonly sqlite: true;
|
|
3658
|
+
};
|
|
3659
|
+
|
|
3660
|
+
interface DocsPublishedManifest {
|
|
3661
|
+
sourceHash: string;
|
|
3662
|
+
name: string;
|
|
3663
|
+
assistant: {
|
|
3664
|
+
access: 'disabled' | 'public' | 'authenticated';
|
|
3665
|
+
model?: string;
|
|
3666
|
+
};
|
|
3667
|
+
mcp: {
|
|
3668
|
+
access: 'disabled' | 'public';
|
|
3669
|
+
};
|
|
3670
|
+
}
|
|
3671
|
+
interface DocsPublishedEnv {
|
|
3672
|
+
ASSETS: Fetcher;
|
|
3673
|
+
}
|
|
3674
|
+
interface DocsPublishedPage {
|
|
3675
|
+
route: string;
|
|
3676
|
+
title: string;
|
|
3677
|
+
markdown: string;
|
|
3678
|
+
}
|
|
3679
|
+
type DocsPublishedCorpusResult = {
|
|
3680
|
+
ok: true;
|
|
3681
|
+
chunks: DocsCorpusChunk[];
|
|
3682
|
+
} | {
|
|
3683
|
+
ok: false;
|
|
3684
|
+
error: unknown;
|
|
3685
|
+
};
|
|
3686
|
+
/** Read the small, generated policy manifest shared by docs runtime features. */
|
|
3687
|
+
declare function loadDocsPublishedManifest(env: DocsPublishedEnv, requestUrl?: string): Promise<DocsPublishedManifest | null>;
|
|
3688
|
+
/** Load and validate the generated corpus once per docs source hash. */
|
|
3689
|
+
declare function loadDocsPublishedCorpus(env: DocsPublishedEnv, sourceHash: string, requestUrl?: string): Promise<DocsCorpusChunk[]>;
|
|
3690
|
+
/** Convert asset and validation failures into one explicit route-level result. */
|
|
3691
|
+
declare function resolveDocsPublishedCorpus(env: DocsPublishedEnv, sourceHash: string, requestUrl?: string): Promise<DocsPublishedCorpusResult>;
|
|
3692
|
+
/** Read the complete generated Markdown only for a route in the public corpus. */
|
|
3693
|
+
declare function readDocsPublishedPage(env: DocsPublishedEnv, corpus: DocsCorpusChunk[], requestedRoute: string, requestUrl?: string): Promise<DocsPublishedPage | null>;
|
|
3694
|
+
|
|
3695
|
+
interface DocsPublicLimiterEnv {
|
|
3696
|
+
DEEPSPACE_APP_ID: string;
|
|
3697
|
+
DOCS_ASSISTANT_LIMITER: DurableObjectNamespace;
|
|
3698
|
+
}
|
|
3699
|
+
interface DocsPublicLease {
|
|
3700
|
+
leaseId: string;
|
|
3701
|
+
stub: DurableObjectStub;
|
|
3702
|
+
}
|
|
3703
|
+
type DocsPublicLeaseResult = {
|
|
3704
|
+
ok: true;
|
|
3705
|
+
lease: DocsPublicLease;
|
|
3706
|
+
} | {
|
|
3707
|
+
ok: false;
|
|
3708
|
+
status: 429 | 503;
|
|
3709
|
+
};
|
|
3710
|
+
/** Hash the edge client address before it reaches durable limiter storage. */
|
|
3711
|
+
declare function docsPublicClientKey(value: string): Promise<string>;
|
|
3712
|
+
/** Acquire one bounded public docs operation from the per-app limiter. */
|
|
3713
|
+
declare function acquireDocsPublicLease(env: DocsPublicLimiterEnv, clientKey: string, logPrefix: string): Promise<DocsPublicLeaseResult>;
|
|
3714
|
+
/** Release a concurrency lease; window usage remains consumed. */
|
|
3715
|
+
declare function releaseDocsPublicLease(lease: DocsPublicLease | undefined, logPrefix: string): Promise<void>;
|
|
3716
|
+
|
|
3352
3717
|
/**
|
|
3353
3718
|
* Per-binding usage metering — record Vectorize / Workers AI / etc. costs
|
|
3354
3719
|
* to the auto-attached `USAGE_EVENTS` Analytics Engine dataset.
|
|
@@ -4894,4 +5259,4 @@ interface AppLogsResponse {
|
|
|
4894
5259
|
declare const APP_LOG_EVENT_KEYS: readonly ["id", "timestamp", "level", "eventType", "message", "source", "outcome", "request", "exception"];
|
|
4895
5260
|
type AppLogEventKey = (typeof APP_LOG_EVENT_KEYS)[number];
|
|
4896
5261
|
|
|
4897
|
-
export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, ALLOWED_BINDING_TYPES, APP_ID_RE, 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 AppMigrationIdsValidation, type AppNameResolution, type AppNameValidation, type AuthWorkerEnv, Awareness, type AwarenessState, type AwarenessStates, BASE_USERS_SCHEMA, BUILT_IN_TOOLS, type BaseMessage, BaseRoom, CANONICAL_APP_IDENTITY_MIGRATION_ID, 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, DEPLOYED_APPS_DEFAULTS, 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, REGISTRY_INSTANCE, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_NAMES, RESOURCE_ID_RE, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_DEFAULT, RecordRoom, type RecordRoomConfig, RegistryClientError, type ResolvedColumn, type ResolvedPermission, type RolePermissions, type RunMigrationsResult, STRICT_APP_ID_RE, SYSTEM_COLLECTIONS, SYSTEM_MANAGED_COLUMNS, SchemaRegistry, type ScopeContext, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, 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, callRegistry, 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, matchOrigin, meterAi, meterUsage, meterVectorize, noopPermissionContext, parseQuotaLimit, platformCorsPatterns, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, readVarUint, readVarUint8Array, registerClientErrorRoute, registryErrorJson, registryStub, resolveAppName, resolveColumn, rowToData, runMigrations, serverBuild, timingSafeEqualHex, timingSafeEqualStrings, toUint8Array, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppMigrationIds, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema, writeVarUint, writeVarUint8Array };
|
|
5262
|
+
export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, ALLOWED_BINDING_TYPES, APP_ID_RE, 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 AppMigrationIdsValidation, type AppNameResolution, type AppNameValidation, type AuthWorkerEnv, Awareness, type AwarenessState, type AwarenessStates, BASE_USERS_SCHEMA, BUILT_IN_TOOLS, type BaseMessage, BaseRoom, CANONICAL_APP_IDENTITY_MIGRATION_ID, 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_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 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 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, REGISTRY_INSTANCE, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_NAMES, RESOURCE_ID_RE, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_DEFAULT, RecordRoom, type RecordRoomConfig, RegistryClientError, type ResolvedColumn, type ResolvedDeepSpaceAgentModel, type ResolvedPermission, type RolePermissions, type RunMigrationsResult, STRICT_APP_ID_RE, SYSTEM_COLLECTIONS, SYSTEM_MANAGED_COLUMNS, SchemaRegistry, type ScopeContext, type ScopedR2Auth, type ScopedR2Config, type ScopedR2Handler, type ScreenshotEnv, 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, acquireDocsPublicLease, analyzePermissions, apiWorkerFetch, appendMessage, applyAiToolDefaults, applySlidingWindow, authWorkerFetch, bindingManifestFromOutputConfig, buildCronContext, buildDocsAssistantPrompt, buildDocsAssistantTools, buildTableSelect, buildUiParts, callRegistry, canCreate, canDelete, canRead, canUpdate, capToolResultSize, captureScreenshot, checkFieldPermissions, clientBuild, coerceValue, collectionTableName, columnId, composioTools, computeDoMigration, computeHmacHex, createChat, createDecoder, createDeepSpaceAI, createDeepSpaceAuth, createEncoder, createScopedR2Handler, dataToColumnValues, decodeJwtPayload, deepSpaceAgentErrorSummary, deleteChatCascade, dispatch, docsAssistantErrorSummary, docsAssistantLimiterManifestEntry, docsPublicClientKey, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, enqueueJob, getChat, getDeepSpaceAIModel, getGlobalDOSchemas, getGlobalDOType, getMessageType, getRolePermissions, handleAwarenessMessage, handleClientErrorReport, handleSyncMessage, hasContent, isAutoProvision, isDocsResourcePath, isOwner, isTestAccountClaims, isTestAccountEmail, isTestAccountTier, lintSchema, listDeepSpaceAgentModels, loadDocsPublishedCorpus, loadDocsPublishedManifest, loadMessages, makeDefaultSummarizer, matchOrigin, meterAi, meterUsage, meterVectorize, noopPermissionContext, normalizeDocsAssistantHistory, normalizeDocsRoute, parseDocsCorpus, parseQuotaLimit, platformCorsPatterns, platformWorkerFetch, prepareMessagesWithCompaction, priceBindingUsageEvent, readDocsPublishedPage, readDocsRoute, readVarUint, readVarUint8Array, registerClientErrorRoute, registerDeepSpaceDocs, registerDocsAssistantRoutes, registerDocsMcpRoutes, registerDocsStaticRoutes, registryErrorJson, registryStub, releaseDocsPublicLease, resolveAppName, resolveColumn, resolveDeepSpaceAgentModel, resolveDocsPublishedCorpus, rowToData, runMigrations, searchDocsCorpus, serverBuild, streamDeepSpaceAgent, timingSafeEqualHex, timingSafeEqualStrings, toUint8Array, totalChars, truncateOldToolResults, turnsToCoreMessages, unwrapToolOutput, updateChat, validateAppMigrationIds, validateAppName, validateBindingManifest, validateDoManifest, verifyJwt, workspaceAccountsSchema, workspaceContentSharesSchema, workspaceEmailHandlesSchema, workspaceFormResponsesSchema, workspacePeopleSchema, workspaceProjectsSchema, workspaceTagsSchema, workspaceTasksSchema, workspaceTeamMembersSchema, workspaceTeamsSchema, workspaceTransactionsSchema, writeVarUint, writeVarUint8Array };
|