@hasna/skills 0.5.11 → 0.6.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.
Files changed (49) hide show
  1. package/README.md +95 -53
  2. package/bin/index.js +17696 -30169
  3. package/bin/mcp.js +8358 -22504
  4. package/bin/migrate.js +108 -6
  5. package/bin/server.js +5827 -565
  6. package/bin/worker.js +489 -135
  7. package/dist/admin-contract.d.ts +13 -13
  8. package/dist/admin-contract.js +28 -47
  9. package/dist/cli/commands/agent-integration.d.ts +2 -0
  10. package/dist/cli/commands/context.d.ts +19 -0
  11. package/dist/cli/commands/install.d.ts +1 -0
  12. package/dist/cli/commands/profile-sync.d.ts +10 -0
  13. package/dist/cli/commands/profiles.d.ts +2 -0
  14. package/dist/index.d.ts +5 -0
  15. package/dist/index.js +5406 -19111
  16. package/dist/lib/agent-integration.d.ts +74 -0
  17. package/dist/lib/cloud-executions.d.ts +39 -0
  18. package/dist/lib/managed-policy.d.ts +6 -0
  19. package/dist/lib/profile-admin.d.ts +4 -0
  20. package/dist/lib/profile-client.d.ts +19 -0
  21. package/dist/lib/read-access.d.ts +3 -23
  22. package/dist/lib/selected-document.d.ts +6 -0
  23. package/dist/lib/selected-run.d.ts +31 -0
  24. package/dist/lib/selection-cache.d.ts +40 -0
  25. package/dist/lib/selection-resolver.d.ts +75 -0
  26. package/dist/lib/skill-context.d.ts +43 -0
  27. package/dist/lib/skillinfo.d.ts +2 -0
  28. package/dist/sdk/execution/dispatchers/ecs.d.ts +8 -0
  29. package/dist/sdk/index.d.ts +2 -0
  30. package/dist/sdk/index.js +9911 -8305
  31. package/dist/server/app.d.ts +7 -1
  32. package/dist/server/artifact-storage.d.ts +7 -10
  33. package/dist/server/auth.d.ts +2 -0
  34. package/dist/server/config.d.ts +2 -0
  35. package/dist/server/profile-api.d.ts +3 -0
  36. package/dist/server/runtime-api.d.ts +31 -0
  37. package/dist/server/runtime-policy.d.ts +25 -0
  38. package/dist/server/runtime-store.d.ts +73 -0
  39. package/dist/server/runtime-worker.d.ts +19 -0
  40. package/dist/server/selection-store.d.ts +39 -0
  41. package/dist/server/sqlite-store.d.ts +2 -0
  42. package/dist/server/store.d.ts +3 -0
  43. package/dist/server/types.d.ts +3 -0
  44. package/dist/types/skill-selection.d.ts +41 -0
  45. package/migrations/postgres/0007_skill_profiles.sql +19 -0
  46. package/migrations/postgres/0008_skill_runtime.sql +14 -0
  47. package/migrations/sqlite/0007_skill_profiles.sql +19 -0
  48. package/migrations/sqlite/0008_skill_runtime.sql +14 -0
  49. package/package.json +1 -1
