@meshagent/meshagent 0.40.2 → 0.41.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.
@@ -8,8 +8,7 @@ export declare abstract class Tool {
8
8
  readonly title: string;
9
9
  readonly inputSpec?: ToolContentSpec;
10
10
  readonly outputSpec?: ToolContentSpec;
11
- readonly thumbnailUrl?: string;
12
- constructor({ name, description, title, inputSchema, inputSpec, outputSpec, outputSchema, thumbnailUrl }: {
11
+ constructor({ name, description, title, inputSchema, inputSpec, outputSpec, outputSchema }: {
13
12
  name: string;
14
13
  description: string;
15
14
  title: string;
@@ -17,7 +16,6 @@ export declare abstract class Tool {
17
16
  inputSpec?: ToolContentSpec;
18
17
  outputSpec?: ToolContentSpec;
19
18
  outputSchema?: Record<string, any>;
20
- thumbnailUrl?: string;
21
19
  });
22
20
  get inputSchema(): Record<string, any> | undefined;
23
21
  get outputSchema(): Record<string, any> | undefined;
@@ -27,14 +25,12 @@ export declare class Toolkit {
27
25
  readonly name: string;
28
26
  readonly title: string;
29
27
  readonly description: string;
30
- readonly thumbnailUrl?: string;
31
28
  readonly tools: Tool[];
32
29
  readonly rules: string[];
33
- constructor({ name, title, description, thumbnailUrl, tools, rules }: {
30
+ constructor({ name, title, description, tools, rules }: {
34
31
  name: string;
35
32
  title?: string;
36
33
  description?: string;
37
- thumbnailUrl?: string;
38
34
  tools: Tool[];
39
35
  rules?: string[];
40
36
  });
@@ -8,7 +8,7 @@ const tool_content_type_1 = require("./tool-content-type");
8
8
  const utils_1 = require("./utils");
9
9
  const room_event_1 = require("./room-event");
10
10
  class Tool {
11
- constructor({ name, description, title, inputSchema, inputSpec, outputSpec, outputSchema, thumbnailUrl }) {
11
+ constructor({ name, description, title, inputSchema, inputSpec, outputSpec, outputSchema }) {
12
12
  this.name = name;
13
13
  this.description = description;
14
14
  this.title = title;
@@ -46,7 +46,6 @@ class Tool {
46
46
  schema: outputSchema,
47
47
  });
48
48
  }
49
- this.thumbnailUrl = thumbnailUrl;
50
49
  }
51
50
  get inputSchema() {
52
51
  return this.inputSpec?.schema;
@@ -57,11 +56,10 @@ class Tool {
57
56
  }
58
57
  exports.Tool = Tool;
59
58
  class Toolkit {
60
- constructor({ name, title = name, description = "", thumbnailUrl, tools, rules = [] }) {
59
+ constructor({ name, title = name, description = "", tools, rules = [] }) {
61
60
  this.name = name;
62
61
  this.title = title;
63
62
  this.description = description;
64
- this.thumbnailUrl = thumbnailUrl;
65
63
  this.tools = tools;
66
64
  this.rules = rules;
67
65
  }
@@ -80,7 +78,6 @@ class Toolkit {
80
78
  title: tool.title,
81
79
  input_spec: tool.inputSpec?.toJson(),
82
80
  output_spec: tool.outputSpec?.toJson(),
83
- thumbnail_url: tool.thumbnailUrl,
84
81
  };
85
82
  }
86
83
  return json;
@@ -150,7 +147,6 @@ class _RemoteToolkitWrapper {
150
147
  description: this.toolkit.description,
151
148
  tools: this.toolkit.getTools(),
152
149
  public: public_,
153
- thumbnail_url: this.toolkit.thumbnailUrl,
154
150
  });
155
151
  const json = response.json;
156
152
  this._registrationId = json["id"];
@@ -207,6 +207,38 @@ export interface ServiceSpec {
207
207
  container?: ContainerSpec | null;
208
208
  external?: ExternalServiceSpec | null;
209
209
  }
210
+ export interface RouteMetadata {
211
+ name: string;
212
+ annotations?: Record<string, string>;
213
+ }
214
+ export interface RouteBackendTarget {
215
+ name: string;
216
+ }
217
+ export interface RouteBackend {
218
+ room?: RouteBackendTarget | null;
219
+ agent?: RouteBackendTarget | null;
220
+ }
221
+ export interface RoutePathSpec {
222
+ path?: string;
223
+ pathType?: "prefix" | "exact";
224
+ targetPort: string | number;
225
+ }
226
+ export interface RouteSpec {
227
+ version: "v1";
228
+ kind: "Route";
229
+ metadata: RouteMetadata;
230
+ domain: string;
231
+ backend: RouteBackend;
232
+ paths?: RoutePathSpec[];
233
+ }
234
+ export interface Route {
235
+ domain: string;
236
+ spec: RouteSpec;
237
+ }
238
+ export interface RoutesPage {
239
+ routes: Route[];
240
+ total: number;
241
+ }
210
242
  export interface Mailbox {
211
243
  address: string;
212
244
  room: string;
@@ -240,6 +272,7 @@ export interface FeedSubscription {
240
272
  room: string;
241
273
  roomId?: string | null;
242
274
  path: string;
275
+ filenameDatetimeFormat?: string | null;
243
276
  createdAt: Date;
244
277
  annotations: Record<string, string>;
245
278
  }
@@ -344,6 +377,7 @@ export declare class Meshagent {
344
377
  private parseRoomShare;
345
378
  private parseRoomSession;
346
379
  private parseRoom;
380
+ private parseRoute;
347
381
  private parseFeed;
348
382
  private parseFeedSubscription;
349
383
  private parseLLMLogger;
@@ -541,12 +575,14 @@ export declare class Meshagent {
541
575
  feedId: string;
542
576
  room: string;
543
577
  path: string;
578
+ filenameDatetimeFormat?: string | null;
544
579
  annotations?: Record<string, string>;
545
580
  }): Promise<FeedSubscription>;
546
581
  updateFeedSubscription(params: {
547
582
  projectId: string;
548
583
  feedId: string;
549
584
  subscriptionId: string;
585
+ filenameDatetimeFormat?: string | null;
550
586
  annotations?: Record<string, string>;
551
587
  }): Promise<void>;
552
588
  getFeedSubscription(projectId: string, feedId: string, subscriptionId: string): Promise<FeedSubscription>;
@@ -752,6 +788,61 @@ export declare class Meshagent {
752
788
  offset?: number;
753
789
  orderBy?: string;
754
790
  }): Promise<RoomInfo[]>;
791
+ createRoute(params: {
792
+ projectId: string;
793
+ spec: RouteSpec;
794
+ }): Promise<void>;
795
+ updateRoute(params: {
796
+ projectId: string;
797
+ domain: string;
798
+ spec: RouteSpec;
799
+ }): Promise<void>;
800
+ getRoute(params: {
801
+ projectId: string;
802
+ domain: string;
803
+ }): Promise<Route>;
804
+ listRoutesPage(projectId: string, options?: {
805
+ count?: number;
806
+ offset?: number;
807
+ filter?: string;
808
+ }): Promise<RoutesPage>;
809
+ listRoutes(projectId: string, options?: {
810
+ count?: number;
811
+ offset?: number;
812
+ filter?: string;
813
+ }): Promise<Route[]>;
814
+ listRoomRoutesPage(params: {
815
+ projectId: string;
816
+ roomName: string;
817
+ count?: number;
818
+ offset?: number;
819
+ filter?: string;
820
+ }): Promise<RoutesPage>;
821
+ listRoomRoutes(params: {
822
+ projectId: string;
823
+ roomName: string;
824
+ count?: number;
825
+ offset?: number;
826
+ filter?: string;
827
+ }): Promise<Route[]>;
828
+ listAgentRoutesPage(params: {
829
+ projectId: string;
830
+ agentName: string;
831
+ count?: number;
832
+ offset?: number;
833
+ filter?: string;
834
+ }): Promise<RoutesPage>;
835
+ listAgentRoutes(params: {
836
+ projectId: string;
837
+ agentName: string;
838
+ count?: number;
839
+ offset?: number;
840
+ filter?: string;
841
+ }): Promise<Route[]>;
842
+ deleteRoute(params: {
843
+ projectId: string;
844
+ domain: string;
845
+ }): Promise<void>;
755
846
  listRoomGrants(projectId: string, options?: {
756
847
  limit?: number;
757
848
  offset?: number;
@@ -231,6 +231,28 @@ class Meshagent {
231
231
  annotations: annotations && typeof annotations === "object" ? annotations : {},
232
232
  };
233
233
  }
234
+ parseRoute(data) {
235
+ if (!data || typeof data !== "object") {
236
+ throw new requirement_1.RoomException("Invalid route payload: expected object");
237
+ }
238
+ if (data.spec && typeof data.spec === "object") {
239
+ return { domain: String(data.domain ?? data.spec.domain), spec: data.spec };
240
+ }
241
+ if (typeof data.domain === "string" && typeof data.room_name === "string") {
242
+ return {
243
+ domain: data.domain,
244
+ spec: {
245
+ version: "v1",
246
+ kind: "Route",
247
+ metadata: { name: data.domain, annotations: data.annotations ?? {} },
248
+ domain: data.domain,
249
+ backend: { room: { name: data.room_name } },
250
+ paths: [{ path: "/", pathType: "prefix", targetPort: data.port }],
251
+ },
252
+ };
253
+ }
254
+ throw new requirement_1.RoomException("Invalid route payload: missing spec");
255
+ }
234
256
  parseFeed(data) {
235
257
  if (!data || typeof data !== "object") {
236
258
  throw new requirement_1.RoomException("Invalid feed payload");
@@ -277,11 +299,16 @@ class Meshagent {
277
299
  if (!data || typeof data !== "object") {
278
300
  throw new requirement_1.RoomException("Invalid feed subscription payload");
279
301
  }
280
- const { id, feed_id: feedIdRaw, feedId, project_id: projectIdRaw, projectId, room, room_id: roomIdRaw, roomId, path, created_at: createdAtRaw, createdAt, annotations, } = data;
302
+ const { id, feed_id: feedIdRaw, feedId, project_id: projectIdRaw, projectId, room, room_id: roomIdRaw, roomId, path, filename_datetime_format: filenameDatetimeFormatRaw, filenameDatetimeFormat, created_at: createdAtRaw, createdAt, annotations, } = data;
281
303
  const feedIdValue = typeof feedId === "string" ? feedId : feedIdRaw;
282
304
  const projectIdValue = typeof projectId === "string" ? projectId : projectIdRaw;
283
305
  const createdAtValue = typeof createdAt === "string" ? createdAt : createdAtRaw;
284
306
  const roomIdValue = typeof roomId === "string" ? roomId : roomIdRaw;
307
+ const filenameDatetimeFormatValue = typeof filenameDatetimeFormat === "string"
308
+ ? filenameDatetimeFormat
309
+ : typeof filenameDatetimeFormatRaw === "string"
310
+ ? filenameDatetimeFormatRaw
311
+ : undefined;
285
312
  if (typeof id !== "string" ||
286
313
  typeof feedIdValue !== "string" ||
287
314
  typeof projectIdValue !== "string" ||
@@ -297,6 +324,7 @@ class Meshagent {
297
324
  room,
298
325
  roomId: typeof roomIdValue === "string" ? roomIdValue : undefined,
299
326
  path,
327
+ filenameDatetimeFormat: filenameDatetimeFormatValue,
300
328
  createdAt: new Date(createdAtValue),
301
329
  annotations: annotations && typeof annotations === "object" ? annotations : {},
302
330
  };
@@ -1140,19 +1168,27 @@ class Meshagent {
1140
1168
  });
1141
1169
  }
1142
1170
  async createFeedSubscription(params) {
1143
- const { projectId, feedId, room, path, annotations = {} } = params;
1171
+ const { projectId, feedId, room, path, filenameDatetimeFormat, annotations = {} } = params;
1144
1172
  const data = await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions`, {
1145
1173
  method: "POST",
1146
- json: { room, path, annotations },
1174
+ json: {
1175
+ room,
1176
+ path,
1177
+ ...(filenameDatetimeFormat !== undefined ? { filename_datetime_format: filenameDatetimeFormat } : {}),
1178
+ annotations,
1179
+ },
1147
1180
  action: "create feed subscription",
1148
1181
  });
1149
1182
  return this.parseFeedSubscription(data.subscription);
1150
1183
  }
1151
1184
  async updateFeedSubscription(params) {
1152
- const { projectId, feedId, subscriptionId, annotations = {} } = params;
1185
+ const { projectId, feedId, subscriptionId, filenameDatetimeFormat, annotations = {} } = params;
1153
1186
  await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions/${subscriptionId}`, {
1154
1187
  method: "PUT",
1155
- json: { annotations },
1188
+ json: {
1189
+ ...(filenameDatetimeFormat !== undefined ? { filename_datetime_format: filenameDatetimeFormat } : {}),
1190
+ annotations,
1191
+ },
1156
1192
  action: "update feed subscription",
1157
1193
  responseType: "void",
1158
1194
  });
@@ -1726,6 +1762,76 @@ class Meshagent {
1726
1762
  const rooms = Array.isArray(data?.rooms) ? data.rooms : [];
1727
1763
  return rooms.map((item) => this.parseRoom(item));
1728
1764
  }
1765
+ async createRoute(params) {
1766
+ await this.request(`/accounts/projects/${params.projectId}/routes`, {
1767
+ method: "POST",
1768
+ json: { spec: params.spec },
1769
+ action: "create route",
1770
+ responseType: "void",
1771
+ });
1772
+ }
1773
+ async updateRoute(params) {
1774
+ const domain = this.encodePathComponent(params.domain);
1775
+ await this.request(`/accounts/projects/${params.projectId}/routes/${domain}`, {
1776
+ method: "PUT",
1777
+ json: { spec: params.spec },
1778
+ action: "update route",
1779
+ responseType: "void",
1780
+ });
1781
+ }
1782
+ async getRoute(params) {
1783
+ const domain = this.encodePathComponent(params.domain);
1784
+ const data = await this.request(`/accounts/projects/${params.projectId}/routes/${domain}`, {
1785
+ action: "get route",
1786
+ });
1787
+ return this.parseRoute(data.route);
1788
+ }
1789
+ async listRoutesPage(projectId, options = {}) {
1790
+ const { count = 100, offset = 0, filter } = options;
1791
+ const data = await this.request(`/accounts/projects/${projectId}/routes`, {
1792
+ query: { count, offset, filter },
1793
+ action: "list routes",
1794
+ });
1795
+ const routes = Array.isArray(data.routes) ? data.routes.map((item) => this.parseRoute(item)) : [];
1796
+ return { routes, total: Number(data.total ?? routes.length) };
1797
+ }
1798
+ async listRoutes(projectId, options = {}) {
1799
+ return (await this.listRoutesPage(projectId, options)).routes;
1800
+ }
1801
+ async listRoomRoutesPage(params) {
1802
+ const { projectId, roomName, count = 100, offset = 0, filter } = params;
1803
+ const room = this.encodePathComponent(roomName);
1804
+ const data = await this.request(`/accounts/projects/${projectId}/rooms/${room}/routes`, {
1805
+ query: { count, offset, filter },
1806
+ action: "list room routes",
1807
+ });
1808
+ const routes = Array.isArray(data.routes) ? data.routes.map((item) => this.parseRoute(item)) : [];
1809
+ return { routes, total: Number(data.total ?? routes.length) };
1810
+ }
1811
+ async listRoomRoutes(params) {
1812
+ return (await this.listRoomRoutesPage(params)).routes;
1813
+ }
1814
+ async listAgentRoutesPage(params) {
1815
+ const { projectId, agentName, count = 100, offset = 0, filter } = params;
1816
+ const agent = this.encodePathComponent(agentName);
1817
+ const data = await this.request(`/accounts/projects/${projectId}/agents/${agent}/routes`, {
1818
+ query: { count, offset, filter },
1819
+ action: "list agent routes",
1820
+ });
1821
+ const routes = Array.isArray(data.routes) ? data.routes.map((item) => this.parseRoute(item)) : [];
1822
+ return { routes, total: Number(data.total ?? routes.length) };
1823
+ }
1824
+ async listAgentRoutes(params) {
1825
+ return (await this.listAgentRoutesPage(params)).routes;
1826
+ }
1827
+ async deleteRoute(params) {
1828
+ const domain = this.encodePathComponent(params.domain);
1829
+ await this.request(`/accounts/projects/${params.projectId}/routes/${domain}`, {
1830
+ method: "DELETE",
1831
+ action: "delete route",
1832
+ responseType: "void",
1833
+ });
1834
+ }
1729
1835
  async listRoomGrants(projectId, options = {}) {
1730
1836
  const { limit = 50, offset = 0, orderBy = "room_name" } = options;
1731
1837
  const data = await this.request(`/accounts/projects/${projectId}/room-grants`, {
@@ -176,13 +176,12 @@ export declare class RoomClient {
176
176
  label: string;
177
177
  expectResponse?: boolean;
178
178
  }): number | null;
179
- invokeNowait({ toolkit, tool, input, participantId, onBehalfOfId, callerContext, }: {
179
+ invokeNowait({ toolkit, tool, input, participantId, onBehalfOfId, }: {
180
180
  toolkit: string;
181
181
  tool: string;
182
182
  input?: Content;
183
183
  participantId?: string;
184
184
  onBehalfOfId?: string;
185
- callerContext?: Record<string, unknown>;
186
185
  }): void;
187
186
  _sendLocalAttributesNowait(attributes: Record<string, unknown>): void;
188
187
  _resendLocalAttributesNowait(): void;
@@ -204,7 +203,6 @@ export declare class RoomClient {
204
203
  input?: Record<string, unknown> | Content;
205
204
  participantId?: string;
206
205
  onBehalfOfId?: string;
207
- callerContext?: Record<string, unknown>;
208
206
  }): Promise<Content>;
209
207
  invokeWithStreamInput(params: {
210
208
  toolkit: string;
@@ -212,7 +210,6 @@ export declare class RoomClient {
212
210
  input: AsyncIterable<Content>;
213
211
  participantId?: string;
214
212
  onBehalfOfId?: string;
215
- callerContext?: Record<string, unknown>;
216
213
  }): Promise<Content>;
217
214
  invokeStream(params: {
218
215
  toolkit: string;
@@ -220,7 +217,6 @@ export declare class RoomClient {
220
217
  input: AsyncIterable<Content>;
221
218
  participantId?: string;
222
219
  onBehalfOfId?: string;
223
- callerContext?: Record<string, unknown>;
224
220
  }): Promise<AsyncIterable<Content>>;
225
221
  private _sendToolCallRequestChunk;
226
222
  private _streamInvokeToolRequestChunks;
@@ -1108,7 +1108,7 @@ class RoomClient {
1108
1108
  expectResponse,
1109
1109
  });
1110
1110
  }
1111
- invokeNowait({ toolkit, tool, input, participantId, onBehalfOfId, callerContext, }) {
1111
+ invokeNowait({ toolkit, tool, input, participantId, onBehalfOfId, }) {
1112
1112
  const resolvedInput = input ?? new response_1.EmptyContent();
1113
1113
  const packedInput = (0, utils_1.unpackMessage)(resolvedInput.pack());
1114
1114
  const request = {
@@ -1116,7 +1116,6 @@ class RoomClient {
1116
1116
  tool,
1117
1117
  participant_id: participantId,
1118
1118
  on_behalf_of_id: onBehalfOfId,
1119
- caller_context: callerContext,
1120
1119
  tool_call_id: `${Date.now()}-${Math.random().toString(16).slice(2)}`,
1121
1120
  arguments: packedInput[0],
1122
1121
  };
@@ -1228,9 +1227,6 @@ class RoomClient {
1228
1227
  if (params.onBehalfOfId != null) {
1229
1228
  request["on_behalf_of_id"] = params.onBehalfOfId;
1230
1229
  }
1231
- if (params.callerContext != null) {
1232
- request["caller_context"] = params.callerContext;
1233
- }
1234
1230
  return await this.sendRequest("room.invoke_tool", request, requestData);
1235
1231
  }
1236
1232
  async invokeWithStreamInput(params) {
@@ -1247,9 +1243,6 @@ class RoomClient {
1247
1243
  if (params.onBehalfOfId != null) {
1248
1244
  request["on_behalf_of_id"] = params.onBehalfOfId;
1249
1245
  }
1250
- if (params.callerContext != null) {
1251
- request["caller_context"] = params.callerContext;
1252
- }
1253
1246
  const requestTask = this._streamInvokeToolRequestChunks(toolCallId, params.input);
1254
1247
  try {
1255
1248
  const response = await this.sendRequest("room.invoke_tool", request);
@@ -1281,9 +1274,6 @@ class RoomClient {
1281
1274
  if (params.onBehalfOfId != null) {
1282
1275
  request["on_behalf_of_id"] = params.onBehalfOfId;
1283
1276
  }
1284
- if (params.callerContext != null) {
1285
- request["caller_context"] = params.callerContext;
1286
- }
1287
1277
  const requestTask = this._streamInvokeToolRequestChunks(toolCallId, params.input);
1288
1278
  void requestTask.catch((error) => {
1289
1279
  const stream = this._toolCallStreams.get(toolCallId);
@@ -136,12 +136,11 @@ class StorageClient extends event_emitter_1.EventEmitter {
136
136
  updatedAt: _parseStorageTimestamp(value["updated_at"], operation),
137
137
  });
138
138
  }
139
- async _invoke(operation, input, callerContext) {
139
+ async _invoke(operation, input) {
140
140
  return await this.client.invoke({
141
141
  toolkit: "storage",
142
142
  tool: operation,
143
143
  input,
144
- callerContext,
145
144
  });
146
145
  }
147
146
  async list(path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent",
3
- "version": "0.40.2",
3
+ "version": "0.41.1",
4
4
  "description": "Meshagent Client",
5
5
  "homepage": "https://github.com/meshagent/meshagent-ts",
6
6
  "scripts": {