@segmentstream/agent 0.83.1 → 0.86.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 +34 -0
- package/README.md +31 -16
- package/dist/_chunks/{build-metadata-DLgMHYWG.mjs → build-metadata-CKp7rmO0.mjs} +1 -1
- package/dist/_chunks/{chat-archive-D4HRgOSo.mjs → chat-archive-By3MnPEC.mjs} +1 -1
- package/dist/_chunks/{principal-dEQyjF1n.mjs → principal-C1g8wCIg.mjs} +12 -3
- package/dist/_chunks/silent-C9x3GcMg.mjs +262 -0
- package/dist/extension/channels/email.mjs +3 -1
- package/dist/extension/channels/slack.mjs +3 -1
- package/dist/extension/channels/telegram.mjs +3 -1
- package/dist/extension/channels/whatsapp.mjs +3 -1
- 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/agent-task.mjs +2 -1
- package/dist/extension/lib/attachment-tools.mjs +1 -1
- package/dist/extension/lib/attachments-dispatch.d.ts +23 -0
- package/dist/extension/lib/attachments-dispatch.mjs +79 -0
- 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.mjs +1 -1
- package/dist/extension/lib/chat-context.mjs +1 -1
- package/dist/extension/lib/chat-recorder.mjs +2 -2
- package/dist/extension/lib/chat-store.mjs +3 -1
- 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 +2 -0
- package/dist/extension/lib/email/channel.mjs +40 -6
- package/dist/extension/lib/environment.d.ts +16 -1
- package/dist/extension/lib/environment.mjs +12 -2
- package/dist/extension/lib/evals.d.ts +3 -1
- package/dist/extension/lib/evals.mjs +3 -1
- package/dist/extension/lib/guest-usage.mjs +3 -2
- package/dist/extension/lib/identities.mjs +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-recall.mjs +1 -1
- package/dist/extension/lib/ontology-tools.mjs +1 -1
- package/dist/extension/lib/review/client.mjs +8 -0
- package/dist/extension/lib/review/files.d.ts +101 -0
- package/dist/extension/lib/review/files.mjs +7 -0
- package/dist/extension/lib/review/hold.d.ts +7 -0
- package/dist/extension/lib/review/hold.mjs +2 -1
- package/dist/extension/lib/review/judge.d.ts +2 -0
- package/dist/extension/lib/review/judge.mjs +1 -0
- package/dist/extension/lib/review/reply.d.ts +66 -0
- package/dist/extension/lib/review/reply.mjs +91 -9
- package/dist/extension/lib/review/revision.mjs +2 -0
- 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 +3 -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 +11 -6
- 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/routing-context.mjs +1 -1
- package/dist/extension/lib/telegram/session-recovery.mjs +1 -1
- package/dist/extension/lib/telegram/silent.mjs +1 -84
- 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.d.ts +13 -3
- 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 +2 -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.d.ts +1 -1
- package/dist/extension/lib/workspace-channel/attachments-send.mjs +3 -1
- package/dist/extension/lib/workspace-channel/channel.mjs +24 -5
- 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 +18 -38
- 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
|
@@ -0,0 +1,79 @@
|
|
|
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 { channelOf } from "../config.mjs";
|
|
8
|
+
import { Ft as chatAddressOf, It as chatChannel } from "../../_chunks/principal-C1g8wCIg.mjs";
|
|
9
|
+
import "../../_chunks/silent-C9x3GcMg.mjs";
|
|
10
|
+
import { sendEmailAttachments } from "./email/attachments-send.mjs";
|
|
11
|
+
import { replyCopies } from "./email/channel.mjs";
|
|
12
|
+
import { sendSlackAttachments } from "./slack/attachments-send.mjs";
|
|
13
|
+
import { sendAttachments } from "./telegram/attachments-send.mjs";
|
|
14
|
+
import { sendWhatsAppAttachments } from "./whatsapp/attachments-send.mjs";
|
|
15
|
+
import { sendChannelAttachments } from "./workspace-channel/attachments-send.mjs";
|
|
16
|
+
async function sendStoredFiles(input) {
|
|
17
|
+
const { channels, principal } = input;
|
|
18
|
+
const chat = chatAddressOf(principal);
|
|
19
|
+
const provider = chat?.provider;
|
|
20
|
+
const name = chat === void 0 ? "telegram" : chatChannel(chat);
|
|
21
|
+
const options = {
|
|
22
|
+
input: input.files,
|
|
23
|
+
principal,
|
|
24
|
+
sessionId: input.sessionId
|
|
25
|
+
};
|
|
26
|
+
if (provider === "slack") return sendSlackAttachments({
|
|
27
|
+
...options,
|
|
28
|
+
connection: channelOf(channels, "slack", name)?.connection
|
|
29
|
+
});
|
|
30
|
+
if (provider === "email") return sendEmailAttachments({
|
|
31
|
+
...options,
|
|
32
|
+
callId: input.callId,
|
|
33
|
+
connection: channelOf(channels, "email", name)?.connection,
|
|
34
|
+
cc: replyCopies(principal, channelOf(channels, "email", name))
|
|
35
|
+
});
|
|
36
|
+
if (provider === "whatsapp") return sendWhatsAppAttachments({
|
|
37
|
+
...options,
|
|
38
|
+
turnId: input.turnId,
|
|
39
|
+
connection: channelOf(channels, "whatsapp", name)?.connection
|
|
40
|
+
});
|
|
41
|
+
if (provider === "custom") return sendChannelAttachments({
|
|
42
|
+
...options,
|
|
43
|
+
connection: channelOf(channels, "custom", name)?.connection
|
|
44
|
+
});
|
|
45
|
+
const telegram = channelOf(channels, "telegram", name);
|
|
46
|
+
return sendAttachments({
|
|
47
|
+
...options,
|
|
48
|
+
connection: telegram?.connection,
|
|
49
|
+
appLinks: telegram,
|
|
50
|
+
identifiers: telegram?.identifiers ?? "block"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function replyFilesSender(channels) {
|
|
54
|
+
return async (input) => {
|
|
55
|
+
const caption = input.files.captions.join("\n\n");
|
|
56
|
+
const result = await sendStoredFiles({
|
|
57
|
+
channels: channels(),
|
|
58
|
+
files: {
|
|
59
|
+
documentIds: input.files.files.map((file) => ({
|
|
60
|
+
entity: file.entity,
|
|
61
|
+
id: file.id,
|
|
62
|
+
property: file.property
|
|
63
|
+
})),
|
|
64
|
+
...caption === "" || caption.length > 1024 ? {} : { caption }
|
|
65
|
+
},
|
|
66
|
+
principal: input.principal ?? null,
|
|
67
|
+
sessionId: input.sessionId,
|
|
68
|
+
turnId: input.turnId,
|
|
69
|
+
callId: `${input.partId}:files`
|
|
70
|
+
});
|
|
71
|
+
const files = result.files;
|
|
72
|
+
if (typeof result.error === "string" || files?.some((file) => file.error !== void 0) === true) console.error("[segmentstream] a passed reply's files were not all sent", {
|
|
73
|
+
sessionId: input.sessionId,
|
|
74
|
+
result
|
|
75
|
+
});
|
|
76
|
+
return result;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export { replyFilesSender, sendStoredFiles };
|
|
@@ -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 { Ft as chatAddressOf, _ as AttachmentError, yt as failureText } from "../../_chunks/principal-
|
|
8
|
+
import { Ft as chatAddressOf, _ as AttachmentError, yt as failureText } from "../../_chunks/principal-C1g8wCIg.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, Pt as SESSION_HEADER, b as agentAttachments, x as attachmentUrl, S as fetchStoredAttachment, C as parseAttachmentUrl } from "../../_chunks/principal-
|
|
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-C1g8wCIg.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-CKp7rmO0.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 { 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-
|
|
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-C1g8wCIg.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 { 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-C1g8wCIg.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,10 +8,10 @@ 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 { Bt as participantsOf, Ft as chatAddressOf, It as chatChannel, i as memberIdOf, ot as guestIdOf } from "../../_chunks/principal-
|
|
11
|
+
import { Bt as participantsOf, Ft as chatAddressOf, It as chatChannel, i as memberIdOf, ot as guestIdOf } from "../../_chunks/principal-C1g8wCIg.mjs";
|
|
12
12
|
import { keyChannel, principalChannel } from "./channel-scope.mjs";
|
|
13
13
|
import { parseAddress } from "./telegram/sessions.mjs";
|
|
14
|
-
import { completionKind } from "
|
|
14
|
+
import { n as completionKind } from "../../_chunks/silent-C9x3GcMg.mjs";
|
|
15
15
|
import { recordModelServiceAlert } from "./model-service-alert.mjs";
|
|
16
16
|
import { call, deliveries } from "eve/events";
|
|
17
17
|
function isTelegram(context) {
|
|
@@ -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 { AgentEnvironmentError, appOrigin } from "./environment.mjs";
|
|
7
|
+
import { AgentEnvironmentError, appOrigin, ontologyDeploymentHeaders } from "./environment.mjs";
|
|
8
8
|
import { runtimeToken } from "./runtime-token.mjs";
|
|
9
9
|
import { r as workflowValue } from "../../_chunks/workflow-serializable-gzv5MZ5P.mjs";
|
|
10
10
|
var ChatStoreError = class extends Error {
|
|
@@ -48,6 +48,7 @@ function chatStore(input = {}) {
|
|
|
48
48
|
redirect: "error",
|
|
49
49
|
headers: {
|
|
50
50
|
authorization: `Bearer ${await token()}`,
|
|
51
|
+
...ontologyDeploymentHeaders(),
|
|
51
52
|
accept: "application/json",
|
|
52
53
|
"content-type": "application/json"
|
|
53
54
|
},
|
|
@@ -86,6 +87,7 @@ async function storeAvailable(input) {
|
|
|
86
87
|
redirect: "error",
|
|
87
88
|
headers: {
|
|
88
89
|
authorization: `Bearer ${await input.token()}`,
|
|
90
|
+
...ontologyDeploymentHeaders(),
|
|
89
91
|
accept: "application/json",
|
|
90
92
|
"content-type": "application/json"
|
|
91
93
|
},
|
|
@@ -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-C1g8wCIg.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-C1g8wCIg.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";
|
|
@@ -57,6 +57,8 @@ export interface EmailChannelOptions {
|
|
|
57
57
|
/** Tests pass an archive and a hold in place of the ontology's. */
|
|
58
58
|
readonly archive?: ChatArchive;
|
|
59
59
|
readonly hold?: Parameters<typeof channelReview>[0]["hold"];
|
|
60
|
+
/** Sends a passed reply's files; without it such a reply is held. */
|
|
61
|
+
readonly sendFiles?: Parameters<typeof channelReview>[0]["sendFiles"];
|
|
60
62
|
};
|
|
61
63
|
readonly environment?: Environment;
|
|
62
64
|
readonly token?: RuntimeToken;
|
|
@@ -8,7 +8,7 @@ import { 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 { Bt as participantsOf, Ft as chatAddressOf, Mt as PARTICIPANTS_ATTRIBUTE, S as fetchStoredAttachment, Vt as withChatAddress, b as agentAttachments, d as prepareInboundMedia, i as memberIdOf, m as turnContent } from "../../../_chunks/principal-
|
|
11
|
+
import { Bt as participantsOf, Ft as chatAddressOf, Mt as PARTICIPANTS_ATTRIBUTE, S as fetchStoredAttachment, Vt as withChatAddress, b as agentAttachments, d as prepareInboundMedia, i as memberIdOf, m as turnContent } from "../../../_chunks/principal-C1g8wCIg.mjs";
|
|
12
12
|
import { channelAttributes, currentChannel, currentKey, 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-DavfKJDI.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 { completionKind } from "
|
|
24
|
+
import { g as turnFiles, n as completionKind } from "../../../_chunks/silent-C9x3GcMg.mjs";
|
|
25
25
|
import { runtimeToken } from "../runtime-token.mjs";
|
|
26
26
|
import { GMAIL_ID, GmailError, gmail, replyKeyOf } from "./gmail.mjs";
|
|
27
27
|
import { inboundMail, parseMail, sentMail } from "./message.mjs";
|
|
@@ -231,7 +231,8 @@ function emailChannelDefinition(options) {
|
|
|
231
231
|
decide: options.review.decide,
|
|
232
232
|
model: options.review.model,
|
|
233
233
|
...options.review.archive === void 0 ? {} : { archive: options.review.archive },
|
|
234
|
-
...options.review.hold === void 0 ? {} : { hold: options.review.hold }
|
|
234
|
+
...options.review.hold === void 0 ? {} : { hold: options.review.hold },
|
|
235
|
+
...options.review.sendFiles === void 0 ? {} : { sendFiles: options.review.sendFiles }
|
|
235
236
|
}, {
|
|
236
237
|
environment,
|
|
237
238
|
...transport
|
|
@@ -947,9 +948,22 @@ function emailChannelDefinition(options) {
|
|
|
947
948
|
const chat = chatAddressOf(principal);
|
|
948
949
|
if (outcome !== "completed" || chat?.provider !== "email" || chat.peer === void 0) return;
|
|
949
950
|
const text = replyText(ctx.view, turnId);
|
|
950
|
-
if (completionKind(text) !== "reply") return;
|
|
951
951
|
const cc = replyCopies(principal, settings());
|
|
952
952
|
const reviewing = review()?.review;
|
|
953
|
+
const files = reviewing === void 0 ? void 0 : turnFiles(ctx.view, turnId);
|
|
954
|
+
if (completionKind(text) !== "reply") {
|
|
955
|
+
if (files !== void 0 && files.files.length > 0 && reviewing.reviewed(principal)) await reviewing.holdFiles({
|
|
956
|
+
principal,
|
|
957
|
+
sessionId: ctx.session.id,
|
|
958
|
+
turnId,
|
|
959
|
+
files,
|
|
960
|
+
recipients: {
|
|
961
|
+
to: [chat.peer],
|
|
962
|
+
cc
|
|
963
|
+
}
|
|
964
|
+
});
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
953
967
|
if (!(reviewing === void 0 ? true : await reviewing.sendOrHold({
|
|
954
968
|
principal,
|
|
955
969
|
sessionId: ctx.session.id,
|
|
@@ -959,7 +973,8 @@ function emailChannelDefinition(options) {
|
|
|
959
973
|
recipients: {
|
|
960
974
|
to: [chat.peer],
|
|
961
975
|
cc
|
|
962
|
-
}
|
|
976
|
+
},
|
|
977
|
+
...files === void 0 || files.files.length === 0 ? {} : { files }
|
|
963
978
|
}))) return;
|
|
964
979
|
const memberId = memberIdOf(principal);
|
|
965
980
|
const participantIds = participantsOf(principal) ?? (memberId === void 0 ? [] : [memberId]);
|
|
@@ -976,7 +991,26 @@ function emailChannelDefinition(options) {
|
|
|
976
991
|
at: new Date(now()).toISOString()
|
|
977
992
|
};
|
|
978
993
|
await record(reply, "requested");
|
|
979
|
-
await send(reply, REPLY_ATTEMPTS);
|
|
994
|
+
const sent = await send(reply, REPLY_ATTEMPTS);
|
|
995
|
+
if (files !== void 0 && files.files.length > 0) {
|
|
996
|
+
if (sent === "sent") await reviewing.sendFiles({
|
|
997
|
+
principal,
|
|
998
|
+
sessionId: ctx.session.id,
|
|
999
|
+
turnId,
|
|
1000
|
+
partId: turnId,
|
|
1001
|
+
files
|
|
1002
|
+
});
|
|
1003
|
+
else await reviewing.holdFiles({
|
|
1004
|
+
principal,
|
|
1005
|
+
sessionId: ctx.session.id,
|
|
1006
|
+
turnId,
|
|
1007
|
+
files,
|
|
1008
|
+
recipients: {
|
|
1009
|
+
to: [chat.peer],
|
|
1010
|
+
cc
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
980
1014
|
} });
|
|
981
1015
|
return {
|
|
982
1016
|
routes: withNamedRoutes("email", [POST(EMAIL_ROUTE, wake)], (name) => {
|
|
@@ -7,10 +7,25 @@ export type Environment = Readonly<Record<string, string | undefined>>;
|
|
|
7
7
|
export declare class AgentEnvironmentError extends Error {
|
|
8
8
|
readonly name = "AgentEnvironmentError";
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* The header the agent of an app preview names its deployment in, on every request to the
|
|
12
|
+
* preview's ontology: the preview's function tokens name no deployment, and every preview of a
|
|
13
|
+
* workspace shares one hosting project, so the ontology refuses a runtime token without it.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ONTOLOGY_DEPLOYMENT_HEADER = "x-segmentstream-ontology-deployment-id";
|
|
16
|
+
/**
|
|
17
|
+
* The app preview this agent runs in, as the platform says (`SEGMENTSTREAM_DEPLOYMENT_TARGET` is
|
|
18
|
+
* `preview`, with its deployment in `SEGMENTSTREAM_ONTOLOGY_DEPLOYMENT_ID`); `undefined` anywhere
|
|
19
|
+
* else, production included.
|
|
20
|
+
*/
|
|
21
|
+
export declare function previewDeployment(environment?: Environment): string | undefined;
|
|
22
|
+
/** The headers every runtime request to the ontology carries: in a preview, its deployment. */
|
|
23
|
+
export declare function ontologyDeploymentHeaders(environment?: Environment): Record<string, string>;
|
|
10
24
|
/**
|
|
11
25
|
* Where the workspace app answers: the ontology service's `/mcp` and `/api/ontology/*`, and the
|
|
12
26
|
* app's `/agent/connect` page. `SEGMENTSTREAM_AGENT_ONTOLOGY_URL` overrides it in local
|
|
13
|
-
* development;
|
|
27
|
+
* development; an app preview uses its own deployment (`VERCEL_URL`), whose ontology was built
|
|
28
|
+
* from the same commit, and production its production domain.
|
|
14
29
|
*/
|
|
15
30
|
export declare function appOrigin(environment?: Environment): string;
|
|
16
31
|
/** What the connection proxy needs: backend-next's URL and the tenant it selects. */
|
|
@@ -17,6 +17,15 @@ function withoutTrailingSlashes(url) {
|
|
|
17
17
|
while (end > 0 && url[end - 1] === "/") end -= 1;
|
|
18
18
|
return url.slice(0, end);
|
|
19
19
|
}
|
|
20
|
+
const ONTOLOGY_DEPLOYMENT_HEADER = "x-segmentstream-ontology-deployment-id";
|
|
21
|
+
function previewDeployment(environment = process.env) {
|
|
22
|
+
const deploymentId = environment.SEGMENTSTREAM_ONTOLOGY_DEPLOYMENT_ID?.trim();
|
|
23
|
+
return environment.SEGMENTSTREAM_DEPLOYMENT_TARGET?.trim() === "preview" && deploymentId !== void 0 && deploymentId !== "" ? deploymentId : void 0;
|
|
24
|
+
}
|
|
25
|
+
function ontologyDeploymentHeaders(environment = process.env) {
|
|
26
|
+
const deploymentId = previewDeployment(environment);
|
|
27
|
+
return deploymentId === void 0 ? {} : { [ONTOLOGY_DEPLOYMENT_HEADER]: deploymentId };
|
|
28
|
+
}
|
|
20
29
|
function appOrigin(environment = process.env) {
|
|
21
30
|
const override = environment.SEGMENTSTREAM_AGENT_ONTOLOGY_URL;
|
|
22
31
|
if (override !== void 0 && override.trim() !== "") {
|
|
@@ -24,6 +33,7 @@ function appOrigin(environment = process.env) {
|
|
|
24
33
|
if (url === void 0 || url.protocol !== "https:" && url.protocol !== "http:") throw new AgentEnvironmentError("SEGMENTSTREAM_AGENT_ONTOLOGY_URL must be an http(s) URL.");
|
|
25
34
|
return withoutTrailingSlashes(`${url.origin}${url.pathname}`);
|
|
26
35
|
}
|
|
36
|
+
if (previewDeployment(environment) !== void 0) return `https://${required(environment, "VERCEL_URL")}`;
|
|
27
37
|
return `https://${required(environment, "VERCEL_PROJECT_PRODUCTION_URL")}`;
|
|
28
38
|
}
|
|
29
39
|
function proxyEnvironment(environment = process.env) {
|
|
@@ -45,9 +55,9 @@ function webhookSecret(environment = process.env) {
|
|
|
45
55
|
return secret === void 0 || secret === "" ? void 0 : secret;
|
|
46
56
|
}
|
|
47
57
|
function channelsEnabled(environment = process.env) {
|
|
48
|
-
return environment.VERCEL_ENV === "production";
|
|
58
|
+
return environment.VERCEL_ENV === "production" && previewDeployment(environment) === void 0;
|
|
49
59
|
}
|
|
50
60
|
function isPreview(environment = process.env) {
|
|
51
61
|
return environment.VERCEL_ENV === "preview";
|
|
52
62
|
}
|
|
53
|
-
export { AgentEnvironmentError, appOrigin, channelsEnabled, isPreview, proxyEnvironment, runtimeIdentityEnvironment, webhookSecret };
|
|
63
|
+
export { AgentEnvironmentError, ONTOLOGY_DEPLOYMENT_HEADER, appOrigin, channelsEnabled, isPreview, ontologyDeploymentHeaders, previewDeployment, proxyEnvironment, runtimeIdentityEnvironment, webhookSecret };
|
|
@@ -4,4 +4,6 @@
|
|
|
4
4
|
* agent's own bundle never loads them.
|
|
5
5
|
*/
|
|
6
6
|
export { defineEval, defineEvalConfig } from "eve/evals";
|
|
7
|
-
export type { EveEval, EveEvalConfig, EveEvalContext, EveEvalDefinition } from "eve/evals";
|
|
7
|
+
export type { Assertion, EveEval, EveEvalConfig, EveEvalContext, EveEvalDefinition, } from "eve/evals";
|
|
8
|
+
/** The value assertions `t.check(value, assertion)` and `t.require` apply. */
|
|
9
|
+
export { equals, includes, matches, satisfies, similarity } from "eve/evals/expect";
|
|
@@ -4,4 +4,6 @@ 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
|
-
|
|
7
|
+
import { defineEval, defineEvalConfig } from "eve/evals";
|
|
8
|
+
import { equals, includes, matches, satisfies, similarity } from "eve/evals/expect";
|
|
9
|
+
export { defineEval, defineEvalConfig, equals, includes, matches, satisfies, similarity };
|
|
@@ -4,9 +4,9 @@ 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 { appOrigin } from "./environment.mjs";
|
|
7
|
+
import { appOrigin, ontologyDeploymentHeaders } from "./environment.mjs";
|
|
8
8
|
import { runtimeToken } from "./runtime-token.mjs";
|
|
9
|
-
import { ot as guestIdOf } from "../../_chunks/principal-
|
|
9
|
+
import { ot as guestIdOf } from "../../_chunks/principal-C1g8wCIg.mjs";
|
|
10
10
|
const GUEST_USAGE_PATH = "/api/ontology/agent/guests/usage";
|
|
11
11
|
const REPORT_TIMEOUT_MS = 5e3;
|
|
12
12
|
function ontologyGuestUsage(options = {}) {
|
|
@@ -15,6 +15,7 @@ function ontologyGuestUsage(options = {}) {
|
|
|
15
15
|
method: "POST",
|
|
16
16
|
headers: {
|
|
17
17
|
authorization: `Bearer ${await (options.token ?? runtimeToken)()}`,
|
|
18
|
+
...ontologyDeploymentHeaders(),
|
|
18
19
|
"content-type": "application/json"
|
|
19
20
|
},
|
|
20
21
|
body: JSON.stringify({
|
|
@@ -6,6 +6,7 @@ __eveDirname(__filename);
|
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { agentToolsAnswer } from "./agent-tools.mjs";
|
|
8
8
|
import { redactDiagnostic } from "./diagnostics.mjs";
|
|
9
|
+
import { ontologyDeploymentHeaders } from "./environment.mjs";
|
|
9
10
|
var AgentIdentityError = class extends Error {
|
|
10
11
|
name = "AgentIdentityError";
|
|
11
12
|
code;
|
|
@@ -166,6 +167,7 @@ function agentIdentities(input) {
|
|
|
166
167
|
method: request.body === void 0 ? "GET" : "POST",
|
|
167
168
|
headers: {
|
|
168
169
|
authorization: `Bearer ${token}`,
|
|
170
|
+
...ontologyDeploymentHeaders(),
|
|
169
171
|
accept: "application/json",
|
|
170
172
|
...request.body === void 0 ? {} : { "content-type": "application/json" }
|
|
171
173
|
},
|
|
@@ -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-
|
|
7
|
+
export { f as attachmentsContext, p as storeFiles, m as turnContent } from "../../../_chunks/principal-C1g8wCIg.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-
|
|
7
|
+
export { f as attachmentsContext, d as prepareInboundMedia, p as storeFiles, m as turnContent } from "../../../_chunks/principal-C1g8wCIg.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-
|
|
7
|
+
export { R as ACT_AS_HEADER, w as actAsHeaders, T as ontologyConnection } from "../../_chunks/principal-C1g8wCIg.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, Ot as runtimeEnvelope, P as actionApproval, V as actorKey, j as ontologyTools } from "../../_chunks/principal-
|
|
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-C1g8wCIg.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";
|
|
@@ -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 { H as actorOf, a as rolesOf, j as ontologyTools, k as actionToolName } from "../../_chunks/principal-
|
|
7
|
+
import { H as actorOf, a as rolesOf, j as ontologyTools, k as actionToolName } from "../../_chunks/principal-C1g8wCIg.mjs";
|
|
8
8
|
import { object } from "./confirmation-description.mjs";
|
|
9
9
|
import { redactDiagnostic } from "./diagnostics.mjs";
|
|
10
10
|
import { defineMemoryProvider } from "eve/memory";
|
|
@@ -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-
|
|
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-C1g8wCIg.mjs";
|
|
@@ -7,6 +7,7 @@ __eveCreateRequire(import.meta.url);
|
|
|
7
7
|
import { redactDiagnostic } from "../diagnostics.mjs";
|
|
8
8
|
import { AgentIdentityError, refusal } from "../identities.mjs";
|
|
9
9
|
import { postDraftRoute } from "./routes.mjs";
|
|
10
|
+
import { ontologyDeploymentHeaders } from "../environment.mjs";
|
|
10
11
|
const CALL_TIMEOUT_MS = 1e4;
|
|
11
12
|
function agentReviews(input) {
|
|
12
13
|
const fetchImpl = input.fetch ?? fetch;
|
|
@@ -23,6 +24,7 @@ function agentReviews(input) {
|
|
|
23
24
|
method: "POST",
|
|
24
25
|
headers: {
|
|
25
26
|
authorization: `Bearer ${token}`,
|
|
27
|
+
...ontologyDeploymentHeaders(),
|
|
26
28
|
accept: "application/json",
|
|
27
29
|
"content-type": "application/json"
|
|
28
30
|
},
|
|
@@ -42,6 +44,11 @@ function agentReviews(input) {
|
|
|
42
44
|
member_id: reply.memberId,
|
|
43
45
|
session_id: reply.sessionId,
|
|
44
46
|
text: reply.text,
|
|
47
|
+
...reply.files === void 0 ? {} : { files: reply.files.map((file) => ({
|
|
48
|
+
entity: file.entity,
|
|
49
|
+
id: file.id,
|
|
50
|
+
property: file.property
|
|
51
|
+
})) },
|
|
45
52
|
mode: reply.mode,
|
|
46
53
|
confidence: reply.confidence,
|
|
47
54
|
...named.turnId === void 0 ? {} : { turn_id: named.turnId }
|
|
@@ -111,6 +118,7 @@ function agentSessionReviews(input) {
|
|
|
111
118
|
method: "POST",
|
|
112
119
|
headers: {
|
|
113
120
|
authorization: `Bearer ${token}`,
|
|
121
|
+
...ontologyDeploymentHeaders(),
|
|
114
122
|
accept: "application/json",
|
|
115
123
|
"content-type": "application/json"
|
|
116
124
|
},
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { SessionAuthContext } from "eve/context";
|
|
2
|
+
import { type SessionView } from "eve/events";
|
|
3
|
+
import type { DocumentReference } from "../sent-files.js";
|
|
4
|
+
import { type Environment } from "../environment.js";
|
|
5
|
+
import { type RuntimeToken } from "../runtime-token.js";
|
|
6
|
+
/** A file attached to a reply, as the ontology read it for the person the reply is for. */
|
|
7
|
+
export interface ReplyFile {
|
|
8
|
+
readonly entity: string;
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly property: string;
|
|
11
|
+
readonly filename: string;
|
|
12
|
+
readonly contentType: string;
|
|
13
|
+
readonly size: number;
|
|
14
|
+
}
|
|
15
|
+
/** The files a reply carries, in order, and the captions their calls gave. */
|
|
16
|
+
export interface ReplyFiles {
|
|
17
|
+
readonly files: ReadonlyArray<ReplyFile>;
|
|
18
|
+
readonly captions: ReadonlyArray<string>;
|
|
19
|
+
}
|
|
20
|
+
/** What `attachments_send` answers in a reviewed chat: nothing sent, the files promised. */
|
|
21
|
+
export interface AttachedFiles {
|
|
22
|
+
readonly attached: true;
|
|
23
|
+
readonly files: ReadonlyArray<ReplyFile>;
|
|
24
|
+
readonly caption?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Every file the turn attached: a channel that sends the turn's reply as one message. */
|
|
27
|
+
export declare function turnFiles(view: SessionView, turnId: string): ReplyFiles;
|
|
28
|
+
/**
|
|
29
|
+
* The files that go with reply part `partId`: those attached after the turn's previous reply part
|
|
30
|
+
* began and before this one did. Files attached after the turn's last reply part are
|
|
31
|
+
* {@link filesAfterReply}.
|
|
32
|
+
*/
|
|
33
|
+
export declare function partFiles(view: SessionView, turnId: string, partId: string): ReplyFiles;
|
|
34
|
+
/**
|
|
35
|
+
* The files no reply part of the turn carries: attached after its last reply part began, or every
|
|
36
|
+
* file of a turn without a reply. They are held on their own, never sent unreviewed.
|
|
37
|
+
*/
|
|
38
|
+
export declare function filesAfterReply(view: SessionView, turnId: string): ReplyFiles;
|
|
39
|
+
/** The most files one draft holds, as the ontology's `agent_draft` takes them. */
|
|
40
|
+
export declare const DRAFT_FILES_LIMIT = 10;
|
|
41
|
+
/** The most characters of captions a passed reply's files carry, as the narrowest channel takes. */
|
|
42
|
+
export declare const CAPTION_LIMIT = 1024;
|
|
43
|
+
/**
|
|
44
|
+
* A reply's files in groups a draft or one send takes: calls each within the limit may together
|
|
45
|
+
* pass it. The captions go with the first group, as they would with the reply.
|
|
46
|
+
*/
|
|
47
|
+
export declare function fileGroups(files: ReplyFiles): ReadonlyArray<ReplyFiles>;
|
|
48
|
+
/** The reply's text with the captions its files' calls gave, as the person reads it. */
|
|
49
|
+
export declare function withCaptions(text: string, captions: ReadonlyArray<string>): string;
|
|
50
|
+
/** Why the ontology refused to let files go with a reply in a reviewed chat. */
|
|
51
|
+
export declare class ReplyFilesRefused extends Error {
|
|
52
|
+
/**
|
|
53
|
+
* `unsupported` when the ontology holds no files with a draft, else its refusal, such as
|
|
54
|
+
* `file_unavailable` or `too_many_files`.
|
|
55
|
+
*/
|
|
56
|
+
readonly code: string;
|
|
57
|
+
readonly status: number;
|
|
58
|
+
readonly index?: number | undefined;
|
|
59
|
+
readonly name = "ReplyFilesRefused";
|
|
60
|
+
constructor(
|
|
61
|
+
/**
|
|
62
|
+
* `unsupported` when the ontology holds no files with a draft, else its refusal, such as
|
|
63
|
+
* `file_unavailable` or `too_many_files`.
|
|
64
|
+
*/
|
|
65
|
+
code: string, status: number, index?: number | undefined);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Asks the ontology whether a reply to `principal` may carry these files: each read as the person
|
|
69
|
+
* the reply is for and checked against the chat's channel, as holding the reply will check them.
|
|
70
|
+
* Resolves the files as it read them; rejects with {@link ReplyFilesRefused}. An ontology that holds
|
|
71
|
+
* no files with a draft answers 404, which is `unsupported`: the files are never sent unreviewed.
|
|
72
|
+
*/
|
|
73
|
+
export declare function checkReplyFiles(input: {
|
|
74
|
+
readonly origin: string;
|
|
75
|
+
readonly token: RuntimeToken;
|
|
76
|
+
readonly fetch?: typeof fetch;
|
|
77
|
+
readonly principal: SessionAuthContext | null;
|
|
78
|
+
readonly files: ReadonlyArray<DocumentReference>;
|
|
79
|
+
}): Promise<ReadonlyArray<ReplyFile>>;
|
|
80
|
+
/** Why `attachments_send` attached nothing, as every channel's refusal reads. */
|
|
81
|
+
export interface AttachRefusal {
|
|
82
|
+
readonly error: string;
|
|
83
|
+
readonly detail: string;
|
|
84
|
+
readonly reference: string;
|
|
85
|
+
readonly index?: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* `attachments_send` in a reviewed chat: the files join the turn's reply instead of being sent,
|
|
89
|
+
* once the ontology checked them as the person may read them and as the channel sends them.
|
|
90
|
+
* Answers what it attached, or a refusal with the workspace's attachment failure text: in a
|
|
91
|
+
* deployment that is not production, which sends no files, an ontology that holds no files with a
|
|
92
|
+
* draft, or a file it refused.
|
|
93
|
+
*/
|
|
94
|
+
export declare function attachToReply(input: {
|
|
95
|
+
readonly files: ReadonlyArray<DocumentReference>;
|
|
96
|
+
readonly caption?: string;
|
|
97
|
+
readonly principal: SessionAuthContext | null;
|
|
98
|
+
readonly environment?: Environment;
|
|
99
|
+
readonly token?: RuntimeToken;
|
|
100
|
+
readonly fetch?: typeof fetch;
|
|
101
|
+
}): Promise<AttachedFiles | AttachRefusal>;
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
export { c as CAPTION_LIMIT, l as DRAFT_FILES_LIMIT, u as ReplyFilesRefused, d as attachToReply, f as checkReplyFiles, p as fileGroups, m as filesAfterReply, h as partFiles, g as turnFiles, _ as withCaptions } from "../../../_chunks/silent-C9x3GcMg.mjs";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SessionAuthContext } from "eve/context";
|
|
2
2
|
import { type ReviewSettings, type Review } from "../../review.js";
|
|
3
|
+
import type { ReplyFile } from "./files.js";
|
|
3
4
|
/**
|
|
4
5
|
* Whether the agent sends a reply itself or holds it for a member to review, by the review of the
|
|
5
6
|
* person it replies to: the session's current principal, whose roles `review` reads.
|
|
@@ -46,6 +47,11 @@ export interface HeldReply {
|
|
|
46
47
|
readonly memberId: string;
|
|
47
48
|
readonly sessionId: string;
|
|
48
49
|
readonly text: string;
|
|
50
|
+
/**
|
|
51
|
+
* Record files the reply carries, as the ontology read them for its member, which approval
|
|
52
|
+
* sends with the text. Absent for a reply of text alone, which any ontology service holds.
|
|
53
|
+
*/
|
|
54
|
+
readonly files?: ReadonlyArray<ReplyFile>;
|
|
49
55
|
readonly mode: "always" | "whenUnsure";
|
|
50
56
|
/** The decision model's probability that staff would send it as written; null when unjudged. */
|
|
51
57
|
readonly confidence: number | null;
|
|
@@ -86,6 +92,7 @@ export declare function heldReply(input: {
|
|
|
86
92
|
readonly sessionId: string;
|
|
87
93
|
readonly partId: string;
|
|
88
94
|
readonly text: string;
|
|
95
|
+
readonly files?: ReadonlyArray<ReplyFile>;
|
|
89
96
|
readonly turnId?: string | null;
|
|
90
97
|
readonly outcome: Extract<ReviewOutcome, {
|
|
91
98
|
send: false;
|