@hasna/skills 0.10.65 → 0.10.67

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.
@@ -4,7 +4,7 @@ import { type ManagedPluginRegistrationWitness } from "./plugin-discovery.js";
4
4
  import { type CodexHookDiscoveryRecovery } from "./codex-hook-discovery-recovery.js";
5
5
  import { type CodexPluginSkillControl, type CodexPluginSourceInput } from "./codex-plugin-skill-controls.js";
6
6
  import { type RetainedReviewArtifact, type ReviewedArtifact } from "./retained-review-artifacts.js";
7
- import { type CodexSemanticCacheWitness, type CodexSemanticCacheAppOnlyParent } from "./codex-semantic-cache-witness.js";
7
+ import { type CodexSemanticCacheWitness, type CodexSemanticCacheAppOnlyParent, type CodexSemanticCacheReviewedHookParent } from "./codex-semantic-cache-witness.js";
8
8
  export { captureDiscoveryDirectories, type DiscoveryDirectory } from "./agent-discovery-directories.js";
9
9
  export interface DiscoverySource {
10
10
  reviewArtifact?: RetainedReviewArtifact;
@@ -26,6 +26,7 @@ export interface CodexSemanticCacheDiscovery {
26
26
  } | null;
27
27
  witness: CodexSemanticCacheWitness;
28
28
  appOnlyParents: CodexSemanticCacheAppOnlyParent[];
29
+ reviewedHookParents?: CodexSemanticCacheReviewedHookParent[];
29
30
  previousPolicySha256: string;
30
31
  supersededSources: DiscoverySource[];
31
32
  supersededDirectories: DiscoveryDirectory[];
@@ -93,7 +94,7 @@ export declare function projectNativeDiscoveryFields(text: string, format: "json
93
94
  export declare function captureRetiredCodexDiscovery(binding: AgentDiscoveryBinding, controls: CodexPluginSkillControl[], rules: unknown): AgentDiscoveryBinding;
94
95
  /** Only native capability locations covered by the complete typed cache census
95
96
  * qualify. Historical sources remain stored; arbitrary missing files do not. */
96
- export declare function codexSemanticCacheSourceRole(source: DiscoverySource, cacheRoot: string, parents: readonly string[]): boolean;
97
+ export declare function codexSemanticCacheSourceRole(source: DiscoverySource, cacheRoot: string, parents: readonly string[], hookParents?: readonly string[]): boolean;
97
98
  export declare function codexSemanticCacheDirectoryRole(path: string, cacheRoot: string): boolean;
98
99
  export declare function assertCodexSemanticCacheHookSafety(cacheRoot: string, parents: readonly string[], configPath: string, hookRootAlias?: CodexSemanticCacheDiscovery["hookRootAlias"]): void;
99
100
  export declare function verifyAgentDiscovery(binding: AgentDiscoveryBinding, codexRecovery?: CodexHookDiscoveryRecovery, reviewedRootAliases?: readonly {
@@ -215,6 +215,8 @@ export declare function planAgentSettingsWitnessUpgrade(options: {
215
215
  export interface CodexSemanticCacheUpgrade {
216
216
  agent: "codex";
217
217
  appOnlyParents: string[];
218
+ /** Explicit cache parents whose complete native mcp_tool hook contract was already enrolled. */
219
+ reviewedHookParents?: string[];
218
220
  expectedPolicySha256: string;
219
221
  expectedSettingsSha256: string;
220
222
  expectedCacheWitnessSha256?: string;
@@ -32,11 +32,31 @@ export interface CodexSemanticCacheAppOnlyParentWitness extends CodexSemanticCac
32
32
  appSha256: string;
33
33
  mcpSha256?: string;
34
34
  }
35
+ /** Explicitly reviewed native MCP-hook parent. Its cache materializations are
36
+ * admitted only when the complete manifest and hooks declaration were already
37
+ * enrolled as full-byte native discovery sources. */
38
+ export interface CodexSemanticCacheReviewedHookParent {
39
+ role: "reviewed-hook";
40
+ pluginId: string;
41
+ namespace: string;
42
+ pluginParent: string;
43
+ installation: "remote-receipt" | "local-marketplace";
44
+ remotePluginId?: string;
45
+ marketplaceSourcePath?: string;
46
+ marketplaceSha256?: string;
47
+ }
48
+ export interface CodexSemanticCacheReviewedHookParentWitness extends CodexSemanticCacheReviewedHookParent {
49
+ manifestSha256: string;
50
+ hooksSha256: string;
51
+ receiptSha256?: string;
52
+ }
35
53
  export interface CodexSemanticCacheWitness {
36
54
  schema: typeof CODEX_SEMANTIC_CACHE_WITNESS_SCHEMA;
37
55
  cacheRoot: string;
38
56
  controls: CodexSemanticCacheControl[];
39
57
  appOnlyParents: CodexSemanticCacheAppOnlyParentWitness[];
58
+ /** Optional only for compatibility with already persisted v1 witnesses. */
59
+ hookParents?: CodexSemanticCacheReviewedHookParentWitness[];
40
60
  skills: CodexSemanticCacheSkill[];
41
61
  sha256: string;
42
62
  }
@@ -45,10 +65,13 @@ export interface CaptureCodexSemanticCacheWitnessOptions {
45
65
  controls: CodexPluginSkillControl[];
46
66
  /** Explicit package-reviewed parents; absence never infers this role. */
47
67
  appOnlyParents?: CodexSemanticCacheAppOnlyParent[];
68
+ /** Explicit roles only; cache presence never creates a hook role. */
69
+ reviewedHookParents?: CodexSemanticCacheReviewedHookParent[];
48
70
  rules: unknown;
49
71
  /** Package-owned, bounded read used by the existing semantic control review. */
50
72
  read?: (path: string) => string;
51
73
  }
74
+ export declare function codexLocalMarketplaceMapsPlugin(text: string, marketplace: string, plugin: string): boolean;
52
75
  /** Capture the current semantic identity without changing the stored baseline.
53
76
  * Existing package-owned parsers validate documents and capability controls. */
54
77
  export declare function captureCodexSemanticCacheWitness(options: CaptureCodexSemanticCacheWitnessOptions): CodexSemanticCacheWitness;
@@ -23,8 +23,18 @@ export declare function getSkillBestDoc(name: string, file?: string): string | n
23
23
  * Extract requirements from a skill's source files
24
24
  */
25
25
  export declare function getSkillRequirements(name: string): SkillRequirements | null;
26
- /** Shared parser for verified bundle content and explicit local authoring files. */
27
- export declare function getSkillRequirementsFromContent(name: string, texts: string[], dependencies?: Record<string, string>, meta?: SkillMeta): SkillRequirements;
26
+ /**
27
+ * Shared parser for verified bundle content and explicit local authoring files.
28
+ * Public through `@hasna/skills/sdk`.
29
+ *
30
+ * The result depends only on the arguments: `texts` are the documentation
31
+ * contents to scan (for example SKILL.md, README.md, CLAUDE.md, .env.example),
32
+ * `dependencies` is the skill package's dependency map and `meta` its catalog
33
+ * record. It reads no registry, file, environment, install state or network,
34
+ * and never mutates its inputs; the returned `dependencies` is the caller's
35
+ * object, not a copy.
36
+ */
37
+ export declare function getSkillRequirementsFromContent(name: string, texts: readonly string[], dependencies?: Record<string, string>, meta?: SkillMeta): SkillRequirements;
28
38
  export interface SkillDependencyStatus {
29
39
  name: string;
30
40
  version: string;
@@ -49,7 +49,7 @@ var __require = import.meta.require;
49
49
  // src/runtime-prerequisites.ts
50
50
  import { isAbsolute as isAbsolute5 } from "path";
51
51
  // package.json
52
- var version = "0.10.65";
52
+ var version = "0.10.67";
53
53
  var package_default = {
54
54
  name: "@hasna/skills",
55
55
  version,
@@ -2643,8 +2643,8 @@ function assertAgentPolicyCollections(policy) {
2643
2643
  }
2644
2644
  }
2645
2645
  if (value.codexSemanticCache !== undefined) {
2646
- const proof = record(value.codexSemanticCache, 8), witness = record(proof.witness, 6);
2647
- requireBound(agent === "codex" && value.agent === "codex" && value.method === "reviewed" && Object.keys(proof).length === 8 && proof.schema === "hasna.codex-semantic-cache-discovery.v1" && typeof proof.previousPolicySha256 === "string" && /^[a-f0-9]{64}$/.test(proof.previousPolicySha256) && Object.keys(witness).length === 6 && witness.schema === "hasna.codex-semantic-cache-witness.v1" && typeof witness.sha256 === "string" && /^[a-f0-9]{64}$/.test(witness.sha256));
2646
+ const proof = record(value.codexSemanticCache, 9), witness = record(proof.witness, 7);
2647
+ requireBound(agent === "codex" && value.agent === "codex" && value.method === "reviewed" && [8, 9].includes(Object.keys(proof).length) && Object.keys(proof).every((key) => ["schema", "configPath", "hookRootAlias", "witness", "appOnlyParents", "previousPolicySha256", "supersededSources", "supersededDirectories", "reviewedHookParents"].includes(key)) && proof.schema === "hasna.codex-semantic-cache-discovery.v1" && typeof proof.previousPolicySha256 === "string" && /^[a-f0-9]{64}$/.test(proof.previousPolicySha256) && [6, 7].includes(Object.keys(witness).length) && Object.keys(witness).every((key) => ["schema", "cacheRoot", "controls", "appOnlyParents", "skills", "sha256", "hookParents"].includes(key)) && witness.schema === "hasna.codex-semantic-cache-witness.v1" && typeof witness.sha256 === "string" && /^[a-f0-9]{64}$/.test(witness.sha256));
2648
2648
  text(proof.configPath);
2649
2649
  requireBound(isAbsolute3(proof.configPath) && resolve5(proof.configPath) === proof.configPath && basename3(proof.configPath) === "config.toml");
2650
2650
  text(witness.cacheRoot);
@@ -2663,6 +2663,20 @@ function assertAgentPolicyCollections(policy) {
2663
2663
  text(parent[key]);
2664
2664
  requireBound(isAbsolute3(parent.pluginParent) && resolve5(parent.pluginParent) === parent.pluginParent);
2665
2665
  }
2666
+ if (proof.reviewedHookParents !== undefined)
2667
+ for (const parent of array(proof.reviewedHookParents, 4096)) {
2668
+ requireBound(object(parent) && parent.role === "reviewed-hook" && (parent.installation === "remote-receipt" && Object.keys(parent).length === 6 || parent.installation === "local-marketplace" && Object.keys(parent).length === 7));
2669
+ requireBound(parent.installation === "remote-receipt" ? Object.keys(parent).sort().join(",") === "installation,namespace,pluginId,pluginParent,remotePluginId,role" : Object.keys(parent).sort().join(",") === "installation,marketplaceSha256,marketplaceSourcePath,namespace,pluginId,pluginParent,role");
2670
+ for (const key of ["pluginId", "namespace", "pluginParent", "installation"])
2671
+ text(parent[key]);
2672
+ if (parent.installation === "remote-receipt")
2673
+ text(parent.remotePluginId);
2674
+ else {
2675
+ text(parent.marketplaceSourcePath);
2676
+ requireBound(typeof parent.marketplaceSha256 === "string" && /^[a-f0-9]{64}$/.test(parent.marketplaceSha256) && isAbsolute3(parent.marketplaceSourcePath) && resolve5(parent.marketplaceSourcePath) === parent.marketplaceSourcePath && basename3(parent.marketplaceSourcePath) === "marketplace.json");
2677
+ }
2678
+ requireBound(isAbsolute3(parent.pluginParent) && resolve5(parent.pluginParent) === parent.pluginParent);
2679
+ }
2666
2680
  for (const row of [...array(witness.controls, 4096), ...array(witness.appOnlyParents, 4096)]) {
2667
2681
  requireBound(object(row));
2668
2682
  for (const key of ["pluginId", "namespace", "pluginParent"])
@@ -2671,6 +2685,26 @@ function assertAgentPolicyCollections(policy) {
2671
2685
  if (row[key] !== undefined)
2672
2686
  requireBound(typeof row[key] === "string" && /^[a-f0-9]{64}$/.test(row[key]));
2673
2687
  }
2688
+ if (witness.hookParents !== undefined)
2689
+ for (const row of array(witness.hookParents, 4096)) {
2690
+ requireBound(object(row) && row.role === "reviewed-hook" && (row.installation === "remote-receipt" && Object.keys(row).length === 9 || row.installation === "local-marketplace" && Object.keys(row).length === 9));
2691
+ requireBound(row.installation === "remote-receipt" ? Object.keys(row).sort().join(",") === "hooksSha256,installation,manifestSha256,namespace,pluginId,pluginParent,receiptSha256,remotePluginId,role" : Object.keys(row).sort().join(",") === "hooksSha256,installation,manifestSha256,marketplaceSha256,marketplaceSourcePath,namespace,pluginId,pluginParent,role");
2692
+ for (const key of ["pluginId", "namespace", "pluginParent", "installation"])
2693
+ text(row[key]);
2694
+ if (row.installation === "remote-receipt")
2695
+ text(row.remotePluginId);
2696
+ else {
2697
+ text(row.marketplaceSourcePath);
2698
+ requireBound(typeof row.marketplaceSha256 === "string" && /^[a-f0-9]{64}$/.test(row.marketplaceSha256) && isAbsolute3(row.marketplaceSourcePath) && resolve5(row.marketplaceSourcePath) === row.marketplaceSourcePath && basename3(row.marketplaceSourcePath) === "marketplace.json");
2699
+ }
2700
+ requireBound(isAbsolute3(row.pluginParent) && resolve5(row.pluginParent) === row.pluginParent);
2701
+ for (const key of ["manifestSha256", "hooksSha256"])
2702
+ requireBound(typeof row[key] === "string" && /^[a-f0-9]{64}$/.test(row[key]));
2703
+ if (row.installation === "remote-receipt")
2704
+ requireBound(typeof row.receiptSha256 === "string" && /^[a-f0-9]{64}$/.test(row.receiptSha256));
2705
+ else
2706
+ requireBound(row.receiptSha256 === undefined);
2707
+ }
2674
2708
  for (const skill of array(witness.skills, 4096)) {
2675
2709
  requireBound(object(skill));
2676
2710
  for (const key of ["name", "pluginId", "namespace", "pluginParent"])
@@ -44,6 +44,7 @@ export * from "../lib/remote-recurring-contract.js";
44
44
  export { RecurringInputError, RemoteRecurringError, RemoteRecurringUnavailableError, RemoteRecurringReadError, RemoteRecurringUnconfirmedError } from "../lib/remote-recurring.js";
45
45
  export type { RecurringCapability, RecurringListOptions, RemoteRecurringErrorCode } from "../lib/remote-recurring.js";
46
46
  export { canonicalJson, canonicalJsonSha256 } from "../lib/canonical-json.js";
47
+ export { getSkillRequirementsFromContent, type SkillRequirements } from "../lib/skillinfo.js";
47
48
  export type { RemoteQuoteUnavailableCode } from "../lib/remote-client.js";
48
49
  export { RemoteCreditApprovalError, type RemoteRunApproval, type RemoteRunQuote, type RemoteCreditPack } from "../lib/remote-account.js";
49
50
  export { type RemoteInputFile, type RemoteInputFileDescriptor } from "../lib/remote-files.js";