@adhd/apigen-plugin-health 0.1.2 โ†’ 0.1.4

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +114 -4
  3. package/package.json +2 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,51 @@
1
+ ## 0.1.4 (2026-07-23)
2
+
3
+
4
+ ### ๐Ÿš€ Features
5
+
6
+ - session batch โ€” dispatch tool-exec + provider routing, publish hygiene, agent/env/apigen fixes
7
+
8
+ - **release:** nx release independent versioning + verify-dist-load publish gate (Agent 2)
9
+
10
+ - **apigen:** canonical route/tool-name projection across transports; serve + generate() + import-specifier fixes
11
+
12
+
13
+ ### ๐Ÿฉน Fixes
14
+
15
+ - resolve build errors from workspace-cleanup merge โ€” unterminated strings, path mappings, lint
16
+
17
+ - **apigen:** update remaining stale @adhd/apigen-errors, core, logical refs
18
+
19
+ - **environment:** correct agent-mcp plugins at: classification (build->runtime)
20
+
21
+ - **apigen:** externalize real npm deps in vite builds โ€” 10 packages shipped broken dist bundles (__filename/timeOrigin crash)
22
+
23
+
24
+ ### โค๏ธ Thank You
25
+
26
+ - pseudosky
27
+
28
+ ## 0.1.3 (2026-07-23)
29
+
30
+
31
+ ### ๐Ÿš€ Features
32
+
33
+ - session batch โ€” dispatch tool-exec + provider routing, publish hygiene, agent/env/apigen fixes
34
+
35
+ - **release:** nx release independent versioning + verify-dist-load publish gate (Agent 2)
36
+
37
+
38
+ ### ๐Ÿฉน Fixes
39
+
40
+ - resolve build errors from workspace-cleanup merge โ€” unterminated strings, path mappings, lint
41
+
42
+ - **apigen:** update remaining stale @adhd/apigen-errors, core, logical refs
43
+
44
+ - **environment:** correct agent-mcp plugins at: classification (build->runtime)
45
+
46
+ - **apigen:** externalize real npm deps in vite builds โ€” 10 packages shipped broken dist bundles (__filename/timeOrigin crash)
47
+
48
+
49
+ ### โค๏ธ Thank You
50
+
51
+ - pseudosky
package/README.md CHANGED
@@ -1,13 +1,123 @@
1
1
  # @adhd/apigen-plugin-health
2
2
 
3
- apigen **mount plugin** โ€” adds a health endpoint to a generated server. Activate with `--use`.
3
+ **Mount plugin** โ€” adds a `GET /_meta/health` endpoint to any apigen server. Reports runtime readiness for load balancers, orchestrators, and the apigen gateway (ยง13).
4
4
 
5
- Part of [apigen](../../README.md). Driven via [`@adhd/apigen-cli`](../../cli).
5
+ Part of [apigen](../README.md). Driven via [`@adhd/apigen-cli`](../../../entrypoint/apigen-cli/README.md).
6
+
7
+ ---
8
+
9
+ ## What it adds
10
+
11
+ When loaded via `--use`, the health plugin contributes a synthetic `_meta/health` operation that returns:
12
+
13
+ ```json
14
+ GET /_meta/health
15
+ โ†’ {"status":"ok","host":"ts"}
16
+ ```
17
+
18
+ The gateway (ยง13.1) routes a host's operations only after this endpoint reports `ready`. For an in-process runtime (non-gateway), it always reports `ok` โ€” if the handler can respond, the runtime is alive.
19
+
20
+ ---
21
+
22
+ ## CLI usage
23
+
24
+ ```bash
25
+ # Fastify with health check
26
+ npx @adhd/apigen-cli run --source api.ts --type api-fastify --opt port=3000 --use health
27
+
28
+ # MCP with health check (SSE transport)
29
+ npx @adhd/apigen-cli run --source api.ts --type mcp --opt transport=sse --opt port=3000 --use health
30
+
31
+ # With custom metadata in the response
32
+ npx @adhd/apigen-cli run --source api.ts --type api-fastify --use health \
33
+ --opt 'useOptions={"health":{"meta":{"version":"1.0","region":"us-east"}}}'
34
+ ```
35
+
36
+ After startup:
6
37
 
