@axiom-lattice/core 2.1.98 → 2.1.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { HumanMessage } from '@langchain/core/messages';
4
4
  import { ZodType } from 'zod/v3';
5
5
  import { $ZodType } from 'zod/v4/core';
6
6
  import { BaseChatModel, BaseChatModelCallOptions } from '@langchain/core/language_models/chat_models';
7
- import { BaseLanguageModelInput, LanguageModelLike, BaseLanguageModel } from '@langchain/core/language_models/base';
7
+ import { BaseLanguageModelInput, LanguageModelLike } from '@langchain/core/language_models/base';
8
8
  import { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
9
9
  import { ChatResult } from '@langchain/core/outputs';
10
10
  import * as _axiom_lattice_protocols from '@axiom-lattice/protocols';
@@ -12,7 +12,7 @@ import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult,
12
12
  export { _axiom_lattice_protocols as Protocols };
13
13
  export { AgentConfig, AgentType, GraphBuildOptions, MemoryType } from '@axiom-lattice/protocols';
14
14
  import * as langchain from 'langchain';
15
- import { ReactAgent, AgentMiddleware, StructuredTool as StructuredTool$1, InterruptOnConfig } from 'langchain';
15
+ import { ReactAgent, AgentMiddleware } from 'langchain';
16
16
  import z, { z as z$1 } from 'zod';
17
17
  import { BaseStore, BaseCheckpointSaver } from '@langchain/langgraph-checkpoint';
18
18
  import * as _langchain_core_tools from '@langchain/core/tools';
@@ -27,8 +27,7 @@ import { Connection, MultiServerMCPClient } from '@langchain/mcp-adapters';
27
27
  import { SandboxClient } from '@agent-infra/sandbox';
28
28
  import { Sandbox } from 'e2b';
29
29
  import { Sandbox as Sandbox$1 } from '@daytonaio/sdk';
30
- import { Runnable, RunnableConfig } from '@langchain/core/runnables';
31
- import { InteropZodObject } from '@langchain/core/utils/types';
30
+ import { RunnableConfig } from '@langchain/core/runnables';
32
31
 
33
32
  /**
34
33
  * BaseLatticeManager - 抽象基类,为各种Lattice管理器提供通用功能
@@ -1737,6 +1736,19 @@ interface AgentBuildParams {
1737
1736
  declare class AgentLatticeManager extends BaseLatticeManager<AgentLattice> {
1738
1737
  private static _instance;
1739
1738
  private initialized;
1739
+ /**
1740
+ * Tracks in-flight agent builds so concurrent callers share a single
1741
+ * build promise (single-flight dedup).
1742
+ */
1743
+ private buildingKeys;
1744
+ /**
1745
+ * Async-local stack of agent keys currently being built in this async
1746
+ * context. A re-entrant build of a key already on the stack is a true
1747
+ * circular reference (A builds B builds A) and must fail fast — distinct
1748
+ * from concurrent independent callers, which are deduplicated via
1749
+ * {@link buildingKeys}.
1750
+ */
1751
+ private buildContext;
1740
1752
  /**
1741
1753
  * 从store异步加载单个AgentLattice
1742
1754
  * 实现BaseLatticeManager的可选方法,支持从assistant store加载单个agent
@@ -4641,6 +4653,11 @@ declare class LocalSandboxProvider implements SandboxProvider {
4641
4653
  createResourceAddress: typeof createResourceAddress;
4642
4654
  }
4643
4655
 
4656
+ /**
4657
+ * Known sandbox provider types, with support for custom string values
4658
+ * registered by external consumers via {@link registerSandboxProviderType}.
4659
+ */
4660
+ type SandboxProviderType = "microsandbox-remote" | "remote" | "e2b" | "daytona" | "local" | string;
4644
4661
  interface CreateSandboxProviderConfig {
4645
4662
  /**
4646
4663
  * Provider type
@@ -4650,7 +4667,7 @@ interface CreateSandboxProviderConfig {
4650
4667
  * - "daytona": Daytona cloud sandbox (https://daytona.io)
4651
4668
  * - "local": Local sandbox using host filesystem and shell (no Docker required)
4652
4669
  */
4653
- type: "microsandbox-remote" | "remote" | "e2b" | "daytona" | "local";
4670
+ type: SandboxProviderType;
4654
4671
  /**
4655
4672
  * Required when type = "remote"
4656
4673
  */
@@ -4709,10 +4726,56 @@ interface CreateSandboxProviderConfig {
4709
4726
  localSandboxBasePath?: string;
4710
4727
  }
4711
4728
  /**
4712
- * Factory function for creating different sandbox provider implementations.
4729
+ * Factory function signature for creating a {@link SandboxProvider} from
4730
+ * a configuration object.
4731
+ */
4732
+ type SandboxProviderFactory = (config: CreateSandboxProviderConfig) => SandboxProvider;
4733
+ /**
4734
+ * Register a custom sandbox provider type at runtime.
4735
+ *
4736
+ * Allows external applications to provide their own provider implementations
4737
+ * without modifying the core package. Built-in types ("remote",
4738
+ * "microsandbox-remote", "e2b", "daytona", "local") are registered
4739
+ * automatically at module load time.
4740
+ *
4741
+ * @param type - The provider type string (e.g. "my-cloud-sandbox")
4742
+ * @param factory - Factory function that receives the full config and returns a SandboxProvider
4743
+ *
4744
+ * @example
4745
+ * ```ts
4746
+ * registerSandboxProviderType("my-cloud", (config) => new MyCloudProvider(config));
4747
+ * ```
4748
+ *
4749
+ * @remarks
4750
+ * - Registration must happen before any call to {@link createSandboxProvider} for that type.
4751
+ * - Re-registering the same type will overwrite the previous factory without warning.
4752
+ */
4753
+ declare function registerSandboxProviderType(type: string, factory: SandboxProviderFactory): void;
4754
+ /**
4755
+ * List all currently registered sandbox provider type strings.
4713
4756
  *
4714
- * This allows runtime selection of the sandbox backend without changing
4715
- * consumer code. New provider types can be added here as they are implemented.
4757
+ * @returns An array of registered provider type names.
4758
+ */
4759
+ declare function listSandboxProviderTypes(): string[];
4760
+ /**
4761
+ * Create a sandbox provider from a configuration object.
4762
+ *
4763
+ * This is the main entry point for obtaining a sandbox provider instance.
4764
+ * The provider type is resolved from the registry; built-in types are
4765
+ * always available, and custom types can be added via
4766
+ * {@link registerSandboxProviderType}.
4767
+ *
4768
+ * @param config - Provider configuration specifying the type and any
4769
+ * type-specific parameters (API keys, base URLs, etc.).
4770
+ * @returns A fully initialized {@link SandboxProvider} instance.
4771
+ * @throws {Error} If the requested type is not found in the registry, with a
4772
+ * message listing all available types.
4773
+ *
4774
+ * @example
4775
+ * ```ts
4776
+ * const provider = createSandboxProvider({ type: "local" });
4777
+ * const sandbox = await provider.createSandbox("demo", { ... });
4778
+ * ```
4716
4779
  */
4717
4780
  declare function createSandboxProvider(config: CreateSandboxProviderConfig): SandboxProvider;
4718
4781
 
@@ -5022,6 +5085,343 @@ declare function setBindingRegistry(r: BindingRegistry): void;
5022
5085
  */
5023
5086
  declare function getBindingRegistry(): BindingRegistry;
5024
5087
 
5088
+ /**
5089
+ * Service contract for controlling evaluation runs.
5090
+ *
5091
+ * The gateway layer implements this interface and registers it via
5092
+ * {@link setEvalRunService} so that agent tools (e.g., `run_eval`) can
5093
+ * start, abort, and monitor evaluation runs without knowing the
5094
+ * underlying run-time infrastructure.
5095
+ *
5096
+ * @see {@link setEvalRunService}
5097
+ * @see {@link getEvalRunService}
5098
+ */
5099
+ interface EvalRunService {
5100
+ /**
5101
+ * Start a new evaluation run for the given project.
5102
+ *
5103
+ * @param tenantId - Tenant that owns the project
5104
+ * @param projectId - Project to evaluate
5105
+ * @returns The newly created run ID
5106
+ */
5107
+ startRun(tenantId: string, projectId: string): Promise<string>;
5108
+ /**
5109
+ * Abort a running evaluation.
5110
+ *
5111
+ * @param runId - The run to abort
5112
+ * @returns `true` if the run was successfully aborted
5113
+ */
5114
+ abortRun(runId: string): Promise<boolean>;
5115
+ /**
5116
+ * Check whether a run's runner process is still alive.
5117
+ *
5118
+ * @param runId - The run to check
5119
+ * @returns `true` if the runner process is still active
5120
+ */
5121
+ isRunning(runId: string): boolean;
5122
+ }
5123
+ /**
5124
+ * Sets the global {@link EvalRunService} instance used by agent evaluation tools.
5125
+ *
5126
+ * The service enables the `run_eval` tool to start, abort, and monitor evaluation
5127
+ * runs. This must be called **at gateway startup** before any agent invocation that
5128
+ * expects `run_eval` to be functional.
5129
+ *
5130
+ * @example
5131
+ * ```ts
5132
+ * import { setEvalRunService } from "@axiom-lattice/core";
5133
+ *
5134
+ * const evalSvc: EvalRunService = {
5135
+ * startRun: async (tid, pid) => { ... },
5136
+ * abortRun: async (rid) => { ... },
5137
+ * isRunning: (rid) => { ... },
5138
+ * };
5139
+ * setEvalRunService(evalSvc);
5140
+ * ```
5141
+ *
5142
+ * @param s - An {@link EvalRunService} implementation
5143
+ * @see {@link getEvalRunService}
5144
+ */
5145
+ declare function setEvalRunService(s: EvalRunService): void;
5146
+ /**
5147
+ * Returns the globally registered {@link EvalRunService}.
5148
+ *
5149
+ * Must be called **after** {@link setEvalRunService}. Used by the `run_eval`
5150
+ * tool to start, abort, and monitor evaluation runs.
5151
+ *
5152
+ * @returns The active {@link EvalRunService} instance
5153
+ * @throws {Error} If the service has not been initialized
5154
+ * @see {@link setEvalRunService}
5155
+ */
5156
+ declare function getEvalRunService(): EvalRunService;
5157
+ /**
5158
+ * Resets the global {@link EvalRunService} to `null`.
5159
+ *
5160
+ * Restricted to the `test` environment for test isolation only. Production
5161
+ * code must never call this function.
5162
+ *
5163
+ * @throws {Error} If `NODE_ENV` is not `"test"`
5164
+ * @see {@link setEvalRunService}
5165
+ */
5166
+ declare function clearEvalRunService(): void;
5167
+
5168
+ interface LatticeAgentStepConfig {
5169
+ agent_id: string;
5170
+ override_message?: string;
5171
+ }
5172
+ type OutputType = {
5173
+ type: "message_content";
5174
+ };
5175
+ interface LatticeEvalProjectType {
5176
+ projectName: string;
5177
+ version?: string;
5178
+ description?: string;
5179
+ suites: LatticeEvalSuiteType[];
5180
+ templates?: LatticeEvalTemplate[];
5181
+ judge_agent_config: {
5182
+ modelKey: string;
5183
+ };
5184
+ lattice_server_config: {
5185
+ tenant_id?: string;
5186
+ };
5187
+ concurrency?: number;
5188
+ }
5189
+ type LatticeEvalLogLevel = "debug" | "info" | "warn" | "error";
5190
+ interface LatticeEvalLogEvent {
5191
+ ts: string;
5192
+ level: LatticeEvalLogLevel;
5193
+ message: string;
5194
+ data?: Record<string, unknown>;
5195
+ }
5196
+ interface LatticeEvalBatchReport {
5197
+ batch_id: string;
5198
+ started_at: string;
5199
+ finished_at: string;
5200
+ project: {
5201
+ projectName: string;
5202
+ version?: string;
5203
+ description?: string;
5204
+ };
5205
+ summary: {
5206
+ total_cases: number;
5207
+ passed_cases: number;
5208
+ failed_cases: number;
5209
+ pass_rate: number;
5210
+ };
5211
+ suites: Array<{
5212
+ suiteName: string;
5213
+ total_cases: number;
5214
+ passed_cases: number;
5215
+ failed_cases: number;
5216
+ cases: Array<{
5217
+ caseId: string;
5218
+ pass?: boolean;
5219
+ final_score?: number;
5220
+ error?: string;
5221
+ }>;
5222
+ }>;
5223
+ }
5224
+ type LatticeEvalCaseType = LatticeEvalCase | LatticeEvalCaseWithTemplate;
5225
+ interface LatticeEvalSuiteType {
5226
+ suiteName: string;
5227
+ version?: string;
5228
+ cases: LatticeEvalCaseType[];
5229
+ }
5230
+ interface LatticeEvalRubric {
5231
+ dimension: string;
5232
+ weight: number;
5233
+ description: string;
5234
+ }
5235
+ interface LatticeEvalCase {
5236
+ caseId: string;
5237
+ input: {
5238
+ message: string;
5239
+ files?: Record<string, string>;
5240
+ };
5241
+ steps: LatticeAgentStepConfig[];
5242
+ output: OutputType;
5243
+ eval: {
5244
+ content_assertion: string;
5245
+ eval_rubrics?: LatticeEvalRubric[];
5246
+ };
5247
+ }
5248
+ interface LatticeEvalCaseWithTemplate {
5249
+ caseId: string;
5250
+ templateId: string;
5251
+ input: {
5252
+ message?: string;
5253
+ files?: Record<string, string>;
5254
+ variables?: Record<string, string>;
5255
+ };
5256
+ output?: OutputType;
5257
+ eval: {
5258
+ content_assertion: string;
5259
+ eval_rubrics?: LatticeEvalRubric[];
5260
+ };
5261
+ }
5262
+ interface LatticeEvalTemplate {
5263
+ templateId: string;
5264
+ description?: string;
5265
+ input_schema: {
5266
+ required_files?: string[];
5267
+ variables?: string[];
5268
+ };
5269
+ default_case: Omit<LatticeEvalCase, "caseId" | "eval"> & {
5270
+ eval?: {
5271
+ eval_rubrics?: LatticeEvalRubric[];
5272
+ };
5273
+ };
5274
+ }
5275
+ interface LatticeEvalResult {
5276
+ pass: boolean;
5277
+ final_score: number;
5278
+ dimension_results: {
5279
+ name: string;
5280
+ score: number;
5281
+ reason: string;
5282
+ }[];
5283
+ summary: string;
5284
+ error?: string;
5285
+ }
5286
+ interface CaseRunResult {
5287
+ caseId: string;
5288
+ result?: LatticeEvalResult;
5289
+ error?: string;
5290
+ error_stack?: string;
5291
+ duration_ms?: number;
5292
+ thread_id?: string;
5293
+ judge_thread_id?: string;
5294
+ test_prompt?: string;
5295
+ final_output?: string;
5296
+ messages?: Array<{
5297
+ role: string;
5298
+ content: string;
5299
+ id?: string;
5300
+ }>;
5301
+ logs: LatticeEvalLogEvent[];
5302
+ }
5303
+
5304
+ /**
5305
+ * Configuration for Lattice evaluation.
5306
+ */
5307
+ interface LatticeEvalConfig {
5308
+ tenant_id?: string;
5309
+ /**
5310
+ * Key of the judge agent lattice to invoke for scoring.
5311
+ * Registered per-project by LatticeEvalProject.
5312
+ */
5313
+ judge_agent_key?: string;
5314
+ /**
5315
+ * When true, prints detailed execution logs for each action.
5316
+ * Defaults to true.
5317
+ */
5318
+ verbose?: boolean;
5319
+ }
5320
+ /**
5321
+ * LatticeEval class for evaluating Lattice evaluation cases.
5322
+ * Executes agents in-process via agentInstanceManager.
5323
+ */
5324
+ declare class LatticeEval {
5325
+ private config;
5326
+ private verbose;
5327
+ private inMemoryLogs;
5328
+ private lastThreadId?;
5329
+ private lastJudgeThreadId?;
5330
+ private lastTestPrompt?;
5331
+ private lastFinalOutput?;
5332
+ private lastDurationMs;
5333
+ private lastMessages;
5334
+ getLastRunMeta(): {
5335
+ duration_ms: number;
5336
+ thread_id: string | undefined;
5337
+ judge_thread_id: string | undefined;
5338
+ test_prompt: string | undefined;
5339
+ final_output: string | undefined;
5340
+ messages: {
5341
+ role: string;
5342
+ content: string;
5343
+ id?: string;
5344
+ }[];
5345
+ };
5346
+ constructor(config?: LatticeEvalConfig);
5347
+ getInMemoryLogs(): LatticeEvalLogEvent[];
5348
+ record(level: LatticeEvalLogLevel, message: string, data?: Record<string, unknown>): void;
5349
+ private log;
5350
+ private getKeyInfo;
5351
+ private buildFileEntries;
5352
+ private executeAgentStep;
5353
+ private extractFinalMessage;
5354
+ private static readonly TRAJECTORY_PER_MESSAGE_LIMIT;
5355
+ private static readonly TRAJECTORY_TOTAL_LIMIT;
5356
+ private buildTrajectory;
5357
+ evaluateCase(evalCase: LatticeEvalCase): Promise<LatticeEvalResult>;
5358
+ }
5359
+ /**
5360
+ * Evaluate a single Lattice evaluation case and always return logs (never throws).
5361
+ */
5362
+ declare function evaluateLatticeCaseWithLogs(evalCase: LatticeEvalCase, config?: LatticeEvalConfig): Promise<CaseRunResult>;
5363
+
5364
+ /**
5365
+ * Configuration resolved from project/suite hierarchy
5366
+ */
5367
+ interface ResolvedConfig {
5368
+ lattice_server_config: {
5369
+ tenant_id?: string;
5370
+ };
5371
+ judge_agent_config?: {
5372
+ modelKey?: string;
5373
+ agentKey?: string;
5374
+ };
5375
+ concurrency: number;
5376
+ }
5377
+ /**
5378
+ * LatticeEvalSuite class manages a suite of evaluation cases
5379
+ * with suite-level configuration
5380
+ */
5381
+ declare class LatticeEvalSuite {
5382
+ private suite;
5383
+ private projectConfig;
5384
+ private templates;
5385
+ private onCaseComplete?;
5386
+ constructor(suite: LatticeEvalSuiteType, projectConfig: ResolvedConfig, templates?: Map<string, LatticeEvalTemplate>, onCaseComplete?: (result: CaseRunResult, suiteName: string) => void | Promise<void>);
5387
+ private getResolvedConfig;
5388
+ private buildEvalConfig;
5389
+ getSuiteName(): string;
5390
+ getVersion(): string | undefined;
5391
+ getCases(): LatticeEvalCase[];
5392
+ getCase(caseId: string): LatticeEvalCase | undefined;
5393
+ runCase(caseId: string): Promise<CaseRunResult>;
5394
+ runAllCases(concurrency?: number, signal?: AbortSignal): Promise<CaseRunResult[]>;
5395
+ }
5396
+
5397
+ /**
5398
+ * Manages a project with multiple evaluation suites.
5399
+ * Registers a per-project judge agent (keyed by project name and tenant)
5400
+ * to avoid cross-project contamination of the judge's model.
5401
+ */
5402
+ declare class LatticeEvalProject {
5403
+ private project;
5404
+ private suites;
5405
+ private judgeAgentKey;
5406
+ constructor(project: LatticeEvalProjectType, onCaseComplete?: (result: CaseRunResult, suiteName: string) => void | Promise<void>);
5407
+ getProjectName(): string;
5408
+ getVersion(): string | undefined;
5409
+ getDescription(): string | undefined;
5410
+ getSuiteNames(): string[];
5411
+ getSuite(suiteName: string): LatticeEvalSuite | undefined;
5412
+ runCase(suiteName: string, caseId: string): Promise<CaseRunResult>;
5413
+ runSuite(suiteName: string, concurrency?: number, signal?: AbortSignal): Promise<CaseRunResult[]>;
5414
+ runAllSuites(concurrency?: number, signal?: AbortSignal): Promise<Map<string, CaseRunResult[]>>;
5415
+ /**
5416
+ * Run all suites as a batch and build an in-memory report.
5417
+ */
5418
+ runAllSuitesBatch(concurrency?: number, signal?: AbortSignal): Promise<{
5419
+ batch_id: string;
5420
+ results: Map<string, CaseRunResult[]>;
5421
+ report: LatticeEvalBatchReport;
5422
+ }>;
5423
+ }
5424
+
5025
5425
  declare function setMenuRegistry(r: MenuRegistry): void;
5026
5426
  declare function getMenuRegistry(): MenuRegistry;
5027
5427
 
@@ -6138,82 +6538,6 @@ declare function buildGrepResultsDict(matches: GrepMatch[]): Record<string, Arra
6138
6538
  */
6139
6539
  declare function formatGrepMatches(matches: GrepMatch[], outputMode: "files_with_matches" | "content" | "count"): string;
6140
6540
 
6141
- /**
6142
- * Type definitions for pre-compiled agents.
6143
- */
6144
- interface CompiledSubAgent {
6145
- /** The key of the agent */
6146
- key: string;
6147
- /** The name of the agent */
6148
- name: string;
6149
- /** The description of the agent */
6150
- description: string;
6151
- /** The agent instance */
6152
- runnable: AgentClient | Runnable;
6153
- }
6154
- /**
6155
- * Type definitions for subagents
6156
- */
6157
- interface SubAgent {
6158
- /** The key of the agent */
6159
- key: string;
6160
- /** The name of the agent */
6161
- name: string;
6162
- /** The description of the agent */
6163
- description: string;
6164
- /** The system prompt to use for the agent */
6165
- systemPrompt: string;
6166
- /** The tools to use for the agent (tool instances, not names). Defaults to defaultTools */
6167
- tools?: StructuredTool$1[];
6168
- /** The model for the agent. Defaults to default_model */
6169
- model?: LanguageModelLike | string;
6170
- /** Additional middleware to append after default_middleware */
6171
- middleware?: AgentMiddleware[];
6172
- /** The tool configs to use for the agent */
6173
- interruptOn?: Record<string, boolean | InterruptOnConfig>;
6174
- }
6175
-
6176
- interface SchedulerMiddlewareOptions {
6177
- defaultMaxRetries?: number;
6178
- }
6179
- declare function createSchedulerMiddleware(options?: SchedulerMiddlewareOptions): AgentMiddleware;
6180
-
6181
- interface TopologyEdge {
6182
- from: string;
6183
- to: string;
6184
- purpose: string;
6185
- }
6186
-
6187
- interface CreateProcessingAgentParams<ContextSchema extends AnnotationRoot<any> | InteropZodObject = AnnotationRoot<any>> {
6188
- model?: BaseLanguageModel | string;
6189
- tools?: StructuredTool[];
6190
- systemPrompt?: string;
6191
- middleware?: AgentMiddleware[];
6192
- subagents?: (SubAgent | CompiledSubAgent)[];
6193
- responseFormat?: any;
6194
- contextSchema?: ContextSchema;
6195
- checkpointer?: BaseCheckpointSaver | boolean;
6196
- store?: BaseStore;
6197
- backend?: BackendProtocol | ((config: {
6198
- state: unknown;
6199
- store?: BaseStore;
6200
- }) => Promise<BackendProtocol>);
6201
- interruptOn?: Record<string, boolean | InterruptOnConfig>;
6202
- name?: string;
6203
- skills?: string[];
6204
- topologyEdges: TopologyEdge[];
6205
- }
6206
- /**
6207
- * Create a Processing Agent with middleware-based architecture.
6208
- *
6209
- * Same as createDeepAgent, but replaces todoListMiddleware with
6210
- * topologyMiddleware for workflow topology enforcement.
6211
- *
6212
- * @param params Configuration parameters for the agent
6213
- * @returns ReactAgent instance ready for invocation
6214
- */
6215
- declare function createProcessingAgent<ContextSchema extends AnnotationRoot<any> | InteropZodObject = AnnotationRoot<any>>(params: CreateProcessingAgentParams<ContextSchema>): ReactAgent<any, any, ContextSchema, any>;
6216
-
6217
6541
  /**
6218
6542
  * Event bus service
6219
6543
  * Used for event publishing and subscription between internal system components
@@ -6322,6 +6646,11 @@ interface QueueMessage {
6322
6646
  message?: string;
6323
6647
  id?: string;
6324
6648
  messages?: MessageLike[];
6649
+ files?: Record<string, {
6650
+ content: string[];
6651
+ created_at: string;
6652
+ modified_at: string;
6653
+ }>;
6325
6654
  };
6326
6655
  command?: CommandParams<any>;
6327
6656
  custom_run_config?: any;
@@ -7061,6 +7390,11 @@ interface UnknownToolHandlerConfig {
7061
7390
  */
7062
7391
  declare function createUnknownToolHandlerMiddleware(config?: UnknownToolHandlerConfig): AgentMiddleware;
7063
7392
 
7393
+ interface SchedulerMiddlewareOptions {
7394
+ defaultMaxRetries?: number;
7395
+ }
7396
+ declare function createSchedulerMiddleware(options?: SchedulerMiddlewareOptions): AgentMiddleware;
7397
+
7064
7398
  declare function createTaskMiddleware(): AgentMiddleware;
7065
7399
 
7066
7400
  type ResolveAgentFn = (ref?: string, responseFormat?: Record<string, unknown>, stepType?: string) => Promise<AgentClient>;
@@ -7127,8 +7461,7 @@ declare function createAgentNode(node: InternalAgentNode, resolveAgent: ResolveA
7127
7461
  * Create a handler for a `map` node.
7128
7462
  *
7129
7463
  * Reads the source array from state, batches items, processes each
7130
- * item through the inner agent in parallel (with concurrency control),
7131
- * and optionally calls a reduce agent to aggregate results.
7464
+ * item through the inner agent in parallel (with concurrency control).
7132
7465
  */
7133
7466
  declare function createMapNode(node: InternalMapNode, resolveAgent: ResolveAgentFn, trackingStore?: WorkflowTrackingStore): (state: Record<string, unknown>, config?: RunnableConfig) => Promise<Partial<Record<string, unknown>>>;
7134
7467
  /**
@@ -7185,6 +7518,18 @@ declare function parseYaml(yamlStr: string): InternalDSL;
7185
7518
  */
7186
7519
  declare function toJsonSchema(fields: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
7187
7520
 
7521
+ /**
7522
+ * Lightweight in-memory abort registry for workflow runs.
7523
+ *
7524
+ * Each workflow run (identified by its tracking runId) gets an AbortController.
7525
+ * When the user requests abort, the gateway signals the controller, and all
7526
+ * sub-agent invokes that received the signal will stop.
7527
+ */
7528
+ declare function registerWorkflowRun(runId: string): AbortController;
7529
+ declare function getWorkflowSignal(runId: string): AbortSignal | undefined;
7530
+ declare function abortWorkflowRun(runId: string): boolean;
7531
+ declare function unregisterWorkflowRun(runId: string): void;
7532
+
7188
7533
  /**
7189
7534
  * Global singleton for personal assistant default configuration.
7190
7535
  *
@@ -7246,4 +7591,4 @@ declare class ConnectionRegistry {
7246
7591
  private static ensureStore;
7247
7592
  }
7248
7593
 
7249
- export { AGENT_TASK_EVENT, type AddMessageParams, Agent, type AgentClient, type AgentExecutor, AgentInstanceManager, type AgentLattice, AgentLatticeManager, type AgentLifecycleEventName, AgentManager, type AgentStreamExecutor, type AgentThreadInterface, BUILTIN_PLUGINS, BUILTIN_SKILLS, type BackendFactory, type BackendProtocol, type BufferStats, type CacheEntry, type Chunk, ChunkBuffer, ChunkBufferLatticeManager, CollectionLatticeManager, type ColumnInfo, CompositeBackend, type ConnectAllChannelsOptions, ConnectionRegistry, ConsoleLoggerClient, type CreateProcessingAgentParams, type CreateSandboxProviderConfig, type CronFields, CustomMetricsClient, type CustomMiddlewareFactory, CustomMiddlewareRegistry, type DatabaseConfig, type DatabaseType, DaytonaInstance, DaytonaProvider, type DaytonaProviderConfig, DefaultScheduleClient, E2BInstance, E2BProvider, type E2BProviderConfig, EMPTY_CONTENT_WARNING, type EditResult, type EmbeddingsInfo, type EmbeddingsLatticeInterface, EmbeddingsLatticeManager, type EnsureMicrosandboxInput, type FileData, type FileInfo, FileSystemSkillStore, type FileSystemSkillStoreOptions, FilesystemBackend, type FsEntry, type GrepMatch, type IMessageQueueStore, type IMetricsServerClient, type ISqlDatabase, InMemoryA2AApiKeyStore, InMemoryAssistantStore, InMemoryBindingStore, InMemoryChannelInstallationStore, InMemoryChunkBuffer, InMemoryCollectionStore, InMemoryDatabaseConfigStore, InMemoryMailboxStore, InMemoryMenuStore, InMemoryTaskListStore, InMemoryTaskStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, InMemoryUserStore, InMemoryUserTenantLinkStore, LINE_NUMBER_WIDTH, type LangGraphStateChecker, LocalSandboxInstance, LocalSandboxProvider, type LocalSandboxProviderConfig, type LoggerLattice, LoggerLatticeManager, MAX_LINE_LENGTH, type MailboxMessage, type MailboxStore, type McpLatticeInterface, McpLatticeManager, type McpServerInfo, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, type MessageCompletedEvent, type MessageFailedEvent, type MessageStartedEvent, MessageType, MetricsServerManager, MicrosandboxRemoteInstance, MicrosandboxRemoteProvider, type MicrosandboxRemoteProviderClient, type MicrosandboxRemoteProviderConfig, MicrosandboxServiceClient, type MicrosandboxServiceClientConfig, type MicrosandboxShellExecInput, type ModelConfig, type ModelLatticeInterface, ModelLatticeManager, MysqlDatabase, type PendingMessage, PersonalAssistantConfig, PinoLoggerClient, PluginRegistry, PostgresDatabase, PrometheusClient, type QueryResult, type QueueLattice, QueueLatticeManager, QueueMode, type QueuePendingEvent, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type ResolveAgentFn, type RunSandboxConfig, type RuntimeModelConfig, type SandboxFileInfo, type SandboxFileService, SandboxFilesystem, type SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, type SandboxProvider, type SandboxShellService, SandboxSkillStore, type SandboxSkillStoreOptions, type SandboxVolumeDefinition, type ScheduleLattice, ScheduleLatticeManager, type SchedulerMiddlewareOptions, SemanticMetricsClient, type SharePayload, SimpleMemoryVectorStore, type SkillLattice, SkillLatticeManager, type SkillMeta, type SkillResource, SqlDatabaseManager, type StateAndStore, StateBackend, StoreBackend, type StoreLattice, StoreLatticeManager, type StoreType, type StoreTypeMap, TOOL_RESULT_TOKEN_LIMIT, TRUNCATION_GUIDANCE, type TableInfo, type TableSchema, type TaskEvent, type TaskListStore, type TaskSpec, TaskStatus, type TaskUpdatable, TeamAgentGraphBuilder, type TeamConfig, type TeamMiddlewareOptions, type TeamTask, type TeammateSpec, type TeammateToolsOptions, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, TokenCache, type ToolDefinition, type ToolLattice, ToolLatticeManager, type TopologyEdge, type UnknownToolHandlerConfig, type VectorStoreLatticeInterface, VectorStoreLatticeManager, type VectorStoreProviderLattice, VectorStoreProviderManager, VolumeFilesystem, type VolumeFsClient, type WorkflowValidationError, type WriteResult, agentInstanceManager, agentLatticeManager, buildGrepResultsDict, buildInput, buildNamedVolumeName, buildSandboxMetadataEnv, buildSkillFile, buildStateAnnotation, buildTableName, checkEmptyContent, clearEncryptionKeyCache, collectionLatticeManager, compileInternal, compileWorkflow, computeSandboxName, configureStores, connectAllChannels, createAgentNode, createAgentTeam, createExecuteSqlQueryTool, createFileData, createInfoSqlTool, createListMetricsDataSourcesTool, createListMetricsServersTool, createListTablesSqlTool, createMapNode, createModelSelectorMiddleware, createNodeHandler, createProcessingAgent, createQueryCheckerSqlTool, createQueryMetricDefinitionTool, createQueryMetricsListTool, createQuerySemanticMetricDataTool, createQuerySqlTool, createQueryTableDefinitionTool, createQueryTablesListTool, createResourceAddress, createSandboxProvider, createSchedulerMiddleware, createSharePayload, createTaskMiddleware, createTeamMiddleware, createTeammateTools, createUnknownToolHandlerMiddleware, createWidgetMiddleware, decrypt, describeCronExpression, embeddingsLatticeManager, encrypt, ensureBuiltinAgentsForTenant, eventBus, eventBus as eventBusDefault, extractFetcherError, extractOutput, fileDataToString, formatContentWithLineNumbers, formatGrepMatches, formatGrepResults, formatReadResponse, generateToken, getAgentClient, getAgentConfig, getAllAgentConfigs, getAllBuiltInSkillMetas, getAllToolDefinitions, getBindingRegistry, getBuiltInSkillContent, getBuiltInSkillMeta, getBuiltInSkillNames, getCheckpointSaver, getChunkBuffer, getCollectionEntryCount, getEmbeddingsClient, getEmbeddingsLattice, getEncryptionKey, getLoggerLattice, getMenuRegistry, getModelLattice, getNextCronTime, getOrCreateCollectionVectorStore, getQueueLattice, getSandBoxManager, getScheduleLattice, getStoreLattice, getToolClient, getToolDefinition, getToolLattice, getVectorStoreClient, getVectorStoreLattice, getVectorStoreProvider, globSearchFiles, grepMatchesFromFiles, grepSearchFiles, hasChunkBuffer, invokeWithRetry, isBuiltInSkill, isUsingDefaultKey, isValidCronExpression, isValidSandboxName, isValidSkillName, listCollectionEntries, loggerLatticeManager, mcpManager, metricsServerManager, modelLatticeManager, normalizeSandboxName, parallelLimit, parseCronExpression, parseSkillFrontmatter, parseYaml, performStringReplacement, queueLatticeManager, registerAgentLattice, registerAgentLatticeWithTenant, registerAgentLattices, registerCheckpointSaver, registerChunkBuffer, registerEmbeddingsLattice, registerExistingTool, registerLoggerLattice, registerModelLattice, registerQueueLattice, registerScheduleLattice, registerStoreLattice, registerTeammateAgent, registerToolLattice, registerVectorStoreLattice, registerVectorStoreProvider, removeCollectionVectorStore, renderTemplate, resolvePath, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, serializePluginMeta, setBindingRegistry, setMenuRegistry, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, toJsonSchema, toSafeStateExpr, toolLatticeManager, truncateIfTooLong, unregisterTeammateAgent, updateFileData, validateAgentInput, validateDSL, validateEncryptionKey, validatePath, validateSkillName, validateToolInput, vectorStoreLatticeManager, vectorStoreProviderManager };
7594
+ export { AGENT_TASK_EVENT, type AddMessageParams, Agent, type AgentClient, type AgentExecutor, AgentInstanceManager, type AgentLattice, AgentLatticeManager, type AgentLifecycleEventName, AgentManager, type AgentStreamExecutor, type AgentThreadInterface, BUILTIN_PLUGINS, BUILTIN_SKILLS, type BackendFactory, type BackendProtocol, type BufferStats, type CacheEntry, type CaseRunResult, type Chunk, ChunkBuffer, ChunkBufferLatticeManager, CollectionLatticeManager, type ColumnInfo, CompositeBackend, type ConnectAllChannelsOptions, ConnectionRegistry, ConsoleLoggerClient, type CreateSandboxProviderConfig, type CronFields, CustomMetricsClient, type CustomMiddlewareFactory, CustomMiddlewareRegistry, type DatabaseConfig, type DatabaseType, DaytonaInstance, DaytonaProvider, type DaytonaProviderConfig, DefaultScheduleClient, E2BInstance, E2BProvider, type E2BProviderConfig, EMPTY_CONTENT_WARNING, type EditResult, type EmbeddingsInfo, type EmbeddingsLatticeInterface, EmbeddingsLatticeManager, type EnsureMicrosandboxInput, type EvalRunService, type FileData, type FileInfo, FileSystemSkillStore, type FileSystemSkillStoreOptions, FilesystemBackend, type FsEntry, type GrepMatch, type IMessageQueueStore, type IMetricsServerClient, type ISqlDatabase, InMemoryA2AApiKeyStore, InMemoryAssistantStore, InMemoryBindingStore, InMemoryChannelInstallationStore, InMemoryChunkBuffer, InMemoryCollectionStore, InMemoryDatabaseConfigStore, InMemoryMailboxStore, InMemoryMenuStore, InMemoryTaskListStore, InMemoryTaskStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, InMemoryUserStore, InMemoryUserTenantLinkStore, LINE_NUMBER_WIDTH, type LangGraphStateChecker, type LatticeAgentStepConfig, LatticeEval, type LatticeEvalBatchReport, type LatticeEvalCase, type LatticeEvalCaseType, type LatticeEvalCaseWithTemplate, type LatticeEvalConfig, type LatticeEvalLogEvent, type LatticeEvalLogLevel, LatticeEvalProject, type LatticeEvalProjectType, type LatticeEvalResult, type LatticeEvalRubric, LatticeEvalSuite, type LatticeEvalSuiteType, type LatticeEvalTemplate, LocalSandboxInstance, LocalSandboxProvider, type LocalSandboxProviderConfig, type LoggerLattice, LoggerLatticeManager, MAX_LINE_LENGTH, type MailboxMessage, type MailboxStore, type McpLatticeInterface, McpLatticeManager, type McpServerInfo, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, type MessageCompletedEvent, type MessageFailedEvent, type MessageStartedEvent, MessageType, MetricsServerManager, MicrosandboxRemoteInstance, MicrosandboxRemoteProvider, type MicrosandboxRemoteProviderClient, type MicrosandboxRemoteProviderConfig, MicrosandboxServiceClient, type MicrosandboxServiceClientConfig, type MicrosandboxShellExecInput, type ModelConfig, type ModelLatticeInterface, ModelLatticeManager, MysqlDatabase, type OutputType, type PendingMessage, PersonalAssistantConfig, PinoLoggerClient, PluginRegistry, PostgresDatabase, PrometheusClient, type QueryResult, type QueueLattice, QueueLatticeManager, QueueMode, type QueuePendingEvent, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type ResolveAgentFn, type ResolvedConfig, type RunSandboxConfig, type RuntimeModelConfig, type SandboxFileInfo, type SandboxFileService, SandboxFilesystem, type SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, type SandboxProvider, type SandboxProviderFactory, type SandboxProviderType, type SandboxShellService, SandboxSkillStore, type SandboxSkillStoreOptions, type SandboxVolumeDefinition, type ScheduleLattice, ScheduleLatticeManager, type SchedulerMiddlewareOptions, SemanticMetricsClient, type SharePayload, SimpleMemoryVectorStore, type SkillLattice, SkillLatticeManager, type SkillMeta, type SkillResource, SqlDatabaseManager, type StateAndStore, StateBackend, StoreBackend, type StoreLattice, StoreLatticeManager, type StoreType, type StoreTypeMap, TOOL_RESULT_TOKEN_LIMIT, TRUNCATION_GUIDANCE, type TableInfo, type TableSchema, type TaskEvent, type TaskListStore, type TaskSpec, TaskStatus, type TaskUpdatable, TeamAgentGraphBuilder, type TeamConfig, type TeamMiddlewareOptions, type TeamTask, type TeammateSpec, type TeammateToolsOptions, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, TokenCache, type ToolDefinition, type ToolLattice, ToolLatticeManager, type UnknownToolHandlerConfig, type VectorStoreLatticeInterface, VectorStoreLatticeManager, type VectorStoreProviderLattice, VectorStoreProviderManager, VolumeFilesystem, type VolumeFsClient, type WorkflowValidationError, type WriteResult, abortWorkflowRun, agentInstanceManager, agentLatticeManager, buildGrepResultsDict, buildInput, buildNamedVolumeName, buildSandboxMetadataEnv, buildSkillFile, buildStateAnnotation, buildTableName, checkEmptyContent, clearEncryptionKeyCache, clearEvalRunService, collectionLatticeManager, compileInternal, compileWorkflow, computeSandboxName, configureStores, connectAllChannels, createAgentNode, createAgentTeam, createExecuteSqlQueryTool, createFileData, createInfoSqlTool, createListMetricsDataSourcesTool, createListMetricsServersTool, createListTablesSqlTool, createMapNode, createModelSelectorMiddleware, createNodeHandler, createQueryCheckerSqlTool, createQueryMetricDefinitionTool, createQueryMetricsListTool, createQuerySemanticMetricDataTool, createQuerySqlTool, createQueryTableDefinitionTool, createQueryTablesListTool, createResourceAddress, createSandboxProvider, createSchedulerMiddleware, createSharePayload, createTaskMiddleware, createTeamMiddleware, createTeammateTools, createUnknownToolHandlerMiddleware, createWidgetMiddleware, decrypt, describeCronExpression, embeddingsLatticeManager, encrypt, ensureBuiltinAgentsForTenant, evaluateLatticeCaseWithLogs, eventBus, eventBus as eventBusDefault, extractFetcherError, extractOutput, fileDataToString, formatContentWithLineNumbers, formatGrepMatches, formatGrepResults, formatReadResponse, generateToken, getAgentClient, getAgentConfig, getAllAgentConfigs, getAllBuiltInSkillMetas, getAllToolDefinitions, getBindingRegistry, getBuiltInSkillContent, getBuiltInSkillMeta, getBuiltInSkillNames, getCheckpointSaver, getChunkBuffer, getCollectionEntryCount, getEmbeddingsClient, getEmbeddingsLattice, getEncryptionKey, getEvalRunService, getLoggerLattice, getMenuRegistry, getModelLattice, getNextCronTime, getOrCreateCollectionVectorStore, getQueueLattice, getSandBoxManager, getScheduleLattice, getStoreLattice, getToolClient, getToolDefinition, getToolLattice, getVectorStoreClient, getVectorStoreLattice, getVectorStoreProvider, getWorkflowSignal, globSearchFiles, grepMatchesFromFiles, grepSearchFiles, hasChunkBuffer, invokeWithRetry, isBuiltInSkill, isUsingDefaultKey, isValidCronExpression, isValidSandboxName, isValidSkillName, listCollectionEntries, listSandboxProviderTypes, loggerLatticeManager, mcpManager, metricsServerManager, modelLatticeManager, normalizeSandboxName, parallelLimit, parseCronExpression, parseSkillFrontmatter, parseYaml, performStringReplacement, queueLatticeManager, registerAgentLattice, registerAgentLatticeWithTenant, registerAgentLattices, registerCheckpointSaver, registerChunkBuffer, registerEmbeddingsLattice, registerExistingTool, registerLoggerLattice, registerModelLattice, registerQueueLattice, registerSandboxProviderType, registerScheduleLattice, registerStoreLattice, registerTeammateAgent, registerToolLattice, registerVectorStoreLattice, registerVectorStoreProvider, registerWorkflowRun, removeCollectionVectorStore, renderTemplate, resolvePath, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, serializePluginMeta, setBindingRegistry, setEvalRunService, setMenuRegistry, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, toJsonSchema, toSafeStateExpr, toolLatticeManager, truncateIfTooLong, unregisterTeammateAgent, unregisterWorkflowRun, updateFileData, validateAgentInput, validateDSL, validateEncryptionKey, validatePath, validateSkillName, validateToolInput, vectorStoreLatticeManager, vectorStoreProviderManager };