@aiwg/cli 2026.10.12 → 2026.10.14
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/agentic/code/providers/pi/aiwg-bridge.ts +44 -1
- package/dist/src/cli/handlers/use-bundle-counts.js +32 -6
- package/dist/src/cli/handlers/use-skill-assets.js +207 -0
- package/dist/src/cli/handlers/use.js +30 -193
- package/dist/src/config/authorization-cli.js +11 -3
- package/dist/src/decision/context-pruning-common.js +41 -0
- package/dist/src/decision/context-pruning-evaluation.js +366 -0
- package/dist/src/decision/context-pruning-pilot.js +431 -0
- package/dist/src/decision/context-pruning-types.js +19 -0
- package/dist/src/decision/context-pruning.js +5 -847
- package/dist/src/decision/ensemble/contract.js +4 -24
- package/dist/src/decision/qualification/release.js +5 -62
- package/dist/src/extensions/manifest.js +8 -1
- package/dist/src/extensions/project-local-doctor.js +78 -2
- package/dist/src/extensions/validation.js +10 -11
- package/dist/src/gates/evaluate.js +3 -13
- package/dist/src/gates/upstream-ceiling.js +111 -0
- package/dist/src/models/provider-models.js +5 -8
- package/dist/src/models/wrapper-definitions.js +14 -0
- package/dist/src/models/wrapper-deployment.js +48 -25
- package/dist/src/models/wrapper-enforcement.js +72 -0
- package/dist/src/policy/hitl-check.js +80 -0
- package/dist/src/rules/activation.d.mts +2 -0
- package/dist/src/rules/activation.mjs +23 -0
- package/dist/src/skills/adapters/local.js +32 -9
- package/dist/src/skills/agent-skills.js +2 -0
- package/dist/src/skills/cli-display.js +33 -0
- package/dist/src/skills/cli.js +2 -26
- package/dist/src/skills/collision-discovery.js +84 -0
- package/dist/src/skills/deployer.js +20 -75
- package/dist/src/skills/deployment-ownership.js +74 -0
- package/dist/src/skills/doctor.js +2 -2
- package/dist/src/skills/importer.js +4 -26
- package/dist/src/skills/registry.js +22 -7
- package/dist/src/smiths/context-pipeline/parallelism-section.js +7 -3
- package/package.json +3 -1
- package/tools/agents/providers/antigravity.mjs +3 -5
- package/tools/agents/providers/base.mjs +3 -3
- package/tools/agents/providers/claude.mjs +3 -5
- package/tools/agents/providers/codex.mjs +3 -5
- package/tools/agents/providers/copilot.mjs +3 -5
- package/tools/agents/providers/cursor.mjs +3 -5
- package/tools/agents/providers/factory.mjs +3 -5
- package/tools/agents/providers/grok-build.mjs +9 -7
- package/tools/agents/providers/model-wrapper.mjs +86 -0
- package/tools/agents/providers/omp.mjs +3 -1
- package/tools/agents/providers/openclaw.mjs +3 -5
- package/tools/agents/providers/opencode.mjs +3 -5
- package/tools/agents/providers/provider-paths-staging.mjs +9 -0
- package/tools/agents/providers/rule-delivery.mjs +4 -4
- package/tools/agents/providers/warp.mjs +3 -5
- package/tools/agents/providers/windsurf.mjs +3 -5
- package/tools/plugin/package-plugins.mjs +2 -2
- package/tools/skills/codex-skill-transform.mjs +232 -0
- package/tools/skills/deploy-skills-codex.mjs +8 -249
- package/tools/warp/warp-content.mjs +548 -0
|
@@ -9,60 +9,13 @@
|
|
|
9
9
|
import fs from 'node:fs';
|
|
10
10
|
import path from 'node:path';
|
|
11
11
|
import { randomUUID } from 'node:crypto';
|
|
12
|
-
import { normalizeProviderDefinitionId } from '../providers/provider-definitions.js';
|
|
13
|
-
import { AGENT_SKILLS_SIDECAR_SCHEMA } from './agent-skills.js';
|
|
14
12
|
import { getImportedAgentSkill } from './importer.js';
|
|
13
|
+
import { higherLocalSkillOwner, skillCollisionDiagnostic } from './collision-discovery.js';
|
|
14
|
+
import { isManagedTarget, readDeploymentSidecar, providersShareProjectionSurface } from './deployment-ownership.js';
|
|
15
15
|
import { resolvePolicy } from './deployment-policy.js';
|
|
16
16
|
import { projectionDocument, providerSkillBytes, sidecarBytes } from './deployment-projection.js';
|
|
17
17
|
import { AGENT_SKILL_MANAGED_MARKER, AGENT_SKILL_DEPLOYMENT_SIDECAR, MARKER_CONTENT, assertPortableName, fail, } from './deployment-types.js';
|
|
18
18
|
export { AGENT_SKILL_MANAGED_MARKER, AGENT_SKILL_DEPLOYMENT_SIDECAR, AgentSkillDeploymentError, } from './deployment-types.js';
|
|
19
|
-
function readDeploymentSidecar(targetPath, expectedName, expectedProvider) {
|
|
20
|
-
try {
|
|
21
|
-
const sidecarPath = path.join(targetPath, AGENT_SKILL_DEPLOYMENT_SIDECAR);
|
|
22
|
-
const stat = fs.lstatSync(sidecarPath);
|
|
23
|
-
if (!stat.isFile() || stat.isSymbolicLink())
|
|
24
|
-
return undefined;
|
|
25
|
-
const value = JSON.parse(fs.readFileSync(sidecarPath, 'utf8'));
|
|
26
|
-
if (value.schemaVersion !== 1
|
|
27
|
-
|| value.kind !== 'aiwg-managed-agent-skill-projection'
|
|
28
|
-
|| !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value.name)
|
|
29
|
-
|| !normalizeProviderDefinitionId(value.provider)
|
|
30
|
-
|| !/^[0-9a-f]{64}$/.test(value.sourceDigest)
|
|
31
|
-
|| !['native', 'projected', 'degraded', 'unsupported'].includes(value.projectionStatus)
|
|
32
|
-
|| !Array.isArray(value.reasons)
|
|
33
|
-
|| !value.reasons.every((item) => typeof item === 'string')
|
|
34
|
-
|| !Array.isArray(value.warnings)
|
|
35
|
-
|| !value.warnings.every((item) => typeof item === 'string')
|
|
36
|
-
|| value.portable?.$schema !== AGENT_SKILLS_SIDECAR_SCHEMA
|
|
37
|
-
|| value.portable.schemaVersion !== 1
|
|
38
|
-
|| typeof value.portable.aiwg !== 'object'
|
|
39
|
-
|| value.portable.aiwg === null
|
|
40
|
-
|| Array.isArray(value.portable.aiwg)
|
|
41
|
-
|| value.portable.provenance?.sourceDigest !== value.sourceDigest
|
|
42
|
-
|| !['strict', 'compatible', 'discovery'].includes(value.portable.validationProfile)
|
|
43
|
-
|| !['untrusted', 'trusted', 'revoked'].includes(value.portable.trust?.state)
|
|
44
|
-
|| !['inactive', 'active', 'blocked'].includes(value.portable.trust?.activation)
|
|
45
|
-
|| (expectedName !== undefined && value.name !== expectedName)
|
|
46
|
-
|| (expectedProvider !== undefined && value.provider !== expectedProvider)
|
|
47
|
-
|| path.basename(targetPath) !== value.name) {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Codex, Antigravity, DeepSeek Harness, and Muse intentionally consume the
|
|
58
|
-
* same portable project skill surface (<repo>/.agents/skills). A projection
|
|
59
|
-
* written for any member is managed ownership for the others when the
|
|
60
|
-
* desired payload is otherwise byte-identical.
|
|
61
|
-
*/
|
|
62
|
-
function providersShareProjectionSurface(actual, expected) {
|
|
63
|
-
const shared = new Set(['antigravity', 'codex', 'deepseek-harness', 'muse']);
|
|
64
|
-
return actual === expected || (shared.has(actual) && shared.has(expected));
|
|
65
|
-
}
|
|
66
19
|
function buildProjectionPlan(record, options) {
|
|
67
20
|
const policy = resolvePolicy(options.target, options);
|
|
68
21
|
const targetPath = path.join(policy.root, record.name);
|
|
@@ -74,6 +27,14 @@ function buildProjectionPlan(record, options) {
|
|
|
74
27
|
desiredEntries: [],
|
|
75
28
|
};
|
|
76
29
|
}
|
|
30
|
+
const collision = higherLocalSkillOwner(record.name, 'imported', options);
|
|
31
|
+
if (collision?.origin) {
|
|
32
|
+
const diagnostic = skillCollisionDiagnostic(record.name, collision.origin, 'imported', collision.path ?? '');
|
|
33
|
+
policy.status = 'degraded';
|
|
34
|
+
policy.reasons.push(diagnostic.message);
|
|
35
|
+
policy.warnings.push(`Existing ${collision.origin}-owned files were not modified: ${collision.path}`);
|
|
36
|
+
return { blocked: true, policy, targetPath, sourceDigest: record.digest, desiredEntries: [] };
|
|
37
|
+
}
|
|
77
38
|
const { document, sourceEntries } = projectionDocument(record);
|
|
78
39
|
const original = sourceEntries.find((entry) => (entry.kind === 'file' && entry.relativePath === 'SKILL.md'));
|
|
79
40
|
const skillBytes = providerSkillBytes(record, policy, document, original?.bytes);
|
|
@@ -108,26 +69,6 @@ function buildProjectionPlan(record, options) {
|
|
|
108
69
|
desiredEntries,
|
|
109
70
|
};
|
|
110
71
|
}
|
|
111
|
-
function isManagedTarget(targetPath, expectedName, expectedProvider) {
|
|
112
|
-
if (!fs.existsSync(targetPath))
|
|
113
|
-
return false;
|
|
114
|
-
try {
|
|
115
|
-
const targetStat = fs.lstatSync(targetPath);
|
|
116
|
-
const marker = path.join(targetPath, AGENT_SKILL_MANAGED_MARKER);
|
|
117
|
-
const sidecar = readDeploymentSidecar(targetPath, expectedName);
|
|
118
|
-
return (targetStat.isDirectory()
|
|
119
|
-
&& !targetStat.isSymbolicLink()
|
|
120
|
-
&& fs.lstatSync(marker).isFile()
|
|
121
|
-
&& !fs.lstatSync(marker).isSymbolicLink()
|
|
122
|
-
&& fs.readFileSync(marker, 'utf8') === MARKER_CONTENT
|
|
123
|
-
&& sidecar !== undefined
|
|
124
|
-
&& (expectedProvider === undefined
|
|
125
|
-
|| providersShareProjectionSurface(sidecar.provider, expectedProvider)));
|
|
126
|
-
}
|
|
127
|
-
catch {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
72
|
function targetMatches(targetPath, desired, name, provider) {
|
|
132
73
|
if (!isManagedTarget(targetPath, name, provider))
|
|
133
74
|
return false;
|
|
@@ -196,6 +137,9 @@ function promoteAtomically(name, plan) {
|
|
|
196
137
|
const existed = fs.existsSync(plan.targetPath);
|
|
197
138
|
try {
|
|
198
139
|
writeDesiredTree(staging, plan.desiredEntries);
|
|
140
|
+
if (!existed && fs.existsSync(plan.targetPath)) {
|
|
141
|
+
fail('AS_DEPLOY_COLLISION_RACE', 'project/user-owned target appeared before imported-owned skill promotion');
|
|
142
|
+
}
|
|
199
143
|
if (existed) {
|
|
200
144
|
if (!isManagedTarget(plan.targetPath, name, plan.policy.provider)) {
|
|
201
145
|
fail('AS_DEPLOY_COLLISION_RACE', 'deployment target ownership changed before atomic promotion');
|
|
@@ -206,11 +150,11 @@ function promoteAtomically(name, plan) {
|
|
|
206
150
|
fs.renameSync(staging, plan.targetPath);
|
|
207
151
|
}
|
|
208
152
|
catch (error) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (fs.existsSync(backup))
|
|
153
|
+
// A failed rename did not install our tree. A newly appeared target is
|
|
154
|
+
// operator-owned; retain it and the backup rather than deleting either.
|
|
155
|
+
if (fs.existsSync(backup) && !fs.existsSync(plan.targetPath)) {
|
|
213
156
|
fs.renameSync(backup, plan.targetPath);
|
|
157
|
+
}
|
|
214
158
|
throw error;
|
|
215
159
|
}
|
|
216
160
|
if (fs.existsSync(backup)) {
|
|
@@ -268,13 +212,13 @@ export function deployImportedAgentSkill(name, options) {
|
|
|
268
212
|
const record = requireDeployableImport(name, projectDir);
|
|
269
213
|
const plan = buildProjectionPlan(record, { ...options, projectDir });
|
|
270
214
|
const dryRun = options.dryRun ?? false;
|
|
271
|
-
if (!plan.policy.supported) {
|
|
215
|
+
if (!plan.policy.supported || plan.blocked) {
|
|
272
216
|
return result('deploy', 'blocked', dryRun, name, plan);
|
|
273
217
|
}
|
|
274
218
|
if (fs.existsSync(plan.targetPath)
|
|
275
219
|
&& !isManagedTarget(plan.targetPath, name, plan.policy.provider)) {
|
|
276
220
|
plan.policy.status = 'degraded';
|
|
277
|
-
plan.policy.reasons.push('target collision is not owned by AIWG');
|
|
221
|
+
plan.policy.reasons.push('target collision is not owned by AIWG: project/user-owned target blocks imported-owned skill');
|
|
278
222
|
plan.policy.warnings.push('the existing user-owned target was not modified');
|
|
279
223
|
return result('deploy', 'blocked', dryRun, name, plan);
|
|
280
224
|
}
|
|
@@ -334,6 +278,7 @@ export function inspectImportedAgentSkillProjection(name, options) {
|
|
|
334
278
|
exists,
|
|
335
279
|
managed,
|
|
336
280
|
matches: (plan.policy.supported
|
|
281
|
+
&& !plan.blocked
|
|
337
282
|
&& managed
|
|
338
283
|
&& targetMatches(plan.targetPath, plan.desiredEntries, name, plan.policy.provider)),
|
|
339
284
|
reasons: [...plan.policy.reasons],
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Verify managed projection ownership before discovery or mutation.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { normalizeProviderDefinitionId } from '../providers/provider-definitions.js';
|
|
5
|
+
import { AGENT_SKILLS_SIDECAR_SCHEMA } from './agent-skills.js';
|
|
6
|
+
import { AGENT_SKILL_DEPLOYMENT_SIDECAR, AGENT_SKILL_MANAGED_MARKER, MARKER_CONTENT, } from './deployment-types.js';
|
|
7
|
+
export function readDeploymentSidecar(targetPath, expectedName, expectedProvider) {
|
|
8
|
+
try {
|
|
9
|
+
const sidecarPath = path.join(targetPath, AGENT_SKILL_DEPLOYMENT_SIDECAR);
|
|
10
|
+
const stat = fs.lstatSync(sidecarPath);
|
|
11
|
+
if (!stat.isFile() || stat.isSymbolicLink())
|
|
12
|
+
return undefined;
|
|
13
|
+
const value = JSON.parse(fs.readFileSync(sidecarPath, 'utf8'));
|
|
14
|
+
if (value.schemaVersion !== 1
|
|
15
|
+
|| value.kind !== 'aiwg-managed-agent-skill-projection'
|
|
16
|
+
|| !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value.name)
|
|
17
|
+
|| !normalizeProviderDefinitionId(value.provider)
|
|
18
|
+
|| !/^[0-9a-f]{64}$/.test(value.sourceDigest)
|
|
19
|
+
|| !['native', 'projected', 'degraded', 'unsupported'].includes(value.projectionStatus)
|
|
20
|
+
|| !Array.isArray(value.reasons)
|
|
21
|
+
|| !value.reasons.every((item) => typeof item === 'string')
|
|
22
|
+
|| !Array.isArray(value.warnings)
|
|
23
|
+
|| !value.warnings.every((item) => typeof item === 'string')
|
|
24
|
+
|| value.portable?.$schema !== AGENT_SKILLS_SIDECAR_SCHEMA
|
|
25
|
+
|| value.portable.schemaVersion !== 1
|
|
26
|
+
|| typeof value.portable.aiwg !== 'object'
|
|
27
|
+
|| value.portable.aiwg === null
|
|
28
|
+
|| Array.isArray(value.portable.aiwg)
|
|
29
|
+
|| value.portable.provenance?.sourceDigest !== value.sourceDigest
|
|
30
|
+
|| !['strict', 'compatible', 'discovery'].includes(value.portable.validationProfile)
|
|
31
|
+
|| !['untrusted', 'trusted', 'revoked'].includes(value.portable.trust?.state)
|
|
32
|
+
|| !['inactive', 'active', 'blocked'].includes(value.portable.trust?.activation)
|
|
33
|
+
|| (expectedName !== undefined && value.name !== expectedName)
|
|
34
|
+
|| (expectedProvider !== undefined && value.provider !== expectedProvider)
|
|
35
|
+
|| path.basename(targetPath) !== value.name) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Codex, Antigravity, DeepSeek Harness, and Muse intentionally consume the
|
|
46
|
+
* same portable project skill surface (<repo>/.agents/skills). A projection
|
|
47
|
+
* written for any member is managed ownership for the others when the
|
|
48
|
+
* desired payload is otherwise byte-identical.
|
|
49
|
+
*/
|
|
50
|
+
export function providersShareProjectionSurface(actual, expected) {
|
|
51
|
+
const shared = new Set(['antigravity', 'codex', 'deepseek-harness', 'muse']);
|
|
52
|
+
return actual === expected || (shared.has(actual) && shared.has(expected));
|
|
53
|
+
}
|
|
54
|
+
export function isManagedTarget(targetPath, expectedName, expectedProvider) {
|
|
55
|
+
if (!fs.existsSync(targetPath))
|
|
56
|
+
return false;
|
|
57
|
+
try {
|
|
58
|
+
const targetStat = fs.lstatSync(targetPath);
|
|
59
|
+
const marker = path.join(targetPath, AGENT_SKILL_MANAGED_MARKER);
|
|
60
|
+
const sidecar = readDeploymentSidecar(targetPath, expectedName);
|
|
61
|
+
return (targetStat.isDirectory()
|
|
62
|
+
&& !targetStat.isSymbolicLink()
|
|
63
|
+
&& fs.lstatSync(marker).isFile()
|
|
64
|
+
&& !fs.lstatSync(marker).isSymbolicLink()
|
|
65
|
+
&& fs.readFileSync(marker, 'utf8') === MARKER_CONTENT
|
|
66
|
+
&& sidecar !== undefined
|
|
67
|
+
&& (expectedProvider === undefined
|
|
68
|
+
|| providersShareProjectionSurface(sidecar.provider, expectedProvider)));
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=deployment-ownership.js.map
|
|
@@ -63,10 +63,10 @@ export function buildAgentSkillsDoctorSection(projectDir, options = {}) {
|
|
|
63
63
|
diagnostics.push(diagnostic('AS_DOCTOR_PROVIDER_UNSUPPORTED', 'warning', inspection.path, '$', `provider "${provider.id}" cannot project active imported skill "${skill.name}": ${inspection.reasons.join('; ')}`, `Use a supported provider surface or retain "${skill.name}" in the managed import store.`));
|
|
64
64
|
}
|
|
65
65
|
else if (!inspection.exists) {
|
|
66
|
-
diagnostics.push(diagnostic('AS_DOCTOR_PROVIDER_DEGRADED', 'warning', inspection.path, '$', `active imported skill "${skill.name}" is not projected to provider "${provider.id}"`, `Deploy or repair the ${provider.id} Agent Skills projection.`));
|
|
66
|
+
diagnostics.push(diagnostic('AS_DOCTOR_PROVIDER_DEGRADED', 'warning', inspection.path, '$', `active imported skill "${skill.name}" is not projected to provider "${provider.id}": ${inspection.reasons.join('; ')}`, `Deploy or repair the ${provider.id} Agent Skills projection.`));
|
|
67
67
|
}
|
|
68
68
|
else if (!inspection.managed || !inspection.matches) {
|
|
69
|
-
diagnostics.push(diagnostic('AS_DOCTOR_DEPLOYED_DRIFT', 'error', inspection.path, '$', `provider "${provider.id}" projection for "${skill.name}" differs from its expected strict managed projection`, `Redeploy "${skill.name}" to ${provider.id} from the managed import.`));
|
|
69
|
+
diagnostics.push(diagnostic('AS_DOCTOR_DEPLOYED_DRIFT', 'error', inspection.path, '$', `provider "${provider.id}" projection for "${skill.name}" differs from its expected strict managed projection: ${inspection.reasons.join('; ')}`, `Redeploy "${skill.name}" to ${provider.id} from the managed import.`));
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -14,7 +14,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
14
14
|
import { createHash, randomUUID } from 'node:crypto';
|
|
15
15
|
import { fileURLToPath } from 'node:url';
|
|
16
16
|
import { projectAiwgPath } from '../config/project-artifacts.js';
|
|
17
|
-
import {
|
|
17
|
+
import { higherLocalSkillOwner } from './collision-discovery.js';
|
|
18
18
|
import { AGENT_SKILLS_BASELINE, } from './agent-skills.js';
|
|
19
19
|
import { validateAgentSkillContent } from './validator.js';
|
|
20
20
|
export const DEFAULT_AGENT_SKILL_IMPORT_LIMITS = Object.freeze({
|
|
@@ -591,28 +591,6 @@ function resultFromRecord(record, skillRoot, status, dryRun) {
|
|
|
591
591
|
totalBytes: record.totalBytes,
|
|
592
592
|
};
|
|
593
593
|
}
|
|
594
|
-
function higherPrecedenceCollision(name, projectDir, managedStore) {
|
|
595
|
-
const candidates = new Map();
|
|
596
|
-
for (const definition of listProviderDefinitions()) {
|
|
597
|
-
const namespace = definition.skillNamespace;
|
|
598
|
-
const basePath = namespace.pathType === 'home-dir'
|
|
599
|
-
? `~/${namespace.skillsBaseDir}`
|
|
600
|
-
: namespace.skillsBaseDir;
|
|
601
|
-
const resolved = resolveProviderPathValue(basePath, projectDir);
|
|
602
|
-
candidates.set(path.join(resolved, name), namespace.pathType === 'home-dir' ? 'user' : 'project');
|
|
603
|
-
}
|
|
604
|
-
candidates.set(path.join(projectDir, '.agents', 'skills', name), 'project');
|
|
605
|
-
candidates.set(path.join(projectDir, '.claude', '.aiwg', 'skills', name), 'project');
|
|
606
|
-
const match = [...candidates.entries()]
|
|
607
|
-
.sort(([left], [right]) => left.localeCompare(right))
|
|
608
|
-
.find(([candidate]) => {
|
|
609
|
-
if (pathContains(managedStore, candidate))
|
|
610
|
-
return false;
|
|
611
|
-
return (fs.existsSync(path.join(candidate, 'SKILL.md'))
|
|
612
|
-
&& !fs.existsSync(path.join(candidate, '.aiwg-managed')));
|
|
613
|
-
});
|
|
614
|
-
return match ? { path: match[0], origin: match[1] } : undefined;
|
|
615
|
-
}
|
|
616
594
|
function writeTree(root, entries) {
|
|
617
595
|
fs.mkdirSync(root, { recursive: true, mode: 0o700 });
|
|
618
596
|
const directories = entries
|
|
@@ -791,10 +769,10 @@ export async function importAgentSkill(source, options) {
|
|
|
791
769
|
const digest = computeTreeDigest(materialized.entries);
|
|
792
770
|
const importedStore = projectAiwgPath(projectDir, 'skills', 'imported');
|
|
793
771
|
const finalRoot = path.join(importedStore, parsed.name);
|
|
794
|
-
const collision =
|
|
772
|
+
const collision = higherLocalSkillOwner(parsed.name, 'imported', { projectDir });
|
|
795
773
|
if (collision) {
|
|
796
|
-
throw new AgentSkillImportError('AS_IMPORT_COLLISION', `${collision.origin}-owned skill "${parsed.name}"
|
|
797
|
-
diagnostic('AS_IMPORT_COLLISION', collision.path, '$.name', `${collision.origin}-owned skill "${parsed.name}" has higher precedence`, 'Rename the imported skill or remove the higher-precedence collision explicitly.'),
|
|
774
|
+
throw new AgentSkillImportError('AS_IMPORT_COLLISION', `${collision.origin}-owned skill "${parsed.name}" takes precedence over imported-owned skill at ${collision.path}`, [
|
|
775
|
+
diagnostic('AS_IMPORT_COLLISION', collision.path ?? '.', '$.name', `${collision.origin}-owned skill "${parsed.name}" has higher precedence than imported-owned skill`, 'Rename the imported skill or remove the higher-precedence collision explicitly.'),
|
|
798
776
|
]);
|
|
799
777
|
}
|
|
800
778
|
const releaseLock = options.dryRun
|
|
@@ -10,6 +10,7 @@ import { AgentSkillsAdapter } from './adapters/agent-skills.js';
|
|
|
10
10
|
import { LocalAdapter } from './adapters/local.js';
|
|
11
11
|
import { ClawHubAdapter } from './adapters/clawhub.js';
|
|
12
12
|
import { OpenClawAdapter } from './adapters/openclaw.js';
|
|
13
|
+
import { selectSkillOwners } from './collision-discovery.js';
|
|
13
14
|
/**
|
|
14
15
|
* All known registry adapters
|
|
15
16
|
*/
|
|
@@ -60,10 +61,16 @@ export async function searchSkills(query, providerId) {
|
|
|
60
61
|
const available = await adapter.isAvailable();
|
|
61
62
|
if (!available)
|
|
62
63
|
continue;
|
|
63
|
-
const adapterResults =
|
|
64
|
-
|
|
64
|
+
const adapterResults = adapter.id === 'local' || adapter.id === 'agentskills'
|
|
65
|
+
? await adapter.list() : await adapter.search(query);
|
|
66
|
+
results.push(...adapterResults.map(skill => adapter.id === 'agentskills'
|
|
67
|
+
? { ...skill, origin: 'imported' } : skill));
|
|
65
68
|
}
|
|
66
|
-
|
|
69
|
+
const normalized = query.toLowerCase();
|
|
70
|
+
return selectSkillOwners(results).filter(skill => !skill.origin
|
|
71
|
+
|| skill.name.toLowerCase().includes(normalized)
|
|
72
|
+
|| skill.description.toLowerCase().includes(normalized)
|
|
73
|
+
|| skill.package?.toLowerCase().includes(normalized));
|
|
67
74
|
}
|
|
68
75
|
/**
|
|
69
76
|
* List all skills across adapters (or a specific one)
|
|
@@ -78,9 +85,10 @@ export async function listSkills(providerId) {
|
|
|
78
85
|
if (!available)
|
|
79
86
|
continue;
|
|
80
87
|
const adapterResults = await adapter.list();
|
|
81
|
-
results.push(...adapterResults
|
|
88
|
+
results.push(...adapterResults.map(skill => adapter.id === 'agentskills'
|
|
89
|
+
? { ...skill, origin: 'imported' } : skill));
|
|
82
90
|
}
|
|
83
|
-
return results;
|
|
91
|
+
return selectSkillOwners(results);
|
|
84
92
|
}
|
|
85
93
|
/**
|
|
86
94
|
* Get detailed skill info (checks adapters in order)
|
|
@@ -89,15 +97,22 @@ export async function getSkillInfo(name, providerId) {
|
|
|
89
97
|
const adapters = providerId
|
|
90
98
|
? ALL_ADAPTERS.filter((a) => a.id === providerId)
|
|
91
99
|
: ALL_ADAPTERS;
|
|
100
|
+
const results = [];
|
|
92
101
|
for (const adapter of adapters) {
|
|
102
|
+
if (results.length && adapter.id !== 'local' && adapter.id !== 'agentskills')
|
|
103
|
+
break;
|
|
93
104
|
const available = await adapter.isAvailable();
|
|
94
105
|
if (!available)
|
|
95
106
|
continue;
|
|
96
107
|
const info = await adapter.info(name);
|
|
97
|
-
if (info)
|
|
108
|
+
if (info && adapter.id === 'agentskills')
|
|
109
|
+
info.origin = 'imported';
|
|
110
|
+
if (info && !info.origin)
|
|
98
111
|
return info;
|
|
112
|
+
if (info)
|
|
113
|
+
results.push(info);
|
|
99
114
|
}
|
|
100
|
-
return
|
|
115
|
+
return selectSkillOwners(results)[0];
|
|
101
116
|
}
|
|
102
117
|
/**
|
|
103
118
|
* Install a skill from a specific registry with cross-platform deployment
|
|
@@ -21,6 +21,7 @@ import { findPackageRoot } from '../../cli/find-package-root.js';
|
|
|
21
21
|
import { readAiwgConfigCandidate, validateWorkerConfigCandidate, resolveParallelism, PROVIDER_PARALLELISM_DEFAULTS } from '../../config/aiwg-config.js';
|
|
22
22
|
import { ConfigLoader } from '../../models/config-loader.js';
|
|
23
23
|
import { validateWorkerCatalogDiscovery } from '../../models/provider-policy.js';
|
|
24
|
+
import { wrapperEnforcementReport } from '../../models/wrapper-enforcement.js';
|
|
24
25
|
export const PARALLELISM_BLOCK_START = '<!-- AIWG-PARALLELISM-CAP:START -->';
|
|
25
26
|
export const PARALLELISM_BLOCK_END = '<!-- AIWG-PARALLELISM-CAP:END -->';
|
|
26
27
|
/** Plain-path pointer (not an `@` import) to the long health/supervision explanation. */
|
|
@@ -214,8 +215,9 @@ function delegationSupport(provider) {
|
|
|
214
215
|
case 'cursor':
|
|
215
216
|
case 'factory':
|
|
216
217
|
case 'opencode':
|
|
217
|
-
case 'openclaw':
|
|
218
218
|
return `**Provider behavior (${provider})**: native custom subagents can select the deployed model-worker wrapper. Verify the resolved model when provider or account policy may substitute it.`;
|
|
219
|
+
case 'openclaw':
|
|
220
|
+
return '**Provider behavior (openclaw)**: wrapper Markdown is a reference mirror; native model controls require separate subagent configuration.';
|
|
219
221
|
case 'openhuman':
|
|
220
222
|
return '**Provider behavior (openhuman)**: wrapper roles compile to OpenHuman agent definitions; exact pins validate while semantic hints may be routed dynamically.';
|
|
221
223
|
case 'warp':
|
|
@@ -224,7 +226,7 @@ function delegationSupport(provider) {
|
|
|
224
226
|
case 'windsurf':
|
|
225
227
|
return '**Provider behavior (windsurf)**: portable subagent model selection is unsupported. Apply the decomposition rubric in the primary agent and do not claim wrapper pinning or parallel delegation.';
|
|
226
228
|
default:
|
|
227
|
-
return
|
|
229
|
+
return `**Provider behavior (${provider ?? 'unknown'})**: delegation and per-worker model selection are unverified. Apply the rubric only where the active provider exposes those capabilities, and state any fallback explicitly.`;
|
|
228
230
|
}
|
|
229
231
|
}
|
|
230
232
|
/**
|
|
@@ -297,7 +299,9 @@ export async function buildParallelismSection(projectPath, deps = {}) {
|
|
|
297
299
|
lines.push('Delegation policy and model-worker selection: `aiwg show rule subagent-scoping`.');
|
|
298
300
|
lines.push('After changing project parallelism with `aiwg config set/reset --project`, follow the emitted provider-specific regeneration commands and run `aiwg workspace-context doctor`.');
|
|
299
301
|
lines.push('');
|
|
300
|
-
|
|
302
|
+
for (const provider of cfg.providers.length ? cfg.providers : ['unknown']) {
|
|
303
|
+
lines.push(`${delegationSupport(provider)} ${wrapperEnforcementReport(provider)}`);
|
|
304
|
+
}
|
|
301
305
|
lines.push('');
|
|
302
306
|
lines.push(workerDispatchStateLine(cfg.parallelism, cfg.setup));
|
|
303
307
|
lines.push('');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiwg/cli",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.14",
|
|
4
4
|
"description": "Lightweight AIWG CLI for signed, versioned web-backed resources.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"dist/src/resources/web-release.d.ts",
|
|
45
45
|
"dist/src/dataset/**/*.d.ts",
|
|
46
46
|
"tools/_resolve-impl.mjs",
|
|
47
|
+
"tools/warp/warp-content.mjs",
|
|
47
48
|
"tools/cli/decision-offload-report.mjs",
|
|
48
49
|
"tools/cli/workspace-status.mjs",
|
|
49
50
|
"tools/ralph-external/session-launcher.mjs",
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
"tools/plugin/package-plugins.mjs",
|
|
91
92
|
"tools/plugin/plugin-links.mjs",
|
|
92
93
|
"tools/skills/deploy-skills-codex.mjs",
|
|
94
|
+
"tools/skills/codex-skill-transform.mjs",
|
|
93
95
|
"README.md"
|
|
94
96
|
],
|
|
95
97
|
"repository": {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withModelWrapper } from './model-wrapper.mjs';
|
|
1
2
|
/** Google Antigravity CLI project resource deployment, qualified against 1.1.26. */
|
|
2
3
|
import fs from 'node:fs';
|
|
3
4
|
import path from 'node:path';
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
normalizeDeploymentMode,
|
|
16
17
|
resolveAiwgRoot,
|
|
17
18
|
} from './base.mjs';
|
|
18
|
-
|
|
19
19
|
export const name = 'antigravity';
|
|
20
20
|
export const aliases = ['agy'];
|
|
21
21
|
export const paths = { agents: '.agents/agents', commands: '', skills: '.agents/skills', rules: '' };
|
|
@@ -29,9 +29,7 @@ export const capabilities = {
|
|
|
29
29
|
homeDirectoryDeploy: false,
|
|
30
30
|
parallelCommandAndSkillSurfaces: false,
|
|
31
31
|
};
|
|
32
|
-
|
|
33
32
|
export const mapModel = model => model;
|
|
34
|
-
|
|
35
33
|
const ANTIGRAVITY_TOOL_MAP = new Map([
|
|
36
34
|
['Read', 'view_file'],
|
|
37
35
|
['Write', 'write_to_file'],
|
|
@@ -39,7 +37,6 @@ const ANTIGRAVITY_TOOL_MAP = new Map([
|
|
|
39
37
|
['Grep', 'grep_search'],
|
|
40
38
|
['Bash', 'run_command'],
|
|
41
39
|
]);
|
|
42
|
-
|
|
43
40
|
function mapTools(value) {
|
|
44
41
|
if (!value) return [];
|
|
45
42
|
return value
|
|
@@ -49,7 +46,8 @@ function mapTools(value) {
|
|
|
49
46
|
.filter(Boolean);
|
|
50
47
|
}
|
|
51
48
|
|
|
52
|
-
export
|
|
49
|
+
export const transformAgent = withModelWrapper('antigravity', translateAgent);
|
|
50
|
+
function translateAgent(_source, content) {
|
|
53
51
|
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
|
|
54
52
|
if (!match) return content;
|
|
55
53
|
const frontmatter = match[1];
|
|
@@ -890,7 +890,7 @@ export function deployFiles(files, destDir, opts, transformFn) {
|
|
|
890
890
|
if (a.type === 'deploy') {
|
|
891
891
|
if (dryRun) console.log(`[dry-run] deploy ${a.src} -> ${a.dest} (${a.reason})`);
|
|
892
892
|
else writeFile(a.dest, a.content, false);
|
|
893
|
-
if (verbose) console.log(`deployed ${path.basename(a.src)} -> ${path.relative(process.cwd(), a.dest)} (${a.reason})`);
|
|
893
|
+
if (verbose) console.log(`deployed ${path.basename(a.src)} -> ${path.relative(process.cwd(), opts.logicalOutputPath?.(a.dest) || a.dest)} (${a.reason})`);
|
|
894
894
|
deployedEntries.push({ filename: path.basename(a.dest), hash: a.hash, frameworkSlug: a.frameworkSlug, sourcePath: path.resolve(a.src) });
|
|
895
895
|
} else if (a.type === 'skip') {
|
|
896
896
|
if (verbose) console.log(`skip (${a.reason}): ${path.basename(a.dest)}`);
|
|
@@ -1577,7 +1577,7 @@ function pruneMissingStandardSkills(destDir, opts) {
|
|
|
1577
1577
|
export function deploySkillDir(skillDir, destDir, opts) {
|
|
1578
1578
|
const { force = false, dryRun = false, provider, transformSkillMd } = opts;
|
|
1579
1579
|
const verbose = opts.verbose === true;
|
|
1580
|
-
const skillName = path.basename(skillDir);
|
|
1580
|
+
const skillName = opts.skillName || path.basename(skillDir);
|
|
1581
1581
|
|
|
1582
1582
|
// Check SKILL.md for explicit platform restriction before deploying anything
|
|
1583
1583
|
const skillMdPath = path.join(skillDir, 'SKILL.md');
|
|
@@ -1592,7 +1592,7 @@ export function deploySkillDir(skillDir, destDir, opts) {
|
|
|
1592
1592
|
const destSkillDir = path.join(destDir, skillName);
|
|
1593
1593
|
const previous = readSidecarManifest(destSkillDir);
|
|
1594
1594
|
const frameworkSlug = extractFrameworkSlug(skillMdPath);
|
|
1595
|
-
if (!canDeploySkill(previous, skillDir, opts)) return;
|
|
1595
|
+
if (!canDeploySkill(previous, skillDir, opts)) return false;
|
|
1596
1596
|
const managed = {};
|
|
1597
1597
|
if (!dryRun) ensureDir(destSkillDir);
|
|
1598
1598
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withModelWrapper } from './model-wrapper.mjs';
|
|
1
2
|
import { postDeploy } from './claude-post-deploy.mjs';
|
|
2
3
|
export { postDeploy };
|
|
3
4
|
import { importImpl } from '../../_resolve-impl.mjs';
|
|
@@ -22,7 +23,6 @@ import { importImpl } from '../../_resolve-impl.mjs';
|
|
|
22
23
|
* - Rules: .claude/rules/ (platform-native)
|
|
23
24
|
* - Hooks/settings: .claude/ (platform-native)
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
26
|
import realFs from 'fs';
|
|
27
27
|
import { createRequire } from 'module';
|
|
28
28
|
const _require = createRequire(import.meta.url);
|
|
@@ -62,13 +62,10 @@ import {
|
|
|
62
62
|
buildRemotesTopologyBlock,
|
|
63
63
|
interpolateContextTokens
|
|
64
64
|
} from './base.mjs';
|
|
65
|
-
|
|
66
65
|
import { writeContextFileSync } from './context-write.mjs';
|
|
67
|
-
|
|
68
66
|
// ============================================================================
|
|
69
67
|
// Provider Configuration
|
|
70
68
|
// ============================================================================
|
|
71
|
-
|
|
72
69
|
export const name = 'claude';
|
|
73
70
|
export const aliases = [];
|
|
74
71
|
|
|
@@ -165,7 +162,8 @@ export function mapModel(shorthand, modelCfg, modelsConfig) {
|
|
|
165
162
|
* Transform agent content for Claude
|
|
166
163
|
* Claude is the native format - minimal transformation needed
|
|
167
164
|
*/
|
|
168
|
-
export
|
|
165
|
+
export const transformAgent = withModelWrapper('claude', translateAgent);
|
|
166
|
+
function translateAgent(srcPath, content, opts) {
|
|
169
167
|
const { reasoningModel, codingModel, efficiencyModel } = opts;
|
|
170
168
|
|
|
171
169
|
// Explicit overrides re-map every classified model, pinned or not.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withModelWrapper } from './model-wrapper.mjs';
|
|
1
2
|
import { postDeploy } from './codex-post-deploy.mjs';
|
|
2
3
|
export { postDeploy };
|
|
3
4
|
import { importImpl } from '../../_resolve-impl.mjs';
|
|
@@ -28,7 +29,6 @@ import { importImpl } from '../../_resolve-impl.mjs';
|
|
|
28
29
|
* - Delegates commands to deploy-prompts-codex.mjs (deploys to ~/.codex/prompts/)
|
|
29
30
|
* - Delegates skills to deploy-skills-codex.mjs (deploys to .agents/skills/)
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
32
|
import realFs from 'fs';
|
|
33
33
|
import { createRequire } from 'module';
|
|
34
34
|
const _require = createRequire(import.meta.url);
|
|
@@ -69,15 +69,12 @@ import {
|
|
|
69
69
|
parseFrontmatter,
|
|
70
70
|
resolveAiwgRoot
|
|
71
71
|
} from './base.mjs';
|
|
72
|
-
|
|
73
72
|
import { writeContextFileSync } from './context-write.mjs';
|
|
74
|
-
|
|
75
73
|
function resolveCodexHelperRoot(srcRoot) {
|
|
76
74
|
const resolved = resolveAiwgRoot(srcRoot);
|
|
77
75
|
if (resolved) return resolved;
|
|
78
76
|
return path.resolve(path.dirname(new URL(import.meta.url).pathname), '..', '..', '..');
|
|
79
77
|
}
|
|
80
|
-
|
|
81
78
|
// ============================================================================
|
|
82
79
|
// Provider Configuration
|
|
83
80
|
// ============================================================================
|
|
@@ -206,7 +203,8 @@ export function renderAgentToml(srcPath, content, models) {
|
|
|
206
203
|
/**
|
|
207
204
|
* Transform agent content for Codex
|
|
208
205
|
*/
|
|
209
|
-
export
|
|
206
|
+
export const transformAgent = withModelWrapper('codex', translateAgent);
|
|
207
|
+
function translateAgent(srcPath, content, opts) {
|
|
210
208
|
const { reasoningModel, codingModel, efficiencyModel } = opts;
|
|
211
209
|
const catalogModels = (opts.modelCatalog || loadRuntimeModelCatalog(staticModelCatalog)).providers.codex.roles;
|
|
212
210
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withModelWrapper } from './model-wrapper.mjs';
|
|
1
2
|
import { importImpl } from '../../_resolve-impl.mjs';
|
|
2
3
|
/**
|
|
3
4
|
* GitHub Copilot Provider
|
|
@@ -19,7 +20,6 @@ import { importImpl } from '../../_resolve-impl.mjs';
|
|
|
19
20
|
* - Tool mapping to Copilot built-in tools
|
|
20
21
|
* - Creates copilot-instructions.md
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
23
|
import realFs from 'fs';
|
|
24
24
|
import { createRequire } from 'module';
|
|
25
25
|
const _require = createRequire(import.meta.url);
|
|
@@ -55,14 +55,11 @@ import {
|
|
|
55
55
|
deploySoulCompanions,
|
|
56
56
|
loadRuntimeModelCatalog
|
|
57
57
|
} from './base.mjs';
|
|
58
|
-
|
|
59
58
|
import { writeContextFileSync } from './context-write.mjs';
|
|
60
59
|
const modelCatalog = loadRuntimeModelCatalog(staticModelCatalog);
|
|
61
|
-
|
|
62
60
|
// ============================================================================
|
|
63
61
|
// Provider Configuration
|
|
64
62
|
// ============================================================================
|
|
65
|
-
|
|
66
63
|
export const name = 'copilot';
|
|
67
64
|
export const aliases = [];
|
|
68
65
|
|
|
@@ -191,7 +188,8 @@ export function getTools(category, toolsString) {
|
|
|
191
188
|
* Transform AIWG agent to GitHub Copilot .agent.md format.
|
|
192
189
|
* Output: YAML frontmatter with name, description, tools, model + markdown body (system prompt).
|
|
193
190
|
*/
|
|
194
|
-
export
|
|
191
|
+
export const transformAgent = withModelWrapper('copilot', translateAgent);
|
|
192
|
+
function translateAgent(srcPath, content, opts) {
|
|
195
193
|
const { modelsConfig = {} } = opts;
|
|
196
194
|
|
|
197
195
|
// Parse existing frontmatter
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withModelWrapper } from './model-wrapper.mjs';
|
|
1
2
|
/**
|
|
2
3
|
* Cursor IDE Provider
|
|
3
4
|
*
|
|
@@ -17,7 +18,6 @@
|
|
|
17
18
|
* - $ARGUMENTS -> [arguments] conversion for rules
|
|
18
19
|
* - Delegates rules deployment to deploy-rules-cursor.mjs
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
21
|
import realFs from 'fs';
|
|
22
22
|
import { createRequire } from 'module';
|
|
23
23
|
const _require = createRequire(import.meta.url);
|
|
@@ -56,14 +56,11 @@ import {
|
|
|
56
56
|
loadRuntimeModelCatalog
|
|
57
57
|
} from './base.mjs';
|
|
58
58
|
const modelCatalog = loadRuntimeModelCatalog(staticModelCatalog);
|
|
59
|
-
|
|
60
59
|
// ============================================================================
|
|
61
60
|
// Provider Configuration
|
|
62
61
|
// ============================================================================
|
|
63
|
-
|
|
64
62
|
export const name = 'cursor';
|
|
65
63
|
export const aliases = [];
|
|
66
|
-
|
|
67
64
|
export const paths = {
|
|
68
65
|
agents: '.cursor/agents/',
|
|
69
66
|
commands: '.cursor/commands/',
|
|
@@ -99,7 +96,8 @@ export const capabilities = {
|
|
|
99
96
|
* Transform agent content for Cursor
|
|
100
97
|
* Cursor uses conventional deployment - minimal transformation needed
|
|
101
98
|
*/
|
|
102
|
-
export
|
|
99
|
+
export const transformAgent = withModelWrapper('cursor', translateAgent);
|
|
100
|
+
function translateAgent(srcPath, content, opts) {
|
|
103
101
|
const model = content.match(/^model:\s*(.+)$/m)?.[1]?.trim().replace(/['"]/g, '');
|
|
104
102
|
if (!model) return content;
|
|
105
103
|
const roles = modelCatalog.providers.cursor.roles;
|