@segmentstream/agent 0.79.0 → 0.80.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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/_chunks/{build-metadata-BrWGOlRd.mjs → build-metadata-BuTCjnNS.mjs} +1 -1
- package/dist/_chunks/{chat-archive-BEk40gWe.mjs → chat-archive-BBd_iZ1d.mjs} +1 -1
- package/dist/_chunks/{principal-C7aAjyt4.mjs → principal-CVV9C_nO.mjs} +8 -1
- package/dist/extension/config.d.ts +8 -0
- package/dist/extension/config.mjs +14 -3
- package/dist/extension/connections/ontology.mjs +1 -1
- 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/admission.d.ts +7 -0
- package/dist/extension/lib/admission.mjs +8 -6
- package/dist/extension/lib/attachment-tools.mjs +1 -1
- 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/chat-address.d.ts +11 -0
- package/dist/extension/lib/chat-address.mjs +1 -1
- package/dist/extension/lib/chat-context.d.ts +7 -0
- package/dist/extension/lib/chat-context.mjs +1 -1
- package/dist/extension/lib/chat-messages.d.ts +9 -1
- package/dist/extension/lib/chat-messages.mjs +4 -4
- package/dist/extension/lib/chat-recorder.d.ts +12 -4
- package/dist/extension/lib/chat-recorder.mjs +2 -2
- package/dist/extension/lib/chat-store.d.ts +6 -0
- package/dist/extension/lib/confirmations.mjs +1 -1
- package/dist/extension/lib/email/attachments-send.mjs +1 -1
- package/dist/extension/lib/email/channel.d.ts +19 -5
- package/dist/extension/lib/email/channel.mjs +209 -22
- package/dist/extension/lib/email/gmail.d.ts +5 -0
- package/dist/extension/lib/email/gmail.mjs +11 -0
- package/dist/extension/lib/guest-usage.mjs +1 -1
- package/dist/extension/lib/identities.d.ts +2 -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-tools.mjs +1 -1
- package/dist/extension/lib/review/client.mjs +24 -12
- package/dist/extension/lib/review/hold.d.ts +7 -0
- package/dist/extension/lib/review/hold.mjs +3 -1
- package/dist/extension/lib/review/reply.mjs +1 -1
- 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.mjs +1 -1
- package/dist/extension/lib/slack/attachments-send.mjs +1 -1
- package/dist/extension/lib/slack/callbacks.mjs +1 -1
- package/dist/extension/lib/stored-files.mjs +1 -1
- package/dist/extension/lib/telegram/adapter.mjs +3 -3
- 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.mjs +1 -1
- 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.mjs +1 -1
- package/dist/extension/lib/telegram/inbound.mjs +2 -2
- package/dist/extension/lib/telegram/lifecycle.mjs +2 -2
- package/dist/extension/lib/telegram/principal.mjs +1 -1
- package/dist/extension/lib/telegram/session-recovery.mjs +1 -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/web/auth.mjs +1 -1
- package/dist/extension/lib/web/channel.mjs +1 -1
- package/dist/extension/lib/whatsapp/adapter.mjs +1 -1
- 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 +1 -1
- 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 +1 -1
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.80.1
|
|
4
|
+
|
|
5
|
+
Pins @segmentstream/ontology 0.156.0.
|
|
6
|
+
|
|
7
|
+
## 0.80.0
|
|
8
|
+
|
|
9
|
+
An email thread can be one chat. `"chats": "thread"` on an email channel makes each Gmail thread one chat and one session of the agent, whoever writes in it; `"sender"`, the default, keeps each person's own chat in a thread, as before. Admission stays the sender's: each turn acts as the person who wrote. Each message, and the reply to it, is read by the members it went to, its sender and the members among its `To` and `Cc`, so a person dropped from `Cc` reads none of the thread's later mail. Each admitted person joins the thread's chat in the inbox, which is named after the thread's subject; with `"record": "all"`, any mail the channel records in a thread, even mail the agent does not take from or to members, brings its chat into the inbox where `inbox.channels` lists the channel, and makes no one its member. A reply held for review in a thread's chat is read, once approved, by the same members as a reply the agent sends itself. A new thread chat reads its history from Gmail once, the thread's last 20 messages before it, as imported history. Chats a thread had per person stay, and replies waiting or held there are still sent. A thread's chat replies to all; `"reply": "sender"` is refused with it. Staff answer a thread's chat in Gmail: the inbox's `postMessage` and `send` refuse it. While staff hold a thread's chat, taken over, the agent answers no one in the thread, whatever their role.
|
|
10
|
+
|
|
11
|
+
`POST /api/ontology/agent/chats/seen` takes `shared: true` for a private chat several people share: the member joins its members and none leaves; a member whose roles the inbox does not take joins none, and is answered whether staff hold the chat where it is recorded already. `POST /api/ontology/agent/chats/messages` takes `imported: true` for history a channel read from its provider, never for a send. `POST /api/ontology/agent/reviews` takes `participants`, at most 50 user ids of the members who read a reply in a private chat several people share; `agent_review` keeps them in its new `participants` property, a redraft keeps them, and the approved reply is recorded as read by its `person` and them. An agent on this release whose ontology SDK predates `participants` holds the reply for its person alone.
|
|
12
|
+
|
|
13
|
+
Pins @segmentstream/ontology 0.155.0.
|
|
14
|
+
|
|
3
15
|
## 0.79.0
|
|
4
16
|
|
|
5
17
|
An email channel can reply to all: with `"reply": "all"` in `agent/segmentstream.json`, a reply goes to the person who wrote, in `To`, and copies the other addresses of the `To` and `Cc` of the mail it answers, without the mailbox's own address; files `segmentstream__attachments_send` sends go to the same people. `"sender"`, the default, replies to the person alone, as before. Each state of a reply names whom it goes to in its channel state, so a reply a later wake sends goes to the same people.
|
package/README.md
CHANGED
|
@@ -285,7 +285,7 @@ continue using GET lookup. Starter templates and pins remain unchanged in this s
|
|
|
285
285
|
| `segmentstream__telegram` | `channels` | `POST /eve/v1/telegram`: Telegram through the connection, with pairing, routing and voice. |
|
|
286
286
|
| `segmentstream__tasks` | `channels` | `POST /eve/segmentstream/v1/tasks`: a workflow's `agentTask`, run as the workflow's user; see [Workflow tasks](#workflow-tasks). |
|
|
287
287
|
| `segmentstream__revisions` | `channels` | `POST /eve/segmentstream/v1/reviews/revise`: a held reply a member sent back, redrafted in a session of its own that acts as the person, reading only, and reported as a new held reply. |
|
|
288
|
-
| `segmentstream__email` | `channels` | `POST /eve/segmentstream/v1/email`: the `GmailConnection` mailbox in `channels.email`, which SegmentStream wakes;
|
|
288
|
+
| `segmentstream__email` | `channels` | `POST /eve/segmentstream/v1/email`: the `GmailConnection` mailbox in `channels.email`, which SegmentStream wakes; a Gmail thread is a chat per person, or one chat (`chats`). |
|
|
289
289
|
| `segmentstream__attachments_list`, `_read`, `_promote`, `_discard` | `tools` | The member's temporary attachments in this chat: list, read, keep through an action, drop. |
|
|
290
290
|
| `segmentstream__attachments_send` | `tools` | Sends readable stored ontology files into the current Telegram, Slack, WhatsApp or email chat. |
|
|
291
291
|
| `segmentstream__no_reply` | `tools` | Eve's `no_reply`: ends the turn without a message and keeps the model's reason in the session and the archive. |
|
|
@@ -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.80.1";
|
|
8
8
|
function agentBuild(environment = process.env) {
|
|
9
9
|
return {
|
|
10
10
|
agent: version,
|
|
@@ -10,7 +10,7 @@ import { n as contentText, t as CONTENT_CAPS } from "./content-cDtVnr8Y.mjs";
|
|
|
10
10
|
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-DavfKJDI.mjs";
|
|
11
11
|
import { applyChatChange } from "../extension/lib/chat-messages.mjs";
|
|
12
12
|
import { ChatStoreError } from "../extension/lib/chat-store.mjs";
|
|
13
|
-
import { c as currentInboundRequest, ht as currentThreadId, xt as reportTelegramError } from "./principal-
|
|
13
|
+
import { c as currentInboundRequest, ht as currentThreadId, xt as reportTelegramError } from "./principal-CVV9C_nO.mjs";
|
|
14
14
|
import { telegramReaction } from "../extension/lib/telegram/reactions.mjs";
|
|
15
15
|
import { currentConfirmationPrompt } from "../extension/lib/group-routing/messages.mjs";
|
|
16
16
|
import { messageMetadata } from "../extension/lib/telegram/message-metadata.mjs";
|
|
@@ -39,6 +39,13 @@ const SESSION_HEADER = "X-SegmentStream-Agent-Session";
|
|
|
39
39
|
const CHAT_ATTRIBUTE = "segmentstreamChat";
|
|
40
40
|
const EARLIER_CHAT_ATTRIBUTE = "segmentstreamConversation";
|
|
41
41
|
const RUNTIME_SOURCE_ATTRIBUTE = "segmentstreamRuntimeSource";
|
|
42
|
+
const PARTICIPANTS_ATTRIBUTE = "segmentstreamParticipants";
|
|
43
|
+
function participantsOf(principal) {
|
|
44
|
+
const named = principal?.attributes[PARTICIPANTS_ATTRIBUTE];
|
|
45
|
+
const memberId = principal?.attributes.memberId;
|
|
46
|
+
if (!Array.isArray(named)) return;
|
|
47
|
+
return [...new Set([...typeof memberId === "string" && memberId !== "" ? [memberId] : [], ...named])];
|
|
48
|
+
}
|
|
42
49
|
function chatRuntimeSource(chat, message = {}) {
|
|
43
50
|
if (chat.provider !== "slack" && chat.provider !== "whatsapp") return;
|
|
44
51
|
return {
|
|
@@ -2058,4 +2065,4 @@ function identityProviderOf(principal) {
|
|
|
2058
2065
|
const provider = principal?.attributes.identityProvider;
|
|
2059
2066
|
return typeof provider === "string" && provider !== "" ? provider : void 0;
|
|
2060
2067
|
}
|
|
2061
|
-
export { KIND_ATTRIBUTE as $, ontologyToolLabels as A, CHAT_ATTRIBUTE as At, actorHeaders as B,
|
|
2068
|
+
export { KIND_ATTRIBUTE as $, ontologyToolLabels as A, CHAT_ATTRIBUTE as At, actorHeaders as B, participantsOf as Bt, parseAttachmentUrl as C, withDeliveryLocale as Ct, OntologyFileUnavailable as D, readableRuntimeEnvelope as Dt, OntologyActionNotPermitted as E, principalRuntimeSource as Et, confirmations as F, chatAddressOf as Ft, memberTool as G, actorOf as H, workspaceIdentityProvider as Ht, inputHash as I, chatChannel as It, AGENT_GRANT_HEADER as J, notForGuests as K, needsConfirmation as L, chatHeaders as Lt, promotionTarget as M, PARTICIPANTS_ATTRIBUTE as Mt, CONFIRMATION_TTL_MS as N, RUNTIME_SOURCE_ATTRIBUTE as Nt, OntologyToolRejected as O, runtimeEnvelope as Ot, actionApproval as P, SESSION_HEADER as Pt, INTROSPECTION_PATH as Q, ACT_AS_HEADER as R, chatRuntimeSource as Rt, fetchStoredAttachment as S, safeTelegramFetch as St, ontologyConnection as T, compatibleRuntimeEnvelope as Tt, isGuestSession as U, actorKey as V, withChatAddress as Vt, 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, isSameChat as zt };
|
|
@@ -323,6 +323,12 @@ export interface EmailChannelInput {
|
|
|
323
323
|
* `To` and the other people of the mail it answers in `Cc`, as a reply to all.
|
|
324
324
|
*/
|
|
325
325
|
readonly reply?: "all" | "sender";
|
|
326
|
+
/**
|
|
327
|
+
* What a chat is: `sender`, when absent, each person's own chat in a Gmail thread; or `thread`,
|
|
328
|
+
* the thread, one chat and one session for everyone who writes in it, whose replies go to all
|
|
329
|
+
* (`reply` cannot be `sender` with it).
|
|
330
|
+
*/
|
|
331
|
+
readonly chats?: "sender" | "thread";
|
|
326
332
|
}
|
|
327
333
|
/**
|
|
328
334
|
* A channel the workspace defines in its own code, `defineChannel` in `agent/agent/channels/`,
|
|
@@ -635,6 +641,8 @@ export interface EmailSettings {
|
|
|
635
641
|
readonly recordQuery?: string;
|
|
636
642
|
/** `all` when the agent's replies go to all the people of the mail; absent, to the person alone. */
|
|
637
643
|
readonly reply?: "all";
|
|
644
|
+
/** `thread` when a Gmail thread is one chat; absent, each person has their own in it. */
|
|
645
|
+
readonly chats?: "thread";
|
|
638
646
|
}
|
|
639
647
|
/**
|
|
640
648
|
* A channel the workspace defines in its own code (`defineChannel`): the connection its code calls
|
|
@@ -424,7 +424,8 @@ function emailSettings(value, issues, path = ["channels", "email"]) {
|
|
|
424
424
|
"push",
|
|
425
425
|
"record",
|
|
426
426
|
"recordQuery",
|
|
427
|
-
"reply"
|
|
427
|
+
"reply",
|
|
428
|
+
"chats"
|
|
428
429
|
],
|
|
429
430
|
issues
|
|
430
431
|
});
|
|
@@ -471,11 +472,20 @@ function emailSettings(value, issues, path = ["channels", "email"]) {
|
|
|
471
472
|
message: "must be a Gmail search of at most 1000 characters",
|
|
472
473
|
path: [...path, "recordQuery"]
|
|
473
474
|
});
|
|
474
|
-
const
|
|
475
|
+
const chats = email.chats ?? "sender";
|
|
476
|
+
const reply = email.reply ?? (chats === "thread" ? "all" : "sender");
|
|
475
477
|
if (reply !== "all" && reply !== "sender") issues.push({
|
|
476
478
|
message: "must be \"all\" or \"sender\"",
|
|
477
479
|
path: [...path, "reply"]
|
|
478
480
|
});
|
|
481
|
+
if (chats !== "sender" && chats !== "thread") issues.push({
|
|
482
|
+
message: "must be \"sender\" or \"thread\"",
|
|
483
|
+
path: [...path, "chats"]
|
|
484
|
+
});
|
|
485
|
+
else if (chats === "thread" && reply === "sender") issues.push({
|
|
486
|
+
message: "needs reply \"all\": a thread's chat is everyone's in it",
|
|
487
|
+
path: [...path, "chats"]
|
|
488
|
+
});
|
|
479
489
|
if (issues.length > before) return null;
|
|
480
490
|
return {
|
|
481
491
|
connection: email.connection,
|
|
@@ -486,7 +496,8 @@ function emailSettings(value, issues, path = ["channels", "email"]) {
|
|
|
486
496
|
record: "all",
|
|
487
497
|
...email.recordQuery === void 0 ? {} : { recordQuery: email.recordQuery.trim() }
|
|
488
498
|
} : {},
|
|
489
|
-
...reply === "all" ? { reply: "all" } : {}
|
|
499
|
+
...reply === "all" ? { reply: "all" } : {},
|
|
500
|
+
...chats === "thread" ? { chats: "thread" } : {}
|
|
490
501
|
};
|
|
491
502
|
}
|
|
492
503
|
function telegramSettings(value, issues, path = ["channels", "telegram"]) {
|
|
@@ -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-CVV9C_nO.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-
|
|
10
|
+
import "../../_chunks/principal-CVV9C_nO.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-CVV9C_nO.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-
|
|
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-CVV9C_nO.mjs";
|
|
@@ -10,6 +10,13 @@ export interface AdmittedChat {
|
|
|
10
10
|
readonly threadId?: string;
|
|
11
11
|
/** Whom a reply is sent to, where it differs from the chat's id. */
|
|
12
12
|
readonly recipient?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A chat several people write in, such as an email thread: each admitted person joins its
|
|
15
|
+
* members, and none leaves. An ontology service released before it refuses the report.
|
|
16
|
+
*/
|
|
17
|
+
readonly shared?: true;
|
|
18
|
+
/** The chat's name, such as an email thread's subject; else the person's name. */
|
|
19
|
+
readonly title?: string;
|
|
13
20
|
}
|
|
14
21
|
/**
|
|
15
22
|
* Reports the private chat of someone the channel recorded without admitting them, such as mail
|
|
@@ -43,14 +43,15 @@ async function reportInboxChat(input) {
|
|
|
43
43
|
return await input.identities.seenChat({
|
|
44
44
|
provider: chat.channel,
|
|
45
45
|
externalId: chat.chatId,
|
|
46
|
-
title: (identity.display?.trim() || identity.externalId).slice(0, 200),
|
|
46
|
+
title: (chat.title?.trim() || identity.display?.trim() || identity.externalId).slice(0, 200),
|
|
47
47
|
...input.memberId === void 0 ? {} : { memberId: input.memberId },
|
|
48
48
|
kind: "private",
|
|
49
49
|
...chat.recipient === void 0 || chat.recipient === chat.chatId ? {} : { recipient: chat.recipient },
|
|
50
|
-
...chat.threadId === void 0 || chat.threadId === "" ? {} : { threadId: chat.threadId }
|
|
50
|
+
...chat.threadId === void 0 || chat.threadId === "" ? {} : { threadId: chat.threadId },
|
|
51
|
+
...chat.shared === true ? { shared: true } : {}
|
|
51
52
|
});
|
|
52
53
|
} catch (error) {
|
|
53
|
-
if (input.memberId === void 0 && error instanceof AgentIdentityError && error.status === 404) return;
|
|
54
|
+
if ((input.memberId === void 0 || chat.shared === true) && error instanceof AgentIdentityError && error.status === 404) return;
|
|
54
55
|
inboxReports.delete(key);
|
|
55
56
|
input.failed?.(error);
|
|
56
57
|
return;
|
|
@@ -88,16 +89,17 @@ async function admitMessage(input) {
|
|
|
88
89
|
} catch (error) {
|
|
89
90
|
input.noticeFailed(error);
|
|
90
91
|
}
|
|
91
|
-
|
|
92
|
+
const shared = input.chat?.shared === true;
|
|
93
|
+
if ((resolved.status === "existing" || resolved.status === "created") && (resolved.inbox === true || shared) && input.identity.chat === "private" && input.chat !== void 0) {
|
|
92
94
|
const reported = await reportInboxChat({
|
|
93
95
|
identity: input.identity,
|
|
94
96
|
identities: input.identities,
|
|
95
97
|
chat: input.chat,
|
|
96
98
|
memberId: resolved.member.id,
|
|
97
|
-
every: resolved.takeover === true,
|
|
99
|
+
every: resolved.takeover === true || shared,
|
|
98
100
|
failed: input.inboxFailed ?? ((error) => console.error("[segmentstream] inbox chat report failed", error))
|
|
99
101
|
});
|
|
100
|
-
if (resolved.takeover === true && reported?.handled === true) return {
|
|
102
|
+
if ((resolved.takeover === true || shared) && reported?.handled === true) return {
|
|
101
103
|
...resolved,
|
|
102
104
|
handled: true
|
|
103
105
|
};
|
|
@@ -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 { Ft as
|
|
7
|
+
import { Ft as chatAddressOf, It as chatChannel, b as agentAttachments, i as memberIdOf } from "../../_chunks/principal-CVV9C_nO.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 {
|
|
8
|
+
import { Ft as chatAddressOf, _ as AttachmentError, yt as failureText } from "../../_chunks/principal-CVV9C_nO.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, jt as CHAT_HEADER, v as EARLIER_CHAT_HEADER, y as MAXIMUM_ATTACHMENT_BYTES,
|
|
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, Pt as SESSION_HEADER, b as agentAttachments, x as attachmentUrl, S as fetchStoredAttachment, C as parseAttachmentUrl } from "../../_chunks/principal-CVV9C_nO.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-BuTCjnNS.mjs";
|
|
@@ -33,6 +33,17 @@ export declare const SESSION_HEADER = "X-SegmentStream-Agent-Session";
|
|
|
33
33
|
export declare const CHAT_ATTRIBUTE = "segmentstreamChat";
|
|
34
34
|
/** The session attribute that carries, as JSON, the runtime source of the message a turn answers. */
|
|
35
35
|
export declare const RUNTIME_SOURCE_ATTRIBUTE = "segmentstreamRuntimeSource";
|
|
36
|
+
/**
|
|
37
|
+
* The session attribute that names, by user id, the members who read the message a turn answers,
|
|
38
|
+
* and the replies to it, in a private chat several people share, such as an email thread: the
|
|
39
|
+
* chat's readers are named row by row. Absent, a private chat's message is its member's.
|
|
40
|
+
*/
|
|
41
|
+
export declare const PARTICIPANTS_ATTRIBUTE = "segmentstreamParticipants";
|
|
42
|
+
/**
|
|
43
|
+
* The members who read the message `principal`'s turn answers, its own member among them, where
|
|
44
|
+
* the channel names them; undefined for a chat whose messages are its one member's.
|
|
45
|
+
*/
|
|
46
|
+
export declare function participantsOf(principal: SessionAuthContext | null | undefined): ReadonlyArray<string> | undefined;
|
|
36
47
|
/** The message a channel's turn answers, beside its chat: its id and the account that wrote it. */
|
|
37
48
|
export interface ChatMessage {
|
|
38
49
|
readonly id?: string;
|
|
@@ -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 { At as CHAT_ATTRIBUTE, jt as CHAT_HEADER, Mt as
|
|
7
|
+
export { At as CHAT_ATTRIBUTE, jt as CHAT_HEADER, Mt as PARTICIPANTS_ATTRIBUTE, Nt as RUNTIME_SOURCE_ATTRIBUTE, Pt as SESSION_HEADER, Ft as chatAddressOf, It as chatChannel, Lt as chatHeaders, Rt as chatRuntimeSource, zt as isSameChat, Bt as participantsOf, Vt as withChatAddress, Ht as workspaceIdentityProvider } from "../../_chunks/principal-CVV9C_nO.mjs";
|
|
@@ -131,6 +131,13 @@ export declare function chatOf(context: {
|
|
|
131
131
|
};
|
|
132
132
|
readonly channel: HookContext["channel"];
|
|
133
133
|
}): {
|
|
134
|
+
provider: string;
|
|
135
|
+
chatId: string;
|
|
136
|
+
chatType: "private";
|
|
137
|
+
threadId: string | null;
|
|
138
|
+
participantIds: readonly string[];
|
|
139
|
+
senderId: string | null;
|
|
140
|
+
} | {
|
|
134
141
|
provider: string;
|
|
135
142
|
chatId: string;
|
|
136
143
|
chatType: "private" | "group" | "channel";
|
|
@@ -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 { h as topicContext, i as chatAuthor, n as archiveSequence, p as storeOf, r as chatArchive, s as collapseChatEvents } from "../../_chunks/chat-archive-DavfKJDI.mjs";
|
|
10
|
-
import { xt as reportTelegramError } from "../../_chunks/principal-
|
|
10
|
+
import { xt as reportTelegramError } from "../../_chunks/principal-CVV9C_nO.mjs";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import { deliveries, runs, turns } from "eve/events";
|
|
13
13
|
import { defineState } from "eve/context";
|
|
@@ -167,7 +167,13 @@ export interface RecordOptions {
|
|
|
167
167
|
* none of is recorded too, without members, in the workspace chat store. A message the archive
|
|
168
168
|
* holds by its provider id is skipped.
|
|
169
169
|
*/
|
|
170
|
-
export declare function recordSentOutside(archive: ChatArchive, message: Omit<RecordedMessage, "participantIds" | "direction"
|
|
170
|
+
export declare function recordSentOutside(archive: ChatArchive, message: Omit<RecordedMessage, "participantIds" | "direction"> & {
|
|
171
|
+
/**
|
|
172
|
+
* The members who read it, in a chat several people share, such as an email thread; by
|
|
173
|
+
* default those of the chat's latest message.
|
|
174
|
+
*/
|
|
175
|
+
readonly participantIds?: ReadonlyArray<string>;
|
|
176
|
+
}, options?: RecordOptions): Promise<SentOutsideOutcome>;
|
|
171
177
|
/**
|
|
172
178
|
* Records a person's message the agent cannot read, such as a contact card on a channel that
|
|
173
179
|
* reads only text and files, in the chat the agent has with them, by the same rule as
|
|
@@ -211,6 +217,8 @@ export declare function recordUnadmittedMessage(archive: ChatArchive, message: U
|
|
|
211
217
|
export declare function recordHandledMessage(archive: ChatArchive, input: {
|
|
212
218
|
readonly chat: AdmittedChat;
|
|
213
219
|
readonly memberId: string;
|
|
220
|
+
/** The members who read it, in a chat several people share; by default its person. */
|
|
221
|
+
readonly participantIds?: ReadonlyArray<string>;
|
|
214
222
|
/** The person's account at the provider. */
|
|
215
223
|
readonly senderId: string | null;
|
|
216
224
|
readonly senderName?: string | null;
|
|
@@ -209,7 +209,7 @@ async function recordInChat(archive, message, options) {
|
|
|
209
209
|
if (options.record !== "all" || await storeOf(archive) === void 0) return "no_chat";
|
|
210
210
|
await recordChatMessage(archive, {
|
|
211
211
|
...message,
|
|
212
|
-
participantIds: []
|
|
212
|
+
participantIds: message.participantIds ?? []
|
|
213
213
|
});
|
|
214
214
|
return "recorded";
|
|
215
215
|
}
|
|
@@ -221,7 +221,7 @@ async function recordInChat(archive, message, options) {
|
|
|
221
221
|
if (known !== void 0) return "known";
|
|
222
222
|
await recordChatMessage(archive, {
|
|
223
223
|
...message,
|
|
224
|
-
participantIds: latest.participantIds
|
|
224
|
+
participantIds: message.participantIds ?? latest.participantIds
|
|
225
225
|
});
|
|
226
226
|
return "recorded";
|
|
227
227
|
}
|
|
@@ -263,7 +263,7 @@ async function recordHandledMessage(archive, input) {
|
|
|
263
263
|
provider: chat.channel,
|
|
264
264
|
chatId: chat.chatId,
|
|
265
265
|
threadId: chat.threadId ?? null,
|
|
266
|
-
participantIds: [input.memberId],
|
|
266
|
+
participantIds: input.participantIds ?? [input.memberId],
|
|
267
267
|
eventId,
|
|
268
268
|
direction: "inbound",
|
|
269
269
|
by: "human",
|
|
@@ -294,7 +294,7 @@ async function recordHandledMessage(archive, input) {
|
|
|
294
294
|
chatId: chat.chatId,
|
|
295
295
|
chatType: "private",
|
|
296
296
|
threadId: chat.threadId === void 0 || chat.threadId === "" ? null : chat.threadId,
|
|
297
|
-
participantIds: [input.memberId],
|
|
297
|
+
participantIds: input.participantIds ?? [input.memberId],
|
|
298
298
|
senderId: input.senderId,
|
|
299
299
|
messageId: input.messageId,
|
|
300
300
|
kind: "decision",
|
|
@@ -22,9 +22,10 @@ export declare function sessionKind(context: {
|
|
|
22
22
|
/**
|
|
23
23
|
* A member's chat, kept under the chat its channel stamped, by the channel's name: the same
|
|
24
24
|
* coordinates its replies, attachments, reviews and inbox use. An email chat is one Gmail thread
|
|
25
|
-
* with one person,
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* with one person, or of everyone in it, each message read by the members the principal names, a
|
|
26
|
+
* WhatsApp chat one person's thread, a Slack direct message one chat whatever thread a message is
|
|
27
|
+
* in, a thread in a Slack channel the chat of everyone in it, and a workspace channel's chat one
|
|
28
|
+
* person's. Undefined for Telegram, which keys its chats from its updates, a
|
|
28
29
|
* web chat, and a session without a member.
|
|
29
30
|
*/
|
|
30
31
|
export declare function stampedChat(principal: SessionAuthContext | null | undefined): {
|
|
@@ -39,7 +40,7 @@ export declare function stampedChat(principal: SessionAuthContext | null | undef
|
|
|
39
40
|
chatId: string;
|
|
40
41
|
chatType: "private";
|
|
41
42
|
threadId: string | null;
|
|
42
|
-
participantIds: string[];
|
|
43
|
+
participantIds: readonly string[];
|
|
43
44
|
senderId: string | null;
|
|
44
45
|
} | undefined;
|
|
45
46
|
export declare function chatCoordinates(context: {
|
|
@@ -48,6 +49,13 @@ export declare function chatCoordinates(context: {
|
|
|
48
49
|
};
|
|
49
50
|
readonly channel: RuntimeContext["channel"];
|
|
50
51
|
}): {
|
|
52
|
+
provider: string;
|
|
53
|
+
chatId: string;
|
|
54
|
+
chatType: "private";
|
|
55
|
+
threadId: string | null;
|
|
56
|
+
participantIds: readonly string[];
|
|
57
|
+
senderId: string | null;
|
|
58
|
+
} | {
|
|
51
59
|
provider: string;
|
|
52
60
|
chatId: string;
|
|
53
61
|
chatType: "private" | "group" | "channel";
|
|
@@ -8,7 +8,7 @@ import { n as contentText, t as CONTENT_CAPS } from "../../_chunks/content-cDtVn
|
|
|
8
8
|
import { a as chatEvent, f as sessionFailureEventId, m as summarizeArguments, p as storeOf, r as chatArchive } from "../../_chunks/chat-archive-DavfKJDI.mjs";
|
|
9
9
|
import { agentTaskIdOf } from "./agent-task.mjs";
|
|
10
10
|
import { revisionOf } from "./review/revision.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { Bt as participantsOf, Ft as chatAddressOf, It as chatChannel, i as memberIdOf, ot as guestIdOf } from "../../_chunks/principal-CVV9C_nO.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";
|
|
@@ -37,7 +37,7 @@ function stampedChat(principal) {
|
|
|
37
37
|
chatId: chat.chatId,
|
|
38
38
|
chatType: "private",
|
|
39
39
|
threadId: chat.provider === "slack" || chat.threadId === "" ? null : chat.threadId,
|
|
40
|
-
participantIds: [memberId],
|
|
40
|
+
participantIds: participantsOf(principal) ?? [memberId],
|
|
41
41
|
senderId: chat.peer ?? null
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -110,6 +110,12 @@ export interface MessageInput {
|
|
|
110
110
|
readonly sessionId?: string;
|
|
111
111
|
readonly turnId?: string;
|
|
112
112
|
readonly meta?: unknown;
|
|
113
|
+
/**
|
|
114
|
+
* History a channel read from its provider, from before it recorded the chat, such as a Gmail
|
|
115
|
+
* thread's earlier mail: no session reads it as new. Never a send. An ontology service released
|
|
116
|
+
* before it refuses it.
|
|
117
|
+
*/
|
|
118
|
+
readonly imported?: true;
|
|
113
119
|
}
|
|
114
120
|
interface Target {
|
|
115
121
|
readonly channel: string;
|
|
@@ -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-CVV9C_nO.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-CVV9C_nO.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";
|
|
@@ -19,9 +19,10 @@ import { type Gmail } from "./gmail.js";
|
|
|
19
19
|
* when Gmail pushes a change and at least every `checkAfterMinutes`, signing the request with the
|
|
20
20
|
* project's agent webhook secret. A wake carries the cursor the last one answered; the channel
|
|
21
21
|
* reads what the mailbox received since, starts a turn per message in the person's thread, and
|
|
22
|
-
* answers the next cursor. One Gmail thread is one chat with
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* answers the next cursor. One Gmail thread is one chat with each person who writes in it, or,
|
|
23
|
+
* with `chats: "thread"`, one chat and one session of everyone in it, each message read by the
|
|
24
|
+
* members it went to. The reply leaves in the same thread, to the person and, as a reply to all, the
|
|
25
|
+
* other people of the mail it answers, or waits for a member when the person's review holds it.
|
|
25
26
|
*
|
|
26
27
|
* A reply is an operation of the chat archive, `requested` before it is sent, then `sent` or
|
|
27
28
|
* `failed`. One Gmail does not take for a while waits there, out of the 16 KiB cursor, and each
|
|
@@ -79,6 +80,11 @@ export interface EmailChannelOptions {
|
|
|
79
80
|
* write in the same thread have a chat and a session each.
|
|
80
81
|
*/
|
|
81
82
|
export declare function emailChatId(threadId: string, sender: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* The chat a message of `sender` in a Gmail thread is in: the thread itself where the channel keeps
|
|
85
|
+
* one chat per thread (`chats: "thread"`), else the sender's own chat in it.
|
|
86
|
+
*/
|
|
87
|
+
export declare function emailChatOf(settings: Pick<EmailSettings, "chats"> | null | undefined, threadId: string, sender: string): string;
|
|
82
88
|
/**
|
|
83
89
|
* The principal's attribute that names the other people of the mail a turn answers, `To` and `Cc`
|
|
84
90
|
* without the sender and the mailbox: a reply to all copies them.
|
|
@@ -92,9 +98,17 @@ export declare const EMAIL_OTHERS_ATTRIBUTE = "segmentstreamEmailOthers";
|
|
|
92
98
|
export declare function replyCopies(principal: SessionAuthContext | null | undefined, settings: Pick<EmailSettings, "reply"> | null | undefined): ReadonlyArray<string>;
|
|
93
99
|
/**
|
|
94
100
|
* The principal of an email session: the member who writes from the address, on the email channel
|
|
95
|
-
* the current wake runs for, with the other people of the mail it answers.
|
|
101
|
+
* the current wake runs for, with the other people of the mail it answers. In a thread's chat it
|
|
102
|
+
* names the chat and the members who read the mail.
|
|
96
103
|
*/
|
|
97
|
-
export declare function emailPrincipal(member: PairedMember, sender: string, threadId: string,
|
|
104
|
+
export declare function emailPrincipal(member: PairedMember, sender: string, threadId: string, options?: {
|
|
105
|
+
/** The other people of the mail the turn answers, whom a reply to all copies. */
|
|
106
|
+
readonly others?: ReadonlyArray<string>;
|
|
107
|
+
/** The chat: the sender's own in the thread when absent. */
|
|
108
|
+
readonly chatId?: string;
|
|
109
|
+
/** The members who read the mail and the replies to it, in a chat several people share. */
|
|
110
|
+
readonly participants?: ReadonlyArray<string>;
|
|
111
|
+
}): SessionAuthContext;
|
|
98
112
|
/** The email channel of the extension. */
|
|
99
113
|
export declare function segmentstreamEmail(options: EmailChannelOptions): Channel;
|
|
100
114
|
/** The email channel's route and events, which {@link segmentstreamEmail} defines as a channel. */
|