@axiom-lattice/core 3.0.3 → 3.0.5

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.mts CHANGED
@@ -8,7 +8,7 @@ import { BaseLanguageModelInput, LanguageModelLike } from '@langchain/core/langu
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';
11
- import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, ThreadStore, AssistantStore, SkillStore, CollectionStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, MenuRegistry, A2AApiKeyStore, TaskStore, SharedResourceStore, ConnectionStore, TaskWorkItemStore, VectorStoreProvider, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, Binding, CreateBindingInput, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, Collection, CreateCollectionRequest, UpdateCollectionRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, STTModelLatticeProtocol, STTConfig, STTClient, TranscriptionResult, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, McpTool, ResourceResolver, ResourceAddress, ShareVisibility, CreateShareRequest, ChannelAdapter, PluginMeta, Plugin, PluginMetaOutput, InternalStateField, InternalInput, InternalNode, InternalAgentNode, InternalMapNode, InternalDSL, ConnectionEntry } from '@axiom-lattice/protocols';
11
+ import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, ThreadStore, AssistantStore, SkillStore, CollectionStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, MenuRegistry, A2AApiKeyStore, TaskStore, SharedResourceStore, ConnectionStore, TaskWorkItemStore, VectorStoreProvider, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, Binding, CreateBindingInput, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, Collection, CreateCollectionRequest, UpdateCollectionRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, STTModelLatticeProtocol, STTConfig, STTClient, TranscriptionResult, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, McpTool, ResourceResolver, ResourceAddress, ShareVisibility, CreateShareRequest, ChannelAdapter, InterruptPolicy, PluginMeta, Plugin, PluginMetaOutput, InternalStateField, InternalInput, InternalNode, InternalAgentNode, InternalMapNode, InternalDSL, ConnectionEntry } from '@axiom-lattice/protocols';
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';
@@ -5276,100 +5276,6 @@ declare function setBindingRegistry(r: BindingRegistry): void;
5276
5276
  */
5277
5277
  declare function getBindingRegistry(): BindingRegistry;
5278
5278
 
