@mantyx/sdk 0.10.0 → 0.11.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 +8 -1
- package/README.md +37 -31
- package/dist/a2a-server.cjs +9 -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-XMUCELMH.js → chunk-DR625E6B.js} +69 -9
- package/dist/chunk-DR625E6B.js.map +1 -0
- package/dist/{client-DHwh8MPj.d.cts → client-Byb0Zdo7.d.cts} +199 -84
- package/dist/{client-DHwh8MPj.d.ts → client-Byb0Zdo7.d.ts} +199 -84
- package/dist/index.cjs +76 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -69
- package/dist/index.js.map +1 -1
- package/docs/agent-runs-protocol.md +373 -220
- package/docs/wire-protocol.md +415 -252
- package/package.json +1 -1
- package/dist/chunk-XMUCELMH.js.map +0 -1
- package/docs/oauth.md +0 -356
|
@@ -47,6 +47,30 @@ declare class MantyxToolError extends MantyxError {
|
|
|
47
47
|
readonly toolName: string;
|
|
48
48
|
constructor(toolName: string, message: string);
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Per-run token totals attached to terminal `result` / `error`
|
|
52
|
+
* events. See `docs/agent-runs-protocol.md` §7.1 for the per-provider
|
|
53
|
+
* mapping and the relationship between buckets. Re-exported from
|
|
54
|
+
* `client.ts` so error consumers can pattern-match the triple without
|
|
55
|
+
* a second import.
|
|
56
|
+
*/
|
|
57
|
+
interface MantyxRunErrorTokens {
|
|
58
|
+
inputTokens: number;
|
|
59
|
+
cachedTokens: number;
|
|
60
|
+
reasoningTokens: number;
|
|
61
|
+
outputTokens: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Resolved model that executed the run. Surfaced on terminal events
|
|
65
|
+
* by MANTYX ≥ 2026-09. See `docs/agent-runs-protocol.md` §7.1. The
|
|
66
|
+
* `provider` empty / undefined is the "no usage data" sentinel.
|
|
67
|
+
*/
|
|
68
|
+
interface MantyxRunErrorModel {
|
|
69
|
+
id: string;
|
|
70
|
+
provider: string;
|
|
71
|
+
vendorModelId: string;
|
|
72
|
+
reasoningEffort?: string;
|
|
73
|
+
}
|
|
50
74
|
/**
|
|
51
75
|
* Optional triage attributes the runner attaches to terminal `error`
|
|
52
76
|
* events. Mirrors the wire fields described in
|
|
@@ -83,6 +107,17 @@ interface MantyxRunErrorInit {
|
|
|
83
107
|
* Informational; the SDK still owns the actual retry decision.
|
|
84
108
|
*/
|
|
85
109
|
retryable?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Per-run token totals from the terminal event. Present against
|
|
112
|
+
* MANTYX ≥ 2026-09 — see {@link MantyxRunErrorTokens} and
|
|
113
|
+
* `docs/agent-runs-protocol.md` §7.1. Includes the failing model
|
|
114
|
+
* call's usage when the run errored mid-loop.
|
|
115
|
+
*/
|
|
116
|
+
tokens?: MantyxRunErrorTokens;
|
|
117
|
+
/** Total model invocations for the run, including the failing call. */
|
|
118
|
+
turns?: number;
|
|
119
|
+
/** Resolved model that executed the run. See {@link MantyxRunErrorModel}. */
|
|
120
|
+
model?: MantyxRunErrorModel;
|
|
86
121
|
}
|
|
87
122
|
declare class MantyxRunError extends MantyxError {
|
|
88
123
|
readonly runId: string;
|
|
@@ -95,6 +130,12 @@ declare class MantyxRunError extends MantyxError {
|
|
|
95
130
|
readonly partialText: string | undefined;
|
|
96
131
|
/** See {@link MantyxRunErrorInit.retryable}. */
|
|
97
132
|
readonly retryable: boolean | undefined;
|
|
133
|
+
/** See {@link MantyxRunErrorInit.tokens}. */
|
|
134
|
+
readonly tokens: MantyxRunErrorTokens | undefined;
|
|
135
|
+
/** See {@link MantyxRunErrorInit.turns}. */
|
|
136
|
+
readonly turns: number | undefined;
|
|
137
|
+
/** See {@link MantyxRunErrorInit.model}. */
|
|
138
|
+
readonly model: MantyxRunErrorModel | undefined;
|
|
98
139
|
constructor(runId: string, subtype: string, message: string, init?: MantyxRunErrorInit);
|
|
99
140
|
}
|
|
100
141
|
/**
|
|
@@ -113,26 +154,28 @@ declare class MantyxParseError extends MantyxError {
|
|
|
113
154
|
}
|
|
114
155
|
|
|
115
156
|
/**
|
|
116
|
-
* MANTYX OAuth 2.0 client:
|
|
117
|
-
*
|
|
118
|
-
* {@link TokenSource}
|
|
119
|
-
*
|
|
157
|
+
* MANTYX OAuth 2.0 refresh client: trade a stored refresh token for
|
|
158
|
+
* short-lived access tokens, revoke tokens at sign-out, and expose
|
|
159
|
+
* a {@link TokenSource} the {@link MantyxClient} HTTP layer calls
|
|
160
|
+
* before every request (and again on 401).
|
|
120
161
|
*
|
|
121
|
-
* The
|
|
162
|
+
* The library is intentionally **refresh-only**. It assumes the caller
|
|
163
|
+
* already obtained the refresh token through their own sign-in flow
|
|
164
|
+
* (Authorization Code + PKCE in a browser, native redirect, server-
|
|
165
|
+
* side exchange — whatever fits the host application). The SDK does
|
|
166
|
+
* not drive consent, does not initiate auth-code exchanges, and does
|
|
167
|
+
* not bundle PKCE helpers.
|
|
122
168
|
*
|
|
123
|
-
*
|
|
169
|
+
* Wire contract (`docs/oauth.md`):
|
|
170
|
+
*
|
|
171
|
+
* - Token endpoint: `POST <baseUrl>/api/oauth/token`, form-encoded,
|
|
172
|
+
* `grant_type=refresh_token`. Echoes back the same `refresh_token`
|
|
173
|
+
* the client sent (refresh tokens are persistent and non-rotating).
|
|
124
174
|
* - Revoke endpoint: `POST <baseUrl>/api/oauth/revoke`, form-encoded.
|
|
125
175
|
* - Access tokens (`mantyx_at_…`) live 1 hour (`expires_in: 3600`).
|
|
126
|
-
* - Refresh tokens (`mantyx_rt_…`) are
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* (encrypted at rest) and the SDK re-mints access tokens from it on
|
|
130
|
-
* demand.
|
|
131
|
-
*
|
|
132
|
-
* See also `docs/oauth.md` for the authorization-code + PKCE consent
|
|
133
|
-
* flow (which the SDK does **not** drive — the calling app owns the
|
|
134
|
-
* redirect dance; once it has the auth code, `exchangeAuthorizationCode`
|
|
135
|
-
* swaps it for the initial `{access_token, refresh_token}` pair).
|
|
176
|
+
* - Refresh tokens (`mantyx_rt_…`) are long-lived; the caller persists
|
|
177
|
+
* them once at first sign-in (encrypted at rest) and the SDK re-mints
|
|
178
|
+
* access tokens from the same value on demand.
|
|
136
179
|
*/
|
|
137
180
|
|
|
138
181
|
declare const DEFAULT_OAUTH_BASE_URL = "https://app.mantyx.io";
|
|
@@ -157,12 +200,12 @@ declare class MantyxOAuthError extends MantyxError {
|
|
|
157
200
|
}
|
|
158
201
|
/**
|
|
159
202
|
* Decoded `POST /api/oauth/token` response, augmented with an absolute
|
|
160
|
-
* `expiresAt` timestamp the SDK
|
|
203
|
+
* `expiresAt` timestamp the SDK uses to decide when to refresh.
|
|
161
204
|
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
205
|
+
* On the refresh grant the response's `refreshToken` is identical to
|
|
206
|
+
* the value the client just sent (refresh tokens never rotate). The
|
|
207
|
+
* field is surfaced for symmetry with whatever the calling app's
|
|
208
|
+
* sign-in flow already does.
|
|
166
209
|
*/
|
|
167
210
|
interface OAuthToken {
|
|
168
211
|
readonly accessToken: string;
|
|
@@ -209,11 +252,6 @@ interface MantyxOAuthClientOptions {
|
|
|
209
252
|
/** Default per-request timeout in milliseconds. Default: 30s. */
|
|
210
253
|
timeoutMs?: number;
|
|
211
254
|
}
|
|
212
|
-
interface ExchangeAuthorizationCodeOptions {
|
|
213
|
-
code: string;
|
|
214
|
-
redirectUri: string;
|
|
215
|
-
codeVerifier: string;
|
|
216
|
-
}
|
|
217
255
|
interface RefreshOptions {
|
|
218
256
|
refreshToken: string;
|
|
219
257
|
/**
|
|
@@ -224,9 +262,6 @@ interface RefreshOptions {
|
|
|
224
262
|
*/
|
|
225
263
|
scope?: string | readonly string[];
|
|
226
264
|
}
|
|
227
|
-
interface ClientCredentialsOptions {
|
|
228
|
-
scope?: string | readonly string[];
|
|
229
|
-
}
|
|
230
265
|
interface RevokeOptions {
|
|
231
266
|
token: string;
|
|
232
267
|
}
|
|
@@ -241,21 +276,24 @@ interface RefreshTokenSourceOptions {
|
|
|
241
276
|
refreshSkewMs?: number;
|
|
242
277
|
/**
|
|
243
278
|
* Optional initial access token + expiry to seed the source's cache
|
|
244
|
-
* with (e.g. the token already in hand from the
|
|
245
|
-
*
|
|
279
|
+
* with (e.g. the token already in hand from the host application's
|
|
280
|
+
* sign-in flow). When omitted, the source mints one on the first
|
|
281
|
+
* call.
|
|
246
282
|
*/
|
|
247
283
|
initialToken?: OAuthToken;
|
|
248
284
|
}
|
|
249
|
-
interface ClientCredentialsTokenSourceOptions {
|
|
250
|
-
scope?: string | readonly string[];
|
|
251
|
-
refreshSkewMs?: number;
|
|
252
|
-
}
|
|
253
285
|
/**
|
|
254
|
-
*
|
|
255
|
-
* (one per `{clientId, clientSecret}` pair);
|
|
256
|
-
* {@link MantyxClient}, then either call
|
|
257
|
-
*
|
|
258
|
-
*
|
|
286
|
+
* Refresh-only wrapper around the MANTYX OAuth 2.0 authorization-server
|
|
287
|
+
* endpoints. App-scoped (one per `{clientId, clientSecret}` pair);
|
|
288
|
+
* construct independently of {@link MantyxClient}, then either call
|
|
289
|
+
* {@link refresh} / {@link revoke} directly or hand a `TokenSource`
|
|
290
|
+
* produced by {@link refreshTokenSource} to `MantyxClient` for fully
|
|
291
|
+
* transparent refresh on every request.
|
|
292
|
+
*
|
|
293
|
+
* The client deliberately does **not** drive the authorization-code
|
|
294
|
+
* exchange or any other "initiate sign-in" grant. The caller is
|
|
295
|
+
* expected to obtain the refresh token through their own consent flow
|
|
296
|
+
* and persist it before constructing this client.
|
|
259
297
|
*/
|
|
260
298
|
declare class MantyxOAuthClient {
|
|
261
299
|
readonly clientId: string;
|
|
@@ -264,33 +302,17 @@ declare class MantyxOAuthClient {
|
|
|
264
302
|
private readonly fetchImpl;
|
|
265
303
|
private readonly timeoutMs;
|
|
266
304
|
constructor(opts: MantyxOAuthClientOptions);
|
|
267
|
-
/**
|
|
268
|
-
* Swap an authorization-code + PKCE verifier for the initial
|
|
269
|
-
* `{access_token, refresh_token}` pair. Call this exactly once per
|
|
270
|
-
* sign-in after the browser/native redirect lands back on your
|
|
271
|
-
* `redirectUri` with a `code` parameter. Persist the returned
|
|
272
|
-
* `refreshToken` against the user record — it is long-lived and
|
|
273
|
-
* non-rotating per `docs/oauth.md` §"Token lifetimes & lifecycle".
|
|
274
|
-
*/
|
|
275
|
-
exchangeAuthorizationCode(opts: ExchangeAuthorizationCodeOptions): Promise<OAuthToken>;
|
|
276
305
|
/**
|
|
277
306
|
* Mint a fresh access token from a stored refresh token. The
|
|
278
|
-
* returned `refreshToken` is identical to the input —
|
|
279
|
-
*
|
|
307
|
+
* returned `refreshToken` is identical to the input — refresh
|
|
308
|
+
* tokens are persistent and non-rotating, so the field is
|
|
309
|
+
* surfaced only for symmetry with the response shape.
|
|
280
310
|
*
|
|
281
311
|
* On `400 invalid_grant` the refresh token has been revoked (or its
|
|
282
312
|
* grant / app was deleted); the SDK surfaces a
|
|
283
313
|
* {@link MantyxOAuthError} and callers must drive a fresh sign-in.
|
|
284
314
|
*/
|
|
285
315
|
refresh(opts: RefreshOptions): Promise<OAuthToken>;
|
|
286
|
-
/**
|
|
287
|
-
* Request a workspace-scoped access token without a user via the
|
|
288
|
-
* `client_credentials` grant. Available only on private OAuth apps
|
|
289
|
-
* that were registered with `allowsClientCredentials: true`. No
|
|
290
|
-
* refresh token is issued; re-call this method whenever a new
|
|
291
|
-
* access token is needed.
|
|
292
|
-
*/
|
|
293
|
-
clientCredentials(opts?: ClientCredentialsOptions): Promise<OAuthToken>;
|
|
294
316
|
/**
|
|
295
317
|
* Revoke an access or refresh token (RFC 7009). The server always
|
|
296
318
|
* returns 200, even for unknown tokens. Revoking a **refresh**
|
|
@@ -305,16 +327,12 @@ declare class MantyxOAuthClient {
|
|
|
305
327
|
* source caches the access token in-memory and refreshes
|
|
306
328
|
* proactively when the cached value is within `refreshSkewMs` of
|
|
307
329
|
* `expiresAt`, or eagerly when `MantyxClient` reports a 401.
|
|
330
|
+
*
|
|
331
|
+
* Pass `initialToken` if the calling app already has a non-expired
|
|
332
|
+
* access token in hand (e.g. straight out of the sign-in flow) to
|
|
333
|
+
* avoid an extra round-trip on the first request.
|
|
308
334
|
*/
|
|
309
335
|
refreshTokenSource(opts: RefreshTokenSourceOptions): TokenSource;
|
|
310
|
-
/**
|
|
311
|
-
* Build a long-lived {@link TokenSource} backed by the
|
|
312
|
-
* `client_credentials` grant. On every refresh the source re-mints
|
|
313
|
-
* a workspace-scoped access token by calling the token endpoint
|
|
314
|
-
* with `grant_type=client_credentials`. Available only on private
|
|
315
|
-
* apps with `allowsClientCredentials: true`.
|
|
316
|
-
*/
|
|
317
|
-
clientCredentialsTokenSource(opts?: ClientCredentialsTokenSourceOptions): TokenSource;
|
|
318
336
|
/**
|
|
319
337
|
* POST `application/x-www-form-urlencoded` to `/api/oauth/token` and
|
|
320
338
|
* decode the {@link OAuthToken} response. Always injects `client_id`
|
|
@@ -323,22 +341,6 @@ declare class MantyxOAuthClient {
|
|
|
323
341
|
private token;
|
|
324
342
|
private formPost;
|
|
325
343
|
}
|
|
326
|
-
/**
|
|
327
|
-
* Generate a high-entropy PKCE `code_verifier` (RFC 7636 §4.1). The
|
|
328
|
-
* verifier is the raw secret you keep across the redirect; the
|
|
329
|
-
* `code_challenge` you send on `/api/oauth/authorize` is derived from
|
|
330
|
-
* it via {@link pkceChallenge}.
|
|
331
|
-
*
|
|
332
|
-
* Default length is 64 characters (≈ 384 bits of entropy after
|
|
333
|
-
* base64url-encoding the 32 random bytes). Pass `length` to clamp to
|
|
334
|
-
* the RFC's 43..128 inclusive range.
|
|
335
|
-
*/
|
|
336
|
-
declare function generatePkceVerifier(length?: number): string;
|
|
337
|
-
/**
|
|
338
|
-
* Compute the PKCE `S256` `code_challenge` for a given verifier:
|
|
339
|
-
* `base64url(sha256(verifier))` with no padding (RFC 7636 §4.2).
|
|
340
|
-
*/
|
|
341
|
-
declare function pkceChallenge(verifier: string): string;
|
|
342
344
|
|
|
343
345
|
/**
|
|
344
346
|
* Public tool helpers for the MANTYX SDK.
|
|
@@ -923,10 +925,102 @@ interface ToolBudget {
|
|
|
923
925
|
* entirely to keep the defaults.
|
|
924
926
|
*/
|
|
925
927
|
type ToolBudgets = Record<string, ToolBudget>;
|
|
928
|
+
/**
|
|
929
|
+
* Per-run token totals attached to terminal `result` / `error` events
|
|
930
|
+
* (and to the `GET /agent-runs/:runId` snapshot) by MANTYX ≥ 2026-09.
|
|
931
|
+
*
|
|
932
|
+
* Aggregated across every model invocation for the run. See
|
|
933
|
+
* `docs/agent-runs-protocol.md` §7.1 for the per-provider mapping and
|
|
934
|
+
* the relationship between buckets (`inputTokens` / `outputTokens` are
|
|
935
|
+
* the billable totals; `cachedTokens` and `reasoningTokens` are
|
|
936
|
+
* diagnostic breakdowns _inside_ those two totals, not separate
|
|
937
|
+
* additive buckets).
|
|
938
|
+
*
|
|
939
|
+
* Older servers omit the cost-attribution triple entirely; SDK callers
|
|
940
|
+
* detect "no usage data" by checking `result.model?.provider` is empty
|
|
941
|
+
* / undefined.
|
|
942
|
+
*/
|
|
943
|
+
interface RunTokenUsage {
|
|
944
|
+
/**
|
|
945
|
+
* Total billable input tokens — fresh prompt tokens plus the
|
|
946
|
+
* cached-read slice the provider still bills (at a discount) plus
|
|
947
|
+
* any cache-creation tokens plus tool-prompt tokens. Equal to the
|
|
948
|
+
* sum of every provider-reported input bucket for the run.
|
|
949
|
+
*/
|
|
950
|
+
inputTokens: number;
|
|
951
|
+
/**
|
|
952
|
+
* The discounted slice of `inputTokens` that came from a prompt
|
|
953
|
+
* cache hit (Anthropic prompt caching, OpenAI cached prompt, Gemini
|
|
954
|
+
* implicit cache). `0` when the provider doesn't report cache reads
|
|
955
|
+
* or the run didn't hit cache.
|
|
956
|
+
*/
|
|
957
|
+
cachedTokens: number;
|
|
958
|
+
/**
|
|
959
|
+
* Non-visible thinking tokens. **Already counted inside
|
|
960
|
+
* `outputTokens`** — surfaced separately so dashboards can break out
|
|
961
|
+
* "thinking cost" vs visible output. `0` when the model didn't
|
|
962
|
+
* reason or didn't report it.
|
|
963
|
+
*/
|
|
964
|
+
reasoningTokens: number;
|
|
965
|
+
/**
|
|
966
|
+
* All tokens the model emitted for this run, visible + reasoning.
|
|
967
|
+
* Matches the provider's "completion tokens" / "output tokens"
|
|
968
|
+
* billing line.
|
|
969
|
+
*/
|
|
970
|
+
outputTokens: number;
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* The resolved model the platform stamped onto the run, surfaced on
|
|
974
|
+
* terminal `result` / `error` events (and `GET /agent-runs/:runId`)
|
|
975
|
+
* by MANTYX ≥ 2026-09. See `docs/agent-runs-protocol.md` §7.1.
|
|
976
|
+
*/
|
|
977
|
+
interface RunModelInfo {
|
|
978
|
+
/**
|
|
979
|
+
* Catalog id — the same string a caller would pass back as
|
|
980
|
+
* `modelId` to re-select this exact entry (e.g. `"platform:demo"`,
|
|
981
|
+
* `"provider:cmf…"`). Empty string against legacy fallbacks that
|
|
982
|
+
* didn't synthesise a catalog id.
|
|
983
|
+
*/
|
|
984
|
+
id: string;
|
|
985
|
+
/**
|
|
986
|
+
* Lowercase provider id: `"openai"`, `"anthropic"`, `"google"`,
|
|
987
|
+
* `"azure-openai"`. Empty string against legacy runners that don't
|
|
988
|
+
* report usage data — SDK callers use that as the "no usage data"
|
|
989
|
+
* signal.
|
|
990
|
+
*/
|
|
991
|
+
provider: string;
|
|
992
|
+
/**
|
|
993
|
+
* The model id the platform actually sent to the provider (e.g.
|
|
994
|
+
* `"gpt-5.4-mini"`, `"claude-opus-4-7"`, `"gemini-2.5-pro"`).
|
|
995
|
+
*/
|
|
996
|
+
vendorModelId: string;
|
|
997
|
+
/**
|
|
998
|
+
* `"off" | "low" | "medium" | "high"`. Omitted when the provider
|
|
999
|
+
* doesn't expose a reasoning-level knob or the run didn't request
|
|
1000
|
+
* one.
|
|
1001
|
+
*/
|
|
1002
|
+
reasoningEffort?: string;
|
|
1003
|
+
}
|
|
926
1004
|
interface RunResult {
|
|
927
1005
|
runId: string;
|
|
928
1006
|
text: string;
|
|
929
1007
|
events: RunEvent[];
|
|
1008
|
+
/**
|
|
1009
|
+
* Per-run token totals from the terminal event. Undefined against
|
|
1010
|
+
* MANTYX servers older than 2026-09 (the "no usage data" signal is
|
|
1011
|
+
* `result.model?.provider` being empty / undefined). See
|
|
1012
|
+
* {@link RunTokenUsage} and `docs/agent-runs-protocol.md` §7.1.
|
|
1013
|
+
*/
|
|
1014
|
+
tokens?: RunTokenUsage;
|
|
1015
|
+
/**
|
|
1016
|
+
* Total `engine.completeTurn(...)` invocations for the run,
|
|
1017
|
+
* including the failing call when a run errored mid-loop. A
|
|
1018
|
+
* single-shot run reports `1`; a tool loop is `>= 2`. Undefined
|
|
1019
|
+
* against legacy MANTYX servers.
|
|
1020
|
+
*/
|
|
1021
|
+
turns?: number;
|
|
1022
|
+
/** Resolved model that executed the run. See {@link RunModelInfo}. */
|
|
1023
|
+
model?: RunModelInfo;
|
|
930
1024
|
}
|
|
931
1025
|
interface RunEventBase {
|
|
932
1026
|
seq: number;
|
|
@@ -1075,6 +1169,15 @@ interface ResultEvent extends RunEventBase {
|
|
|
1075
1169
|
subtype: string;
|
|
1076
1170
|
text?: string;
|
|
1077
1171
|
error?: string;
|
|
1172
|
+
/**
|
|
1173
|
+
* Per-run token totals. Present against MANTYX ≥ 2026-09 — see
|
|
1174
|
+
* {@link RunTokenUsage} and `docs/agent-runs-protocol.md` §7.1.
|
|
1175
|
+
*/
|
|
1176
|
+
tokens?: RunTokenUsage;
|
|
1177
|
+
/** Total model invocations for the run. See {@link RunResult.turns}. */
|
|
1178
|
+
turns?: number;
|
|
1179
|
+
/** Resolved model that executed the run. See {@link RunModelInfo}. */
|
|
1180
|
+
model?: RunModelInfo;
|
|
1078
1181
|
}
|
|
1079
1182
|
interface ErrorEvent extends RunEventBase {
|
|
1080
1183
|
type: "error";
|
|
@@ -1113,6 +1216,18 @@ interface ErrorEvent extends RunEventBase {
|
|
|
1113
1216
|
* Informational; the SDK still owns the actual retry decision.
|
|
1114
1217
|
*/
|
|
1115
1218
|
retryable?: boolean;
|
|
1219
|
+
/**
|
|
1220
|
+
* Per-run token totals. Present against MANTYX ≥ 2026-09 — see
|
|
1221
|
+
* {@link RunTokenUsage} and `docs/agent-runs-protocol.md` §7.1.
|
|
1222
|
+
* The pipeline counts the failing model call too, so a run that
|
|
1223
|
+
* threw on the first turn reports `turns: 1` with that call's
|
|
1224
|
+
* tokens already aggregated.
|
|
1225
|
+
*/
|
|
1226
|
+
tokens?: RunTokenUsage;
|
|
1227
|
+
/** Total model invocations for the run, including the failing call. */
|
|
1228
|
+
turns?: number;
|
|
1229
|
+
/** Resolved model that executed the run. See {@link RunModelInfo}. */
|
|
1230
|
+
model?: RunModelInfo;
|
|
1116
1231
|
}
|
|
1117
1232
|
interface CancelledEvent extends RunEventBase {
|
|
1118
1233
|
type: "cancelled";
|
|
@@ -1319,4 +1434,4 @@ interface LocalHandlers {
|
|
|
1319
1434
|
*/
|
|
1320
1435
|
declare function parseRunOutput<T = unknown>(result: RunResult, validator?: (value: unknown) => T): T;
|
|
1321
1436
|
|
|
1322
|
-
export { type
|
|
1437
|
+
export { type RunEvent as $, type A2AToolRef as A, MantyxOAuthError as B, type CancelledEvent as C, DEFAULT_BASE_URL as D, type ErrorEvent as E, MantyxParseError as F, type MantyxPluginToolRef as G, MantyxRunError as H, type MantyxRunErrorInit as I, type MantyxRunErrorModel as J, type MantyxRunErrorTokens as K, type LocalA2ATool as L, MantyxClient as M, MantyxScopeError as N, MantyxToolError as O, type MantyxToolRef as P, type McpToolRef as Q, type ReasoningLevel as R, type ModelCatalog as S, type ToolRef as T, type ModelInfo as U, type OAuthToken as V, type OutputSchema as W, type RefreshOptions as X, type RefreshTokenSourceOptions as Y, type ResultEvent as Z, type RevokeOptions as _, AgentSession as a, type RunEventBase as a0, type RunModelInfo as a1, type RunResult as a2, type RunSpec as a3, type RunTokenUsage as a4, type ServerToolResultEvent as a5, type SessionInfo as a6, type SessionSpec as a7, type ThinkingDeltaEvent as a8, type TokenRequestReason as a9, type TokenSource as aa, type ToolBudget as ab, type ToolBudgetExceededEvent as ac, type ToolBudgets as ad, type ZodLikeObject as ae, defineLocalA2A as af, defineLocalMcp as ag, defineLocalTool as ah, isLocalA2ATool as ai, isLocalMcpServer as aj, isLocalTool as ak, mantyxA2A as al, mantyxMcp as am, mantyxPluginTool as an, mantyxTool as ao, parseRunOutput as ap, type AgentSpecBase as b, type AssistantDeltaEvent as c, type AssistantMessageEvent as d, DEFAULT_OAUTH_BASE_URL as e, DEFAULT_REFRESH_SKEW_MS as f, type DefineLocalA2AOptions as g, type DefineLocalMcpOptions as h, type DefineLocalToolOptions as i, type LocalHandlers as j, type LocalMcpHttpTransport as k, type LocalMcpServer as l, type LocalMcpStdioTransport as m, type LocalTool as n, type LocalToolCallEvent as o, type LocalToolResultInEvent as p, type LoopDetectedEvent as q, type LoopDetection as r, type MantyxA2AOptions as s, MantyxAuthError as t, type MantyxClientOptions as u, MantyxError as v, type MantyxMcpOptions as w, MantyxNetworkError as x, MantyxOAuthClient as y, type MantyxOAuthClientOptions as z };
|