@cuylabs/agent-core 0.6.0 → 0.7.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 (57) hide show
  1. package/README.md +5 -1
  2. package/dist/{builder-BKkipazh.d.ts → builder-BRvqCcIk.d.ts} +2 -2
  3. package/dist/{resolver-DOfZ-xuk.d.ts → capability-resolver-CgRGsWVX.d.ts} +1 -1
  4. package/dist/{chunk-3C4VKG4P.js → chunk-3HNO5SVI.js} +273 -807
  5. package/dist/chunk-5K7AQVOU.js +619 -0
  6. package/dist/{chunk-QAQADS4X.js → chunk-BNSHUWCV.js} +1 -0
  7. package/dist/{chunk-O2ZCFQL6.js → chunk-CDTV2UYU.js} +86 -1
  8. package/dist/chunk-IEFIQENH.js +73 -0
  9. package/dist/chunk-N7P4PN3O.js +84 -0
  10. package/dist/{chunk-QWFMX226.js → chunk-QGOGIP7T.js} +148 -15
  11. package/dist/chunk-VNQBHPCT.js +398 -0
  12. package/dist/{chunk-X635CM2F.js → chunk-ZPMACVZK.js} +1 -1
  13. package/dist/context/index.js +1 -1
  14. package/dist/host/index.d.ts +45 -0
  15. package/dist/host/index.js +8 -0
  16. package/dist/{index-DZQJD_hp.d.ts → index-C33hlD6H.d.ts} +12 -7
  17. package/dist/{index-ipP3_ztp.d.ts → index-CfBGYrpd.d.ts} +121 -2
  18. package/dist/index.d.ts +107 -126
  19. package/dist/index.js +321 -601
  20. package/dist/inference/index.d.ts +59 -0
  21. package/dist/inference/index.js +25 -0
  22. package/dist/middleware/index.d.ts +7 -4
  23. package/dist/middleware/index.js +5 -3
  24. package/dist/models/index.d.ts +104 -2
  25. package/dist/models/index.js +40 -6
  26. package/dist/prompt/index.d.ts +9 -6
  27. package/dist/reasoning/index.d.ts +54 -8
  28. package/dist/reasoning/index.js +2 -3
  29. package/dist/{registry-CuRWWtcT.d.ts → registry-BDLIHOQB.d.ts} +1 -1
  30. package/dist/{runner-G1wxEgac.d.ts → runner-DSKaEz3z.d.ts} +35 -8
  31. package/dist/runtime/index.d.ts +41 -7
  32. package/dist/runtime/index.js +15 -6
  33. package/dist/scope/index.d.ts +10 -0
  34. package/dist/scope/index.js +14 -0
  35. package/dist/{session-manager-Uawm2Le7.d.ts → session-manager-B_CWGTsl.d.ts} +1 -1
  36. package/dist/skill/index.d.ts +7 -5
  37. package/dist/storage/index.d.ts +2 -2
  38. package/dist/sub-agent/index.d.ts +12 -8
  39. package/dist/tool/index.d.ts +7 -4
  40. package/dist/tool/index.js +4 -3
  41. package/dist/{tool-pFAnJc5Y.d.ts → tool-Db1Ue-1U.d.ts} +1 -1
  42. package/dist/{tool-DYp6-cC3.d.ts → tool-HUtkiVBx.d.ts} +5 -99
  43. package/dist/tracking/index.d.ts +3 -1
  44. package/dist/types-9jGQUjqW.d.ts +29 -0
  45. package/dist/types-CHiPh8U2.d.ts +100 -0
  46. package/dist/types-CqDZTh4d.d.ts +335 -0
  47. package/dist/types-FRpzzg_9.d.ts +355 -0
  48. package/package.json +19 -8
  49. package/dist/capabilities/index.d.ts +0 -97
  50. package/dist/capabilities/index.js +0 -46
  51. package/dist/chunk-6TDTQJ4P.js +0 -116
  52. package/dist/chunk-DWYX7ASF.js +0 -26
  53. package/dist/chunk-FG4MD5MU.js +0 -54
  54. package/dist/config-D2xeGEHK.d.ts +0 -52
  55. package/dist/identifiers-BLUxFqV_.d.ts +0 -12
  56. package/dist/network-D76DS5ot.d.ts +0 -5
  57. package/dist/types-BWo810L_.d.ts +0 -648
