@gaia-ai/core 0.11.1 → 0.11.2

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.
@@ -0,0 +1,23 @@
1
+ /**
2
+ * One registered conductor in the local machine registry
3
+ * (`${GAIA_HOME ?? ~}/.gaia/conductors.json`). The registry is inherently
4
+ * machine + user scoped: it lists the conductors this user can drive locally.
5
+ */
6
+ export interface ConductorRegistryEntry {
7
+ id: string;
8
+ path: string;
9
+ project: string;
10
+ label: string;
11
+ host: 'herdr' | 'process' | 'systemd';
12
+ handle: string;
13
+ }
14
+ /** `${GAIA_HOME ?? ~}/.gaia/conductors.json`. */
15
+ export declare function conductorRegistryPath(): string;
16
+ /** All registered conductors, in insertion order. */
17
+ export declare function listRegisteredConductors(): Promise<ConductorRegistryEntry[]>;
18
+ /** One registered conductor by id, or `null` when absent. */
19
+ export declare function getRegisteredConductor(id: string): Promise<ConductorRegistryEntry | null>;
20
+ /** Insert or overwrite a conductor by id (idempotent). */
21
+ export declare function registerConductor(entry: ConductorRegistryEntry): Promise<void>;
22
+ /** Remove a conductor by id; a no-op when it is not present. */
23
+ export declare function removeConductor(id: string): Promise<void>;
@@ -0,0 +1,59 @@
1
+ import { mkdir, readFile, writeFile } from 'node:fs/promises';
2
+ import { homedir } from 'node:os';
3
+ import { dirname, join } from 'node:path';
4
+ /** `${GAIA_HOME ?? ~}/.gaia/conductors.json`. */
5
+ export function conductorRegistryPath() {
6
+ const home = process.env.GAIA_HOME ?? homedir();
7
+ return join(home, '.gaia', 'conductors.json');
8
+ }
9
+ async function read() {
10
+ let raw;
11
+ try {
12
+ raw = await readFile(conductorRegistryPath(), 'utf8');
13
+ }
14
+ catch {
15
+ return {};
16
+ }
17
+ if (raw.trim() === '') {
18
+ return {};
19
+ }
20
+ try {
21
+ const parsed = JSON.parse(raw);
22
+ if (typeof parsed === 'object' &&
23
+ parsed !== null &&
24
+ !Array.isArray(parsed)) {
25
+ return parsed;
26
+ }
27
+ return {};
28
+ }
29
+ catch {
30
+ return {};
31
+ }
32
+ }
33
+ async function write(data) {
34
+ const path = conductorRegistryPath();
35
+ await mkdir(dirname(path), { recursive: true });
36
+ await writeFile(path, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
37
+ }
38
+ /** All registered conductors, in insertion order. */
39
+ export async function listRegisteredConductors() {
40
+ return Object.values(await read());
41
+ }
42
+ /** One registered conductor by id, or `null` when absent. */
43
+ export async function getRegisteredConductor(id) {
44
+ return (await read())[id] ?? null;
45
+ }
46
+ /** Insert or overwrite a conductor by id (idempotent). */
47
+ export async function registerConductor(entry) {
48
+ const data = await read();
49
+ data[entry.id] = entry;
50
+ await write(data);
51
+ }
52
+ /** Remove a conductor by id; a no-op when it is not present. */
53
+ export async function removeConductor(id) {
54
+ const data = await read();
55
+ if (data[id]) {
56
+ delete data[id];
57
+ await write(data);
58
+ }
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaia-ai/core",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
4
4
  "description": "GAIA surface-agnostic kernel: host contract, split-config helpers, addon preset/discovery machinery, shared primitives.",
5
5
  "type": "module",
6
6
  "license": "MIT",