@hasna/skills 0.4.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.
Files changed (45) hide show
  1. package/README.md +176 -5
  2. package/bin/index.js +6518 -4950
  3. package/bin/mcp.js +1173 -410
  4. package/bin/migrate.js +148 -40
  5. package/bin/server.js +53 -83
  6. package/bin/worker.js +41 -73
  7. package/dist/admin-contract.d.ts +37 -19
  8. package/dist/admin-contract.js +1 -1
  9. package/dist/cli/cli.test-utils.d.ts +10 -8
  10. package/dist/cli/commands/customer-profile.d.ts +2 -0
  11. package/dist/cli/commands/customer-verification.d.ts +5 -0
  12. package/dist/cli/commands/tool-primitives.d.ts +1 -1
  13. package/dist/cli/commands/workspace-member-mutations.d.ts +2 -0
  14. package/dist/cli/commands/workspace-members.d.ts +2 -0
  15. package/dist/cli/env-assignment.d.ts +9 -0
  16. package/dist/index.d.ts +5 -2
  17. package/dist/index.js +613 -153
  18. package/dist/lib/agent-sync.d.ts +13 -8
  19. package/dist/lib/api-url.d.ts +4 -3
  20. package/dist/lib/app-home.d.ts +0 -1
  21. package/dist/lib/client-types.d.ts +75 -0
  22. package/dist/lib/credential-state.d.ts +12 -0
  23. package/dist/lib/fleet-credentials.d.ts +41 -15
  24. package/dist/lib/home-adoption.d.ts +2 -0
  25. package/dist/lib/home-census.d.ts +3 -1
  26. package/dist/lib/local-opt-in.d.ts +24 -0
  27. package/dist/lib/portable-skills-files.d.ts +6 -2
  28. package/dist/lib/read-access.d.ts +83 -0
  29. package/dist/lib/remote-auth.d.ts +14 -0
  30. package/dist/lib/remote-client.d.ts +34 -5
  31. package/dist/lib/remote-profile.d.ts +26 -0
  32. package/dist/lib/remote-registry.d.ts +7 -3
  33. package/dist/lib/remote-workspace.d.ts +76 -0
  34. package/dist/lib/skillinfo.d.ts +1 -1
  35. package/dist/mcp/helpers.d.ts +22 -0
  36. package/dist/mcp/index.d.ts +16 -0
  37. package/dist/sdk/governance-store.d.ts +1 -0
  38. package/dist/sdk/index.d.ts +5 -2
  39. package/dist/sdk/index.js +1084 -283
  40. package/dist/sdk/outputs.d.ts +0 -11
  41. package/dist/sdk/runs.d.ts +1 -1
  42. package/dist/storage.js +6 -40
  43. package/docs/skill-standard.md +30 -2
  44. package/package.json +6 -4
  45. package/dist/lib/instance-credentials-race.fixture.d.ts +0 -1
@@ -45,7 +45,7 @@ export declare function getSkillDependencyStatus(name: string): SkillDependencyS
45
45
  */
