@hmharness/agent 0.14.15 → 0.14.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export { buildSystemPrompt } from './prompt.ts';
6
6
  export { strings, type Locale, type Strings } from './i18n.ts';
7
7
  export { makeSpawnTool, MAX_SPAWN_DEPTH, type SpawnBase } from './spawn.ts';
8
8
  export { buildRegistry, contextPack, makeApproval, nativeRegistry, runAgentTask, spawnBase, toServerConfig, type AgentTaskOptions, type RunnerEvents, } from './runner.ts';
9
+ export * from './skills-conformance.ts';
package/dist/index.js CHANGED
@@ -6,3 +6,4 @@ export { buildSystemPrompt } from "./prompt.js";
6
6
  export { strings } from "./i18n.js";
7
7
  export { makeSpawnTool, MAX_SPAWN_DEPTH } from "./spawn.js";
8
8
  export { buildRegistry, contextPack, makeApproval, nativeRegistry, runAgentTask, spawnBase, toServerConfig, } from "./runner.js";
9
+ export * from "./skills-conformance.js";
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @hmharness/agent - Agent Skills Conformance (P1-06)
3
+ *
4
+ * The audit called for: "官方 SKILL.md 格式 + scripts/references/assets +
5
+ * cross-runtime fixtures"
6
+ *
7
+ * Validates skill definitions against the Agent Skills spec so they can
8
+ * migrate across hmharness / Codex / Claude Code / Goose / other clients.
9
+ */
10
+ export interface SkillManifest {
11
+ name: string;
12
+ description: string;
13
+ /** optional metadata */
14
+ version?: string;
15
+ /** entry point script (relative to skill dir) */
16
+ entry?: string;
17
+ /** supported file structure */
18
+ files: {
19
+ 'SKILL.md': boolean;
20
+ 'scripts/'?: boolean;
21
+ 'references/'?: boolean;
22
+ 'assets/'?: boolean;
23
+ };
24
+ }
25
+ export interface ConformanceResult {
26
+ valid: boolean;
27
+ errors: string[];
28
+ warnings: string[];
29
+ /** conformance level achieved */
30
+ level: 'full' | 'partial' | 'none';
31
+ }
32
+ /**
33
+ * Validate a SKILL.md content against the Agent Skills format.
34
+ * Pure - testable.
35
+ */
36
+ export declare function validateSkillMd(content: string): ConformanceResult;
37
+ /**
38
+ * Check a skill directory structure for conformance.
39
+ * Pure - testable.
40
+ */
41
+ export declare function validateSkillStructure(files: string[]): ConformanceResult;
42
+ /**
43
+ * Generate a cross-runtime compatibility report for a skill.
44
+ * Pure - testable.
45
+ */
46
+ export declare function crossRuntimeReport(skill: {
47
+ name: string;
48
+ hasSkillMd: boolean;
49
+ hasScripts: boolean;
50
+ hasReferences: boolean;
51
+ hasAssets: boolean;
52
+ entryLanguage?: string;
53
+ }): string;
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @hmharness/agent - Agent Skills Conformance (P1-06)
3
+ *
4
+ * The audit called for: "官方 SKILL.md 格式 + scripts/references/assets +
5
+ * cross-runtime fixtures"
6
+ *
7
+ * Validates skill definitions against the Agent Skills spec so they can
8
+ * migrate across hmharness / Codex / Claude Code / Goose / other clients.
9
+ */
10
+ /**
11
+ * Validate a SKILL.md content against the Agent Skills format.
12
+ * Pure - testable.
13
+ */
14
+ export function validateSkillMd(content) {
15
+ const errors = [];
16
+ const warnings = [];
17
+ // must have YAML-like frontmatter
18
+ if (!content.startsWith('---')) {
19
+ errors.push('SKILL.md must start with YAML frontmatter (---)');
20
+ }
21
+ else {
22
+ const end = content.indexOf('---', 3);
23
+ if (end === -1) {
24
+ errors.push('SKILL.md frontmatter not closed');
25
+ }
26
+ else {
27
+ const fm = content.slice(3, end);
28
+ if (!/name\s*:/.test(fm))
29
+ errors.push('frontmatter missing "name" field');
30
+ if (!/description\s*:/.test(fm))
31
+ errors.push('frontmatter missing "description" field');
32
+ }
33
+ }
34
+ // must have some content after frontmatter
35
+ const body = content.replace(/^---[\s\S]*?---/, '').trim();
36
+ if (body.length < 10)
37
+ warnings.push('SKILL.md body is very short (<10 chars)');
38
+ // check for common sections
39
+ if (!/## (usage|how to use|instructions)/i.test(body))
40
+ warnings.push('no usage/instructions section found');
41
+ const valid = errors.length === 0;
42
+ const level = valid ? (warnings.length === 0 ? 'full' : 'partial') : 'none';
43
+ return { valid, errors, warnings, level };
44
+ }
45
+ /**
46
+ * Check a skill directory structure for conformance.
47
+ * Pure - testable.
48
+ */
49
+ export function validateSkillStructure(files) {
50
+ const errors = [];
51
+ const warnings = [];
52
+ if (!files.includes('SKILL.md'))
53
+ errors.push('SKILL.md not found');
54
+ if (!files.some(f => f.startsWith('scripts/')))
55
+ warnings.push('no scripts/ directory (optional but recommended)');
56
+ if (!files.some(f => f.startsWith('references/')))
57
+ warnings.push('no references/ directory (optional)');
58
+ const valid = errors.length === 0;
59
+ const level = valid ? (warnings.length === 0 ? 'full' : 'partial') : 'none';
60
+ return { valid, errors, warnings, level };
61
+ }
62
+ /**
63
+ * Generate a cross-runtime compatibility report for a skill.
64
+ * Pure - testable.
65
+ */
66
+ export function crossRuntimeReport(skill) {
67
+ const lines = [`Skill: ${skill.name}`];
68
+ lines.push(` SKILL.md: ${skill.hasSkillMd ? '✅' : '❌'} (required)`);
69
+ lines.push(` scripts/: ${skill.hasScripts ? '✅' : '⚠️ optional'}`);
70
+ lines.push(` references/: ${skill.hasReferences ? '✅' : '⚠️ optional'}`);
71
+ lines.push(` assets/: ${skill.hasAssets ? '✅' : '⚠️ optional'}`);
72
+ if (skill.entryLanguage)
73
+ lines.push(` entry: ${skill.entryLanguage}`);
74
+ const compatible = skill.hasSkillMd;
75
+ lines.push(` Cross-runtime: ${compatible ? '✅ compatible with Agent Skills spec' : '❌ not compatible'}`);
76
+ return lines.join('\n');
77
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/agent",
3
- "version": "0.14.15",
3
+ "version": "0.14.16",
4
4
  "description": "hmharness agent execution layer: base tools, system prompt, sub-agent spawn, and the shared task runner that frontends (cli, web) drive.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",