@segmentstream/agent 0.29.3 → 0.31.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 (73) hide show
  1. package/README.md +14 -9
  2. package/dist/_chunks/{build-metadata-CMFK1R_F.mjs → build-metadata-CZuxPOVF.mjs} +1 -1
  3. package/dist/_chunks/{principal-D99Lleae.mjs → principal-CPOCTHBa.mjs} +1 -1
  4. package/dist/extension/_manifest.json +1 -1
  5. package/dist/extension/config.d.ts +9 -1
  6. package/dist/extension/config.mjs +9 -3
  7. package/dist/extension/extension.d.ts +2 -2
  8. package/dist/extension/extension.mjs +3 -3
  9. package/dist/extension/hooks/authorization.mjs +2 -2
  10. package/dist/extension/instructions/sandbox.mjs +4 -3
  11. package/dist/extension/lib/actor.mjs +1 -1
  12. package/dist/extension/lib/agent-task-channel.mjs +3 -3
  13. package/dist/extension/lib/attachment-tools.mjs +4 -4
  14. package/dist/extension/lib/attachments.mjs +1 -1
  15. package/dist/extension/lib/build-metadata.mjs +1 -2
  16. package/dist/extension/lib/chat-context.mjs +2 -2
  17. package/dist/extension/lib/confirmations.mjs +4 -4
  18. package/dist/extension/lib/conversation-runtime.mjs +2 -2
  19. package/dist/extension/lib/group-routing/router.mjs +2 -2
  20. package/dist/extension/lib/group-routing/routing-context.mjs +1 -1
  21. package/dist/extension/lib/model-service-alert.mjs +1 -1
  22. package/dist/extension/lib/ontology-connection.mjs +4 -4
  23. package/dist/extension/lib/ontology-file-call.mjs +3 -3
  24. package/dist/extension/lib/ontology-tools.mjs +5 -5
  25. package/dist/extension/lib/runtime-envelope.mjs +1 -2
  26. package/dist/extension/lib/sandbox-session.mjs +1 -2
  27. package/dist/extension/lib/stored-files.mjs +3 -3
  28. package/dist/extension/lib/telegram/adapter.mjs +20 -20
  29. package/dist/extension/lib/telegram/attachment-description.mjs +1 -1
  30. package/dist/extension/lib/telegram/attachments-send.mjs +7 -7
  31. package/dist/extension/lib/telegram/audience.mjs +1 -1
  32. package/dist/extension/lib/telegram/callbacks.mjs +5 -5
  33. package/dist/extension/lib/telegram/chats.mjs +1 -1
  34. package/dist/extension/lib/telegram/confirmation-text.mjs +2 -2
  35. package/dist/extension/lib/telegram/confirmations.mjs +13 -16
  36. package/dist/extension/lib/telegram/conversations.mjs +4 -4
  37. package/dist/extension/lib/telegram/customer-text.mjs +1 -1
  38. package/dist/extension/lib/telegram/delivery-diagnostics.mjs +1 -1
  39. package/dist/extension/lib/telegram/files.mjs +3 -3
  40. package/dist/extension/lib/telegram/health.mjs +1 -1
  41. package/dist/extension/lib/telegram/held-approvals.mjs +1 -1
  42. package/dist/extension/lib/telegram/images.d.ts +1 -1
  43. package/dist/extension/lib/telegram/images.mjs +1 -1
  44. package/dist/extension/lib/telegram/inbound-request.mjs +1 -2
  45. package/dist/extension/lib/telegram/inbound.mjs +19 -19
  46. package/dist/extension/lib/telegram/lifecycle.mjs +4 -4
  47. package/dist/extension/lib/telegram/media-policy.mjs +1 -1
  48. package/dist/extension/lib/telegram/pdf-text.mjs +2 -4
  49. package/dist/extension/lib/telegram/principal.mjs +1 -2
  50. package/dist/extension/lib/telegram/router.mjs +1 -1
  51. package/dist/extension/lib/telegram/routing-context.mjs +4 -4
  52. package/dist/extension/lib/telegram/session-recovery.d.ts +1 -1
  53. package/dist/extension/lib/telegram/session-recovery.mjs +2 -2
  54. package/dist/extension/lib/telegram/silent.mjs +1 -1
  55. package/dist/extension/lib/telegram/structured.mjs +2 -2
  56. package/dist/extension/lib/telegram/turn-errors.mjs +12 -8
  57. package/dist/extension/lib/telegram/voice.mjs +1 -1
  58. package/dist/extension/lib/telegram/workspace-action.mjs +2 -2
  59. package/dist/extension/lib/workflow-serializable.mjs +1 -2
  60. package/dist/extension/model.d.ts +8 -5
  61. package/dist/extension/model.mjs +3 -3
  62. package/dist/extension/tools/attachments_discard.mjs +1 -1
  63. package/dist/extension/tools/attachments_list.mjs +1 -1
  64. package/dist/extension/tools/attachments_promote.mjs +4 -4
  65. package/dist/extension/tools/attachments_read.mjs +2 -2
  66. package/dist/extension/tools/attachments_send.mjs +1 -1
  67. package/dist/extension/tools/attachments_stage.mjs +3 -4
  68. package/dist/extension/tools/attachments_table.mjs +2 -2
  69. package/dist/extension/tools/questions_ask.mjs +3 -3
  70. package/dist/extension/tools/sandbox.mjs +4 -1
  71. package/dist/index.mjs +1 -2
  72. package/package.json +3 -3
  73. package/dist/_chunks/{inbound-request-D1r0FkDI.mjs → inbound-request-Dy7q3T23.mjs} +1 -1
