drizzle-cube 0.4.19 → 0.4.21

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.
Files changed (42) hide show
  1. package/dist/adapters/anthropic-BTkjgFpT.cjs +1 -0
  2. package/dist/adapters/anthropic-CTu9E801.js +126 -0
  3. package/dist/adapters/express/index.cjs +6 -6
  4. package/dist/adapters/express/index.js +73 -69
  5. package/dist/adapters/fastify/index.cjs +6 -6
  6. package/dist/adapters/fastify/index.js +133 -129
  7. package/dist/adapters/google-BAK9pnQf.cjs +2 -0
  8. package/dist/adapters/google-DficVAsJ.js +146 -0
  9. package/dist/adapters/{handler-BV4JuWNW.js → handler-9Rdn7zM2.js} +537 -457
  10. package/dist/adapters/handler-B-tEntiU.cjs +39 -0
  11. package/dist/adapters/hono/index.cjs +6 -6
  12. package/dist/adapters/hono/index.js +199 -195
  13. package/dist/adapters/index-BIMhF5KZ.cjs +23 -0
  14. package/dist/adapters/index-BgCeQBuN.cjs +2 -0
  15. package/dist/adapters/index-C45_meK_.js +719 -0
  16. package/dist/adapters/index-CFEJ62GJ.js +5337 -0
  17. package/dist/adapters/nextjs/index.cjs +5 -5
  18. package/dist/adapters/nextjs/index.js +215 -211
  19. package/dist/adapters/openai-CUSRuKTk.js +131 -0
  20. package/dist/adapters/openai-mLo2MCat.cjs +1 -0
  21. package/dist/client/components/AgenticNotebook/AgentChatPanel.d.ts +3 -0
  22. package/dist/client/components/AgenticNotebook/index.d.ts +6 -0
  23. package/dist/client/hooks/useAgentChat.d.ts +6 -0
  24. package/dist/client/index.js +730 -697
  25. package/dist/client/index.js.map +1 -1
  26. package/dist/client/styles.css +1 -1
  27. package/dist/client-bundle-stats.html +1 -1
  28. package/dist/server/anthropic-BTkjgFpT.cjs +1 -0
  29. package/dist/server/anthropic-CTu9E801.js +126 -0
  30. package/dist/server/google-BAK9pnQf.cjs +2 -0
  31. package/dist/server/google-DficVAsJ.js +146 -0
  32. package/dist/server/index-BIMhF5KZ.cjs +23 -0
  33. package/dist/server/index-BgCeQBuN.cjs +2 -0
  34. package/dist/server/index-C45_meK_.js +719 -0
  35. package/dist/server/index-CFEJ62GJ.js +5337 -0
  36. package/dist/server/index.cjs +51 -45
  37. package/dist/server/index.d.ts +49 -10
  38. package/dist/server/index.js +1978 -1898
  39. package/dist/server/openai-CUSRuKTk.js +131 -0
  40. package/dist/server/openai-mLo2MCat.cjs +1 -0
  41. package/package.json +12 -2
  42. package/dist/adapters/handler-D4MVKkVy.cjs +0 -33
