@mantyx/sdk 0.19.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.
- package/CHANGELOG.md +7 -0
- package/dist/a2a-server.cjs.map +1 -1
- package/dist/a2a-server.d.cts +1 -1
- package/dist/a2a-server.d.ts +1 -1
- package/dist/a2a-server.js +1 -1
- package/dist/{chunk-PRUOUTDL.js → chunk-ZOFQ5AN6.js} +133 -1
- package/dist/chunk-ZOFQ5AN6.js.map +1 -0
- package/dist/{client-IcPVJ_lf.d.cts → client-D4-MQANp.d.cts} +187 -2
- package/dist/{client-IcPVJ_lf.d.ts → client-D4-MQANp.d.ts} +187 -2
- package/dist/{computer-use-C037Wspg.d.cts → computer-use-D4hBi1Tm.d.cts} +1 -1
- package/dist/{computer-use-vEaAPHfv.d.ts → computer-use-DUFbgsSU.d.ts} +1 -1
- package/dist/index.cjs +133 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/playwright.d.cts +2 -2
- package/dist/playwright.d.ts +2 -2
- package/package.json +1 -1
- package/dist/chunk-PRUOUTDL.js.map +0 -1
package/dist/a2a-server.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { AgentCard } from '@a2a-js/sdk';
|
|
|
2
2
|
export { AgentCard, Message, MessageSendParams, Task, TaskArtifactUpdateEvent, TaskStatusUpdateEvent } from '@a2a-js/sdk';
|
|
3
3
|
import { AgentExecutor, RequestContext, ExecutionEventBus } from '@a2a-js/sdk/server';
|
|
4
4
|
export { AgentExecutor, ExecutionEventBus, RequestContext } from '@a2a-js/sdk/server';
|
|
5
|
-
import { M as MantyxClient, T as ToolRef, R as ReasoningLevel, O as OutputSchema } from './client-
|
|
5
|
+
import { M as MantyxClient, T as ToolRef, R as ReasoningLevel, O as OutputSchema } from './client-D4-MQANp.cjs';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
|
8
8
|
/**
|
package/dist/a2a-server.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { AgentCard } from '@a2a-js/sdk';
|
|
|
2
2
|
export { AgentCard, Message, MessageSendParams, Task, TaskArtifactUpdateEvent, TaskStatusUpdateEvent } from '@a2a-js/sdk';
|
|
3
3
|
import { AgentExecutor, RequestContext, ExecutionEventBus } from '@a2a-js/sdk/server';
|
|
4
4
|
export { AgentExecutor, ExecutionEventBus, RequestContext } from '@a2a-js/sdk/server';
|
|
5
|
-
import { M as MantyxClient, T as ToolRef, R as ReasoningLevel, O as OutputSchema } from './client-
|
|
5
|
+
import { M as MantyxClient, T as ToolRef, R as ReasoningLevel, O as OutputSchema } from './client-D4-MQANp.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
|
8
8
|
/**
|
package/dist/a2a-server.js
CHANGED
|
@@ -667,6 +667,7 @@ function inputFileUrlAttachment(opts) {
|
|
|
667
667
|
return { type: "input_file_url", ...opts };
|
|
668
668
|
}
|
|
669
669
|
var RUN_FEEDBACK_EXPLANATION_MAX = 8e3;
|
|
670
|
+
var EVAL_TERMINAL_STATUSES = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled"]);
|
|
670
671
|
function planOnly(options = {}) {
|
|
671
672
|
return {
|
|
672
673
|
planOnly: true,
|
|
@@ -1056,6 +1057,113 @@ var MantyxClient = class {
|
|
|
1056
1057
|
body
|
|
1057
1058
|
});
|
|
1058
1059
|
}
|
|
1060
|
+
// --------------------------------------------------------------- Evals
|
|
1061
|
+
async listEvalDatasets() {
|
|
1062
|
+
return this.request({
|
|
1063
|
+
method: "GET",
|
|
1064
|
+
path: "/eval-datasets"
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
async getEvalDataset(datasetId) {
|
|
1068
|
+
return this.request({
|
|
1069
|
+
method: "GET",
|
|
1070
|
+
path: `/eval-datasets/${encodeURIComponent(datasetId)}`
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
async createEvalRun(spec) {
|
|
1074
|
+
return this.request({
|
|
1075
|
+
method: "POST",
|
|
1076
|
+
path: "/eval-runs",
|
|
1077
|
+
body: serializeCreateEvalRunRequest(spec)
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
async listEvalRuns(options = {}) {
|
|
1081
|
+
const params = new URLSearchParams();
|
|
1082
|
+
if (options.datasetId) params.set("datasetId", options.datasetId);
|
|
1083
|
+
if (options.agentId) params.set("agentId", options.agentId);
|
|
1084
|
+
if (options.status) params.set("status", options.status);
|
|
1085
|
+
if (options.limit !== void 0) params.set("limit", String(options.limit));
|
|
1086
|
+
if (options.offset !== void 0) params.set("offset", String(options.offset));
|
|
1087
|
+
const qs = params.toString();
|
|
1088
|
+
return this.request({
|
|
1089
|
+
method: "GET",
|
|
1090
|
+
path: qs ? `/eval-runs?${qs}` : "/eval-runs"
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
async compareEvalRuns(runA, runB) {
|
|
1094
|
+
const params = new URLSearchParams({ a: runA, b: runB });
|
|
1095
|
+
return this.request({
|
|
1096
|
+
method: "GET",
|
|
1097
|
+
path: `/eval-runs/compare?${params}`
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
async getEvalRun(runId) {
|
|
1101
|
+
return this.request({
|
|
1102
|
+
method: "GET",
|
|
1103
|
+
path: `/eval-runs/${encodeURIComponent(runId)}`
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
async *streamEvalRun(runId, signal) {
|
|
1107
|
+
const url = this.absoluteUrl(`/eval-runs/${encodeURIComponent(runId)}/stream`);
|
|
1108
|
+
const res = await this.openSseStream(url, 0, signal);
|
|
1109
|
+
try {
|
|
1110
|
+
for await (const frame of readSseStream(res.body, { signal })) {
|
|
1111
|
+
if (!frame.data) continue;
|
|
1112
|
+
let parsed;
|
|
1113
|
+
try {
|
|
1114
|
+
parsed = JSON.parse(frame.data);
|
|
1115
|
+
} catch (err) {
|
|
1116
|
+
throw new MantyxParseError(
|
|
1117
|
+
`invalid eval SSE JSON: ${frame.data.slice(0, 200)}`,
|
|
1118
|
+
frame.data,
|
|
1119
|
+
{ cause: err }
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1122
|
+
yield parsed;
|
|
1123
|
+
if (parsed.type === "run_completed" || parsed.type === "run_error" || parsed.type === "run_cancelled") {
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
} finally {
|
|
1128
|
+
await res.body?.cancel().catch(() => void 0);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
async cancelEvalRun(runId) {
|
|
1132
|
+
return this.request({
|
|
1133
|
+
method: "POST",
|
|
1134
|
+
path: `/eval-runs/${encodeURIComponent(runId)}/cancel`
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Start an eval run and block until it reaches a terminal status.
|
|
1139
|
+
* Tails the SSE stream for live `onEvent` callbacks while polling
|
|
1140
|
+
* `getEvalRun` until `status` is terminal.
|
|
1141
|
+
*/
|
|
1142
|
+
async runEval(spec, options = {}) {
|
|
1143
|
+
const accepted = await this.createEvalRun(spec);
|
|
1144
|
+
const pollMs = options.pollIntervalMs ?? 1e3;
|
|
1145
|
+
const streamDone = (async () => {
|
|
1146
|
+
try {
|
|
1147
|
+
for await (const ev of this.streamEvalRun(accepted.runId, options.signal)) {
|
|
1148
|
+
options.onEvent?.(ev);
|
|
1149
|
+
}
|
|
1150
|
+
} catch (err) {
|
|
1151
|
+
if (!(err instanceof MantyxNetworkError)) throw err;
|
|
1152
|
+
}
|
|
1153
|
+
})();
|
|
1154
|
+
try {
|
|
1155
|
+
while (true) {
|
|
1156
|
+
if (options.signal?.aborted) {
|
|
1157
|
+
throw new MantyxNetworkError("eval run wait aborted", { cause: options.signal.reason });
|
|
1158
|
+
}
|
|
1159
|
+
const detail = await this.getEvalRun(accepted.runId);
|
|
1160
|
+
if (EVAL_TERMINAL_STATUSES.has(detail.status)) return detail;
|
|
1161
|
+
await sleep(pollMs);
|
|
1162
|
+
}
|
|
1163
|
+
} finally {
|
|
1164
|
+
await streamDone.catch(() => void 0);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1059
1167
|
// -------------------------------------------------------------- HTTP
|
|
1060
1168
|
absoluteUrl(path) {
|
|
1061
1169
|
return `${this.options.baseUrl}/api/v1/workspaces/${encodeURIComponent(this.options.workspaceSlug)}${path}`;
|
|
@@ -1321,6 +1429,30 @@ function serializeAgentSpec(spec, extra = {}) {
|
|
|
1321
1429
|
Object.assign(body, serializeTurnInput(extra));
|
|
1322
1430
|
return body;
|
|
1323
1431
|
}
|
|
1432
|
+
function serializeCreateEvalRunRequest(spec) {
|
|
1433
|
+
const hasDataset = spec.datasetId !== void 0 || spec.dataset !== void 0;
|
|
1434
|
+
const hasAgent = spec.agentId !== void 0 || spec.agent !== void 0;
|
|
1435
|
+
if (!hasDataset) {
|
|
1436
|
+
throw new MantyxError("createEvalRun requires exactly one of `datasetId` or `dataset`");
|
|
1437
|
+
}
|
|
1438
|
+
if (spec.datasetId !== void 0 && spec.dataset !== void 0) {
|
|
1439
|
+
throw new MantyxError("createEvalRun accepts only one of `datasetId` or `dataset`");
|
|
1440
|
+
}
|
|
1441
|
+
if (!hasAgent) {
|
|
1442
|
+
throw new MantyxError("createEvalRun requires exactly one of `agentId` or `agent`");
|
|
1443
|
+
}
|
|
1444
|
+
if (spec.agentId !== void 0 && spec.agent !== void 0) {
|
|
1445
|
+
throw new MantyxError("createEvalRun accepts only one of `agentId` or `agent`");
|
|
1446
|
+
}
|
|
1447
|
+
const body = {};
|
|
1448
|
+
if (spec.datasetId) body.datasetId = spec.datasetId;
|
|
1449
|
+
if (spec.dataset) body.dataset = spec.dataset;
|
|
1450
|
+
if (spec.agentId) body.agentId = spec.agentId;
|
|
1451
|
+
if (spec.agent) body.agent = serializeAgentSpec(spec.agent);
|
|
1452
|
+
if (spec.modelId) body.modelId = spec.modelId;
|
|
1453
|
+
if (spec.overrides) body.overrides = spec.overrides;
|
|
1454
|
+
return body;
|
|
1455
|
+
}
|
|
1324
1456
|
function serializeToolRefs(tools) {
|
|
1325
1457
|
return tools.map((t) => {
|
|
1326
1458
|
switch (t.kind) {
|
|
@@ -1783,4 +1915,4 @@ export {
|
|
|
1783
1915
|
AgentSession,
|
|
1784
1916
|
parseRunOutput
|
|
1785
1917
|
};
|
|
1786
|
-
//# sourceMappingURL=chunk-
|
|
1918
|
+
//# sourceMappingURL=chunk-ZOFQ5AN6.js.map
|