@tangle-network/sandbox-ui 0.111.1 → 0.111.2

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.
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-K4Q4E7D7.js";
7
7
  import {
8
8
  TerminalView
9
- } from "./chunk-LWSWKLI5.js";
9
+ } from "./chunk-IACRDXER.js";
10
10
  import {
11
11
  cn
12
12
  } from "./chunk-EI44GEQ5.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  usePtySession
3
- } from "./chunk-F7LNWZQR.js";
3
+ } from "./chunk-MYZAW4RX.js";
4
4
 
5
5
  // src/terminal/terminal-view.tsx
6
6
  import "@xterm/xterm/css/xterm.css";
@@ -83,6 +83,7 @@ function usePtySession({
83
83
  const rowsRef = useRef(DEFAULT_TERMINAL_ROWS);
84
84
  const wsRef = useRef(null);
85
85
  const pendingWsRef = useRef(null);
86
+ const geometryPendingRef = useRef(false);
86
87
  const pendingBatchRef = useRef(createEmptyBatch());
87
88
  const drainPromiseRef = useRef(null);
88
89
  const inputAbortRef = useRef(null);
@@ -133,6 +134,7 @@ function usePtySession({
133
134
  inputAbortRef.current = null;
134
135
  }
135
136
  transportReadyRef.current = false;
137
+ geometryPendingRef.current = false;
136
138
  if (sessionIdRef.current) {
137
139
  const sid = sessionIdRef.current;
138
140
  const shouldDeleteSession = shouldDeleteSessionRef.current;
@@ -231,6 +233,7 @@ function usePtySession({
231
233
  cols: colsRef.current,
232
234
  rows: rowsRef.current
233
235
  }));
236
+ geometryPendingRef.current = false;
234
237
  } catch {
235
238
  try {
236
239
  ws.close();
@@ -337,6 +340,24 @@ function usePtySession({
337
340
  };
338
341
  });
339
342
  }, [apiUrl, rejectPendingInput]);
343
+ const patchGeometry = useCallback(async (sessionId, cols, rows) => {
344
+ try {
345
+ const res = await fetch(`${apiUrl}/terminals/${sessionId}`, {
346
+ method: "PATCH",
347
+ headers: {
348
+ Authorization: `Bearer ${tokenRef.current}`,
349
+ "Content-Type": "application/json"
350
+ },
351
+ credentials: "include",
352
+ body: JSON.stringify({ cols, rows })
353
+ });
354
+ if (!res.ok) {
355
+ console.error("Failed to resize terminal:", res.status);
356
+ }
357
+ } catch (err) {
358
+ console.error("Failed to resize terminal", err);
359
+ }
360
+ }, [apiUrl]);
340
361
  const connectStream = useCallback(async (sessionId) => {
341
362
  if (exactAttachRequiredRef.current) {
342
363
  throw new Error(
@@ -364,6 +385,10 @@ function usePtySession({
364
385
  setError(null);
365
386
  retryCountRef.current = 0;
366
387
  ensureDrainRunningRef.current?.();
388
+ if (geometryPendingRef.current) {
389
+ geometryPendingRef.current = false;
390
+ void patchGeometry(sessionId, colsRef.current, rowsRef.current);
391
+ }
367
392
  }
368
393
  const reader = streamRes.body.getReader();
369
394
  const decoder = new TextDecoder();
@@ -427,7 +452,7 @@ function usePtySession({
427
452
  }
428
453
  }
429
454
  }
430
- }, [apiUrl, abortStream]);
455
+ }, [apiUrl, abortStream, patchGeometry]);
431
456
  onDataRef.current = onData;
432
457
  tokenRef.current = token;
433
458
  incarnationIdRef.current = incarnationId;
@@ -482,6 +507,7 @@ function usePtySession({
482
507
  rows: rowsRef.current
483
508
  })
484
509
  });
510
+ geometryPendingRef.current = false;
485
511
  if (!res.ok) {
486
512
  throw new Error(`Failed to create terminal: ${res.status}`);
487
513
  }
@@ -533,28 +559,17 @@ function usePtySession({
533
559
  console.warn("Terminal resize over WS failed; falling back to HTTP", err);
534
560
  }
535
561
  }
