@meshagent/meshagent 0.27.0 → 0.28.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/browser/agent-client.d.ts +12 -25
  3. package/dist/browser/agent-client.js +64 -45
  4. package/dist/browser/agent.d.ts +14 -34
  5. package/dist/browser/agent.js +67 -75
  6. package/dist/browser/database-client.js +2 -2
  7. package/dist/browser/index.d.ts +1 -0
  8. package/dist/browser/index.js +1 -0
  9. package/dist/browser/meshagent-client.d.ts +8 -1
  10. package/dist/browser/meshagent-client.js +18 -6
  11. package/dist/browser/queues-client.js +1 -1
  12. package/dist/browser/response.d.ts +14 -14
  13. package/dist/browser/response.js +42 -42
  14. package/dist/browser/room-client.d.ts +2 -2
  15. package/dist/browser/room-client.js +2 -2
  16. package/dist/browser/secrets-client.d.ts +2 -2
  17. package/dist/browser/secrets-client.js +11 -11
  18. package/dist/browser/storage-client.d.ts +2 -2
  19. package/dist/browser/tool-content-type.d.ts +13 -0
  20. package/dist/browser/tool-content-type.js +68 -0
  21. package/dist/esm/agent-client.d.ts +12 -25
  22. package/dist/esm/agent-client.js +63 -43
  23. package/dist/esm/agent.d.ts +14 -34
  24. package/dist/esm/agent.js +67 -73
  25. package/dist/esm/database-client.js +3 -3
  26. package/dist/esm/index.d.ts +1 -0
  27. package/dist/esm/index.js +1 -0
  28. package/dist/esm/meshagent-client.d.ts +8 -1
  29. package/dist/esm/meshagent-client.js +18 -6
  30. package/dist/esm/queues-client.js +2 -2
  31. package/dist/esm/response.d.ts +14 -14
  32. package/dist/esm/response.js +34 -34
  33. package/dist/esm/room-client.d.ts +2 -2
  34. package/dist/esm/room-client.js +3 -3
  35. package/dist/esm/secrets-client.d.ts +2 -2
  36. package/dist/esm/secrets-client.js +12 -12
  37. package/dist/esm/storage-client.d.ts +2 -2
  38. package/dist/esm/tool-content-type.d.ts +13 -0
  39. package/dist/esm/tool-content-type.js +64 -0
  40. package/dist/node/agent-client.d.ts +12 -25
  41. package/dist/node/agent-client.js +64 -45
  42. package/dist/node/agent.d.ts +14 -34
  43. package/dist/node/agent.js +67 -75
  44. package/dist/node/database-client.js +2 -2
  45. package/dist/node/index.d.ts +1 -0
  46. package/dist/node/index.js +1 -0
  47. package/dist/node/meshagent-client.d.ts +8 -1
  48. package/dist/node/meshagent-client.js +18 -6
  49. package/dist/node/queues-client.js +1 -1
  50. package/dist/node/response.d.ts +14 -14
  51. package/dist/node/response.js +42 -42
  52. package/dist/node/room-client.d.ts +2 -2
  53. package/dist/node/room-client.js +2 -2
  54. package/dist/node/secrets-client.d.ts +2 -2
  55. package/dist/node/secrets-client.js +11 -11
  56. package/dist/node/storage-client.d.ts +2 -2
  57. package/dist/node/tool-content-type.d.ts +13 -0
  58. package/dist/node/tool-content-type.js +68 -0
  59. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [0.28.0]
2
+ - BREAKING: AgentChatContext and TaskContext were removed from the TypeScript agent API, and RemoteTaskRunner.ask now accepts only argument payloads.
3
+
4
+ ## [0.27.2]
5
+ - Stability
6
+
7
+ ## [0.27.1]
8
+ - Stability
9
+
1
10
  ## [0.27.0]
2
11
  - No Node.js/TypeScript source changes were introduced in this range; updates are dependency-focused.
3
12
  - Updated third-party Node dev dependency `mocha` from `^11.1.0` to `^11.3.0` across SDK packages.
@@ -1,44 +1,31 @@
1
1
  import { RoomClient } from "./room-client";
