@cccarv82/freya 2.0.0 → 2.0.1

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/cli/web-ui.js CHANGED
@@ -886,6 +886,12 @@
886
886
  setPill('run', 'health…');
887
887
  setOut('');
888
888
  const r = await api('/api/health', { dir: dirOrDefault() });
889
+ if (r && r.needsInit) {
890
+ setOut(r.error || 'Workspace not initialized');
891
+ setLast(null);
892
+ setPill('plan', 'needs init');
893
+ return;
894
+ }
889
895
  setOut(r.output);
890
896
  setLast(null);
891
897
  setPill('ok', 'health ok');
package/cli/web.js CHANGED
@@ -1525,12 +1525,23 @@ async function cmdWeb({ port, dir, open, dev }) {
1525
1525
  return;
1526
1526
  }
1527
1527
 
1528
+ if (req.method === 'GET' && req.url === '/favicon.ico') {
1529
+ res.writeHead(204, { 'Cache-Control': 'no-store' });
1530
+ res.end();
1531
+ return;
1532
+ }
1533
+
1528
1534
  if (req.url.startsWith('/api/')) {
1529
1535
  const raw = await readBody(req);
1530
1536
  const payload = raw ? JSON.parse(raw) : {};
1531
1537
 
1532
1538
  const requestedDir = payload.dir || dir || './freya';
1533
- const workspaceDir = normalizeWorkspaceDir(requestedDir);
1539
+ let workspaceDir;
1540
+ try {
1541
+ workspaceDir = normalizeWorkspaceDir(requestedDir);
1542
+ } catch {
1543
+ workspaceDir = path.resolve(process.cwd(), requestedDir);
1544
+ }
1534
1545
 
1535
1546
  // debug logging (always on)
1536
1547
  try {
@@ -2035,7 +2046,15 @@ async function cmdWeb({ port, dir, open, dev }) {
2035
2046
 
2036
2047
  if (req.url === '/api/init') {
2037
2048
  try {
2038
- const { output } = await initWorkspace({ targetDir: workspaceDir, force: false, forceData: false, forceLogs: false });
2049
+ const requestedInitDir = String(payload.dir || '').trim() || './freya';
2050
+ let initDir;
2051
+ try {
2052
+ initDir = normalizeWorkspaceDir(requestedInitDir);
2053
+ } catch {
2054
+ initDir = path.resolve(process.cwd(), requestedInitDir);
2055
+ }
2056
+ res.__freyaDebug.workspaceDir = initDir;
2057
+ const { output } = await initWorkspace({ targetDir: initDir, force: false, forceData: false, forceLogs: false });
2039
2058
  return safeJson(res, 200, { output: String(output || '').trim() });
2040
2059
  } catch (e) {
2041
2060
  const message = e && e.message ? e.message : String(e);
@@ -2056,6 +2075,9 @@ async function cmdWeb({ port, dir, open, dev }) {
2056
2075
  const npmCmd = guessNpmCmd();
2057
2076
 
2058
2077
  if (req.url === '/api/health') {
2078
+ if (!looksLikeFreyaWorkspace(workspaceDir)) {
2079
+ return safeJson(res, 200, { ok: false, needsInit: true, error: 'Workspace not initialized' });
2080
+ }
2059
2081
  const r = await run(npmCmd, ['run', 'health'], workspaceDir);
2060
2082
  const output = (r.stdout + r.stderr).trim();
2061
2083
  return safeJson(res, r.code === 0 ? 200 : 400, r.code === 0 ? { output } : { error: output || 'health failed', output });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cccarv82/freya",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Personal AI Assistant with local-first persistence",
5
5
  "scripts": {
6
6
  "health": "node scripts/validate-data.js",