@tangle-network/agent-app 0.44.59 → 0.44.60

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,24 @@ interface SandboxTerminalConnection {
8
8
  error: string | null;
9
9
  loading: boolean;
10
10
  sandboxId?: string;
11
+ connectionId?: string;
11
12
  }
12
- /** Define the response structure for a sandbox terminal connection including URLs, token, status, and errors */
13
+ /**
14
+ * Define the response structure for a sandbox terminal connection including URLs, token, status, and errors
15
+ *
16
+ * Transport-agnostic by construction (#341/#349): the browser-direct
17
+ * scoped-token route (`createSandboxTerminalConnectionRoute`,
18
+ * `src/sandbox/terminal-connection.ts`) returns `sidecarUrl` only — no
19
+ * `runtimeUrl` — while the (now `@deprecated`) same-origin proxy route
20
+ * returns both. `useSandboxTerminalConnection` below resolves
21
+ * `runtimeUrl ?? sidecarUrl` so either shape lands on the same connection
22
+ * state without a hook change.
23
+ *
24
+ * `connectionId` is the id the route's minted token's `sid` is bound to
25
+ * (echoed back from the `connectionId` the hook sent) — pass it straight
26
+ * through as `TerminalView`'s `connectionId` prop, since any other value
27
+ * fails the WS upgrade on the current platform.
28
+ */
13
29
  interface SandboxTerminalConnectionResponse {
14
30
  runtimeUrl?: string;
15
31
  sidecarUrl?: string;
@@ -18,11 +34,23 @@ interface SandboxTerminalConnectionResponse {
18
34
  status?: string;
19
35
  error?: string;
20
36
  sandboxId?: string;
37
+ connectionId?: string;
21
38
  }
22
- /** Define options for configuring a sandbox terminal connection including workspace ID and connection parameters */
39
+ /**
40
+ * Define options for configuring a sandbox terminal connection including workspace ID and connection parameters
41
+ *
42
+ * `connectionId`, when set, is passed to
43
+ * `createSandboxTerminalConnectionRoute` as the `connectionId` query
44
+ * parameter — pass `tabTerminalConnectionId()` here so the route mints a
45
+ * token whose `sid` is bound to the same id `TerminalView` will dial. Give
46
+ * `TerminalView` the response's echoed `connectionId` (not this input
47
+ * value) alongside `sidecarUrl` as `apiUrl` and `token`, since a product's
48
+ * `resolveConnectionId` seam may rewrite it server-side.
49
+ */
23
50
  interface UseSandboxTerminalConnectionOptions {
24
51
  workspaceId: string;
25
52
  connectionUrl?: string | ((workspaceId: string) => string);
53
+ connectionId?: string;
26
54
  fetcher?: typeof fetch;
27
55
  provisionPollIntervalMs?: number;
28
56
  provisionPollTimeoutMs?: number;
@@ -32,7 +60,24 @@ interface UseSandboxTerminalConnectionOptions {
32
60
  interface UseSandboxTerminalConnectionResult extends SandboxTerminalConnection {
33
61
  connect: () => Promise<void>;
34
62
  }
35
- /** Manage and maintain a sandbox terminal connection with automatic polling and token refresh handling */
63
+ /**
64
+ * Manage and maintain a sandbox terminal connection with automatic polling and token refresh handling
65
+ *
66
+ * Transport-agnostic (#341/#349): this hook does not care whether
67
+ * `connectionUrl` is backed by the fleet-default browser-direct
68
+ * scoped-token route (`createSandboxTerminalConnectionRoute`,
69
+ * `src/sandbox/terminal-connection.ts`, `sidecarUrl` only) or the
70
+ * `@deprecated` same-origin proxy route (`runtimeUrl` + `sidecarUrl`) — it
71
+ * resolves `runtimeUrl ?? sidecarUrl` either way.
72
+ *
73
+ * Pass `tabTerminalConnectionId()` as `opts.connectionId` — the hook forwards
74
+ * it as the `connectionId` query parameter the browser-direct route requires
75
+ * to mint a token whose `sid` is bound to that exact id (the orchestrator's
76
+ * terminal WS gate fails closed on any other value). Give `TerminalView` the
77
+ * RESULT's echoed `connectionId` (not the input value — a product's
78
+ * `resolveConnectionId` seam may rewrite it), the resolved `sidecarUrl`/
79
+ * `runtimeUrl` as `apiUrl`, and `token` as its token prop.
80
+ */
36
81
  declare function useSandboxTerminalConnection(opts: UseSandboxTerminalConnectionOptions): UseSandboxTerminalConnectionResult;
37
82
  /**
38
83
  * Stable-per-tab, unique-per-client terminal connection id.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  tabTerminalConnectionId,
3
3
  useSandboxTerminalConnection
4
- } from "../chunk-HCOROIRT.js";
4
+ } from "../chunk-S4YW2Y52.js";
5
5
  export {
6
6
  tabTerminalConnectionId,
7
7
  useSandboxTerminalConnection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.44.59",
3
+ "version": "0.44.60",
4
4
  "packageManager": "pnpm@11.17.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [