@hasna/skills 0.9.9 → 0.9.11

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.
@@ -1,5 +1,6 @@
1
1
  import { connectCodexHookRpc } from "./codex-hook-rpc.js";
2
2
  import { type ReviewedSkillsCli } from "./codex-hook-trust-identity.js";
3
+ import { type ClaudeDiscoveryRecovery } from "./codex-hook-policy-recovery.js";
3
4
  export interface CodexNativeHookTrustOptions {
4
5
  home?: string;
5
6
  dataDir?: string;
@@ -24,6 +25,7 @@ export interface CodexNativeHookReconcileOptions {
24
25
  reviewedSkillsCli?: ReviewedSkillsCli;
25
26
  releaseProof?: SkillsCliReleaseProof;
26
27
  supersedeBinding?: boolean;
28
+ claudeDiscoveryRecovery?: ClaudeDiscoveryRecovery;
27
29
  }
28
30
  type Connect = typeof connectCodexHookRpc;
29
31
  /** Resolve an interrupted native write only after the native consumer and every
@@ -31,6 +33,44 @@ type Connect = typeof connectCodexHookRpc;
31
33
  * receipt for an already-effective operation so the ordinary apply guard can
32
34
  * stop refusing the same journal. */
33
35
  export declare function reconcileCodexNativeHooks(options: CodexNativeHookReconcileOptions, connect?: Connect): Promise<{
36
+ recoveryPlan?: {
37
+ reason?: string | undefined;
38
+ changes?: {
39
+ path: string;
40
+ before: any;
41
+ after: any;
42
+ }[] | undefined;
43
+ hooksSha256: string;
44
+ nativeConfigPath: any;
45
+ nativeVersion: string;
46
+ nativeInventorySha256: string;
47
+ recordedNativeInventorySha256: string;
48
+ boundSkillsCli: {
49
+ path: string;
50
+ version: string;
51
+ sha256: string;
52
+ manifestSha256: string;
53
+ };
54
+ recoveryCli: {
55
+ path: string;
56
+ version: string;
57
+ sha256: string;
58
+ manifestSha256: string;
59
+ };
60
+ releaseProof: SkillsCliReleaseProof | undefined;
61
+ configDiscoveryRecovery?: import("./codex-hook-discovery-recovery.js").CodexHookDiscoveryRecovery | undefined;
62
+ version: number;
63
+ kind: string;
64
+ journal: string;
65
+ journalIntentSha256: string;
66
+ stoppedSha256: string;
67
+ originalPlanDigest: any;
68
+ policyBeforeSha256: string;
69
+ policyCurrentSha256: string;
70
+ configBeforeSha256: string;
71
+ configCurrentSha256: string;
72
+ } | undefined;
73
+ recoveryPlanDigest?: string | undefined;
34
74
  version: number;
35
75
  status: string;
36
76
  reconciled: boolean;
@@ -41,6 +81,7 @@ export declare function reconcileCodexNativeHooks(options: CodexNativeHookReconc
41
81
  nativeVersion: string;
42
82
  nativeStateVerified: boolean;
43
83
  nativeTrustPending: boolean;
84
+ bindingRefreshRequired: boolean;
44
85
  nativeExecutionVerified: boolean;
45
86
  configSha256: string;
46
87
  hooksSha256: string;
@@ -86,6 +127,7 @@ export declare function enrollCodexNativeHooks(options?: CodexNativeHookTrustOpt
86
127
  trustStatus: any;
87
128
  }[];
88
129
  nativeEligible: boolean;
130
+ bindingRefreshRequired: boolean;
89
131
  transport: string;
90
132
  existingSessionsReloaded: boolean;
91
133
  nativeExecutionVerified: boolean;
@@ -1,6 +1,7 @@
1
1
  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
+ import { type CodexHookDiscoveryRecovery } from "./codex-hook-discovery-recovery.js";
4
5
  export { captureDiscoveryDirectories, type DiscoveryDirectory } from "./agent-discovery-directories.js";
5
6
  export interface DiscoverySource {
6
7
  path: string;
@@ -28,7 +29,7 @@ export interface ReviewedDiscoveryInputs {
28
29
  pluginHooks: "reviewed-no-skill-injection";
29
30
  }>;
30
31
  }
31
- export declare function verifyAgentDiscovery(binding: AgentDiscoveryBinding): void;
32
+ export declare function verifyAgentDiscovery(binding: AgentDiscoveryBinding, codexRecovery?: CodexHookDiscoveryRecovery): void;
32
33
  export declare function rebindAgentDiscovery(binding: AgentDiscoveryBinding, changes: Map<string, string>): AgentDiscoveryBinding;
33
34
  /** Capture full byte witnesses for reviewed source or executable files; never import or execute them. */
34
35
  export declare function captureDiscoveryByteSources(paths: string[]): DiscoverySource[];
@@ -1,5 +1,6 @@
1
1
  import { type AgentDiscoveryBinding, type ReviewedDiscoveryInputs } from "./agent-discovery.js";
2
2
  import { type IntegrationAgent } from "./agent-adapters.js";
3
+ import type { CodexHookDiscoveryRecovery } from "./codex-hook-discovery-recovery.js";
3
4
  export type { IntegrationAgent } from "./agent-adapters.js";
4
5
  export type ContextHookEvent = "UserPromptSubmit" | "SessionStart" | "SubagentStart";
5
6
  export interface AgentRootAlias {
@@ -120,6 +121,7 @@ export declare function assertManagedAgentBridge(agent: IntegrationAgent, option
120
121
  projectDir?: string;
121
122
  projectDirs?: string[];
122
123
  profileId?: string;
124
+ codexDiscoveryRecovery?: CodexHookDiscoveryRecovery;
123
125
  }): void;
124
126
  export declare function normalizeAgentHookPrompt(agent: IntegrationAgent, event: string, prompt: string): string;
125
127
  export declare function hookContextOutput(event: string, result: {
@@ -0,0 +1,25 @@
1
+ import type { AgentDiscoveryBinding, DiscoverySource } from "./agent-discovery.js";
2
+ import { type snapshot } from "./codex-hook-trust-files.js";
3
+ type Snapshot = ReturnType<typeof snapshot>;
4
+ /** A receipt projection, not an override supplied by a CLI caller. Only this
5
+ * module can create the in-memory proof used by discovery verification. */
6
+ export interface CodexHookDiscoveryRecovery {
7
+ readonly configPath: string;
8
+ readonly beforeSha256: string;
9
+ readonly currentSha256: string;
10
+ readonly discoverySha256: string;
11
+ readonly typedProjectionSha256: string;
12
+ }
13
+ /** Called after a complete journal/intent or the current reviewed native
14
+ * transaction and exact intended trust writes have been checked. Recheck those
15
+ * writes here so a raw hash alone can never
16
+ * grant this exception. Policy bytes and recorded sources remain unchanged. */
17
+ export declare function createCodexHookDiscoveryRecovery(binding: AgentDiscoveryBinding, before: Snapshot, current: Snapshot, hooks: Array<{
18
+ key: string;
19
+ currentHash: string;
20
+ }>): CodexHookDiscoveryRecovery | undefined;
21
+ export declare function assertCodexHookDiscoveryRecovery(binding: AgentDiscoveryBinding, witness: CodexHookDiscoveryRecovery): void;
22
+ /** Verify this one historical byte witness using the already-validated native
23
+ * transition. Every other source still uses its ordinary current-file hash. */
24
+ export declare function verifiesCodexHookDiscoverySource(binding: AgentDiscoveryBinding, source: DiscoverySource, currentDigest: string | null, witness?: CodexHookDiscoveryRecovery): boolean;
25
+ export {};
@@ -0,0 +1,16 @@
1
+ export interface ClaudeDiscoveryRecovery {
2
+ /** Authoritative review/evidence reference explaining this exact transition. */
3
+ reason: string;
4
+ /** Omit to preview; supply the reviewed preview digest to record a receipt. */
5
+ reviewedPlanDigest?: string;
6
+ }
7
+ /** This admits one named transition, not a general "ignore other agents" mode.
8
+ * Both full policy hashes and these exact values enter the recovery plan. */
9
+ export declare function reviewedClaudeDiscoveryChange(beforeText: string, currentText: string, options: ClaudeDiscoveryRecovery): {
10
+ reason: string;
11
+ changes: {
12
+ path: string;
13
+ before: any;
14
+ after: any;
15
+ }[];
16
+ };
@@ -5,6 +5,17 @@ export interface ReviewedSkillsCli {
5
5
  version: string;
6
6
  sha256: string;
7
7
  }
8
+ /** Read an unchanged journal binding as evidence, never as executable recovery
9
+ * code. The caller separately binds and verifies the running recovery package. */
10
+ export declare function inspectRecordedSkillsCli(command: string, expected: unknown): {
11
+ receipt: {
12
+ path: string;
13
+ version: string;
14
+ sha256: string;
15
+ manifestSha256: string;
16
+ };
17
+ recheck(): void;
18
+ };
8
19
  export declare function bindSkillsCli(command: string, reviewed?: ReviewedSkillsCli): {
9
20
  receipt: {
10
21
  path: string;