package/README.md CHANGED
@@ -7,13 +7,13 @@ calls go through the workspace's connection, unknown senders pair with a member
7
7
  messages become text, and group chats are answered only when the agent is addressed or asked for
8
8
  something it does.
9
9
 
10
- The package is built against one eve version, `0.85.0`, and the workspace's `agent/` pins the same
11
- one. eve and the package move together.
10
+ The package is built against one eve version, `1.0.0-rc.6`, and the workspace's `agent/` pins the
11
+ same one. eve and the package move together.
12
12
 
13
13
  ## Install
14
14
 
15
15
  ```sh
16
- npm install @segmentstream/agent eve@0.85.0
16
+ npm install @segmentstream/agent eve@1.0.0-rc.6
17
17
  ```
18
18
 
19
19
  ## Deploying workspace source
@@ -64,17 +64,22 @@ export default segmentstream(config);
64
64
  import { defineAgent } from "eve";
65
65
  import { segmentstream } from "@segmentstream/agent";
66
66
 
67
+ import config from "../segmentstream.json";
68
+
67
69
  export default defineAgent({
68
70
  defaultTools: false,
69
- model: segmentstream.model(),
71
+ model: segmentstream.model(config.models.chat),
70
72
  reasoning: "medium",
71
73
  limits: { sessionUsage: ({ window }) => (window.costUsd ?? 0) >= 2 },
72
74
  });
