@hasna/skills 0.3.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 (55) hide show
  1. package/README.md +269 -14
  2. package/bin/index.js +7835 -5440
  3. package/bin/mcp.js +2040 -589
  4. package/bin/migrate.js +148 -40
  5. package/bin/server.js +66 -87
  6. package/bin/worker.js +42 -75
  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/remote-account.d.ts +7 -0
  13. package/dist/cli/commands/tool-primitives.d.ts +1 -1
  14. package/dist/cli/commands/workspace-member-mutations.d.ts +2 -0
  15. package/dist/cli/commands/workspace-members.d.ts +2 -0
  16. package/dist/cli/env-assignment.d.ts +9 -0
  17. package/dist/index.d.ts +7 -2
  18. package/dist/index.js +1369 -349
  19. package/dist/lib/agent-sync.d.ts +13 -8
  20. package/dist/lib/api-url.d.ts +4 -3
  21. package/dist/lib/app-home.d.ts +0 -1
  22. package/dist/lib/auth-store.d.ts +1 -1
  23. package/dist/lib/client-types.d.ts +75 -0
  24. package/dist/lib/credential-state.d.ts +12 -0
  25. package/dist/lib/fleet-credentials.d.ts +49 -17
  26. package/dist/lib/home-adoption.d.ts +2 -0
  27. package/dist/lib/home-census.d.ts +3 -1
  28. package/dist/lib/instance-credentials.d.ts +13 -0
  29. package/dist/lib/local-opt-in.d.ts +24 -0
  30. package/dist/lib/mcp-contracts.d.ts +4 -0
  31. package/dist/lib/portable-skills-files.d.ts +10 -2
  32. package/dist/lib/portable-skills-types.d.ts +2 -0
  33. package/dist/lib/read-access.d.ts +83 -0
  34. package/dist/lib/remote-account.d.ts +42 -0
  35. package/dist/lib/remote-auth.d.ts +46 -0
  36. package/dist/lib/remote-client.d.ts +90 -6
  37. package/dist/lib/remote-customer-operations.d.ts +106 -0
  38. package/dist/lib/remote-files.d.ts +21 -0
  39. package/dist/lib/remote-profile.d.ts +26 -0
  40. package/dist/lib/remote-registry.d.ts +7 -3
  41. package/dist/lib/remote-workspace.d.ts +76 -0
  42. package/dist/lib/run-routing.d.ts +1 -0
  43. package/dist/lib/run-state.d.ts +3 -0
  44. package/dist/lib/skillinfo.d.ts +1 -1
  45. package/dist/mcp/helpers.d.ts +22 -0
  46. package/dist/mcp/index.d.ts +16 -0
  47. package/dist/mcp/remote-customer-tools.d.ts +2 -0
  48. package/dist/sdk/governance-store.d.ts +1 -0
  49. package/dist/sdk/index.d.ts +8 -1
  50. package/dist/sdk/index.js +1994 -416
  51. package/dist/sdk/outputs.d.ts +0 -11
  52. package/dist/sdk/runs.d.ts +5 -5
  53. package/dist/storage.js +6 -40
  54. package/docs/skill-standard.md +30 -2
  55. package/package.json +7 -6
package/bin/migrate.js CHANGED
@@ -4,6 +4,130 @@
4
4
  // src/server/migrate.ts
5
5
  import { existsSync as existsSync4, readdirSync as readdirSync3, readFileSync as readFileSync3 } from "fs";
6
6
  import { join as join6 } from "path";
