@rstreamlabs/react 1.7.18 → 1.8.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.
package/README.md CHANGED
@@ -120,9 +120,16 @@ session.
120
120
 
121
121
  import { WebTTYTerminal } from "@rstreamlabs/react/components";
122
122
 
123
- export function Terminal({ token }: { token: string }) {
123
+ export function Terminal({
124
+ execPath,
125
+ token,
126
+ }: {
127
+ execPath?: string;
128
+ token: string;
129
+ }) {
124
130
  return (
125
131
  <WebTTYTerminal
132
+ execPath={execPath}
126
133
  url={`wss://host.example.t.rstream.io?rstream.token=${encodeURIComponent(token)}`}
127
134
  terminalOptions={{ cursorBlink: true }}
128
135
  onComplete={(exitCode) => console.log("completed", exitCode)}
@@ -134,7 +141,8 @@ export function Terminal({ token }: { token: string }) {
134
141
 
135
142
  The component loads xterm.js add-ons for fit, Unicode, web links, and WebGL
136
143
  rendering. It forwards WebTTY stdout/stderr events and keeps terminal resize
137
- state synchronized with the remote session.
144
+ state synchronized with the remote session. When the terminal comes from WebTTY
145
+ inventory, pass the advertised `exec_path` value as `execPath`.
138
146
 
139
147
  ## Security Notes
140
148
 
@@ -1,6 +1,7 @@
1
1
  // src/components/webtty.tsx
2
2
  import "@xterm/xterm/css/xterm.css";
3
3
  import { FitAddon } from "@xterm/addon-fit";
4
+ import { resolveWebTTYExecutionURL } from "@rstreamlabs/webtty";
4
5
  import { Terminal } from "@xterm/xterm";
5
6
  import { Unicode11Addon } from "@xterm/addon-unicode11";
6
7
  import { WebglAddon } from "@xterm/addon-webgl";
@@ -46,6 +47,7 @@ function WebTTYTerminal(props) {
46
47
  allocateTty,
47
48
  cmdArgs,
48
49
  envVars,
50
+ execPath,
49
51
  heartbeatIntervalMs,
50
52
  interactive,
51
53
  sendHeartbeat,
@@ -123,8 +125,9 @@ function WebTTYTerminal(props) {
123
125
  runtime.disposeOnTitleChange = terminal.onTitleChange((title) => {
124
126
  onTitleChangeEvent(title);
125
127
  });
128
+ const connectionURL = execPath === void 0 ? url : resolveWebTTYExecutionURL(url, execPath);
126
129
  const webtty = new WebTTY(
127
- { url, sendHeartbeat, heartbeatIntervalMs },
130
+ { heartbeatIntervalMs, sendHeartbeat, url: connectionURL },
128
131
  { cmdArgs, envVars, allocateTty, interactive, username, workdir },
129
132
  {
130
133
  onStdout: (chunk) => {
@@ -3,6 +3,10 @@ import { ITerminalOptions, Terminal } from '@xterm/xterm';
3
3
  import { WebTTYClientConfig, WebTTYExecutionConfig, WebTTYEvents } from '@rstreamlabs/webtty';
4
4
 
5
5
  interface WebTTYTerminalProps extends WebTTYClientConfig, WebTTYExecutionConfig, WebTTYEvents {
6
+ /**
7
+ * Advertised WebTTY execution path from inventory labels.
8
+ */
9
+ execPath?: string;
6
10
  /**
7
11
  * xterm.js TerminalOptions override
8
12
  */
@@ -3,6 +3,10 @@ import { ITerminalOptions, Terminal } from '@xterm/xterm';
3
3
  import { WebTTYClientConfig, WebTTYExecutionConfig, WebTTYEvents } from '@rstreamlabs/webtty';
4
4
 
5
5
  interface WebTTYTerminalProps extends WebTTYClientConfig, WebTTYExecutionConfig, WebTTYEvents {
6
+ /**
7
+ * Advertised WebTTY execution path from inventory labels.
8
+ */
9
+ execPath?: string;
6
10
  /**
7
11
  * xterm.js TerminalOptions override
8
12
  */
@@ -37,11 +37,12 @@ module.exports = __toCommonJS(components_exports);
37
37
  // src/components/webtty.tsx
38
38
  var import_xterm = require("@xterm/xterm/css/xterm.css");
39
39
  var import_addon_fit = require("@xterm/addon-fit");
40
+ var import_webtty = require("@rstreamlabs/webtty");
40
41
  var import_xterm2 = require("@xterm/xterm");
41
42
  var import_addon_unicode11 = require("@xterm/addon-unicode11");
42
43
  var import_addon_webgl = require("@xterm/addon-webgl");
43
44
  var import_addon_web_links = require("@xterm/addon-web-links");
44
- var import_webtty = require("@rstreamlabs/webtty");
45
+ var import_webtty2 = require("@rstreamlabs/webtty");
45
46
  var React = __toESM(require("react"));
46
47
  var import_jsx_runtime = require("react/jsx-runtime");
47
48
  function WebTTYTerminal(props) {
@@ -82,6 +83,7 @@ function WebTTYTerminal(props) {
82
83
  allocateTty,
83
84
  cmdArgs,
84
85
  envVars,
86
+ execPath,
85
87
  heartbeatIntervalMs,
86
88
  interactive,
87
89
  sendHeartbeat,
@@ -159,8 +161,9 @@ function WebTTYTerminal(props) {
159
161
  runtime.disposeOnTitleChange = terminal.onTitleChange((title) => {
160
162
  onTitleChangeEvent(title);
161
163
  });
162
- const webtty = new import_webtty.WebTTY(
163
- { url, sendHeartbeat, heartbeatIntervalMs },
164
+ const connectionURL = execPath === void 0 ? url : (0, import_webtty.resolveWebTTYExecutionURL)(url, execPath);
165
+ const webtty = new import_webtty2.WebTTY(
166
+ { heartbeatIntervalMs, sendHeartbeat, url: connectionURL },
164
167
  { cmdArgs, envVars, allocateTty, interactive, username, workdir },
165
168
  {
166
169
  onStdout: (chunk) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WebTTYTerminal
3
- } from "../chunk-5MUU3P7J.mjs";
3
+ } from "../chunk-4YJETBAE.mjs";
4
4
  export {
5
5
  WebTTYTerminal
6
6
  };
package/dist/index.js CHANGED
@@ -40,11 +40,12 @@ module.exports = __toCommonJS(src_exports);
40
40
  // src/components/webtty.tsx
41
41
  var import_xterm = require("@xterm/xterm/css/xterm.css");
42
42
  var import_addon_fit = require("@xterm/addon-fit");
43
+ var import_webtty = require("@rstreamlabs/webtty");
43
44
  var import_xterm2 = require("@xterm/xterm");
44
45
  var import_addon_unicode11 = require("@xterm/addon-unicode11");
45
46
  var import_addon_webgl = require("@xterm/addon-webgl");
46
47
  var import_addon_web_links = require("@xterm/addon-web-links");
47
- var import_webtty = require("@rstreamlabs/webtty");
48
+ var import_webtty2 = require("@rstreamlabs/webtty");
48
49
  var React = __toESM(require("react"));
49
50
  var import_jsx_runtime = require("react/jsx-runtime");
50
51
  function WebTTYTerminal(props) {
@@ -85,6 +86,7 @@ function WebTTYTerminal(props) {
85
86
  allocateTty,
86
87
  cmdArgs,
87
88
  envVars,
89
+ execPath,
88
90
  heartbeatIntervalMs,
89
91
  interactive,
90
92
  sendHeartbeat,
@@ -162,8 +164,9 @@ function WebTTYTerminal(props) {
162
164
  runtime.disposeOnTitleChange = terminal.onTitleChange((title) => {
163
165
  onTitleChangeEvent(title);
164
166
  });
165
- const webtty = new import_webtty.WebTTY(
166
- { url, sendHeartbeat, heartbeatIntervalMs },
167
+ const connectionURL = execPath === void 0 ? url : (0, import_webtty.resolveWebTTYExecutionURL)(url, execPath);
168
+ const webtty = new import_webtty2.WebTTY(
169
+ { heartbeatIntervalMs, sendHeartbeat, url: connectionURL },
167
170
  { cmdArgs, envVars, allocateTty, interactive, username, workdir },
168
171
  {
169
172
  onStdout: (chunk) => {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WebTTYTerminal
3
- } from "./chunk-5MUU3P7J.mjs";
3
+ } from "./chunk-4YJETBAE.mjs";
4
4
  import "./chunk-2JFL7TS5.mjs";
5
5
  import {
6
6
  RstreamProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstreamlabs/react",
3
- "version": "1.7.18",
3
+ "version": "1.8.0",
4
4
  "description": "React hooks and components for building rstream-enabled UIs.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -56,8 +56,8 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@rstreamlabs/rstream": "3.0.0",
59
- "@rstreamlabs/tunnels": "3.0.0",
60
- "@rstreamlabs/webtty": "1.6.5",
59
+ "@rstreamlabs/tunnels": "3.1.0",
60
+ "@rstreamlabs/webtty": "1.7.0",
61
61
  "@xterm/addon-fit": "^0.11.0",
62
62
  "@xterm/addon-unicode11": "^0.9.0",
63
63
  "@xterm/addon-web-links": "^0.12.0",