@primitivedotdev/cli 3.0.0-preview.25 → 3.0.0-preview.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-command-DhY2wrh5.js → api-command-B-nuABGm.js} +105 -46
- package/dist/{cli-command-names-DiNDwwDX.js → cli-command-names-no0f7d7s.js} +6 -0
- package/dist/{cli-config-D2MU7PiU.js → cli-config-CwZJQIcn.js} +283 -23
- package/dist/{machine-session-BTJXO0vi.js → machine-session-1utuweTi.js} +3 -3
- package/dist/{notify-session-DrgOcIT6.js → notify-session-CM4_ZYe9.js} +1 -1
- package/dist/oclif/auto-signal-worker.js +2 -2
- package/dist/oclif/command-not-found.js +1 -1
- package/dist/oclif/index.js +457 -119
- package/dist/oclif/receiver-heal.js +2 -2
- package/dist/oclif/root-signup-hint.js +1 -1
- package/dist/{signal-command-BmxZqCot.js → signal-command-D4ZIidPX.js} +2 -2
- package/package.json +1 -1
package/dist/oclif/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { $ as
|
|
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-
|
|
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";
|
|
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
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-
|
|
7
|
-
import { $ as
|
|
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";
|
|
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-
|
|
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
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";
|
|
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-
|
|
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";
|
|
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";
|
|
16
16
|
import { Args, Command, Errors, Flags, ux } from "@oclif/core";
|
|
17
17
|
import { appendFileSync, chmodSync, closeSync, constants, cpSync, existsSync, fstatSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
18
18
|
import { createHash, randomUUID, scryptSync } from "node:crypto";
|
|
19
|
-
import path, { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
19
|
+
import path, { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
|
|
20
20
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
21
21
|
import { createInterface } from "node:readline/promises";
|
|
22
22
|
import { homedir, hostname } from "node:os";
|
|
@@ -3106,6 +3106,17 @@ function endedClaimText(claim) {
|
|
|
3106
3106
|
return text !== "" && !/[\r\n]/.test(text) && text.length <= 500 ? text : "cleared";
|
|
3107
3107
|
}
|
|
3108
3108
|
// src/oclif/commands/api.ts
|
|
3109
|
+
function parseApiHeaderFlag(raw) {
|
|
3110
|
+
const colonIdx = raw.indexOf(":");
|
|
3111
|
+
const eqIdx = raw.indexOf("=");
|
|
3112
|
+
if (colonIdx > 0 && (eqIdx === -1 || colonIdx < eqIdx)) {
|
|
3113
|
+
const name = raw.slice(0, colonIdx).trim();
|
|
3114
|
+
const value = raw.slice(colonIdx + 1).trim();
|
|
3115
|
+
if (!/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/.test(name)) throw new Errors.CLIError(`Invalid header name "${name}" in -H "${raw}".`, { exit: 2 });
|
|
3116
|
+
return [name, value];
|
|
3117
|
+
}
|
|
3118
|
+
return parseHeaderAssignment(raw);
|
|
3119
|
+
}
|
|
3109
3120
|
const BLOCKED_CUSTOM_HEADERS = /* @__PURE__ */ new Set([
|
|
3110
3121
|
"authorization",
|
|
3111
3122
|
"cookie",
|
|
@@ -3234,7 +3245,7 @@ var ApiCommand = class ApiCommand extends Command {
|
|
|
3234
3245
|
}
|
|
3235
3246
|
const headers = mergeHeadersCaseInsensitive({ accept: "application/json" }, authenticated.auth.agentPass || authenticated.auth.connectedAgent ? void 0 : authenticated.requestConfig.headers, envActivityHeaders, explicitFlagsHeaders) ?? {};
|
|
3236
3247
|
for (const rawHeader of flags.header ?? []) {
|
|
3237
|
-
const [name, value] =
|
|
3248
|
+
const [name, value] = parseApiHeaderFlag(rawHeader);
|
|
3238
3249
|
const lower = name.toLowerCase();
|
|
3239
3250
|
if (BLOCKED_CUSTOM_HEADERS.has(lower)) throw new Errors.CLIError(`${name} header is managed automatically and cannot be overridden with -H.`, { exit: 1 });
|
|
3240
3251
|
for (const existingKey of Object.keys(headers)) if (existingKey.toLowerCase() === lower) delete headers[existingKey];
|
|
@@ -3255,7 +3266,7 @@ var ApiCommand = class ApiCommand extends Command {
|
|
|
3255
3266
|
}
|
|
3256
3267
|
let response;
|
|
3257
3268
|
try {
|
|
3258
|
-
response = await fetch(requestUrl.toString(), {
|
|
3269
|
+
response = await authenticated.fetch(requestUrl.toString(), {
|
|
3259
3270
|
method,
|
|
3260
3271
|
headers,
|
|
3261
3272
|
redirect: "manual",
|
|
@@ -3283,7 +3294,15 @@ var ApiCommand = class ApiCommand extends Command {
|
|
|
3283
3294
|
}));
|
|
3284
3295
|
else if (rawBody.length > 0) process.stdout.write(rawBody.endsWith("\n") ? rawBody : `${rawBody}\n`);
|
|
3285
3296
|
else if (!response.ok && !flags.include) this.log(`HTTP ${response.status} ${response.statusText}`.trim());
|
|
3286
|
-
if (!response.ok)
|
|
3297
|
+
if (!response.ok) {
|
|
3298
|
+
if (!flags.json && authenticated.auth.source === "agent-pass" && authenticated.auth.agentPass && (response.status === 401 || response.status === 403)) {
|
|
3299
|
+
const errPayload = extractErrorPayload(parsedJson ?? { message: `HTTP ${response.status}` });
|
|
3300
|
+
const code = extractErrorCode(errPayload) ?? (response.status === 401 ? "unauthorized" : "grant_forbidden");
|
|
3301
|
+
const hint = agentPassErrorHint(authenticated.auth.agentPass, code);
|
|
3302
|
+
if (hint) process.stderr.write(`${hint}\n`);
|
|
3303
|
+
}
|
|
3304
|
+
process.exitCode = 1;
|
|
3305
|
+
}
|
|
3287
3306
|
}
|
|
3288
3307
|
};
|
|
3289
3308
|
// src/oclif/commands/billing.ts
|
|
@@ -7270,7 +7289,6 @@ var ConnectCommand = class ConnectCommand extends Command {
|
|
|
7270
7289
|
profile: Flags.string({ description: "Bind the claimed pass to a named local profile instead of auto-detecting the active session" }),
|
|
7271
7290
|
"api-base-url": Flags.string({
|
|
7272
7291
|
description: "Override the API base URL when claiming a bare pit_v1_ token",
|
|
7273
|
-
env: "PRIMITIVE_API_BASE_URL",
|
|
7274
7292
|
hidden: true
|
|
7275
7293
|
}),
|
|
7276
7294
|
json: Flags.boolean({ description: "Print safe pass metadata, preview, and guide as JSON (never prints the API key)" })
|
|
@@ -7279,7 +7297,9 @@ var ConnectCommand = class ConnectCommand extends Command {
|
|
|
7279
7297
|
const { args, flags } = await this.parse(ConnectCommand);
|
|
7280
7298
|
try {
|
|
7281
7299
|
const rawInput = args.pass ?? await readStdinText();
|
|
7282
|
-
const
|
|
7300
|
+
const hasExplicitUrl = /https?:\/\//i.test(rawInput);
|
|
7301
|
+
const effectiveBaseUrlOverride = flags["api-base-url"] ?? (hasExplicitUrl ? void 0 : process.env.PRIMITIVE_API_BASE_URL);
|
|
7302
|
+
const { token, apiBaseUrl } = parseAccessPassInput(rawInput, effectiveBaseUrlOverride);
|
|
7283
7303
|
const slot = resolveAgentPassSlot({
|
|
7284
7304
|
configDir: this.config.configDir,
|
|
7285
7305
|
profile: flags.profile
|
|
@@ -7288,8 +7308,9 @@ var ConnectCommand = class ConnectCommand extends Command {
|
|
|
7288
7308
|
const tokenHash = agentPassTokenSha256(token);
|
|
7289
7309
|
try {
|
|
7290
7310
|
const existing = readAgentPassFile(slot.path);
|
|
7291
|
-
if (existing && !
|
|
7311
|
+
if (existing && !existing.revoked_at && existing.token_sha256 !== tokenHash) process.stderr.write(`Warning: replacing active Access Pass "${existing.label}" in this slot without revoking it. Run \`${revokeCommand}\` before connecting if you want to revoke the previous pass.\n`);
|
|
7292
7312
|
} catch {}
|
|
7313
|
+
if (slot.binding.kind === "default" && (hasStoredCliLogin(this.config.configDir) || Boolean(process.env.PRIMITIVE_API_KEY?.trim()))) process.stderr.write("Note: No agent session ID was detected, so this Access Pass is active as the default local binding and overrides your global CLI auth until cleared. Use `--profile <name>` to isolate it, or `primitive disconnect --local-only` when done.\n");
|
|
7293
7314
|
const cached = loadCachedAgentPassByToken({
|
|
7294
7315
|
configDir: this.config.configDir,
|
|
7295
7316
|
token
|
|
@@ -7851,9 +7872,15 @@ var DisconnectCommand = class DisconnectCommand extends Command {
|
|
|
7851
7872
|
const detail = error instanceof Error ? error.message : String(error);
|
|
7852
7873
|
throw new AgentPassAuthError(`Saved Access Pass could not be read for remote revocation (${detail}). Revoke it in the Primitive dashboard or re-run with --local-only to delete the local file.`);
|
|
7853
7874
|
}
|
|
7854
|
-
|
|
7875
|
+
try {
|
|
7876
|
+
lstatSync(slot.path);
|
|
7877
|
+
unreadableSlot = true;
|
|
7878
|
+
} catch {
|
|
7879
|
+
unreadableSlot = false;
|
|
7880
|
+
}
|
|
7855
7881
|
}
|
|
7856
7882
|
if (!stored && !unreadableSlot) {
|
|
7883
|
+
const scopeHint = slot.binding.kind === "session" ? "this session" : slot.binding.kind === "profile" ? `profile "${slot.binding.profile}"` : "this machine";
|
|
7857
7884
|
if (flags.json) {
|
|
7858
7885
|
this.log(JSON.stringify({
|
|
7859
7886
|
status: "not_connected",
|
|
@@ -7862,7 +7889,7 @@ var DisconnectCommand = class DisconnectCommand extends Command {
|
|
|
7862
7889
|
}));
|
|
7863
7890
|
return;
|
|
7864
7891
|
}
|
|
7865
|
-
this.log(
|
|
7892
|
+
this.log(`No active Access Pass is bound to ${scopeHint}.`);
|
|
7866
7893
|
return;
|
|
7867
7894
|
}
|
|
7868
7895
|
let revoked = false;
|
|
@@ -8152,31 +8179,51 @@ function checkReceiverStart(configDir, profileName) {
|
|
|
8152
8179
|
return null;
|
|
8153
8180
|
}
|
|
8154
8181
|
}
|
|
8155
|
-
async function checkAgentPassGrant(
|
|
8182
|
+
async function checkAgentPassGrant(params) {
|
|
8183
|
+
const { apiBaseUrl, apiKey, configDir, pass } = params;
|
|
8184
|
+
const disconnectCmd = pass.binding.kind === "profile" ? `primitive disconnect --profile ${pass.binding.profile} --local-only` : "primitive disconnect --local-only";
|
|
8156
8185
|
try {
|
|
8157
8186
|
const response = await fetch(`${apiBaseUrl.replace(/\/+$/, "")}/whoami/grant`, {
|
|
8158
8187
|
method: "GET",
|
|
8159
8188
|
headers: {
|
|
8189
|
+
...cliActivityHeadersFromEnv(),
|
|
8160
8190
|
authorization: `Bearer ${apiKey}`,
|
|
8161
8191
|
accept: "application/json"
|
|
8162
8192
|
}
|
|
8163
8193
|
});
|
|
8164
8194
|
const payload = await response.json().catch(() => null);
|
|
8165
|
-
if (!response.ok)
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8195
|
+
if (!response.ok) {
|
|
8196
|
+
const detail = payload?.error && typeof payload.error === "object" ? JSON.stringify(payload.error).slice(0, 300) : `HTTP ${response.status}`;
|
|
8197
|
+
const extendHint = pass.manage_url ? ` Ask the owner to extend it at ${pass.manage_url}?action=extend&add=4h, or run \`${disconnectCmd}\` to clear the binding.` : ` Run \`${disconnectCmd}\` and reconnect with a fresh pass.`;
|
|
8198
|
+
return {
|
|
8199
|
+
syncedPass: pass,
|
|
8200
|
+
outcome: {
|
|
8201
|
+
status: "fail",
|
|
8202
|
+
message: `Access Pass rejected by API (${detail})`,
|
|
8203
|
+
hint: `The Access Pass may have expired or been revoked.${extendHint}`
|
|
8204
|
+
}
|
|
8205
|
+
};
|
|
8206
|
+
}
|
|
8207
|
+
const { pass: syncedPass, permissions } = syncAgentPassMetadataFromGrant({
|
|
8208
|
+
configDir,
|
|
8209
|
+
pass,
|
|
8210
|
+
grantData: payload?.data ?? null
|
|
8211
|
+
});
|
|
8171
8212
|
return {
|
|
8172
|
-
|
|
8173
|
-
|
|
8213
|
+
syncedPass,
|
|
8214
|
+
outcome: {
|
|
8215
|
+
status: "ok",
|
|
8216
|
+
message: permissions.length > 0 ? `verified via /whoami/grant (${permissions.length} permission${permissions.length === 1 ? "" : "s"})` : "verified via /whoami/grant"
|
|
8217
|
+
}
|
|
8174
8218
|
};
|
|
8175
8219
|
} catch (error) {
|
|
8176
8220
|
return {
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8221
|
+
syncedPass: pass,
|
|
8222
|
+
outcome: {
|
|
8223
|
+
status: "fail",
|
|
8224
|
+
message: `Could not reach /whoami/grant: ${error instanceof Error ? error.message : String(error)}`,
|
|
8225
|
+
hint: "Check network connectivity and proxy settings."
|
|
8226
|
+
}
|
|
8180
8227
|
};
|
|
8181
8228
|
}
|
|
8182
8229
|
}
|
|
@@ -8207,6 +8254,22 @@ var DoctorCommand = class DoctorCommand extends Command {
|
|
|
8207
8254
|
label: "Proxy env",
|
|
8208
8255
|
outcome: checkProxy()
|
|
8209
8256
|
});
|
|
8257
|
+
const lockState = readCliLockState(this.config.configDir);
|
|
8258
|
+
if (lockState.status === "locked") rows.push({
|
|
8259
|
+
label: "Global auth lock",
|
|
8260
|
+
outcome: {
|
|
8261
|
+
status: "ok",
|
|
8262
|
+
message: `Locked since ${lockState.lockedAt} (only Access Passes and connected profiles allowed; unlock with \`primitive unlock --for 15m\`)`
|
|
8263
|
+
}
|
|
8264
|
+
});
|
|
8265
|
+
else if (lockState.status === "temporarily_unlocked") rows.push({
|
|
8266
|
+
label: "Global auth lock",
|
|
8267
|
+
outcome: {
|
|
8268
|
+
status: "warn",
|
|
8269
|
+
message: `Temporarily unlocked until ${lockState.unlockedUntil} (auto-relocks)`,
|
|
8270
|
+
hint: "Run `primitive lock` to re-lock earlier."
|
|
8271
|
+
}
|
|
8272
|
+
});
|
|
8210
8273
|
let resolvedAuth = null;
|
|
8211
8274
|
let authError = null;
|
|
8212
8275
|
try {
|
|
@@ -8216,7 +8279,7 @@ var DoctorCommand = class DoctorCommand extends Command {
|
|
|
8216
8279
|
configDir: this.config.configDir
|
|
8217
8280
|
});
|
|
8218
8281
|
} catch (error) {
|
|
8219
|
-
if (error instanceof AgentPassAuthError) authError = error.message;
|
|
8282
|
+
if (error instanceof AgentPassAuthError || error instanceof CliAuthLockedError) authError = error.message;
|
|
8220
8283
|
else throw error;
|
|
8221
8284
|
}
|
|
8222
8285
|
const connected = resolvedAuth?.connectedAgent;
|
|
@@ -8246,7 +8309,17 @@ var DoctorCommand = class DoctorCommand extends Command {
|
|
|
8246
8309
|
});
|
|
8247
8310
|
if (!connected && apiKeyCheck.status !== "fail") {
|
|
8248
8311
|
if (activePass && resolvedAuth?.apiKey) {
|
|
8249
|
-
const grantOutcome = await checkAgentPassGrant(
|
|
8312
|
+
const { outcome: grantOutcome, syncedPass } = await checkAgentPassGrant({
|
|
8313
|
+
apiBaseUrl: resolvedAuth.apiBaseUrl,
|
|
8314
|
+
apiKey: resolvedAuth.apiKey,
|
|
8315
|
+
configDir: this.config.configDir,
|
|
8316
|
+
pass: activePass
|
|
8317
|
+
});
|
|
8318
|
+
const authRow = rows.find((r) => r.label === "Auth");
|
|
8319
|
+
if (authRow) authRow.outcome = {
|
|
8320
|
+
status: "ok",
|
|
8321
|
+
message: `Access Pass "${syncedPass.label}" (${syncedPass.mode}, expires ${syncedPass.expires_at})`
|
|
8322
|
+
};
|
|
8250
8323
|
rows.push({
|
|
8251
8324
|
label: "API auth",
|
|
8252
8325
|
outcome: grantOutcome
|
|
@@ -8401,10 +8474,7 @@ var DomainsZoneFileCommand = class DomainsZoneFileCommand extends Command {
|
|
|
8401
8474
|
if (!domainId) throw new Errors.CLIError("Could not resolve a domain id.", { exit: 1 });
|
|
8402
8475
|
let response;
|
|
8403
8476
|
try {
|
|
8404
|
-
response = await fetch(zoneFileUrl(requestConfig.resolvedApiBaseUrl, domainId, flags["outbound-only"], flags["inbound-only"]), { headers: {
|
|
8405
|
-
...requestConfig.headers ?? {},
|
|
8406
|
-
...auth.apiKey ? { authorization: `Bearer ${auth.apiKey}` } : {}
|
|
8407
|
-
} });
|
|
8477
|
+
response = await fetch(zoneFileUrl(requestConfig.resolvedApiBaseUrl, domainId, flags["outbound-only"], flags["inbound-only"]), { headers: mergeHeadersCaseInsensitive(requestConfig.headers, cliActivityHeadersFromEnv(), auth.apiKey ? { authorization: `Bearer ${auth.apiKey}` } : void 0) ?? {} });
|
|
8408
8478
|
} catch (error) {
|
|
8409
8479
|
writeErrorWithHints(error);
|
|
8410
8480
|
process.exitCode = 1;
|
|
@@ -8831,13 +8901,10 @@ async function callActivityApi(options) {
|
|
|
8831
8901
|
}
|
|
8832
8902
|
let serializedBody;
|
|
8833
8903
|
if (options.body !== void 0) serializedBody = JSON.stringify(options.body);
|
|
8834
|
-
const headers = mergeHeadersCaseInsensitive({ accept: options.rawText ? "text/csv, application/json" : "application/json" },
|
|
8835
|
-
authorization: `Bearer ${authenticated.auth.apiKey}`,
|
|
8836
|
-
...serializedBody !== void 0 ? { "content-type": "application/json" } : {}
|
|
8837
|
-
}) ?? {};
|
|
8904
|
+
const headers = mergeHeadersCaseInsensitive({ accept: options.rawText ? "text/csv, application/json" : "application/json" }, options.headers, serializedBody !== void 0 ? { "content-type": "application/json" } : void 0) ?? {};
|
|
8838
8905
|
let response;
|
|
8839
8906
|
try {
|
|
8840
|
-
response = await fetch(url.toString(), {
|
|
8907
|
+
response = await authenticated.fetch(url.toString(), {
|
|
8841
8908
|
method: options.method,
|
|
8842
8909
|
headers,
|
|
8843
8910
|
redirect: "manual",
|
|
@@ -8860,8 +8927,11 @@ async function callActivityApi(options) {
|
|
|
8860
8927
|
const sanitized = sanitizeErrorText(rawText);
|
|
8861
8928
|
if (sanitized) message = sanitized;
|
|
8862
8929
|
}
|
|
8863
|
-
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." : "";
|
|
8864
|
-
throw new Errors.CLIError(`${message}${hint}`, {
|
|
8930
|
+
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)." : "";
|
|
8931
|
+
throw new Errors.CLIError(`${message}${hint}`, {
|
|
8932
|
+
exit: 1,
|
|
8933
|
+
...code ? { code } : {}
|
|
8934
|
+
});
|
|
8865
8935
|
}
|
|
8866
8936
|
if (options.rawText) return {
|
|
8867
8937
|
data: void 0,
|
|
@@ -9535,7 +9605,7 @@ async function runBrief(command, flags) {
|
|
|
9535
9605
|
isOwnSignal: (sentId) => isSentSignal(command.config.configDir, sentId),
|
|
9536
9606
|
signal: AbortSignal.timeout(3e4)
|
|
9537
9607
|
});
|
|
9538
|
-
const
|
|
9608
|
+
const activities = flags["with-activity"] ? await fetchEmailThreadActivity(command, detail.thread_id, flags, authenticated) : void 0;
|
|
9539
9609
|
const stop = !flags["no-signal"] && detail.sender_connected_agent_verified !== true && dispatchAutoWorking({
|
|
9540
9610
|
configDir: command.config.configDir,
|
|
9541
9611
|
emailId: detail.id
|
|
@@ -9543,8 +9613,8 @@ async function runBrief(command, flags) {
|
|
|
9543
9613
|
command.log(flags.json ? JSON.stringify({
|
|
9544
9614
|
...brief,
|
|
9545
9615
|
...stop ? { working_signal: { stop_command: stop } } : {},
|
|
9546
|
-
...
|
|
9547
|
-
}, null, 2) : `${renderEmailBrief(brief)}${
|
|
9616
|
+
...activities !== void 0 ? { activities } : {}
|
|
9617
|
+
}, null, 2) : `${renderEmailBrief(brief)}${activities !== void 0 ? renderThreadActivitySection(activities) : ""}${stop ? `\n${workingStopLine(stop)}` : ""}`);
|
|
9548
9618
|
await clearPendingAfterRead(command.config.configDir, detail.id, detail);
|
|
9549
9619
|
});
|
|
9550
9620
|
}
|
|
@@ -9575,10 +9645,10 @@ async function runCompact(command, flags) {
|
|
|
9575
9645
|
...flags.links !== void 0 ? { links: flags.links } : {}
|
|
9576
9646
|
});
|
|
9577
9647
|
if (readable.kind === "ok") {
|
|
9578
|
-
const
|
|
9579
|
-
command.log(JSON.stringify(
|
|
9648
|
+
const activities = flags["with-activity"] ? await fetchEmailThreadActivity(command, readable.data.thread_id, flags, authenticated) : void 0;
|
|
9649
|
+
command.log(JSON.stringify(activities !== void 0 ? {
|
|
9580
9650
|
...readable.data,
|
|
9581
|
-
|
|
9651
|
+
activities
|
|
9582
9652
|
} : readable.data, null, 2));
|
|
9583
9653
|
await clearPendingAfterRead(command.config.configDir, readable.data.id, readable.data);
|
|
9584
9654
|
return;
|
|
@@ -9597,11 +9667,11 @@ async function runCompact(command, flags) {
|
|
|
9597
9667
|
await fail(result.error);
|
|
9598
9668
|
return;
|
|
9599
9669
|
}
|
|
9600
|
-
const
|
|
9670
|
+
const activities = flags["with-activity"] ? await fetchEmailThreadActivity(command, detail.thread_id, flags, authenticated) : void 0;
|
|
9601
9671
|
process.stderr.write(ROUTE_MISSING_NOTICE);
|
|
9602
|
-
command.log(JSON.stringify(
|
|
9672
|
+
command.log(JSON.stringify(activities !== void 0 ? {
|
|
9603
9673
|
...buildEmailCompact(detail),
|
|
9604
|
-
|
|
9674
|
+
activities
|
|
9605
9675
|
} : buildEmailCompact(detail), null, 2));
|
|
9606
9676
|
await clearPendingAfterRead(command.config.configDir, detail.id, detail);
|
|
9607
9677
|
});
|
|
@@ -9696,16 +9766,22 @@ function createEmailsGetCommand(base) {
|
|
|
9696
9766
|
process.exitCode = 1;
|
|
9697
9767
|
return;
|
|
9698
9768
|
}
|
|
9699
|
-
const
|
|
9700
|
-
|
|
9769
|
+
const activities = await fetchEmailThreadActivity(this, detail.thread_id, parsed, authenticated);
|
|
9770
|
+
const enrichedDetail = {
|
|
9701
9771
|
...detail,
|
|
9702
|
-
|
|
9703
|
-
}
|
|
9772
|
+
activities
|
|
9773
|
+
};
|
|
9774
|
+
const output = parsed.json ? {
|
|
9775
|
+
...result.data,
|
|
9776
|
+
success: true,
|
|
9777
|
+
data: enrichedDetail
|
|
9778
|
+
} : enrichedDetail;
|
|
9779
|
+
this.log(JSON.stringify(output, null, 2));
|
|
9704
9780
|
await clearPendingAfterRead(this.config.configDir, detail.id, detail);
|
|
9705
9781
|
});
|
|
9706
9782
|
return;
|
|
9707
9783
|
}
|
|
9708
|
-
this.argv = this.argv.filter((arg) => arg !== "--no-signal" && arg !== "--with-activity");
|
|
9784
|
+
this.argv = this.argv.filter((arg) => arg !== "--no-signal" && !arg.startsWith("--no-signal=") && arg !== "--with-activity" && !arg.startsWith("--with-activity="));
|
|
9709
9785
|
const before = process.exitCode;
|
|
9710
9786
|
await base.prototype.run.call(this);
|
|
9711
9787
|
if (process.exitCode === before || process.exitCode === 0) await clearPendingAfterRead(this.config.configDir, parsed.id);
|
|
@@ -11746,8 +11822,8 @@ const PRIMITIVE_TEAM_AUTHOR = {
|
|
|
11746
11822
|
name: "Primitive Team",
|
|
11747
11823
|
url: "https://primitive.dev"
|
|
11748
11824
|
};
|
|
11749
|
-
const SDK_VERSION_RANGE = "^3.0.0-preview.
|
|
11750
|
-
const CLI_VERSION_RANGE = "^3.0.0-preview.
|
|
11825
|
+
const SDK_VERSION_RANGE = "^3.0.0-preview.26";
|
|
11826
|
+
const CLI_VERSION_RANGE = "^3.0.0-preview.26";
|
|
11751
11827
|
const ESBUILD_VERSION_RANGE = "^0.27.0";
|
|
11752
11828
|
function renderHandler() {
|
|
11753
11829
|
return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
|
|
@@ -14748,24 +14824,34 @@ var WhoamiCommand = class WhoamiCommand extends Command {
|
|
|
14748
14824
|
}, null, 2) : `${identity.agentAddress}\nSelected by: ${selectedBy}. Prefix a command with \`PRIMITIVE_AGENT_PROFILE=\` to run it as the member login instead.\nSaved connected-agent profile: ${identity.profileName}\nAgent address: ${identity.agentAddress}\nOwner personal address (send reports here): ${identity.ownerMemberAddress ?? "unknown; reply to the member who wrote to you"}\nControl address (setup and presence only): ${identity.ownerAddress}\nAPI origin: ${identity.apiBaseUrl}\n${guidance}\nSaved profile status: ${statusCommand}`);
|
|
14749
14825
|
return;
|
|
14750
14826
|
}
|
|
14751
|
-
if (auth.agentPass) {
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14827
|
+
if (auth.agentPass && flags.check === void 0) {
|
|
14828
|
+
let response;
|
|
14829
|
+
try {
|
|
14830
|
+
response = await fetch(`${auth.apiBaseUrl.replace(/\/+$/, "")}/whoami/grant`, {
|
|
14831
|
+
method: "GET",
|
|
14832
|
+
headers: {
|
|
14833
|
+
...cliActivityHeadersFromEnv(),
|
|
14834
|
+
authorization: `Bearer ${auth.apiKey ?? ""}`,
|
|
14835
|
+
accept: "application/json"
|
|
14836
|
+
}
|
|
14837
|
+
});
|
|
14838
|
+
} catch (error) {
|
|
14839
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
14840
|
+
throw new Errors.CLIError(`Could not reach /whoami/grant: ${detail}`, { exit: 1 });
|
|
14841
|
+
}
|
|
14761
14842
|
const payload = await response.json().catch(() => null);
|
|
14762
14843
|
if (!response.ok) {
|
|
14763
14844
|
const errorPayload = extractErrorPayload(payload ?? { message: `HTTP ${response.status}` });
|
|
14764
|
-
writeErrorWithHints(errorPayload);
|
|
14845
|
+
writeErrorWithHints(errorPayload, response, { auth });
|
|
14765
14846
|
process.exitCode = 1;
|
|
14766
14847
|
return;
|
|
14767
14848
|
}
|
|
14768
|
-
grant = payload?.data ?? null;
|
|
14849
|
+
const grant = payload?.data ?? null;
|
|
14850
|
+
const { pass, permissions: perms } = syncAgentPassMetadataFromGrant({
|
|
14851
|
+
configDir: this.config.configDir,
|
|
14852
|
+
pass: auth.agentPass,
|
|
14853
|
+
grantData: grant
|
|
14854
|
+
});
|
|
14769
14855
|
const revokeCommand = pass.binding.kind === "profile" ? `primitive disconnect --profile ${pass.binding.profile}` : "primitive disconnect";
|
|
14770
14856
|
if (flags.json) {
|
|
14771
14857
|
this.log(JSON.stringify({
|
|
@@ -14776,13 +14862,13 @@ var WhoamiCommand = class WhoamiCommand extends Command {
|
|
|
14776
14862
|
}, null, 2));
|
|
14777
14863
|
return;
|
|
14778
14864
|
}
|
|
14779
|
-
const perms = Array.isArray(grant?.permissions) ? grant.permissions.filter((p) => typeof p === "string") : [];
|
|
14780
14865
|
const lines = [
|
|
14781
14866
|
`Authenticated with Access Pass "${pass.label}" (${pass.mode})`,
|
|
14782
14867
|
`Expires at: ${pass.expires_at}`,
|
|
14783
14868
|
`API origin: ${auth.apiBaseUrl}`
|
|
14784
14869
|
];
|
|
14785
14870
|
if (pass.slice_summary) lines.push(`Scope: ${pass.slice_summary}`);
|
|
14871
|
+
if (pass.manage_url) lines.push(`Manage / extend / promote: ${pass.manage_url}`);
|
|
14786
14872
|
if (perms.length > 0) lines.push(`Permissions: ${perms.join(", ")}`);
|
|
14787
14873
|
lines.push(`Disconnect and revoke: ${revokeCommand}`);
|
|
14788
14874
|
this.log(lines.join("\n"));
|
|
@@ -18748,6 +18834,74 @@ var ListenPendingCommand = class ListenPendingCommand extends Command {
|
|
|
18748
18834
|
}, null, 2));
|
|
18749
18835
|
}
|
|
18750
18836
|
};
|
|
18837
|
+
// src/oclif/commands/lock.ts
|
|
18838
|
+
var LockCommand = class LockCommand extends Command {
|
|
18839
|
+
static summary = "Lock global CLI credentials so agents must use scoped Access Passes";
|
|
18840
|
+
static description = "Blocks global OAuth login (credentials.json), ambient PRIMITIVE_API_KEY, and ad-hoc --api-key overrides until you run `primitive unlock` in an interactive terminal. Scoped Access Passes (`primitive connect <url>`) and connected agent profiles (PRIMITIVE_AGENT_PROFILE) continue to work normally while locked.";
|
|
18841
|
+
static examples = [
|
|
18842
|
+
"<%= config.bin %> lock",
|
|
18843
|
+
"<%= config.bin %> lock --reason 'Keep admin login safe from local agent sessions'",
|
|
18844
|
+
"<%= config.bin %> lock --status"
|
|
18845
|
+
];
|
|
18846
|
+
static flags = {
|
|
18847
|
+
reason: Flags.string({ description: "Optional note shown when a locked global credential is blocked" }),
|
|
18848
|
+
status: Flags.boolean({ description: "Show the current lock status without changing it" }),
|
|
18849
|
+
json: Flags.boolean({ description: "Print the lock status as JSON" })
|
|
18850
|
+
};
|
|
18851
|
+
async run() {
|
|
18852
|
+
const { flags } = await this.parse(LockCommand);
|
|
18853
|
+
try {
|
|
18854
|
+
if (flags.status) {
|
|
18855
|
+
const state = readCliLockState(this.config.configDir);
|
|
18856
|
+
if (flags.json) {
|
|
18857
|
+
this.log(JSON.stringify(state));
|
|
18858
|
+
return;
|
|
18859
|
+
}
|
|
18860
|
+
if (state.status === "locked") {
|
|
18861
|
+
this.log(`Global Primitive credentials are LOCKED (since ${state.lockedAt}).`);
|
|
18862
|
+
if (state.reason) this.log(`Reason: ${state.reason}`);
|
|
18863
|
+
this.log("Allowed while locked: scoped Access Passes (`primitive connect <url>`) and PRIMITIVE_AGENT_PROFILE.");
|
|
18864
|
+
this.log("To temporarily use your global login: `primitive unlock --for 15m`.");
|
|
18865
|
+
return;
|
|
18866
|
+
}
|
|
18867
|
+
if (state.status === "temporarily_unlocked") {
|
|
18868
|
+
this.log(`Global Primitive credentials are temporarily unlocked until ${state.unlockedUntil} (will auto-relock).`);
|
|
18869
|
+
this.log("Run `primitive lock` to re-lock immediately.");
|
|
18870
|
+
return;
|
|
18871
|
+
}
|
|
18872
|
+
this.log("Global Primitive credentials are unlocked.");
|
|
18873
|
+
this.log("Run `primitive lock` to prevent agent sessions from accidentally using your global login or PRIMITIVE_API_KEY.");
|
|
18874
|
+
return;
|
|
18875
|
+
}
|
|
18876
|
+
const nowIso = (/* @__PURE__ */ new Date()).toISOString();
|
|
18877
|
+
const reason = flags.reason?.trim() || null;
|
|
18878
|
+
const record = {
|
|
18879
|
+
version: 1,
|
|
18880
|
+
locked: true,
|
|
18881
|
+
locked_at: nowIso,
|
|
18882
|
+
unlocked_until: null,
|
|
18883
|
+
...reason ? { reason } : {}
|
|
18884
|
+
};
|
|
18885
|
+
writeCliLockState(this.config.configDir, record);
|
|
18886
|
+
if (flags.json) {
|
|
18887
|
+
this.log(JSON.stringify({
|
|
18888
|
+
status: "locked",
|
|
18889
|
+
locked: true,
|
|
18890
|
+
locked_at: nowIso,
|
|
18891
|
+
reason
|
|
18892
|
+
}));
|
|
18893
|
+
return;
|
|
18894
|
+
}
|
|
18895
|
+
this.log("Locked global Primitive credentials on this machine.");
|
|
18896
|
+
this.log("Blocked: saved OAuth login, ambient PRIMITIVE_API_KEY, and ad-hoc --api-key overrides.");
|
|
18897
|
+
this.log("Allowed: scoped Access Passes (`primitive connect <url>`) and PRIMITIVE_AGENT_PROFILE.");
|
|
18898
|
+
this.log("When you need your global login in your terminal: run `primitive unlock --for 15m` (auto-relocks) or `primitive unlock`.");
|
|
18899
|
+
} catch (error) {
|
|
18900
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
18901
|
+
throw new Errors.CLIError(message, { exit: 1 });
|
|
18902
|
+
}
|
|
18903
|
+
}
|
|
18904
|
+
};
|
|
18751
18905
|
// src/oclif/commands/login.ts
|
|
18752
18906
|
const MAX_CLI_LOGIN_POLL_INTERVAL_SECONDS = 60;
|
|
18753
18907
|
/** How long a login waits for an in-flight agent registration on this machine. */
|
|
@@ -20027,6 +20181,10 @@ async function runLogoutWithCredentialLock(params) {
|
|
|
20027
20181
|
throw error;
|
|
20028
20182
|
}
|
|
20029
20183
|
const freshCredentials = authenticated.auth.credentials ?? credentials;
|
|
20184
|
+
if (authenticated.auth.source === "agent-pass" && authenticated.auth.agentPass) {
|
|
20185
|
+
const disconnectCmd = authenticated.auth.agentPass.binding.kind === "profile" ? `primitive disconnect --profile ${authenticated.auth.agentPass.binding.profile}` : "primitive disconnect";
|
|
20186
|
+
throw cliError$1(`An Access Pass ("${authenticated.auth.agentPass.label}") is active in this context. Run \`${disconnectCmd}\` to disconnect the Access Pass, or run \`primitive logout\` outside the bound session to log out of your saved Primitive CLI login.`);
|
|
20187
|
+
}
|
|
20030
20188
|
const result = await deps.cliLogout({
|
|
20031
20189
|
body: { key_id: freshCredentials.oauth_grant_id },
|
|
20032
20190
|
client: authenticated.apiClient.client,
|
|
@@ -21461,9 +21619,9 @@ function parseJsonObjectFlag(raw, label) {
|
|
|
21461
21619
|
return parsed;
|
|
21462
21620
|
}
|
|
21463
21621
|
function buildExternalRef(flags) {
|
|
21464
|
-
const hasRefFlags =
|
|
21465
|
-
if (flags["external-ref"] && hasRefFlags) throw new Errors.CLIError("Use either --external-ref or --ref-system/--ref-id/--ref-url/--ref-label, not both.", { exit: 2 });
|
|
21466
|
-
if (flags["external-ref"]) {
|
|
21622
|
+
const hasRefFlags = flags["ref-system"] !== void 0 || flags["ref-id"] !== void 0 || flags["ref-url"] !== void 0 || flags["ref-label"] !== void 0;
|
|
21623
|
+
if (flags["external-ref"] !== void 0 && hasRefFlags) throw new Errors.CLIError("Use either --external-ref or --ref-system/--ref-id/--ref-url/--ref-label, not both.", { exit: 2 });
|
|
21624
|
+
if (flags["external-ref"] !== void 0) {
|
|
21467
21625
|
const obj = parseJsonObjectFlag(flags["external-ref"], "--external-ref");
|
|
21468
21626
|
if (typeof obj.system !== "string" || !obj.system.trim()) throw new Errors.CLIError("--external-ref must include a non-empty string `system`.", { exit: 2 });
|
|
21469
21627
|
const ref = { system: obj.system.trim() };
|
|
@@ -21556,17 +21714,17 @@ var ActivityLogCommand = class ActivityLogCommand extends Command {
|
|
|
21556
21714
|
if (!flags.thread && !flags.email) throw new Errors.CLIError("Provide --thread <uuid> or --email <uuid>.", { exit: 2 });
|
|
21557
21715
|
if (flags.detail !== void 0 && flags["detail-file"] !== void 0) throw new Errors.CLIError("Use either --detail or --detail-file, not both.", { exit: 2 });
|
|
21558
21716
|
if (flags.data !== void 0 && flags["data-file"] !== void 0) throw new Errors.CLIError("Use either --data or --data-file, not both.", { exit: 2 });
|
|
21559
|
-
const threadId = flags.thread ? assertUuid(flags.thread, "--thread") : null;
|
|
21560
|
-
const emailId = flags.email ? assertUuid(flags.email, "--email") : null;
|
|
21561
|
-
const sentEmailId = flags["sent-email"] ? assertUuid(flags["sent-email"], "--sent-email") : void 0;
|
|
21562
|
-
if (flags.action && !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 });
|
|
21563
|
-
if (flags["idempotency-key"] && !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 });
|
|
21564
|
-
const detail = flags["detail-file"] ? readUtf8File(flags["detail-file"], "--detail-file") : flags.detail;
|
|
21717
|
+
const threadId = flags.thread !== void 0 ? assertUuid(flags.thread, "--thread") : null;
|
|
21718
|
+
const emailId = flags.email !== void 0 ? assertUuid(flags.email, "--email") : null;
|
|
21719
|
+
const sentEmailId = flags["sent-email"] !== void 0 ? assertUuid(flags["sent-email"], "--sent-email") : void 0;
|
|
21720
|
+
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 });
|
|
21721
|
+
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 });
|
|
21722
|
+
const detail = flags["detail-file"] !== void 0 ? readUtf8File(flags["detail-file"], "--detail-file") : flags.detail;
|
|
21565
21723
|
if (detail !== void 0 && detail.length > 8e3) throw new Errors.CLIError("Detail must be at most 8000 characters.", { exit: 2 });
|
|
21566
|
-
const data = flags["data-file"] ? parseJsonObjectFlag(readUtf8File(flags["data-file"], "--data-file"), "--data-file") : flags.data ? parseJsonObjectFlag(flags.data, "--data") : void 0;
|
|
21724
|
+
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;
|
|
21567
21725
|
const externalRef = buildExternalRef(flags);
|
|
21568
|
-
const runId = flags["run-id"]
|
|
21569
|
-
const traceUrl = flags["trace-url"] ? assertHttpUrl(flags["trace-url"], "--trace-url") : void 0;
|
|
21726
|
+
const runId = flags["run-id"] !== void 0 ? validateActivityRunId(flags["run-id"], "--run-id") : void 0;
|
|
21727
|
+
const traceUrl = flags["trace-url"] !== void 0 ? assertHttpUrl(flags["trace-url"], "--trace-url") : void 0;
|
|
21570
21728
|
const body = {
|
|
21571
21729
|
summary,
|
|
21572
21730
|
...flags.kind ? { kind: flags.kind } : {},
|
|
@@ -21655,11 +21813,11 @@ var ActivityUpdateCommand = class ActivityUpdateCommand extends Command {
|
|
|
21655
21813
|
if (!trimmed || trimmed.length > 1e3) throw new Errors.CLIError("--summary must be 1 to 1000 characters.", { exit: 2 });
|
|
21656
21814
|
body.summary = trimmed;
|
|
21657
21815
|
}
|
|
21658
|
-
if (flags["detail-file"] && flags.detail !== void 0) throw new Errors.CLIError("Use either --detail or --detail-file, not both.", { exit: 2 });
|
|
21816
|
+
if (flags["detail-file"] !== void 0 && flags.detail !== void 0) throw new Errors.CLIError("Use either --detail or --detail-file, not both.", { exit: 2 });
|
|
21659
21817
|
if (flags["clear-detail"] && (flags.detail !== void 0 || flags["detail-file"] !== void 0)) throw new Errors.CLIError("--clear-detail cannot be combined with --detail or --detail-file.", { exit: 2 });
|
|
21660
21818
|
if (flags["clear-detail"]) body.detail = null;
|
|
21661
|
-
else if (flags["detail-file"] || flags.detail !== void 0) {
|
|
21662
|
-
const detailText = flags["detail-file"] ? readUtf8File(flags["detail-file"], "--detail-file") : flags.detail ?? "";
|
|
21819
|
+
else if (flags["detail-file"] !== void 0 || flags.detail !== void 0) {
|
|
21820
|
+
const detailText = flags["detail-file"] !== void 0 ? readUtf8File(flags["detail-file"], "--detail-file") : flags.detail ?? "";
|
|
21663
21821
|
if (detailText.length > 8e3) throw new Errors.CLIError("Detail must be at most 8000 characters.", { exit: 2 });
|
|
21664
21822
|
body.detail = detailText;
|
|
21665
21823
|
}
|
|
@@ -21670,15 +21828,15 @@ var ActivityUpdateCommand = class ActivityUpdateCommand extends Command {
|
|
|
21670
21828
|
const ref = buildExternalRef(flags);
|
|
21671
21829
|
if (ref) body.external_ref = ref;
|
|
21672
21830
|
}
|
|
21673
|
-
if (flags["data-file"] && flags.data !== void 0) throw new Errors.CLIError("Use either --data or --data-file, not both.", { exit: 2 });
|
|
21674
|
-
if (flags["data-file"]) body.data = parseJsonObjectFlag(readUtf8File(flags["data-file"], "--data-file"), "--data-file");
|
|
21675
|
-
else if (flags.data) body.data = parseJsonObjectFlag(flags.data, "--data");
|
|
21831
|
+
if (flags["data-file"] !== void 0 && flags.data !== void 0) throw new Errors.CLIError("Use either --data or --data-file, not both.", { exit: 2 });
|
|
21832
|
+
if (flags["data-file"] !== void 0) body.data = parseJsonObjectFlag(readUtf8File(flags["data-file"], "--data-file"), "--data-file");
|
|
21833
|
+
else if (flags.data !== void 0) body.data = parseJsonObjectFlag(flags.data, "--data");
|
|
21676
21834
|
if (flags["clear-run-id"] && flags["run-id"] !== void 0) throw new Errors.CLIError("--clear-run-id cannot be combined with --run-id.", { exit: 2 });
|
|
21677
21835
|
if (flags["clear-run-id"]) body.run_id = null;
|
|
21678
|
-
else if (flags["run-id"]) body.run_id = validateActivityRunId(flags["run-id"], "--run-id");
|
|
21836
|
+
else if (flags["run-id"] !== void 0) body.run_id = validateActivityRunId(flags["run-id"], "--run-id");
|
|
21679
21837
|
if (flags["clear-trace-url"] && flags["trace-url"] !== void 0) throw new Errors.CLIError("--clear-trace-url cannot be combined with --trace-url.", { exit: 2 });
|
|
21680
21838
|
if (flags["clear-trace-url"]) body.trace_url = null;
|
|
21681
|
-
else if (flags["trace-url"]) body.trace_url = assertHttpUrl(flags["trace-url"], "--trace-url");
|
|
21839
|
+
else if (flags["trace-url"] !== void 0) body.trace_url = assertHttpUrl(flags["trace-url"], "--trace-url");
|
|
21682
21840
|
if (flags.visibility) body.visibility = flags.visibility;
|
|
21683
21841
|
if (Object.keys(body).length === 0) throw new Errors.CLIError("Provide at least one field to update.", { exit: 2 });
|
|
21684
21842
|
await runWithTiming(flags.time === true, async () => {
|
|
@@ -21743,8 +21901,8 @@ var ActivityTimelineCommand = class ActivityTimelineCommand extends Command {
|
|
|
21743
21901
|
async run() {
|
|
21744
21902
|
const { args, flags } = await this.parse(ActivityTimelineCommand);
|
|
21745
21903
|
const threadId = assertUuid(args.thread_id, "thread_id");
|
|
21746
|
-
const status = flags.status ? validateStatusCsv(flags.status) : void 0;
|
|
21747
|
-
const actorId = flags["actor-id"] ? assertUuid(flags["actor-id"], "--actor-id") : void 0;
|
|
21904
|
+
const status = flags.status !== void 0 ? validateStatusCsv(flags.status) : void 0;
|
|
21905
|
+
const actorId = flags["actor-id"] !== void 0 ? assertUuid(flags["actor-id"], "--actor-id") : void 0;
|
|
21748
21906
|
await runWithTiming(flags.time === true, async () => {
|
|
21749
21907
|
const result = await callActivityApi({
|
|
21750
21908
|
configDir: this.config.configDir,
|
|
@@ -21833,20 +21991,20 @@ var ActivityListCommand = class ActivityListCommand extends Command {
|
|
|
21833
21991
|
async run() {
|
|
21834
21992
|
const { flags } = await this.parse(ActivityListCommand);
|
|
21835
21993
|
if (flags.format === "csv" && flags.json) throw new Errors.CLIError("Cannot combine --format csv with --json.", { exit: 2 });
|
|
21836
|
-
const status = flags.status ? validateStatusCsv(flags.status) : void 0;
|
|
21994
|
+
const status = flags.status !== void 0 ? validateStatusCsv(flags.status) : void 0;
|
|
21837
21995
|
const query = {
|
|
21838
21996
|
source: flags.source,
|
|
21839
|
-
thread_id: flags.thread ? assertUuid(flags.thread, "--thread") : void 0,
|
|
21840
|
-
email_id: flags.email ? assertUuid(flags.email, "--email") : void 0,
|
|
21841
|
-
sent_email_id: flags["sent-email"] ? assertUuid(flags["sent-email"], "--sent-email") : void 0,
|
|
21997
|
+
thread_id: flags.thread !== void 0 ? assertUuid(flags.thread, "--thread") : void 0,
|
|
21998
|
+
email_id: flags.email !== void 0 ? assertUuid(flags.email, "--email") : void 0,
|
|
21999
|
+
sent_email_id: flags["sent-email"] !== void 0 ? assertUuid(flags["sent-email"], "--sent-email") : void 0,
|
|
21842
22000
|
kind: flags.kind,
|
|
21843
22001
|
status,
|
|
21844
22002
|
attention: flags.attention ? "true" : void 0,
|
|
21845
22003
|
action: flags.action,
|
|
21846
22004
|
actor_kind: flags["actor-kind"],
|
|
21847
22005
|
actor_ownership: flags["actor-ownership"],
|
|
21848
|
-
actor_id: flags["actor-id"] ? assertUuid(flags["actor-id"], "--actor-id") : void 0,
|
|
21849
|
-
owner_user_id: flags["owner-user-id"] ? assertUuid(flags["owner-user-id"], "--owner-user-id") : void 0,
|
|
22006
|
+
actor_id: flags["actor-id"] !== void 0 ? assertUuid(flags["actor-id"], "--actor-id") : void 0,
|
|
22007
|
+
owner_user_id: flags["owner-user-id"] !== void 0 ? assertUuid(flags["owner-user-id"], "--owner-user-id") : void 0,
|
|
21850
22008
|
oauth_client_id: flags["oauth-client-id"],
|
|
21851
22009
|
run_id: flags["run-id"],
|
|
21852
22010
|
include_private: flags["include-private"] ? "true" : void 0,
|
|
@@ -21915,7 +22073,7 @@ var ActivityAgentsCommand = class ActivityAgentsCommand extends Command {
|
|
|
21915
22073
|
};
|
|
21916
22074
|
async run() {
|
|
21917
22075
|
const { flags } = await this.parse(ActivityAgentsCommand);
|
|
21918
|
-
const ownerUserId = flags["owner-user-id"] ? assertUuid(flags["owner-user-id"], "--owner-user-id") : void 0;
|
|
22076
|
+
const ownerUserId = flags["owner-user-id"] !== void 0 ? assertUuid(flags["owner-user-id"], "--owner-user-id") : void 0;
|
|
21919
22077
|
await runWithTiming(flags.time === true, async () => {
|
|
21920
22078
|
const result = await callActivityApi({
|
|
21921
22079
|
configDir: this.config.configDir,
|
|
@@ -26361,12 +26519,27 @@ function resolveSkillTargets(options) {
|
|
|
26361
26519
|
if (options.out !== void 0) {
|
|
26362
26520
|
if (!options.out.trim()) throw new Errors.CLIError("--out must be a non-empty path.", { exit: 2 });
|
|
26363
26521
|
const resolvedOut = resolve(cwd, options.out);
|
|
26364
|
-
const
|
|
26522
|
+
const base = basename(resolvedOut);
|
|
26523
|
+
const hasTrailingSep = /[\\/]$/.test(options.out.trim());
|
|
26524
|
+
const existingDir = (() => {
|
|
26525
|
+
try {
|
|
26526
|
+
return lstatSync(resolvedOut).isDirectory();
|
|
26527
|
+
} catch {
|
|
26528
|
+
return false;
|
|
26529
|
+
}
|
|
26530
|
+
})();
|
|
26531
|
+
const ext = extname(base);
|
|
26532
|
+
const isFilePath = !hasTrailingSep && !existingDir && (base.toLowerCase() === "skill.md" || ext.length > 1 && !base.startsWith("."));
|
|
26365
26533
|
const directory = isFilePath ? dirname(resolvedOut) : resolvedOut;
|
|
26366
|
-
if (basename(directory).toLowerCase() === "primitive-connect") throw new Errors.CLIError(`Refusing to write into "${CONNECT_SKILL_NAME}", which is reserved for the bundled connection skill.`, { exit: 2 });
|
|
26534
|
+
if (basename(directory).toLowerCase() === "primitive-connect" || isFilePath && base.toLowerCase() === `primitive-connect.md`) throw new Errors.CLIError(`Refusing to write into "${CONNECT_SKILL_NAME}", which is reserved for the bundled connection skill.`, { exit: 2 });
|
|
26367
26535
|
const filePath = isFilePath ? resolvedOut : join(resolvedOut, "SKILL.md");
|
|
26368
26536
|
const home = resolve(userHome(env));
|
|
26369
|
-
const
|
|
26537
|
+
const matchedHomeRoot = SKILL_TARGETS.map((t) => targetRootDir(t, {
|
|
26538
|
+
project: false,
|
|
26539
|
+
cwd,
|
|
26540
|
+
env
|
|
26541
|
+
})).find((rootDir) => isSubpath(rootDir, directory));
|
|
26542
|
+
const boundary = matchedHomeRoot ? matchedHomeRoot : isSubpath(cwd, directory) ? cwd : isSubpath(home, directory) ? home : dirname(directory);
|
|
26370
26543
|
return [{
|
|
26371
26544
|
target: "custom",
|
|
26372
26545
|
directory,
|
|
@@ -26384,7 +26557,6 @@ function resolveSkillTargets(options) {
|
|
|
26384
26557
|
}));
|
|
26385
26558
|
else if (selector === "all") expanded.push(...SKILL_TARGETS);
|
|
26386
26559
|
else expanded.push(selector);
|
|
26387
|
-
const home = resolve(userHome(env));
|
|
26388
26560
|
const deduped = [];
|
|
26389
26561
|
const seenDirs = /* @__PURE__ */ new Set();
|
|
26390
26562
|
for (const target of expanded) {
|
|
@@ -26396,7 +26568,7 @@ function resolveSkillTargets(options) {
|
|
|
26396
26568
|
const directory = join(rootDir, name);
|
|
26397
26569
|
if (seenDirs.has(directory)) continue;
|
|
26398
26570
|
seenDirs.add(directory);
|
|
26399
|
-
const boundary = project ? cwd :
|
|
26571
|
+
const boundary = project ? cwd : rootDir;
|
|
26400
26572
|
deduped.push({
|
|
26401
26573
|
target,
|
|
26402
26574
|
directory,
|
|
@@ -26417,6 +26589,16 @@ function sha256Text(content) {
|
|
|
26417
26589
|
function assertNoSymlinkAncestors(targetDir, boundary) {
|
|
26418
26590
|
const resolvedDir = resolve(targetDir);
|
|
26419
26591
|
const start = boundary && isSubpath(resolve(boundary), resolvedDir) ? resolve(boundary) : dirname(resolvedDir);
|
|
26592
|
+
try {
|
|
26593
|
+
if (!statSync(start).isDirectory()) throw new Errors.CLIError(`Expected directory at ${start}, found a non-directory entry.`, { exit: 1 });
|
|
26594
|
+
} catch (error) {
|
|
26595
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") try {
|
|
26596
|
+
if (lstatSync(start).isSymbolicLink()) throw new Errors.CLIError(`Refusing to traverse dangling symbolic link: ${start}`, { exit: 1 });
|
|
26597
|
+
} catch (lstatError) {
|
|
26598
|
+
if (!(lstatError && typeof lstatError === "object" && "code" in lstatError && lstatError.code === "ENOENT")) throw lstatError;
|
|
26599
|
+
}
|
|
26600
|
+
else throw error;
|
|
26601
|
+
}
|
|
26420
26602
|
const rel = relative(start, resolvedDir);
|
|
26421
26603
|
const segments = rel ? rel.split(sep).filter(Boolean) : [];
|
|
26422
26604
|
let current = start;
|
|
@@ -26448,6 +26630,13 @@ function hasConnectFrontmatter(content) {
|
|
|
26448
26630
|
if (!match) return false;
|
|
26449
26631
|
return /^name:\s*["']?primitive-connect["']?\s*$/im.test(match[1] ?? "");
|
|
26450
26632
|
}
|
|
26633
|
+
function applySkillFrontmatterName(markdown, normalizedName) {
|
|
26634
|
+
if (normalizedName === "primitive") return markdown;
|
|
26635
|
+
const match = markdown.match(/^(---\r?\n)([\s\S]*?)(\r?\n---(?:\r?\n|$))/);
|
|
26636
|
+
if (!match) return markdown;
|
|
26637
|
+
const [, open, body, close] = match;
|
|
26638
|
+
return `${open}${(body ?? "").replace(/^(name:\s*)(["']?)primitive\2(\s*)$/m, `$1$2${normalizedName}$2$3`)}${close}${markdown.slice(match[0].length)}`;
|
|
26639
|
+
}
|
|
26451
26640
|
function isSkillFilePresent(target) {
|
|
26452
26641
|
try {
|
|
26453
26642
|
assertNoSymlinkAncestors(target.directory, target.boundary);
|
|
@@ -26505,22 +26694,78 @@ function writeFileAtomically(filePath, content, boundary) {
|
|
|
26505
26694
|
throw error;
|
|
26506
26695
|
}
|
|
26507
26696
|
}
|
|
26697
|
+
function readMarkerMetadata(metaPath) {
|
|
26698
|
+
let metaStat;
|
|
26699
|
+
try {
|
|
26700
|
+
metaStat = lstatSync(metaPath);
|
|
26701
|
+
} catch (error) {
|
|
26702
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") return {
|
|
26703
|
+
exists: false,
|
|
26704
|
+
meta: null
|
|
26705
|
+
};
|
|
26706
|
+
throw error;
|
|
26707
|
+
}
|
|
26708
|
+
if (metaStat.isSymbolicLink() || !metaStat.isFile() || metaStat.size > MAX_META_BYTES) return {
|
|
26709
|
+
exists: true,
|
|
26710
|
+
meta: null
|
|
26711
|
+
};
|
|
26712
|
+
try {
|
|
26713
|
+
const raw = JSON.parse(readFileSync(metaPath, "utf8"));
|
|
26714
|
+
if (typeof raw.etag !== "string" || !SKILL_ETAG_RE.test(raw.etag) || typeof raw.sha256 !== "string" || typeof raw.name !== "string") return {
|
|
26715
|
+
exists: true,
|
|
26716
|
+
meta: null
|
|
26717
|
+
};
|
|
26718
|
+
return {
|
|
26719
|
+
exists: true,
|
|
26720
|
+
meta: {
|
|
26721
|
+
name: raw.name,
|
|
26722
|
+
version: typeof raw.version === "string" ? raw.version : "1",
|
|
26723
|
+
etag: raw.etag,
|
|
26724
|
+
sha256: raw.sha256,
|
|
26725
|
+
api_base_url: typeof raw.api_base_url === "string" ? raw.api_base_url : "",
|
|
26726
|
+
org_id: typeof raw.org_id === "string" ? raw.org_id : "",
|
|
26727
|
+
auth_method: typeof raw.auth_method === "string" ? raw.auth_method : null,
|
|
26728
|
+
installed_at: typeof raw.installed_at === "string" ? raw.installed_at : ""
|
|
26729
|
+
}
|
|
26730
|
+
};
|
|
26731
|
+
} catch {
|
|
26732
|
+
return {
|
|
26733
|
+
exists: true,
|
|
26734
|
+
meta: null
|
|
26735
|
+
};
|
|
26736
|
+
}
|
|
26737
|
+
}
|
|
26508
26738
|
function installSkillToTarget(target, payload, options = {}) {
|
|
26509
26739
|
assertNoSymlinkAncestors(target.directory, target.boundary);
|
|
26510
26740
|
assertRegularFileOrMissing(target.filePath);
|
|
26511
26741
|
assertRegularFileOrMissing(target.metaPath);
|
|
26512
26742
|
const hadFile = isSkillFilePresent(target);
|
|
26743
|
+
const marker = readMarkerMetadata(target.metaPath);
|
|
26744
|
+
let locallyModified = false;
|
|
26513
26745
|
if (hadFile) {
|
|
26514
|
-
|
|
26746
|
+
const stat = lstatSync(target.filePath);
|
|
26747
|
+
let existingText = null;
|
|
26748
|
+
if (stat.size <= MAX_SKILL_BYTES) {
|
|
26749
|
+
existingText = readFileSync(target.filePath, "utf8");
|
|
26750
|
+
if (hasConnectFrontmatter(existingText)) throw new Errors.CLIError(`Refusing to overwrite bundled "${CONNECT_SKILL_NAME}" skill at ${target.filePath}.`, { exit: 2 });
|
|
26751
|
+
}
|
|
26752
|
+
if (!marker.exists) {
|
|
26753
|
+
if (!options.force) throw new Errors.CLIError(`Refusing to overwrite unmanaged skill file at ${target.filePath} (missing ${SKILL_META_FILENAME}). Pass --force to overwrite it, or pass --name to install under a different skill directory.`, { exit: 2 });
|
|
26754
|
+
} else if (marker.meta) {
|
|
26755
|
+
const currentHash = existingText !== null ? sha256Text(existingText) : null;
|
|
26756
|
+
if (currentHash === null || currentHash !== marker.meta.sha256) locallyModified = true;
|
|
26757
|
+
}
|
|
26515
26758
|
}
|
|
26759
|
+
const normalizedName = validateSkillName(payload.name);
|
|
26760
|
+
const markdown = applySkillFrontmatterName(payload.markdown, normalizedName);
|
|
26516
26761
|
const existing = readInstalledSkillMeta(target);
|
|
26517
|
-
const sha256 = sha256Text(
|
|
26762
|
+
const sha256 = sha256Text(markdown);
|
|
26518
26763
|
if (!options.force && existing && existing.etag === payload.etag && existing.sha256 === sha256) return {
|
|
26519
26764
|
state: "unchanged",
|
|
26520
26765
|
previousEtag: existing.etag
|
|
26521
26766
|
};
|
|
26522
26767
|
const meta = {
|
|
26523
|
-
name:
|
|
26768
|
+
name: normalizedName,
|
|
26524
26769
|
version: payload.version,
|
|
26525
26770
|
etag: payload.etag,
|
|
26526
26771
|
sha256,
|
|
@@ -26529,11 +26774,13 @@ function installSkillToTarget(target, payload, options = {}) {
|
|
|
26529
26774
|
auth_method: payload.authMethod,
|
|
26530
26775
|
installed_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
26531
26776
|
};
|
|
26532
|
-
writeFileAtomically(target.filePath,
|
|
26777
|
+
writeFileAtomically(target.filePath, markdown, target.boundary);
|
|
26533
26778
|
writeFileAtomically(target.metaPath, `${JSON.stringify(meta, null, 2)}\n`, target.boundary);
|
|
26779
|
+
const warning = locallyModified ? `Overwrote locally modified ${target.filePath} with the live Primitive skill from the server.` : void 0;
|
|
26534
26780
|
return {
|
|
26535
26781
|
state: existing || hadFile ? "updated" : "installed",
|
|
26536
|
-
previousEtag: existing?.etag ?? null
|
|
26782
|
+
previousEtag: existing?.etag ?? marker.meta?.etag ?? null,
|
|
26783
|
+
...warning ? { warning } : {}
|
|
26537
26784
|
};
|
|
26538
26785
|
}
|
|
26539
26786
|
// src/oclif/commands/skill.ts
|
|
@@ -26544,15 +26791,14 @@ async function fetchCliSkill(options) {
|
|
|
26544
26791
|
apiBaseUrl: options.apiBaseUrl
|
|
26545
26792
|
});
|
|
26546
26793
|
if (!authenticated.auth.apiKey) throw new Errors.CLIError("No Primitive credential is active. Connect with `primitive connect <url>`, set PRIMITIVE_API_KEY, or run `primitive signin`.", { exit: 1 });
|
|
26547
|
-
const headers =
|
|
26794
|
+
const headers = {
|
|
26548
26795
|
accept: "application/json",
|
|
26549
|
-
authorization: `Bearer ${authenticated.auth.apiKey}`,
|
|
26550
26796
|
...options.ifNoneMatch && SKILL_ETAG_RE.test(options.ifNoneMatch) ? { "if-none-match": `"${options.ifNoneMatch}"` } : {}
|
|
26551
|
-
}
|
|
26797
|
+
};
|
|
26552
26798
|
const baseUrl = authenticated.auth.apiBaseUrl.replace(/\/+$/, "");
|
|
26553
26799
|
let response;
|
|
26554
26800
|
try {
|
|
26555
|
-
response = await fetch(`${baseUrl}/cli/skill`, {
|
|
26801
|
+
response = await authenticated.fetch(`${baseUrl}/cli/skill`, {
|
|
26556
26802
|
method: "GET",
|
|
26557
26803
|
headers,
|
|
26558
26804
|
redirect: "manual",
|
|
@@ -26578,8 +26824,13 @@ async function fetchCliSkill(options) {
|
|
|
26578
26824
|
parsed = null;
|
|
26579
26825
|
}
|
|
26580
26826
|
if (!response.ok) {
|
|
26581
|
-
const
|
|
26582
|
-
|
|
26827
|
+
const errObj = parsed && typeof parsed === "object" && "error" in parsed ? parsed.error : void 0;
|
|
26828
|
+
const code = errObj?.code;
|
|
26829
|
+
const message = errObj?.message || `Primitive API returned HTTP ${response.status} for GET /v1/cli/skill.`;
|
|
26830
|
+
throw new Errors.CLIError(message, {
|
|
26831
|
+
exit: 1,
|
|
26832
|
+
...code ? { code } : {}
|
|
26833
|
+
});
|
|
26583
26834
|
}
|
|
26584
26835
|
const data = parsed && typeof parsed === "object" && "data" in parsed ? parsed.data : void 0;
|
|
26585
26836
|
if (!data || typeof data.markdown !== "string" || !data.etag) throw new Errors.CLIError("Unexpected response shape from GET /v1/cli/skill.", { exit: 1 });
|
|
@@ -26611,7 +26862,11 @@ function reportSkillCheckResult(command, params) {
|
|
|
26611
26862
|
if (params.json) command.log(JSON.stringify({
|
|
26612
26863
|
state: overall,
|
|
26613
26864
|
etag: params.serverEtag,
|
|
26614
|
-
targets: statuses
|
|
26865
|
+
targets: statuses,
|
|
26866
|
+
...!allFresh ? { error: {
|
|
26867
|
+
code: overall === "missing" ? "skill_missing" : "skill_stale",
|
|
26868
|
+
message: overall === "missing" ? "Installed Primitive skill is missing. Run `primitive skill install` to install." : "Installed Primitive skill is out of date. Run `primitive skill install` to update."
|
|
26869
|
+
} } : {}
|
|
26615
26870
|
}));
|
|
26616
26871
|
else {
|
|
26617
26872
|
for (const item of statuses) command.log(`${item.state}\t${item.target}\t${item.path}`);
|
|
@@ -26704,11 +26959,13 @@ var SkillCommand = class SkillCommand extends Command {
|
|
|
26704
26959
|
authMethod: result.data.auth_method,
|
|
26705
26960
|
markdown: result.data.markdown
|
|
26706
26961
|
}, { force: true });
|
|
26962
|
+
if (outcome.warning) process.stderr.write(`Warning: ${outcome.warning}\n`);
|
|
26707
26963
|
if (flags.json) this.log(JSON.stringify({
|
|
26708
26964
|
state: outcome.state,
|
|
26709
26965
|
path: target.filePath,
|
|
26710
26966
|
etag: result.data.etag,
|
|
26711
|
-
modules: result.data.modules
|
|
26967
|
+
modules: result.data.modules,
|
|
26968
|
+
...outcome.warning ? { warning: outcome.warning } : {}
|
|
26712
26969
|
}));
|
|
26713
26970
|
else this.log(`Wrote Primitive skill (${result.data.etag}) to ${target.filePath}`);
|
|
26714
26971
|
return;
|
|
@@ -26749,7 +27006,7 @@ var SkillInstallCommand = class SkillInstallCommand extends Command {
|
|
|
26749
27006
|
default: DEFAULT_LIVE_SKILL_NAME
|
|
26750
27007
|
}),
|
|
26751
27008
|
check: Flags.boolean({ description: "Dry-run freshness check against server ETag without writing files (exits 0 fresh, 2 stale/missing)" }),
|
|
26752
|
-
force: Flags.boolean({ description: "Rewrite SKILL.md even if the installed ETag matches" }),
|
|
27009
|
+
force: Flags.boolean({ description: "Rewrite SKILL.md even if the installed ETag matches or an unmanaged file exists" }),
|
|
26753
27010
|
json: Flags.boolean({ description: "Output installation summary as JSON" }),
|
|
26754
27011
|
time: Flags.boolean({ description: "Print request timing to stderr" }),
|
|
26755
27012
|
"api-key": Flags.string({
|
|
@@ -26816,11 +27073,13 @@ var SkillInstallCommand = class SkillInstallCommand extends Command {
|
|
|
26816
27073
|
authMethod: result.data.auth_method,
|
|
26817
27074
|
markdown: result.data.markdown
|
|
26818
27075
|
}, { force: flags.force });
|
|
27076
|
+
if (outcome.warning) process.stderr.write(`Warning: ${outcome.warning}\n`);
|
|
26819
27077
|
return {
|
|
26820
27078
|
target: t.target,
|
|
26821
27079
|
path: t.filePath,
|
|
26822
27080
|
state: outcome.state,
|
|
26823
|
-
previous_etag: outcome.previousEtag
|
|
27081
|
+
previous_etag: outcome.previousEtag,
|
|
27082
|
+
...outcome.warning ? { warning: outcome.warning } : {}
|
|
26824
27083
|
};
|
|
26825
27084
|
});
|
|
26826
27085
|
const overall = installed.every((i) => i.state === "unchanged") ? "unchanged" : installed.some((i) => i.state === "updated") ? "updated" : "installed";
|
|
@@ -27169,6 +27428,77 @@ var ThreadsMutedCommand = class ThreadsMutedCommand extends Command {
|
|
|
27169
27428
|
this.log(JSON.stringify(entries, null, 2));
|
|
27170
27429
|
}
|
|
27171
27430
|
};
|
|
27431
|
+
// src/oclif/commands/unlock.ts
|
|
27432
|
+
var UnlockCommand = class UnlockCommand extends Command {
|
|
27433
|
+
static summary = "Unlock global CLI credentials (permanently or temporarily with auto-relock)";
|
|
27434
|
+
static description = "Unlocks global Primitive CLI credentials previously locked with `primitive lock`. Refuses non-interactive shells by default so AI agents cannot unlock your global admin credentials on their own. Pass `--for 15m` to unlock temporarily and auto-relock.";
|
|
27435
|
+
static examples = [
|
|
27436
|
+
"<%= config.bin %> unlock --for 15m",
|
|
27437
|
+
"<%= config.bin %> unlock --for 1h",
|
|
27438
|
+
"<%= config.bin %> unlock"
|
|
27439
|
+
];
|
|
27440
|
+
static flags = {
|
|
27441
|
+
for: Flags.string({ description: "Temporarily unlock for a bounded duration before automatically re-locking (for example: 15m, 1h, 4h)" }),
|
|
27442
|
+
"force-non-interactive": Flags.boolean({
|
|
27443
|
+
description: "Allow unlocking outside an interactive TTY (intended for human-authored scripts only; AI agents must not pass this)",
|
|
27444
|
+
hidden: true
|
|
27445
|
+
}),
|
|
27446
|
+
json: Flags.boolean({ description: "Print the unlock result as JSON" })
|
|
27447
|
+
};
|
|
27448
|
+
async run() {
|
|
27449
|
+
const { flags } = await this.parse(UnlockCommand);
|
|
27450
|
+
try {
|
|
27451
|
+
if (!process.stdin.isTTY && !flags["force-non-interactive"]) throw new Errors.CLIError([
|
|
27452
|
+
"Refusing to unlock global Primitive credentials from a non-interactive shell.",
|
|
27453
|
+
"AI agents: Do NOT unlock the user's global admin credentials. Ask the user to share a scoped Access Pass (`primitive connect <url>`) or ask the user to run `primitive unlock` directly in their own terminal.",
|
|
27454
|
+
"Humans: Run `primitive unlock --for 15m` or `primitive unlock` directly in your interactive terminal."
|
|
27455
|
+
].join("\n"), { exit: 1 });
|
|
27456
|
+
if (flags.for) {
|
|
27457
|
+
const seconds = parseUnlockDurationSeconds(flags.for);
|
|
27458
|
+
const nowMs = Date.now();
|
|
27459
|
+
const existing = readCliLockState(this.config.configDir, () => nowMs);
|
|
27460
|
+
const lockedAt = existing.status === "unlocked" ? new Date(nowMs).toISOString() : existing.lockedAt;
|
|
27461
|
+
const reason = existing.status === "unlocked" ? null : existing.reason;
|
|
27462
|
+
const unlockedUntil = new Date(nowMs + seconds * 1e3).toISOString();
|
|
27463
|
+
writeCliLockState(this.config.configDir, {
|
|
27464
|
+
version: 1,
|
|
27465
|
+
locked: true,
|
|
27466
|
+
locked_at: lockedAt,
|
|
27467
|
+
unlocked_until: unlockedUntil,
|
|
27468
|
+
...reason ? { reason } : {}
|
|
27469
|
+
});
|
|
27470
|
+
if (flags.json) {
|
|
27471
|
+
this.log(JSON.stringify({
|
|
27472
|
+
status: "temporarily_unlocked",
|
|
27473
|
+
locked: false,
|
|
27474
|
+
unlocked_until: unlockedUntil
|
|
27475
|
+
}));
|
|
27476
|
+
return;
|
|
27477
|
+
}
|
|
27478
|
+
this.log(`Unlocked global Primitive credentials until ${unlockedUntil} (will auto-relock).`);
|
|
27479
|
+
this.log("Run `primitive lock` to re-lock earlier.");
|
|
27480
|
+
return;
|
|
27481
|
+
}
|
|
27482
|
+
const removed = removeCliLockState(this.config.configDir);
|
|
27483
|
+
if (flags.json) {
|
|
27484
|
+
this.log(JSON.stringify({
|
|
27485
|
+
status: "unlocked",
|
|
27486
|
+
locked: false,
|
|
27487
|
+
was_locked: removed
|
|
27488
|
+
}));
|
|
27489
|
+
return;
|
|
27490
|
+
}
|
|
27491
|
+
if (removed) {
|
|
27492
|
+
this.log("Unlocked global Primitive credentials.");
|
|
27493
|
+
this.log("Run `primitive lock` again when you want to protect global credentials from agent sessions.");
|
|
27494
|
+
} else this.log("Global Primitive credentials were already unlocked.");
|
|
27495
|
+
} catch (error) {
|
|
27496
|
+
if (error instanceof Errors.CLIError) throw error;
|
|
27497
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
27498
|
+
throw new Errors.CLIError(message, { exit: 1 });
|
|
27499
|
+
}
|
|
27500
|
+
}
|
|
27501
|
+
};
|
|
27172
27502
|
// src/oclif/commands/version.ts
|
|
27173
27503
|
/** The facts `--version` prints, as fields. `node` is Node's version without its leading v. */
|
|
27174
27504
|
function versionInfo(config) {
|
|
@@ -28801,7 +29131,13 @@ const OVERRIDDEN_OPERATION_IDS = /* @__PURE__ */ new Set([
|
|
|
28801
29131
|
"inbox:get-inbox-status",
|
|
28802
29132
|
"search:semantic-search",
|
|
28803
29133
|
"credits:redeem-credit-code",
|
|
28804
|
-
"cli:list-cli-orgs"
|
|
29134
|
+
"cli:list-cli-orgs",
|
|
29135
|
+
"activity:create-email-activity",
|
|
29136
|
+
"activity:create-thread-activity",
|
|
29137
|
+
"activity:get-thread-timeline",
|
|
29138
|
+
"activity:list-mail-activity-actors",
|
|
29139
|
+
"activity:list-org-mail-activity",
|
|
29140
|
+
"activity:update-thread-activity"
|
|
28805
29141
|
]);
|
|
28806
29142
|
const generatedCommands = Object.fromEntries(rawCliOperationManifest.filter((operation) => !OVERRIDDEN_OPERATION_IDS.has(operationId(operation))).map((operation) => [operationId(operation), createOperationCommand(canonicalOperation(operation))]));
|
|
28807
29143
|
generatedCommands["emails:get-email"] = createEmailsGetCommand(generatedCommands["emails:get-email"]);
|
|
@@ -28941,6 +29277,8 @@ const rawCommands = {
|
|
|
28941
29277
|
"org:secrets:remove": OrgSecretsRemoveCommand,
|
|
28942
29278
|
connect: ConnectCommand,
|
|
28943
29279
|
disconnect: DisconnectCommand,
|
|
29280
|
+
lock: LockCommand,
|
|
29281
|
+
unlock: UnlockCommand,
|
|
28944
29282
|
api: ApiCommand,
|
|
28945
29283
|
"payloads:push": PayloadsPushCommand,
|
|
28946
29284
|
"payloads:pull": PayloadsPullCommand,
|