7
+ // package.json
8
+ var package_default = {
9
+ name: "@hasna/skills",
10
+ version: "0.5.0",
11
+ description: "Skills library for AI coding agents",
12
+ type: "module",
13
+ bin: {
14
+ skills: "bin/index.js",
15
+ "skills-mcp": "bin/mcp.js",
16
+ "skills-serve": "bin/server.js",
17
+ "skills-server": "bin/server.js",
18
+ "skills-worker": "bin/worker.js",
19
+ "skills-migrate": "bin/migrate.js"
20
+ },
21
+ exports: {
22
+ ".": {
23
+ import: "./dist/index.js",
24
+ types: "./dist/index.d.ts"
25
+ },
26
+ "./storage": {
27
+ import: "./dist/storage.js",
28
+ types: "./dist/storage.d.ts"
29
+ },
30
+ "./sdk": {
31
+ import: "./dist/sdk/index.js",
32
+ types: "./dist/sdk/index.d.ts"
33
+ },
34
+ "./admin-contract": {
35
+ import: "./dist/admin-contract.js",
36
+ types: "./dist/admin-contract.d.ts"
37
+ }
38
+ },
39
+ files: [
40
+ "dist/",
41
+ "!dist/**/*.test.d.ts",
42
+ "!dist/**/*.fixture.d.ts",
43
+ "!dist/test-preload.d.ts",
44
+ "!dist/platform",
45
+ "bin/",
46
+ "migrations/",
47
+ "docs/skill-standard.md",
48
+ "schemas/",
49
+ "LICENSE",
50
+ "README.md"
51
+ ],
52
+ main: "./dist/index.js",
53
+ types: "./dist/index.d.ts",
54
+ scripts: {
55
+ clean: "rm -rf bin/ dist/",
56
+ build: "bun run clean && bun build ./src/cli/index.tsx --outdir ./bin --target bun && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/server/index.ts --outfile ./bin/server.js --target bun && bun build ./src/server/worker.ts --outfile ./bin/worker.js --target bun && bun build ./src/server/migrate.ts --outfile ./bin/migrate.js --target bun && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts ./src/admin-contract.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
57
+ "build:js": "rm -rf dist && bun build ./src/index.ts ./src/storage.ts ./src/sdk/index.ts ./src/admin-contract.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
58
+ test: "bun test --timeout 30000",
59
+ dev: "bun run ./src/cli/index.tsx",
60
+ "dev:watch": "bun --watch run ./src/cli/index.tsx",
61
+ "dev:mcp": "bun --watch run ./src/mcp/index.ts",
62
+ "dev:server": "bun --watch run ./src/server/index.ts",
63
+ "dev:worker": "bun --watch run ./src/server/worker.ts",
64
+ "docker:check": "bash scripts/docker-build-check.sh",
65
+ migrate: "bun run ./src/server/migrate.ts",
66
+ typecheck: "tsc --noEmit",
67
+ "verify:release": "bun run scripts/release-guard.ts",
68
+ "verify:consumer-types": "bun run scripts/consumer-types.ts",
69
+ prepare: "bun run build:js",
70
+ prepack: "bun run build && bun run verify:release && bun run verify:consumer-types",
71
+ prepublishOnly: "bun run typecheck && bun run test"
72
+ },
73
+ keywords: [
74
+ "skills",
75
+ "ai",
76
+ "agent",
77
+ "cli",
78
+ "typescript",
79
+ "bun",
80
+ "claude",
81
+ "codex",
82
+ "gemini",
83
+ "mcp",
84
+ "model-context-protocol",
85
+ "open-source",
86
+ "skills-library",
87
+ "automation"
88
+ ],
89
+ author: "Hasna",
90
+ license: "Apache-2.0",
91
+ devDependencies: {
92
+ "@hasna/contracts": "1.0.2",
93
+ "@types/bun": "1.3.14",
94
+ "@types/node": "25.2.3",
95
+ "@types/react": "^18.2.0",
96
+ "bun-types": "1.3.14",
97
+ "react-devtools-core": "^7.0.1",
98
+ typescript: "^5",
99
+ yaml: "^2.9.0"
100
+ },
101
+ dependencies: {
102
+ "@aws-sdk/client-ecs": "^3.1079.0",
103
+ "@aws-sdk/client-s3": "^3.1079.0",
104
+ "@hasna/events": "0.1.18",
105
+ "@modelcontextprotocol/sdk": "^1.26.0",
106
+ chalk: "^5.3.0",
107
+ commander: "^12.1.0",
108
+ ink: "^5.0.1",
109
+ "ink-select-input": "^6.0.0",
110
+ "ink-spinner": "^5.0.0",
111
+ "ink-text-input": "^6.0.0",
112
+ react: "^18.2.0",
113
+ zod: "^4.3.6"
114
+ },
115
+ engines: {
116
+ bun: ">=1.0.0"
117
+ },
118
+ publishConfig: {
119
+ registry: "https://registry.npmjs.org",
120
+ access: "public"
121
+ },
122
+ repository: {
123
+ type: "git",
124
+ url: "git+https://github.com/hasna/apps.git"
125
+ },
126
+ homepage: "https://github.com/hasna/skills",
127
+ bugs: {
128
+ url: "https://github.com/hasna/skills/issues"
129
+ }
130
+ };
7
131
 
8
132
  // src/lib/retired-settings.ts
9
133
  var RETIRED_ENV_SUFFIXES = ["_STORAGE_MODE", "_DEPLOYMENT_MODE", "_CLOUD_MODE"];
@@ -100,12 +224,7 @@ import { homedir } from "os";
100
224
  import { join, resolve } from "path";
101
225
  import { homedir as pathsResolverHomedir } from "os";
102
226
  import { join as pathsResolverJoin } from "path";
103
- var PATHS_RESOLVER_KIND_ENV = {
104
- config: "HASNA_CONFIG_HOME",
105
- data: "HASNA_DATA_HOME",
106
- state: "HASNA_STATE_HOME",
107
- cache: "HASNA_CACHE_HOME"
108
- };
227
+ var PATHS_RESOLVER_DATA_ENV = "HASNA_DATA_HOME";
109
228
  var PATHS_RESOLVER_APP_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
