@strav/brain 1.0.0-alpha.22 → 1.0.0-alpha.25

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 (45) hide show
  1. package/package.json +3 -3
  2. package/src/agent_runner.ts +1 -1
  3. package/src/{provider.ts → brain_driver.ts} +11 -10
  4. package/src/brain_error.ts +86 -10
  5. package/src/brain_manager.ts +30 -7
  6. package/src/brain_provider.ts +16 -16
  7. package/src/drivers/anthropic/anthropic_brain_driver.ts +641 -0
  8. package/src/drivers/anthropic/anthropic_helpers.ts +65 -0
  9. package/src/drivers/anthropic/anthropic_message_builder.ts +258 -0
  10. package/src/drivers/anthropic/anthropic_response_mapper.ts +123 -0
  11. package/src/drivers/anthropic/anthropic_tool_loop.ts +246 -0
  12. package/src/drivers/anthropic/index.ts +1 -0
  13. package/src/{providers/deepseek_provider.ts → drivers/deepseek/deepseek_brain_driver.ts} +10 -10
  14. package/src/drivers/deepseek/index.ts +1 -0
  15. package/src/{providers/gemini_provider.ts → drivers/gemini/gemini_brain_driver.ts} +21 -21
  16. package/src/drivers/gemini/index.ts +1 -0
  17. package/src/drivers/ollama/index.ts +1 -0
  18. package/src/{providers/ollama_provider.ts → drivers/ollama/ollama_brain_driver.ts} +5 -5
  19. package/src/drivers/openai/index.ts +1 -0
  20. package/src/{providers/openai_provider.ts → drivers/openai/openai_brain_driver.ts} +152 -591
  21. package/src/drivers/openai/openai_helpers.ts +58 -0
  22. package/src/drivers/openai/openai_message_builder.ts +187 -0
  23. package/src/drivers/openai/openai_response_mapper.ts +70 -0
  24. package/src/drivers/openai/openai_tool_dispatch.ts +127 -0
  25. package/src/drivers/openai/openai_tool_loop.ts +191 -0
  26. package/src/drivers/openai_compat/index.ts +1 -0
  27. package/src/{providers/openai_compat_provider.ts → drivers/openai_compat/openai_compat_brain_driver.ts} +16 -16
  28. package/src/drivers/openai_responses/index.ts +1 -0
  29. package/src/{providers/openai_responses_provider.ts → drivers/openai_responses/openai_responses_brain_driver.ts} +24 -24
  30. package/src/index.ts +18 -12
  31. package/src/mcp/pool.ts +1 -1
  32. package/src/persistence/brain_message.ts +1 -1
  33. package/src/persistence/brain_message_repository.ts +3 -11
  34. package/src/persistence/brain_suspended_run.ts +1 -1
  35. package/src/persistence/brain_suspended_run_repository.ts +2 -11
  36. package/src/persistence/brain_thread.ts +1 -1
  37. package/src/persistence/brain_thread_repository.ts +2 -11
  38. package/src/persistence/index.ts +1 -1
  39. package/src/tool_runner.ts +1 -1
  40. package/src/types.ts +2 -2
  41. package/src/providers/anthropic_provider.ts +0 -1194
  42. /package/src/persistence/{schema → schemas}/brain_message_schema.ts +0 -0
  43. /package/src/persistence/{schema → schemas}/brain_suspended_run_schema.ts +0 -0
  44. /package/src/persistence/{schema → schemas}/brain_thread_schema.ts +0 -0
  45. /package/src/persistence/{schema → schemas}/index.ts +0 -0
