primcli 1.52.0 → 1.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
1
  import { A as saveActiveChatState, C as resolveCliAuth, D as deleteChatState, E as chatStatePath, F as agentProfilesDirectory, H as requireDefaultLoginProfile, M as AgentConnectionSetupError, N as agentProfileDirectory, O as loadActiveChatState, P as agentProfileName, R as loadConnectedAgentProfile, T as saveSignupCredentials, W as PrimitiveApiClient, _ as deleteCliCredentials, a as normalizeCliEnvironmentName, b as hasStoredCliLogin, c as resolveConfigEnvironment, g as credentialsPath, h as credentialsLockPath, i as loadCliConfig, j as AGENT_PROFILE_ENV, k as loadChatConversationByLocalId, 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 saveCliCredentials, x as loadCliCredentials, y as detectPrimitiveKeyEnvMisname } from "../cli-config-DGrZCUfw.js";
2
- import { $ as readEmailInteraction, $n as runWakeSchedule, $t as createFunction, A as readThreadContext, An as listDefaultNetworkAgents, At as writeIdempotentReplayBannerIfReplay, B as connectNextSteps, Bn as listWakeAuthorizations, Bt as hasAutomatedVerdict, C as queryUsesAwaiting, Cn as getRepeatingSend, Ct as sendWaitClampNotice, D as displayAddress, Dn as listAgentContacts, Dt as thrownErrorExitCode, E as describeWake, En as getWakeSchedule, Et as successfulSendOutcome, F as wakeReadCommand, Fn as listFunctionLogs, Ft as AutomatedFilterUnsupportedError, G as clearConsumedPendingMail, Gt as createCliApiClient, H as generatedAgentName, Hn as listWakeSchedules, Ht as queryUsesAutomated, I as wakeRecipientField, In as listFunctions, It as assertAutomatedVerdict, J as readPendingMail, Jn as redeemCreditCode, Jt as addDefaultNetworkMember, K as clearReadPendingMail, Kt as refreshStoredCliCredentials, L as wakeRelationship, Ln as listRepeatingSends, Lt as automatedRejectedError, M as serverMuted, Mn as listDomains, Mt as AUTOMATED_FILTER_UNSUPPORTED_CODE, N as serverRelationship, Nn as listEmails, Nt as AUTOMATED_FLAG_DESCRIPTION, O as formatMailWakeLine, On as listAgentNetworks, Ot as currentMailSessionKey, Pn as listEndpoints, Pt as AUTOMATED_VALUES, Q as interactionNextActions, Qn as resendAgentSignupVerification, Qt as createEndpoint, Rn as listRoutes, Rt as ensureSearchReportsAutomated, S as isAwaitingRejectedError, Sn as getOrgRoutingTopology, St as sendOutcomeExitCode, T as bareAddress, Tn as getThread, Tt as serializeErrorPayload, U as identitySuggestions, Un as pollCliLogin, Vn as listWakeDispatches, Vt as isAutomatedRejectedError, W as loadSkillLine, Wn as pullWebhookEvent, Wt as createAuthenticatedCliApiClient, X as removePendingMail, Xn as reorderRoutes, Xt as cliLogout, Y as recordPendingMail, Yn as removeDefaultNetworkMember, Yt as checkDefaultNetworkContactAdmission, Z as interactionHumanLine, Zn as replyToEmail, Zt as completeWebhookEvent, _ as awaitingRejectedError, _n as getFunction, _r as updateRoute, _t as formatSendFailureSummary, a as extractErrorCode, an as deleteMemory, ar as setFunctionSecret, at as SEND_OUTCOME_HELP, b as formatRepliesCell, bn as getInboxStatus, br as verifyAgentClaim, bt as reportSendCommandResult, c as readTextFileFlag, cn as deleteWakeSchedule, cr as startAgentClaim, ct as buildFollowUpCommand, d as writeErrorWithHints, dn as getAgentContactPolicy, dr as stopRepeatFromEmail, dt as classifySendError, en as createRoute, er as searchEmails, et as replyExpectation, f as AWAITING_FLAG_DESCRIPTION, fr as testFunction, ft as deriveSendIdempotencyKey, g as assertAwaitingFilterRows, gn as getEmail, gr as updateRepeatingSend, gt as formatPriorRepliesWarning, h as ReplyStateUnsupportedError, hn as getDefaultNetworkAgent, hr as updateFunction, ht as formatPriorRepliesCheckSkipped, i as createOperationCommand, ir as setFunctionRoute, it as MAX_SEND_WAIT_TIMEOUT_MS, j as sentInThread, jn as listDefaultNetworkMembers, jt as withFlagSuggestion, k as latestOwnOutbound, kt as formatAlreadySentNotice, l as runWithTiming, lr as startAgentSignup, lt as buildThrownSendFailureEnvelope, m as REPLY_STATE_UNSUPPORTED_CODE, mn as getCreditBalance, mr as updateDefaultNetworkMember, mt as formatDeletedEarlierSendNotice, n as API_ERROR_CODES, nn as createWakeSchedule, nr as semanticSearch, o as extractErrorPayload, on as deleteRoute, or as setMemory, ot as apiResultHttpStatus, p as AWAITING_VALUES, pn as getConversation, pr as unsetFunctionRoute, pt as excludeSignalReplies, q as pendingMailPath, qt as resolveCliApiRequestConfig, r as TIME_FLAG_DESCRIPTION, rr as sendEmail, rt as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, s as formatErrorPayload, sn as deleteWakeAuthorization, sr as simulateRoute, st as assertValidIdempotencyKey, t as API_BASE_URL_FLAG_DESCRIPTION, tn as createWakeAuthorization, tr as searchMemories, tt as replyInteractionWarning, u as surfaceUnauthorizedHint, un as getAccount, ur as startCliLogin, ut as checkPriorReplies, v as ensureSearchReportsReplyState, vn as getFunctionRouting, vr as updateWakeAuthorization, vt as formatSendRecordFailureSummary, w as explainPendingMailNotFound, wn as getSentEmail, wt as sentHistoryWindowStart, x as hasReplyState, xn as getMemory, xr as verifyAgentSignup, xt as sendIdentityFields, y as formatAwaitingCell, yn as getFunctionTestRunTrace, yr as updateWakeSchedule, yt as priorRepliesThatWentOut, z as cliInvocation, zn as listSentEmails, zt as expectedAutomatedVerdicts } from "../api-command-DWTysV8D.js";
2
+ import { $ as apiResultHttpStatus, $n as resendAgentSignupVerification, $t as createEndpoint, A as readThreadContext, At as formatAlreadySentNotice, B as pendingMailPath, Bn as listSentEmails, Bt as expectedAutomatedVerdicts, C as queryUsesAwaiting, Cn as getOrgRoutingTopology, Ct as cliInvocation, D as displayAddress, Dn as getWakeSchedule, Dt as identitySuggestions, E as describeWake, En as getThread, Et as generatedAgentName, F as wakeReadCommand, Fn as listEndpoints, Ft as AUTOMATED_VALUES, G as interactionNextActions, Gn as pullWebhookEvent, Gt as createAuthenticatedCliApiClient, H as recordPendingMail, Hn as listWakeDispatches, Ht as isAutomatedRejectedError, I as wakeRecipientField, In as listFunctionLogs, It as AutomatedFilterUnsupportedError, J as replyInteractionWarning, Jt as resolveCliApiRequestConfig, K as readEmailInteraction, Kt as createCliApiClient, L as wakeRelationship, Ln as listFunctions, Lt as assertAutomatedVerdict, M as serverMuted, Mn as listDefaultNetworkMembers, Mt as withFlagSuggestion, N as serverRelationship, Nn as listDomains, Nt as AUTOMATED_FILTER_UNSUPPORTED_CODE, O as formatMailWakeLine, On as listAgentContacts, Ot as loadSkillLine, Pn as listEmails, Pt as AUTOMATED_FLAG_DESCRIPTION, Q as SEND_OUTCOME_HELP, Qn as replyToEmail, Qt as completeWebhookEvent, R as clearConsumedPendingMail, Rn as listRepeatingSends, Rt as automatedRejectedError, S as isAwaitingRejectedError, Sn as getMemory, Sr as verifyAgentSignup, T as bareAddress, Tn as getSentEmail, U as removePendingMail, Un as listWakeSchedules, Ut as queryUsesAutomated, V as readPendingMail, Vn as listWakeAuthorizations, Vt as hasAutomatedVerdict, W as interactionHumanLine, Wn as pollCliLogin, X as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, Xn as removeDefaultNetworkMember, Xt as checkDefaultNetworkContactAdmission, Yn as redeemCreditCode, Yt as addDefaultNetworkMember, Z as MAX_SEND_WAIT_TIMEOUT_MS, Zn as reorderRoutes, Zt as cliLogout, _ as awaitingRejectedError, _n as getEmail, _r as updateRepeatingSend, _t as sendWaitClampNotice, a as extractErrorCode, ar as setFunctionRoute, at as deriveSendIdempotencyKey, b as formatRepliesCell, bn as getFunctionTestRunTrace, br as updateWakeSchedule, bt as successfulSendOutcome, c as readTextFileFlag, cn as deleteWakeAuthorization, cr as simulateRoute, ct as formatDeletedEarlierSendNotice, d as writeErrorWithHints, dn as getAccount, dr as startCliLogin, dt as formatSendFailureSummary, en as createFunction, er as runWakeSchedule, et as assertValidIdempotencyKey, f as AWAITING_FLAG_DESCRIPTION, fn as getAgentContactPolicy, fr as stopRepeatFromEmail, ft as formatSendRecordFailureSummary, g as assertAwaitingFilterRows, gn as getDefaultNetworkAgent, gr as updateFunction, gt as sendOutcomeExitCode, h as ReplyStateUnsupportedError, hn as getCreditBalance, hr as updateDefaultNetworkMember, ht as sendIdentityFields, i as createOperationCommand, ir as sendEmail, it as classifySendError, j as sentInThread, jn as listDefaultNetworkAgents, jt as writeIdempotentReplayBannerIfReplay, k as latestOwnOutbound, kn as listAgentNetworks, kt as currentMailSessionKey, l as runWithTiming, ln as deleteWakeSchedule, lr as startAgentClaim, lt as formatPriorRepliesCheckSkipped, m as REPLY_STATE_UNSUPPORTED_CODE, mn as getConversation, mr as unsetFunctionRoute, mt as reportSendCommandResult, n as API_ERROR_CODES, nn as createWakeAuthorization, nr as searchMemories, nt as buildThrownSendFailureEnvelope, o as extractErrorPayload, on as deleteMemory, or as setFunctionSecret, ot as excludeSignalReplies, p as AWAITING_VALUES, pr as testFunction, pt as priorRepliesThatWentOut, q as replyExpectation, qt as refreshStoredCliCredentials, r as TIME_FLAG_DESCRIPTION, rn as createWakeSchedule, rr as semanticSearch, rt as checkPriorReplies, s as formatErrorPayload, sn as deleteRoute, sr as setMemory, st as followUpCommandPrefix, t as API_BASE_URL_FLAG_DESCRIPTION, tn as createRoute, tr as searchEmails, tt as buildFollowUpCommand, u as surfaceUnauthorizedHint, ur as startAgentSignup, ut as formatPriorRepliesWarning, v as ensureSearchReportsReplyState, vn as getFunction, vr as updateRoute, vt as sentHistoryWindowStart, w as explainPendingMailNotFound, wn as getRepeatingSend, wt as connectNextSteps, x as hasReplyState, xn as getInboxStatus, xr as verifyAgentClaim, xt as thrownErrorExitCode, y as formatAwaitingCell, yn as getFunctionRouting, yr as updateWakeAuthorization, yt as serializeErrorPayload, z as clearReadPendingMail, zn as listRoutes, zt as ensureSearchReportsAutomated } from "../api-command-C_Fn9Zef.js";
3
3
  import { S as resolveListenSubscription, _ 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, x as normalizeListenOrigin, y as listenIdentity } from "../shared-mail-files-SPPcis9g.js";
