primcli 1.53.0 → 1.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1102,7 +1102,10 @@ The envelope also carries `interaction` (the server's `interaction_hint`,
1102
1102
  `interaction_kind` and `fyi`, plus a `category` and whether a plain reply
1103
1103
  completes it; null when the server does not report them) and `next_actions`,
1104
1104
  the commands that answer the email, best first, each with `kind`, `command`,
1105
- `argv`, `description`, `placeholders` and `requires_message`. For anything
1105
+ `argv`, `description`, `placeholders` and `requires_message`, plus `env` when
1106
+ `argv` must run under the connected profile that ran the command (`command`
1107
+ already carries it as a `PRIMITIVE_AGENT_PROFILE=` prefix). A CLI run from npx
1108
+ prints `npx -y primitive@latest` in place of `primitive`. For anything
1106
1109
  other than ordinary mail, one `how to answer:` line directly above the
1107
1110
  untrusted content names the command:
1108
1111
 
@@ -1,5 +1,5 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-CNZpIYwj.js";
2
- import { C as resolveCliAuth, F as agentProfilesDirectory, G as createClient, H as requireDefaultLoginProfile, K as createConfig, N as agentProfileDirectory, R as loadConnectedAgentProfile, S as normalizeApiBaseUrl, T as saveSignupCredentials, W as PrimitiveApiClient, _ as deleteCliCredentials, c as resolveConfigEnvironment, d as validateCliHeaderName, f as validateCliHeaderValue, i as loadCliConfig, m as cliAccessTokenExpiresAt, p as acquireCliCredentialsLock, w as saveCliCredentials, x as loadCliCredentials, y as detectPrimitiveKeyEnvMisname } from "./cli-config-DGrZCUfw.js";
2
+ import { C as resolveCliAuth, F as agentProfilesDirectory, G as createClient, H as requireDefaultLoginProfile, K as createConfig, N as agentProfileDirectory, R as loadConnectedAgentProfile, S as normalizeApiBaseUrl, T as saveSignupCredentials, W as PrimitiveApiClient, _ as deleteCliCredentials, c as resolveConfigEnvironment, d as validateCliHeaderName, f as validateCliHeaderValue, i as loadCliConfig, j as AGENT_PROFILE_ENV, m as cliAccessTokenExpiresAt, p as acquireCliCredentialsLock, w as saveCliCredentials, x as loadCliCredentials, y as detectPrimitiveKeyEnvMisname } from "./cli-config-DGrZCUfw.js";
3
3
  import { h as writeMailJson, m as withMailLock, p as syncMailDirectory, u as privateMailPermissions } from "./shared-mail-files-SPPcis9g.js";
4
4
  import { Command, Errors, Flags } from "@oclif/core";
5
5
  import { existsSync, lstatSync, readFileSync, readdirSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
@@ -3829,6 +3829,90 @@ function currentMailSessionKey(env = process.env) {
3829
3829
  return value && /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(value) ? `${codex ? "codex" : "claude"}:${value.toLowerCase()}` : null;
3830
3830
  }
3831
3831
  //#endregion
3832
+ //#region src/oclif/agent-identity-suggestions.ts
3833
+ /** The connection name enrollment uses when none is given. */
3834
+ const DEFAULT_ENROLL_NAME = "Coding agent";
3835
+ /** npx runs the CLI from its cache; print follow-up commands the same way. */
3836
+ function cliInvocation(entry) {
3837
+ return entry && /[\\/]_npx[\\/]/.test(entry) ? "npx -y primitive@latest" : "primitive";
3838
+ }
3839
+ /**
3840
+ * Whether an enrollment's connection name is the fallback it chose by itself.
3841
+ * Session registration's `<runtime>-<repository>` names are reported by
3842
+ * registration, which knows the exact name it generated.
3843
+ */
3844
+ function generatedAgentName(name) {
3845
+ return name === DEFAULT_ENROLL_NAME;
3846
+ }
3847
+ /**
3848
+ * Whether a connection name read back from a claim is one nobody chose for
3849
+ * this agent: the enrollment fallback, or a name that only repeats the
3850
+ * address's local part (what an invitation gets when the owner typed just
3851
+ * the address). A name the owner wrote out is never reported as default.
3852
+ */
3853
+ function defaultConnectionName(name, address) {
3854
+ const local = address.split("@")[0]?.toLowerCase() ?? "";
3855
+ return generatedAgentName(name) || name.trim().toLowerCase() === local;
3856
+ }
3857
+ /** The line that tells an agent to load its handling rules before acting on mail. */
3858
+ const LOAD_SKILL_LINE = "Load the primitive-connect skill first if it is not loaded.";
3859
+ /**
3860
+ * The fallback for a session whose skill tool does not list the skill: a
3861
+ * runtime reads its skill list when the session starts, so a skill installed
3862
+ * during the session is reachable only as a file. Empty without a path.
3863
+ */
3864
+ function skillFileFallback(skillFile) {
3865
+ return skillFile ? ` If your skill tool does not list primitive-connect, read ${skillFile} in full.` : "";
3866
+ }
3867
+ /** LOAD_SKILL_LINE, naming the installed SKILL.md when it is known. Still one line. */
3868
+ function loadSkillLine(skillFile) {
3869
+ return `${LOAD_SKILL_LINE}${skillFileFallback(skillFile)}`;
3870
+ }
3871
+ /** One short clause saying how this session will receive mail. */
3872
+ function receivingOutcome(receiving) {
3873
+ if (receiving.mode === "poll") return "nothing wakes this session for new mail, so it checks at the start of each turn and after sending";
3874
+ if (receiving.mode === "external") return receiving.state === "hooks_installed" ? "new mail wakes this session through its installed hooks, confirmed by the first real delivery" : "receiving is not set up yet, so new mail will not wake this session";
3875
+ return receiving.state === "healthy" ? "a background listener receives new mail for this session" : "receiving is not ready yet, so new mail may not reach this session";
3876
+ }
3877
+ /**
3878
+ * What an agent does right after a connection completes, in order. Agents
3879
+ * act on command output even when they have not loaded the skill, so the
3880
+ * steps are carried in the result itself.
3881
+ */
3882
+ function connectNextSteps(params) {
3883
+ const rename = params.suggestions.find((s) => s.kind === "rename")?.command;
3884
+ const runtime = params.suggestions.find((s) => s.kind === "runtime_note")?.command;
3885
+ const offers = [rename ? `rename this agent from its generated name${params.name ? ` "${params.name}"` : ""} (\`${rename}\`)` : null, runtime ? `record where it runs (\`${runtime}\`)` : null].filter((offer) => offer !== null);
3886
+ return [
3887
+ `Report to the owner in two short sentences: that this agent is connected as ${params.address}, and that ${receivingOutcome(params.receiving)}. Leave out the organization id, profile name and command output.`,
3888
+ ...offers.length ? [`In the same message, make one offer to ${offers.join(" and to ")}. Run either only after the owner answers.`] : [],
3889
+ `Load the primitive-connect skill before handling any mail.${skillFileFallback(params.skillFile)}`
3890
+ ];
3891
+ }
3892
+ /**
3893
+ * Additive result fields for a connect, enroll or session registration.
3894
+ * `nameIsDefault` appears only when it is known whether the connection name
3895
+ * is one this CLI generated. The runtime note is suggested once, after a
3896
+ * connection this run completed.
3897
+ */
3898
+ function identitySuggestions(params) {
3899
+ const prefix = `PRIMITIVE_AGENT_PROFILE=${params.profile} ${params.invocation}`;
3900
+ const suggestions = [];
3901
+ const nameIsDefault = params.nameIsDefault;
3902
+ if (nameIsDefault) suggestions.push({
3903
+ kind: "rename",
3904
+ command: `${prefix} agent rename "<new name>"`
3905
+ });
3906
+ if (params.connectedNow) suggestions.push({
3907
+ kind: "runtime_note",
3908
+ command: `${prefix} agent runtime set`
3909
+ });
3910
+ return nameIsDefault === void 0 ? { suggestions } : {
3911
+ nameIsDefault,
3912
+ suggestions
3913
+ };
3914
+ }
3915
+ //#endregion
3832
3916
  //#region src/oclif/send-outcome.ts
3833
3917
  const SEND_OUTCOME_EXIT_CODES = {
3834
3918
  replied: 0,
@@ -4025,6 +4109,33 @@ async function checkPriorReplies(params) {
4025
4109
  };
4026
4110
  }
4027
4111
  }
