@ouro.bot/cli 0.1.0-alpha.894 → 0.1.0-alpha.895

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/changelog.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.895",
6
+ "changes": [
7
+ "The vault unlocks once per machine. Each agent's folder under ~/.ouro-cli/bitwarden/ now keeps one disposable bw profile per installed bw version (bw-<version>/), so machines with several bw installs never migrate or share one profile. When a local step fails on an authenticated profile (a null KdfConfig or missing master-password unlock data after a newer bw half-migrated it, or a missing session), Ouro moves the profile aside as data.json.discarded and logs in fresh once with the saved unlock secret, without asking the human. Server steps (login, sync), network errors, rate limits (429), gateway errors (502/504), connection resets, DNS and unreachable-network failures, lock contention and rejected secrets never discard a profile, and those network failures now count as transient. Ouro no longer deletes the saved Keychain/DPAPI/Secret Service/plaintext unlock entry when the vault rejects it: it keeps the entry and writes a private rejection record (mode 0600) in the agent's bw folder that every process honors, so no process retries a rejected secret against the server; `ouro vault unlock` (even with the same secret) or any successful login clears it. A store's terminal login failure is retried after 15 minutes instead of being held until restart. The locked-vault message also names a macOS password reset, which replaces the login keychain, as a cause. The Unraid template and the Sanctuary bundle runtime move to this version."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.894",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.894",
2
+ "runtimeVersion": "0.1.0-alpha.895",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.894</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.895</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -43,6 +43,7 @@ var __importStar = (this && this.__importStar) || (function () {
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
44
  exports.BitwardenCredentialStore = void 0;
45
45
  exports.sanitizeCredentialErrorDetail = sanitizeCredentialErrorDetail;
46
+ exports.readBwCliVersion = readBwCliVersion;
46
47
  const node_child_process_1 = require("node:child_process");
47
48
  const fs = __importStar(require("node:fs"));
48
49
  const path = __importStar(require("node:path"));
@@ -169,6 +170,7 @@ const BW_LOCK_STALE_MS = BW_LOCK_TIMEOUT_MS * 2;
169
170
  const BW_DATA_FILENAME = "data.json";
170
171
  const BW_SYNC_MARKER_FILENAME = ".ouro-last-sync";
171
172
  const BW_SYNC_FRESH_MS = 60_000;
173
+ const BW_TERMINAL_LOGIN_ERROR_RETRY_MS = 15 * 60_000;
172
174
  /** In-process async mutex keyed by appDataDir. */
173
175
  const inProcessLocks = new Map();
174
176
  function isPidAlive(pid) {
@@ -365,6 +367,58 @@ function isBwNotInstalled(err) {
365
367
  const code = err.code;
366
368
  return code === "ENOENT" || /\bspawn\b.*\benoent\b/.test(msg) || msg.includes("command not found");
367
369
  }
370
+ /**
371
+ * Read the installed @bitwarden/cli version from the package that owns the
372
+ * resolved `bw` binary. Returns null when the binary is not an npm install.
373
+ */
374
+ function readBwCliVersion(bwBinaryPath) {
375
+ let dir;
376
+ try {
377
+ dir = path.dirname(fs.realpathSync(bwBinaryPath));
378
+ }
379
+ catch {
380
+ return null;
381
+ }
382
+ for (let depth = 0; depth < 4; depth++) {
383
+ try {
384
+ const pkg = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8"));
385
+ if (pkg.name === "@bitwarden/cli" && typeof pkg.version === "string")
386
+ return pkg.version;
387
+ }
388
+ catch {
389
+ // Keep walking up toward the package root.
390
+ }
391
+ dir = path.dirname(dir);
392
+ }
393
+ return null;
394
+ }
395
+ /** Another process holds the profile; the profile itself is not at fault. */
396
+ function isBwLockTimeout(err) {
397
+ return err.message.includes("bw CLI lock timeout");
398
+ }
399
+ /**
400
+ * A local bw step (unlock of an already-authenticated profile) failed for a
401
+ * reason that says nothing about the vault server: the profile on disk is
402
+ * unusable. Network, lock and missing-binary failures are not this, and
403
+ * neither is a rejected unlock secret.
404
+ */
405
+ class LocalProfileUnusableError extends Error {
406
+ localError;
407
+ constructor(localError) {
408
+ super(localError.message);
409
+ this.localError = localError;
410
+ }
411
+ }
412
+ function asLocalProfileFailure(err) {
413
+ if (isTransientError(err) || isBwNotInstalled(err) || isBwLockTimeout(err) || isBwInvalidUnlockSecretMessage(err.message)) {
414
+ return err;
415
+ }
416
+ return new LocalProfileUnusableError(err);
417
+ }
418
+ /** A bw version as a safe directory name component. */
419
+ function bwProfileDirName(version) {
420
+ return `bw-${version.replace(/[^A-Za-z0-9._-]/g, "_")}`;
421
+ }
368
422
  /** Check if the error is transient (network/timeout) and worth retrying. */
369
423
  function isTransientError(err) {
370
424
  const msg = err.message.toLowerCase();
@@ -372,7 +426,18 @@ function isTransientError(err) {
372
426
  msg.includes("etimedout") ||
373
427
  msg.includes("enotfound") ||
374
428
  msg.includes("socket hang up") ||
429
+ msg.includes("econnreset") ||
430
+ msg.includes("eai_again") ||
431
+ msg.includes("enetunreach") ||
432
+ msg.includes("ehostunreach") ||
433
+ msg.includes("fetch failed") ||
434
+ msg.includes("429") ||
435
+ msg.includes("too many requests") ||
436
+ msg.includes("502") ||
375
437
  msg.includes("503") ||
438
+ msg.includes("504") ||
439
+ msg.includes("bad gateway") ||
440
+ msg.includes("gateway timeout") ||
376
441
  msg.includes("server unavailable") ||
377
442
  msg.includes("timed out"));
378
443
  }
@@ -491,17 +556,22 @@ class BitwardenCredentialStore {
491
556
  serverUrl;
492
557
  email;
493
558
  masterPassword;
559
+ /** The agent's bw folder; each bw version keeps its own profile under it. */
560
+ agentDataDir;
561
+ /** The profile directory for the running bw version (BITWARDENCLI_APPDATA_DIR). */
494
562
  appDataDir;
495
563
  onInvalidUnlockSecret;
496
564
  onLoginSuccess;
497
565
  sessionToken = null;
498
566
  terminalLoginError = null;
567
+ terminalLoginErrorAt = 0;
499
568
  bwBinaryPath = "bw";
500
569
  structuredItemCache = null;
501
570
  constructor(serverUrl, email, masterPassword, options = {}) {
502
571
  this.serverUrl = serverUrl;
503
572
  this.email = email;
504
573
  this.masterPassword = masterPassword;
574
+ this.agentDataDir = options.appDataDir;
505
575
  this.appDataDir = options.appDataDir;
506
576
  this.onInvalidUnlockSecret = options.onInvalidUnlockSecret;
507
577
  this.onLoginSuccess = options.onLoginSuccess;
@@ -543,11 +613,21 @@ class BitwardenCredentialStore {
543
613
  */
544
614
  async login() {
545
615
  if (this.terminalLoginError) {
546
- throw this.terminalLoginError;
616
+ // A long-lived process retries a terminal failure after a while instead
617
+ // of holding it until restart; rejected secrets are paused separately.
618
+ if (Date.now() - this.terminalLoginErrorAt < BW_TERMINAL_LOGIN_ERROR_RETRY_MS) {
619
+ throw this.terminalLoginError;
620
+ }
621
+ this.terminalLoginError = null;
547
622
  }
548
623
  // Ensure bw CLI is installed before any bw commands
549
624
  this.bwBinaryPath = await (0, bw_installer_1.ensureBwCli)();
550
- if (this.appDataDir) {
625
+ if (this.agentDataDir) {
626
+ // Each bw version gets its own profile directory, so machines with
627
+ // several bw installs (one per Node version) never migrate or fight
628
+ // over one another's state.
629
+ const bwVersion = readBwCliVersion(this.bwBinaryPath);
630
+ this.appDataDir = bwVersion ? path.join(this.agentDataDir, bwProfileDirName(bwVersion)) : this.agentDataDir;
551
631
  fs.mkdirSync(this.appDataDir, { recursive: true, mode: 0o700 });
552
632
  }
553
633
  let lastError;
@@ -562,7 +642,7 @@ class BitwardenCredentialStore {
562
642
  lastError = err instanceof Error ? err : new Error(String(err));
563
643
  // Don't retry non-transient errors (auth failures, bw not installed)
564
644
  if (!isTransientError(lastError)) {
565
- this.terminalLoginError = lastError;
645
+ this.setTerminalLoginError(lastError);
566
646
  if (isBwInvalidUnlockSecretMessage(lastError.message)) {
567
647
  await this.notifyInvalidUnlockSecret(lastError);
568
648
  }
@@ -581,15 +661,76 @@ class BitwardenCredentialStore {
581
661
  await delay(backoffMs);
582
662
  }
583
663
  }
584
- this.terminalLoginError = lastError;
664
+ this.setTerminalLoginError(lastError);
585
665
  /* v8 ignore next -- invalid unlock errors are non-transient and exit through the non-retry path above @preserve */
586
666
  if (isBwInvalidUnlockSecretMessage(lastError.message)) {
587
667
  await this.notifyInvalidUnlockSecret(lastError);
588
668
  }
589
669
  throw lastError;
590
670
  }
591
- /** Single login attempt — called by login() retry loop. */
671
+ setTerminalLoginError(error) {
672
+ this.terminalLoginError = error;
673
+ this.terminalLoginErrorAt = Date.now();
674
+ }
675
+ /**
676
+ * Single login attempt — called by login() retry loop.
677
+ *
678
+ * The bw profile directory is a disposable cache; the durable secret is the
679
+ * machine's vault unlock material. When a local step fails on an
680
+ * authenticated profile (a corrupt or half-migrated profile, a missing
681
+ * session), the profile is moved aside and rebuilt with one fresh login.
682
+ * Server steps (login, sync), network failures, lock contention and
683
+ * rejected secrets never discard the profile, so a bad secret or a flaky
684
+ * server costs at most one server login per attempt.
685
+ */
592
686
  async loginAttempt() {
687
+ try {
688
+ await this.loginWithLocalProfile();
689
+ }
690
+ catch (error) {
691
+ if (!(error instanceof LocalProfileUnusableError))
692
+ throw error;
693
+ await this.discardLocalProfile(error.localError);
694
+ try {
695
+ await this.loginWithLocalProfile();
696
+ }
697
+ catch (retryError) {
698
+ throw retryError instanceof LocalProfileUnusableError ? retryError.localError : retryError;
699
+ }
700
+ }
701
+ }
702
+ /**
703
+ * Move the local bw profile aside so the next bw command starts from an
704
+ * empty profile. The previous data file is kept as one `.discarded` copy
705
+ * for diagnosis and is overwritten by the next discard.
706
+ */
707
+ async discardLocalProfile(cause) {
708
+ const appDataDir = this.appDataDir;
709
+ this.sessionToken = null;
710
+ this.structuredItemCache = null;
711
+ await withBwLock(appDataDir, async () => {
712
+ const dataPath = path.join(appDataDir, BW_DATA_FILENAME);
713
+ try {
714
+ fs.renameSync(dataPath, `${dataPath}.discarded`);
715
+ }
716
+ catch {
717
+ // Already gone: another process discarded it first, which is the same outcome.
718
+ }
719
+ fs.rmSync(path.join(appDataDir, BW_SYNC_MARKER_FILENAME), { force: true });
720
+ });
721
+ (0, runtime_1.emitNervesEvent)({
722
+ level: "warn",
723
+ event: "repertoire.bw_local_profile_discarded",
724
+ component: "repertoire",
725
+ message: "discarded unusable local bw profile; logging in fresh with the saved unlock secret",
726
+ meta: {
727
+ email: this.email,
728
+ serverUrl: this.serverUrl,
729
+ error: sanitizeCredentialErrorDetail(cause.message),
730
+ },
731
+ });
732
+ }
733
+ async loginWithLocalProfile() {
593
734
  let status = await this.readStatus();
594
735
  if (this.shouldRebuildLocalProfile(status)) {
595
736
  await this.rebuildLocalProfile("local bw profile did not match requested vault", status);
@@ -692,7 +833,12 @@ class BitwardenCredentialStore {
692
833
  const err = error;
693
834
  if (!isBwAlreadyLoggedInError(err))
694
835
  throw err;
695
- return this.execBwWithPasswordEnv(["unlock", "--raw"]);
836
+ }
837
+ try {
838
+ return await this.execBwWithPasswordEnv(["unlock", "--raw"]);
839
+ }
840
+ catch (error) {
841
+ throw asLocalProfileFailure(error);
696
842
  }
697
843
  }
698
844
  forgetLocalSyncMarker() {
@@ -754,7 +900,7 @@ class BitwardenCredentialStore {
754
900
  catch (error) {
755
901
  const err = error;
756
902
  if (!isBwInvalidUnlockSecretMessage(err.message))
757
- throw err;
903
+ throw asLocalProfileFailure(err);
758
904
  await this.rebuildLocalProfile(reason, status, err);
759
905
  /* v8 ignore next -- defensive: rebuildLocalProfile always stores a string session token on success @preserve */
760
906
  return this.sessionToken ?? "";
@@ -46,15 +46,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.getCredentialStore = getCredentialStore;
47
47
  exports.probeCredentialVaultAccess = probeCredentialVaultAccess;
48
48
  exports.resetCredentialStore = resetCredentialStore;
49
- const crypto = __importStar(require("node:crypto"));
50
49
  const fs = __importStar(require("node:fs"));
51
- const os = __importStar(require("node:os"));
52
50
  const path = __importStar(require("node:path"));
53
51
  const runtime_1 = require("../nerves/runtime");
54
52
  const identity = __importStar(require("../heart/identity"));
55
53
  const bitwarden_store_1 = require("./bitwarden-store");
56
54
  const vault_unlock_1 = require("./vault-unlock");
57
55
  let stores = new Map();
56
+ function rejectedUnlockMessage(agentName, reason) {
57
+ return [
58
+ `The vault rejected the unlock secret saved on this machine for ${agentName} (${reason}).`,
59
+ "The saved secret was kept. If the vault's unlock secret changed, run",
60
+ `\`ouro vault unlock --agent ${agentName}\` once with the current secret.`,
61
+ ].join(" ");
62
+ }
58
63
  function loadVaultSectionForAgent(agentName) {
59
64
  const configPath = path.join(identity.getAgentRoot(agentName), "agent.json");
60
65
  try {
@@ -65,14 +70,6 @@ function loadVaultSectionForAgent(agentName) {
65
70
  return { configPath };
66
71
  }
67
72
  }
68
- function bitwardenAppDataDir(agentName, vaultConfig, homeDir = os.homedir()) {
69
- const digest = crypto
70
- .createHash("sha256")
71
- .update(`${agentName}:${vaultConfig.serverUrl}:${vaultConfig.email}`)
72
- .digest("hex")
73
- .slice(0, 24);
74
- return path.join(homeDir, ".ouro-cli", "bitwarden", digest);
75
- }
76
73
  function getCredentialStore(agentNameInput) {
77
74
  const agentName = agentNameInput ?? identity.getAgentName();
78
75
  if (agentName === "SerpentGuide") {
@@ -87,6 +84,11 @@ function getCredentialStore(agentNameInput) {
87
84
  const cached = stores.get(cacheKey);
88
85
  if (cached)
89
86
  return cached;
87
+ const agentDataDir = (0, vault_unlock_1.bitwardenAppDataDir)(agentName, vaultConfig);
88
+ const rejection = (0, vault_unlock_1.readVaultUnlockRejection)(agentDataDir);
89
+ if (rejection) {
90
+ throw new Error(rejectedUnlockMessage(agentName, rejection.reason));
91
+ }
90
92
  const unlock = (0, vault_unlock_1.readVaultUnlockSecret)({
91
93
  agentName,
92
94
  email: vaultConfig.email,
@@ -94,25 +96,22 @@ function getCredentialStore(agentNameInput) {
94
96
  });
95
97
  const unlockConfig = { agentName, email: vaultConfig.email, serverUrl: vaultConfig.serverUrl };
96
98
  const unlockSource = unlock.source ?? unlockConfig;
97
- let invalidUnlockCleared = false;
98
99
  let canonicalUnlockStored = false;
99
100
  const store = new bitwarden_store_1.BitwardenCredentialStore(vaultConfig.serverUrl, vaultConfig.email, unlock.secret, {
100
- appDataDir: bitwardenAppDataDir(agentName, vaultConfig),
101
+ appDataDir: agentDataDir,
101
102
  onInvalidUnlockSecret: (error) => {
102
- if (invalidUnlockCleared)
103
- return;
104
- invalidUnlockCleared = true;
105
- (0, vault_unlock_1.clearVaultUnlockSecret)({
106
- agentName,
107
- email: unlockSource.email,
108
- serverUrl: unlockSource.serverUrl,
109
- });
103
+ // The vault rejected the saved secret. Keep the saved secret: deleting
104
+ // the only durable copy turns any misclassified bw or server error
105
+ // into a human prompt. Record the rejection on disk so no process
106
+ // retries it against the server; `ouro vault unlock` or any
107
+ // successful login clears the record.
110
108
  stores.delete(cacheKey);
109
+ (0, vault_unlock_1.recordVaultUnlockRejection)(agentDataDir, error.message);
111
110
  (0, runtime_1.emitNervesEvent)({
112
111
  level: "warn",
113
- event: "repertoire.credential_store_invalid_unlock_cleared",
112
+ event: "repertoire.credential_store_unlock_rejected",
114
113
  component: "repertoire",
115
- message: "cleared rejected local vault unlock material",
114
+ message: "vault rejected the saved local unlock secret; kept it and paused retries until a new secret is saved",
116
115
  meta: {
117
116
  agentName,
118
117
  serverUrl: vaultConfig.serverUrl,
@@ -123,6 +122,7 @@ function getCredentialStore(agentNameInput) {
123
122
  });
124
123
  },
125
124
  onLoginSuccess: () => {
125
+ (0, vault_unlock_1.clearVaultUnlockRejection)(agentDataDir);
126
126
  if (canonicalUnlockStored)
127
127
  return;
128
128
  if (unlockSource.serverUrl === vaultConfig.serverUrl && unlockSource.email === vaultConfig.email)
@@ -170,7 +170,11 @@ async function probeCredentialVaultAccess(agentNameInput, unlockSecret, options
170
170
  throw new Error((0, vault_unlock_1.credentialVaultNotConfiguredError)(agentName, configPath));
171
171
  }
172
172
  const vaultConfig = identity.resolveVaultConfig(agentName, vault);
173
- const store = new bitwarden_store_1.BitwardenCredentialStore(vaultConfig.serverUrl, vaultConfig.email, unlockSecret, { appDataDir: bitwardenAppDataDir(agentName, vaultConfig, options.homeDir) });
173
+ const agentDataDir = (0, vault_unlock_1.bitwardenAppDataDir)(agentName, vaultConfig, options.homeDir);
174
+ const store = new bitwarden_store_1.BitwardenCredentialStore(vaultConfig.serverUrl, vaultConfig.email, unlockSecret, {
175
+ appDataDir: agentDataDir,
176
+ onLoginSuccess: () => (0, vault_unlock_1.clearVaultUnlockRejection)(agentDataDir),
177
+ });
174
178
  await store.get("__ouro_vault_probe__");
175
179
  }
176
180
  function resetCredentialStore() {
@@ -42,6 +42,10 @@ exports.resolveVaultUnlockStore = resolveVaultUnlockStore;
42
42
  exports.noteVaultUnlockSelfHeal = noteVaultUnlockSelfHeal;
43
43
  exports.clearVaultUnlockSecret = clearVaultUnlockSecret;
44
44
  exports.readVaultUnlockSecret = readVaultUnlockSecret;
45
+ exports.bitwardenAppDataDir = bitwardenAppDataDir;
46
+ exports.readVaultUnlockRejection = readVaultUnlockRejection;
47
+ exports.recordVaultUnlockRejection = recordVaultUnlockRejection;
48
+ exports.clearVaultUnlockRejection = clearVaultUnlockRejection;
45
49
  exports.storeVaultUnlockSecret = storeVaultUnlockSecret;
46
50
  exports.getVaultUnlockStatus = getVaultUnlockStatus;
47
51
  const node_child_process_1 = require("node:child_process");
@@ -187,7 +191,7 @@ function lockedMessage(config, store) {
187
191
  "",
188
192
  "Provider credentials are still stored in the agent vault.",
189
193
  "This computer does not currently have usable local unlock material for that vault.",
190
- "This can happen on a new computer, after a local profile or hostname migration, or if the local unlock entry was removed.",
194
+ "This can happen on a new computer, after a local profile or hostname migration, after a macOS password reset that replaced the login keychain, or if the local unlock entry was removed.",
191
195
  "",
192
196
  `Run \`${command}\` and enter the saved agent vault unlock secret from the human/operator who controls that vault.`,
193
197
  lostUnlockSecretGuidance(config),
@@ -587,6 +591,57 @@ function readVaultUnlockSecret(config, deps = {}) {
587
591
  });
588
592
  return { secret: loaded.secret, store, source: loaded.source };
589
593
  }
594
+ const UNLOCK_REJECTED_FILENAME = ".ouro-unlock-rejected";
595
+ /** The agent's bw folder under ~/.ouro-cli/bitwarden; bw profiles live beneath it. */
596
+ function bitwardenAppDataDir(agentName, vaultConfig, homeDirValue = os.homedir()) {
597
+ const digest = crypto
598
+ .createHash("sha256")
599
+ .update(`${agentName}:${vaultConfig.serverUrl}:${vaultConfig.email}`)
600
+ .digest("hex")
601
+ .slice(0, 24);
602
+ return path.join(homeDirValue, ".ouro-cli", "bitwarden", digest);
603
+ }
604
+ /**
605
+ * The vault server rejected the saved unlock secret. Every process honors the
606
+ * record so none retries the same secret against the server; saving a secret
607
+ * or any successful login clears it.
608
+ */
609
+ function readVaultUnlockRejection(agentDataDir) {
610
+ try {
611
+ const parsed = JSON.parse(fs.readFileSync(path.join(agentDataDir, UNLOCK_REJECTED_FILENAME), "utf8"));
612
+ return {
613
+ reason: typeof parsed.reason === "string" ? parsed.reason : "rejected",
614
+ rejectedAt: typeof parsed.rejectedAt === "string" ? parsed.rejectedAt : "",
615
+ };
616
+ }
617
+ catch {
618
+ return null;
619
+ }
620
+ }
621
+ function recordVaultUnlockRejection(agentDataDir, reason, now = new Date()) {
622
+ fs.mkdirSync(agentDataDir, { recursive: true, mode: 0o700 });
623
+ const record = { reason, rejectedAt: now.toISOString() };
624
+ fs.writeFileSync(path.join(agentDataDir, UNLOCK_REJECTED_FILENAME), `${JSON.stringify(record)}\n`, { mode: 0o600 });
625
+ (0, runtime_1.emitNervesEvent)({
626
+ level: "warn",
627
+ component: "repertoire",
628
+ event: "repertoire.vault_unlock_rejection_recorded",
629
+ message: "recorded that the vault rejected the saved unlock secret",
630
+ meta: { agentDataDir },
631
+ });
632
+ }
633
+ function clearVaultUnlockRejection(agentDataDir) {
634
+ const rejectionPath = path.join(agentDataDir, UNLOCK_REJECTED_FILENAME);
635
+ if (!fs.existsSync(rejectionPath))
636
+ return;
637
+ fs.rmSync(rejectionPath, { force: true });
638
+ (0, runtime_1.emitNervesEvent)({
639
+ component: "repertoire",
640
+ event: "repertoire.vault_unlock_rejection_cleared",
641
+ message: "cleared the recorded vault unlock rejection",
642
+ meta: { agentDataDir },
643
+ });
644
+ }
590
645
  function storeVaultUnlockSecret(config, secret, deps = {}) {
591
646
  const canonicalConfig = canonicalizeVaultUnlockConfig(config);
592
647
  const trimmed = secret.trim();
@@ -595,6 +650,9 @@ function storeVaultUnlockSecret(config, secret, deps = {}) {
595
650
  }
596
651
  const store = resolveVaultUnlockStore(canonicalConfig, deps);
597
652
  writeToStore(canonicalConfig, store, trimmed, deps);
653
+ if (canonicalConfig.agentName) {
654
+ clearVaultUnlockRejection(bitwardenAppDataDir(canonicalConfig.agentName, canonicalConfig, homeDir(deps)));
655
+ }
598
656
  (0, runtime_1.emitNervesEvent)({
599
657
  component: "repertoire",
600
658
  event: "repertoire.vault_unlock_stored",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.894",
3
+ "version": "0.1.0-alpha.895",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.894",
9
+ "version": "0.1.0-alpha.895",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.78.0",
12
12
  "@azure/identity": "^4.13.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.894",
3
+ "version": "0.1.0-alpha.895",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },