@segmentstream/ontology 0.107.0 → 0.109.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 +30 -0
- package/README.md +7 -3
- package/dist/analyze.js +34 -3
- package/dist/email.d.ts +18 -2
- package/dist/email.js +57 -7
- package/dist/emails.d.ts +36 -5
- package/dist/emails.js +139 -2
- package/dist/index.d.ts +1 -1
- package/dist/manifest.d.ts +193 -0
- package/dist/manifest.js +22 -0
- package/dist/migrate/model.d.ts +122 -0
- package/dist/service/agent/authentication.js +5 -1
- package/dist/service/chat/providers/email.d.ts +3 -1
- package/dist/service/chat/providers/email.js +8 -1
- package/dist/service/schemas.d.ts +32 -0
- package/dist/sign-in.d.ts +8 -0
- package/package.json +1 -1
|
@@ -9,7 +9,11 @@ export const CHAT_HEADER = "x-segmentstream-agent-chat";
|
|
|
9
9
|
export const SESSION_HEADER = "x-segmentstream-agent-session";
|
|
10
10
|
/** @legacy agent.conversation-header The chat's header from agents built before it took the name. */
|
|
11
11
|
const EARLIER_CHAT_HEADER = "x-segmentstream-agent-conversation";
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* `provider:chat id`. An email chat is a Gmail thread and the person's address
|
|
14
|
+
* (`email:<thread>:<address>`), so an id may hold an address's `@`, `.` and `+`.
|
|
15
|
+
*/
|
|
16
|
+
const CHAT = /^[a-z][a-z0-9_-]{0,31}:[A-Za-z0-9:_.@+-]{1,320}$/;
|
|
13
17
|
const SESSION = /^[A-Za-z0-9:_.-]{1,200}$/;
|
|
14
18
|
/** Authenticate the runtime and resolve its member; attachment storage also checks chat access. */
|
|
15
19
|
export function authenticateAgentCaller(input) {
|
|
@@ -5,7 +5,9 @@ import { type ChatProvider, type ChatSend, type ProviderOutcome } from "./provid
|
|
|
5
5
|
* reads the thread's subject and its last message first, so the reply carries `Re:`, `In-Reply-To`
|
|
6
6
|
* and `References` and the person's mail program shows it in the same conversation; then
|
|
7
7
|
* `POST /users/me/messages/send` with the thread id, never retried. A reply sends no attribution
|
|
8
|
-
* and names no sender, so it leaves from the mailbox's own address.
|
|
8
|
+
* and names no sender, so it leaves from the mailbox's own address. It carries
|
|
9
|
+
* `Auto-Submitted: auto-replied` and `X-SegmentStream-Reply: review-<review id>`, as the email
|
|
10
|
+
* channel's replies carry their own keys. `sent` means Gmail accepted it.
|
|
9
11
|
*/
|
|
10
12
|
export declare function sendEmail(input: ChatSend): Effect.Effect<ProviderOutcome>;
|
|
11
13
|
/**
|
|
@@ -30,7 +30,9 @@ function headersOf(message) {
|
|
|
30
30
|
* reads the thread's subject and its last message first, so the reply carries `Re:`, `In-Reply-To`
|
|
31
31
|
* and `References` and the person's mail program shows it in the same conversation; then
|
|
32
32
|
* `POST /users/me/messages/send` with the thread id, never retried. A reply sends no attribution
|
|
33
|
-
* and names no sender, so it leaves from the mailbox's own address.
|
|
33
|
+
* and names no sender, so it leaves from the mailbox's own address. It carries
|
|
34
|
+
* `Auto-Submitted: auto-replied` and `X-SegmentStream-Reply: review-<review id>`, as the email
|
|
35
|
+
* channel's replies carry their own keys. `sent` means Gmail accepted it.
|
|
34
36
|
*/
|
|
35
37
|
export function sendEmail(input) {
|
|
36
38
|
return Effect.gen(function* () {
|
|
@@ -67,6 +69,9 @@ export function sendEmail(input) {
|
|
|
67
69
|
const list = Array.isArray(messages) ? messages : [];
|
|
68
70
|
const first = headersOf(list[0]);
|
|
69
71
|
const last = headersOf(list.at(-1));
|
|
72
|
+
// The agent's reply, as the email channel sends its own: marked as a program's, so no
|
|
73
|
+
// autoresponder answers it, and named by its review, so the channel knows it for the agent's.
|
|
74
|
+
const key = `review-${input.destination.id}`;
|
|
70
75
|
const raw = emailReplyMessage({
|
|
71
76
|
to: input.destination.external_id,
|
|
72
77
|
subject: first.get("subject") ?? null,
|
|
@@ -74,6 +79,8 @@ export function sendEmail(input) {
|
|
|
74
79
|
references: last.get("references") ?? null,
|
|
75
80
|
text: input.plainText,
|
|
76
81
|
html: input.finalText,
|
|
82
|
+
autoSubmitted: true,
|
|
83
|
+
...(/^[A-Za-z0-9_-]{1,128}$/.test(key) ? { replyKey: key } : {}),
|
|
77
84
|
});
|
|
78
85
|
const payload = { threadId, html: input.finalText, text: input.plainText };
|
|
79
86
|
const result = yield* input.transport
|
|
@@ -432,11 +432,13 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
|
|
|
432
432
|
readonly channels: Schema.$Array<Schema.String>;
|
|
433
433
|
readonly origins: Schema.$Array<Schema.String>;
|
|
434
434
|
}>>;
|
|
435
|
+
readonly invitationEmail: Schema.optionalKey<Schema.String>;
|
|
435
436
|
}>, {
|
|
436
437
|
readonly onNewUser: "on_new_user";
|
|
437
438
|
readonly codeLink: "code_link";
|
|
438
439
|
readonly signUp: "sign_up";
|
|
439
440
|
readonly onSignUp: "on_sign_up";
|
|
441
|
+
readonly invitationEmail: "invitation_email";
|
|
440
442
|
}>>;
|
|
441
443
|
readonly emails: Schema.optionalKey<Schema.$Record<Schema.String, Schema.encodeKeys<Schema.Struct<{
|
|
442
444
|
readonly subject: Schema.String;
|
|
@@ -449,6 +451,20 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
|
|
|
449
451
|
readonly note: Schema.optionalKey<Schema.String>;
|
|
450
452
|
readonly paragraphs: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
451
453
|
readonly action: Schema.String;
|
|
454
|
+
readonly sections: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
455
|
+
readonly title: Schema.String;
|
|
456
|
+
readonly text: Schema.optionalKey<Schema.String>;
|
|
457
|
+
readonly copy: Schema.optionalKey<Schema.Struct<{
|
|
458
|
+
readonly label: Schema.optionalKey<Schema.String>;
|
|
459
|
+
readonly value: Schema.String;
|
|
460
|
+
}>>;
|
|
461
|
+
readonly items: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
462
|
+
readonly label: Schema.String;
|
|
463
|
+
readonly text: Schema.optionalKey<Schema.String>;
|
|
464
|
+
readonly code: Schema.optionalKey<Schema.String>;
|
|
465
|
+
}>>>;
|
|
466
|
+
readonly note: Schema.optionalKey<Schema.String>;
|
|
467
|
+
}>>>;
|
|
452
468
|
readonly footer: Schema.optionalKey<Schema.String>;
|
|
453
469
|
readonly replyTo: Schema.optionalKey<Schema.String>;
|
|
454
470
|
}>, {
|
|
@@ -712,11 +728,13 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
|
|
|
712
728
|
readonly channels: Schema.$Array<Schema.String>;
|
|
713
729
|
readonly origins: Schema.$Array<Schema.String>;
|
|
714
730
|
}>>;
|
|
731
|
+
readonly invitationEmail: Schema.optionalKey<Schema.String>;
|
|
715
732
|
}>, {
|
|
716
733
|
readonly onNewUser: "on_new_user";
|
|
717
734
|
readonly codeLink: "code_link";
|
|
718
735
|
readonly signUp: "sign_up";
|
|
719
736
|
readonly onSignUp: "on_sign_up";
|
|
737
|
+
readonly invitationEmail: "invitation_email";
|
|
720
738
|
}>>>;
|
|
721
739
|
readonly emails: Schema.toEncoded<Schema.optionalKey<Schema.$Record<Schema.String, Schema.encodeKeys<Schema.Struct<{
|
|
722
740
|
readonly subject: Schema.String;
|
|
@@ -729,6 +747,20 @@ export declare const Catalog: Schema.decodeTo<Schema.Struct<{
|
|
|
729
747
|
readonly note: Schema.optionalKey<Schema.String>;
|
|
730
748
|
readonly paragraphs: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
731
749
|
readonly action: Schema.String;
|
|
750
|
+
readonly sections: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
751
|
+
readonly title: Schema.String;
|
|
752
|
+
readonly text: Schema.optionalKey<Schema.String>;
|
|
753
|
+
readonly copy: Schema.optionalKey<Schema.Struct<{
|
|
754
|
+
readonly label: Schema.optionalKey<Schema.String>;
|
|
755
|
+
readonly value: Schema.String;
|
|
756
|
+
}>>;
|
|
757
|
+
readonly items: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
758
|
+
readonly label: Schema.String;
|
|
759
|
+
readonly text: Schema.optionalKey<Schema.String>;
|
|
760
|
+
readonly code: Schema.optionalKey<Schema.String>;
|
|
761
|
+
}>>>;
|
|
762
|
+
readonly note: Schema.optionalKey<Schema.String>;
|
|
763
|
+
}>>>;
|
|
732
764
|
readonly footer: Schema.optionalKey<Schema.String>;
|
|
733
765
|
readonly replyTo: Schema.optionalKey<Schema.String>;
|
|
734
766
|
}>, {
|
package/dist/sign-in.d.ts
CHANGED
|
@@ -111,6 +111,14 @@ export interface SignInOptions {
|
|
|
111
111
|
* person to confirm. The link signs in whichever browser opens it.
|
|
112
112
|
*/
|
|
113
113
|
readonly codeLink?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* One of the ontology's `emails`, by its camelCase name, that the platform sends instead of its
|
|
116
|
+
* own invitation: when a member is invited from the CLI or the console, and when
|
|
117
|
+
* `User.sendSignInLink` names no template for a member who has not signed in yet. It may use only
|
|
118
|
+
* the built-in values, such as `{{app.mcpUrl}}`, since nothing fills others. The platform's own
|
|
119
|
+
* invitation when omitted. A checked ontology holds the email's wire name.
|
|
120
|
+
*/
|
|
121
|
+
readonly invitationEmail?: string;
|
|
114
122
|
}
|
|
115
123
|
/** The sign-in options of a checked ontology, with the sign-up its definition declares. */
|
|
116
124
|
export interface ResolvedSignInOptions extends SignInOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/ontology",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.109.0",
|
|
4
4
|
"description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SegmentStream",
|