@ouro.bot/cli 0.1.0-alpha.481 → 0.1.0-alpha.482

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,14 @@
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.482",
6
+ "changes": [
7
+ "Tracked mail imports and hosted mail index repairs now queue completion and failure notices into the live MCP session when one exists, so `check_response` learns about background mail work immediately instead of silently showing no pending messages.",
8
+ "When no MCP session is live, background mail-operation notices now fall back cleanly to the freshest non-blocked outward session instead of depending on inner-dialog-only wakeups.",
9
+ "Hosted Blob duplicate checks now treat unreadable already-existing message blobs as degraded duplicates during import reruns, preventing large delegated HEY archive backfills from crashing on a transient duplicate-read timeout while keeping the `ouro.bot` wrapper version-synced for the release."
10
+ ]
11
+ },
4
12
  {
5
13
  "version": "0.1.0-alpha.481",
6
14
  "changes": [
@@ -84,6 +84,8 @@ const mbox_import_1 = require("../../mailroom/mbox-import");
84
84
  const reader_1 = require("../../mailroom/reader");
85
85
  const pending_1 = require("../../mind/pending");
86
86
  const background_operations_1 = require("../background-operations");
87
+ const session_activity_1 = require("../session-activity");
88
+ const target_resolution_1 = require("../target-resolution");
87
89
  const cli_parse_1 = require("./cli-parse");
88
90
  const cli_parse_2 = require("./cli-parse");
89
91
  const cli_help_1 = require("./cli-help");
@@ -3409,7 +3411,7 @@ function makeBackgroundOperationId(kind) {
3409
3411
  const prefix = kind === "mail.import-mbox" ? "op_mail_import" : "op_mail_backfill";
3410
3412
  return `${prefix}_${(0, crypto_1.randomUUID)().slice(0, 8)}`;
3411
3413
  }
3412
- function notifyMailOperation(agentName, record, deps) {
3414
+ async function notifyMailOperation(agentName, record, deps) {
3413
3415
  const lines = [
3414
3416
  "[Background Operation]",
3415
3417
  `${record.title} ${record.status === "failed" ? "failed" : "finished"}.`,
@@ -3422,19 +3424,62 @@ function notifyMailOperation(agentName, record, deps) {
3422
3424
  "",
3423
3425
  "Use query_active_work for the live background-work view before drilling into mail details.",
3424
3426
  ];
3425
- (0, pending_1.queuePendingMessage)((0, pending_1.getInnerDialogPendingDir)(agentName), {
3427
+ const agentRoot = providerCliAgentRoot({ agent: agentName }, deps);
3428
+ const content = lines.join("\n");
3429
+ (0, pending_1.queuePendingMessage)(path.join(agentRoot, "state", "pending", "self", "inner", "dialog"), {
3426
3430
  from: "mailroom",
3427
3431
  friendId: "self",
3428
3432
  channel: "inner",
3429
3433
  key: "dialog",
3430
- content: lines.join("\n"),
3434
+ content,
3431
3435
  timestamp: deps.now?.() ?? Date.now(),
3432
3436
  mode: "reflect",
3433
3437
  });
3434
- return deps.sendCommand(deps.socketPath, { kind: "inner.wake", agent: agentName })
3438
+ await queueMailOperationTargetNotification(agentName, content, deps).catch(() => undefined);
3439
+ await deps.sendCommand(deps.socketPath, { kind: "inner.wake", agent: agentName })
3435
3440
  .then(() => undefined)
3436
3441
  .catch(() => undefined);
3437
3442
  }
3443
+ async function queueMailOperationTargetNotification(agentName, content, deps) {
3444
+ const agentRoot = providerCliAgentRoot({ agent: agentName }, deps);
3445
+ const friendsDir = path.join(agentRoot, "friends");
3446
+ const sessionsDir = path.join(agentRoot, "state", "sessions");
3447
+ const mcpTarget = (0, session_activity_1.listSessionActivity)({
3448
+ sessionsDir,
3449
+ friendsDir,
3450
+ agentName,
3451
+ }).find((candidate) => candidate.channel === "mcp");
3452
+ if (mcpTarget) {
3453
+ (0, pending_1.queuePendingMessage)(path.join(agentRoot, "state", "pending", mcpTarget.friendId, mcpTarget.channel, mcpTarget.key), {
3454
+ from: "mailroom",
3455
+ friendId: mcpTarget.friendId,
3456
+ channel: mcpTarget.channel,
3457
+ key: mcpTarget.key,
3458
+ content,
3459
+ timestamp: deps.now?.() ?? Date.now(),
3460
+ mode: "relay",
3461
+ });
3462
+ return;
3463
+ }
3464
+ const candidates = await (0, target_resolution_1.listTargetSessionCandidates)({
3465
+ sessionsDir,
3466
+ friendsDir,
3467
+ agentName,
3468
+ friendStore: new store_file_1.FileFriendStore(friendsDir),
3469
+ });
3470
+ const target = candidates.find((candidate) => candidate.delivery.mode !== "blocked");
3471
+ if (!target)
3472
+ return;
3473
+ (0, pending_1.queuePendingMessage)(path.join(agentRoot, "state", "pending", target.friendId, target.channel, target.key), {
3474
+ from: "mailroom",
3475
+ friendId: target.friendId,
3476
+ channel: target.channel,
3477
+ key: target.key,
3478
+ content,
3479
+ timestamp: deps.now?.() ?? Date.now(),
3480
+ mode: "relay",
3481
+ });
3482
+ }
3438
3483
  function ensureTrackedMailOperation(input) {
3439
3484
  if (!input.operationId)
3440
3485
  return null;
@@ -336,7 +336,28 @@ class AzureBlobMailroomStore {
336
336
  async putRawMessage(input) {
337
337
  await this.ensureContainer();
338
338
  const { message, rawPayload, candidate } = await (0, core_1.buildStoredMailMessage)(input);
339
- const existing = await downloadJson(this.messageBlob(message.id), this.blobOperationTimeoutMs);
339
+ const messageBlob = this.messageBlob(message.id);
340
+ let existing = null;
341
+ try {
342
+ existing = await downloadJson(messageBlob, this.blobOperationTimeoutMs);
343
+ }
344
+ catch (error) {
345
+ if (isRetryableBlobDownloadError(error) && await messageBlob.exists().catch(() => false)) {
346
+ (0, runtime_1.emitNervesEvent)({
347
+ level: "warn",
348
+ component: "senses",
349
+ event: "senses.mail_blob_store_dedupe_degraded",
350
+ message: "azure blob mailroom store treated an unreadable existing message as a duplicate",
351
+ meta: {
352
+ id: message.id,
353
+ agentId: message.agentId,
354
+ error: error instanceof Error ? error.message : String(error),
355
+ },
356
+ });
357
+ return { created: false, message };
358
+ }
359
+ throw error;
360
+ }
340
361
  if (existing) {
341
362
  await this.putMessageIndex(existing);
342
363
  (0, runtime_1.emitNervesEvent)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.481",
3
+ "version": "0.1.0-alpha.482",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",