@segmentstream/ontology 0.140.0 → 0.141.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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.141.0
4
+
5
+ `chat_history` reads a Slack channel's history, every thread of it, as the archive now keeps a
6
+ Slack channel's threads under the channel; it refused Slack channels before. A Slack private
7
+ destination is still refused: read a direct message by the chat the inbox registered for it.
8
+
3
9
  ## 0.140.0
4
10
 
5
11
  Stored ontology properties accept `excludeFromReplication: true`. Deploy this option to omit
@@ -6,8 +6,11 @@ import { CurrentPrincipal } from "../authentication.js";
6
6
  import { currentCaller } from "../caller-context.js";
7
7
  import { chatAttribution } from "./attribution.js";
8
8
  import { chatResolver, groupChatKey, isChatMember } from "./resolve.js";
9
- /** The kinds of channel whose archived chats are keyed by the chat a destination names. */
10
- const HISTORY_KINDS = new Set(["telegram"]);
9
+ /**
10
+ * The kinds of channel whose archived group chats are keyed by the chat a destination names: a
11
+ * Telegram chat, and a Slack channel, whose threads the archive keeps under it.
12
+ */
13
+ const HISTORY_KINDS = new Set(["telegram", "slack"]);
11
14
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
12
15
  /**
13
16
  * A private chat the inbox registered, by its record id, when the caller may read it: a member with
@@ -107,13 +110,20 @@ export function chatReads(backend, options) {
107
110
  if (principal.kind !== "member") {
108
111
  return yield* new PermissionDenied({ message: "Only members may read chatHistory." });
109
112
  }
110
- // History reads the chats of Telegram channels only. Other channels archive a chat under
111
- // their session's address with private coordinates, not under the chat a destination
112
- // names, so their history would be incomplete until the archive keys them the same way.
113
+ // History reads Telegram's chats and Slack's channels, which the archive keeps under the
114
+ // chat a destination names. Other channels' chats are read by the record the inbox
115
+ // registered for them, above.
113
116
  const target = yield* chatResolver(backend, principal, history, {
114
117
  memberGroups: true,
115
118
  kindOf,
116
119
  }).resolve(input.chat);
120
+ // A Slack private destination names its person, while the archive keeps their direct
121
+ // message under its own channel id.
122
+ if (target.kind !== "group" && kindOf(target.provider) !== "telegram") {
123
+ return yield* new ActionRejected({
124
+ message: "Read a direct message by the chat the inbox registered for it.",
125
+ });
126
+ }
117
127
  // A group's members read its history, as they read its attachments; agent_chat:read reads
118
128
  // every group. A private chat is read only by its participant.
119
129
  const member = target.kind === "group" &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.140.0",
3
+ "version": "0.141.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",