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.
Files changed (2) hide show
  1. package/bridge.mjs +18 -10
  2. 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 room's view is the product: the shared PTY never goes below
156
- // FLOOR_COLS×FLOOR_ROWS, no matter what the host does to their local
157
- // window. Below the floor the HOST's rendering wraps oddly (the agent
158
- // keeps drawing for the floor width) the pair's view stays clean.
159
- // Pin an exact size with TP_COLS/TP_ROWS (disables host-following).
160
- const FLOOR_COLS = 100, FLOOR_ROWS = 28
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.max(process.stdout.columns || FLOOR_COLS, FLOOR_COLS),
165
- rows: PIN_ROWS || Math.max(process.stdout.rows || FLOOR_ROWS, FLOOR_ROWS),
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 : 100),
174
- rows: rows || (attached ? ad.rows : 30),
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thinkpool-pair",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Share a local coding-agent CLI (Claude Code, Codex, Gemini, Aider, …) into a ThinkPool Code room, live.",
5
5
  "type": "module",
6
6
  "bin": { "thinkpool-pair": "bridge.mjs" },