4
- import { _ as detectAgentRuntime, a as NotificationRetryError, b as installedVersion, c as readConversationStatusContent, d as defaultSessionSocket, f as NativeSessionDisconnectedError, g as connectSkillTarget, h as NotificationOutcomeUnknownError, i as notificationReceiptPage, l as SESSION_UUID$1, m as NativeSessionNotLoadedError, n as notificationSenders, o as isRoutineNotificationContent, p as NativeSessionError, r as openSessionNotifications, s as notificationPartReader, t as notificationScope, v as installConnectSkill, x as readBundledConnectSkill, y as installedConnectSkillFile } from "../notify-session-CPdFxyt7.js";
5
- import { $ as describeSessionHookItem, A as evaluateContactPolicy, B as agentInvitationHash, C as RECEIVER_MODES, D as NETWORK_ADMISSION_PENDING_RETRY_MS, E as ContactPolicyReadRetryError, F as ContactsApiError, G as saveConnectionName, H as readAgentInvitation, I as contactAddress, J as recordHookMailCheck, K as savedReceiver, L as contactAgentAddress, M as AddressNotesApiError, N as addressNoteTarget, O as NetworkAdmissionPendingError, P as runAddressNotesRequest, Q as describeSessionHookChange, R as runContactRequest, S as runAgentConnect, T as verificationReplySubmitted, U as receiverStatusCommand, V as connectAgent, W as refusalAfterReplacement, X as claudeConfigDir, Y as boundSessionProfiles, Z as currentCliLocation, _ as disconnectAgent, _t as withOwnerMemberAddress, a as endSession, at as readClaudeSettings, b as invitationProfileName, c as pendingSessionDisconnects, ct as writeClaudeSettings, d as registerSession, dt as jsonIndentation, et as ensureHookLauncher, f as retryPendingDisconnects, ft as readManagedFile, g as AgentDisconnectError, gt as refreshOwnerMemberAddressPeriodically, h as enrollmentResumes, ht as readHookLauncherWarning, i as connectedProfilesForSession, it as inspectClaudeHooks, j as canonicalContactSelector, k as createNotificationContactPolicy, l as psProcessInfo, lt as MachineFileError, m as enrollAgent, mt as writeManagedFile, n as OMP_MAIN, nt as findOnPath, o as headlessClaudeRun, ot as repairClaudeHooks, p as runDetached, pt as upsertManagedBlock, q as installClaudeWakeHook, r as agentConnectionState, rt as hasMachineSessionHooks, st as samePath, t as MACHINE_RUNTIMES, tt as ephemeralCliReason, u as readClaudeHookInput, ut as inspectManagedBlock, v as connectWarnings, w as externalReceivingState, x as pollCheckCommand, y as defaultAgentProfileName, z as agentConnectionStatus } from "../machine-session-D4UbgQCW.js";
6
- import { a as scopedChatSenderTrust, i as readBeforeDeadline, n as isPlainChatReply, o as presenceDisposition, r as isScopedChatReply, s as readPresenceProjection, t as isConnectedChatCredential } from "../scoped-chat-BJVYBRim.js";
4
+ import { _ as detectAgentRuntime, a as NotificationRetryError, b as installedVersion, c as readConversationStatusContent, d as defaultSessionSocket, f as NativeSessionDisconnectedError, g as connectSkillTarget, h as NotificationOutcomeUnknownError, i as notificationReceiptPage, l as SESSION_UUID$1, m as NativeSessionNotLoadedError, n as notificationSenders, o as isRoutineNotificationContent, p as NativeSessionError, r as openSessionNotifications, s as notificationPartReader, t as notificationScope, v as installConnectSkill, x as readBundledConnectSkill, y as installedConnectSkillFile } from "../notify-session-DhV0DLAA.js";
5
+ import { $ as describeSessionHookItem, A as evaluateContactPolicy, B as agentInvitationHash, C as RECEIVER_MODES, D as NETWORK_ADMISSION_PENDING_RETRY_MS, E as ContactPolicyReadRetryError, F as ContactsApiError, G as saveConnectionName, H as readAgentInvitation, I as contactAddress, J as recordHookMailCheck, K as savedReceiver, L as contactAgentAddress, M as AddressNotesApiError, N as addressNoteTarget, O as NetworkAdmissionPendingError, P as runAddressNotesRequest, Q as describeSessionHookChange, R as runContactRequest, S as runAgentConnect, T as verificationReplySubmitted, U as receiverStatusCommand, V as connectAgent, W as refusalAfterReplacement, X as claudeConfigDir, Y as boundSessionProfiles, Z as currentCliLocation, _ as disconnectAgent, _t as withOwnerMemberAddress, a as endSession, at as readClaudeSettings, b as invitationProfileName, c as pendingSessionDisconnects, ct as writeClaudeSettings, d as registerSession, dt as jsonIndentation, et as ensureHookLauncher, f as retryPendingDisconnects, ft as readManagedFile, g as AgentDisconnectError, gt as refreshOwnerMemberAddressPeriodically, h as enrollmentResumes, ht as readHookLauncherWarning, i as connectedProfilesForSession, it as inspectClaudeHooks, j as canonicalContactSelector, k as createNotificationContactPolicy, l as psProcessInfo, lt as MachineFileError, m as enrollAgent, mt as writeManagedFile, n as OMP_MAIN, nt as findOnPath, o as headlessClaudeRun, ot as repairClaudeHooks, p as runDetached, pt as upsertManagedBlock, q as installClaudeWakeHook, r as agentConnectionState, rt as hasMachineSessionHooks, st as samePath, t as MACHINE_RUNTIMES, tt as ephemeralCliReason, u as readClaudeHookInput, ut as inspectManagedBlock, v as connectWarnings, w as externalReceivingState, x as pollCheckCommand, y as defaultAgentProfileName, z as agentConnectionStatus } from "../machine-session-Do3mw2_w.js";
6
+ import { a as scopedChatSenderTrust, i as readBeforeDeadline, n as isPlainChatReply, o as presenceDisposition, r as isScopedChatReply, s as readPresenceProjection, t as isConnectedChatCredential } from "../scoped-chat-BrLq4dXH.js";
7
7
  import { c as startBackgroundListen, i as backgroundListenToken, l as stopBackgroundListen, o as runBackgroundListen, r as backgroundListenStatus, u as verifyBackgroundListenTarget } from "../listen-background-CMfxkeVP.js";
