@gaia-ai/conductor 0.6.1 → 0.6.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.
@@ -9,7 +9,9 @@ export declare const ADDON_RENAME_BAK_SUFFIX = ".pre-addon-rename.bak";
9
9
  */
10
10
  export declare const RENAMED_ADDONS: readonly ["auth-basic", "claude", "codex", "deployment", "dropsh", "essentials", "fake", "gaia-ui", "herdr", "kimi", "opencode", "pi", "remote-drupal", "workspace-git"];
11
11
  /**
12
- * Where each export of the DELETED `@gaia-ai/core/plugins` host barrel lives now.
12
+ * Where each export of the host barrels lives now — the DELETED
13
+ * `@gaia-ai/core/plugins` and (GAIA-230) the meta package's
14
+ * `@gaia-ai/gaia/plugins`, which is unresolvable from a dev-clone install.
13
15
  *
14
16
  * The key set is the barrel's own export list — `core/src/plugins/registry-exports.ts`
15
17
  * as of the commit that deleted it — re-pointed at the addon that owns each
@@ -28,12 +30,20 @@ export declare const CORE_PLUGINS_BARREL_EXPORTS: Readonly<Record<string, {
28
30
  target: string;
29
31
  defaultExport: boolean;
30
32
  }>>;
33
+ /**
34
+ * The host-barrel specifiers a descriptor may name. Both map through
35
+ * `CORE_PLUGINS_BARREL_EXPORTS`: `@gaia-ai/core/plugins` is DELETED, and
36
+ * `@gaia-ai/gaia/plugins` (GAIA-230) is unresolvable from a dev-clone install
37
+ * because the meta package that exports it is the workspace's leaf sink.
38
+ */
39
+ export declare const HOST_BARREL_PATHS: readonly ["@gaia-ai/core/plugins", "@gaia-ai/gaia/plugins"];
31
40
  /** Which surface a config file speaks — decides the ambiguous builtins mapping. */
32
41
  export type ConfigSurface = 'connection' | 'engine';
33
42
  /**
34
- * Rewrite the legacy specifiers in one config's SOURCE TEXT — all three: the
43
+ * Rewrite the legacy specifiers in one config's SOURCE TEXT — all of them: the
35
44
  * renamed `@gaia-ai/plugin-*` packages, the deleted `@gaia-ai/core/builtins`
36
- * preset, and the deleted `@gaia-ai/core/plugins` barrel descriptors. Pure; line
45
+ * preset, and the host-barrel descriptors naming either `@gaia-ai/core/plugins`
46
+ * (deleted) or `@gaia-ai/gaia/plugins` (GAIA-230). Pure; line
37
47
  * count is preserved (every replacement is line-local), which is what lets the
38
48
  * reported diff be a plain index-aligned line diff.
39
49
  */
@@ -9,13 +9,31 @@ import { listConductorConfigFiles } from '../config.js';
9
9
  // `.gaia/` configs still name the old packages — so `gaia upgrade` rewrites them
10
10
  // in the user's PROJECT `./.gaia/` and HOME `~/.gaia/` configs.
11
11
  //
