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

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.710",
6
+ "changes": [
7
+ "Read structured Bitwarden slash-name credentials from the full vault item list cache instead of exact or search lookups."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.709",
6
12
  "changes": [
@@ -147,9 +147,6 @@ function isBwLoggedOutOrUnauthenticatedError(err) {
147
147
  function shouldUseStructuredItemLookup(domain) {
148
148
  return domain.includes("/");
149
149
  }
150
- function shouldUseFullListForStructuredLookup(domain, appDataDir) {
151
- return domain.includes("/") && !appDataDir;
152
- }
153
150
  // ---------------------------------------------------------------------------
154
151
  // Cross-process bw CLI lock
155
152
  // ---------------------------------------------------------------------------
@@ -440,18 +437,6 @@ function parseBwItems(stdout, context) {
440
437
  throw new Error(`bw CLI error: invalid JSON from ${context}`);
441
438
  }
442
439
  }
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
- }
455
440
  function parseBwItem(stdout, context) {
456
441
  let parsed;
457
442
  try {
@@ -814,7 +799,7 @@ class BitwardenCredentialStore {
814
799
  message: `getting credential via bw for ${domain}`,
815
800
  meta: { domain, backend: "bitwarden" },
816
801
  });
817
- const item = await this.withTransientRetry(() => this.withSessionRetry((session) => this.findItemByDomain(domain, session, { preferExactStructured: true })));
802
+ const item = await this.withTransientRetry(() => this.withSessionRetry((session) => this.findItemByDomain(domain, session)));
818
803
  if (!item) {
819
804
  (0, runtime_1.emitNervesEvent)({
820
805
  event: "repertoire.bw_credential_get_end",
@@ -838,7 +823,7 @@ class BitwardenCredentialStore {
838
823
  };
839
824
  }
840
825
  async getRawSecret(domain, field) {
841
- const item = await this.withTransientRetry(() => this.withSessionRetry((session) => this.findItemByDomain(domain, session, { preferExactStructured: true })));
826
+ const item = await this.withTransientRetry(() => this.withSessionRetry((session) => this.findItemByDomain(domain, session)));
842
827
  if (!item) {
843
828
  throw new Error(`no credential found for domain "${domain}"`);
844
829
  }
@@ -866,6 +851,9 @@ class BitwardenCredentialStore {
866
851
  meta: { domain, backend: "bitwarden" },
867
852
  });
868
853
  await this.withSessionRetry(async (session) => {
854
+ if (shouldUseStructuredItemLookup(domain)) {
855
+ this.structuredItemCache = null;
856
+ }
869
857
  const existing = await this.findItemByDomain(domain, session);
870
858
  const item = {
871
859
  ...(existing ?? {}),
@@ -954,11 +942,8 @@ class BitwardenCredentialStore {
954
942
  return true;
955
943
  }
956
944
  // --- Private ---
957
- async findItemByDomain(domain, session, options = {}) {
958
- if (options.preferExactStructured && shouldUseStructuredItemLookup(domain)) {
959
- return this.findStructuredItemBySearch(domain, session);
960
- }
961
- if (shouldUseFullListForStructuredLookup(domain, this.appDataDir)) {
945
+ async findItemByDomain(domain, session) {
946
+ if (shouldUseStructuredItemLookup(domain)) {
962
947
  const items = await this.readStructuredItemCache(session);
963
948
  return items.get(domain) ?? null;
964
949
  }
@@ -967,20 +952,6 @@ class BitwardenCredentialStore {
967
952
  // Find exact match by name
968
953
  return items.find((item) => item.name === domain) ?? null;
969
954
  }
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");
981
- }
982
- return exactItem;
983
- }
984
955
  shouldSyncVaultAfterSession(status) {
985
956
  if (status.status === "unauthenticated" || !status.status)
986
957
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.709",
3
+ "version": "0.1.0-alpha.710",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",