@segmentstream/agent 0.51.0 → 0.52.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 (91) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +65 -27
  3. package/dist/_chunks/{build-metadata-C6OqEkxw.mjs → build-metadata-D1C8gnfm.mjs} +1 -1
  4. package/dist/_chunks/{principal-ie0lHCpn.mjs → principal-JoaOmdFL.mjs} +114 -11
  5. package/dist/extension/config.d.ts +37 -1
  6. package/dist/extension/config.mjs +74 -3
  7. package/dist/extension/connections/ontology.mjs +1 -1
  8. package/dist/extension/extension.d.ts +1 -1
  9. package/dist/extension/hooks/authorization.mjs +1 -1
  10. package/dist/extension/instructions/persona.mjs +1 -1
  11. package/dist/extension/instructions/sandbox.mjs +2 -1
  12. package/dist/extension/lib/actor.d.ts +17 -6
  13. package/dist/extension/lib/actor.mjs +1 -1
  14. package/dist/extension/lib/admission.mjs +10 -1
  15. package/dist/extension/lib/agent-task.d.ts +2 -0
  16. package/dist/extension/lib/agent-task.mjs +6 -2
  17. package/dist/extension/lib/agent-tools.d.ts +42 -0
  18. package/dist/extension/lib/agent-tools.mjs +43 -0
  19. package/dist/extension/lib/attachment-tools.mjs +1 -1
  20. package/dist/extension/lib/attachments.mjs +1 -1
  21. package/dist/extension/lib/build-metadata.mjs +1 -1
  22. package/dist/extension/lib/chat-address.mjs +1 -1
  23. package/dist/extension/lib/chat-context.mjs +1 -1
  24. package/dist/extension/lib/chat-recorder.mjs +10 -1
  25. package/dist/extension/lib/confirmations.mjs +1 -1
  26. package/dist/extension/lib/email/channel.mjs +3 -1
  27. package/dist/extension/lib/html-text.d.ts +14 -0
  28. package/dist/extension/lib/html-text.mjs +198 -0
  29. package/dist/extension/lib/identities.d.ts +5 -0
  30. package/dist/extension/lib/identities.mjs +4 -1
  31. package/dist/extension/lib/inbound-media/files.mjs +1 -1
  32. package/dist/extension/lib/inbound-media/index.mjs +1 -1
  33. package/dist/extension/lib/ontology-connection.mjs +1 -1
  34. package/dist/extension/lib/ontology-file-call.mjs +7 -1
  35. package/dist/extension/lib/ontology-tools.mjs +1 -1
  36. package/dist/extension/lib/review/hold.mjs +1 -1
  37. package/dist/extension/lib/review/reply.mjs +1 -1
  38. package/dist/extension/lib/role-skill.mjs +1 -1
  39. package/dist/extension/lib/runtime-envelope.mjs +1 -1
  40. package/dist/extension/lib/sent-files.mjs +1 -1
  41. package/dist/extension/lib/slack/adapter.mjs +3 -1
  42. package/dist/extension/lib/slack/attachments-send.mjs +1 -1
  43. package/dist/extension/lib/stored-files.mjs +1 -1
  44. package/dist/extension/lib/telegram/adapter.mjs +2 -2
  45. package/dist/extension/lib/telegram/attachment-description.mjs +1 -1
  46. package/dist/extension/lib/telegram/attachments-send.mjs +1 -1
  47. package/dist/extension/lib/telegram/callbacks.mjs +1 -1
  48. package/dist/extension/lib/telegram/chat-archive.mjs +1 -1
  49. package/dist/extension/lib/telegram/confirmations.mjs +1 -1
  50. package/dist/extension/lib/telegram/customer-text.mjs +1 -1
  51. package/dist/extension/lib/telegram/files.mjs +1 -1
  52. package/dist/extension/lib/telegram/health.mjs +1 -1
  53. package/dist/extension/lib/telegram/held-approvals.mjs +1 -1
  54. package/dist/extension/lib/telegram/inbound-request.mjs +1 -1
  55. package/dist/extension/lib/telegram/inbound.mjs +1 -1
  56. package/dist/extension/lib/telegram/lifecycle.mjs +2 -2
  57. package/dist/extension/lib/telegram/principal.mjs +1 -1
  58. package/dist/extension/lib/telegram/session-recovery.mjs +1 -1
  59. package/dist/extension/lib/telegram/silent.mjs +1 -1
  60. package/dist/extension/lib/telegram/structured.mjs +1 -1
  61. package/dist/extension/lib/telegram/turn-errors.mjs +1 -1
  62. package/dist/extension/lib/telegram/workspace-action.mjs +1 -1
  63. package/dist/extension/lib/web/auth.d.ts +65 -8
  64. package/dist/extension/lib/web/auth.mjs +1 -1
  65. package/dist/extension/lib/web/channel.d.ts +10 -6
  66. package/dist/extension/lib/web/channel.mjs +1 -1
  67. package/dist/extension/lib/web-fetch.d.ts +60 -0
  68. package/dist/extension/lib/web-fetch.mjs +244 -0
  69. package/dist/extension/lib/whatsapp/adapter.mjs +3 -1
  70. package/dist/extension/lib/whatsapp/files.mjs +1 -1
  71. package/dist/extension/lib/workspace-source.mjs +1 -1
  72. package/dist/extension/model.mjs +1 -1
  73. package/dist/extension/tools/attachments_discard.mjs +1 -1
  74. package/dist/extension/tools/attachments_list.mjs +1 -1
  75. package/dist/extension/tools/attachments_promote.mjs +3 -1
  76. package/dist/extension/tools/attachments_read.mjs +1 -1
  77. package/dist/extension/tools/attachments_send.mjs +1 -1
  78. package/dist/extension/tools/attachments_stage.d.ts +2 -2
  79. package/dist/extension/tools/attachments_stage.mjs +7 -2
  80. package/dist/extension/tools/attachments_table.mjs +1 -1
  81. package/dist/extension/tools/ontology_call_file.d.ts +1 -0
  82. package/dist/extension/tools/ontology_call_file.mjs +2 -1
  83. package/dist/extension/tools/questions_ask.d.ts +1 -3
  84. package/dist/extension/tools/questions_ask.mjs +3 -3
  85. package/dist/extension/tools/sandbox.mjs +5 -1
  86. package/dist/extension/tools/web_fetch.d.ts +2 -0
  87. package/dist/extension/tools/web_fetch.mjs +73 -0
  88. package/dist/extension/tools/workspace_source.mjs +4 -2
  89. package/dist/tools/index.d.ts +1 -0
  90. package/dist/tools/index.mjs +2 -1
  91. package/package.json +2 -2
