@segmentstream/agent 0.31.13 → 0.32.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.
Files changed (48) hide show
  1. package/dist/_chunks/{build-metadata-q7uPSqUP.mjs → build-metadata-B_hCvO_v.mjs} +1 -1
  2. package/dist/_chunks/{inbound-request-Dy7q3T23.mjs → inbound-request-BQQWCrWl.mjs} +7 -3
  3. package/dist/_chunks/{principal-CPOCTHBa.mjs → principal-VsmaJp1x.mjs} +1 -1
  4. package/dist/extension/hooks/authorization.mjs +1 -1
  5. package/dist/extension/instructions.md +6 -2
  6. package/dist/extension/lib/actor.mjs +1 -1
  7. package/dist/extension/lib/attachment-tools.mjs +1 -1
  8. package/dist/extension/lib/build-metadata.mjs +1 -1
  9. package/dist/extension/lib/chat-context.mjs +1 -1
  10. package/dist/extension/lib/confirmation-description.d.ts +45 -0
  11. package/dist/extension/lib/confirmation-description.mjs +60 -1
  12. package/dist/extension/lib/confirmations.d.ts +7 -1
  13. package/dist/extension/lib/confirmations.mjs +5 -4
  14. package/dist/extension/lib/conversation-runtime.mjs +1 -1
  15. package/dist/extension/lib/ontology-connection.mjs +1 -1
  16. package/dist/extension/lib/ontology-file-call.mjs +3 -3
  17. package/dist/extension/lib/ontology-tools.d.ts +2 -1
  18. package/dist/extension/lib/ontology-tools.mjs +48 -4
  19. package/dist/extension/lib/runtime-envelope.mjs +1 -1
  20. package/dist/extension/lib/stored-files.mjs +1 -1
  21. package/dist/extension/lib/telegram/adapter.mjs +3 -3
  22. package/dist/extension/lib/telegram/attachment-description.mjs +1 -1
  23. package/dist/extension/lib/telegram/attachments-send.mjs +2 -2
  24. package/dist/extension/lib/telegram/callbacks.mjs +2 -2
  25. package/dist/extension/lib/telegram/confirmation-text.d.ts +52 -4
  26. package/dist/extension/lib/telegram/confirmation-text.mjs +84 -15
  27. package/dist/extension/lib/telegram/confirmations.d.ts +9 -0
  28. package/dist/extension/lib/telegram/confirmations.mjs +46 -14
  29. package/dist/extension/lib/telegram/conversations.mjs +1 -1
  30. package/dist/extension/lib/telegram/customer-text.mjs +1 -1
  31. package/dist/extension/lib/telegram/files.mjs +2 -2
  32. package/dist/extension/lib/telegram/format.d.ts +4 -0
  33. package/dist/extension/lib/telegram/health.mjs +1 -1
  34. package/dist/extension/lib/telegram/images.mjs +1 -1
  35. package/dist/extension/lib/telegram/inbound-request.mjs +1 -1
  36. package/dist/extension/lib/telegram/inbound.mjs +2 -2
  37. package/dist/extension/lib/telegram/lifecycle.mjs +3 -3
  38. package/dist/extension/lib/telegram/media-policy.mjs +1 -1
  39. package/dist/extension/lib/telegram/principal.mjs +1 -1
  40. package/dist/extension/lib/telegram/session-recovery.mjs +1 -1
  41. package/dist/extension/lib/telegram/silent.mjs +1 -1
  42. package/dist/extension/lib/telegram/structured.mjs +1 -1
  43. package/dist/extension/lib/telegram/turn-errors.mjs +2 -2
  44. package/dist/extension/lib/telegram/voice.mjs +1 -1
  45. package/dist/extension/model.mjs +1 -1
  46. package/dist/extension/tools/attachments_promote.mjs +3 -3
  47. package/dist/extension/tools/questions_ask.mjs +1 -1
  48. package/package.json +2 -2
