@aiwg/cli 2026.10.11 → 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/model-catalog.v1.json +62 -12
- package/agentic/code/providers/pi/aiwg-bridge.ts +44 -1
- package/dist/src/artifacts/binding-target-identity.js +51 -0
- package/dist/src/artifacts/checksum-manifest.js +12 -0
- package/dist/src/artifacts/index-builder.js +11 -13
- package/dist/src/artifacts/query-engine.js +5 -11
- package/dist/src/cli/handlers/doctor-help.js +32 -0
- package/dist/src/cli/handlers/gates.js +19 -18
- package/dist/src/cli/handlers/models-help.js +7 -1
- package/dist/src/cli/handlers/models.js +3 -3
- package/dist/src/cli/handlers/script-runner.js +8 -5
- package/dist/src/cli/handlers/sessions-intake.js +104 -0
- package/dist/src/cli/handlers/sessions-tail.js +172 -0
- package/dist/src/cli/handlers/sessions.js +90 -17
- package/dist/src/cli/handlers/skill-lint.js +10 -3
- package/dist/src/cli/handlers/steward-format.js +100 -0
- package/dist/src/cli/handlers/steward-models.js +167 -0
- package/dist/src/cli/handlers/steward.js +14 -248
- package/dist/src/cli/handlers/use-bundle-counts.js +87 -0
- package/dist/src/cli/handlers/use-skill-assets.js +207 -0
- package/dist/src/cli/handlers/use.js +35 -216
- package/dist/src/cli/handlers/utilities.js +1 -24
- package/dist/src/config/aiwg-config.js +7 -0
- package/dist/src/config/authorization-cli.js +97 -0
- package/dist/src/config/cli-help.js +1 -0
- package/dist/src/config/cli.js +10 -1
- 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 -846
- package/dist/src/decision/ensemble/contract.js +17 -26
- package/dist/src/decision/ensemble-study/artifacts.js +5 -0
- package/dist/src/decision/ensemble-study/score.js +4 -3
- package/dist/src/decision/feature-export.js +3 -9
- package/dist/src/decision/heldout/collector.js +2 -2
- package/dist/src/decision/issue-triage/runtime.js +3 -9
- package/dist/src/decision/qualification/gates.js +2 -1
- package/dist/src/decision/qualification/release.js +6 -64
- package/dist/src/decision/routing/report.js +2 -0
- package/dist/src/decision/sdlc-screening.js +3 -5
- package/dist/src/decision/sensitivity/comparative.js +5 -3
- 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/driver.js +6 -77
- package/dist/src/gates/evaluate.js +6 -23
- package/dist/src/gates/floors.js +4 -4
- package/dist/src/gates/index.js +3 -3
- package/dist/src/gates/lattice.js +26 -0
- package/dist/src/gates/registry.js +2 -1
- package/dist/src/gates/report.js +19 -7
- package/dist/src/gates/upstream-ceiling.js +111 -0
- package/dist/src/issues/audit-cli.js +120 -0
- package/dist/src/issues/audit-contract.js +64 -0
- package/dist/src/issues/audit-local.js +82 -0
- package/dist/src/issues/audit.js +220 -0
- package/dist/src/lint/rule-activation.js +15 -1
- package/dist/src/mission-protocol/canonical-codecs.js +270 -0
- package/dist/src/mission-protocol/codecs.js +22 -550
- package/dist/src/mission-protocol/health-trace-codecs.js +281 -0
- package/dist/src/mission-protocol/health-trace-types.js +43 -0
- package/dist/src/mission-protocol/types.js +2 -42
- package/dist/src/mission-protocol/worker-contract-json.js +10 -0
- package/dist/src/mission-protocol/worker-review-gate.js +100 -0
- package/dist/src/mission-protocol/worker-review-types.js +2 -0
- package/dist/src/models/catalog-policy.js +280 -0
- package/dist/src/models/index.js +1 -1
- package/dist/src/models/model-catalog.v1.json +62 -12
- package/dist/src/models/policy-resources.js +28 -0
- package/dist/src/models/provider-models.js +5 -8
- package/dist/src/models/provider-policy.js +10 -546
- package/dist/src/models/resolver.js +26 -8
- package/dist/src/models/router.js +15 -2
- package/dist/src/models/tiers.js +13 -0
- package/dist/src/models/types.js +0 -6
- package/dist/src/models/worker-ceilings.js +59 -0
- package/dist/src/models/worker-invocation-policy.js +243 -0
- package/dist/src/models/worker-plan.js +16 -20
- package/dist/src/models/worker-review-lineage.js +55 -0
- package/dist/src/models/worker-selection-policy.js +1 -1
- 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/models/wrapper-route.js +6 -3
- package/dist/src/policy/authorization.js +1 -0
- package/dist/src/policy/hitl-check.js +80 -0
- package/dist/src/policy/hitl-config.js +63 -0
- package/dist/src/policy/hitl-receipt.js +57 -0
- package/dist/src/policy/hitl-types.js +4 -0
- package/dist/src/policy/hitl-validation.js +39 -0
- package/dist/src/policy/hitl.js +117 -0
- package/dist/src/rules/activation.d.mts +3 -1
- package/dist/src/rules/activation.mjs +23 -2
- package/dist/src/rules/gate-coverage.js +51 -0
- package/dist/src/rules/gate-references.js +16 -0
- package/dist/src/rules/rule-frontmatter.schema.json +7 -1
- package/dist/src/serve/worker-command-request.js +21 -4
- package/dist/src/serve/worker-invocation-preparation.js +3 -1
- package/dist/src/serve/worker-invocation.js +21 -10
- package/dist/src/sessions/adapters/deepseek-harness.js +1 -0
- package/dist/src/sessions/adapters/grok-build-native.js +269 -0
- package/dist/src/sessions/adapters/grok-build.js +57 -15
- package/dist/src/sessions/adapters/hermes-state-db.js +252 -0
- package/dist/src/sessions/adapters/hermes.js +42 -3
- package/dist/src/sessions/adapters/warp.js +1 -1
- package/dist/src/sessions/batch-import.js +10 -0
- package/dist/src/sessions/contracts.js +1 -1
- package/dist/src/sessions/discovery-capability.js +38 -0
- package/dist/src/sessions/importer.js +8 -251
- package/dist/src/sessions/index.js +4 -0
- package/dist/src/sessions/intake-dir.js +71 -0
- package/dist/src/sessions/normalization.js +251 -0
- package/dist/src/sessions/tail.js +91 -0
- package/dist/src/sessions/workspace-discovery.js +83 -7
- package/dist/src/skills/adapters/local.js +32 -9
- package/dist/src/skills/agent-skill-sidecar.js +28 -0
- package/dist/src/skills/agent-skills.js +6 -23
- package/dist/src/skills/claude-surface-projection.js +25 -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 +26 -361
- package/dist/src/skills/deployment-ownership.js +74 -0
- package/dist/src/skills/deployment-policy.js +114 -0
- package/dist/src/skills/deployment-projection.js +152 -0
- package/dist/src/skills/deployment-types.js +20 -0
- package/dist/src/skills/doctor.js +2 -2
- package/dist/src/skills/exporter.js +8 -31
- package/dist/src/skills/importer.js +4 -26
- package/dist/src/skills/provider-extensions.js +41 -0
- package/dist/src/skills/registry.js +22 -7
- package/dist/src/skills/run.js +6 -0
- package/dist/src/skills/types.js +0 -8
- package/dist/src/skills/validator-resources.js +68 -0
- package/dist/src/skills/validator.js +6 -55
- package/dist/src/smiths/context-pipeline/parallelism-section.js +7 -3
- package/dist/src/storage/cli-migrate-options.js +125 -0
- package/dist/src/storage/cli-migrate.js +111 -0
- package/dist/src/storage/cli.js +4 -279
- package/dist/src/storage/migration-adapter.js +79 -0
- package/dist/src/storage/migration-copy.js +108 -0
- package/dist/src/storage/migration-protocol.js +14 -197
- package/dist/src/storage/migration-records.js +186 -0
- package/dist/src/storage/migration-types.js +12 -0
- package/dist/src/tracker/forge-http.js +2 -1
- package/dist/src/tracker/issue-pages.js +110 -0
- package/package.json +3 -1
- package/schemas/mission-v1.schema.json +335 -0
- package/schemas/models/model-catalog.v1.schema.json +19 -1
- package/schemas/models/model-config-compatibility.v1.schema.json +3 -2
- package/schemas/models/model-policy.v1.schema.json +1 -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 +44 -0
- package/tools/agents/providers/rule-binding-targets.mjs +146 -0
- package/tools/agents/providers/rule-delivery.mjs +9 -128
- 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
- package/vscode-extension/schemas/aiwg.config.v1.json +177 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Project immutable managed sources into provider frontmatter and sidecars.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { stringify } from 'yaml';
|
|
5
|
+
import { createAgentSkillSidecar, projectStrictAgentSkill } from './agent-skills.js';
|
|
6
|
+
import { agentSkillDocument, claudeSkillExtensions } from './provider-extensions.js';
|
|
7
|
+
import { validateAgentSkillContent } from './validator.js';
|
|
8
|
+
import { AGENT_SKILL_MANAGED_MARKER, AGENT_SKILL_DEPLOYMENT_SIDECAR, fail, } from './deployment-types.js';
|
|
9
|
+
function assertSafeSourceEntry(sourceRoot, absolutePath, relativePath) {
|
|
10
|
+
const stat = fs.lstatSync(absolutePath);
|
|
11
|
+
if (stat.isSymbolicLink()) {
|
|
12
|
+
fail('AS_DEPLOY_SOURCE_SYMLINK', `managed source contains a symlink: ${relativePath}`);
|
|
13
|
+
}
|
|
14
|
+
if (!stat.isDirectory() && !stat.isFile()) {
|
|
15
|
+
fail('AS_DEPLOY_SOURCE_SPECIAL_FILE', `managed source contains a non-regular entry: ${relativePath}`);
|
|
16
|
+
}
|
|
17
|
+
const real = fs.realpathSync.native(absolutePath);
|
|
18
|
+
const relativeReal = path.relative(fs.realpathSync.native(sourceRoot), real);
|
|
19
|
+
if (relativeReal.startsWith('..') || path.isAbsolute(relativeReal)) {
|
|
20
|
+
fail('AS_DEPLOY_SOURCE_ESCAPE', `managed source entry escapes its root: ${relativePath}`);
|
|
21
|
+
}
|
|
22
|
+
return stat;
|
|
23
|
+
}
|
|
24
|
+
function collectSourceEntries(sourceRoot) {
|
|
25
|
+
const entries = [];
|
|
26
|
+
const walk = (current, prefix) => {
|
|
27
|
+
for (const entry of fs.readdirSync(current, { withFileTypes: true })
|
|
28
|
+
.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
29
|
+
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
30
|
+
if (relativePath === AGENT_SKILL_MANAGED_MARKER
|
|
31
|
+
|| relativePath === AGENT_SKILL_DEPLOYMENT_SIDECAR) {
|
|
32
|
+
fail('AS_DEPLOY_RESERVED_PATH', `managed source uses reserved deployment path "${relativePath}"`);
|
|
33
|
+
}
|
|
34
|
+
const absolutePath = path.join(current, entry.name);
|
|
35
|
+
const stat = assertSafeSourceEntry(sourceRoot, absolutePath, relativePath);
|
|
36
|
+
if (stat.isDirectory()) {
|
|
37
|
+
entries.push({ kind: 'directory', relativePath });
|
|
38
|
+
walk(absolutePath, relativePath);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
entries.push({
|
|
42
|
+
kind: 'file',
|
|
43
|
+
relativePath,
|
|
44
|
+
bytes: fs.readFileSync(absolutePath),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
walk(sourceRoot, '');
|
|
50
|
+
return entries;
|
|
51
|
+
}
|
|
52
|
+
export function projectionDocument(record) {
|
|
53
|
+
const sourceEntries = collectSourceEntries(record.managedLocation);
|
|
54
|
+
const skillFile = sourceEntries.find((entry) => (entry.kind === 'file' && entry.relativePath === 'SKILL.md'));
|
|
55
|
+
if (!skillFile) {
|
|
56
|
+
fail('AS_DEPLOY_SKILL_MISSING', 'managed source does not contain SKILL.md');
|
|
57
|
+
}
|
|
58
|
+
const content = new TextDecoder('utf-8', { fatal: true }).decode(skillFile.bytes);
|
|
59
|
+
const validation = validateAgentSkillContent(content, {
|
|
60
|
+
profile: record.validationProfile,
|
|
61
|
+
file: path.join(record.managedLocation, 'SKILL.md'),
|
|
62
|
+
directoryName: record.name,
|
|
63
|
+
skillRoot: record.managedLocation,
|
|
64
|
+
checkResources: true,
|
|
65
|
+
});
|
|
66
|
+
if (!validation.valid || !validation.frontmatter) {
|
|
67
|
+
fail('AS_DEPLOY_SOURCE_INVALID', `managed source for "${record.name}" no longer passes ${record.validationProfile} validation`);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
document: agentSkillDocument(validation.frontmatter, validation.body),
|
|
71
|
+
sourceEntries,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export function providerSkillBytes(record, policy, document, originalBytes) {
|
|
75
|
+
const metadata = { ...projectStrictAgentSkill(document) };
|
|
76
|
+
const extensions = claudeSkillExtensions(document);
|
|
77
|
+
if (policy.provider === 'claude') {
|
|
78
|
+
Object.assign(metadata, extensions);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
for (const field of Object.keys(extensions).sort()) {
|
|
82
|
+
const warning = `Claude skill field "${field}" is dropped for provider "${policy.provider}"; retained in providers.claude sidecar only`;
|
|
83
|
+
policy.warnings.push(warning);
|
|
84
|
+
policy.reasons.push(warning);
|
|
85
|
+
policy.status = 'degraded';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (policy.appendToDescription) {
|
|
89
|
+
const suffix = policy.appendToDescription;
|
|
90
|
+
if (!metadata.description.endsWith(suffix)) {
|
|
91
|
+
metadata.description = `${metadata.description.trimEnd()} ${suffix}`;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (policy.maxDescriptionLength !== undefined
|
|
95
|
+
&& metadata.description.length > policy.maxDescriptionLength) {
|
|
96
|
+
policy.status = 'degraded';
|
|
97
|
+
policy.supported = false;
|
|
98
|
+
policy.reasons.push(`description length ${metadata.description.length} exceeds the provider limit ${policy.maxDescriptionLength}; no truncation was applied`);
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
const frontmatter = stringify(metadata, {
|
|
102
|
+
lineWidth: 0,
|
|
103
|
+
sortMapEntries: false,
|
|
104
|
+
}).trimEnd();
|
|
105
|
+
const content = `---\n${frontmatter}\n---\n${document.body}`;
|
|
106
|
+
const validation = validateAgentSkillContent(content, {
|
|
107
|
+
profile: policy.provider === 'claude' ? 'compatible' : 'strict',
|
|
108
|
+
file: 'SKILL.md',
|
|
109
|
+
directoryName: record.name,
|
|
110
|
+
});
|
|
111
|
+
if (!validation.valid) {
|
|
112
|
+
policy.status = 'degraded';
|
|
113
|
+
policy.supported = false;
|
|
114
|
+
policy.reasons.push(`provider projection failed validation: ${validation.diagnostics
|
|
115
|
+
.filter((item) => item.severity === 'error')
|
|
116
|
+
.map((item) => item.code)
|
|
117
|
+
.join(', ')}`);
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
if (policy.provider === 'claude' && originalBytes
|
|
121
|
+
&& document.unknownFields.length === 0
|
|
122
|
+
&& Object.keys(document.aiwg).every((key) => Object.hasOwn(extensions, key)))
|
|
123
|
+
return Buffer.from(originalBytes);
|
|
124
|
+
return Buffer.from(content, 'utf8');
|
|
125
|
+
}
|
|
126
|
+
export function sidecarBytes(record, policy, document) {
|
|
127
|
+
const portableSidecar = createAgentSkillSidecar(document, {
|
|
128
|
+
sourceKind: record.source.kind,
|
|
129
|
+
locator: record.source.locator,
|
|
130
|
+
...(record.source.kind === 'git'
|
|
131
|
+
? {
|
|
132
|
+
requestedRevision: record.source.requestedRevision,
|
|
133
|
+
resolvedRevision: record.source.resolvedRevision,
|
|
134
|
+
}
|
|
135
|
+
: {}),
|
|
136
|
+
sourceDigest: record.digest,
|
|
137
|
+
importedAt: record.importedAt,
|
|
138
|
+
aiwgVersion: record.aiwgVersion,
|
|
139
|
+
}, record.validationProfile, record.trust);
|
|
140
|
+
return Buffer.from(`${JSON.stringify({
|
|
141
|
+
schemaVersion: 1,
|
|
142
|
+
kind: 'aiwg-managed-agent-skill-projection',
|
|
143
|
+
name: record.name,
|
|
144
|
+
provider: policy.provider,
|
|
145
|
+
projectionStatus: policy.status,
|
|
146
|
+
sourceDigest: record.digest,
|
|
147
|
+
reasons: policy.reasons,
|
|
148
|
+
warnings: policy.warnings,
|
|
149
|
+
portable: portableSidecar,
|
|
150
|
+
}, null, 2)}\n`, 'utf8');
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=deployment-projection.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const AGENT_SKILL_MANAGED_MARKER = '.aiwg-managed';
|
|
2
|
+
export const AGENT_SKILL_DEPLOYMENT_SIDECAR = '.aiwg-agent-skill.json';
|
|
3
|
+
export const MARKER_CONTENT = 'aiwg-agent-skill-v1\n';
|
|
4
|
+
export class AgentSkillDeploymentError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
constructor(code, message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.name = 'AgentSkillDeploymentError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function fail(code, message) {
|
|
13
|
+
throw new AgentSkillDeploymentError(code, message);
|
|
14
|
+
}
|
|
15
|
+
export function assertPortableName(name) {
|
|
16
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name) || name.length > 64) {
|
|
17
|
+
fail('AS_DEPLOY_NAME', 'Agent Skill name must be 1-64 lowercase ASCII letters, numbers, or single hyphens');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=deployment-types.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
|
}
|
|
@@ -13,18 +13,10 @@ import fs from 'node:fs';
|
|
|
13
13
|
import path from 'node:path';
|
|
14
14
|
import { fileURLToPath } from 'node:url';
|
|
15
15
|
import { stringify } from 'yaml';
|
|
16
|
-
import { AGENT_SKILLS_BASELINE,
|
|
16
|
+
import { AGENT_SKILLS_BASELINE, projectStrictAgentSkill, } from './agent-skills.js';
|
|
17
17
|
import { validateAgentSkillContent } from './validator.js';
|
|
18
|
+
import { agentSkillDocument } from './provider-extensions.js';
|
|
18
19
|
export const AGENT_SKILL_EXPORT_SIDECAR = '.aiwg-agent-skill-export.json';
|
|
19
|
-
const STANDARD_FIELDS = [
|
|
20
|
-
'name',
|
|
21
|
-
'description',
|
|
22
|
-
'license',
|
|
23
|
-
'compatibility',
|
|
24
|
-
'metadata',
|
|
25
|
-
'allowed-tools',
|
|
26
|
-
];
|
|
27
|
-
const AIWG_FIELDS = new Set(AIWG_SKILL_CONTROL_FIELDS);
|
|
28
20
|
export class AgentSkillExportError extends Error {
|
|
29
21
|
code;
|
|
30
22
|
constructor(code, message) {
|
|
@@ -160,28 +152,11 @@ function parseDocument(sourceRoot, entries) {
|
|
|
160
152
|
.map((item) => item.code)
|
|
161
153
|
.join(', ')}`);
|
|
162
154
|
}
|
|
163
|
-
const
|
|
164
|
-
for (const key of STANDARD_FIELDS) {
|
|
165
|
-
const value = validation.frontmatter[key];
|
|
166
|
-
if (value !== undefined)
|
|
167
|
-
Object.assign(standard, { [key]: structuredClone(value) });
|
|
168
|
-
}
|
|
169
|
-
const aiwg = {};
|
|
170
|
-
for (const [key, value] of Object.entries(validation.frontmatter)) {
|
|
171
|
-
if (AIWG_FIELDS.has(key)) {
|
|
172
|
-
aiwg[key] = structuredClone(value);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
155
|
+
const document = agentSkillDocument(validation.frontmatter, validation.body);
|
|
175
156
|
return {
|
|
176
|
-
document
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
resources: [],
|
|
180
|
-
aiwg,
|
|
181
|
-
unknownFields: [],
|
|
182
|
-
},
|
|
183
|
-
description: validation.frontmatter.description,
|
|
184
|
-
omittedAiwgFields: Object.keys(aiwg).sort(),
|
|
157
|
+
document,
|
|
158
|
+
description: document.standard.description,
|
|
159
|
+
omittedAiwgFields: Object.keys(document.aiwg).sort(),
|
|
185
160
|
};
|
|
186
161
|
}
|
|
187
162
|
function strictSkillEntry(sourceRoot, document) {
|
|
@@ -332,6 +307,7 @@ export function exportAgentSkillDirectory(sourceDir, options) {
|
|
|
332
307
|
sourceDigest,
|
|
333
308
|
exportDigest: '',
|
|
334
309
|
omittedAiwgFields,
|
|
310
|
+
...(document.providers ? { providers: document.providers } : {}),
|
|
335
311
|
fileCount: 0,
|
|
336
312
|
totalBytes: 0,
|
|
337
313
|
exportedAt,
|
|
@@ -360,6 +336,7 @@ export function exportAgentSkillDirectory(sourceDir, options) {
|
|
|
360
336
|
sourceDigest,
|
|
361
337
|
exportDigest,
|
|
362
338
|
omittedAiwgFields,
|
|
339
|
+
...(document.providers ? { providers: document.providers } : {}),
|
|
363
340
|
fileCount,
|
|
364
341
|
totalBytes,
|
|
365
342
|
exportedAt,
|
|
@@ -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
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Classify Claude-native fields separately from portable Agent Skills metadata.
|
|
2
|
+
import { AIWG_SKILL_CONTROL_FIELDS, STANDARD_SKILL_FIELDS, } from './agent-skills.js';
|
|
3
|
+
export const CLAUDE_SKILL_FIELDS = [
|
|
4
|
+
'disable-model-invocation', 'user-invocable', 'disallowed-tools', 'context',
|
|
5
|
+
'agent', 'background', 'model', 'effort', 'paths', 'shell', 'argument-hint',
|
|
6
|
+
'arguments',
|
|
7
|
+
];
|
|
8
|
+
export function agentSkillDocument(frontmatter, body) {
|
|
9
|
+
const standard = Object.fromEntries(STANDARD_SKILL_FIELDS
|
|
10
|
+
.filter((key) => Object.hasOwn(frontmatter, key))
|
|
11
|
+
.map((key) => [key, structuredClone(frontmatter[key])]));
|
|
12
|
+
const aiwg = Object.fromEntries(AIWG_SKILL_CONTROL_FIELDS
|
|
13
|
+
.filter((key) => Object.hasOwn(frontmatter, key))
|
|
14
|
+
.map((key) => [key, structuredClone(frontmatter[key])]));
|
|
15
|
+
const claude = Object.fromEntries(CLAUDE_SKILL_FIELDS
|
|
16
|
+
.filter((key) => Object.hasOwn(frontmatter, key))
|
|
17
|
+
.map((key) => [key, structuredClone(frontmatter[key])]));
|
|
18
|
+
const known = new Set([
|
|
19
|
+
...STANDARD_SKILL_FIELDS, ...AIWG_SKILL_CONTROL_FIELDS, ...CLAUDE_SKILL_FIELDS,
|
|
20
|
+
]);
|
|
21
|
+
return {
|
|
22
|
+
standard: standard,
|
|
23
|
+
aiwg,
|
|
24
|
+
...(Object.keys(claude).length ? { providers: { claude } } : {}),
|
|
25
|
+
body,
|
|
26
|
+
resources: [],
|
|
27
|
+
unknownFields: Object.entries(frontmatter)
|
|
28
|
+
.filter(([key]) => !known.has(key))
|
|
29
|
+
.map(([key, value]) => ({ key, value: structuredClone(value) })),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** Older sidecars retained context/effort under aiwg; preserve that spelling. */
|
|
33
|
+
export function claudeSkillExtensions(document) {
|
|
34
|
+
return {
|
|
35
|
+
...Object.fromEntries(CLAUDE_SKILL_FIELDS
|
|
36
|
+
.filter((key) => Object.hasOwn(document.aiwg, key))
|
|
37
|
+
.map((key) => [key, structuredClone(document.aiwg[key])])),
|
|
38
|
+
...structuredClone(document.providers?.claude ?? {}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=provider-extensions.js.map
|
|
@@ -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
|
package/dist/src/skills/run.js
CHANGED
|
@@ -159,6 +159,12 @@ export async function runSkill(opts) {
|
|
|
159
159
|
...(aiwgRoot ? { AIWG_ROOT: aiwgRoot } : {}),
|
|
160
160
|
...opts.env,
|
|
161
161
|
};
|
|
162
|
+
// Native source owner shares the same indexed script declaration and project CWD.
|
|
163
|
+
if (entry.path.replaceAll('\\', '/').endsWith('agentic/code/frameworks/sdlc-complete/skills/issue-audit/SKILL.md')
|
|
164
|
+
&& entry.script.entrypoint === 'scripts/audit.mjs') {
|
|
165
|
+
const audit = await import('../issues/audit-cli.js');
|
|
166
|
+
return audit.main(opts.args, runCwd, { env });
|
|
167
|
+
}
|
|
162
168
|
const fullArgs = [...invocation.prefixArgs, entrypointPath, ...opts.args];
|
|
163
169
|
return new Promise((resolve) => {
|
|
164
170
|
const child = spawn(invocation.command, fullArgs, {
|
package/dist/src/skills/types.js
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Diagnose bundled skill resource references without changing parser policy.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { AGENT_SKILLS_BASELINE } from './agent-skills.js';
|
|
5
|
+
const MARKDOWN_LINK = /!?\[[^\]]*]\(\s*(?:<([^>]+)>|([^\s)]+))(?:\s+["'][^)]*["'])?\s*\)/g;
|
|
6
|
+
function diagnostic(code, severity, file, yamlPath, message, remediation) {
|
|
7
|
+
return {
|
|
8
|
+
code,
|
|
9
|
+
severity,
|
|
10
|
+
file,
|
|
11
|
+
yamlPath,
|
|
12
|
+
message,
|
|
13
|
+
upstreamBaseline: AGENT_SKILLS_BASELINE.revision,
|
|
14
|
+
remediation,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function resourceDiagnostics(content, file, skillRoot, checkResources) {
|
|
18
|
+
const diagnostics = [];
|
|
19
|
+
const references = new Set();
|
|
20
|
+
for (const match of content.matchAll(MARKDOWN_LINK)) {
|
|
21
|
+
const raw = (match[1] ?? match[2] ?? '').trim();
|
|
22
|
+
if (raw.length === 0
|
|
23
|
+
|| raw.startsWith('#')
|
|
24
|
+
|| /^(?:https?|mailto|data):/i.test(raw)) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const withoutFragment = raw.split('#', 1)[0] ?? '';
|
|
28
|
+
const decoded = (() => {
|
|
29
|
+
try {
|
|
30
|
+
return decodeURIComponent(withoutFragment);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return withoutFragment;
|
|
34
|
+
}
|
|
35
|
+
})();
|
|
36
|
+
references.add(decoded);
|
|
37
|
+
}
|
|
38
|
+
for (const reference of [...references].sort()) {
|
|
39
|
+
const normalized = reference.replaceAll('\\', '/');
|
|
40
|
+
if (path.isAbsolute(reference)
|
|
41
|
+
|| normalized === '..'
|
|
42
|
+
|| normalized.startsWith('../')
|
|
43
|
+
|| normalized.includes('/../')) {
|
|
44
|
+
diagnostics.push(diagnostic('AS_RESOURCE_PATH', 'warning', file, '$.body', `resource reference "${reference}" is not an in-skill relative path`, 'Reference a file relative to SKILL.md without parent traversal.'));
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const segments = normalized.split('/').filter(Boolean);
|
|
48
|
+
if (segments.length > 2) {
|
|
49
|
+
diagnostics.push(diagnostic('AS_ADVISORY_RESOURCE_DEPTH', 'warning', file, '$.body', `resource reference "${reference}" is deeper than one resource-directory level`, 'Prefer resources such as references/topic.md, scripts/run.sh, or assets/example.json.'));
|
|
50
|
+
}
|
|
51
|
+
if (!checkResources || !skillRoot)
|
|
52
|
+
continue;
|
|
53
|
+
const resolved = path.resolve(skillRoot, reference);
|
|
54
|
+
const relative = path.relative(skillRoot, resolved);
|
|
55
|
+
if (relative.startsWith('..')
|
|
56
|
+
|| path.isAbsolute(relative)
|
|
57
|
+
|| !fs.existsSync(resolved)) {
|
|
58
|
+
diagnostics.push(diagnostic('AS_RESOURCE_MISSING', 'warning', file, '$.body', `referenced resource "${reference}" does not exist`, 'Add the referenced file or correct the relative resource path.'));
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const stat = fs.lstatSync(resolved);
|
|
62
|
+
if (stat.isSymbolicLink() || !stat.isFile()) {
|
|
63
|
+
diagnostics.push(diagnostic('AS_RESOURCE_TYPE', 'warning', file, '$.body', `referenced resource "${reference}" is not a regular file`, 'Replace the reference target with an in-tree regular file.'));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return diagnostics;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=validator-resources.js.map
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
import fs from 'node:fs';
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
import { parseDocument } from 'yaml';
|
|
13
|
+
import { resourceDiagnostics } from './validator-resources.js';
|
|
14
|
+
import { CLAUDE_SKILL_FIELDS } from './provider-extensions.js';
|
|
13
15
|
import { AGENT_SKILLS_BASELINE, AGENT_SKILL_VALIDATION_PROFILES, AIWG_SKILL_CONTROL_FIELDS, STANDARD_SKILL_FIELDS, validateCompatibleAgentSkillMetadata, } from './agent-skills.js';
|
|
14
16
|
const FRONTMATTER = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/;
|
|
15
|
-
const MARKDOWN_LINK = /!?\[[^\]]*]\(\s*(?:<([^>]+)>|([^\s)]+))(?:\s+["'][^)]*["'])?\s*\)/g;
|
|
16
17
|
const STANDARD_FIELDS = new Set(STANDARD_SKILL_FIELDS);
|
|
17
18
|
const AIWG_FIELDS = new Set(AIWG_SKILL_CONTROL_FIELDS);
|
|
19
|
+
const CLAUDE_FIELDS = new Set(CLAUDE_SKILL_FIELDS);
|
|
18
20
|
function diagnostic(code, severity, file, yamlPath, message, remediation) {
|
|
19
21
|
return {
|
|
20
22
|
code,
|
|
@@ -49,64 +51,13 @@ function normalizeMetadataDiagnostics(diagnostics, frontmatter, profile, file) {
|
|
|
49
51
|
});
|
|
50
52
|
if (!policy.recognizedAiwgFields) {
|
|
51
53
|
for (const key of Object.keys(frontmatter).sort()) {
|
|
52
|
-
if (!AIWG_FIELDS.has(key))
|
|
54
|
+
if (!AIWG_FIELDS.has(key) && !CLAUDE_FIELDS.has(key))
|
|
53
55
|
continue;
|
|
54
|
-
normalized.push(diagnostic('AS_FIELD_EXTENSION', 'error', file, `$.${key}`, `AIWG extension field "${key}" is not allowed by the strict profile`, 'Remove the extension field or validate with the compatible profile.'));
|
|
56
|
+
normalized.push(diagnostic('AS_FIELD_EXTENSION', 'error', file, `$.${key}`, `Provider or AIWG extension field "${key}" is not allowed by the strict profile`, 'Remove the extension field or validate with the compatible profile.'));
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
return normalized;
|
|
58
60
|
}
|
|
59
|
-
function resourceDiagnostics(content, file, skillRoot, checkResources) {
|
|
60
|
-
const diagnostics = [];
|
|
61
|
-
const references = new Set();
|
|
62
|
-
for (const match of content.matchAll(MARKDOWN_LINK)) {
|
|
63
|
-
const raw = (match[1] ?? match[2] ?? '').trim();
|
|
64
|
-
if (raw.length === 0
|
|
65
|
-
|| raw.startsWith('#')
|
|
66
|
-
|| /^(?:https?|mailto|data):/i.test(raw)) {
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
const withoutFragment = raw.split('#', 1)[0] ?? '';
|
|
70
|
-
const decoded = (() => {
|
|
71
|
-
try {
|
|
72
|
-
return decodeURIComponent(withoutFragment);
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
return withoutFragment;
|
|
76
|
-
}
|
|
77
|
-
})();
|
|
78
|
-
references.add(decoded);
|
|
79
|
-
}
|
|
80
|
-
for (const reference of [...references].sort()) {
|
|
81
|
-
const normalized = reference.replaceAll('\\', '/');
|
|
82
|
-
if (path.isAbsolute(reference)
|
|
83
|
-
|| normalized === '..'
|
|
84
|
-
|| normalized.startsWith('../')
|
|
85
|
-
|| normalized.includes('/../')) {
|
|
86
|
-
diagnostics.push(diagnostic('AS_RESOURCE_PATH', 'warning', file, '$.body', `resource reference "${reference}" is not an in-skill relative path`, 'Reference a file relative to SKILL.md without parent traversal.'));
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
const segments = normalized.split('/').filter(Boolean);
|
|
90
|
-
if (segments.length > 2) {
|
|
91
|
-
diagnostics.push(diagnostic('AS_ADVISORY_RESOURCE_DEPTH', 'warning', file, '$.body', `resource reference "${reference}" is deeper than one resource-directory level`, 'Prefer resources such as references/topic.md, scripts/run.sh, or assets/example.json.'));
|
|
92
|
-
}
|
|
93
|
-
if (!checkResources || !skillRoot)
|
|
94
|
-
continue;
|
|
95
|
-
const resolved = path.resolve(skillRoot, reference);
|
|
96
|
-
const relative = path.relative(skillRoot, resolved);
|
|
97
|
-
if (relative.startsWith('..')
|
|
98
|
-
|| path.isAbsolute(relative)
|
|
99
|
-
|| !fs.existsSync(resolved)) {
|
|
100
|
-
diagnostics.push(diagnostic('AS_RESOURCE_MISSING', 'warning', file, '$.body', `referenced resource "${reference}" does not exist`, 'Add the referenced file or correct the relative resource path.'));
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
const stat = fs.lstatSync(resolved);
|
|
104
|
-
if (stat.isSymbolicLink() || !stat.isFile()) {
|
|
105
|
-
diagnostics.push(diagnostic('AS_RESOURCE_TYPE', 'warning', file, '$.body', `referenced resource "${reference}" is not a regular file`, 'Replace the reference target with an in-tree regular file.'));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return diagnostics;
|
|
109
|
-
}
|
|
110
61
|
function resultState(diagnostics, profile) {
|
|
111
62
|
const errors = diagnostics.filter((item) => item.severity === 'error');
|
|
112
63
|
if (errors.length > 0) {
|
|
@@ -213,7 +164,7 @@ export function validateAgentSkillContent(content, options = {}) {
|
|
|
213
164
|
// Defensive policy check: a future field added to one allow-list must not
|
|
214
165
|
// silently escape classification in this parser.
|
|
215
166
|
for (const key of Object.keys(frontmatter).sort()) {
|
|
216
|
-
if (STANDARD_FIELDS.has(key) || AIWG_FIELDS.has(key))
|
|
167
|
+
if (STANDARD_FIELDS.has(key) || AIWG_FIELDS.has(key) || CLAUDE_FIELDS.has(key))
|
|
217
168
|
continue;
|
|
218
169
|
if (!diagnostics.some((item) => item.yamlPath === `$.${key}`)) {
|
|
219
170
|
diagnostics.push(diagnostic('AS_FIELD_UNKNOWN', AGENT_SKILL_VALIDATION_PROFILES[profile].unknownField, file, `$.${key}`, `unrecognized top-level field "${key}"`, 'Remove the field or map it explicitly before granting it policy meaning.'));
|
|
@@ -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('');
|