@@ -0,0 +1,198 @@
1
+ import { fileURLToPath as __eveFileURLToPath } from "node:url";
2
+ import { dirname as __eveDirname } from "node:path";
3
+ import { createRequire as __eveCreateRequire } from "node:module";
4
+ const __filename = __eveFileURLToPath(import.meta.url);
5
+ __eveDirname(__filename);
6
+ __eveCreateRequire(import.meta.url);
7
+ const HIDDEN = new Set([
8
+ "canvas",
9
+ "iframe",
10
+ "math",
11
+ "noscript",
12
+ "object",
13
+ "script",
14
+ "select",
15
+ "style",
16
+ "svg",
17
+ "template",
18
+ "textarea"
19
+ ]);
20
+ const BLOCKS = new Set([
21
+ "address",
22
+ "article",
23
+ "aside",
24
+ "blockquote",
25
+ "caption",
26
+ "details",
27
+ "dialog",
28
+ "div",
29
+ "dl",
30
+ "fieldset",
31
+ "figcaption",
32
+ "figure",
33
+ "footer",
34
+ "form",
35
+ "header",
36
+ "hgroup",
37
+ "main",
38
+ "nav",
39
+ "ol",
40
+ "p",
41
+ "section",
42
+ "summary",
43
+ "table",
44
+ "title",
45
+ "ul"
46
+ ]);
47
+ const LINES = new Set([
48
+ "dd",
49
+ "dt",
50
+ "li",
51
+ "tr"
52
+ ]);
53
+ const NAMED_ENTITIES = {
54
+ amp: "&",
55
+ apos: "'",
56
+ bull: "•",
57
+ cent: "¢",
58
+ copy: "©",
59
+ deg: "°",
60
+ divide: "÷",
61
+ emsp: " ",
62
+ ensp: " ",
63
+ euro: "€",
64
+ frac12: "½",
65
+ frac14: "¼",
66
+ frac34: "¾",
67
+ gt: ">",
68
+ hellip: "…",
69
+ laquo: "«",
70
+ ldquo: "“",
71
+ lsquo: "‘",
72
+ lt: "<",
73
+ mdash: "—",
74
+ middot: "·",
75
+ nbsp: " ",
76
+ ndash: "–",
77
+ para: "¶",
78
+ plusmn: "±",
79
+ pound: "£",
80
+ quot: "\"",
81
+ raquo: "»",
82
+ rdquo: "”",
83
+ reg: "®",
84
+ rsquo: "’",
85
+ sect: "§",
86
+ shy: "",
87
+ thinsp: " ",
88
+ times: "×",
89
+ trade: "™",
90
+ yen: "¥"
91
+ };
92
+ function decodeEntities(text) {
93
+ return text.replace(/&(#x[0-9a-f]{1,8}|#[0-9]{1,8}|[a-z][a-z0-9]{1,31});?/giu, (whole, name) => {
94
+ if (name.startsWith("#")) {
95
+ const code = name[1] === "x" || name[1] === "X" ? parseInt(name.slice(2), 16) : Number(name.slice(1));
96
+ return code > 0 && code <= 1114111 && (code < 55296 || code > 57343) ? String.fromCodePoint(code) : "�";
97
+ }
98
+ return NAMED_ENTITIES[name.toLowerCase()] ?? whole;
99
+ });
100
+ }
101
+ function attribute(attributes, name) {
102
+ const match = new RegExp(`(?:^|\\s)${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`, "iu").exec(attributes);
103
+ return match === null ? void 0 : decodeEntities(match[1] ?? match[2] ?? match[3] ?? "");
104
+ }
105
+ function linkOf(href, base) {
106
+ if (href === void 0 || href.trim() === "") return;
107
+ try {
108
+ const url = new URL(href.trim(), base);
109
+ return url.protocol === "https:" || url.protocol === "http:" ? url.href : void 0;
110
+ } catch {
111
+ return;
112
+ }
113
+ }
114
+ const TAG_NAME = /^(\/?)([a-zA-Z][a-zA-Z0-9-]{0,31})/u;
115
+ function htmlToText(html, format, base) {
116
+ const markdown = format === "markdown";
117
+ const out = [];
118
+ let preformatted = 0;
119
+ let link;
120
+ let position = 0;
121
+ const text = (raw) => {
122
+ if (raw !== "") {
123
+ const decoded = decodeEntities(raw);
124
+ out.push(preformatted > 0 ? decoded : decoded.replace(/[ \t\r\n\f]+/gu, " "));
125
+ }
126
+ };
127
+ while (position < html.length) {
128
+ const open = html.indexOf("<", position);
129
+ if (open === -1) {
130
+ text(html.slice(position));
131
+ break;
132
+ }
133
+ text(html.slice(position, open));
134
+ if (html.startsWith("<!--", open)) {
135
+ const end = html.indexOf("-->", open + 4);
136
+ position = end === -1 ? html.length : end + 3;
137
+ continue;
138
+ }
139
+ if (html[open + 1] === "!" || html[open + 1] === "?") {
140
+ const end = html.indexOf(">", open);
141
+ position = end === -1 ? html.length : end + 1;
142
+ continue;
143
+ }
144
+ const tag = TAG_NAME.exec(html.slice(open + 1, open + 40));
145
+ if (tag === null) {
146
+ text("<");
147
+ position = open + 1;
148
+ continue;
149
+ }
150
+ const end = html.indexOf(">", open);
151
+ if (end === -1) break;
152
+ const closing = tag[1] === "/";
153
+ const name = tag[2].toLowerCase();
154
+ const attributes = html.slice(open + 1 + tag[0].length, end);
155
+ position = end + 1;
156
+ if (!closing && HIDDEN.has(name) && !attributes.trimEnd().endsWith("/")) {
157
+ const close = new RegExp(`</${name}\\s*>`, "giu");
158
+ close.lastIndex = position;
159
+ position = close.exec(html) === null ? html.length : close.lastIndex;
160
+ continue;
161
+ }
162
+ const heading = /^h([1-6])$/u.exec(name);
163
+ if (heading !== null) {
164
+ out.push("\n\n");
165
+ if (!closing && markdown) out.push(`${"#".repeat(Number(heading[1]))} `);
166
+ } else if (BLOCKS.has(name)) out.push("\n\n");
167
+ else if (LINES.has(name)) {
168
+ if (!closing) out.push(name === "li" && markdown ? "\n- " : "\n");
169
+ } else if (name === "br") out.push("\n");
170
+ else if (name === "hr") out.push(markdown ? "\n\n---\n\n" : "\n\n");
171
+ else if (name === "td" || name === "th") out.push(" ");
172
+ else if (name === "pre") {
173
+ preformatted = Math.max(0, preformatted + (closing ? -1 : 1));
174
+ out.push(markdown ? closing ? "\n```\n\n" : "\n\n```\n" : "\n\n");
175
+ } else if (name === "a" && markdown) {
176
+ if (!closing) {
177
+ const href = linkOf(attribute(attributes, "href"), base);
178
+ link = href === void 0 ? void 0 : {
179
+ href,
180
+ at: out.length
181
+ };
182
+ } else if (link !== void 0) {
183
+ const label = out.slice(link.at).join("").replace(/\s+/gu, " ").trim();
184
+ if (label !== "") out.splice(link.at, out.length - link.at, `[${label}](${link.href})`);
185
+ link = void 0;
186
+ }
187
+ }
188
+ }
189
+ let fenced = false;
190
+ return out.join("").split("\n").map((line) => {
191
+ if (markdown && line.trim() === "```") {
192
+ fenced = !fenced;
193
+ return "```";
194
+ }
195
+ return fenced ? line.trimEnd() : line.trim();
196
+ }).join("\n").replace(/\n{3,}/gu, "\n\n").trim();
197
+ }
198
+ export { decodeEntities, htmlToText };
@@ -12,6 +12,11 @@ export interface PairedMember {
12
12
  readonly id: string;
13
13
  readonly name: string | null;
14
14
  readonly roles: ReadonlyArray<string>;
15
+ /**
16
+ * The agent's own tools the member's roles grant, such as `sandbox`, as the ontology names them;
17
+ * the member holds none when absent.
18
+ */
19
+ readonly agentTools?: ReadonlyArray<string>;
15
20
  readonly locale?: string;
16
21
  }
