@ouro.bot/cli 0.1.0-alpha.708 → 0.1.0-alpha.709

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.709",
6
+ "changes": [
7
+ "Avoid timeout-prone exact Bitwarden get-item lookups for structured runtime credential names by using search plus exact filtering."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.708",
6
12
  "changes": [
@@ -150,10 +150,6 @@ function shouldUseStructuredItemLookup(domain) {
150
150
  function shouldUseFullListForStructuredLookup(domain, appDataDir) {
151
151
  return domain.includes("/") && !appDataDir;
152
152
  }
153
- function isBwItemNotFoundError(error) {
154
- const message = error.message.toLowerCase();
155
- return message.includes("not found") || message.includes("no item");
156
- }
157
153
  // ---------------------------------------------------------------------------
158
154
  // Cross-process bw CLI lock
159
155
  // ---------------------------------------------------------------------------
@@ -444,6 +440,18 @@ function parseBwItems(stdout, context) {
444
440
  throw new Error(`bw CLI error: invalid JSON from ${context}`);
445
441
  }
446
442
  }
443
+ function parseBwSearchItems(stdout, context) {
444
+ try {
445
+ const parsed = JSON.parse(stdout);
446
+ if (!Array.isArray(parsed)) {
447
+ throw new Error("expected item array");
448
+ }
449
+ return parsed;
450
+ }
451
+ catch {
452
+ throw new Error(`bw CLI error: invalid JSON from ${context}`);
453
+ }
454
+ }
447
455
  function parseBwItem(stdout, context) {
448
456
  let parsed;
449
457
  try {
@@ -948,7 +956,7 @@ class BitwardenCredentialStore {
948
956
  // --- Private ---
949
957
  async findItemByDomain(domain, session, options = {}) {
950
958
  if (options.preferExactStructured && shouldUseStructuredItemLookup(domain)) {
951
- return this.findStructuredItemByName(domain, session);
959
+ return this.findStructuredItemBySearch(domain, session);
952
960
  }
953
961
  if (shouldUseFullListForStructuredLookup(domain, this.appDataDir)) {
954
962
  const items = await this.readStructuredItemCache(session);
@@ -959,19 +967,19 @@ class BitwardenCredentialStore {
959
967
  // Find exact match by name
960
968
  return items.find((item) => item.name === domain) ?? null;
961
969
  }
962
- async findStructuredItemByName(domain, session) {
963
- try {
964
- const stdout = await this.execBw(["get", "item", domain], session);
965
- const item = parseBwItem(stdout, "bw get item");
966
- return item.name === domain ? item : null;
967
- }
968
- catch (error) {
969
- /* v8 ignore next -- defensive: execBw rejects with Error instances @preserve */
970
- const err = error instanceof Error ? error : new Error(String(error));
971
- if (isBwItemNotFoundError(err))
972
- return null;
973
- throw err;
970
+ async findStructuredItemBySearch(domain, session) {
971
+ const stdout = await this.execBw(["list", "items", "--search", domain], session);
972
+ const items = parseBwSearchItems(stdout, "bw list items --search");
973
+ const exactItem = items.find((item) => item &&
974
+ typeof item === "object" &&
975
+ !Array.isArray(item) &&
976
+ item.name === domain);
977
+ if (!exactItem)
978
+ return null;
979
+ if (!isBwLoginItem(exactItem)) {
980
+ throw new Error("bw CLI error: invalid item from bw list items --search");
974
981
  }
982
+ return exactItem;
975
983
  }
976
984
  shouldSyncVaultAfterSession(status) {
977
985
  if (status.status === "unauthenticated" || !status.status)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.708",
3
+ "version": "0.1.0-alpha.709",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",