primcli 1.56.0 → 1.57.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.
@@ -435,7 +435,7 @@ async function haltAutoWorking(configDir, match, reason, options = {}) {
435
435
  }
436
436
  const stopped = [];
437
437
  for (const lease of candidates.values()) {
438
- const byPeer = peers.has(lease.sender) && match.profileName !== void 0 && match.profileName === lease.profile;
438
+ const byPeer = peers.has(lease.sender) && match.profileName !== void 0 && match.profileName === lease.profile && (match.threadId === void 0 || match.threadId !== null && lease.thread_id === match.threadId);
439
439
  if (!ids.has(lease.email_id) && !byPeer) continue;
440
440
  try {
441
441
  const stop = stopWorkingLease(configDir, lease.email_id, reason);
@@ -42215,9 +42215,21 @@ async function clearPendingAfterRead(configDir, emailId) {
42215
42215
  await clearReadPendingMail(configDir, profileName, runtime ? runtime.slice(runtime.indexOf(":") + 1) : null, emailId);
42216
42216
  } catch {}
42217
42217
  }
42218
- const NO_SIGNAL_DESCRIPTION = "With --brief, do not report working to the sender. By default, reading mail from the verified owner or a same-organization member (not another agent) that a receiver surfaced to this session reports working in the background until you answer (also disabled by PRIMITIVE_NO_AUTO_SIGNALS=1).";
42218
+ const NO_SIGNAL_DESCRIPTION = "With --brief, do not report working to the sender, and stop a working report an earlier read of this email started; nothing is sent. By default, reading mail from the verified owner or a same-organization member (not another agent) that a receiver surfaced to this session reports working in the background until you answer (also disabled by PRIMITIVE_NO_AUTO_SIGNALS=1).";
42219
+ /**
42220
+ * The line a brief ends with once it has started reporting working: the
42221
+ * agent only knows whether it will act after reading, so the way out has to
42222
+ * come after the content.
42223
+ */
42224
+ function workingStopCommand(emailId, prefix) {
42225
+ return `${prefix} emails get --id ${emailId} --brief --no-signal`;
42226
+ }
42227
+ function workingStopLine(command) {
42228
+ return `The sender now sees you working on this until you answer. If you will not act on it, stop that with ${command} (it sends nothing).`;
42229
+ }
42219
42230
  async function runBrief(command, flags) {
42220
42231
  await runWithTiming(flags.time === true, async () => {
42232
+ if (flags["no-signal"]) await haltAutoWorking(command.config.configDir, { emailIds: [flags.id] }, "not_acting");
42221
42233
  const { apiClient, auth, baseUrlOverridden } = await createAuthenticatedCliApiClient({
42222
42234
  configDir: command.config.configDir,
42223
42235
  apiKey: flags["api-key"],
@@ -42253,12 +42265,15 @@ async function runBrief(command, flags) {
42253
42265
  isOwnSignal: (sentId) => isSentSignal(command.config.configDir, sentId),
42254
42266
  signal: AbortSignal.timeout(3e4)
42255
42267
  });
42256
- command.log(flags.json ? JSON.stringify(brief, null, 2) : renderEmailBrief(brief));
42257
- await clearPendingAfterRead(command.config.configDir, detail.id);
42258
- if (!flags["no-signal"] && detail.sender_connected_agent_verified !== true) dispatchAutoWorking({
42268
+ const stop = !flags["no-signal"] && detail.sender_connected_agent_verified !== true && dispatchAutoWorking({
42259
42269
  configDir: command.config.configDir,
42260
42270
  emailId: detail.id
42261
- });
42271
+ }) ? workingStopCommand(detail.id, followUpCommandPrefix()) : null;
42272
+ command.log(flags.json ? JSON.stringify(stop ? {
42273
+ ...brief,
42274
+ working_signal: { stop_command: stop }
42275
+ } : brief, null, 2) : `${renderEmailBrief(brief)}${stop ? `\n${workingStopLine(stop)}` : ""}`);
42276
+ await clearPendingAfterRead(command.config.configDir, detail.id);
42262
42277
  });
42263
42278
  }
42264
42279
  /**
@@ -43954,7 +43969,7 @@ const PRIMITIVE_TEAM_AUTHOR = {
43954
43969
  url: "https://primitive.dev"
43955
43970
  };
43956
43971
  const SDK_VERSION_RANGE = "^1.35.0";
43957
- const CLI_VERSION_RANGE = "^1.56.0";
43972
+ const CLI_VERSION_RANGE = "^1.57.0";
43958
43973
  const ESBUILD_VERSION_RANGE = "^0.27.0";
43959
43974
  function renderHandler() {
43960
43975
  return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
@@ -55207,7 +55222,8 @@ var ReplyCommand = class ReplyCommand extends Command {
55207
55222
  const halted = await haltAutoWorking(this.config.configDir, {
55208
55223
  emailIds: [emailId],
55209
55224
  peers: priorRepliesCheck.status === "checked" && priorRepliesCheck.detail?.from_email ? [priorRepliesCheck.detail.from_email] : [],
55210
- profileName: auth.connectedAgent?.profileName
55225
+ profileName: auth.connectedAgent?.profileName,
55226
+ threadId: priorRepliesCheck.status === "checked" ? priorRepliesCheck.detail?.thread_id ?? null : null
55211
55227
  }, flags.fyi ? "fyi" : "reply");
55212
55228
  const attemptStartedAtIso = (/* @__PURE__ */ new Date()).toISOString();
55213
55229
  this.attemptStartedAtIso = attemptStartedAtIso;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primcli",
3
- "version": "1.56.0",
3
+ "version": "1.57.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,