@hasna/skills 0.7.2 → 0.8.0

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.
Files changed (50) hide show
  1. package/README.md +69 -18
  2. package/bin/index.js +31416 -17660
  3. package/bin/mcp.js +20185 -5957
  4. package/bin/migrate.js +24 -61
  5. package/bin/server.js +73578 -20340
  6. package/bin/worker.js +65161 -19252
  7. package/dist/admin-contract.js +34 -15
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +19581 -5535
  10. package/dist/lib/agent-discovery-bytes.d.ts +1 -0
  11. package/dist/lib/agent-discovery-path-bytes.d.ts +5 -0
  12. package/dist/lib/agent-discovery.d.ts +3 -1
  13. package/dist/lib/agent-policy-limits.d.ts +4 -0
  14. package/dist/lib/config.d.ts +3 -23
  15. package/dist/lib/installer.d.ts +1 -1
  16. package/dist/lib/portable-skills-types.d.ts +2 -0
  17. package/dist/lib/portable-skills.d.ts +1 -1
  18. package/dist/lib/registry-data/index.d.ts +1 -0
  19. package/dist/lib/registry-types.d.ts +2 -1
  20. package/dist/lib/registry.d.ts +2 -12
  21. package/dist/lib/release-dependencies.d.ts +30 -0
  22. package/dist/lib/skill-aliases.d.ts +2 -3
  23. package/dist/mcp/mcp-test-client.d.ts +2 -2
  24. package/dist/sdk/executor.d.ts +5 -5
  25. package/dist/sdk/index.js +89668 -40182
  26. package/dist/sdk/registry.d.ts +3 -3
  27. package/dist/server/config.d.ts +1 -2
  28. package/dist/server/handlers.d.ts +5 -2
  29. package/dist/server/registry.d.ts +6 -3
  30. package/dist/server/skills-api.d.ts +6 -38
  31. package/dist/storage.js +5 -42
  32. package/package.json +5 -3
  33. package/dist/lib/registry-data/business-marketing.d.ts +0 -2
  34. package/dist/lib/registry-data/communication.d.ts +0 -2
  35. package/dist/lib/registry-data/content-generation.d.ts +0 -2
  36. package/dist/lib/registry-data/data-analysis.d.ts +0 -2
  37. package/dist/lib/registry-data/design-branding.d.ts +0 -2
  38. package/dist/lib/registry-data/development-tools.d.ts +0 -2
  39. package/dist/lib/registry-data/education-learning.d.ts +0 -2
  40. package/dist/lib/registry-data/event-management.d.ts +0 -2
  41. package/dist/lib/registry-data/finance-compliance.d.ts +0 -2
  42. package/dist/lib/registry-data/health-wellness.d.ts +0 -2
  43. package/dist/lib/registry-data/media-processing.d.ts +0 -2
  44. package/dist/lib/registry-data/productivity-organization.d.ts +0 -2
  45. package/dist/lib/registry-data/project-management.d.ts +0 -2
  46. package/dist/lib/registry-data/research-writing.d.ts +0 -2
  47. package/dist/lib/registry-data/science-academic.d.ts +0 -2
  48. package/dist/lib/registry-data/travel-lifestyle.d.ts +0 -2
  49. package/dist/lib/registry-data/web-browser.d.ts +0 -2
  50. package/dist/server/seed-bundled.d.ts +0 -20
@@ -1,5 +1,6 @@
1
1
  export interface DiscoveryByteBudget {
2
2
  remaining: number;
3
+ pathMetadataRemaining?: number;
3
4
  }
4
5
  export declare function discoveryByteBudget(): DiscoveryByteBudget;
5
6
  /** Hash exact bytes without decoding them or following links. The budget spans one capture/verification. */