7
38
  ```bash
8
- npx @adhd/apigen-cli run --source ./api.ts --type api-fastify --use @adhd/apigen-plugin-health
39
+ curl http://localhost:3000/_meta/health
40
+ # โ†’ {"status":"ok","host":"ts","meta":{"version":"1.0","region":"us-east"}}
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Programmatic usage
46
+
47
+ ```ts
48
+ import { extract, composeSchemas } from '@adhd/apigen-core-client';
49
+ import { apiFastifyPlugin } from '@adhd/apigen-plugin-api-fastify';
50
+ import { healthPlugin } from '@adhd/apigen-plugin-health';
51
+
52
+ const ops = await extract({ sourceFile: './api.ts', namespace: 'api' });
53
+ const schemas = composeSchemas(
54
+ {
55
+ metadata: { namespace: 'api', phase: '' },
56
+ schemas: Object.fromEntries(
57
+ ops.filter(o => o.kind === 'action').map(op => [
58
+ op.path[op.path.length - 1].raw,
59
+ { input: op.input, output: op.output, hasCtx: op.hasCtx, 'x-apigen-safe': op.safe },
60
+ ])
61
+ ),
62
+ },
63
+ []
64
+ );
65
+ const mod = await import('./api.ts');
66
+
67
+ const abort = new AbortController();
68
+ process.on('SIGINT', () => abort.abort());
69
+
70
+ await apiFastifyPlugin.run({
71
+ packages: [{ id: 'api', schemas, importPath: './api.ts', fns: mod, createClient: async () => ({}) }],
72
+ outputDir: '',
73
+ options: {
74
+ port: 3000,
75
+ host: '0.0.0.0',
76
+ usePlugins: [
77
+ healthPlugin, // โ† mounts GET /_meta/health
78
+ ],
79
+ // With custom metadata:
80
+ // useOptions: { health: { meta: { version: '1.0', region: 'us-east' } } },
81
+ },
82
+ signal: abort.signal,
83
+ operations: ops,
84
+ });
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Options
90
+
91
+ ```ts
92
+ import { type HealthOptions } from '@adhd/apigen-plugin-health';
9
93
  ```
10
94
 
95
+ | Option | Type | Default | Description |
96
+ |--------|------|---------|-------------|
97
+ | `meta` | `Record<string, string \| number \| boolean \| null>` | `undefined` | Extra metadata included in every health response payload |
98
+
99
+ ---
100
+
101
+ ## Response shape
102
+
103
+ ```ts
104
+ interface HealthResponse {
105
+ status: 'ok';
106
+ host: string; // language runtime tag (e.g. 'ts')
107
+ meta?: Record<string, string | number | boolean | null>;
108
+ }
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Exports
114
+
115
+ | Export | Kind |
116
+ |--------|------|
117
+ | `healthPlugin` | v2 `Plugin<HealthOptions>` โ€” mount capability only |
118
+ | `HealthOptions` | TypeScript interface |
119
+ | `HealthResponse` | TypeScript interface |
120
+
11
121
  ```ts
12
- import { healthPlugin, type HealthOptions } from '@adhd/apigen-plugin-health';
122
+ import { healthPlugin, type HealthOptions, type HealthResponse } from '@adhd/apigen-plugin-health';
13
123
  ```
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@adhd/apigen-plugin-health",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "main": "./index.js",
5
5
  "dependencies": {
6
- "@adhd/apigen-core-client": "^0.1.0"
6
+ "@adhd/apigen-core-client": "^0.1.2"
7
7
  },
8
8
  "publishConfig": {
9
9
  "access": "public"