@rbbtsn0w/adg 0.11.0 → 0.11.1-dev.pr200.c6ce45e
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/README.md +131 -73
- package/dist/src/agents/antigravity.js +218 -45
- package/dist/src/agents/base.js +1 -1
- package/dist/src/agents/claude.js +98 -38
- package/dist/src/agents/codex.js +32 -42
- package/dist/src/cli/core-plugin-handlers.js +3 -3
- package/dist/src/cli/handlers.js +171 -39
- package/dist/src/cli/index.js +23 -14
- package/dist/src/cli/review-update.js +80 -0
- package/dist/src/commands/install/default-dsl.js +1 -1
- package/dist/src/commands/install/discovery.js +3 -1
- package/dist/src/commands/install/install-one.js +41 -31
- package/dist/src/commands/install.js +59 -24
- package/dist/src/commands/marketplace.js +171 -115
- package/dist/src/commands/migrate.js +2 -2
- package/dist/src/commands/projection.js +3 -1
- package/dist/src/commands/remove.js +10 -0
- package/dist/src/commands/review-executables.js +106 -0
- package/dist/src/commands/select-agents.js +2 -2
- package/dist/src/commands/select-components.js +2 -2
- package/dist/src/commands/select-plugins.js +15 -2
- package/dist/src/commands/select-scope.js +3 -4
- package/dist/src/commands/source-upgrade.js +552 -0
- package/dist/src/commands/state.js +3 -1
- package/dist/src/commands/status.js +1 -0
- package/dist/src/commands/update.js +3 -1
- package/dist/src/lock.js +13 -5
- package/dist/src/migration-transaction.js +1011 -0
- package/dist/src/native-retry.js +329 -0
- package/dist/src/process-identity.js +88 -0
- package/dist/src/render/plugins.js +149 -27
- package/dist/src/render/ui.js +4 -4
- package/dist/src/source-history.js +194 -0
- package/dist/src/source-intent.js +7 -0
- package/dist/src/store-mutex.js +179 -0
- package/dist/src/types.js +1 -1
- package/dist/src/update-executables.js +193 -0
- package/dist/src/upgrade-plan.js +378 -0
- package/docs/agents/antigravity.md +5 -0
- package/docs/agents-spec.md +10 -0
- package/docs/branching-and-release.md +369 -55
- package/docs/cli-json.md +9 -0
- package/docs/marketing/README.md +211 -0
- package/docs/marketing/assets.json +228 -0
- package/docs/marketing/capture.json +130 -0
- package/docs/marketing/live-readiness.json +353 -0
- package/docs/marketing/posts.en.md +94 -0
- package/docs/marketing/posts.zh-CN.md +67 -0
- package/docs/marketing/production.md +210 -0
- package/docs/marketing/source/timeline.json +29 -0
- package/docs/marketing/source/workflow-01.svg +16 -0
- package/docs/marketing/source/workflow-02.svg +14 -0
- package/docs/marketing/source/workflow-03.svg +19 -0
- package/docs/marketing/source/workflow-poster.svg +32 -0
- package/docs/marketing/transcript.md +48 -0
- package/docs/plugin-update-semantics.md +53 -10
- package/docs/plugin-upgrade-migrations.md +349 -0
- package/package.json +14 -10
- package/schemas/plugin-lock.schema.json +78 -1
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { exposedContents } from "./components.js";
|
|
3
|
+
import { COMPONENT_TYPES } from "./types.js";
|
|
4
|
+
function sameSource(a, b) {
|
|
5
|
+
return a.type === "github" && b.type === "github" && a.repo.toLowerCase() === b.repo.toLowerCase() && a.ref === b.ref;
|
|
6
|
+
}
|
|
7
|
+
const unique = (items) => [...new Set(items)].sort();
|
|
8
|
+
const enabledState = (plugin) => plugin.state ?? "enabled";
|
|
9
|
+
export function historyIdentity(plugin) {
|
|
10
|
+
return "history-" + createHash("sha256").update(JSON.stringify([
|
|
11
|
+
plugin.name, plugin.version, plugin.sourceHash, plugin.contents, plugin.selection,
|
|
12
|
+
])).digest("hex");
|
|
13
|
+
}
|
|
14
|
+
function historicalSnapshot(plugin) {
|
|
15
|
+
return { name: plugin.name, version: plugin.version, origin: plugin.origin, contents: plugin.contents,
|
|
16
|
+
sourceHash: plugin.sourceHash, selection: plugin.selection, selectionKnown: plugin.selectionKnown,
|
|
17
|
+
effectiveSelection: plugin.effectiveSelection, state: plugin.state, evidence: plugin.evidence };
|
|
18
|
+
}
|
|
19
|
+
/** Resolve existing marketplace identity metadata before touching any installation. */
|
|
20
|
+
export function resolveRenames(renames, names) {
|
|
21
|
+
const result = new Map();
|
|
22
|
+
for (const former of Object.keys(renames)) {
|
|
23
|
+
const seen = new Set();
|
|
24
|
+
let name = former;
|
|
25
|
+
while (name !== null && Object.hasOwn(renames, name)) {
|
|
26
|
+
if (seen.has(name))
|
|
27
|
+
throw new Error(`Marketplace rename cycle: ${former}`);
|
|
28
|
+
seen.add(name);
|
|
29
|
+
name = renames[name];
|
|
30
|
+
}
|
|
31
|
+
if (name !== null && !names.has(name))
|
|
32
|
+
throw new Error(`Missing marketplace rename destination: ${name}`);
|
|
33
|
+
result.set(former, name);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
/** Plan from client-owned installation evidence and an ordinary current catalog. */
|
|
38
|
+
export function planMigration(options) {
|
|
39
|
+
const result = { applied: [], destinations: [], retired: [], retained: [], decisions: [], blockers: [], deferredRecovery: [] };
|
|
40
|
+
const current = new Map(options.installed.filter(p => sameSource(p.origin, options.source)).map(p => [p.name, p]));
|
|
41
|
+
const history = new Map((options.history ?? []).filter(p => sameSource(p.origin, options.source)).map(p => [p.name, p]));
|
|
42
|
+
const candidates = new Map(options.candidates.map(p => [p.name, p]));
|
|
43
|
+
let renames;
|
|
44
|
+
try {
|
|
45
|
+
renames = resolveRenames(options.renames ?? {}, new Set(candidates.keys()));
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
result.blockers.push(error.message);
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
const destinations = new Map();
|
|
52
|
+
const states = new Map();
|
|
53
|
+
const incoming = new Map();
|
|
54
|
+
const ownSelections = new Map();
|
|
55
|
+
const renamedFrom = new Map();
|
|
56
|
+
const visible = new Set([...current.values()].flatMap(p => exposedContents(p.contents, p.effectiveSelection ?? p.selection).skills));
|
|
57
|
+
const requestedSelectionFor = (name) => {
|
|
58
|
+
const candidate = candidates.get(name);
|
|
59
|
+
if (candidate && Object.hasOwn(candidate, "requestedSelection"))
|
|
60
|
+
return candidate.requestedSelection ?? undefined;
|
|
61
|
+
const existing = current.get(name);
|
|
62
|
+
return existing?.selection ?? (existing?.selectionKnown === false ? existing.effectiveSelection ?? { components: [] } : undefined);
|
|
63
|
+
};
|
|
64
|
+
const ensure = (name, predecessor, full = false) => {
|
|
65
|
+
const unrelated = options.installed.find(p => p.name === name && !sameSource(p.origin, options.source));
|
|
66
|
+
if (unrelated) {
|
|
67
|
+
result.blockers.push(`Destination belongs to a different source: ${name}`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const existing = current.get(name);
|
|
71
|
+
const existingSelection = requestedSelectionFor(name);
|
|
72
|
+
let dest = destinations.get(name);
|
|
73
|
+
if (!dest) {
|
|
74
|
+
dest = { name, state: enabledState(existing ?? predecessor), predecessors: [],
|
|
75
|
+
...(existingSelection ? { selection: structuredClone(existingSelection) }
|
|
76
|
+
: existing || full ? {} : { selection: { components: ["skills"], skills: [] } }) };
|
|
77
|
+
destinations.set(name, dest);
|
|
78
|
+
states.set(name, new Set(existing ? [enabledState(existing)] : []));
|
|
79
|
+
}
|
|
80
|
+
dest.predecessors = unique([...dest.predecessors, predecessor.name]);
|
|
81
|
+
const contributions = states.get(name);
|
|
82
|
+
contributions.add(enabledState(predecessor));
|
|
83
|
+
if (contributions.size === 1)
|
|
84
|
+
dest.state = enabledState(predecessor);
|
|
85
|
+
return dest;
|
|
86
|
+
};
|
|
87
|
+
const empty = () => ({ skills: [], agents: [], commands: [], hooks: [], apps: [], mcp: [] });
|
|
88
|
+
const work = [...current.values()].map(old => ({ old, basis: history.get(old.name) ?? old, recovery: undefined }));
|
|
89
|
+
for (const recovery of options.deferredRecovery ?? []) {
|
|
90
|
+
const original = recovery.history;
|
|
91
|
+
if (!sameSource(original.origin, options.source))
|
|
92
|
+
continue;
|
|
93
|
+
// Deferred candidates remain evidence even after their former owner retired.
|
|
94
|
+
const skills = unique(recovery.skills.map(address => address.split(":").at(-1))).filter(skill => !visible.has(skill));
|
|
95
|
+
if (!skills.length)
|
|
96
|
+
continue;
|
|
97
|
+
work.push({ old: { ...original, contents: empty(), effectiveSelection: undefined },
|
|
98
|
+
basis: { ...original, contents: { ...empty(), skills }, selection: undefined, effectiveSelection: undefined, uncertain: true }, recovery });
|
|
99
|
+
}
|
|
100
|
+
const handled = new Set();
|
|
101
|
+
for (const { old, basis, recovery } of work) {
|
|
102
|
+
if (recovery && handled.has(recovery.id))
|
|
103
|
+
continue;
|
|
104
|
+
const reference = { ...basis, state: old.state };
|
|
105
|
+
if (!recovery && renames.has(old.name)) {
|
|
106
|
+
const target = renames.get(old.name);
|
|
107
|
+
if (old.evidence === "catalog" && old.selectionKnown !== true) {
|
|
108
|
+
const id = target === null ? `unmapped:${old.name}` : historyIdentity(basis);
|
|
109
|
+
handled.add(id);
|
|
110
|
+
const skills = target === null ? old.contents.skills.map(skill => `${old.name}:${skill}`)
|
|
111
|
+
: candidates.get(target).contents.skills.map(skill => `${target}:${skill}`);
|
|
112
|
+
const choice = options.decisions?.[id];
|
|
113
|
+
if (!choice)
|
|
114
|
+
result.decisions.push({ id, skills, choices: target === null ? ["keep", "drop"] : ["keep", "select", "restore"], uncertain: true });
|
|
115
|
+
if (!choice || choice.action === "keep" || (choice.action === "select" && !choice.skills?.length)) {
|
|
116
|
+
result.retained.push(old.name);
|
|
117
|
+
result.deferredRecovery.push({ id, history: historicalSnapshot(basis), skills: unique(skills) });
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (target !== null) {
|
|
121
|
+
const chosen = choice.action === "restore" ? skills : (choice.skills ?? []).filter(skill => skills.includes(skill));
|
|
122
|
+
if (chosen.length) {
|
|
123
|
+
const dest = ensure(target, old);
|
|
124
|
+
if (dest)
|
|
125
|
+
incoming.set(target, new Set([
|
|
126
|
+
...(incoming.get(target) ?? []), ...chosen.map(address => address.slice(target.length + 1)),
|
|
127
|
+
]));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
result.retired.push(old.name);
|
|
131
|
+
result.applied.push(id);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (target !== null && ensure(target, old, true)) {
|
|
135
|
+
renamedFrom.set(target, [...(renamedFrom.get(target) ?? []), old]);
|
|
136
|
+
}
|
|
137
|
+
result.retired.push(old.name);
|
|
138
|
+
result.applied.push(historyIdentity(basis));
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const historical = exposedContents(basis.contents, basis.uncertain && basis.selectionKnown !== true ? undefined : basis.effectiveSelection ?? basis.selection);
|
|
142
|
+
const actual = exposedContents(old.contents, old.effectiveSelection ?? old.selection);
|
|
143
|
+
const requested = exposedContents(basis.contents, basis.selection);
|
|
144
|
+
const policy = basis.uncertain ? old : basis;
|
|
145
|
+
const candidatePolicy = candidates.get(old.name);
|
|
146
|
+
const policySelection = candidatePolicy && Object.hasOwn(candidatePolicy, "requestedSelection")
|
|
147
|
+
? candidatePolicy.requestedSelection ?? undefined
|
|
148
|
+
: policy.selectionKnown === false ? policy.effectiveSelection ?? { components: [] } : policy.selection;
|
|
149
|
+
const exposed = { ...actual, skills: unique([...historical.skills, ...actual.skills]) };
|
|
150
|
+
const moves = [];
|
|
151
|
+
const explicitMoves = new Set();
|
|
152
|
+
const unavailable = new Set();
|
|
153
|
+
const dropped = new Set();
|
|
154
|
+
const relinquished = new Set();
|
|
155
|
+
let unresolved = false;
|
|
156
|
+
for (const skill of exposed.skills) {
|
|
157
|
+
// New manifests recalculate mandatory dependencies from requested policy.
|
|
158
|
+
// A previously derived skill is not a request to install another plugin.
|
|
159
|
+
if (basis.selection && basis.selectionKnown !== false && !requested.skills.includes(skill))
|
|
160
|
+
continue;
|
|
161
|
+
if (!recovery && old.evidence !== "catalog" && candidates.get(old.name)?.contents.skills.includes(skill))
|
|
162
|
+
continue;
|
|
163
|
+
const owners = options.candidates.filter(p => p.contents.skills.includes(skill));
|
|
164
|
+
if (owners.length === 0) {
|
|
165
|
+
if (recovery)
|
|
166
|
+
unavailable.add(skill);
|
|
167
|
+
else if (!candidates.has(old.name))
|
|
168
|
+
unresolved = true;
|
|
169
|
+
else if (old.evidence !== "catalog" && policySelection?.skills?.includes(skill)
|
|
170
|
+
&& (!basis.uncertain || actual.skills.includes(skill))) {
|
|
171
|
+
const id = `drop:${old.name}:${skill}`;
|
|
172
|
+
const choice = options.decisions?.[id];
|
|
173
|
+
if (choice?.action === "drop")
|
|
174
|
+
dropped.add(skill);
|
|
175
|
+
else {
|
|
176
|
+
unresolved = true;
|
|
177
|
+
if (choice?.action === "keep")
|
|
178
|
+
result.retained.push(old.name);
|
|
179
|
+
else
|
|
180
|
+
result.decisions.push({ id, skills: [`${old.name}:${skill}`], choices: ["keep", "drop"] });
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const sharedPeers = recovery ? [] : [...current.values()].filter(peer => {
|
|
186
|
+
if (peer.name === old.name)
|
|
187
|
+
return false;
|
|
188
|
+
const proof = history.get(peer.name) ?? peer;
|
|
189
|
+
const selection = proof.selectionKnown === false || (proof.evidence === "catalog" && proof.selectionKnown !== true)
|
|
190
|
+
? proof.effectiveSelection ?? { components: [] } : proof.effectiveSelection ?? proof.selection;
|
|
191
|
+
return exposedContents(proof.contents, selection).skills.includes(skill);
|
|
192
|
+
});
|
|
193
|
+
const sharedBefore = sharedPeers.some(peer => {
|
|
194
|
+
const candidate = candidates.get(peer.name);
|
|
195
|
+
return candidate && exposedContents(candidate.contents, candidate.effectiveSelection ?? undefined).skills.includes(skill);
|
|
196
|
+
});
|
|
197
|
+
// A derived dependency cannot carry another owner's explicit request after that dependency changes.
|
|
198
|
+
const directlyRequestedByPeer = sharedPeers.some(peer => {
|
|
199
|
+
const candidate = candidates.get(peer.name);
|
|
200
|
+
return candidate && exposedContents(candidate.contents, requestedSelectionFor(peer.name)).skills.includes(skill);
|
|
201
|
+
});
|
|
202
|
+
if (sharedBefore && candidates.has(old.name) && (!policySelection?.skills?.includes(skill) || directlyRequestedByPeer)) {
|
|
203
|
+
if (policySelection?.skills?.includes(skill))
|
|
204
|
+
relinquished.add(skill);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (sharedBefore && !candidates.has(old.name)) {
|
|
208
|
+
const historicallyShared = !history.size || sharedPeers.some(peer => history.has(peer.name));
|
|
209
|
+
const formerSelectionKnown = old.selectionKnown === true || (old.selection !== undefined && old.selectionKnown !== false);
|
|
210
|
+
// Known historical sharing retains whole-plugin review. A newly observed peer
|
|
211
|
+
// authorizes skill transfer only with the former owner's own selection or installed proof.
|
|
212
|
+
if (historicallyShared || (!formerSelectionKnown && old.evidence !== "installed")) {
|
|
213
|
+
unresolved = true;
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (!candidates.has(old.name) && sharedPeers.length && owners.length > 1) {
|
|
218
|
+
// Historical sharing cannot identify one successor after the old owners retire.
|
|
219
|
+
unresolved = true;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (owners.length > 1) {
|
|
223
|
+
const uncertain = Boolean(recovery) || Boolean(basis.uncertain && !visible.has(skill));
|
|
224
|
+
const id = uncertain ? `ownership:${historyIdentity(recovery?.history ?? basis)}:${skill}` : `ownership:${old.name}:${skill}`;
|
|
225
|
+
const decision = options.decisions?.[id];
|
|
226
|
+
const addresses = owners.map(p => `${p.name}:${skill}`).sort();
|
|
227
|
+
const chosen = decision?.skills?.filter(address => addresses.includes(address));
|
|
228
|
+
if (decision?.action === "select" && chosen?.length === 1) {
|
|
229
|
+
moves.push({ skill, owner: chosen[0].split(":")[0] });
|
|
230
|
+
if (uncertain)
|
|
231
|
+
explicitMoves.add(chosen[0]);
|
|
232
|
+
}
|
|
233
|
+
else if (decision?.action === "keep") {
|
|
234
|
+
if (uncertain) {
|
|
235
|
+
result.deferredRecovery.push({ id, history: recovery?.history ?? historicalSnapshot(basis), skills: addresses });
|
|
236
|
+
if (!recovery && old.evidence === "catalog")
|
|
237
|
+
result.retained.push(old.name);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
unresolved = true;
|
|
241
|
+
if (!candidates.has(old.name))
|
|
242
|
+
result.retained.push(old.name);
|
|
243
|
+
else
|
|
244
|
+
result.blockers.push(`Ambiguous skill owner retained: ${old.name}:${skill}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else
|
|
248
|
+
result.decisions.push({ id, skills: addresses, choices: ["keep", "select"], ...(uncertain ? { uncertain: true } : {}) });
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
moves.push({ skill, owner: owners[0].name });
|
|
252
|
+
}
|
|
253
|
+
if (recovery && unavailable.size)
|
|
254
|
+
result.deferredRecovery.push({ ...recovery,
|
|
255
|
+
skills: recovery.skills.filter(address => unavailable.has(address.split(":").at(-1))) });
|
|
256
|
+
if ((!moves.length && !dropped.size && !relinquished.size) || unresolved) {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
const retiring = !recovery && !candidates.has(old.name);
|
|
260
|
+
if (retiring && COMPONENT_TYPES.some(component => component !== "skills" && exposed[component].length > 0)) {
|
|
261
|
+
result.blockers.push(`Unmapped native components in retired plugin: ${old.name}`);
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
const missing = basis.uncertain ? moves.filter(move => !visible.has(move.skill) && !explicitMoves.has(`${move.owner}:${move.skill}`)) : [];
|
|
265
|
+
const id = recovery?.id ?? historyIdentity(basis);
|
|
266
|
+
if (recovery && handled.has(id))
|
|
267
|
+
continue;
|
|
268
|
+
handled.add(id);
|
|
269
|
+
const choice = options.decisions?.[id];
|
|
270
|
+
if (missing.length && !choice)
|
|
271
|
+
result.decisions.push({
|
|
272
|
+
id, skills: missing.map(move => `${move.owner}:${move.skill}`).sort(), choices: ["keep", "restore", "select"],
|
|
273
|
+
});
|
|
274
|
+
if (missing.length && choice?.action === "keep")
|
|
275
|
+
result.deferredRecovery.push({
|
|
276
|
+
id, history: recovery?.history ?? historicalSnapshot(basis),
|
|
277
|
+
skills: missing.map(move => `${move.owner}:${move.skill}`).sort(),
|
|
278
|
+
});
|
|
279
|
+
if (!recovery && missing.length && choice?.action === "keep" && old.evidence === "catalog")
|
|
280
|
+
result.retained.push(old.name);
|
|
281
|
+
for (const move of moves) {
|
|
282
|
+
const address = `${move.owner}:${move.skill}`;
|
|
283
|
+
if (missing.includes(move) && choice?.action !== "restore" && !(choice?.action === "select" && choice.skills?.includes(address)))
|
|
284
|
+
continue;
|
|
285
|
+
const dest = ensure(move.owner, reference);
|
|
286
|
+
if (dest) {
|
|
287
|
+
const skills = incoming.get(move.owner) ?? new Set();
|
|
288
|
+
skills.add(move.skill);
|
|
289
|
+
incoming.set(move.owner, skills);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (retiring && !result.retained.includes(old.name))
|
|
293
|
+
result.retired.push(old.name);
|
|
294
|
+
else if (!recovery && (!basis.uncertain || dropped.size || relinquished.size)) {
|
|
295
|
+
const dest = ensure(old.name, reference);
|
|
296
|
+
if (dest && !(policy.selectionKnown === true && policySelection?.skills === undefined)) {
|
|
297
|
+
const selected = basis.uncertain || policy.selectionKnown === false ? exposedContents(policy.contents, policySelection).skills
|
|
298
|
+
: basis.selection && basis.selectionKnown !== false ? requested.skills : exposed.skills;
|
|
299
|
+
const remaining = selected
|
|
300
|
+
.filter(skill => !dropped.has(skill) && !relinquished.has(skill) && !moves.some(move => move.skill === skill));
|
|
301
|
+
ownSelections.set(old.name, { ...policySelection, components: [...(policySelection?.components ?? COMPONENT_TYPES)], skills: remaining });
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (!recovery || choice?.action === "restore" || choice?.action === "select")
|
|
305
|
+
result.applied.push(id);
|
|
306
|
+
}
|
|
307
|
+
for (const [name, dest] of destinations) {
|
|
308
|
+
if (result.retained.includes(name)) {
|
|
309
|
+
result.blockers.push(`Migration destination requires retaining its existing installation: ${name}`);
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
const existing = current.get(name);
|
|
313
|
+
const existingSelection = requestedSelectionFor(name);
|
|
314
|
+
let selection = ownSelections.get(name) ?? (existingSelection ? structuredClone(existingSelection) : dest.selection);
|
|
315
|
+
const renamed = renamedFrom.get(name) ?? [];
|
|
316
|
+
if (renamed.length === 1 && !existing) {
|
|
317
|
+
const former = renamed[0];
|
|
318
|
+
const requested = former.selection ?? (former.selectionKnown === false ? former.effectiveSelection : undefined);
|
|
319
|
+
selection = requested ? structuredClone(requested) : undefined;
|
|
320
|
+
}
|
|
321
|
+
if (renamed.length > 1 && !existing)
|
|
322
|
+
selection = { components: [], skills: [], mcp: [] };
|
|
323
|
+
if (selection && (existing || renamed.length > 1)) {
|
|
324
|
+
for (const former of renamed) {
|
|
325
|
+
const members = exposedContents(former.contents, former.selectionKnown === false ? former.effectiveSelection : former.selection);
|
|
326
|
+
for (const component of COMPONENT_TYPES.filter(component => members[component].length)) {
|
|
327
|
+
if (!selection.components.includes(component)) {
|
|
328
|
+
selection.components.push(component);
|
|
329
|
+
if (component === "skills")
|
|
330
|
+
selection.skills = [];
|
|
331
|
+
if (component === "mcp")
|
|
332
|
+
selection.mcp = [];
|
|
333
|
+
}
|
|
334
|
+
if (component === "skills" && selection.skills)
|
|
335
|
+
selection.skills = unique([...selection.skills, ...members.skills.filter(skill => candidates.get(name).contents.skills.includes(skill))]);
|
|
336
|
+
if (component === "mcp" && selection.mcp)
|
|
337
|
+
selection.mcp = unique([...selection.mcp, ...members.mcp.filter(server => candidates.get(name).contents.mcp.includes(server))]);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
const skills = incoming.get(name);
|
|
342
|
+
if (selection && skills?.size) {
|
|
343
|
+
if (!selection.components.includes("skills")) {
|
|
344
|
+
selection.components.push("skills");
|
|
345
|
+
selection.skills = [];
|
|
346
|
+
}
|
|
347
|
+
if (selection.skills)
|
|
348
|
+
selection.skills = unique([...selection.skills, ...skills]);
|
|
349
|
+
}
|
|
350
|
+
if (selection)
|
|
351
|
+
selection.components = COMPONENT_TYPES.filter(component => selection.components.includes(component));
|
|
352
|
+
dest.selection = selection;
|
|
353
|
+
}
|
|
354
|
+
for (const [name, values] of states) {
|
|
355
|
+
if (values.size < 2)
|
|
356
|
+
continue;
|
|
357
|
+
const id = `state:${name}`;
|
|
358
|
+
const choice = options.decisions?.[id];
|
|
359
|
+
if (choice?.action === "enabled" || choice?.action === "disabled") {
|
|
360
|
+
destinations.get(name).state = choice.action;
|
|
361
|
+
destinations.get(name).stateResolved = true;
|
|
362
|
+
}
|
|
363
|
+
else
|
|
364
|
+
result.decisions.push({ id, skills: [], choices: ["enabled", "disabled"] });
|
|
365
|
+
}
|
|
366
|
+
result.applied = unique(result.applied);
|
|
367
|
+
result.retained = unique(result.retained);
|
|
368
|
+
result.blockers = unique(result.blockers);
|
|
369
|
+
const deferred = new Map();
|
|
370
|
+
for (const item of result.deferredRecovery) {
|
|
371
|
+
const previous = deferred.get(item.id);
|
|
372
|
+
deferred.set(item.id, { ...item, skills: unique([...(previous?.skills ?? []), ...item.skills]) });
|
|
373
|
+
}
|
|
374
|
+
result.deferredRecovery = [...deferred.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
375
|
+
result.destinations = [...destinations.values()].filter(p => !result.retired.includes(p.name) && !result.retained.includes(p.name)).sort((a, b) => a.name.localeCompare(b.name));
|
|
376
|
+
result.retired = result.blockers.length || result.decisions.length ? [] : unique(result.retired);
|
|
377
|
+
return result;
|
|
378
|
+
}
|
|
@@ -154,3 +154,8 @@ plugin root. The ADG adapter materializes files at these conventional locations.
|
|
|
154
154
|
|
|
155
155
|
**Note**: These are injected by the generated `hook-runner.mjs`, not by the Antigravity
|
|
156
156
|
runtime itself. The runner bridges Claude-format command scripts to Antigravity's I/O.
|
|
157
|
+
|
|
158
|
+
ADG places an owned physical plugin directory in the scan directory when the
|
|
159
|
+
store entry lives elsewhere. Native discovery skips a symlink at the plugin
|
|
160
|
+
root. Component aliases inside a physical root are supported. Ordinary update
|
|
161
|
+
repairs an older symlink exposure even when the source revision is unchanged.
|
package/docs/agents-spec.md
CHANGED
|
@@ -341,3 +341,13 @@ When support for a new agent runtime is needed:
|
|
|
341
341
|
4. **Update cross-agent matrices** (§8–§11) to include the new agent column.
|
|
342
342
|
5. **Add hook event support** in [`src/hooks.ts`](../src/hooks.ts) `SUPPORTED_EVENTS`.
|
|
343
343
|
6. **Test** via `adg plugins adapt --target <agent>` and `adg plugins validate`.
|
|
344
|
+
|
|
345
|
+
## Updating plugin layouts
|
|
346
|
+
|
|
347
|
+
Keep plugin and skill identities stable when reorganizing source files. ADG
|
|
348
|
+
tracks verified installed inventories and follows unambiguous same-source
|
|
349
|
+
skill moves. Existing marketplace `renames` metadata can describe plugin name
|
|
350
|
+
changes or removals. Publishers maintain their current ordinary manifests and
|
|
351
|
+
catalog; recovery history belongs to the client store. The
|
|
352
|
+
[update and recovery plan](plugin-upgrade-migrations.md) documents decisions,
|
|
353
|
+
retirement and legacy recovery.
|