@meshagent/meshagent 0.42.0 → 0.43.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 (161) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/browser/agent-client.d.ts +4 -4
  3. package/dist/browser/agent-client.js +16 -16
  4. package/dist/browser/agent.d.ts +6 -6
  5. package/dist/browser/agent.js +57 -57
  6. package/dist/browser/api_keys.js +7 -3
  7. package/dist/browser/containers-client.d.ts +21 -3
  8. package/dist/browser/containers-client.js +126 -78
  9. package/dist/browser/datasets-client.d.ts +1 -1
  10. package/dist/browser/datasets-client.js +83 -83
  11. package/dist/browser/developer-client.d.ts +3 -3
  12. package/dist/browser/developer-client.js +11 -11
  13. package/dist/browser/document.d.ts +2 -2
  14. package/dist/browser/document.js +3 -3
  15. package/dist/browser/helpers.d.ts +4 -4
  16. package/dist/browser/helpers.js +9 -9
  17. package/dist/browser/index.d.ts +35 -35
  18. package/dist/browser/index.js +35 -35
  19. package/dist/browser/memory-client.d.ts +1 -1
  20. package/dist/browser/memory-client.js +6 -6
  21. package/dist/browser/meshagent-client.d.ts +1 -1
  22. package/dist/browser/meshagent-client.js +78 -78
  23. package/dist/browser/messaging-client.d.ts +4 -4
  24. package/dist/browser/messaging-client.js +33 -33
  25. package/dist/browser/participant-token.d.ts +1 -1
  26. package/dist/browser/participant-token.js +5 -5
  27. package/dist/browser/participant.d.ts +1 -1
  28. package/dist/browser/protocol.d.ts +7 -4
  29. package/dist/browser/protocol.js +36 -20
  30. package/dist/browser/queues-client.d.ts +1 -1
  31. package/dist/browser/queues-client.js +10 -10
  32. package/dist/browser/response.js +11 -11
  33. package/dist/browser/room-client.d.ts +23 -17
  34. package/dist/browser/room-client.js +138 -130
  35. package/dist/browser/room-server-client.d.ts +2 -2
  36. package/dist/browser/room-server-client.js +10 -10
  37. package/dist/browser/secrets-client.d.ts +3 -3
  38. package/dist/browser/secrets-client.js +30 -30
  39. package/dist/browser/services-client.d.ts +2 -2
  40. package/dist/browser/services-client.js +8 -8
  41. package/dist/browser/storage-client.d.ts +5 -5
  42. package/dist/browser/storage-client.js +30 -30
  43. package/dist/browser/sync-client.d.ts +4 -4
  44. package/dist/browser/sync-client.js +38 -38
  45. package/dist/browser/toolkit-config.d.ts +3 -3
  46. package/dist/esm/agent-client.d.ts +4 -4
  47. package/dist/esm/agent-client.js +19 -25
  48. package/dist/esm/agent.d.ts +6 -6
  49. package/dist/esm/agent.js +73 -93
  50. package/dist/esm/api_keys.js +12 -21
  51. package/dist/esm/client.js +7 -13
  52. package/dist/esm/completer.js +1 -5
  53. package/dist/esm/containers-client.d.ts +21 -3
  54. package/dist/esm/containers-client.js +132 -89
  55. package/dist/esm/datasets-client.d.ts +1 -1
  56. package/dist/esm/datasets-client.js +101 -111
  57. package/dist/esm/developer-client.d.ts +3 -3
  58. package/dist/esm/developer-client.js +11 -15
  59. package/dist/esm/document.d.ts +2 -2
  60. package/dist/esm/document.js +11 -20
  61. package/dist/esm/entrypoint.js +1 -12
  62. package/dist/esm/event-emitter.js +1 -5
  63. package/dist/esm/helpers.d.ts +4 -4
  64. package/dist/esm/helpers.js +15 -23
  65. package/dist/esm/index.d.ts +35 -35
  66. package/dist/esm/index.js +35 -51
  67. package/dist/esm/memory-client.d.ts +1 -1
  68. package/dist/esm/memory-client.js +7 -11
  69. package/dist/esm/meshagent-client.d.ts +1 -1
  70. package/dist/esm/meshagent-client.js +79 -83
  71. package/dist/esm/messaging-client.d.ts +4 -4
  72. package/dist/esm/messaging-client.js +33 -37
  73. package/dist/esm/oauth-scopes.js +2 -5
  74. package/dist/esm/participant-token.d.ts +1 -1
  75. package/dist/esm/participant-token.js +34 -62
  76. package/dist/esm/participant.d.ts +1 -1
  77. package/dist/esm/participant.js +3 -9
  78. package/dist/esm/protocol.d.ts +7 -4
  79. package/dist/esm/protocol.js +48 -46
  80. package/dist/esm/queues-client.d.ts +1 -1
  81. package/dist/esm/queues-client.js +12 -17
  82. package/dist/esm/requirement.js +4 -11
  83. package/dist/esm/response.js +22 -34
  84. package/dist/esm/room-client.d.ts +23 -17
  85. package/dist/esm/room-client.js +140 -137
  86. package/dist/esm/room-event.js +9 -21
  87. package/dist/esm/room-server-client.d.ts +2 -2
  88. package/dist/esm/room-server-client.js +13 -18
  89. package/dist/esm/runtime.js +1 -10
  90. package/dist/esm/schema.js +9 -18
  91. package/dist/esm/secrets-client.d.ts +3 -3
  92. package/dist/esm/secrets-client.js +31 -35
  93. package/dist/esm/services-client.d.ts +2 -2
  94. package/dist/esm/services-client.js +9 -13
  95. package/dist/esm/storage-client.d.ts +5 -5
  96. package/dist/esm/storage-client.js +32 -38
  97. package/dist/esm/stream-controller.js +1 -5
  98. package/dist/esm/sync-client.d.ts +4 -4
  99. package/dist/esm/sync-client.js +38 -42
  100. package/dist/esm/tool-content-type.js +1 -5
  101. package/dist/esm/toolkit-config.d.ts +3 -3
  102. package/dist/esm/toolkit-config.js +5 -13
  103. package/dist/esm/utils.js +10 -20
  104. package/dist/esm/version.js +1 -4
  105. package/dist/node/agent-client.d.ts +4 -4
  106. package/dist/node/agent-client.js +16 -16
  107. package/dist/node/agent.d.ts +6 -6
  108. package/dist/node/agent.js +57 -57
  109. package/dist/node/api_keys.js +7 -3
  110. package/dist/node/containers-client.d.ts +21 -3
  111. package/dist/node/containers-client.js +126 -78
  112. package/dist/node/datasets-client.d.ts +1 -1
  113. package/dist/node/datasets-client.js +83 -83
  114. package/dist/node/developer-client.d.ts +3 -3
  115. package/dist/node/developer-client.js +11 -11
  116. package/dist/node/document.d.ts +2 -2
  117. package/dist/node/document.js +3 -3
  118. package/dist/node/helpers.d.ts +4 -4
  119. package/dist/node/helpers.js +9 -9
  120. package/dist/node/index.d.ts +35 -35
  121. package/dist/node/index.js +35 -35
  122. package/dist/node/memory-client.d.ts +1 -1
  123. package/dist/node/memory-client.js +6 -6
  124. package/dist/node/meshagent-client.d.ts +1 -1
  125. package/dist/node/meshagent-client.js +78 -78
  126. package/dist/node/messaging-client.d.ts +4 -4
  127. package/dist/node/messaging-client.js +33 -33
  128. package/dist/node/participant-token.d.ts +1 -1
  129. package/dist/node/participant-token.js +5 -5
  130. package/dist/node/participant.d.ts +1 -1
  131. package/dist/node/protocol.d.ts +7 -4
  132. package/dist/node/protocol.js +36 -20
  133. package/dist/node/queues-client.d.ts +1 -1
  134. package/dist/node/queues-client.js +10 -10
  135. package/dist/node/response.js +11 -11
  136. package/dist/node/room-client.d.ts +23 -17
  137. package/dist/node/room-client.js +138 -130
  138. package/dist/node/room-server-client.d.ts +2 -2
  139. package/dist/node/room-server-client.js +10 -10
  140. package/dist/node/secrets-client.d.ts +3 -3
  141. package/dist/node/secrets-client.js +30 -30
  142. package/dist/node/services-client.d.ts +2 -2
  143. package/dist/node/services-client.js +8 -8
  144. package/dist/node/storage-client.d.ts +5 -5
  145. package/dist/node/storage-client.js +30 -30
  146. package/dist/node/sync-client.d.ts +4 -4
  147. package/dist/node/sync-client.js +38 -38
  148. package/dist/node/toolkit-config.d.ts +3 -3
  149. package/package.json +11 -5
  150. package/dist/browser/lk-client.d.ts +0 -18
  151. package/dist/browser/lk-client.js +0 -33
  152. package/dist/browser/lk-protocol.d.ts +0 -22
  153. package/dist/browser/lk-protocol.js +0 -37
  154. package/dist/esm/lk-client.d.ts +0 -18
  155. package/dist/esm/lk-client.js +0 -33
  156. package/dist/esm/lk-protocol.d.ts +0 -22
  157. package/dist/esm/lk-protocol.js +0 -37
  158. package/dist/node/lk-client.d.ts +0 -18
  159. package/dist/node/lk-client.js +0 -33
  160. package/dist/node/lk-protocol.d.ts +0 -22
  161. package/dist/node/lk-protocol.js +0 -37
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [0.43.0]
2
+ - Split LiveKit helpers into `@meshagent/meshagent-livekit-ts` and added `@meshagent/meshagent-node-ts` for room websocket proxying and room-connect helpers.
3
+ - Updated `meshagent-ts` exports for ESM-aware resolution, moved LiveKit out of the core package, and added `RoomClient.withIAP()` and `WebSocketClientProtocol.withIAP()` for the new room-connect flow.
4
+ - Room websocket auth now uses bearer headers on Node and `meshagent-room.` subprotocol tokens in the browser, and the agents/thread APIs now carry backend metadata and attachment-aware prompts.
5
+ - React/auth/dev/tailwind packages now publish CJS main entries alongside ESM builds, and the new LiveKit package depends on `livekit-client@^2.15.5`.
6
+
7
+ ## [0.42.2]
8
+ - Moved TypeScript LiveKit helpers into the new `@meshagent/meshagent-livekit` package so the core TypeScript SDK no longer depends on `livekit-client`.
9
+ - Added `ContainerExitStatus`, `RoomContainerStats`, and published build image metadata to the TypeScript container client models.
10
+ - Added `waitForExitStatus` while keeping `waitForExit` as the exit-code convenience wrapper.
11
+ - Container list parsing now preserves image IDs, runtime stats, and exit-status metadata from API responses.
12
+
13
+ ## [0.42.1]
14
+ - Stability
15
+
1
16
  ## [0.42.0]