@@ -1,12 +1,12 @@
1
1
  /**
2
- * `OpenAICompatProvider` — abstract intermediate that captures the
2
+ * `OpenAICompatBrainDriver` — abstract intermediate that captures the
3
3
  * "OpenAI-compatible local / third-party endpoint" pattern shared by
4
- * `DeepSeekProvider`, `OllamaProvider`, and anything else (Groq,
4
+ * `DeepSeekBrainDriver`, `OllamaBrainDriver`, and anything else (Groq,
5
5
  * Together, Fireworks, vLLM, llama.cpp's server, …) that exposes a
6
6
  * `/v1/chat/completions` surface that is request-/response-shape-
7
7
  * identical to OpenAI's.
8
8
  *
9
- * What it does, factored out of OpenAIProvider:
9
+ * What it does, factored out of OpenAIBrainDriver:
10
10
  *
11
11
  * - **Strips `reasoning_effort`.** Compat endpoints typically
12
12
  * reject unknown fields. `buildParams` removes it on every
@@ -39,14 +39,14 @@
39
39
  */
40
40
 
41
41
  import type OpenAI from 'openai'
42
- import type { AgentGenerateResult } from '../agent_generate_result.ts'
43
- import type { AgentStreamEvent } from '../agent_stream_event.ts'
44
- import { BrainError } from '../brain_error.ts'
45
- import { parseGenerated, type OutputSchema } from '../output_schema.ts'
46
- import type { RunWithToolsOptions } from '../provider.ts'
47
- import type { Tool } from '../tool.ts'
48
- import { recoverOrThrow, runToolWithRecovery } from '../tool_runner.ts'
49
- import { ToolExecutionError } from '../tool_execution_error.ts'
42
+ import type { AgentGenerateResult } from '../../agent_generate_result.ts'
43
+ import type { AgentStreamEvent } from '../../agent_stream_event.ts'
44
+ import { BrainError } from '../../brain_error.ts'
45
+ import { parseGenerated, type OutputSchema } from '../../output_schema.ts'
46
+ import type { RunWithToolsOptions } from '../../brain_driver.ts'
47
+ import type { Tool } from '../../tool.ts'
48
+ import { recoverOrThrow, runToolWithRecovery } from '../../tool_runner.ts'
49
+ import { ToolExecutionError } from '../../tool_execution_error.ts'
50
50
  import type {
51
51
  ChatOptions,
52
52
  ChatUsage,
@@ -56,10 +56,10 @@ import type {
56
56
  SystemPrompt,
57
57
  ToolResultBlock,
58
58
  ToolUseBlock,
59
- } from '../types.ts'
60
- import { OpenAIProvider } from './openai_provider.ts'
59
+ } from '../../types.ts'
60
+ import { OpenAIBrainDriver } from '../openai/openai_brain_driver.ts'
61
61
 
