@cuylabs/agent-core 0.8.0 → 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.
Files changed (127) hide show
  1. package/README.md +33 -17
  2. package/dist/chunk-2O4MCSQS.js +780 -0
  3. package/dist/chunk-2TTOLHBT.js +198 -0
  4. package/dist/chunk-5FMSGQVX.js +281 -0
  5. package/dist/chunk-5NVVNXPQ.js +288 -0
  6. package/dist/{chunk-CAA7FHIH.js → chunk-6HZBHFOL.js} +3 -103
  7. package/dist/chunk-CJI7PVS2.js +58 -0
  8. package/dist/{chunk-N6HWIEEA.js → chunk-CMYN2RCB.js} +278 -61
  9. package/dist/chunk-FII65CN7.js +117 -0
  10. package/dist/{chunk-IVUJDISU.js → chunk-GFTW23FV.js} +5 -14
  11. package/dist/chunk-I6PKJ7XQ.js +292 -0
  12. package/dist/{chunk-BDBZ3SLK.js → chunk-ICZ66572.js} +48 -4
  13. package/dist/chunk-KYLPMBHD.js +316 -0
  14. package/dist/chunk-MXAP4UG6.js +2956 -0
  15. package/dist/{chunk-RZITT45F.js → chunk-N3VX7FEE.js} +39 -6
  16. package/dist/{chunk-YSLSEQ6B.js → chunk-NDZWXCBZ.js} +218 -95
  17. package/dist/{chunk-P6YF7USR.js → chunk-Q742PSH3.js} +23 -38
  18. package/dist/chunk-QAL3OMI3.js +943 -0
  19. package/dist/{chunk-RFEKJKTO.js → chunk-RN6WZEUF.js} +330 -280
  20. package/dist/{chunk-ZXAKHMWH.js → chunk-ROTGCYDW.js} +22 -84
  21. package/dist/chunk-SPBFQXOT.js +0 -0
  22. package/dist/{chunk-LRHOS4ZN.js → chunk-SPILYYDF.js} +3 -2
  23. package/dist/chunk-SSFBF3US.js +602 -0
  24. package/dist/chunk-SZ2XBPTW.js +8 -0
  25. package/dist/chunk-T4UIX5D7.js +115 -0
  26. package/dist/chunk-TIHPYVAJ.js +102 -0
  27. package/dist/{chunk-YUUJK53A.js → chunk-TOTDGK3P.js} +1 -1
  28. package/dist/chunk-V4RFNEET.js +563 -0
  29. package/dist/chunk-VOUEJSW6.js +0 -0
  30. package/dist/{chunk-4BDA7DQY.js → chunk-WBPOZ7CL.js} +673 -273
  31. package/dist/chunk-X4VN4GIJ.js +185 -0
  32. package/dist/dispatch/index.d.ts +93 -0
  33. package/dist/dispatch/index.js +37 -0
  34. package/dist/events/index.d.ts +93 -0
  35. package/dist/events/index.js +6 -0
  36. package/dist/{runtime → execution}/index.d.ts +120 -34
  37. package/dist/{runtime → execution}/index.js +18 -13
  38. package/dist/index-BCqEGzBj.d.ts +251 -0
  39. package/dist/index.d.ts +490 -122
  40. package/dist/index.js +2104 -615
  41. package/dist/{errors → inference/errors}/index.d.ts +2 -2
  42. package/dist/{errors → inference/errors}/index.js +1 -1
  43. package/dist/inference/index.d.ts +16 -23
  44. package/dist/inference/index.js +45 -16
  45. package/dist/instance-BqV2D5pc.d.ts +5723 -0
  46. package/dist/logger/index.d.ts +50 -0
  47. package/dist/logger/index.js +11 -0
  48. package/dist/mcp/index.d.ts +5 -9
  49. package/dist/mcp/index.js +2 -3
  50. package/dist/middleware/index.d.ts +10 -149
  51. package/dist/middleware/index.js +11 -3
  52. package/dist/model-messages-B4nK9D1-.d.ts +13 -0
  53. package/dist/models/index.d.ts +23 -18
  54. package/dist/models/index.js +48 -11
  55. package/dist/models/reasoning/index.d.ts +4 -0
  56. package/dist/{reasoning → models/reasoning}/index.js +3 -3
  57. package/dist/plugin/index.d.ts +458 -0
  58. package/dist/plugin/index.js +32 -0
  59. package/dist/profiles/index.d.ts +55 -0
  60. package/dist/profiles/index.js +30 -0
  61. package/dist/prompt/index.d.ts +8 -12
  62. package/dist/prompt/index.js +3 -2
  63. package/dist/safety/index.d.ts +109 -14
  64. package/dist/safety/index.js +59 -3
  65. package/dist/sandbox/index.d.ts +81 -0
  66. package/dist/sandbox/index.js +1 -0
  67. package/dist/skill/index.d.ts +10 -8
  68. package/dist/skill/index.js +3 -3
  69. package/dist/storage/index.d.ts +12 -4
  70. package/dist/storage/index.js +1 -1
  71. package/dist/subagents/index.d.ts +177 -0
  72. package/dist/subagents/index.js +78 -0
  73. package/dist/team/index.d.ts +544 -0
  74. package/dist/team/index.js +41 -0
  75. package/dist/tool/host/index.d.ts +41 -0
  76. package/dist/tool/host/index.js +10 -0
  77. package/dist/tool/index.d.ts +125 -21
  78. package/dist/tool/index.js +20 -13
  79. package/dist/{types-VQgymC1N.d.ts → types-Bj_J8u_W.d.ts} +44 -64
  80. package/dist/{types-CHiPh8U2.d.ts → types-C_LCeYNg.d.ts} +7 -7
  81. package/dist/types-RSCv7nQ4.d.ts +59 -0
  82. package/package.json +58 -53
  83. package/dist/builder-UpOWQMW3.d.ts +0 -34
  84. package/dist/chunk-7MUFEN4K.js +0 -559
  85. package/dist/chunk-7VKQ4WPB.js +0 -73
  86. package/dist/chunk-BFM2YHNM.js +0 -222
  87. package/dist/chunk-DWYX7ASF.js +0 -26
  88. package/dist/chunk-KUVSERLJ.js +0 -50
  89. package/dist/chunk-N7P4PN3O.js +0 -84
  90. package/dist/chunk-SDSBEQXG.js +0 -157
  91. package/dist/chunk-SQU2AJHO.js +0 -305
  92. package/dist/chunk-VBWWUHWI.js +0 -724
  93. package/dist/chunk-VEKUXUVF.js +0 -41
  94. package/dist/chunk-VNQBHPCT.js +0 -398
  95. package/dist/chunk-WWYYNWEW.js +0 -259
  96. package/dist/context/index.d.ts +0 -259
  97. package/dist/context/index.js +0 -26
  98. package/dist/events-CE72w8W4.d.ts +0 -149
  99. package/dist/host/index.d.ts +0 -45
  100. package/dist/host/index.js +0 -8
  101. package/dist/index-CWSchSql.d.ts +0 -1058
  102. package/dist/messages-BYWGn8TY.d.ts +0 -110
  103. package/dist/presets/index.d.ts +0 -53
  104. package/dist/presets/index.js +0 -28
  105. package/dist/reasoning/index.d.ts +0 -116
  106. package/dist/registry-DwYqsQkX.d.ts +0 -164
  107. package/dist/runner-e2YRcUoX.d.ts +0 -786
  108. package/dist/scope/index.d.ts +0 -10
  109. package/dist/scope/index.js +0 -14
  110. package/dist/session-manager-B_CWGTsl.d.ts +0 -274
  111. package/dist/signal/index.d.ts +0 -28
  112. package/dist/signal/index.js +0 -6
  113. package/dist/sub-agent/index.d.ts +0 -23
  114. package/dist/sub-agent/index.js +0 -15
  115. package/dist/tool-BHbyUAy3.d.ts +0 -150
  116. package/dist/tool-DLXAR9Ce.d.ts +0 -145
  117. package/dist/tracker-DClqYqTj.d.ts +0 -96
  118. package/dist/tracking/index.d.ts +0 -111
  119. package/dist/tracking/index.js +0 -20
  120. package/dist/types-BfNpU8NS.d.ts +0 -270
  121. package/dist/types-BnpEOYV-.d.ts +0 -50
  122. package/dist/types-CQL-SvTn.d.ts +0 -29
  123. package/dist/types-CWm-7rvB.d.ts +0 -55
  124. package/dist/types-KKDrdU9Y.d.ts +0 -325
  125. package/dist/types-QA4WhEfz.d.ts +0 -138
  126. package/dist/types-QKHHQLLq.d.ts +0 -336
  127. package/dist/types-YuWV4ag7.d.ts +0 -72
