@segmentstream/agent 0.102.0 → 0.103.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 +16 -0
- package/README.md +8 -20
- package/dist/_chunks/{build-metadata-BtB38zQ0.mjs → build-metadata-BkLo_nGS.mjs} +1 -1
- package/dist/_chunks/{chat-archive-DmCXcI8G.mjs → chat-archive-CMyCVvpe.mjs} +1 -1
- package/dist/_chunks/{principal-DL9NdRRP.mjs → principal-DIQHp6AG.mjs} +32 -11
- package/dist/_chunks/{silent-xJcJ8SNJ.mjs → silent-CWcAjHwt.mjs} +1 -1
- package/dist/extension/config.d.ts +0 -13
- package/dist/extension/config.mjs +0 -56
- package/dist/extension/connections/ontology.mjs +1 -1
- package/dist/extension/extension.d.ts +0 -2
- package/dist/extension/hooks/authorization.mjs +1 -1
- package/dist/extension/instructions/persona.mjs +1 -1
- package/dist/extension/lib/actor.mjs +1 -1
- package/dist/extension/lib/attachment-tools.mjs +1 -1
- package/dist/extension/lib/attachments-dispatch.mjs +2 -2
- package/dist/extension/lib/attachments-send.mjs +1 -1
- package/dist/extension/lib/attachments.mjs +1 -1
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/channel-guest.d.ts +15 -0
- package/dist/extension/lib/channel-guest.mjs +54 -0
- package/dist/extension/lib/chat-address.mjs +1 -1
- package/dist/extension/lib/chat-context.mjs +1 -1
- package/dist/extension/lib/chat-persona.mjs +1 -1
- package/dist/extension/lib/chat-recorder.mjs +2 -2
- package/dist/extension/lib/confirmations.mjs +1 -1
- package/dist/extension/lib/email/attachments-send.mjs +1 -1
- package/dist/extension/lib/email/channel.mjs +2 -2
- package/dist/extension/lib/guest-usage.mjs +1 -1
- package/dist/extension/lib/identities.d.ts +22 -0
- package/dist/extension/lib/identities.mjs +25 -0
- package/dist/extension/lib/inbound-media/files.mjs +1 -1
- package/dist/extension/lib/inbound-media/index.mjs +1 -1
- package/dist/extension/lib/ontology-connection.mjs +1 -1
- package/dist/extension/lib/ontology-file-call.mjs +1 -1
- package/dist/extension/lib/ontology-recall.mjs +1 -1
- package/dist/extension/lib/ontology-tools.mjs +1 -1
- package/dist/extension/lib/review/files.mjs +1 -1
- package/dist/extension/lib/review/hold.mjs +1 -1
- package/dist/extension/lib/review/reply.mjs +2 -2
- package/dist/extension/lib/role-skill.mjs +1 -1
- package/dist/extension/lib/runtime-envelope.mjs +1 -1
- package/dist/extension/lib/sent-files.mjs +1 -1
- package/dist/extension/lib/slack/adapter.d.ts +2 -0
- package/dist/extension/lib/slack/adapter.mjs +86 -18
- package/dist/extension/lib/slack/attachments-send.mjs +1 -1
- package/dist/extension/lib/slack/callbacks.mjs +1 -1
- package/dist/extension/lib/slack/confirmation-card.mjs +1 -1
- package/dist/extension/lib/stored-files.mjs +1 -1
- package/dist/extension/lib/telegram/adapter.mjs +19 -12
- package/dist/extension/lib/telegram/attachment-description.mjs +1 -1
- package/dist/extension/lib/telegram/attachments-send.mjs +1 -1
- package/dist/extension/lib/telegram/callbacks.mjs +1 -1
- package/dist/extension/lib/telegram/chat-archive.mjs +1 -1
- package/dist/extension/lib/telegram/confirmations.d.ts +2 -0
- package/dist/extension/lib/telegram/confirmations.mjs +49 -13
- package/dist/extension/lib/telegram/customer-text.mjs +1 -1
- package/dist/extension/lib/telegram/files.mjs +1 -1
- package/dist/extension/lib/telegram/health.mjs +1 -1
- package/dist/extension/lib/telegram/held-approvals.mjs +1 -1
- package/dist/extension/lib/telegram/inbound-request.d.ts +2 -0
- package/dist/extension/lib/telegram/inbound-request.mjs +1 -1
- package/dist/extension/lib/telegram/inbound.mjs +30 -15
- package/dist/extension/lib/telegram/lifecycle.mjs +2 -2
- package/dist/extension/lib/telegram/principal.mjs +1 -1
- package/dist/extension/lib/telegram/routing-context.mjs +1 -1
- package/dist/extension/lib/telegram/session-recovery.mjs +1 -1
- package/dist/extension/lib/telegram/sessions.d.ts +2 -0
- package/dist/extension/lib/telegram/sessions.mjs +9 -1
- package/dist/extension/lib/telegram/silent.mjs +1 -1
- package/dist/extension/lib/telegram/store-capture.mjs +1 -1
- package/dist/extension/lib/telegram/structured.mjs +1 -1
- package/dist/extension/lib/telegram/turn-errors.mjs +2 -2
- package/dist/extension/lib/triage.mjs +1 -1
- package/dist/extension/lib/web/auth.d.ts +1 -0
- package/dist/extension/lib/web/auth.mjs +1 -1
- package/dist/extension/lib/web/channel.mjs +1 -1
- package/dist/extension/lib/whatsapp/adapter.mjs +26 -2
- package/dist/extension/lib/whatsapp/attachments-send.mjs +1 -1
- package/dist/extension/lib/whatsapp/callbacks.mjs +1 -1
- package/dist/extension/lib/whatsapp/files.mjs +1 -1
- package/dist/extension/lib/workspace-action.mjs +1 -1
- package/dist/extension/lib/workspace-channel/attachments-send.mjs +1 -1
- package/dist/extension/lib/workspace-channel/channel.mjs +2 -2
- package/dist/extension/lib/workspace-source.mjs +1 -1
- package/dist/extension/model.mjs +1 -1
- package/dist/extension/tools/attachments_discard.mjs +1 -1
- package/dist/extension/tools/attachments_list.mjs +1 -1
- package/dist/extension/tools/attachments_promote.mjs +1 -1
- package/dist/extension/tools/attachments_read.mjs +1 -1
- package/dist/extension/tools/attachments_send.mjs +2 -2
- package/dist/extension/tools/attachments_stage.mjs +1 -1
- package/dist/extension/tools/attachments_table.mjs +1 -1
- package/dist/extension/tools/handoff.mjs +1 -1
- package/dist/extension/tools/questions_ask.mjs +1 -1
- package/dist/extension/tools/workspace_source.mjs +1 -1
- package/package.json +2 -2
- package/dist/extension/lib/public-group-knowledge.d.ts +0 -16
- package/dist/extension/lib/public-group-knowledge.mjs +0 -44
- package/dist/extension/lib/public-group.d.ts +0 -28
- package/dist/extension/lib/public-group.mjs +0 -116
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.103.0
|
|
4
|
+
|
|
5
|
+
Guest turns on admitted messaging channels use workspace roles, regular agent personas, and ontology tools. Workspaces select guest roles by channel and can handle authorized provider tools in workspace code. This replaces isolated group responses and their dedicated action and connection bindings.
|
|
6
|
+
|
|
7
|
+
Pins @segmentstream/ontology 0.182.0.
|
|
8
|
+
|
|
9
|
+
## 0.102.1
|
|
10
|
+
|
|
11
|
+
WhatsApp no longer loses a message that a person sends while the agent is still handling their
|
|
12
|
+
previous one. Before, a second message that arrived on the same instance while the first was
|
|
13
|
+
still being admitted, triaged or transcribed was dropped, after Meta had already been answered,
|
|
14
|
+
so the agent never read it. Now it reaches the agent and joins the running turn. A message Meta
|
|
15
|
+
delivers again still starts only one turn.
|
|
16
|
+
|
|
17
|
+
No configuration changes.
|
|
18
|
+
|
|
3
19
|
## 0.102.0
|
|
4
20
|
|
|
5
21
|
On email and workspace channels, an agent with `review` proposes each turn's reply to the
|
package/README.md
CHANGED
|
@@ -1102,23 +1102,11 @@ ontology authority still apply. The calling channel must authenticate and
|
|
|
1102
1102
|
authorize its caller and choose the intended destination before forwarding.
|
|
1103
1103
|
The reference alone grants no access or messaging authority.
|
|
1104
1104
|
|
|
1105
|
-
##
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
receipts. The ontology rechecks group access on every call.
|
|
1114
|
-
|
|
1115
|
-
For an isolated group answer, the workspace can declare `publicGroups.knowledge`
|
|
1116
|
-
with a `connection` key and localized `unavailable` text in its agent configuration.
|
|
1117
|
-
In the agent's extension mount, add a `lookup` function to that object. Its
|
|
1118
|
-
`PublicGroupKnowledgeContext` supplies the current question, a bounded GET on
|
|
1119
|
-
the named connection, a metered private model call and an abort signal. No
|
|
1120
|
-
member session or conversation history is supplied. Only return facts that may
|
|
1121
|
-
be published to everyone in the group. Those facts and the question enter the
|
|
1122
|
-
ordinary answer model; neither model gets a connection tool or credentials.
|
|
1123
|
-
An empty result, unavailable source or missing runtime binding uses the
|
|
1124
|
-
workspace's fallback text. Closed groups and rejected turns do not run a lookup.
|
|
1105
|
+
## Guest access on messaging channels
|
|
1106
|
+
|
|
1107
|
+
The workspace ontology declares guest channels and their roles in `guest.byChannel`.
|
|
1108
|
+
Existing linked senders always act with their own roles. A sender without a linked account
|
|
1109
|
+
can start a normal agent turn in a group opened with `agent_chat:set_access`. Their tools
|
|
1110
|
+
use current ontology permissions. The chat's existing persona selection supplies its instructions.
|
|
1111
|
+
An optional `guest.openOnInvite` lists connections on which a linked inviter who holds
|
|
1112
|
+
`agent_chat:set_access` for the group may open a newly joined group.
|
|
@@ -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.
|
|
7
|
+
var version = "0.103.0";
|
|
8
8
|
function agentBuild(environment = process.env) {
|
|
9
9
|
return {
|
|
10
10
|
agent: version,
|
|
@@ -11,7 +11,7 @@ import { n as contentText, t as CONTENT_CAPS } from "./content-cDtVnr8Y.mjs";
|
|
|
11
11
|
import { C as sendFingerprint, S as reasonCode, _ as boundedMeta, a as chatEvent, b as messageInput, f as sessionFailureEventId, p as storeOf, v as cutText, w as storedFiles, x as metaOf } from "./chat-archive-_IBU0CXG.mjs";
|
|
12
12
|
import { applyChatChange } from "../extension/lib/chat-messages.mjs";
|
|
13
13
|
import { ChatStoreError } from "../extension/lib/chat-store.mjs";
|
|
14
|
-
import {
|
|
14
|
+
import { St as reportTelegramError, c as currentInboundRequest, gt as currentThreadId } from "./principal-DIQHp6AG.mjs";
|
|
15
15
|
import { telegramReaction } from "../extension/lib/telegram/reactions.mjs";
|
|
16
16
|
import { currentConfirmationPrompt } from "../extension/lib/group-routing/messages.mjs";
|
|
17
17
|
import { messageMetadata } from "../extension/lib/telegram/message-metadata.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 { AGENT_TOOLS_ATTRIBUTE,
|
|
7
|
+
import { AGENT_TOOLS_ATTRIBUTE, agentToolsAnswer, agentToolsAttribute } from "../extension/lib/agent-tools.mjs";
|
|
8
8
|
import { redactDiagnostic } from "../extension/lib/diagnostics.mjs";
|
|
9
9
|
import { appOrigin, ontologyDeploymentHeaders, previewDeployment } from "../extension/lib/environment.mjs";
|
|
10
10
|
import { telegramText, withTelegramTexts } from "../extension/lib/telegram/texts.mjs";
|
|
@@ -102,7 +102,7 @@ function parsedChatAddress(value, provider) {
|
|
|
102
102
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return;
|
|
103
103
|
const item = value;
|
|
104
104
|
const text = (field, empty = false) => typeof field === "string" && (empty || field !== "") && field.length <= 512;
|
|
105
|
-
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;
|
|
105
|
+
if (item.provider !== "telegram" && 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;
|
|
106
106
|
return {
|
|
107
107
|
provider: item.provider,
|
|
108
108
|
...item.channel === void 0 ? {} : { channel: item.channel },
|
|
@@ -455,6 +455,7 @@ function safeTelegramFetch(fetchImpl, scope = "telegram", previews = {}, appLink
|
|
|
455
455
|
};
|
|
456
456
|
}
|
|
457
457
|
const WEB_AUTHENTICATOR = "segmentstream-web";
|
|
458
|
+
const CHANNEL_GUEST_AUTHENTICATOR = "segmentstream-channel-guest";
|
|
458
459
|
const WEB_PROVIDER = "web";
|
|
459
460
|
const AGENT_GRANT_HEADER = "X-SegmentStream-Agent-Grant";
|
|
460
461
|
const WEB_GRANT_ATTRIBUTE = "webGrant";
|
|
@@ -509,8 +510,8 @@ function webMemberOf(body) {
|
|
|
509
510
|
const roles = strings(answer.roles);
|
|
510
511
|
if (answer.active !== true || typeof answer.grant_id !== "string" || roles === void 0) return;
|
|
511
512
|
if (answer.member_id === void 0 && typeof answer.guest_id === "string") {
|
|
512
|
-
const agentTools = (strings(answer.agent_tools) ?? []).filter((tool) => tool !==
|
|
513
|
-
return answer.guest_id === answer.grant_id && answer.chat === `guest:${answer.guest_id}`
|
|
513
|
+
const agentTools = (strings(answer.agent_tools) ?? []).filter((tool) => tool !== "sandbox" && tool !== "browser");
|
|
514
|
+
return !roles.includes("member") && (roles.length === 1 || !roles.includes("guest")) && answer.guest_id === answer.grant_id && answer.chat === `guest:${answer.guest_id}` ? {
|
|
514
515
|
kind: "guest",
|
|
515
516
|
guestId: answer.guest_id,
|
|
516
517
|
grant: answer.grant_id,
|
|
@@ -594,7 +595,7 @@ function guestConfirms(principal) {
|
|
|
594
595
|
}
|
|
595
596
|
function guestIdOf(principal) {
|
|
596
597
|
const guestId = principal?.attributes[GUEST_ID_ATTRIBUTE];
|
|
597
|
-
return principal?.authenticator === "segmentstream-web" && principal.attributes["kind"] === "guest" && typeof guestId === "string" && guestId !== "" ? guestId : void 0;
|
|
598
|
+
return (principal?.authenticator === "segmentstream-web" || principal?.authenticator === "segmentstream-channel-guest") && principal.attributes["kind"] === "guest" && typeof guestId === "string" && guestId !== "" ? guestId : void 0;
|
|
598
599
|
}
|
|
599
600
|
function webPrincipal(member) {
|
|
600
601
|
if (member.kind === "guest") return guestPrincipal(member);
|
|
@@ -742,6 +743,16 @@ function actorHeaders(input) {
|
|
|
742
743
|
};
|
|
743
744
|
}
|
|
744
745
|
if (actor.kind === "guest") {
|
|
746
|
+
if (input.principal?.authenticator === "segmentstream-channel-guest" && guestIdOf(input.principal) === actor.guestId) {
|
|
747
|
+
const chat = chatAddressOf(input.principal);
|
|
748
|
+
if (!chat?.peer || chat.kind !== "group" && chat.provider !== "whatsapp") throw new ActorRequiredError("Missing channel guest address.");
|
|
749
|
+
return {
|
|
750
|
+
[ACT_AS_HEADER]: `guest:${actor.guestId}`,
|
|
751
|
+
"X-SegmentStream-Identity-Provider": chat.provider,
|
|
752
|
+
"X-SegmentStream-Chat-Sender": chat.peer,
|
|
753
|
+
...chatHeaders(input.principal)
|
|
754
|
+
};
|
|
755
|
+
}
|
|
745
756
|
const grant = guestIdOf(input.principal) === actor.guestId ? webGrantOf(input.principal) : void 0;
|
|
746
757
|
if (grant === void 0) throw new ActorRequiredError("The guest's web session carries no agent token grant.");
|
|
747
758
|
return {
|
|
@@ -1400,11 +1411,19 @@ function ontologyConnection(input) {
|
|
|
1400
1411
|
instanceKey: `${origin}/mcp#revision:${actor.subject}:${actor.memberId}`,
|
|
1401
1412
|
tools: { block: [CHAT_POST_TOOL] }
|
|
1402
1413
|
});
|
|
1403
|
-
if (actor.kind === "guest")
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1414
|
+
if (actor.kind === "guest") {
|
|
1415
|
+
const chat = input.principal?.authenticator === "segmentstream-channel-guest" ? chatAddressOf(input.principal) : void 0;
|
|
1416
|
+
const scope = chat ? JSON.stringify([
|
|
1417
|
+
chatChannel(chat),
|
|
1418
|
+
chat.chatId,
|
|
1419
|
+
input.principal?.attributes.roles
|
|
1420
|
+
]) : "web";
|
|
1421
|
+
return defineMcpClientConnection({
|
|
1422
|
+
...common,
|
|
1423
|
+
instanceKey: `${origin}/mcp#guest:${actor.guestId}:${scope}`,
|
|
1424
|
+
tools: { block: [CHAT_POST_TOOL] }
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1408
1427
|
const memberId = actor.memberId;
|
|
1409
1428
|
const web = input.principal?.authenticator === WEB_AUTHENTICATOR;
|
|
1410
1429
|
const chatPosting = input.chatPosting === true && !web;
|
|
@@ -1903,6 +1922,8 @@ var InboundRequest = class {
|
|
|
1903
1922
|
traceId = randomUUID();
|
|
1904
1923
|
telegramBotId;
|
|
1905
1924
|
edited = false;
|
|
1925
|
+
sessionOwner;
|
|
1926
|
+
responseAddress;
|
|
1906
1927
|
triggeringMessageId;
|
|
1907
1928
|
chatId;
|
|
1908
1929
|
replyTo;
|
|
@@ -2083,4 +2104,4 @@ function identityProviderOf(principal) {
|
|
|
2083
2104
|
const provider = principal?.attributes.identityProvider;
|
|
2084
2105
|
return typeof provider === "string" && provider !== "" ? provider : void 0;
|
|
2085
2106
|
}
|
|
2086
|
-
export {
|
|
2107
|
+
export { INTROSPECTION_PATH as $, ontologyToolLabels as A, telegramRuntimeSource as At, actorHeaders as B, isSameChat as Bt, parseAttachmentUrl as C, safeTelegramFetch as Ct, OntologyFileUnavailable as D, principalRuntimeSource as Dt, OntologyActionNotPermitted as E, compatibleRuntimeEnvelope as Et, confirmations as F, SESSION_HEADER as Ft, memberTool as G, actorOf as H, withChatAddress as Ht, inputHash as I, chatAddressOf as It, AGENT_GRANT_HEADER as J, notForGuests as K, needsConfirmation as L, chatChannel as Lt, promotionTarget as M, CHAT_HEADER as Mt, CONFIRMATION_TTL_MS as N, PARTICIPANTS_ATTRIBUTE as Nt, OntologyToolRejected as O, readableRuntimeEnvelope as Ot, actionApproval as P, RUNTIME_SOURCE_ATTRIBUTE as Pt, GUEST_ROLE as Q, ACT_AS_HEADER as R, chatHeaders as Rt, fetchStoredAttachment as S, reportTelegramError as St, ontologyConnection as T, RUNTIME_SOURCE_PROTOCOL as Tt, isGuestSession as U, workspaceIdentityProvider as Ut, actorKey as V, participantsOf as Vt, member as W, GUEST_CONFIRMATIONS_ATTRIBUTE as X, CHANNEL_GUEST_AUTHENTICATOR as Y, GUEST_ID_ATTRIBUTE as Z, AttachmentError as _, customerCopy as _t, rolesOf as a, WEB_PROVIDER as at, agentAttachments as b, failureText as bt, currentInboundRequest as c, guestPrincipal as ct, prepareInboundMedia as d, webGrantOf as dt, KIND_ATTRIBUTE as et, attachmentsContext as f, webMemberOf as ft, ATTACHMENT_URL_PROTOCOL as g, currentThreadId as gt, ATTACHMENT_TTL_HOURS as h, currentLocale as ht, memberIdOf as i, WEB_GRANT_ATTRIBUTE as it, ontologyTools as j, CHAT_ATTRIBUTE as jt, actionToolName as k, runtimeEnvelope as kt, runInboundRequest as l, ontologyIntrospection as lt, turnContent as m, TelegramDeliveryError as mt, chatLanguage as n, TurnLimitedError as nt, telegramPrincipal as o, guestConfirms as ot, storeFiles as p, webPrincipal as pt, ACCESS_TOKEN_PREFIX as q, identityProviderOf as r, WEB_AUTHENTICATOR as rt, InboundRequest as s, guestIdOf as st, TELEGRAM_AUTHENTICATOR as t, TURN_LIMITED_CODE as tt, withReplacedText as u, webAuth as ut, EARLIER_CHAT_HEADER as v, customerMessage as vt, actAsHeaders as w, withDeliveryLocale as wt, attachmentUrl as x, formattingRefused as xt, MAXIMUM_ATTACHMENT_BYTES as y, customerText as yt, ActorRequiredError as z, chatRuntimeSource 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 { confirmationLocale } from "../extension/lib/telegram/confirmation-text.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { It as chatAddressOf, St as reportTelegramError, bt as failureText, ht as currentLocale, i as memberIdOf, mt as TelegramDeliveryError, vt as customerMessage } from "./principal-DIQHp6AG.mjs";
|
|
9
9
|
import { splitTelegramText } from "../extension/lib/telegram/format.mjs";
|
|
10
10
|
import { inTelegramSendQueue } from "../extension/lib/telegram/send-queue.mjs";
|
|
11
11
|
import { redactDiagnostic } from "../extension/lib/diagnostics.mjs";
|
|
@@ -2,7 +2,6 @@ import { type GroupPolicyInput } from "@segmentstream/ontology/groups";
|
|
|
2
2
|
import { type GroupPolicy } from "./lib/group-routing/policy.js";
|
|
3
3
|
import { type QuoteSettings } from "./lib/email/quote-settings.js";
|
|
4
4
|
import { type StructuredInbound } from "./lib/telegram/structured-settings.js";
|
|
5
|
-
import type { PublicGroupKnowledge } from "./lib/public-group-knowledge.js";
|
|
6
5
|
import type { WorkspaceActionHook } from "./lib/workspace-action.js";
|
|
7
6
|
import { type TelegramTexts } from "./lib/telegram/texts.js";
|
|
8
7
|
import { type IdentifierPolicy } from "./lib/customer-text-safety.js";
|
|
@@ -76,18 +75,7 @@ export interface FirstContactSettings {
|
|
|
76
75
|
}
|
|
77
76
|
export declare const ADMISSION_REPLY_KEYS: readonly ["pairingRequired", "pairingButton", "groupPairingButton", "limited", "perSenderLimited", "workspaceLimited", "registrationsLimited", "groupPairingRequired", "refused"];
|
|
78
77
|
export type AdmissionReplies = Partial<Record<(typeof ADMISSION_REPLY_KEYS)[number], LocalizedText>>;
|
|
79
|
-
export interface PublicGroupSettings {
|
|
80
|
-
/** Trusted workspace responder. Its action is bound and authorized by the ontology. */
|
|
81
|
-
readonly respond?: (context: import("./lib/public-group.js").PublicGroupResponseContext) => Promise<string | undefined>;
|
|
82
|
-
readonly knowledge?: PublicGroupKnowledge;
|
|
83
|
-
readonly model: string;
|
|
84
|
-
/** Workspace-published material for an isolated, text-only answer. */
|
|
85
|
-
readonly instructions: string;
|
|
86
|
-
/** Dedicated group connections which may be opened by an authorized inviter. */
|
|
87
|
-
readonly trustedJoinChannels?: readonly string[];
|
|
88
|
-
}
|
|
89
78
|
export interface AdmissionSettings {
|
|
90
|
-
readonly publicGroups?: PublicGroupSettings;
|
|
91
79
|
readonly personas?: PersonaSettings;
|
|
92
80
|
readonly firstContact: FirstContactSettings | null;
|
|
93
81
|
readonly limits: AdmissionLimits;
|
|
@@ -100,7 +88,6 @@ export interface AdmissionSettings {
|
|
|
100
88
|
* the values validation allows.
|
|
101
89
|
*/
|
|
102
90
|
export interface SegmentStreamAgentConfigInput {
|
|
103
|
-
readonly publicGroups?: PublicGroupSettings;
|
|
104
91
|
readonly groups?: GroupPolicyInput;
|
|
105
92
|
readonly texts?: TelegramTexts;
|
|
106
93
|
readonly firstContact?: FirstContactSettings;
|
|
@@ -1147,7 +1147,6 @@ function validateConfig(input, options = {}) {
|
|
|
1147
1147
|
"sessions",
|
|
1148
1148
|
"confirmations",
|
|
1149
1149
|
"firstContact",
|
|
1150
|
-
"publicGroups",
|
|
1151
1150
|
"limits",
|
|
1152
1151
|
"replies",
|
|
1153
1152
|
"texts",
|
|
@@ -1293,60 +1292,6 @@ function validateConfig(input, options = {}) {
|
|
|
1293
1292
|
const sessions = sessionSettings(root?.sessions, issues);
|
|
1294
1293
|
const firstContact = firstContactSettings(root?.firstContact, issues, !legacyArchive);
|
|
1295
1294
|
const limits = admissionLimits(root?.limits, issues);
|
|
1296
|
-
const publicGroupInput = section({
|
|
1297
|
-
value: root?.publicGroups,
|
|
1298
|
-
path: ["publicGroups"],
|
|
1299
|
-
allowed: [
|
|
1300
|
-
"model",
|
|
1301
|
-
"instructions",
|
|
1302
|
-
"trustedJoinChannels",
|
|
1303
|
-
"knowledge",
|
|
1304
|
-
"respond"
|
|
1305
|
-
],
|
|
1306
|
-
issues
|
|
1307
|
-
});
|
|
1308
|
-
let publicGroups;
|
|
1309
|
-
if (publicGroupInput) {
|
|
1310
|
-
const { model, instructions, trustedJoinChannels, respond } = publicGroupInput;
|
|
1311
|
-
const knowledge = section({
|
|
1312
|
-
value: publicGroupInput.knowledge,
|
|
1313
|
-
path: ["publicGroups", "knowledge"],
|
|
1314
|
-
allowed: [
|
|
1315
|
-
"connection",
|
|
1316
|
-
"lookup",
|
|
1317
|
-
"unavailable"
|
|
1318
|
-
],
|
|
1319
|
-
issues
|
|
1320
|
-
});
|
|
1321
|
-
let source;
|
|
1322
|
-
if (knowledge) {
|
|
1323
|
-
const unavailable = localizedText(knowledge.unavailable, [
|
|
1324
|
-
"publicGroups",
|
|
1325
|
-
"knowledge",
|
|
1326
|
-
"unavailable"
|
|
1327
|
-
], issues, 1e3);
|
|
1328
|
-
if (typeof knowledge.connection !== "string" || !CONNECTION_KEY.test(knowledge.connection) || knowledge.lookup !== void 0 && typeof knowledge.lookup !== "function") issues.push({
|
|
1329
|
-
path: ["publicGroups", "knowledge"],
|
|
1330
|
-
message: "Supply a workspace connection and bind a lookup function in the agent mount."
|
|
1331
|
-
});
|
|
1332
|
-
else source = {
|
|
1333
|
-
connection: knowledge.connection,
|
|
1334
|
-
unavailable,
|
|
1335
|
-
...knowledge.lookup && { lookup: knowledge.lookup }
|
|
1336
|
-
};
|
|
1337
|
-
}
|
|
1338
|
-
if (typeof model !== "string" || !model.trim() || model.length > 256 || typeof instructions !== "string" || !instructions.trim() || instructions.length > 32e3 || respond !== void 0 && typeof respond !== "function" || trustedJoinChannels !== void 0 && (!Array.isArray(trustedJoinChannels) || !trustedJoinChannels.every((channel) => typeof channel === "string" && Object.hasOwn(channels ?? {}, channel)))) issues.push({
|
|
1339
|
-
path: ["publicGroups"],
|
|
1340
|
-
message: "Supply a model, public instructions and optional configured channel names."
|
|
1341
|
-
});
|
|
1342
|
-
else publicGroups = {
|
|
1343
|
-
...source && { knowledge: source },
|
|
1344
|
-
...typeof respond === "function" && { respond },
|
|
1345
|
-
model,
|
|
1346
|
-
instructions,
|
|
1347
|
-
...trustedJoinChannels ? { trustedJoinChannels } : {}
|
|
1348
|
-
};
|
|
1349
|
-
}
|
|
1350
1295
|
const replies = admissionReplies(root?.replies, issues, !legacyArchive);
|
|
1351
1296
|
const texts = telegramTexts(root?.texts, issues);
|
|
1352
1297
|
if (!legacyArchive && replies.groupPairingButton !== void 0 && replies.groupPairingRequired === void 0) issues.push({
|
|
@@ -1464,7 +1409,6 @@ function validateConfig(input, options = {}) {
|
|
|
1464
1409
|
...browser === null ? {} : { browser },
|
|
1465
1410
|
sessions,
|
|
1466
1411
|
firstContact,
|
|
1467
|
-
...publicGroups ? { publicGroups } : {},
|
|
1468
1412
|
limits,
|
|
1469
1413
|
replies,
|
|
1470
1414
|
texts,
|
|
@@ -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-
|
|
8
|
+
import { T as ontologyConnection } from "../../_chunks/principal-DIQHp6AG.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;
|
|
@@ -61,5 +61,3 @@ export { replayRouterPayload } from "./lib/group-routing/replay.js";
|
|
|
61
61
|
export { chatAddressing as groupChatAddressing } from "./lib/group-routing/addressing.js";
|
|
62
62
|
export { routingBurst } from "./lib/group-routing/burst.js";
|
|
63
63
|
export type { TelegramTexts } from "./lib/telegram/texts.js";
|
|
64
|
-
export type { PublicGroupResponseContext } from "./lib/public-group.js";
|
|
65
|
-
export type { PublicGroupKnowledge, PublicGroupKnowledgeContext, } from "./lib/public-group-knowledge.js";
|
|
@@ -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-
|
|
10
|
+
import "../../_chunks/principal-DIQHp6AG.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-
|
|
8
|
+
import { a as rolesOf } from "../../_chunks/principal-DIQHp6AG.mjs";
|
|
9
9
|
import { resolveChatPersona } from "../lib/chat-persona.mjs";
|
|
10
10
|
import { personaFor } from "../personas.mjs";
|
|
11
11
|
import { defineDynamic, defineInstructions } from "eve/instructions";
|
|
@@ -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-
|
|
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-DIQHp6AG.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 {
|
|
7
|
+
import { It as chatAddressOf, Lt as chatChannel, b as agentAttachments, i as memberIdOf } from "../../_chunks/principal-DIQHp6AG.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,8 +5,8 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { channelOf } from "../config.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import "../../_chunks/silent-
|
|
8
|
+
import { It as chatAddressOf, Lt as chatChannel } from "../../_chunks/principal-DIQHp6AG.mjs";
|
|
9
|
+
import "../../_chunks/silent-CWcAjHwt.mjs";
|
|
10
10
|
import { sendEmailAttachments } from "./email/attachments-send.mjs";
|
|
11
11
|
import { replyCopies } from "./email/channel.mjs";
|
|
12
12
|
import { sendSlackAttachments } from "./slack/attachments-send.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 {
|
|
8
|
+
import { It as chatAddressOf, _ as AttachmentError, bt as failureText } from "../../_chunks/principal-DIQHp6AG.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,
|
|
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, Ft as SESSION_HEADER, b as agentAttachments, x as attachmentUrl, S as fetchStoredAttachment, C as parseAttachmentUrl } from "../../_chunks/principal-DIQHp6AG.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-
|
|
7
|
+
export { t as agentBuild } from "../../_chunks/build-metadata-BkLo_nGS.mjs";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AgentIdentities } from "./identities.js";
|
|
2
|
+
import type { SessionAuthContext } from "eve/context";
|
|
3
|
+
import type { AdmissionSettings } from "../config.js";
|
|
4
|
+
import { type ChatAddress } from "./chat-address.js";
|
|
5
|
+
/** Called after member resolution required pairing, with the sender from the verified delivery. */
|
|
6
|
+
export declare function admitChannelGuest(identities: AgentIdentities, settings: AdmissionSettings, address: ChatAddress & {
|
|
7
|
+
peer: string;
|
|
8
|
+
}, notify: (text: string) => Promise<unknown>, { locale, purpose, message }?: {
|
|
9
|
+
locale?: string;
|
|
10
|
+
purpose?: "identify";
|
|
11
|
+
message?: string;
|
|
12
|
+
}): Promise<SessionAuthContext | null | undefined>;
|
|
13
|
+
/** Model and tool history is private to this sender and their current roles. */
|
|
14
|
+
export declare function senderSession(id: string, roles: readonly string[]): string;
|
|
15
|
+
export declare function guestSession(principal: SessionAuthContext): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { fileURLToPath as __eveFileURLToPath } from "node:url";
|
|
2
|
+
import { dirname as __eveDirname } from "node:path";
|
|
3
|
+
import { createRequire as __eveCreateRequire } from "node:module";
|
|
4
|
+
const __filename = __eveFileURLToPath(import.meta.url);
|
|
5
|
+
__eveDirname(__filename);
|
|
6
|
+
__eveCreateRequire(import.meta.url);
|
|
7
|
+
import { localizedText } from "./admission.mjs";
|
|
8
|
+
import { Ht as withChatAddress, Y as CHANNEL_GUEST_AUTHENTICATOR, Z as GUEST_ID_ATTRIBUTE, et as KIND_ATTRIBUTE } from "../../_chunks/principal-DIQHp6AG.mjs";
|
|
9
|
+
import { personaPrincipal } from "./chat-persona.mjs";
|
|
10
|
+
import { agentToolsAttribute } from "./agent-tools.mjs";
|
|
11
|
+
import { createHash } from "node:crypto";
|
|
12
|
+
async function admitChannelGuest(identities, settings, address, notify, { locale, purpose, message } = {}) {
|
|
13
|
+
const channel = address.channel ?? address.provider;
|
|
14
|
+
const result = await identities.admitGuest?.({
|
|
15
|
+
channel,
|
|
16
|
+
chat: address.chatId,
|
|
17
|
+
sender: address.peer,
|
|
18
|
+
...message && { message },
|
|
19
|
+
...purpose && { purpose },
|
|
20
|
+
limits: settings.limits
|
|
21
|
+
});
|
|
22
|
+
if (!result || result.status === "closed") return;
|
|
23
|
+
if (result?.status === "limited") {
|
|
24
|
+
const text = localizedText(settings.replies.limited, locale);
|
|
25
|
+
if (text) await notify(text);
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
if (result?.status !== "guest" || typeof result.guestId !== "string" || !Array.isArray(result.roles) || !Array.isArray(result.agentTools)) throw new Error("Invalid guest admission.");
|
|
29
|
+
const { channel: named, ...base } = address;
|
|
30
|
+
const auth = withChatAddress({
|
|
31
|
+
authenticator: CHANNEL_GUEST_AUTHENTICATOR,
|
|
32
|
+
principalId: `guest:${result.guestId}`,
|
|
33
|
+
principalType: "user",
|
|
34
|
+
subject: `guest:${result.guestId}`,
|
|
35
|
+
attributes: {
|
|
36
|
+
[KIND_ATTRIBUTE]: "guest",
|
|
37
|
+
...result.confirmations && { ["guestConfirmations"]: "true" },
|
|
38
|
+
[GUEST_ID_ATTRIBUTE]: result.guestId,
|
|
39
|
+
identityProvider: address.provider,
|
|
40
|
+
roles: result.roles,
|
|
41
|
+
...agentToolsAttribute(result.agentTools),
|
|
42
|
+
...locale && { locale }
|
|
43
|
+
}
|
|
44
|
+
}, named === address.provider ? base : address);
|
|
45
|
+
return personaPrincipal(settings.personas, auth);
|
|
46
|
+
}
|
|
47
|
+
function senderSession(id, roles) {
|
|
48
|
+
return createHash("sha256").update(JSON.stringify([id, [...roles].sort()])).digest("hex").slice(0, 32);
|
|
49
|
+
}
|
|
50
|
+
function guestSession(principal) {
|
|
51
|
+
const roles = principal.attributes.roles;
|
|
52
|
+
return `guest-${senderSession(principal.principalId, Array.isArray(roles) ? roles : [])}`;
|
|
53
|
+
}
|
|
54
|
+
export { admitChannelGuest, guestSession, senderSession };
|
|
@@ -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 {
|
|
7
|
+
export { jt as CHAT_ATTRIBUTE, Mt as CHAT_HEADER, Nt as PARTICIPANTS_ATTRIBUTE, Pt as RUNTIME_SOURCE_ATTRIBUTE, Ft as SESSION_HEADER, It as chatAddressOf, Lt as chatChannel, Rt as chatHeaders, zt as chatRuntimeSource, Bt as isSameChat, Vt as participantsOf, Ht as withChatAddress, Ut as workspaceIdentityProvider } from "../../_chunks/principal-DIQHp6AG.mjs";
|
|
@@ -8,7 +8,7 @@ import { agentTaskIdOf } from "./agent-task.mjs";
|
|
|
8
8
|
import { chatCoordinates, sessionKind } from "./chat-recorder.mjs";
|
|
9
9
|
import { h as topicContext, i as chatAuthor, n as archiveSequence, p as storeOf, r as chatArchive, s as collapseChatEvents } from "../../_chunks/chat-archive-_IBU0CXG.mjs";
|
|
10
10
|
import { TELEGRAM_SOURCE_MARKER, telegramMessageKey } from "./telegram/message-reference.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { St as reportTelegramError } from "../../_chunks/principal-DIQHp6AG.mjs";
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
13
13
|
import { deliveries, runs, turns } from "eve/events";
|
|
14
14
|
import { defineState } from "eve/context";
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { chatPersona } from "../personas.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { It as chatAddressOf, Lt as chatChannel, i as memberIdOf, st as guestIdOf } from "../../_chunks/principal-DIQHp6AG.mjs";
|
|
9
9
|
import { appOrigin, ontologyDeploymentHeaders } from "./environment.mjs";
|
|
10
10
|
import { localizedText } from "./admission.mjs";
|
|
11
11
|
import { runtimeToken } from "./runtime-token.mjs";
|
|
@@ -9,10 +9,10 @@ import { n as contentText, t as CONTENT_CAPS } from "../../_chunks/content-cDtVn
|
|
|
9
9
|
import { a as chatEvent, f as sessionFailureEventId, m as summarizeArguments, p as storeOf, r as chatArchive } from "../../_chunks/chat-archive-_IBU0CXG.mjs";
|
|
10
10
|
import { agentTaskIdOf } from "./agent-task.mjs";
|
|
11
11
|
import { revisionOf } from "./review/revision.mjs";
|
|
12
|
-
import {
|
|
12
|
+
import { It as chatAddressOf, Lt as chatChannel, Vt as participantsOf, i as memberIdOf, st as guestIdOf } from "../../_chunks/principal-DIQHp6AG.mjs";
|
|
13
13
|
import { keyChannel, principalChannel } from "./channel-scope.mjs";
|
|
14
14
|
import { parseAddress } from "./telegram/sessions.mjs";
|
|
15
|
-
import { n as completionKind } from "../../_chunks/silent-
|
|
15
|
+
import { n as completionKind } from "../../_chunks/silent-CWcAjHwt.mjs";
|
|
16
16
|
import { recordModelServiceAlert } from "./model-service-alert.mjs";
|
|
17
17
|
import { call, deliveries } from "eve/events";
|
|
18
18
|
function isTelegram(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 { N as CONFIRMATION_TTL_MS, P as actionApproval, F as confirmations, I as inputHash, L as needsConfirmation } from "../../_chunks/principal-
|
|
7
|
+
export { N as CONFIRMATION_TTL_MS, P as actionApproval, F as confirmations, I as inputHash, L as needsConfirmation } from "../../_chunks/principal-DIQHp6AG.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-
|
|
7
|
+
import { _ as AttachmentError } from "../../../_chunks/principal-DIQHp6AG.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 { CHANNEL_NAME, PUBSUB_TOPIC } from "../../config.mjs";
|
|
|
8
8
|
import { admitMessage, localizedText, reportUnadmittedChat } from "../admission.mjs";
|
|
9
9
|
import { agentToolsAttribute } from "../agent-tools.mjs";
|
|
10
10
|
import { providerChat } from "../attachment-tools.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { Ht as withChatAddress, It as chatAddressOf, Nt as PARTICIPANTS_ATTRIBUTE, S as fetchStoredAttachment, Vt as participantsOf, b as agentAttachments, d as prepareInboundMedia, i as memberIdOf, m as turnContent } from "../../../_chunks/principal-DIQHp6AG.mjs";
|
|
12
12
|
import { channelAttributes, currentChannel, currentKey, inChannel, inHandlerChannels, withNamedRoutes } from "../channel-scope.mjs";
|
|
13
13
|
import { a as chatEvent, b as messageInput, d as replyRecipients, g as UNVERIFIED, l as replyEvent, p as storeOf, r as chatArchive, t as AGENT_SENDER } from "../../../_chunks/chat-archive-_IBU0CXG.mjs";
|
|
14
14
|
import { ChatStoreError } from "../chat-store.mjs";
|
|
@@ -21,7 +21,7 @@ import { gatewayMediaCapabilities, turnMediaPlan } from "../inbound-media/plan.m
|
|
|
21
21
|
import { gatewayImageDescriber } from "../inbound-media/images.mjs";
|
|
22
22
|
import { gatewayTranscriber } from "../inbound-media/speech.mjs";
|
|
23
23
|
import { channelReview } from "../review/reply.mjs";
|
|
24
|
-
import { g as turnFiles, n as completionKind } from "../../../_chunks/silent-
|
|
24
|
+
import { g as turnFiles, n as completionKind } from "../../../_chunks/silent-CWcAjHwt.mjs";
|
|
25
25
|
import { runtimeTokenVerifier } from "../runtime-identity.mjs";
|
|
26
26
|
import { runtimeToken } from "../runtime-token.mjs";
|
|
27
27
|
import { runtimeRequestFailure } from "../telegram/runtime-request.mjs";
|
|
@@ -6,7 +6,7 @@ __eveDirname(__filename);
|
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { appOrigin, ontologyDeploymentHeaders } from "./environment.mjs";
|
|
8
8
|
import { runtimeToken } from "./runtime-token.mjs";
|
|
9
|
-
import {
|
|
9
|
+
import { st as guestIdOf } from "../../_chunks/principal-DIQHp6AG.mjs";
|
|
10
10
|
const GUEST_USAGE_PATH = "/api/ontology/agent/guests/usage";
|
|
11
11
|
const REPORT_TIMEOUT_MS = 5e3;
|
|
12
12
|
function ontologyGuestUsage(options = {}) {
|
|
@@ -38,6 +38,7 @@ export type IdentityResolution = (({
|
|
|
38
38
|
}) & {
|
|
39
39
|
readonly member: PairedMember;
|
|
40
40
|
readonly provisioned: boolean;
|
|
41
|
+
readonly separateSession?: true;
|
|
41
42
|
/**
|
|
42
43
|
* Whether the ontology counts the person's turns against its limits; absent from an ontology
|
|
43
44
|
* released before it said so.
|
|
@@ -114,6 +115,27 @@ export interface ChatHandoff {
|
|
|
114
115
|
readonly handled?: true;
|
|
115
116
|
}
|
|
116
117
|
export interface AgentIdentities {
|
|
118
|
+
admitGuest?(input: {
|
|
119
|
+
message?: string;
|
|
120
|
+
purpose?: "identify";
|
|
121
|
+
channel: string;
|
|
122
|
+
chat: string;
|
|
123
|
+
sender: string;
|
|
124
|
+
limits?: AdmissionLimitsInput;
|
|
125
|
+
}): Promise<{
|
|
126
|
+
status: "closed" | "limited";
|
|
127
|
+
} | {
|
|
128
|
+
status: "guest";
|
|
129
|
+
guestId: string;
|
|
130
|
+
roles: string[];
|
|
131
|
+
agentTools: string[];
|
|
132
|
+
confirmations?: true;
|
|
133
|
+
}>;
|
|
134
|
+
reportInvite?(input: {
|
|
135
|
+
provider: string;
|
|
136
|
+
key: string;
|
|
137
|
+
inviter: string;
|
|
138
|
+
}): Promise<void>;
|
|
117
139
|
lookup(account: ChatAccount): Promise<IdentityLookup>;
|
|
118
140
|
/** Server-owned admission; only an older server's route 404 falls back to GET lookup. */
|
|
119
141
|
resolve(input: ResolveIdentityInput): Promise<IdentityResolution>;
|