62
- export abstract class OpenAICompatProvider extends OpenAIProvider {
62
+ export abstract class OpenAICompatBrainDriver extends OpenAIBrainDriver {
63
63
  /**
64
64
  * Same as the OpenAI build but strips `reasoning_effort` — most
65
65
  * compat endpoints reject unknown fields. Subclasses that target
@@ -528,7 +528,7 @@ function prepareToolForcing(
528
528
  const respondName = `${RESPOND_TOOL_PREFIX}${schema.name}`
529
529
  if (userTools.some((t) => t.name === respondName)) {
530
530
  throw new BrainError(
531
- `OpenAICompatProvider.runWithToolsAndSchema: synthetic tool name "${respondName}" collides with a user-supplied tool. Rename your tool or the OutputSchema.name to avoid the clash.`,
531
+ `OpenAICompatBrainDriver.runWithToolsAndSchema: synthetic tool name "${respondName}" collides with a user-supplied tool. Rename your tool or the OutputSchema.name to avoid the clash.`,
532
532
  { context: { conflictingName: respondName } },
533
533
  )
534
534
  }
@@ -601,7 +601,7 @@ function fromOpenAIAssistant(
601
601
  function addUsageHere(
602
602
  acc: ChatUsage,
603
603
  u: OpenAI.CompletionUsage | undefined,
604
- provider: OpenAICompatProvider,
604
+ provider: OpenAICompatBrainDriver,
605
605
  ): void {
606
606
  if (!u) return
607
607
  // Cast: `mapUsage` is protected on the abstract class; we're
@@ -0,0 +1 @@
1
+ export { OpenAIResponsesBrainDriver } from './openai_responses_brain_driver.ts'
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `OpenAIResponsesProvider` — implementation of `Provider` backed
2
+ * `OpenAIResponsesBrainDriver` — implementation of `Provider` backed
3
3
  * by the `openai` SDK's Responses API
4
4
  * (`client.responses.create`).
5
5
  *
@@ -10,11 +10,11 @@
10
10
  *
11
11
  * For everything else (plain chat, embeddings, transcription,
12
12
  * function calling without server tools), the standard
13
- * `OpenAIProvider` (driver `'openai'`) is simpler. Apps that
13
+ * `OpenAIBrainDriver` (driver `'openai'`) is simpler. Apps that
14
14
  * use both register them as two separate providers and route
15
15
  * per-call.
16
16
  *
17
- * Inherits `embed` + `transcribe` from `OpenAIProvider`
17
+ * Inherits `embed` + `transcribe` from `OpenAIBrainDriver`
18
18
  * (embeddings + Whisper live on different endpoints unchanged).
19
19
  *
20
20
  * V1 coverage:
@@ -32,27 +32,27 @@
32
32
  *
33
33
  * The Responses API's message shape (`input_items`) is different
34
34
  * from chat completions' `messages`, so this is a separate
35
- * provider class rather than a strategy inside `OpenAIProvider`.
35
+ * provider class rather than a strategy inside `OpenAIBrainDriver`.
36
36
  * Translation lives in this file.
37
37
  */
38
38
 
39
39
  import OpenAI from 'openai'
40
- import type { AgentGenerateResult } from '../agent_generate_result.ts'
41
- import type { AgentResult } from '../agent_result.ts'
42
- import type { AgentStreamEvent } from '../agent_stream_event.ts'
43
- import { BrainError } from '../brain_error.ts'
44
- import type { OpenAIResponsesProviderConfig } from '../brain_config.ts'
45
- import { resolveMcpTools, type ResolveMcpToolsOptions } from '../mcp/resolve_mcp_tools.ts'
46
- import type { MCPServer } from '../mcp_server.ts'
47
- import { parseGenerated, type OutputSchema } from '../output_schema.ts'
40
+ import type { AgentGenerateResult } from '../../agent_generate_result.ts'
41
+ import type { AgentResult } from '../../agent_result.ts'
42
+ import type { AgentStreamEvent } from '../../agent_stream_event.ts'
43
+ import { BrainError } from '../../brain_error.ts'
44
+ import type { OpenAIResponsesProviderConfig } from '../../brain_config.ts'
45
+ import { resolveMcpTools, type ResolveMcpToolsOptions } from '../../mcp/resolve_mcp_tools.ts'
46
+ import type { MCPServer } from '../../mcp_server.ts'
47
+ import { parseGenerated, type OutputSchema } from '../../output_schema.ts'
48
48
  import type {
49
- Provider,
49
+ BrainDriver,
50
50
  RunWithToolsOptions,
51
51
  RunWithToolsOptionsWithSuspend,
52
- } from '../provider.ts'
53
- import type { SuspendedRun } from '../suspended_run.ts'
54
- import type { Tool } from '../tool.ts'
55
- import { runToolWithRecovery } from '../tool_runner.ts'
52
+ } from '../../brain_driver.ts'
53
+ import type { SuspendedRun } from '../../suspended_run.ts'
54
+ import type { Tool } from '../../tool.ts'
55
+ import { runToolWithRecovery } from '../../tool_runner.ts'
56
56
  import type {
57
57
  ChatOptions,
58
58
  ChatResult,
@@ -66,8 +66,8 @@ import type {
66
66
  TextBlock,
67
67
  ToolResultBlock,
68
68
  ToolUseBlock,
69
- } from '../types.ts'
70
- import { OpenAIProvider } from './openai_provider.ts'
69
+ } from '../../types.ts'
70
+ import { OpenAIBrainDriver } from '../openai/openai_brain_driver.ts'
71
71
 
72
72
  const DEFAULT_OPENAI_MODEL = 'gpt-5'
73
73
  const DEFAULT_OPENAI_MAX_TOKENS = 4096
@@ -83,13 +83,13 @@ export interface OpenAIResponsesProviderOptions {
83
83
  /** Translation: framework `ServerTool` → Responses API tool entry. */
84
84
  type ResponsesTool = Record<string, unknown>
85
85
 
86
- export class OpenAIResponsesProvider extends OpenAIProvider implements Provider {
86
+ export class OpenAIResponsesBrainDriver extends OpenAIBrainDriver implements BrainDriver {
87
87
  constructor(
88
88
  name: string,
89
89
  config: OpenAIResponsesProviderConfig,
90
90
  options: OpenAIResponsesProviderOptions = {},
91
91
  ) {
92
- // Reuse OpenAIProvider's constructor for the SDK client + the
92
+ // Reuse OpenAIBrainDriver's constructor for the SDK client + the
93
93
  // chat / embed / transcribe model defaults. Inheritance keeps
94
94
  // `client`, `defaultEmbedModel`, `defaultTranscribeModel`
95
95
  // working unchanged.
@@ -951,12 +951,12 @@ function responsesServerTools(serverTools: readonly ServerTool[]): ResponsesTool
951
951
  out.push({ type: 'code_interpreter', container: { type: 'auto' } })
952
952
  } else if (t.type === 'web_fetch') {
953
953
  throw new BrainError(
954
- 'OpenAIResponsesProvider: server tool `web_fetch` is Anthropic-only. Use `web_search` for OpenAI, or route to Anthropic.',
954
+ 'OpenAIResponsesBrainDriver: server tool `web_fetch` is Anthropic-only. Use `web_search` for OpenAI, or route to Anthropic.',
955
955
  { context: { provider: 'openai-responses' } },
956
956
  )
957
957
  } else if (t.type === 'url_context') {
958
958
  throw new BrainError(
959
- 'OpenAIResponsesProvider: server tool `url_context` is Gemini-only. Route to Gemini, or include the URL in the prompt and use `web_search`.',
959
+ 'OpenAIResponsesBrainDriver: server tool `url_context` is Gemini-only. Route to Gemini, or include the URL in the prompt and use `web_search`.',
960
960
  { context: { provider: 'openai-responses' } },
961
961
  )
962
962
  }
@@ -1003,7 +1003,7 @@ async function tryRecoverParseError(
1003
1003
  cause: Error,
1004
1004
  options: RunWithToolsOptions,
1005
1005
  ): Promise<{ content: string; isError: boolean }> {
1006
- const { ToolExecutionError } = await import('../tool_execution_error.ts')
1006
+ const { ToolExecutionError } = await import('../../tool_execution_error.ts')
1007
1007
  const err = new ToolExecutionError(
1008
1008
  toolName,
1009
1009
  callId,
package/src/index.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  // Public API of @strav/brain.
2
2
  //
3
- // V1: Provider interface + AnthropicProvider, BrainManager, Thread,
3
+ // V1: BrainDriver interface + AnthropicBrainDriver, BrainManager, Thread,
4
4
  // BrainProvider service-wiring, prompt caching.
5
5
  // V2 (this slice): tools + agents — defineTool, Agent base + AgentRunner,
6
- // BrainManager.runTools / .agent(Class), Provider.runWithTools.
6
+ // BrainManager.runTools / .agent(Class), BrainDriver.runWithTools.
7
7
  // Still deferred: MCP, embeddings, streaming agent loops, server-side
8
8
  // tools, structured outputs, other providers.
9
9
 
@@ -29,7 +29,13 @@ export {
29
29
  type OpenAIResponsesProviderConfig,
30
30
  type ProviderConfig,
31
31
  } from './brain_config.ts'
32
- export { BrainError } from './brain_error.ts'
32
+ export {
33
+ BrainConfigError,
34
+ BrainError,
35
+ BrainProviderError,
36
+ BrainUsageError,
37
+ UnknownProviderError,
38
+ } from './brain_error.ts'
33
39
  export {
34
40
  type AgentResolver,
35
41
  BrainManager,
@@ -40,18 +46,18 @@ export { defineTool, type DefineToolSpec } from './define_tool.ts'
40
46
  export { MCPClientPool, type MCPClientFactory } from './mcp/pool.ts'
41
47
  export type { MCPServer, MCPServerToolConfig } from './mcp_server.ts'
42
48
  export type { OutputSchema } from './output_schema.ts'
43
- export { AnthropicProvider } from './providers/anthropic_provider.ts'
44
- export { DeepSeekProvider } from './providers/deepseek_provider.ts'
45
- export { GeminiProvider } from './providers/gemini_provider.ts'
46
- export { OllamaProvider } from './providers/ollama_provider.ts'
47
- export { OpenAICompatProvider } from './providers/openai_compat_provider.ts'
48
- export { OpenAIProvider } from './providers/openai_provider.ts'
49
- export { OpenAIResponsesProvider } from './providers/openai_responses_provider.ts'
49
+ export { AnthropicBrainDriver } from './drivers/anthropic/anthropic_brain_driver.ts'
50
+ export { DeepSeekBrainDriver } from './drivers/deepseek/deepseek_brain_driver.ts'
51
+ export { GeminiBrainDriver } from './drivers/gemini/gemini_brain_driver.ts'
52
+ export { OllamaBrainDriver } from './drivers/ollama/ollama_brain_driver.ts'
53
+ export { OpenAICompatBrainDriver } from './drivers/openai_compat/openai_compat_brain_driver.ts'
54
+ export { OpenAIBrainDriver } from './drivers/openai/openai_brain_driver.ts'
55
+ export { OpenAIResponsesBrainDriver } from './drivers/openai_responses/openai_responses_brain_driver.ts'
50
56
  export type {
51
- Provider,
57
+ BrainDriver,
52
58
  RunWithToolsOptions,
53
59
  RunWithToolsOptionsWithSuspend,
54
- } from './provider.ts'
60
+ } from './brain_driver.ts'
55
61
  export {
56
62
  appendResumeResults,
57
63
  isSuspended,
package/src/mcp/pool.ts CHANGED
@@ -23,7 +23,7 @@
23
23
  * ```ts
24
24
  * const pool = new MCPClientPool()
25
25
  *
26
- * const openai = new OpenAIProvider(
26
+ * const openai = new OpenAIBrainDriver(
27
27
  * 'openai',
28
28
  * { driver: 'openai', apiKey: ... },
29
29
  * { mcpPool: pool },
@@ -13,7 +13,7 @@
13
13
 
14
14
  import { Model } from '@strav/database'
15
15
  import type { ChatUsage, ContentBlock } from '../types.ts'
16
- import { brainMessageSchema } from './schema/brain_message_schema.ts'
16
+ import { brainMessageSchema } from './schemas/brain_message_schema.ts'
17
17
 
18
18
  export type BrainMessageRole = 'user' | 'assistant'
19
19
 
@@ -13,13 +13,11 @@
13
13
  * pagination UIs.
14
14
  */
15
15
 
16
- // biome-ignore lint/style/useImportType: PostgresDatabase needs to be a value import for @inject().
17
- import { PostgresDatabase, quoteIdent, Repository, type RepositoryScope } from '@strav/database'
18
- // biome-ignore lint/style/useImportType: EventBus value import for @inject().
19
- import { EventBus, inject, ulid } from '@strav/kernel'
16
+ import { quoteIdent, Repository, type RepositoryScope } from '@strav/database'
17
+ import { ulid } from '@strav/kernel'
20
18
  import type { ChatUsage, ContentBlock } from '../types.ts'
21
19
  import { BrainMessage, type BrainMessageRole } from './brain_message.ts'
22
- import { brainMessageSchema } from './schema/brain_message_schema.ts'
20
+ import { brainMessageSchema } from './schemas/brain_message_schema.ts'
23
21
 
24
22
  export interface AppendTurnInput {
25
23
  threadId: string
@@ -37,16 +35,10 @@ export interface LoadMessagesOptions {
37
35
  offset?: number
38
36
  }
39
37
 
40
- @inject()
41
38
  export class BrainMessageRepository extends Repository<BrainMessage> {
42
39
  static override readonly schema = brainMessageSchema
43
40
  static override readonly model = BrainMessage
44
41
 
45
- // biome-ignore lint/complexity/noUselessConstructor: explicit constructor for @inject() metadata emission.
46
- constructor(db: PostgresDatabase, events: EventBus) {
47
- super(db, events)
48
- }
49
-
50
42
  /**
51
43
  * Insert a new turn at the next `turn_index` for the thread. The
52
44
  * `turn_index` is computed in-SQL so two concurrent appends
@@ -11,7 +11,7 @@
11
11
  import { Model } from '@strav/database'
12
12
  import type { SuspendedState } from '../suspended_run.ts'
13
13
  import type { ToolUseBlock } from '../types.ts'
14
- import { brainSuspendedRunSchema } from './schema/brain_suspended_run_schema.ts'
14
+ import { brainSuspendedRunSchema } from './schemas/brain_suspended_run_schema.ts'
15
15
 
16
16
  export type BrainSuspendedRunStatus = 'pending' | 'resumed' | 'cancelled'
17
17
 
@@ -12,12 +12,9 @@
12
12
  * filtered by `user_id` or `thread_id`.
13
13
  */
14
14
 
15
- // biome-ignore lint/style/useImportType: PostgresDatabase value import for @inject().
16
- import { PostgresDatabase, Repository } from '@strav/database'
17
- // biome-ignore lint/style/useImportType: EventBus value import for @inject().
18
- import { EventBus, inject } from '@strav/kernel'
15
+ import { Repository } from '@strav/database'
19
16
  import { BrainSuspendedRun, type BrainSuspendedRunStatus } from './brain_suspended_run.ts'
20
- import { brainSuspendedRunSchema } from './schema/brain_suspended_run_schema.ts'
17
+ import { brainSuspendedRunSchema } from './schemas/brain_suspended_run_schema.ts'
21
18
 
22
19
  export interface ListPendingOptions {
23
20
  /** Filter by app-defined user — useful when an app has per-user approval queues. */
@@ -29,16 +26,10 @@ export interface ListPendingOptions {
29
26
  offset?: number
30
27
  }
31
28
 
32
- @inject()
33
29
  export class BrainSuspendedRunRepository extends Repository<BrainSuspendedRun> {
34
30
  static override readonly schema = brainSuspendedRunSchema
35
31
  static override readonly model = BrainSuspendedRun
36
32
 
37
- // biome-ignore lint/complexity/noUselessConstructor: explicit constructor for @inject() metadata emission.
38
- constructor(db: PostgresDatabase, events: EventBus) {
39
- super(db, events)
40
- }
41
-
42
33
  /** Flip status to `resumed` after `brain.resumeTools(state, ...)` succeeds. */
43
34
  async markResumed(run: BrainSuspendedRun): Promise<BrainSuspendedRun> {
44
35
  return this.markStatus(run, 'resumed')
@@ -13,7 +13,7 @@
13
13
 
14
14
  import { Model } from '@strav/database'
15
15
  import type { ChatOptions, SystemPrompt } from '../types.ts'
16
- import { brainThreadSchema } from './schema/brain_thread_schema.ts'
16
+ import { brainThreadSchema } from './schemas/brain_thread_schema.ts'
17
17
 
18
18
  export class BrainThread extends Model {
19
19
  static override readonly schema = brainThreadSchema
@@ -14,12 +14,9 @@
14
14
  * shows up in this code — the database enforces isolation.
15
15
  */
16
16
 
17
- // biome-ignore lint/style/useImportType: PostgresDatabase needs to be a value import — the @inject() decorator below resolves the constructor param via reflect-metadata, which requires the runtime class reference.
18
- import { PostgresDatabase, Repository } from '@strav/database'
19
- // biome-ignore lint/style/useImportType: EventBus has the same constraint as PostgresDatabase.
20
- import { EventBus, inject } from '@strav/kernel'
17
+ import { Repository } from '@strav/database'
21
18
  import { BrainThread } from './brain_thread.ts'
22
- import { brainThreadSchema } from './schema/brain_thread_schema.ts'
19
+ import { brainThreadSchema } from './schemas/brain_thread_schema.ts'
23
20
 
24
21
  export interface ListThreadsOptions {
25
22
  /** Pagination — defaults to 50. */
@@ -27,16 +24,10 @@ export interface ListThreadsOptions {
27
24
  offset?: number
28
25
  }
29
26
 
30
- @inject()
31
27
  export class BrainThreadRepository extends Repository<BrainThread> {
32
28
  static override readonly schema = brainThreadSchema
33
29
  static override readonly model = BrainThread
34
30
 
35
- // biome-ignore lint/complexity/noUselessConstructor: explicit constructor forces TypeScript to emit `design:paramtypes` metadata on the subclass for the @inject() decorator above.
36
- constructor(db: PostgresDatabase, events: EventBus) {
37
- super(db, events)
38
- }
39
-
40
31
  /**
41
32
  * List threads for a given app-defined user, newest-first. Empty
42
33
  * `userId` lists every thread visible under RLS — useful for
@@ -45,4 +45,4 @@ export {
45
45
  brainMessageSchema,
46
46
  brainSuspendedRunSchema,
47
47
  brainThreadSchema,
48
- } from './schema/index.ts'
48
+ } from './schemas/index.ts'
@@ -22,7 +22,7 @@
22
22
  * message content; Gemini `functionResponse` with `{ error }`).
23
23
  */
24
24
 
25
- import type { RunWithToolsOptions } from './provider.ts'
25
+ import type { RunWithToolsOptions } from './brain_driver.ts'
26
26
  import type { Tool, ToolContext } from './tool.ts'
27
27
  import { ToolExecutionError } from './tool_execution_error.ts'
28
28
 
package/src/types.ts CHANGED
@@ -376,7 +376,7 @@ export interface ChatOptions {
376
376
  * subsequent requests (Thread does this automatically). Saves
377
377
  * tokens on long threads without lossy client-side pruning.
378
378
  *
379
- * Only honored by `AnthropicProvider` (driver `'anthropic'`),
379
+ * Only honored by `AnthropicBrainDriver` (driver `'anthropic'`),
380
380
  * via the `compact-2026-01-12` beta. Silently ignored by every
381
381
  * other provider so apps targeting multiple providers with the
382
382
  * same options object don't have to special-case.
@@ -388,7 +388,7 @@ export interface ChatOptions {
388
388
  * from the prior `Response` identified by this id and replays
389
389
  * the conversation server-side. Saves tokens on long threads.
390
390
  *
391
- * Only honored by `OpenAIResponsesProvider` (driver
391
+ * Only honored by `OpenAIResponsesBrainDriver` (driver
392
392
  * `'openai-responses'`); silently ignored by every other provider
393
393
  * — apps that target multiple providers with the same options
394
394
  * object don't have to special-case.