@tangle-network/sandbox-ui 0.111.0 → 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.
- package/README.md +1 -1
- package/dist/{chunk-X24MVW2R.js → chunk-5M67IFVI.js} +1 -1
- package/dist/{chunk-LWSWKLI5.js → chunk-IACRDXER.js} +1 -1
- package/dist/{chunk-F7LNWZQR.js → chunk-MYZAW4RX.js} +33 -18
- package/dist/hooks.js +1 -1
- package/dist/index.js +3 -3
- package/dist/terminal.js +2 -2
- package/dist/workbench.js +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ React component library for [Tangle Sandbox](https://sandbox.tangle.tools) — a
|
|
|
16
16
|
npm install @tangle-network/sandbox-ui
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
**Required peers:** `react` and `react-dom` 18 or 19, `@tangle-network/agent-interface ^1.0.0`, `@tangle-network/brand ^1.5.0`, and `@tangle-network/ui ^11.6.0`.
|
|
19
|
+
**Required peers:** `react` and `react-dom` 18 or 19, `@tangle-network/agent-interface ^1.0.0 || ^2.0.0`, `@tangle-network/brand ^1.5.0`, and `@tangle-network/ui ^11.6.0`.
|
|
20
20
|
Optional peers are required only by the subpaths that use them; see [package.json](./package.json). `/editor` needs its tiptap, `yjs` and `@hocuspocus/provider` peers only when it renders an editor, and the `@tangle-network/ui` README holds the table of which surface needs which.
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
@@ -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
|
-
|
|
542
|
-
|
|
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
package/dist/index.js
CHANGED
|
@@ -147,7 +147,7 @@ import {
|
|
|
147
147
|
buildUnifiedPatch,
|
|
148
148
|
computeDiffStats,
|
|
149
149
|
resolveLanguage
|
|
150
|
-
} from "./chunk-
|
|
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-
|
|
235
|
+
import "./chunk-IACRDXER.js";
|
|
236
236
|
import {
|
|
237
237
|
usePtySession
|
|
238
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-MYZAW4RX.js";
|
|
239
239
|
import {
|
|
240
240
|
Avatar,
|
|
241
241
|
AvatarFallback,
|
package/dist/terminal.js
CHANGED
package/dist/workbench.js
CHANGED
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
buildUnifiedPatch,
|
|
13
13
|
computeDiffStats,
|
|
14
14
|
resolveLanguage
|
|
15
|
-
} from "./chunk-
|
|
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-
|
|
20
|
-
import "./chunk-
|
|
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.
|
|
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",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"peerDependencies": {
|
|
119
119
|
"@hocuspocus/provider": ">=2.15.0 <5.0.0",
|
|
120
120
|
"@nanostores/react": ">=0.8.4 <2.0.0",
|
|
121
|
-
"@tangle-network/agent-interface": "^1.0.0",
|
|
121
|
+
"@tangle-network/agent-interface": "^1.0.0 || ^2.0.0",
|
|
122
122
|
"@tangle-network/brand": "^1.5.0",
|
|
123
123
|
"@tangle-network/ui": "^11.6.0",
|
|
124
124
|
"@tanstack/react-query": "^5.0.0",
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
"@storybook/react": "^10.5.4",
|
|
198
198
|
"@storybook/react-vite": "^10.5.4",
|
|
199
199
|
"@tailwindcss/postcss": "^4.3.3",
|
|
200
|
-
"@tangle-network/agent-interface": "1.
|
|
200
|
+
"@tangle-network/agent-interface": "2.1.1",
|
|
201
201
|
"@tangle-network/brand": "^1.5.0",
|
|
202
202
|
"@tangle-network/ui": "^11.6.0",
|
|
203
203
|
"@tanstack/react-query": "^5.101.4",
|