@primitivedotdev/cli 3.0.0-preview.14 → 3.0.0-preview.16

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,12 +1,12 @@
1
- import { $ as interactionNextActions, $t as ConnectedAgentKeyRequiredError, A as openBrowser, B as serverRelationship, Bt as runtimeSessionVariableList, C as approveThenRerunHint, Ct as sendIdentityFields, D as canOfferCopyHotkey, Dt as serializeErrorPayload, E as withApproval, Et as sentHistoryWindowStart, F as formatMailWakeLine, Ft as identitySuggestions, G as claimPendingMail, Gt as readCallerMailFor, H as wakeReadCommand, Ht as withFlagSuggestion, I as latestOwnOutbound, It as loadSkillLine, J as pendingMailPath, Jt as isEmailId, K as clearConsumedPendingMail, Kt as classificationFactLines, L as readThreadContext, Lt as currentMailSessionKey, M as bareAddress, Mt as connectNextSteps, N as describeWake, O as formatBrowserLoginInstructions, Ot as successfulSendOutcome, P as displayAddress, Pt as generatedAgentName, Q as interactionHumanLine, Qt as withAttachmentWait, R as sentInThread, Rt as detectAgentRuntime, S as STEP_UP_TOKEN_FLAG_DESCRIPTION, St as reportSendCommandResult, T as terminalApprovalIo, Tt as sendWaitClampNotice, U as wakeRecipientField, Ut as emptyEmailListHint, Vt as formatAlreadySentNotice, W as wakeRelationship, Wt as mailReach, X as recordPendingMail, Xt as ATTACHMENT_WAIT_FLAG_DESCRIPTION, Y as readPendingMail, Yt as noFactsMessage, Z as removePendingMail, Zt as ATTACHMENT_WAIT_MAX_MS, _ as surfaceUnauthorizedHint, _n as sanitizeForTerminal, _t as formatPriorRepliesCheckSkipped, a as createOperationCommand, an as resolveCliApiRequestConfig, at as MAX_SEND_WAIT_TIMEOUT_MS, b as BROWSER_FLAG_DESCRIPTION, bt as formatSendRecordFailureSummary, c as formatErrorPayload, cn as RESTRICTED_ROLE_NOTE, ct as assertValidIdempotencyKey, d as isGrantRefusal, dn as isBuiltInRoleKey, dt as checkPriorReplies, et as readEmailInteraction, f as networkErrorHint, fn as revokeUserLogin, ft as classifySendError, g as runWithTiming, gn as routeWarningLines, gt as formatDeletedEarlierSendNotice, h as refusalDetails, hn as switchCurrentOrg, ht as followUpCommandPrefix, i as TIME_FLAG_DESCRIPTION, in as refuseOrgSelectionForProfile, it as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, j as explainPendingMailNotFound, jt as cliInvocation, k as listenForCopyHotkey, kt as thrownErrorExitCode, l as hasControlCharacter$1, ln as credentialsFromUserLogin, lt as buildFollowUpCommand, m as readTextFileFlag, mn as roleKeyText, mt as excludeSignalReplies, n as API_ERROR_CODES, nn as createCliApiClient, nt as replyInteractionWarning, o as extractErrorCode, on as selectedOrgFromEnv, ot as SEND_OUTCOME_HELP, p as parameterFlagName, pn as roleKeyLabel, pt as deriveSendIdempotencyKey, q as clearReadPendingMail, qt as classificationOf, r as OPERATION_PATH_FLAGS, rn as refreshStoredCliCredentials, s as extractErrorPayload, sn as CliOrgRefusedError, st as apiResultHttpStatus, t as API_BASE_URL_FLAG_DESCRIPTION, tn as createAuthenticatedCliApiClient, tt as replyExpectation, u as headerFlagName, un as fetchCliOrgs, ut as buildThrownSendFailureEnvelope, v as takesStepUp, vn as setKnownCommands, vt as formatPriorRepliesWarning, w as promptLine$2, wt as sendOutcomeExitCode, x as STEP_UP_HEADER$1, xt as priorRepliesThatWentOut, y as writeErrorWithHints, yn as operationManifest, yt as formatSendFailureSummary, z as serverMuted, zt as detectRuntimeSession } from "../api-command-BTOIanV1.js";
2
- import { $n as setMemory, $t as getOwnGrant, A as filtersFromFlags, An as listWakeAuthorizations, At as deleteWakeAuthorization, B as awaitingRejectedError, Bn as reorderRoutes, C as transientFailure, Cn as listMailboxAccess, Ct as createRoute, D as cursorFromAcceptedRows, Dn as listRoutes, E as collectNewAcceptedEmails, En as listRoles, F as AWAITING_FLAG_DESCRIPTION, Ft as downloadSentAttachmentArchiveMember, G as isAwaitingRejectedError, Gn as runWakeSchedule, Gt as getFunction, H as formatAwaitingCell, Hn as resendAgentSignupVerification, Ht as getCreditBalance, I as AWAITING_VALUES, It as downloadSentAttachmentByFilename, Jn as searchMemories, Jt as getInboxStatus, K as queryUsesAwaiting, Kt as getFunctionRouting, L as REPLY_STATE_UNSUPPORTED_CODE, Lt as getAccessMode, M as quoteDslValue, Mn as listWakeSchedules, Mt as downloadEmailAttachmentArchiveMember, N as sinceFromFlags, Nn as pollCliLogin, Nt as downloadEmailAttachmentByFilename, O as encodeReceivedAtSearchCursor, On as listSentAttachmentArchiveMembers, Ot as deleteMemory, P as sleep$3, Pn as pullWebhookEvent, Q as isEmailReceivedEvent, Qn as setFunctionSecret, Qt as getOutboundStatus, R as ReplyStateUnsupportedError, Rn as redeemCreditCode, Rt as getAccount, S as retryingOperation, Sn as listKeys, St as createKey, T as SINCE_VALUE_HELP, Tn as listRepeatingSends, Tt as createWakeSchedule, U as formatRepliesCell, Un as revokeCredential, Ut as getDefaultNetworkAgent, V as ensureSearchReportsReplyState, Vn as replyToEmail, Vt as getConversation, W as hasReplyState, Wn as rotateKey, Wt as getEmail, Xn as sendEmail, Xt as getMemory, Yn as semanticSearch, Yt as getKey, Zn as setFunctionRoute, Zt as getOrgRoutingTopology, _ as backoffDelay, _n as listEmails, _t as checkSendability, a as REPEAT_IDLE_MAX_MINUTES, ar as testFunction, at as AutomatedFilterUnsupportedError, b as pauseForTransientFailure, bn as listFunctions, bt as createEndpoint, cr as updateFunction, d as parseRepeatTick, dr as updateRoute, dt as hasAutomatedVerdict, en as getRepeatingSend, er as simulateRoute, et as parseWebhookEvent, f as preparePresenceAliveEmail, fn as listDefaultNetworkAgents, fr as updateWakeAuthorization, ft as isAutomatedRejectedError, g as WaitDeadlineReached, gn as listEmailRuleResults, gr as whoami, gt as checkDefaultNetworkContactAdmission, hn as listEmailAttachmentArchiveMembers, hr as verifyAgentSignup, ht as cancelSentEmailByIdempotencyKey, i as REPEAT_EVERY_MAX_MINUTES, in as getWakeSchedule, ir as stopRepeatFromEmail, it as AUTOMATED_VALUES, j as lateMailReread, jn as listWakeDispatches, jt as deleteWakeSchedule, k as fetchEmailSearchPage, kn as listSentEmails, kt as deleteRoute, l as parseInteractionEnvelope, ln as listAgentContacts, lr as updateKey, m as repeatStopCommand, mn as listDomains, mr as verifyAgentClaim, mt as cancelSentEmail, nn as getSentEmail, nr as startAgentSignup, nt as AUTOMATED_FILTER_UNSUPPORTED_CODE, o as REPEAT_MAX_SENDS_MAX, on as leaveOrganization, or as unsetFunctionRoute, ot as assertAutomatedVerdict, p as prepareSignalEmail, pn as listDefaultNetworkMembers, pr as updateWakeSchedule, pt as addDefaultNetworkMember, qn as searchEmails, qt as getFunctionTestRunTrace, rn as getThread, rr as startCliLogin, rt as AUTOMATED_FLAG_DESCRIPTION, s as buildRepeatStopBody, sn as listActivityObjects, sr as updateDefaultNetworkMember, st as automatedRejectedError, tn as getSendFrom, tr as startAgentClaim, tt as parseFromHeader, u as parsePresenceEnvelope, un as listAgentNetworks, ur as updateRepeatingSend, v as describeApiFailure, vn as listEndpoints, vt as cliLogout, w as waitOutRetryAfter, wn as listOrganizationPeople, wt as createWakeAuthorization, x as retryTransient, xn as listGroups, xt as createFunction, yn as listFunctionLogs, yt as completeWebhookEvent, z as assertAwaitingFilterRows, zn as removeDefaultNetworkMember, zt as getAgentContactPolicy } from "../repeats-Dj_o6c-X-B7sSj0oc.js";
3
- import { S as readBundledConnectSkill, _ as NotificationOutcomeUnknownError, a as NotificationRetryError, b as installedConnectSkillFile, c as readConversationStatusContent, d as SESSION_UUID$1, g as NativeSessionNotLoadedError, h as NativeSessionError, i as notificationReceiptPage, l as createListenHandler, m as NativeSessionDisconnectedError, n as notificationSenders, o as isRoutineNotificationContent, p as defaultSessionSocket, r as openSessionNotifications, s as notificationPartReader, t as notificationScope, u as readableDelivery, v as connectSkillTarget, x as installedVersion, y as installConnectSkill } from "../notify-session-b_0jyPIk.js";
1
+ import { $ as interactionNextActions, $t as withAttachmentWait, A as openBrowser, At as thrownErrorExitCode, B as serverRelationship, Bt as detectRuntimeSession, C as approveThenRerunHint, Ct as sendErrorMessage, D as canOfferCopyHotkey, Dt as sentHistoryWindowStart, E as withApproval, Et as sendWaitClampNotice, F as formatMailWakeLine, Ft as generatedAgentName, G as claimPendingMail, Gt as mailReach, H as wakeReadCommand, Ht as formatAlreadySentNotice, I as latestOwnOutbound, It as identitySuggestions, J as pendingMailPath, Jt as classificationOf, K as clearConsumedPendingMail, Kt as readCallerMailFor, L as readThreadContext, Lt as loadSkillLine, M as bareAddress, Mt as cliInvocation, N as describeWake, Nt as connectNextSteps, O as formatBrowserLoginInstructions, Ot as serializeErrorPayload, P as displayAddress, Q as interactionHumanLine, Qt as ATTACHMENT_WAIT_MAX_MS, R as sentInThread, Rt as currentMailSessionKey, S as STEP_UP_TOKEN_FLAG_DESCRIPTION, St as reportSendCommandResult, T as terminalApprovalIo, Tt as sendOutcomeExitCode, U as wakeRecipientField, Ut as withFlagSuggestion, Vt as runtimeSessionVariableList, W as wakeRelationship, Wt as emptyEmailListHint, X as recordPendingMail, Xt as noFactsMessage, Y as readPendingMail, Yt as isEmailId, Z as removePendingMail, Zt as ATTACHMENT_WAIT_FLAG_DESCRIPTION, _ as surfaceUnauthorizedHint, _n as routeWarningLines, _t as formatPriorRepliesCheckSkipped, a as createOperationCommand, an as refuseOrgSelectionForProfile, at as MAX_SEND_WAIT_TIMEOUT_MS, b as BROWSER_FLAG_DESCRIPTION, bn as operationManifest, bt as formatSendRecordFailureSummary, c as formatErrorPayload, cn as CliOrgRefusedError, ct as assertValidIdempotencyKey, d as isGrantRefusal, dn as fetchCliOrgs, dt as checkPriorReplies, en as ConnectedAgentKeyRequiredError, et as readEmailInteraction, f as networkErrorHint, fn as isBuiltInRoleKey, ft as classifySendError, g as runWithTiming, gn as switchCurrentOrg, gt as formatDeletedEarlierSendNotice, h as refusalDetails, hn as roleKeyText, ht as followUpCommandPrefix, i as TIME_FLAG_DESCRIPTION, in as refreshStoredCliCredentials, it as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, j as explainPendingMailNotFound, k as listenForCopyHotkey, kt as successfulSendOutcome, l as hasControlCharacter$1, ln as RESTRICTED_ROLE_NOTE, lt as buildFollowUpCommand, m as readTextFileFlag, mn as roleKeyLabel, mt as excludeSignalReplies, n as API_ERROR_CODES, nn as createAuthenticatedCliApiClient, nt as replyInteractionWarning, o as extractErrorCode, on as resolveCliApiRequestConfig, ot as SEND_OUTCOME_HELP, p as parameterFlagName, pn as revokeUserLogin, pt as deriveSendIdempotencyKey, q as clearReadPendingMail, qt as classificationFactLines, r as OPERATION_PATH_FLAGS, rn as createCliApiClient, s as extractErrorPayload, sn as selectedOrgFromEnv, st as apiResultHttpStatus, t as API_BASE_URL_FLAG_DESCRIPTION, tt as replyExpectation, u as headerFlagName, un as credentialsFromUserLogin, ut as buildThrownSendFailureEnvelope, v as takesStepUp, vn as sanitizeForTerminal, vt as formatPriorRepliesWarning, w as promptLine$2, wt as sendIdentityFields, x as STEP_UP_HEADER$1, xt as priorRepliesThatWentOut, y as writeErrorWithHints, yn as setKnownCommands, yt as formatSendFailureSummary, z as serverMuted, zt as detectAgentRuntime } from "../api-command-D1LX7Tjj.js";
2
+ import { $n as setFunctionSecret, $t as getOwnGrant, A as filtersFromFlags, An as listSentEmails, At as deleteWakeAuthorization, B as awaitingRejectedError, Bn as removeDefaultNetworkMember, C as transientFailure, Cn as listKeys, Ct as createRoute, D as cursorFromAcceptedRows, Dn as listRoles, E as collectNewAcceptedEmails, En as listRepeatingSends, F as AWAITING_FLAG_DESCRIPTION, Fn as pullWebhookEvent, Ft as downloadSentAttachmentArchiveMember, G as isAwaitingRejectedError, Gn as rotateKey, Gt as getFunction, H as formatAwaitingCell, Hn as replyToEmail, Ht as getCreditBalance, I as AWAITING_VALUES, It as downloadSentAttachmentByFilename, Jn as searchEmails, Jt as getInboxStatus, K as queryUsesAwaiting, Kn as runWakeSchedule, Kt as getFunctionRouting, L as REPLY_STATE_UNSUPPORTED_CODE, Lt as getAccessMode, M as quoteDslValue, Mn as listWakeDispatches, Mt as downloadEmailAttachmentArchiveMember, N as sinceFromFlags, Nn as listWakeSchedules, Nt as downloadEmailAttachmentByFilename, O as encodeReceivedAtSearchCursor, On as listRoutes, Ot as deleteMemory, P as sleep$3, Pn as pollCliLogin, Q as isEmailReceivedEvent, Qn as setFunctionRoute, Qt as getOutboundStatus, R as ReplyStateUnsupportedError, Rt as getAccount, S as retryingOperation, Sn as listGroups, St as createKey, T as SINCE_VALUE_HELP, Tn as listOrganizationPeople, Tt as createWakeSchedule, U as formatRepliesCell, Un as resendAgentSignupVerification, Ut as getDefaultNetworkAgent, V as ensureSearchReportsReplyState, Vn as reorderRoutes, Vt as getConversation, W as hasReplyState, Wn as revokeCredential, Wt as getEmail, Xn as semanticSearch, Xt as getMemory, Yn as searchMemories, Yt as getKey, Zn as sendEmail, Zt as getOrgRoutingTopology, _ as backoffDelay, _n as listEmailRulesCoveringMe, _r as whoami, _t as checkSendability, a as REPEAT_IDLE_MAX_MINUTES, ar as stopRepeatFromEmail, at as AutomatedFilterUnsupportedError, b as pauseForTransientFailure, bn as listFunctionLogs, bt as createEndpoint, cr as updateDefaultNetworkMember, d as parseRepeatTick, dr as updateRepeatingSend, dt as hasAutomatedVerdict, en as getRepeatingSend, er as setMemory, et as parseWebhookEvent, f as preparePresenceAliveEmail, fn as listDefaultNetworkAgents, fr as updateRoute, ft as isAutomatedRejectedError, g as WaitDeadlineReached, gn as listEmailRuleResults, gr as verifyAgentSignup, gt as checkDefaultNetworkContactAdmission, hn as listEmailAttachmentArchiveMembers, hr as verifyAgentClaim, ht as cancelSentEmailByIdempotencyKey, i as REPEAT_EVERY_MAX_MINUTES, in as getWakeSchedule, ir as startCliLogin, it as AUTOMATED_VALUES, j as lateMailReread, jn as listWakeAuthorizations, jt as deleteWakeSchedule, k as fetchEmailSearchPage, kn as listSentAttachmentArchiveMembers, kt as deleteRoute, l as parseInteractionEnvelope, ln as listAgentContacts, lr as updateFunction, m as repeatStopCommand, mn as listDomains, mr as updateWakeSchedule, mt as cancelSentEmail, nn as getSentEmail, nr as startAgentClaim, nt as AUTOMATED_FILTER_UNSUPPORTED_CODE, o as REPEAT_MAX_SENDS_MAX, on as leaveOrganization, or as testFunction, ot as assertAutomatedVerdict, p as prepareSignalEmail, pn as listDefaultNetworkMembers, pr as updateWakeAuthorization, pt as addDefaultNetworkMember, qt as getFunctionTestRunTrace, rn as getThread, rr as startAgentSignup, rt as AUTOMATED_FLAG_DESCRIPTION, s as buildRepeatStopBody, sn as listActivityObjects, sr as unsetFunctionRoute, st as automatedRejectedError, tn as getSendFrom, tr as simulateRoute, tt as parseFromHeader, u as parsePresenceEnvelope, un as listAgentNetworks, ur as updateKey, v as describeApiFailure, vn as listEmails, vt as cliLogout, w as waitOutRetryAfter, wn as listMailboxAccess, wt as createWakeAuthorization, x as retryTransient, xn as listFunctions, xt as createFunction, yn as listEndpoints, yt as completeWebhookEvent, z as assertAwaitingFilterRows, zn as redeemCreditCode, zt as getAgentContactPolicy } from "../repeats-Dj_o6c-X-BLUY-8zn.js";
3
+ import { S as readBundledConnectSkill, _ as NotificationOutcomeUnknownError, a as NotificationRetryError, b as installedConnectSkillFile, c as readConversationStatusContent, d as SESSION_UUID$1, g as NativeSessionNotLoadedError, h as NativeSessionError, i as notificationReceiptPage, l as createListenHandler, m as NativeSessionDisconnectedError, n as notificationSenders, o as isRoutineNotificationContent, p as defaultSessionSocket, r as openSessionNotifications, s as notificationPartReader, t as notificationScope, u as readableDelivery, v as connectSkillTarget, x as installedVersion, y as installConnectSkill } from "../notify-session-7oM8bkRx.js";
4
4
  import { A as AGENT_ADDRESS_ENV, C as saveCliCredentials, D as loadActiveChatState, E as deleteChatState, F as agentProfilesDirectory, H as requireDefaultLoginProfile, M as AgentConnectionSetupError, N as agentProfileDirectory, O as loadChatConversationByLocalId, P as agentProfileName, R as loadConnectedAgentProfile, S as resolveCliAuth, T as chatStatePath, W as PrimitiveApiClient, _ as deleteCliCredentials, a as normalizeCliEnvironmentName, b as loadCliCredentials, c as resolveConfigEnvironment, g as credentialsPath, h as credentialsLockPath, i as loadCliConfig, j as AGENT_PROFILE_ENV, k as saveActiveChatState, l as saveCliConfig, m as cliAccessTokenExpiresAt, n as deleteCliConfig, o as redactCliEnvironment, p as acquireCliCredentialsLock, r as emptyCliConfig, s as removeCliEnvironment, u as upsertCliEnvironment, v as deleteCliCredentialsLock, w as saveSignupCredentials, y as detectPrimitiveKeyEnvMisname } from "../cli-config-Ms_0vNjq.js";