5279
- /**
5280
- * Service contract for controlling evaluation runs.
5281
- *
5282
- * The gateway layer implements this interface and registers it via
5283
- * {@link setEvalRunService} so that agent tools (e.g., `run_eval`) can
5284
- * start, abort, and monitor evaluation runs without knowing the
5285
- * underlying run-time infrastructure.
5286
- *
5287
- * @see {@link setEvalRunService}
5288
- * @see {@link getEvalRunService}
5289
- */
5290
- interface EvalRunService {
5291
- /**
5292
- * Start a new evaluation run for the given project.
5293
- *
5294
- * @param tenantId - Tenant that owns the project
5295
- * @param projectId - Project to evaluate
5296
- * @param suiteIds - Optional suite filter — only these suites run.
5297
- * Omit to run all suites. Used to keep the validation suite
5298
- * untouched during the fix loop (hold-out isolation).
5299
- * @param caseIds - Optional case filter — only these cases run (across
5300
- * the suites selected by `suiteIds`, or all suites if omitted).
5301
- * Suites with no matching cases are skipped; an error is thrown if
5302
- * no case matches at all.
5303
- * @param runConfig - Runtime environment (workspace/project) the eval
5304
- * executes in. Comes from the CALLER's runConfig, NOT from the eval
5305
- * project's targetServerConfig. Test cases are environment-agnostic;
5306
- * the run environment is decided at run time.
5307
- * @returns The newly created run ID
5308
- */
5309
- startRun(tenantId: string, projectId: string, suiteIds?: string[], caseIds?: string[], runConfig?: {
5310
- workspaceId?: string;
5311
- projectId?: string;
5312
- }): Promise<string>;
5313
- /**
5314
- * Abort a running evaluation.
5315
- *
5316
- * @param runId - The run to abort
5317
- * @returns `true` if the run was successfully aborted
5318
- */
5319
- abortRun(runId: string): Promise<boolean>;
5320
- /**
5321
- * Check whether a run's runner process is still alive.
5322
- *
5323
- * @param runId - The run to check
5324
- * @returns `true` if the runner process is still active
5325
- */
5326
- isRunning(runId: string): boolean;
5327
- }
5328
- /**
5329
- * Sets the global {@link EvalRunService} instance used by agent evaluation tools.
5330
- *
5331
- * The service enables the `run_eval` tool to start, abort, and monitor evaluation
5332
- * runs. This must be called **at gateway startup** before any agent invocation that
5333
- * expects `run_eval` to be functional.
5334
- *
5335
- * @example
5336
- * ```ts
5337
- * import { setEvalRunService } from "@axiom-lattice/core";
5338
- *
5339
- * const evalSvc: EvalRunService = {
5340
- * startRun: async (tid, pid) => { ... },
5341
- * abortRun: async (rid) => { ... },
5342
- * isRunning: (rid) => { ... },
5343
- * };
5344
- * setEvalRunService(evalSvc);
5345
- * ```
5346
- *
5347
- * @param s - An {@link EvalRunService} implementation
5348
- * @see {@link getEvalRunService}
5349
- */
5350
- declare function setEvalRunService(s: EvalRunService): void;
5351
- /**
5352
- * Returns the globally registered {@link EvalRunService}.
5353
- *
5354
- * Must be called **after** {@link setEvalRunService}. Used by the `run_eval`
5355
- * tool to start, abort, and monitor evaluation runs.
5356
- *
5357
- * @returns The active {@link EvalRunService} instance
5358
- * @throws {Error} If the service has not been initialized
5359
- * @see {@link setEvalRunService}
5360
- */
5361
- declare function getEvalRunService(): EvalRunService;
5362
- /**
5363
- * Resets the global {@link EvalRunService} to `null`.
5364
- *
5365
- * Restricted to the `test` environment for test isolation only. Production
5366
- * code must never call this function.
5367
- *
5368
- * @throws {Error} If `NODE_ENV` is not `"test"`
5369
- * @see {@link setEvalRunService}
5370
- */
5371
- declare function clearEvalRunService(): void;
5372
-
5373
5279
  interface LatticeAgentStepConfig {
5374
5280
  agent_id: string;
5375
5281
  override_message?: string;
@@ -5413,6 +5319,7 @@ interface LatticeEvalBatchReport {
5413
5319
  total_cases: number;
5414
5320
  passed_cases: number;
5415
5321
  failed_cases: number;
5322
+ interrupted_cases: number;
5416
5323
  pass_rate: number;
5417
5324
  };
5418
5325
  suites: Array<{
@@ -5420,11 +5327,13 @@ interface LatticeEvalBatchReport {
5420
5327
  total_cases: number;
5421
5328
  passed_cases: number;
5422
5329
  failed_cases: number;
5330
+ interrupted_cases?: number;
5423
5331
  cases: Array<{
5424
5332
  caseId: string;
5425
5333
  pass?: boolean;
5426
5334
  final_score?: number;
5427
5335
  error?: string;
5336
+ interrupted?: boolean;
5428
5337
  }>;
5429
5338
  }>;
5430
5339
  }
@@ -5451,6 +5360,13 @@ interface LatticeEvalCase {
5451
5360
  content_assertion: string;
5452
5361
  eval_rubrics?: LatticeEvalRubric[];
5453
5362
  };
5363
+ /**
5364
+ * How HITL interrupts are handled for this case. Unset/stop: the case
5365
+ * pauses and the judge evaluates the pause; auto-approve/auto-reject/
5366
+ * canned-response: the runner resumes the agent to test the flow AFTER
5367
+ * the human input.
5368
+ */
5369
+ interruptPolicy?: InterruptPolicy;
5454
5370
  }
5455
5371
  interface LatticeEvalCaseWithTemplate {
5456
5372
  caseId: string;
@@ -5465,6 +5381,7 @@ interface LatticeEvalCaseWithTemplate {
5465
5381
  content_assertion: string;
5466
5382
  eval_rubrics?: LatticeEvalRubric[];
5467
5383
  };
5384
+ interruptPolicy?: InterruptPolicy;
5468
5385
  }