46
46
  export declare function runSkill(name: string, args: string[], options?: {
47
47
  installed?: boolean;
48
- stdio?: "inherit" | "pipe";
48
+ stdio?: "inherit" | "pipe" | "stderr";
49
49
  env?: Record<string, string>;
50
50
  }): Promise<{
51
51
  exitCode: number;
@@ -1,3 +1,24 @@
1
+ /** The shape every tool handler returns; kept structural so registrars need no SDK type import. */
2
+ type McpToolResult = {
3
+ content: Array<{
4
+ type: "text";
5
+ text: string;
6
+ }>;
7
+ isError?: boolean;
8
+ };
9
+ /**
10
+ * Run a DATA tool behind the fleet ladder's refusal.
11
+ *
12
+ * The body is expected to go through `requireSkillsReadAccess()` /
13
+ * `getBrowseRegistry()` (lib/read-access.ts) before it reads the bundled
14
+ * catalog or the on-machine corpus. When the ladder refuses — no credential, no
15
+ * authority, no `HASNA_SKILLS_LOCAL=1` opt-in; an authority with no key; a
16
+ * deliberate selection that cannot be honoured — the refusal comes back as the
17
+ * same `AUTH_REQUIRED` result `get_run_status` already gives, never as the
18
+ * local answer. Any other failure propagates unchanged (the SDK reports it as
19
+ * a tool error with its message).
20
+ */
21
+ export declare function readSurface(body: () => Promise<McpToolResult>): Promise<McpToolResult>;
1
22
  export declare function stripNulls(obj: Record<string, unknown>): Record<string, unknown>;
2
23
  export declare function cacheGet(key: string): unknown | undefined;
3
24
  export declare function cacheSet(key: string, value: unknown): void;
@@ -24,3 +45,4 @@ export declare const TOOL_DESCRIPTIONS: Record<string, {
24
45
  description: string;
25
46
  params: string[];
26
47
  }>;
48
+ export {};
@@ -8,6 +8,22 @@
8
8
  * skills-mcp # Direct binary
9
9
  * skills-mcp --http # Streamable HTTP on 127.0.0.1:8836
10
10
  */
11
+ /**
12
+ * FAIL CLOSED AT STARTUP (owner ruling 2026-09-04, hasna/apps#1720; #1720
13
+ * validation, round 1): the MCP process resolves the fleet ladder BEFORE it
14
+ * connects any transport. With no credential, no authority and no
15
+ * `HASNA_SKILLS_LOCAL=1` opt-in it exits 1 with the ladder's one line on
16
+ * stderr — before `initialize` is answered, before an HTTP port is bound —
17
+ * mirroring the CLI, which exits 1 on the same machine. Serving the bundled
18
+ * catalog to an agent host that registered `skills-mcp` on a station without
19
+ * its credential is the false green the ruling removed. The explicit local
20
+ * opt-in starts the server and announces local mode once on stderr; a
21
+ * credential (or a vault pointer the tools complete per call) starts it hosted.
22
+ *
23
+ * Every data tool still runs the same gate per call (lib/read-access.ts), so a
24
+ * credential that disappears mid-process is refused by the next call too.
25
+ */
26
+ export declare function assertSkillsMcpConfigured(env?: Record<string, string | undefined>): void;
11
27
  /**
12
28
  * Start the Skills MCP server on stdio (newline-delimited JSON-RPC).
13
29
  *
@@ -51,6 +51,7 @@ export interface GovernanceStore {
51
51
  estimatedCents: number;
52
52
  }): Promise<CreditReservation>;
53
53
  reservationsForRun(orgId: string, runId: string): Promise<CreditReservation[]>;
54
+ /** First terminal reconciliation wins; retries return that persisted state unchanged. */
54
55
  reconcileReservation(reservationId: string, actualCents: number, status: "charged" | "released"): Promise<CreditReservation | null>;
55
56
  /** Sum of cost_cents of runs created in the given calendar month (YYYY-MM), plus un-reconciled reservations. */
56
57
  monthlySpendCents(orgId: string, monthPrefix: string): Promise<number>;
@@ -15,7 +15,7 @@
15
15
  * — the shared @hasna/contracts ladder — instead of reading an environment
16
16
  * variable of its own. See lib/fleet-credentials.ts.
17
17
  */
18
- export { MissingSkillsFleetError, SkillsFleetCredentialError, SKILLS_API_KEY_ENV, SKILLS_API_URL_ENV, SKILLS_APP, configuredSkillsApiUrl, noticeLocalSkillsMode, normalizeSkillsApiOrigin, requireSkillsApiOrigin, requireSkillsFleet, resolveSkillsApiOrigin, resolveSkillsFleet, skillsCredentialFilePath, skillsCredentialFiles, skillsCredentialOrReason, type HostedSkillsFleet, type LocalSkillsFleet, type SkillsFleet, type SkillsFleetErrorCode, type SkillsFleetOptions, } from "../lib/fleet-credentials.js";
18
+ export { MissingSkillsFleetError, SkillsFleetCredentialError, SKILLS_API_KEY_ENV, SKILLS_API_URL_ENV, SKILLS_APP, SKILLS_LOCAL_OPT_IN_ENV_KEYS, configuredSkillsApiUrl, isSkillsLocalOptIn, noticeLocalSkillsMode, normalizeSkillsApiOrigin, requireSkillsApiOrigin, requireSkillsFleet, resolveSkillsApiOrigin, resolveSkillsFleet, selectsSkillsLocalMode, skillsCredentialFilePath, skillsCredentialFiles, skillsCredentialOrReason, type HostedSkillsFleet, type LocalSkillsFleet, type SkillsFleet, type SkillsFleetErrorCode, type SkillsFleetOptions, } from "../lib/fleet-credentials.js";
19
19
  export * from "./server.js";
20
20
  export * from "./registry.js";
21
21
  export * from "./runs.js";
@@ -30,7 +30,10 @@ export * from "./events.js";
30
30
  export * from "./spend.js";
31
31
  export * from "./offline.js";
32
32
  export * from "./execution/index.js";
33
- export { RemoteSkillsClient, createRemoteSkillsClient, RemoteRequestError, RemoteRouteUnsupportedError } from "../lib/remote-client.js";
33
+ export { RemoteSkillsClient, createRemoteSkillsClient, RemoteRequestError, RemoteRouteUnsupportedError, RemoteCapabilityUnavailableError, RemoteWorkspaceMemberError } from "../lib/remote-client.js";
34
34
  export { RemoteCreditApprovalError, type RemoteRunApproval, type RemoteRunQuote, type RemoteCreditPack } from "../lib/remote-account.js";
35
35
  export { type RemoteInputFile, type RemoteInputFileDescriptor } from "../lib/remote-files.js";
36
36
  export { RemoteSkillsAuthClient, HostedApiError } from "../lib/remote-auth.js";
37
+ export type { RemoteWorkspaceMember, RemoteWorkspaceMembersPage, RemoteWorkspaceMembersOptions } from "../lib/remote-workspace.js";
38
+ export type { SetRemoteWorkspaceMemberRole, RemoveRemoteWorkspaceMember, RemoteWorkspaceMemberRoleResult, RemoteWorkspaceMemberRemovalResult, RemoteWorkspaceMemberErrorCode } from "../lib/remote-workspace.js";
39
+ export type { RemoteCustomerRole, RemoteCustomerProfile, RemoteCurrentWorkspace, UpdateRemoteProfile, UpdateRemoteWorkspace } from "../lib/remote-profile.js";