@ouro.bot/cli 0.1.0-alpha.1001 → 0.1.0-alpha.1002

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.1002",
6
+ "changes": [
7
+ "When the bundled Bitwarden CLI is missing one of its own modules (for example after an endpoint security product quarantines a file in it), ouro logs it once and uses the bw on PATH instead of failing to start."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1001",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1001",
2
+ "runtimeVersion": "0.1.0-alpha.1002",
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.1001</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1002</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -645,6 +645,8 @@ class BitwardenCredentialStore {
645
645
  catch (err) {
646
646
  /* v8 ignore next -- defensive: loginAttempt always throws Error instances @preserve */
647
647
  lastError = err instanceof Error ? err : new Error(String(err));
648
+ if (this.switchFromBrokenBundledBw(lastError))
649
+ return this.login();
648
650
  // Don't retry non-transient errors (auth failures, bw not installed)
649
651
  if (!isTransientError(lastError)) {
650
652
  this.setTerminalLoginError(lastError);
@@ -932,6 +934,10 @@ class BitwardenCredentialStore {
932
934
  }
933
935
  catch (error) {
934
936
  const err = error;
937
+ if (!attemptedFreshSession && this.switchFromBrokenBundledBw(err)) {
938
+ attemptedFreshSession = true;
939
+ continue;
940
+ }
935
941
  if (attemptedFreshSession || !isBwSessionAuthError(err)) {
936
942
  throw err;
937
943
  }
@@ -941,6 +947,20 @@ class BitwardenCredentialStore {
941
947
  }
942
948
  }
943
949
  }
950
+ /**
951
+ * When the bundled bw fails to load one of its own modules, stop using it and
952
+ * drop this session, so the next login resolves the bw on PATH with its own
953
+ * profile directory. Returns whether it switched.
954
+ */
955
+ switchFromBrokenBundledBw(error) {
956
+ if (!(0, bw_installer_1.isBwMissingModuleError)(error) || !(0, bw_installer_1.isBundledBw)(this.bwBinaryPath))
957
+ return false;
958
+ (0, bw_installer_1.markBundledBwBroken)(error.message);
959
+ this.onProgress?.("the bundled Bitwarden CLI is damaged; switching to the bw on PATH");
960
+ this.sessionToken = null;
961
+ this.structuredItemCache = null;
962
+ return true;
963
+ }
944
964
  async withTransientRetry(operation) {
945
965
  let lastError;
946
966
  for (let attempt = 0; attempt < TRANSIENT_MAX_RETRIES; attempt++) {
@@ -45,6 +45,10 @@ exports.PINNED_BW_CLI_VERSION = void 0;
45
45
  exports.findExecutableOnPath = findExecutableOnPath;
46
46
  exports.findExecutableViaNpmPrefix = findExecutableViaNpmPrefix;
47
47
  exports.findBundledBwCli = findBundledBwCli;
48
+ exports.isBundledBw = isBundledBw;
49
+ exports.isBwMissingModuleError = isBwMissingModuleError;
50
+ exports.markBundledBwBroken = markBundledBwBroken;
51
+ exports.resetBundledBwStateForTests = resetBundledBwStateForTests;
48
52
  exports.bwCommand = bwCommand;
49
53
  exports.ensureBwCli = ensureBwCli;
50
54
  const node_child_process_1 = require("node:child_process");
@@ -168,6 +172,38 @@ function findBundledBwCli(resolvePackageJson = (id) => require.resolve(id)) {
168
172
  return null;
169
173
  }
170
174
  }
175
+ let bundledBwPath = null;
176
+ let bundledBwBroken = false;
177
+ /** Whether `bwBinaryPath` is the bundled bw that ensureBwCli last returned. */
178
+ function isBundledBw(bwBinaryPath) {
179
+ return bundledBwPath !== null && bwBinaryPath === bundledBwPath;
180
+ }
181
+ /** True when bw output shows a damaged install: a module of its own is missing. */
182
+ function isBwMissingModuleError(error) {
183
+ return /\bCannot find module\b/.test(error.message);
184
+ }
185
+ /**
186
+ * Stop using the bundled bw for the rest of this process, after it failed to
187
+ * load one of its own modules (an endpoint security product can quarantine a
188
+ * file inside it). ensureBwCli then falls back to the bw on PATH. Logged once.
189
+ */
190
+ function markBundledBwBroken(reason) {
191
+ if (bundledBwBroken)
192
+ return;
193
+ bundledBwBroken = true;
194
+ (0, runtime_1.emitNervesEvent)({
195
+ level: "warn",
196
+ event: "repertoire.bw_cli_bundled_broken",
197
+ component: "repertoire",
198
+ message: "the bw that ships with ouro is missing a module; using bw on PATH instead",
199
+ meta: { bundledPath: bundledBwPath, reason: reason.split("\n")[0].slice(0, 300) },
200
+ });
201
+ }
202
+ /** Test seam: forget the bundled-bw state between tests. */
203
+ function resetBundledBwStateForTests() {
204
+ bundledBwPath = null;
205
+ bundledBwBroken = false;
206
+ }
171
207
  /** How to spawn a resolved `bw`: a `.js` entry point runs under this Node, anything else directly. */
172
208
  function bwCommand(bwBinaryPath, args, nodePath = process.execPath) {
173
209
  return bwBinaryPath.endsWith(".js") ? { file: nodePath, args: [bwBinaryPath, ...args] } : { file: bwBinaryPath, args };
@@ -184,9 +220,10 @@ async function ensureBwCli(findBundled = findBundledBwCli) {
184
220
  return override;
185
221
  throw new Error(`OURO_BW_BINARY is set to ${override}, which is not an executable file`);
186
222
  }
187
- // 1. The bw that ships with ouro
188
- const bundled = findBundled();
223
+ // 1. The bw that ships with ouro, unless it was found broken in this process
224
+ const bundled = bundledBwBroken ? null : findBundled();
189
225
  if (bundled) {
226
+ bundledBwPath = bundled;
190
227
  return bundled;
191
228
  }
192
229
  // 2. A bw already on PATH
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1001",
3
+ "version": "0.1.0-alpha.1002",
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.1001",
9
+ "version": "0.1.0-alpha.1002",
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.1001",
3
+ "version": "0.1.0-alpha.1002",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },