@hasna/skills 0.9.9 → 0.9.11

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/dist/sdk/index.js CHANGED
@@ -9004,7 +9004,7 @@ var require_client = __commonJS((exports) => {
9004
9004
  var require_config = __commonJS((exports) => {
9005
9005
  var { homedir: homedir6 } = __require("os");
9006
9006
  var { sep: sep7, join: join4 } = __require("path");
9007
- var { createHash: createHash17 } = __require("crypto");
9007
+ var { createHash: createHash19 } = __require("crypto");
9008
9008
  var { readFile: readFile$1 } = __require("fs/promises");
9009
9009
  var { IniSectionType } = require_dist_cjs();
9010
9010
  var { normalizeProvider } = require_client();
@@ -9159,7 +9159,7 @@ var require_config = __commonJS((exports) => {
9159
9159
  var DEFAULT_PROFILE = "default";
9160
9160
  var getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;
9161
9161
  var getSSOTokenFilepath = (id2) => {
9162
- const hasher = createHash17("sha1");
9162
+ const hasher = createHash19("sha1");
9163
9163
  const cacheName = hasher.update(id2).digest("hex");
9164
9164
  return join4(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
9165
9165
  };
@@ -9311,11 +9311,11 @@ var require_config = __commonJS((exports) => {
9311
9311
  };
9312
9312
  function getSelectorName(functionString) {
9313
9313
  try {
9314
- const constants12 = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
9315
- constants12.delete("CONFIG");
9316
- constants12.delete("CONFIG_PREFIX_SEPARATOR");
9317
- constants12.delete("ENV");
9318
- return [...constants12].join(", ");
9314
+ const constants13 = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
9315
+ constants13.delete("CONFIG");
9316
+ constants13.delete("CONFIG_PREFIX_SEPARATOR");
9317
+ constants13.delete("ENV");
9318
+ return [...constants13].join(", ");
9319
9319
  } catch (ignored) {
9320
9320
  return functionString;
9321
9321
  }
@@ -10511,10 +10511,10 @@ var require_endpoints = __commonJS((exports) => {
10511
10511
 
10512
10512
  // node_modules/@smithy/core/dist-cjs/submodules/serde/index.js
10513
10513
  var require_serde = __commonJS((exports) => {
10514
- var { createHmac: createHmac2, createHash: createHash17, getRandomValues } = __require("crypto");
10514
+ var { createHmac: createHmac2, createHash: createHash19, getRandomValues } = __require("crypto");
10515
10515
  var { hasOwn: hasOwn2, HttpResponse } = require_transport();
10516
10516
  exports.hasOwn = hasOwn2;
10517
- var { ReadStream, lstatSync: lstatSync20, fstatSync: fstatSync4 } = __require("fs");
10517
+ var { ReadStream, lstatSync: lstatSync21, fstatSync: fstatSync4 } = __require("fs");
10518
10518
  var { toEndpointV1 } = require_endpoints();
10519
10519
  var { Readable, Writable, PassThrough } = __require("stream");
10520
10520
  var isArrayBuffer = (arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
@@ -11280,7 +11280,7 @@ var require_serde = __commonJS((exports) => {
11280
11280
  return body.end + 1 - body.start;
11281
11281
  } else if (body instanceof ReadStream) {
11282
11282
  if (body.path != null) {
11283
- return lstatSync20(body.path).size;
11283
+ return lstatSync21(body.path).size;
11284
11284
  } else if (typeof body.fd === "number") {
11285
11285
  return fstatSync4(body.fd).size;
11286
11286
  }
@@ -11416,7 +11416,7 @@ var require_serde = __commonJS((exports) => {
11416
11416
  return Promise.resolve(this.hash.digest());
11417
11417
  }
11418
11418
  reset() {
11419
- this.hash = this.secret ? createHmac2(this.algorithmIdentifier, castSourceData(this.secret)) : createHash17(this.algorithmIdentifier);
11419
+ this.hash = this.secret ? createHmac2(this.algorithmIdentifier, castSourceData(this.secret)) : createHash19(this.algorithmIdentifier);
11420
11420
  }
11421
11421
  }
11422
11422
  function castSourceData(toCast, encoding) {
@@ -12155,7 +12155,7 @@ var require_checksum = __commonJS((exports) => {
12155
12155
  var { createReadStream } = __require("fs");
12156
12156
  var { Writable } = __require("stream");
12157
12157
  var { toUint8Array, concatBytes } = require_serde();
12158
- var { createHash: createHash17, createHmac: createHmac2 } = __require("crypto");
12158
+ var { createHash: createHash19, createHmac: createHmac2 } = __require("crypto");
12159
12159
  var zlib = __require("zlib");
12160
12160
  async function blobReader(blob, onChunk, chunkSize = 1024 * 1024) {
12161
12161
  const size = blob.size;
@@ -12320,7 +12320,7 @@ var require_checksum = __commonJS((exports) => {
12320
12320
  }
12321
12321
  var hasNativeCrypto$1 = (() => {
12322
12322
  try {
12323
- createHash17("md5");
12323
+ createHash19("md5");
12324
12324
  return true;
12325
12325
  } catch {
12326
12326
  return false;
@@ -12330,7 +12330,7 @@ var require_checksum = __commonJS((exports) => {
12330
12330
  function buildNativeClass$2() {
12331
12331
  return class Md5Node2 {
12332
12332
  digestLength = 16;
12333
- hash = createHash17("md5");
12333
+ hash = createHash19("md5");
12334
12334
  update(data) {
12335
12335
  this.hash.update(toUint8Array(data));
12336
12336
  }
@@ -12339,7 +12339,7 @@ var require_checksum = __commonJS((exports) => {
12339
12339
  return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
12340
12340
  }
12341
12341
  reset() {
12342
- this.hash = createHash17("md5");
12342
+ this.hash = createHash19("md5");
12343
12343
  }
12344
12344
  };
12345
12345
  }
@@ -12629,7 +12629,7 @@ var require_checksum = __commonJS((exports) => {
12629
12629
  ]);
12630
12630
  var hasNativeCrypto = (() => {
12631
12631
  try {
12632
- createHash17("sha256");
12632
+ createHash19("sha256");
12633
12633
  return true;
12634
12634
  } catch {
12635
12635
  return false;
@@ -12669,7 +12669,7 @@ var require_checksum = __commonJS((exports) => {
12669
12669
  this.finished = false;
12670
12670
  }
12671
12671
  createHash() {
12672
- return this.secret ? createHmac2("sha256", toBuffer(this.secret)) : createHash17("sha256");
12672
+ return this.secret ? createHmac2("sha256", toBuffer(this.secret)) : createHash19("sha256");
12673
12673
  }
12674
12674
  };
12675
12675
  }
@@ -25679,7 +25679,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
25679
25679
  return this.connectOptions === undefined ? http2.connect(url) : http2.connect(url, this.connectOptions);
25680
25680
  }
25681
25681
  }
25682
- var { constants: constants12 } = http2;
25682
+ var { constants: constants13 } = http2;
25683
25683
 
25684
25684
  class NodeHttp2Handler {
25685
25685
  config;
@@ -25770,8 +25770,8 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
25770
25770
  }
25771
25771
  const clientHttp2Stream = session.request({
25772
25772
  ...request2.headers,
25773
- [constants12.HTTP2_HEADER_PATH]: path,
25774
- [constants12.HTTP2_HEADER_METHOD]: method
25773
+ [constants13.HTTP2_HEADER_PATH]: path,
25774
+ [constants13.HTTP2_HEADER_METHOD]: method
25775
25775
  });
25776
25776
  if (effectiveRequestTimeout) {
25777
25777
  clientHttp2Stream.setTimeout(effectiveRequestTimeout, () => {
@@ -29443,10 +29443,10 @@ var require_signin = __commonJS((exports) => {
29443
29443
  });
29444
29444
 
29445
29445
  // node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js
29446
- import { createHash as createHash17, createPrivateKey, createPublicKey, sign } from "crypto";
29446
+ import { createHash as createHash19, createPrivateKey, createPublicKey, sign } from "crypto";
29447
29447
  import { promises as fs2 } from "fs";
29448
29448
  import { homedir as homedir6 } from "os";
29449
- import { dirname as dirname18, join as join31 } from "path";
29449
+ import { dirname as dirname19, join as join31 } from "path";
29450
29450
  var import_config27, import_protocols3, LoginCredentialsFetcher;
29451
29451
  var init_LoginCredentialsFetcher = __esm(() => {
29452
29452
  import_config27 = __toESM(require_config(), 1);
@@ -29606,7 +29606,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
29606
29606
  }
29607
29607
  async saveToken(token) {
29608
29608
  const tokenFilePath = this.getTokenFilePath();
29609
- const directory = dirname18(tokenFilePath);
29609
+ const directory = dirname19(tokenFilePath);
29610
29610
  try {
29611
29611
  await fs2.mkdir(directory, { recursive: true });
29612
29612
  } catch (error) {}
@@ -29615,7 +29615,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
29615
29615
  getTokenFilePath() {
29616
29616
  const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join31(homedir6(), ".aws", "login", "cache");
29617
29617
  const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
29618
- const loginSessionSha256 = createHash17("sha256").update(loginSessionBytes).digest("hex");
29618
+ const loginSessionSha256 = createHash19("sha256").update(loginSessionBytes).digest("hex");
29619
29619
  return join31(directory, `${loginSessionSha256}.json`);
29620
29620
  }
29621
29621
  derToRawSignature(derSignature) {
@@ -32373,7 +32373,7 @@ var init_event_sink = __esm(() => {
32373
32373
  // package.json
32374
32374
  var package_default = {
32375
32375
  name: "@hasna/skills",
32376
- version: "0.9.9",
32376
+ version: "0.9.11",
32377
32377
  description: "Skills library for AI coding agents",
32378
32378
  type: "module",
32379
32379
  bin: {
@@ -37210,10 +37210,10 @@ async function reconcileSkillSession(input, options = {}) {
37210
37210
  return { applied: true, plan, planDigest, ...result };
37211
37211
  }
37212
37212
  // src/lib/selected-run.ts
37213
- import { createHash as createHash16 } from "crypto";
37213
+ import { createHash as createHash18 } from "crypto";
37214
37214
  import { spawn } from "child_process";
37215
- import { mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync3, writeFileSync as writeFileSync8, realpathSync as realpathSync7 } from "fs";
37216
- import { dirname as dirname17, join as join30, resolve as resolve16 } from "path";
37215
+ import { mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync3, writeFileSync as writeFileSync9, realpathSync as realpathSync7 } from "fs";
37216
+ import { dirname as dirname18, join as join30, resolve as resolve16 } from "path";
37217
37217
  import { tmpdir, hostname as stationHostname2 } from "os";
37218
37218
 
37219
37219
  // src/lib/dependency-preparation.ts
@@ -37436,7 +37436,7 @@ import { homedir as homedir5 } from "os";
37436
37436
  import {
37437
37437
  cpSync as cpSync2,
37438
37438
  existsSync as existsSync10,
37439
- lstatSync as lstatSync19,
37439
+ lstatSync as lstatSync20,
37440
37440
  mkdirSync as mkdirSync8,
37441
37441
  mkdtempSync as mkdtempSync2,
37442
37442
  readFileSync as readFileSync16,
@@ -37444,15 +37444,15 @@ import {
37444
37444
  renameSync as renameSync5,
37445
37445
  rmSync as rmSync3,
37446
37446
  statSync as statSync9,
37447
- writeFileSync as writeFileSync6
37447
+ writeFileSync as writeFileSync7
37448
37448
  } from "fs";
37449
37449
  import { homedir as homedir4 } from "os";
37450
- import { basename as basename9, dirname as dirname16, join as join25 } from "path";
37450
+ import { basename as basename9, dirname as dirname17, join as join25 } from "path";
37451
37451
 
37452
37452
  // src/lib/agent-integration.ts
37453
- import { createHash as createHash14, randomUUID as randomUUID3 } from "crypto";
37454
- import { existsSync as existsSync6, lstatSync as lstatSync17, statSync as statSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync13, readdirSync as readdirSync7, opendirSync as opendirSync5, readlinkSync as readlinkSync2, realpathSync as realpathSync4, renameSync as renameSync3, rmdirSync as rmdirSync3, writeFileSync as writeFileSync3, unlinkSync as unlinkSync4, chmodSync, openSync as openSync15, closeSync as closeSync15, fsyncSync as fsyncSync3, fstatSync as fstatSync15, readSync as readSync10, constants as constants11, linkSync as linkSync2 } from "fs";
37455
- import { dirname as dirname13, join as join21, resolve as resolve14, relative as relative3, isAbsolute as isAbsolute15, sep as sep4 } from "path";
37453
+ import { createHash as createHash16, randomUUID as randomUUID3 } from "crypto";
37454
+ import { existsSync as existsSync6, lstatSync as lstatSync18, statSync as statSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync13, readdirSync as readdirSync7, opendirSync as opendirSync5, readlinkSync as readlinkSync2, realpathSync as realpathSync4, renameSync as renameSync3, rmdirSync as rmdirSync3, writeFileSync as writeFileSync4, unlinkSync as unlinkSync4, chmodSync, openSync as openSync16, closeSync as closeSync16, fsyncSync as fsyncSync4, fstatSync as fstatSync16, readSync as readSync11, constants as constants12, linkSync as linkSync2 } from "fs";
37455
+ import { dirname as dirname14, join as join21, resolve as resolve14, relative as relative3, isAbsolute as isAbsolute15, sep as sep4 } from "path";
37456
37456
  import { homedir as homedir3 } from "os";
37457
37457
 
37458
37458
  // src/lib/managed-policy.ts
@@ -37682,9 +37682,9 @@ function isOwnedCliBridge(path, expectedPaths) {
37682
37682
  }
37683
37683
 
37684
37684
  // src/lib/agent-discovery.ts
37685
- import { createHash as createHash13 } from "crypto";
37686
- import { lstatSync as lstatSync16, readFileSync as readFileSync12, readdirSync as readdirSync6, realpathSync as realpathSync3 } from "fs";
37687
- import { basename as basename6, dirname as dirname12, isAbsolute as isAbsolute14, join as join20, resolve as resolve13, sep as sep3 } from "path";
37685
+ import { createHash as createHash15 } from "crypto";
37686
+ import { lstatSync as lstatSync17, readFileSync as readFileSync12, readdirSync as readdirSync6, realpathSync as realpathSync3 } from "fs";
37687
+ import { basename as basename6, dirname as dirname13, isAbsolute as isAbsolute14, join as join20, resolve as resolve13, sep as sep3 } from "path";
37688
37688
 
37689
37689
  // node_modules/yaml/dist/index.js
37690
37690
  var composer = require_composer();
@@ -40084,8 +40084,76 @@ function captureClaudeSettings(path, budget = { remaining: 256 * 1024 * 1024 })
40084
40084
  return { path, hashMode: "claude-settings-v1", sha256: settingsDigest(readSettings(path, budget)) };
40085
40085
  }
40086
40086
 
40087
+ // src/lib/codex-hook-discovery-recovery.ts
40088
+ import { createHash as createHash14 } from "crypto";
40089
+
40090
+ // src/lib/codex-hook-trust-files.ts
40091
+ import { closeSync as closeSync15, constants as constants11, fstatSync as fstatSync15, fsyncSync as fsyncSync3, lstatSync as lstatSync16, openSync as openSync15, readSync as readSync10, writeFileSync as writeFileSync3 } from "fs";
40092
+ import { createHash as createHash13 } from "crypto";
40093
+ import { dirname as dirname12 } from "path";
40094
+ function need4(value, code) {
40095
+ if (!value)
40096
+ throw new Error(`CODEX_HOOK_TRUST_${code}`);
40097
+ }
40098
+ var sameStat = (a, b) => ["dev", "ino", "uid", "nlink", "mode", "size", "mtimeNs", "ctimeNs"].every((key) => a[key] === b[key]);
40099
+ function safeParents(file) {
40100
+ for (let p = dirname12(file);; p = dirname12(p)) {
40101
+ const s = lstatSync16(p);
40102
+ need4(s.isDirectory() && !s.isSymbolicLink(), "UNSAFE_PARENT");
40103
+ need4((s.mode & 18) === 0 || s.uid === 0 && (s.mode & 512) !== 0, "UNSAFE_PARENT");
40104
+ if (dirname12(p) === p)
40105
+ break;
40106
+ }
40107
+ }
40108
+ function snapshot(file, privateFile = false, options = {}) {
40109
+ const readOnlyPackage = options.readOnlyPackage === true && !privateFile;
40110
+ safeParents(file);
40111
+ const initial = lstatSync16(file, { bigint: true });
40112
+ need4(initial.isFile() && initial.uid === BigInt(process.getuid()) && (initial.nlink === 1n || readOnlyPackage && initial.nlink > 1n) && (initial.mode & 0o022n) === 0n && (!privateFile || (initial.mode & 0o777n) === 0o600n), "UNSAFE_FILE");
40113
+ need4(initial.size <= 8n * 1024n * 1024n, "FILE_BOUND");
40114
+ const fd = openSync15(file, constants11.O_RDONLY | constants11.O_NOFOLLOW | constants11.O_NONBLOCK);
40115
+ try {
40116
+ const before = fstatSync15(fd, { bigint: true });
40117
+ need4(sameStat(initial, before), "INPUT_CHANGED");
40118
+ const bytes = Buffer.alloc(Number(before.size) + 1);
40119
+ let length = 0;
40120
+ while (length < bytes.length) {
40121
+ const n2 = readSync10(fd, bytes, length, bytes.length - length, null);
40122
+ if (!n2)
40123
+ break;
40124
+ length += n2;
40125
+ }
40126
+ need4(length === Number(before.size) && sameStat(before, fstatSync15(fd, { bigint: true })) && sameStat(before, lstatSync16(file, { bigint: true })), "INPUT_CHANGED");
40127
+ const content = bytes.subarray(0, length), text2 = new TextDecoder("utf-8", { fatal: true }).decode(content);
40128
+ return { file, privateFile, readOnlyPackage, text: text2, bytes: content, stat: before, sha256: createHash13("sha256").update(content).digest("hex") };
40129
+ } finally {
40130
+ closeSync15(fd);
40131
+ }
40132
+ }
40133
+ function unchanged2(before) {
40134
+ const after = snapshot(before.file, before.privateFile, before.readOnlyPackage ? { readOnlyPackage: true } : {});
40135
+ need4(sameStat(before.stat, after.stat) && after.sha256 === before.sha256, "INPUT_CHANGED");
40136
+ }
40137
+
40138
+ // src/lib/codex-hook-discovery-recovery.ts
40139
+ var sha = (text2) => createHash14("sha256").update(text2).digest("hex");
40140
+ var proofs = new WeakMap;
40141
+ function assertCodexHookDiscoveryRecovery(binding, witness) {
40142
+ const proof = proofs.get(witness);
40143
+ need4(!!proof && binding.agent === "codex" && witness.discoverySha256 === sha(JSON.stringify(binding)), "RECONCILE_DISCOVERY_RECOVERY_CHANGED");
40144
+ unchanged2(proof.before);
40145
+ unchanged2(proof.current);
40146
+ }
40147
+ function verifiesCodexHookDiscoverySource(binding, source, currentDigest, witness) {
40148
+ if (!witness || source.path !== witness.configPath || source.hashMode !== "bytes")
40149
+ return false;
40150
+ assertCodexHookDiscoveryRecovery(binding, witness);
40151
+ need4(source.sha256 === witness.beforeSha256 && currentDigest === witness.currentSha256, "RECONCILE_DISCOVERY_RECOVERY_CHANGED");
40152
+ return true;
40153
+ }
40154
+
40087
40155
  // src/lib/agent-discovery.ts
40088
- var digest2 = (text2) => createHash13("sha256").update(text2).digest("hex");
40156
+ var digest2 = (text2) => createHash15("sha256").update(text2).digest("hex");
40089
40157
  function parseConfig(text2, path, toml = false) {
40090
40158
  try {
40091
40159
  const value = toml ? Bun.TOML.parse(text2) : JSON.parse(text2);
@@ -40099,10 +40167,10 @@ function parseConfig(text2, path, toml = false) {
40099
40167
  function safe4(path) {
40100
40168
  if (!isAbsolute14(path) || path.includes("\x00"))
40101
40169
  throw new Error("Expected an absolute native discovery path");
40102
- for (let cursor = path;; cursor = dirname12(cursor)) {
40103
- if (lstatSync16(cursor, { throwIfNoEntry: false })?.isSymbolicLink())
40170
+ for (let cursor = path;; cursor = dirname13(cursor)) {
40171
+ if (lstatSync17(cursor, { throwIfNoEntry: false })?.isSymbolicLink())
40104
40172
  throw new Error(`Refusing symlink native discovery input: ${cursor}`);
40105
- if (dirname12(cursor) === cursor)
40173
+ if (dirname13(cursor) === cursor)
40106
40174
  break;
40107
40175
  }
40108
40176
  }
@@ -40110,7 +40178,7 @@ function read(path, changes) {
40110
40178
  safe4(path);
40111
40179
  if (changes?.has(path))
40112
40180
  return changes.get(path);
40113
- const stat2 = lstatSync16(path, { throwIfNoEntry: false });
40181
+ const stat2 = lstatSync17(path, { throwIfNoEntry: false });
40114
40182
  if (!stat2)
40115
40183
  return null;
40116
40184
  if (!stat2.isFile() || stat2.size > 16 * 1024 * 1024)
@@ -40160,7 +40228,9 @@ function projected(source, changes, budget = discoveryByteBudget()) {
40160
40228
  throw new Error("Expected native discovery configuration object");
40161
40229
  return digest2(JSON.stringify(Object.fromEntries((source.fields ?? []).map((field2) => [field2, object4[field2] ?? null]))));
40162
40230
  }
40163
- function verifyAgentDiscovery(binding) {
40231
+ function verifyAgentDiscovery(binding, codexRecovery) {
40232
+ if (codexRecovery)
40233
+ assertCodexHookDiscoveryRecovery(binding, codexRecovery);
40164
40234
  if (!binding || !Array.isArray(binding.sources) || !Array.isArray(binding.roots) || binding.sources.length > AGENT_POLICY_LIMITS.discoverySources || binding.roots.length > AGENT_POLICY_LIMITS.discoveryRoots)
40165
40235
  throw new Error("Invalid native discovery binding");
40166
40236
  if (binding.agent === "hermes" && !binding.directories?.length)
@@ -40176,7 +40246,8 @@ function verifyAgentDiscovery(binding) {
40176
40246
  throw new Error("Invalid native discovery projection");
40177
40247
  if (source.sha256 !== null && !/^[a-f0-9]{64}$/.test(source.sha256))
40178
40248
  throw new Error("Invalid native discovery digest");
40179
- if (projected(source, undefined, budget) !== source.sha256)
40249
+ const current = projected(source, undefined, budget);
40250
+ if (current !== source.sha256 && !verifiesCodexHookDiscoverySource(binding, source, current, codexRecovery))
40180
40251
  throw new Error(`Native discovery input changed; run skills hook install with a fresh discovery review: ${source.path}`);
40181
40252
  }
40182
40253
  for (const root2 of binding.roots)
@@ -40248,21 +40319,21 @@ function resolveAgentDiscovery(options) {
40248
40319
  const executable = Bun.which("gemini");
40249
40320
  if (executable) {
40250
40321
  let packageRoot;
40251
- for (let directory = dirname12(realpathSync3(executable)), depth = 0;depth < 8; directory = dirname12(directory), depth++) {
40322
+ for (let directory = dirname13(realpathSync3(executable)), depth = 0;depth < 8; directory = dirname13(directory), depth++) {
40252
40323
  const path = join20(directory, "package.json"), raw = read(path);
40253
40324
  if (raw !== null && parseConfig(raw, path).name === "@google/gemini-cli") {
40254
40325
  packageRoot = directory;
40255
40326
  witness(path);
40256
40327
  break;
40257
40328
  }
40258
- if (dirname12(directory) === directory)
40329
+ if (dirname13(directory) === directory)
40259
40330
  break;
40260
40331
  }
40261
40332
  if (!packageRoot)
40262
40333
  unresolved("installed Gemini package layout is not recognized");
40263
40334
  const builtinRoot = join20(packageRoot, "bundle/builtin");
40264
40335
  safe4(builtinRoot);
40265
- if (!lstatSync16(builtinRoot, { throwIfNoEntry: false })?.isDirectory())
40336
+ if (!lstatSync17(builtinRoot, { throwIfNoEntry: false })?.isDirectory())
40266
40337
  unresolved("installed Gemini builtin root is missing");
40267
40338
  for (const name of readdirSync6(builtinRoot).sort()) {
40268
40339
  const text2 = witness(join20(builtinRoot, name, "SKILL.md"));
@@ -40302,7 +40373,7 @@ function resolveAgentDiscovery(options) {
40302
40373
  unresolved("plugin hooks require a separate no-skill-injection review");
40303
40374
  const commands = join20(root2, "commands");
40304
40375
  safe4(commands);
40305
- if (agent === "claude" && (manifest.commands !== undefined || lstatSync16(commands, { throwIfNoEntry: false })?.isDirectory() && readdirSync6(commands).length))
40376
+ if (agent === "claude" && (manifest.commands !== undefined || lstatSync17(commands, { throwIfNoEntry: false })?.isDirectory() && readdirSync6(commands).length))
40306
40377
  unresolved("legacy command discovery requires retirement or a dedicated format adapter");
40307
40378
  const rootSkill = witness(join20(root2, "SKILL.md"));
40308
40379
  if (rootSkill !== null)
@@ -40316,7 +40387,7 @@ function resolveAgentDiscovery(options) {
40316
40387
  const path = resolve13(root2, value);
40317
40388
  if (path !== root2 && !path.startsWith(root2 + sep3))
40318
40389
  unresolved("plugin skill path escapes its root");
40319
- roots.add(path.endsWith(`${sep3}SKILL.md`) ? dirname12(path) : path);
40390
+ roots.add(path.endsWith(`${sep3}SKILL.md`) ? dirname13(path) : path);
40320
40391
  }
40321
40392
  }
40322
40393
  if (agent === "claude") {
@@ -40324,7 +40395,7 @@ function resolveAgentDiscovery(options) {
40324
40395
  const installed = registrations === null ? {} : parseConfig(registrations, join20(home, ".claude/plugins/installed_plugins.json")).plugins;
40325
40396
  const commands = canonical4(join20(home, ".claude/commands"));
40326
40397
  safe4(commands);
40327
- if (lstatSync16(commands, { throwIfNoEntry: false })?.isDirectory() && readdirSync6(commands).length)
40398
+ if (lstatSync17(commands, { throwIfNoEntry: false })?.isDirectory() && readdirSync6(commands).length)
40328
40399
  unresolved("legacy home command discovery requires a dedicated format adapter");
40329
40400
  for (const [id2, enabled] of Object.entries(config.enabledPlugins ?? {})) {
40330
40401
  if (enabled === false)
@@ -40366,12 +40437,12 @@ function resolveAgentDiscovery(options) {
40366
40437
  }
40367
40438
  const localPlugins = join20(home, ".config/opencode/plugins");
40368
40439
  safe4(localPlugins);
40369
- if (lstatSync16(localPlugins, { throwIfNoEntry: false }) && readdirSync6(localPlugins).some((name) => name !== "skills-cli.js"))
40440
+ if (lstatSync17(localPlugins, { throwIfNoEntry: false }) && readdirSync6(localPlugins).some((name) => name !== "skills-cli.js"))
40370
40441
  unresolved("additional local plugin hooks require review");
40371
40442
  } else if (agent === "hermes") {
40372
40443
  for (const directory of [join20(home, ".hermes/plugins"), join20(home, ".hermes/hermes-agent")]) {
40373
40444
  safe4(directory);
40374
- if (lstatSync16(directory, { throwIfNoEntry: false }))
40445
+ if (lstatSync17(directory, { throwIfNoEntry: false }))
40375
40446
  unresolved("installed runtime/plugin discovery requires reviewed source bindings");
40376
40447
  }
40377
40448
  if (Bun.which("hermes") || Object.keys(config.plugins ?? {}).length)
@@ -40381,11 +40452,11 @@ function resolveAgentDiscovery(options) {
40381
40452
  unresolved("custom extension or skill paths");
40382
40453
  const directory = join20(home, ".gemini/extensions");
40383
40454
  safe4(directory);
40384
- if (lstatSync16(directory, { throwIfNoEntry: false }))
40455
+ if (lstatSync17(directory, { throwIfNoEntry: false }))
40385
40456
  for (const name of readdirSync6(directory)) {
40386
40457
  const root2 = join20(directory, name);
40387
40458
  safe4(root2);
40388
- if (!lstatSync16(root2)?.isDirectory())
40459
+ if (!lstatSync17(root2)?.isDirectory())
40389
40460
  continue;
40390
40461
  const raw = witness(join20(root2, "gemini-extension.json"));
40391
40462
  if (raw === null)
@@ -40540,7 +40611,7 @@ function disableCodexBundledSkills(text2) {
40540
40611
  }
40541
40612
 
40542
40613
  // src/lib/agent-integration.ts
40543
- var sha = (data) => createHash14("sha256").update(data).digest("hex");
40614
+ var sha2 = (data) => createHash16("sha256").update(data).digest("hex");
40544
40615
  var ROOTS = [
40545
40616
  ["claude", ".claude/skills"],
40546
40617
  ["codex", ".codex/skills"],
@@ -40561,9 +40632,9 @@ var ROOTS = [
40561
40632
  function assertSafePath(path) {
40562
40633
  let cursor = resolve14(path);
40563
40634
  while (true) {
40564
- if (lstatSync17(cursor, { throwIfNoEntry: false })?.isSymbolicLink())
40635
+ if (lstatSync18(cursor, { throwIfNoEntry: false })?.isSymbolicLink())
40565
40636
  throw new Error(`Refusing symlink path: ${cursor}`);
40566
- const parent = dirname13(cursor);
40637
+ const parent = dirname14(cursor);
40567
40638
  if (parent === cursor)
40568
40639
  return;
40569
40640
  cursor = parent;
@@ -40572,12 +40643,12 @@ function assertSafePath(path) {
40572
40643
  function readRootAlias(home, agent) {
40573
40644
  assertSafePath(home);
40574
40645
  const realHome = realpathSync4(home), alias = join21(realHome, `.${agent}`);
40575
- const stat2 = lstatSync17(alias, { throwIfNoEntry: false, bigint: true });
40646
+ const stat2 = lstatSync18(alias, { throwIfNoEntry: false, bigint: true });
40576
40647
  if (!stat2?.isSymbolicLink())
40577
40648
  throw new Error(`Agent root alias changed after planning: ${alias}`);
40578
- const link = readlinkSync2(alias), targetPath = resolve14(dirname13(alias), link);
40649
+ const link = readlinkSync2(alias), targetPath = resolve14(dirname14(alias), link);
40579
40650
  assertSafePath(targetPath);
40580
- const targetStat = lstatSync17(targetPath, { throwIfNoEntry: false });
40651
+ const targetStat = lstatSync18(targetPath, { throwIfNoEntry: false });
40581
40652
  if (!targetStat?.isDirectory())
40582
40653
  throw new Error(`Agent root alias must target an existing directory: ${alias}`);
40583
40654
  const target = realpathSync4(targetPath), inside = relative3(realHome, target);
@@ -40590,7 +40661,7 @@ function rootAliases(home, allowed = false) {
40590
40661
  return [];
40591
40662
  const result = [];
40592
40663
  for (const agent of ["claude", "codex"])
40593
- if (lstatSync17(join21(home, `.${agent}`), { throwIfNoEntry: false })?.isSymbolicLink())
40664
+ if (lstatSync18(join21(home, `.${agent}`), { throwIfNoEntry: false })?.isSymbolicLink())
40594
40665
  result.push(readRootAlias(home, agent));
40595
40666
  if (result.some((item, index) => result.slice(index + 1).some((other) => item.target === other.target || item.target.startsWith(other.target + sep4) || other.target.startsWith(item.target + sep4))))
40596
40667
  throw new Error("Agent root alias targets must not overlap");
@@ -40611,35 +40682,35 @@ function recheckRootAliases(aliases) {
40611
40682
  }
40612
40683
  function readNativeBytes(path, maximum = 64 * 1024 * 1024) {
40613
40684
  assertSafePath(path);
40614
- const before = lstatSync17(path);
40685
+ const before = lstatSync18(path);
40615
40686
  if (!before.isFile() || before.size > maximum)
40616
40687
  throw new Error("Unsupported or oversized native skill file");
40617
- const descriptor = openSync15(path, constants11.O_RDONLY | constants11.O_NOFOLLOW | constants11.O_NONBLOCK);
40688
+ const descriptor = openSync16(path, constants12.O_RDONLY | constants12.O_NOFOLLOW | constants12.O_NONBLOCK);
40618
40689
  try {
40619
- const opened = fstatSync15(descriptor);
40690
+ const opened = fstatSync16(descriptor);
40620
40691
  if (!opened.isFile() || opened.dev !== before.dev || opened.ino !== before.ino || opened.size !== before.size)
40621
40692
  throw new Error("Native skill file changed while reading");
40622
40693
  const bytes = Buffer.allocUnsafe(before.size + 1);
40623
40694
  let length = 0;
40624
40695
  while (length < bytes.length) {
40625
- const count = readSync10(descriptor, bytes, length, bytes.length - length, null);
40696
+ const count = readSync11(descriptor, bytes, length, bytes.length - length, null);
40626
40697
  if (!count)
40627
40698
  break;
40628
40699
  length += count;
40629
40700
  }
40630
- const after = fstatSync15(descriptor);
40701
+ const after = fstatSync16(descriptor);
40631
40702
  if (length !== before.size || after.size !== before.size || after.mtimeMs !== opened.mtimeMs || after.ctimeMs !== opened.ctimeMs)
40632
40703
  throw new Error("Native skill file changed while reading");
40633
40704
  return bytes.subarray(0, length);
40634
40705
  } finally {
40635
- closeSync15(descriptor);
40706
+ closeSync16(descriptor);
40636
40707
  }
40637
40708
  }
40638
40709
  function treeHash(root2) {
40639
- const hash2 = createHash14("sha256");
40710
+ const hash2 = createHash16("sha256");
40640
40711
  let bytes = 0, files = 0;
40641
40712
  function visit2(path) {
40642
- const stat2 = lstatSync17(path);
40713
+ const stat2 = lstatSync18(path);
40643
40714
  if (stat2.isSymbolicLink())
40644
40715
  throw new Error(`Refusing symlink in skill: ${path}`);
40645
40716
  const rel = relative3(root2, path);
@@ -40669,7 +40740,7 @@ function selectNativeMigrationTargets(inventory, manifest) {
40669
40740
  const selected = [];
40670
40741
  for (const target of manifest.targets) {
40671
40742
  const projectRoot = resolve14(target.projectRoot), normalized = relative3(projectRoot, resolve14(projectRoot, target.path));
40672
- if (!isAbsolute15(target.projectRoot) || projectRoot !== target.projectRoot || !existsSync6(projectRoot) || !lstatSync17(projectRoot).isDirectory())
40743
+ if (!isAbsolute15(target.projectRoot) || projectRoot !== target.projectRoot || !existsSync6(projectRoot) || !lstatSync18(projectRoot).isDirectory())
40673
40744
  throw new Error(`Native migration target project root must be an existing absolute directory: ${target.projectRoot}`);
40674
40745
  assertSafePath(projectRoot);
40675
40746
  if (isAbsolute15(target.path) || target.path.includes("\\") || target.path.includes("\x00") || !normalized || normalized === ".." || normalized.startsWith(`..${sep4}`) || normalized !== target.path || !/^[0-9a-f]{64}$/.test(target.treeSha256))
@@ -40698,7 +40769,7 @@ function projectAncestorDirectories(projects) {
40698
40769
  if (depth >= 100)
40699
40770
  throw new Error("NATIVE_SKILL_DRIFT: project ancestor discovery limit exceeded");
40700
40771
  directories.add(path);
40701
- const parent = dirname13(path);
40772
+ const parent = dirname14(path);
40702
40773
  if (parent === path)
40703
40774
  break;
40704
40775
  path = parent;
@@ -40729,9 +40800,9 @@ function inventoryNativeSkills(home = homedir3(), options = {}) {
40729
40800
  }
40730
40801
  function emptySiblingCacheAlias(path, parent) {
40731
40802
  const link = readlinkSync2(path), target = resolve14(parent, link);
40732
- if (dirname13(target) !== parent || (isAbsolute15(link) ? link !== target : dirname13(link) !== "."))
40803
+ if (dirname14(target) !== parent || (isAbsolute15(link) ? link !== target : dirname14(link) !== "."))
40733
40804
  return false;
40734
- if (!lstatSync17(target, { throwIfNoEntry: false })?.isDirectory())
40805
+ if (!lstatSync18(target, { throwIfNoEntry: false })?.isDirectory())
40735
40806
  return false;
40736
40807
  const scan = cacheScans.get(target);
40737
40808
  return Boolean(scan?.complete && !scan.hasSkills && scan.entries <= maxAliasProofEntries);
@@ -40743,7 +40814,7 @@ function inventoryNativeSkills(home = homedir3(), options = {}) {
40743
40814
  assertSafePath(path);
40744
40815
  if (!existsSync6(path))
40745
40816
  return scan;
40746
- const stat2 = lstatSync17(path);
40817
+ const stat2 = lstatSync18(path);
40747
40818
  if (stat2.isFile())
40748
40819
  return scan;
40749
40820
  if (!stat2.isDirectory())
@@ -40789,7 +40860,7 @@ function inventoryNativeSkills(home = homedir3(), options = {}) {
40789
40860
  if (isVendor && !options.includeVendor)
40790
40861
  continue;
40791
40862
  const child = join21(path, name);
40792
- if (isVendor && lstatSync17(child, { throwIfNoEntry: false })?.isSymbolicLink()) {
40863
+ if (isVendor && lstatSync18(child, { throwIfNoEntry: false })?.isSymbolicLink()) {
40793
40864
  const target = statSync5(child, { throwIfNoEntry: false });
40794
40865
  if (target?.isFile() || pluginCache && target?.isDirectory() && emptySiblingCacheAlias(child, path)) {
40795
40866
  scan.entries++;
@@ -40999,7 +41070,7 @@ function planAgentIntegration(options) {
40999
41070
  throw new Error("Refusing to overwrite an unrecognized Hermes supervisor");
41000
41071
  if (supervisorBefore !== supervisorAfter)
41001
41072
  changes.push({ path: supervisorPath, before: supervisorBefore, after: supervisorAfter });
41002
- const supervisor = { path: supervisorPath, runtime: process.execPath, sha256: sha(supervisorAfter) };
41073
+ const supervisor = { path: supervisorPath, runtime: process.execPath, sha256: sha2(supervisorAfter) };
41003
41074
  const after2 = configureHermesHooks(before, supervisor, previous);
41004
41075
  if (before !== after2)
41005
41076
  changes.push({ path, before, after: after2 });
@@ -41046,7 +41117,7 @@ function planAgentIntegration(options) {
41046
41117
  agents: [...new Set([...priorAgents, ...options.agents])].sort(),
41047
41118
  home: resolve14(home),
41048
41119
  includeVendor: true,
41049
- ...options.agents.includes("hermes") ? { supervisors: { ...policy.bridge?.supervisors, hermes: { path: join21(dataDir2, "agent-hooks", "hermes.js"), runtime: process.execPath, sha256: sha(renderHermesSupervisor(bindings.get("hermes").command, bindings.get("hermes").profileId)) } } } : {},
41120
+ ...options.agents.includes("hermes") ? { supervisors: { ...policy.bridge?.supervisors, hermes: { path: join21(dataDir2, "agent-hooks", "hermes.js"), runtime: process.execPath, sha256: sha2(renderHermesSupervisor(bindings.get("hermes").command, bindings.get("hermes").profileId)) } } } : {},
41050
41121
  commands: { ...policy.bridge?.commands, ...Object.fromEntries([...bindings].map(([agent, binding]) => [agent, binding.command])) },
41051
41122
  profiles: Object.fromEntries([...new Set([...priorAgents, ...options.agents])].sort().map((agent) => [agent, bindings.get(agent)?.profileId ?? policy.bridge?.profiles?.[agent] ?? policy.profileId])),
41052
41123
  disabledBuiltins: options.agents.includes("codex") ? nativeSkills.filter((entry) => entry.agent === "codex" && entry.vendor && entry.path.startsWith(canonicalAgentPath(join21(home, ".codex", "skills", ".system"), aliases) + sep4)).map((entry) => ({ path: entry.path, hash: entry.hash })) : policy.bridge?.disabledBuiltins ?? [],
@@ -41061,10 +41132,10 @@ function planAgentIntegration(options) {
41061
41132
  }
41062
41133
  function atomicWrite2(path, content) {
41063
41134
  assertSafePath(path);
41064
- mkdirSync5(dirname13(path), { recursive: true, mode: 448 });
41135
+ mkdirSync5(dirname14(path), { recursive: true, mode: 448 });
41065
41136
  const temporary = `${path}.skills-${randomUUID3()}`;
41066
41137
  try {
41067
- writeFileSync3(temporary, content, { mode: 384, flag: "wx" });
41138
+ writeFileSync4(temporary, content, { mode: 384, flag: "wx" });
41068
41139
  renameSync3(temporary, path);
41069
41140
  } finally {
41070
41141
  if (existsSync6(temporary))
@@ -41098,8 +41169,8 @@ function applyAgentIntegration(plan) {
41098
41169
  chmodSync(backupRoot, 448);
41099
41170
  for (const [index, change] of plan.changes.entries())
41100
41171
  if (change.before !== null) {
41101
- const backup = join21(backupRoot, `${index}-${sha(change.path).slice(0, 12)}.backup`);
41102
- writeFileSync3(backup, change.before, { mode: 384, flag: "wx" });
41172
+ const backup = join21(backupRoot, `${index}-${sha2(change.path).slice(0, 12)}.backup`);
41173
+ writeFileSync4(backup, change.before, { mode: 384, flag: "wx" });
41103
41174
  backups.push(backup);
41104
41175
  }
41105
41176
  try {
@@ -41107,7 +41178,7 @@ function applyAgentIntegration(plan) {
41107
41178
  recheckRootAliases(aliases);
41108
41179
  if (currentText(change.path) !== change.before)
41109
41180
  throw new Error(`Configuration changed after planning: ${change.path}`);
41110
- for (let directory = dirname13(change.path);!existsSync6(directory); directory = dirname13(directory))
41181
+ for (let directory = dirname14(change.path);!existsSync6(directory); directory = dirname14(directory))
41111
41182
  createdDirectories.add(directory);
41112
41183
  const after = change.after;
41113
41184
  atomicWrite2(change.path, after);
@@ -41116,7 +41187,7 @@ function applyAgentIntegration(plan) {
41116
41187
  recheckRootAliases(aliases);
41117
41188
  for (const binding of plan.discoveryAfter ?? [])
41118
41189
  verifyAgentDiscovery(binding);
41119
- atomicWrite2(join21(backupRoot, "receipt.json"), JSON.stringify({ version: 1, changes: written.map((change) => ({ path: change.path, beforeHash: change.before === null ? null : sha(change.before), afterHash: sha(change.after) })), backups, ...aliases.length ? { rootAliases: aliases } : {} }) + `
41190
+ atomicWrite2(join21(backupRoot, "receipt.json"), JSON.stringify({ version: 1, changes: written.map((change) => ({ path: change.path, beforeHash: change.before === null ? null : sha2(change.before), afterHash: sha2(change.after) })), backups, ...aliases.length ? { rootAliases: aliases } : {} }) + `
41120
41191
  `);
41121
41192
  } catch (error) {
41122
41193
  for (const change of written.reverse()) {
@@ -41147,11 +41218,11 @@ function applyAgentIntegration(plan) {
41147
41218
  }
41148
41219
  function syncArchiveDirectory(path) {
41149
41220
  assertSafePath(path);
41150
- const descriptor = openSync15(path, constants11.O_RDONLY | constants11.O_DIRECTORY | constants11.O_NOFOLLOW | constants11.O_NONBLOCK);
41221
+ const descriptor = openSync16(path, constants12.O_RDONLY | constants12.O_DIRECTORY | constants12.O_NOFOLLOW | constants12.O_NONBLOCK);
41151
41222
  try {
41152
- fsyncSync3(descriptor);
41223
+ fsyncSync4(descriptor);
41153
41224
  } finally {
41154
- closeSync15(descriptor);
41225
+ closeSync16(descriptor);
41155
41226
  }
41156
41227
  }
41157
41228
  function writeArchiveJournal(path, value) {
@@ -41159,18 +41230,18 @@ function writeArchiveJournal(path, value) {
41159
41230
  const temporary = `${path}.skills-${randomUUID3()}`;
41160
41231
  let descriptor;
41161
41232
  try {
41162
- descriptor = openSync15(temporary, constants11.O_WRONLY | constants11.O_CREAT | constants11.O_EXCL | constants11.O_NOFOLLOW, 384);
41163
- writeFileSync3(descriptor, `${JSON.stringify(value)}
41233
+ descriptor = openSync16(temporary, constants12.O_WRONLY | constants12.O_CREAT | constants12.O_EXCL | constants12.O_NOFOLLOW, 384);
41234
+ writeFileSync4(descriptor, `${JSON.stringify(value)}
41164
41235
  `);
41165
- fsyncSync3(descriptor);
41166
- closeSync15(descriptor);
41236
+ fsyncSync4(descriptor);
41237
+ closeSync16(descriptor);
41167
41238
  descriptor = undefined;
41168
41239
  renameSync3(temporary, path);
41169
- syncArchiveDirectory(dirname13(path));
41240
+ syncArchiveDirectory(dirname14(path));
41170
41241
  } finally {
41171
41242
  if (descriptor !== undefined)
41172
- closeSync15(descriptor);
41173
- if (lstatSync17(temporary, { throwIfNoEntry: false }))
41243
+ closeSync16(descriptor);
41244
+ if (lstatSync18(temporary, { throwIfNoEntry: false }))
41174
41245
  unlinkSync4(temporary);
41175
41246
  }
41176
41247
  }
@@ -41195,8 +41266,8 @@ function archiveNativeSkills(inventory, options) {
41195
41266
  const operationId = randomUUID3(), archiveRoot = join21(options.dataDir ?? getDataDir(), "migration", operationId, "native"), receiptPath = join21(archiveRoot, "receipt.json");
41196
41267
  const entries = selected.map((entry, index) => ({
41197
41268
  source: entry.vendor ? join21(entry.path, "SKILL.md") : entry.path,
41198
- archive: join21(archiveRoot, `${index}-${sha(entry.path).slice(0, 12)}`),
41199
- hash: entry.vendor ? sha(readNativeBytes(join21(entry.path, "SKILL.md"))) : entry.hash,
41269
+ archive: join21(archiveRoot, `${index}-${sha2(entry.path).slice(0, 12)}`),
41270
+ hash: entry.vendor ? sha2(readNativeBytes(join21(entry.path, "SKILL.md"))) : entry.hash,
41200
41271
  ...entry.vendor ? { discoveryOnly: true } : {},
41201
41272
  status: "planned"
41202
41273
  }));
@@ -41204,22 +41275,22 @@ function archiveNativeSkills(inventory, options) {
41204
41275
  const moved = [];
41205
41276
  const verifyArchive = (entry) => {
41206
41277
  assertSafePath(entry.archive);
41207
- const stat2 = lstatSync17(entry.archive);
41278
+ const stat2 = lstatSync18(entry.archive);
41208
41279
  if (entry.discoveryOnly ? !stat2.isFile() : !stat2.isDirectory())
41209
41280
  throw new Error("Archive type changed");
41210
- if ((entry.discoveryOnly ? sha(readNativeBytes(entry.archive)) : treeHash(entry.archive)) !== entry.hash)
41281
+ if ((entry.discoveryOnly ? sha2(readNativeBytes(entry.archive)) : treeHash(entry.archive)) !== entry.hash)
41211
41282
  throw new Error("Archive bytes changed");
41212
41283
  };
41213
41284
  assertSafePath(archiveRoot);
41214
41285
  const created = [];
41215
- for (let path = archiveRoot;!existsSync6(path); path = dirname13(path))
41286
+ for (let path = archiveRoot;!existsSync6(path); path = dirname14(path))
41216
41287
  created.push(path);
41217
41288
  mkdirSync5(archiveRoot, { recursive: true, mode: 448 });
41218
41289
  try {
41219
41290
  for (const directory of created)
41220
41291
  syncArchiveDirectory(directory);
41221
41292
  if (created.length)
41222
- syncArchiveDirectory(dirname13(created.at(-1)));
41293
+ syncArchiveDirectory(dirname14(created.at(-1)));
41223
41294
  writeArchiveJournal(receiptPath, journal);
41224
41295
  for (const [index, entry] of selected.entries()) {
41225
41296
  recheckRootAliases(aliases);
@@ -41231,7 +41302,7 @@ function archiveNativeSkills(inventory, options) {
41231
41302
  writeArchiveJournal(receiptPath, journal);
41232
41303
  renameSync3(move.source, move.archive);
41233
41304
  moved.push(move);
41234
- syncArchiveDirectory(dirname13(move.source));
41305
+ syncArchiveDirectory(dirname14(move.source));
41235
41306
  syncArchiveDirectory(archiveRoot);
41236
41307
  verifyArchive(move);
41237
41308
  move.status = "archived";
@@ -41252,7 +41323,7 @@ function archiveNativeSkills(inventory, options) {
41252
41323
  recheckRootAliases(aliases);
41253
41324
  assertSafePath(entry.source);
41254
41325
  assertSafePath(entry.archive);
41255
- if (lstatSync17(entry.source, { throwIfNoEntry: false })) {
41326
+ if (lstatSync18(entry.source, { throwIfNoEntry: false })) {
41256
41327
  entry.status = "recovery-required";
41257
41328
  entry.conflict = "source-occupied";
41258
41329
  continue;
@@ -41266,10 +41337,10 @@ function archiveNativeSkills(inventory, options) {
41266
41337
  }
41267
41338
  if (entry.discoveryOnly) {
41268
41339
  linkSync2(entry.archive, entry.source);
41269
- syncArchiveDirectory(dirname13(entry.source));
41340
+ syncArchiveDirectory(dirname14(entry.source));
41270
41341
  unlinkSync4(entry.archive);
41271
41342
  } else {
41272
- if (lstatSync17(entry.source, { throwIfNoEntry: false })) {
41343
+ if (lstatSync18(entry.source, { throwIfNoEntry: false })) {
41273
41344
  entry.status = "recovery-required";
41274
41345
  entry.conflict = "source-occupied";
41275
41346
  continue;
@@ -41277,7 +41348,7 @@ function archiveNativeSkills(inventory, options) {
41277
41348
  renameSync3(entry.archive, entry.source);
41278
41349
  }
41279
41350
  entry.status = "restored";
41280
- syncArchiveDirectory(dirname13(entry.source));
41351
+ syncArchiveDirectory(dirname14(entry.source));
41281
41352
  syncArchiveDirectory(archiveRoot);
41282
41353
  } catch {
41283
41354
  entry.status = "recovery-required";
@@ -41311,15 +41382,15 @@ import {
41311
41382
  renameSync as renameSync4,
41312
41383
  rmSync as rmSync2,
41313
41384
  statSync as statSync8,
41314
- writeFileSync as writeFileSync5
41385
+ writeFileSync as writeFileSync6
41315
41386
  } from "fs";
41316
- import { basename as basename8, dirname as dirname15, isAbsolute as isAbsolute16, join as join24, normalize as normalize2, relative as relative5, resolve as resolve15, sep as sep6 } from "path";
41387
+ import { basename as basename8, dirname as dirname16, isAbsolute as isAbsolute16, join as join24, normalize as normalize2, relative as relative5, resolve as resolve15, sep as sep6 } from "path";
41317
41388
 
41318
41389
  // src/lib/registry-data/index.ts
41319
41390
  var SKILLS = [];
41320
41391
 
41321
41392
  // src/lib/skill-hash.ts
41322
- import { createHash as createHash15 } from "crypto";
41393
+ import { createHash as createHash17 } from "crypto";
41323
41394
  import { existsSync as existsSync7, readdirSync as readdirSync8, readFileSync as readFileSync14, statSync as statSync6 } from "fs";
41324
41395
  import { join as join22, sep as sep5 } from "path";
41325
41396
  var CONTENT_HASH_ALGORITHM = "sha256";
@@ -41443,13 +41514,13 @@ function* bundleHashParts(files) {
41443
41514
  yield new TextEncoder().encode("\x00");
41444
41515
  }
41445
41516
  function hashBundleFiles(files) {
41446
- const hash2 = createHash15(CONTENT_HASH_ALGORITHM);
41517
+ const hash2 = createHash17(CONTENT_HASH_ALGORITHM);
41447
41518
  for (const part of bundleHashParts(files))
41448
41519
  hash2.update(part);
41449
41520
  return hash2.digest("hex");
41450
41521
  }
41451
41522
  async function hashBundleFilesCooperatively(files, check) {
41452
- const hash2 = createHash15(CONTENT_HASH_ALGORITHM);
41523
+ const hash2 = createHash17(CONTENT_HASH_ALGORITHM);
41453
41524
  let bytesSinceYield = 0;
41454
41525
  for (const part of bundleHashParts(files)) {
41455
41526
  for (let offset = 0;offset < part.byteLength; offset += 64 * 1024) {
@@ -41532,7 +41603,7 @@ function snapshotContentEntries(entries, limits, check) {
41532
41603
  contentLimit("Content hash entry limit exceeded");
41533
41604
  if (Reflect.ownKeys(entries).length !== entries.length + 1)
41534
41605
  invalidContent("Invalid content hash entry array");
41535
- const snapshot = [];
41606
+ const snapshot2 = [];
41536
41607
  const paths = new SkillEntryPaths;
41537
41608
  let rawBytes = 0;
41538
41609
  for (let index = 0;index < entries.length; index++) {
@@ -41556,10 +41627,10 @@ function snapshotContentEntries(entries, limits, check) {
41556
41627
  rawBytes += size;
41557
41628
  const bytes = new Uint8Array(new ArrayBuffer(size));
41558
41629
  bytes.set(entry.bytes);
41559
- snapshot.push({ path: entry.path, bytes, mode: entry.mode });
41630
+ snapshot2.push({ path: entry.path, bytes, mode: entry.mode });
41560
41631
  }
41561
41632
  check();
41562
- return snapshot;
41633
+ return snapshot2;
41563
41634
  }
41564
41635
  function coveredContentPath(path) {
41565
41636
  const segments = path.split("/");
@@ -41607,12 +41678,12 @@ async function hashContentEntries(entries, options) {
41607
41678
  try {
41608
41679
  signal?.addEventListener("abort", abort, { once: true });
41609
41680
  check();
41610
- const snapshot = snapshotContentEntries(entries, limits, check);
41681
+ const snapshot2 = snapshotContentEntries(entries, limits, check);
41611
41682
  const normalized = [];
41612
41683
  let normalizedBytes = 0;
41613
41684
  let manifest;
41614
41685
  await new Promise((resolve15) => setImmediate(resolve15));
41615
- for (const entry of snapshot) {
41686
+ for (const entry of snapshot2) {
41616
41687
  check();
41617
41688
  if (!coveredContentPath(entry.path))
41618
41689
  continue;
@@ -41832,13 +41903,13 @@ function validateRuntimeContract(manifest, issues, strict) {
41832
41903
  import {
41833
41904
  cpSync,
41834
41905
  existsSync as existsSync8,
41835
- lstatSync as lstatSync18,
41906
+ lstatSync as lstatSync19,
41836
41907
  mkdirSync as mkdirSync6,
41837
41908
  readFileSync as readFileSync15,
41838
41909
  realpathSync as realpathSync5,
41839
- writeFileSync as writeFileSync4
41910
+ writeFileSync as writeFileSync5
41840
41911
  } from "fs";
41841
- import { basename as basename7, dirname as dirname14, join as join23, relative as relative4 } from "path";
41912
+ import { basename as basename7, dirname as dirname15, join as join23, relative as relative4 } from "path";
41842
41913
  var ANY_SEGMENT_COPY_EXCLUDES = new Set([
41843
41914
  ".git",
41844
41915
  ".DS_Store",
@@ -41956,7 +42027,7 @@ function createInstructionManifest(name, options) {
41956
42027
  }
41957
42028
  function writeInstructionSkillTemplate(skillPath, manifest) {
41958
42029
  mkdirSync6(skillPath, { recursive: true });
41959
- writeFileSync4(join23(skillPath, "SKILL.md"), renderInstructionSkillMd(manifest));
42030
+ writeFileSync5(join23(skillPath, "SKILL.md"), renderInstructionSkillMd(manifest));
41960
42031
  writeSkillJsonWithHash(skillPath, manifest);
41961
42032
  }
41962
42033
  function renderInstructionSkillMd(manifest) {
@@ -42007,11 +42078,11 @@ function createPortableManifest(name, options) {
42007
42078
  }
42008
42079
  function writePortableSkillTemplate(skillPath, manifest) {
42009
42080
  mkdirSync6(join23(skillPath, "src"), { recursive: true });
42010
- writeFileSync4(join23(skillPath, "SKILL.md"), renderSkillMd(manifest));
42011
- writeFileSync4(join23(skillPath, "AGENTS.md"), renderAgentsMd(manifest));
42012
- writeFileSync4(join23(skillPath, "package.json"), renderPackageJson(manifest));
42013
- writeFileSync4(join23(skillPath, "tsconfig.json"), renderTsconfig());
42014
- writeFileSync4(join23(skillPath, "src", "index.ts"), renderEntrypoint(manifest));
42081
+ writeFileSync5(join23(skillPath, "SKILL.md"), renderSkillMd(manifest));
42082
+ writeFileSync5(join23(skillPath, "AGENTS.md"), renderAgentsMd(manifest));
42083
+ writeFileSync5(join23(skillPath, "package.json"), renderPackageJson(manifest));
42084
+ writeFileSync5(join23(skillPath, "tsconfig.json"), renderTsconfig());
42085
+ writeFileSync5(join23(skillPath, "src", "index.ts"), renderEntrypoint(manifest));
42015
42086
  writeSkillJsonWithHash(skillPath, manifest);
42016
42087
  }
42017
42088
  function fillContractDefaults(manifest, entrypoint) {
@@ -42036,7 +42107,7 @@ function writeSkillJsonWithHash(skillPath, manifest) {
42036
42107
  content_hash: undefined
42037
42108
  }
42038
42109
  };
42039
- writeFileSync4(join23(skillPath, "skill.json"), `${JSON.stringify({ ...existing, ...renderSkillJsonObject(withoutHash) }, null, 2)}
42110
+ writeFileSync5(join23(skillPath, "skill.json"), `${JSON.stringify({ ...existing, ...renderSkillJsonObject(withoutHash) }, null, 2)}
42040
42111
  `);
42041
42112
  const hash2 = computeContentHash(skillPath);
42042
42113
  const withHash = {
@@ -42046,7 +42117,7 @@ function writeSkillJsonWithHash(skillPath, manifest) {
42046
42117
  content_hash: hash2
42047
42118
  }
42048
42119
  };
42049
- writeFileSync4(join23(skillPath, "skill.json"), `${JSON.stringify({ ...existing, ...renderSkillJsonObject(withHash) }, null, 2)}
42120
+ writeFileSync5(join23(skillPath, "skill.json"), `${JSON.stringify({ ...existing, ...renderSkillJsonObject(withHash) }, null, 2)}
42050
42121
  `);
42051
42122
  return withHash;
42052
42123
  }
@@ -42086,18 +42157,18 @@ function ensurePortableSkillFiles(skillPath, manifest) {
42086
42157
  };
42087
42158
  const entry = next.commands[0]?.entry ?? "src/index.ts";
42088
42159
  if (entry && !existsSync8(join23(skillPath, entry))) {
42089
- mkdirSync6(dirname14(join23(skillPath, entry)), { recursive: true });
42090
- writeFileSync4(join23(skillPath, entry), renderEntrypoint(next));
42160
+ mkdirSync6(dirname15(join23(skillPath, entry)), { recursive: true });
42161
+ writeFileSync5(join23(skillPath, entry), renderEntrypoint(next));
42091
42162
  }
42092
42163
  if (!existsSync8(join23(skillPath, "SKILL.md")))
42093
- writeFileSync4(join23(skillPath, "SKILL.md"), renderSkillMd(next));
42164
+ writeFileSync5(join23(skillPath, "SKILL.md"), renderSkillMd(next));
42094
42165
  else
42095
- writeFileSync4(join23(skillPath, "SKILL.md"), ensureSkillMdFrontmatter(readFileSync15(join23(skillPath, "SKILL.md"), "utf-8"), next));
42166
+ writeFileSync5(join23(skillPath, "SKILL.md"), ensureSkillMdFrontmatter(readFileSync15(join23(skillPath, "SKILL.md"), "utf-8"), next));
42096
42167
  if (!existsSync8(join23(skillPath, "AGENTS.md")))
42097
- writeFileSync4(join23(skillPath, "AGENTS.md"), renderAgentsMd(next));
42168
+ writeFileSync5(join23(skillPath, "AGENTS.md"), renderAgentsMd(next));
42098
42169
  ensurePackageJson(skillPath, next);
42099
42170
  if (!existsSync8(join23(skillPath, "tsconfig.json")))
42100
- writeFileSync4(join23(skillPath, "tsconfig.json"), renderTsconfig());
42171
+ writeFileSync5(join23(skillPath, "tsconfig.json"), renderTsconfig());
42101
42172
  writeSkillJsonWithHash(skillPath, next);
42102
42173
  return readPortableSkillManifest(skillPath, next.name);
42103
42174
  }
@@ -42107,7 +42178,7 @@ function ensurePackageJson(skillPath, manifest) {
42107
42178
  const commandName = normalizePortableSkillName(first.name || manifest.name);
42108
42179
  const entry = (first.entry ?? "src/index.ts").replace(/^\.\//, "");
42109
42180
  if (!existsSync8(pkgPath)) {
42110
- writeFileSync4(pkgPath, renderPackageJson(manifest));
42181
+ writeFileSync5(pkgPath, renderPackageJson(manifest));
42111
42182
  return;
42112
42183
  }
42113
42184
  const existing = readJsonObject(pkgPath);
@@ -42126,7 +42197,7 @@ function ensurePackageJson(skillPath, manifest) {
42126
42197
  const scripts = isRecord2(existing.scripts) ? { ...existing.scripts } : {};
42127
42198
  if (!stringValue(scripts.dev))
42128
42199
  scripts.dev = `bun run ${entry}`;
42129
- writeFileSync4(pkgPath, `${JSON.stringify({
42200
+ writeFileSync5(pkgPath, `${JSON.stringify({
42130
42201
  ...existing,
42131
42202
  name: manifest.name,
42132
42203
  version: manifest.version,
@@ -42150,20 +42221,20 @@ function ensureInstructionSkillFiles(skillPath, manifest) {
42150
42221
  commands: []
42151
42222
  };
42152
42223
  if (!existsSync8(join23(skillPath, "SKILL.md"))) {
42153
- writeFileSync4(join23(skillPath, "SKILL.md"), renderSkillMd(next));
42224
+ writeFileSync5(join23(skillPath, "SKILL.md"), renderSkillMd(next));
42154
42225
  } else {
42155
42226
  const path = join23(skillPath, "SKILL.md");
42156
42227
  const content = readFileSync15(path, "utf8");
42157
42228
  const declaredName = parseSkillFrontmatter(content)?.name;
42158
42229
  if (declaredName && declaredName !== next.name) {
42159
- writeFileSync4(path, renameInstructionFrontmatter(content, next.name));
42230
+ writeFileSync5(path, renameInstructionFrontmatter(content, next.name));
42160
42231
  }
42161
42232
  }
42162
42233
  const packagePath = join23(skillPath, "package.json");
42163
42234
  if (existsSync8(packagePath)) {
42164
42235
  const pkg = readJsonObject(packagePath);
42165
42236
  if (typeof pkg.name === "string" && pkg.name !== next.name) {
42166
- writeFileSync4(packagePath, `${JSON.stringify({ ...pkg, name: next.name }, null, 2)}
42237
+ writeFileSync5(packagePath, `${JSON.stringify({ ...pkg, name: next.name }, null, 2)}
42167
42238
  `);
42168
42239
  }
42169
42240
  }
@@ -42191,7 +42262,7 @@ function renameInstructionFrontmatter(content, name) {
42191
42262
  return renamed + content.slice(frontmatter[0].length);
42192
42263
  }
42193
42264
  function copySkillDirectory(source, destination) {
42194
- const resolvedSource = lstatSync18(source).isSymbolicLink() ? realpathSync5(source) : source;
42265
+ const resolvedSource = lstatSync19(source).isSymbolicLink() ? realpathSync5(source) : source;
42195
42266
  mkdirSync6(destination, { recursive: true });
42196
42267
  cpSync(resolvedSource, destination, {
42197
42268
  recursive: true,
@@ -42204,7 +42275,7 @@ function copySkillDirectory(source, destination) {
42204
42275
  if (isExcludedCopyEntry(segments[i], i === 0))
42205
42276
  return false;
42206
42277
  }
42207
- if (lstatSync18(src).isSymbolicLink())
42278
+ if (lstatSync19(src).isSymbolicLink())
42208
42279
  return false;
42209
42280
  return true;
42210
42281
  }
@@ -42625,7 +42696,7 @@ function physicalImportPath(path) {
42625
42696
  const suffix = [];
42626
42697
  while (!existsSync9(ancestor)) {
42627
42698
  suffix.unshift(basename8(ancestor));
42628
- ancestor = dirname15(ancestor);
42699
+ ancestor = dirname16(ancestor);
42629
42700
  }
42630
42701
  return join24(realpathSync6(ancestor), ...suffix);
42631
42702
  }
@@ -42662,7 +42733,7 @@ function portPortableSkill(sourcePath, options = {}) {
42662
42733
  throw new Error(`Skill '${skillName}' already exists at ${destination}`);
42663
42734
  rmSync2(destination, { recursive: true, force: true });
42664
42735
  }
42665
- mkdirSync7(dirname15(destination), { recursive: true });
42736
+ mkdirSync7(dirname16(destination), { recursive: true });
42666
42737
  copySkillDirectory(absoluteSource, destination);
42667
42738
  const base = {
42668
42739
  ...inferred,
@@ -42702,7 +42773,7 @@ function writeCorpusSkill(input, options = {}) {
42702
42773
  const skillPath = join24(root2, name);
42703
42774
  const created = !existsSync9(skillPath);
42704
42775
  mkdirSync7(skillPath, { recursive: true });
42705
- writeFileSync5(join24(skillPath, "SKILL.md"), input.skillMd);
42776
+ writeFileSync6(join24(skillPath, "SKILL.md"), input.skillMd);
42706
42777
  const manifest = buildCorpusManifest(input, name);
42707
42778
  writeSkillJsonWithHash(skillPath, manifest);
42708
42779
  return { name, path: skillPath, manifest, created };
@@ -42717,7 +42788,7 @@ function installCorpusSkillAtomically(input, options = {}) {
42717
42788
  let moved = false;
42718
42789
  let backup = null;
42719
42790
  try {
42720
- writeFileSync5(join24(staging, "SKILL.md"), input.skillMd);
42791
+ writeFileSync6(join24(staging, "SKILL.md"), input.skillMd);
42721
42792
  const manifest = buildCorpusManifest(input, name);
42722
42793
  writeSkillJsonWithHash(staging, manifest);
42723
42794
  if (existsSync9(target)) {
@@ -42933,7 +43004,7 @@ function isSkillsOwnershipMarker(marker) {
42933
43004
  function hasSkillsOwnershipMarker(dir) {
42934
43005
  const path = join25(dir, SYNC_MARKER_FILE);
42935
43006
  try {
42936
- if (!lstatSync19(path).isFile())
43007
+ if (!lstatSync20(path).isFile())
42937
43008
  return false;
42938
43009
  const marker = JSON.parse(readFileSync16(path, "utf8"));
42939
43010
  return isSkillsOwnershipMarker(marker);
@@ -43159,7 +43230,7 @@ function writeManagedSkillDir(dir, skillMd, options) {
43159
43230
  const action = dirExists ? "update" : "create";
43160
43231
  if (options.dryRun)
43161
43232
  return { action, path: skillMdPath };
43162
- const parentDir = dirname16(dir);
43233
+ const parentDir = dirname17(dir);
43163
43234
  mkdirSync8(parentDir, { recursive: true });
43164
43235
  const transactionDir = mkdtempSync2(join25(parentDir, `.hasna-skills-write-${basename9(dir)}-`));
43165
43236
  const candidateDir = join25(transactionDir, "candidate");
@@ -43181,10 +43252,10 @@ function writeManagedSkillDir(dir, skillMd, options) {
43181
43252
  } else {
43182
43253
  mkdirSync8(candidateDir, { recursive: true });
43183
43254
  }
43184
- writeFileSync6(candidateSkillMdPath, skillMd.endsWith(`
43255
+ writeFileSync7(candidateSkillMdPath, skillMd.endsWith(`
43185
43256
  `) ? skillMd : `${skillMd}
43186
43257
  `);
43187
- writeFileSync6(candidateMarkerPath, `${JSON.stringify(marker, null, 2)}
43258
+ writeFileSync7(candidateMarkerPath, `${JSON.stringify(marker, null, 2)}
43188
43259
  `);
43189
43260
  if (dirExists) {
43190
43261
  originalMoved = true;
@@ -43572,7 +43643,7 @@ function getAllTags() {
43572
43643
  }
43573
43644
 
43574
43645
  // src/lib/project-state.ts
43575
- import { existsSync as existsSync12, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync7 } from "fs";
43646
+ import { existsSync as existsSync12, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync8 } from "fs";
43576
43647
  import { join as join27 } from "path";
43577
43648
  var VALID_PIN_SOURCES = [
43578
43649
  "official",
@@ -43621,7 +43692,7 @@ function saveProjectConfig(config, targetDir = process.cwd()) {
43621
43692
  const dir = getProjectStateDir(targetDir);
43622
43693
  mkdirSync9(dir, { recursive: true });
43623
43694
  const normalized = normalizeProjectConfig({ ...config, updatedAt: new Date().toISOString() });
43624
- writeFileSync7(getProjectConfigPath(targetDir), JSON.stringify(normalized, null, 2) + `
43695
+ writeFileSync8(getProjectConfigPath(targetDir), JSON.stringify(normalized, null, 2) + `
43625
43696
  `);
43626
43697
  }
43627
43698
  function pinProjectSkill(name, details = {}, targetDir = process.cwd()) {
@@ -44525,8 +44596,8 @@ async function executeSelectedLocal(selected, options = {}) {
44525
44596
  throw new SkillSelectionError("INVALID_BUNDLE_PATH", "The execution bundle path exceeds its limit.");
44526
44597
  });
44527
44598
  const destination = join30(runDirectory, entry.path);
44528
- mkdirSync10(dirname17(destination), { recursive: true, mode: 448 });
44529
- writeFileSync8(destination, entry.bytes, { flag: "wx", mode: entry.mode & 511 });
44599
+ mkdirSync10(dirname18(destination), { recursive: true, mode: 448 });
44600
+ writeFileSync9(destination, entry.bytes, { flag: "wx", mode: entry.mode & 511 });
44530
44601
  }
44531
44602
  env.SKILLS_INPUT_JSON = input;
44532
44603
  env.SKILLS_WORKSPACE_DIR = resolve16(options.cwd ?? process.cwd());
@@ -44559,13 +44630,13 @@ async function executeSelectedLocal(selected, options = {}) {
44559
44630
  selection: selection2,
44560
44631
  target: "local",
44561
44632
  runtime: runtimeName,
44562
- inputDigest: `sha256:${createHash16("sha256").update(input).digest("hex")}`,
44633
+ inputDigest: `sha256:${createHash18("sha256").update(input).digest("hex")}`,
44563
44634
  runDirectory,
44564
44635
  ...executionGrant ? { executionGrant } : {},
44565
44636
  ...bindings ? { secretBinding: { schema: bindings.schema, selection: bindings.selection, consumer: bindings.consumer, secretsAuthority: bindings.secretsAuthority, bindings: bindings.bindings } } : {},
44566
44637
  ...result
44567
44638
  };
44568
- writeFileSync8(join30(runDirectory, ".execution-receipt.json"), JSON.stringify({ ...receipt, stdout: undefined, stderr: undefined }), { mode: 384 });
44639
+ writeFileSync9(join30(runDirectory, ".execution-receipt.json"), JSON.stringify({ ...receipt, stdout: undefined, stderr: undefined }), { mode: 384 });
44569
44640
  return receipt;
44570
44641
  }
44571
44642
  async function subprocess(command, cwd, env, input, timeoutMs) {
@@ -53849,7 +53920,7 @@ var import_node_http_handler2 = __toESM(require_dist_cjs6(), 1);
53849
53920
 
53850
53921
  // node_modules/@aws-sdk/checksums/dist-cjs/submodules/sha/index.js
53851
53922
  var { toUint8Array: toUint8Array2, concatBytes } = require_serde();
53852
- var { createHmac: createHmac2, createHash: createHash18 } = __require("crypto");
53923
+ var { createHmac: createHmac2, createHash: createHash20 } = __require("crypto");
53853
53924
  var { Sha256: Sha2562, Sha256Js, Sha256Node } = require_checksum();
53854
53925
  var BLOCK2 = 64;
53855
53926
  var DIGEST_LENGTH = 20;
@@ -54018,7 +54089,7 @@ class Sha1Js {
54018
54089
  }
54019
54090
  var hasNativeCrypto = (() => {
54020
54091
  try {
54021
- createHash18("sha1");
54092
+ createHash20("sha1");
54022
54093
  return true;
54023
54094
  } catch {
54024
54095
  return false;
@@ -54058,7 +54129,7 @@ function buildNativeClass() {
54058
54129
  this.finished = false;
54059
54130
  }
54060
54131
  createHash() {
54061
- return this.secret ? createHmac2("sha1", toBuffer(this.secret)) : createHash18("sha1");
54132
+ return this.secret ? createHmac2("sha1", toBuffer(this.secret)) : createHash20("sha1");
54062
54133
  }
54063
54134
  };
54064
54135
  }
@@ -54627,7 +54698,7 @@ function assertReservationCents(value, field2) {
54627
54698
  import { Database as Database2 } from "bun:sqlite";
54628
54699
  import { randomUUID as randomUUID8 } from "crypto";
54629
54700
  import { mkdirSync as mkdirSync12 } from "fs";
54630
- import { dirname as dirname21 } from "path";
54701
+ import { dirname as dirname22 } from "path";
54631
54702
 
54632
54703
  // src/server/database-url.ts
54633
54704
  import { isAbsolute as isAbsolute17, join as join32 } from "path";
@@ -54923,12 +54994,12 @@ class PostgresSkillSelectionStore {
54923
54994
  // src/server/sqlite-store.ts
54924
54995
  import { randomUUID as randomUUID7 } from "crypto";
54925
54996
  import { mkdirSync as mkdirSync11, readFileSync as readFileSync22, readdirSync as readdirSync12 } from "fs";
54926
- import { dirname as dirname20, join as join34 } from "path";
54997
+ import { dirname as dirname21, join as join34 } from "path";
54927
54998
 
54928
54999
  // src/server/auth.ts
54929
- import { createHash as createHash19 } from "crypto";
55000
+ import { createHash as createHash21 } from "crypto";
54930
55001
  function hashApiKey(token) {
54931
- return createHash19("sha256").update(token).digest("hex");
55002
+ return createHash21("sha256").update(token).digest("hex");
54932
55003
  }
54933
55004
  function bearerToken(request2) {
54934
55005
  const header = request2.headers.get("authorization") || "";
@@ -54982,7 +55053,7 @@ function permitsSkillsRoute(principal, method, resource) {
54982
55053
 
54983
55054
  // src/server/migrations-dir.ts
54984
55055
  import { existsSync as existsSync15 } from "fs";
54985
- import { dirname as dirname19, join as join33 } from "path";
55056
+ import { dirname as dirname20, join as join33 } from "path";
54986
55057
  var MIGRATION_DIALECTS = ["postgres", "sqlite"];
54987
55058
  var MAX_WALK_UP = 6;
54988
55059
  function findMigrationsRoot(startDirs = defaultStartDirs()) {
@@ -54992,7 +55063,7 @@ function findMigrationsRoot(startDirs = defaultStartDirs()) {
54992
55063
  const candidate2 = join33(dir, "migrations");
54993
55064
  if (MIGRATION_DIALECTS.some((dialect) => existsSync15(join33(candidate2, dialect))))
54994
55065
  return candidate2;
54995
- const parent = dirname19(dir);
55066
+ const parent = dirname20(dir);
54996
55067
  if (parent === dir)
54997
55068
  break;
54998
55069
  dir = parent;
@@ -55238,7 +55309,7 @@ function validOperatorScopeEnrollmentInput(input) {
55238
55309
  }
55239
55310
 
55240
55311
  // src/lib/revision.ts
55241
- import { createHash as createHash20 } from "crypto";
55312
+ import { createHash as createHash22 } from "crypto";
55242
55313
  var REVISION_ID_PATTERN = /^[0-9a-f]{64}$/;
55243
55314
  function revisionIdOf(content) {
55244
55315
  const canonicalContent = {
@@ -55260,7 +55331,7 @@ function revisionIdOf(content) {
55260
55331
  canonicalContent.replacementSlug = content.replacementSlug ?? null;
55261
55332
  }
55262
55333
  const canonical4 = JSON.stringify(canonicalContent);
55263
- return createHash20("sha256").update(canonical4).digest("hex");
55334
+ return createHash22("sha256").update(canonical4).digest("hex");
55264
55335
  }
55265
55336
  function revisionIdOfRecord(record3) {
55266
55337
  return revisionIdOf(record3);
@@ -55285,7 +55356,7 @@ class SqliteSkillsStore {
55285
55356
  constructor(path = SQLITE_MEMORY_PATH, options = {}) {
55286
55357
  const inMemory = path === SQLITE_MEMORY_PATH;
55287
55358
  if (!inMemory)
55288
- mkdirSync11(dirname20(path), { recursive: true });
55359
+ mkdirSync11(dirname21(path), { recursive: true });
55289
55360
  this.db = openDatabase(path);
55290
55361
  this.db.exec(`PRAGMA busy_timeout = ${Math.max(0, options.busyTimeoutMs ?? 5000)}`);
55291
55362
  if (!inMemory)
@@ -56095,7 +56166,7 @@ class SqliteGovernanceStore {
56095
56166
  closed = false;
56096
56167
  constructor(path = SQLITE_MEMORY_PATH, options = {}) {
56097
56168
  if (path !== SQLITE_MEMORY_PATH)
56098
- mkdirSync12(dirname21(path), { recursive: true });
56169
+ mkdirSync12(dirname22(path), { recursive: true });
56099
56170
  this.db = new Database2(path, { create: true, readwrite: true });
56100
56171
  this.db.exec("PRAGMA busy_timeout = 5000");
56101
56172
  this.db.exec("PRAGMA foreign_keys = ON");
@@ -56328,7 +56399,7 @@ function nextMonthPrefix(monthPrefix) {
56328
56399
  }
56329
56400
 
56330
56401
  // src/server/skills-api.ts
56331
- import { createHash as createHash21 } from "crypto";
56402
+ import { createHash as createHash23 } from "crypto";
56332
56403
  var SLUG_PATTERN = /^[a-z0-9][a-z0-9._-]*$/;
56333
56404
  var SHA256_HEX2 = /^[0-9a-f]{64}$/;
56334
56405
  var MAX_SLUG_LENGTH = 128;
@@ -56518,7 +56589,7 @@ async function parsePublishRequest(request2, config) {
56518
56589
  if (bundleBytes.byteLength === 0) {
56519
56590
  throw new SkillRequestError(400, "BUNDLE_EMPTY", "the uploaded bundle is empty");
56520
56591
  }
56521
- const sha2562 = createHash21("sha256").update(bundleBytes).digest("hex");
56592
+ const sha2562 = createHash23("sha256").update(bundleBytes).digest("hex");
56522
56593
  const claimed = optionalString(manifest.bundleSha256);
56523
56594
  if (claimed)
56524
56595
  assertSha2562(claimed);
@@ -56633,7 +56704,7 @@ async function readPublishedBundle(store, artifactStorage, principal, slug) {
56633
56704
  if (!bytes) {
56634
56705
  throw new SkillRequestError(503, "BUNDLE_BACKEND_UNAVAILABLE", "bundle storage backend unavailable");
56635
56706
  }
56636
- const actual = createHash21("sha256").update(bytes).digest("hex");
56707
+ const actual = createHash23("sha256").update(bytes).digest("hex");
56637
56708
  if (actual !== record3.bundleSha256) {
56638
56709
  throw new SkillRequestError(500, "BUNDLE_DIGEST_DRIFT", `stored bundle for '${slug}' hashes to ${actual} but was published as ${record3.bundleSha256}`);
56639
56710
  }
@@ -56781,7 +56852,7 @@ async function readSkillVersionBundle(store, artifactStorage, principal, slug, v
56781
56852
  const bytes = await artifactStorage.readBundle(bundle2);
56782
56853
  if (!bytes)
56783
56854
  throw new SkillRequestError(503, "BUNDLE_BACKEND_UNAVAILABLE", "bundle storage backend unavailable");
56784
- const actual = createHash21("sha256").update(bytes).digest("hex");
56855
+ const actual = createHash23("sha256").update(bytes).digest("hex");
56785
56856
  if (actual !== found.bundleSha256) {
56786
56857
  throw new SkillRequestError(500, "BUNDLE_DIGEST_DRIFT", `stored bundle for '${slug}@${version2}' hashes to ${actual} but was published as ${found.bundleSha256}`);
56787
56858
  }
@@ -57183,7 +57254,7 @@ async function handleProfileApi(store, principal, request2, parts, config) {
57183
57254
  // src/server/runtime-store.ts
57184
57255
  import { Database as Database3 } from "bun:sqlite";
57185
57256
  import { mkdirSync as mkdirSync13 } from "fs";
57186
- import { dirname as dirname22 } from "path";
57257
+ import { dirname as dirname23 } from "path";
57187
57258
 
57188
57259
  // src/sdk/execution/types.ts
57189
57260
  var EXECUTION_PROTOCOL_VERSION = REMOTE_SKILL_RUN_CONTRACT_VERSION;
@@ -57239,7 +57310,7 @@ class RuntimeExecutionStore {
57239
57310
  }
57240
57311
  const path = target.kind === "sqlite" ? target.path : ":memory:";
57241
57312
  if (path !== ":memory:")
57242
- mkdirSync13(dirname22(path), { recursive: true });
57313
+ mkdirSync13(dirname23(path), { recursive: true });
57243
57314
  const db = new Database3(path);
57244
57315
  db.run("PRAGMA busy_timeout=5000");
57245
57316
  db.run("PRAGMA journal_mode=WAL");
@@ -57479,7 +57550,7 @@ class RuntimeExecutionStore {
57479
57550
  }
57480
57551
 
57481
57552
  // src/sdk/execution/admission.ts
57482
- import { createHash as createHash23 } from "crypto";
57553
+ import { createHash as createHash25 } from "crypto";
57483
57554
 
57484
57555
  // src/sdk/execution/image-profile.ts
57485
57556
  class ImageProfileResolutionError extends Error {
@@ -58091,11 +58162,11 @@ function ownedAdmission(admission) {
58091
58162
  };
58092
58163
  }
58093
58164
  function digestInput(input) {
58094
- return createHash23("sha256").update(canonicalJson2(input)).digest("hex");
58165
+ return createHash25("sha256").update(canonicalJson2(input)).digest("hex");
58095
58166
  }
58096
58167
 
58097
58168
  // src/sdk/execution/dispatchers/ecs.ts
58098
- import { createHash as createHash24 } from "crypto";
58169
+ import { createHash as createHash26 } from "crypto";
58099
58170
 
58100
58171
  // src/sdk/execution/state-machine.ts
58101
58172
  var LEGAL_TRANSITIONS = {
@@ -61495,13 +61566,13 @@ function observedTask(states, taskArn) {
61495
61566
  return state2.lastStatus === "STOPPED" || LIVE_TASK_STATUSES.has(state2.lastStatus) ? state2 : undefined;
61496
61567
  }
61497
61568
  function clientTokenFor(runId3, attemptId) {
61498
- return createHash24("sha256").update(`${runId3}\x00${attemptId}`).digest("hex").slice(0, CLIENT_TOKEN_BYTES * 2);
61569
+ return createHash26("sha256").update(`${runId3}\x00${attemptId}`).digest("hex").slice(0, CLIENT_TOKEN_BYTES * 2);
61499
61570
  }
61500
61571
  function startedByFor(runId3, attemptNumber) {
61501
61572
  return `skills-exec/${runId3}/a${attemptNumber}`;
61502
61573
  }
61503
61574
  function requestDigestFor(admission, attemptId) {
61504
- return createHash24("sha256").update(canonicalJson2({ admission, attemptId })).digest("hex");
61575
+ return createHash26("sha256").update(canonicalJson2({ admission, attemptId })).digest("hex");
61505
61576
  }
61506
61577
 
61507
61578
  class EcsDispatcher {
@@ -61797,10 +61868,10 @@ function validText(value) {
61797
61868
  }
61798
61869
 
61799
61870
  // src/server/runtime-policy.ts
61800
- import { createHash as createHash26, createHmac as createHmac3, timingSafeEqual as timingSafeEqual2 } from "crypto";
61871
+ import { createHash as createHash28, createHmac as createHmac3, timingSafeEqual as timingSafeEqual2 } from "crypto";
61801
61872
 
61802
61873
  // src/server/runtime-pure-contract.ts
61803
- import { createHash as createHash25 } from "crypto";
61874
+ import { createHash as createHash27 } from "crypto";
61804
61875
  var PURE_DESCRIPTOR = Object.freeze({
61805
61876
  id: "regex-test.v1",
61806
61877
  runtime: "bun",
@@ -61824,7 +61895,7 @@ var PURE_LIMITS = Object.freeze({
61824
61895
  maxArtifactsBytes: 0,
61825
61896
  maxConcurrency: 1
61826
61897
  });
61827
- var hash2 = (bytes) => createHash25("sha256").update(bytes).digest("hex");
61898
+ var hash2 = (bytes) => createHash27("sha256").update(bytes).digest("hex");
61828
61899
  var object5 = (v2) => {
61829
61900
  if (!v2 || typeof v2 !== "object" || Array.isArray(v2))
61830
61901
  throw Error("Pure contract requires an object");
@@ -62053,7 +62124,7 @@ function verifyRuntimeToken(token, key, admission, attempt, now = Date.now()) {
62053
62124
  const actual = Buffer.from(token);
62054
62125
  return actual.length === expected.length && timingSafeEqual2(actual, expected);
62055
62126
  }
62056
- var hashBytes = (bytes) => createHash26("sha256").update(bytes).digest("hex");
62127
+ var hashBytes = (bytes) => createHash28("sha256").update(bytes).digest("hex");
62057
62128
 
62058
62129
  // src/server/runtime-api.ts
62059
62130
  async function createRuntimeService(options) {
@@ -68386,7 +68457,7 @@ var localRunExecutor = {
68386
68457
  // src/sdk/storage.ts
68387
68458
  var artifactStorageSeam = ArtifactStorage;
68388
68459
  // src/sdk/outputs.ts
68389
- import { createHash as createHash27 } from "crypto";
68460
+ import { createHash as createHash29 } from "crypto";
68390
68461
  class DatabaseOnlyObjectStore {
68391
68462
  usesS3 = false;
68392
68463
  async materialize(run, artifact, body4) {
@@ -68433,7 +68504,7 @@ function createGovernedArtifactWriter(options) {
68433
68504
  const stamped = {
68434
68505
  ...meta,
68435
68506
  byteSize: outputBytes,
68436
- sha256: createHash27("sha256").update(persistedBytes).digest("hex"),
68507
+ sha256: createHash29("sha256").update(persistedBytes).digest("hex"),
68437
68508
  visibility: options.visibility ?? config.defaultVisibility,
68438
68509
  ...config.artifactTtlSeconds !== undefined ? { expiresAt: expiresAtFor(createdAt, config.artifactTtlSeconds) } : {}
68439
68510
  };
@@ -87200,7 +87271,7 @@ function date4(params) {
87200
87271
  return _coercedDate(ZodDate2, params);
87201
87272
  }
87202
87273
  // src/lib/canonical-json.ts
87203
- import { createHash as createHash28 } from "crypto";
87274
+ import { createHash as createHash30 } from "crypto";
87204
87275
  function canonicalJson3(value, maximumBytes = 2 * 1024 * 1024) {
87205
87276
  return canonicalJsonAtDepth(value, maximumBytes, 64);
87206
87277
  }
@@ -87244,7 +87315,7 @@ function canonicalJsonAtDepth(value, maximumBytes, maximumDepth) {
87244
87315
  return visit3(value, 0);
87245
87316
  }
87246
87317
  function canonicalJsonSha256(value, maximumBytes) {
87247
- return createHash28("sha256").update(canonicalJson3(value, maximumBytes)).digest("hex");
87318
+ return createHash30("sha256").update(canonicalJson3(value, maximumBytes)).digest("hex");
87248
87319
  }
87249
87320
 
87250
87321
  // src/lib/remote-recurring-contract.ts
@@ -87387,8 +87458,8 @@ var inputs = {
87387
87458
  };
87388
87459
  function recurringInput(action, raw) {
87389
87460
  try {
87390
- const snapshot = JSON.parse(canonicalJson3(raw, action === "preview" ? 1048576 : 4096));
87391
- return inputs[action].parse(snapshot);
87461
+ const snapshot2 = JSON.parse(canonicalJson3(raw, action === "preview" ? 1048576 : 4096));
87462
+ return inputs[action].parse(snapshot2);
87392
87463
  } catch {
87393
87464
  throw new RecurringInputError;
87394
87465
  }
@@ -89345,7 +89416,7 @@ async function requestInvitationEmail(origin, action, input2) {
89345
89416
  }
89346
89417
 
89347
89418
  // src/lib/remote-private-publications.ts
89348
- import { createHash as createHash29 } from "crypto";
89419
+ import { createHash as createHash31 } from "crypto";
89349
89420
  var PRIVATE_PUBLICATION_MAX_BYTES = 16 * 1024 * 1024;
89350
89421
  var failures2 = {
89351
89422
  INVALID_REQUEST: [400, "The publication request is invalid."],
@@ -89392,7 +89463,7 @@ var hash4 = (v2) => typeof v2 === "string" && /^[a-f0-9]{64}$/.test(v2);
89392
89463
  var record9 = (v2) => !!v2 && typeof v2 === "object" && !Array.isArray(v2);
89393
89464
  var exact = (v2, keys3) => record9(v2) && Object.keys(v2).sort().join(",") === keys3.sort().join(",");
89394
89465
  var date5 = (v2) => typeof v2 === "string" && /^\d{4}-\d\d-\d\dT[0-9:.]+(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/.test(v2) && Number.isFinite(Date.parse(v2));
89395
- var publicationSha256 = (bytes) => createHash29("sha256").update(bytes).digest("hex");
89466
+ var publicationSha256 = (bytes) => createHash31("sha256").update(bytes).digest("hex");
89396
89467
  function checkedPublicationDeclaration(value) {
89397
89468
  if (!exact(value, ["idempotencyKey", "version", "expectedCurrentVersionId", "manifestText", "archiveSha256", "archiveByteSize"]) || !publicationUuid(value.idempotencyKey) || !(value.expectedCurrentVersionId === null || publicationUuid(value.expectedCurrentVersionId)) || typeof value.version !== "string" || !value.version || value.version.length > 128 || /[\p{Cc}\p{Cs}]/u.test(value.version) || typeof value.manifestText !== "string" || Buffer.byteLength(value.manifestText) > 16384 || !hash4(value.archiveSha256) || !Number.isSafeInteger(value.archiveByteSize) || Number(value.archiveByteSize) < 1 || Number(value.archiveByteSize) > PRIVATE_PUBLICATION_MAX_BYTES)
89398
89469
  return bad();
@@ -89874,8 +89945,8 @@ class RemoteSkillsAuthClient {
89874
89945
  }
89875
89946
  }
89876
89947
  // src/lib/private-publication-recovery.ts
89877
- import { constants as constants12, closeSync as closeSync16, fsyncSync as fsyncSync4, fstatSync as fstatSync16, lstatSync as lstatSync20, mkdirSync as mkdirSync14, openSync as openSync16, readSync as readSync11, realpathSync as realpathSync8, renameSync as renameSync6, unlinkSync as unlinkSync5, writeFileSync as writeFileSync9 } from "fs";
89878
- import { dirname as dirname23, isAbsolute as isAbsolute18, join as join36, resolve as resolve18 } from "path";
89948
+ import { constants as constants13, closeSync as closeSync17, fsyncSync as fsyncSync5, fstatSync as fstatSync17, lstatSync as lstatSync21, mkdirSync as mkdirSync14, openSync as openSync17, readSync as readSync12, realpathSync as realpathSync8, renameSync as renameSync6, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "fs";
89949
+ import { dirname as dirname24, isAbsolute as isAbsolute18, join as join36, resolve as resolve18 } from "path";
89879
89950
  import { randomUUID as randomUUID11 } from "crypto";
89880
89951
  var fail = () => {
89881
89952
  throw new PrivatePublicationError("PUBLICATION_RECOVERY_INVALID", "The recovery directory is invalid or changed. Preserve it and inspect the existing intent; do not start a replacement automatically.");
@@ -89883,14 +89954,14 @@ var fail = () => {
89883
89954
  function safeDirectory(directory) {
89884
89955
  if (!isAbsolute18(directory) || directory !== resolve18(directory) || realpathSync8(directory) !== directory)
89885
89956
  return fail();
89886
- for (let path2 = directory;; path2 = dirname23(path2)) {
89887
- const stat2 = lstatSync20(path2);
89957
+ for (let path2 = directory;; path2 = dirname24(path2)) {
89958
+ const stat2 = lstatSync21(path2);
89888
89959
  if (!stat2.isDirectory() || stat2.isSymbolicLink())
89889
89960
  return fail();
89890
- if (path2 === dirname23(path2))
89961
+ if (path2 === dirname24(path2))
89891
89962
  break;
89892
89963
  }
89893
- const own2 = lstatSync20(directory);
89964
+ const own2 = lstatSync21(directory);
89894
89965
  if ((own2.mode & 63) !== 0 || process.getuid && own2.uid !== process.getuid())
89895
89966
  return fail();
89896
89967
  return { dev: own2.dev, ino: own2.ino };
@@ -89902,35 +89973,35 @@ function unchangedDirectory(directory, identity3) {
89902
89973
  }
89903
89974
  function readOwned(directory, name, max) {
89904
89975
  const identity3 = safeDirectory(directory), file2 = join36(directory, name);
89905
- const fd = openSync16(file2, constants12.O_RDONLY | constants12.O_NOFOLLOW);
89976
+ const fd = openSync17(file2, constants13.O_RDONLY | constants13.O_NOFOLLOW);
89906
89977
  try {
89907
- const stat2 = fstatSync16(fd);
89978
+ const stat2 = fstatSync17(fd);
89908
89979
  if (!stat2.isFile() || stat2.nlink !== 1 || stat2.size > max || stat2.size < 1 || (stat2.mode & 63) !== 0 || process.getuid && stat2.uid !== process.getuid())
89909
89980
  return fail();
89910
89981
  const buffer = Buffer.alloc(Math.min(max, stat2.size) + 1);
89911
89982
  let length = 0;
89912
89983
  while (length < buffer.length) {
89913
- const count = readSync11(fd, buffer, length, buffer.length - length, length);
89984
+ const count = readSync12(fd, buffer, length, buffer.length - length, length);
89914
89985
  if (count === 0)
89915
89986
  break;
89916
89987
  length += count;
89917
89988
  }
89918
- const bytes = buffer.subarray(0, length), after = fstatSync16(fd);
89989
+ const bytes = buffer.subarray(0, length), after = fstatSync17(fd);
89919
89990
  unchangedDirectory(directory, identity3);
89920
89991
  if (bytes.length !== stat2.size || stat2.size !== after.size || stat2.mtimeMs !== after.mtimeMs || stat2.ctimeMs !== after.ctimeMs)
89921
89992
  return fail();
89922
89993
  return bytes;
89923
89994
  } finally {
89924
- closeSync16(fd);
89995
+ closeSync17(fd);
89925
89996
  }
89926
89997
  }
89927
89998
  function writeOwned(directory, name, bytes) {
89928
- const fd = openSync16(join36(directory, name), constants12.O_WRONLY | constants12.O_CREAT | constants12.O_EXCL | constants12.O_NOFOLLOW, 384);
89999
+ const fd = openSync17(join36(directory, name), constants13.O_WRONLY | constants13.O_CREAT | constants13.O_EXCL | constants13.O_NOFOLLOW, 384);
89929
90000
  try {
89930
- writeFileSync9(fd, bytes);
89931
- fsyncSync4(fd);
90001
+ writeFileSync10(fd, bytes);
90002
+ fsyncSync5(fd);
89932
90003
  } finally {
89933
- closeSync16(fd);
90004
+ closeSync17(fd);
89934
90005
  }
89935
90006
  }
89936
90007
  function save(directory, value) {
@@ -89939,11 +90010,11 @@ function save(directory, value) {
89939
90010
  `);
89940
90011
  unchangedDirectory(directory, identity3);
89941
90012
  renameSync6(join36(directory, temporary), join36(directory, "receipt.json"));
89942
- const fd = openSync16(directory, constants12.O_RDONLY | constants12.O_NOFOLLOW);
90013
+ const fd = openSync17(directory, constants13.O_RDONLY | constants13.O_NOFOLLOW);
89943
90014
  try {
89944
- fsyncSync4(fd);
90015
+ fsyncSync5(fd);
89945
90016
  } finally {
89946
- closeSync16(fd);
90017
+ closeSync17(fd);
89947
90018
  }
89948
90019
  }
89949
90020
  function bind(client2, receipt) {
@@ -89954,20 +90025,20 @@ async function locked(directory, action) {
89954
90025
  const identity3 = safeDirectory(directory), file2 = join36(directory, "operation.lock");
89955
90026
  let fd;
89956
90027
  try {
89957
- fd = openSync16(file2, constants12.O_WRONLY | constants12.O_CREAT | constants12.O_EXCL | constants12.O_NOFOLLOW, 384);
90028
+ fd = openSync17(file2, constants13.O_WRONLY | constants13.O_CREAT | constants13.O_EXCL | constants13.O_NOFOLLOW, 384);
89958
90029
  } catch {
89959
90030
  throw new PrivatePublicationError("PUBLICATION_RECOVERY_BUSY", "Another operation holds this recovery directory. If it crashed, confirm that process has stopped before explicitly removing operation.lock and resuming.");
89960
90031
  }
89961
- const lock = fstatSync16(fd);
90032
+ const lock = fstatSync17(fd);
89962
90033
  try {
89963
- writeFileSync9(fd, JSON.stringify({ pid: process.pid }) + `
90034
+ writeFileSync10(fd, JSON.stringify({ pid: process.pid }) + `
89964
90035
  `);
89965
- fsyncSync4(fd);
90036
+ fsyncSync5(fd);
89966
90037
  return await action();
89967
90038
  } finally {
89968
- closeSync16(fd);
90039
+ closeSync17(fd);
89969
90040
  unchangedDirectory(directory, identity3);
89970
- const now2 = lstatSync20(file2);
90041
+ const now2 = lstatSync21(file2);
89971
90042
  if (now2.dev !== lock.dev || now2.ino !== lock.ino || !now2.isFile() || now2.isSymbolicLink())
89972
90043
  fail();
89973
90044
  unlinkSync5(file2);
@@ -90019,15 +90090,15 @@ async function preparePrivatePublication(client2, sourceDirectory, recoveryDirec
90019
90090
  phase: "prepared",
90020
90091
  intent: null
90021
90092
  };
90022
- if (!isAbsolute18(recoveryDirectory) || resolve18(recoveryDirectory) !== recoveryDirectory || realpathSync8(dirname23(recoveryDirectory)) !== dirname23(recoveryDirectory))
90093
+ if (!isAbsolute18(recoveryDirectory) || resolve18(recoveryDirectory) !== recoveryDirectory || realpathSync8(dirname24(recoveryDirectory)) !== dirname24(recoveryDirectory))
90023
90094
  return fail();
90024
90095
  mkdirSync14(recoveryDirectory, { mode: 448 });
90025
90096
  safeDirectory(recoveryDirectory);
90026
- const parent = openSync16(dirname23(recoveryDirectory), constants12.O_RDONLY | constants12.O_NOFOLLOW);
90097
+ const parent = openSync17(dirname24(recoveryDirectory), constants13.O_RDONLY | constants13.O_NOFOLLOW);
90027
90098
  try {
90028
- fsyncSync4(parent);
90099
+ fsyncSync5(parent);
90029
90100
  } finally {
90030
- closeSync16(parent);
90101
+ closeSync17(parent);
90031
90102
  }
90032
90103
  writeOwned(recoveryDirectory, "bundle.tgz", packed.bytes);
90033
90104
  save(recoveryDirectory, receipt);
@@ -90135,7 +90206,7 @@ function exact2(value, names) {
90135
90206
  const keys3 = Object.keys(value).sort(), expected = [...names].sort();
90136
90207
  return keys3.length === expected.length && keys3.every((key, index) => key === expected[index]);
90137
90208
  }
90138
- function snapshot(value, maximum) {
90209
+ function snapshot2(value, maximum) {
90139
90210
  let nodes4 = 0, bytes = 0;
90140
90211
  const parts = [], ancestors2 = new Set;
90141
90212
  const append = (part) => {
@@ -90214,7 +90285,7 @@ function snapshot(value, maximum) {
90214
90285
  }
90215
90286
  function requestSnapshot(input2) {
90216
90287
  try {
90217
- const owned = snapshot(input2, SKILL_OPERATION_LIMITS.requestBytes), value = owned.value;
90288
+ const owned = snapshot2(input2, SKILL_OPERATION_LIMITS.requestBytes), value = owned.value;
90218
90289
  if (!record10(value) || !exact2(value, ["contractVersion", "requestId", "operation", "input"]) || value.contractVersion !== 1 || !validId(value.requestId) || typeof value.operation !== "string" || value.operation.length > 128 || !/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/.test(value.operation) || !record10(value.input))
90219
90290
  throw Error();
90220
90291
  return { ...owned, value };
@@ -90224,7 +90295,7 @@ function requestSnapshot(input2) {
90224
90295
  }
90225
90296
  function resultSnapshot(input2, requestId) {
90226
90297
  try {
90227
- const value = snapshot(input2, SKILL_OPERATION_LIMITS.resultBytes).value;
90298
+ const value = snapshot2(input2, SKILL_OPERATION_LIMITS.resultBytes).value;
90228
90299
  if (!record10(value) || value.contractVersion !== 1 || value.requestId !== requestId)
90229
90300
  throw Error();
90230
90301
  const fields = ["contractVersion", "requestId", "status"];