@@ -0,0 +1,59 @@
1
+ import { ToolSet } from 'ai';
2
+ import { T as Tool } from '../tool-Db1Ue-1U.js';
3
+ import { T as ToolHost } from '../types-CHiPh8U2.js';
4
+ import { M as MiddlewareRunner } from '../runner-DSKaEz3z.js';
5
+ export { S as StreamChunk } from '../runner-DSKaEz3z.js';
6
+ import { d as TurnTrackerContext } from '../tool-HUtkiVBx.js';
7
+ import { T as ToolExecutionMode, I as InferenceStreamInput, A as AnyInferenceResult } from '../types-FRpzzg_9.js';
8
+ export { a as AnyStreamResult, C as CustomStreamProvider, b as CustomStreamResult, D as DEFAULT_MAX_OUTPUT_TOKENS, c as InferenceCustomResult, d as InferenceStepInfo, e as InferenceStreamResult, L as LLMStreamInput, f as LLMStreamResult, O as OUTPUT_TOKEN_MAX, S as StepInfo } from '../types-FRpzzg_9.js';
9
+ import 'zod';
10
+ import '@ai-sdk/provider-utils';
11
+ import '../messages-BYWGn8TY.js';
12
+ import '../types-9jGQUjqW.js';
13
+ import '../types-CQaXbRsS.js';
14
+
15
+ /**
16
+ * Build a Vercel AI SDK `ToolSet` from `Tool.Info` definitions.
17
+ */
18
+ declare function buildToolSet(options: {
19
+ tools: Record<string, Tool.Info>;
20
+ cwd: string;
21
+ sessionID: string;
22
+ messageID: string;
23
+ abort: AbortSignal;
24
+ turnTracker?: TurnTrackerContext;
25
+ host?: ToolHost;
26
+ middleware?: MiddlewareRunner;
27
+ executionMode?: ToolExecutionMode;
28
+ }): Promise<ToolSet>;
29
+
30
+ /**
31
+ * Create a model inference stream with optional retry support.
32
+ */
33
+ declare function stream(input: InferenceStreamInput): Promise<AnyInferenceResult>;
34
+ /**
35
+ * Create a stream without retry.
36
+ */
37
+ declare function streamOnce(input: InferenceStreamInput): Promise<AnyInferenceResult>;
38
+ /**
39
+ * Create a single-step stream.
40
+ */
41
+ declare function streamStep(input: InferenceStreamInput): Promise<AnyInferenceResult>;
42
+
43
+ declare const Inference: {
44
+ readonly buildToolSet: typeof buildToolSet;
45
+ readonly stream: typeof stream;
46
+ readonly streamOnce: typeof streamOnce;
47
+ readonly streamStep: typeof streamStep;
48
+ };
49
+ /**
50
+ * @deprecated Use `Inference`.
51
+ */
52
+ declare const LLM: {
53
+ readonly buildToolSet: typeof buildToolSet;
54
+ readonly stream: typeof stream;
55
+ readonly streamOnce: typeof streamOnce;
56
+ readonly streamStep: typeof streamStep;
57
+ };
58
+
59
+ export { AnyInferenceResult, Inference, InferenceStreamInput, LLM, ToolExecutionMode, buildToolSet, stream, streamOnce, streamStep };
@@ -0,0 +1,25 @@
1
+ import {
2
+ DEFAULT_MAX_OUTPUT_TOKENS,
3
+ Inference,
4
+ LLM,
5
+ OUTPUT_TOKEN_MAX,
6
+ buildToolSet,
7
+ stream,
8
+ streamOnce,
9
+ streamStep
10
+ } from "../chunk-5K7AQVOU.js";
11
+ import "../chunk-ZPMACVZK.js";
12
+ import "../chunk-IEFIQENH.js";
13
+ import "../chunk-N7P4PN3O.js";
14
+ import "../chunk-VEKUXUVF.js";
15
+ import "../chunk-QGOGIP7T.js";
16
+ export {
17
+ DEFAULT_MAX_OUTPUT_TOKENS,
18
+ Inference,
19
+ LLM,
20
+ OUTPUT_TOKEN_MAX,
21
+ buildToolSet,
22
+ stream,
23
+ streamOnce,
24
+ streamStep
25
+ };
@@ -1,8 +1,11 @@
1
- export { h as AgentMiddleware, i as AgentModelHooks, B as BlockedModelCall, M as MiddlewareRunner, m as ModelCallContext, f as ModelCallInput, n as ModelCallOutput, T as ToolCallDecision } from '../runner-G1wxEgac.js';
2
- export { c as ApprovalMiddlewareConfig, O as OtelMiddlewareConfig, T as TelemetryConfig, e as TelemetryConfigResult, f as approvalMiddleware, g as createTelemetryConfig, o as otelMiddleware } from '../index-ipP3_ztp.js';
1
+ export { h as AgentMiddleware, i as AgentModelHooks, B as BlockedModelCall, M as MiddlewareRunner, m as ModelCallContext, e as ModelCallInput, n as ModelCallOutput, T as ToolCallDecision } from '../runner-DSKaEz3z.js';
2
+ export { c as ApprovalMiddlewareConfig, C as CacheTTL, O as OtelMiddlewareConfig, P as PromptCacheConfig, T as TelemetryConfig, e as TelemetryConfigResult, f as approvalMiddleware, g as createTelemetryConfig, o as otelMiddleware, p as promptCacheMiddleware } from '../index-CfBGYrpd.js';
3
3
  import 'ai';
4
+ import '@ai-sdk/provider-utils';
4
5
  import '../messages-BYWGn8TY.js';
5
- import '../tool-pFAnJc5Y.js';
6
+ import '../tool-Db1Ue-1U.js';
6
7
  import 'zod';
7
- import '../tool-DYp6-cC3.js';
8
+ import '../tool-HUtkiVBx.js';
9
+ import '../types-CHiPh8U2.js';
10
+ import '../types-9jGQUjqW.js';
8
11
  import '../types-CQaXbRsS.js';
@@ -2,11 +2,13 @@ import {
2
2
  MiddlewareRunner,
3
3
  approvalMiddleware,
4
4
  createTelemetryConfig,
5
- otelMiddleware
6
- } from "../chunk-O2ZCFQL6.js";
5
+ otelMiddleware,
6
+ promptCacheMiddleware
7
+ } from "../chunk-CDTV2UYU.js";
7
8
  export {
8
9
  MiddlewareRunner,
9
10
  approvalMiddleware,
10
11
  createTelemetryConfig,
11
- otelMiddleware
12
+ otelMiddleware,
13
+ promptCacheMiddleware
12
14
  };
@@ -1,5 +1,15 @@
1
- export { g as getModelId, a as getProviderId } from '../identifiers-BLUxFqV_.js';
2
1
  import { LanguageModel } from 'ai';
2
+ import { C as CapabilitySource, S as SourcePriority, d as SourceResult, P as ProviderCompatibility, c as ResolverOptions, b as ModelEntry, M as ModelCapabilities, N as NetworkStatus } from '../capability-resolver-CgRGsWVX.js';
3
+ export { D as DEFAULT_RESOLVER_OPTIONS, I as InputModality, a as ModelCapabilityResolver, O as OutputModality, R as ResolutionResult, e as configureResolver, f as extractModelId, g as extractProvider, h as getDefaultResolver } from '../capability-resolver-CgRGsWVX.js';
4
+
5
+ /**
6
+ * Extract a model ID string from a LanguageModel instance.
7
+ */
8
+ declare function getModelId(model: LanguageModel): string;
9
+ /**
10
+ * Extract a provider identifier from a LanguageModel instance.
11
+ */
12
+ declare function getProviderId(model: LanguageModel): string | undefined;
3
13
 
