@primitivedotdev/cli 3.0.0-preview.16 → 3.0.0-preview.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { N as agentProfileDirectory, P as agentProfileName, R as loadConnectedAgentProfile, j as AGENT_PROFILE_ENV } from "../cli-config-Ms_0vNjq.js";
2
2
  import { a as backgroundListenStatus, i as backgroundListenRestartable, s as claimBackgroundListenRestart, t as BACKGROUND_LISTEN_RELAUNCH_ENV } from "../listen-background-DyBYca28.js";
3
- import { d as SESSION_UUID, t as notificationScope } from "../notify-session-7oM8bkRx.js";
4
- import { zt as detectAgentRuntime } from "../api-command-D1LX7Tjj.js";
3
+ import { d as SESSION_UUID, t as notificationScope } from "../notify-session-Pt4oRh0I.js";
4
+ import { Bt as detectAgentRuntime } from "../api-command-CgBNtNyD.js";
5
5
  import { d as readMailJson } from "../shared-mail-files-BAQSGxxz.js";
6
6
  import { join } from "node:path";
7
7
  import { spawn } from "node:child_process";
@@ -48,6 +48,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
48
48
  agentWorkProposeDeadline: () => agentWorkProposeDeadline,
49
49
  agentWorkReportStatus: () => agentWorkReportStatus,
50
50
  agentWorkWithdrawDeadline: () => agentWorkWithdrawDeadline,
51
+ amendEmailRuleObjection: () => amendEmailRuleObjection,
51
52
  awaitReply: () => awaitReply,
52
53
  cancelSentEmail: () => cancelSentEmail,
53
54
  cancelSentEmailByIdempotencyKey: () => cancelSentEmailByIdempotencyKey,
