@lucenaone/coder 1.1.0 → 1.1.3

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": "@lucenaone/coder",
3
- "version": "1.1.0",
3
+ "version": "1.1.3",
4
4
  "description": "Private tunnel for connecting LucenaCoder.com to your local folder. Always remains folder scoped while providing full terminal access.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/agent.js CHANGED
@@ -124,16 +124,14 @@ export class LucenaAgent {
124
124
 
125
125
  // ── Listen for browser connect events ──
126
126
  // When the browser connects, push the pre-built index immediately
127
- const connectRef = ref(this.db, `tunnels/${this.tunnelId}/meta/browserConnected`);
128
127
  onChildAdded(ref(this.db, `tunnels/${this.tunnelId}/browserConnect`), async (snapshot) => {
129
128
  const data = snapshot.val();
130
129
  if (!data) return;
131
130
  remove(snapshot.ref);
132
131
 
133
- // Wait for indexing to finish if it hasn't yet
134
- const index = await this.indexPromise;
135
- if (index) {
136
- this.pushIndexSnapshot(index);
132
+ // Index is guaranteed ready (awaited in start()), push immediately
133
+ if (this.indexData) {
134
+ this.pushIndexSnapshot(this.indexData);
137
135
  }
138
136
  });
139
137
 
@@ -152,6 +150,11 @@ export class LucenaAgent {
152
150
 
153
151
  this.startWatcher();
154
152
  this.connected = true;
153
+
154
+ // ── Wait for indexing to finish before opening the browser ──
155
+ // This guarantees the snapshot is ready the instant the browser connects
156
+ await this.indexPromise;
157
+
155
158
  return this.tunnelId;
156
159
  }
157
160
 
@@ -373,4 +376,4 @@ export class LucenaAgent {
373
376
 
374
377
  this.connected = false;
375
378
  }
376
- }
379
+ }
package/src/main.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/main.js — CLI entry point for the Lucena agent
2
2
  import { LucenaAgent } from './agent.js';
3
3
  import { basename } from 'path';
4
- import { exec } from 'child_process';
4
+
5
5
 
6
6
  // Standard ANSI Terminal Colors
7
7
  const c = {
@@ -42,8 +42,6 @@ export async function main() {
42
42
  console.log(` ${c.cyan}📍 Scoped to:${c.reset} ${cwd}`);
43
43
  console.log(` ${c.yellow}🛡️ Safe Mode:${c.reset} ON by default (All edits require approval)`);
44
44
  console.log(` ${c.dim}Optionally switch to YOLO on LucenaCoder.com${c.reset}\n`);
45
- console.log(` ${c.dim}⏳ Indexing workspace...${c.reset}`);
46
- console.log(` Starting tunnel...`);
47
45
 
48
46
  const agent = new LucenaAgent(cwd);
49
47
 
@@ -58,7 +56,7 @@ export async function main() {
58
56
 
59
57
  try {
60
58
  const tunnelId = await agent.start();
61
- console.log(`\n ${c.green}✔ Tunnel active!${c.reset}\n`);
59
+ console.log(` ${c.green}✔ Tunnel active!${c.reset}\n`);
62
60
 
63
61
  const idLabel = "Tunnel ID:";
64
62
  const boxWidth = idLabel.length + tunnelId.length + 5;
@@ -69,17 +67,19 @@ export async function main() {
69
67
  console.log(` ${c.dim}└${border}┘${c.reset}`);
70
68
 
71
69
  const webUrl = `https://lucenacoder.com/?tunnel=${tunnelId}`;
72
- console.log(`\n ${c.dim}Opening browser to your workspace...${c.reset}`);
73
70
 
74
- const startCmd = process.platform === 'darwin' ? 'open'
75
- : process.platform === 'win32' ? 'start'
76
- : 'xdg-open';
77
-
78
- exec(`${startCmd} "${webUrl}"`);
71
+ const urlLabel = "URL:";
72
+ const urlBoxWidth = urlLabel.length + webUrl.length + 5;
73
+ const urlBorder = ''.repeat(urlBoxWidth);
74
+
75
+ console.log(`\n ${c.dim}┌${urlBorder}┐${c.reset}`);
76
+ console.log(` ${c.dim}│${c.reset} ${c.dim}${urlLabel}${c.reset} ${c.cyan}${webUrl}${c.reset} ${c.dim}│${c.reset}`);
77
+ console.log(` ${c.dim}└${urlBorder}┘${c.reset}`);
79
78
 
80
- console.log(`\n ${c.dim}Press Ctrl+C to disconnect${c.reset}\n`);
79
+ console.log(`\n ${c.dim}Open the URL above in your browser to connect.${c.reset}`);
80
+ console.log(` ${c.dim}Press Ctrl+C to disconnect${c.reset}\n`);
81
81
  } catch (err) {
82
82
  console.error(`\n ${c.yellow}✖ Failed to start tunnel: ${err.message}${c.reset}\n`);
83
83
  process.exit(1);
84
84
  }
85
- }
85
+ }