@@ -0,0 +1,5 @@
1
+ import { type DiscoveryByteBudget } from "./agent-discovery-bytes.js";
2
+ /** Bind path identity and exact bytes without importing or executing the file.
3
+ * Absence also has a digest: null cannot attest the path leading to an absence.
4
+ * Planned replacement is refused because its future inode is not knowable. */
5
+ export declare function hashDiscoveryPathFile(path: string, budget: DiscoveryByteBudget, changes?: Map<string, string>): string;
@@ -4,7 +4,7 @@ export { captureDiscoveryDirectories, type DiscoveryDirectory } from "./agent-di
4
4
  export interface DiscoverySource {
5
5
  path: string;
6
6
  sha256: string | null;
7
- hashMode?: "bytes";
7
+ hashMode?: "bytes" | "path-bytes";
8
8
  format?: "json" | "toml" | "yaml";
9
9
  fields?: string[];
10
10
  }
@@ -30,6 +30,8 @@ export declare function verifyAgentDiscovery(binding: AgentDiscoveryBinding): vo
30
30
  export declare function rebindAgentDiscovery(binding: AgentDiscoveryBinding, changes: Map<string, string>): AgentDiscoveryBinding;
31
31
  /** Capture full byte witnesses for reviewed source or executable files; never import or execute them. */
32
32
  export declare function captureDiscoveryByteSources(paths: string[]): DiscoverySource[];
33
+ /** Capture executable/source path identity, including links and absent targets. */
34
+ export declare function captureDiscoveryPathSources(paths: string[]): DiscoverySource[];
33
35
  /** Project settings can introduce a higher-precedence discovery source. Until
34
36
  * its native merge format is supported, refuse that layer rather than certify
35
37
  * the home-only inventory. Ordinary unrelated project settings remain usable. */
@@ -5,6 +5,10 @@ export declare const AGENT_POLICY_LIMITS: Readonly<{
5
5
  discoverySources: 2048;
6
6
  discoveryRawSourceBytes: number;
7
7
  discoveryRawTotalBytes: number;
8
+ discoveryPathLinks: 40;
9
+ discoveryPathSteps: 256;
10
+ discoveryPathSourceMetadataBytes: number;
11
+ discoveryPathTotalMetadataBytes: number;
8
12
  discoveryRoots: 512;
9
13
  discoveryDirectories: 64;
10
14
  discoveryDirectoryEntries: 20000;
@@ -4,7 +4,6 @@
4
4
  * Loads configuration from:
5
5
  * 1. Project-local: ./skills.config.json (highest priority)
6
6
  * 2. Global: ~/.hasna/skills/config.json (JSON format, lowest priority)
7
- * (backward compat: also checks ~/.skillsrc)
8
7
  *
9
8
  * Values from the project config override global config.
10
9
  */
@@ -83,35 +82,16 @@ export declare function isOwnerLayoutMigrated(appDir: string): boolean;
83
82
  /**
84
83
  * Get the data directory for skills global config/data.
85
84
  * Default: ~/.hasna/skills/, overridable with $HASNA_SKILLS_DIR.
86
- * Auto-migrates from ~/.skills/ and ~/.skillsrc without deleting legacy data.
85
+ * Legacy directories and configuration are never imported during resolution.
87
86
  */
88
87
  export declare function getDataDir(): string;
89
- /**
90
- * Write-free data-dir resolution for read-only paths (e.g. `sync --dry-run`).
91
- *
92
- * getDataDir() itself writes: it mkdirs the app folder, merges legacy ~/.skills
93
- * content and copies the legacy config file. A dry run must resolve the SAME
94
- * directory a real run would use without performing any of that — the app-home
95
- * resolver (getDataRoot) is already write-free, so this mirrors it directly.
96
- */
88
+ /** Resolve the same app data root without creating directories. */
97
89
  export declare function getDataDirReadOnly(): string;
98
90
  /**
99
91
  * Get the config file path for a given scope, write-free (see getDataDirReadOnly).
100
92
  */
101
93
  export declare function getConfigPathReadOnly(scope: ConfigScope): string;
102
- /**
103
- * Load merged config (project-local overrides global) without the writes
104
- * getDataDir() performs on the write path.
105
- *
106
- * The write path folds the legacy ~/.skillsrc into canonical config.json as part of
107
- * getDataDir()'s migration — copied ONLY when canonical config.json is absent, and
108
- * the legacy migration is skipped entirely when a data-directory override is active.
109
- * This mirrors that FILE-LEVEL precedence, never field-level merging: canonical
110
- * config.json, when present, is the whole global config; legacy ~/.skillsrc is read
111
- * only in the exact situation the write path would copy it (no canonical file, no
112
- * override). Field-level merging would inherit stale legacy values beneath a
113
- * canonical config that omits them, so the two paths must agree exactly.
114
- */
94
+ /** Read only the canonical global and explicitly selected project configuration. */
115
95
  export declare function loadConfigReadOnly(): SkillsConfig;
116
96
  /**
117
97
  * Get the config file path for a given scope
@@ -48,7 +48,7 @@ interface MetaFile {
48
48
  disabled?: string[];
49
49
  }
50
50
  /**
51
- * Get the path to a bundled skill in the package.
51
+ * Resolve a skill only inside the owned cache or an explicit authoring source.
52
52
  */
53
53
  export declare function getSkillPath(name: string): string;
54
54
  /**
@@ -114,6 +114,8 @@ export interface PortPortableSkillOptions extends PortableSkillOptions {
114
114
  }
115
115
  export interface BulkPortPortableSkillOptions extends PortableSkillOptions {
116
116
  overwrite?: boolean;
117
+ /** Explicitly permit imported names that shadow bundled official skills. */
118
+ allowShadow?: boolean;
117
119
  /** When false, the first failure is rethrown. Defaults to true (skip-on-error). */
118
120
  continueOnError?: boolean;
119
121
  }
