@segmentstream/agent 0.70.0 → 0.71.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/_chunks/{build-metadata-BXGz_t3T.mjs → build-metadata-D83t0hEp.mjs} +1 -1
  3. package/dist/_chunks/{principal-DYl7vqOp.mjs → principal-BWTq_zuf.mjs} +106 -74
  4. package/dist/extension/connections/ontology.mjs +1 -1
  5. package/dist/extension/hooks/authorization.mjs +1 -1
  6. package/dist/extension/instructions/persona.mjs +1 -1
  7. package/dist/extension/lib/actor.mjs +1 -1
  8. package/dist/extension/lib/attachment-tools.mjs +1 -1
  9. package/dist/extension/lib/attachments-send.mjs +1 -1
  10. package/dist/extension/lib/attachments.mjs +1 -1
  11. package/dist/extension/lib/build-metadata.mjs +1 -1
  12. package/dist/extension/lib/chat-address.d.ts +19 -2
  13. package/dist/extension/lib/chat-address.mjs +1 -1
  14. package/dist/extension/lib/chat-context.mjs +1 -1
  15. package/dist/extension/lib/chat-recorder.mjs +1 -1
  16. package/dist/extension/lib/confirmations.mjs +1 -1
  17. package/dist/extension/lib/email/attachments-send.mjs +1 -1
  18. package/dist/extension/lib/email/channel.mjs +1 -1
  19. package/dist/extension/lib/guest-usage.mjs +1 -1
  20. package/dist/extension/lib/inbound-media/files.mjs +1 -1
  21. package/dist/extension/lib/inbound-media/index.mjs +1 -1
  22. package/dist/extension/lib/ontology-connection.mjs +1 -1
  23. package/dist/extension/lib/ontology-file-call.mjs +1 -1
  24. package/dist/extension/lib/ontology-tools.d.ts +1 -0
  25. package/dist/extension/lib/ontology-tools.mjs +1 -1
  26. package/dist/extension/lib/review/hold.mjs +1 -1
  27. package/dist/extension/lib/review/reply.mjs +1 -1
  28. package/dist/extension/lib/role-skill.mjs +1 -1
  29. package/dist/extension/lib/runtime-envelope.d.ts +10 -1
  30. package/dist/extension/lib/runtime-envelope.mjs +1 -1
  31. package/dist/extension/lib/sent-files.mjs +1 -1
  32. package/dist/extension/lib/slack/adapter.mjs +4 -1
  33. package/dist/extension/lib/slack/attachments-send.mjs +1 -1
  34. package/dist/extension/lib/slack/callbacks.mjs +4 -10
  35. package/dist/extension/lib/stored-files.mjs +1 -1
  36. package/dist/extension/lib/telegram/adapter.mjs +2 -2
  37. package/dist/extension/lib/telegram/attachment-description.mjs +1 -1
  38. package/dist/extension/lib/telegram/attachments-send.mjs +1 -1
  39. package/dist/extension/lib/telegram/callbacks.mjs +1 -1
  40. package/dist/extension/lib/telegram/chat-archive.mjs +1 -1
  41. package/dist/extension/lib/telegram/confirmations.mjs +1 -1
  42. package/dist/extension/lib/telegram/customer-text.mjs +1 -1
  43. package/dist/extension/lib/telegram/files.mjs +1 -1
  44. package/dist/extension/lib/telegram/health.mjs +1 -1
  45. package/dist/extension/lib/telegram/held-approvals.mjs +1 -1
  46. package/dist/extension/lib/telegram/inbound-request.mjs +1 -1
  47. package/dist/extension/lib/telegram/inbound.mjs +1 -1
  48. package/dist/extension/lib/telegram/lifecycle.mjs +2 -2
  49. package/dist/extension/lib/telegram/principal.mjs +1 -1
  50. package/dist/extension/lib/telegram/session-recovery.mjs +1 -1
  51. package/dist/extension/lib/telegram/silent.mjs +1 -1
  52. package/dist/extension/lib/telegram/structured.mjs +1 -1
  53. package/dist/extension/lib/telegram/turn-errors.mjs +1 -1
  54. package/dist/extension/lib/web/auth.mjs +1 -1
  55. package/dist/extension/lib/web/channel.mjs +1 -1
  56. package/dist/extension/lib/whatsapp/adapter.mjs +4 -1
  57. package/dist/extension/lib/whatsapp/attachments-send.mjs +1 -1
  58. package/dist/extension/lib/whatsapp/callbacks.mjs +4 -10
  59. package/dist/extension/lib/whatsapp/files.mjs +1 -1
  60. package/dist/extension/lib/workspace-action.mjs +1 -1
  61. package/dist/extension/lib/workspace-channel/attachments-send.mjs +1 -1
  62. package/dist/extension/lib/workspace-channel/channel.mjs +1 -1
  63. package/dist/extension/lib/workspace-source.mjs +1 -1
  64. package/dist/extension/model.mjs +1 -1
  65. package/dist/extension/tools/attachments_discard.mjs +1 -1
  66. package/dist/extension/tools/attachments_list.mjs +1 -1
  67. package/dist/extension/tools/attachments_promote.mjs +4 -3
  68. package/dist/extension/tools/attachments_read.mjs +1 -1
  69. package/dist/extension/tools/attachments_send.mjs +1 -1
  70. package/dist/extension/tools/attachments_stage.mjs +1 -1
  71. package/dist/extension/tools/attachments_table.mjs +1 -1
  72. package/dist/extension/tools/handoff.mjs +1 -1
  73. package/dist/extension/tools/questions_ask.mjs +1 -1
  74. package/dist/extension/tools/workspace_source.mjs +1 -1
  75. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.71.1
4
+
5
+ Pins @segmentstream/ontology 0.146.1.
6
+
7
+ ## 0.71.0
8
+
9
+ Tool calls an agent makes in a Slack or WhatsApp chat carry `context.runtime.source`, as Telegram's
10
+ do: the chat, its thread, the message the turn answers and its sender. An action can then answer in
11
+ the Slack thread the member is talking in rather than at the top of the chat. Every Slack or WhatsApp
12
+ source, a workspace button press's and a file call's too, goes only to an ontology whose
13
+ `initialize` lists the channel among those it reads; an older one, which would refuse the whole
14
+ call, gets it without the source. Upgrade the ontology SDK with the agent SDK to keep a press's
15
+ source.
16
+
17
+ Pins @segmentstream/ontology 0.146.0.
18
+
3
19
  ## 0.70.0