@@ -1,325 +0,0 @@
1
- import { StreamTextResult, ToolSet, Output, LanguageModel, ModelMessage, TelemetrySettings } from 'ai';
2
- import { T as Tool } from './tool-BHbyUAy3.js';
3
- import { T as ToolHost } from './types-CHiPh8U2.js';
4
- import { S as StreamChunk, d as StreamProvider, M as MiddlewareRunner, e as ModelCallInput } from './runner-e2YRcUoX.js';
5
- import { R as ReasoningLevel } from './types-CQaXbRsS.js';
6
- import { d as TurnTrackerContext } from './tool-DLXAR9Ce.js';
7
- import { L as LLMError } from './llm-error-D93FNNLY.js';
8
-
9
- /**
10
- * Intervention Controller for @cuylabs/agent-core
11
- *
12
- * Manages mid-turn message injection into running agent turns.
13
- * Uses Vercel AI SDK v6's `prepareStep` hook for zero-overhead
14
- * integration at step boundaries (between LLM calls in a multi-step turn).
15
- *
16
- * Instead of polling a queue after each tool execution, this leverages
17
- * the SDK's native step lifecycle. The
18
- * `prepareStep` callback fires before every LLM call, giving us a
19
- * natural injection point with no custom loop machinery.
20
- *
21
- * Two injection modes:
22
- * - **Immediate**: `intervene(msg)` — injected at the next step boundary
23
- * - **Deferred**: `queueNext(msg)` — held until the turn completes
24
- */
25
- /** A queued intervention message waiting to be applied */
26
- interface PendingIntervention {
27
- /** Unique identifier for tracking */
28
- readonly id: string;
29
- /** The user message to inject */
30
- readonly message: string;
31
- /** When the intervention was created */
32
- readonly createdAt: Date;
33
- }
34
- /**
35
- * Callback fired when an intervention is applied to a step.
36
- *
37
- * The agent uses this to push `intervention-applied` events into
38
- * the streaming event queue so they reach the consumer in the
39
- * correct order relative to other events.
40
- */
41
- type OnInterventionApplied = (intervention: PendingIntervention) => void;
42
- /**
43
- * Manages mid-turn message injection for agents.
44
- *
45
- * This is the core primitive that connects user redirection intent
46
- * to the AI SDK's multi-step loop. The flow:
47
- *
48
- * 1. Consumer calls `agent.intervene("focus on auth.ts")` from any async context
49
- * 2. The message is queued as a `PendingIntervention`
50
- * 3. At the next step boundary, `prepareStep` drains the queue
51
- * 4. The message is appended to the LLM's input messages
52
- * 5. The LLM responds to the redirect naturally
53
- *
54
- * Thread safety: All operations are synchronous and run on the
55
- * same event loop. No locks needed — Node.js guarantees ordering.
56
- *
57
- * @example
58
- * ```typescript
59
- * const ctrl = new InterventionController();
60
- *
61
- * // Queue an intervention (from a UI handler, WebSocket, etc.)
62
- * const id = ctrl.intervene("stop refactoring, fix the failing test first");
63
- *
64
- * // Later, in prepareStep:
65
- * const pending = ctrl.drainImmediate();
66
- * // → [{ id, message: "stop refactoring...", createdAt }]
67
- * ```
68
- */
69
- declare class InterventionController {
70
- /** Immediate interventions — applied at the next step boundary */
71
- private immediate;
72
- /** Deferred messages — held until the turn completes */
73
- private deferred;
74
- /**
75
- * Callback fired when an intervention is wired into a step.
76
- * Set by the Agent before starting a chat turn, cleared after.
77
- */
78
- onApplied?: OnInterventionApplied;
79
- /**
80
- * Inject a message at the next LLM step boundary.
81
- *
82
- * The message is appended as a user message to the conversation
83
- * before the next LLM call in the current multi-step turn. The
84
- * LLM will see it and can adjust its behavior accordingly.
85
- *
86
- * Safe to call from any async context while `chat()` is running.
87
- * If called when no turn is active, the message will be picked up
88
- * by the first step of the next `chat()` call.
89
- *
90
- * @param message - The user message to inject
91
- * @returns Intervention ID for tracking
92
- */
93
- intervene(message: string): string;
94
- /**
95
- * Drain and return all pending immediate interventions.
96
- * The internal queue is cleared atomically.
97
- *
98
- * @internal Called by the LLM stream's `prepareStep` hook
99
- */
100
- drainImmediate(): PendingIntervention[];
101
- /** Whether there are pending immediate interventions */
102
- get hasPending(): boolean;
103
- /** Number of pending immediate interventions */
104
- get pendingCount(): number;
105
- /**
106
- * Queue a message for after the current turn completes.
107
- *
108
- * Unlike `intervene()`, this does **not** inject mid-turn. The
109
- * message is held and available via `drainDeferred()` after
110
- * `chat()` finishes. The consumer decides whether to send it
111
- * as a new turn.
112
- *
113
- * @param message - The message to queue
114
- * @returns Intervention ID for tracking
115
- */
116
- queueNext(message: string): string;
117
- /**
118
- * Drain and return all deferred messages.
119
- * The internal queue is cleared atomically.
120
- */
121
- drainDeferred(): PendingIntervention[];
122
- /** Whether there are deferred messages */
123
- get hasDeferred(): boolean;
124
- /** Number of deferred messages */
125
- get deferredCount(): number;
126
- /** Clear all queues (immediate + deferred) */
127
- clear(): void;
128
- /** Reset the controller for a new turn (clears onApplied, keeps queues) */
129
- resetCallbacks(): void;
130
- }
131
-
132
- /**
133
- * Retry logic with exponential backoff for @cuylabs/agent-core
134
- *
135
- * Provides configurable retry behavior with header-aware delays,
136
- * exponential backoff, and abort signal support.
137
- */
138
-
139
- /**
140
- * Retry configuration
141
- */
142
- interface RetryConfig {
143
- /** Maximum number of retry attempts (default: 3) */
144
- maxAttempts?: number;
145
- /** Initial delay in ms (default: 2000) */
146
- initialDelayMs?: number;
147
- /** Backoff multiplier (default: 2) */
148
- backoffFactor?: number;
149
- /** Maximum delay without headers in ms (default: 30000) */
150
- maxDelayMs?: number;
151
- /** Whether to jitter delays (default: true) */
152
- jitter?: boolean;
153
- /** Callback when retrying */
154
- onRetry?: (attempt: number, delayMs: number, error: LLMError) => void;
155
- }
156
- /**
157
- * Default retry configuration
158
- */
159
- declare const DEFAULT_RETRY_CONFIG: Required<Omit<RetryConfig, "onRetry">>;
160
- /**
161
- * Tracks retry state across attempts
162
- */
163
- interface RetryState {
164
- /** Current attempt number (1-indexed) */
165
- attempt: number;
166
- /** Total errors encountered */
167
- errors: LLMError[];
168
- /** Whether more retries are available */
169
- canRetry: boolean;
170
- /** Delay until next retry (if applicable) */
171
- nextDelayMs?: number;
172
- }
173
- /**
174
- * Creates initial retry state
175
- */
176
- declare function createRetryState(): RetryState;
177
- /**
178
- * Calculate delay for a retry attempt
179
- */
180
- declare function calculateDelay(attempt: number, error: LLMError | undefined, config: Required<Omit<RetryConfig, "onRetry">>): number;
181
- /**
182
- * Sleep for a duration, respecting abort signal
183
- */
184
- declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
185
- /**
186
- * Execute a function with retry logic
187
- */
188
- declare function withRetry<T>(fn: (attempt: number) => Promise<T>, config?: RetryConfig, signal?: AbortSignal): Promise<T>;
189
- /**
190
- * Options for retry handler
191
- */
192
- interface RetryHandlerOptions extends RetryConfig {
193
- /** Abort signal */
194
- signal?: AbortSignal;
195
- }
196
- /**
197
- * Creates a retry handler that wraps stream creation
198
- */
199
- declare function createRetryHandler(options?: RetryHandlerOptions): <T>(createStream: (attempt: number) => Promise<T>) => Promise<T>;
200
- /**
201
- * Checks if more retries should be attempted
202
- */
203
- declare function shouldRetry(error: unknown, attempt: number, maxAttempts?: number): boolean;
204
-
205
- /** Stream result type - uses default Output for text streaming. */
206
- type InferenceStreamResult = StreamTextResult<ToolSet, Output.Output<string, string, never>>;
207
- /**
208
- * @deprecated Use `InferenceStreamResult`.
209
- */
210
- type LLMStreamResult = InferenceStreamResult;
211
-
212
- /**
213
- * Custom stream result type - compatible shape from external providers.
214
- */
215
- type InferenceCustomResult = {
216
- fullStream: AsyncIterable<StreamChunk>;
217
- text: Promise<string>;
218
- usage: Promise<{
219
- inputTokens: number;
220
- outputTokens: number;
221
- totalTokens: number;
222
- }>;
223
- finishReason: Promise<string>;
224
- };
225
- /** Union type for stream results - either AI SDK or custom. */
226
- type AnyInferenceResult = InferenceStreamResult | InferenceCustomResult;
227
- /**
228
- * @deprecated Use `InferenceCustomResult`.
229
- */
230
- type CustomStreamResult = InferenceCustomResult;
231
- /**
232
- * @deprecated Use `AnyInferenceResult`.
233
- */
234
- type AnyStreamResult = AnyInferenceResult;
235
- /** Default max output tokens. */
236
- declare const DEFAULT_MAX_OUTPUT_TOKENS = 32000;
237
- /**
238
- * @deprecated Use `DEFAULT_MAX_OUTPUT_TOKENS`.
239
- */
240
- declare const OUTPUT_TOKEN_MAX = 32000;
241
- /**
242
- * @deprecated Use StreamProvider from types instead.
243
- */
244
- type CustomStreamProvider = StreamProvider;
245
- /** Control whether AI SDK tool definitions auto-execute or only expose calls. */
246
- type ToolExecutionMode = "auto" | "plan";
247
- /**
248
- * Input for model inference stream creation.
249
- */
250
- interface InferenceStreamInput {
251
- /** Session ID */
252
- sessionID: string;
253
- /** Step number within the current turn */
254
- step?: number;
255
- /** Model to use */
256
- model: LanguageModel;
257
- /** System prompt parts */
258
- system: string[];
259
- /** Messages to send */
260
- messages: ModelMessage[];
261
- /** Abort signal */
262
- abort: AbortSignal;
263
- /** Tools to use */
264
- tools: Record<string, Tool.Info>;
265
- /** Whether tools should auto-execute or only be surfaced as tool calls. */
266
- toolExecutionMode?: ToolExecutionMode;
267
- /** Working directory */
268
- cwd: string;
269
- /** Execution environment for tools */
270
- host?: ToolHost;
271
- /** Temperature */
272
- temperature?: number;
273
- /** Top-p */
274
- topP?: number;
275
- /** Max output tokens */
276
- maxOutputTokens?: number;
277
- /** Max steps (tool iterations) */
278
- maxSteps?: number;
279
- /** Reasoning level for extended-thinking models */
280
- reasoningLevel?: ReasoningLevel;
281
- /** Retry configuration */
282
- retry?: RetryConfig;
283
- /** Callback for step completion */
284
- onStepFinish?: (step: InferenceStepInfo) => void | Promise<void>;
285
- /** Custom stream provider */
286
- customStreamProvider?: StreamProvider;
287
- /** Turn tracker for automatic file baseline capture */
288
- turnTracker?: TurnTrackerContext;
289
- /** Pre-built MCP tools */
290
- mcpTools?: ToolSet;
291
- /** Intervention controller for mid-turn message injection */
292
- intervention?: InterventionController;
293
- /** Middleware runner for lifecycle hooks */
294
- middleware?: MiddlewareRunner;
295
- /** AI SDK telemetry settings */
296
- telemetry?: TelemetrySettings;
297
- /** Internal snapshot of the resolved model request after middleware input hooks. */
298
- activeModelCall?: ModelCallInput;
299
- }
300
- /**
301
- * Step information surfaced to callers.
302
- */
303
- interface InferenceStepInfo {
304
- toolResults?: Array<{
305
- toolName: string;
306
- toolCallId: string;
307
- output: unknown;
308
- }>;
309
- usage?: {
310
- inputTokens?: number;
311
- outputTokens?: number;
312
- totalTokens?: number;
313
- };
314
- finishReason?: string;
315
- }
316
- /**
317
- * @deprecated Use `InferenceStreamInput`.
318
- */
319
- type LLMStreamInput = InferenceStreamInput;
320
- /**
321
- * @deprecated Use `InferenceStepInfo`.
322
- */
323
- type StepInfo = InferenceStepInfo;
324
-
325
- export { type AnyInferenceResult as A, type CustomStreamProvider as C, DEFAULT_MAX_OUTPUT_TOKENS as D, type InferenceStreamInput as I, type LLMStreamInput as L, OUTPUT_TOKEN_MAX as O, type PendingIntervention as P, type RetryConfig as R, type StepInfo as S, type ToolExecutionMode as T, type AnyStreamResult as a, type CustomStreamResult as b, type InferenceCustomResult as c, type InferenceStepInfo as d, type InferenceStreamResult as e, type LLMStreamResult as f, InterventionController as g, DEFAULT_RETRY_CONFIG as h, type OnInterventionApplied as i, type RetryHandlerOptions as j, type RetryState as k, calculateDelay as l, createRetryHandler as m, createRetryState as n, sleep as o, shouldRetry as s, withRetry as w };
@@ -1,138 +0,0 @@
1
- /**
2
- * Model Capability Types for @cuylabs/agent-core
3
- *
4
- * Defines the structure for model capabilities that can be sourced from
5
- * static patterns, local cache, or remote APIs.
6
- */
7
- /**
8
- * Input modalities a model can accept
9
- */
10
- type InputModality = "text" | "image" | "audio" | "video" | "pdf";
11
- /**
12
- * Output modalities a model can produce
13
- */
14
- type OutputModality = "text" | "image" | "audio" | "video";
15
- /**
16
- * Comprehensive model capabilities
17
- */
18
- interface ModelCapabilities {
19
- /** Model supports extended reasoning/thinking */
20
- reasoning: boolean;
21
- /** Model supports function/tool calling */
22
- toolCalling: boolean;
23
- /** Model supports temperature adjustment */
24
- temperature: boolean;
25
- /** Model supports file attachments */
26
- attachments: boolean;
27
- /** Model supports streaming responses */
28
- streaming: boolean;
29
- /** Supported input modalities */
30
- inputModalities: InputModality[];
31
- /** Supported output modalities */
32
- outputModalities: OutputModality[];
33
- /** Maximum context window in tokens */
34
- contextWindow?: number;
35
- /** Maximum output tokens */
36
- maxOutput?: number;
37
- }
38
- /**
39
- * Provider-specific compatibility flags
40
- * These handle quirks in different provider implementations
41
- */
42
- interface ProviderCompatibility {
43
- /** Supports OpenAI-style reasoning_effort parameter */
44
- supportsReasoningEffort?: boolean;
45
- /** Supports developer/system role distinction */
46
- supportsDeveloperRole?: boolean;
47
- /** Field name for max tokens (varies by provider) */
48
- maxTokensField?: "max_tokens" | "max_completion_tokens";
49
- /** Requires thinking as text tags vs structured */
50
- requiresThinkingTags?: boolean;
51
- /** Provider-specific thinking format */
52
- thinkingFormat?: "openai" | "anthropic" | "google" | "zai";
53
- }
54
- /**
55
- * Complete model entry with metadata
56
- */
57
- interface ModelEntry {
58
- /** Model identifier (e.g., "gpt-4o", "claude-sonnet-4") */
59
- id: string;
60
- /** Human-readable model name */
61
- name: string;
62
- /** Provider identifier (e.g., "openai", "anthropic") */
63
- provider: string;
64
- /** Model capabilities */
65
- capabilities: ModelCapabilities;
66
- /** Provider-specific compatibility settings */
67
- compatibility?: ProviderCompatibility;
68
- /** Cost per million tokens (input) */
69
- costInput?: number;
70
- /** Cost per million tokens (output) */
71
- costOutput?: number;
72
- /** When this entry was last updated */
73
- updatedAt?: string;
74
- }
75
- /**
76
- * Priority levels for capability sources
77
- */
78
- declare enum SourcePriority {
79
- /** User configuration overrides everything */
80
- UserConfig = 0,
81
- /** Local cache from previous fetch */
82
- LocalCache = 1,
83
- /** Bundled static data (build-time) */
84
- BundledData = 2,
85
- /** Pattern-based inference (fallback) */
86
- PatternMatch = 3,
87
- /** Remote API (if network available) */
88
- RemoteAPI = 4
89
- }
90
- /**
91
- * Result from a capability source lookup
92
- */
93
- interface SourceResult {
94
- /** The model entry if found */
95
- entry?: ModelEntry;
96
- /** Which source provided this result */
97
- source: SourcePriority;
98
- /** Whether this is a confident match */
99
- confident: boolean;
100
- /** Error message if lookup failed */
101
- error?: string;
102
- }
103
- /**
104
- * Capability source interface
105
- */
106
- interface CapabilitySource {
107
- /** Source priority (lower = higher priority) */
108
- priority: SourcePriority;
109
- /** Human-readable source name */
110
- name: string;
111
- /** Look up capabilities for a model */
112
- lookup(modelId: string, provider?: string): Promise<SourceResult>;
113
- /** Check if this source is available */
114
- isAvailable(): Promise<boolean>;
115
- }
116
- /**
117
- * Options for the capability resolver
118
- */
119
- interface ResolverOptions {
120
- /** Enable remote API fetching (default: false) */
121
- enableRemoteFetch?: boolean;
122
- /** Remote API URL (default: https://models.dev) */
123
- remoteApiUrl?: string;
124
- /** Cache directory path */
125
- cachePath?: string;
126
- /** Cache TTL in milliseconds (default: 1 hour) */
127
- cacheTtlMs?: number;
128
- /** Network timeout in milliseconds (default: 10 seconds) */
129
- networkTimeoutMs?: number;
130
- /** Custom user overrides for specific models */
131
- modelOverrides?: Record<string, Partial<ModelCapabilities>>;
132
- }
133
- /**
134
- * Default resolver options
135
- */
136
- declare const DEFAULT_RESOLVER_OPTIONS: Required<ResolverOptions>;
137
-
138
- 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 };