primcli 3.0.0-preview.21 → 3.0.0-preview.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- import { $t as queryScopesItself, A as displayAddress, An as revokeUserLogin, B as wakeRelationship, Bt as FOCUS_SERVER_SUPPORT, C as canOfferCopyHotkey, Cn as selectedOrgFromEnv, Ct as sentHistoryWindowStart, D as explainPendingMailNotFound, Dn as displayedRoleKey, E as openBrowser, En as credentialsFromUserLogin, Et as thrownErrorExitCode, F as serverMuted, Fn as sanitizeForTerminal, Ft as detectAgentRuntime, G as readPendingMail, Gt as focusFlags, H as clearConsumedPendingMail, Ht as countFromMeta, I as serverRelationship, In as shownLine, It as detectRuntimeSession, J as interactionHumanLine, Jt as joinNames, K as recordPendingMail, Kt as focusForCorpus, Ln as setKnownCommands, Lt as runtimeSessionVariableList, M as latestOwnOutbound, Mn as roleKeyText, Mt as identitySuggestions, N as readThreadContext, Nn as switchCurrentOrg, Nt as loadSkillLine, O as bareAddress, On as fetchCliOrgs, Ot as cliInvocation, P as sentInThread, Pn as routeWarningLines, Pt as currentMailSessionKey, Q as replyInteractionWarning, Qt as oneDomainAtATimeError, R as wakeReadCommand, Rn as operationManifest, Rt as formatAlreadySentNotice, S as withApproval, Sn as resolveCliApiRequestConfig, St as sendWaitClampNotice, T as listenForCopyHotkey, Tn as RESTRICTED_ROLE_NOTE, Tt as successfulSendOutcome, U as clearReadPendingMail, Ut as focusEmptyHint, V as claimPendingMail, Vt as NO_FOCUS, W as pendingMailPath, Wt as focusFlagValues, X as readEmailInteraction, Xt as manyDomainsSupported, Y as interactionNextActions, Yt as loadSavedFocus, Z as replyExpectation, Zt as normalizeDomainNames, _ as STEP_UP_HEADER$1, _t as priorRepliesThatWentOut, a as extractErrorCode, an as withoutFocus, at as buildFollowUpCommand, b as promptLine$2, bn as refreshStoredCliCredentials, bt as sendIdentityFields, c as hasControlCharacter$1, cn as emptyEmailListHint, ct as classifySendError, d as readTextFileFlag, dn as formatFact, dt as followUpCommandPrefix, en as readReadableDomains, et as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, f as refusesCredential, fn as isEmailId, ft as formatDeletedEarlierSendNotice, g as BROWSER_FLAG_DESCRIPTION, gn as ConnectedAgentKeyRequiredError, gt as formatSendRecordFailureSummary, h as writeErrorWithHints, hn as withAttachmentWait, ht as formatSendFailureSummary, i as createOperationCommand, in as withFocusMeta, it as assertValidIdempotencyKey, j as formatMailWakeLine, jn as roleKeyLabel, jt as generatedAgentName, k as describeWake, kn as isBuiltInRoleKey, kt as connectNextSteps, l as isGrantRefusal, ln as mailReach, lt as deriveSendIdempotencyKey, m as surfaceUnauthorizedHint, mn as ATTACHMENT_WAIT_MAX_MS, mt as formatPriorRepliesWarning, n as API_ERROR_CODES, nn as resolveFocus, nt as SEND_OUTCOME_HELP, o as extractErrorPayload, on as writeFocusLine, ot as buildThrownSendFailureEnvelope, p as runWithTiming, pn as ATTACHMENT_WAIT_FLAG_DESCRIPTION, pt as formatPriorRepliesCheckSkipped, q as removePendingMail, qt as focusProfile, r as TIME_FLAG_DESCRIPTION, rn as saveFocus, rt as apiResultHttpStatus, s as formatErrorPayload, sn as withFlagSuggestion, st as checkPriorReplies, t as API_BASE_URL_FLAG_DESCRIPTION, tn as resolveDomainNames, tt as MAX_SEND_WAIT_TIMEOUT_MS, u as networkErrorHint, un as readCallerMailFor, ut as excludeSignalReplies, v as STEP_UP_TOKEN_FLAG_DESCRIPTION, vn as createAuthenticatedCliApiClient, vt as reportSendCommandResult, w as formatBrowserLoginInstructions, wn as CliOrgRefusedError, wt as serializeErrorPayload, x as terminalApprovalIo, xn as refuseOrgSelectionForProfile, xt as sendOutcomeExitCode, y as approveThenRerunHint, yn as createCliApiClient, yt as sendErrorMessage, z as wakeRecipientField, zt as FOCUS_ENV } from "../api-command-Bab30eNp.js";
2
- import { a as canonicalCommands, c as retiredCommandTarget, i as canonicalCommandId, o as canonicalOperation, s as operationCommandId, t as COMMAND_RENAMES } from "../cli-command-names-BYbYdipl.js";
1
+ import { $ as replyInteractionWarning, $t as oneDomainAtATimeError, A as describeWake, An as displayedRoleKey, At as connectNextSteps, B as wakeRecipientField, Bn as setKnownCommands, Bt as FOCUS_ENV, C as withApproval, Cn as refreshStoredCliCredentials, Ct as sendWaitClampNotice, D as openBrowser, Dn as CliOrgRefusedError, Dt as thrownErrorExitCode, E as listenForCopyHotkey, En as selectedOrgFromEnv, Et as successfulSendOutcome, F as sentInThread, Fn as roleKeyText, Ft as currentMailSessionKey, G as pendingMailPath, Gt as focusFlagValues, H as claimPendingMail, Ht as NO_FOCUS, I as serverMuted, In as switchCurrentOrg, It as detectAgentRuntime, J as removePendingMail, Jt as focusProfile, K as readPendingMail, Kt as focusFlags, L as serverRelationship, Ln as routeWarningLines, Lt as detectRuntimeSession, M as formatMailWakeLine, Mn as isBuiltInRoleKey, Mt as generatedAgentName, N as latestOwnOutbound, Nn as revokeUserLogin, Nt as identitySuggestions, O as explainPendingMailNotFound, On as RESTRICTED_ROLE_NOTE, P as readThreadContext, Pn as roleKeyLabel, Pt as loadSkillLine, Q as replyExpectation, Qt as normalizeDomainNames, Rn as sanitizeForTerminal, Rt as runtimeSessionVariableList, S as terminalApprovalIo, Sn as createCliApiClient, St as sendOutcomeExitCode, T as formatBrowserLoginInstructions, Tn as resolveCliApiRequestConfig, Tt as serializeErrorPayload, U as clearConsumedPendingMail, Ut as countFromMeta, V as wakeRelationship, Vn as operationManifest, Vt as FOCUS_SERVER_SUPPORT, W as clearReadPendingMail, Wt as focusEmptyHint, X as interactionNextActions, Xt as loadSavedFocus, Y as interactionHumanLine, Yt as joinNames, Z as readEmailInteraction, Zt as manyDomainsSupported, _ as BROWSER_FLAG_DESCRIPTION, _n as ATTACHMENT_WAIT_MAX_MS, _t as formatSendRecordFailureSummary, a as createOperationCommand, an as withFocusMeta, at as assertValidIdempotencyKey, b as approveThenRerunHint, bt as sendErrorMessage, c as formatErrorPayload, cn as withFlagSuggestion, ct as checkPriorReplies, d as networkErrorHint, dn as readCallerMailFor, dt as excludeSignalReplies, en as queryScopesItself, f as readTextFileFlag, fn as formatFact, ft as followUpCommandPrefix, g as writeErrorWithHints, gn as ATTACHMENT_WAIT_FLAG_DESCRIPTION, gt as formatSendFailureSummary, h as surfaceUnauthorizedHint, hn as withBooleanFlagValues, ht as formatPriorRepliesWarning, i as TIME_FLAG_DESCRIPTION, in as saveFocus, it as apiResultHttpStatus, j as displayAddress, jn as fetchCliOrgs, k as bareAddress, kn as credentialsFromUserLogin, kt as cliInvocation, l as hasControlCharacter$1, ln as emptyEmailListHint, lt as classifySendError, m as runWithTiming, mn as fetchBoundedPages, mt as formatPriorRepliesCheckSkipped, n as API_ERROR_CODES, nn as resolveDomainNames, nt as MAX_SEND_WAIT_TIMEOUT_MS, o as extractErrorCode, on as withoutFocus, ot as buildFollowUpCommand, p as refusesCredential, pn as isEmailId, pt as formatDeletedEarlierSendNotice, q as recordPendingMail, qt as focusForCorpus, r as PAGED_LIMIT_MAX, rn as resolveFocus, rt as SEND_OUTCOME_HELP, s as extractErrorPayload, sn as writeFocusLine, st as buildThrownSendFailureEnvelope, t as API_BASE_URL_FLAG_DESCRIPTION, tn as readDomainsOrRefusal, tt as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, u as isGrantRefusal, un as mailReach, ut as deriveSendIdempotencyKey, v as STEP_UP_HEADER$1, vn as withAttachmentWait, vt as priorRepliesThatWentOut, w as canOfferCopyHotkey, wn as refuseOrgSelectionForProfile, wt as sentHistoryWindowStart, x as promptLine$2, xn as createAuthenticatedCliApiClient, xt as sendIdentityFields, y as STEP_UP_TOKEN_FLAG_DESCRIPTION, yn as ConnectedAgentKeyRequiredError, yt as reportSendCommandResult, z as wakeReadCommand, zn as shownLine, zt as formatAlreadySentNotice } from "../api-command-Dm1BKxOr.js";
2
+ import { a as canonicalCommandId, c as operationCommandId, i as canonicalCliText, l as retiredCommandTarget, n as COMMAND_RENAMES, o as canonicalCommands, s as canonicalOperation, t as COMMAND_PAIR_RENAMES } from "../cli-command-names-DteMqL-H.js";
3
3
  import { ignoreArgumentStdin } from "./command-stdin.js";
