gauss-ts 1.1.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 (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +499 -0
  3. package/dist/agent-CHrSUkPz.d.ts +485 -0
  4. package/dist/agent-CMp1wFzs.d.cts +485 -0
  5. package/dist/agent.cjs +2 -0
  6. package/dist/agent.cjs.map +1 -0
  7. package/dist/agent.d.cts +144 -0
  8. package/dist/agent.d.ts +144 -0
  9. package/dist/agent.js +2 -0
  10. package/dist/agent.js.map +1 -0
  11. package/dist/index.cjs +21 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.d.cts +492 -0
  14. package/dist/index.d.ts +492 -0
  15. package/dist/index.js +21 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/mcp.cjs +2 -0
  18. package/dist/mcp.cjs.map +1 -0
  19. package/dist/mcp.d.cts +282 -0
  20. package/dist/mcp.d.ts +282 -0
  21. package/dist/mcp.js +2 -0
  22. package/dist/mcp.js.map +1 -0
  23. package/dist/middleware.cjs +2 -0
  24. package/dist/middleware.cjs.map +1 -0
  25. package/dist/middleware.d.cts +46 -0
  26. package/dist/middleware.d.ts +46 -0
  27. package/dist/middleware.js +2 -0
  28. package/dist/middleware.js.map +1 -0
  29. package/dist/orchestration.cjs +2 -0
  30. package/dist/orchestration.cjs.map +1 -0
  31. package/dist/orchestration.d.cts +94 -0
  32. package/dist/orchestration.d.ts +94 -0
  33. package/dist/orchestration.js +2 -0
  34. package/dist/orchestration.js.map +1 -0
  35. package/dist/rag.cjs +2 -0
  36. package/dist/rag.cjs.map +1 -0
  37. package/dist/rag.d.cts +43 -0
  38. package/dist/rag.d.ts +43 -0
  39. package/dist/rag.js +2 -0
  40. package/dist/rag.js.map +1 -0
  41. package/dist/tools.cjs +2 -0
  42. package/dist/tools.cjs.map +1 -0
  43. package/dist/tools.d.cts +48 -0
  44. package/dist/tools.d.ts +48 -0
  45. package/dist/tools.js +2 -0
  46. package/dist/tools.js.map +1 -0
  47. package/dist/types-BkwC4s1P.d.cts +239 -0
  48. package/dist/types-BkwC4s1P.d.ts +239 -0
  49. package/package.json +132 -0
@@ -0,0 +1,492 @@
1
+ import { D as Disposable, H as Handle, E as EvalScorerType, J as JsMessage, e as CostEstimate, M as Message, b as AgentResult } from './types-BkwC4s1P.cjs';
2
+ export { A as AgentOptions, f as Citation, C as CodeExecutionOptions, g as CodeExecutionResult, h as CoercionStrategy, G as GeneratedImageData, i as GroundingChunk, j as GroundingMetadata, I as ImageGenerationConfig, k as ImageGenerationResult, l as MemoryEntry, m as MemoryStats, n as MessageRole, o as PiiAction, d as ProviderCapabilities, c as ProviderOptions, P as ProviderType, R as RecallOptions, p as SearchResult, S as StreamCallback, T as ToolDef, a as ToolExecutor, V as VectorChunk, q as detectProvider, r as resolveApiKey } from './types-BkwC4s1P.cjs';
3
+ import { A as AgentConfig, a as Agent } from './agent-CMp1wFzs.cjs';
4
+ export { b as AgentStream, S as StreamEvent, g as gauss } from './agent-CMp1wFzs.cjs';
5
+ export { BatchItem, availableRuntimes, batch, executeCode, generateImage } from './agent.cjs';
6
+ export { Memory, VectorStore } from './rag.cjs';
7
+ export { ConsensusStrategy, ForkNodeConfig, Graph, GraphNodeConfig, Network, Team, TeamResult, TeamStrategy, Workflow, WorkflowStepConfig } from './orchestration.cjs';
8
+ export { GuardrailChain, MiddlewareChain, PluginRegistry } from './middleware.cjs';
9
+ export { A2aClient, A2aClientOptions, A2aMessage, A2aMessageRole, AgentCapabilities, AgentCard, AgentSkill, Artifact, McpContent, McpModelHint, McpModelPreferences, McpPrompt, McpPromptArgument, McpPromptMessage, McpPromptResult, McpResource, McpResourceContent, McpSamplingMessage, McpSamplingRequest, McpSamplingResponse, McpServer, MessageSendConfig, Part, SendMessageResult, Task, TaskState, TaskStatus, agentMessage, extractText, taskText, textMessage, userMessage } from './mcp.cjs';
10
+ export { ToolExample, ToolRegistry, ToolRegistryEntry, ToolSearchResult, ToolValidator } from './tools.cjs';
11
+ export { version } from 'gauss-napi';
12
+
13
+ /**
14
+ * Model Constants — Single Source of Truth
15
+ *
16
+ * Update these when new model versions are released.
17
+ * All examples, tests, and defaults reference this file.
18
+ */
19
+ declare const OPENAI_DEFAULT = "gpt-5.2";
20
+ declare const OPENAI_FAST = "gpt-4.1";
21
+ declare const OPENAI_REASONING = "o4-mini";
22
+ declare const OPENAI_IMAGE = "gpt-image-1";
23
+ declare const ANTHROPIC_DEFAULT = "claude-sonnet-4-20250514";
24
+ declare const ANTHROPIC_FAST = "claude-haiku-4-20250414";
25
+ declare const ANTHROPIC_PREMIUM = "claude-opus-4-20250414";
26
+ declare const GOOGLE_DEFAULT = "gemini-2.5-flash";
27
+ declare const GOOGLE_PREMIUM = "gemini-2.5-pro";
28
+ declare const GOOGLE_IMAGE = "gemini-2.0-flash";
29
+ declare const OPENROUTER_DEFAULT = "openai/gpt-5.2";
30
+ declare const DEEPSEEK_DEFAULT = "deepseek-chat";
31
+ declare const DEEPSEEK_REASONING = "deepseek-reasoner";
32
+ declare const TOGETHER_DEFAULT = "meta-llama/Llama-3.3-70B-Instruct-Turbo";
33
+ declare const FIREWORKS_DEFAULT = "accounts/fireworks/models/llama-v3p1-70b-instruct";
34
+ declare const MISTRAL_DEFAULT = "mistral-large-latest";
35
+ declare const PERPLEXITY_DEFAULT = "sonar-pro";
36
+ declare const XAI_DEFAULT = "grok-3-beta";
37
+ declare const PROVIDER_DEFAULTS: Record<string, string>;
38
+ /** Get the default model for a provider */
39
+ declare function defaultModel(provider: string): string;
40
+
41
+ interface EnterprisePresetOptions extends AgentConfig {
42
+ retries?: number;
43
+ }
44
+ /**
45
+ * Plug-and-play enterprise preset with production-safe defaults.
46
+ */
47
+ declare function enterprisePreset(config?: EnterprisePresetOptions): Agent;
48
+ /**
49
+ * One-liner enterprise run helper.
50
+ */
51
+ declare function enterpriseRun(prompt: string, config?: EnterprisePresetOptions): Promise<string>;
52
+
53
+ declare class ApprovalManager implements Disposable {
54
+ private readonly _handle;
55
+ private disposed;
56
+ constructor();
57
+ get handle(): Handle;
58
+ request(toolName: string, args: Record<string, unknown>, sessionId: string): string;
59
+ approve(requestId: string, modifiedArgs?: Record<string, unknown>): void;
60
+ deny(requestId: string, reason?: string): void;
61
+ listPending(): unknown;
62
+ destroy(): void;
63
+ [Symbol.dispose](): void;
64
+ private assertNotDisposed;
65
+ }
66
+
67
+ declare class CheckpointStore implements Disposable {
68
+ private readonly _handle;
69
+ private disposed;
70
+ constructor();
71
+ get handle(): Handle;
72
+ save(checkpoint: Record<string, unknown>): Promise<void>;
73
+ load(checkpointId: string): Promise<unknown>;
74
+ loadLatest(sessionId: string): Promise<unknown>;
75
+ destroy(): void;
76
+ [Symbol.dispose](): void;
77
+ private assertNotDisposed;
78
+ }
79
+
80
+ declare class EvalRunner implements Disposable {
81
+ private readonly _handle;
82
+ private disposed;
83
+ constructor(threshold?: number);
84
+ get handle(): Handle;
85
+ addScorer(scorerType: EvalScorerType): this;
86
+ destroy(): void;
87
+ [Symbol.dispose](): void;
88
+ private assertNotDisposed;
89
+ static loadDatasetJsonl(jsonl: string): unknown;
90
+ static loadDatasetJson(jsonStr: string): unknown;
91
+ }
92
+
93
+ declare class Telemetry implements Disposable {
94
+ private readonly _handle;
95
+ private disposed;
96
+ constructor();
97
+ get handle(): Handle;
98
+ /** Record a span. Pass a SpanRecord object or use the convenience overload. */
99
+ recordSpan(span: Record<string, unknown>): void;
100
+ recordSpan(name: string, durationMs: number, attributes?: Record<string, unknown>): void;
101
+ exportSpans(): unknown;
102
+ exportMetrics(): unknown;
103
+ clear(): void;
104
+ destroy(): void;
105
+ [Symbol.dispose](): void;
106
+ private assertNotDisposed;
107
+ }
108
+
109
+ /**
110
+ * Create a fallback provider that tries providers in order.
111
+ * Returns a provider handle usable with Agent constructor.
112
+ */
113
+ declare function createFallbackProvider(providerHandles: Handle[]): Handle;
114
+ /**
115
+ * Wrap a provider with a circuit breaker.
116
+ * Returns a provider handle usable with Agent constructor.
117
+ */
118
+ declare function createCircuitBreaker(providerHandle: Handle, failureThreshold?: number, recoveryTimeoutMs?: number): Handle;
119
+ /**
120
+ * Create a resilient provider with retry, circuit breaker, and fallbacks.
121
+ * Returns a provider handle usable with Agent constructor.
122
+ */
123
+ declare function createResilientProvider(primaryHandle: Handle, fallbackHandles: Handle[], enableCircuitBreaker?: boolean): Handle;
124
+ /**
125
+ * Convenience: create a resilient agent by wrapping its provider.
126
+ */
127
+ declare function createResilientAgent(primary: Agent, fallbacks: Agent[], enableCircuitBreaker?: boolean): Handle;
128
+
129
+ declare function countTokens(text: string): number;
130
+ declare function countTokensForModel(text: string, model: string): number;
131
+ declare function countMessageTokens(messages: JsMessage[]): number;
132
+ declare function getContextWindowSize(model: string): number;
133
+ declare function estimateCost(model: string, usage: {
134
+ inputTokens: number;
135
+ outputTokens: number;
136
+ reasoningTokens?: number;
137
+ cacheReadTokens?: number;
138
+ cacheCreationTokens?: number;
139
+ }): CostEstimate;
140
+
141
+ declare function parseAgentConfig(jsonStr: string): string;
142
+ declare function resolveEnv(value: string): string;
143
+
144
+ declare function parsePartialJson(text: string): string | null;
145
+
146
+ /**
147
+ * Retry utilities — exponential backoff and configurable retry logic.
148
+ *
149
+ * @example
150
+ * import { withRetry, RetryConfig } from "gauss-ts";
151
+ *
152
+ * const result = await withRetry(() => agent.run("Hello"), {
153
+ * maxRetries: 3,
154
+ * backoff: "exponential",
155
+ * });
156
+ *
157
+ * // Or wrap an agent:
158
+ * const resilientRun = retryable(agent, { maxRetries: 5 });
159
+ * const result = await resilientRun("Hello");
160
+ */
161
+
162
+ interface RetryConfig {
163
+ /** Maximum number of retry attempts (default: 3). */
164
+ maxRetries?: number;
165
+ /** Backoff strategy (default: "exponential"). */
166
+ backoff?: "fixed" | "linear" | "exponential";
167
+ /** Base delay in ms (default: 1000). */
168
+ baseDelayMs?: number;
169
+ /** Maximum delay in ms (default: 30000). */
170
+ maxDelayMs?: number;
171
+ /** Jitter factor 0–1 (default: 0.1). Adds randomness to prevent thundering herd. */
172
+ jitter?: number;
173
+ /** Optional predicate — retry only if this returns true for the error. */
174
+ retryIf?: (error: Error, attempt: number) => boolean;
175
+ /** Called on each retry attempt, useful for logging. */
176
+ onRetry?: (error: Error, attempt: number, delayMs: number) => void;
177
+ }
178
+ /**
179
+ * Execute an async function with retry logic.
180
+ *
181
+ * @example
182
+ * const data = await withRetry(async () => {
183
+ * return await agent.run("Summarize this article");
184
+ * }, { maxRetries: 3, backoff: "exponential" });
185
+ */
186
+ declare function withRetry<T>(fn: () => Promise<T>, config?: RetryConfig): Promise<T>;
187
+ /**
188
+ * Wrap an agent's run method with retry logic. Returns a function
189
+ * that accepts a prompt and returns an AgentResult.
190
+ *
191
+ * @example
192
+ * const run = retryable(agent, { maxRetries: 5 });
193
+ * const result = await run("Hello");
194
+ */
195
+ declare function retryable(agent: Agent, config?: RetryConfig): (prompt: string | Message[]) => Promise<AgentResult>;
196
+
197
+ /**
198
+ * Structured Output — validate and extract typed JSON from LLM responses.
199
+ *
200
+ * @example
201
+ * import { structured, zodSchema } from "gauss-ts";
202
+ *
203
+ * const result = await structured(agent, "List 3 fruits", {
204
+ * schema: { type: "object", properties: { fruits: { type: "array", items: { type: "string" } } } },
205
+ * });
206
+ * console.log(result.data.fruits); // ["apple", "banana", "cherry"]
207
+ */
208
+
209
+ /** JSON Schema subset for structured output. */
210
+ interface JsonSchema {
211
+ type: string;
212
+ properties?: Record<string, JsonSchema>;
213
+ items?: JsonSchema;
214
+ required?: string[];
215
+ enum?: unknown[];
216
+ description?: string;
217
+ [key: string]: unknown;
218
+ }
219
+ interface StructuredConfig {
220
+ /** JSON schema the output must conform to. */
221
+ schema: JsonSchema;
222
+ /** Maximum parse retries if the model returns invalid JSON (default: 2). */
223
+ maxParseRetries?: number;
224
+ /** If true, include the raw AgentResult alongside parsed data. */
225
+ includeRaw?: boolean;
226
+ }
227
+ interface StructuredResult<T = unknown> {
228
+ /** Parsed and validated data. */
229
+ data: T;
230
+ /** Raw agent result (only if includeRaw was true). */
231
+ raw?: AgentResult;
232
+ }
233
+ /**
234
+ * Run an agent with structured output extraction.
235
+ *
236
+ * Automatically instructs the model to output JSON matching the schema,
237
+ * extracts and parses the JSON from the response, and retries on parse failure.
238
+ *
239
+ * @example
240
+ * const { data } = await structured(agent, "List 3 programming languages", {
241
+ * schema: {
242
+ * type: "object",
243
+ * properties: {
244
+ * languages: { type: "array", items: { type: "string" } }
245
+ * },
246
+ * required: ["languages"]
247
+ * }
248
+ * });
249
+ * console.log(data.languages);
250
+ */
251
+ declare function structured<T = unknown>(agent: Agent, prompt: string | Message[], config: StructuredConfig): Promise<StructuredResult<T>>;
252
+
253
+ /**
254
+ * Prompt Templates — composable, type-safe prompt construction.
255
+ *
256
+ * @example
257
+ * import { template, PromptTemplate } from "gauss-ts";
258
+ *
259
+ * const summarize = template("Summarize the following {{format}}:\n\n{{text}}");
260
+ * const prompt = summarize({ format: "article", text: "Lorem ipsum..." });
261
+ *
262
+ * // Composition:
263
+ * const withTone = template("{{base}}\n\nUse a {{tone}} tone.");
264
+ * const prompt = withTone({
265
+ * base: summarize({ format: "article", text: "..." }),
266
+ * tone: "professional",
267
+ * });
268
+ */
269
+ /** Extract variable names from a template string. */
270
+ type ExtractVars<T extends string> = T extends `${string}{{${infer Var}}}${infer Rest}` ? Var | ExtractVars<Rest> : never;
271
+ /** Variables object for a template. */
272
+ type TemplateVars<T extends string> = Record<ExtractVars<T>, string>;
273
+ /** A compiled prompt template function. */
274
+ interface PromptTemplate<T extends string = string> {
275
+ /** Render the template with variables. */
276
+ (vars: TemplateVars<T>): string;
277
+ /** The raw template string. */
278
+ readonly raw: string;
279
+ /** List of variable names in the template. */
280
+ readonly variables: string[];
281
+ }
282
+ /**
283
+ * Create a reusable prompt template with `{{variable}}` placeholders.
284
+ *
285
+ * @example
286
+ * const t = template("Hello {{name}}, you are {{age}} years old.");
287
+ * t({ name: "Alice", age: "30" }); // "Hello Alice, you are 30 years old."
288
+ * t.variables; // ["name", "age"]
289
+ */
290
+ declare function template<T extends string>(templateStr: T): PromptTemplate<T>;
291
+ /** Summarization template. */
292
+ declare const summarize: PromptTemplate<"Summarize the following {{format}} in {{style}}:\n\n{{text}}">;
293
+ /** Translation template. */
294
+ declare const translate: PromptTemplate<"Translate the following text to {{language}}:\n\n{{text}}">;
295
+ /** Code review template. */
296
+ declare const codeReview: PromptTemplate<"Review this {{language}} code for bugs, security issues, and best practices:\n\n```{{language}}\n{{code}}\n```">;
297
+ /** Classification template. */
298
+ declare const classify: PromptTemplate<"Classify the following text into one of these categories: {{categories}}\n\nText: {{text}}\n\nRespond with only the category name.">;
299
+ /** Extraction template. */
300
+ declare const extract: PromptTemplate<"Extract the following information from the text: {{fields}}\n\nText: {{text}}\n\nRespond as JSON.">;
301
+
302
+ /**
303
+ * AGENTS.MD and SKILL.MD parsers — parse agent/skill specifications from markdown.
304
+ *
305
+ * @example
306
+ * ```ts
307
+ * import { AgentSpec, SkillSpec, discoverAgents } from "gauss-ts";
308
+ *
309
+ * // Parse a single AGENTS.MD
310
+ * const spec = AgentSpec.fromMarkdown(content);
311
+ * console.log(spec.name, spec.tools);
312
+ *
313
+ * // Discover all agents in a directory tree
314
+ * const agents = await discoverAgents("./agents");
315
+ *
316
+ * // Parse a SKILL.MD
317
+ * const skill = SkillSpec.fromMarkdown(skillContent);
318
+ * console.log(skill.steps);
319
+ * ```
320
+ */
321
+ /** Tool reference within an AGENTS.MD spec. */
322
+ interface AgentToolSpec {
323
+ name: string;
324
+ description: string;
325
+ parameters?: Record<string, unknown>;
326
+ }
327
+ /** Parsed agent specification from AGENTS.MD. */
328
+ interface AgentSpecData {
329
+ name: string;
330
+ description: string;
331
+ model?: string;
332
+ provider?: string;
333
+ instructions?: string;
334
+ tools: AgentToolSpec[];
335
+ skills: string[];
336
+ capabilities: string[];
337
+ environment: Array<[string, string]>;
338
+ metadata: Record<string, unknown>;
339
+ }
340
+ /** Step within a SKILL.MD spec. */
341
+ interface SkillStep {
342
+ description: string;
343
+ action?: string;
344
+ }
345
+ /** Input or output parameter in a SKILL.MD spec. */
346
+ interface SkillParam {
347
+ name: string;
348
+ param_type: string;
349
+ description: string;
350
+ required: boolean;
351
+ }
352
+ /** Parsed skill specification from SKILL.MD. */
353
+ interface SkillSpecData {
354
+ name: string;
355
+ description: string;
356
+ steps: SkillStep[];
357
+ inputs: SkillParam[];
358
+ outputs: SkillParam[];
359
+ }
360
+ /** Immutable parsed AGENTS.MD specification with a fluent API. */
361
+ declare class AgentSpec {
362
+ readonly name: string;
363
+ readonly description: string;
364
+ readonly model?: string;
365
+ readonly provider?: string;
366
+ readonly instructions?: string;
367
+ readonly tools: readonly AgentToolSpec[];
368
+ readonly skills: readonly string[];
369
+ readonly capabilities: readonly string[];
370
+ readonly environment: ReadonlyMap<string, string>;
371
+ readonly metadata: Readonly<Record<string, unknown>>;
372
+ private constructor();
373
+ /** Parse an AGENTS.MD markdown string into an AgentSpec. */
374
+ static fromMarkdown(content: string): AgentSpec;
375
+ /** Check whether a specific tool is declared in this spec. */
376
+ hasTool(name: string): boolean;
377
+ /** Check whether a specific capability is declared. */
378
+ hasCapability(name: string): boolean;
379
+ /** Serialize back to a plain object. */
380
+ toJSON(): AgentSpecData;
381
+ }
382
+ /** Immutable parsed SKILL.MD specification with a fluent API. */
383
+ declare class SkillSpec {
384
+ readonly name: string;
385
+ readonly description: string;
386
+ readonly steps: readonly SkillStep[];
387
+ readonly inputs: readonly SkillParam[];
388
+ readonly outputs: readonly SkillParam[];
389
+ private constructor();
390
+ /** Parse a SKILL.MD markdown string into a SkillSpec. */
391
+ static fromMarkdown(content: string): SkillSpec;
392
+ /** Get the total number of steps. */
393
+ get stepCount(): number;
394
+ /** Get all required inputs. */
395
+ get requiredInputs(): readonly SkillParam[];
396
+ /** Serialize back to a plain object. */
397
+ toJSON(): SkillSpecData;
398
+ }
399
+ /** Discover all AGENTS.MD files in a directory tree and parse them. */
400
+ declare function discoverAgents(dir: string): AgentSpec[];
401
+
402
+ /**
403
+ * Pipeline — compose agent operations into clean data flows.
404
+ *
405
+ * @example
406
+ * import { pipe, map, filter, tap } from "gauss-ts";
407
+ *
408
+ * const result = await pipe(
409
+ * ["apple", "banana", "cherry"],
410
+ * map(fruit => agent.run(`Describe ${fruit}`)),
411
+ * filter(r => r.text.length > 50),
412
+ * tap(r => console.log(r.text)),
413
+ * );
414
+ */
415
+ /** An async transform step in a pipeline. */
416
+ type PipeStep<I, O> = (input: I) => Promise<O> | O;
417
+ /**
418
+ * Compose async operations into a pipeline.
419
+ *
420
+ * @example
421
+ * const result = await pipe(
422
+ * "Hello",
423
+ * (s) => agent.run(s),
424
+ * (r) => r.text.toUpperCase(),
425
+ * );
426
+ */
427
+ declare function pipe<A>(input: A): Promise<A>;
428
+ declare function pipe<A, B>(input: A, s1: PipeStep<A, B>): Promise<B>;
429
+ declare function pipe<A, B, C>(input: A, s1: PipeStep<A, B>, s2: PipeStep<B, C>): Promise<C>;
430
+ declare function pipe<A, B, C, D>(input: A, s1: PipeStep<A, B>, s2: PipeStep<B, C>, s3: PipeStep<C, D>): Promise<D>;
431
+ declare function pipe<A, B, C, D, E>(input: A, s1: PipeStep<A, B>, s2: PipeStep<B, C>, s3: PipeStep<C, D>, s4: PipeStep<D, E>): Promise<E>;
432
+ /**
433
+ * Map an async function over an array with concurrency control.
434
+ *
435
+ * @example
436
+ * const results = await mapAsync(
437
+ * ["a", "b", "c"],
438
+ * (item) => agent.run(item),
439
+ * { concurrency: 2 }
440
+ * );
441
+ */
442
+ declare function mapAsync<T, R>(items: T[], fn: (item: T, index: number) => Promise<R>, options?: {
443
+ concurrency?: number;
444
+ }): Promise<R[]>;
445
+ /**
446
+ * Filter items using an async predicate with concurrency control.
447
+ *
448
+ * @example
449
+ * const valid = await filterAsync(items, async (item) => {
450
+ * const result = await agent.run(`Is "${item}" valid?`);
451
+ * return result.text.includes("yes");
452
+ * });
453
+ */
454
+ declare function filterAsync<T>(items: T[], predicate: (item: T, index: number) => Promise<boolean>, options?: {
455
+ concurrency?: number;
456
+ }): Promise<T[]>;
457
+ /**
458
+ * Reduce items using an async reducer (sequential).
459
+ *
460
+ * @example
461
+ * const summary = await reduceAsync(
462
+ * documents,
463
+ * async (acc, doc) => {
464
+ * const result = await agent.run(`Combine: ${acc}\n\nNew: ${doc}`);
465
+ * return result.text;
466
+ * },
467
+ * ""
468
+ * );
469
+ */
470
+ declare function reduceAsync<T, R>(items: T[], reducer: (accumulator: R, item: T, index: number) => Promise<R>, initial: R): Promise<R>;
471
+ /**
472
+ * Execute a side-effect for each item (sequential). Returns input unchanged.
473
+ * Useful in pipelines for logging or monitoring.
474
+ *
475
+ * @example
476
+ * await tapAsync(results, async (r) => console.log(r.text));
477
+ */
478
+ declare function tapAsync<T>(items: T[], fn: (item: T, index: number) => Promise<void> | void): Promise<T[]>;
479
+ /**
480
+ * Compose multiple middleware-style functions into one.
481
+ *
482
+ * @example
483
+ * const enhance = compose(
484
+ * async (text) => `[System] ${text}`,
485
+ * async (text) => text.trim(),
486
+ * );
487
+ * const result = await enhance(" hello ");
488
+ * // → "[System] hello"
489
+ */
490
+ declare function compose<T>(...fns: PipeStep<T, T>[]): PipeStep<T, T>;
491
+
492
+ export { ANTHROPIC_DEFAULT, ANTHROPIC_FAST, ANTHROPIC_PREMIUM, Agent, AgentConfig, AgentResult, AgentSpec, type AgentSpecData, type AgentToolSpec, ApprovalManager, CheckpointStore, CostEstimate, DEEPSEEK_DEFAULT, DEEPSEEK_REASONING, Disposable, type EnterprisePresetOptions, EvalRunner, EvalScorerType, FIREWORKS_DEFAULT, GOOGLE_DEFAULT, GOOGLE_IMAGE, GOOGLE_PREMIUM, Handle, JsMessage, type JsonSchema, MISTRAL_DEFAULT, Message, OPENAI_DEFAULT, OPENAI_FAST, OPENAI_IMAGE, OPENAI_REASONING, OPENROUTER_DEFAULT, PERPLEXITY_DEFAULT, PROVIDER_DEFAULTS, type PipeStep, type PromptTemplate, type RetryConfig, type SkillParam, SkillSpec, type SkillSpecData, type SkillStep, type StructuredConfig, type StructuredResult, TOGETHER_DEFAULT, Telemetry, XAI_DEFAULT, classify, codeReview, compose, countMessageTokens, countTokens, countTokensForModel, createCircuitBreaker, createFallbackProvider, createResilientAgent, createResilientProvider, defaultModel, discoverAgents, enterprisePreset, enterpriseRun, estimateCost, extract, filterAsync, getContextWindowSize, mapAsync, parseAgentConfig, parsePartialJson, pipe, reduceAsync, resolveEnv, retryable, structured, summarize, tapAsync, template, translate, withRetry };