package/README.md CHANGED
@@ -15,69 +15,112 @@ Requires [Bun](https://bun.sh/) 1.3+.
15
15
 
16
16
  ## Quick Start
17
17
 
18
- ```bash
19
- # Browse skills interactively
20
- skills
21
-
22
- # Sign in. With a credential and no URL, the CLI talks to the fleet gateway;
23
- # point it at your own instance first if you run one.
24
- skills setup --api-url https://skills.example.com # only for your own instance
25
- skills auth login --api-key "$HASNA_SKILLS_API_KEY"
26
-
27
- # With no credential and no URL, skills simply run on this machine
28
- skills list
18
+ Configure a Skills API credential using `skills auth login`. The default authority
19
+ is `https://api.hasna.com/skills`; versioned requests use `/skills/v1`.
20
+ Use `skills setup --api-url https://skills.example.com` for your own server.
29
21
 
30
- # Optionally pin a skill preference in this project
31
- skills pin logo-design
22
+ A workspace administrator creates a shared profile selecting published skills by
23
+ exact version and SHA-256 digest. Consumers sync that profile into a verified
24
+ Skills cache, then load instructions through the CLI:
32
25
 
33
- # Register the Skills MCP server with every supported agent
34
- skills setup agents
35
-
36
- # See what a skill needs
37
- skills info logo-design
26
+ ```bash
27
+ skills list --json
28
+ skills profiles show default --json
29
+ skills sync --selection-profile default --json
30
+ skills load release-notes
31
+ skills context 'Prepare release notes' --json
32
+
33
+ # Preview agent configuration, then install hooks with recoverable backups.
34
+ skills hook install --agent all --selection-profile default --json
35
+ skills hook install --agent all --selection-profile default --apply --json
36
+
37
+ # Inventory native copies, then archive managed copies outside agent discovery.
38
+ skills migrate native --json
39
+ skills migrate native --apply --json
40
+ ```
38
41
 
39
- # Server-owned (premium) skills run through the configured Skills API
40
- skills run <server-owned-skill> --brief "minimal geometric owl mark"
42
+ Hook installation enables CLI loading on the station, denies Claude's native
43
+ Skill tool, and disables discovered Codex native skills. It preserves unrelated
44
+ hooks and configuration. Use `--include-vendor` to include Codex system and
45
+ cached plugin skills. Project-local skills require a project discovery audit. Native
46
+ exports are refused while this policy is active. Archives preserve full skill
47
+ directories; `--include-unmanaged` explicitly includes user-authored copies.
48
+ Archive receipts and configuration backups live under the Skills data directory.
49
+
50
+ If your home `.claude` or `.codex` directory intentionally links to another
51
+ directory within your home, add `--allow-root-aliases` to hook installation and
52
+ native migration. The plan records and rechecks the exact link and target;
53
+ links inside skill contents or configuration files remain refused.
54
+
55
+ At session start, the hook authenticates and refreshes the profile. Prompt hooks
56
+ select complete skill instructions from that verified cache using explicit
57
+ `$skill` references, profile keywords, paths and always-required selections.
58
+ A session retains its selected versions; compaction restores loaded instructions,
59
+ and subagents inherit the parent's selection. Instructions that exceed the
60
+ context budget produce an explicit `skills load` command. A hook never executes
61
+ a skill. Cached use is explicit and expires after 24 hours; authentication
62
+ failures do not silently switch to a local catalog.
63
+
64
+ ## Profiles, station sync and rollback
41
65
 
42
- # Every other skill runs on this machine by default, even when an API is
43
- # configured; local skills may use your own provider keys when documented
44
- skills requires brand-style-guide
45
- OPENAI_API_KEY=... skills run brand-style-guide ./brand-notes.md
66
+ ```bash
67
+ # A writer creates a profile from a JSON selection document.
68
+ skills profiles set default --file selections.json --json
69
+ skills profiles show default --save profile-before.json --json
70
+
71
+ # Update only the revision you reviewed. Restoring a saved document rolls back
72
+ # the selection while producing a new profile revision.
73
+ skills profiles set default --file profile-next.json --if-match REVISION --json
74
+ skills profiles set default --file profile-before.json --if-match NEW_REVISION --json
75
+
76
+ # Use the same profile on another station; record exact project selections.
77
+ skills sync --selection-profile default --station station-example --json
78
+ skills sync --selection-profile default --project --json
79
+ skills sync --selection-profile default --check --json
80
+ skills station-state station-example --json
46
81
  ```
47
82
 
48
- ## Server-Side Runtime Skills
83
+ Selection documents contain a `selections` array. Each entry has `slug`,
84
+ `version`, `bundleDigest` (`sha256:` followed by 64 lowercase hex characters),
85
+ and optional `triggers` containing `keywords`, `paths`, or `always`. Profile
86
+ writes use compare-and-swap revisions. Station receipts belong to the workspace,
87
+ user and stable station ID, so rotating a key does not create a new station.
88
+ Consumers need `skills:read` and `stations:write`; profile publishers need
89
+ `skills:write`. Key scopes apply even to workspace owners.
49
90
 
50
- Premium skills run on the server. A skill is premium — server-owned — when its
51
- published contract carries the server-owned marker (`skills.runtime: "hosted"`
52
- or `skills.source: "remote" | "private-hosted"` in the skill's `package.json`).
53
- The CLI and MCP server submit server-owned skills to the configured Skills API,
54
- create local run metadata, and then expose status and artifact commands. They
55
- do not fall back to bundled local execution when auth is missing or the server
56
- runtime is unavailable.
91
+ `--selection-profile` chooses the shared skill selection. The top-level
92
+ `--profile` option chooses an isolated credential file; these are separate
93
+ settings. `HASNA_SKILLS_SELECTION_PROFILE` overrides the installed selection
94
+ profile. A project lock and an existing session keep exact versions until they
95
+ are explicitly changed or a new session starts.
57
96
 
58
- Routing is credential-driven and local is the default: a run is sent to the API
59
- only when a credential resolves (see **Credentials** below) and the skill carries
60
- the server-owned marker. Every other skill runs on this machine, whether or not
61
- a credential exists. No skill in the OSS catalog is server-owned today; the
62
- marker arrives with skills synced from a Skills API deployment. A server-owned
63
- skill run without a credential fails closed with an error naming the missing
64
- setup — it never silently runs locally.
97
+ ## Executable skills
65
98
 
66
99
  ```bash
67
- skills auth login --api-key "$HASNA_SKILLS_API_KEY"
68
- skills run <server-owned-skill> --brief "minimal geometric owl mark"
69
- skills runs status <run-id>
70
- skills exports download <run-id>
100
+ skills run --target cloud --input '{"title":"Example","content":"Hello"}' pdf-generate@0.5.2
101
+ skills executions status RUN_ID --json
102
+ skills executions download RUN_ID document.pdf --output ./document.pdf
71
103
  ```
72
104
 
73
- Browser/device-code and email-code login commands are retained for compatible
74
- deployments. A Skills deployment can bootstrap with a provisioned API key via
75
- `skills auth login --api-key`.
76
-
77
- `HASNA_SKILLS_API_KEY` is the Skills API credential. It is not a provider
78
- credential. Provider keys such as `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, or
79
- `GEMINI_API_KEY` remain supported only for free/local OSS skills whose
80
- requirements explicitly document local provider use.
105
+ Cloud execution is enabled only when the deployment configures a reviewed image
106
+ and exact bundle allowlist. The first supported lane is `pdf-generate`; arbitrary
107
+ uploaded code is not admitted. Runs capture version, bundle digest, input digest,
108
+ runtime image digest, limits and policy. The cloud worker runs in a separate
109
+ Fargate task; the skill process has no API/provider credentials, no network, a
110
+ read-only root and bounded temporary storage, execution time and output.
111
+ `GET /skills/v1/capabilities` reports whether this deployment has cloud execution
112
+ configured. Authorization and runtime availability are checked separately.
113
+
114
+ On a managed station, local execution also resolves the selected immutable
115
+ bundle. Self-contained local executables run with explicit environment references
116
+ and bounded time/output; declarations requiring isolation or dependency
117
+ preparation are refused with cloud guidance. Local execution has the station
118
+ user's filesystem privileges. Instruction skills use `skills load`.
119
+
120
+ Browser/device-code login remains available for compatible custom deployments.
121
+ The fleet gateway uses provisioned API keys. `HASNA_SKILLS_API_KEY` is a Skills
122
+ API credential, not a provider key. Provider keys such as `OPENAI_API_KEY`
123
+ are supplied only to local skills that explicitly declare them.
81
124
 
82
125
  ## Credentials
83
126
 
@@ -127,8 +170,7 @@ customer-owned instance explicitly with `HASNA_SKILLS_API_URL=https://skills.exa
127
170
  its own profile/credential; configuring one instance does not select the other.
128
171
  The OSS server accepts `/v1/...` aliases through the same handlers as its
129
172
  `/api/v1/...` routes, plus `/v1/auth/whoami` for existing API-key identity and
130
- `/v1/health` for liveness. Gateway integration is incomplete until the internal
131
- origin runs this version and passes authenticated live acceptance. Login and
173
+ `/v1/health` for liveness. Profile and runtime availability can be checked on the authenticated capabilities endpoint. Login and
132
174
  device authorization still use `/api/auth/...` on standalone instances; the
133
175
  internal gateway has no interactive login service, so these operations stop
134
176
  before transmitting account input or credentials. This is an explicit readiness gap, not support for