primcli 1.50.0 → 1.52.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.
- package/README.md +16 -3
- package/bin/claude-pending-mail.mjs +95 -1
- package/bin/claude-wake.mjs +3 -1
- package/dist/{api-command-Ci6eyQ8d.js → api-command-DWTysV8D.js} +87 -13
- package/dist/{machine-session-CY0j2r7S.js → machine-session-D4UbgQCW.js} +3 -3
- package/dist/{connect-skill-xtf3Q5IF.js → notify-session-CPdFxyt7.js} +283 -243
- package/dist/oclif/auto-signal-worker.js +2 -2
- package/dist/oclif/auto-signals.js +1 -1
- package/dist/oclif/index.js +124 -23
- package/dist/oclif/receiver-heal.js +1 -1
- package/dist/{signal-command-D9R7d44k.js → signal-command-CaKUsE4H.js} +2 -2
- package/dist/skills/primitive-connect/SKILL.md +85 -511
- package/dist/skills/primitive-connect/references/collaboration.md +91 -0
- package/dist/skills/primitive-connect/references/communication.md +3 -2
- package/dist/skills/primitive-connect/references/contact-requests.md +4 -3
- package/dist/skills/primitive-connect/references/contacts.md +130 -0
- package/dist/skills/primitive-connect/references/conversations.md +172 -0
- package/dist/skills/primitive-connect/references/manual-setup.md +10 -9
- package/dist/skills/primitive-connect/references/native-session.md +3 -3
- package/dist/skills/primitive-connect/references/presence-and-receiving.md +124 -0
- package/dist/skills/primitive-connect/references/private-api-fallback.md +2 -2
- package/dist/skills/primitive-connect.json +12 -8
- package/package.json +1 -1
- /package/dist/{scoped-chat-DSLrmgWQ.js → scoped-chat-BJVYBRim.js} +0 -0
package/dist/oclif/index.js
CHANGED
|
@@ -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
|
|
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";
|
|
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 {
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
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";
|
|
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
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-
|
|
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";
|
|
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";
|
|
@@ -35353,7 +35353,7 @@ async function checkAgentMail(options) {
|
|
|
35353
35353
|
more = page === maxPages - 1;
|
|
35354
35354
|
}
|
|
35355
35355
|
const output = {
|
|
35356
|
-
...emails.length > 0 ? { guidance:
|
|
35356
|
+
...emails.length > 0 ? { guidance: loadSkillLine(installedConnectSkillFile({ runtime: mailCheckRuntime() })) } : {},
|
|
35357
35357
|
outcome: emails.length > 0 ? "mail" : "empty",
|
|
35358
35358
|
emails,
|
|
35359
35359
|
more,
|
|
@@ -35373,6 +35373,11 @@ async function checkAgentMail(options) {
|
|
|
35373
35373
|
release();
|
|
35374
35374
|
}
|
|
35375
35375
|
}
|
|
35376
|
+
/** The runtime this mail check runs in, from the runtime's own session variable. */
|
|
35377
|
+
function mailCheckRuntime() {
|
|
35378
|
+
const key = currentMailSessionKey();
|
|
35379
|
+
return key?.startsWith("claude:") ? "claude" : key?.startsWith("codex:") ? "codex" : null;
|
|
35380
|
+
}
|
|
35376
35381
|
//#endregion
|
|
35377
35382
|
//#region src/oclif/commands/agent-check-mail.ts
|
|
35378
35383
|
/** npx runs the CLI from its cache; print follow-up commands the same way. */
|
|
@@ -35709,7 +35714,11 @@ var AgentConnectCommand = class AgentConnectCommand extends Command {
|
|
|
35709
35714
|
address: output.address,
|
|
35710
35715
|
receiving: output.receiving,
|
|
35711
35716
|
..."name" in output ? { name: output.name } : {},
|
|
35712
|
-
suggestions: identity.suggestions
|
|
35717
|
+
suggestions: identity.suggestions,
|
|
35718
|
+
skillFile: installedConnectSkillFile({
|
|
35719
|
+
runtime: output.skill.runtime,
|
|
35720
|
+
installedPath: output.skill.path
|
|
35721
|
+
})
|
|
35713
35722
|
}) : [];
|
|
35714
35723
|
const suggested = {
|
|
35715
35724
|
...output,
|
|
@@ -36093,7 +36102,8 @@ var AgentEnrollCommand = class AgentEnrollCommand extends Command {
|
|
|
36093
36102
|
mode: "mode" in output.receiving ? String(output.receiving.mode) : flags.receiver === "external" ? "external" : "native"
|
|
36094
36103
|
},
|
|
36095
36104
|
name: result.name,
|
|
36096
|
-
suggestions: identity.suggestions
|
|
36105
|
+
suggestions: identity.suggestions,
|
|
36106
|
+
skillFile: installedConnectSkillFile({ runtime: detectAgentRuntime(flags.session) })
|
|
36097
36107
|
}) : [];
|
|
36098
36108
|
const guided = nextSteps.length ? {
|
|
36099
36109
|
...output,
|
|
@@ -37488,6 +37498,25 @@ function parseReceipt(raw) {
|
|
|
37488
37498
|
if (!value || value.version !== 1 || typeof value.request_hash !== "string" || typeof value.sent_at !== "string" || !Number.isFinite(Date.parse(value.sent_at)) || typeof value.completed !== "boolean" || value.reply !== void 0 && (!value.reply || typeof value.reply !== "object" || typeof value.reply.emailId !== "string" || !value.reply.emailId || typeof value.reply.requestId !== "string" || !/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(value.reply.requestId)) || value.idempotency_key !== void 0 && (typeof value.idempotency_key !== "string" || !/^[!-~]{1,255}$/.test(value.idempotency_key)) || value.send_attempted !== void 0 && typeof value.send_attempted !== "boolean" || value.sent !== null && (!value.sent || typeof value.sent.id !== "string" || !value.sent.id || typeof value.sent.status !== "string")) throw new Error("Invalid chat receipt");
|
|
37489
37499
|
return value;
|
|
37490
37500
|
}
|
|
37501
|
+
/**
|
|
37502
|
+
* True when a receipt exists for `scope` and is not completed. An unreadable
|
|
37503
|
+
* receipt counts as unfinished: beginChatReceipt then reports it instead of
|
|
37504
|
+
* a retry quietly starting a second send beside it.
|
|
37505
|
+
*/
|
|
37506
|
+
function hasUnfinishedChatReceipt(configDir, scope) {
|
|
37507
|
+
const path = join(configDir, "chat-receipts", `${chatRequestHash(scope)}.json`);
|
|
37508
|
+
let raw;
|
|
37509
|
+
try {
|
|
37510
|
+
raw = readFileSync(path, "utf8");
|
|
37511
|
+
} catch (error) {
|
|
37512
|
+
return error.code !== "ENOENT";
|
|
37513
|
+
}
|
|
37514
|
+
try {
|
|
37515
|
+
return !parseReceipt(raw).completed;
|
|
37516
|
+
} catch {
|
|
37517
|
+
return true;
|
|
37518
|
+
}
|
|
37519
|
+
}
|
|
37491
37520
|
/** Caller holds the request/parent lock until completion. Unknown POSTs never retry. */
|
|
37492
37521
|
function beginChatReceipt(configDir, scope, requestHash, options = {}) {
|
|
37493
37522
|
const directory = join(configDir, "chat-receipts");
|
|
@@ -37947,6 +37976,9 @@ async function openConnectedReplyWait(options) {
|
|
|
37947
37976
|
async observed(emailId) {
|
|
37948
37977
|
if (options.contactRequest && await store.observeNotifiedContactReply(emailId, requestId, waiter.token)) return;
|
|
37949
37978
|
await store.markWaitObserved(emailId, requestId);
|
|
37979
|
+
try {
|
|
37980
|
+
await clearConsumedPendingMail(options.configDir, options.sessionKey, emailId);
|
|
37981
|
+
} catch {}
|
|
37950
37982
|
},
|
|
37951
37983
|
finish: () => store.finishWait(requestId),
|
|
37952
37984
|
close() {
|
|
@@ -38557,6 +38589,62 @@ function deriveSubject(body) {
|
|
|
38557
38589
|
}
|
|
38558
38590
|
return "Message";
|
|
38559
38591
|
}
|
|
38592
|
+
const CHAT_SUBJECT_MAX_LENGTH = 60;
|
|
38593
|
+
const TITLES$1 = new Set([
|
|
38594
|
+
"dr",
|
|
38595
|
+
"mr",
|
|
38596
|
+
"mrs",
|
|
38597
|
+
"ms",
|
|
38598
|
+
"prof",
|
|
38599
|
+
"sr",
|
|
38600
|
+
"jr",
|
|
38601
|
+
"st",
|
|
38602
|
+
"vs",
|
|
38603
|
+
"e.g",
|
|
38604
|
+
"i.e",
|
|
38605
|
+
"approx",
|
|
38606
|
+
"fig"
|
|
38607
|
+
]);
|
|
38608
|
+
const ABBREVIATIONS = new Set([
|
|
38609
|
+
"etc",
|
|
38610
|
+
"inc",
|
|
38611
|
+
"ltd",
|
|
38612
|
+
"co",
|
|
38613
|
+
"no"
|
|
38614
|
+
]);
|
|
38615
|
+
/**
|
|
38616
|
+
* The line up to its first sentence end: `.`, `?` or `!` followed by
|
|
38617
|
+
* whitespace or the line end. A period after a title-like abbreviation or
|
|
38618
|
+
* a single letter (an initial) does not end the sentence, nor does one
|
|
38619
|
+
* after another abbreviation when the text continues in lowercase or a
|
|
38620
|
+
* digit.
|
|
38621
|
+
*/
|
|
38622
|
+
function firstSentence(line) {
|
|
38623
|
+
const end = /[.?!](?=\s|$)/g;
|
|
38624
|
+
for (let match = end.exec(line); match; match = end.exec(line)) {
|
|
38625
|
+
if (match[0] === ".") {
|
|
38626
|
+
const bare = (/(\S+)$/.exec(line.slice(0, match.index))?.[1] ?? "").replace(/^[("'[]+/, "").toLowerCase();
|
|
38627
|
+
if (TITLES$1.has(bare) || /^[a-z]$/.test(bare)) continue;
|
|
38628
|
+
const next = /^\s+(\S)/.exec(line.slice(match.index + 1))?.[1] ?? "";
|
|
38629
|
+
if (ABBREVIATIONS.has(bare) && /[a-z0-9]/.test(next)) continue;
|
|
38630
|
+
}
|
|
38631
|
+
return line.slice(0, match.index + 1);
|
|
38632
|
+
}
|
|
38633
|
+
return line;
|
|
38634
|
+
}
|
|
38635
|
+
/**
|
|
38636
|
+
* A short subject for a chat message, whose body is usually one long line
|
|
38637
|
+
* or a short paragraph: the first sentence of the first non-empty line,
|
|
38638
|
+
* cut at a word boundary to at most CHAT_SUBJECT_MAX_LENGTH characters.
|
|
38639
|
+
* The body is sent unchanged; replies thread on headers, not the subject.
|
|
38640
|
+
*/
|
|
38641
|
+
function deriveChatSubject(body) {
|
|
38642
|
+
const sentence = firstSentence(deriveSubject(body));
|
|
38643
|
+
if (sentence.length <= CHAT_SUBJECT_MAX_LENGTH) return sentence;
|
|
38644
|
+
const room = sentence.slice(0, CHAT_SUBJECT_MAX_LENGTH - 3);
|
|
38645
|
+
const space = room.lastIndexOf(" ");
|
|
38646
|
+
return `${(space >= CHAT_SUBJECT_MAX_LENGTH / 2 ? room.slice(0, space) : room).replace(/[\s,;:.!?-]+$/, "")}...`;
|
|
38647
|
+
}
|
|
38560
38648
|
function isVerifiedDomain(domain) {
|
|
38561
38649
|
return domain.is_active === true;
|
|
38562
38650
|
}
|
|
@@ -39667,18 +39755,23 @@ var ChatCommand = class ChatCommand extends Command {
|
|
|
39667
39755
|
subject = derivedReplySubject(replyContext.parentReply);
|
|
39668
39756
|
} else {
|
|
39669
39757
|
from = selectedFrom ?? await pickDefaultFromAddress(apiClient, authFailureContext);
|
|
39670
|
-
subject = flags.subject ??
|
|
39758
|
+
subject = flags.subject ?? deriveChatSubject(message);
|
|
39671
39759
|
}
|
|
39672
|
-
const
|
|
39760
|
+
const hashFor = (value) => chatRequestHash({
|
|
39673
39761
|
api: auth.apiBaseUrl,
|
|
39674
39762
|
account: auth.credentials?.org_id ?? chatCredentialIdentity(auth.apiKey, auth.apiBaseUrl),
|
|
39675
39763
|
from,
|
|
39676
39764
|
recipient: args.recipient,
|
|
39677
|
-
subject,
|
|
39765
|
+
subject: value,
|
|
39678
39766
|
message,
|
|
39679
39767
|
parent: parentReply?.id ?? flags["in-reply-to"],
|
|
39680
39768
|
attachments
|
|
39681
39769
|
});
|
|
39770
|
+
if (!parentReply && flags.subject === void 0) {
|
|
39771
|
+
const previous = deriveSubject(message);
|
|
39772
|
+
if (previous !== subject && hasUnfinishedChatReceipt(this.config.configDir, hashFor(previous))) subject = previous;
|
|
39773
|
+
}
|
|
39774
|
+
const requestHash = hashFor(subject);
|
|
39682
39775
|
const scope = parentReply ? chatRequestHash({
|
|
39683
39776
|
api: auth.apiBaseUrl,
|
|
39684
39777
|
from,
|
|
@@ -39807,7 +39900,12 @@ var ChatCommand = class ChatCommand extends Command {
|
|
|
39807
39900
|
const resumed = receipt.data.sent !== null;
|
|
39808
39901
|
this.chatProgress.sendStartedAtIso = sentAtIso;
|
|
39809
39902
|
if (parentReply !== void 0) {
|
|
39810
|
-
const priorReplies = Array.isArray(parentReply.replies) ?
|
|
39903
|
+
const priorReplies = Array.isArray(parentReply.replies) ? await excludeSignalReplies({
|
|
39904
|
+
client: apiClient.client,
|
|
39905
|
+
replies: priorRepliesThatWentOut(parentReply.replies, { excludeSentId: receipt.data.sent?.id }),
|
|
39906
|
+
threadId: parentReply.thread_id,
|
|
39907
|
+
isLocalSignal: (sentId) => isSentSignal(this.config.configDir, sentId)
|
|
39908
|
+
}) : null;
|
|
39811
39909
|
this.chatProgress.priorReplies = priorReplies;
|
|
39812
39910
|
if (!resumed) {
|
|
39813
39911
|
const warning = priorReplies === null ? `Could not check whether you already replied to email ${parentReply.id} (the API returned no reply history). Prior-reply check skipped; sending the reply anyway.` : formatPriorRepliesWarning(priorReplies);
|
|
@@ -43494,7 +43592,7 @@ const PRIMITIVE_TEAM_AUTHOR = {
|
|
|
43494
43592
|
url: "https://primitive.dev"
|
|
43495
43593
|
};
|
|
43496
43594
|
const SDK_VERSION_RANGE = "^1.35.0";
|
|
43497
|
-
const CLI_VERSION_RANGE = "^1.
|
|
43595
|
+
const CLI_VERSION_RANGE = "^1.52.0";
|
|
43498
43596
|
const ESBUILD_VERSION_RANGE = "^0.27.0";
|
|
43499
43597
|
function renderHandler() {
|
|
43500
43598
|
return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
|
|
@@ -47823,7 +47921,9 @@ async function createWakeMail(options) {
|
|
|
47823
47921
|
thread_id: notice.context.threadId,
|
|
47824
47922
|
in_thread: notice.context.inThread,
|
|
47825
47923
|
newer: notice.context.newer ?? null,
|
|
47826
|
-
...notice.context.interaction ? { interaction: notice.context.interaction } : {}
|
|
47924
|
+
...notice.context.interaction ? { interaction: notice.context.interaction } : {},
|
|
47925
|
+
relationship: notice.context.relationship,
|
|
47926
|
+
attachments: notice.context.attachments
|
|
47827
47927
|
} : {
|
|
47828
47928
|
kind: "status",
|
|
47829
47929
|
email_id: detail.id,
|
|
@@ -47931,10 +48031,10 @@ async function createWakeMail(options) {
|
|
|
47931
48031
|
}
|
|
47932
48032
|
return outcome(true);
|
|
47933
48033
|
}
|
|
47934
|
-
if (
|
|
48034
|
+
if (requested && detail.reply_to_sent_email_id) {
|
|
47935
48035
|
if (["bound", "completed"].includes(requested.status) && requested.sentEmailId === detail.reply_to_sent_email_id && requested.peer === sender && (requested.sessionKey === null || requested.sessionKey === options.sessionKey) && Date.parse(detail.received_at) >= Date.parse(requested.createdAt)) {
|
|
47936
48036
|
if (requested.contactRequest ? isContactAcceptance(await readContactInteraction(detail, readPart, signal, Date.parse(detail.received_at)), requested.contactRequest) : isPlainChatReply(detail)) {
|
|
47937
|
-
admission = await policy.admitResponse(sender, detail.received_at, signal, detail.id);
|
|
48037
|
+
if (!admission || admission.kind === "request") admission = await policy.admitResponse(sender, detail.received_at, signal, detail.id);
|
|
47938
48038
|
if (admission) {
|
|
47939
48039
|
const disposition = await store.wakeDisposition(detail.id, detail.reply_to_sent_email_id);
|
|
47940
48040
|
if (disposition === "observed") return outcome(true);
|
|
@@ -48568,13 +48668,14 @@ var ListenCommand = class ListenCommand extends Command {
|
|
|
48568
48668
|
process.stderr.write(`Primitive status arrived: ${status.emailId}${recipient} ${status.kind} ${status.peer} ${status.sentEmailId}. This is activity on an exact conversation this session started, not a new task.\n`);
|
|
48569
48669
|
process.exitCode = 2;
|
|
48570
48670
|
} else if (wake?.wakeId()) {
|
|
48571
|
-
|
|
48572
|
-
|
|
48573
|
-
|
|
48574
|
-
|
|
48575
|
-
|
|
48576
|
-
|
|
48577
|
-
|
|
48671
|
+
process.stderr.write(formatMailWakeLine({
|
|
48672
|
+
emailId: wake.wakeId() ?? "",
|
|
48673
|
+
recipient,
|
|
48674
|
+
relation: wake.senderRelation?.(),
|
|
48675
|
+
context: wake.context?.(),
|
|
48676
|
+
profileName: hookProfileName,
|
|
48677
|
+
skillFile: installedConnectSkillFile({ runtime: "claude" })
|
|
48678
|
+
}));
|
|
48578
48679
|
process.exitCode = 2;
|
|
48579
48680
|
const auto = wake.autoSignal?.();
|
|
48580
48681
|
if (auto) dispatchAutoRead({
|
|
@@ -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 {
|
|
3
|
+
import { _ as detectAgentRuntime, l as SESSION_UUID, t as notificationScope } from "../notify-session-CPdFxyt7.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";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Et as successfulSendOutcome, Qt as createEndpoint, T as bareAddress, dt as classifySendError, gn as getEmail, o as extractErrorPayload, rr as sendEmail, zn as listSentEmails } from "./api-command-DWTysV8D.js";
|
|
2
2
|
import { _ as acquireListenLock, b as listenProcessIdentity, c as mailTime, d as readMailJson, f as removeMailFile, h as writeMailJson, i as mailId, l as privateMailDirectory, m as withMailLock, n as invalidSharedMail, o as mailObject, p as syncMailDirectory, r as mailAddress, s as mailString, t as SharedMailStateError, v as compareListenProcessIdentity, y as listenIdentity } from "./shared-mail-files-SPPcis9g.js";
|
|
3
|
-
import { a as scopedChatSenderTrust, i as readBeforeDeadline, n as isPlainChatReply } from "./scoped-chat-
|
|
3
|
+
import { a as scopedChatSenderTrust, i as readBeforeDeadline, n as isPlainChatReply } from "./scoped-chat-BJVYBRim.js";
|
|
4
4
|
import { h as sendPreparedSignal, p as prepareSignalEmail } from "./repeats-D2xtLium-B8Wq41vG.js";
|
|
5
5
|
import { n as tryOwnSharedMail, r as waitForSharedMailChange, t as readSharedMailOwner } from "./shared-mail-watch-CWhpfJ0N.js";
|
|
6
6
|
import { recordSentSignal } from "./oclif/auto-signals.js";
|