2
17
  - Added project lookup by key.
3
18
  - Container and room APIs now return structured `containerPort`/`hostPort` entries instead of integer port lists, which is a breaking response-shape change.
@@ -1,7 +1,7 @@
1
- import { RoomClient } from "./room-client";
2
- import type { Content } from "./response";
3
- import { ToolInput, type ToolCallOutput } from "./agent";
4
- import { ToolContentSpec } from "./tool-content-type";
1
+ import { RoomClient } from "./room-client.js";
2
+ import type { Content } from "./response.js";
3
+ import { ToolInput, type ToolCallOutput } from "./agent.js";
4
+ import { ToolContentSpec } from "./tool-content-type.js";
5
5
  export declare class ToolDescription {
6
6
  title: string;
7
7
  name: string;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AgentsClient = exports.ToolkitDescription = exports.ToolDescription = void 0;
4
- const agent_1 = require("./agent");
5
- const tool_content_type_1 = require("./tool-content-type");
4
+ const agent_js_1 = require("./agent.js");
5
+ const tool_content_type_js_1 = require("./tool-content-type.js");
6
6
  class ToolDescription {
7
7
  constructor({ title, name, description, inputSchema, inputSpec, outputSpec, outputSchema, defs }) {
8
8
  this.title = title;
9
9
  this.name = name;
10
10
  this.description = description;
11
11
  if (inputSpec !== undefined && inputSchema !== undefined) {
12
- this.inputSpec = new tool_content_type_1.ToolContentSpec({
12
+ this.inputSpec = new tool_content_type_js_1.ToolContentSpec({
13
13
  types: [...inputSpec.types],
14
14
  stream: inputSpec.stream,
15
15
  schema: inputSchema,
@@ -19,14 +19,14 @@ class ToolDescription {
19
19
  this.inputSpec = inputSpec;
20
20
  }
21
21
  else if (inputSchema !== undefined) {
22
- this.inputSpec = new tool_content_type_1.ToolContentSpec({
22
+ this.inputSpec = new tool_content_type_js_1.ToolContentSpec({
23
23
  types: ["json"],
24
24
  stream: false,
25
25
  schema: inputSchema,
26
26
  });
27
27
  }
28
28
  if (outputSpec !== undefined && outputSchema !== undefined) {
29
- this.outputSpec = new tool_content_type_1.ToolContentSpec({
29
+ this.outputSpec = new tool_content_type_js_1.ToolContentSpec({
30
30
  types: [...outputSpec.types],
31
31
  stream: outputSpec.stream,
32
32
  schema: outputSchema,
@@ -36,7 +36,7 @@ class ToolDescription {
36
36
  this.outputSpec = outputSpec;
37
37
  }
38
38
  else if (outputSchema !== undefined) {
39
- this.outputSpec = new tool_content_type_1.ToolContentSpec({
39
+ this.outputSpec = new tool_content_type_js_1.ToolContentSpec({
40
40
  types: ["json"],
41
41
  stream: false,
42
42
  schema: outputSchema,
@@ -96,9 +96,9 @@ class ToolkitDescription {
96
96
  name: tool["name"],
97
97
  description: tool["description"],
98
98
  inputSchema: tool["input_schema"],
99
- inputSpec: tool_content_type_1.ToolContentSpec.fromJson(tool["input_spec"]),
99
+ inputSpec: tool_content_type_js_1.ToolContentSpec.fromJson(tool["input_spec"]),
100
100
  outputSchema: tool["output_schema"],
101
- outputSpec: tool_content_type_1.ToolContentSpec.fromJson(tool["output_spec"]),
101
+ outputSpec: tool_content_type_js_1.ToolContentSpec.fromJson(tool["output_spec"]),
102
102
  defs: tool["defs"],
103
103
  }));
104
104
  }
@@ -112,9 +112,9 @@ class ToolkitDescription {
112
112
  name: toolName,
113
113
  description: tool["description"],
114
114
  inputSchema: tool["input_schema"],
115
- inputSpec: tool_content_type_1.ToolContentSpec.fromJson(tool["input_spec"]),
115
+ inputSpec: tool_content_type_js_1.ToolContentSpec.fromJson(tool["input_spec"]),
116
116
  outputSchema: tool["output_schema"],
117
- outputSpec: tool_content_type_1.ToolContentSpec.fromJson(tool["output_spec"]),
117
+ outputSpec: tool_content_type_js_1.ToolContentSpec.fromJson(tool["output_spec"]),
118
118
  defs: tool["defs"],
119
119
  }));
120
120
  }
@@ -149,7 +149,7 @@ class AgentsClient {
149
149
  onBehalfOfId: params.onBehalfOfId,
150
150
  });
151
151
  }
152
- if (params.input instanceof agent_1.ToolContentInput) {
152
+ if (params.input instanceof agent_js_1.ToolContentInput) {
153
153
  const output = await this.client.invokeToolCall({
154
154
  toolkit: params.toolkit,
155
155
  tool: params.tool,
@@ -158,10 +158,10 @@ class AgentsClient {
158
158
  onBehalfOfId: params.onBehalfOfId,
159
159
  });
160
160
  return output.kind === "content"
161
- ? new agent_1.ToolContentOutput(output.content)
162
- : new agent_1.ToolStreamOutput(output.stream, { inputClosed: output.inputClosed });
161
+ ? new agent_js_1.ToolContentOutput(output.content)
162
+ : new agent_js_1.ToolStreamOutput(output.stream, { inputClosed: output.inputClosed });
163
163
  }
164
- if (params.input instanceof agent_1.ToolStreamInput) {
164
+ if (params.input instanceof agent_js_1.ToolStreamInput) {
165
165
  const output = await this.client.invokeToolCall({
166
166
  toolkit: params.toolkit,
167
167
  tool: params.tool,
@@ -171,8 +171,8 @@ class AgentsClient {
171
171
  onBehalfOfId: params.onBehalfOfId,
172
172
  });
173
173
  return output.kind === "content"
174
- ? new agent_1.ToolContentOutput(output.content)
175
- : new agent_1.ToolStreamOutput(output.stream, { inputClosed: output.inputClosed });
174
+ ? new agent_js_1.ToolContentOutput(output.content)
175
+ : new agent_js_1.ToolStreamOutput(output.stream, { inputClosed: output.inputClosed });
176
176
  }
177
177
  throw new Error("invokeTool input must be ToolContentInput or ToolStreamInput");
178
178
  }
@@ -1,9 +1,9 @@
1
- import { RoomClient } from "./room-client";
2
- import { RequiredToolkit } from "./requirement";
3
- import { type Content } from "./response";
4
- import { RoomServerException } from "./room-server-client";
5
- import { ToolContentSpec } from "./tool-content-type";
6
- import { Participant } from "./participant";
1
+ import { RoomClient } from "./room-client.js";
2
+ import { RequiredToolkit } from "./requirement.js";
3
+ import { type Content } from "./response.js";
4
+ import { RoomServerException } from "./room-server-client.js";
5
+ import { ToolContentSpec } from "./tool-content-type.js";
6
+ import { Participant } from "./participant.js";
7
7
  export type ValidationMode = "full" | "contentTypes" | "none";
8
8
  export declare class InvalidToolDataException extends RoomServerException {
9
9
  constructor(message: string);
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RemoteTaskRunner = exports.HostedToolkit = exports.Toolkit = exports.Tool = exports.ContentTool = exports.FunctionTool = exports.BaseTool = exports.ToolStreamOutput = exports.ToolContentOutput = exports.ToolCallOutput = exports.ToolStreamInput = exports.ToolContentInput = exports.ToolInput = exports.RoomToolContext = exports.ToolContext = exports.InvalidToolDataException = void 0;
4
4
  exports.startHostedToolkit = startHostedToolkit;
5
- const response_1 = require("./response");
6
- const room_server_client_1 = require("./room-server-client");
7
- const tool_content_type_1 = require("./tool-content-type");
8
- const utils_1 = require("./utils");
9
- const room_event_1 = require("./room-event");
10
- const participant_1 = require("./participant");
11
- const stream_controller_1 = require("./stream-controller");
12
- class InvalidToolDataException extends room_server_client_1.RoomServerException {
5
+ const response_js_1 = require("./response.js");
6
+ const room_server_client_js_1 = require("./room-server-client.js");
7
+ const tool_content_type_js_1 = require("./tool-content-type.js");
8
+ const utils_js_1 = require("./utils.js");
9
+ const room_event_js_1 = require("./room-event.js");
10
+ const participant_js_1 = require("./participant.js");
11
+ const stream_controller_js_1 = require("./stream-controller.js");
12
+ class InvalidToolDataException extends room_server_client_js_1.RoomServerException {
13
13
  constructor(message) {
14
14
  super(message);
15
15
  this.name = "InvalidToolDataException";
@@ -90,10 +90,10 @@ exports.ContentTool = ContentTool;
90
90
  class Tool extends BaseTool {
91
91
  constructor(params) {
92
92
  const inputSpec = params.inputSpec !== undefined && params.inputSchema !== undefined
93
- ? new tool_content_type_1.ToolContentSpec({ types: [...params.inputSpec.types], stream: params.inputSpec.stream, schema: params.inputSchema })
93
+ ? new tool_content_type_js_1.ToolContentSpec({ types: [...params.inputSpec.types], stream: params.inputSpec.stream, schema: params.inputSchema })
94
94
  : params.inputSpec;
95
95
  const outputSpec = params.outputSpec !== undefined && params.outputSchema !== undefined
96
- ? new tool_content_type_1.ToolContentSpec({ types: [...params.outputSpec.types], stream: params.outputSpec.stream, schema: params.outputSchema })
96
+ ? new tool_content_type_js_1.ToolContentSpec({ types: [...params.outputSpec.types], stream: params.outputSpec.stream, schema: params.outputSchema })
97
97
  : params.outputSpec;
98
98
  super({
99
99
  name: params.name,
@@ -101,10 +101,10 @@ class Tool extends BaseTool {
101
101
  title: params.title,
102
102
  inputSchema: params.inputSchema,
103
103
  inputSpec: inputSpec ?? (params.inputSchema !== undefined
104
- ? new tool_content_type_1.ToolContentSpec({ types: ["json"], stream: false, schema: params.inputSchema })
104
+ ? new tool_content_type_js_1.ToolContentSpec({ types: ["json"], stream: false, schema: params.inputSchema })
105
105
  : undefined),
106
106
  outputSpec: outputSpec ?? (params.outputSchema !== undefined
107
- ? new tool_content_type_1.ToolContentSpec({ types: ["json"], stream: false, schema: params.outputSchema })
107
+ ? new tool_content_type_js_1.ToolContentSpec({ types: ["json"], stream: false, schema: params.outputSchema })
108
108
  : undefined),
109
109
  outputSchema: params.outputSchema,
110
110
  defs: params.defs,
@@ -116,38 +116,38 @@ function isRecord(value) {
116
116
  return typeof value === "object" && value !== null && !Array.isArray(value);
117
117
  }
118
118
  function contentType(content) {
119
- if (content instanceof response_1.BinaryContent)
119
+ if (content instanceof response_js_1.BinaryContent)
120
120
  return "binary";
121
- if (content instanceof response_1.JsonContent)
121
+ if (content instanceof response_js_1.JsonContent)
122
122
  return "json";
123
- if (content instanceof response_1.TextContent)
123
+ if (content instanceof response_js_1.TextContent)
124
124
  return "text";
125
- if (content instanceof response_1.FileContent)
125
+ if (content instanceof response_js_1.FileContent)
126
126
  return "file";
127
- if (content instanceof response_1.LinkContent)
127
+ if (content instanceof response_js_1.LinkContent)
128
128
  return "link";
129
- if (content instanceof response_1.EmptyContent)
129
+ if (content instanceof response_js_1.EmptyContent)
130
130
  return "empty";
131
131
  return undefined;
132
132
  }
133
133
  function schemaValue(content) {
134
- if (content instanceof response_1.BinaryContent)
134
+ if (content instanceof response_js_1.BinaryContent)
135
135
  return content.headers;
136
- if (content instanceof response_1.JsonContent)
136
+ if (content instanceof response_js_1.JsonContent)
137
137
  return content.json;
138
- if (content instanceof response_1.TextContent)
138
+ if (content instanceof response_js_1.TextContent)
139
139
  return content.text;
140
- if (content instanceof response_1.EmptyContent)
140
+ if (content instanceof response_js_1.EmptyContent)
141
141
  return null;
142
- if (content instanceof response_1.LinkContent)
142
+ if (content instanceof response_js_1.LinkContent)
143
143
  return { name: content.name, url: content.url };
144
- if (content instanceof response_1.FileContent)
144
+ if (content instanceof response_js_1.FileContent)
145
145
  return { name: content.name, mime_type: content.mimeType, size: content.data.length };
146
- if (content instanceof response_1.ControlContent)
146
+ if (content instanceof response_js_1.ControlContent)
147
147
  return { method: content.method };
148
- if (content instanceof response_1.ErrorContent)
148
+ if (content instanceof response_js_1.ErrorContent)
149
149
  return content.code === undefined ? { text: content.text } : { text: content.text, code: content.code };
150
- const [header] = (0, utils_1.unpackMessage)(content.pack());
150
+ const [header] = (0, utils_js_1.unpackMessage)(content.pack());
151
151
  return header;
152
152
  }
153
153
  function schemaWithDefs(schema, defs) {
@@ -268,7 +268,7 @@ class Toolkit {
268
268
  }
269
269
  async execute(first, second, third) {
270
270
  if (typeof first === "string") {
271
- const output = await this.executeTool(new ToolContext(), first, new ToolContentInput(new response_1.JsonContent({ json: second })));
271
+ const output = await this.executeTool(new ToolContext(), first, new ToolContentInput(new response_js_1.JsonContent({ json: second })));
272
272
  if (output instanceof ToolContentOutput) {
273
273
  return output.content;
274
274
  }
@@ -297,9 +297,9 @@ class Toolkit {
297
297
  throw new Error(`tool ${name} has unsupported type`);
298
298
  }
299
299
  decodeFunctionToolArguments(toolName, input) {
300
- if (input instanceof response_1.EmptyContent)
300
+ if (input instanceof response_js_1.EmptyContent)
301
301
  return {};
302
- if (input instanceof response_1.JsonContent) {
302
+ if (input instanceof response_js_1.JsonContent) {
303
303
  if (!isRecord(input.json)) {
304
304
  throw new Error(`tool ${toolName} requires JSON object input`);
305
305
  }
@@ -318,18 +318,18 @@ class Toolkit {
318
318
  return tool.inputSpec;
319
319
  if (tool.inputSpec !== undefined)
320
320
  return tool.inputSpec;
321
- return new tool_content_type_1.ToolContentSpec({ types: ["json"], stream: false, schema: tool.inputSchema ?? { type: "object", additionalProperties: true } });
321
+ return new tool_content_type_js_1.ToolContentSpec({ types: ["json"], stream: false, schema: tool.inputSchema ?? { type: "object", additionalProperties: true } });
322
322
  }
323
323
  resolveOutputSpec(tool) {
324
324
  if (tool.outputSpec !== undefined) {
325
325
  if (tool.outputSchema !== undefined && tool.outputSpec.schema === undefined && tool.outputSpec.types.includes("json")) {
326
- return new tool_content_type_1.ToolContentSpec({ types: [...tool.outputSpec.types], stream: tool.outputSpec.stream, schema: tool.outputSchema });
326
+ return new tool_content_type_js_1.ToolContentSpec({ types: [...tool.outputSpec.types], stream: tool.outputSpec.stream, schema: tool.outputSchema });
327
327
  }
328
328
  return tool.outputSpec;
329
329
  }
330
330
  if (tool.outputSchema === undefined)
331
331
  return undefined;
332
- return new tool_content_type_1.ToolContentSpec({ types: ["json"], stream: false, schema: tool.outputSchema });
332
+ return new tool_content_type_js_1.ToolContentSpec({ types: ["json"], stream: false, schema: tool.outputSchema });
333
333
  }
334
334
  validateStreamMode({ tool, direction, spec, stream }) {
335
335
  if (!this.shouldValidateContentTypes || spec === undefined)
@@ -399,7 +399,7 @@ class _RemoteToolkitWrapper {
399
399
  }
400
400
  async start({ public_: isPublic = false } = {}) {
401
401
  if (this._started) {
402
- throw new room_server_client_1.RoomServerException(`toolkit ${this.toolkit.name} is already started`);
402
+ throw new room_server_client_js_1.RoomServerException(`toolkit ${this.toolkit.name} is already started`);
403
403
  }
404
404
  this._public = isPublic;
405
405
  this.client.protocol.addHandler(`room.tool_call.${this.toolkit.name}`, this._toolCallHandler);
@@ -425,7 +425,7 @@ class _RemoteToolkitWrapper {
425
425
  this._started = false;
426
426
  this.client.off("disconnected", this._roomEventHandler);
427
427
  this.client.off("reconnected", this._roomEventHandler);
428
- this._failActiveRequestStreams(new room_server_client_1.RoomServerException("hosted toolkit stopped"));
428
+ this._failActiveRequestStreams(new room_server_client_js_1.RoomServerException("hosted toolkit stopped"));
429
429
  try {
430
430
  await this._unregister();
431
431
  }
@@ -484,13 +484,13 @@ class _RemoteToolkitWrapper {
484
484
  });
485
485
  }
486
486
  _onRoomEvent(event) {
487
- if (!this._started || !(event instanceof room_event_1.RoomStatusEvent)) {
487
+ if (!this._started || !(event instanceof room_event_js_1.RoomStatusEvent)) {
488
488
  return;
489
489
  }
490
490
  if (event.status === "disconnected") {
491
491
  this._registrationId = undefined;
492
492
  const message = event.message?.trim();
493
- this._failActiveRequestStreams(new room_server_client_1.RoomServerException(message == null || message.length === 0
493
+ this._failActiveRequestStreams(new room_server_client_js_1.RoomServerException(message == null || message.length === 0
494
494
  ? "room connection lost before streamed tool call request completed"
495
495
  : `room connection lost before streamed tool call request completed: ${message}`));
496
496
  return;
@@ -509,16 +509,16 @@ class _RemoteToolkitWrapper {
509
509
  if (remote.id === participantId)
510
510
  return remote;
511
511
  }
512
- return new participant_1.RemoteParticipant(this.client, participantId, "user");
512
+ return new participant_js_1.RemoteParticipant(this.client, participantId, "user");
513
513
  }
514
514
  _contentFromToolCallArguments(rawArguments, payload) {
515
515
  if (!isRecord(rawArguments)) {
516
516
  throw new Error("arguments must be a content header object");
517
517
  }
518
518
  if (typeof rawArguments.type === "string") {
519
- return (0, response_1.unpackContent)((0, utils_1.packMessage)(rawArguments, payload.length > 0 ? payload : undefined));
519
+ return (0, response_js_1.unpackContent)((0, utils_js_1.packMessage)(rawArguments, payload.length > 0 ? payload : undefined));
520
520
  }
521
- return new response_1.JsonContent({ json: rawArguments });
521
+ return new response_js_1.JsonContent({ json: rawArguments });
522
522
  }
523
523
  async _sendToolCallResponse(messageId, chunk) {
524
524
  try {
@@ -531,9 +531,9 @@ class _RemoteToolkitWrapper {
531
531
  }
532
532
  }
533
533
  async _sendToolCallResponseChunk(messageId, toolCallId, chunk) {
534
- const [header, payload] = (0, utils_1.unpackMessage)(chunk.pack());
534
+ const [header, payload] = (0, utils_js_1.unpackMessage)(chunk.pack());
535
535
  try {
536
- await this.client.protocol.send("room.tool_call_response_chunk", (0, utils_1.packMessage)({ tool_call_id: toolCallId, chunk: header }, payload.length > 0 ? payload : undefined), { id: messageId });
536
+ await this.client.protocol.send("room.tool_call_response_chunk", (0, utils_js_1.packMessage)({ tool_call_id: toolCallId, chunk: header }, payload.length > 0 ? payload : undefined), { id: messageId });
537
537
  return true;
538
538
  }
539
539
  catch (error) {
@@ -553,7 +553,7 @@ class _RemoteToolkitWrapper {
553
553
  };
554
554
  }
555
555
  _enqueueRequestStreamChunk(stream, chunk, tool) {
556
- if (chunk instanceof response_1.ControlContent) {
556
+ if (chunk instanceof response_js_1.ControlContent) {
557
557
  if (chunk.method === "open")
558
558
  return;
559
559
  if (chunk.method === "close") {
@@ -582,7 +582,7 @@ class _RemoteToolkitWrapper {
582
582
  let toolCallId = toolCallIdFallback;
583
583
  let openedResponseStream = false;
584
584
  try {
585
- const [message, payload] = (0, utils_1.unpackMessage)(data);
585
+ const [message, payload] = (0, utils_js_1.unpackMessage)(data);
586
586
  const toolName = message["name"];
587
587
  if (typeof toolName !== "string" || toolName.length === 0) {
588
588
  throw new Error("tool call requires a tool name");
@@ -591,19 +591,19 @@ class _RemoteToolkitWrapper {
591
591
  ? message["tool_call_id"]
592
592
  : toolCallIdFallback;
593
593
  const inputChunk = this._contentFromToolCallArguments(message["arguments"], payload);
594
- const requestStream = inputChunk instanceof response_1.ControlContent && inputChunk.method === "open";
595
- if (inputChunk instanceof response_1.ControlContent && !requestStream) {
596
- await this._sendToolCallResponse(messageId, new response_1.ErrorContent({ text: "request stream must start with an open control chunk" }));
594
+ const requestStream = inputChunk instanceof response_js_1.ControlContent && inputChunk.method === "open";
595
+ if (inputChunk instanceof response_js_1.ControlContent && !requestStream) {
596
+ await this._sendToolCallResponse(messageId, new response_js_1.ErrorContent({ text: "request stream must start with an open control chunk" }));
597
597
  return;
598
598
  }
599
599
  const tool = this.toolkit.getTool(toolName);
600
600
  this.toolkit.validateStreamMode({ tool, direction: "input", spec: this.toolkit.resolveInputSpec(tool), stream: requestStream });
601
601
  let resolvedInput;
602
602
  if (requestStream) {
603
- const controller = new stream_controller_1.StreamController();
603
+ const controller = new stream_controller_js_1.StreamController();
604
604
  this._requestStreams.set(toolCallId, controller);
605
605
  this._requestStreamTools.set(toolCallId, tool);
606
- this._enqueueRequestStreamChunk(controller, new response_1.ControlContent({ method: "open" }), tool);
606
+ this._enqueueRequestStreamChunk(controller, new response_js_1.ControlContent({ method: "open" }), tool);
607
607
  const buffered = this._pendingRequestChunks.get(toolCallId) ?? [];
608
608
  this._pendingRequestChunks.delete(toolCallId);
609
609
  for (const chunk of buffered) {
@@ -630,29 +630,29 @@ class _RemoteToolkitWrapper {
630
630
  if (output instanceof ToolStreamOutput) {
631
631
  this.toolkit.validateStreamMode({ tool, direction: "output", spec: this.toolkit.resolveOutputSpec(tool), stream: true });
632
632
  openedResponseStream = true;
633
- if (!await this._sendToolCallResponse(messageId, new response_1.ControlContent({ method: "open" })))
633
+ if (!await this._sendToolCallResponse(messageId, new response_js_1.ControlContent({ method: "open" })))
634
634
  return;
635
635
  for await (const chunk of output.stream) {
636
636
  this.toolkit.validateOutputContent(tool, chunk);
637
637
  if (!await this._sendToolCallResponseChunk(messageId, toolCallId, chunk))
638
638
  return;
639
639
  }
640
- await this._sendToolCallResponseChunk(messageId, toolCallId, new response_1.ControlContent({ method: "close" }));
640
+ await this._sendToolCallResponseChunk(messageId, toolCallId, new response_js_1.ControlContent({ method: "close" }));
641
641
  return;
642
642
  }
643
643
  throw new Error(`tool ${toolName} returned unsupported output`);
644
644
  }
645
645
  catch (error) {
646
646
  if (!openedResponseStream) {
647
- await this._sendToolCallResponse(messageId, new response_1.ErrorContent({ text: String(error) }));
647
+ await this._sendToolCallResponse(messageId, new response_js_1.ErrorContent({ text: String(error) }));
648
648
  return;
649
649
  }
650
650
  if (!(error instanceof InvalidToolDataException)) {
651
- await this._sendToolCallResponseChunk(messageId, toolCallId, new response_1.ErrorContent({ text: String(error) }));
651
+ await this._sendToolCallResponseChunk(messageId, toolCallId, new response_js_1.ErrorContent({ text: String(error) }));
652
652
  }
653
- await this._sendToolCallResponseChunk(messageId, toolCallId, new response_1.ControlContent({
653
+ await this._sendToolCallResponseChunk(messageId, toolCallId, new response_js_1.ControlContent({
654
654
  method: "close",
655
- statusCode: error instanceof InvalidToolDataException ? response_1.ControlCloseStatus.INVALID_DATA : undefined,
655
+ statusCode: error instanceof InvalidToolDataException ? response_js_1.ControlCloseStatus.INVALID_DATA : undefined,
656
656
  message: error instanceof InvalidToolDataException ? error.message : undefined,
657
657
  }));
658
658
  }
@@ -665,14 +665,14 @@ class _RemoteToolkitWrapper {
665
665
  return;
666
666
  }
667
667
  try {
668
- const [message, payload] = (0, utils_1.unpackMessage)(data);
668
+ const [message, payload] = (0, utils_js_1.unpackMessage)(data);
669
669
  const toolCallId = message["tool_call_id"];
670
670
  if (typeof toolCallId !== "string" || toolCallId.length === 0)
671
671
  return;
672
672
  const chunkHeader = message["chunk"];
673
673
  if (!isRecord(chunkHeader))
674
674
  return;
675
- const chunk = (0, response_1.unpackContent)((0, utils_1.packMessage)(chunkHeader, payload.length > 0 ? payload : undefined));
675
+ const chunk = (0, response_js_1.unpackContent)((0, utils_js_1.packMessage)(chunkHeader, payload.length > 0 ? payload : undefined));
676
676
  const stream = this._requestStreams.get(toolCallId);
677
677
  if (stream === undefined) {
678
678
  const buffered = this._pendingRequestChunks.get(toolCallId) ?? [];
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.base36Encode = base36Encode;
4
7
  exports.base36Decode = base36Decode;
@@ -8,7 +11,8 @@ exports.base64CompressUuid = base64CompressUuid;
8
11
  exports.base64DecompressUuid = base64DecompressUuid;
9
12
  exports.parseApiKey = parseApiKey;
10
13
  exports.encodeApiKey = encodeApiKey;
11
- const base_64_1 = require("base-64");
14
+ const base_64_1 = __importDefault(require("base-64"));
15
+ const { encode: base64Encode, decode: base64Decode } = base_64_1.default;
12
16
  const BASE36_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
13
17
  const BASE36 = 36n;
14
18
  const UUID_HEX_REGEX = /^[0-9a-f]{32}$/;
@@ -95,7 +99,7 @@ function bytesToBase64(bytes) {
95
99
  if (globalScope.btoa) {
96
100
  return globalScope.btoa(binary);
97
101
  }
98
- return (0, base_64_1.encode)(binary);
102
+ return base64Encode(binary);
99
103
  }
100
104
  function base64ToBytes(base64) {
101
105
  if (globalScope.Buffer) {
@@ -107,7 +111,7 @@ function base64ToBytes(base64) {
107
111
  binary = globalScope.atob(base64);
108
112
  }
109
113
  else {
110
- binary = (0, base_64_1.decode)(base64);
114
+ binary = base64Decode(base64);
111
115
  }
112
116
  const bytes = new Uint8Array(binary.length);
113
117
  for (let i = 0; i < binary.length; i += 1) {
@@ -1,6 +1,6 @@
1
- import type { ContainerMountSpec } from "./meshagent-client";
2
- import { type Content } from "./response";
3
- import { RoomClient } from "./room-client";
1
+ import type { ContainerMountSpec } from "./meshagent-client.js";
2
+ import { type Content } from "./response.js";
3
+ import { RoomClient } from "./room-client.js";
4
4
  export interface DockerSecret {
5
5
  username: string;
6
6
  password: string;
@@ -56,15 +56,30 @@ export interface RoomContainerPort {
56
56
  containerPort: number;
57
57
  hostPort: number;
58
58
  }
59
+ export interface RoomContainerStats {
60
+ cpuUsageNanoCores?: number;
61
+ memoryUsageBytes?: number;
62
+ memoryWorkingSetBytes?: number;
63
+ timestampNs?: number;
64
+ }
59
65
  export interface RoomContainer {
60
66
  id: string;
61
67
  image: string;
68
+ imageId?: string;
62
69
  name?: string;
63
70
  ports: RoomContainerPort[];
64
71
  startedBy: ContainerParticipantInfo;
65
72
  state: string;
66
73
  private: boolean;
67
74
  serviceId?: string;
75
+ stats?: RoomContainerStats;
76
+ exitStatus?: ContainerExitStatus;
77
+ }
78
+ export interface ContainerExitStatus {
79
+ exitCode: number;
80
+ reason?: string;
81
+ message?: string;
82
+ oomKilled?: boolean;
68
83
  }
69
84
  export interface LogProgress {
70
85
  layer?: string | null;
@@ -211,6 +226,9 @@ export declare class ContainersClient {
211
226
  containerId: string;
212
227
  force?: boolean;
213
228
  }): Promise<void>;
229
+ waitForExitStatus(params: {
230
+ containerId: string;
231
+ }): Promise<ContainerExitStatus>;
214
232
  waitForExit(params: {
215
233
  containerId: string;
216
234
  }): Promise<number>;