@cohortapp/agent-sdk 2.11.0 → 2.11.2

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.
@@ -111,6 +111,13 @@ export function parseInboxItemYaml(body) {
111
111
  if (channelType) item.channel_type = channelType;
112
112
  if (isPrivate !== undefined) item.is_private = isPrivate;
113
113
  if (isDm !== undefined) item.is_dm = isDm;
114
+ // THE CHANNEL KIND. Cohort's only reliable DM signal, written by
115
+ // scripts/poller/utils.inboxItemToYaml when present. Attached only when the
116
+ // writer emitted it so a non-Cohort item keeps its old shape; the daemon's
117
+ // enrichItem reads it to tell a 1:1 DM (skips the election) from a GROUP_DM
118
+ // (goes through the election as a multi-participant channel).
119
+ const channelKind = scalar("channel_kind");
120
+ if (channelKind) item.channel_kind = channelKind;
114
121
  // The hq chain kind, when the org projection carried one through the writer.
115
122
  // Attached only when present so a non-org item keeps exactly its old shape;
116
123
  // `lib/execution/intake.fromInboxItem` prefers it over the surface so an
@@ -239,6 +239,17 @@ raw_ref: "${item.raw_ref || ""}"
239
239
  yaml += `channel_id: "${item.channel_id}"\n`;
240
240
  }
241
241
 
242
+ // THE CHANNEL KIND (DM / GROUP_DM / PUBLIC / …). Cohort's only reliable DM
243
+ // signal (its channel ids are cuids, so the "D…"/"dm/" prefix heuristics never
244
+ // fire). Written ONLY when present so a non-Cohort item is byte-identical to
245
+ // before; the daemon's `enrichItem` reads it to route a 1:1 DM past the group
246
+ // election gate while a GROUP_DM still goes through it. Enumerated writers like
247
+ // this one drop anything not named here, which is exactly how the signal was
248
+ // lost between eventToInboxItem and parseInboxItemYaml.
249
+ if (item.channel_kind) {
250
+ yaml += `channel_kind: "${item.channel_kind}"\n`;
251
+ }
252
+
242
253
  // CONFIDENTIALITY SIGNALS. Slack's conversation-ID prefix is not a reliable
243
254
  // type indicator (a private channel can carry a `C…` id), so downstream
244
255
  // consumers — notably the daemon's fail-closed outcome gate,