airloom 0.1.7 → 0.1.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/dist/index.js +24 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1053,6 +1053,7 @@ function createHostServer(opts) {
|
|
|
1053
1053
|
pairingQR: opts.state.pairingQR,
|
|
1054
1054
|
relayUrl: opts.state.relayUrl,
|
|
1055
1055
|
adapter: opts.state.adapter ? { name: opts.state.adapter.name, model: opts.state.adapter.model } : null,
|
|
1056
|
+
terminalLaunch: opts.state.terminalLaunch,
|
|
1056
1057
|
messages: opts.state.messages
|
|
1057
1058
|
});
|
|
1058
1059
|
});
|
|
@@ -1260,6 +1261,7 @@ var HOST_HTML = `<!DOCTYPE html>
|
|
|
1260
1261
|
</div>
|
|
1261
1262
|
<div class="card">
|
|
1262
1263
|
<div class="status"><div class="dot wait" id="dot"></div><span id="statusText">Initializing...</span></div>
|
|
1264
|
+
<p style="color:#888;font-size:.9rem;margin-top:8px" id="launchText">Launch: current shell</p>
|
|
1263
1265
|
</div>
|
|
1264
1266
|
<div class="card" id="configCard">
|
|
1265
1267
|
<h2>AI Configuration</h2>
|
|
@@ -1340,6 +1342,7 @@ ws.onmessage=e=>{
|
|
|
1340
1342
|
else if(d.type==='peer_disconnected'){document.getElementById('dot').className='dot wait';document.getElementById('statusText').textContent='Phone disconnected'}
|
|
1341
1343
|
};
|
|
1342
1344
|
fetch('/api/status').then(r=>r.json()).then(d=>{
|
|
1345
|
+
if(d.terminalLaunch) document.getElementById('launchText').textContent='Launch: '+d.terminalLaunch;
|
|
1343
1346
|
if(d.pairingCode){document.getElementById('pairingCard').style.display='';document.getElementById('pairingCode').textContent=d.pairingCode;if(d.pairingQR)document.getElementById('qrCode').src=d.pairingQR}
|
|
1344
1347
|
if(d.connected){document.getElementById('dot').className='dot on';document.getElementById('statusText').textContent='Phone connected';document.getElementById('chatCard').style.display=''}
|
|
1345
1348
|
else{document.getElementById('dot').className='dot wait';document.getElementById('statusText').textContent='Waiting for phone...'}
|
|
@@ -1384,8 +1387,8 @@ function parseCommand(command) {
|
|
|
1384
1387
|
args: parts.slice(1).map((part) => part.replace(/^"|"$/g, ""))
|
|
1385
1388
|
};
|
|
1386
1389
|
}
|
|
1387
|
-
function getDefaultTerminalCommand() {
|
|
1388
|
-
const configured = process.env.AIRLOOM_TERMINAL_COMMAND?.trim();
|
|
1390
|
+
function getDefaultTerminalCommand(explicitCommand) {
|
|
1391
|
+
const configured = explicitCommand?.trim() || process.env.AIRLOOM_TERMINAL_COMMAND?.trim();
|
|
1389
1392
|
if (configured) return parseCommand(configured);
|
|
1390
1393
|
if (process.platform === "win32") {
|
|
1391
1394
|
const file = process.env.COMSPEC || "powershell.exe";
|
|
@@ -1442,9 +1445,14 @@ var AdaptiveOutputBatcher = class {
|
|
|
1442
1445
|
this.timer = setTimeout(() => this.flush(), recentInput ? this.fastInterval : this.slowInterval);
|
|
1443
1446
|
}
|
|
1444
1447
|
};
|
|
1448
|
+
function getTerminalLaunchDisplay(explicitCommand) {
|
|
1449
|
+
const command = getDefaultTerminalCommand(explicitCommand);
|
|
1450
|
+
return [command.file, ...command.args].join(" ");
|
|
1451
|
+
}
|
|
1445
1452
|
var TerminalSession = class {
|
|
1446
|
-
constructor(channel) {
|
|
1453
|
+
constructor(channel, launchCommand) {
|
|
1447
1454
|
this.channel = channel;
|
|
1455
|
+
this.launchCommand = launchCommand;
|
|
1448
1456
|
}
|
|
1449
1457
|
pty = null;
|
|
1450
1458
|
stream = null;
|
|
@@ -1487,7 +1495,7 @@ var TerminalSession = class {
|
|
|
1487
1495
|
this.pty.resize(this.cols, this.rows);
|
|
1488
1496
|
return;
|
|
1489
1497
|
}
|
|
1490
|
-
const command = getDefaultTerminalCommand();
|
|
1498
|
+
const command = getDefaultTerminalCommand(this.launchCommand);
|
|
1491
1499
|
const file = resolveExecutable2(command.file) ?? command.file;
|
|
1492
1500
|
const meta = { kind: "terminal", cols: this.cols, rows: this.rows };
|
|
1493
1501
|
this.stream = this.channel.createStream(meta);
|
|
@@ -1665,6 +1673,13 @@ async function main() {
|
|
|
1665
1673
|
});
|
|
1666
1674
|
await channel.connect(session.sessionToken);
|
|
1667
1675
|
console.log("[host] Connected to relay, waiting for phone...");
|
|
1676
|
+
const launchPreset = cliArgs.preset ? CLI_PRESETS.find((p) => p.id === cliArgs.preset) : void 0;
|
|
1677
|
+
if (cliArgs.preset && !launchPreset) {
|
|
1678
|
+
console.error(`[host] Unknown preset "${cliArgs.preset}". Available: ${CLI_PRESETS.map((p) => p.id).join(", ")}`);
|
|
1679
|
+
process.exit(1);
|
|
1680
|
+
}
|
|
1681
|
+
const launchCommand = cliArgs.cli ?? launchPreset?.command;
|
|
1682
|
+
const terminalLaunch = getTerminalLaunchDisplay(launchCommand);
|
|
1668
1683
|
const state = {
|
|
1669
1684
|
channel,
|
|
1670
1685
|
adapter: null,
|
|
@@ -1673,19 +1688,14 @@ async function main() {
|
|
|
1673
1688
|
// set after server starts
|
|
1674
1689
|
relayUrl: useAbly ? "ably" : RELAY_URL,
|
|
1675
1690
|
connected: false,
|
|
1691
|
+
terminalLaunch,
|
|
1676
1692
|
messages: []
|
|
1677
1693
|
};
|
|
1694
|
+
console.log(`[host] Terminal launch: ${terminalLaunch}`);
|
|
1678
1695
|
if (cliArgs.cli || cliArgs.preset) {
|
|
1679
1696
|
let command = cliArgs.cli;
|
|
1680
|
-
|
|
1681
|
-
if (
|
|
1682
|
-
presetInfo = CLI_PRESETS.find((p) => p.id === cliArgs.preset);
|
|
1683
|
-
if (!presetInfo) {
|
|
1684
|
-
console.error(`[host] Unknown preset "${cliArgs.preset}". Available: ${CLI_PRESETS.map((p) => p.id).join(", ")}`);
|
|
1685
|
-
process.exit(1);
|
|
1686
|
-
}
|
|
1687
|
-
if (!command) command = presetInfo.command;
|
|
1688
|
-
}
|
|
1697
|
+
const presetInfo = launchPreset;
|
|
1698
|
+
if (presetInfo && !command) command = presetInfo.command;
|
|
1689
1699
|
if (command) {
|
|
1690
1700
|
state.adapter = new CLIAdapter({
|
|
1691
1701
|
command,
|
|
@@ -1769,7 +1779,7 @@ async function main() {
|
|
|
1769
1779
|
exec(`${cmd} ${localUrl}`);
|
|
1770
1780
|
}).catch(() => {
|
|
1771
1781
|
});
|
|
1772
|
-
const terminal = new TerminalSession(channel);
|
|
1782
|
+
const terminal = new TerminalSession(channel, launchCommand);
|
|
1773
1783
|
channel.on("ready", () => {
|
|
1774
1784
|
console.log("[host] Phone connected! Channel ready.");
|
|
1775
1785
|
state.connected = true;
|