4
14
  type AdapterKind = "openai" | "anthropic" | "google" | "openai-compatible";
5
15
  type AdapterSettings = {
@@ -30,4 +40,96 @@ type Resolver = (key: string) => Promise<LanguageModel>;
30
40
  type SyncResolver = (key: string) => LanguageModel;
31
41
  declare function createResolver(directory: Directory): Resolver;
32
42
 
33
- export { type AdapterSettings, type Directory, type EngineSpec, type ModelSpec, type Resolver, type SyncResolver, createResolver };
43
+ /**
44
+ * Profile-Based Capability Detection for @cuylabs/agent-core
45
+ *
46
+ * Static pattern matching for model capabilities when no external data is available.
47
+ * This is the fallback layer — always works offline.
48
+ */
49
+
50
+ /**
51
+ * Infer provider from model ID
52
+ */
53
+ declare function inferProvider(modelId: string): string | undefined;
54
+ /**
55
+ * Pattern-based capability source
56
+ * Always available, uses heuristics to detect capabilities
57
+ */
58
+ declare class PatternCapabilitySource implements CapabilitySource {
59
+ readonly priority = SourcePriority.PatternMatch;
60
+ readonly name = "Pattern Matching";
61
+ lookup(modelId: string, providerHint?: string): Promise<SourceResult>;
62
+ isAvailable(): Promise<boolean>;
63
+ }
64
+ /**
65
+ * Quick check if a model ID likely supports reasoning
66
+ */
67
+ declare function likelySupportsReasoning(modelId: string): boolean;
68
+ /**
69
+ * Get provider compatibility for a model
70
+ */
71
+ declare function getProviderCompatibility(modelId: string, provider?: string): ProviderCompatibility | undefined;
72
+
73
+ type CapabilityOverrides = ResolverOptions["modelOverrides"];
74
+ type OverrideLookup = {
75
+ override?: Partial<ModelCapabilities>;
76
+ matchedKey?: string;
77
+ };
78
+ declare function findCapabilityOverride(overrides: CapabilityOverrides, modelId: string, provider?: string): OverrideLookup;
79
+ declare function applyCapabilityOverride(entry: ModelEntry, override?: Partial<ModelCapabilities>): ModelEntry;
80
+
81
+ declare class CapabilityCache {
82
+ private adapter;
83
+ private memoryCache;
84
+ private ttlMs;
85
+ private loaded;
86
+ constructor(options?: Partial<ResolverOptions>);
87
+ private load;
88
+ get(modelId: string, provider?: string): Promise<ModelEntry | undefined>;
89
+ set(entry: ModelEntry): Promise<void>;
90
+ setMany(entries: ModelEntry[]): Promise<void>;
91
+ persist(): Promise<void>;
92
+ clear(): Promise<void>;
93
+ stats(): {
94
+ size: number;
95
+ loaded: boolean;
96
+ };
97
+ getAll(): Promise<ModelEntry[]>;
98
+ getAllByProvider(): Promise<Record<string, ModelEntry[]>>;
99
+ }
100
+ declare class CacheCapabilitySource implements CapabilitySource {
101
+ private cache;
102
+ readonly priority = SourcePriority.LocalCache;
103
+ readonly name = "Local Cache";
104
+ constructor(cache: CapabilityCache);
105
+ lookup(modelId: string, provider?: string): Promise<SourceResult>;
106
+ isAvailable(): Promise<boolean>;
107
+ }
108
+
109
+ declare function getNetworkStatus(): NetworkStatus;
110
+
111
+ declare class RemoteCapabilityFetcher {
112
+ private apiUrl;
113
+ private timeoutMs;
114
+ private cache;
115
+ private lastFetchTime;
116
+ private minFetchInterval;
117
+ constructor(cache: CapabilityCache, options?: Partial<ResolverOptions>);
118
+ fetchAll(): Promise<ModelEntry[]>;
119
+ ping(): Promise<boolean>;
120
+ }
121
+
122
+ declare class RemoteCapabilitySource implements CapabilitySource {
123
+ readonly priority = SourcePriority.RemoteAPI;
124
+ readonly name = "Remote API (models.dev)";
125
+ private fetcher;
126
+ private cache;
127
+ private fetchPromise;
128
+ private enabled;
129
+ constructor(cache: CapabilityCache, options?: Partial<ResolverOptions>);
130
+ lookup(modelId: string, provider?: string): Promise<SourceResult>;
131
+ isAvailable(): Promise<boolean>;
132
+ refresh(): Promise<void>;
133
+ }
134
+
135
+ export { type AdapterSettings, CacheCapabilitySource, CapabilityCache, type CapabilityOverrides, CapabilitySource, type Directory, type EngineSpec, ModelCapabilities, ModelEntry, type ModelSpec, NetworkStatus, PatternCapabilitySource, ProviderCompatibility, RemoteCapabilityFetcher, RemoteCapabilitySource, type Resolver, ResolverOptions, SourcePriority, SourceResult, type SyncResolver, applyCapabilityOverride, createResolver, findCapabilityOverride, getModelId, getNetworkStatus, getProviderCompatibility, getProviderId, inferProvider, likelySupportsReasoning };
@@ -1,12 +1,46 @@
1
1
  import {
2
- createResolver
3
- } from "../chunk-6TDTQJ4P.js";
4
- import {
2
+ CacheCapabilitySource,
3
+ CapabilityCache,
4
+ DEFAULT_RESOLVER_OPTIONS,
5
+ ModelCapabilityResolver,
6
+ PatternCapabilitySource,
7
+ RemoteCapabilityFetcher,
8
+ RemoteCapabilitySource,
9
+ SourcePriority,
10
+ applyCapabilityOverride,
11
+ configureResolver,
12
+ createResolver,
13
+ extractModelId,
14
+ extractProvider,
15
+ findCapabilityOverride,
16
+ getDefaultResolver,
5
17
  getModelId,
6
- getProviderId
7
- } from "../chunk-DWYX7ASF.js";
18
+ getNetworkStatus,
19
+ getProviderCompatibility,
20
+ getProviderId,
21
+ inferProvider,
22
+ likelySupportsReasoning
23
+ } from "../chunk-QGOGIP7T.js";
8
24
  export {
25
+ CacheCapabilitySource,
26
+ CapabilityCache,
27
+ DEFAULT_RESOLVER_OPTIONS,
28
+ ModelCapabilityResolver,
29
+ PatternCapabilitySource,
30
+ RemoteCapabilityFetcher,
31
+ RemoteCapabilitySource,
32
+ SourcePriority,
33
+ applyCapabilityOverride,
34
+ configureResolver,
9
35
  createResolver,
36
+ extractModelId,
37
+ extractProvider,
38
+ findCapabilityOverride,
39
+ getDefaultResolver,
10
40
  getModelId,
11
- getProviderId
41
+ getNetworkStatus,
42
+ getProviderCompatibility,
43
+ getProviderId,
44
+ inferProvider,
45
+ likelySupportsReasoning
12
46
  };