4
- import { $ as AUTOMATED_VALUES, $n as stopRepeatFromEmail, $t as getThread, A as collectNewAcceptedEmails, At as downloadSentAttachmentArchiveMember, B as REPLY_STATE_UNSUPPORTED_CODE, Bn as runWakeSchedule, Cn as listSentAttachmentArchiveMembers, Ct as deleteMemory, D as transientFailure, Dn as listWakeSchedules, Dt as downloadEmailAttachmentArchiveMember, E as retryingOperation, En as listWakeDispatches, Et as deleteWakeSchedule, F as lateMailReread, Fn as reorderRoutes, G as formatAwaitingCell, Gn as sendEmail, Gt as getKey, H as assertAwaitingFilterRows, Hn as searchEmails, Ht as getFunctionRouting, I as sinceFromFlags, In as replyToEmail, It as getConversation, J as isAwaitingRejectedError, Jn as setMemory, Jt as getOutboundStatus, K as formatRepliesCell, Kn as setFunctionRoute, Kt as getMemory, L as sleep$3, Ln as resendAgentSignupVerification, Lt as getCreditBalance, M as encodeReceivedAtSearchCursor, Mt as getAccessMode, N as fetchEmailSearchPage, Nn as redeemCreditCode, Nt as getAccount, O as waitOutRetryAfter, On as pollCliLogin, Ot as downloadEmailAttachmentByFilename, P as filtersFromFlags, Pn as removeDefaultNetworkMember, Pt as getAgentContactPolicy, Q as AUTOMATED_FLAG_DESCRIPTION, Qn as startCliLogin, Qt as getSentEmail, R as AWAITING_FLAG_DESCRIPTION, Rn as revokeCredential, Rt as getDefaultNetworkAgent, S as describeApiFailure, Sn as listRoutes, T as retryTransient, Tn as listWakeAuthorizations, Tt as deleteWakeAuthorization, U as awaitingRejectedError, Un as searchMemories, Ut as getFunctionTestRunTrace, V as ReplyStateUnsupportedError, Vt as getFunction, W as ensureSearchReportsReplyState, Wn as semanticSearch, Wt as getInboxStatus, Xn as startAgentClaim, Xt as getRepeatingSend, Y as queryUsesAwaiting, Yn as simulateRoute, Yt as getOwnGrant, Z as AUTOMATED_FILTER_UNSUPPORTED_CODE, Zn as startAgentSignup, Zt as getSendFrom, _n as listKeys, _t as createKey, a as REPEAT_IDLE_MAX_MINUTES, an as listAgentContacts, ar as updateRepeatingSend, b as WaitDeadlineReached, bn as listRepeatingSends, bt as createWakeSchedule, cn as listDefaultNetworkAgents, cr as updateWakeSchedule, ct as addDefaultNetworkMember, d as parseRepeatTick, dn as listEmailAttachmentArchiveMembers, dr as whoami, dt as checkDefaultNetworkContactAdmission, en as getWakeSchedule, er as testFunction, et as AutomatedFilterUnsupportedError, f as preparePresenceAliveEmail, fn as listEmails, ft as checkSendability, g as isEmailReceivedEvent, gn as listGroups, gt as createFunction, hn as listFunctions, ht as createEndpoint, i as REPEAT_EVERY_MAX_MINUTES, ir as updateKey, j as cursorFromAcceptedRows, jt as downloadSentAttachmentByFilename, k as SINCE_VALUE_HELP, kn as pullWebhookEvent, l as parseInteractionEnvelope, ln as listDefaultNetworkMembers, lr as verifyAgentClaim, lt as cancelSentEmail, m as repeatStopCommand, mn as listFunctionLogs, mt as completeWebhookEvent, nn as leaveOrganization, nr as updateDefaultNetworkMember, nt as automatedRejectedError, o as REPEAT_MAX_SENDS_MAX, on as listAgentNetworks, or as updateRoute, ot as hasAutomatedVerdict, p as prepareSignalEmail, pn as listEndpoints, pt as cliLogout, q as hasReplyState, qn as setFunctionSecret, qt as getOrgRoutingTopology, rn as listActivityObjects, rr as updateFunction, s as buildRepeatStopBody, sr as updateWakeAuthorization, st as isAutomatedRejectedError, tr as unsetFunctionRoute, tt as assertAutomatedVerdict, u as parsePresenceEnvelope, un as listDomains, ur as verifyAgentSignup, ut as cancelSentEmailByIdempotencyKey, v as parseWebhookEvent, vn as listMailboxAccess, vt as createRoute, w as pauseForTransientFailure, wn as listSentEmails, wt as deleteRoute, x as backoffDelay, xn as listRoles, y as parseFromHeader, yn as listOrganizationPeople, yt as createWakeAuthorization, z as AWAITING_VALUES, zn as rotateKey, zt as getEmail } from "../repeats-Dj_o6c-X-CraZzs4t.js";
5
- 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-BRK9_xSb.js";
4
+ import { a as runStreamingJson, i as jsonOutputRequested, n as captureOutput, o as thrownErrorBody, r as guardJsonOutputCommands, t as JSON_OUTPUT_FLAG } from "../json-output-BMZrLH47.js";
5
+ import { $ as AUTOMATED_VALUES, $n as stopRepeatFromEmail, $t as getThread, A as collectNewAcceptedEmails, At as downloadSentAttachmentArchiveMember, B as REPLY_STATE_UNSUPPORTED_CODE, Bn as runWakeSchedule, Cn as listSentAttachmentArchiveMembers, Ct as deleteMemory, D as transientFailure, Dn as listWakeSchedules, Dt as downloadEmailAttachmentArchiveMember, E as retryingOperation, En as listWakeDispatches, Et as deleteWakeSchedule, F as lateMailReread, Fn as reorderRoutes, G as formatAwaitingCell, Gn as sendEmail, Gt as getKey, H as assertAwaitingFilterRows, Hn as searchEmails, Ht as getFunctionRouting, I as sinceFromFlags, In as replyToEmail, It as getConversation, J as isAwaitingRejectedError, Jn as setMemory, Jt as getOutboundStatus, K as formatRepliesCell, Kn as setFunctionRoute, Kt as getMemory, L as sleep$3, Ln as resendAgentSignupVerification, Lt as getCreditBalance, M as encodeReceivedAtSearchCursor, Mt as getAccessMode, N as fetchEmailSearchPage, Nn as redeemCreditCode, Nt as getAccount, O as waitOutRetryAfter, On as pollCliLogin, Ot as downloadEmailAttachmentByFilename, P as filtersFromFlags, Pn as removeDefaultNetworkMember, Pt as getAgentContactPolicy, Q as AUTOMATED_FLAG_DESCRIPTION, Qn as startCliLogin, Qt as getSentEmail, R as AWAITING_FLAG_DESCRIPTION, Rn as revokeCredential, Rt as getDefaultNetworkAgent, S as describeApiFailure, Sn as listRoutes, T as retryTransient, Tn as listWakeAuthorizations, Tt as deleteWakeAuthorization, U as awaitingRejectedError, Un as searchMemories, Ut as getFunctionTestRunTrace, V as ReplyStateUnsupportedError, Vt as getFunction, W as ensureSearchReportsReplyState, Wn as semanticSearch, Wt as getInboxStatus, Xn as startAgentClaim, Xt as getRepeatingSend, Y as queryUsesAwaiting, Yn as simulateRoute, Yt as getOwnGrant, Z as AUTOMATED_FILTER_UNSUPPORTED_CODE, Zn as startAgentSignup, Zt as getSendFrom, _n as listKeys, _t as createKey, a as REPEAT_IDLE_MAX_MINUTES, an as listAgentContacts, ar as updateRepeatingSend, b as WaitDeadlineReached, bn as listRepeatingSends, bt as createWakeSchedule, cn as listDefaultNetworkAgents, cr as updateWakeSchedule, ct as addDefaultNetworkMember, d as parseRepeatTick, dn as listEmailAttachmentArchiveMembers, dr as whoami, dt as checkDefaultNetworkContactAdmission, en as getWakeSchedule, er as testFunction, et as AutomatedFilterUnsupportedError, f as preparePresenceAliveEmail, fn as listEmails, ft as checkSendability, g as isEmailReceivedEvent, gn as listGroups, gt as createFunction, hn as listFunctions, ht as createEndpoint, i as REPEAT_EVERY_MAX_MINUTES, ir as updateKey, j as cursorFromAcceptedRows, jt as downloadSentAttachmentByFilename, k as SINCE_VALUE_HELP, kn as pullWebhookEvent, l as parseInteractionEnvelope, ln as listDefaultNetworkMembers, lr as verifyAgentClaim, lt as cancelSentEmail, m as repeatStopCommand, mn as listFunctionLogs, mt as completeWebhookEvent, nn as leaveOrganization, nr as updateDefaultNetworkMember, nt as automatedRejectedError, o as REPEAT_MAX_SENDS_MAX, on as listAgentNetworks, or as updateRoute, ot as hasAutomatedVerdict, p as prepareSignalEmail, pn as listEndpoints, pt as cliLogout, q as hasReplyState, qn as setFunctionSecret, qt as getOrgRoutingTopology, rn as listActivityObjects, rr as updateFunction, s as buildRepeatStopBody, sr as updateWakeAuthorization, st as isAutomatedRejectedError, tr as unsetFunctionRoute, tt as assertAutomatedVerdict, u as parsePresenceEnvelope, un as listDomains, ur as verifyAgentSignup, ut as cancelSentEmailByIdempotencyKey, v as parseWebhookEvent, vn as listMailboxAccess, vt as createRoute, w as pauseForTransientFailure, wn as listSentEmails, wt as deleteRoute, x as backoffDelay, xn as listRoles, y as parseFromHeader, yn as listOrganizationPeople, yt as createWakeAuthorization, z as AWAITING_VALUES, zn as rotateKey, zt as getEmail } from "../repeats-Dj_o6c-X-x61TNLz-.js";
6
+ 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-DHQbjXOq.js";
6
7
  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";
