@segmentstream/agent 0.22.5 → 0.22.6
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 +15 -0
- package/dist/_chunks/{build-metadata-CWgw4jwP.mjs → build-metadata-C9CHlcKU.mjs} +1 -1
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/telegram/adapter.mjs +1 -1
- package/dist/extension/lib/telegram/chat-post-card.mjs +2 -1
- package/dist/extension/lib/telegram/confirmations.mjs +10 -7
- package/dist/extension/lib/telegram/health.mjs +1 -1
- package/dist/extension/lib/telegram/lifecycle.mjs +1 -1
- package/dist/extension/lib/telegram/texts.d.ts +1 -1
- package/dist/extension/lib/telegram/texts.mjs +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -874,3 +874,18 @@ later changes are delivered. Active means its published generation is usable; it
|
|
|
874
874
|
does not prove that the warehouse has every recent write. Use the reported source
|
|
875
875
|
freshness watermark when reading aggregates. Initial copies and replay remain
|
|
876
876
|
unavailable until their required verification and publication finish.
|
|
877
|
+
|
|
878
|
+
### Exact-post preview wording
|
|
879
|
+
|
|
880
|
+
`texts.chatPost.previewPrivate` and `previewGroup` optionally provide localized
|
|
881
|
+
confirmation headings for Telegram private chats and groups. Templates substitute
|
|
882
|
+
`{recipient}`, `{signature}` and `{provider}` from the resolved, frozen preview;
|
|
883
|
+
substituted values are literal text. The exact message and its attribution remain
|
|
884
|
+
visible below the heading. Without a template the existing destination heading
|
|
885
|
+
is preserved. A heading that makes the complete card too long is rejected before
|
|
886
|
+
posting; it never truncates the preview.
|
|
887
|
+
|
|
888
|
+
Recovered Telegram sessions retain their recovery continuation while awaiting a
|
|
889
|
+
confirmation or an answer. They do not alias the original inbox, whose predecessor
|
|
890
|
+
may still own its durable hook. Confirmation callbacks retain the recorded owner
|
|
891
|
+
and the usual requester, expiry and idempotency checks.
|
|
@@ -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.22.
|
|
7
|
+
var version = "0.22.6";
|
|
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-C9CHlcKU.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-C9CHlcKU.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";
|
|
@@ -29,9 +29,10 @@ function chatPostCard(description, copy) {
|
|
|
29
29
|
const preview = description.chatPost;
|
|
30
30
|
if (preview === void 0) throw new Error("An exact chat preview is required.");
|
|
31
31
|
const base = renderConfirmation(description, copy);
|
|
32
|
+
const destination = telegramText("chatPost", preview.externalId.startsWith("-") ? "previewGroup" : "previewPrivate")?.replace(/\{(recipient|signature|provider)\}/gu, (_, key) => key === "recipient" ? preview.title : key === "signature" ? preview.attribution : preview.provider);
|
|
32
33
|
const text = [
|
|
33
34
|
base.text,
|
|
34
|
-
`${preview.title} (${preview.provider})`,
|
|
35
|
+
destination ?? `${preview.title} (${preview.provider})`,
|
|
35
36
|
...preview.replyTo === null ? [] : [preview.replyTo]
|
|
36
37
|
].map(escapeMarkdownV2).join("\n") + `\n\n${preview.finalText}`;
|
|
37
38
|
const receiptSpace = RECEIPT_DATA_SPACE + Math.max(...["sent", "uncertain"].map((status) => escapeMarkdownV2(telegramText("chatPost", status) ?? "").length)) + escapeMarkdownV2(telegramText("chatPost", "historyNotRecorded") ?? "").length;
|
|
@@ -21,6 +21,7 @@ import { call } from "eve/events";
|
|
|
21
21
|
import { createHash } from "node:crypto";
|
|
22
22
|
import { telegramTextLinks } from "@segmentstream-cloud/ontology/telegram";
|
|
23
23
|
const PREFIX = "ss-confirm:";
|
|
24
|
+
const recoveredContinuation = (address) => address !== void 0 && /:recovery:[a-f0-9]{64}$/u.test(address);
|
|
24
25
|
function shortHash(value) {
|
|
25
26
|
return createHash("sha256").update(value).digest("hex").slice(0, 20);
|
|
26
27
|
}
|
|
@@ -339,7 +340,7 @@ function telegramConfirmationEvents(archive, observed, deferredOptions) {
|
|
|
339
340
|
};
|
|
340
341
|
const sent = await withConfirmationPrompt(prompt, () => exactPost ? withChatPostCard(text, send, copy.previewLinks) : withConfirmationText(text, send));
|
|
341
342
|
remember(channel, ctx, sent.id, text, prompt);
|
|
342
|
-
channel.continuation?.alias(formatAddress({
|
|
343
|
+
if (!recoveredContinuation(channel.continuation?.token)) channel.continuation?.alias(formatAddress({
|
|
343
344
|
chatId: channel.telegram.chatId,
|
|
344
345
|
messageThreadId: String(channel.telegram.messageThreadId ?? ""),
|
|
345
346
|
conversationId: ""
|
|
@@ -447,12 +448,14 @@ function telegramConfirmationEvents(archive, observed, deferredOptions) {
|
|
|
447
448
|
...state.pendingQuestions,
|
|
448
449
|
[questionKey(saved)]: saved
|
|
449
450
|
};
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
451
|
+
if (!recoveredContinuation(address)) {
|
|
452
|
+
channel.continuation?.alias(formatAddress({
|
|
453
|
+
chatId: question.chatId,
|
|
454
|
+
messageThreadId: question.messageThreadId,
|
|
455
|
+
conversationId: ""
|
|
456
|
+
}));
|
|
457
|
+
channel.continuation?.alias(questionAddress(saved));
|
|
458
|
+
}
|
|
456
459
|
const sent = await channel.telegram.post({
|
|
457
460
|
text: question.question,
|
|
458
461
|
reply_markup: {
|
|
@@ -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-C9CHlcKU.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-C9CHlcKU.mjs";
|
|
14
14
|
var AttachmentLifecycleNotPermitted = class extends Error {
|
|
15
15
|
code = "attachment_lifecycle_not_permitted";
|
|
16
16
|
};
|
|
@@ -2,7 +2,7 @@ import type { LocalizedText } from "../../config.js";
|
|
|
2
2
|
export declare const TELEGRAM_TEXT_KEYS: {
|
|
3
3
|
readonly callback: readonly ["error", "unknown", "forbidden", "expired", "already", "unsupported"];
|
|
4
4
|
readonly confirmation: readonly ["question", "confirm", "cancel", "edit", "executing", "done", "cancelled", "failed", "expired", "interrupted"];
|
|
5
|
-
readonly chatPost: readonly ["sent", "uncertain", "historyNotRecorded"];
|
|
5
|
+
readonly chatPost: readonly ["sent", "uncertain", "historyNotRecorded", "previewPrivate", "previewGroup"];
|
|
6
6
|
readonly notice: readonly ["failed", "modelBudgetExceeded", "modelUnavailable", "recovery", "attachment", "authorization", "response", "connected", "disconnected", "cancelled"];
|
|
7
7
|
readonly authorization: readonly ["prompt", "url", "button"];
|
|
8
8
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/agent",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.6",
|
|
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",
|