@hasna/skills 0.4.0 → 0.5.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.
Files changed (48) hide show
  1. package/README.md +220 -5
  2. package/bin/index.js +7747 -5645
  3. package/bin/mcp.js +1493 -431
  4. package/bin/migrate.js +148 -40
  5. package/bin/server.js +53 -83
  6. package/bin/worker.js +41 -73
  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/tool-primitives.d.ts +1 -1
  13. package/dist/cli/commands/workspace-member-mutations.d.ts +2 -0
  14. package/dist/cli/commands/workspace-members.d.ts +2 -0
  15. package/dist/cli/commands/workspace-selection.d.ts +11 -0
  16. package/dist/cli/env-assignment.d.ts +9 -0
  17. package/dist/index.d.ts +8 -2
  18. package/dist/index.js +841 -167
  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/client-types.d.ts +75 -0
  23. package/dist/lib/credential-state.d.ts +12 -0
  24. package/dist/lib/fleet-credentials.d.ts +41 -15
  25. package/dist/lib/home-adoption.d.ts +2 -0
  26. package/dist/lib/home-census.d.ts +3 -1
  27. package/dist/lib/local-opt-in.d.ts +24 -0
  28. package/dist/lib/portable-skills-files.d.ts +6 -2
  29. package/dist/lib/read-access.d.ts +83 -0
  30. package/dist/lib/remote-auth.d.ts +23 -3
  31. package/dist/lib/remote-client.d.ts +45 -5
  32. package/dist/lib/remote-profile.d.ts +26 -0
  33. package/dist/lib/remote-registry.d.ts +7 -3
  34. package/dist/lib/remote-workspace-selection.d.ts +58 -0
  35. package/dist/lib/remote-workspace.d.ts +76 -0
  36. package/dist/lib/skillinfo.d.ts +1 -1
  37. package/dist/lib/workspace-profile.d.ts +49 -0
  38. package/dist/mcp/helpers.d.ts +22 -0
  39. package/dist/mcp/index.d.ts +16 -0
  40. package/dist/sdk/governance-store.d.ts +1 -0
  41. package/dist/sdk/index.d.ts +8 -2
  42. package/dist/sdk/index.js +1312 -297
  43. package/dist/sdk/outputs.d.ts +0 -11
  44. package/dist/sdk/runs.d.ts +1 -1
  45. package/dist/storage.js +6 -40
  46. package/docs/skill-standard.md +30 -2
  47. package/package.json +6 -4
  48. package/dist/lib/instance-credentials-race.fixture.d.ts +0 -1
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.1",
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.4.0",
23103
+ version: "0.5.1",
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,8 +23158,9 @@ 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",
23163
+ prepack: "bun run build && bun run verify:release && bun run verify:consumer-types",
23162
23164
  prepublishOnly: "bun run typecheck && bun run test"
23163
23165
  },
