@ouro.bot/cli 0.1.0-alpha.707 → 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,18 @@
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
+ },
10
+ {
11
+ "version": "0.1.0-alpha.708",
12
+ "changes": [
13
+ "Prefer cached runtime credentials for native RSVP refresh and smoke runs, falling back to vault refresh only on cold start."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.707",
6
18
  "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/dist/rsvp/cli.js CHANGED
@@ -197,6 +197,14 @@ function resolveLatestSnapshot(agentRoot) {
197
197
  function machineIdForCli() {
198
198
  return (0, machine_identity_1.loadOrCreateMachineIdentity)().machineId;
199
199
  }
200
+ async function resolveRsvpRuntimeCredentialConfig(agent) {
201
+ const cached = (0, runtime_credentials_1.readRuntimeCredentialConfig)(agent);
202
+ return cached.ok ? cached : (0, runtime_credentials_1.refreshRuntimeCredentialConfig)(agent, { preserveCachedOnFailure: true });
203
+ }
204
+ async function resolveRsvpMachineRuntimeCredentialConfig(agent) {
205
+ const cached = (0, runtime_credentials_1.readMachineRuntimeCredentialConfig)(agent);
206
+ return cached.ok ? cached : (0, runtime_credentials_1.refreshMachineRuntimeCredentialConfig)(agent, machineIdForCli(), { preserveCachedOnFailure: true });
207
+ }
200
208
  function blueBubblesChatFor(config) {
201
209
  const sendTarget = config.bluebubblesRoute.chatIdentifier
202
210
  ? { kind: "chat_identifier", value: config.bluebubblesRoute.chatIdentifier }
@@ -515,8 +523,8 @@ async function executeRefresh(command, deps) {
515
523
  result: configResult,
516
524
  });
517
525
  }
518
- const runtimeConfig = await (0, runtime_credentials_1.refreshRuntimeCredentialConfig)(command.agent, { preserveCachedOnFailure: true });
519
- const machineRuntimeConfig = await (0, runtime_credentials_1.refreshMachineRuntimeCredentialConfig)(command.agent, machineIdForCli(), { preserveCachedOnFailure: true });
526
+ const runtimeConfig = await resolveRsvpRuntimeCredentialConfig(command.agent);
527
+ const machineRuntimeConfig = await resolveRsvpMachineRuntimeCredentialConfig(command.agent);
520
528
  const readiness = (0, config_1.validateRsvpReadiness)({
521
529
  agent: command.agent,
522
530
  agentRoot,
@@ -703,7 +711,7 @@ async function executeSmoke(command, deps) {
703
711
  const sendAllowed = wantsLiveSend;
704
712
  let delivery;
705
713
  if (sendAllowed) {
706
- const bluebubbles = rsvpBlueBubblesClientConfig(configResult.config, await (0, runtime_credentials_1.refreshMachineRuntimeCredentialConfig)(command.agent, machineIdForCli(), { preserveCachedOnFailure: true }));
714
+ const bluebubbles = rsvpBlueBubblesClientConfig(configResult.config, await resolveRsvpMachineRuntimeCredentialConfig(command.agent));
707
715
  const sent = await (0, client_1.createBlueBubblesClient)(bluebubbles.config, bluebubbles.channelConfig).sendText({
708
716
  chat: blueBubblesChatFor(configResult.config),
709
717
  text: answer.text,
@@ -158,8 +158,10 @@ async function defaultNativeBlueBubblesCredentialHealth(input, deps) {
158
158
  if (!input.agent) {
159
159
  return { ok: false, detail: "native BlueBubbles credential check requires an agent" };
160
160
  }
161
- const machineId = (0, machine_identity_1.loadOrCreateMachineIdentity)({ homeDir: deps.homeDir() }).machineId;
162
- const runtimeConfig = await (0, runtime_credentials_1.refreshMachineRuntimeCredentialConfig)(input.agent, machineId, { preserveCachedOnFailure: true });
161
+ const cachedRuntimeConfig = (0, runtime_credentials_1.readMachineRuntimeCredentialConfig)(input.agent);
162
+ const runtimeConfig = cachedRuntimeConfig.ok
163
+ ? cachedRuntimeConfig
164
+ : await (0, runtime_credentials_1.refreshMachineRuntimeCredentialConfig)(input.agent, (0, machine_identity_1.loadOrCreateMachineIdentity)({ homeDir: deps.homeDir() }).machineId, { preserveCachedOnFailure: true });
163
165
  if (!runtimeConfig.ok) {
164
166
  return { ok: false, detail: "machine runtime/config unavailable" };
165
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.707",
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",