@@ -20,7 +20,7 @@ export * from "./portable-skills-types.js";
20
20
  * exists there (the record is the authority; a skills/ directory someone
21
21
  * created by hand is not the corpus)
22
22
  * 3. `getDataDir()` - <app folder>/installed (pre-migration corpus,
23
- * with the legacy auto-copy migration), where the app folder is
23
+ * without importing any legacy directories), where the app folder is
24
24
  * $HASNA_SKILLS_DIR, else ~/.hasna/skills
25
25
  *
26
26
  * The app folder holds app data (config.json, skills.db, auth.json); the corpus
@@ -1,2 +1,3 @@
1
1
  import type { SkillMeta } from "../registry-types.js";
2
+ /** @deprecated Skills are loaded from an account or an explicitly selected local source. */
2
3
  export declare const SKILLS: SkillMeta[];
@@ -38,5 +38,6 @@ export interface SkillAvailabilityMetadata {
38
38
  }
39
39
  export declare const CATEGORIES: readonly ["Development Tools", "Business & Marketing", "Productivity & Organization", "Project Management", "Content Generation", "Finance & Compliance", "Data & Analysis", "Media Processing", "Design & Branding", "Web & Browser", "Research & Writing", "Science & Academic", "Education & Learning", "Communication", "Health & Wellness", "Travel & Lifestyle", "Event Management"];
40
40
  export type Category = (typeof CATEGORIES)[number];
41
- export declare const BASIC_SKILL_NAMES: readonly ["blog-article", "ad-creative-pack", "email-sequence", "seo-content-pack", "social-content-calendar", "pitch-deck", "proposal-pack", "market-research-report"];
41
+ /** @deprecated There is no software-owned default selection. Use an account profile. */
42
+ export declare const BASIC_SKILL_NAMES: readonly string[];
42
43
  export type SkillRegistryProfile = "basic" | "all";
@@ -7,19 +7,9 @@ export { BASIC_SKILL_NAMES, CATEGORIES, SKILLS };
7
7
  export type { Category, SkillMeta, SkillRegistryProfile };
8
8
  export declare function isBasicSkillName(name: string): boolean;
9
9
  export declare function findExtensionSkillPath(name: string): string | null;
10
- /**
11
- * Load the full registry: official skills merged with a configured private
12
- * extension checkout and global custom skills from the canonical local corpus
13
- * — <app folder>/installed/<name>/ before the owner-layout migration, <app
14
- * folder>/skills/<name>/ after it (resolveCorpusRoot(), the one resolution
15
- * every discovery path shares) — plus the legacy ~/.hasna/skills/custom/<name>/
16
- * migration safety net.
17
- *
18
- * Custom skills take precedence over extensions, which take precedence over
19
- * official skills. Extension skills are read in place and never copied into the
20
- * corpus. Results are cached for 5 seconds.
21
- */
10
+ /** Discover the Skills-owned cache and explicitly configured authoring sources. */
22
11
  export declare function loadRegistry(cwd?: string): SkillMeta[];
