@mantyx/sdk 0.15.1 → 0.16.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 -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-YXTU725K.js → chunk-EEVTNG4C.js} +36 -7
- package/dist/chunk-EEVTNG4C.js.map +1 -0
- package/dist/{client-fu11V4HX.d.cts → client-DgBXj6Dh.d.cts} +22 -1
- package/dist/{client-fu11V4HX.d.ts → client-DgBXj6Dh.d.ts} +22 -1
- package/dist/index.cjs +36 -7
- 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 +2 -2
- package/dist/index.js.map +1 -1
- package/docs/agent-runs-protocol.md +17 -4
- package/docs/wire-protocol.md +26 -6
- package/package.json +1 -1
- package/dist/chunk-YXTU725K.js.map +0 -1
|
@@ -1025,13 +1025,28 @@ type ToolBudgets = Record<string, ToolBudget>;
|
|
|
1025
1025
|
*
|
|
1026
1026
|
* `interval` is optional; when omitted the MANTYX runtime default is **5**
|
|
1027
1027
|
* LLM calls between reviews. Server-side upper bound: `100`.
|
|
1028
|
+
*
|
|
1029
|
+
* `reasoningTrigger` controls mid-turn reasoning reviews (default
|
|
1030
|
+
* `{ chars: 3000, ms: 30000 }`). Pass `false` to only review at tool-round
|
|
1031
|
+
* boundaries.
|
|
1028
1032
|
*/
|
|
1029
1033
|
interface Supervisor {
|
|
1030
1034
|
/** LLM calls (`completeTurn` invocations) between supervisor reviews. */
|
|
1031
1035
|
interval?: number;
|
|
1036
|
+
/** Mid-turn reasoning trigger, or `false` to disable. */
|
|
1037
|
+
reasoningTrigger?: ReasoningTrigger | false;
|
|
1038
|
+
}
|
|
1039
|
+
/** Mid-turn supervisor review trigger (reasoning span length / duration). */
|
|
1040
|
+
interface ReasoningTrigger {
|
|
1041
|
+
/** Reasoning characters per span before review. Default `3000`, max `50000`. */
|
|
1042
|
+
chars?: number;
|
|
1043
|
+
/** Milliseconds per reasoning span before review. Default `30000`, max `600000`. */
|
|
1044
|
+
ms?: number;
|
|
1032
1045
|
}
|
|
1033
1046
|
/** Verdict from a run-supervisor review. */
|
|
1034
1047
|
type SupervisorAction = "on_track" | "redirect" | "finalize";
|
|
1048
|
+
/** When a supervisor review fired relative to the model turn. */
|
|
1049
|
+
type SupervisorPhase = "turn_boundary" | "reasoning";
|
|
1035
1050
|
/** Status of one step in an in-product task plan. */
|
|
1036
1051
|
type TaskPlanStepStatus = "pending" | "in_progress" | "done";
|
|
1037
1052
|
/** One checklist row in a {@link TaskPlan}. */
|
|
@@ -1338,6 +1353,12 @@ interface SupervisorEvent extends RunEventBase {
|
|
|
1338
1353
|
* pipeline's `modelInvocations` counter at the check boundary.
|
|
1339
1354
|
*/
|
|
1340
1355
|
llmCalls: number;
|
|
1356
|
+
/**
|
|
1357
|
+
* `"turn_boundary"` (default cadence review) or `"reasoning"` (mid-turn
|
|
1358
|
+
* review while a long reasoning span was still streaming). Omitted is
|
|
1359
|
+
* equivalent to `"turn_boundary"`.
|
|
1360
|
+
*/
|
|
1361
|
+
phase?: SupervisorPhase;
|
|
1341
1362
|
}
|
|
1342
1363
|
/**
|
|
1343
1364
|
* Live checklist update for an in-product task plan. Non-terminal — the run
|
|
@@ -1720,4 +1741,4 @@ interface LocalHandlers {
|
|
|
1720
1741
|
*/
|
|
1721
1742
|
declare function parseRunOutput<T = unknown>(result: RunResult, validator?: (value: unknown) => T): T;
|
|
1722
1743
|
|
|
1723
|
-
export { type ModelCatalog as $, type A2AToolRef as A, MantyxError as B, type CancelledEvent as C, DEFAULT_BASE_URL as D, type ErrorEvent as E, type MantyxMcpOptions as F, MantyxNetworkError as G, MantyxOAuthClient as H, type InputFileAttachment as I, type MantyxOAuthClientOptions as J, MantyxOAuthError as K, type LocalA2ATool as L, MantyxClient as M, MantyxParseError as N, type OutputSchema as O, type MantyxPluginToolRef as P, MantyxRunError as Q, type ReasoningLevel as R, type MantyxRunErrorInit as S, type ToolRef as T, type MantyxRunErrorModel as U, type MantyxRunErrorTokens as V, MantyxScopeError as W, MantyxToolError as X, type MantyxToolRef as Y, type McpToolRef as Z, type MessageAttachment as _, AgentSession as a, type ModelInfo as a0, type OAuthToken as a1, type OutputSchemaValue as a2, type PlanOptions as a3, type PlanSpec as a4, type
|
|
1744
|
+
export { type ModelCatalog as $, type A2AToolRef as A, MantyxError as B, type CancelledEvent as C, DEFAULT_BASE_URL as D, type ErrorEvent as E, type MantyxMcpOptions as F, MantyxNetworkError as G, MantyxOAuthClient as H, type InputFileAttachment as I, type MantyxOAuthClientOptions as J, MantyxOAuthError as K, type LocalA2ATool as L, MantyxClient as M, MantyxParseError as N, type OutputSchema as O, type MantyxPluginToolRef as P, MantyxRunError as Q, type ReasoningLevel as R, type MantyxRunErrorInit as S, type ToolRef as T, type MantyxRunErrorModel as U, type MantyxRunErrorTokens as V, MantyxScopeError as W, MantyxToolError as X, type MantyxToolRef as Y, type McpToolRef as Z, type MessageAttachment as _, AgentSession as a, type ModelInfo as a0, type OAuthToken as a1, type OutputSchemaValue as a2, type PlanOptions as a3, type PlanSpec as a4, type ReasoningTrigger as a5, type RefreshOptions as a6, type RefreshTokenSourceOptions as a7, type ResultEvent as a8, type RevokeOptions as a9, type ZodLikeObject as aA, defineLocalA2A as aB, defineLocalMcp as aC, defineLocalTool as aD, inputFileAttachment as aE, inputFileUrlAttachment as aF, isLocalA2ATool as aG, isLocalMcpServer as aH, isLocalTool as aI, mantyxA2A as aJ, mantyxMcp as aK, mantyxPluginTool as aL, mantyxTool as aM, parseRunOutput as aN, planOnly as aO, type RunEvent as aa, type RunEventBase as ab, type RunModelInfo as ac, type RunResult as ad, type RunSpec as ae, type RunTokenUsage as af, type ServerToolResultEvent as ag, type SessionInfo as ah, type SessionListResult as ai, type SessionSpec as aj, type SessionSummary as ak, type Supervisor as al, type SupervisorAction as am, type SupervisorEvent as an, type SupervisorPhase as ao, type TaskPlan as ap, type TaskPlanEvent as aq, type TaskPlanStep as ar, type TaskPlanStepStatus as as, type ThinkingDeltaEvent as at, type TokenRequestReason as au, type TokenSource as av, type ToolBudget as aw, type ToolBudgetExceededEvent as ax, type ToolBudgets as ay, type UserMessageEvent 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 LocalToolResultInEvent as u, type LoopDetectedEvent as v, type LoopDetection as w, type MantyxA2AOptions as x, MantyxAuthError as y, type MantyxClientOptions as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1514,23 +1514,24 @@ function normalizeLoopDetection(value) {
|
|
|
1514
1514
|
}
|
|
1515
1515
|
return out;
|
|
1516
1516
|
}
|
|
1517
|
-
function assertThreshold(label, value, min) {
|
|
1517
|
+
function assertThreshold(label, value, min, max = LOOP_DETECTION_THRESHOLD_MAX) {
|
|
1518
1518
|
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value)) {
|
|
1519
1519
|
throw new MantyxError(`${label} must be an integer, got ${JSON.stringify(value)}`);
|
|
1520
1520
|
}
|
|
1521
1521
|
if (value < min) {
|
|
1522
1522
|
throw new MantyxError(`${label} must be >= ${min}, got ${value}`);
|
|
1523
1523
|
}
|
|
1524
|
-
if (value >
|
|
1525
|
-
throw new MantyxError(
|
|
1526
|
-
`${label} must be <= ${LOOP_DETECTION_THRESHOLD_MAX} (server-enforced), got ${value}`
|
|
1527
|
-
);
|
|
1524
|
+
if (value > max) {
|
|
1525
|
+
throw new MantyxError(`${label} must be <= ${max} (server-enforced), got ${value}`);
|
|
1528
1526
|
}
|
|
1529
1527
|
return value;
|
|
1530
1528
|
}
|
|
1531
1529
|
var TOOL_BUDGETS_MAX_ENTRIES = 32;
|
|
1532
1530
|
var TOOL_BUDGET_MAX_NAME_LEN = 120;
|
|
1533
1531
|
var TOOL_BUDGET_MAX_CALLS = 1e3;
|
|
1532
|
+
var SUPERVISOR_INTERVAL_MAX = 100;
|
|
1533
|
+
var SUPERVISOR_REASONING_CHARS_MAX = 5e4;
|
|
1534
|
+
var SUPERVISOR_REASONING_MS_MAX = 6e5;
|
|
1534
1535
|
function normalizeSupervisor(value) {
|
|
1535
1536
|
if (value === false) return false;
|
|
1536
1537
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -1540,7 +1541,35 @@ function normalizeSupervisor(value) {
|
|
|
1540
1541
|
}
|
|
1541
1542
|
const out = {};
|
|
1542
1543
|
if (value.interval !== void 0) {
|
|
1543
|
-
out.interval = assertThreshold("supervisor.interval", value.interval, 1);
|
|
1544
|
+
out.interval = assertThreshold("supervisor.interval", value.interval, 1, SUPERVISOR_INTERVAL_MAX);
|
|
1545
|
+
}
|
|
1546
|
+
if (value.reasoningTrigger !== void 0) {
|
|
1547
|
+
if (value.reasoningTrigger === false) {
|
|
1548
|
+
out.reasoningTrigger = false;
|
|
1549
|
+
} else if (!value.reasoningTrigger || typeof value.reasoningTrigger !== "object" || Array.isArray(value.reasoningTrigger)) {
|
|
1550
|
+
throw new MantyxError(
|
|
1551
|
+
`supervisor.reasoningTrigger must be \`false\` or an object { chars?, ms? }, got ${JSON.stringify(value.reasoningTrigger)}`
|
|
1552
|
+
);
|
|
1553
|
+
} else {
|
|
1554
|
+
const rt = {};
|
|
1555
|
+
if (value.reasoningTrigger.chars !== void 0) {
|
|
1556
|
+
rt.chars = assertThreshold(
|
|
1557
|
+
"supervisor.reasoningTrigger.chars",
|
|
1558
|
+
value.reasoningTrigger.chars,
|
|
1559
|
+
1,
|
|
1560
|
+
SUPERVISOR_REASONING_CHARS_MAX
|
|
1561
|
+
);
|
|
1562
|
+
}
|
|
1563
|
+
if (value.reasoningTrigger.ms !== void 0) {
|
|
1564
|
+
rt.ms = assertThreshold(
|
|
1565
|
+
"supervisor.reasoningTrigger.ms",
|
|
1566
|
+
value.reasoningTrigger.ms,
|
|
1567
|
+
1,
|
|
1568
|
+
SUPERVISOR_REASONING_MS_MAX
|
|
1569
|
+
);
|
|
1570
|
+
}
|
|
1571
|
+
out.reasoningTrigger = rt;
|
|
1572
|
+
}
|
|
1544
1573
|
}
|
|
1545
1574
|
return out;
|
|
1546
1575
|
}
|
|
@@ -1953,7 +1982,7 @@ function normalizeScope(scope) {
|
|
|
1953
1982
|
}
|
|
1954
1983
|
|
|
1955
1984
|
// src/version.ts
|
|
1956
|
-
var SDK_VERSION = "0.
|
|
1985
|
+
var SDK_VERSION = "0.16.0";
|
|
1957
1986
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1958
1987
|
0 && (module.exports = {
|
|
1959
1988
|
AgentSession,
|