@cuylabs/agent-core 0.5.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 +85 -372
  2. package/dist/{builder-RcTZuYnO.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-IMGQOTU2.js → chunk-3HNO5SVI.js} +286 -690
  5. package/dist/chunk-5K7AQVOU.js +619 -0
  6. package/dist/{chunk-QAQADS4X.js → chunk-BNSHUWCV.js} +1 -0
  7. package/dist/{chunk-OTUGSCED.js → chunk-CDTV2UYU.js} +159 -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-p0kOsVsE.d.ts → index-C33hlD6H.d.ts} +12 -7
  17. package/dist/{index-tmhaADz5.d.ts → index-CfBGYrpd.d.ts} +121 -2
  18. package/dist/index.d.ts +107 -126
  19. package/dist/index.js +322 -597
  20. package/dist/inference/index.d.ts +59 -0
  21. package/dist/inference/index.js +25 -0
  22. package/dist/middleware/index.d.ts +8 -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 +10 -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-C7aMP_x3.d.ts → runner-DSKaEz3z.d.ts} +290 -7
  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 +8 -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-MM1JoX5T.d.ts +0 -810
@@ -1,8 +1,177 @@
1
1
  import * as ai from 'ai';
2
- import { LanguageModel } 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';
8
+ import { R as ReasoningLevel } from './types-CQaXbRsS.js';
9
+
10
+ /**
11
+ * Stream types for @cuylabs/agent-core
12
+ *
13
+ * Defines the canonical StreamChunk union and related types
14
+ * for both AI SDK native and custom stream providers.
15
+ */
16
+ /**
17
+ * Stream chunk types (AI SDK compatible + custom streams)
18
+ *
19
+ * This is the single canonical definition — used by both the
20
+ * streaming module and custom stream providers.
21
+ */
22
+ type StreamChunk = {
23
+ type: "text-start";
24
+ } | {
25
+ type: "text-delta";
26
+ text: string;
27
+ } | {
28
+ type: "text-end";
29
+ } | {
30
+ type: "reasoning-start";
31
+ id: string;
32
+ } | {
33
+ type: "reasoning-delta";
34
+ id: string;
35
+ text: string;
36
+ } | {
37
+ type: "reasoning-end";
38
+ id: string;
39
+ } | {
40
+ type: "tool-call";
41
+ toolName: string;
42
+ toolCallId: string;
43
+ input: unknown;
44
+ } | {
45
+ type: "tool-result";
46
+ toolName: string;
47
+ toolCallId: string;
48
+ output: unknown;
49
+ } | {
50
+ type: "tool-error";
51
+ toolName: string;
52
+ toolCallId: string;
53
+ error: unknown;
54
+ } | {
55
+ type: "finish-step";
56
+ usage?: {
57
+ inputTokens?: number;
58
+ outputTokens?: number;
59
+ totalTokens?: number;
60
+ };
61
+ finishReason?: string;
62
+ } | {
63
+ type: "finish";
64
+ totalUsage?: {
65
+ inputTokens?: number;
66
+ outputTokens?: number;
67
+ totalTokens?: number;
68
+ };
69
+ } | {
70
+ type: "error";
71
+ error: unknown;
72
+ } | {
73
+ type: "start-step";
74
+ } | {
75
+ type: "start";
76
+ } | {
77
+ type: "abort";
78
+ } | {
79
+ type: "computer-call";
80
+ callId: string;
81
+ action: unknown;
82
+ pendingSafetyChecks?: unknown[];
83
+ } | {
84
+ type: "step-usage";
85
+ usage: {
86
+ inputTokens: number;
87
+ outputTokens: number;
88
+ totalTokens: number;
89
+ };
90
+ };
91
+ /**
92
+ * Custom stream provider function type.
93
+ *
94
+ * This matches the signature needed for agent-core's inference module,
95
+ * returning a StreamProviderResult-compatible object.
96
+ */
97
+ type StreamProvider = (input: StreamProviderInput) => Promise<StreamProviderResult>;
98
+ /**
99
+ * Input for custom stream providers
100
+ */
101
+ interface StreamProviderInput {
102
+ /** System prompt */
103
+ system: string;
104
+ /** Messages to send */
105
+ messages: Array<{
106
+ role: string;
107
+ content: unknown;
108
+ }>;
109
+ /** Abort signal */
110
+ abortSignal?: AbortSignal;
111
+ /** Max iterations */
112
+ maxSteps?: number;
113
+ }
114
+ /**
115
+ * Result from custom stream providers (AI SDK StreamTextResult compatible)
116
+ */
117
+ interface StreamProviderResult {
118
+ /** Async iterable of stream chunks */
119
+ fullStream: AsyncIterable<StreamChunk>;
120
+ /** Promise resolving to final text */
121
+ text: Promise<string>;
122
+ /** Promise resolving to usage stats */
123
+ usage: Promise<{
124
+ inputTokens: number;
125
+ outputTokens: number;
126
+ totalTokens: number;
127
+ }>;
128
+ /** Promise resolving to finish reason */
129
+ finishReason: Promise<string>;
130
+ }
131
+ /**
132
+ * Configuration for stream provider factory.
133
+ * Contains everything needed to create a stream provider for a specific model.
134
+ */
135
+ interface StreamProviderConfig {
136
+ /** API key to use */
137
+ apiKey?: string;
138
+ /** Display dimensions */
139
+ display?: {
140
+ width: number;
141
+ height: number;
142
+ };
143
+ /** Environment type */
144
+ environment?: string;
145
+ /** Enable debug logging */
146
+ debug?: boolean;
147
+ }
148
+ /**
149
+ * Stream provider factory - creates a stream provider for a given model.
150
+ *
151
+ * This is attached to enhanced tools (like computer tools) to allow
152
+ * the Agent to automatically configure the right stream provider
153
+ * when a model requires custom handling (e.g., OpenAI computer-use-preview).
154
+ */
155
+ type StreamProviderFactory = (modelId: string, config: StreamProviderConfig) => StreamProvider;
156
+ /**
157
+ * Enhanced tools array with additional capabilities.
158
+ *
159
+ * This extends the standard Tool.AnyInfo[] with optional metadata
160
+ * that the Agent can use for automatic configuration.
161
+ */
162
+ interface EnhancedTools extends Array<unknown> {
163
+ /**
164
+ * Factory to create a stream provider for models that need custom streaming.
165
+ * Called by the Agent when it detects a model that requires special handling.
166
+ */
167
+ __streamProviderFactory?: StreamProviderFactory;
168
+ /**
169
+ * Model patterns that require the custom stream provider.
170
+ * Used by the Agent to detect when to use the factory.
171
+ * Default patterns: ["computer-use-preview"]
172
+ */
173
+ __customStreamModels?: string[];
174
+ }
6
175
 
