@k9o/extension-manifest 1.6.0 → 1.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k9o/extension-manifest",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/builder.ts CHANGED
@@ -55,6 +55,7 @@ import {
55
55
  type PersonalDataDeclaration,
56
56
  type DependsOnEntry,
57
57
  type InstallConfigEntry,
58
+ type MessagingProviderDeclaration,
58
59
  type WorkflowTemplateEntry,
59
60
  type EventSubscriptionEntry,
60
61
  type ErasureHookDeclaration,
@@ -186,6 +187,7 @@ export type ManifestAuthor = {
186
187
  /** Ready-made workflows a workflow-template extension ships; wire-shaped entries, copied through verbatim (inner keys stay camelCase). */
187
188
  workflowTemplates?: readonly WorkflowTemplateEntry[];
188
189
  installConfig?: readonly InstallConfigEntry[];
190
+ messagingProvider?: MessagingProviderDeclaration;
189
191
  /** Event subscriptions; same wire shape, entries pass through (copied). Each `invokes` names an `auth: "event"` endpoint. */
190
192
  eventSubscriptions?: readonly EventSubscriptionEntry[];
191
193
  /** The subject-erasure hook; same wire shape. `invokes` names an `auth: "erasure"` endpoint. */
@@ -316,6 +318,7 @@ export function defineManifest(input: ManifestAuthor): Manifest {
316
318
  : {}),
317
319
  ...(input.dependsOn !== undefined ? { depends_on: input.dependsOn.map((d) => structuredClone(d)) } : {}),
318
320
  ...(input.workflowTemplates !== undefined ? { workflow_templates: input.workflowTemplates.map((t) => structuredClone(t)) } : {}),
321
+ ...(input.messagingProvider !== undefined ? { messaging_provider: structuredClone(input.messagingProvider) } : {}),
319
322
  ...(input.installConfig !== undefined ? { install_config: input.installConfig.map((d) => structuredClone(d)) } : {}),
320
323
  ...(input.eventSubscriptions !== undefined ? { event_subscriptions: input.eventSubscriptions.map((d) => structuredClone(d)) } : {}),
321
324
  ...(input.erasureHook !== undefined ? { erasure_hook: { ...input.erasureHook } } : {}),
package/src/index.ts CHANGED
@@ -85,6 +85,10 @@ export {
85
85
  type PersonalDataDeclaration,
86
86
  type DependsOnEntry,
87
87
  type InstallConfigEntry,
88
+ type MessagingProviderDeclaration,
89
+ type MessagingPermission,
90
+ type MessagingChannel,
91
+ MESSAGING_CHANNELS,
88
92
  type InstallConfigObjectField,
89
93
  type InstallConfigType,
90
94
  type EventSubscriptionEntry,
package/src/manifest.ts CHANGED
@@ -235,11 +235,14 @@ export type AiPermission = {
235
235
  * compliance extensions only (`…/audit/project-events`); the catalogue refuses to sign it for any other extension and
236
236
  * the platform refuses to enable or serve it.
237
237
  */
238
- export type AuditPermission = {
239
- domain: "audit";
240
- action: "read";
241
- qualifier: "_self" | "project";
242
- };
238
+ export type AuditPermission =
239
+ | { domain: "audit"; action: "read"; qualifier: "_self" | "project" }
240
+ /**
241
+ * Write the extension's own audit events (`k9o.audit.emit()`, `POST /@<project>/extensions/<slug>/audit/events`).
242
+ * `"_self"` only: the platform stamps the event type with the extension's slug, and the row is marked as the
243
+ * extension's own statement.
244
+ */
245
+ | { domain: "audit"; action: "write"; qualifier: "_self" };
243
246
 
244
247
  export type Permission =
245
248
  | DocumentsPermission
@@ -264,7 +267,20 @@ export type Permission =
264
267
  | EgressMcpPermission
265
268
  | KiboPermission
266
269
  | AiPermission
267
- | AuditPermission;
270
+ | AuditPermission
271
+ | MessagingPermission;
272
+
273
+ /** The channels a messaging grant or provider names. Closed. */
274
+ export const MESSAGING_CHANNELS = ["chat", "sms", "whatsapp", "email", "voice", "push"] as const;
275
+ export type MessagingChannel = (typeof MESSAGING_CHANNELS)[number];
276
+
277
+ /**
278
+ * Messaging. `send` is qualified by the channels the extension may send on (one, or a list), never `"*"`.
279
+ * `request_approval` asks a person to approve something and takes `"*"`.
280
+ */
281
+ export type MessagingPermission =
282
+ | { domain: "messaging"; action: "send"; qualifier: MessagingChannel | readonly MessagingChannel[] }
283
+ | { domain: "messaging"; action: "request_approval"; qualifier: "*" };
268
284
 
269
285
  export type PermissionDomain = Permission["domain"];
270
286
 
@@ -1410,6 +1426,11 @@ export type Manifest = {
1410
1426
  * Never a host, a URL or a secret. At most `INSTALL_CONFIG_MAX_KEYS`.
1411
1427
  */
1412
1428
  install_config?: readonly InstallConfigEntry[];
1429
+ /**
1430
+ * The channels this extension serves as a messaging provider. `send_function` names a sandbox-tier function the manifest
1431
+ * declares and `inbound_path` a declared `webhookIngress` path. A push provider also names `platforms` and `push_service`.
1432
+ */
1433
+ messaging_provider?: MessagingProviderDeclaration;
1413
1434
  /**
1414
1435
  * Event subscriptions: the platform delivers each matching record or object event to `invokes`, a declared
1415
1436
  * `auth: "event"` endpoint. At most `EVENT_SUBSCRIPTIONS_MAX_PER_EXTENSION`.
@@ -1641,3 +1662,17 @@ export type ErasureHookDeclaration = {
1641
1662
  /** `"<METHOD>:<path>"`, exactly a declared `auth: "erasure"` endpoint's method and literal path. */
1642
1663
  invokes: string;
1643
1664
  };
1665
+
1666
+ /** `messaging_provider`: the channels an extension serves as a messaging provider. */
1667
+ export type MessagingProviderDeclaration = {
1668
+ channels: readonly MessagingChannel[];
1669
+ /** Required with `push`, refused otherwise. */
1670
+ platforms?: readonly ("ios" | "android")[];
1671
+ /** Required with `push`, refused otherwise. `apns` reaches ios only. */
1672
+ push_service?: "apns" | "fcm";
1673
+ /** A sandbox-tier `surfaces.background_logic.functions[]` entry. */
1674
+ send_function: string;
1675
+ /** A declared `webhookIngress` path. */
1676
+ inbound_path?: string;
1677
+ limits?: { templates?: boolean; read_receipts?: boolean; max_recipients?: number };
1678
+ };