@segmentstream/agent 0.12.1 → 0.13.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/README.md +29 -22
- package/dist/_chunks/{build-metadata-Dl-ZJp5p.mjs → build-metadata-BLeBanNg.mjs} +1 -1
- package/dist/_chunks/{inbound-request-BrWspFw5.mjs → inbound-request-BXhiIph-.mjs} +21 -19
- package/dist/_chunks/{workflow-serializable-BxrXgxjc.mjs → workflow-serializable-DVQBWK8p.mjs} +87 -4
- package/dist/extension/_manifest.json +0 -1
- package/dist/extension/config.d.ts +18 -5
- package/dist/extension/config.mjs +138 -18
- package/dist/extension/extension.d.ts +7 -1
- package/dist/extension/hooks/authorization.d.ts +3 -0
- package/dist/extension/hooks/authorization.mjs +16 -0
- package/dist/extension/instructions.md +3 -4
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/chat-post-confirmation.d.ts +1 -0
- package/dist/extension/lib/chat-post-confirmation.mjs +4 -2
- package/dist/extension/lib/confirmation-outcome.d.ts +1 -1
- package/dist/extension/lib/confirmations.d.ts +2 -0
- package/dist/extension/lib/confirmations.mjs +7 -4
- package/dist/extension/lib/conversations.mjs +1 -1
- package/dist/extension/lib/deferred-confirmations.d.ts +3 -0
- package/dist/extension/lib/deferred-confirmations.mjs +2 -0
- package/dist/extension/lib/ontology-tools.mjs +1 -1
- package/dist/extension/lib/telegram/adapter.mjs +34 -7
- package/dist/extension/lib/telegram/attachment-description.mjs +1 -1
- package/dist/extension/lib/telegram/attachments-send.mjs +13 -10
- package/dist/extension/lib/telegram/chat-post-card.d.ts +1 -1
- package/dist/extension/lib/telegram/chat-post-card.mjs +13 -10
- package/dist/extension/lib/telegram/confirmation-expiry.d.ts +2 -1
- package/dist/extension/lib/telegram/confirmation-expiry.mjs +5 -4
- package/dist/extension/lib/telegram/confirmation-text.d.ts +1 -1
- package/dist/extension/lib/telegram/confirmation-text.mjs +18 -12
- package/dist/extension/lib/telegram/confirmations.mjs +24 -19
- package/dist/extension/lib/telegram/conversations.d.ts +2 -0
- package/dist/extension/lib/telegram/conversations.mjs +14 -1
- package/dist/extension/lib/telegram/customer-text.d.ts +9 -8
- package/dist/extension/lib/telegram/customer-text.mjs +1 -1
- package/dist/extension/lib/telegram/deferred-confirmations.mjs +10 -9
- package/dist/extension/lib/telegram/files.mjs +1 -1
- package/dist/extension/lib/telegram/health.mjs +1 -1
- package/dist/extension/lib/telegram/images.mjs +1 -1
- package/dist/extension/lib/telegram/inbound-request.mjs +1 -1
- package/dist/extension/lib/telegram/inbound.mjs +18 -17
- package/dist/extension/lib/telegram/lifecycle.mjs +2 -2
- package/dist/extension/lib/telegram/media-policy.mjs +1 -1
- package/dist/extension/lib/telegram/silent.mjs +1 -1
- package/dist/extension/lib/telegram/texts.d.ts +16 -0
- package/dist/extension/lib/telegram/texts.mjs +70 -0
- package/dist/extension/lib/telegram/turn-errors.d.ts +1 -1
- package/dist/extension/lib/telegram/turn-errors.mjs +37 -3
- package/dist/extension/lib/telegram/voice.mjs +1 -1
- package/dist/extension/lib/workflow-serializable.mjs +1 -1
- package/dist/extension/schedules/confirmations.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 +3 -1
- package/dist/extension/tools/attachments_read.mjs +1 -1
- package/dist/extension/tools/attachments_send.mjs +1 -1
- package/dist/extension/tools/attachments_table.mjs +1 -1
- package/dist/extension/tools/ontology.mjs +1 -1
- package/dist/extension/tools/questions_ask.mjs +1 -1
- package/package.json +2 -2
- package/dist/extension/connections/ontology.d.ts +0 -7
- package/dist/extension/connections/ontology.mjs +0 -11
|
@@ -5,6 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { effectiveGroupPolicy, groupPolicy } from "../group-routing/policy.mjs";
|
|
8
|
+
import { admitMessage, localizedText } from "../admission.mjs";
|
|
8
9
|
import { conversationLanguage, telegramPrincipal } from "./principal.mjs";
|
|
9
10
|
import { addressingReason, conversationKey, otherRecipient } from "../group-routing/signals.mjs";
|
|
10
11
|
import { conversationAddressing, conversationState } from "../group-routing/conversation.mjs";
|
|
@@ -12,7 +13,7 @@ import { questionInvitation } from "../group-routing/engagement.mjs";
|
|
|
12
13
|
import { conversationContext, routeMessage } from "../group-routing/router.mjs";
|
|
13
14
|
import { observedContext } from "../group-routing/observed.mjs";
|
|
14
15
|
import { debounceBurst, routingBurst } from "../group-routing/burst.mjs";
|
|
15
|
-
import { p as reportTelegramError } from "../../../_chunks/inbound-request-
|
|
16
|
+
import { p as reportTelegramError } from "../../../_chunks/inbound-request-BXhiIph-.mjs";
|
|
16
17
|
import { AttachmentLifecycleNotPermitted, startTypingHeartbeat, typingUntilComplete } from "./lifecycle.mjs";
|
|
17
18
|
import { formatAddress, messageAddress, scopedAddress } from "./sessions.mjs";
|
|
18
19
|
import { contentShape, messageContent } from "./content.mjs";
|
|
@@ -27,13 +28,9 @@ import { questionAddress, questionFromHistory } from "./confirmations.mjs";
|
|
|
27
28
|
import { routingContext } from "./routing-context.mjs";
|
|
28
29
|
import { recordGateDecision, recordInboundContent, recordRouteDecision } from "./conversations.mjs";
|
|
29
30
|
import { chatContext } from "./chats.mjs";
|
|
30
|
-
import { admitMessage, localizedText } from "../admission.mjs";
|
|
31
31
|
import { attachmentsContext, inboundAttachments, stageFiles } from "./files.mjs";
|
|
32
32
|
import { heldApprovals, releaseHeldApproval } from "./held-approvals.mjs";
|
|
33
33
|
import { voiceOf, voiceText } from "./voice.mjs";
|
|
34
|
-
const UNKNOWN_PRIVATE = "🔗";
|
|
35
|
-
const UNKNOWN_IN_GROUP = "🔒";
|
|
36
|
-
const REFUSED = "🔒";
|
|
37
34
|
const MAXIMUM_QUOTE_LENGTH = 500;
|
|
38
35
|
function buttonTo(text, url) {
|
|
39
36
|
return { inline_keyboard: [[{
|
|
@@ -96,12 +93,6 @@ function speakerBlock(input) {
|
|
|
96
93
|
lines.push("</speaker>");
|
|
97
94
|
return lines.join("\n");
|
|
98
95
|
}
|
|
99
|
-
function unknownInGroup(bot) {
|
|
100
|
-
return bot?.username === void 0 ? { text: UNKNOWN_IN_GROUP } : {
|
|
101
|
-
text: UNKNOWN_IN_GROUP,
|
|
102
|
-
reply_markup: buttonTo("✉️", `https://t.me/${bot.username}`)
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
96
|
async function answerUnpaired(input) {
|
|
106
97
|
const { context, message, lookup, dependencies } = input;
|
|
107
98
|
if (lookup.status === "limited") {
|
|
@@ -131,12 +122,19 @@ async function answerUnpaired(input) {
|
|
|
131
122
|
}
|
|
132
123
|
if (lookup.status === "refused") {
|
|
133
124
|
const text = localizedText(dependencies.admission().replies.refused, message.from.languageCode);
|
|
134
|
-
await context.telegram.post(text
|
|
135
|
-
return
|
|
125
|
+
if (text !== void 0) await context.telegram.post(text);
|
|
126
|
+
return text !== void 0;
|
|
136
127
|
}
|
|
128
|
+
const replies = dependencies.admission().replies;
|
|
129
|
+
const locale = message.from.languageCode;
|
|
137
130
|
if (message.chat.type !== "private") {
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
const text = localizedText(replies.groupPairingRequired, locale);
|
|
132
|
+
const button = localizedText(replies.groupPairingButton, locale);
|
|
133
|
+
if (text !== void 0) await context.telegram.post({
|
|
134
|
+
text,
|
|
135
|
+
...button === void 0 || input.bot?.username === void 0 ? {} : { reply_markup: buttonTo(button, `https://t.me/${input.bot.username}`) }
|
|
136
|
+
});
|
|
137
|
+
return text !== void 0;
|
|
140
138
|
}
|
|
141
139
|
const sender = display(message.from);
|
|
142
140
|
const pairing = await dependencies.identities.createPairing({
|
|
@@ -144,9 +142,12 @@ async function answerUnpaired(input) {
|
|
|
144
142
|
externalId: message.from.id,
|
|
145
143
|
...sender === void 0 ? {} : { display: sender }
|
|
146
144
|
});
|
|
145
|
+
const text = localizedText(replies.pairingRequired, locale);
|
|
146
|
+
const label = localizedText(replies.pairingButton, locale);
|
|
147
|
+
if (text === void 0 || label === void 0) throw new Error("replies.pairingRequired and replies.pairingButton are required for Telegram.");
|
|
147
148
|
await context.telegram.post({
|
|
148
|
-
text
|
|
149
|
-
reply_markup: buttonTo(
|
|
149
|
+
text,
|
|
150
|
+
reply_markup: buttonTo(label, dependencies.connectUrl(pairing.code))
|
|
150
151
|
});
|
|
151
152
|
return true;
|
|
152
153
|
}
|
|
@@ -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 { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
7
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-BLeBanNg.mjs";
|
|
8
8
|
import { object } from "../confirmation-description.mjs";
|
|
9
|
-
import { n as currentInboundRequest, p as reportTelegramError } from "../../../_chunks/inbound-request-
|
|
9
|
+
import { n as currentInboundRequest, p as reportTelegramError } from "../../../_chunks/inbound-request-BXhiIph-.mjs";
|
|
10
10
|
import { needsConfirmation } from "../confirmations.mjs";
|
|
11
11
|
import { OntologyActionNotPermitted, actionToolName, ontologyTools } from "../ontology-tools.mjs";
|
|
12
12
|
var AttachmentLifecycleNotPermitted = class extends Error {
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { DEFAULT_IMAGE_DESCRIPTION_MODEL } from "../../config.mjs";
|
|
8
|
-
import { p as reportTelegramError } from "../../../_chunks/inbound-request-
|
|
8
|
+
import { p as reportTelegramError } from "../../../_chunks/inbound-request-BXhiIph-.mjs";
|
|
9
9
|
function planMedia(capabilities, descriptionModel = null) {
|
|
10
10
|
if (typeof descriptionModel === "string") return {
|
|
11
11
|
images: "describe",
|
|
@@ -9,7 +9,7 @@ import { agentMessage, observedChatKey } from "../group-routing/observed.mjs";
|
|
|
9
9
|
import { confirmationLocale } from "./confirmation-text.mjs";
|
|
10
10
|
import { splitTelegramText } from "./format.mjs";
|
|
11
11
|
import { inTelegramSendQueue } from "./send-queue.mjs";
|
|
12
|
-
import { a as TelegramDeliveryError, l as customerMessage, o as currentLocale, p as reportTelegramError } from "../../../_chunks/inbound-request-
|
|
12
|
+
import { a as TelegramDeliveryError, l as customerMessage, o as currentLocale, p as reportTelegramError } from "../../../_chunks/inbound-request-BXhiIph-.mjs";
|
|
13
13
|
const SILENT_MARKERS = new Set(["[silent]", "no_reply"]);
|
|
14
14
|
function isSilentReply(text) {
|
|
15
15
|
return SILENT_MARKERS.has(text.trim().toLowerCase());
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LocalizedText } from "../../config.js";
|
|
2
|
+
export declare const TELEGRAM_TEXT_KEYS: {
|
|
3
|
+
readonly callback: readonly ["error", "unknown", "forbidden", "expired", "already", "unsupported"];
|
|
4
|
+
readonly confirmation: readonly ["question", "confirm", "cancel", "edit", "executing", "done", "cancelled", "failed", "expired", "interrupted"];
|
|
5
|
+
readonly chatPost: readonly ["sent", "uncertain", "historyNotRecorded"];
|
|
6
|
+
readonly notice: readonly ["failed", "recovery", "attachment", "authorization", "response", "connected", "disconnected", "cancelled"];
|
|
7
|
+
readonly authorization: readonly ["prompt", "url", "button"];
|
|
8
|
+
};
|
|
9
|
+
export type TelegramTexts = {
|
|
10
|
+
readonly [Group in keyof typeof TELEGRAM_TEXT_KEYS]?: Partial<Record<(typeof TELEGRAM_TEXT_KEYS)[Group][number], LocalizedText>>;
|
|
11
|
+
};
|
|
12
|
+
/** Bind workspace copy to one webhook or durable event, never to another workspace's request. */
|
|
13
|
+
export declare function withTelegramTexts<T>(texts: TelegramTexts, run: () => T, locale?: () => string): T;
|
|
14
|
+
export declare function telegramText<Group extends keyof TelegramTexts>(group: Group, key: (typeof TELEGRAM_TEXT_KEYS)[Group][number], locale?: string): string | undefined;
|
|
15
|
+
/** A persisted card keeps its original locale even while another member's webhook reconciles it. */
|
|
16
|
+
export declare function withTelegramLocale<T>(locale: string | undefined, run: () => T): T;
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { AsyncLocalStorage } from "node:async_hooks";
|
|
9
|
+
const TELEGRAM_TEXT_KEYS = {
|
|
10
|
+
callback: [
|
|
11
|
+
"error",
|
|
12
|
+
"unknown",
|
|
13
|
+
"forbidden",
|
|
14
|
+
"expired",
|
|
15
|
+
"already",
|
|
16
|
+
"unsupported"
|
|
17
|
+
],
|
|
18
|
+
confirmation: [
|
|
19
|
+
"question",
|
|
20
|
+
"confirm",
|
|
21
|
+
"cancel",
|
|
22
|
+
"edit",
|
|
23
|
+
"executing",
|
|
24
|
+
"done",
|
|
25
|
+
"cancelled",
|
|
26
|
+
"failed",
|
|
27
|
+
"expired",
|
|
28
|
+
"interrupted"
|
|
29
|
+
],
|
|
30
|
+
chatPost: [
|
|
31
|
+
"sent",
|
|
32
|
+
"uncertain",
|
|
33
|
+
"historyNotRecorded"
|
|
34
|
+
],
|
|
35
|
+
notice: [
|
|
36
|
+
"failed",
|
|
37
|
+
"recovery",
|
|
38
|
+
"attachment",
|
|
39
|
+
"authorization",
|
|
40
|
+
"response",
|
|
41
|
+
"connected",
|
|
42
|
+
"disconnected",
|
|
43
|
+
"cancelled"
|
|
44
|
+
],
|
|
45
|
+
authorization: [
|
|
46
|
+
"prompt",
|
|
47
|
+
"url",
|
|
48
|
+
"button"
|
|
49
|
+
]
|
|
50
|
+
};
|
|
51
|
+
const storage = new AsyncLocalStorage();
|
|
52
|
+
function withTelegramTexts(texts, run, locale = () => "en") {
|
|
53
|
+
return storage.run({
|
|
54
|
+
texts,
|
|
55
|
+
locale
|
|
56
|
+
}, run);
|
|
57
|
+
}
|
|
58
|
+
function telegramText(group, key, locale) {
|
|
59
|
+
const configured = storage.getStore();
|
|
60
|
+
const section = configured?.texts[group];
|
|
61
|
+
return localizedText(section?.[key], locale ?? configured?.locale());
|
|
62
|
+
}
|
|
63
|
+
function withTelegramLocale(locale, run) {
|
|
64
|
+
const configured = storage.getStore();
|
|
65
|
+
return configured === void 0 || locale === void 0 ? run() : storage.run({
|
|
66
|
+
...configured,
|
|
67
|
+
locale: () => locale
|
|
68
|
+
}, run);
|
|
69
|
+
}
|
|
70
|
+
export { TELEGRAM_TEXT_KEYS, telegramText, withTelegramLocale, withTelegramTexts };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { TelegramChannelEvents } from "eve/channels/telegram";
|
|
2
|
-
export declare const telegramFailureEvents: Pick<TelegramChannelEvents, "turn.failed" | "turn.cancelled" | "session.failed" | "authorization.completed">;
|
|
2
|
+
export declare const telegramFailureEvents: Pick<TelegramChannelEvents, "turn.failed" | "turn.cancelled" | "session.failed" | "authorization.completed" | "authorization.required">;
|
|
@@ -4,11 +4,41 @@ 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 { telegramText } from "./texts.mjs";
|
|
7
8
|
import { memberIdOf } from "./principal.mjs";
|
|
8
9
|
import { confirmationLocale } from "./confirmation-text.mjs";
|
|
9
|
-
import { c as customerCopy, d as failureText, o as currentLocale, p as reportTelegramError } from "../../../_chunks/inbound-request-
|
|
10
|
+
import { c as customerCopy, d as failureText, o as currentLocale, p as reportTelegramError } from "../../../_chunks/inbound-request-BXhiIph-.mjs";
|
|
10
11
|
const telegramFailureEvents = {
|
|
12
|
+
async "authorization.required"(event, channel, context) {
|
|
13
|
+
if (event.candidateId !== void 0) return;
|
|
14
|
+
const locale = confirmationLocale(context.session.auth.current, currentLocale());
|
|
15
|
+
const prompt = telegramText("authorization", "prompt", locale);
|
|
16
|
+
const url = telegramText("authorization", "url", locale);
|
|
17
|
+
const button = telegramText("authorization", "button", locale);
|
|
18
|
+
if (prompt !== void 0) {
|
|
19
|
+
const sent = await channel.telegram.post({
|
|
20
|
+
text: prompt,
|
|
21
|
+
...url === void 0 || button === void 0 ? {} : { reply_markup: { inline_keyboard: [[{
|
|
22
|
+
text: button,
|
|
23
|
+
url
|
|
24
|
+
}]] } }
|
|
25
|
+
});
|
|
26
|
+
if (sent.id) channel.state.pendingAuthMessageIds = {
|
|
27
|
+
...channel.state.pendingAuthMessageIds,
|
|
28
|
+
[event.name]: sent.id
|
|
29
|
+
};
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const state = channel.state;
|
|
33
|
+
state.authorizationCancellationTurnId = event.turnId;
|
|
34
|
+
const errorId = reportTelegramError("authorization_prompt_unconfigured", new Error("texts.authorization.prompt is not configured."), { sessionId: context.session.id });
|
|
35
|
+
await channel.telegram.post(failureText(errorId, "authorization", locale));
|
|
36
|
+
},
|
|
11
37
|
async "turn.cancelled"(event, channel, context) {
|
|
38
|
+
const state = channel.state;
|
|
39
|
+
const authorizationTurn = state.authorizationCancellationTurnId;
|
|
40
|
+
delete state.authorizationCancellationTurnId;
|
|
41
|
+
if (typeof event.turnId === "string" && authorizationTurn === event.turnId) return;
|
|
12
42
|
const errorId = reportTelegramError("turn_cancelled", event, {
|
|
13
43
|
chatId: channel.state.chatId,
|
|
14
44
|
sessionId: context.session.id,
|
|
@@ -37,17 +67,21 @@ const telegramFailureEvents = {
|
|
|
37
67
|
const messageId = channel.state.pendingAuthMessageIds?.[event.name];
|
|
38
68
|
if (event.candidateId !== void 0 || messageId === void 0) return;
|
|
39
69
|
const locale = confirmationLocale(context.session.auth.current);
|
|
40
|
-
const copy = customerCopy();
|
|
70
|
+
const copy = customerCopy(locale);
|
|
41
71
|
let text = event.outcome === "authorized" ? copy.connected : copy.disconnected;
|
|
42
72
|
if (event.reason !== void 0) {
|
|
43
73
|
const errorId = reportTelegramError("authorization_not_completed", event, { chatId: channel.state.chatId });
|
|
44
74
|
text = failureText(errorId, "authorization", locale);
|
|
45
75
|
}
|
|
46
|
-
await channel.telegram.editMessageText({
|
|
76
|
+
if (text !== void 0) await channel.telegram.editMessageText({
|
|
47
77
|
messageId,
|
|
48
78
|
text,
|
|
49
79
|
replyMarkup: { inline_keyboard: [] }
|
|
50
80
|
});
|
|
81
|
+
else await channel.telegram.editMessageReplyMarkup({
|
|
82
|
+
messageId,
|
|
83
|
+
replyMarkup: { inline_keyboard: [] }
|
|
84
|
+
});
|
|
51
85
|
delete channel.state.pendingAuthMessageIds?.[event.name];
|
|
52
86
|
}
|
|
53
87
|
};
|
|
@@ -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 { p as reportTelegramError } from "../../../_chunks/inbound-request-
|
|
7
|
+
import { p as reportTelegramError } from "../../../_chunks/inbound-request-BXhiIph-.mjs";
|
|
8
8
|
import "../connection-proxy.mjs";
|
|
9
9
|
import { gateway, transcribe } from "ai";
|
|
10
10
|
const LABELS = {
|
|
@@ -4,5 +4,5 @@ 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 { n as workflowToolResult, r as workflowValue, t as toWorkflowSerializable } from "../../_chunks/workflow-serializable-
|
|
7
|
+
import { n as workflowToolResult, r as workflowValue, t as toWorkflowSerializable } from "../../_chunks/workflow-serializable-DVQBWK8p.mjs";
|
|
8
8
|
export { toWorkflowSerializable, workflowToolResult, workflowValue };
|
|
@@ -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 { n as workflowToolResult } from "../../_chunks/workflow-serializable-
|
|
7
|
+
import { n as workflowToolResult } from "../../_chunks/workflow-serializable-DVQBWK8p.mjs";
|
|
8
8
|
import { ID_INPUT, attachmentForModel, attachmentOwner, stringArgument, toolAttachments } from "../lib/attachment-tools.mjs";
|
|
9
9
|
import { defineTool } from "eve/tools";
|
|
10
10
|
var attachments_discard_default = defineTool({
|
|
@@ -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 { n as workflowToolResult } from "../../_chunks/workflow-serializable-
|
|
7
|
+
import { n as workflowToolResult } from "../../_chunks/workflow-serializable-DVQBWK8p.mjs";
|
|
8
8
|
import { attachmentForModel, attachmentOwner, toolAttachments } from "../lib/attachment-tools.mjs";
|
|
9
9
|
import { defineTool } from "eve/tools";
|
|
10
10
|
var attachments_list_default = defineTool({
|
|
@@ -4,13 +4,15 @@ 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 { n as workflowToolResult } from "../../_chunks/workflow-serializable-
|
|
7
|
+
import { n as workflowToolResult } from "../../_chunks/workflow-serializable-DVQBWK8p.mjs";
|
|
8
|
+
import segmentstream from "../extension.mjs";
|
|
8
9
|
import { actionApproval } from "../lib/confirmations.mjs";
|
|
9
10
|
import { ontologyTools, promotionTarget } from "../lib/ontology-tools.mjs";
|
|
10
11
|
import { attachmentForModel, attachmentOwner, optionalObject, optionalString, stringArgument, toolAttachments } from "../lib/attachment-tools.mjs";
|
|
11
12
|
import { defineTool } from "eve/tools";
|
|
12
13
|
var attachments_promote_default = defineTool({
|
|
13
14
|
approval: actionApproval({
|
|
15
|
+
texts: () => segmentstream.config.texts ?? {},
|
|
14
16
|
labels: (memberId, _tool, input) => {
|
|
15
17
|
const target = promotionTarget(input);
|
|
16
18
|
return ontologyTools().labels(memberId, target.action, target.input);
|
|
@@ -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 { n as workflowToolResult } from "../../_chunks/workflow-serializable-
|
|
7
|
+
import { n as workflowToolResult } from "../../_chunks/workflow-serializable-DVQBWK8p.mjs";
|
|
8
8
|
import { ID_INPUT, attachmentOwner, headerArgument, optionalString, pageInteger, readOutput, stringArgument, toolAttachments } from "../lib/attachment-tools.mjs";
|
|
9
9
|
import { readStoredFile } from "../lib/stored-files.mjs";
|
|
10
10
|
import { defineTool } from "eve/tools";
|
|
@@ -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 { n as workflowToolResult } from "../../_chunks/workflow-serializable-
|
|
7
|
+
import { n as workflowToolResult } from "../../_chunks/workflow-serializable-DVQBWK8p.mjs";
|
|
8
8
|
import segmentstream from "../extension.mjs";
|
|
9
9
|
import { sendAttachments, sendAttachmentsInput } from "../lib/telegram/attachments-send.mjs";
|
|
10
10
|
import { defineTool } from "eve/tools";
|
|
@@ -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 { n as workflowToolResult } from "../../_chunks/workflow-serializable-
|
|
7
|
+
import { n as workflowToolResult } from "../../_chunks/workflow-serializable-DVQBWK8p.mjs";
|
|
8
8
|
import { readSheets, typedTable } from "../lib/attachment-tables.mjs";
|
|
9
9
|
import { queryTable } from "../lib/attachment-query.mjs";
|
|
10
10
|
import { ID_INPUT, attachmentForModel, attachmentOwner, boundedResultPage, headerArgument, optionalString, pageInteger, stringArgument, toolAttachments } from "../lib/attachment-tools.mjs";
|
|
@@ -123,7 +123,7 @@ var ontology_default = defineDynamic({ events: { "turn.started": async (_event,
|
|
|
123
123
|
required: ["name"],
|
|
124
124
|
additionalProperties: false
|
|
125
125
|
},
|
|
126
|
-
execute: (input, ctx) => executeDeferredTool(memberId, input.name, input.arguments ?? {}, ctx)
|
|
126
|
+
execute: (input, ctx) => executeDeferredTool(memberId, input.name, input.arguments ?? {}, ctx, { texts: () => segmentstream.config.texts ?? {} })
|
|
127
127
|
})
|
|
128
128
|
};
|
|
129
129
|
} } });
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { memberIdOf } from "../lib/telegram/principal.mjs";
|
|
8
|
-
import { n as workflowToolResult } from "../../_chunks/workflow-serializable-
|
|
8
|
+
import { n as workflowToolResult } from "../../_chunks/workflow-serializable-DVQBWK8p.mjs";
|
|
9
9
|
import { pendingQuestions, questionKey } from "../lib/questions.mjs";
|
|
10
10
|
import { stringArgument } from "../lib/attachment-tools.mjs";
|
|
11
11
|
import { defineTool } from "eve/tools";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Mount a SegmentStream workspace's agent on eve: the ontology as tools, acting as the member who writes, and Telegram through the workspace's connection.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SegmentStream",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@chat-adapter/telegram": "4.41.0",
|
|
65
|
-
"@segmentstream-cloud/ontology": "0.
|
|
65
|
+
"@segmentstream-cloud/ontology": "0.49.0",
|
|
66
66
|
"@vercel/oidc": "^3.8.4",
|
|
67
67
|
"ai": "^7.0.128",
|
|
68
68
|
"csv-parse": "^7.0.3",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `segmentstream__ontology`: the ontology's MCP tools, acting as the member of each turn. It is
|
|
3
|
-
* resolved per turn because a group chat's session serves several members; a turn without a
|
|
4
|
-
* paired member, or a mount with `ontology.connection: false`, gets no connection.
|
|
5
|
-
*/
|
|
6
|
-
declare const _default: import("eve").DynamicSentinel<import("eve/connections").DynamicConnectionResult>;
|
|
7
|
-
export default _default;
|
|
@@ -1,11 +0,0 @@
|
|
|
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 segmentstream from "../extension.mjs";
|
|
8
|
-
import { ontologyConnectionForTurn } from "../lib/ontology-connection.mjs";
|
|
9
|
-
import { defineDynamic } from "eve/connections";
|
|
10
|
-
var ontology_default = defineDynamic({ events: { "turn.started": (_event, context) => segmentstream.config.ontology.connection && segmentstream.config.confirmations.mode === "held" ? ontologyConnectionForTurn({ principal: context.session.auth.current }) : null } });
|
|
11
|
-
export { ontology_default as default };
|