@rbbtsn0w/adg 0.11.0-dev.pr166.1007d82 → 0.11.0-dev.pr167.24412d5

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.
@@ -105,7 +105,7 @@ export function makeCli(bin, opts) {
105
105
  else if (r.stderr)
106
106
  console.error(r.stderr.trim());
107
107
  }
108
- return { ok, out: `${r.stdout ?? ""}${r.stderr ?? ""}${r.error ? r.error.message : ""}` };
108
+ return { ok, out: `${r.stdout ?? ""}${r.stderr ?? ""}${r.error ? r.error.message : ""}`, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
109
109
  }
110
110
  finally {
111
111
  span.end();
@@ -176,7 +176,7 @@ function listCodexMarketplaces(runner) {
176
176
  for (let attempt = 0; attempt < 2; attempt++) {
177
177
  const listed = runner(["plugin", "marketplace", "list", "--json"]);
178
178
  if (listed.ok)
179
- return { ok: true, sources: parseCodexMarketplaceLocalSources(listed.out), removed, errors };
179
+ return { ok: true, sources: parseCodexMarketplaceLocalSources(listed.stdout ?? listed.out), removed, errors };
180
180
  const detail = listed.out.trim() || "codex plugin marketplace list failed without an error message";
181
181
  const ownedStale = parseCodexStaleMarketplaceErrors(listed.out).filter((e) => isAdgOwnedName(e.name));
182
182
  if (attempt === 1 || ownedStale.length === 0)
@@ -296,8 +296,13 @@ export const codexAgent = {
296
296
  const result = run(["plugin", "list", "--available", "--marketplace", marketplace, "--json"]);
297
297
  if (!result.ok)
298
298
  return codexListFailure(result.out);
299
- const records = parseCodexInspection(result.out, marketplace);
300
- recordTelemetryEvent("adg.codex.inspect_plugins", { "inspection.valid": records !== undefined, "inspection.record_count": records?.length ?? 0 }, span);
299
+ const records = parseCodexInspection(result.stdout ?? result.out, marketplace);
300
+ recordTelemetryEvent("adg.codex.inspect_plugins", {
301
+ "inspection.valid": records !== undefined,
302
+ "inspection.record_count": records?.length ?? 0,
303
+ "inspection.version_count": records?.filter((record) => record.version !== undefined).length ?? 0,
304
+ "inspection.stderr_present": Boolean(result.stderr),
305
+ }, span);
301
306
  return records ?? codexUnrecognizedListFailure(result.out);
302
307
  }
303
308
  finally {
@@ -316,7 +321,7 @@ export const codexAgent = {
316
321
  return undefined; // no generated marketplace → can't scope the query
317
322
  const jsonRes = run(["plugin", "list", "--json"]);
318
323
  if (jsonRes.ok) {
319
- const parsed = parseCodexPluginListJson(jsonRes.out, mp);
324
+ const parsed = parseCodexPluginListJson(jsonRes.stdout ?? jsonRes.out, mp);
320
325
  if (parsed !== undefined)
321
326
  return parsed;
322
327
  return codexUnrecognizedListFailure(jsonRes.out);
@@ -346,33 +351,7 @@ export function codexUnrecognizedListFailure(out) {
346
351
  }
347
352
  /** Parse `codex plugin list --json` into installed and enabled plugin names for one marketplace. */
348
353
  export function parseCodexPluginListJson(out, marketplace) {
349
- try {
350
- const parsed = JSON.parse(out);
351
- if (typeof parsed !== "object" || parsed === null)
352
- return undefined;
353
- const installed = parsed.installed;
354
- if (!Array.isArray(installed))
355
- return undefined;
356
- const names = [];
357
- const seen = new Set();
358
- for (const entry of installed) {
359
- if (typeof entry !== "object" || entry === null)
360
- continue;
361
- const record = entry;
362
- const name = typeof record.name === "string" ? record.name : undefined;
363
- const mp = typeof record.marketplaceName === "string" ? record.marketplaceName : undefined;
364
- const isInstalled = record.installed === true;
365
- const enabled = record.enabled === true;
366
- if (!name || mp !== marketplace || !isInstalled || !enabled || seen.has(name))
367
- continue;
368
- seen.add(name);
369
- names.push(name);
370
- }
371
- return names;
372
- }
373
- catch {
374
- return undefined;
375
- }
354
+ return parseCodexInspection(out, marketplace)?.filter((record) => record.installed && record.enabled).map((record) => record.name);
376
355
  }
377
356
  /**
378
357
  * Parse `codex plugin list` output into the *installed and enabled* plugin names
@@ -407,19 +386,29 @@ export function parseCodexPluginList(out, marketplace) {
407
386
  export function parseCodexInspection(out, marketplace) {
408
387
  try {
409
388
  const parsed = JSON.parse(out);
410
- if (!Array.isArray(parsed?.installed) || !Array.isArray(parsed?.available))
389
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed) || !Array.isArray(parsed.installed))
390
+ return undefined;
391
+ const available = parsed.available === undefined ? [] : parsed.available;
392
+ if (!Array.isArray(available))
411
393
  return undefined;
412
394
  const records = new Map();
413
- for (const record of [...parsed.installed, ...parsed.available]) {
414
- if (!record || typeof record !== "object")
415
- return undefined;
416
- if (record.marketplaceName !== marketplace)
417
- continue;
418
- if (typeof record.name !== "string" || record.pluginId !== `${record.name}@${marketplace}` || typeof record.installed !== "boolean" || typeof record.enabled !== "boolean" || (record.enabled && !record.installed))
419
- return undefined;
420
- if (records.has(record.name))
421
- return undefined;
422
- records.set(record.name, { id: record.pluginId, name: record.name, installed: record.installed, enabled: record.enabled });
395
+ for (const [entries, installed] of [[parsed.installed, true], [available, false]]) {
396
+ for (const record of entries) {
397
+ if (!record || typeof record !== "object" || Array.isArray(record) || typeof record.marketplaceName !== "string")
398
+ return undefined;
399
+ if (record.marketplaceName !== marketplace)
400
+ continue;
401
+ if (record.installed !== installed)
402
+ return undefined;
403
+ if (typeof record.name !== "string" || !record.name.trim() || record.pluginId !== `${record.name}@${marketplace}` || typeof record.installed !== "boolean" || typeof record.enabled !== "boolean" || (record.enabled && !record.installed))
404
+ return undefined;
405
+ if (record.version != null && (typeof record.version !== "string" || !record.version.trim()))
406
+ return undefined;
407
+ if (records.has(record.name))
408
+ return undefined;
409
+ records.set(record.name, { id: record.pluginId, name: record.name, installed: record.installed, enabled: record.enabled,
410
+ ...(typeof record.version === "string" ? { version: record.version } : {}) });
411
+ }
423
412
  }
424
413
  return [...records.values()];
425
414
  }
@@ -50,6 +50,7 @@ export function pluginStatus(opts) {
50
50
  displayName: a.displayName,
51
51
  queryable: true,
52
52
  ...details,
53
+ ...(Array.isArray(inspection) ? { runtimePlugins: inspection } : {}),
53
54
  inSync: enabled.filter((n) => agentSet.has(n)),
54
55
  missing: enabled.filter((n) => !agentSet.has(n)),
55
56
  agentOnly,
package/docs/cli-json.md CHANGED
@@ -121,6 +121,15 @@ Field notes:
121
121
  Codex detailed queries additionally expose `runtimeMissing` and
122
122
  `runtimeDisabled`, splitting the existing `missing` array without changing it.
123
123
  Other agents may omit these optional fields.
124
+ Detailed queries also expose `runtimePlugins`: scoped native records with
125
+ `id`, `name`, `installed`, `enabled`, and optional `version`. A version on an
126
+ installed record describes the native registration; a version on an available,
127
+ uninstalled record describes the catalog. Missing or null native versions are
128
+ omitted rather than guessed. These records do not prove which version an
129
+ existing session has loaded. An older installed-only response is supported;
130
+ an omitted `available` list does not imply additional installed plugins.
131
+ JSON is parsed from stdout; successful CLI warnings on stderr do not make a
132
+ valid snapshot unknown. Malformed or contradictory state remains a query error.
124
133
  Content drift is not represented; use `adg plugins sync` when a full runtime
125
134
  refresh is required.
126
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbbtsn0w/adg",
3
- "version": "0.11.0-dev.pr166.1007d82",
3
+ "version": "0.11.0-dev.pr167.24412d5",
4
4
  "description": "Agent Directory Group (ADG) toolkit — two domains: plugins and skills.",
5
5
  "type": "module",
6
6
  "license": "MIT",