5469
5386
  interface LatticeEvalTemplate {
5470
5387
  templateId: string;
@@ -5489,12 +5406,30 @@ interface LatticeEvalResult {
5489
5406
  }[];
5490
5407
  summary: string;
5491
5408
  error?: string;
5409
+ /**
5410
+ * True when the agent-under-test requested human input (HITL interrupt)
5411
+ * before producing a final answer. Such cases are NOT judged — they are
5412
+ * neither pass nor fail.
5413
+ */
5414
+ interrupted?: boolean;
5415
+ /** The HITL interrupt payload (LangGraph `__interrupt__[0]`). */
5416
+ interrupt?: {
5417
+ id?: string;
5418
+ value?: unknown;
5419
+ };
5492
5420
  }
5493
5421
  interface CaseRunResult {
5494
5422
  caseId: string;
5495
5423
  result?: LatticeEvalResult;
5496
5424
  error?: string;
5497
5425
  error_stack?: string;
5426
+ /** True when the agent-under-test hit a HITL interrupt (case not judged). */
5427
+ interrupted?: boolean;
5428
+ /** The HITL interrupt payload. */
5429
+ interrupt?: {
5430
+ id?: string;
5431
+ value?: unknown;
5432
+ };
5498
5433
  duration_ms?: number;
5499
5434
  thread_id?: string;
5500
5435
  judge_thread_id?: string;
@@ -5508,6 +5443,114 @@ interface CaseRunResult {
5508
5443
  logs: LatticeEvalLogEvent[];
5509
5444
  }
5510
5445
 
5446
+ /**
5447
+ * Service contract for controlling evaluation runs.
5448
+ *
5449
+ * The gateway layer implements this interface and registers it via
5450
+ * {@link setEvalRunService} so that agent tools (e.g., `run_eval`) can
5451
+ * start, abort, and monitor evaluation runs without knowing the
5452
+ * underlying run-time infrastructure.
5453
+ *
5454
+ * @see {@link setEvalRunService}
5455
+ * @see {@link getEvalRunService}
5456
+ */
5457
+ interface EvalRunService {
5458
+ /**
5459
+ * Start a new evaluation run for the given project.
5460
+ *
5461
+ * @param tenantId - Tenant that owns the project
5462
+ * @param projectId - Project to evaluate
5463
+ * @param suiteIds - Optional suite filter — only these suites run.
5464
+ * Omit to run all suites. Used to keep the validation suite
5465
+ * untouched during the fix loop (hold-out isolation).
5466
+ * @param caseIds - Optional case filter — only these cases run (across
5467
+ * the suites selected by `suiteIds`, or all suites if omitted).
5468
+ * Suites with no matching cases are skipped; an error is thrown if
5469
+ * no case matches at all.
5470
+ * @param runConfig - Runtime environment (workspace/project) the eval
5471
+ * executes in. Comes from the CALLER's runConfig, NOT from the eval
5472
+ * project's targetServerConfig. Test cases are environment-agnostic;
5473
+ * the run environment is decided at run time.
5474
+ * @returns The newly created run ID
5475
+ */
5476
+ startRun(tenantId: string, projectId: string, suiteIds?: string[], caseIds?: string[], runConfig?: {
5477
+ workspaceId?: string;
5478
+ projectId?: string;
5479
+ }): Promise<string>;
5480
+ /**
5481
+ * Abort a running evaluation.
5482
+ *
5483
+ * @param runId - The run to abort
5484
+ * @returns `true` if the run was successfully aborted
5485
+ */
5486
+ abortRun(runId: string): Promise<boolean>;
5487
+ /**
5488
+ * Wait for a run to reach a terminal state and return its batch report.
5489
+ *
5490
+ * Resolves when the run finishes (completed, failed, or aborted) and its
5491
+ * status has been persisted to the store — the caller can then read the
5492
+ * run and its results without polling. Enables synchronous tool execution
5493
+ * (`run_eval start` with `wait: true`).
5494
+ *
5495
+ * @param runId - The run to wait for
5496
+ * @returns The final batch report of the run
5497
+ * @throws {Error} If the run is not tracked in this process's memory
5498
+ * (already finished and cleaned up, or owned by another gateway instance)
5499
+ */
5500
+ waitForRun(runId: string): Promise<LatticeEvalBatchReport>;
5501
+ /**
5502
+ * Check whether a run's runner process is still alive.
5503
+ *
5504
+ * @param runId - The run to check
5505
+ * @returns `true` if the runner process is still active
5506
+ */
5507
+ isRunning(runId: string): boolean;
5508
+ }
5509
+ /**
5510
+ * Sets the global {@link EvalRunService} instance used by agent evaluation tools.
5511
+ *
5512
+ * The service enables the `run_eval` tool to start, abort, and monitor evaluation
5513
+ * runs. This must be called **at gateway startup** before any agent invocation that
5514
+ * expects `run_eval` to be functional.
5515
+ *
5516
+ * @example
5517
+ * ```ts
5518
+ * import { setEvalRunService } from "@axiom-lattice/core";
5519
+ *
5520
+ * const evalSvc: EvalRunService = {
5521
+ * startRun: async (tid, pid) => { ... },
5522
+ * abortRun: async (rid) => { ... },
5523
+ * isRunning: (rid) => { ... },
5524
+ * };
5525
+ * setEvalRunService(evalSvc);
5526
+ * ```
5527
+ *
5528
+ * @param s - An {@link EvalRunService} implementation
5529
+ * @see {@link getEvalRunService}
5530
+ */
5531
+ declare function setEvalRunService(s: EvalRunService): void;
5532
+ /**
5533
+ * Returns the globally registered {@link EvalRunService}.
5534
+ *
5535
+ * Must be called **after** {@link setEvalRunService}. Used by the `run_eval`
5536
+ * tool to start, abort, and monitor evaluation runs.
5537
+ *
5538
+ * @returns The active {@link EvalRunService} instance
5539
+ * @throws {Error} If the service has not been initialized
5540
+ * @see {@link setEvalRunService}
5541
+ */
5542
+ declare function getEvalRunService(): EvalRunService;
5543
+ /**
5544
+ * Resets the global {@link EvalRunService} to `null`.
5545
+ *
5546
+ * Restricted to the `test` environment for test isolation only. Production
5547
+ * code must never call this function.
5548
+ *
5549
+ * @throws {Error} If `NODE_ENV` is not `"test"`
5550
+ * @see {@link setEvalRunService}
5551
+ */
5552
+ declare function clearEvalRunService(): void;
5553
+
5511
5554
  interface JudgeVerdict {
5512
5555
  pass?: boolean;
5513
5556
  final_score?: number;
@@ -5547,11 +5590,8 @@ interface LatticeEvalConfig {
5547
5590
  */
5548
5591
  verbose?: boolean;
5549
5592
  }
5550
- /**
5551
- * LatticeEval class for evaluating Lattice evaluation cases.
5552
- * Executes agents in-process via agentInstanceManager.
5553
- */
5554
5593
  declare class LatticeEval {
5594
+ /** Per-message and total budget for the trajectory text (chars). */
5555
5595
  private config;
5556
5596
  private verbose;
5557
5597
  private inMemoryLogs;
@@ -7632,7 +7672,10 @@ declare function createModelSelectorMiddleware(): AgentMiddleware;
7632
7672
  * to generate error ToolMessages and jump back to the model.
7633
7673
  *
7634
7674
  * Key Design Principles:
7635
- * 1. Preserve all tool_calls in AIMessage (keep model's original intent)
7675
+ * 1. Only keep unknown tool_calls in AIMessage (strip valid ones to prevent
7676
+ * dangling tool_calls — afterModel jumps to "model" and skips ToolNode, so
7677
+ * any preserved call without a ToolMessage would be rejected by
7678
+ * OpenAI/OneAPI with 400 "insufficient tool messages following tool_calls")
7636
7679
  * 2. Generate error ToolMessages for unknown tools (preserve tool_call_id mapping)
7637
7680
  * 3. Use jumpTo to loop back to model node (required for agent loop)
7638
7681
  * 4. ToolNode will skip tool calls that already have ToolMessages
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import { BaseLanguageModelInput, LanguageModelLike } from '@langchain/core/langu
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';
11
- import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, ThreadStore, AssistantStore, SkillStore, CollectionStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, MenuRegistry, A2AApiKeyStore, TaskStore, SharedResourceStore, ConnectionStore, TaskWorkItemStore, VectorStoreProvider, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, Binding, CreateBindingInput, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, Collection, CreateCollectionRequest, UpdateCollectionRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, STTModelLatticeProtocol, STTConfig, STTClient, TranscriptionResult, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, McpTool, ResourceResolver, ResourceAddress, ShareVisibility, CreateShareRequest, ChannelAdapter, PluginMeta, Plugin, PluginMetaOutput, InternalStateField, InternalInput, InternalNode, InternalAgentNode, InternalMapNode, InternalDSL, ConnectionEntry } from '@axiom-lattice/protocols';
11
+ import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, ThreadStore, AssistantStore, SkillStore, CollectionStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, MenuRegistry, A2AApiKeyStore, TaskStore, SharedResourceStore, ConnectionStore, TaskWorkItemStore, VectorStoreProvider, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, Binding, CreateBindingInput, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, Collection, CreateCollectionRequest, UpdateCollectionRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, STTModelLatticeProtocol, STTConfig, STTClient, TranscriptionResult, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, McpTool, ResourceResolver, ResourceAddress, ShareVisibility, CreateShareRequest, ChannelAdapter, InterruptPolicy, PluginMeta, Plugin, PluginMetaOutput, InternalStateField, InternalInput, InternalNode, InternalAgentNode, InternalMapNode, InternalDSL, ConnectionEntry } from '@axiom-lattice/protocols';
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';
@@ -5276,100 +5276,6 @@ declare function setBindingRegistry(r: BindingRegistry): void;
5276
5276
  */
5277
5277
  declare function getBindingRegistry(): BindingRegistry;
5278
5278
 
5279
- /**
5280
- * Service contract for controlling evaluation runs.
5281
- *
5282
- * The gateway layer implements this interface and registers it via
5283
- * {@link setEvalRunService} so that agent tools (e.g., `run_eval`) can
5284
- * start, abort, and monitor evaluation runs without knowing the
5285
- * underlying run-time infrastructure.
5286
- *
5287
- * @see {@link setEvalRunService}
5288
- * @see {@link getEvalRunService}
5289
- */
5290
- interface EvalRunService {
5291
- /**
5292
- * Start a new evaluation run for the given project.
5293
- *
5294
- * @param tenantId - Tenant that owns the project
5295
- * @param projectId - Project to evaluate
5296
- * @param suiteIds - Optional suite filter — only these suites run.
5297
- * Omit to run all suites. Used to keep the validation suite
5298
- * untouched during the fix loop (hold-out isolation).
5299
- * @param caseIds - Optional case filter — only these cases run (across
5300
- * the suites selected by `suiteIds`, or all suites if omitted).
5301
- * Suites with no matching cases are skipped; an error is thrown if
5302
- * no case matches at all.
5303
- * @param runConfig - Runtime environment (workspace/project) the eval
5304
- * executes in. Comes from the CALLER's runConfig, NOT from the eval
5305
- * project's targetServerConfig. Test cases are environment-agnostic;
5306
- * the run environment is decided at run time.
5307
- * @returns The newly created run ID
5308
- */
5309
- startRun(tenantId: string, projectId: string, suiteIds?: string[], caseIds?: string[], runConfig?: {
5310
- workspaceId?: string;
5311
- projectId?: string;
5312
- }): Promise<string>;
5313
- /**
5314
- * Abort a running evaluation.
5315
- *
5316
- * @param runId - The run to abort
5317
- * @returns `true` if the run was successfully aborted
5318
- */
5319
- abortRun(runId: string): Promise<boolean>;
5320
- /**
5321
- * Check whether a run's runner process is still alive.
5322
- *
5323
- * @param runId - The run to check
5324
- * @returns `true` if the runner process is still active
5325
- */
5326
- isRunning(runId: string): boolean;
5327
- }
5328
- /**
5329
- * Sets the global {@link EvalRunService} instance used by agent evaluation tools.
5330
- *
5331
- * The service enables the `run_eval` tool to start, abort, and monitor evaluation
5332
- * runs. This must be called **at gateway startup** before any agent invocation that
5333
- * expects `run_eval` to be functional.
5334
- *
5335
- * @example
5336
- * ```ts
5337
- * import { setEvalRunService } from "@axiom-lattice/core";
5338
- *
5339
- * const evalSvc: EvalRunService = {
5340
- * startRun: async (tid, pid) => { ... },
5341
- * abortRun: async (rid) => { ... },
5342
- * isRunning: (rid) => { ... },
5343
- * };
5344
- * setEvalRunService(evalSvc);
5345
- * ```
5346
- *
5347
- * @param s - An {@link EvalRunService} implementation
5348
- * @see {@link getEvalRunService}
5349
- */
5350
- declare function setEvalRunService(s: EvalRunService): void;
5351
- /**
5352
- * Returns the globally registered {@link EvalRunService}.
5353
- *
5354
- * Must be called **after** {@link setEvalRunService}. Used by the `run_eval`
5355
- * tool to start, abort, and monitor evaluation runs.
5356
- *
5357
- * @returns The active {@link EvalRunService} instance
5358
- * @throws {Error} If the service has not been initialized
5359
- * @see {@link setEvalRunService}
5360
- */
5361
- declare function getEvalRunService(): EvalRunService;
5362
- /**
5363
- * Resets the global {@link EvalRunService} to `null`.
5364
- *
5365
- * Restricted to the `test` environment for test isolation only. Production
5366
- * code must never call this function.
5367
- *
5368
- * @throws {Error} If `NODE_ENV` is not `"test"`
5369
- * @see {@link setEvalRunService}
5370
- */
5371
- declare function clearEvalRunService(): void;
5372
-
5373
5279
  interface LatticeAgentStepConfig {
5374
5280
  agent_id: string;
5375
5281
  override_message?: string;
@@ -5413,6 +5319,7 @@ interface LatticeEvalBatchReport {
5413
5319
  total_cases: number;
5414
5320
  passed_cases: number;
5415
5321
  failed_cases: number;
5322
+ interrupted_cases: number;
5416
5323
  pass_rate: number;
5417
5324
  };
5418
5325
  suites: Array<{
@@ -5420,11 +5327,13 @@ interface LatticeEvalBatchReport {
5420
5327
  total_cases: number;
5421
5328
  passed_cases: number;
5422
5329
  failed_cases: number;
5330
+ interrupted_cases?: number;
5423
5331
  cases: Array<{
5424
5332
  caseId: string;
5425
5333
  pass?: boolean;
5426
5334
  final_score?: number;
5427
5335
  error?: string;
5336
+ interrupted?: boolean;
5428
5337
  }>;
5429
5338
  }>;
5430
5339
  }
@@ -5451,6 +5360,13 @@ interface LatticeEvalCase {
5451
5360
  content_assertion: string;
5452
5361
  eval_rubrics?: LatticeEvalRubric[];
5453
5362
  };
5363
+ /**
5364
+ * How HITL interrupts are handled for this case. Unset/stop: the case
5365
+ * pauses and the judge evaluates the pause; auto-approve/auto-reject/
5366
+ * canned-response: the runner resumes the agent to test the flow AFTER
5367
+ * the human input.
5368
+ */
5369
+ interruptPolicy?: InterruptPolicy;
5454
5370
  }
5455
5371
  interface LatticeEvalCaseWithTemplate {
5456
5372
  caseId: string;
@@ -5465,6 +5381,7 @@ interface LatticeEvalCaseWithTemplate {
5465
5381
  content_assertion: string;
5466
5382
  eval_rubrics?: LatticeEvalRubric[];
5467
5383
  };
5384
+ interruptPolicy?: InterruptPolicy;
5468
5385
  }
5469
5386
  interface LatticeEvalTemplate {
5470
5387
  templateId: string;
@@ -5489,12 +5406,30 @@ interface LatticeEvalResult {
5489
5406
  }[];
5490
5407
  summary: string;
5491
5408
  error?: string;
5409
+ /**
5410
+ * True when the agent-under-test requested human input (HITL interrupt)
5411
+ * before producing a final answer. Such cases are NOT judged — they are
5412
+ * neither pass nor fail.
5413
+ */
5414
+ interrupted?: boolean;
5415
+ /** The HITL interrupt payload (LangGraph `__interrupt__[0]`). */
5416
+ interrupt?: {
5417
+ id?: string;
5418
+ value?: unknown;
5419
+ };
5492
5420
  }
5493
5421
  interface CaseRunResult {
5494
5422
  caseId: string;
5495
5423
  result?: LatticeEvalResult;
5496
5424
  error?: string;
5497
5425
  error_stack?: string;
5426
+ /** True when the agent-under-test hit a HITL interrupt (case not judged). */
5427
+ interrupted?: boolean;
5428
+ /** The HITL interrupt payload. */
5429
+ interrupt?: {
5430
+ id?: string;
5431
+ value?: unknown;
5432
+ };
5498
5433
  duration_ms?: number;
5499
5434
  thread_id?: string;
5500
5435
  judge_thread_id?: string;
@@ -5508,6 +5443,114 @@ interface CaseRunResult {
5508
5443
  logs: LatticeEvalLogEvent[];
5509
5444
  }
5510
5445
 
5446
+ /**
5447
+ * Service contract for controlling evaluation runs.
5448
+ *
5449
+ * The gateway layer implements this interface and registers it via
5450
+ * {@link setEvalRunService} so that agent tools (e.g., `run_eval`) can
5451
+ * start, abort, and monitor evaluation runs without knowing the
5452
+ * underlying run-time infrastructure.
5453
+ *
5454
+ * @see {@link setEvalRunService}
5455
+ * @see {@link getEvalRunService}
5456
+ */
5457
+ interface EvalRunService {
5458
+ /**
5459
+ * Start a new evaluation run for the given project.
5460
+ *
5461
+ * @param tenantId - Tenant that owns the project
5462
+ * @param projectId - Project to evaluate
5463
+ * @param suiteIds - Optional suite filter — only these suites run.
5464
+ * Omit to run all suites. Used to keep the validation suite
5465
+ * untouched during the fix loop (hold-out isolation).
5466
+ * @param caseIds - Optional case filter — only these cases run (across
5467
+ * the suites selected by `suiteIds`, or all suites if omitted).
5468
+ * Suites with no matching cases are skipped; an error is thrown if
5469
+ * no case matches at all.
5470
+ * @param runConfig - Runtime environment (workspace/project) the eval
5471
+ * executes in. Comes from the CALLER's runConfig, NOT from the eval
5472
+ * project's targetServerConfig. Test cases are environment-agnostic;
5473
+ * the run environment is decided at run time.
5474
+ * @returns The newly created run ID
5475
+ */
5476
+ startRun(tenantId: string, projectId: string, suiteIds?: string[], caseIds?: string[], runConfig?: {
5477
+ workspaceId?: string;
5478
+ projectId?: string;
5479
+ }): Promise<string>;
5480
+ /**
5481
+ * Abort a running evaluation.
5482
+ *
5483
+ * @param runId - The run to abort
5484
+ * @returns `true` if the run was successfully aborted
5485
+ */
5486
+ abortRun(runId: string): Promise<boolean>;
5487
+ /**
5488
+ * Wait for a run to reach a terminal state and return its batch report.
5489
+ *
5490
+ * Resolves when the run finishes (completed, failed, or aborted) and its
5491
+ * status has been persisted to the store — the caller can then read the
5492
+ * run and its results without polling. Enables synchronous tool execution
5493
+ * (`run_eval start` with `wait: true`).
5494
+ *
5495
+ * @param runId - The run to wait for
5496
+ * @returns The final batch report of the run
5497
+ * @throws {Error} If the run is not tracked in this process's memory
5498
+ * (already finished and cleaned up, or owned by another gateway instance)
5499
+ */
5500
+ waitForRun(runId: string): Promise<LatticeEvalBatchReport>;
5501
+ /**
5502
+ * Check whether a run's runner process is still alive.
5503
+ *
5504
+ * @param runId - The run to check
5505
+ * @returns `true` if the runner process is still active
5506
+ */
5507
+ isRunning(runId: string): boolean;
5508
+ }
5509
+ /**
5510
+ * Sets the global {@link EvalRunService} instance used by agent evaluation tools.
5511
+ *
5512
+ * The service enables the `run_eval` tool to start, abort, and monitor evaluation
5513
+ * runs. This must be called **at gateway startup** before any agent invocation that
5514
+ * expects `run_eval` to be functional.
5515
+ *
5516
+ * @example
5517
+ * ```ts
5518
+ * import { setEvalRunService } from "@axiom-lattice/core";
5519
+ *
5520
+ * const evalSvc: EvalRunService = {
5521
+ * startRun: async (tid, pid) => { ... },
5522
+ * abortRun: async (rid) => { ... },
5523
+ * isRunning: (rid) => { ... },
5524
+ * };
5525
+ * setEvalRunService(evalSvc);
5526
+ * ```
5527
+ *
5528
+ * @param s - An {@link EvalRunService} implementation
5529
+ * @see {@link getEvalRunService}
5530
+ */
5531
+ declare function setEvalRunService(s: EvalRunService): void;
5532
+ /**
5533
+ * Returns the globally registered {@link EvalRunService}.
5534
+ *
5535
+ * Must be called **after** {@link setEvalRunService}. Used by the `run_eval`
5536
+ * tool to start, abort, and monitor evaluation runs.
5537
+ *
5538
+ * @returns The active {@link EvalRunService} instance
5539
+ * @throws {Error} If the service has not been initialized
5540
+ * @see {@link setEvalRunService}
5541
+ */
5542
+ declare function getEvalRunService(): EvalRunService;
5543
+ /**
5544
+ * Resets the global {@link EvalRunService} to `null`.
5545
+ *
5546
+ * Restricted to the `test` environment for test isolation only. Production
5547
+ * code must never call this function.
5548
+ *
5549
+ * @throws {Error} If `NODE_ENV` is not `"test"`
5550
+ * @see {@link setEvalRunService}
5551
+ */
5552
+ declare function clearEvalRunService(): void;
5553
+
5511
5554
  interface JudgeVerdict {
5512
5555
  pass?: boolean;
5513
5556
  final_score?: number;
@@ -5547,11 +5590,8 @@ interface LatticeEvalConfig {
5547
5590
  */
5548
5591
  verbose?: boolean;
5549
5592
  }
5550
- /**
5551
- * LatticeEval class for evaluating Lattice evaluation cases.
5552
- * Executes agents in-process via agentInstanceManager.
5553
- */
5554
5593
  declare class LatticeEval {
5594
+ /** Per-message and total budget for the trajectory text (chars). */
5555
5595
  private config;
5556
5596
  private verbose;
5557
5597
  private inMemoryLogs;
@@ -7632,7 +7672,10 @@ declare function createModelSelectorMiddleware(): AgentMiddleware;
7632
7672
  * to generate error ToolMessages and jump back to the model.
7633
7673
  *
7634
7674
  * Key Design Principles:
7635
- * 1. Preserve all tool_calls in AIMessage (keep model's original intent)
7675
+ * 1. Only keep unknown tool_calls in AIMessage (strip valid ones to prevent
7676
+ * dangling tool_calls — afterModel jumps to "model" and skips ToolNode, so
7677
+ * any preserved call without a ToolMessage would be rejected by
7678
+ * OpenAI/OneAPI with 400 "insufficient tool messages following tool_calls")
7636
7679
  * 2. Generate error ToolMessages for unknown tools (preserve tool_call_id mapping)
7637
7680
  * 3. Use jumpTo to loop back to model node (required for agent loop)
7638
7681
  * 4. ToolNode will skip tool calls that already have ToolMessages