@segmentstream/agent 0.36.3 → 0.37.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/README.md +23 -4
- package/dist/_chunks/{build-metadata-D3ytCxvV.mjs → build-metadata-C0Kz75P3.mjs} +1 -1
- package/dist/_chunks/{principal-UlkbLrgQ.mjs → principal-BIX7T6Hh.mjs} +1 -1
- package/dist/extension/hooks/authorization.mjs +1 -1
- package/dist/extension/instructions.md +6 -4
- package/dist/extension/lib/actor.mjs +1 -1
- package/dist/extension/lib/attachment-tools.mjs +1 -1
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/chat-post-confirmation.d.ts +3 -1
- package/dist/extension/lib/chat-post-confirmation.mjs +8 -5
- package/dist/extension/lib/{telegram/chats.d.ts → chats.d.ts} +14 -4
- package/dist/extension/lib/{telegram/chats.mjs → chats.mjs} +33 -17
- package/dist/extension/lib/confirmations.d.ts +3 -4
- package/dist/extension/lib/confirmations.mjs +16 -11
- package/dist/extension/lib/conversation-runtime.mjs +1 -1
- package/dist/extension/lib/conversation.d.ts +33 -0
- package/dist/extension/lib/conversation.mjs +55 -0
- package/dist/extension/lib/ontology-connection.mjs +11 -4
- package/dist/extension/lib/ontology-file-call.mjs +1 -1
- package/dist/extension/lib/ontology-tools.mjs +1 -1
- package/dist/extension/lib/runtime-envelope.d.ts +5 -1
- package/dist/extension/lib/runtime-envelope.mjs +1 -1
- package/dist/extension/lib/slack/adapter.d.ts +43 -2
- package/dist/extension/lib/slack/adapter.mjs +201 -39
- package/dist/extension/lib/stored-files.mjs +1 -1
- package/dist/extension/lib/telegram/adapter.mjs +7 -4
- 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-post-card.d.ts +11 -0
- package/dist/extension/lib/telegram/chat-post-card.mjs +27 -12
- package/dist/extension/lib/telegram/confirmations.mjs +1 -1
- package/dist/extension/lib/telegram/conversations.d.ts +1 -1
- package/dist/extension/lib/telegram/files.mjs +1 -1
- package/dist/extension/lib/telegram/health.d.ts +1 -1
- package/dist/extension/lib/telegram/health.mjs +1 -1
- package/dist/extension/lib/telegram/inbound.d.ts +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/membership.d.ts +1 -1
- package/dist/extension/lib/telegram/principal.mjs +1 -1
- package/dist/extension/lib/telegram/structured.mjs +1 -1
- package/dist/extension/lib/telegram/turn-errors.mjs +1 -1
- package/dist/extension/lib/whatsapp/adapter.d.ts +2 -0
- package/dist/extension/lib/whatsapp/adapter.mjs +8 -1
- package/dist/extension/model.mjs +1 -1
- package/dist/extension/tools/attachments_promote.mjs +1 -1
- package/dist/extension/tools/questions_ask.mjs +4 -1
- package/package.json +2 -2
|
@@ -4,8 +4,8 @@ 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 { d as telegramRuntimeSource, l as principalRuntimeSource, u as runtimeEnvelope } from "../../../_chunks/principal-
|
|
8
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
7
|
+
import { d as telegramRuntimeSource, l as principalRuntimeSource, u as runtimeEnvelope } from "../../../_chunks/principal-BIX7T6Hh.mjs";
|
|
8
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-C0Kz75P3.mjs";
|
|
9
9
|
import { n as currentInboundRequest } from "../../../_chunks/inbound-request-DgQB4g1J.mjs";
|
|
10
10
|
import { object } from "../confirmation-description.mjs";
|
|
11
11
|
import { needsConfirmation } from "../confirmations.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentIdentities } from "../identities.js";
|
|
2
|
-
import type { AgentChats } from "
|
|
2
|
+
import type { AgentChats } from "../chats.js";
|
|
3
3
|
/** Membership updates have no message for Eve to route. Report them at the verified webhook boundary. */
|
|
4
4
|
export declare function reportMembership(input: {
|
|
5
5
|
readonly update: Record<string, unknown>;
|
|
@@ -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 TELEGRAM_AUTHENTICATOR, n as conversationLanguage, r as identityProviderOf, i as memberIdOf, a as rolesOf, o as telegramPrincipal } from "../../../_chunks/principal-
|
|
7
|
+
export { t as TELEGRAM_AUTHENTICATOR, n as conversationLanguage, r as identityProviderOf, i as memberIdOf, a as rolesOf, o as telegramPrincipal } from "../../../_chunks/principal-BIX7T6Hh.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 { d as telegramRuntimeSource, u as runtimeEnvelope } from "../../../_chunks/principal-
|
|
7
|
+
import { d as telegramRuntimeSource, u as runtimeEnvelope } from "../../../_chunks/principal-BIX7T6Hh.mjs";
|
|
8
8
|
import { workspaceAction } from "./workspace-action.mjs";
|
|
9
9
|
import { STRUCTURED_KINDS } from "./structured-settings.mjs";
|
|
10
10
|
const record = (value) => {
|
|
@@ -8,7 +8,7 @@ import { telegramText } from "./texts.mjs";
|
|
|
8
8
|
import { confirmationLocale } from "./confirmation-text.mjs";
|
|
9
9
|
import { recordSessionFailure } from "./conversations.mjs";
|
|
10
10
|
import { c as customerCopy, d as failureText, o as currentLocale, p as reportTelegramError, s as currentThreadId } from "../../../_chunks/inbound-request-DgQB4g1J.mjs";
|
|
11
|
-
import { i as memberIdOf } from "../../../_chunks/principal-
|
|
11
|
+
import { i as memberIdOf } from "../../../_chunks/principal-BIX7T6Hh.mjs";
|
|
12
12
|
import { modelServiceFailure } from "../model-service-failure.mjs";
|
|
13
13
|
function telegramFailureEvents(input) {
|
|
14
14
|
return {
|
|
@@ -70,7 +70,9 @@ export declare function segmentstreamWhatsApp(options: WhatsAppChannelOptions):
|
|
|
70
70
|
* after answering anyone else with the workspace's reply, if it has one.
|
|
71
71
|
*/
|
|
72
72
|
export declare function receive(input: {
|
|
73
|
+
/** The Chat SDK thread: its id names the conversation, one person's chat with the number. */
|
|
73
74
|
readonly thread: {
|
|
75
|
+
readonly id: string;
|
|
74
76
|
readonly post: (text: string) => Promise<unknown>;
|
|
75
77
|
};
|
|
76
78
|
readonly message: Pick<Message, "author" | "text" | "attachments">;
|
|
@@ -6,6 +6,7 @@ __eveDirname(__filename);
|
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { admitMessage, localizedText } from "../admission.mjs";
|
|
8
8
|
import { chatSdkButtonAnswer, withButtonDecision } from "../confirmation-buttons.mjs";
|
|
9
|
+
import { withConversation } from "../conversation.mjs";
|
|
9
10
|
import { redactDiagnostic } from "../diagnostics.mjs";
|
|
10
11
|
import { MAXIMUM_DOWNLOAD_BYTES, connectionProxy } from "../connection-proxy.mjs";
|
|
11
12
|
import { appOrigin, channelsEnabled, proxyEnvironment, webhookSecret } from "../environment.mjs";
|
|
@@ -201,7 +202,13 @@ async function receive(input) {
|
|
|
201
202
|
});
|
|
202
203
|
switch (resolution.status) {
|
|
203
204
|
case "existing":
|
|
204
|
-
case "created": return turn ? whatsappPrincipal(resolution.member, sender)
|
|
205
|
+
case "created": return turn ? withConversation(whatsappPrincipal(resolution.member, sender), {
|
|
206
|
+
provider: "whatsapp",
|
|
207
|
+
chatId: thread.id,
|
|
208
|
+
threadId: "",
|
|
209
|
+
kind: "private",
|
|
210
|
+
peer: sender
|
|
211
|
+
}) : void 0;
|
|
205
212
|
case "pairing_required": {
|
|
206
213
|
const text = localizedText(admission.replies.pairingRequired);
|
|
207
214
|
if (text !== void 0) {
|
package/dist/extension/model.mjs
CHANGED
|
@@ -6,7 +6,7 @@ __eveDirname(__filename);
|
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { chatModelChoiceOf } from "./config.mjs";
|
|
8
8
|
import { isPreview } from "./lib/environment.mjs";
|
|
9
|
-
import { a as rolesOf } from "../_chunks/principal-
|
|
9
|
+
import { a as rolesOf } from "../_chunks/principal-BIX7T6Hh.mjs";
|
|
10
10
|
import { defineDynamic } from "eve";
|
|
11
11
|
import { runs } from "eve/events";
|
|
12
12
|
function chooseModel(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 { u as runtimeEnvelope } from "../../_chunks/principal-
|
|
7
|
+
import { u as runtimeEnvelope } from "../../_chunks/principal-BIX7T6Hh.mjs";
|
|
8
8
|
import segmentstream from "../extension.mjs";
|
|
9
9
|
import { n as workflowToolResult } from "../../_chunks/workflow-serializable-DU7WeCIW.mjs";
|
|
10
10
|
import { actionApproval } from "../lib/confirmations.mjs";
|
|
@@ -7,8 +7,9 @@ __eveCreateRequire(import.meta.url);
|
|
|
7
7
|
import { n as workflowToolResult } from "../../_chunks/workflow-serializable-DU7WeCIW.mjs";
|
|
8
8
|
import { agentTaskIdOf, agentTaskSessions } from "../lib/agent-task.mjs";
|
|
9
9
|
import { stringArgument } from "../lib/attachment-tools.mjs";
|
|
10
|
+
import { conversationOf } from "../lib/conversation.mjs";
|
|
10
11
|
import { pendingQuestions, questionKey } from "../lib/questions.mjs";
|
|
11
|
-
import { i as memberIdOf } from "../../_chunks/principal-
|
|
12
|
+
import { i as memberIdOf } from "../../_chunks/principal-BIX7T6Hh.mjs";
|
|
12
13
|
import { defineTool } from "eve/tools";
|
|
13
14
|
var questions_ask_default = defineTool({
|
|
14
15
|
availableInSubagents: false,
|
|
@@ -42,6 +43,8 @@ var questions_ask_default = defineTool({
|
|
|
42
43
|
} : task);
|
|
43
44
|
return workflowToolResult({ question: text }, ctx);
|
|
44
45
|
}
|
|
46
|
+
const conversation = conversationOf(ctx.session.auth.current);
|
|
47
|
+
if (conversation !== void 0 && conversation.provider !== "telegram") throw new Error(`questions_ask is unavailable in ${conversation.provider}: ask the question in your reply; the member's answer continues this conversation.`);
|
|
45
48
|
const memberId = memberIdOf(ctx.session.auth.current);
|
|
46
49
|
const chatId = ctx.session.auth.current?.attributes.chatId;
|
|
47
50
|
if (memberId === void 0 || typeof chatId !== "string") throw new Error("A member in a chat is required.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.1",
|
|
4
4
|
"description": "Mount a SegmentStream workspace's agent on eve: the ontology as tools, acting as the member who writes, and Telegram, WhatsApp and Slack through the workspace's connections.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SegmentStream",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@chat-adapter/state-memory": "4.42.0",
|
|
77
77
|
"@chat-adapter/telegram": "4.41.0",
|
|
78
78
|
"@chat-adapter/whatsapp": "4.42.0",
|
|
79
|
-
"@segmentstream/ontology": "0.
|
|
79
|
+
"@segmentstream/ontology": "0.93.0",
|
|
80
80
|
"@vercel/oidc": "^3.8.4",
|
|
81
81
|
"ai": "^7.0.137",
|
|
82
82
|
"chat": "4.42.0",
|