@hasna/skills 0.8.11 → 0.9.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 +21 -4
- package/bin/index.js +853 -446
- package/bin/mcp.js +309 -155
- package/bin/migrate.js +100 -10
- package/bin/server.js +596 -51
- package/bin/worker.js +283 -20
- package/dist/cli/commands/registry.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +498 -184
- package/dist/lib/agent-discovery.d.ts +1 -1
- package/dist/lib/claude-settings-witness.d.ts +19 -0
- package/dist/lib/cloud-executions.d.ts +20 -0
- package/dist/lib/registry-types.d.ts +3 -0
- package/dist/lib/remote-client.d.ts +11 -0
- package/dist/lib/revision.d.ts +3 -0
- package/dist/sdk/execution/admission.d.ts +2 -1
- package/dist/sdk/execution/types.d.ts +9 -0
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +1755 -752
- package/dist/server/runtime-policy.d.ts +4 -2
- package/dist/server/runtime-pure-contract.d.ts +51 -0
- package/dist/server/runtime-store.d.ts +4 -0
- package/dist/server/runtime-worker.d.ts +2 -1
- package/dist/server/selection-store.d.ts +9 -1
- package/dist/server/skills-api.d.ts +2 -1
- package/dist/server/sqlite-store.d.ts +4 -1
- package/dist/server/store.d.ts +6 -1
- package/dist/server/types.d.ts +27 -0
- package/docs/plugin-admission.md +67 -0
- package/migrations/postgres/0010_skill_archive_lifecycle.sql +5 -0
- package/migrations/sqlite/0010_skill_archive_lifecycle.sql +5 -0
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ export { captureDiscoveryDirectories, type DiscoveryDirectory } from "./agent-di
|
|
|
5
5
|
export interface DiscoverySource {
|
|
6
6
|
path: string;
|
|
7
7
|
sha256: string | null;
|
|
8
|
-
hashMode?: "bytes" | "path-bytes" | "claude-plugin-registry" | "claude-marketplace-registry";
|
|
8
|
+
hashMode?: "bytes" | "path-bytes" | "claude-plugin-registry" | "claude-marketplace-registry" | "claude-settings-v1";
|
|
9
9
|
managedPlugins?: ManagedPluginRegistrationWitness[];
|
|
10
10
|
format?: "json" | "toml" | "yaml";
|
|
11
11
|
fields?: string[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const CLAUDE_SETTINGS_WITNESS_LIMITS: Readonly<{
|
|
2
|
+
bytes: number;
|
|
3
|
+
rows: 1024;
|
|
4
|
+
depth: 32;
|
|
5
|
+
nodes: 65536;
|
|
6
|
+
stringCharacters: 16384;
|
|
7
|
+
pathCharacters: 4096;
|
|
8
|
+
}>;
|
|
9
|
+
export interface ClaudeSettingsWitnessBudget {
|
|
10
|
+
remaining: number;
|
|
11
|
+
}
|
|
12
|
+
/** Hash only reviewed installer-rendered settings after the disk preimage has been verified. */
|
|
13
|
+
export declare function hashClaudeSettingsReplacement(text: string, budget: ClaudeSettingsWitnessBudget): string;
|
|
14
|
+
/** Explicit capture never converts a stored legacy raw witness or changes settings. */
|
|
15
|
+
export declare function captureClaudeSettings(path: string, budget?: ClaudeSettingsWitnessBudget): {
|
|
16
|
+
path: string;
|
|
17
|
+
hashMode: "claude-settings-v1";
|
|
18
|
+
sha256: string;
|
|
19
|
+
};
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import type { PureExecutionContract } from "../sdk/execution/types.js";
|
|
2
|
+
export interface CloudEligibility {
|
|
3
|
+
contractVersion: 1;
|
|
4
|
+
eligible: boolean;
|
|
5
|
+
skill: string;
|
|
6
|
+
version: string;
|
|
7
|
+
bundleDigest: string;
|
|
8
|
+
reason?: string;
|
|
9
|
+
runtimeImageDigest?: string;
|
|
10
|
+
executionContract?: PureExecutionContract | {
|
|
11
|
+
id: "pdf.v1";
|
|
12
|
+
};
|
|
13
|
+
secrets?: "none";
|
|
14
|
+
egress?: "deny";
|
|
15
|
+
}
|
|
1
16
|
export interface CloudExecution {
|
|
2
17
|
contractVersion: 1;
|
|
3
18
|
id: string;
|
|
@@ -7,6 +22,9 @@ export interface CloudExecution {
|
|
|
7
22
|
bundleDigest: string;
|
|
8
23
|
inputDigest: string;
|
|
9
24
|
runtimeImageDigest: string;
|
|
25
|
+
executionContract?: PureExecutionContract | {
|
|
26
|
+
id: "pdf.v1";
|
|
27
|
+
};
|
|
10
28
|
status: "admitted" | "leased" | "running" | "succeeded" | "failed" | "cancelled";
|
|
11
29
|
exitCode?: number;
|
|
12
30
|
artifacts: {
|
|
@@ -22,6 +40,8 @@ export declare class CloudExecutionClient {
|
|
|
22
40
|
constructor(apiOrigin: string, apiKey: string);
|
|
23
41
|
static configured(): Promise<CloudExecutionClient>;
|
|
24
42
|
private request;
|
|
43
|
+
/** Metadata only: never creates, starts or reconciles a task. */
|
|
44
|
+
eligibility(slug: string, version: string, bundleDigest?: string): Promise<CloudEligibility>;
|
|
25
45
|
submit(slug: string, version: string, input: unknown, key: string, selection?: {
|
|
26
46
|
bundleDigest: string;
|
|
27
47
|
workspaceId?: string;
|
|
@@ -12,6 +12,9 @@ export interface SkillMeta {
|
|
|
12
12
|
tags: string[];
|
|
13
13
|
dependencies?: string[];
|
|
14
14
|
version?: string;
|
|
15
|
+
/** Server registry revision and lifecycle, when supplied by a remote read. */
|
|
16
|
+
revisionId?: string | null;
|
|
17
|
+
lifecycle?: "active" | "archived";
|
|
15
18
|
/**
|
|
16
19
|
* Artifact class of the skill. "executable" skills carry a runnable
|
|
17
20
|
* package.json/bin/src; "instruction" skills are SKILL.md-primary prose for
|
|
@@ -30,6 +30,10 @@ export declare class RemoteRequestError extends Error {
|
|
|
30
30
|
readonly status: number;
|
|
31
31
|
constructor(path: string, status: number, _statusText?: string);
|
|
32
32
|
}
|
|
33
|
+
export declare class RemoteSkillLifecycleError extends RemoteRequestError {
|
|
34
|
+
readonly code?: string;
|
|
35
|
+
constructor(path: string, status: number, code?: string);
|
|
36
|
+
}
|
|
33
37
|
/** Bounded checkout outcome; the key is caller-owned, never copied from a server error. */
|
|
34
38
|
export declare class RemoteCreditCheckoutError extends RemoteRequestError {
|
|
35
39
|
readonly code: RemoteCreditCheckoutErrorCode;
|
|
@@ -144,6 +148,8 @@ export declare class RemoteSkillsClient {
|
|
|
144
148
|
};
|
|
145
149
|
recurringConsents?: RecurringCapability;
|
|
146
150
|
}>;
|
|
151
|
+
/** Add the single supported publication scope to an existing key, metadata only. */
|
|
152
|
+
addSkillPublishScope(keyId: string, expectedScopes: string[], expectedOrgId: string): Promise<Record<string, unknown>>;
|
|
147
153
|
/** Quote first and fail closed when the caller has not approved the required credits. */
|
|
148
154
|
submitQuotedRun(slug: string, input?: Record<string, unknown>, args?: string[], approval?: RemoteRunApproval): Promise<RemoteSkillRunContract>;
|
|
149
155
|
getIdentity(): Promise<Record<string, unknown>>;
|
|
@@ -252,6 +258,11 @@ export declare class RemoteSkillsClient {
|
|
|
252
258
|
*/
|
|
253
259
|
publishSkill(manifest: Record<string, unknown>, bundle?: Uint8Array, ifMatch?: string): Promise<Response>;
|
|
254
260
|
deleteSkill(slug: string): Promise<Response>;
|
|
261
|
+
setSkillLifecycle(slug: string, lifecycle: "active" | "archived", options: {
|
|
262
|
+
reason?: string;
|
|
263
|
+
replacementSlug?: string;
|
|
264
|
+
expectedRevisionId: string;
|
|
265
|
+
}): Promise<any>;
|
|
255
266
|
downloadSkillBundle(slug: string): Promise<Response>;
|
|
256
267
|
/**
|
|
257
268
|
* Bundle fetch for the verified-pull path. Returns the raw Response so the caller can
|
package/dist/lib/revision.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export interface RevisionContent {
|
|
|
12
12
|
skillMd?: string;
|
|
13
13
|
bundleSha256?: string;
|
|
14
14
|
bundleByteSize?: number;
|
|
15
|
+
lifecycle?: "active" | "archived";
|
|
16
|
+
archiveReason?: string;
|
|
17
|
+
replacementSlug?: string;
|
|
15
18
|
}
|
|
16
19
|
export declare function revisionIdOf(content: RevisionContent): string;
|
|
17
20
|
export declare function revisionIdOfRecord(record: RevisionContent): string;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { ImageProfileRegistry } from "./image-profile.js";
|
|
12
12
|
import type { RunExecutionStore } from "./storage.js";
|
|
13
|
-
import { type FrozenAdmission, type RunLimits, type RunPolicy, type RuntimeName } from "./types.js";
|
|
13
|
+
import { type FrozenAdmission, type RunLimits, type RunPolicy, type RuntimeName, type PureExecutionContract } from "./types.js";
|
|
14
14
|
export interface SubmitRunInput {
|
|
15
15
|
tenantId: string;
|
|
16
16
|
skillId: string;
|
|
@@ -24,6 +24,7 @@ export interface SubmitRunInput {
|
|
|
24
24
|
systemDeps?: string[];
|
|
25
25
|
policy?: Partial<RunPolicy>;
|
|
26
26
|
limits?: Partial<RunLimits>;
|
|
27
|
+
executionContract?: PureExecutionContract;
|
|
27
28
|
}
|
|
28
29
|
export interface SubmitRunResult {
|
|
29
30
|
run: FrozenAdmission;
|
|
@@ -33,6 +33,13 @@ export interface RunLimits {
|
|
|
33
33
|
maxArtifactsBytes: number;
|
|
34
34
|
maxConcurrency: number;
|
|
35
35
|
}
|
|
36
|
+
/** Trusted, versioned adapter identity. Absent only for legacy PDF admissions. */
|
|
37
|
+
export interface PureExecutionContract {
|
|
38
|
+
id: "regex-test.v1";
|
|
39
|
+
descriptorDigest: string;
|
|
40
|
+
entrypoint: string;
|
|
41
|
+
entrypointDigest: string;
|
|
42
|
+
}
|
|
36
43
|
/** Everything frozen at admission under one stable run_id. */
|
|
37
44
|
export interface FrozenAdmission {
|
|
38
45
|
contractVersion: number;
|
|
@@ -46,6 +53,7 @@ export interface FrozenAdmission {
|
|
|
46
53
|
runtimeImageDigest: string;
|
|
47
54
|
/** Prebuilt dependency layer tag, when the manifest's system_deps are allowlisted. */
|
|
48
55
|
dependencyLayerTag: string | null;
|
|
56
|
+
executionContract?: PureExecutionContract;
|
|
49
57
|
/** sha256 of the canonical serialization of the run input. */
|
|
50
58
|
inputDigest: string;
|
|
51
59
|
runtime: RuntimeName;
|
|
@@ -109,6 +117,7 @@ export interface AttemptReceipt {
|
|
|
109
117
|
runtimeImageDigest: string;
|
|
110
118
|
bundleDigest: string;
|
|
111
119
|
dependencyLayerTag: string | null;
|
|
120
|
+
executionContract?: PureExecutionContract;
|
|
112
121
|
policy: RunPolicy;
|
|
113
122
|
limits: RunLimits;
|
|
114
123
|
exitCode: number | null;
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -15,6 +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 { CloudExecutionClient, type CloudExecution, type CloudEligibility } from "../lib/cloud-executions.js";
|
|
18
19
|
export { readExecutionGrantPolicy, saveExecutionGrantPolicy, resolveExecutionGrant } from "../lib/execution-grant-client.js";
|
|
19
20
|
export type { ExecutionGrant, ExecutionGrantPolicy, ExecutionGrantRequest, ResolvedExecutionGrant } from "../lib/execution-grants.js";
|
|
20
21
|
export { HttpProfileClient, createProfileClient, type ProfileClient, type AuthenticatedProfilePrincipal, type AuthenticatedProfileRole } from "../lib/profile-client.js";
|