@hasna/skills 0.3.0 → 0.5.0
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 +269 -14
- package/bin/index.js +7835 -5440
- package/bin/mcp.js +2040 -589
- package/bin/migrate.js +148 -40
- package/bin/server.js +66 -87
- package/bin/worker.js +42 -75
- package/dist/admin-contract.d.ts +37 -19
- package/dist/admin-contract.js +1 -1
- package/dist/cli/cli.test-utils.d.ts +10 -8
- package/dist/cli/commands/customer-profile.d.ts +2 -0
- package/dist/cli/commands/customer-verification.d.ts +5 -0
- package/dist/cli/commands/remote-account.d.ts +7 -0
- package/dist/cli/commands/tool-primitives.d.ts +1 -1
- package/dist/cli/commands/workspace-member-mutations.d.ts +2 -0
- package/dist/cli/commands/workspace-members.d.ts +2 -0
- package/dist/cli/env-assignment.d.ts +9 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1369 -349
- package/dist/lib/agent-sync.d.ts +13 -8
- package/dist/lib/api-url.d.ts +4 -3
- package/dist/lib/app-home.d.ts +0 -1
- package/dist/lib/auth-store.d.ts +1 -1
- package/dist/lib/client-types.d.ts +75 -0
- package/dist/lib/credential-state.d.ts +12 -0
- package/dist/lib/fleet-credentials.d.ts +49 -17
- package/dist/lib/home-adoption.d.ts +2 -0
- package/dist/lib/home-census.d.ts +3 -1
- package/dist/lib/instance-credentials.d.ts +13 -0
- package/dist/lib/local-opt-in.d.ts +24 -0
- package/dist/lib/mcp-contracts.d.ts +4 -0
- package/dist/lib/portable-skills-files.d.ts +10 -2
- package/dist/lib/portable-skills-types.d.ts +2 -0
- package/dist/lib/read-access.d.ts +83 -0
- package/dist/lib/remote-account.d.ts +42 -0
- package/dist/lib/remote-auth.d.ts +46 -0
- package/dist/lib/remote-client.d.ts +90 -6
- package/dist/lib/remote-customer-operations.d.ts +106 -0
- package/dist/lib/remote-files.d.ts +21 -0
- package/dist/lib/remote-profile.d.ts +26 -0
- package/dist/lib/remote-registry.d.ts +7 -3
- package/dist/lib/remote-workspace.d.ts +76 -0
- package/dist/lib/run-routing.d.ts +1 -0
- package/dist/lib/run-state.d.ts +3 -0
- package/dist/lib/skillinfo.d.ts +1 -1
- package/dist/mcp/helpers.d.ts +22 -0
- package/dist/mcp/index.d.ts +16 -0
- package/dist/mcp/remote-customer-tools.d.ts +2 -0
- package/dist/sdk/governance-store.d.ts +1 -0
- package/dist/sdk/index.d.ts +8 -1
- package/dist/sdk/index.js +1994 -416
- package/dist/sdk/outputs.d.ts +0 -11
- package/dist/sdk/runs.d.ts +5 -5
- package/dist/storage.js +6 -40
- package/docs/skill-standard.md +30 -2
- package/package.json +7 -6
package/dist/sdk/outputs.d.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Outputs governance: default-private visibility, pre-persistence redaction,
|
|
3
|
-
* hard size limits, finite TTLs, and immutable deletion receipts.
|
|
4
|
-
*
|
|
5
|
-
* The writer is the one gate every artifact passes at write time: visibility is
|
|
6
|
-
* stamped from the governance default, redaction runs BEFORE the bytes are
|
|
7
|
-
* stored, the per-output and per-run-total caps are checked before the row is
|
|
8
|
-
* written, and expiresAt is computed from the configured TTL. The expiry sweep
|
|
9
|
-
* is the retention half: artifacts whose expiresAt is in the past are deleted
|
|
10
|
-
* (row + object) and every deletion lands one append-only receipt.
|
|
11
|
-
*/
|
|
12
1
|
import type { ArtifactBody, ObjectStore } from "./storage.js";
|
|
13
2
|
import type { GovernanceStore, LifecycleReceipt } from "./governance-store.js";
|
|
14
3
|
import { type OutputGovernanceConfig } from "./governance.js";
|
package/dist/sdk/runs.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* `FOR UPDATE SKIP LOCKED`, SQLite `BEGIN IMMEDIATE` plus a conditional claim) — no
|
|
12
12
|
* business logic is duplicated here.
|
|
13
13
|
*/
|
|
14
|
-
import { z } from "zod";
|
|
14
|
+
import { z } from "zod/v3";
|
|
15
15
|
import { REMOTE_SKILL_RUN_CONTRACT_VERSION, normalizeRemoteSkillRunContract, type RemoteSkillRunContract } from "../lib/remote-run-contract.js";
|
|
16
16
|
import type { ApiPrincipal, CreateRunInput, ServerRunRecord, ServerRunStatus, SkillsProductStore } from "../server/types.js";
|
|
17
17
|
import type { OfflineGate } from "./offline.js";
|
|
@@ -90,7 +90,7 @@ export declare const runTerminalSchema: z.ZodObject<{
|
|
|
90
90
|
status: z.ZodEnum<["succeeded", "failed", "cancelled", "expired"]>;
|
|
91
91
|
completedAt: z.ZodString;
|
|
92
92
|
}, "strip", z.ZodTypeAny, {
|
|
93
|
-
status: "cancelled" | "failed" | "
|
|
93
|
+
status: "cancelled" | "failed" | "expired" | "succeeded";
|
|
94
94
|
skill: string;
|
|
95
95
|
completedAt: string;
|
|
96
96
|
contractVersion: 1;
|
|
@@ -98,7 +98,7 @@ export declare const runTerminalSchema: z.ZodObject<{
|
|
|
98
98
|
leaseGeneration: number;
|
|
99
99
|
attemptId: string;
|
|
100
100
|
}, {
|
|
101
|
-
status: "cancelled" | "failed" | "
|
|
101
|
+
status: "cancelled" | "failed" | "expired" | "succeeded";
|
|
102
102
|
skill: string;
|
|
103
103
|
completedAt: string;
|
|
104
104
|
contractVersion: 1;
|
|
@@ -162,7 +162,7 @@ export declare const runProtocolSchema: z.ZodDiscriminatedUnion<"status", [z.Zod
|
|
|
162
162
|
status: z.ZodEnum<["succeeded", "failed", "cancelled", "expired"]>;
|
|
163
163
|
completedAt: z.ZodString;
|
|
164
164
|
}, "strip", z.ZodTypeAny, {
|
|
165
|
-
status: "cancelled" | "failed" | "
|
|
165
|
+
status: "cancelled" | "failed" | "expired" | "succeeded";
|
|
166
166
|
skill: string;
|
|
167
167
|
completedAt: string;
|
|
168
168
|
contractVersion: 1;
|
|
@@ -170,7 +170,7 @@ export declare const runProtocolSchema: z.ZodDiscriminatedUnion<"status", [z.Zod
|
|
|
170
170
|
leaseGeneration: number;
|
|
171
171
|
attemptId: string;
|
|
172
172
|
}, {
|
|
173
|
-
status: "cancelled" | "failed" | "
|
|
173
|
+
status: "cancelled" | "failed" | "expired" | "succeeded";
|
|
174
174
|
skill: string;
|
|
175
175
|
completedAt: string;
|
|
176
176
|
contractVersion: 1;
|
package/dist/storage.js
CHANGED
|
@@ -119,12 +119,7 @@ import { homedir } from "os";
|
|
|
119
119
|
import { join, resolve } from "path";
|
|
120
120
|
import { homedir as pathsResolverHomedir } from "os";
|
|
121
121
|
import { join as pathsResolverJoin } from "path";
|
|
122
|
-
var
|
|
123
|
-
config: "HASNA_CONFIG_HOME",
|
|
124
|
-
data: "HASNA_DATA_HOME",
|
|
125
|
-
state: "HASNA_STATE_HOME",
|
|
126
|
-
cache: "HASNA_CACHE_HOME"
|
|
127
|
-
};
|
|
122
|
+
var PATHS_RESOLVER_DATA_ENV = "HASNA_DATA_HOME";
|
|
128
123
|
var PATHS_RESOLVER_APP_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
129
124
|
function pathsResolverAssertApp(app) {
|
|
130
125
|
if (typeof app !== "string" || app.length === 0) {
|
|
@@ -134,48 +129,19 @@ function pathsResolverAssertApp(app) {
|
|
|
134
129
|
throw new TypeError(`paths: invalid app slug "${app}" \u2014 expected lowercase kebab-case ([a-z0-9]+(-[a-z0-9]+)*)`);
|
|
135
130
|
}
|
|
136
131
|
}
|
|
137
|
-
function
|
|
138
|
-
if (!Object.keys(PATHS_RESOLVER_KIND_ENV).includes(kind)) {
|
|
139
|
-
throw new TypeError(`paths: invalid path kind "${kind}" \u2014 expected one of ${Object.keys(PATHS_RESOLVER_KIND_ENV).join(", ")}`);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function pathsResolverBaseDir(kind, options) {
|
|
143
|
-
pathsResolverAssertKind(kind);
|
|
132
|
+
function pathsResolverDataBaseDir(options) {
|
|
144
133
|
const env = options.env ?? process.env;
|
|
145
|
-
const override = env[
|
|
134
|
+
const override = env[PATHS_RESOLVER_DATA_ENV];
|
|
146
135
|
if (typeof override === "string" && override.length > 0)
|
|
147
136
|
return override;
|
|
148
137
|
const home = options.home ?? pathsResolverHomedir();
|
|
149
138
|
const platform = options.platform ?? process.platform;
|
|
150
|
-
|
|
151
|
-
switch (kind) {
|
|
152
|
-
case "config":
|
|
153
|
-
case "data":
|
|
154
|
-
return pathsResolverJoin(home, "Library", "Application Support", "Hasna");
|
|
155
|
-
case "cache":
|
|
156
|
-
return pathsResolverJoin(home, "Library", "Caches", "Hasna");
|
|
157
|
-
case "state":
|
|
158
|
-
return pathsResolverJoin(home, "Library", "Logs", "Hasna");
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
switch (kind) {
|
|
162
|
-
case "config":
|
|
163
|
-
return pathsResolverJoin(home, ".config", "hasna");
|
|
164
|
-
case "data":
|
|
165
|
-
return pathsResolverJoin(home, ".local", "share", "hasna");
|
|
166
|
-
case "state":
|
|
167
|
-
return pathsResolverJoin(home, ".local", "state", "hasna");
|
|
168
|
-
case "cache":
|
|
169
|
-
return pathsResolverJoin(home, ".cache", "hasna");
|
|
170
|
-
}
|
|
139
|
+
return platform === "darwin" ? pathsResolverJoin(home, "Library", "Application Support", "Hasna") : pathsResolverJoin(home, ".local", "share", "hasna");
|
|
171
140
|
}
|
|
172
|
-
function
|
|
141
|
+
function dataDir(options) {
|
|
173
142
|
pathsResolverAssertApp(options.app);
|
|
174
143
|
const appSegment = options.internal === true ? pathsResolverJoin("internal", options.app) : options.app;
|
|
175
|
-
return pathsResolverJoin(
|
|
176
|
-
}
|
|
177
|
-
function dataDir(options) {
|
|
178
|
-
return pathsResolverResolve("data", options);
|
|
144
|
+
return pathsResolverJoin(pathsResolverDataBaseDir(options), appSegment);
|
|
179
145
|
}
|
|
180
146
|
var DATA_DIR_ENV = "HASNA_SKILLS_DIR";
|
|
181
147
|
var HASNA_SKILLS_HOME_ENV = "HASNA_SKILLS_HOME";
|
package/docs/skill-standard.md
CHANGED
|
@@ -298,6 +298,7 @@ them alone by design. Adoption is the migration mode for that population:
|
|
|
298
298
|
```bash
|
|
299
299
|
skills sync --adopt # dry-run: hash unmarked home skills vs the corpus
|
|
300
300
|
skills sync --adopt --apply # write markers for exact matches; ledger the rest
|
|
301
|
+
skills sync my-skill --adopt --for codex --source ./skills --apply
|
|
301
302
|
```
|
|
302
303
|
|
|
303
304
|
Each unmarked home skill's `SKILL.md` is hashed (line endings normalized,
|
|
@@ -312,6 +313,26 @@ Each unmarked home skill's `SKILL.md` is hashed (line endings normalized,
|
|
|
312
313
|
Every written marker is listed in a rollback record under
|
|
313
314
|
`~/.hasna/skills/rollback/`. Nothing is ever deleted by adoption.
|
|
314
315
|
|
|
316
|
+
### Managed home ownership
|
|
317
|
+
|
|
318
|
+
Ordinary sync updates an existing directory only when its regular
|
|
319
|
+
`.hasna-skills.json` sidecar contains `managedBy: "@hasna/skills"`. Missing,
|
|
320
|
+
foreign or malformed markers leave the directory unmanaged. A directory with
|
|
321
|
+
`SKILL.md` can still be explicitly replaced using `skills sync --force`;
|
|
322
|
+
an unmanaged directory without `SKILL.md` is always preserved. Preview mode
|
|
323
|
+
uses the same ownership decision and writes nothing.
|
|
324
|
+
|
|
325
|
+
The library's `removeManagedAgentSkill` and `removeSkillForAgent` follow the same
|
|
326
|
+
exact-owner check, including project and global agent installs. They return
|
|
327
|
+
`false` and preserve a directory without valid Skills ownership; neither has a
|
|
328
|
+
force override.
|
|
329
|
+
|
|
330
|
+
Remote tombstones also preserve directories without exact Skills ownership.
|
|
331
|
+
Registry reconciliation accepts a marker's baseline hash and version only when
|
|
332
|
+
that same marker names the Skills owner. Foreign or invalid markers cannot choose
|
|
333
|
+
which divergent copy wins; the existing conflict policy and explicit overrides
|
|
334
|
+
still apply.
|
|
335
|
+
|
|
315
336
|
### Home drift census
|
|
316
337
|
|
|
317
338
|
```bash
|
|
@@ -324,5 +345,12 @@ Compares each existing agent home against the canonical corpus and lists
|
|
|
324
345
|
candidates, not drift. `skills diff <name>` and `skills outdated` use the same
|
|
325
346
|
home-vs-canonical comparison; the pinned-skill version comparison remains as a
|
|
326
347
|
subset. `skills sync --prune [--apply]` removes only marked-and-stray dirs,
|
|
327
|
-
recording each removal in the rollback store before it happens.
|
|
328
|
-
|
|
348
|
+
recording each removal in the rollback store before it happens. Adoption and
|
|
349
|
+
prune honor `--source` (then `$SKILLS_SOURCE`, then the installed cache), `--for`
|
|
350
|
+
and optional skill names. Names are normalized and must exist in the selected
|
|
351
|
+
corpus or selected agent homes; a stale prune target need not exist in the corpus.
|
|
352
|
+
Invalid selections fail before any apply write. Prune requires the marker
|
|
353
|
+
`managedBy` to be exactly `@hasna/skills`; another tool's marker never grants
|
|
354
|
+
deletion authority. Adoption also leaves every already-marked directory alone.
|
|
355
|
+
Rollback records contain identities, hashes and markers, not backups of removed
|
|
356
|
+
file content.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/skills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Skills library for AI coding agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"files": [
|
|
33
33
|
"dist/",
|
|
34
34
|
"!dist/**/*.test.d.ts",
|
|
35
|
+
"!dist/**/*.fixture.d.ts",
|
|
35
36
|
"!dist/test-preload.d.ts",
|
|
36
37
|
"!dist/platform",
|
|
37
38
|
"bin/",
|
|
@@ -57,10 +58,10 @@
|
|
|
57
58
|
"migrate": "bun run ./src/server/migrate.ts",
|
|
58
59
|
"typecheck": "tsc --noEmit",
|
|
59
60
|
"verify:release": "bun run scripts/release-guard.ts",
|
|
61
|
+
"verify:consumer-types": "bun run scripts/consumer-types.ts",
|
|
60
62
|
"prepare": "bun run build:js",
|
|
61
|
-
"prepack": "bun run build && bun run verify:release",
|
|
62
|
-
"prepublishOnly": "bun run typecheck && bun run test"
|
|
63
|
-
"postinstall": "mkdir -p $HOME/.hasna/skills/custom 2>/dev/null || true"
|
|
63
|
+
"prepack": "bun run build && bun run verify:release && bun run verify:consumer-types",
|
|
64
|
+
"prepublishOnly": "bun run typecheck && bun run test"
|
|
64
65
|
},
|
|
65
66
|
"keywords": [
|
|
66
67
|
"skills",
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
"author": "Hasna",
|
|
82
83
|
"license": "Apache-2.0",
|
|
83
84
|
"devDependencies": {
|
|
85
|
+
"@hasna/contracts": "1.0.2",
|
|
84
86
|
"@types/bun": "1.3.14",
|
|
85
87
|
"@types/node": "25.2.3",
|
|
86
88
|
"@types/react": "^18.2.0",
|
|
@@ -92,8 +94,7 @@
|
|
|
92
94
|
"dependencies": {
|
|
93
95
|
"@aws-sdk/client-ecs": "^3.1079.0",
|
|
94
96
|
"@aws-sdk/client-s3": "^3.1079.0",
|
|
95
|
-
"@hasna/
|
|
96
|
-
"@hasna/events": "0.1.16",
|
|
97
|
+
"@hasna/events": "0.1.18",
|
|
97
98
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
98
99
|
"chalk": "^5.3.0",
|
|
99
100
|
"commander": "^12.1.0",
|