@@ -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.31.13";
7
+ var version = "0.32.0";
8
8
  function agentBuild(environment = process.env) {
9
9
  return {
10
10
  agent: version,
@@ -8,7 +8,7 @@ import { telegramText } from "../extension/lib/telegram/texts.mjs";
8
8
  import { isTechnicalText } from "../extension/lib/customer-text-safety.mjs";
9
9
  import { redactTelegramDiagnostic } from "../extension/lib/telegram/diagnostic-redaction.mjs";
10
10
  import { chatPostCardLinks, isExactChatPostCard } from "../extension/lib/telegram/chat-post-card.mjs";
11
- import { isConfirmationText } from "../extension/lib/telegram/confirmation-text.mjs";
11
+ import { confirmationEntities } from "../extension/lib/telegram/confirmation-text.mjs";
12
12
  import { plainTelegramText, splitTelegramText, telegramMarkdown } from "../extension/lib/telegram/format.mjs";
13
13
  import { inTelegramSendQueue } from "../extension/lib/telegram/send-queue.mjs";
14
14
  import { retainDeliveryDiagnostic } from "../extension/lib/telegram/delivery-diagnostics.mjs";
@@ -140,9 +140,13 @@ function safeTelegramFetch(fetchImpl, scope = "telegram", previews = {}) {
140
140
  if (typeof body[field] === "string" && !isExactChatPostCard(body[field])) {
141
141
  const entityField = field === "text" ? "entities" : "caption_entities";
142
142
  const existing = body[entityField];
143
- const message = Array.isArray(existing) || isConfirmationText(body[field]) ? {
143
+ const card = confirmationEntities(body[field]);
144
+ const message = card !== void 0 ? {
144
145
  text: body[field],
145
- entities: existing ?? []
146
+ entities: [...card]
147
+ } : Array.isArray(existing) ? {
148
+ text: body[field],
149
+ entities: existing
146
150
  } : guardedCustomerMessage(body[field], currentLocale(), () => {
147
151
  textBlocked = true;
148
152
  });
@@ -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 currentInboundRequest } from "./inbound-request-Dy7q3T23.mjs";
7
+ import { n as currentInboundRequest } from "./inbound-request-BQQWCrWl.mjs";
8
8
  import "../extension/lib/agent-task.mjs";
9
9
  import { randomUUID } from "node:crypto";
10
10
  function telegramRuntimeSource(message, files, callbackQueryId) {
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
7
7
  import segmentstream from "../extension.mjs";
8
8
  import { localizedText } from "../lib/admission.mjs";
9
9
  import { confirmationLocale } from "../lib/telegram/confirmation-text.mjs";
10
- import "../../_chunks/principal-CPOCTHBa.mjs";
10
+ import "../../_chunks/principal-VsmaJp1x.mjs";
11
11
  import { defineHook } from "eve/hooks";
12
12
  var authorization_default = defineHook({ events: { "interaction.opened": (event, context) => {
13
13
  const principal = context.session.auth.current;
@@ -37,8 +37,10 @@ turn's own input with its `<speaker>` and `<message_audience>` blocks; use the a
37
37
  and rich mentions for addressing.
38
38
 
39
39
  In Telegram, reply in the member's conversation language. After an action, use at most one short
40
- human sentence saying what changed and where, with a link to the record in the app. Confirmations
41
- already show their status. Never quote tool output, tool names, record ids, JSON, stack traces or
40
+ human sentence saying what changed and where, with a link to the record in the app. A confirmation
41
+ card is the whole exchange for its action: it shows what will happen and then its outcome, so do
42
+ not announce the action before its card, and add nothing after it unless there is something the
43
+ card does not say, such as a next step. Never quote tool output, tool names, record ids, JSON, stack traces or
42
44
  internal errors; explain failures briefly with an error reference when available. When
43
45
  `<message_audience>` has `engagement_policy` `conversation` and the member declines your
44
46
  involvement or closes the conversation, output exactly `[SILENT]`; do not acknowledge the
@@ -77,6 +79,8 @@ rejection or perform actions.
77
79
  adds trusted facts. Omit this argument on older tools without schema support.
78
80
  Use distinct confirm/cancel labels; all visible wording comes from the workspace. If trusted
79
81
  target titles are unavailable or the facts are too long, resolve the targets or narrow the call.
82
+ An action can describe its own card; when it refuses the input instead, the call is refused
83
+ before any card with the action's reason: tell the member that reason and do not retry.
80
84
  Cancel ends that call; retry it only after a new instruction from the member.
81
85
  - Every change goes through an action. Report results after success; never claim a record changed
82
86
  unless an action reported it.
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { AGENT_TASK_HEADER, agentTaskIdOf, taskSecret } from "./agent-task.mjs";
8
- import { i as memberIdOf, r as identityProviderOf } from "../../_chunks/principal-CPOCTHBa.mjs";
8
+ import { i as memberIdOf, r as identityProviderOf } from "../../_chunks/principal-VsmaJp1x.mjs";
9
9
  import { defineDynamic } from "eve/tools";
10
10
  const ACT_AS_HEADER = "X-SegmentStream-Act-As";
11
11
  function member(memberId) {
@@ -10,7 +10,7 @@ import { readSheets, typedTable } from "./attachment-tables.mjs";
10
10
  import { appOrigin } from "./environment.mjs";
11
11
  import { runtimeToken } from "./runtime-token.mjs";
12
12
  import { telegramConversation } from "./telegram/files.mjs";
13
- import { i as memberIdOf } from "../../_chunks/principal-CPOCTHBa.mjs";
13
+ import { i as memberIdOf } from "../../_chunks/principal-VsmaJp1x.mjs";
14
14
  const MAXIMUM_TEXT_CHARACTERS = 5e4;
15
15
  const MAXIMUM_INLINE_BYTES = 5242880;
16
16
  var AttachmentOwnerError = class extends Error {
@@ -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-q7uPSqUP.mjs";
7
+ export { t as agentBuild } from "../../_chunks/build-metadata-B_hCvO_v.mjs";
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
7
7
  import { agentTaskIdOf } from "./agent-task.mjs";
8
8
  import { conversationCoordinates } from "./conversation-runtime.mjs";
9
9
  import { collapseConversationEvents, conversations, topicContext } from "./conversations.mjs";
10
- import { p as reportTelegramError } from "../../_chunks/inbound-request-Dy7q3T23.mjs";
10
+ import { p as reportTelegramError } from "../../_chunks/inbound-request-BQQWCrWl.mjs";
11
11
  import { deliveries, runs, turns } from "eve/events";
12
12
  import { createHash } from "node:crypto";
13
13
  import { defineState } from "eve/context";
@@ -1,6 +1,31 @@
1
1
  import type { ChatPostPreview } from "./chat-post-confirmation.js";
2
+ /** One line of an action's own confirmation: what the person checks before confirming. */
3
+ export interface ConfirmationCardFact {
4
+ readonly icon?: string;
5
+ readonly text: string;
6
+ /** A page that shows what the line names; the line links to it. */
7
+ readonly url?: string;
8
+ }
9
+ /**
10
+ * The confirmation an action describes itself, through the ontology's preview, in the chat's
11
+ * language: its title and the facts the person checks, already checked as safe to show.
12
+ */
13
+ export interface ConfirmationCard {
14
+ readonly title: string;
15
+ readonly icon?: string;
16
+ readonly facts: readonly ConfirmationCardFact[];
17
+ /** Secondary detail, shown collapsed. */
18
+ readonly details: readonly string[];
19
+ /** A page about what the action concerns, shown as a button. */
20
+ readonly link?: {
21
+ readonly text: string;
22
+ readonly url: string;
23
+ };
24
+ }
2
25
  /** Only human-facing facts cross into the confirmation renderer; identifiers stay in the gate. */
3
26
  export interface ConfirmationDescription {
27
+ /** The action's own confirmation; the fields below are then not shown. */
28
+ readonly card?: ConfirmationCard;
4
29
  readonly action: string;
5
30
  readonly entity?: string;
6
31
  readonly description?: string;
@@ -16,6 +41,14 @@ export interface ConfirmationDescription {
16
41
  readonly chatPost?: ChatPostPreview;
17
42
  readonly warning?: boolean;
18
43
  }
44
+ /**
45
+ * The action refuses the input it would be confirmed with, in its own words: no card is shown, and
46
+ * the agent tells the member why.
47
+ */
48
+ export declare class ConfirmationRefused extends Error {
49
+ readonly reason: string;
50
+ constructor(reason: string);
51
+ }
19
52
  /** A target the card cannot name, by its field's safe label, so the model learns which one and why. */
20
53
  export declare class UnsafeConfirmationTarget extends Error {
21
54
  readonly label: string;
@@ -34,6 +67,18 @@ export declare function humanText(value: unknown, maximum?: number): string | un
34
67
  export declare function fieldSchema(value: unknown, root: Record<string, unknown>, depth?: number): Record<string, unknown>;
35
68
  /** The annotation in which the ontology lists a confirmable action's card facts. */
36
69
  export declare const CONFIRMATION_FACTS = "segmentstream/confirmation";
70
+ /**
71
+ * The JSON-RPC method that asks an action, whose card facts carry `preview`, what its member
72
+ * confirms instead of running it: `{ name, arguments, locale }`. The ontology answers as
73
+ * `tools/call` does, with `{ confirmation }`; an ontology without the method, or a tool that no
74
+ * longer describes its confirmation, answers with an error and runs nothing.
75
+ */
76
+ export declare const CONFIRMATION_PREVIEW_METHOD = "segmentstream/confirmation/preview";
77
+ /**
78
+ * The confirmation an action described, checked as every card fact is: plain text without ids,
79
+ * codes or markup, emoji markers and https links. It throws on anything else, saying what.
80
+ */
81
+ export declare function confirmationCard(value: unknown): ConfirmationCard;
37
82
  /**
38
83
  * The trusted inputs of {@link describeConfirmation} from the card facts the ontology lists in a
39
84
  * confirmable tool's annotations: each listed field's label, its options' labels, and for a record
@@ -5,6 +5,14 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { isTechnicalText, withoutEmailAddresses } from "./customer-text-safety.mjs";
8
+ var ConfirmationRefused = class extends Error {
9
+ reason;
10
+ constructor(reason) {
11
+ super(reason);
12
+ this.reason = reason;
13
+ this.name = "ConfirmationRefused";
14
+ }
15
+ };
8
16
  var UnsafeConfirmationTarget = class extends Error {
9
17
  label;
10
18
  constructor(label) {
@@ -51,6 +59,57 @@ function fieldSchema(value, root, depth = 0) {
51
59
  return Object.assign({}, ...ref === void 0 ? [] : [fieldSchema(referenced, root, depth + 1)], ...branches.map((branch) => fieldSchema(branch, root, depth + 1)), schema);
52
60
  }
53
61
  const CONFIRMATION_FACTS = "segmentstream/confirmation";
62
+ const CONFIRMATION_PREVIEW_METHOD = "segmentstream/confirmation/preview";
63
+ const ICON = /^[\p{Extended_Pictographic}\p{Regional_Indicator}\u{1F3FB}-\u{1F3FF}\u200D\uFE0F\u20E3#*0-9]{1,16}$/u;
64
+ function cardIcon(value, where) {
65
+ if (value === void 0) return;
66
+ if (typeof value !== "string" || !ICON.test(value) || !/\p{Extended_Pictographic}|\p{Regional_Indicator}/u.test(value)) throw new Error(`The confirmation's ${where} icon is not an emoji.`);
67
+ return value;
68
+ }
69
+ const GRANTS = new RegExp("(?:^|[?&#])(?:x-amz-[^=&]*|x-goog-[^=&]*|sig|signature|token|access_token|key|api_key|secret|password|code|credential)=", "i");
70
+ function cardUrl(value, where) {
71
+ if (value === void 0) return;
72
+ let url;
73
+ try {
74
+ url = typeof value === "string" && value.length <= 2048 ? new URL(value) : void 0;
75
+ } catch {
76
+ url = void 0;
77
+ }
78
+ if (url === void 0 || url.protocol !== "https:" || url.username !== "" || url.password !== "" || GRANTS.test(`${url.search}${url.hash}`) || isTechnicalText(String(value))) throw new Error(`The confirmation's ${where} link is not a plain https page.`);
79
+ return String(value);
80
+ }
81
+ function cardText(value, maximum, where) {
82
+ const issue = humanTextIssue(value, maximum);
83
+ if (issue !== void 0) throw new Error(`The confirmation's ${where} ${issue}.`);
84
+ return value.trim();
85
+ }
86
+ function confirmationCard(value) {
87
+ const card = object(value);
88
+ const facts = Array.isArray(card.facts) ? card.facts : [];
89
+ const details = Array.isArray(card.details) ? card.details : [];
90
+ if (!Array.isArray(card.facts) || facts.length > 20 || details.length > 10) throw new Error("The confirmation has no facts list, or too many lines.");
91
+ const link = card.link === void 0 ? void 0 : object(card.link);
92
+ const icon = cardIcon(card.icon, "title");
93
+ return {
94
+ title: cardText(card.title, 80, "title"),
95
+ ...icon === void 0 ? {} : { icon },
96
+ facts: facts.map((item, index) => {
97
+ const fact = object(item);
98
+ const icon = cardIcon(fact.icon, `fact ${index + 1}`);
99
+ const url = cardUrl(fact.url, `fact ${index + 1}`);
100
+ return {
101
+ ...icon === void 0 ? {} : { icon },
102
+ text: cardText(fact.text, 300, `fact ${index + 1}`),
103
+ ...url === void 0 ? {} : { url }
104
+ };
105
+ }),
106
+ details: details.map((line, index) => cardText(line, 300, `detail ${index + 1}`)),
107
+ ...link === void 0 ? {} : { link: {
108
+ text: cardText(link.text, 40, "link"),
109
+ url: cardUrl(link.url, "link")
110
+ } }
111
+ };
112
+ }
54
113
  function factsConfirmation(facts) {
55
114
  const properties = {};
56
115
  const entities = new Map();
@@ -151,4 +210,4 @@ async function describeConfirmation(input) {
151
210
  ...targets.length === 0 ? {} : { targets }
152
211
  };
153
212
  }
154
- export { CONFIRMATION_FACTS, UnsafeConfirmationTarget, describeConfirmation, factsConfirmation, fieldSchema, humanText, humanTextIssue, humanize, object };
213
+ export { CONFIRMATION_FACTS, CONFIRMATION_PREVIEW_METHOD, ConfirmationRefused, UnsafeConfirmationTarget, confirmationCard, describeConfirmation, factsConfirmation, fieldSchema, humanText, humanTextIssue, humanize, object };
@@ -8,6 +8,8 @@ export declare const CONFIRMATION_TTL_MS: number;
8
8
  export interface ActionAnnotations {
9
9
  readonly readOnlyHint?: boolean;
10
10
  readonly confirmation?: boolean;
11
+ /** The action describes its own confirmation; the agent's presentation copy is optional. */
12
+ readonly preview?: boolean;
11
13
  readonly destructiveHint?: boolean;
12
14
  readonly irreversibleHint?: boolean;
13
15
  readonly idempotentHint?: boolean;
@@ -43,7 +45,11 @@ export declare const confirmations: StateHandle<Record<string, Confirmation>>;
43
45
  */
44
46
  export declare function actionApproval(options: {
45
47
  readonly labels: (actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>, signal?: AbortSignal, hints?: Readonly<Record<string, unknown>>) => Promise<ActionAnnotations>;
46
- readonly describe?: (actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>, hints?: Readonly<Record<string, unknown>>) => Promise<ConfirmationDescription>;
48
+ /**
49
+ * The card's trusted facts, or the action's own confirmation in the chat's `locale`. Throws
50
+ * {@link ConfirmationRefused} when the action refuses the input: no card is shown.
51
+ */
52
+ readonly describe?: (actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>, hints?: Readonly<Record<string, unknown>>, locale?: string) => Promise<ConfirmationDescription>;
47
53
  /**
48
54
  * The call's `_confirmation` when the tool input does not carry it itself, such as a file-backed
49
55
  * call whose arguments are snapshotted elsewhere. Defaults to the tool input's own field.
@@ -5,8 +5,8 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { actorOf, member } from "./actor.mjs";
8
- import { i as memberIdOf } from "../../_chunks/principal-CPOCTHBa.mjs";
9
- import { UnsafeConfirmationTarget } from "./confirmation-description.mjs";
8
+ import { i as memberIdOf } from "../../_chunks/principal-VsmaJp1x.mjs";
9
+ import { ConfirmationRefused, UnsafeConfirmationTarget } from "./confirmation-description.mjs";
10
10
  import { chatPostDigest, isChatPost } from "./chat-post-confirmation.mjs";
11
11
  import { confirmationCopy, confirmationCopyIssue, confirmationLocale, renderConfirmation } from "./telegram/confirmation-text.mjs";
12
12
  import { chatPostCard } from "./telegram/chat-post-card.mjs";
@@ -106,11 +106,12 @@ function actionApproval(options) {
106
106
  }
107
107
  if (saved !== void 0) return denied("The original call is waiting for its Confirm / Cancel buttons.");
108
108
  if (!posting && !needsConfirmation(labels)) return "approved";
109
- if (labels.confirmation === true && copy === void 0) return missingCopy();
109
+ if (labels.confirmation === true && labels.preview !== true && copy === void 0) return missingCopy();
110
110
  try {
111
- if (!posting) description = await options.describe?.(member(memberId), ctx.toolName, businessInput, hints);
111
+ if (!posting) description = await options.describe?.(member(memberId), ctx.toolName, businessInput, hints, confirmationLocale(ctx.session.auth.current));
112
112
  if (description === void 0) throw new Error("A trusted confirmation description is required.");
113
113
  } catch (error) {
114
+ if (error instanceof ConfirmationRefused) return denied(`The action refuses this input, so no card was shown and nothing ran: ${error.reason} Tell the member why in their language, in a short message; do not ask them to confirm it and do not make the same call again.`);
114
115
  console.warn("The confirmation description could not be read.", error);
115
116
  if (error instanceof UnsafeConfirmationTarget) return denied(`No confirmation card can name the ${error.label}: its title is missing, unreadable, or looks like a file name, link or identifier. Another call will be refused the same way; tell the member, who can rename that record or make the change in the app.`);
116
117
  return denied("Trusted confirmation facts are incomplete, unsafe or too long. Resolve every target title and narrow the input before making a new call.");
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
7
7
  import { n as contentText, t as CONTENT_CAPS } from "../../_chunks/content-cDtVnr8Y.mjs";
8
8
  import { conversationEvent, conversations, sessionFailureEventId, summarizeArguments } from "./conversations.mjs";
9
9
  import { agentTaskIdOf } from "./agent-task.mjs";
10
- import { i as memberIdOf } from "../../_chunks/principal-CPOCTHBa.mjs";
10
+ import { i as memberIdOf } from "../../_chunks/principal-VsmaJp1x.mjs";
11
11
  import { parseAddress } from "./telegram/sessions.mjs";
12
12
  import { completionKind } from "./telegram/silent.mjs";
13
13
  import { recordModelServiceAlert } from "./model-service-alert.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 { c as compatibleRuntimeEnvelope, u as runtimeEnvelope } from "../../_chunks/principal-CPOCTHBa.mjs";
7
+ import { c as compatibleRuntimeEnvelope, u as runtimeEnvelope } from "../../_chunks/principal-VsmaJp1x.mjs";
8
8
  import { appOrigin } from "./environment.mjs";
9
9
  import { actionApproval, confirmations } from "./confirmations.mjs";
10
10
  import { CHAT_POST_ENVELOPE, CHAT_POST_TOOL, chatPostDigest, chatPostOperationId, isChatPost } from "./chat-post-confirmation.mjs";
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
7
7
  import { actionApproval, confirmations, inputHash } from "./confirmations.mjs";
8
8
  import { isChatPost } from "./chat-post-confirmation.mjs";
9
9
  import { ontologyTools } from "./ontology-tools.mjs";
10
- import { u as runtimeEnvelope } from "../../_chunks/principal-CPOCTHBa.mjs";
10
+ import { u as runtimeEnvelope } from "../../_chunks/principal-VsmaJp1x.mjs";
11
11
  import { sandboxFile } from "./sandbox-session.mjs";
12
12
  import { saveOntologyResult } from "./ontology-result-file.mjs";
13
13
  import { actorKey, actorOf } from "./actor.mjs";
@@ -46,10 +46,10 @@ function ontologyFileCall(texts) {
46
46
  if (saved.saveResult && labels.readOnlyHint !== true) throw new Error("Saving a result requires a permitted read-only ontology tool.");
47
47
  return labels;
48
48
  },
49
- describe: async (actor, _action, input) => {
49
+ describe: async (actor, _action, input, _hints, locale) => {
50
50
  const saved = bound(input, ownerOf(actor));
51
51
  const business = Object.fromEntries(Object.entries(saved.arguments).filter(([key]) => key !== "_confirmation"));
52
- return ontologyTools({ principal }).describe(actor, saved.name, business);
52
+ return ontologyTools({ principal }).describe(actor, saved.name, business, void 0, locale);
53
53
  },
54
54
  copy: (actor, input) => {
55
55
  try {
@@ -2,6 +2,7 @@ import { type RuntimeEnvelope } from "./runtime-envelope.js";
2
2
  import type { SessionAuthContext } from "eve/context";
3
3
  import { type OntologyActor } from "./actor.js";
4
4
  import type { ActionAnnotations } from "./confirmations.js";
5
+ import { type ConfirmationDescription } from "./confirmation-description.js";
5
6
  import { type Environment } from "./environment.js";
6
7
  import { type RuntimeToken } from "./runtime-token.js";
7
8
  /** The annotations Eve passes with a call of an MCP connection's tool, from its own listing. */
@@ -49,7 +50,7 @@ export declare function ontologyTools(options?: {
49
50
  rpc: (actor: OntologyActor, method: string, params: Record<string, unknown>, signal?: AbortSignal) => Promise<Record<string, unknown>>;
50
51
  supportsRuntimeSource(actor: OntologyActor, signal?: AbortSignal): Promise<boolean>;
51
52
  labels(actor: OntologyActor, action: string, input?: Readonly<Record<string, unknown>>, signal?: AbortSignal, hints?: ToolHints): Promise<ActionAnnotations>;
52
- describe(actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>, hints?: ToolHints): Promise<import("./confirmation-description.js").ConfirmationDescription>;
53
+ describe(actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>, hints?: ToolHints, locale?: string): Promise<ConfirmationDescription>;
53
54
  };
54
55
  export declare function ontologyToolLabels(options?: Parameters<typeof ontologyTools>[0]): (actor: OntologyActor, action: string, input?: Readonly<Record<string, unknown>>, signal?: AbortSignal, hints?: ToolHints) => Promise<ActionAnnotations>;
55
56
  /** MCP normalizes an authored camelCase action to snake_case. */
@@ -4,15 +4,30 @@ 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 { c as compatibleRuntimeEnvelope, s as RUNTIME_SOURCE_PROTOCOL, u as runtimeEnvelope } from "../../_chunks/principal-CPOCTHBa.mjs";
7
+ import { c as compatibleRuntimeEnvelope, s as RUNTIME_SOURCE_PROTOCOL, u as runtimeEnvelope } from "../../_chunks/principal-VsmaJp1x.mjs";
8
8
  import "./agent-task.mjs";
9
9
  import { actorHeaders, actorKey, actorOf } from "./actor.mjs";
10
- import { CONFIRMATION_FACTS, describeConfirmation, factsConfirmation, object } from "./confirmation-description.mjs";
10
+ import { CONFIRMATION_FACTS, CONFIRMATION_PREVIEW_METHOD, ConfirmationRefused, confirmationCard, describeConfirmation, factsConfirmation, object } from "./confirmation-description.mjs";
11
11
  import { appOrigin } from "./environment.mjs";
12
12
  import { redactDiagnostic } from "./diagnostics.mjs";
13
13
  import { runtimeToken } from "./runtime-token.mjs";
14
14
  import { describeChatPost, isChatPost, supportsChatPost } from "./chat-post-confirmation.mjs";
15
15
  import { randomUUID } from "node:crypto";
16
+ function rejection(error) {
17
+ let cause = error.cause;
18
+ for (let depth = 0; depth < 4 && cause !== void 0; depth++) {
19
+ const code = object(object(cause).structuredContent).error;
20
+ if (typeof code === "string") return code;
21
+ cause = object(cause).cause;
22
+ }
23
+ return "";
24
+ }
25
+ const REFUSALS = new Set([
26
+ "action_rejected",
27
+ "not_found",
28
+ "conflict",
29
+ "forbidden"
30
+ ]);
16
31
  var OntologyToolRejected = class extends Error {
17
32
  code = "ontology_tool_rejected";
18
33
  };
@@ -224,6 +239,28 @@ function ontologyTools(options = {}) {
224
239
  input
225
240
  };
226
241
  }
242
+ async function preview(actor, name, input, locale, signal) {
243
+ let result;
244
+ try {
245
+ result = await rpc(actor, CONFIRMATION_PREVIEW_METHOD, {
246
+ name,
247
+ arguments: input,
248
+ locale
249
+ }, signal);
250
+ } catch (error) {
251
+ if (error instanceof OntologyToolRejected && REFUSALS.has(rejection(error))) throw new ConfirmationRefused(error.message);
252
+ console.warn("The action's confirmation could not be read; showing its fields.", error);
253
+ return;
254
+ }
255
+ const structured = object(result.structuredContent);
256
+ if (structured.confirmation === null || structured.confirmation === void 0) return;
257
+ try {
258
+ return confirmationCard(structured.confirmation);
259
+ } catch (error) {
260
+ console.warn("The action's confirmation cannot be shown; showing its fields.", error);
261
+ return;
262
+ }
263
+ }
227
264
  async function catalogEntities(actor, signal) {
228
265
  try {
229
266
  const catalog = await rpc(actor, "resources/read", { uri: "ontology://catalog" }, signal);
@@ -245,10 +282,11 @@ function ontologyTools(options = {}) {
245
282
  const annotations = object(tool.annotations);
246
283
  return {
247
284
  ...Object.fromEntries(Object.entries(annotations).filter(([key]) => key !== CONFIRMATION_FACTS)),
248
- confirmation: annotations["segmentstream/confirmation"] !== void 0 || object(object(tool.inputSchema).properties)._confirmation !== void 0
285
+ confirmation: annotations["segmentstream/confirmation"] !== void 0 || object(object(tool.inputSchema).properties)._confirmation !== void 0,
286
+ ...object(annotations["segmentstream/confirmation"]).preview === true ? { preview: true } : {}
249
287
  };
250
288
  },
251
- async describe(actor, action, input, hints) {
289
+ async describe(actor, action, input, hints, locale = "en") {
252
290
  const signal = AbortSignal.timeout(15e3);
253
291
  const resolved = await resolve(actor, action, input, signal, hints);
254
292
  const { tool } = resolved;
@@ -289,6 +327,12 @@ function ontologyTools(options = {}) {
289
327
  }
290
328
  }
291
329
  const facts = object(tool.annotations)[CONFIRMATION_FACTS];
330
+ const card = object(facts).preview === true ? await preview(actor, String(tool.name), input, locale, signal) : void 0;
331
+ if (card !== void 0) return {
332
+ card,
333
+ action: card.title,
334
+ fields: []
335
+ };
292
336
  if (facts !== void 0) return describeConfirmation({
293
337
  ...factsConfirmation(object(facts)),
294
338
  values: input,
@@ -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 { s as RUNTIME_SOURCE_PROTOCOL, c as compatibleRuntimeEnvelope, l as principalRuntimeSource, u as runtimeEnvelope, d as telegramRuntimeSource } from "../../_chunks/principal-CPOCTHBa.mjs";
7
+ export { s as RUNTIME_SOURCE_PROTOCOL, c as compatibleRuntimeEnvelope, l as principalRuntimeSource, u as runtimeEnvelope, d as telegramRuntimeSource } from "../../_chunks/principal-VsmaJp1x.mjs";
@@ -6,7 +6,7 @@ __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { object } from "./confirmation-description.mjs";
8
8
  import { OntologyFileUnavailable, ontologyTools } from "./ontology-tools.mjs";
9
- import { i as memberIdOf } from "../../_chunks/principal-CPOCTHBa.mjs";
9
+ import { i as memberIdOf } from "../../_chunks/principal-VsmaJp1x.mjs";
10
10
  import { member } from "./actor.mjs";
11
11
  import { redactDiagnostic } from "./diagnostics.mjs";
12
12
  import { createHash } from "node:crypto";
@@ -10,7 +10,7 @@ import { groupRoutingHealth } from "../group-routing/health.mjs";
10
10
  import { dispatchStructuredMessage, structuredMessage } from "./structured.mjs";
11
11
  import { handleWorkspaceCallback, isWorkspaceCallback } from "./callbacks.mjs";
12
12
  import { telegramText, withTelegramTexts } from "./texts.mjs";
13
- import { t as agentBuild } from "../../../_chunks/build-metadata-q7uPSqUP.mjs";
13
+ import { t as agentBuild } from "../../../_chunks/build-metadata-B_hCvO_v.mjs";
14
14
  import { attachmentLifecycle } from "./lifecycle.mjs";
15
15
  import { manifestOf } from "../../config.mjs";
16
16
  import { gatewayAttachmentDescriber } from "./attachment-description.mjs";
@@ -26,8 +26,8 @@ import { runtimeToken } from "../runtime-token.mjs";
26
26
  import { botIdentityCache } from "./bot.mjs";
27
27
  import { handleConfirmationCallback, telegramConfirmationEvents } from "./confirmations.mjs";
28
28
  import { confirmationLocale } from "./confirmation-text.mjs";
29
- import { d as failureText, h as withDeliveryLocale, i as withReplacedText, m as safeTelegramFetch, n as currentInboundRequest, o as currentLocale, p as reportTelegramError, r as runInboundRequest, t as InboundRequest } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
30
- import { n as conversationLanguage, o as telegramPrincipal } from "../../../_chunks/principal-CPOCTHBa.mjs";
29
+ import { d as failureText, h as withDeliveryLocale, i as withReplacedText, m as safeTelegramFetch, n as currentInboundRequest, o as currentLocale, p as reportTelegramError, r as runInboundRequest, t as InboundRequest } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
30
+ import { n as conversationLanguage, o as telegramPrincipal } from "../../../_chunks/principal-VsmaJp1x.mjs";
31
31
  import { gatewayImageDescriber } from "./images.mjs";
32
32
  import { gatewayMediaCapabilities, planMedia } from "./media-policy.mjs";
33
33
  import { agentChats } from "./chats.mjs";
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { describableImage } from "./images.mjs";
8
- import { p as reportTelegramError } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
8
+ import { p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
9
9
  import { gateway, generateText } from "ai";
10
10
  const MAXIMUM_ROUTING_ATTACHMENT_BYTES = 5242880;
11
11
  const ROUTING_ATTACHMENT_TIMEOUT_MS = 15e3;
@@ -12,10 +12,10 @@ import { fetchFileGrant, transientFileStatus } from "../file-grant.mjs";
12
12
  import { appOrigin, channelsEnabled, proxyEnvironment } from "../environment.mjs";
13
13
  import { ACT_AS_HEADER } from "../actor.mjs";
14
14
  import { runtimeToken } from "../runtime-token.mjs";
15
- import "../../../_chunks/principal-CPOCTHBa.mjs";
15
+ import "../../../_chunks/principal-VsmaJp1x.mjs";
16
16
  import { confirmationLocale } from "./confirmation-text.mjs";
17
17
  import { inTelegramSendQueue, telegramSendScope } from "./send-queue.mjs";
18
- import { d as failureText, f as formattingRefused, l as customerMessage, p as reportTelegramError } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
18
+ import { d as failureText, f as formattingRefused, l as customerMessage, p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
19
19
  import { TELEGRAM_PLACEHOLDER_TOKEN, TELEGRAM_PROXY_ORIGIN, telegramProxyFetch } from "./proxy-fetch.mjs";
20
20
  const MAXIMUM_PHOTO_BYTES = 10485760;
21
21
  const MAXIMUM_DOCUMENT_BYTES = 52428800;
@@ -5,8 +5,8 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { object } from "../confirmation-description.mjs";
8
- import { d as telegramRuntimeSource, i as memberIdOf, o as telegramPrincipal, u as runtimeEnvelope } from "../../../_chunks/principal-CPOCTHBa.mjs";
9
- import { n as currentInboundRequest, p as reportTelegramError } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
8
+ import { d as telegramRuntimeSource, i as memberIdOf, o as telegramPrincipal, u as runtimeEnvelope } from "../../../_chunks/principal-VsmaJp1x.mjs";
9
+ import { n as currentInboundRequest, p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
10
10
  import { formatAddress, parseAddress, scopedAddress } from "./sessions.mjs";
11
11
  import { telegramText } from "./texts.mjs";
12
12
  import { workspaceAction } from "./workspace-action.mjs";
@@ -1,8 +1,18 @@
1
1
  import type { SessionAuthContext } from "eve/context";
2
2
  import { type ConfirmationDescription } from "../confirmation-description.js";
3
- /** Confirmation facts and statuses are literal text; delivery still applies the shared validator. */
4
- export declare function withConfirmationText<T>(text: string, run: () => T): T;
5
- export declare function isConfirmationText(text: string): boolean;
3
+ import type { TelegramEntity } from "./format.js";
4
+ /** A confirmation card's text with its formatting, as Telegram entities. */
5
+ export interface ConfirmationMessageText {
6
+ readonly text: string;
7
+ readonly entities?: readonly TelegramEntity[];
8
+ }
9
+ /**
10
+ * Confirmation facts and statuses are literal text, sent with exactly the formatting the card was
11
+ * built with; delivery still applies the shared validator to the text.
12
+ */
13
+ export declare function withConfirmationText<T>(message: string | ConfirmationMessageText, run: () => T): T;
14
+ /** The formatting of the confirmation being delivered, when `text` is its text. */
15
+ export declare function confirmationEntities(text: string): readonly TelegramEntity[] | undefined;
6
16
  export interface ConfirmationCopy {
7
17
  readonly question: string;
8
18
  readonly confirm: string;
@@ -17,6 +27,13 @@ export interface ConfirmationCopy {
17
27
  export interface ConfirmationText {
18
28
  readonly previewLinks?: readonly string[];
19
29
  readonly text: string;
30
+ /** The formatting of `text`; a chat post card formats its own. */
31
+ readonly entities?: readonly TelegramEntity[];
32
+ /** A page about what the action concerns, as a button under the decision. */
33
+ readonly link?: {
34
+ readonly text: string;
35
+ readonly url: string;
36
+ };
20
37
  readonly confirm: string;
21
38
  readonly cancel: string;
22
39
  readonly executing: string;
@@ -35,5 +52,36 @@ export declare function confirmationLocale(principal: SessionAuthContext | null,
35
52
  export declare function confirmationCopyIssue(value: unknown): string | undefined;
36
53
  /** Reject the entire presentation object; never partially trust malformed model copy. */
37
54
  export declare function confirmationCopy(value?: unknown): ConfirmationCopy | undefined;
38
- /** Button positions retain callback meaning; workspace copy supplies every label and status. */
55
+ /**
56
+ * Button positions retain callback meaning; workspace copy supplies every label and status. An
57
+ * action that describes its own confirmation gives the card its title, facts and details; any
58
+ * other card asks the agent's question above the action's trusted facts.
59
+ */
39
60
  export declare function renderConfirmation(description?: ConfirmationDescription, copy?: ConfirmationCopy): ConfirmationText;
61
+ /** The marker of each outcome, used when the workspace's word for it has none of its own. */
62
+ declare const STATUS_MARKERS: {
63
+ readonly executing: "⌛";
64
+ readonly completed: "✅";
65
+ readonly cancelled: "✖️";
66
+ readonly failed: "⚠️";
67
+ readonly expired: "⏰";
68
+ readonly interrupted: "⏸";
69
+ };
70
+ export type ConfirmationOutcome = keyof typeof STATUS_MARKERS;
71
+ /**
72
+ * The card with its outcome under it: a marker and the workspace's word for the outcome, who
73
+ * decided, when (in each reader's own time zone), and why it failed when the action said so.
74
+ * A failure without the action's reason carries its diagnostic reference instead.
75
+ */
76
+ export declare function confirmationStatus(card: ConfirmationMessageText, status: {
77
+ readonly outcome: ConfirmationOutcome;
78
+ readonly label: string;
79
+ readonly actor?: string | null;
80
+ readonly at: number;
81
+ readonly reason?: string;
82
+ readonly reference?: string;
83
+ }): {
84
+ text: string;
85
+ entities: TelegramEntity[];
86
+ };
87
+ export {};
@@ -4,17 +4,38 @@ 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 { humanText, humanTextIssue, object } from "../confirmation-description.mjs";
7
+ import { confirmationCard, humanText, humanTextIssue, object } from "../confirmation-description.mjs";
8
8
  import { isTechnicalText } from "../customer-text-safety.mjs";
9
9
  import { telegramText } from "./texts.mjs";
10
10
  import { AsyncLocalStorage } from "node:async_hooks";
11
11
  const plainConfirmation = new AsyncLocalStorage();
12
- function withConfirmationText(text, run) {
13
- if (text.length > 4096 || isTechnicalText(text)) throw new Error("The complete confirmation cannot pass the delivery safety check.");
14
- return plainConfirmation.run(text, run);
12
+ function withConfirmationText(message, run) {
13
+ const card = typeof message === "string" ? { text: message } : message;
14
+ if (card.text.length > 4096 || isTechnicalText(card.text)) throw new Error("The complete confirmation cannot pass the delivery safety check.");
15
+ return plainConfirmation.run(card, run);
15
16
  }
16
- function isConfirmationText(text) {
17
- return plainConfirmation.getStore() === text;
17
+ function confirmationEntities(text) {
18
+ const card = plainConfirmation.getStore();
19
+ return card?.text === text ? card.entities ?? [] : void 0;
20
+ }
21
+ function composer(text = "", entities = []) {
22
+ const out = {
23
+ text,
24
+ entities: [...entities]
25
+ };
26
+ return {
27
+ add(value, entity) {
28
+ if (entity !== void 0 && value.length > 0) out.entities.push({
29
+ ...entity,
30
+ offset: out.text.length,
31
+ length: value.length
32
+ });
33
+ out.text += value;
34
+ },
35
+ get message() {
36
+ return out;
37
+ }
38
+ };
18
39
  }
19
40
  function confirmationLocale(principal, fallback = "en") {
20
41
  for (const key of [
@@ -72,23 +93,44 @@ function renderConfirmation(description, copy) {
72
93
  copy = confirmationCopy(copy);
73
94
  const action = humanText(description?.action);
74
95
  if (description === void 0 || action === void 0 || action === "❓") throw new Error("A confirmation requires a safe declared action title.");
75
- const facts = [action, ...(description?.fields ?? []).map(({ label, value }) => {
76
- if (value.length > 3584) throw new Error("The complete confirmation facts cannot fit in one Telegram message.");
77
- const safeLabel = humanText(label);
78
- const safeValue = humanText(value, 3584);
79
- if (safeLabel === void 0 || safeValue === void 0) throw new Error("The complete confirmation facts contain an unsafe field.");
80
- return `${safeLabel}: ${safeValue}`;
81
- })].filter(Boolean).join("\n");
82
96
  const configured = (key) => {
83
97
  const value = telegramText("confirmation", key);
84
98
  if (value === void 0) throw new Error(`texts.confirmation.${key} is required for Telegram confirmations.`);
85
99
  return value;
86
100
  };
87
- const text = [copy?.question ?? configured("question"), facts].filter(Boolean).join("\n\n");
101
+ const card = description.card === void 0 ? void 0 : confirmationCard(description.card);
102
+ const body = composer();
103
+ if (card !== void 0) {
104
+ body.add(card.icon === void 0 ? card.title : `${card.icon} ${card.title}`, { type: "bold" });
105
+ for (const fact of card.facts) {
106
+ body.add(fact.icon === void 0 ? "\n" : `\n${fact.icon} `);
107
+ body.add(fact.text, fact.url === void 0 ? void 0 : {
108
+ type: "text_link",
109
+ url: fact.url
110
+ });
111
+ }
112
+ if (card.details.length > 0) {
113
+ body.add("\n");
114
+ body.add(card.details.join("\n"), { type: "expandable_blockquote" });
115
+ }
116
+ } else {
117
+ const facts = [action, ...(description.fields ?? []).map(({ label, value }) => {
118
+ if (value.length > 3584) throw new Error("The complete confirmation facts cannot fit in one Telegram message.");
119
+ const safeLabel = humanText(label);
120
+ const safeValue = humanText(value, 3584);
121
+ if (safeLabel === void 0 || safeValue === void 0) throw new Error("The complete confirmation facts contain an unsafe field.");
122
+ return `${safeLabel}: ${safeValue}`;
123
+ })].join("\n");
124
+ body.add(copy?.question ?? configured("question"), { type: "bold" });
125
+ body.add(`\n\n${facts}`);
126
+ }
127
+ const { text, entities } = body.message;
88
128
  if (text.length > 3584) throw new Error("The complete confirmation facts cannot fit in one Telegram message.");
89
129
  if (isTechnicalText(text)) throw new Error("The complete confirmation cannot pass the delivery safety check.");
90
130
  return {
91
131
  text,
132
+ entities,
133
+ ...card?.link === void 0 ? {} : { link: card.link },
92
134
  confirm: copy?.confirm ?? configured("confirm"),
93
135
  cancel: copy?.cancel ?? configured("cancel"),
94
136
  executing: configured("executing"),
@@ -100,4 +142,31 @@ function renderConfirmation(description, copy) {
100
142
  edit: copy?.edit ?? configured("edit")
101
143
  };
102
144
  }
103
- export { confirmationCopy, confirmationCopyIssue, confirmationLocale, isConfirmationText, renderConfirmation, withConfirmationText };
145
+ const STATUS_MARKERS = {
146
+ executing: "⌛",
147
+ completed: "✅",
148
+ cancelled: "✖️",
149
+ failed: "⚠️",
150
+ expired: "⏰",
151
+ interrupted: "⏸"
152
+ };
153
+ function clock(at) {
154
+ return `${new Date(at).toISOString().slice(11, 16)} UTC`;
155
+ }
156
+ function confirmationStatus(card, status) {
157
+ const out = composer(card.text, card.entities);
158
+ const actor = humanText(status.actor, 80);
159
+ out.add("\n\n");
160
+ out.add(/^\p{Extended_Pictographic}/u.test(status.label) ? status.label : `${STATUS_MARKERS[status.outcome]} ${status.label}`);
161
+ if (actor !== void 0) out.add(` · ${actor}`);
162
+ out.add(" · ");
163
+ out.add(clock(status.at), {
164
+ type: "date_time",
165
+ unix_time: Math.floor(status.at / 1e3),
166
+ date_time_format: "t"
167
+ });
168
+ if (status.reason !== void 0) out.add(`\n${status.reason}`);
169
+ else if (status.reference !== void 0) out.add(` · ${status.reference}`);
170
+ return out.message;
171
+ }
172
+ export { confirmationCopy, confirmationCopyIssue, confirmationEntities, confirmationLocale, confirmationStatus, renderConfirmation, withConfirmationText };
@@ -23,5 +23,14 @@ export declare function handleConfirmationCallback(input: {
23
23
  readonly scope: "chat" | "thread";
24
24
  readonly now?: number;
25
25
  }): Promise<void>;
26
+ /**
27
+ * Why the action refused a confirmed call, in its own words, when it said: an ontology refusal
28
+ * (`action_rejected`) whose message is plain text a member can read. Anything else is not a reason
29
+ * to show; its diagnostic reference stays.
30
+ */
31
+ export declare function refusalReason(data: {
32
+ readonly output?: unknown;
33
+ readonly error?: unknown;
34
+ }): string | undefined;
26
35
  export declare function telegramConfirmationEvents(archive?: Conversations, scope?: () => "chat" | "thread"): TelegramChannelEvents & Pick<ChannelEvents<TelegramEventContext>, "context.settled">;
27
36
  export declare const confirmationEvents: TelegramChannelEvents & Pick<ChannelEvents<TelegramEventContext>, "context.settled">;
@@ -12,9 +12,9 @@ import { chatPostOperationId, isChatPost } from "../chat-post-confirmation.mjs";
12
12
  import { conversationEvent } from "../conversations.mjs";
13
13
  import { chatPostCard, chatPostCardStatus, chatPostReceipt, withChatPostCard } from "./chat-post-card.mjs";
14
14
  import { answerMarker, isPendingQuestion, pendingQuestions, questionKey } from "../questions.mjs";
15
- import { n as currentInboundRequest, p as reportTelegramError } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
16
- import { renderConfirmation, withConfirmationText } from "./confirmation-text.mjs";
17
- import { i as memberIdOf, o as telegramPrincipal } from "../../../_chunks/principal-CPOCTHBa.mjs";
15
+ import { n as currentInboundRequest, p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
16
+ import { confirmationStatus, renderConfirmation, withConfirmationText } from "./confirmation-text.mjs";
17
+ import { i as memberIdOf, o as telegramPrincipal } from "../../../_chunks/principal-VsmaJp1x.mjs";
18
18
  import { formatAddress, scopedAddress } from "./sessions.mjs";
19
19
  import { call } from "eve/events";
20
20
  import { createHash } from "node:crypto";
@@ -201,6 +201,17 @@ function messagePrompt(message) {
201
201
  at: new Date().toISOString()
202
202
  };
203
203
  }
204
+ function group(channel) {
205
+ const type = channel.telegram.chatType;
206
+ return type === void 0 ? String(channel.telegram.chatId).startsWith("-") : type !== "private";
207
+ }
208
+ function refusalReason(data) {
209
+ const output = object(data.output);
210
+ const structured = object(output.structuredContent ?? output);
211
+ const message = String(object(data.error).message ?? "");
212
+ const detail = structured.error === "action_rejected" && typeof structured.detail === "string" ? structured.detail : /^([^\n]+?) \(action_rejected, request [^)\n]+\)/u.exec(message)?.[1];
213
+ return humanText(detail, 300);
214
+ }
204
215
  function telegramConfirmationEvents(archive, scope) {
205
216
  const record = async (callId, phase, text, status, ctx) => {
206
217
  const saved = confirmations.get()[callId];
@@ -292,6 +303,7 @@ function telegramConfirmationEvents(archive, scope) {
292
303
  reply_markup: { inline_keyboard: [[
293
304
  {
294
305
  text: copy.confirm,
306
+ style: "success",
295
307
  callback_data: confirmationCallback(requestId, memberId, "approve")
296
308
  },
297
309
  ...exactPost ? [{
@@ -302,7 +314,10 @@ function telegramConfirmationEvents(archive, scope) {
302
314
  text: copy.cancel,
303
315
  callback_data: confirmationCallback(requestId, memberId, "cancel")
304
316
  }
305
- ]] }
317
+ ], ...copy.link === void 0 ? [] : [[{
318
+ text: copy.link.text,
319
+ url: copy.link.url
320
+ }]]] }
306
321
  });
307
322
  const prompt = {
308
323
  requestId,
@@ -321,7 +336,10 @@ function telegramConfirmationEvents(archive, scope) {
321
336
  author: humanText(ctx.session.auth.current.attributes.memberName) ?? "the requester"
322
337
  } }
323
338
  };
324
- const sent = await withConfirmationPrompt(prompt, () => exactPost ? withChatPostCard(text, send, copy.previewLinks) : withConfirmationText(text, send));
339
+ const sent = await withConfirmationPrompt(prompt, () => exactPost ? withChatPostCard(text, send, copy.previewLinks) : withConfirmationText({
340
+ text,
341
+ ...copy.entities ? { entities: copy.entities } : {}
342
+ }, send));
325
343
  if (aliasesPendingTopic(scope?.(), channel.continuation?.token)) channel.continuation?.alias(formatAddress({
326
344
  chatId: channel.telegram.chatId,
327
345
  messageThreadId: String(channel.telegram.messageThreadId ?? ""),
@@ -334,6 +352,7 @@ function telegramConfirmationEvents(archive, scope) {
334
352
  requestId,
335
353
  messageId: sent.id,
336
354
  text,
355
+ ...copy.entities === void 0 ? {} : { entities: copy.entities },
337
356
  copy,
338
357
  exactPost,
339
358
  prompt,
@@ -363,12 +382,19 @@ function telegramConfirmationEvents(archive, scope) {
363
382
  const [callId, message] = entry;
364
383
  const copy = message.copy ?? renderConfirmation();
365
384
  const reason = confirmations.get()[callId]?.cancellationReason;
366
- const status = resolution.outcome === "accepted" ? copy.executing : reason === "expired" ? copy.expired : [
385
+ const outcome = resolution.outcome === "accepted" ? "executing" : reason === "expired" ? "expired" : [
367
386
  "withdrawn",
368
387
  "interrupted",
369
388
  "abandoned"
370
- ].includes(resolution.outcome) ? copy.interrupted : copy.cancelled;
371
- const text = message.exactPost ? chatPostCardStatus(message.text, status) : `${message.text}\n\n${status}`;
389
+ ].includes(resolution.outcome) ? "interrupted" : "cancelled";
390
+ const status = copy[outcome];
391
+ const card = message.exactPost ? { text: chatPostCardStatus(message.text, status) } : confirmationStatus(message, {
392
+ outcome,
393
+ label: status,
394
+ actor: (outcome === "executing" || outcome === "cancelled") && group(channel) ? messagePrompt(message).requestedBy : void 0,
395
+ at: Date.now()
396
+ });
397
+ const text = card.text;
372
398
  const edit = () => channel.telegram.editMessageText({
373
399
  messageId: message.messageId,
374
400
  replyMarkup: { inline_keyboard: [] },
@@ -383,7 +409,7 @@ function telegramConfirmationEvents(archive, scope) {
383
409
  ].includes(resolution.outcome) ? "interrupted" : "cancelled"
384
410
  };
385
411
  message.prompt = prompt;
386
- await withConfirmationPrompt(prompt, () => message.exactPost ? withChatPostCard(text, edit, [...message.previewLinks ?? [], ...telegramTextLinks(status)]) : withConfirmationText(text, edit));
412
+ await withConfirmationPrompt(prompt, () => message.exactPost ? withChatPostCard(text, edit, [...message.previewLinks ?? [], ...telegramTextLinks(status)]) : withConfirmationText(card, edit));
387
413
  await record(callId, reason ?? (resolution.outcome === "accepted" ? "approved" : resolution.outcome === "declined" ? "cancelled" : "ignored"), text, resolution.outcome === "accepted" ? "requested" : "cancelled", ctx);
388
414
  if (resolution.outcome !== "accepted") {
389
415
  delete state.confirmationMessages?.[callId];
@@ -460,16 +486,22 @@ function telegramConfirmationEvents(archive, scope) {
460
486
  } else {
461
487
  const copy = message.copy ?? renderConfirmation();
462
488
  const errorId = failed ? reportTelegramError("confirmed_action_failed", data, { callId: data.callId }) : void 0;
463
- const status = failed ? `${copy.failed} ${errorId}` : copy.completed;
464
- const text = `${message.text}\n\n${status}`;
489
+ const reason = failed ? refusalReason(data) : void 0;
490
+ const card = confirmationStatus(message, {
491
+ outcome: failed ? "failed" : "completed",
492
+ label: failed ? copy.failed : copy.completed,
493
+ actor: group(channel) ? messagePrompt(message).requestedBy : void 0,
494
+ at: Date.now(),
495
+ ...reason !== void 0 ? { reason } : errorId === void 0 ? {} : { reference: errorId }
496
+ });
465
497
  const prompt = {
466
498
  ...messagePrompt(message),
467
499
  state: failed ? "failed" : "completed"
468
500
  };
469
- await withConfirmationPrompt(prompt, () => withConfirmationText(text, () => channel.telegram.editMessageText({
501
+ await withConfirmationPrompt(prompt, () => withConfirmationText(card, () => channel.telegram.editMessageText({
470
502
  messageId: message.messageId,
471
503
  replyMarkup: { inline_keyboard: [] },
472
- text
504
+ text: card.text
473
505
  })));
474
506
  }
475
507
  delete state.confirmationMessages?.[data.callId];
@@ -493,4 +525,4 @@ function telegramConfirmationEvents(archive, scope) {
493
525
  };
494
526
  }
495
527
  const confirmationEvents = telegramConfirmationEvents();
496
- export { confirmationCallback, confirmationEvents, handleConfirmationCallback, questionAddress, questionFromHistory, questionsFromHistory, routingConfirmationState, routingConfirmations, telegramConfirmationEvents };
528
+ export { confirmationCallback, confirmationEvents, handleConfirmationCallback, questionAddress, questionFromHistory, questionsFromHistory, refusalReason, routingConfirmationState, routingConfirmations, telegramConfirmationEvents };
@@ -9,7 +9,7 @@ import { n as contentText, t as CONTENT_CAPS } from "../../../_chunks/content-cD
9
9
  import { conversationEvent, sessionFailureEventId } from "../conversations.mjs";
10
10
  import { currentConfirmationPrompt } from "../group-routing/messages.mjs";
11
11
  import { messageMetadata } from "./message-metadata.mjs";
12
- import { n as currentInboundRequest, p as reportTelegramError, s as currentThreadId } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
12
+ import { n as currentInboundRequest, p as reportTelegramError, s as currentThreadId } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
13
13
  import { reportMembership } from "./membership.mjs";
14
14
  import { currentDeliveryScope } from "./delivery-diagnostics.mjs";
15
15
  import { contentShape, messageContent } from "./content.mjs";
@@ -5,5 +5,5 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { isTechnicalText } from "../customer-text-safety.mjs";
8
- import { a as TelegramDeliveryError, c as customerCopy, d as failureText, f as formattingRefused, h as withDeliveryLocale, l as customerMessage, m as safeTelegramFetch, o as currentLocale, p as reportTelegramError, s as currentThreadId, u as customerText } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
8
+ import { a as TelegramDeliveryError, c as customerCopy, d as failureText, f as formattingRefused, h as withDeliveryLocale, l as customerMessage, m as safeTelegramFetch, o as currentLocale, p as reportTelegramError, s as currentThreadId, u as customerText } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
9
9
  export { TelegramDeliveryError, currentLocale, currentThreadId, customerCopy, customerMessage, customerText, failureText, formattingRefused, isTechnicalText, reportTelegramError, safeTelegramFetch, withDeliveryLocale };
@@ -5,8 +5,8 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { MAXIMUM_ATTACHMENT_BYTES, attachmentUrl } from "../attachments.mjs";
8
- import { d as failureText, p as reportTelegramError } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
9
- import { n as conversationLanguage } from "../../../_chunks/principal-CPOCTHBa.mjs";
8
+ import { d as failureText, p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
9
+ import { n as conversationLanguage } from "../../../_chunks/principal-VsmaJp1x.mjs";
10
10
  import { describableImage, describeReceivedImage } from "./images.mjs";
11
11
  function telegramConversation(chatId) {
12
12
  return `telegram:${chatId}`;
@@ -4,6 +4,10 @@ export interface TelegramEntity {
4
4
  readonly length: number;
5
5
  readonly url?: string;
6
6
  readonly language?: string;
7
+ /** A `date_time` entity's moment: Telegram shows it in each reader's time zone. */
8
+ readonly unix_time?: number;
9
+ /** A `date_time` entity's format, such as `t` for the short time. */
10
+ readonly date_time_format?: string;
7
11
  }
8
12
  export interface TelegramText {
9
13
  readonly text: string;
@@ -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 { t as agentBuild } from "../../../_chunks/build-metadata-q7uPSqUP.mjs";
7
+ import { t as agentBuild } from "../../../_chunks/build-metadata-B_hCvO_v.mjs";
8
8
  import { runtimeRequestFailure } from "./runtime-request.mjs";
9
9
  import { GET } from "eve/channels";
10
10
  const HEALTH_ROUTE = "/eve/v1/telegram/health";
@@ -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-Dy7q3T23.mjs";
7
+ import { p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
8
8
  import { gateway, generateText } from "ai";
9
9
  const MAXIMUM_IMAGE_DESCRIPTION_BYTES = 5242880;
10
10
  const MAXIMUM_NATIVE_IMAGE_BYTES = 3145728;
@@ -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 InboundRequest, n as currentInboundRequest, r as runInboundRequest, i as withReplacedText } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
7
+ export { t as InboundRequest, n as currentInboundRequest, r as runInboundRequest, i as withReplacedText } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
@@ -6,7 +6,7 @@ __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { WorkspaceActionAlreadyDispatched } from "./workspace-action.mjs";
8
8
  import { structuredMessage } from "./structured.mjs";
9
- import { d as telegramRuntimeSource, n as conversationLanguage, o as telegramPrincipal, u as runtimeEnvelope } from "../../../_chunks/principal-CPOCTHBa.mjs";
9
+ import { d as telegramRuntimeSource, n as conversationLanguage, o as telegramPrincipal, u as runtimeEnvelope } from "../../../_chunks/principal-VsmaJp1x.mjs";
10
10
  import { routingBurst } from "../group-routing/burst.mjs";
11
11
  import { telegramSignals } from "./signals.mjs";
12
12
  import { addressingReason, conversationKey, otherRecipient } from "../group-routing/signals.mjs";
@@ -30,7 +30,7 @@ import { MAXIMUM_ROUTING_ATTACHMENT_BYTES, describeRoutingAttachment, routingAtt
30
30
  import { recordGateDecision, recordInboundContent, recordRouteDecision } from "./conversations.mjs";
31
31
  import { contentShape, messageContent } from "./content.mjs";
32
32
  import { messageAudience } from "./audience.mjs";
33
- import { p as reportTelegramError } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
33
+ import { p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
34
34
  const MAXIMUM_QUOTE_LENGTH = 500;
35
35
  function buttonTo(text, url) {
36
36
  return { inline_keyboard: [[{
@@ -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 { d as telegramRuntimeSource, l as principalRuntimeSource, u as runtimeEnvelope } from "../../../_chunks/principal-CPOCTHBa.mjs";
8
- import { t as agentBuild } from "../../../_chunks/build-metadata-q7uPSqUP.mjs";
9
- import { n as currentInboundRequest } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
7
+ import { d as telegramRuntimeSource, l as principalRuntimeSource, u as runtimeEnvelope } from "../../../_chunks/principal-VsmaJp1x.mjs";
8
+ import { t as agentBuild } from "../../../_chunks/build-metadata-B_hCvO_v.mjs";
9
+ import { n as currentInboundRequest } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
10
10
  import { object } from "../confirmation-description.mjs";
11
11
  import { needsConfirmation } from "../confirmations.mjs";
12
12
  import { OntologyActionNotPermitted, actionToolName, ontologyTools } from "../ontology-tools.mjs";
@@ -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-Dy7q3T23.mjs";
8
+ import { p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
9
9
  function planMedia(capabilities, descriptionModel = null) {
10
10
  if (typeof descriptionModel === "string") return {
11
11
  images: "describe",
@@ -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-CPOCTHBa.mjs";
7
+ export { t as TELEGRAM_AUTHENTICATOR, n as conversationLanguage, r as identityProviderOf, i as memberIdOf, a as rolesOf, o as telegramPrincipal } from "../../../_chunks/principal-VsmaJp1x.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 { p as reportTelegramError } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
7
+ import { p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
8
8
  import { createHash } from "node:crypto";
9
9
  function strandedRun(error) {
10
10
  if (!(error instanceof Error) || error.name !== "RunKeyFetchError" || !("status" in error) || error.status !== 404) return;
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { confirmationLocale } from "./confirmation-text.mjs";
8
- import { a as TelegramDeliveryError, l as customerMessage, o as currentLocale, p as reportTelegramError } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
8
+ import { a as TelegramDeliveryError, l as customerMessage, o as currentLocale, p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
9
9
  import { splitTelegramText } from "./format.mjs";
10
10
  import { inTelegramSendQueue } from "./send-queue.mjs";
11
11
  const SILENT_MARKERS = new Set(["[silent]", "no_reply"]);
@@ -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-CPOCTHBa.mjs";
7
+ import { d as telegramRuntimeSource, u as runtimeEnvelope } from "../../../_chunks/principal-VsmaJp1x.mjs";
8
8
  import { workspaceAction } from "./workspace-action.mjs";
9
9
  import { STRUCTURED_KINDS } from "./structured-settings.mjs";
10
10
  const record = (value) => {
@@ -7,8 +7,8 @@ __eveCreateRequire(import.meta.url);
7
7
  import { telegramText } from "./texts.mjs";
8
8
  import { confirmationLocale } from "./confirmation-text.mjs";
9
9
  import { recordSessionFailure } from "./conversations.mjs";
10
- import { c as customerCopy, d as failureText, o as currentLocale, p as reportTelegramError, s as currentThreadId } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
11
- import { i as memberIdOf } from "../../../_chunks/principal-CPOCTHBa.mjs";
10
+ import { c as customerCopy, d as failureText, o as currentLocale, p as reportTelegramError, s as currentThreadId } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
11
+ import { i as memberIdOf } from "../../../_chunks/principal-VsmaJp1x.mjs";
12
12
  import { modelServiceFailure } from "../model-service-failure.mjs";
13
13
  function telegramFailureEvents(input) {
14
14
  return {
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import "../connection-proxy.mjs";
8
- import { p as reportTelegramError } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
8
+ import { p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
9
9
  import { gateway, transcribe } from "ai";
10
10
  const LABELS = {
11
11
  voice: "voice message",
@@ -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-CPOCTHBa.mjs";
9
+ import { a as rolesOf } from "../_chunks/principal-VsmaJp1x.mjs";
10
10
  import { runs } from "eve/events";
11
11
  import { defineDynamic } from "eve";
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-CPOCTHBa.mjs";
7
+ import { u as runtimeEnvelope } from "../../_chunks/principal-VsmaJp1x.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";
@@ -37,9 +37,9 @@ const tool = defineTool({
37
37
  const target = promotionTarget(input);
38
38
  return ontologyTools().labels(actor, target.action, target.input);
39
39
  },
40
- describe: (actor, _tool, input) => {
40
+ describe: (actor, _tool, input, _hints, locale) => {
41
41
  const target = promotionTarget(input);
42
- return ontologyTools().describe(actor, target.action, target.input);
42
+ return ontologyTools().describe(actor, target.action, target.input, void 0, locale);
43
43
  }
44
44
  }),
45
45
  description: "Keep a file the member sent by storing it in a record through an ontology action that takes a file, such as document.upload. Give the entity, the action and the action's input without the file field: the platform fills it with the attachment, and fills sha256 when the action takes one. Runs with the member's permissions. The same file promoted again through the same action returns the earlier result instead of a duplicate. With the sandbox on, give path instead of id to keep a file from /workspace, such as a result in /workspace/work.",
@@ -8,7 +8,7 @@ import { n as workflowToolResult } from "../../_chunks/workflow-serializable-DU7
8
8
  import { agentTaskIdOf, agentTaskSessions } from "../lib/agent-task.mjs";
9
9
  import { stringArgument } from "../lib/attachment-tools.mjs";
10
10
  import { pendingQuestions, questionKey } from "../lib/questions.mjs";
11
- import { i as memberIdOf } from "../../_chunks/principal-CPOCTHBa.mjs";
11
+ import { i as memberIdOf } from "../../_chunks/principal-VsmaJp1x.mjs";
12
12
  import { defineTool } from "eve/tools";
13
13
  var questions_ask_default = defineTool({
14
14
  availableInSubagents: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/agent",
3
- "version": "0.31.13",
3
+ "version": "0.32.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",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "@chat-adapter/telegram": "4.41.0",
77
- "@segmentstream-cloud/ontology": "0.88.0",
77
+ "@segmentstream-cloud/ontology": "0.90.0",
78
78
  "@vercel/oidc": "^3.8.4",
79
79
  "ai": "^7.0.137",
80
80
  "csv-parse": "^7.0.3",