2
- import { Response } from "./response";
3
- export declare class AgentDescription {
4
- readonly name: string;
5
- readonly title: string;
6
- readonly description: string;
7
- readonly outputSchema?: Record<string, any>;
8
- readonly inputSchema?: Record<string, any>;
9
- readonly labels: string[];
10
- readonly supportsTools: boolean;
11
- constructor({ name, title, description, outputSchema, inputSchema, labels, supportsTools, }: {
12
- name: string;
13
- title: string;
14
- description: string;
15
- outputSchema?: Record<string, any>;
16
- inputSchema?: Record<string, any>;
17
- labels?: string[];
18
- supportsTools: boolean;
19
- });
20
- toJson(): Record<string, any>;
21
- static fromJson(a: Record<string, any>): AgentDescription;
22
- }
2
+ import { Content } from "./response";
3
+ import { ToolContentSpec } from "./tool-content-type";
23
4
  export declare class ToolDescription {
24
5
  title: string;
25
6
  name: string;
26
7
  description: string;
27
- inputSchema: Record<string, any>;
8
+ inputSpec?: ToolContentSpec;
9
+ outputSpec?: ToolContentSpec;
28
10
  defs?: Record<string, any>;
29
11
  thumbnailUrl?: string;
30
12
  pricing?: string;
31
13
  supportsContext?: boolean;
32
- constructor({ title, name, description, inputSchema, thumbnailUrl, defs, pricing, supportsContext }: {
14
+ constructor({ title, name, description, inputSchema, inputSpec, outputSpec, outputSchema, thumbnailUrl, defs, pricing, supportsContext }: {
33
15
  title: string;
34
16
  name: string;
35
17
  description: string;
36
- inputSchema: Record<string, any>;
18
+ inputSchema?: Record<string, any>;
19
+ inputSpec?: ToolContentSpec;
20
+ outputSpec?: ToolContentSpec;
21
+ outputSchema?: Record<string, any>;
37
22
  thumbnailUrl?: string;
38
23
  defs?: Record<string, any>;
39
24
  pricing?: string;
40
25
  supportsContext?: boolean;
41
26
  });
27
+ get inputSchema(): Record<string, any> | undefined;
28
+ get outputSchema(): Record<string, any> | undefined;
42
29
  }
43
30
  export declare class ToolkitDescription {
44
31
  readonly title: string;
@@ -87,5 +74,5 @@ export declare class AgentsClient {
87
74
  toolkit: string;
88
75
  tool: string;
89
76
  arguments: Record<string, any>;
90
- }): Promise<Response>;
77
+ }): Promise<Content>;
91
78
  }