5
5
  import { C as resolveListenSubscription, S as normalizeListenOrigin, _ as acquireListenLock, a as mailLockBusy, c as mailTime, d as readMailJson, f as removeMailFile, g as ListenStateError, h as writeMailJson, i as mailId, l as privateMailDirectory, m as withMailLock, o as mailObject, u as privateMailPermissions, y as listenIdentity } from "../shared-mail-files-BAQSGxxz.js";
6
- import { $ as saveConnectionName, A as ContactPolicyReadRetryError, B as AddressNotesApiError, C as RECEIVER_MODES, Ct as upsertManagedBlock, D as registrationSummary, Dt as refreshOwnerMemberAddressPeriodically, E as failedSessionRegistration, Et as addSessionReceiver, F as canonicalContactSelector, G as contactAgentAddress, H as runAddressNotesRequest, I as AgentDisconnectError, J as agentInvitationHash, K as runContactRequest, L as claimOverRevokedSetup, M as NetworkAdmissionPendingError, N as createNotificationContactPolicy, O as registrationSummaryLine, Ot as withOwnerMemberAddress, P as evaluateContactPolicy, Q as refusalAfterReplacement, R as clearRevokedAddresses, S as runAgentConnect, St as readManagedFile, T as verificationReplySubmitted, Tt as readHookLauncherWarning, U as ContactsApiError, V as addressNoteTarget, W as contactAddress, X as readAgentInvitation, Y as connectAgent, Z as receiverStatusCommand, _ as enrollmentResumes, _t as samePath, a as endSession, at as boundSessionProfiles, b as invitationProfileName, bt as inspectManagedBlock, c as pendingSessionDisconnects, ct as describeSessionHookChange, d as registerSession, dt as ephemeralCliReason, et as savedReceiver, f as retryPendingDisconnects, ft as findOnPath, g as enrollAgent, gt as repairClaudeHooks, h as staleSessionAgents, ht as readClaudeSettings, i as connectedProfilesForSession, it as recordHookMailCheck, j as NETWORK_ADMISSION_PENDING_RETRY_MS, k as waitForRegistrations, l as psProcessInfo, lt as describeSessionHookItem, m as runDetached, mt as inspectClaudeHooks, n as OMP_MAIN, nt as releaseRegistrationsForProfile, o as headlessClaudeRun, ot as claudeConfigDir, p as revokeStaleSessionAgents, pt as hasMachineSessionHooks, q as agentConnectionStatus, r as agentConnectionState, rt as installClaudeWakeHook, st as currentCliLocation, t as HOOK_END_GRACE_MS, tt as MACHINE_RUNTIMES, u as readClaudeHookInput, ut as ensureHookLauncher, v as connectWarnings, vt as writeClaudeSettings, w as externalReceivingState, wt as writeManagedFile, x as pollCheckCommand, xt as jsonIndentation, y as defaultAgentProfileName, yt as MachineFileError, z as disconnectAgent } from "../machine-session-BTkDAKda.js";
7
- import { a as readBeforeDeadline, c as readPresenceProjection, i as readApiBeforeDeadline, n as isPlainChatReply, o as scopedChatSenderTrust, r as isScopedChatReply, s as presenceDisposition, t as isConnectedChatCredential } from "../scoped-chat-Cqmn-k7q.js";
6
+ import { $ as saveConnectionName, A as ContactPolicyReadRetryError, B as AddressNotesApiError, C as RECEIVER_MODES, Ct as upsertManagedBlock, D as registrationSummary, Dt as refreshOwnerMemberAddressPeriodically, E as failedSessionRegistration, Et as addSessionReceiver, F as canonicalContactSelector, G as contactAgentAddress, H as runAddressNotesRequest, I as AgentDisconnectError, J as agentInvitationHash, K as runContactRequest, L as claimOverRevokedSetup, M as NetworkAdmissionPendingError, N as createNotificationContactPolicy, O as registrationSummaryLine, Ot as withOwnerMemberAddress, P as evaluateContactPolicy, Q as refusalAfterReplacement, R as clearRevokedAddresses, S as runAgentConnect, St as readManagedFile, T as verificationReplySubmitted, Tt as readHookLauncherWarning, U as ContactsApiError, V as addressNoteTarget, W as contactAddress, X as readAgentInvitation, Y as connectAgent, Z as receiverStatusCommand, _ as enrollmentResumes, _t as samePath, a as endSession, at as boundSessionProfiles, b as invitationProfileName, bt as inspectManagedBlock, c as pendingSessionDisconnects, ct as describeSessionHookChange, d as registerSession, dt as ephemeralCliReason, et as savedReceiver, f as retryPendingDisconnects, ft as findOnPath, g as enrollAgent, gt as repairClaudeHooks, h as staleSessionAgents, ht as readClaudeSettings, i as connectedProfilesForSession, it as recordHookMailCheck, j as NETWORK_ADMISSION_PENDING_RETRY_MS, k as waitForRegistrations, l as psProcessInfo, lt as describeSessionHookItem, m as runDetached, mt as inspectClaudeHooks, n as OMP_MAIN, nt as releaseRegistrationsForProfile, o as headlessClaudeRun, ot as claudeConfigDir, p as revokeStaleSessionAgents, pt as hasMachineSessionHooks, q as agentConnectionStatus, r as agentConnectionState, rt as installClaudeWakeHook, st as currentCliLocation, t as HOOK_END_GRACE_MS, tt as MACHINE_RUNTIMES, u as readClaudeHookInput, ut as ensureHookLauncher, v as connectWarnings, vt as writeClaudeSettings, w as externalReceivingState, wt as writeManagedFile, x as pollCheckCommand, xt as jsonIndentation, y as defaultAgentProfileName, yt as MachineFileError, z as disconnectAgent } from "../machine-session-DJoBSWTy.js";
7
+ import { a as readBeforeDeadline, c as readPresenceProjection, i as readApiBeforeDeadline, n as isPlainChatReply, o as scopedChatSenderTrust, r as isScopedChatReply, s as presenceDisposition, t as isConnectedChatCredential } from "../scoped-chat-CrQpmC0K.js";
8
8
  import { autoSignalEligible, dispatchAutoRead, dispatchAutoWorking, haltAutoWorking, isSentSignal, readWorkingLease, restoreAutoWorking } from "./auto-signals.js";
9
- import { a as ensureSharedMailSubscription, c as isConnectedAgentKey, d as reserveSharedMailSubscription, f as followEmailConversation, g as EventReceiverError, h as EventConnection, i as sharedMailScope, l as createSharedMailWaiter, m as otherParticipants, n as reconcileChatSend, p as readConversationFollow, r as openSharedMailReceiver, s as AGENT_CONNECTION_REQUIRED_MESSAGE, t as sendSignal, u as openSharedMailStore } from "../signal-command-ewPBzvjU.js";
9
+ import { a as ensureSharedMailSubscription, c as isConnectedAgentKey, d as reserveSharedMailSubscription, f as followEmailConversation, g as EventReceiverError, h as EventConnection, i as sharedMailScope, l as createSharedMailWaiter, m as otherParticipants, n as reconcileChatSend, p as readConversationFollow, r as openSharedMailReceiver, s as AGENT_CONNECTION_REQUIRED_MESSAGE, t as sendSignal, u as openSharedMailStore } from "../signal-command-Bkr_XwLC.js";
10
10
  import { a as thrownErrorBody, i as runStreamingJson, n as guardJsonOutputCommands, r as jsonOutputRequested, t as JSON_OUTPUT_FLAG } from "../json-output-ch756TXV.js";
11
11
  import { a as backgroundListenStatus, c as runBackgroundListen, d as stopBackgroundListen, f as verifyBackgroundListenTarget, o as backgroundListenToken, r as backgroundListenConfiguration, u as startBackgroundListen } from "../listen-background-DyBYca28.js";
12
12
  import { ORG_SELECTION_ENV } from "./global-org-flag.js";
@@ -226,7 +226,7 @@ const openapiDocument = {
226
226
  },
227
227
  {
228
228
  "name": "Email Rule Oversight",
229
- "description": "The email rules that reach your own mailboxes, whoever wrote them, read-only, and your objections to them: asking a rule's author to turn it off. The organization needs the email rules feature, and the caller must be a member with mail:read on their own dashboard session or the Primitive CLI, not narrowed.",
229
+ "description": "The email rules that reach your own mailboxes, whoever wrote them, read-only, and your objections to them: asking a rule's author to turn it off, narrow it or explain it. The organization needs the email rules feature, and the caller must be a member with mail:read on their own dashboard session or the Primitive CLI, not narrowed.",
230
230
  "x-openapi-spec": "https://api.primitive.dev/v1/openapi/tags/email-rule-oversight"
231
231
  },
