@primitivedotdev/sdk 0.12.0 → 0.13.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.
@@ -1,2 +1,2 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
- export { addDomain, createEndpoint, createFilter, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, downloadAttachments, downloadRawEmail, getAccount, getEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, sendEmail, testEndpoint, updateAccount, updateDomain, updateEndpoint, updateFilter, verifyDomain } from './sdk.gen.js';
2
+ export { addDomain, createEndpoint, createFilter, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, downloadAttachments, downloadRawEmail, getAccount, getEmail, getSendPermissions, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, sendEmail, testEndpoint, updateAccount, updateDomain, updateEndpoint, updateFilter, verifyDomain } from './sdk.gen.js';
@@ -122,11 +122,15 @@ export const verifyDomain = (options) => (options.client ?? client).post({
122
122
  ...options
123
123
  });
124
124
  /**
125
- * List emails
125
+ * List inbound emails
126
126
  *
127
- * Returns a paginated list of received emails. Supports filtering by
128
- * domain, status, date range, and free-text search across subject,
129
- * sender, and recipient fields.
127
+ * Returns a paginated list of INBOUND emails received at your
128
+ * verified domains. Outbound messages sent via /send-mail are not
129
+ * included; this endpoint is the inbox view, not a unified
130
+ * send/receive history.
131
+ *
132
+ * Supports filtering by domain, status, date range, and free-text
133
+ * search across subject, sender, and recipient fields.
130
134
  *
131
135
  */