8
- import { a as REPEAT_IDLE_MAX_MINUTES, d as parseRepeatTick, f as preparePresenceAliveEmail, g as isEmailReceivedEvent, i as REPEAT_EVERY_MAX_MINUTES, l as parseInteractionEnvelope$1, m as repeatStopCommand, o as REPEAT_MAX_SENDS_MAX, p as prepareSignalEmail, s as buildRepeatStopBody, u as parsePresenceEnvelope, v as parseWebhookEvent, y as parseFromHeader } from "../repeats-D2xtLium-B8Wq41vG.js";
9
- import { a as ensureSharedMailSubscription, c as reserveSharedMailSubscription, d as otherParticipants, f as EventConnection, h as pushFile, i as sharedMailScope, l as followEmailConversation, m as pullFile, n as reconcileChatSend, o as createSharedMailWaiter, p as EventReceiverError, r as openSharedMailReceiver, s as openSharedMailStore, t as sendSignal, u as readConversationFollow } from "../signal-command-CaKUsE4H.js";
8
+ import { a as REPEAT_IDLE_MAX_MINUTES, d as parseRepeatTick, f as preparePresenceAliveEmail, g as isEmailReceivedEvent, i as REPEAT_EVERY_MAX_MINUTES, l as parseInteractionEnvelope$1, m as repeatStopCommand, o as REPEAT_MAX_SENDS_MAX, p as prepareSignalEmail, s as buildRepeatStopBody, u as parsePresenceEnvelope, v as parseWebhookEvent, y as parseFromHeader } from "../repeats-D2xtLium-DmtVD6ol.js";
9
+ import { a as ensureSharedMailSubscription, c as reserveSharedMailSubscription, d as otherParticipants, f as EventConnection, h as pushFile, i as sharedMailScope, l as followEmailConversation, m as pullFile, n as reconcileChatSend, o as createSharedMailWaiter, p as EventReceiverError, r as openSharedMailReceiver, s as openSharedMailStore, t as sendSignal, u as readConversationFollow } from "../signal-command-CqfODMCp.js";
10
10
  import { autoSignalEligible, dispatchAutoRead, dispatchAutoWorking, haltAutoWorking, isSentSignal, restoreAutoWorking } from "./auto-signals.js";
