@hasna/skills 0.10.75 → 0.10.77

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.
@@ -35,6 +35,8 @@ type Connect = typeof connectCodexHookRpc;
35
35
  * receipt for an already-effective operation so the ordinary apply guard can
36
36
  * stop refusing the same journal. */
37
37
  export declare function reconcileCodexNativeHooks(options: CodexNativeHookReconcileOptions, connect?: Connect): Promise<{
38
+ nativeAdmission?: "unavailable";
39
+ nativeAdmissionProbe?: import("./codex-corpus-write.js").CodexAdmissionProbe;
38
40
  recoveryPlan?: {
39
41
  reason?: string | undefined;
40
42
  changes?: {
@@ -119,6 +121,8 @@ export declare function reconcileCodexNativeHooks(options: CodexNativeHookReconc
119
121
  /** Deliberately separate from filesystem hook installation: native trust is an
120
122
  * explicit authorization of exact owned commands, never a broad trust bypass. */
121
123
  export declare function enrollCodexNativeHooks(options?: CodexNativeHookTrustOptions, connect?: Connect): Promise<{
124
+ nativeAdmission?: "unavailable";
125
+ nativeAdmissionProbe?: import("./codex-corpus-write.js").CodexAdmissionProbe;
122
126
  planDigest: string;
123
127
  skillsCli: {
124
128
  path: string;
@@ -1,4 +1,4 @@
1
- import { type CodexCorpusWriteOptions } from "./codex-corpus-write.js";
1
+ import { type CodexAdmissionReceipt, type CodexCorpusWriteOptions } from "./codex-corpus-write.js";
2
2
  import { type ReviewedCodexSkillDenial } from "./codex-plugin-skill-controls.js";
3
3
  import { type CodexNativeHookEnvelope, type ProcessInspector, type NativePolicyHelperRunner } from "./codex-native-skill-policy.js";
4
4
  import { type CodexNativeSkillCatalog } from "./codex-native-skill-catalog.js";
@@ -242,7 +242,7 @@ export declare function applyAgentIntegration(plan: AgentIntegrationPlan, option
242
242
  changed: string[];
243
243
  backups: string[];
244
244
  rootAliases?: AgentRootAlias[];
245
- };
245
+ } & CodexAdmissionReceipt;
246
246
  export declare function archiveNativeSkills(inventory: NativeSkillEntry[], options: CodexCorpusWriteOptions & {
247
247
  dataDir?: string;
248
248
  includeUnmanaged?: boolean;
@@ -263,7 +263,7 @@ export declare function archiveNativeSkills(inventory: NativeSkillEntry[], optio
263
263
  digest: string;
264
264
  targetCount: number;
265
265
  };
266
- };
266
+ } & CodexAdmissionReceipt;
267
267
  /** Native hook input for the Codex policy adapter. Only the Codex hook paths that
268
268
  * receive native SessionStart/UserPromptSubmit input supply it; install-time and
269
269
  * other guard calls never do. `inspector` is a test seam for process lineage. */
@@ -1,4 +1,4 @@
1
- import { type CodexCorpusWriteOptions } from "./codex-corpus-write.js";
1
+ import { type CodexAdmissionReceipt, type CodexAdmissionRecordOptions, type CodexCorpusWriteOptions } from "./codex-corpus-write.js";
2
2
  /**
3
3
  * `skills sync` — the last mile: write skills from this machine's corpus
4
4
  * (the migrated owner-layout cache ~/.hasna/skills/skills/<name>/, or the
@@ -76,7 +76,7 @@ export declare function isPointerSkillMd(markdown: string): boolean;
76
76
  /** A pointer SKILL.md for an executable skill: what it is and how to actually run it. */
77
77
  export declare function pointerSkillMd(name: string, description: string): string;
78
78
  export type SyncActionKind = "create" | "update" | "skip";
79
- export interface AgentSyncAction {
79
+ export interface AgentSyncAction extends CodexAdmissionReceipt {
80
80
  skill: string;
81
81
  agent: SyncAgent;
82
82
  path: string;
@@ -155,7 +155,7 @@ export interface WriteManagedAgentSkillParams extends CodexCorpusWriteOptions {
155
155
  * directory is always left untouched. A fresh directory is created.
156
156
  */
157
157
  export declare function writeManagedAgentSkill(params: WriteManagedAgentSkillParams): AgentSyncAction;
158
- export interface ManagedDirWriteResult {
158
+ export interface ManagedDirWriteResult extends CodexAdmissionReceipt {
159
159
  action: SyncActionKind;
160
160
  path: string;
161
161
  reason?: string;
@@ -181,4 +181,6 @@ export declare function writeManagedSkillDir(dir: string, skillMd: string, optio
181
181
  * did not write (no valid Skills ownership marker). Foreign or malformed markers
182
182
  * grant no deletion authority, and removal has no force override.
183
183
  */
184
- export declare function removeManagedAgentSkill(skill: string, agent: SyncAgent, homeDir?: string, options?: CodexCorpusWriteOptions): boolean;
184
+ /** Returns only whether it removed; pass `onCodexAdmission` to receive the admission
185
+ * record. Without it, a Codex home without native admission refuses as before. */
186
+ export declare function removeManagedAgentSkill(skill: string, agent: SyncAgent, homeDir?: string, options?: CodexCorpusWriteOptions & CodexAdmissionRecordOptions): boolean;
@@ -88,7 +88,7 @@ export declare function getAuthConfigReadOnly(env?: Env, options?: SkillsFleetOp
88
88
  * forgotten locally. Recorded in identity.json (never a secret).
89
89
  */
90
90
  export type StoredKeyIssuer = "sign-in" | "api-key";
91
- export declare function saveAuthConfig(config: StoredAuthConfig, env?: Env, authenticatedOrigin?: string, issuedBy?: StoredKeyIssuer): string;
91
+ export declare function saveAuthConfig(config: StoredAuthConfig, env?: Env, authenticatedOrigin?: string, issuedBy?: StoredKeyIssuer, assertUnchanged?: () => void): string;
92
92
  /**
93
93
  * Who put the active profile's stored credential there — the question
94
94
  * `skills logout` has to answer before it touches it (Instructions rule
@@ -1,16 +1,57 @@
1
+ /** Fixed refusal vocabulary for the interim fallback; never native text. */
2
+ export type CodexCorpusRefusal = "native-lock-present" | "executable-unverified" | "probe-inconclusive" | "command-present" | "writer-busy" | "skills-lock-unavailable" | "lease-changed";
1
3
  export interface CodexCorpusWriteOptions {
2
4
  /** The selected native executable; never a shell command. */
3
5
  codexCommand?: string;
4
6
  /** Existing callers with a reviewed executable binding retain that binding. */
5
7
  codexSha256?: string;
6
8
  }
9
+ /** The probe behind a fallback write. `executable`, `sha256` and `size` identify the
10
+ * selected executable file (for an npm install, the launcher script), not the vendor
11
+ * binary it starts. Never contains native output. */
12
+ export interface CodexAdmissionProbe {
13
+ kind: "help-unrecognized-subcommand";
14
+ executable: string;
15
+ sha256: string;
16
+ size: number;
17
+ version: string;
18
+ probeExitCode: 2;
19
+ controlExitCode: 0;
20
+ }
21
+ export interface CodexCorpusAdmission {
22
+ nativeAdmission: "verified" | "unavailable";
23
+ probe?: CodexAdmissionProbe;
24
+ }
25
+ export interface CodexAdmissionReceipt {
26
+ nativeAdmission?: "unavailable";
27
+ nativeAdmissionProbe?: CodexAdmissionProbe;
28
+ }
29
+ export interface CodexCorpusLease {
30
+ assertCurrent(): void;
31
+ close(): void;
32
+ admission: CodexCorpusAdmission;
33
+ }
34
+ /** Boolean writers have no receipt: they use the fallback only when the caller takes this record. */
35
+ export interface CodexAdmissionRecordOptions {
36
+ onCodexAdmission?: (admission: CodexCorpusAdmission) => void;
37
+ }
38
+ /** Gate policy for one transaction; writers without a receipt disable the fallback. */
39
+ export interface CodexCorpusWritePolicy {
40
+ fallback?: boolean;
41
+ }
42
+ /** Reads `onCodexAdmission` once. Only a synchronous function enables the fallback and
43
+ * receives the record; any other defined value refuses before anything happens, and a
44
+ * callback that returns a thenable refuses before anything is removed. */
45
+ export declare function codexAdmissionRecord(options: CodexAdmissionRecordOptions): {
46
+ policy: CodexCorpusWritePolicy;
47
+ deliver(admission: CodexCorpusAdmission | undefined): void;
48
+ };
49
+ /** Receipt fields for a write made under the interim fallback; native-path receipts are unchanged. */
50
+ export declare function codexAdmissionReceipt(admission: CodexCorpusAdmission | undefined): CodexAdmissionReceipt;
7
51
  /** Protected aliases fail closed; unrelated project paths remain usable. */
8
52
  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
- };
53
+ export declare function acquireCodexCorpusWrite(roots: readonly string[], options: CodexCorpusWriteOptions, policy?: CodexCorpusWritePolicy): CodexCorpusLease;
13
54
  /** 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;
55
+ export declare function withCodexCorpusWrite<T>(roots: readonly string[], run: (assertCurrent: () => void, admission?: CodexCorpusAdmission) => T, options?: CodexCorpusWriteOptions, policy?: CodexCorpusWritePolicy): T;
15
56
  /** 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>;
57
+ export declare function withCodexCorpusWriteAsync<T>(roots: readonly string[], run: (assertCurrent: () => void, admission?: CodexCorpusAdmission) => Promise<T>, options?: CodexCorpusWriteOptions, policy?: CodexCorpusWritePolicy): Promise<T>;
@@ -1,7 +1,10 @@
1
+ import { type CodexCorpusAdmission } from "./codex-corpus-write.js";
1
2
  export { SUPPORTED_CODEX_HOOK_VERSIONS } from "./codex-native-compatibility.js";
2
3
  export interface CodexHookRpc {
3
4
  version: string;
4
5
  processId?: number;
6
+ /** How the owned client's corpus lease was admitted; absent on synthetic clients. */
7
+ admission?: CodexCorpusAdmission;
5
8
  request(method: string, params: unknown): Promise<any>;
6
9
  close(): Promise<void>;
7
10
  }
@@ -0,0 +1,31 @@
1
+ /** The one package-owned definition of the plugin-root locations Codex reads.
2
+ *
3
+ * The vendor-refresh guard (codex-vendor-refresh.ts), the semantic cache
4
+ * witness (codex-semantic-cache-witness.ts) and the reviewed hook dependency
5
+ * closure (codex-hook-mcp-dependencies.ts) all derive their capability rules
6
+ * from these lists, so a location added here reaches every mode at once.
7
+ */
8
+ /** Manifest locations in a plugin version root, in the order Codex 0.160.0 and
9
+ * later look them up: the Agent Plugins root `plugin.json` first, then the
10
+ * `.codex-plugin`, `.claude-plugin` and `.cursor-plugin` manifests. The first
11
+ * one present is the plugin's manifest. */
12
+ export declare const CODEX_PLUGIN_MANIFEST_LOCATIONS: readonly string[];
13
+ /** The manifest directories among CODEX_PLUGIN_MANIFEST_LOCATIONS. */
14
+ export declare const CODEX_PLUGIN_MANIFEST_DIRECTORIES: readonly string[];
15
+ /** Every direct entry of a plugin version root that carries a capability Codex
16
+ * reads: each manifest location, the default hooks directory and a root hooks
17
+ * file, the MCP and connector declarations, and the default command and agent
18
+ * directories. Spelled in lowercase; compare names through
19
+ * codexPluginRootCapabilityEntry so a case-insensitive file system cannot alias
20
+ * one. */
21
+ export declare const CODEX_PLUGIN_ROOT_CAPABILITY_ENTRIES: readonly string[];
22
+ /** Case-insensitive comparison form. Upper- then lower-casing also folds the
23
+ * Kelvin sign, long s and dotless i onto their ASCII letters, so a name a
24
+ * case-insensitive file system could open as a capability entry folds onto it. */
25
+ export declare function foldCodexPluginEntryName(name: string): string;
26
+ /** The lowercase CODEX_PLUGIN_ROOT_CAPABILITY_ENTRIES member a directory entry
27
+ * name denotes, matched without regard to case, or null. */
28
+ export declare function codexPluginRootCapabilityEntry(name: string): string | null;
29
+ /** Whether a directory entry name is a skill document (`SKILL.md`), matched
30
+ * without regard to case. */
31
+ export declare function isCodexSkillDocumentName(name: string): boolean;
@@ -0,0 +1,5 @@
1
+ export declare function skillsShellArgument(value: string): string;
2
+ /** Set every supported URL alias consistently for this invocation only. */
3
+ export declare function skillsApiUrlEnvironment(origin: string): string;
4
+ /** Keep copied CLI commands on the credential profile selected by CLI or environment. */
5
+ export declare function skillsProfileCommand(command: string, env?: Record<string, string | undefined>, origin?: string): string;
@@ -134,7 +134,7 @@ export interface LocalSkillsFleet {
134
134
  }
135
135
  export type SkillsFleet = HostedSkillsFleet | LocalSkillsFleet;
136
136
  /** Machine-readable reasons a hosted resolution was refused. */
137
- export type SkillsFleetErrorCode = "MISSING_API_CREDENTIAL" | "INVALID_API_URL" | "INSTANCE_CREDENTIAL_MISMATCH" | "GATEWAY_AUTH_UNAVAILABLE";
137
+ export type SkillsFleetErrorCode = "MISSING_API_CREDENTIAL" | "INVALID_API_URL" | "INSTANCE_CREDENTIAL_MISMATCH" | "GATEWAY_AUTH_UNAVAILABLE" | "STORED_CREDENTIAL_PROTECTED";
138
138
  /**
139
139
  * A configured install could not produce a usable hosted client.
140
140
  *
@@ -336,14 +336,17 @@ export interface SignInTarget {
336
336
  source: string;
337
337
  /** Set when an already-resolving credential decided the origin: its source NAME, never a value. */
338
338
  credentialSource?: string;
339
+ /** A captured sign-in carries this through approval and persistence. */
340
+ unchanged?: () => void;
339
341
  }
340
342
  /**
341
343
  * The refusal for a sign-in that would target the internal gateway, which has
342
- * no sign-in service — or null. It names what to unset or remove, and never
343
- * suggests pointing this machine at the product server while an internal
344
- * credential is still configured. Nothing is sent either way.
344
+ * no sign-in service — or null. Use a separate profile for product sign-in,
345
+ * preserving the existing fleet configuration. Nothing is sent either way.
345
346
  */
346
347
  export declare function gatewaySignInRefusal(target: SignInTarget): SkillsFleetCredentialError | null;
348
+ /** Refuse before sign-in traffic can replace a selected fleet key or vault reference. */
349
+ export declare function assertSkillsSignInCredentialReplaceable(env?: Env, profile?: string): void;
347
350
  /**
348
351
  * The authority a SIGN-IN talks to: `skills login`, `skills auth login` /
349
352
  * `signup`, and the TUI `/login`. Resolved on its own because signing in is how
@@ -354,7 +357,8 @@ export declare function gatewaySignInRefusal(target: SignInTarget): SkillsFleetC
354
357
  * 1. `--url <origin>` — an explicit choice for this sign-in. It is refused when
355
358
  * an outranking URL (the environment or the Keychain) names a different
356
359
  * instance, because the key it mints would be shadowed the moment it is
357
- * saved. A URL in the credentials file is what a sign-in replaces.
360
+ * saved. A URL in the credentials file is replaceable only when it does
361
+ * not protect a fleet credential or vault reference.
358
362
  * 2. a configured URL — environment, profile or credentials file, Keychain.
359
363
  * 3. the instance an already-stored credential belongs to. A legacy internal
360
364
  * key with no recorded URL belongs to the fleet gateway, so a machine that
@@ -366,6 +370,8 @@ export declare function gatewaySignInRefusal(target: SignInTarget): SkillsFleetC
366
370
  * Nothing here sends a request.
367
371
  */
368
372
  export declare function resolveSkillsSignInOrigin(env?: Env, options?: SkillsFleetOptions, explicitUrl?: string): SignInTarget;
373
+ /** Retain the selected credential's exact file state across a multi-step sign-in. */
374
+ export declare function captureSkillsSignInTarget(env?: Env, options?: SkillsFleetOptions, explicitUrl?: string): SignInTarget;
369
375
  /**
370
376
  * The hosted resolution, or throw. Use on every auth and write path.
371
377
  *
@@ -1,6 +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
+ import { type CodexAdmissionReceipt, type CodexCorpusWriteOptions } from "./codex-corpus-write.js";
4
4
  export declare const CONFLICTS_LEDGER_FILE = "conflicts.json";
5
5
  export declare const ROLLBACK_DIRNAME = "rollback";
6
6
  export interface HomeSkillEntry {
@@ -36,7 +36,7 @@ export interface AdoptionOptions extends PortableSkillOptions, CodexCorpusWriteO
36
36
  /** Write markers and the conflicts ledger. Without it, scan only. */
37
37
  apply?: boolean;
38
38
  }
39
- export interface AdoptionResult extends AdoptionScan {
39
+ export interface AdoptionResult extends AdoptionScan, CodexAdmissionReceipt {
40
40
  applied: boolean;
41
41
  /** Rollback record path, when markers were written. */
42
42
  rollbackFile?: string;
@@ -48,7 +48,7 @@ export interface RollbackMarker {
48
48
  hash: string;
49
49
  marker: SyncMarker;
50
50
  }
51
- export interface RollbackRecord {
51
+ export interface RollbackRecord extends CodexAdmissionReceipt {
52
52
  version: 1;
53
53
  mode: "adopt" | "prune";
54
54
  timestamp: string;
@@ -58,7 +58,7 @@ export interface PruneCandidate extends RollbackMarker {
58
58
  /** The agent home skills directory. */
59
59
  home: string;
60
60
  }
61
- export interface PruneResult {
61
+ export interface PruneResult extends CodexAdmissionReceipt {
62
62
  candidates: PruneCandidate[];
63
63
  pruned: number;
64
64
  dryRun: boolean;
@@ -78,7 +78,7 @@ export declare function scanUnmarkedHomes(options?: AdoptionOptions): AdoptionSc
78
78
  * every directory removed (mode "prune"), so both operations are auditable
79
79
  * from a single machine-readable file. Deleted resource bytes are not stored.
80
80
  */
81
- export declare function writeRollbackRecord(mode: "adopt" | "prune", entries: RollbackMarker[], appDir?: string): string;
81
+ export declare function writeRollbackRecord(mode: "adopt" | "prune", entries: RollbackMarker[], appDir?: string, admission?: CodexAdmissionReceipt): string;
82
82
  /**
83
83
  * Adopt unmarked home skills whose content exactly matches the canonical
84
84
  * corpus. Without `apply` this is a pure scan; with `apply` it writes one
@@ -1,7 +1,7 @@
1
- import { type CodexCorpusWriteOptions } from "./codex-corpus-write.js";
1
+ import { type CodexAdmissionReceipt, type CodexAdmissionRecordOptions, type CodexCorpusWriteOptions } from "./codex-corpus-write.js";
2
2
  import { type SkillMeta } from "./registry.js";
3
3
  import { type ProjectSkillPin } from "./project-state.js";
4
- export interface InstallResult {
4
+ export interface InstallResult extends CodexAdmissionReceipt {
5
5
  skill: string;
6
6
  success: boolean;
7
7
  error?: string;
@@ -108,5 +108,7 @@ export declare function installSkillForAgent(name: string, options: AgentInstall
108
108
  overwrite?: boolean;
109
109
  dryRun?: boolean;
110
110
  }, generateSkillMd?: (name: string) => string | null): InstallResult;
111
- export declare function removeSkillForAgent(name: string, options: AgentInstallOptions): boolean;
111
+ /** Returns only whether it removed; pass `onCodexAdmission` to receive the admission
112
+ * record. Without it, a Codex home without native admission refuses as before. */
113
+ export declare function removeSkillForAgent(name: string, options: AgentInstallOptions & CodexAdmissionRecordOptions): boolean;
112
114
  export {};
@@ -16,4 +16,6 @@ export declare function readSkillsInstanceMetadata(file: string): {
16
16
  * profile (nothing stored yet, so it may sign in) from a broken selection.
17
17
  */
18
18
  export declare function skillsFileHasCredential(file: string): boolean;
19
+ /** A stored vault reference must survive interactive sign-in unchanged. */
20
+ export declare function skillsFileHasVaultReference(file: string): boolean;
19
21
  export {};
@@ -119,7 +119,7 @@ export declare function clearPendingDeviceSignIn(env?: Env, origin?: string): vo
119
119
  * Store the key a sign-in produced, bound to the instance that issued it.
120
120
  * A session-only answer (a token, no key) mints a CLI key first.
121
121
  */
122
- export declare function persistSignIn(result: SignInResult, origin: string, env?: Env, issuedBy?: StoredKeyIssuer): Promise<string>;
122
+ export declare function persistSignIn(result: SignInResult, origin: string, env?: Env, issuedBy?: StoredKeyIssuer, assertUnchanged?: () => void): Promise<string>;
123
123
  /**
124
124
  * What happened to server-side revocation.
125
125
  *
@@ -49,7 +49,7 @@ var __require = import.meta.require;
49
49
  // src/runtime-prerequisites.ts
50
50
  import { isAbsolute as isAbsolute7 } from "path";
51
51
  // package.json
52
- var version = "0.10.75";
52
+ var version = "0.10.77";
53
53
  var package_default = {
54
54
  name: "@hasna/skills",
55
55
  version,