@primitivedotdev/cli 3.0.0-preview.15 → 3.0.0-preview.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-command-D5Nbd6Pq.js → api-command-CgBNtNyD.js} +1693 -492
- package/dist/{machine-session-DyGP7wDs.js → machine-session-CSqj4DmF.js} +4 -4
- package/dist/{notify-session-B64Lgv6Z.js → notify-session-Pt4oRh0I.js} +2 -2
- package/dist/oclif/auto-signal-worker.js +3 -3
- package/dist/oclif/auto-signals.js +1 -1
- package/dist/oclif/command-not-found.js +22 -3
- package/dist/oclif/help.js +5 -2
- package/dist/oclif/index.js +570 -160
- package/dist/oclif/receiver-heal.js +2 -2
- package/dist/{repeats-Dj_o6c-X-C1y88ZwJ.js → repeats-Dj_o6c-X-DlfpQiUq.js} +29 -11
- package/dist/{scoped-chat-CocomDwR.js → scoped-chat-Du-Bi0tC.js} +1 -1
- package/dist/{signal-command-lJM0763f.js → signal-command-DZuZbt-_.js} +12 -6
- package/package.json +3 -3
package/dist/oclif/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $n as
|
|
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-
|
|
1
|
+
import { $ as interactionHumanLine, $t as ATTACHMENT_WAIT_MAX_MS, A as listenForCopyHotkey, At as successfulSendOutcome, B as serverMuted, Bt as detectAgentRuntime, C as STEP_UP_TOKEN_FLAG_DESCRIPTION, Ct as reportSendCommandResult, D as withApproval, Dt as sendWaitClampNotice, E as terminalApprovalIo, Et as sendOutcomeExitCode, F as displayAddress, G as wakeRelationship, Gt as emptyEmailListHint, Ht as runtimeSessionVariableList, I as formatMailWakeLine, It as generatedAgentName, J as clearReadPendingMail, Jt as classificationFactLines, K as claimPendingMail, Kt as mailReach, L as latestOwnOutbound, Lt as identitySuggestions, M as explainPendingMailNotFound, N as bareAddress, Nt as cliInvocation, O as canOfferCopyHotkey, Ot as sentHistoryWindowStart, P as describeWake, Pt as connectNextSteps, Q as removePendingMail, Qt as ATTACHMENT_WAIT_FLAG_DESCRIPTION, R as readThreadContext, Rt as loadSkillLine, S as STEP_UP_HEADER$1, St as priorRepliesThatWentOut, T as promptLine$2, Tt as sendIdentityFields, U as wakeReadCommand, Ut as formatAlreadySentNotice, V as serverRelationship, Vt as detectRuntimeSession, W as wakeRecipientField, Wt as withFlagSuggestion, X as readPendingMail, Xt as isEmailId, Y as pendingMailPath, Yt as classificationOf, Z as recordPendingMail, Zt as noFactsMessage, _ as runWithTiming, _n as switchCurrentOrg, _t as formatDeletedEarlierSendNotice, a as createOperationCommand, an as refreshStoredCliCredentials, at as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, b as writeErrorWithHints, bn as setKnownCommands, bt as formatSendFailureSummary, c as formatErrorPayload, cn as selectedOrgFromEnv, ct as apiResultHttpStatus, d as isGrantRefusal, dn as credentialsFromUserLogin, dt as buildThrownSendFailureEnvelope, en as withAttachmentWait, et as interactionNextActions, f as networkErrorHint, fn as fetchCliOrgs, ft as checkPriorReplies, g as refusesCredential, gn as roleKeyText, gt as followUpCommandPrefix, h as refusalDetails, hn as roleKeyLabel, ht as excludeSignalReplies, i as TIME_FLAG_DESCRIPTION, in as createCliApiClient, j as openBrowser, jt as thrownErrorExitCode, k as formatBrowserLoginInstructions, kt as serializeErrorPayload, l as hasControlCharacter$1, ln as CliOrgRefusedError, lt as assertValidIdempotencyKey, m as readTextFileFlag, mn as revokeUserLogin, mt as deriveSendIdempotencyKey, n as API_ERROR_CODES, nt as replyExpectation, o as extractErrorCode, on as refuseOrgSelectionForProfile, ot as MAX_SEND_WAIT_TIMEOUT_MS, p as parameterFlagName, pn as isBuiltInRoleKey, pt as classifySendError, q as clearConsumedPendingMail, qt as readCallerMailFor, r as OPERATION_PATH_FLAGS, rn as createAuthenticatedCliApiClient, rt as replyInteractionWarning, s as extractErrorPayload, sn as resolveCliApiRequestConfig, st as SEND_OUTCOME_HELP, t as API_BASE_URL_FLAG_DESCRIPTION, tn as ConnectedAgentKeyRequiredError, tt as readEmailInteraction, u as headerFlagName, un as RESTRICTED_ROLE_NOTE, ut as buildFollowUpCommand, v as surfaceUnauthorizedHint, vn as routeWarningLines, vt as formatPriorRepliesCheckSkipped, w as approveThenRerunHint, wt as sendErrorMessage, x as BROWSER_FLAG_DESCRIPTION, xn as operationManifest, xt as formatSendRecordFailureSummary, y as takesStepUp, yn as sanitizeForTerminal, yt as formatPriorRepliesWarning, z as sentInThread, zt as currentMailSessionKey } from "../api-command-CgBNtNyD.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-DlfpQiUq.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-Pt4oRh0I.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-
|
|
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-
|
|
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-CSqj4DmF.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-Du-Bi0tC.js";
|
|
8
8
|
import { autoSignalEligible, dispatchAutoRead, dispatchAutoWorking, haltAutoWorking, isSentSignal, readWorkingLease, restoreAutoWorking } from "./auto-signals.js";
|
|
9
|
-
import {
|
|
9
|
+
import { _ as EventConnection, a as ensureSharedMailSubscription, d as createSharedMailWaiter, f as openSharedMailStore, g as otherParticipants, h as readConversationFollow, i as sharedMailScope, l as KEY_REVOKED_MESSAGE, m as followEmailConversation, n as reconcileChatSend, p as reserveSharedMailSubscription, r as openSharedMailReceiver, s as AGENT_CONNECTION_REQUIRED_MESSAGE, t as sendSignal, u as isConnectedAgentKey, v as EventReceiverError } from "../signal-command-DZuZbt-_.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";
|
|
@@ -21779,7 +21779,7 @@ const openapiDocument = {
|
|
|
21779
21779
|
"/activity/objects": { "get": {
|
|
21780
21780
|
"operationId": "listActivityObjects",
|
|
21781
21781
|
"summary": "List what you created, or what you were asked",
|
|
21782
|
-
"description": "The objects the caller created, newest first, each with where it stands now, including ones since disabled, deleted or revoked where the object keeps a row: Functions, endpoints, Function triggers, pull subscriptions, recipient routes, filters, wake schedules, repeating sends and scheduled sends. An API key, an app or an agent sees what it created itself; a webhook given to an API key lists under that key. A person (a dashboard session, or their own Primitive CLI or app login) sees what they created through any credential of theirs, each item naming it, and also their API keys, personal agents, email rules, rule requests and objections to rules over their mail (objections only on the dashboard or the Primitive CLI). Each kind is listed only if the caller could list it through that kind's own route; a kind it could not is named in withheld, with no count. Ids, names and states only: never a webhook URL or mail content. Needs activity:read_self. With relation=asked it lists instead what other members asked of the person, open or answered: the rule requests made to them, and the objections to rules they wrote, under their current membership, each naming the member who asked or objected in created_through. A key, an app or an agent has none, and gets both kinds in withheld. With relation=concerning it lists instead what other members did that concerns the person's own mail: each time a rule started covering one of their mailboxes, saved a new version
|
|
21782
|
+
"description": "The objects the caller created, newest first, each with where it stands now, including ones since disabled, deleted or revoked where the object keeps a row: Functions, endpoints, Function triggers, pull subscriptions, recipient routes, filters, wake schedules, repeating sends and scheduled sends. An API key, an app or an agent sees what it created itself; a webhook given to an API key lists under that key. A person (a dashboard session, or their own Primitive CLI or app login) sees what they created through any credential of theirs, each item naming it, and also their API keys, personal agents, email rules, rule requests and objections to rules over their mail (objections only on the dashboard or the Primitive CLI). Each kind is listed only if the caller could list it through that kind's own route; a kind it could not is named in withheld, with no count. Ids, names and states only: never a webhook URL or mail content. Needs activity:read_self. With relation=asked it lists instead what other members asked of the person, open or answered: the rule requests made to them, and the objections to rules they wrote, under their current membership, each naming the member who asked or objected in created_through. A key, an app or an agent has none, and gets both kinds in withheld. With relation=concerning it lists instead what other members did that concerns the person's own mail: each time a rule started covering one of their mailboxes, saved a new version while covering it, or stopped covering it, named as the rule was then, naming its author in created_through, under their current membership; only on the dashboard or the Primitive CLI. A key, an app or an agent has none, and gets email_rule_coverage in withheld. A notice never reads as ended. Notices are written by a periodic job and can lag: until the notices record a rule starting to cover you, the first page lists that rule as pending (pending_complete says whether that check finished), and as_of says about when the notices last looked. For what covers you now, read GET /email-rules/covering-me.",
|
|
21783
21783
|
"tags": ["Activity"],
|
|
21784
21784
|
"security": [{ "BearerAuth": [] }],
|
|
21785
21785
|
"parameters": [
|
|
@@ -21790,7 +21790,7 @@ const openapiDocument = {
|
|
|
21790
21790
|
"description": "created (the default), asked or concerning.",
|
|
21791
21791
|
"schema": {
|
|
21792
21792
|
"default": "created",
|
|
21793
|
-
"description": "created (the default): what you created. asked: what other members asked of you, open or answered: rule requests made to you, and objections to rules you wrote; kind may then name only email_rule_request and email_rule_objection. concerning: what other members did that concerns your own mail: an active rule that started covering one of your mailboxes, saved a new version
|
|
21793
|
+
"description": "created (the default): what you created. asked: what other members asked of you, open or answered: rule requests made to you, and objections to rules you wrote; kind may then name only email_rule_request and email_rule_objection. concerning: what other members did that concerns your own mail: an active rule that started covering one of your mailboxes, saved a new version while covering it, or stopped covering it (email_rule_coverage, the only kind it takes). A rule in draft or observe is not told of; GET /v1/email-rules/covering-me lists it. asked and concerning are for a person's own view only.",
|
|
21794
21794
|
"type": "string",
|
|
21795
21795
|
"enum": [
|
|
21796
21796
|
"created",
|
|
@@ -22755,7 +22755,7 @@ const openapiDocument = {
|
|
|
22755
22755
|
"patch": {
|
|
22756
22756
|
"operationId": "updateEmailRule",
|
|
22757
22757
|
"summary": "Change a rule",
|
|
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. 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
|
|
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).",
|
|
22759
22759
|
"tags": ["Email Rules"],
|
|
22760
22760
|
"security": [{ "BearerAuth": [] }],
|
|
22761
22761
|
"parameters": [{
|
|
@@ -22788,7 +22788,7 @@ const openapiDocument = {
|
|
|
22788
22788
|
}
|
|
22789
22789
|
},
|
|
22790
22790
|
"400": {
|
|
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 or
|
|
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.",
|
|
22792
22792
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
22793
22793
|
},
|
|
22794
22794
|
"401": {
|
|
@@ -22811,7 +22811,7 @@ const openapiDocument = {
|
|
|
22811
22811
|
}
|
|
22812
22812
|
},
|
|
22813
22813
|
"403": {
|
|
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. 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.",
|
|
22815
22815
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
22816
22816
|
},
|
|
22817
22817
|
"404": {
|
|
@@ -22819,7 +22819,7 @@ const openapiDocument = {
|
|
|
22819
22819
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
22820
22820
|
},
|
|
22821
22821
|
"409": {
|
|
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 or
|
|
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.",
|
|
22823
22823
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
22824
22824
|
},
|
|
22825
22825
|
"429": {
|
|
@@ -23093,7 +23093,7 @@ const openapiDocument = {
|
|
|
23093
23093
|
"/emails/{id}/rule-results": { "get": {
|
|
23094
23094
|
"operationId": "listEmailRuleResults",
|
|
23095
23095
|
"summary": "List every rule's result on an email",
|
|
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. 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).",
|
|
23097
23097
|
"tags": ["Email Rules"],
|
|
23098
23098
|
"security": [{ "BearerAuth": [] }],
|
|
23099
23099
|
"parameters": [{
|
|
@@ -24881,7 +24881,7 @@ const openapiDocument = {
|
|
|
24881
24881
|
"/email-rules/covering-me": { "get": {
|
|
24882
24882
|
"operationId": "listEmailRulesCoveringMe",
|
|
24883
24883
|
"summary": "List the rules over your mail",
|
|
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):
|
|
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.",
|
|
24885
24885
|
"tags": ["Email Rule Oversight"],
|
|
24886
24886
|
"security": [{ "BearerAuth": [] }],
|
|
24887
24887
|
"parameters": [{
|
|
@@ -24979,7 +24979,7 @@ const openapiDocument = {
|
|
|
24979
24979
|
"/email-rules/covering-me/{id}": { "get": {
|
|
24980
24980
|
"operationId": "getEmailRuleCoveringMe",
|
|
24981
24981
|
"summary": "Get a rule over your mail",
|
|
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>). 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.",
|
|
24983
24983
|
"tags": ["Email Rule Oversight"],
|
|
24984
24984
|
"security": [{ "BearerAuth": [] }],
|
|
24985
24985
|
"parameters": [{
|
|
@@ -25318,7 +25318,7 @@ const openapiDocument = {
|
|
|
25318
25318
|
"post": {
|
|
25319
25319
|
"operationId": "createEmailRuleObjection",
|
|
25320
25320
|
"summary": "Object to a rule over your mail",
|
|
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,
|
|
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, declines it (optionally with a reason the objector sees), or answers it amended once they have saved a newer version of the rule, or the member who made it withdraws it, which clears its message (not from an email to the author already sent or being sent). 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.",
|
|
25322
25322
|
"tags": ["Email Rule Oversight"],
|
|
25323
25323
|
"security": [{ "BearerAuth": [] }],
|
|
25324
25324
|
"requestBody": {
|
|
@@ -25419,7 +25419,7 @@ const openapiDocument = {
|
|
|
25419
25419
|
"get": {
|
|
25420
25420
|
"operationId": "listEmailRuleObjections",
|
|
25421
25421
|
"summary": "List objections",
|
|
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,
|
|
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, declines it (optionally with a reason the objector sees), or answers it amended once they have saved a newer version of the rule, or the member who made it withdraws it, which clears its message (not from an email to the author already sent or being sent). 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.",
|
|
25423
25423
|
"tags": ["Email Rule Oversight"],
|
|
25424
25424
|
"security": [{ "BearerAuth": [] }],
|
|
25425
25425
|
"parameters": [
|
|
@@ -25553,7 +25553,7 @@ const openapiDocument = {
|
|
|
25553
25553
|
"/email-rule-objections/{id}": { "get": {
|
|
25554
25554
|
"operationId": "getEmailRuleObjection",
|
|
25555
25555
|
"summary": "Get an objection",
|
|
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,
|
|
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, declines it (optionally with a reason the objector sees), or answers it amended once they have saved a newer version of the rule, or the member who made it withdraws it, which clears its message (not from an email to the author already sent or being sent). 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.",
|
|
25557
25557
|
"tags": ["Email Rule Oversight"],
|
|
25558
25558
|
"security": [{ "BearerAuth": [] }],
|
|
25559
25559
|
"parameters": [{
|
|
@@ -25637,7 +25637,7 @@ const openapiDocument = {
|
|
|
25637
25637
|
"/email-rule-objections/{id}/withdraw": { "post": {
|
|
25638
25638
|
"operationId": "withdrawEmailRuleObjection",
|
|
25639
25639
|
"summary": "Withdraw an objection",
|
|
25640
|
-
"description": "Withdraws a pending objection you made, and clears its message. 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.",
|
|
25640
|
+
"description": "Withdraws a pending objection you made, and clears its message; an email to the rule's author already sent or being sent keeps 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.",
|
|
25641
25641
|
"tags": ["Email Rule Oversight"],
|
|
25642
25642
|
"security": [{ "BearerAuth": [] }],
|
|
25643
25643
|
"parameters": [{
|
|
@@ -25735,7 +25735,7 @@ const openapiDocument = {
|
|
|
25735
25735
|
"/email-rule-objections/{id}/decline": { "post": {
|
|
25736
25736
|
"operationId": "declineEmailRuleObjection",
|
|
25737
25737
|
"summary": "Decline an objection to your rule",
|
|
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
|
|
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 explain who receives what the rule matches, the reason is your answer. If you changed the rule instead, answer amended. 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.",
|
|
25739
25739
|
"tags": ["Email Rule Oversight"],
|
|
25740
25740
|
"security": [{ "BearerAuth": [] }],
|
|
25741
25741
|
"parameters": [{
|
|
@@ -25945,6 +25945,121 @@ const openapiDocument = {
|
|
|
25945
25945
|
},
|
|
25946
25946
|
"x-primitive-permission": ["mail:read"]
|
|
25947
25947
|
} },
|
|
25948
|
+
"/email-rule-objections/{id}/amend": { "post": {
|
|
25949
|
+
"operationId": "amendEmailRuleObjection",
|
|
25950
|
+
"summary": "Answer an objection to your rule as amended",
|
|
25951
|
+
"description": "Answers a pending objection to a rule you wrote by saying you changed the rule: save a new version first (PATCH /email-rules/{id}), then answer amended, optionally with a note the member who objected sees. Records the version the rule has now (rule.amended_version). Refused unless the rule's current version is newer than when the objection was made (rule.objected_version). 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.",
|
|
25952
|
+
"tags": ["Email Rule Oversight"],
|
|
25953
|
+
"security": [{ "BearerAuth": [] }],
|
|
25954
|
+
"parameters": [{
|
|
25955
|
+
"name": "id",
|
|
25956
|
+
"in": "path",
|
|
25957
|
+
"required": true,
|
|
25958
|
+
"description": "The objection id.",
|
|
25959
|
+
"schema": {
|
|
25960
|
+
"type": "string",
|
|
25961
|
+
"format": "uuid"
|
|
25962
|
+
}
|
|
25963
|
+
}, {
|
|
25964
|
+
"name": "Idempotency-Key",
|
|
25965
|
+
"in": "header",
|
|
25966
|
+
"required": false,
|
|
25967
|
+
"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.",
|
|
25968
|
+
"schema": {
|
|
25969
|
+
"type": "string",
|
|
25970
|
+
"minLength": 1,
|
|
25971
|
+
"maxLength": 255
|
|
25972
|
+
}
|
|
25973
|
+
}],
|
|
25974
|
+
"requestBody": {
|
|
25975
|
+
"required": false,
|
|
25976
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/AmendEmailRuleObjectionRequest" } } }
|
|
25977
|
+
},
|
|
25978
|
+
"responses": {
|
|
25979
|
+
"200": {
|
|
25980
|
+
"description": "Answer an objection to your rule as amended",
|
|
25981
|
+
"content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
|
|
25982
|
+
"type": "object",
|
|
25983
|
+
"required": ["data"],
|
|
25984
|
+
"properties": { "data": { "$ref": "#/components/schemas/AmendEmailRuleObjectionResult" } }
|
|
25985
|
+
}] } } },
|
|
25986
|
+
"headers": {
|
|
25987
|
+
"ratelimit-limit": { "$ref": "#/components/headers/ratelimit-limit" },
|
|
25988
|
+
"ratelimit-remaining": { "$ref": "#/components/headers/ratelimit-remaining" },
|
|
25989
|
+
"ratelimit-reset": { "$ref": "#/components/headers/ratelimit-reset" },
|
|
25990
|
+
"ratelimit-policy": { "$ref": "#/components/headers/ratelimit-policy" }
|
|
25991
|
+
}
|
|
25992
|
+
},
|
|
25993
|
+
"400": {
|
|
25994
|
+
"description": "Invalid request parameters",
|
|
25995
|
+
"content": { "application/json": {
|
|
25996
|
+
"schema": { "$ref": "#/components/schemas/ErrorResponse" },
|
|
25997
|
+
"example": {
|
|
25998
|
+
"success": false,
|
|
25999
|
+
"error": {
|
|
26000
|
+
"code": "validation_error",
|
|
26001
|
+
"message": "Invalid domain format"
|
|
26002
|
+
}
|
|
26003
|
+
}
|
|
26004
|
+
} }
|
|
26005
|
+
},
|
|
26006
|
+
"401": {
|
|
26007
|
+
"description": "Invalid or missing API key",
|
|
26008
|
+
"content": { "application/json": {
|
|
26009
|
+
"schema": { "$ref": "#/components/schemas/ErrorResponse" },
|
|
26010
|
+
"example": {
|
|
26011
|
+
"success": false,
|
|
26012
|
+
"error": {
|
|
26013
|
+
"code": "unauthorized",
|
|
26014
|
+
"message": "Invalid or missing API key"
|
|
26015
|
+
}
|
|
26016
|
+
}
|
|
26017
|
+
} },
|
|
26018
|
+
"headers": {
|
|
26019
|
+
"ratelimit-limit": { "$ref": "#/components/headers/ratelimit-limit-unauthenticated" },
|
|
26020
|
+
"ratelimit-remaining": { "$ref": "#/components/headers/ratelimit-remaining-unauthenticated" },
|
|
26021
|
+
"ratelimit-reset": { "$ref": "#/components/headers/ratelimit-reset-unauthenticated" },
|
|
26022
|
+
"ratelimit-policy": { "$ref": "#/components/headers/ratelimit-policy-unauthenticated" }
|
|
26023
|
+
}
|
|
26024
|
+
},
|
|
26025
|
+
"403": {
|
|
26026
|
+
"description": "feature_not_enabled: this organization lacks the email rules feature; permission refusals answer forbidden or grant_forbidden; details.reason first_party_required means this credential is not your dashboard session or the Primitive CLI. forbidden with details.reason author_only: only the rule's author can answer it.",
|
|
26027
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
26028
|
+
},
|
|
26029
|
+
"404": {
|
|
26030
|
+
"description": "not_found: no objection with this id that you can see.",
|
|
26031
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
26032
|
+
},
|
|
26033
|
+
"409": {
|
|
26034
|
+
"description": "not_pending: it was already decided or withdrawn (details.status). conflict with details.reason no_new_version: the rule has no version newer than details.objected_version (details.current_version is its version now); rule_deleted: the rule was deleted.",
|
|
26035
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
26036
|
+
},
|
|
26037
|
+
"429": {
|
|
26038
|
+
"description": "Rate limit exceeded. The `ratelimit-*` headers describe the limiter that rejected this request, with its own limit and window, not the API budget that successful responses report. A limiter that reports only a wait sends `Retry-After` alone.",
|
|
26039
|
+
"headers": {
|
|
26040
|
+
"Retry-After": {
|
|
26041
|
+
"schema": { "type": "integer" },
|
|
26042
|
+
"description": "Seconds to wait before retrying"
|
|
26043
|
+
},
|
|
26044
|
+
"ratelimit-limit": { "$ref": "#/components/headers/ratelimit-limit-429" },
|
|
26045
|
+
"ratelimit-remaining": { "$ref": "#/components/headers/ratelimit-remaining-429" },
|
|
26046
|
+
"ratelimit-reset": { "$ref": "#/components/headers/ratelimit-reset" },
|
|
26047
|
+
"ratelimit-policy": { "$ref": "#/components/headers/ratelimit-policy-429" }
|
|
26048
|
+
},
|
|
26049
|
+
"content": { "application/json": {
|
|
26050
|
+
"schema": { "$ref": "#/components/schemas/ErrorResponse" },
|
|
26051
|
+
"example": {
|
|
26052
|
+
"success": false,
|
|
26053
|
+
"error": {
|
|
26054
|
+
"code": "rate_limit_exceeded",
|
|
26055
|
+
"message": "Rate limit exceeded"
|
|
26056
|
+
}
|
|
26057
|
+
}
|
|
26058
|
+
} }
|
|
26059
|
+
}
|
|
26060
|
+
},
|
|
26061
|
+
"x-primitive-permission": ["mail:read"]
|
|
26062
|
+
} },
|
|
25948
26063
|
"/domains/{id}/agent-authorization": { "get": {
|
|
25949
26064
|
"operationId": "getDomainAgentAuthorization",
|
|
25950
26065
|
"summary": "Get a domain's Agent Authorization status",
|
|
@@ -41297,6 +41412,7 @@ const openapiDocument = {
|
|
|
41297
41412
|
"keep_refused",
|
|
41298
41413
|
"key_change_superseded",
|
|
41299
41414
|
"key_recently_created",
|
|
41415
|
+
"key_revoked",
|
|
41300
41416
|
"last_owner",
|
|
41301
41417
|
"latest_message_mismatch",
|
|
41302
41418
|
"latest_message_thread_unresolved",
|
|
@@ -43257,11 +43373,11 @@ const openapiDocument = {
|
|
|
43257
43373
|
"raw_size_bytes": { "type": ["integer", "null"] },
|
|
43258
43374
|
"webhook_status": {
|
|
43259
43375
|
"$ref": "#/components/schemas/EmailWebhookStatus",
|
|
43260
|
-
"description": "
|
|
43376
|
+
"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
43377
|
},
|
|
43262
43378
|
"webhook_attempt_count": {
|
|
43263
43379
|
"type": "integer",
|
|
43264
|
-
"description": "
|
|
43380
|
+
"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
43381
|
},
|
|
43266
43382
|
"thread_id": {
|
|
43267
43383
|
"type": ["string", "null"],
|
|
@@ -43762,29 +43878,29 @@ const openapiDocument = {
|
|
|
43762
43878
|
"rejection_reason": { "type": ["string", "null"] },
|
|
43763
43879
|
"webhook_status": {
|
|
43764
43880
|
"$ref": "#/components/schemas/EmailWebhookStatus",
|
|
43765
|
-
"description": "
|
|
43881
|
+
"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
43882
|
},
|
|
43767
43883
|
"webhook_attempt_count": {
|
|
43768
43884
|
"type": "integer",
|
|
43769
|
-
"description": "
|
|
43885
|
+
"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
43886
|
},
|
|
43771
43887
|
"webhook_last_attempt_at": {
|
|
43772
43888
|
"type": ["string", "null"],
|
|
43773
43889
|
"format": "date-time",
|
|
43774
|
-
"description": "
|
|
43890
|
+
"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
43891
|
},
|
|
43776
43892
|
"webhook_last_status_code": {
|
|
43777
43893
|
"type": ["integer", "null"],
|
|
43778
|
-
"description": "
|
|
43894
|
+
"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
43895
|
},
|
|
43780
43896
|
"webhook_last_error": {
|
|
43781
43897
|
"type": ["string", "null"],
|
|
43782
|
-
"description": "
|
|
43898
|
+
"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."
|
|
43783
43899
|
},
|
|
43784
43900
|
"webhook_fired_at": {
|
|
43785
43901
|
"type": ["string", "null"],
|
|
43786
43902
|
"format": "date-time",
|
|
43787
|
-
"description": "
|
|
43903
|
+
"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."
|
|
43788
43904
|
},
|
|
43789
43905
|
"smtp_helo": { "type": ["string", "null"] },
|
|
43790
43906
|
"smtp_mail_from": {
|
|
@@ -44051,7 +44167,7 @@ const openapiDocument = {
|
|
|
44051
44167
|
},
|
|
44052
44168
|
"shared_through": {
|
|
44053
44169
|
"type": ["object", "null"],
|
|
44054
|
-
"description": "
|
|
44170
|
+
"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.",
|
|
44055
44171
|
"required": [
|
|
44056
44172
|
"share_id",
|
|
44057
44173
|
"rule_name",
|
|
@@ -44080,7 +44196,7 @@ const openapiDocument = {
|
|
|
44080
44196
|
},
|
|
44081
44197
|
"rule_deliveries": {
|
|
44082
44198
|
"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, and when it could not be read in time. A key reading it through a rule is not a delivery.",
|
|
44199
|
+
"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
44200
|
"required": [
|
|
44085
44201
|
"rules",
|
|
44086
44202
|
"hidden",
|
|
@@ -48393,7 +48509,7 @@ const openapiDocument = {
|
|
|
48393
48509
|
"duration_ms": { "type": ["integer", "null"] },
|
|
48394
48510
|
"last_error": {
|
|
48395
48511
|
"type": ["string", "null"],
|
|
48396
|
-
"description": "Why the last attempt failed, or null. A webhook's answer
|
|
48512
|
+
"description": "Why the last attempt failed, or null. A webhook's answer follows its status (HTTP 404: ...) as plain text, at most 300 characters (response_body has more); older attempts can quote more. It is quoted only for a caller who can read the webhook (GET /endpoints/{id}; a deleted webhook only for a caller who reads every webhook); anyone else gets the status and a note. Text the platform writes (a redirect not followed, a network error) is shown to everyone."
|
|
48397
48513
|
},
|
|
48398
48514
|
"created_at": {
|
|
48399
48515
|
"type": "string",
|
|
@@ -51374,12 +51490,12 @@ const openapiDocument = {
|
|
|
51374
51490
|
},
|
|
51375
51491
|
"id": { "type": "string" },
|
|
51376
51492
|
"name": {
|
|
51377
|
-
"description": "The name the object is known by: an endpoint's display name, a route's or filter's pattern, a Function's name, a send's From address, a wake schedule's command and the address it wakes, an API key's name, an agent's address, a rule's or rule request's name, and for an objection or a coverage notice the name its rule had then. Never a webhook URL and never mail content.",
|
|
51493
|
+
"description": "The name the object is known by: an endpoint's display name, a route's or filter's pattern, a Function's name, a send's From address, a wake schedule's command and the address it wakes, an API key's name, an agent's address, a rule's or rule request's name, and for an objection or a coverage notice the name its rule had then (for a stopped notice, when you were last told of it, or while it last covered you). Never a webhook URL and never mail content.",
|
|
51378
51494
|
"type": ["string", "null"]
|
|
51379
51495
|
},
|
|
51380
51496
|
"state": {
|
|
51381
51497
|
"type": "string",
|
|
51382
|
-
"description": "Where it stands now: enabled, disabled, deleted or replaced (endpoints and routes), enabled or disabled (filters, wake schedules), live, suspended or deleted (Functions), active, paused or ended (repeating sends), scheduled (scheduled sends), active, suspended, expired or revoked (API keys), pending, claimed, connected or revoked (agents), draft, observe or active (email rules), pending, accepted, declined or withdrawn (rule requests and objections), and for a coverage notice what it told: started (a rule was made or turned active over your mailboxes, or an active rule came to reach you; once per rule, not per mailbox), new_version,
|
|
51498
|
+
"description": "Where it stands now: enabled, disabled, deleted or replaced (endpoints and routes), enabled or disabled (filters, wake schedules), live, suspended or deleted (Functions), active, paused or ended (repeating sends), scheduled (scheduled sends), active, suspended, expired or revoked (API keys), pending, claimed, connected or revoked (agents), draft, observe or active (email rules), pending, accepted, declined or withdrawn (rule requests and objections; an objection may also be amended), and for a coverage notice what it told: started (a rule was made or turned active over your mailboxes, or an active rule came to reach you; once per rule, not per mailbox), new_version, stopped (it no longer covers you, why in stop_reason), or baseline (it already covered you when notices began). pending: a rule started covering your mailbox and the notices have not recorded that start yet (a restart within an hour of the last start notice, or within 5 minutes of the notices finding the rule stopped, is recorded without a new one, unless you were told it stopped since); its id is then the rule's, and created_at when the rule last changed."
|
|
51383
51499
|
},
|
|
51384
51500
|
"created_at": {
|
|
51385
51501
|
"type": "string",
|
|
@@ -51388,7 +51504,7 @@ const openapiDocument = {
|
|
|
51388
51504
|
"ended_at": {
|
|
51389
51505
|
"type": ["string", "null"],
|
|
51390
51506
|
"format": "date-time",
|
|
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
|
|
51507
|
+
"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, withdrawn or, for an objection, amended); null otherwise, as on every coverage notice (rule_now marks one whose rule was deleted)."
|
|
51392
51508
|
},
|
|
51393
51509
|
"owned_now": {
|
|
51394
51510
|
"type": "string",
|
|
@@ -51489,6 +51605,15 @@ const openapiDocument = {
|
|
|
51489
51605
|
}
|
|
51490
51606
|
},
|
|
51491
51607
|
"required": ["before", "after"]
|
|
51608
|
+
},
|
|
51609
|
+
"stop_reason": {
|
|
51610
|
+
"description": "For a stopped notice: deleted, turned_off (no longer active), or no_longer_covers (active, reaching none of your mailboxes now).",
|
|
51611
|
+
"type": "string",
|
|
51612
|
+
"enum": [
|
|
51613
|
+
"deleted",
|
|
51614
|
+
"turned_off",
|
|
51615
|
+
"no_longer_covers"
|
|
51616
|
+
]
|
|
51492
51617
|
}
|
|
51493
51618
|
},
|
|
51494
51619
|
"required": [
|
|
@@ -51535,7 +51660,7 @@ const openapiDocument = {
|
|
|
51535
51660
|
"as_of": {
|
|
51536
51661
|
"type": ["string", "null"],
|
|
51537
51662
|
"format": "date-time",
|
|
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
|
|
51663
|
+
"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, or a stopped notice is still to be told, so this stops moving while neither."
|
|
51539
51664
|
},
|
|
51540
51665
|
"pending_complete": {
|
|
51541
51666
|
"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.",
|
|
@@ -51787,6 +51912,38 @@ const openapiDocument = {
|
|
|
51787
51912
|
},
|
|
51788
51913
|
"required": ["evaluation_scope", "scope_selection"]
|
|
51789
51914
|
},
|
|
51915
|
+
"EmailRuleScopeWarning": {
|
|
51916
|
+
"type": "object",
|
|
51917
|
+
"properties": {
|
|
51918
|
+
"name": {
|
|
51919
|
+
"type": "string",
|
|
51920
|
+
"maxLength": 320
|
|
51921
|
+
},
|
|
51922
|
+
"kind": {
|
|
51923
|
+
"type": "string",
|
|
51924
|
+
"enum": ["address", "domain"]
|
|
51925
|
+
},
|
|
51926
|
+
"reason": {
|
|
51927
|
+
"type": "string",
|
|
51928
|
+
"enum": [
|
|
51929
|
+
"unknown_domain",
|
|
51930
|
+
"inactive_domain",
|
|
51931
|
+
"unknown_address"
|
|
51932
|
+
],
|
|
51933
|
+
"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."
|
|
51934
|
+
},
|
|
51935
|
+
"message": {
|
|
51936
|
+
"type": "string",
|
|
51937
|
+
"maxLength": 1e3
|
|
51938
|
+
}
|
|
51939
|
+
},
|
|
51940
|
+
"required": [
|
|
51941
|
+
"name",
|
|
51942
|
+
"kind",
|
|
51943
|
+
"reason",
|
|
51944
|
+
"message"
|
|
51945
|
+
]
|
|
51946
|
+
},
|
|
51790
51947
|
"EmailRuleScopeSelection": {
|
|
51791
51948
|
"type": "object",
|
|
51792
51949
|
"properties": {
|
|
@@ -51885,6 +52042,12 @@ const openapiDocument = {
|
|
|
51885
52042
|
"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.",
|
|
51886
52043
|
"$ref": "#/components/schemas/EmailRuleScopeUsed"
|
|
51887
52044
|
},
|
|
52045
|
+
"scope_warnings": {
|
|
52046
|
+
"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.",
|
|
52047
|
+
"maxItems": 150,
|
|
52048
|
+
"type": "array",
|
|
52049
|
+
"items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
|
|
52050
|
+
},
|
|
51888
52051
|
"sql": {
|
|
51889
52052
|
"description": "Present only when include_sql was true.",
|
|
51890
52053
|
"type": "object",
|
|
@@ -51938,32 +52101,6 @@ const openapiDocument = {
|
|
|
51938
52101
|
"vocabulary"
|
|
51939
52102
|
]
|
|
51940
52103
|
},
|
|
51941
|
-
"EmailRuleScopeWarning": {
|
|
51942
|
-
"type": "object",
|
|
51943
|
-
"properties": {
|
|
51944
|
-
"name": { "type": "string" },
|
|
51945
|
-
"kind": {
|
|
51946
|
-
"type": "string",
|
|
51947
|
-
"enum": ["address", "domain"]
|
|
51948
|
-
},
|
|
51949
|
-
"reason": {
|
|
51950
|
-
"type": "string",
|
|
51951
|
-
"enum": [
|
|
51952
|
-
"unknown_domain",
|
|
51953
|
-
"inactive_domain",
|
|
51954
|
-
"unknown_address"
|
|
51955
|
-
],
|
|
51956
|
-
"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."
|
|
51957
|
-
},
|
|
51958
|
-
"message": { "type": "string" }
|
|
51959
|
-
},
|
|
51960
|
-
"required": [
|
|
51961
|
-
"name",
|
|
51962
|
-
"kind",
|
|
51963
|
-
"reason",
|
|
51964
|
-
"message"
|
|
51965
|
-
]
|
|
51966
|
-
},
|
|
51967
52104
|
"EmailRuleSampleJudgment": {
|
|
51968
52105
|
"type": "object",
|
|
51969
52106
|
"properties": {
|
|
@@ -52004,7 +52141,15 @@ const openapiDocument = {
|
|
|
52004
52141
|
"properties": {
|
|
52005
52142
|
"question": { "type": "string" },
|
|
52006
52143
|
"answer": { "type": ["boolean", "null"] },
|
|
52007
|
-
"
|
|
52144
|
+
"confidence": {
|
|
52145
|
+
"description": "How sure the answer is, from 0 to 1: the chance of the answer given, as webhook payloads carry it. Null when unanswered.",
|
|
52146
|
+
"type": ["number", "null"]
|
|
52147
|
+
},
|
|
52148
|
+
"probability": {
|
|
52149
|
+
"deprecated": true,
|
|
52150
|
+
"description": "Deprecated: read confidence. The chance the answer is yes.",
|
|
52151
|
+
"type": ["number", "null"]
|
|
52152
|
+
},
|
|
52008
52153
|
"error_class": { "type": "string" }
|
|
52009
52154
|
},
|
|
52010
52155
|
"required": [
|
|
@@ -52393,6 +52538,11 @@ const openapiDocument = {
|
|
|
52393
52538
|
"type": "string"
|
|
52394
52539
|
},
|
|
52395
52540
|
"subject": { "type": ["string", "null"] },
|
|
52541
|
+
"attachment_names": {
|
|
52542
|
+
"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.",
|
|
52543
|
+
"type": "array",
|
|
52544
|
+
"items": { "type": "string" }
|
|
52545
|
+
},
|
|
52396
52546
|
"parts": {
|
|
52397
52547
|
"description": "How each top-level part of the rule decided. Present for matched, near_miss and no_match.",
|
|
52398
52548
|
"type": "array",
|
|
@@ -52457,7 +52607,15 @@ const openapiDocument = {
|
|
|
52457
52607
|
"properties": {
|
|
52458
52608
|
"question": { "type": "string" },
|
|
52459
52609
|
"answer": { "type": ["boolean", "null"] },
|
|
52460
|
-
"
|
|
52610
|
+
"confidence": {
|
|
52611
|
+
"description": "How sure the answer is, from 0 to 1: the chance of the answer given, as webhook payloads carry it. Null when unanswered.",
|
|
52612
|
+
"type": ["number", "null"]
|
|
52613
|
+
},
|
|
52614
|
+
"probability": {
|
|
52615
|
+
"deprecated": true,
|
|
52616
|
+
"description": "Deprecated: read confidence. The chance the answer is yes.",
|
|
52617
|
+
"type": ["number", "null"]
|
|
52618
|
+
},
|
|
52461
52619
|
"error_class": { "type": "string" }
|
|
52462
52620
|
},
|
|
52463
52621
|
"required": [
|
|
@@ -52592,6 +52750,7 @@ const openapiDocument = {
|
|
|
52592
52750
|
},
|
|
52593
52751
|
"scope_warnings": {
|
|
52594
52752
|
"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.",
|
|
52753
|
+
"maxItems": 150,
|
|
52595
52754
|
"type": "array",
|
|
52596
52755
|
"items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
|
|
52597
52756
|
},
|
|
@@ -52781,7 +52940,15 @@ const openapiDocument = {
|
|
|
52781
52940
|
"properties": {
|
|
52782
52941
|
"question": { "type": "string" },
|
|
52783
52942
|
"answer": { "type": ["boolean", "null"] },
|
|
52784
|
-
"
|
|
52943
|
+
"confidence": {
|
|
52944
|
+
"description": "How sure the answer is, from 0 to 1: the chance of the answer given, as webhook payloads carry it. Null when unanswered.",
|
|
52945
|
+
"type": ["number", "null"]
|
|
52946
|
+
},
|
|
52947
|
+
"probability": {
|
|
52948
|
+
"deprecated": true,
|
|
52949
|
+
"description": "Deprecated: read confidence. The chance the answer is yes.",
|
|
52950
|
+
"type": ["number", "null"]
|
|
52951
|
+
},
|
|
52785
52952
|
"error_class": { "type": "string" }
|
|
52786
52953
|
},
|
|
52787
52954
|
"required": [
|
|
@@ -53142,7 +53309,15 @@ const openapiDocument = {
|
|
|
53142
53309
|
"properties": {
|
|
53143
53310
|
"question": { "type": "string" },
|
|
53144
53311
|
"answer": { "type": ["boolean", "null"] },
|
|
53145
|
-
"
|
|
53312
|
+
"confidence": {
|
|
53313
|
+
"description": "How sure the answer is, from 0 to 1: the chance of the answer given, as webhook payloads carry it. Null when unanswered.",
|
|
53314
|
+
"type": ["number", "null"]
|
|
53315
|
+
},
|
|
53316
|
+
"probability": {
|
|
53317
|
+
"deprecated": true,
|
|
53318
|
+
"description": "Deprecated: read confidence. The chance the answer is yes.",
|
|
53319
|
+
"type": ["number", "null"]
|
|
53320
|
+
},
|
|
53146
53321
|
"error_class": { "type": "string" }
|
|
53147
53322
|
},
|
|
53148
53323
|
"required": [
|
|
@@ -53327,6 +53502,7 @@ const openapiDocument = {
|
|
|
53327
53502
|
},
|
|
53328
53503
|
"scope_warnings": {
|
|
53329
53504
|
"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.",
|
|
53505
|
+
"maxItems": 150,
|
|
53330
53506
|
"type": "array",
|
|
53331
53507
|
"items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
|
|
53332
53508
|
},
|
|
@@ -53399,13 +53575,23 @@ const openapiDocument = {
|
|
|
53399
53575
|
}
|
|
53400
53576
|
},
|
|
53401
53577
|
"undecided_samples": {
|
|
53402
|
-
"description": "Made-up emails not decided, by index. Only a write
|
|
53578
|
+
"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.",
|
|
53403
53579
|
"type": "array",
|
|
53404
53580
|
"items": {
|
|
53405
53581
|
"type": "integer",
|
|
53406
53582
|
"minimum": 0
|
|
53407
53583
|
}
|
|
53408
53584
|
},
|
|
53585
|
+
"failed_sample_details": {
|
|
53586
|
+
"description": "failed_samples with each one's label, from a write that judged them before saving (if_expectations_pass, or by default).",
|
|
53587
|
+
"type": "array",
|
|
53588
|
+
"items": { "$ref": "#/components/schemas/EmailRuleSampleDetail" }
|
|
53589
|
+
},
|
|
53590
|
+
"undecided_sample_details": {
|
|
53591
|
+
"description": "undecided_samples with each one's label, as failed_sample_details.",
|
|
53592
|
+
"type": "array",
|
|
53593
|
+
"items": { "$ref": "#/components/schemas/EmailRuleSampleDetail" }
|
|
53594
|
+
},
|
|
53409
53595
|
"note": {
|
|
53410
53596
|
"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.",
|
|
53411
53597
|
"type": "string"
|
|
@@ -53431,7 +53617,7 @@ const openapiDocument = {
|
|
|
53431
53617
|
"required": ["version", "note"]
|
|
53432
53618
|
},
|
|
53433
53619
|
"affects": {
|
|
53434
|
-
"description": "After an update that saved a version: API keys listing the rule
|
|
53620
|
+
"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.",
|
|
53435
53621
|
"type": "object",
|
|
53436
53622
|
"properties": {
|
|
53437
53623
|
"keys": {
|
|
@@ -53454,11 +53640,11 @@ const openapiDocument = {
|
|
|
53454
53640
|
]
|
|
53455
53641
|
},
|
|
53456
53642
|
"notice": {
|
|
53457
|
-
"description": "After a write that saved a version of an active rule keys or
|
|
53643
|
+
"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.",
|
|
53458
53644
|
"type": "string"
|
|
53459
53645
|
},
|
|
53460
53646
|
"share_notice": {
|
|
53461
|
-
"description": "After a write that
|
|
53647
|
+
"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.",
|
|
53462
53648
|
"type": "string"
|
|
53463
53649
|
}
|
|
53464
53650
|
},
|
|
@@ -53592,6 +53778,17 @@ const openapiDocument = {
|
|
|
53592
53778
|
"created_at"
|
|
53593
53779
|
]
|
|
53594
53780
|
},
|
|
53781
|
+
"EmailRuleSampleDetail": {
|
|
53782
|
+
"type": "object",
|
|
53783
|
+
"properties": {
|
|
53784
|
+
"index": {
|
|
53785
|
+
"type": "integer",
|
|
53786
|
+
"minimum": 0
|
|
53787
|
+
},
|
|
53788
|
+
"label": { "type": ["string", "null"] }
|
|
53789
|
+
},
|
|
53790
|
+
"required": ["index", "label"]
|
|
53791
|
+
},
|
|
53595
53792
|
"CreateEmailRuleRequest": {
|
|
53596
53793
|
"type": "object",
|
|
53597
53794
|
"properties": {
|
|
@@ -53708,6 +53905,12 @@ const openapiDocument = {
|
|
|
53708
53905
|
"breadth_scope": {
|
|
53709
53906
|
"description": "Ignored (the compile answer's breadth_scope): set a rule's scope with evaluation_scope.",
|
|
53710
53907
|
"$ref": "#/components/schemas/EmailRuleScopeUsed"
|
|
53908
|
+
},
|
|
53909
|
+
"scope_warnings": {
|
|
53910
|
+
"description": "Ignored (the compile answer's scope_warnings).",
|
|
53911
|
+
"maxItems": 150,
|
|
53912
|
+
"type": "array",
|
|
53913
|
+
"items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
|
|
53711
53914
|
}
|
|
53712
53915
|
},
|
|
53713
53916
|
"required": [
|
|
@@ -54017,6 +54220,12 @@ const openapiDocument = {
|
|
|
54017
54220
|
"description": "Ignored (the compile answer's breadth_scope): set a rule's scope with evaluation_scope.",
|
|
54018
54221
|
"$ref": "#/components/schemas/EmailRuleScopeUsed"
|
|
54019
54222
|
},
|
|
54223
|
+
"scope_warnings": {
|
|
54224
|
+
"description": "Ignored (the compile answer's scope_warnings).",
|
|
54225
|
+
"maxItems": 150,
|
|
54226
|
+
"type": "array",
|
|
54227
|
+
"items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
|
|
54228
|
+
},
|
|
54020
54229
|
"kind": {
|
|
54021
54230
|
"description": "Must be the rule's own (400 kind_mismatch).",
|
|
54022
54231
|
"type": "string",
|
|
@@ -54080,7 +54289,7 @@ const openapiDocument = {
|
|
|
54080
54289
|
"maximum": 2147483647
|
|
54081
54290
|
},
|
|
54082
54291
|
"if_expectations_pass": {
|
|
54083
|
-
"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
|
|
54292
|
+
"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.",
|
|
54084
54293
|
"type": "boolean"
|
|
54085
54294
|
},
|
|
54086
54295
|
"restore_version": {
|
|
@@ -54194,7 +54403,7 @@ const openapiDocument = {
|
|
|
54194
54403
|
"question_answers": {
|
|
54195
54404
|
"type": "array",
|
|
54196
54405
|
"items": {},
|
|
54197
|
-
"description": "The answers to the rule's own questions, when they were asked."
|
|
54406
|
+
"description": "The answers to the rule's own questions, when they were asked: each with question, answer, confidence, the deprecated probability and, when unanswered, error_class, as a test gives them."
|
|
54198
54407
|
},
|
|
54199
54408
|
"detail_withheld": {
|
|
54200
54409
|
"description": "Present, as true, on a decision about an email whose content cannot be read (withheld, failed to parse, discarded, or still awaiting sender authentication): matched still says what the rule decided, but how it got there was read from that content, so parts and question_answers are empty and near_miss is false. Discarding an email's content normally removes its decisions. Absent otherwise.",
|
|
@@ -54308,7 +54517,7 @@ const openapiDocument = {
|
|
|
54308
54517
|
"exclusiveMinimum": 0
|
|
54309
54518
|
},
|
|
54310
54519
|
"reads_in_full": {
|
|
54311
|
-
"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.",
|
|
54520
|
+
"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.",
|
|
54312
54521
|
"type": "integer",
|
|
54313
54522
|
"minimum": 0
|
|
54314
54523
|
},
|
|
@@ -54531,7 +54740,15 @@ const openapiDocument = {
|
|
|
54531
54740
|
"properties": {
|
|
54532
54741
|
"question": { "type": "string" },
|
|
54533
54742
|
"answer": { "type": ["boolean", "null"] },
|
|
54534
|
-
"
|
|
54743
|
+
"confidence": {
|
|
54744
|
+
"description": "How sure the answer is, from 0 to 1: the chance of the answer given, as webhook payloads carry it. Null when unanswered.",
|
|
54745
|
+
"type": ["number", "null"]
|
|
54746
|
+
},
|
|
54747
|
+
"probability": {
|
|
54748
|
+
"deprecated": true,
|
|
54749
|
+
"description": "Deprecated: read confidence. The chance the answer is yes.",
|
|
54750
|
+
"type": ["number", "null"]
|
|
54751
|
+
},
|
|
54535
54752
|
"error_class": { "type": "string" }
|
|
54536
54753
|
},
|
|
54537
54754
|
"required": [
|
|
@@ -54723,6 +54940,7 @@ const openapiDocument = {
|
|
|
54723
54940
|
},
|
|
54724
54941
|
"scope_warnings": {
|
|
54725
54942
|
"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.",
|
|
54943
|
+
"maxItems": 150,
|
|
54726
54944
|
"type": "array",
|
|
54727
54945
|
"items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
|
|
54728
54946
|
},
|
|
@@ -54920,6 +55138,12 @@ const openapiDocument = {
|
|
|
54920
55138
|
"description": "Ignored (the compile answer's breadth_scope): set a rule's scope with evaluation_scope.",
|
|
54921
55139
|
"$ref": "#/components/schemas/EmailRuleScopeUsed"
|
|
54922
55140
|
},
|
|
55141
|
+
"scope_warnings": {
|
|
55142
|
+
"description": "Ignored (the compile answer's scope_warnings).",
|
|
55143
|
+
"maxItems": 150,
|
|
55144
|
+
"type": "array",
|
|
55145
|
+
"items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
|
|
55146
|
+
},
|
|
54923
55147
|
"kind": {
|
|
54924
55148
|
"description": "Only grant.",
|
|
54925
55149
|
"type": "string",
|
|
@@ -54967,7 +55191,7 @@ const openapiDocument = {
|
|
|
54967
55191
|
"type": ["string", "null"]
|
|
54968
55192
|
},
|
|
54969
55193
|
"server_notes": {
|
|
54970
|
-
"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.",
|
|
55194
|
+
"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.",
|
|
54971
55195
|
"type": "array",
|
|
54972
55196
|
"items": { "type": "string" }
|
|
54973
55197
|
},
|
|
@@ -55016,7 +55240,7 @@ const openapiDocument = {
|
|
|
55016
55240
|
"type": ["boolean", "null"]
|
|
55017
55241
|
},
|
|
55018
55242
|
"notice": {
|
|
55019
|
-
"description": "For the member asked, while pending: 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). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
55243
|
+
"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.",
|
|
55020
55244
|
"type": ["string", "null"]
|
|
55021
55245
|
},
|
|
55022
55246
|
"target_can_accept": {
|
|
@@ -55147,7 +55371,7 @@ const openapiDocument = {
|
|
|
55147
55371
|
"type": ["string", "null"]
|
|
55148
55372
|
},
|
|
55149
55373
|
"server_notes": {
|
|
55150
|
-
"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.",
|
|
55374
|
+
"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.",
|
|
55151
55375
|
"type": "array",
|
|
55152
55376
|
"items": { "type": "string" }
|
|
55153
55377
|
},
|
|
@@ -55196,7 +55420,7 @@ const openapiDocument = {
|
|
|
55196
55420
|
"type": ["boolean", "null"]
|
|
55197
55421
|
},
|
|
55198
55422
|
"notice": {
|
|
55199
|
-
"description": "For the member asked, while pending: 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). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
55423
|
+
"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.",
|
|
55200
55424
|
"type": ["string", "null"]
|
|
55201
55425
|
}
|
|
55202
55426
|
},
|
|
@@ -55367,11 +55591,11 @@ const openapiDocument = {
|
|
|
55367
55591
|
"rule_deleted",
|
|
55368
55592
|
null
|
|
55369
55593
|
],
|
|
55370
|
-
"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."
|
|
55594
|
+
"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."
|
|
55371
55595
|
},
|
|
55372
55596
|
"accepted_rule_version": {
|
|
55373
55597
|
"type": "integer",
|
|
55374
|
-
"description": "The version of the rule that was accepted. A
|
|
55598
|
+
"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."
|
|
55375
55599
|
},
|
|
55376
55600
|
"edited_on_accept": {
|
|
55377
55601
|
"type": "boolean",
|
|
@@ -55385,6 +55609,10 @@ const openapiDocument = {
|
|
|
55385
55609
|
"description": "True when the rule is active and the share live but new email is not being shared now (what was shared stays visible); false when new email is shared. Null when it does not apply (share not live, rule not active, or you are not on the share) or could not be read.",
|
|
55386
55610
|
"type": ["boolean", "null"]
|
|
55387
55611
|
},
|
|
55612
|
+
"activity": {
|
|
55613
|
+
"description": "For the member it is shared with, on the dashboard or the Primitive CLI, while it is live and their access reads content: whether it is working, so a quiet mailbox can be told from a stopped share. Null otherwise.",
|
|
55614
|
+
"anyOf": [{ "$ref": "#/components/schemas/EmailRuleShareActivity" }, { "type": "null" }]
|
|
55615
|
+
},
|
|
55388
55616
|
"is_granter": {
|
|
55389
55617
|
"type": "boolean",
|
|
55390
55618
|
"description": "Whether you are the member sharing their mail."
|
|
@@ -55428,7 +55656,7 @@ const openapiDocument = {
|
|
|
55428
55656
|
"rule_id": {
|
|
55429
55657
|
"type": ["string", "null"],
|
|
55430
55658
|
"format": "uuid",
|
|
55431
|
-
"description": "The rule itself. Only for the member sharing their mail; null for anyone else."
|
|
55659
|
+
"description": "The rule itself. Only for the member sharing their mail; null for anyone else. The member it is shared with lists this share's id in a key's grant.rules instead (from the dashboard), and their own webhooks receive what it shares."
|
|
55432
55660
|
}
|
|
55433
55661
|
},
|
|
55434
55662
|
"required": [
|
|
@@ -55449,6 +55677,41 @@ const openapiDocument = {
|
|
|
55449
55677
|
"rule_id"
|
|
55450
55678
|
]
|
|
55451
55679
|
},
|
|
55680
|
+
"EmailRuleShareActivity": {
|
|
55681
|
+
"type": "object",
|
|
55682
|
+
"properties": {
|
|
55683
|
+
"rule_active": {
|
|
55684
|
+
"type": "boolean",
|
|
55685
|
+
"description": "Whether the rule is active now: only an active rule shares."
|
|
55686
|
+
},
|
|
55687
|
+
"last_decided_at": {
|
|
55688
|
+
"type": ["string", "null"],
|
|
55689
|
+
"format": "date-time",
|
|
55690
|
+
"description": "The start of the hour in which the rule last decided on any email in the sharing member's mailboxes since the share began, counting only hours that have ended and the hour of the newest email shared; null if none, or not read."
|
|
55691
|
+
},
|
|
55692
|
+
"shared_emails": {
|
|
55693
|
+
"type": ["integer", "null"],
|
|
55694
|
+
"minimum": 0,
|
|
55695
|
+
"description": "Emails this share has shared, counted up to 10,000; null when these could not be read."
|
|
55696
|
+
},
|
|
55697
|
+
"shared_emails_more": {
|
|
55698
|
+
"description": "Present when it has shared more than 10,000.",
|
|
55699
|
+
"type": "boolean",
|
|
55700
|
+
"const": true
|
|
55701
|
+
},
|
|
55702
|
+
"last_shared_at": {
|
|
55703
|
+
"type": ["string", "null"],
|
|
55704
|
+
"format": "date-time",
|
|
55705
|
+
"description": "When it last shared one; null if it has not, or not read."
|
|
55706
|
+
}
|
|
55707
|
+
},
|
|
55708
|
+
"required": [
|
|
55709
|
+
"rule_active",
|
|
55710
|
+
"last_decided_at",
|
|
55711
|
+
"shared_emails",
|
|
55712
|
+
"last_shared_at"
|
|
55713
|
+
]
|
|
55714
|
+
},
|
|
55452
55715
|
"EmailRuleShareGranter": {
|
|
55453
55716
|
"type": "object",
|
|
55454
55717
|
"properties": {
|
|
@@ -55560,6 +55823,12 @@ const openapiDocument = {
|
|
|
55560
55823
|
"description": "Ignored (the compile answer's breadth_scope): set a rule's scope with evaluation_scope.",
|
|
55561
55824
|
"$ref": "#/components/schemas/EmailRuleScopeUsed"
|
|
55562
55825
|
},
|
|
55826
|
+
"scope_warnings": {
|
|
55827
|
+
"description": "Ignored (the compile answer's scope_warnings).",
|
|
55828
|
+
"maxItems": 150,
|
|
55829
|
+
"type": "array",
|
|
55830
|
+
"items": { "$ref": "#/components/schemas/EmailRuleScopeWarning" }
|
|
55831
|
+
},
|
|
55563
55832
|
"kind": {
|
|
55564
55833
|
"description": "Only grant.",
|
|
55565
55834
|
"type": "string",
|
|
@@ -55578,18 +55847,18 @@ const openapiDocument = {
|
|
|
55578
55847
|
"AcceptEmailRuleRequestResult": {
|
|
55579
55848
|
"type": "object",
|
|
55580
55849
|
"properties": {
|
|
55581
|
-
"request": { "$ref": "#/components/schemas/EmailRuleRequest" },
|
|
55582
|
-
"rule": { "$ref": "#/components/schemas/EmailRuleWithVersion" },
|
|
55583
|
-
"share": { "$ref": "#/components/schemas/EmailRuleShare" },
|
|
55584
55850
|
"notice": {
|
|
55585
55851
|
"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.",
|
|
55586
55852
|
"type": "string"
|
|
55587
|
-
}
|
|
55853
|
+
},
|
|
55854
|
+
"rule": { "$ref": "#/components/schemas/EmailRuleWithVersion" },
|
|
55855
|
+
"share": { "$ref": "#/components/schemas/EmailRuleShare" },
|
|
55856
|
+
"request": { "$ref": "#/components/schemas/EmailRuleRequest" }
|
|
55588
55857
|
},
|
|
55589
55858
|
"required": [
|
|
55590
|
-
"request",
|
|
55591
55859
|
"rule",
|
|
55592
|
-
"share"
|
|
55860
|
+
"share",
|
|
55861
|
+
"request"
|
|
55593
55862
|
]
|
|
55594
55863
|
},
|
|
55595
55864
|
"ListEmailRuleSharesResult": {
|
|
@@ -55961,6 +56230,14 @@ const openapiDocument = {
|
|
|
55961
56230
|
"created_at": {
|
|
55962
56231
|
"type": "string",
|
|
55963
56232
|
"format": "date-time"
|
|
56233
|
+
},
|
|
56234
|
+
"english": {
|
|
56235
|
+
"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.",
|
|
56236
|
+
"type": ["string", "null"]
|
|
56237
|
+
},
|
|
56238
|
+
"explanation": {
|
|
56239
|
+
"description": "What its current version matches, as compiled. Null as english is.",
|
|
56240
|
+
"type": ["string", "null"]
|
|
55964
56241
|
}
|
|
55965
56242
|
},
|
|
55966
56243
|
"required": [
|
|
@@ -56159,7 +56436,7 @@ const openapiDocument = {
|
|
|
56159
56436
|
"question_answers": {
|
|
56160
56437
|
"type": "array",
|
|
56161
56438
|
"items": {},
|
|
56162
|
-
"description": "The answers to the rule's own questions, when they were asked."
|
|
56439
|
+
"description": "The answers to the rule's own questions, when they were asked: each with question, answer, confidence, the deprecated probability and, when unanswered, error_class, as a test gives them."
|
|
56163
56440
|
},
|
|
56164
56441
|
"detail_withheld": {
|
|
56165
56442
|
"description": "Present, as true, when the email's content cannot be read: matched still says what the rule decided, and parts and question_answers are empty.",
|
|
@@ -56217,9 +56494,10 @@ const openapiDocument = {
|
|
|
56217
56494
|
"pending",
|
|
56218
56495
|
"accepted",
|
|
56219
56496
|
"declined",
|
|
56220
|
-
"withdrawn"
|
|
56497
|
+
"withdrawn",
|
|
56498
|
+
"amended"
|
|
56221
56499
|
],
|
|
56222
|
-
"description": "pending until the rule's author accepts it (turning the rule off) or
|
|
56500
|
+
"description": "pending until the rule's author accepts it (turning the rule off), declines it, or answers it amended (they saved a newer version of the rule), or the member who made it withdraws it; never changes after."
|
|
56223
56501
|
},
|
|
56224
56502
|
"rule": {
|
|
56225
56503
|
"type": "object",
|
|
@@ -56232,9 +56510,22 @@ const openapiDocument = {
|
|
|
56232
56510
|
"name": {
|
|
56233
56511
|
"type": "string",
|
|
56234
56512
|
"description": "Its name when the objection was made."
|
|
56513
|
+
},
|
|
56514
|
+
"objected_version": {
|
|
56515
|
+
"type": ["integer", "null"],
|
|
56516
|
+
"description": "The rule's version when the objection was made; null when it could not be told for an older objection."
|
|
56517
|
+
},
|
|
56518
|
+
"amended_version": {
|
|
56519
|
+
"type": ["integer", "null"],
|
|
56520
|
+
"description": "The rule's version when its author answered amended; null otherwise."
|
|
56235
56521
|
}
|
|
56236
56522
|
},
|
|
56237
|
-
"required": [
|
|
56523
|
+
"required": [
|
|
56524
|
+
"id",
|
|
56525
|
+
"name",
|
|
56526
|
+
"objected_version",
|
|
56527
|
+
"amended_version"
|
|
56528
|
+
]
|
|
56238
56529
|
},
|
|
56239
56530
|
"objector": {
|
|
56240
56531
|
"description": "Who objected.",
|
|
@@ -56260,6 +56551,10 @@ const openapiDocument = {
|
|
|
56260
56551
|
"description": "The author's answer when declining, which the objector sees; null when none was given.",
|
|
56261
56552
|
"type": ["string", "null"]
|
|
56262
56553
|
},
|
|
56554
|
+
"amend_note": {
|
|
56555
|
+
"description": "The author's note when answering amended, which the objector sees; null when none was given.",
|
|
56556
|
+
"type": ["string", "null"]
|
|
56557
|
+
},
|
|
56263
56558
|
"created_at": {
|
|
56264
56559
|
"type": "string",
|
|
56265
56560
|
"format": "date-time"
|
|
@@ -56283,6 +56578,7 @@ const openapiDocument = {
|
|
|
56283
56578
|
"is_author",
|
|
56284
56579
|
"message",
|
|
56285
56580
|
"decline_reason",
|
|
56581
|
+
"amend_note",
|
|
56286
56582
|
"created_at",
|
|
56287
56583
|
"decided_at",
|
|
56288
56584
|
"decided_by_user_id"
|
|
@@ -56319,7 +56615,7 @@ const openapiDocument = {
|
|
|
56319
56615
|
"type": ["string", "null"],
|
|
56320
56616
|
"minLength": 1,
|
|
56321
56617
|
"maxLength": 500,
|
|
56322
|
-
"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
|
|
56618
|
+
"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, and an email to the author about the objection quotes it. Withdrawing clears it from the objection, not from an email already sent or being sent."
|
|
56323
56619
|
}
|
|
56324
56620
|
},
|
|
56325
56621
|
"required": ["rule_id"],
|
|
@@ -56338,12 +56634,23 @@ const openapiDocument = {
|
|
|
56338
56634
|
"type": ["string", "null"],
|
|
56339
56635
|
"minLength": 1,
|
|
56340
56636
|
"maxLength": 500,
|
|
56341
|
-
"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
|
|
56637
|
+
"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 explain who receives it. If you changed the rule instead, answer amended."
|
|
56342
56638
|
} },
|
|
56343
56639
|
"additionalProperties": false
|
|
56344
56640
|
},
|
|
56345
56641
|
"DeclineEmailRuleObjectionResult": { "$ref": "#/components/schemas/EmailRuleObjection" },
|
|
56346
56642
|
"AcceptEmailRuleObjectionResult": { "$ref": "#/components/schemas/EmailRuleObjection" },
|
|
56643
|
+
"AmendEmailRuleObjectionRequest": {
|
|
56644
|
+
"type": "object",
|
|
56645
|
+
"properties": { "note": {
|
|
56646
|
+
"type": ["string", "null"],
|
|
56647
|
+
"minLength": 1,
|
|
56648
|
+
"maxLength": 500,
|
|
56649
|
+
"description": "What you changed, up to 500 characters; null or absent for none. The member who objected sees it."
|
|
56650
|
+
} },
|
|
56651
|
+
"additionalProperties": false
|
|
56652
|
+
},
|
|
56653
|
+
"AmendEmailRuleObjectionResult": { "$ref": "#/components/schemas/EmailRuleObjection" },
|
|
56347
56654
|
"GetDomainAgentAuthorizationResult": {
|
|
56348
56655
|
"type": "object",
|
|
56349
56656
|
"properties": {
|
|
@@ -58370,7 +58677,7 @@ const openapiDocument = {
|
|
|
58370
58677
|
"attempt_count": { "type": "integer" },
|
|
58371
58678
|
"duration_ms": { "type": ["integer", "null"] },
|
|
58372
58679
|
"last_error": {
|
|
58373
|
-
"description": "Why the last attempt failed, or null. A webhook's answer
|
|
58680
|
+
"description": "Why the last attempt failed, or null. A webhook's answer follows its status (HTTP 404: ...) as plain text, at most 300 characters (response_body has more); older attempts can quote more. It is quoted only for a caller who can read the webhook (GET /endpoints/{id}; a deleted webhook only for a caller who reads every webhook); anyone else gets the status and a note. Text the platform writes (a redirect not followed, a network error) is shown to everyone.",
|
|
58374
58681
|
"type": ["string", "null"]
|
|
58375
58682
|
},
|
|
58376
58683
|
"last_error_code": {
|
|
@@ -61007,6 +61314,7 @@ const openapiDocument = {
|
|
|
61007
61314
|
"items": { "type": "string" }
|
|
61008
61315
|
},
|
|
61009
61316
|
"rules": {
|
|
61317
|
+
"description": "Email rule ids: the key also reads the emails these rules granted. An address listed beside them is read in full, so rules beside a domain, a retired address or the address of a member other than the key's holder (its creator, or whoever it was transferred to) are refused (400 validation_error, details.reason rules_beside_domain or rules_beside_personal_mailbox). A rule shared with you goes here by its share's id, from your dashboard session only.",
|
|
61010
61318
|
"maxItems": 20,
|
|
61011
61319
|
"type": "array",
|
|
61012
61320
|
"items": { "type": "string" }
|
|
@@ -61292,6 +61600,7 @@ const openapiDocument = {
|
|
|
61292
61600
|
"items": { "type": "string" }
|
|
61293
61601
|
},
|
|
61294
61602
|
"rules": {
|
|
61603
|
+
"description": "Email rule ids: the key also reads the emails these rules granted. An address listed beside them is read in full, so rules beside a domain, a retired address or the address of a member other than the key's holder (its creator, or whoever it was transferred to) are refused (400 validation_error, details.reason rules_beside_domain or rules_beside_personal_mailbox). A rule shared with you goes here by its share's id, from your dashboard session only.",
|
|
61295
61604
|
"maxItems": 20,
|
|
61296
61605
|
"type": "array",
|
|
61297
61606
|
"items": { "type": "string" }
|
|
@@ -63282,6 +63591,7 @@ const openapiDocument = {
|
|
|
63282
63591
|
"items": { "type": "string" }
|
|
63283
63592
|
},
|
|
63284
63593
|
"rules": {
|
|
63594
|
+
"description": "Email rule ids: the key also reads the emails these rules granted. An address listed beside them is read in full, so rules beside a domain, a retired address or the address of a member other than the key's holder (its creator, or whoever it was transferred to) are refused (400 validation_error, details.reason rules_beside_domain or rules_beside_personal_mailbox). A rule shared with you goes here by its share's id, from your dashboard session only.",
|
|
63285
63595
|
"maxItems": 20,
|
|
63286
63596
|
"type": "array",
|
|
63287
63597
|
"items": { "type": "string" }
|
|
@@ -65471,6 +65781,8 @@ function receiverTotals(value) {
|
|
|
65471
65781
|
* or, when the totals are equal (an owner or a webhook site changed), that
|
|
65472
65782
|
* they are. Null for any other notice, and for one whose totals are missing
|
|
65473
65783
|
* or not counts (an older server).
|
|
65784
|
+
* The API no longer sends these notices; this only reads one written before,
|
|
65785
|
+
* should an answer still carry it, so the help and the table promise none.
|
|
65474
65786
|
*/
|
|
65475
65787
|
function receiversChangeText(item) {
|
|
65476
65788
|
if (item.state !== "receivers_changed") return null;
|
|
@@ -65488,17 +65800,32 @@ function receiversChangeText(item) {
|
|
|
65488
65800
|
];
|
|
65489
65801
|
return changed.length > 0 ? changed.join(", ") : "same totals, an owner or webhook site changed";
|
|
65490
65802
|
}
|
|
65803
|
+
const STOP_REASONS = /* @__PURE__ */ new Map([
|
|
65804
|
+
["deleted", "rule deleted"],
|
|
65805
|
+
["turned_off", "turned off"],
|
|
65806
|
+
["no_longer_covers", "no longer reaches your mailboxes"]
|
|
65807
|
+
]);
|
|
65808
|
+
/**
|
|
65809
|
+
* Why a stopped notice says the rule stopped covering you, from its
|
|
65810
|
+
* stop_reason. Null for any other notice, and for one whose reason is
|
|
65811
|
+
* missing or unknown (an older server).
|
|
65812
|
+
*/
|
|
65813
|
+
function stoppedText(item) {
|
|
65814
|
+
if (item.state !== "stopped") return null;
|
|
65815
|
+
const reason = item.stop_reason;
|
|
65816
|
+
return typeof reason === "string" ? STOP_REASONS.get(reason) ?? null : null;
|
|
65817
|
+
}
|
|
65491
65818
|
/** Where to see what covers you now, whatever the notices have caught up with. */
|
|
65492
65819
|
const COVERING_NOW = `\`primitive email-rule-oversight list-email-rules-covering-me\` shows what covers you now.`;
|
|
65493
65820
|
/**
|
|
65494
|
-
* One line per coverage notice: what it told (started, new_version,
|
|
65495
|
-
*
|
|
65496
|
-
*
|
|
65497
|
-
*
|
|
65498
|
-
*
|
|
65499
|
-
*
|
|
65500
|
-
*
|
|
65501
|
-
* what changed
|
|
65821
|
+
* One line per coverage notice: what it told (started, new_version, stopped,
|
|
65822
|
+
* or baseline for a rule that already covered you when notices began), when,
|
|
65823
|
+
* the rule's name then, and its author; and, first, each rule that covers you
|
|
65824
|
+
* now whose notice is not written yet (pending, dated when the rule last
|
|
65825
|
+
* changed), then the rule's id (rule_id; a pending row's own id is the
|
|
65826
|
+
* rule's), never the notice's own id, which no command takes; and, when any
|
|
65827
|
+
* row is a stopped notice with its reason (or an older receivers_changed
|
|
65828
|
+
* notice with its totals), what changed (CHANGE).
|
|
65502
65829
|
* `complete` says the listing is the whole of it (from the first page to the
|
|
65503
65830
|
* last, nothing withheld). Even then an empty one is no promise that nothing
|
|
65504
65831
|
* covers you: notices can lag, so it
|
|
@@ -65514,7 +65841,7 @@ function formatConcerningRows(items, complete = false, asOf, pendingComplete) {
|
|
|
65514
65841
|
item.created_through.name ?? item.created_through.id ?? "",
|
|
65515
65842
|
item.rule_id ?? (item.state === "pending" ? item.id : "")
|
|
65516
65843
|
]);
|
|
65517
|
-
const changes = items.map((item) => receiversChangeText(item));
|
|
65844
|
+
const changes = items.map((item) => receiversChangeText(item) ?? stoppedText(item));
|
|
65518
65845
|
const withChange = changes.some((change) => change !== null);
|
|
65519
65846
|
if (withChange) for (const [i, row] of rows.entries()) row.push(changes[i] ?? "");
|
|
65520
65847
|
const header = [
|
|
@@ -65528,15 +65855,41 @@ function formatConcerningRows(items, complete = false, asOf, pendingComplete) {
|
|
|
65528
65855
|
const widths = header.map((h, i) => Math.max(h.length, ...rows.map((row) => (row[i] ?? "").length)));
|
|
65529
65856
|
const line = (cells) => cells.map((cell, i) => i === cells.length - 1 ? cell : cell.padEnd(widths[i] ?? 0)).join(" ").trimEnd();
|
|
65530
65857
|
const pending = items.some((item) => item.state === "pending") ? ["", `pending: the rule covers you now and its notice is not written yet. ${COVERING_NOW}`] : [];
|
|
65531
|
-
const
|
|
65858
|
+
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."] : [];
|
|
65532
65859
|
return [
|
|
65533
65860
|
line(header),
|
|
65534
65861
|
...rows.map(line),
|
|
65535
65862
|
...pending,
|
|
65536
|
-
...
|
|
65863
|
+
...baseline,
|
|
65537
65864
|
...unfinished ? ["", pending.length > 0 ? unfinished : `${unfinished} ${COVERING_NOW}`] : []
|
|
65538
65865
|
].join("\n");
|
|
65539
65866
|
}
|
|
65867
|
+
async function observingRules(client) {
|
|
65868
|
+
try {
|
|
65869
|
+
const result = await listEmailRulesCoveringMe({
|
|
65870
|
+
client,
|
|
65871
|
+
query: { limit: 100 }
|
|
65872
|
+
});
|
|
65873
|
+
const page = result.data;
|
|
65874
|
+
const status = result.response?.status;
|
|
65875
|
+
if (status === 401 || status === 403) return "refused";
|
|
65876
|
+
if (result.error !== void 0 || !Array.isArray(page?.data)) return null;
|
|
65877
|
+
return {
|
|
65878
|
+
count: page.data.filter((rule) => rule.state === "observe" && rule.is_author === false).length,
|
|
65879
|
+
more: typeof page.meta?.cursor === "string"
|
|
65880
|
+
};
|
|
65881
|
+
} catch {
|
|
65882
|
+
return null;
|
|
65883
|
+
}
|
|
65884
|
+
}
|
|
65885
|
+
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.";
|
|
65886
|
+
/** The footer under `activity concerning` for rules in observe over your mail, or null with none to tell of. */
|
|
65887
|
+
function formatObservingFooter(observing) {
|
|
65888
|
+
if (observing === "refused") return null;
|
|
65889
|
+
if (observing === null) return `Rules in observe can also cover your mail: ${OBSERVE_SAYS}`;
|
|
65890
|
+
if (observing.count === 0) return observing.more ? `Rules in observe can also cover your mail: ${OBSERVE_SAYS}` : null;
|
|
65891
|
+
return `${`${observing.more ? "At least " : ""}${observing.count} ${observing.count === 1 ? "rule" : "rules"} in observe also ${observing.count === 1 ? "covers" : "cover"} your mail`}: ${OBSERVE_SAYS}`;
|
|
65892
|
+
}
|
|
65540
65893
|
/** What was left out, and why: no counts, only the kinds and what would show them. */
|
|
65541
65894
|
function formatWithheld(withheld) {
|
|
65542
65895
|
if (withheld.length === 0) return null;
|
|
@@ -65622,6 +65975,10 @@ async function runActivityList(command, flags, relation) {
|
|
|
65622
65975
|
}
|
|
65623
65976
|
const complete = flags.state === "all" && !flags.cursor && !cursor && withheld.length === 0 && pendingComplete !== false;
|
|
65624
65977
|
command.log(relation === "asked" ? formatAskedRows(items, complete) : relation === "concerning" ? formatConcerningRows(items, complete, asOf, pendingComplete) : formatActivityRows(covers, items));
|
|
65978
|
+
if (relation === "concerning" && !flags.cursor && !withheld.some((w) => w.kind === "email_rule_coverage")) {
|
|
65979
|
+
const observing = formatObservingFooter(await observingRules(auth.apiClient.client));
|
|
65980
|
+
if (observing) command.log(`\n${observing}`);
|
|
65981
|
+
}
|
|
65625
65982
|
const notShown = formatWithheld(withheld);
|
|
65626
65983
|
if (notShown) command.log(`\n${notShown}`);
|
|
65627
65984
|
if (cursor) command.log(`\nMore: ${resumeCommand(command.config.bin, flags, cursor, relation)}`);
|
|
@@ -65669,7 +66026,9 @@ var ActivityCreatedCommand = class ActivityCreatedCommand extends Command {
|
|
|
65669
66026
|
var ActivityAskedCommand = class ActivityAskedCommand extends Command {
|
|
65670
66027
|
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.
|
|
65671
66028
|
|
|
65672
|
-
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
|
|
66029
|
+
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.
|
|
66030
|
+
|
|
66031
|
+
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).`;
|
|
65673
66032
|
static summary = "List what other members asked of you";
|
|
65674
66033
|
static examples = [
|
|
65675
66034
|
"<%= config.bin %> activity asked",
|
|
@@ -65704,12 +66063,12 @@ var ActivityAskedCommand = class ActivityAskedCommand extends Command {
|
|
|
65704
66063
|
}
|
|
65705
66064
|
};
|
|
65706
66065
|
var ActivityConcerningCommand = class ActivityConcerningCommand extends Command {
|
|
65707
|
-
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),
|
|
66066
|
+
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), or saved a new version while covering it (new_version), 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. 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, and neither is a change in who receives the rule's matches (its keys, webhooks or share): \`primitive email-rule-oversight get-email-rule-covering-me <rule-id>\` shows who receives them now, by owner, while the rule covers you.
|
|
65708
66067
|
|
|
65709
66068
|
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.
|
|
65710
66069
|
|
|
65711
66070
|
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.`;
|
|
65712
|
-
static summary = "List rules that started covering your mail or
|
|
66071
|
+
static summary = "List rules that started covering your mail, changed or stopped";
|
|
65713
66072
|
static examples = ["<%= config.bin %> activity concerning", "<%= config.bin %> activity concerning --all --json"];
|
|
65714
66073
|
static flags = {
|
|
65715
66074
|
"api-key": API_KEY_FLAG$3,
|
|
@@ -69851,12 +70210,26 @@ async function sendableDomains(apiClient) {
|
|
|
69851
70210
|
return Array.isArray(domains) ? domains.filter((domain) => typeof domain === "string") : [];
|
|
69852
70211
|
}
|
|
69853
70212
|
/**
|
|
70213
|
+
* The code on a refusal for a send with no --from that has no default From
|
|
70214
|
+
* (several addresses it may send from, say), so a caller reading --json can
|
|
70215
|
+
* tell it from a failed request.
|
|
70216
|
+
*/
|
|
70217
|
+
const NO_DEFAULT_FROM_CODE = "no_default_from";
|
|
70218
|
+
/**
|
|
70219
|
+
* The code on a refusal for a credential that lists no address or domain it
|
|
70220
|
+
* can send from (one that lists only email rules, say): no --from helps.
|
|
70221
|
+
*/
|
|
70222
|
+
const NO_SEND_ADDRESS_CODE = "no_send_address";
|
|
70223
|
+
/**
|
|
69854
70224
|
* The refusal for a credential with no From to default to: why, the
|
|
69855
70225
|
* addresses and domains it may send from as far as the CLI can tell, and how
|
|
69856
70226
|
* to pass --from. Never a guess: the CLI does not pick one of them.
|
|
69857
70227
|
*/
|
|
69858
70228
|
async function noDefaultFrom(apiClient, grant, reason, options = {}) {
|
|
69859
|
-
if (!grantSends(grant)) return new Errors.CLIError("This credential cannot send mail from any address, so --from has no default.", {
|
|
70229
|
+
if (!grantSends(grant)) return new Errors.CLIError("This credential cannot send mail from any address, so --from has no default.", {
|
|
70230
|
+
exit: 1,
|
|
70231
|
+
code: NO_SEND_ADDRESS_CODE
|
|
70232
|
+
});
|
|
69860
70233
|
const { exclude } = options;
|
|
69861
70234
|
const reach = grantSendReach(grant);
|
|
69862
70235
|
const addresses = (reach?.addresses ?? []).filter((address) => address.toLowerCase() !== exclude?.toLowerCase());
|
|
@@ -69866,7 +70239,10 @@ async function noDefaultFrom(apiClient, grant, reason, options = {}) {
|
|
|
69866
70239
|
if (domains.length > 0) parts.push(`${addresses.length > 0 ? "Also any" : "Any"} address at: ${domains.join(", ")}.`);
|
|
69867
70240
|
const example = options.example === false ? null : addresses[0] ?? (domains[0] ? `<name>@${domains[0]}` : null);
|
|
69868
70241
|
parts.push(example ? `Pass the one to use with --from, for example --from ${example}.` : "Pass the address to send from with --from <address>.");
|
|
69869
|
-
return new Errors.CLIError(`${reason} ${parts.join(" ")}`, {
|
|
70242
|
+
return new Errors.CLIError(`${reason} ${parts.join(" ")}`, {
|
|
70243
|
+
exit: 1,
|
|
70244
|
+
code: reach !== null && addresses.length === 0 && domains.length === 0 ? NO_SEND_ADDRESS_CODE : NO_DEFAULT_FROM_CODE
|
|
70245
|
+
});
|
|
69870
70246
|
}
|
|
69871
70247
|
/**
|
|
69872
70248
|
* Why the API would refuse a send from `from` to `to`, or null when it would
|
|
@@ -69901,7 +70277,7 @@ function unauthorizedRefusal(errorPayload, authFailureContext) {
|
|
|
69901
70277
|
...authFailureContext,
|
|
69902
70278
|
payload: errorPayload
|
|
69903
70279
|
});
|
|
69904
|
-
return new Errors.CLIError("Cannot send: CLI auth is missing or invalid (see hint
|
|
70280
|
+
return new Errors.CLIError(extractErrorCode(errorPayload) === API_ERROR_CODES.keyRevoked ? "Cannot send: this API key was revoked (see the message above)." : "Cannot send: CLI auth is missing or invalid (see the hint).", { exit: 1 });
|
|
69905
70281
|
}
|
|
69906
70282
|
/**
|
|
69907
70283
|
* The From a send uses when --from is left out. A connected agent sends as
|
|
@@ -69927,7 +70303,10 @@ async function resolveDefaultFrom(apiClient, authFailureContext, options = {}) {
|
|
|
69927
70303
|
address: authFailureContext.auth.connectedAgent.agentAddress,
|
|
69928
70304
|
source: "agent"
|
|
69929
70305
|
};
|
|
69930
|
-
if (isConnectedChatCredential(authFailureContext.auth.apiKey)) throw new Errors.CLIError("Connected agents must pass --from with their connected email address.", {
|
|
70306
|
+
if (isConnectedChatCredential(authFailureContext.auth.apiKey)) throw new Errors.CLIError("Connected agents must pass --from with their connected email address.", {
|
|
70307
|
+
exit: 1,
|
|
70308
|
+
code: NO_DEFAULT_FROM_CODE
|
|
70309
|
+
});
|
|
69931
70310
|
const answered = await sendFromAnswer(apiClient, authFailureContext, options.purpose ?? "send");
|
|
69932
70311
|
if (answered) return answered;
|
|
69933
70312
|
const own = await getOwnGrant({
|
|
@@ -69936,7 +70315,7 @@ async function resolveDefaultFrom(apiClient, authFailureContext, options = {}) {
|
|
|
69936
70315
|
});
|
|
69937
70316
|
if (own.error) {
|
|
69938
70317
|
const errorPayload = extractErrorPayload(own.error);
|
|
69939
|
-
if (extractErrorCode(errorPayload)
|
|
70318
|
+
if (refusesCredential(extractErrorCode(errorPayload))) throw unauthorizedRefusal(errorPayload, authFailureContext);
|
|
69940
70319
|
throw new Errors.CLIError(`Could not tell which addresses this credential may send from, so --from has no default. Pass --from <address>. Underlying error: ${formatErrorPayload(errorPayload)}`, { exit: 1 });
|
|
69941
70320
|
}
|
|
69942
70321
|
const grant = own.data?.data?.grant ?? null;
|
|
@@ -70067,7 +70446,7 @@ async function sendFromAnswer(apiClient, authFailureContext, purpose) {
|
|
|
70067
70446
|
if (result.error) {
|
|
70068
70447
|
const errorPayload = extractErrorPayload(result.error);
|
|
70069
70448
|
const code = extractErrorCode(errorPayload);
|
|
70070
|
-
if (code
|
|
70449
|
+
if (refusesCredential(code)) throw unauthorizedRefusal(errorPayload, authFailureContext);
|
|
70071
70450
|
if (code === "not_found" || code === "function_scope_forbidden") return void 0;
|
|
70072
70451
|
throw new Errors.CLIError(`Could not tell which address this credential may send from, so --from has no default. Pass --from <address>. Underlying error: ${formatErrorPayload(errorPayload)}`, { exit: 1 });
|
|
70073
70452
|
}
|
|
@@ -70093,7 +70472,10 @@ async function sendFromAnswer(apiClient, authFailureContext, purpose) {
|
|
|
70093
70472
|
if (domains.length > 0) parts.push(`${addresses.length > 0 ? "Also any" : "Any"} address at: ${domains.join(", ")}.`);
|
|
70094
70473
|
parts.push(await claimHint(apiClient));
|
|
70095
70474
|
if (!nothingListed) parts.push("Pass the address to use with --from <address>.");
|
|
70096
|
-
throw new Errors.CLIError(parts.filter((part) => part).join(" "), {
|
|
70475
|
+
throw new Errors.CLIError(parts.filter((part) => part).join(" "), {
|
|
70476
|
+
exit: 1,
|
|
70477
|
+
code: nothingListed ? NO_SEND_ADDRESS_CODE : NO_DEFAULT_FROM_CODE
|
|
70478
|
+
});
|
|
70097
70479
|
}
|
|
70098
70480
|
/** The address of resolveDefaultFrom. */
|
|
70099
70481
|
async function pickDefaultFromAddress(apiClient, authFailureContext, options = {}) {
|
|
@@ -70116,7 +70498,7 @@ async function legacyDefaultFromAddress(apiClient) {
|
|
|
70116
70498
|
});
|
|
70117
70499
|
if (result.error) {
|
|
70118
70500
|
const payload = extractErrorPayload(result.error);
|
|
70119
|
-
if (extractErrorCode(payload)
|
|
70501
|
+
if (refusesCredential(extractErrorCode(payload))) return { kind: "unauthorized" };
|
|
70120
70502
|
if (!isGrantRefusal(payload)) return { kind: "unknown" };
|
|
70121
70503
|
const own = await getOwnGrant({
|
|
70122
70504
|
client: apiClient.client,
|
|
@@ -70636,7 +71018,7 @@ function buildChatSendFailureEnvelope(params) {
|
|
|
70636
71018
|
return {
|
|
70637
71019
|
outcome: params.outcome,
|
|
70638
71020
|
exit_code: params.exitCode ?? sendOutcomeExitCode(params.outcome),
|
|
70639
|
-
outcome_message: params.outcomeMessage ?? (params.outcome === "already_sent" ? formatDeletedEarlierSendNotice() : formatSendFailureSummary(params.noun, params.outcome, params.httpStatus)),
|
|
71021
|
+
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))),
|
|
70640
71022
|
...sendIdentityFields({
|
|
70641
71023
|
idempotencyKey: params.idempotencyKey,
|
|
70642
71024
|
sent
|
|
@@ -71668,11 +72050,6 @@ var ChatCommand = class ChatCommand extends Command {
|
|
|
71668
72050
|
saveChatReceipt(params.receipt);
|
|
71669
72051
|
}
|
|
71670
72052
|
params.progress?.fail(outcome === "already_sent" ? `${params.noun} already sent earlier.` : `${params.noun} send failed.`);
|
|
71671
|
-
writeErrorWithHints(errorPayload);
|
|
71672
|
-
surfaceUnauthorizedHint({
|
|
71673
|
-
...params.authFailureContext,
|
|
71674
|
-
payload: errorPayload
|
|
71675
|
-
});
|
|
71676
72053
|
const envelope = buildChatSendFailureEnvelope({
|
|
71677
72054
|
error: errorPayload,
|
|
71678
72055
|
httpStatus,
|
|
@@ -71687,6 +72064,11 @@ var ChatCommand = class ChatCommand extends Command {
|
|
|
71687
72064
|
process.stderr.write(`${chatNoticeText(envelope.outcome_message)}\n`);
|
|
71688
72065
|
if (!params.json) this.log(envelope.outcome_message);
|
|
71689
72066
|
} else process.stderr.write(`${chatFailureText(envelope.outcome_message)}\n`);
|
|
72067
|
+
writeErrorWithHints(errorPayload);
|
|
72068
|
+
surfaceUnauthorizedHint({
|
|
72069
|
+
...params.authFailureContext,
|
|
72070
|
+
payload: errorPayload
|
|
72071
|
+
});
|
|
71690
72072
|
if (params.json) this.log(JSON.stringify(envelope, null, 2));
|
|
71691
72073
|
if (envelope.exit_code !== 0) process.exitCode = envelope.exit_code;
|
|
71692
72074
|
}
|
|
@@ -72879,7 +73261,7 @@ async function checkAskedOfYou(client, now = Date.now()) {
|
|
|
72879
73261
|
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")] : []];
|
|
72880
73262
|
const items = concerning?.items ?? [];
|
|
72881
73263
|
const pending = items.filter((item) => item.state === "pending").length;
|
|
72882
|
-
const notices = items.filter((item) => (item.state === "started" || item.state === "new_version" || item.state === "
|
|
73264
|
+
const notices = items.filter((item) => (item.state === "started" || item.state === "new_version" || item.state === "stopped") && Date.parse(item.created_at) >= since).length;
|
|
72883
73265
|
const parts = [
|
|
72884
73266
|
...waiting.length > 0 ? [`${waiting.join(" and ")} waiting for you`] : [],
|
|
72885
73267
|
...ASKED_KINDS.filter((kind) => hidden.has(kind)).map((kind) => `${kind === "email_rule_request" ? "rule requests" : "objections"} not shown to this credential`),
|
|
@@ -72929,7 +73311,7 @@ function checkReceiverStart(configDir, profileName) {
|
|
|
72929
73311
|
}
|
|
72930
73312
|
}
|
|
72931
73313
|
var DoctorCommand = class DoctorCommand extends Command {
|
|
72932
|
-
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
|
|
73314
|
+
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.`;
|
|
72933
73315
|
static summary = "Check the local environment and live API for common problems";
|
|
72934
73316
|
static examples = ["<%= config.bin %> doctor", "<%= config.bin %> doctor --api-key prim_..."];
|
|
72935
73317
|
static flags = {
|
|
@@ -72942,7 +73324,7 @@ var DoctorCommand = class DoctorCommand extends Command {
|
|
|
72942
73324
|
env: "PRIMITIVE_API_BASE_URL",
|
|
72943
73325
|
hidden: true
|
|
72944
73326
|
}),
|
|
72945
|
-
json: Flags.boolean({ description: "
|
|
73327
|
+
json: Flags.boolean({ description: "Print the checks as one JSON document on stdout (ok, warnings and each check's label, status, message and hint) instead of the readable checklist" })
|
|
72946
73328
|
};
|
|
72947
73329
|
async run() {
|
|
72948
73330
|
const { flags } = await this.parse(DoctorCommand);
|
|
@@ -73003,21 +73385,24 @@ var DoctorCommand = class DoctorCommand extends Command {
|
|
|
73003
73385
|
}
|
|
73004
73386
|
}
|
|
73005
73387
|
}
|
|
73006
|
-
|
|
73007
|
-
|
|
73008
|
-
|
|
73388
|
+
if (flags.json) {
|
|
73389
|
+
const failed = rows.filter((row) => row.outcome.status === "fail");
|
|
73390
|
+
const summary = {
|
|
73391
|
+
ok: failed.length === 0,
|
|
73392
|
+
warnings: rows.filter((row) => row.outcome.status === "warn").length,
|
|
73393
|
+
checks: rows.map(({ label, outcome }) => ({
|
|
73394
|
+
label,
|
|
73395
|
+
status: outcome.status,
|
|
73396
|
+
message: outcome.message,
|
|
73397
|
+
..."hint" in outcome && outcome.hint ? { hint: outcome.hint } : {}
|
|
73398
|
+
})),
|
|
73399
|
+
...failed.length > 0 ? { error: { message: `${failed.length} ${failed.length === 1 ? "check" : "checks"} failed: ${failed.map((row) => row.label).join(", ")}.` } } : {}
|
|
73400
|
+
};
|
|
73401
|
+
this.log(JSON.stringify(summary, null, 2));
|
|
73402
|
+
} else for (const row of rows) {
|
|
73403
|
+
this.log(renderRow(row));
|
|
73404
|
+
if ("hint" in row.outcome && row.outcome.hint) this.log(` hint: ${row.outcome.hint}`);
|
|
73009
73405
|
}
|
|
73010
|
-
const summary = {
|
|
73011
|
-
ok: rows.every((row) => row.outcome.status !== "fail"),
|
|
73012
|
-
warnings: rows.filter((row) => row.outcome.status === "warn").length,
|
|
73013
|
-
checks: rows.map(({ label, outcome }) => ({
|
|
73014
|
-
label,
|
|
73015
|
-
status: outcome.status,
|
|
73016
|
-
message: outcome.message,
|
|
73017
|
-
..."hint" in outcome && outcome.hint ? { hint: outcome.hint } : {}
|
|
73018
|
-
}))
|
|
73019
|
-
};
|
|
73020
|
-
this.log(JSON.stringify(summary, null, 2));
|
|
73021
73406
|
if (rows.some((row) => row.outcome.status === "fail")) process.exitCode = 1;
|
|
73022
73407
|
}
|
|
73023
73408
|
};
|
|
@@ -76029,8 +76414,8 @@ const PRIMITIVE_TEAM_AUTHOR = {
|
|
|
76029
76414
|
name: "Primitive Team",
|
|
76030
76415
|
url: "https://primitive.dev"
|
|
76031
76416
|
};
|
|
76032
|
-
const SDK_VERSION_RANGE = "^3.0.0-preview.
|
|
76033
|
-
const CLI_VERSION_RANGE = "^3.0.0-preview.
|
|
76417
|
+
const SDK_VERSION_RANGE = "^3.0.0-preview.17";
|
|
76418
|
+
const CLI_VERSION_RANGE = "^3.0.0-preview.17";
|
|
76034
76419
|
const ESBUILD_VERSION_RANGE = "^0.27.0";
|
|
76035
76420
|
function renderHandler() {
|
|
76036
76421
|
return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
|
|
@@ -79436,9 +79821,9 @@ function wholeMailboxAddresses(notes) {
|
|
|
79436
79821
|
}
|
|
79437
79822
|
/**
|
|
79438
79823
|
* What a key create or update says when the key reads whole mailboxes beside
|
|
79439
|
-
* its email rules: on stderr as a Warning line, or under --json
|
|
79440
|
-
* document's
|
|
79441
|
-
*
|
|
79824
|
+
* its email rules: first, on stderr as a Warning line, or under --json as the
|
|
79825
|
+
* document's first field, whole_mailbox_warning, and the first entry of its
|
|
79826
|
+
* warnings (the JSON guard keeps stderr empty). Null when it does not. The
|
|
79442
79827
|
* exit code is not changed: the key is made or changed as asked.
|
|
79443
79828
|
*/
|
|
79444
79829
|
function wholeMailboxWarning(keyId, notes) {
|
|
@@ -79446,6 +79831,27 @@ function wholeMailboxWarning(keyId, notes) {
|
|
|
79446
79831
|
const addresses = wholeMailboxAddresses(notes);
|
|
79447
79832
|
return `This key reads ${addresses.length > 0 ? `every email at ${addresses.join(", ")}` : "every email at an address or domain it lists"}, not only the emails its rules grant. An address or domain listed beside a rule is read in full. To limit a key to the rules' emails, create one with the same permissions and only --rule for its mail (no --address or --domain), then revoke this one with \`primitive keys revoke ${keyId}\`.`;
|
|
79448
79833
|
}
|
|
79834
|
+
/**
|
|
79835
|
+
* A --json document led by the whole-mailbox warning: whole_mailbox_warning
|
|
79836
|
+
* as its first field, and the warning first in its warnings, before the
|
|
79837
|
+
* server's own, as an object with a description as theirs have (reason
|
|
79838
|
+
* whole_mailbox, with the addresses and domains read in full). Unchanged when
|
|
79839
|
+
* there is no warning.
|
|
79840
|
+
*/
|
|
79841
|
+
function ledByWholeMailboxWarning(document, whole, notes) {
|
|
79842
|
+
if (!whole) return document;
|
|
79843
|
+
const { whole_mailbox_warning: _shown, ...rest } = document;
|
|
79844
|
+
const warnings = Array.isArray(rest.warnings) ? rest.warnings : [];
|
|
79845
|
+
return {
|
|
79846
|
+
whole_mailbox_warning: whole,
|
|
79847
|
+
...rest,
|
|
79848
|
+
warnings: [{
|
|
79849
|
+
reason: "whole_mailbox",
|
|
79850
|
+
addresses: wholeMailboxAddresses(notes),
|
|
79851
|
+
description: whole
|
|
79852
|
+
}, ...warnings]
|
|
79853
|
+
};
|
|
79854
|
+
}
|
|
79449
79855
|
/** The notes other than whole_mailbox, which wholeMailboxWarning says instead. */
|
|
79450
79856
|
function otherNotes(notes) {
|
|
79451
79857
|
if (!Array.isArray(notes)) return [];
|
|
@@ -79517,6 +79923,10 @@ function buildCreateGrant(choice) {
|
|
|
79517
79923
|
...choice.domains.length > 0 ? { domains: choice.domains } : {},
|
|
79518
79924
|
...choice.rules.length > 0 ? { rules: choice.rules } : {}
|
|
79519
79925
|
};
|
|
79926
|
+
const domainBesideRule = choice.rules.length > 0 && choice.domains.length > 0 ? {
|
|
79927
|
+
ok: false,
|
|
79928
|
+
message: `--rule cannot be combined with --domain: the key would read every email on ${choice.domains.join(", ")}, not only what the rules granted. Create a key with --rule alone, or one with --domain alone.`
|
|
79929
|
+
} : null;
|
|
79520
79930
|
if (choice.permissions.length > 0) {
|
|
79521
79931
|
if (choice.preset) return {
|
|
79522
79932
|
ok: false,
|
|
@@ -79526,6 +79936,7 @@ function buildCreateGrant(choice) {
|
|
|
79526
79936
|
ok: false,
|
|
79527
79937
|
message: choice.allMailboxes ? "--all-mailboxes reaches every mailbox, so it cannot be combined with --address, --domain or --rule." : "Say which mail the key reaches: --address, --domain or --rule (each repeatable), or --all-mailboxes."
|
|
79528
79938
|
};
|
|
79939
|
+
if (domainBesideRule) return domainBesideRule;
|
|
79529
79940
|
return {
|
|
79530
79941
|
ok: true,
|
|
79531
79942
|
grant: {
|
|
@@ -79558,6 +79969,7 @@ function buildCreateGrant(choice) {
|
|
|
79558
79969
|
ok: false,
|
|
79559
79970
|
message: `${choice.preset} needs --address, --domain or --rule.`
|
|
79560
79971
|
};
|
|
79972
|
+
if (domainBesideRule) return domainBesideRule;
|
|
79561
79973
|
return {
|
|
79562
79974
|
ok: true,
|
|
79563
79975
|
grant: {
|
|
@@ -79851,7 +80263,7 @@ var KeysCreateCommand = class KeysCreateCommand extends Command {
|
|
|
79851
80263
|
|
|
79852
80264
|
The secret is printed once, on its own line on stdout (in the JSON with --json). Store it right away: it is not shown again and the CLI does not save it.
|
|
79853
80265
|
|
|
79854
|
-
A key limited to email rules (--rule, repeatable) reaches only the mail those rules match. Give it mail:read with --permission, or use --preset own_addresses_read_only.
|
|
80266
|
+
A key limited to email rules (--rule, repeatable) reaches only the mail those rules match. Give it mail:read with --permission, or use --preset own_addresses_read_only. A key reads every email at an address or domain it lists, not only what the rules match, so --domain cannot be given beside --rule, and the API refuses an --address beside it that is another member's mailbox, a former member's included, or a retired address. Your own address, an agent's or a shared one may be given beside --rule, for example so the key reads your own mail beside a share, or replies from an agent's address; each is read in full, and the command says so first: on stderr, or with --json in whole_mailbox_warning.
|
|
79855
80267
|
|
|
79856
80268
|
${keyPermissionsHelp()}`;
|
|
79857
80269
|
static summary = "Create an API key";
|
|
@@ -79882,7 +80294,7 @@ var KeysCreateCommand = class KeysCreateCommand extends Command {
|
|
|
79882
80294
|
multiple: true
|
|
79883
80295
|
}),
|
|
79884
80296
|
rule: Flags.string({
|
|
79885
|
-
description: "An email rule id whose matching mail the key reaches (repeatable).
|
|
80297
|
+
description: "An email rule id whose matching mail the key reaches (repeatable). Not with --domain, nor with an --address that is another member's or a former member's mailbox, or a retired address; any other --address beside it (your own, an agent's, a shared one) is read in full, not only the rule's mail. A rule a colleague shares with you goes on a key by the share's id, from your own dashboard session only (the dashboard's API keys page), not through the CLI; your own webhooks receive what a share gives you without a key.",
|
|
79886
80298
|
multiple: true
|
|
79887
80299
|
}),
|
|
79888
80300
|
"all-mailboxes": Flags.boolean({ description: "A key with --permission that reaches every mailbox." }),
|
|
@@ -79929,15 +80341,13 @@ var KeysCreateCommand = class KeysCreateCommand extends Command {
|
|
|
79929
80341
|
return;
|
|
79930
80342
|
}
|
|
79931
80343
|
const key = result.data;
|
|
80344
|
+
const whole = wholeMailboxWarning(key.id, key.address_warnings);
|
|
79932
80345
|
if (!flags.json) {
|
|
80346
|
+
if (whole) process.stderr.write(`Warning: ${whole}\n\n`);
|
|
79933
80347
|
writeWarnings(key.warnings);
|
|
79934
80348
|
writeWarnings(otherNotes(key.address_warnings));
|
|
79935
80349
|
}
|
|
79936
|
-
|
|
79937
|
-
printSecret(this, Boolean(flags.json), whole ? {
|
|
79938
|
-
...key,
|
|
79939
|
-
whole_mailbox_warning: whole
|
|
79940
|
-
} : key, key.key, [
|
|
80350
|
+
printSecret(this, Boolean(flags.json), ledByWholeMailboxWarning(key, whole, key.address_warnings), key.key, [
|
|
79941
80351
|
`Created API key ${key.name ?? "(unnamed)"} (${key.id}), prefix ${key.key_prefix}.`,
|
|
79942
80352
|
`Permissions: ${describePermissions({
|
|
79943
80353
|
template: key.grant.template,
|
|
@@ -79951,7 +80361,6 @@ var KeysCreateCommand = class KeysCreateCommand extends Command {
|
|
|
79951
80361
|
})}`,
|
|
79952
80362
|
`Expires: ${key.expires_at ?? "never"}`
|
|
79953
80363
|
].join("\n"));
|
|
79954
|
-
if (whole && !flags.json) process.stderr.write(`Warning: ${whole}\n`);
|
|
79955
80364
|
}
|
|
79956
80365
|
};
|
|
79957
80366
|
var KeysRotateCommand = class KeysRotateCommand extends Command {
|
|
@@ -80014,7 +80423,7 @@ var KeysRotateCommand = class KeysRotateCommand extends Command {
|
|
|
80014
80423
|
var KeysUpdateCommand = class KeysUpdateCommand extends Command {
|
|
80015
80424
|
static description = `Change an API key's permissions, email rules, name or expiry. It keeps its id and secret.
|
|
80016
80425
|
|
|
80017
|
-
--add and --remove take permissions (repeatable, or comma-separated); \`primitive keys create --help-full\` lists the permissions a key can hold. --add-rule and --remove-rule add email rules to the key or take them off, and keep its other rules. --rule replaces every rule the key has with the ones given, so pass all the rules it should keep; it cannot be combined with --add-rule or --remove-rule. --expires-at gives it a new expiry: a later one extends it, within your organization's credential policy, and is how to keep a key working past its expiry (rotating keeps the expiry). --no-expiry removes it where the policy allows. An expired key cannot be extended. Everything else about the key stays as it is, and the output lists any rules a change took off. When the key's grant is written and it lists an address or domain beside its rules, which it reads in full, the command
|
|
80426
|
+
--add and --remove take permissions (repeatable, or comma-separated); \`primitive keys create --help-full\` lists the permissions a key can hold. --add-rule and --remove-rule add email rules to the key or take them off, and keep its other rules. --rule replaces every rule the key has with the ones given, so pass all the rules it should keep; it cannot be combined with --add-rule or --remove-rule. A change to the permissions or rules of a key that lists a share made with you (--add, --remove, --rule, --add-rule) is refused through the CLI unless it takes the share off; make it from your own dashboard session. --name, --expires-at and --no-expiry work as usual. --expires-at gives it a new expiry: a later one extends it, within your organization's credential policy, and is how to keep a key working past its expiry (rotating keeps the expiry). --no-expiry removes it where the policy allows. An expired key cannot be extended. Everything else about the key stays as it is, and the output lists any rules a change took off. A rule cannot be added to a key that lists a domain. The API refuses a rule added beside a retired address or the mailbox of a member other than the key's holder (its creator, or whoever it was transferred to), a former member's included, and a permission added to a key that already lists rules beside such an address or a domain. It judges this by the key's holder, not by whoever makes the change. When the key's grant is written and it lists an address or domain beside its rules, which it reads in full, the command says so before the result: on stderr, or with --json in whole_mailbox_warning.
|
|
80018
80427
|
|
|
80019
80428
|
The change runs directly; if your organization requires approval, the command prints the approval link and takes --step-up-token, as for a new key. A key never holds more than you do.
|
|
80020
80429
|
|
|
@@ -80049,7 +80458,7 @@ var KeysUpdateCommand = class KeysUpdateCommand extends Command {
|
|
|
80049
80458
|
exclusive: ["add-rule", "remove-rule"]
|
|
80050
80459
|
}),
|
|
80051
80460
|
"add-rule": Flags.string({
|
|
80052
|
-
description: "An email rule id to add to the key (repeatable, or comma-separated). Its other rules stay.",
|
|
80461
|
+
description: "An email rule id to add to the key (repeatable, or comma-separated). Its other rules stay. A rule shared with you is added by its share's id from your own dashboard session only, not through the CLI.",
|
|
80053
80462
|
multiple: true
|
|
80054
80463
|
}),
|
|
80055
80464
|
"remove-rule": Flags.string({
|
|
@@ -80113,6 +80522,8 @@ var KeysUpdateCommand = class KeysUpdateCommand extends Command {
|
|
|
80113
80522
|
...ruleChange
|
|
80114
80523
|
});
|
|
80115
80524
|
if (!next.ok) this.error(next.message.replace("<key-id>", args.id), { exit: 2 });
|
|
80525
|
+
const listedDomains = stringList(next.grant.domains ?? []) ?? [];
|
|
80526
|
+
if ((stringList(next.grant.rules ?? []) ?? []).filter((r) => !rulesBefore.some((k) => k.toLowerCase() === r.toLowerCase())).length > 0 && listedDomains.length > 0) this.error(`Key ${args.id} lists ${listedDomains.join(", ")}, so a rule cannot be added to it: the key would read every email on that domain, not only what the rule granted. Create a key with --rule alone for the rule's mail.`, { exit: 2 });
|
|
80116
80527
|
rulesNotOnKey = removeRules.filter((r) => !rulesBefore.some((k) => k.toLowerCase() === r.toLowerCase()));
|
|
80117
80528
|
if (rulesNotOnKey.length > 0 && !flags.json) process.stderr.write(`Not on this key, so nothing to take off: ${rulesNotOnKey.join(", ")}.\n`);
|
|
80118
80529
|
const sentRules = stringList(next.grant.rules ?? []) ?? [];
|
|
@@ -80154,18 +80565,18 @@ var KeysUpdateCommand = class KeysUpdateCommand extends Command {
|
|
|
80154
80565
|
const standingNotes = after?.ok ? after.data.address_warnings : void 0;
|
|
80155
80566
|
const whole = grantChanged ? wholeMailboxWarning(args.id, result.data.address_warnings) : null;
|
|
80156
80567
|
if (flags.json) {
|
|
80157
|
-
this.log(JSON.stringify({
|
|
80568
|
+
this.log(JSON.stringify(ledByWholeMailboxWarning({
|
|
80158
80569
|
...after?.ok ? after.data : {},
|
|
80159
80570
|
...result.data,
|
|
80160
80571
|
...!grantChanged && Array.isArray(standingNotes) ? { address_warnings: standingNotes } : {},
|
|
80161
80572
|
...grantChanged ? { notice: HELD_REQUEST_NOTICE } : {},
|
|
80162
80573
|
...grantChanged && rulesRemoved.length > 0 ? { rules_removed: rulesRemoved } : {},
|
|
80163
80574
|
...rulesNotOnKey.length > 0 ? { rules_not_on_key: rulesNotOnKey } : {},
|
|
80164
|
-
...after && !after.ok ? { key_error: after.payload } : {}
|
|
80165
|
-
|
|
80166
|
-
}, null, 2));
|
|
80575
|
+
...after && !after.ok ? { key_error: after.payload } : {}
|
|
80576
|
+
}, whole, result.data.address_warnings), null, 2));
|
|
80167
80577
|
return;
|
|
80168
80578
|
}
|
|
80579
|
+
if (whole) process.stderr.write(`Warning: ${whole}\n\n`);
|
|
80169
80580
|
writeWarnings(result.data.warnings);
|
|
80170
80581
|
writeWarnings(whole ? otherNotes(result.data.address_warnings) : result.data.address_warnings);
|
|
80171
80582
|
const changed = result.data.changed;
|
|
@@ -80177,7 +80588,6 @@ var KeysUpdateCommand = class KeysUpdateCommand extends Command {
|
|
|
80177
80588
|
if (grantChanged && rulesRemoved.length > 0) this.log(`Rules taken off: ${rulesRemoved.join(", ")}`);
|
|
80178
80589
|
if (changed.includes("expires_at")) this.log(`Expires: ${expiry.expiresAt ?? "never"}`);
|
|
80179
80590
|
if (grantChanged) process.stderr.write(`${HELD_REQUEST_NOTICE}\n`);
|
|
80180
|
-
if (whole) process.stderr.write(`Warning: ${whole}\n`);
|
|
80181
80591
|
}
|
|
80182
80592
|
};
|
|
80183
80593
|
/**
|
|
@@ -81387,7 +81797,7 @@ var RequestFailure = class extends ListenError {
|
|
|
81387
81797
|
code;
|
|
81388
81798
|
retryAfter;
|
|
81389
81799
|
constructor(status, code, retryAfter) {
|
|
81390
|
-
super(code === "pull_subscription_requires_agent_connection" ? AGENT_CONNECTION_REQUIRED_MESSAGE : code === "agent_connection_scope_forbidden" ? "This operation is outside the connected address grant. Use inbound email events and this credential’s own subscription." : status === 401 || status === 403 ? "Listener authorization failed. Run primitive signin or check your API key and account permissions." : status === 409 && code === "subscription_conflict" ? "This subscription has different event filters. Omit --events to resume it, or use primitive listen --subscription new-subscription (add your --events selection)." : `Listener API request failed (HTTP ${status || "transport"}, ${code}).`);
|
|
81800
|
+
super(code === "pull_subscription_requires_agent_connection" ? AGENT_CONNECTION_REQUIRED_MESSAGE : code === "agent_connection_scope_forbidden" ? "This operation is outside the connected address grant. Use inbound email events and this credential’s own subscription." : code === "key_revoked" ? KEY_REVOKED_MESSAGE : status === 401 || status === 403 ? "Listener authorization failed. Run primitive signin or check your API key and account permissions." : status === 409 && code === "subscription_conflict" ? "This subscription has different event filters. Omit --events to resume it, or use primitive listen --subscription new-subscription (add your --events selection)." : `Listener API request failed (HTTP ${status || "transport"}, ${code}).`);
|
|
81391
81801
|
this.status = status;
|
|
81392
81802
|
this.code = code;
|
|
81393
81803
|
this.retryAfter = retryAfter;
|
|
@@ -82610,7 +83020,7 @@ var ListenCommand = class ListenCommand extends Command {
|
|
|
82610
83020
|
process.exitCode = 1;
|
|
82611
83021
|
return;
|
|
82612
83022
|
}
|
|
82613
|
-
throw new Errors.CLIError(error instanceof ListenError || error instanceof ListenStateError ? error.message : error?.code === "pull_subscription_requires_agent_connection" ? AGENT_CONNECTION_REQUIRED_MESSAGE : "The listener stopped because of a local state or connection error.");
|
|
83023
|
+
throw new Errors.CLIError(error instanceof ListenError || error instanceof ListenStateError ? error.message : error?.code === "pull_subscription_requires_agent_connection" ? AGENT_CONNECTION_REQUIRED_MESSAGE : error?.code === "key_revoked" ? KEY_REVOKED_MESSAGE : "The listener stopped because of a local state or connection error.");
|
|
82614
83024
|
} finally {
|
|
82615
83025
|
await wake?.close();
|
|
82616
83026
|
clearTimeout(timer);
|