11
11
  import { t as guardJsonOutputCommands } from "../json-output-Cf-GFeff.js";
12
12
  import { Args, Command, Errors, Flags, ux } from "@oclif/core";
@@ -35542,6 +35542,39 @@ async function replaceSessionAddresses(params) {
35542
35542
  }
35543
35543
  return replaced;
35544
35544
  }
35545
+ /**
35546
+ * Picks the profile a status read inspects: an explicit --profile, then the
35547
+ * one address connected for an explicit --session, then
35548
+ * PRIMITIVE_AGENT_PROFILE, then the one address connected for the runtime's
35549
+ * own session ID. Null when none
35550
+ * applies or the session has several addresses; `session` is null when no
35551
+ * session was available to look in.
35552
+ */
35553
+ function statusProfile(params) {
35554
+ const env = params.env ?? process.env;
35555
+ const chosen = params.profile ?? (params.session ? void 0 : env["PRIMITIVE_AGENT_PROFILE"]?.trim() || void 0);
35556
+ if (chosen) return { profile: chosen };
35557
+ const session = guardedSession(params.session, env);
35558
+ if (!session) return {
35559
+ profile: null,
35560
+ session: null,
35561
+ bound: []
35562
+ };
35563
+ const { others } = inspectSessionAddresses({
35564
+ configDir: params.configDir,
35565
+ session
35566
+ });
35567
+ const only = others.length === 1 ? others[0] : void 0;
35568
+ return only ? { profile: only.profile } : {
35569
+ profile: null,
35570
+ session,
35571
+ bound: others.map((row) => row.profile)
35572
+ };
35573
+ }
35574
+ /** Why a status read found no single profile, and what to do next. */
35575
+ function statusProfileMissingDetail(bound) {
35576
+ return bound.length > 1 ? `This session has several connected profiles (${bound.join(", ")}). Pass --profile <name>.` : `No Primitive address is connected for this session, so connecting one will not replace anything. Pass --profile <name> or set ${AGENT_PROFILE_ENV} to inspect another saved profile.`;
35577
+ }
35545
35578
  //#endregion
