noumen 0.6.0 → 0.8.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/README.md +237 -93
- package/dist/a2a/index.d.ts +5 -7
- package/dist/a2a/index.js +3 -4
- package/dist/a2a/index.js.map +1 -1
- package/dist/acp/index.d.ts +5 -7
- package/dist/acp/index.js +0 -1
- package/dist/acp/index.js.map +1 -1
- package/dist/{agent-DWE4_P5X.d.ts → agent-D0gl-qYi.d.ts} +89 -34
- package/dist/{chunk-6MMYCGJQ.js → chunk-5HY4IYNT.js} +1529 -2321
- package/dist/chunk-5HY4IYNT.js.map +1 -0
- package/dist/chunk-BC5BLWBC.js +21 -0
- package/dist/chunk-BC5BLWBC.js.map +1 -0
- package/dist/{chunk-XZN4QZLK.js → chunk-CX4BL6PC.js} +25 -15
- package/dist/chunk-CX4BL6PC.js.map +1 -0
- package/dist/{chunk-5GEX6ZSB.js → chunk-HQISH4D7.js} +60 -1
- package/dist/chunk-HQISH4D7.js.map +1 -0
- package/dist/{chunk-Y45R3PQL.js → chunk-NUCJXOUV.js} +32 -18
- package/dist/{chunk-Y45R3PQL.js.map → chunk-NUCJXOUV.js.map} +1 -1
- package/dist/chunk-OPFFLQZL.js +40 -0
- package/dist/chunk-OPFFLQZL.js.map +1 -0
- package/dist/chunk-PDEAJ272.js +660 -0
- package/dist/chunk-PDEAJ272.js.map +1 -0
- package/dist/chunk-PKHLGGEC.js +115 -0
- package/dist/chunk-PKHLGGEC.js.map +1 -0
- package/dist/chunk-XQTNXRE7.js +176 -0
- package/dist/chunk-XQTNXRE7.js.map +1 -0
- package/dist/chunk-XZPAA5TO.js +817 -0
- package/dist/chunk-XZPAA5TO.js.map +1 -0
- package/dist/cli/index.js +77 -42
- package/dist/cli/index.js.map +1 -1
- package/dist/client/index.d.ts +1 -2
- package/dist/client/index.js +0 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client-JJFLE6RT.js +9 -0
- package/dist/{computer-BPdxSo6X.d.ts → computer-DzMR92tK.d.ts} +1 -1
- package/dist/docker.d.ts +2 -2
- package/dist/docker.js +0 -1
- package/dist/docker.js.map +1 -1
- package/dist/e2b.d.ts +2 -2
- package/dist/e2b.js +0 -1
- package/dist/e2b.js.map +1 -1
- package/dist/freestyle.d.ts +2 -2
- package/dist/freestyle.js +0 -1
- package/dist/freestyle.js.map +1 -1
- package/dist/{headless-FFU2DESQ.js → headless-25DU4MJQ.js} +1 -3
- package/dist/{headless-FFU2DESQ.js.map → headless-25DU4MJQ.js.map} +1 -1
- package/dist/{history-snip-64GYP4ZL.js → history-snip-HAWNAYKY.js} +1 -2
- package/dist/index.d.ts +351 -72
- package/dist/index.js +54 -55
- package/dist/jsonrpc/index.js +0 -1
- package/dist/local.d.ts +168 -0
- package/dist/local.js +40 -0
- package/dist/local.js.map +1 -0
- package/dist/lsp/index.d.ts +4 -5
- package/dist/lsp/index.js +0 -1
- package/dist/{lsp-PS3BWIHC.js → lsp-3APWNKB2.js} +1 -2
- package/dist/{manager-DLXK63XC.js → manager-Z5EQ7YYV.js} +1 -2
- package/dist/mcp/index.d.ts +16 -8
- package/dist/mcp/index.js +5 -6
- package/dist/mcp/index.js.map +1 -1
- package/dist/{mcp-auth-AEI2R4ZC.js → mcp-auth-NOIQPF7W.js} +1 -2
- package/dist/{provider-factory-TUHU3DIG.js → provider-factory-KNBSHXJ6.js} +3 -3
- package/dist/{render-GRN4ZSSW.js → render-4VEODRK7.js} +1 -2
- package/dist/{resolve-6KUZNEYW.js → resolve-AGQZFMKD.js} +3 -3
- package/dist/sandbox-DAqQo0Tj.d.ts +49 -0
- package/dist/sandbox-index-ODNREIFA.js +32 -0
- package/dist/sandbox-index-ODNREIFA.js.map +1 -0
- package/dist/server/index.d.ts +18 -7
- package/dist/server/index.js +9 -5
- package/dist/server/index.js.map +1 -1
- package/dist/{server-BzNGKTP6.d.ts → server-DFXdlqyX.d.ts} +1 -1
- package/dist/{spinner-OJNR6NFO.js → spinner-72JEISPK.js} +1 -2
- package/dist/sprites.d.ts +2 -2
- package/dist/sprites.js +0 -1
- package/dist/sprites.js.map +1 -1
- package/dist/ssh.d.ts +2 -2
- package/dist/ssh.js +0 -1
- package/dist/ssh.js.map +1 -1
- package/dist/{types-DhXwOQwD.d.ts → types-BX4ALqoN.d.ts} +76 -4
- package/dist/{types-kiGBF35b.d.ts → types-DLZNyF5t.d.ts} +125 -1
- package/dist/unsandboxed.d.ts +59 -0
- package/dist/unsandboxed.js +32 -0
- package/dist/unsandboxed.js.map +1 -0
- package/dist/{uuid-RVN2T26F.js → uuid-CVTNAPEB.js} +1 -2
- package/dist/{zod-7YXKWYMC.js → zod-VKURGPRT.js} +1 -2
- package/package.json +35 -50
- package/dist/cache-BlBwXXPS.d.ts +0 -38
- package/dist/chunk-5GEX6ZSB.js.map +0 -1
- package/dist/chunk-6MMYCGJQ.js.map +0 -1
- package/dist/chunk-7IQCQI2G.js +0 -94
- package/dist/chunk-7IQCQI2G.js.map +0 -1
- package/dist/chunk-CCM2AXZG.js +0 -16
- package/dist/chunk-CCM2AXZG.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-HEQQQGK5.js +0 -131
- package/dist/chunk-HEQQQGK5.js.map +0 -1
- package/dist/chunk-I3JTUFPK.js +0 -171
- package/dist/chunk-I3JTUFPK.js.map +0 -1
- package/dist/chunk-XZN4QZLK.js.map +0 -1
- package/dist/chunk-ZXSDKBYB.js +0 -474
- package/dist/chunk-ZXSDKBYB.js.map +0 -1
- package/dist/client-CRRO2376.js +0 -10
- package/dist/providers/anthropic.d.ts +0 -19
- package/dist/providers/anthropic.js +0 -36
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/bedrock.d.ts +0 -39
- package/dist/providers/bedrock.js +0 -56
- package/dist/providers/bedrock.js.map +0 -1
- package/dist/providers/gemini.d.ts +0 -17
- package/dist/providers/gemini.js +0 -262
- package/dist/providers/gemini.js.map +0 -1
- package/dist/providers/ollama.d.ts +0 -13
- package/dist/providers/ollama.js +0 -20
- package/dist/providers/ollama.js.map +0 -1
- package/dist/providers/openai.d.ts +0 -21
- package/dist/providers/openai.js +0 -9
- package/dist/providers/openrouter.d.ts +0 -16
- package/dist/providers/openrouter.js +0 -24
- package/dist/providers/openrouter.js.map +0 -1
- package/dist/providers/vertex.d.ts +0 -42
- package/dist/providers/vertex.js +0 -68
- package/dist/providers/vertex.js.map +0 -1
- package/dist/sandbox-9qeMTNrD.d.ts +0 -126
- package/dist/types-CD0rUKKT.d.ts +0 -109
- package/dist/uuid-RVN2T26F.js.map +0 -1
- package/dist/zod-7YXKWYMC.js.map +0 -1
- /package/dist/{chunk-DGUM43GV.js.map → client-JJFLE6RT.js.map} +0 -0
- /package/dist/{client-CRRO2376.js.map → history-snip-HAWNAYKY.js.map} +0 -0
- /package/dist/{history-snip-64GYP4ZL.js.map → lsp-3APWNKB2.js.map} +0 -0
- /package/dist/{lsp-PS3BWIHC.js.map → manager-Z5EQ7YYV.js.map} +0 -0
- /package/dist/{manager-DLXK63XC.js.map → mcp-auth-NOIQPF7W.js.map} +0 -0
- /package/dist/{mcp-auth-AEI2R4ZC.js.map → provider-factory-KNBSHXJ6.js.map} +0 -0
- /package/dist/{provider-factory-TUHU3DIG.js.map → render-4VEODRK7.js.map} +0 -0
- /package/dist/{providers/openai.js.map → resolve-AGQZFMKD.js.map} +0 -0
- /package/dist/{render-GRN4ZSSW.js.map → spinner-72JEISPK.js.map} +0 -0
- /package/dist/{resolve-6KUZNEYW.js.map → uuid-CVTNAPEB.js.map} +0 -0
- /package/dist/{spinner-OJNR6NFO.js.map → zod-VKURGPRT.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { A as AIProvider, T as ToolDefinition,
|
|
4
|
-
export {
|
|
5
|
-
import { S as Sandbox } from './sandbox-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export { F as FileCheckpointManager, s as FileState, t as FileStateCache, k as FileStateCacheConfig, u as FileWriteHookInput, v as HookOutput, J as JsonSchemaType, b as LspDiagnostic, c as LspLocation, d as LspOperation, L as LspServerConfig, a as LspServerState, f as LspSymbol, M as MemoryUpdateHookInput, w as ModelSwitchHookInput, N as NotificationHookInput, x as PermissionDeniedHookInput, y as PermissionRequestHookInput, R as RetryAttemptHookInput, z as SafeParseResult, A as SessionEndHookInput, B as SessionStartHookInput, S as SubagentConfig, i as SubagentRun, C as SubagentStartHookInput, E as SubagentStopHookInput, G as Task, I as TaskCreateInput, K as TaskStatus, j as TaskStore, O as TaskUpdateInput, Q as ToolParameters, Z as ZodLikeSchema, U as formatZodValidationError, V as registerZodToJsonSchema, W as zodToJsonSchema } from './types-DhXwOQwD.js';
|
|
1
|
+
import { b as AutoTitleConfig, a as Agent, C as CacheControlConfig, S as SkillDefinition, T as ThreadConfig, c as SessionStorage, d as ContextFile, P as ProjectContextConfig, e as ContextScope, R as RetryConfig, f as RetryContext, g as RetryEngineOptions, h as Span, i as SpanAttributeValue, j as SpanStatusCode, k as Tracer, l as SpanOptions, m as StoredCostState } from './agent-D0gl-qYi.js';
|
|
2
|
+
export { A as AgentOptions, n as AutoCompactConfig, o as AutoCompactTrackingState, B as BudgetState, p as CLEARED_PLACEHOLDER, q as COMPACTABLE_TOOLS, r as CacheScope, s as ContentReplacementState, t as CostTracker, D as DEFAULT_AUTO_TITLE_MAX_INPUT_CHARS, u as DEFAULT_AUTO_TITLE_SYSTEM_PROMPT, v as DEFAULT_MODELS, w as DEFAULT_RETRY_CONFIG, x as DiagnoseCheckResult, y as DiagnoseResult, G as GenerateAutoTitleOptions, M as MicrocompactConfig, z as MicrocompactResult, E as ProviderName, F as ReactiveCompactConfig, H as ReactiveCompactResult, I as ResolveProviderOptions, J as RetryEvent, K as RunCallbacks, L as RunResult, N as SUPPORTED_PROVIDERS, O as SnipConfig, Q as SnipResult, U as Thread, V as ThreadOptions, W as ToolResultBudgetConfig, X as ToolResultBudgetResult, Y as ToolResultReplacementRecord, Z as ToolResultSpillResult, _ as ToolResultStorageConfig, $ as TracingConfig, a0 as WebSearchConfig, a1 as WebSearchResult, a2 as applyPersistedReplacements, a3 as applySnipRemovals, a4 as canAutoCompact, a5 as createAutoCompactConfig, a6 as createAutoCompactTracking, a7 as createBudgetState, a8 as createContentReplacementState, a9 as createWebSearchTool, aa as detectProvider, ab as enforceToolResultBudget, ac as enforceToolResultStorageBudget, ad as extractTitleFromResponse, ae as extractTitleSeedText, af as generateAutoTitle, ag as getMessageCacheBreakpointIndex, ah as microcompactMessages, ai as normalizeTitle, aj as persistToolResult, ak as projectSnippedView, al as reconstructContentReplacementState, am as recordAutoCompactFailure, an as recordAutoCompactSuccess, ao as resolveProvider, ap as shouldAutoCompact, aq as snipMessagesByUuids, ar as sortToolDefinitionsForCache, as as tryReactiveCompact, at as webSearchToolPlaceholder } from './agent-D0gl-qYi.js';
|
|
3
|
+
import { A as AIProvider, q as ChatParams, r as ChatStreamChunk, T as ToolDefinition, s as ToolCallContent, S as StreamEvent, l as PermissionHandler, d as ContentPart, e as ChatMessage, k as ChatCompletionUsage, t as PermissionContext, u as PermissionBehavior, v as PermissionRule, w as AutoModeConfig, x as PermissionDecision, y as PermissionUpdate, M as ModelPricing, h as UsageRecord, z as MemoryProvider, B as MemoryEntry, n as ThinkingConfig, G as AssistantMessage, H as ToolResultMessage, a as FileCheckpointSnapshot, I as ToolResultOverflowEntry, f as ContentReplacementRecord, J as JsonSchemaOutputFormat } from './types-DLZNyF5t.js';
|
|
4
|
+
export { K as AiTitleEntry, L as ChatStreamChoice, N as ChatStreamDelta, Q as ChatStreamError, C as CheckpointConfig, V as CompactBoundaryEntry, W as ContentReplacementEntry, i as CostSummary, X as CustomTitleEntry, Y as DenialTrackingConfig, D as DiffStats, E as Entry, Z as FileCheckpointBackup, _ as FileCheckpointEntry, F as FileCheckpointState, $ as ImageContent, a0 as ImageUrlContent, a1 as JsonObjectOutputFormat, o as MemoryConfig, a2 as MemoryType, a3 as MessageEntry, a4 as MetadataEntry, j as ModelUsageSummary, O as OutputFormat, a5 as PermissionAllowResult, a6 as PermissionAskResult, m as PermissionConfig, a7 as PermissionDenyResult, b as PermissionMode, a8 as PermissionPassthroughResult, a9 as PermissionRequest, P as PermissionResponse, c as PermissionResult, aa as PermissionRuleSource, ab as RULE_SOURCE_PRECEDENCE, R as RunOptions, ac as SerializedMessage, g as SessionInfo, ad as SnipBoundaryEntry, ae as SummaryEntry, af as SystemMessage, ag as TextContent, ah as ToolDefParameterProperty, p as ToolResult, ai as UserMessage, aj as createCheckpointState } from './types-DLZNyF5t.js';
|
|
5
|
+
import { S as Sandbox } from './sandbox-DAqQo0Tj.js';
|
|
6
|
+
import { H as HookDefinition, T as Tool, h as ToolContext, g as ToolResult, n as HookEvent, o as HookInput, P as PostToolUseFailureHookInput, p as PostToolUseFailureHookOutput, q as PostToolUseHookInput, r as PostToolUseHookOutput, s as PreToolUseHookInput, t as PreToolUseHookOutput } from './types-BX4ALqoN.js';
|
|
7
|
+
export { u as DEFAULT_DOT_DIRS, j as DotDirConfig, i as DotDirResolver, F as FileCheckpointManager, v as FileState, w as FileStateCache, m as FileStateCacheConfig, x as FileWriteHookInput, y as HookOutput, J as JsonSchemaType, b as LspDiagnostic, c as LspLocation, d as LspOperation, L as LspServerConfig, a as LspServerState, f as LspSymbol, M as MemoryUpdateHookInput, z as ModelSwitchHookInput, N as NotificationHookInput, A as PermissionDeniedHookInput, B as PermissionRequestHookInput, R as RetryAttemptHookInput, C as SafeParseResult, E as SessionEndHookInput, G as SessionStartHookInput, S as SubagentConfig, k as SubagentRun, I as SubagentStartHookInput, K as SubagentStopHookInput, O as Task, Q as TaskCreateInput, U as TaskStatus, l as TaskStore, V as TaskUpdateInput, W as ToolParameters, Z as ZodLikeSchema, X as createDotDirResolver, Y as formatZodValidationError, _ as readAllDotDirs, $ as readFirstDotDir, a0 as registerZodToJsonSchema, a1 as zodToJsonSchema } from './types-BX4ALqoN.js';
|
|
9
8
|
import { M as McpServerConfig } from './types-2kTLUCnD.js';
|
|
10
9
|
export { b as McpConfig, c as McpConnection, d as McpHttpServerConfig, e as McpOAuthConfig, f as McpSseServerConfig, g as McpStdioServerConfig, h as McpToolInfo, i as McpWebSocketServerConfig, a as OAuthProviderOptions, O as OAuthTokenData, T as TokenStorage } from './types-2kTLUCnD.js';
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export { OpenRouterProviderOptions } from './providers/openrouter.js';
|
|
15
|
-
export { BedrockAnthropicProviderOptions } from './providers/bedrock.js';
|
|
16
|
-
export { VertexAnthropicProviderOptions } from './providers/vertex.js';
|
|
17
|
-
export { OllamaProviderOptions } from './providers/ollama.js';
|
|
18
|
-
import { a as VirtualFs, R as ReadOptions, F as FileEntry, b as FileStat, V as VirtualComputer, E as ExecOptions, C as CommandResult } from './computer-BPdxSo6X.js';
|
|
19
|
-
import { c as PermissionHandler, e as PermissionContext, f as PermissionBehavior, g as PermissionRule, A as AutoModeConfig, h as PermissionDecision, i as PermissionUpdate } from './types-CD0rUKKT.js';
|
|
20
|
-
export { D as DenialTrackingConfig, j as PermissionAllowResult, k as PermissionAskResult, d as PermissionConfig, l as PermissionDenyResult, a as PermissionMode, m as PermissionPassthroughResult, n as PermissionRequest, P as PermissionResponse, b as PermissionResult, o as PermissionRuleSource, R as RULE_SOURCE_PRECEDENCE } from './types-CD0rUKKT.js';
|
|
21
|
-
export { a as McpClientManagerOptions, b as McpServerOptions, c as buildMcpToolName, g as getMcpPrefix, n as normalizeNameForMCP, p as parseMcpToolName } from './server-BzNGKTP6.js';
|
|
22
|
-
export { C as CacheControlConfig, a as CacheScope, g as getMessageCacheBreakpointIndex, s as sortToolDefinitionsForCache } from './cache-BlBwXXPS.js';
|
|
10
|
+
import { a as VirtualComputer, V as VirtualFs } from './computer-DzMR92tK.js';
|
|
11
|
+
export { C as CommandResult, E as ExecOptions, F as FileEntry, b as FileStat, R as ReadOptions } from './computer-DzMR92tK.js';
|
|
12
|
+
export { a as McpClientManagerOptions, b as McpServerOptions, c as buildMcpToolName, g as getMcpPrefix, n as normalizeNameForMCP, p as parseMcpToolName } from './server-DFXdlqyX.js';
|
|
23
13
|
export { JsonRpcErrorObject, JsonRpcMessage, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse } from './jsonrpc/index.js';
|
|
24
14
|
export { b as AcpCapabilities, c as AcpInitializeParams, d as AcpInitializeResult, A as AcpTransport } from './types-QwfylltH.js';
|
|
25
15
|
export { e as A2AArtifact, M as A2AMessage, P as A2APart, b as A2ATask, g as A2ATaskStatus, a as AgentCard, A as AgentSkill } from './types-NIyVwQ4h.js';
|
|
@@ -28,14 +18,28 @@ export { OAuthClientProvider, OAuthDiscoveryState } from '@modelcontextprotocol/
|
|
|
28
18
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
29
19
|
|
|
30
20
|
interface PresetOptions {
|
|
31
|
-
/** The AI provider instance (e.g. `new
|
|
21
|
+
/** The AI provider instance (e.g. `new AiSdkProvider({ model })`) */
|
|
32
22
|
provider: AIProvider;
|
|
33
|
-
/** Working directory for
|
|
23
|
+
/** Working directory for path resolution. Defaults to `process.cwd()`. */
|
|
34
24
|
cwd?: string;
|
|
35
25
|
/** Model name override. Each preset has a sensible default. */
|
|
36
26
|
model?: string;
|
|
37
|
-
/**
|
|
38
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Sandbox providing filesystem + shell execution. Required — the root
|
|
29
|
+
* barrel deliberately doesn't pull in a default implementation, so
|
|
30
|
+
* callers must pick a backend explicitly:
|
|
31
|
+
*
|
|
32
|
+
* - `import { UnsandboxedLocal } from "noumen/unsandboxed"` — raw host access.
|
|
33
|
+
* - `import { LocalSandbox } from "noumen/local"` — OS-level sandboxing.
|
|
34
|
+
* - `import { DockerSandbox } from "noumen/docker"`
|
|
35
|
+
* - `import { E2BSandbox } from "noumen/e2b"`
|
|
36
|
+
* - `import { FreestyleSandbox } from "noumen/freestyle"`
|
|
37
|
+
* - `import { SshSandbox } from "noumen/ssh"`
|
|
38
|
+
* - `import { SpritesSandbox } from "noumen/sprites"`
|
|
39
|
+
*
|
|
40
|
+
* You can also pass any `{ fs, computer }` pair for custom sandboxes.
|
|
41
|
+
*/
|
|
42
|
+
sandbox: Sandbox;
|
|
39
43
|
/** Extra hooks to attach. */
|
|
40
44
|
hooks?: HookDefinition[];
|
|
41
45
|
/** MCP servers to connect to during `init()`. */
|
|
@@ -66,56 +70,326 @@ declare function planningAgent(opts: PresetOptions): Agent;
|
|
|
66
70
|
*/
|
|
67
71
|
declare function reviewAgent(opts: PresetOptions): Agent;
|
|
68
72
|
|
|
69
|
-
interface LocalFsOptions {
|
|
70
|
-
basePath?: string;
|
|
71
|
-
}
|
|
72
73
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
74
|
+
* Classification of an AI SDK `LanguageModelV3` by its vendor / wire format.
|
|
75
|
+
*
|
|
76
|
+
* We derive the family from the model's `provider` string. Providers
|
|
77
|
+
* downstream plug additional provider-specific knobs onto
|
|
78
|
+
* `providerOptions` in different shapes; the request translator uses the
|
|
79
|
+
* family to decide whether `thinking` becomes Anthropic's
|
|
80
|
+
* `thinking: { type: "enabled" }`, OpenAI's `reasoningEffort`, or
|
|
81
|
+
* Gemini-native `thinkingConfig`.
|
|
82
|
+
*/
|
|
83
|
+
type ProviderFamily =
|
|
84
|
+
/** Anthropic messages API — native or via Bedrock / Vertex / OpenRouter passthrough. */
|
|
85
|
+
"anthropic"
|
|
86
|
+
/** OpenAI chat/completions or Responses; also `google` when routed through a chat/completions proxy. */
|
|
87
|
+
| "openai"
|
|
88
|
+
/** Google Generative AI native (`@ai-sdk/google`). */
|
|
89
|
+
| "google"
|
|
90
|
+
/** Unknown vendor — provider-specific options are dropped. */
|
|
91
|
+
| "unknown";
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* `ChatParams` -> `LanguageModelV3CallOptions` translation.
|
|
95
|
+
*
|
|
96
|
+
* Handles:
|
|
97
|
+
* - OpenAI-shaped `ChatMessage`s -> AI SDK `LanguageModelV3Prompt`
|
|
98
|
+
* - Anthropic thinking signature / redacted thinking round-tripping via
|
|
99
|
+
* `providerOptions.anthropic` on reasoning parts
|
|
100
|
+
* - Anthropic cache breakpoints on tools + messages (honors `skipCacheWrite`)
|
|
101
|
+
* - `thinking` / `reasoningEffort` mapped to the right
|
|
102
|
+
* `providerOptions.{anthropic,openai,google}` shape per provider family
|
|
103
|
+
* - Tool definitions with `fixTypelessProperties` to satisfy OpenAI's
|
|
104
|
+
* strict JSON Schema validator
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Minimal subset of `LanguageModelV3CallOptions` that we produce. We avoid
|
|
109
|
+
* importing `@ai-sdk/provider` types at the module level so mock language
|
|
110
|
+
* models in tests don't need to ship the full generic type surface; the
|
|
111
|
+
* returned object is structurally compatible.
|
|
112
|
+
*/
|
|
113
|
+
interface TranslatedCallOptions {
|
|
114
|
+
prompt: AiSdkMessage[];
|
|
115
|
+
maxOutputTokens?: number;
|
|
116
|
+
temperature?: number;
|
|
117
|
+
abortSignal?: AbortSignal;
|
|
118
|
+
tools?: AiSdkTool[];
|
|
119
|
+
toolChoice?: {
|
|
120
|
+
type: "auto";
|
|
121
|
+
};
|
|
122
|
+
responseFormat?: {
|
|
123
|
+
type: "text";
|
|
124
|
+
} | {
|
|
125
|
+
type: "json";
|
|
126
|
+
schema?: Record<string, unknown>;
|
|
127
|
+
name?: string;
|
|
128
|
+
};
|
|
129
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
130
|
+
}
|
|
131
|
+
type AiSdkMessage = {
|
|
132
|
+
role: "system";
|
|
133
|
+
content: string;
|
|
134
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
135
|
+
} | {
|
|
136
|
+
role: "user";
|
|
137
|
+
content: Array<AiSdkTextPart | AiSdkFilePart>;
|
|
138
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
139
|
+
} | {
|
|
140
|
+
role: "assistant";
|
|
141
|
+
content: Array<AiSdkTextPart | AiSdkReasoningPart | AiSdkToolCallPart>;
|
|
142
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
143
|
+
} | {
|
|
144
|
+
role: "tool";
|
|
145
|
+
content: AiSdkToolResultPart[];
|
|
146
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
147
|
+
};
|
|
148
|
+
interface AiSdkTextPart {
|
|
149
|
+
type: "text";
|
|
150
|
+
text: string;
|
|
151
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
152
|
+
}
|
|
153
|
+
interface AiSdkFilePart {
|
|
154
|
+
type: "file";
|
|
155
|
+
data: string | Uint8Array | URL;
|
|
156
|
+
mediaType: string;
|
|
157
|
+
filename?: string;
|
|
158
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
159
|
+
}
|
|
160
|
+
interface AiSdkReasoningPart {
|
|
161
|
+
type: "reasoning";
|
|
162
|
+
text: string;
|
|
163
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
164
|
+
}
|
|
165
|
+
interface AiSdkToolCallPart {
|
|
166
|
+
type: "tool-call";
|
|
167
|
+
toolCallId: string;
|
|
168
|
+
toolName: string;
|
|
169
|
+
input: unknown;
|
|
170
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
171
|
+
}
|
|
172
|
+
interface AiSdkToolResultPart {
|
|
173
|
+
type: "tool-result";
|
|
174
|
+
toolCallId: string;
|
|
175
|
+
toolName: string;
|
|
176
|
+
output: {
|
|
177
|
+
type: "text";
|
|
178
|
+
value: string;
|
|
179
|
+
} | {
|
|
180
|
+
type: "json";
|
|
181
|
+
value: unknown;
|
|
182
|
+
} | {
|
|
183
|
+
type: "error-text";
|
|
184
|
+
value: string;
|
|
185
|
+
} | {
|
|
186
|
+
type: "content";
|
|
187
|
+
value: Array<{
|
|
188
|
+
type: "text";
|
|
189
|
+
text: string;
|
|
190
|
+
} | {
|
|
191
|
+
type: "image-data";
|
|
192
|
+
data: string;
|
|
193
|
+
mediaType: string;
|
|
194
|
+
} | {
|
|
195
|
+
type: "image-url";
|
|
196
|
+
url: string;
|
|
197
|
+
}>;
|
|
198
|
+
};
|
|
199
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
200
|
+
}
|
|
201
|
+
interface AiSdkTool {
|
|
202
|
+
type: "function";
|
|
203
|
+
name: string;
|
|
204
|
+
description?: string;
|
|
205
|
+
inputSchema: Record<string, unknown>;
|
|
206
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
101
207
|
}
|
|
102
208
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
209
|
+
/**
|
|
210
|
+
* AI SDK v3 stream -> noumen `ChatStreamChunk` translation.
|
|
211
|
+
*
|
|
212
|
+
* Consumes a `ReadableStream<LanguageModelV3StreamPart>` produced by any
|
|
213
|
+
* Vercel AI SDK provider and yields OpenAI-shaped chunks compatible with
|
|
214
|
+
* the existing noumen pipeline:
|
|
215
|
+
*
|
|
216
|
+
* text-delta -> choices[0].delta.content
|
|
217
|
+
* reasoning-delta -> choices[0].delta.thinking_content
|
|
218
|
+
* reasoning-end -> choices[0].delta.{thinking_signature,redacted_thinking_data}
|
|
219
|
+
* (reads Anthropic providerMetadata)
|
|
220
|
+
* tool-input-* -> choices[0].delta.tool_calls[].function.arguments (streamed)
|
|
221
|
+
* tool-call -> finalizes the tool-call (applies sanitize + repair)
|
|
222
|
+
* finish -> terminal chunk with finish_reason + usage
|
|
223
|
+
* error -> throws ChatStreamError via mapApiCallError
|
|
224
|
+
*/
|
|
225
|
+
|
|
226
|
+
type Json = unknown;
|
|
227
|
+
interface StreamPartBase {
|
|
228
|
+
type: string;
|
|
229
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
230
|
+
id?: string;
|
|
106
231
|
}
|
|
232
|
+
type AiSdkStreamPart = {
|
|
233
|
+
type: "stream-start";
|
|
234
|
+
warnings?: unknown;
|
|
235
|
+
} | {
|
|
236
|
+
type: "response-metadata";
|
|
237
|
+
id?: string;
|
|
238
|
+
modelId?: string;
|
|
239
|
+
timestamp?: Date;
|
|
240
|
+
} | {
|
|
241
|
+
type: "text-start";
|
|
242
|
+
id: string;
|
|
243
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
244
|
+
} | {
|
|
245
|
+
type: "text-delta";
|
|
246
|
+
id: string;
|
|
247
|
+
delta: string;
|
|
248
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
249
|
+
} | {
|
|
250
|
+
type: "text-end";
|
|
251
|
+
id: string;
|
|
252
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
253
|
+
} | {
|
|
254
|
+
type: "reasoning-start";
|
|
255
|
+
id: string;
|
|
256
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
257
|
+
} | {
|
|
258
|
+
type: "reasoning-delta";
|
|
259
|
+
id: string;
|
|
260
|
+
delta: string;
|
|
261
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
262
|
+
} | {
|
|
263
|
+
type: "reasoning-end";
|
|
264
|
+
id: string;
|
|
265
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
266
|
+
} | {
|
|
267
|
+
type: "tool-input-start";
|
|
268
|
+
id: string;
|
|
269
|
+
toolName: string;
|
|
270
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
271
|
+
providerExecuted?: boolean;
|
|
272
|
+
dynamic?: boolean;
|
|
273
|
+
} | {
|
|
274
|
+
type: "tool-input-delta";
|
|
275
|
+
id: string;
|
|
276
|
+
delta: string;
|
|
277
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
278
|
+
} | {
|
|
279
|
+
type: "tool-input-end";
|
|
280
|
+
id: string;
|
|
281
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
282
|
+
} | {
|
|
283
|
+
type: "tool-call";
|
|
284
|
+
toolCallId: string;
|
|
285
|
+
toolName: string;
|
|
286
|
+
input: string;
|
|
287
|
+
providerExecuted?: boolean;
|
|
288
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
289
|
+
} | {
|
|
290
|
+
type: "tool-result";
|
|
291
|
+
toolCallId: string;
|
|
292
|
+
toolName: string;
|
|
293
|
+
result: Json;
|
|
294
|
+
isError?: boolean;
|
|
295
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
296
|
+
} | {
|
|
297
|
+
type: "finish";
|
|
298
|
+
finishReason: string | {
|
|
299
|
+
unified: string;
|
|
300
|
+
raw?: string;
|
|
301
|
+
};
|
|
302
|
+
usage: AiSdkUsage;
|
|
303
|
+
providerMetadata?: Record<string, Record<string, Json>>;
|
|
304
|
+
} | {
|
|
305
|
+
type: "error";
|
|
306
|
+
error: unknown;
|
|
307
|
+
} | (StreamPartBase & {
|
|
308
|
+
[k: string]: unknown;
|
|
309
|
+
});
|
|
310
|
+
/** Unified usage shape covering both V2 (flat) and V3 (nested). */
|
|
311
|
+
type AiSdkUsage = {
|
|
312
|
+
inputTokens?: number;
|
|
313
|
+
outputTokens?: number;
|
|
314
|
+
totalTokens?: number;
|
|
315
|
+
reasoningTokens?: number;
|
|
316
|
+
cachedInputTokens?: number;
|
|
317
|
+
} | {
|
|
318
|
+
inputTokens: {
|
|
319
|
+
total?: number;
|
|
320
|
+
noCache?: number;
|
|
321
|
+
cacheRead?: number;
|
|
322
|
+
cacheWrite?: number;
|
|
323
|
+
};
|
|
324
|
+
outputTokens: {
|
|
325
|
+
total?: number;
|
|
326
|
+
text?: number;
|
|
327
|
+
reasoning?: number;
|
|
328
|
+
};
|
|
329
|
+
raw?: Record<string, Json>;
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* `AiSdkProvider` — single noumen `AIProvider` implementation that wraps
|
|
334
|
+
* any Vercel AI SDK `LanguageModelV3` (`@ai-sdk/openai`, `@ai-sdk/anthropic`,
|
|
335
|
+
* `@ai-sdk/google`, `@openrouter/ai-sdk-provider`, `@ai-sdk/amazon-bedrock`,
|
|
336
|
+
* `@ai-sdk/google-vertex`, `ollama-ai-provider-v2`, ...).
|
|
337
|
+
*
|
|
338
|
+
* Callers construct the vendor SDK model (often via pocketuniverse's metered
|
|
339
|
+
* `createProvider(...)` factory so traffic flows through `/api/ai/*` with
|
|
340
|
+
* JWT auth + credit metering) and hand it to `new AiSdkProvider({ model })`.
|
|
341
|
+
* The noumen pipeline then keeps talking to one uniform `chat()` surface.
|
|
342
|
+
*
|
|
343
|
+
* See `/Users/a/mastra/packages/core/src/llm/model/aisdk/v5/model.ts` for
|
|
344
|
+
* the reference wrapper; we intentionally strip out mastra-specific event
|
|
345
|
+
* plumbing and keep the surface area to just `AIProvider.chat`.
|
|
346
|
+
*/
|
|
347
|
+
|
|
107
348
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
349
|
+
* Minimal subset of `LanguageModelV3` we require. Using a structural type
|
|
350
|
+
* means tests can pass lightweight mocks and we don't have a hard import
|
|
351
|
+
* dependency on `@ai-sdk/provider` types (peer-only).
|
|
352
|
+
*/
|
|
353
|
+
interface AiSdkLanguageModel {
|
|
354
|
+
readonly specificationVersion: "v2" | "v3";
|
|
355
|
+
readonly provider: string;
|
|
356
|
+
readonly modelId: string;
|
|
357
|
+
doStream(options: TranslatedCallOptions): Promise<{
|
|
358
|
+
stream: ReadableStream<AiSdkStreamPart>;
|
|
359
|
+
}>;
|
|
360
|
+
}
|
|
361
|
+
interface AiSdkProviderOptions {
|
|
362
|
+
/** The AI SDK language model instance (any v2 or v3 provider). */
|
|
363
|
+
model: AiSdkLanguageModel;
|
|
364
|
+
/**
|
|
365
|
+
* Fallback model id reported by `AIProvider.defaultModel`. When omitted
|
|
366
|
+
* we use `model.modelId`. `ChatParams.model`, when provided, always
|
|
367
|
+
* wins at call time because the AI SDK model is already bound to its
|
|
368
|
+
* id — this field is purely informational for consumers that ask for
|
|
369
|
+
* a default without wiring in a resolver.
|
|
370
|
+
*/
|
|
371
|
+
defaultModel?: string;
|
|
372
|
+
/**
|
|
373
|
+
* Override the provider family classifier. Use this if you know the
|
|
374
|
+
* model's vendor more precisely than the string-based heuristic (e.g.
|
|
375
|
+
* a custom base URL forwards Anthropic traffic but reports
|
|
376
|
+
* `provider: "openai.chat"`).
|
|
377
|
+
*/
|
|
378
|
+
providerFamily?: ProviderFamily;
|
|
379
|
+
/**
|
|
380
|
+
* Anthropic prompt-cache configuration. No-op when `providerFamily` is
|
|
381
|
+
* not Anthropic. When enabled, noumen inserts a single cache breakpoint
|
|
382
|
+
* on the appropriate message position (respects `ChatParams.skipCacheWrite`).
|
|
383
|
+
*/
|
|
384
|
+
cacheConfig?: CacheControlConfig;
|
|
385
|
+
}
|
|
386
|
+
declare class AiSdkProvider implements AIProvider {
|
|
387
|
+
readonly defaultModel: string;
|
|
388
|
+
readonly providerFamily: ProviderFamily;
|
|
389
|
+
private readonly model;
|
|
390
|
+
private readonly cacheConfig?;
|
|
391
|
+
constructor(opts: AiSdkProviderOptions);
|
|
392
|
+
chat(params: ChatParams): AsyncIterable<ChatStreamChunk>;
|
|
119
393
|
}
|
|
120
394
|
|
|
121
395
|
/**
|
|
@@ -793,9 +1067,14 @@ declare function buildSystemPrompt(opts: {
|
|
|
793
1067
|
}): string;
|
|
794
1068
|
|
|
795
1069
|
/**
|
|
796
|
-
* Load project context files from the hierarchical
|
|
797
|
-
*
|
|
1070
|
+
* Load project context files from the hierarchical `<NAME>.md` convention.
|
|
1071
|
+
* Returns files ordered lowest-to-highest priority:
|
|
798
1072
|
* managed -> user -> project (root first, cwd last) -> local.
|
|
1073
|
+
*
|
|
1074
|
+
* Within each layer, dot-dirs are iterated in config order — so with the
|
|
1075
|
+
* default `['.noumen', '.claude']`, `.noumen` content is loaded first
|
|
1076
|
+
* (lower precedence within the layer) and `.claude` last (higher
|
|
1077
|
+
* precedence within the layer). That matches the historical behavior.
|
|
799
1078
|
*/
|
|
800
1079
|
declare function loadProjectContext(fs: VirtualFs, config: ProjectContextConfig): Promise<ContextFile[]>;
|
|
801
1080
|
/**
|
|
@@ -1400,4 +1679,4 @@ declare const IMAGE_EXTENSIONS: Set<string>;
|
|
|
1400
1679
|
*/
|
|
1401
1680
|
declare function createImageMetadataText(dims: ImageDimensions): string;
|
|
1402
1681
|
|
|
1403
|
-
export { AIProvider, API_IMAGE_MAX_BASE64_SIZE, Agent, AssistantMessage, AutoModeConfig, AutoTitleConfig, type CacheSafeParams, CannotRetryError, ChatCompletionUsage, ChatMessage, ChatStreamChunk, type ClassifiedError, type ClassifierResult, type CommandClassification,
|
|
1682
|
+
export { AIProvider, API_IMAGE_MAX_BASE64_SIZE, Agent, type AiSdkLanguageModel, AiSdkProvider, type AiSdkProviderOptions, AssistantMessage, AutoModeConfig, AutoTitleConfig, CacheControlConfig, type CacheSafeParams, CannotRetryError, ChatCompletionUsage, ChatMessage, ChatParams, ChatStreamChunk, type ClassifiedError, type ClassifierResult, type CommandClassification, type CompactOptions, type CompressedImageResult, ContentPart, ContentReplacementRecord, ContextFile, ContextScope, DEFAULT_PRICING, type DenialLimits, type DenialState, DenialTracker, type ExtractMemoriesResult, FileCheckpointSnapshot, FileMemoryProvider, type FrontmatterData, type GitOperationEvent, type GitOperationType, HookDefinition, HookEvent, HookInput, IMAGE_EXTENSIONS, IMAGE_MAX_HEIGHT, IMAGE_MAX_WIDTH, type ImageDimensions, InProcessBackend, type IndexTruncation, InvariantViolation, JsonSchemaOutputFormat, Mailbox, McpServerConfig, MemoryEntry, MemoryProvider, ModelPricing, NoopSpan, NoopTracer, OTelTracer, type ParsedFrontmatter, PermissionBehavior, PermissionContext, PermissionDecision, PermissionHandler, PermissionRule, PermissionUpdate, PostToolUseFailureHookInput, PostToolUseFailureHookOutput, PostToolUseHookInput, PostToolUseHookOutput, PreToolUseHookInput, PreToolUseHookOutput, type PresetOptions, ProjectContextConfig, type ResizedImage, type ResolvePermissionOptions, type ResumePayload, RetryConfig, RetryContext, RetryEngineOptions, STRUCTURED_OUTPUT_TOOL_NAME, Sandbox, type SanitizeResult, SessionStorage, type ShellSafetyConfig, SkillDefinition, Span, SpanAttributeValue, SpanOptions, SpanStatusCode, StoredCostState, StreamEvent, type StreamingExecResult, StreamingToolExecutor, type StreamingToolExecutorFn, type SwarmBackend, type SwarmConfig, type SwarmEvents, SwarmManager, type SwarmMember, type SwarmMemberConfig, type SwarmMemberStatus, type SwarmMessage, type SwarmStatus, TOOL_SEARCH_NAME, ThinkingConfig, ThreadConfig, Tool, ToolCallContent, type ToolCallExecResult, type ToolCallExecutor, ToolResult as ToolCallResult, ToolContext, ToolDefinition, ToolRegistry, ToolResultMessage, ToolResultOverflowEntry, type ToolWithDeferral, Tracer, type TurnInterruption, UsageRecord, type UserInputHandler, VirtualComputer, VirtualFs, type WorktreeInfo, activateContextForPaths, activateSkillsForPaths, agentTool, all, applyPermissionUpdate, applyPermissionUpdates, askUserTool, assertValidMessageSequence, bashTool, buildExtractionPrompt, buildMemorySystemPromptSection, buildProjectContextSection, buildSystemPrompt, calculateCost, classifyCommand, classifyError, classifyPermission, codingAgent, commandWritesGitInternals, compactConversation, compressImageBufferWithTokenLimit, contentMatchesRule, contentToString, countOccurrences, createCacheSafeParams, createImageMetadataText, createSkillTool, createStructuredOutputTool, createToolSearchTool, createWorktree, detectGitOperations, detectTurnInterruption, editFileTool, enterPlanModeTool, enterWorktreeTool, estimateCompactionSavings, estimateMessagesTokens, estimateTokens, exitPlanModeTool, exitWorktreeTool, extractCommandName, extractMemories, filterActiveContextFiles, filterOrphanedThinkingMessages, filterUnresolvedToolUses, filterWhitespaceOnlyAssistantMessages, findActualString, findGitRoot, findModelPricing, formatDeferredToolLine, generateMissingToolResults, getActiveSkills, getAutoCompactThreshold, getContextWindowForModel, getEffectiveContextWindow, getLastCacheSafeParams, getMatchingRules, getRetryDelay, getWorktreeChanges, globTool, grepTool, groupMessagesByTurn, hasGitIndexLockError, hasImageContent, isDeferredTool, isGitInternalPath, isPathInWorkingDirectories, isRetryable, listWorktrees, loadProjectContext, loadSkills, looksLikeBareRepo, matchSimpleGlob, maybeResizeAndDownsampleImageBlock, maybeResizeAndDownsampleImageBuffer, normalizeContent, normalizeMessagesForAPI, normalizeQuotes, notebookEditTool, parseAllowedTools, parseFrontmatter, parsePaths, partitionToolCalls, planningAgent, preserveQuoteStyle, readFileTool, registerContextWindows, removeWorktree, resolvePermission, resolveToolFlag, restoreSession, reviewAgent, runNotificationHooks, runPostToolUseFailureHooks, runPostToolUseHooks, runPreToolUseHooks, runToolsBatched, sanitizeForResume, sanitizeWorktreeSlug, saveCacheSafeParams, searchToolsWithKeywords, stripImageContent, stripTrailingWhitespace, taskCreateTool, taskGetTool, taskListTool, taskUpdateTool, tokenCountWithEstimation, toolMatchesRule, truncateHeadForPTLRetry, truncateIndex, webFetchTool, withRetry, writeFileTool };
|