@mantyx/sdk 0.18.0 → 0.20.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.
@@ -464,6 +464,15 @@ interface LocalTool<TArgs = Record<string, unknown>> {
464
464
  * `docs/agent-runs-protocol.md` §4.1.1.
465
465
  */
466
466
  readonly readOnly: boolean;
467
+ /**
468
+ * When `true`, the tool's result is **persisted with the session and
469
+ * replayed to the model on later turns** — reconstructed as a
470
+ * `tool_use` + `tool_result` pair in its original place in the
471
+ * transcript. Only meaningful for session-scoped runs. Keep outputs
472
+ * small (text only, ~8 KB cap). See `docs/agent-runs-protocol.md`
473
+ * §4.1.1.
474
+ */
475
+ readonly retain: boolean;
467
476
  readonly execute: (args: TArgs) => Promise<LocalToolOutput> | LocalToolOutput;
468
477
  }
469
478
  interface DefineLocalToolOptions<T extends ZodLikeObject | undefined> {
@@ -488,6 +497,12 @@ interface DefineLocalToolOptions<T extends ZodLikeObject | undefined> {
488
497
  * {@link LocalTool.readOnly}.
489
498
  */
490
499
  readOnly?: boolean;
500
+ /**
501
+ * Persist the tool result across session turns so follow-ups can
502
+ * reference values the model can no longer recompute. See
503
+ * {@link LocalTool.retain}.
504
+ */
505
+ retain?: boolean;
491
506
  execute: (args: T extends ZodLikeObject ? z.infer<T> : Record<string, unknown>) => Promise<LocalToolOutput> | LocalToolOutput;
492
507
  }
493
508
  declare function defineLocalTool<T extends ZodLikeObject | undefined>(opts: DefineLocalToolOptions<T>): LocalTool;
@@ -800,6 +815,174 @@ interface RunFeedbackResult {
800
815
  targetKind: string;
801
816
  agentRunId: string;
802
817
  }
818
+ /** Terminal statuses for {@link EvalRunDetail} and {@link EvalRunSummary}. */
819
+ type EvalRunStatus = "queued" | "running" | "succeeded" | "failed" | "cancelled";
820
+ /** One case in an inline eval dataset (`POST /eval-runs` `dataset`). */
821
+ interface InlineEvalCaseSpec {
822
+ name?: string;
823
+ input: {
824
+ role?: "user";
825
+ content: string;
826
+ expected?: string | null;
827
+ };
828
+ scorers?: Record<string, unknown>[];
829
+ toolMocks?: Record<string, unknown>;
830
+ tags?: string[];
831
+ }
832
+ /** Inline eval dataset blob (`POST /eval-runs` `dataset`). */
833
+ interface InlineEvalDatasetSpec {
834
+ name?: string;
835
+ toolMocks?: Record<string, unknown>;
836
+ cases: InlineEvalCaseSpec[];
837
+ }
838
+ /** Saved-agent overrides on `POST /eval-runs` (ignored for inline `agent`). */
839
+ interface AgentEvalOverrides {
840
+ systemPrompt?: string;
841
+ systemPromptAppend?: string;
842
+ model?: string;
843
+ llmProviderId?: string;
844
+ reasoningLevel?: "low" | "medium" | "high";
845
+ disableTools?: boolean;
846
+ toolAllowlist?: string[];
847
+ disabledMocks?: string[];
848
+ }
849
+ /** Body for `POST /eval-runs`. Exactly one of `datasetId`/`dataset` and `agentId`/`agent`. */
850
+ interface CreateEvalRunRequest {
851
+ datasetId?: string;
852
+ dataset?: InlineEvalDatasetSpec;
853
+ agentId?: string;
854
+ agent?: AgentSpecBase;
855
+ modelId?: string;
856
+ overrides?: AgentEvalOverrides;
857
+ }
858
+ interface EvalDatasetSummary {
859
+ id: string;
860
+ name: string;
861
+ description: string | null;
862
+ caseCount: number;
863
+ runCount: number;
864
+ createdAt: string;
865
+ updatedAt: string;
866
+ }
867
+ interface EvalDatasetList {
868
+ datasets: EvalDatasetSummary[];
869
+ }
870
+ interface EvalCase {
871
+ id: string;
872
+ name: string;
873
+ input: Record<string, unknown>;
874
+ scorers: Record<string, unknown>[];
875
+ tags: string[];
876
+ toolMocks: Record<string, unknown> | null;
877
+ createdAt: string;
878
+ updatedAt: string;
879
+ }
880
+ interface EvalDatasetDetail {
881
+ id: string;
882
+ name: string;
883
+ description: string | null;
884
+ toolMocks: Record<string, unknown> | null;
885
+ cases: EvalCase[];
886
+ createdAt: string;
887
+ updatedAt: string;
888
+ }
889
+ interface EvalRunAccepted {
890
+ runId: string;
891
+ status: string;
892
+ streamUrl: string;
893
+ }
894
+ interface EvalRunSummary {
895
+ id: string;
896
+ datasetId: string;
897
+ datasetName: string;
898
+ agentId: string | null;
899
+ inlineAgent: boolean;
900
+ status: EvalRunStatus;
901
+ totalCases: number;
902
+ completedCases: number;
903
+ passedCases: number;
904
+ score: number | null;
905
+ tokenUsage: Record<string, unknown> | null;
906
+ error: string | null;
907
+ agentOverrides: Record<string, unknown> | null;
908
+ startedAt: string | null;
909
+ finishedAt: string | null;
910
+ createdAt: string;
911
+ }
912
+ interface EvalCaseResult {
913
+ id: string;
914
+ caseId: string;
915
+ case: EvalCase;
916
+ finalText: string | null;
917
+ toolCalls: Record<string, unknown>[];
918
+ scores: Record<string, unknown>[];
919
+ passed: boolean;
920
+ score: number;
921
+ tokens: Record<string, unknown> | null;
922
+ latencyMs: number | null;
923
+ error: string | null;
924
+ createdAt: string;
925
+ }
926
+ interface EvalRunDetail extends EvalRunSummary {
927
+ inlineAgentSpec: Record<string, unknown> | null;
928
+ agentSpecSnapshot: Record<string, unknown> | null;
929
+ updatedAt: string;
930
+ results: EvalCaseResult[];
931
+ }
932
+ interface EvalRunList {
933
+ runs: EvalRunSummary[];
934
+ limit: number;
935
+ offset: number;
936
+ }
937
+ interface EvalRunCompareSide {
938
+ id: string;
939
+ agentId: string | null;
940
+ inlineAgent: boolean;
941
+ status: string;
942
+ totalCases: number;
943
+ completedCases: number;
944
+ passedCases: number;
945
+ score: number | null;
946
+ tokenUsage: Record<string, unknown> | null;
947
+ agentOverrides: Record<string, unknown> | null;
948
+ agentSpecSnapshot: Record<string, unknown> | null;
949
+ startedAt: string | null;
950
+ finishedAt: string | null;
951
+ createdAt: string;
952
+ }
953
+ interface EvalRunCompareCase {
954
+ caseId: string;
955
+ caseName: string;
956
+ caseInput: Record<string, unknown> | null;
957
+ a: Record<string, unknown> | null;
958
+ b: Record<string, unknown> | null;
959
+ }
960
+ interface EvalRunCompare {
961
+ datasetId: string;
962
+ datasetName: string;
963
+ runA: EvalRunCompareSide;
964
+ runB: EvalRunCompareSide;
965
+ cases: EvalRunCompareCase[];
966
+ }
967
+ /** One SSE frame from `GET /eval-runs/:runId/stream`. */
968
+ interface EvalRunEvent {
969
+ type: string;
970
+ [key: string]: unknown;
971
+ }
972
+ interface ListEvalRunsOptions {
973
+ datasetId?: string;
974
+ agentId?: string;
975
+ status?: EvalRunStatus | string;
976
+ limit?: number;
977
+ offset?: number;
978
+ }
979
+ interface RunEvalOptions {
980
+ /** Called for each SSE frame while the run is in flight. */
981
+ onEvent?: (event: EvalRunEvent) => void;
982
+ /** Poll interval when SSE is unavailable or ends early. Default 1000ms. */
983
+ pollIntervalMs?: number;
984
+ signal?: AbortSignal;
985
+ }
803
986
  interface MantyxClientOptions {
804
987
  /**
805
988
  * Workspace API key (token prefix `mantyx_`) **or** a MANTYX OAuth 2.0
@@ -833,7 +1016,8 @@ interface MantyxClientOptions {
833
1016
  *
834
1017
  * OAuth tokens additionally enforce per-route **scopes**
835
1018
  * (`runs:read`, `runs:write`, `sessions:read`, `sessions:write`,
836
- * `models:read`, `feedback:write`, `mantyx.identity:read`); see
1019
+ * `models:read`, `feedback:write`, `evals:read`, `evals:write`,
1020
+ * `mantyx.identity:read`); see
837
1021
  * `docs/agent-runs-protocol.md` §2.2 for the table. Missing scopes
838
1022
  * land as {@link MantyxScopeError} so callers can route the user
839
1023
  * back to a re-consent flow.
@@ -1664,6 +1848,22 @@ declare class MantyxClient {
1664
1848
  * the same response body. See `docs/agent-runs-protocol.md` §9a.
1665
1849
  */
1666
1850
  submitRunFeedback(runId: string, input: RunFeedbackInput): Promise<RunFeedbackResult>;
1851
+ listEvalDatasets(): Promise<EvalDatasetList>;
1852
+ getEvalDataset(datasetId: string): Promise<EvalDatasetDetail>;
1853
+ createEvalRun(spec: CreateEvalRunRequest): Promise<EvalRunAccepted>;
1854
+ listEvalRuns(options?: ListEvalRunsOptions): Promise<EvalRunList>;
1855
+ compareEvalRuns(runA: string, runB: string): Promise<EvalRunCompare>;
1856
+ getEvalRun(runId: string): Promise<EvalRunDetail>;
1857
+ streamEvalRun(runId: string, signal?: AbortSignal): AsyncGenerator<EvalRunEvent, void, void>;
1858
+ cancelEvalRun(runId: string): Promise<{
1859
+ ok: boolean;
1860
+ }>;
1861
+ /**
1862
+ * Start an eval run and block until it reaches a terminal status.
1863
+ * Tails the SSE stream for live `onEvent` callbacks while polling
1864
+ * `getEvalRun` until `status` is terminal.
1865
+ */
1866
+ runEval(spec: CreateEvalRunRequest, options?: RunEvalOptions): Promise<EvalRunDetail>;
1667
1867
  private absoluteUrl;
1668
1868
  /**
1669
1869
  * Resolve the bearer credential to send on the next request. With a
@@ -1826,4 +2026,4 @@ interface LocalHandlers {
1826
2026
  */
1827
2027
  declare function parseRunOutput<T = unknown>(result: RunResult, validator?: (value: unknown) => T): T;
1828
2028
 
1829
- export { type McpToolRef as $, type A2AToolRef as A, MantyxAuthError as B, type CancelledEvent as C, DEFAULT_BASE_URL as D, type ErrorEvent as E, type MantyxClientOptions as F, MantyxError as G, type MantyxMcpOptions as H, type InputFileAttachment as I, MantyxNetworkError as J, MantyxOAuthClient as K, type LocalA2ATool as L, MantyxClient as M, type MantyxOAuthClientOptions as N, type OutputSchema as O, MantyxOAuthError as P, MantyxParseError as Q, type ReasoningLevel as R, type MantyxPluginToolRef as S, type ToolRef as T, MantyxRunError as U, type MantyxRunErrorInit as V, type MantyxRunErrorModel as W, type MantyxRunErrorTokens as X, MantyxScopeError as Y, MantyxToolError as Z, type MantyxToolRef as _, AgentSession as a, type MessageAttachment as a0, type ModelCatalog as a1, type ModelInfo as a2, type OAuthToken as a3, type OutputSchemaValue as a4, type PlanOptions as a5, type PlanSpec as a6, type ReasoningTrigger as a7, type RefreshOptions as a8, type RefreshTokenSourceOptions as a9, type TokenSource as aA, type ToolBudget as aB, type ToolBudgetExceededEvent as aC, type ToolBudgets as aD, type ToolResultFile as aE, type UserMessageEvent as aF, type ZodLikeObject as aG, defineLocalA2A as aH, defineLocalMcp as aI, defineLocalTool as aJ, inputFileAttachment as aK, inputFileUrlAttachment as aL, isLocalA2ATool as aM, isLocalMcpServer as aN, isLocalTool as aO, mantyxA2A as aP, mantyxMcp as aQ, mantyxPluginTool as aR, mantyxTool as aS, parseRunOutput as aT, planOnly as aU, type ResultEvent as aa, type RevokeOptions as ab, type RunEvent as ac, type RunEventBase as ad, type RunFeedbackInput as ae, type RunFeedbackResult as af, type RunFeedbackVerdict as ag, type RunModelInfo as ah, type RunResult as ai, type RunSpec as aj, type RunTokenUsage as ak, type ServerToolResultEvent as al, type SessionInfo as am, type SessionListResult as an, type SessionSpec as ao, type SessionSummary as ap, type Supervisor as aq, type SupervisorAction as ar, type SupervisorEvent as as, type SupervisorPhase as at, type TaskPlan as au, type TaskPlanEvent as av, type TaskPlanStep as aw, type TaskPlanStepStatus as ax, type ThinkingDeltaEvent as ay, type TokenRequestReason as az, type AgentSpecBase as b, type AssistantDeltaEvent as c, type AssistantMessageEvent as d, type AttachmentMetadata as e, type ConversationMessage as f, DEFAULT_OAUTH_BASE_URL as g, DEFAULT_REFRESH_SKEW_MS as h, type DefineLocalA2AOptions as i, type DefineLocalMcpOptions as j, type DefineLocalToolOptions as k, type InputFileAttachmentMetadata as l, type InputFileUrlAttachment as m, type InputFileUrlAttachmentMetadata as n, type LocalHandlers as o, type LocalMcpHttpTransport as p, type LocalMcpServer as q, type LocalMcpStdioTransport as r, type LocalTool as s, type LocalToolCallEvent as t, type LocalToolOutput as u, type LocalToolResult as v, type LocalToolResultInEvent as w, type LoopDetectedEvent as x, type LoopDetection as y, type MantyxA2AOptions as z };
2029
+ export { type LoopDetection as $, type A2AToolRef as A, type EvalRunSummary as B, type CancelledEvent as C, DEFAULT_BASE_URL as D, type ErrorEvent as E, type InlineEvalDatasetSpec as F, type InputFileAttachment as G, type InputFileAttachmentMetadata as H, type InlineEvalCaseSpec as I, type InputFileUrlAttachment as J, type InputFileUrlAttachmentMetadata as K, type ListEvalRunsOptions as L, MantyxClient as M, type LocalA2ATool as N, type OutputSchema as O, type LocalHandlers as P, type LocalMcpHttpTransport as Q, type ReasoningLevel as R, type LocalMcpServer as S, type ToolRef as T, type LocalMcpStdioTransport as U, type LocalTool as V, type LocalToolCallEvent as W, type LocalToolOutput as X, type LocalToolResult as Y, type LocalToolResultInEvent as Z, type LoopDetectedEvent as _, type AgentEvalOverrides as a, defineLocalA2A as a$, type MantyxA2AOptions as a0, MantyxAuthError as a1, type MantyxClientOptions as a2, MantyxError as a3, type MantyxMcpOptions as a4, MantyxNetworkError as a5, MantyxOAuthClient as a6, type MantyxOAuthClientOptions as a7, MantyxOAuthError as a8, MantyxParseError as a9, type RunFeedbackVerdict as aA, type RunModelInfo as aB, type RunResult as aC, type RunSpec as aD, type RunTokenUsage as aE, type ServerToolResultEvent as aF, type SessionInfo as aG, type SessionListResult as aH, type SessionSpec as aI, type SessionSummary as aJ, type Supervisor as aK, type SupervisorAction as aL, type SupervisorEvent as aM, type SupervisorPhase as aN, type TaskPlan as aO, type TaskPlanEvent as aP, type TaskPlanStep as aQ, type TaskPlanStepStatus as aR, type ThinkingDeltaEvent as aS, type TokenRequestReason as aT, type TokenSource as aU, type ToolBudget as aV, type ToolBudgetExceededEvent as aW, type ToolBudgets as aX, type ToolResultFile as aY, type UserMessageEvent as aZ, type ZodLikeObject as a_, type MantyxPluginToolRef as aa, MantyxRunError as ab, type MantyxRunErrorInit as ac, type MantyxRunErrorModel as ad, type MantyxRunErrorTokens as ae, MantyxScopeError as af, MantyxToolError as ag, type MantyxToolRef as ah, type McpToolRef as ai, type MessageAttachment as aj, type ModelCatalog as ak, type ModelInfo as al, type OAuthToken as am, type OutputSchemaValue as an, type PlanOptions as ao, type PlanSpec as ap, type ReasoningTrigger as aq, type RefreshOptions as ar, type RefreshTokenSourceOptions as as, type ResultEvent as at, type RevokeOptions as au, type RunEvalOptions as av, type RunEvent as aw, type RunEventBase as ax, type RunFeedbackInput as ay, type RunFeedbackResult as az, AgentSession as b, defineLocalMcp as b0, defineLocalTool as b1, inputFileAttachment as b2, inputFileUrlAttachment as b3, isLocalA2ATool as b4, isLocalMcpServer as b5, isLocalTool as b6, mantyxA2A as b7, mantyxMcp as b8, mantyxPluginTool as b9, mantyxTool as ba, parseRunOutput as bb, planOnly as bc, type AgentSpecBase as c, type AssistantDeltaEvent as d, type AssistantMessageEvent as e, type AttachmentMetadata as f, type ConversationMessage as g, type CreateEvalRunRequest as h, DEFAULT_OAUTH_BASE_URL as i, DEFAULT_REFRESH_SKEW_MS as j, type DefineLocalA2AOptions as k, type DefineLocalMcpOptions as l, type DefineLocalToolOptions as m, type EvalCase as n, type EvalCaseResult as o, type EvalDatasetDetail as p, type EvalDatasetList as q, type EvalDatasetSummary as r, type EvalRunAccepted as s, type EvalRunCompare as t, type EvalRunCompareCase as u, type EvalRunCompareSide as v, type EvalRunDetail as w, type EvalRunEvent as x, type EvalRunList as y, type EvalRunStatus as z };
@@ -464,6 +464,15 @@ interface LocalTool<TArgs = Record<string, unknown>> {
464
464
  * `docs/agent-runs-protocol.md` §4.1.1.
465
465
  */
466
466
  readonly readOnly: boolean;
467
+ /**
468
+ * When `true`, the tool's result is **persisted with the session and
469
+ * replayed to the model on later turns** — reconstructed as a
470
+ * `tool_use` + `tool_result` pair in its original place in the
471
+ * transcript. Only meaningful for session-scoped runs. Keep outputs
472
+ * small (text only, ~8 KB cap). See `docs/agent-runs-protocol.md`
473
+ * §4.1.1.
474
+ */
475
+ readonly retain: boolean;
467
476
  readonly execute: (args: TArgs) => Promise<LocalToolOutput> | LocalToolOutput;
468
477
  }
469
478
  interface DefineLocalToolOptions<T extends ZodLikeObject | undefined> {
@@ -488,6 +497,12 @@ interface DefineLocalToolOptions<T extends ZodLikeObject | undefined> {
488
497
  * {@link LocalTool.readOnly}.
489
498
  */
490
499
  readOnly?: boolean;
500
+ /**
501
+ * Persist the tool result across session turns so follow-ups can
502
+ * reference values the model can no longer recompute. See
503
+ * {@link LocalTool.retain}.
504
+ */
505
+ retain?: boolean;
491
506
  execute: (args: T extends ZodLikeObject ? z.infer<T> : Record<string, unknown>) => Promise<LocalToolOutput> | LocalToolOutput;
492
507
  }
493
508
  declare function defineLocalTool<T extends ZodLikeObject | undefined>(opts: DefineLocalToolOptions<T>): LocalTool;
@@ -800,6 +815,174 @@ interface RunFeedbackResult {
800
815
  targetKind: string;
801
816
  agentRunId: string;
802
817
  }
818
+ /** Terminal statuses for {@link EvalRunDetail} and {@link EvalRunSummary}. */
819
+ type EvalRunStatus = "queued" | "running" | "succeeded" | "failed" | "cancelled";
820
+ /** One case in an inline eval dataset (`POST /eval-runs` `dataset`). */
821
+ interface InlineEvalCaseSpec {
822
+ name?: string;
823
+ input: {
824
+ role?: "user";
825
+ content: string;
826
+ expected?: string | null;
827
+ };
828
+ scorers?: Record<string, unknown>[];
829
+ toolMocks?: Record<string, unknown>;
830
+ tags?: string[];
831
+ }
832
+ /** Inline eval dataset blob (`POST /eval-runs` `dataset`). */
833
+ interface InlineEvalDatasetSpec {
834
+ name?: string;
835
+ toolMocks?: Record<string, unknown>;
836
+ cases: InlineEvalCaseSpec[];
837
+ }
838
+ /** Saved-agent overrides on `POST /eval-runs` (ignored for inline `agent`). */
839
+ interface AgentEvalOverrides {
840
+ systemPrompt?: string;
841
+ systemPromptAppend?: string;
842
+ model?: string;
843
+ llmProviderId?: string;
844
+ reasoningLevel?: "low" | "medium" | "high";
845
+ disableTools?: boolean;
846
+ toolAllowlist?: string[];
847
+ disabledMocks?: string[];
848
+ }
849
+ /** Body for `POST /eval-runs`. Exactly one of `datasetId`/`dataset` and `agentId`/`agent`. */
850
+ interface CreateEvalRunRequest {
851
+ datasetId?: string;
852
+ dataset?: InlineEvalDatasetSpec;
853
+ agentId?: string;
854
+ agent?: AgentSpecBase;
855
+ modelId?: string;
856
+ overrides?: AgentEvalOverrides;
857
+ }
858
+ interface EvalDatasetSummary {
859
+ id: string;
860
+ name: string;
861
+ description: string | null;
862
+ caseCount: number;
863
+ runCount: number;
864
+ createdAt: string;
865
+ updatedAt: string;
866
+ }
867
+ interface EvalDatasetList {
868
+ datasets: EvalDatasetSummary[];
869
+ }
870
+ interface EvalCase {
871
+ id: string;
872
+ name: string;
873
+ input: Record<string, unknown>;
874
+ scorers: Record<string, unknown>[];
875
+ tags: string[];
876
+ toolMocks: Record<string, unknown> | null;
877
+ createdAt: string;
878
+ updatedAt: string;
879
+ }
880
+ interface EvalDatasetDetail {
881
+ id: string;
882
+ name: string;
883
+ description: string | null;
884
+ toolMocks: Record<string, unknown> | null;
885
+ cases: EvalCase[];
886
+ createdAt: string;
887
+ updatedAt: string;
888
+ }
889
+ interface EvalRunAccepted {
890
+ runId: string;
891
+ status: string;
892
+ streamUrl: string;
893
+ }
894
+ interface EvalRunSummary {
895
+ id: string;
896
+ datasetId: string;
897
+ datasetName: string;
898
+ agentId: string | null;
899
+ inlineAgent: boolean;
900
+ status: EvalRunStatus;
901
+ totalCases: number;
902
+ completedCases: number;
903
+ passedCases: number;
904
+ score: number | null;
905
+ tokenUsage: Record<string, unknown> | null;
906
+ error: string | null;
907
+ agentOverrides: Record<string, unknown> | null;
908
+ startedAt: string | null;
909
+ finishedAt: string | null;
910
+ createdAt: string;
911
+ }
912
+ interface EvalCaseResult {
913
+ id: string;
914
+ caseId: string;
915
+ case: EvalCase;
916
+ finalText: string | null;
917
+ toolCalls: Record<string, unknown>[];
918
+ scores: Record<string, unknown>[];
919
+ passed: boolean;
920
+ score: number;
921
+ tokens: Record<string, unknown> | null;
922
+ latencyMs: number | null;
923
+ error: string | null;
924
+ createdAt: string;
925
+ }
926
+ interface EvalRunDetail extends EvalRunSummary {
927
+ inlineAgentSpec: Record<string, unknown> | null;
928
+ agentSpecSnapshot: Record<string, unknown> | null;
929
+ updatedAt: string;
930
+ results: EvalCaseResult[];
931
+ }
932
+ interface EvalRunList {
933
+ runs: EvalRunSummary[];
934
+ limit: number;
935
+ offset: number;
936
+ }
937
+ interface EvalRunCompareSide {
938
+ id: string;
939
+ agentId: string | null;
940
+ inlineAgent: boolean;
941
+ status: string;
942
+ totalCases: number;
943
+ completedCases: number;
944
+ passedCases: number;
945
+ score: number | null;
946
+ tokenUsage: Record<string, unknown> | null;
947
+ agentOverrides: Record<string, unknown> | null;
948
+ agentSpecSnapshot: Record<string, unknown> | null;
949
+ startedAt: string | null;
950
+ finishedAt: string | null;
951
+ createdAt: string;
952
+ }
953
+ interface EvalRunCompareCase {
954
+ caseId: string;
955
+ caseName: string;
956
+ caseInput: Record<string, unknown> | null;
957
+ a: Record<string, unknown> | null;
958
+ b: Record<string, unknown> | null;
959
+ }
960
+ interface EvalRunCompare {
961
+ datasetId: string;
962
+ datasetName: string;
963
+ runA: EvalRunCompareSide;
964
+ runB: EvalRunCompareSide;
965
+ cases: EvalRunCompareCase[];
966
+ }
967
+ /** One SSE frame from `GET /eval-runs/:runId/stream`. */
968
+ interface EvalRunEvent {
969
+ type: string;
970
+ [key: string]: unknown;
971
+ }
972
+ interface ListEvalRunsOptions {
973
+ datasetId?: string;
974
+ agentId?: string;
975
+ status?: EvalRunStatus | string;
976
+ limit?: number;
977
+ offset?: number;
978
+ }
979
+ interface RunEvalOptions {
980
+ /** Called for each SSE frame while the run is in flight. */
981
+ onEvent?: (event: EvalRunEvent) => void;
982
+ /** Poll interval when SSE is unavailable or ends early. Default 1000ms. */
983
+ pollIntervalMs?: number;
984
+ signal?: AbortSignal;
985
+ }
803
986
  interface MantyxClientOptions {
804
987
  /**
805
988
  * Workspace API key (token prefix `mantyx_`) **or** a MANTYX OAuth 2.0
@@ -833,7 +1016,8 @@ interface MantyxClientOptions {
833
1016
  *
834
1017
  * OAuth tokens additionally enforce per-route **scopes**
835
1018
  * (`runs:read`, `runs:write`, `sessions:read`, `sessions:write`,
836
- * `models:read`, `feedback:write`, `mantyx.identity:read`); see
1019
+ * `models:read`, `feedback:write`, `evals:read`, `evals:write`,
1020
+ * `mantyx.identity:read`); see
837
1021
  * `docs/agent-runs-protocol.md` §2.2 for the table. Missing scopes
838
1022
  * land as {@link MantyxScopeError} so callers can route the user
839
1023
  * back to a re-consent flow.
@@ -1664,6 +1848,22 @@ declare class MantyxClient {
1664
1848
  * the same response body. See `docs/agent-runs-protocol.md` §9a.
1665
1849
  */
1666
1850
  submitRunFeedback(runId: string, input: RunFeedbackInput): Promise<RunFeedbackResult>;
1851
+ listEvalDatasets(): Promise<EvalDatasetList>;
1852
+ getEvalDataset(datasetId: string): Promise<EvalDatasetDetail>;
1853
+ createEvalRun(spec: CreateEvalRunRequest): Promise<EvalRunAccepted>;
1854
+ listEvalRuns(options?: ListEvalRunsOptions): Promise<EvalRunList>;
1855
+ compareEvalRuns(runA: string, runB: string): Promise<EvalRunCompare>;
1856
+ getEvalRun(runId: string): Promise<EvalRunDetail>;
1857
+ streamEvalRun(runId: string, signal?: AbortSignal): AsyncGenerator<EvalRunEvent, void, void>;
1858
+ cancelEvalRun(runId: string): Promise<{
1859
+ ok: boolean;
1860
+ }>;
1861
+ /**
1862
+ * Start an eval run and block until it reaches a terminal status.
1863
+ * Tails the SSE stream for live `onEvent` callbacks while polling
1864
+ * `getEvalRun` until `status` is terminal.
1865
+ */
1866
+ runEval(spec: CreateEvalRunRequest, options?: RunEvalOptions): Promise<EvalRunDetail>;
1667
1867
  private absoluteUrl;
1668
1868
  /**
1669
1869
  * Resolve the bearer credential to send on the next request. With a
@@ -1826,4 +2026,4 @@ interface LocalHandlers {
1826
2026
  */
1827
2027
  declare function parseRunOutput<T = unknown>(result: RunResult, validator?: (value: unknown) => T): T;
1828
2028
 
1829
- export { type McpToolRef as $, type A2AToolRef as A, MantyxAuthError as B, type CancelledEvent as C, DEFAULT_BASE_URL as D, type ErrorEvent as E, type MantyxClientOptions as F, MantyxError as G, type MantyxMcpOptions as H, type InputFileAttachment as I, MantyxNetworkError as J, MantyxOAuthClient as K, type LocalA2ATool as L, MantyxClient as M, type MantyxOAuthClientOptions as N, type OutputSchema as O, MantyxOAuthError as P, MantyxParseError as Q, type ReasoningLevel as R, type MantyxPluginToolRef as S, type ToolRef as T, MantyxRunError as U, type MantyxRunErrorInit as V, type MantyxRunErrorModel as W, type MantyxRunErrorTokens as X, MantyxScopeError as Y, MantyxToolError as Z, type MantyxToolRef as _, AgentSession as a, type MessageAttachment as a0, type ModelCatalog as a1, type ModelInfo as a2, type OAuthToken as a3, type OutputSchemaValue as a4, type PlanOptions as a5, type PlanSpec as a6, type ReasoningTrigger as a7, type RefreshOptions as a8, type RefreshTokenSourceOptions as a9, type TokenSource as aA, type ToolBudget as aB, type ToolBudgetExceededEvent as aC, type ToolBudgets as aD, type ToolResultFile as aE, type UserMessageEvent as aF, type ZodLikeObject as aG, defineLocalA2A as aH, defineLocalMcp as aI, defineLocalTool as aJ, inputFileAttachment as aK, inputFileUrlAttachment as aL, isLocalA2ATool as aM, isLocalMcpServer as aN, isLocalTool as aO, mantyxA2A as aP, mantyxMcp as aQ, mantyxPluginTool as aR, mantyxTool as aS, parseRunOutput as aT, planOnly as aU, type ResultEvent as aa, type RevokeOptions as ab, type RunEvent as ac, type RunEventBase as ad, type RunFeedbackInput as ae, type RunFeedbackResult as af, type RunFeedbackVerdict as ag, type RunModelInfo as ah, type RunResult as ai, type RunSpec as aj, type RunTokenUsage as ak, type ServerToolResultEvent as al, type SessionInfo as am, type SessionListResult as an, type SessionSpec as ao, type SessionSummary as ap, type Supervisor as aq, type SupervisorAction as ar, type SupervisorEvent as as, type SupervisorPhase as at, type TaskPlan as au, type TaskPlanEvent as av, type TaskPlanStep as aw, type TaskPlanStepStatus as ax, type ThinkingDeltaEvent as ay, type TokenRequestReason as az, type AgentSpecBase as b, type AssistantDeltaEvent as c, type AssistantMessageEvent as d, type AttachmentMetadata as e, type ConversationMessage as f, DEFAULT_OAUTH_BASE_URL as g, DEFAULT_REFRESH_SKEW_MS as h, type DefineLocalA2AOptions as i, type DefineLocalMcpOptions as j, type DefineLocalToolOptions as k, type InputFileAttachmentMetadata as l, type InputFileUrlAttachment as m, type InputFileUrlAttachmentMetadata as n, type LocalHandlers as o, type LocalMcpHttpTransport as p, type LocalMcpServer as q, type LocalMcpStdioTransport as r, type LocalTool as s, type LocalToolCallEvent as t, type LocalToolOutput as u, type LocalToolResult as v, type LocalToolResultInEvent as w, type LoopDetectedEvent as x, type LoopDetection as y, type MantyxA2AOptions as z };
2029
+ export { type LoopDetection as $, type A2AToolRef as A, type EvalRunSummary as B, type CancelledEvent as C, DEFAULT_BASE_URL as D, type ErrorEvent as E, type InlineEvalDatasetSpec as F, type InputFileAttachment as G, type InputFileAttachmentMetadata as H, type InlineEvalCaseSpec as I, type InputFileUrlAttachment as J, type InputFileUrlAttachmentMetadata as K, type ListEvalRunsOptions as L, MantyxClient as M, type LocalA2ATool as N, type OutputSchema as O, type LocalHandlers as P, type LocalMcpHttpTransport as Q, type ReasoningLevel as R, type LocalMcpServer as S, type ToolRef as T, type LocalMcpStdioTransport as U, type LocalTool as V, type LocalToolCallEvent as W, type LocalToolOutput as X, type LocalToolResult as Y, type LocalToolResultInEvent as Z, type LoopDetectedEvent as _, type AgentEvalOverrides as a, defineLocalA2A as a$, type MantyxA2AOptions as a0, MantyxAuthError as a1, type MantyxClientOptions as a2, MantyxError as a3, type MantyxMcpOptions as a4, MantyxNetworkError as a5, MantyxOAuthClient as a6, type MantyxOAuthClientOptions as a7, MantyxOAuthError as a8, MantyxParseError as a9, type RunFeedbackVerdict as aA, type RunModelInfo as aB, type RunResult as aC, type RunSpec as aD, type RunTokenUsage as aE, type ServerToolResultEvent as aF, type SessionInfo as aG, type SessionListResult as aH, type SessionSpec as aI, type SessionSummary as aJ, type Supervisor as aK, type SupervisorAction as aL, type SupervisorEvent as aM, type SupervisorPhase as aN, type TaskPlan as aO, type TaskPlanEvent as aP, type TaskPlanStep as aQ, type TaskPlanStepStatus as aR, type ThinkingDeltaEvent as aS, type TokenRequestReason as aT, type TokenSource as aU, type ToolBudget as aV, type ToolBudgetExceededEvent as aW, type ToolBudgets as aX, type ToolResultFile as aY, type UserMessageEvent as aZ, type ZodLikeObject as a_, type MantyxPluginToolRef as aa, MantyxRunError as ab, type MantyxRunErrorInit as ac, type MantyxRunErrorModel as ad, type MantyxRunErrorTokens as ae, MantyxScopeError as af, MantyxToolError as ag, type MantyxToolRef as ah, type McpToolRef as ai, type MessageAttachment as aj, type ModelCatalog as ak, type ModelInfo as al, type OAuthToken as am, type OutputSchemaValue as an, type PlanOptions as ao, type PlanSpec as ap, type ReasoningTrigger as aq, type RefreshOptions as ar, type RefreshTokenSourceOptions as as, type ResultEvent as at, type RevokeOptions as au, type RunEvalOptions as av, type RunEvent as aw, type RunEventBase as ax, type RunFeedbackInput as ay, type RunFeedbackResult as az, AgentSession as b, defineLocalMcp as b0, defineLocalTool as b1, inputFileAttachment as b2, inputFileUrlAttachment as b3, isLocalA2ATool as b4, isLocalMcpServer as b5, isLocalTool as b6, mantyxA2A as b7, mantyxMcp as b8, mantyxPluginTool as b9, mantyxTool as ba, parseRunOutput as bb, planOnly as bc, type AgentSpecBase as c, type AssistantDeltaEvent as d, type AssistantMessageEvent as e, type AttachmentMetadata as f, type ConversationMessage as g, type CreateEvalRunRequest as h, DEFAULT_OAUTH_BASE_URL as i, DEFAULT_REFRESH_SKEW_MS as j, type DefineLocalA2AOptions as k, type DefineLocalMcpOptions as l, type DefineLocalToolOptions as m, type EvalCase as n, type EvalCaseResult as o, type EvalDatasetDetail as p, type EvalDatasetList as q, type EvalDatasetSummary as r, type EvalRunAccepted as s, type EvalRunCompare as t, type EvalRunCompareCase as u, type EvalRunCompareSide as v, type EvalRunDetail as w, type EvalRunEvent as x, type EvalRunList as y, type EvalRunStatus as z };
@@ -1,4 +1,4 @@
1
- import { ai as RunResult, M as MantyxClient, R as ReasoningLevel, s as LocalTool } from './client-CLT46vp5.cjs';
1
+ import { aC as RunResult, M as MantyxClient, R as ReasoningLevel, V as LocalTool } from './client-D4-MQANp.cjs';
2
2
 
3
3
  /** Scroll direction shared by `scroll_at` / `scroll_document`. */
4
4
  type ScrollDirection = "up" | "down" | "left" | "right";
@@ -1,4 +1,4 @@
1
- import { ai as RunResult, M as MantyxClient, R as ReasoningLevel, s as LocalTool } from './client-CLT46vp5.js';
1
+ import { aC as RunResult, M as MantyxClient, R as ReasoningLevel, V as LocalTool } from './client-D4-MQANp.js';
2
2
 
3
3
  /** Scroll direction shared by `scroll_at` / `scroll_document`. */
4
4
  type ScrollDirection = "up" | "down" | "left" | "right";