clawdentity 0.0.16 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/bin.js +100 -21
  2. package/dist/index.js +100 -21
  3. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -18651,7 +18651,7 @@ var createConfigCommand = (dependencies = {}) => {
18651
18651
 
18652
18652
  // src/commands/connector.ts
18653
18653
  import { execFile as execFileCallback } from "child_process";
18654
- import { mkdir as mkdir4, readFile as readFile3, rm, writeFile as writeFile4 } from "fs/promises";
18654
+ import { mkdir as mkdir4, readFile as readFile4, rm, writeFile as writeFile4 } from "fs/promises";
18655
18655
  import { homedir as homedir2 } from "os";
18656
18656
  import { dirname as dirname3, join as join5 } from "path";
18657
18657
  import { fileURLToPath } from "url";
@@ -19320,7 +19320,7 @@ var ConnectorClient = class {
19320
19320
 
19321
19321
  // ../../packages/connector/src/runtime.ts
19322
19322
  import { randomBytes as randomBytes2 } from "crypto";
19323
- import { mkdir as mkdir3, rename as rename2, writeFile as writeFile3 } from "fs/promises";
19323
+ import { mkdir as mkdir3, readFile as readFile3, rename as rename2, writeFile as writeFile3 } from "fs/promises";
19324
19324
  import {
19325
19325
  createServer
19326
19326
  } from "http";
@@ -19497,6 +19497,63 @@ async function writeRegistryAuthAtomic(input) {
19497
19497
  `, "utf8");
19498
19498
  await rename2(tmpPath, targetPath);
19499
19499
  }
19500
+ function parseRegistryAuthFromDisk(payload) {
19501
+ if (!isRecord5(payload)) {
19502
+ return void 0;
19503
+ }
19504
+ const tokenType = payload.tokenType;
19505
+ const accessToken = payload.accessToken;
19506
+ const accessExpiresAt = payload.accessExpiresAt;
19507
+ const refreshToken = payload.refreshToken;
19508
+ const refreshExpiresAt = payload.refreshExpiresAt;
19509
+ if (tokenType !== "Bearer" || typeof accessToken !== "string" || typeof accessExpiresAt !== "string" || typeof refreshToken !== "string" || typeof refreshExpiresAt !== "string") {
19510
+ return void 0;
19511
+ }
19512
+ return {
19513
+ tokenType,
19514
+ accessToken,
19515
+ accessExpiresAt,
19516
+ refreshToken,
19517
+ refreshExpiresAt
19518
+ };
19519
+ }
19520
+ async function readRegistryAuthFromDisk(input) {
19521
+ const authPath = join4(
19522
+ input.configDir,
19523
+ AGENTS_DIR_NAME2,
19524
+ input.agentName,
19525
+ REGISTRY_AUTH_FILENAME
19526
+ );
19527
+ let raw;
19528
+ try {
19529
+ raw = await readFile3(authPath, "utf8");
19530
+ } catch (error48) {
19531
+ if (error48 && typeof error48 === "object" && "code" in error48 && error48.code === "ENOENT") {
19532
+ return void 0;
19533
+ }
19534
+ input.logger.warn("connector.runtime.registry_auth_read_failed", {
19535
+ authPath,
19536
+ reason: error48 instanceof Error ? error48.message : "unknown"
19537
+ });
19538
+ return void 0;
19539
+ }
19540
+ let parsed;
19541
+ try {
19542
+ parsed = JSON.parse(raw);
19543
+ } catch {
19544
+ input.logger.warn("connector.runtime.registry_auth_invalid_json", {
19545
+ authPath
19546
+ });
19547
+ return void 0;
19548
+ }
19549
+ const auth = parseRegistryAuthFromDisk(parsed);
19550
+ if (auth === void 0) {
19551
+ input.logger.warn("connector.runtime.registry_auth_invalid_shape", {
19552
+ authPath
19553
+ });
19554
+ }
19555
+ return auth;
19556
+ }
19500
19557
  async function readRequestJson(req) {
19501
19558
  const chunks = [];
19502
19559
  let totalBytes = 0;
@@ -19560,7 +19617,25 @@ async function startConnectorRuntime(input) {
19560
19617
  parseRequiredString(input.credentials.secretKey, "secretKey")
19561
19618
  );
19562
19619
  let currentAuth = toInitialAuthBundle(input.credentials);
19620
+ const syncAuthFromDisk = async () => {
19621
+ const diskAuth = await readRegistryAuthFromDisk({
19622
+ configDir: input.configDir,
19623
+ agentName: input.agentName,
19624
+ logger: logger12
19625
+ });
19626
+ if (!diskAuth) {
19627
+ return;
19628
+ }
19629
+ if (diskAuth.accessToken === currentAuth.accessToken && diskAuth.accessExpiresAt === currentAuth.accessExpiresAt && diskAuth.refreshToken === currentAuth.refreshToken && diskAuth.refreshExpiresAt === currentAuth.refreshExpiresAt) {
19630
+ return;
19631
+ }
19632
+ currentAuth = diskAuth;
19633
+ logger12.info("connector.runtime.registry_auth_synced", {
19634
+ agentName: input.agentName
19635
+ });
19636
+ };
19563
19637
  const refreshCurrentAuthIfNeeded = async () => {
19638
+ await syncAuthFromDisk();
19564
19639
  if (!shouldRefreshAccessToken(currentAuth, Date.now())) {
19565
19640
  return;
19566
19641
  }
@@ -19604,6 +19679,7 @@ async function startConnectorRuntime(input) {
19604
19679
  const statusPath = DEFAULT_CONNECTOR_STATUS_PATH;
19605
19680
  const outboundUrl = new URL(outboundPath, outboundBaseUrl).toString();
19606
19681
  const relayToPeer = async (request) => {
19682
+ await syncAuthFromDisk();
19607
19683
  const peerUrl = new URL(request.peerProxyUrl);
19608
19684
  const body = JSON.stringify(request.payload ?? {});
19609
19685
  const refreshKey = `${REFRESH_SINGLE_FLIGHT_PREFIX}:${input.configDir}:${input.agentName}`;
@@ -19648,7 +19724,10 @@ async function startConnectorRuntime(input) {
19648
19724
  await executeWithAgentAuthRefreshRetry({
19649
19725
  key: refreshKey,
19650
19726
  shouldRetry: isRetryableRelayAuthError,
19651
- getAuth: async () => currentAuth,
19727
+ getAuth: async () => {
19728
+ await syncAuthFromDisk();
19729
+ return currentAuth;
19730
+ },
19652
19731
  persistAuth: async (nextAuth) => {
19653
19732
  currentAuth = nextAuth;
19654
19733
  await writeRegistryAuthAtomic({
@@ -20395,7 +20474,7 @@ async function uninstallConnectorServiceForAgent(agentName, commandOptions = {},
20395
20474
  async function startConnectorForAgent(agentName, commandOptions = {}, dependencies = {}) {
20396
20475
  const resolveConfigImpl = dependencies.resolveConfigImpl ?? resolveConfig;
20397
20476
  const getConfigDirImpl = dependencies.getConfigDirImpl ?? getConfigDir;
20398
- const readFileImpl = dependencies.readFileImpl ?? ((path, encoding) => readFile3(path, encoding));
20477
+ const readFileImpl = dependencies.readFileImpl ?? ((path, encoding) => readFile4(path, encoding));
20399
20478
  const fetchImpl = dependencies.fetchImpl ?? globalThis.fetch;
20400
20479
  const loadConnectorModule = dependencies.loadConnectorModule ?? loadDefaultConnectorModule;
20401
20480
  const configDir = getConfigDirImpl();
@@ -20943,7 +21022,7 @@ var createInviteCommand = (dependencies = {}) => {
20943
21022
  import { spawn } from "child_process";
20944
21023
  import { randomBytes as randomBytes3 } from "crypto";
20945
21024
  import { existsSync } from "fs";
20946
- import { chmod as chmod3, copyFile, mkdir as mkdir5, readFile as readFile4, writeFile as writeFile5 } from "fs/promises";
21025
+ import { chmod as chmod3, copyFile, mkdir as mkdir5, readFile as readFile5, writeFile as writeFile5 } from "fs/promises";
20947
21026
  import { homedir as homedir3 } from "os";
20948
21027
  import { dirname as dirname4, join as join6, resolve as resolvePath } from "path";
20949
21028
  import { fileURLToPath as fileURLToPath2 } from "url";
@@ -21212,7 +21291,7 @@ function resolveTransformPeersPath(openclawDir) {
21212
21291
  return join6(openclawDir, "hooks", "transforms", RELAY_PEERS_FILE_NAME);
21213
21292
  }
21214
21293
  async function readJsonFile(filePath) {
21215
- const raw = await readFile4(filePath, "utf8");
21294
+ const raw = await readFile5(filePath, "utf8");
21216
21295
  try {
21217
21296
  return JSON.parse(raw);
21218
21297
  } catch {
@@ -21230,7 +21309,7 @@ async function ensureLocalAgentCredentials(homeDir, agentName) {
21230
21309
  for (const filePath of requiredFiles) {
21231
21310
  let content;
21232
21311
  try {
21233
- content = await readFile4(filePath, "utf8");
21312
+ content = await readFile5(filePath, "utf8");
21234
21313
  } catch (error48) {
21235
21314
  if (getErrorCode2(error48) === "ENOENT") {
21236
21315
  throw createCliError6(
@@ -21524,7 +21603,7 @@ function resolveConnectorPidPath(homeDir, agentName) {
21524
21603
  }
21525
21604
  async function readConnectorPidFile(pidPath) {
21526
21605
  try {
21527
- const raw = (await readFile4(pidPath, "utf8")).trim();
21606
+ const raw = (await readFile5(pidPath, "utf8")).trim();
21528
21607
  if (raw.length === 0) {
21529
21608
  return void 0;
21530
21609
  }
@@ -22039,7 +22118,7 @@ async function runOpenclawDoctor(options = {}) {
22039
22118
  const selectedAgentPath = resolveOpenclawAgentNamePath(homeDir);
22040
22119
  let selectedAgentName;
22041
22120
  try {
22042
- const selectedAgentRaw = await readFile4(selectedAgentPath, "utf8");
22121
+ const selectedAgentRaw = await readFile5(selectedAgentPath, "utf8");
22043
22122
  selectedAgentName = assertValidAgentName(selectedAgentRaw.trim());
22044
22123
  checks.push(
22045
22124
  toDoctorCheck({
@@ -22162,9 +22241,9 @@ async function runOpenclawDoctor(options = {}) {
22162
22241
  const relayTransformRuntimePath = resolveTransformRuntimePath(openclawDir);
22163
22242
  const relayTransformPeersPath = resolveTransformPeersPath(openclawDir);
22164
22243
  try {
22165
- const transformContents = await readFile4(transformTargetPath, "utf8");
22166
- const runtimeContents = await readFile4(relayTransformRuntimePath, "utf8");
22167
- const peersSnapshotContents = await readFile4(
22244
+ const transformContents = await readFile5(transformTargetPath, "utf8");
22245
+ const runtimeContents = await readFile5(relayTransformRuntimePath, "utf8");
22246
+ const peersSnapshotContents = await readFile5(
22168
22247
  relayTransformPeersPath,
22169
22248
  "utf8"
22170
22249
  );
@@ -22873,7 +22952,7 @@ import {
22873
22952
  chmod as chmod4,
22874
22953
  mkdir as mkdir6,
22875
22954
  readdir,
22876
- readFile as readFile5,
22955
+ readFile as readFile6,
22877
22956
  unlink as unlink2,
22878
22957
  writeFile as writeFile6
22879
22958
  } from "fs/promises";
@@ -23388,7 +23467,7 @@ function parsePairStatusResponse(payload) {
23388
23467
  };
23389
23468
  }
23390
23469
  async function readAgentProofMaterial(agentName, dependencies) {
23391
- const readFileImpl = dependencies.readFileImpl ?? readFile5;
23470
+ const readFileImpl = dependencies.readFileImpl ?? readFile6;
23392
23471
  const getConfigDirImpl = dependencies.getConfigDirImpl ?? getConfigDir;
23393
23472
  const normalizedAgentName = assertValidAgentName(agentName);
23394
23473
  const agentDir = join7(
@@ -23571,7 +23650,7 @@ function resolveConfirmTicketSource(options) {
23571
23650
  }
23572
23651
  async function persistPairedPeer(input) {
23573
23652
  const getConfigDirImpl = input.dependencies.getConfigDirImpl ?? getConfigDir;
23574
- const readFileImpl = input.dependencies.readFileImpl ?? readFile5;
23653
+ const readFileImpl = input.dependencies.readFileImpl ?? readFile6;
23575
23654
  const mkdirImpl = input.dependencies.mkdirImpl ?? mkdir6;
23576
23655
  const writeFileImpl = input.dependencies.writeFileImpl ?? writeFile6;
23577
23656
  const chmodImpl = input.dependencies.chmodImpl ?? chmod4;
@@ -23669,7 +23748,7 @@ async function confirmPairing(agentName, options, dependencies = {}) {
23669
23748
  const resolveConfigImpl = dependencies.resolveConfigImpl ?? resolveConfig;
23670
23749
  const nowSecondsImpl = dependencies.nowSecondsImpl ?? (() => Math.floor(Date.now() / 1e3));
23671
23750
  const nonceFactoryImpl = dependencies.nonceFactoryImpl ?? (() => randomBytes4(NONCE_SIZE2).toString("base64url"));
23672
- const readFileImpl = dependencies.readFileImpl ?? readFile5;
23751
+ const readFileImpl = dependencies.readFileImpl ?? readFile6;
23673
23752
  const qrDecodeImpl = dependencies.qrDecodeImpl ?? decodeTicketFromPng;
23674
23753
  const config2 = await resolveConfigImpl();
23675
23754
  const ticketSource = resolveConfirmTicketSource(options);
@@ -24041,7 +24120,7 @@ import { Command as Command9 } from "commander";
24041
24120
 
24042
24121
  // src/install-skill-mode.ts
24043
24122
  import { constants, existsSync as existsSync2 } from "fs";
24044
- import { access as access3, copyFile as copyFile2, mkdir as mkdir7, readdir as readdir2, readFile as readFile6 } from "fs/promises";
24123
+ import { access as access3, copyFile as copyFile2, mkdir as mkdir7, readdir as readdir2, readFile as readFile7 } from "fs/promises";
24045
24124
  import { createRequire } from "module";
24046
24125
  import { homedir as homedir4 } from "os";
24047
24126
  import { dirname as dirname6, join as join8, relative } from "path";
@@ -24230,10 +24309,10 @@ async function resolveArtifacts(input) {
24230
24309
  );
24231
24310
  }
24232
24311
  async function copyArtifact(input) {
24233
- const sourceContent = await readFile6(input.sourcePath);
24312
+ const sourceContent = await readFile7(input.sourcePath);
24234
24313
  let existingContent;
24235
24314
  try {
24236
- existingContent = await readFile6(input.targetPath);
24315
+ existingContent = await readFile7(input.targetPath);
24237
24316
  } catch (error48) {
24238
24317
  if (getErrorCode3(error48) !== "ENOENT") {
24239
24318
  throw error48;
@@ -24365,7 +24444,7 @@ var createSkillCommand = () => {
24365
24444
  };
24366
24445
 
24367
24446
  // src/commands/verify.ts
24368
- import { readFile as readFile7 } from "fs/promises";
24447
+ import { readFile as readFile8 } from "fs/promises";
24369
24448
  import { Command as Command10 } from "commander";
24370
24449
  var logger10 = createLogger({ service: "cli", module: "verify" });
24371
24450
  var REGISTRY_KEYS_CACHE_FILE = "registry-keys.json";
@@ -24414,7 +24493,7 @@ var resolveToken = async (tokenOrFile) => {
24414
24493
  throw new VerifyCommandError("invalid token (value is empty)");
24415
24494
  }
24416
24495
  try {
24417
- const fileContents = await readFile7(input, "utf-8");
24496
+ const fileContents = await readFile8(input, "utf-8");
24418
24497
  const token = fileContents.trim();
24419
24498
  if (token.length === 0) {
24420
24499
  throw new VerifyCommandError(`invalid token (${input} is empty)`);
package/dist/index.js CHANGED
@@ -18651,7 +18651,7 @@ var createConfigCommand = (dependencies = {}) => {
18651
18651
 
18652
18652
  // src/commands/connector.ts
18653
18653
  import { execFile as execFileCallback } from "child_process";
18654
- import { mkdir as mkdir4, readFile as readFile3, rm, writeFile as writeFile4 } from "fs/promises";
18654
+ import { mkdir as mkdir4, readFile as readFile4, rm, writeFile as writeFile4 } from "fs/promises";
18655
18655
  import { homedir as homedir2 } from "os";
18656
18656
  import { dirname as dirname3, join as join5 } from "path";
18657
18657
  import { fileURLToPath } from "url";
@@ -19320,7 +19320,7 @@ var ConnectorClient = class {
19320
19320
 
19321
19321
  // ../../packages/connector/src/runtime.ts
19322
19322
  import { randomBytes as randomBytes2 } from "crypto";
19323
- import { mkdir as mkdir3, rename as rename2, writeFile as writeFile3 } from "fs/promises";
19323
+ import { mkdir as mkdir3, readFile as readFile3, rename as rename2, writeFile as writeFile3 } from "fs/promises";
19324
19324
  import {
19325
19325
  createServer
19326
19326
  } from "http";
@@ -19497,6 +19497,63 @@ async function writeRegistryAuthAtomic(input) {
19497
19497
  `, "utf8");
19498
19498
  await rename2(tmpPath, targetPath);
19499
19499
  }
19500
+ function parseRegistryAuthFromDisk(payload) {
19501
+ if (!isRecord5(payload)) {
19502
+ return void 0;
19503
+ }
19504
+ const tokenType = payload.tokenType;
19505
+ const accessToken = payload.accessToken;
19506
+ const accessExpiresAt = payload.accessExpiresAt;
19507
+ const refreshToken = payload.refreshToken;
19508
+ const refreshExpiresAt = payload.refreshExpiresAt;
19509
+ if (tokenType !== "Bearer" || typeof accessToken !== "string" || typeof accessExpiresAt !== "string" || typeof refreshToken !== "string" || typeof refreshExpiresAt !== "string") {
19510
+ return void 0;
19511
+ }
19512
+ return {
19513
+ tokenType,
19514
+ accessToken,
19515
+ accessExpiresAt,
19516
+ refreshToken,
19517
+ refreshExpiresAt
19518
+ };
19519
+ }
19520
+ async function readRegistryAuthFromDisk(input) {
19521
+ const authPath = join4(
19522
+ input.configDir,
19523
+ AGENTS_DIR_NAME2,
19524
+ input.agentName,
19525
+ REGISTRY_AUTH_FILENAME
19526
+ );
19527
+ let raw;
19528
+ try {
19529
+ raw = await readFile3(authPath, "utf8");
19530
+ } catch (error48) {
19531
+ if (error48 && typeof error48 === "object" && "code" in error48 && error48.code === "ENOENT") {
19532
+ return void 0;
19533
+ }
19534
+ input.logger.warn("connector.runtime.registry_auth_read_failed", {
19535
+ authPath,
19536
+ reason: error48 instanceof Error ? error48.message : "unknown"
19537
+ });
19538
+ return void 0;
19539
+ }
19540
+ let parsed;
19541
+ try {
19542
+ parsed = JSON.parse(raw);
19543
+ } catch {
19544
+ input.logger.warn("connector.runtime.registry_auth_invalid_json", {
19545
+ authPath
19546
+ });
19547
+ return void 0;
19548
+ }
19549
+ const auth = parseRegistryAuthFromDisk(parsed);
19550
+ if (auth === void 0) {
19551
+ input.logger.warn("connector.runtime.registry_auth_invalid_shape", {
19552
+ authPath
19553
+ });
19554
+ }
19555
+ return auth;
19556
+ }
19500
19557
  async function readRequestJson(req) {
19501
19558
  const chunks = [];
19502
19559
  let totalBytes = 0;
@@ -19560,7 +19617,25 @@ async function startConnectorRuntime(input) {
19560
19617
  parseRequiredString(input.credentials.secretKey, "secretKey")
19561
19618
  );
19562
19619
  let currentAuth = toInitialAuthBundle(input.credentials);
19620
+ const syncAuthFromDisk = async () => {
19621
+ const diskAuth = await readRegistryAuthFromDisk({
19622
+ configDir: input.configDir,
19623
+ agentName: input.agentName,
19624
+ logger: logger11
19625
+ });
19626
+ if (!diskAuth) {
19627
+ return;
19628
+ }
19629
+ if (diskAuth.accessToken === currentAuth.accessToken && diskAuth.accessExpiresAt === currentAuth.accessExpiresAt && diskAuth.refreshToken === currentAuth.refreshToken && diskAuth.refreshExpiresAt === currentAuth.refreshExpiresAt) {
19630
+ return;
19631
+ }
19632
+ currentAuth = diskAuth;
19633
+ logger11.info("connector.runtime.registry_auth_synced", {
19634
+ agentName: input.agentName
19635
+ });
19636
+ };
19563
19637
  const refreshCurrentAuthIfNeeded = async () => {
19638
+ await syncAuthFromDisk();
19564
19639
  if (!shouldRefreshAccessToken(currentAuth, Date.now())) {
19565
19640
  return;
19566
19641
  }
@@ -19604,6 +19679,7 @@ async function startConnectorRuntime(input) {
19604
19679
  const statusPath = DEFAULT_CONNECTOR_STATUS_PATH;
19605
19680
  const outboundUrl = new URL(outboundPath, outboundBaseUrl).toString();
19606
19681
  const relayToPeer = async (request) => {
19682
+ await syncAuthFromDisk();
19607
19683
  const peerUrl = new URL(request.peerProxyUrl);
19608
19684
  const body = JSON.stringify(request.payload ?? {});
19609
19685
  const refreshKey = `${REFRESH_SINGLE_FLIGHT_PREFIX}:${input.configDir}:${input.agentName}`;
@@ -19648,7 +19724,10 @@ async function startConnectorRuntime(input) {
19648
19724
  await executeWithAgentAuthRefreshRetry({
19649
19725
  key: refreshKey,
19650
19726
  shouldRetry: isRetryableRelayAuthError,
19651
- getAuth: async () => currentAuth,
19727
+ getAuth: async () => {
19728
+ await syncAuthFromDisk();
19729
+ return currentAuth;
19730
+ },
19652
19731
  persistAuth: async (nextAuth) => {
19653
19732
  currentAuth = nextAuth;
19654
19733
  await writeRegistryAuthAtomic({
@@ -20395,7 +20474,7 @@ async function uninstallConnectorServiceForAgent(agentName, commandOptions = {},
20395
20474
  async function startConnectorForAgent(agentName, commandOptions = {}, dependencies = {}) {
20396
20475
  const resolveConfigImpl = dependencies.resolveConfigImpl ?? resolveConfig;
20397
20476
  const getConfigDirImpl = dependencies.getConfigDirImpl ?? getConfigDir;
20398
- const readFileImpl = dependencies.readFileImpl ?? ((path, encoding) => readFile3(path, encoding));
20477
+ const readFileImpl = dependencies.readFileImpl ?? ((path, encoding) => readFile4(path, encoding));
20399
20478
  const fetchImpl = dependencies.fetchImpl ?? globalThis.fetch;
20400
20479
  const loadConnectorModule = dependencies.loadConnectorModule ?? loadDefaultConnectorModule;
20401
20480
  const configDir = getConfigDirImpl();
@@ -20943,7 +21022,7 @@ var createInviteCommand = (dependencies = {}) => {
20943
21022
  import { spawn } from "child_process";
20944
21023
  import { randomBytes as randomBytes3 } from "crypto";
20945
21024
  import { existsSync } from "fs";
20946
- import { chmod as chmod3, copyFile, mkdir as mkdir5, readFile as readFile4, writeFile as writeFile5 } from "fs/promises";
21025
+ import { chmod as chmod3, copyFile, mkdir as mkdir5, readFile as readFile5, writeFile as writeFile5 } from "fs/promises";
20947
21026
  import { homedir as homedir3 } from "os";
20948
21027
  import { dirname as dirname4, join as join6, resolve as resolvePath } from "path";
20949
21028
  import { fileURLToPath as fileURLToPath2 } from "url";
@@ -21212,7 +21291,7 @@ function resolveTransformPeersPath(openclawDir) {
21212
21291
  return join6(openclawDir, "hooks", "transforms", RELAY_PEERS_FILE_NAME);
21213
21292
  }
21214
21293
  async function readJsonFile(filePath) {
21215
- const raw = await readFile4(filePath, "utf8");
21294
+ const raw = await readFile5(filePath, "utf8");
21216
21295
  try {
21217
21296
  return JSON.parse(raw);
21218
21297
  } catch {
@@ -21230,7 +21309,7 @@ async function ensureLocalAgentCredentials(homeDir, agentName) {
21230
21309
  for (const filePath of requiredFiles) {
21231
21310
  let content;
21232
21311
  try {
21233
- content = await readFile4(filePath, "utf8");
21312
+ content = await readFile5(filePath, "utf8");
21234
21313
  } catch (error48) {
21235
21314
  if (getErrorCode2(error48) === "ENOENT") {
21236
21315
  throw createCliError6(
@@ -21524,7 +21603,7 @@ function resolveConnectorPidPath(homeDir, agentName) {
21524
21603
  }
21525
21604
  async function readConnectorPidFile(pidPath) {
21526
21605
  try {
21527
- const raw = (await readFile4(pidPath, "utf8")).trim();
21606
+ const raw = (await readFile5(pidPath, "utf8")).trim();
21528
21607
  if (raw.length === 0) {
21529
21608
  return void 0;
21530
21609
  }
@@ -22039,7 +22118,7 @@ async function runOpenclawDoctor(options = {}) {
22039
22118
  const selectedAgentPath = resolveOpenclawAgentNamePath(homeDir);
22040
22119
  let selectedAgentName;
22041
22120
  try {
22042
- const selectedAgentRaw = await readFile4(selectedAgentPath, "utf8");
22121
+ const selectedAgentRaw = await readFile5(selectedAgentPath, "utf8");
22043
22122
  selectedAgentName = assertValidAgentName(selectedAgentRaw.trim());
22044
22123
  checks.push(
22045
22124
  toDoctorCheck({
@@ -22162,9 +22241,9 @@ async function runOpenclawDoctor(options = {}) {
22162
22241
  const relayTransformRuntimePath = resolveTransformRuntimePath(openclawDir);
22163
22242
  const relayTransformPeersPath = resolveTransformPeersPath(openclawDir);
22164
22243
  try {
22165
- const transformContents = await readFile4(transformTargetPath, "utf8");
22166
- const runtimeContents = await readFile4(relayTransformRuntimePath, "utf8");
22167
- const peersSnapshotContents = await readFile4(
22244
+ const transformContents = await readFile5(transformTargetPath, "utf8");
22245
+ const runtimeContents = await readFile5(relayTransformRuntimePath, "utf8");
22246
+ const peersSnapshotContents = await readFile5(
22168
22247
  relayTransformPeersPath,
22169
22248
  "utf8"
22170
22249
  );
@@ -22873,7 +22952,7 @@ import {
22873
22952
  chmod as chmod4,
22874
22953
  mkdir as mkdir6,
22875
22954
  readdir,
22876
- readFile as readFile5,
22955
+ readFile as readFile6,
22877
22956
  unlink as unlink2,
22878
22957
  writeFile as writeFile6
22879
22958
  } from "fs/promises";
@@ -23388,7 +23467,7 @@ function parsePairStatusResponse(payload) {
23388
23467
  };
23389
23468
  }
23390
23469
  async function readAgentProofMaterial(agentName, dependencies) {
23391
- const readFileImpl = dependencies.readFileImpl ?? readFile5;
23470
+ const readFileImpl = dependencies.readFileImpl ?? readFile6;
23392
23471
  const getConfigDirImpl = dependencies.getConfigDirImpl ?? getConfigDir;
23393
23472
  const normalizedAgentName = assertValidAgentName(agentName);
23394
23473
  const agentDir = join7(
@@ -23571,7 +23650,7 @@ function resolveConfirmTicketSource(options) {
23571
23650
  }
23572
23651
  async function persistPairedPeer(input) {
23573
23652
  const getConfigDirImpl = input.dependencies.getConfigDirImpl ?? getConfigDir;
23574
- const readFileImpl = input.dependencies.readFileImpl ?? readFile5;
23653
+ const readFileImpl = input.dependencies.readFileImpl ?? readFile6;
23575
23654
  const mkdirImpl = input.dependencies.mkdirImpl ?? mkdir6;
23576
23655
  const writeFileImpl = input.dependencies.writeFileImpl ?? writeFile6;
23577
23656
  const chmodImpl = input.dependencies.chmodImpl ?? chmod4;
@@ -23669,7 +23748,7 @@ async function confirmPairing(agentName, options, dependencies = {}) {
23669
23748
  const resolveConfigImpl = dependencies.resolveConfigImpl ?? resolveConfig;
23670
23749
  const nowSecondsImpl = dependencies.nowSecondsImpl ?? (() => Math.floor(Date.now() / 1e3));
23671
23750
  const nonceFactoryImpl = dependencies.nonceFactoryImpl ?? (() => randomBytes4(NONCE_SIZE2).toString("base64url"));
23672
- const readFileImpl = dependencies.readFileImpl ?? readFile5;
23751
+ const readFileImpl = dependencies.readFileImpl ?? readFile6;
23673
23752
  const qrDecodeImpl = dependencies.qrDecodeImpl ?? decodeTicketFromPng;
23674
23753
  const config2 = await resolveConfigImpl();
23675
23754
  const ticketSource = resolveConfirmTicketSource(options);
@@ -24041,7 +24120,7 @@ import { Command as Command9 } from "commander";
24041
24120
 
24042
24121
  // src/install-skill-mode.ts
24043
24122
  import { constants, existsSync as existsSync2 } from "fs";
24044
- import { access as access3, copyFile as copyFile2, mkdir as mkdir7, readdir as readdir2, readFile as readFile6 } from "fs/promises";
24123
+ import { access as access3, copyFile as copyFile2, mkdir as mkdir7, readdir as readdir2, readFile as readFile7 } from "fs/promises";
24045
24124
  import { createRequire } from "module";
24046
24125
  import { homedir as homedir4 } from "os";
24047
24126
  import { dirname as dirname6, join as join8, relative } from "path";
@@ -24230,10 +24309,10 @@ async function resolveArtifacts(input) {
24230
24309
  );
24231
24310
  }
24232
24311
  async function copyArtifact(input) {
24233
- const sourceContent = await readFile6(input.sourcePath);
24312
+ const sourceContent = await readFile7(input.sourcePath);
24234
24313
  let existingContent;
24235
24314
  try {
24236
- existingContent = await readFile6(input.targetPath);
24315
+ existingContent = await readFile7(input.targetPath);
24237
24316
  } catch (error48) {
24238
24317
  if (getErrorCode3(error48) !== "ENOENT") {
24239
24318
  throw error48;
@@ -24365,7 +24444,7 @@ var createSkillCommand = () => {
24365
24444
  };
24366
24445
 
24367
24446
  // src/commands/verify.ts
24368
- import { readFile as readFile7 } from "fs/promises";
24447
+ import { readFile as readFile8 } from "fs/promises";
24369
24448
  import { Command as Command10 } from "commander";
24370
24449
  var logger10 = createLogger({ service: "cli", module: "verify" });
24371
24450
  var REGISTRY_KEYS_CACHE_FILE = "registry-keys.json";
@@ -24414,7 +24493,7 @@ var resolveToken = async (tokenOrFile) => {
24414
24493
  throw new VerifyCommandError("invalid token (value is empty)");
24415
24494
  }
24416
24495
  try {
24417
- const fileContents = await readFile7(input, "utf-8");
24496
+ const fileContents = await readFile8(input, "utf-8");
24418
24497
  const token = fileContents.trim();
24419
24498
  if (token.length === 0) {
24420
24499
  throw new VerifyCommandError(`invalid token (${input} is empty)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawdentity",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"