@mantyx/sdk 0.24.0 → 2026.9.2
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 +28 -1
- package/LICENSE +201 -0
- package/README.md +35 -12
- package/dist/a2a-server.cjs +11 -1
- package/dist/a2a-server.d.ts +2 -1
- package/dist/a2a-server.js +3 -2
- package/dist/{chunk-OUK6ZZ5H.js → chunk-XMNAWLMF.js} +75 -2
- package/dist/client.d.ts +59 -7
- package/dist/computer-use.d.ts +0 -1
- package/dist/errors.d.ts +13 -1
- package/dist/index.cjs +76 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -3
- package/dist/local-resolver.d.ts +0 -1
- package/dist/oauth.d.ts +0 -1
- package/dist/playwright.cjs +0 -1
- package/dist/playwright.d.ts +0 -1
- package/dist/playwright.js +0 -1
- package/dist/sse.d.ts +0 -1
- package/dist/structured-output.d.ts +11 -0
- package/dist/tools.d.ts +0 -1
- package/dist/version.d.ts +2 -3
- package/dist/zod-to-json-schema.d.ts +0 -1
- package/docs/agent-runs-protocol.md +238 -89
- package/docs/wire-protocol.md +201 -82
- package/package.json +17 -18
- package/CONTRIBUTING.md +0 -72
- package/EXTRACT.md +0 -70
- package/dist/a2a-server.cjs.map +0 -1
- package/dist/a2a-server.d.ts.map +0 -1
- package/dist/a2a-server.js.map +0 -1
- package/dist/chunk-OUK6ZZ5H.js.map +0 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/computer-use.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/local-resolver.d.ts.map +0 -1
- package/dist/oauth.d.ts.map +0 -1
- package/dist/playwright.cjs.map +0 -1
- package/dist/playwright.d.ts.map +0 -1
- package/dist/playwright.js.map +0 -1
- package/dist/sse.d.ts.map +0 -1
- package/dist/tools.d.ts.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/zod-to-json-schema.d.ts.map +0 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TokenSource } from "./oauth.js";
|
|
2
|
+
import type { OutputSchemaEnforcement, StructuredOutputInfo } from "./structured-output.js";
|
|
2
3
|
import type { LocalA2ATool, LocalMcpServer, LocalTool, LocalToolSchemaInput, ReasoningLevel, ToolRef, ToolResultFile } from "./tools.js";
|
|
3
4
|
export declare const DEFAULT_BASE_URL = "https://app.mantyx.io";
|
|
4
5
|
/** Inline file bytes for a user message (base64, no data-URL prefix). */
|
|
@@ -101,6 +102,7 @@ export interface AgentEvalOverrides {
|
|
|
101
102
|
}
|
|
102
103
|
/** Body for `POST /eval-runs`. Exactly one of `datasetId`/`dataset` and `agentId`/`agent`. */
|
|
103
104
|
export interface CreateEvalRunRequest {
|
|
105
|
+
newLoop?: boolean;
|
|
104
106
|
datasetId?: string;
|
|
105
107
|
dataset?: InlineEvalDatasetSpec;
|
|
106
108
|
agentId?: string;
|
|
@@ -341,6 +343,8 @@ export interface AgentSpecBase {
|
|
|
341
343
|
systemPrompt?: string;
|
|
342
344
|
modelId?: string;
|
|
343
345
|
tools?: ToolRef[];
|
|
346
|
+
/** Opt into the verified loop; omission preserves legacy behavior or session inheritance. */
|
|
347
|
+
newLoop?: boolean;
|
|
344
348
|
/**
|
|
345
349
|
* Provider thinking strength: a string anchor (`"off" | "low" | "medium" |
|
|
346
350
|
* "high"`) or an integer in `0..100` (where `0` explicitly disables provider
|
|
@@ -355,9 +359,10 @@ export interface AgentSpecBase {
|
|
|
355
359
|
maxToolTurns?: number;
|
|
356
360
|
};
|
|
357
361
|
/**
|
|
358
|
-
*
|
|
359
|
-
* matching a JSON Schema. The terminal `result` event still
|
|
360
|
-
* reply as `text: string
|
|
362
|
+
* Asks the provider to constrain the model's **final assistant text** to a
|
|
363
|
+
* JSON document matching a JSON Schema. The terminal `result` event still
|
|
364
|
+
* carries the reply as `text: string`. Set `enforcement: "strict"` when
|
|
365
|
+
* provider rejection or unconstrained fallback must fail.
|
|
361
366
|
*
|
|
362
367
|
* `name` (optional) is a stable identifier the server forwards to the
|
|
363
368
|
* provider (OpenAI `text.format.name`, Anthropic synthetic-tool name).
|
|
@@ -494,6 +499,8 @@ export interface OutputSchema {
|
|
|
494
499
|
name?: string;
|
|
495
500
|
/** Required. Zod schema or JSON Schema describing the final assistant text. Root must be a JSON object. */
|
|
496
501
|
schema: OutputSchemaValue;
|
|
502
|
+
/** Enforcement policy. Omission preserves the platform's best-effort default. */
|
|
503
|
+
enforcement?: OutputSchemaEnforcement;
|
|
497
504
|
}
|
|
498
505
|
/**
|
|
499
506
|
* Loop-detection thresholds. See {@link AgentSpecBase.loopDetection} for the
|
|
@@ -723,6 +730,8 @@ export interface RunResult {
|
|
|
723
730
|
turns?: number;
|
|
724
731
|
/** Resolved model that executed the run. See {@link RunModelInfo}. */
|
|
725
732
|
model?: RunModelInfo;
|
|
733
|
+
/** Structured-output enforcement metadata, when reported by the server. */
|
|
734
|
+
structuredOutput?: StructuredOutputInfo;
|
|
726
735
|
/**
|
|
727
736
|
* Final structured checklist for `planOnly` runs. Undefined for normal
|
|
728
737
|
* executed runs (use `task_plan` events for live progress). See
|
|
@@ -940,6 +949,8 @@ export interface ResultEvent extends RunEventBase {
|
|
|
940
949
|
turns?: number;
|
|
941
950
|
/** Resolved model that executed the run. See {@link RunModelInfo}. */
|
|
942
951
|
model?: RunModelInfo;
|
|
952
|
+
/** Structured-output enforcement metadata, when reported by the server. */
|
|
953
|
+
structuredOutput?: StructuredOutputInfo;
|
|
943
954
|
}
|
|
944
955
|
export interface ErrorEvent extends RunEventBase {
|
|
945
956
|
type: "error";
|
|
@@ -990,6 +1001,12 @@ export interface ErrorEvent extends RunEventBase {
|
|
|
990
1001
|
turns?: number;
|
|
991
1002
|
/** Resolved model that executed the run. See {@link RunModelInfo}. */
|
|
992
1003
|
model?: RunModelInfo;
|
|
1004
|
+
/** Provider HTTP status associated with this terminal failure, when available. */
|
|
1005
|
+
apiStatus?: number;
|
|
1006
|
+
/** Provider-specific error code associated with this terminal failure, when available. */
|
|
1007
|
+
apiCode?: string;
|
|
1008
|
+
/** Structured-output enforcement metadata, when reported by the server. */
|
|
1009
|
+
structuredOutput?: StructuredOutputInfo;
|
|
993
1010
|
}
|
|
994
1011
|
export interface CancelledEvent extends RunEventBase {
|
|
995
1012
|
type: "cancelled";
|
|
@@ -1040,8 +1057,21 @@ export interface SessionListResult {
|
|
|
1040
1057
|
total: number;
|
|
1041
1058
|
limit: number;
|
|
1042
1059
|
offset: number;
|
|
1060
|
+
/** Opaque cursor for the next page. Absent on older MANTYX servers. */
|
|
1061
|
+
nextCursor?: string | null;
|
|
1043
1062
|
sessions: SessionSummary[];
|
|
1044
1063
|
}
|
|
1064
|
+
/** One bounded page from {@link MantyxClient.getSessionEventsPage}. */
|
|
1065
|
+
export interface SessionEventsPage {
|
|
1066
|
+
sessionId: string;
|
|
1067
|
+
/** Total messages in the session, not just this page. */
|
|
1068
|
+
total: number;
|
|
1069
|
+
events: RunEvent[];
|
|
1070
|
+
/** Pass this value back as `beforeSeq` to fetch the preceding page. */
|
|
1071
|
+
nextBeforeSeq: number | null;
|
|
1072
|
+
/** True when older messages remain before this page. */
|
|
1073
|
+
truncated: boolean;
|
|
1074
|
+
}
|
|
1045
1075
|
export declare class MantyxClient {
|
|
1046
1076
|
readonly options: Required<Pick<MantyxClientOptions, "workspaceSlug" | "baseUrl">> & {
|
|
1047
1077
|
/**
|
|
@@ -1109,6 +1139,8 @@ export declare class MantyxClient {
|
|
|
1109
1139
|
status?: "active" | "ended";
|
|
1110
1140
|
limit?: number;
|
|
1111
1141
|
offset?: number;
|
|
1142
|
+
/** Opaque `nextCursor` returned by the previous page. */
|
|
1143
|
+
cursor?: string;
|
|
1112
1144
|
}): Promise<SessionListResult>;
|
|
1113
1145
|
/**
|
|
1114
1146
|
* Fetch a session's conversation as realtime-style event frames so a UI can
|
|
@@ -1121,6 +1153,14 @@ export declare class MantyxClient {
|
|
|
1121
1153
|
full?: boolean;
|
|
1122
1154
|
lastMessages?: number;
|
|
1123
1155
|
}): Promise<RunEvent[]>;
|
|
1156
|
+
/**
|
|
1157
|
+
* Fetch one bounded page of session events. Pages are returned in ascending
|
|
1158
|
+
* sequence order; follow `nextBeforeSeq` to walk backward through history.
|
|
1159
|
+
*/
|
|
1160
|
+
getSessionEventsPage(sessionId: string, opts?: {
|
|
1161
|
+
lastMessages?: number;
|
|
1162
|
+
beforeSeq?: number;
|
|
1163
|
+
}): Promise<SessionEventsPage>;
|
|
1124
1164
|
/** Drive an existing run to completion (collect events, dispatch local tools). */
|
|
1125
1165
|
driveRun(runId: string, handlers: LocalHandlers, opts?: {
|
|
1126
1166
|
onAssistantDelta?: (delta: string) => void;
|
|
@@ -1219,6 +1259,8 @@ export declare class AgentSession {
|
|
|
1219
1259
|
* Per-message override for `reasoningLevel`. Applies only to this run
|
|
1220
1260
|
* and does not mutate the session's stored value.
|
|
1221
1261
|
*/
|
|
1262
|
+
/** Opt into the verified loop; omission preserves legacy behavior or session inheritance. */
|
|
1263
|
+
newLoop?: boolean;
|
|
1222
1264
|
reasoningLevel?: ReasoningLevel;
|
|
1223
1265
|
/**
|
|
1224
1266
|
* Per-message override for `outputSchema`. Applies only to this run
|
|
@@ -1252,6 +1294,8 @@ export declare class AgentSession {
|
|
|
1252
1294
|
signal?: AbortSignal;
|
|
1253
1295
|
attachments?: MessageAttachment[];
|
|
1254
1296
|
metadata?: Record<string, string>;
|
|
1297
|
+
/** Opt into the verified loop; omission preserves legacy behavior or session inheritance. */
|
|
1298
|
+
newLoop?: boolean;
|
|
1255
1299
|
reasoningLevel?: ReasoningLevel;
|
|
1256
1300
|
outputSchema?: OutputSchema;
|
|
1257
1301
|
loopDetection?: LoopDetection | false;
|
|
@@ -1267,6 +1311,8 @@ export declare class AgentSession {
|
|
|
1267
1311
|
onAssistantDelta?: (s: string) => void;
|
|
1268
1312
|
signal?: AbortSignal;
|
|
1269
1313
|
metadata?: Record<string, string>;
|
|
1314
|
+
/** Opt into the verified loop; omission preserves legacy behavior or session inheritance. */
|
|
1315
|
+
newLoop?: boolean;
|
|
1270
1316
|
reasoningLevel?: ReasoningLevel;
|
|
1271
1317
|
outputSchema?: OutputSchema;
|
|
1272
1318
|
loopDetection?: LoopDetection | false;
|
|
@@ -1277,6 +1323,14 @@ export declare class AgentSession {
|
|
|
1277
1323
|
}): Promise<RunResult>;
|
|
1278
1324
|
history(): Promise<ConversationMessage[]>;
|
|
1279
1325
|
info(): Promise<SessionInfo>;
|
|
1326
|
+
events(opts?: {
|
|
1327
|
+
full?: boolean;
|
|
1328
|
+
lastMessages?: number;
|
|
1329
|
+
}): Promise<RunEvent[]>;
|
|
1330
|
+
eventsPage(opts?: {
|
|
1331
|
+
lastMessages?: number;
|
|
1332
|
+
beforeSeq?: number;
|
|
1333
|
+
}): Promise<SessionEventsPage>;
|
|
1280
1334
|
end(): Promise<void>;
|
|
1281
1335
|
}
|
|
1282
1336
|
/** Internal registry of client-resolved handlers, indexed by `kind`. */
|
|
@@ -1293,9 +1347,8 @@ export declare function taskPlanFromEventData(data: Record<string, unknown>): Ta
|
|
|
1293
1347
|
/**
|
|
1294
1348
|
* Parse the terminal text of a `RunResult` as JSON.
|
|
1295
1349
|
*
|
|
1296
|
-
*
|
|
1297
|
-
*
|
|
1298
|
-
* cases. Transient model errors (refusal text, truncation under
|
|
1350
|
+
* Provider-enforced output should parse as JSON, but transient model errors
|
|
1351
|
+
* (refusal text, truncation under
|
|
1299
1352
|
* `max_tokens` pressure, exotic Unicode) can still produce strings that
|
|
1300
1353
|
* fail to `JSON.parse` in rare edge cases — this helper centralises that
|
|
1301
1354
|
* brittle step and surfaces a typed {@link MantyxParseError} on failure
|
|
@@ -1321,4 +1374,3 @@ export declare function taskPlanFromEventData(data: Record<string, unknown>): Ta
|
|
|
1321
1374
|
* ```
|
|
1322
1375
|
*/
|
|
1323
1376
|
export declare function parseRunOutput<T = unknown>(result: RunResult, validator?: (value: unknown) => T): T;
|
|
1324
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/computer-use.d.ts
CHANGED
|
@@ -189,4 +189,3 @@ export declare function extractActions(result: RunResult): ComputerUseActionCall
|
|
|
189
189
|
* console.log(out.finalText);
|
|
190
190
|
*/
|
|
191
191
|
export declare function runComputerUse(opts: RunComputerUseOptions): Promise<ComputerUseResult>;
|
|
192
|
-
//# sourceMappingURL=computer-use.d.ts.map
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Error types raised by the MANTYX SDK.
|
|
3
3
|
*/
|
|
4
|
+
import type { StructuredOutputInfo } from "./structured-output.js";
|
|
4
5
|
export declare class MantyxError extends Error {
|
|
5
6
|
readonly code: string;
|
|
6
7
|
readonly status: number | undefined;
|
|
@@ -116,6 +117,12 @@ export interface MantyxRunErrorInit {
|
|
|
116
117
|
turns?: number;
|
|
117
118
|
/** Resolved model that executed the run. See {@link MantyxRunErrorModel}. */
|
|
118
119
|
model?: MantyxRunErrorModel;
|
|
120
|
+
/** Provider HTTP status associated with the failure, when available. */
|
|
121
|
+
apiStatus?: number;
|
|
122
|
+
/** Provider-specific error code associated with the failure, when available. */
|
|
123
|
+
apiCode?: string;
|
|
124
|
+
/** Structured-output enforcement metadata, when reported by the server. */
|
|
125
|
+
structuredOutput?: StructuredOutputInfo;
|
|
119
126
|
}
|
|
120
127
|
export declare class MantyxRunError extends MantyxError {
|
|
121
128
|
readonly runId: string;
|
|
@@ -134,6 +141,12 @@ export declare class MantyxRunError extends MantyxError {
|
|
|
134
141
|
readonly turns: number | undefined;
|
|
135
142
|
/** See {@link MantyxRunErrorInit.model}. */
|
|
136
143
|
readonly model: MantyxRunErrorModel | undefined;
|
|
144
|
+
/** Provider HTTP status associated with the failure, when available. */
|
|
145
|
+
readonly apiStatus: number | undefined;
|
|
146
|
+
/** Provider-specific error code associated with the failure, when available. */
|
|
147
|
+
readonly apiCode: string | undefined;
|
|
148
|
+
/** Structured-output enforcement metadata, when reported by the server. */
|
|
149
|
+
readonly structuredOutput: StructuredOutputInfo | undefined;
|
|
137
150
|
constructor(runId: string, subtype: string, message: string, init?: MantyxRunErrorInit);
|
|
138
151
|
}
|
|
139
152
|
/**
|
|
@@ -150,4 +163,3 @@ export declare class MantyxParseError extends MantyxError {
|
|
|
150
163
|
cause?: unknown;
|
|
151
164
|
});
|
|
152
165
|
}
|
|
153
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -139,6 +139,12 @@ var MantyxRunError = class extends MantyxError {
|
|
|
139
139
|
turns;
|
|
140
140
|
/** See {@link MantyxRunErrorInit.model}. */
|
|
141
141
|
model;
|
|
142
|
+
/** Provider HTTP status associated with the failure, when available. */
|
|
143
|
+
apiStatus;
|
|
144
|
+
/** Provider-specific error code associated with the failure, when available. */
|
|
145
|
+
apiCode;
|
|
146
|
+
/** Structured-output enforcement metadata, when reported by the server. */
|
|
147
|
+
structuredOutput;
|
|
142
148
|
constructor(runId, subtype, message, init = {}) {
|
|
143
149
|
super(message, { code: subtype });
|
|
144
150
|
this.name = "MantyxRunError";
|
|
@@ -151,6 +157,9 @@ var MantyxRunError = class extends MantyxError {
|
|
|
151
157
|
this.tokens = init.tokens;
|
|
152
158
|
this.turns = init.turns;
|
|
153
159
|
this.model = init.model;
|
|
160
|
+
this.apiStatus = init.apiStatus;
|
|
161
|
+
this.apiCode = init.apiCode;
|
|
162
|
+
this.structuredOutput = init.structuredOutput;
|
|
154
163
|
}
|
|
155
164
|
};
|
|
156
165
|
var MantyxParseError = class extends MantyxError {
|
|
@@ -936,6 +945,7 @@ var MantyxClient = class {
|
|
|
936
945
|
if (opts.status) query.status = opts.status;
|
|
937
946
|
if (typeof opts.limit === "number") query.limit = opts.limit;
|
|
938
947
|
if (typeof opts.offset === "number") query.offset = opts.offset;
|
|
948
|
+
if (opts.cursor) query.cursor = opts.cursor;
|
|
939
949
|
return this.request({
|
|
940
950
|
method: "GET",
|
|
941
951
|
path: "/agent-sessions",
|
|
@@ -962,6 +972,28 @@ var MantyxClient = class {
|
|
|
962
972
|
});
|
|
963
973
|
return res.events ?? [];
|
|
964
974
|
}
|
|
975
|
+
/**
|
|
976
|
+
* Fetch one bounded page of session events. Pages are returned in ascending
|
|
977
|
+
* sequence order; follow `nextBeforeSeq` to walk backward through history.
|
|
978
|
+
*/
|
|
979
|
+
async getSessionEventsPage(sessionId, opts = {}) {
|
|
980
|
+
const query = {
|
|
981
|
+
lastMessages: opts.lastMessages ?? 100,
|
|
982
|
+
beforeSeq: opts.beforeSeq
|
|
983
|
+
};
|
|
984
|
+
const res = await this.request({
|
|
985
|
+
method: "GET",
|
|
986
|
+
path: `/agent-sessions/${encodeURIComponent(sessionId)}/events`,
|
|
987
|
+
query
|
|
988
|
+
});
|
|
989
|
+
return {
|
|
990
|
+
sessionId: res.sessionId,
|
|
991
|
+
total: res.total,
|
|
992
|
+
events: res.events ?? [],
|
|
993
|
+
nextBeforeSeq: res.nextBeforeSeq ?? null,
|
|
994
|
+
truncated: res.truncated ?? false
|
|
995
|
+
};
|
|
996
|
+
}
|
|
965
997
|
// ----------------------------------------------------------- Internals
|
|
966
998
|
/** Drive an existing run to completion (collect events, dispatch local tools). */
|
|
967
999
|
async driveRun(runId, handlers, opts = {}) {
|
|
@@ -970,6 +1002,7 @@ var MantyxClient = class {
|
|
|
970
1002
|
let tokens;
|
|
971
1003
|
let turns;
|
|
972
1004
|
let modelInfo;
|
|
1005
|
+
let structuredOutput;
|
|
973
1006
|
let plan;
|
|
974
1007
|
for await (const ev of this.streamRunEvents(runId, handlers, opts.signal)) {
|
|
975
1008
|
collected.push(ev);
|
|
@@ -982,6 +1015,7 @@ var MantyxClient = class {
|
|
|
982
1015
|
tokens = parseRunTokens(r.tokens) ?? tokens;
|
|
983
1016
|
turns = parseRunTurns(r.turns) ?? turns;
|
|
984
1017
|
modelInfo = parseRunModel(r.model) ?? modelInfo;
|
|
1018
|
+
structuredOutput = parseStructuredOutputInfo(r.structuredOutput) ?? structuredOutput;
|
|
985
1019
|
if (r.subtype === "success") {
|
|
986
1020
|
finalText = typeof r.text === "string" ? r.text : "";
|
|
987
1021
|
const parsedPlan = parseTaskPlan(r.plan);
|
|
@@ -993,6 +1027,7 @@ var MantyxClient = class {
|
|
|
993
1027
|
if (tokens !== void 0) errInit.tokens = tokens;
|
|
994
1028
|
if (turns !== void 0) errInit.turns = turns;
|
|
995
1029
|
if (modelInfo !== void 0) errInit.model = modelInfo;
|
|
1030
|
+
if (structuredOutput !== void 0) errInit.structuredOutput = structuredOutput;
|
|
996
1031
|
throw new MantyxRunError(runId, r.subtype, r.error ?? r.subtype, errInit);
|
|
997
1032
|
}
|
|
998
1033
|
} else if (ev.type === "error") {
|
|
@@ -1003,12 +1038,16 @@ var MantyxClient = class {
|
|
|
1003
1038
|
if (e.finishReason !== void 0) errInit.finishReason = e.finishReason;
|
|
1004
1039
|
if (typeof e.partialText === "string") errInit.partialText = e.partialText;
|
|
1005
1040
|
if (typeof e.retryable === "boolean") errInit.retryable = e.retryable;
|
|
1041
|
+
if (typeof e.apiStatus === "number") errInit.apiStatus = e.apiStatus;
|
|
1042
|
+
if (typeof e.apiCode === "string") errInit.apiCode = e.apiCode;
|
|
1006
1043
|
const errTokens = parseRunTokens(e.tokens);
|
|
1007
1044
|
if (errTokens !== void 0) errInit.tokens = errTokens;
|
|
1008
1045
|
const errTurns = parseRunTurns(e.turns);
|
|
1009
1046
|
if (errTurns !== void 0) errInit.turns = errTurns;
|
|
1010
1047
|
const errModel = parseRunModel(e.model);
|
|
1011
1048
|
if (errModel !== void 0) errInit.model = errModel;
|
|
1049
|
+
const errStructuredOutput = parseStructuredOutputInfo(e.structuredOutput);
|
|
1050
|
+
if (errStructuredOutput !== void 0) errInit.structuredOutput = errStructuredOutput;
|
|
1012
1051
|
throw new MantyxRunError(runId, subtype, e.error, errInit);
|
|
1013
1052
|
} else if (ev.type === "cancelled") {
|
|
1014
1053
|
throw new MantyxRunError(runId, "cancelled", "Run was cancelled");
|
|
@@ -1018,6 +1057,7 @@ var MantyxClient = class {
|
|
|
1018
1057
|
if (tokens !== void 0) result.tokens = tokens;
|
|
1019
1058
|
if (turns !== void 0) result.turns = turns;
|
|
1020
1059
|
if (modelInfo !== void 0) result.model = modelInfo;
|
|
1060
|
+
if (structuredOutput !== void 0) result.structuredOutput = structuredOutput;
|
|
1021
1061
|
if (plan !== void 0) result.plan = plan;
|
|
1022
1062
|
return result;
|
|
1023
1063
|
}
|
|
@@ -1273,7 +1313,7 @@ var MantyxClient = class {
|
|
|
1273
1313
|
const agentRunId = typeof record.agentRunId === "string" ? record.agentRunId : typeof nested?.agentRunId === "string" ? nested.agentRunId : "";
|
|
1274
1314
|
if (agentRunId) {
|
|
1275
1315
|
const localEv = evalEventToLocalToolCall(ev);
|
|
1276
|
-
|
|
1316
|
+
await this.dispatchLocalTool(agentRunId, localEv, handlers);
|
|
1277
1317
|
}
|
|
1278
1318
|
}
|
|
1279
1319
|
options.onEvent?.(ev);
|
|
@@ -1461,6 +1501,7 @@ var AgentSession = class {
|
|
|
1461
1501
|
}
|
|
1462
1502
|
if (this.tools.length > 0) body.tools = serializeToolRefs(this.tools);
|
|
1463
1503
|
if (opts.metadata && Object.keys(opts.metadata).length > 0) body.metadata = opts.metadata;
|
|
1504
|
+
if (opts.newLoop !== void 0) body.newLoop = opts.newLoop;
|
|
1464
1505
|
if (opts.reasoningLevel !== void 0) {
|
|
1465
1506
|
body.reasoningLevel = normalizeReasoningLevel(opts.reasoningLevel);
|
|
1466
1507
|
}
|
|
@@ -1501,6 +1542,12 @@ var AgentSession = class {
|
|
|
1501
1542
|
async info() {
|
|
1502
1543
|
return this.client.getSessionInfo(this.id);
|
|
1503
1544
|
}
|
|
1545
|
+
async events(opts = {}) {
|
|
1546
|
+
return this.client.getSessionEvents(this.id, opts);
|
|
1547
|
+
}
|
|
1548
|
+
async eventsPage(opts = {}) {
|
|
1549
|
+
return this.client.getSessionEventsPage(this.id, opts);
|
|
1550
|
+
}
|
|
1504
1551
|
async end() {
|
|
1505
1552
|
try {
|
|
1506
1553
|
await this.client.endSession(this.id);
|
|
@@ -1540,6 +1587,7 @@ function serializeAgentSpec(spec, extra = {}) {
|
|
|
1540
1587
|
if (spec.agentId) body.agentId = spec.agentId;
|
|
1541
1588
|
if (spec.name) body.name = spec.name;
|
|
1542
1589
|
if (spec.modelId) body.modelId = spec.modelId;
|
|
1590
|
+
if (spec.newLoop !== void 0) body.newLoop = spec.newLoop;
|
|
1543
1591
|
if (spec.reasoningLevel !== void 0) {
|
|
1544
1592
|
body.reasoningLevel = normalizeReasoningLevel(spec.reasoningLevel);
|
|
1545
1593
|
}
|
|
@@ -1579,6 +1627,7 @@ function serializeCreateEvalRunRequest(spec) {
|
|
|
1579
1627
|
throw new MantyxError("createEvalRun accepts only one of `agentId` or `agent`");
|
|
1580
1628
|
}
|
|
1581
1629
|
const body = {};
|
|
1630
|
+
if (spec.newLoop !== void 0) body.newLoop = spec.newLoop;
|
|
1582
1631
|
if (spec.datasetId) body.datasetId = spec.datasetId;
|
|
1583
1632
|
if (spec.dataset) body.dataset = spec.dataset;
|
|
1584
1633
|
if (spec.agentId) body.agentId = spec.agentId;
|
|
@@ -1736,6 +1785,17 @@ function normalizeOutputSchema(value) {
|
|
|
1736
1785
|
}
|
|
1737
1786
|
out.name = value.name;
|
|
1738
1787
|
}
|
|
1788
|
+
if (value.enforcement !== void 0) {
|
|
1789
|
+
if (value.enforcement !== "best_effort" && value.enforcement !== "strict") {
|
|
1790
|
+
throw new MantyxError(
|
|
1791
|
+
`outputSchema.enforcement must be "best_effort" or "strict", got ${JSON.stringify(value.enforcement)}`
|
|
1792
|
+
);
|
|
1793
|
+
}
|
|
1794
|
+
out.enforcement = value.enforcement;
|
|
1795
|
+
}
|
|
1796
|
+
if (value.schema == null) {
|
|
1797
|
+
throw new MantyxError("outputSchema.schema must be a Zod schema or a non-null JSON object");
|
|
1798
|
+
}
|
|
1739
1799
|
const schema = toToolParametersWire(
|
|
1740
1800
|
value.schema
|
|
1741
1801
|
);
|
|
@@ -2046,6 +2106,20 @@ function parseRunTurns(value) {
|
|
|
2046
2106
|
if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
|
|
2047
2107
|
return Math.max(0, Math.trunc(value));
|
|
2048
2108
|
}
|
|
2109
|
+
function parseStructuredOutputInfo(value) {
|
|
2110
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
2111
|
+
const v = value;
|
|
2112
|
+
const mechanism = v.enforcementMechanism;
|
|
2113
|
+
if (typeof v.schemaRequested !== "boolean" || typeof v.schemaEnforced !== "boolean" || mechanism !== "native_schema" && mechanism !== "synthetic_tool" && mechanism !== "none" || typeof v.unconstrainedFallbackOccurred !== "boolean") {
|
|
2114
|
+
return void 0;
|
|
2115
|
+
}
|
|
2116
|
+
return {
|
|
2117
|
+
schemaRequested: v.schemaRequested,
|
|
2118
|
+
schemaEnforced: v.schemaEnforced,
|
|
2119
|
+
enforcementMechanism: mechanism,
|
|
2120
|
+
unconstrainedFallbackOccurred: v.unconstrainedFallbackOccurred
|
|
2121
|
+
};
|
|
2122
|
+
}
|
|
2049
2123
|
function parseRunModel(value) {
|
|
2050
2124
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
2051
2125
|
const v = value;
|
|
@@ -2673,7 +2747,7 @@ async function runComputerUse(opts) {
|
|
|
2673
2747
|
}
|
|
2674
2748
|
|
|
2675
2749
|
// src/version.ts
|
|
2676
|
-
var SDK_VERSION = "
|
|
2750
|
+
var SDK_VERSION = "2026.9.2";
|
|
2677
2751
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2678
2752
|
0 && (module.exports = {
|
|
2679
2753
|
AgentSession,
|
|
@@ -2716,4 +2790,3 @@ var SDK_VERSION = "0.24.0";
|
|
|
2716
2790
|
toToolParametersWire,
|
|
2717
2791
|
zodToJsonSchema
|
|
2718
2792
|
});
|
|
2719
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -34,11 +34,12 @@
|
|
|
34
34
|
* console.log(result.text);
|
|
35
35
|
*/
|
|
36
36
|
export { MantyxClient, AgentSession, DEFAULT_BASE_URL, parseRunOutput, planOnly, taskPlanFromEventData, inputFileAttachment, inputFileUrlAttachment, } from "./client.js";
|
|
37
|
-
export type { MantyxClientOptions, ModelInfo, ModelCatalog, AgentSpecBase, RunSpec, SessionSpec, OutputSchema, OutputSchemaValue, LoopDetection, ToolBudget, ToolBudgets, Supervisor, SupervisorAction, SupervisorPhase, ReasoningTrigger, PlanOptions, PlanMode, PlanSpec, TaskPlan, TaskPlanStep, TaskPlanStepStatus, TaskPlanTransition, RunResult, RunTokenUsage, RunModelInfo, RunEvent, RunEventBase, AssistantDeltaEvent, ThinkingDeltaEvent, AssistantMessageEvent, UserMessageEvent, InputFileAttachment, InputFileUrlAttachment, MessageAttachment, InputFileAttachmentMetadata, InputFileUrlAttachmentMetadata, AttachmentMetadata, ConversationMessage, ServerToolResultEvent, LocalToolCallEvent, LocalToolResultInEvent, LoopDetectedEvent, ToolBudgetExceededEvent, SupervisorEvent, TaskPlanEvent, ResultEvent, ErrorEvent, CancelledEvent, SessionInfo, SessionSummary, SessionListResult, LocalHandlers, RunFeedbackVerdict, RunFeedbackInput, RunFeedbackResult, EvalRunStatus, InlineEvalCaseSpec, InlineEvalDatasetSpec, AgentEvalOverrides, CreateEvalRunRequest, EvalDatasetSummary, EvalDatasetList, EvalCase, EvalDatasetDetail, EvalRunAccepted, EvalRunSummary, EvalCaseResult, EvalRunDetail, EvalRunList, EvalRunCompareSide, EvalRunCompareCase, EvalRunCompare, EvalRunEvent, ListEvalRunsOptions, RunEvalOptions, } from "./client.js";
|
|
37
|
+
export type { MantyxClientOptions, ModelInfo, ModelCatalog, AgentSpecBase, RunSpec, SessionSpec, OutputSchema, OutputSchemaValue, LoopDetection, ToolBudget, ToolBudgets, Supervisor, SupervisorAction, SupervisorPhase, ReasoningTrigger, PlanOptions, PlanMode, PlanSpec, TaskPlan, TaskPlanStep, TaskPlanStepStatus, TaskPlanTransition, RunResult, RunTokenUsage, RunModelInfo, RunEvent, RunEventBase, AssistantDeltaEvent, ThinkingDeltaEvent, AssistantMessageEvent, UserMessageEvent, InputFileAttachment, InputFileUrlAttachment, MessageAttachment, InputFileAttachmentMetadata, InputFileUrlAttachmentMetadata, AttachmentMetadata, ConversationMessage, ServerToolResultEvent, LocalToolCallEvent, LocalToolResultInEvent, LoopDetectedEvent, ToolBudgetExceededEvent, SupervisorEvent, TaskPlanEvent, ResultEvent, ErrorEvent, CancelledEvent, SessionInfo, SessionSummary, SessionListResult, SessionEventsPage, LocalHandlers, RunFeedbackVerdict, RunFeedbackInput, RunFeedbackResult, EvalRunStatus, InlineEvalCaseSpec, InlineEvalDatasetSpec, AgentEvalOverrides, CreateEvalRunRequest, EvalDatasetSummary, EvalDatasetList, EvalCase, EvalDatasetDetail, EvalRunAccepted, EvalRunSummary, EvalCaseResult, EvalRunDetail, EvalRunList, EvalRunCompareSide, EvalRunCompareCase, EvalRunCompare, EvalRunEvent, ListEvalRunsOptions, RunEvalOptions, } from "./client.js";
|
|
38
38
|
export { defineLocalTool, mantyxTool, mantyxPluginTool, mantyxA2A, defineLocalA2A, mantyxMcp, defineLocalMcp, isLocalTool, isLocalA2ATool, isLocalMcpServer, } from "./tools.js";
|
|
39
39
|
export type { LocalTool, LocalToolResult, LocalToolOutput, ToolResultFile, MantyxToolRef, MantyxPluginToolRef, ToolRef, ZodLikeObject, DefineLocalToolOptions, ReasoningLevel, A2AToolRef, LocalA2ATool, McpToolRef, LocalMcpServer, LocalMcpHttpTransport, LocalMcpStdioTransport, MantyxA2AOptions, DefineLocalA2AOptions, MantyxMcpOptions, DefineLocalMcpOptions, } from "./tools.js";
|
|
40
40
|
export { MantyxError, MantyxAuthError, MantyxNetworkError, MantyxParseError, MantyxScopeError, MantyxToolError, MantyxRunError, } from "./errors.js";
|
|
41
41
|
export type { MantyxRunErrorInit, MantyxRunErrorTokens, MantyxRunErrorModel, } from "./errors.js";
|
|
42
|
+
export type { OutputSchemaEnforcement, StructuredOutputEnforcementMechanism, StructuredOutputInfo, } from "./structured-output.js";
|
|
42
43
|
export { MantyxOAuthClient, MantyxOAuthError, DEFAULT_OAUTH_BASE_URL, DEFAULT_REFRESH_SKEW_MS, } from "./oauth.js";
|
|
43
44
|
export type { OAuthToken, TokenSource, TokenRequestReason, MantyxOAuthClientOptions, RefreshOptions, RevokeOptions, RefreshTokenSourceOptions, } from "./oauth.js";
|
|
44
45
|
export { runComputerUse, defineComputerUseTools, buildComputerUseSystemPrompt, denormalizeCoordinate, extractActions, COMPUTER_USE_ACTIONS, } from "./computer-use.js";
|
|
@@ -47,4 +48,3 @@ export { zodToJsonSchema, toToolParametersWire } from "./zod-to-json-schema.js";
|
|
|
47
48
|
export { readSseStream } from "./sse.js";
|
|
48
49
|
export type { SseEvent, SseStreamOptions } from "./sse.js";
|
|
49
50
|
export { SDK_VERSION } from "./version.js";
|
|
50
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
taskPlanFromEventData,
|
|
28
28
|
toToolParametersWire,
|
|
29
29
|
zodToJsonSchema
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-XMNAWLMF.js";
|
|
31
31
|
|
|
32
32
|
// src/oauth.ts
|
|
33
33
|
var DEFAULT_OAUTH_BASE_URL = "https://app.mantyx.io";
|
|
@@ -603,7 +603,7 @@ async function runComputerUse(opts) {
|
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
// src/version.ts
|
|
606
|
-
var SDK_VERSION = "
|
|
606
|
+
var SDK_VERSION = "2026.9.2";
|
|
607
607
|
export {
|
|
608
608
|
AgentSession,
|
|
609
609
|
COMPUTER_USE_ACTIONS,
|
|
@@ -645,4 +645,3 @@ export {
|
|
|
645
645
|
toToolParametersWire,
|
|
646
646
|
zodToJsonSchema
|
|
647
647
|
};
|
|
648
|
-
//# sourceMappingURL=index.js.map
|
package/dist/local-resolver.d.ts
CHANGED
package/dist/oauth.d.ts
CHANGED
package/dist/playwright.cjs
CHANGED
package/dist/playwright.d.ts
CHANGED
|
@@ -80,4 +80,3 @@ export declare class PlaywrightController implements BrowserController {
|
|
|
80
80
|
}
|
|
81
81
|
/** @internal Exported for unit tests. */
|
|
82
82
|
export declare function scrollDelta(direction: ScrollDirection, magnitude: number): [number, number];
|
|
83
|
-
//# sourceMappingURL=playwright.d.ts.map
|
package/dist/playwright.js
CHANGED
package/dist/sse.d.ts
CHANGED
|
@@ -24,4 +24,3 @@ export interface SseStreamOptions {
|
|
|
24
24
|
* Comment frames (`:keep-alive`) are dropped.
|
|
25
25
|
*/
|
|
26
26
|
export declare function readSseStream(body: ReadableStream<Uint8Array> | null, opts?: SseStreamOptions): AsyncGenerator<SseEvent, void, void>;
|
|
27
|
-
//# sourceMappingURL=sse.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Requested output-schema enforcement policy. Omission preserves best-effort behavior. */
|
|
2
|
+
export type OutputSchemaEnforcement = "best_effort" | "strict";
|
|
3
|
+
/** Mechanism the platform used to constrain a structured-output run. */
|
|
4
|
+
export type StructuredOutputEnforcementMechanism = "native_schema" | "synthetic_tool" | "none";
|
|
5
|
+
/** Terminal observability metadata for a structured-output run. */
|
|
6
|
+
export interface StructuredOutputInfo {
|
|
7
|
+
schemaRequested: boolean;
|
|
8
|
+
schemaEnforced: boolean;
|
|
9
|
+
enforcementMechanism: StructuredOutputEnforcementMechanism;
|
|
10
|
+
unconstrainedFallbackOccurred: boolean;
|
|
11
|
+
}
|
package/dist/tools.d.ts
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Release version — synced from
|
|
2
|
+
* Release version — synced from sdk/VERSION (`pnpm run sync-version`).
|
|
3
3
|
*/
|
|
4
|
-
export declare const SDK_VERSION = "
|
|
5
|
-
//# sourceMappingURL=version.d.ts.map
|
|
4
|
+
export declare const SDK_VERSION = "2026.9.2";
|