562
+ if (pendingWsRef.current) {
563
+ geometryPendingRef.current = true;
564
+ return;
565
+ }
536
566
  if (exactAttachRequiredRef.current) {
537
567
  throw new Error(
538
568
  "Interactive terminal is not attached with its exact identity"
539
569
  );
540
570
  }
541
- try {
542
- const res = await fetch(`${apiUrl}/terminals/${sid}`, {
543
- method: "PATCH",
544
- headers: {
545
- Authorization: `Bearer ${tokenRef.current}`,
546
- "Content-Type": "application/json"
547
- },
548
- credentials: "include",
549
- body: JSON.stringify({ cols, rows })
550
- });
551
- if (!res.ok) {
552
- console.error("Failed to resize terminal:", res.status);
553
- }
554
- } catch (err) {
555
- console.error("Failed to resize terminal", err);
556
- }
557
- }, [apiUrl]);
571
+ await patchGeometry(sid, cols, rows);
572
+ }, [apiUrl, patchGeometry]);
558
573
  const drainInputQueue = useCallback(async () => {
559
574
  while (pendingBatchRef.current.data.length > 0) {
560
575
  const sid = sessionIdRef.current;
package/dist/hooks.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  } from "./chunk-72UF2H5H.js";
27
27
  import {
28
28
  usePtySession
29
- } from "./chunk-F7LNWZQR.js";
29
+ } from "./chunk-MYZAW4RX.js";
30
30
  import "./chunk-CZ7CSFO4.js";
31
31
  export {
32
32
  RealtimeSessionRegistry,
package/dist/index.js CHANGED
@@ -147,7 +147,7 @@ import {
147
147
  buildUnifiedPatch,
148
148
  computeDiffStats,
149
149
  resolveLanguage
150
- } from "./chunk-X24MVW2R.js";
150
+ } from "./chunk-5M67IFVI.js";
151
151
  import {
152
152
  FileArtifactPane,
153
153
  FilePreview,
@@ -232,10 +232,10 @@ import {
232
232
  UsageChart,
233
233
  formatPrice
234
234
  } from "./chunk-OMUIPJQZ.js";
235
- import "./chunk-LWSWKLI5.js";
235
+ import "./chunk-IACRDXER.js";
236
236
  import {
237
237
  usePtySession
238
- } from "./chunk-F7LNWZQR.js";
238
+ } from "./chunk-MYZAW4RX.js";
239
239
  import {
240
240
  Avatar,
241
241
  AvatarFallback,
package/dist/terminal.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  DEFAULT_TERMINAL_THEME,
3
3
  TerminalView
4
- } from "./chunk-LWSWKLI5.js";
5
- import "./chunk-F7LNWZQR.js";
4
+ } from "./chunk-IACRDXER.js";
5
+ import "./chunk-MYZAW4RX.js";
6
6
  import "./chunk-CZ7CSFO4.js";
7
7
  export {
8
8
  DEFAULT_TERMINAL_THEME,
package/dist/workbench.js CHANGED
@@ -12,12 +12,12 @@ import {
12
12
  buildUnifiedPatch,
13
13
  computeDiffStats,
14
14
  resolveLanguage
15
- } from "./chunk-X24MVW2R.js";
15
+ } from "./chunk-5M67IFVI.js";
16
16
  import "./chunk-PZVUIUUW.js";
17
17
  import "./chunk-K4Q4E7D7.js";
18
18
  import "./chunk-OMUIPJQZ.js";
19
- import "./chunk-LWSWKLI5.js";
20
- import "./chunk-F7LNWZQR.js";
19
+ import "./chunk-IACRDXER.js";
20
+ import "./chunk-MYZAW4RX.js";
21
21
  import "./chunk-2XPJ2XF7.js";
22
22
  import "./chunk-RQZRXKMR.js";
23
23
  import "./chunk-BGVEHENC.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox-ui",
3
- "version": "0.111.1",
3
+ "version": "0.111.2",
4
4
  "description": "Unified UI component library for Tangle Sandbox — primitives, chat, dashboard, terminal, editor, and workspace components",
5
5
  "repository": {
6
6
  "type": "git",