@venturewild/workspace 0.1.3 → 0.1.5
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 +1 -1
- package/server/src/config.mjs +13 -1
- package/server/src/service.mjs +18 -22
package/package.json
CHANGED
package/server/src/config.mjs
CHANGED
|
@@ -299,4 +299,16 @@ export function buildConfig(overrides = {}) {
|
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
// Read from package.json (the single source of truth) so the reported version
|
|
303
|
+
// can never drift from the published release — `npm version` bumps it for free.
|
|
304
|
+
// This previously hardcoded '0.1.0', so every release (0.1.1/0.1.2/0.1.3) shipped
|
|
305
|
+
// a stale version to `--version`, /api/health, doctor, and all telemetry.
|
|
306
|
+
function readAppVersion() {
|
|
307
|
+
try {
|
|
308
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../../package.json'), 'utf8'));
|
|
309
|
+
return pkg.version || '0.0.0';
|
|
310
|
+
} catch {
|
|
311
|
+
return '0.0.0';
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
export const APP_VERSION = readAppVersion();
|
package/server/src/service.mjs
CHANGED
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
//
|
|
8
8
|
// macOS (code-complete + unit-tested 2026-06-01; real-Mac reboot proof pending):
|
|
9
9
|
// writes a `~/Library/LaunchAgents/<label>.plist` (RunAtLoad + KeepAlive +
|
|
10
|
-
// ThrottleInterval)
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
10
|
+
// ThrottleInterval). Install does NOT start it now (no `launchctl bootstrap`) —
|
|
11
|
+
// launchd auto-loads the plist at the NEXT login, mirroring the Windows HKCU\Run
|
|
12
|
+
// model. (Starting it at install time would grab :5173 and collide with the
|
|
13
|
+
// `wild-workspace` the user runs this session.) Uninstall uses `launchctl bootout`
|
|
14
|
+
// to stop any instance loaded from a prior login. Runs as the user, NO admin —
|
|
15
|
+
// macOS 13+ shows a one-time "Background item added" toast + a Login Items toggle
|
|
16
|
+
// (consent, not admin). launchd provides crash-restart for free; the supervisor
|
|
17
|
+
// still owns the singleton lock + child watchdog.
|
|
15
18
|
//
|
|
16
19
|
// Linux (systemd --user) is designed but not yet implemented — it returns a clear
|
|
17
20
|
// "not yet" result so callers degrade gracefully (the user runs `wild-workspace`).
|
|
@@ -160,7 +163,7 @@ export function buildPlist({ node, cli, workspaceDir, outLog, errLog, label = LA
|
|
|
160
163
|
].join('\n');
|
|
161
164
|
}
|
|
162
165
|
|
|
163
|
-
async function macInstall({ node, cli, workspaceDir, port, version }, { dir, launchAgentsDir
|
|
166
|
+
async function macInstall({ node, cli, workspaceDir, port, version }, { dir, launchAgentsDir }) {
|
|
164
167
|
fs.mkdirSync(dir, { recursive: true });
|
|
165
168
|
fs.mkdirSync(launchAgentsDir, { recursive: true });
|
|
166
169
|
const plist = plistPath(launchAgentsDir);
|
|
@@ -173,20 +176,15 @@ async function macInstall({ node, cli, workspaceDir, port, version }, { dir, lau
|
|
|
173
176
|
JSON.stringify({ node, cli, workspaceDir, port, version, installedAt: new Date().toISOString() }, null, 2),
|
|
174
177
|
'utf8',
|
|
175
178
|
);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
//
|
|
179
|
-
// the
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
// Pre-Yosemite-style macOS without `bootstrap` — fall back to the legacy verb.
|
|
186
|
-
await execFileImpl('launchctl', ['load', '-w', plist]);
|
|
187
|
-
loadVerb = 'load';
|
|
188
|
-
}
|
|
189
|
-
return { installed: true, mechanism: 'LaunchAgent', launcher: plist, plist, label: LAUNCHD_LABEL, runValue: target, serviceJson, loadVerb };
|
|
179
|
+
// Deliberately do NOT `launchctl bootstrap` here. bootstrap + RunAtLoad would
|
|
180
|
+
// start the supervisor immediately, grabbing :5173 — then the `wild-workspace`
|
|
181
|
+
// the user runs *this session* collides on the port (createServer rejects on
|
|
182
|
+
// EADDRINUSE). Dropping the plist into ~/Library/LaunchAgents is enough:
|
|
183
|
+
// launchd auto-loads it at the NEXT login (RunAtLoad fires then). This mirrors
|
|
184
|
+
// the proven Windows HKCU\Run model, which also only fires at login — so the
|
|
185
|
+
// current session is the manual `wild-workspace`, and always-on takes over
|
|
186
|
+
// from the next login/reboot (which is also the cleanest B5 proof).
|
|
187
|
+
return { installed: true, mechanism: 'LaunchAgent', launcher: plist, plist, label: LAUNCHD_LABEL, runValue: plist, serviceJson, startsAtNextLogin: true };
|
|
190
188
|
}
|
|
191
189
|
|
|
192
190
|
async function macUninstall({ dir, launchAgentsDir, execFileImpl, killImpl, uid }) {
|
|
@@ -245,8 +243,6 @@ export async function installService(opts = {}, deps = {}) {
|
|
|
245
243
|
return macInstall(opts, {
|
|
246
244
|
dir: deps.dir || globalDir(),
|
|
247
245
|
launchAgentsDir: deps.launchAgentsDir || defaultLaunchAgentsDir(),
|
|
248
|
-
execFileImpl: deps.execFileImpl || execFileP,
|
|
249
|
-
uid: deps.uid ?? currentUid(),
|
|
250
246
|
});
|
|
251
247
|
}
|
|
252
248
|
return unsupported(platform, 'installed');
|