@@ -1,12 +1,15 @@
1
- import { c as ModelFamily, l as EnvironmentInfo, I as InstructionFile } from '../runner-G1wxEgac.js';
2
- export { a as PromptBuildContext, P as PromptConfig, b as PromptSection } from '../runner-G1wxEgac.js';
1
+ import { c as ModelFamily, l as EnvironmentInfo, I as InstructionFile } from '../runner-DSKaEz3z.js';
2
+ export { a as PromptBuildContext, P as PromptConfig, b as PromptSection } from '../runner-DSKaEz3z.js';
3
3
  import { LanguageModel } from 'ai';
4
- export { P as PromptBuilder, c as createPromptBuilder } from '../builder-BKkipazh.js';
5
- export { d as SkillConfig } from '../tool-pFAnJc5Y.js';
4
+ export { P as PromptBuilder, c as createPromptBuilder } from '../builder-BRvqCcIk.js';
5
+ export { d as SkillConfig } from '../tool-Db1Ue-1U.js';
6
+ import '@ai-sdk/provider-utils';
6
7
  import '../messages-BYWGn8TY.js';
7
- import '../tool-DYp6-cC3.js';
8
+ import '../types-9jGQUjqW.js';
9
+ import '../tool-HUtkiVBx.js';
10
+ import '../types-CHiPh8U2.js';
8
11
  import '../types-CQaXbRsS.js';
9
- import '../registry-CuRWWtcT.js';
12
+ import '../registry-BDLIHOQB.js';
10
13
  import 'zod';
11
14
 
12
15
  /**
@@ -1,10 +1,9 @@
1
- import { R as ReasoningLevel } from '../types-CQaXbRsS.js';
2
- export { E as EXTENDED_LEVELS, F as FIXED_LEVELS, a as ReasoningConfig, S as STANDARD_LEVELS, s as shouldIncludeReasoningSummary } from '../types-CQaXbRsS.js';
3
- import { P as ProviderCompatibility } from '../resolver-DOfZ-xuk.js';
4
- export { e as extractModelId, a as extractProvider } from '../resolver-DOfZ-xuk.js';
5
- export { b as buildReasoningOptions, a as buildReasoningOptionsSync, g as getReasoningConfig, c as getReasoningConfigSync, s as supportsReasoning, d as supportsReasoningSync } from '../config-D2xeGEHK.js';
6
- import 'ai';
7
- import '@ai-sdk/provider-utils';
1
+ import { R as ReasoningLevel, a as ReasoningConfig } from '../types-CQaXbRsS.js';
2
+ export { E as EXTENDED_LEVELS, F as FIXED_LEVELS, S as STANDARD_LEVELS, s as shouldIncludeReasoningSummary } from '../types-CQaXbRsS.js';
3
+ import { P as ProviderCompatibility } from '../capability-resolver-CgRGsWVX.js';
4
+ export { f as extractModelId, g as extractProvider } from '../capability-resolver-CgRGsWVX.js';
5
+ import { LanguageModel } from 'ai';
6
+ import { ProviderOptions } from '@ai-sdk/provider-utils';
8
7
 
9
8
  /**
10
9
  * Provider-Specific Reasoning Option Builders
@@ -68,4 +67,51 @@ declare function buildOpenRouterOptions(level: ReasoningLevel): Record<string, u
68
67
  */
69
68
  declare function getProviderOptionsKey(provider: string): string;
70
69
 