4112
+ const FOLLOW_UP_PROFILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/;
4113
+ /**
4114
+ * How a printed follow-up command reaches this same CLI and identity: through
4115
+ * npx when this process runs from npx's cache (a bare `primitive` may be
4116
+ * missing or an older global install), and under the connected profile this
4117
+ * process was selected with, since another profile cannot see the same mail.
4118
+ */
4119
+ function envPrefix(env) {
4120
+ return Object.entries(env ?? {}).map(([name, value]) => `${name}=${value} `).join("");
4121
+ }
4122
+ /**
4123
+ * The start of a printed CLI command line, for text that builds commands as
4124
+ * strings rather than argv: the profile prefix, then npx's form when this
4125
+ * process runs from npx's cache, else `bin`.
4126
+ */
4127
+ function followUpCommandPrefix(bin = "primitive", invocation = followUpInvocation()) {
4128
+ const program = invocation.program[0] === "npx" ? invocation.program.join(" ") : bin;
4129
+ return `${envPrefix(invocation.env)}${program}`;
4130
+ }
4131
+ function followUpInvocation(entry = process.argv[1], env = process.env) {
4132
+ const program = cliInvocation(entry).split(" ");
4133
+ const profile = env[AGENT_PROFILE_ENV];
4134
+ return profile && FOLLOW_UP_PROFILE.test(profile) ? {
4135
+ program,
4136
+ env: { [AGENT_PROFILE_ENV]: profile }
4137
+ } : { program };
4138
+ }
4028
4139
  function shellQuote(value) {
4029
4140
  if (/^[A-Za-z0-9_./:@%+=,-]+$/.test(value)) return value;
4030
4141
  return `'${value.replaceAll("'", "'\\''")}'`;
@@ -4032,12 +4143,16 @@ function shellQuote(value) {
4032
4143
  function commandFromArgv(argv) {
4033
4144
  return argv.map(shellQuote).join(" ");
4034
4145
  }
4035
- function buildFollowUpCommand(kind, description, argv, options = {}) {
4146
+ function buildFollowUpCommand(kind, description, argv, options = {}, invocation = followUpInvocation()) {
4036
4147
  const requiresMessage = options.requiresMessage ?? false;
4148
+ const cli = argv[0] === "primitive";
4149
+ const resolved = cli ? [...invocation.program, ...argv.slice(1)] : argv;
4150
+ const env = cli ? invocation.env : void 0;
4037
4151
  return {
4038
- argv,
4152
+ argv: resolved,
4039
4153
  description,
4040
- command: commandFromArgv(argv),
4154
+ command: `${envPrefix(env)}${commandFromArgv(resolved)}`,
4155
+ ...env ? { env } : {},
4041
4156
  kind,
4042
4157
  placeholders: requiresMessage ? [{
4043
4158
  description: "Replace with the message body before running.",
@@ -4718,90 +4833,6 @@ function pendingMailProfiles(configDir, session, emailId) {
4718
4833
  }).sort();
4719
4834
  }
4720
4835
  //#endregion
4721
- //#region src/oclif/agent-identity-suggestions.ts
4722
- /** The connection name enrollment uses when none is given. */
4723
- const DEFAULT_ENROLL_NAME = "Coding agent";
4724
- /** npx runs the CLI from its cache; print follow-up commands the same way. */
4725
- function cliInvocation(entry) {
4726
- return entry && /[\\/]_npx[\\/]/.test(entry) ? "npx -y primitive@latest" : "primitive";
4727
- }
4728
- /**
4729
- * Whether an enrollment's connection name is the fallback it chose by itself.
4730
- * Session registration's `<runtime>-<repository>` names are reported by
4731
- * registration, which knows the exact name it generated.
4732
- */
4733
- function generatedAgentName(name) {
4734
- return name === DEFAULT_ENROLL_NAME;
4735
- }
4736
- /**
4737
- * Whether a connection name read back from a claim is one nobody chose for
4738
- * this agent: the enrollment fallback, or a name that only repeats the
4739
- * address's local part (what an invitation gets when the owner typed just
4740
- * the address). A name the owner wrote out is never reported as default.
4741
- */
4742
- function defaultConnectionName(name, address) {
4743
- const local = address.split("@")[0]?.toLowerCase() ?? "";
4744
- return generatedAgentName(name) || name.trim().toLowerCase() === local;
4745
- }
4746
- /** The line that tells an agent to load its handling rules before acting on mail. */
4747
- const LOAD_SKILL_LINE = "Load the primitive-connect skill first if it is not loaded.";
4748
- /**
4749
- * The fallback for a session whose skill tool does not list the skill: a
4750
- * runtime reads its skill list when the session starts, so a skill installed
4751
- * during the session is reachable only as a file. Empty without a path.
4752
- */
4753
- function skillFileFallback(skillFile) {
4754
- return skillFile ? ` If your skill tool does not list primitive-connect, read ${skillFile} in full.` : "";
4755
- }
4756
- /** LOAD_SKILL_LINE, naming the installed SKILL.md when it is known. Still one line. */
4757
- function loadSkillLine(skillFile) {
4758
- return `${LOAD_SKILL_LINE}${skillFileFallback(skillFile)}`;
4759
- }
4760
- /** One short clause saying how this session will receive mail. */
4761
- function receivingOutcome(receiving) {
4762
- if (receiving.mode === "poll") return "nothing wakes this session for new mail, so it checks at the start of each turn and after sending";
4763
- if (receiving.mode === "external") return receiving.state === "hooks_installed" ? "new mail wakes this session through its installed hooks, confirmed by the first real delivery" : "receiving is not set up yet, so new mail will not wake this session";
4764
- return receiving.state === "healthy" ? "a background listener receives new mail for this session" : "receiving is not ready yet, so new mail may not reach this session";
4765
- }
4766
- /**
4767
- * What an agent does right after a connection completes, in order. Agents
4768
- * act on command output even when they have not loaded the skill, so the
4769
- * steps are carried in the result itself.
4770
- */
4771
- function connectNextSteps(params) {
4772
- const rename = params.suggestions.find((s) => s.kind === "rename")?.command;
4773
- const runtime = params.suggestions.find((s) => s.kind === "runtime_note")?.command;
4774
- const offers = [rename ? `rename this agent from its generated name${params.name ? ` "${params.name}"` : ""} (\`${rename}\`)` : null, runtime ? `record where it runs (\`${runtime}\`)` : null].filter((offer) => offer !== null);
4775
- return [
4776
- `Report to the owner in two short sentences: that this agent is connected as ${params.address}, and that ${receivingOutcome(params.receiving)}. Leave out the organization id, profile name and command output.`,
4777
- ...offers.length ? [`In the same message, make one offer to ${offers.join(" and to ")}. Run either only after the owner answers.`] : [],
4778
- `Load the primitive-connect skill before handling any mail.${skillFileFallback(params.skillFile)}`
4779
- ];
4780
- }
4781
- /**
4782
- * Additive result fields for a connect, enroll or session registration.
4783
- * `nameIsDefault` appears only when it is known whether the connection name
4784
- * is one this CLI generated. The runtime note is suggested once, after a
4785
- * connection this run completed.
4786
- */
4787
- function identitySuggestions(params) {
4788
- const prefix = `PRIMITIVE_AGENT_PROFILE=${params.profile} ${params.invocation}`;
4789
- const suggestions = [];
4790
- const nameIsDefault = params.nameIsDefault;
4791
- if (nameIsDefault) suggestions.push({
4792
- kind: "rename",
4793
- command: `${prefix} agent rename "<new name>"`
4794
- });
4795
- if (params.connectedNow) suggestions.push({
4796
- kind: "runtime_note",
4797
- command: `${prefix} agent runtime set`
4798
- });
4799
- return nameIsDefault === void 0 ? { suggestions } : {
4800
- nameIsDefault,
4801
- suggestions
4802
- };
4803
- }
4804
- //#endregion
4805
4836
  //#region src/oclif/wake-context.ts
4806
4837
  /**
4807
4838
  * Mail from a verified owner, member or connected peer agent is mail the
@@ -5094,7 +5125,7 @@ function savedConnectedProfiles(configDir, exclude) {
5094
5125
  */
5095
5126
  async function otherProfiles(configDir, session, current) {
5096
5127
  if (session) try {
5097
- const { connectedProfilesForSession } = await import("./machine-session-BEoAvyJE.js").then((n) => n.s);
5128
+ const { connectedProfilesForSession } = await import("./machine-session-Do3mw2_w.js").then((n) => n.s);
5098
5129
  return {
5099
5130
  inSession: true,
5100
5131
  profiles: connectedProfilesForSession(configDir, session, current)
@@ -5962,4 +5993,4 @@ function canonicalizeCliReferences(description) {
5962
5993
  return description.replaceAll("`primitive emails:latest`", "`primitive emails latest`").replaceAll("`primitive describe emails:get-email | jq '.responseSchema.properties'`", "`primitive describe emails:get | jq '.responseSchema.properties'`");
5963
5994
  }
5964
5995
  //#endregion
5965
- export { readEmailInteraction as $, runWakeSchedule as $n, createFunction as $t, readThreadContext as A, listDefaultNetworkAgents as An, writeIdempotentReplayBannerIfReplay as At, connectNextSteps as B, listWakeAuthorizations as Bn, hasAutomatedVerdict as Bt, queryUsesAwaiting as C, getRepeatingSend as Cn, sendWaitClampNotice as Ct, displayAddress as D, listAgentContacts as Dn, thrownErrorExitCode as Dt, describeWake as E, getWakeSchedule as En, successfulSendOutcome as Et, wakeReadCommand as F, listFunctionLogs as Fn, AutomatedFilterUnsupportedError as Ft, clearConsumedPendingMail as G, putAgentContact as Gn, createCliApiClient as Gt, generatedAgentName as H, listWakeSchedules as Hn, queryUsesAutomated as Ht, wakeRecipientField as I, listFunctions as In, assertAutomatedVerdict as It, readPendingMail as J, redeemCreditCode as Jn, addDefaultNetworkMember as Jt, clearReadPendingMail as K, putAgentContactPolicy as Kn, refreshStoredCliCredentials as Kt, wakeRelationship as L, listRepeatingSends as Ln, automatedRejectedError as Lt, serverMuted as M, listDomains as Mn, AUTOMATED_FILTER_UNSUPPORTED_CODE as Mt, serverRelationship as N, listEmails as Nn, AUTOMATED_FLAG_DESCRIPTION as Nt, formatMailWakeLine as O, listAgentNetworks as On, currentMailSessionKey as Ot, skillFirstLine as P, listEndpoints as Pn, AUTOMATED_VALUES as Pt, interactionNextActions as Q, resendAgentSignupVerification as Qn, createEndpoint as Qt, DEFAULT_ENROLL_NAME as R, listRoutes as Rn, ensureSearchReportsAutomated as Rt, isAwaitingRejectedError as S, getOrgRoutingTopology as Sn, sendOutcomeExitCode as St, bareAddress$1 as T, getThread as Tn, serializeErrorPayload as Tt, identitySuggestions as U, pollCliLogin as Un, SAVED_CLI_OAUTH_SESSION_EXPIRED_MESSAGE as Ut, defaultConnectionName as V, listWakeDispatches as Vn, isAutomatedRejectedError as Vt, loadSkillLine as W, pullWebhookEvent as Wn, createAuthenticatedCliApiClient as Wt, removePendingMail as X, reorderRoutes as Xn, cliLogout as Xt, recordPendingMail as Y, removeDefaultNetworkMember as Yn, checkDefaultNetworkContactAdmission as Yt, interactionHumanLine as Z, replyToEmail as Zn, completeWebhookEvent as Zt, awaitingRejectedError as _, getFunction as _n, updateRoute as _r, formatSendFailureSummary as _t, extractErrorCode as a, deleteMemory as an, setFunctionSecret as ar, SEND_OUTCOME_HELP as at, formatRepliesCell as b, getInboxStatus as bn, verifyAgentClaim as br, reportSendCommandResult as bt, readTextFileFlag as c, deleteWakeSchedule as cn, startAgentClaim as cr, buildFollowUpCommand as ct, writeErrorWithHints as d, getAgentContactPolicy as dn, stopRepeatFromEmail as dr, classifySendError as dt, createRoute as en, searchEmails as er, replyExpectation as et, AWAITING_FLAG_DESCRIPTION as f, getContact as fn, testFunction as fr, deriveSendIdempotencyKey as ft, assertAwaitingFilterRows as g, getEmail as gn, updateRepeatingSend as gr, formatPriorRepliesWarning as gt, ReplyStateUnsupportedError as h, getDefaultNetworkAgent as hn, updateFunction as hr, formatPriorRepliesCheckSkipped as ht, createOperationCommand as i, deleteContact as in, setFunctionRoute as ir, MAX_SEND_WAIT_TIMEOUT_MS as it, sentInThread as j, listDefaultNetworkMembers as jn, withFlagSuggestion as jt, latestOwnOutbound as k, listContacts as kn, formatAlreadySentNotice as kt, runWithTiming as l, downloadEmailAttachmentPart as ln, startAgentSignup as lr, buildThrownSendFailureEnvelope as lt, REPLY_STATE_UNSUPPORTED_CODE as m, getCreditBalance as mn, updateDefaultNetworkMember as mr, formatDeletedEarlierSendNotice as mt, API_ERROR_CODES as n, createWakeSchedule as nn, semanticSearch as nr, wakeInteractionSentence as nt, extractErrorPayload as o, deleteRoute as on, setMemory as or, apiResultHttpStatus as ot, AWAITING_VALUES as p, getConversation as pn, unsetFunctionRoute as pr, excludeSignalReplies as pt, pendingMailPath as q, putContact as qn, resolveCliApiRequestConfig as qt, TIME_FLAG_DESCRIPTION as r, deleteAgentContact as rn, sendEmail as rr, IDEMPOTENCY_KEY_FLAG_DESCRIPTION as rt, formatErrorPayload as s, deleteWakeAuthorization as sn, simulateRoute as sr, assertValidIdempotencyKey as st, API_BASE_URL_FLAG_DESCRIPTION as t, createWakeAuthorization as tn, searchMemories as tr, replyInteractionWarning as tt, surfaceUnauthorizedHint as u, getAccount as un, startCliLogin as ur, checkPriorReplies as ut, ensureSearchReportsReplyState as v, getFunctionRouting as vn, updateWakeAuthorization as vr, formatSendRecordFailureSummary as vt, explainPendingMailNotFound as w, getSentEmail as wn, sentHistoryWindowStart as wt, hasReplyState as x, getMemory as xn, verifyAgentSignup as xr, sendIdentityFields as xt, formatAwaitingCell as y, getFunctionTestRunTrace as yn, updateWakeSchedule as yr, priorRepliesThatWentOut as yt, cliInvocation as z, listSentEmails as zn, expectedAutomatedVerdicts as zt };
5996
+ export { apiResultHttpStatus as $, resendAgentSignupVerification as $n, createEndpoint as $t, readThreadContext as A, listContacts as An, formatAlreadySentNotice as At, pendingMailPath as B, listSentEmails as Bn, expectedAutomatedVerdicts as Bt, queryUsesAwaiting as C, getOrgRoutingTopology as Cn, cliInvocation as Ct, displayAddress as D, getWakeSchedule as Dn, identitySuggestions as Dt, describeWake as E, getThread as En, generatedAgentName as Et, wakeReadCommand as F, listEndpoints as Fn, AUTOMATED_VALUES as Ft, interactionNextActions as G, pullWebhookEvent as Gn, createAuthenticatedCliApiClient as Gt, recordPendingMail as H, listWakeDispatches as Hn, isAutomatedRejectedError as Ht, wakeRecipientField as I, listFunctionLogs as In, AutomatedFilterUnsupportedError as It, replyInteractionWarning as J, putContact as Jn, resolveCliApiRequestConfig as Jt, readEmailInteraction as K, putAgentContact as Kn, createCliApiClient as Kt, wakeRelationship as L, listFunctions as Ln, assertAutomatedVerdict as Lt, serverMuted as M, listDefaultNetworkMembers as Mn, withFlagSuggestion as Mt, serverRelationship as N, listDomains as Nn, AUTOMATED_FILTER_UNSUPPORTED_CODE as Nt, formatMailWakeLine as O, listAgentContacts as On, loadSkillLine as Ot, skillFirstLine as P, listEmails as Pn, AUTOMATED_FLAG_DESCRIPTION as Pt, SEND_OUTCOME_HELP as Q, replyToEmail as Qn, completeWebhookEvent as Qt, clearConsumedPendingMail as R, listRepeatingSends as Rn, automatedRejectedError as Rt, isAwaitingRejectedError as S, getMemory as Sn, verifyAgentSignup as Sr, DEFAULT_ENROLL_NAME as St, bareAddress$1 as T, getSentEmail as Tn, defaultConnectionName as Tt, removePendingMail as U, listWakeSchedules as Un, queryUsesAutomated as Ut, readPendingMail as V, listWakeAuthorizations as Vn, hasAutomatedVerdict as Vt, interactionHumanLine as W, pollCliLogin as Wn, SAVED_CLI_OAUTH_SESSION_EXPIRED_MESSAGE as Wt, IDEMPOTENCY_KEY_FLAG_DESCRIPTION as X, removeDefaultNetworkMember as Xn, checkDefaultNetworkContactAdmission as Xt, wakeInteractionSentence as Y, redeemCreditCode as Yn, addDefaultNetworkMember as Yt, MAX_SEND_WAIT_TIMEOUT_MS as Z, reorderRoutes as Zn, cliLogout as Zt, awaitingRejectedError as _, getEmail as _n, updateRepeatingSend as _r, sendWaitClampNotice as _t, extractErrorCode as a, deleteContact as an, setFunctionRoute as ar, deriveSendIdempotencyKey as at, formatRepliesCell as b, getFunctionTestRunTrace as bn, updateWakeSchedule as br, successfulSendOutcome as bt, readTextFileFlag as c, deleteWakeAuthorization as cn, simulateRoute as cr, formatDeletedEarlierSendNotice as ct, writeErrorWithHints as d, getAccount as dn, startCliLogin as dr, formatSendFailureSummary as dt, createFunction as en, runWakeSchedule as er, assertValidIdempotencyKey as et, AWAITING_FLAG_DESCRIPTION as f, getAgentContactPolicy as fn, stopRepeatFromEmail as fr, formatSendRecordFailureSummary as ft, assertAwaitingFilterRows as g, getDefaultNetworkAgent as gn, updateFunction as gr, sendOutcomeExitCode as gt, ReplyStateUnsupportedError as h, getCreditBalance as hn, updateDefaultNetworkMember as hr, sendIdentityFields as ht, createOperationCommand as i, deleteAgentContact as in, sendEmail as ir, classifySendError as it, sentInThread as j, listDefaultNetworkAgents as jn, writeIdempotentReplayBannerIfReplay as jt, latestOwnOutbound as k, listAgentNetworks as kn, currentMailSessionKey as kt, runWithTiming as l, deleteWakeSchedule as ln, startAgentClaim as lr, formatPriorRepliesCheckSkipped as lt, REPLY_STATE_UNSUPPORTED_CODE as m, getConversation as mn, unsetFunctionRoute as mr, reportSendCommandResult as mt, API_ERROR_CODES as n, createWakeAuthorization as nn, searchMemories as nr, buildThrownSendFailureEnvelope as nt, extractErrorPayload as o, deleteMemory as on, setFunctionSecret as or, excludeSignalReplies as ot, AWAITING_VALUES as p, getContact as pn, testFunction as pr, priorRepliesThatWentOut as pt, replyExpectation as q, putAgentContactPolicy as qn, refreshStoredCliCredentials as qt, TIME_FLAG_DESCRIPTION as r, createWakeSchedule as rn, semanticSearch as rr, checkPriorReplies as rt, formatErrorPayload as s, deleteRoute as sn, setMemory as sr, followUpCommandPrefix as st, API_BASE_URL_FLAG_DESCRIPTION as t, createRoute as tn, searchEmails as tr, buildFollowUpCommand as tt, surfaceUnauthorizedHint as u, downloadEmailAttachmentPart as un, startAgentSignup as ur, formatPriorRepliesWarning as ut, ensureSearchReportsReplyState as v, getFunction as vn, updateRoute as vr, sentHistoryWindowStart as vt, explainPendingMailNotFound as w, getRepeatingSend as wn, connectNextSteps as wt, hasReplyState as x, getInboxStatus as xn, verifyAgentClaim as xr, thrownErrorExitCode as xt, formatAwaitingCell as y, getFunctionRouting as yn, updateWakeAuthorization as yr, serializeErrorPayload as yt, clearReadPendingMail as z, listRoutes as zn, ensureSearchReportsAutomated as zt };
@@ -1,8 +1,8 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-CNZpIYwj.js";
2
2
  import { B as parseOwnerMemberAddress, F as agentProfilesDirectory, I as connectedAgentIdentity, L as connectedApiBaseUrl, M as AgentConnectionSetupError, N as agentProfileDirectory, P as agentProfileName, R as loadConnectedAgentProfile, U as saveConnectedAgentProfile, V as profileAlreadyConnectedMessage, W as PrimitiveApiClient, j as AGENT_PROFILE_ENV, x as loadCliCredentials, z as parseConnectedAgentProfile } from "./cli-config-DGrZCUfw.js";
3
- import { Dn as listAgentContacts, Gn as putAgentContact, Kn as putAgentContactPolicy, Kt as refreshStoredCliCredentials, Mn as listDomains, V as defaultConnectionName, dn as getAgentContactPolicy, er as searchEmails, fn as getContact, gn as getEmail, in as deleteContact, kn as listContacts, qn as putContact, rn as deleteAgentContact, rr as sendEmail, zn as listSentEmails } from "./api-command-B7Je5tw6.js";
3
+ import { An as listContacts, Bn as listSentEmails, Jn as putContact, Kn as putAgentContact, Nn as listDomains, On as listAgentContacts, Tt as defaultConnectionName, _n as getEmail, an as deleteContact, fn as getAgentContactPolicy, in as deleteAgentContact, ir as sendEmail, pn as getContact, qn as putAgentContactPolicy, qt as refreshStoredCliCredentials, tr as searchEmails } from "./api-command-C_Fn9Zef.js";
4
4
  import { _ as acquireListenLock, c as mailTime, d as readMailJson, f as removeMailFile, g as ListenStateError, h as writeMailJson, i as mailId, l as privateMailDirectory, o as mailObject, r as mailAddress, s as mailString } from "./shared-mail-files-SPPcis9g.js";
5
- import { _ as detectAgentRuntime, a as NotificationRetryError, d as defaultSessionSocket, f as NativeSessionDisconnectedError, l as SESSION_UUID, t as notificationScope, u as connectNativeSession, v as installConnectSkill, x as readBundledConnectSkill } from "./notify-session-DGEvXUO_.js";
5
+ import { _ as detectAgentRuntime, a as NotificationRetryError, d as defaultSessionSocket, f as NativeSessionDisconnectedError, l as SESSION_UUID, t as notificationScope, u as connectNativeSession, v as installConnectSkill, x as readBundledConnectSkill } from "./notify-session-DhV0DLAA.js";
6
6
  import { a as scopedChatSenderTrust } from "./scoped-chat-BrLq4dXH.js";
7
7
  import { l as stopBackgroundListen, r as backgroundListenStatus } from "./listen-background-CMfxkeVP.js";
8
8
  import { t as readSharedMailOwner } from "./shared-mail-watch-CWhpfJ0N.js";
@@ -1,4 +1,4 @@
1
- import { F as wakeReadCommand, P as skillFirstLine, ln as downloadEmailAttachmentPart, nt as wakeInteractionSentence } from "./api-command-B7Je5tw6.js";
1
+ import { F as wakeReadCommand, P as skillFirstLine, Y as wakeInteractionSentence, un as downloadEmailAttachmentPart } from "./api-command-C_Fn9Zef.js";
2
2
  import { _ as acquireListenLock, g as ListenStateError, y as listenIdentity } from "./shared-mail-files-SPPcis9g.js";
3
3
  import { _ as isTrustedSender, c as classifySignalContent, g as isEmailReceivedEvent, v as parseWebhookEvent } from "./repeats-D2xtLium-DmtVD6ol.js";
4
4
  import { closeSync, copyFileSync, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, opendirSync, readFileSync, readdirSync, readlinkSync, renameSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
@@ -1,6 +1,6 @@
1
- import { A as readThreadContext, Wt as createAuthenticatedCliApiClient, wn as getSentEmail } from "../api-command-B7Je5tw6.js";
1
+ import { A as readThreadContext, Gt as createAuthenticatedCliApiClient, Tn as getSentEmail } from "../api-command-C_Fn9Zef.js";
2
2
  import { _ as acquireListenLock } from "../shared-mail-files-SPPcis9g.js";
3
- import { t as sendSignal } from "../signal-command-DoSjEhUP.js";
3
+ import { t as sendSignal } from "../signal-command-CqfODMCp.js";
4
4
  import { AUTO_SIGNAL_KIND_ENV, AUTO_WORKING_RENEW_MS, autoSignalsDisabled, clearWorkingSending, markWorkingSending, readAutoClaim, readWorkingLease, recordRenewer, stopWorkingLease, writeWorkingLease } from "./auto-signals.js";
5
5
  import { join } from "node:path";
6
6
  import { homedir } from "node:os";
@@ -1,12 +1,12 @@
1
1
  import { A as saveActiveChatState, C as resolveCliAuth, D as deleteChatState, E as chatStatePath, F as agentProfilesDirectory, H as requireDefaultLoginProfile, M as AgentConnectionSetupError, N as agentProfileDirectory, O as loadActiveChatState, P as agentProfileName, R as loadConnectedAgentProfile, T as saveSignupCredentials, W as PrimitiveApiClient, _ as deleteCliCredentials, a as normalizeCliEnvironmentName, b as hasStoredCliLogin, c as resolveConfigEnvironment, g as credentialsPath, h as credentialsLockPath, i as loadCliConfig, j as AGENT_PROFILE_ENV, k as loadChatConversationByLocalId, l as saveCliConfig, m as cliAccessTokenExpiresAt, n as deleteCliConfig, o as redactCliEnvironment, p as acquireCliCredentialsLock, r as emptyCliConfig, s as removeCliEnvironment, u as upsertCliEnvironment, v as deleteCliCredentialsLock, w as saveCliCredentials, x as loadCliCredentials, y as detectPrimitiveKeyEnvMisname } from "../cli-config-DGrZCUfw.js";
2
- import { $ as readEmailInteraction, $n as runWakeSchedule, $t as createFunction, A as readThreadContext, An as listDefaultNetworkAgents, At as writeIdempotentReplayBannerIfReplay, B as connectNextSteps, Bn as listWakeAuthorizations, Bt as hasAutomatedVerdict, C as queryUsesAwaiting, Cn as getRepeatingSend, Ct as sendWaitClampNotice, D as displayAddress, Dn as listAgentContacts, Dt as thrownErrorExitCode, E as describeWake, En as getWakeSchedule, Et as successfulSendOutcome, F as wakeReadCommand, Fn as listFunctionLogs, Ft as AutomatedFilterUnsupportedError, G as clearConsumedPendingMail, Gt as createCliApiClient, H as generatedAgentName, Hn as listWakeSchedules, Ht as queryUsesAutomated, I as wakeRecipientField, In as listFunctions, It as assertAutomatedVerdict, J as readPendingMail, Jn as redeemCreditCode, Jt as addDefaultNetworkMember, K as clearReadPendingMail, Kt as refreshStoredCliCredentials, L as wakeRelationship, Ln as listRepeatingSends, Lt as automatedRejectedError, M as serverMuted, Mn as listDomains, Mt as AUTOMATED_FILTER_UNSUPPORTED_CODE, N as serverRelationship, Nn as listEmails, Nt as AUTOMATED_FLAG_DESCRIPTION, O as formatMailWakeLine, On as listAgentNetworks, Ot as currentMailSessionKey, Pn as listEndpoints, Pt as AUTOMATED_VALUES, Q as interactionNextActions, Qn as resendAgentSignupVerification, Qt as createEndpoint, Rn as listRoutes, Rt as ensureSearchReportsAutomated, S as isAwaitingRejectedError, Sn as getOrgRoutingTopology, St as sendOutcomeExitCode, T as bareAddress, Tn as getThread, Tt as serializeErrorPayload, U as identitySuggestions, Un as pollCliLogin, Vn as listWakeDispatches, Vt as isAutomatedRejectedError, W as loadSkillLine, Wn as pullWebhookEvent, Wt as createAuthenticatedCliApiClient, X as removePendingMail, Xn as reorderRoutes, Xt as cliLogout, Y as recordPendingMail, Yn as removeDefaultNetworkMember, Yt as checkDefaultNetworkContactAdmission, Z as interactionHumanLine, Zn as replyToEmail, Zt as completeWebhookEvent, _ as awaitingRejectedError, _n as getFunction, _r as updateRoute, _t as formatSendFailureSummary, a as extractErrorCode, an as deleteMemory, ar as setFunctionSecret, at as SEND_OUTCOME_HELP, b as formatRepliesCell, bn as getInboxStatus, br as verifyAgentClaim, bt as reportSendCommandResult, c as readTextFileFlag, cn as deleteWakeSchedule, cr as startAgentClaim, ct as buildFollowUpCommand, d as writeErrorWithHints, dn as getAgentContactPolicy, dr as stopRepeatFromEmail, dt as classifySendError, en as createRoute, er as searchEmails, et as replyExpectation, f as AWAITING_FLAG_DESCRIPTION, fr as testFunction, ft as deriveSendIdempotencyKey, g as assertAwaitingFilterRows, gn as getEmail, gr as updateRepeatingSend, gt as formatPriorRepliesWarning, h as ReplyStateUnsupportedError, hn as getDefaultNetworkAgent, hr as updateFunction, ht as formatPriorRepliesCheckSkipped, i as createOperationCommand, ir as setFunctionRoute, it as MAX_SEND_WAIT_TIMEOUT_MS, j as sentInThread, jn as listDefaultNetworkMembers, jt as withFlagSuggestion, k as latestOwnOutbound, kt as formatAlreadySentNotice, l as runWithTiming, lr as startAgentSignup, lt as buildThrownSendFailureEnvelope, m as REPLY_STATE_UNSUPPORTED_CODE, mn as getCreditBalance, mr as updateDefaultNetworkMember, mt as formatDeletedEarlierSendNotice, n as API_ERROR_CODES, nn as createWakeSchedule, nr as semanticSearch, o as extractErrorPayload, on as deleteRoute, or as setMemory, ot as apiResultHttpStatus, p as AWAITING_VALUES, pn as getConversation, pr as unsetFunctionRoute, pt as excludeSignalReplies, q as pendingMailPath, qt as resolveCliApiRequestConfig, r as TIME_FLAG_DESCRIPTION, rr as sendEmail, rt as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, s as formatErrorPayload, sn as deleteWakeAuthorization, sr as simulateRoute, st as assertValidIdempotencyKey, t as API_BASE_URL_FLAG_DESCRIPTION, tn as createWakeAuthorization, tr as searchMemories, tt as replyInteractionWarning, u as surfaceUnauthorizedHint, un as getAccount, ur as startCliLogin, ut as checkPriorReplies, v as ensureSearchReportsReplyState, vn as getFunctionRouting, vr as updateWakeAuthorization, vt as formatSendRecordFailureSummary, w as explainPendingMailNotFound, wn as getSentEmail, wt as sentHistoryWindowStart, x as hasReplyState, xn as getMemory, xr as verifyAgentSignup, xt as sendIdentityFields, y as formatAwaitingCell, yn as getFunctionTestRunTrace, yr as updateWakeSchedule, yt as priorRepliesThatWentOut, z as cliInvocation, zn as listSentEmails, zt as expectedAutomatedVerdicts } from "../api-command-B7Je5tw6.js";
2
+ import { $ as apiResultHttpStatus, $n as resendAgentSignupVerification, $t as createEndpoint, A as readThreadContext, At as formatAlreadySentNotice, B as pendingMailPath, Bn as listSentEmails, Bt as expectedAutomatedVerdicts, C as queryUsesAwaiting, Cn as getOrgRoutingTopology, Ct as cliInvocation, D as displayAddress, Dn as getWakeSchedule, Dt as identitySuggestions, E as describeWake, En as getThread, Et as generatedAgentName, F as wakeReadCommand, Fn as listEndpoints, Ft as AUTOMATED_VALUES, G as interactionNextActions, Gn as pullWebhookEvent, Gt as createAuthenticatedCliApiClient, H as recordPendingMail, Hn as listWakeDispatches, Ht as isAutomatedRejectedError, I as wakeRecipientField, In as listFunctionLogs, It as AutomatedFilterUnsupportedError, J as replyInteractionWarning, Jt as resolveCliApiRequestConfig, K as readEmailInteraction, Kt as createCliApiClient, L as wakeRelationship, Ln as listFunctions, Lt as assertAutomatedVerdict, M as serverMuted, Mn as listDefaultNetworkMembers, Mt as withFlagSuggestion, N as serverRelationship, Nn as listDomains, Nt as AUTOMATED_FILTER_UNSUPPORTED_CODE, O as formatMailWakeLine, On as listAgentContacts, Ot as loadSkillLine, Pn as listEmails, Pt as AUTOMATED_FLAG_DESCRIPTION, Q as SEND_OUTCOME_HELP, Qn as replyToEmail, Qt as completeWebhookEvent, R as clearConsumedPendingMail, Rn as listRepeatingSends, Rt as automatedRejectedError, S as isAwaitingRejectedError, Sn as getMemory, Sr as verifyAgentSignup, T as bareAddress, Tn as getSentEmail, U as removePendingMail, Un as listWakeSchedules, Ut as queryUsesAutomated, V as readPendingMail, Vn as listWakeAuthorizations, Vt as hasAutomatedVerdict, W as interactionHumanLine, Wn as pollCliLogin, X as IDEMPOTENCY_KEY_FLAG_DESCRIPTION, Xn as removeDefaultNetworkMember, Xt as checkDefaultNetworkContactAdmission, Yn as redeemCreditCode, Yt as addDefaultNetworkMember, Z as MAX_SEND_WAIT_TIMEOUT_MS, Zn as reorderRoutes, Zt as cliLogout, _ as awaitingRejectedError, _n as getEmail, _r as updateRepeatingSend, _t as sendWaitClampNotice, a as extractErrorCode, ar as setFunctionRoute, at as deriveSendIdempotencyKey, b as formatRepliesCell, bn as getFunctionTestRunTrace, br as updateWakeSchedule, bt as successfulSendOutcome, c as readTextFileFlag, cn as deleteWakeAuthorization, cr as simulateRoute, ct as formatDeletedEarlierSendNotice, d as writeErrorWithHints, dn as getAccount, dr as startCliLogin, dt as formatSendFailureSummary, en as createFunction, er as runWakeSchedule, et as assertValidIdempotencyKey, f as AWAITING_FLAG_DESCRIPTION, fn as getAgentContactPolicy, fr as stopRepeatFromEmail, ft as formatSendRecordFailureSummary, g as assertAwaitingFilterRows, gn as getDefaultNetworkAgent, gr as updateFunction, gt as sendOutcomeExitCode, h as ReplyStateUnsupportedError, hn as getCreditBalance, hr as updateDefaultNetworkMember, ht as sendIdentityFields, i as createOperationCommand, ir as sendEmail, it as classifySendError, j as sentInThread, jn as listDefaultNetworkAgents, jt as writeIdempotentReplayBannerIfReplay, k as latestOwnOutbound, kn as listAgentNetworks, kt as currentMailSessionKey, l as runWithTiming, ln as deleteWakeSchedule, lr as startAgentClaim, lt as formatPriorRepliesCheckSkipped, m as REPLY_STATE_UNSUPPORTED_CODE, mn as getConversation, mr as unsetFunctionRoute, mt as reportSendCommandResult, n as API_ERROR_CODES, nn as createWakeAuthorization, nr as searchMemories, nt as buildThrownSendFailureEnvelope, o as extractErrorPayload, on as deleteMemory, or as setFunctionSecret, ot as excludeSignalReplies, p as AWAITING_VALUES, pr as testFunction, pt as priorRepliesThatWentOut, q as replyExpectation, qt as refreshStoredCliCredentials, r as TIME_FLAG_DESCRIPTION, rn as createWakeSchedule, rr as semanticSearch, rt as checkPriorReplies, s as formatErrorPayload, sn as deleteRoute, sr as setMemory, st as followUpCommandPrefix, t as API_BASE_URL_FLAG_DESCRIPTION, tn as createRoute, tr as searchEmails, tt as buildFollowUpCommand, u as surfaceUnauthorizedHint, ur as startAgentSignup, ut as formatPriorRepliesWarning, v as ensureSearchReportsReplyState, vn as getFunction, vr as updateRoute, vt as sentHistoryWindowStart, w as explainPendingMailNotFound, wn as getRepeatingSend, wt as connectNextSteps, x as hasReplyState, xn as getInboxStatus, xr as verifyAgentClaim, xt as thrownErrorExitCode, y as formatAwaitingCell, yn as getFunctionRouting, yr as updateWakeAuthorization, yt as serializeErrorPayload, z as clearReadPendingMail, zn as listRoutes, zt as ensureSearchReportsAutomated } from "../api-command-C_Fn9Zef.js";
3
3
  import { S as resolveListenSubscription, _ as acquireListenLock, a as mailLockBusy, c as mailTime, d as readMailJson, f as removeMailFile, g as ListenStateError, h as writeMailJson, i as mailId, l as privateMailDirectory, m as withMailLock, o as mailObject, u as privateMailPermissions, x as normalizeListenOrigin, y as listenIdentity } from "../shared-mail-files-SPPcis9g.js";
4
- import { _ as detectAgentRuntime, a as NotificationRetryError, b as installedVersion, c as readConversationStatusContent, d as defaultSessionSocket, f as NativeSessionDisconnectedError, g as connectSkillTarget, h as NotificationOutcomeUnknownError, i as notificationReceiptPage, l as SESSION_UUID$1, m as NativeSessionNotLoadedError, n as notificationSenders, o as isRoutineNotificationContent, p as NativeSessionError, r as openSessionNotifications, s as notificationPartReader, t as notificationScope, v as installConnectSkill, x as readBundledConnectSkill, y as installedConnectSkillFile } from "../notify-session-DGEvXUO_.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-BEoAvyJE.js";
4
+ import { _ as detectAgentRuntime, a as NotificationRetryError, b as installedVersion, c as readConversationStatusContent, d as defaultSessionSocket, f as NativeSessionDisconnectedError, g as connectSkillTarget, h as NotificationOutcomeUnknownError, i as notificationReceiptPage, l as SESSION_UUID$1, m as NativeSessionNotLoadedError, n as notificationSenders, o as isRoutineNotificationContent, p as NativeSessionError, r as openSessionNotifications, s as notificationPartReader, t as notificationScope, v as installConnectSkill, x as readBundledConnectSkill, y as installedConnectSkillFile } from "../notify-session-DhV0DLAA.js";
5
+ import { $ as describeSessionHookItem, A as evaluateContactPolicy, B as agentInvitationHash, C as RECEIVER_MODES, D as NETWORK_ADMISSION_PENDING_RETRY_MS, E as ContactPolicyReadRetryError, F as ContactsApiError, G as saveConnectionName, H as readAgentInvitation, I as contactAddress, J as recordHookMailCheck, K as savedReceiver, L as contactAgentAddress, M as AddressNotesApiError, N as addressNoteTarget, O as NetworkAdmissionPendingError, P as runAddressNotesRequest, Q as describeSessionHookChange, R as runContactRequest, S as runAgentConnect, T as verificationReplySubmitted, U as receiverStatusCommand, V as connectAgent, W as refusalAfterReplacement, X as claudeConfigDir, Y as boundSessionProfiles, Z as currentCliLocation, _ as disconnectAgent, _t as withOwnerMemberAddress, a as endSession, at as readClaudeSettings, b as invitationProfileName, c as pendingSessionDisconnects, ct as writeClaudeSettings, d as registerSession, dt as jsonIndentation, et as ensureHookLauncher, f as retryPendingDisconnects, ft as readManagedFile, g as AgentDisconnectError, gt as refreshOwnerMemberAddressPeriodically, h as enrollmentResumes, ht as readHookLauncherWarning, i as connectedProfilesForSession, it as inspectClaudeHooks, j as canonicalContactSelector, k as createNotificationContactPolicy, l as psProcessInfo, lt as MachineFileError, m as enrollAgent, mt as writeManagedFile, n as OMP_MAIN, nt as findOnPath, o as headlessClaudeRun, ot as repairClaudeHooks, p as runDetached, pt as upsertManagedBlock, q as installClaudeWakeHook, r as agentConnectionState, rt as hasMachineSessionHooks, st as samePath, t as MACHINE_RUNTIMES, tt as ephemeralCliReason, u as readClaudeHookInput, ut as inspectManagedBlock, v as connectWarnings, w as externalReceivingState, x as pollCheckCommand, y as defaultAgentProfileName, z as agentConnectionStatus } from "../machine-session-Do3mw2_w.js";
6
6
  import { a as scopedChatSenderTrust, i as readBeforeDeadline, n as isPlainChatReply, o as presenceDisposition, r as isScopedChatReply, s as readPresenceProjection, t as isConnectedChatCredential } from "../scoped-chat-BrLq4dXH.js";
7
7
  import { c as startBackgroundListen, i as backgroundListenToken, l as stopBackgroundListen, o as runBackgroundListen, r as backgroundListenStatus, u as verifyBackgroundListenTarget } from "../listen-background-CMfxkeVP.js";
8
8
  import { a as REPEAT_IDLE_MAX_MINUTES, d as parseRepeatTick, f as preparePresenceAliveEmail, g as isEmailReceivedEvent, i as REPEAT_EVERY_MAX_MINUTES, l as parseInteractionEnvelope$1, m as repeatStopCommand, o as REPEAT_MAX_SENDS_MAX, p as prepareSignalEmail, s as buildRepeatStopBody, u as parsePresenceEnvelope, v as parseWebhookEvent, y as parseFromHeader } from "../repeats-D2xtLium-DmtVD6ol.js";
9
- import { a as ensureSharedMailSubscription, c as reserveSharedMailSubscription, d as otherParticipants, f as EventConnection, h as pushFile, i as sharedMailScope, l as followEmailConversation, m as pullFile, n as reconcileChatSend, o as createSharedMailWaiter, p as EventReceiverError, r as openSharedMailReceiver, s as openSharedMailStore, t as sendSignal, u as readConversationFollow } from "../signal-command-DoSjEhUP.js";
9
+ import { a as ensureSharedMailSubscription, c as reserveSharedMailSubscription, d as otherParticipants, f as EventConnection, h as pushFile, i as sharedMailScope, l as followEmailConversation, m as pullFile, n as reconcileChatSend, o as createSharedMailWaiter, p as EventReceiverError, r as openSharedMailReceiver, s as openSharedMailStore, t as sendSignal, u as readConversationFollow } from "../signal-command-CqfODMCp.js";
10
10
  import { autoSignalEligible, dispatchAutoRead, dispatchAutoWorking, haltAutoWorking, isSentSignal, restoreAutoWorking } from "./auto-signals.js";
11
11
  import { t as guardJsonOutputCommands } from "../json-output-Cf-GFeff.js";
12
12
  import { Args, Command, Errors, Flags, ux } from "@oclif/core";
@@ -35542,6 +35542,39 @@ async function replaceSessionAddresses(params) {
35542
35542
  }
35543
35543
  return replaced;
35544
35544
  }
35545
+ /**
35546
+ * Picks the profile a status read inspects: an explicit --profile, then the
35547
+ * one address connected for an explicit --session, then
35548
+ * PRIMITIVE_AGENT_PROFILE, then the one address connected for the runtime's
35549
+ * own session ID. Null when none
35550
+ * applies or the session has several addresses; `session` is null when no
35551
+ * session was available to look in.
35552
+ */
35553
+ function statusProfile(params) {
35554
+ const env = params.env ?? process.env;
35555
+ const chosen = params.profile ?? (params.session ? void 0 : env["PRIMITIVE_AGENT_PROFILE"]?.trim() || void 0);
35556
+ if (chosen) return { profile: chosen };
35557
+ const session = guardedSession(params.session, env);
35558
+ if (!session) return {
35559
+ profile: null,
35560
+ session: null,
35561
+ bound: []
35562
+ };
35563
+ const { others } = inspectSessionAddresses({
35564
+ configDir: params.configDir,
35565
+ session
35566
+ });
35567
+ const only = others.length === 1 ? others[0] : void 0;
35568
+ return only ? { profile: only.profile } : {
35569
+ profile: null,
35570
+ session,
35571
+ bound: others.map((row) => row.profile)
35572
+ };
35573
+ }
35574
+ /** Why a status read found no single profile, and what to do next. */
35575
+ function statusProfileMissingDetail(bound) {
35576
+ return bound.length > 1 ? `This session has several connected profiles (${bound.join(", ")}). Pass --profile <name>.` : `No Primitive address is connected for this session, so connecting one will not replace anything. Pass --profile <name> or set ${AGENT_PROFILE_ENV} to inspect another saved profile.`;
35577
+ }
35545
35578
  //#endregion
35546
35579
  //#region src/oclif/commands/agent-connect.ts
35547
35580
  /** npx runs the CLI from its cache; resume through npx too so the command works without a global install. */
@@ -35549,7 +35582,7 @@ function invocation$1(entry) {
35549
35582
  return entry && /[\\/]_npx[\\/]/.test(entry) ? "npx -y primitive@latest" : "primitive";
35550
35583
  }
35551
35584
  var AgentConnectCommand = class AgentConnectCommand extends Command {
35552
- static description = `Connect this coding session to Primitive in one call. With --session, the command checks this CLI's capabilities, installs or refreshes the matching primitive-connect skill for the detected runtime (Claude Code or Codex) from files bundled in this CLI, claims the owner's private setup invitation from piped stdin, answers one authenticated setup challenge, enables owner notifications, starts receiving, seeds a private AGENT_INFO note from --name and --info when absent, and prints one JSON result. The receiver defaults to external hooks in Claude Code and the native background listener elsewhere. When the native default cannot work because this machine has no local session socket (for example Codex older than 0.158.0), the command connects with poll receiving instead and reports receiving.fallbackReason and receiving.fallbackDetail. Without a session (no --session, or an empty one) the receiver is poll: for runtimes with no local session ID or hooks, such as a cloud-hosted conversation whose commands run in a separate sandbox, the invitation is claimed and verified the same way, nothing is installed, and the result's receiving.checkCommand is the command the agent runs to check for new mail at the start of each turn and after it sends. Native receiving starts or reuses a supervised background listener and waits briefly for its first successful mail check; external receiving installs the exact Claude session's fail-open Stop hook and resume SessionStart hook after the verification reply; a real idle mail event must still verify wake. The profile defaults to session-<session>, or to connection-<invitation hash prefix> without a session. --resume continues saved progress without reading stdin or replaying a claim or uncertain verification send. After the reply is submitted it waits up to a minute for the server to confirm the connection and reports verification.state verified, or reply_submitted while confirmation is still pending. Verification is separate from receiver health. Both official production (https://api.primitive.dev/v1) and staging (https://api.primitive-staging-1.com/v1) invitations pin their API origin. Never pass an invitation as a command argument. One address per session: if this session already has a connected Primitive address, including one saved in the profile being connected, the command claims nothing, leaves stdin unread, and exits 3 with status already_connected. Its detail names how to continue that profile's own connection when that is the only one: --resume for a setup with saved progress, or --keep-existing to refresh a claim-only profile from the same invitation. Otherwise ask the user whether to keep the existing address or disconnect it first, then rerun with --keep-existing or --replace-existing. Never choose for the user. Select the saved identity with PRIMITIVE_AGENT_PROFILE. Use --status --json with --profile, or with PRIMITIVE_AGENT_PROFILE set, to inspect saved identity and local receiver health offline; it exits 1 when the profile is not configured. A completed connection's result carries nextSteps, in order: report to the owner in two short sentences, make one offer to rename a generated name and record where the agent runs, and load the primitive-connect skill before handling mail. When the claim reported one, the result also carries the connection's name and nameIsDefault.`;
35585
+ static description = `Connect this coding session to Primitive in one call. With --session, the command checks this CLI's capabilities, installs or refreshes the matching primitive-connect skill for the detected runtime (Claude Code or Codex) from files bundled in this CLI, claims the owner's private setup invitation from piped stdin, answers one authenticated setup challenge, enables owner notifications, starts receiving, seeds a private AGENT_INFO note from --name and --info when absent, and prints one JSON result. The receiver defaults to external hooks in Claude Code and the native background listener elsewhere. When the native default cannot work because this machine has no local session socket (for example Codex older than 0.158.0), the command connects with poll receiving instead and reports receiving.fallbackReason and receiving.fallbackDetail. Without a session (no --session, or an empty one) the receiver is poll: for runtimes with no local session ID or hooks, such as a cloud-hosted conversation whose commands run in a separate sandbox, the invitation is claimed and verified the same way, nothing is installed, and the result's receiving.checkCommand is the command the agent runs to check for new mail at the start of each turn and after it sends. Native receiving starts or reuses a supervised background listener and waits briefly for its first successful mail check; external receiving installs the exact Claude session's fail-open Stop hook and resume SessionStart hook after the verification reply; a real idle mail event must still verify wake. The profile defaults to session-<session>, or to connection-<invitation hash prefix> without a session. --resume continues saved progress without reading stdin or replaying a claim or uncertain verification send. After the reply is submitted it waits up to a minute for the server to confirm the connection and reports verification.state verified, or reply_submitted while confirmation is still pending. Verification is separate from receiver health. Both official production (https://api.primitive.dev/v1) and staging (https://api.primitive-staging-1.com/v1) invitations pin their API origin. Never pass an invitation as a command argument. One address per session: if this session already has a connected Primitive address, including one saved in the profile being connected, the command claims nothing, leaves stdin unread, and exits 3 with status already_connected. Its detail names how to continue that profile's own connection when that is the only one: --resume for a setup with saved progress, or --keep-existing to refresh a claim-only profile from the same invitation. Otherwise ask the user whether to keep the existing address or disconnect it first, then rerun with --keep-existing or --replace-existing. Never choose for the user. Select the saved identity with PRIMITIVE_AGENT_PROFILE. Use --status --json with --profile, with PRIMITIVE_AGENT_PROFILE set, or with --session (the address connected for that session) to inspect saved identity and local receiver health offline; it exits 1 when nothing is configured. A status check before connecting is optional: connect itself claims nothing and exits 3 when the session already has an address. A completed connection's result carries nextSteps, in order: report to the owner in two short sentences, make one offer to rename a generated name and record where the agent runs, and load the primitive-connect skill before handling mail. When the claim reported one, the result also carries the connection's name and nameIsDefault.`;
35553
35586
  static summary = "Connect and verify an agent address";
35554
35587
  static examples = [
35555
35588
  "<%= config.bin %> agent connect --session \"$CODEX_THREAD_ID\" --name Research --info \"Reviews pull requests\" --json < private-invitation.txt",
@@ -35564,10 +35597,7 @@ var AgentConnectCommand = class AgentConnectCommand extends Command {
35564
35597
  ];
35565
35598
  static flags = {
35566
35599
  profile: Flags.string({ description: "Local agent profile name; defaults to session-<session> with --session, or connection-<invitation hash prefix> for poll receiving. Existing OAuth login is preserved" }),
35567
- session: Flags.string({
35568
- description: "Exact current session UUID; verify email and configure receiving after claiming. Omit it (or pass it empty) when the runtime exposes none, which selects poll receiving",
35569
- exclusive: ["status"]
35570
- }),
35600
+ session: Flags.string({ description: "Exact current session UUID; verify email and configure receiving after claiming. Omit it (or pass it empty) when the runtime exposes none, which selects poll receiving. With --status, reads the address connected for that session" }),
35571
35601
  receiver: Flags.string({
35572
35602
  description: "Native starts a supported session receiver; external installs the exact Claude session's fail-open Stop hook and resume SessionStart hook; poll installs nothing and the agent checks for mail itself with `agent check-mail`. Defaults to external in Claude Code, native elsewhere, and poll without a session",
35573
35603
  options: [...RECEIVER_MODES],
@@ -35615,8 +35645,27 @@ var AgentConnectCommand = class AgentConnectCommand extends Command {
35615
35645
  let replaced = [];
35616
35646
  try {
35617
35647
  if (flags.status) {
35618
- const profileName = flags.profile ?? (process.env["PRIMITIVE_AGENT_PROFILE"]?.trim() || void 0);
35619
- if (!profileName) throw new AgentConnectionSetupError(`Pass --profile <name> or set ${AGENT_PROFILE_ENV}.`);
35648
+ const statusSession = flags.session?.trim();
35649
+ if (statusSession !== void 0 && !SESSION_UUID$1.test(statusSession)) throw new AgentConnectionSetupError(statusSession === "" ? "--status with an empty --session has no session to look in. Pass --profile <name> for a sessionless connection." : "--session requires the exact loaded session UUID.");
35650
+ const picked = statusProfile({
35651
+ configDir: this.config.configDir,
35652
+ profile: flags.profile,
35653
+ session: statusSession
35654
+ });
35655
+ if (picked.profile === null && picked.session === null) throw new AgentConnectionSetupError(`Pass --profile <name>, --session <id> or set ${AGENT_PROFILE_ENV}.`);
35656
+ if (picked.profile === null) {
35657
+ const detail = statusProfileMissingDetail(picked.bound);
35658
+ this.log(flags.json ? JSON.stringify({
35659
+ status: "not_configured",
35660
+ profileName: null,
35661
+ session: picked.session,
35662
+ ...picked.bound.length > 1 ? { profiles: picked.bound } : {},
35663
+ detail
35664
+ }) : detail);
35665
+ process.exitCode = 1;
35666
+ return;
35667
+ }
35668
+ const profileName = picked.profile;
35620
35669
  const result = agentConnectionStatus(this.config.configDir, profileName);
35621
35670
  if (result.status !== "configured") {
35622
35671
  const detail = `Agent profile ${profileName} is not configured. Run \`primitive agent connect\` with the owner's invitation to connect it.`;
@@ -36756,30 +36805,6 @@ var AgentSessionRegisterCommand = class AgentSessionRegisterCommand extends Comm
36756
36805
  };
36757
36806
  //#endregion
36758
36807
  //#region src/oclif/commands/agent-status.ts
36759
- /**
36760
- * Picks the profile `agent status` reads: an explicit --profile, then
36761
- * PRIMITIVE_AGENT_PROFILE, then the one address connected for this runtime
36762
- * session. Null when none applies or the session has several addresses.
36763
- */
36764
- function statusProfile(params) {
36765
- const env = params.env ?? process.env;
36766
- const chosen = params.profile ?? (env["PRIMITIVE_AGENT_PROFILE"]?.trim() || void 0);
36767
- if (chosen) return { profile: chosen };
36768
- const session = guardedSession(void 0, env);
36769
- if (!session) return {
36770
- profile: null,
36771
- bound: []
36772
- };
36773
- const { others } = inspectSessionAddresses({
36774
- configDir: params.configDir,
36775
- session
36776
- });
36777
- const only = others.length === 1 ? others[0] : void 0;
36778
- return only ? { profile: only.profile } : {
36779
- profile: null,
36780
- bound: others.map((row) => row.profile)
36781
- };
36782
- }
36783
36808
  /** A hidden alias of `agent connect --status`, for the command agents guess. */
36784
36809
  var AgentStatusCommand = class AgentStatusCommand extends Command {
36785
36810
  static hidden = true;
@@ -36796,7 +36821,7 @@ var AgentStatusCommand = class AgentStatusCommand extends Command {
36796
36821
  profile: flags.profile
36797
36822
  });
36798
36823
  if (picked.profile === null) {
36799
- const detail = picked.bound.length > 1 ? `This session has several connected profiles (${picked.bound.join(", ")}). Pass --profile <name>.` : `No Primitive address is connected for this session. Pass --profile <name> or set ${AGENT_PROFILE_ENV} to inspect a saved profile.`;
36824
+ const detail = statusProfileMissingDetail(picked.bound);
36800
36825
  this.log(flags.json ? JSON.stringify({
36801
36826
  status: "not_configured",
36802
36827
  profileName: null,
@@ -43592,7 +43617,7 @@ const PRIMITIVE_TEAM_AUTHOR = {
43592
43617
  url: "https://primitive.dev"
43593
43618
  };
43594
43619
  const SDK_VERSION_RANGE = "^1.35.0";
43595
- const CLI_VERSION_RANGE = "^1.53.0";
43620
+ const CLI_VERSION_RANGE = "^1.54.0";
43596
43621
  const ESBUILD_VERSION_RANGE = "^0.27.0";
43597
43622
  function renderHandler() {
43598
43623
  return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
@@ -45392,8 +45417,9 @@ function formatTrust(email) {
45392
45417
  const known = email.from_known_address === null ? "unknown" : email.from_known_address ? "yes" : "no";
45393
45418
  return `${email.auth ? `SPF ${email.auth.spf ?? "unknown"}, DMARC ${email.auth.dmarc ?? "unknown"}` : "not reported"}; known sender: ${known}`;
45394
45419
  }
45420
+ /** The reply command line, reaching this same CLI and connected profile. */
45395
45421
  function replyCommand(bin, id) {
45396
- return `${bin} reply --id ${id}`;
45422
+ return `${followUpCommandPrefix(bin)} reply --id ${id}`;
45397
45423
  }
45398
45424
  const DEFAULT_API = {
45399
45425
  getConversation,
@@ -1,6 +1,6 @@
1
1
  import { N as agentProfileDirectory, P as agentProfileName, R as loadConnectedAgentProfile, j as AGENT_PROFILE_ENV } from "../cli-config-DGrZCUfw.js";
2
2
  import { d as readMailJson } from "../shared-mail-files-SPPcis9g.js";
3
- import { _ as detectAgentRuntime, l as SESSION_UUID, t as notificationScope } from "../notify-session-DGEvXUO_.js";
3
+ import { _ as detectAgentRuntime, l as SESSION_UUID, t as notificationScope } from "../notify-session-DhV0DLAA.js";
4
4
  import { a as claimBackgroundListenRestart, n as backgroundListenRestartable, r as backgroundListenStatus } from "../listen-background-CMfxkeVP.js";
5
5
  import { join } from "node:path";
6
6
  import { spawn } from "node:child_process";
@@ -1,4 +1,4 @@
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-B7Je5tw6.js";
1
+ import { $t as createEndpoint, Bn as listSentEmails, T as bareAddress, _n as getEmail, bt as successfulSendOutcome, ir as sendEmail, it as classifySendError, o as extractErrorPayload } from "./api-command-C_Fn9Zef.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
3
  import { a as scopedChatSenderTrust, i as readBeforeDeadline, n as isPlainChatReply } from "./scoped-chat-BrLq4dXH.js";
4
4
  import { h as sendPreparedSignal, p as prepareSignalEmail } from "./repeats-D2xtLium-DmtVD6ol.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primcli",
3
- "version": "1.53.0",
3
+ "version": "1.54.0",
4
4
  "description": "Official Primitive CLI: deploy Primitive Functions, send and inspect mail, manage endpoints, all from the terminal. Wraps the @primitivedotdev/sdk runtime client with one-shot commands.",
5
5
  "type": "module",
6
6
  "sideEffects": false,