primcli 3.0.0-preview.18 → 3.0.0-preview.19
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/README.md +15 -0
- package/dist/{api-command-BlfqpBjp.js → api-command--2ZkNMvH.js} +630 -75
- package/dist/{machine-session-cmk2oCPL.js → machine-session-ADcw9uJm.js} +4 -4
- package/dist/{notify-session-BIElQmDi.js → notify-session-06flGBgK.js} +2 -2
- package/dist/oclif/auto-signal-worker.js +3 -3
- package/dist/oclif/auto-signals.js +1 -1
- package/dist/oclif/index.js +524 -90
- package/dist/oclif/receiver-heal.js +2 -2
- package/dist/{repeats-Dj_o6c-X-b-Y0Ejun.js → repeats-Dj_o6c-X-DTtFzwNd.js} +7 -4
- package/dist/{scoped-chat-CaiJJRMA.js → scoped-chat-C7l2BSZr.js} +1 -1
- package/dist/{signal-command-C4Eu4-1-.js → signal-command-D6oaza1W.js} +4 -4
- package/package.json +1 -1
package/dist/oclif/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { $ as interactionNextActions, A as openBrowser, At as thrownErrorExitCode, B as serverRelationship, Bt as detectRuntimeSession, C as approveThenRerunHint, Ct as sendErrorMessage, D as canOfferCopyHotkey, Dt as sentHistoryWindowStart, E as withApproval, Et as sendWaitClampNotice, F as formatMailWakeLine, Ft as generatedAgentName, G as claimPendingMail, Gt as
|
|
2
|
-
import { $ as
|
|
3
|
-
import { C as readBundledConnectSkill, S as installedVersion, _ as NotificationOutcomeUnknownError, a as NotificationRetryError, b as installSkill, 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 bundledSkillNames, w as readBundledSkill, x as installedConnectSkillFile, y as connectSkillTarget } from "../notify-session-
|
|
1
|
+
import { $ as interactionNextActions, $t as loadSavedFocus, A as openBrowser, An as credentialsFromUserLogin, At as thrownErrorExitCode, B as serverRelationship, Bn as setKnownCommands, Bt as detectRuntimeSession, C as approveThenRerunHint, Cn as createCliApiClient, Ct as sendErrorMessage, D as canOfferCopyHotkey, Dn as selectedOrgFromEnv, Dt as sentHistoryWindowStart, E as withApproval, En as resolveCliApiRequestConfig, Et as sendWaitClampNotice, F as formatMailWakeLine, Fn as roleKeyText, Ft as generatedAgentName, G as claimPendingMail, Gt as NO_FOCUS, H as wakeReadCommand, Ht as formatAlreadySentNotice, I as latestOwnOutbound, In as switchCurrentOrg, It as identitySuggestions, J as pendingMailPath, Jt as focusFlagValues, K as clearConsumedPendingMail, Kt as countFromMeta, L as readThreadContext, Ln as routeWarningLines, Lt as loadSkillLine, M as bareAddress, Mn as isBuiltInRoleKey, Mt as cliInvocation, N as describeWake, Nn as revokeUserLogin, Nt as connectNextSteps, O as formatBrowserLoginInstructions, On as CliOrgRefusedError, Ot as serializeErrorPayload, P as displayAddress, Pn as roleKeyLabel, Q as interactionHumanLine, Qt as joinNames, R as sentInThread, Rn as sanitizeForTerminal, Rt as currentMailSessionKey, S as STEP_UP_TOKEN_FLAG_DESCRIPTION, Sn as createAuthenticatedCliApiClient, St as reportSendCommandResult, T as terminalApprovalIo, Tn as refuseOrgSelectionForProfile, Tt as sendOutcomeExitCode, U as wakeRecipientField, Ut as FOCUS_ENV, Vn as operationManifest, Vt as runtimeSessionVariableList, W as wakeRelationship, Wt as FOCUS_SERVER_SUPPORT, X as recordPendingMail, Xt as focusForCorpus, Y as readPendingMail, Yt as focusFlags, Z as removePendingMail, Zt as focusProfile, _ as surfaceUnauthorizedHint, _n as ATTACHMENT_WAIT_FLAG_DESCRIPTION, _t as formatPriorRepliesCheckSkipped, a as createOperationCommand, an as resolveDomainNames, at as MAX_SEND_WAIT_TIMEOUT_MS, b as BROWSER_FLAG_DESCRIPTION, bn as ConnectedAgentKeyRequiredError, bt as formatSendRecordFailureSummary, c as formatErrorPayload, cn as withFocusMeta, ct as assertValidIdempotencyKey, d as isGrantRefusal, dn as withFlagSuggestion, dt as checkPriorReplies, en as manyDomainsSupported, et as readEmailInteraction, f as networkErrorHint, fn as emptyEmailListHint, ft as classifySendError, g as runWithTiming, gn as isEmailId, gt as formatDeletedEarlierSendNotice, h as refusesCredential, hn as formatFact, ht as followUpCommandPrefix, i as TIME_FLAG_DESCRIPTION, in as readReadableDomains, it as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, j as explainPendingMailNotFound, jn as fetchCliOrgs, k as listenForCopyHotkey, kn as RESTRICTED_ROLE_NOTE, kt as successfulSendOutcome, l as hasControlCharacter$1, ln as withoutFocus, lt as buildFollowUpCommand, m as readTextFileFlag, mn as readCallerMailFor, mt as excludeSignalReplies, n as API_ERROR_CODES, nn as oneDomainAtATimeError, nt as replyInteractionWarning, o as extractErrorCode, on as resolveFocus, ot as SEND_OUTCOME_HELP, p as parameterFlagName, pn as mailReach, pt as deriveSendIdempotencyKey, q as clearReadPendingMail, qt as focusEmptyHint, r as OPERATION_PATH_FLAGS, rn as queryScopesItself, s as extractErrorPayload, sn as saveFocus, st as apiResultHttpStatus, t as API_BASE_URL_FLAG_DESCRIPTION, tn as normalizeDomainNames, tt as replyExpectation, u as headerFlagName, un as writeFocusLine, ut as buildThrownSendFailureEnvelope, v as takesStepUp, vn as ATTACHMENT_WAIT_MAX_MS, vt as formatPriorRepliesWarning, w as promptLine$2, wn as refreshStoredCliCredentials, wt as sendIdentityFields, x as STEP_UP_HEADER$1, xt as priorRepliesThatWentOut, y as writeErrorWithHints, yn as withAttachmentWait, yt as formatSendFailureSummary, z as serverMuted, zn as shownLine, zt as detectAgentRuntime } from "../api-command--2ZkNMvH.js";
|
|
2
|
+
import { $ as AUTOMATED_VALUES, $n as testFunction, $t as getWakeSchedule, A as collectNewAcceptedEmails, At as downloadSentAttachmentArchiveMember, B as REPLY_STATE_UNSUPPORTED_CODE, Bt as getFunction, Cn as listSentEmails, Ct as deleteMemory, D as transientFailure, Dn as pollCliLogin, Dt as downloadEmailAttachmentArchiveMember, E as retryingOperation, En as listWakeSchedules, Et as deleteWakeSchedule, F as lateMailReread, Fn as replyToEmail, G as formatAwaitingCell, Gn as setFunctionRoute, Gt as getMemory, H as assertAwaitingFilterRows, Hn as searchMemories, Ht as getFunctionTestRunTrace, I as sinceFromFlags, In as resendAgentSignupVerification, It as getConversation, J as isAwaitingRejectedError, Jn as simulateRoute, Jt as getOwnGrant, K as formatRepliesCell, Kn as setFunctionSecret, Kt as getOrgRoutingTopology, L as sleep$3, Ln as revokeCredential, Lt as getCreditBalance, M as encodeReceivedAtSearchCursor, Mn as redeemCreditCode, Mt as getAccessMode, N as fetchEmailSearchPage, Nn as removeDefaultNetworkMember, Nt as getAccount, O as waitOutRetryAfter, On as pullWebhookEvent, Ot as downloadEmailAttachmentByFilename, P as filtersFromFlags, Pn as reorderRoutes, Pt as getAgentContactPolicy, Q as AUTOMATED_FLAG_DESCRIPTION, Qn as stopRepeatFromEmail, Qt as getThread, R as AWAITING_FLAG_DESCRIPTION, Rn as rotateKey, Rt as getDefaultNetworkAgent, S as describeApiFailure, Sn as listSentAttachmentArchiveMembers, T as retryTransient, Tn as listWakeDispatches, Tt as deleteWakeAuthorization, U as awaitingRejectedError, Un as semanticSearch, Ut as getInboxStatus, V as ReplyStateUnsupportedError, Vn as searchEmails, Vt as getFunctionRouting, W as ensureSearchReportsReplyState, Wn as sendEmail, Wt as getKey, Xn as startAgentSignup, Xt as getSendFrom, Y as queryUsesAwaiting, Yn as startAgentClaim, Yt as getRepeatingSend, Z as AUTOMATED_FILTER_UNSUPPORTED_CODE, Zn as startCliLogin, Zt as getSentEmail, _n as listMailboxAccess, _t as createKey, a as REPEAT_IDLE_MAX_MINUTES, an as listAgentNetworks, ar as updateRoute, b as WaitDeadlineReached, bn as listRoles, bt as createWakeSchedule, cn as listDefaultNetworkMembers, cr as verifyAgentClaim, ct as addDefaultNetworkMember, d as parseRepeatTick, dn as listEmails, dt as checkDefaultNetworkContactAdmission, er as unsetFunctionRoute, et as AutomatedFilterUnsupportedError, f as preparePresenceAliveEmail, fn as listEndpoints, ft as checkSendability, g as isEmailReceivedEvent, gn as listKeys, gt as createFunction, hn as listGroups, ht as createEndpoint, i as REPEAT_EVERY_MAX_MINUTES, in as listAgentContacts, ir as updateRepeatingSend, j as cursorFromAcceptedRows, jt as downloadSentAttachmentByFilename, k as SINCE_VALUE_HELP, l as parseInteractionEnvelope, ln as listDomains, lr as verifyAgentSignup, lt as cancelSentEmail, m as repeatStopCommand, mn as listFunctions, mt as completeWebhookEvent, nn as listActivityObjects, nr as updateFunction, nt as automatedRejectedError, o as REPEAT_MAX_SENDS_MAX, or as updateWakeAuthorization, ot as hasAutomatedVerdict, p as prepareSignalEmail, pn as listFunctionLogs, pt as cliLogout, q as hasReplyState, qn as setMemory, qt as getOutboundStatus, rr as updateKey, s as buildRepeatStopBody, sn as listDefaultNetworkAgents, sr as updateWakeSchedule, st as isAutomatedRejectedError, tn as leaveOrganization, tr as updateDefaultNetworkMember, tt as assertAutomatedVerdict, u as parsePresenceEnvelope, un as listEmailAttachmentArchiveMembers, ur as whoami, ut as cancelSentEmailByIdempotencyKey, v as parseWebhookEvent, vn as listOrganizationPeople, vt as createRoute, w as pauseForTransientFailure, wn as listWakeAuthorizations, wt as deleteRoute, x as backoffDelay, xn as listRoutes, y as parseFromHeader, yn as listRepeatingSends, yt as createWakeAuthorization, z as AWAITING_VALUES, zn as runWakeSchedule, zt as getEmail } from "../repeats-Dj_o6c-X-DTtFzwNd.js";
|
|
3
|
+
import { C as readBundledConnectSkill, S as installedVersion, _ as NotificationOutcomeUnknownError, a as NotificationRetryError, b as installSkill, 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 bundledSkillNames, w as readBundledSkill, x as installedConnectSkillFile, y as connectSkillTarget } from "../notify-session-06flGBgK.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-ADcw9uJm.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-C7l2BSZr.js";
|
|
8
8
|
import { autoSignalEligible, dispatchAutoRead, dispatchAutoWorking, haltAutoWorking, isSentSignal, readWorkingLease, restoreAutoWorking } from "./auto-signals.js";
|
|
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-
|
|
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-D6oaza1W.js";
|
|
10
10
|
import { a as thrownErrorBody, i as runStreamingJson, n as guardJsonOutputCommands, r as jsonOutputRequested, t as JSON_OUTPUT_FLAG } from "../json-output-saHY68hr.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";
|
|
@@ -221,7 +221,7 @@ const openapiDocument = {
|
|
|
221
221
|
},
|
|
222
222
|
{
|
|
223
223
|
"name": "Email Rules",
|
|
224
|
-
"description": "Rules a member writes in plain English to pick out received mail. The organization needs the email rules feature, and the caller must be a member (their own session, or an OAuth or CLI token that is not narrowed) with mail:read.",
|
|
224
|
+
"description": "Rules a member writes in plain English to pick out received mail. Rules apply only to mail received on the organization's mail relay domains: other mail is never classified or decided, and a scope names only mailboxes and domains there. The organization needs the email rules feature, and the caller must be a member (their own session, or an OAuth or CLI token that is not narrowed) with mail:read.",
|
|
225
225
|
"x-openapi-spec": "https://api.primitive.dev/v1/openapi/tags/email-rules"
|
|
226
226
|
},
|
|
227
227
|
{
|
|
@@ -2693,15 +2693,6 @@ const openapiDocument = {
|
|
|
2693
2693
|
},
|
|
2694
2694
|
"description": "Number of results per page"
|
|
2695
2695
|
},
|
|
2696
|
-
{
|
|
2697
|
-
"name": "domain_id",
|
|
2698
|
-
"in": "query",
|
|
2699
|
-
"schema": {
|
|
2700
|
-
"type": "string",
|
|
2701
|
-
"format": "uuid"
|
|
2702
|
-
},
|
|
2703
|
-
"description": "Filter by domain ID"
|
|
2704
|
-
},
|
|
2705
2696
|
{
|
|
2706
2697
|
"name": "status",
|
|
2707
2698
|
"in": "query",
|
|
@@ -2914,6 +2905,13 @@ const openapiDocument = {
|
|
|
2914
2905
|
},
|
|
2915
2906
|
"description": "With `message`, one row per message instead of one per mailbox copy (a message to several mailboxes of the org is stored once per mailbox). The row is the copy in your own mailbox (the `recipient` filter, then your bound address, then your member address), else the copy that arrived first, rejected or not, the same row in history and forward-tail paging. A message is listed when at least one copy you can read matches every filter at once: `awaiting=you` means some copy awaits you, `status=completed` that some copy completed, `search` that some copy matches; the row shown is still the representative. Under a connected agent key, which reads one mailbox, filters test the row itself. A filter other than `recipient` is tested copy by copy, so such a page is a bounded walk and can answer 504 `search_timeout`. With `thread_id`, only copies in that thread are grouped. `meta.total` counts messages. Each row adds `copies` and, when you can read the send, `sent_email_id`. A row can be replaced by a better-ranked copy that becomes visible later: drop any row whose id is in a newer row's `copies`. Paging history, a message whose representative was deleted or outranked between pages can show again on a later page under another id."
|
|
2916
2907
|
},
|
|
2908
|
+
{
|
|
2909
|
+
"name": "domain_ids",
|
|
2910
|
+
"in": "query",
|
|
2911
|
+
"required": false,
|
|
2912
|
+
"schema": { "type": "string" },
|
|
2913
|
+
"description": "Domain ids, comma-separated or with the key repeated, at most 50: only mail received at one of them. Only narrows: an id you cannot read, or of another organization, matches no mail and is not reported as unknown. `meta.domain_ids` echoes the list as given."
|
|
2914
|
+
},
|
|
2917
2915
|
{
|
|
2918
2916
|
"name": "include_presence",
|
|
2919
2917
|
"in": "query",
|
|
@@ -3037,15 +3035,6 @@ const openapiDocument = {
|
|
|
3037
3035
|
},
|
|
3038
3036
|
"description": "Full-text search restricted to the parsed text body."
|
|
3039
3037
|
},
|
|
3040
|
-
{
|
|
3041
|
-
"name": "domain_id",
|
|
3042
|
-
"in": "query",
|
|
3043
|
-
"schema": {
|
|
3044
|
-
"type": "string",
|
|
3045
|
-
"format": "uuid"
|
|
3046
|
-
},
|
|
3047
|
-
"description": "Filter by domain ID."
|
|
3048
|
-
},
|
|
3049
3038
|
{
|
|
3050
3039
|
"name": "reply_to_sent_email_id",
|
|
3051
3040
|
"in": "query",
|
|
@@ -3240,6 +3229,13 @@ const openapiDocument = {
|
|
|
3240
3229
|
"example": "body_text,headers"
|
|
3241
3230
|
},
|
|
3242
3231
|
"description": "Extra parts on every row, comma-separated: `body_text`, `body_html`, `headers`, `attachments`. Reads a page of messages in one request instead of one detail read per row. Parts are withheld where the detail read withholds them. Each body field is cut to 64 KiB per row and a response carries at most 2048 KiB of body text, in page order; a cut or omitted body is named in `truncated_fields`. Unknown values are a `validation_error`."
|
|
3232
|
+
},
|
|
3233
|
+
{
|
|
3234
|
+
"name": "domain_ids",
|
|
3235
|
+
"in": "query",
|
|
3236
|
+
"required": false,
|
|
3237
|
+
"schema": { "type": "string" },
|
|
3238
|
+
"description": "Domain ids, comma-separated or with the key repeated, at most 50: received mail at one of them, and with `direction` `outbound` or `any`, sent mail from an address at one of them. Only narrows: an id you cannot read, or of another organization, matches no mail and is not reported as unknown. `meta.domain_ids` echoes the list as given."
|
|
3243
3239
|
}
|
|
3244
3240
|
],
|
|
3245
3241
|
"responses": {
|
|
@@ -8349,6 +8345,13 @@ const openapiDocument = {
|
|
|
8349
8345
|
},
|
|
8350
8346
|
"description": "Extra parts on every row, comma-separated: `body_text`, `body_html`, `headers`, `attachments`. Reads a page of messages in one request instead of one detail read per row. Parts are withheld where the detail read withholds them. Each body field is cut to 64 KiB per row and a response carries at most 2048 KiB of body text, in page order; a cut or omitted body is named in `truncated_fields`. Unknown values are a `validation_error`."
|
|
8351
8347
|
},
|
|
8348
|
+
{
|
|
8349
|
+
"name": "domain_ids",
|
|
8350
|
+
"in": "query",
|
|
8351
|
+
"required": false,
|
|
8352
|
+
"schema": { "type": "string" },
|
|
8353
|
+
"description": "Domain ids, comma-separated or with the key repeated, at most 50: only sends from an address at one of them. Only narrows: an id you cannot read, or of another organization, matches no mail and is not reported as unknown. `meta.domain_ids` echoes the list as given."
|
|
8354
|
+
},
|
|
8352
8355
|
{
|
|
8353
8356
|
"name": "header",
|
|
8354
8357
|
"in": "query",
|
|
@@ -8366,10 +8369,23 @@ const openapiDocument = {
|
|
|
8366
8369
|
"description": "Page of sent-email summaries",
|
|
8367
8370
|
"content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/ListEnvelope" }, {
|
|
8368
8371
|
"type": "object",
|
|
8369
|
-
"properties": {
|
|
8370
|
-
"
|
|
8371
|
-
|
|
8372
|
-
|
|
8372
|
+
"properties": {
|
|
8373
|
+
"data": {
|
|
8374
|
+
"type": "array",
|
|
8375
|
+
"items": { "$ref": "#/components/schemas/SentEmailSummary" }
|
|
8376
|
+
},
|
|
8377
|
+
"meta": {
|
|
8378
|
+
"type": "object",
|
|
8379
|
+
"properties": { "domain_ids": {
|
|
8380
|
+
"type": "array",
|
|
8381
|
+
"items": {
|
|
8382
|
+
"type": "string",
|
|
8383
|
+
"format": "uuid"
|
|
8384
|
+
},
|
|
8385
|
+
"description": "Present when the request filtered by `domain_ids`: the ids it was given, deduped and lowercased."
|
|
8386
|
+
} }
|
|
8387
|
+
}
|
|
8388
|
+
}
|
|
8373
8389
|
}] } } },
|
|
8374
8390
|
"headers": {
|
|
8375
8391
|
"ratelimit-limit": { "$ref": "#/components/headers/ratelimit-limit" },
|
|
@@ -22153,7 +22169,7 @@ const openapiDocument = {
|
|
|
22153
22169
|
"/email-rules/test": { "post": {
|
|
22154
22170
|
"operationId": "testEmailRule",
|
|
22155
22171
|
"summary": "Test a rule against received mail",
|
|
22156
|
-
"description": "Runs a rule over received mail and reports what it would decide for each email (matched, near_miss, no_match, unclassified, skipped or not_found), with a summary of how each top-level condition and question decided. Test an unsaved tree with its kind, a saved rule by rule_id (its current version, as its author), rule_id with tree (that tree as the rule's next version, as its author, against its saved expectations; its author only), or a pending rule request by request_id (its rule as asked, as you, over your own mailboxes). It reads only mail its author can read and its scope covers. A rule you see only because it covers your own mailboxes runs as you, over only those. Without email_ids it tests the newest emails, at most 200 and none older than 30 days, plus any expected ones. Unclassified emails over 2 hours old are classified first unless classify_missing is false. It records no decision and grants nothing, and stops at about 90 seconds. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
|
|
22172
|
+
"description": "Runs a rule over received mail and reports what it would decide for each email (matched, near_miss, no_match, unclassified, skipped or not_found), with a summary of how each top-level condition and question decided. Test an unsaved tree with its kind, a saved rule by rule_id (its current version, as its author), rule_id with tree (that tree as the rule's next version, as its author, against its saved expectations; its author only), or a pending rule request by request_id (its rule as asked, as you, over your own mailboxes). It reads only mail its author can read and its scope covers. A rule you see only because it covers your own mailboxes runs as you, over only those. Without email_ids it tests the newest emails on the mail relay domains, at most 200 and none older than 30 days, plus any expected ones. Unclassified emails over 2 hours old are classified first unless classify_missing is false. It records no decision and grants nothing, and stops at about 90 seconds. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
|
|
22157
22173
|
"tags": ["Email Rules"],
|
|
22158
22174
|
"security": [{ "BearerAuth": [] }],
|
|
22159
22175
|
"requestBody": {
|
|
@@ -22207,7 +22223,7 @@ const openapiDocument = {
|
|
|
22207
22223
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
22208
22224
|
},
|
|
22209
22225
|
"409": {
|
|
22210
|
-
"description": "email_rule_author_unresolvable: the rule cannot run as its author (for an unsaved tree, a request or a rule covering you, the caller). details.reason is left, revoked, suspended, membership_ended, no_mail_read, no_own_mailbox, no_shareable_mailbox or no_selected_mailbox. email_rule_request_not_pending: request_id names a request already decided.",
|
|
22226
|
+
"description": "email_rule_author_unresolvable: the rule cannot run as its author (for an unsaved tree, a request or a rule covering you, the caller). details.reason is left, revoked, suspended, membership_ended, no_mail_read, no_own_mailbox, no_relay_mailbox (nothing on the mail relay domains to read), no_shareable_mailbox or no_selected_mailbox. email_rule_request_not_pending: request_id names a request already decided.",
|
|
22211
22227
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
22212
22228
|
},
|
|
22213
22229
|
"429": {
|
|
@@ -22409,7 +22425,7 @@ const openapiDocument = {
|
|
|
22409
22425
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
22410
22426
|
},
|
|
22411
22427
|
"409": {
|
|
22412
|
-
"description": "email_rule_author_unresolvable: the rule cannot run as its author (for an unsaved tree, a request or a rule covering you, you), so it would decide nothing for real. details.reason is left, revoked, suspended, membership_ended, no_mail_read, no_own_mailbox, no_shareable_mailbox or no_selected_mailbox. email_rule_request_not_pending: request_id names a request already decided.",
|
|
22428
|
+
"description": "email_rule_author_unresolvable: the rule cannot run as its author (for an unsaved tree, a request or a rule covering you, you), so it would decide nothing for real. details.reason is left, revoked, suspended, membership_ended, no_mail_read, no_own_mailbox, no_relay_mailbox (nothing on the mail relay domains to read), no_shareable_mailbox or no_selected_mailbox. email_rule_request_not_pending: request_id names a request already decided.",
|
|
22413
22429
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
22414
22430
|
},
|
|
22415
22431
|
"429": {
|
|
@@ -22502,11 +22518,11 @@ const openapiDocument = {
|
|
|
22502
22518
|
}
|
|
22503
22519
|
},
|
|
22504
22520
|
"403": {
|
|
22505
|
-
"description": "feature_not_enabled: this organization lacks the email rules feature; permission refusals answer forbidden or grant_forbidden. email_rule_scope_not_readable: scope_selection names something you cannot read (details.addresses, details.domains).",
|
|
22521
|
+
"description": "feature_not_enabled: this organization lacks the email rules feature; permission refusals answer forbidden or grant_forbidden. email_rule_scope_not_readable: scope_selection names something you cannot read, or (details.reason not_relay_domain) something off the mail relay domains (details.addresses, details.domains).",
|
|
22506
22522
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
22507
22523
|
},
|
|
22508
22524
|
"409": {
|
|
22509
|
-
"description": "email_rule_author_unresolvable: the rule could not run as you over the chosen scope. details.reason is left, revoked, suspended, membership_ended, no_mail_read, no_own_mailbox or no_shareable_mailbox. With no evaluation_scope it covers only your own mail, so
|
|
22525
|
+
"description": "email_rule_author_unresolvable: the rule could not run as you over the chosen scope. details.reason is left, revoked, suspended, membership_ended, no_mail_read, no_own_mailbox, no_relay_mailbox or no_shareable_mailbox. With no evaluation_scope it covers only your own mailboxes on the mail relay domains, so those reasons there mean a scope must be named.",
|
|
22510
22526
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
22511
22527
|
},
|
|
22512
22528
|
"429": {
|
|
@@ -24332,7 +24348,7 @@ const openapiDocument = {
|
|
|
24332
24348
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
24333
24349
|
},
|
|
24334
24350
|
"409": {
|
|
24335
|
-
"description": "email_rule_request_not_pending: the request was already decided (details.status). email_rule_request_party_left: one of the two people is no longer a member under the membership recorded (details.party). email_rule_share_limit: the member who asked already receives the most shared rules allowed (details.limit).",
|
|
24351
|
+
"description": "email_rule_request_not_pending: the request was already decided (details.status). email_rule_request_party_left: one of the two people is no longer a member under the membership recorded (details.party). email_rule_share_limit: the member who asked already receives the most shared rules allowed (details.limit). email_rule_author_unresolvable with details.reason no_relay_mailbox: you have no own mailbox on the mail relay domains.",
|
|
24336
24352
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
24337
24353
|
},
|
|
24338
24354
|
"429": {
|
|
@@ -43848,6 +43864,14 @@ const openapiDocument = {
|
|
|
43848
43864
|
"facets_capped": {
|
|
43849
43865
|
"type": "boolean",
|
|
43850
43866
|
"description": "Present and `true` when the search matched more than 1,000 emails, so `facets` aggregate only the most recent 1,000 matches, in the same way `total_capped` marks a capped `total`."
|
|
43867
|
+
},
|
|
43868
|
+
"domain_ids": {
|
|
43869
|
+
"type": "array",
|
|
43870
|
+
"items": {
|
|
43871
|
+
"type": "string",
|
|
43872
|
+
"format": "uuid"
|
|
43873
|
+
},
|
|
43874
|
+
"description": "Present when the request filtered by `domain_ids`: the ids it was given, deduped and lowercased."
|
|
43851
43875
|
}
|
|
43852
43876
|
},
|
|
43853
43877
|
"required": [
|
|
@@ -45985,6 +46009,16 @@ const openapiDocument = {
|
|
|
45985
46009
|
"cursor": {
|
|
45986
46010
|
"type": "string",
|
|
45987
46011
|
"description": "Opaque pagination cursor from a prior response's `meta.cursor`."
|
|
46012
|
+
},
|
|
46013
|
+
"domain_ids": {
|
|
46014
|
+
"type": "array",
|
|
46015
|
+
"items": {
|
|
46016
|
+
"type": "string",
|
|
46017
|
+
"format": "uuid"
|
|
46018
|
+
},
|
|
46019
|
+
"minItems": 1,
|
|
46020
|
+
"maxItems": 50,
|
|
46021
|
+
"description": "Domain ids, at most 50: only received mail at one of them, tested on the ranked candidates, so a page can hold fewer than `limit` results. Received mail only: refused with corpus `outbound`, and the default corpus becomes `inbound`. Only narrows: an id you cannot read, or of another organization, matches no mail and is not reported as unknown. `meta.domain_ids` echoes the list as given."
|
|
45988
46022
|
}
|
|
45989
46023
|
}
|
|
45990
46024
|
},
|
|
@@ -46129,6 +46163,14 @@ const openapiDocument = {
|
|
|
46129
46163
|
"coverage": {
|
|
46130
46164
|
"description": "Index-coverage snapshot, present only when requested via\n`include: [coverage]`; otherwise null.\n",
|
|
46131
46165
|
"oneOf": [{ "$ref": "#/components/schemas/SemanticSearchCoverage" }, { "type": "null" }]
|
|
46166
|
+
},
|
|
46167
|
+
"domain_ids": {
|
|
46168
|
+
"type": "array",
|
|
46169
|
+
"items": {
|
|
46170
|
+
"type": "string",
|
|
46171
|
+
"format": "uuid"
|
|
46172
|
+
},
|
|
46173
|
+
"description": "Present when the request filtered by `domain_ids`: the ids it was given, deduped and lowercased."
|
|
46132
46174
|
}
|
|
46133
46175
|
},
|
|
46134
46176
|
"required": [
|
|
@@ -51383,6 +51425,22 @@ const openapiDocument = {
|
|
|
51383
51425
|
"has_more": {
|
|
51384
51426
|
"type": "boolean",
|
|
51385
51427
|
"description": "Whether another page follows this one, read from the page itself, so it is there with or without a count (`count=false`)."
|
|
51428
|
+
},
|
|
51429
|
+
"total_capped": {
|
|
51430
|
+
"type": "boolean",
|
|
51431
|
+
"description": "Present whenever `total` is. `true` when the count stopped at its cap, so `total` is a floor (\"at least N\") rather than an exact count. On the forward tail (`since`) and with `search`, no count runs: `total` is the rows the page read, and `true` means it saw a match past its last row, so more follow `meta.cursor` (`total` is then `limit` + 1, a floor)."
|
|
51432
|
+
},
|
|
51433
|
+
"total_unavailable": {
|
|
51434
|
+
"type": "boolean",
|
|
51435
|
+
"description": "Present and `true` when a history page asked for a count that did not fit its time budget. The page and `meta.cursor` are still returned; only `total` and `total_capped` are absent. `has_more` still says whether another page follows."
|
|
51436
|
+
},
|
|
51437
|
+
"domain_ids": {
|
|
51438
|
+
"type": "array",
|
|
51439
|
+
"items": {
|
|
51440
|
+
"type": "string",
|
|
51441
|
+
"format": "uuid"
|
|
51442
|
+
},
|
|
51443
|
+
"description": "Present when the request filtered by `domain_ids`: the ids it was given, deduped and lowercased."
|
|
51386
51444
|
}
|
|
51387
51445
|
}
|
|
51388
51446
|
}] },
|
|
@@ -52538,7 +52596,7 @@ const openapiDocument = {
|
|
|
52538
52596
|
"own_mailboxes",
|
|
52539
52597
|
"selected"
|
|
52540
52598
|
],
|
|
52541
|
-
"description": "own_mailboxes (the default): mail to your own addresses and agents (for a rule that shares, those mail:share_own lets you share). author: all you can read, inboxes added later included. selected: what scope_selection names."
|
|
52599
|
+
"description": "own_mailboxes (the default): mail to your own addresses and agents on the mail relay domains (for a rule that shares, those mail:share_own lets you share). author: all you can read, inboxes added later included. selected: what scope_selection names."
|
|
52542
52600
|
},
|
|
52543
52601
|
"scope_selection": { "$ref": "#/components/schemas/EmailRuleScopeSelection" },
|
|
52544
52602
|
"rule_id": {
|
|
@@ -52846,9 +52904,10 @@ const openapiDocument = {
|
|
|
52846
52904
|
]
|
|
52847
52905
|
},
|
|
52848
52906
|
"skipped_reason": {
|
|
52849
|
-
"description": "Why a skipped email cannot be tested. unparsed: its content failed to parse, so it can never be classified. rejected: it was rejected and never delivered. content_discarded: its content has been discarded, or is being. Nothing is classified or asked about it and no stored answers are used, so it never counts as a pass. The recent window holds only mail that can be tested, apart from unparsed mail; an email you name is reported as skipped, whichever of these it is.",
|
|
52907
|
+
"description": "Why a skipped email cannot be tested. not_relay_domain: it was not received on one of the organization's mail relay domains, and rules decide only that mail. unparsed: its content failed to parse, so it can never be classified. rejected: it was rejected and never delivered. content_discarded: its content has been discarded, or is being. Nothing is classified or asked about it and no stored answers are used, so it never counts as a pass. The recent window holds only mail on the mail relay domains that can be tested, apart from unparsed mail; an email you name is reported as skipped, whichever of these it is.",
|
|
52850
52908
|
"type": "string",
|
|
52851
52909
|
"enum": [
|
|
52910
|
+
"not_relay_domain",
|
|
52852
52911
|
"unparsed",
|
|
52853
52912
|
"rejected",
|
|
52854
52913
|
"content_discarded"
|
|
@@ -53209,7 +53268,7 @@ const openapiDocument = {
|
|
|
53209
53268
|
"own_mailboxes",
|
|
53210
53269
|
"selected"
|
|
53211
53270
|
],
|
|
53212
|
-
"description": "own_mailboxes (the default): mail to your own addresses and agents (for a rule that shares, those mail:share_own lets you share). author: all you can read, inboxes added later included. selected: what scope_selection names."
|
|
53271
|
+
"description": "own_mailboxes (the default): mail to your own addresses and agents on the mail relay domains (for a rule that shares, those mail:share_own lets you share). author: all you can read, inboxes added later included. selected: what scope_selection names."
|
|
53213
53272
|
},
|
|
53214
53273
|
"scope_selection": { "$ref": "#/components/schemas/EmailRuleScopeSelection" },
|
|
53215
53274
|
"rule_id": {
|
|
@@ -53316,7 +53375,7 @@ const openapiDocument = {
|
|
|
53316
53375
|
"own_mailboxes",
|
|
53317
53376
|
"selected"
|
|
53318
53377
|
],
|
|
53319
|
-
"description": "own_mailboxes (the default): mail to your own addresses and agents (for a rule that shares, those mail:share_own lets you share). author: all you can read, inboxes added later included. selected: what scope_selection names."
|
|
53378
|
+
"description": "own_mailboxes (the default): mail to your own addresses and agents on the mail relay domains (for a rule that shares, those mail:share_own lets you share). author: all you can read, inboxes added later included. selected: what scope_selection names."
|
|
53320
53379
|
},
|
|
53321
53380
|
"scope_selection": { "$ref": "#/components/schemas/EmailRuleScopeSelection" },
|
|
53322
53381
|
"rule_id": {
|
|
@@ -53879,7 +53938,7 @@ const openapiDocument = {
|
|
|
53879
53938
|
"own_mailboxes",
|
|
53880
53939
|
"selected"
|
|
53881
53940
|
],
|
|
53882
|
-
"description": "own_mailboxes (the default): mail to your own addresses and agents (for a rule that shares, those mail:share_own lets you share). author: all you can read, inboxes added later included. selected: what scope_selection names."
|
|
53941
|
+
"description": "own_mailboxes (the default): mail to your own addresses and agents on the mail relay domains (for a rule that shares, those mail:share_own lets you share). author: all you can read, inboxes added later included. selected: what scope_selection names."
|
|
53883
53942
|
},
|
|
53884
53943
|
"scope_selection": { "$ref": "#/components/schemas/EmailRuleScopeSelection" },
|
|
53885
53944
|
"expectations": {
|
|
@@ -54191,7 +54250,7 @@ const openapiDocument = {
|
|
|
54191
54250
|
"own_mailboxes",
|
|
54192
54251
|
"selected"
|
|
54193
54252
|
],
|
|
54194
|
-
"description": "own_mailboxes: mail to your own addresses and agents (for a rule that shares, those mail:share_own lets you share). author: all you can read, inboxes added later included. selected: what scope_selection names. Left out, the scope stays. A change saves a new version with the same conditions, and is refused while the rule is shared."
|
|
54253
|
+
"description": "own_mailboxes: mail to your own addresses and agents on the mail relay domains (for a rule that shares, those mail:share_own lets you share). author: all you can read, inboxes added later included. selected: what scope_selection names. Left out, the scope stays. A change saves a new version with the same conditions, and is refused while the rule is shared."
|
|
54195
54254
|
},
|
|
54196
54255
|
"scope_selection": { "$ref": "#/components/schemas/EmailRuleScopeSelection" },
|
|
54197
54256
|
"expectations": {
|
|
@@ -54804,12 +54863,12 @@ const openapiDocument = {
|
|
|
54804
54863
|
"addresses": {
|
|
54805
54864
|
"type": "array",
|
|
54806
54865
|
"items": { "type": "string" },
|
|
54807
|
-
"description": "Inboxes you can read, matching q. For someone who reads the whole organization, the inboxes known as someone's: member addresses, members' verified work emails at the organization's domains, agents' addresses and inboxes with shared access. Otherwise the inboxes your access lists (search with q for those past the first page). See may_name_unlisted for what else you may name."
|
|
54866
|
+
"description": "Inboxes on the mail relay domains you can read, matching q. For someone who reads the whole organization, the inboxes known as someone's: member addresses, members' verified work emails at the organization's domains, agents' addresses and inboxes with shared access. Otherwise the inboxes your access lists (search with q for those past the first page). See may_name_unlisted for what else you may name."
|
|
54808
54867
|
},
|
|
54809
54868
|
"domains": {
|
|
54810
54869
|
"type": "array",
|
|
54811
54870
|
"items": { "type": "string" },
|
|
54812
|
-
"description": "
|
|
54871
|
+
"description": "Mail relay domains you can read, matching q."
|
|
54813
54872
|
},
|
|
54814
54873
|
"more": {
|
|
54815
54874
|
"type": "boolean",
|
|
@@ -55064,7 +55123,7 @@ const openapiDocument = {
|
|
|
55064
55123
|
"description": "Whether they can accept a rule request now under their role."
|
|
55065
55124
|
},
|
|
55066
55125
|
"missing_permission": {
|
|
55067
|
-
"description": "The permission their role lacks for accepting, when can_accept is false.",
|
|
55126
|
+
"description": "The permission their role lacks for accepting, when can_accept is false; null then means they have no own mailbox on the mail relay domains.",
|
|
55068
55127
|
"type": ["string", "null"]
|
|
55069
55128
|
},
|
|
55070
55129
|
"warning": {
|
|
@@ -67108,7 +67167,7 @@ var AgentEnrollCommand = class AgentEnrollCommand extends Command {
|
|
|
67108
67167
|
}
|
|
67109
67168
|
};
|
|
67110
67169
|
// src/oclif/commands/agent-notes.ts
|
|
67111
|
-
const commonFlags$
|
|
67170
|
+
const commonFlags$4 = {
|
|
67112
67171
|
address: Flags.string({ description: "Address to target; writes by a connected profile can target only its own address" }),
|
|
67113
67172
|
json: Flags.boolean({ description: "Print JSON (already the default)" }),
|
|
67114
67173
|
"api-key": Flags.string({
|
|
@@ -67158,7 +67217,7 @@ var AgentNotesListCommand = class AgentNotesListCommand extends Command {
|
|
|
67158
67217
|
static description = "List organization notes for an address. A connected profile defaults to its own address. With --address it lists only the AGENT_INFO, AGENT_WORKING and AGENT_RUNTIME notes of another agent in its organization.";
|
|
67159
67218
|
static summary = "List address notes";
|
|
67160
67219
|
static flags = {
|
|
67161
|
-
...commonFlags$
|
|
67220
|
+
...commonFlags$4,
|
|
67162
67221
|
prefix: Flags.string({ description: "Only names beginning with this prefix" }),
|
|
67163
67222
|
cursor: Flags.string({ description: "Continue after a note name returned as meta.cursor" }),
|
|
67164
67223
|
limit: Flags.integer({
|
|
@@ -67182,7 +67241,7 @@ var AgentNotesGetCommand = class AgentNotesGetCommand extends Command {
|
|
|
67182
67241
|
static description = "Read one organization address note. A connected profile defaults to its own address. On the address of another agent in its organization it can read only AGENT_INFO, AGENT_WORKING and AGENT_RUNTIME; other notes there return 403.";
|
|
67183
67242
|
static summary = "Get an address note";
|
|
67184
67243
|
static args = nameArg;
|
|
67185
|
-
static flags = commonFlags$
|
|
67244
|
+
static flags = commonFlags$4;
|
|
67186
67245
|
async run() {
|
|
67187
67246
|
const { args, flags } = await this.parse(AgentNotesGetCommand);
|
|
67188
67247
|
await run$3(this, {
|
|
@@ -67199,7 +67258,7 @@ var AgentNotesSetCommand = class AgentNotesSetCommand extends Command {
|
|
|
67199
67258
|
text: Args.string({ description: "Text value (or JSON with --json-value); use --value-file for longer or private content" })
|
|
67200
67259
|
};
|
|
67201
67260
|
static flags = {
|
|
67202
|
-
...commonFlags$
|
|
67261
|
+
...commonFlags$4,
|
|
67203
67262
|
"value-file": Flags.string({ description: "Read the value from a UTF-8 file instead of a command argument" }),
|
|
67204
67263
|
"json-value": Flags.boolean({ description: "Parse the supplied value as JSON instead of storing plain text" }),
|
|
67205
67264
|
"if-version": Flags.string({
|
|
@@ -67244,7 +67303,7 @@ var AgentNotesDeleteCommand = class AgentNotesDeleteCommand extends Command {
|
|
|
67244
67303
|
static summary = "Delete an address note";
|
|
67245
67304
|
static args = nameArg;
|
|
67246
67305
|
static flags = {
|
|
67247
|
-
...commonFlags$
|
|
67306
|
+
...commonFlags$4,
|
|
67248
67307
|
"if-version": Flags.string({ description: "Delete only if the note has this exact version" })
|
|
67249
67308
|
};
|
|
67250
67309
|
async run() {
|
|
@@ -67474,7 +67533,7 @@ function runtimeNoteValue(value) {
|
|
|
67474
67533
|
return text;
|
|
67475
67534
|
}
|
|
67476
67535
|
// src/oclif/commands/agent-runtime.ts
|
|
67477
|
-
const commonFlags$
|
|
67536
|
+
const commonFlags$3 = {
|
|
67478
67537
|
json: Flags.boolean({ description: "Print the result as JSON" }),
|
|
67479
67538
|
"api-key": Flags.string({
|
|
67480
67539
|
description: "API key override",
|
|
@@ -67529,7 +67588,7 @@ var AgentRuntimeSetCommand = class AgentRuntimeSetCommand extends Command {
|
|
|
67529
67588
|
static description = `Write the private ${RUNTIME_NOTE_NAME} address note: one line saying where this agent runs and what it is, so its owner and peers can tell sessions apart. Without --value the line is \`<runtime> on <host> in <folder>\`, for example "Claude Code on my-laptop in app". The runtime is Claude Code, Codex or omp when detected, otherwise CLI; the host is the machine name without a trailing .local; the folder is the current directory's name only, never its full path. No environment values or credentials are included. The note is private to the organization, and an existing note is updated in place. Offer this to your owner before writing it.`;
|
|
67530
67589
|
static examples = ["<%= config.bin %> agent runtime set", "<%= config.bin %> agent runtime set --value \"Codex on build-box in api\" --json"];
|
|
67531
67590
|
static flags = {
|
|
67532
|
-
...commonFlags$
|
|
67591
|
+
...commonFlags$3,
|
|
67533
67592
|
value: Flags.string({ description: `One line to store instead of the computed default, at most 500 characters` }),
|
|
67534
67593
|
address: Flags.string({ description: "Address whose note to write. A connected profile defaults to, and can write only, its own address; owner logins must pass it." })
|
|
67535
67594
|
};
|
|
@@ -67560,7 +67619,7 @@ var AgentRuntimeGetCommand = class AgentRuntimeGetCommand extends Command {
|
|
|
67560
67619
|
static description = `Read the ${RUNTIME_NOTE_NAME} address note for an address. Prints its one line, or "none" when the note is absent. A connected profile defaults to its own address.`;
|
|
67561
67620
|
static examples = ["<%= config.bin %> agent runtime get", "<%= config.bin %> agent runtime get --address peer@example.com --json"];
|
|
67562
67621
|
static flags = {
|
|
67563
|
-
...commonFlags$
|
|
67622
|
+
...commonFlags$3,
|
|
67564
67623
|
address: Flags.string({ description: "Address to read. A connected profile defaults to its own address." })
|
|
67565
67624
|
};
|
|
67566
67625
|
async run() {
|
|
@@ -67994,7 +68053,7 @@ function parseIsoTime(value) {
|
|
|
67994
68053
|
return Date.parse(value);
|
|
67995
68054
|
}
|
|
67996
68055
|
// src/oclif/commands/agent-working.ts
|
|
67997
|
-
const commonFlags$
|
|
68056
|
+
const commonFlags$2 = {
|
|
67998
68057
|
json: Flags.boolean({ description: "Print the result as JSON" }),
|
|
67999
68058
|
"api-key": Flags.string({
|
|
68000
68059
|
description: "API key override",
|
|
@@ -68080,7 +68139,7 @@ var AgentWorkingSetCommand = class AgentWorkingSetCommand extends Command {
|
|
|
68080
68139
|
ignoreStdin: true
|
|
68081
68140
|
}) };
|
|
68082
68141
|
static flags = {
|
|
68083
|
-
...commonFlags$
|
|
68142
|
+
...commonFlags$2,
|
|
68084
68143
|
address: writeAddressFlag,
|
|
68085
68144
|
stdin: Flags.boolean({ description: "Read the claim from stdin instead of an argument, so it stays out of process listings and shell history" }),
|
|
68086
68145
|
until: Flags.string({ description: "Expiry as an ISO 8601 time with a timezone (default: 4 hours from now)" }),
|
|
@@ -68125,7 +68184,7 @@ var AgentWorkingGetCommand = class AgentWorkingGetCommand extends Command {
|
|
|
68125
68184
|
static description = `Read the ${WORKING_NOTE_NAME} claim for an address. Prints the claim and its expiry, or "none" when there is no claim or it has expired. A plain-text value written before claims had an expiry is shown as-is. A connected profile defaults to its own address; use --address to check a peer before editing a shared file.`;
|
|
68126
68185
|
static examples = ["<%= config.bin %> agent working get", "<%= config.bin %> agent working get --address peer@example.com --json"];
|
|
68127
68186
|
static flags = {
|
|
68128
|
-
...commonFlags$
|
|
68187
|
+
...commonFlags$2,
|
|
68129
68188
|
address: Flags.string({ description: "Address to check. A connected profile defaults to its own address." })
|
|
68130
68189
|
};
|
|
68131
68190
|
async run() {
|
|
@@ -68163,7 +68222,7 @@ var AgentWorkingClearCommand = class AgentWorkingClearCommand extends Command {
|
|
|
68163
68222
|
static description = `End the ${WORKING_NOTE_NAME} claim when work ends. The claim is rewritten with its expiry set to now, so it reads as none from then on; this works for connected agents, which may write their own notes but not delete them. If that write is refused, the note is deleted instead when the credential allows it. Succeeds when there is no active claim to clear.`;
|
|
68164
68223
|
static examples = ["<%= config.bin %> agent working clear"];
|
|
68165
68224
|
static flags = {
|
|
68166
|
-
...commonFlags$
|
|
68225
|
+
...commonFlags$2,
|
|
68167
68226
|
address: writeAddressFlag
|
|
68168
68227
|
};
|
|
68169
68228
|
async run() {
|
|
@@ -74230,7 +74289,8 @@ var EmailsLatestCommand = class EmailsLatestCommand extends Command {
|
|
|
74230
74289
|
options: [...AWAITING_VALUES]
|
|
74231
74290
|
}),
|
|
74232
74291
|
json: Flags.boolean({ description: "Print the raw response envelope (with full UUIDs and meta) as JSON on STDOUT instead of the text table. Useful for piping into `jq`, capturing ids for follow-up commands, or scripting." }),
|
|
74233
|
-
time: Flags.boolean({ description: TIME_FLAG_DESCRIPTION })
|
|
74292
|
+
time: Flags.boolean({ description: TIME_FLAG_DESCRIPTION }),
|
|
74293
|
+
...focusFlags()
|
|
74234
74294
|
};
|
|
74235
74295
|
async run() {
|
|
74236
74296
|
const { flags } = await this.parse(EmailsLatestCommand);
|
|
@@ -74241,12 +74301,21 @@ var EmailsLatestCommand = class EmailsLatestCommand extends Command {
|
|
|
74241
74301
|
configDir: this.config.configDir
|
|
74242
74302
|
});
|
|
74243
74303
|
const awaiting = flags.awaiting;
|
|
74304
|
+
const focus = await resolveFocus({
|
|
74305
|
+
surface: "inbound",
|
|
74306
|
+
configDir: this.config.configDir,
|
|
74307
|
+
auth,
|
|
74308
|
+
client: apiClient.client,
|
|
74309
|
+
flags: focusFlagValues(flags)
|
|
74310
|
+
});
|
|
74311
|
+
const query = {
|
|
74312
|
+
limit: flags.limit,
|
|
74313
|
+
...awaiting ? { awaiting } : {},
|
|
74314
|
+
...focus.params
|
|
74315
|
+
};
|
|
74244
74316
|
const result = await listEmails({
|
|
74245
74317
|
client: apiClient.client,
|
|
74246
|
-
query
|
|
74247
|
-
limit: flags.limit,
|
|
74248
|
-
...awaiting ? { awaiting } : {}
|
|
74249
|
-
},
|
|
74318
|
+
query,
|
|
74250
74319
|
responseStyle: "fields"
|
|
74251
74320
|
});
|
|
74252
74321
|
if (result.error) {
|
|
@@ -74275,12 +74344,33 @@ var EmailsLatestCommand = class EmailsLatestCommand extends Command {
|
|
|
74275
74344
|
process.exitCode = 1;
|
|
74276
74345
|
return;
|
|
74277
74346
|
}
|
|
74347
|
+
const rows = envelope?.data ?? [];
|
|
74348
|
+
const note = rows.length === 0 ? await focusEmptyHint(focus, async () => {
|
|
74349
|
+
const counted = await listEmails({
|
|
74350
|
+
client: apiClient.client,
|
|
74351
|
+
query: {
|
|
74352
|
+
...withoutFocus(query, focus),
|
|
74353
|
+
limit: 1,
|
|
74354
|
+
count: "true"
|
|
74355
|
+
},
|
|
74356
|
+
responseStyle: "fields"
|
|
74357
|
+
});
|
|
74358
|
+
return counted.error ? null : countFromMeta(counted.data);
|
|
74359
|
+
}) : null;
|
|
74278
74360
|
if (flags.json) {
|
|
74279
|
-
|
|
74361
|
+
const document = withFocusMeta(envelope ?? null, focus);
|
|
74362
|
+
this.log(JSON.stringify(note && document ? {
|
|
74363
|
+
...document,
|
|
74364
|
+
summary: note
|
|
74365
|
+
} : document, null, 2));
|
|
74280
74366
|
return;
|
|
74281
74367
|
}
|
|
74282
|
-
|
|
74368
|
+
writeFocusLine(focus, false);
|
|
74283
74369
|
if (rows.length === 0) {
|
|
74370
|
+
if (note) {
|
|
74371
|
+
process.stderr.write(`${note}\n`);
|
|
74372
|
+
return;
|
|
74373
|
+
}
|
|
74284
74374
|
process.stderr.write(`${emptyEmailListHint({
|
|
74285
74375
|
filterFlags: awaiting ? [`--awaiting ${awaiting}`] : [],
|
|
74286
74376
|
caller: await readCallerMailFor(auth, apiClient.client),
|
|
@@ -74599,6 +74689,7 @@ var EmailsWaitCommand = class EmailsWaitCommand extends Command {
|
|
|
74599
74689
|
}
|
|
74600
74690
|
};
|
|
74601
74691
|
// src/oclif/commands/emails-watch.ts
|
|
74692
|
+
const ELSEWHERE_CHECK_MS = 6e4;
|
|
74602
74693
|
function cliError$4(message) {
|
|
74603
74694
|
return new Errors.CLIError(message, { exit: 1 });
|
|
74604
74695
|
}
|
|
@@ -74630,7 +74721,7 @@ var EmailsWatchCommand = class EmailsWatchCommand extends Command {
|
|
|
74630
74721
|
options: [...AWAITING_VALUES]
|
|
74631
74722
|
}),
|
|
74632
74723
|
body: Flags.string({ description: "Full-text body filter" }),
|
|
74633
|
-
|
|
74724
|
+
...focusFlags(),
|
|
74634
74725
|
"domain-id": Flags.string({ description: "Filter by domain UUID" }),
|
|
74635
74726
|
from: Flags.string({ description: "Filter by sender address or domain" }),
|
|
74636
74727
|
"has-attachment": Flags.boolean({ description: "Only show emails with one or more attachments" }),
|
|
@@ -74675,7 +74766,25 @@ var EmailsWatchCommand = class EmailsWatchCommand extends Command {
|
|
|
74675
74766
|
} catch (error) {
|
|
74676
74767
|
throw cliError$4(error instanceof Error ? error.message : String(error));
|
|
74677
74768
|
}
|
|
74678
|
-
const
|
|
74769
|
+
const focus = await resolveFocus({
|
|
74770
|
+
surface: "inbound",
|
|
74771
|
+
configDir: this.config.configDir,
|
|
74772
|
+
auth,
|
|
74773
|
+
client: apiClient.client,
|
|
74774
|
+
flags: focusFlagValues(flags),
|
|
74775
|
+
explicitScope: Boolean(flags["domain-id"] || flags.to) || queryScopesItself(flags.q),
|
|
74776
|
+
conflictingFlag: flags["domain-id"] ? "--domain-id" : void 0
|
|
74777
|
+
});
|
|
74778
|
+
writeFocusLine(focus, false);
|
|
74779
|
+
const filters = {
|
|
74780
|
+
...filtersFromFlags({
|
|
74781
|
+
...flags,
|
|
74782
|
+
domain: void 0
|
|
74783
|
+
}),
|
|
74784
|
+
...focus.focused ? { focus: focus.params } : {}
|
|
74785
|
+
};
|
|
74786
|
+
let elsewhereNoted = !focus.focused;
|
|
74787
|
+
let elsewhereCheckedAt = 0;
|
|
74679
74788
|
const deadline = flags.seconds ? Date.now() + flags.seconds * 1e3 : null;
|
|
74680
74789
|
const idWidth = pickIdWidth(Boolean(process.stdout.isTTY));
|
|
74681
74790
|
const seenIds = /* @__PURE__ */ new Set();
|
|
@@ -74744,6 +74853,33 @@ var EmailsWatchCommand = class EmailsWatchCommand extends Command {
|
|
|
74744
74853
|
printed += 1;
|
|
74745
74854
|
if (flags.number && printed >= flags.number) return;
|
|
74746
74855
|
}
|
|
74856
|
+
if (printed === 0 && !elsewhereNoted && Date.now() - elsewhereCheckedAt >= ELSEWHERE_CHECK_MS) {
|
|
74857
|
+
elsewhereCheckedAt = Date.now();
|
|
74858
|
+
let total = null;
|
|
74859
|
+
let capped = false;
|
|
74860
|
+
const note = await focusEmptyHint(focus, async () => {
|
|
74861
|
+
const counted = await fetchEmailSearchPage({
|
|
74862
|
+
apiClient,
|
|
74863
|
+
count: true,
|
|
74864
|
+
filters: {
|
|
74865
|
+
...filters,
|
|
74866
|
+
focus: void 0
|
|
74867
|
+
},
|
|
74868
|
+
pageSize: 1,
|
|
74869
|
+
since
|
|
74870
|
+
});
|
|
74871
|
+
total = counted.ok ? counted.total ?? null : null;
|
|
74872
|
+
capped = counted.ok && counted.totalCapped === true;
|
|
74873
|
+
return total === null ? null : {
|
|
74874
|
+
total,
|
|
74875
|
+
bound: capped ? "atLeast" : void 0
|
|
74876
|
+
};
|
|
74877
|
+
});
|
|
74878
|
+
if (note && total !== null && total > 0) {
|
|
74879
|
+
process.stderr.write(`${note}\n`);
|
|
74880
|
+
elsewhereNoted = true;
|
|
74881
|
+
}
|
|
74882
|
+
}
|
|
74747
74883
|
if (cursorAdvanced) continue;
|
|
74748
74884
|
if (!await waitOutRetryAfter(recent.failed, { deadline })) break;
|
|
74749
74885
|
if (deadline !== null && Date.now() >= deadline) break;
|
|
@@ -74751,6 +74887,186 @@ var EmailsWatchCommand = class EmailsWatchCommand extends Command {
|
|
|
74751
74887
|
}
|
|
74752
74888
|
}
|
|
74753
74889
|
};
|
|
74890
|
+
// src/oclif/commands/focus.ts
|
|
74891
|
+
const commonFlags$1 = {
|
|
74892
|
+
json: JSON_OUTPUT_FLAG,
|
|
74893
|
+
"api-key": Flags.string({
|
|
74894
|
+
description: "API key override",
|
|
74895
|
+
env: "PRIMITIVE_API_KEY"
|
|
74896
|
+
}),
|
|
74897
|
+
"api-base-url": Flags.string({
|
|
74898
|
+
description: API_BASE_URL_FLAG_DESCRIPTION,
|
|
74899
|
+
env: "PRIMITIVE_API_BASE_URL",
|
|
74900
|
+
hidden: true
|
|
74901
|
+
})
|
|
74902
|
+
};
|
|
74903
|
+
const FOCUS_DESCRIPTION = `Which domains mail listings and searches show.
|
|
74904
|
+
|
|
74905
|
+
On a credential that reads mail on more than one domain, listings and searches are refused until a focus is chosen: \`primitive focus set <domain...>\` to see only those domains, or \`primitive focus set --all\` to see every domain. The choice is saved for this profile (the member login, or the connected agent selected by PRIMITIVE_AGENT_PROFILE), never in a credential file.
|
|
74906
|
+
|
|
74907
|
+
A focus applies to \`emails list\`, \`emails latest\`, \`emails search\`, \`search\`, \`emails watch\`, \`inbox next\`, \`sent list\` and \`semantic-search\`. Every focused command says so on stderr, and under --json in \`meta.focus\`. It never applies to reads by id or to notifications (\`listen\`, \`wait\`, \`emails wait\`, \`agent check-mail\`).
|
|
74908
|
+
|
|
74909
|
+
Override it for one command with --domain <name> or --all-domains, or for a session with ${FOCUS_ENV}=<name,...> (or ${FOCUS_ENV}=all).`;
|
|
74910
|
+
async function readState(command, flags, lookupOptional = false) {
|
|
74911
|
+
const { apiClient, auth } = await createAuthenticatedCliApiClient({
|
|
74912
|
+
configDir: command.config.configDir,
|
|
74913
|
+
apiKey: flags["api-key"],
|
|
74914
|
+
apiBaseUrl: flags["api-base-url"]
|
|
74915
|
+
});
|
|
74916
|
+
const readable = await readReadableDomains(apiClient.client);
|
|
74917
|
+
const fallbackOrg = auth.connectedAgent?.orgId ?? auth.credentials?.org_id ?? null;
|
|
74918
|
+
if (!readable && lookupOptional && fallbackOrg) return {
|
|
74919
|
+
profile: focusProfile(command.config.configDir, auth),
|
|
74920
|
+
orgId: fallbackOrg,
|
|
74921
|
+
readable: null
|
|
74922
|
+
};
|
|
74923
|
+
if (!readable) throw new Errors.CLIError("Could not read this credential's domains; retry in a moment.", {
|
|
74924
|
+
exit: 1,
|
|
74925
|
+
code: "focus_lookup_failed"
|
|
74926
|
+
});
|
|
74927
|
+
const orgId = readable.orgId ?? auth.connectedAgent?.orgId ?? auth.credentials?.org_id ?? null;
|
|
74928
|
+
if (!orgId) throw new Errors.CLIError("This credential reads no verified domain, so there is no focus to choose.", {
|
|
74929
|
+
exit: 1,
|
|
74930
|
+
code: "focus_no_domains"
|
|
74931
|
+
});
|
|
74932
|
+
return {
|
|
74933
|
+
profile: focusProfile(command.config.configDir, auth),
|
|
74934
|
+
orgId,
|
|
74935
|
+
readable
|
|
74936
|
+
};
|
|
74937
|
+
}
|
|
74938
|
+
function profileLabel(profile) {
|
|
74939
|
+
return profile.kind === "agent" ? `agent profile ${profile.name}` : "the member login";
|
|
74940
|
+
}
|
|
74941
|
+
function describeChoice(choice) {
|
|
74942
|
+
if (!choice) return "none chosen";
|
|
74943
|
+
if ("all" in choice) return "every domain";
|
|
74944
|
+
return joinNames(choice.domains.map((d) => d.name));
|
|
74945
|
+
}
|
|
74946
|
+
function choiceJson(choice) {
|
|
74947
|
+
if (!choice) return null;
|
|
74948
|
+
if ("all" in choice) return {
|
|
74949
|
+
all: true,
|
|
74950
|
+
domains: []
|
|
74951
|
+
};
|
|
74952
|
+
return {
|
|
74953
|
+
all: false,
|
|
74954
|
+
domains: choice.domains
|
|
74955
|
+
};
|
|
74956
|
+
}
|
|
74957
|
+
var FocusCommand = class FocusCommand extends Command {
|
|
74958
|
+
static summary = "Show which domains mail listings and searches show";
|
|
74959
|
+
static description = FOCUS_DESCRIPTION;
|
|
74960
|
+
static examples = [
|
|
74961
|
+
"<%= config.bin %> focus",
|
|
74962
|
+
"<%= config.bin %> focus set support.example.com",
|
|
74963
|
+
"<%= config.bin %> focus set --all",
|
|
74964
|
+
"<%= config.bin %> focus clear"
|
|
74965
|
+
];
|
|
74966
|
+
static flags = commonFlags$1;
|
|
74967
|
+
async run() {
|
|
74968
|
+
const { flags } = await this.parse(FocusCommand);
|
|
74969
|
+
const state = await readState(this, flags, true);
|
|
74970
|
+
const choice = loadSavedFocus(state.profile, state.orgId)?.choice ?? null;
|
|
74971
|
+
const session = process.env["PRIMITIVE_FOCUS_DOMAINS"]?.trim() || null;
|
|
74972
|
+
const names = state.readable?.domains.map((d) => d.name) ?? null;
|
|
74973
|
+
if (flags.json) {
|
|
74974
|
+
this.log(JSON.stringify({
|
|
74975
|
+
profile: profileLabel(state.profile),
|
|
74976
|
+
saved: choiceJson(choice),
|
|
74977
|
+
session_override: session,
|
|
74978
|
+
domains: names,
|
|
74979
|
+
applies: names === null ? null : names.length > 1
|
|
74980
|
+
}, null, 2));
|
|
74981
|
+
return;
|
|
74982
|
+
}
|
|
74983
|
+
if (names !== null && names.length <= 1) {
|
|
74984
|
+
this.log(`This credential reads mail on ${names.length === 1 ? `one domain, ${names[0]}` : "no verified domain"}, so listings are never focused.`);
|
|
74985
|
+
return;
|
|
74986
|
+
}
|
|
74987
|
+
this.log(`Focus for ${profileLabel(state.profile)}: ${describeChoice(choice)}.`);
|
|
74988
|
+
if (session) this.log(`${FOCUS_ENV}=${session} overrides it in this session.`);
|
|
74989
|
+
this.log(names === null ? "Could not read this credential's domains just now." : `Domains this credential reads mail on: ${joinNames(names)}.`);
|
|
74990
|
+
if (!choice) this.log("Choose with `primitive focus set <domain...>` or `primitive focus set --all`.");
|
|
74991
|
+
}
|
|
74992
|
+
};
|
|
74993
|
+
var FocusSetCommand = class FocusSetCommand extends Command {
|
|
74994
|
+
static summary = "Choose which domains mail listings and searches show";
|
|
74995
|
+
static description = `Save the focus for this profile: the domains named, or every domain with --all. Names are checked against the domains this credential reads mail on.
|
|
74996
|
+
|
|
74997
|
+
${FOCUS_DESCRIPTION}`;
|
|
74998
|
+
static strict = false;
|
|
74999
|
+
static args = {};
|
|
75000
|
+
static examples = ["<%= config.bin %> focus set support.example.com", "<%= config.bin %> focus set --all"];
|
|
75001
|
+
static flags = {
|
|
75002
|
+
...commonFlags$1,
|
|
75003
|
+
all: Flags.boolean({ description: "Show every domain this credential reads mail on." })
|
|
75004
|
+
};
|
|
75005
|
+
async run() {
|
|
75006
|
+
const { flags, argv } = await this.parse(FocusSetCommand);
|
|
75007
|
+
const given = argv.filter((a) => typeof a === "string");
|
|
75008
|
+
const flagLike = given.find((a) => a.startsWith("-"));
|
|
75009
|
+
if (flagLike) throw new Errors.CLIError(`${flagLike} is not a flag of focus set: name domains as arguments, or pass --all.`, {
|
|
75010
|
+
exit: 2,
|
|
75011
|
+
code: "usage_error"
|
|
75012
|
+
});
|
|
75013
|
+
const names = normalizeDomainNames(given);
|
|
75014
|
+
if (flags.all && names.length > 0) throw new Errors.CLIError("Name domains or pass --all, not both.", {
|
|
75015
|
+
exit: 2,
|
|
75016
|
+
code: "usage_error"
|
|
75017
|
+
});
|
|
75018
|
+
if (!flags.all && names.length === 0) throw new Errors.CLIError("Name one or more domains, or pass --all for every domain.", {
|
|
75019
|
+
exit: 2,
|
|
75020
|
+
code: "usage_error"
|
|
75021
|
+
});
|
|
75022
|
+
if (names.length > 1 && !manyDomainsSupported()) throw oneDomainAtATimeError(names);
|
|
75023
|
+
if (names.length > 50) throw new Errors.CLIError(`A focus names at most 50 domains (got ${names.length}).`, {
|
|
75024
|
+
exit: 2,
|
|
75025
|
+
code: "usage_error"
|
|
75026
|
+
});
|
|
75027
|
+
const state = await readState(this, flags);
|
|
75028
|
+
const choice = flags.all ? { all: true } : { domains: resolveDomainNames(names, state.readable.domains, "primitive focus set") };
|
|
75029
|
+
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
75030
|
+
saveFocus(state.profile, state.orgId, () => ({
|
|
75031
|
+
choice,
|
|
75032
|
+
chosen_at: at
|
|
75033
|
+
}));
|
|
75034
|
+
if (flags.json) {
|
|
75035
|
+
this.log(JSON.stringify({
|
|
75036
|
+
profile: profileLabel(state.profile),
|
|
75037
|
+
saved: choiceJson(choice)
|
|
75038
|
+
}, null, 2));
|
|
75039
|
+
return;
|
|
75040
|
+
}
|
|
75041
|
+
this.log("all" in choice ? `Listings and searches for ${profileLabel(state.profile)} now show every domain.` : `Listings and searches for ${profileLabel(state.profile)} now show only ${describeChoice(choice)}. Widen one command with --all-domains, or run \`primitive focus clear\`.`);
|
|
75042
|
+
}
|
|
75043
|
+
};
|
|
75044
|
+
var FocusClearCommand = class FocusClearCommand extends Command {
|
|
75045
|
+
static summary = "Forget the saved focus for this profile";
|
|
75046
|
+
static description = `Forget this profile's saved focus. On a credential that reads mail on more than one domain, listings and searches are then refused until a focus is chosen again.
|
|
75047
|
+
|
|
75048
|
+
${FOCUS_DESCRIPTION}`;
|
|
75049
|
+
static examples = ["<%= config.bin %> focus clear"];
|
|
75050
|
+
static flags = commonFlags$1;
|
|
75051
|
+
async run() {
|
|
75052
|
+
const { flags } = await this.parse(FocusClearCommand);
|
|
75053
|
+
const state = await readState(this, flags, true);
|
|
75054
|
+
let had = false;
|
|
75055
|
+
saveFocus(state.profile, state.orgId, (current) => {
|
|
75056
|
+
had = Boolean(current?.choice);
|
|
75057
|
+
return null;
|
|
75058
|
+
});
|
|
75059
|
+
if (flags.json) {
|
|
75060
|
+
this.log(JSON.stringify({
|
|
75061
|
+
profile: profileLabel(state.profile),
|
|
75062
|
+
saved: null,
|
|
75063
|
+
cleared: had
|
|
75064
|
+
}, null, 2));
|
|
75065
|
+
return;
|
|
75066
|
+
}
|
|
75067
|
+
this.log(had ? `Cleared the focus for ${profileLabel(state.profile)}; listings and searches ask for a choice again (or pass --domain or --all-domains).` : `No focus was saved for ${profileLabel(state.profile)}.`);
|
|
75068
|
+
}
|
|
75069
|
+
};
|
|
74754
75070
|
// src/oclif/function-deploy-wait.ts
|
|
74755
75071
|
function validateDeployWaitFlags(params) {
|
|
74756
75072
|
if (params.timeoutSeconds < 0) return "--timeout must be greater than or equal to 0.";
|
|
@@ -75902,8 +76218,8 @@ const PRIMITIVE_TEAM_AUTHOR = {
|
|
|
75902
76218
|
name: "Primitive Team",
|
|
75903
76219
|
url: "https://primitive.dev"
|
|
75904
76220
|
};
|
|
75905
|
-
const SDK_VERSION_RANGE = "^3.0.0-preview.
|
|
75906
|
-
const CLI_VERSION_RANGE = "^3.0.0-preview.
|
|
76221
|
+
const SDK_VERSION_RANGE = "^3.0.0-preview.19";
|
|
76222
|
+
const CLI_VERSION_RANGE = "^3.0.0-preview.19";
|
|
75907
76223
|
const ESBUILD_VERSION_RANGE = "^0.27.0";
|
|
75908
76224
|
function renderHandler() {
|
|
75909
76225
|
return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
|
|
@@ -77801,6 +78117,24 @@ const DEFAULT_API = {
|
|
|
77801
78117
|
listEmails
|
|
77802
78118
|
};
|
|
77803
78119
|
/**
|
|
78120
|
+
* The API with the domain focus's fields added to every listing. Reads by id
|
|
78121
|
+
* are left as they are.
|
|
78122
|
+
*/
|
|
78123
|
+
function focusedInboxApi(api, params) {
|
|
78124
|
+
const base = api ?? DEFAULT_API;
|
|
78125
|
+
if (Object.keys(params).length === 0) return base;
|
|
78126
|
+
return {
|
|
78127
|
+
...base,
|
|
78128
|
+
listEmails: ((input) => base.listEmails({
|
|
78129
|
+
...input,
|
|
78130
|
+
query: {
|
|
78131
|
+
...input?.query ?? {},
|
|
78132
|
+
...params
|
|
78133
|
+
}
|
|
78134
|
+
}))
|
|
78135
|
+
};
|
|
78136
|
+
}
|
|
78137
|
+
/**
|
|
77804
78138
|
* The API for a wait: a rate limit, gateway failure or network error backs
|
|
77805
78139
|
* off and reads again until the deadline (null: no deadline), then throws
|
|
77806
78140
|
* WaitDeadlineReached. These are all reads, so a retry repeats nothing.
|
|
@@ -78199,7 +78533,8 @@ var InboxNextCommand = class InboxNextCommand extends Command {
|
|
|
78199
78533
|
description: `Only with --wait: seconds to wait before exiting 5 (default ${DEFAULT_WAIT_TIMEOUT_SECONDS}); 0 waits forever. Ignored without --wait.`,
|
|
78200
78534
|
min: 0
|
|
78201
78535
|
}),
|
|
78202
|
-
"include-automated": Flags.boolean({ description: "Do not skip automated mail (bounces, mailer-daemon, own addresses, reports, Auto-Submitted, bulk and list mail): drops the server-side `automated=false` filter." })
|
|
78536
|
+
"include-automated": Flags.boolean({ description: "Do not skip automated mail (bounces, mailer-daemon, own addresses, reports, Auto-Submitted, bulk and list mail): drops the server-side `automated=false` filter." }),
|
|
78537
|
+
...focusFlags()
|
|
78203
78538
|
};
|
|
78204
78539
|
async run() {
|
|
78205
78540
|
const { flags } = await this.parse(InboxNextCommand);
|
|
@@ -78234,7 +78569,19 @@ var InboxNextCommand = class InboxNextCommand extends Command {
|
|
|
78234
78569
|
process.exitCode = INBOX_NEXT_EXIT_CODES.error;
|
|
78235
78570
|
};
|
|
78236
78571
|
const deadline = flags.wait && flags.timeout > 0 ? Date.now() + flags.timeout * 1e3 : null;
|
|
78237
|
-
const
|
|
78572
|
+
const focus = await resolveFocus({
|
|
78573
|
+
surface: "inbound",
|
|
78574
|
+
configDir: this.config.configDir,
|
|
78575
|
+
auth,
|
|
78576
|
+
client: apiClient.client,
|
|
78577
|
+
flags: focusFlagValues(flags)
|
|
78578
|
+
});
|
|
78579
|
+
writeFocusLine(focus, flags.json);
|
|
78580
|
+
const api = focus.focused ? focusedInboxApi(flags.wait ? waitingInboxApi(deadline) : void 0, focus.params) : flags.wait ? waitingInboxApi(deadline) : void 0;
|
|
78581
|
+
const print = (result) => this.printResult(result, bin, flags, apiClient, {
|
|
78582
|
+
api,
|
|
78583
|
+
focus
|
|
78584
|
+
});
|
|
78238
78585
|
try {
|
|
78239
78586
|
let since = flags.wait ? await baselineCursor({
|
|
78240
78587
|
apiClient,
|
|
@@ -78248,12 +78595,12 @@ var InboxNextCommand = class InboxNextCommand extends Command {
|
|
|
78248
78595
|
includeAutomated: flags["include-automated"]
|
|
78249
78596
|
});
|
|
78250
78597
|
if (result.outcome === "email" || !flags.wait || since === null) {
|
|
78251
|
-
await
|
|
78598
|
+
await print(result);
|
|
78252
78599
|
return;
|
|
78253
78600
|
}
|
|
78254
78601
|
const remainingMs = deadline === null ? MAX_LONG_POLL_SECONDS$1 * 1e3 : deadline - Date.now();
|
|
78255
78602
|
if (remainingMs <= 0) {
|
|
78256
|
-
await
|
|
78603
|
+
await print(result);
|
|
78257
78604
|
return;
|
|
78258
78605
|
}
|
|
78259
78606
|
if (!announcedWait && !flags.json) {
|
|
@@ -78276,10 +78623,10 @@ var InboxNextCommand = class InboxNextCommand extends Command {
|
|
|
78276
78623
|
}
|
|
78277
78624
|
} catch (error) {
|
|
78278
78625
|
if (error instanceof WaitDeadlineReached) {
|
|
78279
|
-
await
|
|
78626
|
+
await print({
|
|
78280
78627
|
outcome: "empty",
|
|
78281
78628
|
automated_awaiting: null
|
|
78282
|
-
}
|
|
78629
|
+
});
|
|
78283
78630
|
return;
|
|
78284
78631
|
}
|
|
78285
78632
|
if (error instanceof ReplyStateUnsupportedError || error instanceof AutomatedFilterUnsupportedError) {
|
|
@@ -78295,24 +78642,49 @@ var InboxNextCommand = class InboxNextCommand extends Command {
|
|
|
78295
78642
|
throw error;
|
|
78296
78643
|
}
|
|
78297
78644
|
}
|
|
78298
|
-
async printResult(found, bin, flags, apiClient) {
|
|
78645
|
+
async printResult(found, bin, flags, apiClient, scope = { focus: NO_FOCUS }) {
|
|
78299
78646
|
let result = found;
|
|
78300
78647
|
if (found.outcome === "empty" && !flags["include-automated"]) try {
|
|
78301
78648
|
result = {
|
|
78302
78649
|
...found,
|
|
78303
|
-
automated_awaiting: await countAutomatedAwaiting({
|
|
78650
|
+
automated_awaiting: await countAutomatedAwaiting({
|
|
78651
|
+
apiClient,
|
|
78652
|
+
api: scope.focus.focused ? focusedInboxApi(void 0, scope.focus.params) : void 0
|
|
78653
|
+
})
|
|
78304
78654
|
};
|
|
78305
78655
|
} catch (error) {
|
|
78306
78656
|
const detail = error instanceof Error ? error.message : String(error);
|
|
78307
78657
|
process.stderr.write(`Could not count automated mail awaiting a reply (${detail}); \`automated_awaiting\` is null.\n`);
|
|
78308
78658
|
}
|
|
78309
|
-
|
|
78310
|
-
|
|
78659
|
+
const elsewhere = result.outcome === "empty" ? await focusEmptyHint(scope.focus, async () => {
|
|
78660
|
+
const query = {
|
|
78661
|
+
awaiting: "you",
|
|
78662
|
+
exclude_fyi: "true",
|
|
78663
|
+
...flags["include-automated"] ? {} : { automated: "false" },
|
|
78664
|
+
limit: 1,
|
|
78665
|
+
count: "true"
|
|
78666
|
+
};
|
|
78667
|
+
const counted = await listEmails({
|
|
78668
|
+
client: apiClient.client,
|
|
78669
|
+
query: withoutFocus(query, scope.focus),
|
|
78670
|
+
responseStyle: "fields"
|
|
78671
|
+
});
|
|
78672
|
+
return counted.error ? null : countFromMeta(counted.data, "upTo");
|
|
78673
|
+
}) : null;
|
|
78674
|
+
if (flags.json) {
|
|
78675
|
+
const document = toJson(result, bin);
|
|
78676
|
+
this.log(JSON.stringify({
|
|
78677
|
+
...document,
|
|
78678
|
+
...scope.focus.meta ? { meta: { focus: scope.focus.meta } } : {},
|
|
78679
|
+
...elsewhere ? { summary: elsewhere } : {}
|
|
78680
|
+
}, null, 2));
|
|
78681
|
+
} else if (result.outcome === "email") this.log(formatTranscript(result, bin));
|
|
78311
78682
|
else {
|
|
78312
78683
|
const pending = result.automated_awaiting;
|
|
78313
78684
|
const count = pending ? `${pending.total}${pending.capped ? "+" : ""}` : "";
|
|
78314
78685
|
const one = pending?.total === 1 && !pending.capped;
|
|
78315
78686
|
process.stderr.write(`Nothing awaits your reply.${pending && pending.total > 0 ? ` ${count} automated email${one ? "" : "s"} also await${one ? "s" : ""} a reply; pass --include-automated to see ${one ? "it" : "them"}.` : ""}\n`);
|
|
78687
|
+
if (elsewhere) process.stderr.write(`${elsewhere}\n`);
|
|
78316
78688
|
}
|
|
78317
78689
|
process.exitCode = result.outcome === "email" ? INBOX_NEXT_EXIT_CODES.email : INBOX_NEXT_EXIT_CODES.empty;
|
|
78318
78690
|
}
|
|
@@ -88429,7 +88801,8 @@ var SemanticSearchCommand = class SemanticSearchCommand extends Command {
|
|
|
88429
88801
|
}),
|
|
88430
88802
|
cursor: Flags.string({ description: "Opaque pagination cursor from a prior response's meta.cursor." }),
|
|
88431
88803
|
json: Flags.boolean({ description: "Print the raw response envelope as JSON on STDOUT instead of the text table." }),
|
|
88432
|
-
time: Flags.boolean({ description: TIME_FLAG_DESCRIPTION })
|
|
88804
|
+
time: Flags.boolean({ description: TIME_FLAG_DESCRIPTION }),
|
|
88805
|
+
...focusFlags(FOCUS_SERVER_SUPPORT.semantic === null)
|
|
88433
88806
|
};
|
|
88434
88807
|
async run() {
|
|
88435
88808
|
const { args, flags } = await this.parse(SemanticSearchCommand);
|
|
@@ -88439,9 +88812,18 @@ var SemanticSearchCommand = class SemanticSearchCommand extends Command {
|
|
|
88439
88812
|
apiBaseUrl: flags["api-base-url"],
|
|
88440
88813
|
configDir: this.config.configDir
|
|
88441
88814
|
});
|
|
88815
|
+
const focus = focusForCorpus(await resolveFocus({
|
|
88816
|
+
surface: "semantic",
|
|
88817
|
+
configDir: this.config.configDir,
|
|
88818
|
+
auth,
|
|
88819
|
+
client: apiClient.client,
|
|
88820
|
+
flags: focusFlagValues(flags)
|
|
88821
|
+
}), flags.corpus);
|
|
88822
|
+
writeFocusLine(focus, flags.json);
|
|
88442
88823
|
const result = await semanticSearch({
|
|
88443
88824
|
client: apiClient.client,
|
|
88444
88825
|
body: {
|
|
88826
|
+
...focus.params,
|
|
88445
88827
|
query: args.query,
|
|
88446
88828
|
mode: flags.mode,
|
|
88447
88829
|
...flags.corpus ? { corpus: flags.corpus } : {},
|
|
@@ -88465,13 +88847,19 @@ var SemanticSearchCommand = class SemanticSearchCommand extends Command {
|
|
|
88465
88847
|
return;
|
|
88466
88848
|
}
|
|
88467
88849
|
const envelope = result.data;
|
|
88850
|
+
const rows = envelope?.data ?? [];
|
|
88851
|
+
const elsewhere = rows.length === 0 && !flags.cursor ? await focusEmptyHint(focus, async () => null) : null;
|
|
88468
88852
|
if (flags.json) {
|
|
88469
|
-
|
|
88853
|
+
const document = withFocusMeta(envelope ?? null, focus);
|
|
88854
|
+
this.log(JSON.stringify(elsewhere && document ? {
|
|
88855
|
+
...document,
|
|
88856
|
+
summary: elsewhere
|
|
88857
|
+
} : document, null, 2));
|
|
88470
88858
|
return;
|
|
88471
88859
|
}
|
|
88472
|
-
const rows = envelope?.data ?? [];
|
|
88473
88860
|
if (rows.length === 0) {
|
|
88474
88861
|
process.stderr.write("No matching mail.\n");
|
|
88862
|
+
if (elsewhere) process.stderr.write(`${elsewhere}\n`);
|
|
88475
88863
|
return;
|
|
88476
88864
|
}
|
|
88477
88865
|
process.stderr.write(`${formatHeader()}\n`);
|
|
@@ -88490,7 +88878,6 @@ const LEXICAL_ONLY_FLAGS = [
|
|
|
88490
88878
|
"to",
|
|
88491
88879
|
"subject",
|
|
88492
88880
|
"body",
|
|
88493
|
-
"domain",
|
|
88494
88881
|
"domain-id",
|
|
88495
88882
|
"has-attachment",
|
|
88496
88883
|
"status",
|
|
@@ -88562,7 +88949,7 @@ var SearchCommand = class SearchCommand extends Command {
|
|
|
88562
88949
|
to: Flags.string({ description: "Lexical only. Filter by recipient address or recipient domain." }),
|
|
88563
88950
|
subject: Flags.string({ description: "Lexical only. Full-text search restricted to the subject." }),
|
|
88564
88951
|
body: Flags.string({ description: "Lexical only. Full-text search restricted to the parsed text body." }),
|
|
88565
|
-
|
|
88952
|
+
...focusFlags(),
|
|
88566
88953
|
"domain-id": Flags.string({ description: "Lexical only. Filter by domain ID." }),
|
|
88567
88954
|
"has-attachment": Flags.string({
|
|
88568
88955
|
description: "Lexical only. Filter by whether the email has one or more attachments.",
|
|
@@ -88649,9 +89036,18 @@ var SearchCommand = class SearchCommand extends Command {
|
|
|
88649
89036
|
process.exitCode = 2;
|
|
88650
89037
|
return;
|
|
88651
89038
|
}
|
|
89039
|
+
const focus = focusForCorpus(await resolveFocus({
|
|
89040
|
+
surface: "semantic",
|
|
89041
|
+
configDir: this.config.configDir,
|
|
89042
|
+
auth,
|
|
89043
|
+
client: apiClient.client,
|
|
89044
|
+
flags: focusFlagValues(flags)
|
|
89045
|
+
}), flags.corpus);
|
|
89046
|
+
writeFocusLine(focus, flags.json);
|
|
88652
89047
|
const result = await semanticSearch({
|
|
88653
89048
|
client: apiClient.client,
|
|
88654
89049
|
body: {
|
|
89050
|
+
...focus.params,
|
|
88655
89051
|
query: args.query,
|
|
88656
89052
|
mode: flags.mode,
|
|
88657
89053
|
...flags.corpus ? { corpus: flags.corpus } : {},
|
|
@@ -88667,13 +89063,19 @@ var SearchCommand = class SearchCommand extends Command {
|
|
|
88667
89063
|
return;
|
|
88668
89064
|
}
|
|
88669
89065
|
const envelope = result.data;
|
|
89066
|
+
const rows = envelope?.data ?? [];
|
|
89067
|
+
const elsewhere = rows.length === 0 && !flags.cursor ? await focusEmptyHint(focus, async () => null) : null;
|
|
88670
89068
|
if (flags.json) {
|
|
88671
|
-
|
|
89069
|
+
const document = withFocusMeta(envelope ?? null, focus);
|
|
89070
|
+
this.log(JSON.stringify(elsewhere && document ? {
|
|
89071
|
+
...document,
|
|
89072
|
+
summary: elsewhere
|
|
89073
|
+
} : document, null, 2));
|
|
88672
89074
|
return;
|
|
88673
89075
|
}
|
|
88674
|
-
const rows = envelope?.data ?? [];
|
|
88675
89076
|
if (rows.length === 0) {
|
|
88676
89077
|
process.stderr.write("No matching mail.\n");
|
|
89078
|
+
if (elsewhere) process.stderr.write(`${elsewhere}\n`);
|
|
88677
89079
|
return;
|
|
88678
89080
|
}
|
|
88679
89081
|
process.stderr.write(`${formatHeader()}\n`);
|
|
@@ -88687,8 +89089,17 @@ var SearchCommand = class SearchCommand extends Command {
|
|
|
88687
89089
|
process.exitCode = 2;
|
|
88688
89090
|
return;
|
|
88689
89091
|
}
|
|
89092
|
+
const focus = await resolveFocus({
|
|
89093
|
+
surface: "inbound",
|
|
89094
|
+
configDir: this.config.configDir,
|
|
89095
|
+
auth,
|
|
89096
|
+
client: apiClient.client,
|
|
89097
|
+
flags: focusFlagValues(flags),
|
|
89098
|
+
explicitScope: Boolean(flags["domain-id"] || flags.to || threadId) || queryScopesItself(args.query),
|
|
89099
|
+
conflictingFlag: flags["domain-id"] ? "--domain-id" : void 0
|
|
89100
|
+
});
|
|
88690
89101
|
const query = {
|
|
88691
|
-
q:
|
|
89102
|
+
q: args.query,
|
|
88692
89103
|
limit: flags.limit
|
|
88693
89104
|
};
|
|
88694
89105
|
const awaiting = flags.awaiting;
|
|
@@ -88698,7 +89109,7 @@ var SearchCommand = class SearchCommand extends Command {
|
|
|
88698
89109
|
if (flags.to) query.to = flags.to;
|
|
88699
89110
|
if (flags.subject) query.subject = flags.subject;
|
|
88700
89111
|
if (flags.body) query.body = flags.body;
|
|
88701
|
-
if (flags["domain-id"]) query.
|
|
89112
|
+
if (flags["domain-id"]) query.domain_ids = flags["domain-id"];
|
|
88702
89113
|
if (flags["has-attachment"]) query.has_attachment = flags["has-attachment"];
|
|
88703
89114
|
if (flags.status) query.status = flags.status;
|
|
88704
89115
|
if (flags.sort) query.sort = flags.sort;
|
|
@@ -88710,6 +89121,7 @@ var SearchCommand = class SearchCommand extends Command {
|
|
|
88710
89121
|
if (threadId) query.thread_id = threadId;
|
|
88711
89122
|
if (flags.prefix) query.prefix = "true";
|
|
88712
89123
|
if (flags.count === false) query.count = "false";
|
|
89124
|
+
Object.assign(query, focus.params);
|
|
88713
89125
|
const result = await searchEmails({
|
|
88714
89126
|
client: apiClient.client,
|
|
88715
89127
|
query,
|
|
@@ -88734,13 +89146,32 @@ var SearchCommand = class SearchCommand extends Command {
|
|
|
88734
89146
|
process.exitCode = 1;
|
|
88735
89147
|
return;
|
|
88736
89148
|
}
|
|
89149
|
+
const rows = envelope?.data ?? [];
|
|
89150
|
+
const elsewhere = rows.length === 0 && !flags.cursor ? await focusEmptyHint(focus, async () => {
|
|
89151
|
+
const counted = await searchEmails({
|
|
89152
|
+
client: apiClient.client,
|
|
89153
|
+
query: {
|
|
89154
|
+
...withoutFocus(query, focus),
|
|
89155
|
+
limit: 1,
|
|
89156
|
+
count: "true"
|
|
89157
|
+
},
|
|
89158
|
+
responseStyle: "fields"
|
|
89159
|
+
});
|
|
89160
|
+
return counted.error ? null : countFromMeta(counted.data);
|
|
89161
|
+
}) : null;
|
|
88737
89162
|
if (flags.json) {
|
|
88738
|
-
|
|
89163
|
+
const document = withFocusMeta(envelope ?? null, focus);
|
|
89164
|
+
this.log(JSON.stringify(elsewhere && document && typeof document === "object" ? {
|
|
89165
|
+
...document,
|
|
89166
|
+
summary: elsewhere
|
|
89167
|
+
} : document, null, 2));
|
|
88739
89168
|
return;
|
|
88740
89169
|
}
|
|
88741
|
-
|
|
88742
|
-
if (rows.length === 0)
|
|
88743
|
-
|
|
89170
|
+
writeFocusLine(focus, false);
|
|
89171
|
+
if (rows.length === 0) {
|
|
89172
|
+
process.stderr.write("No matching mail.\n");
|
|
89173
|
+
if (elsewhere) process.stderr.write(`${elsewhere}\n`);
|
|
89174
|
+
} else {
|
|
88744
89175
|
const idWidth = pickIdWidth(Boolean(process.stdout.isTTY));
|
|
88745
89176
|
process.stderr.write(`${formatHeader$1(idWidth)}\n`);
|
|
88746
89177
|
for (const row of rows) this.log(formatRow$1(row, idWidth));
|
|
@@ -91746,6 +92177,9 @@ const COMMANDS = {
|
|
|
91746
92177
|
"machine:doctor": MachineDoctorCommand,
|
|
91747
92178
|
"skills:install": SkillsInstallCommand,
|
|
91748
92179
|
"emails:latest": EmailsLatestCommand,
|
|
92180
|
+
focus: FocusCommand,
|
|
92181
|
+
"focus:set": FocusSetCommand,
|
|
92182
|
+
"focus:clear": FocusClearCommand,
|
|
91749
92183
|
"emails:attachment": EmailsAttachmentCommand,
|
|
91750
92184
|
"emails:attachment-members": EmailsAttachmentMembersCommand,
|
|
91751
92185
|
"emails:facts": EmailsFactsCommand,
|