@hasna/skills 0.2.1 → 0.3.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.
- package/README.md +100 -36
- package/bin/index.js +14659 -24077
- package/bin/mcp.js +4085 -13649
- package/bin/migrate.js +5 -0
- package/bin/server.js +367 -210
- package/bin/worker.js +364 -197
- package/dist/admin-contract.d.ts +5861 -916
- package/dist/admin-contract.js +3611 -13914
- package/dist/cli/cli.test-utils.d.ts +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4877 -14248
- package/dist/lib/api-url.d.ts +32 -23
- package/dist/lib/auth-store.d.ts +111 -42
- package/dist/lib/config.d.ts +19 -21
- package/dist/lib/feedback.d.ts +8 -3
- package/dist/lib/fleet-credentials.d.ts +246 -0
- package/dist/lib/remote-client.d.ts +19 -9
- package/dist/lib/remote-registry.d.ts +31 -11
- package/dist/lib/run-routing.d.ts +6 -4
- package/dist/lib/vendor-host-policy.d.ts +31 -0
- package/dist/sdk/index.d.ts +6 -0
- package/dist/sdk/index.js +5455 -14602
- package/dist/sdk/runs.d.ts +101 -19
- package/dist/storage.js +9 -14
- package/package.json +3 -1
package/dist/sdk/runs.d.ts
CHANGED
|
@@ -38,7 +38,23 @@ export declare const runAdmissionSchema: z.ZodObject<{
|
|
|
38
38
|
skill: z.ZodString;
|
|
39
39
|
status: z.ZodLiteral<"admitted">;
|
|
40
40
|
createdAt: z.ZodString;
|
|
41
|
-
}, z.
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
status: "admitted";
|
|
43
|
+
createdAt: string;
|
|
44
|
+
skill: string;
|
|
45
|
+
contractVersion: 1;
|
|
46
|
+
runId: string;
|
|
47
|
+
leaseGeneration: number;
|
|
48
|
+
attemptId: string;
|
|
49
|
+
}, {
|
|
50
|
+
status: "admitted";
|
|
51
|
+
createdAt: string;
|
|
52
|
+
skill: string;
|
|
53
|
+
contractVersion: 1;
|
|
54
|
+
runId: string;
|
|
55
|
+
leaseGeneration: number;
|
|
56
|
+
attemptId: string;
|
|
57
|
+
}>;
|
|
42
58
|
export type RunAdmission = z.infer<typeof runAdmissionSchema>;
|
|
43
59
|
/** Lease: a worker has claimed the run. */
|
|
44
60
|
export declare const runLeaseSchema: z.ZodObject<{
|
|
@@ -48,7 +64,21 @@ export declare const runLeaseSchema: z.ZodObject<{
|
|
|
48
64
|
leaseGeneration: z.ZodNumber;
|
|
49
65
|
workerId: z.ZodString;
|
|
50
66
|
status: z.ZodLiteral<"leased">;
|
|
51
|
-
}, z.
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
status: "leased";
|
|
69
|
+
contractVersion: 1;
|
|
70
|
+
runId: string;
|
|
71
|
+
leaseGeneration: number;
|
|
72
|
+
attemptId: string;
|
|
73
|
+
workerId: string;
|
|
74
|
+
}, {
|
|
75
|
+
status: "leased";
|
|
76
|
+
contractVersion: 1;
|
|
77
|
+
runId: string;
|
|
78
|
+
leaseGeneration: number;
|
|
79
|
+
attemptId: string;
|
|
80
|
+
workerId: string;
|
|
81
|
+
}>;
|
|
52
82
|
export type RunLease = z.infer<typeof runLeaseSchema>;
|
|
53
83
|
/** Terminal: the run reached a final state. */
|
|
54
84
|
export declare const runTerminalSchema: z.ZodObject<{
|
|
@@ -57,17 +87,28 @@ export declare const runTerminalSchema: z.ZodObject<{
|
|
|
57
87
|
attemptId: z.ZodString;
|
|
58
88
|
leaseGeneration: z.ZodNumber;
|
|
59
89
|
skill: z.ZodString;
|
|
60
|
-
status: z.ZodEnum<
|
|
61
|
-
cancelled: "cancelled";
|
|
62
|
-
failed: "failed";
|
|
63
|
-
succeeded: "succeeded";
|
|
64
|
-
expired: "expired";
|
|
65
|
-
}>;
|
|
90
|
+
status: z.ZodEnum<["succeeded", "failed", "cancelled", "expired"]>;
|
|
66
91
|
completedAt: z.ZodString;
|
|
67
|
-
}, z.
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
status: "cancelled" | "failed" | "succeeded" | "expired";
|
|
94
|
+
skill: string;
|
|
95
|
+
completedAt: string;
|
|
96
|
+
contractVersion: 1;
|
|
97
|
+
runId: string;
|
|
98
|
+
leaseGeneration: number;
|
|
99
|
+
attemptId: string;
|
|
100
|
+
}, {
|
|
101
|
+
status: "cancelled" | "failed" | "succeeded" | "expired";
|
|
102
|
+
skill: string;
|
|
103
|
+
completedAt: string;
|
|
104
|
+
contractVersion: 1;
|
|
105
|
+
runId: string;
|
|
106
|
+
leaseGeneration: number;
|
|
107
|
+
attemptId: string;
|
|
108
|
+
}>;
|
|
68
109
|
export type RunTerminal = z.infer<typeof runTerminalSchema>;
|
|
69
110
|
/** Any single protocol message, discriminated by `status`. */
|
|
70
|
-
export declare const runProtocolSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
111
|
+
export declare const runProtocolSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
71
112
|
contractVersion: z.ZodLiteral<1>;
|
|
72
113
|
runId: z.ZodString;
|
|
73
114
|
attemptId: z.ZodString;
|
|
@@ -75,27 +116,68 @@ export declare const runProtocolSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
75
116
|
skill: z.ZodString;
|
|
76
117
|
status: z.ZodLiteral<"admitted">;
|
|
77
118
|
createdAt: z.ZodString;
|
|
78
|
-
},
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
status: "admitted";
|
|
121
|
+
createdAt: string;
|
|
122
|
+
skill: string;
|
|
123
|
+
contractVersion: 1;
|
|
124
|
+
runId: string;
|
|
125
|
+
leaseGeneration: number;
|
|
126
|
+
attemptId: string;
|
|
127
|
+
}, {
|
|
128
|
+
status: "admitted";
|
|
129
|
+
createdAt: string;
|
|
130
|
+
skill: string;
|
|
131
|
+
contractVersion: 1;
|
|
132
|
+
runId: string;
|
|
133
|
+
leaseGeneration: number;
|
|
134
|
+
attemptId: string;
|
|
135
|
+
}>, z.ZodObject<{
|
|
79
136
|
contractVersion: z.ZodLiteral<1>;
|
|
80
137
|
runId: z.ZodString;
|
|
81
138
|
attemptId: z.ZodString;
|
|
82
139
|
leaseGeneration: z.ZodNumber;
|
|
83
140
|
workerId: z.ZodString;
|
|
84
141
|
status: z.ZodLiteral<"leased">;
|
|
85
|
-
},
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
status: "leased";
|
|
144
|
+
contractVersion: 1;
|
|
145
|
+
runId: string;
|
|
146
|
+
leaseGeneration: number;
|
|
147
|
+
attemptId: string;
|
|
148
|
+
workerId: string;
|
|
149
|
+
}, {
|
|
150
|
+
status: "leased";
|
|
151
|
+
contractVersion: 1;
|
|
152
|
+
runId: string;
|
|
153
|
+
leaseGeneration: number;
|
|
154
|
+
attemptId: string;
|
|
155
|
+
workerId: string;
|
|
156
|
+
}>, z.ZodObject<{
|
|
86
157
|
contractVersion: z.ZodLiteral<1>;
|
|
87
158
|
runId: z.ZodString;
|
|
88
159
|
attemptId: z.ZodString;
|
|
89
160
|
leaseGeneration: z.ZodNumber;
|
|
90
161
|
skill: z.ZodString;
|
|
91
|
-
status: z.ZodEnum<
|
|
92
|
-
cancelled: "cancelled";
|
|
93
|
-
failed: "failed";
|
|
94
|
-
succeeded: "succeeded";
|
|
95
|
-
expired: "expired";
|
|
96
|
-
}>;
|
|
162
|
+
status: z.ZodEnum<["succeeded", "failed", "cancelled", "expired"]>;
|
|
97
163
|
completedAt: z.ZodString;
|
|
98
|
-
}, z.
|
|
164
|
+
}, "strip", z.ZodTypeAny, {
|
|
165
|
+
status: "cancelled" | "failed" | "succeeded" | "expired";
|
|
166
|
+
skill: string;
|
|
167
|
+
completedAt: string;
|
|
168
|
+
contractVersion: 1;
|
|
169
|
+
runId: string;
|
|
170
|
+
leaseGeneration: number;
|
|
171
|
+
attemptId: string;
|
|
172
|
+
}, {
|
|
173
|
+
status: "cancelled" | "failed" | "succeeded" | "expired";
|
|
174
|
+
skill: string;
|
|
175
|
+
completedAt: string;
|
|
176
|
+
contractVersion: 1;
|
|
177
|
+
runId: string;
|
|
178
|
+
leaseGeneration: number;
|
|
179
|
+
attemptId: string;
|
|
180
|
+
}>]>;
|
|
99
181
|
export type RunProtocolMessage = z.infer<typeof runProtocolSchema>;
|
|
100
182
|
/** Map the store's status vocabulary onto the protocol lifecycle. */
|
|
101
183
|
export declare function protocolStateOf(status: ServerRunStatus): RunProtocolState;
|
package/dist/storage.js
CHANGED
|
@@ -65,7 +65,12 @@ import { join as join2, dirname } from "path";
|
|
|
65
65
|
// src/lib/retired-settings.ts
|
|
66
66
|
var RETIRED_ENV_SUFFIXES = ["_STORAGE_MODE", "_DEPLOYMENT_MODE", "_CLOUD_MODE"];
|
|
67
67
|
var RETIRED_CONFIG_KEYS = {
|
|
68
|
-
mode: "
|
|
68
|
+
mode: "a configured API origin",
|
|
69
|
+
apiUrl: "skills setup --api-url <origin>"
|
|
70
|
+
};
|
|
71
|
+
var RETIRED_CONFIG_KEY_REASONS = {
|
|
72
|
+
mode: "Deployment modes were removed: a Skills client either resolves a credential " + "or it does not, and that is the whole of it.",
|
|
73
|
+
apiUrl: "The service address is no longer kept in this app's config file: it is read from " + "HASNA_SKILLS_API_URL, then the macOS Keychain item hasna.credentials.skills.api-url, " + "then ~/.hasna/skills/config/credentials, then the fleet gateway."
|
|
69
74
|
};
|
|
70
75
|
|
|
71
76
|
class RetiredSettingError extends Error {
|
|
@@ -104,7 +109,7 @@ function assertNoRetiredConfigKeys(config, source) {
|
|
|
104
109
|
for (const [key, replacement] of Object.entries(RETIRED_CONFIG_KEYS)) {
|
|
105
110
|
if (!(key in config))
|
|
106
111
|
continue;
|
|
107
|
-
throw new RetiredSettingError(key, `${source}: "${key}" is no longer a configuration key. ` +
|
|
112
|
+
throw new RetiredSettingError(key, `${source}: "${key}" is no longer a configuration key. ` + `${RETIRED_CONFIG_KEY_REASONS[key] ?? ""} ` + `Use ${replacement} instead, and remove the old key with: skills config unset ${key}. ` + "Refused rather than ignored, because silently dropping it would leave an " + "operator believing they had pointed this install at a server.");
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
115
|
|
|
@@ -232,7 +237,7 @@ var ENUM_KEYS = {
|
|
|
232
237
|
defaultScope: ["global", "project"],
|
|
233
238
|
format: ["compact", "json", "csv"]
|
|
234
239
|
};
|
|
235
|
-
var STRING_KEYS = ["
|
|
240
|
+
var STRING_KEYS = ["extensionsDir"];
|
|
236
241
|
function validKeys() {
|
|
237
242
|
return [...Object.keys(ENUM_KEYS), ...STRING_KEYS];
|
|
238
243
|
}
|
|
@@ -263,16 +268,6 @@ function normalizeConfigValue(key, value) {
|
|
|
263
268
|
const allowed = allowedValues(key);
|
|
264
269
|
if (allowed)
|
|
265
270
|
return allowed.includes(value) ? value : undefined;
|
|
266
|
-
if (key === "apiUrl") {
|
|
267
|
-
try {
|
|
268
|
-
const url = new URL(value);
|
|
269
|
-
if (url.protocol !== "http:" && url.protocol !== "https:")
|
|
270
|
-
return;
|
|
271
|
-
return value.replace(/\/+$/, "");
|
|
272
|
-
} catch {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
271
|
if (key === "extensionsDir")
|
|
277
272
|
return value.trim() ? value : undefined;
|
|
278
273
|
return;
|
|
@@ -342,7 +337,7 @@ function saveConfig(key, value, scope = "project") {
|
|
|
342
337
|
const normalized = normalizeConfigValue(key, value);
|
|
343
338
|
if (normalized === undefined) {
|
|
344
339
|
const allowed = allowedValues(key);
|
|
345
|
-
throw new Error(allowed ? `Invalid value '${value}' for ${key}. Allowed: ${allowed.join(", ")}` : `Invalid value '${value}' for ${key}. Expected
|
|
340
|
+
throw new Error(allowed ? `Invalid value '${value}' for ${key}. Allowed: ${allowed.join(", ")}` : `Invalid value '${value}' for ${key}. Expected a non-empty path`);
|
|
346
341
|
}
|
|
347
342
|
const filePath = getConfigPath(scope);
|
|
348
343
|
let existing = {};
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/skills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Skills library for AI coding agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"skills": "bin/index.js",
|
|
8
8
|
"skills-mcp": "bin/mcp.js",
|
|
9
|
+
"skills-serve": "bin/server.js",
|
|
9
10
|
"skills-server": "bin/server.js",
|
|
10
11
|
"skills-worker": "bin/worker.js",
|
|
11
12
|
"skills-migrate": "bin/migrate.js"
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
"dependencies": {
|
|
92
93
|
"@aws-sdk/client-ecs": "^3.1079.0",
|
|
93
94
|
"@aws-sdk/client-s3": "^3.1079.0",
|
|
95
|
+
"@hasna/contracts": "1.0.1",
|
|
94
96
|
"@hasna/events": "0.1.16",
|
|
95
97
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
96
98
|
"chalk": "^5.3.0",
|