7
8
  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";
8
- 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-cfgMKQ_U.js";
9
- 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-YucNhX6U.js";
9
+ 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-DPLiLNot.js";
10
+ 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-Bss3OjFI.js";
10
11
  import { autoSignalEligible, dispatchAutoRead, dispatchAutoWorking, haltAutoWorking, isSentSignal, readWorkingLease, restoreAutoWorking } from "./auto-signals.js";
11
- 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-AOnn_Him.js";
12
- import { a as thrownErrorBody, i as runStreamingJson, n as guardJsonOutputCommands, r as jsonOutputRequested, t as JSON_OUTPUT_FLAG } from "../json-output-xgN0ZLWP.js";
12
+ 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-vIo4maG0.js";
13
13
  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";
14
14
  import { ORG_SELECTION_ENV } from "./global-org-flag.js";
15
15
  import { n as createConfig, t as createClient } from "../client.gen-6rZvmHfx.js";
@@ -70,6 +70,173 @@ const CLI_OMITTED_OPERATION_IDS = /* @__PURE__ */ new Set([
70
70
  const rawCliOperationManifest = operationManifest.filter((operation) => !CLI_OMITTED_OPERATION_IDS.has(`${operation.tagCommand}:${operation.command}`));
71
71
  /** CLI presentation names; the SDK manifest above retains its API identity. */
72
72
  const cliOperationManifest = rawCliOperationManifest.map(canonicalOperation);
73
+ // src/oclif/command-pairs.ts
74
+ function flagsOf(command) {
75
+ return {
76
+ ...command.flags,
77
+ ...command.enableJsonFlag ? { json: JSON_OUTPUT_FLAG } : {}
78
+ };
79
+ }
80
+ function booleanFlag(flag) {
81
+ return flag?.type === "boolean" || flag?.options?.length === 2 && flag.options.includes("true") && flag.options.includes("false");
82
+ }
83
+ function delegateArgv(command, values, names, args) {
84
+ const definitions = flagsOf(command);
85
+ const argv = [];
86
+ for (const name of names) {
87
+ if (name === "json" && definitions[name] === void 0) continue;
88
+ const value = values[name];
89
+ if (value === void 0) continue;
90
+ const definition = definitions[name];
91
+ for (const item of Array.isArray(value) ? value : [value]) if (definition?.type === "boolean") argv.push(item === false ? `--no-${name}` : `--${name}`);
92
+ else argv.push(`--${name}=${String(item)}`);
93
+ }
94
+ const positional = Object.keys(command.args ?? {}).flatMap((name) => args[name] === void 0 ? [] : [String(args[name])]);
95
+ if (positional.length) argv.push("--", ...positional);
96
+ return argv;
97
+ }
98
+ /** One path with task inputs and structured request inputs, never two aliases. */
99
+ function combineCommandPair(task, request, options = {}) {
100
+ ignoreArgumentStdin(task);
101
+ ignoreArgumentStdin(request);
102
+ const taskFlags = flagsOf(task);
103
+ const requestFlags = flagsOf(request);
104
+ const flags = {};
105
+ for (const [name, flag] of Object.entries({
106
+ ...requestFlags,
107
+ ...taskFlags
108
+ })) {
109
+ const a = taskFlags[name];
110
+ const b = requestFlags[name];
111
+ flags[name] = {
112
+ ...flag,
113
+ required: false,
114
+ default: a && b ? void 0 : flag.default,
115
+ ...booleanFlag(a) && booleanFlag(b) ? {
116
+ type: "boolean",
117
+ allowNo: a?.allowNo || b?.allowNo || a?.type !== b?.type
118
+ } : {},
119
+ ...typeof a?.max === "number" && typeof b?.max === "number" ? { max: Math.max(a.max, b.max) } : {}
120
+ };
121
+ if (flags[name]?.type === "boolean") delete flags[name].options;
122
+ }
123
+ const taskArgs = task.args ?? {};
124
+ const requestArgs = request.args ?? {};
125
+ const args = Object.fromEntries(Object.entries(Object.keys(taskArgs).length ? taskArgs : requestArgs).map(([name, argument]) => [name, {
126
+ ...argument,
127
+ required: false,
128
+ ignoreStdin: true
129
+ }]));
130
+ const parseFlags = Object.fromEntries(Object.entries(flags).map(([name, flag]) => {
131
+ const neutral = {
132
+ ...flag,
133
+ parse: async (value) => value
134
+ };
135
+ for (const key of [
136
+ "required",
137
+ "default",
138
+ "exclusive",
139
+ "exactlyOne",
140
+ "atLeastOne",
141
+ "dependsOn",
142
+ "relationships",
143
+ "min",
144
+ "max",
145
+ "options"
146
+ ]) delete neutral[key];
147
+ return [name, neutral];
148
+ }));
149
+ const requestHelp = request.helpInputs;
150
+ const requiredTaskFlags = Object.keys(taskFlags).filter((name) => taskFlags[name]?.required);
151
+ const taskInput = [...Object.keys(taskArgs).filter((name) => taskArgs[name]?.required).map((name) => `<${name}>`), ...requiredTaskFlags.map((name) => `--${name}`)].join(" ");
152
+ class CombinedCommand extends Command {
153
+ static pairedCommand = true;
154
+ static summary = options.storedRedeploy ? request.summary : task.summary ?? request.summary;
155
+ static description = canonicalCliText(`${options.storedRedeploy ? "Redeploy the function's stored source, or pass --file to upload a new bundle with the existing secret and deployment-wait options.\n\n" : ""}${task.description ?? ""}\n\n${taskInput ? `Readable input form: ${taskInput}. Alternatively, use the request fields below or JSON.\n\n` : ""}Inputs exclusive to the readable form cannot be mixed with request-only fields. With --json, the result is in data and existing pagination metadata is preserved.\n\n${request.description ?? ""}`);
156
+ static helpInputs = {
157
+ requiredFlags: [.../* @__PURE__ */ new Set([...requiredTaskFlags, ...requestHelp?.requiredFlags ?? []])],
158
+ requiredJsonFields: requestHelp?.requiredJsonFields ?? []
159
+ };
160
+ static examples = task.examples?.map((example) => typeof example === "string" ? canonicalCliText(example) : {
161
+ ...example,
162
+ command: canonicalCliText(example.command)
163
+ });
164
+ static flags = flags;
165
+ static args = args;
166
+ async run() {
167
+ const argv = withBooleanFlagValues(this.argv, flags);
168
+ const parsed = await this.parse({
169
+ flags: parseFlags,
170
+ args,
171
+ strict: true
172
+ }, argv).catch((error) => {
173
+ throw withFlagSuggestion(error, Object.keys(flags));
174
+ });
175
+ const values = parsed.flags;
176
+ const givenFlags = new Set(parsed.raw.flatMap((token) => token.type === "flag" ? [token.flag] : []));
177
+ const suppliedArgs = Object.entries(parsed.args).filter(([, value]) => value !== void 0);
178
+ const requestOnly = Object.keys(requestFlags).filter((name) => name !== "json" && !(name in taskFlags) && givenFlags.has(name));
179
+ const taskOnly = Object.keys(taskFlags).filter((name) => !(name in requestFlags) && givenFlags.has(name));
180
+ const needsRequest = requestOnly.length > 0 || suppliedArgs.some(([name]) => !(name in taskArgs)) || Object.entries(values).some(([name, value]) => {
181
+ if (!(name in requestFlags)) return false;
182
+ const limit = taskFlags[name]?.max;
183
+ const numeric = typeof value === "number" ? value : typeof value === "string" && value.trim() !== "" ? Number(value) : NaN;
184
+ return value === "" || value === false && taskFlags[name]?.type === "boolean" && !taskFlags[name]?.allowNo || Number.isFinite(numeric) && limit !== void 0 && numeric > limit;
185
+ }) || options.storedRedeploy === true && values.file === void 0;
186
+ if (needsRequest && taskOnly.length > 0) throw new Errors.CLIError(`Cannot combine ${taskOnly.map((name) => `--${name}`).join(", ")} with structured request input. Use the task flags together, or supply the request with API fields and JSON.`, { exit: 2 });
187
+ if (needsRequest && suppliedArgs.some(([name]) => !(name in requestArgs))) throw new Errors.CLIError("Positional task values cannot be combined with structured request flags. Put those values in the request's flags or JSON body.", { exit: 2 });
188
+ const selected = needsRequest ? request : task;
189
+ const forwarded = delegateArgv(selected, values, givenFlags, parsed.args);
190
+ if (values.json !== true) {
191
+ await selected.run(forwarded, this.config);
192
+ return;
193
+ }
194
+ const output = captureOutput();
195
+ let thrown;
196
+ try {
197
+ await selected.run(forwarded, this.config);
198
+ } catch (error) {
199
+ thrown = error;
200
+ } finally {
201
+ output.restore();
202
+ }
203
+ const text = output.stdout.join("");
204
+ if (text.trim() && thrown === void 0 && !process.exitCode) {
205
+ const value = JSON.parse(text);
206
+ const document = value !== null && typeof value === "object" && !Array.isArray(value) && ("data" in value || "error" in value) ? value : { data: value };
207
+ if (!("error" in document) && document.success === void 0) document.success = true;
208
+ if (options.listPage && !("error" in document)) {
209
+ const page = document.data;
210
+ if (page !== null && typeof page === "object" && !Array.isArray(page)) {
211
+ const fields = page;
212
+ if (Array.isArray(fields.items)) {
213
+ const cursor = options.listPage === "keys" ? fields.next_cursor : fields.cursor;
214
+ document.data = fields.items;
215
+ document.meta = {
216
+ ...document.meta,
217
+ cursor: cursor ?? null,
218
+ ...options.listPage === "keys" ? { has_more: Boolean(cursor) } : { can_invite: fields.can_invite }
219
+ };
220
+ }
221
+ }
222
+ }
223
+ if (options.listPage === "members" && Array.isArray(document.data)) document.data = document.data.map((person) => {
224
+ if (person === null || typeof person !== "object") return person;
225
+ const row = person;
226
+ return typeof row.role === "string" ? {
227
+ ...row,
228
+ role: displayedRoleKey(row.role)
229
+ } : row;
230
+ });
231
+ if (Array.isArray(document.data) && document.meta === void 0) document.meta = {};
232
+ this.log(JSON.stringify(document));
233
+ } else if (text) process.stdout.write(text);
234
+ for (const chunk of output.stderr) process.stderr.write(chunk);
235
+ if (thrown !== void 0) throw thrown;
236
+ }
237
+ }
238
+ return CombinedCommand;
239
+ }
73
240
  // src/oclif/commands/activity.ts
74
241
  const API_KEY_FLAG$3 = Flags.string({
75
242
  description: "Primitive API key override (defaults to PRIMITIVE_API_KEY or saved OAuth login credentials)",
@@ -8018,7 +8185,7 @@ var EmailsFactsCommand = class EmailsFactsCommand extends Command {
8018
8185
  static summary = "Show what the classifier read from an email";
8019
8186
  static description = `Show what the classifier read from a received email, from its understanding.facts (\`primitive emails get <id> --json\`): one fact per line with its value and confidence, for example \`is_cold_outreach: true at 0.69\`, or \`topics: [billing, invoice] at 0.80\` for a multi fact. An email with no classification yet, or none to read, prints why on stderr and nothing on stdout; with --json it prints the classification, or null.
8020
8187
 
8021
- These are the facts as the classifier wrote them; a test's results[].values shows what a rule's conditions compared.`;
8188
+ With --json, the classification or null is in data, alongside success and meta. These are the facts as the classifier wrote them; a test's results[].values shows what a rule's conditions compared.`;
8022
8189
  static examples = ["<%= config.bin %> emails facts 3f0e1c2a-8b7d-4c6e-9a1b-2d3e4f5a6b7c", "<%= config.bin %> emails facts --id 3f0e1c2a-8b7d-4c6e-9a1b-2d3e4f5a6b7c --json"];
8023
8190
  static args = { id: Args.string({
8024
8191
  description: ID_DESCRIPTION,
@@ -8026,7 +8193,7 @@ These are the facts as the classifier wrote them; a test's results[].values show
8026
8193
  }) };
8027
8194
  static flags = {
8028
8195
  id: Flags.string({ description: ID_DESCRIPTION }),
8029
- json: Flags.boolean({ description: "Print the classification (id, vocabulary, classified_at, facts) as one JSON document on stdout, or null when the email has none. A failure prints the error with exit_code." }),
8196
+ json: Flags.boolean({ description: "Print success, data and meta as one JSON document. data is the classification (id, vocabulary, classified_at, facts), or null when the email has none. A failure prints the error with exit_code." }),
8030
8197
  "api-key": Flags.string({
8031
8198
  description: "Primitive API key override (defaults to PRIMITIVE_API_KEY or saved OAuth login credentials)",
8032
8199
  env: "PRIMITIVE_API_KEY"
@@ -8069,10 +8236,16 @@ These are the facts as the classifier wrote them; a test's results[].values show
8069
8236
  process.exitCode = 1;
8070
8237
  return;
8071
8238
  }
8072
- const understanding = read.data?.data?.understanding;
8239
+ const envelope = read.data;
8240
+ const understanding = envelope?.data?.understanding;
8073
8241
  const classification = classificationFromUnderstanding(understanding);
8074
8242
  if (flags.json) {
8075
- this.log(JSON.stringify(classification, null, 2));
8243
+ this.log(JSON.stringify({
8244
+ ...envelope,
8245
+ success: true,
8246
+ data: classification,
8247
+ meta: envelope?.meta ?? {}
8248
+ }, null, 2));
8076
8249
  return;
8077
8250
  }
8078
8251
  const lines = classification ? Object.entries(classification.facts).map(([name, fact]) => formatFact(name, isRecord$1(fact) ? fact : {})) : [];
@@ -8872,7 +9045,7 @@ function createEmailsGetCommand(base) {
8872
9045
  }
8873
9046
  // src/oclif/commands/emails-latest.ts
8874
9047
  const DEFAULT_LIMIT$2 = 10;
8875
- const MAX_LIMIT$2 = 100;
9048
+ const API_PAGE_MAXIMUM = 100;
8876
9049
  const SUBJECT_DISPLAY_WIDTH = 50;
8877
9050
  const ADDRESS_DISPLAY_WIDTH = 32;
8878
9051
  const ID_DISPLAY_WIDTH_SHORT = 8;
@@ -8906,7 +9079,7 @@ function formatHeader$1(idWidth) {
8906
9079
  return `${"ID".padEnd(idWidth)} ${"RECEIVED (UTC)".padEnd(RECEIVED_DISPLAY_WIDTH)} ${"FROM".padEnd(ADDRESS_DISPLAY_WIDTH)} ${"TO".padEnd(ADDRESS_DISPLAY_WIDTH)} ${"AWAITING".padEnd(AWAITING_DISPLAY_WIDTH)} ${"REPLIES".padEnd(REPLIES_DISPLAY_WIDTH)} SUBJECT`;
8907
9080
  }
8908
9081
  var EmailsLatestCommand = class EmailsLatestCommand extends Command {
8909
- static description = `Print the N most recent inbound emails as a one-line-per-row text table. Designed for quick triage and visual scanning. For programmatic access, use \`primitive emails list\` (full JSON envelope, cursor pagination, filters) or pass \`--json\` here for the same raw shape without pagination/filters.
9082
+ static description = `Print the N most recent inbound emails as a one-line-per-row text table. Designed for quick triage and visual scanning. For programmatic access, use \`primitive emails list\` (full JSON envelope, cursor pagination, filters) or pass \`--json\` here for the same response envelope, including cursor pagination.
8910
9083
 
8911
9084
  ID display is TTY-aware. When STDOUT is a terminal, the table truncates each row's id to the first ${ID_DISPLAY_WIDTH_SHORT} characters for readability. When STDOUT is piped or redirected (the row stream is being consumed by another command), the full UUID is printed so the id can be fed straight back into \`emails:get\`, \`emails:delete\`, etc. without a separate \`--json\` round-trip.
8912
9085
 
@@ -8916,7 +9089,8 @@ var EmailsLatestCommand = class EmailsLatestCommand extends Command {
8916
9089
  static summary = "Show the most recent inbound emails as a compact table";
8917
9090
  static examples = [
8918
9091
  "<%= config.bin %> emails latest",
8919
- "<%= config.bin %> emails latest --limit 25",
9092
+ "<%= config.bin %> emails latest --limit 200",
9093
+ "<%= config.bin %> emails latest --cursor <cursor> --json",
8920
9094
  "<%= config.bin %> emails latest | head -1 | awk '{print $1}' # full UUID since piped",
8921
9095
  "<%= config.bin %> emails latest --json | jq '.data[0].id'",
8922
9096
  "<%= config.bin %> emails latest --awaiting you"
@@ -8932,11 +9106,12 @@ var EmailsLatestCommand = class EmailsLatestCommand extends Command {
8932
9106
  hidden: true
8933
9107
  }),
8934
9108
  limit: Flags.integer({
8935
- description: `Number of rows to print (1-${MAX_LIMIT$2}, default ${DEFAULT_LIMIT$2}).`,
9109
+ description: `Number of rows to print (1-${PAGED_LIMIT_MAX}, default ${DEFAULT_LIMIT$2}), fetched in pages of at most ${API_PAGE_MAXIMUM}. Continue with --cursor for more.`,
8936
9110
  default: DEFAULT_LIMIT$2,
8937
9111
  min: 1,
8938
- max: MAX_LIMIT$2
9112
+ max: PAGED_LIMIT_MAX
8939
9113
  }),
9114
+ cursor: Flags.string({ description: "Continue from meta.cursor of a previous listing. The next cursor is printed on stderr, or in meta.cursor with --json." }),
8940
9115
  awaiting: Flags.string({
8941
9116
  description: AWAITING_FLAG_DESCRIPTION,
8942
9117
  options: [...AWAITING_VALUES]
@@ -8963,14 +9138,25 @@ var EmailsLatestCommand = class EmailsLatestCommand extends Command {
8963
9138
  });
8964
9139
  const query = {
8965
9140
  limit: flags.limit,
9141
+ ...flags.cursor !== void 0 ? { cursor: flags.cursor } : {},
8966
9142
  ...awaiting ? { awaiting } : {},
8967
9143
  ...focus.params
8968
9144
  };
8969
- const result = await listEmails({
8970
- client: apiClient.client,
8971
- query,
8972
- responseStyle: "fields"
9145
+ const paged = await fetchBoundedPages({
9146
+ wanted: flags.limit,
9147
+ maximum: API_PAGE_MAXIMUM,
9148
+ cursor: flags.cursor,
9149
+ call: (limit, cursor) => listEmails({
9150
+ client: apiClient.client,
9151
+ query: {
9152
+ ...query,
9153
+ limit,
9154
+ cursor
9155
+ },
9156
+ responseStyle: "fields"
9157
+ })
8973
9158
  });
9159
+ const result = paged.result;
8974
9160
  if (result.error) {
8975
9161
  const errorPayload = extractErrorPayload(result.error);
8976
9162
  if (awaiting && isAwaitingRejectedError(errorPayload)) {
@@ -8988,7 +9174,7 @@ var EmailsLatestCommand = class EmailsLatestCommand extends Command {
8988
9174
  process.exitCode = 1;
8989
9175
  return;
8990
9176
  }
8991
- const envelope = result.data;
9177
+ const envelope = paged.envelope ?? result.data;
8992
9178
  if (awaiting) try {
8993
9179
  assertAwaitingFilterRows(envelope?.data ?? [], "GET /emails");
8994
9180
  } catch (error) {
@@ -8998,7 +9184,12 @@ var EmailsLatestCommand = class EmailsLatestCommand extends Command {
8998
9184
  return;
8999
9185
  }
9000
9186
  const rows = envelope?.data ?? [];
9001
- const note = rows.length === 0 ? await focusEmptyHint(focus, async () => {
9187
+ const note = (rows.length === 0 && (flags.cursor !== void 0 || envelope?.meta?.cursor) ? emptyEmailListHint({
9188
+ filterFlags: awaiting ? [`--awaiting ${awaiting}`] : [],
9189
+ ...flags.cursor !== void 0 ? { pastFlag: "--cursor" } : {},
9190
+ nextCursor: envelope?.meta?.cursor,
9191
+ caller: null
9192
+ }) : null) ?? (rows.length === 0 ? await focusEmptyHint(focus, async () => {
9002
9193
  const counted = await listEmails({
9003
9194
  client: apiClient.client,
9004
9195
  query: {
@@ -9009,9 +9200,10 @@ var EmailsLatestCommand = class EmailsLatestCommand extends Command {
9009
9200
  responseStyle: "fields"
9010
9201
  });
9011
9202
  return counted.error ? null : countFromMeta(counted.data);
9012
- }) : null;
9203
+ }) : null);
9013
9204
  if (flags.json) {
9014
9205
  const document = withFocusMeta(envelope ?? null, focus);
9206
+ if (paged.note) process.stderr.write(`${paged.note}\n`);
9015
9207
  this.log(JSON.stringify(note && document ? {
9016
9208
  ...document,
9017
9209
  summary: note
@@ -9019,6 +9211,8 @@ var EmailsLatestCommand = class EmailsLatestCommand extends Command {
9019
9211
  return;
9020
9212
  }
9021
9213
  writeFocusLine(focus, false);
9214
+ if (envelope?.meta?.cursor) process.stderr.write(`next cursor: ${envelope.meta.cursor}\n`);
9215
+ if (paged.note) process.stderr.write(`${paged.note}\n`);
9022
9216
  if (rows.length === 0) {
9023
9217
  if (note) {
9024
9218
  process.stderr.write(`${note}\n`);
@@ -9555,7 +9749,7 @@ const commonFlags$1 = {
9555
9749
  };
9556
9750
  const FOCUS_DESCRIPTION = `Which domains mail listings and searches show.
9557
9751
 
9558
- 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.
9752
+ 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 current login, or the connected agent selected by PRIMITIVE_AGENT_PROFILE), never in a credential file.
9559
9753
 
9560
9754
  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\`).
9561
9755
 
@@ -9566,13 +9760,18 @@ async function readState(command, flags, lookupOptional = false) {
9566
9760
  apiKey: flags["api-key"],
9567
9761
  apiBaseUrl: flags["api-base-url"]
9568
9762
  });
9569
- const readable = await readReadableDomains(apiClient.client);
9763
+ const { readable, refusal } = await readDomainsOrRefusal(apiClient.client);
9570
9764
  const fallbackOrg = auth.connectedAgent?.orgId ?? auth.credentials?.org_id ?? null;
9571
- if (!readable && lookupOptional && fallbackOrg) return {
9765
+ if (!readable && lookupOptional && (fallbackOrg || refusal)) return {
9572
9766
  profile: focusProfile(command.config.configDir, auth),
9573
9767
  orgId: fallbackOrg,
9574
- readable: null
9768
+ readable: null,
9769
+ refusal
9575
9770
  };
9771
+ if (!readable && refusal) throw new Errors.CLIError(refusal.message.replace(/\.?$/, "."), {
9772
+ exit: 1,
9773
+ code: refusal.code
9774
+ });
9576
9775
  if (!readable) throw new Errors.CLIError("Could not read this credential's domains; retry in a moment.", {
9577
9776
  exit: 1,
9578
9777
  code: "focus_lookup_failed"
@@ -9589,7 +9788,7 @@ async function readState(command, flags, lookupOptional = false) {
9589
9788
  };
9590
9789
  }
9591
9790
  function profileLabel(profile) {
9592
- return profile.kind === "agent" ? `agent profile ${profile.name}` : "the member login";
9791
+ return profile.kind === "agent" ? `agent profile ${profile.name}` : "the current login";
9593
9792
  }
9594
9793
  function describeChoice(choice) {
9595
9794
  if (!choice) return "none chosen";
@@ -9620,7 +9819,7 @@ var FocusCommand = class FocusCommand extends Command {
9620
9819
  async run() {
9621
9820
  const { flags } = await this.parse(FocusCommand);
9622
9821
  const state = await readState(this, flags, true);
9623
- const choice = loadSavedFocus(state.profile, state.orgId)?.choice ?? null;
9822
+ const choice = (state.orgId ? loadSavedFocus(state.profile, state.orgId) : null)?.choice ?? null;
9624
9823
  const session = process.env["PRIMITIVE_FOCUS_DOMAINS"]?.trim() || null;
9625
9824
  const names = state.readable?.domains.map((d) => d.name) ?? null;
9626
9825
  if (flags.json) {
@@ -9629,10 +9828,16 @@ var FocusCommand = class FocusCommand extends Command {
9629
9828
  saved: choiceJson(choice),
9630
9829
  session_override: session,
9631
9830
  domains: names,
9632
- applies: names === null ? null : names.length > 1
9831
+ applies: names === null ? null : names.length > 1,
9832
+ ...state.refusal ? { refusal: state.refusal } : {}
9633
9833
  }, null, 2));
9634
9834
  return;
9635
9835
  }
9836
+ if (state.refusal) {
9837
+ if (choice) this.log(`Focus for ${profileLabel(state.profile)}: ${describeChoice(choice)}.`);
9838
+ this.log(state.refusal.message.replace(/\.?$/, "."));
9839
+ return;
9840
+ }
9636
9841
  if (names !== null && names.length <= 1) {
9637
9842
  this.log(`This credential reads mail on ${names.length === 1 ? `one domain, ${names[0]}` : "no verified domain"}, so listings are never focused.`);
9638
9843
  return;
@@ -9705,7 +9910,7 @@ ${FOCUS_DESCRIPTION}`;
9705
9910
  const { flags } = await this.parse(FocusClearCommand);
9706
9911
  const state = await readState(this, flags, true);
9707
9912
  let had = false;
9708
- saveFocus(state.profile, state.orgId, (current) => {
9913
+ if (state.orgId) saveFocus(state.profile, state.orgId, (current) => {
9709
9914
  had = Boolean(current?.choice);
9710
9915
  return null;
9711
9916
  });
@@ -10871,8 +11076,8 @@ const PRIMITIVE_TEAM_AUTHOR = {
10871
11076
  name: "Primitive Team",
10872
11077
  url: "https://primitive.dev"
10873
11078
  };
10874
- const SDK_VERSION_RANGE = "^3.0.0-preview.21";
10875
- const CLI_VERSION_RANGE = "^3.0.0-preview.21";
11079
+ const SDK_VERSION_RANGE = "^3.0.0-preview.22";
11080
+ const CLI_VERSION_RANGE = "^3.0.0-preview.22";
10876
11081
  const ESBUILD_VERSION_RANGE = "^0.27.0";
10877
11082
  function renderHandler() {
10878
11083
  return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
@@ -12294,7 +12499,7 @@ async function runSetSecret(api, params) {
12294
12499
  };
12295
12500
  }
12296
12501
  var FunctionsSetSecretCommand = class FunctionsSetSecretCommand extends Command {
12297
- static description = `Write a function secret and optionally redeploy so the new value lands in the running handler. Agent-grade shortcut for functions set-function-secret + functions redeploy.
12502
+ static description = `Write a function secret and optionally redeploy so the new value lands in the running handler.
12298
12503
 
12299
12504
  Without --redeploy this is a plain secret upsert: the value is
12300
12505
  encrypted at rest but is NOT visible to the running handler until
@@ -14222,7 +14427,7 @@ function expiryFromFlags(flags) {
14222
14427
  function unwrap(data) {
14223
14428
  return data?.data ?? data;
14224
14429
  }
14225
- async function call(request) {
14430
+ async function call(request, keepEnvelope = false) {
14226
14431
  try {
14227
14432
  const result = await request;
14228
14433
  if (result.error !== void 0 || !result.response?.ok) return {
@@ -14234,7 +14439,8 @@ async function call(request) {
14234
14439
  };
14235
14440
  return {
14236
14441
  ok: true,
14237
- data: unwrap(result.data)
14442
+ data: unwrap(result.data),
14443
+ ...keepEnvelope ? { envelope: result.data } : {}
14238
14444
  };
14239
14445
  } catch (error) {
14240
14446
  return {
@@ -14640,13 +14846,16 @@ var KeysListCommand = class KeysListCommand extends Command {
14640
14846
  "api-key": API_KEY_FLAG$1,
14641
14847
  "api-base-url": API_BASE_URL_FLAG$2,
14642
14848
  "include-revoked": Flags.boolean({ description: "List revoked keys too, each marked [revoked] with when it was revoked." }),
14643
- json: Flags.boolean({ description: "Print the keys as JSON." })
14849
+ json: Flags.boolean({ description: "Print the keys in data, with continuation in meta.cursor." })
14644
14850
  };
14645
14851
  async run() {
14646
14852
  const { flags } = await this.parse(KeysListCommand);
14647
14853
  const includeRevoked = flags["include-revoked"] === true;
14648
14854
  const auth = await authenticate(this, flags);
14649
14855
  const items = [];
14856
+ let envelope = {};
14857
+ let meta = {};
14858
+ const warnings = [];
14650
14859
  let cursor;
14651
14860
  for (let page = 0; page < LIST_PAGE_LIMIT; page += 1) {
14652
14861
  const result = await call(listKeys({
@@ -14655,20 +14864,40 @@ var KeysListCommand = class KeysListCommand extends Command {
14655
14864
  cursor,
14656
14865
  include_revoked: includeRevoked ? "true" : void 0
14657
14866
  }
14658
- }));
14867
+ }), true);
14659
14868
  if (!result.ok) {
14660
14869
  await reportKeysError(this, result, auth, Boolean(flags.json));
14661
14870
  return;
14662
14871
  }
14872
+ envelope = {
14873
+ ...envelope,
14874
+ ...result.envelope
14875
+ };
14876
+ meta = {
14877
+ ...meta,
14878
+ ...result.envelope?.meta
14879
+ };
14880
+ if (Array.isArray(result.envelope?.warnings)) warnings.push(...result.envelope.warnings);
14663
14881
  items.push(...result.data.items);
14664
14882
  cursor = result.data.next_cursor ?? void 0;
14665
14883
  if (!cursor) break;
14666
14884
  }
14667
14885
  if (flags.json) {
14668
- this.log(JSON.stringify(items, null, 2));
14886
+ this.log(JSON.stringify({
14887
+ ...envelope,
14888
+ success: true,
14889
+ data: items,
14890
+ meta: {
14891
+ ...meta,
14892
+ cursor: cursor ?? null,
14893
+ has_more: Boolean(cursor)
14894
+ },
14895
+ ...warnings.length ? { warnings } : {}
14896
+ }));
14669
14897
  return;
14670
14898
  }
14671
14899
  this.log(formatKeyRows(items, { includeRevoked }));
14900
+ if (cursor) process.stderr.write(`next cursor: ${cursor}\n`);
14672
14901
  }
14673
14902
  };
14674
14903
  var KeysGetCommand = class KeysGetCommand extends Command {
@@ -15132,9 +15361,13 @@ function revokeCascadeLines(data) {
15132
15361
  var KeysRevokeCommand = class KeysRevokeCommand extends Command {
15133
15362
  static description = `Revoke an API key. It stops working at once. What the organization owns keeps working; what the key itself owns, such as its own webhooks, keeps working only while someone can still act for it, such as a key of the same rotation that still works. What it set up or owns is listed for review, each with whether anything still acts for it and, for a webhook, whether it still delivers received mail. Keys it replaced that are still in their rotation overlap are revoked with it, except any you may not revoke; the output counts both, and names them and the key acting for each item when you may read the organization's keys.
15134
15363
 
15135
- Asks for confirmation first; pass --yes to skip the prompt in scripts. Revoking runs directly. If your organization requires approval, the command prints the approval link, opens it where it can and waits for the one-time token; in a script, approve and run it again with --step-up-token.`;
15364
+ Asks for confirmation first; pass --yes to confirm in scripts. JSON and non-interactive mode never prompt, so use --yes --json for scripted JSON output. Revoking runs directly. If your organization requires approval, the command prints the approval link, opens it where it can and waits for the one-time token; in a script, approve and run it again with --step-up-token.`;
15136
15365
  static summary = "Revoke an API key";
15137
- static examples = ["<%= config.bin %> keys revoke 0f0e0d0c-0b0a-4908-8706-050403020100", "<%= config.bin %> keys revoke 0f0e0d0c-0b0a-4908-8706-050403020100 --yes"];
15366
+ static examples = [
15367
+ "<%= config.bin %> keys revoke 0f0e0d0c-0b0a-4908-8706-050403020100",
15368
+ "<%= config.bin %> keys revoke 0f0e0d0c-0b0a-4908-8706-050403020100 --yes",
15369
+ "<%= config.bin %> keys revoke 0f0e0d0c-0b0a-4908-8706-050403020100 --yes --json"
15370
+ ];
15138
15371
  static args = { id: Args.string({
15139
15372
  description: "The key's id.",
15140
15373
  required: true
@@ -15153,7 +15386,13 @@ var KeysRevokeCommand = class KeysRevokeCommand extends Command {
15153
15386
  async run() {
15154
15387
  const { args, flags } = await this.parse(KeysRevokeCommand);
15155
15388
  if (!flags.yes) {
15156
- if (flags.json || !(process.stdin.isTTY && process.stderr.isTTY)) this.error("Not revoking: no terminal to confirm in. Pass --yes to revoke without a prompt.", { exit: 2 });
15389
+ if (flags.json || !(process.stdin.isTTY && process.stderr.isTTY)) throw Object.assign(new Errors.CLIError("Confirmation required: pass --yes to revoke without a prompt. --json and non-interactive mode never prompt.", { exit: 2 }), {
15390
+ code: "usage_error",
15391
+ details: {
15392
+ reason: "confirmation_required",
15393
+ required_flags: ["--yes"]
15394
+ }
15395
+ });
15157
15396
  const answer = await promptLine$2(`Revoke key ${args.id}? It stops working at once. [y/N] `);
15158
15397
  if (!/^y(es)?$/i.test(answer.trim())) {
15159
15398
  process.stderr.write("Cancelled. The key still works.\n");
@@ -22797,7 +23036,7 @@ const SHARED_FLAGS = {
22797
23036
  }),
22798
23037
  json: Flags.boolean({ description: "Print the response data as JSON." })
22799
23038
  };
22800
- async function runRead(command, flags, read, format, after) {
23039
+ async function runRead(command, flags, read, format, after, keepEnvelope = false) {
22801
23040
  const { apiClient, auth, baseUrlOverridden } = await createAuthenticatedCliApiClient({
22802
23041
  apiKey: flags["api-key"],
22803
23042
  apiBaseUrl: flags["api-base-url"],
@@ -22817,7 +23056,7 @@ async function runRead(command, flags, read, format, after) {
22817
23056
  return;
22818
23057
  }
22819
23058
  const data = result.data?.data;
22820
- command.log(flags.json ? JSON.stringify(data, null, 2) : format(data));
23059
+ command.log(flags.json ? JSON.stringify(keepEnvelope ? result.data : data, null, 2) : format(data));
22821
23060
  if (!flags.json) after?.(data);
22822
23061
  }
22823
23062
  function formatRoles(list) {
@@ -22855,9 +23094,10 @@ function mailAccessText(person) {
22855
23094
  function formatMembers(list) {
22856
23095
  if (list.items.length === 0) return "No members.";
22857
23096
  return list.items.map((person) => {
22858
- const role = printable(person.role_name || person.role);
23097
+ const role = printable(roleKeyLabel(person.role));
23098
+ const assigned = person.role_id && person.role_name ? ` assigned role: ${printable(person.role_name)}` : "";
22859
23099
  const agents = person.agents.length > 0 ? ` ${person.agents.length} agent${person.agents.length === 1 ? "" : "s"}` : "";
22860
- return `${printable(person.name)} ${person.work_email ?? "no work email"} ${role} ${person.user_id}${agents}${mailAccessText(person)}`;
23100
+ return `${printable(person.name)} ${person.work_email ?? "no work email"} ${role}${assigned} ${person.user_id}${agents}${mailAccessText(person)}`;
22861
23101
  }).join("\n");
22862
23102
  }
22863
23103
  function formatAccessMode(mode) {
@@ -22877,11 +23117,11 @@ var RolesListCommand = class RolesListCommand extends Command {
22877
23117
  }
22878
23118
  };
22879
23119
  var RolesMembersCommand = class RolesMembersCommand extends Command {
22880
- static description = "List the organization's members with their roles: name, work email, role, user id, how many directory agents each has, and what their access lets them do with mail (read, send, both or none), where you can see it. Use it to see each member's role before you ask someone for something, for example before sending an email rule request. With --json, prints the response data, including each member's role key, role id, agents and the next page's cursor.";
23120
+ static description = "List the organization's members with their built-in role, using the same name as whoami and org list. An assigned template or custom role is labeled separately. The built-in label does not grant permissions; mail access shows what they can read or send where you can see it. Rows include name, work email, user id and directory agents. With --json, data is the members array: role is the displayed built-in key; role_name and role_id keep the assigned role's metadata. meta.cursor continues the listing and meta.can_invite says whether you can invite members.";
22881
23121
  static summary = "List members and their roles";
22882
23122
  static examples = [
22883
- "<%= config.bin %> roles members",
22884
- "<%= config.bin %> roles members --query alice",
23123
+ "<%= config.bin %> members list",
23124
+ "<%= config.bin %> members list --query alice",
22885
23125
  "<%= config.bin %> members list --json"
22886
23126
  ];
22887
23127
  static flags = {
@@ -22892,7 +23132,7 @@ var RolesMembersCommand = class RolesMembersCommand extends Command {
22892
23132
  min: 1,
22893
23133
  max: 100
22894
23134
  }),
22895
- cursor: Flags.string({ description: "The next page's cursor: printed on stderr as `next cursor: <value>`, or `cursor` with --json." })
23135
+ cursor: Flags.string({ description: "The next page's cursor: printed on stderr as `next cursor: <value>`, or `meta.cursor` with --json." })
22896
23136
  };
22897
23137
  async run() {
22898
23138
  const { flags } = await this.parse(RolesMembersCommand);
@@ -22907,7 +23147,7 @@ var RolesMembersCommand = class RolesMembersCommand extends Command {
22907
23147
  responseStyle: "fields"
22908
23148
  }), formatMembers, (list) => {
22909
23149
  if (list.cursor) process.stderr.write(`next cursor: ${list.cursor}\n`);
22910
- });
23150
+ }, true);
22911
23151
  }
22912
23152
  };
22913
23153
  var RolesGroupsCommand = class RolesGroupsCommand extends Command {
@@ -24912,6 +25152,31 @@ const sessionOnlyFlag = Flags.boolean({
24912
25152
  exclusive: ["all-sessions"]
24913
25153
  });
24914
25154
  const jsonFlag = Flags.boolean({ description: "Print JSON (already the default)" });
25155
+ const serverFlags = {
25156
+ "api-key": Flags.string({
25157
+ description: "Primitive API key override",
25158
+ env: "PRIMITIVE_API_KEY"
25159
+ }),
25160
+ "api-base-url": Flags.string({
25161
+ description: "Override the API base URL",
25162
+ env: "PRIMITIVE_API_BASE_URL",
25163
+ hidden: true
25164
+ }),
25165
+ address: Flags.string({ description: "Address whose thread mute changes. Defaults to the connected agent's address; required for other credentials." })
25166
+ };
25167
+ function localProfile(command, flags) {
25168
+ const agent = resolveCliAuth({
25169
+ configDir: command.config.configDir,
25170
+ apiKey: flags["api-key"],
25171
+ apiBaseUrl: flags["api-base-url"]
25172
+ }).connectedAgent;
25173
+ if (flags.address !== void 0 && flags.address.toLowerCase() !== agent?.agentAddress.toLowerCase()) return void 0;
25174
+ return agent?.profileName;
25175
+ }
25176
+ function requireLocalProfile(command, profile) {
25177
+ if (!profile) command.error("Local thread mutes require a connected agent profile for the requested address. Set PRIMITIVE_AGENT_PROFILE to that profile.");
25178
+ return profile;
25179
+ }
24915
25180
  function profileName(command) {
24916
25181
  const name = resolveCliAuth({ configDir: command.config.configDir }).connectedAgent?.profileName;
24917
25182
  if (!name) command.error("Thread mutes belong to a connected agent profile. Set PRIMITIVE_AGENT_PROFILE to the profile whose wakes should change.");
@@ -24948,11 +25213,12 @@ function errorMessage(payload) {
24948
25213
  * caller can fall back to a local mute. A 404 for an unknown thread names
24949
25214
  * the thread and is reported separately.
24950
25215
  */
24951
- async function callMuteApi(client, method, id) {
25216
+ async function callMuteApi(client, method, id, address) {
24952
25217
  const response = await client[method]({
24953
25218
  security,
24954
25219
  url: "/threads/{id}/mute",
24955
25220
  path: { id },
25221
+ ...address === void 0 ? {} : { query: { address } },
24956
25222
  responseStyle: "fields"
24957
25223
  });
24958
25224
  if (response.error === void 0) return {
@@ -24970,8 +25236,12 @@ async function callMuteApi(client, method, id) {
24970
25236
  payload: response.error
24971
25237
  };
24972
25238
  }
24973
- async function apiClient(command) {
24974
- const { apiClient } = await createAuthenticatedCliApiClient({ configDir: command.config.configDir });
25239
+ async function apiClient(command, flags = {}) {
25240
+ const { apiClient } = await createAuthenticatedCliApiClient({
25241
+ configDir: command.config.configDir,
25242
+ apiKey: flags["api-key"],
25243
+ apiBaseUrl: flags["api-base-url"]
25244
+ });
24975
25245
  return apiClient.client;
24976
25246
  }
24977
25247
  function failWith(payload) {
@@ -24981,9 +25251,14 @@ function failWith(payload) {
24981
25251
  const UNSUPPORTED_NOTE = "This server does not keep thread mutes yet, so the mute is stored locally for this profile.";
24982
25252
  var ThreadsMuteCommand = class ThreadsMuteCommand extends Command {
24983
25253
  static summary = "Stop wakes for one thread";
24984
- static description = "Mutes the thread for this connected agent's address on the server, so no session or runtime using the address is woken by it. Mail in it is still received and readable, reads report it as muted, and its delivery event is completed so it is not redelivered. With --session-only the mute is stored locally and applies only to the current Claude Code or Codex session. A server without thread mutes gets a local mute instead: the current runtime session's, or with --all-sessions (or outside a session) every session on the profile.";
24985
- static examples = ["PRIMITIVE_AGENT_PROFILE=work <%= config.bin %> threads mute --id <thread-id>", "PRIMITIVE_AGENT_PROFILE=work <%= config.bin %> threads mute --id <thread-id> --session-only"];
25254
+ static description = "Mutes the thread for --address on the server, defaulting to the connected agent's address, so no session or runtime using the address is woken by it. Other credentials must provide --address. Mail in it is still received and readable, reads report it as muted, and its delivery event is completed so it is not redelivered. With --session-only the mute is stored locally and applies only to the current Claude Code or Codex session. A server without thread mutes gets a local mute instead: the current runtime session's, or with --all-sessions (or outside a session) every session on the profile. Local mutes require the requested address's connected profile.";
25255
+ static examples = [
25256
+ "PRIMITIVE_AGENT_PROFILE=work <%= config.bin %> threads mute --id <thread-id>",
25257
+ "PRIMITIVE_AGENT_PROFILE=work <%= config.bin %> threads mute --id <thread-id> --session-only",
25258
+ "<%= config.bin %> threads mute --id <thread-id> --address member@example.com"
25259
+ ];
24986
25260
  static flags = {
25261
+ ...serverFlags,
24987
25262
  id: idFlag,
24988
25263
  "session-only": sessionOnlyFlag,
24989
25264
  "all-sessions": allSessionsFlag,
@@ -24992,9 +25267,10 @@ var ThreadsMuteCommand = class ThreadsMuteCommand extends Command {
24992
25267
  async run() {
24993
25268
  const { flags } = await this.parse(ThreadsMuteCommand);
24994
25269
  const id = threadId(this, flags.id);
24995
- const profile = profileName(this);
25270
+ const profile = localProfile(this, flags);
25271
+ if (flags["session-only"]) requireLocalProfile(this, profile);
24996
25272
  if (!flags["session-only"]) {
24997
- const result = await callMuteApi(await apiClient(this), "put", id);
25273
+ const result = await callMuteApi(await apiClient(this, flags), "put", id, flags.address);
24998
25274
  if (result.kind === "ok") {
24999
25275
  const data = record(result.data);
25000
25276
  this.log(JSON.stringify({
@@ -25008,10 +25284,11 @@ var ThreadsMuteCommand = class ThreadsMuteCommand extends Command {
25008
25284
  return;
25009
25285
  }
25010
25286
  if (result.kind !== "unsupported") return failWith(result.payload);
25287
+ requireLocalProfile(this, profile);
25011
25288
  process.stderr.write(`${UNSUPPORTED_NOTE}\n`);
25012
25289
  }
25013
25290
  const session = flags["session-only"] ? requireSession(this) : muteSession(flags["all-sessions"]);
25014
- const { mute, changed } = await muteThread(this.config.configDir, profile, id, session);
25291
+ const { mute, changed } = await muteThread(this.config.configDir, requireLocalProfile(this, profile), id, session);
25015
25292
  this.log(JSON.stringify({
25016
25293
  thread_id: mute.thread_id,
25017
25294
  muted: true,
@@ -25024,9 +25301,10 @@ var ThreadsMuteCommand = class ThreadsMuteCommand extends Command {
25024
25301
  };
25025
25302
  var ThreadsUnmuteCommand = class ThreadsUnmuteCommand extends Command {
25026
25303
  static summary = "Resume wakes for one muted thread";
25027
- static description = "Removes the server mute for this address and this session's local mute for the thread, or every local mute on the profile with --all-sessions (also the default outside a runtime session). With --session-only only this session's local mute is removed. Reports any local mute that still applies.";
25304
+ static description = "Removes the server mute for --address, defaulting to the connected agent's address. Other credentials must provide --address. For that address's connected profile, also removes this session's local mute for the thread, or every local mute with --all-sessions (also the default outside a runtime session). With --session-only only this session's local mute is removed. Reports any local mute that still applies.";
25028
25305
  static examples = ["PRIMITIVE_AGENT_PROFILE=work <%= config.bin %> threads unmute --id <thread-id>"];
25029
25306
  static flags = {
25307
+ ...serverFlags,
25030
25308
  id: idFlag,
25031
25309
  "session-only": sessionOnlyFlag,
25032
25310
  "all-sessions": allSessionsFlag,
@@ -25035,15 +25313,24 @@ var ThreadsUnmuteCommand = class ThreadsUnmuteCommand extends Command {
25035
25313
  async run() {
25036
25314
  const { flags } = await this.parse(ThreadsUnmuteCommand);
25037
25315
  const id = threadId(this, flags.id);
25038
- const profile = profileName(this);
25316
+ const profile = localProfile(this, flags);
25317
+ if (flags["session-only"]) requireLocalProfile(this, profile);
25039
25318
  let server = null;
25040
25319
  if (!flags["session-only"]) {
25041
- const result = await callMuteApi(await apiClient(this), "delete", id);
25320
+ const result = await callMuteApi(await apiClient(this, flags), "delete", id, flags.address);
25042
25321
  if (result.kind === "error") return failWith(result.payload);
25322
+ if (!profile) {
25323
+ if (result.kind === "ok") {
25324
+ this.log(JSON.stringify(result.data, null, 2));
25325
+ return;
25326
+ }
25327
+ if (result.kind === "thread_not_found") return failWith(result.payload);
25328
+ requireLocalProfile(this, profile);
25329
+ }
25043
25330
  server = result.kind === "ok" ? "unmuted" : result.kind === "thread_not_found" ? "not_found" : "unsupported";
25044
25331
  }
25045
25332
  const session = flags["session-only"] ? requireSession(this) : muteSession(flags["all-sessions"]);
25046
- const { removed, remaining } = await unmuteThread(this.config.configDir, profile, id, session, { allScopes: session === null });
25333
+ const { removed, remaining } = await unmuteThread(this.config.configDir, requireLocalProfile(this, profile), id, session, { allScopes: session === null });
25047
25334
  const stillMuted = session === null ? remaining : remaining.filter((mute) => mute.session === null || mute.session === session);
25048
25335
  this.log(JSON.stringify({
25049
25336
  thread_id: id,
@@ -26918,6 +27205,17 @@ const rawCommands = {
26918
27205
  "wake:authorizations:delete": WakeAuthorizationsDeleteCommand,
26919
27206
  "wake:dispatches:list": WakeDispatchesListCommand
26920
27207
  };
27208
+ for (const [oldId, target] of Object.entries(COMMAND_PAIR_RENAMES)) {
27209
+ const request = generatedCommands[oldId];
27210
+ if (!request) continue;
27211
+ const taskEntry = Object.entries(rawCommands).find(([id]) => !Object.hasOwn(COMMAND_PAIR_RENAMES, id) && canonicalCommandId(id) === target);
27212
+ if (!taskEntry) throw new Error(`Missing task command for ${oldId}`);
27213
+ const combined = combineCommandPair(taskEntry[1], request, {
27214
+ storedRedeploy: oldId === "functions:redeploy-function",
27215
+ listPage: oldId === "credentials:list-keys" ? "keys" : oldId === "projects:list-organization-people" ? "members" : void 0
27216
+ });
27217
+ for (const id of Object.keys(rawCommands)) if (canonicalCommandId(id) === target) rawCommands[id] = combined;
27218
+ }
26921
27219
  const COMMANDS = canonicalCommands(rawCommands);
26922
27220
  for (const command of new Set(Object.values(COMMANDS))) ignoreArgumentStdin(command);
26923
27221
  setKnownCommands(Object.keys(COMMANDS), CANONICAL_OPERATION_ALIASES);