@@ -3616,7 +3617,7 @@ const getWebhookDeliveryStats = (options) => (options?.client ?? client).get({
3616
3617
  /**
3617
3618
  * List what you created, or what you were asked
3618
3619
  *
3619
- * The objects the caller created, newest first, each with where it stands now, including ones since disabled, deleted or revoked where the object keeps a row: Functions, endpoints, Function triggers, pull subscriptions, recipient routes, filters, wake schedules, repeating sends and scheduled sends. An API key, an app or an agent sees what it created itself; a webhook given to an API key lists under that key. A person (a dashboard session, or their own Primitive CLI or app login) sees what they created through any credential of theirs, each item naming it, and also their API keys, personal agents, email rules, rule requests and objections to rules over their mail (objections only on the dashboard or the Primitive CLI). Each kind is listed only if the caller could list it through that kind's own route; a kind it could not is named in withheld, with no count. Ids, names and states only: never a webhook URL or mail content. Needs activity:read_self. With relation=asked it lists instead what other members asked of the person, open or answered: the rule requests made to them, and the objections to rules they wrote, under their current membership, each naming the member who asked or objected in created_through. A key, an app or an agent has none, and gets both kinds in withheld. With relation=concerning it lists instead what other members did that concerns the person's own mail: each time a rule started covering one of their mailboxes, saved a new version, or changed who receives its matches while covering it, named as the rule was then, naming its author in created_through, under their current membership; only on the dashboard or the Primitive CLI. A key, an app or an agent has none, and gets email_rule_coverage in withheld. A notice never reads as ended. Notices are written by a periodic job and can lag: until the notices record a rule starting to cover you, the first page lists that rule as pending (pending_complete says whether that check finished), and as_of says about when the notices last looked. For what covers you now, read GET /email-rules/covering-me.
3620
+ * The objects the caller created, newest first, each with where it stands now, including ones since disabled, deleted or revoked where the object keeps a row: Functions, endpoints, Function triggers, pull subscriptions, recipient routes, filters, wake schedules, repeating sends and scheduled sends. An API key, an app or an agent sees what it created itself; a webhook given to an API key lists under that key. A person (a dashboard session, or their own Primitive CLI or app login) sees what they created through any credential of theirs, each item naming it, and also their API keys, personal agents, email rules, rule requests and objections to rules over their mail (objections only on the dashboard or the Primitive CLI). Each kind is listed only if the caller could list it through that kind's own route; a kind it could not is named in withheld, with no count. Ids, names and states only: never a webhook URL or mail content. Needs activity:read_self. With relation=asked it lists instead what other members asked of the person, open or answered: the rule requests made to them, and the objections to rules they wrote, under their current membership, each naming the member who asked or objected in created_through. A key, an app or an agent has none, and gets both kinds in withheld. With relation=concerning it lists instead what other members did that concerns the person's own mail: each time a rule started covering one of their mailboxes, saved a new version while covering it, or stopped covering it, named as the rule was then, naming its author in created_through, under their current membership; only on the dashboard or the Primitive CLI. A key, an app or an agent has none, and gets email_rule_coverage in withheld. A notice never reads as ended. Notices are written by a periodic job and can lag: until the notices record a rule starting to cover you, the first page lists that rule as pending (pending_complete says whether that check finished), and as_of says about when the notices last looked. For what covers you now, read GET /email-rules/covering-me.
3620
3621
  */
3621
3622
  const listActivityObjects = (options) => (options?.client ?? client).get({
3622
3623
  security: [{
@@ -4085,7 +4086,7 @@ const listEmailRuleVersionsCoveringMe = (options) => (options.client ?? client).
4085
4086
  /**
4086
4087
  * List objections
4087
4088
  *
4088
- * Objections you made and objections to rules you wrote (by default), only one of the two, or every objection you can see, newest first. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, or declines it (optionally with a reason the objector sees), or the member who made it withdraws it, which clears its message. It never changes after that. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.
4089
+ * Objections you made and objections to rules you wrote (by default), only one of the two, or every objection you can see, newest first. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, declines it (optionally with a reason the objector sees), or answers it amended once they have saved a newer version of the rule, or the member who made it withdraws it, which clears its message (not from an email to the author already sent or being sent). It never changes after that. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.
4089
4090
  */
4090
4091
  const listEmailRuleObjections = (options) => (options?.client ?? client).get({
4091
4092
  security: [{
@@ -4098,7 +4099,7 @@ const listEmailRuleObjections = (options) => (options?.client ?? client).get({
4098
4099
  /**
4099
4100
  * Object to a rule over your mail
4100
4101
  *
4101
- * Objects to a rule that covers one of your own mailboxes now: say in the message what you ask its author, to turn it off, narrow it, or explain who receives what it matches. The author answers by accepting, which turns it off, or by declining, optionally with a reason you see; the rule keeps running unless they accept. Only a rule that covers you now: one you see only because it once decided on your mail cannot be objected to. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, or declines it (optionally with a reason the objector sees), or the member who made it withdraws it, which clears its message. It never changes after that. You may have one pending objection per rule and 50 in all, and object to the same rule again only 10 minutes after you last did, whatever became of it. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.
4102
+ * Objects to a rule that covers one of your own mailboxes now: say in the message what you ask its author, to turn it off, narrow it, or explain who receives what it matches. The author answers by accepting, which turns it off, or by declining, optionally with a reason you see; the rule keeps running unless they accept. Only a rule that covers you now: one you see only because it once decided on your mail cannot be objected to. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, declines it (optionally with a reason the objector sees), or answers it amended once they have saved a newer version of the rule, or the member who made it withdraws it, which clears its message (not from an email to the author already sent or being sent). It never changes after that. You may have one pending objection per rule and 50 in all, and object to the same rule again only 10 minutes after you last did, whatever became of it. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.
4102
4103
  */
4103
4104
  const createEmailRuleObjection = (options) => (options.client ?? client).post({
4104
4105
  security: [{
@@ -4115,7 +4116,7 @@ const createEmailRuleObjection = (options) => (options.client ?? client).post({
4115
4116
  /**
4116
4117
  * Get an objection
4117
4118
  *
4118
- * One objection you can see. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, or declines it (optionally with a reason the objector sees), or the member who made it withdraws it, which clears its message. It never changes after that. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.
4119
+ * One objection you can see. An objection is seen by the member who made it, the rule's author and the organization's owners and admins. It stays pending until the rule's author accepts it, turning the rule off, declines it (optionally with a reason the objector sees), or answers it amended once they have saved a newer version of the rule, or the member who made it withdraws it, which clears its message (not from an email to the author already sent or being sent). It never changes after that. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.
4119
4120
  */
4120
4121
  const getEmailRuleObjection = (options) => (options.client ?? client).get({
4121
4122
  security: [{
@@ -4128,7 +4129,7 @@ const getEmailRuleObjection = (options) => (options.client ?? client).get({
4128
4129
  /**
4129
4130
  * Withdraw an objection
4130
4131
  *
4131
- * Withdraws a pending objection you made, and clears its message. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.
4132
+ * Withdraws a pending objection you made, and clears its message; an email to the rule's author already sent or being sent keeps it. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.
4132
4133
  */
4133
4134
  const withdrawEmailRuleObjection = (options) => (options.client ?? client).post({
4134
4135
  security: [{
@@ -4141,7 +4142,7 @@ const withdrawEmailRuleObjection = (options) => (options.client ?? client).post(
4141
4142
  /**
4142
4143
  * Decline an objection to your rule
4143
4144
  *
4144
- * Declines a pending objection to a rule you wrote, optionally saying why (reason), which the member who objected sees; the rule stays as it is. When its message asks you to narrow the rule or explain who receives it, the reason is your answer; narrow it with a new version as well if you agree. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.
4145
+ * Declines a pending objection to a rule you wrote, optionally saying why (reason), which the member who objected sees; the rule stays as it is. When its message asks you to explain who receives what the rule matches, the reason is your answer. If you changed the rule instead, answer amended. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.
4145
4146
  */
4146
4147
  const declineEmailRuleObjection = (options) => (options.client ?? client).post({
4147
4148
  security: [{
@@ -4169,6 +4170,23 @@ const acceptEmailRuleObjection = (options) => (options.client ?? client).post({
4169
4170
  ...options
4170
4171
  });
4171
4172
  /**
4173
+ * Answer an objection to your rule as amended
4174
+ *
4175
+ * Answers a pending objection to a rule you wrote by saying you changed the rule: save a new version first (PATCH /email-rules/{id}), then answer amended, optionally with a note the member who objected sees. Records the version the rule has now (rule.amended_version). Refused unless the rule's current version is newer than when the objection was made (rule.objected_version). Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.
4176
+ */
4177
+ const amendEmailRuleObjection = (options) => (options.client ?? client).post({
4178
+ security: [{
4179
+ scheme: "bearer",
4180
+ type: "http"
4181
+ }],
4182
+ url: "/email-rule-objections/{id}/amend",
4183
+ ...options,
4184
+ headers: {
4185
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
4186
+ ...options.headers
4187
+ }
4188
+ });
4189
+ /**
4172
4190
  * Get a domain's Agent Authorization status
4173
4191
  *
4174
4192
  * Whether the domain publishes an Agent Authorization (`_agents`) TXT record that lets agents on Primitive email it, read from DNS with the same engine the send path uses (an answer may be up to five minutes old): published (a record authorizes them), published_unauthorized (a record exists but does not), not_set_up (no record, the default) or inconclusive (the lookup could not tell; retry). The domain is one of the organization's, verified or pending; a credential confined to some mailboxes sees only the domains its scope covers. Needs domains:read.
@@ -1,4 +1,4 @@
1
- import { $ as isTrustedSender, c as classifySignalContent, x as retryTransient } from "./repeats-Dj_o6c-X-BLUY-8zn.js";
1
+ import { $ as isTrustedSender, c as classifySignalContent, x as retryTransient } from "./repeats-Dj_o6c-X-DlfpQiUq.js";
2
2
  // src/oclif/presence-provenance.ts
3
3
  function readPresenceProjection(detail) {
4
4
  if (!detail || typeof detail !== "object") return null;
@@ -1,15 +1,15 @@
1
- import { An as listSentEmails, Wt as getEmail, Zn as sendEmail, bt as createEndpoint, h as sendPreparedSignal, p as prepareSignalEmail, v as describeApiFailure } from "./repeats-Dj_o6c-X-BLUY-8zn.js";
2
- import { M as bareAddress, ft as classifySendError, kt as successfulSendOutcome, s as extractErrorPayload } from "./api-command-D1LX7Tjj.js";
1
+ import { An as listSentEmails, Wt as getEmail, Zn as sendEmail, bt as createEndpoint, h as sendPreparedSignal, p as prepareSignalEmail, v as describeApiFailure } from "./repeats-Dj_o6c-X-DlfpQiUq.js";
2
+ import { At as successfulSendOutcome, N as bareAddress, pt as classifySendError, s as extractErrorPayload } from "./api-command-CgBNtNyD.js";
3
3
  import { recordSentSignal } from "./oclif/auto-signals.js";
4
4
  import { _ as acquireListenLock, 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, x as listenProcessIdentity, y as listenIdentity } from "./shared-mail-files-BAQSGxxz.js";
5
- import { i as readApiBeforeDeadline, n as isPlainChatReply, o as scopedChatSenderTrust } from "./scoped-chat-CrQpmC0K.js";
5
+ import { i as readApiBeforeDeadline, n as isPlainChatReply, o as scopedChatSenderTrust } from "./scoped-chat-Du-Bi0tC.js";
6
6
  import { n as tryOwnSharedMail, r as waitForSharedMailChange, t as readSharedMailOwner } from "./shared-mail-watch-BAPMsFNv.js";
7
7
  import { Errors } from "@oclif/core";
8
8
  import { opendirSync } from "node:fs";
9
9
  import { createHash, randomUUID, scryptSync } from "node:crypto";
10
10
  import { dirname, join } from "node:path";
11
11
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
12
- // ../sdk-node/dist/api-mtCxA8lC.js
12
+ // ../sdk-node/dist/api-Bm-YOKa1.js
13
13
  const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
14
14
  function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
15
15
  let lastEventId;
@@ -1831,6 +1831,10 @@ async function openSharedMailStore(options) {
1831
1831
  /** The API's code for an account credential creating a pull subscription. */
1832
1832
  const AGENT_CONNECTION_REQUIRED = "pull_subscription_requires_agent_connection";
1833
1833
  const AGENT_CONNECTION_REQUIRED_MESSAGE = "primitive listen needs a connected agent credential, which limits the subscription to one address. Connect one with primitive agent connect and select its profile. With an account API key, watch mail with primitive emails watch or receive it at an HTTP webhook endpoint instead.";
1834
+ /** The API's code for a full API key that was revoked. */
1835
+ const KEY_REVOKED = "key_revoked";
1836
+ /** What a listener says when its agent's key was revoked: connect again, as signing in cannot bring it back. */
1837
+ const KEY_REVOKED_MESSAGE = "This agent's key was revoked, so it no longer works. Connect the agent again for a new one; signing in does not bring it back.";
1834
1838
  /** Connected-agent API keys are the only credentials that can create pull subscriptions. */
1835
1839
  function isConnectedAgentKey(apiKey) {
1836
1840
  return apiKey?.startsWith("pconn_") === true;
@@ -1855,7 +1859,9 @@ async function ensureSharedMailSubscription(options) {
1855
1859
  responseStyle: "fields"
1856
1860
  });
1857
1861
  if (result.error || !result.data?.data) {
1858
- if (result.error?.error?.code === "pull_subscription_requires_agent_connection") throw new EventReceiverError(AGENT_CONNECTION_REQUIRED_MESSAGE, AGENT_CONNECTION_REQUIRED, 403);
1862
+ const error = result.error;
1863
+ if (error?.error?.code === "pull_subscription_requires_agent_connection") throw new EventReceiverError(AGENT_CONNECTION_REQUIRED_MESSAGE, AGENT_CONNECTION_REQUIRED, 403);
1864
+ if (error?.error?.code === "key_revoked") throw new EventReceiverError(KEY_REVOKED_MESSAGE, KEY_REVOKED, 401);
1859
1865
  throw new EventReceiverError("Could not open the shared inbound subscription.", "subscription_failed", result.response?.status ?? 0);
1860
1866
  }
1861
1867
  const created = result.data.data;
@@ -2338,4 +2344,4 @@ async function sendSignal(context, options) {
2338
2344
  release();
2339
2345
  }
2340
2346
  }
2341
- export { ensureSharedMailSubscription as a, isConnectedAgentKey as c, reserveSharedMailSubscription as d, followEmailConversation as f, EventReceiverError as g, EventConnection as h, sharedMailScope as i, createSharedMailWaiter as l, otherParticipants as m, reconcileChatSend as n, AGENT_CONNECTION_REQUIRED as o, readConversationFollow as p, openSharedMailReceiver as r, AGENT_CONNECTION_REQUIRED_MESSAGE as s, sendSignal as t, openSharedMailStore as u };
2347
+ export { EventConnection as _, ensureSharedMailSubscription as a, KEY_REVOKED as c, createSharedMailWaiter as d, openSharedMailStore as f, otherParticipants as g, readConversationFollow as h, sharedMailScope as i, KEY_REVOKED_MESSAGE as l, followEmailConversation as m, reconcileChatSend as n, AGENT_CONNECTION_REQUIRED as o, reserveSharedMailSubscription as p, openSharedMailReceiver as r, AGENT_CONNECTION_REQUIRED_MESSAGE as s, sendSignal as t, isConnectedAgentKey as u, EventReceiverError as v };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primitivedotdev/cli",
3
- "version": "3.0.0-preview.16",
3
+ "version": "3.0.0-preview.17",
4
4
  "publishConfig": {
5
5
  "tag": "preview"
6
6
  },