quilltap 4.4.0-dev.226 → 4.4.0-dev.239

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/bin/quilltap.js +35 -0
  2. package/package.json +2 -1
package/bin/quilltap.js CHANGED
@@ -169,6 +169,19 @@ function ensureNativeModules() {
169
169
  }
170
170
  }
171
171
 
172
+ // Check node-pty: backs the Ariel terminal feature. Loaded dynamically by
173
+ // pty-manager in the standalone server, so resolution must succeed and the
174
+ // native binding's NODE_MODULE_VERSION must match the runtime.
175
+ try {
176
+ require('node-pty');
177
+ } catch (err) {
178
+ if (err.message && err.message.includes('NODE_MODULE_VERSION')) {
179
+ needsRebuild.push('node-pty');
180
+ } else if (err.code === 'MODULE_NOT_FOUND') {
181
+ needsRebuild.push('node-pty');
182
+ }
183
+ }
184
+
172
185
  if (needsRebuild.length === 0) return;
173
186
 
174
187
  console.log(` Rebuilding native modules for Node.js ${process.version}...`);
@@ -238,6 +251,28 @@ function linkNativeModules(standaloneDir) {
238
251
  || resolveModuleDir('better-sqlite3');
239
252
  linkModule('better-sqlite3', betterSqlite3Dir);
240
253
 
254
+ // Link node-pty — the standalone tarball strips it (platform-specific),
255
+ // and pty-manager loads it via a dynamic require, so it needs to resolve
256
+ // from standaloneDir/node_modules.
257
+ const nodePtyDir = resolveModuleDir('node-pty');
258
+ linkModule('node-pty', nodePtyDir);
259
+ if (nodePtyDir) {
260
+ // Some npm cache extractions strip the executable bit on spawn-helper,
261
+ // causing pty.spawn() to fail with `posix_spawnp failed`. Restore it.
262
+ const prebuildsDir = path.join(nodePtyDir, 'prebuilds');
263
+ if (fs.existsSync(prebuildsDir)) {
264
+ try {
265
+ for (const entry of fs.readdirSync(prebuildsDir, { withFileTypes: true })) {
266
+ if (!entry.isDirectory()) continue;
267
+ const helper = path.join(prebuildsDir, entry.name, 'spawn-helper');
268
+ if (fs.existsSync(helper)) {
269
+ try { fs.chmodSync(helper, 0o755); } catch { /* best-effort */ }
270
+ }
271
+ }
272
+ } catch { /* best-effort */ }
273
+ }
274
+ }
275
+
241
276
  // Link sharp
242
277
  const sharpDir = resolveModuleDir('sharp');
243
278
  linkModule('sharp', sharpDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quilltap",
3
- "version": "4.4.0-dev.226",
3
+ "version": "4.4.0-dev.239",
4
4
  "description": "Self-hosted AI workspace for writers, worldbuilders, and roleplayers. Run with npx quilltap.",
5
5
  "author": {
6
6
  "name": "Charles Sebold",
@@ -35,6 +35,7 @@
35
35
  "dependencies": {
36
36
  "@napi-rs/canvas": "^0.1.100",
37
37
  "better-sqlite3-multiple-ciphers": "^12.9.0",
38
+ "node-pty": "^1.1.0",
38
39
  "sharp": "^0.34.5",
39
40
  "tar": "^7.5.15",
40
41
  "yauzl": "^3.3.0"