4
20
 
5
21
  One action answers the workspace's buttons in every channel: `buttons: { entity, action,
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- var version = "0.70.0";
7
+ var version = "0.71.1";
8
8
  function agentBuild(environment = process.env) {
9
9
  return {
10
10
  agent: version,
@@ -34,6 +34,87 @@ import { defineMcpClientConnection } from "eve/connections";
34
34
  import { defineState } from "eve/context";
35
35
  import { defineDynamic as defineDynamic$1 } from "eve/tools";
36
36
  import { ForbiddenError, UnauthenticatedError } from "eve/channels/auth";
37
+ const CHAT_HEADER = "X-SegmentStream-Agent-Chat";
38
+ const SESSION_HEADER = "X-SegmentStream-Agent-Session";
39
+ const CHAT_ATTRIBUTE = "segmentstreamChat";
40
+ const EARLIER_CHAT_ATTRIBUTE = "segmentstreamConversation";
41
+ const RUNTIME_SOURCE_ATTRIBUTE = "segmentstreamRuntimeSource";
42
+ function chatRuntimeSource(chat, message = {}) {
43
+ if (chat.provider !== "slack" && chat.provider !== "whatsapp") return;
44
+ return {
45
+ provider: chat.provider,
46
+ ...chat.channel === void 0 ? {} : { channel: chat.channel },
47
+ chat_id: chat.chatId,
48
+ thread_id: chat.threadId,
49
+ kind: chat.kind,
50
+ ...chat.peer === void 0 ? {} : { peer: chat.peer },
51
+ ...message.id === void 0 ? {} : { message_id: message.id },
52
+ ...message.sender === void 0 ? {} : { sender: message.sender }
53
+ };
54
+ }
55
+ function withChatAddress(principal, chat, message) {
56
+ const source = message === void 0 ? void 0 : chatRuntimeSource(chat, message);
57
+ return {
58
+ ...principal,
59
+ attributes: {
60
+ ...principal.attributes,
61
+ [CHAT_ATTRIBUTE]: JSON.stringify(chat),
62
+ ...source === void 0 ? {} : { [RUNTIME_SOURCE_ATTRIBUTE]: JSON.stringify(source) }
63
+ }
64
+ };
65
+ }
66
+ function chatAddressOf(principal) {
67
+ if (principal === void 0 || principal === null) return;
68
+ const attributes = principal.attributes;
69
+ if (principal.authenticator === "segmentstream-telegram") {
70
+ const chatId = attributes.chatId;
71
+ return typeof chatId !== "string" || chatId === "" ? void 0 : {
72
+ provider: "telegram",
73
+ ...principalChannel(principal) === void 0 ? {} : { channel: principalChannel(principal) },
74
+ chatId,
75
+ threadId: String(attributes.messageThreadId ?? ""),
76
+ kind: chatId.startsWith("-") ? "group" : "private"
77
+ };
78
+ }
79
+ const value = attributes["segmentstreamChat"] ?? attributes[EARLIER_CHAT_ATTRIBUTE];
80
+ if (typeof value !== "string") return;
81
+ try {
82
+ return parsedChatAddress(JSON.parse(value), attributes.identityProvider);
83
+ } catch {
84
+ return;
85
+ }
86
+ }
87
+ function chatHeaders(principal, sessionId) {
88
+ const chat = chatAddressOf(principal);
89
+ return chat === void 0 ? {} : {
90
+ [CHAT_HEADER]: `${chatChannel(chat)}:${chat.chatId}`,
91
+ ...sessionId === void 0 || sessionId === "" ? {} : { [SESSION_HEADER]: sessionId }
92
+ };
93
+ }
94
+ function parsedChatAddress(value, provider) {
95
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return;
96
+ const item = value;
97
+ const text = (field, empty = false) => typeof field === "string" && (empty || field !== "") && field.length <= 512;
98
+ if (item.provider !== "slack" && item.provider !== "whatsapp" && item.provider !== "web" && item.provider !== "email" && item.provider !== "custom" || (item.provider === "custom" ? typeof item.channel !== "string" || provider !== workspaceIdentityProvider(item.channel) : item.provider !== provider) || !text(item.chatId) || !text(item.threadId, true) || item.kind !== "private" && item.kind !== "group" || item.peer !== void 0 && !text(item.peer) || item.channel !== void 0 && (typeof item.channel !== "string" || !CHANNEL_NAME.test(item.channel) || item.channel === item.provider)) return;
99
+ return {
100
+ provider: item.provider,
101
+ ...item.channel === void 0 ? {} : { channel: item.channel },
102
+ chatId: item.chatId,
103
+ threadId: item.threadId,
104
+ kind: item.kind,
105
+ ...item.peer === void 0 ? {} : { peer: item.peer }
106
+ };
107
+ }
108
+ function workspaceIdentityProvider(channel) {
109
+ return `channel:${channel}`;
110
+ }
111
+ function chatChannel(chat) {
112
+ return chat.channel ?? chat.provider;
113
+ }
114
+ function isSameChat(chat, destination) {
115
+ if (chatChannel(chat) !== destination.provider) return false;
116
+ return chat.chatId === destination.externalId || chat.provider !== "telegram" && chat.kind === "private" && chat.peer === destination.externalId;
117
+ }
37
118
  function telegramRuntimeSource(message, files, callbackQueryId) {
38
119
  const attachments = [];
39
120
  for (const file of message.attachments) {
@@ -73,8 +154,7 @@ function telegramRuntimeSource(message, files, callbackQueryId) {
73
154
  };
74
155
  }
75
156
  function principalRuntimeSource(principal) {
76
- if (principal?.authenticator !== "segmentstream-telegram") return;
77
- const value = principal.attributes.segmentstreamRuntimeSource;
157
+ const value = principal?.attributes[RUNTIME_SOURCE_ATTRIBUTE];
78
158
  if (typeof value !== "string") return;
79
159
  try {
80
160
  return JSON.parse(value);
@@ -91,6 +171,17 @@ function runtimeEnvelope(input = {}) {
91
171
  ...source === void 0 ? {} : { source }
92
172
  };
93
173
  }
174
+ async function readableRuntimeEnvelope(envelope, providers) {
175
+ const provider = envelope.source?.provider;
176
+ if (provider === void 0 || provider === "telegram" || (await providers()).has(provider)) return envelope;
177
+ return {
178
+ version: envelope.version,
179
+ session_id: envelope.session_id,
180
+ call_id: envelope.call_id,
181
+ ...envelope.operation_id === void 0 ? {} : { operation_id: envelope.operation_id },
182
+ ...envelope.expected === void 0 ? {} : { expected: envelope.expected }
183
+ };
184
+ }
94
185
  function compatibleRuntimeEnvelope(envelope, extended) {
95
186
  const source = envelope.source;
96
187
  return extended || source === void 0 || source.provider !== "telegram" ? envelope : {
@@ -357,71 +448,6 @@ function safeTelegramFetch(fetchImpl, scope = "telegram", previews = {}, appLink
357
448
  return typeof body.chat_id === "string" || typeof body.chat_id === "number" ? inTelegramSendQueue(scope, String(body.chat_id), send) : send();
358
449
  };
359
450
  }
360
- const CHAT_HEADER = "X-SegmentStream-Agent-Chat";
361
- const SESSION_HEADER = "X-SegmentStream-Agent-Session";
362
- const CHAT_ATTRIBUTE = "segmentstreamChat";
363
- const EARLIER_CHAT_ATTRIBUTE = "segmentstreamConversation";
364
- function withChatAddress(principal, chat) {
365
- return {
366
- ...principal,
367
- attributes: {
368
- ...principal.attributes,
369
- [CHAT_ATTRIBUTE]: JSON.stringify(chat)
370
- }
371
- };
372
- }
373
- function chatAddressOf(principal) {
374
- if (principal === void 0 || principal === null) return;
375
- const attributes = principal.attributes;
376
- if (principal.authenticator === "segmentstream-telegram") {
377
- const chatId = attributes.chatId;
378
- return typeof chatId !== "string" || chatId === "" ? void 0 : {
379
- provider: "telegram",
380
- ...principalChannel(principal) === void 0 ? {} : { channel: principalChannel(principal) },
381
- chatId,
382
- threadId: String(attributes.messageThreadId ?? ""),
383
- kind: chatId.startsWith("-") ? "group" : "private"
384
- };
385
- }
386
- const value = attributes["segmentstreamChat"] ?? attributes[EARLIER_CHAT_ATTRIBUTE];
387
- if (typeof value !== "string") return;
388
- try {
389
- return parsedChatAddress(JSON.parse(value), attributes.identityProvider);
390
- } catch {
391
- return;
392
- }
393
- }
394
- function chatHeaders(principal, sessionId) {
395
- const chat = chatAddressOf(principal);
396
- return chat === void 0 ? {} : {
397
- [CHAT_HEADER]: `${chatChannel(chat)}:${chat.chatId}`,
398
- ...sessionId === void 0 || sessionId === "" ? {} : { [SESSION_HEADER]: sessionId }
399
- };
400
- }
401
- function parsedChatAddress(value, provider) {
402
- if (typeof value !== "object" || value === null || Array.isArray(value)) return;
403
- const item = value;
404
- const text = (field, empty = false) => typeof field === "string" && (empty || field !== "") && field.length <= 512;
405
- if (item.provider !== "slack" && item.provider !== "whatsapp" && item.provider !== "web" && item.provider !== "email" && item.provider !== "custom" || (item.provider === "custom" ? typeof item.channel !== "string" || provider !== workspaceIdentityProvider(item.channel) : item.provider !== provider) || !text(item.chatId) || !text(item.threadId, true) || item.kind !== "private" && item.kind !== "group" || item.peer !== void 0 && !text(item.peer) || item.channel !== void 0 && (typeof item.channel !== "string" || !CHANNEL_NAME.test(item.channel) || item.channel === item.provider)) return;
406
- return {
407
- provider: item.provider,
408
- ...item.channel === void 0 ? {} : { channel: item.channel },
409
- chatId: item.chatId,
410
- threadId: item.threadId,
411
- kind: item.kind,
412
- ...item.peer === void 0 ? {} : { peer: item.peer }
413
- };
414
- }
415
- function workspaceIdentityProvider(channel) {
416
- return `channel:${channel}`;
417
- }
418
- function chatChannel(chat) {
419
- return chat.channel ?? chat.provider;
420
- }
421
- function isSameChat(chat, destination) {
422
- if (chatChannel(chat) !== destination.provider) return false;
423
- return chat.chatId === destination.externalId || chat.provider !== "telegram" && chat.kind === "private" && chat.peer === destination.externalId;
424
- }
425
451
  const WEB_AUTHENTICATOR = "segmentstream-web";
426
452
  const WEB_PROVIDER = "web";
427
453
  const AGENT_GRANT_HEADER = "X-SegmentStream-Agent-Grant";
@@ -1011,7 +1037,7 @@ function ontologyTools(options = {}) {
1011
1037
  const current = actorOf(options.principal);
1012
1038
  const own = current !== void 0 && actorKey(current) === key ? options.principal : null;
1013
1039
  if (method === "tools/call") {
1014
- const envelope = options.envelope ?? runtimeEnvelope({ principal: own });
1040
+ const envelope = await readableRuntimeEnvelope(options.envelope ?? runtimeEnvelope({ principal: own }), () => sourceProviders(actor, signal));
1015
1041
  const extended = envelope.source !== void 0 && await runtimeSource(actor, signal);
1016
1042
  params = {
1017
1043
  ...params,
@@ -1081,6 +1107,10 @@ function ontologyTools(options = {}) {
1081
1107
  const result = await initialize(actor, signal);
1082
1108
  return object(object(result?.capabilities).experimental)[capability] !== void 0;
1083
1109
  }
1110
+ async function sourceProviders(actor, signal) {
1111
+ const advertised = object(object(object((await initialize(actor, signal))?.capabilities).experimental)[RUNTIME_SOURCE_PROTOCOL]).providers;
1112
+ return new Set(Array.isArray(advertised) ? advertised.filter((provider) => typeof provider === "string") : ["telegram"]);
1113
+ }
1084
1114
  async function runtimeSource(actor, signal) {
1085
1115
  const key = actorKey(actor);
1086
1116
  if (!runtimeSources.has(key)) {
@@ -1188,6 +1218,7 @@ function ontologyTools(options = {}) {
1188
1218
  async supportsRuntimeSource(actor, signal) {
1189
1219
  return runtimeSource(actor, signal);
1190
1220
  },
1221
+ sourceProviders,
1191
1222
  async labels(actor, action, input = {}, signal, hints) {
1192
1223
  const { tool } = await resolve(actor, action, input, signal, hints);
1193
1224
  const annotations = object(tool.annotations);
@@ -1307,6 +1338,7 @@ function ontologyConnection(input) {
1307
1338
  if (actor === void 0) return null;
1308
1339
  const origin = appOrigin(input.environment ?? process.env);
1309
1340
  const token = input.token ?? runtimeToken;
1341
+ const tools = ontologyTools(input);
1310
1342
  const headers = (context) => ({
1311
1343
  ...actAsHeaders({
1312
1344
  principal: context.session.auth.current,
@@ -1320,7 +1352,7 @@ function ontologyConnection(input) {
1320
1352
  protocolVersionDiscovery: false,
1321
1353
  description: DESCRIPTION,
1322
1354
  approval: actionApproval({
1323
- ...ontologyTools(input),
1355
+ ...tools,
1324
1356
  texts: input.texts
1325
1357
  }),
1326
1358
  auth: {
@@ -1360,13 +1392,13 @@ function ontologyConnection(input) {
1360
1392
  ...common,
1361
1393
  instanceKey: `${origin}/mcp#member:${memberId}${web ? ":web" : ""}${chatProtocol}${sourceProtocol}`,
1362
1394
  ...web ? { tools: { block: [CHAT_POST_TOOL] } } : {},
1363
- ...chatPosting || input.runtimeSource ? { toolCall: { providedArguments: { [CHAT_POST_ENVELOPE]: (ctx) => {
1395
+ ...chatPosting || input.runtimeSource ? { toolCall: { providedArguments: { [CHAT_POST_ENVELOPE]: async (ctx) => {
1364
1396
  headers(ctx);
1365
- const base = compatibleRuntimeEnvelope(runtimeEnvelope({
1397
+ const base = compatibleRuntimeEnvelope(await readableRuntimeEnvelope(runtimeEnvelope({
1366
1398
  principal: ctx.session.auth.current,
1367
1399
  sessionId: ctx.session.id,
1368
1400
  callId: ctx.callId
1369
- }), input.runtimeSource === true);
1401
+ }), () => tools.sourceProviders(actor)), input.runtimeSource === true);
1370
1402
  if (!isChatPost(ctx.toolName)) return base;
1371
1403
  const saved = confirmations.get()[ctx.callId];
1372
1404
  const preview = saved?.description?.chatPost;
@@ -1982,7 +2014,7 @@ function telegramPrincipal(input) {
1982
2014
  const sender = message.from.id;
1983
2015
  const attributes = {
1984
2016
  memberId: member.id,
1985
- segmentstreamRuntimeSource: JSON.stringify(telegramRuntimeSource(message, currentInboundRequest()?.files, input.callbackQueryId)),
2017
+ [RUNTIME_SOURCE_ATTRIBUTE]: JSON.stringify(telegramRuntimeSource(message, currentInboundRequest()?.files, input.callbackQueryId)),
1986
2018
  identityProvider: "telegram",
1987
2019
  roles: member.roles,
1988
2020
  ...agentToolsAttribute(member.agentTools),
@@ -2026,4 +2058,4 @@ function identityProviderOf(principal) {
2026
2058
  const provider = principal?.attributes.identityProvider;
2027
2059
  return typeof provider === "string" && provider !== "" ? provider : void 0;
2028
2060
  }
2029
- export { KIND_ATTRIBUTE as $, ontologyToolLabels as A, reportTelegramError as At, actorHeaders as B, parseAttachmentUrl as C, currentLocale as Ct, OntologyFileUnavailable as D, customerText as Dt, OntologyActionNotPermitted as E, customerMessage as Et, confirmations as F, principalRuntimeSource as Ft, memberTool as G, actorOf as H, inputHash as I, runtimeEnvelope as It, AGENT_GRANT_HEADER as J, notForGuests as K, needsConfirmation as L, telegramRuntimeSource as Lt, promotionTarget as M, withDeliveryLocale as Mt, CONFIRMATION_TTL_MS as N, RUNTIME_SOURCE_PROTOCOL as Nt, OntologyToolRejected as O, failureText as Ot, actionApproval as P, compatibleRuntimeEnvelope as Pt, INTROSPECTION_PATH as Q, ACT_AS_HEADER as R, fetchStoredAttachment as S, TelegramDeliveryError as St, ontologyConnection as T, customerCopy as Tt, isGuestSession as U, actorKey as V, member as W, GUEST_ID_ATTRIBUTE as X, GUEST_CONFIRMATIONS_ATTRIBUTE as Y, GUEST_ROLE as Z, AttachmentError as _, chatChannel as _t, rolesOf as a, guestConfirms as at, agentAttachments as b, withChatAddress as bt, currentInboundRequest as c, ontologyIntrospection as ct, prepareInboundMedia as d, webMemberOf as dt, TURN_LIMITED_CODE as et, attachmentsContext as f, webPrincipal as ft, ATTACHMENT_URL_PROTOCOL as g, chatAddressOf as gt, ATTACHMENT_TTL_HOURS as h, SESSION_HEADER as ht, memberIdOf as i, WEB_PROVIDER as it, ontologyTools as j, safeTelegramFetch as jt, actionToolName as k, formattingRefused as kt, runInboundRequest as l, webAuth as lt, turnContent as m, CHAT_HEADER as mt, chatLanguage as n, WEB_AUTHENTICATOR as nt, telegramPrincipal as o, guestIdOf as ot, storeFiles as p, CHAT_ATTRIBUTE as pt, ACCESS_TOKEN_PREFIX as q, identityProviderOf as r, WEB_GRANT_ATTRIBUTE as rt, InboundRequest as s, guestPrincipal as st, TELEGRAM_AUTHENTICATOR as t, TurnLimitedError as tt, withReplacedText as u, webGrantOf as ut, EARLIER_CHAT_HEADER as v, chatHeaders as vt, actAsHeaders as w, currentThreadId as wt, attachmentUrl as x, workspaceIdentityProvider as xt, MAXIMUM_ATTACHMENT_BYTES as y, isSameChat as yt, ActorRequiredError as z };
2061
+ export { KIND_ATTRIBUTE as $, ontologyToolLabels as A, CHAT_ATTRIBUTE as At, actorHeaders as B, workspaceIdentityProvider as Bt, parseAttachmentUrl as C, withDeliveryLocale as Ct, OntologyFileUnavailable as D, readableRuntimeEnvelope as Dt, OntologyActionNotPermitted as E, principalRuntimeSource as Et, confirmations as F, chatChannel as Ft, memberTool as G, actorOf as H, inputHash as I, chatHeaders as It, AGENT_GRANT_HEADER as J, notForGuests as K, needsConfirmation as L, chatRuntimeSource as Lt, promotionTarget as M, RUNTIME_SOURCE_ATTRIBUTE as Mt, CONFIRMATION_TTL_MS as N, SESSION_HEADER as Nt, OntologyToolRejected as O, runtimeEnvelope as Ot, actionApproval as P, chatAddressOf as Pt, INTROSPECTION_PATH as Q, ACT_AS_HEADER as R, isSameChat as Rt, fetchStoredAttachment as S, safeTelegramFetch as St, ontologyConnection as T, compatibleRuntimeEnvelope as Tt, isGuestSession as U, actorKey as V, member as W, GUEST_ID_ATTRIBUTE as X, GUEST_CONFIRMATIONS_ATTRIBUTE as Y, GUEST_ROLE as Z, AttachmentError as _, customerMessage as _t, rolesOf as a, guestConfirms as at, agentAttachments as b, formattingRefused as bt, currentInboundRequest as c, ontologyIntrospection as ct, prepareInboundMedia as d, webMemberOf as dt, TURN_LIMITED_CODE as et, attachmentsContext as f, webPrincipal as ft, ATTACHMENT_URL_PROTOCOL as g, customerCopy as gt, ATTACHMENT_TTL_HOURS as h, currentThreadId as ht, memberIdOf as i, WEB_PROVIDER as it, ontologyTools as j, CHAT_HEADER as jt, actionToolName as k, telegramRuntimeSource as kt, runInboundRequest as l, webAuth as lt, turnContent as m, currentLocale as mt, chatLanguage as n, WEB_AUTHENTICATOR as nt, telegramPrincipal as o, guestIdOf as ot, storeFiles as p, TelegramDeliveryError as pt, ACCESS_TOKEN_PREFIX as q, identityProviderOf as r, WEB_GRANT_ATTRIBUTE as rt, InboundRequest as s, guestPrincipal as st, TELEGRAM_AUTHENTICATOR as t, TurnLimitedError as tt, withReplacedText as u, webGrantOf as ut, EARLIER_CHAT_HEADER as v, customerText as vt, actAsHeaders as w, RUNTIME_SOURCE_PROTOCOL as wt, attachmentUrl as x, reportTelegramError as xt, MAXIMUM_ATTACHMENT_BYTES as y, failureText as yt, ActorRequiredError as z, withChatAddress as zt };
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import segmentstream from "../extension.mjs";
8
- import { T as ontologyConnection } from "../../_chunks/principal-DYl7vqOp.mjs";
8
+ import { T as ontologyConnection } from "../../_chunks/principal-BWTq_zuf.mjs";
9
9
  import { defineDynamic } from "eve/connections";
10
10
  var ontology_default = defineDynamic(async (context) => {
11
11
  if (!segmentstream.config.ontology.connection) return null;
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
7
7
  import segmentstream from "../extension.mjs";
8
8
  import { localizedText } from "../lib/admission.mjs";
9
9
  import { confirmationLocale } from "../lib/telegram/confirmation-text.mjs";
10
- import "../../_chunks/principal-DYl7vqOp.mjs";
10
+ import "../../_chunks/principal-BWTq_zuf.mjs";
11
11
  import { defineHook } from "eve/hooks";
12
12
  var authorization_default = defineHook({ events: { "interaction.opened": (event, context) => {
13
13
  const principal = context.session.auth.current;
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import segmentstream from "../extension.mjs";
8
- import { a as rolesOf } from "../../_chunks/principal-DYl7vqOp.mjs";
8
+ import { a as rolesOf } from "../../_chunks/principal-BWTq_zuf.mjs";
9
9
  import { personaFor } from "../personas.mjs";
10
10
  import { defineDynamic, defineInstructions } from "eve/instructions";
11
11
  var persona_default = defineDynamic((context) => {
@@ -4,4 +4,4 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- export { R as ACT_AS_HEADER, z as ActorRequiredError, B as actorHeaders, V as actorKey, H as actorOf, U as isGuestSession, W as member, G as memberTool, K as notForGuests } from "../../_chunks/principal-DYl7vqOp.mjs";
7
+ export { R as ACT_AS_HEADER, z as ActorRequiredError, B as actorHeaders, V as actorKey, H as actorOf, U as isGuestSession, W as member, G as memberTool, K as notForGuests } from "../../_chunks/principal-BWTq_zuf.mjs";
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- import { _t as chatChannel, b as agentAttachments, gt as chatAddressOf, i as memberIdOf } from "../../_chunks/principal-DYl7vqOp.mjs";
7
+ import { Ft as chatChannel, Pt as chatAddressOf, b as agentAttachments, i as memberIdOf } from "../../_chunks/principal-BWTq_zuf.mjs";
8
8
  import { detectFile, documentText } from "./attachment-formats.mjs";
9
9
  import { readSheets, typedTable } from "./attachment-tables.mjs";
10
10
  import { appOrigin } from "./environment.mjs";
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { attachmentOwner } from "./attachment-tools.mjs";
8
- import { Ot as failureText, _ as AttachmentError, gt as chatAddressOf } from "../../_chunks/principal-DYl7vqOp.mjs";
8
+ import { Pt as chatAddressOf, _ as AttachmentError, yt as failureText } from "../../_chunks/principal-BWTq_zuf.mjs";
9
9
  import { appOrigin, channelsEnabled } from "./environment.mjs";
10
10
  import { transientFileStatus } from "./file-grant.mjs";
11
11
  import { runtimeToken } from "./runtime-token.mjs";
@@ -4,4 +4,4 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- export { h as ATTACHMENT_TTL_HOURS, g as ATTACHMENT_URL_PROTOCOL, _ as AttachmentError, mt as CHAT_HEADER, v as EARLIER_CHAT_HEADER, y as MAXIMUM_ATTACHMENT_BYTES, ht as SESSION_HEADER, b as agentAttachments, x as attachmentUrl, S as fetchStoredAttachment, C as parseAttachmentUrl } from "../../_chunks/principal-DYl7vqOp.mjs";
7
+ export { h as ATTACHMENT_TTL_HOURS, g as ATTACHMENT_URL_PROTOCOL, _ as AttachmentError, jt as CHAT_HEADER, v as EARLIER_CHAT_HEADER, y as MAXIMUM_ATTACHMENT_BYTES, Nt as SESSION_HEADER, b as agentAttachments, x as attachmentUrl, S as fetchStoredAttachment, C as parseAttachmentUrl } from "../../_chunks/principal-BWTq_zuf.mjs";
@@ -4,4 +4,4 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- export { t as agentBuild } from "../../_chunks/build-metadata-BXGz_t3T.mjs";
7
+ export { t as agentBuild } from "../../_chunks/build-metadata-D83t0hEp.mjs";
@@ -1,3 +1,4 @@
1
+ import type { RuntimeSource } from "@segmentstream/ontology";
1
2
  import type { SessionAuthContext } from "eve/context";
2
3
  /**
3
4
  * The chat a member's message came from, the same way for every channel: the provider,
@@ -30,8 +31,24 @@ export declare const CHAT_HEADER = "X-SegmentStream-Agent-Chat";
30
31
  export declare const SESSION_HEADER = "X-SegmentStream-Agent-Session";
31
32
  /** The session attribute that carries a non-Telegram channel's chat, as JSON. */
32
33
  export declare const CHAT_ATTRIBUTE = "segmentstreamChat";
33
- /** A channel's principal with the chat its message came from. */
34
- export declare function withChatAddress(principal: SessionAuthContext, chat: ChatAddress): SessionAuthContext;
34
+ /** The session attribute that carries, as JSON, the runtime source of the message a turn answers. */
35
+ export declare const RUNTIME_SOURCE_ATTRIBUTE = "segmentstreamRuntimeSource";
36
+ /** The message a channel's turn answers, beside its chat: its id and the account that wrote it. */
37
+ export interface ChatMessage {
38
+ readonly id?: string;
39
+ readonly sender?: string;
40
+ }
41
+ /**
42
+ * The runtime source a tool call names for a message in a Slack or WhatsApp chat: the chat, its
43
+ * thread, the message and its sender, as the ontology verifies them. Telegram builds its own, with
44
+ * the references only Telegram carries; another channel has none the ontology reads.
45
+ */
46
+ export declare function chatRuntimeSource(chat: ChatAddress, message?: ChatMessage): RuntimeSource | undefined;
47
+ /**
48
+ * A channel's principal with the chat its message came from and, given the message, the runtime
49
+ * source the turn's tool calls name.
50
+ */
51
+ export declare function withChatAddress(principal: SessionAuthContext, chat: ChatAddress, message?: ChatMessage): SessionAuthContext;
35
52
  /**
36
53
  * The chat a session's principal speaks from, or undefined for one without a channel
37
54
  * chat, such as a task. Telegram's comes from the chat attributes its principal always
@@ -4,4 +4,4 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- export { pt as CHAT_ATTRIBUTE, mt as CHAT_HEADER, ht as SESSION_HEADER, gt as chatAddressOf, _t as chatChannel, vt as chatHeaders, yt as isSameChat, bt as withChatAddress, xt as workspaceIdentityProvider } from "../../_chunks/principal-DYl7vqOp.mjs";
7
+ export { At as CHAT_ATTRIBUTE, jt as CHAT_HEADER, Mt as RUNTIME_SOURCE_ATTRIBUTE, Nt as SESSION_HEADER, Pt as chatAddressOf, Ft as chatChannel, It as chatHeaders, Lt as chatRuntimeSource, Rt as isSameChat, zt as withChatAddress, Bt as workspaceIdentityProvider } from "../../_chunks/principal-BWTq_zuf.mjs";
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
7
7
  import { agentTaskIdOf } from "./agent-task.mjs";
8
8
  import { chatCoordinates, sessionKind } from "./chat-recorder.mjs";
9
9
  import { archiveSequence, chatArchive, chatAuthor, collapseChatEvents, topicContext } from "./chat-archive.mjs";
10
- import { At as reportTelegramError } from "../../_chunks/principal-DYl7vqOp.mjs";
10
+ import { xt as reportTelegramError } from "../../_chunks/principal-BWTq_zuf.mjs";
11
11
  import { createHash } from "node:crypto";
12
12
  import { deliveries, runs, turns } from "eve/events";
13
13
  import { defineState } from "eve/context";
@@ -8,7 +8,7 @@ import { n as contentText, t as CONTENT_CAPS } from "../../_chunks/content-cDtVn
8
8
  import { chatArchive, chatEvent, sessionFailureEventId, summarizeArguments } from "./chat-archive.mjs";
9
9
  import { agentTaskIdOf } from "./agent-task.mjs";
10
10
  import { revisionOf } from "./review/revision.mjs";
11
- import { _t as chatChannel, gt as chatAddressOf, i as memberIdOf, ot as guestIdOf } from "../../_chunks/principal-DYl7vqOp.mjs";
11
+ import { Ft as chatChannel, Pt as chatAddressOf, i as memberIdOf, ot as guestIdOf } from "../../_chunks/principal-BWTq_zuf.mjs";
12
12
  import { keyChannel, principalChannel } from "./channel-scope.mjs";
13
13
  import { parseAddress } from "./telegram/sessions.mjs";
14
14
  import { completionKind } from "./telegram/silent.mjs";
@@ -4,4 +4,4 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- export { N as CONFIRMATION_TTL_MS, P as actionApproval, F as confirmations, I as inputHash, L as needsConfirmation } from "../../_chunks/principal-DYl7vqOp.mjs";
7
+ export { N as CONFIRMATION_TTL_MS, P as actionApproval, F as confirmations, I as inputHash, L as needsConfirmation } from "../../_chunks/principal-BWTq_zuf.mjs";
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- import { _ as AttachmentError } from "../../../_chunks/principal-DYl7vqOp.mjs";
7
+ import { _ as AttachmentError } from "../../../_chunks/principal-BWTq_zuf.mjs";
8
8
  import { sendStoredAttachments } from "../attachments-send.mjs";
9
9
  import { ConnectionProxyError, connectionProxy } from "../connection-proxy.mjs";
10
10
  import { redactDiagnostic } from "../diagnostics.mjs";
@@ -8,7 +8,7 @@ import { PUBSUB_TOPIC } from "../../config.mjs";
8
8
  import { admitMessage, localizedText } from "../admission.mjs";
9
9
  import { agentToolsAttribute } from "../agent-tools.mjs";
10
10
  import { providerChat } from "../attachment-tools.mjs";
11
- import { S as fetchStoredAttachment, b as agentAttachments, bt as withChatAddress, d as prepareInboundMedia, gt as chatAddressOf, i as memberIdOf, m as turnContent } from "../../../_chunks/principal-DYl7vqOp.mjs";
11
+ import { Pt as chatAddressOf, S as fetchStoredAttachment, b as agentAttachments, d as prepareInboundMedia, i as memberIdOf, m as turnContent, zt as withChatAddress } from "../../../_chunks/principal-BWTq_zuf.mjs";
12
12
  import { channelAttributes, currentChannel, currentKey, inHandlerChannels, withNamedRoutes } from "../channel-scope.mjs";
13
13
  import { chatArchive, replyEvent } from "../chat-archive.mjs";
14
14
  import { recordHandledMessage, recordSentOutside } from "../chat-messages.mjs";
@@ -6,7 +6,7 @@ __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { appOrigin } from "./environment.mjs";
8
8
  import { runtimeToken } from "./runtime-token.mjs";
9
- import { ot as guestIdOf } from "../../_chunks/principal-DYl7vqOp.mjs";
9
+ import { ot as guestIdOf } from "../../_chunks/principal-BWTq_zuf.mjs";
10
10
  const GUEST_USAGE_PATH = "/api/ontology/agent/guests/usage";
11
11
  const REPORT_TIMEOUT_MS = 5e3;
12
12
  function ontologyGuestUsage(options = {}) {
@@ -4,4 +4,4 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- export { f as attachmentsContext, p as storeFiles, m as turnContent } from "../../../_chunks/principal-DYl7vqOp.mjs";
7
+ export { f as attachmentsContext, p as storeFiles, m as turnContent } from "../../../_chunks/principal-BWTq_zuf.mjs";
@@ -4,4 +4,4 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- export { f as attachmentsContext, d as prepareInboundMedia, p as storeFiles, m as turnContent } from "../../../_chunks/principal-DYl7vqOp.mjs";
7
+ export { f as attachmentsContext, d as prepareInboundMedia, p as storeFiles, m as turnContent } from "../../../_chunks/principal-BWTq_zuf.mjs";
@@ -4,4 +4,4 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- export { R as ACT_AS_HEADER, w as actAsHeaders, T as ontologyConnection } from "../../_chunks/principal-DYl7vqOp.mjs";
7
+ export { R as ACT_AS_HEADER, w as actAsHeaders, T as ontologyConnection } from "../../_chunks/principal-BWTq_zuf.mjs";
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- import { F as confirmations, H as actorOf, I as inputHash, It as runtimeEnvelope, P as actionApproval, V as actorKey, j as ontologyTools } from "../../_chunks/principal-DYl7vqOp.mjs";
7
+ import { F as confirmations, H as actorOf, I as inputHash, Ot as runtimeEnvelope, P as actionApproval, V as actorKey, j as ontologyTools } from "../../_chunks/principal-BWTq_zuf.mjs";
8
8
  import { isChatPost } from "./chat-post-confirmation.mjs";
9
9
  import { sandboxFile } from "./sandbox-session.mjs";
10
10
  import { saveOntologyResult } from "./ontology-result-file.mjs";
@@ -51,6 +51,7 @@ export declare function ontologyTools(options?: {
51
51
  }): {
52
52
  rpc: (actor: OntologyActor, method: string, params: Record<string, unknown>, signal?: AbortSignal) => Promise<Record<string, unknown>>;
53
53
  supportsRuntimeSource(actor: OntologyActor, signal?: AbortSignal): Promise<boolean>;
54
+ sourceProviders: (actor: OntologyActor, signal?: AbortSignal) => Promise<ReadonlySet<string>>;
54
55
  labels(actor: OntologyActor, action: string, input?: Readonly<Record<string, unknown>>, signal?: AbortSignal, hints?: ToolHints): Promise<ActionAnnotations>;
55
56
  describe(actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>, hints?: ToolHints, locale?: string): Promise<ConfirmationDescription>;
56
57
  };
@@ -4,4 +4,4 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- export { E as OntologyActionNotPermitted, D as OntologyFileUnavailable, O as OntologyToolRejected, k as actionToolName, A as ontologyToolLabels, j as ontologyTools, M as promotionTarget } from "../../_chunks/principal-DYl7vqOp.mjs";
7
+ export { E as OntologyActionNotPermitted, D as OntologyFileUnavailable, O as OntologyToolRejected, k as actionToolName, A as ontologyToolLabels, j as ontologyTools, M as promotionTarget } from "../../_chunks/principal-BWTq_zuf.mjs";
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { reviewFor } from "../../review.mjs";
8
- import { a as rolesOf, gt as chatAddressOf, i as memberIdOf } from "../../../_chunks/principal-DYl7vqOp.mjs";
8
+ import { Pt as chatAddressOf, a as rolesOf, i as memberIdOf } from "../../../_chunks/principal-BWTq_zuf.mjs";
9
9
  function reviewOf(settings, principal) {
10
10
  return reviewFor(settings, rolesOf(principal));
11
11
  }
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- import { _t as chatChannel, gt as chatAddressOf, i as memberIdOf } from "../../../_chunks/principal-DYl7vqOp.mjs";
7
+ import { Ft as chatChannel, Pt as chatAddressOf, i as memberIdOf } from "../../../_chunks/principal-BWTq_zuf.mjs";
8
8
  import { chatArchive, chatEvent } from "../chat-archive.mjs";
9
9
  import { stampedChat } from "../chat-recorder.mjs";
10
10
  import { appOrigin } from "../environment.mjs";
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- import { a as rolesOf } from "../../_chunks/principal-DYl7vqOp.mjs";
7
+ import { a as rolesOf } from "../../_chunks/principal-BWTq_zuf.mjs";
8
8
  import { defineDynamic, defineSkill } from "eve/skills";
9
9
  function forRoles(roles, skill) {
10
10
  if (!Array.isArray(roles) || roles.length === 0 || !roles.every((role) => typeof role === "string" && role.trim() !== "")) throw new TypeError("forRoles() needs at least one role name; a skill for everyone is an ordinary skill file.");
@@ -19,7 +19,10 @@ export type RuntimeEnvelope = {
19
19
  };
20
20
  /** The source comes from the verified Telegram message and admitted storage results. */
21
21
  export declare function telegramRuntimeSource(message: Pick<TelegramMessage, "chat" | "messageId" | "messageThreadId" | "replyToMessage" | "from" | "raw" | "attachments">, files?: ReadonlyMap<string, StagedFile>, callbackQueryId?: string): TelegramRuntimeSource;
22
- /** Session auth is SDK-owned; no tool argument is read while rebuilding provenance. */
22
+ /**
23
+ * The source of the message a channel's turn answers. Session auth is SDK-owned: each channel
24
+ * writes it from the verified message, and no tool argument is read while rebuilding provenance.
25
+ */
23
26
  export declare function principalRuntimeSource(principal?: SessionAuthContext | null): RuntimeSource | undefined;
24
27
  export declare function runtimeEnvelope(input?: {
25
28
  readonly principal?: SessionAuthContext | null;
@@ -27,6 +30,12 @@ export declare function runtimeEnvelope(input?: {
27
30
  readonly callId?: string;
28
31
  readonly source?: RuntimeSource;
29
32
  }): RuntimeEnvelope;
33
+ /**
34
+ * The envelope with its source only where the ontology reads it: from Telegram always, from another
35
+ * channel only where `initialize` lists it, since an ontology that cannot read a source refuses
36
+ * the whole call. The ontology is asked only for another channel's source.
37
+ */
38
+ export declare function readableRuntimeEnvelope(envelope: RuntimeEnvelope, providers: () => Promise<ReadonlySet<string>>): Promise<RuntimeEnvelope>;
30
39
  /** Older strict ontology schemas accept only the original chat identity fields. */
31
40
  export declare function compatibleRuntimeEnvelope(envelope: RuntimeEnvelope, extended: boolean): RuntimeEnvelope;
32
41
  export declare const RUNTIME_SOURCE_PROTOCOL = "segmentstream/runtime-source";
@@ -4,4 +4,4 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- export { Nt as RUNTIME_SOURCE_PROTOCOL, Pt as compatibleRuntimeEnvelope, Ft as principalRuntimeSource, It as runtimeEnvelope, Lt as telegramRuntimeSource } from "../../_chunks/principal-DYl7vqOp.mjs";
7
+ export { wt as RUNTIME_SOURCE_PROTOCOL, Tt as compatibleRuntimeEnvelope, Et as principalRuntimeSource, Dt as readableRuntimeEnvelope, Ot as runtimeEnvelope, kt as telegramRuntimeSource } from "../../_chunks/principal-BWTq_zuf.mjs";
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- import { R as ACT_AS_HEADER, _ as AttachmentError, ht as SESSION_HEADER, mt as CHAT_HEADER, v as EARLIER_CHAT_HEADER } from "../../_chunks/principal-DYl7vqOp.mjs";
7
+ import { Nt as SESSION_HEADER, R as ACT_AS_HEADER, _ as AttachmentError, jt as CHAT_HEADER, v as EARLIER_CHAT_HEADER } from "../../_chunks/principal-BWTq_zuf.mjs";
8
8
  import { fetchFileGrant, transientFileStatus } from "./file-grant.mjs";
9
9
  var StoredFileError = class extends AttachmentError {
10
10
  filename;
@@ -8,7 +8,7 @@ import { admitMessage, localizedText } from "../admission.mjs";
8
8
  import { agentToolsAttribute } from "../agent-tools.mjs";
9
9
  import { agentChats, channelChats } from "../chats.mjs";
10
10
  import { withButtonDecision } from "../confirmation-buttons.mjs";
11
- import { b as agentAttachments, bt as withChatAddress, d as prepareInboundMedia, m as turnContent } from "../../../_chunks/principal-DYl7vqOp.mjs";
11
+ import { b as agentAttachments, d as prepareInboundMedia, m as turnContent, zt as withChatAddress } from "../../../_chunks/principal-BWTq_zuf.mjs";
12
12
  import { channelAttributes, currentChannel, withNamedRoutes, withSessionChannels } from "../channel-scope.mjs";
13
13
  import { redactDiagnostic } from "../diagnostics.mjs";
14
14
  import { MAXIMUM_DOWNLOAD_BYTES, connectionProxy } from "../connection-proxy.mjs";
@@ -472,6 +472,9 @@ async function receive(input) {
472
472
  threadId: ctx.slack.threadTs,
473
473
  kind: input.direct ? "private" : "group",
474
474
  ...input.direct ? { peer: user } : {}
475
+ }, {
476
+ id: message.ts,
477
+ sender: user
475
478
  });
476
479
  if (message.attachments.length === 0 || input.files === void 0) return { auth };
477
480
  const channelId = ctx.slack.channelId;