73
75
  ```
74
76
 
75
- `segmentstream.model()` resolves on `session.started` from `models.chat` in `agent/segmentstream.json`
76
- (`{ "default", "byRole", "preview" }`), where the platform reads it too; an inline
77
- `segmentstream.model({ default, byRole, preview })` works the same. On a preview deployment it returns `preview`
77
+ `segmentstream.model(choice)` resolves on `session.started` from `models.chat` of
78
+ `agent/segmentstream.json` (`{ "default", "byRole", "preview" }`), where the platform reads it too;
79
+ an inline `segmentstream.model({ default, byRole, preview })` works the same. `agent.ts` passes the
80
+ choice because eve binds the extension's configuration only to the modules it bundles for the
81
+ mount: code outside the extension never sees it. A missing or invalid choice fails when `agent.ts`
82
+ loads. On a preview deployment it returns `preview`
78
83
  when set. Otherwise it returns the model of the first `byRole` entry whose role the member holds, in
79
84
  the order written, and `default` when none matches. The roles come from the member's pairing, not
80
85
  from the message. The model is never switched mid-session, which keeps the provider's prompt cache.
@@ -399,7 +404,7 @@ The SDK adds no text to the prompt.
399
404
  context. `stt: false` skips transcription. Transcription accepts at most 20 MiB
400
405
  and ten minutes of declared duration, with a 60-second inference timeout. A skipped or failed
401
406
  transcription reaches the agent as a note. Originals are stored as ontology attachments.
402
- Eve 0.85.0 only hydrates inbound images and PDFs; it does **not** deliver native audio bytes to
407
+ eve (through 1.0) only hydrates inbound images and PDFs; it does **not** deliver native audio bytes to
403
408
  the chat model. Even an audio-capable chat model therefore uses the configured STT fallback,
404
409
  with an explicit host limitation note. Native audio requires a compatible Eve host change.
405
410
  - **Attachments.** Photos, documents and other Telegram files up to 20 MB stream through the connection proxy (its
@@ -701,7 +706,7 @@ Eve resolution, so member/topic routing survives a cold start. No second provide
701
706
 
702
707
  ## Release and migration
703
708
 
704
- The original exact-post release used Agent SDK 0.17.13, Eve 0.76.3, Ontology SDK 0.56.0 and App SDK 0.25.2. Current builds require Eve 0.85.0 and a rebuilt Agent SDK extension.
709
+ The original exact-post release used Agent SDK 0.17.13, Eve 0.76.3, Ontology SDK 0.56.0 and App SDK 0.25.2. Current builds require eve 1.0.0-rc.6 and a rebuilt Agent SDK extension.
705
710
  In the next release, feedback file guidance follows the visible tools.
706
711
  The compatible Cloud archive/API must be deployed first; migrations run only through its CI/CD gate.
707
712
  Publish the ontology SDK before the agent SDK. Upgrade the workspace ontology before its agent,
@@ -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.29.3";
7
+ var version = "0.31.0";
8
8
  function agentBuild(environment = process.env) {
9
9
  return {
10
10
  agent: version,
@@ -4,8 +4,8 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
+ import { n as currentInboundRequest } from "./inbound-request-Dy7q3T23.mjs";
7
8
  import "../extension/lib/agent-task.mjs";
8
- import { n as currentInboundRequest } from "./inbound-request-D1r0FkDI.mjs";
9
9
  import { randomUUID } from "node:crypto";
10
10
  function telegramRuntimeSource(message, files, callbackQueryId) {
11
11
  const attachments = [];
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "kind": "eve-extension",
3
3
  "formatVersion": 3,
4
- "builtWithEve": "0.85.0",
4
+ "builtWithEve": "1.0.0-rc.6",
5
5
  "contractMajor": 0
6
6
  }
@@ -196,7 +196,10 @@ export interface SegmentStreamAgentConfig extends AdmissionSettings {
196
196
  readonly telegram: TelegramSettings | null;
197
197
  };
198
198
  readonly models: {
199
- /** `null` when `agent.ts` passes the choice to `segmentstream.model()` itself. */
199
+ /**
200
+ * `null` when the JSON sets none. The platform reads it at deploy; `agent.ts` passes the same
201
+ * value to `segmentstream.model()`, which never reads the mount's configuration.
202
+ */
200
203
  readonly chat: ChatModelChoice | null;
201
204
  readonly stt: string | false;
202
205
  readonly imageDescription: string | false | null;
@@ -227,6 +230,11 @@ export declare class SegmentStreamAgentConfigError extends Error {
227
230
  readonly name = "SegmentStreamAgentConfigError";
228
231
  constructor(issues: ReadonlyArray<ConfigIssue>);
229
232
  }
233
+ /**
234
+ * The chat model choice `agent.ts` passes to `segmentstream.model()`, validated like `models.chat`
235
+ * of `agent/segmentstream.json`, where it normally comes from.
236
+ */
237
+ export declare function chatModelChoiceOf(value: unknown): ChatModelChoice;
230
238
  /** Exact historical pins retain the pre-0.13 presentation contract at the archive boundary. */
231
239
  export declare function isLegacyAgentArchive(version: string | undefined): boolean;
232
240
  /** Validates the authored configuration and applies the defaults. */
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath as __eveFileURLToPath } from "node:url";
2
- import { dirname as __eveDirname } from "node:path";
2
+ import { dirname as __eveDirname, isAbsolute, relative, resolve } from "node:path";
3
3
  import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
@@ -10,7 +10,6 @@ import { STRUCTURED_KINDS } from "./lib/telegram/structured-settings.mjs";
10
10
  import { TELEGRAM_TEXT_KEYS } from "./lib/telegram/texts.mjs";
11
11
  import { isTechnicalText } from "./lib/customer-text-safety.mjs";
12
12
  import { readFileSync, realpathSync } from "node:fs";
13
- import { isAbsolute, relative, resolve } from "node:path";
14
13
  import { expandGroupFiles, groupPolicyIssues } from "@segmentstream-cloud/ontology/groups";
15
14
  import { TELEGRAM_LINK_PREVIEWS, isHttpOrigin } from "@segmentstream-cloud/ontology/telegram";
16
15
  const CONNECTION_KEY = /^[a-z][a-z0-9_]{0,63}$/;
@@ -298,6 +297,13 @@ function chatModelChoice(value, issues) {
298
297
  ...preview === void 0 ? {} : { preview }
299
298
  };
300
299
  }
300
+ function chatModelChoiceOf(value) {
301
+ const issues = [];
302
+ const choice = chatModelChoice(value, issues);
303
+ if (issues.length > 0) throw new SegmentStreamAgentConfigError(issues);
304
+ if (choice === null) throw new TypeError("segmentstream.model() needs the chat model choice: pass models.chat of agent/segmentstream.json, as in segmentstream.model(config.models.chat).");
305
+ return choice;
306
+ }
301
307
  function isSessionScope(value) {
302
308
  return SESSION_SCOPES.some((scope) => scope === value);
303
309
  }
@@ -718,4 +724,4 @@ function manifestOf(config) {
718
724
  if (validation.issues !== void 0) throw new SegmentStreamAgentConfigError(validation.issues);
719
725
  return validation.value;
720
726
  }
721
- export { ADMISSION_REPLY_KEYS, DEFAULT_ADMISSION_LIMITS, DEFAULT_ATTACHMENTS_MODEL, DEFAULT_DECISION_MODEL, DEFAULT_IMAGE_DESCRIPTION_MODEL, DEFAULT_STT_MODEL, SESSION_SCOPES, SegmentStreamAgentConfigError, TELEGRAM_POLICIES, configSchema, isLegacyAgentArchive, manifestOf, validateConfig };
727
+ export { ADMISSION_REPLY_KEYS, DEFAULT_ADMISSION_LIMITS, DEFAULT_ATTACHMENTS_MODEL, DEFAULT_DECISION_MODEL, DEFAULT_IMAGE_DESCRIPTION_MODEL, DEFAULT_STT_MODEL, SESSION_SCOPES, SegmentStreamAgentConfigError, TELEGRAM_POLICIES, chatModelChoiceOf, configSchema, isLegacyAgentArchive, manifestOf, validateConfig };
@@ -1,5 +1,5 @@
1
1
  import { manifestOf } from "./config.js";
2
- import { type DynamicModel, type ModelChoice } from "./model.js";
2
+ import { model } from "./model.js";
3
3
  export declare const segmentstream: import("eve/extension").ExtensionHandle<{
4
4
  readonly "~standard": {
5
5
  readonly version: 1;
@@ -16,7 +16,7 @@ export declare const segmentstream: import("eve/extension").ExtensionHandle<{
16
16
  };
17
17
  };
18
18
  }> & {
19
- model: (choice?: ModelChoice) => DynamicModel;
19
+ model: typeof model;
20
20
  manifestOf: typeof manifestOf;
21
21
  };
22
22
  export default segmentstream;
@@ -4,20 +4,20 @@ 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 { DEFAULT_GROUP_POLICY, effectiveGroupPolicy, groupPolicy } from "./lib/group-routing/policy.mjs";
8
7
  import { DEFAULT_ADMISSION_LIMITS, DEFAULT_DECISION_MODEL, DEFAULT_STT_MODEL, SegmentStreamAgentConfigError, configSchema, manifestOf } from "./config.mjs";
9
8
  import { chooseModel, model } from "./model.mjs";
9
+ import { DEFAULT_GROUP_POLICY, effectiveGroupPolicy, groupPolicy } from "./lib/group-routing/policy.mjs";
10
10
  import { addressingReason, conversationKey } from "./lib/group-routing/signals.mjs";
11
- import { conversationAddressing } from "./lib/group-routing/addressing.mjs";
12
11
  import { decisionRouter, routeMessage } from "./lib/group-routing/router.mjs";
13
12
  import { agentMessage } from "./lib/group-routing/messages.mjs";
14
13
  import { archivedRoutingMessages } from "./lib/group-routing/routing-context.mjs";
15
14
  import { replayRouterPayload } from "./lib/group-routing/replay.mjs";
15
+ import { conversationAddressing } from "./lib/group-routing/addressing.mjs";
16
16
  import { routingBurst } from "./lib/group-routing/burst.mjs";
17
17
  import { defineExtension } from "eve/extension";
18
18
  const extension = defineExtension({ config: configSchema });
19
19
  const segmentstream = Object.assign(extension, {
20
- model: (choice) => model(choice ?? (() => extension.config.models.chat)),
20
+ model,
21
21
  manifestOf
22
22
  });
23
23
  export { DEFAULT_ADMISSION_LIMITS, DEFAULT_DECISION_MODEL, DEFAULT_GROUP_POLICY, DEFAULT_STT_MODEL, SegmentStreamAgentConfigError, archivedRoutingMessages, chooseModel, conversationKey, segmentstream as default, segmentstream, effectiveGroupPolicy, addressingReason as groupAddressingReason, agentMessage as groupAgentMessage, conversationAddressing as groupConversationAddressing, decisionRouter as groupDecisionRouter, groupPolicy, manifestOf, model, replayRouterPayload, routeMessage as routeGroupMessage, routingBurst };
@@ -4,10 +4,10 @@ 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 segmentstream from "../extension.mjs";
7
8
  import { localizedText } from "../lib/admission.mjs";
8
- import "../../_chunks/principal-D99Lleae.mjs";
9
9
  import { confirmationLocale } from "../lib/telegram/confirmation-text.mjs";
10
- import segmentstream from "../extension.mjs";
10
+ import "../../_chunks/principal-CPOCTHBa.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;
@@ -44,9 +44,10 @@ Downloads and package installs fail. For reading one file or exact totals over o
44
44
  paging metadata. Scripts can read that JSON directly; do not retype rows. This mode accepts only
45
45
  permitted read-only tools. A saved result's row count covers that result only. Follow its cursor
46
46
  or split truncated aggregate groups into disjoint filters, verify coverage, then combine files.
47
- - A command still running after 30 seconds keeps running and returns status "running" with a
48
- directory under /tmp/.eve/jobs; check its stdout and exit files with later commands. Output over
49
- 50 KiB is truncated: write large output to a file and read it in parts.
47
+ - A command still running after 60 seconds (pass \`timeout\`, up to 120, for a long script) keeps
48
+ running and returns status "running" with a directory under /tmp/.eve/jobs; check its stdout and
49
+ exit files with later commands. Output over 50 KiB is truncated and names the file that holds all
50
+ of it: read that file in parts.
50
51
  - The sandbox is temporary. It is discarded when the chat's history resets and replaced after a
51
52
  day; keep what matters through the ontology. To keep a file you produced, pass its path inside
52
53
  /workspace to \`segmentstream__attachments_promote\` instead of an id.`;
