@pixelbyte-software/pixcode 1.51.6 → 1.51.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixelbyte-software/pixcode",
3
- "version": "1.51.6",
3
+ "version": "1.51.8",
4
4
  "description": "Self-hosted AI coding agent control room for Claude Code, Cursor CLI, OpenAI Codex, Gemini CLI, Qwen Code, and OpenCode with chat, files, shell, Git, orchestration, API keys, Telegram, MCP, plugins, themes, and desktop/server deployment.",
5
5
  "type": "module",
6
6
  "main": "dist-server/server/index.js",
package/server/index.js CHANGED
@@ -288,6 +288,15 @@ async function readLatestPixcodePackageMetadata() {
288
288
  };
289
289
  }
290
290
 
291
+ function isSafePackageVersion(version) {
292
+ return typeof version === 'string' && /^\d+\.\d+\.\d+(?:[-+][A-Za-z0-9.-]+)?$/.test(version.trim());
293
+ }
294
+
295
+ function buildPixcodeTarballUrl(version) {
296
+ if (!isSafePackageVersion(version)) return null;
297
+ return `https://registry.npmjs.org/@pixelbyte-software/pixcode/-/pixcode-${version.trim()}.tgz`;
298
+ }
299
+
291
300
  async function runRuntimeDirUpdateJob(job, runtimeDir, latestVersion, tarballUrl) {
292
301
  appendUpdateJobLog(job, 'meta', `Update mode: runtime-dir\nRuntime: ${runtimeDir}\n`);
293
302
  appendUpdateJobLog(job, 'meta', `Downloading ${tarballUrl}\n`);
@@ -390,7 +399,7 @@ function readCurrentPackageVersion() {
390
399
  }
391
400
  }
392
401
 
393
- function createSystemUpdateJob(actorUser) {
402
+ function createSystemUpdateJob(actorUser, options = {}) {
394
403
  const activeJob = getActiveUpdateJob();
395
404
  if (activeJob) return activeJob;
396
405
 
@@ -401,7 +410,7 @@ function createSystemUpdateJob(actorUser) {
401
410
  updatedAt: new Date().toISOString(),
402
411
  completedAt: null,
403
412
  fromVersion: SERVER_VERSION,
404
- toVersion: null,
413
+ toVersion: isSafePackageVersion(options.targetVersion) ? options.targetVersion.trim() : null,
405
414
  installMode,
406
415
  runtimeDir: process.env.PIXCODE_RUNTIME_DIR || null,
407
416
  actorUserId: actorUser?.id ?? actorUser?.userId ?? null,
@@ -422,7 +431,10 @@ function createSystemUpdateJob(actorUser) {
422
431
  appendUpdateJobLog(job, 'stderr', `Registry precheck failed: ${error.message}\n`);
423
432
  return { latestVersion: null, tarballUrl: null };
424
433
  });
425
- job.toVersion = latest.latestVersion || null;
434
+ const requestedVersion = isSafePackageVersion(options.targetVersion) ? options.targetVersion.trim() : null;
435
+ const resolvedVersion = latest.latestVersion || requestedVersion || null;
436
+ const resolvedTarballUrl = latest.tarballUrl || buildPixcodeTarballUrl(resolvedVersion);
437
+ job.toVersion = resolvedVersion;
426
438
 
427
439
  if (!IS_PLATFORM && installMode === 'npm' && latest.latestVersion && latest.latestVersion === SERVER_VERSION) {
428
440
  job.status = 'completed';
@@ -433,10 +445,13 @@ function createSystemUpdateJob(actorUser) {
433
445
  }
434
446
 
435
447
  if (runtimeDir) {
436
- if (!latest.latestVersion || !latest.tarballUrl) {
437
- throw new Error('Registry response missing latest version or tarball URL.');
448
+ if (!resolvedVersion || !resolvedTarballUrl) {
449
+ throw new Error('Registry response missing latest version or tarball URL. Try manual update or retry when registry access is available.');
450
+ }
451
+ if (!latest.latestVersion) {
452
+ appendUpdateJobLog(job, 'meta', `Using requested target version ${resolvedVersion} after registry precheck failed.\n`);
438
453
  }
439
- job.toVersion = await runRuntimeDirUpdateJob(job, runtimeDir, latest.latestVersion, latest.tarballUrl);
454
+ job.toVersion = await runRuntimeDirUpdateJob(job, runtimeDir, resolvedVersion, resolvedTarballUrl);
440
455
  } else {
441
456
  const updateCommand = IS_PLATFORM
442
457
  ? 'npm run update:platform'
@@ -1576,7 +1591,9 @@ app.get('/api/system/update-state', authenticateToken, (req, res) => {
1576
1591
  });
1577
1592
 
1578
1593
  app.post('/api/system/update-jobs', authenticateToken, requireAdmin, requireApiScope('system:update'), (req, res) => {
1579
- const job = createSystemUpdateJob(req.user);
1594
+ const job = createSystemUpdateJob(req.user, {
1595
+ targetVersion: req.body?.targetVersion || req.body?.latestVersion,
1596
+ });
1580
1597
  res.status(job.status === 'queued' ? 202 : 200).json({
1581
1598
  success: true,
1582
1599
  job: snapshotUpdateJob(job),
@@ -3750,9 +3767,17 @@ function handleShellConnection(ws, request) {
3750
3767
  }
3751
3768
  } else if (data.type === 'resize') {
3752
3769
  // Handle terminal resize
3753
- if (shellProcess && shellProcess.resize) {
3754
- console.log('Terminal resize requested:', data.cols, 'x', data.rows);
3755
- shellProcess.resize(data.cols, data.rows);
3770
+ const session = ptySessionKey ? ptySessionsMap.get(ptySessionKey) : null;
3771
+ const activePty = session?.pty || shellProcess;
3772
+ if (activePty && typeof activePty.resize === 'function' && session?.lifecycleState !== 'completed' && session?.lifecycleState !== 'failed') {
3773
+ try {
3774
+ activePty.resize(data.cols, data.rows);
3775
+ } catch (error) {
3776
+ const message = error instanceof Error ? error.message : String(error);
3777
+ if (!/already exited/i.test(message)) {
3778
+ console.warn('Terminal resize failed:', message);
3779
+ }
3780
+ }
3756
3781
  }
3757
3782
  }
3758
3783
  } catch (error) {