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

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,4 +1,4 @@
1
- import { $t as getOwnGrant, B as awaitingRejectedError, G as isAwaitingRejectedError, J as EMAIL_RULE_OBJECTION_EVENT_TYPES, Kn as sdk_gen_exports, R as ReplyStateUnsupportedError, V as ensureSearchReportsReplyState, Wt as getEmail, X as SENT_EMAIL_EVENT_TYPES, Y as EMAIL_RULE_REQUEST_EVENT_TYPES, Z as WEBHOOK_EVENT_TYPES, at as AutomatedFilterUnsupportedError, ct as automatedSurfaceForOperation, ft as isAutomatedRejectedError, lt as ensureSearchReportsAutomated, ot as assertAutomatedVerdict, q as replyStateSurfaceForOperation, rn as getThread, st as automatedRejectedError, ut as expectedAutomatedVerdicts, vn as listEndpoints, y as parseRetryAfter, z as assertAwaitingFilterRows } from "./repeats-Dj_o6c-X-B7sSj0oc.js";
1
+ import { $t as getOwnGrant, B as awaitingRejectedError, G as isAwaitingRejectedError, J as EMAIL_RULE_OBJECTION_EVENT_TYPES, R as ReplyStateUnsupportedError, V as ensureSearchReportsReplyState, Wt as getEmail, X as SENT_EMAIL_EVENT_TYPES, Y as EMAIL_RULE_REQUEST_EVENT_TYPES, Z as WEBHOOK_EVENT_TYPES, at as AutomatedFilterUnsupportedError, ct as automatedSurfaceForOperation, ft as isAutomatedRejectedError, lt as ensureSearchReportsAutomated, ot as assertAutomatedVerdict, q as replyStateSurfaceForOperation, qn as sdk_gen_exports, rn as getThread, st as automatedRejectedError, ut as expectedAutomatedVerdicts, y as parseRetryAfter, yn as listEndpoints, z as assertAwaitingFilterRows } from "./repeats-Dj_o6c-X-BLUY-8zn.js";
2
2
  import { C as saveCliCredentials, F as agentProfilesDirectory, H as requireDefaultLoginProfile, N as agentProfileDirectory, R as loadConnectedAgentProfile, S as resolveCliAuth, W as PrimitiveApiClient, _ as deleteCliCredentials, b as loadCliCredentials, 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 saveSignupCredentials, x as normalizeApiBaseUrl, y as detectPrimitiveKeyEnvMisname } from "./cli-config-Ms_0vNjq.js";
3
3
  import "./oclif/global-org-flag.js";
4
4
  import { a as thrownErrorBody } from "./json-output-ch756TXV.js";
