@portel/photon 1.8.2 → 1.8.4
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/dist/auto-ui/beam.d.ts.map +1 -1
- package/dist/auto-ui/beam.js +43 -6
- package/dist/auto-ui/beam.js.map +1 -1
- package/dist/beam.bundle.js +5 -2
- package/dist/beam.bundle.js.map +2 -2
- package/dist/marketplace-manager.d.ts +6 -0
- package/dist/marketplace-manager.d.ts.map +1 -1
- package/dist/marketplace-manager.js +91 -10
- package/dist/marketplace-manager.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beam.d.ts","sourceRoot":"","sources":["../../src/auto-ui/beam.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiyBH,wBAAsB,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"beam.d.ts","sourceRoot":"","sources":["../../src/auto-ui/beam.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiyBH,wBAAsB,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAinFlF;AAiYD;;;GAGG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAsB9C"}
|
package/dist/auto-ui/beam.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import * as http from 'http';
|
|
9
9
|
import * as net from 'net';
|
|
10
10
|
import * as fs from 'fs/promises';
|
|
11
|
-
import { existsSync, lstatSync, realpathSync, watch } from 'fs';
|
|
11
|
+
import { existsSync, lstatSync, mkdirSync, realpathSync, watch } from 'fs';
|
|
12
12
|
import * as path from 'path';
|
|
13
13
|
import * as os from 'os';
|
|
14
14
|
import { spawn } from 'child_process';
|
|
@@ -588,6 +588,9 @@ function extractCspFromSource(source) {
|
|
|
588
588
|
}
|
|
589
589
|
export async function startBeam(rawWorkingDir, port) {
|
|
590
590
|
const workingDir = path.resolve(rawWorkingDir);
|
|
591
|
+
// Show version banner immediately
|
|
592
|
+
const { PHOTON_VERSION } = await import('../version.js');
|
|
593
|
+
console.log(`\n⚡ Photon Beam v${PHOTON_VERSION}\n`);
|
|
591
594
|
// Initialize marketplace manager for photon discovery and installation
|
|
592
595
|
const marketplace = new MarketplaceManager();
|
|
593
596
|
await marketplace.initialize();
|
|
@@ -598,6 +601,16 @@ export async function startBeam(rawWorkingDir, port) {
|
|
|
598
601
|
catch (error) {
|
|
599
602
|
logger.warn(`Failed to update marketplace caches: ${getErrorMessage(error)}`);
|
|
600
603
|
}
|
|
604
|
+
// Repair missing assets from photons installed before the asset-download fix
|
|
605
|
+
try {
|
|
606
|
+
const repaired = await marketplace.repairMissingAssets(workingDir);
|
|
607
|
+
if (repaired > 0) {
|
|
608
|
+
logger.info(`Repaired assets for ${repaired} photon(s)`);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
catch (error) {
|
|
612
|
+
logger.warn(`Asset repair check failed: ${getErrorMessage(error)}`);
|
|
613
|
+
}
|
|
601
614
|
// Discover all photons (user photons + bundled photons)
|
|
602
615
|
const userPhotonList = await listPhotonMCPs(workingDir);
|
|
603
616
|
// Add bundled photons with their paths
|
|
@@ -2543,15 +2556,28 @@ export async function startBeam(rawWorkingDir, port) {
|
|
|
2543
2556
|
socket.connect(p, '127.0.0.1');
|
|
2544
2557
|
});
|
|
2545
2558
|
};
|
|
2546
|
-
// Find an available port
|
|
2559
|
+
// Find an available port (compact status line output)
|
|
2560
|
+
const isTTY = process.stderr.isTTY;
|
|
2547
2561
|
while (currentPort < port + maxPortAttempts) {
|
|
2548
2562
|
const available = await isPortAvailable(currentPort);
|
|
2549
|
-
if (available)
|
|
2563
|
+
if (available) {
|
|
2564
|
+
// Clear the status line if we printed any
|
|
2565
|
+
if (currentPort > port && isTTY) {
|
|
2566
|
+
process.stderr.write('\r\x1b[K');
|
|
2567
|
+
}
|
|
2550
2568
|
break;
|
|
2551
|
-
|
|
2569
|
+
}
|
|
2570
|
+
if (isTTY) {
|
|
2571
|
+
process.stderr.write(`\r\x1b[K⚠️ Port ${currentPort} in use, trying ${currentPort + 1}...`);
|
|
2572
|
+
}
|
|
2573
|
+
else {
|
|
2574
|
+
console.error(`⚠️ Port ${currentPort} is in use, trying ${currentPort + 1}...`);
|
|
2575
|
+
}
|
|
2552
2576
|
currentPort++;
|
|
2553
2577
|
}
|
|
2554
2578
|
if (currentPort >= port + maxPortAttempts) {
|
|
2579
|
+
if (isTTY)
|
|
2580
|
+
process.stderr.write('\n');
|
|
2555
2581
|
console.error(`\n❌ No available port found (tried ${port}-${currentPort - 1}). Exiting.\n`);
|
|
2556
2582
|
process.exit(1);
|
|
2557
2583
|
}
|
|
@@ -2560,7 +2586,12 @@ export async function startBeam(rawWorkingDir, port) {
|
|
|
2560
2586
|
server.once('error', (err) => {
|
|
2561
2587
|
if (err.code === 'EADDRINUSE' && currentPort < port + maxPortAttempts) {
|
|
2562
2588
|
currentPort++;
|
|
2563
|
-
|
|
2589
|
+
if (isTTY) {
|
|
2590
|
+
process.stderr.write(`\r\x1b[K⚠️ Port ${currentPort - 1} in use, trying ${currentPort}...`);
|
|
2591
|
+
}
|
|
2592
|
+
else {
|
|
2593
|
+
console.error(`⚠️ Port ${currentPort - 1} is in use, trying ${currentPort}...`);
|
|
2594
|
+
}
|
|
2564
2595
|
tryListen();
|
|
2565
2596
|
}
|
|
2566
2597
|
else if (err.code === 'EADDRINUSE') {
|
|
@@ -2577,7 +2608,9 @@ export async function startBeam(rawWorkingDir, port) {
|
|
|
2577
2608
|
server.listen(currentPort, bindAddress, () => {
|
|
2578
2609
|
process.env.BEAM_PORT = String(currentPort);
|
|
2579
2610
|
const url = `http://localhost:${currentPort}`;
|
|
2580
|
-
|
|
2611
|
+
if (isTTY)
|
|
2612
|
+
process.stderr.write('\r\x1b[K'); // Clear any port status line
|
|
2613
|
+
console.log(`⚡ Photon Beam → ${url} (loading photons...)\n`);
|
|
2581
2614
|
resolve();
|
|
2582
2615
|
});
|
|
2583
2616
|
// Configure server and socket timeouts to prevent premature disconnections
|
|
@@ -2749,6 +2782,10 @@ export async function startBeam(rawWorkingDir, port) {
|
|
|
2749
2782
|
// ══════════════════════════════════════════════════════════════════════════════
|
|
2750
2783
|
try {
|
|
2751
2784
|
const configDir = path.dirname(CONFIG_FILE);
|
|
2785
|
+
// Ensure directory exists before watching (fresh install may not have ~/.photon yet)
|
|
2786
|
+
if (!existsSync(configDir)) {
|
|
2787
|
+
mkdirSync(configDir, { recursive: true });
|
|
2788
|
+
}
|
|
2752
2789
|
let configDebounce = null;
|
|
2753
2790
|
const configWatcher = watch(configDir, (eventType, filename) => {
|
|
2754
2791
|
if (filename !== 'config.json')
|