Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/server/src/core/skills/SkillManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
SkillRegistry,
SkillSelector,
loadSkillMarkdownFile,
resolveBuiltinSkillsDirectory,
parseSkillMarkdown,
type LoadedSkillContext,
type SignedSkillRegistryEntry,
Expand All @@ -22,7 +23,7 @@ import { listSkillFiles, type ParsedSkillFile } from './parser';
import { logger } from '../../utils/logger';
import { getConfig } from '../../config';

const DEFAULT_BUILTIN_DIR = path.resolve(process.cwd(), 'apps/server/src/core/skills/builtins');
const DEFAULT_BUILTIN_DIR = resolveBuiltinSkillsDirectory();

function skillDataRoot(): string {
return path.resolve(
Expand Down
3 changes: 3 additions & 0 deletions docs/guides/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ or operate a Server. The complete v1.0.0 package atlas is available in the
- All public `@codesoul-co/hypha-*` packages in one release use the same Semantic Version.
- Internal `@codesoul-co/hypha-*` dependencies use the exact release version.
- Each package publishes only `dist/` plus npm-generated metadata.
- `@codesoul-co/hypha-skills` additionally ships the framework built-in skills
(`builtins/`) and exposes `resolveBuiltinSkillsDirectory()` so npm consumers can load
`context-enrichment` and `intent-classification` without a Server source checkout.
- Node.js 22 or newer is required.
- `npm run release:check:npm` builds package output, verifies declared source dependencies, checks
package metadata, and validates the files that `npm pack` would include.
Expand Down
3 changes: 2 additions & 1 deletion packages/skills/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
}
},
"files": [
"dist"
"dist",
"builtins"
],
"publishConfig": {
"access": "public"
Expand Down
28 changes: 28 additions & 0 deletions packages/skills/src/builtin-skills.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { describe, expect, it } from 'vitest';
import {
LocalSkillLoader,
SkillRegistry,
resolveBuiltinSkillsDirectory,
} from './index';

describe('packaged built-in skills', () => {
it('resolves the builtins directory shipped inside the package', () => {
const directory = resolveBuiltinSkillsDirectory();
expect(directory.endsWith('builtins')).toBe(true);
expect(directory).toContain('packages');
expect(directory).toContain('skills');
});

it('loads both framework built-in skills from the packaged directory', async () => {
const registry = new SkillRegistry();
const loader = new LocalSkillLoader({
directories: [resolveBuiltinSkillsDirectory()],
recursive: true,
});
const skills = await loader.loadInto(registry);
const ids = skills.map((skill) => skill.id).sort();
expect(ids).toEqual(['context-enrichment', 'intent-classification']);
expect(registry.get('context-enrichment')).toMatchObject({ version: '1.0.0' });
expect(registry.get('intent-classification')).toMatchObject({ version: '1.0.0' });
});
});
12 changes: 12 additions & 0 deletions packages/skills/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ import {

export * from './remote-registry';

/**
* Resolves the directory that ships Hypha's built-in skills
* (context-enrichment, intent-classification) inside this npm package.
*
* The published tarball includes `builtins/` next to `dist/`, so consumers
* can load the framework built-ins without a source checkout of the Server.
*/
export function resolveBuiltinSkillsDirectory(): string {
// Compiled CJS output lives in <pkg>/dist; the shipped data lives in <pkg>/builtins.
return path.resolve(__dirname, '..', 'builtins');
}

export interface SkillRef {
id: string;
version?: string;
Expand Down
3 changes: 2 additions & 1 deletion packages/skills/src/skills.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
DefaultSkillPolicy,
createEffectiveAgentCapabilitySnapshot,
LocalSkillLoader,
resolveBuiltinSkillsDirectory,
SkillContextLoader,
SkillRegistry,
SkillResolver,
Expand Down Expand Up @@ -209,7 +210,7 @@ describe('@codesoul-co/hypha-skills resolver', () => {
it('loads a real local markdown skill and activates it progressively', async () => {
const registry = new SkillRegistry();
const loader = new LocalSkillLoader({
directories: ['apps/server/src/core/skills/builtins'],
directories: [resolveBuiltinSkillsDirectory()],
recursive: false,
});
await loader.loadInto(registry);
Expand Down