@runtypelabs/sdk 6.4.0 → 6.5.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/dist/index.cjs +62 -18
- package/dist/index.d.cts +722 -23
- package/dist/index.d.ts +722 -23
- package/dist/index.mjs +62 -18
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -213,6 +213,8 @@ var UNIFIED_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
|
213
213
|
"artifact_update",
|
|
214
214
|
"artifact_complete",
|
|
215
215
|
"source",
|
|
216
|
+
"state_snapshot",
|
|
217
|
+
"state_delta",
|
|
216
218
|
"tool_start",
|
|
217
219
|
"tool_input_delta",
|
|
218
220
|
"tool_input_complete",
|
|
@@ -365,9 +367,10 @@ function createFlowEventTranslator() {
|
|
|
365
367
|
pageOrigin: data.pageOrigin
|
|
366
368
|
})
|
|
367
369
|
];
|
|
368
|
-
// Channels/markers/tool-family/approval/skip/source/custom/ping the
|
|
369
|
-
// consumer never read → no callback event. (A non-terminal `error` is
|
|
370
|
-
// produced on agent streams; dropping it here avoids a false
|
|
370
|
+
// Channels/markers/tool-family/approval/skip/source/state/custom/ping the
|
|
371
|
+
// flow consumer never read → no callback event. (A non-terminal `error` is
|
|
372
|
+
// only produced on agent streams; dropping it here avoids a false
|
|
373
|
+
// flow_error.)
|
|
371
374
|
default:
|
|
372
375
|
return [];
|
|
373
376
|
}
|
|
@@ -670,8 +673,9 @@ function createAgentEventTranslator() {
|
|
|
670
673
|
case "ping":
|
|
671
674
|
return [compact({ type: "agent_ping", executionId, seq, timestamp: data.timestamp })];
|
|
672
675
|
// turn/text/reasoning open+close markers, step_*, artifact_*, source,
|
|
673
|
-
//
|
|
674
|
-
//
|
|
676
|
+
// state_snapshot/state_delta (agent-state channel with no stable SDK
|
|
677
|
+
// callback), custom (fallback beat / routing), and the skill-fold result
|
|
678
|
+
// envelope the SDK never consumed → no callback event.
|
|
675
679
|
default:
|
|
676
680
|
return [];
|
|
677
681
|
}
|
|
@@ -6048,19 +6052,35 @@ var RuntypeClient = class {
|
|
|
6048
6052
|
* normalization the `DispatchEndpoint` applies, with no per-builder call.
|
|
6049
6053
|
*/
|
|
6050
6054
|
async dispatch(config) {
|
|
6055
|
+
const normalized = normalizeDispatchRequest(config);
|
|
6056
|
+
const request6 = transformRequest({
|
|
6057
|
+
...normalized,
|
|
6058
|
+
options: {
|
|
6059
|
+
...normalized.options,
|
|
6060
|
+
streamResponse: true
|
|
6061
|
+
}
|
|
6062
|
+
});
|
|
6051
6063
|
return this.requestStream("/dispatch", {
|
|
6052
6064
|
method: "POST",
|
|
6053
|
-
body: JSON.stringify(
|
|
6065
|
+
body: JSON.stringify(request6)
|
|
6054
6066
|
});
|
|
6055
6067
|
}
|
|
6056
6068
|
/**
|
|
6057
6069
|
* Dispatch flow execution (non-streaming JSON).
|
|
6058
6070
|
*
|
|
6059
6071
|
* The non-streaming sibling of {@link dispatch}; it normalizes to the same
|
|
6060
|
-
* canonical wire contract so builders never post a raw, un-normalized body
|
|
6072
|
+
* canonical wire contract so builders never post a raw, un-normalized body,
|
|
6073
|
+
* and pins `streamResponse: false` so the server returns buffered JSON.
|
|
6061
6074
|
*/
|
|
6062
6075
|
async dispatchJson(config) {
|
|
6063
|
-
|
|
6076
|
+
const normalized = normalizeDispatchRequest(config);
|
|
6077
|
+
return this.post("/dispatch", {
|
|
6078
|
+
...normalized,
|
|
6079
|
+
options: {
|
|
6080
|
+
...normalized.options,
|
|
6081
|
+
streamResponse: false
|
|
6082
|
+
}
|
|
6083
|
+
});
|
|
6064
6084
|
}
|
|
6065
6085
|
/**
|
|
6066
6086
|
* Build full URL with query parameters
|
|
@@ -6428,7 +6448,7 @@ var Runtype = class {
|
|
|
6428
6448
|
|
|
6429
6449
|
// src/version.ts
|
|
6430
6450
|
var FALLBACK_VERSION = "0.0.0";
|
|
6431
|
-
var SDK_VERSION = "6.
|
|
6451
|
+
var SDK_VERSION = "6.5.0".length > 0 ? "6.5.0" : FALLBACK_VERSION;
|
|
6432
6452
|
var RUNTYPE_CLIENT_KIND = "sdk";
|
|
6433
6453
|
var SDK_USER_AGENT = `runtype-sdk/${SDK_VERSION} (typescript)`;
|
|
6434
6454
|
|
|
@@ -8977,34 +8997,52 @@ var DispatchEndpoint = class {
|
|
|
8977
8997
|
* Dispatch: create and/or execute flows on records atomically
|
|
8978
8998
|
*/
|
|
8979
8999
|
async execute(data) {
|
|
8980
|
-
|
|
9000
|
+
const normalized = normalizeDispatchRequest(data);
|
|
9001
|
+
return this.client.post("/dispatch", {
|
|
9002
|
+
...normalized,
|
|
9003
|
+
options: {
|
|
9004
|
+
...normalized.options,
|
|
9005
|
+
streamResponse: false
|
|
9006
|
+
}
|
|
9007
|
+
});
|
|
8981
9008
|
}
|
|
8982
9009
|
/**
|
|
8983
9010
|
* Dispatch with streaming response
|
|
8984
9011
|
*/
|
|
8985
9012
|
async executeStream(data) {
|
|
9013
|
+
const normalized = normalizeDispatchRequest(data);
|
|
8986
9014
|
return this.client.requestStream("/dispatch", {
|
|
8987
9015
|
method: "POST",
|
|
8988
|
-
body: JSON.stringify(
|
|
9016
|
+
body: JSON.stringify({
|
|
9017
|
+
...normalized,
|
|
9018
|
+
options: {
|
|
9019
|
+
...normalized.options,
|
|
9020
|
+
streamResponse: true
|
|
9021
|
+
}
|
|
9022
|
+
})
|
|
8989
9023
|
});
|
|
8990
9024
|
}
|
|
8991
9025
|
/**
|
|
8992
9026
|
* Resume paused flow execution
|
|
8993
|
-
*
|
|
9027
|
+
* Uses buffered JSON when streamResponse is omitted.
|
|
8994
9028
|
*
|
|
8995
|
-
* @param data.
|
|
8996
|
-
* @param data.
|
|
8997
|
-
* @param data.
|
|
9029
|
+
* @param data.executionId - The execution ID to resume
|
|
9030
|
+
* @param data.toolOutputs - Tool outputs to inject into the flow
|
|
9031
|
+
* @param data.streamResponse - Whether to stream the response (defaults to false)
|
|
8998
9032
|
* @param data.messages - Optional messages to override the original dispatch messages
|
|
8999
9033
|
*/
|
|
9000
9034
|
async resume(data) {
|
|
9001
|
-
|
|
9035
|
+
const request6 = {
|
|
9036
|
+
...data,
|
|
9037
|
+
streamResponse: data.streamResponse ?? false
|
|
9038
|
+
};
|
|
9039
|
+
if (request6.streamResponse) {
|
|
9002
9040
|
return this.client.requestStream("/dispatch/resume", {
|
|
9003
9041
|
method: "POST",
|
|
9004
|
-
body: JSON.stringify(
|
|
9042
|
+
body: JSON.stringify(request6)
|
|
9005
9043
|
});
|
|
9006
9044
|
}
|
|
9007
|
-
return this.client.post("/dispatch/resume",
|
|
9045
|
+
return this.client.post("/dispatch/resume", request6);
|
|
9008
9046
|
}
|
|
9009
9047
|
/**
|
|
9010
9048
|
* Evaluate a model-proposed runtime tool against a configurable allowlist policy.
|
|
@@ -9100,6 +9138,12 @@ var AnalyticsEndpoint = class {
|
|
|
9100
9138
|
async getModelUsage(params) {
|
|
9101
9139
|
return this.client.get("/model-usage", params);
|
|
9102
9140
|
}
|
|
9141
|
+
/**
|
|
9142
|
+
* Get execution and platform-spend usage grouped by projected product end user.
|
|
9143
|
+
*/
|
|
9144
|
+
async getEndUserUsage(params) {
|
|
9145
|
+
return this.client.get("/analytics/end-user-usage", params);
|
|
9146
|
+
}
|
|
9103
9147
|
};
|
|
9104
9148
|
var FlowStepsEndpoint = class {
|
|
9105
9149
|
constructor(client) {
|