@jini-ai/platform 0.7.3-next.2 → 0.7.4
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 +7 -0
- package/README.md +13 -0
- package/dist/download-lock.d.ts +3 -1
- package/dist/download-lock.js +4 -6
- package/dist/download-maintenance.js +6 -6
- package/dist/download-state.js +17 -14
- package/dist/download-store.d.ts +34 -10
- package/dist/download-store.js +24 -20
- package/dist/download-target.d.ts +6 -2
- package/dist/download-target.js +7 -7
- package/dist/download-transfer.js +18 -12
- package/dist/download.js +4 -4
- package/dist/fetch-with-timeout.d.ts +0 -53
- package/dist/fetch-with-timeout.js +62 -13
- package/dist/fs/directory-running-lock.d.ts +4 -0
- package/dist/fs/directory-running-lock.js +8 -1
- package/dist/fs/directory-workspace.d.ts +2 -1
- package/dist/fs/directory-workspace.js +2 -2
- package/dist/fs/durable-json.d.ts +3 -16
- package/dist/fs/durable-json.js +4 -2
- package/dist/fs/guarded-reader.d.ts +10 -0
- package/dist/fs/guarded-reader.js +34 -1
- package/dist/fs/index.d.ts +4 -0
- package/dist/fs/index.js +4 -0
- package/dist/fs/leased-directory-move.d.ts +49 -0
- package/dist/fs/leased-directory-move.js +31 -0
- package/dist/fs/owned-temp-root.d.ts +74 -0
- package/dist/fs/owned-temp-root.js +203 -0
- package/dist/fs/recent-directories.d.ts +2 -1
- package/dist/fs/resolve-directory-target.d.ts +33 -0
- package/dist/fs/resolve-directory-target.js +58 -0
- package/dist/fs/staged-file.d.ts +40 -0
- package/dist/fs/staged-file.js +75 -0
- package/dist/fs/strict-containment.d.ts +14 -0
- package/dist/fs/strict-containment.js +14 -0
- package/dist/image/png-encode.d.ts +41 -0
- package/dist/image/png-encode.js +96 -0
- package/dist/index.d.ts +3 -1
- package/dist/mail/email-template-agent-tools.d.ts +150 -0
- package/dist/mail/email-template-agent-tools.js +86 -0
- package/dist/mail/email-template-tool-registrations.d.ts +73 -0
- package/dist/mail/email-template-tool-registrations.js +66 -0
- package/dist/mail/email-template.js +3 -7
- package/dist/mail/feedback-route.d.ts +50 -0
- package/dist/mail/feedback-route.js +46 -0
- package/dist/mail/feedback-setup.d.ts +44 -0
- package/dist/mail/feedback-setup.js +53 -0
- package/dist/mail/feedback-sources.d.ts +67 -0
- package/dist/mail/feedback-sources.js +42 -0
- package/dist/mail/index.d.ts +10 -1
- package/dist/mail/index.js +4 -0
- package/dist/mail/mail-status.d.ts +32 -0
- package/dist/mail/mail-status.js +2 -0
- package/dist/mail/positional-purpose-gate.d.ts +14 -0
- package/dist/mail/positional-purpose-gate.js +18 -0
- package/dist/mail/purpose-gate-probe.d.ts +18 -0
- package/dist/mail/purpose-gate-probe.js +22 -0
- package/dist/mail/purpose-scoped-mailer.d.ts +4 -0
- package/dist/mail/purpose-scoped-mailer.js +4 -3
- package/dist/mail/resolve-mailer.d.ts +13 -1
- package/dist/mail/resolve-mailer.js +11 -5
- package/dist/mail/sql/activity.repo.d.ts +20 -0
- package/dist/mail/sql/activity.repo.js +133 -0
- package/dist/mail/sql/attempts.repo.d.ts +17 -0
- package/dist/mail/sql/attempts.repo.js +32 -0
- package/dist/mail/sql/capture.repo.d.ts +69 -0
- package/dist/mail/sql/capture.repo.js +119 -0
- package/dist/mail/sql/feedback-inbox.repo.d.ts +12 -0
- package/dist/mail/sql/feedback-inbox.repo.js +32 -0
- package/dist/mail/sql/index.d.ts +12 -0
- package/dist/mail/sql/index.js +12 -0
- package/dist/mail/sql/ledger.repo.d.ts +29 -0
- package/dist/mail/sql/ledger.repo.js +57 -0
- package/dist/mail/sql/retention.d.ts +23 -0
- package/dist/mail/sql/retention.js +53 -0
- package/dist/mail/sql/site-feedback-route.d.ts +18 -0
- package/dist/mail/sql/site-feedback-route.js +22 -0
- package/dist/mail/sql/suppression-admin.repo.d.ts +11 -0
- package/dist/mail/sql/suppression-admin.repo.js +76 -0
- package/dist/mail/sql/suppression.repo.d.ts +10 -0
- package/dist/mail/sql/suppression.repo.js +33 -0
- package/dist/mail/test-send.d.ts +147 -0
- package/dist/mail/test-send.js +198 -0
- package/dist/mail/use-readiness.d.ts +104 -0
- package/dist/mail/use-readiness.js +140 -0
- package/dist/object-store/local-fs.js +34 -1
- package/dist/object-store/site/artifact-provider.d.ts +65 -0
- package/dist/object-store/site/artifact-provider.js +37 -0
- package/dist/object-store/site/registry.d.ts +110 -0
- package/dist/object-store/site/registry.js +93 -0
- package/dist/object-store/site/setting.d.ts +34 -0
- package/dist/object-store/site/setting.js +32 -0
- package/dist/process-probes.d.ts +11 -4
- package/dist/process-probes.js +3 -3
- package/dist/process-top-footprint.d.ts +1 -1
- package/dist/process-top-footprint.js +1 -3
- package/dist/process.d.ts +3 -17
- package/dist/process.js +3 -2
- package/dist/retention/index.d.ts +6 -0
- package/dist/retention/index.js +6 -0
- package/dist/retention/measure-tree.d.ts +68 -0
- package/dist/retention/measure-tree.js +205 -0
- package/dist/retention/preview-store.d.ts +12 -0
- package/dist/retention/preview-store.js +28 -0
- package/dist/retention/routes.d.ts +23 -0
- package/dist/retention/routes.js +24 -0
- package/dist/retention/runner.d.ts +103 -0
- package/dist/retention/runner.js +164 -0
- package/dist/secrets/credential-sets/index.d.ts +1 -0
- package/dist/secrets/credential-sets/index.js +1 -0
- package/dist/secrets/credential-sets/store-vault-guards.d.ts +26 -0
- package/dist/secrets/credential-sets/store-vault-guards.js +30 -0
- package/dist/secrets/credential-sets/vault.service.d.ts +1 -1
- package/dist/secrets/index.d.ts +1 -1
- package/dist/secrets/index.js +1 -1
- package/dist/secrets/keyring.env.d.ts +1 -1
- package/dist/secrets/keyring.env.js +3 -5
- package/dist/secrets/keyring.memory.d.ts +4 -1
- package/dist/secrets/keyring.memory.js +4 -1
- package/dist/secrets/legacy-codecs.d.ts +381 -0
- package/dist/secrets/legacy-codecs.js +468 -0
- package/dist/secrets/legacy-owner.d.ts +3 -11
- package/dist/secrets/root-key/ensure.d.ts +154 -0
- package/dist/secrets/root-key/ensure.js +328 -0
- package/dist/secrets/root-key/files.d.ts +104 -0
- package/dist/secrets/root-key/files.js +166 -0
- package/dist/secrets/root-key/material.d.ts +132 -0
- package/dist/secrets/root-key/material.js +116 -0
- package/dist/secrets/root-key/ordered-keyring.d.ts +157 -0
- package/dist/secrets/root-key/ordered-keyring.js +104 -0
- package/dist/secrets/root-key/reconcile.d.ts +50 -0
- package/dist/secrets/root-key/reconcile.js +147 -0
- package/dist/secrets/root-key/site-keyring-errors.d.ts +78 -0
- package/dist/secrets/root-key/site-keyring-errors.js +37 -0
- package/dist/secrets/root-key/sources.d.ts +79 -0
- package/dist/secrets/root-key/sources.js +119 -0
- package/dist/secrets/secret-sealer.aesgcm.d.ts +50 -2
- package/dist/secrets/secret-sealer.aesgcm.js +107 -19
- package/dist/web/tool-registrations.d.ts +67 -0
- package/dist/web/tool-registrations.js +44 -0
- package/package.json +138 -6
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Email-template tools. Same permissions as the Pages HTML tools they mirror: reading is
|
|
3
|
+
* `content.read`, writing raw HTML is `pages.edit_html` (a template is raw HTML on Pages storage).
|
|
4
|
+
*/
|
|
5
|
+
/** The host's names the email-template catalog text and authorization carry. */
|
|
6
|
+
export interface EmailTemplatesHostCopy {
|
|
7
|
+
/** The host permission that writes raw HTML (its Pages HTML edit permission), named in the write tools' text and authorization. */
|
|
8
|
+
readonly editHtmlPermission: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The email-template tool catalog, bound once by the host with its {@link EmailTemplatesHostCopy};
|
|
12
|
+
* bound with the host's own permission name, the model-facing text is the host's original catalog text.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createEmailTemplatesAgentToolCatalog({ copy }: {
|
|
15
|
+
copy: EmailTemplatesHostCopy;
|
|
16
|
+
}, _optional?: Record<string, never>): ({
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
sideEffects: "none";
|
|
20
|
+
authorization: {
|
|
21
|
+
permission: string;
|
|
22
|
+
};
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: string;
|
|
25
|
+
additionalProperties: boolean;
|
|
26
|
+
properties: {
|
|
27
|
+
limit: {
|
|
28
|
+
type: string;
|
|
29
|
+
minimum: number;
|
|
30
|
+
maximum: number;
|
|
31
|
+
clamp: boolean;
|
|
32
|
+
};
|
|
33
|
+
cursor: {
|
|
34
|
+
type: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
} | {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
sideEffects: "none";
|
|
42
|
+
authorization: {
|
|
43
|
+
permission: string;
|
|
44
|
+
};
|
|
45
|
+
inputSchema: {
|
|
46
|
+
type: string;
|
|
47
|
+
additionalProperties: boolean;
|
|
48
|
+
required: string[];
|
|
49
|
+
properties: {
|
|
50
|
+
id: {
|
|
51
|
+
type: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
} | {
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
sideEffects: "none";
|
|
59
|
+
authorization: {
|
|
60
|
+
permission: string;
|
|
61
|
+
};
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: string;
|
|
64
|
+
additionalProperties: boolean;
|
|
65
|
+
properties: {
|
|
66
|
+
id: {
|
|
67
|
+
type: string;
|
|
68
|
+
};
|
|
69
|
+
html: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
values: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
additionalProperties: {
|
|
76
|
+
type: string[];
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
mode: {
|
|
80
|
+
type: string;
|
|
81
|
+
enum: string[];
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
} | {
|
|
86
|
+
name: string;
|
|
87
|
+
description: string;
|
|
88
|
+
sideEffects: "mutates-durable-state";
|
|
89
|
+
authorization: {
|
|
90
|
+
permission: string;
|
|
91
|
+
};
|
|
92
|
+
inputSchema: {
|
|
93
|
+
type: string;
|
|
94
|
+
additionalProperties: boolean;
|
|
95
|
+
required: string[];
|
|
96
|
+
properties: {
|
|
97
|
+
name: {
|
|
98
|
+
type: string;
|
|
99
|
+
maxLength: number;
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
html: {
|
|
103
|
+
type: string;
|
|
104
|
+
description: string;
|
|
105
|
+
};
|
|
106
|
+
subject: {
|
|
107
|
+
type: string;
|
|
108
|
+
description: string;
|
|
109
|
+
};
|
|
110
|
+
fields: {
|
|
111
|
+
type: string;
|
|
112
|
+
items: {
|
|
113
|
+
type: string;
|
|
114
|
+
};
|
|
115
|
+
description: string;
|
|
116
|
+
};
|
|
117
|
+
id?: never;
|
|
118
|
+
expectedVersion?: never;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
} | {
|
|
122
|
+
name: string;
|
|
123
|
+
description: string;
|
|
124
|
+
sideEffects: "mutates-durable-state";
|
|
125
|
+
authorization: {
|
|
126
|
+
permission: string;
|
|
127
|
+
};
|
|
128
|
+
inputSchema: {
|
|
129
|
+
type: string;
|
|
130
|
+
additionalProperties: boolean;
|
|
131
|
+
required: string[];
|
|
132
|
+
properties: {
|
|
133
|
+
id: {
|
|
134
|
+
type: string;
|
|
135
|
+
};
|
|
136
|
+
html: {
|
|
137
|
+
type: string;
|
|
138
|
+
description?: never;
|
|
139
|
+
};
|
|
140
|
+
expectedVersion: {
|
|
141
|
+
type: string;
|
|
142
|
+
minimum: number;
|
|
143
|
+
};
|
|
144
|
+
name?: never;
|
|
145
|
+
subject?: never;
|
|
146
|
+
fields?: never;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
})[];
|
|
150
|
+
//# sourceMappingURL=email-template-agent-tools.d.ts.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Email-template tools. Same permissions as the Pages HTML tools they mirror: reading is
|
|
3
|
+
* `content.read`, writing raw HTML is `pages.edit_html` (a template is raw HTML on Pages storage).
|
|
4
|
+
*/
|
|
5
|
+
const FIELD_CONTRACT = "A template is a full HTML email document. Its <title> is the subject (it may use fields). Fill-in fields are " +
|
|
6
|
+
"written {{name}} anywhere in the HTML or the subject and declared in the head as " +
|
|
7
|
+
'<meta name="email-fields" content="name=Ada, orderId">, each name optionally =sample (the value previews use). ' +
|
|
8
|
+
"Values are HTML-escaped; a field with no value renders empty and is listed in missingFields. " +
|
|
9
|
+
"Use table layout and inline styles: mail clients ignore most CSS and all script. Scripts run only in the admin " +
|
|
10
|
+
"preview; sent emails are static HTML with <script>, on* handlers, javascript: URLs, <iframe>/<object>/<embed> " +
|
|
11
|
+
"and comments removed.";
|
|
12
|
+
const VALUES_SCHEMA = {
|
|
13
|
+
type: "object",
|
|
14
|
+
description: "Field values by name, e.g. {\"name\":\"Ada\"}.",
|
|
15
|
+
additionalProperties: { type: ["string", "number", "boolean"] },
|
|
16
|
+
};
|
|
17
|
+
/** The read-only list tool: no host wording, so it is a static declaration. */
|
|
18
|
+
const EMAIL_TEMPLATE_LIST_TOOL = {
|
|
19
|
+
name: "email_template_list",
|
|
20
|
+
description: "Lists this site's HTML email templates. Returns {templates:[{id,name,subject,fields,version,updatedAt}]}. Requires content.read.",
|
|
21
|
+
sideEffects: "none",
|
|
22
|
+
authorization: { permission: "content.read" },
|
|
23
|
+
inputSchema: { type: "object", additionalProperties: false, properties: { limit: { type: "integer", minimum: 1, maximum: 100, clamp: true }, cursor: { type: "string" } } },
|
|
24
|
+
};
|
|
25
|
+
/** The read-only get tool: carries the field contract, which is static text. */
|
|
26
|
+
const EMAIL_TEMPLATE_GET_TOOL = {
|
|
27
|
+
name: "email_template_get",
|
|
28
|
+
description: `Reads one email template: {id,name,subject,fields,version,updatedAt,html,undeclaredFields}. Pass version back as expectedVersion when editing. ${FIELD_CONTRACT} Requires content.read.`,
|
|
29
|
+
sideEffects: "none",
|
|
30
|
+
authorization: { permission: "content.read" },
|
|
31
|
+
inputSchema: { type: "object", additionalProperties: false, required: ["id"], properties: { id: { type: "string" } } },
|
|
32
|
+
};
|
|
33
|
+
/** The read-only preview tool: renders and sends nothing. */
|
|
34
|
+
const EMAIL_TEMPLATE_PREVIEW_TOOL = {
|
|
35
|
+
name: "email_template_preview",
|
|
36
|
+
description: "Renders an email template with field values, as the live preview shows it. Pass id for a saved template or html for unsaved markup. mode admin (default) fills declared samples for missing values and keeps scripts; mode sent returns exactly what would be emailed (static html plus the plain-text alternative). Returns {subject,html,missingFields,undeclaredFields,mode,scriptsStripped,text?}. Sends nothing. Requires content.read.",
|
|
37
|
+
sideEffects: "none",
|
|
38
|
+
authorization: { permission: "content.read" },
|
|
39
|
+
inputSchema: {
|
|
40
|
+
type: "object",
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
properties: { id: { type: "string" }, html: { type: "string" }, values: VALUES_SCHEMA, mode: { type: "string", enum: ["admin", "sent"] } },
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
/** The create and edit tools: the only ones whose text and authorization name the host's edit-HTML permission. */
|
|
46
|
+
function emailTemplateWriteTools({ copy }) {
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
name: "email_template_create",
|
|
50
|
+
description: `Creates an HTML email template. Give html for the full document, or omit it to start from a simple starter email built from subject and fields. Returns the template as email_template_get does. ${FIELD_CONTRACT} Requires ${copy.editHtmlPermission}.`,
|
|
51
|
+
sideEffects: "mutates-durable-state",
|
|
52
|
+
authorization: { permission: copy.editHtmlPermission },
|
|
53
|
+
inputSchema: {
|
|
54
|
+
type: "object",
|
|
55
|
+
additionalProperties: false,
|
|
56
|
+
required: ["name"],
|
|
57
|
+
properties: {
|
|
58
|
+
name: { type: "string", maxLength: 200, description: "Admin-facing name, e.g. Order confirmation." },
|
|
59
|
+
html: { type: "string", description: "The full HTML document." },
|
|
60
|
+
subject: { type: "string", description: "Starter only (ignored with html): the subject; defaults to name." },
|
|
61
|
+
fields: { type: "array", items: { type: "string" }, description: "Starter only (ignored with html): field names, each optionally name=sample." },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "email_template_edit",
|
|
67
|
+
description: `Replaces an email template's whole HTML document. Read it first with email_template_get and send its version as expectedVersion; a stale version writes nothing (EMAIL_TEMPLATES_VERSION_CONFLICT). Returns the saved template. ${FIELD_CONTRACT} Requires ${copy.editHtmlPermission}.`,
|
|
68
|
+
sideEffects: "mutates-durable-state",
|
|
69
|
+
authorization: { permission: copy.editHtmlPermission },
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: "object",
|
|
72
|
+
additionalProperties: false,
|
|
73
|
+
required: ["id", "html", "expectedVersion"],
|
|
74
|
+
properties: { id: { type: "string" }, html: { type: "string" }, expectedVersion: { type: "integer", minimum: 1 } },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The email-template tool catalog, bound once by the host with its {@link EmailTemplatesHostCopy};
|
|
81
|
+
* bound with the host's own permission name, the model-facing text is the host's original catalog text.
|
|
82
|
+
*/
|
|
83
|
+
export function createEmailTemplatesAgentToolCatalog({ copy }, _optional = {}) {
|
|
84
|
+
return [EMAIL_TEMPLATE_LIST_TOOL, EMAIL_TEMPLATE_GET_TOOL, ...emailTemplateWriteTools({ copy }), EMAIL_TEMPLATE_PREVIEW_TOOL];
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=email-template-agent-tools.js.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type AgentToolSideEffect, type ToolExecutionContext, type ToolRegistration } from "@jini-ai/core";
|
|
2
|
+
import type { ToolContributor } from "@jini-ai/core";
|
|
3
|
+
export interface EmailTemplateStorePort {
|
|
4
|
+
find(args: {
|
|
5
|
+
id: string;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
html: string;
|
|
10
|
+
version: number;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
} | null>;
|
|
13
|
+
create(args: {
|
|
14
|
+
name: string;
|
|
15
|
+
seedHtml: string;
|
|
16
|
+
actorId: string;
|
|
17
|
+
}): Promise<{
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
html: string;
|
|
21
|
+
version: number;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
}>;
|
|
24
|
+
openHtml(args: {
|
|
25
|
+
id: string;
|
|
26
|
+
actorId: string;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
version: number | null;
|
|
29
|
+
write(args: {
|
|
30
|
+
html: string;
|
|
31
|
+
}): Promise<boolean>;
|
|
32
|
+
}>;
|
|
33
|
+
rename(args: {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
ifVersion: number;
|
|
37
|
+
}): Promise<boolean>;
|
|
38
|
+
listPage(args: {
|
|
39
|
+
limit: number;
|
|
40
|
+
before?: {
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
id: string;
|
|
43
|
+
};
|
|
44
|
+
}): Promise<Array<{
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
html: string;
|
|
48
|
+
version: number;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
} | null>>;
|
|
51
|
+
}
|
|
52
|
+
export interface EmailTemplatesToolDeps {
|
|
53
|
+
workspaceId: string;
|
|
54
|
+
editHtmlPermission: string;
|
|
55
|
+
catalog: readonly import('@jini-ai/core').AgentToolDefinition[];
|
|
56
|
+
requirePermission(input: {
|
|
57
|
+
ctx: ToolExecutionContext;
|
|
58
|
+
name: string;
|
|
59
|
+
}): Promise<unknown>;
|
|
60
|
+
emailTemplateStore(): EmailTemplateStorePort;
|
|
61
|
+
ForbiddenError: abstract new (...args: never[]) => Error;
|
|
62
|
+
}
|
|
63
|
+
export declare const emailTemplatesDerivedRisk: ReadonlyMap<string, AgentToolSideEffect>;
|
|
64
|
+
/**
|
|
65
|
+
* The assistant half of email templates; every handler is a permission check plus one shared
|
|
66
|
+
* operation from `operations.ts`, the same call the admin route makes.
|
|
67
|
+
* @returns The five registrations.
|
|
68
|
+
* @complexity O(1) per call beyond the operation's own cost.
|
|
69
|
+
*/
|
|
70
|
+
export declare function buildEmailTemplatesRegistrations(deps: EmailTemplatesToolDeps): ToolRegistration[];
|
|
71
|
+
/** Contributes the email-template tools; registered once by `tool-catalog-manifest.ts`. */
|
|
72
|
+
export declare function contributeEmailTemplatesTools(): ToolContributor<EmailTemplatesToolDeps, unknown>;
|
|
73
|
+
//# sourceMappingURL=email-template-tool-registrations.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { requireExpectedVersion } from "@jini-ai/core/optimistic-concurrency";
|
|
2
|
+
import { toolMetadata } from "@jini-ai/core/tool-metadata/email-templates";
|
|
3
|
+
import { buildDomainRegistrations, indexCatalogById, requireInputRecord } from "@jini-ai/core";
|
|
4
|
+
import { forbiddenRule, withModelFacingErrors } from "@jini-ai/core/model-facing-tool-errors";
|
|
5
|
+
import { createEmailTemplate, editEmailTemplate, EmailTemplateInputError, EmailTemplateNotFoundError, EmailTemplateVersionConflictError, getEmailTemplate, listEmailTemplates, previewEmailTemplate, requireText, } from "@jini-ai/platform/mail/email-template-operations";
|
|
6
|
+
export const emailTemplatesDerivedRisk = new Map([
|
|
7
|
+
// -> postRepo.listHtmlByKind only.
|
|
8
|
+
["email_template_list", "none"],
|
|
9
|
+
// -> postRepo.findById only.
|
|
10
|
+
["email_template_get", "none"],
|
|
11
|
+
// -> postRepo.save + PagesHtmlDocumentStore.ensureHtmlFormat: one new draft row, its revisions.
|
|
12
|
+
["email_template_create", "mutates-durable-state"],
|
|
13
|
+
// -> PagesHtmlDocumentStore.write: one compare-and-set body write plus its revision.
|
|
14
|
+
["email_template_edit", "mutates-durable-state"],
|
|
15
|
+
// -> postRepo.findById at most; renders in memory and sends nothing.
|
|
16
|
+
["email_template_preview", "none"],
|
|
17
|
+
]);
|
|
18
|
+
function permission({ deps, ctx, name }, _options = {}) {
|
|
19
|
+
return deps.requirePermission({ ctx, name });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The assistant half of email templates; every handler is a permission check plus one shared
|
|
23
|
+
* operation from `operations.ts`, the same call the admin route makes.
|
|
24
|
+
* @returns The five registrations.
|
|
25
|
+
* @complexity O(1) per call beyond the operation's own cost.
|
|
26
|
+
*/
|
|
27
|
+
export function buildEmailTemplatesRegistrations(deps) {
|
|
28
|
+
return buildDomainRegistrations({ metadata: toolMetadata, domain: "email-templates", catalogModule: "@jini-ai/platform/mail/email-template-agent-tools", catalog: indexCatalogById({ catalog: deps.catalog }), derivedRisk: emailTemplatesDerivedRisk, handlers: withModelFacingErrors({ handlers: {
|
|
29
|
+
email_template_list: async (ctx) => {
|
|
30
|
+
requireInputRecord({ input: ctx.input });
|
|
31
|
+
await permission({ deps, ctx, name: "content.read" });
|
|
32
|
+
return listEmailTemplates({ store: deps.emailTemplateStore(), input: requireInputRecord({ input: ctx.input }) });
|
|
33
|
+
},
|
|
34
|
+
email_template_get: async (ctx) => {
|
|
35
|
+
const input = requireInputRecord({ input: ctx.input });
|
|
36
|
+
await permission({ deps, ctx, name: "content.read" });
|
|
37
|
+
return getEmailTemplate({ store: deps.emailTemplateStore(), id: requireText({ value: input.id, key: "id", max: 200 }) });
|
|
38
|
+
},
|
|
39
|
+
email_template_create: async (ctx) => {
|
|
40
|
+
const input = requireInputRecord({ input: ctx.input });
|
|
41
|
+
await permission({ deps, ctx, name: deps.editHtmlPermission });
|
|
42
|
+
ctx.signal.throwIfAborted();
|
|
43
|
+
return createEmailTemplate({ store: deps.emailTemplateStore(), input, actorId: ctx.principal.id });
|
|
44
|
+
},
|
|
45
|
+
email_template_edit: async (ctx) => {
|
|
46
|
+
const input = requireInputRecord({ input: ctx.input });
|
|
47
|
+
await permission({ deps, ctx, name: deps.editHtmlPermission });
|
|
48
|
+
return editEmailTemplate({ store: deps.emailTemplateStore(), input: { ...input, expectedVersion: requireExpectedVersion({ value: input.expectedVersion, readToolId: "email_template_get" }) }, actorId: ctx.principal.id });
|
|
49
|
+
},
|
|
50
|
+
email_template_preview: async (ctx) => {
|
|
51
|
+
const input = requireInputRecord({ input: ctx.input });
|
|
52
|
+
await permission({ deps, ctx, name: "content.read" });
|
|
53
|
+
return previewEmailTemplate({ store: deps.emailTemplateStore(), input });
|
|
54
|
+
},
|
|
55
|
+
}, rules: [
|
|
56
|
+
forbiddenRule({ domainPrefix: "EMAIL_TEMPLATES", error: deps.ForbiddenError }),
|
|
57
|
+
{ error: EmailTemplateNotFoundError, code: "EMAIL_TEMPLATES_NOT_FOUND" },
|
|
58
|
+
{ error: EmailTemplateInputError, code: "EMAIL_TEMPLATES_INVALID_INPUT" },
|
|
59
|
+
{ error: EmailTemplateVersionConflictError, code: "EMAIL_TEMPLATES_VERSION_CONFLICT" },
|
|
60
|
+
] }) });
|
|
61
|
+
}
|
|
62
|
+
/** Contributes the email-template tools; registered once by `tool-catalog-manifest.ts`. */
|
|
63
|
+
export function contributeEmailTemplatesTools() {
|
|
64
|
+
return { domain: "email-templates", build: buildEmailTemplatesRegistrations, risk: emailTemplatesDerivedRisk };
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=email-template-tool-registrations.js.map
|
|
@@ -33,8 +33,8 @@ export function fillPlaceholders({ text, values, escape: escapeValue }, _optiona
|
|
|
33
33
|
missing.add(name);
|
|
34
34
|
return "";
|
|
35
35
|
}
|
|
36
|
-
// Own keys contain strings by contract
|
|
37
|
-
return escapeValue({ value: values[name]
|
|
36
|
+
// Own keys contain strings by contract.
|
|
37
|
+
return escapeValue({ value: values[name] });
|
|
38
38
|
});
|
|
39
39
|
return { text: filled, missingFields: [...missing] };
|
|
40
40
|
}
|
|
@@ -71,11 +71,7 @@ function attribute({ element, name }, _options = {}) {
|
|
|
71
71
|
/** Every element under `root`, in document order (so "the first `<title>`" means the first one written). */
|
|
72
72
|
function* elementsIn(root, _options = {}) {
|
|
73
73
|
const pending = [root];
|
|
74
|
-
|
|
75
|
-
const node = pending.pop();
|
|
76
|
-
// Array length checks do not narrow pop() or indexed reads under the desktop config.
|
|
77
|
-
if (node === undefined)
|
|
78
|
-
continue;
|
|
74
|
+
for (let node = pending.pop(); node !== undefined; node = pending.pop()) {
|
|
79
75
|
if (isElement(node))
|
|
80
76
|
yield node;
|
|
81
77
|
queueChildParents({ node, pending });
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file `POST /hooks/mail/:providerId` — framework-free handler over Jini's `createMailFeedbackIngest`.
|
|
3
|
+
*
|
|
4
|
+
* Features never import Express (`features/INFO.md`); the server mounts {@link MailFeedbackRoute}
|
|
5
|
+
* with a RAW body parser (signatures are over the exact bytes) ahead of the public JSON parser.
|
|
6
|
+
* Hardening lives in the Jini ingest: body cap (413), unverified-request rate limit (429), unknown
|
|
7
|
+
* provider (404), no secret configured (503), bad signature (401), replay dedup.
|
|
8
|
+
*/
|
|
9
|
+
import { type MailFeedbackInboxPort, type MailFeedbackIngestOptions, type MailFeedbackResponse } from "./feedback.js";
|
|
10
|
+
import type { MailFeedbackParser } from "./provider.js";
|
|
11
|
+
import type { MailSuppressionRepoPort } from "./ports.js";
|
|
12
|
+
/** Default body cap; the server's raw parser uses the same number so both refuse alike. */
|
|
13
|
+
export declare const MAIL_FEEDBACK_MAX_BODY_BYTES: number;
|
|
14
|
+
export interface MailFeedbackRouteDeps {
|
|
15
|
+
/** The provider's feedback parser; undefined = unknown provider or no feedback support (404). May load plugins. */
|
|
16
|
+
parserFor: (required: {
|
|
17
|
+
providerId: string;
|
|
18
|
+
}) => MailFeedbackParser | undefined | Promise<MailFeedbackParser | undefined>;
|
|
19
|
+
/** Current + previous webhook secrets from the vault; empty = not configured (503). */
|
|
20
|
+
secretsFor: (required: {
|
|
21
|
+
providerId: string;
|
|
22
|
+
}) => Promise<readonly string[]>;
|
|
23
|
+
repos: {
|
|
24
|
+
inbox: MailFeedbackInboxPort;
|
|
25
|
+
suppression: MailSuppressionRepoPort;
|
|
26
|
+
};
|
|
27
|
+
/** The workspace this site's mail belongs to. */
|
|
28
|
+
resolveWorkspaceId: (required: Record<string, never>) => string | Promise<string>;
|
|
29
|
+
}
|
|
30
|
+
export interface MailFeedbackRequest {
|
|
31
|
+
providerId: string;
|
|
32
|
+
rawBody: Uint8Array;
|
|
33
|
+
/** Node-style headers (lower-case keys; repeated headers as arrays). */
|
|
34
|
+
headers: Readonly<Record<string, string | readonly string[] | undefined>>;
|
|
35
|
+
}
|
|
36
|
+
export interface MailFeedbackRoute {
|
|
37
|
+
readonly maxBodyBytes: number;
|
|
38
|
+
handle(required: MailFeedbackRequest): Promise<MailFeedbackResponse>;
|
|
39
|
+
}
|
|
40
|
+
/** Flattens Node headers to the parser's `Record<string, string>`; lower-cased keys, arrays joined. */
|
|
41
|
+
export declare function flattenHeaders({ headers }: {
|
|
42
|
+
headers: MailFeedbackRequest["headers"];
|
|
43
|
+
}, _optional?: Record<string, never>): Record<string, string>;
|
|
44
|
+
/**
|
|
45
|
+
* One ingest per process, so the unverified-request counter is shared across requests.
|
|
46
|
+
* @complexity O(events) inbox writes per request, plus one parser and one secrets lookup.
|
|
47
|
+
* @example createMailFeedbackRoute({ parserFor, secretsFor, repos: { inbox, suppression }, resolveWorkspaceId })
|
|
48
|
+
*/
|
|
49
|
+
export declare function createMailFeedbackRoute(required: MailFeedbackRouteDeps, optional?: MailFeedbackIngestOptions): MailFeedbackRoute;
|
|
50
|
+
//# sourceMappingURL=feedback-route.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file `POST /hooks/mail/:providerId` — framework-free handler over Jini's `createMailFeedbackIngest`.
|
|
3
|
+
*
|
|
4
|
+
* Features never import Express (`features/INFO.md`); the server mounts {@link MailFeedbackRoute}
|
|
5
|
+
* with a RAW body parser (signatures are over the exact bytes) ahead of the public JSON parser.
|
|
6
|
+
* Hardening lives in the Jini ingest: body cap (413), unverified-request rate limit (429), unknown
|
|
7
|
+
* provider (404), no secret configured (503), bad signature (401), replay dedup.
|
|
8
|
+
*/
|
|
9
|
+
import { createMailFeedbackIngest, } from "./feedback.js";
|
|
10
|
+
/** Default body cap; the server's raw parser uses the same number so both refuse alike. */
|
|
11
|
+
export const MAIL_FEEDBACK_MAX_BODY_BYTES = 256 * 1024;
|
|
12
|
+
/** Flattens Node headers to the parser's `Record<string, string>`; lower-cased keys, arrays joined. */
|
|
13
|
+
export function flattenHeaders({ headers }, _optional = {}) {
|
|
14
|
+
const flat = {};
|
|
15
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
16
|
+
if (value === undefined)
|
|
17
|
+
continue;
|
|
18
|
+
flat[name.toLowerCase()] = typeof value === "string" ? value : value.join(", ");
|
|
19
|
+
}
|
|
20
|
+
return flat;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* One ingest per process, so the unverified-request counter is shared across requests.
|
|
24
|
+
* @complexity O(events) inbox writes per request, plus one parser and one secrets lookup.
|
|
25
|
+
* @example createMailFeedbackRoute({ parserFor, secretsFor, repos: { inbox, suppression }, resolveWorkspaceId })
|
|
26
|
+
*/
|
|
27
|
+
export function createMailFeedbackRoute(required, optional = {}) {
|
|
28
|
+
const maxBodyBytes = optional.maxBodyBytes ?? MAIL_FEEDBACK_MAX_BODY_BYTES;
|
|
29
|
+
// The Jini ingest asks for its parser synchronously; the lookup here may be async (plugin load),
|
|
30
|
+
// so each request resolves first and the ingest reads the result in the same tick.
|
|
31
|
+
const parsers = new Map();
|
|
32
|
+
const ingest = createMailFeedbackIngest({ parserFor: ({ providerId }) => parsers.get(providerId), secretsFor: required.secretsFor, inbox: required.repos.inbox, suppression: required.repos.suppression }, { ...optional, maxBodyBytes });
|
|
33
|
+
return {
|
|
34
|
+
maxBodyBytes,
|
|
35
|
+
async handle({ providerId, rawBody, headers }) {
|
|
36
|
+
const workspaceId = await required.resolveWorkspaceId({});
|
|
37
|
+
const parser = await required.parserFor({ providerId });
|
|
38
|
+
if (parser)
|
|
39
|
+
parsers.set(providerId, parser);
|
|
40
|
+
else
|
|
41
|
+
parsers.delete(providerId);
|
|
42
|
+
return ingest.handle({ providerId, workspaceId, rawBody, headers: flattenHeaders({ headers }) });
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=feedback-route.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file **Feedback setup** (email phase 5) behind `mail_get_feedback_setup` and
|
|
3
|
+
* `GET system/mail-feedback`: for each active provider, whether it can report deliveries, bounces
|
|
4
|
+
* and complaints, the webhook URL to paste into the provider, whether its signing secret is saved
|
|
5
|
+
* (current and previous rotation slots, `features/mail/feedback-sources.ts`), and the newest
|
|
6
|
+
* verified event.
|
|
7
|
+
*
|
|
8
|
+
* Presence only: the secret slots are read from the credential list by label, never decrypted, so
|
|
9
|
+
* this read cannot leak or even touch a secret. "No events yet" (`no_events_yet`) is reported apart
|
|
10
|
+
* from healthy ingestion (`receiving`), because a webhook nobody has called looks the same as a
|
|
11
|
+
* broken one until the first event arrives.
|
|
12
|
+
*/
|
|
13
|
+
import type { OriginRegistryPort } from "@jini-ai/core/contracts/server/verified-origin";
|
|
14
|
+
import type { MailSuppressionAdminRepo } from "@jini-ai/core/contracts/site/platform-mail";
|
|
15
|
+
import type { MailProviderControl } from "./mail-status.js";
|
|
16
|
+
import type { MailFeedbackSetupReport } from "@jini-ai/core/contracts/site/platform-mail";
|
|
17
|
+
export interface MailFeedbackSetupDeps<TCredentialRepo = unknown> {
|
|
18
|
+
workspaceId: string;
|
|
19
|
+
mailProviderControl?: Pick<MailProviderControl, "describe">;
|
|
20
|
+
/** The host's credential store, handed back to {@link MailFeedbackSetupDeps.listCustomCredentials}. */
|
|
21
|
+
customCredentialSetRepo?: TCredentialRepo;
|
|
22
|
+
originRegistry?: Pick<OriginRegistryPort, "canonicalOrigin">;
|
|
23
|
+
mailSuppressionAdmin?: Pick<MailSuppressionAdminRepo, "lastFeedbackEvent">;
|
|
24
|
+
/** Host: safe summaries (label + update time, never a secret) of the saved credentials. */
|
|
25
|
+
listCustomCredentials(deps: {
|
|
26
|
+
repo: TCredentialRepo;
|
|
27
|
+
}, input: {
|
|
28
|
+
workspaceId: string;
|
|
29
|
+
}): Promise<readonly {
|
|
30
|
+
label: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
}[]>;
|
|
33
|
+
/** Host: the persisted current/previous signing-secret labels for a provider (product-prefixed). */
|
|
34
|
+
mailWebhookSecretLabels(required: {
|
|
35
|
+
providerLabel: string;
|
|
36
|
+
}): readonly [string, string];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Feedback setup for every provider that currently sends for a lane.
|
|
40
|
+
* @complexity One provider describe, one credential list, one origin read and one inbox probe per provider.
|
|
41
|
+
* @example await readMailFeedbackSetup(deps)
|
|
42
|
+
*/
|
|
43
|
+
export declare function readMailFeedbackSetup(deps: MailFeedbackSetupDeps, _options?: Record<string, never>): Promise<MailFeedbackSetupReport>;
|
|
44
|
+
//# sourceMappingURL=feedback-setup.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Mirrors `features/newsletter/confirmation.ts`'s private `composeOriginUrl` (default ports elided). */
|
|
2
|
+
function originUrl(origin, _options = {}) {
|
|
3
|
+
const matchesDefaultPort = (origin.scheme === "https" && origin.port === 443) || (origin.scheme === "http" && origin.port === 80);
|
|
4
|
+
const isDefaultPort = origin.port === undefined || matchesDefaultPort;
|
|
5
|
+
const authority = isDefaultPort ? origin.host : `${origin.host}:${origin.port}`;
|
|
6
|
+
return `${origin.scheme}://${authority}${origin.basePath ?? ""}`;
|
|
7
|
+
}
|
|
8
|
+
async function siteOrigin(deps, _options = {}) {
|
|
9
|
+
if (!deps.originRegistry)
|
|
10
|
+
return null;
|
|
11
|
+
try {
|
|
12
|
+
return originUrl(await deps.originRegistry.canonicalOrigin({ workspaceId: deps.workspaceId }));
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function slot({ label, saved }, _options = {}) {
|
|
19
|
+
return { label, configured: saved.has(label), updatedAt: saved.get(label) ?? null };
|
|
20
|
+
}
|
|
21
|
+
function stateOf(setup, _options = {}) {
|
|
22
|
+
if (!setup.supported)
|
|
23
|
+
return "unsupported";
|
|
24
|
+
if (!setup.signingSecret?.current.configured && !setup.signingSecret?.previous.configured)
|
|
25
|
+
return "secret_missing";
|
|
26
|
+
return setup.lastVerifiedEvent ? "receiving" : "no_events_yet";
|
|
27
|
+
}
|
|
28
|
+
async function providerSetup({ deps, provider, context }, _optional = {}) {
|
|
29
|
+
const supported = provider.capabilities.feedback;
|
|
30
|
+
const webhookPath = `/hooks/mail/${encodeURIComponent(provider.id)}`;
|
|
31
|
+
const [current, previous] = deps.mailWebhookSecretLabels({ providerLabel: provider.label });
|
|
32
|
+
const signingSecret = supported ? { current: slot({ label: current, saved: context.saved }), previous: slot({ label: previous, saved: context.saved }) } : null;
|
|
33
|
+
const lastVerifiedEvent = supported && deps.mailSuppressionAdmin ? await deps.mailSuppressionAdmin.lastFeedbackEvent({ workspaceId: deps.workspaceId, providerId: provider.id }) : null;
|
|
34
|
+
const setup = { providerId: provider.id, label: provider.label, lanes: provider.lanes, supported, webhookPath,
|
|
35
|
+
webhookUrl: supported && context.origin ? `${context.origin}${webhookPath}` : null, signingSecret, lastVerifiedEvent };
|
|
36
|
+
return { ...setup, state: stateOf(setup) };
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Feedback setup for every provider that currently sends for a lane.
|
|
40
|
+
* @complexity One provider describe, one credential list, one origin read and one inbox probe per provider.
|
|
41
|
+
* @example await readMailFeedbackSetup(deps)
|
|
42
|
+
*/
|
|
43
|
+
export async function readMailFeedbackSetup(deps, _options = {}) {
|
|
44
|
+
if (!deps.mailProviderControl?.describe)
|
|
45
|
+
return { available: false, providers: [] };
|
|
46
|
+
const report = await deps.mailProviderControl.describe();
|
|
47
|
+
const active = report.providers.filter((provider) => provider.lanes.length > 0);
|
|
48
|
+
const records = deps.customCredentialSetRepo ? await deps.listCustomCredentials({ repo: deps.customCredentialSetRepo }, { workspaceId: deps.workspaceId }) : [];
|
|
49
|
+
const saved = new Map(records.map((record) => [record.label, record.updatedAt]));
|
|
50
|
+
const origin = await siteOrigin(deps);
|
|
51
|
+
return { available: true, providers: await Promise.all(active.map((provider) => providerSetup({ deps, provider, context: { origin, saved } }))) };
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=feedback-setup.js.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Where the feedback route finds a provider's parser and webhook secrets.
|
|
3
|
+
*
|
|
4
|
+
* Parsers come from the provider module's `.feedback` (Jini `MailProviderModule`), read off the
|
|
5
|
+
* plugin mail-adapter registry until the composition hands over a provider registry. Secrets live
|
|
6
|
+
* in the custom-credentials vault under fixed labels, one per provider, plus a `(previous)` label so
|
|
7
|
+
* a secret can rotate without dropping in-flight webhooks: save the new one as current, keep the old
|
|
8
|
+
* one as previous until the provider stops signing with it, then delete it.
|
|
9
|
+
*/
|
|
10
|
+
import type { MailFeedbackParser } from "./provider.js";
|
|
11
|
+
/** Reads one saved vault credential by label (the host's custom-credentials store); `null` = not saved. */
|
|
12
|
+
export type MailWebhookSecretResolver<Credentials> = (credentials: Credentials, input: {
|
|
13
|
+
workspaceId: string;
|
|
14
|
+
label: string;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
connection: {
|
|
17
|
+
token: string;
|
|
18
|
+
};
|
|
19
|
+
} | null>;
|
|
20
|
+
/** The registry shape this needs (`MailAdapterRegistry` structurally); modules are untrusted values. */
|
|
21
|
+
export interface MailAdapterSource {
|
|
22
|
+
list(): readonly {
|
|
23
|
+
readonly descriptor: {
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly label: string;
|
|
26
|
+
};
|
|
27
|
+
readonly module: unknown;
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
/** Vault labels for a provider's webhook signing secret: current first, then the rotation slot.
|
|
31
|
+
* `labelPrefix` is the host's product label; stored labels are persisted, so it never changes. */
|
|
32
|
+
export declare function mailWebhookSecretLabels({ providerLabel, labelPrefix }: {
|
|
33
|
+
providerLabel: string;
|
|
34
|
+
labelPrefix: string;
|
|
35
|
+
}): readonly [string, string];
|
|
36
|
+
/**
|
|
37
|
+
* Parser and label lookups over a freshly loaded adapter registry.
|
|
38
|
+
* @complexity O(a) adapters per lookup, plus one registry load.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createPluginMailFeedbackSources(required: {
|
|
41
|
+
loadAdapters: () => Promise<MailAdapterSource>;
|
|
42
|
+
}): {
|
|
43
|
+
parserFor: ({ providerId }: {
|
|
44
|
+
providerId: string;
|
|
45
|
+
}) => Promise<MailFeedbackParser | undefined>;
|
|
46
|
+
labelFor: ({ providerId }: {
|
|
47
|
+
providerId: string;
|
|
48
|
+
}) => Promise<string | undefined>;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* `secretsFor` over the vault: the current then previous secret that are saved, in that order.
|
|
52
|
+
* A vault read failure propagates (the route answers 500 and the provider retries).
|
|
53
|
+
* @complexity Two label lookups per call.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createVaultMailWebhookSecrets<Credentials>(required: {
|
|
56
|
+
credentials: Credentials;
|
|
57
|
+
workspaceId: string;
|
|
58
|
+
labelFor: (required: {
|
|
59
|
+
providerId: string;
|
|
60
|
+
}) => Promise<string | undefined>;
|
|
61
|
+
/** The host's vault reader and label prefix (see {@link mailWebhookSecretLabels}). */
|
|
62
|
+
resolveByLabel: MailWebhookSecretResolver<Credentials>;
|
|
63
|
+
labelPrefix: string;
|
|
64
|
+
}, _optional?: Record<string, never>): ({ providerId }: {
|
|
65
|
+
providerId: string;
|
|
66
|
+
}) => Promise<readonly string[]>;
|
|
67
|
+
//# sourceMappingURL=feedback-sources.d.ts.map
|