@gaia-ai/core 0.9.2 → 0.10.0
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.
|
@@ -16,6 +16,16 @@ export interface GaiaConnectionConfig {
|
|
|
16
16
|
source: GaiaConfigSource;
|
|
17
17
|
/** true when the loaded file is a legacy `conductor.config.js` connection. */
|
|
18
18
|
legacy: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* GAIA-373: UI extension entry modules discovered from `addons[]`, as
|
|
21
|
+
* RESOLVED `file://` URLs (see `resolveUiEntries` for why resolution happens
|
|
22
|
+
* here rather than at the import).
|
|
23
|
+
*
|
|
24
|
+
* Nothing is imported — `gaia dropsh` loads this same connection and never
|
|
25
|
+
* renders a TUI, so the cost of a UI contribution must not be paid until
|
|
26
|
+
* `gaia ui`'s kernel actually boots (spec F2/D3).
|
|
27
|
+
*/
|
|
28
|
+
ui_entries: string[];
|
|
19
29
|
}
|
|
20
30
|
/**
|
|
21
31
|
* Load the connection config for `gaia ui` / `gaia dropsh` / conductor-auth.
|
|
@@ -115,5 +115,35 @@ export async function loadGaiaConfig(host, opts = {}) {
|
|
|
115
115
|
fallback: resolution.fallback,
|
|
116
116
|
source: resolution.source,
|
|
117
117
|
legacy: resolution.legacy,
|
|
118
|
+
ui_entries: discovered ? resolveUiEntries(discovered.uiEntries, bases) : [],
|
|
118
119
|
};
|
|
119
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Resolve each UI entry specifier to an importable file URL — GAIA-373.
|
|
123
|
+
*
|
|
124
|
+
* Resolution belongs HERE, against the very bases that found the addon's
|
|
125
|
+
* `./preset`, and not in the renderer that eventually imports them. A preset
|
|
126
|
+
* names a package specifier (`@gaia-ai/addon-x/ui`) because that is what its
|
|
127
|
+
* author can honestly write; but the module that imports it is the TUI kernel,
|
|
128
|
+
* inside `@gaia-ai/addon-gaia-ui`, and a bare specifier there resolves against
|
|
129
|
+
* THAT package's dependencies. A contribution addon is its SIBLING, never its
|
|
130
|
+
* dependency — the layered DAG forbids the backwards edge — so the bare import
|
|
131
|
+
* fails, and it fails at cockpit boot rather than at config load.
|
|
132
|
+
*
|
|
133
|
+
* Measured, not reasoned: `gaia ui GAIA-373` with the addon listed reported
|
|
134
|
+
* `Cannot find module '@gaia-ai/addon-gaia-ui-artifacts/ui' from
|
|
135
|
+
* .../addons/gaia-ui/dist/src/Extension/load.js`.
|
|
136
|
+
*
|
|
137
|
+
* Still NOTHING IS IMPORTED here (F2): a resolve is a path lookup, and the
|
|
138
|
+
* megabytes behind the specifier stay unloaded until a TUI actually boots.
|
|
139
|
+
*/
|
|
140
|
+
function resolveUiEntries(entries, bases) {
|
|
141
|
+
return entries.map((entry) => {
|
|
142
|
+
const resolved = resolveModuleEslintStyle(entry, bases);
|
|
143
|
+
if (resolved === undefined) {
|
|
144
|
+
throw new Error(`gaia.config.js cannot resolve UI entry '${entry}' — the addon that ` +
|
|
145
|
+
'contributes it must be installed where the config can see it');
|
|
146
|
+
}
|
|
147
|
+
return pathToFileURL(resolved).href;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
@@ -60,6 +60,18 @@ export interface DiscoveredContributions {
|
|
|
60
60
|
/** Opaque: `AgentCandidate[]` on the conductor surface. */
|
|
61
61
|
agents: unknown[];
|
|
62
62
|
connectionPlugins: DropSHPlugin[];
|
|
63
|
+
/**
|
|
64
|
+
* GAIA-373: UI extension entry MODULES — specifiers, never constructed
|
|
65
|
+
* contributions.
|
|
66
|
+
*
|
|
67
|
+
* Storybook's `managerEntries` model, and load-bearing for a measured reason:
|
|
68
|
+
* `discoverAddons` runs on every connection load (`gaia dropsh` included), and
|
|
69
|
+
* `@opentui/core` is megabytes of native code that a preset returning objects
|
|
70
|
+
* would pull onto that path — the very import GAIA-326 had to make dynamic.
|
|
71
|
+
* Concretely typed rather than opaque: a specifier is a string, so the kernel
|
|
72
|
+
* needs no foreign type for it and stays surface-agnostic all the same.
|
|
73
|
+
*/
|
|
74
|
+
uiEntries: string[];
|
|
63
75
|
}
|
|
64
76
|
/**
|
|
65
77
|
* An OPAQUE per-surface accumulator. The kernel threads it without knowing its
|
|
@@ -87,6 +99,7 @@ export interface GaiaPreset<O = unknown> {
|
|
|
87
99
|
workspaces?: OpaqueAccumulator<O>;
|
|
88
100
|
agents?: OpaqueAccumulator<O>;
|
|
89
101
|
connectionPlugins?: (acc: DropSHPlugin[], opts: O) => DropSHPlugin[] | Promise<DropSHPlugin[]>;
|
|
102
|
+
uiEntries?: (acc: string[], opts: O) => string[] | Promise<string[]>;
|
|
90
103
|
}
|
|
91
104
|
/** The preset function keys, for shape-detection during discovery. */
|
|
92
105
|
export declare const PRESET_FUNCTION_KEYS: Array<keyof DiscoveredContributions>;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
export const SURFACE_KEYS = {
|
|
29
29
|
command: ['commands'],
|
|
30
30
|
conductor: ['remotes', 'executors', 'workspaces', 'agents'],
|
|
31
|
-
connection: ['connectionPlugins'],
|
|
31
|
+
connection: ['connectionPlugins', 'uiEntries'],
|
|
32
32
|
};
|
|
33
33
|
/** The preset function keys, for shape-detection during discovery. */
|
|
34
34
|
export const PRESET_FUNCTION_KEYS = [
|
|
@@ -38,6 +38,7 @@ export const PRESET_FUNCTION_KEYS = [
|
|
|
38
38
|
'workspaces',
|
|
39
39
|
'agents',
|
|
40
40
|
'connectionPlugins',
|
|
41
|
+
'uiEntries',
|
|
41
42
|
];
|
|
42
43
|
/** An empty contributions accumulator. */
|
|
43
44
|
export function emptyContributions() {
|
|
@@ -48,5 +49,6 @@ export function emptyContributions() {
|
|
|
48
49
|
workspaces: [],
|
|
49
50
|
agents: [],
|
|
50
51
|
connectionPlugins: [],
|
|
52
|
+
uiEntries: [],
|
|
51
53
|
};
|
|
52
54
|
}
|
package/package.json
CHANGED