@sealant/sdk 0.14.0 → 0.16.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.
@@ -189,7 +189,7 @@ export const makeWorkspace = (ctx, init) => {
189
189
  ...(ttl === undefined ? {} : { ttlSeconds: ttl === null ? null : parseTtlSeconds(ttl) }),
190
190
  }));
191
191
  },
192
- forward: (port) => openForward(ctx, init.id, port),
192
+ forward: (port, options) => openForward(ctx, init.id, port, options),
193
193
  };
194
194
  return workspace;
195
195
  };
@@ -202,11 +202,17 @@ export const makeWorkspace = (ctx, init) => {
202
202
  * upgrade with a plain HTTP status when nothing listens on the port, which
203
203
  * surfaces here as the connect rejection.
204
204
  */
205
- const openForward = (ctx, workspaceId, port) => {
205
+ const openForward = (ctx, workspaceId, port, options) => {
206
206
  const config = ctx.config;
207
207
  const url = new URL(`/v1/workspaces/${workspaceId}/forward`, config.baseUrl);
208
208
  url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
209
209
  url.searchParams.set("port", String(port));
210
+ if (options?.host !== undefined) {
211
+ url.searchParams.set("host", options.host);
212
+ }
213
+ if (options?.protocol === "udp") {
214
+ url.searchParams.set("protocol", "udp");
215
+ }
210
216
  if (config.apiKey === undefined) {
211
217
  url.searchParams.set("ownerUserId", config.hostLocal.ownerUserId);
212
218
  }
package/dist/types.d.ts CHANGED
@@ -221,13 +221,27 @@ export interface Workspace {
221
221
  readonly in?: string | null;
222
222
  }): Promise<void>;
223
223
  /**
224
- * Open a raw TCP byte pipe to `127.0.0.1:port` INSIDE the workspace — the
225
- * primitive for reaching a dev server or database the workspace runs.
226
- * Protocol-agnostic: nothing inspects or records the payload. One held
227
- * WebSocket per forward; rejects when nothing accepts the connection. The
228
- * target host is fixed at loopback by design.
224
+ * Open a raw TCP byte pipe (or a UDP datagram pipe) INSIDE the workspace — the primitive for
225
+ * reaching a dev server or database the workspace runs. Protocol-agnostic:
226
+ * nothing inspects or records the payload. One held WebSocket per forward;
227
+ * rejects when nothing accepts the connection. The target host is a CLOSED
228
+ * workspace-private set: the container's loopback (default), or `docker` —
229
+ * the workspace-scoped Docker sidecar's alias, where `docker compose`
230
+ * publishes its ports.
229
231
  */
230
- forward(port: number): Promise<WorkspaceForward>;
232
+ forward(port: number, options?: WorkspaceForwardOptions): Promise<WorkspaceForward>;
233
+ }
234
+ /** Options for {@link Workspace.forward}. */
235
+ export interface WorkspaceForwardOptions {
236
+ /** Target inside the workspace: its loopback (default) or the Docker sidecar. */
237
+ readonly host?: "127.0.0.1" | "localhost" | "docker";
238
+ /**
239
+ * Forward transport. TCP (default) is a byte stream; `"udp"` opens a
240
+ * connected UDP socket where one frame on this pipe is exactly one
241
+ * datagram, both directions. UDP has no connection handshake: opening
242
+ * succeeds even when nothing listens yet — datagrams simply drop.
243
+ */
244
+ readonly protocol?: "tcp" | "udp";
231
245
  }
232
246
  /**
233
247
  * A live port forward — one WebSocket, held until `close()` or the remote
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealant/sdk",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "The fluent public SDK for Sealant — create a workspace, run a harness, replay the record.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "@sealant/api-contracts": "^0.14.0"
29
+ "@sealant/api-contracts": "^0.16.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@effect/vitest": "4.0.0-beta.85",