@@ -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-D99Lleae.mjs";
8
+ import { i as memberIdOf, r as identityProviderOf } from "../../_chunks/principal-CPOCTHBa.mjs";
9
9
  import { defineDynamic } from "eve/tools";
10
10
  const ACT_AS_HEADER = "X-SegmentStream-Act-As";
11
11
  function member(memberId) {
@@ -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 { AGENT_TASK_END_ROUTE, AGENT_TASK_ROUTE, agentTaskSessions, agentTasks, taskAddress, taskPrincipal } from "./agent-task.mjs";
7
8
  import { redactDiagnostic } from "./diagnostics.mjs";
8
9
  import { channelsEnabled, runtimeIdentityEnvironment } from "./environment.mjs";
9
- import { AGENT_TASK_END_ROUTE, AGENT_TASK_ROUTE, agentTaskSessions, agentTasks, taskAddress, taskPrincipal } from "./agent-task.mjs";
10
10
  import { runtimeTokenVerifier } from "./runtime-identity.mjs";
11
11
  import { runtimeRequestFailure } from "./telegram/runtime-request.mjs";
12
12
  import { POST, defineChannel } from "eve/channels";
@@ -110,7 +110,7 @@ function agentTaskEvents(input) {
110
110
  async function retire(source, timeoutMs) {
111
111
  let delivery;
112
112
  try {
113
- delivery = await source.reset();
113
+ delivery = await source.end();
114
114
  } catch (cause) {
115
115
  if (SessionNotActiveError.is(cause)) return;
116
116
  throw cause;
@@ -180,7 +180,7 @@ function agentTaskChannel(options = {}) {
180
180
  const [taskId, sessionId] = body;
181
181
  const owner = await args.resolveSession(taskAddress(taskId));
182
182
  if (owner?.id !== sessionId) return Response.json({ ended: false });
183
- args.waitUntil(owner.reset().then(() => void 0, (cause) => {
183
+ args.waitUntil(owner.end().then(() => void 0, (cause) => {
184
184
  if (!SessionNotActiveError.is(cause)) log("[segmentstream] agent_task_end_failed", {
185
185
  taskId,
186
186
  sessionId,
@@ -4,13 +4,13 @@ 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 { appOrigin } from "./environment.mjs";
8
- import { runtimeToken } from "./runtime-token.mjs";
9
- import { i as memberIdOf } from "../../_chunks/principal-D99Lleae.mjs";
10
7
  import { agentAttachments } from "./attachments.mjs";
11
- import { telegramConversation } from "./telegram/files.mjs";
12
8
  import { detectFile, documentText } from "./attachment-formats.mjs";
13
9
  import { readSheets, typedTable } from "./attachment-tables.mjs";
10
+ import { appOrigin } from "./environment.mjs";
11
+ import { runtimeToken } from "./runtime-token.mjs";
12
+ import { telegramConversation } from "./telegram/files.mjs";
13
+ import { i as memberIdOf } from "../../_chunks/principal-CPOCTHBa.mjs";
14
14
  const MAXIMUM_TEXT_CHARACTERS = 5e4;
15
15
  const MAXIMUM_INLINE_BYTES = 5242880;
16
16
  var AttachmentOwnerError = class extends Error {
@@ -4,8 +4,8 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- import { ACT_AS_HEADER } from "./actor.mjs";
8
7
  import { MAXIMUM_DOWNLOAD_BYTES } from "./connection-proxy.mjs";
8
+ import { ACT_AS_HEADER } from "./actor.mjs";
9
9
  import { createHash } from "node:crypto";
10
10
  const MAXIMUM_ATTACHMENT_BYTES = MAXIMUM_DOWNLOAD_BYTES;
11
11
  const ATTACHMENT_TTL_HOURS = 24;
@@ -4,5 +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
- import { t as agentBuild } from "../../_chunks/build-metadata-CMFK1R_F.mjs";
8
- export { agentBuild };
7
+ export { t as agentBuild } from "../../_chunks/build-metadata-CZuxPOVF.mjs";
@@ -5,9 +5,9 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { agentTaskIdOf } from "./agent-task.mjs";
8
- import { collapseConversationEvents, conversations, topicContext } from "./conversations.mjs";
9
- import { p as reportTelegramError } from "../../_chunks/inbound-request-D1r0FkDI.mjs";
10
8
  import { conversationCoordinates } from "./conversation-runtime.mjs";
9
+ import { collapseConversationEvents, conversations, topicContext } from "./conversations.mjs";
10
+ import { p as reportTelegramError } from "../../_chunks/inbound-request-Dy7q3T23.mjs";
11
11
  import { deliveries, runs, turns } from "eve/events";
12
12
  import { createHash } from "node:crypto";
13
13
  import { defineState } from "eve/context";
@@ -4,13 +4,13 @@ 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 { withTelegramTexts } from "./telegram/texts.mjs";
8
- import { i as memberIdOf } from "../../_chunks/principal-D99Lleae.mjs";
7
+ import { actorOf, member } from "./actor.mjs";
8
+ import { i as memberIdOf } from "../../_chunks/principal-CPOCTHBa.mjs";
9
9
  import { UnsafeConfirmationTarget } from "./confirmation-description.mjs";
10
+ import { chatPostDigest, isChatPost } from "./chat-post-confirmation.mjs";
10
11
  import { confirmationCopy, confirmationLocale, renderConfirmation } from "./telegram/confirmation-text.mjs";
11
12
  import { chatPostCard } from "./telegram/chat-post-card.mjs";
12
- import { actorOf, member } from "./actor.mjs";
13
- import { chatPostDigest, isChatPost } from "./chat-post-confirmation.mjs";
13
+ import { withTelegramTexts } from "./telegram/texts.mjs";
14
14
  import { createHash } from "node:crypto";
15
15
  import { defineState } from "eve/context";
16
16
  const CONFIRMATION_TTL_MS = 6e5;
@@ -4,10 +4,10 @@ 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 { agentTaskIdOf } from "./agent-task.mjs";
8
- import { i as memberIdOf } from "../../_chunks/principal-D99Lleae.mjs";
9
7
  import { n as contentText, t as CONTENT_CAPS } from "../../_chunks/content-cDtVnr8Y.mjs";
10
8
  import { conversationEvent, conversations, sessionFailureEventId, summarizeArguments } from "./conversations.mjs";
9
+ import { agentTaskIdOf } from "./agent-task.mjs";
10
+ import { i as memberIdOf } from "../../_chunks/principal-CPOCTHBa.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,13 +4,13 @@ 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 { DEFAULT_GROUP_POLICY, groupPolicy, overlaySmartPolicy } from "./policy.mjs";
8
- import { addressingReason, otherRecipient, signalAudience } from "./signals.mjs";
9
7
  import { conversationAddressing } from "./addressing.mjs";
10
8
  import { addressedToAgent, conversationDecisionRouter } from "./conversation-router.mjs";
11
9
  import { recordRoutingMetric } from "./health.mjs";
10
+ import { DEFAULT_GROUP_POLICY, groupPolicy, overlaySmartPolicy } from "./policy.mjs";
12
11
  import { humanAddressee, humanThread, questionInvitation, restoreEngagement } from "./engagement.mjs";
13
12
  import { boundedRouterPayload, policyHash } from "./record.mjs";
13
+ import { addressingReason, otherRecipient, signalAudience } from "./signals.mjs";
14
14
  const FOLLOW_UP_WINDOW_MS = 18e5;
15
15
  function isAgentMessage(message) {
16
16
  return "role" in message && message.role === "agent";
@@ -4,8 +4,8 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- import { collapseConversationEvents } from "../conversations.mjs";
8
7
  import { agentMessage } from "./messages.mjs";
8
+ import { collapseConversationEvents } from "../conversations.mjs";
9
9
  function archivedMetadata(event) {
10
10
  try {
11
11
  return JSON.parse(event.argsSummary ?? "null")?.routing ?? {};
@@ -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 { redactTelegramDiagnostic } from "./telegram/diagnostic-redaction.mjs";
8
7
  import { conversationEvent } from "./conversations.mjs";
9
8
  import { modelServiceFailure } from "./model-service-failure.mjs";
9
+ import { redactTelegramDiagnostic } from "./telegram/diagnostic-redaction.mjs";
10
10
  async function recordModelServiceAlert(archive, scope, error) {
11
11
  const category = modelServiceFailure(error);
12
12
  if (category === void 0) return;
@@ -4,13 +4,13 @@ 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
8
  import { appOrigin } from "./environment.mjs";
8
- import { runtimeToken, tokenExpiry } from "./runtime-token.mjs";
9
- import { c as compatibleRuntimeEnvelope, u as runtimeEnvelope } from "../../_chunks/principal-D99Lleae.mjs";
10
- import { ACT_AS_HEADER, ActorRequiredError, actorHeaders, actorKey, actorOf } from "./actor.mjs";
11
- import { CHAT_POST_ENVELOPE, CHAT_POST_TOOL, chatPostDigest, chatPostOperationId, isChatPost } from "./chat-post-confirmation.mjs";
12
9
  import { actionApproval, confirmations } from "./confirmations.mjs";
10
+ import { CHAT_POST_ENVELOPE, CHAT_POST_TOOL, chatPostDigest, chatPostOperationId, isChatPost } from "./chat-post-confirmation.mjs";
13
11
  import { ontologyTools } from "./ontology-tools.mjs";
12
+ import { runtimeToken, tokenExpiry } from "./runtime-token.mjs";
13
+ import { ACT_AS_HEADER, ActorRequiredError, actorHeaders, actorKey, actorOf } from "./actor.mjs";
14
14
  import { defineMcpClientConnection } from "eve/connections";
15
15
  const DESCRIPTION = "The company's ontology: its records, their history, and the actions that change them, narrowed to what the user you act for may read and do. Use describe for the compact entity index or discover for metadata search, then describe relevant refs for complete definitions. Call me for that user. Older ontologies without discover provide the legacy catalog through describe.";
16
16
  function actAsHeaders(input) {
@@ -4,13 +4,13 @@ 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-D99Lleae.mjs";
8
- import { actorKey, actorOf } from "./actor.mjs";
9
- import { isChatPost } from "./chat-post-confirmation.mjs";
10
7
  import { actionApproval, confirmations, inputHash } from "./confirmations.mjs";
8
+ import { isChatPost } from "./chat-post-confirmation.mjs";
11
9
  import { ontologyTools } from "./ontology-tools.mjs";
10
+ import { u as runtimeEnvelope } from "../../_chunks/principal-CPOCTHBa.mjs";
12
11
  import { sandboxFile } from "./sandbox-session.mjs";
13
12
  import { saveOntologyResult } from "./ontology-result-file.mjs";
13
+ import { actorKey, actorOf } from "./actor.mjs";
14
14
  import { defineState } from "eve/context";
15
15
  import { defineTool } from "eve/tools";
16
16
  const snapshots = defineState("segmentstream.ontologyFiles", () => ({}));
@@ -4,13 +4,13 @@ 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 { redactDiagnostic } from "./diagnostics.mjs";
8
- import { appOrigin } from "./environment.mjs";
9
- import { runtimeToken } from "./runtime-token.mjs";
7
+ import { c as compatibleRuntimeEnvelope, s as RUNTIME_SOURCE_PROTOCOL, u as runtimeEnvelope } from "../../_chunks/principal-CPOCTHBa.mjs";
10
8
  import "./agent-task.mjs";
11
- import { c as compatibleRuntimeEnvelope, s as RUNTIME_SOURCE_PROTOCOL, u as runtimeEnvelope } from "../../_chunks/principal-D99Lleae.mjs";
12
- import { describeConfirmation, object } from "./confirmation-description.mjs";
13
9
  import { actorHeaders, actorKey, actorOf } from "./actor.mjs";
10
+ import { describeConfirmation, object } from "./confirmation-description.mjs";
11
+ import { appOrigin } from "./environment.mjs";
12
+ import { redactDiagnostic } from "./diagnostics.mjs";
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
16
  var OntologyToolRejected = class extends Error {
@@ -4,5 +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
- import { c as compatibleRuntimeEnvelope, d as telegramRuntimeSource, l as principalRuntimeSource, s as RUNTIME_SOURCE_PROTOCOL, u as runtimeEnvelope } from "../../_chunks/principal-D99Lleae.mjs";
8
- export { RUNTIME_SOURCE_PROTOCOL, compatibleRuntimeEnvelope, principalRuntimeSource, runtimeEnvelope, telegramRuntimeSource };
7
+ export { s as RUNTIME_SOURCE_PROTOCOL, c as compatibleRuntimeEnvelope, l as principalRuntimeSource, u as runtimeEnvelope, d as telegramRuntimeSource } from "../../_chunks/principal-CPOCTHBa.mjs";
@@ -1,11 +1,10 @@
1
1
  import { fileURLToPath as __eveFileURLToPath } from "node:url";
2
- import { dirname as __eveDirname } from "node:path";
2
+ import { dirname as __eveDirname, posix } from "node:path";
3
3
  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
7
  import { defineState } from "eve/context";
8
- import { posix } from "node:path";
9
8
  const SANDBOX_MARKER_PATH = "/workspace/.segmentstream/sandbox.json";
10
9
  const SANDBOX_ATTACHMENTS_DIRECTORY = "/workspace/.eve/attachments";
11
10
  const SANDBOX_MAXIMUM_AGE_MS = 864e5;
@@ -4,11 +4,11 @@ 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 { redactDiagnostic } from "./diagnostics.mjs";
8
- import { i as memberIdOf } from "../../_chunks/principal-D99Lleae.mjs";
9
7
  import { object } from "./confirmation-description.mjs";
10
- import { member } from "./actor.mjs";
11
8
  import { OntologyFileUnavailable, ontologyTools } from "./ontology-tools.mjs";
9
+ import { i as memberIdOf } from "../../_chunks/principal-CPOCTHBa.mjs";
10
+ import { member } from "./actor.mjs";
11
+ import { redactDiagnostic } from "./diagnostics.mjs";
12
12
  import { createHash } from "node:crypto";
13
13
  async function readStoredFile(input, principal, options = {}) {
14
14
  const grant = await storedFileGrant(input, principal, options);
@@ -4,44 +4,44 @@ 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 { appOrigin, channelsEnabled, proxyEnvironment, runtimeIdentityEnvironment, webhookSecret } from "../environment.mjs";
8
- import { runtimeToken } from "../runtime-token.mjs";
9
- import { runtimeTokenVerifier } from "../runtime-identity.mjs";
10
- import { telegramText, withTelegramTexts } from "./texts.mjs";
11
- import { manifestOf } from "../../config.mjs";
12
- import { n as conversationLanguage, o as telegramPrincipal } from "../../../_chunks/principal-D99Lleae.mjs";
13
7
  import { object } from "../confirmation-description.mjs";
14
- import { confirmationLocale } from "./confirmation-text.mjs";
15
- import { telegramSendScope } from "./send-queue.mjs";
16
- import { conversations, topicContext } from "../conversations.mjs";
17
- import { withDeliveryDiagnostics } from "./delivery-diagnostics.mjs";
18
- 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-D1r0FkDI.mjs";
19
- import { chooseModel } from "../../model.mjs";
20
- import { groupRoutingHealth } from "../group-routing/health.mjs";
21
- import { decisionRouter } from "../group-routing/router.mjs";
22
8
  import { archivedRoutingMessages } from "../group-routing/routing-context.mjs";
9
+ import { groupRoutingHealth } from "../group-routing/health.mjs";
23
10
  import { dispatchStructuredMessage, structuredMessage } from "./structured.mjs";
24
- import { scopedAddress } from "./sessions.mjs";
25
11
  import { handleWorkspaceCallback, isWorkspaceCallback } from "./callbacks.mjs";
26
- import { t as agentBuild } from "../../../_chunks/build-metadata-CMFK1R_F.mjs";
12
+ import { telegramText, withTelegramTexts } from "./texts.mjs";
13
+ import { t as agentBuild } from "../../../_chunks/build-metadata-CZuxPOVF.mjs";
27
14
  import { attachmentLifecycle } from "./lifecycle.mjs";
28
- import { gatewayImageDescriber } from "./images.mjs";
15
+ import { manifestOf } from "../../config.mjs";
29
16
  import { gatewayAttachmentDescriber } from "./attachment-description.mjs";
30
- import { MAXIMUM_DOWNLOAD_BYTES, connectionProxy } from "../connection-proxy.mjs";
17
+ import { chooseModel } from "../../model.mjs";
31
18
  import { agentAttachments, parseAttachmentUrl } from "../attachments.mjs";
19
+ import { MAXIMUM_DOWNLOAD_BYTES, connectionProxy } from "../connection-proxy.mjs";
20
+ import { appOrigin, channelsEnabled, proxyEnvironment, runtimeIdentityEnvironment, webhookSecret } from "../environment.mjs";
32
21
  import { agentIdentities } from "../identities.mjs";
22
+ import { conversations, topicContext } from "../conversations.mjs";
33
23
  import { captureRouteDecider, captureTelegramFetch, conversationIdentities, recordGateDecision, telegramConversationCapture } from "./conversations.mjs";
24
+ import { runtimeTokenVerifier } from "../runtime-identity.mjs";
25
+ import { runtimeToken } from "../runtime-token.mjs";
34
26
  import { botIdentityCache } from "./bot.mjs";
35
27
  import { handleConfirmationCallback, telegramConfirmationEvents } from "./confirmations.mjs";
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";
31
+ import { gatewayImageDescriber } from "./images.mjs";
36
32
  import { gatewayMediaCapabilities, planMedia } from "./media-policy.mjs";
37
33
  import { agentChats } from "./chats.mjs";
38
- import { interimTexts, replyDelivery } from "./silent.mjs";
39
- import { downloadTelegramFile, gatewayTranscriber } from "./voice.mjs";
40
34
  import { handleInboundMessage } from "./inbound.mjs";
41
35
  import { recoverableSessions } from "./session-recovery.mjs";
42
36
  import { TELEGRAM_PLACEHOLDER_TOKEN, TELEGRAM_PROXY_ORIGIN, telegramProxyFetch } from "./proxy-fetch.mjs";
43
37
  import { healthRoute } from "./health.mjs";
38
+ import { decisionRouter } from "../group-routing/router.mjs";
39
+ import { scopedAddress } from "./sessions.mjs";
40
+ import { interimTexts, replyDelivery } from "./silent.mjs";
41
+ import { telegramSendScope } from "./send-queue.mjs";
44
42
  import { telegramFailureEvents } from "./turn-errors.mjs";
43
+ import { withDeliveryDiagnostics } from "./delivery-diagnostics.mjs";
44
+ import { downloadTelegramFile, gatewayTranscriber } from "./voice.mjs";
45
45
  import { telegramWebhookVerifier } from "./webhook.mjs";
46
46
  import { telegramPreviewEnvironment } from "@segmentstream-cloud/ontology/telegram";
47
47
  import { telegramChannel } from "eve/channels/telegram";
@@ -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 { p as reportTelegramError } from "../../../_chunks/inbound-request-D1r0FkDI.mjs";
8
7
  import { describableImage } from "./images.mjs";
9
8
  import { MAXIMUM_ROUTING_PDF_CHARACTERS, extractRoutingPdf } from "./pdf-text.mjs";
9
+ import { p as reportTelegramError } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
10
10
  import { gateway, generateText } from "ai";
11
11
  const MAXIMUM_ROUTING_ATTACHMENT_BYTES = 5242880;
12
12
  const ROUTING_ATTACHMENT_TIMEOUT_MS = 15e3;
@@ -4,19 +4,19 @@ 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 { attachmentOwner } from "../attachment-tools.mjs";
8
+ import { AttachmentError, CONVERSATION_HEADER, SESSION_HEADER } from "../attachments.mjs";
9
+ import { MAXIMUM_PROXY_BODY_BYTES, connectionProxy } from "../connection-proxy.mjs";
7
10
  import { redactDiagnostic } from "../diagnostics.mjs";
11
+ import { fetchFileGrant, transientFileStatus } from "../file-grant.mjs";
8
12
  import { appOrigin, channelsEnabled, proxyEnvironment } from "../environment.mjs";
13
+ import { ACT_AS_HEADER } from "../actor.mjs";
9
14
  import { runtimeToken } from "../runtime-token.mjs";
10
- import "../../../_chunks/principal-D99Lleae.mjs";
15
+ import "../../../_chunks/principal-CPOCTHBa.mjs";
11
16
  import { confirmationLocale } from "./confirmation-text.mjs";
12
17
  import { inTelegramSendQueue, telegramSendScope } from "./send-queue.mjs";
13
- import { d as failureText, f as formattingRefused, l as customerMessage, p as reportTelegramError } from "../../../_chunks/inbound-request-D1r0FkDI.mjs";
14
- import { ACT_AS_HEADER } from "../actor.mjs";
15
- import { MAXIMUM_PROXY_BODY_BYTES, connectionProxy } from "../connection-proxy.mjs";
16
- import { AttachmentError, CONVERSATION_HEADER, SESSION_HEADER } from "../attachments.mjs";
18
+ import { d as failureText, f as formattingRefused, l as customerMessage, p as reportTelegramError } from "../../../_chunks/inbound-request-Dy7q3T23.mjs";
17
19
  import { TELEGRAM_PLACEHOLDER_TOKEN, TELEGRAM_PROXY_ORIGIN, telegramProxyFetch } from "./proxy-fetch.mjs";
18
- import { attachmentOwner } from "../attachment-tools.mjs";
19
- import { fetchFileGrant, transientFileStatus } from "../file-grant.mjs";
20
20
  const MAXIMUM_PHOTO_BYTES = 10485760;
21
21
  const MAXIMUM_DOCUMENT_BYTES = 52428800;
22
22
  const PHOTOS = new Set([
@@ -4,8 +4,8 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- import { otherRecipient } from "../group-routing/signals.mjs";
8
7
  import { messageContent, telegramRecord } from "./content.mjs";
8
+ import { otherRecipient } from "../group-routing/signals.mjs";
9
9
  function recipient(user, bot) {
10
10
  const id = typeof user.id === "string" || typeof user.id === "number" ? String(user.id) : void 0;
11
11
  const username = typeof user.username === "string" ? user.username : void 0;