@runtypelabs/sdk 9.1.1 → 9.2.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 +189 -8
- package/dist/index.d.cts +692 -79
- package/dist/index.d.ts +692 -79
- package/dist/index.mjs +185 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
AgentsEndpoint: () => AgentsEndpoint,
|
|
27
27
|
AgentsNamespace: () => AgentsNamespace,
|
|
28
28
|
AnalyticsEndpoint: () => AnalyticsEndpoint,
|
|
29
|
+
ApiKeyRequestsEndpoint: () => ApiKeyRequestsEndpoint,
|
|
29
30
|
ApiKeysEndpoint: () => ApiKeysEndpoint,
|
|
30
31
|
BatchBuilder: () => BatchBuilder,
|
|
31
32
|
BatchesNamespace: () => BatchesNamespace,
|
|
@@ -46,6 +47,8 @@ __export(index_exports, {
|
|
|
46
47
|
EvalRunner: () => EvalRunner,
|
|
47
48
|
EvalSuitesNamespace: () => EvalSuitesNamespace,
|
|
48
49
|
EvalsNamespace: () => EvalsNamespace,
|
|
50
|
+
ExecutionsEndpoint: () => ExecutionsEndpoint,
|
|
51
|
+
ExecutionsNamespace: () => ExecutionsNamespace,
|
|
49
52
|
FlowBuilder: () => FlowBuilder,
|
|
50
53
|
FlowDriftError: () => FlowDriftError,
|
|
51
54
|
FlowEnsureConflictError: () => FlowEnsureConflictError,
|
|
@@ -137,6 +140,7 @@ __export(index_exports, {
|
|
|
137
140
|
getDefaultPlanPath: () => getDefaultPlanPath,
|
|
138
141
|
getLikelySupportingCandidatePaths: () => getLikelySupportingCandidatePaths,
|
|
139
142
|
interpolateWorkflowTemplate: () => interpolateWorkflowTemplate,
|
|
143
|
+
isCatalogClientToolRef: () => isCatalogClientToolRef,
|
|
140
144
|
isDiscoveryToolName: () => isDiscoveryToolName,
|
|
141
145
|
isMarathonArtifactPath: () => isMarathonArtifactPath,
|
|
142
146
|
isPreservationSensitiveTask: () => isPreservationSensitiveTask,
|
|
@@ -1408,6 +1412,24 @@ var FlowBuilder = class {
|
|
|
1408
1412
|
);
|
|
1409
1413
|
return this;
|
|
1410
1414
|
}
|
|
1415
|
+
/**
|
|
1416
|
+
* Add a bounded do-while loop step.
|
|
1417
|
+
*/
|
|
1418
|
+
loop(config) {
|
|
1419
|
+
this.addStep(
|
|
1420
|
+
"loop",
|
|
1421
|
+
config.name,
|
|
1422
|
+
{
|
|
1423
|
+
steps: config.steps,
|
|
1424
|
+
until: config.until,
|
|
1425
|
+
maxIterations: config.maxIterations,
|
|
1426
|
+
iterationVariable: config.iterationVariable
|
|
1427
|
+
},
|
|
1428
|
+
config.enabled,
|
|
1429
|
+
config.when
|
|
1430
|
+
);
|
|
1431
|
+
return this;
|
|
1432
|
+
}
|
|
1411
1433
|
/**
|
|
1412
1434
|
* Add a search step
|
|
1413
1435
|
*/
|
|
@@ -3230,6 +3252,24 @@ var RuntypeFlowBuilder = class {
|
|
|
3230
3252
|
);
|
|
3231
3253
|
return this;
|
|
3232
3254
|
}
|
|
3255
|
+
/**
|
|
3256
|
+
* Add a bounded do-while loop step.
|
|
3257
|
+
*/
|
|
3258
|
+
loop(config) {
|
|
3259
|
+
this.addStep(
|
|
3260
|
+
"loop",
|
|
3261
|
+
config.name,
|
|
3262
|
+
{
|
|
3263
|
+
steps: config.steps,
|
|
3264
|
+
until: config.until,
|
|
3265
|
+
maxIterations: config.maxIterations,
|
|
3266
|
+
iterationVariable: config.iterationVariable
|
|
3267
|
+
},
|
|
3268
|
+
config.enabled,
|
|
3269
|
+
config.when
|
|
3270
|
+
);
|
|
3271
|
+
return this;
|
|
3272
|
+
}
|
|
3233
3273
|
/**
|
|
3234
3274
|
* Add a search step
|
|
3235
3275
|
*/
|
|
@@ -5156,6 +5196,16 @@ var AgentsNamespace = class {
|
|
|
5156
5196
|
}
|
|
5157
5197
|
};
|
|
5158
5198
|
|
|
5199
|
+
// src/executions-namespace.ts
|
|
5200
|
+
var ExecutionsNamespace = class {
|
|
5201
|
+
constructor(getClient) {
|
|
5202
|
+
this.getClient = getClient;
|
|
5203
|
+
}
|
|
5204
|
+
getStatus(executionId) {
|
|
5205
|
+
return this.getClient().getExecutionStatus(executionId);
|
|
5206
|
+
}
|
|
5207
|
+
};
|
|
5208
|
+
|
|
5159
5209
|
// src/tools-ensure.ts
|
|
5160
5210
|
function normalizeToolDefinition(definition) {
|
|
5161
5211
|
const parametersSchema = isPlainObject(definition.parametersSchema) ? normalizeValue(definition.parametersSchema) : {};
|
|
@@ -5900,6 +5950,11 @@ function transformQueryParams(params) {
|
|
|
5900
5950
|
return result;
|
|
5901
5951
|
}
|
|
5902
5952
|
|
|
5953
|
+
// src/types.ts
|
|
5954
|
+
function isCatalogClientToolRef(entry) {
|
|
5955
|
+
return entry.catalog === "runtype-mcp";
|
|
5956
|
+
}
|
|
5957
|
+
|
|
5903
5958
|
// src/dispatch-request.ts
|
|
5904
5959
|
function normalizeDispatchMessageContent(content) {
|
|
5905
5960
|
if (Array.isArray(content) && content.some(
|
|
@@ -5924,6 +5979,9 @@ function normalizeDispatchRequest(request6) {
|
|
|
5924
5979
|
content: normalizeDispatchMessageContent(message.content)
|
|
5925
5980
|
}));
|
|
5926
5981
|
const clientTools = request6.clientTools?.map((tool) => {
|
|
5982
|
+
if (isCatalogClientToolRef(tool)) {
|
|
5983
|
+
return tool;
|
|
5984
|
+
}
|
|
5927
5985
|
if (tool.parametersSchema.type !== "object") {
|
|
5928
5986
|
throw new Error(`Client tool "${tool.name}" parametersSchema.type must be "object"`);
|
|
5929
5987
|
}
|
|
@@ -5979,11 +6037,11 @@ var RuntypeClient = class {
|
|
|
5979
6037
|
/**
|
|
5980
6038
|
* Generic POST request
|
|
5981
6039
|
*/
|
|
5982
|
-
async post(path, data) {
|
|
6040
|
+
async post(path, data, extraHeaders) {
|
|
5983
6041
|
const url = this.buildUrl(path);
|
|
5984
6042
|
const response = await this.makeRequest(url, {
|
|
5985
6043
|
method: "POST",
|
|
5986
|
-
headers: this.headers,
|
|
6044
|
+
headers: { ...this.headers, ...extraHeaders },
|
|
5987
6045
|
body: data ? JSON.stringify(data) : void 0
|
|
5988
6046
|
});
|
|
5989
6047
|
return this.transformResponse(response);
|
|
@@ -6076,6 +6134,21 @@ var RuntypeClient = class {
|
|
|
6076
6134
|
}
|
|
6077
6135
|
});
|
|
6078
6136
|
}
|
|
6137
|
+
/** Start a normalized dispatch and return a durable handle immediately. */
|
|
6138
|
+
async dispatchAsync(config) {
|
|
6139
|
+
const normalized = normalizeDispatchRequest(config);
|
|
6140
|
+
return this.post(
|
|
6141
|
+
"/dispatch",
|
|
6142
|
+
{
|
|
6143
|
+
...normalized,
|
|
6144
|
+
options: { ...normalized.options, streamResponse: false }
|
|
6145
|
+
},
|
|
6146
|
+
{ Prefer: "respond-async" }
|
|
6147
|
+
);
|
|
6148
|
+
}
|
|
6149
|
+
async getExecutionStatus(executionId) {
|
|
6150
|
+
return this.get(`/executions/${encodeURIComponent(executionId)}/status`);
|
|
6151
|
+
}
|
|
6079
6152
|
/**
|
|
6080
6153
|
* Build full URL with query parameters
|
|
6081
6154
|
*/
|
|
@@ -6350,6 +6423,10 @@ var Runtype = class {
|
|
|
6350
6423
|
static get agents() {
|
|
6351
6424
|
return new AgentsNamespace(() => this.getClient());
|
|
6352
6425
|
}
|
|
6426
|
+
/** Poll durable handles returned by asynchronous execute operations. */
|
|
6427
|
+
static get executions() {
|
|
6428
|
+
return new ExecutionsNamespace(() => this.getClient());
|
|
6429
|
+
}
|
|
6353
6430
|
/**
|
|
6354
6431
|
* Tools namespace - Tool config-as-code (define / ensure / pull)
|
|
6355
6432
|
*
|
|
@@ -6442,7 +6519,7 @@ var Runtype = class {
|
|
|
6442
6519
|
|
|
6443
6520
|
// src/version.ts
|
|
6444
6521
|
var FALLBACK_VERSION = "0.0.0";
|
|
6445
|
-
var SDK_VERSION = "9.
|
|
6522
|
+
var SDK_VERSION = "9.2.1".length > 0 ? "9.2.1" : FALLBACK_VERSION;
|
|
6446
6523
|
var RUNTYPE_CLIENT_KIND = "sdk";
|
|
6447
6524
|
var SDK_USER_AGENT = `runtype-sdk/${SDK_VERSION} (typescript)`;
|
|
6448
6525
|
|
|
@@ -8825,9 +8902,72 @@ var CollectionsEndpoint = class {
|
|
|
8825
8902
|
return this.client.get("/collections/types.d.ts");
|
|
8826
8903
|
}
|
|
8827
8904
|
};
|
|
8905
|
+
var ApiKeyRequestsEndpoint = class {
|
|
8906
|
+
constructor(client) {
|
|
8907
|
+
this.client = client;
|
|
8908
|
+
}
|
|
8909
|
+
/**
|
|
8910
|
+
* File a request. Nothing is minted; the response carries the request, the
|
|
8911
|
+
* browser handoff a human must complete, and a suggested poll interval.
|
|
8912
|
+
*/
|
|
8913
|
+
async create(data) {
|
|
8914
|
+
return this.client.post("/api-keys/requests", data);
|
|
8915
|
+
}
|
|
8916
|
+
/**
|
|
8917
|
+
* Read one request — poll this for the approval decision.
|
|
8918
|
+
*
|
|
8919
|
+
* The route answers with the `{ request, handoff? }` envelope (the handoff is
|
|
8920
|
+
* present only while a human still has to act), so unwrap it the way `list()`
|
|
8921
|
+
* unwraps `{ requests }`. Returning the envelope raw types as `ApiKeyRequest`
|
|
8922
|
+
* but has no `status`, which silently reads as `undefined` in every caller's
|
|
8923
|
+
* state machine rather than failing anywhere near here.
|
|
8924
|
+
*/
|
|
8925
|
+
async get(requestId) {
|
|
8926
|
+
const response = await this.client.get(
|
|
8927
|
+
`/api-keys/requests/${requestId}`
|
|
8928
|
+
);
|
|
8929
|
+
return response.request;
|
|
8930
|
+
}
|
|
8931
|
+
/**
|
|
8932
|
+
* Read one request together with its browser handoff. Same route as `get()`;
|
|
8933
|
+
* use this when re-raising the approval prompt for a request this process did
|
|
8934
|
+
* not file (the handoff is absent once the request leaves `pending`).
|
|
8935
|
+
*/
|
|
8936
|
+
async getWithHandoff(requestId) {
|
|
8937
|
+
return this.client.get(`/api-keys/requests/${requestId}`);
|
|
8938
|
+
}
|
|
8939
|
+
/**
|
|
8940
|
+
* List requests for the account. Clerk-session surface (the human review
|
|
8941
|
+
* queue); an API key sees only its own requests.
|
|
8942
|
+
*/
|
|
8943
|
+
async list(params) {
|
|
8944
|
+
const response = await this.client.get(
|
|
8945
|
+
"/api-keys/requests",
|
|
8946
|
+
params
|
|
8947
|
+
);
|
|
8948
|
+
return response.requests;
|
|
8949
|
+
}
|
|
8950
|
+
/**
|
|
8951
|
+
* Redeem an approved request. The key is minted here and returned exactly
|
|
8952
|
+
* once: `delivery: 'inline'` (the API default) puts the plaintext in
|
|
8953
|
+
* `apiKey`; `delivery: 'secret'` stores it as a Runtype secret and returns
|
|
8954
|
+
* only a `{{secret:KEY}}` reference in `secretRef`. Claiming twice is a 409.
|
|
8955
|
+
*/
|
|
8956
|
+
async claim(requestId, data) {
|
|
8957
|
+
return this.client.post(
|
|
8958
|
+
`/api-keys/requests/${requestId}/claim`,
|
|
8959
|
+
data
|
|
8960
|
+
);
|
|
8961
|
+
}
|
|
8962
|
+
/** Withdraw a pending request you filed. Cannot be undone. */
|
|
8963
|
+
async cancel(requestId) {
|
|
8964
|
+
return this.client.post(`/api-keys/requests/${requestId}/cancel`);
|
|
8965
|
+
}
|
|
8966
|
+
};
|
|
8828
8967
|
var ApiKeysEndpoint = class {
|
|
8829
8968
|
constructor(client) {
|
|
8830
8969
|
this.client = client;
|
|
8970
|
+
this.requests = new ApiKeyRequestsEndpoint(client);
|
|
8831
8971
|
}
|
|
8832
8972
|
/**
|
|
8833
8973
|
* List all API keys for the authenticated user
|
|
@@ -9082,6 +9222,18 @@ var DispatchEndpoint = class {
|
|
|
9082
9222
|
}
|
|
9083
9223
|
});
|
|
9084
9224
|
}
|
|
9225
|
+
/** Start a dispatch and return its durable execution handle immediately. */
|
|
9226
|
+
async executeAsync(data) {
|
|
9227
|
+
const normalized = normalizeDispatchRequest(data);
|
|
9228
|
+
return this.client.post(
|
|
9229
|
+
"/dispatch",
|
|
9230
|
+
{
|
|
9231
|
+
...normalized,
|
|
9232
|
+
options: { ...normalized.options, streamResponse: false }
|
|
9233
|
+
},
|
|
9234
|
+
{ Prefer: "respond-async" }
|
|
9235
|
+
);
|
|
9236
|
+
}
|
|
9085
9237
|
/**
|
|
9086
9238
|
* Dispatch with streaming response
|
|
9087
9239
|
*/
|
|
@@ -9149,6 +9301,16 @@ var DispatchEndpoint = class {
|
|
|
9149
9301
|
return applyGeneratedRuntimeToolProposalToDispatchRequest(request6, proposal, options);
|
|
9150
9302
|
}
|
|
9151
9303
|
};
|
|
9304
|
+
var ExecutionsEndpoint = class {
|
|
9305
|
+
constructor(client) {
|
|
9306
|
+
this.client = client;
|
|
9307
|
+
}
|
|
9308
|
+
async getStatus(executionId) {
|
|
9309
|
+
return this.client.get(
|
|
9310
|
+
`/executions/${encodeURIComponent(executionId)}/status`
|
|
9311
|
+
);
|
|
9312
|
+
}
|
|
9313
|
+
};
|
|
9152
9314
|
var ChatEndpoint = class {
|
|
9153
9315
|
constructor(client) {
|
|
9154
9316
|
this.client = client;
|
|
@@ -9838,6 +10000,14 @@ var _AgentsEndpoint = class _AgentsEndpoint {
|
|
|
9838
10000
|
streamResponse: false
|
|
9839
10001
|
});
|
|
9840
10002
|
}
|
|
10003
|
+
/** Start an agent execution and return its durable handle immediately. */
|
|
10004
|
+
async executeAsync(id, data) {
|
|
10005
|
+
return this.client.post(
|
|
10006
|
+
`/agents/${id}/execute`,
|
|
10007
|
+
{ ...data, streamResponse: false },
|
|
10008
|
+
{ Prefer: "respond-async" }
|
|
10009
|
+
);
|
|
10010
|
+
}
|
|
9841
10011
|
/**
|
|
9842
10012
|
* Execute an agent with streaming response
|
|
9843
10013
|
*
|
|
@@ -13004,9 +13174,7 @@ function assertTurnScopedLocalTools(localTools) {
|
|
|
13004
13174
|
);
|
|
13005
13175
|
}
|
|
13006
13176
|
if (entry.parametersSchema.type !== "object") {
|
|
13007
|
-
throw new Error(
|
|
13008
|
-
`Turn-scoped local tool "${name}" parametersSchema.type must be "object"`
|
|
13009
|
-
);
|
|
13177
|
+
throw new Error(`Turn-scoped local tool "${name}" parametersSchema.type must be "object"`);
|
|
13010
13178
|
}
|
|
13011
13179
|
}
|
|
13012
13180
|
}
|
|
@@ -13042,6 +13210,7 @@ var RuntypeClient2 = class {
|
|
|
13042
13210
|
this.modelConfigs = new ModelConfigsEndpoint(this);
|
|
13043
13211
|
this.providerKeys = new ProviderKeysEndpoint(this);
|
|
13044
13212
|
this.dispatch = new DispatchEndpoint(this);
|
|
13213
|
+
this.executions = new ExecutionsEndpoint(this);
|
|
13045
13214
|
this.chat = new ChatEndpoint(this);
|
|
13046
13215
|
this.users = new UsersEndpoint(this);
|
|
13047
13216
|
this.analytics = new AnalyticsEndpoint(this);
|
|
@@ -13309,11 +13478,11 @@ var RuntypeClient2 = class {
|
|
|
13309
13478
|
/**
|
|
13310
13479
|
* Generic POST request
|
|
13311
13480
|
*/
|
|
13312
|
-
async post(path, data) {
|
|
13481
|
+
async post(path, data, extraHeaders) {
|
|
13313
13482
|
const url = this.buildUrl(path);
|
|
13314
13483
|
const response = await this.makeRequest(url, {
|
|
13315
13484
|
method: "POST",
|
|
13316
|
-
headers: this.headers,
|
|
13485
|
+
headers: { ...this.headers, ...extraHeaders },
|
|
13317
13486
|
body: data ? JSON.stringify(transformRequest(data)) : void 0
|
|
13318
13487
|
});
|
|
13319
13488
|
return transformResponse(response);
|
|
@@ -13908,6 +14077,12 @@ var CONDITIONAL_FIELDS = [
|
|
|
13908
14077
|
{ key: "trueSteps", format: "value" },
|
|
13909
14078
|
{ key: "falseSteps", format: "value" }
|
|
13910
14079
|
];
|
|
14080
|
+
var LOOP_FIELDS = [
|
|
14081
|
+
{ key: "steps", format: "value" },
|
|
14082
|
+
{ key: "until", format: "template" },
|
|
14083
|
+
{ key: "maxIterations", format: "raw" },
|
|
14084
|
+
{ key: "iterationVariable", format: "json" }
|
|
14085
|
+
];
|
|
13911
14086
|
var SEARCH_FIELDS = [
|
|
13912
14087
|
{ key: "provider", format: "json" },
|
|
13913
14088
|
{ key: "query", format: "template" },
|
|
@@ -14199,6 +14374,7 @@ var STEP_FIELD_REGISTRY = {
|
|
|
14199
14374
|
"transform-data": TRANSFORM_DATA_FIELDS,
|
|
14200
14375
|
"set-variable": SET_VARIABLE_FIELDS,
|
|
14201
14376
|
conditional: CONDITIONAL_FIELDS,
|
|
14377
|
+
loop: LOOP_FIELDS,
|
|
14202
14378
|
search: SEARCH_FIELDS,
|
|
14203
14379
|
"send-email": SEND_EMAIL_FIELDS,
|
|
14204
14380
|
"send-stream": SEND_STREAM_FIELDS,
|
|
@@ -14233,6 +14409,7 @@ var STEP_TYPE_TO_METHOD = {
|
|
|
14233
14409
|
"transform-data": "transformData",
|
|
14234
14410
|
template: "template",
|
|
14235
14411
|
conditional: "conditional",
|
|
14412
|
+
loop: "loop",
|
|
14236
14413
|
"set-variable": "setVariable",
|
|
14237
14414
|
"upsert-record": "upsertRecord",
|
|
14238
14415
|
"update-record": "updateRecord",
|
|
@@ -14261,6 +14438,7 @@ var STEP_TYPE_TO_METHOD = {
|
|
|
14261
14438
|
AgentsEndpoint,
|
|
14262
14439
|
AgentsNamespace,
|
|
14263
14440
|
AnalyticsEndpoint,
|
|
14441
|
+
ApiKeyRequestsEndpoint,
|
|
14264
14442
|
ApiKeysEndpoint,
|
|
14265
14443
|
BatchBuilder,
|
|
14266
14444
|
BatchesNamespace,
|
|
@@ -14281,6 +14459,8 @@ var STEP_TYPE_TO_METHOD = {
|
|
|
14281
14459
|
EvalRunner,
|
|
14282
14460
|
EvalSuitesNamespace,
|
|
14283
14461
|
EvalsNamespace,
|
|
14462
|
+
ExecutionsEndpoint,
|
|
14463
|
+
ExecutionsNamespace,
|
|
14284
14464
|
FlowBuilder,
|
|
14285
14465
|
FlowDriftError,
|
|
14286
14466
|
FlowEnsureConflictError,
|
|
@@ -14372,6 +14552,7 @@ var STEP_TYPE_TO_METHOD = {
|
|
|
14372
14552
|
getDefaultPlanPath,
|
|
14373
14553
|
getLikelySupportingCandidatePaths,
|
|
14374
14554
|
interpolateWorkflowTemplate,
|
|
14555
|
+
isCatalogClientToolRef,
|
|
14375
14556
|
isDiscoveryToolName,
|
|
14376
14557
|
isMarathonArtifactPath,
|
|
14377
14558
|
isPreservationSensitiveTask,
|