@cuylabs/agent-core 0.7.0 → 0.9.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/dist/{builder-BRvqCcIk.d.ts → builder-BgZ_j4Vs.d.ts} +3 -2
- package/dist/chunk-4QFNWPIF.js +202 -0
- package/dist/chunk-5ARZJWD2.js +259 -0
- package/dist/chunk-DXFBQMXP.js +53 -0
- package/dist/chunk-EKR6PKXU.js +180 -0
- package/dist/{chunk-IVUJDISU.js → chunk-GFTW23FV.js} +5 -14
- package/dist/{chunk-IEFIQENH.js → chunk-H3FUYU52.js} +15 -7
- package/dist/chunk-I6PKJ7XQ.js +292 -0
- package/dist/chunk-IYWQOJMQ.js +102 -0
- package/dist/{chunk-3HNO5SVI.js → chunk-J4QDGZIA.js} +20 -4
- package/dist/{chunk-7MUFEN4K.js → chunk-JLXG2SH7.js} +349 -3
- package/dist/{chunk-CDTV2UYU.js → chunk-MAZ5DY5B.js} +64 -276
- package/dist/{chunk-P6YF7USR.js → chunk-MHKK374K.js} +12 -11
- package/dist/{chunk-VBWWUHWI.js → chunk-OFDKHNCX.js} +4 -1
- package/dist/{chunk-YUUJK53A.js → chunk-RKEW5WXI.js} +1 -1
- package/dist/{chunk-LRHOS4ZN.js → chunk-SPILYYDF.js} +3 -2
- package/dist/{chunk-QGOGIP7T.js → chunk-UDCZ673N.js} +385 -233
- package/dist/{chunk-BDBZ3SLK.js → chunk-UHCJEM2E.js} +39 -2
- package/dist/chunk-WGZAPU6N.js +929 -0
- package/dist/{chunk-5K7AQVOU.js → chunk-WKHDSSXG.js} +130 -209
- package/dist/{chunk-BNSHUWCV.js → chunk-WWYYNWEW.js} +1 -1
- package/dist/context/index.js +1 -1
- package/dist/events-CE72w8W4.d.ts +149 -0
- package/dist/index-BCqEGzBj.d.ts +251 -0
- package/dist/{index-C33hlD6H.d.ts → index-DQuTZ8xL.d.ts} +319 -56
- package/dist/index.d.ts +42 -121
- package/dist/index.js +951 -848
- package/dist/inference/errors/index.d.ts +11 -0
- package/dist/inference/errors/index.js +16 -0
- package/dist/inference/index.d.ts +12 -8
- package/dist/inference/index.js +35 -7
- package/dist/llm-error-D93FNNLY.d.ts +32 -0
- package/dist/middleware/index.d.ts +246 -7
- package/dist/middleware/index.js +3 -1
- package/dist/models/index.d.ts +132 -9
- package/dist/models/index.js +48 -8
- package/dist/models/reasoning/index.d.ts +4 -0
- package/dist/{reasoning → models/reasoning}/index.js +2 -7
- package/dist/plugin/index.d.ts +414 -0
- package/dist/plugin/index.js +32 -0
- package/dist/presets/index.d.ts +53 -0
- package/dist/presets/index.js +30 -0
- package/dist/prompt/index.d.ts +11 -8
- package/dist/prompt/index.js +3 -2
- package/dist/{registry-BDLIHOQB.d.ts → registry-DwYqsQkX.d.ts} +1 -1
- package/dist/runner-CI-XeR16.d.ts +91 -0
- package/dist/runtime/index.d.ts +12 -8
- package/dist/runtime/index.js +8 -7
- package/dist/safety/index.d.ts +38 -0
- package/dist/safety/index.js +12 -0
- package/dist/scope/index.d.ts +2 -2
- package/dist/{session-manager-B_CWGTsl.d.ts → session-manager-KbYt2WUh.d.ts} +8 -0
- package/dist/signal/index.d.ts +28 -0
- package/dist/signal/index.js +6 -0
- package/dist/skill/index.d.ts +7 -6
- package/dist/skill/index.js +3 -3
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.js +1 -1
- package/dist/sub-agent/index.d.ts +16 -10
- package/dist/sub-agent/index.js +21 -4
- package/dist/tool/index.d.ts +22 -6
- package/dist/tool/index.js +3 -3
- package/dist/tool-CZWN3KbO.d.ts +141 -0
- package/dist/{tool-HUtkiVBx.d.ts → tool-DkhSCV2Y.d.ts} +2 -2
- package/dist/tracking/index.d.ts +2 -2
- package/dist/tracking/index.js +1 -1
- package/dist/{tool-Db1Ue-1U.d.ts → types-BfNpU8NS.d.ts} +1 -150
- package/dist/{types-FRpzzg_9.d.ts → types-BlOKk-Bb.d.ts} +10 -35
- package/dist/types-BlZwmnuW.d.ts +50 -0
- package/dist/{types-9jGQUjqW.d.ts → types-CQL-SvTn.d.ts} +1 -1
- package/dist/types-CWm-7rvB.d.ts +55 -0
- package/dist/{runner-DSKaEz3z.d.ts → types-DTSkxakL.d.ts} +7 -235
- package/dist/{types-CqDZTh4d.d.ts → types-DmDwi2zI.d.ts} +8 -4
- package/dist/types-YuWV4ag7.d.ts +72 -0
- package/package.json +67 -6
- package/dist/capability-resolver-CgRGsWVX.d.ts +0 -254
- package/dist/chunk-ZPMACVZK.js +0 -305
- package/dist/index-CfBGYrpd.d.ts +0 -317
- package/dist/reasoning/index.d.ts +0 -117
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { R as ReasoningLevel, a as ReasoningConfig } from './types-CQaXbRsS.js';
|
|
2
|
+
import { LanguageModel } from 'ai';
|
|
3
|
+
import { ProviderOptions } from '@ai-sdk/provider-utils';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Model Capability Types for @cuylabs/agent-core
|
|
7
|
+
*
|
|
8
|
+
* Defines the structure for model capabilities that can be sourced from
|
|
9
|
+
* static patterns, local cache, or remote APIs.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Input modalities a model can accept
|
|
13
|
+
*/
|
|
14
|
+
type InputModality = "text" | "image" | "audio" | "video" | "pdf";
|
|
15
|
+
/**
|
|
16
|
+
* Output modalities a model can produce
|
|
17
|
+
*/
|
|
18
|
+
type OutputModality = "text" | "image" | "audio" | "video";
|
|
19
|
+
/**
|
|
20
|
+
* Comprehensive model capabilities
|
|
21
|
+
*/
|
|
22
|
+
interface ModelCapabilities {
|
|
23
|
+
/** Model supports extended reasoning/thinking */
|
|
24
|
+
reasoning: boolean;
|
|
25
|
+
/** Model supports function/tool calling */
|
|
26
|
+
toolCalling: boolean;
|
|
27
|
+
/** Model supports temperature adjustment */
|
|
28
|
+
temperature: boolean;
|
|
29
|
+
/** Model supports file attachments */
|
|
30
|
+
attachments: boolean;
|
|
31
|
+
/** Model supports streaming responses */
|
|
32
|
+
streaming: boolean;
|
|
33
|
+
/** Supported input modalities */
|
|
34
|
+
inputModalities: InputModality[];
|
|
35
|
+
/** Supported output modalities */
|
|
36
|
+
outputModalities: OutputModality[];
|
|
37
|
+
/** Maximum context window in tokens */
|
|
38
|
+
contextWindow?: number;
|
|
39
|
+
/** Maximum output tokens */
|
|
40
|
+
maxOutput?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Provider-specific compatibility flags
|
|
44
|
+
* These handle quirks in different provider implementations
|
|
45
|
+
*/
|
|
46
|
+
interface ProviderCompatibility {
|
|
47
|
+
/** Supports OpenAI-style reasoning_effort parameter */
|
|
48
|
+
supportsReasoningEffort?: boolean;
|
|
49
|
+
/** Supports developer/system role distinction */
|
|
50
|
+
supportsDeveloperRole?: boolean;
|
|
51
|
+
/** Field name for max tokens (varies by provider) */
|
|
52
|
+
maxTokensField?: "max_tokens" | "max_completion_tokens";
|
|
53
|
+
/** Requires thinking as text tags vs structured */
|
|
54
|
+
requiresThinkingTags?: boolean;
|
|
55
|
+
/** Provider-specific thinking format */
|
|
56
|
+
thinkingFormat?: "openai" | "anthropic" | "google" | "zai";
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Complete model entry with metadata
|
|
60
|
+
*/
|
|
61
|
+
interface ModelEntry {
|
|
62
|
+
/** Model identifier (e.g., "gpt-4o", "claude-sonnet-4") */
|
|
63
|
+
id: string;
|
|
64
|
+
/** Human-readable model name */
|
|
65
|
+
name: string;
|
|
66
|
+
/** Provider identifier (e.g., "openai", "anthropic") */
|
|
67
|
+
provider: string;
|
|
68
|
+
/** Model capabilities */
|
|
69
|
+
capabilities: ModelCapabilities;
|
|
70
|
+
/** Provider-specific compatibility settings */
|
|
71
|
+
compatibility?: ProviderCompatibility;
|
|
72
|
+
/** Cost per million tokens (input) */
|
|
73
|
+
costInput?: number;
|
|
74
|
+
/** Cost per million tokens (output) */
|
|
75
|
+
costOutput?: number;
|
|
76
|
+
/** When this entry was last updated */
|
|
77
|
+
updatedAt?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Priority levels for capability sources
|
|
81
|
+
*/
|
|
82
|
+
declare enum SourcePriority {
|
|
83
|
+
/** User configuration overrides everything */
|
|
84
|
+
UserConfig = 0,
|
|
85
|
+
/** Local cache from previous fetch */
|
|
86
|
+
LocalCache = 1,
|
|
87
|
+
/** Bundled static data (build-time) */
|
|
88
|
+
BundledData = 2,
|
|
89
|
+
/** Pattern-based inference (fallback) */
|
|
90
|
+
PatternMatch = 3,
|
|
91
|
+
/** Remote API (if network available) */
|
|
92
|
+
RemoteAPI = 4
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Result from a capability source lookup
|
|
96
|
+
*/
|
|
97
|
+
interface SourceResult {
|
|
98
|
+
/** The model entry if found */
|
|
99
|
+
entry?: ModelEntry;
|
|
100
|
+
/** Which source provided this result */
|
|
101
|
+
source: SourcePriority;
|
|
102
|
+
/** Whether this is a confident match */
|
|
103
|
+
confident: boolean;
|
|
104
|
+
/** Error message if lookup failed */
|
|
105
|
+
error?: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Capability source interface
|
|
109
|
+
*/
|
|
110
|
+
interface CapabilitySource {
|
|
111
|
+
/** Source priority (lower = higher priority) */
|
|
112
|
+
priority: SourcePriority;
|
|
113
|
+
/** Human-readable source name */
|
|
114
|
+
name: string;
|
|
115
|
+
/** Look up capabilities for a model */
|
|
116
|
+
lookup(modelId: string, provider?: string): Promise<SourceResult>;
|
|
117
|
+
/** Check if this source is available */
|
|
118
|
+
isAvailable(): Promise<boolean>;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Options for the capability resolver
|
|
122
|
+
*/
|
|
123
|
+
interface ResolverOptions {
|
|
124
|
+
/** Enable remote API fetching (default: false) */
|
|
125
|
+
enableRemoteFetch?: boolean;
|
|
126
|
+
/** Remote API URL (default: https://models.dev) */
|
|
127
|
+
remoteApiUrl?: string;
|
|
128
|
+
/** Cache directory path */
|
|
129
|
+
cachePath?: string;
|
|
130
|
+
/** Cache TTL in milliseconds (default: 1 hour) */
|
|
131
|
+
cacheTtlMs?: number;
|
|
132
|
+
/** Network timeout in milliseconds (default: 10 seconds) */
|
|
133
|
+
networkTimeoutMs?: number;
|
|
134
|
+
/** Custom user overrides for specific models */
|
|
135
|
+
modelOverrides?: Record<string, Partial<ModelCapabilities>>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Default resolver options
|
|
139
|
+
*/
|
|
140
|
+
declare const DEFAULT_RESOLVER_OPTIONS: Required<ResolverOptions>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Provider-Specific Reasoning Option Builders
|
|
144
|
+
*
|
|
145
|
+
* Each function takes a {@link ReasoningLevel} and returns the
|
|
146
|
+
* provider-options object expected by the Vercel AI SDK's
|
|
147
|
+
* `providerOptions` parameter.
|
|
148
|
+
*
|
|
149
|
+
* Provider key mapping (`getProviderOptionsKey`) is also defined
|
|
150
|
+
* here so that callers can wrap the raw options correctly.
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Build OpenAI reasoning options.
|
|
155
|
+
*
|
|
156
|
+
* OpenAI reasoning models use:
|
|
157
|
+
* - `reasoningEffort` — controls depth
|
|
158
|
+
* - `reasoningSummary` — controls whether reasoning is streamed
|
|
159
|
+
* (`"auto"` = condensed summary, `"detailed"` = full)
|
|
160
|
+
*
|
|
161
|
+
* `reasoningSummary` requires a verified OpenAI organisation.
|
|
162
|
+
* Set `CODE_AGENT_DISABLE_REASONING_SUMMARY=true` to skip it.
|
|
163
|
+
*/
|
|
164
|
+
declare function buildOpenAIOptions(level: ReasoningLevel, compat?: ProviderCompatibility): Record<string, unknown> | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Build Anthropic thinking options.
|
|
167
|
+
*
|
|
168
|
+
* Uses `thinking.type: "enabled"` with `budgetTokens`.
|
|
169
|
+
*/
|
|
170
|
+
declare function buildAnthropicOptions(level: ReasoningLevel): Record<string, unknown> | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Build Google / Gemini reasoning options.
|
|
173
|
+
*
|
|
174
|
+
* - **Gemini 3+** uses `thinkingLevel` (`"low"` / `"high"`)
|
|
175
|
+
* - **Gemini 2.5 and earlier** uses `thinkingBudget` (token count)
|
|
176
|
+
*/
|
|
177
|
+
declare function buildGoogleOptions(level: ReasoningLevel, modelId?: string): Record<string, unknown> | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* Build xAI / Grok reasoning options.
|
|
180
|
+
*/
|
|
181
|
+
declare function buildXAIOptions(level: ReasoningLevel): Record<string, unknown> | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* Build Groq reasoning options.
|
|
184
|
+
*/
|
|
185
|
+
declare function buildGroqOptions(level: ReasoningLevel): Record<string, unknown> | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Build Amazon Bedrock reasoning options.
|
|
188
|
+
*
|
|
189
|
+
* - Anthropic / Claude models use `budgetTokens`
|
|
190
|
+
* - Amazon Nova models use `maxReasoningEffort`
|
|
191
|
+
*/
|
|
192
|
+
declare function buildBedrockOptions(level: ReasoningLevel, modelId?: string): Record<string, unknown> | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* Build OpenRouter reasoning options.
|
|
195
|
+
*/
|
|
196
|
+
declare function buildOpenRouterOptions(level: ReasoningLevel): Record<string, unknown> | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* Resolve the `providerOptions` key for a given SDK provider string.
|
|
199
|
+
*
|
|
200
|
+
* Falls back to the first dot-segment (e.g. `"foo.bar"` → `"foo"`).
|
|
201
|
+
*/
|
|
202
|
+
declare function getProviderOptionsKey(provider: string): string;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Reasoning Configuration & Option Builders
|
|
206
|
+
*
|
|
207
|
+
* Orchestrates capability detection and provider-specific option
|
|
208
|
+
* building to produce ready-to-use `providerOptions` for the
|
|
209
|
+
* Vercel AI SDK.
|
|
210
|
+
*
|
|
211
|
+
* Two flavours of every function are provided:
|
|
212
|
+
* - **Async** (`getReasoningConfig`, `buildReasoningOptions`) —
|
|
213
|
+
* uses the full capability resolver (network + cache).
|
|
214
|
+
* - **Sync** (`getReasoningConfigSync`, `buildReasoningOptionsSync`) —
|
|
215
|
+
* uses fast pattern-matching only (no network).
|
|
216
|
+
*/
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Get the reasoning configuration for a model.
|
|
220
|
+
*
|
|
221
|
+
* Uses the full capability resolver (including network lookups)
|
|
222
|
+
* for the most accurate result.
|
|
223
|
+
*/
|
|
224
|
+
declare function getReasoningConfig(model: LanguageModel): Promise<ReasoningConfig>;
|
|
225
|
+
/**
|
|
226
|
+
* Synchronous reasoning config using pattern-matching only.
|
|
227
|
+
*
|
|
228
|
+
* Faster but less accurate than {@link getReasoningConfig}.
|
|
229
|
+
* Good for hot paths where async is impractical.
|
|
230
|
+
*/
|
|
231
|
+
declare function getReasoningConfigSync(model: LanguageModel): ReasoningConfig;
|
|
232
|
+
/**
|
|
233
|
+
* Build `providerOptions` for a reasoning level (async).
|
|
234
|
+
*
|
|
235
|
+
* Returns `undefined` when reasoning is off or unsupported.
|
|
236
|
+
*/
|
|
237
|
+
declare function buildReasoningOptions(model: LanguageModel, level: ReasoningLevel): Promise<ProviderOptions | undefined>;
|
|
238
|
+
/**
|
|
239
|
+
* Build `providerOptions` for a reasoning level (sync / pattern-only).
|
|
240
|
+
*/
|
|
241
|
+
declare function buildReasoningOptionsSync(model: LanguageModel, level: ReasoningLevel): ProviderOptions | undefined;
|
|
242
|
+
/**
|
|
243
|
+
* Check whether a model supports reasoning (async, full resolver).
|
|
244
|
+
*/
|
|
245
|
+
declare function supportsReasoning(model: LanguageModel): Promise<boolean>;
|
|
246
|
+
/**
|
|
247
|
+
* Synchronous check using pattern-matching only.
|
|
248
|
+
*/
|
|
249
|
+
declare function supportsReasoningSync(model: LanguageModel): boolean;
|
|
250
|
+
|
|
251
|
+
export { type CapabilitySource as C, DEFAULT_RESOLVER_OPTIONS as D, type InputModality as I, type ModelCapabilities as M, type OutputModality as O, type ProviderCompatibility as P, type ResolverOptions as R, SourcePriority as S, type ModelEntry as a, type SourceResult as b, buildAnthropicOptions as c, buildBedrockOptions as d, buildGoogleOptions as e, buildGroqOptions as f, buildOpenAIOptions as g, buildOpenRouterOptions as h, buildReasoningOptions as i, buildReasoningOptionsSync as j, buildXAIOptions as k, getProviderOptionsKey as l, getReasoningConfig as m, getReasoningConfigSync as n, supportsReasoningSync as o, supportsReasoning as s };
|