@@ -1,55 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgentsClient = exports.ToolkitConfiguration = exports.ToolkitDescription = exports.ToolDescription = exports.AgentDescription = void 0;
4
- class AgentDescription {
5
- constructor({ name, title, description, outputSchema, inputSchema, labels, supportsTools, }) {
6
- this.name = name;
7
- this.title = title;
8
- this.description = description;
9
- this.outputSchema = outputSchema;
10
- this.inputSchema = inputSchema;
11
- this.labels = Array.isArray(labels) ? labels : [];
12
- this.supportsTools = supportsTools ?? false;
13
- }
14
- toJson() {
15
- return {
16
- name: this.name,
17
- title: this.title,
18
- description: this.description,
19
- input_schema: this.inputSchema,
20
- output_schema: this.outputSchema,
21
- labels: this.labels,
22
- supports_tools: this.supportsTools,
23
- };
24
- }
25
- static fromJson(a) {
26
- let labels = [];
27
- if (Array.isArray(a["labels"])) {
28
- labels = a["labels"].filter((item) => typeof item === "string");
29
- }
30
- return new AgentDescription({
31
- name: a["name"],
32
- title: a["title"] ?? "",
33
- description: a["description"] ?? "",
34
- inputSchema: a["input_schema"] ?? undefined,
35
- outputSchema: a["output_schema"] ?? undefined,
36
- supportsTools: a["supports_tools"] === true,
37
- labels,
38
- });
39
- }
40
- }
41
- exports.AgentDescription = AgentDescription;
3
+ exports.AgentsClient = exports.ToolkitConfiguration = exports.ToolkitDescription = exports.ToolDescription = void 0;
4
+ const tool_content_type_1 = require("./tool-content-type");
42
5
  class ToolDescription {
43
- constructor({ title, name, description, inputSchema, thumbnailUrl, defs, pricing, supportsContext }) {
6
+ constructor({ title, name, description, inputSchema, inputSpec, outputSpec, outputSchema, thumbnailUrl, defs, pricing, supportsContext }) {
44
7
  this.title = title;
45
8
  this.name = name;
46
9
  this.description = description;
47
- this.inputSchema = inputSchema;
10
+ if (inputSpec !== undefined && inputSchema !== undefined) {
11
+ this.inputSpec = new tool_content_type_1.ToolContentSpec({
12
+ types: [...inputSpec.types],
13
+ stream: inputSpec.stream,
14
+ schema: inputSchema,
15
+ });
16
+ }
17
+ else if (inputSpec !== undefined) {
18
+ this.inputSpec = inputSpec;
19
+ }
20
+ else if (inputSchema !== undefined) {
21
+ this.inputSpec = new tool_content_type_1.ToolContentSpec({
22
+ types: ["json"],
23
+ stream: false,
24
+ schema: inputSchema,
25
+ });
26
+ }
27
+ if (outputSpec !== undefined && outputSchema !== undefined) {
28
+ this.outputSpec = new tool_content_type_1.ToolContentSpec({
29
+ types: [...outputSpec.types],
30
+ stream: outputSpec.stream,
31
+ schema: outputSchema,
32
+ });
33
+ }
34
+ else if (outputSpec !== undefined) {
35
+ this.outputSpec = outputSpec;
36
+ }
37
+ else if (outputSchema !== undefined) {
38
+ this.outputSpec = new tool_content_type_1.ToolContentSpec({
39
+ types: ["json"],
40
+ stream: false,
41
+ schema: outputSchema,
42
+ });
43
+ }
48
44
  this.thumbnailUrl = thumbnailUrl;
49
45
  this.defs = defs;
50
46
  this.pricing = pricing;
51
47
  this.supportsContext = supportsContext ?? false;
52
48
  }
49
+ get inputSchema() {
50
+ return this.inputSpec?.schema;
51
+ }
52
+ get outputSchema() {
53
+ return this.outputSpec?.schema;
54
+ }
53
55
  }
54
56
  exports.ToolDescription = ToolDescription;
55
57
  class ToolkitDescription {
@@ -78,9 +80,12 @@ class ToolkitDescription {
78
80
  name: tool.name,
79
81
  title: tool.title,
80
82
  description: tool.description,
81
- input_schema: tool.inputSchema,
83
+ input_spec: tool.inputSpec?.toJson(),
84
+ output_spec: tool.outputSpec?.toJson(),
82
85
  thumbnail_url: tool.thumbnailUrl,
83
86
  defs: tool.defs,
87
+ pricing: tool.pricing,
88
+ supports_context: tool.supportsContext,
84
89
  })),
85
90
  };
86
91
  }
@@ -99,10 +104,13 @@ class ToolkitDescription {
99
104
  name: tool["name"],
100
105
  description: tool["description"],
101
106
  inputSchema: tool["input_schema"],
107
+ inputSpec: tool_content_type_1.ToolContentSpec.fromJson(tool["input_spec"]),
108
+ outputSchema: tool["output_schema"],
109
+ outputSpec: tool_content_type_1.ToolContentSpec.fromJson(tool["output_spec"]),
102
110
  thumbnailUrl: tool["thumbnail_url"],
103
111
  defs: tool["defs"],
104
112
  pricing: tool["pricing"],
105
- supportsContext: tool["supportsContext"],
113
+ supportsContext: tool["supports_context"] ?? tool["supportsContext"],
106
114
  }));
107
115
  }
108
116
  }
@@ -115,10 +123,13 @@ class ToolkitDescription {
115
123
  name: toolName,
116
124
  description: tool["description"],
117
125
  inputSchema: tool["input_schema"],
126
+ inputSpec: tool_content_type_1.ToolContentSpec.fromJson(tool["input_spec"]),
127
+ outputSchema: tool["output_schema"],
128
+ outputSpec: tool_content_type_1.ToolContentSpec.fromJson(tool["output_spec"]),
118
129
  thumbnailUrl: tool["thumbnail_url"],
119
130
  defs: tool["defs"],
120
131
  pricing: tool["pricing"],
121
- supportsContext: tool["supportsContext"],
132
+ supportsContext: tool["supports_context"] ?? tool["supportsContext"],
122
133
  }));
123
134
  }