35546
35579
  //#region src/oclif/commands/agent-connect.ts
35547
35580
  /** npx runs the CLI from its cache; resume through npx too so the command works without a global install. */
@@ -35549,7 +35582,7 @@ function invocation$1(entry) {
35549
35582
  return entry && /[\\/]_npx[\\/]/.test(entry) ? "npx -y primitive@latest" : "primitive";
35550
35583
  }
35551
35584
  var AgentConnectCommand = class AgentConnectCommand extends Command {
35552
- static description = `Connect this coding session to Primitive in one call. With --session, the command checks this CLI's capabilities, installs or refreshes the matching primitive-connect skill for the detected runtime (Claude Code or Codex) from files bundled in this CLI, claims the owner's private setup invitation from piped stdin, answers one authenticated setup challenge, enables owner notifications, starts receiving, seeds a private AGENT_INFO note from --name and --info when absent, and prints one JSON result. The receiver defaults to external hooks in Claude Code and the native background listener elsewhere. When the native default cannot work because this machine has no local session socket (for example Codex older than 0.158.0), the command connects with poll receiving instead and reports receiving.fallbackReason and receiving.fallbackDetail. Without a session (no --session, or an empty one) the receiver is poll: for runtimes with no local session ID or hooks, such as a cloud-hosted conversation whose commands run in a separate sandbox, the invitation is claimed and verified the same way, nothing is installed, and the result's receiving.checkCommand is the command the agent runs to check for new mail at the start of each turn and after it sends. Native receiving starts or reuses a supervised background listener and waits briefly for its first successful mail check; external receiving installs the exact Claude session's fail-open Stop hook and resume SessionStart hook after the verification reply; a real idle mail event must still verify wake. The profile defaults to session-<session>, or to connection-<invitation hash prefix> without a session. --resume continues saved progress without reading stdin or replaying a claim or uncertain verification send. After the reply is submitted it waits up to a minute for the server to confirm the connection and reports verification.state verified, or reply_submitted while confirmation is still pending. Verification is separate from receiver health. Both official production (https://api.primitive.dev/v1) and staging (https://api.primitive-staging-1.com/v1) invitations pin their API origin. Never pass an invitation as a command argument. One address per session: if this session already has a connected Primitive address, including one saved in the profile being connected, the command claims nothing, leaves stdin unread, and exits 3 with status already_connected. Its detail names how to continue that profile's own connection when that is the only one: --resume for a setup with saved progress, or --keep-existing to refresh a claim-only profile from the same invitation. Otherwise ask the user whether to keep the existing address or disconnect it first, then rerun with --keep-existing or --replace-existing. Never choose for the user. Select the saved identity with PRIMITIVE_AGENT_PROFILE. Use --status --json with --profile, or with PRIMITIVE_AGENT_PROFILE set, to inspect saved identity and local receiver health offline; it exits 1 when the profile is not configured. A completed connection's result carries nextSteps, in order: report to the owner in two short sentences, make one offer to rename a generated name and record where the agent runs, and load the primitive-connect skill before handling mail. When the claim reported one, the result also carries the connection's name and nameIsDefault.`;
35585
+ static description = `Connect this coding session to Primitive in one call. With --session, the command checks this CLI's capabilities, installs or refreshes the matching primitive-connect skill for the detected runtime (Claude Code or Codex) from files bundled in this CLI, claims the owner's private setup invitation from piped stdin, answers one authenticated setup challenge, enables owner notifications, starts receiving, seeds a private AGENT_INFO note from --name and --info when absent, and prints one JSON result. The receiver defaults to external hooks in Claude Code and the native background listener elsewhere. When the native default cannot work because this machine has no local session socket (for example Codex older than 0.158.0), the command connects with poll receiving instead and reports receiving.fallbackReason and receiving.fallbackDetail. Without a session (no --session, or an empty one) the receiver is poll: for runtimes with no local session ID or hooks, such as a cloud-hosted conversation whose commands run in a separate sandbox, the invitation is claimed and verified the same way, nothing is installed, and the result's receiving.checkCommand is the command the agent runs to check for new mail at the start of each turn and after it sends. Native receiving starts or reuses a supervised background listener and waits briefly for its first successful mail check; external receiving installs the exact Claude session's fail-open Stop hook and resume SessionStart hook after the verification reply; a real idle mail event must still verify wake. The profile defaults to session-<session>, or to connection-<invitation hash prefix> without a session. --resume continues saved progress without reading stdin or replaying a claim or uncertain verification send. After the reply is submitted it waits up to a minute for the server to confirm the connection and reports verification.state verified, or reply_submitted while confirmation is still pending. Verification is separate from receiver health. Both official production (https://api.primitive.dev/v1) and staging (https://api.primitive-staging-1.com/v1) invitations pin their API origin. Never pass an invitation as a command argument. One address per session: if this session already has a connected Primitive address, including one saved in the profile being connected, the command claims nothing, leaves stdin unread, and exits 3 with status already_connected. Its detail names how to continue that profile's own connection when that is the only one: --resume for a setup with saved progress, or --keep-existing to refresh a claim-only profile from the same invitation. Otherwise ask the user whether to keep the existing address or disconnect it first, then rerun with --keep-existing or --replace-existing. Never choose for the user. Select the saved identity with PRIMITIVE_AGENT_PROFILE. Use --status --json with --profile, with PRIMITIVE_AGENT_PROFILE set, or with --session (the address connected for that session) to inspect saved identity and local receiver health offline; it exits 1 when nothing is configured. A status check before connecting is optional: connect itself claims nothing and exits 3 when the session already has an address. A completed connection's result carries nextSteps, in order: report to the owner in two short sentences, make one offer to rename a generated name and record where the agent runs, and load the primitive-connect skill before handling mail. When the claim reported one, the result also carries the connection's name and nameIsDefault.`;
35553
35586
  static summary = "Connect and verify an agent address";
35554
35587
  static examples = [
35555
35588
  "<%= config.bin %> agent connect --session \"$CODEX_THREAD_ID\" --name Research --info \"Reviews pull requests\" --json < private-invitation.txt",
@@ -35564,10 +35597,7 @@ var AgentConnectCommand = class AgentConnectCommand extends Command {
35564
35597
  ];
35565
35598
  static flags = {
35566
35599
  profile: Flags.string({ description: "Local agent profile name; defaults to session-<session> with --session, or connection-<invitation hash prefix> for poll receiving. Existing OAuth login is preserved" }),
35567
- session: Flags.string({
35568
- description: "Exact current session UUID; verify email and configure receiving after claiming. Omit it (or pass it empty) when the runtime exposes none, which selects poll receiving",
35569
- exclusive: ["status"]
35570
- }),
35600
+ session: Flags.string({ description: "Exact current session UUID; verify email and configure receiving after claiming. Omit it (or pass it empty) when the runtime exposes none, which selects poll receiving. With --status, reads the address connected for that session" }),
35571
35601
  receiver: Flags.string({
35572
35602
  description: "Native starts a supported session receiver; external installs the exact Claude session's fail-open Stop hook and resume SessionStart hook; poll installs nothing and the agent checks for mail itself with `agent check-mail`. Defaults to external in Claude Code, native elsewhere, and poll without a session",
35573
35603
  options: [...RECEIVER_MODES],
@@ -35615,8 +35645,27 @@ var AgentConnectCommand = class AgentConnectCommand extends Command {
35615
35645
  let replaced = [];
35616
35646
  try {
35617
35647
  if (flags.status) {
35618
- const profileName = flags.profile ?? (process.env["PRIMITIVE_AGENT_PROFILE"]?.trim() || void 0);
35619
- if (!profileName) throw new AgentConnectionSetupError(`Pass --profile <name> or set ${AGENT_PROFILE_ENV}.`);
35648
+ const statusSession = flags.session?.trim();
35649
+ if (statusSession !== void 0 && !SESSION_UUID$1.test(statusSession)) throw new AgentConnectionSetupError(statusSession === "" ? "--status with an empty --session has no session to look in. Pass --profile <name> for a sessionless connection." : "--session requires the exact loaded session UUID.");
35650
+ const picked = statusProfile({
35651
+ configDir: this.config.configDir,
35652
+ profile: flags.profile,
35653
+ session: statusSession
35654
+ });
35655
+ if (picked.profile === null && picked.session === null) throw new AgentConnectionSetupError(`Pass --profile <name>, --session <id> or set ${AGENT_PROFILE_ENV}.`);
35656
+ if (picked.profile === null) {
35657
+ const detail = statusProfileMissingDetail(picked.bound);
35658
+ this.log(flags.json ? JSON.stringify({
35659
+ status: "not_configured",
35660
+ profileName: null,
35661
+ session: picked.session,
35662
+ ...picked.bound.length > 1 ? { profiles: picked.bound } : {},
35663
+ detail
35664
+ }) : detail);
35665
+ process.exitCode = 1;
35666
+ return;
35667
+ }
35668
+ const profileName = picked.profile;
35620
35669
  const result = agentConnectionStatus(this.config.configDir, profileName);
35621
35670
  if (result.status !== "configured") {
35622
35671
  const detail = `Agent profile ${profileName} is not configured. Run \`primitive agent connect\` with the owner's invitation to connect it.`;
@@ -36756,30 +36805,6 @@ var AgentSessionRegisterCommand = class AgentSessionRegisterCommand extends Comm
36756
36805
  };
36757
36806
  //#endregion
36758
36807
  //#region src/oclif/commands/agent-status.ts
36759
- /**
36760
- * Picks the profile `agent status` reads: an explicit --profile, then
36761
- * PRIMITIVE_AGENT_PROFILE, then the one address connected for this runtime
36762
- * session. Null when none applies or the session has several addresses.
36763
- */
36764
- function statusProfile(params) {
36765
- const env = params.env ?? process.env;
36766
- const chosen = params.profile ?? (env["PRIMITIVE_AGENT_PROFILE"]?.trim() || void 0);
36767
- if (chosen) return { profile: chosen };
36768
- const session = guardedSession(void 0, env);
36769
- if (!session) return {
36770
- profile: null,
36771
- bound: []
36772
- };
36773
- const { others } = inspectSessionAddresses({
36774
- configDir: params.configDir,
36775
- session
36776
- });
36777
- const only = others.length === 1 ? others[0] : void 0;
36778
- return only ? { profile: only.profile } : {
36779
- profile: null,
36780
- bound: others.map((row) => row.profile)
36781
- };
36782
- }
36783
36808
  /** A hidden alias of `agent connect --status`, for the command agents guess. */
36784
36809
  var AgentStatusCommand = class AgentStatusCommand extends Command {
36785
36810
  static hidden = true;
@@ -36796,7 +36821,7 @@ var AgentStatusCommand = class AgentStatusCommand extends Command {
36796
36821
  profile: flags.profile
36797
36822
  });
36798
36823
  if (picked.profile === null) {
36799
- const detail = picked.bound.length > 1 ? `This session has several connected profiles (${picked.bound.join(", ")}). Pass --profile <name>.` : `No Primitive address is connected for this session. Pass --profile <name> or set ${AGENT_PROFILE_ENV} to inspect a saved profile.`;
36824
+ const detail = statusProfileMissingDetail(picked.bound);
36800
36825
  this.log(flags.json ? JSON.stringify({
36801
36826
  status: "not_configured",
36802
36827
  profileName: null,
@@ -43592,7 +43617,7 @@ const PRIMITIVE_TEAM_AUTHOR = {
43592
43617
  url: "https://primitive.dev"
43593
43618
  };
43594
43619
  const SDK_VERSION_RANGE = "^1.35.0";
43595
- const CLI_VERSION_RANGE = "^1.52.0";
43620
+ const CLI_VERSION_RANGE = "^1.54.0";
43596
43621
  const ESBUILD_VERSION_RANGE = "^0.27.0";
43597
43622
  function renderHandler() {
43598
43623
  return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
@@ -45392,8 +45417,9 @@ function formatTrust(email) {
45392
45417
  const known = email.from_known_address === null ? "unknown" : email.from_known_address ? "yes" : "no";
45393
45418
  return `${email.auth ? `SPF ${email.auth.spf ?? "unknown"}, DMARC ${email.auth.dmarc ?? "unknown"}` : "not reported"}; known sender: ${known}`;
45394
45419
  }
45420
+ /** The reply command line, reaching this same CLI and connected profile. */
45395
45421
  function replyCommand(bin, id) {
45396
- return `${bin} reply --id ${id}`;
45422
+ return `${followUpCommandPrefix(bin)} reply --id ${id}`;
45397
45423
  }
45398
45424
  const DEFAULT_API = {
45399
45425
  getConversation,
@@ -1,6 +1,6 @@
1
1
  import { N as agentProfileDirectory, P as agentProfileName, R as loadConnectedAgentProfile, j as AGENT_PROFILE_ENV } from "../cli-config-DGrZCUfw.js";
2
2
  import { d as readMailJson } from "../shared-mail-files-SPPcis9g.js";
3
- import { _ as detectAgentRuntime, l as SESSION_UUID, t as notificationScope } from "../notify-session-CPdFxyt7.js";
3
+ import { _ as detectAgentRuntime, l as SESSION_UUID, t as notificationScope } from "../notify-session-DhV0DLAA.js";
4
4
  import { a as claimBackgroundListenRestart, n as backgroundListenRestartable, r as backgroundListenStatus } from "../listen-background-CMfxkeVP.js";
5
5
  import { join } from "node:path";
6
6
  import { spawn } from "node:child_process";