@@ -872,7 +872,7 @@ const operationManifest = [
872
872
  "ended_at": {
873
873
  "type": ["string", "null"],
874
874
  "format": "date-time",
875
- "description": "When it was deleted, replaced or revoked, when an API key expired, when a repeating send stopped, or when a rule request or objection was decided (accepted, declined or withdrawn); null otherwise, as on every coverage notice."
875
+ "description": "When it was deleted, replaced or revoked, when an API key expired, when a repeating send stopped, or when a rule request or objection was decided (accepted, declined or withdrawn); null otherwise, as on every coverage notice (rule_now marks one whose rule was deleted)."
876
876
  },
877
877
  "owned_now": {
878
878
  "type": "string",
@@ -902,10 +902,15 @@ const operationManifest = [
902
902
  ]
903
903
  },
904
904
  "rule_id": {
905
- "description": "For email_rule_coverage, always: the rule it is about, since names need not be unique (for pending, the same as id). GET /v1/email-rules/covering-me/{rule_id} shows the rule while it covers you, or as it last decided on your mail; otherwise it answers not_found.",
905
+ "description": "For email_rule_coverage, always: the rule it is about, since names need not be unique (for pending, the same as id). GET /v1/email-rules/covering-me/{rule_id} shows the rule while it covers you, or as it last decided on your mail; otherwise it answers not_found, with details.reason rule_deleted once a rule you were told of is deleted.",
906
906
  "type": "string",
907
907
  "format": "uuid"
908
908
  },
909
+ "rule_now": {
910
+ "description": "For email_rule_coverage: deleted once the rule it is about has been deleted. Left out while it exists, or when that could not be checked.",
911
+ "type": "string",
912
+ "enum": ["deleted"]
913
+ },
909
914
  "receivers_change": {
910
915
  "description": "For a receivers_changed notice: who received the rule's matches before and after, in totals. They can be equal when only an owner or a webhook site changed; covering-me shows them by owner. A rotated key counts once here while the old one still works; covering-me counts both.",
911
916
  "type": "object",
@@ -1014,7 +1019,7 @@ const operationManifest = [
1014
1019
  "as_of": {
1015
1020
  "type": ["string", "null"],
1016
1021
  "format": "date-time",
1017
- "description": "With relation=concerning only: about when the notices last looked at your organization; null if never or unread. Coverage since may have no notice yet."
1022
+ "description": "With relation=concerning only: about when the notices last looked at your organization; null if never or unread. Coverage since may have no notice yet. They look only while one of its rules could cover someone, so this stops moving while none could."
1018
1023
  },
1019
1024
  "pending_complete": {
1020
1025
  "description": "With relation=concerning, on the first page only: whether the check for rules that started covering you without their start notice (state pending, listed ahead of the notices and beyond limit) was finished. false: some may be missing. Absent where there is nothing to check.",
@@ -6453,7 +6458,10 @@ const operationManifest = [
6453
6458
  null
6454
6459
  ]
6455
6460
  },
6456
- "webhook_attempt_count": { "type": "integer" },
6461
+ "webhook_attempt_count": {
6462
+ "type": "integer",
6463
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its attempts."
6464
+ },
6457
6465
  "thread_id": {
6458
6466
  "type": ["string", "null"],
6459
6467
  "format": "uuid",
@@ -10938,7 +10946,7 @@ const operationManifest = [
10938
10946
  "binaryResponse": false,
10939
10947
  "bodyRequired": true,
10940
10948
  "command": "rotate-key",
10941
- "description": "Mint a successor with a new id and the same name, grant, expiry and conditions, and return its secret once. The old key keeps working for overlap_seconds, then stops: 24 hours when overlap_seconds is omitted, at most 7 days, never past its own expires_at, and at once with 0 (which is how to rotate a key whose secret leaked). previous_key_expires_at says when the old key stops. Revoking the successor during the overlap also revokes the old key when you may revoke that one too; the revoke's predecessors_left counts any left working. Rotating does not extend a key: the successor keeps the old expiry unless expires_at gives it a new one. That needs keys:manage (403 forbidden otherwise), is held to the credential policy (400 when past its maximum lifetime, with the latest expiry it allows now in the message), and someone limited to their own keys can only keep or bring it forward (403 grant_forbidden, details.reason own_key_tighten_only); the old key then never outlives the new one. The person rotating must cover the key's access (403 grant_forbidden, details.reason target_not_covered), and a key an owner holds is rotated by an owner only (403 forbidden, details.reason owner_key_rotation), since rotating hands over the new secret. The person's own Primitive CLI login needs no step-up (it acts as the person, held to the same rules) unless the organization's credential policy sets cli_writes_require_approval; the Primitive app's token is refused, even with one. Needs the organization's credential features to be enabled; while they are not, this answers 404 feature_disabled, with details.feature naming the feature. Contact Primitive to turn them on.\n\nPerson only: a dashboard session, the person's own Primitive CLI login with no step-up (unless the organization's credential policy sets cli_writes_require_approval), or the person's own OAuth token with a step-up token for purpose `keys.create` in the Primitive-Step-Up header. Without one any other OAuth token is answered 403 step_up_required, whose details carry the dashboard URL that issues it (or 403 grant_forbidden when the person's role, or the client, could not do it anyway). The person's role must hold keys:manage. API keys and agent connection keys are refused. An agent acting for the person is refused unless it carries a step-up token the person issued in the dashboard.",
10949
+ "description": "Mint a successor with a new id and the same name, grant, expiry and conditions, and return its secret once, with its name and grant so you can see they carried over. The old key keeps working for overlap_seconds, then stops: 24 hours when overlap_seconds is omitted, at most 7 days, never past its own expires_at, and at once with 0 (which is how to rotate a key whose secret leaked). previous_key_expires_at says when the old key stops. Revoking the successor during the overlap also revokes the old key when you may revoke that one too; the revoke's predecessors_left counts any left working. Rotating does not extend a key: the successor keeps the old expiry unless expires_at gives it a new one. That needs keys:manage (403 forbidden otherwise), is held to the credential policy (400 when past its maximum lifetime, with the latest expiry it allows now in the message), and someone limited to their own keys can only keep or bring it forward (403 grant_forbidden, details.reason own_key_tighten_only); the old key then never outlives the new one. The person rotating must cover the key's access (403 grant_forbidden, details.reason target_not_covered), and a key an owner holds is rotated by an owner only (403 forbidden, details.reason owner_key_rotation), since rotating hands over the new secret. The person's own Primitive CLI login needs no step-up (it acts as the person, held to the same rules) unless the organization's credential policy sets cli_writes_require_approval; the Primitive app's token is refused, even with one. Needs the organization's credential features to be enabled; while they are not, this answers 404 feature_disabled, with details.feature naming the feature. Contact Primitive to turn them on.\n\nPerson only: a dashboard session, the person's own Primitive CLI login with no step-up (unless the organization's credential policy sets cli_writes_require_approval), or the person's own OAuth token with a step-up token for purpose `keys.create` in the Primitive-Step-Up header. Without one any other OAuth token is answered 403 step_up_required, whose details carry the dashboard URL that issues it (or 403 grant_forbidden when the person's role, or the client, could not do it anyway). The person's role must hold keys:manage. API keys and agent connection keys are refused. An agent acting for the person is refused unless it carries a step-up token the person issued in the dashboard.",
10942
10950
  "hasJsonBody": true,
10943
10951
  "method": "POST",
10944
10952
  "operationId": "rotateKey",
@@ -10996,6 +11004,36 @@ const operationManifest = [
10996
11004
  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
10997
11005
  },
10998
11006
  "previous_key_id": { "type": "string" },
11007
+ "name": {
11008
+ "description": "The successor's name: the rotated key's, which it keeps.",
11009
+ "type": ["string", "null"]
11010
+ },
11011
+ "grant": {
11012
+ "description": "The grant the successor holds, as a create answers it: the rotated key's own, carried over unchanged (rules, addresses and domains included).",
11013
+ "type": "object",
11014
+ "properties": {
11015
+ "template": { "type": ["string", "null"] },
11016
+ "credential_grant_id": { "type": ["string", "null"] },
11017
+ "permissions": {
11018
+ "type": ["array", "null"],
11019
+ "items": { "type": "string" }
11020
+ },
11021
+ "mail_scope": {},
11022
+ "resources": {}
11023
+ },
11024
+ "required": [
11025
+ "template",
11026
+ "credential_grant_id",
11027
+ "permissions",
11028
+ "mail_scope",
11029
+ "resources"
11030
+ ],
11031
+ "additionalProperties": {}
11032
+ },
11033
+ "rotated_from": {
11034
+ "description": "The rotated key: previous_key_id, under the name GET /v1/keys/{id} gives it.",
11035
+ "type": "string"
11036
+ },
10999
11037
  "previous_key_expires_at": {
11000
11038
  "type": "string",
11001
11039
  "format": "date-time",
@@ -13635,10 +13673,13 @@ const operationManifest = [
13635
13673
  "description": "Whether it is to a rule you wrote, in your current membership."
13636
13674
  },
13637
13675
  "message": {
13638
- "description": "Why the objector objects; null when none was given, or once withdrawn.",
13676
+ "description": "Why they object and what they ask (to turn the rule off, narrow it, or explain who receives it); null when none was given, or once withdrawn.",
13677
+ "type": ["string", "null"]
13678
+ },
13679
+ "decline_reason": {
13680
+ "description": "The author's answer when declining, which the objector sees; null when none was given.",
13639
13681
  "type": ["string", "null"]
13640
13682
  },
13641
- "decline_reason": { "type": ["string", "null"] },
13642
13683
  "created_at": {
13643
13684
  "type": "string",
13644
13685
  "format": "date-time"
@@ -13676,7 +13717,7 @@ const operationManifest = [
13676
13717
  "binaryResponse": false,
13677
13718
  "bodyRequired": true,
13678
13719
  "command": "create-email-rule-objection",
13679
- "description": "Asks the author of a rule that covers one of your own mailboxes now to turn it off. 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, 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.",
13720
+ "description": "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.",
13680
13721
  "hasJsonBody": true,
13681
13722
  "method": "POST",
13682
13723
  "operationId": "createEmailRuleObjection",
@@ -13704,7 +13745,7 @@ const operationManifest = [
13704
13745
  "type": ["string", "null"],
13705
13746
  "minLength": 1,
13706
13747
  "maxLength": 500,
13707
- "description": "Why you object, up to 500 characters; null or absent for none. The rule's author and the organization's owners and admins see it while it stands; withdrawing clears it."
13748
+ "description": "Why you object and what you ask, up to 500 characters: to turn the rule off, to narrow it, or to explain who receives what it matches. Null or absent for none. The rule's author and the organization's owners and admins see it while it stands; withdrawing clears it."
13708
13749
  }
13709
13750
  },
13710
13751
  "required": ["rule_id"],
@@ -13789,10 +13830,13 @@ const operationManifest = [
13789
13830
  "description": "Whether it is to a rule you wrote, in your current membership."
13790
13831
  },
13791
13832
  "message": {
13792
- "description": "Why the objector objects; null when none was given, or once withdrawn.",
13833
+ "description": "Why they object and what they ask (to turn the rule off, narrow it, or explain who receives it); null when none was given, or once withdrawn.",
13834
+ "type": ["string", "null"]
13835
+ },
13836
+ "decline_reason": {
13837
+ "description": "The author's answer when declining, which the objector sees; null when none was given.",
13793
13838
  "type": ["string", "null"]
13794
13839
  },
13795
- "decline_reason": { "type": ["string", "null"] },
13796
13840
  "created_at": {
13797
13841
  "type": "string",
13798
13842
  "format": "date-time"
@@ -13830,7 +13874,7 @@ const operationManifest = [
13830
13874
  "binaryResponse": false,
13831
13875
  "bodyRequired": false,
13832
13876
  "command": "decline-email-rule-objection",
13833
- "description": "Declines a pending objection to a rule you wrote, optionally saying why; the rule stays as it is. 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.",
13877
+ "description": "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.",
13834
13878
  "hasJsonBody": true,
13835
13879
  "method": "POST",
13836
13880
  "operationId": "declineEmailRuleObjection",
@@ -13858,7 +13902,7 @@ const operationManifest = [
13858
13902
  "type": ["string", "null"],
13859
13903
  "minLength": 1,
13860
13904
  "maxLength": 500,
13861
- "description": "Why you are declining, up to 500 characters; null or absent for none. The member who objected sees it."
13905
+ "description": "Why you are declining, up to 500 characters; null or absent for none. The member who objected sees it: it is how to answer one that asks you to narrow the rule or explain who receives it."
13862
13906
  } },
13863
13907
  "additionalProperties": false
13864
13908
  },
@@ -13941,10 +13985,13 @@ const operationManifest = [
13941
13985
  "description": "Whether it is to a rule you wrote, in your current membership."
13942
13986
  },
13943
13987
  "message": {
13944
- "description": "Why the objector objects; null when none was given, or once withdrawn.",
13988
+ "description": "Why they object and what they ask (to turn the rule off, narrow it, or explain who receives it); null when none was given, or once withdrawn.",
13989
+ "type": ["string", "null"]
13990
+ },
13991
+ "decline_reason": {
13992
+ "description": "The author's answer when declining, which the objector sees; null when none was given.",
13945
13993
  "type": ["string", "null"]
13946
13994
  },
13947
- "decline_reason": { "type": ["string", "null"] },
13948
13995
  "created_at": {
13949
13996
  "type": "string",
13950
13997
  "format": "date-time"
@@ -13982,7 +14029,7 @@ const operationManifest = [
13982
14029
  "binaryResponse": false,
13983
14030
  "bodyRequired": false,
13984
14031
  "command": "get-email-rule-covering-me",
13985
- "description": "One rule that covers one of your own mailboxes, read-only, with its current version; or one that no longer does but decided on mail at your own mailbox (covers_now false), shown as the version that last decided on your mail, without its current name. You see its name, wording, current tree, state, kind and author, and which of your own mailboxes it reaches. Its wording and tree are shown as written, so they can name other addresses (a condition on who an email is from or to). While it covers you, you also see who receives what it matches (receivers): how many API keys, webhooks and shares, the member each belongs to (or the organization), and the sites the webhooks deliver to. You do not see which keys, webhooks or shares they are (no ids, names, prefixes, or URLs beyond the site), the other inboxes and domains its scope names, or its saved expectations. 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.",
14032
+ "description": "One rule that covers one of your own mailboxes, read-only, with its current version; or one that no longer does but decided on mail at your own mailbox (covers_now false), shown as the version that last decided on your mail, without its current name. You see its name, wording, current tree, state, kind and author, and which of your own mailboxes it reaches. Its wording and tree are shown as written, so they can name other addresses (a condition on who an email is from or to). While it covers you, you also see who receives what it matches (receivers): how many API keys, webhooks and shares, the member each belongs to (or the organization), and the sites the webhooks deliver to. You do not see which keys, webhooks or shares they are (no ids, names, prefixes, or URLs beyond the site), the other inboxes and domains its scope names, or its saved expectations. For what happened to one email of yours, every rule's decision on it and, for another member's rule covering you, who receives what it shares: GET /v1/emails/{id}/rule-results (primitive email-rules list-email-rule-results --email-id <email-id>). Whether a rule delivered the email by webhook is not in the rule results: on your own mail, rule_deliveries on GET /v1/emails/{id} (primitive emails get <email-id> --json) counts each rule's webhook deliveries; on another member's mail, GET /v1/webhooks/deliveries?email_id=<email-id> (primitive webhook-deliveries list --email-id <email-id>, with webhooks:read) lists them. 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.",
13986
14033
  "hasJsonBody": false,
13987
14034
  "method": "GET",
13988
14035
  "operationId": "getEmailRuleCoveringMe",
@@ -14024,6 +14071,10 @@ const operationManifest = [
14024
14071
  "enum": ["grant", "do_not_share"],
14025
14072
  "description": "grant: what it matches can be shared. do_not_share: it blocks sharing what it matches."
14026
14073
  },
14074
+ "do_not_share_note": {
14075
+ "description": "On a grant rule: that the active do-not-share rules over an email run first, keeping from it what they match and holding back what they cannot decide, which is decided again for up to a day and shared only if none of them then matches it.",
14076
+ "type": "string"
14077
+ },
14027
14078
  "author": {
14028
14079
  "type": "object",
14029
14080
  "properties": {
@@ -14124,7 +14175,7 @@ const operationManifest = [
14124
14175
  "exclusiveMinimum": 0
14125
14176
  },
14126
14177
  "reads_in_full": {
14127
- "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches.",
14178
+ "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches. It counts what they can read, not whether any has read an email.",
14128
14179
  "type": "integer",
14129
14180
  "minimum": 0
14130
14181
  },
@@ -14295,7 +14346,7 @@ const operationManifest = [
14295
14346
  "exclusiveMinimum": 0
14296
14347
  },
14297
14348
  "reads_in_full": {
14298
- "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches.",
14349
+ "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches. It counts what they can read, not whether any has read an email.",
14299
14350
  "type": "integer",
14300
14351
  "minimum": 0
14301
14352
  },
@@ -14528,7 +14579,7 @@ const operationManifest = [
14528
14579
  "binaryResponse": false,
14529
14580
  "bodyRequired": false,
14530
14581
  "command": "get-email-rule-objection",
14531
- "description": "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, 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.",
14582
+ "description": "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.",
14532
14583
  "hasJsonBody": false,
14533
14584
  "method": "GET",
14534
14585
  "operationId": "getEmailRuleObjection",
@@ -14624,10 +14675,13 @@ const operationManifest = [
14624
14675
  "description": "Whether it is to a rule you wrote, in your current membership."
14625
14676
  },
14626
14677
  "message": {
14627
- "description": "Why the objector objects; null when none was given, or once withdrawn.",
14678
+ "description": "Why they object and what they ask (to turn the rule off, narrow it, or explain who receives it); null when none was given, or once withdrawn.",
14679
+ "type": ["string", "null"]
14680
+ },
14681
+ "decline_reason": {
14682
+ "description": "The author's answer when declining, which the objector sees; null when none was given.",
14628
14683
  "type": ["string", "null"]
14629
14684
  },
14630
- "decline_reason": { "type": ["string", "null"] },
14631
14685
  "created_at": {
14632
14686
  "type": "string",
14633
14687
  "format": "date-time"
@@ -14788,7 +14842,7 @@ const operationManifest = [
14788
14842
  "binaryResponse": false,
14789
14843
  "bodyRequired": false,
14790
14844
  "command": "list-email-rule-objections",
14791
- "description": "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, 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.",
14845
+ "description": "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.",
14792
14846
  "hasJsonBody": false,
14793
14847
  "method": "GET",
14794
14848
  "operationId": "listEmailRuleObjections",
@@ -14923,10 +14977,13 @@ const operationManifest = [
14923
14977
  "description": "Whether it is to a rule you wrote, in your current membership."
14924
14978
  },
14925
14979
  "message": {
14926
- "description": "Why the objector objects; null when none was given, or once withdrawn.",
14980
+ "description": "Why they object and what they ask (to turn the rule off, narrow it, or explain who receives it); null when none was given, or once withdrawn.",
14981
+ "type": ["string", "null"]
14982
+ },
14983
+ "decline_reason": {
14984
+ "description": "The author's answer when declining, which the objector sees; null when none was given.",
14927
14985
  "type": ["string", "null"]
14928
14986
  },
14929
- "decline_reason": { "type": ["string", "null"] },
14930
14987
  "created_at": {
14931
14988
  "type": "string",
14932
14989
  "format": "date-time"
@@ -15085,7 +15142,7 @@ const operationManifest = [
15085
15142
  "binaryResponse": false,
15086
15143
  "bodyRequired": false,
15087
15144
  "command": "list-email-rules-covering-me",
15088
- "description": "Every email rule that covers one of your own mailboxes now, yours included, newest first, in any state. A rule covers you when the scope it runs with now reaches one of your own mailboxes (your member mailbox, or a personal agent's address): one whose author reads all your mail (author scope, for an author who reads the organization's mail or holds an access entry for your mailbox), or one that names your mailbox or its domain (selected). Another member's own_mailboxes rule never covers you. You see its name, wording, current tree, state, kind and author, and which of your own mailboxes it reaches. Its wording and tree are shown as written, so they can name other addresses (a condition on who an email is from or to). While it covers you, you also see who receives what it matches (receivers): how many API keys, webhooks and shares, the member each belongs to (or the organization), and the sites the webhooks deliver to. You do not see which keys, webhooks or shares they are (no ids, names, prefixes, or URLs beyond the site), the other inboxes and domains its scope names, or its saved expectations. A page can hold fewer rules than limit, or none, and still carry a cursor (one request reads a bounded number of rules): keep reading until meta.cursor is null. 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.",
15145
+ "description": "Every email rule that covers one of your own mailboxes now, yours included, newest first, in any state. A rule covers you when the scope it runs with now reaches one of your own mailboxes (your member mailbox, or a personal agent's address), and covers.via says how: author_reach, it runs over everything its author can read, which includes your mail (an author who reads the organization's mail or holds an access entry for your mailbox); selected, it names your mailbox or its domain; own_mailboxes, it is your own rule over your own mail. Another member's own_mailboxes rule never covers you. You see its name, wording, current tree, state, kind and author, and which of your own mailboxes it reaches. Its wording and tree are shown as written, so they can name other addresses (a condition on who an email is from or to). While it covers you, you also see who receives what it matches (receivers): how many API keys, webhooks and shares, the member each belongs to (or the organization), and the sites the webhooks deliver to. You do not see which keys, webhooks or shares they are (no ids, names, prefixes, or URLs beyond the site), the other inboxes and domains its scope names, or its saved expectations. Each listed rule carries its current version's english and explanation; its tree is on GET /v1/email-rules/covering-me/{id}. A page can hold fewer rules than limit, or none, and still carry a cursor (one request reads a bounded number of rules): keep reading until meta.cursor is null. For what happened to one email of yours, every rule's decision on it and, for another member's rule covering you, who receives what it shares: GET /v1/emails/{id}/rule-results (primitive email-rules list-email-rule-results --email-id <email-id>). Whether a rule delivered the email by webhook is not in the rule results: on your own mail, rule_deliveries on GET /v1/emails/{id} (primitive emails get <email-id> --json) counts each rule's webhook deliveries; on another member's mail, GET /v1/webhooks/deliveries?email_id=<email-id> (primitive webhook-deliveries list --email-id <email-id>, with webhooks:read) lists them. 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.",
15089
15146
  "hasJsonBody": false,
15090
15147
  "method": "GET",
15091
15148
  "operationId": "listEmailRulesCoveringMe",
@@ -15135,6 +15192,10 @@ const operationManifest = [
15135
15192
  "enum": ["grant", "do_not_share"],
15136
15193
  "description": "grant: what it matches can be shared. do_not_share: it blocks sharing what it matches."
15137
15194
  },
15195
+ "do_not_share_note": {
15196
+ "description": "On a grant rule: that the active do-not-share rules over an email run first, keeping from it what they match and holding back what they cannot decide, which is decided again for up to a day and shared only if none of them then matches it.",
15197
+ "type": "string"
15198
+ },
15138
15199
  "author": {
15139
15200
  "type": "object",
15140
15201
  "properties": {
@@ -15231,7 +15292,7 @@ const operationManifest = [
15231
15292
  "exclusiveMinimum": 0
15232
15293
  },
15233
15294
  "reads_in_full": {
15234
- "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches.",
15295
+ "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches. It counts what they can read, not whether any has read an email.",
15235
15296
  "type": "integer",
15236
15297
  "minimum": 0
15237
15298
  },
@@ -15402,7 +15463,7 @@ const operationManifest = [
15402
15463
  "exclusiveMinimum": 0
15403
15464
  },
15404
15465
  "reads_in_full": {
15405
- "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches.",
15466
+ "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches. It counts what they can read, not whether any has read an email.",
15406
15467
  "type": "integer",
15407
15468
  "minimum": 0
15408
15469
  },
@@ -15530,6 +15591,14 @@ const operationManifest = [
15530
15591
  "created_at": {
15531
15592
  "type": "string",
15532
15593
  "format": "date-time"
15594
+ },
15595
+ "english": {
15596
+ "description": "What its author asked for, in their words, at its current version. Null when it has no version, was deleted after the page was read, or the words could not be read in time; GET /v1/email-rules/covering-me/{id} shows them with its tree.",
15597
+ "type": ["string", "null"]
15598
+ },
15599
+ "explanation": {
15600
+ "description": "What its current version matches, as compiled. Null as english is.",
15601
+ "type": ["string", "null"]
15533
15602
  }
15534
15603
  },
15535
15604
  "required": [
@@ -15658,10 +15727,13 @@ const operationManifest = [
15658
15727
  "description": "Whether it is to a rule you wrote, in your current membership."
15659
15728
  },
15660
15729
  "message": {
15661
- "description": "Why the objector objects; null when none was given, or once withdrawn.",
15730
+ "description": "Why they object and what they ask (to turn the rule off, narrow it, or explain who receives it); null when none was given, or once withdrawn.",
15731
+ "type": ["string", "null"]
15732
+ },
15733
+ "decline_reason": {
15734
+ "description": "The author's answer when declining, which the objector sees; null when none was given.",
15662
15735
  "type": ["string", "null"]
15663
15736
  },
15664
- "decline_reason": { "type": ["string", "null"] },
15665
15737
  "created_at": {
15666
15738
  "type": "string",
15667
15739
  "format": "date-time"
@@ -15836,6 +15908,81 @@ const operationManifest = [
15836
15908
  "required": ["checked", "matched"]
15837
15909
  }, { "type": "null" }]
15838
15910
  },
15911
+ "breadth_scope": {
15912
+ "type": "object",
15913
+ "properties": {
15914
+ "evaluation_scope": {
15915
+ "type": "string",
15916
+ "enum": [
15917
+ "author",
15918
+ "own_mailboxes",
15919
+ "selected"
15920
+ ],
15921
+ "description": "author, own_mailboxes or selected, as a rule's evaluation_scope."
15922
+ },
15923
+ "scope_selection": {
15924
+ "type": ["object", "null"],
15925
+ "properties": {
15926
+ "addresses": {
15927
+ "maxItems": 100,
15928
+ "type": "array",
15929
+ "items": {
15930
+ "type": "string",
15931
+ "maxLength": 320
15932
+ }
15933
+ },
15934
+ "domains": {
15935
+ "maxItems": 50,
15936
+ "type": "array",
15937
+ "items": {
15938
+ "type": "string",
15939
+ "maxLength": 253
15940
+ }
15941
+ }
15942
+ },
15943
+ "required": ["addresses", "domains"],
15944
+ "description": "What a selected scope names; null for any other."
15945
+ }
15946
+ },
15947
+ "required": ["evaluation_scope", "scope_selection"]
15948
+ },
15949
+ "scope_warnings": {
15950
+ "description": "Ignored (the compile answer's scope_warnings).",
15951
+ "maxItems": 150,
15952
+ "type": "array",
15953
+ "items": {
15954
+ "type": "object",
15955
+ "properties": {
15956
+ "name": {
15957
+ "type": "string",
15958
+ "maxLength": 320
15959
+ },
15960
+ "kind": {
15961
+ "type": "string",
15962
+ "enum": ["address", "domain"]
15963
+ },
15964
+ "reason": {
15965
+ "type": "string",
15966
+ "enum": [
15967
+ "unknown_domain",
15968
+ "inactive_domain",
15969
+ "unknown_address"
15970
+ ],
15971
+ "description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
15972
+ },
15973
+ "message": {
15974
+ "type": "string",
15975
+ "maxLength": 1e3
15976
+ }
15977
+ },
15978
+ "required": [
15979
+ "name",
15980
+ "kind",
15981
+ "reason",
15982
+ "message"
15983
+ ]
15984
+ }
15985
+ },
15839
15986
  "kind": {
15840
15987
  "description": "Only grant.",
15841
15988
  "type": "string",
@@ -15963,194 +16110,9 @@ const operationManifest = [
15963
16110
  "responseSchema": {
15964
16111
  "type": "object",
15965
16112
  "properties": {
15966
- "request": {
15967
- "type": "object",
15968
- "properties": {
15969
- "id": {
15970
- "type": "string",
15971
- "format": "uuid"
15972
- },
15973
- "status": {
15974
- "type": "string",
15975
- "enum": [
15976
- "pending",
15977
- "accepted",
15978
- "declined",
15979
- "withdrawn"
15980
- ]
15981
- },
15982
- "name": { "type": "string" },
15983
- "english": { "type": "string" },
15984
- "tree": {
15985
- "type": "object",
15986
- "properties": {
15987
- "version": {
15988
- "type": "number",
15989
- "const": 1
15990
- },
15991
- "vocabulary": {
15992
- "type": "string",
15993
- "description": "Vocabulary version, such as v1."
15994
- },
15995
- "when": {
15996
- "type": "object",
15997
- "propertyNames": { "type": "string" },
15998
- "additionalProperties": {},
15999
- "description": "A condition {column, op, value?, min_confidence?} (see GET /email-rules/vocabulary) or {all: [...]}, {any: [...]}, {not: ...}."
16000
- },
16001
- "questions": {
16002
- "type": "array",
16003
- "items": { "type": "string" },
16004
- "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, never attachment contents. A grant rule needs every one yes; a do_not_share rule matches on any yes."
16005
- }
16006
- },
16007
- "required": [
16008
- "version",
16009
- "vocabulary",
16010
- "when",
16011
- "questions"
16012
- ]
16013
- },
16014
- "explanation": { "type": "string" },
16015
- "assumptions": {
16016
- "type": "array",
16017
- "items": { "type": "string" }
16018
- },
16019
- "warnings": {
16020
- "type": "array",
16021
- "items": { "type": "string" },
16022
- "description": "As the member who asked sent them, normally from their compile, then every compiler note on the rule's tree and words they lack. The compiler's note that the rule matches nearly everything, in its own wording, counted that member's recent mail: anyone else reads it naming them."
16023
- },
16024
- "server_explanation": {
16025
- "description": "What the rule as asked actually does: Primitive's own reading of the request's tree, never the words of the member who asked or of a model. Null when the tree no longer reads as one.",
16026
- "type": ["string", "null"]
16027
- },
16028
- "server_notes": {
16029
- "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
16030
- "type": "array",
16031
- "items": { "type": "string" }
16032
- },
16033
- "compiled_by": { "type": "string" },
16034
- "vocabulary": { "type": "string" },
16035
- "proposed_via": {
16036
- "type": "string",
16037
- "enum": ["session", "oauth"],
16038
- "description": "session: the proposer's own session; oauth: an OAuth or CLI token acting for them."
16039
- },
16040
- "created_at": {
16041
- "type": "string",
16042
- "format": "date-time"
16043
- },
16044
- "decided_at": {
16045
- "type": ["string", "null"],
16046
- "format": "date-time"
16047
- },
16048
- "decided_by_user_id": {
16049
- "type": ["string", "null"],
16050
- "format": "uuid"
16051
- },
16052
- "proposer": {
16053
- "type": "object",
16054
- "properties": {
16055
- "user_id": {
16056
- "type": "string",
16057
- "format": "uuid"
16058
- },
16059
- "name": { "type": ["string", "null"] },
16060
- "email": {
16061
- "description": "Sign-in email; null unless you can list member emails, this is you, or they asked you.",
16062
- "type": ["string", "null"]
16063
- },
16064
- "active": {
16065
- "type": "boolean",
16066
- "description": "Still a member under the membership recorded (a request or share with someone who left no longer works)."
16067
- }
16068
- },
16069
- "required": [
16070
- "user_id",
16071
- "name",
16072
- "email",
16073
- "active"
16074
- ]
16075
- },
16076
- "target": {
16077
- "type": "object",
16078
- "properties": {
16079
- "user_id": {
16080
- "type": ["string", "null"],
16081
- "format": "uuid",
16082
- "description": "Null unless you can list members or this is you."
16083
- },
16084
- "name": {
16085
- "description": "Null unless you can list members or this is you.",
16086
- "type": ["string", "null"]
16087
- },
16088
- "email": {
16089
- "description": "Sign-in email; null unless you can list member emails or this is you.",
16090
- "type": ["string", "null"]
16091
- },
16092
- "active": {
16093
- "type": "boolean",
16094
- "description": "Still a member under the membership recorded (a request or share with someone who left no longer works)."
16095
- }
16096
- },
16097
- "required": [
16098
- "user_id",
16099
- "name",
16100
- "email",
16101
- "active"
16102
- ]
16103
- },
16104
- "target_address_typed": {
16105
- "description": "The address the proposer typed to name the target; null for anyone else, and when named by user id.",
16106
- "type": ["string", "null"]
16107
- },
16108
- "is_proposer": { "type": "boolean" },
16109
- "is_target": { "type": "boolean" },
16110
- "share_id": {
16111
- "type": ["string", "null"],
16112
- "format": "uuid",
16113
- "description": "The share accepting created, while it exists."
16114
- },
16115
- "message": {
16116
- "description": "What the member asking wrote about why; null when they wrote nothing.",
16117
- "type": ["string", "null"]
16118
- },
16119
- "decline_reason": {
16120
- "description": "Why the member asked declined it; null unless they gave a reason when declining.",
16121
- "type": ["string", "null"]
16122
- },
16123
- "edited_on_accept": {
16124
- "description": "Once accepted: whether the rule was changed first, as on the share. Null until then, or when unreadable.",
16125
- "type": ["boolean", "null"]
16126
- },
16127
- "notice": {
16128
- "description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, then what accepting would share. For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
16129
- "type": ["string", "null"]
16130
- }
16131
- },
16132
- "required": [
16133
- "id",
16134
- "status",
16135
- "name",
16136
- "english",
16137
- "tree",
16138
- "explanation",
16139
- "assumptions",
16140
- "warnings",
16141
- "compiled_by",
16142
- "vocabulary",
16143
- "proposed_via",
16144
- "created_at",
16145
- "decided_at",
16146
- "decided_by_user_id",
16147
- "proposer",
16148
- "target",
16149
- "target_address_typed",
16150
- "is_proposer",
16151
- "is_target",
16152
- "share_id"
16153
- ]
16113
+ "notice": {
16114
+ "description": "What is now shared, in words. When you changed the rule and it can now match mail the request left out by who it was sent to (such as mail where an address is only copied), that comes first; when you changed its english, tree or explanation (edited_on_accept; a new name alone is no change), that rule.current is what you agreed to and request what was asked.",
16115
+ "type": "string"
16154
16116
  },
16155
16117
  "rule": {
16156
16118
  "type": "object",
@@ -16248,7 +16210,7 @@ const operationManifest = [
16248
16210
  "minimum": 0
16249
16211
  },
16250
16212
  "objection_notice": {
16251
- "description": "With pending_objections above 0: that members asked you to turn it off, and how to answer.",
16213
+ "description": "With pending_objections above 0: that members objected (each message says what they ask: to turn it off, narrow it or explain it), and how to answer.",
16252
16214
  "type": "string"
16253
16215
  },
16254
16216
  "created_at": {
@@ -16389,11 +16351,11 @@ const operationManifest = [
16389
16351
  "rule_deleted",
16390
16352
  null
16391
16353
  ],
16392
- "description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
16354
+ "description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved, on a share that ended before new versions kept shares) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
16393
16355
  },
16394
16356
  "accepted_rule_version": {
16395
16357
  "type": "integer",
16396
- "description": "The version of the rule that was accepted. A new version of the rule ends the share."
16358
+ "description": "The version of the rule that was accepted. A later version keeps the share: what each version matches is shared from when it is saved."
16397
16359
  },
16398
16360
  "edited_on_accept": {
16399
16361
  "type": "boolean",
@@ -16517,15 +16479,200 @@ const operationManifest = [
16517
16479
  "rule_id"
16518
16480
  ]
16519
16481
  },
16520
- "notice": {
16521
- "description": "What is now shared, in words. When you changed the rule and it can now match mail the request left out by who it was sent to (such as mail where an address is only copied), that comes first.",
16522
- "type": "string"
16482
+ "request": {
16483
+ "type": "object",
16484
+ "properties": {
16485
+ "id": {
16486
+ "type": "string",
16487
+ "format": "uuid"
16488
+ },
16489
+ "status": {
16490
+ "type": "string",
16491
+ "enum": [
16492
+ "pending",
16493
+ "accepted",
16494
+ "declined",
16495
+ "withdrawn"
16496
+ ]
16497
+ },
16498
+ "name": { "type": "string" },
16499
+ "english": { "type": "string" },
16500
+ "tree": {
16501
+ "type": "object",
16502
+ "properties": {
16503
+ "version": {
16504
+ "type": "number",
16505
+ "const": 1
16506
+ },
16507
+ "vocabulary": {
16508
+ "type": "string",
16509
+ "description": "Vocabulary version, such as v1."
16510
+ },
16511
+ "when": {
16512
+ "type": "object",
16513
+ "propertyNames": { "type": "string" },
16514
+ "additionalProperties": {},
16515
+ "description": "A condition {column, op, value?, min_confidence?} (see GET /email-rules/vocabulary) or {all: [...]}, {any: [...]}, {not: ...}."
16516
+ },
16517
+ "questions": {
16518
+ "type": "array",
16519
+ "items": { "type": "string" },
16520
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, never attachment contents. A grant rule needs every one yes; a do_not_share rule matches on any yes."
16521
+ }
16522
+ },
16523
+ "required": [
16524
+ "version",
16525
+ "vocabulary",
16526
+ "when",
16527
+ "questions"
16528
+ ]
16529
+ },
16530
+ "explanation": { "type": "string" },
16531
+ "assumptions": {
16532
+ "type": "array",
16533
+ "items": { "type": "string" }
16534
+ },
16535
+ "warnings": {
16536
+ "type": "array",
16537
+ "items": { "type": "string" },
16538
+ "description": "As the member who asked sent them, normally from their compile, then every compiler note on the rule's tree and words they lack. The compiler's note that the rule matches nearly everything, in its own wording, counted that member's recent mail: anyone else reads it naming them."
16539
+ },
16540
+ "server_explanation": {
16541
+ "description": "What the rule as asked actually does: Primitive's own reading of the request's tree, never the words of the member who asked or of a model. Null when the tree no longer reads as one.",
16542
+ "type": ["string", "null"]
16543
+ },
16544
+ "server_notes": {
16545
+ "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
16546
+ "type": "array",
16547
+ "items": { "type": "string" }
16548
+ },
16549
+ "compiled_by": { "type": "string" },
16550
+ "vocabulary": { "type": "string" },
16551
+ "proposed_via": {
16552
+ "type": "string",
16553
+ "enum": ["session", "oauth"],
16554
+ "description": "session: the proposer's own session; oauth: an OAuth or CLI token acting for them."
16555
+ },
16556
+ "created_at": {
16557
+ "type": "string",
16558
+ "format": "date-time"
16559
+ },
16560
+ "decided_at": {
16561
+ "type": ["string", "null"],
16562
+ "format": "date-time"
16563
+ },
16564
+ "decided_by_user_id": {
16565
+ "type": ["string", "null"],
16566
+ "format": "uuid"
16567
+ },
16568
+ "proposer": {
16569
+ "type": "object",
16570
+ "properties": {
16571
+ "user_id": {
16572
+ "type": "string",
16573
+ "format": "uuid"
16574
+ },
16575
+ "name": { "type": ["string", "null"] },
16576
+ "email": {
16577
+ "description": "Sign-in email; null unless you can list member emails, this is you, or they asked you.",
16578
+ "type": ["string", "null"]
16579
+ },
16580
+ "active": {
16581
+ "type": "boolean",
16582
+ "description": "Still a member under the membership recorded (a request or share with someone who left no longer works)."
16583
+ }
16584
+ },
16585
+ "required": [
16586
+ "user_id",
16587
+ "name",
16588
+ "email",
16589
+ "active"
16590
+ ]
16591
+ },
16592
+ "target": {
16593
+ "type": "object",
16594
+ "properties": {
16595
+ "user_id": {
16596
+ "type": ["string", "null"],
16597
+ "format": "uuid",
16598
+ "description": "Null unless you can list members or this is you."
16599
+ },
16600
+ "name": {
16601
+ "description": "Null unless you can list members or this is you.",
16602
+ "type": ["string", "null"]
16603
+ },
16604
+ "email": {
16605
+ "description": "Sign-in email; null unless you can list member emails or this is you.",
16606
+ "type": ["string", "null"]
16607
+ },
16608
+ "active": {
16609
+ "type": "boolean",
16610
+ "description": "Still a member under the membership recorded (a request or share with someone who left no longer works)."
16611
+ }
16612
+ },
16613
+ "required": [
16614
+ "user_id",
16615
+ "name",
16616
+ "email",
16617
+ "active"
16618
+ ]
16619
+ },
16620
+ "target_address_typed": {
16621
+ "description": "The address the proposer typed to name the target; null for anyone else, and when named by user id.",
16622
+ "type": ["string", "null"]
16623
+ },
16624
+ "is_proposer": { "type": "boolean" },
16625
+ "is_target": { "type": "boolean" },
16626
+ "share_id": {
16627
+ "type": ["string", "null"],
16628
+ "format": "uuid",
16629
+ "description": "The share accepting created, while it exists."
16630
+ },
16631
+ "message": {
16632
+ "description": "What the member asking wrote about why; null when they wrote nothing.",
16633
+ "type": ["string", "null"]
16634
+ },
16635
+ "decline_reason": {
16636
+ "description": "Why the member asked declined it; null unless they gave a reason when declining.",
16637
+ "type": ["string", "null"]
16638
+ },
16639
+ "edited_on_accept": {
16640
+ "description": "Once accepted: whether the rule was changed first, as on the share. Null until then, or when unreadable.",
16641
+ "type": ["boolean", "null"]
16642
+ },
16643
+ "notice": {
16644
+ "description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
16645
+ "type": ["string", "null"]
16646
+ }
16647
+ },
16648
+ "required": [
16649
+ "id",
16650
+ "status",
16651
+ "name",
16652
+ "english",
16653
+ "tree",
16654
+ "explanation",
16655
+ "assumptions",
16656
+ "warnings",
16657
+ "compiled_by",
16658
+ "vocabulary",
16659
+ "proposed_via",
16660
+ "created_at",
16661
+ "decided_at",
16662
+ "decided_by_user_id",
16663
+ "proposer",
16664
+ "target",
16665
+ "target_address_typed",
16666
+ "is_proposer",
16667
+ "is_target",
16668
+ "share_id"
16669
+ ]
16523
16670
  }
16524
16671
  },
16525
16672
  "required": [
16526
- "request",
16527
16673
  "rule",
16528
- "share"
16674
+ "share",
16675
+ "request"
16529
16676
  ]
16530
16677
  },
16531
16678
  "sdkName": "acceptEmailRuleRequest",
@@ -16787,6 +16934,81 @@ const operationManifest = [
16787
16934
  "required": ["checked", "matched"]
16788
16935
  }, { "type": "null" }]
16789
16936
  },
16937
+ "breadth_scope": {
16938
+ "type": "object",
16939
+ "properties": {
16940
+ "evaluation_scope": {
16941
+ "type": "string",
16942
+ "enum": [
16943
+ "author",
16944
+ "own_mailboxes",
16945
+ "selected"
16946
+ ],
16947
+ "description": "author, own_mailboxes or selected, as a rule's evaluation_scope."
16948
+ },
16949
+ "scope_selection": {
16950
+ "type": ["object", "null"],
16951
+ "properties": {
16952
+ "addresses": {
16953
+ "maxItems": 100,
16954
+ "type": "array",
16955
+ "items": {
16956
+ "type": "string",
16957
+ "maxLength": 320
16958
+ }
16959
+ },
16960
+ "domains": {
16961
+ "maxItems": 50,
16962
+ "type": "array",
16963
+ "items": {
16964
+ "type": "string",
16965
+ "maxLength": 253
16966
+ }
16967
+ }
16968
+ },
16969
+ "required": ["addresses", "domains"],
16970
+ "description": "What a selected scope names; null for any other."
16971
+ }
16972
+ },
16973
+ "required": ["evaluation_scope", "scope_selection"]
16974
+ },
16975
+ "scope_warnings": {
16976
+ "description": "Names in the scope_selection sent that match nothing this organization receives mail at (a typo, or an inbox not yet in use), as a test or write would warn of them. Present only when there are some; writes ignore it.",
16977
+ "maxItems": 150,
16978
+ "type": "array",
16979
+ "items": {
16980
+ "type": "object",
16981
+ "properties": {
16982
+ "name": {
16983
+ "type": "string",
16984
+ "maxLength": 320
16985
+ },
16986
+ "kind": {
16987
+ "type": "string",
16988
+ "enum": ["address", "domain"]
16989
+ },
16990
+ "reason": {
16991
+ "type": "string",
16992
+ "enum": [
16993
+ "unknown_domain",
16994
+ "inactive_domain",
16995
+ "unknown_address"
16996
+ ],
16997
+ "description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
16998
+ },
16999
+ "message": {
17000
+ "type": "string",
17001
+ "maxLength": 1e3
17002
+ }
17003
+ },
17004
+ "required": [
17005
+ "name",
17006
+ "kind",
17007
+ "reason",
17008
+ "message"
17009
+ ]
17010
+ }
17011
+ },
16790
17012
  "sql": {
16791
17013
  "description": "Present only when include_sql was true.",
16792
17014
  "type": "object",
@@ -17140,6 +17362,81 @@ const operationManifest = [
17140
17362
  },
17141
17363
  "required": ["checked", "matched"]
17142
17364
  }, { "type": "null" }]
17365
+ },
17366
+ "breadth_scope": {
17367
+ "type": "object",
17368
+ "properties": {
17369
+ "evaluation_scope": {
17370
+ "type": "string",
17371
+ "enum": [
17372
+ "author",
17373
+ "own_mailboxes",
17374
+ "selected"
17375
+ ],
17376
+ "description": "author, own_mailboxes or selected, as a rule's evaluation_scope."
17377
+ },
17378
+ "scope_selection": {
17379
+ "type": ["object", "null"],
17380
+ "properties": {
17381
+ "addresses": {
17382
+ "maxItems": 100,
17383
+ "type": "array",
17384
+ "items": {
17385
+ "type": "string",
17386
+ "maxLength": 320
17387
+ }
17388
+ },
17389
+ "domains": {
17390
+ "maxItems": 50,
17391
+ "type": "array",
17392
+ "items": {
17393
+ "type": "string",
17394
+ "maxLength": 253
17395
+ }
17396
+ }
17397
+ },
17398
+ "required": ["addresses", "domains"],
17399
+ "description": "What a selected scope names; null for any other."
17400
+ }
17401
+ },
17402
+ "required": ["evaluation_scope", "scope_selection"]
17403
+ },
17404
+ "scope_warnings": {
17405
+ "description": "Ignored (the compile answer's scope_warnings).",
17406
+ "maxItems": 150,
17407
+ "type": "array",
17408
+ "items": {
17409
+ "type": "object",
17410
+ "properties": {
17411
+ "name": {
17412
+ "type": "string",
17413
+ "maxLength": 320
17414
+ },
17415
+ "kind": {
17416
+ "type": "string",
17417
+ "enum": ["address", "domain"]
17418
+ },
17419
+ "reason": {
17420
+ "type": "string",
17421
+ "enum": [
17422
+ "unknown_domain",
17423
+ "inactive_domain",
17424
+ "unknown_address"
17425
+ ],
17426
+ "description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
17427
+ },
17428
+ "message": {
17429
+ "type": "string",
17430
+ "maxLength": 1e3
17431
+ }
17432
+ },
17433
+ "required": [
17434
+ "name",
17435
+ "kind",
17436
+ "reason",
17437
+ "message"
17438
+ ]
17439
+ }
17143
17440
  }
17144
17441
  },
17145
17442
  "required": [
@@ -17245,7 +17542,7 @@ const operationManifest = [
17245
17542
  "minimum": 0
17246
17543
  },
17247
17544
  "objection_notice": {
17248
- "description": "With pending_objections above 0: that members asked you to turn it off, and how to answer.",
17545
+ "description": "With pending_objections above 0: that members objected (each message says what they ask: to turn it off, narrow it or explain it), and how to answer.",
17249
17546
  "type": "string"
17250
17547
  },
17251
17548
  "created_at": {
@@ -17346,11 +17643,15 @@ const operationManifest = [
17346
17643
  },
17347
17644
  "scope_warnings": {
17348
17645
  "description": "Names in scope_selection that match nothing this organization receives mail at (a typo, or an inbox not yet in use). Present only when there are some.",
17646
+ "maxItems": 150,
17349
17647
  "type": "array",
17350
17648
  "items": {
17351
17649
  "type": "object",
17352
17650
  "properties": {
17353
- "name": { "type": "string" },
17651
+ "name": {
17652
+ "type": "string",
17653
+ "maxLength": 320
17654
+ },
17354
17655
  "kind": {
17355
17656
  "type": "string",
17356
17657
  "enum": ["address", "domain"]
@@ -17364,7 +17665,10 @@ const operationManifest = [
17364
17665
  ],
17365
17666
  "description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
17366
17667
  },
17367
- "message": { "type": "string" }
17668
+ "message": {
17669
+ "type": "string",
17670
+ "maxLength": 1e3
17671
+ }
17368
17672
  },
17369
17673
  "required": [
17370
17674
  "name",
@@ -17374,6 +17678,10 @@ const operationManifest = [
17374
17678
  ]
17375
17679
  }
17376
17680
  },
17681
+ "do_not_share_note": {
17682
+ "description": "On a grant rule's create answer: that active do-not-share rules reaching an email run first: one that matches it keeps it from being shared through this rule, and one that cannot decide it holds it back while it is decided again for up to a day; it is shared through this rule only if none of them then matches it.",
17683
+ "type": "string"
17684
+ },
17377
17685
  "expectations": {
17378
17686
  "description": "Its saved expectations, each list by email id, as stored: on every create, and on an update that set or removed them.",
17379
17687
  "type": "object",
@@ -17550,13 +17858,43 @@ const operationManifest = [
17550
17858
  }
17551
17859
  },
17552
17860
  "undecided_samples": {
17553
- "description": "Made-up emails not decided, by index. Only a write sent with if_expectations_pass that saves a version or activates the rule judges them.",
17861
+ "description": "Made-up emails not decided, by index. Only a write that saves a version or activates the rule, sent with if_expectations_pass or judged by default, judges them.",
17554
17862
  "type": "array",
17555
17863
  "items": {
17556
17864
  "type": "integer",
17557
17865
  "minimum": 0
17558
17866
  }
17559
17867
  },
17868
+ "failed_sample_details": {
17869
+ "description": "failed_samples with each one's label, from a write that judged them before saving (if_expectations_pass, or by default).",
17870
+ "type": "array",
17871
+ "items": {
17872
+ "type": "object",
17873
+ "properties": {
17874
+ "index": {
17875
+ "type": "integer",
17876
+ "minimum": 0
17877
+ },
17878
+ "label": { "type": ["string", "null"] }
17879
+ },
17880
+ "required": ["index", "label"]
17881
+ }
17882
+ },
17883
+ "undecided_sample_details": {
17884
+ "description": "undecided_samples with each one's label, as failed_sample_details.",
17885
+ "type": "array",
17886
+ "items": {
17887
+ "type": "object",
17888
+ "properties": {
17889
+ "index": {
17890
+ "type": "integer",
17891
+ "minimum": 0
17892
+ },
17893
+ "label": { "type": ["string", "null"] }
17894
+ },
17895
+ "required": ["index", "label"]
17896
+ }
17897
+ },
17560
17898
  "note": {
17561
17899
  "description": "On an update that saved a version that did not pass, or a do_not_share rule created active: that it was saved anyway, is current, and whether it is live.",
17562
17900
  "type": "string"
@@ -17582,7 +17920,7 @@ const operationManifest = [
17582
17920
  "required": ["version", "note"]
17583
17921
  },
17584
17922
  "affects": {
17585
- "description": "After an update that saved a version: API keys listing the rule, the webhooks they own, and shares this write ended. The rule keeps its state. Absent if not read.",
17923
+ "description": "After an update that saved a version, or turned a grant rule active: API keys listing the rule and the webhooks they own, which read and receive what a grant rule grants from now on. shares_ended is always 0: a new version keeps the rule's share (share_notice says so). Saving a version does not by itself change the rule's state. Absent after any other write, and if not read.",
17586
17924
  "type": "object",
17587
17925
  "properties": {
17588
17926
  "keys": {
@@ -17605,11 +17943,11 @@ const operationManifest = [
17605
17943
  ]
17606
17944
  },
17607
17945
  "notice": {
17608
- "description": "After a write that saved a version of an active rule keys or webhooks read without checking it first: what it changes, and how to have the next one checked.",
17946
+ "description": "After a write that saved a version of an active rule keys, webhooks or a share read without checking it first: what it changes, and how to have the next one checked.",
17609
17947
  "type": "string"
17610
17948
  },
17611
17949
  "share_notice": {
17612
- "description": "After a write that ended the rule's share: that it did, given even when affects is not, with whom it was with and the version they accepted when those can be read.",
17950
+ "description": "After a write that saved a version of a rule with a live share: that the share goes on under it, given even when affects is not, with whom it is and the version they accepted when those can be read.",
17613
17951
  "type": "string"
17614
17952
  }
17615
17953
  },
@@ -17634,7 +17972,7 @@ const operationManifest = [
17634
17972
  "binaryResponse": false,
17635
17973
  "bodyRequired": true,
17636
17974
  "command": "create-email-rule-request",
17637
- "description": "Asks another member of the organization for a rule over their own mail, from a compile response or a tree you wrote. Name them by user id, or by their member mailbox address, or by their verified work email if you can list members (at most 30 lookups by address an hour). Nothing is evaluated or shared until they accept, and they may change the rule first. A message (up to 500 characters, fixed once sent) tells them why you ask. At most 5 pending requests to one member and 50 in all. With members:read the answer says whether they can accept it under their role (target_can_accept, target_warning); POST /v1/email-rule-requests/target-check checks first. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
17975
+ "description": "Asks another member of the organization for a rule over their own mail, from a compile response or a tree you wrote. Name them by user id, or by their member mailbox address, or by their verified work email if you can list members (at most 30 lookups by address an hour). Nothing is evaluated or shared until they accept, and they may change the rule first. A message (up to 500 characters, fixed once sent) tells them why you ask. With an Idempotency-Key, asking again for exactly what a pending request of yours to the same member asks (name, english, tree, explanation and message, naming them the same way) returns that request with existing: true (200), so a retry never asks them twice. At most 5 pending requests to one member and 50 in all. With members:read the answer says whether they can accept it under their role (target_can_accept, target_warning); POST /v1/email-rule-requests/target-check checks first. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
17638
17976
  "hasJsonBody": true,
17639
17977
  "method": "POST",
17640
17978
  "operationId": "createEmailRuleRequest",
@@ -17642,7 +17980,7 @@ const operationManifest = [
17642
17980
  "pathParams": [],
17643
17981
  "queryParams": [],
17644
17982
  "headerParams": [{
17645
- "description": "Optional, and not used to deduplicate: this operation stores no result by the key, so a retry with the same key runs the request again. Operations that need a credential refuse a key that is empty, longer than 255 characters or not printable ASCII with 400 `validation_error` and echo a valid one in the Idempotency-Key response header; operations that need none ignore it.",
17983
+ "description": "Optional. With a key, a create identical to a pending request of yours to the same member (name, english, tree, explanation and message, naming the member the same way) returns that request with existing: true (200) instead of making a second one. The key itself is not stored, so any key does this, and a create without one is never matched to an existing request. A key that is empty, longer than 255 characters or not printable ASCII is refused with 400 `validation_error`; a valid one is echoed in the Idempotency-Key response header.",
17646
17984
  "enum": null,
17647
17985
  "name": "Idempotency-Key",
17648
17986
  "required": false,
@@ -17783,6 +18121,81 @@ const operationManifest = [
17783
18121
  "required": ["checked", "matched"]
17784
18122
  }, { "type": "null" }]
17785
18123
  },
18124
+ "breadth_scope": {
18125
+ "type": "object",
18126
+ "properties": {
18127
+ "evaluation_scope": {
18128
+ "type": "string",
18129
+ "enum": [
18130
+ "author",
18131
+ "own_mailboxes",
18132
+ "selected"
18133
+ ],
18134
+ "description": "author, own_mailboxes or selected, as a rule's evaluation_scope."
18135
+ },
18136
+ "scope_selection": {
18137
+ "type": ["object", "null"],
18138
+ "properties": {
18139
+ "addresses": {
18140
+ "maxItems": 100,
18141
+ "type": "array",
18142
+ "items": {
18143
+ "type": "string",
18144
+ "maxLength": 320
18145
+ }
18146
+ },
18147
+ "domains": {
18148
+ "maxItems": 50,
18149
+ "type": "array",
18150
+ "items": {
18151
+ "type": "string",
18152
+ "maxLength": 253
18153
+ }
18154
+ }
18155
+ },
18156
+ "required": ["addresses", "domains"],
18157
+ "description": "What a selected scope names; null for any other."
18158
+ }
18159
+ },
18160
+ "required": ["evaluation_scope", "scope_selection"]
18161
+ },
18162
+ "scope_warnings": {
18163
+ "description": "Ignored (the compile answer's scope_warnings).",
18164
+ "maxItems": 150,
18165
+ "type": "array",
18166
+ "items": {
18167
+ "type": "object",
18168
+ "properties": {
18169
+ "name": {
18170
+ "type": "string",
18171
+ "maxLength": 320
18172
+ },
18173
+ "kind": {
18174
+ "type": "string",
18175
+ "enum": ["address", "domain"]
18176
+ },
18177
+ "reason": {
18178
+ "type": "string",
18179
+ "enum": [
18180
+ "unknown_domain",
18181
+ "inactive_domain",
18182
+ "unknown_address"
18183
+ ],
18184
+ "description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
18185
+ },
18186
+ "message": {
18187
+ "type": "string",
18188
+ "maxLength": 1e3
18189
+ }
18190
+ },
18191
+ "required": [
18192
+ "name",
18193
+ "kind",
18194
+ "reason",
18195
+ "message"
18196
+ ]
18197
+ }
18198
+ },
17786
18199
  "kind": {
17787
18200
  "description": "Only grant.",
17788
18201
  "type": "string",
@@ -17859,7 +18272,7 @@ const operationManifest = [
17859
18272
  "type": ["string", "null"]
17860
18273
  },
17861
18274
  "server_notes": {
17862
- "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
18275
+ "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
17863
18276
  "type": "array",
17864
18277
  "items": { "type": "string" }
17865
18278
  },
@@ -17958,7 +18371,7 @@ const operationManifest = [
17958
18371
  "type": ["boolean", "null"]
17959
18372
  },
17960
18373
  "notice": {
17961
- "description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, then what accepting would share. For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
18374
+ "description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
17962
18375
  "type": ["string", "null"]
17963
18376
  },
17964
18377
  "target_can_accept": {
@@ -17968,6 +18381,11 @@ const operationManifest = [
17968
18381
  "target_warning": {
17969
18382
  "description": "Why the member asked cannot accept it yet, naming the permission their role lacks. The request is still sent. Null when they can, or when target_can_accept is null.",
17970
18383
  "type": ["string", "null"]
18384
+ },
18385
+ "existing": {
18386
+ "description": "Present, as true, when the create carried an Idempotency-Key and you already had a pending request to this member asking exactly this (name, english, tree, explanation and message, naming the member the same way): that request is returned (200), and no second one is made or sent.",
18387
+ "type": "boolean",
18388
+ "const": true
17971
18389
  }
17972
18390
  },
17973
18391
  "required": [
@@ -18097,7 +18515,7 @@ const operationManifest = [
18097
18515
  "type": ["string", "null"]
18098
18516
  },
18099
18517
  "server_notes": {
18100
- "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
18518
+ "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
18101
18519
  "type": "array",
18102
18520
  "items": { "type": "string" }
18103
18521
  },
@@ -18196,7 +18614,7 @@ const operationManifest = [
18196
18614
  "type": ["boolean", "null"]
18197
18615
  },
18198
18616
  "notice": {
18199
- "description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, then what accepting would share. For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
18617
+ "description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
18200
18618
  "type": ["string", "null"]
18201
18619
  }
18202
18620
  },
@@ -18470,7 +18888,7 @@ const operationManifest = [
18470
18888
  "format": "uuid"
18471
18889
  },
18472
18890
  "kind": {
18473
- "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule uses its own.",
18891
+ "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule or a request uses its own.",
18474
18892
  "type": "string",
18475
18893
  "enum": ["grant", "do_not_share"]
18476
18894
  },
@@ -18821,7 +19239,7 @@ const operationManifest = [
18821
19239
  "minimum": 0
18822
19240
  },
18823
19241
  "objection_notice": {
18824
- "description": "With pending_objections above 0: that members asked you to turn it off, and how to answer.",
19242
+ "description": "With pending_objections above 0: that members objected (each message says what they ask: to turn it off, narrow it or explain it), and how to answer.",
18825
19243
  "type": "string"
18826
19244
  },
18827
19245
  "created_at": {
@@ -19159,7 +19577,7 @@ const operationManifest = [
19159
19577
  "type": ["string", "null"]
19160
19578
  },
19161
19579
  "server_notes": {
19162
- "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
19580
+ "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
19163
19581
  "type": "array",
19164
19582
  "items": { "type": "string" }
19165
19583
  },
@@ -19258,7 +19676,7 @@ const operationManifest = [
19258
19676
  "type": ["boolean", "null"]
19259
19677
  },
19260
19678
  "notice": {
19261
- "description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, then what accepting would share. For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
19679
+ "description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
19262
19680
  "type": ["string", "null"]
19263
19681
  }
19264
19682
  },
@@ -19376,11 +19794,15 @@ const operationManifest = [
19376
19794
  },
19377
19795
  "scope_warnings": {
19378
19796
  "description": "Names in scope_selection that match nothing this organization receives mail at (a typo, or an inbox not yet in use). Present only when there are some.",
19797
+ "maxItems": 150,
19379
19798
  "type": "array",
19380
19799
  "items": {
19381
19800
  "type": "object",
19382
19801
  "properties": {
19383
- "name": { "type": "string" },
19802
+ "name": {
19803
+ "type": "string",
19804
+ "maxLength": 320
19805
+ },
19384
19806
  "kind": {
19385
19807
  "type": "string",
19386
19808
  "enum": ["address", "domain"]
@@ -19394,7 +19816,10 @@ const operationManifest = [
19394
19816
  ],
19395
19817
  "description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
19396
19818
  },
19397
- "message": { "type": "string" }
19819
+ "message": {
19820
+ "type": "string",
19821
+ "maxLength": 1e3
19822
+ }
19398
19823
  },
19399
19824
  "required": [
19400
19825
  "name",
@@ -19473,11 +19898,11 @@ const operationManifest = [
19473
19898
  "rule_deleted",
19474
19899
  null
19475
19900
  ],
19476
- "description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
19901
+ "description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved, on a share that ended before new versions kept shares) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
19477
19902
  },
19478
19903
  "accepted_rule_version": {
19479
19904
  "type": "integer",
19480
- "description": "The version of the rule that was accepted. A new version of the rule ends the share."
19905
+ "description": "The version of the rule that was accepted. A later version keeps the share: what each version matches is shared from when it is saved."
19481
19906
  },
19482
19907
  "edited_on_accept": {
19483
19908
  "type": "boolean",
@@ -20058,7 +20483,7 @@ const operationManifest = [
20058
20483
  "type": ["string", "null"]
20059
20484
  },
20060
20485
  "server_notes": {
20061
- "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
20486
+ "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
20062
20487
  "type": "array",
20063
20488
  "items": { "type": "string" }
20064
20489
  },
@@ -20157,7 +20582,7 @@ const operationManifest = [
20157
20582
  "type": ["boolean", "null"]
20158
20583
  },
20159
20584
  "notice": {
20160
- "description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, then what accepting would share. For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
20585
+ "description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
20161
20586
  "type": ["string", "null"]
20162
20587
  }
20163
20588
  },
@@ -20194,7 +20619,7 @@ const operationManifest = [
20194
20619
  "binaryResponse": false,
20195
20620
  "bodyRequired": false,
20196
20621
  "command": "list-email-rule-results",
20197
- "description": "What each rule you can see decided about this email (matched, not matched, or not run), in the words of the deciding version. A do_not_share rule that matched it blocks sharing while active; earlier shares stay. Only a caller who can read the email gets an answer. classification is every fact the classifier read, as rule conditions read it. At most 50 rules are listed, results first; not_listed counts the rest. Another member's rule that decided on your own mail is listed read_only (dashboard and CLI only), with who receives what it shares (receivers) while it covers you; hidden counts deciding rules you cannot see. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
20622
+ "description": "What each rule you can see decided about this email (matched, not matched, or not run), in the words of the deciding version. A do_not_share rule that matched it blocks sharing while active; earlier shares stay. Only a caller who can read the email gets an answer. classification is every fact the classifier read, as rule conditions read it. At most 50 rules are listed, results first; not_listed counts the rest. Another member's rule that decided on your own mail is listed read_only (dashboard and CLI only), with who receives what it shares (receivers) while it covers you; hidden counts deciding rules you cannot see. Whether a rule delivered the email by webhook is not in the rule results: on your own mail, rule_deliveries on GET /v1/emails/{id} (primitive emails get <email-id> --json) counts each rule's webhook deliveries; on another member's mail, GET /v1/webhooks/deliveries?email_id=<email-id> (primitive webhook-deliveries list --email-id <email-id>, with webhooks:read) lists them. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
20198
20623
  "hasJsonBody": false,
20199
20624
  "method": "GET",
20200
20625
  "operationId": "listEmailRuleResults",
@@ -20412,9 +20837,10 @@ const operationManifest = [
20412
20837
  "enum": [
20413
20838
  "draft",
20414
20839
  "created_after_email",
20840
+ "outside_scope",
20415
20841
  null
20416
20842
  ],
20417
- "description": "What is known about a rule with no result on this email. draft: the rule is a draft now. created_after_email: the rule was created after the email arrived. Null when it has a result, or when nothing is known."
20843
+ "description": "What is known about a rule with no result on this email. draft: the rule is a draft now. created_after_email: the rule was created after the email arrived. outside_scope: the mailbox this email is in is outside what its scope names (its author's own mailboxes, its selection, or all its author reads now), so it does not decide on it. Null when it has a result, or when nothing is known (it may not have decided yet)."
20418
20844
  },
20419
20845
  "author_left": {
20420
20846
  "description": "On a do-not-share rule whose author is no longer a member of the organization: it blocks nothing now, whatever it decided. Absent otherwise.",
@@ -20494,7 +20920,7 @@ const operationManifest = [
20494
20920
  "exclusiveMinimum": 0
20495
20921
  },
20496
20922
  "reads_in_full": {
20497
- "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches.",
20923
+ "description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches. It counts what they can read, not whether any has read an email.",
20498
20924
  "type": "integer",
20499
20925
  "minimum": 0
20500
20926
  },
@@ -21199,11 +21625,11 @@ const operationManifest = [
21199
21625
  "rule_deleted",
21200
21626
  null
21201
21627
  ],
21202
- "description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
21628
+ "description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved, on a share that ended before new versions kept shares) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
21203
21629
  },
21204
21630
  "accepted_rule_version": {
21205
21631
  "type": "integer",
21206
- "description": "The version of the rule that was accepted. A new version of the rule ends the share."
21632
+ "description": "The version of the rule that was accepted. A later version keeps the share: what each version matches is shared from when it is saved."
21207
21633
  },
21208
21634
  "edited_on_accept": {
21209
21635
  "type": "boolean",
@@ -21609,7 +22035,7 @@ const operationManifest = [
21609
22035
  "minimum": 0
21610
22036
  },
21611
22037
  "objection_notice": {
21612
- "description": "With pending_objections above 0: that members asked you to turn it off, and how to answer.",
22038
+ "description": "With pending_objections above 0: that members objected (each message says what they ask: to turn it off, narrow it or explain it), and how to answer.",
21613
22039
  "type": "string"
21614
22040
  },
21615
22041
  "created_at": {
@@ -21714,11 +22140,11 @@ const operationManifest = [
21714
22140
  "rule_deleted",
21715
22141
  null
21716
22142
  ],
21717
- "description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
22143
+ "description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved, on a share that ended before new versions kept shares) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
21718
22144
  },
21719
22145
  "accepted_rule_version": {
21720
22146
  "type": "integer",
21721
- "description": "The version of the rule that was accepted. A new version of the rule ends the share."
22147
+ "description": "The version of the rule that was accepted. A later version keeps the share: what each version matches is shared from when it is saved."
21722
22148
  },
21723
22149
  "edited_on_accept": {
21724
22150
  "type": "boolean",
@@ -21852,7 +22278,7 @@ const operationManifest = [
21852
22278
  "binaryResponse": false,
21853
22279
  "bodyRequired": true,
21854
22280
  "command": "test-email-rule",
21855
- "description": "Runs a rule over received mail and reports what it would decide for each email (matched, near_miss, no_match, unclassified, skipped or not_found), with a summary of how each top-level condition and question decided. Test an unsaved tree, or a saved rule by rule_id (its current version, as its author). It reads only mail its author can read and its scope covers. A rule you see only because it covers your own mailboxes runs as you, over only those, from the dashboard or the Primitive CLI. Without email_ids it tests the newest emails, at most 200 and none older than 30 days, plus any expected ones. Unclassified emails over 2 hours old are classified first unless classify_missing is false. It records no decision and grants nothing, and stops at about 90 seconds. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
22281
+ "description": "Runs a rule over received mail and reports what it would decide for each email (matched, near_miss, no_match, unclassified, skipped or not_found), with a summary of how each top-level condition and question decided. Test an unsaved tree, a saved rule by rule_id (its current version, as its author), or a pending rule request by request_id (its rule as asked, as you, over your own mailboxes). It reads only mail its author can read and its scope covers. A rule you see only because it covers your own mailboxes runs as you, over only those, from the dashboard or the Primitive CLI. Without email_ids it tests the newest emails, at most 200 and none older than 30 days, plus any expected ones. Unclassified emails over 2 hours old are classified first unless classify_missing is false. It records no decision and grants nothing, and stops at about 90 seconds. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
21856
22282
  "hasJsonBody": true,
21857
22283
  "method": "POST",
21858
22284
  "operationId": "testEmailRule",
@@ -21942,8 +22368,13 @@ const operationManifest = [
21942
22368
  "type": "string",
21943
22369
  "format": "uuid"
21944
22370
  },
22371
+ "request_id": {
22372
+ "description": "A pending rule request you can see: its rule as asked, tested as you over your own mailboxes (what accepting would share, for the member asked). Give one of tree, rule_id and request_id.",
22373
+ "type": "string",
22374
+ "format": "uuid"
22375
+ },
21945
22376
  "kind": {
21946
- "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule uses its own.",
22377
+ "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule or a request uses its own.",
21947
22378
  "type": "string",
21948
22379
  "enum": ["grant", "do_not_share"]
21949
22380
  },
@@ -22148,6 +22579,54 @@ const operationManifest = [
22148
22579
  "type": "integer",
22149
22580
  "minimum": 0,
22150
22581
  "description": "The most emails the recent window holds: 200, less one place per expected email."
22582
+ },
22583
+ "scope": {
22584
+ "type": "object",
22585
+ "properties": {
22586
+ "evaluation_scope": {
22587
+ "type": "string",
22588
+ "enum": [
22589
+ "author",
22590
+ "own_mailboxes",
22591
+ "selected"
22592
+ ],
22593
+ "description": "author, own_mailboxes or selected, as a rule's evaluation_scope."
22594
+ },
22595
+ "scope_selection": {
22596
+ "type": ["object", "null"],
22597
+ "properties": {
22598
+ "addresses": {
22599
+ "maxItems": 100,
22600
+ "type": "array",
22601
+ "items": {
22602
+ "type": "string",
22603
+ "maxLength": 320
22604
+ }
22605
+ },
22606
+ "domains": {
22607
+ "maxItems": 50,
22608
+ "type": "array",
22609
+ "items": {
22610
+ "type": "string",
22611
+ "maxLength": 253
22612
+ }
22613
+ }
22614
+ },
22615
+ "required": ["addresses", "domains"],
22616
+ "description": "What a selected scope names; null for any other."
22617
+ }
22618
+ },
22619
+ "required": ["evaluation_scope", "scope_selection"]
22620
+ },
22621
+ "oldest_at": {
22622
+ "type": ["string", "null"],
22623
+ "format": "date-time",
22624
+ "description": "When the oldest email tested arrived, expected ones included; null when none was. The window is the newest 200 the scope reaches, so a narrower scope reaches further back: compare counts only over the same scope and span."
22625
+ },
22626
+ "newest_at": {
22627
+ "type": ["string", "null"],
22628
+ "format": "date-time",
22629
+ "description": "When the newest email tested arrived; null when none was."
22151
22630
  }
22152
22631
  },
22153
22632
  "required": [
@@ -22264,6 +22743,11 @@ const operationManifest = [
22264
22743
  "type": "string"
22265
22744
  },
22266
22745
  "subject": { "type": ["string", "null"] },
22746
+ "attachment_names": {
22747
+ "description": "On matched and near_miss: the file names the email lists, in order, at most 10 (the names its questions are given; never what is in the files). Parts with no name are left out; absent when there are none.",
22748
+ "type": "array",
22749
+ "items": { "type": "string" }
22750
+ },
22267
22751
  "parts": {
22268
22752
  "description": "How each top-level part of the rule decided. Present for matched, near_miss and no_match.",
22269
22753
  "type": "array",
@@ -22463,11 +22947,15 @@ const operationManifest = [
22463
22947
  },
22464
22948
  "scope_warnings": {
22465
22949
  "description": "Names in scope_selection that match nothing this organization receives mail at (a typo, or an inbox not yet in use). Present only when there are some.",
22950
+ "maxItems": 150,
22466
22951
  "type": "array",
22467
22952
  "items": {
22468
22953
  "type": "object",
22469
22954
  "properties": {
22470
- "name": { "type": "string" },
22955
+ "name": {
22956
+ "type": "string",
22957
+ "maxLength": 320
22958
+ },
22471
22959
  "kind": {
22472
22960
  "type": "string",
22473
22961
  "enum": ["address", "domain"]
@@ -22481,7 +22969,10 @@ const operationManifest = [
22481
22969
  ],
22482
22970
  "description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
22483
22971
  },
22484
- "message": { "type": "string" }
22972
+ "message": {
22973
+ "type": "string",
22974
+ "maxLength": 1e3
22975
+ }
22485
22976
  },
22486
22977
  "required": [
22487
22978
  "name",
@@ -22654,7 +23145,7 @@ const operationManifest = [
22654
23145
  "binaryResponse": false,
22655
23146
  "bodyRequired": true,
22656
23147
  "command": "test-email-rule-on-sample",
22657
- "description": "Reports what a rule would decide for an email you describe (sender, recipients, subject, plain text, attachment types and file names; optionally automated, from a mailing list, and a spam score), classified and decided as received mail would be. A rule reading a spam score you gave none for decides on none (unset_columns). Nothing is stored. Test an unsaved tree or a saved rule by rule_id. The answer includes what the classifier read. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
23148
+ "description": "Reports what a rule would decide for an email you describe (sender, recipients, subject, plain text, attachment types and file names; optionally automated, from a mailing list, and a spam score), classified and decided as received mail would be. A rule reading a spam score you gave none for decides on none (unset_columns). Nothing is stored. Test an unsaved tree, a saved rule by rule_id, or a pending rule request by request_id (its rule as asked, as you). The answer includes what the classifier read. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
22658
23149
  "hasJsonBody": true,
22659
23150
  "method": "POST",
22660
23151
  "operationId": "testEmailRuleOnSample",
@@ -22744,8 +23235,13 @@ const operationManifest = [
22744
23235
  "type": "string",
22745
23236
  "format": "uuid"
22746
23237
  },
23238
+ "request_id": {
23239
+ "description": "A pending rule request you can see: its rule as asked, tested as you over your own mailboxes (what accepting would share, for the member asked). Give one of tree, rule_id and request_id.",
23240
+ "type": "string",
23241
+ "format": "uuid"
23242
+ },
22747
23243
  "kind": {
22748
- "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule uses its own.",
23244
+ "description": "For an unsaved tree: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. A saved rule or a request uses its own.",
22749
23245
  "type": "string",
22750
23246
  "enum": ["grant", "do_not_share"]
22751
23247
  },
@@ -22844,6 +23340,10 @@ const operationManifest = [
22844
23340
  ],
22845
23341
  "additionalProperties": false,
22846
23342
  "description": "A made-up received email. Nothing about it is stored."
23343
+ },
23344
+ "with_protection": {
23345
+ "description": "With true, a grant rule that matches is also judged against the active do-not-share rules over the first recipient's mailbox, which you must read in full and the rule must run over; see protection. Limited to 20 an hour per member.",
23346
+ "type": "boolean"
22847
23347
  }
22848
23348
  },
22849
23349
  "required": ["email"],
@@ -23000,6 +23500,59 @@ const operationManifest = [
23000
23500
  "required": ["value", "confidence"]
23001
23501
  },
23002
23502
  "description": "What the classifier read from the email, by fact: its value and confidence."
23503
+ },
23504
+ "protection": {
23505
+ "description": "With with_protection: whether a match would be shared. Nothing is stored.",
23506
+ "type": "object",
23507
+ "properties": {
23508
+ "mailbox": {
23509
+ "type": "string",
23510
+ "description": "The mailbox judged: the first recipient."
23511
+ },
23512
+ "outcome": {
23513
+ "type": "string",
23514
+ "enum": [
23515
+ "shared",
23516
+ "withheld",
23517
+ "not_matched"
23518
+ ],
23519
+ "description": "not_matched: the rule did not match, so nothing would be shared and no do-not-share rule was judged."
23520
+ },
23521
+ "withheld_by": {
23522
+ "type": "array",
23523
+ "items": {
23524
+ "type": "object",
23525
+ "properties": {
23526
+ "id": {
23527
+ "type": "string",
23528
+ "format": "uuid"
23529
+ },
23530
+ "name": { "type": "string" },
23531
+ "reason": {
23532
+ "type": "string",
23533
+ "enum": ["matched", "undecided"]
23534
+ }
23535
+ },
23536
+ "required": [
23537
+ "id",
23538
+ "name",
23539
+ "reason"
23540
+ ]
23541
+ },
23542
+ "description": "Do-not-share rules you can see that would keep it from being shared. undecided: left undecided as real mail would leave it, or not reached by this test (past 50 rules, 10 rules' questions, or the time limit); it is held back either way."
23543
+ },
23544
+ "withheld_by_hidden": {
23545
+ "type": "integer",
23546
+ "minimum": 0,
23547
+ "description": "Rules you cannot see that would."
23548
+ }
23549
+ },
23550
+ "required": [
23551
+ "mailbox",
23552
+ "outcome",
23553
+ "withheld_by",
23554
+ "withheld_by_hidden"
23555
+ ]
23003
23556
  }
23004
23557
  },
23005
23558
  "required": [
@@ -23021,7 +23574,7 @@ const operationManifest = [
23021
23574
  "binaryResponse": false,
23022
23575
  "bodyRequired": true,
23023
23576
  "command": "update-email-rule",
23024
- "description": "Renames the rule, saves a new version (english and tree together; earlier versions stay) or restores one (restore_version), changes its state (draft is off; observe; active), its scope (evaluation_scope, with scope_selection when selected) or its saved expectations (judged in expectations_check). Anyone but its author who sees it may only set state draft, and while it is shared only if they manage members from the dashboard. A scope change saves a new version; a shared rule keeps its scope, and a kind never changes. A saved version takes effect at once. if_version refuses a write once a version was saved since you read it; if_revision, once anything changed. Without if_expectations_pass a version is saved even when its expectations fail, except on an active rule keys or webhooks read: that write is checked first unless if_expectations_pass is false. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
23577
+ "description": "Renames the rule, saves a new version (english and tree together; earlier versions stay) or restores one (restore_version), changes its state (draft is off; observe; active), its scope (evaluation_scope, with scope_selection when selected) or its saved expectations (judged in expectations_check). Anyone but its author who sees it may only set state draft, and while it is shared only if they manage members from the dashboard. A scope change saves a new version; a shared rule keeps its scope, and a kind never changes. A saved version takes effect at once, on the rule's share too, which goes on under it. if_version refuses a write once a version was saved since you read it; if_revision, once anything changed. Without if_expectations_pass a version is saved even when its expectations fail, except on an active rule keys, webhooks or a share read: that write is checked first unless if_expectations_pass is false. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
23025
23578
  "hasJsonBody": true,
23026
23579
  "method": "PATCH",
23027
23580
  "operationId": "updateEmailRule",
@@ -23161,6 +23714,81 @@ const operationManifest = [
23161
23714
  "required": ["checked", "matched"]
23162
23715
  }, { "type": "null" }]
23163
23716
  },
23717
+ "breadth_scope": {
23718
+ "type": "object",
23719
+ "properties": {
23720
+ "evaluation_scope": {
23721
+ "type": "string",
23722
+ "enum": [
23723
+ "author",
23724
+ "own_mailboxes",
23725
+ "selected"
23726
+ ],
23727
+ "description": "author, own_mailboxes or selected, as a rule's evaluation_scope."
23728
+ },
23729
+ "scope_selection": {
23730
+ "type": ["object", "null"],
23731
+ "properties": {
23732
+ "addresses": {
23733
+ "maxItems": 100,
23734
+ "type": "array",
23735
+ "items": {
23736
+ "type": "string",
23737
+ "maxLength": 320
23738
+ }
23739
+ },
23740
+ "domains": {
23741
+ "maxItems": 50,
23742
+ "type": "array",
23743
+ "items": {
23744
+ "type": "string",
23745
+ "maxLength": 253
23746
+ }
23747
+ }
23748
+ },
23749
+ "required": ["addresses", "domains"],
23750
+ "description": "What a selected scope names; null for any other."
23751
+ }
23752
+ },
23753
+ "required": ["evaluation_scope", "scope_selection"]
23754
+ },
23755
+ "scope_warnings": {
23756
+ "description": "Ignored (the compile answer's scope_warnings).",
23757
+ "maxItems": 150,
23758
+ "type": "array",
23759
+ "items": {
23760
+ "type": "object",
23761
+ "properties": {
23762
+ "name": {
23763
+ "type": "string",
23764
+ "maxLength": 320
23765
+ },
23766
+ "kind": {
23767
+ "type": "string",
23768
+ "enum": ["address", "domain"]
23769
+ },
23770
+ "reason": {
23771
+ "type": "string",
23772
+ "enum": [
23773
+ "unknown_domain",
23774
+ "inactive_domain",
23775
+ "unknown_address"
23776
+ ],
23777
+ "description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
23778
+ },
23779
+ "message": {
23780
+ "type": "string",
23781
+ "maxLength": 1e3
23782
+ }
23783
+ },
23784
+ "required": [
23785
+ "name",
23786
+ "kind",
23787
+ "reason",
23788
+ "message"
23789
+ ]
23790
+ }
23791
+ },
23164
23792
  "kind": {
23165
23793
  "description": "Must be the rule's own (400 kind_mismatch).",
23166
23794
  "type": "string",
@@ -23468,7 +24096,7 @@ const operationManifest = [
23468
24096
  "maximum": 2147483647
23469
24097
  },
23470
24098
  "if_expectations_pass": {
23471
- "description": "true: judge the rule as this write leaves it (new tree, restored version, new scope, or the version it activates) against the expectations it leaves, as POST /email-rules/test would, before saving; it can take as long as a test. Failed: 409 expectations_failed; on emails the rule cannot read: 409 expectations_unreadable; undecided: 409 expectations_undecided (each with details.expectations_check); none to judge: 400 no_expectations. Refused writes save nothing; a pass saves unless the rule moved meanwhile (409 email_rule_conflict). Only writes that save a version or activate the rule are judged. Omitted: judged as with true when the write saves a version or changes the scope of an active rule that API keys or webhooks read and that has expectations. false: never judged first.",
24099
+ "description": "true: judge the rule as this write leaves it (new tree, restored version, new scope, or the version it activates) against the expectations it leaves, as POST /email-rules/test would, before saving; it can take as long as a test. Failed: 409 expectations_failed; on emails the rule cannot read: 409 expectations_unreadable; undecided: 409 expectations_undecided (each with details.expectations_check); none to judge: 400 no_expectations. Refused writes save nothing; a pass saves unless the rule moved meanwhile (409 email_rule_conflict). Only writes that save a version or activate the rule are judged. Omitted: judged as with true when the write saves a version or changes the scope of an active rule that API keys, webhooks or a share read and that has expectations. false: never judged first.",
23472
24100
  "type": "boolean"
23473
24101
  },
23474
24102
  "restore_version": {
@@ -23576,7 +24204,7 @@ const operationManifest = [
23576
24204
  "minimum": 0
23577
24205
  },
23578
24206
  "objection_notice": {
23579
- "description": "With pending_objections above 0: that members asked you to turn it off, and how to answer.",
24207
+ "description": "With pending_objections above 0: that members objected (each message says what they ask: to turn it off, narrow it or explain it), and how to answer.",
23580
24208
  "type": "string"
23581
24209
  },
23582
24210
  "created_at": {
@@ -23677,11 +24305,15 @@ const operationManifest = [
23677
24305
  },
23678
24306
  "scope_warnings": {
23679
24307
  "description": "Names in scope_selection that match nothing this organization receives mail at (a typo, or an inbox not yet in use). Present only when there are some.",
24308
+ "maxItems": 150,
23680
24309
  "type": "array",
23681
24310
  "items": {
23682
24311
  "type": "object",
23683
24312
  "properties": {
23684
- "name": { "type": "string" },
24313
+ "name": {
24314
+ "type": "string",
24315
+ "maxLength": 320
24316
+ },
23685
24317
  "kind": {
23686
24318
  "type": "string",
23687
24319
  "enum": ["address", "domain"]
@@ -23695,7 +24327,10 @@ const operationManifest = [
23695
24327
  ],
23696
24328
  "description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
23697
24329
  },
23698
- "message": { "type": "string" }
24330
+ "message": {
24331
+ "type": "string",
24332
+ "maxLength": 1e3
24333
+ }
23699
24334
  },
23700
24335
  "required": [
23701
24336
  "name",
@@ -23705,6 +24340,10 @@ const operationManifest = [
23705
24340
  ]
23706
24341
  }
23707
24342
  },
24343
+ "do_not_share_note": {
24344
+ "description": "On a grant rule's create answer: that active do-not-share rules reaching an email run first: one that matches it keeps it from being shared through this rule, and one that cannot decide it holds it back while it is decided again for up to a day; it is shared through this rule only if none of them then matches it.",
24345
+ "type": "string"
24346
+ },
23708
24347
  "expectations": {
23709
24348
  "description": "Its saved expectations, each list by email id, as stored: on every create, and on an update that set or removed them.",
23710
24349
  "type": "object",
@@ -23881,13 +24520,43 @@ const operationManifest = [
23881
24520
  }
23882
24521
  },
23883
24522
  "undecided_samples": {
23884
- "description": "Made-up emails not decided, by index. Only a write sent with if_expectations_pass that saves a version or activates the rule judges them.",
24523
+ "description": "Made-up emails not decided, by index. Only a write that saves a version or activates the rule, sent with if_expectations_pass or judged by default, judges them.",
23885
24524
  "type": "array",
23886
24525
  "items": {
23887
24526
  "type": "integer",
23888
24527
  "minimum": 0
23889
24528
  }
23890
24529
  },
24530
+ "failed_sample_details": {
24531
+ "description": "failed_samples with each one's label, from a write that judged them before saving (if_expectations_pass, or by default).",
24532
+ "type": "array",
24533
+ "items": {
24534
+ "type": "object",
24535
+ "properties": {
24536
+ "index": {
24537
+ "type": "integer",
24538
+ "minimum": 0
24539
+ },
24540
+ "label": { "type": ["string", "null"] }
24541
+ },
24542
+ "required": ["index", "label"]
24543
+ }
24544
+ },
24545
+ "undecided_sample_details": {
24546
+ "description": "undecided_samples with each one's label, as failed_sample_details.",
24547
+ "type": "array",
24548
+ "items": {
24549
+ "type": "object",
24550
+ "properties": {
24551
+ "index": {
24552
+ "type": "integer",
24553
+ "minimum": 0
24554
+ },
24555
+ "label": { "type": ["string", "null"] }
24556
+ },
24557
+ "required": ["index", "label"]
24558
+ }
24559
+ },
23891
24560
  "note": {
23892
24561
  "description": "On an update that saved a version that did not pass, or a do_not_share rule created active: that it was saved anyway, is current, and whether it is live.",
23893
24562
  "type": "string"
@@ -23913,7 +24582,7 @@ const operationManifest = [
23913
24582
  "required": ["version", "note"]
23914
24583
  },
23915
24584
  "affects": {
23916
- "description": "After an update that saved a version: API keys listing the rule, the webhooks they own, and shares this write ended. The rule keeps its state. Absent if not read.",
24585
+ "description": "After an update that saved a version, or turned a grant rule active: API keys listing the rule and the webhooks they own, which read and receive what a grant rule grants from now on. shares_ended is always 0: a new version keeps the rule's share (share_notice says so). Saving a version does not by itself change the rule's state. Absent after any other write, and if not read.",
23917
24586
  "type": "object",
23918
24587
  "properties": {
23919
24588
  "keys": {
@@ -23936,11 +24605,11 @@ const operationManifest = [
23936
24605
  ]
23937
24606
  },
23938
24607
  "notice": {
23939
- "description": "After a write that saved a version of an active rule keys or webhooks read without checking it first: what it changes, and how to have the next one checked.",
24608
+ "description": "After a write that saved a version of an active rule keys, webhooks or a share read without checking it first: what it changes, and how to have the next one checked.",
23940
24609
  "type": "string"
23941
24610
  },
23942
24611
  "share_notice": {
23943
- "description": "After a write that ended the rule's share: that it did, given even when affects is not, with whom it was with and the version they accepted when those can be read.",
24612
+ "description": "After a write that saved a version of a rule with a live share: that the share goes on under it, given even when affects is not, with whom it is and the version they accepted when those can be read.",
23944
24613
  "type": "string"
23945
24614
  }
23946
24615
  },
@@ -24051,7 +24720,7 @@ const operationManifest = [
24051
24720
  "type": ["string", "null"]
24052
24721
  },
24053
24722
  "server_notes": {
24054
- "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
24723
+ "description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
24055
24724
  "type": "array",
24056
24725
  "items": { "type": "string" }
24057
24726
  },
@@ -24150,7 +24819,7 @@ const operationManifest = [
24150
24819
  "type": ["boolean", "null"]
24151
24820
  },
24152
24821
  "notice": {
24153
- "description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, then what accepting would share. For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
24822
+ "description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
24154
24823
  "type": ["string", "null"]
24155
24824
  }
24156
24825
  },
@@ -24868,16 +25537,27 @@ const operationManifest = [
24868
25537
  null
24869
25538
  ]
24870
25539
  },
24871
- "webhook_attempt_count": { "type": "integer" },
25540
+ "webhook_attempt_count": {
25541
+ "type": "integer",
25542
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its attempts."
25543
+ },
24872
25544
  "webhook_last_attempt_at": {
24873
25545
  "type": ["string", "null"],
24874
- "format": "date-time"
25546
+ "format": "date-time",
25547
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its last attempt."
25548
+ },
25549
+ "webhook_last_status_code": {
25550
+ "type": ["integer", "null"],
25551
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. What it last answered."
25552
+ },
25553
+ "webhook_last_error": {
25554
+ "type": ["string", "null"],
25555
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its last error."
24875
25556
  },
24876
- "webhook_last_status_code": { "type": ["integer", "null"] },
24877
- "webhook_last_error": { "type": ["string", "null"] },
24878
25557
  "webhook_fired_at": {
24879
25558
  "type": ["string", "null"],
24880
- "format": "date-time"
25559
+ "format": "date-time",
25560
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. When it was delivered."
24881
25561
  },
24882
25562
  "smtp_helo": { "type": ["string", "null"] },
24883
25563
  "smtp_mail_from": {
@@ -25404,7 +26084,7 @@ const operationManifest = [
25404
26084
  },
25405
26085
  "shared_through": {
25406
26086
  "type": ["object", "null"],
25407
- "description": "The rule share a reader has this email through, when that is their only way to it. Null for everyone else.",
26087
+ "description": "Only for a reader who has this email through a colleague's share of their mail, when that share is their only way to it: the share and who gave it. Null for everyone else, including on your own mail when a rule or share of yours gave it to someone: rule_deliveries counts the webhooks rules delivered it to, and GET /v1/email-rule-shares/{id}/emails lists what a share you gave has given.",
25408
26088
  "required": [
25409
26089
  "share_id",
25410
26090
  "rule_name",
@@ -25431,6 +26111,81 @@ const operationManifest = [
25431
26111
  }
25432
26112
  }
25433
26113
  },
26114
+ "rule_deliveries": {
26115
+ "type": ["object", "null"],
26116
+ "description": "Where Email Rules delivered this email by webhook, for the owner of the mailbox it is at, on their own dashboard session or the Primitive CLI. Null for everyone else, including on another member's mail even for an organization owner or admin (GET /v1/webhooks/deliveries?email_id=<email-id> lists its deliveries, a rule's included), and when it could not be read in time. A key reading it through a rule is not a delivery.",
26117
+ "required": [
26118
+ "rules",
26119
+ "hidden",
26120
+ "complete"
26121
+ ],
26122
+ "properties": {
26123
+ "rules": {
26124
+ "type": "array",
26125
+ "description": "Each rule over your mail that queued a webhook delivery of this email, newest rule first.",
26126
+ "items": {
26127
+ "type": "object",
26128
+ "required": [
26129
+ "rule_id",
26130
+ "name",
26131
+ "delivered",
26132
+ "pending",
26133
+ "failed",
26134
+ "not_sent",
26135
+ "hosts",
26136
+ "hosts_not_listed"
26137
+ ],
26138
+ "properties": {
26139
+ "rule_id": {
26140
+ "type": "string",
26141
+ "format": "uuid",
26142
+ "description": "The rule. A webhook sent it through several rules counts under one."
26143
+ },
26144
+ "name": { "type": "string" },
26145
+ "delivered": {
26146
+ "type": "integer",
26147
+ "minimum": 0,
26148
+ "description": "Webhooks it was delivered to."
26149
+ },
26150
+ "pending": {
26151
+ "type": "integer",
26152
+ "minimum": 0,
26153
+ "description": "Webhooks still owed it."
26154
+ },
26155
+ "failed": {
26156
+ "type": "integer",
26157
+ "minimum": 0,
26158
+ "description": "Webhooks whose attempts gave up."
26159
+ },
26160
+ "not_sent": {
26161
+ "type": "integer",
26162
+ "minimum": 0,
26163
+ "description": "Webhooks it was not sent to after all."
26164
+ },
26165
+ "hosts": {
26166
+ "type": "array",
26167
+ "items": { "type": "string" },
26168
+ "description": "The sites it was delivered to at the time, named as the covering view names sites; they may differ from the rule's current receivers there."
26169
+ },
26170
+ "hosts_not_listed": {
26171
+ "type": "integer",
26172
+ "minimum": 0,
26173
+ "description": "Sites past the listed ones."
26174
+ }
26175
+ }
26176
+ }
26177
+ },
26178
+ "hidden": {
26179
+ "type": "integer",
26180
+ "minimum": 0,
26181
+ "description": "Rules that queued a delivery of it that are not listed: they do not cover your mailboxes now, or are past the 50 one answer judges."
26182
+ },
26183
+ "complete": {
26184
+ "type": "boolean",
26185
+ "description": "False when a delivery may be missing: the email is older than 14 days, or it has more deliveries or rules than one answer reads."
26186
+ }
26187
+ }
26188
+ },
25434
26189
  "from_name": {
25435
26190
  "type": ["string", "null"],
25436
26191
  "description": "Display name from the `From:` header, decoded for display: RFC 2047 encoded words are decoded in their declared charset and folded lines are joined (e.g. `Dana Rúiz` for `=?UTF-8?Q?Dana_R=C3=BAiz?= <dana@example.com>`). Null when the header carries no display name. For display only: identify the sender by `from_email`, never by this name, which the sender chooses freely."
@@ -26326,7 +27081,10 @@ const operationManifest = [
26326
27081
  null
26327
27082
  ]
26328
27083
  },
26329
- "webhook_attempt_count": { "type": "integer" },
27084
+ "webhook_attempt_count": {
27085
+ "type": "integer",
27086
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its attempts."
27087
+ },
26330
27088
  "thread_id": {
26331
27089
  "type": ["string", "null"],
26332
27090
  "format": "uuid",
@@ -27061,7 +27819,10 @@ const operationManifest = [
27061
27819
  null
27062
27820
  ]
27063
27821
  },
27064
- "webhook_attempt_count": { "type": "integer" },
27822
+ "webhook_attempt_count": {
27823
+ "type": "integer",
27824
+ "description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its attempts."
27825
+ },
27065
27826
  "thread_id": {
27066
27827
  "type": ["string", "null"],
27067
27828
  "format": "uuid",
@@ -47218,7 +47979,7 @@ const operationManifest = [
47218
47979
  "type": "object",
47219
47980
  "additionalProperties": false,
47220
47981
  "required": ["url"],
47221
- "description": "One-click unsubscribe for the message. Primitive writes a `List-Unsubscribe` header naming `url` (and `mailto` when given) and, unless `one_click` is false, `List-Unsubscribe-Post: List-Unsubscribe=One-Click` (RFC 8058), and DKIM-signs both. A receiver that offers one-click unsubscribe sends an HTTPS POST to `url` with the form body `List-Unsubscribe=One-Click`; your endpoint records the unsubscribe. Every recipient of the message gets the same `url`, so send one message per recipient when the URL identifies who to unsubscribe. The `headers` map refuses both header names, so this field is the only way to set them, and the headers it adds count toward the 25 entries `headers` may hold. A field whose rendered `List-Unsubscribe` would pass 980 characters is refused. Not accepted on a repeating send.",
47982
+ "description": "One-click unsubscribe for the message. Primitive writes a `List-Unsubscribe` header naming `url` (and `mailto` when given) and, unless `one_click` is false, `List-Unsubscribe-Post: List-Unsubscribe=One-Click` (RFC 8058), and DKIM-signs both. A receiver that offers one-click unsubscribe sends an HTTPS POST to `url` with the form body `List-Unsubscribe=One-Click`; your endpoint records the unsubscribe. Every recipient of a message would get the same `url`, so another recipient could unsubscribe whoever it identifies: a reply with `unsubscribe` must go to the one address it answers, and one with `reply_all` that adds a cc is refused with a `validation_error`. The `headers` map refuses both header names, so this field is the only way to set them, and the headers it adds count toward the 25 entries `headers` may hold. A field whose rendered `List-Unsubscribe` would pass 980 characters is refused. Not accepted on a repeating send.",
47222
47983
  "properties": {
47223
47984
  "url": {
47224
47985
  "type": "string",
@@ -48406,7 +49167,7 @@ const operationManifest = [
48406
49167
  "type": "object",
48407
49168
  "additionalProperties": false,
48408
49169
  "required": ["url"],
48409
- "description": "One-click unsubscribe for the message. Primitive writes a `List-Unsubscribe` header naming `url` (and `mailto` when given) and, unless `one_click` is false, `List-Unsubscribe-Post: List-Unsubscribe=One-Click` (RFC 8058), and DKIM-signs both. A receiver that offers one-click unsubscribe sends an HTTPS POST to `url` with the form body `List-Unsubscribe=One-Click`; your endpoint records the unsubscribe. Every recipient of the message gets the same `url`, so send one message per recipient when the URL identifies who to unsubscribe. The `headers` map refuses both header names, so this field is the only way to set them, and the headers it adds count toward the 25 entries `headers` may hold. A field whose rendered `List-Unsubscribe` would pass 980 characters is refused. Not accepted on a repeating send.",
49170
+ "description": "One-click unsubscribe for the message. Primitive writes a `List-Unsubscribe` header naming `url` (and `mailto` when given) and, unless `one_click` is false, `List-Unsubscribe-Post: List-Unsubscribe=One-Click` (RFC 8058), and DKIM-signs both. A receiver that offers one-click unsubscribe sends an HTTPS POST to `url` with the form body `List-Unsubscribe=One-Click`; your endpoint records the unsubscribe. Every recipient of a message would get the same `url`, so another recipient could unsubscribe whoever it identifies: a send with `unsubscribe` must have exactly one recipient, one entry across `to`, `cc` and `bcc` (an address given twice counts twice), and a send to more is refused with a `validation_error`. Send one message per recipient, for example with `POST /v1/send-mail/batch`. The `headers` map refuses both header names, so this field is the only way to set them, and the headers it adds count toward the 25 entries `headers` may hold. A field whose rendered `List-Unsubscribe` would pass 980 characters is refused. Not accepted on a repeating send.",
48410
49171
  "properties": {
48411
49172
  "url": {
48412
49173
  "type": "string",
@@ -48913,7 +49674,7 @@ const operationManifest = [
48913
49674
  "type": "object",
48914
49675
  "additionalProperties": false,
48915
49676
  "required": ["url"],
48916
- "description": "One-click unsubscribe for the message. Primitive writes a `List-Unsubscribe` header naming `url` (and `mailto` when given) and, unless `one_click` is false, `List-Unsubscribe-Post: List-Unsubscribe=One-Click` (RFC 8058), and DKIM-signs both. A receiver that offers one-click unsubscribe sends an HTTPS POST to `url` with the form body `List-Unsubscribe=One-Click`; your endpoint records the unsubscribe. Every recipient of the message gets the same `url`, so send one message per recipient when the URL identifies who to unsubscribe. The `headers` map refuses both header names, so this field is the only way to set them, and the headers it adds count toward the 25 entries `headers` may hold. A field whose rendered `List-Unsubscribe` would pass 980 characters is refused. Not accepted on a repeating send.",
49677
+ "description": "One-click unsubscribe for the message. Primitive writes a `List-Unsubscribe` header naming `url` (and `mailto` when given) and, unless `one_click` is false, `List-Unsubscribe-Post: List-Unsubscribe=One-Click` (RFC 8058), and DKIM-signs both. A receiver that offers one-click unsubscribe sends an HTTPS POST to `url` with the form body `List-Unsubscribe=One-Click`; your endpoint records the unsubscribe. Every recipient of a message would get the same `url`, so another recipient could unsubscribe whoever it identifies: a send with `unsubscribe` must have exactly one recipient, one entry across `to`, `cc` and `bcc` (an address given twice counts twice), and a send to more is refused with a `validation_error`. Send one message per recipient, for example with `POST /v1/send-mail/batch`. The `headers` map refuses both header names, so this field is the only way to set them, and the headers it adds count toward the 25 entries `headers` may hold. A field whose rendered `List-Unsubscribe` would pass 980 characters is refused. Not accepted on a repeating send.",
48917
49678
  "properties": {
48918
49679
  "url": {
48919
49680
  "type": "string",
@@ -53659,8 +54420,8 @@ function shownKey(key) {
53659
54420
  function unknownFieldsNote(source, sent, all) {
53660
54421
  const carriers = /* @__PURE__ */ new Map();
53661
54422
  for (const sample of sent) {
53662
- const number = all.indexOf(sample) + 1;
53663
- for (const field of UNKNOWN_FIELDS.get(sample) ?? []) carriers.set(field, [...carriers.get(field) ?? [], number]);
54423
+ const index = all.indexOf(sample);
54424
+ for (const field of UNKNOWN_FIELDS.get(sample) ?? []) carriers.set(field, [...carriers.get(field) ?? [], `${index + 1} (index ${index})`]);
53664
54425
  }
53665
54426
  if (carriers.size === 0) return null;
53666
54427
  return `${source} has fields this CLI does not know, which it does not refuse but leaves for the API to judge (if the API refuses one, take it out): ${[...carriers].map(([field, numbers]) => `${field} (sample${numbers.length === 1 ? "" : "s"} ${numbers.join(", ")})`).join(", ")}.`;
@@ -53716,14 +54477,14 @@ function samplesFromJson(value, source) {
53716
54477
  const samples = lookAlikeSamples(data);
53717
54478
  if (samples.length === 0) throw usageError$2(`${source} is a generate-look-alikes answer with no look-alikes in it.`);
53718
54479
  samples.forEach((sample, index) => {
53719
- const unknown = checkSampleEmail(sample.email, `${source}, look-alike ${index + 1}`);
54480
+ const unknown = checkSampleEmail(sample.email, `${source}, look-alike ${index + 1} (index ${index})`);
53720
54481
  if (unknown.length > 0) UNKNOWN_FIELDS.set(sample, unknown);
53721
54482
  });
53722
54483
  return samples;
53723
54484
  }
53724
54485
  if (!Array.isArray(data)) throw usageError$2(`${source} must hold a JSON array of samples, such as [{"expected": "no_match", "label": "a personal bill", "email": {...}}], or a generate-look-alikes answer.`);
53725
54486
  return data.map((item, index) => {
53726
- const at = `${source}, sample ${index + 1}`;
54487
+ const at = `${source}, sample ${index + 1} (index ${index})`;
53727
54488
  if (!isRecord$1(item)) throw usageError$2(`${at} is not an object.`);
53728
54489
  const unknown = Object.keys(item).filter((key) => !SAMPLE_KEYS.has(key));
53729
54490
  if (item.expected !== "match" && item.expected !== "no_match") throw usageError$2(`${at}: expected must be "match" or "no_match".`);
@@ -54136,6 +54897,46 @@ function expectBodyFields(flags) {
54136
54897
  value: expect
54137
54898
  }];
54138
54899
  }
54900
+ /** test-email-rule's flag that tests the emails an earlier answer tested. */
54901
+ const SAME_EMAILS_FLAG = "same-emails-as";
54902
+ const EMAIL_IDS_MAX = 200;
54903
+ /**
54904
+ * `email_ids` for test-email-rule, from --same-emails-as: every email an
54905
+ * earlier test's answer, saved as it printed it, tested (its results'
54906
+ * email_id), so a second tree is tested over the same mail rather than over
54907
+ * whatever is newest by then.
54908
+ */
54909
+ function sameEmailsBodyFields(flags) {
54910
+ const file = flags[SAME_EMAILS_FLAG];
54911
+ if (typeof file !== "string") return [];
54912
+ const saved = readJsonFileFlag(file, `--${SAME_EMAILS_FLAG}`);
54913
+ const answer = isRecord(saved) && isRecord(saved.data) ? saved.data : saved;
54914
+ const results = isRecord(answer) && Array.isArray(answer.results) ? answer.results : null;
54915
+ if (!results) throw usageError(`--${SAME_EMAILS_FLAG} ${file} is not a saved test-email-rule answer: it has no results. Save one with test-email-rule --json > answer.json.`);
54916
+ const ids = [...new Set(results.flatMap((result) => isRecord(result) && typeof result.email_id === "string" && isEmailId(result.email_id) ? [result.email_id.toLowerCase()] : []))];
54917
+ if (ids.length === 0) throw usageError(`--${SAME_EMAILS_FLAG} ${file} names no emails.`);
54918
+ if (ids.length > EMAIL_IDS_MAX) throw usageError(`--${SAME_EMAILS_FLAG} ${file} names ${ids.length} emails; a test takes at most ${EMAIL_IDS_MAX}.`);
54919
+ return [{
54920
+ flag: `--${SAME_EMAILS_FLAG}`,
54921
+ property: "email_ids",
54922
+ value: ids
54923
+ }];
54924
+ }
54925
+ /**
54926
+ * The emails --same-emails-as names with the expected ones this test sends
54927
+ * (from the expect flags, or the body's own expect) are at most
54928
+ * EMAIL_IDS_MAX, as the API takes them: refused here, naming the flag,
54929
+ * rather than by the API as email_ids the caller never typed. A saved rule's
54930
+ * own expectations are not known here; the API counts those.
54931
+ */
54932
+ function checkSameEmailsWithExpected(same, expect, base) {
54933
+ const ids = same[0]?.value;
54934
+ if (!Array.isArray(ids)) return;
54935
+ const sent = expect[0]?.value ?? (isRecord(base) ? base.expect : void 0);
54936
+ const expected = isRecord(sent) ? [sent.match, sent.no_match].flatMap((list) => Array.isArray(list) ? list.filter((id) => typeof id === "string") : []) : [];
54937
+ const all = /* @__PURE__ */ new Set([...ids, ...expected.map((id) => id.toLowerCase())]);
54938
+ if (all.size > EMAIL_IDS_MAX) throw usageError(`--${SAME_EMAILS_FLAG} names ${ids.length} emails and the expectations sent name others: ${all.size} in all, and a test takes at most ${EMAIL_IDS_MAX}.`);
54939
+ }
54139
54940
  /**
54140
54941
  * `expectations` for create-email-rule and update-email-rule, from
54141
54942
  * --expectations-file. A file holding `null` removes the saved expectations,
@@ -54284,7 +55085,8 @@ function sampleNamer(request) {
54284
55085
  const fromFile = sent && typeof request?.flags?.["expect-samples-file"] === "string";
54285
55086
  return ({ index, label }) => {
54286
55087
  const n = fromFile ? sentSampleNumber(index, request?.flags) : index + 1;
54287
- const name = sent ? `sample ${n}` : `saved sample ${n}`;
55088
+ if (!sent) return `saved sample ${n} (index ${index}${label ? `, "${label}"` : ""})`;
55089
+ const name = `sample ${n}`;
54288
55090
  return label ? `${name} ("${label}")` : name;
54289
55091
  };
54290
55092
  }
@@ -54371,7 +55173,52 @@ function notMatchedLine(result) {
54371
55173
  const source = result.question_answers_source ? ` (${result.question_answers_source})` : "";
54372
55174
  lines.push(` questions${source}: ${answers.map(answerText).join("; ")}`);
54373
55175
  }
54374
- return lines;
55176
+ return [...lines, ...attachmentsLine(result)];
55177
+ }
55178
+ /** Marks that reorder text on screen, so "inv\u202egpj.exe" could show as "invexe.jpg". */
55179
+ const BIDI_CONTROLS = /[\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
55180
+ /** The longest a sender's subject or file name is shown in a report line. */
55181
+ const SHOWN_TEXT_MAX = 100;
55182
+ /**
55183
+ * Text a sender wrote (a subject, an address, a file name), as a report
55184
+ * line shows it: no terminal control sequences or reordering marks, on one
55185
+ * line, cut at SHOWN_TEXT_MAX.
55186
+ */
55187
+ function shownText(value) {
55188
+ if (typeof value !== "string") return "";
55189
+ const line = sanitizeForTerminal(value).replace(BIDI_CONTROLS, "").replaceAll(/\s+/g, " ").trim();
55190
+ return line.length > SHOWN_TEXT_MAX ? `${line.slice(0, 97)}...` : line;
55191
+ }
55192
+ /**
55193
+ * The file names a matched or near-miss result lists (attachment_names), on
55194
+ * one line under it: the names its questions are given, shown as shownText
55195
+ * shows a sender's text.
55196
+ */
55197
+ function attachmentsLine(result) {
55198
+ const names = result.attachment_names;
55199
+ if (!Array.isArray(names)) return [];
55200
+ const shown = names.map(shownText).filter(Boolean);
55201
+ return shown.length > 0 ? [` attachments: ${shown.join(", ")}`] : [];
55202
+ }
55203
+ /**
55204
+ * The matched emails, each with who sent it, its subject and its attachments'
55205
+ * file names, so a match can be judged without opening it; cut as the not
55206
+ * matched list is.
55207
+ */
55208
+ function matchedLines(results, expectations) {
55209
+ const flagged = new Set((expectations?.results ?? []).filter((result) => result.status !== "passed").map((result) => result.email_id));
55210
+ const matched = results.filter((result) => result.outcome === "matched").map((result, position) => ({
55211
+ result,
55212
+ position
55213
+ })).sort((a, b) => Number(flagged.has(b.result.email_id)) - Number(flagged.has(a.result.email_id)) || a.position - b.position).map(({ result }) => result);
55214
+ if (matched.length === 0) return [];
55215
+ const shown = matched.slice(0, 25);
55216
+ return [shown.length < matched.length ? `Matched (${shown.length} of ${matched.length} shown; the JSON has every result):` : `Matched (${matched.length}):`, ...shown.flatMap((result) => {
55217
+ const from = shownText(result.from_address);
55218
+ const subject = shownText(result.subject);
55219
+ const about = [from, subject ? `"${subject}"` : ""].filter(Boolean);
55220
+ return [` ${result.email_id}${about.length > 0 ? ` ${about.join(" ")}` : ""}`, ...attachmentsLine(result)];
55221
+ })];
54375
55222
  }
54376
55223
  function notMatchedLines(results, expectations) {
54377
55224
  const flagged = new Set((expectations?.results ?? []).filter((result) => result.status !== "passed").map((result) => result.email_id));
@@ -54440,6 +55287,24 @@ function expectationsOutcome(expectations, testResults = [], name = sampleNamer(
54440
55287
  };
54441
55288
  return {};
54442
55289
  }
55290
+ /** A time an answer gives, to the minute, in UTC. */
55291
+ function minuteUtc(value) {
55292
+ const at = new Date(value);
55293
+ return Number.isNaN(at.getTime()) ? value : `${at.toISOString().slice(0, 16).replace("T", " ")} UTC`;
55294
+ }
55295
+ /**
55296
+ * The first line of a test report: which mail was tested. A test of recent
55297
+ * mail covers the newest emails, so a later one covers what has arrived since,
55298
+ * and two counts compare only over the same emails.
55299
+ */
55300
+ function windowLine(data, tested) {
55301
+ const window = isRecord(data.window) ? data.window : void 0;
55302
+ const oldest = typeof window?.oldest_at === "string" ? window.oldest_at : void 0;
55303
+ const newest = typeof window?.newest_at === "string" ? window.newest_at : void 0;
55304
+ if (!window || !oldest || !newest) return [];
55305
+ const span = `Tested ${plural$1(tested, "email", "emails")} received ${minuteUtc(oldest)} to ${minuteUtc(newest)}.`;
55306
+ return window.mode === "recent" ? [`${span} A later test of recent mail covers what has arrived since: to compare two trees, test the second with --${SAME_EMAILS_FLAG} <this answer, saved with --json>.`] : [span];
55307
+ }
54443
55308
  /** The stderr report and exit code of a test-email-rule answer. */
54444
55309
  function testEmailRuleReport(data, request) {
54445
55310
  if (!isRecord(data)) return { lines: [] };
@@ -54447,13 +55312,16 @@ function testEmailRuleReport(data, request) {
54447
55312
  const result = data;
54448
55313
  const results = Array.isArray(result.results) ? result.results : [];
54449
55314
  const summary = isRecord(result.summary) ? result.summary : void 0;
55315
+ const counts = isRecord(data.counts) ? data.counts : void 0;
54450
55316
  return {
54451
55317
  lines: [
55318
+ ...windowLine(data, (typeof counts?.emails === "number" ? counts.emails : results.length) - (typeof counts?.not_found === "number" ? counts.not_found : 0)),
54452
55319
  ...(Array.isArray(summary?.warnings) ? summary.warnings : []).map((warning) => `Warning: ${warning}`),
54453
55320
  ...scopeWarningLines(result.scope_warnings),
54454
55321
  ...conditionLines(summary),
54455
55322
  ...questionLines(summary, results),
54456
55323
  ...expectationsLines(result.expectations, results, name),
55324
+ ...matchedLines(results, result.expectations),
54457
55325
  ...notMatchedLines(results, result.expectations)
54458
55326
  ],
54459
55327
  ...expectationsOutcome(result.expectations, results, name)
@@ -54464,28 +55332,50 @@ function indexList(value) {
54464
55332
  return Array.isArray(value) ? value.filter((n) => typeof n === "number") : [];
54465
55333
  }
54466
55334
  /**
55335
+ * The labels a write's check gives the made-up emails it names, by index
55336
+ * (failed_sample_details and undecided_sample_details), from a server that
55337
+ * sends them.
55338
+ */
55339
+ function sampleDetailLabels(check) {
55340
+ const labels = /* @__PURE__ */ new Map();
55341
+ if (!isRecord(check)) return labels;
55342
+ for (const key of ["failed_sample_details", "undecided_sample_details"]) {
55343
+ const details = check[key];
55344
+ if (!Array.isArray(details)) continue;
55345
+ for (const detail of details) if (isRecord(detail) && typeof detail.index === "number" && Number.isInteger(detail.index) && detail.index >= 0) labels.set(detail.index, typeof detail.label === "string" ? detail.label : null);
55346
+ }
55347
+ return labels;
55348
+ }
55349
+ /**
54467
55350
  * How a rule write names a made-up email its check gives by index, from 0 in
54468
55351
  * the set judged: those this write sends in place of the rule's
54469
55352
  * (expectation_samples), or the rule's saved ones oldest first and then
54470
55353
  * those it adds (add_expectation_samples). One this write sent is "sample
54471
55354
  * N", its number in the samples file --pick took it from (or its place in
54472
- * what was sent); any other is "saved sample N", its place among the rule's.
54473
- * With its label when known. `saved` is the answer's expectation_samples,
54474
- * every one the rule keeps after the write, when it has them.
55355
+ * what was sent); any other is "saved sample N (index i)", its place among
55356
+ * the rule's and the index the API names it by. With its label when known,
55357
+ * from the samples or from `labels` (sampleDetailLabels). `saved` is the
55358
+ * answer's expectation_samples, every one the rule keeps after the write,
55359
+ * when it has them.
54475
55360
  */
54476
- function writtenSampleNamer(body, flags, saved) {
55361
+ function writtenSampleNamer(body, flags, saved, labels = /* @__PURE__ */ new Map()) {
54477
55362
  const sent = isRecord(body) && Array.isArray(body.expectation_samples) ? body.expectation_samples : null;
54478
55363
  const added = isRecord(body) && Array.isArray(body.add_expectation_samples) ? body.add_expectation_samples : null;
54479
55364
  const kept = Array.isArray(saved) ? saved : null;
54480
55365
  const labelled = (name, sample) => isRecord(sample) && typeof sample.label === "string" && sample.label ? `${name} ("${sample.label}")` : name;
55366
+ const indexed = (name, index) => {
55367
+ const sample = kept?.[index];
55368
+ const label = isRecord(sample) && typeof sample.label === "string" && sample.label ? sample.label : labels.get(index);
55369
+ return `${name} (index ${index}${label ? `, "${label}"` : ""})`;
55370
+ };
54481
55371
  return (index) => {
54482
55372
  if (sent) return labelled(`sample ${sentSampleNumber(index, flags)}`, sent[index]);
54483
55373
  if (added) {
54484
55374
  const start = kept ? kept.length - added.length : null;
54485
- if (start === null) return `made-up email ${index + 1}`;
55375
+ if (start === null) return indexed(`made-up email ${index + 1}`, index);
54486
55376
  if (index >= start) return labelled(`sample ${sentSampleNumber(index - start, flags)}`, added[index - start]);
54487
55377
  }
54488
- return labelled(`saved sample ${index + 1}`, kept?.[index]);
55378
+ return indexed(`saved sample ${index + 1}`, index);
54489
55379
  };
54490
55380
  }
54491
55381
  function expectationsCheckLine(check, ruleId, name = (index) => `saved sample ${index + 1}`) {
@@ -54576,18 +55466,24 @@ function restoredLine(restored, currentVersion) {
54576
55466
  return `Saved version ${restored.version} again ${as}.${note}`;
54577
55467
  }
54578
55468
  /**
54579
- * Who an update that saved a version reaches, as its answer counts them: the
54580
- * keys listing the rule, the webhooks those keys own, and the shares the
54581
- * write ended.
55469
+ * Who an update that saved a version, or turned a grant rule active, reaches,
55470
+ * as its answer counts them: the keys listing the rule and the webhooks those
55471
+ * keys own, and the shares the write ended when it ended any. A new version
55472
+ * keeps a rule's share, so the API counts none; the answer's `share_notice`
55473
+ * says the share goes on.
54582
55474
  */
54583
- function affectsLine(affects) {
55475
+ function affectsLine(affects, write = {}) {
54584
55476
  if (!isRecord(affects)) return void 0;
54585
55477
  const count = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
54586
55478
  const keys = count(affects.keys);
54587
55479
  const endpoints = count(affects.endpoints);
54588
- const shares = count(affects.shares_ended);
54589
- if (keys === void 0 || endpoints === void 0 || shares === void 0) return void 0;
54590
- return `This version reaches ${plural$1(keys, "API key", "API keys")} listing the rule and ${plural$1(endpoints, "webhook", "webhooks")} those keys own; it ended ${plural$1(shares, "share", "shares")}. The rule keeps its state.`;
55480
+ const shares = count(affects.shares_ended) ?? 0;
55481
+ const reach = `${plural$1(keys ?? 0, "API key", "API keys")} listing the rule and ${plural$1(endpoints ?? 0, "webhook", "webhooks")} those keys own`;
55482
+ if (write.activatedOnly && keys !== void 0 && endpoints !== void 0) return `Now active${write.scopeSent ? ", over the scope this write sent" : ""}: it reaches ${reach}.`;
55483
+ if (keys === void 0 || endpoints === void 0) return void 0;
55484
+ const ended = shares > 0 ? `; it ended ${plural$1(shares, "share", "shares")}` : "";
55485
+ if (write.stateSent !== void 0 && typeof write.state === "string") return `This version reaches ${reach}${ended}. The rule is now ${write.state}.`;
55486
+ return `This version reaches ${reach}${ended}. The rule keeps its state.`;
54591
55487
  }
54592
55488
  /** The rule's author, by name and email where the answer gives them. */
54593
55489
  function authorLine(author) {
@@ -54614,14 +55510,26 @@ function writtenEmailRuleReport(data, request) {
54614
55510
  }
54615
55511
  const restored = restoredLine(rule.restored_from, rule.current_version);
54616
55512
  if (restored) lines.push(restored);
54617
- const reach = affectsLine(rule.affects);
55513
+ const body = isRecord(request.body) ? request.body : {};
55514
+ const activatedOnly = body.state === "active" && body.tree === void 0 && body.restore_version === void 0;
55515
+ const scopeSent = body.evaluation_scope !== void 0;
55516
+ const reach = rule.kind === "do_not_share" && activatedOnly && !scopeSent ? void 0 : affectsLine(rule.affects, {
55517
+ activatedOnly,
55518
+ scopeSent,
55519
+ stateSent: body.state,
55520
+ state: rule.state
55521
+ });
54618
55522
  if (reach) lines.push(reach);
54619
- for (const note of [rule.share_notice, rule.notice]) {
55523
+ for (const note of [
55524
+ rule.share_notice,
55525
+ rule.notice,
55526
+ rule.do_not_share_note
55527
+ ]) {
54620
55528
  const line = noteLine(note);
54621
55529
  if (line) lines.push(line);
54622
55530
  }
54623
55531
  const sentExpectations = sentExpectationsIn(request.body);
54624
- const name = writtenSampleNamer(request.body, request.flags, rule.expectation_samples);
55532
+ const name = writtenSampleNamer(request.body, request.flags, rule.expectation_samples, sampleDetailLabels(rule.expectations_check));
54625
55533
  const checked = expectationsCheckLine(rule.expectations_check, ruleId, name);
54626
55534
  if (checked) lines.push(checked);
54627
55535
  else if (sentExpectations) lines.push(`Expectations were not checked on this write. Test them with \`primitive email-rules test-email-rule --rule-id ${ruleId}\`.`);
@@ -54718,14 +55626,17 @@ function readAgain(id) {
54718
55626
  /**
54719
55627
  * Who reads an active rule, from a refusal's details.read_by: the server
54720
55628
  * sends it when it checked the write against the rule's expectations because
54721
- * API keys or webhooks read the rule, whether or not the write asked.
55629
+ * API keys, webhooks or a share read the rule, whether or not the write asked.
54722
55630
  * Undefined without it.
54723
55631
  */
54724
55632
  function readByText(details) {
54725
55633
  const readBy = details.read_by;
54726
55634
  if (!isRecord(readBy)) return void 0;
54727
- const { keys, webhooks } = readBy;
54728
- return typeof keys === "number" && typeof webhooks === "number" ? `${plural$1(keys, "API key", "API keys")} and ${plural$1(webhooks, "webhook", "webhooks")} read what it grants` : "API keys or webhooks may read what it grants (they could not be counted in time)";
55635
+ const { keys, webhooks, shares } = readBy;
55636
+ if (typeof keys !== "number" || typeof webhooks !== "number" || shares === null) return "API keys, webhooks or a share may read what it grants (they could not be counted in time)";
55637
+ const shared = typeof shares === "number" && shares > 0 ? `it is shared with ${plural$1(shares, "member", "members")}` : void 0;
55638
+ if (keys + webhooks === 0 && shared) return shared;
55639
+ return `${plural$1(keys, "API key", "API keys")} and ${plural$1(webhooks, "webhook", "webhooks")} read what it grants${shared ? `, and ${shared}` : ""}`;
54729
55640
  }
54730
55641
  /** How to save a write the default check refused, without the check. */
54731
55642
  function saveUncheckedText(flags) {
@@ -54738,14 +55649,14 @@ function saveUncheckedText(flags) {
54738
55649
  * expectations_failed, expectations_undecided, expectations_unreadable and
54739
55650
  * no_expectations. The guard runs when the write sends if_expectations_pass,
54740
55651
  * and by default (details.read_by) when it changes what an active rule that
54741
- * API keys or webhooks read grants. Nothing was saved in any of them.
55652
+ * API keys, webhooks or a share read grants. Nothing was saved in any of them.
54742
55653
  */
54743
55654
  function updateEmailRuleErrorHint(code, payload, ruleId, body, flags) {
54744
55655
  const id = typeof ruleId === "string" && ruleId ? ruleId : "<rule-id>";
54745
55656
  const details = errorDetails(payload);
54746
55657
  const guarded = isRecord(body) && body.if_expectations_pass === true;
54747
55658
  const readBy = readByText(details);
54748
- const judged = readBy ? "was judged against its expectations before saving, as a write that changes what an active rule grants is by default while API keys or webhooks read it, and nothing was saved" : "was judged against its expectations before saving (if_expectations_pass), and nothing was saved";
55659
+ const judged = readBy ? "was judged against its expectations before saving, as a write that changes what an active rule grants is by default while API keys, webhooks or a share read it, and nothing was saved" : "was judged against its expectations before saving (if_expectations_pass), and nothing was saved";
54749
55660
  const unchecked = readBy ? ` The rule is active and ${readBy}; to save the write without the check, ${saveUncheckedText(flags)}.` : "";
54750
55661
  if (code === "email_rule_conflict") switch (details.reason) {
54751
55662
  case "version_moved": return versionMovedHint(payload, ruleId);
@@ -54755,14 +55666,14 @@ function updateEmailRuleErrorHint(code, payload, ruleId, body, flags) {
54755
55666
  }
54756
55667
  case "expectations_moved": return `Hint: the rule's saved expectations changed while this write was checked against them, so nothing was saved. ${readAgain(id)}.`;
54757
55668
  case "rule_changed": return guarded ? `Hint: the rule changed after this write was judged against its expectations and before it was saved, so saving it would have gone unchecked; nothing was saved. ${readAgain(id)}.` : `Hint: the rule changed while this write was being saved, so nothing was saved. ${readAgain(id)}.`;
54758
- case "readers_changed": return "Hint: API keys or webhooks started reading this rule while this write was being saved, and saving it would have changed what they receive without checking it against the rule's expectations, so nothing was saved. Send the write again: it is then checked first.";
55669
+ case "readers_changed": return "Hint: API keys, webhooks or a share started reading this rule while this write was being saved, and saving it would have changed what they receive without checking it against the rule's expectations, so nothing was saved. Send the write again: it is then checked first.";
54759
55670
  default: return;
54760
55671
  }
54761
55672
  if (code === "expectations_failed" || code === "expectations_undecided") {
54762
55673
  const check = isRecord(details.expectations_check) ? details.expectations_check : {};
54763
55674
  const failed = Array.isArray(check.failed) ? check.failed : [];
54764
55675
  const undecided = Array.isArray(check.undecided) ? check.undecided : [];
54765
- const name = writtenSampleNamer(body, flags);
55676
+ const name = writtenSampleNamer(body, flags, void 0, sampleDetailLabels(check));
54766
55677
  const failedAll = [...failed, ...indexList(check.failed_samples).map(name)];
54767
55678
  const undecidedSamples = indexList(check.undecided_samples);
54768
55679
  const undecidedAll = [...undecided, ...undecidedSamples.map(name)];
@@ -54838,6 +55749,25 @@ function updateEmailRuleErrorExitCode(payload) {
54838
55749
  function undecidedSamplesMayStay(count, reason) {
54839
55750
  return count > 0 && !RETRYABLE_REASONS.has(reason) && reason !== "author_unresolvable";
54840
55751
  }
55752
+ /**
55753
+ * The stderr report of test-email-rule-on-sample with --with-protection:
55754
+ * whether a match would be shared, and the do-not-share rules that would
55755
+ * keep it from being shared. Nothing without protection in the answer.
55756
+ */
55757
+ function testSampleProtectionReport(data) {
55758
+ if (!isRecord(data) || !isRecord(data.protection)) return { lines: [] };
55759
+ const protection = data.protection;
55760
+ const mailbox = typeof protection.mailbox === "string" && protection.mailbox ? ` over ${protection.mailbox}` : "";
55761
+ if (protection.outcome === "not_matched") return { lines: [`Protection${mailbox}: the rule did not match, so nothing would be shared and no do-not-share rule was judged.`] };
55762
+ if (protection.outcome === "shared") return { lines: [`Protection${mailbox}: a match would be shared; no do-not-share rule keeps it back.`] };
55763
+ if (protection.outcome !== "withheld") return { lines: [] };
55764
+ const withheld = (Array.isArray(protection.withheld_by) ? protection.withheld_by : []).filter(isRecord);
55765
+ const named = withheld.map((rule) => `${typeof rule.name === "string" ? rule.name : "a rule"} (${rule.id}, ${rule.reason === "undecided" ? "undecided" : "matched"})`);
55766
+ const hidden = typeof protection.withheld_by_hidden === "number" && protection.withheld_by_hidden > 0 ? protection.withheld_by_hidden : 0;
55767
+ const by = [...named, ...hidden > 0 ? [plural$1(hidden, "rule you cannot see", "rules you cannot see")] : []];
55768
+ const undecided = withheld.some((rule) => rule.reason === "undecided") ? " An undecided one holds it back until it is decided." : "";
55769
+ return { lines: [`Protection${mailbox}: a match would be withheld${by.length > 0 ? ` by ${by.join(", ")}` : ""}.${undecided}`] };
55770
+ }
54841
55771
  /** Where compile counted breadth, by the evaluation_scope it was sent. */
54842
55772
  const BREADTH_SCOPE = {
54843
55773
  own_mailboxes: "in your own mailboxes",
@@ -54847,10 +55777,11 @@ const BREADTH_SCOPE = {
54847
55777
  /** The stderr report of compile-email-rule: how many recent emails it holds for. */
54848
55778
  function compileEmailRuleReport(data, request) {
54849
55779
  if (!isRecord(data)) return { lines: [] };
54850
- const lines = (Array.isArray(data.warnings) ? data.warnings : []).filter((warning) => typeof warning === "string" && warning.trim() !== "").map((warning) => `Warning: ${warning.trim()}`);
55780
+ const lines = [...scopeWarningLines(data.scope_warnings), ...(Array.isArray(data.warnings) ? data.warnings : []).filter((warning) => typeof warning === "string" && warning.trim() !== "").map((warning) => `Warning: ${warning.trim()}`)];
54851
55781
  const breadth = data.breadth;
54852
55782
  const sent = isRecord(request?.body) && typeof request.body.evaluation_scope === "string" ? request.body.evaluation_scope : void 0;
54853
- const where = sent === void 0 ? "in your own mailboxes, the default; pass --evaluation-scope to count over the scope you will save it with" : BREADTH_SCOPE[sent] ?? `in evaluation_scope ${sent}`;
55783
+ const counted = isRecord(data.breadth_scope) && typeof data.breadth_scope.evaluation_scope === "string" ? data.breadth_scope.evaluation_scope : sent;
55784
+ const where = sent === void 0 && (counted === void 0 || counted === "own_mailboxes") ? "in your own mailboxes, the default; pass --evaluation-scope to count over the scope you will save it with" : BREADTH_SCOPE[counted ?? "own_mailboxes"] ?? `in evaluation_scope ${counted}`;
54854
55785
  if (isRecord(breadth) && typeof breadth.checked === "number" && typeof breadth.matched === "number") lines.push(`Breadth: its conditions hold for ${breadth.matched} of ${plural$1(breadth.checked, "recent email", "recent emails")} checked ${where}.`);
54855
55786
  return { lines };
54856
55787
  }
@@ -54882,11 +55813,11 @@ function listEmailRulesReport(data) {
54882
55813
  return { lines };
54883
55814
  }
54884
55815
  /** create-email-rule's --fail-on-expectations: the exit code follows the check made after saving. */
54885
- const FAIL_ON_EXPECTATIONS_HELP = "Exit 1 when an expectation in the answer's expectations_check failed, and 3 when none failed but one is undecided or the expectations this write sent were not checked (test the rule to decide). A create does not judge made-up emails, so with some it exits 3. Without it the command exits 0 whatever the check says.";
55816
+ const FAIL_ON_EXPECTATIONS_HELP = "Exit 1 when an expectation in the answer's expectations_check failed, and 3 when none failed but one is undecided or the expectations this write sent were not checked (test the rule to decide). A create does not judge made-up emails, so with some it exits 3. It judges emails by id on their stored classification without asking the rule's questions, so on a new rule with questions an email whose conditions hold stays undecided (exit 3) until `test-email-rule --rule-id` asks them. Without it the command exits 0 whatever the check says.";
54886
55817
  /** update-email-rule's --fail-on-expectations: the server refuses the write. */
54887
- const UPDATE_FAIL_ON_EXPECTATIONS_HELP = "Refuse the write unless the rule, as this write would leave it, passes its expectations. It sends if_expectations_pass (over any in --body-file or --raw-body), so the server judges a new version, a restored one, a new scope or turning the rule active before saving, on its emails by id and its made-up emails, and saves nothing when one failed (exit 1), one names an email the rule cannot read (exit 1, since sending again never decides it), one is undecided (exit 3, or 1 when the rule cannot run as its author or a made-up email is undecided for no reason the answer gives) or the rule has none (exit 1). It can take as long as a test of the rule; the command waits for it. Judging needs a credential that reads the mail's content. A write the server does not judge (one changing only expectations, say) is saved, and the exit code then follows the answer's expectations_check, as on create. Without it, the server still judges, and refuses the same way, a write that saves a version or changes the scope of an active rule that API keys or webhooks read and that has expectations (the refusal's details.read_by counts them), unless --no-if-expectations-pass is sent. With --json, a refused write's document holds the API's error alone; a saved write's holds the rule.";
55818
+ const UPDATE_FAIL_ON_EXPECTATIONS_HELP = "Refuse the write unless the rule, as this write would leave it, passes its expectations. It sends if_expectations_pass (over any in --body-file or --raw-body), so the server judges a new version, a restored one, a new scope or turning the rule active before saving, on its emails by id and its made-up emails, and saves nothing when one failed (exit 1), one names an email the rule cannot read (exit 1, since sending again never decides it), one is undecided (exit 3, or 1 when the rule cannot run as its author or a made-up email is undecided for no reason the answer gives) or the rule has none (exit 1). It can take as long as a test of the rule; the command waits for it. Judging needs a credential that reads the mail's content. A write the server does not judge (one changing only expectations, say) is saved, and the exit code then follows the answer's expectations_check, as on create. Without it, the server still judges, and refuses the same way, a write that saves a version or changes the scope of an active rule that API keys, webhooks or a share read and that has expectations (the refusal's details.read_by counts them), unless --no-if-expectations-pass is sent. With --json, a refused write's document holds the API's error alone; a saved write's holds the rule.";
54888
55819
  /** When update-email-rule judges the made-up emails a samples flag sets. */
54889
- const UPDATE_JUDGES_SAMPLES = `The write judges them before saving with --${FAIL_ON_EXPECTATIONS_FLAG}, when it saves a version or turns the rule active, and without it when it saves a version or changes the scope of an active rule that API keys or webhooks read, unless --no-if-expectations-pass is sent.`;
55820
+ const UPDATE_JUDGES_SAMPLES = `The write judges them before saving with --${FAIL_ON_EXPECTATIONS_FLAG}, when it saves a version or turns the rule active, and without it when it saves a version or changes the scope of an active rule that API keys, webhooks or a share read, unless --no-if-expectations-pass is sent.`;
54890
55821
  /** What a samples file flag reads. */
54891
55822
  const SAMPLES_FILE_SHAPE = "A JSON file of made-up emails the rule must match or not: an array such as [{\"expected\": \"no_match\", \"label\": \"a personal bill\", \"email\": {...}}], with email as test-email-rule-on-sample takes it (text up to 4,000 characters, at most 10 each of to, cc, attachment_types and attachment_names), like the one generate-look-alikes --samples-file writes, or a generate-look-alikes answer saved as it printed it.";
54892
55823
  const EXPECTATION_FLAG_NOTE = "Replaces any expect in --body-file or --raw-body. The answer reports them in expectations (passed, counts, results) and the exit code follows it; see --help-full.";
@@ -54912,6 +55843,25 @@ function endEmailRuleShareReport(data) {
54912
55843
  const note = isRecord(data) && typeof data.note === "string" ? data.note.trim() : "";
54913
55844
  return { lines: note ? [note] : [] };
54914
55845
  }
55846
+ /**
55847
+ * accept-email-rule-request without --json: the answer's notice, then the
55848
+ * rule as it was agreed, since the answer's request block holds the rule as
55849
+ * it was asked and reads like what was accepted.
55850
+ */
55851
+ function acceptEmailRuleRequestReport(data) {
55852
+ if (!isRecord(data)) return { lines: [] };
55853
+ const notice = typeof data.notice === "string" ? data.notice.split(/\n\s*\n/).map((part) => part.trim()).filter(Boolean) : [];
55854
+ const rule = isRecord(data.rule) ? data.rule : void 0;
55855
+ const current = rule && isRecord(rule.current) ? rule.current : void 0;
55856
+ const lines = [...notice];
55857
+ if (rule && typeof rule.name === "string" && typeof rule.id === "string") {
55858
+ const version = typeof current?.version === "number" ? `, version ${current.version}` : "";
55859
+ const state = typeof rule.state === "string" ? `, ${rule.state}` : "";
55860
+ const agreed = typeof current?.english === "string" ? ` What you agreed to: ${current.english}` : "";
55861
+ lines.push(`Accepted as ${rule.name} (${rule.id})${version}${state}.${agreed}`);
55862
+ }
55863
+ return { lines };
55864
+ }
54915
55865
  const EMAIL_RULE_OPERATION_EXTENSIONS = {
54916
55866
  testEmailRule: {
54917
55867
  flags: {
@@ -54931,9 +55881,19 @@ const EMAIL_RULE_OPERATION_EXTENSIONS = {
54931
55881
  }),
54932
55882
  [EXPECT_SAMPLES_FILE_FLAG]: Flags.string({ description: `${SAMPLES_FILE_SHAPE} Sets expect.samples (at most 20), beside any emails by id; the answer judges each in expectations.samples (index from 0 over those sent), and the report names each by its number in the file. Like any expect, it replaces a saved rule's own expectations and samples for this test. ${EXPECTATION_FLAG_NOTE}` }),
54933
55883
  [PICK_FLAG]: Flags.string({ description: pickFlagHelp([EXPECT_SAMPLES_FILE_FLAG]) }),
55884
+ [SAME_EMAILS_FLAG]: Flags.string({ description: `Test the same emails as an earlier test: a file holding what test-email-rule --json printed. Sets email_ids to its results' email_id, over any in --body-file or --raw-body, so two trees are compared over the same mail; a test of recent mail covers the newest emails, which move on as mail arrives. At most ${EMAIL_IDS_MAX} emails, counting the expected ones a test adds (a saved rule's own, with --rule-id).` }),
54934
55885
  ...scopeSelectionFlags()
54935
55886
  },
54936
- bodyFields: (flags, base) => [...expectBodyFields(flags), ...scopeSelectionBodyFields(flags, base)],
55887
+ bodyFields: (flags, base) => {
55888
+ const expect = expectBodyFields(flags);
55889
+ const same = sameEmailsBodyFields(flags);
55890
+ checkSameEmailsWithExpected(same, expect, base);
55891
+ return [
55892
+ ...expect,
55893
+ ...same,
55894
+ ...scopeSelectionBodyFields(flags, base)
55895
+ ];
55896
+ },
54937
55897
  bodyProperties: ["expect", "scope_selection"],
54938
55898
  fallbackExitCode: (data) => {
54939
55899
  const expectations = data?.expectations;
@@ -55005,7 +55965,8 @@ const EMAIL_RULE_OPERATION_EXTENSIONS = {
55005
55965
  testEmailRuleOnSample: {
55006
55966
  flags: scopeSelectionFlags(),
55007
55967
  bodyFields: scopeSelectionBodyFields,
55008
- bodyProperties: ["scope_selection"]
55968
+ bodyProperties: ["scope_selection"],
55969
+ report: testSampleProtectionReport
55009
55970
  },
55010
55971
  acceptEmailRuleRequest: {
55011
55972
  flags: {
@@ -55013,7 +55974,8 @@ const EMAIL_RULE_OPERATION_EXTENSIONS = {
55013
55974
  [PICK_FLAG]: Flags.string({ description: pickFlagHelp([SAMPLES_FILE_FLAG]) })
55014
55975
  },
55015
55976
  bodyFields: samplesBodyFields(false),
55016
- bodyProperties: ["expectation_samples"]
55977
+ bodyProperties: ["expectation_samples"],
55978
+ report: acceptEmailRuleRequestReport
55017
55979
  },
55018
55980
  compileEmailRule: {
55019
55981
  flags: scopeSelectionFlags(),
@@ -55293,7 +56255,7 @@ function unknownEventTypes(eventTypes) {
55293
56255
  function unknownEventTypesWarning(unknown) {
55294
56256
  return `Warning: ${unknown.join(", ")} ${unknown.length === 1 ? "is" : "are"} not an event type this CLI knows. Subscriptions match exact names, so a misspelled name receives nothing. Continuing; newer event types may not be known to this CLI yet.\n`;
55295
56257
  }
55296
- function isPlainObject$1(value) {
56258
+ function isPlainObject(value) {
55297
56259
  return value !== null && typeof value === "object" && !Array.isArray(value);
55298
56260
  }
55299
56261
  /**
@@ -55306,16 +56268,16 @@ async function currentEndpointRules(endpointId, listEndpoints) {
55306
56268
  if (response.error) throw new EventTypesFlagError("Could not read the endpoint's current rules to keep them. Retry, or pass the full rules with --raw-body.");
55307
56269
  const row = (response.data?.data ?? []).find((endpoint) => endpoint.id === endpointId);
55308
56270
  if (!row) throw new EventTypesFlagError(`No endpoint ${endpointId} is visible to this credential, so its rules cannot be updated.`);
55309
- return isPlainObject$1(row.rules) ? row.rules : {};
56271
+ return isPlainObject(row.rules) ? row.rules : {};
55310
56272
  }
55311
56273
  /**
55312
56274
  * Put `eventTypes` in the request body's `rules.event_types`, on top of
55313
56275
  * `baseRules` (rules the caller passed in the body win over `baseRules`).
55314
56276
  */
55315
56277
  function withEventTypes(body, eventTypes, baseRules = {}) {
55316
- if (body !== void 0 && !isPlainObject$1(body)) throw new EventTypesFlagError("--raw-body must be a JSON object when also passing --event-types.");
56278
+ if (body !== void 0 && !isPlainObject(body)) throw new EventTypesFlagError("--raw-body must be a JSON object when also passing --event-types.");
55317
56279
  const current = body ?? {};
55318
- if (current.rules !== void 0 && !isPlainObject$1(current.rules)) throw new EventTypesFlagError("rules in --raw-body must be a JSON object when also passing --event-types.");
56280
+ if (current.rules !== void 0 && !isPlainObject(current.rules)) throw new EventTypesFlagError("rules in --raw-body must be a JSON object when also passing --event-types.");
55319
56281
  const explicitRules = current.rules ?? {};
55320
56282
  return {
55321
56283
  ...current,
@@ -55328,115 +56290,7 @@ function withEventTypes(body, eventTypes, baseRules = {}) {
55328
56290
  }
55329
56291
  /** True when the caller already passed `rules` in the request body. */
55330
56292
  function bodyHasRules(body) {
55331
- return isPlainObject$1(body) && body.rules !== void 0;
55332
- }
55333
- // src/oclif/endpoint-url-shown.ts
55334
- /** The commands whose answers carry endpoints, by operation sdkName. */
55335
- const ENDPOINT_URL_OPERATIONS = /* @__PURE__ */ new Set([
55336
- "getEndpoint",
55337
- "listEndpoints",
55338
- "createEndpoint",
55339
- "updateEndpoint"
55340
- ]);
55341
- /** The commands that send a URL, whose value is checked for the placeholder. */
55342
- const ENDPOINT_URL_WRITE_OPERATIONS = /* @__PURE__ */ new Set(["createEndpoint", "updateEndpoint"]);
55343
- /** What a hidden query string is replaced with. */
55344
- const HIDDEN_QUERY = "?... (query hidden)";
55345
- const SHOW_URL_FLAG_DESCRIPTION = "Print each webhook URL in full, its query string included. Without it the query string is shown as ?... (query hidden), with url_query_hidden: true on the endpoint, because it can carry a secret such as a deployment protection bypass token.";
55346
- /**
55347
- * Said when an answer had a URL shortened: on stderr without --json, and in
55348
- * the document's summary with --json --envelope.
55349
- */
55350
- const HIDDEN_QUERY_NOTE = "A webhook URL's query string is hidden, as it can carry a secret. Pass --show-url to print it in full.";
55351
- /**
55352
- * The URL with its query string, and anything after it, replaced by
55353
- * HIDDEN_QUERY; null when it has no query string. A `?` after a `#` is part
55354
- * of the fragment, not a query.
55355
- */
55356
- function urlWithQueryHidden(url) {
55357
- const query = url.indexOf("?");
55358
- if (query < 0) return null;
55359
- const fragment = url.indexOf("#");
55360
- if (fragment >= 0 && fragment < query) return null;
55361
- return `${url.slice(0, query)}${HIDDEN_QUERY}`;
55362
- }
55363
- function hideOne(endpoint) {
55364
- if (endpoint === null || typeof endpoint !== "object" || Array.isArray(endpoint)) return {
55365
- value: endpoint,
55366
- hidden: false
55367
- };
55368
- const url = endpoint.url;
55369
- const shown = typeof url === "string" ? urlWithQueryHidden(url) : null;
55370
- if (shown === null) return {
55371
- value: endpoint,
55372
- hidden: false
55373
- };
55374
- return {
55375
- value: {
55376
- ...endpoint,
55377
- url: shown,
55378
- url_query_hidden: true
55379
- },
55380
- hidden: true
55381
- };
55382
- }
55383
- /**
55384
- * An answer's data (one endpoint, or a list of them) with each URL's query
55385
- * string hidden, and whether any was.
55386
- */
55387
- function endpointsWithQueryHidden(data) {
55388
- if (!Array.isArray(data)) {
55389
- const one = hideOne(data);
55390
- return {
55391
- data: one.value,
55392
- hidden: one.hidden
55393
- };
55394
- }
55395
- let hidden = false;
55396
- return {
55397
- data: data.map((row) => {
55398
- const one = hideOne(row);
55399
- hidden ||= one.hidden;
55400
- return one.value;
55401
- }),
55402
- hidden
55403
- };
55404
- }
55405
- function isPlainObject(value) {
55406
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
55407
- const prototype = Object.getPrototypeOf(value);
55408
- return prototype === Object.prototype || prototype === null;
55409
- }
55410
- /** How deep errorWithQueryHidden looks into an error payload. */
55411
- const ERROR_DEPTH = 8;
55412
- /**
55413
- * An error answer with the query string hidden in every `url` it names, such
55414
- * as `details.holder.url` on a 409 for a slot another endpoint holds.
55415
- * Anything that is not a plain object or a list is left as it is.
55416
- */
55417
- function errorWithQueryHidden(payload, depth = 0) {
55418
- if (depth > ERROR_DEPTH) return payload;
55419
- if (Array.isArray(payload)) return payload.map((entry) => errorWithQueryHidden(entry, depth + 1));
55420
- if (!isPlainObject(payload)) return payload;
55421
- const out = {};
55422
- for (const [key, value] of Object.entries(payload)) out[key] = errorWithQueryHidden(value, depth + 1);
55423
- return hideOne(out).value;
55424
- }
55425
- /**
55426
- * A query string as a partial copy of HIDDEN_QUERY leaves it: a terminal's
55427
- * word selection stops at its first space, after `?...`.
55428
- */
55429
- const HIDDEN_QUERY_START = "?...";
55430
- /**
55431
- * The refusal for a request body whose url is a URL as these commands print
55432
- * it with the query hidden, whole or cut at its first space, so a printed URL
55433
- * is never written back in place of the real one; null for any other body.
55434
- */
55435
- function hiddenQueryUrlRefusal(body) {
55436
- if (body === null || typeof body !== "object" || Array.isArray(body)) return null;
55437
- const url = body.url;
55438
- if (typeof url !== "string" || !url.includes(HIDDEN_QUERY_START)) return null;
55439
- return `The url carries ${HIDDEN_QUERY_START}, the start of ${HIDDEN_QUERY}, which is how the endpoint commands print a URL with its query string hidden, not the URL itself. Pass the full URL; \`primitive endpoints get <id> --show-url\` prints a webhook's URL in full.`;
56293
+ return isPlainObject(body) && body.rules !== void 0;
55440
56294
  }
55441
56295
  // src/oclif/endpoints-test-redirect.ts
55442
56296
  async function detectFunctionEndpoint(endpointId, listEndpoints) {
@@ -56054,8 +56908,30 @@ function formatScheduledSummary(noun, sent, idempotencyKey) {
56054
56908
  const byKey = idempotencyKey ? ` or \`primitive sent cancel --idempotency-key ${shellQuote(idempotencyKey)}\`` : "";
56055
56909
  return `${noun} ${verb}${when} (id ${sent.id}). Nothing has gone out yet. Do not resend. To cancel it before then, run \`primitive sent cancel --id ${sent.id}\`${byKey}.`;
56056
56910
  }
56057
- function formatSendFailureSummary(noun, outcome, httpStatus) {
56058
- if (outcome === "not_sent") return `${noun} not sent: ${httpStatus === void 0 ? "the request failed before sending" : `the API rejected the request (HTTP ${httpStatus})`}. Nothing went out; fix the problem before retrying.`;
56911
+ /**
56912
+ * The API's own words for a refusal (`message` on its error), on one line and
56913
+ * ending in a full stop, or undefined when it gave none.
56914
+ */
56915
+ function sendErrorMessage(payload) {
56916
+ const message = payload !== null && typeof payload === "object" ? payload.message : void 0;
56917
+ if (typeof message !== "string") return void 0;
56918
+ const line = sanitizeForTerminal(message).replaceAll(/\s+/g, " ").trim();
56919
+ if (!line) return void 0;
56920
+ const cut = line.length > SEND_ERROR_MESSAGE_MAX ? `${line.slice(0, SEND_ERROR_MESSAGE_MAX - 3).trimEnd()}...` : line;
56921
+ return /[.!?]["')\]]*$/.test(cut) ? cut : `${cut}.`;
56922
+ }
56923
+ /** The longest API message the failure line repeats; the error itself follows in full. */
56924
+ const SEND_ERROR_MESSAGE_MAX = 300;
56925
+ /**
56926
+ * The one line that says a send failed. A refusal leads with what the API
56927
+ * said was wrong (`message`, from sendErrorMessage), so the first line read
56928
+ * names the problem rather than only its status.
56929
+ */
56930
+ function formatSendFailureSummary(noun, outcome, httpStatus, message) {
56931
+ if (outcome === "not_sent") {
56932
+ if (message) return `${noun} not sent${httpStatus === void 0 ? "" : ` (HTTP ${httpStatus})`}: ${message} Nothing went out; fix the problem before retrying.`;
56933
+ return `${noun} not sent: ${httpStatus === void 0 ? "the request failed before sending" : `the API rejected the request (HTTP ${httpStatus})`}. Nothing went out; fix the problem before retrying.`;
56934
+ }
56059
56935
  return `${noun} send outcome uncertain (${httpStatus === void 0 ? "no response from the API" : `HTTP ${httpStatus}`}): it may or may not have gone out. Do not resend blindly; check sent history first.`;
56060
56936
  }
56061
56937
  function priorRepliesThatWentOut(replies, options = {}) {
@@ -56325,11 +57201,11 @@ function reportSendCommandResult(params) {
56325
57201
  let errorPayload = null;
56326
57202
  if (params.result.error) {
56327
57203
  errorPayload = extractErrorPayload(params.result.error);
56328
- params.onApiError(errorPayload);
56329
57204
  const failure = classifySendError(httpStatus, errorPayload);
56330
57205
  outcome = failure;
56331
- outcomeMessage = failure === "already_sent" ? formatDeletedEarlierSendNotice() : formatSendFailureSummary(params.noun, failure, httpStatus);
57206
+ outcomeMessage = failure === "already_sent" ? formatDeletedEarlierSendNotice() : formatSendFailureSummary(params.noun, failure, httpStatus, sendErrorMessage(errorPayload));
56332
57207
  if (!params.json) params.writeStderr(`${outcomeMessage}\n`);
57208
+ params.onApiError(errorPayload);
56333
57209
  } else {
56334
57210
  sent = params.result.data?.data ?? null;
56335
57211
  if (sent === null) {
@@ -57293,7 +58169,7 @@ function savedConnectedProfiles(configDir, exclude) {
57293
58169
  */
57294
58170
  async function otherProfiles(configDir, session, current) {
57295
58171
  if (session) try {
57296
- const { connectedProfilesForSession } = await import("./machine-session-BTkDAKda.js").then((n) => n.s);
58172
+ const { connectedProfilesForSession } = await import("./machine-session-DJoBSWTy.js").then((n) => n.s);
57297
58173
  return {
57298
58174
  inSession: true,
57299
58175
  profiles: connectedProfilesForSession(configDir, session, current)
@@ -58338,7 +59214,7 @@ function buildFlags(operation) {
58338
59214
  const bodyFieldFlagToProperty = /* @__PURE__ */ new Map();
58339
59215
  if (operation.hasJsonBody) {
58340
59216
  flags["raw-body"] = Flags.string({ description: "Full request body as raw JSON. Escape hatch for nested or complex fields (e.g. arrays); prefer per-field flags (e.g. --to, --from, --body-text) when available." });
58341
- flags["body-file"] = Flags.string({ description: "Path to a JSON file used as the request body. Same role as --raw-body for callers passing a saved payload." });
59217
+ flags["body-file"] = Flags.string({ description: `Path to a JSON file used as the request body. Same role as --raw-body for callers passing a saved payload.${BODY_FILE_HELP[operation.sdkName] ? ` ${BODY_FILE_HELP[operation.sdkName]}` : ""}` });
58342
59218
  const bodyFields = extractBodyFields(operation.requestSchema);
58343
59219
  const aliasesForOperation = OPERATION_FLAG_ALIASES[operation.sdkName];
58344
59220
  for (const field of bodyFields) {
@@ -58384,10 +59260,6 @@ function buildFlags(operation) {
58384
59260
  multiple: true
58385
59261
  });
58386
59262
  if (operation.binaryResponse) flags.output = Flags.string({ description: "Write binary response bytes to a file" });
58387
- if (ENDPOINT_URL_OPERATIONS.has(operation.sdkName)) {
58388
- if (flags["show-url"] !== void 0) throw new Error(`${operation.sdkName}: --show-url is both a generated flag and the CLI's own`);
58389
- flags["show-url"] = Flags.boolean({ description: SHOW_URL_FLAG_DESCRIPTION });
58390
- }
58391
59263
  if (ATTACHMENT_WAIT_OPERATIONS.has(operation.sdkName)) flags.wait = Flags.boolean({
58392
59264
  allowNo: true,
58393
59265
  default: true,
@@ -58483,13 +59355,40 @@ const OPERATION_HINTS = {
58483
59355
  getMemory: "Tip: prefer `primitive memories get <key> [--function <function-id>]` for the common read path.",
58484
59356
  deleteMemory: "Tip: prefer `primitive memories delete <key> [--function <function-id>]` for the common delete path.",
58485
59357
  searchMemories: "Tip: prefer `primitive memories search [prefix] [--metadata-only] [--function <function-id>]` for the common search path.",
59358
+ listEmails: "Tip: for a one-line-per-email table, `primitive emails latest --limit 100`.",
58486
59359
  createEmailRuleObjection: "Tip: say in --message (up to 500 characters) what you want. It can ask for less than turning the rule off: ask the author to narrow the rule, or to explain where its matches go (its receivers). The author accepts, which turns the rule off, or declines, optionally giving a reason, which you see in `primitive email-rule-oversight get-email-rule-objection <objection-id>`. You can withdraw it with `primitive email-rule-oversight withdraw-email-rule-objection <objection-id>`. Objecting does not change the rule.",
58487
- declineEmailRuleObjection: "Tip: the member who objected sees --reason (up to 500 characters). When the objection asked you to narrow the rule or explain a receiver, the reason can answer that: say what you changed, or what the receiver is for.",
59360
+ declineEmailRuleObjection: "Tip: the member who objected sees --reason (up to 500 characters). If you narrow the rule instead of turning it off, decline with a reason saying what you changed: accepting turns the rule off, and the member sees the reason on the objection. When the objection asked you to explain a receiver, the reason can say what the receiver is for.",
58488
59361
  listEndpoints: "Tip: without --json, a table on stderr after the JSON shows each endpoint's ENABLED and DELIVERING. DELIVERING is read from delivery.delivering, whether a webhook is being sent mail at all, not from enabled: an endpoint can be enabled and still not be delivering (its owner's key revoked, say), shown as no with the reason codes in parentheses. A webhook whose delivery could not be checked shows unknown, and a Function or pull endpoint shows -.",
58489
59362
  startAgentSignup: "Tip: pass --terms-accepted. Capture the signup_token from the response and feed it to `primitive agent verify-agent-signup --signup-token <token> --verification-code <6-digit-code>` (the verify flag accepts --code as an alias). The high-level `primitive signup <email>` command walks an interactive user through both steps with friendlier prompts.",
58490
59363
  testEmailRule: "Tip: --expect-match and --expect-no-match (or --expect-file) set expect, the emails the rule must match and must not. When no expect is sent, by these flags or in the body, a saved rule's saved expectations are judged instead. Either way, the answer reports the expectations it judged in expectations: passed, counts and per-email results. (create-email-rule and update-email-rule instead judge the rule's saved expectations on the version they save, in expectations_check: passed, decided, failed and undecided.) The exit code follows that report: 1 when one failed; 1 when one is undecided and testing again will not decide it (its email cannot be found or read, cannot be classified, or cannot be tested: skipped); 3 when the only undecided ones can be decided later (not classified yet, or a question unanswered), so test again later. Exit 1 also means the request failed. With --json, error.code tells these apart: expectations_failed, expectations_unresolvable, expectations_undecided (exit 3), or the API's own code. Without --json a readable report follows the JSON on stderr: warnings, how each condition held, the expectations, and the values each email that did not match was compared on.",
58491
59364
  verifyAgentSignup: "Tip: pass --verification-code <code> (or --code; both work). The response carries OAuth tokens but not your assigned inbox domain; run `primitive domains list` (or `primitive whoami`) after success to see the managed *.primitive.email address that routes to this account."
58492
59365
  };
59366
+ /**
59367
+ * A top-level text field of `body` longer than the spec's maxLength for it,
59368
+ * said as a refusal, or undefined. Counted after trimming the ends, by code
59369
+ * point, which is never more than the API counts, so nothing the API would
59370
+ * take is refused here; a message over the limit is refused before it is
59371
+ * sent rather than by the API after typing it.
59372
+ */
59373
+ function overLongBodyField(schema, body) {
59374
+ if (body === null || typeof body !== "object" || Array.isArray(body)) return void 0;
59375
+ const properties = schema?.properties;
59376
+ if (!properties) return void 0;
59377
+ for (const [field, value] of Object.entries(body)) {
59378
+ const max = properties[field]?.maxLength;
59379
+ if (typeof value !== "string" || typeof max !== "number") continue;
59380
+ const length = Array.from(value.trim()).length;
59381
+ if (length > max) return `${field} is ${length} characters; the API takes at most ${max}. Nothing was sent.`;
59382
+ }
59383
+ }
59384
+ /** What a write that takes a compile answer reads from --body-file, said beside the generic help. */
59385
+ const COMPILE_ANSWER = "the answer `compile-email-rule --json` printed (without --include-sql), unchanged: save it to a file";
59386
+ const BODY_FILE_HELP = {
59387
+ createEmailRule: `For this command, ${COMPILE_ANSWER}, and add --english with the description you compiled, and --name. The answer carries no scope: pass --evaluation-scope again if you compiled with one.`,
59388
+ updateEmailRule: `For a new version, ${COMPILE_ANSWER}, and add --english with the description you compiled (required with a new tree); --name only to rename it.`,
59389
+ createEmailRuleRequest: `For this command, ${COMPILE_ANSWER}, and add --english with the description you compiled, --name and --target-email.`,
59390
+ acceptEmailRuleRequest: `To change the rule as you accept it, ${COMPILE_ANSWER}, and add --english with the description you compiled.`
59391
+ };
58493
59392
  const OPERATION_FLAG_ALIASES = { verifyAgentSignup: { verification_code: ["code"] } };
58494
59393
  const OPERATION_EXTRA_BODY_FLAGS = { addDomain: { "mail-relay": {
58495
59394
  property: "mail_relay",
@@ -58575,13 +59474,6 @@ function createOperationCommand(operation) {
58575
59474
  "verifyAgentSignup",
58576
59475
  "resendAgentSignupVerification"
58577
59476
  ].includes(operation.operationId)) requireDefaultLoginProfile();
58578
- const prereadBody = ENDPOINT_URL_WRITE_OPERATIONS.has(operation.sdkName) && operation.hasJsonBody ? { value: readJsonBody(parsedFlags) } : void 0;
58579
- if (prereadBody) {
58580
- const urlFlag = [...bodyFieldFlagToProperty].find(([, property]) => property === "url")?.[0];
58581
- const flagUrl = urlFlag ? parsedFlags[urlFlag] : void 0;
58582
- const refusal = hiddenQueryUrlRefusal(typeof flagUrl === "string" ? { url: flagUrl } : prereadBody.value);
58583
- if (refusal) throw new Errors.CLIError(refusal, { exit: 2 });
58584
- }
58585
59477
  await runWithTiming(parsedFlags.time === true, async () => {
58586
59478
  const { apiClient, auth, baseUrlOverridden } = await createAuthenticatedCliApiClient({
58587
59479
  apiKey: typeof parsedFlags["api-key"] === "string" ? parsedFlags["api-key"] : void 0,
@@ -58590,7 +59482,7 @@ function createOperationCommand(operation) {
58590
59482
  });
58591
59483
  let body;
58592
59484
  if (operation.hasJsonBody) {
58593
- const explicit = prereadBody ? prereadBody.value : readJsonBody(parsedFlags);
59485
+ const explicit = readJsonBody(parsedFlags);
58594
59486
  const overrides = collectBodyFieldFlags(parsedFlags, bodyFieldFlagToProperty);
58595
59487
  const extensionFlagFor = /* @__PURE__ */ new Map();
58596
59488
  for (const field of extension?.bodyFields?.(parsedFlags, explicit) ?? []) {
@@ -58610,10 +59502,6 @@ function createOperationCommand(operation) {
58610
59502
  }
58611
59503
  } else body = explicit;
58612
59504
  }
58613
- if (ENDPOINT_URL_WRITE_OPERATIONS.has(operation.sdkName)) {
58614
- const refusal = hiddenQueryUrlRefusal(body);
58615
- if (refusal) throw new Errors.CLIError(refusal, { exit: 2 });
58616
- }
58617
59505
  if (EVENT_TYPES_FLAG_OPERATIONS.has(operation.sdkName) && Array.isArray(parsedFlags["event-types"])) body = await applyEventTypesFlag({
58618
59506
  body,
58619
59507
  values: parsedFlags["event-types"],
@@ -58625,6 +59513,8 @@ function createOperationCommand(operation) {
58625
59513
  quiet: parsedFlags.json === true
58626
59514
  });
58627
59515
  if (operation.bodyRequired && body === void 0) throw new Errors.CLIError(`Operation ${operation.operationId} requires a body. Pass each field as a --flag (see --help) or supply JSON via --raw-body / --body-file.`);
59516
+ const tooLong = overLongBodyField(operation.requestSchema, body);
59517
+ if (tooLong) throw new Errors.CLIError(tooLong, { exit: 2 });
58628
59518
  const operationFn = sdk_gen_exports[operation.sdkName];
58629
59519
  const query = collectValues(operation.queryParams, parsedFlags, operation.sdkName);
58630
59520
  const replyStateSurface = replyStateSurfaceForOperation(operation.sdkName, query);
@@ -58733,7 +59623,7 @@ function createOperationCommand(operation) {
58733
59623
  if (result.error) {
58734
59624
  const errorPayload = extractErrorPayload(result.error);
58735
59625
  const operationErrorHint = OPERATION_ERROR_HINTS[operation.sdkName]?.(extractErrorCode(errorPayload), body, errorPayload, collectValues(operation.pathParams, parsedFlags, operation.sdkName), parsedFlags);
58736
- writeErrorWithHints(ENDPOINT_URL_OPERATIONS.has(operation.sdkName) && parsedFlags["show-url"] !== true ? errorWithQueryHidden(errorPayload) : errorPayload, result.response, { codeHint: !(operationErrorHint && OPERATION_ERROR_HINTS_REPLACING_CODE_HINT.has(operation.sdkName)) });
59626
+ writeErrorWithHints(errorPayload, result.response, { codeHint: !(operationErrorHint && OPERATION_ERROR_HINTS_REPLACING_CODE_HINT.has(operation.sdkName)) });
58737
59627
  if (operationErrorHint) process.stderr.write(`${operationErrorHint}\n`);
58738
59628
  if (stepUpUrl) process.stderr.write(approveThenRerunHint(stepUpUrl));
58739
59629
  if (replyStateSurface && isAwaitingRejectedError(errorPayload)) process.stderr.write(`${awaitingRejectedError(replyStateSurface).message}\n`);
@@ -58881,26 +59771,12 @@ function createOperationCommand(operation) {
58881
59771
  }
58882
59772
  };
58883
59773
  }
58884
- let shownEnvelope = envelope;
58885
- let queryHidden = false;
58886
- if (ENDPOINT_URL_OPERATIONS.has(operation.sdkName) && parsedFlags["show-url"] !== true && envelope) {
58887
- const shown = endpointsWithQueryHidden(envelope.data);
58888
- if (shown.hidden) {
58889
- shownEnvelope = {
58890
- ...envelope,
58891
- data: shown.data
58892
- };
58893
- queryHidden = true;
58894
- if (jsonOutput && withEnvelope) summary.push(HIDDEN_QUERY_NOTE);
58895
- }
58896
- }
58897
- let printed = jsonOutput && withEnvelope ? operationJsonDocument(shownEnvelope, summary) : operationOutputPayload(shownEnvelope, withEnvelope);
59774
+ let printed = jsonOutput && withEnvelope ? operationJsonDocument(envelope, summary) : operationOutputPayload(envelope, withEnvelope);
58898
59775
  if (jsonOutput && report?.exitCode && report.error && printed !== null && typeof printed === "object" && !Array.isArray(printed)) printed = {
58899
59776
  ...printed,
58900
59777
  error: report.error
58901
59778
  };
58902
59779
  this.log(JSON.stringify(printed, null, 2));
58903
- if (queryHidden && !jsonOutput) process.stderr.write(`${HIDDEN_QUERY_NOTE}\n`);
58904
59780
  if (reportError !== void 0) process.stderr.write(`Warning: ${operation.sdkName} succeeded but its report could not be built (${reportError}). The JSON above is the full answer; read it rather than the exit code.\n`);
58905
59781
  if (report && !jsonOutput) for (const line of report.lines) process.stderr.write(`${line}\n`);
58906
59782
  if (reportError !== void 0 && report?.exitCode && !jsonOutput) process.stderr.write(`The answer's expectations were not all shown to pass, so the command exits ${report.exitCode}.\n`);
@@ -58934,4 +59810,4 @@ function emptyDeliveriesHint(sdkName, query) {
58934
59810
  function canonicalizeCliReferences(description) {
58935
59811
  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'`");
58936
59812
  }
58937
- export { interactionNextActions as $, ConnectedAgentKeyRequiredError as $t, openBrowser as A, DEFAULT_ENROLL_NAME as At, serverRelationship as B, runtimeSessionVariableList as Bt, approveThenRerunHint as C, sendIdentityFields as Ct, canOfferCopyHotkey as D, serializeErrorPayload as Dt, withApproval as E, sentHistoryWindowStart as Et, formatMailWakeLine as F, identitySuggestions as Ft, claimPendingMail as G, readCallerMailFor as Gt, wakeReadCommand as H, withFlagSuggestion as Ht, latestOwnOutbound as I, loadSkillLine as It, pendingMailPath as J, isEmailId as Jt, clearConsumedPendingMail as K, classificationFactLines as Kt, readThreadContext as L, currentMailSessionKey as Lt, bareAddress$1 as M, connectNextSteps as Mt, describeWake as N, defaultConnectionName as Nt, formatBrowserLoginInstructions as O, successfulSendOutcome as Ot, displayAddress as P, generatedAgentName as Pt, interactionHumanLine as Q, withAttachmentWait as Qt, sentInThread as R, detectAgentRuntime as Rt, STEP_UP_TOKEN_FLAG_DESCRIPTION as S, reportSendCommandResult as St, terminalApprovalIo as T, sendWaitClampNotice as Tt, wakeRecipientField as U, emptyEmailListHint as Ut, skillFirstLine as V, formatAlreadySentNotice as Vt, wakeRelationship as W, mailReach as Wt, recordPendingMail as X, ATTACHMENT_WAIT_FLAG_DESCRIPTION as Xt, readPendingMail as Y, noFactsMessage as Yt, removePendingMail as Z, ATTACHMENT_WAIT_MAX_MS as Zt, surfaceUnauthorizedHint as _, sanitizeForTerminal as _n, formatPriorRepliesCheckSkipped as _t, createOperationCommand as a, resolveCliApiRequestConfig as an, MAX_SEND_WAIT_TIMEOUT_MS as at, BROWSER_FLAG_DESCRIPTION as b, formatSendRecordFailureSummary as bt, formatErrorPayload as c, RESTRICTED_ROLE_NOTE as cn, assertValidIdempotencyKey as ct, isGrantRefusal as d, isBuiltInRoleKey as dn, checkPriorReplies as dt, SAVED_CLI_OAUTH_SESSION_EXPIRED_MESSAGE as en, readEmailInteraction as et, networkErrorHint as f, revokeUserLogin as fn, classifySendError as ft, runWithTiming as g, routeWarningLines as gn, formatDeletedEarlierSendNotice as gt, refusalDetails as h, switchCurrentOrg as hn, followUpCommandPrefix as ht, TIME_FLAG_DESCRIPTION as i, refuseOrgSelectionForProfile as in, IDEMPOTENCY_KEY_FLAG_DESCRIPTION as it, explainPendingMailNotFound as j, cliInvocation as jt, listenForCopyHotkey as k, thrownErrorExitCode as kt, hasControlCharacter as l, credentialsFromUserLogin as ln, buildFollowUpCommand as lt, readTextFileFlag as m, roleKeyText as mn, excludeSignalReplies as mt, API_ERROR_CODES as n, createCliApiClient as nn, replyInteractionWarning as nt, extractErrorCode as o, selectedOrgFromEnv as on, SEND_OUTCOME_HELP as ot, parameterFlagName as p, roleKeyLabel as pn, deriveSendIdempotencyKey as pt, clearReadPendingMail as q, classificationOf as qt, OPERATION_PATH_FLAGS as r, refreshStoredCliCredentials as rn, wakeInteractionSentence as rt, extractErrorPayload as s, CliOrgRefusedError as sn, apiResultHttpStatus as st, API_BASE_URL_FLAG_DESCRIPTION as t, createAuthenticatedCliApiClient as tn, replyExpectation as tt, headerFlagName as u, fetchCliOrgs as un, buildThrownSendFailureEnvelope as ut, takesStepUp as v, setKnownCommands as vn, formatPriorRepliesWarning as vt, promptLine as w, sendOutcomeExitCode as wt, STEP_UP_HEADER as x, priorRepliesThatWentOut as xt, writeErrorWithHints as y, operationManifest as yn, formatSendFailureSummary as yt, serverMuted as z, detectRuntimeSession as zt };
59813
+ export { interactionNextActions as $, withAttachmentWait as $t, openBrowser as A, thrownErrorExitCode as At, serverRelationship as B, detectRuntimeSession as Bt, approveThenRerunHint as C, sendErrorMessage as Ct, canOfferCopyHotkey as D, sentHistoryWindowStart as Dt, withApproval as E, sendWaitClampNotice as Et, formatMailWakeLine as F, generatedAgentName as Ft, claimPendingMail as G, mailReach as Gt, wakeReadCommand as H, formatAlreadySentNotice as Ht, latestOwnOutbound as I, identitySuggestions as It, pendingMailPath as J, classificationOf as Jt, clearConsumedPendingMail as K, readCallerMailFor as Kt, readThreadContext as L, loadSkillLine as Lt, bareAddress$1 as M, cliInvocation as Mt, describeWake as N, connectNextSteps as Nt, formatBrowserLoginInstructions as O, serializeErrorPayload as Ot, displayAddress as P, defaultConnectionName as Pt, interactionHumanLine as Q, ATTACHMENT_WAIT_MAX_MS as Qt, sentInThread as R, currentMailSessionKey as Rt, STEP_UP_TOKEN_FLAG_DESCRIPTION as S, reportSendCommandResult as St, terminalApprovalIo as T, sendOutcomeExitCode as Tt, wakeRecipientField as U, withFlagSuggestion as Ut, skillFirstLine as V, runtimeSessionVariableList as Vt, wakeRelationship as W, emptyEmailListHint as Wt, recordPendingMail as X, noFactsMessage as Xt, readPendingMail as Y, isEmailId as Yt, removePendingMail as Z, ATTACHMENT_WAIT_FLAG_DESCRIPTION as Zt, surfaceUnauthorizedHint as _, routeWarningLines as _n, formatPriorRepliesCheckSkipped as _t, createOperationCommand as a, refuseOrgSelectionForProfile as an, MAX_SEND_WAIT_TIMEOUT_MS as at, BROWSER_FLAG_DESCRIPTION as b, operationManifest as bn, formatSendRecordFailureSummary as bt, formatErrorPayload as c, CliOrgRefusedError as cn, assertValidIdempotencyKey as ct, isGrantRefusal as d, fetchCliOrgs as dn, checkPriorReplies as dt, ConnectedAgentKeyRequiredError as en, readEmailInteraction as et, networkErrorHint as f, isBuiltInRoleKey as fn, classifySendError as ft, runWithTiming as g, switchCurrentOrg as gn, formatDeletedEarlierSendNotice as gt, refusalDetails as h, roleKeyText as hn, followUpCommandPrefix as ht, TIME_FLAG_DESCRIPTION as i, refreshStoredCliCredentials as in, IDEMPOTENCY_KEY_FLAG_DESCRIPTION as it, explainPendingMailNotFound as j, DEFAULT_ENROLL_NAME as jt, listenForCopyHotkey as k, successfulSendOutcome as kt, hasControlCharacter as l, RESTRICTED_ROLE_NOTE as ln, buildFollowUpCommand as lt, readTextFileFlag as m, roleKeyLabel as mn, excludeSignalReplies as mt, API_ERROR_CODES as n, createAuthenticatedCliApiClient as nn, replyInteractionWarning as nt, extractErrorCode as o, resolveCliApiRequestConfig as on, SEND_OUTCOME_HELP as ot, parameterFlagName as p, revokeUserLogin as pn, deriveSendIdempotencyKey as pt, clearReadPendingMail as q, classificationFactLines as qt, OPERATION_PATH_FLAGS as r, createCliApiClient as rn, wakeInteractionSentence as rt, extractErrorPayload as s, selectedOrgFromEnv as sn, apiResultHttpStatus as st, API_BASE_URL_FLAG_DESCRIPTION as t, SAVED_CLI_OAUTH_SESSION_EXPIRED_MESSAGE as tn, replyExpectation as tt, headerFlagName as u, credentialsFromUserLogin as un, buildThrownSendFailureEnvelope as ut, takesStepUp as v, sanitizeForTerminal as vn, formatPriorRepliesWarning as vt, promptLine as w, sendIdentityFields as wt, STEP_UP_HEADER as x, priorRepliesThatWentOut as xt, writeErrorWithHints as y, setKnownCommands as yn, formatSendFailureSummary as yt, serverMuted as z, detectAgentRuntime as zt };