@@ -25,13 +25,28 @@ export declare interface AgentChatRequest {
25
25
 
26
26
  /**
27
27
  * Agent configuration options (provided in adapter options).
28
- * Uses `@anthropic-ai/sdk` (the standard Anthropic API client) for direct
29
- * HTTP API calls — no subprocess spawning, fully edge-runtime compatible.
28
+ * Supports multiple LLM providers defaults to Anthropic for backward compatibility.
29
+ * All providers use direct HTTP API calls — no subprocess spawning, fully edge-runtime compatible.
30
30
  */
31
31
  export declare interface AgentConfig {
32
- /** Server-side Anthropic API key */
32
+ /**
33
+ * LLM provider to use (default: 'anthropic').
34
+ * - 'anthropic': Claude models via @anthropic-ai/sdk
35
+ * - 'openai': OpenAI models via openai SDK (also supports Groq, Together, Mistral, Ollama via baseURL)
36
+ * - 'google': Gemini models via @google/generative-ai
37
+ */
38
+ provider?: 'anthropic' | 'openai' | 'google';
39
+ /**
40
+ * Base URL for OpenAI-compatible providers.
41
+ * Only used when provider is 'openai'. Examples:
42
+ * - Groq: 'https://api.groq.com/openai/v1'
43
+ * - Together: 'https://api.together.xyz/v1'
44
+ * - Ollama: 'http://localhost:11434/v1'
45
+ */
46
+ baseURL?: string;
47
+ /** Server-side API key for the selected provider */
33
48
  apiKey?: string;
34
- /** Model to use (default: 'claude-sonnet-4-6') */
49
+ /** Model to use (default depends on provider: 'claude-sonnet-4-6' for Anthropic, 'gpt-4.1-mini' for OpenAI, 'gemini-3-flash-preview' for Google) */
35
50
  model?: string;
36
51
  /** Maximum agentic turns per request (default: 25) */
37
52
  maxTurns?: number;
@@ -41,6 +56,16 @@ export declare interface AgentConfig {
41
56
  allowClientApiKey?: boolean;
42
57
  /** Optional observability hooks for tracing */
43
58
  observability?: AgentObservabilityHooks;
59
+ /**
60
+ * Build per-request system context for the LLM prompt from the authenticated security context.
61
+ * Called on every agent chat request with the resolved security context.
62
+ * The returned string is appended to the system prompt under "## User Context".
63
+ *
64
+ * @example
65
+ * buildSystemContext: (securityContext) =>
66
+ * `User: ${securityContext.userName}, Role: ${securityContext.role}`
67
+ */
68
+ buildSystemContext?: (securityContext: Record<string, unknown>) => string | undefined;
44
69
  }
45
70
 
46
71
  /**
@@ -76,7 +101,7 @@ export declare interface AgentObservabilityHooks {
76
101
  model: string;
77
102
  historyLength: number;
78
103
  }) => void;
79
- /** Called after each Anthropic API call completes */
104
+ /** Called after each LLM API call completes */
80
105
  onGenerationEnd?: (event: {
81
106
  traceId: string;
82
107
  turn: number;
@@ -85,6 +110,10 @@ export declare interface AgentObservabilityHooks {
85
110
  inputTokens?: number;
86
111
  outputTokens?: number;
87
112
  durationMs: number;
113
+ /** Messages array sent to the API */
114
+ input?: unknown;
115
+ /** Assistant content blocks from the response */
116
+ output?: unknown;
88
117
  }) => void;
89
118
  /** Called after each tool execution */
90
119
  onToolEnd?: (event: {
@@ -2227,10 +2256,9 @@ export declare function getToolDefinitions(): ToolDefinition[];
2227
2256
  /**
2228
2257
  * Handle an agent chat request, yielding SSE events as the agent works.
2229
2258
  *
2230
- * Uses the Anthropic Messages API (`@anthropic-ai/sdk`) with `stream: true`
2231
- * (raw async iterable) for Cloudflare Workers / edge-runtime compatibility.
2259
+ * Uses the configured LLM provider with streaming for edge-runtime compatibility.
2232
2260
  * Implements a manual agentic loop: send messages → stream response → execute
2233
- * tool calls → append results → repeat until stop_reason !== 'tool_use'.
2261
+ * tool calls → append results → repeat until the model stops requesting tools.
2234
2262
  */
2235
2263
  export declare function handleAgentChat(options: {
2236
2264
  message: string;
@@ -2240,6 +2268,12 @@ export declare function handleAgentChat(options: {
2240
2268
  securityContext: SecurityContext;
2241
2269
  agentConfig: AgentConfig;
2242
2270
  apiKey: string;
2271
+ /** Per-request context appended to the system prompt (e.g. user info, tenant context) */
2272
+ systemContext?: string;
2273
+ /** Per-request overrides from client headers (take precedence over agentConfig) */
2274
+ providerOverride?: string;
2275
+ modelOverride?: string;
2276
+ baseURLOverride?: string;
2243
2277
  }): AsyncGenerator<AgentSSEEvent>;
2244
2278
 
2245
2279
  /**
@@ -4814,12 +4848,17 @@ declare interface TimeDimensionRef {
4814
4848
  export declare type TimeGranularity = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
4815
4849
 
4816
4850
  /**
4817
- * Anthropic API tool definition (JSON schema format)
4851
+ * LLM Provider Abstraction Types
4852
+ * Provider-agnostic interfaces for multi-provider LLM support in the agentic notebook.
4853
+ */
4854
+ /**
4855
+ * Generic tool definition (provider-agnostic).
4856
+ * Each provider's formatTools() wraps this in its own format.
4818
4857
  */
4819
4858
  declare interface ToolDefinition {
4820
4859
  name: string;
4821
4860
  description: string;
4822
- input_schema: {
4861
+ parameters: {
4823
4862
  type: 'object';
4824
4863
  properties: Record<string, unknown>;
4825
4864
  required?: string[];