@segmentstream/agent 0.42.0 → 0.43.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/README.md +24 -24
- package/dist/_chunks/{build-metadata-CUyA2hlu.mjs → build-metadata-CkBdh-TE.mjs} +1 -1
- package/dist/_chunks/{principal-BIX7T6Hh.mjs → principal-nQ_gwLJs.mjs} +4 -4
- package/dist/extension/channels/telegram.mjs +1 -1
- package/dist/extension/channels/whatsapp.mjs +1 -1
- package/dist/extension/config.d.ts +14 -16
- package/dist/extension/config.mjs +57 -12
- package/dist/extension/conventions.d.ts +1 -1
- package/dist/extension/conventions.mjs +22 -19
- package/dist/extension/extension.d.ts +2 -2
- package/dist/extension/extension.mjs +3 -3
- package/dist/extension/hooks/authorization.mjs +1 -1
- package/dist/extension/hooks/{conversations.mjs → chat-recorder.mjs} +4 -4
- package/dist/extension/hooks/sandbox.d.ts +2 -2
- package/dist/extension/instructions/{conversations.mjs → chat-context.mjs} +2 -2
- package/dist/extension/instructions/persona.mjs +1 -1
- package/dist/extension/instructions/sandbox.mjs +2 -2
- package/dist/extension/instructions.md +10 -10
- package/dist/extension/lib/actor.mjs +1 -1
- package/dist/extension/lib/attachment-tools.d.ts +1 -1
- package/dist/extension/lib/attachment-tools.mjs +7 -7
- package/dist/extension/lib/attachments.d.ts +9 -4
- package/dist/extension/lib/attachments.mjs +9 -7
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/chat-address.d.ts +33 -0
- package/dist/extension/lib/{conversation.mjs → chat-address.mjs} +13 -12
- package/dist/extension/lib/{conversations.d.ts → chat-archive.d.ts} +12 -12
- package/dist/extension/lib/{conversations.mjs → chat-archive.mjs} +9 -9
- package/dist/extension/lib/chat-context.d.ts +5 -5
- package/dist/extension/lib/chat-context.mjs +6 -6
- package/dist/extension/lib/{conversation-runtime.d.ts → chat-recorder.d.ts} +3 -3
- package/dist/extension/lib/{conversation-runtime.mjs → chat-recorder.mjs} +13 -13
- package/dist/extension/lib/confirmations.d.ts +3 -3
- package/dist/extension/lib/confirmations.mjs +8 -8
- package/dist/extension/lib/group-routing/addressing.d.ts +1 -1
- package/dist/extension/lib/group-routing/addressing.mjs +2 -2
- package/dist/extension/lib/group-routing/burst.mjs +2 -2
- package/dist/extension/lib/group-routing/{conversation-prompt.d.ts → chat-prompt.d.ts} +2 -2
- package/dist/extension/lib/group-routing/{conversation-prompt.mjs → chat-prompt.mjs} +3 -3
- package/dist/extension/lib/group-routing/{conversation-router.d.ts → chat-router.d.ts} +6 -6
- package/dist/extension/lib/group-routing/{conversation-router.mjs → chat-router.mjs} +9 -9
- package/dist/extension/lib/group-routing/engagement.mjs +2 -2
- package/dist/extension/lib/group-routing/messages.d.ts +1 -1
- package/dist/extension/lib/group-routing/policy.d.ts +6 -6
- package/dist/extension/lib/group-routing/policy.mjs +16 -16
- package/dist/extension/lib/group-routing/replay.mjs +36 -9
- package/dist/extension/lib/group-routing/router.d.ts +3 -3
- package/dist/extension/lib/group-routing/router.mjs +16 -16
- package/dist/extension/lib/group-routing/routing-context.d.ts +2 -2
- package/dist/extension/lib/group-routing/routing-context.mjs +2 -2
- package/dist/extension/lib/group-routing/signals.d.ts +3 -3
- package/dist/extension/lib/group-routing/signals.mjs +5 -5
- package/dist/extension/lib/model-service-alert.d.ts +2 -2
- package/dist/extension/lib/model-service-alert.mjs +2 -2
- package/dist/extension/lib/ontology-connection.mjs +1 -1
- package/dist/extension/lib/ontology-file-call.mjs +1 -1
- package/dist/extension/lib/ontology-tools.mjs +1 -1
- package/dist/extension/lib/review/hold.d.ts +7 -7
- package/dist/extension/lib/review/hold.mjs +12 -12
- package/dist/extension/lib/review/judge.d.ts +9 -9
- package/dist/extension/lib/review/judge.mjs +12 -12
- package/dist/extension/lib/review/reply.d.ts +13 -13
- package/dist/extension/lib/review/reply.mjs +20 -20
- 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 +3 -2
- package/dist/extension/lib/slack/adapter.mjs +2 -2
- package/dist/extension/lib/slack/attachments-send.d.ts +2 -2
- package/dist/extension/lib/slack/attachments-send.mjs +5 -5
- package/dist/extension/lib/slack/files.mjs +4 -4
- package/dist/extension/lib/stored-files.mjs +1 -1
- package/dist/extension/lib/telegram/adapter.d.ts +4 -3
- package/dist/extension/lib/telegram/adapter.mjs +10 -10
- package/dist/extension/lib/telegram/attachments-send.mjs +1 -1
- package/dist/extension/lib/telegram/callbacks.mjs +1 -1
- package/dist/extension/lib/telegram/{conversations.d.ts → chat-archive.d.ts} +7 -7
- package/dist/extension/lib/telegram/{conversations.mjs → chat-archive.mjs} +10 -10
- package/dist/extension/lib/telegram/confirmation-text.mjs +1 -0
- package/dist/extension/lib/telegram/confirmations.d.ts +2 -2
- package/dist/extension/lib/telegram/confirmations.mjs +3 -3
- package/dist/extension/lib/telegram/delivery-diagnostics.d.ts +3 -3
- package/dist/extension/lib/telegram/delivery-diagnostics.mjs +2 -2
- package/dist/extension/lib/telegram/files.d.ts +1 -1
- package/dist/extension/lib/telegram/files.mjs +8 -8
- package/dist/extension/lib/telegram/health.mjs +1 -1
- package/dist/extension/lib/telegram/inbound-request.d.ts +1 -1
- package/dist/extension/lib/telegram/inbound.d.ts +3 -3
- package/dist/extension/lib/telegram/inbound.mjs +36 -36
- package/dist/extension/lib/telegram/lifecycle.mjs +3 -3
- package/dist/extension/lib/telegram/principal.d.ts +2 -2
- package/dist/extension/lib/telegram/principal.mjs +1 -1
- package/dist/extension/lib/telegram/router.mjs +2 -2
- package/dist/extension/lib/telegram/sessions.d.ts +1 -1
- package/dist/extension/lib/telegram/signals.mjs +1 -1
- package/dist/extension/lib/telegram/silent.d.ts +2 -2
- package/dist/extension/lib/telegram/structured.mjs +1 -1
- package/dist/extension/lib/telegram/turn-errors.d.ts +2 -2
- package/dist/extension/lib/telegram/turn-errors.mjs +2 -2
- package/dist/extension/lib/telegram/voice.d.ts +1 -1
- package/dist/extension/lib/whatsapp/adapter.d.ts +2 -2
- package/dist/extension/lib/whatsapp/adapter.mjs +2 -2
- package/dist/extension/lib/workflow-serializable.d.ts +1 -1
- package/dist/extension/model.mjs +1 -1
- package/dist/extension/personas.d.ts +1 -1
- package/dist/extension/review.d.ts +23 -20
- package/dist/extension/review.mjs +21 -34
- package/dist/extension/tools/attachments_promote.mjs +1 -1
- package/dist/extension/tools/attachments_send.mjs +3 -3
- package/dist/extension/tools/no_reply.d.ts +1 -1
- package/dist/extension/tools/questions_ask.mjs +4 -4
- package/dist/extension/tools/sandbox.mjs +2 -2
- package/package.json +2 -2
- package/dist/extension/lib/conversation.d.ts +0 -33
- /package/dist/extension/hooks/{conversations.d.ts → chat-recorder.d.ts} +0 -0
- /package/dist/extension/instructions/{conversations.d.ts → chat-context.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ See [Sandbox](#sandbox).
|
|
|
121
121
|
| `ontology.connection` | `true` | Whether the agent reaches the ontology over MCP |
|
|
122
122
|
| `sandbox` | `false` | `true` adds `bash`, `read_file` and `write_file` in the agent's sandbox without network; see [Sandbox](#sandbox) |
|
|
123
123
|
| `personas` | none | `{ "byRole": { role: persona }, "default": persona }`: who the agent is to the person; see [Personas and skills by role](#personas-and-skills-by-role) |
|
|
124
|
-
| `
|
|
124
|
+
| `review` | none | `{ "byRole": { role: { "mode": … } }, "default": { "mode": … } }`: who sends replies; see [Reply review](#reply-review) |
|
|
125
125
|
|
|
126
126
|
An unknown field or an invalid value fails the mount with `SegmentStreamAgentConfigError`, naming
|
|
127
127
|
each path. `manifestOf(config)` returns the normalized configuration, defaults applied, for the
|
|
@@ -130,8 +130,8 @@ platform's deployment manifest.
|
|
|
130
130
|
## Personas and skills by role
|
|
131
131
|
|
|
132
132
|
The shared instructions (`agent/agent/instructions.md`) reach everyone the agent talks to. A
|
|
133
|
-
persona, `agent/personas/<name>.md`, says who the agent is to the person in a
|
|
134
|
-
per
|
|
133
|
+
persona, `agent/personas/<name>.md`, says who the agent is to the person in a session: one
|
|
134
|
+
per session, the first `personas.byRole` entry whose role the person who started it holds,
|
|
135
135
|
else `personas.default`. The SDK reads each text when the agent is built and the platform puts it
|
|
136
136
|
inline when it deploys, so the mount stays `segmentstream(config)`; the build fails when a named
|
|
137
137
|
text is missing. Guidance for the group decision model lives the same way in
|
|
@@ -145,11 +145,11 @@ in the workspace agent guide.
|
|
|
145
145
|
|
|
146
146
|
## Reply review
|
|
147
147
|
|
|
148
|
-
`
|
|
148
|
+
`review` says, per role of the person the agent replies to, who sends its replies on
|
|
149
149
|
Telegram and WhatsApp: `{ "review": { "mode": "never" } }` (the agent, the default),
|
|
150
150
|
`{ "mode": "always" }` (a member reviews every reply) or
|
|
151
151
|
`{ "mode": "whenUnsure", "minConfidence": 0.9 }` (the decision model judges each reply in its
|
|
152
|
-
|
|
152
|
+
chat, with the criteria in `agent/review/<role>.md`, and the agent sends those it is sure
|
|
153
153
|
enough of). A held reply becomes an `agent_review` record of the ontology, which a member
|
|
154
154
|
approves, edits or rejects. See [reply review](../../docs/agent.md#reply-review) in the workspace
|
|
155
155
|
agent guide.
|
|
@@ -261,7 +261,7 @@ continue using GET lookup. Starter templates and pins remain unchanged in this s
|
|
|
261
261
|
| `segmentstream__bash`, `_read_file`, `_write_file` | `tools` | With `"sandbox": true`: eve's file tools, only in the sandbox `@segmentstream/agent/sandbox` opened. |
|
|
262
262
|
| `segmentstream__attachments_stage` | `tools` | With `"sandbox": true`: copies a chat attachment or a stored record's file, read as the member, into the sandbox. |
|
|
263
263
|
| platform rules | `instructions` | Changes go through actions; `*_find` and `list_metrics` say what fields and metrics mean; `discover` ranks by meaning where listed; when to call `no_reply`; attachments |
|
|
264
|
-
| chat context | `hooks`, `instructions` | Adds the chat messages a Telegram session has not seen, once, ahead of the turn; see [Durable
|
|
264
|
+
| chat context | `hooks`, `instructions` | Adds the chat messages a Telegram session has not seen, once, ahead of the turn; see [Durable chats](#durable-chats). |
|
|
265
265
|
| sandbox rules | `instructions` | With `"sandbox": true`: working copies, file contents as data, no network. |
|
|
266
266
|
| sandbox cleanup | `hooks` | Deletes the session's sandbox when its history is cleared. |
|
|
267
267
|
|
|
@@ -373,7 +373,7 @@ The SDK adds no text to the prompt.
|
|
|
373
373
|
- **The secret.** The route hands the secret to the session in the channel's adapter state; the
|
|
374
374
|
session's first event moves it into the session's durable task state, and it is forgotten once
|
|
375
375
|
the outcome is reported. It is never in the principal, the model's context, tool arguments or
|
|
376
|
-
results, the session's events, logs or the
|
|
376
|
+
results, the session's events, logs or the chat archive.
|
|
377
377
|
- **No person is present.** Ontology actions the workflow's role permits run without confirmation
|
|
378
378
|
cards. Attachments, member files, chat history and `chat_post_message` are not offered. A
|
|
379
379
|
question from `questions_ask`, an approval a tool asks a person for, eve's own questions or a
|
|
@@ -387,7 +387,7 @@ The SDK adds no text to the prompt.
|
|
|
387
387
|
or when the ontology refuses the secret, the session ends: eve has no command for a session to
|
|
388
388
|
retire itself, so it asks its own deployment's `POST /eve/segmentstream/v1/tasks/end`, which ends
|
|
389
389
|
only the session that still owns the task's address.
|
|
390
|
-
- **Logs.** The
|
|
390
|
+
- **Logs.** The chat archive keeps a task's events under provider `task` and the task's id,
|
|
391
391
|
with no member taking part, so `segmentstream agent logs --chat <task id>` shows them.
|
|
392
392
|
|
|
393
393
|
### Telegram
|
|
@@ -414,14 +414,14 @@ The SDK adds no text to the prompt.
|
|
|
414
414
|
`chatId`, `chatType` and `username`.
|
|
415
415
|
- **Routing.** Private chats and messages explicitly addressed to the bot retain direct admission.
|
|
416
416
|
Other group messages, including captionless attachments, go through one `decide` question with
|
|
417
|
-
the agent's purpose, recent
|
|
417
|
+
the agent's purpose, recent chat, open questions and confirmation state. The legacy
|
|
418
418
|
`mention` policy observes unaddressed messages without paid work. Attachments never force a turn.
|
|
419
419
|
Human reply edges and other recipients are untrusted context for inference. Failed decisions
|
|
420
|
-
observe, except within a
|
|
421
|
-
|
|
420
|
+
observe, except within a chat-policy `defer` band. Recent context comes from the
|
|
421
|
+
chat archive: observed and answered messages, delivered replies and confirmation cards;
|
|
422
422
|
retries add nothing. Decision events retain the reason, short audit note, model and latency, plus
|
|
423
423
|
probabilities when available.
|
|
424
|
-
- **
|
|
424
|
+
- **Chat addressing.** Opt in with `groups.smart.engagement.policy: "chat"`.
|
|
425
425
|
Code decides only explicit cases: a bot mention, command, agent vocative or reply to the agent
|
|
426
426
|
goes to the agent; a reply to, tag of, or leading/trailing name of a person goes to that person.
|
|
427
427
|
Every other message goes to the decision model with the chat's last `smart.context.messages`
|
|
@@ -481,7 +481,7 @@ The SDK adds no text to the prompt.
|
|
|
481
481
|
no turn and drops the old chat from the memo. The `<chat>` block carries at most 1000
|
|
482
482
|
characters of `whenToUse`.
|
|
483
483
|
- **Cross-chat drafts.** The agent uses `chat_post_message` through its existing ontology
|
|
484
|
-
connection, from a Telegram, Slack or WhatsApp
|
|
484
|
+
connection, from a Telegram, Slack or WhatsApp chat, into a Telegram chat or, when the
|
|
485
485
|
ontology declares `chat.slack`, a Slack channel or a member's Slack DM, or, when it declares
|
|
486
486
|
`chat.whatsapp`, another member's WhatsApp chat with the workspace's number (only inside Meta's
|
|
487
487
|
24-hour customer-service window). The Slack channel reports
|
|
@@ -500,7 +500,7 @@ The SDK adds no text to the prompt.
|
|
|
500
500
|
routes now serve only the inbound webhook and authenticated health; old instruction relay calls
|
|
501
501
|
fail instead of starting an agent turn.
|
|
502
502
|
- **Silence.** When the model calls `segmentstream__no_reply` (eve's `no_reply`), the turn ends
|
|
503
|
-
without a message; the call and its reason are recorded in the session and the
|
|
503
|
+
without a message; the call and its reason are recorded in the session and the chat
|
|
504
504
|
archive like any tool call. Empty and whitespace-only final text also send nothing. The turn
|
|
505
505
|
stays in the session. Archive decisions distinguish empty text and whitespace, retaining finish
|
|
506
506
|
reason and character count without logging raw output. Model reply decisions do not prove
|
|
@@ -609,7 +609,7 @@ larger Telegram limits do not bypass it. Downloads are bounded even if storage u
|
|
|
609
609
|
Exact chat posting accepts text only through the ontology's `chat_post_message`.
|
|
610
610
|
There are no `document_ids` relay arguments, `AgentMessage` transport or
|
|
611
611
|
`<agent_request>` turns. Stored file tools keep their member authorization in the
|
|
612
|
-
current
|
|
612
|
+
current chat; group purpose and document restrictions still apply.
|
|
613
613
|
|
|
614
614
|
## Telegram answer delivery
|
|
615
615
|
|
|
@@ -653,7 +653,7 @@ Building the package needs Node.js 24, as eve does: `pnpm run build` runs `eve e
|
|
|
653
653
|
which writes the agent-shaped `dist/extension` tree, its declarations and eve's compatibility
|
|
654
654
|
manifest.
|
|
655
655
|
|
|
656
|
-
SDK-authored tool results and
|
|
656
|
+
SDK-authored tool results and chat archive events normalize runtime values to JSON
|
|
657
657
|
before returning or encoding them. Exact decimal/bigint strings and binary byte views are
|
|
658
658
|
preserved; conversion diagnostics identify the boundary and value path without logging payloads.
|
|
659
659
|
Maps use entry arrays so distinct key types and object keys retain every entry. Native brand and
|
|
@@ -685,7 +685,7 @@ a provider token.
|
|
|
685
685
|
|
|
686
686
|
Apache-2.0
|
|
687
687
|
|
|
688
|
-
## Durable
|
|
688
|
+
## Durable chats
|
|
689
689
|
|
|
690
690
|
Production Telegram webhooks archive every receivable message in the platform database,
|
|
691
691
|
including automated posts and unanswered messages. The extension also records replies,
|
|
@@ -713,7 +713,7 @@ applies bounded credential and file-byte redaction, and ingestion preserves the
|
|
|
713
713
|
Deploy backend migration 0043/API before upgrading to agent SDK 0.6.10.
|
|
714
714
|
`segmentstream agent logs` and its `show`/`call` commands read this content
|
|
715
715
|
with a human Cloud session; all members with workspace access can read DMs too.
|
|
716
|
-
Runtime/model/MCP
|
|
716
|
+
Runtime/model/MCP chat readers never receive these new fields. Telegram delivery diagnostics
|
|
717
717
|
retain their correlation reference, operation and redacted error in the same archive before the
|
|
718
718
|
channel callback returns, so a notice remains diagnosable after runtime logs expire.
|
|
719
719
|
|
|
@@ -722,7 +722,7 @@ Platform REST reads, the workspace ontology's
|
|
|
722
722
|
`chat_history` and `chat_search`, and the member REST facade enforce workspace/group
|
|
723
723
|
permissions and DM participant/admin scope. Deploy the backend migration/API and upgrade the
|
|
724
724
|
ontology SDK along with this extension. See the repository's
|
|
725
|
-
[
|
|
725
|
+
[chat storage guide](../../docs/agent-chat-storage.md) for APIs, retention,
|
|
726
726
|
eve's existing storage, and Telegram's delivery limits.
|
|
727
727
|
|
|
728
728
|
### Exact chat posting protocol
|
|
@@ -745,11 +745,11 @@ The target/attribution are resolved again immediately before executing the froze
|
|
|
745
745
|
|
|
746
746
|
The SDK constructs model-hidden `_segmentstream` metadata for approved runtime posts.
|
|
747
747
|
It contains `version: 1`, `session_id` and `call_id`. A consumed, unexpired chat approval additionally
|
|
748
|
-
supplies `operation_id`, the source
|
|
748
|
+
supplies `operation_id`, the source chat and `expected: { chat_id, digest }`. A Telegram
|
|
749
749
|
source carries its chat, topic and message references. A Slack or WhatsApp source carries only
|
|
750
750
|
`{ provider, chat_id, thread_id, kind, peer? }`: `kind` is `private` for a member's own direct
|
|
751
|
-
|
|
752
|
-
channel other than the member's verified pairing, and a post into the
|
|
751
|
+
chat, whose `peer` is the member's id on the provider. The ontology refuses a source on a
|
|
752
|
+
channel other than the member's verified pairing, and a post into the chat it came from,
|
|
753
753
|
including a private destination naming the same person. An ontology without this source form
|
|
754
754
|
refuses a Slack or WhatsApp source before sending.
|
|
755
755
|
The operation ID is `hq:` plus SHA-256 of the JSON array `[session_id, call_id]`; it stays stable
|
|
@@ -789,7 +789,7 @@ the unreachable run. The smart gate still decides whether to reply; observing a
|
|
|
789
789
|
creates no session and sends no failure notice. Every deployment, independent request and
|
|
790
790
|
cold start selects the same successor, and Eve hands it over between deployments like any
|
|
791
791
|
healthy session. If the successor's own deployment is deleted later, the next successor
|
|
792
|
-
follows the same rule, up to four in a row. Archived
|
|
792
|
+
follows the same rule, up to four in a row. Archived chat context remains
|
|
793
793
|
available, but the inaccessible session's model history and pending inputs cannot migrate.
|
|
794
794
|
`segmentstream history squash` deletes earlier deployments and so ends the sessions
|
|
795
795
|
they own; each affected address continues once at its successor.
|
|
@@ -809,7 +809,7 @@ retrying, and temporary-outage copy that asks the member to wait before retrying
|
|
|
809
809
|
Unknown model failures retain the ordinary notice; raw provider messages and hints
|
|
810
810
|
never become user-facing text. Session recovery failures use the same classification.
|
|
811
811
|
|
|
812
|
-
The
|
|
812
|
+
The chat recorder also writes a `model_service_alert` decision for recognized
|
|
813
813
|
model service failures on every channel it can archive, including private HTTP sessions.
|
|
814
814
|
This durable operator alert contains only the safe category, failure code, retry policy
|
|
815
815
|
and ordinary event coordinates. A workspace-wide archive event key limits it to one
|
|
@@ -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.43.0";
|
|
8
8
|
function agentBuild(environment = process.env) {
|
|
9
9
|
return {
|
|
10
10
|
agent: version,
|
|
@@ -94,8 +94,8 @@ function telegramPrincipal(input) {
|
|
|
94
94
|
if (message.from.username !== void 0) attributes.username = message.from.username;
|
|
95
95
|
const locale = member.locale ?? message.from.languageCode;
|
|
96
96
|
if (locale !== void 0) attributes.locale = locale;
|
|
97
|
-
const language = input.
|
|
98
|
-
if (language !== void 0) attributes.
|
|
97
|
+
const language = input.chatLanguage ?? chatLanguage([message.text || message.caption]);
|
|
98
|
+
if (language !== void 0) attributes.chatLanguage = language;
|
|
99
99
|
return {
|
|
100
100
|
authenticator: TELEGRAM_AUTHENTICATOR,
|
|
101
101
|
issuer: "telegram",
|
|
@@ -105,7 +105,7 @@ function telegramPrincipal(input) {
|
|
|
105
105
|
attributes
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function chatLanguage(texts) {
|
|
109
109
|
for (const text of texts) {
|
|
110
110
|
if (/[\u0430-\u044f\u0451]/iu.test(text)) return "ru";
|
|
111
111
|
if ((text.match(/\b[a-z]+\b/gi)?.length ?? 0) >= 3) return "en";
|
|
@@ -125,4 +125,4 @@ function identityProviderOf(principal) {
|
|
|
125
125
|
const provider = principal?.attributes.identityProvider;
|
|
126
126
|
return typeof provider === "string" && provider !== "" ? provider : void 0;
|
|
127
127
|
}
|
|
128
|
-
export { rolesOf as a, compatibleRuntimeEnvelope as c, telegramRuntimeSource as d, memberIdOf as i, principalRuntimeSource as l,
|
|
128
|
+
export { rolesOf as a, compatibleRuntimeEnvelope as c, telegramRuntimeSource as d, memberIdOf as i, principalRuntimeSource as l, chatLanguage as n, telegramPrincipal as o, identityProviderOf as r, RUNTIME_SOURCE_PROTOCOL as s, TELEGRAM_AUTHENTICATOR as t, runtimeEnvelope as u };
|
|
@@ -16,7 +16,7 @@ var telegram_default = segmentstreamTelegram({
|
|
|
16
16
|
admission: () => segmentstream.config,
|
|
17
17
|
decide: (options) => decide(options),
|
|
18
18
|
review: {
|
|
19
|
-
settings: () => segmentstream.config.
|
|
19
|
+
settings: () => segmentstream.config.review,
|
|
20
20
|
decide: (options) => decide(options)
|
|
21
21
|
}
|
|
22
22
|
});
|
|
@@ -11,7 +11,7 @@ var whatsapp_default = segmentstreamWhatsApp({
|
|
|
11
11
|
settings: () => segmentstream.config.channels.whatsapp,
|
|
12
12
|
admission: () => segmentstream.config,
|
|
13
13
|
review: {
|
|
14
|
-
settings: () => segmentstream.config.
|
|
14
|
+
settings: () => segmentstream.config.review,
|
|
15
15
|
decide: (options) => decide(options),
|
|
16
16
|
model: () => segmentstream.config.models.decision
|
|
17
17
|
}
|
|
@@ -5,7 +5,7 @@ import type { WorkspaceActionHook } from "./lib/telegram/workspace-action.js";
|
|
|
5
5
|
import { type TelegramTexts } from "./lib/telegram/texts.js";
|
|
6
6
|
import type { AttachmentLifecycle } from "./lib/telegram/lifecycle.js";
|
|
7
7
|
import { type PersonaSettings } from "./personas.js";
|
|
8
|
-
import { type
|
|
8
|
+
import { type ReviewSettings, type ReviewMode } from "./review.js";
|
|
9
9
|
import { type TelegramLinkPreviews } from "@segmentstream/ontology/telegram";
|
|
10
10
|
export declare const TELEGRAM_POLICIES: readonly ["mention", "smart"];
|
|
11
11
|
/**
|
|
@@ -179,21 +179,19 @@ export interface SegmentStreamAgentConfigInput {
|
|
|
179
179
|
* that staff would send the reply as written (`whenUnsure`). The criteria of a `whenUnsure`
|
|
180
180
|
* review are `agent/review/<role>.md` (`default.md`), which the SDK and the platform put inline.
|
|
181
181
|
*/
|
|
182
|
-
readonly
|
|
183
|
-
readonly byRole?: Readonly<Record<string,
|
|
184
|
-
readonly default?:
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
/** One entry of {@link SegmentStreamAgentConfigInput.conversations}. */
|
|
188
|
-
export interface ConversationInput {
|
|
189
|
-
readonly review: {
|
|
190
|
-
readonly mode: Exclude<ReviewMode, "whenUnsure">;
|
|
191
|
-
} | {
|
|
192
|
-
readonly mode: "whenUnsure";
|
|
193
|
-
readonly minConfidence: number;
|
|
194
|
-
readonly criteria?: string;
|
|
182
|
+
readonly review?: {
|
|
183
|
+
readonly byRole?: Readonly<Record<string, ReviewInput>>;
|
|
184
|
+
readonly default?: ReviewInput;
|
|
195
185
|
};
|
|
196
186
|
}
|
|
187
|
+
/** One entry of {@link SegmentStreamAgentConfigInput.review}. */
|
|
188
|
+
export type ReviewInput = {
|
|
189
|
+
readonly mode: Exclude<ReviewMode, "whenUnsure">;
|
|
190
|
+
} | {
|
|
191
|
+
readonly mode: "whenUnsure";
|
|
192
|
+
readonly minConfidence: number;
|
|
193
|
+
readonly criteria?: string;
|
|
194
|
+
};
|
|
197
195
|
export interface TelegramSettings {
|
|
198
196
|
readonly groups?: {
|
|
199
197
|
readonly replyEdgeIsAddress?: boolean;
|
|
@@ -260,7 +258,7 @@ export interface SegmentStreamAgentConfig extends AdmissionSettings {
|
|
|
260
258
|
/** The personas, with their texts once read; absent when `segmentstream.json` declares none. */
|
|
261
259
|
readonly personas?: PersonaSettings;
|
|
262
260
|
/** Who sends replies; absent when `segmentstream.json` declares none, and the agent sends them. */
|
|
263
|
-
readonly
|
|
261
|
+
readonly review?: ReviewSettings;
|
|
264
262
|
}
|
|
265
263
|
/** One validation failure, in Standard Schema's issue shape. */
|
|
266
264
|
export interface ConfigIssue {
|
|
@@ -272,7 +270,7 @@ export type ConfigWarning = ConfigIssue;
|
|
|
272
270
|
/**
|
|
273
271
|
* Every setting the configuration sets that configures nothing, for the deploy output and the
|
|
274
272
|
* console, so the builder learns of it where they work: retired session and group keys, and the
|
|
275
|
-
* older policies' thresholds where the
|
|
273
|
+
* older policies' thresholds where the chat policy applies. The agent also logs them.
|
|
276
274
|
*/
|
|
277
275
|
export declare function configWarnings(value: unknown): ReadonlyArray<ConfigWarning>;
|
|
278
276
|
type Validation = {
|
|
@@ -11,9 +11,9 @@ import { TELEGRAM_TEXT_KEYS } from "./lib/telegram/texts.mjs";
|
|
|
11
11
|
import { isTechnicalText } from "./lib/customer-text-safety.mjs";
|
|
12
12
|
import { inlineConventionFiles } from "./conventions.mjs";
|
|
13
13
|
import { personaSettings } from "./personas.mjs";
|
|
14
|
-
import {
|
|
14
|
+
import { earlierReviewInput, reviewSettings } from "./review.mjs";
|
|
15
15
|
import { readFileSync, realpathSync } from "node:fs";
|
|
16
|
-
import { expandGroupFiles, groupPolicyIssues } from "@segmentstream/ontology/groups";
|
|
16
|
+
import { currentGroupPolicyInput, expandGroupFiles, groupPolicyIssues } from "@segmentstream/ontology/groups";
|
|
17
17
|
import { TELEGRAM_LINK_PREVIEWS, isHttpOrigin } from "@segmentstream/ontology/telegram";
|
|
18
18
|
const CONNECTION_KEY = /^[a-z][a-z0-9_]{0,63}$/;
|
|
19
19
|
const TELEGRAM_POLICIES = ["mention", "smart"];
|
|
@@ -46,7 +46,7 @@ const IGNORED_SESSION_KEYS = [
|
|
|
46
46
|
"timezone",
|
|
47
47
|
"idleResetHours"
|
|
48
48
|
];
|
|
49
|
-
const INAPPLICABLE_THRESHOLD = "applies only to the legacy and engaged policies; the
|
|
49
|
+
const INAPPLICABLE_THRESHOLD = "applies only to the legacy and engaged policies; the chat policy reads thresholds.reply and thresholds.defer, so remove it";
|
|
50
50
|
function configWarnings(value) {
|
|
51
51
|
const root = value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
52
52
|
return [
|
|
@@ -56,12 +56,17 @@ function configWarnings(value) {
|
|
|
56
56
|
})),
|
|
57
57
|
...ignoredGroupSettings(root?.groups, ["groups"]).map((path) => ({
|
|
58
58
|
path: path.split("."),
|
|
59
|
-
message: "no longer configures anything: group routing reads the chat's recent messages and has no
|
|
59
|
+
message: "no longer configures anything: group routing reads the chat's recent messages and has no chat timers, so remove it"
|
|
60
60
|
})),
|
|
61
|
-
...inapplicableGroupThresholds(root?.groups).map((path) => ({
|
|
61
|
+
...inapplicableGroupThresholds(currentGroupPolicyInput(root?.groups)).map((path) => ({
|
|
62
62
|
path: ["groups", ...path],
|
|
63
63
|
message: INAPPLICABLE_THRESHOLD
|
|
64
64
|
})),
|
|
65
|
+
...earlierRoutingNames(root?.groups),
|
|
66
|
+
...root?.conversations === void 0 ? [] : [{
|
|
67
|
+
path: ["conversations"],
|
|
68
|
+
message: "is now review, with each role's mode and minConfidence directly under it: write \"review\": { \"byRole\": { \"<role>\": { \"mode\": ... } }, \"default\": { ... } }"
|
|
69
|
+
}],
|
|
65
70
|
...isRecord(root?.groups) && isRecord(root.groups.smart) && root.groups.smart.instructions !== void 0 ? [{
|
|
66
71
|
path: [
|
|
67
72
|
"groups",
|
|
@@ -72,6 +77,40 @@ function configWarnings(value) {
|
|
|
72
77
|
}] : []
|
|
73
78
|
];
|
|
74
79
|
}
|
|
80
|
+
function earlierRoutingNames(groups) {
|
|
81
|
+
if (!isRecord(groups)) return [];
|
|
82
|
+
return [
|
|
83
|
+
[["groups", "smart"], groups.smart],
|
|
84
|
+
...isRecord(groups.chats) ? Object.entries(groups.chats).map(([key, chat]) => [[
|
|
85
|
+
"groups",
|
|
86
|
+
"chats",
|
|
87
|
+
key,
|
|
88
|
+
"smart"
|
|
89
|
+
], isRecord(chat) ? chat.smart : void 0]) : [],
|
|
90
|
+
[[
|
|
91
|
+
"groups",
|
|
92
|
+
"observability",
|
|
93
|
+
"shadow"
|
|
94
|
+
], isRecord(groups.observability) ? groups.observability.shadow : void 0]
|
|
95
|
+
].flatMap(([path, smart]) => {
|
|
96
|
+
const engagement = isRecord(smart) && isRecord(smart.engagement) ? smart.engagement : {};
|
|
97
|
+
return [...engagement.policy === "conversation" ? [{
|
|
98
|
+
path: [
|
|
99
|
+
...path,
|
|
100
|
+
"engagement",
|
|
101
|
+
"policy"
|
|
102
|
+
],
|
|
103
|
+
message: "is now \"chat\"; write \"chat\""
|
|
104
|
+
}] : [], ...engagement.conversationMinutes === void 0 ? [] : [{
|
|
105
|
+
path: [
|
|
106
|
+
...path,
|
|
107
|
+
"engagement",
|
|
108
|
+
"conversationMinutes"
|
|
109
|
+
],
|
|
110
|
+
message: "is now engagementMinutes; rename it"
|
|
111
|
+
}]];
|
|
112
|
+
});
|
|
113
|
+
}
|
|
75
114
|
var SegmentStreamAgentConfigError = class extends Error {
|
|
76
115
|
issues;
|
|
77
116
|
name = "SegmentStreamAgentConfigError";
|
|
@@ -596,6 +635,7 @@ function validateConfig(input, options = {}) {
|
|
|
596
635
|
"replies",
|
|
597
636
|
"texts",
|
|
598
637
|
"personas",
|
|
638
|
+
"review",
|
|
599
639
|
"conversations"
|
|
600
640
|
],
|
|
601
641
|
issues
|
|
@@ -641,21 +681,22 @@ function validateConfig(input, options = {}) {
|
|
|
641
681
|
const telegram = telegramSettings(channels?.telegram, issues);
|
|
642
682
|
const whatsapp = whatsappSettings(channels?.whatsapp, issues);
|
|
643
683
|
const slack = slackSettings(channels?.slack, issues);
|
|
644
|
-
|
|
684
|
+
const authoredGroupsInput = currentGroupPolicyInput(root?.groups);
|
|
685
|
+
for (const issue of groupPolicyIssues(authoredGroupsInput)) issues.push({
|
|
645
686
|
...issue,
|
|
646
687
|
path: ["groups", ...issue.path]
|
|
647
688
|
});
|
|
648
|
-
const ignoredGroups = ignoredGroupSettings(
|
|
689
|
+
const ignoredGroups = ignoredGroupSettings(authoredGroupsInput, ["groups"]);
|
|
649
690
|
if (ignoredGroups.length > 0 && !ignoredGroupSettingsReported) {
|
|
650
691
|
ignoredGroupSettingsReported = true;
|
|
651
|
-
console.warn(`[segmentstream] agent/segmentstream.json: ${ignoredGroups.join(", ")} no longer configure anything and are ignored. Group routing has no
|
|
692
|
+
console.warn(`[segmentstream] agent/segmentstream.json: ${ignoredGroups.join(", ")} no longer configure anything and are ignored. Group routing has no chat timers: the classifier reads the chat's last groups.smart.context.messages messages, however old; remove these keys.`);
|
|
652
693
|
}
|
|
653
|
-
const inapplicable = inapplicableGroupThresholds(
|
|
694
|
+
const inapplicable = inapplicableGroupThresholds(authoredGroupsInput);
|
|
654
695
|
if (inapplicable.length > 0 && !inapplicableThresholdsReported) {
|
|
655
696
|
inapplicableThresholdsReported = true;
|
|
656
697
|
console.warn(`[segmentstream] agent/segmentstream.json: ${inapplicable.map((path) => ["groups", ...path].join(".")).join(", ")} ${INAPPLICABLE_THRESHOLD}.`);
|
|
657
698
|
}
|
|
658
|
-
let authoredGroups =
|
|
699
|
+
let authoredGroups = authoredGroupsInput;
|
|
659
700
|
if (authoredGroups !== void 0 && groupPolicyIssues(authoredGroups).length === 0) try {
|
|
660
701
|
authoredGroups = expandGroupFiles(authoredGroups, (path) => {
|
|
661
702
|
const root = realpathSync(process.cwd());
|
|
@@ -778,7 +819,11 @@ function validateConfig(input, options = {}) {
|
|
|
778
819
|
path: ["sandbox"]
|
|
779
820
|
});
|
|
780
821
|
const personas = personaSettings(root?.personas, issues, options.texts === "required");
|
|
781
|
-
|
|
822
|
+
if (root?.review !== void 0 && root.conversations !== void 0) issues.push({
|
|
823
|
+
path: ["conversations"],
|
|
824
|
+
message: "is the earlier name of review; keep review"
|
|
825
|
+
});
|
|
826
|
+
const review = reviewSettings(root?.review ?? earlierReviewInput(root?.conversations), issues);
|
|
782
827
|
if (issues.length > 0) return { issues };
|
|
783
828
|
return { value: {
|
|
784
829
|
groups,
|
|
@@ -805,7 +850,7 @@ function validateConfig(input, options = {}) {
|
|
|
805
850
|
replies,
|
|
806
851
|
texts,
|
|
807
852
|
...personas === null ? {} : { personas },
|
|
808
|
-
...
|
|
853
|
+
...review === void 0 ? {} : { review }
|
|
809
854
|
} };
|
|
810
855
|
}
|
|
811
856
|
function readAgentFile(path) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - `agent/groups/instructions.md`: guidance the group decision model reads after the platform's
|
|
7
7
|
* rules;
|
|
8
8
|
* - `agent/review/<role>.md` (`default.md` for `default`): what staff check a reply for, which the
|
|
9
|
-
* decision model reads for a
|
|
9
|
+
* decision model reads for a role whose review is `whenUnsure`.
|
|
10
10
|
*
|
|
11
11
|
* The SDK reads them when the agent is built; the platform reads them from the deployment's
|
|
12
12
|
* archive and puts them inline in `segmentstream.json` before it builds, so the running agent,
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { isPersonaName, personaFile } from "./personas.mjs";
|
|
8
|
-
import { criteriaFiles } from "./review.mjs";
|
|
8
|
+
import { criteriaFiles, earlierReviewInput } from "./review.mjs";
|
|
9
9
|
const GROUP_INSTRUCTIONS_FILE = "groups/instructions.md";
|
|
10
10
|
function isRecord(value) {
|
|
11
11
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -44,11 +44,22 @@ function inlineConventionFiles(input, read) {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
if (isRecord(input.
|
|
47
|
+
if (isRecord(input.review)) {
|
|
48
|
+
let review = { ...input.review };
|
|
49
|
+
for (const { path, file } of criteriaFiles(input.review)) {
|
|
50
|
+
const criteria = read(file);
|
|
51
|
+
if (criteria !== void 0) review = withReviewCriteria(review, path, criteria);
|
|
52
|
+
}
|
|
53
|
+
output = {
|
|
54
|
+
...output,
|
|
55
|
+
review
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (input.review === void 0 && isRecord(input.conversations)) {
|
|
48
59
|
let conversations = { ...input.conversations };
|
|
49
|
-
for (const { path, file } of criteriaFiles(input.conversations)) {
|
|
60
|
+
for (const { path, file } of criteriaFiles(earlierReviewInput(input.conversations))) {
|
|
50
61
|
const criteria = read(file);
|
|
51
|
-
if (criteria !== void 0) conversations = withReviewCriteria(conversations, path, criteria);
|
|
62
|
+
if (criteria !== void 0) conversations = withReviewCriteria(conversations, [...path, "review"], criteria);
|
|
52
63
|
}
|
|
53
64
|
output = {
|
|
54
65
|
...output,
|
|
@@ -57,24 +68,16 @@ function inlineConventionFiles(input, read) {
|
|
|
57
68
|
}
|
|
58
69
|
return output;
|
|
59
70
|
}
|
|
60
|
-
function withReviewCriteria(
|
|
71
|
+
function withReviewCriteria(settings, path, criteria) {
|
|
61
72
|
const [head, ...rest] = path;
|
|
62
|
-
if (head === void 0) return {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
...conversations,
|
|
66
|
-
[head]: withReviewCriteria(child, rest, criteria)
|
|
73
|
+
if (head === void 0) return {
|
|
74
|
+
...settings,
|
|
75
|
+
criteria
|
|
67
76
|
};
|
|
68
|
-
const
|
|
77
|
+
const child = isRecord(settings[head]) ? settings[head] : {};
|
|
69
78
|
return {
|
|
70
|
-
...
|
|
71
|
-
[head]:
|
|
72
|
-
...child,
|
|
73
|
-
review: {
|
|
74
|
-
...review,
|
|
75
|
-
criteria
|
|
76
|
-
}
|
|
77
|
-
}
|
|
79
|
+
...settings,
|
|
80
|
+
[head]: withReviewCriteria(child, rest, criteria)
|
|
78
81
|
};
|
|
79
82
|
}
|
|
80
83
|
export { GROUP_INSTRUCTIONS_FILE, inlineConventionFiles };
|
|
@@ -24,11 +24,11 @@ export { DEFAULT_DECISION_MODEL, DEFAULT_STT_MODEL, DEFAULT_ADMISSION_LIMITS, Se
|
|
|
24
24
|
export { chooseModel, model, type DynamicModel, type ModelChoice } from "./model.js";
|
|
25
25
|
export { forRoles } from "./lib/role-skill.js";
|
|
26
26
|
export { groupPolicy, effectiveGroupPolicy, DEFAULT_GROUP_POLICY, type GroupPolicy, type GroupPolicyInput, type SmartPolicyInput, type ChatOverrideInput, } from "./lib/group-routing/policy.js";
|
|
27
|
-
export { addressingReason as groupAddressingReason,
|
|
27
|
+
export { addressingReason as groupAddressingReason, chatKey, type GroupMessageSignals, type AgentMessageSignals, type GroupChannelAdapter, } from "./lib/group-routing/signals.js";
|
|
28
28
|
export { routeMessage as routeGroupMessage, decisionRouter as groupDecisionRouter, } from "./lib/group-routing/router.js";
|
|
29
29
|
export { agentMessage as groupAgentMessage, type RecentMessage, type AgentMessage, type ObservedMessage, } from "./lib/group-routing/messages.js";
|
|
30
30
|
export { archivedRoutingMessages } from "./lib/group-routing/routing-context.js";
|
|
31
31
|
export { replayRouterPayload } from "./lib/group-routing/replay.js";
|
|
32
|
-
export {
|
|
32
|
+
export { chatAddressing as groupChatAddressing } from "./lib/group-routing/addressing.js";
|
|
33
33
|
export { routingBurst } from "./lib/group-routing/burst.js";
|
|
34
34
|
export type { TelegramTexts } from "./lib/telegram/texts.js";
|
|
@@ -8,12 +8,12 @@ import { DEFAULT_ADMISSION_LIMITS, DEFAULT_DECISION_MODEL, DEFAULT_STT_MODEL, Se
|
|
|
8
8
|
import { chooseModel, model } from "./model.mjs";
|
|
9
9
|
import { forRoles } from "./lib/role-skill.mjs";
|
|
10
10
|
import { DEFAULT_GROUP_POLICY, effectiveGroupPolicy, groupPolicy } from "./lib/group-routing/policy.mjs";
|
|
11
|
-
import { addressingReason,
|
|
11
|
+
import { addressingReason, chatKey } from "./lib/group-routing/signals.mjs";
|
|
12
12
|
import { decisionRouter, routeMessage } from "./lib/group-routing/router.mjs";
|
|
13
13
|
import { agentMessage } from "./lib/group-routing/messages.mjs";
|
|
14
14
|
import { archivedRoutingMessages } from "./lib/group-routing/routing-context.mjs";
|
|
15
15
|
import { replayRouterPayload } from "./lib/group-routing/replay.mjs";
|
|
16
|
-
import {
|
|
16
|
+
import { chatAddressing } from "./lib/group-routing/addressing.mjs";
|
|
17
17
|
import { routingBurst } from "./lib/group-routing/burst.mjs";
|
|
18
18
|
import { defineExtension } from "eve/extension";
|
|
19
19
|
const extension = defineExtension({ config: configSchema });
|
|
@@ -21,4 +21,4 @@ const segmentstream = Object.assign(extension, {
|
|
|
21
21
|
model,
|
|
22
22
|
manifestOf
|
|
23
23
|
});
|
|
24
|
-
export { DEFAULT_ADMISSION_LIMITS, DEFAULT_DECISION_MODEL, DEFAULT_GROUP_POLICY, DEFAULT_STT_MODEL, SegmentStreamAgentConfigError, archivedRoutingMessages,
|
|
24
|
+
export { DEFAULT_ADMISSION_LIMITS, DEFAULT_DECISION_MODEL, DEFAULT_GROUP_POLICY, DEFAULT_STT_MODEL, SegmentStreamAgentConfigError, archivedRoutingMessages, chatKey, chooseModel, segmentstream as default, segmentstream, effectiveGroupPolicy, forRoles, addressingReason as groupAddressingReason, agentMessage as groupAgentMessage, chatAddressing as groupChatAddressing, decisionRouter as groupDecisionRouter, groupPolicy, manifestOf, model, replayRouterPayload, routeMessage as routeGroupMessage, routingBurst };
|
|
@@ -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-nQ_gwLJs.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,9 +5,9 @@ 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 {
|
|
9
|
-
import {
|
|
8
|
+
import { chatRecorder } from "../lib/chat-recorder.mjs";
|
|
9
|
+
import { chatArchive } from "../lib/chat-archive.mjs";
|
|
10
10
|
import { repliesReviewed } from "../lib/review/hold.mjs";
|
|
11
11
|
import { defineHook } from "eve/hooks";
|
|
12
|
-
var
|
|
13
|
-
export {
|
|
12
|
+
var chat_recorder_default = defineHook({ events: { "*": chatRecorder(chatArchive(), (principal) => repliesReviewed(segmentstream.config.review, principal)) } });
|
|
13
|
+
export { chat_recorder_default as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A cleared history starts the next
|
|
3
|
-
* is deleted through its handle, so the next access opens a fresh one. Compaction keeps the
|
|
2
|
+
* A cleared history starts the next session without the files of the last one: the sandbox
|
|
3
|
+
* is deleted through its handle, so the next access opens a fresh one. Compaction keeps the session and fires
|
|
4
4
|
* `context.settled` with kind `compaction` mid-turn too, so it leaves the sandbox alone; eve's own session-end
|
|
5
5
|
* cleanup deletes whatever remains.
|
|
6
6
|
*/
|
|
@@ -6,7 +6,7 @@ __eveDirname(__filename);
|
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { chatContextState, chatOf } from "../lib/chat-context.mjs";
|
|
8
8
|
import { defineDynamic, defineInstructions } from "eve/instructions";
|
|
9
|
-
var
|
|
9
|
+
var chat_context_default = defineDynamic((context) => {
|
|
10
10
|
if (chatOf(context) === void 0) return null;
|
|
11
11
|
const pending = chatContextState.get().pending;
|
|
12
12
|
return pending !== void 0 && pending.turnId === context.turn?.id && pending.content !== null ? defineInstructions({
|
|
@@ -14,4 +14,4 @@ var conversations_default = defineDynamic((context) => {
|
|
|
14
14
|
content: pending.content
|
|
15
15
|
}) : null;
|
|
16
16
|
});
|
|
17
|
-
export {
|
|
17
|
+
export { chat_context_default as default };
|
|
@@ -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-nQ_gwLJs.mjs";
|
|
9
9
|
import { personaFor } from "../personas.mjs";
|
|
10
10
|
import { defineDynamic, defineInstructions } from "eve/instructions";
|
|
11
11
|
var persona_default = defineDynamic((context) => {
|
|
@@ -8,8 +8,8 @@ import segmentstream from "../extension.mjs";
|
|
|
8
8
|
import { defineDynamic, defineInstructions } from "eve/instructions";
|
|
9
9
|
const SANDBOX_INSTRUCTIONS = `# Sandbox
|
|
10
10
|
|
|
11
|
-
\`segmentstream__bash\`, \`segmentstream__read_file\` and \`segmentstream__write_file\` work in
|
|
12
|
-
|
|
11
|
+
\`segmentstream__bash\`, \`segmentstream__read_file\` and \`segmentstream__write_file\` work in your
|
|
12
|
+
isolated sandbox: a Linux machine with no network, no credentials and no company
|
|
13
13
|
data. Use them to unpack archives, read PDFs, spreadsheets, CSV and images, run OCR and compute
|
|
14
14
|
with scripts. Installed: python3 with pandas, openpyxl, pypdf and pdfplumber; pdftotext and
|
|
15
15
|
pdftoppm, qpdf, tesseract (eng, rus), ghostscript, ImageMagick, 7z, unar, unzip, jq and rg.
|