@runtypelabs/sdk 11.19.0 → 11.19.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/dist/index.cjs +114 -19
- package/dist/index.d.cts +34 -55
- package/dist/index.d.ts +34 -55
- package/dist/index.mjs +114 -19
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -222,7 +222,8 @@ function createFlowEventTranslator() {
|
|
|
222
222
|
awaitedAt: data.awaitedAt,
|
|
223
223
|
origin: data.origin,
|
|
224
224
|
pageOrigin: data.pageOrigin,
|
|
225
|
-
annotations: data.annotations
|
|
225
|
+
annotations: data.annotations,
|
|
226
|
+
subagent: data.subagent
|
|
226
227
|
})];
|
|
227
228
|
default: return [];
|
|
228
229
|
}
|
|
@@ -870,7 +871,7 @@ var FlowResult = class {
|
|
|
870
871
|
*/
|
|
871
872
|
async stream(callbacks = {}) {
|
|
872
873
|
if (this.consumed && this.cachedSummary) {
|
|
873
|
-
if (callbacks.onFlowComplete) callbacks.onFlowComplete({
|
|
874
|
+
if (callbacks.onFlowComplete && !this.cachedSummary.paused) callbacks.onFlowComplete({
|
|
874
875
|
type: "flow_complete",
|
|
875
876
|
flowId: this.cachedSummary.flowId,
|
|
876
877
|
totalSteps: this.cachedSummary.totalSteps,
|
|
@@ -1807,6 +1808,13 @@ function createExternalTool(config) {
|
|
|
1807
1808
|
};
|
|
1808
1809
|
}
|
|
1809
1810
|
// src/local-tool-pause.ts
|
|
1811
|
+
function subagentOf(value) {
|
|
1812
|
+
const subagent = value;
|
|
1813
|
+
return typeof subagent?.toolName === "string" && typeof subagent.parentToolCallId === "string" ? {
|
|
1814
|
+
toolName: subagent.toolName,
|
|
1815
|
+
parentToolCallId: subagent.parentToolCallId
|
|
1816
|
+
} : void 0;
|
|
1817
|
+
}
|
|
1810
1818
|
/**
|
|
1811
1819
|
* Fold a unified `await` event, or an SDK stable-callback `flow_await` /
|
|
1812
1820
|
* `step_await`, into the per-tool paused-state map. Compatibility frames may
|
|
@@ -1827,10 +1835,12 @@ function collectLocalToolAwait(pausedTools, event) {
|
|
|
1827
1835
|
const pending = pausedTools.get(PENDING_NAMELESS_KEY);
|
|
1828
1836
|
if (pending) pausedTools.delete(PENDING_NAMELESS_KEY);
|
|
1829
1837
|
const prev = pausedTools.get(name) ?? pending;
|
|
1838
|
+
const subagent = subagentOf(event.subagent) ?? prev?.subagent;
|
|
1830
1839
|
pausedTools.set(name, {
|
|
1831
1840
|
toolName: name,
|
|
1832
1841
|
executionId: executionId ?? prev?.executionId ?? "",
|
|
1833
|
-
parameters: event.parameters ?? prev?.parameters
|
|
1842
|
+
parameters: event.parameters ?? prev?.parameters,
|
|
1843
|
+
...subagent ? { subagent } : {}
|
|
1834
1844
|
});
|
|
1835
1845
|
return;
|
|
1836
1846
|
}
|
|
@@ -1853,6 +1863,55 @@ function resolveBatchExecutionId(pausedTools) {
|
|
|
1853
1863
|
for (const tool of pausedTools) if (tool.executionId) return tool.executionId;
|
|
1854
1864
|
return "";
|
|
1855
1865
|
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Splits a paused batch into the calls this caller runs and the sub-agent requests it holds no handler for.
|
|
1868
|
+
* Those are left paused on the parent for whoever watches it (an approver, a UI), never thrown as missing.
|
|
1869
|
+
*/
|
|
1870
|
+
function partitionLocalToolBatch(pausedTools, hasHandler) {
|
|
1871
|
+
const leftToParent = pausedTools.filter((tool) => tool.subagent && !hasHandler(tool.toolName));
|
|
1872
|
+
return {
|
|
1873
|
+
runnable: pausedTools.filter((tool) => !leftToParent.includes(tool)),
|
|
1874
|
+
leftToParent
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
/** The result a run returns when every remaining request belongs to a sub-agent this caller cannot answer. */
|
|
1878
|
+
function pausedOnSubagentEnvelope(executionId, leftToParent) {
|
|
1879
|
+
return {
|
|
1880
|
+
status: "paused",
|
|
1881
|
+
executionId,
|
|
1882
|
+
pausedTools: leftToParent
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
/** A run's summary when it stopped on sub-agent requests this caller cannot answer, so every result getter reads it. */
|
|
1886
|
+
function pausedOnSubagentSummary(executionId, leftToParent) {
|
|
1887
|
+
return {
|
|
1888
|
+
flowId: "",
|
|
1889
|
+
flowName: "",
|
|
1890
|
+
totalSteps: 0,
|
|
1891
|
+
successfulSteps: 0,
|
|
1892
|
+
failedSteps: 0,
|
|
1893
|
+
executionTime: 0,
|
|
1894
|
+
results: /* @__PURE__ */ new Map(),
|
|
1895
|
+
success: true,
|
|
1896
|
+
paused: pausedOnSubagentEnvelope(executionId, leftToParent)
|
|
1897
|
+
};
|
|
1898
|
+
}
|
|
1899
|
+
/** The next batch with the sub-agent requests still held from an earlier cycle, each once. */
|
|
1900
|
+
function withCarriedRequests(carried, pausedTools) {
|
|
1901
|
+
const key = (tool) => `${tool.subagent?.parentToolCallId ?? ""}:${tool.toolName}`;
|
|
1902
|
+
const seen = new Set(pausedTools.map(key));
|
|
1903
|
+
return [...pausedTools, ...carried.filter((tool) => !seen.has(key(tool)))];
|
|
1904
|
+
}
|
|
1905
|
+
/** Whether a buffered envelope reached the run's end; one whose follow closed before a terminal frame did not. */
|
|
1906
|
+
function bufferedReachedTerminal(data) {
|
|
1907
|
+
if (typeof data !== "object" || data === null) return true;
|
|
1908
|
+
const { status, events } = data;
|
|
1909
|
+
if (status !== "failed" || !Array.isArray(events)) return true;
|
|
1910
|
+
return events.some((event) => {
|
|
1911
|
+
const type = event?.type;
|
|
1912
|
+
return type === "execution_complete" || type === "execution_error";
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1856
1915
|
// src/detached-reconnect.ts
|
|
1857
1916
|
/**
|
|
1858
1917
|
* Transparent reconnect for a DETACHED agent stream (ADR 0020 point 6;
|
|
@@ -10792,6 +10851,7 @@ var RuntypeFlowBuilder = class {
|
|
|
10792
10851
|
};
|
|
10793
10852
|
const processStep = async (response) => {
|
|
10794
10853
|
if (isStreaming) {
|
|
10854
|
+
let reachedTerminal = false;
|
|
10795
10855
|
const pausedTools = /* @__PURE__ */ new Map();
|
|
10796
10856
|
const wrappedCallbacks = {
|
|
10797
10857
|
...callbacks,
|
|
@@ -10820,9 +10880,12 @@ var RuntypeFlowBuilder = class {
|
|
|
10820
10880
|
wrappedCallbacks.onStepComplete?.(event.result, event);
|
|
10821
10881
|
break;
|
|
10822
10882
|
case "flow_complete":
|
|
10883
|
+
reachedTerminal = true;
|
|
10823
10884
|
wrappedCallbacks.onFlowComplete?.(event);
|
|
10824
10885
|
break;
|
|
10825
|
-
case "flow_error":
|
|
10886
|
+
case "flow_error":
|
|
10887
|
+
reachedTerminal = true;
|
|
10888
|
+
wrappedCallbacks.onError?.(new Error(flowErrorMessage(event)));
|
|
10826
10889
|
}
|
|
10827
10890
|
}
|
|
10828
10891
|
} catch (e) {
|
|
@@ -10838,7 +10901,8 @@ var RuntypeFlowBuilder = class {
|
|
|
10838
10901
|
};
|
|
10839
10902
|
return {
|
|
10840
10903
|
done: true,
|
|
10841
|
-
result: accumulatedSummary
|
|
10904
|
+
result: accumulatedSummary,
|
|
10905
|
+
terminal: reachedTerminal
|
|
10842
10906
|
};
|
|
10843
10907
|
} else {
|
|
10844
10908
|
const data = await response.json();
|
|
@@ -10861,10 +10925,15 @@ var RuntypeFlowBuilder = class {
|
|
|
10861
10925
|
}
|
|
10862
10926
|
return {
|
|
10863
10927
|
done: true,
|
|
10864
|
-
result: data
|
|
10928
|
+
result: data,
|
|
10929
|
+
terminal: bufferedReachedTerminal(data)
|
|
10865
10930
|
};
|
|
10866
10931
|
}
|
|
10867
10932
|
};
|
|
10933
|
+
const pausedOnSubagent = (left) => {
|
|
10934
|
+
const summary = pausedOnSubagentSummary(resolveBatchExecutionId(left), left);
|
|
10935
|
+
return new FlowResult(new Response(JSON.stringify(summary.paused), { headers: { "content-type": "application/json" } }), summary);
|
|
10936
|
+
};
|
|
10868
10937
|
let currentResponse;
|
|
10869
10938
|
let carriedRelease = {};
|
|
10870
10939
|
if (isStreaming) currentResponse = await client.dispatch(config);
|
|
@@ -10873,8 +10942,11 @@ var RuntypeFlowBuilder = class {
|
|
|
10873
10942
|
carriedRelease = releaseFieldsOf(data);
|
|
10874
10943
|
currentResponse = new Response(JSON.stringify(data), { headers: { "content-type": "application/json" } });
|
|
10875
10944
|
}
|
|
10945
|
+
let carried = [];
|
|
10876
10946
|
while (true) {
|
|
10877
|
-
const { done, result } = await processStep(currentResponse);
|
|
10947
|
+
const { done, result, terminal } = await processStep(currentResponse);
|
|
10948
|
+
const pausedNow = result;
|
|
10949
|
+
if (carried.length > 0 && (done ? terminal === false : !(pausedNow.status === "paused" && pausedNow.pausedTools?.length))) return pausedOnSubagent(carried);
|
|
10878
10950
|
if (done) {
|
|
10879
10951
|
if (isStreaming) return new FlowResult(new Response(JSON.stringify(result), { headers: { "content-type": "application/json" } }), result);
|
|
10880
10952
|
return new FlowResult(new Response(JSON.stringify(result), { headers: { "content-type": "application/json" } }));
|
|
@@ -10882,8 +10954,11 @@ var RuntypeFlowBuilder = class {
|
|
|
10882
10954
|
const pausedResult = result;
|
|
10883
10955
|
if (pausedResult.status === "paused" && pausedResult.pausedTools?.length) {
|
|
10884
10956
|
const executionId = resolveBatchExecutionId(pausedResult.pausedTools);
|
|
10957
|
+
const { runnable, leftToParent } = partitionLocalToolBatch(withCarriedRequests(carried, pausedResult.pausedTools), (toolName) => Boolean(localTools[toolName]));
|
|
10958
|
+
if (runnable.length === 0) return pausedOnSubagent(leftToParent);
|
|
10959
|
+
carried = leftToParent;
|
|
10885
10960
|
try {
|
|
10886
|
-
const outputs = await Promise.all(
|
|
10961
|
+
const outputs = await Promise.all(runnable.map(async ({ toolName, parameters }) => {
|
|
10887
10962
|
if (!localTools[toolName]) throw new Error(`Local tool "${toolName}" required but not provided in localTools map`);
|
|
10888
10963
|
try {
|
|
10889
10964
|
return [toolName, await localTools[toolName](parameters)];
|
|
@@ -14755,7 +14830,7 @@ function transformQueryParams(params) {
|
|
|
14755
14830
|
return result;
|
|
14756
14831
|
}
|
|
14757
14832
|
// src/version.ts
|
|
14758
|
-
const SDK_VERSION = "11.19.
|
|
14833
|
+
const SDK_VERSION = "11.19.2";
|
|
14759
14834
|
/**
|
|
14760
14835
|
* Canonical client identity the API uses for attribution
|
|
14761
14836
|
* (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
|
|
@@ -14772,6 +14847,14 @@ const RUNTYPE_CLIENT_KIND = "sdk";
|
|
|
14772
14847
|
*/
|
|
14773
14848
|
const SDK_USER_AGENT = `runtype-sdk/${SDK_VERSION} (typescript)`;
|
|
14774
14849
|
// src/client.ts
|
|
14850
|
+
/** The handler for a paused tool: its exact name first, then the webmcp:-stripped form, so no namespace shadows one. */
|
|
14851
|
+
function findLocalToolEntry(localTools, toolName) {
|
|
14852
|
+
const BARE_NAME_NAMESPACES = ["webmcp:"];
|
|
14853
|
+
const lookupCandidates = [toolName];
|
|
14854
|
+
for (const ns of BARE_NAME_NAMESPACES) if (toolName.startsWith(ns)) lookupCandidates.push(toolName.slice(ns.length));
|
|
14855
|
+
const matchedKey = lookupCandidates.find((key) => localTools[key]);
|
|
14856
|
+
return matchedKey ? localTools[matchedKey] : void 0;
|
|
14857
|
+
}
|
|
14775
14858
|
function isObjectRecord(value) {
|
|
14776
14859
|
return typeof value === "object" && value !== null;
|
|
14777
14860
|
}
|
|
@@ -14900,6 +14983,7 @@ var RuntypeClient = class {
|
|
|
14900
14983
|
};
|
|
14901
14984
|
const processStep = async (response) => {
|
|
14902
14985
|
if (isStreaming) {
|
|
14986
|
+
let reachedTerminal = false;
|
|
14903
14987
|
const pausedTools = /* @__PURE__ */ new Map();
|
|
14904
14988
|
const wrappedCallbacks = {
|
|
14905
14989
|
...callbacks,
|
|
@@ -14932,9 +15016,12 @@ var RuntypeClient = class {
|
|
|
14932
15016
|
wrappedCallbacks.onStepComplete?.(event.result, event);
|
|
14933
15017
|
break;
|
|
14934
15018
|
case "flow_complete":
|
|
15019
|
+
reachedTerminal = true;
|
|
14935
15020
|
wrappedCallbacks.onFlowComplete?.(event);
|
|
14936
15021
|
break;
|
|
14937
|
-
case "flow_error":
|
|
15022
|
+
case "flow_error":
|
|
15023
|
+
reachedTerminal = true;
|
|
15024
|
+
wrappedCallbacks.onError?.(new Error(flowErrorMessage(event)));
|
|
14938
15025
|
}
|
|
14939
15026
|
}
|
|
14940
15027
|
} catch (e) {
|
|
@@ -14950,7 +15037,8 @@ var RuntypeClient = class {
|
|
|
14950
15037
|
};
|
|
14951
15038
|
return {
|
|
14952
15039
|
done: true,
|
|
14953
|
-
result: summary
|
|
15040
|
+
result: summary,
|
|
15041
|
+
terminal: reachedTerminal
|
|
14954
15042
|
};
|
|
14955
15043
|
} else {
|
|
14956
15044
|
const data = await response.json();
|
|
@@ -14973,10 +15061,16 @@ var RuntypeClient = class {
|
|
|
14973
15061
|
}
|
|
14974
15062
|
return {
|
|
14975
15063
|
done: true,
|
|
14976
|
-
result: data
|
|
15064
|
+
result: data,
|
|
15065
|
+
terminal: bufferedReachedTerminal(data)
|
|
14977
15066
|
};
|
|
14978
15067
|
}
|
|
14979
15068
|
};
|
|
15069
|
+
const pausedOnSubagent = (left) => {
|
|
15070
|
+
const summary = pausedOnSubagentSummary(resolveBatchExecutionId(left), left);
|
|
15071
|
+
if (isStreaming) return summary;
|
|
15072
|
+
return new FlowResult(new Response(JSON.stringify(summary.paused), { headers: { "content-type": "application/json" } }), summary);
|
|
15073
|
+
};
|
|
14980
15074
|
let currentResponse;
|
|
14981
15075
|
let carriedRelease = {};
|
|
14982
15076
|
if (isStreaming) currentResponse = await this.dispatch.executeStream(modifiedRequest);
|
|
@@ -14985,21 +15079,22 @@ var RuntypeClient = class {
|
|
|
14985
15079
|
carriedRelease = releaseFieldsOf(data);
|
|
14986
15080
|
currentResponse = new Response(JSON.stringify(data), { headers: { "content-type": "application/json" } });
|
|
14987
15081
|
}
|
|
15082
|
+
let carried = [];
|
|
14988
15083
|
while (true) {
|
|
14989
|
-
const { done, result } = await processStep(currentResponse);
|
|
15084
|
+
const { done, result, terminal } = await processStep(currentResponse);
|
|
15085
|
+
if (carried.length > 0 && (done ? terminal === false : !isPausedLocalActionResult(result))) return pausedOnSubagent(carried);
|
|
14990
15086
|
if (done) {
|
|
14991
15087
|
if (isStreaming) return result;
|
|
14992
15088
|
return new FlowResult(new Response(JSON.stringify(result), { headers: { "content-type": "application/json" } }));
|
|
14993
15089
|
}
|
|
14994
15090
|
if (isPausedLocalActionResult(result)) {
|
|
14995
15091
|
const executionId = resolveBatchExecutionId(result.pausedTools);
|
|
15092
|
+
const { runnable, leftToParent } = partitionLocalToolBatch(withCarriedRequests(carried, result.pausedTools), (toolName) => Boolean(findLocalToolEntry(localTools, toolName)));
|
|
15093
|
+
if (runnable.length === 0) return pausedOnSubagent(leftToParent);
|
|
15094
|
+
carried = leftToParent;
|
|
14996
15095
|
try {
|
|
14997
|
-
const outputs = await Promise.all(
|
|
14998
|
-
const
|
|
14999
|
-
const lookupCandidates = [toolName];
|
|
15000
|
-
for (const ns of BARE_NAME_NAMESPACES) if (toolName.startsWith(ns)) lookupCandidates.push(toolName.slice(ns.length));
|
|
15001
|
-
const matchedKey = lookupCandidates.find((key) => localTools[key]);
|
|
15002
|
-
const toolEntry = matchedKey ? localTools[matchedKey] : void 0;
|
|
15096
|
+
const outputs = await Promise.all(runnable.map(async ({ toolName, parameters }) => {
|
|
15097
|
+
const toolEntry = findLocalToolEntry(localTools, toolName);
|
|
15003
15098
|
if (!toolEntry) throw new Error(`Local tool "${toolName}" required but not provided in localTools map`);
|
|
15004
15099
|
const handler = hasToolEntryShape(toolEntry) ? toolEntry.execute : toolEntry;
|
|
15005
15100
|
try {
|
package/dist/index.d.cts
CHANGED
|
@@ -10145,7 +10145,7 @@ interface paths {
|
|
|
10145
10145
|
untrustedContentHint?: boolean;
|
|
10146
10146
|
}[];
|
|
10147
10147
|
clientToolsFingerprint?: string;
|
|
10148
|
-
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers).
|
|
10148
|
+
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). A proof that fails verification is rejected with 401 `invalid_identity_proof`. */
|
|
10149
10149
|
identityProof?: {
|
|
10150
10150
|
provider: string;
|
|
10151
10151
|
token: string;
|
|
@@ -10337,7 +10337,7 @@ interface paths {
|
|
|
10337
10337
|
};
|
|
10338
10338
|
/**
|
|
10339
10339
|
* List the visitor's own conversations
|
|
10340
|
-
* @description List conversations belonging to the calling browser's anonymous visitor, newest first, cursor-paginated. Requires both a live `sessionId` and the `X-Visitor-Token` secret from `/client/init`; the site-wide client token alone can never reach this route. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`
|
|
10340
|
+
* @description List conversations belonging to the calling browser's anonymous visitor, newest first, cursor-paginated. Requires both a live `sessionId` and the `X-Visitor-Token` secret from `/client/init`; the site-wide client token alone can never reach this route. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`) reporting what the server did with a supplied `X-Identity-Proof`, so a widget can tell a verified action from a browser-scoped one. It is exposed via CORS; it grants no authority.
|
|
10341
10341
|
*/
|
|
10342
10342
|
get: {
|
|
10343
10343
|
parameters: {
|
|
@@ -10440,22 +10440,13 @@ interface paths {
|
|
|
10440
10440
|
"application/json": components["schemas"]["Error"];
|
|
10441
10441
|
};
|
|
10442
10442
|
};
|
|
10443
|
-
/** @description An `X-Identity-Proof` was supplied but end-user identity admission is not enabled for this token owner, so it cannot be evaluated (`identity_proof_not_admitted`). Nothing was read, deleted, or otherwise acted on. Retry without the proof to act at plain browser scope. Distinct from 401 `invalid_identity_proof`, which means the proof WAS evaluated and rejected. */
|
|
10444
|
-
503: {
|
|
10445
|
-
headers: {
|
|
10446
|
-
[name: string]: unknown;
|
|
10447
|
-
};
|
|
10448
|
-
content: {
|
|
10449
|
-
"application/json": components["schemas"]["Error"];
|
|
10450
|
-
};
|
|
10451
|
-
};
|
|
10452
10443
|
};
|
|
10453
10444
|
};
|
|
10454
10445
|
put?: never;
|
|
10455
10446
|
post?: never;
|
|
10456
10447
|
/**
|
|
10457
10448
|
* Delete all of the visitor's own conversations
|
|
10458
|
-
* @description Permanently delete every conversation belonging to the calling visitor, with their transcripts. Intended for a widget's "clear my history" control and for host-site privacy-erasure hooks. Pass `targetId` to delete only the conversations a target-scoped UI actually listed; OMITTING it deliberately means every conversation in the authorized visitor scope, across all targets. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`
|
|
10449
|
+
* @description Permanently delete every conversation belonging to the calling visitor, with their transcripts. Intended for a widget's "clear my history" control and for host-site privacy-erasure hooks. Pass `targetId` to delete only the conversations a target-scoped UI actually listed; OMITTING it deliberately means every conversation in the authorized visitor scope, across all targets. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`) reporting what the server did with a supplied `X-Identity-Proof`, so a widget can tell a verified action from a browser-scoped one. It is exposed via CORS; it grants no authority.
|
|
10459
10450
|
*/
|
|
10460
10451
|
delete: {
|
|
10461
10452
|
parameters: {
|
|
@@ -10535,15 +10526,6 @@ interface paths {
|
|
|
10535
10526
|
"application/json": components["schemas"]["Error"];
|
|
10536
10527
|
};
|
|
10537
10528
|
};
|
|
10538
|
-
/** @description An `X-Identity-Proof` was supplied but end-user identity admission is not enabled for this token owner, so it cannot be evaluated (`identity_proof_not_admitted`). Nothing was read, deleted, or otherwise acted on. Retry without the proof to act at plain browser scope. Distinct from 401 `invalid_identity_proof`, which means the proof WAS evaluated and rejected. */
|
|
10539
|
-
503: {
|
|
10540
|
-
headers: {
|
|
10541
|
-
[name: string]: unknown;
|
|
10542
|
-
};
|
|
10543
|
-
content: {
|
|
10544
|
-
"application/json": components["schemas"]["Error"];
|
|
10545
|
-
};
|
|
10546
|
-
};
|
|
10547
10529
|
};
|
|
10548
10530
|
};
|
|
10549
10531
|
options?: never;
|
|
@@ -10747,7 +10729,7 @@ interface paths {
|
|
|
10747
10729
|
};
|
|
10748
10730
|
/**
|
|
10749
10731
|
* Read one of the visitor's own conversations
|
|
10750
|
-
* @description Return a single conversation with its message transcript. Answers 404 (never 403) for a conversation the caller does not own, so the route cannot be used to probe for other visitors' conversations. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`
|
|
10732
|
+
* @description Return a single conversation with its message transcript. Answers 404 (never 403) for a conversation the caller does not own, so the route cannot be used to probe for other visitors' conversations. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`) reporting what the server did with a supplied `X-Identity-Proof`, so a widget can tell a verified action from a browser-scoped one. It is exposed via CORS; it grants no authority.
|
|
10751
10733
|
*/
|
|
10752
10734
|
get: {
|
|
10753
10735
|
parameters: {
|
|
@@ -10872,22 +10854,13 @@ interface paths {
|
|
|
10872
10854
|
"application/json": components["schemas"]["Error"];
|
|
10873
10855
|
};
|
|
10874
10856
|
};
|
|
10875
|
-
/** @description An `X-Identity-Proof` was supplied but end-user identity admission is not enabled for this token owner, so it cannot be evaluated (`identity_proof_not_admitted`). Nothing was read, deleted, or otherwise acted on. Retry without the proof to act at plain browser scope. Distinct from 401 `invalid_identity_proof`, which means the proof WAS evaluated and rejected. */
|
|
10876
|
-
503: {
|
|
10877
|
-
headers: {
|
|
10878
|
-
[name: string]: unknown;
|
|
10879
|
-
};
|
|
10880
|
-
content: {
|
|
10881
|
-
"application/json": components["schemas"]["Error"];
|
|
10882
|
-
};
|
|
10883
|
-
};
|
|
10884
10857
|
};
|
|
10885
10858
|
};
|
|
10886
10859
|
put?: never;
|
|
10887
10860
|
post?: never;
|
|
10888
10861
|
/**
|
|
10889
10862
|
* Delete one of the visitor's own conversations
|
|
10890
|
-
* @description Permanently delete a conversation and its stored transcript. Answers 404 (never 403) for a conversation the caller does not own. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`
|
|
10863
|
+
* @description Permanently delete a conversation and its stored transcript. Answers 404 (never 403) for a conversation the caller does not own. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`) reporting what the server did with a supplied `X-Identity-Proof`, so a widget can tell a verified action from a browser-scoped one. It is exposed via CORS; it grants no authority.
|
|
10891
10864
|
*/
|
|
10892
10865
|
delete: {
|
|
10893
10866
|
parameters: {
|
|
@@ -10975,15 +10948,6 @@ interface paths {
|
|
|
10975
10948
|
"application/json": components["schemas"]["Error"];
|
|
10976
10949
|
};
|
|
10977
10950
|
};
|
|
10978
|
-
/** @description An `X-Identity-Proof` was supplied but end-user identity admission is not enabled for this token owner, so it cannot be evaluated (`identity_proof_not_admitted`). Nothing was read, deleted, or otherwise acted on. Retry without the proof to act at plain browser scope. Distinct from 401 `invalid_identity_proof`, which means the proof WAS evaluated and rejected. */
|
|
10979
|
-
503: {
|
|
10980
|
-
headers: {
|
|
10981
|
-
[name: string]: unknown;
|
|
10982
|
-
};
|
|
10983
|
-
content: {
|
|
10984
|
-
"application/json": components["schemas"]["Error"];
|
|
10985
|
-
};
|
|
10986
|
-
};
|
|
10987
10951
|
};
|
|
10988
10952
|
};
|
|
10989
10953
|
options?: never;
|
|
@@ -11386,7 +11350,7 @@ interface paths {
|
|
|
11386
11350
|
/** @description Durable anonymous visitor id (`cvis_…`). */
|
|
11387
11351
|
id: string;
|
|
11388
11352
|
/**
|
|
11389
|
-
* @description What the server did with a supplied `identityProof` on THIS request. `not_provided`: none was sent. `admitted`: it was verified and produced the end-user scope. `ignored`:
|
|
11353
|
+
* @description What the server did with a supplied `identityProof` on THIS request. `not_provided`: none was sent. `admitted`: it was verified and produced the end-user scope. `ignored`: no longer emitted, because every token owner now evaluates a supplied proof; it stays in the enum for older clients. An invalid proof fails init with 401 `invalid_identity_proof`. Reporting only: it confers no authority and carries no identity value.
|
|
11390
11354
|
* @enum {string}
|
|
11391
11355
|
*/
|
|
11392
11356
|
identityStatus: "not_provided" | "admitted" | "ignored";
|
|
@@ -11643,7 +11607,7 @@ interface paths {
|
|
|
11643
11607
|
put?: never;
|
|
11644
11608
|
/**
|
|
11645
11609
|
* Reset the current browser visitor
|
|
11646
|
-
* @description Explicit widget shutdown/logout lifecycle. Revokes the presented browser visitor when it still resolves, without deleting conversation records. The response is idempotent so it cannot reveal whether a visitor secret was valid. Clear the locally stored secret after success; a later history-capable init creates a clean anonymous visitor. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`
|
|
11610
|
+
* @description Explicit widget shutdown/logout lifecycle. Revokes the presented browser visitor when it still resolves, without deleting conversation records. The response is idempotent so it cannot reveal whether a visitor secret was valid. Clear the locally stored secret after success; a later history-capable init creates a clean anonymous visitor. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`) reporting what the server did with a supplied `X-Identity-Proof`, so a widget can tell a verified action from a browser-scoped one. It is exposed via CORS; it grants no authority.
|
|
11647
11611
|
*/
|
|
11648
11612
|
post: {
|
|
11649
11613
|
parameters: {
|
|
@@ -11720,15 +11684,6 @@ interface paths {
|
|
|
11720
11684
|
"application/json": components["schemas"]["Error"];
|
|
11721
11685
|
};
|
|
11722
11686
|
};
|
|
11723
|
-
/** @description An `X-Identity-Proof` was supplied but end-user identity admission is not enabled for this token owner, so it cannot be evaluated (`identity_proof_not_admitted`). Nothing was read, deleted, or otherwise acted on. Retry without the proof to act at plain browser scope. Distinct from 401 `invalid_identity_proof`, which means the proof WAS evaluated and rejected. */
|
|
11724
|
-
503: {
|
|
11725
|
-
headers: {
|
|
11726
|
-
[name: string]: unknown;
|
|
11727
|
-
};
|
|
11728
|
-
content: {
|
|
11729
|
-
"application/json": components["schemas"]["Error"];
|
|
11730
|
-
};
|
|
11731
|
-
};
|
|
11732
11687
|
};
|
|
11733
11688
|
};
|
|
11734
11689
|
delete?: never;
|
|
@@ -14413,7 +14368,7 @@ interface paths {
|
|
|
14413
14368
|
instruction: string;
|
|
14414
14369
|
maxToolCalls?: number;
|
|
14415
14370
|
/**
|
|
14416
|
-
* @description Execution
|
|
14371
|
+
* @description Execution speed. `standard` (the default) runs at normal speed; `fast` runs at a higher speed for tasks that need it. Applies when creating a task.
|
|
14417
14372
|
* @enum {string}
|
|
14418
14373
|
*/
|
|
14419
14374
|
priority?: "standard" | "fast";
|
|
@@ -16295,7 +16250,7 @@ interface paths {
|
|
|
16295
16250
|
* @enum {string}
|
|
16296
16251
|
*/
|
|
16297
16252
|
history?: "inline" | "stored";
|
|
16298
|
-
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers).
|
|
16253
|
+
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). A proof that fails verification is rejected with 401 `invalid_identity_proof`. */
|
|
16299
16254
|
identityProof?: {
|
|
16300
16255
|
provider: string;
|
|
16301
16256
|
token: string;
|
|
@@ -16768,7 +16723,7 @@ interface paths {
|
|
|
16768
16723
|
* @enum {string}
|
|
16769
16724
|
*/
|
|
16770
16725
|
history?: "inline" | "stored";
|
|
16771
|
-
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers).
|
|
16726
|
+
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). A proof that fails verification is rejected with 401 `invalid_identity_proof`. */
|
|
16772
16727
|
identityProof?: {
|
|
16773
16728
|
provider: string;
|
|
16774
16729
|
token: string;
|
|
@@ -63950,6 +63905,11 @@ interface components {
|
|
|
63950
63905
|
};
|
|
63951
63906
|
seq: number;
|
|
63952
63907
|
stepId?: string;
|
|
63908
|
+
subagent?: {
|
|
63909
|
+
agentName?: string;
|
|
63910
|
+
parentToolCallId?: string;
|
|
63911
|
+
toolName: string;
|
|
63912
|
+
};
|
|
63953
63913
|
toolCallId?: string;
|
|
63954
63914
|
toolId?: string;
|
|
63955
63915
|
toolName?: string;
|
|
@@ -67440,6 +67400,19 @@ interface ContextErrorHandling {
|
|
|
67440
67400
|
onError: ErrorHandlingMode;
|
|
67441
67401
|
fallbacks?: ContextFallback[];
|
|
67442
67402
|
}
|
|
67403
|
+
/** A single paused local tool call awaiting client execution. */
|
|
67404
|
+
interface LocalToolPausedState {
|
|
67405
|
+
toolName: string;
|
|
67406
|
+
executionId: string;
|
|
67407
|
+
parameters?: unknown;
|
|
67408
|
+
/** Set when a sub-agent raised the request on the parent it is parked on; the caller may not hold its handler. */
|
|
67409
|
+
subagent?: LocalToolSubagent;
|
|
67410
|
+
}
|
|
67411
|
+
/** The parent call a sub-agent's request is shown under; answering it on the parent forwards it to the child. */
|
|
67412
|
+
interface LocalToolSubagent {
|
|
67413
|
+
toolName: string;
|
|
67414
|
+
parentToolCallId: string;
|
|
67415
|
+
}
|
|
67443
67416
|
/**
|
|
67444
67417
|
* Options for the flow stream consumers.
|
|
67445
67418
|
*
|
|
@@ -68199,6 +68172,12 @@ interface FlowSummary {
|
|
|
68199
68172
|
results: Map<string, any>;
|
|
68200
68173
|
/** Whether the flow completed successfully */
|
|
68201
68174
|
success: boolean;
|
|
68175
|
+
/** Set when the run stopped on sub-agent requests this caller registered no handler for; answer them on the parent. */
|
|
68176
|
+
paused?: {
|
|
68177
|
+
status: 'paused';
|
|
68178
|
+
executionId: string;
|
|
68179
|
+
pausedTools: LocalToolPausedState[];
|
|
68180
|
+
};
|
|
68202
68181
|
}
|
|
68203
68182
|
/**
|
|
68204
68183
|
* Generic flow-step config for step types that do not yet have a typed SDK
|
package/dist/index.d.ts
CHANGED
|
@@ -10145,7 +10145,7 @@ interface paths {
|
|
|
10145
10145
|
untrustedContentHint?: boolean;
|
|
10146
10146
|
}[];
|
|
10147
10147
|
clientToolsFingerprint?: string;
|
|
10148
|
-
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers).
|
|
10148
|
+
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). A proof that fails verification is rejected with 401 `invalid_identity_proof`. */
|
|
10149
10149
|
identityProof?: {
|
|
10150
10150
|
provider: string;
|
|
10151
10151
|
token: string;
|
|
@@ -10337,7 +10337,7 @@ interface paths {
|
|
|
10337
10337
|
};
|
|
10338
10338
|
/**
|
|
10339
10339
|
* List the visitor's own conversations
|
|
10340
|
-
* @description List conversations belonging to the calling browser's anonymous visitor, newest first, cursor-paginated. Requires both a live `sessionId` and the `X-Visitor-Token` secret from `/client/init`; the site-wide client token alone can never reach this route. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`
|
|
10340
|
+
* @description List conversations belonging to the calling browser's anonymous visitor, newest first, cursor-paginated. Requires both a live `sessionId` and the `X-Visitor-Token` secret from `/client/init`; the site-wide client token alone can never reach this route. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`) reporting what the server did with a supplied `X-Identity-Proof`, so a widget can tell a verified action from a browser-scoped one. It is exposed via CORS; it grants no authority.
|
|
10341
10341
|
*/
|
|
10342
10342
|
get: {
|
|
10343
10343
|
parameters: {
|
|
@@ -10440,22 +10440,13 @@ interface paths {
|
|
|
10440
10440
|
"application/json": components["schemas"]["Error"];
|
|
10441
10441
|
};
|
|
10442
10442
|
};
|
|
10443
|
-
/** @description An `X-Identity-Proof` was supplied but end-user identity admission is not enabled for this token owner, so it cannot be evaluated (`identity_proof_not_admitted`). Nothing was read, deleted, or otherwise acted on. Retry without the proof to act at plain browser scope. Distinct from 401 `invalid_identity_proof`, which means the proof WAS evaluated and rejected. */
|
|
10444
|
-
503: {
|
|
10445
|
-
headers: {
|
|
10446
|
-
[name: string]: unknown;
|
|
10447
|
-
};
|
|
10448
|
-
content: {
|
|
10449
|
-
"application/json": components["schemas"]["Error"];
|
|
10450
|
-
};
|
|
10451
|
-
};
|
|
10452
10443
|
};
|
|
10453
10444
|
};
|
|
10454
10445
|
put?: never;
|
|
10455
10446
|
post?: never;
|
|
10456
10447
|
/**
|
|
10457
10448
|
* Delete all of the visitor's own conversations
|
|
10458
|
-
* @description Permanently delete every conversation belonging to the calling visitor, with their transcripts. Intended for a widget's "clear my history" control and for host-site privacy-erasure hooks. Pass `targetId` to delete only the conversations a target-scoped UI actually listed; OMITTING it deliberately means every conversation in the authorized visitor scope, across all targets. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`
|
|
10449
|
+
* @description Permanently delete every conversation belonging to the calling visitor, with their transcripts. Intended for a widget's "clear my history" control and for host-site privacy-erasure hooks. Pass `targetId` to delete only the conversations a target-scoped UI actually listed; OMITTING it deliberately means every conversation in the authorized visitor scope, across all targets. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`) reporting what the server did with a supplied `X-Identity-Proof`, so a widget can tell a verified action from a browser-scoped one. It is exposed via CORS; it grants no authority.
|
|
10459
10450
|
*/
|
|
10460
10451
|
delete: {
|
|
10461
10452
|
parameters: {
|
|
@@ -10535,15 +10526,6 @@ interface paths {
|
|
|
10535
10526
|
"application/json": components["schemas"]["Error"];
|
|
10536
10527
|
};
|
|
10537
10528
|
};
|
|
10538
|
-
/** @description An `X-Identity-Proof` was supplied but end-user identity admission is not enabled for this token owner, so it cannot be evaluated (`identity_proof_not_admitted`). Nothing was read, deleted, or otherwise acted on. Retry without the proof to act at plain browser scope. Distinct from 401 `invalid_identity_proof`, which means the proof WAS evaluated and rejected. */
|
|
10539
|
-
503: {
|
|
10540
|
-
headers: {
|
|
10541
|
-
[name: string]: unknown;
|
|
10542
|
-
};
|
|
10543
|
-
content: {
|
|
10544
|
-
"application/json": components["schemas"]["Error"];
|
|
10545
|
-
};
|
|
10546
|
-
};
|
|
10547
10529
|
};
|
|
10548
10530
|
};
|
|
10549
10531
|
options?: never;
|
|
@@ -10747,7 +10729,7 @@ interface paths {
|
|
|
10747
10729
|
};
|
|
10748
10730
|
/**
|
|
10749
10731
|
* Read one of the visitor's own conversations
|
|
10750
|
-
* @description Return a single conversation with its message transcript. Answers 404 (never 403) for a conversation the caller does not own, so the route cannot be used to probe for other visitors' conversations. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`
|
|
10732
|
+
* @description Return a single conversation with its message transcript. Answers 404 (never 403) for a conversation the caller does not own, so the route cannot be used to probe for other visitors' conversations. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`) reporting what the server did with a supplied `X-Identity-Proof`, so a widget can tell a verified action from a browser-scoped one. It is exposed via CORS; it grants no authority.
|
|
10751
10733
|
*/
|
|
10752
10734
|
get: {
|
|
10753
10735
|
parameters: {
|
|
@@ -10872,22 +10854,13 @@ interface paths {
|
|
|
10872
10854
|
"application/json": components["schemas"]["Error"];
|
|
10873
10855
|
};
|
|
10874
10856
|
};
|
|
10875
|
-
/** @description An `X-Identity-Proof` was supplied but end-user identity admission is not enabled for this token owner, so it cannot be evaluated (`identity_proof_not_admitted`). Nothing was read, deleted, or otherwise acted on. Retry without the proof to act at plain browser scope. Distinct from 401 `invalid_identity_proof`, which means the proof WAS evaluated and rejected. */
|
|
10876
|
-
503: {
|
|
10877
|
-
headers: {
|
|
10878
|
-
[name: string]: unknown;
|
|
10879
|
-
};
|
|
10880
|
-
content: {
|
|
10881
|
-
"application/json": components["schemas"]["Error"];
|
|
10882
|
-
};
|
|
10883
|
-
};
|
|
10884
10857
|
};
|
|
10885
10858
|
};
|
|
10886
10859
|
put?: never;
|
|
10887
10860
|
post?: never;
|
|
10888
10861
|
/**
|
|
10889
10862
|
* Delete one of the visitor's own conversations
|
|
10890
|
-
* @description Permanently delete a conversation and its stored transcript. Answers 404 (never 403) for a conversation the caller does not own. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`
|
|
10863
|
+
* @description Permanently delete a conversation and its stored transcript. Answers 404 (never 403) for a conversation the caller does not own. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`) reporting what the server did with a supplied `X-Identity-Proof`, so a widget can tell a verified action from a browser-scoped one. It is exposed via CORS; it grants no authority.
|
|
10891
10864
|
*/
|
|
10892
10865
|
delete: {
|
|
10893
10866
|
parameters: {
|
|
@@ -10975,15 +10948,6 @@ interface paths {
|
|
|
10975
10948
|
"application/json": components["schemas"]["Error"];
|
|
10976
10949
|
};
|
|
10977
10950
|
};
|
|
10978
|
-
/** @description An `X-Identity-Proof` was supplied but end-user identity admission is not enabled for this token owner, so it cannot be evaluated (`identity_proof_not_admitted`). Nothing was read, deleted, or otherwise acted on. Retry without the proof to act at plain browser scope. Distinct from 401 `invalid_identity_proof`, which means the proof WAS evaluated and rejected. */
|
|
10979
|
-
503: {
|
|
10980
|
-
headers: {
|
|
10981
|
-
[name: string]: unknown;
|
|
10982
|
-
};
|
|
10983
|
-
content: {
|
|
10984
|
-
"application/json": components["schemas"]["Error"];
|
|
10985
|
-
};
|
|
10986
|
-
};
|
|
10987
10951
|
};
|
|
10988
10952
|
};
|
|
10989
10953
|
options?: never;
|
|
@@ -11386,7 +11350,7 @@ interface paths {
|
|
|
11386
11350
|
/** @description Durable anonymous visitor id (`cvis_…`). */
|
|
11387
11351
|
id: string;
|
|
11388
11352
|
/**
|
|
11389
|
-
* @description What the server did with a supplied `identityProof` on THIS request. `not_provided`: none was sent. `admitted`: it was verified and produced the end-user scope. `ignored`:
|
|
11353
|
+
* @description What the server did with a supplied `identityProof` on THIS request. `not_provided`: none was sent. `admitted`: it was verified and produced the end-user scope. `ignored`: no longer emitted, because every token owner now evaluates a supplied proof; it stays in the enum for older clients. An invalid proof fails init with 401 `invalid_identity_proof`. Reporting only: it confers no authority and carries no identity value.
|
|
11390
11354
|
* @enum {string}
|
|
11391
11355
|
*/
|
|
11392
11356
|
identityStatus: "not_provided" | "admitted" | "ignored";
|
|
@@ -11643,7 +11607,7 @@ interface paths {
|
|
|
11643
11607
|
put?: never;
|
|
11644
11608
|
/**
|
|
11645
11609
|
* Reset the current browser visitor
|
|
11646
|
-
* @description Explicit widget shutdown/logout lifecycle. Revokes the presented browser visitor when it still resolves, without deleting conversation records. The response is idempotent so it cannot reveal whether a visitor secret was valid. Clear the locally stored secret after success; a later history-capable init creates a clean anonymous visitor. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`
|
|
11610
|
+
* @description Explicit widget shutdown/logout lifecycle. Revokes the presented browser visitor when it still resolves, without deleting conversation records. The response is idempotent so it cannot reveal whether a visitor secret was valid. Clear the locally stored secret after success; a later history-capable init creates a clean anonymous visitor. Every response carries `X-History-Identity-Status` (`not_provided` | `admitted`) reporting what the server did with a supplied `X-Identity-Proof`, so a widget can tell a verified action from a browser-scoped one. It is exposed via CORS; it grants no authority.
|
|
11647
11611
|
*/
|
|
11648
11612
|
post: {
|
|
11649
11613
|
parameters: {
|
|
@@ -11720,15 +11684,6 @@ interface paths {
|
|
|
11720
11684
|
"application/json": components["schemas"]["Error"];
|
|
11721
11685
|
};
|
|
11722
11686
|
};
|
|
11723
|
-
/** @description An `X-Identity-Proof` was supplied but end-user identity admission is not enabled for this token owner, so it cannot be evaluated (`identity_proof_not_admitted`). Nothing was read, deleted, or otherwise acted on. Retry without the proof to act at plain browser scope. Distinct from 401 `invalid_identity_proof`, which means the proof WAS evaluated and rejected. */
|
|
11724
|
-
503: {
|
|
11725
|
-
headers: {
|
|
11726
|
-
[name: string]: unknown;
|
|
11727
|
-
};
|
|
11728
|
-
content: {
|
|
11729
|
-
"application/json": components["schemas"]["Error"];
|
|
11730
|
-
};
|
|
11731
|
-
};
|
|
11732
11687
|
};
|
|
11733
11688
|
};
|
|
11734
11689
|
delete?: never;
|
|
@@ -14413,7 +14368,7 @@ interface paths {
|
|
|
14413
14368
|
instruction: string;
|
|
14414
14369
|
maxToolCalls?: number;
|
|
14415
14370
|
/**
|
|
14416
|
-
* @description Execution
|
|
14371
|
+
* @description Execution speed. `standard` (the default) runs at normal speed; `fast` runs at a higher speed for tasks that need it. Applies when creating a task.
|
|
14417
14372
|
* @enum {string}
|
|
14418
14373
|
*/
|
|
14419
14374
|
priority?: "standard" | "fast";
|
|
@@ -16295,7 +16250,7 @@ interface paths {
|
|
|
16295
16250
|
* @enum {string}
|
|
16296
16251
|
*/
|
|
16297
16252
|
history?: "inline" | "stored";
|
|
16298
|
-
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers).
|
|
16253
|
+
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). A proof that fails verification is rejected with 401 `invalid_identity_proof`. */
|
|
16299
16254
|
identityProof?: {
|
|
16300
16255
|
provider: string;
|
|
16301
16256
|
token: string;
|
|
@@ -16768,7 +16723,7 @@ interface paths {
|
|
|
16768
16723
|
* @enum {string}
|
|
16769
16724
|
*/
|
|
16770
16725
|
history?: "inline" | "stored";
|
|
16771
|
-
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers).
|
|
16726
|
+
/** @description Customer-native auth proof for the Identity Exchange. When present and the surface has a matching integration, the verified tenant/end-user replace any body-asserted tenant/endUser (which are never trusted for web-embedded callers). A proof that fails verification is rejected with 401 `invalid_identity_proof`. */
|
|
16772
16727
|
identityProof?: {
|
|
16773
16728
|
provider: string;
|
|
16774
16729
|
token: string;
|
|
@@ -63950,6 +63905,11 @@ interface components {
|
|
|
63950
63905
|
};
|
|
63951
63906
|
seq: number;
|
|
63952
63907
|
stepId?: string;
|
|
63908
|
+
subagent?: {
|
|
63909
|
+
agentName?: string;
|
|
63910
|
+
parentToolCallId?: string;
|
|
63911
|
+
toolName: string;
|
|
63912
|
+
};
|
|
63953
63913
|
toolCallId?: string;
|
|
63954
63914
|
toolId?: string;
|
|
63955
63915
|
toolName?: string;
|
|
@@ -67440,6 +67400,19 @@ interface ContextErrorHandling {
|
|
|
67440
67400
|
onError: ErrorHandlingMode;
|
|
67441
67401
|
fallbacks?: ContextFallback[];
|
|
67442
67402
|
}
|
|
67403
|
+
/** A single paused local tool call awaiting client execution. */
|
|
67404
|
+
interface LocalToolPausedState {
|
|
67405
|
+
toolName: string;
|
|
67406
|
+
executionId: string;
|
|
67407
|
+
parameters?: unknown;
|
|
67408
|
+
/** Set when a sub-agent raised the request on the parent it is parked on; the caller may not hold its handler. */
|
|
67409
|
+
subagent?: LocalToolSubagent;
|
|
67410
|
+
}
|
|
67411
|
+
/** The parent call a sub-agent's request is shown under; answering it on the parent forwards it to the child. */
|
|
67412
|
+
interface LocalToolSubagent {
|
|
67413
|
+
toolName: string;
|
|
67414
|
+
parentToolCallId: string;
|
|
67415
|
+
}
|
|
67443
67416
|
/**
|
|
67444
67417
|
* Options for the flow stream consumers.
|
|
67445
67418
|
*
|
|
@@ -68199,6 +68172,12 @@ interface FlowSummary {
|
|
|
68199
68172
|
results: Map<string, any>;
|
|
68200
68173
|
/** Whether the flow completed successfully */
|
|
68201
68174
|
success: boolean;
|
|
68175
|
+
/** Set when the run stopped on sub-agent requests this caller registered no handler for; answer them on the parent. */
|
|
68176
|
+
paused?: {
|
|
68177
|
+
status: 'paused';
|
|
68178
|
+
executionId: string;
|
|
68179
|
+
pausedTools: LocalToolPausedState[];
|
|
68180
|
+
};
|
|
68202
68181
|
}
|
|
68203
68182
|
/**
|
|
68204
68183
|
* Generic flow-step config for step types that do not yet have a typed SDK
|
package/dist/index.mjs
CHANGED
|
@@ -221,7 +221,8 @@ function createFlowEventTranslator() {
|
|
|
221
221
|
awaitedAt: data.awaitedAt,
|
|
222
222
|
origin: data.origin,
|
|
223
223
|
pageOrigin: data.pageOrigin,
|
|
224
|
-
annotations: data.annotations
|
|
224
|
+
annotations: data.annotations,
|
|
225
|
+
subagent: data.subagent
|
|
225
226
|
})];
|
|
226
227
|
default: return [];
|
|
227
228
|
}
|
|
@@ -869,7 +870,7 @@ var FlowResult = class {
|
|
|
869
870
|
*/
|
|
870
871
|
async stream(callbacks = {}) {
|
|
871
872
|
if (this.consumed && this.cachedSummary) {
|
|
872
|
-
if (callbacks.onFlowComplete) callbacks.onFlowComplete({
|
|
873
|
+
if (callbacks.onFlowComplete && !this.cachedSummary.paused) callbacks.onFlowComplete({
|
|
873
874
|
type: "flow_complete",
|
|
874
875
|
flowId: this.cachedSummary.flowId,
|
|
875
876
|
totalSteps: this.cachedSummary.totalSteps,
|
|
@@ -1806,6 +1807,13 @@ function createExternalTool(config) {
|
|
|
1806
1807
|
};
|
|
1807
1808
|
}
|
|
1808
1809
|
// src/local-tool-pause.ts
|
|
1810
|
+
function subagentOf(value) {
|
|
1811
|
+
const subagent = value;
|
|
1812
|
+
return typeof subagent?.toolName === "string" && typeof subagent.parentToolCallId === "string" ? {
|
|
1813
|
+
toolName: subagent.toolName,
|
|
1814
|
+
parentToolCallId: subagent.parentToolCallId
|
|
1815
|
+
} : void 0;
|
|
1816
|
+
}
|
|
1809
1817
|
/**
|
|
1810
1818
|
* Fold a unified `await` event, or an SDK stable-callback `flow_await` /
|
|
1811
1819
|
* `step_await`, into the per-tool paused-state map. Compatibility frames may
|
|
@@ -1826,10 +1834,12 @@ function collectLocalToolAwait(pausedTools, event) {
|
|
|
1826
1834
|
const pending = pausedTools.get(PENDING_NAMELESS_KEY);
|
|
1827
1835
|
if (pending) pausedTools.delete(PENDING_NAMELESS_KEY);
|
|
1828
1836
|
const prev = pausedTools.get(name) ?? pending;
|
|
1837
|
+
const subagent = subagentOf(event.subagent) ?? prev?.subagent;
|
|
1829
1838
|
pausedTools.set(name, {
|
|
1830
1839
|
toolName: name,
|
|
1831
1840
|
executionId: executionId ?? prev?.executionId ?? "",
|
|
1832
|
-
parameters: event.parameters ?? prev?.parameters
|
|
1841
|
+
parameters: event.parameters ?? prev?.parameters,
|
|
1842
|
+
...subagent ? { subagent } : {}
|
|
1833
1843
|
});
|
|
1834
1844
|
return;
|
|
1835
1845
|
}
|
|
@@ -1852,6 +1862,55 @@ function resolveBatchExecutionId(pausedTools) {
|
|
|
1852
1862
|
for (const tool of pausedTools) if (tool.executionId) return tool.executionId;
|
|
1853
1863
|
return "";
|
|
1854
1864
|
}
|
|
1865
|
+
/**
|
|
1866
|
+
* Splits a paused batch into the calls this caller runs and the sub-agent requests it holds no handler for.
|
|
1867
|
+
* Those are left paused on the parent for whoever watches it (an approver, a UI), never thrown as missing.
|
|
1868
|
+
*/
|
|
1869
|
+
function partitionLocalToolBatch(pausedTools, hasHandler) {
|
|
1870
|
+
const leftToParent = pausedTools.filter((tool) => tool.subagent && !hasHandler(tool.toolName));
|
|
1871
|
+
return {
|
|
1872
|
+
runnable: pausedTools.filter((tool) => !leftToParent.includes(tool)),
|
|
1873
|
+
leftToParent
|
|
1874
|
+
};
|
|
1875
|
+
}
|
|
1876
|
+
/** The result a run returns when every remaining request belongs to a sub-agent this caller cannot answer. */
|
|
1877
|
+
function pausedOnSubagentEnvelope(executionId, leftToParent) {
|
|
1878
|
+
return {
|
|
1879
|
+
status: "paused",
|
|
1880
|
+
executionId,
|
|
1881
|
+
pausedTools: leftToParent
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1884
|
+
/** A run's summary when it stopped on sub-agent requests this caller cannot answer, so every result getter reads it. */
|
|
1885
|
+
function pausedOnSubagentSummary(executionId, leftToParent) {
|
|
1886
|
+
return {
|
|
1887
|
+
flowId: "",
|
|
1888
|
+
flowName: "",
|
|
1889
|
+
totalSteps: 0,
|
|
1890
|
+
successfulSteps: 0,
|
|
1891
|
+
failedSteps: 0,
|
|
1892
|
+
executionTime: 0,
|
|
1893
|
+
results: /* @__PURE__ */ new Map(),
|
|
1894
|
+
success: true,
|
|
1895
|
+
paused: pausedOnSubagentEnvelope(executionId, leftToParent)
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
/** The next batch with the sub-agent requests still held from an earlier cycle, each once. */
|
|
1899
|
+
function withCarriedRequests(carried, pausedTools) {
|
|
1900
|
+
const key = (tool) => `${tool.subagent?.parentToolCallId ?? ""}:${tool.toolName}`;
|
|
1901
|
+
const seen = new Set(pausedTools.map(key));
|
|
1902
|
+
return [...pausedTools, ...carried.filter((tool) => !seen.has(key(tool)))];
|
|
1903
|
+
}
|
|
1904
|
+
/** Whether a buffered envelope reached the run's end; one whose follow closed before a terminal frame did not. */
|
|
1905
|
+
function bufferedReachedTerminal(data) {
|
|
1906
|
+
if (typeof data !== "object" || data === null) return true;
|
|
1907
|
+
const { status, events } = data;
|
|
1908
|
+
if (status !== "failed" || !Array.isArray(events)) return true;
|
|
1909
|
+
return events.some((event) => {
|
|
1910
|
+
const type = event?.type;
|
|
1911
|
+
return type === "execution_complete" || type === "execution_error";
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1855
1914
|
// src/detached-reconnect.ts
|
|
1856
1915
|
/**
|
|
1857
1916
|
* Transparent reconnect for a DETACHED agent stream (ADR 0020 point 6;
|
|
@@ -10791,6 +10850,7 @@ var RuntypeFlowBuilder = class {
|
|
|
10791
10850
|
};
|
|
10792
10851
|
const processStep = async (response) => {
|
|
10793
10852
|
if (isStreaming) {
|
|
10853
|
+
let reachedTerminal = false;
|
|
10794
10854
|
const pausedTools = /* @__PURE__ */ new Map();
|
|
10795
10855
|
const wrappedCallbacks = {
|
|
10796
10856
|
...callbacks,
|
|
@@ -10819,9 +10879,12 @@ var RuntypeFlowBuilder = class {
|
|
|
10819
10879
|
wrappedCallbacks.onStepComplete?.(event.result, event);
|
|
10820
10880
|
break;
|
|
10821
10881
|
case "flow_complete":
|
|
10882
|
+
reachedTerminal = true;
|
|
10822
10883
|
wrappedCallbacks.onFlowComplete?.(event);
|
|
10823
10884
|
break;
|
|
10824
|
-
case "flow_error":
|
|
10885
|
+
case "flow_error":
|
|
10886
|
+
reachedTerminal = true;
|
|
10887
|
+
wrappedCallbacks.onError?.(new Error(flowErrorMessage(event)));
|
|
10825
10888
|
}
|
|
10826
10889
|
}
|
|
10827
10890
|
} catch (e) {
|
|
@@ -10837,7 +10900,8 @@ var RuntypeFlowBuilder = class {
|
|
|
10837
10900
|
};
|
|
10838
10901
|
return {
|
|
10839
10902
|
done: true,
|
|
10840
|
-
result: accumulatedSummary
|
|
10903
|
+
result: accumulatedSummary,
|
|
10904
|
+
terminal: reachedTerminal
|
|
10841
10905
|
};
|
|
10842
10906
|
} else {
|
|
10843
10907
|
const data = await response.json();
|
|
@@ -10860,10 +10924,15 @@ var RuntypeFlowBuilder = class {
|
|
|
10860
10924
|
}
|
|
10861
10925
|
return {
|
|
10862
10926
|
done: true,
|
|
10863
|
-
result: data
|
|
10927
|
+
result: data,
|
|
10928
|
+
terminal: bufferedReachedTerminal(data)
|
|
10864
10929
|
};
|
|
10865
10930
|
}
|
|
10866
10931
|
};
|
|
10932
|
+
const pausedOnSubagent = (left) => {
|
|
10933
|
+
const summary = pausedOnSubagentSummary(resolveBatchExecutionId(left), left);
|
|
10934
|
+
return new FlowResult(new Response(JSON.stringify(summary.paused), { headers: { "content-type": "application/json" } }), summary);
|
|
10935
|
+
};
|
|
10867
10936
|
let currentResponse;
|
|
10868
10937
|
let carriedRelease = {};
|
|
10869
10938
|
if (isStreaming) currentResponse = await client.dispatch(config);
|
|
@@ -10872,8 +10941,11 @@ var RuntypeFlowBuilder = class {
|
|
|
10872
10941
|
carriedRelease = releaseFieldsOf(data);
|
|
10873
10942
|
currentResponse = new Response(JSON.stringify(data), { headers: { "content-type": "application/json" } });
|
|
10874
10943
|
}
|
|
10944
|
+
let carried = [];
|
|
10875
10945
|
while (true) {
|
|
10876
|
-
const { done, result } = await processStep(currentResponse);
|
|
10946
|
+
const { done, result, terminal } = await processStep(currentResponse);
|
|
10947
|
+
const pausedNow = result;
|
|
10948
|
+
if (carried.length > 0 && (done ? terminal === false : !(pausedNow.status === "paused" && pausedNow.pausedTools?.length))) return pausedOnSubagent(carried);
|
|
10877
10949
|
if (done) {
|
|
10878
10950
|
if (isStreaming) return new FlowResult(new Response(JSON.stringify(result), { headers: { "content-type": "application/json" } }), result);
|
|
10879
10951
|
return new FlowResult(new Response(JSON.stringify(result), { headers: { "content-type": "application/json" } }));
|
|
@@ -10881,8 +10953,11 @@ var RuntypeFlowBuilder = class {
|
|
|
10881
10953
|
const pausedResult = result;
|
|
10882
10954
|
if (pausedResult.status === "paused" && pausedResult.pausedTools?.length) {
|
|
10883
10955
|
const executionId = resolveBatchExecutionId(pausedResult.pausedTools);
|
|
10956
|
+
const { runnable, leftToParent } = partitionLocalToolBatch(withCarriedRequests(carried, pausedResult.pausedTools), (toolName) => Boolean(localTools[toolName]));
|
|
10957
|
+
if (runnable.length === 0) return pausedOnSubagent(leftToParent);
|
|
10958
|
+
carried = leftToParent;
|
|
10884
10959
|
try {
|
|
10885
|
-
const outputs = await Promise.all(
|
|
10960
|
+
const outputs = await Promise.all(runnable.map(async ({ toolName, parameters }) => {
|
|
10886
10961
|
if (!localTools[toolName]) throw new Error(`Local tool "${toolName}" required but not provided in localTools map`);
|
|
10887
10962
|
try {
|
|
10888
10963
|
return [toolName, await localTools[toolName](parameters)];
|
|
@@ -14754,7 +14829,7 @@ function transformQueryParams(params) {
|
|
|
14754
14829
|
return result;
|
|
14755
14830
|
}
|
|
14756
14831
|
// src/version.ts
|
|
14757
|
-
const SDK_VERSION = "11.19.
|
|
14832
|
+
const SDK_VERSION = "11.19.2";
|
|
14758
14833
|
/**
|
|
14759
14834
|
* Canonical client identity the API uses for attribution
|
|
14760
14835
|
* (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
|
|
@@ -14771,6 +14846,14 @@ const RUNTYPE_CLIENT_KIND = "sdk";
|
|
|
14771
14846
|
*/
|
|
14772
14847
|
const SDK_USER_AGENT = `runtype-sdk/${SDK_VERSION} (typescript)`;
|
|
14773
14848
|
// src/client.ts
|
|
14849
|
+
/** The handler for a paused tool: its exact name first, then the webmcp:-stripped form, so no namespace shadows one. */
|
|
14850
|
+
function findLocalToolEntry(localTools, toolName) {
|
|
14851
|
+
const BARE_NAME_NAMESPACES = ["webmcp:"];
|
|
14852
|
+
const lookupCandidates = [toolName];
|
|
14853
|
+
for (const ns of BARE_NAME_NAMESPACES) if (toolName.startsWith(ns)) lookupCandidates.push(toolName.slice(ns.length));
|
|
14854
|
+
const matchedKey = lookupCandidates.find((key) => localTools[key]);
|
|
14855
|
+
return matchedKey ? localTools[matchedKey] : void 0;
|
|
14856
|
+
}
|
|
14774
14857
|
function isObjectRecord(value) {
|
|
14775
14858
|
return typeof value === "object" && value !== null;
|
|
14776
14859
|
}
|
|
@@ -14899,6 +14982,7 @@ var RuntypeClient = class {
|
|
|
14899
14982
|
};
|
|
14900
14983
|
const processStep = async (response) => {
|
|
14901
14984
|
if (isStreaming) {
|
|
14985
|
+
let reachedTerminal = false;
|
|
14902
14986
|
const pausedTools = /* @__PURE__ */ new Map();
|
|
14903
14987
|
const wrappedCallbacks = {
|
|
14904
14988
|
...callbacks,
|
|
@@ -14931,9 +15015,12 @@ var RuntypeClient = class {
|
|
|
14931
15015
|
wrappedCallbacks.onStepComplete?.(event.result, event);
|
|
14932
15016
|
break;
|
|
14933
15017
|
case "flow_complete":
|
|
15018
|
+
reachedTerminal = true;
|
|
14934
15019
|
wrappedCallbacks.onFlowComplete?.(event);
|
|
14935
15020
|
break;
|
|
14936
|
-
case "flow_error":
|
|
15021
|
+
case "flow_error":
|
|
15022
|
+
reachedTerminal = true;
|
|
15023
|
+
wrappedCallbacks.onError?.(new Error(flowErrorMessage(event)));
|
|
14937
15024
|
}
|
|
14938
15025
|
}
|
|
14939
15026
|
} catch (e) {
|
|
@@ -14949,7 +15036,8 @@ var RuntypeClient = class {
|
|
|
14949
15036
|
};
|
|
14950
15037
|
return {
|
|
14951
15038
|
done: true,
|
|
14952
|
-
result: summary
|
|
15039
|
+
result: summary,
|
|
15040
|
+
terminal: reachedTerminal
|
|
14953
15041
|
};
|
|
14954
15042
|
} else {
|
|
14955
15043
|
const data = await response.json();
|
|
@@ -14972,10 +15060,16 @@ var RuntypeClient = class {
|
|
|
14972
15060
|
}
|
|
14973
15061
|
return {
|
|
14974
15062
|
done: true,
|
|
14975
|
-
result: data
|
|
15063
|
+
result: data,
|
|
15064
|
+
terminal: bufferedReachedTerminal(data)
|
|
14976
15065
|
};
|
|
14977
15066
|
}
|
|
14978
15067
|
};
|
|
15068
|
+
const pausedOnSubagent = (left) => {
|
|
15069
|
+
const summary = pausedOnSubagentSummary(resolveBatchExecutionId(left), left);
|
|
15070
|
+
if (isStreaming) return summary;
|
|
15071
|
+
return new FlowResult(new Response(JSON.stringify(summary.paused), { headers: { "content-type": "application/json" } }), summary);
|
|
15072
|
+
};
|
|
14979
15073
|
let currentResponse;
|
|
14980
15074
|
let carriedRelease = {};
|
|
14981
15075
|
if (isStreaming) currentResponse = await this.dispatch.executeStream(modifiedRequest);
|
|
@@ -14984,21 +15078,22 @@ var RuntypeClient = class {
|
|
|
14984
15078
|
carriedRelease = releaseFieldsOf(data);
|
|
14985
15079
|
currentResponse = new Response(JSON.stringify(data), { headers: { "content-type": "application/json" } });
|
|
14986
15080
|
}
|
|
15081
|
+
let carried = [];
|
|
14987
15082
|
while (true) {
|
|
14988
|
-
const { done, result } = await processStep(currentResponse);
|
|
15083
|
+
const { done, result, terminal } = await processStep(currentResponse);
|
|
15084
|
+
if (carried.length > 0 && (done ? terminal === false : !isPausedLocalActionResult(result))) return pausedOnSubagent(carried);
|
|
14989
15085
|
if (done) {
|
|
14990
15086
|
if (isStreaming) return result;
|
|
14991
15087
|
return new FlowResult(new Response(JSON.stringify(result), { headers: { "content-type": "application/json" } }));
|
|
14992
15088
|
}
|
|
14993
15089
|
if (isPausedLocalActionResult(result)) {
|
|
14994
15090
|
const executionId = resolveBatchExecutionId(result.pausedTools);
|
|
15091
|
+
const { runnable, leftToParent } = partitionLocalToolBatch(withCarriedRequests(carried, result.pausedTools), (toolName) => Boolean(findLocalToolEntry(localTools, toolName)));
|
|
15092
|
+
if (runnable.length === 0) return pausedOnSubagent(leftToParent);
|
|
15093
|
+
carried = leftToParent;
|
|
14995
15094
|
try {
|
|
14996
|
-
const outputs = await Promise.all(
|
|
14997
|
-
const
|
|
14998
|
-
const lookupCandidates = [toolName];
|
|
14999
|
-
for (const ns of BARE_NAME_NAMESPACES) if (toolName.startsWith(ns)) lookupCandidates.push(toolName.slice(ns.length));
|
|
15000
|
-
const matchedKey = lookupCandidates.find((key) => localTools[key]);
|
|
15001
|
-
const toolEntry = matchedKey ? localTools[matchedKey] : void 0;
|
|
15095
|
+
const outputs = await Promise.all(runnable.map(async ({ toolName, parameters }) => {
|
|
15096
|
+
const toolEntry = findLocalToolEntry(localTools, toolName);
|
|
15002
15097
|
if (!toolEntry) throw new Error(`Local tool "${toolName}" required but not provided in localTools map`);
|
|
15003
15098
|
const handler = hasToolEntryShape(toolEntry) ? toolEntry.execute : toolEntry;
|
|
15004
15099
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtypelabs/sdk",
|
|
3
|
-
"version": "11.19.
|
|
3
|
+
"version": "11.19.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript SDK for the Runtype API with fluent methods. Use it to quickly realize AI products, agents, and workflows.",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@runtypelabs/shared": "3.
|
|
27
|
+
"@runtypelabs/shared": "3.115.0",
|
|
28
28
|
"openapi-typescript": "^7.13.0",
|
|
29
29
|
"tsdown": "^0.23.2",
|
|
30
30
|
"typescript": "^6.0.3",
|