thinkpool-pair 0.7.4 → 0.7.5
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/account.mjs +5 -8
- package/package.json +1 -1
package/account.mjs
CHANGED
|
@@ -99,7 +99,8 @@ export async function runAccount(SUPABASE_URL, SUPABASE_ANON) {
|
|
|
99
99
|
process.exit(1)
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
process.
|
|
102
|
+
const DEFAULT_DIR = process.cwd() // unbound sessions auto-serve here; `bind` overrides per session
|
|
103
|
+
process.stderr.write(`\n ◆ thinkpool-pair — account mode · ${email}\n Auto-serving your sessions from ${DEFAULT_DIR}\n (point one at another repo: npx thinkpool-pair bind <code> <dir>)\n`)
|
|
103
104
|
|
|
104
105
|
const children = new Map() // room -> child process
|
|
105
106
|
const warned = new Set()
|
|
@@ -115,24 +116,20 @@ export async function runAccount(SUPABASE_URL, SUPABASE_ANON) {
|
|
|
115
116
|
const tick = async () => {
|
|
116
117
|
let rooms = []
|
|
117
118
|
try {
|
|
118
|
-
const { data } = await sb.from('code_sessions').select('code,name,last_active_at').order('last_active_at', { ascending: false })
|
|
119
|
+
const { data } = await sb.from('code_sessions').select('code,name,last_active_at').order('last_active_at', { ascending: false }).limit(20)
|
|
119
120
|
rooms = data || []
|
|
120
121
|
} catch { /* transient — keep existing children, retry next tick */ }
|
|
121
122
|
const dirs = loadDirs()
|
|
122
123
|
for (const r of rooms) {
|
|
123
124
|
const room = r.code
|
|
124
125
|
if (!room || children.has(room)) continue
|
|
125
|
-
const dir = dirs[room]
|
|
126
|
-
if (!dir) {
|
|
127
|
-
if (!warned.has(room)) { warned.add(room); process.stderr.write(`\n ◇ session ${r.name ? `"${r.name}" ` : ''}(${room}) needs a directory:\n npx thinkpool-pair bind ${room} <path>\n`) }
|
|
128
|
-
continue
|
|
129
|
-
}
|
|
126
|
+
const dir = dirs[room] || DEFAULT_DIR // auto-serve unbound sessions in the launch dir
|
|
130
127
|
if (!fs.existsSync(dir)) {
|
|
131
128
|
if (!warned.has(room)) { warned.add(room); process.stderr.write(`\n ◇ ${room}: bound directory is gone (${dir}) — re-bind it.\n`) }
|
|
132
129
|
continue
|
|
133
130
|
}
|
|
134
131
|
warned.delete(room)
|
|
135
|
-
process.stderr.write(`\n ◆ serving ${room}${r.name ? ` "${r.name}"` : ''} → ${dir}\n`)
|
|
132
|
+
process.stderr.write(`\n ◆ serving ${room}${r.name ? ` "${r.name}"` : ''} → ${dir}${dirs[room] ? '' : ' (default)'}\n`)
|
|
136
133
|
const child = spawn(process.execPath, [BRIDGE, room, '--headless'], { cwd: dir, stdio: 'inherit' })
|
|
137
134
|
children.set(room, child)
|
|
138
135
|
child.on('exit', () => { children.delete(room) }) // re-served on the next tick
|