@karmaniverous/jeeves-server 3.3.1 → 3.4.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.
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <meta name="robots" content="noindex, nofollow" />
8
8
  <title>Jeeves Server</title>
9
- <script type="module" crossorigin src="/app/assets/index-Bk4tUE4j.js"></script>
9
+ <script type="module" crossorigin src="/app/assets/index-jSGuHSeS.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/app/assets/index-D-RC7ZS6.css">
11
11
  </head>
12
12
  <body>
@@ -13,7 +13,6 @@ import { rawRoutes } from './raw.js';
13
13
  import { runnerRoutes } from './runner.js';
14
14
  import { searchRoutes } from './search.js';
15
15
  import { sharingRoutes } from './sharing.js';
16
- import { statusRoutes } from './status.js';
17
16
  export const apiRoute = async (fastify) => {
18
17
  // Add auth hook directly to this context (not as a child plugin)
19
18
  // so it applies to all routes registered below.
@@ -29,5 +28,4 @@ export const apiRoute = async (fastify) => {
29
28
  await fastify.register(searchRoutes);
30
29
  await fastify.register(sharingRoutes);
31
30
  await fastify.register(authStatusRoutes);
32
- await fastify.register(statusRoutes);
33
31
  };
@@ -30,9 +30,6 @@ export const runnerRoutes = async (fastify) => {
30
30
  return reply.code(403).send({ error: 'Insider access required' });
31
31
  }
32
32
  });
33
- fastify.get('/api/runner/health', async (_req, reply) => {
34
- await proxyToRunner(reply, '/health');
35
- });
36
33
  fastify.get('/api/runner/jobs', async (_req, reply) => {
37
34
  await proxyToRunner(reply, '/jobs');
38
35
  });
