@rubytech/taskmaster 1.0.103 → 1.0.104

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.
@@ -6,7 +6,7 @@
6
6
  <title>Taskmaster Control</title>
7
7
  <meta name="color-scheme" content="dark light" />
8
8
  <link rel="icon" type="image/png" href="./favicon.png" />
9
- <script type="module" crossorigin src="./assets/index-HzTAaV5Y.js"></script>
9
+ <script type="module" crossorigin src="./assets/index-BVS_Pain.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="./assets/index-DjhCZlZd.css">
11
11
  </head>
12
12
  <body>
@@ -95,6 +95,33 @@ async function getWifiIp() {
95
95
  }
96
96
  return null;
97
97
  }
98
+ /**
99
+ * Query wlan0 device state directly via `nmcli dev show wlan0`.
100
+ * This is more reliable than checking IN-USE in scan results, which can be stale.
101
+ */
102
+ async function getWlan0State() {
103
+ try {
104
+ const { stdout } = await runExec("nmcli", ["-t", "-f", "GENERAL.STATE,GENERAL.CONNECTION", "dev", "show", "wlan0"], { timeoutMs: 5_000 });
105
+ // Output: GENERAL.STATE:100 (connected)\nGENERAL.CONNECTION:MyWiFi
106
+ let connected = false;
107
+ let ssid = null;
108
+ for (const line of stdout.split("\n")) {
109
+ if (line.startsWith("GENERAL.STATE:")) {
110
+ // State 100 = connected, anything else = disconnected
111
+ connected = line.includes("100");
112
+ }
113
+ if (line.startsWith("GENERAL.CONNECTION:")) {
114
+ const val = line.slice("GENERAL.CONNECTION:".length).trim();
115
+ if (val && val !== "--")
116
+ ssid = val;
117
+ }
118
+ }
119
+ return { connected, ssid };
120
+ }
121
+ catch {
122
+ return { connected: false, ssid: null };
123
+ }
124
+ }
98
125
  /**
99
126
  * Find a saved WiFi connection profile managed by NetworkManager.
100
127
  * Returns { name, ssid, autoconnect } or null if none exists.
@@ -181,18 +208,30 @@ export const wifiHandlers = {
181
208
  });
182
209
  return;
183
210
  }
184
- // Check active WiFi connection
185
- const { stdout } = await runExec("nmcli", ["-t", "-f", "IN-USE,SSID,SIGNAL,SECURITY", "dev", "wifi", "list"], { timeoutMs: 10_000 });
186
- const networks = parseWifiList(stdout);
187
- const active = networks.find((n) => n.active);
188
- const ip = active ? await getWifiIp() : null;
211
+ // Query wlan0 device state directly — more reliable than scan results
212
+ // which can be stale right after connecting.
213
+ const deviceState = await getWlan0State();
214
+ const ip = deviceState.connected ? await getWifiIp() : null;
215
+ // Get signal strength from scan results (non-blocking, may be stale)
216
+ let signal = null;
217
+ if (deviceState.connected && deviceState.ssid) {
218
+ try {
219
+ const { stdout } = await runExec("nmcli", ["-t", "-f", "IN-USE,SSID,SIGNAL,SECURITY", "dev", "wifi", "list"], { timeoutMs: 5_000 });
220
+ const networks = parseWifiList(stdout);
221
+ const active = networks.find((n) => n.active);
222
+ signal = active?.signal ?? null;
223
+ }
224
+ catch {
225
+ // Non-critical — signal strength is cosmetic
226
+ }
227
+ }
189
228
  // Check for saved connection profile
190
229
  const saved = await getSavedWifiConnection();
191
230
  respond(true, {
192
231
  available: true,
193
- connected: !!active,
194
- ssid: active?.ssid ?? null,
195
- signal: active?.signal ?? null,
232
+ connected: deviceState.connected,
233
+ ssid: deviceState.ssid,
234
+ signal,
196
235
  ip,
197
236
  savedSsid: saved?.ssid ?? null,
198
237
  autoconnect: saved?.autoconnect ?? false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubytech/taskmaster",
3
- "version": "1.0.103",
3
+ "version": "1.0.104",
4
4
  "description": "AI-powered business assistant for small businesses",
5
5
  "publishConfig": {
6
6
  "access": "public"