232
232
  {
@@ -22117,7 +22117,7 @@ const openapiDocument = {
22117
22117
  "/email-rules/test": { "post": {
22118
22118
  "operationId": "testEmailRule",
22119
22119
  "summary": "Test a rule against received mail",
22120
- "description": "Runs a rule over received mail and reports what it would decide for each email (matched, near_miss, no_match, unclassified, skipped or not_found), with a summary of how each top-level condition and question decided. Test an unsaved tree, or a saved rule by rule_id (its current version, as its author). It reads only mail its author can read and its scope covers. A rule you see only because it covers your own mailboxes runs as you, over only those, from the dashboard or the Primitive CLI. Without email_ids it tests the newest emails, at most 200 and none older than 30 days, plus any expected ones. Unclassified emails over 2 hours old are classified first unless classify_missing is false. It records no decision and grants nothing, and stops at about 90 seconds. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
22120
+ "description": "Runs a rule over received mail and reports what it would decide for each email (matched, near_miss, no_match, unclassified, skipped or not_found), with a summary of how each top-level condition and question decided. Test an unsaved tree, a saved rule by rule_id (its current version, as its author), or a pending rule request by request_id (its rule as asked, as you, over your own mailboxes). It reads only mail its author can read and its scope covers. A rule you see only because it covers your own mailboxes runs as you, over only those, from the dashboard or the Primitive CLI. Without email_ids it tests the newest emails, at most 200 and none older than 30 days, plus any expected ones. Unclassified emails over 2 hours old are classified first unless classify_missing is false. It records no decision and grants nothing, and stops at about 90 seconds. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
22121
22121
  "tags": ["Email Rules"],
22122
22122
  "security": [{ "BearerAuth": [] }],
22123
22123
  "requestBody": {
@@ -22140,7 +22140,7 @@ const openapiDocument = {
22140
22140
  }
22141
22141
  },
22142
22142
  "400": {
22143
- "description": "validation_error: give exactly one of tree and rule_id, at most 200 email_ids (with the expected emails), 1 to 100 expected emails none in both lists (or only expect.samples, up to 20), and a tree that is valid for the column contract. evaluation_scope, scope_selection and kind go only with tree. A saved rule whose current version no longer renders answers details.reason version_not_renderable; email_ids that with its saved expectations name over 200 emails, too_many_emails.",
22143
+ "description": "validation_error: give exactly one of tree, rule_id and request_id, at most 200 email_ids (with the expected emails), 1 to 100 expected emails none in both lists (or only expect.samples, up to 20), and a tree that is valid for the column contract. evaluation_scope, scope_selection and kind go only with tree. A saved rule's current version or a request's rule that no longer renders answers details.reason version_not_renderable; email_ids that with its saved expectations name over 200 emails, too_many_emails.",
22144
22144
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22145
22145
  },
22146
22146
  "401": {
@@ -22167,11 +22167,11 @@ const openapiDocument = {
22167
22167
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22168
22168
  },
22169
22169
  "404": {
22170
- "description": "not_found: rule_id names no rule you can see or that covers your mailboxes (details.reason rule_not_found).",
22170
+ "description": "not_found: rule_id names no rule you can see or that covers your mailboxes (details.reason rule_not_found), or request_id no rule request you can see (request_not_found).",
22171
22171
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22172
22172
  },
22173
22173
  "409": {
22174
- "description": "email_rule_author_unresolvable: the rule cannot run as its author (for an unsaved tree or a rule covering you, the caller). details.reason is left, revoked, suspended, membership_ended, no_mail_read, no_own_mailbox, no_shareable_mailbox or no_selected_mailbox.",
22174
+ "description": "email_rule_author_unresolvable: the rule cannot run as its author (for an unsaved tree, a request or a rule covering you, the caller). details.reason is left, revoked, suspended, membership_ended, no_mail_read, no_own_mailbox, no_shareable_mailbox or no_selected_mailbox. email_rule_request_not_pending: request_id names a request already decided.",
22175
22175
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22176
22176
  },
22177
22177
  "429": {
@@ -22319,7 +22319,7 @@ const openapiDocument = {
22319
22319
  "/email-rules/test-sample": { "post": {
22320
22320
  "operationId": "testEmailRuleOnSample",
22321
22321
  "summary": "Test a rule against a made-up email",
22322
- "description": "Reports what a rule would decide for an email you describe (sender, recipients, subject, plain text, attachment types and file names; optionally automated, from a mailing list, and a spam score), classified and decided as received mail would be. A rule reading a spam score you gave none for decides on none (unset_columns). Nothing is stored. Test an unsaved tree or a saved rule by rule_id. The answer includes what the classifier read. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
22322
+ "description": "Reports what a rule would decide for an email you describe (sender, recipients, subject, plain text, attachment types and file names; optionally automated, from a mailing list, and a spam score), classified and decided as received mail would be. A rule reading a spam score you gave none for decides on none (unset_columns). Nothing is stored. Test an unsaved tree, a saved rule by rule_id, or a pending rule request by request_id (its rule as asked, as you). The answer includes what the classifier read. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
22323
22323
  "tags": ["Email Rules"],
22324
22324
  "security": [{ "BearerAuth": [] }],
22325
22325
  "requestBody": {
@@ -22342,7 +22342,7 @@ const openapiDocument = {
22342
22342
  }
22343
22343
  },
22344
22344
  "400": {
22345
- "description": "validation_error: give exactly one of tree and rule_id (evaluation_scope, scope_selection and kind only with tree), an email with a sender, 1 to 50 To addresses (and up to 50 Cc), and a text body, and a tree that is valid for the column contract and within the size limits for a saved rule. A saved rule whose current version no longer renders answers details.reason version_not_renderable.",
22345
+ "description": "validation_error: give exactly one of tree, rule_id and request_id (evaluation_scope, scope_selection and kind only with tree), an email with a sender, 1 to 50 To addresses (and up to 50 Cc), and a text body, and a tree that is valid for the column contract and within the size limits for a saved rule. A saved rule's current version or a request's rule that no longer renders answers details.reason version_not_renderable. With with_protection: not_a_grant_rule, or protection_mailbox_outside_rule when the rule does not run over the first recipient.",
22346
22346
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22347
22347
  },
22348
22348
  "401": {
@@ -22365,15 +22365,15 @@ const openapiDocument = {
22365
22365
  }
22366
22366
  },
22367
22367
  "403": {
22368
- "description": "feature_not_enabled: this organization lacks the email rules feature; permission refusals answer forbidden or grant_forbidden. email_rule_scope_not_readable: scope_selection names something you cannot read. forbidden with details.reason covering_view_only: you read this rule only in the covering view, since it decided on your mail before and covers none of your mailboxes now (details.covering_view).",
22368
+ "description": "feature_not_enabled: this organization lacks the email rules feature; permission refusals answer forbidden or grant_forbidden. email_rule_scope_not_readable: scope_selection names something you cannot read. forbidden with details.reason covering_view_only: you read this rule only in the covering view, since it decided on your mail before and covers none of your mailboxes now (details.covering_view). grant_forbidden protection_mailbox_not_read: with_protection at a mailbox you do not read in full.",
22369
22369
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22370
22370
  },
22371
22371
  "404": {
22372
- "description": "not_found: rule_id names no rule you can see or that covers your mailboxes (details.reason rule_not_found).",
22372
+ "description": "not_found: rule_id names no rule you can see or that covers your mailboxes (details.reason rule_not_found), or request_id no rule request you can see (request_not_found).",
22373
22373
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22374
22374
  },
22375
22375
  "409": {
22376
- "description": "email_rule_author_unresolvable: the rule cannot run as its author (for an unsaved tree or a rule covering you, you), so it would decide nothing for real. details.reason is left, revoked, suspended, membership_ended, no_mail_read, no_own_mailbox, no_shareable_mailbox or no_selected_mailbox.",
22376
+ "description": "email_rule_author_unresolvable: the rule cannot run as its author (for an unsaved tree, a request or a rule covering you, you), so it would decide nothing for real. details.reason is left, revoked, suspended, membership_ended, no_mail_read, no_own_mailbox, no_shareable_mailbox or no_selected_mailbox. email_rule_request_not_pending: request_id names a request already decided.",
22377
22377
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22378
22378
  },
22379
22379
  "429": {
@@ -22398,6 +22398,10 @@ const openapiDocument = {
22398
22398
  }
22399
22399
  }
22400
22400
  } }
22401
+ },
22402
+ "503": {
22403
+ "description": "service_unavailable: with_protection could not read the do-not-share rules in time (protection_unavailable), or its limit could not be checked (protection_limit_unavailable).",
22404
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22401
22405
  }
22402
22406
  },
22403
22407
  "x-primitive-permission": ["mail:read"],
@@ -22751,7 +22755,7 @@ const openapiDocument = {
22751
22755
  "patch": {
22752
22756
  "operationId": "updateEmailRule",
22753
22757
  "summary": "Change a rule",
22754
- "description": "Renames the rule, saves a new version (english and tree together; earlier versions stay) or restores one (restore_version), changes its state (draft is off; observe; active), its scope (evaluation_scope, with scope_selection when selected) or its saved expectations (judged in expectations_check). Anyone but its author who sees it may only set state draft, and while it is shared only if they manage members from the dashboard. A scope change saves a new version; a shared rule keeps its scope, and a kind never changes. A saved version takes effect at once. if_version refuses a write once a version was saved since you read it; if_revision, once anything changed. Without if_expectations_pass a version is saved even when its expectations fail, except on an active rule keys or webhooks read: that write is checked first unless if_expectations_pass is false. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
22758
+ "description": "Renames the rule, saves a new version (english and tree together; earlier versions stay) or restores one (restore_version), changes its state (draft is off; observe; active), its scope (evaluation_scope, with scope_selection when selected) or its saved expectations (judged in expectations_check). Anyone but its author who sees it may only set state draft, and while it is shared only if they manage members from the dashboard. A scope change saves a new version; a shared rule keeps its scope, and a kind never changes. A saved version takes effect at once, on the rule's share too, which goes on under it. if_version refuses a write once a version was saved since you read it; if_revision, once anything changed. Without if_expectations_pass a version is saved even when its expectations fail, except on an active rule keys, webhooks or a share read: that write is checked first unless if_expectations_pass is false. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
22755
22759
  "tags": ["Email Rules"],
22756
22760
  "security": [{ "BearerAuth": [] }],
22757
22761
  "parameters": [{
@@ -22784,7 +22788,7 @@ const openapiDocument = {
22784
22788
  }
22785
22789
  },
22786
22790
  "400": {
22787
- "description": "validation_error: invalid body or tree (details.errors), too large (too_large), a version that no longer renders (version_not_renderable), restore_version names the current version (already_current), over 20 made-up emails (too_many_expectation_samples), or a kind other than the rule's own (kind_mismatch). no_expectations: if_expectations_pass with no expectations to judge, or a write that removes them from an active rule keys or webhooks read; nothing was saved.",
22791
+ "description": "validation_error: invalid body or tree (details.errors), too large (too_large), a version that no longer renders (version_not_renderable), restore_version names the current version (already_current), over 20 made-up emails (too_many_expectation_samples), or a kind other than the rule's own (kind_mismatch). no_expectations: if_expectations_pass with no expectations to judge, or a write that removes them from an active rule keys, webhooks or a share read; nothing was saved.",
22788
22792
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22789
22793
  },
22790
22794
  "401": {
@@ -22807,7 +22811,7 @@ const openapiDocument = {
22807
22811
  }
22808
22812
  },
22809
22813
  "403": {
22810
- "description": "feature_not_enabled: this organization lacks the email rules feature; permission refusals answer forbidden or grant_forbidden. email_rule_author_only: only the rule's author may make this change. forbidden (rule_shared): the rule is shared, so only its author or a member manager can turn it off. email_rule_scope_not_readable: scope_selection names something you cannot read. grant_forbidden (mail_depth): judging a write (if_expectations_pass, or by default) needs content access to mail when it judges emails by id.",
22814
+ "description": "feature_not_enabled: this organization lacks the email rules feature; permission refusals answer forbidden or grant_forbidden. email_rule_author_only: only the rule's author may make this change. forbidden (rule_shared): the rule is shared, so only its author or a member manager can turn it off. forbidden (first_party_required): a new version of a shared rule is saved only by its author on the dashboard or the Primitive CLI, never by an app or agent acting for them. email_rule_scope_not_readable: scope_selection names something you cannot read. grant_forbidden (mail_depth): judging a write (if_expectations_pass, or by default) needs content access to mail when it judges emails by id.",
22811
22815
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22812
22816
  },
22813
22817
  "404": {
@@ -22815,7 +22819,7 @@ const openapiDocument = {
22815
22819
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22816
22820
  },
22817
22821
  "409": {
22818
- "description": "email_rule_conflict: the rule changed (details.reason version_moved with current_version, revision_moved with current_revision, expectations_moved, rule_changed or readers_changed); read it again and retry. email_rule_scope_locked: the rule is shared. email_rule_author_unresolvable: the rule could not run as you over the chosen scope. expectations_failed, expectations_unreadable (details.unreadable) or expectations_undecided, with if_expectations_pass or by default on an active rule keys or webhooks read (details.read_by): nothing was saved; details carries current_version, state and expectations_check.",
22822
+ "description": "email_rule_conflict: the rule changed (details.reason version_moved with current_version, revision_moved with current_revision, expectations_moved, rule_changed or readers_changed); read it again and retry. email_rule_scope_locked: the rule is shared. email_rule_author_unresolvable: the rule could not run as you over the chosen scope. expectations_failed, expectations_unreadable (details.unreadable) or expectations_undecided, with if_expectations_pass or by default on an active rule keys, webhooks or a share read (details.read_by): nothing was saved; details carries current_version, state and expectations_check.",
22819
22823
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
22820
22824
  },
22821
22825
  "429": {
@@ -23089,7 +23093,7 @@ const openapiDocument = {
23089
23093
  "/emails/{id}/rule-results": { "get": {
23090
23094
  "operationId": "listEmailRuleResults",
23091
23095
  "summary": "List every rule's result on an email",
23092
- "description": "What each rule you can see decided about this email (matched, not matched, or not run), in the words of the deciding version. A do_not_share rule that matched it blocks sharing while active; earlier shares stay. Only a caller who can read the email gets an answer. classification is every fact the classifier read, as rule conditions read it. At most 50 rules are listed, results first; not_listed counts the rest. Another member's rule that decided on your own mail is listed read_only (dashboard and CLI only), with who receives what it shares (receivers) while it covers you; hidden counts deciding rules you cannot see. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
23096
+ "description": "What each rule you can see decided about this email (matched, not matched, or not run), in the words of the deciding version. A do_not_share rule that matched it blocks sharing while active; earlier shares stay. Only a caller who can read the email gets an answer. classification is every fact the classifier read, as rule conditions read it. At most 50 rules are listed, results first; not_listed counts the rest. Another member's rule that decided on your own mail is listed read_only (dashboard and CLI only), with who receives what it shares (receivers) while it covers you; hidden counts deciding rules you cannot see. Whether a rule delivered the email by webhook is not in the rule results: on your own mail, rule_deliveries on GET /v1/emails/{id} (primitive emails get <email-id> --json) counts each rule's webhook deliveries; on another member's mail, GET /v1/webhooks/deliveries?email_id=<email-id> (primitive webhook-deliveries list --email-id <email-id>, with webhooks:read) lists them. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
23093
23097
  "tags": ["Email Rules"],
23094
23098
  "security": [{ "BearerAuth": [] }],
23095
23099
  "parameters": [{
@@ -23502,7 +23506,7 @@ const openapiDocument = {
23502
23506
  "post": {
23503
23507
  "operationId": "createEmailRuleRequest",
23504
23508
  "summary": "Ask a member for a rule",
23505
- "description": "Asks another member of the organization for a rule over their own mail, from a compile response or a tree you wrote. Name them by user id, or by their member mailbox address, or by their verified work email if you can list members (at most 30 lookups by address an hour). Nothing is evaluated or shared until they accept, and they may change the rule first. A message (up to 500 characters, fixed once sent) tells them why you ask. At most 5 pending requests to one member and 50 in all. With members:read the answer says whether they can accept it under their role (target_can_accept, target_warning); POST /v1/email-rule-requests/target-check checks first. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
23509
+ "description": "Asks another member of the organization for a rule over their own mail, from a compile response or a tree you wrote. Name them by user id, or by their member mailbox address, or by their verified work email if you can list members (at most 30 lookups by address an hour). Nothing is evaluated or shared until they accept, and they may change the rule first. A message (up to 500 characters, fixed once sent) tells them why you ask. With an Idempotency-Key, asking again for exactly what a pending request of yours to the same member asks (name, english, tree, explanation and message, naming them the same way) returns that request with existing: true (200), so a retry never asks them twice. At most 5 pending requests to one member and 50 in all. With members:read the answer says whether they can accept it under their role (target_can_accept, target_warning); POST /v1/email-rule-requests/target-check checks first. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
23506
23510
  "tags": ["Email Rules"],
23507
23511
  "security": [{ "BearerAuth": [] }],
23508
23512
  "requestBody": {
@@ -23510,6 +23514,20 @@ const openapiDocument = {
23510
23514
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateEmailRuleRequestRequest" } } }
23511
23515
  },
23512
23516
  "responses": {
23517
+ "200": {
23518
+ "description": "The pending request this create matched (existing: true): no second one was made.",
23519
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
23520
+ "type": "object",
23521
+ "required": ["data"],
23522
+ "properties": { "data": { "$ref": "#/components/schemas/CreateEmailRuleRequestResult" } }
23523
+ }] } } },
23524
+ "headers": {
23525
+ "ratelimit-limit": { "$ref": "#/components/headers/ratelimit-limit" },
23526
+ "ratelimit-remaining": { "$ref": "#/components/headers/ratelimit-remaining" },
23527
+ "ratelimit-reset": { "$ref": "#/components/headers/ratelimit-reset" },
23528
+ "ratelimit-policy": { "$ref": "#/components/headers/ratelimit-policy" }
23529
+ }
23530
+ },
23513
23531
  "201": {
23514
23532
  "description": "Ask a member for a rule",
23515
23533
  "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
@@ -23581,18 +23599,18 @@ const openapiDocument = {
23581
23599
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
23582
23600
  }
23583
23601
  },
23584
- "x-primitive-permission": ["mail:read"],
23585
23602
  "parameters": [{
23586
23603
  "name": "Idempotency-Key",
23587
23604
  "in": "header",
23588
23605
  "required": false,
23589
- "description": "Optional, and not used to deduplicate: this operation stores no result by the key, so a retry with the same key runs the request again. Operations that need a credential refuse a key that is empty, longer than 255 characters or not printable ASCII with 400 `validation_error` and echo a valid one in the Idempotency-Key response header; operations that need none ignore it.",
23606
+ "description": "Optional. With a key, a create identical to a pending request of yours to the same member (name, english, tree, explanation and message, naming the member the same way) returns that request with existing: true (200) instead of making a second one. The key itself is not stored, so any key does this, and a create without one is never matched to an existing request. A key that is empty, longer than 255 characters or not printable ASCII is refused with 400 `validation_error`; a valid one is echoed in the Idempotency-Key response header.",
23590
23607
  "schema": {
23591
23608
  "type": "string",
23592
23609
  "minLength": 1,
23593
23610
  "maxLength": 255
23594
23611
  }
23595
- }]
23612
+ }],
23613
+ "x-primitive-permission": ["mail:read"]
23596
23614
  },
23597
23615
  "get": {
23598
23616
  "operationId": "listEmailRuleRequests",
@@ -24863,7 +24881,7 @@ const openapiDocument = {
24863
24881
  "/email-rules/covering-me": { "get": {
24864
24882
  "operationId": "listEmailRulesCoveringMe",
24865
24883
  "summary": "List the rules over your mail",
24866
- "description": "Every email rule that covers one of your own mailboxes now, yours included, newest first, in any state. A rule covers you when the scope it runs with now reaches one of your own mailboxes (your member mailbox, or a personal agent's address): one whose author reads all your mail (author scope, for an author who reads the organization's mail or holds an access entry for your mailbox), or one that names your mailbox or its domain (selected). Another member's own_mailboxes rule never covers you. You see its name, wording, current tree, state, kind and author, and which of your own mailboxes it reaches. Its wording and tree are shown as written, so they can name other addresses (a condition on who an email is from or to). While it covers you, you also see who receives what it matches (receivers): how many API keys, webhooks and shares, the member each belongs to (or the organization), and the sites the webhooks deliver to. You do not see which keys, webhooks or shares they are (no ids, names, prefixes, or URLs beyond the site), the other inboxes and domains its scope names, or its saved expectations. A page can hold fewer rules than limit, or none, and still carry a cursor (one request reads a bounded number of rules): keep reading until meta.cursor is null. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
24884
+ "description": "Every email rule that covers one of your own mailboxes now, yours included, newest first, in any state. A rule covers you when the scope it runs with now reaches one of your own mailboxes (your member mailbox, or a personal agent's address), and covers.via says how: author_reach, it runs over everything its author can read, which includes your mail (an author who reads the organization's mail or holds an access entry for your mailbox); selected, it names your mailbox or its domain; own_mailboxes, it is your own rule over your own mail. Another member's own_mailboxes rule never covers you. You see its name, wording, current tree, state, kind and author, and which of your own mailboxes it reaches. Its wording and tree are shown as written, so they can name other addresses (a condition on who an email is from or to). While it covers you, you also see who receives what it matches (receivers): how many API keys, webhooks and shares, the member each belongs to (or the organization), and the sites the webhooks deliver to. You do not see which keys, webhooks or shares they are (no ids, names, prefixes, or URLs beyond the site), the other inboxes and domains its scope names, or its saved expectations. Each listed rule carries its current version's english and explanation; its tree is on GET /v1/email-rules/covering-me/{id}. A page can hold fewer rules than limit, or none, and still carry a cursor (one request reads a bounded number of rules): keep reading until meta.cursor is null. For what happened to one email of yours, every rule's decision on it and, for another member's rule covering you, who receives what it shares: GET /v1/emails/{id}/rule-results (primitive email-rules list-email-rule-results --email-id <email-id>). Whether a rule delivered the email by webhook is not in the rule results: on your own mail, rule_deliveries on GET /v1/emails/{id} (primitive emails get <email-id> --json) counts each rule's webhook deliveries; on another member's mail, GET /v1/webhooks/deliveries?email_id=<email-id> (primitive webhook-deliveries list --email-id <email-id>, with webhooks:read) lists them. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
24867
24885
  "tags": ["Email Rule Oversight"],
24868
24886
  "security": [{ "BearerAuth": [] }],
24869
24887
  "parameters": [{
@@ -24961,7 +24979,7 @@ const openapiDocument = {
24961
24979
  "/email-rules/covering-me/{id}": { "get": {
24962
24980
  "operationId": "getEmailRuleCoveringMe",
24963
24981
  "summary": "Get a rule over your mail",
24964
- "description": "One rule that covers one of your own mailboxes, read-only, with its current version; or one that no longer does but decided on mail at your own mailbox (covers_now false), shown as the version that last decided on your mail, without its current name. You see its name, wording, current tree, state, kind and author, and which of your own mailboxes it reaches. Its wording and tree are shown as written, so they can name other addresses (a condition on who an email is from or to). While it covers you, you also see who receives what it matches (receivers): how many API keys, webhooks and shares, the member each belongs to (or the organization), and the sites the webhooks deliver to. You do not see which keys, webhooks or shares they are (no ids, names, prefixes, or URLs beyond the site), the other inboxes and domains its scope names, or its saved expectations. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
24982
+ "description": "One rule that covers one of your own mailboxes, read-only, with its current version; or one that no longer does but decided on mail at your own mailbox (covers_now false), shown as the version that last decided on your mail, without its current name. You see its name, wording, current tree, state, kind and author, and which of your own mailboxes it reaches. Its wording and tree are shown as written, so they can name other addresses (a condition on who an email is from or to). While it covers you, you also see who receives what it matches (receivers): how many API keys, webhooks and shares, the member each belongs to (or the organization), and the sites the webhooks deliver to. You do not see which keys, webhooks or shares they are (no ids, names, prefixes, or URLs beyond the site), the other inboxes and domains its scope names, or its saved expectations. For what happened to one email of yours, every rule's decision on it and, for another member's rule covering you, who receives what it shares: GET /v1/emails/{id}/rule-results (primitive email-rules list-email-rule-results --email-id <email-id>). Whether a rule delivered the email by webhook is not in the rule results: on your own mail, rule_deliveries on GET /v1/emails/{id} (primitive emails get <email-id> --json) counts each rule's webhook deliveries; on another member's mail, GET /v1/webhooks/deliveries?email_id=<email-id> (primitive webhook-deliveries list --email-id <email-id>, with webhooks:read) lists them. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
24965
24983
  "tags": ["Email Rule Oversight"],
24966
24984
  "security": [{ "BearerAuth": [] }],
24967
24985
  "parameters": [{
@@ -25013,7 +25031,7 @@ const openapiDocument = {
25013
25031
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
25014
25032
  },
25015
25033
  "404": {
25016
- "description": "not_found: no rule with this id covers your mailboxes or decided on your mail.",
25034
+ "description": "not_found: no rule with this id covers your mailboxes or decided on your mail; details.reason rule_deleted (with details.rule_name) for one deleted after you were told it covered you.",
25017
25035
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
25018
25036
  },
25019
25037
  "429": {
@@ -25139,7 +25157,7 @@ const openapiDocument = {
25139
25157
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
25140
25158
  },
25141
25159
  "404": {
25142
- "description": "not_found: no rule with this id covers your mailboxes or decided on your mail.",
25160
+ "description": "not_found: no rule with this id covers your mailboxes or decided on your mail; details.reason rule_deleted (with details.rule_name) for one deleted after you were told it covered you.",
25143
25161
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
25144
25162
  },
25145
25163
  "429": {
@@ -25267,7 +25285,7 @@ const openapiDocument = {
25267
25285
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
25268
25286
  },
25269
25287
  "404": {
25270
- "description": "not_found: no rule with this id covers your mailboxes or decided on your mail.",
25288
+ "description": "not_found: no rule with this id covers your mailboxes or decided on your mail; details.reason rule_deleted (with details.rule_name) for one deleted after you were told it covered you.",
25271
25289
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
25272
25290
  },
25273
25291
  "429": {
@@ -25300,7 +25318,7 @@ const openapiDocument = {
25300
25318
  "post": {
25301
25319
  "operationId": "createEmailRuleObjection",
25302
25320
  "summary": "Object to a rule over your mail",
25303
- "description": "Asks the author of a rule that covers one of your own mailboxes now to turn it off. Only a rule that covers you now: one you see only because it once decided on your mail cannot be objected to. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, or declines it, or the member who made it withdraws it, which clears its message. It never changes after that. You may have one pending objection per rule and 50 in all, and object to the same rule again only 10 minutes after you last did, whatever became of it. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
25321
+ "description": "Objects to a rule that covers one of your own mailboxes now: say in the message what you ask its author, to turn it off, narrow it, or explain who receives what it matches. The author answers by accepting, which turns it off, or by declining, optionally with a reason you see; the rule keeps running unless they accept. Only a rule that covers you now: one you see only because it once decided on your mail cannot be objected to. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, or declines it (optionally with a reason the objector sees), or the member who made it withdraws it, which clears its message. It never changes after that. You may have one pending objection per rule and 50 in all, and object to the same rule again only 10 minutes after you last did, whatever became of it. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
25304
25322
  "tags": ["Email Rule Oversight"],
25305
25323
  "security": [{ "BearerAuth": [] }],
25306
25324
  "requestBody": {
@@ -25401,7 +25419,7 @@ const openapiDocument = {
25401
25419
  "get": {
25402
25420
  "operationId": "listEmailRuleObjections",
25403
25421
  "summary": "List objections",
25404
- "description": "Objections you made and objections to rules you wrote (by default), only one of the two, or every objection you can see, newest first. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, or declines it, or the member who made it withdraws it, which clears its message. It never changes after that. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
25422
+ "description": "Objections you made and objections to rules you wrote (by default), only one of the two, or every objection you can see, newest first. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, or declines it (optionally with a reason the objector sees), or the member who made it withdraws it, which clears its message. It never changes after that. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
25405
25423
  "tags": ["Email Rule Oversight"],
25406
25424
  "security": [{ "BearerAuth": [] }],
25407
25425
  "parameters": [
@@ -25535,7 +25553,7 @@ const openapiDocument = {
25535
25553
  "/email-rule-objections/{id}": { "get": {
25536
25554
  "operationId": "getEmailRuleObjection",
25537
25555
  "summary": "Get an objection",
25538
- "description": "One objection you can see. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, or declines it, or the member who made it withdraws it, which clears its message. It never changes after that. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
25556
+ "description": "One objection you can see. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, or declines it (optionally with a reason the objector sees), or the member who made it withdraws it, which clears its message. It never changes after that. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
25539
25557
  "tags": ["Email Rule Oversight"],
25540
25558
  "security": [{ "BearerAuth": [] }],
25541
25559
  "parameters": [{
@@ -25717,7 +25735,7 @@ const openapiDocument = {
25717
25735
  "/email-rule-objections/{id}/decline": { "post": {
25718
25736
  "operationId": "declineEmailRuleObjection",
25719
25737
  "summary": "Decline an objection to your rule",
25720
- "description": "Declines a pending objection to a rule you wrote, optionally saying why; the rule stays as it is. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
25738
+ "description": "Declines a pending objection to a rule you wrote, optionally saying why (reason), which the member who objected sees; the rule stays as it is. When its message asks you to narrow the rule or explain who receives it, the reason is your answer; narrow it with a new version as well if you agree. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
25721
25739
  "tags": ["Email Rule Oversight"],
25722
25740
  "security": [{ "BearerAuth": [] }],
25723
25741
  "parameters": [{
@@ -34803,7 +34821,7 @@ const openapiDocument = {
34803
34821
  "summary": "Rotate an API key",
34804
34822
  "tags": ["Credentials"],
34805
34823
  "security": [{ "BearerAuth": [] }],
34806
- "description": "Mint a successor with a new id and the same name, grant, expiry and conditions, and return its secret once. The old key keeps working for overlap_seconds, then stops: 24 hours when overlap_seconds is omitted, at most 7 days, never past its own expires_at, and at once with 0 (which is how to rotate a key whose secret leaked). previous_key_expires_at says when the old key stops. Revoking the successor during the overlap also revokes the old key when you may revoke that one too; the revoke's predecessors_left counts any left working. Rotating does not extend a key: the successor keeps the old expiry unless expires_at gives it a new one. That needs keys:manage (403 forbidden otherwise), is held to the credential policy (400 when past its maximum lifetime, with the latest expiry it allows now in the message), and someone limited to their own keys can only keep or bring it forward (403 grant_forbidden, details.reason own_key_tighten_only); the old key then never outlives the new one. The person rotating must cover the key's access (403 grant_forbidden, details.reason target_not_covered), and a key an owner holds is rotated by an owner only (403 forbidden, details.reason owner_key_rotation), since rotating hands over the new secret. The person's own Primitive CLI login needs no step-up (it acts as the person, held to the same rules) unless the organization's credential policy sets cli_writes_require_approval; the Primitive app's token is refused, even with one. Needs the organization's credential features to be enabled; while they are not, this answers 404 feature_disabled, with details.feature naming the feature. Contact Primitive to turn them on.\n\nPerson only: a dashboard session, the person's own Primitive CLI login with no step-up (unless the organization's credential policy sets cli_writes_require_approval), or the person's own OAuth token with a step-up token for purpose `keys.create` in the Primitive-Step-Up header. Without one any other OAuth token is answered 403 step_up_required, whose details carry the dashboard URL that issues it (or 403 grant_forbidden when the person's role, or the client, could not do it anyway). The person's role must hold keys:manage. API keys and agent connection keys are refused. An agent acting for the person is refused unless it carries a step-up token the person issued in the dashboard.",
34824
+ "description": "Mint a successor with a new id and the same name, grant, expiry and conditions, and return its secret once, with its name and grant so you can see they carried over. The old key keeps working for overlap_seconds, then stops: 24 hours when overlap_seconds is omitted, at most 7 days, never past its own expires_at, and at once with 0 (which is how to rotate a key whose secret leaked). previous_key_expires_at says when the old key stops. Revoking the successor during the overlap also revokes the old key when you may revoke that one too; the revoke's predecessors_left counts any left working. Rotating does not extend a key: the successor keeps the old expiry unless expires_at gives it a new one. That needs keys:manage (403 forbidden otherwise), is held to the credential policy (400 when past its maximum lifetime, with the latest expiry it allows now in the message), and someone limited to their own keys can only keep or bring it forward (403 grant_forbidden, details.reason own_key_tighten_only); the old key then never outlives the new one. The person rotating must cover the key's access (403 grant_forbidden, details.reason target_not_covered), and a key an owner holds is rotated by an owner only (403 forbidden, details.reason owner_key_rotation), since rotating hands over the new secret. The person's own Primitive CLI login needs no step-up (it acts as the person, held to the same rules) unless the organization's credential policy sets cli_writes_require_approval; the Primitive app's token is refused, even with one. Needs the organization's credential features to be enabled; while they are not, this answers 404 feature_disabled, with details.feature naming the feature. Contact Primitive to turn them on.\n\nPerson only: a dashboard session, the person's own Primitive CLI login with no step-up (unless the organization's credential policy sets cli_writes_require_approval), or the person's own OAuth token with a step-up token for purpose `keys.create` in the Primitive-Step-Up header. Without one any other OAuth token is answered 403 step_up_required, whose details carry the dashboard URL that issues it (or 403 grant_forbidden when the person's role, or the client, could not do it anyway). The person's role must hold keys:manage. API keys and agent connection keys are refused. An agent acting for the person is refused unless it carries a step-up token the person issued in the dashboard.",
34807
34825
  "x-primitive-person-only": {
34808
34826
  "access": "step_up",
34809
34827
  "step_up_purpose": "keys.create",
@@ -43237,8 +43255,14 @@ const openapiDocument = {
43237
43255
  "format": "date-time"
43238
43256
  },
43239
43257
  "raw_size_bytes": { "type": ["integer", "null"] },
43240
- "webhook_status": { "$ref": "#/components/schemas/EmailWebhookStatus" },
43241
- "webhook_attempt_count": { "type": "integer" },
43258
+ "webhook_status": {
43259
+ "$ref": "#/components/schemas/EmailWebhookStatus",
43260
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its delivery state. `pending` with 0 attempts can also mean no route webhook took it, and then it changes only if the email is sent again."
43261
+ },
43262
+ "webhook_attempt_count": {
43263
+ "type": "integer",
43264
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its attempts."
43265
+ },
43242
43266
  "thread_id": {
43243
43267
  "type": ["string", "null"],
43244
43268
  "format": "uuid",
@@ -43736,17 +43760,31 @@ const openapiDocument = {
43736
43760
  "format": "date-time"
43737
43761
  },
43738
43762
  "rejection_reason": { "type": ["string", "null"] },
43739
- "webhook_status": { "$ref": "#/components/schemas/EmailWebhookStatus" },
43740
- "webhook_attempt_count": { "type": "integer" },
43763
+ "webhook_status": {
43764
+ "$ref": "#/components/schemas/EmailWebhookStatus",
43765
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its delivery state. `pending` with 0 attempts can also mean no route webhook took it, and then it changes only if the email is sent again."
43766
+ },
43767
+ "webhook_attempt_count": {
43768
+ "type": "integer",
43769
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its attempts."
43770
+ },
43741
43771
  "webhook_last_attempt_at": {
43742
43772
  "type": ["string", "null"],
43743
- "format": "date-time"
43773
+ "format": "date-time",
43774
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its last attempt."
43775
+ },
43776
+ "webhook_last_status_code": {
43777
+ "type": ["integer", "null"],
43778
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. What it last answered."
43779
+ },
43780
+ "webhook_last_error": {
43781
+ "type": ["string", "null"],
43782
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its last error."
43744
43783
  },
43745
- "webhook_last_status_code": { "type": ["integer", "null"] },
43746
- "webhook_last_error": { "type": ["string", "null"] },
43747
43784
  "webhook_fired_at": {
43748
43785
  "type": ["string", "null"],
43749
- "format": "date-time"
43786
+ "format": "date-time",
43787
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. When it was delivered."
43750
43788
  },
43751
43789
  "smtp_helo": { "type": ["string", "null"] },
43752
43790
  "smtp_mail_from": {
@@ -44013,7 +44051,7 @@ const openapiDocument = {
44013
44051
  },
44014
44052
  "shared_through": {
44015
44053
  "type": ["object", "null"],
44016
- "description": "The rule share a reader has this email through, when that is their only way to it. Null for everyone else.",
44054
+ "description": "Only for a reader who has this email through a colleague's share of their mail, when that share is their only way to it: the share and who gave it. Null for everyone else, including on your own mail when a rule or share of yours gave it to someone: rule_deliveries counts the webhooks rules delivered it to, and GET /v1/email-rule-shares/{id}/emails lists what a share you gave has given.",
44017
44055
  "required": [
44018
44056
  "share_id",
44019
44057
  "rule_name",
@@ -44040,6 +44078,81 @@ const openapiDocument = {
44040
44078
  }
44041
44079
  }
44042
44080
  },
44081
+ "rule_deliveries": {
44082
+ "type": ["object", "null"],
44083
+ "description": "Where Email Rules delivered this email by webhook, for the owner of the mailbox it is at, on their own dashboard session or the Primitive CLI. Null for everyone else, including on another member's mail even for an organization owner or admin (GET /v1/webhooks/deliveries?email_id=<email-id> lists its deliveries, a rule's included), and when it could not be read in time. A key reading it through a rule is not a delivery.",
44084
+ "required": [
44085
+ "rules",
44086
+ "hidden",
44087
+ "complete"
44088
+ ],
44089
+ "properties": {
44090
+ "rules": {
44091
+ "type": "array",
44092
+ "description": "Each rule over your mail that queued a webhook delivery of this email, newest rule first.",
44093
+ "items": {
44094
+ "type": "object",
44095
+ "required": [
44096
+ "rule_id",
44097
+ "name",
44098
+ "delivered",
44099
+ "pending",
44100
+ "failed",
44101
+ "not_sent",
44102
+ "hosts",
44103
+ "hosts_not_listed"
44104
+ ],
44105
+ "properties": {
44106
+ "rule_id": {
44107
+ "type": "string",
44108
+ "format": "uuid",
44109
+ "description": "The rule. A webhook sent it through several rules counts under one."
44110
+ },
44111
+ "name": { "type": "string" },
44112
+ "delivered": {
44113
+ "type": "integer",
44114
+ "minimum": 0,
44115
+ "description": "Webhooks it was delivered to."
44116
+ },
44117
+ "pending": {
44118
+ "type": "integer",
44119
+ "minimum": 0,
44120
+ "description": "Webhooks still owed it."
44121
+ },
44122
+ "failed": {
44123
+ "type": "integer",
44124
+ "minimum": 0,
44125
+ "description": "Webhooks whose attempts gave up."
44126
+ },
44127
+ "not_sent": {
44128
+ "type": "integer",
44129
+ "minimum": 0,
44130
+ "description": "Webhooks it was not sent to after all."
44131
+ },
44132
+ "hosts": {
44133
+ "type": "array",
44134
+ "items": { "type": "string" },
44135
+ "description": "The sites it was delivered to at the time, named as the covering view names sites; they may differ from the rule's current receivers there."
44136
+ },
44137
+ "hosts_not_listed": {
44138
+ "type": "integer",
44139
+ "minimum": 0,
44140
+ "description": "Sites past the listed ones."
44141
+ }
44142
+ }
44143
+ }
44144
+ },
44145
+ "hidden": {
44146
+ "type": "integer",
44147
+ "minimum": 0,
44148
+ "description": "Rules that queued a delivery of it that are not listed: they do not cover your mailboxes now, or are past the 50 one answer judges."
44149
+ },
44150
+ "complete": {
44151
+ "type": "boolean",
44152
+ "description": "False when a delivery may be missing: the email is older than 14 days, or it has more deliveries or rules than one answer reads."
44153
+ }
44154
+ }
44155
+ },
44043
44156
  "from_name": {
44044
44157
  "type": ["string", "null"],
44045
44158
  "description": "Display name from the `From:` header, decoded for display: RFC 2047 encoded words are decoded in their declared charset and folded lines are joined (e.g. `Dana Rúiz` for `=?UTF-8?Q?Dana_R=C3=BAiz?= <dana@example.com>`). Null when the header carries no display name. For display only: identify the sender by `from_email`, never by this name, which the sender chooses freely."
@@ -45052,7 +45165,7 @@ const openapiDocument = {
45052
45165
  "type": "object",
45053
45166
  "additionalProperties": false,
45054
45167
  "required": ["url"],
45055
- "description": "One-click unsubscribe for the message. Primitive writes a `List-Unsubscribe` header naming `url` (and `mailto` when given) and, unless `one_click` is false, `List-Unsubscribe-Post: List-Unsubscribe=One-Click` (RFC 8058), and DKIM-signs both. A receiver that offers one-click unsubscribe sends an HTTPS POST to `url` with the form body `List-Unsubscribe=One-Click`; your endpoint records the unsubscribe. Every recipient of the message gets the same `url`, so send one message per recipient when the URL identifies who to unsubscribe. The `headers` map refuses both header names, so this field is the only way to set them, and the headers it adds count toward the 25 entries `headers` may hold. A field whose rendered `List-Unsubscribe` would pass 980 characters is refused. Not accepted on a repeating send.",
45168
+ "description": "One-click unsubscribe for the message. Primitive writes a `List-Unsubscribe` header naming `url` (and `mailto` when given) and, unless `one_click` is false, `List-Unsubscribe-Post: List-Unsubscribe=One-Click` (RFC 8058), and DKIM-signs both. A receiver that offers one-click unsubscribe sends an HTTPS POST to `url` with the form body `List-Unsubscribe=One-Click`; your endpoint records the unsubscribe. Every recipient of a message would get the same `url`, so another recipient could unsubscribe whoever it identifies: a send with `unsubscribe` must have exactly one recipient, one entry across `to`, `cc` and `bcc` (an address given twice counts twice), and a send to more is refused with a `validation_error`. Send one message per recipient, for example with `POST /v1/send-mail/batch`. The `headers` map refuses both header names, so this field is the only way to set them, and the headers it adds count toward the 25 entries `headers` may hold. A field whose rendered `List-Unsubscribe` would pass 980 characters is refused. Not accepted on a repeating send.",
45056
45169
  "properties": {
45057
45170
  "url": {
45058
45171
  "type": "string",
@@ -46124,7 +46237,7 @@ const openapiDocument = {
46124
46237
  "type": "object",
46125
46238
  "additionalProperties": false,
46126
46239
  "required": ["url"],
46127
- "description": "One-click unsubscribe for the message. Primitive writes a `List-Unsubscribe` header naming `url` (and `mailto` when given) and, unless `one_click` is false, `List-Unsubscribe-Post: List-Unsubscribe=One-Click` (RFC 8058), and DKIM-signs both. A receiver that offers one-click unsubscribe sends an HTTPS POST to `url` with the form body `List-Unsubscribe=One-Click`; your endpoint records the unsubscribe. Every recipient of the message gets the same `url`, so send one message per recipient when the URL identifies who to unsubscribe. The `headers` map refuses both header names, so this field is the only way to set them, and the headers it adds count toward the 25 entries `headers` may hold. A field whose rendered `List-Unsubscribe` would pass 980 characters is refused. Not accepted on a repeating send.",
46240
+ "description": "One-click unsubscribe for the message. Primitive writes a `List-Unsubscribe` header naming `url` (and `mailto` when given) and, unless `one_click` is false, `List-Unsubscribe-Post: List-Unsubscribe=One-Click` (RFC 8058), and DKIM-signs both. A receiver that offers one-click unsubscribe sends an HTTPS POST to `url` with the form body `List-Unsubscribe=One-Click`; your endpoint records the unsubscribe. Every recipient of a message would get the same `url`, so another recipient could unsubscribe whoever it identifies: a reply with `unsubscribe` must go to the one address it answers, and one with `reply_all` that adds a cc is refused with a `validation_error`. The `headers` map refuses both header names, so this field is the only way to set them, and the headers it adds count toward the 25 entries `headers` may hold. A field whose rendered `List-Unsubscribe` would pass 980 characters is refused. Not accepted on a repeating send.",
46128
46241
  "properties": {
46129
46242
  "url": {
46130
46243
  "type": "string",
@@ -51275,7 +51388,7 @@ const openapiDocument = {
51275
51388
  "ended_at": {
51276
51389
  "type": ["string", "null"],
51277
51390
  "format": "date-time",
51278
- "description": "When it was deleted, replaced or revoked, when an API key expired, when a repeating send stopped, or when a rule request or objection was decided (accepted, declined or withdrawn); null otherwise, as on every coverage notice."
51391
+ "description": "When it was deleted, replaced or revoked, when an API key expired, when a repeating send stopped, or when a rule request or objection was decided (accepted, declined or withdrawn); null otherwise, as on every coverage notice (rule_now marks one whose rule was deleted)."
51279
51392
  },
51280
51393
  "owned_now": {
51281
51394
  "type": "string",
@@ -51305,10 +51418,15 @@ const openapiDocument = {
51305
51418
  ]
51306
51419
  },
51307
51420
  "rule_id": {
51308
- "description": "For email_rule_coverage, always: the rule it is about, since names need not be unique (for pending, the same as id). GET /v1/email-rules/covering-me/{rule_id} shows the rule while it covers you, or as it last decided on your mail; otherwise it answers not_found.",
51421
+ "description": "For email_rule_coverage, always: the rule it is about, since names need not be unique (for pending, the same as id). GET /v1/email-rules/covering-me/{rule_id} shows the rule while it covers you, or as it last decided on your mail; otherwise it answers not_found, with details.reason rule_deleted once a rule you were told of is deleted.",
51309
51422
  "type": "string",
51310
51423
  "format": "uuid"
51311
51424
  },
51425
+ "rule_now": {
51426
+ "description": "For email_rule_coverage: deleted once the rule it is about has been deleted. Left out while it exists, or when that could not be checked.",
51427
+ "type": "string",
51428
+ "enum": ["deleted"]
51429
+ },
51312
51430
  "receivers_change": {
51313
51431
  "description": "For a receivers_changed notice: who received the rule's matches before and after, in totals. They can be equal when only an owner or a webhook site changed; covering-me shows them by owner. A rotated key counts once here while the old one still works; covering-me counts both.",
51314
51432
  "type": "object",
@@ -51417,7 +51535,7 @@ const openapiDocument = {
51417
51535
  "as_of": {
51418
51536
  "type": ["string", "null"],
51419
51537
  "format": "date-time",
51420
- "description": "With relation=concerning only: about when the notices last looked at your organization; null if never or unread. Coverage since may have no notice yet."
51538
+ "description": "With relation=concerning only: about when the notices last looked at your organization; null if never or unread. Coverage since may have no notice yet. They look only while one of its rules could cover someone, so this stops moving while none could."
51421
51539
  },
51422
51540
  "pending_complete": {
51423
51541
  "description": "With relation=concerning, on the first page only: whether the check for rules that started covering you without their start notice (state pending, listed ahead of the notices and beyond limit) was finished. false: some may be missing. Absent where there is nothing to check.",
@@ -51631,6 +51749,76 @@ const openapiDocument = {
51631
51749
  },
51632
51750
  "required": ["checked", "matched"]
51633
51751
  },
51752
+ "EmailRuleScopeUsed": {
51753
+ "type": "object",
51754
+ "properties": {
51755
+ "evaluation_scope": {
51756
+ "type": "string",
51757
+ "enum": [
51758
+ "author",
51759
+ "own_mailboxes",
51760
+ "selected"
51761
+ ],
51762
+ "description": "author, own_mailboxes or selected, as a rule's evaluation_scope."
51763
+ },
51764
+ "scope_selection": {
51765
+ "type": ["object", "null"],
51766
+ "properties": {
51767
+ "addresses": {
51768
+ "maxItems": 100,
51769
+ "type": "array",
51770
+ "items": {
51771
+ "type": "string",
51772
+ "maxLength": 320
51773
+ }
51774
+ },
51775
+ "domains": {
51776
+ "maxItems": 50,
51777
+ "type": "array",
51778
+ "items": {
51779
+ "type": "string",
51780
+ "maxLength": 253
51781
+ }
51782
+ }
51783
+ },
51784
+ "required": ["addresses", "domains"],
51785
+ "description": "What a selected scope names; null for any other."
51786
+ }
51787
+ },
51788
+ "required": ["evaluation_scope", "scope_selection"]
51789
+ },
51790
+ "EmailRuleScopeWarning": {
51791
+ "type": "object",
51792
+ "properties": {
51793
+ "name": {
51794
+ "type": "string",
51795
+ "maxLength": 320
51796
+ },
51797
+ "kind": {
51798
+ "type": "string",
51799
+ "enum": ["address", "domain"]
51800
+ },
51801
+ "reason": {
51802
+ "type": "string",
51803
+ "enum": [
51804
+ "unknown_domain",
51805
+ "inactive_domain",
51806
+ "unknown_address"
51807
+ ],
51808
+ "description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
51809
+ },
51810
+ "message": {
51811
+ "type": "string",
51812
+ "maxLength": 1e3
51813
+ }
51814
+ },
51815
+ "required": [
51816
+ "name",
51817
+ "kind",
51818
+ "reason",
51819
+ "message"
51820
+ ]
51821
+ },
51634
51822
  "EmailRuleScopeSelection": {
51635
51823
  "type": "object",
51636
51824
  "properties": {
@@ -51725,6 +51913,16 @@ const openapiDocument = {
51725
51913
  "description": "For a grant rule with questions, breadth counted on its conditions alone: the emails its questions are asked about. Null for any other rule, or when not counted in full (as breadth).",
51726
51914
  "anyOf": [{ "$ref": "#/components/schemas/EmailRuleBreadth" }, { "type": "null" }]
51727
51915
  },
51916
+ "breadth_scope": {
51917
+ "description": "The scope breadth and conditions_breadth are counted over: evaluation_scope as sent, by default own_mailboxes. Not the saved rule's scope, which a write sets with evaluation_scope; writes ignore this, as they ignore breadth.",
51918
+ "$ref": "#/components/schemas/EmailRuleScopeUsed"
51919
+ },
51920
+ "scope_warnings": {
51921
+ "description": "Names in the scope_selection sent that match nothing this organization receives mail at (a typo, or an inbox not yet in use), as a test or write would warn of them. Present only when there are some; writes ignore it.",
51922
+ "maxItems": 150,
51923
+ "type": "array",
51924
+ "items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
51925
+ },
51728
51926
  "sql": {
51729
51927
  "description": "Present only when include_sql was true.",
51730
51928
  "type": "object",
@@ -51778,32 +51976,6 @@ const openapiDocument = {
51778
51976
  "vocabulary"
51779
51977
  ]
51780
51978
  },
51781
- "EmailRuleScopeWarning": {
51782
- "type": "object",
51783
- "properties": {
51784
- "name": { "type": "string" },
51785
- "kind": {
51786
- "type": "string",
51787
- "enum": ["address", "domain"]
51788
- },
51789
- "reason": {
51790
- "type": "string",
51791
- "enum": [
51792
- "unknown_domain",
51793
- "inactive_domain",
51794
- "unknown_address"
51795
- ],
51796
- "description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
51797
- },
51798
- "message": { "type": "string" }
51799
- },
51800
- "required": [
51801
- "name",
51802
- "kind",
51803
- "reason",
51804
- "message"
51805
- ]
51806
- },
51807
51979
  "EmailRuleSampleJudgment": {
51808
51980
  "type": "object",
51809
51981
  "properties": {
@@ -52010,7 +52182,7 @@ const openapiDocument = {
52010
52182
  "type": "object",
52011
52183
  "properties": {
52012
52184
  "tree": {
52013
- "description": "An unsaved rule tree, as POST /email-rules/compile returned it or written by hand. Give tree or rule_id, not both.",
52185
+ "description": "An unsaved rule tree, as POST /email-rules/compile returned it or written by hand. Give one of tree, rule_id and request_id.",
52014
52186
  "$ref": "#/components/schemas/EmailRuleTreeInput"
52015
52187
  },
52016
52188
  "evaluation_scope": {
@@ -52028,8 +52200,13 @@ const openapiDocument = {
52028
52200
  "type": "string",
52029
52201
  "format": "uuid"
52030
52202
  },
52203
+ "request_id": {
52204
+ "description": "A pending rule request you can see: its rule as asked, tested as you over your own mailboxes (what accepting would share, for the member asked). Give one of tree, rule_id and request_id.",
52205
+ "type": "string",
52206
+ "format": "uuid"
52207
+ },
52031
52208
  "kind": {
52032
- "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule uses its own.",
52209
+ "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule or a request uses its own.",
52033
52210
  "type": "string",
52034
52211
  "enum": ["grant", "do_not_share"]
52035
52212
  },
@@ -52098,6 +52275,20 @@ const openapiDocument = {
52098
52275
  "type": "integer",
52099
52276
  "minimum": 0,
52100
52277
  "description": "The most emails the recent window holds: 200, less one place per expected email."
52278
+ },
52279
+ "scope": {
52280
+ "description": "The scope the test ran with: a saved rule's as stored, over its author's mail (GET /email-rules/{id}/scope: what it reaches now), or a tree's as sent, over yours (by default own_mailboxes). A rule covering you, tested as you: own_mailboxes, your mailboxes it covers.",
52281
+ "$ref": "#/components/schemas/EmailRuleScopeUsed"
52282
+ },
52283
+ "oldest_at": {
52284
+ "type": ["string", "null"],
52285
+ "format": "date-time",
52286
+ "description": "When the oldest email tested arrived, expected ones included; null when none was. The window is the newest 200 the scope reaches, so a narrower scope reaches further back: compare counts only over the same scope and span."
52287
+ },
52288
+ "newest_at": {
52289
+ "type": ["string", "null"],
52290
+ "format": "date-time",
52291
+ "description": "When the newest email tested arrived; null when none was."
52101
52292
  }
52102
52293
  },
52103
52294
  "required": [
@@ -52214,6 +52405,11 @@ const openapiDocument = {
52214
52405
  "type": "string"
52215
52406
  },
52216
52407
  "subject": { "type": ["string", "null"] },
52408
+ "attachment_names": {
52409
+ "description": "On matched and near_miss: the file names the email lists, in order, at most 10 (the names its questions are given; never what is in the files). Parts with no name are left out; absent when there are none.",
52410
+ "type": "array",
52411
+ "items": { "type": "string" }
52412
+ },
52217
52413
  "parts": {
52218
52414
  "description": "How each top-level part of the rule decided. Present for matched, near_miss and no_match.",
52219
52415
  "type": "array",
@@ -52413,6 +52609,7 @@ const openapiDocument = {
52413
52609
  },
52414
52610
  "scope_warnings": {
52415
52611
  "description": "Names in scope_selection that match nothing this organization receives mail at (a typo, or an inbox not yet in use). Present only when there are some.",
52612
+ "maxItems": 150,
52416
52613
  "type": "array",
52417
52614
  "items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
52418
52615
  },
@@ -52627,7 +52824,7 @@ const openapiDocument = {
52627
52824
  "type": "object",
52628
52825
  "properties": {
52629
52826
  "tree": {
52630
- "description": "An unsaved rule tree, as POST /email-rules/compile returned it or written by hand. Give tree or rule_id, not both.",
52827
+ "description": "An unsaved rule tree, as POST /email-rules/compile returned it or written by hand. Give one of tree, rule_id and request_id.",
52631
52828
  "$ref": "#/components/schemas/EmailRuleTreeInput"
52632
52829
  },
52633
52830
  "english": {
@@ -52657,7 +52854,7 @@ const openapiDocument = {
52657
52854
  "format": "uuid"
52658
52855
  },
52659
52856
  "kind": {
52660
- "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule uses its own.",
52857
+ "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule or a request uses its own.",
52661
52858
  "type": "string",
52662
52859
  "enum": ["grant", "do_not_share"]
52663
52860
  },
@@ -52745,7 +52942,7 @@ const openapiDocument = {
52745
52942
  "type": "object",
52746
52943
  "properties": {
52747
52944
  "tree": {
52748
- "description": "An unsaved rule tree, as POST /email-rules/compile returned it or written by hand. Give tree or rule_id, not both.",
52945
+ "description": "An unsaved rule tree, as POST /email-rules/compile returned it or written by hand. Give one of tree, rule_id and request_id.",
52749
52946
  "$ref": "#/components/schemas/EmailRuleTreeInput"
52750
52947
  },
52751
52948
  "evaluation_scope": {
@@ -52763,8 +52960,13 @@ const openapiDocument = {
52763
52960
  "type": "string",
52764
52961
  "format": "uuid"
52765
52962
  },
52963
+ "request_id": {
52964
+ "description": "A pending rule request you can see: its rule as asked, tested as you over your own mailboxes (what accepting would share, for the member asked). Give one of tree, rule_id and request_id.",
52965
+ "type": "string",
52966
+ "format": "uuid"
52967
+ },
52766
52968
  "kind": {
52767
- "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule uses its own.",
52969
+ "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule or a request uses its own.",
52768
52970
  "type": "string",
52769
52971
  "enum": ["grant", "do_not_share"]
52770
52972
  },
@@ -52863,6 +53065,10 @@ const openapiDocument = {
52863
53065
  ],
52864
53066
  "additionalProperties": false,
52865
53067
  "description": "A made-up received email. Nothing about it is stored."
53068
+ },
53069
+ "with_protection": {
53070
+ "description": "With true, a grant rule that matches is also judged against the active do-not-share rules over the first recipient's mailbox, which you must read in full and the rule must run over; see protection. Limited to 20 an hour per member.",
53071
+ "type": "boolean"
52866
53072
  }
52867
53073
  },
52868
53074
  "required": ["email"],
@@ -52992,6 +53198,59 @@ const openapiDocument = {
52992
53198
  "required": ["value", "confidence"]
52993
53199
  },
52994
53200
  "description": "What the classifier read from the email, by fact: its value and confidence."
53201
+ },
53202
+ "protection": {
53203
+ "description": "With with_protection: whether a match would be shared. Nothing is stored.",
53204
+ "type": "object",
53205
+ "properties": {
53206
+ "mailbox": {
53207
+ "type": "string",
53208
+ "description": "The mailbox judged: the first recipient."
53209
+ },
53210
+ "outcome": {
53211
+ "type": "string",
53212
+ "enum": [
53213
+ "shared",
53214
+ "withheld",
53215
+ "not_matched"
53216
+ ],
53217
+ "description": "not_matched: the rule did not match, so nothing would be shared and no do-not-share rule was judged."
53218
+ },
53219
+ "withheld_by": {
53220
+ "type": "array",
53221
+ "items": {
53222
+ "type": "object",
53223
+ "properties": {
53224
+ "id": {
53225
+ "type": "string",
53226
+ "format": "uuid"
53227
+ },
53228
+ "name": { "type": "string" },
53229
+ "reason": {
53230
+ "type": "string",
53231
+ "enum": ["matched", "undecided"]
53232
+ }
53233
+ },
53234
+ "required": [
53235
+ "id",
53236
+ "name",
53237
+ "reason"
53238
+ ]
53239
+ },
53240
+ "description": "Do-not-share rules you can see that would keep it from being shared. undecided: left undecided as real mail would leave it, or not reached by this test (past 50 rules, 10 rules' questions, or the time limit); it is held back either way."
53241
+ },
53242
+ "withheld_by_hidden": {
53243
+ "type": "integer",
53244
+ "minimum": 0,
53245
+ "description": "Rules you cannot see that would."
53246
+ }
53247
+ },
53248
+ "required": [
53249
+ "mailbox",
53250
+ "outcome",
53251
+ "withheld_by",
53252
+ "withheld_by_hidden"
53253
+ ]
52995
53254
  }
52996
53255
  },
52997
53256
  "required": [
@@ -53069,7 +53328,7 @@ const openapiDocument = {
53069
53328
  "minimum": 0
53070
53329
  },
53071
53330
  "objection_notice": {
53072
- "description": "With pending_objections above 0: that members asked you to turn it off, and how to answer.",
53331
+ "description": "With pending_objections above 0: that members objected (each message says what they ask: to turn it off, narrow it or explain it), and how to answer.",
53073
53332
  "type": "string"
53074
53333
  },
53075
53334
  "created_at": {
@@ -53086,9 +53345,14 @@ const openapiDocument = {
53086
53345
  },
53087
53346
  "scope_warnings": {
53088
53347
  "description": "Names in scope_selection that match nothing this organization receives mail at (a typo, or an inbox not yet in use). Present only when there are some.",
53348
+ "maxItems": 150,
53089
53349
  "type": "array",
53090
53350
  "items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
53091
53351
  },
53352
+ "do_not_share_note": {
53353
+ "description": "On a grant rule's create answer: that active do-not-share rules reaching an email run first: one that matches it keeps it from being shared through this rule, and one that cannot decide it holds it back while it is decided again for up to a day; it is shared through this rule only if none of them then matches it.",
53354
+ "type": "string"
53355
+ },
53092
53356
  "expectations": {
53093
53357
  "description": "Its saved expectations, each list by email id, as stored: on every create, and on an update that set or removed them.",
53094
53358
  "type": "object",
@@ -53154,13 +53418,23 @@ const openapiDocument = {
53154
53418
  }
53155
53419
  },
53156
53420
  "undecided_samples": {
53157
- "description": "Made-up emails not decided, by index. Only a write sent with if_expectations_pass that saves a version or activates the rule judges them.",
53421
+ "description": "Made-up emails not decided, by index. Only a write that saves a version or activates the rule, sent with if_expectations_pass or judged by default, judges them.",
53158
53422
  "type": "array",
53159
53423
  "items": {
53160
53424
  "type": "integer",
53161
53425
  "minimum": 0
53162
53426
  }
53163
53427
  },
53428
+ "failed_sample_details": {
53429
+ "description": "failed_samples with each one's label, from a write that judged them before saving (if_expectations_pass, or by default).",
53430
+ "type": "array",
53431
+ "items": { "$ref": "#/components/schemas/EmailRuleSampleDetail" }
53432
+ },
53433
+ "undecided_sample_details": {
53434
+ "description": "undecided_samples with each one's label, as failed_sample_details.",
53435
+ "type": "array",
53436
+ "items": { "$ref": "#/components/schemas/EmailRuleSampleDetail" }
53437
+ },
53164
53438
  "note": {
53165
53439
  "description": "On an update that saved a version that did not pass, or a do_not_share rule created active: that it was saved anyway, is current, and whether it is live.",
53166
53440
  "type": "string"
@@ -53186,7 +53460,7 @@ const openapiDocument = {
53186
53460
  "required": ["version", "note"]
53187
53461
  },
53188
53462
  "affects": {
53189
- "description": "After an update that saved a version: API keys listing the rule, the webhooks they own, and shares this write ended. The rule keeps its state. Absent if not read.",
53463
+ "description": "After an update that saved a version, or turned a grant rule active: API keys listing the rule and the webhooks they own, which read and receive what a grant rule grants from now on. shares_ended is always 0: a new version keeps the rule's share (share_notice says so). Saving a version does not by itself change the rule's state. Absent after any other write, and if not read.",
53190
53464
  "type": "object",
53191
53465
  "properties": {
53192
53466
  "keys": {
@@ -53209,11 +53483,11 @@ const openapiDocument = {
53209
53483
  ]
53210
53484
  },
53211
53485
  "notice": {
53212
- "description": "After a write that saved a version of an active rule keys or webhooks read without checking it first: what it changes, and how to have the next one checked.",
53486
+ "description": "After a write that saved a version of an active rule keys, webhooks or a share read without checking it first: what it changes, and how to have the next one checked.",
53213
53487
  "type": "string"
53214
53488
  },
53215
53489
  "share_notice": {
53216
- "description": "After a write that ended the rule's share: that it did, given even when affects is not, with whom it was with and the version they accepted when those can be read.",
53490
+ "description": "After a write that saved a version of a rule with a live share: that the share goes on under it, given even when affects is not, with whom it is and the version they accepted when those can be read.",
53217
53491
  "type": "string"
53218
53492
  }
53219
53493
  },
@@ -53347,6 +53621,17 @@ const openapiDocument = {
53347
53621
  "created_at"
53348
53622
  ]
53349
53623
  },
53624
+ "EmailRuleSampleDetail": {
53625
+ "type": "object",
53626
+ "properties": {
53627
+ "index": {
53628
+ "type": "integer",
53629
+ "minimum": 0
53630
+ },
53631
+ "label": { "type": ["string", "null"] }
53632
+ },
53633
+ "required": ["index", "label"]
53634
+ },
53350
53635
  "CreateEmailRuleRequest": {
53351
53636
  "type": "object",
53352
53637
  "properties": {
@@ -53459,6 +53744,16 @@ const openapiDocument = {
53459
53744
  "conditions_breadth": {
53460
53745
  "description": "Ignored.",
53461
53746
  "anyOf": [{ "$ref": "#/components/schemas/EmailRuleBreadth" }, { "type": "null" }]
53747
+ },
53748
+ "breadth_scope": {
53749
+ "description": "Ignored (the compile answer's breadth_scope): set a rule's scope with evaluation_scope.",
53750
+ "$ref": "#/components/schemas/EmailRuleScopeUsed"
53751
+ },
53752
+ "scope_warnings": {
53753
+ "description": "Ignored (the compile answer's scope_warnings).",
53754
+ "maxItems": 150,
53755
+ "type": "array",
53756
+ "items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
53462
53757
  }
53463
53758
  },
53464
53759
  "required": [
@@ -53534,7 +53829,7 @@ const openapiDocument = {
53534
53829
  "minimum": 0
53535
53830
  },
53536
53831
  "objection_notice": {
53537
- "description": "With pending_objections above 0: that members asked you to turn it off, and how to answer.",
53832
+ "description": "With pending_objections above 0: that members objected (each message says what they ask: to turn it off, narrow it or explain it), and how to answer.",
53538
53833
  "type": "string"
53539
53834
  },
53540
53835
  "created_at": {
@@ -53641,7 +53936,7 @@ const openapiDocument = {
53641
53936
  "minimum": 0
53642
53937
  },
53643
53938
  "objection_notice": {
53644
- "description": "With pending_objections above 0: that members asked you to turn it off, and how to answer.",
53939
+ "description": "With pending_objections above 0: that members objected (each message says what they ask: to turn it off, narrow it or explain it), and how to answer.",
53645
53940
  "type": "string"
53646
53941
  },
53647
53942
  "created_at": {
@@ -53764,6 +54059,16 @@ const openapiDocument = {
53764
54059
  "description": "Ignored.",
53765
54060
  "anyOf": [{ "$ref": "#/components/schemas/EmailRuleBreadth" }, { "type": "null" }]
53766
54061
  },
54062
+ "breadth_scope": {
54063
+ "description": "Ignored (the compile answer's breadth_scope): set a rule's scope with evaluation_scope.",
54064
+ "$ref": "#/components/schemas/EmailRuleScopeUsed"
54065
+ },
54066
+ "scope_warnings": {
54067
+ "description": "Ignored (the compile answer's scope_warnings).",
54068
+ "maxItems": 150,
54069
+ "type": "array",
54070
+ "items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
54071
+ },
53767
54072
  "kind": {
53768
54073
  "description": "Must be the rule's own (400 kind_mismatch).",
53769
54074
  "type": "string",
@@ -53827,7 +54132,7 @@ const openapiDocument = {
53827
54132
  "maximum": 2147483647
53828
54133
  },
53829
54134
  "if_expectations_pass": {
53830
- "description": "true: judge the rule as this write leaves it (new tree, restored version, new scope, or the version it activates) against the expectations it leaves, as POST /email-rules/test would, before saving; it can take as long as a test. Failed: 409 expectations_failed; on emails the rule cannot read: 409 expectations_unreadable; undecided: 409 expectations_undecided (each with details.expectations_check); none to judge: 400 no_expectations. Refused writes save nothing; a pass saves unless the rule moved meanwhile (409 email_rule_conflict). Only writes that save a version or activate the rule are judged. Omitted: judged as with true when the write saves a version or changes the scope of an active rule that API keys or webhooks read and that has expectations. false: never judged first.",
54135
+ "description": "true: judge the rule as this write leaves it (new tree, restored version, new scope, or the version it activates) against the expectations it leaves, as POST /email-rules/test would, before saving; it can take as long as a test. Failed: 409 expectations_failed; on emails the rule cannot read: 409 expectations_unreadable; undecided: 409 expectations_undecided (each with details.expectations_check); none to judge: 400 no_expectations. Refused writes save nothing; a pass saves unless the rule moved meanwhile (409 email_rule_conflict). Only writes that save a version or activate the rule are judged. Omitted: judged as with true when the write saves a version or changes the scope of an active rule that API keys, webhooks or a share read and that has expectations. false: never judged first.",
53831
54136
  "type": "boolean"
53832
54137
  },
53833
54138
  "restore_version": {
@@ -54055,7 +54360,7 @@ const openapiDocument = {
54055
54360
  "exclusiveMinimum": 0
54056
54361
  },
54057
54362
  "reads_in_full": {
54058
- "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches.",
54363
+ "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches. It counts what they can read, not whether any has read an email.",
54059
54364
  "type": "integer",
54060
54365
  "minimum": 0
54061
54366
  },
@@ -54328,9 +54633,10 @@ const openapiDocument = {
54328
54633
  "enum": [
54329
54634
  "draft",
54330
54635
  "created_after_email",
54636
+ "outside_scope",
54331
54637
  null
54332
54638
  ],
54333
- "description": "What is known about a rule with no result on this email. draft: the rule is a draft now. created_after_email: the rule was created after the email arrived. Null when it has a result, or when nothing is known."
54639
+ "description": "What is known about a rule with no result on this email. draft: the rule is a draft now. created_after_email: the rule was created after the email arrived. outside_scope: the mailbox this email is in is outside what its scope names (its author's own mailboxes, its selection, or all its author reads now), so it does not decide on it. Null when it has a result, or when nothing is known (it may not have decided yet)."
54334
54640
  },
54335
54641
  "author_left": {
54336
54642
  "description": "On a do-not-share rule whose author is no longer a member of the organization: it blocks nothing now, whatever it decided. Absent otherwise.",
@@ -54469,6 +54775,7 @@ const openapiDocument = {
54469
54775
  },
54470
54776
  "scope_warnings": {
54471
54777
  "description": "Names in scope_selection that match nothing this organization receives mail at (a typo, or an inbox not yet in use). Present only when there are some.",
54778
+ "maxItems": 150,
54472
54779
  "type": "array",
54473
54780
  "items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
54474
54781
  },
@@ -54662,6 +54969,16 @@ const openapiDocument = {
54662
54969
  "description": "Ignored.",
54663
54970
  "anyOf": [{ "$ref": "#/components/schemas/EmailRuleBreadth" }, { "type": "null" }]
54664
54971
  },
54972
+ "breadth_scope": {
54973
+ "description": "Ignored (the compile answer's breadth_scope): set a rule's scope with evaluation_scope.",
54974
+ "$ref": "#/components/schemas/EmailRuleScopeUsed"
54975
+ },
54976
+ "scope_warnings": {
54977
+ "description": "Ignored (the compile answer's scope_warnings).",
54978
+ "maxItems": 150,
54979
+ "type": "array",
54980
+ "items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
54981
+ },
54665
54982
  "kind": {
54666
54983
  "description": "Only grant.",
54667
54984
  "type": "string",
@@ -54709,7 +55026,7 @@ const openapiDocument = {
54709
55026
  "type": ["string", "null"]
54710
55027
  },
54711
55028
  "server_notes": {
54712
- "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
55029
+ "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
54713
55030
  "type": "array",
54714
55031
  "items": { "type": "string" }
54715
55032
  },
@@ -54758,7 +55075,7 @@ const openapiDocument = {
54758
55075
  "type": ["boolean", "null"]
54759
55076
  },
54760
55077
  "notice": {
54761
- "description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, then what accepting would share. For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
55078
+ "description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
54762
55079
  "type": ["string", "null"]
54763
55080
  },
54764
55081
  "target_can_accept": {
@@ -54768,6 +55085,11 @@ const openapiDocument = {
54768
55085
  "target_warning": {
54769
55086
  "description": "Why the member asked cannot accept it yet, naming the permission their role lacks. The request is still sent. Null when they can, or when target_can_accept is null.",
54770
55087
  "type": ["string", "null"]
55088
+ },
55089
+ "existing": {
55090
+ "description": "Present, as true, when the create carried an Idempotency-Key and you already had a pending request to this member asking exactly this (name, english, tree, explanation and message, naming the member the same way): that request is returned (200), and no second one is made or sent.",
55091
+ "type": "boolean",
55092
+ "const": true
54771
55093
  }
54772
55094
  },
54773
55095
  "required": [
@@ -54884,7 +55206,7 @@ const openapiDocument = {
54884
55206
  "type": ["string", "null"]
54885
55207
  },
54886
55208
  "server_notes": {
54887
- "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
55209
+ "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
54888
55210
  "type": "array",
54889
55211
  "items": { "type": "string" }
54890
55212
  },
@@ -54933,7 +55255,7 @@ const openapiDocument = {
54933
55255
  "type": ["boolean", "null"]
54934
55256
  },
54935
55257
  "notice": {
54936
- "description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, then what accepting would share. For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
55258
+ "description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
54937
55259
  "type": ["string", "null"]
54938
55260
  }
54939
55261
  },
@@ -55047,7 +55369,7 @@ const openapiDocument = {
55047
55369
  "minimum": 0
55048
55370
  },
55049
55371
  "objection_notice": {
55050
- "description": "With pending_objections above 0: that members asked you to turn it off, and how to answer.",
55372
+ "description": "With pending_objections above 0: that members objected (each message says what they ask: to turn it off, narrow it or explain it), and how to answer.",
55051
55373
  "type": "string"
55052
55374
  },
55053
55375
  "created_at": {
@@ -55104,11 +55426,11 @@ const openapiDocument = {
55104
55426
  "rule_deleted",
55105
55427
  null
55106
55428
  ],
55107
- "description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
55429
+ "description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved, on a share that ended before new versions kept shares) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
55108
55430
  },
55109
55431
  "accepted_rule_version": {
55110
55432
  "type": "integer",
55111
- "description": "The version of the rule that was accepted. A new version of the rule ends the share."
55433
+ "description": "The version of the rule that was accepted. A later version keeps the share: what each version matches is shared from when it is saved."
55112
55434
  },
55113
55435
  "edited_on_accept": {
55114
55436
  "type": "boolean",
@@ -55293,6 +55615,16 @@ const openapiDocument = {
55293
55615
  "description": "Ignored.",
55294
55616
  "anyOf": [{ "$ref": "#/components/schemas/EmailRuleBreadth" }, { "type": "null" }]
55295
55617
  },
55618
+ "breadth_scope": {
55619
+ "description": "Ignored (the compile answer's breadth_scope): set a rule's scope with evaluation_scope.",
55620
+ "$ref": "#/components/schemas/EmailRuleScopeUsed"
55621
+ },
55622
+ "scope_warnings": {
55623
+ "description": "Ignored (the compile answer's scope_warnings).",
55624
+ "maxItems": 150,
55625
+ "type": "array",
55626
+ "items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
55627
+ },
55296
55628
  "kind": {
55297
55629
  "description": "Only grant.",
55298
55630
  "type": "string",
@@ -55311,18 +55643,18 @@ const openapiDocument = {
55311
55643
  "AcceptEmailRuleRequestResult": {
55312
55644
  "type": "object",
55313
55645
  "properties": {
55314
- "request": { "$ref": "#/components/schemas/EmailRuleRequest" },
55315
- "rule": { "$ref": "#/components/schemas/EmailRuleWithVersion" },
55316
- "share": { "$ref": "#/components/schemas/EmailRuleShare" },
55317
55646
  "notice": {
55318
- "description": "What is now shared, in words. When you changed the rule and it can now match mail the request left out by who it was sent to (such as mail where an address is only copied), that comes first.",
55647
+ "description": "What is now shared, in words. When you changed the rule and it can now match mail the request left out by who it was sent to (such as mail where an address is only copied), that comes first; when you changed its english, tree or explanation (edited_on_accept; a new name alone is no change), that rule.current is what you agreed to and request what was asked.",
55319
55648
  "type": "string"
55320
- }
55649
+ },
55650
+ "rule": { "$ref": "#/components/schemas/EmailRuleWithVersion" },
55651
+ "share": { "$ref": "#/components/schemas/EmailRuleShare" },
55652
+ "request": { "$ref": "#/components/schemas/EmailRuleRequest" }
55321
55653
  },
55322
55654
  "required": [
55323
- "request",
55324
55655
  "rule",
55325
- "share"
55656
+ "share",
55657
+ "request"
55326
55658
  ]
55327
55659
  },
55328
55660
  "ListEmailRuleSharesResult": {
@@ -55666,6 +55998,10 @@ const openapiDocument = {
55666
55998
  "enum": ["grant", "do_not_share"],
55667
55999
  "description": "grant: what it matches can be shared. do_not_share: it blocks sharing what it matches."
55668
56000
  },
56001
+ "do_not_share_note": {
56002
+ "description": "On a grant rule: that the active do-not-share rules over an email run first, keeping from it what they match and holding back what they cannot decide, which is decided again for up to a day and shared only if none of them then matches it.",
56003
+ "type": "string"
56004
+ },
55669
56005
  "author": {
55670
56006
  "description": "Who wrote it.",
55671
56007
  "$ref": "#/components/schemas/EmailRuleCoveringAuthor"
@@ -55690,6 +56026,14 @@ const openapiDocument = {
55690
56026
  "created_at": {
55691
56027
  "type": "string",
55692
56028
  "format": "date-time"
56029
+ },
56030
+ "english": {
56031
+ "description": "What its author asked for, in their words, at its current version. Null when it has no version, was deleted after the page was read, or the words could not be read in time; GET /v1/email-rules/covering-me/{id} shows them with its tree.",
56032
+ "type": ["string", "null"]
56033
+ },
56034
+ "explanation": {
56035
+ "description": "What its current version matches, as compiled. Null as english is.",
56036
+ "type": ["string", "null"]
55693
56037
  }
55694
56038
  },
55695
56039
  "required": [
@@ -55755,6 +56099,10 @@ const openapiDocument = {
55755
56099
  "enum": ["grant", "do_not_share"],
55756
56100
  "description": "grant: what it matches can be shared. do_not_share: it blocks sharing what it matches."
55757
56101
  },
56102
+ "do_not_share_note": {
56103
+ "description": "On a grant rule: that the active do-not-share rules over an email run first, keeping from it what they match and holding back what they cannot decide, which is decided again for up to a day and shared only if none of them then matches it.",
56104
+ "type": "string"
56105
+ },
55758
56106
  "author": {
55759
56107
  "description": "Who wrote it.",
55760
56108
  "$ref": "#/components/schemas/EmailRuleCoveringAuthor"
@@ -55978,10 +56326,13 @@ const openapiDocument = {
55978
56326
  "description": "Whether it is to a rule you wrote, in your current membership."
55979
56327
  },
55980
56328
  "message": {
55981
- "description": "Why the objector objects; null when none was given, or once withdrawn.",
56329
+ "description": "Why they object and what they ask (to turn the rule off, narrow it, or explain who receives it); null when none was given, or once withdrawn.",
56330
+ "type": ["string", "null"]
56331
+ },
56332
+ "decline_reason": {
56333
+ "description": "The author's answer when declining, which the objector sees; null when none was given.",
55982
56334
  "type": ["string", "null"]
55983
56335
  },
55984
- "decline_reason": { "type": ["string", "null"] },
55985
56336
  "created_at": {
55986
56337
  "type": "string",
55987
56338
  "format": "date-time"
@@ -56041,7 +56392,7 @@ const openapiDocument = {
56041
56392
  "type": ["string", "null"],
56042
56393
  "minLength": 1,
56043
56394
  "maxLength": 500,
56044
- "description": "Why you object, up to 500 characters; null or absent for none. The rule's author and the organization's owners and admins see it while it stands; withdrawing clears it."
56395
+ "description": "Why you object and what you ask, up to 500 characters: to turn the rule off, to narrow it, or to explain who receives what it matches. Null or absent for none. The rule's author and the organization's owners and admins see it while it stands; withdrawing clears it."
56045
56396
  }
56046
56397
  },
56047
56398
  "required": ["rule_id"],
@@ -56060,7 +56411,7 @@ const openapiDocument = {
56060
56411
  "type": ["string", "null"],
56061
56412
  "minLength": 1,
56062
56413
  "maxLength": 500,
56063
- "description": "Why you are declining, up to 500 characters; null or absent for none. The member who objected sees it."
56414
+ "description": "Why you are declining, up to 500 characters; null or absent for none. The member who objected sees it: it is how to answer one that asks you to narrow the rule or explain who receives it."
56064
56415
  } },
56065
56416
  "additionalProperties": false
56066
56417
  },
@@ -60803,6 +61154,36 @@ const openapiDocument = {
60803
61154
  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
60804
61155
  },
60805
61156
  "previous_key_id": { "type": "string" },
61157
+ "name": {
61158
+ "description": "The successor's name: the rotated key's, which it keeps.",
61159
+ "type": ["string", "null"]
61160
+ },
61161
+ "grant": {
61162
+ "description": "The grant the successor holds, as a create answers it: the rotated key's own, carried over unchanged (rules, addresses and domains included).",
61163
+ "type": "object",
61164
+ "properties": {
61165
+ "template": { "type": ["string", "null"] },
61166
+ "credential_grant_id": { "type": ["string", "null"] },
61167
+ "permissions": {
61168
+ "type": ["array", "null"],
61169
+ "items": { "type": "string" }
61170
+ },
61171
+ "mail_scope": {},
61172
+ "resources": {}
61173
+ },
61174
+ "required": [
61175
+ "template",
61176
+ "credential_grant_id",
61177
+ "permissions",
61178
+ "mail_scope",
61179
+ "resources"
61180
+ ],
61181
+ "additionalProperties": {}
61182
+ },
61183
+ "rotated_from": {
61184
+ "description": "The rotated key: previous_key_id, under the name GET /v1/keys/{id} gives it.",
61185
+ "type": "string"
61186
+ },
60806
61187
  "previous_key_expires_at": {
60807
61188
  "type": "string",
60808
61189
  "format": "date-time",
@@ -65180,17 +65561,32 @@ function receiversChangeText(item) {
65180
65561
  ];
65181
65562
  return changed.length > 0 ? changed.join(", ") : "same totals, an owner or webhook site changed";
65182
65563
  }
65564
+ const STOP_REASONS = /* @__PURE__ */ new Map([
65565
+ ["deleted", "rule deleted"],
65566
+ ["turned_off", "turned off"],
65567
+ ["no_longer_covers", "no longer reaches your mailboxes"]
65568
+ ]);
65569
+ /**
65570
+ * Why a stopped notice says the rule stopped covering you, from its
65571
+ * stop_reason. Null for any other notice, and for one whose reason is
65572
+ * missing or unknown (an older server).
65573
+ */
65574
+ function stoppedText(item) {
65575
+ if (item.state !== "stopped") return null;
65576
+ const reason = item.stop_reason;
65577
+ return typeof reason === "string" ? STOP_REASONS.get(reason) ?? null : null;
65578
+ }
65183
65579
  /** Where to see what covers you now, whatever the notices have caught up with. */
65184
65580
  const COVERING_NOW = `\`primitive email-rule-oversight list-email-rules-covering-me\` shows what covers you now.`;
65185
65581
  /**
65186
65582
  * One line per coverage notice: what it told (started, new_version,
65187
- * receivers_changed, or baseline for a rule that already covered you when
65188
- * notices began), when, the rule's name then, and its author; and, first,
65583
+ * receivers_changed, stopped, or baseline for a rule that already covered you
65584
+ * when notices began), when, the rule's name then, and its author; and, first,
65189
65585
  * each rule that covers you now whose notice is not written yet (pending,
65190
65586
  * dated when the rule last changed), then the rule's id (rule_id; a pending
65191
65587
  * row's own id is the rule's), never the notice's own id, which no command
65192
- * takes; and, when any row is a receivers_changed notice with its totals,
65193
- * what changed in them (CHANGE).
65588
+ * takes; and, when any row is a receivers_changed notice with its totals or
65589
+ * a stopped notice with its reason, what changed (CHANGE).
65194
65590
  * `complete` says the listing is the whole of it (from the first page to the
65195
65591
  * last, nothing withheld). Even then an empty one is no promise that nothing
65196
65592
  * covers you: notices can lag, so it
@@ -65202,11 +65598,11 @@ function formatConcerningRows(items, complete = false, asOf, pendingComplete) {
65202
65598
  const rows = items.map((item) => [
65203
65599
  item.state,
65204
65600
  minute(item.created_at),
65205
- item.name ?? "(unnamed)",
65601
+ `${item.name ?? "(unnamed)"}${item.rule_now === "deleted" ? " (deleted)" : ""}`,
65206
65602
  item.created_through.name ?? item.created_through.id ?? "",
65207
65603
  item.rule_id ?? (item.state === "pending" ? item.id : "")
65208
65604
  ]);
65209
- const changes = items.map((item) => receiversChangeText(item));
65605
+ const changes = items.map((item) => receiversChangeText(item) ?? stoppedText(item));
65210
65606
  const withChange = changes.some((change) => change !== null);
65211
65607
  if (withChange) for (const [i, row] of rows.entries()) row.push(changes[i] ?? "");
65212
65608
  const header = [
@@ -65220,15 +65616,43 @@ function formatConcerningRows(items, complete = false, asOf, pendingComplete) {
65220
65616
  const widths = header.map((h, i) => Math.max(h.length, ...rows.map((row) => (row[i] ?? "").length)));
65221
65617
  const line = (cells) => cells.map((cell, i) => i === cells.length - 1 ? cell : cell.padEnd(widths[i] ?? 0)).join(" ").trimEnd();
65222
65618
  const pending = items.some((item) => item.state === "pending") ? ["", `pending: the rule covers you now and its notice is not written yet. ${COVERING_NOW}`] : [];
65619
+ const baseline = items.some((item) => item.state === "baseline") ? ["", "baseline: the rule already covered you when these notices began, so its start was never told as news."] : [];
65223
65620
  const receivers = items.some((item) => item.state === "receivers_changed") ? ["", "receivers_changed: who receives the rule's matches changed, with the totals before and after where the server sends them. `primitive email-rule-oversight get-email-rule-covering-me <rule-id>` shows who receives them now, by owner, while the rule covers you."] : [];
65224
65621
  return [
65225
65622
  line(header),
65226
65623
  ...rows.map(line),
65227
65624
  ...pending,
65625
+ ...baseline,
65228
65626
  ...receivers,
65229
65627
  ...unfinished ? ["", pending.length > 0 ? unfinished : `${unfinished} ${COVERING_NOW}`] : []
65230
65628
  ].join("\n");
65231
65629
  }
65630
+ async function observingRules(client) {
65631
+ try {
65632
+ const result = await listEmailRulesCoveringMe({
65633
+ client,
65634
+ query: { limit: 100 }
65635
+ });
65636
+ const page = result.data;
65637
+ const status = result.response?.status;
65638
+ if (status === 401 || status === 403) return "refused";
65639
+ if (result.error !== void 0 || !Array.isArray(page?.data)) return null;
65640
+ return {
65641
+ count: page.data.filter((rule) => rule.state === "observe" && rule.is_author === false).length,
65642
+ more: typeof page.meta?.cursor === "string"
65643
+ };
65644
+ } catch {
65645
+ return null;
65646
+ }
65647
+ }
65648
+ const OBSERVE_SAYS = "a rule in observe records a decision on every email it reads and shares or blocks nothing until it is turned active, which is listed here as started. `primitive email-rule-oversight list-email-rules-covering-me` lists them.";
65649
+ /** The footer under `activity concerning` for rules in observe over your mail, or null with none to tell of. */
65650
+ function formatObservingFooter(observing) {
65651
+ if (observing === "refused") return null;
65652
+ if (observing === null) return `Rules in observe can also cover your mail: ${OBSERVE_SAYS}`;
65653
+ if (observing.count === 0) return observing.more ? `Rules in observe can also cover your mail: ${OBSERVE_SAYS}` : null;
65654
+ return `${`${observing.more ? "At least " : ""}${observing.count} ${observing.count === 1 ? "rule" : "rules"} in observe also ${observing.count === 1 ? "covers" : "cover"} your mail`}: ${OBSERVE_SAYS}`;
65655
+ }
65232
65656
  /** What was left out, and why: no counts, only the kinds and what would show them. */
65233
65657
  function formatWithheld(withheld) {
65234
65658
  if (withheld.length === 0) return null;
@@ -65314,6 +65738,10 @@ async function runActivityList(command, flags, relation) {
65314
65738
  }
65315
65739
  const complete = flags.state === "all" && !flags.cursor && !cursor && withheld.length === 0 && pendingComplete !== false;
65316
65740
  command.log(relation === "asked" ? formatAskedRows(items, complete) : relation === "concerning" ? formatConcerningRows(items, complete, asOf, pendingComplete) : formatActivityRows(covers, items));
65741
+ if (relation === "concerning" && !flags.cursor && !withheld.some((w) => w.kind === "email_rule_coverage")) {
65742
+ const observing = formatObservingFooter(await observingRules(auth.apiClient.client));
65743
+ if (observing) command.log(`\n${observing}`);
65744
+ }
65317
65745
  const notShown = formatWithheld(withheld);
65318
65746
  if (notShown) command.log(`\n${notShown}`);
65319
65747
  if (cursor) command.log(`\nMore: ${resumeCommand(command.config.bin, flags, cursor, relation)}`);
@@ -65361,7 +65789,9 @@ var ActivityCreatedCommand = class ActivityCreatedCommand extends Command {
65361
65789
  var ActivityAskedCommand = class ActivityAskedCommand extends Command {
65362
65790
  static description = `List what other members asked of you, newest first, open or answered: rule requests made to you for an email rule over your own mail, and objections to rules you wrote, each with its kind, where it stands and who asked.
65363
65791
 
65364
- Signed in with \`primitive login\`, you see what was asked of you under your current membership. A key, an app or an agent is asked nothing. Read a request (email_rule_request) with \`primitive email-rules get-email-rule-request --id <id>\`, and an objection (email_rule_objection) with \`primitive email-rule-oversight get-email-rule-objection --id <id>\`, then accept or decline it.`;
65792
+ Signed in with \`primitive login\`, you see what was asked of you under your current membership. A key, an app or an agent is asked nothing. Read a request (email_rule_request) with \`primitive email-rules get-email-rule-request --id <id>\`, and an objection (email_rule_objection) with \`primitive email-rule-oversight get-email-rule-objection --id <id>\`, then accept or decline it.
65793
+
65794
+ Requests and objections you made are not here: \`primitive activity created --kind email_rule_request,email_rule_objection\` lists them with where each stands (pending, accepted, declined or withdrawn; with --json, ended_at says when it was decided).`;
65365
65795
  static summary = "List what other members asked of you";
65366
65796
  static examples = [
65367
65797
  "<%= config.bin %> activity asked",
@@ -65396,12 +65826,12 @@ var ActivityAskedCommand = class ActivityAskedCommand extends Command {
65396
65826
  }
65397
65827
  };
65398
65828
  var ActivityConcerningCommand = class ActivityConcerningCommand extends Command {
65399
- static description = `List what other members did that concerns your own mail, newest first: each time another member's rule started covering your mailboxes, that is, it was made or turned active over them or an active rule came to reach you, once per rule, not per mailbox (started), saved a new version while covering it (new_version), or changed who receives its matches: its keys, webhooks or share (receivers_changed, with the totals before and after in the table, and under receivers_change with --json, at most once every 15 minutes for a rule), named as the rule was then, with its author. A rule that already covered you when these notices began is listed once as baseline. A rule in draft or observe grants and blocks nothing and gets no notice while it stays there, though \`primitive email-rule-oversight list-email-rules-covering-me\` lists it; turning it active is what is listed, and a rule that covers you again within an hour of its last started or baseline notice gets no new one, though a version it saved meanwhile is listed as new_version, and a change in who receives its matches as receivers_changed. A rule that stops covering you and a rename are not listed.
65829
+ static description = `List what other members did that concerns your own mail, newest first: each time another member's rule started covering your mailboxes, that is, it was made or turned active over them or an active rule came to reach you, once per rule, not per mailbox (started), saved a new version while covering it (new_version), or changed who receives its matches: its keys, webhooks or share (receivers_changed, with the totals before and after in the table, and under receivers_change with --json, at most once every 15 minutes for a rule), named as the rule was then, with its author. A rule that already covered you when these notices began is listed once as baseline. A rule in draft or observe grants and blocks nothing and gets no notice while it stays there, though \`primitive email-rule-oversight list-email-rules-covering-me\` lists it; turning it active is what is listed, and a rule that covers you again within an hour of its last started or baseline notice gets no new one unless you were told it stopped since, though a version it saved meanwhile is listed as new_version, and a change in who receives its matches as receivers_changed. A rule that stops covering you is listed as stopped, with why (rule deleted, turned off, or no longer reaching your mailboxes; stop_reason with --json), about 5 minutes after the notices find it stopped, so one turned off and on again meanwhile is listed neither stopped nor started again. A rename is not listed.
65400
65830
 
65401
65831
  Notices can lag. Until a start is written, a rule that now covers you is listed first as pending, dated when the rule last changed, and with --json its id is the rule's. When the check for such rules did not finish, the listing says so and --json carries pending_complete: false; run it again in a moment.
65402
65832
 
65403
65833
  Signed in with \`primitive login\`, you see the notices about your own mail under your current membership. A key, an app or an agent has none. The rules that cover you now, with their ids, are listed by \`primitive email-rule-oversight list-email-rules-covering-me\`; ask a rule's author to turn it off with \`primitive email-rule-oversight create-email-rule-objection --rule-id <rule-id>\`. The table's RULE ID, and rule_id with --json, is the rule's id, which \`primitive email-rule-oversight get-email-rule-covering-me <rule-id>\` and create-email-rule-objection --rule-id take; with --json each notice's own id is the notice's, not the rule's.`;
65404
- static summary = "List rules that started covering your mail or changed";
65834
+ static summary = "List rules that started covering your mail, changed or stopped";
65405
65835
  static examples = ["<%= config.bin %> activity concerning", "<%= config.bin %> activity concerning --all --json"];
65406
65836
  static flags = {
65407
65837
  "api-key": API_KEY_FLAG$3,
@@ -70328,7 +70758,7 @@ function buildChatSendFailureEnvelope(params) {
70328
70758
  return {
70329
70759
  outcome: params.outcome,
70330
70760
  exit_code: params.exitCode ?? sendOutcomeExitCode(params.outcome),
70331
- outcome_message: params.outcomeMessage ?? (params.outcome === "already_sent" ? formatDeletedEarlierSendNotice() : formatSendFailureSummary(params.noun, params.outcome, params.httpStatus)),
70761
+ outcome_message: params.outcomeMessage ?? (params.outcome === "already_sent" ? formatDeletedEarlierSendNotice() : formatSendFailureSummary(params.noun, params.outcome, params.httpStatus, params.httpStatus === void 0 ? void 0 : sendErrorMessage(params.error))),
70332
70762
  ...sendIdentityFields({
70333
70763
  idempotencyKey: params.idempotencyKey,
70334
70764
  sent
@@ -71360,11 +71790,6 @@ var ChatCommand = class ChatCommand extends Command {
71360
71790
  saveChatReceipt(params.receipt);
71361
71791
  }
71362
71792
  params.progress?.fail(outcome === "already_sent" ? `${params.noun} already sent earlier.` : `${params.noun} send failed.`);
71363
- writeErrorWithHints(errorPayload);
71364
- surfaceUnauthorizedHint({
71365
- ...params.authFailureContext,
71366
- payload: errorPayload
71367
- });
71368
71793
  const envelope = buildChatSendFailureEnvelope({
71369
71794
  error: errorPayload,
71370
71795
  httpStatus,
@@ -71379,6 +71804,11 @@ var ChatCommand = class ChatCommand extends Command {
71379
71804
  process.stderr.write(`${chatNoticeText(envelope.outcome_message)}\n`);
71380
71805
  if (!params.json) this.log(envelope.outcome_message);
71381
71806
  } else process.stderr.write(`${chatFailureText(envelope.outcome_message)}\n`);
71807
+ writeErrorWithHints(errorPayload);
71808
+ surfaceUnauthorizedHint({
71809
+ ...params.authFailureContext,
71810
+ payload: errorPayload
71811
+ });
71382
71812
  if (params.json) this.log(JSON.stringify(envelope, null, 2));
71383
71813
  if (envelope.exit_code !== 0) process.exitCode = envelope.exit_code;
71384
71814
  }
@@ -72571,7 +73001,7 @@ async function checkAskedOfYou(client, now = Date.now()) {
72571
73001
  const waiting = asked.more ? [`at least ${requests + objections} rule requests and objections`] : [...requests > 0 ? [plural$1(requests, "rule request")] : [], ...objections > 0 ? [plural$1(objections, "objection")] : []];
72572
73002
  const items = concerning?.items ?? [];
72573
73003
  const pending = items.filter((item) => item.state === "pending").length;
72574
- const notices = items.filter((item) => (item.state === "started" || item.state === "new_version" || item.state === "receivers_changed") && Date.parse(item.created_at) >= since).length;
73004
+ const notices = items.filter((item) => (item.state === "started" || item.state === "new_version" || item.state === "receivers_changed" || item.state === "stopped") && Date.parse(item.created_at) >= since).length;
72575
73005
  const parts = [
72576
73006
  ...waiting.length > 0 ? [`${waiting.join(" and ")} waiting for you`] : [],
72577
73007
  ...ASKED_KINDS.filter((kind) => hidden.has(kind)).map((kind) => `${kind === "email_rule_request" ? "rule requests" : "objections"} not shown to this credential`),
@@ -72621,7 +73051,7 @@ function checkReceiverStart(configDir, profileName) {
72621
73051
  }
72622
73052
  }
72623
73053
  var DoctorCommand = class DoctorCommand extends Command {
72624
- static description = `Run a one-shot environment health check: Node version, proxy env, CLI auth resolution, /account reachability, verified-domain status, and, signed in as yourself, the rule requests and objections waiting for you and the rules over your mail that recently started covering it or changed. With PRIMITIVE_AGENT_PROFILE selected, reports saved identity offline and points to whoami and exact listener status instead of account-only checks. Prints actionable hints for each warning or failure.`;
73054
+ static description = `Run a one-shot environment health check: Node version, proxy env, CLI auth resolution, /account reachability, verified-domain status, and, signed in as yourself, the rule requests and objections waiting for you and the rules over your mail that recently started covering it, changed or stopped. With PRIMITIVE_AGENT_PROFILE selected, reports saved identity offline and points to whoami and exact listener status instead of account-only checks. Prints actionable hints for each warning or failure.`;
72625
73055
  static summary = "Check the local environment and live API for common problems";
72626
73056
  static examples = ["<%= config.bin %> doctor", "<%= config.bin %> doctor --api-key prim_..."];
72627
73057
  static flags = {
@@ -75721,8 +76151,8 @@ const PRIMITIVE_TEAM_AUTHOR = {
75721
76151
  name: "Primitive Team",
75722
76152
  url: "https://primitive.dev"
75723
76153
  };
75724
- const SDK_VERSION_RANGE = "^3.0.0-preview.14";
75725
- const CLI_VERSION_RANGE = "^3.0.0-preview.14";
76154
+ const SDK_VERSION_RANGE = "^3.0.0-preview.16";
76155
+ const CLI_VERSION_RANGE = "^3.0.0-preview.16";
75726
76156
  const ESBUILD_VERSION_RANGE = "^0.27.0";
75727
76157
  function renderHandler() {
75728
76158
  return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and