@hasna/skills 0.10.74 → 0.10.76
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.
- package/README.md +18 -1
- package/bin/index.js +701 -341
- package/bin/mcp.js +142 -93
- package/bin/migrate.js +1 -1
- package/bin/server.js +1 -1
- package/bin/worker.js +1 -1
- package/dist/cli/stray-arguments.d.ts +29 -0
- package/dist/index.js +572 -243
- package/dist/lib/agent-codex-trust.d.ts +4 -0
- package/dist/lib/agent-integration.d.ts +3 -3
- package/dist/lib/agent-sync.d.ts +6 -4
- package/dist/lib/codex-corpus-write.d.ts +47 -6
- package/dist/lib/codex-hook-rpc.d.ts +3 -0
- package/dist/lib/home-adoption.d.ts +5 -5
- package/dist/lib/installer.d.ts +5 -3
- package/dist/lib/search.d.ts +18 -0
- package/dist/runtime-prerequisites.js +1 -1
- package/dist/sdk/index.js +630 -301
- package/package.json +1 -1
|
@@ -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. */
|
package/dist/lib/agent-sync.d.ts
CHANGED
|
@@ -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
|
-
|
|
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;
|
|
@@ -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
|
}
|
|
@@ -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
|
package/dist/lib/installer.d.ts
CHANGED
|
@@ -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
|
-
|
|
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 {};
|
package/dist/lib/search.d.ts
CHANGED
|
@@ -11,6 +11,24 @@ export declare function editDistance(a: string, b: string): number;
|
|
|
11
11
|
* Search skills by name, description, and tags using fuzzy matching.
|
|
12
12
|
*/
|
|
13
13
|
export declare function searchSkills(query: string, registry?: SkillMeta[]): SkillMeta[];
|
|
14
|
+
/**
|
|
15
|
+
* Bounded close canonical names for a refused name, strongest evidence first:
|
|
16
|
+
*
|
|
17
|
+
* 0. the exact name;
|
|
18
|
+
* 1. a hyphen-delimited containment — the candidate owns the query as a whole
|
|
19
|
+
* leading or trailing segment (`fleet-refresh` → `instructions-fleet-refresh`);
|
|
20
|
+
* 2. a multi-word token subset of the candidate;
|
|
21
|
+
* 3. the edit-distance rule that was the only signal before.
|
|
22
|
+
*
|
|
23
|
+
* Containment is what edit distance cannot see, and it is the case that cost
|
|
24
|
+
* real time: the canonical name that owns a shorter name as its trailing
|
|
25
|
+
* segment is 13 edits from the short name, so a caller naming the procedure by
|
|
26
|
+
* its last words was told the procedure did not exist (Agents Audit A27). The
|
|
27
|
+
* distance pass still runs and fills any slots containment leaves, so a
|
|
28
|
+
* distance-only miss — including every query under three characters — keeps the
|
|
29
|
+
* answer it has always had.
|
|
30
|
+
*/
|
|
31
|
+
export declare function findCloseSkillNames(query: string, names: readonly string[], maxResults?: number): string[];
|
|
14
32
|
/**
|
|
15
33
|
* Find skills with names similar to the given query (for "did you mean?" suggestions).
|
|
16
34
|
*/
|
|
@@ -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.
|
|
52
|
+
var version = "0.10.76";
|
|
53
53
|
var package_default = {
|
|
54
54
|
name: "@hasna/skills",
|
|
55
55
|
version,
|