@hasna/skills 0.8.2 → 0.8.3
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 +70 -2
- package/bin/index.js +585 -282
- package/bin/mcp.js +255 -109
- package/bin/migrate.js +82 -24
- package/bin/server.js +1222 -430
- package/bin/worker.js +395 -87
- package/dist/cli/commands/grants.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/lib/execution-grant-client.d.ts +5 -0
- package/dist/lib/execution-grants.d.ts +49 -0
- package/dist/lib/selected-manifest.d.ts +6 -0
- package/dist/lib/selected-run.d.ts +9 -0
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +9205 -8724
- package/dist/server/execution-grant-store.d.ts +29 -0
- package/dist/server/execution-grants-api.d.ts +4 -0
- package/dist/server/sqlite-store.d.ts +2 -0
- package/dist/server/store.d.ts +3 -0
- package/dist/server/types.d.ts +2 -0
- package/migrations/postgres/0009_execution_grants.sql +15 -0
- package/migrations/sqlite/0009_execution_grants.sql +15 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37660,7 +37660,7 @@ import { dirname as dirname14, relative as relative7 } from "path";
|
|
|
37660
37660
|
// package.json
|
|
37661
37661
|
var package_default = {
|
|
37662
37662
|
name: "@hasna/skills",
|
|
37663
|
-
version: "0.8.
|
|
37663
|
+
version: "0.8.3",
|
|
37664
37664
|
description: "Skills library for AI coding agents",
|
|
37665
37665
|
type: "module",
|
|
37666
37666
|
bin: {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ExecutionGrant, type ExecutionGrantPolicy, type ExecutionGrantRequest, type ResolvedExecutionGrant } from "./execution-grants.js";
|
|
2
|
+
export declare function readExecutionGrantPolicy(profileId: string, revision?: string): Promise<ExecutionGrantPolicy>;
|
|
3
|
+
export declare function saveExecutionGrantPolicy(profileId: string, grants: ExecutionGrant[], revision?: string): Promise<ExecutionGrantPolicy>;
|
|
4
|
+
/** No disk cache: every execution obtains a current decision from its configured Skills authority. */
|
|
5
|
+
export declare function resolveExecutionGrant(input: ExecutionGrantRequest): Promise<ResolvedExecutionGrant>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { SelectedSecretBindings } from "./execution-secrets.js";
|
|
2
|
+
export declare const MAX_EXECUTION_GRANTS = 256;
|
|
3
|
+
export declare const MAX_EXECUTION_GRANT_BYTES: number;
|
|
4
|
+
export interface ExecutionGrant {
|
|
5
|
+
id: string;
|
|
6
|
+
target: "local";
|
|
7
|
+
selection: {
|
|
8
|
+
slug: string;
|
|
9
|
+
version: string;
|
|
10
|
+
bundleDigest: string;
|
|
11
|
+
};
|
|
12
|
+
actors: string[];
|
|
13
|
+
/** Canonical directory conditions, not cryptographic machine attestation. */
|
|
14
|
+
consumers: {
|
|
15
|
+
stationId: string;
|
|
16
|
+
workspaceDirectory: string;
|
|
17
|
+
includeDescendants?: boolean;
|
|
18
|
+
}[];
|
|
19
|
+
secretsAuthority: string;
|
|
20
|
+
bindings: Record<string, string>;
|
|
21
|
+
expiresAt?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ExecutionGrantPolicy {
|
|
24
|
+
schema: "hasna.skills-execution-grants.v1";
|
|
25
|
+
profileId: string;
|
|
26
|
+
workspaceId: string;
|
|
27
|
+
revision: string;
|
|
28
|
+
previousRevision: string | null;
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
actorId: string;
|
|
31
|
+
grants: ExecutionGrant[];
|
|
32
|
+
}
|
|
33
|
+
export interface ExecutionGrantRequest {
|
|
34
|
+
selection: SelectedSecretBindings["selection"];
|
|
35
|
+
consumer: SelectedSecretBindings["consumer"];
|
|
36
|
+
}
|
|
37
|
+
export interface ResolvedExecutionGrant {
|
|
38
|
+
policyRevision: string;
|
|
39
|
+
grantId: string;
|
|
40
|
+
bindings: SelectedSecretBindings;
|
|
41
|
+
}
|
|
42
|
+
export declare function grantIdentifier(v: unknown): v is string;
|
|
43
|
+
export declare function grantRecord(v: unknown): v is Record<string, unknown>;
|
|
44
|
+
export declare function grantWorkspace(v: unknown): v is string;
|
|
45
|
+
export declare function grantDirectoryContains(root: string, directory: string, descendants?: boolean): boolean;
|
|
46
|
+
export declare function validateExecutionGrants(value: unknown): ExecutionGrant[];
|
|
47
|
+
export declare function validateExecutionGrantPolicy(value: unknown): ExecutionGrantPolicy;
|
|
48
|
+
export declare function validateExecutionGrantRequest(value: unknown): ExecutionGrantRequest;
|
|
49
|
+
export declare function executionGrantMatches(g: ExecutionGrant, r: ExecutionGrantRequest, actorId: string, now?: number): boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ExecutionGrantRequest, type ResolvedExecutionGrant } from "./execution-grants.js";
|
|
1
2
|
import type { ResolvedSkillSelection } from "../types/skill-selection.js";
|
|
2
3
|
import type { SkillBundleEntry } from "./skill-bundle.js";
|
|
3
4
|
import { type SelectionResolverOptions } from "./selection-resolver.js";
|
|
@@ -23,6 +24,10 @@ export interface SelectedLocalRunOptions {
|
|
|
23
24
|
secretBindings?: SelectedSecretBindings;
|
|
24
25
|
/** SDK injection seam. The default uses the independently configured Secrets SDK. */
|
|
25
26
|
createSecretsClient?: () => SelectedSecretsClient;
|
|
27
|
+
/** Disable network authorization for explicit cached execution; declared secrets then need caller bindings. */
|
|
28
|
+
sharedExecutionGrants?: boolean;
|
|
29
|
+
/** SDK seam for current shared authorization; responses still undergo exact binding validation. */
|
|
30
|
+
resolveExecutionGrant?: (request: ExecutionGrantRequest) => Promise<ResolvedExecutionGrant>;
|
|
26
31
|
}
|
|
27
32
|
export declare function prepareSelectedSecretBindings(selected: ResolvedSelectedRun, cwd?: string): Promise<SelectedSecretBindings>;
|
|
28
33
|
export declare function executeSelectedLocal(selected: ResolvedSelectedRun, options?: SelectedLocalRunOptions): Promise<{
|
|
@@ -42,6 +47,10 @@ export declare function executeSelectedLocal(selected: ResolvedSelectedRun, opti
|
|
|
42
47
|
secretsAuthority: string;
|
|
43
48
|
bindings: Record<string, string>;
|
|
44
49
|
} | undefined;
|
|
50
|
+
executionGrant?: {
|
|
51
|
+
policyRevision: string;
|
|
52
|
+
grantId: string;
|
|
53
|
+
} | undefined;
|
|
45
54
|
selection: ResolvedSkillSelection;
|
|
46
55
|
target: "local";
|
|
47
56
|
runtime: any;
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
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 { readExecutionGrantPolicy, saveExecutionGrantPolicy, resolveExecutionGrant } from "../lib/execution-grant-client.js";
|
|
19
|
+
export type { ExecutionGrant, ExecutionGrantPolicy, ExecutionGrantRequest, ResolvedExecutionGrant } from "../lib/execution-grants.js";
|
|
18
20
|
export { HttpProfileClient, createProfileClient, type ProfileClient } from "../lib/profile-client.js";
|
|
19
21
|
export { resolveSelectedRun, executeSelectedLocal, prepareSelectedSecretBindings, type ResolvedSelectedRun, type SelectedLocalRunOptions } from "../lib/selected-run.js";
|
|
20
22
|
export { readSelectedSecretBindings, type SelectedSecretBindings, type SelectedSecretsClient } from "../lib/execution-secrets.js";
|