@hasna/skills 0.10.36 → 0.10.38

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.
@@ -3,6 +3,15 @@ export interface DiscoveryDirectory {
3
3
  path: string;
4
4
  sha256: string | null;
5
5
  }
6
+ export interface DiscoveryDirectoryProjection extends DiscoveryDirectory {
7
+ entries: string[];
8
+ }
9
+ /** A separate planner-created projection retains membership outside exact
10
+ * reviewed inactive roots. It never replaces a historical full witness. */
11
+ export declare function captureDiscoveryDirectoryProjection(paths: string[], omittedRoots: readonly string[]): DiscoveryDirectoryProjection[];
12
+ /** Compare a planner-captured inventory after removing only exact inert graphs.
13
+ * The stored rows must reproduce their original digest before projection. */
14
+ export declare function verifyDiscoveryDirectoryProjection(directories: DiscoveryDirectoryProjection[], omittedRoots: readonly string[]): void;
6
15
  /** Read-only capture; callers must review both membership and source bytes. */
7
16
  export declare function captureDiscoveryDirectories(paths: string[], excludedRoots?: readonly string[]): DiscoveryDirectory[];
8
17
  export declare function verifyDiscoveryDirectories(directories: DiscoveryDirectory[], excludedRoots?: readonly string[]): void;
@@ -2,7 +2,7 @@ import type { IntegrationAgent } from "./agent-adapters.js";
2
2
  import { type DiscoveryDirectory } from "./agent-discovery-directories.js";
3
3
  import { type ManagedPluginRegistrationWitness } from "./plugin-discovery.js";
4
4
  import { type CodexHookDiscoveryRecovery } from "./codex-hook-discovery-recovery.js";
5
- import { type CodexPluginSourceInput } from "./codex-plugin-skill-controls.js";
5
+ import { type CodexPluginSkillControl, type CodexPluginSourceInput } from "./codex-plugin-skill-controls.js";
6
6
  export { captureDiscoveryDirectories, type DiscoveryDirectory } from "./agent-discovery-directories.js";