7
176
  /** Agent status for UI display */
8
177
  type AgentStatus = "idle" | "processing" | "thinking" | "reasoning" | "calling-tool" | "waiting-approval" | "error";
@@ -127,13 +296,18 @@ type AgentEvent = {
127
296
  } | {
128
297
  type: "complete";
129
298
  usage?: TokenUsage;
299
+ output?: string;
130
300
  };
131
301
  /**
132
- * Processor result - what happens after processing a turn
302
+ * Step-processing result - what happens after reducing one streamed step
303
+ */
304
+ type StepProcessingResult = "continue" | "stop" | "compact";
305
+ /**
306
+ * @deprecated Use `StepProcessingResult`.
133
307
  */
134
- type ProcessorResult = "continue" | "stop" | "compact";
308
+ type ProcessorResult = StepProcessingResult;
135
309
  /**
136
- * Stream input for the LLM
310
+ * Stream input for model inference
137
311
  */
138
312
  interface StreamInput {
139
313
  sessionID: string;
@@ -389,6 +563,104 @@ interface ToolCallDecision {
389
563
  /** Reason for denial — returned to the model as the tool output */
390
564
  reason?: string;
391
565
  }
566
+ /**
567
+ * Mutable model invocation payload presented to middleware before an LLM call.
568
+ */
569
+ interface ModelCallInput {
570
+ model: LanguageModel;
571
+ system: string[];
572
+ messages: ModelMessage[];
573
+ temperature?: number;
574
+ topP?: number;
575
+ maxOutputTokens?: number;
576
+ maxSteps?: number;
577
+ reasoningLevel?: ReasoningLevel;
578
+ telemetry?: TelemetrySettings;
579
+ customStreamProvider?: StreamProvider;
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[];
601
+ }
602
+ /**
603
+ * Context shared across model middleware hooks for a single step.
604
+ */
605
+ interface ModelCallContext {
606
+ sessionID: string;
607
+ step: number;
608
+ cwd: string;
609
+ abort: AbortSignal;
610
+ model: LanguageModel;
611
+ toolNames: string[];
612
+ mcpToolNames: string[];
613
+ scope?: ScopeSnapshot;
614
+ }
615
+ /**
616
+ * Return this from `model.input(...)` to stop an LLM call entirely.
617
+ */
618
+ interface BlockedModelCall {
619
+ block: true;
620
+ reason: string;
621
+ }
622
+ /**
623
+ * Final step result exposed to model middleware after the stream is processed.
624
+ */
625
+ interface ModelCallOutput {
626
+ text: string;
627
+ usage?: TokenUsage;
628
+ finishReason?: string;
629
+ }
630
+ /**
631
+ * Optional model-specific hooks grouped under `middleware.model`.
632
+ */
633
+ interface AgentModelHooks {
634
+ /**
635
+ * Review or rewrite the model request before the LLM is invoked.
636
+ *
637
+ * Return:
638
+ * - `undefined` to keep the current request
639
+ * - a `ModelCallInput` object to replace the request
640
+ * - `{ block: true, reason }` to cancel the model call
641
+ *
642
+ * Hooks run in middleware array order. The first block stops the call.
643
+ */
644
+ input?(input: ModelCallInput, ctx: ModelCallContext): Promise<ModelCallInput | BlockedModelCall | void>;
645
+ /**
646
+ * Review or rewrite raw stream chunks as they arrive from the model.
647
+ *
648
+ * Return:
649
+ * - `undefined` to keep the current chunk
650
+ * - a `StreamChunk` to replace it
651
+ * - `null` to drop it from downstream processing
652
+ *
653
+ * Hooks run in middleware array order.
654
+ */
655
+ chunk?(chunk: StreamChunk, ctx: ModelCallContext): Promise<StreamChunk | null | void>;
656
+ /**
657
+ * Review or rewrite the fully processed model result for the current step.
658
+ *
659
+ * Hooks run in reverse middleware order so outer middleware sees the final
660
+ * shaped result, matching `afterToolCall(...)`.
661
+ */
662
+ output?(output: ModelCallOutput, ctx: ModelCallContext): Promise<ModelCallOutput | void>;
663
+ }
392
664
  /**
393
665
  * Agent middleware — composable lifecycle hooks.
394
666
  *
@@ -397,6 +669,9 @@ interface ToolCallDecision {
397
669
  * Ordering:
398
670
  * - `beforeToolCall`: runs in array order, first "deny" wins
399
671
  * - `afterToolCall`: runs in reverse order (innermost first)
672
+ * - `model.input`: runs in array order, first block wins
673
+ * - `model.chunk`: runs in array order on raw stream chunks
674
+ * - `model.output`: runs in reverse order
400
675
  * - `promptSections`: all run, sections merged
401
676
  * - `onEvent`: all run in parallel (non-blocking)
402
677
  * - `onChatStart` / `onChatEnd`: run in array order, awaited sequentially
@@ -420,6 +695,11 @@ interface ToolCallDecision {
420
695
  interface AgentMiddleware {
421
696
  /** Middleware name (for logging and debugging) */
422
697
  name: string;
698
+ /**
699
+ * Optional hooks for shaping model requests, raw stream chunks,
700
+ * and final step outputs.
701
+ */
702
+ model?: AgentModelHooks;
423
703
  /**
424
704
  * Intercept a tool call before execution.
425
705
  *
@@ -538,6 +818,9 @@ declare class MiddlewareRunner {
538
818
  get hasMiddleware(): boolean;
539
819
  /** Get the middleware list (for fork inheritance) */
540
820
  getMiddleware(): readonly AgentMiddleware[];
821
+ runModelInput(input: ModelCallInput, ctx: ModelCallContext): Promise<ModelCallInput | BlockedModelCall>;
822
+ runModelChunk(chunk: StreamChunk, ctx: ModelCallContext): Promise<StreamChunk | undefined>;
823
+ runModelOutput(output: ModelCallOutput, ctx: ModelCallContext): Promise<ModelCallOutput>;
541
824
  /**
542
825
  * Run all `beforeToolCall` hooks in order.
543
826
  *
@@ -593,4 +876,4 @@ declare class MiddlewareRunner {
593
876
  }): Promise<void>;
594
877
  }
595
878
 
596
- export { type AgentEvent as A, type EnvironmentInfo as E, type InstructionFile as I, MiddlewareRunner as M, type PromptConfig as P, type StreamInput as S, type ToolCallDecision as T, type PromptBuildContext as a, type PromptSection as b, type ModelFamily as c, type ProcessorResult as d, type AgentTurnBoundaryKind as e, type AgentMiddleware as f, type AgentStatus as g, type ApprovalEvent as h };
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-C7aMP_x3.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, K as PrepareModelStepOptions, M as PreparedAgentModelStep, U as RunModelStepOptions, a as ProcessorOutput, V as RunToolBatchOptions, W as RunToolBatchResult, C as CommitOutputOptions, r as CommitStepOptions, l as AgentTurnState, p as AgentTurnStepCommitToolResult, o as AgentTurnStepCommitToolCall } from '../types-MM1JoX5T.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, a2 as advanceAgentTurnState, a4 as createAgentTurnEngine, a5 as createAgentTurnState, a8 as failAgentTurnState } from '../types-MM1JoX5T.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-IMGQOTU2.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
+ };
@@ -271,4 +271,4 @@ declare class SessionManager {
271
271
  getStorage(): SessionStorage;
272
272
  }
273
273
 
274
- export { type BranchEntry as B, type CompactionEntry as C, type EntryBase as E, type FileEntry as F, type MessageEntry as M, STORAGE_VERSION as S, type CreateSessionOptions as a, type MetadataEntry as b, type SessionContext as c, type SessionEntry as d, type SessionHeader as e, type SessionInfo as f, SessionManager as g, type SessionStorage as h, type SerializedMessage as i, type ConfigChangeEntry as j };
274
+ export { type BranchEntry as B, type CompactionEntry as C, type EntryBase as E, type FileEntry as F, type MessageEntry as M, SessionManager as S, type ConfigChangeEntry as a, type CreateSessionOptions as b, type MetadataEntry as c, STORAGE_VERSION as d, type SerializedMessage as e, type SessionContext as f, type SessionEntry as g, type SessionHeader as h, type SessionInfo as i, type SessionStorage as j };
@@ -1,9 +1,11 @@
1
- import { h as SkillScope, i as SkillSource, a as SkillMetadata, g as SkillResourceType, c as SkillResource, b as SkillContent, d as SkillConfig, S as SkillDiscoveryResult, T as Tool } from '../tool-pFAnJc5Y.js';
2
- export { R as RemoteSkillEntry, e as RemoteSkillIndex, f as SkillDiscoveryError, j as SkillSourceType } from '../tool-pFAnJc5Y.js';
3
- import { S as SkillRegistry } from '../registry-CuRWWtcT.js';
4
- export { c as createSkillRegistry, e as emptySkillRegistry } from '../registry-CuRWWtcT.js';
1
+ import { h as SkillScope, i as SkillSource, a as SkillMetadata, g as SkillResourceType, c as SkillResource, b as SkillContent, d as SkillConfig, S as SkillDiscoveryResult, T as Tool } from '../tool-Db1Ue-1U.js';
2
+ export { R as RemoteSkillEntry, e as RemoteSkillIndex, f as SkillDiscoveryError, j as SkillSourceType } from '../tool-Db1Ue-1U.js';
3
+ import { S as SkillRegistry } from '../registry-BDLIHOQB.js';
4
+ export { c as createSkillRegistry, e as emptySkillRegistry } from '../registry-BDLIHOQB.js';
5
5
  import 'zod';
6
- import '../tool-DYp6-cC3.js';
6
+ import '../tool-HUtkiVBx.js';
7
+ import '../types-CHiPh8U2.js';
8
+ import '../types-9jGQUjqW.js';
7
9
 
8
10
  declare const SKILL_FILENAME = "SKILL.md";
9
11
  declare const DEFAULT_SKILL_MAX_SIZE = 102400;
@@ -1,5 +1,5 @@
1
- import { F as FileEntry, i as SerializedMessage, d as SessionEntry, M as MessageEntry, b as MetadataEntry, f as SessionInfo, h as SessionStorage, e as SessionHeader, g as SessionManager } from '../session-manager-Uawm2Le7.js';
2
- export { B as BranchEntry, C as CompactionEntry, j as ConfigChangeEntry, a as CreateSessionOptions, E as EntryBase, S as STORAGE_VERSION, c as SessionContext } from '../session-manager-Uawm2Le7.js';
1
+ import { F as FileEntry, g as SessionEntry, M as MessageEntry, c as MetadataEntry, e as SerializedMessage, i as SessionInfo, j as SessionStorage, h as SessionHeader, S as SessionManager } from '../session-manager-B_CWGTsl.js';
2
+ export { B as BranchEntry, C as CompactionEntry, a as ConfigChangeEntry, b as CreateSessionOptions, E as EntryBase, d as STORAGE_VERSION, f as SessionContext } from '../session-manager-B_CWGTsl.js';
3
3
  import { M as Message } from '../messages-BYWGn8TY.js';
4
4
 
5
5
  /**
@@ -1,14 +1,18 @@
1
- export { c as AgentProfile, D as DEFAULT_MAX_CONCURRENT, d as DEFAULT_MAX_SPAWN_DEPTH, e as DEFAULT_SESSION_TITLE_PREFIX, S as SubAgentCompletedResult, f as SubAgentHandle, g as SubAgentStatus, h as SubAgentToolConfig, i as SubAgentTracker, j as SubAgentUsage, l as createSubAgentTools } from '../index-p0kOsVsE.js';
1
+ export { c as AgentProfile, D as DEFAULT_MAX_CONCURRENT, d as DEFAULT_MAX_SPAWN_DEPTH, e as DEFAULT_SESSION_TITLE_PREFIX, S as SubAgentCompletedResult, g as SubAgentHandle, h as SubAgentStatus, i as SubAgentToolConfig, j as SubAgentTracker, k as SubAgentUsage, m as createSubAgentTools } from '../index-C33hlD6H.js';
2
2
  import 'ai';
3
3
  import '../types-CQaXbRsS.js';
4
- import '../tool-pFAnJc5Y.js';
4
+ import '../tool-Db1Ue-1U.js';
5
5
  import 'zod';
6
- import '../tool-DYp6-cC3.js';
7
- import '../runner-C7aMP_x3.js';
6
+ import '../tool-HUtkiVBx.js';
7
+ import '../types-CHiPh8U2.js';
8
+ import '../types-9jGQUjqW.js';
9
+ import '../runner-DSKaEz3z.js';
10
+ import '@ai-sdk/provider-utils';
8
11
  import '../messages-BYWGn8TY.js';
9
- import '../session-manager-Uawm2Le7.js';
12
+ import '../session-manager-B_CWGTsl.js';
10
13
  import '../types-VQgymC1N.js';
11
14
  import '../tracker-DClqYqTj.js';
12
- import '../builder-RcTZuYnO.js';
13
- import '../registry-CuRWWtcT.js';
14
- import '../types-MM1JoX5T.js';
15
+ import '../builder-BRvqCcIk.js';
16
+ import '../registry-BDLIHOQB.js';
17
+ import '../types-FRpzzg_9.js';
18
+ import '../types-CqDZTh4d.js';
@@ -1,10 +1,14 @@
1
- import { T as Tool } from '../tool-pFAnJc5Y.js';
2
- export { C as CompatibleSchema, I as InferSchemaOutput, k as defineTool } from '../tool-pFAnJc5Y.js';
3
- import { a as ToolReplayPolicy, F as FileOperationMeta, N as NormalizedToolReplayPolicy, d as ToolHost, e as TurnTrackerContext } from '../tool-DYp6-cC3.js';
4
- import { M as MiddlewareRunner } from '../runner-C7aMP_x3.js';
1
+ import { T as Tool } from '../tool-Db1Ue-1U.js';
2
+ export { C as CompatibleSchema, I as InferSchemaOutput, k as defineTool } from '../tool-Db1Ue-1U.js';
3
+ import { a as ToolReplayPolicy, F as FileOperationMeta, N as NormalizedToolReplayPolicy, d as TurnTrackerContext } from '../tool-HUtkiVBx.js';
4
+ import { T as ToolHost } from '../types-CHiPh8U2.js';
5
+ import { M as MiddlewareRunner } from '../runner-DSKaEz3z.js';
5
6
  import 'zod';
7
+ import '../types-9jGQUjqW.js';
6
8
  import 'ai';
9
+ import '@ai-sdk/provider-utils';
7
10
  import '../messages-BYWGn8TY.js';
11
+ import '../types-CQaXbRsS.js';
8
12
 
9
13
  /**
10
14
  * Normalize a tool replay policy into explicit, infrastructure-agnostic
@@ -2,9 +2,6 @@ import {
2
2
  ToolRegistry,
3
3
  defaultRegistry
4
4
  } from "../chunk-SDSBEQXG.js";
5
- import {
6
- executeAgentToolCall
7
- } from "../chunk-FG4MD5MU.js";
8
5
  import {
9
6
  MAX_BYTES,
10
7
  MAX_LINES,
@@ -16,6 +13,10 @@ import {
16
13
  normalizeToolReplayPolicy,
17
14
  truncateOutput
18
15
  } from "../chunk-P6YF7USR.js";
16
+ import {
17
+ executeAgentToolCall
18
+ } from "../chunk-IEFIQENH.js";
19
+ import "../chunk-N7P4PN3O.js";
19
20
  import "../chunk-VEKUXUVF.js";
20
21
  export {
21
22
  MAX_BYTES,
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { T as ToolMetadata, a as ToolReplayPolicy, b as ToolContext, F as FileOperationMeta, c as ToolResult } from './tool-DYp6-cC3.js';
2
+ import { T as ToolMetadata, a as ToolReplayPolicy, b as ToolContext, F as FileOperationMeta, c as ToolResult } from './tool-HUtkiVBx.js';
3
3
 
4
4
  /**
5
5
  * Skill System Types