@sigil-dev/plugin-namepool 0.9.0 → 0.9.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.
Files changed (2) hide show
  1. package/README.md +55 -1
  2. package/package.json +3 -2
package/README.md CHANGED
@@ -1 +1,55 @@
1
- # Sigil plugin for having uniueqe instance names
1
+ # @sigil-dev/plugin-namepool
2
+
3
+ Assigns human-readable names to Grimoire workers instead of the default `mode-index` identifiers like `api-0`, `ws-1`.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ bun add @sigil-dev/plugin-namepool
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { defineConfig } from "@sigil-dev/grimoire";
15
+ import { namepool } from "@sigil-dev/plugin-namepool";
16
+
17
+ export default defineConfig({
18
+ plugins: [
19
+ namepool({ names: ["Rei", "Asuka", "Misato", "Kaworu", "Ritsuko"] }),
20
+ ],
21
+ dev: true,
22
+ });
23
+ ```
24
+
25
+ Workers are assigned names by `globalIndex` — the first worker across all modes gets `names[0]`, the second gets `names[1]`, and so on. If there are more workers than names, the remainder fall back to `mode-index`.
26
+
27
+ ## Options
28
+
29
+ ```ts
30
+ interface NamepoolOptions {
31
+ names: string[];
32
+ }
33
+ ```
34
+
35
+ | Option | Type | Description |
36
+ |---|---|---|
37
+ | `names` | `string[]` | Ordered list of names to assign to workers by global index. |
38
+
39
+ ## Integration with plugin-health
40
+
41
+ When both plugins are registered, `plugin-health` automatically picks up the name pool and uses it to report `reserved` workers — names in the pool that have no live worker assigned. No manual wiring needed.
42
+
43
+ ```ts
44
+ import { namepool } from "@sigil-dev/plugin-namepool";
45
+ import { healthPlugin } from "@sigil-dev/plugin-health";
46
+
47
+ export default defineConfig({
48
+ plugins: [
49
+ namepool({ names: ["Rei", "Asuka", "Shinji"] }),
50
+ healthPlugin(), // finds namepool automatically via onPluginsResolved
51
+ ],
52
+ });
53
+ ```
54
+
55
+ The `/health` endpoint will include all three names in the cluster array, marking any without a live worker as `"reserved"`.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@sigil-dev/plugin-namepool",
3
+ "description": "Automatic worker names for Sigil",
3
4
  "module": "index.ts",
4
- "version": "0.9.0",
5
+ "version": "0.9.1",
5
6
  "type": "module",
6
7
  "private": false,
7
8
  "devDependencies": {
@@ -9,6 +10,6 @@
9
10
  },
10
11
  "peerDependencies": {
11
12
  "typescript": "^5",
12
- "@sigil-dev/grimoire": "0.9.0"
13
+ "@sigil-dev/grimoire": "0.9.1"
13
14
  }
14
15
  }