@meshagent/meshagent 0.44.11 → 0.44.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/browser/agent-client.js +1 -1
- package/dist/browser/containers-client.js +1 -1
- package/dist/browser/datasets-client.d.ts +1 -1
- package/dist/browser/datasets-client.js +15 -15
- package/dist/browser/developer-client.js +1 -1
- package/dist/browser/entrypoint.js +5 -1
- package/dist/browser/memory-client.js +1 -1
- package/dist/browser/meshagent-client.d.ts +123 -7
- package/dist/browser/meshagent-client.js +357 -10
- package/dist/browser/messaging-client.js +1 -1
- package/dist/browser/queues-client.js +1 -1
- package/dist/browser/requirement.d.ts +21 -0
- package/dist/browser/requirement.js +87 -1
- package/dist/browser/room-client.d.ts +12 -1
- package/dist/browser/room-client.js +91 -31
- package/dist/browser/secrets-client.js +1 -1
- package/dist/browser/services-client.js +2 -2
- package/dist/browser/storage-client.d.ts +1 -1
- package/dist/browser/storage-client.js +1 -1
- package/dist/browser/stream-controller.d.ts +1 -0
- package/dist/browser/stream-controller.js +27 -7
- package/dist/browser/sync-client.js +1 -1
- package/dist/esm/agent-client.js +1 -1
- package/dist/esm/containers-client.js +1 -1
- package/dist/esm/datasets-client.d.ts +1 -1
- package/dist/esm/datasets-client.js +15 -15
- package/dist/esm/developer-client.js +1 -1
- package/dist/esm/entrypoint.js +6 -1
- package/dist/esm/memory-client.js +1 -1
- package/dist/esm/meshagent-client.d.ts +123 -7
- package/dist/esm/meshagent-client.js +353 -10
- package/dist/esm/messaging-client.js +1 -1
- package/dist/esm/queues-client.js +1 -1
- package/dist/esm/requirement.d.ts +21 -0
- package/dist/esm/requirement.js +84 -0
- package/dist/esm/room-client.d.ts +12 -1
- package/dist/esm/room-client.js +92 -32
- package/dist/esm/secrets-client.js +1 -1
- package/dist/esm/services-client.js +2 -2
- package/dist/esm/storage-client.d.ts +1 -1
- package/dist/esm/storage-client.js +1 -1
- package/dist/esm/stream-controller.d.ts +1 -0
- package/dist/esm/stream-controller.js +27 -7
- package/dist/esm/sync-client.js +1 -1
- package/dist/node/agent-client.js +1 -1
- package/dist/node/containers-client.js +1 -1
- package/dist/node/datasets-client.d.ts +1 -1
- package/dist/node/datasets-client.js +15 -15
- package/dist/node/developer-client.js +1 -1
- package/dist/node/entrypoint.js +6 -1
- package/dist/node/memory-client.js +1 -1
- package/dist/node/meshagent-client.d.ts +123 -7
- package/dist/node/meshagent-client.js +357 -10
- package/dist/node/messaging-client.js +1 -1
- package/dist/node/queues-client.js +1 -1
- package/dist/node/requirement.d.ts +21 -0
- package/dist/node/requirement.js +87 -1
- package/dist/node/room-client.d.ts +12 -1
- package/dist/node/room-client.js +91 -31
- package/dist/node/secrets-client.js +1 -1
- package/dist/node/services-client.js +2 -2
- package/dist/node/storage-client.d.ts +1 -1
- package/dist/node/storage-client.js +1 -1
- package/dist/node/stream-controller.d.ts +1 -0
- package/dist/node/stream-controller.js +27 -7
- package/dist/node/sync-client.js +1 -1
- package/package.json +1 -1
|
@@ -216,6 +216,7 @@ class RoomClient {
|
|
|
216
216
|
this._eventEmitter = new event_emitter_js_1.EventEmitter();
|
|
217
217
|
this._pendingRequests = new Map();
|
|
218
218
|
this._toolCallStreams = new Map();
|
|
219
|
+
this._toolCallPreOpenErrors = new Map();
|
|
219
220
|
this._ignoredResponseLabels = new Map();
|
|
220
221
|
this._ready = new completer_js_1.Completer();
|
|
221
222
|
this._roomClosed = new completer_js_1.Completer();
|
|
@@ -1199,13 +1200,10 @@ class RoomClient {
|
|
|
1199
1200
|
}
|
|
1200
1201
|
return toolkits;
|
|
1201
1202
|
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
tool: params.tool,
|
|
1207
|
-
};
|
|
1208
|
-
let requestData;
|
|
1203
|
+
_normalizeInvokeInput(input) {
|
|
1204
|
+
if (input === undefined) {
|
|
1205
|
+
return new response_js_1.EmptyContent();
|
|
1206
|
+
}
|
|
1209
1207
|
if (input instanceof response_js_1.BinaryContent ||
|
|
1210
1208
|
input instanceof response_js_1.EmptyContent ||
|
|
1211
1209
|
input instanceof response_js_1.ErrorContent ||
|
|
@@ -1213,35 +1211,53 @@ class RoomClient {
|
|
|
1213
1211
|
input instanceof response_js_1.JsonContent ||
|
|
1214
1212
|
input instanceof response_js_1.LinkContent ||
|
|
1215
1213
|
input instanceof response_js_1.TextContent) {
|
|
1216
|
-
|
|
1217
|
-
request["arguments"] = JSON.parse((0, utils_js_1.splitMessageHeader)(packed));
|
|
1218
|
-
const payload = (0, utils_js_1.splitMessagePayload)(packed);
|
|
1219
|
-
if (payload.length > 0) {
|
|
1220
|
-
requestData = payload;
|
|
1221
|
-
}
|
|
1214
|
+
return input;
|
|
1222
1215
|
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
type: "json",
|
|
1226
|
-
json: input,
|
|
1227
|
-
};
|
|
1216
|
+
if (typeof input === "object" && input !== null && !Array.isArray(input)) {
|
|
1217
|
+
return new response_js_1.JsonContent({ json: input });
|
|
1228
1218
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1219
|
+
throw new room_server_client_js_1.RoomServerException("invoke input must be a content value or JSON object");
|
|
1220
|
+
}
|
|
1221
|
+
invoke(params) {
|
|
1222
|
+
const outputPromise = this.invokeToolCall({
|
|
1223
|
+
toolkit: params.toolkit,
|
|
1224
|
+
tool: params.tool,
|
|
1225
|
+
input: this._normalizeInvokeInput(params.input ?? params.arguments),
|
|
1226
|
+
participantId: params.participantId,
|
|
1227
|
+
onBehalfOfId: params.onBehalfOfId,
|
|
1228
|
+
});
|
|
1229
|
+
void outputPromise.catch(() => undefined);
|
|
1230
|
+
return {
|
|
1231
|
+
async *[Symbol.asyncIterator]() {
|
|
1232
|
+
const output = await outputPromise;
|
|
1233
|
+
if (output.kind === "stream") {
|
|
1234
|
+
yield* output.stream;
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
yield output.content;
|
|
1238
|
+
},
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
async invokeContent(params) {
|
|
1242
|
+
const output = await this.invokeToolCall({
|
|
1243
|
+
toolkit: params.toolkit,
|
|
1244
|
+
tool: params.tool,
|
|
1245
|
+
input: this._normalizeInvokeInput(params.input ?? params.arguments),
|
|
1246
|
+
participantId: params.participantId,
|
|
1247
|
+
onBehalfOfId: params.onBehalfOfId,
|
|
1248
|
+
});
|
|
1249
|
+
if (output.kind !== "content") {
|
|
1250
|
+
throw new room_server_client_js_1.RoomServerException("unexpected streamed output from " + params.toolkit + "." + params.tool);
|
|
1237
1251
|
}
|
|
1238
|
-
return
|
|
1252
|
+
return output.content;
|
|
1239
1253
|
}
|
|
1240
1254
|
async invokeToolCall(params) {
|
|
1241
1255
|
const toolCallId = `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
1242
1256
|
const controller = new stream_controller_js_1.StreamController();
|
|
1243
1257
|
const responseIterator = controller.stream[Symbol.asyncIterator]();
|
|
1258
|
+
const preOpenError = new completer_js_1.Completer();
|
|
1244
1259
|
this._toolCallStreams.set(toolCallId, controller);
|
|
1260
|
+
this._toolCallPreOpenErrors.set(toolCallId, preOpenError);
|
|
1245
1261
|
const request = {
|
|
1246
1262
|
toolkit: params.toolkit,
|
|
1247
1263
|
tool: params.tool,
|
|
@@ -1269,7 +1285,11 @@ class RoomClient {
|
|
|
1269
1285
|
request["on_behalf_of_id"] = params.onBehalfOfId;
|
|
1270
1286
|
}
|
|
1271
1287
|
try {
|
|
1272
|
-
const response = await
|
|
1288
|
+
const response = await Promise.race([
|
|
1289
|
+
this.sendRequest("room.invoke_tool", request, requestData),
|
|
1290
|
+
preOpenError.fut,
|
|
1291
|
+
]);
|
|
1292
|
+
this._toolCallPreOpenErrors.delete(toolCallId);
|
|
1273
1293
|
if (response instanceof response_js_1.ControlContent && response.method === "open") {
|
|
1274
1294
|
if (requestTask != null) {
|
|
1275
1295
|
void requestTask.catch((error) => {
|
|
@@ -1277,7 +1297,7 @@ class RoomClient {
|
|
|
1277
1297
|
if (stream == null) {
|
|
1278
1298
|
return;
|
|
1279
1299
|
}
|
|
1280
|
-
stream.
|
|
1300
|
+
stream.addError(error);
|
|
1281
1301
|
stream.close();
|
|
1282
1302
|
this._toolCallStreams.delete(toolCallId);
|
|
1283
1303
|
});
|
|
@@ -1301,6 +1321,7 @@ class RoomClient {
|
|
|
1301
1321
|
}
|
|
1302
1322
|
catch (error) {
|
|
1303
1323
|
await Promise.resolve(requestTask).catch(() => undefined);
|
|
1324
|
+
this._toolCallPreOpenErrors.delete(toolCallId);
|
|
1304
1325
|
this._toolCallStreams.delete(toolCallId);
|
|
1305
1326
|
controller.close();
|
|
1306
1327
|
throw error;
|
|
@@ -1338,7 +1359,9 @@ class RoomClient {
|
|
|
1338
1359
|
const toolCallId = `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
1339
1360
|
const controller = new stream_controller_js_1.StreamController();
|
|
1340
1361
|
const responseIterator = controller.stream[Symbol.asyncIterator]();
|
|
1362
|
+
const preOpenError = new completer_js_1.Completer();
|
|
1341
1363
|
this._toolCallStreams.set(toolCallId, controller);
|
|
1364
|
+
this._toolCallPreOpenErrors.set(toolCallId, preOpenError);
|
|
1342
1365
|
const request = {
|
|
1343
1366
|
toolkit: params.toolkit,
|
|
1344
1367
|
tool: params.tool,
|
|
@@ -1357,11 +1380,24 @@ class RoomClient {
|
|
|
1357
1380
|
if (stream == null) {
|
|
1358
1381
|
return;
|
|
1359
1382
|
}
|
|
1360
|
-
stream.
|
|
1383
|
+
stream.addError(error);
|
|
1361
1384
|
stream.close();
|
|
1362
1385
|
this._toolCallStreams.delete(toolCallId);
|
|
1363
1386
|
});
|
|
1364
|
-
|
|
1387
|
+
let response;
|
|
1388
|
+
try {
|
|
1389
|
+
response = await Promise.race([
|
|
1390
|
+
this.sendRequest("room.invoke_tool", request),
|
|
1391
|
+
preOpenError.fut,
|
|
1392
|
+
]);
|
|
1393
|
+
}
|
|
1394
|
+
catch (error) {
|
|
1395
|
+
this._toolCallPreOpenErrors.delete(toolCallId);
|
|
1396
|
+
this._toolCallStreams.delete(toolCallId);
|
|
1397
|
+
controller.close();
|
|
1398
|
+
throw error;
|
|
1399
|
+
}
|
|
1400
|
+
this._toolCallPreOpenErrors.delete(toolCallId);
|
|
1365
1401
|
if (!(response instanceof response_js_1.ControlContent) || response.method !== "open") {
|
|
1366
1402
|
this._toolCallStreams.delete(toolCallId);
|
|
1367
1403
|
controller.close();
|
|
@@ -1418,10 +1454,34 @@ class RoomClient {
|
|
|
1418
1454
|
return;
|
|
1419
1455
|
}
|
|
1420
1456
|
const content = this._decodeToolCallContent({ header, payload });
|
|
1457
|
+
const preOpenError = this._toolCallPreOpenErrors.get(toolCallId);
|
|
1458
|
+
if (preOpenError != null && content instanceof response_js_1.ErrorContent) {
|
|
1459
|
+
const error = new room_server_client_js_1.RoomServerException(content.text, content.code);
|
|
1460
|
+
if (!preOpenError.completed) {
|
|
1461
|
+
preOpenError.completeError(error);
|
|
1462
|
+
}
|
|
1463
|
+
stream.addError(error);
|
|
1464
|
+
stream.close();
|
|
1465
|
+
this._toolCallStreams.delete(toolCallId);
|
|
1466
|
+
this._toolCallPreOpenErrors.delete(toolCallId);
|
|
1467
|
+
return;
|
|
1468
|
+
}
|
|
1469
|
+
if (content instanceof response_js_1.ControlContent &&
|
|
1470
|
+
content.method === "close" &&
|
|
1471
|
+
content.statusCode !== undefined &&
|
|
1472
|
+
content.statusCode !== response_js_1.ControlCloseStatus.NORMAL) {
|
|
1473
|
+
const error = new room_server_client_js_1.RoomServerException(content.message ?? `tool call stream closed with status ${content.statusCode}`, undefined, { statusCode: content.statusCode });
|
|
1474
|
+
stream.addError(error);
|
|
1475
|
+
stream.close();
|
|
1476
|
+
this._toolCallStreams.delete(toolCallId);
|
|
1477
|
+
this._toolCallPreOpenErrors.delete(toolCallId);
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1421
1480
|
stream.add(content);
|
|
1422
1481
|
if (content instanceof response_js_1.ControlContent && content.method === "close") {
|
|
1423
1482
|
stream.close();
|
|
1424
1483
|
this._toolCallStreams.delete(toolCallId);
|
|
1484
|
+
this._toolCallPreOpenErrors.delete(toolCallId);
|
|
1425
1485
|
}
|
|
1426
1486
|
}
|
|
1427
1487
|
async _handleResponse(protocol, messageId, _type, data) {
|
|
@@ -21,7 +21,7 @@ class SecretsClient {
|
|
|
21
21
|
return new room_server_client_js_1.RoomServerException(`unexpected return type from secrets.${operation}`);
|
|
22
22
|
}
|
|
23
23
|
async invoke(operation, input) {
|
|
24
|
-
return await this.client.
|
|
24
|
+
return await this.client.invokeContent({
|
|
25
25
|
toolkit: "secrets",
|
|
26
26
|
tool: operation,
|
|
27
27
|
input,
|
|
@@ -53,7 +53,7 @@ class ServicesClient {
|
|
|
53
53
|
return (await this.listWithState()).services;
|
|
54
54
|
}
|
|
55
55
|
async listWithState() {
|
|
56
|
-
const response = await this.room.
|
|
56
|
+
const response = await this.room.invokeContent({
|
|
57
57
|
toolkit: "services",
|
|
58
58
|
tool: "list",
|
|
59
59
|
input: {},
|
|
@@ -77,7 +77,7 @@ class ServicesClient {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
async restart(params) {
|
|
80
|
-
const response = await this.room.
|
|
80
|
+
const response = await this.room.invokeContent({
|
|
81
81
|
toolkit: "services",
|
|
82
82
|
tool: "restart",
|
|
83
83
|
input: {
|
|
@@ -3,7 +3,7 @@ import { Protocol } from "./protocol.js";
|
|
|
3
3
|
import { RoomEvent } from "./room-event.js";
|
|
4
4
|
import { BinaryContent, FileContent } from "./response.js";
|
|
5
5
|
import { EventEmitter } from "./event-emitter.js";
|
|
6
|
-
type StorageClientRoom = Pick<RoomClient, "
|
|
6
|
+
type StorageClientRoom = Pick<RoomClient, "invokeContent" | "invokeStream" | "emit"> & {
|
|
7
7
|
isActiveProtocol(protocol: Protocol): boolean;
|
|
8
8
|
protocol: Pick<Protocol, "addHandler">;
|
|
9
9
|
};
|
|
@@ -137,7 +137,7 @@ class StorageClient extends event_emitter_js_1.EventEmitter {
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
async _invoke(operation, input) {
|
|
140
|
-
return await this.client.
|
|
140
|
+
return await this.client.invokeContent({
|
|
141
141
|
toolkit: "storage",
|
|
142
142
|
tool: operation,
|
|
143
143
|
input,
|
|
@@ -19,21 +19,26 @@ class StreamController {
|
|
|
19
19
|
if (sub.waiter) {
|
|
20
20
|
const w = sub.waiter;
|
|
21
21
|
sub.waiter = null;
|
|
22
|
-
w({ done: true, value: undefined });
|
|
22
|
+
w.resolve({ done: true, value: undefined });
|
|
23
23
|
}
|
|
24
24
|
self.subs.delete(sub);
|
|
25
25
|
};
|
|
26
26
|
return {
|
|
27
27
|
async next() {
|
|
28
28
|
if (sub.queue.length > 0) {
|
|
29
|
-
|
|
29
|
+
const item = sub.queue.shift();
|
|
30
|
+
if (item.kind === "error") {
|
|
31
|
+
cleanup();
|
|
32
|
+
return Promise.reject(item.error);
|
|
33
|
+
}
|
|
34
|
+
return { done: false, value: item.value };
|
|
30
35
|
}
|
|
31
36
|
if (self.closed) {
|
|
32
37
|
cleanup();
|
|
33
38
|
return { done: true, value: undefined };
|
|
34
39
|
}
|
|
35
|
-
return new Promise(resolve => {
|
|
36
|
-
sub.waiter = resolve;
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
sub.waiter = { resolve, reject };
|
|
37
42
|
});
|
|
38
43
|
},
|
|
39
44
|
async return() {
|
|
@@ -55,10 +60,25 @@ class StreamController {
|
|
|
55
60
|
if (sub.waiter) {
|
|
56
61
|
const w = sub.waiter;
|
|
57
62
|
sub.waiter = null;
|
|
58
|
-
w({ done: false, value });
|
|
63
|
+
w.resolve({ done: false, value });
|
|
59
64
|
}
|
|
60
65
|
else {
|
|
61
|
-
sub.queue.push(value);
|
|
66
|
+
sub.queue.push({ kind: "value", value });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
addError(error) {
|
|
71
|
+
if (this.closed)
|
|
72
|
+
return;
|
|
73
|
+
for (const sub of [...this.subs]) {
|
|
74
|
+
if (sub.waiter) {
|
|
75
|
+
const w = sub.waiter;
|
|
76
|
+
sub.waiter = null;
|
|
77
|
+
w.reject(error);
|
|
78
|
+
this.subs.delete(sub);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
sub.queue.push({ kind: "error", error });
|
|
62
82
|
}
|
|
63
83
|
}
|
|
64
84
|
}
|
|
@@ -70,7 +90,7 @@ class StreamController {
|
|
|
70
90
|
if (sub.waiter) {
|
|
71
91
|
const w = sub.waiter;
|
|
72
92
|
sub.waiter = null;
|
|
73
|
-
w({ done: true, value: undefined });
|
|
93
|
+
w.resolve({ done: true, value: undefined });
|
|
74
94
|
}
|
|
75
95
|
}
|
|
76
96
|
}
|
|
@@ -164,7 +164,7 @@ class SyncClient extends event_emitter_js_1.EventEmitter {
|
|
|
164
164
|
return new room_server_client_js_1.RoomServerException(`unexpected return type from sync.${operation}`);
|
|
165
165
|
}
|
|
166
166
|
async _invoke(operation, input) {
|
|
167
|
-
return await this.room.
|
|
167
|
+
return await this.room.invokeContent({
|
|
168
168
|
toolkit: "sync",
|
|
169
169
|
tool: operation,
|
|
170
170
|
input,
|
package/dist/esm/agent-client.js
CHANGED
|
@@ -136,7 +136,7 @@ export class AgentsClient {
|
|
|
136
136
|
}
|
|
137
137
|
async invokeTool(params) {
|
|
138
138
|
if (params.input === undefined) {
|
|
139
|
-
return await this.client.
|
|
139
|
+
return await this.client.invokeContent({
|
|
140
140
|
toolkit: params.toolkit,
|
|
141
141
|
tool: params.tool,
|
|
142
142
|
arguments: params.arguments ?? {},
|
|
@@ -399,7 +399,7 @@ export class ContainersClient {
|
|
|
399
399
|
return new RoomServerException(`unexpected return type from containers.${operation}`);
|
|
400
400
|
}
|
|
401
401
|
async invoke(operation, input) {
|
|
402
|
-
return await this.room.
|
|
402
|
+
return await this.room.invokeContent({
|
|
403
403
|
toolkit: "containers",
|
|
404
404
|
tool: operation,
|
|
405
405
|
input,
|
|
@@ -173,7 +173,7 @@ export type DatasetRecord = Record<string, DatasetValue>;
|
|
|
173
173
|
export type DatasetRows = DatasetRecord[];
|
|
174
174
|
export type DatasetRowChunks = AsyncIterable<DatasetRows> | Iterable<DatasetRows>;
|
|
175
175
|
export type DatasetWhere = string | Record<string, DatasetValue>;
|
|
176
|
-
type DatasetRoomInvoker = Pick<RoomClient, "
|
|
176
|
+
type DatasetRoomInvoker = Pick<RoomClient, "invokeContent" | "invokeStream">;
|
|
177
177
|
export declare class DatasetUuid {
|
|
178
178
|
readonly value: string;
|
|
179
179
|
constructor(value: string);
|
|
@@ -715,7 +715,7 @@ export class DatasetsClient {
|
|
|
715
715
|
return new RoomServerException(`unexpected return type from datasets.${operation}`);
|
|
716
716
|
}
|
|
717
717
|
async invoke(operation, input) {
|
|
718
|
-
const response = await this.room.
|
|
718
|
+
const response = await this.room.invokeContent({ toolkit: "dataset", tool: operation, input });
|
|
719
719
|
if (response instanceof JsonContent) {
|
|
720
720
|
return response;
|
|
721
721
|
}
|
|
@@ -725,7 +725,7 @@ export class DatasetsClient {
|
|
|
725
725
|
return null;
|
|
726
726
|
}
|
|
727
727
|
async invokeContent(operation, input) {
|
|
728
|
-
return await this.room.
|
|
728
|
+
return await this.room.invokeContent({ toolkit: "dataset", tool: operation, input });
|
|
729
729
|
}
|
|
730
730
|
async invokeStream(operation, input) {
|
|
731
731
|
return await this.room.invokeStream({ toolkit: "dataset", tool: operation, input });
|
|
@@ -901,7 +901,7 @@ export class DatasetsClient {
|
|
|
901
901
|
await this.drainWriteStream("create_table", input);
|
|
902
902
|
}
|
|
903
903
|
async dropTable({ name, ignoreMissing = false, namespace, branch }) {
|
|
904
|
-
await this.room.
|
|
904
|
+
await this.room.invokeContent({
|
|
905
905
|
toolkit: "dataset",
|
|
906
906
|
tool: "drop_table",
|
|
907
907
|
input: {
|
|
@@ -956,7 +956,7 @@ export class DatasetsClient {
|
|
|
956
956
|
});
|
|
957
957
|
}
|
|
958
958
|
async dropIndex({ table, name, namespace, branch }) {
|
|
959
|
-
await this.room.
|
|
959
|
+
await this.room.invokeContent({
|
|
960
960
|
toolkit: "dataset",
|
|
961
961
|
tool: "drop_index",
|
|
962
962
|
input: { table, name, namespace: namespace ?? null, branch: branch ?? null },
|
|
@@ -975,7 +975,7 @@ export class DatasetsClient {
|
|
|
975
975
|
}));
|
|
976
976
|
return;
|
|
977
977
|
}
|
|
978
|
-
await this.room.
|
|
978
|
+
await this.room.invokeContent({
|
|
979
979
|
toolkit: "dataset",
|
|
980
980
|
tool: "add_columns",
|
|
981
981
|
input: {
|
|
@@ -987,7 +987,7 @@ export class DatasetsClient {
|
|
|
987
987
|
});
|
|
988
988
|
}
|
|
989
989
|
async dropColumns({ table, columns, namespace, branch }) {
|
|
990
|
-
await this.room.
|
|
990
|
+
await this.room.invokeContent({
|
|
991
991
|
toolkit: "dataset",
|
|
992
992
|
tool: "drop_columns",
|
|
993
993
|
input: { table, columns, namespace: namespace ?? null, branch: branch ?? null },
|
|
@@ -1009,7 +1009,7 @@ export class DatasetsClient {
|
|
|
1009
1009
|
await this.drainWriteStream("insert", input);
|
|
1010
1010
|
}
|
|
1011
1011
|
async update({ table, where, values, namespace, branch }) {
|
|
1012
|
-
await this.room.
|
|
1012
|
+
await this.room.invokeContent({
|
|
1013
1013
|
toolkit: "dataset",
|
|
1014
1014
|
tool: "update",
|
|
1015
1015
|
input: {
|
|
@@ -1022,7 +1022,7 @@ export class DatasetsClient {
|
|
|
1022
1022
|
});
|
|
1023
1023
|
}
|
|
1024
1024
|
async delete({ table, where, namespace, branch }) {
|
|
1025
|
-
await this.room.
|
|
1025
|
+
await this.room.invokeContent({
|
|
1026
1026
|
toolkit: "dataset",
|
|
1027
1027
|
tool: "delete",
|
|
1028
1028
|
input: { table, where, namespace: namespace ?? null, branch: branch ?? null },
|
|
@@ -1134,13 +1134,13 @@ export class DatasetsClient {
|
|
|
1134
1134
|
});
|
|
1135
1135
|
}
|
|
1136
1136
|
async closeSqlQuery({ queryId }) {
|
|
1137
|
-
const response = await this.room.
|
|
1137
|
+
const response = await this.room.invokeContent({ toolkit: "dataset", tool: "close_sql_query", input: { query_id: queryId } });
|
|
1138
1138
|
if (!(response instanceof EmptyContent)) {
|
|
1139
1139
|
throw this._unexpectedResponseError("close_sql_query");
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
1142
|
async cancelSqlQuery({ queryId }) {
|
|
1143
|
-
const response = await this.room.
|
|
1143
|
+
const response = await this.room.invokeContent({ toolkit: "dataset", tool: "cancel_sql_query", input: { query_id: queryId } });
|
|
1144
1144
|
if (!(response instanceof JsonContent)
|
|
1145
1145
|
|| !["cancelled", "cancelling", "not_cancellable"].includes(response.json.status)) {
|
|
1146
1146
|
throw this._unexpectedResponseError("cancel_sql_query");
|
|
@@ -1296,7 +1296,7 @@ export class DatasetsClient {
|
|
|
1296
1296
|
return response.json.count;
|
|
1297
1297
|
}
|
|
1298
1298
|
async inspect({ table, namespace, branch, version }) {
|
|
1299
|
-
const response = await this.room.
|
|
1299
|
+
const response = await this.room.invokeContent({
|
|
1300
1300
|
toolkit: "dataset",
|
|
1301
1301
|
tool: "inspect",
|
|
1302
1302
|
input: {
|
|
@@ -1341,7 +1341,7 @@ export class DatasetsClient {
|
|
|
1341
1341
|
return tableStatsFromJson(response.json);
|
|
1342
1342
|
}
|
|
1343
1343
|
async restore({ table, version, namespace, branch }) {
|
|
1344
|
-
await this.room.
|
|
1344
|
+
await this.room.invokeContent({
|
|
1345
1345
|
toolkit: "dataset",
|
|
1346
1346
|
tool: "restore",
|
|
1347
1347
|
input: { table, version, namespace: namespace ?? null, branch: branch ?? null },
|
|
@@ -1359,7 +1359,7 @@ export class DatasetsClient {
|
|
|
1359
1359
|
return response.json.versions.map((version) => tableVersionFromJson(version));
|
|
1360
1360
|
}
|
|
1361
1361
|
async createIndex({ table, config, namespace, branch }) {
|
|
1362
|
-
await this.room.
|
|
1362
|
+
await this.room.invokeContent({
|
|
1363
1363
|
toolkit: "dataset",
|
|
1364
1364
|
tool: "create_index",
|
|
1365
1365
|
input: { table, config, namespace: namespace ?? null, branch: branch ?? null },
|
|
@@ -1387,7 +1387,7 @@ export class DatasetsClient {
|
|
|
1387
1387
|
return response.json.branches.map((branch) => tableBranchFromJson(branch));
|
|
1388
1388
|
}
|
|
1389
1389
|
async createBranch({ branch, fromBranch, namespace }) {
|
|
1390
|
-
await this.room.
|
|
1390
|
+
await this.room.invokeContent({
|
|
1391
1391
|
toolkit: "dataset",
|
|
1392
1392
|
tool: "create_branch",
|
|
1393
1393
|
input: {
|
|
@@ -1398,7 +1398,7 @@ export class DatasetsClient {
|
|
|
1398
1398
|
});
|
|
1399
1399
|
}
|
|
1400
1400
|
async deleteBranch({ branch, namespace }) {
|
|
1401
|
-
await this.room.
|
|
1401
|
+
await this.room.invokeContent({
|
|
1402
1402
|
toolkit: "dataset",
|
|
1403
1403
|
tool: "delete_branch",
|
|
1404
1404
|
input: { branch, namespace: namespace ?? null },
|
|
@@ -21,7 +21,7 @@ export class DeveloperClient extends EventEmitter {
|
|
|
21
21
|
this._emitDeveloperLog(rawJson["type"], rawJson["data"]);
|
|
22
22
|
}
|
|
23
23
|
async log(type, data) {
|
|
24
|
-
await this.client.
|
|
24
|
+
await this.client.invokeContent({
|
|
25
25
|
toolkit: "developer",
|
|
26
26
|
tool: "log",
|
|
27
27
|
input: { type, data },
|
package/dist/esm/entrypoint.js
CHANGED
|
@@ -10,7 +10,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
10
10
|
var __getProtoOf = Object.getPrototypeOf;
|
|
11
11
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
12
|
var __commonJS = (cb, mod) => function __require() {
|
|
13
|
-
|
|
13
|
+
try {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
throw mod = 0, e;
|
|
18
|
+
}
|
|
14
19
|
};
|
|
15
20
|
var __copyProps = (to, from2, except, desc) => {
|
|
16
21
|
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
|
|
@@ -383,7 +383,7 @@ export class MemoryClient {
|
|
|
383
383
|
return unexpectedResponse(operation);
|
|
384
384
|
}
|
|
385
385
|
async invoke(operation, input) {
|
|
386
|
-
const response = await this.room.
|
|
386
|
+
const response = await this.room.invokeContent({
|
|
387
387
|
toolkit: "memory",
|
|
388
388
|
tool: operation,
|
|
389
389
|
input,
|