132
136
  export const listEmails = (options) => (options?.client ?? client).get({
@@ -371,6 +375,46 @@ export const replayDelivery = (options) => (options.client ?? client).post({
371
375
  url: '/webhooks/deliveries/{id}/replay',
372
376
  ...options
373
377
  });
378
+ /**
379
+ * List send-permission rules
380
+ *
381
+ * Returns a flat list of rules describing every recipient the
382
+ * caller may send to. Each rule has a `type`, a kind-specific
383
+ * payload, and a human-readable `description`. If any rule
384
+ * matches the recipient, /send-mail will accept the send under
385
+ * the recipient-scope check.
386
+ *
387
+ * The endpoint is the answer to "where can I send" without
388
+ * exposing internal entitlement names. Agents that don't
389
+ * recognize a `type` can still read the `description` prose
390
+ * and act on it.
391
+ *
392
+ * Rule kinds, ordered broadest-first so an agent can stop
393
+ * scanning at the first match:
394
+ *
395
+ * 1. `any_recipient` (one entry, only when the org can send
396
+ * anywhere): every other rule below it is redundant.
397
+ * 2. `managed_zone` (always emitted, one per Primitive-managed
398
+ * zone): sends to any address at *.primitive.email or
399
+ * *.email.works always succeed; no entitlement required.
400
+ * 3. `your_domain` (one per active verified outbound domain
401
+ * owned by the org): sends to that domain are approved.
402
+ * 4. `address` (one per address that has authenticated
403
+ * inbound mail to the org, capped at `meta.address_cap`):
404
+ * sends to that exact address are approved.
405
+ *
406
+ * The list is informational, not an authorization check.
407
+ * /send-mail remains the source of truth on whether an
408
+ * individual send will succeed (it also enforces the
409
+ * from-address and the `send_mail` entitlement, which are
410
+ * not recipient-scope concerns and are not represented here).
411
+ *
412
+ */
413
+ export const getSendPermissions = (options) => (options?.client ?? client).get({
414
+ security: [{ scheme: 'bearer', type: 'http' }],
415
+ url: '/send-permissions',
416
+ ...options
417
+ });
374
418
  /**
375
419
  * Send outbound email
376
420
  *
@@ -1,2 +1,2 @@
1
- import { $ as AddDomainResponse, $n as ReplayDeliveryErrors, $r as UpdateEndpointResponses, $t as ErrorResponse, A as getWebhookSecret, An as ListDomainsError, Ar as TestEndpointError, At as DeleteFilterData, B as sendEmail, Bn as ListEndpointsError, Br as UpdateAccountResponse, Bt as DownloadAttachmentsError, C as deleteEndpoint, Cn as Limit, Cr as SendEmailResponses, Ct as DeleteEmailResponse, D as getAccount, Dn as ListDeliveriesResponse, Dr as StorageStats, Dt as DeleteEndpointErrors, E as downloadRawEmail, En as ListDeliveriesErrors, Er as SentEmailStatus, Et as DeleteEndpointError, F as listFilters, Fn as ListEmailsError, Fr as UnverifiedDomain, Ft as DeliveryStatus, G as updateFilter, Gn as ListFiltersData, Gr as UpdateDomainInput, Gt as DownloadRawEmailError, H as updateAccount, Hn as ListEndpointsResponse, Hr as UpdateDomainData, Ht as DownloadAttachmentsResponse, I as replayDelivery, In as ListEmailsErrors, Ir as UpdateAccountData, It as DeliverySummary, J as AccountUpdated, Jn as ListFiltersResponse, Jr as UpdateEndpointData, Jt as DownloadRawEmailResponses, K as verifyDomain, Kn as ListFiltersError, Kr as UpdateDomainResponse, Kt as DownloadRawEmailErrors, L as replayEmailWebhooks, Ln as ListEmailsResponse, Lr as UpdateAccountError, Lt as Domain, M as listDomains, Mn as ListDomainsResponse, Mr as TestEndpointResponse, Mt as DeleteFilterErrors, N as listEmails, Nn as ListDomainsResponses, Nr as TestEndpointResponses, Nt as DeleteFilterResponse, O as getEmail, On as ListDeliveriesResponses, Or as SuccessEnvelope, Ot as DeleteEndpointResponse, P as listEndpoints, Pn as ListEmailsData, Pr as TestResult, Pt as DeleteFilterResponses, Q as AddDomainInput, Qn as ReplayDeliveryError, Qr as UpdateEndpointResponse, Qt as Endpoint, R as replyToEmail, Rn as ListEmailsResponses, Rr as UpdateAccountErrors, Rt as DomainVerifyResult, S as deleteEmail, Sn as GetWebhookSecretResponses, Sr as SendEmailResponse, St as DeleteEmailErrors, T as downloadAttachments, Tn as ListDeliveriesError, Tr as SendMailResult, Tt as DeleteEndpointData, U as updateDomain, Un as ListEndpointsResponses, Ur as UpdateDomainError, Ut as DownloadAttachmentsResponses, V as testEndpoint, Vn as ListEndpointsErrors, Vr as UpdateAccountResponses, Vt as DownloadAttachmentsErrors, W as updateEndpoint, Wn as ListEnvelope, Wr as UpdateDomainErrors, Wt as DownloadRawEmailData, X as AddDomainError, Xn as PaginationMeta, Xr as UpdateEndpointErrors, Xt as EmailDetailReply, Y as AddDomainData, Yn as ListFiltersResponses, Yr as UpdateEndpointError, Yt as EmailDetail, Z as AddDomainErrors, Zn as ReplayDeliveryData, Zr as UpdateEndpointInput, Zt as EmailSummary, _ as Options, _i as Options$1, _n as GetStorageStatsResponses, _r as RotateWebhookSecretResponse, _t as DeleteDomainErrors, a as PrimitiveApiError, ai as UpdateFilterResponses, an as GetAccountErrors, ar as ReplayEmailWebhooksResponse, at as CreateEndpointInput, b as createFilter, bi as ResponseStyle, bn as GetWebhookSecretErrors, br as SendEmailError, bt as DeleteEmailData, c as PrimitiveClientOptions, ci as VerifyDomainError, cn as GetEmailData, cr as ReplyToEmailData, ct as CreateFilterData, d as SendResult, di as VerifyDomainResponses, dn as GetEmailResponse, dr as ReplyToEmailResponse, dt as CreateFilterInput, ei as UpdateFilterData, en as Filter, er as ReplayDeliveryResponse, et as AddDomainResponses, f as SendThreadInput, fi as WebhookSecret, fn as GetEmailResponses, fr as ReplyToEmailResponses, ft as CreateFilterResponse, g as operations, gi as CreateClientConfig, gn as GetStorageStatsResponse, gr as RotateWebhookSecretErrors, gt as DeleteDomainError, h as createPrimitiveClient, hi as Config, hn as GetStorageStatsErrors, hr as RotateWebhookSecretError, ht as DeleteDomainData, i as PrimitiveApiClientOptions, ii as UpdateFilterResponse, in as GetAccountError, ir as ReplayEmailWebhooksErrors, it as CreateEndpointErrors, j as listDeliveries, jn as ListDomainsErrors, jr as TestEndpointErrors, jt as DeleteFilterError, k as getStorageStats, kn as ListDomainsData, kr as TestEndpointData, kt as DeleteEndpointResponses, l as ReplyInput, li as VerifyDomainErrors, ln as GetEmailError, lr as ReplyToEmailError, lt as CreateFilterError, m as createPrimitiveApiClient, mi as ClientOptions$1, mn as GetStorageStatsError, mr as RotateWebhookSecretData, mt as Cursor, n as ForwardInput, ni as UpdateFilterErrors, nn as GateFix, nr as ReplayEmailWebhooksData, nt as CreateEndpointData, o as PrimitiveApiErrorDetails, oi as VerifiedDomain, on as GetAccountResponse, or as ReplayEmailWebhooksResponses, ot as CreateEndpointResponse, p as client, pi as Client, pn as GetStorageStatsData, pr as ResourceId, pt as CreateFilterResponses, q as Account, qn as ListFiltersErrors, qr as UpdateDomainResponses, qt as DownloadRawEmailResponse, r as PrimitiveApiClient, ri as UpdateFilterInput, rn as GetAccountData, rr as ReplayEmailWebhooksError, rt as CreateEndpointError, s as PrimitiveClient, si as VerifyDomainData, sn as GetAccountResponses, sr as ReplayResult, st as CreateEndpointResponses, t as DEFAULT_BASE_URL, ti as UpdateFilterError, tn as GateDenial, tr as ReplayDeliveryResponses, tt as ClientOptions, u as SendInput, ui as VerifyDomainResponse, un as GetEmailErrors, ur as ReplyToEmailErrors, ut as CreateFilterErrors, v as addDomain, vi as RequestOptions, vn as GetWebhookSecretData, vr as RotateWebhookSecretResponses, vt as DeleteDomainResponse, w as deleteFilter, wn as ListDeliveriesData, wr as SendMailInput, wt as DeleteEmailResponses, x as deleteDomain, xi as Auth, xn as GetWebhookSecretResponse, xr as SendEmailErrors, xt as DeleteEmailError, y as createEndpoint, yi as RequestResult, yn as GetWebhookSecretError, yr as SendEmailData, yt as DeleteDomainResponses, z as rotateWebhookSecret, zn as ListEndpointsData, zr as UpdateAccountInput, zt as DownloadAttachmentsData } from "../index-K4KbjppU.js";
2
- export { Account, AccountUpdated, AddDomainData, AddDomainError, AddDomainErrors, AddDomainInput, AddDomainResponse, AddDomainResponses, Auth, ClientOptions, CreateClientConfig, CreateEndpointData, CreateEndpointError, CreateEndpointErrors, CreateEndpointInput, CreateEndpointResponse, CreateEndpointResponses, CreateFilterData, CreateFilterError, CreateFilterErrors, CreateFilterInput, CreateFilterResponse, CreateFilterResponses, Cursor, DEFAULT_BASE_URL, DeleteDomainData, DeleteDomainError, DeleteDomainErrors, DeleteDomainResponse, DeleteDomainResponses, DeleteEmailData, DeleteEmailError, DeleteEmailErrors, DeleteEmailResponse, DeleteEmailResponses, DeleteEndpointData, DeleteEndpointError, DeleteEndpointErrors, DeleteEndpointResponse, DeleteEndpointResponses, DeleteFilterData, DeleteFilterError, DeleteFilterErrors, DeleteFilterResponse, DeleteFilterResponses, DeliveryStatus, DeliverySummary, Domain, DomainVerifyResult, DownloadAttachmentsData, DownloadAttachmentsError, DownloadAttachmentsErrors, DownloadAttachmentsResponse, DownloadAttachmentsResponses, DownloadRawEmailData, DownloadRawEmailError, DownloadRawEmailErrors, DownloadRawEmailResponse, DownloadRawEmailResponses, EmailDetail, EmailDetailReply, EmailSummary, Endpoint, ErrorResponse, Filter, ForwardInput, GateDenial, GateFix, GetAccountData, GetAccountError, GetAccountErrors, GetAccountResponse, GetAccountResponses, GetEmailData, GetEmailError, GetEmailErrors, GetEmailResponse, GetEmailResponses, GetStorageStatsData, GetStorageStatsError, GetStorageStatsErrors, GetStorageStatsResponse, GetStorageStatsResponses, GetWebhookSecretData, GetWebhookSecretError, GetWebhookSecretErrors, GetWebhookSecretResponse, GetWebhookSecretResponses, Limit, ListDeliveriesData, ListDeliveriesError, ListDeliveriesErrors, ListDeliveriesResponse, ListDeliveriesResponses, ListDomainsData, ListDomainsError, ListDomainsErrors, ListDomainsResponse, ListDomainsResponses, ListEmailsData, ListEmailsError, ListEmailsErrors, ListEmailsResponse, ListEmailsResponses, ListEndpointsData, ListEndpointsError, ListEndpointsErrors, ListEndpointsResponse, ListEndpointsResponses, ListEnvelope, ListFiltersData, ListFiltersError, ListFiltersErrors, ListFiltersResponse, ListFiltersResponses, Options, PaginationMeta, PrimitiveApiClient, PrimitiveApiClientOptions, PrimitiveApiError, PrimitiveApiErrorDetails, PrimitiveClient, PrimitiveClientOptions, Client as PrimitiveGeneratedApiClient, ClientOptions$1 as PrimitiveGeneratedApiClientOptions, Config as PrimitiveGeneratedApiConfig, Options$1 as PrimitiveGeneratedApiOptions, RequestOptions as PrimitiveGeneratedApiRequestOptions, RequestResult as PrimitiveGeneratedApiRequestResult, ReplayDeliveryData, ReplayDeliveryError, ReplayDeliveryErrors, ReplayDeliveryResponse, ReplayDeliveryResponses, ReplayEmailWebhooksData, ReplayEmailWebhooksError, ReplayEmailWebhooksErrors, ReplayEmailWebhooksResponse, ReplayEmailWebhooksResponses, ReplayResult, ReplyInput, ReplyToEmailData, ReplyToEmailError, ReplyToEmailErrors, ReplyToEmailResponse, ReplyToEmailResponses, ResourceId, ResponseStyle, RotateWebhookSecretData, RotateWebhookSecretError, RotateWebhookSecretErrors, RotateWebhookSecretResponse, RotateWebhookSecretResponses, SendEmailData, SendEmailError, SendEmailErrors, SendEmailResponse, SendEmailResponses, SendInput, SendMailInput, SendMailResult, SendResult, SendThreadInput, SentEmailStatus, StorageStats, SuccessEnvelope, TestEndpointData, TestEndpointError, TestEndpointErrors, TestEndpointResponse, TestEndpointResponses, TestResult, UnverifiedDomain, UpdateAccountData, UpdateAccountError, UpdateAccountErrors, UpdateAccountInput, UpdateAccountResponse, UpdateAccountResponses, UpdateDomainData, UpdateDomainError, UpdateDomainErrors, UpdateDomainInput, UpdateDomainResponse, UpdateDomainResponses, UpdateEndpointData, UpdateEndpointError, UpdateEndpointErrors, UpdateEndpointInput, UpdateEndpointResponse, UpdateEndpointResponses, UpdateFilterData, UpdateFilterError, UpdateFilterErrors, UpdateFilterInput, UpdateFilterResponse, UpdateFilterResponses, VerifiedDomain, VerifyDomainData, VerifyDomainError, VerifyDomainErrors, VerifyDomainResponse, VerifyDomainResponses, WebhookSecret, addDomain, client, createEndpoint, createFilter, createPrimitiveApiClient, createPrimitiveClient, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, downloadAttachments, downloadRawEmail, getAccount, getEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, operations, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, sendEmail, testEndpoint, updateAccount, updateDomain, updateEndpoint, updateFilter, verifyDomain };
1
+ import { $ as AddDomainInput, $n as ListFiltersErrors, $r as UpdateAccountResponses, $t as Endpoint, A as getStorageStats, Ai as RequestOptions, An as ListDeliveriesData, Ar as SendMailInput, At as DeleteEndpointResponses, B as rotateWebhookSecret, Bn as ListEmailsData, Br as SuccessEnvelope, Bt as DownloadAttachmentsData, C as deleteEndpoint, Ci as VerifyDomainResponses, Cn as GetStorageStatsResponses, Cr as RotateWebhookSecretResponse, Ct as DeleteEmailErrors, D as getAccount, Di as Config, Dn as GetWebhookSecretResponse, Dr as SendEmailErrors, Dt as DeleteEndpointError, E as downloadRawEmail, Ei as ClientOptions$1, En as GetWebhookSecretErrors, Er as SendEmailError, Et as DeleteEndpointData, F as listEndpoints, Fn as ListDomainsData, Fr as SendPermissionRule, Ft as DeleteFilterResponses, G as updateEndpoint, Gn as ListEndpointsData, Gr as TestEndpointResponses, Gt as DownloadRawEmailData, H as testEndpoint, Hn as ListEmailsErrors, Hr as TestEndpointError, Ht as DownloadAttachmentsErrors, I as listFilters, In as ListDomainsError, Ir as SendPermissionYourDomain, It as DeliveryStatus, J as Account, Jn as ListEndpointsResponse, Jr as UpdateAccountData, Jt as DownloadRawEmailResponse, K as updateFilter, Kn as ListEndpointsError, Kr as TestResult, Kt as DownloadRawEmailError, L as replayDelivery, Ln as ListDomainsErrors, Lr as SendPermissionsMeta, Lt as DeliverySummary, M as listDeliveries, Mi as ResponseStyle, Mn as ListDeliveriesErrors, Mr as SendPermissionAddress, Mt as DeleteFilterError, N as listDomains, Ni as Auth, Nn as ListDeliveriesResponse, Nr as SendPermissionAnyRecipient, Nt as DeleteFilterErrors, O as getEmail, Oi as CreateClientConfig, On as GetWebhookSecretResponses, Or as SendEmailResponse, Ot as DeleteEndpointErrors, P as listEmails, Pn as ListDeliveriesResponses, Pr as SendPermissionManagedZone, Pt as DeleteFilterResponse, Q as AddDomainErrors, Qn as ListFiltersError, Qr as UpdateAccountResponse, Qt as EmailSummary, R as replayEmailWebhooks, Rn as ListDomainsResponse, Rr as SentEmailStatus, Rt as Domain, S as deleteEmail, Si as VerifyDomainResponse, Sn as GetStorageStatsResponse, Sr as RotateWebhookSecretErrors, St as DeleteEmailError, T as downloadAttachments, Ti as Client, Tn as GetWebhookSecretError, Tr as SendEmailData, Tt as DeleteEmailResponses, U as updateAccount, Un as ListEmailsResponse, Ur as TestEndpointErrors, Ut as DownloadAttachmentsResponse, V as sendEmail, Vn as ListEmailsError, Vr as TestEndpointData, Vt as DownloadAttachmentsError, W as updateDomain, Wn as ListEmailsResponses, Wr as TestEndpointResponse, Wt as DownloadAttachmentsResponses, X as AddDomainData, Xn as ListEnvelope, Xr as UpdateAccountErrors, Xt as EmailDetail, Y as AccountUpdated, Yn as ListEndpointsResponses, Yr as UpdateAccountError, Yt as DownloadRawEmailResponses, Z as AddDomainError, Zn as ListFiltersData, Zr as UpdateAccountInput, Zt as EmailDetailReply, _ as Options, _i as UpdateFilterResponses, _n as GetSendPermissionsResponse, _r as ReplyToEmailResponse, _t as DeleteDomainError, a as PrimitiveApiError, ai as UpdateDomainResponses, an as GetAccountError, ar as ReplayDeliveryErrors, at as CreateEndpointErrors, b as createFilter, bi as VerifyDomainError, bn as GetStorageStatsError, br as RotateWebhookSecretData, bt as DeleteDomainResponses, c as PrimitiveClientOptions, ci as UpdateEndpointErrors, cn as GetAccountResponses, cr as ReplayEmailWebhooksData, ct as CreateEndpointResponses, d as SendResult, di as UpdateEndpointResponses, dn as GetEmailErrors, dr as ReplayEmailWebhooksResponse, dt as CreateFilterErrors, ei as UpdateDomainData, en as ErrorResponse, er as ListFiltersResponse, et as AddDomainResponse, f as SendThreadInput, fi as UpdateFilterData, fn as GetEmailResponse, fr as ReplayEmailWebhooksResponses, ft as CreateFilterInput, g as operations, gi as UpdateFilterResponse, gn as GetSendPermissionsErrors, gr as ReplyToEmailErrors, gt as DeleteDomainData, h as createPrimitiveClient, hi as UpdateFilterInput, hn as GetSendPermissionsError, hr as ReplyToEmailError, ht as Cursor, i as PrimitiveApiClientOptions, ii as UpdateDomainResponse, in as GetAccountData, ir as ReplayDeliveryError, it as CreateEndpointError, j as getWebhookSecret, ji as RequestResult, jn as ListDeliveriesError, jr as SendMailResult, jt as DeleteFilterData, k as getSendPermissions, ki as Options$1, kn as Limit, kr as SendEmailResponses, kt as DeleteEndpointResponse, l as ReplyInput, li as UpdateEndpointInput, ln as GetEmailData, lr as ReplayEmailWebhooksError, lt as CreateFilterData, m as createPrimitiveApiClient, mi as UpdateFilterErrors, mn as GetSendPermissionsData, mr as ReplyToEmailData, mt as CreateFilterResponses, n as ForwardInput, ni as UpdateDomainErrors, nn as GateDenial, nr as PaginationMeta, nt as ClientOptions, o as PrimitiveApiErrorDetails, oi as UpdateEndpointData, on as GetAccountErrors, or as ReplayDeliveryResponse, ot as CreateEndpointInput, p as client, pi as UpdateFilterError, pn as GetEmailResponses, pr as ReplayResult, pt as CreateFilterResponse, q as verifyDomain, qn as ListEndpointsErrors, qr as UnverifiedDomain, qt as DownloadRawEmailErrors, r as PrimitiveApiClient, ri as UpdateDomainInput, rn as GateFix, rr as ReplayDeliveryData, rt as CreateEndpointData, s as PrimitiveClient, si as UpdateEndpointError, sn as GetAccountResponse, sr as ReplayDeliveryResponses, st as CreateEndpointResponse, t as DEFAULT_BASE_URL, ti as UpdateDomainError, tn as Filter, tr as ListFiltersResponses, tt as AddDomainResponses, u as SendInput, ui as UpdateEndpointResponse, un as GetEmailError, ur as ReplayEmailWebhooksErrors, ut as CreateFilterError, v as addDomain, vi as VerifiedDomain, vn as GetSendPermissionsResponses, vr as ReplyToEmailResponses, vt as DeleteDomainErrors, w as deleteFilter, wi as WebhookSecret, wn as GetWebhookSecretData, wr as RotateWebhookSecretResponses, wt as DeleteEmailResponse, x as deleteDomain, xi as VerifyDomainErrors, xn as GetStorageStatsErrors, xr as RotateWebhookSecretError, xt as DeleteEmailData, y as createEndpoint, yi as VerifyDomainData, yn as GetStorageStatsData, yr as ResourceId, yt as DeleteDomainResponse, z as replyToEmail, zn as ListDomainsResponses, zr as StorageStats, zt as DomainVerifyResult } from "../index-ChLFXxTa.js";
2
+ export { Account, AccountUpdated, AddDomainData, AddDomainError, AddDomainErrors, AddDomainInput, AddDomainResponse, AddDomainResponses, Auth, ClientOptions, CreateClientConfig, CreateEndpointData, CreateEndpointError, CreateEndpointErrors, CreateEndpointInput, CreateEndpointResponse, CreateEndpointResponses, CreateFilterData, CreateFilterError, CreateFilterErrors, CreateFilterInput, CreateFilterResponse, CreateFilterResponses, Cursor, DEFAULT_BASE_URL, DeleteDomainData, DeleteDomainError, DeleteDomainErrors, DeleteDomainResponse, DeleteDomainResponses, DeleteEmailData, DeleteEmailError, DeleteEmailErrors, DeleteEmailResponse, DeleteEmailResponses, DeleteEndpointData, DeleteEndpointError, DeleteEndpointErrors, DeleteEndpointResponse, DeleteEndpointResponses, DeleteFilterData, DeleteFilterError, DeleteFilterErrors, DeleteFilterResponse, DeleteFilterResponses, DeliveryStatus, DeliverySummary, Domain, DomainVerifyResult, DownloadAttachmentsData, DownloadAttachmentsError, DownloadAttachmentsErrors, DownloadAttachmentsResponse, DownloadAttachmentsResponses, DownloadRawEmailData, DownloadRawEmailError, DownloadRawEmailErrors, DownloadRawEmailResponse, DownloadRawEmailResponses, EmailDetail, EmailDetailReply, EmailSummary, Endpoint, ErrorResponse, Filter, ForwardInput, GateDenial, GateFix, GetAccountData, GetAccountError, GetAccountErrors, GetAccountResponse, GetAccountResponses, GetEmailData, GetEmailError, GetEmailErrors, GetEmailResponse, GetEmailResponses, GetSendPermissionsData, GetSendPermissionsError, GetSendPermissionsErrors, GetSendPermissionsResponse, GetSendPermissionsResponses, GetStorageStatsData, GetStorageStatsError, GetStorageStatsErrors, GetStorageStatsResponse, GetStorageStatsResponses, GetWebhookSecretData, GetWebhookSecretError, GetWebhookSecretErrors, GetWebhookSecretResponse, GetWebhookSecretResponses, Limit, ListDeliveriesData, ListDeliveriesError, ListDeliveriesErrors, ListDeliveriesResponse, ListDeliveriesResponses, ListDomainsData, ListDomainsError, ListDomainsErrors, ListDomainsResponse, ListDomainsResponses, ListEmailsData, ListEmailsError, ListEmailsErrors, ListEmailsResponse, ListEmailsResponses, ListEndpointsData, ListEndpointsError, ListEndpointsErrors, ListEndpointsResponse, ListEndpointsResponses, ListEnvelope, ListFiltersData, ListFiltersError, ListFiltersErrors, ListFiltersResponse, ListFiltersResponses, Options, PaginationMeta, PrimitiveApiClient, PrimitiveApiClientOptions, PrimitiveApiError, PrimitiveApiErrorDetails, PrimitiveClient, PrimitiveClientOptions, Client as PrimitiveGeneratedApiClient, ClientOptions$1 as PrimitiveGeneratedApiClientOptions, Config as PrimitiveGeneratedApiConfig, Options$1 as PrimitiveGeneratedApiOptions, RequestOptions as PrimitiveGeneratedApiRequestOptions, RequestResult as PrimitiveGeneratedApiRequestResult, ReplayDeliveryData, ReplayDeliveryError, ReplayDeliveryErrors, ReplayDeliveryResponse, ReplayDeliveryResponses, ReplayEmailWebhooksData, ReplayEmailWebhooksError, ReplayEmailWebhooksErrors, ReplayEmailWebhooksResponse, ReplayEmailWebhooksResponses, ReplayResult, ReplyInput, ReplyToEmailData, ReplyToEmailError, ReplyToEmailErrors, ReplyToEmailResponse, ReplyToEmailResponses, ResourceId, ResponseStyle, RotateWebhookSecretData, RotateWebhookSecretError, RotateWebhookSecretErrors, RotateWebhookSecretResponse, RotateWebhookSecretResponses, SendEmailData, SendEmailError, SendEmailErrors, SendEmailResponse, SendEmailResponses, SendInput, SendMailInput, SendMailResult, SendPermissionAddress, SendPermissionAnyRecipient, SendPermissionManagedZone, SendPermissionRule, SendPermissionYourDomain, SendPermissionsMeta, SendResult, SendThreadInput, SentEmailStatus, StorageStats, SuccessEnvelope, TestEndpointData, TestEndpointError, TestEndpointErrors, TestEndpointResponse, TestEndpointResponses, TestResult, UnverifiedDomain, UpdateAccountData, UpdateAccountError, UpdateAccountErrors, UpdateAccountInput, UpdateAccountResponse, UpdateAccountResponses, UpdateDomainData, UpdateDomainError, UpdateDomainErrors, UpdateDomainInput, UpdateDomainResponse, UpdateDomainResponses, UpdateEndpointData, UpdateEndpointError, UpdateEndpointErrors, UpdateEndpointInput, UpdateEndpointResponse, UpdateEndpointResponses, UpdateFilterData, UpdateFilterError, UpdateFilterErrors, UpdateFilterInput, UpdateFilterResponse, UpdateFilterResponses, VerifiedDomain, VerifyDomainData, VerifyDomainError, VerifyDomainErrors, VerifyDomainResponse, VerifyDomainResponses, WebhookSecret, addDomain, client, createEndpoint, createFilter, createPrimitiveApiClient, createPrimitiveClient, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, downloadAttachments, downloadRawEmail, getAccount, getEmail, getSendPermissions, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, operations, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, sendEmail, testEndpoint, updateAccount, updateDomain, updateEndpoint, updateFilter, verifyDomain };
@@ -624,6 +624,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
624
624
  downloadRawEmail: () => downloadRawEmail,
625
625
  getAccount: () => getAccount,
626
626
  getEmail: () => getEmail,
627
+ getSendPermissions: () => getSendPermissions,
627
628
  getStorageStats: () => getStorageStats,
628
629
  getWebhookSecret: () => getWebhookSecret,
629
630
  listDeliveries: () => listDeliveries,
@@ -795,11 +796,15 @@ const verifyDomain = (options) => (options.client ?? client$1).post({
795
796
  ...options
796
797
  });
797
798
  /**
798
- * List emails
799
+ * List inbound emails
799
800
  *
800
- * Returns a paginated list of received emails. Supports filtering by
801
- * domain, status, date range, and free-text search across subject,
802
- * sender, and recipient fields.
801
+ * Returns a paginated list of INBOUND emails received at your
802
+ * verified domains. Outbound messages sent via /send-mail are not
803
+ * included; this endpoint is the inbox view, not a unified
804
+ * send/receive history.
805
+ *
806
+ * Supports filtering by domain, status, date range, and free-text
807
+ * search across subject, sender, and recipient fields.
803
808
  *
804
809
  */
805
810
  const listEmails = (options) => (options?.client ?? client$1).get({
@@ -1099,6 +1104,49 @@ const replayDelivery = (options) => (options.client ?? client$1).post({
1099
1104
  ...options
1100
1105
  });
1101
1106
  /**
1107
+ * List send-permission rules
1108
+ *
1109
+ * Returns a flat list of rules describing every recipient the
1110
+ * caller may send to. Each rule has a `type`, a kind-specific
1111
+ * payload, and a human-readable `description`. If any rule
1112
+ * matches the recipient, /send-mail will accept the send under
1113
+ * the recipient-scope check.
1114
+ *
1115
+ * The endpoint is the answer to "where can I send" without
1116
+ * exposing internal entitlement names. Agents that don't
1117
+ * recognize a `type` can still read the `description` prose
1118
+ * and act on it.
1119
+ *
1120
+ * Rule kinds, ordered broadest-first so an agent can stop
1121
+ * scanning at the first match:
1122
+ *
1123
+ * 1. `any_recipient` (one entry, only when the org can send
1124
+ * anywhere): every other rule below it is redundant.
1125
+ * 2. `managed_zone` (always emitted, one per Primitive-managed
1126
+ * zone): sends to any address at *.primitive.email or
1127
+ * *.email.works always succeed; no entitlement required.
1128
+ * 3. `your_domain` (one per active verified outbound domain
1129
+ * owned by the org): sends to that domain are approved.
1130
+ * 4. `address` (one per address that has authenticated
1131
+ * inbound mail to the org, capped at `meta.address_cap`):
1132
+ * sends to that exact address are approved.
1133
+ *
1134
+ * The list is informational, not an authorization check.
1135
+ * /send-mail remains the source of truth on whether an
1136
+ * individual send will succeed (it also enforces the
1137
+ * from-address and the `send_mail` entitlement, which are
1138
+ * not recipient-scope concerns and are not represented here).
1139
+ *
1140
+ */
1141
+ const getSendPermissions = (options) => (options?.client ?? client$1).get({
1142
+ security: [{
1143
+ scheme: "bearer",
1144
+ type: "http"
1145
+ }],
1146
+ url: "/send-permissions",
1147
+ ...options
1148
+ });
1149
+ /**
1102
1150
  * Send outbound email
1103
1151
  *
1104
1152
  * Sends an outbound email through Primitive's outbound relay. By default
@@ -1364,4 +1412,4 @@ function client(options = {}) {
1364
1412
  }
1365
1413
  const operations = sdk_gen_exports;
1366
1414
  //#endregion
1367
- export { rotateWebhookSecret as A, listDomains as C, replayDelivery as D, listFilters as E, updateEndpoint as F, updateFilter as I, verifyDomain as L, testEndpoint as M, updateAccount as N, replayEmailWebhooks as O, updateDomain as P, listDeliveries as S, listEndpoints as T, downloadRawEmail as _, client as a, getStorageStats as b, operations as c, createFilter as d, deleteDomain as f, downloadAttachments as g, deleteFilter as h, PrimitiveClient as i, sendEmail as j, replyToEmail as k, addDomain as l, deleteEndpoint as m, PrimitiveApiClient as n, createPrimitiveApiClient as o, deleteEmail as p, PrimitiveApiError as r, createPrimitiveClient as s, DEFAULT_BASE_URL as t, createEndpoint as u, getAccount as v, listEmails as w, getWebhookSecret as x, getEmail as y };
1415
+ export { replyToEmail as A, listDeliveries as C, listFilters as D, listEndpoints as E, updateDomain as F, updateEndpoint as I, updateFilter as L, sendEmail as M, testEndpoint as N, replayDelivery as O, updateAccount as P, verifyDomain as R, getWebhookSecret as S, listEmails as T, downloadRawEmail as _, client as a, getSendPermissions as b, operations as c, createFilter as d, deleteDomain as f, downloadAttachments as g, deleteFilter as h, PrimitiveClient as i, rotateWebhookSecret as j, replayEmailWebhooks as k, addDomain as l, deleteEndpoint as m, PrimitiveApiClient as n, createPrimitiveApiClient as o, deleteEmail as p, PrimitiveApiError as r, createPrimitiveClient as s, DEFAULT_BASE_URL as t, createEndpoint as u, getAccount as v, listDomains as w, getStorageStats as x, getEmail as y };
@@ -560,6 +560,18 @@ type EmailSummary = {
560
560
  domain_id?: string | null;
561
561
  org_id?: string | null;
562
562
  status: 'pending' | 'accepted' | 'completed' | 'rejected';
563
+ /**
564
+ * SMTP envelope sender (return-path) the inbound mail server
565
+ * accepted. For most legitimate mail this equals the bare
566
+ * address in the From header; for mailing lists, bounce
567
+ * handlers, and forwarders it is typically the bounce address
568
+ * rather than the human-visible sender.
569
+ *
570
+ * For the parsed From-header value (with display name handling
571
+ * and a sender-fallback when the header is unparseable), GET
572
+ * the email by id and use `from_email`.
573
+ *
574
+ */
563
575
  sender: string;
564
576
  recipient: string;
565
577
  subject?: string | null;
@@ -576,6 +588,20 @@ type EmailDetail = {
576
588
  message_id?: string | null;
577
589
  domain_id?: string | null;
578
590
  org_id?: string | null;
591
+ /**
592
+ * SMTP envelope sender (return-path) the inbound mail server
593
+ * accepted. Same value as `smtp_mail_from`; both fields exist
594
+ * so protocol-aware tooling can use whichever name it expects.
595
+ *
596
+ * For most legitimate mail this equals `from_email`; for
597
+ * mailing lists, bounce handlers, and forwarders it is
598
+ * typically the bounce-handling address rather than the
599
+ * human-visible sender.
600
+ *
601
+ * **For the canonical "who sent this email" value, use
602
+ * `from_email`.**
603
+ *
604
+ */
579
605
  sender: string;
580
606
  recipient: string;
581
607
  subject?: string | null;
@@ -602,13 +628,43 @@ type EmailDetail = {
602
628
  webhook_last_error?: string | null;
603
629
  webhook_fired_at?: string | null;
604
630
  smtp_helo?: string | null;
631
+ /**
632
+ * SMTP envelope MAIL FROM (return-path), as accepted by the
633
+ * inbound mail server. Same value as `sender`; both fields
634
+ * exist so protocol-aware tooling can use whichever name it
635
+ * expects.
636
+ *
637
+ * For the canonical "who sent this email" value (display name
638
+ * stripped, From-header preferred), use `from_email`.
639
+ *
640
+ */
605
641
  smtp_mail_from?: string | null;
606
642
  smtp_rcpt_to?: Array<string> | null;
643
+ /**
644
+ * Raw `From:` header from the message body, including any
645
+ * display name (e.g. `"Alice Example" <alice@example.com>`).
646
+ * Use this when you need the display name for rendering.
647
+ *
648
+ * For the bare email address (display name stripped), use
649
+ * `from_email`.
650
+ *
651
+ */
607
652
  from_header?: string | null;
608
653
  content_discarded_at?: string | null;
609
654
  content_discarded_by_delivery_id?: string | null;
610
655
  /**
611
- * Parsed from address (from_header or sender fallback)
656
+ * Bare email address parsed from the `From:` header, with
657
+ * display name stripped (e.g. `alice@example.com`). Falls
658
+ * back to `sender` (the SMTP envelope MAIL FROM) when the
659
+ * `From:` header cannot be parsed.
660
+ *
661
+ * **This is the canonical "who sent this email" field for
662
+ * most use cases**, including comparing against allowlists,
663
+ * routing replies, or displaying the sender to a user. Use
664
+ * `from_header` when you specifically need the display name,
665
+ * or `sender`/`smtp_mail_from` when you need the SMTP
666
+ * envelope value (e.g. to follow a bounce).
667
+ *
612
668
  */
613
669
  from_email: string;
614
670
  /**
@@ -779,6 +835,135 @@ type SendMailResult = {
779
835
  */
780
836
  idempotent_replay: boolean;
781
837
  };
838
+ /**
839
+ * One recipient-scope rule describing a destination the caller
840
+ * may send to. Discriminated on `type`. Each rule carries a
841
+ * human-prose `description` field intended for display.
842
+ *
843
+ * Rule kinds are stable within an SDK release. A response
844
+ * containing a `type` value not enumerated in this schema
845
+ * means the server is running a newer version than the SDK;
846
+ * upgrade the SDK to the release that matches the server's
847
+ * schema. Strict-parsing SDKs (Go, Python) will raise a
848
+ * decode error in that case rather than silently dropping
849
+ * the unknown rule, since silent drops would let an outbound
850
+ * agent reason from an incomplete view of its own permissions.
851
+ *
852
+ */
853
+ type SendPermissionRule = ({
854
+ type: 'any_recipient';
855
+ } & SendPermissionAnyRecipient) | ({
856
+ type: 'managed_zone';
857
+ } & SendPermissionManagedZone) | ({
858
+ type: 'your_domain';
859
+ } & SendPermissionYourDomain) | ({
860
+ type: 'address';
861
+ } & SendPermissionAddress);
862
+ /**
863
+ * The caller can send to any recipient. When this rule is
864
+ * present, every other rule in the response is redundant.
865
+ *
866
+ */
867
+ type SendPermissionAnyRecipient = {
868
+ type: 'any_recipient';
869
+ /**
870
+ * Human-prose summary of the rule.
871
+ */
872
+ description: string;
873
+ };
874
+ /**
875
+ * The caller can send to any address at the named
876
+ * Primitive-managed zone. Always emitted (no entitlement
877
+ * required) because Primitive owns the zone and every mailbox
878
+ * belongs to a Primitive customer by construction.
879
+ *
880
+ */
881
+ type SendPermissionManagedZone = {
882
+ type: 'managed_zone';
883
+ /**
884
+ * The managed apex domain. Sends are accepted to any
885
+ * address at the apex itself or any subdomain (e.g.
886
+ * `alice@primitive.email` and `alice@acme.primitive.email`
887
+ * both match the `primitive.email` zone rule).
888
+ *
889
+ */
890
+ zone: string;
891
+ /**
892
+ * Human-prose summary of the rule.
893
+ */
894
+ description: string;
895
+ };
896
+ /**
897
+ * The caller can send to any address at one of their own
898
+ * verified outbound domains. Emitted once per active row in
899
+ * the org's `domains` table.
900
+ *
901
+ */
902
+ type SendPermissionYourDomain = {
903
+ type: 'your_domain';
904
+ /**
905
+ * A verified outbound domain owned by the caller's org.
906
+ */
907
+ domain: string;
908
+ /**
909
+ * Human-prose summary of the rule.
910
+ */
911
+ description: string;
912
+ };
913
+ /**
914
+ * The caller can send to a specific address that has
915
+ * authenticated inbound mail to the org. Emitted once per row
916
+ * in the org's `known_send_addresses` table, capped at
917
+ * `meta.address_cap`.
918
+ *
919
+ */
920
+ type SendPermissionAddress = {
921
+ type: 'address';
922
+ /**
923
+ * The bare email address this rule grants sends to.
924
+ */
925
+ address: string;
926
+ /**
927
+ * Most recent inbound email from this address that
928
+ * authenticated successfully (DMARC pass + DKIM/SPF
929
+ * alignment). Updated on each new authenticated receipt.
930
+ *
931
+ */
932
+ last_received_at: string;
933
+ /**
934
+ * Total number of authenticated inbound emails from this
935
+ * address. Increments only when `last_received_at` advances.
936
+ *
937
+ */
938
+ received_count: number;
939
+ /**
940
+ * Human-prose summary of the rule.
941
+ */
942
+ description: string;
943
+ };
944
+ /**
945
+ * Response metadata for /send-permissions. The `address_cap`
946
+ * bounds the size of the `address` rule subset; orgs with more
947
+ * than `address_cap` known addresses almost always also hold a
948
+ * broader rule type (`any_recipient` or `your_domain`), so the
949
+ * cap is a response-size bound rather than a meaningful
950
+ * product limit.
951
+ *
952
+ */
953
+ type SendPermissionsMeta = {
954
+ /**
955
+ * Maximum number of `address` rules included in `data`.
956
+ */
957
+ address_cap: number;
958
+ /**
959
+ * True when the org has more than `address_cap` known
960
+ * addresses and the list was truncated. False when every
961
+ * known address is represented or when the org holds no
962
+ * address rules at all.
963
+ *
964
+ */
965
+ truncated: boolean;
966
+ };
782
967
  type Endpoint = {
783
968
  id: string;
784
969
  org_id: string;
@@ -1926,6 +2111,29 @@ type ReplayDeliveryResponses = {
1926
2111
  };
1927
2112
  };
1928
2113
  type ReplayDeliveryResponse = ReplayDeliveryResponses[keyof ReplayDeliveryResponses];
2114
+ type GetSendPermissionsData = {
2115
+ body?: never;
2116
+ path?: never;
2117
+ query?: never;
2118
+ url: '/send-permissions';
2119
+ };
2120
+ type GetSendPermissionsErrors = {
2121
+ /**
2122
+ * Invalid or missing API key
2123
+ */
2124
+ 401: ErrorResponse;
2125
+ };
2126
+ type GetSendPermissionsError = GetSendPermissionsErrors[keyof GetSendPermissionsErrors];
2127
+ type GetSendPermissionsResponses = {
2128
+ /**
2129
+ * Send-permission rules for the caller's org
2130
+ */
2131
+ 200: SuccessEnvelope & {
2132
+ data: Array<SendPermissionRule>;
2133
+ meta: SendPermissionsMeta;
2134
+ };
2135
+ };
2136
+ type GetSendPermissionsResponse = GetSendPermissionsResponses[keyof GetSendPermissionsResponses];
1929
2137
  type SendEmailData = {
1930
2138
  body: SendMailInput;
1931
2139
  headers?: {
@@ -1982,7 +2190,7 @@ type SendEmailResponses = {
1982
2190
  };
1983
2191
  type SendEmailResponse = SendEmailResponses[keyof SendEmailResponses];
1984
2192
  declare namespace sdk_gen_d_exports {
1985
- export { Options, addDomain, createEndpoint, createFilter, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, downloadAttachments, downloadRawEmail, getAccount, getEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, sendEmail, testEndpoint, updateAccount, updateDomain, updateEndpoint, updateFilter, verifyDomain };
2193
+ export { Options, addDomain, createEndpoint, createFilter, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, downloadAttachments, downloadRawEmail, getAccount, getEmail, getSendPermissions, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, sendEmail, testEndpoint, updateAccount, updateDomain, updateEndpoint, updateFilter, verifyDomain };
1986
2194
  }
1987
2195
  type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
1988
2196
  /**
@@ -2067,11 +2275,15 @@ declare const updateDomain: <ThrowOnError extends boolean = false>(options: Opti
2067
2275
  */
2068
2276
  declare const verifyDomain: <ThrowOnError extends boolean = false>(options: Options<VerifyDomainData, ThrowOnError>) => RequestResult<VerifyDomainResponses, VerifyDomainErrors, ThrowOnError, "fields">;
2069
2277
  /**
2070
- * List emails
2278
+ * List inbound emails
2279
+ *
2280
+ * Returns a paginated list of INBOUND emails received at your
2281
+ * verified domains. Outbound messages sent via /send-mail are not
2282
+ * included; this endpoint is the inbox view, not a unified
2283
+ * send/receive history.
2071
2284
  *
2072
- * Returns a paginated list of received emails. Supports filtering by
2073
- * domain, status, date range, and free-text search across subject,
2074
- * sender, and recipient fields.
2285
+ * Supports filtering by domain, status, date range, and free-text
2286
+ * search across subject, sender, and recipient fields.
2075
2287
  *
2076
2288
  */
2077
2289
  declare const listEmails: <ThrowOnError extends boolean = false>(options?: Options<ListEmailsData, ThrowOnError>) => RequestResult<ListEmailsResponses, ListEmailsErrors, ThrowOnError, "fields">;
@@ -2216,6 +2428,42 @@ declare const listDeliveries: <ThrowOnError extends boolean = false>(options?: O
2216
2428
  *
2217
2429
  */
2218
2430
  declare const replayDelivery: <ThrowOnError extends boolean = false>(options: Options<ReplayDeliveryData, ThrowOnError>) => RequestResult<ReplayDeliveryResponses, ReplayDeliveryErrors, ThrowOnError, "fields">;
2431
+ /**
2432
+ * List send-permission rules
2433
+ *
2434
+ * Returns a flat list of rules describing every recipient the
2435
+ * caller may send to. Each rule has a `type`, a kind-specific
2436
+ * payload, and a human-readable `description`. If any rule
2437
+ * matches the recipient, /send-mail will accept the send under
2438
+ * the recipient-scope check.
2439
+ *
2440
+ * The endpoint is the answer to "where can I send" without
2441
+ * exposing internal entitlement names. Agents that don't
2442
+ * recognize a `type` can still read the `description` prose
2443
+ * and act on it.
2444
+ *
2445
+ * Rule kinds, ordered broadest-first so an agent can stop
2446
+ * scanning at the first match:
2447
+ *
2448
+ * 1. `any_recipient` (one entry, only when the org can send
2449
+ * anywhere): every other rule below it is redundant.
2450
+ * 2. `managed_zone` (always emitted, one per Primitive-managed
2451
+ * zone): sends to any address at *.primitive.email or
2452
+ * *.email.works always succeed; no entitlement required.
2453
+ * 3. `your_domain` (one per active verified outbound domain
2454
+ * owned by the org): sends to that domain are approved.
2455
+ * 4. `address` (one per address that has authenticated
2456
+ * inbound mail to the org, capped at `meta.address_cap`):
2457
+ * sends to that exact address are approved.
2458
+ *
2459
+ * The list is informational, not an authorization check.
2460
+ * /send-mail remains the source of truth on whether an
2461
+ * individual send will succeed (it also enforces the
2462
+ * from-address and the `send_mail` entitlement, which are
2463
+ * not recipient-scope concerns and are not represented here).
2464
+ *
2465
+ */
2466
+ declare const getSendPermissions: <ThrowOnError extends boolean = false>(options?: Options<GetSendPermissionsData, ThrowOnError>) => RequestResult<GetSendPermissionsResponses, GetSendPermissionsErrors, ThrowOnError, "fields">;
2219
2467
  /**
2220
2468
  * Send outbound email
2221
2469
  *
@@ -2352,4 +2600,4 @@ declare function createPrimitiveClient(options?: PrimitiveClientOptions): Primit
2352
2600
  declare function client(options?: PrimitiveClientOptions): PrimitiveClient;
2353
2601
  declare const operations: typeof sdk_gen_d_exports;
2354
2602
  //#endregion
2355
- export { AddDomainResponse as $, ReplayDeliveryErrors as $n, UpdateEndpointResponses as $r, ErrorResponse as $t, getWebhookSecret as A, ListDomainsError as An, TestEndpointError as Ar, DeleteFilterData as At, sendEmail as B, ListEndpointsError as Bn, UpdateAccountResponse as Br, DownloadAttachmentsError as Bt, deleteEndpoint as C, Limit as Cn, SendEmailResponses as Cr, DeleteEmailResponse as Ct, getAccount as D, ListDeliveriesResponse as Dn, StorageStats as Dr, DeleteEndpointErrors as Dt, downloadRawEmail as E, ListDeliveriesErrors as En, SentEmailStatus as Er, DeleteEndpointError as Et, listFilters as F, ListEmailsError as Fn, UnverifiedDomain as Fr, DeliveryStatus as Ft, updateFilter as G, ListFiltersData as Gn, UpdateDomainInput as Gr, DownloadRawEmailError as Gt, updateAccount as H, ListEndpointsResponse as Hn, UpdateDomainData as Hr, DownloadAttachmentsResponse as Ht, replayDelivery as I, ListEmailsErrors as In, UpdateAccountData as Ir, DeliverySummary as It, AccountUpdated as J, ListFiltersResponse as Jn, UpdateEndpointData as Jr, DownloadRawEmailResponses as Jt, verifyDomain as K, ListFiltersError as Kn, UpdateDomainResponse as Kr, DownloadRawEmailErrors as Kt, replayEmailWebhooks as L, ListEmailsResponse as Ln, UpdateAccountError as Lr, Domain as Lt, listDomains as M, ListDomainsResponse as Mn, TestEndpointResponse as Mr, DeleteFilterErrors as Mt, listEmails as N, ListDomainsResponses as Nn, TestEndpointResponses as Nr, DeleteFilterResponse as Nt, getEmail as O, ListDeliveriesResponses as On, SuccessEnvelope as Or, DeleteEndpointResponse as Ot, listEndpoints as P, ListEmailsData as Pn, TestResult as Pr, DeleteFilterResponses as Pt, AddDomainInput as Q, ReplayDeliveryError as Qn, UpdateEndpointResponse as Qr, Endpoint as Qt, replyToEmail as R, ListEmailsResponses as Rn, UpdateAccountErrors as Rr, DomainVerifyResult as Rt, deleteEmail as S, GetWebhookSecretResponses as Sn, SendEmailResponse as Sr, DeleteEmailErrors as St, downloadAttachments as T, ListDeliveriesError as Tn, SendMailResult as Tr, DeleteEndpointData as Tt, updateDomain as U, ListEndpointsResponses as Un, UpdateDomainError as Ur, DownloadAttachmentsResponses as Ut, testEndpoint as V, ListEndpointsErrors as Vn, UpdateAccountResponses as Vr, DownloadAttachmentsErrors as Vt, updateEndpoint as W, ListEnvelope as Wn, UpdateDomainErrors as Wr, DownloadRawEmailData as Wt, AddDomainError as X, PaginationMeta as Xn, UpdateEndpointErrors as Xr, EmailDetailReply as Xt, AddDomainData as Y, ListFiltersResponses as Yn, UpdateEndpointError as Yr, EmailDetail as Yt, AddDomainErrors as Z, ReplayDeliveryData as Zn, UpdateEndpointInput as Zr, EmailSummary as Zt, Options as _, Options$1 as _i, GetStorageStatsResponses as _n, RotateWebhookSecretResponse as _r, DeleteDomainErrors as _t, PrimitiveApiError as a, UpdateFilterResponses as ai, GetAccountErrors as an, ReplayEmailWebhooksResponse as ar, CreateEndpointInput as at, createFilter as b, ResponseStyle as bi, GetWebhookSecretErrors as bn, SendEmailError as br, DeleteEmailData as bt, PrimitiveClientOptions as c, VerifyDomainError as ci, GetEmailData as cn, ReplyToEmailData as cr, CreateFilterData as ct, SendResult as d, VerifyDomainResponses as di, GetEmailResponse as dn, ReplyToEmailResponse as dr, CreateFilterInput as dt, UpdateFilterData as ei, Filter as en, ReplayDeliveryResponse as er, AddDomainResponses as et, SendThreadInput as f, WebhookSecret as fi, GetEmailResponses as fn, ReplyToEmailResponses as fr, CreateFilterResponse as ft, operations as g, CreateClientConfig as gi, GetStorageStatsResponse as gn, RotateWebhookSecretErrors as gr, DeleteDomainError as gt, createPrimitiveClient as h, Config as hi, GetStorageStatsErrors as hn, RotateWebhookSecretError as hr, DeleteDomainData as ht, PrimitiveApiClientOptions as i, UpdateFilterResponse as ii, GetAccountError as in, ReplayEmailWebhooksErrors as ir, CreateEndpointErrors as it, listDeliveries as j, ListDomainsErrors as jn, TestEndpointErrors as jr, DeleteFilterError as jt, getStorageStats as k, ListDomainsData as kn, TestEndpointData as kr, DeleteEndpointResponses as kt, ReplyInput as l, VerifyDomainErrors as li, GetEmailError as ln, ReplyToEmailError as lr, CreateFilterError as lt, createPrimitiveApiClient as m, ClientOptions$1 as mi, GetStorageStatsError as mn, RotateWebhookSecretData as mr, Cursor as mt, ForwardInput as n, UpdateFilterErrors as ni, GateFix as nn, ReplayEmailWebhooksData as nr, CreateEndpointData as nt, PrimitiveApiErrorDetails as o, VerifiedDomain as oi, GetAccountResponse as on, ReplayEmailWebhooksResponses as or, CreateEndpointResponse as ot, client as p, Client as pi, GetStorageStatsData as pn, ResourceId as pr, CreateFilterResponses as pt, Account as q, ListFiltersErrors as qn, UpdateDomainResponses as qr, DownloadRawEmailResponse as qt, PrimitiveApiClient as r, UpdateFilterInput as ri, GetAccountData as rn, ReplayEmailWebhooksError as rr, CreateEndpointError as rt, PrimitiveClient as s, VerifyDomainData as si, GetAccountResponses as sn, ReplayResult as sr, CreateEndpointResponses as st, DEFAULT_BASE_URL as t, UpdateFilterError as ti, GateDenial as tn, ReplayDeliveryResponses as tr, ClientOptions as tt, SendInput as u, VerifyDomainResponse as ui, GetEmailErrors as un, ReplyToEmailErrors as ur, CreateFilterErrors as ut, addDomain as v, RequestOptions as vi, GetWebhookSecretData as vn, RotateWebhookSecretResponses as vr, DeleteDomainResponse as vt, deleteFilter as w, ListDeliveriesData as wn, SendMailInput as wr, DeleteEmailResponses as wt, deleteDomain as x, Auth as xi, GetWebhookSecretResponse as xn, SendEmailErrors as xr, DeleteEmailError as xt, createEndpoint as y, RequestResult as yi, GetWebhookSecretError as yn, SendEmailData as yr, DeleteDomainResponses as yt, rotateWebhookSecret as z, ListEndpointsData as zn, UpdateAccountInput as zr, DownloadAttachmentsData as zt };
2603
+ export { AddDomainInput as $, ListFiltersErrors as $n, UpdateAccountResponses as $r, Endpoint as $t, getStorageStats as A, RequestOptions as Ai, ListDeliveriesData as An, SendMailInput as Ar, DeleteEndpointResponses as At, rotateWebhookSecret as B, ListEmailsData as Bn, SuccessEnvelope as Br, DownloadAttachmentsData as Bt, deleteEndpoint as C, VerifyDomainResponses as Ci, GetStorageStatsResponses as Cn, RotateWebhookSecretResponse as Cr, DeleteEmailErrors as Ct, getAccount as D, Config as Di, GetWebhookSecretResponse as Dn, SendEmailErrors as Dr, DeleteEndpointError as Dt, downloadRawEmail as E, ClientOptions$1 as Ei, GetWebhookSecretErrors as En, SendEmailError as Er, DeleteEndpointData as Et, listEndpoints as F, ListDomainsData as Fn, SendPermissionRule as Fr, DeleteFilterResponses as Ft, updateEndpoint as G, ListEndpointsData as Gn, TestEndpointResponses as Gr, DownloadRawEmailData as Gt, testEndpoint as H, ListEmailsErrors as Hn, TestEndpointError as Hr, DownloadAttachmentsErrors as Ht, listFilters as I, ListDomainsError as In, SendPermissionYourDomain as Ir, DeliveryStatus as It, Account as J, ListEndpointsResponse as Jn, UpdateAccountData as Jr, DownloadRawEmailResponse as Jt, updateFilter as K, ListEndpointsError as Kn, TestResult as Kr, DownloadRawEmailError as Kt, replayDelivery as L, ListDomainsErrors as Ln, SendPermissionsMeta as Lr, DeliverySummary as Lt, listDeliveries as M, ResponseStyle as Mi, ListDeliveriesErrors as Mn, SendPermissionAddress as Mr, DeleteFilterError as Mt, listDomains as N, Auth as Ni, ListDeliveriesResponse as Nn, SendPermissionAnyRecipient as Nr, DeleteFilterErrors as Nt, getEmail as O, CreateClientConfig as Oi, GetWebhookSecretResponses as On, SendEmailResponse as Or, DeleteEndpointErrors as Ot, listEmails as P, ListDeliveriesResponses as Pn, SendPermissionManagedZone as Pr, DeleteFilterResponse as Pt, AddDomainErrors as Q, ListFiltersError as Qn, UpdateAccountResponse as Qr, EmailSummary as Qt, replayEmailWebhooks as R, ListDomainsResponse as Rn, SentEmailStatus as Rr, Domain as Rt, deleteEmail as S, VerifyDomainResponse as Si, GetStorageStatsResponse as Sn, RotateWebhookSecretErrors as Sr, DeleteEmailError as St, downloadAttachments as T, Client as Ti, GetWebhookSecretError as Tn, SendEmailData as Tr, DeleteEmailResponses as Tt, updateAccount as U, ListEmailsResponse as Un, TestEndpointErrors as Ur, DownloadAttachmentsResponse as Ut, sendEmail as V, ListEmailsError as Vn, TestEndpointData as Vr, DownloadAttachmentsError as Vt, updateDomain as W, ListEmailsResponses as Wn, TestEndpointResponse as Wr, DownloadAttachmentsResponses as Wt, AddDomainData as X, ListEnvelope as Xn, UpdateAccountErrors as Xr, EmailDetail as Xt, AccountUpdated as Y, ListEndpointsResponses as Yn, UpdateAccountError as Yr, DownloadRawEmailResponses as Yt, AddDomainError as Z, ListFiltersData as Zn, UpdateAccountInput as Zr, EmailDetailReply as Zt, Options as _, UpdateFilterResponses as _i, GetSendPermissionsResponse as _n, ReplyToEmailResponse as _r, DeleteDomainError as _t, PrimitiveApiError as a, UpdateDomainResponses as ai, GetAccountError as an, ReplayDeliveryErrors as ar, CreateEndpointErrors as at, createFilter as b, VerifyDomainError as bi, GetStorageStatsError as bn, RotateWebhookSecretData as br, DeleteDomainResponses as bt, PrimitiveClientOptions as c, UpdateEndpointErrors as ci, GetAccountResponses as cn, ReplayEmailWebhooksData as cr, CreateEndpointResponses as ct, SendResult as d, UpdateEndpointResponses as di, GetEmailErrors as dn, ReplayEmailWebhooksResponse as dr, CreateFilterErrors as dt, UpdateDomainData as ei, ErrorResponse as en, ListFiltersResponse as er, AddDomainResponse as et, SendThreadInput as f, UpdateFilterData as fi, GetEmailResponse as fn, ReplayEmailWebhooksResponses as fr, CreateFilterInput as ft, operations as g, UpdateFilterResponse as gi, GetSendPermissionsErrors as gn, ReplyToEmailErrors as gr, DeleteDomainData as gt, createPrimitiveClient as h, UpdateFilterInput as hi, GetSendPermissionsError as hn, ReplyToEmailError as hr, Cursor as ht, PrimitiveApiClientOptions as i, UpdateDomainResponse as ii, GetAccountData as in, ReplayDeliveryError as ir, CreateEndpointError as it, getWebhookSecret as j, RequestResult as ji, ListDeliveriesError as jn, SendMailResult as jr, DeleteFilterData as jt, getSendPermissions as k, Options$1 as ki, Limit as kn, SendEmailResponses as kr, DeleteEndpointResponse as kt, ReplyInput as l, UpdateEndpointInput as li, GetEmailData as ln, ReplayEmailWebhooksError as lr, CreateFilterData as lt, createPrimitiveApiClient as m, UpdateFilterErrors as mi, GetSendPermissionsData as mn, ReplyToEmailData as mr, CreateFilterResponses as mt, ForwardInput as n, UpdateDomainErrors as ni, GateDenial as nn, PaginationMeta as nr, ClientOptions as nt, PrimitiveApiErrorDetails as o, UpdateEndpointData as oi, GetAccountErrors as on, ReplayDeliveryResponse as or, CreateEndpointInput as ot, client as p, UpdateFilterError as pi, GetEmailResponses as pn, ReplayResult as pr, CreateFilterResponse as pt, verifyDomain as q, ListEndpointsErrors as qn, UnverifiedDomain as qr, DownloadRawEmailErrors as qt, PrimitiveApiClient as r, UpdateDomainInput as ri, GateFix as rn, ReplayDeliveryData as rr, CreateEndpointData as rt, PrimitiveClient as s, UpdateEndpointError as si, GetAccountResponse as sn, ReplayDeliveryResponses as sr, CreateEndpointResponse as st, DEFAULT_BASE_URL as t, UpdateDomainError as ti, Filter as tn, ListFiltersResponses as tr, AddDomainResponses as tt, SendInput as u, UpdateEndpointResponse as ui, GetEmailError as un, ReplayEmailWebhooksErrors as ur, CreateFilterError as ut, addDomain as v, VerifiedDomain as vi, GetSendPermissionsResponses as vn, ReplyToEmailResponses as vr, DeleteDomainErrors as vt, deleteFilter as w, WebhookSecret as wi, GetWebhookSecretData as wn, RotateWebhookSecretResponses as wr, DeleteEmailResponse as wt, deleteDomain as x, VerifyDomainErrors as xi, GetStorageStatsErrors as xn, RotateWebhookSecretError as xr, DeleteEmailData as xt, createEndpoint as y, VerifyDomainData as yi, GetStorageStatsData as yn, ResourceId as yr, DeleteDomainResponse as yt, replyToEmail as z, ListDomainsResponses as zn, StorageStats as zr, DomainVerifyResult as zt };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { A as UnknownEvent, C as ParsedDataFailed, D as RawContentDownloadOnly, E as RawContent, M as WebhookAttachment, N as WebhookEvent, O as RawContentInline, S as ParsedDataComplete, T as ParsedStatus, _ as ForwardResultInline, a as DmarcPolicy, b as KnownWebhookEvent, c as EmailAnalysis, d as EventType, f as ForwardAnalysis, g as ForwardResultAttachmentSkipped, h as ForwardResultAttachmentAnalyzed, i as DkimSignature, j as ValidateEmailAuthResult, k as SpfResult, l as EmailAuth, m as ForwardResult, n as AuthVerdict, o as DmarcResult, p as ForwardOriginalSender, r as DkimResult, s as EmailAddress, t as AuthConfidence, u as EmailReceivedEvent, v as ForwardVerdict, w as ParsedError, x as ParsedData, y as ForwardVerification } from "./types-9vXGZjPd.js";
2
2
  import { a as buildReplySubject, c as parseHeaderAddress, i as buildForwardSubject, n as ReceivedEmailAddress, o as formatAddress, r as ReceivedEmailThread, s as normalizeReceivedEmail, t as ReceivedEmail } from "./received-email-DNjpq_Wt.js";
3
- import { a as PrimitiveApiError, c as PrimitiveClientOptions, d as SendResult, f as SendThreadInput, h as createPrimitiveClient, l as ReplyInput, n as ForwardInput, p as client, s as PrimitiveClient, u as SendInput } from "./index-K4KbjppU.js";
3
+ import { a as PrimitiveApiError, c as PrimitiveClientOptions, d as SendResult, f as SendThreadInput, h as createPrimitiveClient, l as ReplyInput, n as ForwardInput, p as client, s as PrimitiveClient, u as SendInput } from "./index-ChLFXxTa.js";
4
4
  import { A as VerifyOptions, B as PAYLOAD_ERRORS, C as signStandardWebhooksPayload, D as PRIMITIVE_CONFIRMED_HEADER, E as LEGACY_SIGNATURE_HEADER, F as VerifyDownloadTokenResult, G as VERIFICATION_ERRORS, H as RAW_EMAIL_ERRORS, I as generateDownloadToken, J as WebhookPayloadErrorCode, K as WebhookErrorCode, L as verifyDownloadToken, M as verifyWebhookSignature, N as GenerateDownloadTokenOptions, O as PRIMITIVE_SIGNATURE_HEADER, P as VerifyDownloadTokenOptions, Q as WebhookVerificationErrorCode, R as safeValidateEmailReceivedEvent, S as StandardWebhooksVerifyOptions, T as LEGACY_CONFIRMED_HEADER, U as RawEmailDecodeError, V as PrimitiveWebhookError, W as RawEmailDecodeErrorCode, X as WebhookValidationErrorCode, Y as WebhookValidationError, Z as WebhookVerificationError, _ as emailReceivedEventJsonSchema, a as confirmedHeaders, b as STANDARD_WEBHOOK_TIMESTAMP_HEADER, c as handleWebhook, d as isRawIncluded, f as parseWebhookEvent, g as validateEmailAuth, h as WEBHOOK_VERSION, i as WebhookHeaders, j as signWebhookPayload, k as SignResult, l as isDownloadExpired, m as verifyRawEmailDownload, n as HandleWebhookOptions, o as decodeRawEmail, p as receive, q as WebhookPayloadError, r as ReceiveRequestOptions, s as getDownloadTimeRemaining, t as DecodeRawEmailOptions, u as isEmailReceivedEvent, v as STANDARD_WEBHOOK_ID_HEADER, w as verifyStandardWebhooksSignature, x as StandardWebhooksSignResult, y as STANDARD_WEBHOOK_SIGNATURE_HEADER, z as validateEmailReceivedEvent } from "./index-CbEivn3S.js";
5
5
 
6
6
  //#region src/index.d.ts
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as parseHeaderAddress, i as normalizeReceivedEmail, n as buildReplySubject, r as formatAddress, t as buildForwardSubject } from "./received-email-D6tKtWwW.js";
2
- import { a as client, i as PrimitiveClient, r as PrimitiveApiError, s as createPrimitiveClient } from "./api-CLLpjjWy.js";
2
+ import { a as client, i as PrimitiveClient, r as PrimitiveApiError, s as createPrimitiveClient } from "./api-DvJpdOJ8.js";
3
3
  import { A as PRIMITIVE_CONFIRMED_HEADER, B as RAW_EMAIL_ERRORS, C as STANDARD_WEBHOOK_ID_HEADER, D as verifyStandardWebhooksSignature, E as signStandardWebhooksPayload, F as verifyDownloadToken, G as WebhookVerificationError, H as VERIFICATION_ERRORS, I as safeValidateEmailReceivedEvent, L as validateEmailReceivedEvent, M as signWebhookPayload, N as verifyWebhookSignature, O as LEGACY_CONFIRMED_HEADER, P as generateDownloadToken, R as PAYLOAD_ERRORS, S as emailReceivedEventJsonSchema, T as STANDARD_WEBHOOK_TIMESTAMP_HEADER, U as WebhookPayloadError, V as RawEmailDecodeError, W as WebhookValidationError, _ as DmarcResult, a as isDownloadExpired, b as ParsedStatus, c as parseWebhookEvent, d as WEBHOOK_VERSION, f as validateEmailAuth, g as DmarcPolicy, h as DkimResult, i as handleWebhook, j as PRIMITIVE_SIGNATURE_HEADER, k as LEGACY_SIGNATURE_HEADER, l as receive, m as AuthVerdict, n as decodeRawEmail, o as isEmailReceivedEvent, p as AuthConfidence, r as getDownloadTimeRemaining, s as isRawIncluded, t as confirmedHeaders, u as verifyRawEmailDownload, v as EventType, w as STANDARD_WEBHOOK_SIGNATURE_HEADER, x as SpfResult, y as ForwardVerdict, z as PrimitiveWebhookError } from "./webhook-zkN4wUTs.js";
4
4
  //#region src/index.ts
5
5
  const primitive = {
@@ -67,8 +67,22 @@ function extractBodyFields(schema) {
67
67
  kind = "complex";
68
68
  }
69
69
  }
70
+ // Pull the first paragraph of the schema description for use
71
+ // as the CLI flag's --help string. We split on a blank line
72
+ // (paragraph break) and then collapse any soft line wraps
73
+ // inside that paragraph to spaces. This avoids the previous
74
+ // bug where `split("\n")[0]` truncated wrapped prose like
75
+ // "Optional override for ... Defaults to\nthe inbound's..."
76
+ // to "Optional override for ... Defaults to" - a sentence
77
+ // ending with "to" with nothing after it, which read as
78
+ // ellipsis truncation in --help. The remaining paragraphs
79
+ // are intentionally dropped so multi-paragraph schemas don't
80
+ // blow out the per-flag help block.
70
81
  const description = typeof propSchema.description === "string"
71
- ? propSchema.description.split("\n")[0].trim()
82
+ ? propSchema.description
83
+ .split(/\n\s*\n/)[0]
84
+ .replace(/\s*\n\s*/g, " ")
85
+ .trim()
72
86
  : "";
73
87
  const enumRaw = propSchema.enum;
74
88
  const enumValues = kind === "string" && Array.isArray(enumRaw)
@@ -242,6 +256,52 @@ export function formatErrorPayload(payload) {
242
256
  }
243
257
  return JSON.stringify(payload, null, 2);
244
258
  }
259
+ // Pull the top-level error code out of either a server response
260
+ // payload (`{ error: { code: '...' } }` or `{ code: '...' }`) or a
261
+ // thrown Error whose `cause.code` carries the value. Used to drive
262
+ // `--api-key` and similar hints in writeErrorWithHints below.
263
+ // Also exported so individual commands (send, whoami) can branch
264
+ // on auth failures and avoid surfacing misleading "fix this flag"
265
+ // guidance when the real problem is the API key.
266
+ export function extractErrorCode(payload) {
267
+ if (payload instanceof Error) {
268
+ const { code } = extractCauseDetails(payload.cause);
269
+ return code;
270
+ }
271
+ if (payload && typeof payload === "object") {
272
+ const inner = payload.error;
273
+ if (inner && typeof inner === "object" && typeof inner.code === "string") {
274
+ return inner.code;
275
+ }
276
+ const direct = payload.code;
277
+ if (typeof direct === "string")
278
+ return direct;
279
+ }
280
+ return undefined;
281
+ }
282
+ // Common-case actionable hints keyed by error code. The full
283
+ // JSON envelope still goes to stderr unchanged for any caller
284
+ // that wants to parse it; the hint is an extra trailing line so
285
+ // a human reading the output sees "what to actually do next."
286
+ // The AGX walkthrough flagged that an `unauthorized` envelope
287
+ // alone left the agent without context for the env var or the
288
+ // `--api-key` flag; this closes that gap without having to
289
+ // special-case every command.
290
+ const ERROR_CODE_HINTS = {
291
+ unauthorized: "Hint: pass --api-key explicitly, or set PRIMITIVE_API_KEY in your environment. `primitive whoami` is the fastest way to verify a key is live.",
292
+ };
293
+ // Write a server / SDK error to stderr in the canonical envelope
294
+ // shape, plus an actionable hint when the code is one we know how
295
+ // to advise on. Replaces the bare
296
+ // `process.stderr.write(${formatErrorPayload(p)}\n)` dance every
297
+ // command was doing.
298
+ export function writeErrorWithHints(payload) {
299
+ process.stderr.write(`${formatErrorPayload(payload)}\n`);
300
+ const code = extractErrorCode(payload);
301
+ if (code && ERROR_CODE_HINTS[code]) {
302
+ process.stderr.write(`${ERROR_CODE_HINTS[code]}\n`);
303
+ }
304
+ }
245
305
  // Reserved flag names the body-field expander must never overwrite.
246
306
  // `--raw-body` and `--body-file` are the JSON escape hatches.
247
307
  // `--api-key`, `--base-url`, `--output` are infra. Path and query
@@ -266,22 +326,23 @@ const RESERVED_FLAG_NAMES = new Set([
266
326
  "output",
267
327
  ]);
268
328
  function bodyFieldFlag(field) {
269
- // Flag descriptions cap at 80 chars so oclif's --help output
270
- // stays readable; the schema's full description is also visible
271
- // via `primitive list-operations | jq`.
272
- const descMax = 80;
273
- const trimmedDesc = field.description.length > descMax
274
- ? `${field.description.slice(0, descMax - 3)}...`
275
- : field.description;
329
+ // Pass the full first-line description through. oclif's --help
330
+ // renderer wraps long values across multiple lines on its own,
331
+ // so a fixed character cap here just produces ellipsis-truncated
332
+ // sentences ("body_html is required. Th...") that mislead the
333
+ // reader. extractBodyFields already normalizes by taking only
334
+ // the first paragraph of the schema description, so multi-
335
+ // paragraph fields don't blow out the help.
336
+ //
276
337
  // Field-flag UX choice: do NOT mark scalar body fields as
277
338
  // required at the oclif level even when the JSON Schema marks
278
339
  // them required. Reason: a caller can satisfy the requirement
279
- // either via the individual flag OR via --body / --body-file.
340
+ // either via the individual flag OR via --raw-body / --body-file.
280
341
  // Marking the flag required would force the individual-flag
281
342
  // form. The runtime body merger validates the final assembled
282
343
  // body against the same server-side schema either way.
283
344
  const common = {
284
- description: trimmedDesc || field.name,
345
+ description: field.description || field.name,
285
346
  };
286
347
  if (field.kind === "boolean")
287
348
  return Flags.boolean(common);
@@ -460,8 +521,7 @@ export function createOperationCommand(operation) {
460
521
  responseStyle: "fields",
461
522
  });
462
523
  if (result.error) {
463
- const errorPayload = extractErrorPayload(result.error);
464
- process.stderr.write(`${formatErrorPayload(errorPayload)}\n`);
524
+ writeErrorWithHints(extractErrorPayload(result.error));
465
525
  process.exitCode = 1;
466
526
  return;
467
527
  }
@@ -1,7 +1,7 @@
1
1
  import { Command, Errors, Flags } from "@oclif/core";
2
2
  import { listDomains, sendEmail } from "../../api/generated/sdk.gen.js";
3
3
  import { PrimitiveApiClient } from "../../api/index.js";
4
- import { extractErrorPayload, formatErrorPayload } from "../api-command.js";
4
+ import { extractErrorCode, extractErrorPayload, formatErrorPayload, writeErrorWithHints, } from "../api-command.js";
5
5
  // `primitive send` is the agent-grade shortcut for the most common
6
6
  // case: send a fresh outbound email. It wraps `sending:send-email`
7
7
  // with two ergonomic defaults that the underlying operation can't
@@ -52,6 +52,20 @@ async function pickDefaultFromAddress(apiClient) {
52
52
  });
53
53
  if (result.error) {
54
54
  const errorPayload = extractErrorPayload(result.error);
55
+ // If the underlying failure is an auth problem, don't pretend
56
+ // --from will fix it: the actual sendEmail call would 401 too.
57
+ // Surface the auth hint via writeErrorWithHints and bail with
58
+ // a focused message instead of the verbose "underlying error"
59
+ // wrapping.
60
+ if (extractErrorCode(errorPayload) === "unauthorized") {
61
+ writeErrorWithHints(errorPayload);
62
+ // exit: 1 to match the run() unauthorized path (which uses
63
+ // `process.exitCode = 1`). oclif's CLIError defaults to 2,
64
+ // so without this override the same "unauthorized" condition
65
+ // exits 2 when surfaced from listDomains and 1 when surfaced
66
+ // from sendEmail, breaking callers that branch on exit code.
67
+ throw new Errors.CLIError("Cannot send: API key is missing or invalid (see hint above).", { exit: 1 });
68
+ }
55
69
  throw new Errors.CLIError(`Could not look up your verified domains to default --from. Pass --from explicitly. Underlying error: ${formatErrorPayload(errorPayload)}`);
56
70
  }
57
71
  const envelope = result.data;
@@ -147,8 +161,7 @@ class SendCommand extends Command {
147
161
  responseStyle: "fields",
148
162
  });
149
163
  if (result.error) {
150
- const errorPayload = extractErrorPayload(result.error);
151
- process.stderr.write(`${formatErrorPayload(errorPayload)}\n`);
164
+ writeErrorWithHints(extractErrorPayload(result.error));
152
165
  process.exitCode = 1;
153
166
  return;
154
167
  }
@@ -1,7 +1,7 @@
1
1
  import { Command, Errors, Flags } from "@oclif/core";
2
2
  import { getAccount } from "../../api/generated/sdk.gen.js";
3
3
  import { PrimitiveApiClient } from "../../api/index.js";
4
- import { extractErrorPayload, formatErrorPayload } from "../api-command.js";
4
+ import { extractErrorPayload, writeErrorWithHints } from "../api-command.js";
5
5
  // `primitive whoami` is the credentials smoke-test the AGX
6
6
  // walkthrough kept asking for. Before this command, a user with a
7
7
  // suspect API key had no fast way to verify "is my key live and
@@ -40,8 +40,7 @@ class WhoamiCommand extends Command {
40
40
  responseStyle: "fields",
41
41
  });
42
42
  if (result.error) {
43
- const errorPayload = extractErrorPayload(result.error);
44
- process.stderr.write(`${formatErrorPayload(errorPayload)}\n`);
43
+ writeErrorWithHints(extractErrorPayload(result.error));
45
44
  process.exitCode = 1;
46
45
  return;
47
46
  }
@@ -532,8 +532,8 @@ export const openapiDocument = {
532
532
  "/emails": {
533
533
  "get": {
534
534
  "operationId": "listEmails",
535
- "summary": "List emails",
536
- "description": "Returns a paginated list of received emails. Supports filtering by\ndomain, status, date range, and free-text search across subject,\nsender, and recipient fields.\n",
535
+ "summary": "List inbound emails",
536
+ "description": "Returns a paginated list of INBOUND emails received at your\nverified domains. Outbound messages sent via /send-mail are not\nincluded; this endpoint is the inbox view, not a unified\nsend/receive history.\n\nSupports filtering by domain, status, date range, and free-text\nsearch across subject, sender, and recipient fields.\n",
537
537
  "tags": [
538
538
  "Emails"
539
539
  ],
@@ -1522,6 +1522,53 @@ export const openapiDocument = {
1522
1522
  }
1523
1523
  }
1524
1524
  },
1525
+ "/send-permissions": {
1526
+ "get": {
1527
+ "operationId": "getSendPermissions",
1528
+ "summary": "List send-permission rules",
1529
+ "description": "Returns a flat list of rules describing every recipient the\ncaller may send to. Each rule has a `type`, a kind-specific\npayload, and a human-readable `description`. If any rule\nmatches the recipient, /send-mail will accept the send under\nthe recipient-scope check.\n\nThe endpoint is the answer to \"where can I send\" without\nexposing internal entitlement names. Agents that don't\nrecognize a `type` can still read the `description` prose\nand act on it.\n\nRule kinds, ordered broadest-first so an agent can stop\nscanning at the first match:\n\n 1. `any_recipient` (one entry, only when the org can send\n anywhere): every other rule below it is redundant.\n 2. `managed_zone` (always emitted, one per Primitive-managed\n zone): sends to any address at *.primitive.email or\n *.email.works always succeed; no entitlement required.\n 3. `your_domain` (one per active verified outbound domain\n owned by the org): sends to that domain are approved.\n 4. `address` (one per address that has authenticated\n inbound mail to the org, capped at `meta.address_cap`):\n sends to that exact address are approved.\n\nThe list is informational, not an authorization check.\n/send-mail remains the source of truth on whether an\nindividual send will succeed (it also enforces the\nfrom-address and the `send_mail` entitlement, which are\nnot recipient-scope concerns and are not represented here).\n",
1530
+ "tags": [
1531
+ "Sending"
1532
+ ],
1533
+ "responses": {
1534
+ "200": {
1535
+ "description": "Send-permission rules for the caller's org",
1536
+ "content": {
1537
+ "application/json": {
1538
+ "schema": {
1539
+ "allOf": [
1540
+ {
1541
+ "$ref": "#/components/schemas/SuccessEnvelope"
1542
+ },
1543
+ {
1544
+ "type": "object",
1545
+ "properties": {
1546
+ "data": {
1547
+ "type": "array",
1548
+ "items": {
1549
+ "$ref": "#/components/schemas/SendPermissionRule"
1550
+ }
1551
+ },
1552
+ "meta": {
1553
+ "$ref": "#/components/schemas/SendPermissionsMeta"
1554
+ }
1555
+ },
1556
+ "required": [
1557
+ "data",
1558
+ "meta"
1559
+ ]
1560
+ }
1561
+ ]
1562
+ }
1563
+ }
1564
+ }
1565
+ },
1566
+ "401": {
1567
+ "$ref": "#/components/responses/Unauthorized"
1568
+ }
1569
+ }
1570
+ }
1571
+ },
1525
1572
  "/send-mail": {
1526
1573
  "post": {
1527
1574
  "operationId": "sendEmail",
@@ -2432,7 +2479,8 @@ export const openapiDocument = {
2432
2479
  ]
2433
2480
  },
2434
2481
  "sender": {
2435
- "type": "string"
2482
+ "type": "string",
2483
+ "description": "SMTP envelope sender (return-path) the inbound mail server\naccepted. For most legitimate mail this equals the bare\naddress in the From header; for mailing lists, bounce\nhandlers, and forwarders it is typically the bounce address\nrather than the human-visible sender.\n\nFor the parsed From-header value (with display name handling\nand a sender-fallback when the header is unparseable), GET\nthe email by id and use `from_email`.\n"
2436
2484
  },
2437
2485
  "recipient": {
2438
2486
  "type": "string"
@@ -2523,7 +2571,8 @@ export const openapiDocument = {
2523
2571
  "format": "uuid"
2524
2572
  },
2525
2573
  "sender": {
2526
- "type": "string"
2574
+ "type": "string",
2575
+ "description": "SMTP envelope sender (return-path) the inbound mail server\naccepted. Same value as `smtp_mail_from`; both fields exist\nso protocol-aware tooling can use whichever name it expects.\n\nFor most legitimate mail this equals `from_email`; for\nmailing lists, bounce handlers, and forwarders it is\ntypically the bounce-handling address rather than the\nhuman-visible sender.\n\n**For the canonical \"who sent this email\" value, use\n`from_email`.**\n"
2527
2576
  },
2528
2577
  "recipient": {
2529
2578
  "type": "string"
@@ -2645,7 +2694,8 @@ export const openapiDocument = {
2645
2694
  "type": [
2646
2695
  "string",
2647
2696
  "null"
2648
- ]
2697
+ ],
2698
+ "description": "SMTP envelope MAIL FROM (return-path), as accepted by the\ninbound mail server. Same value as `sender`; both fields\nexist so protocol-aware tooling can use whichever name it\nexpects.\n\nFor the canonical \"who sent this email\" value (display name\nstripped, From-header preferred), use `from_email`.\n"
2649
2699
  },
2650
2700
  "smtp_rcpt_to": {
2651
2701
  "type": [
@@ -2660,7 +2710,8 @@ export const openapiDocument = {
2660
2710
  "type": [
2661
2711
  "string",
2662
2712
  "null"
2663
- ]
2713
+ ],
2714
+ "description": "Raw `From:` header from the message body, including any\ndisplay name (e.g. `\"Alice Example\" <alice@example.com>`).\nUse this when you need the display name for rendering.\n\nFor the bare email address (display name stripped), use\n`from_email`.\n"
2664
2715
  },
2665
2716
  "content_discarded_at": {
2666
2717
  "type": [
@@ -2677,7 +2728,7 @@ export const openapiDocument = {
2677
2728
  },
2678
2729
  "from_email": {
2679
2730
  "type": "string",
2680
- "description": "Parsed from address (from_header or sender fallback)"
2731
+ "description": "Bare email address parsed from the `From:` header, with\ndisplay name stripped (e.g. `alice@example.com`). Falls\nback to `sender` (the SMTP envelope MAIL FROM) when the\n`From:` header cannot be parsed.\n\n**This is the canonical \"who sent this email\" field for\nmost use cases**, including comparing against allowlists,\nrouting replies, or displaying the sender to a user. Use\n`from_header` when you specifically need the display name,\nor `sender`/`smtp_mail_from` when you need the SMTP\nenvelope value (e.g. to follow a bounce).\n"
2681
2732
  },
2682
2733
  "to_email": {
2683
2734
  "type": "string",
@@ -2935,6 +2986,156 @@ export const openapiDocument = {
2935
2986
  "idempotent_replay"
2936
2987
  ]
2937
2988
  },
2989
+ "SendPermissionRule": {
2990
+ "description": "One recipient-scope rule describing a destination the caller\nmay send to. Discriminated on `type`. Each rule carries a\nhuman-prose `description` field intended for display.\n\nRule kinds are stable within an SDK release. A response\ncontaining a `type` value not enumerated in this schema\nmeans the server is running a newer version than the SDK;\nupgrade the SDK to the release that matches the server's\nschema. Strict-parsing SDKs (Go, Python) will raise a\ndecode error in that case rather than silently dropping\nthe unknown rule, since silent drops would let an outbound\nagent reason from an incomplete view of its own permissions.\n",
2991
+ "discriminator": {
2992
+ "propertyName": "type",
2993
+ "mapping": {
2994
+ "any_recipient": "#/components/schemas/SendPermissionAnyRecipient",
2995
+ "managed_zone": "#/components/schemas/SendPermissionManagedZone",
2996
+ "your_domain": "#/components/schemas/SendPermissionYourDomain",
2997
+ "address": "#/components/schemas/SendPermissionAddress"
2998
+ }
2999
+ },
3000
+ "oneOf": [
3001
+ {
3002
+ "$ref": "#/components/schemas/SendPermissionAnyRecipient"
3003
+ },
3004
+ {
3005
+ "$ref": "#/components/schemas/SendPermissionManagedZone"
3006
+ },
3007
+ {
3008
+ "$ref": "#/components/schemas/SendPermissionYourDomain"
3009
+ },
3010
+ {
3011
+ "$ref": "#/components/schemas/SendPermissionAddress"
3012
+ }
3013
+ ]
3014
+ },
3015
+ "SendPermissionAnyRecipient": {
3016
+ "type": "object",
3017
+ "description": "The caller can send to any recipient. When this rule is\npresent, every other rule in the response is redundant.\n",
3018
+ "properties": {
3019
+ "type": {
3020
+ "type": "string",
3021
+ "enum": [
3022
+ "any_recipient"
3023
+ ]
3024
+ },
3025
+ "description": {
3026
+ "type": "string",
3027
+ "description": "Human-prose summary of the rule."
3028
+ }
3029
+ },
3030
+ "required": [
3031
+ "type",
3032
+ "description"
3033
+ ]
3034
+ },
3035
+ "SendPermissionManagedZone": {
3036
+ "type": "object",
3037
+ "description": "The caller can send to any address at the named\nPrimitive-managed zone. Always emitted (no entitlement\nrequired) because Primitive owns the zone and every mailbox\nbelongs to a Primitive customer by construction.\n",
3038
+ "properties": {
3039
+ "type": {
3040
+ "type": "string",
3041
+ "enum": [
3042
+ "managed_zone"
3043
+ ]
3044
+ },
3045
+ "zone": {
3046
+ "type": "string",
3047
+ "description": "The managed apex domain. Sends are accepted to any\naddress at the apex itself or any subdomain (e.g.\n`alice@primitive.email` and `alice@acme.primitive.email`\nboth match the `primitive.email` zone rule).\n"
3048
+ },
3049
+ "description": {
3050
+ "type": "string",
3051
+ "description": "Human-prose summary of the rule."
3052
+ }
3053
+ },
3054
+ "required": [
3055
+ "type",
3056
+ "zone",
3057
+ "description"
3058
+ ]
3059
+ },
3060
+ "SendPermissionYourDomain": {
3061
+ "type": "object",
3062
+ "description": "The caller can send to any address at one of their own\nverified outbound domains. Emitted once per active row in\nthe org's `domains` table.\n",
3063
+ "properties": {
3064
+ "type": {
3065
+ "type": "string",
3066
+ "enum": [
3067
+ "your_domain"
3068
+ ]
3069
+ },
3070
+ "domain": {
3071
+ "type": "string",
3072
+ "description": "A verified outbound domain owned by the caller's org."
3073
+ },
3074
+ "description": {
3075
+ "type": "string",
3076
+ "description": "Human-prose summary of the rule."
3077
+ }
3078
+ },
3079
+ "required": [
3080
+ "type",
3081
+ "domain",
3082
+ "description"
3083
+ ]
3084
+ },
3085
+ "SendPermissionAddress": {
3086
+ "type": "object",
3087
+ "description": "The caller can send to a specific address that has\nauthenticated inbound mail to the org. Emitted once per row\nin the org's `known_send_addresses` table, capped at\n`meta.address_cap`.\n",
3088
+ "properties": {
3089
+ "type": {
3090
+ "type": "string",
3091
+ "enum": [
3092
+ "address"
3093
+ ]
3094
+ },
3095
+ "address": {
3096
+ "type": "string",
3097
+ "description": "The bare email address this rule grants sends to."
3098
+ },
3099
+ "last_received_at": {
3100
+ "type": "string",
3101
+ "format": "date-time",
3102
+ "description": "Most recent inbound email from this address that\nauthenticated successfully (DMARC pass + DKIM/SPF\nalignment). Updated on each new authenticated receipt.\n"
3103
+ },
3104
+ "received_count": {
3105
+ "type": "integer",
3106
+ "description": "Total number of authenticated inbound emails from this\naddress. Increments only when `last_received_at` advances.\n"
3107
+ },
3108
+ "description": {
3109
+ "type": "string",
3110
+ "description": "Human-prose summary of the rule."
3111
+ }
3112
+ },
3113
+ "required": [
3114
+ "type",
3115
+ "address",
3116
+ "last_received_at",
3117
+ "received_count",
3118
+ "description"
3119
+ ]
3120
+ },
3121
+ "SendPermissionsMeta": {
3122
+ "type": "object",
3123
+ "description": "Response metadata for /send-permissions. The `address_cap`\nbounds the size of the `address` rule subset; orgs with more\nthan `address_cap` known addresses almost always also hold a\nbroader rule type (`any_recipient` or `your_domain`), so the\ncap is a response-size bound rather than a meaningful\nproduct limit.\n",
3124
+ "properties": {
3125
+ "address_cap": {
3126
+ "type": "integer",
3127
+ "description": "Maximum number of `address` rules included in `data`."
3128
+ },
3129
+ "truncated": {
3130
+ "type": "boolean",
3131
+ "description": "True when the org has more than `address_cap` known\naddresses and the list was truncated. False when every\nknown address is represented or when the org holds no\naddress rules at all.\n"
3132
+ }
3133
+ },
3134
+ "required": [
3135
+ "address_cap",
3136
+ "truncated"
3137
+ ]
3138
+ },
2938
3139
  "Endpoint": {
2939
3140
  "type": "object",
2940
3141
  "properties": {
@@ -371,7 +371,7 @@ export const operationManifest = [
371
371
  "binaryResponse": false,
372
372
  "bodyRequired": false,
373
373
  "command": "list-emails",
374
- "description": "Returns a paginated list of received emails. Supports filtering by\ndomain, status, date range, and free-text search across subject,\nsender, and recipient fields.\n",
374
+ "description": "Returns a paginated list of INBOUND emails received at your\nverified domains. Outbound messages sent via /send-mail are not\nincluded; this endpoint is the inbox view, not a unified\nsend/receive history.\n\nSupports filtering by domain, status, date range, and free-text\nsearch across subject, sender, and recipient fields.\n",
375
375
  "hasJsonBody": false,
376
376
  "method": "GET",
377
377
  "operationId": "listEmails",
@@ -435,7 +435,7 @@ export const operationManifest = [
435
435
  ],
436
436
  "requestSchema": null,
437
437
  "sdkName": "listEmails",
438
- "summary": "List emails",
438
+ "summary": "List inbound emails",
439
439
  "tag": "Emails",
440
440
  "tagCommand": "emails"
441
441
  },
@@ -752,6 +752,23 @@ export const operationManifest = [
752
752
  "tag": "Filters",
753
753
  "tagCommand": "filters"
754
754
  },
755
+ {
756
+ "binaryResponse": false,
757
+ "bodyRequired": false,
758
+ "command": "get-send-permissions",
759
+ "description": "Returns a flat list of rules describing every recipient the\ncaller may send to. Each rule has a `type`, a kind-specific\npayload, and a human-readable `description`. If any rule\nmatches the recipient, /send-mail will accept the send under\nthe recipient-scope check.\n\nThe endpoint is the answer to \"where can I send\" without\nexposing internal entitlement names. Agents that don't\nrecognize a `type` can still read the `description` prose\nand act on it.\n\nRule kinds, ordered broadest-first so an agent can stop\nscanning at the first match:\n\n 1. `any_recipient` (one entry, only when the org can send\n anywhere): every other rule below it is redundant.\n 2. `managed_zone` (always emitted, one per Primitive-managed\n zone): sends to any address at *.primitive.email or\n *.email.works always succeed; no entitlement required.\n 3. `your_domain` (one per active verified outbound domain\n owned by the org): sends to that domain are approved.\n 4. `address` (one per address that has authenticated\n inbound mail to the org, capped at `meta.address_cap`):\n sends to that exact address are approved.\n\nThe list is informational, not an authorization check.\n/send-mail remains the source of truth on whether an\nindividual send will succeed (it also enforces the\nfrom-address and the `send_mail` entitlement, which are\nnot recipient-scope concerns and are not represented here).\n",
760
+ "hasJsonBody": false,
761
+ "method": "GET",
762
+ "operationId": "getSendPermissions",
763
+ "path": "/send-permissions",
764
+ "pathParams": [],
765
+ "queryParams": [],
766
+ "requestSchema": null,
767
+ "sdkName": "getSendPermissions",
768
+ "summary": "List send-permission rules",
769
+ "tag": "Sending",
770
+ "tagCommand": "sending"
771
+ },
755
772
  {
756
773
  "binaryResponse": false,
757
774
  "bodyRequired": true,
@@ -342,7 +342,7 @@
342
342
  "type": "boolean"
343
343
  },
344
344
  "spam-threshold": {
345
- "description": "Global spam score threshold (0-15). Emails scoring above this are rejected. S...",
345
+ "description": "Global spam score threshold (0-15). Emails scoring above this are rejected. Set to null to disable.",
346
346
  "name": "spam-threshold",
347
347
  "hasDynamicHelp": false,
348
348
  "multiple": false,
@@ -784,7 +784,7 @@
784
784
  "emails:list-emails": {
785
785
  "aliases": [],
786
786
  "args": {},
787
- "description": "Returns a paginated list of received emails. Supports filtering by\ndomain, status, date range, and free-text search across subject,\nsender, and recipient fields.\n",
787
+ "description": "Returns a paginated list of INBOUND emails received at your\nverified domains. Outbound messages sent via /send-mail are not\nincluded; this endpoint is the inbox view, not a unified\nsend/receive history.\n\nSupports filtering by domain, status, date range, and free-text\nsearch across subject, sender, and recipient fields.\n",
788
788
  "flags": {
789
789
  "api-key": {
790
790
  "description": "Primitive API key (defaults to PRIMITIVE_API_KEY)",
@@ -872,7 +872,7 @@
872
872
  "pluginName": "@primitivedotdev/sdk",
873
873
  "pluginType": "core",
874
874
  "strict": true,
875
- "summary": "List emails",
875
+ "summary": "List inbound emails",
876
876
  "enableJsonFlag": false
877
877
  },
878
878
  "emails:replay-email-webhooks": {
@@ -1370,6 +1370,38 @@
1370
1370
  "summary": "Update a filter rule",
1371
1371
  "enableJsonFlag": false
1372
1372
  },
1373
+ "sending:get-send-permissions": {
1374
+ "aliases": [],
1375
+ "args": {},
1376
+ "description": "Returns a flat list of rules describing every recipient the\ncaller may send to. Each rule has a `type`, a kind-specific\npayload, and a human-readable `description`. If any rule\nmatches the recipient, /send-mail will accept the send under\nthe recipient-scope check.\n\nThe endpoint is the answer to \"where can I send\" without\nexposing internal entitlement names. Agents that don't\nrecognize a `type` can still read the `description` prose\nand act on it.\n\nRule kinds, ordered broadest-first so an agent can stop\nscanning at the first match:\n\n 1. `any_recipient` (one entry, only when the org can send\n anywhere): every other rule below it is redundant.\n 2. `managed_zone` (always emitted, one per Primitive-managed\n zone): sends to any address at *.primitive.email or\n *.email.works always succeed; no entitlement required.\n 3. `your_domain` (one per active verified outbound domain\n owned by the org): sends to that domain are approved.\n 4. `address` (one per address that has authenticated\n inbound mail to the org, capped at `meta.address_cap`):\n sends to that exact address are approved.\n\nThe list is informational, not an authorization check.\n/send-mail remains the source of truth on whether an\nindividual send will succeed (it also enforces the\nfrom-address and the `send_mail` entitlement, which are\nnot recipient-scope concerns and are not represented here).\n",
1377
+ "flags": {
1378
+ "api-key": {
1379
+ "description": "Primitive API key (defaults to PRIMITIVE_API_KEY)",
1380
+ "env": "PRIMITIVE_API_KEY",
1381
+ "name": "api-key",
1382
+ "hasDynamicHelp": false,
1383
+ "multiple": false,
1384
+ "type": "option"
1385
+ },
1386
+ "base-url": {
1387
+ "description": "API base URL (defaults to PRIMITIVE_API_URL or production)",
1388
+ "env": "PRIMITIVE_API_URL",
1389
+ "name": "base-url",
1390
+ "hasDynamicHelp": false,
1391
+ "multiple": false,
1392
+ "type": "option"
1393
+ }
1394
+ },
1395
+ "hasDynamicHelp": false,
1396
+ "hiddenAliases": [],
1397
+ "id": "sending:get-send-permissions",
1398
+ "pluginAlias": "@primitivedotdev/sdk",
1399
+ "pluginName": "@primitivedotdev/sdk",
1400
+ "pluginType": "core",
1401
+ "strict": true,
1402
+ "summary": "List send-permission rules",
1403
+ "enableJsonFlag": false
1404
+ },
1373
1405
  "sending:reply-to-email": {
1374
1406
  "aliases": [],
1375
1407
  "args": {},
@@ -1421,21 +1453,21 @@
1421
1453
  "type": "option"
1422
1454
  },
1423
1455
  "body-text": {
1424
- "description": "Plain-text reply body. At least one of body_text or body_html is required. Th...",
1456
+ "description": "Plain-text reply body. At least one of body_text or body_html is required. The combined UTF-8 byte length of body_text and body_html must be at most 262144 bytes (same cap as send-mail).",
1425
1457
  "name": "body-text",
1426
1458
  "hasDynamicHelp": false,
1427
1459
  "multiple": false,
1428
1460
  "type": "option"
1429
1461
  },
1430
1462
  "from": {
1431
- "description": "Optional override for the reply's From header. Defaults to",
1463
+ "description": "Optional override for the reply's From header. Defaults to the inbound's recipient. Use to add a display name (`\"Acme Support\" <agent@company.com>`) or to reply from a different verified outbound address (e.g. multi-team routing where support@ triages to billing@). The from-domain must be a verified outbound domain for your org, same as send-mail.",
1432
1464
  "name": "from",
1433
1465
  "hasDynamicHelp": false,
1434
1466
  "multiple": false,
1435
1467
  "type": "option"
1436
1468
  },
1437
1469
  "wait": {
1438
- "description": "When true, wait for the first downstream SMTP delivery outcome before returni...",
1470
+ "description": "When true, wait for the first downstream SMTP delivery outcome before returning, mirroring the send-mail `wait` semantics.",
1439
1471
  "name": "wait",
1440
1472
  "allowNo": false,
1441
1473
  "type": "boolean"
@@ -1487,7 +1519,7 @@
1487
1519
  "type": "option"
1488
1520
  },
1489
1521
  "from": {
1490
- "description": "RFC 5322 From header. The sender domain must be a verified outbound domain fo...",
1522
+ "description": "RFC 5322 From header. The sender domain must be a verified outbound domain for your organization.",
1491
1523
  "name": "from",
1492
1524
  "hasDynamicHelp": false,
1493
1525
  "multiple": false,
@@ -1501,21 +1533,21 @@
1501
1533
  "type": "option"
1502
1534
  },
1503
1535
  "to": {
1504
- "description": "Recipient address. Recipient eligibility depends on your account's outbound e...",
1536
+ "description": "Recipient address. Recipient eligibility depends on your account's outbound entitlements.",
1505
1537
  "name": "to",
1506
1538
  "hasDynamicHelp": false,
1507
1539
  "multiple": false,
1508
1540
  "type": "option"
1509
1541
  },
1510
1542
  "body-html": {
1511
- "description": "HTML message body. At least one of body_text or body_html is required. The co...",
1543
+ "description": "HTML message body. At least one of body_text or body_html is required. The combined UTF-8 byte length of body_text and body_html must be at most 262144 bytes.",
1512
1544
  "name": "body-html",
1513
1545
  "hasDynamicHelp": false,
1514
1546
  "multiple": false,
1515
1547
  "type": "option"
1516
1548
  },
1517
1549
  "body-text": {
1518
- "description": "Plain-text message body. At least one of body_text or body_html is required. ...",
1550
+ "description": "Plain-text message body. At least one of body_text or body_html is required. The combined UTF-8 byte length of body_text and body_html must be at most 262144 bytes.",
1519
1551
  "name": "body-text",
1520
1552
  "hasDynamicHelp": false,
1521
1553
  "multiple": false,
@@ -1535,7 +1567,7 @@
1535
1567
  "type": "boolean"
1536
1568
  },
1537
1569
  "wait-timeout-ms": {
1538
- "description": "Maximum time to wait for a delivery outcome when wait is true. Defaults to 30...",
1570
+ "description": "Maximum time to wait for a delivery outcome when wait is true. Defaults to 30000.",
1539
1571
  "name": "wait-timeout-ms",
1540
1572
  "hasDynamicHelp": false,
1541
1573
  "multiple": false,
@@ -1679,5 +1711,5 @@
1679
1711
  "enableJsonFlag": false
1680
1712
  }
1681
1713
  },
1682
- "version": "0.12.0"
1714
+ "version": "0.13.0"
1683
1715
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primitivedotdev/sdk",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Official Primitive Node.js SDK — webhook, api, openapi, contract, and parser modules",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",