@shumkov/orchestra 0.4.0 → 0.4.1

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.
@@ -1470,6 +1470,11 @@ class CliProcess extends Process {
1470
1470
  files: args.files,
1471
1471
  messageId: args.message_id, // 0.13: edit_message target bubble
1472
1472
  sourceMsgId, // reaction/quote target (A2)
1473
+ // Quote participant rides the SAME ledger entry as sourceMsgId, so the quote's
1474
+ // author can never disagree with its target. Present only when there's a resolved
1475
+ // quote target; null otherwise so the dispatcher omits the quote (never a
1476
+ // half-built quote — WhatsApp needs both fields).
1477
+ participantJid: sourceMsgId != null ? (sourceEntry?.participantJid ?? null) : null,
1473
1478
  sessionCwd: this.sessionCwd, // P0 #2: dispatcher uses this to allowlist file roots
1474
1479
  maxOutboundFileBytes: this.maxOutboundFileBytes, // backend/chat-derived upload cap
1475
1480
  });
@@ -1678,11 +1683,15 @@ class CliProcess extends Process {
1678
1683
 
1679
1684
  // ─── 0.13 D2: InputLedger ──────────────────────────────────────────
1680
1685
 
1681
- _ledgerAdd(turnId, { source, msgId = null } = {}) {
1686
+ _ledgerAdd(turnId, { source, msgId = null, participantJid = null } = {}) {
1682
1687
  this.inputLedger.set(turnId, {
1683
1688
  turnId,
1684
1689
  source,
1685
1690
  msgId: msgId != null ? String(msgId) : null,
1691
+ // The source message's author JID, carried so a reply can quote it (WhatsApp
1692
+ // threading needs both the stanza id AND the participant). Null for backends /
1693
+ // callers that don't supply one — the quote is then simply omitted downstream.
1694
+ participantJid: participantJid != null ? String(participantJid) : null,
1686
1695
  chatId: this.chatId,
1687
1696
  writtenAt: Date.now(),
1688
1697
  state: 'written',
@@ -2546,7 +2555,11 @@ class CliProcess extends Process {
2546
2555
  // 0.13 D2: ledger the primary + keep the exact envelope for the delivery
2547
2556
  // watchdog's idempotent re-write (the pending owns it — no text in the
2548
2557
  // ledger, events stay content-free per L13).
2549
- this._ledgerAdd(turnId, { source: 'primary', msgId: opts.context?.sourceMsgId });
2558
+ this._ledgerAdd(turnId, {
2559
+ source: 'primary',
2560
+ msgId: opts.context?.sourceMsgId,
2561
+ participantJid: opts.context?.participantJid,
2562
+ });
2550
2563
 
2551
2564
  // Review F#18: bridge-disconnect TOCTOU. The bridgeReady check at
2552
2565
  // top of send() can race the bridge socket close. If the bridge
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shumkov/orchestra",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Drive interactive Claude Code CLI sessions: spawn, inject messages via the MCP channels bridge, observe turns, recover. The transport-agnostic session engine extracted from polygram, shared by polygram (Telegram) and water (WhatsApp).",
5
5
  "type": "commonjs",
6
6
  "main": "index.js",