@segmentstream/ontology 0.201.1 → 0.202.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.202.0
4
+
5
+ A member of staff answers the chat of someone the agent never admitted. Recording a channel
6
+ (`record: "all"`) with the channel in `inbox.channels` registers such a chat without a member, for
7
+ example a supplier's mail or a WhatsApp number that wrote in. Until now `agent_chat.send` refused
8
+ it in either voice ("The chat has no person to answer"). A member now answers it from their own
9
+ session in their own voice, `as: "me"`, under `agent_chat:post_message` within a scope that holds
10
+ the record. The reply goes to the address or account the chat names, and staff alone read it. The
11
+ agent's voice, workflows, services and `agent_chat.draft` stay refused, since nothing unattended
12
+ answers people no one admitted. A chat of several members outside a shared thread stays refused.
13
+
3
14
  ## 0.201.1
4
15
 
5
16
  `chat_send` and `chat_post_message` tell agents to mention the particular people a group-chat
@@ -416,7 +416,9 @@ export const AgentChat = entity("agent_chat", {
416
416
  "reads, to required with cc; confirm its recipients with the member first. A person's own " +
417
417
  "chat keeps its person among them (refusal recipient_required); addresses that are no " +
418
418
  "plain addresses, or more than 50, are refused with recipients_invalid, and another chat " +
419
- "refuses them with recipients_unsupported, each before the key is spent.",
419
+ "refuses them with recipients_unsupported, each before the key is spent. The chat of someone " +
420
+ "the agent never admitted, which the inbox registered without a member, takes only a " +
421
+ "member's reply as me, to whom it names.",
420
422
  // Each voice needs its own permission, which the delivery checks: either opens the action.
421
423
  permission: ["agent_chat:send", "agent_chat:post_message"],
422
424
  input: ChatSendInput,
@@ -445,7 +445,15 @@ chats) {
445
445
  threadId !== null &&
446
446
  channelProvider(ontology.manifest.chat, String(record.provider))?.threadRecipients !==
447
447
  undefined;
448
- if (!shared && people.length !== 1) {
448
+ // A chat of several members outside a shared thread has no one person to answer. A chat no
449
+ // one was admitted to, which recording the channel registered, has none yet: a member of
450
+ // staff answers whom it names in their own voice. The agent never admitted its person, and
451
+ // a workflow or a service would answer it unattended, as an auto-responder to strangers. A
452
+ // member answers from their own session in the app or their own MCP client.
453
+ const staffReply = permission === "agent_chat:post_message" &&
454
+ (context.caller.kind === "member" || context.caller.kind === "oauth") &&
455
+ context.principal.kind === "member";
456
+ if (!shared && (people.length > 1 || (people.length === 0 && !staffReply))) {
449
457
  return yield* new ActionRejected({
450
458
  message: "The chat has no person to answer. Nothing was sent.",
451
459
  });
@@ -461,7 +469,7 @@ chats) {
461
469
  provider: String(record.provider),
462
470
  external_id: recipient,
463
471
  kind: "private",
464
- participantIds: shared ? [] : [String(people[0].id)],
472
+ participantIds: shared || people[0] === undefined ? [] : [String(people[0].id)],
465
473
  },
466
474
  chatId,
467
475
  threadId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.201.1",
3
+ "version": "0.202.0",
4
4
  "description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SegmentStream",