7
7
  export interface DiscoverySource {
8
8
  path: string;
@@ -19,6 +19,14 @@ export interface AgentDiscoveryBinding {
19
19
  directories?: DiscoveryDirectory[];
20
20
  method: "automatic" | "reviewed";
21
21
  builtinNames?: string[];
22
+ codexDisabledPluginSkills?: CodexPluginSkillControl[];
23
+ codexRetiredMaterializations?: {
24
+ roots: string[];
25
+ parents?: string[];
26
+ directories: Array<DiscoveryDirectory & {
27
+ entries?: string[];
28
+ }>;
29
+ };
22
30
  codexInstallationInputs?: {
23
31
  version: "codex-cli 0.160.0";
24
32
  catalogSha256: string;
@@ -39,6 +47,9 @@ export interface ReviewedDiscoveryInputs {
39
47
  /** Project one native configuration's witnessed fields, exactly as discovery
40
48
  * binds them. Used for both the current file and a preserved reviewed preimage. */
41
49
  export declare function projectNativeDiscoveryFields(text: string, format: "json" | "toml" | "yaml", fields: readonly string[], path: string): string;
50
+ /** Called only after the owning planner validated discovery and capabilities.
51
+ * New roots must already be body-free; absent roots need the prior typed proof. */
52
+ export declare function captureRetiredCodexDiscovery(binding: AgentDiscoveryBinding, controls: CodexPluginSkillControl[], rules: unknown): AgentDiscoveryBinding;
42
53
  export declare function verifyAgentDiscovery(binding: AgentDiscoveryBinding, codexRecovery?: CodexHookDiscoveryRecovery): void;
43
54
  export declare function rebindAgentDiscovery(binding: AgentDiscoveryBinding, changes: Map<string, string>): AgentDiscoveryBinding;
44
55
  /** Capture full byte witnesses for reviewed source or executable files; never import or execute them. */
@@ -1,3 +1,5 @@
1
+ import { type CodexCorpusWriteOptions } from "./codex-corpus-write.js";
2
+ import { type ReviewedCodexSkillDenial } from "./codex-plugin-skill-controls.js";
1
3
  import { type CodexNativeSkillCatalog } from "./codex-native-skill-catalog.js";
2
4
  import { type AgentDiscoveryBinding, type ReviewedDiscoveryInputs } from "./agent-discovery.js";
3
5
  import { type IntegrationAgent } from "./agent-adapters.js";
@@ -24,6 +26,7 @@ export interface NativeSkillEntry {
24
26
  bridge?: boolean;
25
27
  bridgeHome?: string;
26
28
  rootAlias?: AgentRootAlias;
29
+ codexHome?: string;
27
30
  }
28
31
  export interface NativeMigrationTarget {
29
32
  agent: string;
@@ -45,7 +48,7 @@ export interface AgentConfigChange {
45
48
  export interface AgentIntegrationPlan {
46
49
  observedNativeSources?: Array<{
47
50
  path: string;
48
- sha256: string;
51
+ sha256: string | null;
49
52
  }>;
50
53
  codexPluginSkillReview?: {
51
54
  version: string;
@@ -132,6 +135,7 @@ export declare function planAgentIntegration(options: {
132
135
  allowRootAliases?: boolean;
133
136
  reviewedCacheAlias?: string;
134
137
  codexNativeCatalog?: CodexNativeSkillCatalog;
138
+ codexSkillDenials?: ReviewedCodexSkillDenial[];
135
139
  }): AgentIntegrationPlan;
136
140
  export interface ClaudeManagedHookProjection {
137
141
  schema: "hasna.claude-managed-hook-projection.v1";
@@ -192,12 +196,12 @@ export declare function planAgentSettingsWitnessUpgrade(options: {
192
196
  expectedPolicySha256: string;
193
197
  expectedSettingsSha256: string;
194
198
  }): AgentIntegrationPlan;
195
- export declare function applyAgentIntegration(plan: AgentIntegrationPlan): {
199
+ export declare function applyAgentIntegration(plan: AgentIntegrationPlan, options?: CodexCorpusWriteOptions): {
196
200
  changed: string[];
197
201
  backups: string[];
198
202
  rootAliases?: AgentRootAlias[];
199
203
  };
200
- export declare function archiveNativeSkills(inventory: NativeSkillEntry[], options: {
204
+ export declare function archiveNativeSkills(inventory: NativeSkillEntry[], options: CodexCorpusWriteOptions & {
201
205
  dataDir?: string;
202
206
  includeUnmanaged?: boolean;
203
207
  includeVendor?: boolean;
@@ -1,3 +1,4 @@
1
+ import { type CodexCorpusWriteOptions } from "./codex-corpus-write.js";
1
2
  /**
2
3
  * `skills sync` — the last mile: write skills from this machine's corpus
3
4
  * (the migrated owner-layout cache ~/.hasna/skills/skills/<name>/, or the
@@ -82,7 +83,7 @@ export interface AgentSyncAction {
82
83
  action: SyncActionKind;
83
84
  reason?: string;
84
85
  }
85
- export interface SyncSkillsOptions {
86
+ export interface SyncSkillsOptions extends CodexCorpusWriteOptions {
86
87
  /** Specific skills to sync. When empty, every corpus skill is synced. */
87
88
  names?: string[];
88
89
  /** Explicit; the default when no names are given is already "all". */
@@ -133,7 +134,7 @@ export declare function resolveSyncCorpus(options?: SyncSkillsOptions): {
133
134
  source: "source" | "corpus";
134
135
  };
135
136
  export declare function syncSkillsToAgents(options?: SyncSkillsOptions): SyncSkillsResult;
136
- export interface WriteManagedAgentSkillParams {
137
+ export interface WriteManagedAgentSkillParams extends CodexCorpusWriteOptions {
137
138
  skill: string;
138
139
  agent: SyncAgent;
139
140
  skillMd: string;
@@ -159,7 +160,7 @@ export interface ManagedDirWriteResult {
159
160
  path: string;
160
161
  reason?: string;
161
162
  }
162
- export interface ManagedDirWriteOptions {
163
+ export interface ManagedDirWriteOptions extends CodexCorpusWriteOptions {
163
164
  skill: string;
164
165
  source?: string;
165
166
  resourceDir?: string;
@@ -180,4 +181,4 @@ export declare function writeManagedSkillDir(dir: string, skillMd: string, optio
180
181
  * did not write (no valid Skills ownership marker). Foreign or malformed markers
181
182
  * grant no deletion authority, and removal has no force override.
182
183
  */
183
- export declare function removeManagedAgentSkill(skill: string, agent: SyncAgent, homeDir?: string): boolean;
184
+ export declare function removeManagedAgentSkill(skill: string, agent: SyncAgent, homeDir?: string, options?: CodexCorpusWriteOptions): boolean;
@@ -0,0 +1,16 @@
1
+ export interface CodexCorpusWriteOptions {
2
+ /** The selected native executable; never a shell command. */
3
+ codexCommand?: string;
4
+ /** Existing callers with a reviewed executable binding retain that binding. */
5
+ codexSha256?: string;
6
+ }
7
+ /** Protected aliases fail closed; unrelated project paths remain usable. */
8
+ export declare function codexCorpusRootForPath(path: string): string | undefined;
9
+ export declare function acquireCodexCorpusWrite(roots: readonly string[], options: CodexCorpusWriteOptions): {
10
+ assertCurrent: () => void;
11
+ close: () => void;
12
+ };
13
+ /** Keep the descriptor through preimage checks, writes, rollback and readback. */
14
+ export declare function withCodexCorpusWrite<T>(roots: readonly string[], run: (assertCurrent: () => void) => T, options?: CodexCorpusWriteOptions): T;
15
+ /** The callback must await every native child's close before settling. */
16
+ export declare function withCodexCorpusWriteAsync<T>(roots: readonly string[], run: (assertCurrent: () => void) => Promise<T>, options?: CodexCorpusWriteOptions): Promise<T>;
@@ -8,6 +8,7 @@ export interface CodexPluginSkillControl {
8
8
  appSha256?: string;
9
9
  mcpSha256?: string;
10
10
  remotePluginId?: string;
11
+ skillsOnly?: true;
11
12
  }
12
13
  /** A native nonremote installation disabled by the witnessed configuration.
13
14
  * Its cache is inert; this makes no claim about reviewed hook capabilities. */
@@ -18,6 +19,11 @@ export interface CodexInactivePluginControl {
18
19
  sourceType: "local" | "git" | "npm";
19
20
  sourceSha256: string;
20
21
  }
22
+ export interface ReviewedCodexSkillDenial {
23
+ name: string;
24
+ path: string;
25
+ sha256: string;
26
+ }
21
27
  export interface CodexPluginSourceInput {
22
28
  pluginId: string;
23
29
  namespace: string;
@@ -26,9 +32,16 @@ export interface CodexPluginSourceInput {
26
32
  sourceSha256: string;
27
33
  }
28
34
  type Read = (path: string) => string;
35
+ /** Establish the reviewed denial/skills-only role for an exact remote parent.
36
+ * Walk every ancestor: a dangling alias or non-directory is never absence. */
37
+ export declare function reviewedDisabledCodexPluginParent(cache: string, parent: string, controls: CodexPluginSkillControl[], rules: unknown): boolean;
38
+ export declare function absentDisabledCodexPluginParent(cache: string, parent: string, controls: CodexPluginSkillControl[], rules: unknown): boolean;
39
+ /** A body-free historical remote version has no remaining native skill entry.
40
+ * Bind its capability-identical, skills-only identity before projecting it. */
41
+ export declare function reviewedRetiredCodexRoot(cache: string, root: string, controls: CodexPluginSkillControl[], rules: unknown, read: Read, allowAbsent?: boolean): boolean;
29
42
  /** Capability controls remain bound even after every native Skill body disappears. */
30
- export declare function reviewedCodexPluginCapabilitiesUnchanged(cache: string, controls: CodexPluginSkillControl[], read: Read): boolean;
31
- export declare function reviewCodexPluginControls(catalog: CodexNativeSkillCatalog, documents: string[], cache: string, cwd: string, read: Read, rules: unknown, pluginSettings?: unknown, plannedRules?: unknown): {
43
+ export declare function reviewedCodexPluginCapabilitiesUnchanged(cache: string, controls: CodexPluginSkillControl[], read: Read, rules?: unknown): boolean;
44
+ export declare function reviewCodexPluginControls(catalog: CodexNativeSkillCatalog, documents: string[], cache: string, cwd: string, read: Read, rules: unknown, pluginSettings?: unknown, plannedRules?: unknown, denials?: ReviewedCodexSkillDenial[]): {
32
45
  skills: CodexPluginSkillControl[];
33
46
  inactivePlugins: CodexInactivePluginControl[];
34
47
  sourceInputs: CodexPluginSourceInput[];
@@ -1,5 +1,6 @@
1
1
  import { type SyncAgent, type SyncMarker } from "./agent-sync.js";
2
2
  import type { PortableSkillOptions } from "./portable-skills.js";
3
+ import { type CodexCorpusWriteOptions } from "./codex-corpus-write.js";
3
4
  export declare const CONFLICTS_LEDGER_FILE = "conflicts.json";
4
5
  export declare const ROLLBACK_DIRNAME = "rollback";
5
6
  export interface HomeSkillEntry {
@@ -28,7 +29,7 @@ export interface AdoptionScan {
28
29
  /** Already-marked dirs, counted only. */
29
30
  managed: number;
30
31
  }
31
- export interface AdoptionOptions extends PortableSkillOptions {
32
+ export interface AdoptionOptions extends PortableSkillOptions, CodexCorpusWriteOptions {
32
33
  agents?: SyncAgent[];
33
34
  /** Optional selected home/corpus names; omitted means all names. */
34
35
  names?: string[];
@@ -1,12 +1,4 @@
1
- /**
2
- * Skill setup and project preferences.
3
- *
4
- * Skills are discovered through the CLI/MCP registry and executed from the bundled
5
- * package or the remote platform. Project state remains metadata-only pins. Agent skill
6
- * folders, however, are now written by the last-mile sync: installSkillForAgent() writes a
7
- * per-tool-adapted SKILL.md into an agent's folder, non-clobbering, marking each directory
8
- * it owns so a re-sync never overwrites a skill the user hand-authored.
9
- */
1
+ import { type CodexCorpusWriteOptions } from "./codex-corpus-write.js";
10
2
  import { type SkillMeta } from "./registry.js";
11
3
  import { type ProjectSkillPin } from "./project-state.js";
12
4
  export interface InstallResult {
@@ -95,7 +87,7 @@ export type AgentScope = "global" | "project";
95
87
  export declare const AGENT_TARGETS: AgentTarget[];
96
88
  export declare const AGENT_LABELS: Record<AgentTarget, string>;
97
89
  export declare function resolveAgents(agentArg: string): AgentTarget[];
98
- export interface AgentInstallOptions {
90
+ export interface AgentInstallOptions extends CodexCorpusWriteOptions {
99
91
  agent: AgentTarget;
100
92
  scope?: AgentScope;
101
93
  projectDir?: string;