@segmentstream/agent 0.6.4 → 0.6.5

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.
@@ -1,12 +1,12 @@
1
1
  /** Telegram entities annotate UTF-16 text ranges; they never contain the missing message body. */
2
- export interface ContentEntity {
2
+ interface ContentEntity {
3
3
  readonly type: string;
4
4
  readonly offset: number;
5
5
  readonly length: number;
6
6
  readonly user?: Readonly<Record<string, unknown>>;
7
7
  readonly username?: string;
8
8
  }
9
- export interface MessageContent {
9
+ interface MessageContent {
10
10
  readonly text: string;
11
11
  readonly entities: ReadonlyArray<ContentEntity>;
12
12
  readonly source: "text" | "caption" | "rich_message" | "none";
@@ -27,3 +27,4 @@ export declare function contentShape(raw: Readonly<Record<string, unknown>>, con
27
27
  truncated: boolean;
28
28
  forwarded: boolean;
29
29
  };
30
+ export {};
@@ -3,8 +3,6 @@ export declare const MAXIMUM_IMAGE_DESCRIPTION_BYTES: number;
3
3
  /** Eve 0.76.3's actual inbound image inlining limit. */
4
4
  export declare const MAXIMUM_NATIVE_IMAGE_BYTES: number;
5
5
  export declare const MAXIMUM_IMAGE_DESCRIPTIONS = 1;
6
- export declare const MAXIMUM_IMAGE_DESCRIPTION_CHARACTERS = 512;
7
- export declare const IMAGE_DESCRIPTION_TIMEOUT_MS = 15000;
8
6
  export type ImageDescriber = (input: {
9
7
  readonly bytes: Uint8Array;
10
8
  readonly mediaType: string;
@@ -39,9 +39,9 @@ async function describeReceivedImage(input) {
39
39
  if (input.bytes.byteLength > 5242880) return "[image description skipped: exceeds 5 MiB; original remains stored]";
40
40
  try {
41
41
  const text = (await input.describe(input)).trim();
42
- return text === "" ? "[image description unavailable: empty result; original remains stored]" : text.length > 512 ? `${text.slice(0, 511)}…` : text;
42
+ return text === "" ? "[image description unavailable: empty result; original remains stored]" : text.length > MAXIMUM_IMAGE_DESCRIPTION_CHARACTERS ? `${text.slice(0, 511)}…` : text;
43
43
  } catch (error) {
44
44
  return `[image description failed; original remains stored; error reference: ${reportTelegramError("image_description_failed", error)}]`;
45
45
  }
46
46
  }
47
- export { IMAGE_DESCRIPTION_TIMEOUT_MS, MAXIMUM_IMAGE_DESCRIPTIONS, MAXIMUM_IMAGE_DESCRIPTION_BYTES, MAXIMUM_IMAGE_DESCRIPTION_CHARACTERS, MAXIMUM_NATIVE_IMAGE_BYTES, describableImage, describeReceivedImage, gatewayImageDescriber };
47
+ export { MAXIMUM_IMAGE_DESCRIPTIONS, MAXIMUM_IMAGE_DESCRIPTION_BYTES, MAXIMUM_NATIVE_IMAGE_BYTES, describableImage, describeReceivedImage, gatewayImageDescriber };
@@ -10,8 +10,6 @@
10
10
  import type { Attachment } from "../attachments.js";
11
11
  /** How many observed messages a chat keeps; the oldest goes first. */
12
12
  export declare const OBSERVED_MESSAGES = 30;
13
- /** Media references/summaries have their own budget so they cannot consume the caption budget. */
14
- export declare const MAXIMUM_MEDIA_LENGTH = 2000;
15
13
  export interface ObservedMessage {
16
14
  /** How the chat names the author: their username, else their first name. */
17
15
  readonly author: string;
@@ -83,4 +83,4 @@ function observedContext(messages) {
83
83
  "</observed_messages>"
84
84
  ].join("\n")];
85
85
  }
86
- export { MAXIMUM_MEDIA_LENGTH, OBSERVED_MESSAGES, agentMessage, observedChatKey, observedContext, observedMessages };
86
+ export { OBSERVED_MESSAGES, agentMessage, observedChatKey, observedContext, observedMessages };
@@ -12,7 +12,6 @@ export interface VoiceMessage {
12
12
  readonly seconds: number | undefined;
13
13
  readonly size: number | undefined;
14
14
  }
15
- export declare const MAXIMUM_TRANSCRIPTION_SECONDS: number;
16
15
  /** The voice, audio or video note a raw Telegram message carries, if any. */
17
16
  export declare function voiceOf(raw: Readonly<Record<string, unknown>>): VoiceMessage | undefined;
18
17
  /** The note that tells the model a message was spoken, such as `[voice message, 12 s]`. */
@@ -90,7 +90,7 @@ async function voiceText(input) {
90
90
  text: voiceNote(voice, "too long to transcribe"),
91
91
  note
92
92
  };
93
- if (voice.seconds !== void 0 && voice.seconds > 600) return {
93
+ if (voice.seconds !== void 0 && voice.seconds > MAXIMUM_TRANSCRIPTION_SECONDS) return {
94
94
  text: voiceNote(voice, "exceeds the 10 minute transcription limit"),
95
95
  note
96
96
  };
@@ -118,4 +118,4 @@ async function voiceText(input) {
118
118
  };
119
119
  }
120
120
  }
121
- export { MAXIMUM_TRANSCRIPTION_SECONDS, TelegramFileError, downloadTelegramFile, gatewayTranscriber, voiceNote, voiceOf, voiceText };
121
+ export { TelegramFileError, downloadTelegramFile, gatewayTranscriber, voiceNote, voiceOf, voiceText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/agent",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
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",