@segmentstream/agent 0.81.0 → 0.82.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.
- package/CHANGELOG.md +31 -0
- package/README.md +11 -11
- package/dist/_chunks/{build-metadata-CMQ30PpO.mjs → build-metadata-CEbH_2Vh.mjs} +1 -1
- package/dist/_chunks/{chat-archive-BBd_iZ1d.mjs → chat-archive-D4HRgOSo.mjs} +1 -1
- package/dist/_chunks/{principal-CVV9C_nO.mjs → principal-dEQyjF1n.mjs} +2 -3
- package/dist/extension/config.d.ts +5 -5
- package/dist/extension/connections/ontology.mjs +1 -1
- package/dist/extension/hooks/authorization.mjs +1 -1
- package/dist/extension/instructions/persona.mjs +1 -1
- package/dist/extension/lib/actor.mjs +1 -1
- package/dist/extension/lib/attachment-tools.mjs +1 -1
- package/dist/extension/lib/attachments-send.d.ts +2 -1
- package/dist/extension/lib/attachments-send.mjs +1 -1
- package/dist/extension/lib/attachments.mjs +1 -1
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/chat-address.mjs +1 -1
- package/dist/extension/lib/chat-context.mjs +1 -1
- package/dist/extension/lib/chat-recorder.mjs +1 -1
- package/dist/extension/lib/confirmations.mjs +1 -1
- package/dist/extension/lib/email/attachments-send.d.ts +2 -2
- package/dist/extension/lib/email/attachments-send.mjs +4 -3
- package/dist/extension/lib/email/channel.mjs +1 -1
- package/dist/extension/lib/email/gmail.d.ts +4 -10
- package/dist/extension/lib/email/gmail.mjs +6 -99
- package/dist/extension/lib/guest-usage.mjs +1 -1
- package/dist/extension/lib/inbound-media/files.mjs +1 -1
- package/dist/extension/lib/inbound-media/index.mjs +1 -1
- package/dist/extension/lib/ontology-connection.mjs +1 -1
- package/dist/extension/lib/ontology-file-call.mjs +1 -1
- package/dist/extension/lib/ontology-recall.mjs +1 -1
- package/dist/extension/lib/ontology-tools.mjs +1 -1
- package/dist/extension/lib/review/client.d.ts +3 -3
- package/dist/extension/lib/review/client.mjs +3 -2
- package/dist/extension/lib/review/hold.mjs +1 -1
- package/dist/extension/lib/review/reply.d.ts +1 -1
- package/dist/extension/lib/review/reply.mjs +1 -1
- package/dist/extension/lib/review/revision.mjs +2 -1
- package/dist/extension/lib/review/routes.d.ts +9 -0
- package/dist/extension/lib/review/routes.mjs +15 -0
- package/dist/extension/lib/role-skill.mjs +1 -1
- package/dist/extension/lib/runtime-envelope.mjs +1 -1
- package/dist/extension/lib/sent-files.mjs +1 -1
- package/dist/extension/lib/slack/adapter.mjs +1 -1
- package/dist/extension/lib/slack/attachments-send.d.ts +2 -1
- package/dist/extension/lib/slack/attachments-send.mjs +63 -104
- package/dist/extension/lib/slack/callbacks.mjs +1 -1
- package/dist/extension/lib/stored-files.mjs +1 -1
- package/dist/extension/lib/telegram/adapter.mjs +3 -3
- package/dist/extension/lib/telegram/attachment-description.mjs +1 -1
- package/dist/extension/lib/telegram/attachments-send.d.ts +0 -2
- package/dist/extension/lib/telegram/attachments-send.mjs +43 -107
- package/dist/extension/lib/telegram/callbacks.mjs +1 -1
- package/dist/extension/lib/telegram/chat-archive.mjs +1 -1
- package/dist/extension/lib/telegram/confirmations.mjs +1 -1
- package/dist/extension/lib/telegram/customer-text.mjs +1 -1
- package/dist/extension/lib/telegram/files.mjs +1 -1
- package/dist/extension/lib/telegram/format.d.ts +2 -6
- package/dist/extension/lib/telegram/format.mjs +1 -28
- package/dist/extension/lib/telegram/health.mjs +1 -1
- package/dist/extension/lib/telegram/held-approvals.mjs +1 -1
- package/dist/extension/lib/telegram/inbound-request.mjs +1 -1
- package/dist/extension/lib/telegram/inbound.mjs +2 -2
- package/dist/extension/lib/telegram/lifecycle.mjs +2 -2
- package/dist/extension/lib/telegram/principal.mjs +1 -1
- package/dist/extension/lib/telegram/session-recovery.mjs +1 -1
- package/dist/extension/lib/telegram/silent.mjs +1 -1
- package/dist/extension/lib/telegram/store-capture.mjs +1 -1
- package/dist/extension/lib/telegram/structured.mjs +1 -1
- package/dist/extension/lib/telegram/turn-errors.mjs +2 -2
- package/dist/extension/lib/web/auth.mjs +1 -1
- package/dist/extension/lib/web/channel.mjs +1 -1
- package/dist/extension/lib/whatsapp/adapter.d.ts +9 -0
- package/dist/extension/lib/whatsapp/adapter.mjs +10 -2
- package/dist/extension/lib/whatsapp/attachments-send.d.ts +2 -10
- package/dist/extension/lib/whatsapp/attachments-send.mjs +71 -43
- package/dist/extension/lib/whatsapp/callbacks.mjs +1 -1
- package/dist/extension/lib/whatsapp/files.mjs +1 -1
- package/dist/extension/lib/workspace-action.mjs +1 -1
- package/dist/extension/lib/workspace-channel/attachments-send.d.ts +1 -1
- package/dist/extension/lib/workspace-channel/attachments-send.mjs +5 -9
- package/dist/extension/lib/workspace-channel/channel.mjs +1 -1
- package/dist/extension/lib/workspace-source.mjs +1 -1
- package/dist/extension/model.mjs +1 -1
- package/dist/extension/review.d.ts +1 -1
- package/dist/extension/tools/attachments_discard.mjs +1 -1
- package/dist/extension/tools/attachments_list.mjs +1 -1
- package/dist/extension/tools/attachments_promote.mjs +1 -1
- package/dist/extension/tools/attachments_read.mjs +1 -1
- package/dist/extension/tools/attachments_send.mjs +1 -1
- package/dist/extension/tools/attachments_stage.mjs +1 -1
- package/dist/extension/tools/attachments_table.mjs +1 -1
- package/dist/extension/tools/handoff.mjs +1 -1
- package/dist/extension/tools/questions_ask.mjs +1 -1
- package/dist/extension/tools/workspace_source.mjs +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.82.0
|
|
4
|
+
|
|
5
|
+
The agent reports the replies it keeps for review, their redrafts and a session's drafts at the
|
|
6
|
+
ontology service's `/api/ontology/agent/drafts` routes, the `agent_draft` entity's. An ontology
|
|
7
|
+
service released before them answers 404 there, and the agent then uses the earlier
|
|
8
|
+
`/agent/reviews` routes, so the agent SDK can be upgraded before or after the ontology SDK.
|
|
9
|
+
|
|
10
|
+
Pins @segmentstream/ontology 0.158.0.
|
|
11
|
+
|
|
12
|
+
## 0.81.2
|
|
13
|
+
|
|
14
|
+
Each channel's message with files is now one sender in the ontology SDK, which the agent's
|
|
15
|
+
`attachments_send` calls and the ontology's own delivery can call too:
|
|
16
|
+
`sendTelegramFiles` (`@segmentstream/ontology/telegram`), `sendSlackFiles` (`/slack`),
|
|
17
|
+
`sendWhatsAppFiles` (`/whatsapp`) and `sendGmailMessage` (`/email`), each over a minimal
|
|
18
|
+
`request(call) → reply` connection transport and reporting per visible part whether the provider's
|
|
19
|
+
answer proves it was sent. Each channel's file limits are declared once next to its sender
|
|
20
|
+
(`telegramFileRefusal`, `slackFileRefusal`, `whatsappFileRefusal`, `EMAIL_FILES_BYTES`,
|
|
21
|
+
`WORKSPACE_CHANNEL_FILES_BYTES`), and the workspace channel contract (`WorkspaceChannelSend`) now
|
|
22
|
+
types the `files` its send route takes.
|
|
23
|
+
|
|
24
|
+
`attachments_send` sends as before. In WhatsApp, a caption that no file can carry, too long or
|
|
25
|
+
ahead of audio, goes on its own first as before; when that message fails, the files still go
|
|
26
|
+
without it and the tool's answer reports the caption's failure as `caption`.
|
|
27
|
+
|
|
28
|
+
Pins @segmentstream/ontology 0.157.0.
|
|
29
|
+
|
|
30
|
+
## 0.81.1
|
|
31
|
+
|
|
32
|
+
Pins @segmentstream/ontology 0.156.1.
|
|
33
|
+
|
|
3
34
|
## 0.81.0
|
|
4
35
|
|
|
5
36
|
The agent can recall the workspace's ontology records at the start of every turn. `ontologyRecall()`
|
package/README.md
CHANGED
|
@@ -182,8 +182,8 @@ channel but the web chat, Slack included: `{ "review": { "mode": "never" } }` (t
|
|
|
182
182
|
default), `{ "mode": "always" }` (a member reviews every reply) or
|
|
183
183
|
`{ "mode": "whenUnsure", "minConfidence": 0.9 }` (the decision model judges each reply in its
|
|
184
184
|
chat, with the criteria in `agent/review/<role>.md`, and the agent sends those it is sure
|
|
185
|
-
enough of). A held reply becomes an `
|
|
186
|
-
approves, edits or rejects. See reply review (`docs/agent.md#reply-review`) in the workspace
|
|
185
|
+
enough of). A held reply becomes an `agent_draft` record of the ontology, the agent's draft
|
|
186
|
+
awaiting a decision, which a member approves, edits or rejects. See reply review (`docs/agent.md#reply-review`) in the workspace
|
|
187
187
|
agent guide.
|
|
188
188
|
|
|
189
189
|
## Channel admission and first contact
|
|
@@ -295,7 +295,7 @@ continue using GET lookup. Starter templates and pins remain unchanged in this s
|
|
|
295
295
|
| `segmentstream__ontology` | `connections` | Direct MCP tools through Eve search, calls and approvals, acting as the current member or task. |
|
|
296
296
|
| `segmentstream__telegram` | `channels` | `POST /eve/v1/telegram`: Telegram through the connection, with pairing, routing and voice. |
|
|
297
297
|
| `segmentstream__tasks` | `channels` | `POST /eve/segmentstream/v1/tasks`: a workflow's `agentTask`, run as the workflow's user; see [Workflow tasks](#workflow-tasks). |
|
|
298
|
-
| `segmentstream__revisions` | `channels` | `POST /eve/segmentstream/v1/reviews/revise`: a
|
|
298
|
+
| `segmentstream__revisions` | `channels` | `POST /eve/segmentstream/v1/reviews/revise`: a draft a member sent back, redrafted in a session of its own that acts as the person, reading only, and reported as a new draft. |
|
|
299
299
|
| `segmentstream__email` | `channels` | `POST /eve/segmentstream/v1/email`: the `GmailConnection` mailbox in `channels.email`, which SegmentStream wakes; a Gmail thread is a chat per person, or one chat (`chats`). |
|
|
300
300
|
| `segmentstream__attachments_list`, `_read`, `_promote`, `_discard` | `tools` | The member's temporary attachments in this chat: list, read, keep through an action, drop. |
|
|
301
301
|
| `segmentstream__attachments_send` | `tools` | Sends readable stored ontology files into the current Telegram, Slack, WhatsApp or email chat. |
|
|
@@ -475,7 +475,7 @@ The SDK adds no text to the prompt.
|
|
|
475
475
|
- **The secret.** The route hands the secret to the session in the channel's adapter state; the
|
|
476
476
|
session's first event moves it into the session's durable task state, and it is forgotten once
|
|
477
477
|
the outcome is reported. It is never in the principal, the model's context, tool arguments or
|
|
478
|
-
results, the session's events, logs or the chat
|
|
478
|
+
results, the session's events, logs or the chat store.
|
|
479
479
|
- **No person is present.** Ontology actions the workflow's role permits run without confirmation
|
|
480
480
|
cards. Attachments, member files, chat history and `chat_post_message` are not offered. A
|
|
481
481
|
question from `questions_ask`, an approval a tool asks a person for, eve's own questions or a
|
|
@@ -489,7 +489,7 @@ The SDK adds no text to the prompt.
|
|
|
489
489
|
or when the ontology refuses the secret, the session ends: eve has no command for a session to
|
|
490
490
|
retire itself, so it asks its own deployment's `POST /eve/segmentstream/v1/tasks/end`, which ends
|
|
491
491
|
only the session that still owns the task's address.
|
|
492
|
-
- **Logs.** The chat
|
|
492
|
+
- **Logs.** The chat store keeps a task's events under provider `task` and the task's id,
|
|
493
493
|
with no member taking part, so `segmentstream agent logs --chat <task id>` shows them.
|
|
494
494
|
|
|
495
495
|
### Telegram
|
|
@@ -505,7 +505,7 @@ The SDK adds no text to the prompt.
|
|
|
505
505
|
for Agent SDK 0.13 or later. Pre-0.13 archives without menu copy retain their existing provider menu.
|
|
506
506
|
- **Production only.** Outside `VERCEL_ENV=production` the route answers 200 and does nothing, so a
|
|
507
507
|
preview never answers a real chat. Without `channels.telegram` it answers 404.
|
|
508
|
-
- **Pairing.** Bots and channel posts are
|
|
508
|
+
- **Pairing.** Bots and channel posts are recorded without starting turns. The sender's Telegram
|
|
509
509
|
account is checked on every message, so revocation takes effect immediately. Unlinked group
|
|
510
510
|
speech and attachment metadata remain raw context, including edits; no unlinked voice is decoded or gets
|
|
511
511
|
a reply. An unknown private sender gets the workspace pairing prompt and button to `/agent/connect?code=…`,
|
|
@@ -520,7 +520,7 @@ The SDK adds no text to the prompt.
|
|
|
520
520
|
`mention` policy observes unaddressed messages without paid work. Attachments never force a turn.
|
|
521
521
|
Human reply edges and other recipients are untrusted context for inference. Failed decisions
|
|
522
522
|
observe, except within a chat-policy `defer` band. Recent context comes from the
|
|
523
|
-
chat
|
|
523
|
+
chat store: observed and answered messages, delivered replies and confirmation cards;
|
|
524
524
|
retries add nothing. Decision events retain the reason, short audit note, model and latency, plus
|
|
525
525
|
probabilities when available.
|
|
526
526
|
- **Chat addressing.** Opt in with `groups.smart.engagement.policy: "chat"`.
|
|
@@ -615,9 +615,9 @@ The SDK adds no text to the prompt.
|
|
|
615
615
|
than `no_reply` is requested. Telegram shows each for a few seconds; nothing refreshes it on a
|
|
616
616
|
timer, and a refused action is logged and does not affect the turn.
|
|
617
617
|
|
|
618
|
-
Routing context comes from the
|
|
619
|
-
process memory, and a cold start reports its chats afresh. The
|
|
620
|
-
|
|
618
|
+
Routing context comes from the chat store in every process; only chat-report caches live in
|
|
619
|
+
process memory, and a cold start reports its chats afresh. The chat store survives independently of
|
|
620
|
+
the agent's session state.
|
|
621
621
|
|
|
622
622
|
Text and captions retain their Telegram entity annotations for addressing. Rich-message blocks
|
|
623
623
|
are projected to plain text before capture and dispatch, bounded to 16,384 UTF-16 code units,
|
|
@@ -658,7 +658,7 @@ evidence. Failure, unsupported format and limit notes retain the original attach
|
|
|
658
658
|
Metadata lookups have a five-second timeout, a five-minute success cache and a 30-second failure
|
|
659
659
|
cache, with at most 128 model entries. A lookup failure never asserts that the model saw pixels.
|
|
660
660
|
|
|
661
|
-
Eve's native image input limit is 3 MiB per image. The
|
|
661
|
+
Eve's native image input limit is 3 MiB per image. The chat store keeps each message's stored
|
|
662
662
|
attachments by reference (id, name, type, size, expiry; never bytes or download grants). The next
|
|
663
663
|
answered turn appends the native images of messages observed since the chat's last answered
|
|
664
664
|
message as file parts, once, up to five images and 3 MiB total after accounting for current
|
|
@@ -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.
|
|
7
|
+
var version = "0.82.0";
|
|
8
8
|
function agentBuild(environment = process.env) {
|
|
9
9
|
return {
|
|
10
10
|
agent: version,
|
|
@@ -10,7 +10,7 @@ import { n as contentText, t as CONTENT_CAPS } from "./content-cDtVnr8Y.mjs";
|
|
|
10
10
|
import { C as sendFingerprint, S as reasonCode, _ as boundedMeta, a as chatEvent, b as messageInput, f as sessionFailureEventId, p as storeOf, v as cutText, w as storedFiles, x as metaOf } from "./chat-archive-DavfKJDI.mjs";
|
|
11
11
|
import { applyChatChange } from "../extension/lib/chat-messages.mjs";
|
|
12
12
|
import { ChatStoreError } from "../extension/lib/chat-store.mjs";
|
|
13
|
-
import { c as currentInboundRequest, ht as currentThreadId, xt as reportTelegramError } from "./principal-
|
|
13
|
+
import { c as currentInboundRequest, ht as currentThreadId, xt as reportTelegramError } from "./principal-dEQyjF1n.mjs";
|
|
14
14
|
import { telegramReaction } from "../extension/lib/telegram/reactions.mjs";
|
|
15
15
|
import { currentConfirmationPrompt } from "../extension/lib/group-routing/messages.mjs";
|
|
16
16
|
import { messageMetadata } from "../extension/lib/telegram/message-metadata.mjs";
|
|
@@ -29,7 +29,7 @@ import { describableImage, describeReceivedImage } from "../extension/lib/inboun
|
|
|
29
29
|
import { NATIVE_AUDIO_NOTE, isSpeech, transcribeSpeech } from "../extension/lib/inbound-media/speech.mjs";
|
|
30
30
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
31
31
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
32
|
-
import { telegramPreviewOptions, telegramTextLinks } from "@segmentstream/ontology/telegram";
|
|
32
|
+
import { telegramFormattingRefused, telegramPreviewOptions, telegramTextLinks } from "@segmentstream/ontology/telegram";
|
|
33
33
|
import { defineMcpClientConnection } from "eve/connections";
|
|
34
34
|
import { defineState } from "eve/context";
|
|
35
35
|
import { defineDynamic as defineDynamic$1 } from "eve/tools";
|
|
@@ -291,8 +291,7 @@ function guardedCustomerMessage(text, locale, identifiers, blocked) {
|
|
|
291
291
|
}
|
|
292
292
|
async function formattingRefused(response) {
|
|
293
293
|
if (response.status !== 400) return false;
|
|
294
|
-
|
|
295
|
-
return body?.ok === false && typeof body.description === "string" && (/can't parse entities|cannot parse entities|entity (?:bounds|offset|length)|entities (?:are|too)/iu.test(body.description) || /unsupported (?:start tag|parse mode)/iu.test(body.description));
|
|
294
|
+
return telegramFormattingRefused(response.status, await response.clone().json().catch(() => null));
|
|
296
295
|
}
|
|
297
296
|
var TelegramDeliveryError = class extends Error {
|
|
298
297
|
reference;
|
|
@@ -187,20 +187,20 @@ export interface SegmentStreamAgentConfigInput {
|
|
|
187
187
|
readonly sessions?: {
|
|
188
188
|
/**
|
|
189
189
|
* What a group session spans: `chat` (default) keeps one session per group chat and forum
|
|
190
|
-
* topic, `thread` keeps
|
|
190
|
+
* topic, `thread` keeps one session per reply thread.
|
|
191
191
|
*/
|
|
192
192
|
readonly scope?: string;
|
|
193
193
|
/**
|
|
194
194
|
* @legacy agent.config-retired-keys
|
|
195
|
-
* @deprecated Accepted and ignored:
|
|
196
|
-
* window (`compaction` in `agent.ts`).
|
|
195
|
+
* @deprecated Accepted and ignored: the agent compacts a session automatically near its
|
|
196
|
+
* model's context window (`compaction` in `agent.ts`).
|
|
197
197
|
*/
|
|
198
198
|
readonly compactAt?: unknown;
|
|
199
199
|
/** @deprecated Accepted and ignored, with `compactAt`. */
|
|
200
200
|
readonly timezone?: unknown;
|
|
201
201
|
/**
|
|
202
|
-
* @deprecated Accepted and ignored:
|
|
203
|
-
* in `agent.ts`.
|
|
202
|
+
* @deprecated Accepted and ignored: the agent ends an idle session after
|
|
203
|
+
* `limits.sessionTimeoutMs` in `agent.ts`.
|
|
204
204
|
*/
|
|
205
205
|
readonly idleResetHours?: unknown;
|
|
206
206
|
};
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import segmentstream from "../extension.mjs";
|
|
8
|
-
import { T as ontologyConnection } from "../../_chunks/principal-
|
|
8
|
+
import { T as ontologyConnection } from "../../_chunks/principal-dEQyjF1n.mjs";
|
|
9
9
|
import { defineDynamic } from "eve/connections";
|
|
10
10
|
var ontology_default = defineDynamic(async (context) => {
|
|
11
11
|
if (!segmentstream.config.ontology.connection) return null;
|
|
@@ -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-
|
|
10
|
+
import "../../_chunks/principal-dEQyjF1n.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;
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import segmentstream from "../extension.mjs";
|
|
8
|
-
import { a as rolesOf } from "../../_chunks/principal-
|
|
8
|
+
import { a as rolesOf } from "../../_chunks/principal-dEQyjF1n.mjs";
|
|
9
9
|
import { personaFor } from "../personas.mjs";
|
|
10
10
|
import { defineDynamic, defineInstructions } from "eve/instructions";
|
|
11
11
|
var persona_default = defineDynamic((context) => {
|
|
@@ -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 { R as ACT_AS_HEADER, z as ActorRequiredError, B as actorHeaders, V as actorKey, H as actorOf, U as isGuestSession, W as member, G as memberTool, K as notForGuests } from "../../_chunks/principal-
|
|
7
|
+
export { R as ACT_AS_HEADER, z as ActorRequiredError, B as actorHeaders, V as actorKey, H as actorOf, U as isGuestSession, W as member, G as memberTool, K as notForGuests } from "../../_chunks/principal-dEQyjF1n.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 { Ft as chatAddressOf, It as chatChannel, b as agentAttachments, i as memberIdOf } from "../../_chunks/principal-
|
|
7
|
+
import { Ft as chatAddressOf, It as chatChannel, b as agentAttachments, i as memberIdOf } from "../../_chunks/principal-dEQyjF1n.mjs";
|
|
8
8
|
import { detectFile, documentText } from "./attachment-formats.mjs";
|
|
9
9
|
import { readSheets, typedTable } from "./attachment-tables.mjs";
|
|
10
10
|
import { appOrigin } from "./environment.mjs";
|
|
@@ -10,7 +10,8 @@ import type { SendAttachmentsInput } from "./telegram/attachments-send.js";
|
|
|
10
10
|
* chat; nothing throws: each failure is logged with a reference for operators and answered as a
|
|
11
11
|
* refusal code with the workspace's attachment failure text, the whole call's when nothing could
|
|
12
12
|
* be tried and each file's otherwise. Files are never held for review, and the chat recorder keeps
|
|
13
|
-
* the call and its answer. A channel supplies only how it sends what it read
|
|
13
|
+
* the call and its answer. A channel supplies only how it sends what it read, with the message
|
|
14
|
+
* with files of `@segmentstream/ontology/<channel>`, which the ontology's own delivery sends too.
|
|
14
15
|
*/
|
|
15
16
|
/** Why one requested file did not reach the chat. */
|
|
16
17
|
export interface AttachmentSendFailure {
|
|
@@ -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 { Ft as chatAddressOf, _ as AttachmentError, yt as failureText } from "../../_chunks/principal-
|
|
8
|
+
import { Ft as chatAddressOf, _ as AttachmentError, yt as failureText } from "../../_chunks/principal-dEQyjF1n.mjs";
|
|
9
9
|
import { appOrigin, channelsEnabled } from "./environment.mjs";
|
|
10
10
|
import { transientFileStatus } from "./file-grant.mjs";
|
|
11
11
|
import { runtimeToken } from "./runtime-token.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 { h as ATTACHMENT_TTL_HOURS, g as ATTACHMENT_URL_PROTOCOL, _ as AttachmentError, jt as CHAT_HEADER, v as EARLIER_CHAT_HEADER, y as MAXIMUM_ATTACHMENT_BYTES, Pt as SESSION_HEADER, b as agentAttachments, x as attachmentUrl, S as fetchStoredAttachment, C as parseAttachmentUrl } from "../../_chunks/principal-
|
|
7
|
+
export { h as ATTACHMENT_TTL_HOURS, g as ATTACHMENT_URL_PROTOCOL, _ as AttachmentError, jt as CHAT_HEADER, v as EARLIER_CHAT_HEADER, y as MAXIMUM_ATTACHMENT_BYTES, Pt as SESSION_HEADER, b as agentAttachments, x as attachmentUrl, S as fetchStoredAttachment, C as parseAttachmentUrl } from "../../_chunks/principal-dEQyjF1n.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 { t as agentBuild } from "../../_chunks/build-metadata-
|
|
7
|
+
export { t as agentBuild } from "../../_chunks/build-metadata-CEbH_2Vh.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 { At as CHAT_ATTRIBUTE, jt as CHAT_HEADER, Mt as PARTICIPANTS_ATTRIBUTE, Nt as RUNTIME_SOURCE_ATTRIBUTE, Pt as SESSION_HEADER, Ft as chatAddressOf, It as chatChannel, Lt as chatHeaders, Rt as chatRuntimeSource, zt as isSameChat, Bt as participantsOf, Vt as withChatAddress, Ht as workspaceIdentityProvider } from "../../_chunks/principal-
|
|
7
|
+
export { At as CHAT_ATTRIBUTE, jt as CHAT_HEADER, Mt as PARTICIPANTS_ATTRIBUTE, Nt as RUNTIME_SOURCE_ATTRIBUTE, Pt as SESSION_HEADER, Ft as chatAddressOf, It as chatChannel, Lt as chatHeaders, Rt as chatRuntimeSource, zt as isSameChat, Bt as participantsOf, Vt as withChatAddress, Ht as workspaceIdentityProvider } from "../../_chunks/principal-dEQyjF1n.mjs";
|
|
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
|
|
|
7
7
|
import { agentTaskIdOf } from "./agent-task.mjs";
|
|
8
8
|
import { chatCoordinates, sessionKind } from "./chat-recorder.mjs";
|
|
9
9
|
import { h as topicContext, i as chatAuthor, n as archiveSequence, p as storeOf, r as chatArchive, s as collapseChatEvents } from "../../_chunks/chat-archive-DavfKJDI.mjs";
|
|
10
|
-
import { xt as reportTelegramError } from "../../_chunks/principal-
|
|
10
|
+
import { xt as reportTelegramError } from "../../_chunks/principal-dEQyjF1n.mjs";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import { deliveries, runs, turns } from "eve/events";
|
|
13
13
|
import { defineState } from "eve/context";
|
|
@@ -8,7 +8,7 @@ import { n as contentText, t as CONTENT_CAPS } from "../../_chunks/content-cDtVn
|
|
|
8
8
|
import { a as chatEvent, f as sessionFailureEventId, m as summarizeArguments, p as storeOf, r as chatArchive } from "../../_chunks/chat-archive-DavfKJDI.mjs";
|
|
9
9
|
import { agentTaskIdOf } from "./agent-task.mjs";
|
|
10
10
|
import { revisionOf } from "./review/revision.mjs";
|
|
11
|
-
import { Bt as participantsOf, Ft as chatAddressOf, It as chatChannel, i as memberIdOf, ot as guestIdOf } from "../../_chunks/principal-
|
|
11
|
+
import { Bt as participantsOf, Ft as chatAddressOf, It as chatChannel, i as memberIdOf, ot as guestIdOf } from "../../_chunks/principal-dEQyjF1n.mjs";
|
|
12
12
|
import { keyChannel, principalChannel } from "./channel-scope.mjs";
|
|
13
13
|
import { parseAddress } from "./telegram/sessions.mjs";
|
|
14
14
|
import { completionKind } from "./telegram/silent.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 { N as CONFIRMATION_TTL_MS, P as actionApproval, F as confirmations, I as inputHash, L as needsConfirmation } from "../../_chunks/principal-
|
|
7
|
+
export { N as CONFIRMATION_TTL_MS, P as actionApproval, F as confirmations, I as inputHash, L as needsConfirmation } from "../../_chunks/principal-dEQyjF1n.mjs";
|
|
@@ -12,8 +12,8 @@ import { type Gmail } from "./gmail.js";
|
|
|
12
12
|
* caption is the reply's text. The checks and failures are every channel's (`../attachments-send.ts`).
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
|
-
* The most bytes of files one reply carries, together
|
|
16
|
-
*
|
|
15
|
+
* The most bytes of files one reply carries, together, as the ontology declares it for every email
|
|
16
|
+
* sender. A message larger than one proxied request is uploaded in chunks.
|
|
17
17
|
*/
|
|
18
18
|
export declare const MAXIMUM_EMAIL_ATTACHMENT_BYTES: number;
|
|
19
19
|
/** What became of one requested file. */
|
|
@@ -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 { _ as AttachmentError } from "../../../_chunks/principal-
|
|
7
|
+
import { _ as AttachmentError } from "../../../_chunks/principal-dEQyjF1n.mjs";
|
|
8
8
|
import { sendStoredAttachments } from "../attachments-send.mjs";
|
|
9
9
|
import { ConnectionProxyError, connectionProxy } from "../connection-proxy.mjs";
|
|
10
10
|
import { redactDiagnostic } from "../diagnostics.mjs";
|
|
@@ -12,7 +12,8 @@ import { proxyEnvironment } from "../environment.mjs";
|
|
|
12
12
|
import { StoredFileError, fetchStoredFile } from "../sent-files.mjs";
|
|
13
13
|
import { GmailError, gmail, replyKeyOf } from "./gmail.mjs";
|
|
14
14
|
import { randomUUID } from "node:crypto";
|
|
15
|
-
|
|
15
|
+
import { EMAIL_FILES_BYTES } from "@segmentstream/ontology/email";
|
|
16
|
+
const MAXIMUM_EMAIL_ATTACHMENT_BYTES = EMAIL_FILES_BYTES;
|
|
16
17
|
const TOO_LARGE = `One email carries at most ${MAXIMUM_EMAIL_ATTACHMENT_BYTES / 1024 / 1024} MiB of files.`;
|
|
17
18
|
function reportEmailError(operation, error, secrets) {
|
|
18
19
|
const reference = randomUUID();
|
|
@@ -68,7 +69,7 @@ async function sendEmailAttachments(options) {
|
|
|
68
69
|
message: TOO_LARGE
|
|
69
70
|
}),
|
|
70
71
|
limit: ({ size }) => {
|
|
71
|
-
if (total + size >
|
|
72
|
+
if (total + size > MAXIMUM_EMAIL_ATTACHMENT_BYTES) throw new AttachmentError({
|
|
72
73
|
code: "too_large",
|
|
73
74
|
message: TOO_LARGE
|
|
74
75
|
});
|
|
@@ -8,7 +8,7 @@ import { PUBSUB_TOPIC } from "../../config.mjs";
|
|
|
8
8
|
import { admitMessage, localizedText, reportUnadmittedChat } from "../admission.mjs";
|
|
9
9
|
import { agentToolsAttribute } from "../agent-tools.mjs";
|
|
10
10
|
import { providerChat } from "../attachment-tools.mjs";
|
|
11
|
-
import { Bt as participantsOf, Ft as chatAddressOf, Mt as PARTICIPANTS_ATTRIBUTE, S as fetchStoredAttachment, Vt as withChatAddress, b as agentAttachments, d as prepareInboundMedia, i as memberIdOf, m as turnContent } from "../../../_chunks/principal-
|
|
11
|
+
import { Bt as participantsOf, Ft as chatAddressOf, Mt as PARTICIPANTS_ATTRIBUTE, S as fetchStoredAttachment, Vt as withChatAddress, b as agentAttachments, d as prepareInboundMedia, i as memberIdOf, m as turnContent } from "../../../_chunks/principal-dEQyjF1n.mjs";
|
|
12
12
|
import { channelAttributes, currentChannel, currentKey, inHandlerChannels, withNamedRoutes } from "../channel-scope.mjs";
|
|
13
13
|
import { a as chatEvent, b as messageInput, d as replyRecipients, g as UNVERIFIED, l as replyEvent, p as storeOf, r as chatArchive, t as AGENT_SENDER } from "../../../_chunks/chat-archive-DavfKJDI.mjs";
|
|
14
14
|
import { ChatStoreError } from "../chat-store.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type EmailAttachment } from "@segmentstream/ontology/email";
|
|
2
|
-
import {
|
|
1
|
+
import { GmailError, type EmailAttachment } from "@segmentstream/ontology/email";
|
|
2
|
+
import type { ConnectionProxy } from "../connection-proxy.js";
|
|
3
3
|
/**
|
|
4
4
|
* The mailbox of a `GmailConnection`, through SegmentStream's connection proxy: the calls the email
|
|
5
5
|
* channel makes, each one Gmail API request on `users/me`.
|
|
@@ -15,15 +15,9 @@ export declare function replyKeyOf(...parts: ReadonlyArray<string>): string;
|
|
|
15
15
|
/**
|
|
16
16
|
* Gmail answered with a status the channel does not continue from. `detail` keeps Google's own
|
|
17
17
|
* explanation, such as a topic Gmail may not publish to or a missing scope, for operators; the
|
|
18
|
-
* channel redacts it where it logs.
|
|
18
|
+
* channel redacts it where it logs. The ontology's Gmail sender throws the same error.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
21
|
-
readonly operation: string;
|
|
22
|
-
readonly status: number;
|
|
23
|
-
readonly detail?: string | undefined;
|
|
24
|
-
readonly name = "GmailError";
|
|
25
|
-
constructor(operation: string, status: number, detail?: string | undefined);
|
|
26
|
-
}
|
|
20
|
+
export { GmailError };
|
|
27
21
|
/** A message the mailbox received since the cursor, as its history names it. */
|
|
28
22
|
export interface AddedMessage {
|
|
29
23
|
readonly id: string;
|
|
@@ -4,35 +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 { MAXIMUM_PROXY_BODY_BYTES } from "../connection-proxy.mjs";
|
|
8
7
|
import { createHash } from "node:crypto";
|
|
9
|
-
import { REPLY_KEY_HEADER, emailReplyMessage, renderEmailHtml } from "@segmentstream/ontology/email";
|
|
8
|
+
import { GmailError, REPLY_KEY_HEADER, emailReplyMessage, gmailExplanation, renderEmailHtml, sendGmailMessage } from "@segmentstream/ontology/email";
|
|
10
9
|
const GMAIL_ID = /^[A-Za-z0-9_-]{1,512}$/;
|
|
11
10
|
function replyKeyOf(...parts) {
|
|
12
11
|
return createHash("sha256").update(parts.join(":")).digest("base64url").slice(0, 32);
|
|
13
12
|
}
|
|
14
|
-
const
|
|
15
|
-
var GmailError = class extends Error {
|
|
16
|
-
operation;
|
|
17
|
-
status;
|
|
18
|
-
detail;
|
|
19
|
-
name = "GmailError";
|
|
20
|
-
constructor(operation, status, detail) {
|
|
21
|
-
super(`Gmail answered ${operation} with status ${status}` + (detail === void 0 ? "." : `: ${detail}`));
|
|
22
|
-
this.operation = operation;
|
|
23
|
-
this.status = status;
|
|
24
|
-
this.detail = detail;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
function explanation(reply) {
|
|
28
|
-
const error = json(reply).error ?? {};
|
|
29
|
-
const reasons = Array.isArray(error.errors) ? error.errors.flatMap((item) => {
|
|
30
|
-
const reason = item?.reason;
|
|
31
|
-
return typeof reason === "string" ? [reason] : [];
|
|
32
|
-
}) : [];
|
|
33
|
-
const text = [typeof error.message === "string" ? error.message : "", ...reasons].filter((part) => part !== "").join("; ");
|
|
34
|
-
return text === "" ? void 0 : text.slice(0, DETAIL_LIMIT);
|
|
35
|
-
}
|
|
13
|
+
const explanation = gmailExplanation;
|
|
36
14
|
const decoder = new TextDecoder();
|
|
37
15
|
function json(reply) {
|
|
38
16
|
try {
|
|
@@ -212,85 +190,14 @@ function gmail(proxy) {
|
|
|
212
190
|
...input.key === void 0 ? {} : { replyKey: input.key },
|
|
213
191
|
...input.attachments === void 0 || input.attachments.length === 0 ? {} : { attachments: input.attachments }
|
|
214
192
|
});
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
193
|
+
const id = text((await sendGmailMessage({
|
|
194
|
+
request: (call) => proxy().request(call),
|
|
195
|
+
message: new TextEncoder().encode(raw),
|
|
218
196
|
threadId: input.threadId
|
|
219
|
-
};
|
|
220
|
-
const id = text((JSON.stringify(body).length <= 2097152 ? await ok("messages.send", "POST", "/messages/send", body) : await upload(message, input.threadId)).id);
|
|
197
|
+
})).id);
|
|
221
198
|
if (id === void 0) throw new GmailError("messages.send", 502);
|
|
222
199
|
return id;
|
|
223
200
|
}
|
|
224
201
|
};
|
|
225
|
-
async function upload(message, threadId) {
|
|
226
|
-
const started = await proxy().request({
|
|
227
|
-
api: "upload",
|
|
228
|
-
method: "POST",
|
|
229
|
-
path: "/upload/gmail/v1/users/me/messages/send?uploadType=resumable",
|
|
230
|
-
headers: [
|
|
231
|
-
["content-type", "application/json; charset=UTF-8"],
|
|
232
|
-
["x-upload-content-type", "message/rfc822"],
|
|
233
|
-
["x-upload-content-length", String(message.byteLength)]
|
|
234
|
-
],
|
|
235
|
-
body: new TextEncoder().encode(JSON.stringify({ threadId }))
|
|
236
|
-
});
|
|
237
|
-
if (started.status < 200 || started.status >= 300) throw new GmailError("messages.send", started.status, explanation(started));
|
|
238
|
-
const session = uploadSession(replyHeader(started, "location"));
|
|
239
|
-
if (session === void 0) throw new GmailError("messages.send", 502, "Gmail named no upload session it may use.");
|
|
240
|
-
const total = message.byteLength;
|
|
241
|
-
let offset = 0;
|
|
242
|
-
let recoveries = 0;
|
|
243
|
-
for (;;) {
|
|
244
|
-
const end = Math.min(offset + UPLOAD_CHUNK_BYTES, total);
|
|
245
|
-
let reply;
|
|
246
|
-
try {
|
|
247
|
-
reply = await proxy().request({
|
|
248
|
-
api: session.api,
|
|
249
|
-
method: "PUT",
|
|
250
|
-
path: session.path,
|
|
251
|
-
headers: [["content-type", "message/rfc822"], ["content-range", `bytes ${offset}-${end - 1}/${total}`]],
|
|
252
|
-
body: message.subarray(offset, end)
|
|
253
|
-
});
|
|
254
|
-
if (reply.status === 408 || reply.status === 429 || reply.status >= 500) throw new GmailError("messages.send", reply.status, explanation(reply));
|
|
255
|
-
} catch (error) {
|
|
256
|
-
recoveries += 1;
|
|
257
|
-
if (recoveries > UPLOAD_RECOVERIES) throw error;
|
|
258
|
-
reply = await proxy().request({
|
|
259
|
-
api: session.api,
|
|
260
|
-
method: "PUT",
|
|
261
|
-
path: session.path,
|
|
262
|
-
headers: [["content-range", `bytes */${total}`]],
|
|
263
|
-
body: new Uint8Array()
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
if (reply.status === 200 || reply.status === 201) return json(reply);
|
|
267
|
-
if (reply.status !== 308) throw new GmailError("messages.send", reply.status, explanation(reply));
|
|
268
|
-
const held = /^bytes=0-(\d+)$/u.exec(replyHeader(reply, "range") ?? "")?.[1];
|
|
269
|
-
offset = held === void 0 ? 0 : Number(held) + 1;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
const UPLOAD_CHUNK_BYTES = MAXIMUM_PROXY_BODY_BYTES;
|
|
274
|
-
const UPLOAD_RECOVERIES = 3;
|
|
275
|
-
const UPLOAD_APIS = {
|
|
276
|
-
"gmail.googleapis.com": "upload",
|
|
277
|
-
"www.googleapis.com": "upload_legacy"
|
|
278
|
-
};
|
|
279
|
-
const UPLOAD_PATH = /^\/(?:resumable\/)?upload\/gmail\/v1\/users\/me\/messages\/send$/u;
|
|
280
|
-
function uploadSession(location) {
|
|
281
|
-
if (location === void 0) return;
|
|
282
|
-
try {
|
|
283
|
-
const url = new URL(location);
|
|
284
|
-
const api = UPLOAD_APIS[url.hostname];
|
|
285
|
-
return url.protocol === "https:" && url.port === "" && api !== void 0 && UPLOAD_PATH.test(url.pathname) && url.searchParams.has("upload_id") ? {
|
|
286
|
-
api,
|
|
287
|
-
path: `${url.pathname}${url.search}`
|
|
288
|
-
} : void 0;
|
|
289
|
-
} catch {
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
function replyHeader(reply, name) {
|
|
294
|
-
return reply.headers.find(([key]) => key.toLowerCase() === name)?.[1];
|
|
295
202
|
}
|
|
296
203
|
export { GMAIL_ID, GmailError, gmail, replyKeyOf };
|
|
@@ -6,7 +6,7 @@ __eveDirname(__filename);
|
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { appOrigin } from "./environment.mjs";
|
|
8
8
|
import { runtimeToken } from "./runtime-token.mjs";
|
|
9
|
-
import { ot as guestIdOf } from "../../_chunks/principal-
|
|
9
|
+
import { ot as guestIdOf } from "../../_chunks/principal-dEQyjF1n.mjs";
|
|
10
10
|
const GUEST_USAGE_PATH = "/api/ontology/agent/guests/usage";
|
|
11
11
|
const REPORT_TIMEOUT_MS = 5e3;
|
|
12
12
|
function ontologyGuestUsage(options = {}) {
|
|
@@ -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-
|
|
7
|
+
export { f as attachmentsContext, p as storeFiles, m as turnContent } from "../../../_chunks/principal-dEQyjF1n.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-
|
|
7
|
+
export { f as attachmentsContext, d as prepareInboundMedia, p as storeFiles, m as turnContent } from "../../../_chunks/principal-dEQyjF1n.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 { R as ACT_AS_HEADER, w as actAsHeaders, T as ontologyConnection } from "../../_chunks/principal-
|
|
7
|
+
export { R as ACT_AS_HEADER, w as actAsHeaders, T as ontologyConnection } from "../../_chunks/principal-dEQyjF1n.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 { F as confirmations, H as actorOf, I as inputHash, Ot as runtimeEnvelope, P as actionApproval, V as actorKey, j as ontologyTools } from "../../_chunks/principal-
|
|
7
|
+
import { F as confirmations, H as actorOf, I as inputHash, Ot as runtimeEnvelope, P as actionApproval, V as actorKey, j as ontologyTools } from "../../_chunks/principal-dEQyjF1n.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";
|
|
@@ -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 { H as actorOf, a as rolesOf, j as ontologyTools, k as actionToolName } from "../../_chunks/principal-
|
|
7
|
+
import { H as actorOf, a as rolesOf, j as ontologyTools, k as actionToolName } from "../../_chunks/principal-dEQyjF1n.mjs";
|
|
8
8
|
import { object } from "./confirmation-description.mjs";
|
|
9
9
|
import { redactDiagnostic } from "./diagnostics.mjs";
|
|
10
10
|
import { defineMemoryProvider } from "eve/memory";
|
|
@@ -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 { E as OntologyActionNotPermitted, D as OntologyFileUnavailable, O as OntologyToolRejected, k as actionToolName, A as ontologyToolLabels, j as ontologyTools, M as promotionTarget } from "../../_chunks/principal-
|
|
7
|
+
export { E as OntologyActionNotPermitted, D as OntologyFileUnavailable, O as OntologyToolRejected, k as actionToolName, A as ontologyToolLabels, j as ontologyTools, M as promotionTarget } from "../../_chunks/principal-dEQyjF1n.mjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { RuntimeToken } from "../runtime-token.js";
|
|
2
2
|
import type { HoldReply } from "./hold.js";
|
|
3
3
|
/**
|
|
4
|
-
* Reports a
|
|
5
|
-
* a member to approve, edit or reject. The report is keyed, so one repeated after
|
|
6
|
-
* the
|
|
4
|
+
* Reports a reply kept for review to the ontology service, which records it as a pending
|
|
5
|
+
* `agent_draft` for a member to approve, edit or reject. The report is keyed, so one repeated after
|
|
6
|
+
* a failure finds the draft it created.
|
|
7
7
|
*/
|
|
8
8
|
export declare function agentReviews(input: {
|
|
9
9
|
/** The workspace app's origin, where the ontology service answers `/api/ontology/*`. */
|
|
@@ -6,6 +6,7 @@ __eveDirname(__filename);
|
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { redactDiagnostic } from "../diagnostics.mjs";
|
|
8
8
|
import { AgentIdentityError, refusal } from "../identities.mjs";
|
|
9
|
+
import { postDraftRoute } from "./routes.mjs";
|
|
9
10
|
const CALL_TIMEOUT_MS = 1e4;
|
|
10
11
|
function agentReviews(input) {
|
|
11
12
|
const fetchImpl = input.fetch ?? fetch;
|
|
@@ -18,7 +19,7 @@ function agentReviews(input) {
|
|
|
18
19
|
const participants = reply.participants !== void 0 && reply.participants.some((id) => id !== reply.memberId) ? reply.participants : void 0;
|
|
19
20
|
const send = async (named) => {
|
|
20
21
|
try {
|
|
21
|
-
return await fetchImpl
|
|
22
|
+
return await postDraftRoute(fetchImpl, input.origin, "", {
|
|
22
23
|
method: "POST",
|
|
23
24
|
headers: {
|
|
24
25
|
authorization: `Bearer ${token}`,
|
|
@@ -102,7 +103,7 @@ function agentSessionReviews(input) {
|
|
|
102
103
|
const token = await input.token();
|
|
103
104
|
let response;
|
|
104
105
|
try {
|
|
105
|
-
response = await fetchImpl
|
|
106
|
+
response = await postDraftRoute(fetchImpl, input.origin, "/session", {
|
|
106
107
|
method: "POST",
|
|
107
108
|
headers: {
|
|
108
109
|
authorization: `Bearer ${token}`,
|