@rbbtsn0w/adg 0.10.0-dev.pr125.efe3393 → 0.10.0-dev.pr126.02b1b51
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.
- package/dist/src/agents/codex.js +67 -8
- package/dist/src/cli/handlers.js +28 -20
- package/dist/src/cli/index.js +3 -1
- package/dist/src/commands/dependency-order.js +24 -0
- package/dist/src/commands/install.js +1 -1
- package/dist/src/commands/link.js +1 -1
- package/dist/src/commands/marketplace.js +31 -4
- package/dist/src/commands/runtime-repair.js +148 -0
- package/dist/src/commands/state.js +5 -19
- package/dist/src/commands/status.js +6 -1
- package/dist/src/commands/sync.js +12 -2
- package/dist/src/render/plugins.js +13 -2
- package/docs/cli-json.md +3 -0
- package/docs/local-plugin-registration.md +46 -3
- package/package.json +1 -1
package/dist/src/agents/codex.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { existsSync, readdirSync, readFileSync, rmSync } from "node:fs";
|
|
2
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { join, resolve } from "node:path";
|
|
5
5
|
import { SpanKind } from "@opentelemetry/api";
|
|
@@ -48,13 +48,20 @@ export function writeCodexMarketplaceName(pluginsDir) {
|
|
|
48
48
|
/** Register the local marketplace root Codex expects for this store. */
|
|
49
49
|
export function syncMarketplace(pluginsDir, marketplace, runner = run, warn = console.warn) {
|
|
50
50
|
const root = codexMarketplaceRoot(pluginsDir);
|
|
51
|
+
// Explicit stores need the same supported discovery layout as canonical stores.
|
|
52
|
+
if (root === pluginsDir && existsSync(marketplacePath(pluginsDir))) {
|
|
53
|
+
const exportDir = join(root, ".agents", "plugins");
|
|
54
|
+
mkdirSync(exportDir, { recursive: true });
|
|
55
|
+
writeFileSync(join(exportDir, "marketplace.json"), readFileSync(marketplacePath(pluginsDir)));
|
|
56
|
+
}
|
|
51
57
|
const add = runner(["plugin", "marketplace", "add", root]);
|
|
52
58
|
if (add.ok)
|
|
53
|
-
return;
|
|
59
|
+
return true;
|
|
54
60
|
const upgraded = runner(["plugin", "marketplace", "upgrade", marketplace]);
|
|
55
61
|
if (!upgraded.ok) {
|
|
56
62
|
warn(`failed to sync Codex marketplace (${marketplace}): ${upgraded.out.trim() || add.out.trim() || "codex plugin marketplace sync failed without an error message"}`);
|
|
57
63
|
}
|
|
64
|
+
return upgraded.ok;
|
|
58
65
|
}
|
|
59
66
|
/**
|
|
60
67
|
* Best-effort retirement of historical aliases after canonical installs succeed.
|
|
@@ -236,26 +243,36 @@ export const codexAgent = {
|
|
|
236
243
|
const mp = writeCodexMarketplaceName(ctx.pluginsDir);
|
|
237
244
|
if (!available())
|
|
238
245
|
return skippedResult("codex");
|
|
239
|
-
|
|
246
|
+
let diagnostic = "";
|
|
247
|
+
if (!syncMarketplace(ctx.pluginsDir, mp, run, (message) => { diagnostic = message; }))
|
|
248
|
+
return { agent: "codex", affected: [], skipped: false, failures: [{ stage: "marketplace", errorType: "MARKETPLACE_SYNC_FAILED", message: diagnostic || "Codex marketplace registration failed; plugin installation was not attempted." }] };
|
|
240
249
|
const affected = [];
|
|
250
|
+
const failures = [];
|
|
241
251
|
for (const p of ctx.plugins) {
|
|
242
|
-
|
|
252
|
+
const result = run(["plugin", "add", `${p}@${mp}`]);
|
|
253
|
+
if (result.ok)
|
|
243
254
|
affected.push(p);
|
|
255
|
+
else
|
|
256
|
+
failures.push({ plugin: p, stage: "install", errorType: "CLI_FAILURE", message: result.out.trim() || "Codex installation failed." });
|
|
244
257
|
}
|
|
245
258
|
if (ctx.reconcileLegacyAliases && affected.length > 0)
|
|
246
259
|
reconcileLegacyAliases(ctx.pluginsDir, mp, affected);
|
|
247
|
-
return { agent: "codex", affected, skipped: false };
|
|
260
|
+
return { agent: "codex", affected, skipped: false, ...(failures.length ? { failures } : {}) };
|
|
248
261
|
},
|
|
249
262
|
deactivate(ctx) {
|
|
250
263
|
const mp = writeCodexMarketplaceName(ctx.pluginsDir);
|
|
251
264
|
if (!available())
|
|
252
265
|
return skippedResult("codex");
|
|
253
266
|
const affected = [];
|
|
267
|
+
const failures = [];
|
|
254
268
|
for (const p of ctx.plugins) {
|
|
255
|
-
|
|
269
|
+
const result = run(["plugin", "remove", `${p}@${mp}`]);
|
|
270
|
+
if (result.ok)
|
|
256
271
|
affected.push(p);
|
|
272
|
+
else
|
|
273
|
+
failures.push({ plugin: p, stage: "remove", errorType: "CLI_FAILURE", message: result.out.trim() || "Codex removal failed." });
|
|
257
274
|
}
|
|
258
|
-
return { agent: "codex", affected, skipped: false };
|
|
275
|
+
return { agent: "codex", affected, skipped: false, ...(failures.length ? { failures } : {}) };
|
|
259
276
|
},
|
|
260
277
|
// `codex plugin add` stages into `.remote-plugin-install-staging` and swaps the
|
|
261
278
|
// cache entry (keeping a `.tmp/plugins-backup-*`), so it *replaces* rather than
|
|
@@ -264,13 +281,31 @@ export const codexAgent = {
|
|
|
264
281
|
refresh(ctx) {
|
|
265
282
|
return codexAgent.activate(ctx);
|
|
266
283
|
},
|
|
284
|
+
inspectPlugins(ctx) {
|
|
285
|
+
if (!available())
|
|
286
|
+
return undefined;
|
|
287
|
+
const marketplace = codexMarketplaceName(ctx.pluginsDir);
|
|
288
|
+
return getTracer().startActiveSpan("adg.codex.inspect_plugins", (span) => {
|
|
289
|
+
try {
|
|
290
|
+
const result = run(["plugin", "list", "--available", "--marketplace", marketplace, "--json"]);
|
|
291
|
+
if (!result.ok)
|
|
292
|
+
return codexListFailure(result.out);
|
|
293
|
+
const records = parseCodexInspection(result.out, marketplace);
|
|
294
|
+
recordTelemetryEvent("adg.codex.inspect_plugins", { "inspection.valid": records !== undefined, "inspection.record_count": records?.length ?? 0 }, span);
|
|
295
|
+
return records ?? codexUnrecognizedListFailure(result.out);
|
|
296
|
+
}
|
|
297
|
+
finally {
|
|
298
|
+
span.end();
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
},
|
|
267
302
|
// Query Codex's live plugin state for `adg plugins status`, scoped to our
|
|
268
303
|
// generated marketplace. `available()` gates the query so an absent CLI is a
|
|
269
304
|
// quiet `undefined` ("unknown").
|
|
270
305
|
listInstalled(ctx) {
|
|
271
306
|
if (!available())
|
|
272
307
|
return undefined;
|
|
273
|
-
const mp =
|
|
308
|
+
const mp = codexMarketplaceName(ctx.pluginsDir);
|
|
274
309
|
if (!mp)
|
|
275
310
|
return undefined; // no generated marketplace → can't scope the query
|
|
276
311
|
const jsonRes = run(["plugin", "list", "--json"]);
|
|
@@ -362,3 +397,27 @@ export function parseCodexPluginList(out, marketplace) {
|
|
|
362
397
|
}
|
|
363
398
|
return names;
|
|
364
399
|
}
|
|
400
|
+
/** Reject malformed snapshots instead of interpreting them as missing registrations. */
|
|
401
|
+
export function parseCodexInspection(out, marketplace) {
|
|
402
|
+
try {
|
|
403
|
+
const parsed = JSON.parse(out);
|
|
404
|
+
if (!Array.isArray(parsed?.installed) || !Array.isArray(parsed?.available))
|
|
405
|
+
return undefined;
|
|
406
|
+
const records = new Map();
|
|
407
|
+
for (const record of [...parsed.installed, ...parsed.available]) {
|
|
408
|
+
if (!record || typeof record !== "object")
|
|
409
|
+
return undefined;
|
|
410
|
+
if (record.marketplaceName !== marketplace)
|
|
411
|
+
continue;
|
|
412
|
+
if (typeof record.name !== "string" || record.pluginId !== `${record.name}@${marketplace}` || typeof record.installed !== "boolean" || typeof record.enabled !== "boolean" || (record.enabled && !record.installed))
|
|
413
|
+
return undefined;
|
|
414
|
+
if (records.has(record.name))
|
|
415
|
+
return undefined;
|
|
416
|
+
records.set(record.name, { id: record.pluginId, name: record.name, installed: record.installed, enabled: record.enabled });
|
|
417
|
+
}
|
|
418
|
+
return [...records.values()];
|
|
419
|
+
}
|
|
420
|
+
catch {
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
423
|
+
}
|
package/dist/src/cli/handlers.js
CHANGED
|
@@ -22,13 +22,13 @@ import { createProgress, formatUpdateSummary } from "../render/progress.js";
|
|
|
22
22
|
import { renderAgentReport, renderMarketplaceList, renderUpdateReport, } from "../render/plugins.js";
|
|
23
23
|
import { CACHE_USAGE, MARKETPLACE_USAGE, PLUGIN_ALIASES, PLUGIN_COMMANDS, SCOPE, fail, parseVerb, renderPluginsHelp, renderVerbHelp, requireSingleTarget, resolveComponents, resolveScopeDir, resolveTargets, scopeOf, wantsHelp, } from "./index.js";
|
|
24
24
|
import { handleCorePluginVerb } from "./core-plugin-handlers.js";
|
|
25
|
-
import { commandOutcome } from "../command-outcome.js";
|
|
25
|
+
import { commandOutcome, mergeCommandOutcomes } from "../command-outcome.js";
|
|
26
26
|
export function updateResultCounts(result) {
|
|
27
27
|
const failedRemote = result.remote.filter((source) => source.failed !== undefined).length;
|
|
28
28
|
return {
|
|
29
29
|
succeeded: result.remote.length - failedRemote +
|
|
30
30
|
result.local.results.length,
|
|
31
|
-
failed: failedRemote + result.local.missing.length,
|
|
31
|
+
failed: failedRemote + result.local.missing.length + result.agents.reduce((count, agent) => count + (agent.failures?.length ?? 0), 0),
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
@@ -180,8 +180,12 @@ export async function runPlugins(rawVerb, rest) {
|
|
|
180
180
|
}
|
|
181
181
|
if (verb === "update")
|
|
182
182
|
return handleUpdate(rest, cmd);
|
|
183
|
-
await runPluginsVerb(verb, rest, cmd);
|
|
184
|
-
|
|
183
|
+
return await runPluginsVerb(verb, rest, cmd) ?? commandOutcome("success");
|
|
184
|
+
}
|
|
185
|
+
function runtimeOutcome(agents = []) {
|
|
186
|
+
return mergeCommandOutcomes(agents.map((agent) => agent.failures?.length
|
|
187
|
+
? commandOutcome((agent.verified ?? agent.affected).length ? "partial" : "failure", "dependency")
|
|
188
|
+
: commandOutcome("success")));
|
|
185
189
|
}
|
|
186
190
|
async function handleAdd(rest, cmd) {
|
|
187
191
|
const { values, positionals } = parseVerb("add", cmd.flags, rest);
|
|
@@ -241,22 +245,28 @@ async function handleAdd(rest, cmd) {
|
|
|
241
245
|
}
|
|
242
246
|
for (const line of renderAgentReport(agents, "enabled"))
|
|
243
247
|
console.log(line);
|
|
248
|
+
return runtimeOutcome(agents);
|
|
244
249
|
}
|
|
245
250
|
async function handleLink(rest, cmd) {
|
|
246
251
|
const { values, positionals } = parseVerb("link", cmd.flags, rest);
|
|
247
252
|
const targets = resolveVerbTargets(values, "link");
|
|
248
253
|
const sc = await resolveActionScope(values, "link");
|
|
249
254
|
const names = positionals.length > 0 ? positionals : undefined;
|
|
255
|
+
const outcomes = [];
|
|
250
256
|
for (const target of targets) {
|
|
251
257
|
const res = linkPlugins({ pluginsDir: sc.pluginsDir, target, global: sc.global, names });
|
|
252
258
|
for (const action of res.actions) {
|
|
253
|
-
console.log(`${ui.ok("linked")} ${ui.name(action.name)} ${ui.meta(`[${res.target}]`)}${action.linkedTo ? ui.meta(` -> ${action.linkedTo}`) : ""}`);
|
|
259
|
+
console.log(`${action.linkedTo ? ui.ok("linked") : ui.meta("projected")} ${ui.name(action.name)} ${ui.meta(`[${res.target}]`)}${action.linkedTo ? ui.meta(` -> ${action.linkedTo}`) : ""}`);
|
|
254
260
|
for (const file of action.adapted)
|
|
255
261
|
console.log(ui.meta(` adapted: ${file}`));
|
|
256
262
|
}
|
|
263
|
+
for (const failure of res.failures ?? [])
|
|
264
|
+
console.error(`${target}: ${failure.stage}: ${failure.message}`);
|
|
265
|
+
outcomes.push(runtimeOutcome([{ agent: target, affected: res.actions.filter((action) => action.linkedTo).map((action) => action.name), skipped: Boolean(res.cliSkipped), failures: res.failures }]));
|
|
257
266
|
if (res.cliSkipped)
|
|
258
267
|
printCliUnavailableNote(target, `manifests were generated, but nothing was enabled in ${target}.`);
|
|
259
268
|
}
|
|
269
|
+
return mergeCommandOutcomes(outcomes);
|
|
260
270
|
}
|
|
261
271
|
async function handleUnlink(rest, cmd) {
|
|
262
272
|
const { values, positionals } = parseVerb("unlink", cmd.flags, rest);
|
|
@@ -287,15 +297,20 @@ async function handleSync(rest, cmd) {
|
|
|
287
297
|
const targets = resolveVerbTargets(values, "sync");
|
|
288
298
|
const sc = await resolveActionScope(values, "sync");
|
|
289
299
|
const names = positionals.length > 0 ? positionals : undefined;
|
|
300
|
+
const outcomes = [];
|
|
290
301
|
for (const target of targets) {
|
|
291
302
|
const res = syncPlugins({ pluginsDir: sc.pluginsDir, target, global: sc.global, names });
|
|
292
303
|
for (const action of res.actions) {
|
|
293
304
|
const tail = action.synced ? ui.meta(` -> ${res.target}`) : "";
|
|
294
|
-
console.log(`${ui.ok("synced")} ${ui.name(action.name)} ${ui.meta(`[${res.target}]`)}${tail}`);
|
|
305
|
+
console.log(`${action.synced ? ui.ok("synced") : ui.meta("not synced")} ${ui.name(action.name)} ${ui.meta(`[${res.target}]`)}${tail}`);
|
|
295
306
|
}
|
|
307
|
+
for (const failure of res.failures ?? [])
|
|
308
|
+
console.error(`${target}: ${failure.stage}: ${failure.message}`);
|
|
309
|
+
outcomes.push(runtimeOutcome([{ agent: target, affected: res.actions.filter((action) => action.synced).map((action) => action.name), skipped: Boolean(res.cliSkipped), failures: res.failures }]));
|
|
296
310
|
if (res.cliSkipped)
|
|
297
311
|
printCliUnavailableNote(target, `manifests were regenerated, but nothing was re-synced in ${target}.`);
|
|
298
312
|
}
|
|
313
|
+
return mergeCommandOutcomes(outcomes);
|
|
299
314
|
}
|
|
300
315
|
/**
|
|
301
316
|
* Re-fetch every scope in `resolveUpdateScopes(values)` and refresh its
|
|
@@ -316,6 +331,7 @@ async function runUpdateAcrossScopes(values, opts) {
|
|
|
316
331
|
source: opts.source,
|
|
317
332
|
all: values.all,
|
|
318
333
|
activate: true,
|
|
334
|
+
repair: values.repair,
|
|
319
335
|
agentScope: sc.agentScope,
|
|
320
336
|
scope: { label: sc.label, globalDir: globalPluginsDir() },
|
|
321
337
|
targets: opts.targets,
|
|
@@ -352,8 +368,7 @@ async function runPluginsVerb(verb, rest, cmd) {
|
|
|
352
368
|
return;
|
|
353
369
|
switch (verb) {
|
|
354
370
|
case "add": {
|
|
355
|
-
|
|
356
|
-
return;
|
|
371
|
+
return handleAdd(rest, cmd);
|
|
357
372
|
}
|
|
358
373
|
case "import-skills": {
|
|
359
374
|
const { values, positionals } = parseVerb(verb, cmd.flags, rest);
|
|
@@ -374,8 +389,7 @@ async function runPluginsVerb(verb, rest, cmd) {
|
|
|
374
389
|
return;
|
|
375
390
|
}
|
|
376
391
|
case "link": {
|
|
377
|
-
|
|
378
|
-
return;
|
|
392
|
+
return handleLink(rest, cmd);
|
|
379
393
|
}
|
|
380
394
|
case "disable":
|
|
381
395
|
case "enable": {
|
|
@@ -390,22 +404,16 @@ async function runPluginsVerb(verb, rest, cmd) {
|
|
|
390
404
|
const changed = result.changed.includes(name);
|
|
391
405
|
console.log(`${changed ? ui.ok(verb === "disable" ? "disabled" : "enabled") : ui.meta("already " + result.state)} ${ui.name(name)}`);
|
|
392
406
|
}
|
|
393
|
-
for (const
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
console.log(ui.meta(` ${result.state} in ${display}: ${agent.affected.join(", ")}`));
|
|
397
|
-
else if (agent.skipped)
|
|
398
|
-
console.log(ui.warn(` ${agent.agent} unavailable — run \`adg plugins sync --target ${agent.agent} ${result.order.join(" ")}\` later`));
|
|
399
|
-
}
|
|
400
|
-
return;
|
|
407
|
+
for (const line of renderAgentReport(result.agents, result.state))
|
|
408
|
+
console.log(line);
|
|
409
|
+
return runtimeOutcome(result.agents);
|
|
401
410
|
}
|
|
402
411
|
case "unlink": {
|
|
403
412
|
await handleUnlink(rest, cmd);
|
|
404
413
|
return;
|
|
405
414
|
}
|
|
406
415
|
case "sync": {
|
|
407
|
-
|
|
408
|
-
return;
|
|
416
|
+
return handleSync(rest, cmd);
|
|
409
417
|
}
|
|
410
418
|
case "update":
|
|
411
419
|
throw new Error("plugins update must be routed by runPlugins");
|
package/dist/src/cli/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export const FLAGS = {
|
|
|
29
29
|
as: { type: "string", hint: "<name>", help: "installed identity for a manifest-free structural source" },
|
|
30
30
|
prefix: { type: "string", hint: "<p>", help: "prefix imported skill names" },
|
|
31
31
|
verbose: { type: "boolean", short: "v", help: "expand each component to its member names" },
|
|
32
|
+
repair: { type: "boolean", help: "repair missing Codex registrations after updating; preserve runtime-disabled plugins" },
|
|
32
33
|
json: { type: "boolean", help: "print stable machine-readable JSON" },
|
|
33
34
|
};
|
|
34
35
|
// Scope flags recur on almost every command; name the group once.
|
|
@@ -92,8 +93,9 @@ export const PLUGIN_COMMANDS = {
|
|
|
92
93
|
"rescanned in place. In a terminal, it asks whether to update project, global,\n" +
|
|
93
94
|
"or both; pass a scope flag to skip the prompt.\n\n" +
|
|
94
95
|
"This is the plugins-domain twin of `adg skills update`.",
|
|
95
|
-
flags: ["all", ...SCOPE],
|
|
96
|
+
flags: ["all", "repair", ...SCOPE],
|
|
96
97
|
examples: [
|
|
98
|
+
"adg plugins update --global --repair # explicitly restore missing Codex registrations",
|
|
97
99
|
"adg plugins update # guided: project / global / both",
|
|
98
100
|
"adg plugins update --global # every global source",
|
|
99
101
|
"adg plugins update owner/repo # just one source",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Shared lock traversal for explicit enablement and scoped runtime recovery. */
|
|
2
|
+
export function dependencyOrder(lock, roots) {
|
|
3
|
+
const order = [];
|
|
4
|
+
const visited = new Set();
|
|
5
|
+
const active = new Set();
|
|
6
|
+
const visit = (name) => {
|
|
7
|
+
if (active.has(name))
|
|
8
|
+
throw new Error(`dependency cycle: ${name}`);
|
|
9
|
+
if (visited.has(name))
|
|
10
|
+
return;
|
|
11
|
+
const entry = lock.plugins[name];
|
|
12
|
+
if (!entry)
|
|
13
|
+
throw new Error(`missing installed dependency: ${name}`);
|
|
14
|
+
active.add(name);
|
|
15
|
+
for (const dependency of Object.keys(entry.dependencies ?? {}).sort())
|
|
16
|
+
visit(dependency);
|
|
17
|
+
active.delete(name);
|
|
18
|
+
visited.add(name);
|
|
19
|
+
order.push(name);
|
|
20
|
+
};
|
|
21
|
+
for (const root of roots)
|
|
22
|
+
visit(root);
|
|
23
|
+
return order;
|
|
24
|
+
}
|
|
@@ -90,7 +90,7 @@ function activateInstalled(opts, targets, installed, existingPlugins) {
|
|
|
90
90
|
parts.push(agent.activate(ctxFor(activateNames)));
|
|
91
91
|
if (refreshNames.length > 0)
|
|
92
92
|
parts.push(agent.refresh(ctxFor(refreshNames)));
|
|
93
|
-
return parts.reduce((acc, result) => ({ agent: result.agent, affected: [...acc.affected, ...result.affected], skipped: acc.skipped && result.skipped }), { agent: agent.id, affected: [], skipped: true });
|
|
93
|
+
return parts.reduce((acc, result) => ({ agent: result.agent, affected: [...acc.affected, ...result.affected], skipped: acc.skipped && result.skipped, ...((acc.failures?.length || result.failures?.length) ? { failures: [...(acc.failures ?? []), ...(result.failures ?? [])] } : {}) }), { agent: agent.id, affected: [], skipped: true });
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
@@ -32,5 +32,5 @@ export function linkPlugins(opts) {
|
|
|
32
32
|
for (const a of actions)
|
|
33
33
|
if (res.affected.includes(a.name))
|
|
34
34
|
a.linkedTo = agent.displayName;
|
|
35
|
-
return { target: opts.target, actions, cliSkipped: res.skipped };
|
|
35
|
+
return { target: opts.target, actions, cliSkipped: res.skipped, ...(res.failures?.length ? { failures: res.failures } : {}) };
|
|
36
36
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { repairCodex } from "./runtime-repair.js";
|
|
2
|
+
import { getAgent, resolveAgents, allAgents } from "../agents/index.js";
|
|
1
3
|
import { gitRemoteRevision } from "../sources.js";
|
|
2
4
|
import { cloneGitHub, gitRevision, parseGitHubSource } from "../sources.js";
|
|
3
5
|
import { materializeSource, resolveRemoteRevision } from "../remote/index.js";
|
|
@@ -90,6 +92,12 @@ export function mergeAgentResults(groups) {
|
|
|
90
92
|
// If any pass ran, the agent was processed — matches addPlugins' merge so
|
|
91
93
|
// a skipped local rescan can't mask a successful remote re-activation.
|
|
92
94
|
existing.skipped = existing.skipped && r.skipped;
|
|
95
|
+
if (r.failures?.length)
|
|
96
|
+
existing.failures = [...(existing.failures ?? []), ...r.failures];
|
|
97
|
+
for (const field of ["verified", "unverified", "preservedDisabled"]) {
|
|
98
|
+
if (r[field] !== undefined)
|
|
99
|
+
existing[field] = [...new Set([...(existing[field] ?? []), ...r[field]])];
|
|
100
|
+
}
|
|
93
101
|
}
|
|
94
102
|
else {
|
|
95
103
|
merged.set(r.agent, { ...r, affected: [...r.affected] });
|
|
@@ -114,6 +122,14 @@ export async function updatePlugins(opts) {
|
|
|
114
122
|
if (opts.source && !remoteGroups[0].remote) {
|
|
115
123
|
throw new Error(`source "${opts.source}" is local and cannot be re-synced; re-run \`adg plugins add\`.`);
|
|
116
124
|
}
|
|
125
|
+
const repairAgent = opts.agents
|
|
126
|
+
? opts.agents.find((agent) => agent.id === "codex") ?? null
|
|
127
|
+
: getAgent("codex");
|
|
128
|
+
const repairScope = opts.agentScope ?? "project";
|
|
129
|
+
const initial = opts.repair ? repairAgent?.inspectPlugins?.({ pluginsDir: opts.pluginsDir, plugins: [], scope: repairScope }) : undefined;
|
|
130
|
+
// Source materialization proceeds, but this mode owns every Codex mutation.
|
|
131
|
+
const updateAgents = opts.repair ? (opts.agents ?? resolveAgents(opts.targets)).filter((agent) => agent.id !== "codex") : opts.agents;
|
|
132
|
+
const removalAgents = opts.repair ? (opts.deactivationAgents ?? allAgents()).filter((agent) => agent.id !== "codex") : opts.deactivationAgents;
|
|
117
133
|
const now = opts.now ?? new Date().toISOString();
|
|
118
134
|
const remote = [];
|
|
119
135
|
const remoteAgents = [];
|
|
@@ -189,8 +205,8 @@ export async function updatePlugins(opts) {
|
|
|
189
205
|
...(request.defaultDescription ? { defaultDescription: request.defaultDescription } : {}),
|
|
190
206
|
activate: opts.activate,
|
|
191
207
|
scope: opts.agentScope,
|
|
192
|
-
agents:
|
|
193
|
-
deactivationAgents:
|
|
208
|
+
agents: updateAgents,
|
|
209
|
+
deactivationAgents: removalAgents,
|
|
194
210
|
now,
|
|
195
211
|
preparedSourceDir: checkout,
|
|
196
212
|
preparedResolvedRevision: resolvedRevision,
|
|
@@ -238,11 +254,22 @@ export async function updatePlugins(opts) {
|
|
|
238
254
|
only: localNames,
|
|
239
255
|
resync: opts.activate,
|
|
240
256
|
scope: opts.agentScope,
|
|
241
|
-
agents:
|
|
257
|
+
agents: updateAgents,
|
|
242
258
|
...(opts.onProgress ? { onProgress: opts.onProgress } : {}),
|
|
243
259
|
})
|
|
244
260
|
: { results: [], missing: [] };
|
|
245
|
-
const
|
|
261
|
+
const repairNames = [...new Set([...remoteGroups.flatMap((group) => group.installed), ...remote.flatMap((source) => [...source.updated, ...source.unchanged]), ...localNames])];
|
|
262
|
+
const currentLock = readLock(lockPath(opts.pluginsDir));
|
|
263
|
+
const repairs = opts.repair ? [repairCodex({
|
|
264
|
+
pluginsDir: opts.pluginsDir,
|
|
265
|
+
plugins: repairNames.filter((name) => currentLock.plugins[name]),
|
|
266
|
+
scope: opts.agentScope ?? "project",
|
|
267
|
+
}, false, repairAgent, {
|
|
268
|
+
initial, observed: true,
|
|
269
|
+
changed: [...remote.flatMap((source) => source.updated), ...local.results.filter((plugin) => plugin.changed).map((plugin) => plugin.name)],
|
|
270
|
+
removed: repairNames.filter((name) => !currentLock.plugins[name]),
|
|
271
|
+
})] : [];
|
|
272
|
+
const agents = mergeAgentResults([remoteAgents, local.agents ?? [], repairs]);
|
|
246
273
|
return { remote, local, agents };
|
|
247
274
|
}
|
|
248
275
|
/** Uninstall every plugin that came from a given source (and from the agents). */
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { getAgent, agentsForComponents } from "../agents/index.js";
|
|
2
|
+
import { selectInstalled, rematerializeInstalled } from "./projection.js";
|
|
3
|
+
import { dependencyOrder } from "./dependency-order.js";
|
|
4
|
+
import { readLock } from "../lock.js";
|
|
5
|
+
import { lockPath } from "../paths.js";
|
|
6
|
+
import { pluginState } from "../types.js";
|
|
7
|
+
import { getTracer, recordTelemetryEvent } from "../telemetry.js";
|
|
8
|
+
/** Both status and planning interpret records from an already-scoped snapshot. */
|
|
9
|
+
export function runtimeDifference(names, records) {
|
|
10
|
+
const byName = new Map(records.map((record) => [record.name, record]));
|
|
11
|
+
return {
|
|
12
|
+
runtimeMissing: names.filter((name) => !byName.get(name)?.installed),
|
|
13
|
+
runtimeDisabled: names.filter((name) => byName.get(name)?.installed && !byName.get(name)?.enabled),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function registrationPlan(names, records, enableDisabled, changed = []) {
|
|
17
|
+
const difference = runtimeDifference(names, records);
|
|
18
|
+
const missing = new Set(difference.runtimeMissing);
|
|
19
|
+
const disabled = new Set(difference.runtimeDisabled);
|
|
20
|
+
const changedSet = new Set(changed);
|
|
21
|
+
return {
|
|
22
|
+
targets: names.filter((name) => missing.has(name) || (disabled.has(name) ? enableDisabled : changedSet.has(name))),
|
|
23
|
+
preservedDisabled: enableDisabled ? [] : difference.runtimeDisabled,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Preserve execution facts while recording whether the runtime confirmed them. */
|
|
27
|
+
export function verifyRegistrations(result, snapshot) {
|
|
28
|
+
const valid = Array.isArray(snapshot)
|
|
29
|
+
? new Set(snapshot.filter((record) => record.installed && record.enabled).map((record) => record.name))
|
|
30
|
+
: undefined;
|
|
31
|
+
const verified = result.affected.filter((name) => valid?.has(name));
|
|
32
|
+
const unverified = result.affected.filter((name) => !valid?.has(name));
|
|
33
|
+
const failures = unverified.map((plugin) => ({
|
|
34
|
+
plugin, stage: "verify",
|
|
35
|
+
errorType: valid ? "REGISTRATION_MISSING" : "STATE_UNAVAILABLE",
|
|
36
|
+
message: Array.isArray(snapshot)
|
|
37
|
+
? "Codex did not report the plugin installed and enabled after execution."
|
|
38
|
+
: snapshot?.error ?? "Installation finished, but Codex state could not be verified.",
|
|
39
|
+
}));
|
|
40
|
+
return { ...result, verified, unverified, ...(failures.length ? { failures: [...(result.failures ?? []), ...failures] } : {}) };
|
|
41
|
+
}
|
|
42
|
+
/** Execute one scoped plan, preserving runtime overrides and dependency boundaries. */
|
|
43
|
+
export function repairCodex(ctx, enableDisabled, agent = getAgent("codex"), options = {}) {
|
|
44
|
+
return getTracer().startActiveSpan("adg.codex.registration_repair", (span) => {
|
|
45
|
+
const result = { agent: "codex", affected: [], skipped: false, verified: [], unverified: [] };
|
|
46
|
+
const fail = (stage, errorType, message, plugin) => {
|
|
47
|
+
(result.failures ??= []).push({ stage, errorType, message, ...(plugin ? { plugin } : {}) });
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
if (!ctx.plugins.length && !options.removed?.length)
|
|
51
|
+
return result;
|
|
52
|
+
const plugins = ctx.plugins.length ? selectInstalled(ctx.pluginsDir, ctx.plugins).filter((plugin) => pluginState(plugin) === "enabled" && agentsForComponents(Object.entries(plugin.contents ?? {})
|
|
53
|
+
.filter(([, members]) => members.length > 0).map(([type]) => type)).some((a) => a.id === "codex")) : [];
|
|
54
|
+
const names = plugins.map((plugin) => plugin.name);
|
|
55
|
+
const inspect = () => agent?.inspectPlugins?.({ ...ctx, plugins: names });
|
|
56
|
+
const first = options.observed ? options.initial : inspect();
|
|
57
|
+
if (!Array.isArray(first)) {
|
|
58
|
+
fail("inspect", "STATE_UNAVAILABLE", first?.error ?? "Codex detailed state is unavailable; install a supported CLI.");
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
const planned = registrationPlan(names, first, enableDisabled, options.changed);
|
|
62
|
+
result.preservedDisabled = planned.preservedDisabled;
|
|
63
|
+
const removals = options.removed?.filter((name) => first.some((record) => record.name === name && record.installed)) ?? [];
|
|
64
|
+
if (!planned.targets.length && !removals.length)
|
|
65
|
+
return result;
|
|
66
|
+
const current = inspect();
|
|
67
|
+
if (!Array.isArray(current)) {
|
|
68
|
+
fail("inspect", "STATE_UNAVAILABLE", current?.error ?? "Codex state became unavailable before repair.");
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
const latest = registrationPlan(planned.targets, current, enableDisabled, options.changed);
|
|
72
|
+
result.preservedDisabled = [...new Set([...planned.preservedDisabled, ...latest.preservedDisabled])];
|
|
73
|
+
const selected = new Set(latest.targets);
|
|
74
|
+
const lock = readLock(lockPath(ctx.pluginsDir));
|
|
75
|
+
const ordered = [];
|
|
76
|
+
const blocked = new Set();
|
|
77
|
+
for (const name of latest.targets) {
|
|
78
|
+
try {
|
|
79
|
+
for (const dependency of dependencyOrder(lock, [name]))
|
|
80
|
+
if (selected.has(dependency) && !ordered.includes(dependency))
|
|
81
|
+
ordered.push(dependency);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
blocked.add(name);
|
|
85
|
+
fail("install", "DEPENDENCY_INVALID", error instanceof Error ? error.message : String(error), name);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const byName = new Map(plugins.map((plugin) => [plugin.name, plugin]));
|
|
89
|
+
const available = new Set(current.filter((record) => record.installed && record.enabled).map((record) => record.name));
|
|
90
|
+
for (const name of ordered) {
|
|
91
|
+
if (blocked.has(name))
|
|
92
|
+
continue;
|
|
93
|
+
const dependency = Object.keys(lock.plugins[name]?.dependencies ?? {}).find((dep) => blocked.has(dep) || !available.has(dep));
|
|
94
|
+
if (dependency) {
|
|
95
|
+
blocked.add(name);
|
|
96
|
+
fail("install", "DEPENDENCY_UNAVAILABLE", `Required dependency ${dependency} is unavailable; no installation was attempted.`, name);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
rematerializeInstalled(ctx.pluginsDir, [byName.get(name)]);
|
|
101
|
+
const installed = agent.activate({ ...ctx, plugins: [name] });
|
|
102
|
+
result.affected.push(...installed.affected);
|
|
103
|
+
if (installed.failures?.length)
|
|
104
|
+
(result.failures ??= []).push(...installed.failures);
|
|
105
|
+
if (!installed.affected.includes(name) || installed.failures?.length || installed.skipped) {
|
|
106
|
+
blocked.add(name);
|
|
107
|
+
if (!installed.failures?.length)
|
|
108
|
+
fail("install", "INSTALLATION_INCOMPLETE", "Codex did not complete installation.", name);
|
|
109
|
+
}
|
|
110
|
+
else
|
|
111
|
+
available.add(name);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
blocked.add(name);
|
|
115
|
+
fail("install", "PROJECTION_FAILED", error instanceof Error ? error.message : String(error), name);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const removeNow = removals.filter((name) => current.some((record) => record.name === name && record.installed));
|
|
119
|
+
if (removeNow.length) {
|
|
120
|
+
const removed = agent.deactivate({ ...ctx, plugins: removeNow });
|
|
121
|
+
if (removed.failures?.length)
|
|
122
|
+
(result.failures ??= []).push(...removed.failures);
|
|
123
|
+
}
|
|
124
|
+
if (!result.affected.length && !removeNow.length)
|
|
125
|
+
return result;
|
|
126
|
+
const verified = inspect();
|
|
127
|
+
Object.assign(result, verifyRegistrations(result, verified));
|
|
128
|
+
if (Array.isArray(verified)) {
|
|
129
|
+
for (const name of removeNow)
|
|
130
|
+
if (verified.some((record) => record.name === name && record.installed))
|
|
131
|
+
fail("verify", "REMOVAL_UNVERIFIED", "Codex still reports the removed plugin installed.", name);
|
|
132
|
+
}
|
|
133
|
+
else if (removeNow.length && !result.affected.length) {
|
|
134
|
+
fail("verify", "STATE_UNAVAILABLE", verified?.error ?? "Codex removal could not be verified.");
|
|
135
|
+
}
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
recordTelemetryEvent("adg.codex.registration_repair", {
|
|
140
|
+
"repair.affected_count": result.affected.length,
|
|
141
|
+
"repair.verified_count": result.verified?.length ?? 0,
|
|
142
|
+
"repair.failure_count": result.failures?.length ?? 0,
|
|
143
|
+
"repair.preserved_disabled_count": result.preservedDisabled?.length ?? 0,
|
|
144
|
+
}, span);
|
|
145
|
+
span.end();
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { dependencyOrder } from "./dependency-order.js";
|
|
2
|
+
import { repairCodex } from "./runtime-repair.js";
|
|
1
3
|
import { listPlugins } from "./list.js";
|
|
2
4
|
import { agentsForComponents, resolveAgents } from "../agents/index.js";
|
|
3
5
|
import { lockPath } from "../paths.js";
|
|
@@ -20,24 +22,6 @@ function enabledDependents(lock, names) {
|
|
|
20
22
|
.map(([name]) => name)
|
|
21
23
|
.sort();
|
|
22
24
|
}
|
|
23
|
-
function enableOrder(lock, roots) {
|
|
24
|
-
const order = [];
|
|
25
|
-
const seen = new Set();
|
|
26
|
-
const visit = (name) => {
|
|
27
|
-
if (seen.has(name))
|
|
28
|
-
return;
|
|
29
|
-
seen.add(name);
|
|
30
|
-
const entry = lock.plugins[name];
|
|
31
|
-
if (!entry)
|
|
32
|
-
throw new Error(`missing installed dependency: ${name}`);
|
|
33
|
-
for (const dependency of Object.keys(entry.dependencies ?? {}).sort())
|
|
34
|
-
visit(dependency);
|
|
35
|
-
order.push(name);
|
|
36
|
-
};
|
|
37
|
-
for (const root of roots)
|
|
38
|
-
visit(root);
|
|
39
|
-
return order;
|
|
40
|
-
}
|
|
41
25
|
function pluginAgentIds(plugins, name) {
|
|
42
26
|
const plugin = plugins.find((item) => item.name === name);
|
|
43
27
|
const types = Object.entries(plugin?.contents ?? {})
|
|
@@ -62,7 +46,7 @@ export function disablePlugins(opts) {
|
|
|
62
46
|
}
|
|
63
47
|
export function enablePlugins(opts) {
|
|
64
48
|
const { lock, names } = selectedLock(opts);
|
|
65
|
-
const order =
|
|
49
|
+
const order = dependencyOrder(lock, names);
|
|
66
50
|
const changed = order.filter((name) => pluginState(lock.plugins[name]) !== "enabled");
|
|
67
51
|
for (const name of changed) {
|
|
68
52
|
const entry = lock.plugins[name];
|
|
@@ -83,6 +67,8 @@ export function enablePlugins(opts) {
|
|
|
83
67
|
if (changed.length > 0)
|
|
84
68
|
writeLock(lockPath(opts.pluginsDir), updatedLock);
|
|
85
69
|
const agents = (opts.agents ?? resolveAgents()).map((agent) => {
|
|
70
|
+
if (agent.id === "codex" && agent.inspectPlugins)
|
|
71
|
+
return repairCodex({ pluginsDir: opts.pluginsDir, plugins: order, scope: opts.scope }, true, agent);
|
|
86
72
|
const compatible = changed.filter((name) => pluginAgentIds(plugins, name).has(agent.id));
|
|
87
73
|
if (compatible.length === 0)
|
|
88
74
|
return { agent: agent.id, affected: [], skipped: false };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { runtimeDifference } from "./runtime-repair.js";
|
|
1
2
|
import { existsSync } from "node:fs";
|
|
2
3
|
import { listPlugins } from "./list.js";
|
|
3
4
|
import { allAgents, isAgentListFailure, resolveAgents } from "../agents/index.js";
|
|
@@ -16,7 +17,10 @@ export function pluginStatus(opts) {
|
|
|
16
17
|
const agents = opts.agents ?? (opts.targets ? resolveAgents(opts.targets) : allAgents());
|
|
17
18
|
const hasProjectLock = existsSync(lockPath(opts.pluginsDir));
|
|
18
19
|
return agents.map((a) => {
|
|
19
|
-
const
|
|
20
|
+
const ctx = { pluginsDir: opts.pluginsDir, plugins: [], scope: opts.scope };
|
|
21
|
+
const inspection = a.inspectPlugins?.(ctx);
|
|
22
|
+
const details = Array.isArray(inspection) ? runtimeDifference(enabled, inspection) : undefined;
|
|
23
|
+
const installed = a.inspectPlugins ? (Array.isArray(inspection) ? inspection.filter((record) => record.installed && record.enabled).map((record) => record.name) : inspection) : a.listInstalled?.(ctx);
|
|
20
24
|
if (installed === undefined) {
|
|
21
25
|
return { id: a.id, displayName: a.displayName, queryable: false, inSync: [], missing: [], agentOnly: [], disabled: [], unexpectedlyEnabled: [] };
|
|
22
26
|
}
|
|
@@ -45,6 +49,7 @@ export function pluginStatus(opts) {
|
|
|
45
49
|
id: a.id,
|
|
46
50
|
displayName: a.displayName,
|
|
47
51
|
queryable: true,
|
|
52
|
+
...details,
|
|
48
53
|
inSync: enabled.filter((n) => agentSet.has(n)),
|
|
49
54
|
missing: enabled.filter((n) => !agentSet.has(n)),
|
|
50
55
|
agentOnly,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { verifyRegistrations } from "./runtime-repair.js";
|
|
1
2
|
import { adaptedFilesForTarget, rematerializeInstalled, selectInstalled } from "./projection.js";
|
|
2
3
|
import { getAgent } from "../agents/index.js";
|
|
3
4
|
import { pluginState } from "../types.js";
|
|
@@ -24,8 +25,17 @@ export function syncPlugins(opts) {
|
|
|
24
25
|
...(opts.target === "codex" ? { reconcileLegacyAliases: true } : {}),
|
|
25
26
|
})] : []),
|
|
26
27
|
];
|
|
28
|
+
if (opts.target === "codex" && agent.inspectPlugins && enabled.length && !parts.every((part) => part.skipped)) {
|
|
29
|
+
const snapshot = agent.inspectPlugins({ pluginsDir: opts.pluginsDir, plugins: enabled.map((plugin) => plugin.name), scope });
|
|
30
|
+
for (let index = 0; index < parts.length; index++) {
|
|
31
|
+
const part = parts[index];
|
|
32
|
+
const enabledNames = new Set(enabled.map((plugin) => plugin.name));
|
|
33
|
+
const checked = verifyRegistrations({ ...part, affected: part.affected.filter((name) => enabledNames.has(name)) }, snapshot);
|
|
34
|
+
parts[index] = { ...checked, affected: part.affected };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
27
37
|
for (const action of actions)
|
|
28
|
-
if (parts.some((part) => part.affected.includes(action.name)))
|
|
38
|
+
if (parts.some((part) => part.affected.includes(action.name)) && !parts.some((part) => part.failures?.some((failure) => failure.plugin === action.name)))
|
|
29
39
|
action.synced = true;
|
|
30
|
-
return { target: opts.target, actions, cliSkipped: parts.length > 0 && parts.every((part) => part.skipped) };
|
|
40
|
+
return { target: opts.target, actions, cliSkipped: parts.length > 0 && parts.every((part) => part.skipped), ...(parts.some((part) => part.failures?.length) ? { failures: parts.flatMap((part) => part.failures ?? []) } : {}) };
|
|
31
41
|
}
|
|
@@ -26,8 +26,15 @@ export function renderAgentReport(agents, verb) {
|
|
|
26
26
|
const out = [];
|
|
27
27
|
for (const r of agents ?? []) {
|
|
28
28
|
const name = getAgent(r.agent)?.displayName ?? r.agent;
|
|
29
|
-
|
|
30
|
-
out.push(`${
|
|
29
|
+
for (const failure of r.failures ?? [])
|
|
30
|
+
out.push(ui.err(`${r.agent}: ${failure.stage}${failure.plugin ? ` ${failure.plugin}` : ""}: ${failure.message}`));
|
|
31
|
+
const completed = r.verified ?? r.affected;
|
|
32
|
+
if (completed.length > 0)
|
|
33
|
+
out.push(`${ui.ok(verb)} in ${ui.name(name)}: ${completed.join(", ")}`);
|
|
34
|
+
if (r.unverified?.length)
|
|
35
|
+
out.push(ui.warn(`installed, recovery unverified in ${name}: ${r.unverified.join(", ")}`));
|
|
36
|
+
if (r.preservedDisabled?.length)
|
|
37
|
+
out.push(ui.meta(`runtime disabled, preserved in ${name}: ${r.preservedDisabled.join(", ")}; use enable or sync to activate`));
|
|
31
38
|
else if (r.skipped)
|
|
32
39
|
out.push(ui.warn(`note: \`${r.agent}\` CLI not found — run \`adg plugins link --target ${r.agent}\` after installing it.`));
|
|
33
40
|
}
|
|
@@ -147,6 +154,10 @@ export function renderStatus(statuses) {
|
|
|
147
154
|
out.push(ui.warn(` missing (${s.missing.length}): ${s.missing.join(", ")}`));
|
|
148
155
|
out.push(ui.meta(` → adg plugins sync --target ${s.id} ${s.missing.join(" ")}`));
|
|
149
156
|
}
|
|
157
|
+
if (s.runtimeMissing?.length)
|
|
158
|
+
out.push(ui.warn(` registration missing: ${s.runtimeMissing.join(", ")}`));
|
|
159
|
+
if (s.runtimeDisabled?.length)
|
|
160
|
+
out.push(ui.meta(` runtime disabled (preserved by update --repair): ${s.runtimeDisabled.join(", ")}`));
|
|
150
161
|
if (s.agentOnly.length > 0) {
|
|
151
162
|
out.push(ui.warn(` in agent only (${s.agentOnly.length}): ${s.agentOnly.join(", ")}`));
|
|
152
163
|
out.push(ui.meta(` → if ADG-managed, adg plugins unlink --target ${s.id} <name> (else ignore)`));
|
package/docs/cli-json.md
CHANGED
|
@@ -118,6 +118,9 @@ Field notes:
|
|
|
118
118
|
store-disabled plugins absent from the runtime as intended;
|
|
119
119
|
`unexpectedlyEnabled` contains disabled plugins still active in that runtime.
|
|
120
120
|
`agentOnly` remains reserved for runtime plugins absent from the store.
|
|
121
|
+
Codex detailed queries additionally expose `runtimeMissing` and
|
|
122
|
+
`runtimeDisabled`, splitting the existing `missing` array without changing it.
|
|
123
|
+
Other agents may omit these optional fields.
|
|
121
124
|
Content drift is not represented; use `adg plugins sync` when a full runtime
|
|
122
125
|
refresh is required.
|
|
123
126
|
|
|
@@ -95,9 +95,9 @@ For project installs, the Claude entry uses `scope: "project"` and records a
|
|
|
95
95
|
|
|
96
96
|
## Other Runtimes
|
|
97
97
|
|
|
98
|
-
Codex
|
|
99
|
-
`link --target codex`
|
|
100
|
-
|
|
98
|
+
Codex discovers ADG's marketplace, but loads plugins only after runtime
|
|
99
|
+
registration through its CLI. Use `link --target codex` for registration and
|
|
100
|
+
`sync --target codex` for a complete refresh.
|
|
101
101
|
|
|
102
102
|
Antigravity imports from ADG's generated `.antigravity-plugin/` projection.
|
|
103
103
|
Use `link --target antigravity` for first registration and `sync --target
|
|
@@ -142,3 +142,46 @@ runtime projections, and activates the plugin in each compatible runtime.
|
|
|
142
142
|
`unlink --target <runtime>` is different: it is a temporary per-runtime override
|
|
143
143
|
and does not change store state. A later `sync` restores the store's enabled or
|
|
144
144
|
disabled state. `remove` deletes the payload and catalog entry entirely.
|
|
145
|
+
|
|
146
|
+
## Codex Registration Recovery
|
|
147
|
+
|
|
148
|
+
`adg plugins status --target codex --global --json` preserves the existing
|
|
149
|
+
`missing` field and adds `runtimeMissing` (not installed) and `runtimeDisabled`
|
|
150
|
+
(installed but disabled). Queries do not rewrite the catalog or Codex config.
|
|
151
|
+
Query failures mean unknown state, not an empty installation.
|
|
152
|
+
|
|
153
|
+
Use `adg plugins enable <name> --global` to explicitly restore an enabled plugin,
|
|
154
|
+
including a missing registration or runtime disablement. Healthy registrations
|
|
155
|
+
are not reinstalled. `adg plugins update --global --repair` updates sources and
|
|
156
|
+
then repairs missing Codex registrations using the existing local snapshots;
|
|
157
|
+
it preserves runtime-disabled plugins even when their source changes. Enabled
|
|
158
|
+
plugins whose contents changed are refreshed through the same verified execution
|
|
159
|
+
plan. Ordinary `update` does not repair an
|
|
160
|
+
intentional `unlink`. `sync` explicitly reconciles the complete desired state.
|
|
161
|
+
|
|
162
|
+
Repair honors stored component selections and dependencies. Installation and
|
|
163
|
+
verification failures are reported individually; partial failure exits nonzero
|
|
164
|
+
without rolling back successful installations. Other runtimes retain their
|
|
165
|
+
existing behavior. CLI diagnostics are local output, not telemetry payloads.
|
|
166
|
+
|
|
167
|
+
### Official Account Switch Investigation
|
|
168
|
+
|
|
169
|
+
The relationship between official Codex account switching and registration
|
|
170
|
+
loss is unconfirmed. Capture scoped plugin status before switching, immediately
|
|
171
|
+
after switching, after restarting and opening a new conversation, and after
|
|
172
|
+
explicit repair. Compare only ADG plugin/marketplace settings and cache presence;
|
|
173
|
+
keep any config backup private and redact paths in shared evidence. Never collect
|
|
174
|
+
`auth.json`, credentials, account identifiers, or raw config in telemetry.
|
|
175
|
+
Registration recovery does not guarantee that an existing desktop conversation
|
|
176
|
+
refreshes its skills; verify discovery in a new conversation.
|
|
177
|
+
|
|
178
|
+
In repair mode, Codex state is observed before source updates. Other runtimes
|
|
179
|
+
retain their normal update behavior; Codex writes are deferred until a scoped
|
|
180
|
+
plan is ready. An unavailable snapshot allows source materialization but blocks
|
|
181
|
+
Codex installation, refresh, and cleanup, producing a nonzero result.
|
|
182
|
+
|
|
183
|
+
Dependencies are processed first. A dependency outside the selected scope is
|
|
184
|
+
checked, not automatically installed; unavailable or failed dependencies block
|
|
185
|
+
their dependents while independent plugins continue. Explicit `enable` includes
|
|
186
|
+
its dependency closure. Execution success and post-operation verification are
|
|
187
|
+
reported separately: an unverified installation is never displayed as enabled.
|
package/package.json
CHANGED