12
- // All THREE deleted/renamed specifiers are covered. The `@gaia-ai/gaia/plugins`
13
- // barrel is deliberately NOT covered: it still exists as a back-compat
14
- // aggregator. `@gaia-ai/core/plugins` has no such reprieve — it is gone, and the
15
- // pre-GAIA-224 project docs explicitly told configs to name `@gaia-ai/core/plugins`
16
- // and NOT `@gaia-ai/gaia/plugins` (core resolved from both the dev monorepo and a
17
- // global install; the meta package did not), so real installs DO name the deleted
18
- // one. See `CORE_PLUGINS_BARREL_EXPORTS`.
12
+ // All THREE deleted/renamed specifiers are covered, and — GAIA-230 — so is the
13
+ // FOURTH: the `@gaia-ai/gaia/plugins` host barrel.
14
+ //
15
+ // GAIA-224 excluded that barrel on the premise that it "still exists as a
16
+ // back-compat aggregator", so a config naming it keeps resolving. That premise is
17
+ // INSTALL-DEPENDENT and false for a dev-clone install: `@gaia-ai/gaia` is the
18
+ // workspace's leaf SINK, so nothing depends on it and it is absent from
19
+ // `gaia-cli/node_modules/@gaia-ai/`; it is also the only package exporting
20
+ // `./plugins` (`@gaia-ai/core`'s export map has no such subpath). The `gaia` shim
21
+ // prefers a checkout's own build over the global install by design, so exactly
22
+ // there the barrel is unresolvable and that one config line dies while its
23
+ // sibling `addon-*` slots resolve fine.
24
+ //
25
+ // The barrel itself keeps existing — this is not repairing a dead reference, it is
26
+ // making configs stop NAMING a barrel the project docs already tell them not to
27
+ // name. Both barrels are therefore migrated the same closed-set way, over the same
28
+ // `CORE_PLUGINS_BARREL_EXPORTS` table. Two deliberate consequences:
29
+ // - the table is a SUPERSET of what `@gaia-ai/gaia/plugins` actually re-exports
30
+ // (`host/src/plugins-barrel.ts` omits the fakes on purpose — they are
31
+ // workspace-only and must not be a published package's dependency). Mapping
32
+ // them anyway is right: such a descriptor is broken today, and retargeting it
33
+ // at `@gaia-ai/addon-fake` fixes it.
34
+ // - `loadInstructions` IS a barrel export but is not a plugin factory and is
35
+ // absent from the table, so it stays untouched — as does any other unmapped
36
+ // `export:`.
19
37
  //
20
38
  // Covered per config dir:
21
39
  // - the connection config `gaia.config.js` (its `plugins[]` / `addons[]`);
@@ -34,10 +52,10 @@ import { listConductorConfigFiles } from '../config.js';
34
52
  // The `@gaia-ai/core/plugins` rewrite is likewise closed-set: it is driven by
35
53
  // the barrel's OWN export list, and an export name outside that list is left
36
54
  // untouched rather than retargeted at a guess.
37
- // - `*Plugin` interface identifiers (`RemotePlugin`, `herdrExecutorPlugin`, …),
38
- // the `plugins:`/`addons:` config KEYS and the `@gaia-ai/gaia/plugins`
39
- // subpath barrel are excluded BY CONSTRUCTION: they carry neither the
40
- // `@gaia-ai/plugin-` scope prefix nor the `@gaia-ai/core/` path.
55
+ // - `*Plugin` interface identifiers (`RemotePlugin`, `herdrExecutorPlugin`, …)
56
+ // and the `plugins:`/`addons:` config KEYS are excluded BY CONSTRUCTION: a
57
+ // replacement only ever fires on a full quoted specifier, and none of those
58
+ // is one.
41
59
  // - Idempotent: a config already on `addon-*` produces zero matches and is
42
60
  // left BYTE-unchanged (no rewrite, no backup, no report line).
43
61
  // - `--dry-run` prints the line diff and writes nothing.
@@ -85,7 +103,9 @@ const QUOTED_LEGACY_ADDON = new RegExp(`(['"\`])@gaia-ai/plugin-(${[...RENAMED_A
85
103
  /** `'@gaia-ai/core/builtins'` inside a matched quote pair (the deleted preset). */
86
104
  const QUOTED_LEGACY_BUILTINS = /(['"`])@gaia-ai\/core\/builtins\1/g;