17
22
  export type IdentityLookup = {
@@ -4,6 +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 { agentToolsAnswer } from "./agent-tools.mjs";
7
8
  import { redactDiagnostic } from "./diagnostics.mjs";
8
9
  var AgentIdentityError = class extends Error {
9
10
  name = "AgentIdentityError";
@@ -37,7 +38,8 @@ function remember(cache, key, value) {
37
38
  function pairedMember(value) {
38
39
  const user = isRecord(value) ? value.user : void 0;
39
40
  const roles = isRecord(value) ? value.roles : void 0;
40
- if (!isRecord(user) || typeof user.id !== "string" || user.name !== void 0 && user.name !== null && typeof user.name !== "string" || !Array.isArray(roles) || !roles.every((role) => typeof role === "string")) throw new AgentIdentityError({
41
+ const agentTools = isRecord(value) ? agentToolsAnswer(value.agent_tools) : void 0;
42
+ if (!isRecord(user) || typeof user.id !== "string" || user.name !== void 0 && user.name !== null && typeof user.name !== "string" || !Array.isArray(roles) || !roles.every((role) => typeof role === "string") || agentTools === void 0) throw new AgentIdentityError({
41
43
  code: "invalid_response",
42
44
  message: "The ontology service answered the identity lookup with an invalid body."
43
45
  });
@@ -45,6 +47,7 @@ function pairedMember(value) {
45
47
  id: user.id,
46
48
  name: typeof user.name === "string" ? user.name : null,
47
49
  roles,
50
+ agentTools,
48
51
  ...typeof user.locale === "string" ? { locale: user.locale } : {}
49
52
  };
50
53
  }
@@ -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 { f as attachmentsContext, p as storeFiles, m as turnContent } from "../../../_chunks/principal-ie0lHCpn.mjs";
7
+ export { f as attachmentsContext, p as storeFiles, m as turnContent } from "../../../_chunks/principal-JoaOmdFL.mjs";
@@ -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 { f as attachmentsContext, d as prepareInboundMedia, p as storeFiles, m as turnContent } from "../../../_chunks/principal-ie0lHCpn.mjs";
7
+ export { f as attachmentsContext, d as prepareInboundMedia, p as storeFiles, m as turnContent } from "../../../_chunks/principal-JoaOmdFL.mjs";
@@ -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 { B as ACT_AS_HEADER, E as actAsHeaders, D as ontologyConnection } from "../../_chunks/principal-ie0lHCpn.mjs";
7
+ export { B as ACT_AS_HEADER, E as actAsHeaders, D as ontologyConnection } from "../../_chunks/principal-JoaOmdFL.mjs";
@@ -4,10 +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 { I as actionApproval, L as confirmations, N as ontologyTools, R as inputHash, U as actorKey, W as actorOf, wt as runtimeEnvelope } from "../../_chunks/principal-ie0lHCpn.mjs";
7
+ import { I as actionApproval, L as confirmations, N as ontologyTools, R as inputHash, U as actorKey, W as actorOf, jt as runtimeEnvelope } from "../../_chunks/principal-JoaOmdFL.mjs";
8
8
  import { isChatPost } from "./chat-post-confirmation.mjs";
9
9
  import { sandboxFile } from "./sandbox-session.mjs";
10
10
  import { saveOntologyResult } from "./ontology-result-file.mjs";
11
+ import { AgentToolRefusedError, SANDBOX_TOOL, holdsAgentTool, requireAgentTool } from "./agent-tools.mjs";
11
12
  import { defineState } from "eve/context";
12
13
  import { defineTool } from "eve/tools";
13
14
  const snapshots = defineState("segmentstream.ontologyFiles", () => ({}));
@@ -101,6 +102,10 @@ function ontologyFileCall(texts) {
101
102
  try {
102
103
  const owner = ownerOf(actorOf(ctx.session.auth.current));
103
104
  const input = ctx.toolInput;
105
+ if (!holdsAgentTool(ctx.session.auth.current, "sandbox")) return {
106
+ type: "denied",
107
+ reason: new AgentToolRefusedError(SANDBOX_TOOL).message
108
+ };
104
109
  if (owner === void 0 || input === void 0 || isChatPost(input.name) || input.name.startsWith("ontology_") || input.name.includes("__") || !/^[a-z][a-z0-9_]*$/.test(input.name)) return {
105
110
  type: "denied",
106
111
  reason: "A paired member or a task, and a direct ontology tool, are required."
@@ -159,6 +164,7 @@ function ontologyFileCall(texts) {
159
164
  }
160
165
  },
161
166
  async execute(input, ctx) {
167
+ requireAgentTool(ctx.session.auth.current, SANDBOX_TOOL);
162
168
  const actor = actorOf(ctx.session.auth.current);
163
169
  const owner = ownerOf(actor);
164
170
  const saved = bound(request(ctx.callId, input, owner), owner);
@@ -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 { O as OntologyActionNotPermitted, k as OntologyFileUnavailable, A as OntologyToolRejected, j as actionToolName, M as ontologyToolLabels, N as ontologyTools, P as promotionTarget } from "../../_chunks/principal-ie0lHCpn.mjs";
7
+ export { O as OntologyActionNotPermitted, k as OntologyFileUnavailable, A as OntologyToolRejected, j as actionToolName, M as ontologyToolLabels, N as ontologyTools, P as promotionTarget } from "../../_chunks/principal-JoaOmdFL.mjs";
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { reviewFor } from "../../review.mjs";
8
- import { a as rolesOf, i as memberIdOf, st as chatAddressOf } from "../../../_chunks/principal-ie0lHCpn.mjs";
8
+ import { a as rolesOf, i as memberIdOf, mt as chatAddressOf } from "../../../_chunks/principal-JoaOmdFL.mjs";
9
9
  function reviewOf(settings, principal) {
10
10
  return reviewFor(settings, rolesOf(principal));
11
11
  }
@@ -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 { i as memberIdOf, st as chatAddressOf } from "../../../_chunks/principal-ie0lHCpn.mjs";
7
+ import { i as memberIdOf, mt as chatAddressOf } from "../../../_chunks/principal-JoaOmdFL.mjs";
8
8
  import { chatArchive, chatEvent } from "../chat-archive.mjs";
9
9
  import { appOrigin } from "../environment.mjs";
10
10
  import { agentReviews } from "./client.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 { a as rolesOf } from "../../_chunks/principal-ie0lHCpn.mjs";
7
+ import { a as rolesOf } from "../../_chunks/principal-JoaOmdFL.mjs";
8
8
  import { defineDynamic, defineSkill } from "eve/skills";
9
9
  function forRoles(roles, skill) {
10
10
  if (!Array.isArray(roles) || roles.length === 0 || !roles.every((role) => typeof role === "string" && role.trim() !== "")) throw new TypeError("forRoles() needs at least one role name; a skill for everyone is an ordinary skill file.");
@@ -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 { xt as RUNTIME_SOURCE_PROTOCOL, St as compatibleRuntimeEnvelope, Ct as principalRuntimeSource, wt as runtimeEnvelope, Tt as telegramRuntimeSource } from "../../_chunks/principal-ie0lHCpn.mjs";
7
+ export { Ot as RUNTIME_SOURCE_PROTOCOL, kt as compatibleRuntimeEnvelope, At as principalRuntimeSource, jt as runtimeEnvelope, Mt as telegramRuntimeSource } from "../../_chunks/principal-JoaOmdFL.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 { B as ACT_AS_HEADER, _ as AttachmentError, v as CHAT_HEADER, x as SESSION_HEADER, y as EARLIER_CHAT_HEADER } from "../../_chunks/principal-ie0lHCpn.mjs";
7
+ import { B as ACT_AS_HEADER, _ as AttachmentError, v as CHAT_HEADER, x as SESSION_HEADER, y as EARLIER_CHAT_HEADER } from "../../_chunks/principal-JoaOmdFL.mjs";
8
8
  import { fetchFileGrant, transientFileStatus } from "./file-grant.mjs";
9
9
  var StoredFileError = class extends AttachmentError {
10
10
  filename;
@@ -5,9 +5,10 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { admitMessage, localizedText } from "../admission.mjs";
8
+ import { agentToolsAttribute } from "../agent-tools.mjs";
8
9
  import { agentChats } from "../chats.mjs";
9
10
  import { withButtonDecision } from "../confirmation-buttons.mjs";
10
- import { S as agentAttachments, d as prepareInboundMedia, lt as withChatAddress, m as turnContent } from "../../../_chunks/principal-ie0lHCpn.mjs";
11
+ import { S as agentAttachments, d as prepareInboundMedia, gt as withChatAddress, m as turnContent } from "../../../_chunks/principal-JoaOmdFL.mjs";
11
12
  import { redactDiagnostic } from "../diagnostics.mjs";
12
13
  import { MAXIMUM_DOWNLOAD_BYTES, connectionProxy } from "../connection-proxy.mjs";
13
14
  import { appOrigin, channelsEnabled, proxyEnvironment, webhookSecret } from "../environment.mjs";
@@ -101,6 +102,7 @@ function slackPrincipal(member, user) {
101
102
  memberId: member.id,
102
103
  identityProvider: "slack",
103
104
  roles: member.roles,
105
+ ...agentToolsAttribute(member.agentTools),
104
106
  ...member.name === null ? {} : { memberName: member.name },
105
107
  ...member.locale === void 0 ? {} : { locale: member.locale }
106
108
  }
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { attachmentOwner } from "../attachment-tools.mjs";
8
- import { _ as AttachmentError, gt as failureText, st as chatAddressOf } from "../../../_chunks/principal-ie0lHCpn.mjs";
8
+ import { Ct as failureText, _ as AttachmentError, mt as chatAddressOf } from "../../../_chunks/principal-JoaOmdFL.mjs";
9
9
  import { MAXIMUM_PROXY_BODY_BYTES, connectionProxy } from "../connection-proxy.mjs";
10
10
  import { redactDiagnostic } from "../diagnostics.mjs";
11
11
  import { appOrigin, channelsEnabled, proxyEnvironment } from "../environment.mjs";
@@ -5,7 +5,7 @@ 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 { G as member, N as ontologyTools, i as memberIdOf, k as OntologyFileUnavailable } from "../../_chunks/principal-ie0lHCpn.mjs";
8
+ import { K as member, N as ontologyTools, i as memberIdOf, k as OntologyFileUnavailable } from "../../_chunks/principal-JoaOmdFL.mjs";
9
9
  import { redactDiagnostic } from "./diagnostics.mjs";
10
10
  import { createHash } from "node:crypto";
11
11
  async function readStoredFile(input, principal, options = {}) {
@@ -10,12 +10,12 @@ 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-C6OqEkxw.mjs";
13
+ import { t as agentBuild } from "../../../_chunks/build-metadata-D1C8gnfm.mjs";
14
14
  import { attachmentLifecycle } from "./lifecycle.mjs";
15
15
  import { manifestOf } from "../../config.mjs";
16
16
  import { gatewayAttachmentDescriber } from "./attachment-description.mjs";
17
17
  import { chooseModel } from "../../model.mjs";
18
- import { S as agentAttachments, bt as withDeliveryLocale, c as currentInboundRequest, dt as currentLocale, gt as failureText, l as runInboundRequest, n as chatLanguage, o as telegramPrincipal, s as InboundRequest, u as withReplacedText, vt as reportTelegramError, w as fetchStoredAttachment, yt as safeTelegramFetch } from "../../../_chunks/principal-ie0lHCpn.mjs";
18
+ import { Ct as failureText, Dt as withDeliveryLocale, Et as safeTelegramFetch, S as agentAttachments, Tt as reportTelegramError, c as currentInboundRequest, l as runInboundRequest, n as chatLanguage, o as telegramPrincipal, s as InboundRequest, u as withReplacedText, vt as currentLocale, w as fetchStoredAttachment } from "../../../_chunks/principal-JoaOmdFL.mjs";
19
19
  import { MAXIMUM_DOWNLOAD_BYTES, connectionProxy } from "../connection-proxy.mjs";
20
20
  import { appOrigin, channelsEnabled, proxyEnvironment, runtimeIdentityEnvironment, webhookSecret } from "../environment.mjs";
21
21
  import { agentIdentities } from "../identities.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 "../inbound-media/images.mjs";
8
- import { vt as reportTelegramError } from "../../../_chunks/principal-ie0lHCpn.mjs";
8
+ import { Tt as reportTelegramError } from "../../../_chunks/principal-JoaOmdFL.mjs";
9
9
  import { gateway, generateText } from "ai";
10
10
  const MAXIMUM_ROUTING_ATTACHMENT_BYTES = 5242880;
11
11
  const ROUTING_ATTACHMENT_TIMEOUT_MS = 15e3;
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { attachmentOwner } from "../attachment-tools.mjs";
8
- import { _ as AttachmentError, _t as formattingRefused, gt as failureText, mt as customerMessage, vt as reportTelegramError } from "../../../_chunks/principal-ie0lHCpn.mjs";
8
+ import { Ct as failureText, Tt as reportTelegramError, _ as AttachmentError, wt as formattingRefused, xt as customerMessage } from "../../../_chunks/principal-JoaOmdFL.mjs";
9
9
  import { MAXIMUM_PROXY_BODY_BYTES, connectionProxy } from "../connection-proxy.mjs";
10
10
  import { redactDiagnostic } from "../diagnostics.mjs";
11
11
  import { transientFileStatus } from "../file-grant.mjs";
@@ -5,7 +5,7 @@ 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 { Tt as telegramRuntimeSource, c as currentInboundRequest, i as memberIdOf, o as telegramPrincipal, vt as reportTelegramError, wt as runtimeEnvelope } from "../../../_chunks/principal-ie0lHCpn.mjs";
8
+ import { Mt as telegramRuntimeSource, Tt as reportTelegramError, c as currentInboundRequest, i as memberIdOf, jt as runtimeEnvelope, o as telegramPrincipal } from "../../../_chunks/principal-JoaOmdFL.mjs";
9
9
  import { formatAddress, parseAddress, scopedAddress } from "./sessions.mjs";
10
10
  import { telegramText } from "./texts.mjs";
11
11
  import { workspaceAction } from "./workspace-action.mjs";
@@ -9,7 +9,7 @@ import { n as contentText, t as CONTENT_CAPS } from "../../../_chunks/content-cD
9
9
  import { chatEvent, sessionFailureEventId } from "../chat-archive.mjs";
10
10
  import { currentConfirmationPrompt } from "../group-routing/messages.mjs";
11
11
  import { messageMetadata } from "./message-metadata.mjs";
12
- import { c as currentInboundRequest, ft as currentThreadId, vt as reportTelegramError } from "../../../_chunks/principal-ie0lHCpn.mjs";
12
+ import { Tt as reportTelegramError, c as currentInboundRequest, yt as currentThreadId } from "../../../_chunks/principal-JoaOmdFL.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,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { telegramText } from "./texts.mjs";
8
- import { L as confirmations, c as currentInboundRequest, i as memberIdOf, o as telegramPrincipal, vt as reportTelegramError } from "../../../_chunks/principal-ie0lHCpn.mjs";
8
+ import { L as confirmations, Tt as reportTelegramError, c as currentInboundRequest, i as memberIdOf, o as telegramPrincipal } from "../../../_chunks/principal-JoaOmdFL.mjs";
9
9
  import { humanText } from "../confirmation-description.mjs";
10
10
  import { withConfirmationPrompt } from "../group-routing/messages.mjs";
11
11
  import { chatPostOperationId, isChatPost } from "../chat-post-confirmation.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 { _t as formattingRefused, bt as withDeliveryLocale, dt as currentLocale, ft as currentThreadId, gt as failureText, ht as customerText, mt as customerMessage, pt as customerCopy, ut as TelegramDeliveryError, vt as reportTelegramError, yt as safeTelegramFetch } from "../../../_chunks/principal-ie0lHCpn.mjs";
8
+ import { Ct as failureText, Dt as withDeliveryLocale, Et as safeTelegramFetch, St as customerText, Tt as reportTelegramError, _t as TelegramDeliveryError, bt as customerCopy, vt as currentLocale, wt as formattingRefused, xt as customerMessage, yt as currentThreadId } from "../../../_chunks/principal-JoaOmdFL.mjs";
9
9
  export { TelegramDeliveryError, currentLocale, currentThreadId, customerCopy, customerMessage, customerText, failureText, formattingRefused, isTechnicalText, reportTelegramError, safeTelegramFetch, withDeliveryLocale };
@@ -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 storeFiles, vt as reportTelegramError } from "../../../_chunks/principal-ie0lHCpn.mjs";
7
+ import { Tt as reportTelegramError, p as storeFiles } from "../../../_chunks/principal-JoaOmdFL.mjs";
8
8
  function telegramChat(chatId) {
9
9
  return `telegram:${chatId}`;
10
10
  }
@@ -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-C6OqEkxw.mjs";
7
+ import { t as agentBuild } from "../../../_chunks/build-metadata-D1C8gnfm.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 { F as CONFIRMATION_TTL_MS } from "../../../_chunks/principal-ie0lHCpn.mjs";
7
+ import { F as CONFIRMATION_TTL_MS } from "../../../_chunks/principal-JoaOmdFL.mjs";
8
8
  import { object } from "../confirmation-description.mjs";
9
9
  import { SessionNotActiveError } from "eve/sessions";
10
10
  function heldApprovals(events) {
@@ -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 InboundRequest, c as currentInboundRequest, l as runInboundRequest, u as withReplacedText } from "../../../_chunks/principal-ie0lHCpn.mjs";
7
+ export { s as InboundRequest, c as currentInboundRequest, l as runInboundRequest, u as withReplacedText } from "../../../_chunks/principal-JoaOmdFL.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 { C as attachmentUrl, Tt as telegramRuntimeSource, f as attachmentsContext, n as chatLanguage, o as telegramPrincipal, vt as reportTelegramError, wt as runtimeEnvelope } from "../../../_chunks/principal-ie0lHCpn.mjs";
9
+ import { C as attachmentUrl, Mt as telegramRuntimeSource, Tt as reportTelegramError, f as attachmentsContext, jt as runtimeEnvelope, n as chatLanguage, o as telegramPrincipal } from "../../../_chunks/principal-JoaOmdFL.mjs";
10
10
  import { routingBurst } from "../group-routing/burst.mjs";
11
11
  import { telegramSignals } from "./signals.mjs";
12
12
  import { addressingReason, chatKey, otherRecipient } from "../group-routing/signals.mjs";
@@ -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 { Ct as principalRuntimeSource, G as member, N as ontologyTools, O as OntologyActionNotPermitted, Tt as telegramRuntimeSource, c as currentInboundRequest, j as actionToolName, wt as runtimeEnvelope, z as needsConfirmation } from "../../../_chunks/principal-ie0lHCpn.mjs";
8
- import { t as agentBuild } from "../../../_chunks/build-metadata-C6OqEkxw.mjs";
7
+ import { At as principalRuntimeSource, K as member, Mt as telegramRuntimeSource, N as ontologyTools, O as OntologyActionNotPermitted, c as currentInboundRequest, j as actionToolName, jt as runtimeEnvelope, z as needsConfirmation } from "../../../_chunks/principal-JoaOmdFL.mjs";
8
+ import { t as agentBuild } from "../../../_chunks/build-metadata-D1C8gnfm.mjs";
9
9
  import { object } from "../confirmation-description.mjs";
10
10
  var AttachmentLifecycleNotPermitted = class extends Error {
11
11
  code = "attachment_lifecycle_not_permitted";
@@ -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 chatLanguage, r as identityProviderOf, i as memberIdOf, a as rolesOf, o as telegramPrincipal } from "../../../_chunks/principal-ie0lHCpn.mjs";
7
+ export { t as TELEGRAM_AUTHENTICATOR, n as chatLanguage, r as identityProviderOf, i as memberIdOf, a as rolesOf, o as telegramPrincipal } from "../../../_chunks/principal-JoaOmdFL.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 { vt as reportTelegramError } from "../../../_chunks/principal-ie0lHCpn.mjs";
7
+ import { Tt as reportTelegramError } from "../../../_chunks/principal-JoaOmdFL.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 { dt as currentLocale, mt as customerMessage, ut as TelegramDeliveryError, vt as reportTelegramError } from "../../../_chunks/principal-ie0lHCpn.mjs";
8
+ import { Tt as reportTelegramError, _t as TelegramDeliveryError, vt as currentLocale, xt as customerMessage } from "../../../_chunks/principal-JoaOmdFL.mjs";
9
9
  import { splitTelegramText } from "./format.mjs";
10
10
  import { inTelegramSendQueue } from "./send-queue.mjs";
11
11
  const NO_REPLY_TOOL = "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 { Tt as telegramRuntimeSource, wt as runtimeEnvelope } from "../../../_chunks/principal-ie0lHCpn.mjs";
7
+ import { Mt as telegramRuntimeSource, jt as runtimeEnvelope } from "../../../_chunks/principal-JoaOmdFL.mjs";
8
8
  import { workspaceAction } from "./workspace-action.mjs";
9
9
  import { STRUCTURED_KINDS } from "./structured-settings.mjs";
10
10
  const record = (value) => {
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
7
7
  import { telegramText } from "./texts.mjs";
8
8
  import { confirmationLocale } from "./confirmation-text.mjs";
9
9
  import { recordSessionFailure } from "./chat-archive.mjs";
10
- import { dt as currentLocale, ft as currentThreadId, gt as failureText, i as memberIdOf, pt as customerCopy, vt as reportTelegramError } from "../../../_chunks/principal-ie0lHCpn.mjs";
10
+ import { Ct as failureText, Tt as reportTelegramError, bt as customerCopy, i as memberIdOf, vt as currentLocale, yt as currentThreadId } from "../../../_chunks/principal-JoaOmdFL.mjs";
11
11
  import { modelServiceFailure } from "../model-service-failure.mjs";
12
12
  function telegramFailureEvents(input) {
13
13
  return {
@@ -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 { G as member, N as ontologyTools, j as actionToolName, z as needsConfirmation } from "../../../_chunks/principal-ie0lHCpn.mjs";
7
+ import { K as member, N as ontologyTools, j as actionToolName, z as needsConfirmation } from "../../../_chunks/principal-JoaOmdFL.mjs";
8
8
  import { object } from "../confirmation-description.mjs";
9
9
  var WorkspaceActionAlreadyDispatched = class extends Error {};
10
10
  async function workspaceAction(input) {