primcli 3.0.0-preview.27 → 3.0.0-preview.29

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.
@@ -76,6 +76,17 @@ const COMMAND_RENAMES = {
76
76
  "agent-connections:revoke-agent-connection": "agent-connections:revoke",
77
77
  "agent-connections:set-agent-connection-visibility": "agent-connections:set-visibility",
78
78
  "agent-connections:update-agent-connection-settings": "agent-connections:update-settings",
79
+ "agents:bind-agent-credential": "agents:bind-credential",
80
+ "agents:claim-agent-address": "agents:claim-address",
81
+ "agents:create-agent": "agents:create",
82
+ "agents:get-agent": "agents:get",
83
+ "agents:list-agents": "agents:list",
84
+ "agents:pause-agent": "agents:pause",
85
+ "agents:release-agent-address": "agents:release-address",
86
+ "agents:resume-agent": "agents:resume",
87
+ "agents:retire-agent": "agents:retire",
88
+ "agents:unbind-agent-credential": "agents:unbind-credential",
89
+ "agents:update-agent": "agents:update",
79
90
  "agent-networks:add-default-network-member": "agent-networks:add-member",
80
91
  "agent-networks:check-default-network-contact-admission": "agent-networks:check-contact-admission",
81
92
  "agent-networks:get-default-network-agent": "agent-networks:get-agent",
@@ -1,12 +1,12 @@
1
1
  import { B as agentProfileDirectory, G as loadConnectedAgentProfile, H as agentProfilesDirectory, J as profileAlreadyConnectedMessage, K as parseConnectedAgentProfile, R as AGENT_PROFILE_ENV, S as loadCliCredentials, U as connectedAgentIdentity, V as agentProfileName, W as connectedApiBaseUrl, X as saveConnectedAgentProfile, dt as detectAgentRuntime, mt as PrimitiveApiClient, q as parseOwnerMemberAddress, z as AgentConnectionSetupError } from "./cli-config-CwZJQIcn.js";
2
- import { An as putAgentContact, Ft as getContact, Gn as sendEmail, Hn as searchEmails, Mn as putContact, Pt as getAgentContactPolicy, St as deleteContact, an as listAgentContacts, fr as __exportAll, in as listAgentConnections, jn as putAgentContactPolicy, sn as listContacts, tn as inviteAgentConnection, un as listDomains, wn as listSentEmails, xt as deleteAgentContact, zt as getEmail } from "./repeats-Dj_o6c-X-CK1wU9lP.js";
3
- import { At as cliInvocation, Cn as refuseOrgSelectionForProfile, Mt as defaultConnectionName, Sn as refreshStoredCliCredentials } from "./api-command-B-nuABGm.js";
2
+ import { An as putAgentContact, Ft as getContact, Gn as sendEmail, Hn as searchEmails, Mn as putContact, Pt as getAgentContactPolicy, St as deleteContact, an as listAgentContacts, fr as __exportAll, in as listAgentConnections, jn as putAgentContactPolicy, sn as listContacts, tn as inviteAgentConnection, un as listDomains, wn as listSentEmails, xt as deleteAgentContact, zt as getEmail } from "./repeats-Dj_o6c-X-jmlxD8_1.js";
3
+ import { At as cliInvocation, Cn as refuseOrgSelectionForProfile, Mt as defaultConnectionName, Sn as refreshStoredCliCredentials } from "./api-command-BX7D2LxZ.js";
4
4
  import { _ as acquireListenLock, b as listenLockHeld, c as mailTime, d as readMailJson, f as removeMailFile, g as ListenStateError, h as writeMailJson, i as mailId, l as privateMailDirectory, o as mailObject, p as syncMailDirectory, r as mailAddress, s as mailString } from "./shared-mail-files-BAQSGxxz.js";
5
- import { a as NotificationRetryError, d as SESSION_UUID, f as connectNativeSession, m as NativeSessionDisconnectedError, p as defaultSessionSocket, t as notificationScope, w as readBundledConnectSkill, x as installSkill } from "./notify-session-CM4_ZYe9.js";
5
+ import { a as NotificationRetryError, d as SESSION_UUID, f as connectNativeSession, m as NativeSessionDisconnectedError, p as defaultSessionSocket, t as notificationScope, w as readBundledConnectSkill, x as installSkill } from "./notify-session-CmoGM6h8.js";
6
6
  import { a as backgroundListenStatus, d as stopBackgroundListen } from "./listen-background-DyBYca28.js";
7
7
  import { t as readSharedMailOwner } from "./shared-mail-watch-DdtgJOrV.js";
8
8
  import { withoutOrgSelection } from "./oclif/global-org-flag.js";
9
- import { o as scopedChatSenderTrust } from "./scoped-chat-DN0qj4AY.js";
9
+ import { o as scopedChatSenderTrust } from "./scoped-chat-CDkazRdx.js";
10
10
  import { accessSync, chmodSync, closeSync, constants, copyFileSync, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, rmdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
11
11
  import { createHash, randomUUID } from "node:crypto";
12
12
  import { basename, delimiter, dirname, isAbsolute, join, resolve } from "node:path";
@@ -1,5 +1,5 @@
1
- import { _ as isTrustedSender, c as classifySignalContent, g as isEmailReceivedEvent, kt as downloadEmailAttachmentPart, v as parseWebhookEvent } from "./repeats-Dj_o6c-X-CK1wU9lP.js";
2
- import { B as wakeReadCommand, tt as wakeInteractionSentence, z as skillFirstLine } from "./api-command-B-nuABGm.js";
1
+ import { _ as isTrustedSender, c as classifySignalContent, g as isEmailReceivedEvent, kt as downloadEmailAttachmentPart, v as parseWebhookEvent } from "./repeats-Dj_o6c-X-jmlxD8_1.js";
2
+ import { B as wakeReadCommand, tt as wakeInteractionSentence, z as skillFirstLine } from "./api-command-BX7D2LxZ.js";
3
3
  import { _ as acquireListenLock, g as ListenStateError, y as listenIdentity } from "./shared-mail-files-BAQSGxxz.js";
4
4
  import { closeSync, copyFileSync, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, opendirSync, readFileSync, readdirSync, readlinkSync, renameSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { createHash, randomUUID, scryptSync } from "node:crypto";
@@ -1,8 +1,8 @@
1
- import { Qt as getSentEmail } from "../repeats-Dj_o6c-X-CK1wU9lP.js";
2
- import { F as readThreadContext, yn as createAuthenticatedCliApiClient } from "../api-command-B-nuABGm.js";
1
+ import { Qt as getSentEmail } from "../repeats-Dj_o6c-X-jmlxD8_1.js";
2
+ import { F as readThreadContext, yn as createAuthenticatedCliApiClient } from "../api-command-BX7D2LxZ.js";
3
3
  import { AUTO_SIGNAL_KIND_ENV, AUTO_WORKING_RENEW_MS, autoSignalsDisabled, clearWorkingSending, markWorkingSending, readAutoClaim, readWorkingLease, recordRenewer, stopWorkingLease, writeWorkingLease } from "./auto-signals.js";
4
4
  import { _ as acquireListenLock } from "../shared-mail-files-BAQSGxxz.js";
5
- import { t as sendSignal } from "../signal-command-D4ZIidPX.js";
5
+ import { t as sendSignal } from "../signal-command-Dz3D14zv.js";
6
6
  import { join } from "node:path";
7
7
  import { homedir } from "node:os";
8
8
  // src/oclif/auto-signal-worker.ts
@@ -1,4 +1,4 @@
1
- import { n as isPlainChatReply, o as scopedChatSenderTrust } from "../scoped-chat-DN0qj4AY.js";
1
+ import { n as isPlainChatReply, o as scopedChatSenderTrust } from "../scoped-chat-CDkazRdx.js";
2
2
  import { d as readMailJson, h as writeMailJson, i as mailId, l as privateMailDirectory, r as mailAddress } from "../shared-mail-files-BAQSGxxz.js";
3
3
  import { existsSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
4
4
  import { randomUUID } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import { n as COMMAND_RENAMES } from "../cli-command-names-no0f7d7s.js";
1
+ import { n as COMMAND_RENAMES } from "../cli-command-names-DPG2eMQ_.js";
2
2
  import { i as jsonOutputRequested } from "../json-output-BMZrLH47.js";
3
3
  // src/oclif/command-not-found.ts
4
4
  /** At most this many commands are suggested for one word. */
@@ -1,15 +1,15 @@
1
- import { $ as replyExpectation, $t as readDomainsOrRefusal, A as bareAddress, An as fetchCliOrgs, At as cliInvocation, B as wakeReadCommand, Bn as operationManifest, Bt as NO_FOCUS, C as terminalApprovalIo, Cn as refuseOrgSelectionForProfile, Ct as sendOutcomeExitCode, D as listenForCopyHotkey, Dn as RESTRICTED_ROLE_NOTE, Dt as successfulSendOutcome, E as formatBrowserLoginInstructions, En as CliOrgRefusedError, Et as serializeErrorPayload, F as readThreadContext, Fn as switchCurrentOrg, Ft as loadSkillLine, G as clearReadPendingMail, Gn as validateActivityReason, Gt as focusForCorpus, H as wakeRelationship, Hn as PRIMITIVE_RUN_ID_HEADER, Ht as focusEmptyHint, I as sentInThread, In as routeWarningLines, It as currentMailSessionKey, J as recordPendingMail, Jt as loadSavedFocus, K as pendingMailPath, Kn as validateActivityRunId, Kt as focusProfile, L as serverMuted, Ln as sanitizeForTerminal, Lt as formatAlreadySentNotice, M as displayAddress, Mn as revokeUserLogin, N as formatMailWakeLine, Nn as roleKeyLabel, Nt as generatedAgentName, O as openBrowser, On as credentialsFromUserLogin, Ot as thrownErrorExitCode, P as latestOwnOutbound, Pn as roleKeyText, Pt as identitySuggestions, Q as readEmailInteraction, Qt as queryScopesItself, R as serverRelationship, Rn as shownLine, Rt as FOCUS_ENV, S as promptLine$2, Sn as refreshStoredCliCredentials, St as sendIdentityFields, T as canOfferCopyHotkey, Tn as selectedOrgFromEnv, Tt as sentHistoryWindowStart, U as claimPendingMail, Un as attachActivityContextFlags, Ut as focusFlagValues, V as wakeRecipientField, Vn as PRIMITIVE_REASON_HEADER, Vt as countFromMeta, W as clearConsumedPendingMail, Wn as cliActivityHeadersFromEnv, Wt as focusFlags, X as interactionHumanLine, Xt as normalizeDomainNames, Y as removePendingMail, Yt as manyDomainsSupported, Z as interactionNextActions, Zt as oneDomainAtATimeError, _ as writeErrorWithHints, _n as ConnectedAgentKeyRequiredError, _t as formatSendFailureSummary, a as agentPassErrorHint, an as writeFocusLine, at as apiResultHttpStatus, b as STEP_UP_TOKEN_FLAG_DESCRIPTION, bn as createCliApiClient, bt as reportSendCommandResult, c as extractErrorPayload, cn as mailReach, ct as buildThrownSendFailureEnvelope, d as isGrantRefusal, dn as isEmailId, dt as deriveSendIdempotencyKey, en as resolveDomainNames, et as replyInteractionWarning, f as networkErrorHint, fn as fetchBoundedPages, ft as excludeSignalReplies, g as surfaceUnauthorizedHint, gn as withAttachmentWait, gt as formatPriorRepliesWarning, h as runWithTiming, hn as ATTACHMENT_WAIT_MAX_MS, ht as formatPriorRepliesCheckSkipped, i as TIME_FLAG_DESCRIPTION, in as withoutFocus, it as SEND_OUTCOME_HELP, j as describeWake, jn as isBuiltInRoleKey, jt as connectNextSteps, k as explainPendingMailNotFound, kn as displayedRoleKey, l as formatErrorPayload, ln as readCallerMailFor, lt as checkPriorReplies, m as refusesCredential, mn as ATTACHMENT_WAIT_FLAG_DESCRIPTION, mt as formatDeletedEarlierSendNotice, n as API_ERROR_CODES, nn as saveFocus, nt as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, o as createOperationCommand, on as withFlagSuggestion, ot as assertValidIdempotencyKey, p as readTextFileFlag, pn as withBooleanFlagValues, pt as followUpCommandPrefix, q as readPendingMail, qt as joinNames, r as PAGED_LIMIT_MAX, rn as withFocusMeta, rt as MAX_SEND_WAIT_TIMEOUT_MS, s as extractErrorCode, sn as emptyEmailListHint, st as buildFollowUpCommand, t as API_BASE_URL_FLAG_DESCRIPTION, tn as resolveFocus, u as hasControlCharacter$1, un as formatFact, ut as classifySendError, v as BROWSER_FLAG_DESCRIPTION, vt as formatSendRecordFailureSummary, w as withApproval, wn as resolveCliApiRequestConfig, wt as sendWaitClampNotice, x as approveThenRerunHint, xn as mergeHeadersCaseInsensitive, xt as sendErrorMessage, y as STEP_UP_HEADER$1, yn as createAuthenticatedCliApiClient, yt as priorRepliesThatWentOut, zn as setKnownCommands, zt as FOCUS_SERVER_SUPPORT } from "../api-command-B-nuABGm.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-no0f7d7s.js";
1
+ import { $ as replyExpectation, $t as readDomainsOrRefusal, A as bareAddress, An as fetchCliOrgs, At as cliInvocation, B as wakeReadCommand, Bn as operationManifest, Bt as NO_FOCUS, C as terminalApprovalIo, Cn as refuseOrgSelectionForProfile, Ct as sendOutcomeExitCode, D as listenForCopyHotkey, Dn as RESTRICTED_ROLE_NOTE, Dt as successfulSendOutcome, E as formatBrowserLoginInstructions, En as CliOrgRefusedError, Et as serializeErrorPayload, F as readThreadContext, Fn as switchCurrentOrg, Ft as loadSkillLine, G as clearReadPendingMail, Gn as validateActivityReason, Gt as focusForCorpus, H as wakeRelationship, Hn as PRIMITIVE_RUN_ID_HEADER, Ht as focusEmptyHint, I as sentInThread, In as routeWarningLines, It as currentMailSessionKey, J as recordPendingMail, Jt as loadSavedFocus, K as pendingMailPath, Kn as validateActivityRunId, Kt as focusProfile, L as serverMuted, Ln as sanitizeForTerminal, Lt as formatAlreadySentNotice, M as displayAddress, Mn as revokeUserLogin, N as formatMailWakeLine, Nn as roleKeyLabel, Nt as generatedAgentName, O as openBrowser, On as credentialsFromUserLogin, Ot as thrownErrorExitCode, P as latestOwnOutbound, Pn as roleKeyText, Pt as identitySuggestions, Q as readEmailInteraction, Qt as queryScopesItself, R as serverRelationship, Rn as shownLine, Rt as FOCUS_ENV, S as promptLine$2, Sn as refreshStoredCliCredentials, St as sendIdentityFields, T as canOfferCopyHotkey, Tn as selectedOrgFromEnv, Tt as sentHistoryWindowStart, U as claimPendingMail, Un as attachActivityContextFlags, Ut as focusFlagValues, V as wakeRecipientField, Vn as PRIMITIVE_REASON_HEADER, Vt as countFromMeta, W as clearConsumedPendingMail, Wn as cliActivityHeadersFromEnv, Wt as focusFlags, X as interactionHumanLine, Xt as normalizeDomainNames, Y as removePendingMail, Yt as manyDomainsSupported, Z as interactionNextActions, Zt as oneDomainAtATimeError, _ as writeErrorWithHints, _n as ConnectedAgentKeyRequiredError, _t as formatSendFailureSummary, a as agentPassErrorHint, an as writeFocusLine, at as apiResultHttpStatus, b as STEP_UP_TOKEN_FLAG_DESCRIPTION, bn as createCliApiClient, bt as reportSendCommandResult, c as extractErrorPayload, cn as mailReach, ct as buildThrownSendFailureEnvelope, d as isGrantRefusal, dn as isEmailId, dt as deriveSendIdempotencyKey, en as resolveDomainNames, et as replyInteractionWarning, f as networkErrorHint, fn as fetchBoundedPages, ft as excludeSignalReplies, g as surfaceUnauthorizedHint, gn as withAttachmentWait, gt as formatPriorRepliesWarning, h as runWithTiming, hn as ATTACHMENT_WAIT_MAX_MS, ht as formatPriorRepliesCheckSkipped, i as TIME_FLAG_DESCRIPTION, in as withoutFocus, it as SEND_OUTCOME_HELP, j as describeWake, jn as isBuiltInRoleKey, jt as connectNextSteps, k as explainPendingMailNotFound, kn as displayedRoleKey, l as formatErrorPayload, ln as readCallerMailFor, lt as checkPriorReplies, m as refusesCredential, mn as ATTACHMENT_WAIT_FLAG_DESCRIPTION, mt as formatDeletedEarlierSendNotice, n as API_ERROR_CODES, nn as saveFocus, nt as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, o as createOperationCommand, on as withFlagSuggestion, ot as assertValidIdempotencyKey, p as readTextFileFlag, pn as withBooleanFlagValues, pt as followUpCommandPrefix, q as readPendingMail, qt as joinNames, r as PAGED_LIMIT_MAX, rn as withFocusMeta, rt as MAX_SEND_WAIT_TIMEOUT_MS, s as extractErrorCode, sn as emptyEmailListHint, st as buildFollowUpCommand, t as API_BASE_URL_FLAG_DESCRIPTION, tn as resolveFocus, u as hasControlCharacter$1, un as formatFact, ut as classifySendError, v as BROWSER_FLAG_DESCRIPTION, vt as formatSendRecordFailureSummary, w as withApproval, wn as resolveCliApiRequestConfig, wt as sendWaitClampNotice, x as approveThenRerunHint, xn as mergeHeadersCaseInsensitive, xt as sendErrorMessage, y as STEP_UP_HEADER$1, yn as createAuthenticatedCliApiClient, yt as priorRepliesThatWentOut, zn as setKnownCommands, zt as FOCUS_SERVER_SUPPORT } from "../api-command-BX7D2LxZ.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-DPG2eMQ_.js";
3
3
  import { ignoreArgumentStdin } from "./command-stdin.js";
4
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-CK1wU9lP.js";
6
- import { C as installedVersion, S as installedConnectSkillFile, T as readBundledSkill, _ as NotificationOutcomeUnknownError, a as NotificationRetryError, b as connectSkillTarget, 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 CONNECT_SKILL_NAME, w as readBundledConnectSkill, x as installSkill, y as bundledSkillNames } from "../notify-session-CM4_ZYe9.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-jmlxD8_1.js";
6
+ import { C as installedVersion, S as installedConnectSkillFile, T as readBundledSkill, _ as NotificationOutcomeUnknownError, a as NotificationRetryError, b as connectSkillTarget, 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 CONNECT_SKILL_NAME, w as readBundledConnectSkill, x as installSkill, y as bundledSkillNames } from "../notify-session-CmoGM6h8.js";
7
7
  import { $ as agentPassMetadata, A as removeCliLockState, B as agentProfileDirectory, D as CliAuthLockedError, E as saveSignupCredentials, F as loadChatConversationByLocalId, G as loadConnectedAgentProfile, H as agentProfilesDirectory, I as saveActiveChatState, L as AGENT_ADDRESS_ENV, M as chatStatePath, N as deleteChatState, O as parseUnlockDurationSeconds, P as loadActiveChatState, Q as AgentPassAuthError, R as AGENT_PROFILE_ENV, S as loadCliCredentials, T as saveCliCredentials, V as agentProfileName, Y as requireDefaultLoginProfile, Z as AGENT_PASS_PROFILE_ENV, _ as credentialsPath, a as normalizeCliEnvironmentName, at as parseAccessPassInput, b as detectPrimitiveKeyEnvMisname, c as removeCliEnvironment, ct as revokeAccessPassRemote, d as upsertCliEnvironment, dt as detectAgentRuntime, et as agentPassTokenSha256, ft as detectRuntimeSession, g as credentialsLockPath, h as cliAccessTokenExpiresAt, i as loadCliConfig, it as loadCachedAgentPassByToken, j as writeCliLockState, k as readCliLockState, l as resolveConfigEnvironment, lt as saveAgentPass, m as acquireCliCredentialsLock, mt as PrimitiveApiClient, n as deleteCliConfig, nt as deleteAgentPass, o as parseHeaderAssignment, ot as readAgentPassFile, pt as runtimeSessionVariableList, r as emptyCliConfig, s as redactCliEnvironment, st as resolveAgentPassSlot, tt as claimAccessPassRemote, u as saveCliConfig, ut as syncAgentPassMetadataFromGrant, v as deleteCliCredentials, w as resolveCliAuth, x as hasStoredCliLogin, y as deleteCliCredentialsLock, z as AgentConnectionSetupError } from "../cli-config-CwZJQIcn.js";
8
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";
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-1utuweTi.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-DN0qj4AY.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-B8Z4GZ6-.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-CDkazRdx.js";
11
11
  import { autoSignalEligible, dispatchAutoRead, dispatchAutoWorking, haltAutoWorking, isSentSignal, readWorkingLease, restoreAutoWorking } from "./auto-signals.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-D4ZIidPX.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-Dz3D14zv.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";
@@ -8923,19 +8923,28 @@ async function callActivityApi(options) {
8923
8923
  if (!response.ok) {
8924
8924
  let message = `Primitive API returned HTTP ${response.status}.`;
8925
8925
  let code;
8926
+ let details;
8926
8927
  try {
8927
8928
  const parsed = JSON.parse(rawText);
8928
8929
  code = parsed.error?.code;
8929
8930
  if (parsed.error?.message) message = parsed.error.message;
8931
+ if (parsed.error?.details && typeof parsed.error.details === "object") details = parsed.error.details;
8930
8932
  } catch {
8931
8933
  const sanitized = sanitizeErrorText(rawText);
8932
8934
  if (sanitized) message = sanitized;
8933
8935
  }
8936
+ const existingActivity = details?.activity && typeof details.activity === "object" ? details.activity : null;
8937
+ const conflictMetaParts = [];
8938
+ if (existingActivity?.started_at) conflictMetaParts.push(`started ${existingActivity.started_at}`);
8939
+ if (existingActivity?.claim_expires_at) conflictMetaParts.push(`claim expires ${existingActivity.claim_expires_at}`);
8940
+ const conflictSummary = response.status === 409 && existingActivity ? ` Existing activity ${existingActivity.id ?? "unknown"} [${existingActivity.status ?? "unknown"}] rev ${existingActivity.revision ?? "?"}${conflictMetaParts.length > 0 ? ` (${conflictMetaParts.join(", ")})` : ""}.` : "";
8934
8941
  const hint = code === "grant_forbidden" ? " Check whether this credential holds mail.activity:read / mail.activity:write." : code === "access_reason_required" ? " Pass --reason \"...\" or set PRIMITIVE_REASON." : code === "feature_not_enabled" ? " Mail activity tracking is not enabled for this organization." : code === "activity_header_invalid" ? " Check --reason / PRIMITIVE_REASON (1-500 printable ASCII) and --run-id / PRIMITIVE_RUN_ID ([A-Za-z0-9._:/-], 1-128 chars)." : "";
8935
- throw new Errors.CLIError(`${message}${hint}`, {
8942
+ const cliErr = new Errors.CLIError(`${message}${conflictSummary}${hint}`, {
8936
8943
  exit: 1,
8937
8944
  ...code ? { code } : {}
8938
8945
  });
8946
+ if (details) cliErr.details = details;
8947
+ throw cliErr;
8939
8948
  }
8940
8949
  if (options.rawText) return {
8941
8950
  data: void 0,
@@ -11826,8 +11835,8 @@ const PRIMITIVE_TEAM_AUTHOR = {
11826
11835
  name: "Primitive Team",
11827
11836
  url: "https://primitive.dev"
11828
11837
  };
11829
- const SDK_VERSION_RANGE = "^3.0.0-preview.27";
11830
- const CLI_VERSION_RANGE = "^3.0.0-preview.27";
11838
+ const SDK_VERSION_RANGE = "^3.0.0-preview.29";
11839
+ const CLI_VERSION_RANGE = "^3.0.0-preview.29";
11831
11840
  const ESBUILD_VERSION_RANGE = "^0.27.0";
11832
11841
  function renderHandler() {
11833
11842
  return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
@@ -21665,8 +21674,8 @@ const COMMON_API_FLAGS = {
21665
21674
  };
21666
21675
  var ActivityLogCommand = class ActivityLogCommand extends Command {
21667
21676
  static summary = "Log an agent work note, external action outcome, or handoff";
21668
- static description = "Record structured work on a Primitive email or thread so humans and other agents see what already happened. Supply a deterministic --idempotency-key per (thread, action) so retries update the same entry cleanly.";
21669
- static examples = [`<%= config.bin %> activity log --email <email-id> --action brex.upload_invoice --status succeeded --summary "Uploaded Acme invoice #412 to Brex" --ref-system brex --ref-id inv_412 --idempotency-key brex.upload_invoice:v1`, `<%= config.bin %> activity log --thread <thread-id> --kind handoff --status needs_review --summary "Personal invoice detected; needs confirmation"`];
21677
+ static description = "Record structured work on a Primitive email or thread so humans and other agents see what already happened. Without --idempotency-key every call appends a new row. With --idempotency-key (scoped per thread and actor), retries update in place; add --if-absent and --claim-ttl to atomically claim work across replicas.";
21678
+ static examples = [`<%= config.bin %> activity log --email <email-id> --action brex.upload_invoice --status started --summary "Uploading Acme invoice #412 to Brex" --idempotency-key brex.upload_invoice:<email-id> --if-absent --claim-ttl 300`, `<%= config.bin %> activity log --thread <thread-id> --kind handoff --action brex.review_receipt --status needs_review --summary "Personal invoice detected; needs confirmation"`];
21670
21679
  static args = { summary: Args.string({
21671
21680
  description: "Optional positional summary (alternative to --summary)",
21672
21681
  required: false
@@ -21705,7 +21714,9 @@ var ActivityLogCommand = class ActivityLogCommand extends Command {
21705
21714
  env: "PRIMITIVE_RUN_ID"
21706
21715
  }),
21707
21716
  "trace-url": Flags.string({ description: "Optional https:// URL to the agent execution trace" }),
21708
- "idempotency-key": Flags.string({ description: "Deterministic key per (thread, action) so retries upsert in place" }),
21717
+ "idempotency-key": Flags.string({ description: "Optional key scoped per (thread, actor). Reusing it updates in place; omit to append a new row" }),
21718
+ "if-absent": Flags.boolean({ description: "With --idempotency-key: atomically create only if no active/completed activity exists (takes over expired started claims; otherwise exits with 409 conflict)" }),
21719
+ "claim-ttl": Flags.integer({ description: "Claim lease TTL in seconds (1 to 86400) for status=started entries; after expiry, another replica can take over via --if-absent" }),
21709
21720
  visibility: Flags.string({
21710
21721
  description: "Visibility: thread (default, shared) or actor_only (private)",
21711
21722
  options: [...ACTIVITY_VISIBILITIES]
@@ -21725,6 +21736,8 @@ var ActivityLogCommand = class ActivityLogCommand extends Command {
21725
21736
  const sentEmailId = flags["sent-email"] !== void 0 ? assertUuid(flags["sent-email"], "--sent-email") : void 0;
21726
21737
  if (flags.action !== void 0 && !ACTION_SLUG_RE.test(flags.action.trim())) throw new Errors.CLIError("--action must start with a lowercase letter or digit and use only a-z, 0-9, ., _, :, - (max 128 chars).", { exit: 2 });
21727
21738
  if (flags["idempotency-key"] !== void 0 && !IDEMPOTENCY_KEY_RE.test(flags["idempotency-key"].trim())) throw new Errors.CLIError("--idempotency-key must be 1 to 255 printable ASCII characters without spaces.", { exit: 2 });
21739
+ if (flags["if-absent"] && !flags["idempotency-key"]?.trim()) throw new Errors.CLIError("--if-absent requires --idempotency-key <key>.", { exit: 2 });
21740
+ if (flags["claim-ttl"] !== void 0 && (flags["claim-ttl"] < 1 || flags["claim-ttl"] > 86400)) throw new Errors.CLIError("--claim-ttl must be an integer between 1 and 86400 seconds.", { exit: 2 });
21728
21741
  const detail = flags["detail-file"] !== void 0 ? readUtf8File(flags["detail-file"], "--detail-file") : flags.detail;
21729
21742
  if (detail !== void 0 && detail.length > 8e3) throw new Errors.CLIError("Detail must be at most 8000 characters.", { exit: 2 });
21730
21743
  const data = flags["data-file"] !== void 0 ? parseJsonObjectFlag(readUtf8File(flags["data-file"], "--data-file"), "--data-file") : flags.data !== void 0 ? parseJsonObjectFlag(flags.data, "--data") : void 0;
@@ -21743,6 +21756,8 @@ var ActivityLogCommand = class ActivityLogCommand extends Command {
21743
21756
  ...runId ? { run_id: runId } : {},
21744
21757
  ...traceUrl ? { trace_url: traceUrl } : {},
21745
21758
  ...flags["idempotency-key"] ? { idempotency_key: flags["idempotency-key"].trim() } : {},
21759
+ ...flags["if-absent"] ? { if_absent: true } : {},
21760
+ ...flags["claim-ttl"] !== void 0 ? { claim_ttl_seconds: flags["claim-ttl"] } : {},
21746
21761
  ...flags.visibility ? { visibility: flags.visibility } : {}
21747
21762
  };
21748
21763
  const path = threadId ? `/threads/${threadId}/activities` : `/emails/${emailId}/activities`;
@@ -21806,6 +21821,9 @@ var ActivityUpdateCommand = class ActivityUpdateCommand extends Command {
21806
21821
  description: "Updated visibility: thread or actor_only",
21807
21822
  options: [...ACTIVITY_VISIBILITIES]
21808
21823
  }),
21824
+ "claim-ttl": Flags.integer({ description: "Updated claim lease TTL in seconds (1 to 86400) when status is started" }),
21825
+ "clear-claim-ttl": Flags.boolean({ description: "Clear claim_expires_at (sets null)" }),
21826
+ "if-revision": Flags.integer({ description: "Expected current revision for compare-and-set updates (exits with 409 conflict if modified since)" }),
21809
21827
  ...COMMON_API_FLAGS
21810
21828
  };
21811
21829
  async run() {
@@ -21844,7 +21862,17 @@ var ActivityUpdateCommand = class ActivityUpdateCommand extends Command {
21844
21862
  if (flags["clear-trace-url"]) body.trace_url = null;
21845
21863
  else if (flags["trace-url"] !== void 0) body.trace_url = assertHttpUrl(flags["trace-url"], "--trace-url");
21846
21864
  if (flags.visibility) body.visibility = flags.visibility;
21865
+ if (flags["clear-claim-ttl"] && flags["claim-ttl"] !== void 0) throw new Errors.CLIError("--clear-claim-ttl cannot be combined with --claim-ttl.", { exit: 2 });
21866
+ if (flags["clear-claim-ttl"]) body.claim_ttl_seconds = null;
21867
+ else if (flags["claim-ttl"] !== void 0) {
21868
+ if (flags["claim-ttl"] < 1 || flags["claim-ttl"] > 86400) throw new Errors.CLIError("--claim-ttl must be an integer between 1 and 86400 seconds.", { exit: 2 });
21869
+ body.claim_ttl_seconds = flags["claim-ttl"];
21870
+ }
21847
21871
  if (Object.keys(body).length === 0) throw new Errors.CLIError("Provide at least one field to update.", { exit: 2 });
21872
+ if (flags["if-revision"] !== void 0) {
21873
+ if (flags["if-revision"] < 1) throw new Errors.CLIError("--if-revision must be at least 1.", { exit: 2 });
21874
+ body.if_revision = flags["if-revision"];
21875
+ }
21848
21876
  await runWithTiming(flags.time === true, async () => {
21849
21877
  const result = await callActivityApi({
21850
21878
  configDir: this.config.configDir,
@@ -21888,6 +21916,7 @@ var ActivityTimelineCommand = class ActivityTimelineCommand extends Command {
21888
21916
  options: [...ACTIVITY_OWNERSHIPS]
21889
21917
  }),
21890
21918
  "actor-id": Flags.string({ description: "Filter by specific actor UUID" }),
21919
+ "agent-id": Flags.string({ description: "Filter by durable Agent identity UUID" }),
21891
21920
  "run-id": Flags.string({ description: "Filter by run_id" }),
21892
21921
  "include-private": Flags.boolean({ description: "Include other actors' actor_only rows (requires activity:read)" }),
21893
21922
  order: Flags.string({
@@ -21909,6 +21938,7 @@ var ActivityTimelineCommand = class ActivityTimelineCommand extends Command {
21909
21938
  const threadId = assertUuid(args.thread_id, "thread_id");
21910
21939
  const status = flags.status !== void 0 ? validateStatusCsv(flags.status) : void 0;
21911
21940
  const actorId = flags["actor-id"] !== void 0 ? assertUuid(flags["actor-id"], "--actor-id") : void 0;
21941
+ const agentId = flags["agent-id"] !== void 0 ? assertUuid(flags["agent-id"], "--agent-id") : void 0;
21912
21942
  await runWithTiming(flags.time === true, async () => {
21913
21943
  const result = await callActivityApi({
21914
21944
  configDir: this.config.configDir,
@@ -21924,6 +21954,7 @@ var ActivityTimelineCommand = class ActivityTimelineCommand extends Command {
21924
21954
  action: flags.action,
21925
21955
  actor_ownership: flags["actor-ownership"],
21926
21956
  actor_id: actorId,
21957
+ agent_id: agentId,
21927
21958
  run_id: flags["run-id"],
21928
21959
  include_private: flags["include-private"] ? "true" : void 0,
21929
21960
  order: flags.order,
@@ -21974,6 +22005,7 @@ var ActivityListCommand = class ActivityListCommand extends Command {
21974
22005
  options: [...ACTIVITY_OWNERSHIPS]
21975
22006
  }),
21976
22007
  "actor-id": Flags.string({ description: "Filter by actor UUID" }),
22008
+ "agent-id": Flags.string({ description: "Filter by durable Agent identity UUID" }),
21977
22009
  "owner-user-id": Flags.string({ description: "Filter by human owner user UUID" }),
21978
22010
  "oauth-client-id": Flags.string({ description: "Filter by OAuth client ID" }),
21979
22011
  "run-id": Flags.string({ description: "Filter by run_id" }),
@@ -22010,6 +22042,7 @@ var ActivityListCommand = class ActivityListCommand extends Command {
22010
22042
  actor_kind: flags["actor-kind"],
22011
22043
  actor_ownership: flags["actor-ownership"],
22012
22044
  actor_id: flags["actor-id"] !== void 0 ? assertUuid(flags["actor-id"], "--actor-id") : void 0,
22045
+ agent_id: flags["agent-id"] !== void 0 ? assertUuid(flags["agent-id"], "--agent-id") : void 0,
22013
22046
  owner_user_id: flags["owner-user-id"] !== void 0 ? assertUuid(flags["owner-user-id"], "--owner-user-id") : void 0,
22014
22047
  oauth_client_id: flags["oauth-client-id"],
22015
22048
  run_id: flags["run-id"],
@@ -1,6 +1,6 @@
1
1
  import { B as agentProfileDirectory, G as loadConnectedAgentProfile, R as AGENT_PROFILE_ENV, V as agentProfileName, dt as detectAgentRuntime } from "../cli-config-CwZJQIcn.js";
2
2
  import { a as backgroundListenStatus, i as backgroundListenRestartable, s as claimBackgroundListenRestart, t as BACKGROUND_LISTEN_RELAUNCH_ENV } from "../listen-background-DyBYca28.js";
3
- import { d as SESSION_UUID, t as notificationScope } from "../notify-session-CM4_ZYe9.js";
3
+ import { d as SESSION_UUID, t as notificationScope } from "../notify-session-CmoGM6h8.js";
4
4
  import { d as readMailJson } from "../shared-mail-files-BAQSGxxz.js";
5
5
  import { join } from "node:path";
6
6
  import { spawn } from "node:child_process";
@@ -50,6 +50,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
50
50
  agentWorkWithdrawDeadline: () => agentWorkWithdrawDeadline,
51
51
  amendEmailRuleObjection: () => amendEmailRuleObjection,
52
52
  awaitReply: () => awaitReply,
53
+ bindAgentCredential: () => bindAgentCredential,
53
54
  cancelSentEmail: () => cancelSentEmail,
54
55
  cancelSentEmailByIdempotencyKey: () => cancelSentEmailByIdempotencyKey,
55
56
  checkDefaultNetworkContactAdmission: () => checkDefaultNetworkContactAdmission,
@@ -57,11 +58,13 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
57
58
  checkEmailRuleRequestTarget: () => checkEmailRuleRequestTarget,
58
59
  checkSendability: () => checkSendability,
59
60
  checkVanityInboxName: () => checkVanityInboxName,
61
+ claimAgentAddress: () => claimAgentAddress,
60
62
  claimAgentConnection: () => claimAgentConnection,
61
63
  claimVanityInboxName: () => claimVanityInboxName,
62
64
  cliLogout: () => cliLogout,
63
65
  compileEmailRule: () => compileEmailRule,
64
66
  completeWebhookEvent: () => completeWebhookEvent,
67
+ createAgent: () => createAgent,
65
68
  createAgentAccount: () => createAgentAccount,
66
69
  createAgentClaimLink: () => createAgentClaimLink,
67
70
  createAgentConnection: () => createAgentConnection,
@@ -124,6 +127,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
124
127
  getAccessMode: () => getAccessMode,
125
128
  getAccount: () => getAccount,
126
129
  getAddressNote: () => getAddressNote,
130
+ getAgent: () => getAgent,
127
131
  getAgentConnectionSettings: () => getAgentConnectionSettings,
128
132
  getAgentContactPolicy: () => getAgentContactPolicy,
129
133
  getContact: () => getContact,
@@ -201,6 +205,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
201
205
  listAgentConnections: () => listAgentConnections,
202
206
  listAgentContacts: () => listAgentContacts,
203
207
  listAgentNetworks: () => listAgentNetworks,
208
+ listAgents: () => listAgents,
204
209
  listBreakGlass: () => listBreakGlass,
205
210
  listChanges: () => listChanges,
206
211
  listCliOrgs: () => listCliOrgs,
@@ -268,6 +273,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
268
273
  lookupFunction: () => lookupFunction,
269
274
  markThreadRead: () => markThreadRead,
270
275
  muteThread: () => muteThread,
276
+ pauseAgent: () => pauseAgent,
271
277
  pollCliLogin: () => pollCliLogin,
272
278
  prepareContactAcceptance: () => prepareContactAcceptance,
273
279
  prepareContactRequest: () => prepareContactRequest,
@@ -282,6 +288,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
282
288
  reconcileGoogleMailImport: () => reconcileGoogleMailImport,
283
289
  redeemCreditCode: () => redeemCreditCode,
284
290
  redeployFunction: () => redeployFunction,
291
+ releaseAgentAddress: () => releaseAgentAddress,
285
292
  releaseSentEmail: () => releaseSentEmail,
286
293
  removeAgentConnection: () => removeAgentConnection,
287
294
  removeDefaultNetworkMember: () => removeDefaultNetworkMember,
@@ -297,6 +304,8 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
297
304
  rescheduleSentEmail: () => rescheduleSentEmail,
298
305
  resendAgentSignupVerification: () => resendAgentSignupVerification,
299
306
  resendCliSignupVerification: () => resendCliSignupVerification,
307
+ resumeAgent: () => resumeAgent,
308
+ retireAgent: () => retireAgent,
300
309
  revokeAgentConnection: () => revokeAgentConnection,
301
310
  revokeAllCredentials: () => revokeAllCredentials,
302
311
  revokeCredential: () => revokeCredential,
@@ -341,9 +350,11 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
341
350
  testEndpointRules: () => testEndpointRules,
342
351
  testFunction: () => testFunction,
343
352
  transferOwnedItems: () => transferOwnedItems,
353
+ unbindAgentCredential: () => unbindAgentCredential,
344
354
  unmuteThread: () => unmuteThread,
345
355
  unsetFunctionRoute: () => unsetFunctionRoute,
346
356
  updateAccount: () => updateAccount,
357
+ updateAgent: () => updateAgent,
347
358
  updateAgentConnectionSettings: () => updateAgentConnectionSettings,
348
359
  updateCredentialPolicy: () => updateCredentialPolicy,
349
360
  updateDefaultNetworkMember: () => updateDefaultNetworkMember,
@@ -6112,6 +6123,173 @@ const listMailActivityActors = (options) => (options?.client ?? client).get({
6112
6123
  url: "/activity/mail/actors",
6113
6124
  ...options
6114
6125
  });
6126
+ /**
6127
+ * List durable agent identities in the organization
6128
+ *
6129
+ * Lists durable per-organization agent identities along with their active claimed addresses, credential counts, owner attribution, and lifecycle status.
6130
+ */
6131
+ const listAgents = (options) => (options?.client ?? client).get({
6132
+ security: [{
6133
+ scheme: "bearer",
6134
+ type: "http"
6135
+ }],
6136
+ url: "/agents",
6137
+ ...options
6138
+ });
6139
+ /**
6140
+ * Create a durable agent identity
6141
+ *
6142
+ * Creates a durable per-organization agent identity decoupled from individual API keys or OAuth grants.
6143
+ */
6144
+ const createAgent = (options) => (options.client ?? client).post({
6145
+ security: [{
6146
+ scheme: "bearer",
6147
+ type: "http"
6148
+ }],
6149
+ url: "/agents",
6150
+ ...options,
6151
+ headers: {
6152
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
6153
+ ...options.headers
6154
+ }
6155
+ });
6156
+ /**
6157
+ * Get a durable agent identity with credentials and claimed addresses
6158
+ *
6159
+ * Returns full details for one agent identity, including active and retired claimed addresses and bound credentials.
6160
+ */
6161
+ const getAgent = (options) => (options.client ?? client).get({
6162
+ security: [{
6163
+ scheme: "bearer",
6164
+ type: "http"
6165
+ }],
6166
+ url: "/agents/{id}",
6167
+ ...options
6168
+ });
6169
+ /**
6170
+ * Update a durable agent identity
6171
+ *
6172
+ * Updates an agent identity's name, description, accountable owner, owning group, vendor metadata, or upper-bound envelope grant.
6173
+ */
6174
+ const updateAgent = (options) => (options.client ?? client).patch({
6175
+ security: [{
6176
+ scheme: "bearer",
6177
+ type: "http"
6178
+ }],
6179
+ url: "/agents/{id}",
6180
+ ...options,
6181
+ headers: {
6182
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
6183
+ ...options.headers
6184
+ }
6185
+ });
6186
+ /**
6187
+ * Pause an agent identity and hold queued outbound work
6188
+ *
6189
+ * Pauses the agent across all bound credentials (returning 403 agent_paused instead of 401), holds scheduled sends, pauses repeating sends and wake schedules, and holds pending drafts.
6190
+ */
6191
+ const pauseAgent = (options) => (options.client ?? client).post({
6192
+ security: [{
6193
+ scheme: "bearer",
6194
+ type: "http"
6195
+ }],
6196
+ url: "/agents/{id}/pause",
6197
+ ...options,
6198
+ headers: {
6199
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
6200
+ ...options.headers
6201
+ }
6202
+ });
6203
+ /**
6204
+ * Resume a paused agent identity
6205
+ *
6206
+ * Returns a paused agent to active status, restoring paused wake schedules and held drafts. Held scheduled sends stay held unless release_held_sends is true.
6207
+ */
6208
+ const resumeAgent = (options) => (options.client ?? client).post({
6209
+ security: [{
6210
+ scheme: "bearer",
6211
+ type: "http"
6212
+ }],
6213
+ url: "/agents/{id}/resume",
6214
+ ...options,
6215
+ headers: {
6216
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
6217
+ ...options.headers
6218
+ }
6219
+ });
6220
+ /**
6221
+ * Permanently retire an agent identity
6222
+ *
6223
+ * Permanently retires the agent (bound credentials return 403 agent_retired), cancels queued sends, repeating sends, wake schedules, and pending drafts, and retires claimed addresses.
6224
+ */
6225
+ const retireAgent = (options) => (options.client ?? client).post({
6226
+ security: [{
6227
+ scheme: "bearer",
6228
+ type: "http"
6229
+ }],
6230
+ url: "/agents/{id}/retire",
6231
+ ...options
6232
+ });
6233
+ /**
6234
+ * Bind an API key or OAuth grant to an agent identity
6235
+ *
6236
+ * Binds an existing API key or OAuth grant to an agent identity and backfills historical thread activities onto the agent identity with deterministic collision folding.
6237
+ */
6238
+ const bindAgentCredential = (options) => (options.client ?? client).post({
6239
+ security: [{
6240
+ scheme: "bearer",
6241
+ type: "http"
6242
+ }],
6243
+ url: "/agents/{id}/credentials",
6244
+ ...options,
6245
+ headers: {
6246
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
6247
+ ...options.headers
6248
+ }
6249
+ });
6250
+ /**
6251
+ * Unbind a credential from an agent identity
6252
+ *
6253
+ * Detaches an API key or OAuth grant from an agent identity while preserving historical ledger rows.
6254
+ */
6255
+ const unbindAgentCredential = (options) => (options.client ?? client).delete({
6256
+ security: [{
6257
+ scheme: "bearer",
6258
+ type: "http"
6259
+ }],
6260
+ url: "/agents/{id}/credentials/{credential_id}",
6261
+ ...options
6262
+ });
6263
+ /**
6264
+ * Claim an optional mailbox address for an agent identity
6265
+ *
6266
+ * Claims an address on a verified organization domain with an enforced canonical From display name. Catch-all sending and receiving on unclaimed addresses remain unchanged.
6267
+ */
6268
+ const claimAgentAddress = (options) => (options.client ?? client).post({
6269
+ security: [{
6270
+ scheme: "bearer",
6271
+ type: "http"
6272
+ }],
6273
+ url: "/agents/{id}/addresses",
6274
+ ...options,
6275
+ headers: {
6276
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
6277
+ ...options.headers
6278
+ }
6279
+ });
6280
+ /**
6281
+ * Release a claimed mailbox address from an agent identity
6282
+ *
6283
+ * Releases an active claimed address from an agent identity and records it as retired.
6284
+ */
6285
+ const releaseAgentAddress = (options) => (options.client ?? client).delete({
6286
+ security: [{
6287
+ scheme: "bearer",
6288
+ type: "http"
6289
+ }],
6290
+ url: "/agents/{id}/addresses/{address_id}",
6291
+ ...options
6292
+ });
6115
6293
  // src/oclif/automated-filter.ts
6116
6294
  /**
6117
6295
  * The server-side `automated` verdict on inbound email: `automated`
@@ -1,4 +1,4 @@
1
- import { T as retryTransient, _ as isTrustedSender, c as classifySignalContent } from "./repeats-Dj_o6c-X-CK1wU9lP.js";
1
+ import { T as retryTransient, _ as isTrustedSender, c as classifySignalContent } from "./repeats-Dj_o6c-X-jmlxD8_1.js";
2
2
  // src/oclif/presence-provenance.ts
3
3
  function readPresenceProjection(detail) {
4
4
  if (!detail || typeof detail !== "object") return null;
@@ -1,15 +1,15 @@
1
- import { Gn as sendEmail, S as describeApiFailure, h as sendPreparedSignal, ht as createEndpoint, p as prepareSignalEmail, wn as listSentEmails, zt as getEmail } from "./repeats-Dj_o6c-X-CK1wU9lP.js";
2
- import { A as bareAddress, Dt as successfulSendOutcome, c as extractErrorPayload, ut as classifySendError } from "./api-command-B-nuABGm.js";
1
+ import { Gn as sendEmail, S as describeApiFailure, h as sendPreparedSignal, ht as createEndpoint, p as prepareSignalEmail, wn as listSentEmails, zt as getEmail } from "./repeats-Dj_o6c-X-jmlxD8_1.js";
2
+ import { A as bareAddress, Dt as successfulSendOutcome, c as extractErrorPayload, ut as classifySendError } from "./api-command-BX7D2LxZ.js";
3
3
  import { recordSentSignal } from "./oclif/auto-signals.js";
4
4
  import { _ as acquireListenLock, c as mailTime, d as readMailJson, f as removeMailFile, h as writeMailJson, i as mailId, l as privateMailDirectory, m as withMailLock, n as invalidSharedMail, o as mailObject, p as syncMailDirectory, r as mailAddress, s as mailString, t as SharedMailStateError, v as compareListenProcessIdentity, x as listenProcessIdentity, y as listenIdentity } from "./shared-mail-files-BAQSGxxz.js";
5
- import { i as readApiBeforeDeadline, n as isPlainChatReply, o as scopedChatSenderTrust } from "./scoped-chat-DN0qj4AY.js";
5
+ import { i as readApiBeforeDeadline, n as isPlainChatReply, o as scopedChatSenderTrust } from "./scoped-chat-CDkazRdx.js";
6
6
  import { n as tryOwnSharedMail, r as waitForSharedMailChange, t as readSharedMailOwner } from "./shared-mail-watch-DdtgJOrV.js";
7
7
  import { Errors } from "@oclif/core";
8
8
  import { opendirSync } from "node:fs";
9
9
  import { createHash, randomUUID, scryptSync } from "node:crypto";
10
10
  import { dirname, join } from "node:path";
11
11
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
12
- // ../sdk-node/dist/api-DIBTC4OT.js
12
+ // ../sdk-node/dist/api-DXhAtpt6.js
13
13
  const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
14
14
  function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
15
15
  let lastEventId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primcli",
3
- "version": "3.0.0-preview.27",
3
+ "version": "3.0.0-preview.29",
4
4
  "publishConfig": {
5
5
  "tag": "preview"
6
6
  },
@@ -192,6 +192,9 @@
192
192
  "activity": {
193
193
  "description": "Where you learn what others asked of you and did to your mail (`primitive activity asked`, `primitive activity concerning`, `primitive activity created`), and record or inspect verified mail activity events and shared agent work logs (`primitive activity log`, `update`, `timeline`, `list`, `agents`)."
194
194
  },
195
+ "agents": {
196
+ "description": "Manage durable per-organization agent identities, bind credentials, pause/resume/retire agents, and claim optional agent addresses (`primitive agents list|create|get|update|pause|resume|retire|bind-credential|unbind-credential|claim-address|release-address`)."
197
+ },
195
198
  "email-rules": {
196
199
  "description": "Rules written in plain English that pick out received mail"
197
200
  },