@hasna/skills 0.6.3 → 0.7.1

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.
@@ -0,0 +1,45 @@
1
+ export declare const INTEGRATION_AGENTS: readonly ["claude", "codex", "gemini", "opencode", "cursor", "hermes"];
2
+ export type IntegrationAgent = typeof INTEGRATION_AGENTS[number];
3
+ export declare const AGENT_ADAPTERS: {
4
+ readonly claude: {
5
+ readonly root: ".claude/skills";
6
+ readonly config: ".claude/settings.json";
7
+ readonly events: readonly ["UserPromptSubmit", "SessionStart", "SubagentStart"];
8
+ readonly promptContext: true;
9
+ };
10
+ readonly codex: {
11
+ readonly root: ".codex/skills";
12
+ readonly config: ".codex/hooks.json";
13
+ readonly events: readonly ["UserPromptSubmit", "SessionStart", "SubagentStart"];
14
+ readonly promptContext: true;
15
+ };
16
+ readonly gemini: {
17
+ readonly root: ".gemini/skills";
18
+ readonly config: ".gemini/settings.json";
19
+ readonly events: readonly ["BeforeAgent", "SessionStart"];
20
+ readonly promptContext: true;
21
+ };
22
+ readonly opencode: {
23
+ readonly root: ".config/opencode/skills";
24
+ readonly config: ".config/opencode/opencode.json";
25
+ readonly events: readonly ["chat.message"];
26
+ readonly promptContext: true;
27
+ };
28
+ readonly hermes: {
29
+ readonly root: ".hermes/skills";
30
+ readonly config: ".hermes/config.yaml";
31
+ readonly events: readonly ["pre_llm_call", "pre_tool_call"];
32
+ readonly promptContext: true;
33
+ readonly promptFailureMode: "open";
34
+ readonly toolFailureMode: "supervised-child-errors-block";
35
+ readonly requiresNativeTrust: true;
36
+ };
37
+ readonly cursor: {
38
+ readonly root: ".cursor/skills";
39
+ readonly config: ".cursor/hooks.json";
40
+ readonly events: readonly ["beforeSubmitPrompt", "sessionStart"];
41
+ readonly promptContext: false;
42
+ };
43
+ };
44
+ export declare function normalizeAgentHookEvent(agent: IntegrationAgent, event: string): string;
45
+ export declare function renderOpenCodePlugin(command: string, profileId: string): string;
@@ -0,0 +1,6 @@
1
+ export declare const CLI_BRIDGE_NAME = "skills-cli";
2
+ export declare const CLI_BRIDGE_VERSION = 1;
3
+ export declare const CLI_BRIDGE_DIGEST: string;
4
+ export declare const CLI_BRIDGE_FILES: Readonly<Record<string, string>>;
5
+ /** Ownership is exact bytes at an expected location, never a marker's claim alone. */
6
+ export declare function isOwnedCliBridge(path: string, expectedPaths: readonly string[]): boolean;
@@ -0,0 +1,37 @@
1
+ import type { IntegrationAgent } from "./agent-adapters.js";
2
+ export interface DiscoverySource {
3
+ path: string;
4
+ sha256: string | null;
5
+ format?: "json" | "toml" | "yaml";
6
+ fields?: string[];
7
+ }
8
+ export interface AgentDiscoveryBinding {
9
+ agent: IntegrationAgent;
10
+ roots: string[];
11
+ sources: DiscoverySource[];
12
+ method: "automatic" | "reviewed";
13
+ builtinNames?: string[];
14
+ }
15
+ export interface ReviewedDiscoveryInputs {
16
+ version: 1;
17
+ agents: Array<{
18
+ agent: IntegrationAgent;
19
+ roots: string[];
20
+ sources: DiscoverySource[];
21
+ pluginHooks: "reviewed-no-skill-injection";
22
+ }>;
23
+ }
24
+ export declare function verifyAgentDiscovery(binding: AgentDiscoveryBinding): void;
25
+ export declare function rebindAgentDiscovery(binding: AgentDiscoveryBinding, changes: Map<string, string>): AgentDiscoveryBinding;
26
+ /** Project settings can introduce a higher-precedence discovery source. Until
27
+ * its native merge format is supported, refuse that layer rather than certify
28
+ * the home-only inventory. Ordinary unrelated project settings remain usable. */
29
+ export declare function assertProjectDiscovery(agent: IntegrationAgent, directories: string[], home: string, canonical?: (path: string) => string): void;
30
+ /** Resolve configured plugin discovery without starting an agent or loading a plugin.
31
+ * Unknown runtime registrations require explicit reviewed inputs, never a cache guess. */
32
+ export declare function resolveAgentDiscovery(options: {
33
+ home: string;
34
+ agent: IntegrationAgent;
35
+ reviewed?: ReviewedDiscoveryInputs;
36
+ canonical?: (path: string) => string;
37
+ }): AgentDiscoveryBinding;
@@ -0,0 +1,30 @@
1
+ export interface HermesSupervisorBinding {
2
+ path: string;
3
+ runtime: string;
4
+ sha256: string;
5
+ }
6
+ export declare const HERMES_OPT_OUT = ".no-bundled-skills";
7
+ declare const EVENTS: readonly ["pre_llm_call", "pre_tool_call"];
8
+ export declare function parseHermesConfig(text: string | null): Record<string, any>;
9
+ export declare function hermesHookDefinitions(supervisor: Pick<HermesSupervisorBinding, "path" | "runtime">): Record<typeof EVENTS[number], {
10
+ command: string;
11
+ timeout: number;
12
+ fail_closed?: boolean;
13
+ }>;
14
+ export declare function configureHermesHooks(text: string | null, supervisor: HermesSupervisorBinding, previous?: HermesSupervisorBinding): string;
15
+ export declare function assertHermesEnvironment(home: string): void;
16
+ export declare function assertHermesProtection(home: string, config: Record<string, any>, command: string, profile: string, supervisor: HermesSupervisorBinding): void;
17
+ /** skill_view also searches legacy <name>.md with rglob, including hidden and
18
+ * dependency directories that the normal SKILL.md index skips. Check the one
19
+ * name admitted by the native tool guard without reading any candidate bytes.
20
+ * Only support folders directly under a real skill descriptor are excluded,
21
+ * matching Hermes is_skill_support_path. Every other bounded path is checked. */
22
+ export declare function assertNoHermesLegacyShadow(root: string): void;
23
+ export declare function normalizeHermesHookInput(input: Record<string, any>): Record<string, any>;
24
+ export declare function assertHermesTool(input: Record<string, any>): void;
25
+ /** Hermes 0.20.5 treats some empty/non-directive child failures as no directive,
26
+ * even with fail_closed. This owned supervisor produces its explicit blocking
27
+ * wire shape and exit 2 for every observed Skills child failure. Native host or
28
+ * supervisor death is outside that guarantee; no native runtime is patched. */
29
+ export declare function renderHermesSupervisor(command: string, profile: string): string;
30
+ export {};
@@ -1,4 +1,6 @@
1
- export type IntegrationAgent = "claude" | "codex";
1
+ import { type AgentDiscoveryBinding, type ReviewedDiscoveryInputs } from "./agent-discovery.js";
2
+ import { type IntegrationAgent } from "./agent-adapters.js";
3
+ export type { IntegrationAgent } from "./agent-adapters.js";
2
4
  export type ContextHookEvent = "UserPromptSubmit" | "SessionStart" | "SubagentStart";
