@diegoaltoworks/chatter 0.65.0 → 0.67.0

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.
@@ -263,7 +263,12 @@ async function prepareChat({
263
263
  mode,
264
264
  buckets: resolvedBuckets,
265
265
  sender,
266
- retrievedChunks
266
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
267
+ // still the array the store returned (no reranker, or one that threw
268
+ // or returned a non-array), the two are the same object, so whatever a
269
+ // hook pushed onto its argument would land in the context assembled
270
+ // below.
271
+ retrievedChunks: [...retrievedChunks]
267
272
  });
268
273
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
269
274
  } catch (error) {
@@ -229,7 +229,12 @@ async function prepareChat({
229
229
  mode,
230
230
  buckets: resolvedBuckets,
231
231
  sender,
232
- retrievedChunks
232
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
233
+ // still the array the store returned (no reranker, or one that threw
234
+ // or returned a non-array), the two are the same object, so whatever a
235
+ // hook pushed onto its argument would land in the context assembled
236
+ // below.
237
+ retrievedChunks: [...retrievedChunks]
233
238
  });
234
239
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
235
240
  } catch (error) {
@@ -500,7 +500,12 @@ async function prepareChat({
500
500
  mode,
501
501
  buckets: resolvedBuckets,
502
502
  sender,
503
- retrievedChunks
503
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
504
+ // still the array the store returned (no reranker, or one that threw
505
+ // or returned a non-array), the two are the same object, so whatever a
506
+ // hook pushed onto its argument would land in the context assembled
507
+ // below.
508
+ retrievedChunks: [...retrievedChunks]
504
509
  });
505
510
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
506
511
  } catch (error) {
@@ -452,7 +452,12 @@ async function prepareChat({
452
452
  mode,
453
453
  buckets: resolvedBuckets,
454
454
  sender,
455
- retrievedChunks
455
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
456
+ // still the array the store returned (no reranker, or one that threw
457
+ // or returned a non-array), the two are the same object, so whatever a
458
+ // hook pushed onto its argument would land in the context assembled
459
+ // below.
460
+ retrievedChunks: [...retrievedChunks]
456
461
  });
457
462
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
458
463
  } catch (error) {
@@ -393,7 +393,12 @@ async function prepareChat({
393
393
  mode,
394
394
  buckets: resolvedBuckets,
395
395
  sender,
396
- retrievedChunks
396
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
397
+ // still the array the store returned (no reranker, or one that threw
398
+ // or returned a non-array), the two are the same object, so whatever a
399
+ // hook pushed onto its argument would land in the context assembled
400
+ // below.
401
+ retrievedChunks: [...retrievedChunks]
397
402
  });
398
403
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
399
404
  } catch (error) {
@@ -348,7 +348,12 @@ async function prepareChat({
348
348
  mode,
349
349
  buckets: resolvedBuckets,
350
350
  sender,
351
- retrievedChunks
351
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
352
+ // still the array the store returned (no reranker, or one that threw
353
+ // or returned a non-array), the two are the same object, so whatever a
354
+ // hook pushed onto its argument would land in the context assembled
355
+ // below.
356
+ retrievedChunks: [...retrievedChunks]
352
357
  });
353
358
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
354
359
  } catch (error) {
@@ -30,6 +30,39 @@ export interface WhatsAppMessageEvent {
30
30
  sock: WASocket;
31
31
  message: WAMessage;
32
32
  }
33
+ /**
34
+ * A session's connection state, derived from the same `connection.update`
35
+ * and lease transitions the channel already reacts to - not a new event
36
+ * source. `connecting` covers both the first connect after acquiring the
37
+ * lease and every reconnect attempt; `waiting_for_lease` covers not
38
+ * currently holding this session's lease, whether another instance holds it
39
+ * or acquiring/renewing it is failing.
40
+ */
41
+ export type WaConnectionState = "connected" | "connecting" | "waiting_for_lease" | "disconnected";
42
+ export interface WaSessionStatus {
43
+ sessionId: string;
44
+ state: WaConnectionState;
45
+ /** `Date.now()`-style timestamp of the last state transition (not of the last read). */
46
+ since: number;
47
+ /** The most recent failure description; cleared once the session reconnects. */
48
+ lastError?: string;
49
+ }
50
+ /**
51
+ * Optional liveness escalation: `onUnhealthy` fires once a session has been
52
+ * anything but `connected` for at least `unhealthyAfterMs`, and rearms the
53
+ * moment it reconnects. That includes `waiting_for_lease` - legitimate
54
+ * during a brief multi-instance deploy overlap, so size `unhealthyAfterMs`
55
+ * comfortably above how long that overlap is expected to last, or an
56
+ * instance that never wins the lease (a stuck rollout) will trip the
57
+ * watchdog repeatedly. Off by default - an unconfigured host still gets a
58
+ * bounded, grep-able error log while unhealthy (see `createWhatsAppChannel`'s
59
+ * status checker), just no callback. A host can use `onUnhealthy` to alert,
60
+ * or to `process.exit` so the platform restarts the container.
61
+ */
62
+ export interface WhatsAppWatchdogConfig {
63
+ unhealthyAfterMs: number;
64
+ onUnhealthy?: (status: WaSessionStatus) => void;
65
+ }
33
66
  export interface WhatsAppChannelConfig {
34
67
  /** Passphrase that encrypts auth state at rest (AES-256-GCM key material). Keep it stable across restarts and deploys — losing it means re-pairing. */
35
68
  sessionSecret: string;
@@ -60,6 +93,8 @@ export interface WhatsAppChannelConfig {
60
93
  leaseStore?: WaLeaseStore;
61
94
  /** Baileys auth-state persistence, encrypted above this seam. Defaults to a `wa_auth` table in `deps.db`; inject your own to run this channel without a libsql database. */
62
95
  authStore?: WaAuthKV;
96
+ /** Liveness escalation for a session stuck unhealthy. Off by default (see {@link WhatsAppWatchdogConfig}). */
97
+ watchdog?: WhatsAppWatchdogConfig;
63
98
  }
64
99
  /** A live, leased session: what `stop()` (or losing the lease) must tear down. */
65
100
  export interface WaSessionHandle {
@@ -99,6 +134,8 @@ export interface LeaseGatedConnectDeps {
99
134
  * no live socket and nothing pending never recovers on its own.
100
135
  */
101
136
  onConnectFailed?: (sessionId: string, error: unknown) => void;
137
+ /** Reports a connection-state transition, for the channel's status/watchdog seam. Optional - direct callers of `acquireSessionLease` in tests don't need it. */
138
+ onStatusChange?: (sessionId: string, state: WaConnectionState, lastError?: string) => void;
102
139
  }
103
140
  /**
104
141
  * Acquire `sessionId`'s lease before connecting — two instances must never
@@ -130,5 +167,10 @@ export interface WhatsAppMediaPayload {
130
167
  * `false` rather than sending Baileys a `{ image: { url: undefined } }`.
131
168
  */
132
169
  export declare function normalizeWaMediaPayload(payload: unknown): WhatsAppMediaPayload;
133
- export declare function createWhatsAppChannel(config: WhatsAppChannelConfig): Channel;
170
+ /** `createWhatsAppChannel`'s return type: the {@link Channel} SPI plus a way to poll per-session connection health without log-scraping. */
171
+ export interface WhatsAppChannel extends Channel {
172
+ /** Per-session status, in the order `sessionIds` was configured. */
173
+ getStatus(): WaSessionStatus[];
174
+ }
175
+ export declare function createWhatsAppChannel(config: WhatsAppChannelConfig): WhatsAppChannel;
134
176
  //# sourceMappingURL=channel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../src/channels/whatsapp/channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAgB,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAuB,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,KAAK,EAAoB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,KAAK,OAAO,EAAmD,MAAM,WAAW,CAAC;AAC1F,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAKjB;gFACgF;AAChF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,uJAAu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AuthState, useTursoAuthState } from "./authState";
28
28
  export type { Baileys } from "./baileys";
29
29
  export { loadBaileys } from "./baileys";
30
- export { acquireSessionLease, createWhatsAppChannel, type LeaseGatedConnectDeps, normalizeWaMediaPayload, reconnectDelayMs, senderNameFor, shutdownWaSessions, type WaSessionHandle, type WhatsAppChannelConfig, type WhatsAppMediaPayload, type WhatsAppMessageEvent, } from "./channel";
30
+ export { acquireSessionLease, createWhatsAppChannel, type LeaseGatedConnectDeps, normalizeWaMediaPayload, reconnectDelayMs, senderNameFor, shutdownWaSessions, type WaConnectionState, type WaSessionHandle, type WaSessionStatus, type WhatsAppChannel, type WhatsAppChannelConfig, type WhatsAppMediaPayload, type WhatsAppMessageEvent, type WhatsAppWatchdogConfig, } from "./channel";
31
31
  export { decrypt, encrypt } from "./crypto";
32
32
  export { createWhatsAppImageHandler, type DrawRequestDetectorConfig, drawSubject, isDrawRequest, type WhatsAppImageHandler, type WhatsAppImageHandlerDeps, type WhatsAppImageRequestContext, type WhatsAppImageStrings, } from "./images";
33
33
  export { createWhatsAppInboundHandler, extractText, isGroupJid, jidsMatch, jidToPhoneNumber, messageContext, type ResolvedWaMessage, resolveWaMessage, senderPhoneFor, stripOwnMentions, type WaMessageContext, type WhatsAppInboundConfig, } from "./inbound";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/channels/whatsapp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnF,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EACL,0BAA0B,EAC1B,KAAK,yBAAyB,EAC9B,WAAW,EACX,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,GAC1B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,4BAA4B,EAC5B,WAAW,EACX,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,2BAA2B,EAC3B,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,GACjC,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/channels/whatsapp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnF,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EACL,0BAA0B,EAC1B,KAAK,yBAAyB,EAC9B,WAAW,EACX,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,GAC1B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,4BAA4B,EAC5B,WAAW,EACX,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,2BAA2B,EAC3B,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,GACjC,MAAM,UAAU,CAAC"}
@@ -348,9 +348,13 @@ function createTursoWaLeaseStore(client) {
348
348
  // src/channels/whatsapp/channel.ts
349
349
  var RECONNECT_DELAY_MS = 5e3;
350
350
  var RECONNECT_MAX_DELAY_MS = 10 * 60 * 1e3;
351
+ var UNHEALTHY_LOG_INTERVAL_MS = 5 * 60 * 1e3;
351
352
  function reconnectDelayMs(failures) {
352
353
  return exponentialBackoffMs(RECONNECT_DELAY_MS, RECONNECT_MAX_DELAY_MS, failures);
353
354
  }
355
+ function describeError(error) {
356
+ return error instanceof Error ? error.message : String(error);
357
+ }
354
358
  async function shutdownWaSessions(sessions) {
355
359
  await Promise.all(
356
360
  [...sessions.values()].map(async (handle) => {
@@ -381,6 +385,7 @@ async function acquireSessionLease(sessionId, deps) {
381
385
  const schedule = deps.schedule ?? ((fn, ms) => void setTimeout(fn, ms));
382
386
  const logger = deps.logger ?? createConsoleLogger();
383
387
  if (isStopped()) return;
388
+ deps.onStatusChange?.(sessionId, "waiting_for_lease");
384
389
  const retry = () => {
385
390
  schedule(
386
391
  () => void acquireSessionLease(sessionId, deps).catch(
@@ -394,6 +399,7 @@ async function acquireSessionLease(sessionId, deps) {
394
399
  acquired = await leaseStore.tryAcquire(sessionId, instanceId, now(), staleMs);
395
400
  } catch (error) {
396
401
  logger.warn(`WhatsApp[${sessionId}]: lease acquire failed, retrying:`, error);
402
+ deps.onStatusChange?.(sessionId, "waiting_for_lease", describeError(error));
397
403
  retry();
398
404
  return;
399
405
  }
@@ -416,6 +422,11 @@ async function acquireSessionLease(sessionId, deps) {
416
422
  logger.error(
417
423
  `WhatsApp[${sessionId}]: lease heartbeats have been failing for ${failingForMs}ms, treating the lease as lost`
418
424
  );
425
+ deps.onStatusChange?.(
426
+ sessionId,
427
+ "disconnected",
428
+ `lease heartbeats failing for ${failingForMs}ms`
429
+ );
419
430
  demoteSelf();
420
431
  return;
421
432
  }
@@ -423,6 +434,7 @@ async function acquireSessionLease(sessionId, deps) {
423
434
  if (isStopped()) return;
424
435
  if (!stillHeld) {
425
436
  logger.error(`WhatsApp[${sessionId}]: lost the lease to another instance, disconnecting`);
437
+ deps.onStatusChange?.(sessionId, "disconnected", "lost the lease to another instance");
426
438
  demoteSelf();
427
439
  return;
428
440
  }
@@ -475,6 +487,26 @@ function createWhatsAppChannel(config) {
475
487
  const failureCounts = /* @__PURE__ */ new Map();
476
488
  const registeredSenderNames = /* @__PURE__ */ new Map();
477
489
  let senders;
490
+ const statuses = new Map(
491
+ sessionIds.map((id) => [id, { sessionId: id, state: "waiting_for_lease", since: now() }])
492
+ );
493
+ const unhealthySince = /* @__PURE__ */ new Map();
494
+ const watchdogFired = /* @__PURE__ */ new Set();
495
+ const lastUnhealthyLogAt = /* @__PURE__ */ new Map();
496
+ let healthCheckInterval;
497
+ function setStatus(sessionId, state, lastError) {
498
+ const prev = statuses.get(sessionId);
499
+ const since = prev && prev.state === state ? prev.since : now();
500
+ const resolvedLastError = lastError !== void 0 ? lastError : state === "connected" ? void 0 : prev?.lastError;
501
+ statuses.set(sessionId, { sessionId, state, since, lastError: resolvedLastError });
502
+ if (state === "connected") {
503
+ unhealthySince.delete(sessionId);
504
+ watchdogFired.delete(sessionId);
505
+ lastUnhealthyLogAt.delete(sessionId);
506
+ } else if (!unhealthySince.has(sessionId)) {
507
+ unhealthySince.set(sessionId, since);
508
+ }
509
+ }
478
510
  return {
479
511
  name: channelName,
480
512
  async start(deps) {
@@ -500,7 +532,8 @@ function createWhatsAppChannel(config) {
500
532
  waitMs,
501
533
  schedule,
502
534
  logger: log,
503
- onConnectFailed: recoverFromFailedConnect
535
+ onConnectFailed: recoverFromFailedConnect,
536
+ onStatusChange: setStatus
504
537
  };
505
538
  function nextRetryDelayMs(sessionId) {
506
539
  const failures = failureCounts.get(sessionId) ?? 0;
@@ -515,6 +548,7 @@ function createWhatsAppChannel(config) {
515
548
  const handle = claimSession(sessionId, sessions);
516
549
  if (!handle) return;
517
550
  const delay = nextRetryDelayMs(sessionId);
551
+ setStatus(sessionId, "disconnected", describeError(error));
518
552
  log.error(
519
553
  `WhatsApp[${sessionId}]: connect attempt failed, releasing the lease and retrying in ${Math.round(delay / 1e3)}s:`,
520
554
  error
@@ -534,6 +568,7 @@ function createWhatsAppChannel(config) {
534
568
  }
535
569
  async function connect(sessionId) {
536
570
  if (stopped || !sessions.has(sessionId)) return;
571
+ setStatus(sessionId, "connecting");
537
572
  const baileys = await loadBaileys2();
538
573
  const runtime = {
539
574
  bufferJSON: baileys.BufferJSON,
@@ -550,6 +585,7 @@ function createWhatsAppChannel(config) {
550
585
  log.warn(
551
586
  `WhatsApp[${sessionId}]: no paired session found \u2014 pair it first (see docs/channels.md). Re-checking in 60s.`
552
587
  );
588
+ setStatus(sessionId, "disconnected", "no paired session - pair it first");
553
589
  schedule(() => attemptConnect(sessionId), 6e4);
554
590
  return;
555
591
  }
@@ -579,6 +615,7 @@ function createWhatsAppChannel(config) {
579
615
  const { connection, lastDisconnect } = update;
580
616
  if (connection === "open") {
581
617
  failureCounts.set(sessionId, 0);
618
+ setStatus(sessionId, "connected");
582
619
  log.info(`WhatsApp[${sessionId}]: connected as ${sock.user?.id ?? "unknown"}`);
583
620
  const senderName = senderNameFor(channelName, sessionId);
584
621
  const sender = {
@@ -609,6 +646,7 @@ function createWhatsAppChannel(config) {
609
646
  }
610
647
  const statusCode = lastDisconnect?.error?.output?.statusCode;
611
648
  if (statusCode === baileys.DisconnectReason.loggedOut) {
649
+ setStatus(sessionId, "disconnected", "session logged out - re-pair required");
612
650
  log.error(
613
651
  `WhatsApp[${sessionId}]: session logged out \u2014 re-pair to reconnect (see docs/channels.md).`
614
652
  );
@@ -617,6 +655,7 @@ function createWhatsAppChannel(config) {
617
655
  }
618
656
  if (!stopped && sessions.has(sessionId)) {
619
657
  const delay = nextRetryDelayMs(sessionId);
658
+ setStatus(sessionId, "disconnected", `connection closed (${statusCode ?? "?"})`);
620
659
  log.warn(
621
660
  `WhatsApp[${sessionId}]: connection closed (${statusCode ?? "?"}), reconnecting in ${Math.round(delay / 1e3)}s...`
622
661
  );
@@ -637,6 +676,33 @@ function createWhatsAppChannel(config) {
637
676
  });
638
677
  }
639
678
  }
679
+ function checkHealth() {
680
+ const nowMs = now();
681
+ for (const sessionId of sessionIds) {
682
+ const unhealthySinceMs = unhealthySince.get(sessionId);
683
+ if (unhealthySinceMs === void 0) continue;
684
+ const status = statuses.get(sessionId);
685
+ if (!status) continue;
686
+ const watchdog = config.watchdog;
687
+ if (watchdog && nowMs - unhealthySinceMs >= watchdog.unhealthyAfterMs && !watchdogFired.has(sessionId)) {
688
+ watchdogFired.add(sessionId);
689
+ watchdog.onUnhealthy?.(status);
690
+ }
691
+ if (!watchdog?.onUnhealthy) {
692
+ const lastLogged = lastUnhealthyLogAt.get(sessionId) ?? unhealthySinceMs;
693
+ if (nowMs - lastLogged >= UNHEALTHY_LOG_INTERVAL_MS) {
694
+ lastUnhealthyLogAt.set(sessionId, nowMs);
695
+ log.error(
696
+ `WhatsApp[${sessionId}]: unhealthy (${status.state}) since ${new Date(status.since).toISOString()}` + (status.lastError ? ` - ${status.lastError}` : "")
697
+ );
698
+ }
699
+ }
700
+ }
701
+ }
702
+ healthCheckInterval = setInterval(checkHealth, heartbeatMs);
703
+ if (typeof healthCheckInterval === "object" && "unref" in healthCheckInterval) {
704
+ healthCheckInterval.unref();
705
+ }
640
706
  for (const sessionId of sessionIds) {
641
707
  void acquireSessionLease(sessionId, leaseDeps).catch(
642
708
  (error) => log.error(`WhatsApp[${sessionId}]: failed to start:`, error)
@@ -645,11 +711,18 @@ function createWhatsAppChannel(config) {
645
711
  },
646
712
  async stop() {
647
713
  stopped = true;
714
+ if (healthCheckInterval) clearInterval(healthCheckInterval);
715
+ for (const sessionId of sessionIds) setStatus(sessionId, "disconnected", "channel stopped");
648
716
  for (const senderName of registeredSenderNames.values()) {
649
717
  senders?.unregister(senderName);
650
718
  }
651
719
  registeredSenderNames.clear();
652
720
  await shutdownWaSessions(sessions);
721
+ },
722
+ getStatus() {
723
+ return sessionIds.map(
724
+ (id) => statuses.get(id) ?? { sessionId: id, state: "waiting_for_lease", since: now() }
725
+ );
653
726
  }
654
727
  };
655
728
  }
@@ -950,7 +1023,12 @@ async function prepareChat({
950
1023
  mode,
951
1024
  buckets: resolvedBuckets,
952
1025
  sender,
953
- retrievedChunks
1026
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
1027
+ // still the array the store returned (no reranker, or one that threw
1028
+ // or returned a non-array), the two are the same object, so whatever a
1029
+ // hook pushed onto its argument would land in the context assembled
1030
+ // below.
1031
+ retrievedChunks: [...retrievedChunks]
954
1032
  });
955
1033
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
956
1034
  } catch (error) {
@@ -283,9 +283,13 @@ function createTursoWaLeaseStore(client) {
283
283
  // src/channels/whatsapp/channel.ts
284
284
  var RECONNECT_DELAY_MS = 5e3;
285
285
  var RECONNECT_MAX_DELAY_MS = 10 * 60 * 1e3;
286
+ var UNHEALTHY_LOG_INTERVAL_MS = 5 * 60 * 1e3;
286
287
  function reconnectDelayMs(failures) {
287
288
  return exponentialBackoffMs(RECONNECT_DELAY_MS, RECONNECT_MAX_DELAY_MS, failures);
288
289
  }
290
+ function describeError(error) {
291
+ return error instanceof Error ? error.message : String(error);
292
+ }
289
293
  async function shutdownWaSessions(sessions) {
290
294
  await Promise.all(
291
295
  [...sessions.values()].map(async (handle) => {
@@ -316,6 +320,7 @@ async function acquireSessionLease(sessionId, deps) {
316
320
  const schedule = deps.schedule ?? ((fn, ms) => void setTimeout(fn, ms));
317
321
  const logger = deps.logger ?? createConsoleLogger();
318
322
  if (isStopped()) return;
323
+ deps.onStatusChange?.(sessionId, "waiting_for_lease");
319
324
  const retry = () => {
320
325
  schedule(
321
326
  () => void acquireSessionLease(sessionId, deps).catch(
@@ -329,6 +334,7 @@ async function acquireSessionLease(sessionId, deps) {
329
334
  acquired = await leaseStore.tryAcquire(sessionId, instanceId, now(), staleMs);
330
335
  } catch (error) {
331
336
  logger.warn(`WhatsApp[${sessionId}]: lease acquire failed, retrying:`, error);
337
+ deps.onStatusChange?.(sessionId, "waiting_for_lease", describeError(error));
332
338
  retry();
333
339
  return;
334
340
  }
@@ -351,6 +357,11 @@ async function acquireSessionLease(sessionId, deps) {
351
357
  logger.error(
352
358
  `WhatsApp[${sessionId}]: lease heartbeats have been failing for ${failingForMs}ms, treating the lease as lost`
353
359
  );
360
+ deps.onStatusChange?.(
361
+ sessionId,
362
+ "disconnected",
363
+ `lease heartbeats failing for ${failingForMs}ms`
364
+ );
354
365
  demoteSelf();
355
366
  return;
356
367
  }
@@ -358,6 +369,7 @@ async function acquireSessionLease(sessionId, deps) {
358
369
  if (isStopped()) return;
359
370
  if (!stillHeld) {
360
371
  logger.error(`WhatsApp[${sessionId}]: lost the lease to another instance, disconnecting`);
372
+ deps.onStatusChange?.(sessionId, "disconnected", "lost the lease to another instance");
361
373
  demoteSelf();
362
374
  return;
363
375
  }
@@ -410,6 +422,26 @@ function createWhatsAppChannel(config) {
410
422
  const failureCounts = /* @__PURE__ */ new Map();
411
423
  const registeredSenderNames = /* @__PURE__ */ new Map();
412
424
  let senders;
425
+ const statuses = new Map(
426
+ sessionIds.map((id) => [id, { sessionId: id, state: "waiting_for_lease", since: now() }])
427
+ );
428
+ const unhealthySince = /* @__PURE__ */ new Map();
429
+ const watchdogFired = /* @__PURE__ */ new Set();
430
+ const lastUnhealthyLogAt = /* @__PURE__ */ new Map();
431
+ let healthCheckInterval;
432
+ function setStatus(sessionId, state, lastError) {
433
+ const prev = statuses.get(sessionId);
434
+ const since = prev && prev.state === state ? prev.since : now();
435
+ const resolvedLastError = lastError !== void 0 ? lastError : state === "connected" ? void 0 : prev?.lastError;
436
+ statuses.set(sessionId, { sessionId, state, since, lastError: resolvedLastError });
437
+ if (state === "connected") {
438
+ unhealthySince.delete(sessionId);
439
+ watchdogFired.delete(sessionId);
440
+ lastUnhealthyLogAt.delete(sessionId);
441
+ } else if (!unhealthySince.has(sessionId)) {
442
+ unhealthySince.set(sessionId, since);
443
+ }
444
+ }
413
445
  return {
414
446
  name: channelName,
415
447
  async start(deps) {
@@ -435,7 +467,8 @@ function createWhatsAppChannel(config) {
435
467
  waitMs,
436
468
  schedule,
437
469
  logger: log,
438
- onConnectFailed: recoverFromFailedConnect
470
+ onConnectFailed: recoverFromFailedConnect,
471
+ onStatusChange: setStatus
439
472
  };
440
473
  function nextRetryDelayMs(sessionId) {
441
474
  const failures = failureCounts.get(sessionId) ?? 0;
@@ -450,6 +483,7 @@ function createWhatsAppChannel(config) {
450
483
  const handle = claimSession(sessionId, sessions);
451
484
  if (!handle) return;
452
485
  const delay = nextRetryDelayMs(sessionId);
486
+ setStatus(sessionId, "disconnected", describeError(error));
453
487
  log.error(
454
488
  `WhatsApp[${sessionId}]: connect attempt failed, releasing the lease and retrying in ${Math.round(delay / 1e3)}s:`,
455
489
  error
@@ -469,6 +503,7 @@ function createWhatsAppChannel(config) {
469
503
  }
470
504
  async function connect(sessionId) {
471
505
  if (stopped || !sessions.has(sessionId)) return;
506
+ setStatus(sessionId, "connecting");
472
507
  const baileys = await loadBaileys2();
473
508
  const runtime = {
474
509
  bufferJSON: baileys.BufferJSON,
@@ -485,6 +520,7 @@ function createWhatsAppChannel(config) {
485
520
  log.warn(
486
521
  `WhatsApp[${sessionId}]: no paired session found \u2014 pair it first (see docs/channels.md). Re-checking in 60s.`
487
522
  );
523
+ setStatus(sessionId, "disconnected", "no paired session - pair it first");
488
524
  schedule(() => attemptConnect(sessionId), 6e4);
489
525
  return;
490
526
  }
@@ -514,6 +550,7 @@ function createWhatsAppChannel(config) {
514
550
  const { connection, lastDisconnect } = update;
515
551
  if (connection === "open") {
516
552
  failureCounts.set(sessionId, 0);
553
+ setStatus(sessionId, "connected");
517
554
  log.info(`WhatsApp[${sessionId}]: connected as ${sock.user?.id ?? "unknown"}`);
518
555
  const senderName = senderNameFor(channelName, sessionId);
519
556
  const sender = {
@@ -544,6 +581,7 @@ function createWhatsAppChannel(config) {
544
581
  }
545
582
  const statusCode = lastDisconnect?.error?.output?.statusCode;
546
583
  if (statusCode === baileys.DisconnectReason.loggedOut) {
584
+ setStatus(sessionId, "disconnected", "session logged out - re-pair required");
547
585
  log.error(
548
586
  `WhatsApp[${sessionId}]: session logged out \u2014 re-pair to reconnect (see docs/channels.md).`
549
587
  );
@@ -552,6 +590,7 @@ function createWhatsAppChannel(config) {
552
590
  }
553
591
  if (!stopped && sessions.has(sessionId)) {
554
592
  const delay = nextRetryDelayMs(sessionId);
593
+ setStatus(sessionId, "disconnected", `connection closed (${statusCode ?? "?"})`);
555
594
  log.warn(
556
595
  `WhatsApp[${sessionId}]: connection closed (${statusCode ?? "?"}), reconnecting in ${Math.round(delay / 1e3)}s...`
557
596
  );
@@ -572,6 +611,33 @@ function createWhatsAppChannel(config) {
572
611
  });
573
612
  }
574
613
  }
614
+ function checkHealth() {
615
+ const nowMs = now();
616
+ for (const sessionId of sessionIds) {
617
+ const unhealthySinceMs = unhealthySince.get(sessionId);
618
+ if (unhealthySinceMs === void 0) continue;
619
+ const status = statuses.get(sessionId);
620
+ if (!status) continue;
621
+ const watchdog = config.watchdog;
622
+ if (watchdog && nowMs - unhealthySinceMs >= watchdog.unhealthyAfterMs && !watchdogFired.has(sessionId)) {
623
+ watchdogFired.add(sessionId);
624
+ watchdog.onUnhealthy?.(status);
625
+ }
626
+ if (!watchdog?.onUnhealthy) {
627
+ const lastLogged = lastUnhealthyLogAt.get(sessionId) ?? unhealthySinceMs;
628
+ if (nowMs - lastLogged >= UNHEALTHY_LOG_INTERVAL_MS) {
629
+ lastUnhealthyLogAt.set(sessionId, nowMs);
630
+ log.error(
631
+ `WhatsApp[${sessionId}]: unhealthy (${status.state}) since ${new Date(status.since).toISOString()}` + (status.lastError ? ` - ${status.lastError}` : "")
632
+ );
633
+ }
634
+ }
635
+ }
636
+ }
637
+ healthCheckInterval = setInterval(checkHealth, heartbeatMs);
638
+ if (typeof healthCheckInterval === "object" && "unref" in healthCheckInterval) {
639
+ healthCheckInterval.unref();
640
+ }
575
641
  for (const sessionId of sessionIds) {
576
642
  void acquireSessionLease(sessionId, leaseDeps).catch(
577
643
  (error) => log.error(`WhatsApp[${sessionId}]: failed to start:`, error)
@@ -580,11 +646,18 @@ function createWhatsAppChannel(config) {
580
646
  },
581
647
  async stop() {
582
648
  stopped = true;
649
+ if (healthCheckInterval) clearInterval(healthCheckInterval);
650
+ for (const sessionId of sessionIds) setStatus(sessionId, "disconnected", "channel stopped");
583
651
  for (const senderName of registeredSenderNames.values()) {
584
652
  senders?.unregister(senderName);
585
653
  }
586
654
  registeredSenderNames.clear();
587
655
  await shutdownWaSessions(sessions);
656
+ },
657
+ getStatus() {
658
+ return sessionIds.map(
659
+ (id) => statuses.get(id) ?? { sessionId: id, state: "waiting_for_lease", since: now() }
660
+ );
588
661
  }
589
662
  };
590
663
  }
@@ -885,7 +958,12 @@ async function prepareChat({
885
958
  mode,
886
959
  buckets: resolvedBuckets,
887
960
  sender,
888
- retrievedChunks
961
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
962
+ // still the array the store returned (no reranker, or one that threw
963
+ // or returned a non-array), the two are the same object, so whatever a
964
+ // hook pushed onto its argument would land in the context assembled
965
+ // below.
966
+ retrievedChunks: [...retrievedChunks]
889
967
  });
890
968
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
891
969
  } catch (error) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ChatBot API Client
3
- * A TypeScript client for consuming the DiegoBot API
3
+ * A TypeScript client for consuming a Chatter server's API
4
4
  */
5
5
  import type { ChatBotConfig, ChatMessage, StreamCallbacks } from "./types";
6
6
  export declare class ChatBot {
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export type ChatMode = "public" | "private";
5
5
  export interface ChatBotConfig {
6
- /** Host of the DiegoBot API (e.g., 'api.example.com' - protocol will be added automatically) */
6
+ /** Host of the Chatter server (e.g., 'api.example.com' - protocol will be added automatically) */
7
7
  host: string;
8
8
  /** Either 'public' or 'private' */
9
9
  mode: ChatMode;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE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6BAA6B;IAC7B,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;IACrE,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACtC,gCAAgC;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC;CAC9E"}
@@ -70,11 +70,13 @@ export interface FallbackContext {
70
70
  /** Caller identity, where the surface has one. Absent on anonymous surfaces. */
71
71
  sender?: string;
72
72
  /**
73
- * What `store.query` returned, before `rerankContext` ran: always
74
- * non-empty when this is empty because `rerankContext` filtered
75
- * everything out, and always empty when the store itself found nothing.
76
- * A hook can use this to tell "some low-confidence signal existed" apart
77
- * from "nothing matched at all".
73
+ * What `store.query` returned for this turn, before `rerankContext` ran.
74
+ * `fallbackFn` runs only when the post-rerank context is empty, so this
75
+ * array is non-empty exactly when `rerankContext` filtered every retrieved
76
+ * chunk out, and empty exactly when the store itself found nothing. A hook
77
+ * can use that to tell "some low-confidence signal existed" apart from
78
+ * "nothing matched at all". It is a copy, so mutating it in place cannot
79
+ * change the context the turn goes on to answer with.
78
80
  */
79
81
  retrievedChunks: string[];
80
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/core/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhD,MAAM,WAAW,eAAe;IAC9B,I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;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,WAAW,CAAC,EAChC,KAAK,EACL,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,OAAO,EACP,MAAM,EACN,YAAY,EACZ,aAAa,EACb,UAAU,EACV,MAAM,GACP,EAAE;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yFAAyF;IACzF,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,yGAAyG;IACzG,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,yFAAyF;IACzF,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,kHAAkH;IAClH,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,GAAG,OAAO,CAAC,YAAY,CAAC,CAkExB"}
package/dist/index.js CHANGED
@@ -967,7 +967,12 @@ async function prepareChat({
967
967
  mode,
968
968
  buckets: resolvedBuckets,
969
969
  sender,
970
- retrievedChunks
970
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
971
+ // still the array the store returned (no reranker, or one that threw
972
+ // or returned a non-array), the two are the same object, so whatever a
973
+ // hook pushed onto its argument would land in the context assembled
974
+ // below.
975
+ retrievedChunks: [...retrievedChunks]
971
976
  });
972
977
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
973
978
  } catch (error) {
@@ -1551,7 +1556,7 @@ async function createMCPServer(config) {
1551
1556
  privateToolConfig.enabled ? privateToolConfig.name : null
1552
1557
  ].filter(Boolean);
1553
1558
  if (enabledTools.length === 0) {
1554
- log.warn("\u26A0\uFE0F Warning: No MCP tools enabled");
1559
+ log.warn("No MCP tools enabled");
1555
1560
  }
1556
1561
  log.info(
1557
1562
  `\u2705 ${config.bot.name} MCP Server ready (transport: ${transportMode}, tools: ${enabledTools.join(", ") || "none"})`
package/dist/index.mjs CHANGED
@@ -892,7 +892,12 @@ async function prepareChat({
892
892
  mode,
893
893
  buckets: resolvedBuckets,
894
894
  sender,
895
- retrievedChunks
895
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
896
+ // still the array the store returned (no reranker, or one that threw
897
+ // or returned a non-array), the two are the same object, so whatever a
898
+ // hook pushed onto its argument would land in the context assembled
899
+ // below.
900
+ retrievedChunks: [...retrievedChunks]
896
901
  });
897
902
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
898
903
  } catch (error) {
@@ -1476,7 +1481,7 @@ async function createMCPServer(config) {
1476
1481
  privateToolConfig.enabled ? privateToolConfig.name : null
1477
1482
  ].filter(Boolean);
1478
1483
  if (enabledTools.length === 0) {
1479
- log.warn("\u26A0\uFE0F Warning: No MCP tools enabled");
1484
+ log.warn("No MCP tools enabled");
1480
1485
  }
1481
1486
  log.info(
1482
1487
  `\u2705 ${config.bot.name} MCP Server ready (transport: ${transportMode}, tools: ${enabledTools.join(", ") || "none"})`
@@ -706,7 +706,12 @@ async function prepareChat({
706
706
  mode,
707
707
  buckets: resolvedBuckets,
708
708
  sender,
709
- retrievedChunks
709
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
710
+ // still the array the store returned (no reranker, or one that threw
711
+ // or returned a non-array), the two are the same object, so whatever a
712
+ // hook pushed onto its argument would land in the context assembled
713
+ // below.
714
+ retrievedChunks: [...retrievedChunks]
710
715
  });
711
716
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
712
717
  } catch (error) {
@@ -1229,7 +1234,7 @@ async function createMCPServer(config) {
1229
1234
  privateToolConfig.enabled ? privateToolConfig.name : null
1230
1235
  ].filter(Boolean);
1231
1236
  if (enabledTools.length === 0) {
1232
- log.warn("\u26A0\uFE0F Warning: No MCP tools enabled");
1237
+ log.warn("No MCP tools enabled");
1233
1238
  }
1234
1239
  log.info(
1235
1240
  `\u2705 ${config.bot.name} MCP Server ready (transport: ${transportMode}, tools: ${enabledTools.join(", ") || "none"})`
@@ -678,7 +678,12 @@ async function prepareChat({
678
678
  mode,
679
679
  buckets: resolvedBuckets,
680
680
  sender,
681
- retrievedChunks
681
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
682
+ // still the array the store returned (no reranker, or one that threw
683
+ // or returned a non-array), the two are the same object, so whatever a
684
+ // hook pushed onto its argument would land in the context assembled
685
+ // below.
686
+ retrievedChunks: [...retrievedChunks]
682
687
  });
683
688
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
684
689
  } catch (error) {
@@ -1201,7 +1206,7 @@ async function createMCPServer(config) {
1201
1206
  privateToolConfig.enabled ? privateToolConfig.name : null
1202
1207
  ].filter(Boolean);
1203
1208
  if (enabledTools.length === 0) {
1204
- log.warn("\u26A0\uFE0F Warning: No MCP tools enabled");
1209
+ log.warn("No MCP tools enabled");
1205
1210
  }
1206
1211
  log.info(
1207
1212
  `\u2705 ${config.bot.name} MCP Server ready (transport: ${transportMode}, tools: ${enabledTools.join(", ") || "none"})`
package/dist/server.js CHANGED
@@ -915,7 +915,12 @@ async function prepareChat({
915
915
  mode,
916
916
  buckets: resolvedBuckets,
917
917
  sender,
918
- retrievedChunks
918
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
919
+ // still the array the store returned (no reranker, or one that threw
920
+ // or returned a non-array), the two are the same object, so whatever a
921
+ // hook pushed onto its argument would land in the context assembled
922
+ // below.
923
+ retrievedChunks: [...retrievedChunks]
919
924
  });
920
925
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
921
926
  } catch (error) {
package/dist/server.mjs CHANGED
@@ -887,7 +887,12 @@ async function prepareChat({
887
887
  mode,
888
888
  buckets: resolvedBuckets,
889
889
  sender,
890
- retrievedChunks
890
+ // A copy for the same reason the reranker gets one. Whenever `ctx` is
891
+ // still the array the store returned (no reranker, or one that threw
892
+ // or returned a non-array), the two are the same object, so whatever a
893
+ // hook pushed onto its argument would land in the context assembled
894
+ // below.
895
+ retrievedChunks: [...retrievedChunks]
891
896
  });
892
897
  if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
893
898
  } catch (error) {
package/dist/types.d.ts CHANGED
@@ -28,7 +28,7 @@ export interface PricingRates {
28
28
  * Bot identity configuration
29
29
  */
30
30
  export interface BotIdentity {
31
- /** Bot display name (e.g., "DiegoBot", "AcmeBot") */
31
+ /** Bot display name (e.g., "AcmeBot") */
32
32
  name: string;
33
33
  /** Person or company name the bot represents */
34
34
  personName: string;
@@ -38,12 +38,17 @@ export interface BotIdentity {
38
38
  description: string;
39
39
  }
40
40
  /**
41
- * Bot branding configuration
41
+ * Bot branding configuration.
42
+ *
43
+ * Passthrough only: both colors are published on `GET /config` for a host's
44
+ * own page to read, and nothing shipped applies them. The built-in widgets are
45
+ * styled with the `chatter-ui-` CSS classes (see docs/client.md), so setting a
46
+ * color here does not restyle them.
42
47
  */
43
48
  export interface BotBranding {
44
- /** Primary color for public chat widget */
49
+ /** Primary color to publish for the public chat, for a host page to apply itself */
45
50
  publicPrimaryColor?: string;
46
- /** Primary color for private chat widget */
51
+ /** Primary color to publish for the private chat, for a host page to apply itself */
47
52
  privatePrimaryColor?: string;
48
53
  }
49
54
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OA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ACrB,CAAC;CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegoaltoworks/chatter",
3
- "version": "0.65.0",
3
+ "version": "0.67.0",
4
4
  "description": "Embeddable AI chatbot framework with RAG, authentication, and customizable widgets",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",