23164
23166
  keywords: [
@@ -23180,6 +23182,7 @@ var package_default = {
23180
23182
  author: "Hasna",
23181
23183
  license: "Apache-2.0",
23182
23184
  devDependencies: {
23185
+ "@hasna/contracts": "1.0.2",
23183
23186
  "@types/bun": "1.3.14",
23184
23187
  "@types/node": "25.2.3",
23185
23188
  "@types/react": "^18.2.0",
@@ -23191,8 +23194,7 @@ var package_default = {
23191
23194
  dependencies: {
23192
23195
  "@aws-sdk/client-ecs": "^3.1079.0",
23193
23196
  "@aws-sdk/client-s3": "^3.1079.0",
23194
- "@hasna/contracts": "1.0.1",
23195
- "@hasna/events": "0.1.16",
23197
+ "@hasna/events": "0.1.18",
23196
23198
  "@modelcontextprotocol/sdk": "^1.26.0",
23197
23199
  chalk: "^5.3.0",
23198
23200
  commander: "^12.1.0",
@@ -23901,7 +23903,7 @@ var $NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS = NODE_RESPONSE_CHECKSUM_V
23901
23903
  var $getFlexibleChecksumsPlugin = getFlexibleChecksumsPlugin;
23902
23904
  var $resolveFlexibleChecksumsConfig = resolveFlexibleChecksumsConfig;
23903
23905
 
23904
- // ../../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
23905
23907
  var import_client23 = __toESM(require_client2(), 1);
23906
23908
 
23907
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
@@ -24509,7 +24511,7 @@ var $getThrow200ExceptionsPlugin = getThrow200ExceptionsPlugin;
24509
24511
  var $getValidateBucketNamePlugin = getValidateBucketNamePlugin;
24510
24512
  var $resolveS3Config = resolveS3Config;
24511
24513
 
24512
- // ../../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
24513
24515
  var import_core = __toESM(require_dist_cjs2(), 1);
24514
24516
  var import_client24 = __toESM(require_client(), 1);
24515
24517
  var import_config29 = __toESM(require_config(), 1);
@@ -24519,17 +24521,17 @@ var import_protocols6 = __toESM(require_protocols(), 1);
24519
24521
  var import_retry4 = __toESM(require_retry(), 1);
24520
24522
  var import_schema2 = __toESM(require_schema(), 1);
24521
24523
 
24522
- // ../../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
24523
24525
  var import_httpAuthSchemes = __toESM(require_httpAuthSchemes(), 1);
24524
24526
  var import_signature_v4_multi_region = __toESM(require_dist_cjs4(), 1);
24525
24527
  var import_client2 = __toESM(require_client(), 1);
24526
24528
  var import_endpoints3 = __toESM(require_endpoints(), 1);
24527
24529
 
24528
- // ../../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
24529
24531
  var import_client = __toESM(require_client2(), 1);
24530
24532
  var import_endpoints2 = __toESM(require_endpoints(), 1);
24531
24533
 
24532
- // ../../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
24533
24535
  var import_endpoints = __toESM(require_endpoints(), 1);
24534
24536
  var aw = "ref";
24535
24537
  var ax = "argv";
@@ -26473,7 +26475,7 @@ var nodes = new Int32Array([
26473
26475
  ]);
26474
26476
  var bdd = import_endpoints.BinaryDecisionDiagram.from(nodes, root, _data.conditions, _data.results);
26475
26477
 
26476
- // ../../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
26477
26479
  var cache = new import_endpoints2.EndpointCache({
26478
26480
  size: 50,
26479
26481
  params: [
@@ -26501,7 +26503,7 @@ var defaultEndpointResolver = (endpointParams, context = {}) => {
26501
26503
  };
26502
26504
  import_endpoints2.customEndpointFunctions.aws = import_client.awsEndpointFunctions;
26503
26505
 
26504
- // ../../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
26505
26507
  var createEndpointRuleSetHttpAuthSchemeParametersProvider = (defaultHttpAuthSchemeParametersProvider) => async (config, context, input) => {
26506
26508
  if (!input) {
26507
26509
  throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");
@@ -26617,11 +26619,11 @@ var resolveHttpAuthSchemeConfig = (config) => {
26617
26619
  });
26618
26620
  };
26619
26621
 
26620
- // ../../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
26621
26623
  var import_client3 = __toESM(require_client(), 1);
26622
26624
  var import_endpoints4 = __toESM(require_endpoints(), 1);
26623
26625
 
26624
- // ../../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
26625
26627
  var resolveClientEndpointParameters = (options) => {
26626
26628
  return Object.assign(options, {
26627
26629
  useFipsEndpoint: options.useFipsEndpoint ?? false,
@@ -26647,7 +26649,7 @@ var commonParams = {
26647
26649
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
26648
26650
  };
26649
26651
 
26650
- // ../../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
26651
26653
  var command = import_client3.makeBuilder(commonParams, "AmazonS3", "S3Client", import_endpoints4.getEndpointPlugin);
26652
26654
  var _ep0 = {
26653
26655
  Bucket: { type: "contextParams", name: "Bucket" },
@@ -26679,10 +26681,10 @@ var _mw11 = (Command, cs, config, o2) => [
26679
26681
  $getSsecPlugin(config)
26680
26682
  ];
26681
26683
 
26682
- // ../../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
26683
26685
  var import_schema = __toESM(require_schema(), 1);
26684
26686
 
26685
- // ../../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
26686
26688
  var import_client4 = __toESM(require_client(), 1);
26687
26689
  class S3ServiceException extends import_client4.ServiceException {
26688
26690
  constructor(options) {
@@ -26691,7 +26693,7 @@ class S3ServiceException extends import_client4.ServiceException {
26691
26693
  }
26692
26694
  }
26693
26695
 
26694
- // ../../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
26695
26697
  class NoSuchUpload extends S3ServiceException {
26696
26698
  name = "NoSuchUpload";
26697
26699
  $fault = "client";
@@ -26969,7 +26971,7 @@ class ObjectAlreadyInActiveTierError extends S3ServiceException {
26969
26971
  }
26970
26972
  }
26971
26973
 
26972
- // ../../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
26973
26975
  var _A = "Account";
26974
26976
  var _AAO = "AnalyticsAndOperator";
26975
26977
  var _AC = "AccelerateConfiguration";
@@ -32421,13 +32423,13 @@ var WriteGetObjectResponse$ = [
32421
32423
  () => __Unit
32422
32424
  ];
32423
32425
 
32424
- // ../../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
32425
32427
  class CreateSessionCommand extends command(_ep4, _mw0, "CreateSession", CreateSession$) {
32426
32428
  }
32427
- // ../../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
32428
32430
  var package_default2 = {
32429
32431
  name: "@aws-sdk/client-s3",
32430
- version: "3.1126.0",
32432
+ version: "3.1127.0",
32431
32433
  description: "AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native",
32432
32434
  homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3",
32433
32435
  license: "Apache-2.0",
@@ -32494,7 +32496,7 @@ var package_default2 = {
32494
32496
  tslib: "^2.6.2"
32495
32497
  },
32496
32498
  devDependencies: {
32497
- "@aws-sdk/signature-v4-crt": "3.1126.0",
32499
+ "@aws-sdk/signature-v4-crt": "3.1127.0",
32498
32500
  "@smithy/snapshot-testing": "^2.3.2",
32499
32501
  "@tsconfig/node20": "20.1.8",
32500
32502
  "@types/node": "^20.14.8",
@@ -32509,7 +32511,7 @@ var package_default2 = {
32509
32511
  }
32510
32512
  };
32511
32513
 
32512
- // ../../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
32513
32515
  var import_client19 = __toESM(require_client2(), 1);
32514
32516
  var import_httpAuthSchemes3 = __toESM(require_httpAuthSchemes(), 1);
32515
32517
 
@@ -32666,7 +32668,7 @@ var defaultProvider = (init = {}) => memoizeChain([
32666
32668
  }
32667
32669
  ], credentialsTreatedAsExpired);
32668
32670
  var credentialsTreatedAsExpired = (credentials) => credentials?.expiration !== undefined && credentials.expiration.getTime() - Date.now() < 300000;
32669
- // ../../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
32670
32672
  var import_checksum2 = __toESM(require_checksum(), 1);
32671
32673
  var import_client20 = __toESM(require_client(), 1);
32672
32674
  var import_config28 = __toESM(require_config(), 1);
@@ -32904,7 +32906,7 @@ var subtle = typeof digest === "function" && typeof sign2 === "function" && type
32904
32906
  var MAX_PENDING_BYTES = 8 * 1024 * 1024;
32905
32907
  var $Sha1 = Sha1Node;
32906
32908
 
32907
- // ../../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
32908
32910
  var import_httpAuthSchemes2 = __toESM(require_httpAuthSchemes(), 1);
32909
32911
  var import_signature_v4_multi_region2 = __toESM(require_dist_cjs4(), 1);
32910
32912
  var import_checksum = __toESM(require_checksum(), 1);
@@ -32956,7 +32958,7 @@ var getRuntimeConfig2 = (config) => {
32956
32958
  };
32957
32959
  };
32958
32960
 
32959
- // ../../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
32960
32962
  var getRuntimeConfig3 = (config) => {
32961
32963
  import_client20.emitWarningIfUnsupportedVersion(process.version);
32962
32964
  const defaultsMode = import_config28.resolveDefaultsModeConfig(config);
@@ -32997,12 +32999,12 @@ var getRuntimeConfig3 = (config) => {
32997
32999
  };
32998
33000
  };
32999
33001
 
33000
- // ../../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
33001
33003
  var import_client21 = __toESM(require_client2(), 1);
33002
33004
  var import_client22 = __toESM(require_client(), 1);
33003
33005
  var import_protocols5 = __toESM(require_protocols(), 1);
33004
33006
 
33005
- // ../../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
33006
33008
  var getHttpAuthExtensionConfiguration2 = (runtimeConfig) => {
33007
33009
  const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
33008
33010
  let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
@@ -33041,14 +33043,14 @@ var resolveHttpAuthRuntimeConfig2 = (config) => {
33041
33043
  };
33042
33044
  };
33043
33045
 
33044
- // ../../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
33045
33047
  var resolveRuntimeExtensions2 = (runtimeConfig, extensions) => {
33046
33048
  const extensionConfiguration = Object.assign(import_client21.getAwsRegionExtensionConfiguration(runtimeConfig), import_client22.getDefaultExtensionConfiguration(runtimeConfig), import_protocols5.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration2(runtimeConfig));
33047
33049
  extensions.forEach((extension) => extension.configure(extensionConfiguration));
33048
33050
  return Object.assign(runtimeConfig, import_client21.resolveAwsRegionExtensionConfiguration(extensionConfiguration), import_client22.resolveDefaultRuntimeConfig(extensionConfiguration), import_protocols5.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig2(extensionConfiguration));
33049
33051
  };
33050
33052
 
33051
- // ../../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
33052
33054
  class S3Client extends import_client24.Client {
33053
33055
  config;
33054
33056
  constructor(...[configuration]) {
@@ -33093,15 +33095,15 @@ class S3Client extends import_client24.Client {
33093
33095
  }
33094
33096
  }
33095
33097
 
33096
- // ../../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
33097
33099
  class DeleteObjectCommand extends command(_ep0, _mw0, "DeleteObject", DeleteObject$) {
33098
33100
  }
33099
33101
 
33100
- // ../../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
33101
33103
  class GetObjectCommand extends command(_ep0, _mw7, "GetObject", GetObject$) {
33102
33104
  }
33103
33105
 
33104
- // ../../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
33105
33107
  class PutObjectCommand extends command(_ep0, _mw11, "PutObject", PutObject$) {
33106
33108
  }
33107
33109
 
@@ -33502,12 +33504,7 @@ import { homedir as homedir2 } from "os";
33502
33504
  import { join as join3, resolve } from "path";
33503
33505
  import { homedir as pathsResolverHomedir } from "os";
33504
33506
  import { join as pathsResolverJoin } from "path";
33505
- var PATHS_RESOLVER_KIND_ENV = {
33506
- config: "HASNA_CONFIG_HOME",
33507
- data: "HASNA_DATA_HOME",
33508
- state: "HASNA_STATE_HOME",
33509
- cache: "HASNA_CACHE_HOME"
33510
- };
33507
+ var PATHS_RESOLVER_DATA_ENV = "HASNA_DATA_HOME";
33511
33508
  var PATHS_RESOLVER_APP_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
33512
33509
  function pathsResolverAssertApp(app) {
33513
33510
  if (typeof app !== "string" || app.length === 0) {
@@ -33517,48 +33514,19 @@ function pathsResolverAssertApp(app) {
33517
33514
  throw new TypeError(`paths: invalid app slug "${app}" \u2014 expected lowercase kebab-case ([a-z0-9]+(-[a-z0-9]+)*)`);
33518
33515
  }
33519
33516
  }
33520
- function pathsResolverAssertKind(kind) {
33521
- if (!Object.keys(PATHS_RESOLVER_KIND_ENV).includes(kind)) {
33522
- throw new TypeError(`paths: invalid path kind "${kind}" \u2014 expected one of ${Object.keys(PATHS_RESOLVER_KIND_ENV).join(", ")}`);
33523
- }
33524
- }
33525
- function pathsResolverBaseDir(kind, options) {
33526
- pathsResolverAssertKind(kind);
33517
+ function pathsResolverDataBaseDir(options) {
33527
33518
  const env = options.env ?? process.env;
33528
- const override = env[PATHS_RESOLVER_KIND_ENV[kind]];
33519
+ const override = env[PATHS_RESOLVER_DATA_ENV];
33529
33520
  if (typeof override === "string" && override.length > 0)
33530
33521
  return override;
33531
33522
  const home = options.home ?? pathsResolverHomedir();
33532
33523
  const platform = options.platform ?? process.platform;
33533
- if (platform === "darwin") {
33534
- switch (kind) {
33535
- case "config":
33536
- case "data":
33537
- return pathsResolverJoin(home, "Library", "Application Support", "Hasna");
33538
- case "cache":
33539
- return pathsResolverJoin(home, "Library", "Caches", "Hasna");
33540
- case "state":
33541
- return pathsResolverJoin(home, "Library", "Logs", "Hasna");
33542
- }
33543
- }
33544
- switch (kind) {
33545
- case "config":
33546
- return pathsResolverJoin(home, ".config", "hasna");
33547
- case "data":
33548
- return pathsResolverJoin(home, ".local", "share", "hasna");
33549
- case "state":
33550
- return pathsResolverJoin(home, ".local", "state", "hasna");
33551
- case "cache":
33552
- return pathsResolverJoin(home, ".cache", "hasna");
33553
- }
33554
- }
33555
- function pathsResolverResolve(kind, options) {
33556
- pathsResolverAssertApp(options.app);
33557
- const appSegment = options.internal === true ? pathsResolverJoin("internal", options.app) : options.app;
33558
- return pathsResolverJoin(pathsResolverBaseDir(kind, options), appSegment);
33524
+ return platform === "darwin" ? pathsResolverJoin(home, "Library", "Application Support", "Hasna") : pathsResolverJoin(home, ".local", "share", "hasna");
33559
33525
  }
33560
33526
  function dataDir(options) {
33561
- 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);
33562
33530
  }
33563
33531
  var DATA_DIR_ENV = "HASNA_SKILLS_DIR";
33564
33532
  var HASNA_SKILLS_HOME_ENV = "HASNA_SKILLS_HOME";
@@ -34756,13 +34724,12 @@ class SqliteGovernanceStore {
34756
34724
  return rows.map((row) => this.reservationFrom(row));
34757
34725
  }
34758
34726
  async reconcileReservation(reservationId2, actualCents, status) {
34759
- const row = this.db.query("SELECT * FROM skills_credit_reservations WHERE id = ? LIMIT 1").get(reservationId2);
34760
- if (!row || String(row.status) !== "reserved")
34761
- return row ? this.reservationFrom(row) : null;
34762
- const reconciledAt = nowIso();
34763
- this.db.run("UPDATE skills_credit_reservations SET actual_cents = ?, status = ?, reconciled_at = ? WHERE id = ?", [actualCents, status, reconciledAt, reservationId2]);
34764
- const updated = this.db.query("SELECT * FROM skills_credit_reservations WHERE id = ? LIMIT 1").get(reservationId2);
34765
- 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;
34766
34733
  }
34767
34734
  async monthlySpendCents(orgId, monthPrefix) {
34768
34735
  const from = `${monthPrefix}-01T00:00:00.000Z`;
@@ -35858,13 +35825,16 @@ function normalizePortableSkillName(name) {
35858
35825
  return normalized;
35859
35826
  }
35860
35827
  function readPortableSkillManifest(skillPath, fallbackName = basename(skillPath)) {
35828
+ return readManifest(skillPath, fallbackName, normalizePortableSkillName);
35829
+ }
35830
+ function readManifest(skillPath, fallbackName, normalizeName) {
35861
35831
  const skillJsonPath = join9(skillPath, "skill.json");
35862
35832
  const skillMdPath = join9(skillPath, "SKILL.md");
35863
35833
  const pkgPath = join9(skillPath, "package.json");
35864
35834
  const jsonManifest = existsSync5(skillJsonPath) ? readJsonObject(skillJsonPath) : undefined;
35865
35835
  const frontmatter = existsSync5(skillMdPath) ? parseSkillFrontmatter(readFileSync6(skillMdPath, "utf-8")) ?? undefined : undefined;
35866
35836
  const pkg = existsSync5(pkgPath) ? readJsonObject(pkgPath) : undefined;
35867
- 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);
35868
35838
  const description = stringField(jsonManifest, "description") ?? frontmatter?.description ?? stringValue(pkg?.description) ?? `${name} skill`;
35869
35839
  const version2 = readDeclaredSkillVersion(skillPath) ?? PORTABLE_SKILL_DEFAULT_VERSION;
35870
35840
  const kind = parseSkillKind(stringField(jsonManifest, "kind") ?? frontmatter?.kind);
@@ -36634,7 +36604,7 @@ async function getMergedSkill(store, artifactStorage, principal, slug) {
36634
36604
  if (resolved.kind === "published")
36635
36605
  return publishedPayload(resolved.record);
36636
36606
  const bundled = getServerSkill(slug);
36637
- return bundled ? bundled : null;
36607
+ return bundled ? { ...bundled, publicationState: "catalogue-only", revisionId: null } : null;
36638
36608
  }
36639
36609
  async function getMergedSkillMd(store, artifactStorage, principal, slug) {
36640
36610
  const resolved = await resolvePublishedSkill(store, artifactStorage, principal, slug);