@segmentstream/ontology 0.156.1 → 0.158.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 +40 -0
- package/README.md +8 -7
- package/dist/agent-chat.d.ts +1 -1
- package/dist/agent-chat.js +8 -8
- package/dist/agent-draft.d.ts +287 -0
- package/dist/{agent-review.js → agent-draft.js} +103 -82
- package/dist/analyze.d.ts +1 -1
- package/dist/analyze.js +71 -14
- package/dist/channel-files.d.ts +70 -0
- package/dist/channel-files.js +58 -0
- package/dist/chat.d.ts +2 -2
- package/dist/earlier-entity-names.d.ts +35 -0
- package/dist/earlier-entity-names.js +88 -0
- package/dist/email.d.ts +2 -0
- package/dist/email.js +1 -0
- package/dist/gmail-send.d.ts +39 -0
- package/dist/gmail-send.js +179 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/migrate/plan.js +31 -2
- package/dist/permissions.d.ts +5 -5
- package/dist/permissions.js +13 -10
- package/dist/replicated-entities.d.ts +1 -1
- package/dist/replicated-entities.js +4 -1
- package/dist/replication/bigquery.d.ts +24 -2
- package/dist/replication/bigquery.js +72 -12
- package/dist/runtime/agents.d.ts +1 -1
- package/dist/runtime/agents.js +43 -38
- package/dist/runtime/service-binding.js +1 -1
- package/dist/service/agent/protocol.d.ts +4 -4
- package/dist/service/agent/protocol.js +7 -7
- package/dist/service/agent/server.js +14 -9
- package/dist/service/chat/envelope.d.ts +12 -12
- package/dist/service/chat/review-delivery.js +23 -22
- package/dist/service/chat/review-revision.d.ts +1 -1
- package/dist/service/chat/review-revision.js +13 -13
- package/dist/service/mcp/runtime-policy.js +1 -1
- package/dist/service/mcp/server.js +9 -1
- package/dist/service/mcp/tools.js +1 -1
- package/dist/service/operations.js +11 -5
- package/dist/service/runtime-contract.d.ts +3 -3
- package/dist/service/service.d.ts +6 -0
- package/dist/service/service.js +21 -3
- package/dist/slack-files.d.ts +53 -0
- package/dist/slack-files.js +183 -0
- package/dist/slack.d.ts +3 -0
- package/dist/slack.js +2 -0
- package/dist/telegram-files.d.ts +81 -0
- package/dist/telegram-files.js +244 -0
- package/dist/telegram.d.ts +3 -1
- package/dist/telegram.js +2 -0
- package/dist/whatsapp-files.d.ts +54 -0
- package/dist/whatsapp-files.js +138 -0
- package/dist/whatsapp.d.ts +3 -0
- package/dist/whatsapp.js +2 -0
- package/dist/workspace-channel.d.ts +20 -0
- package/dist/workspace-channel.js +10 -0
- package/package.json +1 -1
- package/dist/agent-review.d.ts +0 -154
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.158.0
|
|
4
|
+
|
|
5
|
+
The built-in `agent_review` is now `agent_draft`, the agent's draft reply awaiting a staff
|
|
6
|
+
decision. It keeps its id, so the next deploy renames its table, history, enum types, indexes and
|
|
7
|
+
join tables and keeps every record. Its property `provider` is now `channelKind`; the inverses on
|
|
8
|
+
`user` are `agentDrafts`, `decidedAgentDrafts` and `notedAgentDrafts`, and on `agent_chat`
|
|
9
|
+
`drafts`. Its actions take the draft as `draft` and answer it as `draft`. The SDK exports
|
|
10
|
+
`AgentDraft` and `AGENT_DRAFT_*`. The routes are `/api/ontology/agent_draft/*`, the MCP tools
|
|
11
|
+
`agent_draft_*` and the warehouse view `ontology.agent_draft`; the agent reports drafts at
|
|
12
|
+
`/api/ontology/agent/drafts`. While an entity declares `renamedFrom`, the warehouse also keeps its
|
|
13
|
+
views under the earlier name.
|
|
14
|
+
|
|
15
|
+
Action required: by 2027-05-22, write `agent_draft:<verb>` for `agent_review:<verb>` in roles
|
|
16
|
+
(`check` warns where they still use it), call `agent_draft_*` tools and
|
|
17
|
+
`/api/ontology/agent_draft/*` routes, pass `draft` for `review` in approve, reject and revise
|
|
18
|
+
inputs and read `draft` from their results, import `AgentDraft` and `AGENT_DRAFT_*` for
|
|
19
|
+
`AgentReview` and `AGENT_REVIEW_*`, and query `ontology.agent_draft` in the warehouse for
|
|
20
|
+
`ontology.agent_review`. Until then the earlier names keep working. Update at once any `where`,
|
|
21
|
+
`include` or record read that names the renamed fields: `provider` on drafts is `channelKind`,
|
|
22
|
+
and the `agentReviews`, `decidedAgentReviews`, `notedAgentReviews` and `reviews` inverses are
|
|
23
|
+
`agentDrafts`, `decidedAgentDrafts`, `notedAgentDrafts` and `drafts`. A trigger's `when` or
|
|
24
|
+
`input` that reads `event.action` sees `agent_draft.hold`, `agent_draft.approve` and so on, and
|
|
25
|
+
reads the draft from `event.input.draft`.
|
|
26
|
+
|
|
27
|
+
## 0.157.0
|
|
28
|
+
|
|
29
|
+
Each channel's message with files is now one sender in the ontology SDK, which the agent's
|
|
30
|
+
`attachments_send` calls and the ontology's own delivery can call too:
|
|
31
|
+
`sendTelegramFiles` (`@segmentstream/ontology/telegram`), `sendSlackFiles` (`/slack`),
|
|
32
|
+
`sendWhatsAppFiles` (`/whatsapp`) and `sendGmailMessage` (`/email`), each over a minimal
|
|
33
|
+
`request(call) → reply` connection transport and reporting per visible part whether the provider's
|
|
34
|
+
answer proves it was sent. Each channel's file limits are declared once next to its sender
|
|
35
|
+
(`telegramFileRefusal`, `slackFileRefusal`, `whatsappFileRefusal`, `EMAIL_FILES_BYTES`,
|
|
36
|
+
`WORKSPACE_CHANNEL_FILES_BYTES`), and the workspace channel contract (`WorkspaceChannelSend`) now
|
|
37
|
+
types the `files` its send route takes.
|
|
38
|
+
|
|
39
|
+
`attachments_send` sends as before. In WhatsApp, a caption that no file can carry, too long or
|
|
40
|
+
ahead of audio, goes on its own first as before; when that message fails, the files still go
|
|
41
|
+
without it and the tool's answer reports the caption's failure as `caption`.
|
|
42
|
+
|
|
3
43
|
## 0.156.1
|
|
4
44
|
|
|
5
45
|
Every reader of a chat in the workspace's chat store now reads only what reached the provider:
|
package/README.md
CHANGED
|
@@ -393,8 +393,9 @@ export default defineOntology({
|
|
|
393
393
|
key and `rel.many` a join table. With a warehouse-backed end, `rel.one` declares one `on`
|
|
394
394
|
pair and is matched by value. `User` is the built-in entity for app users and service
|
|
395
395
|
principals; `AgentChat` (`agent_chat`) is the built-in entity for the group chats of the
|
|
396
|
-
app's agent (see [Agents](#agents)), and `
|
|
397
|
-
|
|
396
|
+
app's agent (see [Agents](#agents)), and `AgentDraft` (`agent_draft`) for the agent's draft
|
|
397
|
+
replies awaiting a member's decision to approve, edit or reject them; until 2027-05-22 the
|
|
398
|
+
earlier name `agent_review` still works, and `check` warns where roles use it. Every ontology includes them. Text feedback defaults on with built-in `AppFeedback`; files follow the non-feedback-blob policy
|
|
398
399
|
(or an explicit opt-in) and add `AppFeedbackFile` (see [App feedback](#app-feedback)).
|
|
399
400
|
- `role(name, { description, permissions })` declares a role: a named set of permissions.
|
|
400
401
|
Every role is the workspace's own, named as it likes; `member` and `feedback_reporter` are
|
|
@@ -433,7 +434,7 @@ export default defineOntology({
|
|
|
433
434
|
role `guest` alone, with `permissions`, which `check` holds to the rules of sign-up roles and
|
|
434
435
|
more: no built-in entity, no scope naming `me`, and of the agent's own tools only
|
|
435
436
|
`agent_tool:web`. The agent acting for a guest (`X-SegmentStream-Act-As: guest:<id>` with the
|
|
436
|
-
grant) reaches `/mcp` alone, without `me`, member files or the chat
|
|
437
|
+
grant) reaches `/mcp` alone, without `me`, member files or the chat store; what a guest creates
|
|
437
438
|
is created by nobody, and `principal.kind` is `guest`. Agent token introspection answers a
|
|
438
439
|
guest's token with `guest_id`, `roles`, `grant_id`, `chat` and `agent_tools`, and counts their
|
|
439
440
|
turns against the agent's `limits.guest`. Origins of `guest` and `signUp` are an origin alone
|
|
@@ -1000,7 +1001,7 @@ configured. This preparation does not advertise or enable exact chat posting.
|
|
|
1000
1001
|
A permission is `<entity>:<verb>`. The verbs are `read`, the generated `create`, `update`,
|
|
1001
1002
|
`delete`, `link` and `unlink`, and the names of authored actions. A role may use `*` for the
|
|
1002
1003
|
entity, the verb or both: `lead:*`, `*:read`, `*:*`. An entity wildcard never covers the
|
|
1003
|
-
built-in `agent_chat`, `
|
|
1004
|
+
built-in `agent_chat`, `agent_draft`, `agent_tool`, `app_feedback`, `app_feedback_file`,
|
|
1004
1005
|
`user_identity` or `workspace_source`: reading or changing them needs a permission that names them,
|
|
1005
1006
|
such as `agent_chat:read` or `agent_chat:*`.
|
|
1006
1007
|
|
|
@@ -1599,10 +1600,10 @@ code names.
|
|
|
1599
1600
|
`chat` names the agent's channels as its `channels` does. A channel not named after its kind,
|
|
1600
1601
|
such as a second number, says its kind: `chat: { sales_whatsapp: { kind: "whatsapp", connection:
|
|
1601
1602
|
waSales } }`. Its chats are keyed by its name (`sales_whatsapp:private:<member UUID>`, and the
|
|
1602
|
-
`provider` of its `agent_chat` records), and posts and
|
|
1603
|
+
`provider` of its `agent_chat` records), and posts and approved drafts there leave through its
|
|
1603
1604
|
connection. A member's account reaches them on every channel of its kind. A channel the workspace
|
|
1604
1605
|
defines in its own code is `chat: { helpdesk: { kind: "custom" } }`, with no connection: its posts
|
|
1605
|
-
and
|
|
1606
|
+
and approved drafts go to the app's agent, which sends them with the channel's code, and its
|
|
1606
1607
|
people's accounts are its own, `channel:helpdesk`, which `signUp.channels` may list.
|
|
1607
1608
|
|
|
1608
1609
|
`chat_list({ query?, chat?, after?, limit? })` returns eligible routing metadata and server-derived
|
|
@@ -1622,7 +1623,7 @@ refused, never truncated or split. Telegram Markdown is rendered independently f
|
|
|
1622
1623
|
attribution; only a definite formatting refusal allows one plain-text retry. Unknown delivery
|
|
1623
1624
|
outcomes are never retried. Telegram replies require the named message to exist.
|
|
1624
1625
|
|
|
1625
|
-
A durable
|
|
1626
|
+
A durable delivery reservation authorizes exactly one provider attempt. Reuse the same key on
|
|
1626
1627
|
replay; changed content/destination conflicts. An uncertain operation is never automatically
|
|
1627
1628
|
resent. The flat MCP receipt is `{ status: "sent" | "uncertain", message_id, url, duplicate,
|
|
1628
1629
|
history_recorded }`; private chats may have no URL. A receipt-write failure leaves
|
package/dist/agent-chat.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
export declare const TELEGRAM = "telegram";
|
|
3
3
|
/**
|
|
4
|
-
* A chat's key: its channel and its id there, `<channel>:<id>`, as the chat
|
|
4
|
+
* A chat's key: its channel and its id there, `<channel>:<id>`, as the chat store and the agent's
|
|
5
5
|
* requests name the chat, such as `telegram:-100123` or `web:guest:<id>`.
|
|
6
6
|
*/
|
|
7
7
|
export declare function agentChatKey(provider: string, externalId: string): string;
|
package/dist/agent-chat.js
CHANGED
|
@@ -7,7 +7,7 @@ import { p } from "./property.js";
|
|
|
7
7
|
import { rel } from "./relationship.js";
|
|
8
8
|
export const TELEGRAM = "telegram";
|
|
9
9
|
/**
|
|
10
|
-
* A chat's key: its channel and its id there, `<channel>:<id>`, as the chat
|
|
10
|
+
* A chat's key: its channel and its id there, `<channel>:<id>`, as the chat store and the agent's
|
|
11
11
|
* requests name the chat, such as `telegram:-100123` or `web:guest:<id>`.
|
|
12
12
|
*/
|
|
13
13
|
export function agentChatKey(provider, externalId) {
|
|
@@ -19,10 +19,10 @@ export const AgentChat = entity("agent_chat", {
|
|
|
19
19
|
label: "Agent chat",
|
|
20
20
|
plural: "Agent chats",
|
|
21
21
|
title: "title",
|
|
22
|
-
description: "A chat of the
|
|
23
|
-
"it and members say what it is for, so that
|
|
24
|
-
"
|
|
25
|
-
"inbox takes the person's
|
|
22
|
+
description: "A chat on one of the agent's channels, including chats the agent only records: a group chat " +
|
|
23
|
+
"it is in, which the agent records when it sees it and members say what it is for, so that " +
|
|
24
|
+
"agents know where to write; or a person's private chat, which the agent records for the " +
|
|
25
|
+
"workspace's staff when the ontology's inbox takes the person or the chat's channel.",
|
|
26
26
|
properties: {
|
|
27
27
|
provider: p.text({ managed: true, description: "The channel, for example telegram." }),
|
|
28
28
|
kind: p.select([
|
|
@@ -41,7 +41,7 @@ export const AgentChat = entity("agent_chat", {
|
|
|
41
41
|
unique: true,
|
|
42
42
|
managed: true,
|
|
43
43
|
description: "The chat's key, `<provider>:<externalId>`, such as `web:guest:<id>` or " +
|
|
44
|
-
"`telegram:-100123`, as the chat
|
|
44
|
+
"`telegram:-100123`, as the chat store names the chat. Analytics events and other " +
|
|
45
45
|
"records tag a chat with it, so a warehouse-backed entity relates to the chat on it.",
|
|
46
46
|
}),
|
|
47
47
|
title: p.text({
|
|
@@ -199,7 +199,7 @@ export const AgentChat = entity("agent_chat", {
|
|
|
199
199
|
}),
|
|
200
200
|
importHistory: action({
|
|
201
201
|
description: "Import a chat's messages from before the agent recorded it, such as a client's earlier " +
|
|
202
|
-
"
|
|
202
|
+
"chat kept elsewhere: each joins the chat in its place by its time, which the " +
|
|
203
203
|
"agent's next session of the chat, the inbox and chat search read as history. Name the chat " +
|
|
204
204
|
"by its agent_chat record, or by channel and chatId as the channel keys it. A message the " +
|
|
205
205
|
"chat already holds, by id, is a duplicate, so importing again adds nothing, and history " +
|
|
@@ -223,7 +223,7 @@ export const AgentChat = entity("agent_chat", {
|
|
|
223
223
|
}),
|
|
224
224
|
send: action({
|
|
225
225
|
description: "Send a message to a chat as the agent, without the sender attribution a post carries: the " +
|
|
226
|
-
"person reads it as the agent's, and the
|
|
226
|
+
"person reads it as the agent's, and the chat store keeps who asked for it. For a workflow or " +
|
|
227
227
|
"a member that writes first, such as a follow-up the workspace decides on. Same chat, text " +
|
|
228
228
|
"and idempotency key as postMessage; text is Markdown each channel renders natively. " +
|
|
229
229
|
"Refused for the agent's own sessions and its tasks: a task's workflow sends what the task " +
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* The agent's draft reply awaiting a staff decision. `agent/segmentstream.json` says, per role of
|
|
4
|
+
* the person the agent replies to, whether a member reviews its replies (`chats.*.review`); the
|
|
5
|
+
* agent records each reply it keeps for review here as a draft, and only the actions below change
|
|
6
|
+
* it. Approving sends the draft, or the member's edit of it, to the person's chat as the agent,
|
|
7
|
+
* without the sender attribution a chat post carries, at most once; rejecting discards it. Reading,
|
|
8
|
+
* approving and rejecting each need a permission that names `agent_draft`: an entity wildcard does
|
|
9
|
+
* not cover it, since its records hold the workspace's chats with the people it serves.
|
|
10
|
+
*/
|
|
11
|
+
export declare const AGENT_DRAFT_STATUSES: readonly [{
|
|
12
|
+
readonly value: "pending";
|
|
13
|
+
readonly description: "Waiting for a member to approve, edit or reject it.";
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: "sent";
|
|
16
|
+
readonly description: "Approved and delivered to the person.";
|
|
17
|
+
}, {
|
|
18
|
+
readonly value: "uncertain";
|
|
19
|
+
readonly description: "Approved; the provider may have delivered it, and it is never sent again.";
|
|
20
|
+
}, {
|
|
21
|
+
readonly value: "failed";
|
|
22
|
+
readonly description: "Approved; the provider refused it, and nothing was sent.";
|
|
23
|
+
}, {
|
|
24
|
+
readonly value: "rejected";
|
|
25
|
+
readonly description: "Rejected: the person never sees it.";
|
|
26
|
+
}, {
|
|
27
|
+
readonly value: "superseded";
|
|
28
|
+
readonly description: "Redrafted at a member's request: the draft that revises it replaces it.";
|
|
29
|
+
}];
|
|
30
|
+
export declare const AGENT_DRAFT_REVISION_STATES: readonly [{
|
|
31
|
+
readonly value: "requested";
|
|
32
|
+
readonly description: "A member asked the agent to redraft it; it is redrafting.";
|
|
33
|
+
}, {
|
|
34
|
+
readonly value: "failed";
|
|
35
|
+
readonly description: "The agent could not redraft it; it still waits as it is.";
|
|
36
|
+
}];
|
|
37
|
+
export declare const AGENT_DRAFT_MODES: readonly [{
|
|
38
|
+
readonly value: "always";
|
|
39
|
+
readonly description: "Every reply in the chat waits for a member.";
|
|
40
|
+
}, {
|
|
41
|
+
readonly value: "whenUnsure";
|
|
42
|
+
readonly description: "The decision model was not sure enough that staff would send it as written.";
|
|
43
|
+
}];
|
|
44
|
+
/** The longest reply a draft holds; a provider may accept less in one message. */
|
|
45
|
+
export declare const AGENT_DRAFT_TEXT_LIMIT = 20000;
|
|
46
|
+
/** The longest reason a member gives for rejecting a reply. */
|
|
47
|
+
export declare const AGENT_DRAFT_REASON_LIMIT = 2000;
|
|
48
|
+
/** The longest note a member gives the agent for redrafting a reply. */
|
|
49
|
+
export declare const AGENT_DRAFT_NOTE_LIMIT = 2000;
|
|
50
|
+
/** The most members a draft names as the readers of its reply, as many as a reply to mail goes to. */
|
|
51
|
+
export declare const AGENT_DRAFT_PARTICIPANTS_LIMIT = 50;
|
|
52
|
+
/** Addresses as a draft keeps them in `to` and `cc`: separated by commas. */
|
|
53
|
+
export declare function draftAddresses(addresses: ReadonlyArray<string>): string;
|
|
54
|
+
/** The addresses a draft keeps in `to` or `cc`; none for an empty value. */
|
|
55
|
+
export declare function addressesOfDraft(value: unknown): ReadonlyArray<string>;
|
|
56
|
+
/** Members as a draft keeps them in `participants`: their user ids, once each, by commas. */
|
|
57
|
+
export declare function draftParticipants(ids: ReadonlyArray<string>): string;
|
|
58
|
+
/** The members a draft keeps in `participants`, once each; anything that is no user id is left out. */
|
|
59
|
+
export declare function participantsOfDraft(value: unknown): ReadonlyArray<string>;
|
|
60
|
+
export declare const AgentDraft: import("./entity.js").Entity<"agent_draft", {
|
|
61
|
+
readonly key: import("./property.js").Property<string, false, true>;
|
|
62
|
+
readonly channelKind: import("./property.js").Property<string, false, false>;
|
|
63
|
+
readonly channel: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
64
|
+
readonly chatId: import("./property.js").Property<string, false, false>;
|
|
65
|
+
readonly recipient: import("./property.js").Property<string, false, false>;
|
|
66
|
+
readonly to: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
67
|
+
readonly cc: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
68
|
+
readonly participants: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
69
|
+
readonly chatKind: import("./property.js").Property<"private" | "group", false, false>;
|
|
70
|
+
readonly threadId: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
71
|
+
readonly replyTo: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
72
|
+
readonly sessionId: import("./property.js").Property<string, false, false>;
|
|
73
|
+
readonly draft: import("./property.js").Property<string, false, false>;
|
|
74
|
+
readonly text: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
75
|
+
readonly status: import("./property.js").Property<"pending" | "sent" | "uncertain" | "failed" | "rejected" | "superseded", false, false>;
|
|
76
|
+
readonly mode: import("./property.js").Property<"always" | "whenUnsure", false, false>;
|
|
77
|
+
readonly confidence: Schema.optionalKey<import("./property.js").Property<number, false, false>>;
|
|
78
|
+
readonly messageId: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
79
|
+
readonly decidedAt: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
80
|
+
readonly reason: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
81
|
+
readonly note: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
82
|
+
readonly revision: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
83
|
+
readonly revisionState: Schema.optionalKey<import("./property.js").Property<"failed" | "requested", false, false>>;
|
|
84
|
+
}, {
|
|
85
|
+
readonly person: import("./relationship.js").OneRelationship<false, false, "user">;
|
|
86
|
+
readonly decidedBy: import("./relationship.js").OneRelationship<true, false, "user">;
|
|
87
|
+
readonly notedBy: import("./relationship.js").OneRelationship<true, false, "user">;
|
|
88
|
+
readonly revises: import("./relationship.js").OneRelationship<true, false, "agent_draft">;
|
|
89
|
+
readonly agentChat: import("./relationship.js").OneRelationship<true, false, "agent_chat">;
|
|
90
|
+
}, import("./entity.js").InvocableActions<{
|
|
91
|
+
readonly approve: import("./action.js").Action<Schema.Struct<{
|
|
92
|
+
readonly draft: Schema.Codec<string, string, never, never>;
|
|
93
|
+
readonly text: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
94
|
+
readonly to: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
95
|
+
readonly cc: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
96
|
+
}>, {
|
|
97
|
+
to?: readonly string[] | undefined;
|
|
98
|
+
cc?: readonly string[] | undefined;
|
|
99
|
+
draft: string;
|
|
100
|
+
review: string;
|
|
101
|
+
status: "sent" | "uncertain" | "failed";
|
|
102
|
+
message_id: string | null;
|
|
103
|
+
duplicate: boolean;
|
|
104
|
+
}>;
|
|
105
|
+
readonly reject: import("./action.js").Action<Schema.Struct<{
|
|
106
|
+
readonly draft: Schema.Codec<string, string, never, never>;
|
|
107
|
+
readonly reason: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
108
|
+
}>, {
|
|
109
|
+
draft: string;
|
|
110
|
+
review: string;
|
|
111
|
+
status: "rejected";
|
|
112
|
+
}>;
|
|
113
|
+
readonly revise: import("./action.js").Action<Schema.Struct<{
|
|
114
|
+
readonly draft: Schema.Codec<string, string, never, never>;
|
|
115
|
+
readonly note: import("./property.js").Property<string, false, false>;
|
|
116
|
+
}>, {
|
|
117
|
+
draft: string;
|
|
118
|
+
review: string;
|
|
119
|
+
revision: string;
|
|
120
|
+
status: "requested";
|
|
121
|
+
}>;
|
|
122
|
+
}, "agent_draft", {
|
|
123
|
+
readonly id: string;
|
|
124
|
+
readonly createdAt: string;
|
|
125
|
+
readonly updatedAt: string;
|
|
126
|
+
readonly createdBy: string | null;
|
|
127
|
+
readonly updatedBy: string | null;
|
|
128
|
+
readonly key: string;
|
|
129
|
+
readonly channelKind: string;
|
|
130
|
+
readonly channel: string | null;
|
|
131
|
+
readonly chatId: string;
|
|
132
|
+
readonly recipient: string;
|
|
133
|
+
readonly to: string | null;
|
|
134
|
+
readonly cc: string | null;
|
|
135
|
+
readonly participants: string | null;
|
|
136
|
+
readonly chatKind: "private" | "group";
|
|
137
|
+
readonly threadId: string | null;
|
|
138
|
+
readonly replyTo: string | null;
|
|
139
|
+
readonly sessionId: string;
|
|
140
|
+
readonly draft: string;
|
|
141
|
+
readonly text: string | null;
|
|
142
|
+
readonly status: "pending" | "sent" | "uncertain" | "failed" | "rejected" | "superseded";
|
|
143
|
+
readonly mode: "always" | "whenUnsure";
|
|
144
|
+
readonly confidence: number | null;
|
|
145
|
+
readonly messageId: string | null;
|
|
146
|
+
readonly decidedAt: string | null;
|
|
147
|
+
readonly reason: string | null;
|
|
148
|
+
readonly note: string | null;
|
|
149
|
+
readonly revision: string | null;
|
|
150
|
+
readonly revisionState: "failed" | "requested" | null;
|
|
151
|
+
readonly personId: string;
|
|
152
|
+
readonly decidedById: string | null;
|
|
153
|
+
readonly notedById: string | null;
|
|
154
|
+
readonly revisesId: string | null;
|
|
155
|
+
readonly agentChatId: string | null;
|
|
156
|
+
}>, Readonly<Record<never, never>>, "actions">;
|
|
157
|
+
export type AgentDraft = typeof AgentDraft.Type;
|
|
158
|
+
/** @deprecated Use {@link AgentDraft}: `agent_review` is the entity's earlier name. */
|
|
159
|
+
export declare const AgentReview: import("./entity.js").Entity<"agent_draft", {
|
|
160
|
+
readonly key: import("./property.js").Property<string, false, true>;
|
|
161
|
+
readonly channelKind: import("./property.js").Property<string, false, false>;
|
|
162
|
+
readonly channel: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
163
|
+
readonly chatId: import("./property.js").Property<string, false, false>;
|
|
164
|
+
readonly recipient: import("./property.js").Property<string, false, false>;
|
|
165
|
+
readonly to: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
166
|
+
readonly cc: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
167
|
+
readonly participants: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
168
|
+
readonly chatKind: import("./property.js").Property<"private" | "group", false, false>;
|
|
169
|
+
readonly threadId: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
170
|
+
readonly replyTo: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
171
|
+
readonly sessionId: import("./property.js").Property<string, false, false>;
|
|
172
|
+
readonly draft: import("./property.js").Property<string, false, false>;
|
|
173
|
+
readonly text: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
174
|
+
readonly status: import("./property.js").Property<"pending" | "sent" | "uncertain" | "failed" | "rejected" | "superseded", false, false>;
|
|
175
|
+
readonly mode: import("./property.js").Property<"always" | "whenUnsure", false, false>;
|
|
176
|
+
readonly confidence: Schema.optionalKey<import("./property.js").Property<number, false, false>>;
|
|
177
|
+
readonly messageId: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
178
|
+
readonly decidedAt: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
179
|
+
readonly reason: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
180
|
+
readonly note: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
181
|
+
readonly revision: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
182
|
+
readonly revisionState: Schema.optionalKey<import("./property.js").Property<"failed" | "requested", false, false>>;
|
|
183
|
+
}, {
|
|
184
|
+
readonly person: import("./relationship.js").OneRelationship<false, false, "user">;
|
|
185
|
+
readonly decidedBy: import("./relationship.js").OneRelationship<true, false, "user">;
|
|
186
|
+
readonly notedBy: import("./relationship.js").OneRelationship<true, false, "user">;
|
|
187
|
+
readonly revises: import("./relationship.js").OneRelationship<true, false, "agent_draft">;
|
|
188
|
+
readonly agentChat: import("./relationship.js").OneRelationship<true, false, "agent_chat">;
|
|
189
|
+
}, import("./entity.js").InvocableActions<{
|
|
190
|
+
readonly approve: import("./action.js").Action<Schema.Struct<{
|
|
191
|
+
readonly draft: Schema.Codec<string, string, never, never>;
|
|
192
|
+
readonly text: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
193
|
+
readonly to: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
194
|
+
readonly cc: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
195
|
+
}>, {
|
|
196
|
+
to?: readonly string[] | undefined;
|
|
197
|
+
cc?: readonly string[] | undefined;
|
|
198
|
+
draft: string;
|
|
199
|
+
review: string;
|
|
200
|
+
status: "sent" | "uncertain" | "failed";
|
|
201
|
+
message_id: string | null;
|
|
202
|
+
duplicate: boolean;
|
|
203
|
+
}>;
|
|
204
|
+
readonly reject: import("./action.js").Action<Schema.Struct<{
|
|
205
|
+
readonly draft: Schema.Codec<string, string, never, never>;
|
|
206
|
+
readonly reason: Schema.optionalKey<import("./property.js").Property<string, false, false>>;
|
|
207
|
+
}>, {
|
|
208
|
+
draft: string;
|
|
209
|
+
review: string;
|
|
210
|
+
status: "rejected";
|
|
211
|
+
}>;
|
|
212
|
+
readonly revise: import("./action.js").Action<Schema.Struct<{
|
|
213
|
+
readonly draft: Schema.Codec<string, string, never, never>;
|
|
214
|
+
readonly note: import("./property.js").Property<string, false, false>;
|
|
215
|
+
}>, {
|
|
216
|
+
draft: string;
|
|
217
|
+
review: string;
|
|
218
|
+
revision: string;
|
|
219
|
+
status: "requested";
|
|
220
|
+
}>;
|
|
221
|
+
}, "agent_draft", {
|
|
222
|
+
readonly id: string;
|
|
223
|
+
readonly createdAt: string;
|
|
224
|
+
readonly updatedAt: string;
|
|
225
|
+
readonly createdBy: string | null;
|
|
226
|
+
readonly updatedBy: string | null;
|
|
227
|
+
readonly key: string;
|
|
228
|
+
readonly channelKind: string;
|
|
229
|
+
readonly channel: string | null;
|
|
230
|
+
readonly chatId: string;
|
|
231
|
+
readonly recipient: string;
|
|
232
|
+
readonly to: string | null;
|
|
233
|
+
readonly cc: string | null;
|
|
234
|
+
readonly participants: string | null;
|
|
235
|
+
readonly chatKind: "private" | "group";
|
|
236
|
+
readonly threadId: string | null;
|
|
237
|
+
readonly replyTo: string | null;
|
|
238
|
+
readonly sessionId: string;
|
|
239
|
+
readonly draft: string;
|
|
240
|
+
readonly text: string | null;
|
|
241
|
+
readonly status: "pending" | "sent" | "uncertain" | "failed" | "rejected" | "superseded";
|
|
242
|
+
readonly mode: "always" | "whenUnsure";
|
|
243
|
+
readonly confidence: number | null;
|
|
244
|
+
readonly messageId: string | null;
|
|
245
|
+
readonly decidedAt: string | null;
|
|
246
|
+
readonly reason: string | null;
|
|
247
|
+
readonly note: string | null;
|
|
248
|
+
readonly revision: string | null;
|
|
249
|
+
readonly revisionState: "failed" | "requested" | null;
|
|
250
|
+
readonly personId: string;
|
|
251
|
+
readonly decidedById: string | null;
|
|
252
|
+
readonly notedById: string | null;
|
|
253
|
+
readonly revisesId: string | null;
|
|
254
|
+
readonly agentChatId: string | null;
|
|
255
|
+
}>, Readonly<Record<never, never>>, "actions">;
|
|
256
|
+
/** @deprecated Use {@link AgentDraft}. */
|
|
257
|
+
export type AgentReview = AgentDraft;
|
|
258
|
+
/** @deprecated Use {@link AGENT_DRAFT_STATUSES}. */
|
|
259
|
+
export declare const AGENT_REVIEW_STATUSES: readonly [{
|
|
260
|
+
readonly value: "pending";
|
|
261
|
+
readonly description: "Waiting for a member to approve, edit or reject it.";
|
|
262
|
+
}, {
|
|
263
|
+
readonly value: "sent";
|
|
264
|
+
readonly description: "Approved and delivered to the person.";
|
|
265
|
+
}, {
|
|
266
|
+
readonly value: "uncertain";
|
|
267
|
+
readonly description: "Approved; the provider may have delivered it, and it is never sent again.";
|
|
268
|
+
}, {
|
|
269
|
+
readonly value: "failed";
|
|
270
|
+
readonly description: "Approved; the provider refused it, and nothing was sent.";
|
|
271
|
+
}, {
|
|
272
|
+
readonly value: "rejected";
|
|
273
|
+
readonly description: "Rejected: the person never sees it.";
|
|
274
|
+
}, {
|
|
275
|
+
readonly value: "superseded";
|
|
276
|
+
readonly description: "Redrafted at a member's request: the draft that revises it replaces it.";
|
|
277
|
+
}];
|
|
278
|
+
/** @deprecated Use {@link AGENT_DRAFT_MODES}. */
|
|
279
|
+
export declare const AGENT_REVIEW_MODES: readonly [{
|
|
280
|
+
readonly value: "always";
|
|
281
|
+
readonly description: "Every reply in the chat waits for a member.";
|
|
282
|
+
}, {
|
|
283
|
+
readonly value: "whenUnsure";
|
|
284
|
+
readonly description: "The decision model was not sure enough that staff would send it as written.";
|
|
285
|
+
}];
|
|
286
|
+
/** @deprecated Use {@link AGENT_DRAFT_TEXT_LIMIT}. */
|
|
287
|
+
export declare const AGENT_REVIEW_TEXT_LIMIT = 20000;
|