87
105
  /**
88
- * Where each export of the DELETED `@gaia-ai/core/plugins` host barrel lives now.
106
+ * Where each export of the host barrels lives now — the DELETED
107
+ * `@gaia-ai/core/plugins` and (GAIA-230) the meta package's
108
+ * `@gaia-ai/gaia/plugins`, which is unresolvable from a dev-clone install.
89
109
  *
90
110
  * The key set is the barrel's own export list — `core/src/plugins/registry-exports.ts`
91
111
  * as of the commit that deleted it — re-pointed at the addon that owns each
@@ -113,13 +133,25 @@ export const CORE_PLUGINS_BARREL_EXPORTS = {
113
133
  fakeWorkspace: { target: FAKE, defaultExport: false },
114
134
  gitWorkspace: { target: WORKSPACE_GIT, defaultExport: true },
115
135
  };
116
- const BARREL_PATH = '@gaia-ai/core/plugins';
136
+ /**
137
+ * The host-barrel specifiers a descriptor may name. Both map through
138
+ * `CORE_PLUGINS_BARREL_EXPORTS`: `@gaia-ai/core/plugins` is DELETED, and
139
+ * `@gaia-ai/gaia/plugins` (GAIA-230) is unresolvable from a dev-clone install
140
+ * because the meta package that exports it is the workspace's leaf sink.
141
+ */
142
+ export const HOST_BARREL_PATHS = [
143
+ '@gaia-ai/core/plugins',
144
+ '@gaia-ai/gaia/plugins',
145
+ ];
146
+ /** The two barrel specifiers as one non-capturing regex alternation, so the
147
+ * backreference numbers in the descriptor patterns below are unaffected. */
148
+ const BARREL_PATH = `(?:${HOST_BARREL_PATHS.join('|')})`;
117
149
  /** `plugin:` / `use:` — the two descriptor keys that name a package. */
118
150
  const PKG_KEY = '(?:plugin|use)';
119
151
  /** A JS identifier, i.e. an `export:` value the barrel could have carried. */
120
152
  const IDENT = String.raw `[A-Za-z_$][\w$]*`;
121
153
  /**
122
- * `plugin: '@gaia-ai/core/plugins', export: 'drupalRemote'` — the barrel
154
+ * `plugin: '<barrel>', export: 'drupalRemote'` — the barrel
123
155
  * descriptor in its written order, single/double/back quoted, one line or many
124
156
  * (`\s` spans newlines). Requiring the `export:` to be ADJACENT is what keeps
125
157
  * this from ever pairing a barrel mention with an unrelated slot's `export:`.
@@ -128,7 +160,7 @@ const BARREL_THEN_EXPORT = new RegExp(`(${PKG_KEY}\\s*:\\s*)(['"\`])${BARREL_PAT
128
160
  /** The same descriptor with the keys written the other way round. */
129
161
  const EXPORT_THEN_BARREL = new RegExp(`export\\s*:\\s*(['"\`])(${IDENT})\\1(\\s*,\\s*)(${PKG_KEY}\\s*:\\s*)(['"\`])${BARREL_PATH}\\5`, 'g');
130
162
  /**
131
- * Rewrite the `@gaia-ai/core/plugins` descriptors in one config's source text.
163
+ * Rewrite the host-barrel descriptors (both specifiers) in one config's source text.
132
164
  *
133
165
  * A mapped descriptor becomes `<key>: '<addon>'` — with the `export:` DROPPED
134
166
  * when the addon default-exports that factory *and* the whole descriptor sits on
@@ -227,9 +259,10 @@ function builtinsTargetFor(text, at, surface) {
227
259
  return surface === 'connection' ? AUTH_BASIC : REMOTE_DRUPAL;
228
260
  }
229
261
  /**
230
- * Rewrite the legacy specifiers in one config's SOURCE TEXT — all three: the
262
+ * Rewrite the legacy specifiers in one config's SOURCE TEXT — all of them: the
231
263
  * renamed `@gaia-ai/plugin-*` packages, the deleted `@gaia-ai/core/builtins`
232
- * preset, and the deleted `@gaia-ai/core/plugins` barrel descriptors. Pure; line
264
+ * preset, and the host-barrel descriptors naming either `@gaia-ai/core/plugins`
265
+ * (deleted) or `@gaia-ai/gaia/plugins` (GAIA-230). Pure; line
233
266
  * count is preserved (every replacement is line-local), which is what lets the
234
267
  * reported diff be a plain index-aligned line diff.
235
268
  */
