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

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.708",
6
+ "changes": [
7
+ "Prefer cached runtime credentials for native RSVP refresh and smoke runs, falling back to vault refresh only on cold start."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.707",
12
+ "changes": [
13
+ "Build RSVP BlueBubbles send clients from explicit agent runtime config during native refresh and smoke runs."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.706",
6
18
  "changes": [
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 }
@@ -211,6 +219,50 @@ function blueBubblesChatFor(config) {
211
219
  participantHandles: [],
212
220
  };
213
221
  }
222
+ function numberField(record, key, fallback) {
223
+ const value = record?.[key];
224
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
225
+ }
226
+ function stringArrayField(record, key) {
227
+ const value = record?.[key];
228
+ if (!Array.isArray(value))
229
+ return [];
230
+ return value.map((entry) => typeof entry === "string" ? entry.trim() : "").filter(Boolean);
231
+ }
232
+ function recordField(record, key) {
233
+ const value = record[key];
234
+ return value && typeof value === "object" && !Array.isArray(value)
235
+ ? value
236
+ : null;
237
+ }
238
+ function rsvpBlueBubblesClientConfig(nativeConfig, machineRuntimeConfig) {
239
+ if (!machineRuntimeConfig.ok) {
240
+ throw new Error(`BlueBubbles runtime config unavailable at ${machineRuntimeConfig.itemPath}: ${machineRuntimeConfig.error}`);
241
+ }
242
+ const bluebubbles = recordField(machineRuntimeConfig.config, "bluebubbles");
243
+ const bluebubblesChannel = recordField(machineRuntimeConfig.config, "bluebubblesChannel");
244
+ const serverUrl = localText(bluebubbles?.serverUrl);
245
+ const password = localText(bluebubbles?.password);
246
+ if (!serverUrl) {
247
+ throw new Error("bluebubbles.serverUrl is required in this machine's agent-vault runtime config. Run `ouro connect bluebubbles --agent <agent>`.");
248
+ }
249
+ if (!password) {
250
+ throw new Error("bluebubbles.password is required in this machine's agent-vault runtime config. Run `ouro connect bluebubbles --agent <agent>`.");
251
+ }
252
+ return {
253
+ config: {
254
+ serverUrl,
255
+ password,
256
+ accountId: localText(bluebubbles?.accountId) || localText(nativeConfig.bluebubblesRoute.accountId) || "default",
257
+ ownHandles: stringArrayField(bluebubbles, "ownHandles"),
258
+ },
259
+ channelConfig: {
260
+ port: numberField(bluebubblesChannel, "port", 18790),
261
+ webhookPath: localText(bluebubblesChannel?.webhookPath) || "/bluebubbles-webhook",
262
+ requestTimeoutMs: numberField(bluebubblesChannel, "requestTimeoutMs", 30_000),
263
+ },
264
+ };
265
+ }
214
266
  function normalizeDelivery(value) {
215
267
  const record = value && typeof value === "object" && !Array.isArray(value) ? value : {};
216
268
  return {
@@ -471,8 +523,8 @@ async function executeRefresh(command, deps) {
471
523
  result: configResult,
472
524
  });
473
525
  }
474
- const runtimeConfig = await (0, runtime_credentials_1.refreshRuntimeCredentialConfig)(command.agent, { preserveCachedOnFailure: true });
475
- 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);
476
528
  const readiness = (0, config_1.validateRsvpReadiness)({
477
529
  agent: command.agent,
478
530
  agentRoot,
@@ -552,7 +604,8 @@ async function executeRefresh(command, deps) {
552
604
  const sendAllowed = wantsLiveSend;
553
605
  let delivery;
554
606
  if (sendAllowed) {
555
- const sent = await (0, client_1.createBlueBubblesClient)().sendText({
607
+ const bluebubbles = rsvpBlueBubblesClientConfig(configResult.config, machineRuntimeConfig);
608
+ const sent = await (0, client_1.createBlueBubblesClient)(bluebubbles.config, bluebubbles.channelConfig).sendText({
556
609
  chat: blueBubblesChatFor(configResult.config),
557
610
  text: reportText,
558
611
  tempGuid: outboundDecision.idempotencyKey,
@@ -658,7 +711,8 @@ async function executeSmoke(command, deps) {
658
711
  const sendAllowed = wantsLiveSend;
659
712
  let delivery;
660
713
  if (sendAllowed) {
661
- const sent = await (0, client_1.createBlueBubblesClient)().sendText({
714
+ const bluebubbles = rsvpBlueBubblesClientConfig(configResult.config, await resolveRsvpMachineRuntimeCredentialConfig(command.agent));
715
+ const sent = await (0, client_1.createBlueBubblesClient)(bluebubbles.config, bluebubbles.channelConfig).sendText({
662
716
  chat: blueBubblesChatFor(configResult.config),
663
717
  text: answer.text,
664
718
  });
@@ -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.706",
3
+ "version": "0.1.0-alpha.708",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",