124
135
  }
@@ -185,7 +196,15 @@ class AgentsClient {
185
196
  return toolkits;
186
197
  }
187
198
  async invokeTool(params) {
188
- return await this.client.sendRequest("agent.invoke_tool", params);
199
+ const request = {
200
+ toolkit: params.toolkit,
201
+ tool: params.tool,
202
+ arguments: {
203
+ type: "json",
204
+ json: params.arguments,
205
+ },
206
+ };
207
+ return await this.client.sendRequest("agent.invoke_tool", request);
189
208
  }
190
209
  }
191
210
  exports.AgentsClient = AgentsClient;
@@ -1,47 +1,27 @@
1
1
  import { RoomClient } from "./room-client";
2
2
  import { RequiredToolkit } from "./requirement";
3
- import { Response } from "./response";
4
- export declare class AgentChatContext {
5
- messages: Array<Record<string, any>>;
6
- readonly systemRole: string;
7
- constructor({ messages, systemRole }: {
8
- messages?: Array<Record<string, any>>;
9
- systemRole?: string;
10
- });
11
- appendRules(rules: string[]): void;
12
- appendUserMessage(message: string): void;
13
- appendUserImage(url: string): void;
14
- copy(): AgentChatContext;
15
- toJson(): Record<string, any>;
16
- static fromJson(json: Record<string, any>): AgentChatContext;
17
- }
18
- export declare class TaskContext {
19
- private readonly _jwt;
20
- private readonly _chat;
21
- private readonly _apiUrl;
22
- constructor({ chat, jwt, api_url }: {
23
- chat: AgentChatContext;
24
- jwt: string;
25
- api_url: string;
26
- });
27
- get chat(): AgentChatContext;
28
- get jwt(): string;
29
- get api_url(): string;
30
- }
3
+ import { Content } from "./response";
4
+ import { ToolContentSpec } from "./tool-content-type";
31
5
  export declare abstract class Tool {
32
6
  readonly name: string;
33
7
  readonly description: string;
34
8
  readonly title: string;
35
- readonly inputSchema: Record<string, any>;
9
+ readonly inputSpec?: ToolContentSpec;
10
+ readonly outputSpec?: ToolContentSpec;
36
11
  readonly thumbnailUrl?: string;
37
- constructor({ name, description, title, inputSchema, thumbnailUrl }: {
12
+ constructor({ name, description, title, inputSchema, inputSpec, outputSpec, outputSchema, thumbnailUrl }: {
38
13
  name: string;
39
14
  description: string;
40
15
  title: string;
41
- inputSchema: Record<string, any>;
16
+ inputSchema?: Record<string, any>;
17
+ inputSpec?: ToolContentSpec;
18
+ outputSpec?: ToolContentSpec;
19
+ outputSchema?: Record<string, any>;
42
20
  thumbnailUrl?: string;
43
21
  });
44
- abstract execute(arguments_: Record<string, any>): Promise<Response>;
22
+ get inputSchema(): Record<string, any> | undefined;
23
+ get outputSchema(): Record<string, any> | undefined;
24
+ abstract execute(arguments_: Record<string, any>): Promise<Content>;
45
25
  }
46
26
  export declare abstract class Toolkit {
47
27
  readonly tools: Tool[];
@@ -52,7 +32,7 @@ export declare abstract class Toolkit {
52
32
  });
53
33
  getTool(name: string): Tool;
54
34
  getTools(): Record<string, any>;
55
- execute(name: string, args: Record<string, any>): Promise<Response>;
35
+ execute(name: string, args: Record<string, any>): Promise<Content>;
56
36
  }
57
37
  export declare abstract class RemoteToolkit extends Toolkit {
58
38
  protected readonly client: RoomClient;
@@ -96,5 +76,5 @@ export declare abstract class RemoteTaskRunner {
96
76
  });
97
77
  start(): Promise<void>;
98
78
  stop(): Promise<void>;
99
- abstract ask(context: TaskContext, arguments_: Record<string, any>): Promise<Record<string, any>>;
79
+ abstract ask(arguments_: Record<string, any>): Promise<Record<string, any>>;
100
80
  }
