thinkpool-pair 0.3.4 → 0.3.6
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/bridge.mjs +18 -10
- package/package.json +1 -1
package/bridge.mjs
CHANGED
|
@@ -152,17 +152,25 @@ const flushAll = () => {
|
|
|
152
152
|
const flushTimer = setInterval(flushAll, 35)
|
|
153
153
|
|
|
154
154
|
// ── shared-PTY geometry ───────────────────────────────────────────
|
|
155
|
-
// The
|
|
156
|
-
//
|
|
157
|
-
//
|
|
158
|
-
//
|
|
159
|
-
//
|
|
160
|
-
|
|
155
|
+
// The attached PTY is CAPPED at 120×32, never pinned (2026-06-11).
|
|
156
|
+
// Mangling physics: a PTY *wider/taller* than the host's window forces
|
|
157
|
+
// mid-line wraps → the host's own view shreds (the 2026-06-10 pin did
|
|
158
|
+
// exactly this to any window under 120 cols). A PTY *smaller* than the
|
|
159
|
+
// window is harmless — it just leaves an empty margin. So per axis:
|
|
160
|
+
// attached = min(host TTY, 120×32)
|
|
161
|
+
// Host view is always clean (PTY ≤ window); web viewers never get
|
|
162
|
+
// microscopic text (grid ≤ 120 cols — the original reason for the pin;
|
|
163
|
+
// they render the exact grid and scale, per d78c978).
|
|
164
|
+
// TP_COLS/TP_ROWS force an exact size (you own the consequences);
|
|
165
|
+
// TP_FOLLOW=1 follows the host window uncapped (solo screen-mirror).
|
|
166
|
+
const CAP_COLS = 120, CAP_ROWS = 32
|
|
167
|
+
const FALLBACK_COLS = 100, FALLBACK_ROWS = 28 // stdout size unknown (rare)
|
|
168
|
+
const FOLLOW = process.env.TP_FOLLOW === '1'
|
|
161
169
|
const PIN_COLS = parseInt(process.env.TP_COLS, 10) || null
|
|
162
170
|
const PIN_ROWS = parseInt(process.env.TP_ROWS, 10) || null
|
|
163
171
|
const attachedDims = () => ({
|
|
164
|
-
cols: PIN_COLS || Math.
|
|
165
|
-
rows: PIN_ROWS || Math.
|
|
172
|
+
cols: PIN_COLS || (FOLLOW ? (process.stdout.columns || FALLBACK_COLS) : Math.min(process.stdout.columns || FALLBACK_COLS, CAP_COLS)),
|
|
173
|
+
rows: PIN_ROWS || (FOLLOW ? (process.stdout.rows || FALLBACK_ROWS) : Math.min(process.stdout.rows || FALLBACK_ROWS, CAP_ROWS)),
|
|
166
174
|
})
|
|
167
175
|
|
|
168
176
|
function openTerm({ id, cmd, args = [], attached = false, cols, rows }) {
|
|
@@ -170,8 +178,8 @@ function openTerm({ id, cmd, args = [], attached = false, cols, rows }) {
|
|
|
170
178
|
const ad = attached ? attachedDims() : null
|
|
171
179
|
const term = pty.spawn(cmd, args, {
|
|
172
180
|
name: 'xterm-256color',
|
|
173
|
-
cols: cols || (attached ? ad.cols :
|
|
174
|
-
rows: rows || (attached ? ad.rows :
|
|
181
|
+
cols: cols || (attached ? ad.cols : (PIN_COLS || 120)),
|
|
182
|
+
rows: rows || (attached ? ad.rows : (PIN_ROWS || 32)),
|
|
175
183
|
cwd: process.cwd(), env: process.env,
|
|
176
184
|
})
|
|
177
185
|
const entry = { term, cmd, attached, scrollback: '', buf: '' }
|
package/package.json
CHANGED