@hasna/skills 0.8.1 → 0.8.2

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.
@@ -0,0 +1,40 @@
1
+ import type { ResolvedSkillSelection } from "../types/skill-selection.js";
2
+ export interface SelectedSecretBindings {
3
+ schema: "hasna.skills-secret-bindings.v1";
4
+ selection: Pick<ResolvedSkillSelection, "authority" | "workspaceId" | "profileRevision" | "slug" | "version" | "bundleDigest"> & {
5
+ profileId: string;
6
+ };
7
+ consumer: {
8
+ stationId: string;
9
+ workspaceDirectory: string;
10
+ };
11
+ /** Exact canonical /v1 authority of the independently configured Secrets client. */
12
+ secretsAuthority: string;
13
+ /** Declared environment name -> vault key. Values are resolved freshly for each run. */
14
+ bindings: Record<string, string>;
15
+ }
16
+ export interface SelectedSecretsClient {
17
+ readonly baseUrl: string;
18
+ getSecret(query: {
19
+ key: string;
20
+ }, init?: RequestInit): Promise<{
21
+ key: string;
22
+ value: string;
23
+ expires_at?: string | null;
24
+ }>;
25
+ }
26
+ export interface SelectedSecretScope {
27
+ selection: ResolvedSkillSelection;
28
+ profileId: string;
29
+ cwd: string;
30
+ }
31
+ export declare function selectedSecretBindingsTemplate(scope: SelectedSecretScope, names: string[], createClient?: () => SelectedSecretsClient): SelectedSecretBindings;
32
+ /** Runtime controls must not be supplied as credentials, even by a reviewed binding. */
33
+ export declare function declaredSecretNames(value: unknown): string[];
34
+ /** Reading is bounded and rejects symlinks/devices. Parsing errors never echo file contents. */
35
+ export declare function readSelectedSecretBindings(path: string): SelectedSecretBindings;
36
+ /** Validate every grant before constructing a client or reading any secret. */
37
+ export declare function validateSelectedSecretBindings(value: unknown, scope: SelectedSecretScope, names: string[]): SelectedSecretBindings;
38
+ export declare function resolveSelectedSecrets(bindings: SelectedSecretBindings, createClient?: () => SelectedSecretsClient): Promise<Record<string, string>>;
39
+ /** Limit accidental disclosure in child output. This is not a sandbox for hostile code. */
40
+ export declare function redactExecutionSecrets(text: string, env: Record<string, string>): string;
@@ -1,8 +1,10 @@
1
1
  import type { ResolvedSkillSelection } from "../types/skill-selection.js";
2
2
  import type { SkillBundleEntry } from "./skill-bundle.js";
3
3
  import { type SelectionResolverOptions } from "./selection-resolver.js";
4
+ import { type SelectedSecretBindings, type SelectedSecretsClient } from "./execution-secrets.js";
4
5
  export interface ResolvedSelectedRun {
5
6
  selection: ResolvedSkillSelection;
7
+ profileId: string;
6
8
  kind: "instruction" | "executable";
7
9
  entries: SkillBundleEntry[];
8
10
  manifest: Record<string, any>;
@@ -17,12 +19,29 @@ export interface SelectedLocalRunOptions {
17
19
  timeoutMs?: number;
18
20
  /** Only explicitly supplied environment values are available to declared secret references. */
19
21
  env?: Record<string, string>;
22
+ /** Explicit value-free vault grants; mutually exclusive with env. */
23
+ secretBindings?: SelectedSecretBindings;
24
+ /** SDK injection seam. The default uses the independently configured Secrets SDK. */
25
+ createSecretsClient?: () => SelectedSecretsClient;
20
26
  }
27
+ export declare function prepareSelectedSecretBindings(selected: ResolvedSelectedRun, cwd?: string): Promise<SelectedSecretBindings>;
21
28
  export declare function executeSelectedLocal(selected: ResolvedSelectedRun, options?: SelectedLocalRunOptions): Promise<{
22
29
  exitCode: number;
23
30
  stdout: string;
24
31
  stderr: string;
25
32
  error?: string;
33
+ secretBinding?: {
34
+ schema: "hasna.skills-secret-bindings.v1";
35
+ selection: Pick<ResolvedSkillSelection, "slug" | "version" | "bundleDigest" | "workspaceId" | "authority" | "profileRevision"> & {
36
+ profileId: string;
37
+ };
38
+ consumer: {
39
+ stationId: string;
40
+ workspaceDirectory: string;
41
+ };
42
+ secretsAuthority: string;
43
+ bindings: Record<string, string>;
44
+ } | undefined;
26
45
  selection: ResolvedSkillSelection;
27
46
  target: "local";
28
47
  runtime: any;
@@ -16,6 +16,8 @@
16
16
  * variable of its own. See lib/fleet-credentials.ts.
17
17
  */
18
18
  export { HttpProfileClient, createProfileClient, type ProfileClient } from "../lib/profile-client.js";
19
+ export { resolveSelectedRun, executeSelectedLocal, prepareSelectedSecretBindings, type ResolvedSelectedRun, type SelectedLocalRunOptions } from "../lib/selected-run.js";
20
+ export { readSelectedSecretBindings, type SelectedSecretBindings, type SelectedSecretsClient } from "../lib/execution-secrets.js";
19
21
  export type { SkillSelection, SkillProfile, ResolvedSkillSelection, ResolvedSkillProfile, StationSkillStateInput, StationSkillState } from "../types/skill-selection.js";
20
22
  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";
21
23
  export * from "./server.js";