@meshagent/meshagent-ts-auth 0.40.2 → 0.41.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/CHANGELOG.md +9 -0
- package/dist/browser/ma-auth.global.js +108 -40
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [0.41.0]
|
|
2
|
+
- Added spec-based route models and route CRUD/listing APIs, including room and agent routes, with legacy-payload compatibility.
|
|
3
|
+
- Managed-agent toolkit descriptions were simplified to omit `thumbnailUrl` and `pricing`.
|
|
4
|
+
- Breaking change: consumers that read the old toolkit metadata fields need to update to the new shape.
|
|
5
|
+
|
|
6
|
+
## [0.40.3]
|
|
7
|
+
- TypeScript client now supports route-spec CRUD/listing for room-backed and agent-backed routes.
|
|
8
|
+
- Toolkit serialization was slimmed down by removing `thumbnailUrl` and `pricing` from toolkit and tool payloads, so consumers must no longer rely on those fields.
|
|
9
|
+
|
|
1
10
|
## [0.40.2]
|
|
2
11
|
- Stability
|
|
3
12
|
|
|
@@ -11223,7 +11223,7 @@ ${err.toString()}`);
|
|
|
11223
11223
|
utils_12 = (init_utils(), __toCommonJS(utils_exports));
|
|
11224
11224
|
room_event_1 = (init_room_event(), __toCommonJS(room_event_exports));
|
|
11225
11225
|
Tool = class {
|
|
11226
|
-
constructor({ name, description, title, inputSchema, inputSpec, outputSpec, outputSchema
|
|
11226
|
+
constructor({ name, description, title, inputSchema, inputSpec, outputSpec, outputSchema }) {
|
|
11227
11227
|
this.name = name;
|
|
11228
11228
|
this.description = description;
|
|
11229
11229
|
this.title = title;
|
|
@@ -11257,7 +11257,6 @@ ${err.toString()}`);
|
|
|
11257
11257
|
schema: outputSchema
|
|
11258
11258
|
});
|
|
11259
11259
|
}
|
|
11260
|
-
this.thumbnailUrl = thumbnailUrl;
|
|
11261
11260
|
}
|
|
11262
11261
|
get inputSchema() {
|
|
11263
11262
|
return this.inputSpec?.schema;
|
|
@@ -11268,11 +11267,10 @@ ${err.toString()}`);
|
|
|
11268
11267
|
};
|
|
11269
11268
|
exports.Tool = Tool;
|
|
11270
11269
|
Toolkit = class {
|
|
11271
|
-
constructor({ name, title = name, description = "",
|
|
11270
|
+
constructor({ name, title = name, description = "", tools, rules = [] }) {
|
|
11272
11271
|
this.name = name;
|
|
11273
11272
|
this.title = title;
|
|
11274
11273
|
this.description = description;
|
|
11275
|
-
this.thumbnailUrl = thumbnailUrl;
|
|
11276
11274
|
this.tools = tools;
|
|
11277
11275
|
this.rules = rules;
|
|
11278
11276
|
}
|
|
@@ -11290,8 +11288,7 @@ ${err.toString()}`);
|
|
|
11290
11288
|
description: tool.description,
|
|
11291
11289
|
title: tool.title,
|
|
11292
11290
|
input_spec: tool.inputSpec?.toJson(),
|
|
11293
|
-
output_spec: tool.outputSpec?.toJson()
|
|
11294
|
-
thumbnail_url: tool.thumbnailUrl
|
|
11291
|
+
output_spec: tool.outputSpec?.toJson()
|
|
11295
11292
|
};
|
|
11296
11293
|
}
|
|
11297
11294
|
return json;
|
|
@@ -11358,8 +11355,7 @@ ${err.toString()}`);
|
|
|
11358
11355
|
title: this.toolkit.title,
|
|
11359
11356
|
description: this.toolkit.description,
|
|
11360
11357
|
tools: this.toolkit.getTools(),
|
|
11361
|
-
public: public_
|
|
11362
|
-
thumbnail_url: this.toolkit.thumbnailUrl
|
|
11358
|
+
public: public_
|
|
11363
11359
|
});
|
|
11364
11360
|
const json = response.json;
|
|
11365
11361
|
this._registrationId = json["id"];
|
|
@@ -11459,7 +11455,7 @@ ${err.toString()}`);
|
|
|
11459
11455
|
exports.AgentsClient = exports.ToolkitDescription = exports.ToolDescription = void 0;
|
|
11460
11456
|
tool_content_type_12 = (init_tool_content_type(), __toCommonJS(tool_content_type_exports));
|
|
11461
11457
|
ToolDescription = class {
|
|
11462
|
-
constructor({ title, name, description, inputSchema, inputSpec, outputSpec, outputSchema,
|
|
11458
|
+
constructor({ title, name, description, inputSchema, inputSpec, outputSpec, outputSchema, defs }) {
|
|
11463
11459
|
this.title = title;
|
|
11464
11460
|
this.name = name;
|
|
11465
11461
|
this.description = description;
|
|
@@ -11493,9 +11489,7 @@ ${err.toString()}`);
|
|
|
11493
11489
|
schema: outputSchema
|
|
11494
11490
|
});
|
|
11495
11491
|
}
|
|
11496
|
-
this.thumbnailUrl = thumbnailUrl;
|
|
11497
11492
|
this.defs = defs;
|
|
11498
|
-
this.pricing = pricing;
|
|
11499
11493
|
}
|
|
11500
11494
|
get inputSchema() {
|
|
11501
11495
|
return this.inputSpec?.schema;
|
|
@@ -11506,12 +11500,11 @@ ${err.toString()}`);
|
|
|
11506
11500
|
};
|
|
11507
11501
|
exports.ToolDescription = ToolDescription;
|
|
11508
11502
|
ToolkitDescription = class _ToolkitDescription {
|
|
11509
|
-
constructor({ title, name, description, tools,
|
|
11503
|
+
constructor({ title, name, description, tools, participantId }) {
|
|
11510
11504
|
this.title = title;
|
|
11511
11505
|
this.name = name;
|
|
11512
11506
|
this.description = description;
|
|
11513
11507
|
this.tools = tools;
|
|
11514
|
-
this.thumbnailUrl = thumbnailUrl;
|
|
11515
11508
|
this.participantId = participantId;
|
|
11516
11509
|
this._byName = new Map(this.tools.map((tool) => [tool.name, tool]));
|
|
11517
11510
|
}
|
|
@@ -11523,7 +11516,6 @@ ${err.toString()}`);
|
|
|
11523
11516
|
name: this.name,
|
|
11524
11517
|
description: this.description,
|
|
11525
11518
|
title: this.title,
|
|
11526
|
-
thumbnail_url: this.thumbnailUrl,
|
|
11527
11519
|
...this.participantId !== void 0 && {
|
|
11528
11520
|
participant_id: this.participantId
|
|
11529
11521
|
},
|
|
@@ -11533,9 +11525,7 @@ ${err.toString()}`);
|
|
|
11533
11525
|
description: tool.description,
|
|
11534
11526
|
input_spec: tool.inputSpec?.toJson(),
|
|
11535
11527
|
output_spec: tool.outputSpec?.toJson(),
|
|
11536
|
-
|
|
11537
|
-
defs: tool.defs,
|
|
11538
|
-
pricing: tool.pricing
|
|
11528
|
+
defs: tool.defs
|
|
11539
11529
|
}))
|
|
11540
11530
|
};
|
|
11541
11531
|
}
|
|
@@ -11544,7 +11534,6 @@ ${err.toString()}`);
|
|
|
11544
11534
|
const title = json["title"] ?? "";
|
|
11545
11535
|
const finalName = name ?? json["name"] ?? "";
|
|
11546
11536
|
const description = json["description"] ?? "";
|
|
11547
|
-
const thumbnailUrl = json["thumbnail_url"] ?? void 0;
|
|
11548
11537
|
const participantId = json["participant_id"] ?? void 0;
|
|
11549
11538
|
const toolsList = [];
|
|
11550
11539
|
if (Array.isArray(json["tools"])) {
|
|
@@ -11557,9 +11546,7 @@ ${err.toString()}`);
|
|
|
11557
11546
|
inputSpec: tool_content_type_12.ToolContentSpec.fromJson(tool["input_spec"]),
|
|
11558
11547
|
outputSchema: tool["output_schema"],
|
|
11559
11548
|
outputSpec: tool_content_type_12.ToolContentSpec.fromJson(tool["output_spec"]),
|
|
11560
|
-
|
|
11561
|
-
defs: tool["defs"],
|
|
11562
|
-
pricing: tool["pricing"]
|
|
11549
|
+
defs: tool["defs"]
|
|
11563
11550
|
}));
|
|
11564
11551
|
}
|
|
11565
11552
|
} else if (typeof json["tools"] === "object" && json["tools"] !== null) {
|
|
@@ -11574,9 +11561,7 @@ ${err.toString()}`);
|
|
|
11574
11561
|
inputSpec: tool_content_type_12.ToolContentSpec.fromJson(tool["input_spec"]),
|
|
11575
11562
|
outputSchema: tool["output_schema"],
|
|
11576
11563
|
outputSpec: tool_content_type_12.ToolContentSpec.fromJson(tool["output_spec"]),
|
|
11577
|
-
|
|
11578
|
-
defs: tool["defs"],
|
|
11579
|
-
pricing: tool["pricing"]
|
|
11564
|
+
defs: tool["defs"]
|
|
11580
11565
|
}));
|
|
11581
11566
|
}
|
|
11582
11567
|
}
|
|
@@ -11584,7 +11569,6 @@ ${err.toString()}`);
|
|
|
11584
11569
|
title,
|
|
11585
11570
|
name: finalName,
|
|
11586
11571
|
description,
|
|
11587
|
-
thumbnailUrl,
|
|
11588
11572
|
participantId,
|
|
11589
11573
|
tools: toolsList
|
|
11590
11574
|
});
|
|
@@ -32305,6 +32289,9 @@ return true;`);
|
|
|
32305
32289
|
if (!(p2s instanceof Uint8Array) || p2s.length < 8) {
|
|
32306
32290
|
throw new JWEInvalid("PBES2 Salt Input must be 8 or more octets");
|
|
32307
32291
|
}
|
|
32292
|
+
if (!Number.isSafeInteger(p2c) || Math.sign(p2c) !== 1) {
|
|
32293
|
+
throw new JWEInvalid("PBES2 Count Input must be a positive integer");
|
|
32294
|
+
}
|
|
32308
32295
|
const salt = concatSalt(alg, p2s);
|
|
32309
32296
|
const keylen = parseInt(alg.slice(13, 16), 10);
|
|
32310
32297
|
const subtleAlg = {
|
|
@@ -35274,7 +35261,7 @@ ${newlined}
|
|
|
35274
35261
|
init_type_checks();
|
|
35275
35262
|
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
35276
35263
|
const NAME = "jose";
|
|
35277
|
-
const VERSION = "v6.2.
|
|
35264
|
+
const VERSION = "v6.2.3";
|
|
35278
35265
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
35279
35266
|
}
|
|
35280
35267
|
customFetch = /* @__PURE__ */ Symbol();
|
|
@@ -38208,6 +38195,28 @@ ${newlined}
|
|
|
38208
38195
|
annotations: annotations && typeof annotations === "object" ? annotations : {}
|
|
38209
38196
|
};
|
|
38210
38197
|
}
|
|
38198
|
+
parseRoute(data) {
|
|
38199
|
+
if (!data || typeof data !== "object") {
|
|
38200
|
+
throw new requirement_1.RoomException("Invalid route payload: expected object");
|
|
38201
|
+
}
|
|
38202
|
+
if (data.spec && typeof data.spec === "object") {
|
|
38203
|
+
return { domain: String(data.domain ?? data.spec.domain), spec: data.spec };
|
|
38204
|
+
}
|
|
38205
|
+
if (typeof data.domain === "string" && typeof data.room_name === "string") {
|
|
38206
|
+
return {
|
|
38207
|
+
domain: data.domain,
|
|
38208
|
+
spec: {
|
|
38209
|
+
version: "v1",
|
|
38210
|
+
kind: "Route",
|
|
38211
|
+
metadata: { name: data.domain, annotations: data.annotations ?? {} },
|
|
38212
|
+
domain: data.domain,
|
|
38213
|
+
backend: { room: { name: data.room_name } },
|
|
38214
|
+
paths: [{ path: "/", pathType: "prefix", targetPort: data.port }]
|
|
38215
|
+
}
|
|
38216
|
+
};
|
|
38217
|
+
}
|
|
38218
|
+
throw new requirement_1.RoomException("Invalid route payload: missing spec");
|
|
38219
|
+
}
|
|
38211
38220
|
parseFeed(data) {
|
|
38212
38221
|
if (!data || typeof data !== "object") {
|
|
38213
38222
|
throw new requirement_1.RoomException("Invalid feed payload");
|
|
@@ -39643,6 +39652,76 @@ ${newlined}
|
|
|
39643
39652
|
const rooms = Array.isArray(data?.rooms) ? data.rooms : [];
|
|
39644
39653
|
return rooms.map((item) => this.parseRoom(item));
|
|
39645
39654
|
}
|
|
39655
|
+
async createRoute(params2) {
|
|
39656
|
+
await this.request(`/accounts/projects/${params2.projectId}/routes`, {
|
|
39657
|
+
method: "POST",
|
|
39658
|
+
json: { spec: params2.spec },
|
|
39659
|
+
action: "create route",
|
|
39660
|
+
responseType: "void"
|
|
39661
|
+
});
|
|
39662
|
+
}
|
|
39663
|
+
async updateRoute(params2) {
|
|
39664
|
+
const domain = this.encodePathComponent(params2.domain);
|
|
39665
|
+
await this.request(`/accounts/projects/${params2.projectId}/routes/${domain}`, {
|
|
39666
|
+
method: "PUT",
|
|
39667
|
+
json: { spec: params2.spec },
|
|
39668
|
+
action: "update route",
|
|
39669
|
+
responseType: "void"
|
|
39670
|
+
});
|
|
39671
|
+
}
|
|
39672
|
+
async getRoute(params2) {
|
|
39673
|
+
const domain = this.encodePathComponent(params2.domain);
|
|
39674
|
+
const data = await this.request(`/accounts/projects/${params2.projectId}/routes/${domain}`, {
|
|
39675
|
+
action: "get route"
|
|
39676
|
+
});
|
|
39677
|
+
return this.parseRoute(data.route);
|
|
39678
|
+
}
|
|
39679
|
+
async listRoutesPage(projectId, options = {}) {
|
|
39680
|
+
const { count = 100, offset = 0, filter } = options;
|
|
39681
|
+
const data = await this.request(`/accounts/projects/${projectId}/routes`, {
|
|
39682
|
+
query: { count, offset, filter },
|
|
39683
|
+
action: "list routes"
|
|
39684
|
+
});
|
|
39685
|
+
const routes = Array.isArray(data.routes) ? data.routes.map((item) => this.parseRoute(item)) : [];
|
|
39686
|
+
return { routes, total: Number(data.total ?? routes.length) };
|
|
39687
|
+
}
|
|
39688
|
+
async listRoutes(projectId, options = {}) {
|
|
39689
|
+
return (await this.listRoutesPage(projectId, options)).routes;
|
|
39690
|
+
}
|
|
39691
|
+
async listRoomRoutesPage(params2) {
|
|
39692
|
+
const { projectId, roomName, count = 100, offset = 0, filter } = params2;
|
|
39693
|
+
const room = this.encodePathComponent(roomName);
|
|
39694
|
+
const data = await this.request(`/accounts/projects/${projectId}/rooms/${room}/routes`, {
|
|
39695
|
+
query: { count, offset, filter },
|
|
39696
|
+
action: "list room routes"
|
|
39697
|
+
});
|
|
39698
|
+
const routes = Array.isArray(data.routes) ? data.routes.map((item) => this.parseRoute(item)) : [];
|
|
39699
|
+
return { routes, total: Number(data.total ?? routes.length) };
|
|
39700
|
+
}
|
|
39701
|
+
async listRoomRoutes(params2) {
|
|
39702
|
+
return (await this.listRoomRoutesPage(params2)).routes;
|
|
39703
|
+
}
|
|
39704
|
+
async listAgentRoutesPage(params2) {
|
|
39705
|
+
const { projectId, agentName, count = 100, offset = 0, filter } = params2;
|
|
39706
|
+
const agent = this.encodePathComponent(agentName);
|
|
39707
|
+
const data = await this.request(`/accounts/projects/${projectId}/agents/${agent}/routes`, {
|
|
39708
|
+
query: { count, offset, filter },
|
|
39709
|
+
action: "list agent routes"
|
|
39710
|
+
});
|
|
39711
|
+
const routes = Array.isArray(data.routes) ? data.routes.map((item) => this.parseRoute(item)) : [];
|
|
39712
|
+
return { routes, total: Number(data.total ?? routes.length) };
|
|
39713
|
+
}
|
|
39714
|
+
async listAgentRoutes(params2) {
|
|
39715
|
+
return (await this.listAgentRoutesPage(params2)).routes;
|
|
39716
|
+
}
|
|
39717
|
+
async deleteRoute(params2) {
|
|
39718
|
+
const domain = this.encodePathComponent(params2.domain);
|
|
39719
|
+
await this.request(`/accounts/projects/${params2.projectId}/routes/${domain}`, {
|
|
39720
|
+
method: "DELETE",
|
|
39721
|
+
action: "delete route",
|
|
39722
|
+
responseType: "void"
|
|
39723
|
+
});
|
|
39724
|
+
}
|
|
39646
39725
|
async listRoomGrants(projectId, options = {}) {
|
|
39647
39726
|
const { limit = 50, offset = 0, orderBy = "room_name" } = options;
|
|
39648
39727
|
const data = await this.request(`/accounts/projects/${projectId}/room-grants`, {
|
|
@@ -41409,12 +41488,11 @@ ${newlined}
|
|
|
41409
41488
|
updatedAt: _parseStorageTimestamp(value["updated_at"], operation)
|
|
41410
41489
|
});
|
|
41411
41490
|
}
|
|
41412
|
-
async _invoke(operation, input
|
|
41491
|
+
async _invoke(operation, input) {
|
|
41413
41492
|
return await this.client.invoke({
|
|
41414
41493
|
toolkit: "storage",
|
|
41415
41494
|
tool: operation,
|
|
41416
|
-
input
|
|
41417
|
-
callerContext
|
|
41495
|
+
input
|
|
41418
41496
|
});
|
|
41419
41497
|
}
|
|
41420
41498
|
async list(path) {
|
|
@@ -43320,7 +43398,7 @@ ${newlined}
|
|
|
43320
43398
|
expectResponse
|
|
43321
43399
|
});
|
|
43322
43400
|
}
|
|
43323
|
-
invokeNowait({ toolkit, tool, input, participantId, onBehalfOfId
|
|
43401
|
+
invokeNowait({ toolkit, tool, input, participantId, onBehalfOfId }) {
|
|
43324
43402
|
const resolvedInput = input ?? new response_112.EmptyContent();
|
|
43325
43403
|
const packedInput = (0, utils_110.unpackMessage)(resolvedInput.pack());
|
|
43326
43404
|
const request = {
|
|
@@ -43328,7 +43406,6 @@ ${newlined}
|
|
|
43328
43406
|
tool,
|
|
43329
43407
|
participant_id: participantId,
|
|
43330
43408
|
on_behalf_of_id: onBehalfOfId,
|
|
43331
|
-
caller_context: callerContext,
|
|
43332
43409
|
tool_call_id: `${Date.now()}-${Math.random().toString(16).slice(2)}`,
|
|
43333
43410
|
arguments: packedInput[0]
|
|
43334
43411
|
};
|
|
@@ -43431,9 +43508,6 @@ ${newlined}
|
|
|
43431
43508
|
if (params2.onBehalfOfId != null) {
|
|
43432
43509
|
request["on_behalf_of_id"] = params2.onBehalfOfId;
|
|
43433
43510
|
}
|
|
43434
|
-
if (params2.callerContext != null) {
|
|
43435
|
-
request["caller_context"] = params2.callerContext;
|
|
43436
|
-
}
|
|
43437
43511
|
return await this.sendRequest("room.invoke_tool", request, requestData);
|
|
43438
43512
|
}
|
|
43439
43513
|
async invokeWithStreamInput(params2) {
|
|
@@ -43450,9 +43524,6 @@ ${newlined}
|
|
|
43450
43524
|
if (params2.onBehalfOfId != null) {
|
|
43451
43525
|
request["on_behalf_of_id"] = params2.onBehalfOfId;
|
|
43452
43526
|
}
|
|
43453
|
-
if (params2.callerContext != null) {
|
|
43454
|
-
request["caller_context"] = params2.callerContext;
|
|
43455
|
-
}
|
|
43456
43527
|
const requestTask = this._streamInvokeToolRequestChunks(toolCallId, params2.input);
|
|
43457
43528
|
try {
|
|
43458
43529
|
const response = await this.sendRequest("room.invoke_tool", request);
|
|
@@ -43483,9 +43554,6 @@ ${newlined}
|
|
|
43483
43554
|
if (params2.onBehalfOfId != null) {
|
|
43484
43555
|
request["on_behalf_of_id"] = params2.onBehalfOfId;
|
|
43485
43556
|
}
|
|
43486
|
-
if (params2.callerContext != null) {
|
|
43487
|
-
request["caller_context"] = params2.callerContext;
|
|
43488
|
-
}
|
|
43489
43557
|
const requestTask = this._streamInvokeToolRequestChunks(toolCallId, params2.input);
|
|
43490
43558
|
void requestTask.catch((error) => {
|
|
43491
43559
|
const stream = this._toolCallStreams.get(toolCallId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshagent/meshagent-ts-auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Meshagent Typescript Auth",
|
|
5
5
|
"homepage": "https://github.com/meshagent/meshagent-ts-auth",
|
|
6
6
|
"scripts": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"CHANGELOG.md"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@meshagent/meshagent": "^0.
|
|
42
|
+
"@meshagent/meshagent": "^0.41.0",
|
|
43
43
|
"typescript": "^5.8.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|