@hasna/skills 0.7.3 → 0.8.1
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 +161 -19
- package/bin/index.js +5321 -4850
- package/bin/mcp.js +7841 -7538
- package/bin/migrate.js +22 -60
- package/bin/server.js +73576 -20339
- package/bin/worker.js +65159 -19251
- package/dist/admin-contract.js +8 -8
- package/dist/cli/commands/recurring.d.ts +2 -0
- package/dist/index.js +2617 -2747
- package/dist/lib/canonical-json.d.ts +8 -0
- package/dist/lib/cli-mcp-parity.d.ts +1 -1
- package/dist/lib/config.d.ts +3 -23
- package/dist/lib/installer.d.ts +1 -1
- package/dist/lib/mcp-contracts.d.ts +1 -1
- package/dist/lib/portable-skills.d.ts +1 -1
- package/dist/lib/recurring-customer.d.ts +29 -0
- package/dist/lib/recurring-recovery.d.ts +82 -0
- package/dist/lib/recurring-surface.d.ts +252 -0
- package/dist/lib/registry-data/index.d.ts +1 -0
- package/dist/lib/registry-types.d.ts +2 -1
- package/dist/lib/registry.d.ts +2 -12
- package/dist/lib/release-dependencies.d.ts +3 -0
- package/dist/lib/remote-client.d.ts +13 -0
- package/dist/lib/remote-customer-operations.d.ts +1 -0
- package/dist/lib/remote-invitations.d.ts +1 -1
- package/dist/lib/remote-recurring-contract.d.ts +165 -0
- package/dist/lib/remote-recurring.d.ts +95 -0
- package/dist/lib/skill-aliases.d.ts +2 -3
- package/dist/mcp/mcp-test-client.d.ts +2 -2
- package/dist/mcp/remote-recurring-tools.d.ts +2 -0
- package/dist/sdk/executor.d.ts +5 -5
- package/dist/sdk/index.d.ts +4 -0
- package/dist/sdk/index.js +114864 -46432
- package/dist/sdk/registry.d.ts +3 -3
- package/dist/server/config.d.ts +1 -2
- package/dist/server/handlers.d.ts +5 -2
- package/dist/server/registry.d.ts +6 -3
- package/dist/server/skills-api.d.ts +6 -38
- package/dist/storage.js +5 -42
- package/package.json +3 -2
- package/dist/lib/registry-data/business-marketing.d.ts +0 -2
- package/dist/lib/registry-data/communication.d.ts +0 -2
- package/dist/lib/registry-data/content-generation.d.ts +0 -2
- package/dist/lib/registry-data/data-analysis.d.ts +0 -2
- package/dist/lib/registry-data/design-branding.d.ts +0 -2
- package/dist/lib/registry-data/development-tools.d.ts +0 -2
- package/dist/lib/registry-data/education-learning.d.ts +0 -2
- package/dist/lib/registry-data/event-management.d.ts +0 -2
- package/dist/lib/registry-data/finance-compliance.d.ts +0 -2
- package/dist/lib/registry-data/health-wellness.d.ts +0 -2
- package/dist/lib/registry-data/media-processing.d.ts +0 -2
- package/dist/lib/registry-data/productivity-organization.d.ts +0 -2
- package/dist/lib/registry-data/project-management.d.ts +0 -2
- package/dist/lib/registry-data/research-writing.d.ts +0 -2
- package/dist/lib/registry-data/science-academic.d.ts +0 -2
- package/dist/lib/registry-data/travel-lifestyle.d.ts +0 -2
- package/dist/lib/registry-data/web-browser.d.ts +0 -2
- package/dist/server/seed-bundled.d.ts +0 -20
package/README.md
CHANGED
|
@@ -13,6 +13,21 @@ bun install -g @hasna/skills
|
|
|
13
13
|
|
|
14
14
|
Requires [Bun](https://bun.sh/) 1.3+.
|
|
15
15
|
|
|
16
|
+
## Private skill catalogs
|
|
17
|
+
|
|
18
|
+
The public package provides the CLI, API, SDK, hooks, and runtime. A skill's
|
|
19
|
+
instructions and executable bundle belong to the organization that publishes
|
|
20
|
+
them. API reads require authentication and use that organization's catalog,
|
|
21
|
+
including tag filters, versions, and downloads. An empty account starts empty;
|
|
22
|
+
neither a repository checkout nor files on the server machine supply defaults.
|
|
23
|
+
Server startup and upgrades never import a bundled catalog.
|
|
24
|
+
|
|
25
|
+
Each operator can use their own compatible server and storage. S3 is optional:
|
|
26
|
+
the server supports durable SQLite or PostgreSQL and database-backed bundles
|
|
27
|
+
when no S3 bucket is configured. Publishing through an authenticated account
|
|
28
|
+
does not publish to GitHub or npm. Keep private source documents and executable
|
|
29
|
+
payloads outside public software repositories.
|
|
30
|
+
|
|
16
31
|
## Quick Start
|
|
17
32
|
|
|
18
33
|
The fleet authority is `https://api.hasna.com/skills`; versioned requests use
|
|
@@ -377,6 +392,20 @@ to be installed in the process. Every way that fetch can fail (SDK absent, vault
|
|
|
377
392
|
unreachable, item missing or empty) is terminal and exits non-zero; a pointer
|
|
378
393
|
never falls through to another tier, and never to the local corpus.
|
|
379
394
|
|
|
395
|
+
For a durable reference without a raw Skills key, the same
|
|
396
|
+
`HASNA_SKILLS_API_KEY_REF` field can be stored in the owner-only canonical or
|
|
397
|
+
selected-profile credentials file, alongside its `HASNA_SKILLS_API_URL` and
|
|
398
|
+
`HASNA_SKILLS_BOUND_API_URL`. Do not keep a literal API key in that file too.
|
|
399
|
+
The file retains its existing priority, and the reference remains bound to its
|
|
400
|
+
recorded Skills instance. Secrets needs its own working bootstrap provider;
|
|
401
|
+
this setup does not unlock a Keychain or copy a Secrets bootstrap credential.
|
|
402
|
+
If the file changes during a vault lookup, the request is refused.
|
|
403
|
+
|
|
404
|
+
An explicit `skills auth login` replaces a stored reference with the newly
|
|
405
|
+
authenticated key. `skills auth logout` removes the app's file reference, not
|
|
406
|
+
the vault item or Secrets' credential. Changing the service URL preserves the
|
|
407
|
+
reference's previous instance binding.
|
|
408
|
+
|
|
380
409
|
**The service address, in the same shape:**
|
|
381
410
|
|
|
382
411
|
`HASNA_SKILLS_API_URL` → the Keychain item `hasna.credentials.skills.api-url` →
|
|
@@ -421,8 +450,8 @@ as silent aliases one rung below the canonical names, for one release. Use the
|
|
|
421
450
|
and the bare `skills` listing all exit 1; `skills-mcp` exits 1 at startup
|
|
422
451
|
before answering `initialize` or binding a port, and each MCP data tool
|
|
423
452
|
answers `AUTH_REQUIRED` on its own;
|
|
424
|
-
- the explicit local opt-in → **local
|
|
425
|
-
|
|
453
|
+
- the explicit local opt-in → **local**, using only owned drafts and the verified
|
|
454
|
+
local cache. An empty installation has no skills. Opt in with:
|
|
426
455
|
`HASNA_SKILLS_LOCAL=1` (alias `SKILLS_LOCAL=1`). It prints one line saying
|
|
427
456
|
"local mode" on stderr. A configured environment always outranks the opt-in:
|
|
428
457
|
with an authority or credential in the environment, `HASNA_SKILLS_LOCAL` is
|
|
@@ -439,7 +468,7 @@ of app folders, and `XDG_CONFIG_HOME` is not consulted at all.
|
|
|
439
468
|
|---|---|
|
|
440
469
|
| `HASNA_SKILLS_API_KEY` | The API key (tier 5 of the ladder). The silent alias `SKILLS_API_KEY` is accepted for one release. |
|
|
441
470
|
| `HASNA_SKILLS_API_URL` | The Skills API origin (HTTPS, or loopback HTTP). The silent alias `SKILLS_API_URL` is accepted for one release. |
|
|
442
|
-
| `HASNA_SKILLS_LOCAL` | Explicit unhosted opt-in: run on this machine against the
|
|
471
|
+
| `HASNA_SKILLS_LOCAL` | Explicit unhosted opt-in: run on this machine against owned drafts and the verified cache when no authority is configured. Any non-blank value (`1`). Alias `SKILLS_LOCAL`. Ignored whenever an authority or credential variable IS set. |
|
|
443
472
|
| `HASNA_SKILLS_API_KEY_OVERRIDE` | Deliberate tier-2 key that outranks every store. |
|
|
444
473
|
| `HASNA_SKILLS_API_KEY_REF` | Deliberate tier-2 vault-item pointer (resolved through `@hasna/secrets`). |
|
|
445
474
|
| `HASNA_PROFILE` | Selects an isolated `credentials-<profile>` file (tier 1). |
|
|
@@ -460,7 +489,7 @@ of app folders, and `XDG_CONFIG_HOME` is not consulted at all.
|
|
|
460
489
|
| `skills list` | `ls` | List available skills (filter with `-c`, `--pinned`, `-t`, `--brief`) |
|
|
461
490
|
| `skills search <query>` | `s` | Search by name, description, or tags |
|
|
462
491
|
| `skills info <name>` | | Show metadata, env vars, and system dependencies |
|
|
463
|
-
| `skills show <name>` | | Show
|
|
492
|
+
| `skills show <name>` | | Show account or owned portable skill details |
|
|
464
493
|
| `skills docs <name>` | | Show documentation (SKILL.md > README.md > CLAUDE.md) |
|
|
465
494
|
| `skills requires <name>` | | Show env vars, system deps, and npm dependencies |
|
|
466
495
|
| `skills profiles show <id>` / `skills profiles set <id> --file <json>` | | Read an exact shared selection or update it with writer authorization |
|
|
@@ -480,7 +509,7 @@ of app folders, and `XDG_CONFIG_HOME` is not consulted at all.
|
|
|
480
509
|
| `skills runs status <run-id>` | | Poll a remote skill run |
|
|
481
510
|
| `skills exports download <run-id>` | | Download completed remote artifacts |
|
|
482
511
|
| `skills update` | | Refresh project pin metadata |
|
|
483
|
-
| `skills diff <name>` | | Compare pin metadata against the
|
|
512
|
+
| `skills diff <name>` | | Compare pin metadata against the active registry |
|
|
484
513
|
| `skills init` | | Generate `.env.example` and update `.gitignore` for pinned skills |
|
|
485
514
|
| `skills categories` | | List all categories with skill counts |
|
|
486
515
|
| `skills tags` | | List all unique tags with occurrence counts |
|
|
@@ -620,11 +649,9 @@ Stable command shapes:
|
|
|
620
649
|
|
|
621
650
|
## Remote Registry
|
|
622
651
|
|
|
623
|
-
The npm package ships no
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
whether browse/search commands read a server's registry is one fact, whether a
|
|
627
|
-
credential resolves (see [Credentials](#credentials)). To point at your own
|
|
652
|
+
The npm package ships no skill corpus. Authenticated discovery reads the
|
|
653
|
+
account catalog. Explicit local mode reads owned drafts and verified downloads.
|
|
654
|
+
A failed hosted read never substitutes local content. To point at your own
|
|
628
655
|
instance:
|
|
629
656
|
|
|
630
657
|
```bash
|
|
@@ -657,6 +684,118 @@ and version-skew contract: `docs/architecture/remote-client-pins-tags-sync.md`.
|
|
|
657
684
|
For the reusable upstream contract, see
|
|
658
685
|
`docs/architecture/reusable-skills-engine.md`.
|
|
659
686
|
|
|
687
|
+
### Recurring consent SDK
|
|
688
|
+
|
|
689
|
+
The SDK exposes `previewRecurringConsent`, `getRecurringDraft`,
|
|
690
|
+
`activateRecurringConsent`, `listRecurringConsents`, `getRecurringConsent`,
|
|
691
|
+
`listRecurringOccurrences` and `revokeRecurringConsent`. These require a server
|
|
692
|
+
that explicitly advertises the version-1 recurring capability; an unavailable
|
|
693
|
+
server raises `RemoteRecurringUnavailableError`. This client does not create
|
|
694
|
+
local schedules or enable a server policy. Use `createRemoteSkillsClient` for the
|
|
695
|
+
existing selected-profile/API binding, or construct `RemoteSkillsClient` with an
|
|
696
|
+
explicit bearer and API URL. Each operation captures that connection and all
|
|
697
|
+
inputs before asynchronous work. An optional final `RemoteWorkspaceContext`
|
|
698
|
+
restricts it to an observed user and membership; profile files are unchanged.
|
|
699
|
+
|
|
700
|
+
`RecurringRequest` carries explicit cadence, lifetime, runtime limits and credit
|
|
701
|
+
and occurrence ceilings. A preview returns immutable terms, their hash, the
|
|
702
|
+
original quote and approval deadline; its quote states that admission reprices.
|
|
703
|
+
Draft retrieval retains those values even after expiry and never refreshes the
|
|
704
|
+
deadline. Activation requires the original draft ID and `RecurringActivation`:
|
|
705
|
+
`contractVersion: 1`, its exact `acceptedTermsSha256`, the literal acceptance
|
|
706
|
+
`authorize-recurring-credit-use`, and a caller-owned idempotency key. The client
|
|
707
|
+
reads the stored draft before submitting; the server independently requires
|
|
708
|
+
current fresh human authority. Client metadata cannot grant that authority.
|
|
709
|
+
Read operations require `schedules:read`, while preview and revocation require
|
|
710
|
+
`schedules:manage`; API keys cannot activate a grant. Consent read/history/revoke
|
|
711
|
+
preserve tenant-wide control, including retained grants from other deployments.
|
|
712
|
+
|
|
713
|
+
`RemoteRecurringUnconfirmedError` means a dispatched mutation could have
|
|
714
|
+
committed. Keep its original server/account, inputs, terms hash and request key;
|
|
715
|
+
explicitly reconcile that same identity with current authority. The client never
|
|
716
|
+
retries a POST, creates a replacement key or asserts rollback. After uncertain
|
|
717
|
+
revocation, inspect the original consent and occurrences; revocation does not
|
|
718
|
+
promise cancellation of an already authorized attempt. Exact domain not-found
|
|
719
|
+
responses return `null` only for draft/consent reads. Malformed or oversized
|
|
720
|
+
responses fail closed. Pages accept 1–100 items and an opaque cursor; a large
|
|
721
|
+
terms page can exceed the 64-MiB response bound, so request a smaller page
|
|
722
|
+
explicitly. JSON input is limited to 1 MiB and 64 nesting levels. Dashboard
|
|
723
|
+
approval and server enablement remain separate from these client interfaces.
|
|
724
|
+
|
|
725
|
+
### Recurring consent from the terminal or MCP
|
|
726
|
+
|
|
727
|
+
`skills recurring` uses the same hosted SDK methods. Existing `skills schedule`
|
|
728
|
+
commands retain their local metadata and one-shot behavior. A compatible server
|
|
729
|
+
must already support recurring consent; these commands install no server policy,
|
|
730
|
+
daemon or default key scopes. Read/draft/history require `schedules:read`, and
|
|
731
|
+
preview/revocation require `schedules:manage`.
|
|
732
|
+
|
|
733
|
+
| Command | MCP tool |
|
|
734
|
+
| --- | --- |
|
|
735
|
+
| `recurring preview --request <file>` | `preview_recurring_consent` |
|
|
736
|
+
| `recurring draft <draft-id>` | `get_recurring_draft` |
|
|
737
|
+
| `recurring activate <draft-id>` | `activate_recurring_consent` |
|
|
738
|
+
| `recurring list` / `recurring get <consent-id>` | `list_recurring_consents` / `get_recurring_consent` |
|
|
739
|
+
| `recurring occurrences <consent-id>` | `list_recurring_occurrences` |
|
|
740
|
+
| `recurring revoke <consent-id> --confirm` | `revoke_recurring_consent` |
|
|
741
|
+
| `recurring recover --recovery-dir <original-directory>` | `recover_recurring_consent` |
|
|
742
|
+
| `recurring verification <draft-id> --email <email> --confirm` | `request_recurring_verification` |
|
|
743
|
+
|
|
744
|
+
Use the CLI's existing `--profile <name>` before the command, or the MCP host's
|
|
745
|
+
explicitly configured connection. Fresh approval needs an enrolled workspace
|
|
746
|
+
profile or both observed `--user-id` and `--membership-id`; those IDs restrict
|
|
747
|
+
current authority. The target, profile and credential are captured before prompts
|
|
748
|
+
and checked again before changes. No operation switches or overwrites saved
|
|
749
|
+
credentials. A normal API-key login alone cannot activate recurring spend.
|
|
750
|
+
Before requesting or verifying a code, the client checks the selected key's
|
|
751
|
+
current account email, trimming whitespace and ignoring case as the server does.
|
|
752
|
+
A different email is refused before the login endpoint can create an account.
|
|
753
|
+
|
|
754
|
+
The request file contains every explicit `RecurringRequest` field, including
|
|
755
|
+
JSON input/args, runtime and connector limits, cadence/start/expiry/grace, UTC-day
|
|
756
|
+
period, finish-authorized-attempt policy, all three credit ceilings and both
|
|
757
|
+
occurrence ceilings. No policy values are inferred. Preview and draft retrieval
|
|
758
|
+
show the original server terms/hash, quote, first due instants and approval
|
|
759
|
+
deadline. They create no run or credit reservation. Each grant adds its own
|
|
760
|
+
budget; an occurrence reprices within the approved limits.
|
|
761
|
+
|
|
762
|
+
To activate, provide `--accepted-terms <original-sha256>`,
|
|
763
|
+
`--idempotency-key <original-key>`, `--recovery-dir <new-absolute-directory>`,
|
|
764
|
+
`--email <email>` and `--confirm`. A terminal displays the complete immutable
|
|
765
|
+
draft and requires typing `authorize-recurring-credit-use`, then requests a
|
|
766
|
+
fresh code and reads it masked. For JSON or noninteractive use, also supply
|
|
767
|
+
`--acceptance authorize-recurring-credit-use --code-stdin`; request the code
|
|
768
|
+
first with `recurring verification`. Do not put the code or session in argv.
|
|
769
|
+
Cancellation/EOF does not grant consent. The server independently verifies fresh,
|
|
770
|
+
eligible, non-impersonated human authority and the original terms.
|
|
771
|
+
|
|
772
|
+
MCP activation takes the same original draft, approval object, recovery directory
|
|
773
|
+
and explicit `confirm: true`, plus account email and a fresh code. The MCP host
|
|
774
|
+
may retain supplied code arguments in its history; the masked terminal flow
|
|
775
|
+
avoids that disclosure. No tool returns or stores the resulting session. A tool
|
|
776
|
+
confirmation boolean or API key never substitutes for verified human approval.
|
|
777
|
+
|
|
778
|
+
Activation and revocation require a new recovery directory under an existing
|
|
779
|
+
canonical parent. It is created privately and contains the original server,
|
|
780
|
+
profile, account/membership, draft/hash/approval key or consent ID and attempt
|
|
781
|
+
state. It contains no bearer, OTP or raw input payload. Preserve it after errors;
|
|
782
|
+
unknown mutation outcomes exit 2 in the CLI and set MCP `isError` with
|
|
783
|
+
`outcomeUnknown: true`. Read-only `recover` never resubmits. Explicit
|
|
784
|
+
`recover --confirm` reuses the original activation key/terms and fresh approval,
|
|
785
|
+
or the same revoked consent; it never creates a replacement request. An expired
|
|
786
|
+
draft or lost current authority does not resolve an earlier unknown outcome.
|
|
787
|
+
Aliased, replaced, malformed or locked recovery directories refuse changes.
|
|
788
|
+
|
|
789
|
+
List/history expose one page (1–100 items, default 20) and the unchanged opaque
|
|
790
|
+
cursor. Consent output includes period/total reserved and settled credits,
|
|
791
|
+
admitted counts, ceilings, deployment and next due time; history includes stable
|
|
792
|
+
occurrence/run IDs, outcomes, refusal reasons and allocation state. All hosts
|
|
793
|
+
read the same server identities. Revocation reports residual authorized exposure
|
|
794
|
+
and does not promise cancellation/refund of an already authorized attempt.
|
|
795
|
+
Cancellation is separate. A lost preview response has no draft lookup key:
|
|
796
|
+
report that uncertainty and explicitly choose any new preview, without silently
|
|
797
|
+
turning it into an activation.
|
|
798
|
+
|
|
660
799
|
## Portable Skills
|
|
661
800
|
|
|
662
801
|
Portable skills live under `~/.hasna/skills/installed/<name>/` and follow the
|
|
@@ -872,7 +1011,14 @@ const run = await client.submitQuotedRun("blog-article", {}, ["--topic", "Your t
|
|
|
872
1011
|
});
|
|
873
1012
|
```
|
|
874
1013
|
|
|
875
|
-
`submitRun` remains a
|
|
1014
|
+
`submitRun` remains a compatibility transport for servers implementing the legacy
|
|
1015
|
+
submission protocol. This OSS server returns HTTP 410 (`LEGACY_EXECUTION_RETIRED`)
|
|
1016
|
+
for unversioned submissions and never queues or executes them. Use a selected,
|
|
1017
|
+
immutable executable version through `skills run <name>@<version> --target cloud`;
|
|
1018
|
+
see [versioned cloud execution](docs/architecture/cloud-execution-runtime.md).
|
|
1019
|
+
Historical run reads, logs, artifacts, and cancellation remain available.
|
|
1020
|
+
|
|
1021
|
+
On servers that implement paid submission, new integrations
|
|
876
1022
|
should use `submitQuotedRun` or `submitQuotedRunWithFiles` so capability and
|
|
877
1023
|
approval checks run before submission. Credit counts are integers; `maxCostCents`
|
|
878
1024
|
is a legacy spelling for the same credit ceiling. An optional receipt is a
|
|
@@ -1002,8 +1148,8 @@ src/
|
|
|
1002
1148
|
├── cli/index.tsx # Commander.js CLI + Ink TUI
|
|
1003
1149
|
├── mcp/index.ts # MCP server (stdio)
|
|
1004
1150
|
├── lib/
|
|
1005
|
-
│ ├── registry-data/ #
|
|
1006
|
-
│ ├── registry.ts #
|
|
1151
|
+
│ ├── registry-data/ # Empty compatibility export; no catalog content
|
|
1152
|
+
│ ├── registry.ts # Discovery over owned cache and explicit sources
|
|
1007
1153
|
│ ├── installer.ts # Project pins and disabled source-copy paths
|
|
1008
1154
|
│ ├── project-state.ts # .skills/project.json preferences
|
|
1009
1155
|
│ ├── run-state.ts # .skills/runs and .skills/exports metadata
|
|
@@ -1013,19 +1159,15 @@ src/
|
|
|
1013
1159
|
│ └── utils.ts # normalizeSkillName()
|
|
1014
1160
|
├── index.ts # Library re-exports (npm package entry)
|
|
1015
1161
|
└── *.test.ts # Test files
|
|
1016
|
-
|
|
1017
|
-
skills/ # Public skill contracts and local OSS skills
|
|
1018
|
-
├── _common/ # Shared utilities
|
|
1019
|
-
└── */ # Local skills include src/; server-executed skills expose metadata/contracts
|
|
1020
1162
|
```
|
|
1021
1163
|
|
|
1022
1164
|
### Derived counts
|
|
1023
1165
|
|
|
1024
1166
|
| Count | Value | Derived from |
|
|
1025
1167
|
|---|---|---|
|
|
1026
|
-
| Catalog skills |
|
|
1168
|
+
| Catalog skills | 0 | `SKILLS.length` (`src/lib/registry-data/`) |
|
|
1027
1169
|
| Categories | 17 | `CATEGORIES` (`src/lib/registry-types.ts`) |
|
|
1028
|
-
| MCP tools |
|
|
1170
|
+
| MCP tools | 81 | `tools/list` against a live `buildServer()` |
|
|
1029
1171
|
|
|
1030
1172
|
Every number in this table is re-derived from the source tree on each test run by
|
|
1031
1173
|
`src/lib/readme-derived-counts.test.ts`, so a drifted figure fails a test rather
|