12
+ /** Compatibility name for the caller's own catalog; no baked-in default selection. */
23
13
  export declare function loadBasicRegistry(cwd?: string): SkillMeta[];
24
14
  export declare function loadRegistryProfile(profile?: SkillRegistryProfile, cwd?: string): SkillMeta[];
25
15
  /** Invalidate the registry cache (e.g. after installing a custom skill). */
@@ -0,0 +1,30 @@
1
+ type Context = Record<string, string | null>;
2
+ /** Verifies installed resolution against the selected standalone frozen lock.
3
+ * This is a graph/version check; the separate frozen installer receipt binds
4
+ * registry integrity. Package payload attestation is not inferred from version. */
5
+ export declare function verifyProducerDependencies(packageRoot: string): {
6
+ status: string;
7
+ package: {
8
+ name: string;
9
+ version: string;
10
+ };
11
+ manifestSha256: string;
12
+ lockSha256: string;
13
+ nodeCount: number;
14
+ edgeCount: number;
15
+ nodes: {
16
+ lockKey: string;
17
+ name: string;
18
+ version: string;
19
+ manifestSha256: string;
20
+ relativePath: string;
21
+ context: Context;
22
+ }[];
23
+ edges: {
24
+ from: string;
25
+ name: string;
26
+ to: string | null;
27
+ optionalAbsent?: boolean;
28
+ }[];
29
+ };
30
+ export {};
@@ -1,6 +1,5 @@
1
- export declare const SKILL_ALIASES: {
2
- readonly "create-blog-article": "blog-article";
3
- };
1
+ /** @deprecated Aliases belong to an account's selected profile, never the package. */
2
+ export declare const SKILL_ALIASES: Readonly<Record<string, string>>;
4
3
  export type SkillAlias = keyof typeof SKILL_ALIASES;
5
4
  export declare function normalizeSkillSlug(name: string): string;
6
5
  export declare function resolveSkillAlias(name: string): string;
@@ -1,5 +1,5 @@
1
- export declare const EXPECTED_ALL_SKILL_COUNT: number;
2
- export declare const EXPECTED_BASIC_SKILL_COUNT: 8;
1
+ export declare const EXPECTED_ALL_SKILL_COUNT: 12;
2
+ export declare const EXPECTED_BASIC_SKILL_COUNT: 12;
3
3
  /**
4
4
  * Helper class to communicate with the MCP server over stdio.
5
5
  */
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Executor seam: what actually runs a claimed skill run.
2
+ * Compatibility seam for historical unversioned run records.
3
3
  *
4
- * The interface is the contract an embedder supplies an executor against. The current
5
- * implementation is the provider-free deterministic handler the shipped worker runs
6
- * (src/server/handlers.ts) — same logs, same artifacts, same terminal transitions.
4
+ * Embedders may supply their own implementation of the interface. The legacy
5
+ * implementation only drains old records to a fenced refusal; versioned bundle
6
+ * execution uses the managed runtime and never resolves an embedded skill name.
7
7
  */
8
8
  import { ArtifactStorage } from "../server/artifact-storage.js";
9
9
  import { executeRun } from "../server/handlers.js";
@@ -12,6 +12,6 @@ import type { ServerRunRecord, SkillsProductStore } from "../server/types.js";
12
12
  export interface RunExecutor {
13
13
  execute(store: SkillsProductStore, run: ServerRunRecord, storage?: ArtifactStorage): Promise<ServerRunRecord>;
14
14
  }
15
- /** Current implementation: the shipped deterministic handler, unchanged. */
15
+ /** @deprecated Drains legacy records with LEGACY_EXECUTION_RETIRED; executes no skill. */
16
16
  export declare const localRunExecutor: RunExecutor;
17
17
  export { executeRun };