@@ -1,7 +1,7 @@
1
1
  import { readdirSync } from 'node:fs';
2
2
  import { resolve } from 'node:path';
3
3
  import { pathToFileURL } from 'node:url';
4
- import { discoverAddons, emptyContributions, resolveConductorSlots, resolveModuleEslintStyle, } from '@gaia-ai/core';
4
+ import { discoverAddons, emptyContributions, findDefaultExportObject, matchDelimiter, resolveConductorSlots, resolveModuleEslintStyle, scanTopLevelProperties, } from '@gaia-ai/core';
5
5
  import { narrowConductorContributions } from './plugins/preset.js';
6
6
  // GAIA-201: the `.gaia/` walk-up + connection resolution moved to `@gaia-ai/core`
7
7
  // (`resolveConfigPath` / `resolveGaiaConfigPath` / `findGaiaDir`). Re-export the
@@ -330,171 +330,9 @@ export function stripStatesFromConfigSource(source) {
330
330
  // (`baseUrl`/`clientId`/`clientSecret`) and a connection-only `loadMachine`
331
331
  // (with its `const machine = await loadMachine()`) when they become unreferenced.
332
332
  // ---------------------------------------------------------------------------
333
- const CLOSER = { '{': '}', '[': ']', '(': ')' };
334
- /** Skip a `//`-line comment; return the index of the terminating newline (or EOF). */
335
- function skipLineComment(src, i) {
336
- const nl = src.indexOf('\n', i);
337
- return nl === -1 ? src.length : nl;
338
- }
339
- /** Skip a `/* *\/` block comment; return the index just past it. */
340
- function skipBlockComment(src, i) {
341
- const end = src.indexOf('*/', i + 2);
342
- return end === -1 ? src.length : end + 2;
343
- }
344
- /** Skip a string/template literal (honouring `\` escapes and `${ … }`
345
- * interpolations in backtick strings); return the index just past the close. */
346
- function skipString(src, i) {
347
- const quote = src[i];
348
- i++;
349
- while (i < src.length) {
350
- const c = src[i];
351
- if (c === '\\') {
352
- i += 2;
353
- continue;
354
- }
355
- if (quote === '`' && c === '$' && src[i + 1] === '{') {
356
- i = matchDelimiter(src, i + 1) + 1;
357
- continue;
358
- }
359
- if (c === quote)
360
- return i + 1;
361
- i++;
362
- }
363
- return i;
364
- }
365
- /** Given the index of an opening `{`/`[`/`(`, return the index of its matching
366
- * close, skipping nested delimiters, strings and comments. -1 if unbalanced. */
367
- function matchDelimiter(src, openIdx) {
368
- const stack = [CLOSER[src[openIdx]]];
369
- let i = openIdx + 1;
370
- while (i < src.length && stack.length > 0) {
371
- const c = src[i];
372
- if (c === '/' && src[i + 1] === '/') {
373
- i = skipLineComment(src, i);
374
- continue;
375
- }
376
- if (c === '/' && src[i + 1] === '*') {
377
- i = skipBlockComment(src, i);
378
- continue;
379
- }
380
- if (c === "'" || c === '"' || c === '`') {
381
- i = skipString(src, i);
382
- continue;
383
- }
384
- if (c === '{' || c === '[' || c === '(') {
385
- stack.push(CLOSER[c]);
386
- i++;
387
- continue;
388
- }
389
- if (c === '}' || c === ']' || c === ')') {
390
- if (c === stack[stack.length - 1])
391
- stack.pop();
392
- i++;
393
- continue;
394
- }
395
- i++;
396
- }
397
- return stack.length === 0 ? i - 1 : -1;
398
- }
399
- /** Skip whitespace + comments starting at `i` (bounded by `limit`). */
400
- function skipTrivia(src, i, limit) {
401
- while (i < limit) {
402
- const c = src[i];
403
- if (c === ' ' || c === '\t' || c === '\n' || c === '\r') {
404
- i++;
405
- continue;
406
- }
407
- if (c === '/' && src[i + 1] === '/') {
408
- i = skipLineComment(src, i);
409
- continue;
410
- }
411
- if (c === '/' && src[i + 1] === '*') {
412
- i = skipBlockComment(src, i);
413
- continue;
414
- }
415
- break;
416
- }
417
- return i;
418
- }
419
- /** Read a property key (bare identifier or quoted string) at `i`. */
420
- function readKey(src, i) {
421
- const c = src[i];
422
- if (c === "'" || c === '"') {
423
- const end = skipString(src, i);
424
- return { name: src.slice(i + 1, end - 1), end };
425
- }
426
- const m = /^[A-Za-z0-9_$]+/.exec(src.slice(i));
427
- if (m)
428
- return { name: m[0], end: i + m[0].length };
429
- return { end: i };
430
- }
431
- /** From `from`, scan to just past the next top-level `,` (or to `limit` when the
432
- * value runs to the object close), skipping nested delimiters/strings/comments. */
433
- function scanToTopLevelComma(src, from, limit) {
434
- let i = from;
435
- while (i < limit) {
436
- const c = src[i];
437
- if (c === '/' && src[i + 1] === '/') {
438
- i = skipLineComment(src, i);
439
- continue;
440
- }
441
- if (c === '/' && src[i + 1] === '*') {
442
- i = skipBlockComment(src, i);
443
- continue;
444
- }
445
- if (c === "'" || c === '"' || c === '`') {
446
- i = skipString(src, i);
447
- continue;
448
- }
449
- if (c === '{' || c === '[' || c === '(') {
450
- i = matchDelimiter(src, i) + 1;
451
- continue;
452
- }
453
- if (c === ',')
454
- return i + 1;
455
- i++;
456
- }
457
- return limit;
458
- }
459
- /** Locate the `export default { … }` object; return the body span (exclusive of
460
- * the braces) or undefined when the default export is not an object literal. */
461
- function findDefaultExportObject(src) {
462
- const m = /export\s+default\s*/.exec(src);
463
- if (!m)
464
- return undefined;
465
- const braceIdx = m.index + m[0].length;
466
- if (src[braceIdx] !== '{')
467
- return undefined;
468
- const end = matchDelimiter(src, braceIdx);
469
- if (end === -1)
470
- return undefined;
471
- return { bodyStart: braceIdx + 1, bodyEnd: end };
472
- }
473
- /** Enumerate the top-level properties of the object body [bodyStart, bodyEnd). */
474
- function scanTopLevelProperties(src, bodyStart, bodyEnd) {
475
- const entries = [];
476
- let i = bodyStart;
477
- while (i < bodyEnd) {
478
- const entryStart = i;
479
- const keyPos = skipTrivia(src, i, bodyEnd);
480
- if (keyPos >= bodyEnd)
481
- break;
482
- const key = readKey(src, keyPos);
483
- let j = skipTrivia(src, key.end, bodyEnd);
484
- if (src[j] !== ':') {
485
- // Not a `key: value` property (spread/computed/shorthand) — keep it.
486
- const term = scanToTopLevelComma(src, keyPos, bodyEnd);
487
- entries.push({ key: undefined, start: entryStart, end: term });
488
- i = term;
489
- continue;
490
- }
491
- j++;
492
- const term = scanToTopLevelComma(src, j, bodyEnd);
493
- entries.push({ key: key.name, start: entryStart, end: term });
494
- i = term;
495
- }
496
- return entries;
497
- }
333
+ // GAIA-230: the scanner primitives themselves now live in `@gaia-ai/core`
334
+ // (`core/src/cli/config-source.ts`) the kernel needs them for the content-gated
335
+ // legacy connection read, and layer 0 cannot import this package. Imported above.
498
336
  /** Count word-boundary occurrences of an identifier in the source. */
499
337
  function countIdent(src, name) {
500
338
  const re = new RegExp(`(?<![A-Za-z0-9_$])${name}(?![A-Za-z0-9_$])`, 'g');
@@ -1,8 +1,9 @@
1
1
  export type * from '@gaia-ai/core';
2
2
  export type { ConductorRegistryEntry } from '@gaia-ai/core';
3
3
  export { conductorId } from '@gaia-ai/core';
4
+ export { GAIA_CONFIG_SCHEMA_VERSION, readConfigSchemaVersion, } from './cli/config-schema.js';
4
5
  export { renderGaiaConfig } from './cli/init.js';
5
- export { type AddonRenameResult, type ConfigSurface, migrateAddonNames, migrateAddonNamesInFile, RENAMED_ADDONS, runAddonRenameMigration, } from './cli/migrate-addon-names.js';
6
+ export { type AddonRenameResult, type ConfigSurface, HOST_BARREL_PATHS, migrateAddonNames, migrateAddonNamesInFile, RENAMED_ADDONS, runAddonRenameMigration, } from './cli/migrate-addon-names.js';
6
7
  export { hasProjectConnection, type ProjectConnectionChoice, runConnectionUpgrade, runUpgrade, type UpgradeReport, } from './cli/upgrade.js';
7
8
  export { default as conductorCommandPlugin, type GaiaCliDeps, runConductorCli, } from './commands/conductor.js';
8
9
  export { composeConductorConfig, DEFAULT_AGENT_PROMPT, loadConductorConfig, stripLegacyConnectionFromConfigSource, } from './config.js';
package/dist/src/index.js CHANGED
@@ -1,11 +1,14 @@
1
1
  export { conductorId } from '@gaia-ai/core';
2
+ // GAIA-216: the connection-config schema version + its regex reader. GAIA-230:
3
+ // the host's `gaia upgrade` intro prints the `from → to` pair from these.
4
+ export { GAIA_CONFIG_SCHEMA_VERSION, readConfigSchemaVersion, } from './cli/config-schema.js';
2
5
  // GAIA-201: the connection-config template, reused by `gaia upgrade` to seed a
3
6
  // `gaia.config.js`.
4
7
  export { renderGaiaConfig } from './cli/init.js';
5
8
  // GAIA-224 (Finding 8b): the addon package-name rename pass `gaia upgrade` runs
6
9
  // as its last step (`@gaia-ai/plugin-*` + the deleted `@gaia-ai/core/builtins`
7
10
  // and `@gaia-ai/core/plugins` → `@gaia-ai/addon-*`).
8
- export { migrateAddonNames, migrateAddonNamesInFile, RENAMED_ADDONS, runAddonRenameMigration, } from './cli/migrate-addon-names.js';
11
+ export { HOST_BARREL_PATHS, migrateAddonNames, migrateAddonNamesInFile, RENAMED_ADDONS, runAddonRenameMigration, } from './cli/migrate-addon-names.js';
9
12
  // GAIA-216: the seed/migration routine, hoisted from the host so `conductor init`
10
13
  // (intra-package) and `gaia upgrade` (host→engine) share one implementation.
11
14
  export { hasProjectConnection, runConnectionUpgrade, runUpgrade, } from './cli/upgrade.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaia-ai/conductor",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "GAIA conductor engine + CLI: registers, claims tickets via JSON:API, dispatches agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@
28
28
  "directory": "gaia-cli/conductor"
29
29
  },
30
30
  "dependencies": {
31
- "@gaia-ai/core": "^0.6.1",
31
+ "@gaia-ai/core": "^0.6.2",
32
32
  "@dropsh/plugin-oauth2": "^0.5.7",
33
33
  "@dropsh/plugin-jsonapi-schema": "^0.5.8",
34
34
  "commander": "^12.1.0",