@mantyx/sdk 0.20.0 → 0.21.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 +11 -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-ZOFQ5AN6.js → chunk-QMUVI3Y3.js} +62 -19
- package/dist/chunk-QMUVI3Y3.js.map +1 -0
- package/dist/{client-D4-MQANp.d.cts → client-C7TzTpNW.d.cts} +4 -0
- package/dist/{client-D4-MQANp.d.ts → client-C7TzTpNW.d.ts} +4 -0
- package/dist/{computer-use-D4hBi1Tm.d.cts → computer-use-1m6E_VIl.d.cts} +1 -1
- package/dist/{computer-use-DUFbgsSU.d.ts → computer-use-4QzI3lGU.d.ts} +1 -1
- package/dist/index.cjs +62 -19
- 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-ZOFQ5AN6.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-C7TzTpNW.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-C7TzTpNW.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
|
8
8
|
/**
|
package/dist/a2a-server.js
CHANGED
|
@@ -1071,6 +1071,10 @@ var MantyxClient = class {
|
|
|
1071
1071
|
});
|
|
1072
1072
|
}
|
|
1073
1073
|
async createEvalRun(spec) {
|
|
1074
|
+
const tools = spec.tools ?? [];
|
|
1075
|
+
if (tools.length > 0) {
|
|
1076
|
+
await resolveLocalRefs(tools, { fetch: this.options.fetch });
|
|
1077
|
+
}
|
|
1074
1078
|
return this.request({
|
|
1075
1079
|
method: "POST",
|
|
1076
1080
|
path: "/eval-runs",
|
|
@@ -1140,28 +1144,49 @@ var MantyxClient = class {
|
|
|
1140
1144
|
* `getEvalRun` until `status` is terminal.
|
|
1141
1145
|
*/
|
|
1142
1146
|
async runEval(spec, options = {}) {
|
|
1143
|
-
const
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
options.onEvent?.(ev);
|
|
1149
|
-
}
|
|
1150
|
-
} catch (err) {
|
|
1151
|
-
if (!(err instanceof MantyxNetworkError)) throw err;
|
|
1152
|
-
}
|
|
1153
|
-
})();
|
|
1147
|
+
const tools = options.tools ?? spec.tools ?? [];
|
|
1148
|
+
if (tools.length > 0) {
|
|
1149
|
+
await resolveLocalRefs(tools, { fetch: this.options.fetch });
|
|
1150
|
+
}
|
|
1151
|
+
const handlers = collectLocalHandlers(tools);
|
|
1154
1152
|
try {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1153
|
+
const accepted = await this.createEvalRun({
|
|
1154
|
+
...spec,
|
|
1155
|
+
...tools.length > 0 ? { tools } : {}
|
|
1156
|
+
});
|
|
1157
|
+
const pollMs = options.pollIntervalMs ?? 1e3;
|
|
1158
|
+
const streamDone = (async () => {
|
|
1159
|
+
try {
|
|
1160
|
+
for await (const ev of this.streamEvalRun(accepted.runId, options.signal)) {
|
|
1161
|
+
if (ev.type === "local_tool_call" && tools.length > 0) {
|
|
1162
|
+
const record = ev;
|
|
1163
|
+
const nested = typeof record.data === "object" && record.data !== null && !Array.isArray(record.data) ? record.data : void 0;
|
|
1164
|
+
const agentRunId = typeof record.agentRunId === "string" ? record.agentRunId : typeof nested?.agentRunId === "string" ? nested.agentRunId : "";
|
|
1165
|
+
if (agentRunId) {
|
|
1166
|
+
const localEv = evalEventToLocalToolCall(ev);
|
|
1167
|
+
void this.dispatchLocalTool(agentRunId, localEv, handlers).catch(() => void 0);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
options.onEvent?.(ev);
|
|
1171
|
+
}
|
|
1172
|
+
} catch (err) {
|
|
1173
|
+
if (!(err instanceof MantyxNetworkError)) throw err;
|
|
1174
|
+
}
|
|
1175
|
+
})();
|
|
1176
|
+
try {
|
|
1177
|
+
while (true) {
|
|
1178
|
+
if (options.signal?.aborted) {
|
|
1179
|
+
throw new MantyxNetworkError("eval run wait aborted", { cause: options.signal.reason });
|
|
1180
|
+
}
|
|
1181
|
+
const detail = await this.getEvalRun(accepted.runId);
|
|
1182
|
+
if (EVAL_TERMINAL_STATUSES.has(detail.status)) return detail;
|
|
1183
|
+
await sleep(pollMs);
|
|
1158
1184
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
await sleep(pollMs);
|
|
1185
|
+
} finally {
|
|
1186
|
+
await streamDone.catch(() => void 0);
|
|
1162
1187
|
}
|
|
1163
1188
|
} finally {
|
|
1164
|
-
await
|
|
1189
|
+
await closeMcpRefs(tools);
|
|
1165
1190
|
}
|
|
1166
1191
|
}
|
|
1167
1192
|
// -------------------------------------------------------------- HTTP
|
|
@@ -1449,10 +1474,28 @@ function serializeCreateEvalRunRequest(spec) {
|
|
|
1449
1474
|
if (spec.dataset) body.dataset = spec.dataset;
|
|
1450
1475
|
if (spec.agentId) body.agentId = spec.agentId;
|
|
1451
1476
|
if (spec.agent) body.agent = serializeAgentSpec(spec.agent);
|
|
1477
|
+
if (spec.tools && spec.tools.length > 0 && spec.agentId) {
|
|
1478
|
+
body.tools = serializeToolRefs(spec.tools);
|
|
1479
|
+
}
|
|
1452
1480
|
if (spec.modelId) body.modelId = spec.modelId;
|
|
1453
1481
|
if (spec.overrides) body.overrides = spec.overrides;
|
|
1454
1482
|
return body;
|
|
1455
1483
|
}
|
|
1484
|
+
function evalEventToLocalToolCall(ev) {
|
|
1485
|
+
const data = ev.data && typeof ev.data === "object" && !Array.isArray(ev.data) ? ev.data : ev;
|
|
1486
|
+
return {
|
|
1487
|
+
type: "local_tool_call",
|
|
1488
|
+
seq: 0,
|
|
1489
|
+
toolUseId: String(data.toolUseId ?? ""),
|
|
1490
|
+
name: String(data.name ?? ""),
|
|
1491
|
+
args: data.args ?? {},
|
|
1492
|
+
...typeof data.kind === "string" ? { kind: data.kind } : {},
|
|
1493
|
+
...data.agentCard !== void 0 ? { agentCard: data.agentCard } : {},
|
|
1494
|
+
...typeof data.mcpServer === "string" ? { mcpServer: data.mcpServer } : {},
|
|
1495
|
+
...typeof data.mcpToolName === "string" ? { mcpToolName: data.mcpToolName } : {},
|
|
1496
|
+
...data.mcpServerInfo !== void 0 ? { mcpServerInfo: data.mcpServerInfo } : {}
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1456
1499
|
function serializeToolRefs(tools) {
|
|
1457
1500
|
return tools.map((t) => {
|
|
1458
1501
|
switch (t.kind) {
|
|
@@ -1915,4 +1958,4 @@ export {
|
|
|
1915
1958
|
AgentSession,
|
|
1916
1959
|
parseRunOutput
|
|
1917
1960
|
};
|
|
1918
|
-
//# sourceMappingURL=chunk-
|
|
1961
|
+
//# sourceMappingURL=chunk-QMUVI3Y3.js.map
|