@@ -53,7 +50,7 @@ export const runnerRoutes = async (fastify) => {
53
50
  fastify.post('/api/runner/jobs/:id/disable', async (req, reply) => {
54
51
  await proxyToRunner(reply, `/jobs/${encodeURIComponent(req.params.id)}/disable`, 'POST');
55
52
  });
56
- fastify.get('/api/runner/stats', async (_req, reply) => {
57
- await proxyToRunner(reply, '/stats');
53
+ fastify.get('/api/runner/status', async (_req, reply) => {
54
+ await proxyToRunner(reply, '/status');
58
55
  });
59
56
  };
@@ -4,9 +4,9 @@
4
4
  * Returns version, uptime, port, connected services reachability,
5
5
  * event schemas, insider count (no PII), and export capabilities.
6
6
  */
7
- import { getConfig } from '../../config/index.js';
8
- import { getRecentEvents } from '../../services/eventLog.js';
9
- import { packageVersion } from '../../util/packageVersion.js';
7
+ import { getConfig } from '../config/index.js';
8
+ import { getRecentEvents } from '../services/eventLog.js';
9
+ import { packageVersion } from '../util/packageVersion.js';
10
10
  const startTime = Date.now();
11
11
  async function checkService(url) {
12
12
  // Try /status first (watcher), then /health (runner)
@@ -28,7 +28,7 @@ async function checkService(url) {
28
28
  }
29
29
  // eslint-disable-next-line @typescript-eslint/require-await
30
30
  export const statusRoutes = async (fastify) => {
31
- fastify.get('/api/status', async (request) => {
31
+ fastify.get('/status', async (request) => {
32
32
  const config = getConfig();
33
33
  const [watcher, runner, meta] = await Promise.all([
34
34
  config.watcherUrl ? checkService(config.watcherUrl) : null,
@@ -21,12 +21,12 @@ const mockConfig = {
21
21
  metaUrl: null,
22
22
  exportFormats: ['pdf', 'docx', 'zip'],
23
23
  };
24
- vi.mock('../../config/index.js', () => ({
24
+ vi.mock('../config/index.js', () => ({
25
25
  getConfig: () => mockConfig,
26
26
  }));
27
27
  // Must import AFTER mock
28
28
  const { statusRoutes } = await import('./status.js');
29
- describe('GET /api/status', () => {
29
+ describe('GET /status', () => {
30
30
  it('returns structured status', async () => {
31
31
  // Create a minimal Fastify-like test harness
32
32
  const routes = {};
@@ -36,7 +36,7 @@ describe('GET /api/status', () => {
36
36
  },
37
37
  };
38
38
  await statusRoutes(fakeFastify, {});
39
- const handler = routes['/api/status'];
39
+ const handler = routes['/status'];
40
40
  expect(handler).toBeDefined();
41
41
  const result = await handler({ accessMode: 'insider', query: {} });
42
42
  const status = result;
@@ -13,10 +13,10 @@ import { apiRoute } from './routes/api/index.js';
13
13
  import { authRoute } from './routes/auth.js';
14
14
  import { registerConfigRoute } from './routes/config.js';
15
15
  import { eventRoute } from './routes/event.js';
16
- import { healthRoute } from './routes/health.js';
17
16
  import { keysRoute } from './routes/keys.js';
18
17
  import { pathRoute } from './routes/path/index.js';
19
18
  import { staticRoutes } from './routes/static.js';
19
+ import { statusRoutes } from './routes/status.js';
20
20
  import { initDiagramCache } from './services/diagramCache.js';
21
21
  import { startQueueProcessor } from './services/eventQueue.js';
22
22
  import { initExportCache } from './services/exportCache.js';
@@ -35,8 +35,8 @@ async function start() {
35
35
  });
36
36
  // Register routes
37
37
  await fastify.register(staticRoutes);
38
- await fastify.register(healthRoute);
39
38
  registerConfigRoute(fastify);
39
+ await fastify.register(statusRoutes);
40
40
  await fastify.register(authRoute);
41
41
  await fastify.register(keysRoute);
42
42
  await fastify.register(eventRoute);
@@ -79,7 +79,7 @@ async function start() {
79
79
  console.log(` GET /api/export/* - PDF/DOCX/ZIP export`);
80
80
  console.log(` POST /event - Event Gateway (key auth)`);
81
81
  console.log(` GET /key - Compute path key (X-API-Key auth)`);
82
- console.log(` GET /health - Health check (no auth)`);
82
+ console.log(` GET /status - Server status (no auth)`);
83
83
  }
84
84
  catch (err) {
85
85
  console.error('Fatal startup error:', err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karmaniverous/jeeves-server",
3
- "version": "3.3.1",
3
+ "version": "3.4.1",
4
4
  "description": "Secure file browser, markdown viewer, and webhook gateway with PDF/DOCX export and expiring share links",
5
5
  "keywords": [
6
6
  "fastify",
@@ -47,9 +47,9 @@
47
47
  "license": "MIT",
48
48
  "dependencies": {
49
49
  "@commander-js/extra-typings": "^14.0.0",
50
- "@karmaniverous/jeeves": "^0.2.0",
51
50
  "@fastify/cookie": "^11.0.2",
52
51
  "@fastify/static": "^8.3.0",
52
+ "@karmaniverous/jeeves": "^0.3.0",
53
53
  "@karmaniverous/jsonmap": "^0.3.1",
54
54
  "@mermaid-js/mermaid-cli": "^11.12.0",
55
55
  "@turbodocx/html-to-docx": "^1.1.0",
@@ -16,8 +16,6 @@ import { rawRoutes } from './raw.js';
16
16
  import { runnerRoutes } from './runner.js';
17
17
  import { searchRoutes } from './search.js';
18
18
  import { sharingRoutes } from './sharing.js';
19
- import { statusRoutes } from './status.js';
20
-
21
19
  export const apiRoute: FastifyPluginAsync = async (fastify) => {
22
20
  // Add auth hook directly to this context (not as a child plugin)
23
21
  // so it applies to all routes registered below.
@@ -33,5 +31,4 @@ export const apiRoute: FastifyPluginAsync = async (fastify) => {
33
31
  await fastify.register(searchRoutes);
34
32
  await fastify.register(sharingRoutes);
35
33
  await fastify.register(authStatusRoutes);
36
- await fastify.register(statusRoutes);
37
34
  };
@@ -44,10 +44,6 @@ export const runnerRoutes: FastifyPluginAsync = async (fastify) => {
44
44
  }
45
45
  });
46
46
 
47
- fastify.get('/api/runner/health', async (_req, reply) => {
48
- await proxyToRunner(reply, '/health');
49
- });
50
-
51
47
  fastify.get('/api/runner/jobs', async (_req, reply) => {
52
48
  await proxyToRunner(reply, '/jobs');
53
49
  });
@@ -101,7 +97,7 @@ export const runnerRoutes: FastifyPluginAsync = async (fastify) => {
101
97
  },
102
98
  );
103
99
 
104
- fastify.get('/api/runner/stats', async (_req, reply) => {
105
- await proxyToRunner(reply, '/stats');
100
+ fastify.get('/api/runner/status', async (_req, reply) => {
101
+ await proxyToRunner(reply, '/status');
106
102
  });
107
103
  };
@@ -23,14 +23,14 @@ const mockConfig = {
23
23
  exportFormats: ['pdf', 'docx', 'zip'],
24
24
  };
25
25
 
26
- vi.mock('../../config/index.js', () => ({
26
+ vi.mock('../config/index.js', () => ({
27
27
  getConfig: () => mockConfig,
28
28
  }));
29
29
 
30
30
  // Must import AFTER mock
31
31
  const { statusRoutes } = await import('./status.js');
32
32
 
33
- describe('GET /api/status', () => {
33
+ describe('GET /status', () => {
34
34
  it('returns structured status', async () => {
35
35
  // Create a minimal Fastify-like test harness
36
36
  const routes: Record<string, (req: unknown) => Promise<unknown>> = {};
@@ -42,7 +42,7 @@ describe('GET /api/status', () => {
42
42
 
43
43
  await statusRoutes(fakeFastify as never, {});
44
44
 
45
- const handler = routes['/api/status'];
45
+ const handler = routes['/status'];
46
46
  expect(handler).toBeDefined();
47
47
 
48
48
  const result = await handler({ accessMode: 'insider', query: {} });
@@ -7,9 +7,9 @@
7
7
 
8
8
  import type { FastifyPluginAsync } from 'fastify';
9
9
 
10
- import { getConfig } from '../../config/index.js';
11
- import { getRecentEvents } from '../../services/eventLog.js';
12
- import { packageVersion } from '../../util/packageVersion.js';
10
+ import { getConfig } from '../config/index.js';
11
+ import { getRecentEvents } from '../services/eventLog.js';
12
+ import { packageVersion } from '../util/packageVersion.js';
13
13
 
14
14
  const startTime = Date.now();
15
15
 
@@ -40,7 +40,7 @@ async function checkService(url: string): Promise<ServiceStatus> {
40
40
  // eslint-disable-next-line @typescript-eslint/require-await
41
41
  export const statusRoutes: FastifyPluginAsync = async (fastify) => {
42
42
  fastify.get<{ Querystring: { events?: string } }>(
43
- '/api/status',
43
+ '/status',
44
44
  async (request) => {
45
45
  const config = getConfig();
46
46
 
package/src/server.ts CHANGED
@@ -16,10 +16,10 @@ import { apiRoute } from './routes/api/index.js';
16
16
  import { authRoute } from './routes/auth.js';
17
17
  import { registerConfigRoute } from './routes/config.js';
18
18
  import { eventRoute } from './routes/event.js';
19
- import { healthRoute } from './routes/health.js';
20
19
  import { keysRoute } from './routes/keys.js';
21
20
  import { pathRoute } from './routes/path/index.js';
22
21
  import { staticRoutes } from './routes/static.js';
22
+ import { statusRoutes } from './routes/status.js';
23
23
  import { initDiagramCache } from './services/diagramCache.js';
24
24
  import { startQueueProcessor } from './services/eventQueue.js';
25
25
  import { initExportCache } from './services/exportCache.js';
@@ -44,8 +44,8 @@ async function start() {
44
44
 
45
45
  // Register routes
46
46
  await fastify.register(staticRoutes);
47
- await fastify.register(healthRoute);
48
47
  registerConfigRoute(fastify);
48
+ await fastify.register(statusRoutes);
49
49
  await fastify.register(authRoute);
50
50
  await fastify.register(keysRoute);
51
51
  await fastify.register(eventRoute);
@@ -95,7 +95,7 @@ async function start() {
95
95
  console.log(` GET /api/export/* - PDF/DOCX/ZIP export`);
96
96
  console.log(` POST /event - Event Gateway (key auth)`);
97
97
  console.log(` GET /key - Compute path key (X-API-Key auth)`);
98
- console.log(` GET /health - Health check (no auth)`);
98
+ console.log(` GET /status - Server status (no auth)`);
99
99
  } catch (err) {
100
100
  console.error('Fatal startup error:', err);
101
101
  process.exit(1);
@@ -1,10 +0,0 @@
1
- /**
2
- * Health check endpoint
3
- */
4
- // eslint-disable-next-line @typescript-eslint/require-await
5
- export const healthRoute = async (fastify) => {
6
- // eslint-disable-next-line @typescript-eslint/require-await
7
- fastify.get('/health', async () => {
8
- return { ok: true, uptime: process.uptime() };
9
- });
10
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * Health check endpoint
3
- */
4
-
5
- import type { FastifyPluginAsync } from 'fastify';
6
-
7
- // eslint-disable-next-line @typescript-eslint/require-await
8
- export const healthRoute: FastifyPluginAsync = async (fastify) => {
9
- // eslint-disable-next-line @typescript-eslint/require-await
10
- fastify.get('/health', async () => {
11
- return { ok: true, uptime: process.uptime() };
12
- });
13
- };