@runtypelabs/sdk 10.14.2 → 10.15.1
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 +30 -15
- package/dist/index.d.cts +324 -19
- package/dist/index.d.ts +324 -19
- package/dist/index.mjs +30 -15
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -172,7 +172,8 @@ function createFlowEventTranslator() {
|
|
|
172
172
|
failedSteps: data.failedSteps,
|
|
173
173
|
executionTime: data.durationMs,
|
|
174
174
|
finalOutput: data.finalOutput,
|
|
175
|
-
completedAt: data.completedAt
|
|
175
|
+
completedAt: data.completedAt,
|
|
176
|
+
outcome: data.outcome
|
|
176
177
|
})];
|
|
177
178
|
case "execution_error": return [compact({
|
|
178
179
|
type: "flow_error",
|
|
@@ -181,7 +182,8 @@ function createFlowEventTranslator() {
|
|
|
181
182
|
error: data.error,
|
|
182
183
|
code: data.code,
|
|
183
184
|
upgradeUrl: data.upgradeUrl,
|
|
184
|
-
blockReason: data.blockReason
|
|
185
|
+
blockReason: data.blockReason,
|
|
186
|
+
outcome: data.outcome
|
|
185
187
|
})];
|
|
186
188
|
case "await":
|
|
187
189
|
if (data.awaitReason === "detached") return [];
|
|
@@ -194,7 +196,8 @@ function createFlowEventTranslator() {
|
|
|
194
196
|
parameters: data.parameters,
|
|
195
197
|
awaitedAt: data.awaitedAt,
|
|
196
198
|
origin: data.origin,
|
|
197
|
-
pageOrigin: data.pageOrigin
|
|
199
|
+
pageOrigin: data.pageOrigin,
|
|
200
|
+
annotations: data.annotations
|
|
198
201
|
})];
|
|
199
202
|
default: return [];
|
|
200
203
|
}
|
|
@@ -303,7 +306,8 @@ function createAgentEventTranslator() {
|
|
|
303
306
|
parameters: data.parameters,
|
|
304
307
|
hiddenParameterNames: data.hiddenParameterNames,
|
|
305
308
|
origin: data.origin,
|
|
306
|
-
pageOrigin: data.pageOrigin
|
|
309
|
+
pageOrigin: data.pageOrigin,
|
|
310
|
+
annotations: data.annotations
|
|
307
311
|
})];
|
|
308
312
|
case "tool_output_delta": return [compact({
|
|
309
313
|
type: "agent_tool_delta",
|
|
@@ -418,6 +422,7 @@ function createAgentEventTranslator() {
|
|
|
418
422
|
awaitedAt: data.awaitedAt,
|
|
419
423
|
origin: data.origin,
|
|
420
424
|
pageOrigin: data.pageOrigin,
|
|
425
|
+
annotations: data.annotations,
|
|
421
426
|
awaitReason: data.awaitReason,
|
|
422
427
|
elicitation: data.elicitation,
|
|
423
428
|
externalAgent: data.externalAgent
|
|
@@ -437,7 +442,8 @@ function createAgentEventTranslator() {
|
|
|
437
442
|
totalTokens: data.totalTokens,
|
|
438
443
|
finalOutput: data.finalOutput,
|
|
439
444
|
duration: data.durationMs,
|
|
440
|
-
externalAgent: data.externalAgent
|
|
445
|
+
externalAgent: data.externalAgent,
|
|
446
|
+
outcome: data.outcome
|
|
441
447
|
})];
|
|
442
448
|
case "execution_error":
|
|
443
449
|
if (data.kind !== "agent") return [];
|
|
@@ -449,7 +455,8 @@ function createAgentEventTranslator() {
|
|
|
449
455
|
success: false,
|
|
450
456
|
stopReason: data.stopReason ?? "error",
|
|
451
457
|
error: errorMessage(data.error),
|
|
452
|
-
completedAt: data.completedAt
|
|
458
|
+
completedAt: data.completedAt,
|
|
459
|
+
outcome: data.outcome
|
|
453
460
|
})];
|
|
454
461
|
case "error": return [compact({
|
|
455
462
|
type: "agent_error",
|
|
@@ -8738,6 +8745,13 @@ var LogsEndpoint = class {
|
|
|
8738
8745
|
return this.client.get(`/logs/trace/execution/${executionId}`);
|
|
8739
8746
|
}
|
|
8740
8747
|
/**
|
|
8748
|
+
* Explain one execution from its retained trace, with each claim citing trace entry ids.
|
|
8749
|
+
* Runs a metered, tool-free analysis in the caller's account and never changes the run.
|
|
8750
|
+
*/
|
|
8751
|
+
async explainRun(executionId) {
|
|
8752
|
+
return this.client.post(`/logs/trace/execution/${encodeURIComponent(executionId)}/explain`, void 0, void 0, { timeoutMs: 6e4 });
|
|
8753
|
+
}
|
|
8754
|
+
/**
|
|
8741
8755
|
* Get the trace tree for a conversation (all executions within it).
|
|
8742
8756
|
*/
|
|
8743
8757
|
async traceConversation(conversationId) {
|
|
@@ -14444,7 +14458,7 @@ function transformQueryParams(params) {
|
|
|
14444
14458
|
}
|
|
14445
14459
|
//#endregion
|
|
14446
14460
|
//#region src/version.ts
|
|
14447
|
-
const SDK_VERSION = "10.
|
|
14461
|
+
const SDK_VERSION = "10.15.1";
|
|
14448
14462
|
/**
|
|
14449
14463
|
* Canonical client identity the API uses for attribution
|
|
14450
14464
|
* (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
|
|
@@ -14565,6 +14579,7 @@ var RuntypeClient = class {
|
|
|
14565
14579
|
parametersSchema: entry.parametersSchema,
|
|
14566
14580
|
...entry.origin ? { origin: entry.origin } : {},
|
|
14567
14581
|
...entry.pageOrigin ? { pageOrigin: entry.pageOrigin } : {},
|
|
14582
|
+
...entry.annotations ? { annotations: entry.annotations } : {},
|
|
14568
14583
|
...entry.untrustedContentHint ? { untrustedContentHint: true } : {}
|
|
14569
14584
|
})) : [];
|
|
14570
14585
|
const modifiedRequest = {
|
|
@@ -14749,7 +14764,7 @@ var RuntypeClient = class {
|
|
|
14749
14764
|
/**
|
|
14750
14765
|
* Generic POST request
|
|
14751
14766
|
*/
|
|
14752
|
-
async post(path, data, extraHeaders) {
|
|
14767
|
+
async post(path, data, extraHeaders, options) {
|
|
14753
14768
|
const url = this.buildUrl(path);
|
|
14754
14769
|
return await this.makeRequest(url, {
|
|
14755
14770
|
method: "POST",
|
|
@@ -14758,7 +14773,7 @@ var RuntypeClient = class {
|
|
|
14758
14773
|
...extraHeaders
|
|
14759
14774
|
},
|
|
14760
14775
|
body: data ? JSON.stringify(data) : void 0
|
|
14761
|
-
});
|
|
14776
|
+
}, options?.timeoutMs);
|
|
14762
14777
|
}
|
|
14763
14778
|
/**
|
|
14764
14779
|
* POST request with FormData support for file uploads
|
|
@@ -14867,9 +14882,9 @@ var RuntypeClient = class {
|
|
|
14867
14882
|
* `makeRawRequest` keeps its own variant: it additionally composes a
|
|
14868
14883
|
* caller-supplied `signal` (user-initiated stream aborts) with the timeout.
|
|
14869
14884
|
*/
|
|
14870
|
-
async fetchWithTimeout(url, options) {
|
|
14871
|
-
const controller =
|
|
14872
|
-
const timeoutId = controller &&
|
|
14885
|
+
async fetchWithTimeout(url, options, timeoutMs = this.timeout) {
|
|
14886
|
+
const controller = timeoutMs === null ? null : new AbortController();
|
|
14887
|
+
const timeoutId = controller && timeoutMs !== null ? setTimeout(() => controller.abort(), timeoutMs) : null;
|
|
14873
14888
|
try {
|
|
14874
14889
|
const response = await fetch(url, {
|
|
14875
14890
|
...options,
|
|
@@ -14879,12 +14894,12 @@ var RuntypeClient = class {
|
|
|
14879
14894
|
return response;
|
|
14880
14895
|
} catch (error) {
|
|
14881
14896
|
if (timeoutId) clearTimeout(timeoutId);
|
|
14882
|
-
if (timeoutId && error instanceof Error && error.name === "AbortError") throw new Error(`Request timeout after ${
|
|
14897
|
+
if (timeoutId && error instanceof Error && error.name === "AbortError") throw new Error(`Request timeout after ${timeoutMs}ms`, { cause: error });
|
|
14883
14898
|
throw error;
|
|
14884
14899
|
}
|
|
14885
14900
|
}
|
|
14886
|
-
async makeRequest(url, options) {
|
|
14887
|
-
const response = await this.fetchWithTimeout(url, options);
|
|
14901
|
+
async makeRequest(url, options, timeoutMs = this.timeout) {
|
|
14902
|
+
const response = await this.fetchWithTimeout(url, options, timeoutMs);
|
|
14888
14903
|
if (!response.ok) throw await this.createApiError(response);
|
|
14889
14904
|
if (response.status === 204) return null;
|
|
14890
14905
|
if (response.headers.get("content-type")?.includes("application/json")) return response.json();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtypelabs/sdk",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.15.1",
|
|
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.81.1",
|
|
28
28
|
"openapi-typescript": "^7.13.0",
|
|
29
29
|
"tsdown": "^0.23.0",
|
|
30
30
|
"typescript": "^6.0.3",
|