110
229
  function pathsResolverAssertApp(app) {
111
230
  if (typeof app !== "string" || app.length === 0) {
@@ -115,48 +234,19 @@ function pathsResolverAssertApp(app) {
115
234
  throw new TypeError(`paths: invalid app slug "${app}" \u2014 expected lowercase kebab-case ([a-z0-9]+(-[a-z0-9]+)*)`);
116
235
  }
117
236
  }
118
- function pathsResolverAssertKind(kind) {
119
- if (!Object.keys(PATHS_RESOLVER_KIND_ENV).includes(kind)) {
120
- throw new TypeError(`paths: invalid path kind "${kind}" \u2014 expected one of ${Object.keys(PATHS_RESOLVER_KIND_ENV).join(", ")}`);
121
- }
122
- }
123
- function pathsResolverBaseDir(kind, options) {
124
- pathsResolverAssertKind(kind);
237
+ function pathsResolverDataBaseDir(options) {
125
238
  const env = options.env ?? process.env;
126
- const override = env[PATHS_RESOLVER_KIND_ENV[kind]];
239
+ const override = env[PATHS_RESOLVER_DATA_ENV];
127
240
  if (typeof override === "string" && override.length > 0)
128
241
  return override;
129
242
  const home = options.home ?? pathsResolverHomedir();
130
243
  const platform = options.platform ?? process.platform;
131
- if (platform === "darwin") {
132
- switch (kind) {
133
- case "config":
134
- case "data":
135
- return pathsResolverJoin(home, "Library", "Application Support", "Hasna");
136
- case "cache":
137
- return pathsResolverJoin(home, "Library", "Caches", "Hasna");
138
- case "state":
139
- return pathsResolverJoin(home, "Library", "Logs", "Hasna");
140
- }
141
- }
142
- switch (kind) {
143
- case "config":
144
- return pathsResolverJoin(home, ".config", "hasna");
145
- case "data":
146
- return pathsResolverJoin(home, ".local", "share", "hasna");
147
- case "state":
148
- return pathsResolverJoin(home, ".local", "state", "hasna");
149
- case "cache":
150
- return pathsResolverJoin(home, ".cache", "hasna");
151
- }
244
+ return platform === "darwin" ? pathsResolverJoin(home, "Library", "Application Support", "Hasna") : pathsResolverJoin(home, ".local", "share", "hasna");
152
245
  }
153
- function pathsResolverResolve(kind, options) {
246
+ function dataDir(options) {
154
247
  pathsResolverAssertApp(options.app);
155
248
  const appSegment = options.internal === true ? pathsResolverJoin("internal", options.app) : options.app;
156
- return pathsResolverJoin(pathsResolverBaseDir(kind, options), appSegment);
157
- }
158
- function dataDir(options) {
159
- return pathsResolverResolve("data", options);
249
+ return pathsResolverJoin(pathsResolverDataBaseDir(options), appSegment);
160
250
  }
161
251
  var DATA_DIR_ENV = "HASNA_SKILLS_DIR";
162
252
  var HASNA_SKILLS_HOME_ENV = "HASNA_SKILLS_HOME";
@@ -1392,6 +1482,24 @@ async function runPostgresMigrations(databaseUrl, migrationsDir) {
1392
1482
  }
1393
1483
  }
1394
1484
  if (import.meta.main) {
1485
+ const EARLY_ARGV = process.argv.slice(2);
1486
+ if (EARLY_ARGV.includes("--version") || EARLY_ARGV.includes("-V")) {
1487
+ console.log(package_default.version);
1488
+ process.exit(0);
1489
+ }
1490
+ if (EARLY_ARGV.includes("--help") || EARLY_ARGV.includes("-h")) {
1491
+ console.log(`Usage: skills-migrate [options]
1492
+
1493
+ Applies pending schema migrations to the configured @hasna/skills database.
1494
+
1495
+ Options:
1496
+ -V, --version output the version number
1497
+ -h, --help display help for command
1498
+
1499
+ Environment:
1500
+ HASNA_SKILLS_DATABASE_URL The database to migrate (required; DATABASE_URL is accepted)`);
1501
+ process.exit(0);
1502
+ }
1395
1503
  const config = resolveServerConfig();
1396
1504
  if (!config.databaseUrl) {
1397
1505
  throw new Error("HASNA_SKILLS_DATABASE_URL or DATABASE_URL is required for migrations. " + "SQLite databases migrate themselves when the server opens them, so there is nothing to do here " + "unless you are naming a target explicitly.");
package/bin/server.js CHANGED
@@ -23100,7 +23100,7 @@ var init_dist_es9 = __esm(() => {
23100
23100
  // package.json
23101
23101
  var package_default = {
23102
23102
  name: "@hasna/skills",
23103
- version: "0.3.0",
23103
+ version: "0.5.0",
23104
23104
  description: "Skills library for AI coding agents",
23105
23105
  type: "module",
23106
23106
  bin: {
@@ -23132,6 +23132,7 @@ var package_default = {
23132
23132
  files: [
23133
23133
  "dist/",
23134
23134
  "!dist/**/*.test.d.ts",
23135
+ "!dist/**/*.fixture.d.ts",
23135
23136
  "!dist/test-preload.d.ts",
23136
23137
  "!dist/platform",
23137
23138
  "bin/",
@@ -23157,10 +23158,10 @@ var package_default = {
23157
23158
  migrate: "bun run ./src/server/migrate.ts",
23158
23159
  typecheck: "tsc --noEmit",
23159
23160
  "verify:release": "bun run scripts/release-guard.ts",
23161
+ "verify:consumer-types": "bun run scripts/consumer-types.ts",
23160
23162
  prepare: "bun run build:js",
23161
- prepack: "bun run build && bun run verify:release",
23162
- prepublishOnly: "bun run typecheck && bun run test",
23163
- postinstall: "mkdir -p $HOME/.hasna/skills/custom 2>/dev/null || true"
23163
+ prepack: "bun run build && bun run verify:release && bun run verify:consumer-types",
23164
+ prepublishOnly: "bun run typecheck && bun run test"
23164
23165
  },
23165
23166
  keywords: [
23166
23167
  "skills",
@@ -23181,6 +23182,7 @@ var package_default = {
23181
23182
  author: "Hasna",
23182
23183
  license: "Apache-2.0",
23183
23184
  devDependencies: {
23185
+ "@hasna/contracts": "1.0.2",
23184
23186
  "@types/bun": "1.3.14",
23185
23187
  "@types/node": "25.2.3",
23186
23188
  "@types/react": "^18.2.0",
@@ -23192,8 +23194,7 @@ var package_default = {
23192
23194
  dependencies: {
23193
23195
  "@aws-sdk/client-ecs": "^3.1079.0",
23194
23196
  "@aws-sdk/client-s3": "^3.1079.0",
23195
- "@hasna/contracts": "1.0.1",
23196
- "@hasna/events": "0.1.16",
23197
+ "@hasna/events": "0.1.18",
23197
23198
  "@modelcontextprotocol/sdk": "^1.26.0",
23198
23199
  chalk: "^5.3.0",
23199
23200
  commander: "^12.1.0",
@@ -23902,7 +23903,7 @@ var $NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS = NODE_RESPONSE_CHECKSUM_V
23902
23903
  var $getFlexibleChecksumsPlugin = getFlexibleChecksumsPlugin;
23903
23904
  var $resolveFlexibleChecksumsConfig = resolveFlexibleChecksumsConfig;
23904
23905
 
23905
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
23906
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
23906
23907
  var import_client23 = __toESM(require_client2(), 1);
23907
23908
 
23908
23909
  // ../../node_modules/.bun/@aws-sdk+middleware-sdk-s3@3.972.75/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/submodules/s3/index.js
@@ -24510,7 +24511,7 @@ var $getThrow200ExceptionsPlugin = getThrow200ExceptionsPlugin;
24510
24511
  var $getValidateBucketNamePlugin = getValidateBucketNamePlugin;
24511
24512
  var $resolveS3Config = resolveS3Config;
24512
24513
 
24513
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
24514
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
24514
24515
  var import_core = __toESM(require_dist_cjs2(), 1);
24515
24516
  var import_client24 = __toESM(require_client(), 1);
24516
24517
  var import_config29 = __toESM(require_config(), 1);
@@ -24520,17 +24521,17 @@ var import_protocols6 = __toESM(require_protocols(), 1);
24520
24521
  var import_retry4 = __toESM(require_retry(), 1);
24521
24522
  var import_schema2 = __toESM(require_schema(), 1);
24522
24523
 
24523
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthSchemeProvider.js
24524
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthSchemeProvider.js
24524
24525
  var import_httpAuthSchemes = __toESM(require_httpAuthSchemes(), 1);
24525
24526
  var import_signature_v4_multi_region = __toESM(require_dist_cjs4(), 1);
24526
24527
  var import_client2 = __toESM(require_client(), 1);
24527
24528
  var import_endpoints3 = __toESM(require_endpoints(), 1);
24528
24529
 
24529
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/endpointResolver.js
24530
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/endpointResolver.js
24530
24531
  var import_client = __toESM(require_client2(), 1);
24531
24532
  var import_endpoints2 = __toESM(require_endpoints(), 1);
24532
24533
 
24533
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/bdd.js
24534
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/bdd.js
24534
24535
  var import_endpoints = __toESM(require_endpoints(), 1);
24535
24536
  var aw = "ref";
24536
24537
  var ax = "argv";
@@ -26474,7 +26475,7 @@ var nodes = new Int32Array([
26474
26475
  ]);
26475
26476
  var bdd = import_endpoints.BinaryDecisionDiagram.from(nodes, root, _data.conditions, _data.results);
26476
26477
 
26477
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/endpointResolver.js
26478
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/endpointResolver.js
26478
26479
  var cache = new import_endpoints2.EndpointCache({
26479
26480
  size: 50,
26480
26481
  params: [
@@ -26502,7 +26503,7 @@ var defaultEndpointResolver = (endpointParams, context = {}) => {
26502
26503
  };
26503
26504
  import_endpoints2.customEndpointFunctions.aws = import_client.awsEndpointFunctions;
26504
26505
 
26505
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthSchemeProvider.js
26506
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthSchemeProvider.js
26506
26507
  var createEndpointRuleSetHttpAuthSchemeParametersProvider = (defaultHttpAuthSchemeParametersProvider) => async (config, context, input) => {
26507
26508
  if (!input) {
26508
26509
  throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");
@@ -26618,11 +26619,11 @@ var resolveHttpAuthSchemeConfig = (config) => {
26618
26619
  });
26619
26620
  };
26620
26621
 
26621
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commandBuilder.js
26622
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commandBuilder.js
26622
26623
  var import_client3 = __toESM(require_client(), 1);
26623
26624
  var import_endpoints4 = __toESM(require_endpoints(), 1);
26624
26625
 
26625
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/EndpointParameters.js
26626
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/EndpointParameters.js
26626
26627
  var resolveClientEndpointParameters = (options) => {
26627
26628
  return Object.assign(options, {
26628
26629
  useFipsEndpoint: options.useFipsEndpoint ?? false,
@@ -26648,7 +26649,7 @@ var commonParams = {
26648
26649
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
26649
26650
  };
26650
26651
 
26651
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commandBuilder.js
26652
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commandBuilder.js
26652
26653
  var command = import_client3.makeBuilder(commonParams, "AmazonS3", "S3Client", import_endpoints4.getEndpointPlugin);
26653
26654
  var _ep0 = {
26654
26655
  Bucket: { type: "contextParams", name: "Bucket" },
@@ -26680,10 +26681,10 @@ var _mw11 = (Command, cs, config, o2) => [
26680
26681
  $getSsecPlugin(config)
26681
26682
  ];
26682
26683
 
26683
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/schemas/schemas_0.js
26684
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/schemas/schemas_0.js
26684
26685
  var import_schema = __toESM(require_schema(), 1);
26685
26686
 
26686
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/models/S3ServiceException.js
26687
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/models/S3ServiceException.js
26687
26688
  var import_client4 = __toESM(require_client(), 1);
26688
26689
  class S3ServiceException extends import_client4.ServiceException {
26689
26690
  constructor(options) {
@@ -26692,7 +26693,7 @@ class S3ServiceException extends import_client4.ServiceException {
26692
26693
  }
26693
26694
  }
26694
26695
 
26695
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/models/errors.js
26696
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/models/errors.js
26696
26697
  class NoSuchUpload extends S3ServiceException {
26697
26698
  name = "NoSuchUpload";
26698
26699
  $fault = "client";
@@ -26970,7 +26971,7 @@ class ObjectAlreadyInActiveTierError extends S3ServiceException {
26970
26971
  }
26971
26972
  }
26972
26973
 
26973
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/schemas/schemas_0.js
26974
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/schemas/schemas_0.js
26974
26975
  var _A = "Account";
26975
26976
  var _AAO = "AnalyticsAndOperator";
26976
26977
  var _AC = "AccelerateConfiguration";
@@ -32422,13 +32423,13 @@ var WriteGetObjectResponse$ = [
32422
32423
  () => __Unit
32423
32424
  ];
32424
32425
 
32425
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commands/CreateSessionCommand.js
32426
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commands/CreateSessionCommand.js
32426
32427
  class CreateSessionCommand extends command(_ep4, _mw0, "CreateSession", CreateSession$) {
32427
32428
  }
32428
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/package.json
32429
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/package.json
32429
32430
  var package_default2 = {
32430
32431
  name: "@aws-sdk/client-s3",
32431
- version: "3.1126.0",
32432
+ version: "3.1127.0",
32432
32433
  description: "AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native",
32433
32434
  homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3",
32434
32435
  license: "Apache-2.0",
@@ -32495,7 +32496,7 @@ var package_default2 = {
32495
32496
  tslib: "^2.6.2"
32496
32497
  },
32497
32498
  devDependencies: {
32498
- "@aws-sdk/signature-v4-crt": "3.1126.0",
32499
+ "@aws-sdk/signature-v4-crt": "3.1127.0",
32499
32500
  "@smithy/snapshot-testing": "^2.3.2",
32500
32501
  "@tsconfig/node20": "20.1.8",
32501
32502
  "@types/node": "^20.14.8",
@@ -32510,7 +32511,7 @@ var package_default2 = {
32510
32511
  }
32511
32512
  };
32512
32513
 
32513
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
32514
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
32514
32515
  var import_client19 = __toESM(require_client2(), 1);
32515
32516
  var import_httpAuthSchemes3 = __toESM(require_httpAuthSchemes(), 1);
32516
32517
 
@@ -32667,7 +32668,7 @@ var defaultProvider = (init = {}) => memoizeChain([
32667
32668
  }
32668
32669
  ], credentialsTreatedAsExpired);
32669
32670
  var credentialsTreatedAsExpired = (credentials) => credentials?.expiration !== undefined && credentials.expiration.getTime() - Date.now() < 300000;
32670
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
32671
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
32671
32672
  var import_checksum2 = __toESM(require_checksum(), 1);
32672
32673
  var import_client20 = __toESM(require_client(), 1);
32673
32674
  var import_config28 = __toESM(require_config(), 1);
@@ -32905,7 +32906,7 @@ var subtle = typeof digest === "function" && typeof sign2 === "function" && type
32905
32906
  var MAX_PENDING_BYTES = 8 * 1024 * 1024;
32906
32907
  var $Sha1 = Sha1Node;
32907
32908
 
32908
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.shared.js
32909
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.shared.js
32909
32910
  var import_httpAuthSchemes2 = __toESM(require_httpAuthSchemes(), 1);
32910
32911
  var import_signature_v4_multi_region2 = __toESM(require_dist_cjs4(), 1);
32911
32912
  var import_checksum = __toESM(require_checksum(), 1);
@@ -32957,7 +32958,7 @@ var getRuntimeConfig2 = (config) => {
32957
32958
  };
32958
32959
  };
32959
32960
 
32960
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
32961
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
32961
32962
  var getRuntimeConfig3 = (config) => {
32962
32963
  import_client20.emitWarningIfUnsupportedVersion(process.version);
32963
32964
  const defaultsMode = import_config28.resolveDefaultsModeConfig(config);
@@ -32998,12 +32999,12 @@ var getRuntimeConfig3 = (config) => {
32998
32999
  };
32999
33000
  };
33000
33001
 
33001
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeExtensions.js
33002
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeExtensions.js
33002
33003
  var import_client21 = __toESM(require_client2(), 1);
33003
33004
  var import_client22 = __toESM(require_client(), 1);
33004
33005
  var import_protocols5 = __toESM(require_protocols(), 1);
33005
33006
 
33006
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthExtensionConfiguration.js
33007
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthExtensionConfiguration.js
33007
33008
  var getHttpAuthExtensionConfiguration2 = (runtimeConfig) => {
33008
33009
  const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
33009
33010
  let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
@@ -33042,14 +33043,14 @@ var resolveHttpAuthRuntimeConfig2 = (config) => {
33042
33043
  };
33043
33044
  };
33044
33045
 
33045
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeExtensions.js
33046
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeExtensions.js
33046
33047
  var resolveRuntimeExtensions2 = (runtimeConfig, extensions) => {
33047
33048
  const extensionConfiguration = Object.assign(import_client21.getAwsRegionExtensionConfiguration(runtimeConfig), import_client22.getDefaultExtensionConfiguration(runtimeConfig), import_protocols5.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration2(runtimeConfig));
33048
33049
  extensions.forEach((extension) => extension.configure(extensionConfiguration));
33049
33050
  return Object.assign(runtimeConfig, import_client21.resolveAwsRegionExtensionConfiguration(extensionConfiguration), import_client22.resolveDefaultRuntimeConfig(extensionConfiguration), import_protocols5.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig2(extensionConfiguration));
33050
33051
  };
33051
33052
 
33052
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
33053
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
33053
33054
  class S3Client extends import_client24.Client {
33054
33055
  config;
33055
33056
  constructor(...[configuration]) {
@@ -33094,15 +33095,15 @@ class S3Client extends import_client24.Client {
33094
33095
  }
33095
33096
  }
33096
33097
 
33097
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commands/DeleteObjectCommand.js
33098
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commands/DeleteObjectCommand.js
33098
33099
  class DeleteObjectCommand extends command(_ep0, _mw0, "DeleteObject", DeleteObject$) {
33099
33100
  }
33100
33101
 
33101
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commands/GetObjectCommand.js
33102
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commands/GetObjectCommand.js
33102
33103
  class GetObjectCommand extends command(_ep0, _mw7, "GetObject", GetObject$) {
33103
33104
  }
33104
33105
 
33105
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commands/PutObjectCommand.js
33106
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commands/PutObjectCommand.js
33106
33107
  class PutObjectCommand extends command(_ep0, _mw11, "PutObject", PutObject$) {
33107
33108
  }
33108
33109
 
@@ -33503,12 +33504,7 @@ import { homedir as homedir2 } from "os";
33503
33504
  import { join as join3, resolve } from "path";
33504
33505
  import { homedir as pathsResolverHomedir } from "os";
33505
33506
  import { join as pathsResolverJoin } from "path";
33506
- var PATHS_RESOLVER_KIND_ENV = {
33507
- config: "HASNA_CONFIG_HOME",
33508
- data: "HASNA_DATA_HOME",
33509
- state: "HASNA_STATE_HOME",
33510
- cache: "HASNA_CACHE_HOME"
33511
- };
33507
+ var PATHS_RESOLVER_DATA_ENV = "HASNA_DATA_HOME";
33512
33508
  var PATHS_RESOLVER_APP_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
33513
33509
  function pathsResolverAssertApp(app) {
33514
33510
  if (typeof app !== "string" || app.length === 0) {
@@ -33518,48 +33514,19 @@ function pathsResolverAssertApp(app) {
33518
33514
  throw new TypeError(`paths: invalid app slug "${app}" \u2014 expected lowercase kebab-case ([a-z0-9]+(-[a-z0-9]+)*)`);
33519
33515
  }
33520
33516
  }
33521
- function pathsResolverAssertKind(kind) {
33522
- if (!Object.keys(PATHS_RESOLVER_KIND_ENV).includes(kind)) {
33523
- throw new TypeError(`paths: invalid path kind "${kind}" \u2014 expected one of ${Object.keys(PATHS_RESOLVER_KIND_ENV).join(", ")}`);
33524
- }
33525
- }
33526
- function pathsResolverBaseDir(kind, options) {
33527
- pathsResolverAssertKind(kind);
33517
+ function pathsResolverDataBaseDir(options) {
33528
33518
  const env = options.env ?? process.env;
33529
- const override = env[PATHS_RESOLVER_KIND_ENV[kind]];
33519
+ const override = env[PATHS_RESOLVER_DATA_ENV];
33530
33520
  if (typeof override === "string" && override.length > 0)
33531
33521
  return override;
33532
33522
  const home = options.home ?? pathsResolverHomedir();
33533
33523
  const platform = options.platform ?? process.platform;
33534
- if (platform === "darwin") {
33535
- switch (kind) {
33536
- case "config":
33537
- case "data":
33538
- return pathsResolverJoin(home, "Library", "Application Support", "Hasna");
33539
- case "cache":
33540
- return pathsResolverJoin(home, "Library", "Caches", "Hasna");
33541
- case "state":
33542
- return pathsResolverJoin(home, "Library", "Logs", "Hasna");
33543
- }
33544
- }
33545
- switch (kind) {
33546
- case "config":
33547
- return pathsResolverJoin(home, ".config", "hasna");
33548
- case "data":
33549
- return pathsResolverJoin(home, ".local", "share", "hasna");
33550
- case "state":
33551
- return pathsResolverJoin(home, ".local", "state", "hasna");
33552
- case "cache":
33553
- return pathsResolverJoin(home, ".cache", "hasna");
33554
- }
33555
- }
33556
- function pathsResolverResolve(kind, options) {
33557
- pathsResolverAssertApp(options.app);
33558
- const appSegment = options.internal === true ? pathsResolverJoin("internal", options.app) : options.app;
33559
- return pathsResolverJoin(pathsResolverBaseDir(kind, options), appSegment);
33524
+ return platform === "darwin" ? pathsResolverJoin(home, "Library", "Application Support", "Hasna") : pathsResolverJoin(home, ".local", "share", "hasna");
33560
33525
  }
33561
33526
  function dataDir(options) {
33562
- return pathsResolverResolve("data", options);
33527
+ pathsResolverAssertApp(options.app);
33528
+ const appSegment = options.internal === true ? pathsResolverJoin("internal", options.app) : options.app;
33529
+ return pathsResolverJoin(pathsResolverDataBaseDir(options), appSegment);
33563
33530
  }
33564
33531
  var DATA_DIR_ENV = "HASNA_SKILLS_DIR";
33565
33532
  var HASNA_SKILLS_HOME_ENV = "HASNA_SKILLS_HOME";
@@ -34757,13 +34724,12 @@ class SqliteGovernanceStore {
34757
34724
  return rows.map((row) => this.reservationFrom(row));
34758
34725
  }
34759
34726
  async reconcileReservation(reservationId2, actualCents, status) {
34760
- const row = this.db.query("SELECT * FROM skills_credit_reservations WHERE id = ? LIMIT 1").get(reservationId2);
34761
- if (!row || String(row.status) !== "reserved")
34762
- return row ? this.reservationFrom(row) : null;
34763
- const reconciledAt = nowIso();
34764
- this.db.run("UPDATE skills_credit_reservations SET actual_cents = ?, status = ?, reconciled_at = ? WHERE id = ?", [actualCents, status, reconciledAt, reservationId2]);
34765
- const updated = this.db.query("SELECT * FROM skills_credit_reservations WHERE id = ? LIMIT 1").get(reservationId2);
34766
- return this.reservationFrom(updated);
34727
+ const updated = this.db.query(`UPDATE skills_credit_reservations SET actual_cents = ?, status = ?, reconciled_at = ?
34728
+ WHERE id = ? AND status = 'reserved' RETURNING *`).get(actualCents, status, nowIso(), reservationId2);
34729
+ if (updated)
34730
+ return this.reservationFrom(updated);
34731
+ const existing = this.db.query("SELECT * FROM skills_credit_reservations WHERE id = ? LIMIT 1").get(reservationId2);
34732
+ return existing ? this.reservationFrom(existing) : null;
34767
34733
  }
34768
34734
  async monthlySpendCents(orgId, monthPrefix) {
34769
34735
  const from = `${monthPrefix}-01T00:00:00.000Z`;
@@ -35755,6 +35721,16 @@ var KNOWN_TOP_LEVEL_ENTRIES = new Set([
35755
35721
  "vision.ts"
35756
35722
  ]);
35757
35723
  var VALID_PROVENANCE_SOURCES = new Set(["official", "custom", "remote", "private", "private-hosted", "upstream", "extension"]);
35724
+ function frontmatterString(raw) {
35725
+ if (raw.startsWith('"') && raw.endsWith('"')) {
35726
+ try {
35727
+ const decoded = JSON.parse(raw);
35728
+ if (typeof decoded === "string")
35729
+ return decoded;
35730
+ } catch {}
35731
+ }
35732
+ return raw.replace(/^["']|["']$/g, "");
35733
+ }
35758
35734
  function parseSkillFrontmatter(content) {
35759
35735
  const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
35760
35736
  if (!match)
@@ -35774,12 +35750,12 @@ function parseSkillFrontmatter(content) {
35774
35750
  const tags = [];
35775
35751
  while (i3 + 1 < lines.length && /^\s+-\s+/.test(lines[i3 + 1])) {
35776
35752
  i3++;
35777
- tags.push(lines[i3].replace(/^\s+-\s+/, "").trim());
35753
+ tags.push(frontmatterString(lines[i3].replace(/^\s+-\s+/, "").trim()));
35778
35754
  }
35779
35755
  result.tags = tags;
35780
35756
  continue;
35781
35757
  }
35782
- const value = rawValue.replace(/^["']|["']$/g, "");
35758
+ const value = frontmatterString(rawValue);
35783
35759
  if (!value)
35784
35760
  continue;
35785
35761
  if (key === "name")
@@ -35849,13 +35825,16 @@ function normalizePortableSkillName(name) {
35849
35825
  return normalized;
35850
35826
  }
35851
35827
  function readPortableSkillManifest(skillPath, fallbackName = basename(skillPath)) {
35828
+ return readManifest(skillPath, fallbackName, normalizePortableSkillName);
35829
+ }
35830
+ function readManifest(skillPath, fallbackName, normalizeName) {
35852
35831
  const skillJsonPath = join9(skillPath, "skill.json");
35853
35832
  const skillMdPath = join9(skillPath, "SKILL.md");
35854
35833
  const pkgPath = join9(skillPath, "package.json");
35855
35834
  const jsonManifest = existsSync5(skillJsonPath) ? readJsonObject(skillJsonPath) : undefined;
35856
35835
  const frontmatter = existsSync5(skillMdPath) ? parseSkillFrontmatter(readFileSync6(skillMdPath, "utf-8")) ?? undefined : undefined;
35857
35836
  const pkg = existsSync5(pkgPath) ? readJsonObject(pkgPath) : undefined;
35858
- const name = normalizePortableSkillName(stringField(jsonManifest, "name") ?? frontmatter?.name ?? stringValue(pkg?.name) ?? fallbackName);
35837
+ const name = normalizeName(stringField(jsonManifest, "name") ?? frontmatter?.name ?? stringValue(pkg?.name) ?? fallbackName);
35859
35838
  const description = stringField(jsonManifest, "description") ?? frontmatter?.description ?? stringValue(pkg?.description) ?? `${name} skill`;
35860
35839
  const version2 = readDeclaredSkillVersion(skillPath) ?? PORTABLE_SKILL_DEFAULT_VERSION;
35861
35840
  const kind = parseSkillKind(stringField(jsonManifest, "kind") ?? frontmatter?.kind);
@@ -36625,7 +36604,7 @@ async function getMergedSkill(store, artifactStorage, principal, slug) {
36625
36604
  if (resolved.kind === "published")
36626
36605
  return publishedPayload(resolved.record);
36627
36606
  const bundled = getServerSkill(slug);
36628
- return bundled ? bundled : null;
36607
+ return bundled ? { ...bundled, publicationState: "catalogue-only", revisionId: null } : null;
36629
36608
  }
36630
36609
  async function getMergedSkillMd(store, artifactStorage, principal, slug) {
36631
36610
  const resolved = await resolvePublishedSkill(store, artifactStorage, principal, slug);