3
5
  export interface AgentRootAlias {
4
6
  agent: IntegrationAgent;
@@ -15,6 +17,9 @@ export interface NativeSkillEntry {
15
17
  hash: string;
16
18
  managed: boolean;
17
19
  vendor: boolean;
20
+ system?: boolean;
21
+ bridge?: boolean;
22
+ bridgeHome?: string;
18
23
  rootAlias?: AgentRootAlias;
19
24
  }
20
25
  export interface AgentConfigChange {
@@ -27,11 +32,25 @@ export interface AgentIntegrationPlan {
27
32
  profileId: string;
28
33
  changes: AgentConfigChange[];
29
34
  nativeSkills: NativeSkillEntry[];
35
+ observedPolicy?: {
36
+ path: string;
37
+ before: string | null;
38
+ };
39
+ discoveryBefore?: AgentDiscoveryBinding[];
40
+ discoveryAfter?: AgentDiscoveryBinding[];
30
41
  rootAliases?: AgentRootAlias[];
31
42
  }
32
43
  export declare function inventoryNativeSkills(home?: string, options?: {
33
44
  includeVendor?: boolean;
45
+ guardHermes?: boolean;
34
46
  projectDir?: string;
47
+ projectDirs?: string[];
48
+ agentRoots?: Array<{
49
+ agent: string;
50
+ path: string;
51
+ }>;
52
+ configured?: boolean;
53
+ discoveryInputs?: ReviewedDiscoveryInputs;
35
54
  allowRootAliases?: boolean;
36
55
  }): NativeSkillEntry[];
37
56
  /** Planning is read-only; credentials and unrelated settings never appear in CLI output. */
@@ -43,6 +62,7 @@ export declare function planAgentIntegration(options: {
43
62
  profileId?: string;
44
63
  includeVendor?: boolean;
45
64
  projectDir?: string;
65
+ discoveryInputs?: ReviewedDiscoveryInputs;
46
66
  allowRootAliases?: boolean;
47
67
  }): AgentIntegrationPlan;
48
68
  export declare function applyAgentIntegration(plan: AgentIntegrationPlan): {
@@ -53,15 +73,26 @@ export declare function applyAgentIntegration(plan: AgentIntegrationPlan): {
53
73
  export declare function archiveNativeSkills(inventory: NativeSkillEntry[], options: {
54
74
  dataDir?: string;
55
75
  includeUnmanaged?: boolean;
76
+ includeVendor?: boolean;
56
77
  allowRootAliases?: boolean;
57
78
  }): {
58
79
  entries: Array<{
59
80
  source: string;
60
81
  archive: string;
61
82
  hash: string;
83
+ discoveryOnly?: boolean;
62
84
  }>;
85
+ receiptPath?: string;
63
86
  rootAliases?: AgentRootAlias[];
64
87
  };
88
+ /** Run before any prompt context load. Missing ownership or reappearing native
89
+ * discovery files require repair; verified cache availability is not an override. */
90
+ export declare function assertManagedAgentBridge(agent: IntegrationAgent, options?: {
91
+ home?: string;
92
+ dataDir?: string;
93
+ projectDir?: string;
94
+ projectDirs?: string[];
95
+ }): void;
65
96
  export declare function hookContextOutput(event: string, result: {
66
97
  context: string;
67
98
  receipt?: unknown;
@@ -0,0 +1,13 @@
1
+ /** Shared bounds for stored policy, discovery, and pre-activation validation. */
2
+ export declare const AGENT_POLICY_LIMITS: Readonly<{
3
+ bytes: number;
4
+ agents: 16;
5
+ discoverySources: 2048;
6
+ discoveryRoots: 512;
7
+ builtinNames: 2048;
8
+ rootAliases: 2;
9
+ fields: 64;
10
+ pathCharacters: 4096;
11
+ }>;
12
+ /** Unknown extension fields remain compatible within the serialized byte bound. */
13
+ export declare function assertAgentPolicyCollections(policy: Record<string, any>): void;
@@ -0,0 +1,9 @@
1
+ export declare const DEPENDENCY_PREPARATION_MARKER = ".skills-dependency-preparation";
2
+ export declare function hasDependencyPreparationMarker(skillPath: string): boolean;
3
+ type PreparationFailure = {
4
+ exitCode: number;
5
+ error: string;
6
+ };
7
+ /** Prepare in the selected corpus without exposing installer diagnostics. */
8
+ export declare function prepareSkillDependencies(skillPath: string, env: Record<string, string | undefined>, timeoutMs?: number): Promise<PreparationFailure | undefined>;
9
+ export {};
@@ -1,4 +1,12 @@
1
- /** Lightweight, write-free policy check; importing agent integration would create an installer cycle. */
1
+ /** Validate the actual wire representation shared by readers and activation. */
2
+ export declare function parseManagedSkillPolicy(text: string): Record<string, any>;
3
+ export declare function serializeManagedSkillPolicy(value: Record<string, any>): string;
4
+ /** Read at most the shared byte bound, including a concurrent file growth. */
5
+ export declare function readManagedSkillPolicySnapshot(dataDir?: string): {
6
+ text: string;
7
+ value: Record<string, any>;
8
+ } | null;
9
+ /** Lightweight policy check; importing agent integration would create a cycle. */
2
10
  export declare function readManagedSkillPolicy(dataDir?: string): {
3
11
  loading?: string;
4
12
  profileId?: string;
@@ -35,6 +35,8 @@ export * from "./portable-skills-types.js";
35
35
  * and one rule for which source wins.
36
36
  */
37
37
  export declare function getPortableSkillsRoot(options?: PortableSkillOptions): string;
38
+ /** Resolve an existing authoring corpus without creating or migrating directories. */
39
+ export declare function getPortableSkillsRootReadOnly(options?: PortableSkillOptions): string;
38
40
  export declare function getPortableSkillPath(name: string, options?: PortableSkillOptions): string;
39
41
  export declare function findPortableSkill(name: string, options?: PortableSkillOptions): PortableSkillSummary | null;
40
42
  export declare function listPortableSkills(options?: PortableSkillOptions): PortableSkillSummary[];
@@ -0,0 +1,13 @@
1
+ type OwnedChild = {
2
+ readonly pid: number;
3
+ readonly exitCode: number | null;
4
+ readonly signalCode: string | number | null;
5
+ kill(signal: "SIGKILL"): unknown;
6
+ };
7
+ type GroupSignal = (pid: number, signal: "SIGKILL" | 0) => unknown;
8
+ /** Capture identity immediately after spawn; Bun may change pid after reaping. */
9
+ export declare function capturePreparationProcess(child: OwnedChild, platform?: NodeJS.Platform, signalGroup?: GroupSignal): {
10
+ kill(): void;
11
+ groupExited(): boolean | undefined;
12
+ };
13
+ export {};
@@ -0,0 +1,22 @@
1
+ import { type PortableSkillOptions, type SkillKind } from "./portable-skills.js";
2
+ export interface PrepareSkillOptions extends PortableSkillOptions {
3
+ version: string;
4
+ kind?: SkillKind;
5
+ dryRun?: boolean;
6
+ }
7
+ export interface PrepareSkillResult {
8
+ name: string;
9
+ path: string;
10
+ previousVersion: string;
11
+ version: string;
12
+ kind: SkillKind;
13
+ contentHash: string;
14
+ changed: boolean;
15
+ written: boolean;
16
+ warnings: Array<{
17
+ code: string;
18
+ message: string;
19
+ }>;
20
+ }
21
+ /** Prepare a reviewed local draft. No execution, dependency install, API call or source rewrite. */
22
+ export declare function prepareSkill(name: string, options: PrepareSkillOptions): PrepareSkillResult;
@@ -0,0 +1,15 @@
1
+ import type { ResolvedSkillProfile, SkillProfile, SkillSelection } from "../types/skill-selection.js";
2
+ /** Shared transport and local-document limits. Operator request limits may be lower. */
3
+ export declare const MAX_PROFILE_SELECTIONS = 4096;
4
+ export declare const MAX_PROFILE_DOCUMENT_BYTES: number;
5
+ export declare const MAX_SKILL_SESSION_ID_CHARS = 256;
6
+ export declare const PROFILE_SESSION_ENVELOPE_BYTES: number;
7
+ export declare const MAX_RESOLVED_PROFILE_BYTES: number;
8
+ export declare const LEGACY_PROFILE_SELECTIONS = 256;
9
+ export declare const LEGACY_PROFILE_DOCUMENT_BYTES = 1000000;
10
+ export declare function profileDocumentBytes(value: unknown): number;
11
+ export declare function requiresProfileCapacity(selections: SkillSelection[], bodyBytes: number): boolean;
12
+ export declare function assertAdvertisedProfileCapacity(value: unknown, count: number, bodyBytes: number): void;
13
+ export declare function resolvedProfileSnapshot(profile: Pick<SkillProfile, "id" | "workspaceId" | "revision" | "selections">, authority: string): ResolvedSkillProfile;
14
+ /** Station submissions carry canonical selections, not repeated resolution metadata. */
15
+ export declare function profileSelectionSnapshot(selections: SkillSelection[]): SkillSelection[];
@@ -0,0 +1,6 @@
1
+ import type { SkillSelection } from "../types/skill-selection.js";
2
+ /** Aliases are direct names of one pinned selection, never a second registry. */
3
+ export declare function selectionAliasError(selections: readonly Pick<SkillSelection, "slug" | "aliases">[]): string | undefined;
4
+ export declare function selectionMatchesName(selection: Pick<SkillSelection, "slug" | "aliases">, name: string): boolean;
5
+ /** Ignore resolved authority fields and JSON key ordering, not contract data. */
6
+ export declare function selectionSnapshotsEqual(left: readonly SkillSelection[], right: readonly SkillSelection[]): boolean;
@@ -52,6 +52,7 @@ export declare function loadSelectedSkill(spec: string, profileId: string, optio
52
52
  slug: string;
53
53
  version: string;
54
54
  bundleDigest: string;
55
+ aliases?: string[];
55
56
  triggers?: {
56
57
  keywords?: string[];
57
58
  paths?: string[];
@@ -1,6 +1,3 @@
1
- /**
2
- * Skill info - reads docs, requirements, and metadata from skill source
3
- */
4
1
  import { type SkillMeta } from "./registry.js";
5
2
  export interface SkillDocs {
6
3
  skillMd: string | null;
@@ -49,6 +46,7 @@ export declare function runSkill(name: string, args: string[], options?: {
49
46
  installed?: boolean;
50
47
  stdio?: "inherit" | "pipe" | "stderr";
51
48
  env?: Record<string, string>;
49
+ preparationTimeoutMs?: number;
52
50
  }): Promise<{
53
51
  exitCode: number;
54
52
  error?: string;