@segmentstream/agent 0.23.0 → 0.23.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 +9 -4
- package/dist/_chunks/{build-metadata-CfqAnu3o.mjs → build-metadata-CKvMES1d.mjs} +1 -1
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/telegram/adapter.mjs +2 -2
- package/dist/extension/lib/telegram/confirmations.d.ts +1 -1
- package/dist/extension/lib/telegram/confirmations.mjs +6 -3
- package/dist/extension/lib/telegram/health.mjs +1 -1
- package/dist/extension/lib/telegram/lifecycle.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -899,10 +899,15 @@ visible below the heading. Without a template the existing destination heading
|
|
|
899
899
|
is preserved. A heading that makes the complete card too long is rejected before
|
|
900
900
|
posting; it never truncates the preview.
|
|
901
901
|
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
902
|
+
In the default `chat` session scope, a Telegram session awaiting a confirmation or
|
|
903
|
+
an answer adds no topic or member-question alias: the topic address already routes
|
|
904
|
+
every message of the chat to it. A recovered session therefore never claims the
|
|
905
|
+
original inbox, whose predecessor may still own its durable hook; Eve ends a session
|
|
906
|
+
when another run holds an alias it claims. In `thread` scope the session adds those
|
|
907
|
+
aliases so untagged answers reach it. A recovered thread session skips them only
|
|
908
|
+
until its first group post, because Eve exposes its latest alias as the continuation.
|
|
909
|
+
Confirmation callbacks retain the recorded owner and the usual requester, expiry and
|
|
910
|
+
idempotency checks.
|
|
906
911
|
|
|
907
912
|
### Sending to the registered Telegram channel
|
|
908
913
|
|
|
@@ -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.23.
|
|
7
|
+
var version = "0.23.1";
|
|
8
8
|
function agentBuild(environment = process.env) {
|
|
9
9
|
return {
|
|
10
10
|
agent: version,
|
|
@@ -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 { t as agentBuild } from "../../_chunks/build-metadata-
|
|
7
|
+
import { t as agentBuild } from "../../_chunks/build-metadata-CKvMES1d.mjs";
|
|
8
8
|
export { agentBuild };
|
|
@@ -24,7 +24,7 @@ import { MAXIMUM_DOWNLOAD_BYTES, connectionProxy } from "../connection-proxy.mjs
|
|
|
24
24
|
import { dispatchStructuredMessage, structuredMessage } from "./structured.mjs";
|
|
25
25
|
import { scopedAddress, sessionPolicy } from "./sessions.mjs";
|
|
26
26
|
import { handleWorkspaceCallback, isWorkspaceCallback } from "./callbacks.mjs";
|
|
27
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
27
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-CKvMES1d.mjs";
|
|
28
28
|
import { attachmentLifecycle } from "./lifecycle.mjs";
|
|
29
29
|
import { observedMessages } from "./observed.mjs";
|
|
30
30
|
import { expireDeferredCards, handleDeferredCallback, isDeferredCallback } from "./deferred-confirmations.mjs";
|
|
@@ -173,7 +173,7 @@ function segmentstreamTelegram(options) {
|
|
|
173
173
|
environment,
|
|
174
174
|
token,
|
|
175
175
|
...options.fetch ? { fetch: options.fetch } : {}
|
|
176
|
-
});
|
|
176
|
+
}, () => options.sessions().scope);
|
|
177
177
|
const channel = telegramChannel({
|
|
178
178
|
turnPolicy: "queue",
|
|
179
179
|
api: {
|
|
@@ -24,5 +24,5 @@ export declare function handleConfirmationCallback(input: {
|
|
|
24
24
|
readonly scope: "chat" | "thread";
|
|
25
25
|
readonly now?: number;
|
|
26
26
|
}): Promise<void>;
|
|
27
|
-
export declare function telegramConfirmationEvents(archive?: Conversations, observed?: ObservedMessages, deferredOptions?: DeferredOptions): TelegramChannelEvents & Pick<ChannelEvents<TelegramEventContext>, "context.settled">;
|
|
27
|
+
export declare function telegramConfirmationEvents(archive?: Conversations, observed?: ObservedMessages, deferredOptions?: DeferredOptions, scope?: () => "chat" | "thread"): TelegramChannelEvents & Pick<ChannelEvents<TelegramEventContext>, "context.settled">;
|
|
28
28
|
export declare const confirmationEvents: TelegramChannelEvents & Pick<ChannelEvents<TelegramEventContext>, "context.settled">;
|
|
@@ -22,6 +22,9 @@ import { createHash } from "node:crypto";
|
|
|
22
22
|
import { telegramTextLinks } from "@segmentstream-cloud/ontology/telegram";
|
|
23
23
|
const PREFIX = "ss-confirm:";
|
|
24
24
|
const recoveredContinuation = (address) => address !== void 0 && /:recovery:[a-f0-9]{64}$/u.test(address);
|
|
25
|
+
function aliasesPendingTopic(scope, token) {
|
|
26
|
+
return scope !== "chat" && !recoveredContinuation(token);
|
|
27
|
+
}
|
|
25
28
|
function shortHash(value) {
|
|
26
29
|
return createHash("sha256").update(value).digest("hex").slice(0, 20);
|
|
27
30
|
}
|
|
@@ -199,7 +202,7 @@ function messagePrompt(message) {
|
|
|
199
202
|
at: new Date().toISOString()
|
|
200
203
|
};
|
|
201
204
|
}
|
|
202
|
-
function telegramConfirmationEvents(archive, observed, deferredOptions) {
|
|
205
|
+
function telegramConfirmationEvents(archive, observed, deferredOptions, scope) {
|
|
203
206
|
const remember = (channel, ctx, messageId, text, confirmation) => {
|
|
204
207
|
const principal = ctx.session.auth.current;
|
|
205
208
|
const name = humanText(principal?.attributes.memberName);
|
|
@@ -340,7 +343,7 @@ function telegramConfirmationEvents(archive, observed, deferredOptions) {
|
|
|
340
343
|
};
|
|
341
344
|
const sent = await withConfirmationPrompt(prompt, () => exactPost ? withChatPostCard(text, send, copy.previewLinks) : withConfirmationText(text, send));
|
|
342
345
|
remember(channel, ctx, sent.id, text, prompt);
|
|
343
|
-
if (
|
|
346
|
+
if (aliasesPendingTopic(scope?.(), channel.continuation?.token)) channel.continuation?.alias(formatAddress({
|
|
344
347
|
chatId: channel.telegram.chatId,
|
|
345
348
|
messageThreadId: String(channel.telegram.messageThreadId ?? ""),
|
|
346
349
|
conversationId: ""
|
|
@@ -448,7 +451,7 @@ function telegramConfirmationEvents(archive, observed, deferredOptions) {
|
|
|
448
451
|
...state.pendingQuestions,
|
|
449
452
|
[questionKey(saved)]: saved
|
|
450
453
|
};
|
|
451
|
-
if (
|
|
454
|
+
if (aliasesPendingTopic(scope?.(), address)) {
|
|
452
455
|
channel.continuation?.alias(formatAddress({
|
|
453
456
|
chatId: question.chatId,
|
|
454
457
|
messageThreadId: question.messageThreadId,
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { runtimeRequestFailure } from "./runtime-request.mjs";
|
|
8
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
8
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-CKvMES1d.mjs";
|
|
9
9
|
import { GET } from "eve/channels";
|
|
10
10
|
const HEALTH_ROUTE = "/eve/v1/telegram/health";
|
|
11
11
|
function healthRoute(input) {
|
|
@@ -10,7 +10,7 @@ import { n as currentInboundRequest, p as reportTelegramError } from "../../../_
|
|
|
10
10
|
import { member } from "../actor.mjs";
|
|
11
11
|
import { needsConfirmation } from "../confirmations.mjs";
|
|
12
12
|
import { OntologyActionNotPermitted, actionToolName, ontologyTools } from "../ontology-tools.mjs";
|
|
13
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
13
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-CKvMES1d.mjs";
|
|
14
14
|
var AttachmentLifecycleNotPermitted = class extends Error {
|
|
15
15
|
code = "attachment_lifecycle_not_permitted";
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/agent",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.1",
|
|
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",
|