@@ -1,85 +1,56 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RemoteTaskRunner = exports.RemoteToolkit = exports.Toolkit = exports.Tool = exports.TaskContext = exports.AgentChatContext = void 0;
3
+ exports.RemoteTaskRunner = exports.RemoteToolkit = exports.Toolkit = exports.Tool = void 0;
4
4
  const response_1 = require("./response");
5
+ const tool_content_type_1 = require("./tool-content-type");
5
6
  const utils_1 = require("./utils");
6
- class AgentChatContext {
7
- constructor({ messages, systemRole = "system" }) {
8
- this.messages = messages ? [...messages] : [];
9
- this.systemRole = systemRole;
10
- }
11
- appendRules(rules) {
12
- let systemMessage = this.messages.find((m) => m["role"] === this.systemRole);
13
- if (!systemMessage) {
14
- systemMessage = { role: this.systemRole, content: "" };
15
- this.messages.push(systemMessage);
16
- }
17
- const plan = `
18
- Rules:
19
- -${rules.join("\n-")}
20
- `;
21
- systemMessage["content"] += plan;
22
- }
23
- appendUserMessage(message) {
24
- this.messages.push({ role: "user", content: message });
25
- }
26
- appendUserImage(url) {
27
- this.messages.push({
28
- role: "user",
29
- content: [
30
- {
31
- type: "image_url",
32
- image_url: { url: url, detail: "auto" },
33
- },
34
- ],
35
- });
36
- }
37
- copy() {
38
- const cloned = JSON.parse(JSON.stringify(this.messages));
39
- return new AgentChatContext({
40
- messages: cloned,
41
- systemRole: this.systemRole,
42
- });
43
- }
44
- toJson() {
45
- return {
46
- messages: this.messages,
47
- system_role: this.systemRole,
48
- };
49
- }
50
- static fromJson(json) {
51
- return new AgentChatContext({
52
- messages: json["messages"],
53
- systemRole: json["system_role"] || "system",
54
- });
55
- }
56
- }
57
- exports.AgentChatContext = AgentChatContext;
58
- class TaskContext {
59
- constructor({ chat, jwt, api_url }) {
60
- this._jwt = jwt;
61
- this._chat = chat;
62
- this._apiUrl = api_url;
63
- }
64
- get chat() {
65
- return this._chat;
66
- }
67
- get jwt() {
68
- return this._jwt;
69
- }
70
- get api_url() {
71
- return this._apiUrl;
72
- }
73
- }
74
- exports.TaskContext = TaskContext;
75
7
  class Tool {
76
- constructor({ name, description, title, inputSchema, thumbnailUrl }) {
8
+ constructor({ name, description, title, inputSchema, inputSpec, outputSpec, outputSchema, thumbnailUrl }) {
77
9
  this.name = name;
78
10
  this.description = description;
79
11
  this.title = title;
80
- this.inputSchema = inputSchema;
12
+ if (inputSpec !== undefined && inputSchema !== undefined) {
13
+ this.inputSpec = new tool_content_type_1.ToolContentSpec({
14
+ types: [...inputSpec.types],
15
+ stream: inputSpec.stream,
16
+ schema: inputSchema,
17
+ });
18
+ }
19
+ else if (inputSpec !== undefined) {
20
+ this.inputSpec = inputSpec;
21
+ }
22
+ else if (inputSchema !== undefined) {
23
+ this.inputSpec = new tool_content_type_1.ToolContentSpec({
24
+ types: ["json"],
25
+ stream: false,
26
+ schema: inputSchema,
27
+ });
28
+ }
29
+ if (outputSpec !== undefined && outputSchema !== undefined) {
30
+ this.outputSpec = new tool_content_type_1.ToolContentSpec({
31
+ types: [...outputSpec.types],
32
+ stream: outputSpec.stream,
33
+ schema: outputSchema,
34
+ });
35
+ }
36
+ else if (outputSpec !== undefined) {
37
+ this.outputSpec = outputSpec;
38
+ }
39
+ else if (outputSchema !== undefined) {
40
+ this.outputSpec = new tool_content_type_1.ToolContentSpec({
41
+ types: ["json"],
42
+ stream: false,
43
+ schema: outputSchema,
44
+ });
45
+ }
81
46
  this.thumbnailUrl = thumbnailUrl;
82
47
  }
48
+ get inputSchema() {
49
+ return this.inputSpec?.schema;
50
+ }
51
+ get outputSchema() {
52
+ return this.outputSpec?.schema;
53
+ }
83
54
  }
84
55
  exports.Tool = Tool;
85
56
  class Toolkit {
@@ -100,7 +71,8 @@ class Toolkit {
100
71
  json[tool.name] = {
101
72
  description: tool.description,
102
73
  title: tool.title,
103
- input_schema: tool.inputSchema,
74
+ input_spec: tool.inputSpec?.toJson(),
75
+ output_spec: tool.outputSpec?.toJson(),
104
76
  thumbnail_url: tool.thumbnailUrl,
105
77
  };
106
78
  }
@@ -150,12 +122,32 @@ class RemoteToolkit extends Toolkit {
150
122
  try {
151
123
  const [message, _] = (0, utils_1.unpackMessage)(data);
152
124
  const toolName = message["name"];
153
- const args = message["arguments"];
125
+ const rawArguments = message["arguments"];
126
+ let args;
127
+ if (rawArguments &&
128
+ typeof rawArguments === "object" &&
129
+ !Array.isArray(rawArguments) &&
130
+ "type" in rawArguments) {
131
+ const content = rawArguments;
132
+ const contentType = content["type"];
133
+ if (contentType === "json") {
134
+ args = content["json"] ?? {};
135
+ }
136
+ else if (contentType === "empty") {
137
+ args = {};
138
+ }
139
+ else {
140
+ throw new Error(`tool '${toolName}' requires JSON object input, received content type '${String(contentType)}'`);
141
+ }
142
+ }
143
+ else {
144
+ args = rawArguments ?? {};
145
+ }
154
146
  const response = await this.execute(toolName, args);
155
147
  await this.client.protocol.send("agent.tool_call_response", response.pack(), messageId);
156
148
  }
157
149
  catch (e) {
158
- const err = new response_1.ErrorResponse({ text: String(e) });
150
+ const err = new response_1.ErrorContent({ text: String(e) });
159
151
  await this.client.protocol.send("agent.tool_call_response", err.pack(), messageId);
160
152
  }
161
153
  }
@@ -69,7 +69,7 @@ class DatabaseClient {
69
69
  params,
70
70
  };
71
71
  const response = await this.room.sendRequest("database.sql", payload);
72
- if (response instanceof response_1.JsonResponse) {
72
+ if (response instanceof response_1.JsonContent) {
73
73
  if (response?.json?.results) {
74
74
  return response.json.results;
75
75
  }
@@ -100,7 +100,7 @@ class DatabaseClient {
100
100
  payload.vector = vector;
101
101
  }
102
102
  const response = await this.room.sendRequest("database.search", payload);
103
- if (response instanceof response_1.JsonResponse) {
103
+ if (response instanceof response_1.JsonContent) {
104
104
  if (response?.json?.results) {
105
105
  return response.json.results;
106
106
  }
@@ -26,4 +26,5 @@ export * from './stream-controller';
26
26
  export * from './sync-client';
27
27
  export * from './api_keys';
28
28
  export * from './helpers';
29
+ export * from './tool-content-type';
29
30
  export * from './utils';
@@ -42,4 +42,5 @@ __exportStar(require("./stream-controller"), exports);
42
42
  __exportStar(require("./sync-client"), exports);
43
43
  __exportStar(require("./api_keys"), exports);
44
44
  __exportStar(require("./helpers"), exports);
45
+ __exportStar(require("./tool-content-type"), exports);
45
46
  __exportStar(require("./utils"), exports);
@@ -30,6 +30,7 @@ export interface RoomInfo {
30
30
  id: string;
31
31
  name: string;
32
32
  metadata: Record<string, unknown>;
33
+ annotations: Record<string, string>;
33
34
  }
34
35
  export interface ProjectRoomGrant {
35
36
  room: RoomInfo;
@@ -79,6 +80,7 @@ export interface ServiceMetadata {
79
80
  }
80
81
  export interface ContainerSpec {
81
82
  command?: string | null;
83
+ working_dir?: string | null;
82
84
  image: string;
83
85
  environment?: EnvironmentVariable[] | null;
84
86
  secrets?: string[];
@@ -137,6 +139,7 @@ export interface ServiceSpec {
137
139
  export interface Mailbox {
138
140
  address: string;
139
141
  room: string;
142
+ roomId?: string;
140
143
  queue: string;
141
144
  }
142
145
  export interface Balance {
@@ -322,10 +325,14 @@ export declare class Meshagent {
322
325
  name: string;
323
326
  ifNotExists?: boolean;
324
327
  metadata?: Record<string, unknown>;
328
+ annotations?: Record<string, string>;
325
329
  permissions?: Record<string, ApiScope>;
326
330
  }): Promise<RoomInfo>;
327
331
  getRoom(projectId: string, name: string): Promise<RoomInfo>;
328
- updateRoom(projectId: string, roomId: string, name: string): Promise<void>;
332
+ updateRoom(projectId: string, roomId: string, name: string, options?: {
333
+ metadata?: Record<string, unknown>;
334
+ annotations?: Record<string, string>;
335
+ }): Promise<void>;
329
336
  deleteRoom(projectId: string, roomId: string): Promise<void>;
330
337
  connectRoom(projectId: string, room: string): Promise<RoomConnectionInfo>;
331
338
  createRoomGrant(params: {
@@ -176,7 +176,7 @@ class Meshagent {
176
176
  if (!data || typeof data !== "object") {
177
177
  throw new requirement_1.RoomException("Invalid room payload");
178
178
  }
179
- const { id, name, metadata } = data;
179
+ const { id, name, metadata, annotations } = data;
180
180
  if (typeof id !== "string" || typeof name !== "string") {
181
181
  throw new requirement_1.RoomException("Invalid room payload: missing id or name");
182
182
  }
@@ -184,6 +184,7 @@ class Meshagent {
184
184
  id,
185
185
  name,
186
186
  metadata: metadata && typeof metadata === "object" ? metadata : {},
187
+ annotations: annotations && typeof annotations === "object" ? annotations : {},
187
188
  };
188
189
  }
189
190
  parseProjectRoomGrant(data) {
@@ -710,11 +711,14 @@ class Meshagent {
710
711
  if (!item || typeof item !== "object") {
711
712
  throw new requirement_1.RoomException("Invalid mailbox payload");
712
713
  }
713
- const { address, room, queue } = item;
714
+ const { address, room, room_id, queue } = item;
714
715
  if (typeof address !== "string" || typeof room !== "string" || typeof queue !== "string") {
715
716
  throw new requirement_1.RoomException("Invalid mailbox payload: missing fields");
716
717
  }
717
- return { address, room, queue };
718
+ if (room_id !== undefined && typeof room_id !== "string") {
719
+ throw new requirement_1.RoomException("Invalid mailbox payload: invalid room_id");
720
+ }
721
+ return { address, room, roomId: room_id, queue };
718
722
  });
719
723
  }
720
724
  async deleteMailbox(projectId, address) {
@@ -839,11 +843,12 @@ class Meshagent {
839
843
  return secrets.map((item) => this.parseSecret(item));
840
844
  }
841
845
  async createRoom(params) {
842
- const { projectId, name, ifNotExists = false, metadata, permissions } = params;
846
+ const { projectId, name, ifNotExists = false, metadata, annotations, permissions } = params;
843
847
  const payload = {
844
848
  name,
845
849
  if_not_exists: Boolean(ifNotExists),
846
850
  metadata,
851
+ annotations,
847
852
  };
848
853
  if (permissions) {
849
854
  const serialized = {};
@@ -865,10 +870,17 @@ class Meshagent {
865
870
  });
866
871
  return this.parseRoom(data);
867
872
  }
868
- async updateRoom(projectId, roomId, name) {
873
+ async updateRoom(projectId, roomId, name, options = {}) {
874
+ const payload = { name };
875
+ if (options.metadata !== undefined) {
876
+ payload["metadata"] = options.metadata;
877
+ }
878
+ if (options.annotations !== undefined) {
879
+ payload["annotations"] = options.annotations;
880
+ }
869
881
  await this.request(`/accounts/projects/${projectId}/rooms/${roomId}`, {
870
882
  method: "PUT",
871
- json: { name },
883
+ json: payload,
872
884
  action: "update room",
873
885
  responseType: "void",
874
886
  });
@@ -36,7 +36,7 @@ class QueuesClient {
36
36
  create,
37
37
  wait,
38
38
  });
39
- if (response instanceof response_1.EmptyResponse) {
39
+ if (response instanceof response_1.EmptyContent) {
40
40
  return null;
41
41
  }
42
42
  else {