71
- export { ReasoningLevel, buildAnthropicOptions, buildBedrockOptions, buildGoogleOptions, buildGroqOptions, buildOpenAIOptions, buildOpenRouterOptions, buildXAIOptions, getProviderOptionsKey };
70
+ /**
71
+ * Reasoning Configuration & Option Builders
72
+ *
73
+ * Orchestrates capability detection and provider-specific option
74
+ * building to produce ready-to-use `providerOptions` for the
75
+ * Vercel AI SDK.
76
+ *
77
+ * Two flavours of every function are provided:
78
+ * - **Async** (`getReasoningConfig`, `buildReasoningOptions`) —
79
+ * uses the full capability resolver (network + cache).
80
+ * - **Sync** (`getReasoningConfigSync`, `buildReasoningOptionsSync`) —
81
+ * uses fast pattern-matching only (no network).
82
+ */
83
+
84
+ /**
85
+ * Get the reasoning configuration for a model.
86
+ *
87
+ * Uses the full capability resolver (including network lookups)
88
+ * for the most accurate result.
89
+ */
90
+ declare function getReasoningConfig(model: LanguageModel): Promise<ReasoningConfig>;
91
+ /**
92
+ * Synchronous reasoning config using pattern-matching only.
93
+ *
94
+ * Faster but less accurate than {@link getReasoningConfig}.
95
+ * Good for hot paths where async is impractical.
96
+ */
97
+ declare function getReasoningConfigSync(model: LanguageModel): ReasoningConfig;
98
+ /**
99
+ * Build `providerOptions` for a reasoning level (async).
100
+ *
101
+ * Returns `undefined` when reasoning is off or unsupported.
102
+ */
103
+ declare function buildReasoningOptions(model: LanguageModel, level: ReasoningLevel): Promise<ProviderOptions | undefined>;
104
+ /**
105
+ * Build `providerOptions` for a reasoning level (sync / pattern-only).
106
+ */
107
+ declare function buildReasoningOptionsSync(model: LanguageModel, level: ReasoningLevel): ProviderOptions | undefined;
108
+ /**
109
+ * Check whether a model supports reasoning (async, full resolver).
110
+ */
111
+ declare function supportsReasoning(model: LanguageModel): Promise<boolean>;
112
+ /**
113
+ * Synchronous check using pattern-matching only.
114
+ */
115
+ declare function supportsReasoningSync(model: LanguageModel): boolean;
116
+
117
+ export { ReasoningConfig, ReasoningLevel, buildAnthropicOptions, buildBedrockOptions, buildGoogleOptions, buildGroqOptions, buildOpenAIOptions, buildOpenRouterOptions, buildReasoningOptions, buildReasoningOptionsSync, buildXAIOptions, getProviderOptionsKey, getReasoningConfig, getReasoningConfigSync, supportsReasoning, supportsReasoningSync };
@@ -17,12 +17,11 @@ import {
17
17
  shouldIncludeReasoningSummary,
18
18
  supportsReasoning,
19
19
  supportsReasoningSync
20
- } from "../chunk-X635CM2F.js";
20
+ } from "../chunk-ZPMACVZK.js";
21
21
  import {
22
22
  extractModelId,
23
23
  extractProvider
24
- } from "../chunk-QWFMX226.js";
25
- import "../chunk-DWYX7ASF.js";
24
+ } from "../chunk-QGOGIP7T.js";
26
25
  export {
27
26
  EXTENDED_LEVELS,
28
27
  FIXED_LEVELS,
@@ -1,4 +1,4 @@
1
- import { S as SkillDiscoveryResult, a as SkillMetadata, b as SkillContent, c as SkillResource, d as SkillConfig } from './tool-pFAnJc5Y.js';
1
+ import { S as SkillDiscoveryResult, a as SkillMetadata, b as SkillContent, c as SkillResource, d as SkillConfig } from './tool-Db1Ue-1U.js';
2
2
 
3
3
  /**
4
4
  * Skill Registry — in-memory store for discovered skills
@@ -1,8 +1,10 @@
1
1
  import * as ai from 'ai';
2
- import { LanguageModel, ModelMessage, TelemetrySettings } from 'ai';
2
+ import { LanguageModel, ModelMessage, TelemetrySettings, SystemModelMessage } from 'ai';
3
+ import { ProviderOptions } from '@ai-sdk/provider-utils';
3
4
  import { T as TokenUsage, M as Message } from './messages-BYWGn8TY.js';
4
- import { d as SkillConfig, T as Tool } from './tool-pFAnJc5Y.js';
5
- import { b as ToolContext } from './tool-DYp6-cC3.js';
5
+ import { d as SkillConfig, T as Tool } from './tool-Db1Ue-1U.js';
6
+ import { b as ScopeSnapshot } from './types-9jGQUjqW.js';
7
+ import { b as ToolContext } from './tool-HUtkiVBx.js';
6
8
  import { R as ReasoningLevel } from './types-CQaXbRsS.js';
7
9
 
8
10
  /**
@@ -89,7 +91,7 @@ type StreamChunk = {
89
91
  /**
90
92
  * Custom stream provider function type.
91
93
  *
92
- * This matches the signature needed for agent-core's LLM module,
94
+ * This matches the signature needed for agent-core's inference module,
93
95
  * returning a StreamProviderResult-compatible object.
94
96
  */
95
97
  type StreamProvider = (input: StreamProviderInput) => Promise<StreamProviderResult>;
@@ -297,11 +299,15 @@ type AgentEvent = {
297
299
  output?: string;
298
300
  };
299
301
  /**
300
- * Processor result - what happens after processing a turn
302
+ * Step-processing result - what happens after reducing one streamed step
301
303
  */
302
- type ProcessorResult = "continue" | "stop" | "compact";
304
+ type StepProcessingResult = "continue" | "stop" | "compact";
303
305
  /**
304
- * Stream input for the LLM
306
+ * @deprecated Use `StepProcessingResult`.
307
+ */
308
+ type ProcessorResult = StepProcessingResult;
309
+ /**
310
+ * Stream input for model inference
305
311
  */
306
312
  interface StreamInput {
307
313
  sessionID: string;
@@ -572,6 +578,26 @@ interface ModelCallInput {
572
578
  telemetry?: TelemetrySettings;
573
579
  customStreamProvider?: StreamProvider;
574
580
  toolExecutionMode?: "auto" | "plan";
581
+ /**
582
+ * Provider-specific options passed through to `streamText()`.
583
+ *
584
+ * Middleware can set these to enable provider features like Anthropic
585
+ * prompt caching (`{ anthropic: { cacheControl: { type: "ephemeral" } } }`).
586
+ *
587
+ * When multiple sources set providerOptions (e.g. middleware + reasoning),
588
+ * they are shallow-merged before the LLM call.
589
+ */
590
+ providerOptions?: ProviderOptions;
591
+ /**
592
+ * System messages with provider-specific options.
593
+ *
594
+ * When set, these take precedence over the plain `system` strings.
595
+ * This allows middleware to attach per-message metadata such as
596
+ * Anthropic `cacheControl` breakpoints on system content.
597
+ *
598
+ * Leave undefined to use the plain `system` string array.
599
+ */
600
+ systemMessages?: SystemModelMessage[];
575
601
  }
576
602
  /**
577
603
  * Context shared across model middleware hooks for a single step.
@@ -584,6 +610,7 @@ interface ModelCallContext {
584
610
  model: LanguageModel;
585
611
  toolNames: string[];
586
612
  mcpToolNames: string[];
613
+ scope?: ScopeSnapshot;
587
614
  }
588
615
  /**
589
616
  * Return this from `model.input(...)` to stop an LLM call entirely.
@@ -849,4 +876,4 @@ declare class MiddlewareRunner {
849
876
  }): Promise<void>;
850
877
  }
851
878
 
852
- export { type AgentEvent as A, type BlockedModelCall as B, type EnhancedTools as E, type InstructionFile as I, MiddlewareRunner as M, type PromptConfig as P, type StreamChunk as S, type ToolCallDecision as T, type PromptBuildContext as a, type PromptSection as b, type ModelFamily as c, type ProcessorResult as d, type StreamProvider as e, type ModelCallInput as f, type AgentTurnBoundaryKind as g, type AgentMiddleware as h, type AgentModelHooks as i, type AgentStatus as j, type ApprovalEvent as k, type EnvironmentInfo as l, type ModelCallContext as m, type ModelCallOutput as n, type StreamInput as o, type StreamProviderConfig as p, type StreamProviderFactory as q, type StreamProviderInput as r, type StreamProviderResult as s };
879
+ export { type AgentEvent as A, type BlockedModelCall as B, type EnhancedTools as E, type InstructionFile as I, MiddlewareRunner as M, type PromptConfig as P, type StreamChunk as S, type ToolCallDecision as T, type PromptBuildContext as a, type PromptSection as b, type ModelFamily as c, type StreamProvider as d, type ModelCallInput as e, type StepProcessingResult as f, type AgentTurnBoundaryKind as g, type AgentMiddleware as h, type AgentModelHooks as i, type AgentStatus as j, type ApprovalEvent as k, type EnvironmentInfo as l, type ModelCallContext as m, type ModelCallOutput as n, type ProcessorResult as o, type StreamInput as p, type StreamProviderConfig as q, type StreamProviderFactory as r, type StreamProviderInput as s, type StreamProviderResult as t };
@@ -1,13 +1,45 @@
1
- import { A as AgentEvent } from '../runner-G1wxEgac.js';
1
+ import { A as AgentEvent } from '../runner-DSKaEz3z.js';
2
2
  import { T as TokenUsage, M as Message } from '../messages-BYWGn8TY.js';
3
- import { n as AgentTurnStepCommitSnapshot, t as CreateAgentTurnStepCommitBatchOptions, f as AgentTurnCommitBatch, J as PrepareModelStepOptions, K as PreparedAgentModelStep, S as RunModelStepOptions, a as ProcessorOutput, U as RunToolBatchOptions, V as RunToolBatchResult, C as CommitOutputOptions, r as CommitStepOptions, l as AgentTurnState, p as AgentTurnStepCommitToolResult, o as AgentTurnStepCommitToolCall } from '../types-BWo810L_.js';
4
- export { b as AgentTurnActiveToolCall, c as AgentTurnBoundaryMetadata, d as AgentTurnBoundarySnapshot, e as AgentTurnCommitApplier, g as AgentTurnCommitOptions, h as AgentTurnEngine, i as AgentTurnEngineOptions, j as AgentTurnPhase, k as AgentTurnResolvedToolCall, m as AgentTurnStateAdvanceOptions, q as AgentTurnStepRuntimeConfig, s as CreateAgentTurnStateOptions, X as advanceAgentTurnState, Z as createAgentTurnEngine, _ as createAgentTurnState, a1 as failAgentTurnState } from '../types-BWo810L_.js';
3
+ import { b as ScopeSnapshot } from '../types-9jGQUjqW.js';
4
+ import { S as StepProcessingOptions, z as StepProcessingOutput, l as AgentTurnStepCommitSnapshot, r as CreateAgentTurnStepCommitBatchOptions, d as AgentTurnCommitBatch, P as PrepareModelStepOptions, u as PreparedAgentModelStep, R as RunModelStepOptions, x as RunToolBatchOptions, y as RunToolBatchResult, C as CommitOutputOptions, p as CommitStepOptions, j as AgentTurnState, n as AgentTurnStepCommitToolResult, m as AgentTurnStepCommitToolCall } from '../types-CqDZTh4d.js';
5
+ export { A as AgentTurnActiveToolCall, a as AgentTurnBoundaryMetadata, b as AgentTurnBoundarySnapshot, c as AgentTurnCommitApplier, e as AgentTurnCommitOptions, f as AgentTurnEngine, g as AgentTurnEngineOptions, h as AgentTurnPhase, i as AgentTurnResolvedToolCall, k as AgentTurnStateAdvanceOptions, o as AgentTurnStepRuntimeConfig, q as CreateAgentTurnStateOptions, v as ProcessorOptions, w as ProcessorOutput, B as advanceAgentTurnState, E as createAgentTurnEngine, F as createAgentTurnState, G as failAgentTurnState } from '../types-CqDZTh4d.js';
6
+ import { A as AnyInferenceResult } from '../types-FRpzzg_9.js';
5
7
  import { ModelMessage } from 'ai';
6
- import '../tool-pFAnJc5Y.js';
8
+ import '@ai-sdk/provider-utils';
9
+ import '../tool-Db1Ue-1U.js';
7
10
  import 'zod';
8
- import '../tool-DYp6-cC3.js';
11
+ import '../tool-HUtkiVBx.js';
12
+ import '../types-CHiPh8U2.js';
9
13
  import '../types-CQaXbRsS.js';
10
14
 
15
+ /**
16
+ * Doom loop error thrown when repeated tool calls are detected.
17
+ */
18
+ declare class DoomLoopError extends Error {
19
+ readonly toolName: string;
20
+ readonly repeatCount: number;
21
+ readonly input: unknown;
22
+ constructor(toolName: string, repeatCount: number, input: unknown);
23
+ }
24
+
25
+ /**
26
+ * Context overflow error.
27
+ */
28
+ declare class ContextOverflowError extends Error {
29
+ readonly inputTokens: number;
30
+ readonly limit: number;
31
+ constructor(inputTokens: number, limit: number);
32
+ }
33
+
34
+ /**
35
+ * Process an inference stream into runtime step events.
36
+ */
37
+ declare function processStepStream(stream: AnyInferenceResult, options: StepProcessingOptions): Promise<StepProcessingOutput>;
38
+ /**
39
+ * @deprecated Use `processStepStream`.
40
+ */
41
+ declare const processStream: typeof processStepStream;
42
+
11
43
  declare function createAgentTurnStepCommitBatch(step: number, snapshot: AgentTurnStepCommitSnapshot, options?: CreateAgentTurnStepCommitBatchOptions): AgentTurnCommitBatch | undefined;
12
44
 
13
45
  /**
@@ -18,7 +50,7 @@ declare function prepareModelStep(options: PrepareModelStepOptions): PreparedAge
18
50
  /**
19
51
  * Execute exactly one model/tool step and stream its events.
20
52
  */
21
- declare function runModelStep(options: RunModelStepOptions): AsyncGenerator<AgentEvent, ProcessorOutput>;
53
+ declare function runModelStep(options: RunModelStepOptions): AsyncGenerator<AgentEvent, StepProcessingOutput>;
22
54
 
23
55
  /**
24
56
  * Execute planned tool calls outside the AI SDK loop.
@@ -82,6 +114,7 @@ interface AgentTaskExecutionRun<TPayload extends AgentTaskPayload = AgentTaskPay
82
114
  context: Readonly<AgentTaskExecutionContext>;
83
115
  sessionId: string;
84
116
  startedAt: string;
117
+ scope?: ScopeSnapshot;
85
118
  }
86
119
  interface AgentTaskExecutionSnapshot {
87
120
  sessionId: string;
@@ -98,6 +131,7 @@ interface AgentTaskExecutionSnapshot {
98
131
  startedAt: string;
99
132
  updatedAt: string;
100
133
  turnState: AgentTurnState;
134
+ scope?: ScopeSnapshot;
101
135
  }
102
136
  interface AgentTaskExecutionCheckpoint<TPayload extends AgentTaskPayload = AgentTaskPayload> {
103
137
  run: AgentTaskExecutionRun<TPayload>;
@@ -354,4 +388,4 @@ declare function failAgentWorkflowTurnState(state: AgentWorkflowTurnState, error
354
388
  */
355
389
  declare function convertAgentMessagesToModelMessages(messages: Message[]): ModelMessage[];
356
390
 
357
- export { type AgentTaskChatAdapter, type AgentTaskCheckpointReason, type AgentTaskCheckpointStrategy, type AgentTaskCheckpointStrategyInput, type AgentTaskExecutionCheckpoint, type AgentTaskExecutionContext, type AgentTaskExecutionRun, type AgentTaskExecutionSnapshot, type AgentTaskObserver, type AgentTaskPayload, type AgentTaskResult, type AgentTaskRunner, type AgentTaskRunnerOptions, AgentTurnCommitBatch, AgentTurnState, AgentTurnStepCommitSnapshot, AgentTurnStepCommitToolCall, AgentTurnStepCommitToolResult, type AgentWorkflowAssistantMessageSnapshot, type AgentWorkflowCommitResult, type AgentWorkflowMessageSnapshot, type AgentWorkflowModelStepPlan, type AgentWorkflowModelStepResult, type AgentWorkflowOperationPlan, type AgentWorkflowOutputCommitPlan, type AgentWorkflowReplayDecision, type AgentWorkflowStepCommitPlan, type AgentWorkflowSystemMessageSnapshot, type AgentWorkflowToolBatchResult, type AgentWorkflowToolCallPlan, type AgentWorkflowToolCallResult, type AgentWorkflowToolCallSnapshot, type AgentWorkflowToolMessageSnapshot, type AgentWorkflowTurnPhase, type AgentWorkflowTurnState, type AgentWorkflowUserMessageSnapshot, CommitOutputOptions, CommitStepOptions, CreateAgentTurnStepCommitBatchOptions, type CreateAgentWorkflowTurnStateOptions, PrepareModelStepOptions, PreparedAgentModelStep, RunModelStepOptions, RunToolBatchOptions, RunToolBatchResult, applyAgentWorkflowCommitResult, applyAgentWorkflowModelStepResult, applyAgentWorkflowToolBatchResult, applyAgentWorkflowToolCallResult, cloneAgentWorkflowTurnState, commitOutput, commitStep, convertAgentMessagesToModelMessages, createAgentTaskRunner, createAgentTurnStepCommitBatch, createAgentWorkflowTurnState, defaultAgentTaskCheckpointStrategy, failAgentWorkflowTurnState, planNextAgentWorkflowOperation, prepareModelStep, recordAgentWorkflowReplayDecision, restoreAgentWorkflowMessage, restoreAgentWorkflowMessages, runModelStep, runToolBatch, snapshotAgentWorkflowMessage, snapshotAgentWorkflowMessages };
391
+ export { type AgentTaskChatAdapter, type AgentTaskCheckpointReason, type AgentTaskCheckpointStrategy, type AgentTaskCheckpointStrategyInput, type AgentTaskExecutionCheckpoint, type AgentTaskExecutionContext, type AgentTaskExecutionRun, type AgentTaskExecutionSnapshot, type AgentTaskObserver, type AgentTaskPayload, type AgentTaskResult, type AgentTaskRunner, type AgentTaskRunnerOptions, AgentTurnCommitBatch, AgentTurnState, AgentTurnStepCommitSnapshot, AgentTurnStepCommitToolCall, AgentTurnStepCommitToolResult, type AgentWorkflowAssistantMessageSnapshot, type AgentWorkflowCommitResult, type AgentWorkflowMessageSnapshot, type AgentWorkflowModelStepPlan, type AgentWorkflowModelStepResult, type AgentWorkflowOperationPlan, type AgentWorkflowOutputCommitPlan, type AgentWorkflowReplayDecision, type AgentWorkflowStepCommitPlan, type AgentWorkflowSystemMessageSnapshot, type AgentWorkflowToolBatchResult, type AgentWorkflowToolCallPlan, type AgentWorkflowToolCallResult, type AgentWorkflowToolCallSnapshot, type AgentWorkflowToolMessageSnapshot, type AgentWorkflowTurnPhase, type AgentWorkflowTurnState, type AgentWorkflowUserMessageSnapshot, CommitOutputOptions, CommitStepOptions, ContextOverflowError, CreateAgentTurnStepCommitBatchOptions, type CreateAgentWorkflowTurnStateOptions, DoomLoopError, PrepareModelStepOptions, PreparedAgentModelStep, RunModelStepOptions, RunToolBatchOptions, RunToolBatchResult, StepProcessingOptions, StepProcessingOutput, applyAgentWorkflowCommitResult, applyAgentWorkflowModelStepResult, applyAgentWorkflowToolBatchResult, applyAgentWorkflowToolCallResult, cloneAgentWorkflowTurnState, commitOutput, commitStep, convertAgentMessagesToModelMessages, createAgentTaskRunner, createAgentTurnStepCommitBatch, createAgentWorkflowTurnState, defaultAgentTaskCheckpointStrategy, failAgentWorkflowTurnState, planNextAgentWorkflowOperation, prepareModelStep, processStepStream, processStream, recordAgentWorkflowReplayDecision, restoreAgentWorkflowMessage, restoreAgentWorkflowMessages, runModelStep, runToolBatch, snapshotAgentWorkflowMessage, snapshotAgentWorkflowMessages };
@@ -1,5 +1,7 @@
1
1
  import {
2
2
  AgentTurnEngine,
3
+ ContextOverflowError,
4
+ DoomLoopError,
3
5
  advanceAgentTurnState,
4
6
  applyAgentWorkflowCommitResult,
5
7
  applyAgentWorkflowModelStepResult,
@@ -19,6 +21,8 @@ import {
19
21
  failAgentWorkflowTurnState,
20
22
  planNextAgentWorkflowOperation,
21
23
  prepareModelStep,
24
+ processStepStream,
25
+ processStream,
22
26
  recordAgentWorkflowReplayDecision,
23
27
  restoreAgentWorkflowMessage,
24
28
  restoreAgentWorkflowMessages,
@@ -26,15 +30,18 @@ import {
26
30
  runToolBatch,
27
31
  snapshotAgentWorkflowMessage,
28
32
  snapshotAgentWorkflowMessages
29
- } from "../chunk-3C4VKG4P.js";
30
- import "../chunk-FG4MD5MU.js";
33
+ } from "../chunk-3HNO5SVI.js";
34
+ import "../chunk-BNSHUWCV.js";
35
+ import "../chunk-5K7AQVOU.js";
36
+ import "../chunk-ZPMACVZK.js";
37
+ import "../chunk-IEFIQENH.js";
38
+ import "../chunk-N7P4PN3O.js";
31
39
  import "../chunk-VEKUXUVF.js";
32
- import "../chunk-QAQADS4X.js";
33
- import "../chunk-X635CM2F.js";
34
- import "../chunk-QWFMX226.js";
35
- import "../chunk-DWYX7ASF.js";
40
+ import "../chunk-QGOGIP7T.js";
36
41
  export {
37
42
  AgentTurnEngine,
43
+ ContextOverflowError,
44
+ DoomLoopError,
38
45
  advanceAgentTurnState,
39
46
  applyAgentWorkflowCommitResult,
40
47
  applyAgentWorkflowModelStepResult,
@@ -54,6 +61,8 @@ export {
54
61
  failAgentWorkflowTurnState,
55
62
  planNextAgentWorkflowOperation,
56
63
  prepareModelStep,
64
+ processStepStream,
65
+ processStream,
57
66
  recordAgentWorkflowReplayDecision,
58
67
  restoreAgentWorkflowMessage,
59
68
  restoreAgentWorkflowMessages,
@@ -0,0 +1,10 @@
1
+ import { S as ScopeOptions, a as Scope, b as ScopeSnapshot } from '../types-9jGQUjqW.js';
2
+ export { c as ScopeAttributeValue, d as ScopeAttributes, e as ScopeKind } from '../types-9jGQUjqW.js';
3
+
4
+ declare function currentScope(): Scope | undefined;
5
+ declare function snapshotScope(scope?: Scope | undefined): ScopeSnapshot | undefined;
6
+ declare function createScope(options: ScopeOptions): Scope;
7
+ declare function withinScope<T>(options: ScopeOptions, fn: () => T | Promise<T>): Promise<T>;
8
+ declare function restoreScope<T>(snapshot: ScopeSnapshot | undefined, fn: () => T | Promise<T>): Promise<T>;
9
+
10
+ export { Scope, ScopeOptions, ScopeSnapshot, createScope, currentScope, restoreScope, snapshotScope, withinScope };
@@ -0,0 +1,14 @@
1
+ import {
2
+ createScope,
3
+ currentScope,
4
+ restoreScope,
5
+ snapshotScope,
6
+ withinScope
7
+ } from "../chunk-N7P4PN3O.js";
8
+ export {
9
+ createScope,
10
+ currentScope,
11
+ restoreScope,
12
+ snapshotScope,
13
+ withinScope
14
+ };