@primitivedotdev/cli 3.0.0-preview.19 → 3.0.0-preview.20

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,8 +1,10 @@
1
- import { Bn as sdk_gen_exports, C as parseRetryAfter, H as assertAwaitingFilterRows, J as isAwaitingRejectedError, Jt as getOwnGrant, Qt as getThread, U as awaitingRejectedError, V as ReplyStateUnsupportedError, W as ensureSearchReportsReplyState, X as replyStateSurfaceForOperation, at as expectedAutomatedVerdicts, et as AutomatedFilterUnsupportedError, fn as listEndpoints, it as ensureSearchReportsAutomated, ln as listDomains, nt as automatedRejectedError, rt as automatedSurfaceForOperation, st as isAutomatedRejectedError, tt as assertAutomatedVerdict, zt as getEmail } from "./repeats-Dj_o6c-X-DTtFzwNd.js";
1
+ import { $t as getThread, Bt as getEndpoint, C as parseRetryAfter, H as assertAwaitingFilterRows, J as isAwaitingRejectedError, U as awaitingRejectedError, V as ReplyStateUnsupportedError, Vn as sdk_gen_exports, W as ensureSearchReportsReplyState, X as replyStateSurfaceForOperation, Yt as getOwnGrant, at as expectedAutomatedVerdicts, et as AutomatedFilterUnsupportedError, it as ensureSearchReportsAutomated, nt as automatedRejectedError, pn as listEndpoints, rt as automatedSurfaceForOperation, st as isAutomatedRejectedError, tt as assertAutomatedVerdict, un as listDomains, zt as getEmail } from "./repeats-Dj_o6c-X-CliyH3ge.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
- import { a as thrownErrorBody } from "./json-output-saHY68hr.js";
4
+ import { a as assertRequiredBodyFields, i as operationHelpInputs } from "./help-inputs-NGARVZL_.js";
5
+ import { a as thrownErrorBody } from "./json-output-xgN0ZLWP.js";
5
6
  import { d as readMailJson, h as writeMailJson, m as withMailLock, p as syncMailDirectory, u as privateMailPermissions } from "./shared-mail-files-BAQSGxxz.js";
7
+ import { a as writeRetryIdNotice, n as rememberRetryIds, r as retryIdFields, t as prepareRetryIds } from "./retry-ids-04ZPJCZY.js";
6
8
  import { Args, Command, Errors, Flags } from "@oclif/core";
7
9
  import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
8
10
  import { createHash, randomUUID } from "node:crypto";
@@ -13572,7 +13574,7 @@ const operationManifest = [
13572
13574
  "pathParams": [],
13573
13575
  "queryParams": [],
13574
13576
  "headerParams": [{
13575
- "description": "A single-use step-up token of purpose `org_settings.write` (Change the organization name, logo, semantic search setting or email notification settings), valid 5 minutes. When this operation answers 403 `step_up_required`, the person confirms at the link in `details.step_up_url` and the request is retried with the token that page shows, in this header. Accepted only with the person's own OAuth token of the client it was confirmed for; refused with a token issued for MCP, with any API key or agent connection key, and with a dashboard session.",
13577
+ "description": "A single-use step-up token of purpose `org_settings.write` (Change the organization name, logo, semantic search setting, email notification settings or whether email rules read attachments), valid 5 minutes. When this operation answers 403 `step_up_required`, the person confirms at the link in `details.step_up_url` and the request is retried with the token that page shows, in this header. Accepted only with the person's own OAuth token of the client it was confirmed for; refused with a token issued for MCP, with any API key or agent connection key, and with a dashboard session.",
13576
13578
  "enum": null,
13577
13579
  "name": "Primitive-Step-Up",
13578
13580
  "required": false,
@@ -14628,7 +14630,7 @@ const operationManifest = [
14628
14630
  "questions": {
14629
14631
  "type": "array",
14630
14632
  "items": { "type": "string" },
14631
- "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."
14633
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
14632
14634
  }
14633
14635
  },
14634
14636
  "required": [
@@ -14931,19 +14933,24 @@ const operationManifest = [
14931
14933
  "type": "boolean",
14932
14934
  "const": true
14933
14935
  },
14934
- "created_at": {
14936
+ "decided_at": {
14935
14937
  "type": "string",
14936
- "format": "date-time"
14938
+ "format": "date-time",
14939
+ "description": "When the rule made this decision."
14937
14940
  },
14938
14941
  "from_address": {
14939
14942
  "description": "The email's sender address, as GET /v1/emails/{id} shows it.",
14940
14943
  "type": ["string", "null"]
14941
14944
  },
14942
14945
  "subject": { "type": ["string", "null"] },
14946
+ "recipient": {
14947
+ "description": "Which of your mailboxes the email was received in.",
14948
+ "type": ["string", "null"]
14949
+ },
14943
14950
  "received_at": {
14944
14951
  "type": ["string", "null"],
14945
14952
  "format": "date-time",
14946
- "description": "When the email arrived. Null, with the other two, when you are not shown the email (it awaits sender authentication)."
14953
+ "description": "When the email arrived. Null, with from_address, subject and recipient, when you are not shown the email (it awaits sender authentication)."
14947
14954
  }
14948
14955
  },
14949
14956
  "required": [
@@ -14955,9 +14962,10 @@ const operationManifest = [
14955
14962
  "near_miss",
14956
14963
  "parts",
14957
14964
  "question_answers",
14958
- "created_at",
14965
+ "decided_at",
14959
14966
  "from_address",
14960
14967
  "subject",
14968
+ "recipient",
14961
14969
  "received_at"
14962
14970
  ]
14963
14971
  }
@@ -15240,7 +15248,7 @@ const operationManifest = [
15240
15248
  "questions": {
15241
15249
  "type": "array",
15242
15250
  "items": { "type": "string" },
15243
- "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."
15251
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
15244
15252
  }
15245
15253
  },
15246
15254
  "required": [
@@ -15780,7 +15788,7 @@ const operationManifest = [
15780
15788
  "description": "A condition {column, op, value?, min_confidence?} (see GET /email-rules/vocabulary) or {all: [...]}, {any: [...]}, {not: ...}."
15781
15789
  },
15782
15790
  "questions": {
15783
- "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. Left out, none.",
15791
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes. Left out, none.",
15784
15792
  "type": "array",
15785
15793
  "items": { "type": "string" }
15786
15794
  }
@@ -16010,6 +16018,147 @@ const operationManifest = [
16010
16018
  "type": "integer",
16011
16019
  "minimum": 0
16012
16020
  },
16021
+ "receivers": {
16022
+ "description": "On the list with all=true only: who receives what it matches now. Null when it could not be read in time.",
16023
+ "anyOf": [{
16024
+ "type": "object",
16025
+ "properties": {
16026
+ "keys": {
16027
+ "type": "array",
16028
+ "items": {
16029
+ "type": "object",
16030
+ "properties": {
16031
+ "owner": { "anyOf": [{
16032
+ "type": "object",
16033
+ "properties": {
16034
+ "kind": {
16035
+ "type": "string",
16036
+ "const": "member"
16037
+ },
16038
+ "user_id": {
16039
+ "type": "string",
16040
+ "description": "The member's user id.",
16041
+ "format": "uuid"
16042
+ },
16043
+ "name": {
16044
+ "description": "Their name; null when they have none set.",
16045
+ "type": ["string", "null"]
16046
+ }
16047
+ },
16048
+ "required": [
16049
+ "kind",
16050
+ "user_id",
16051
+ "name"
16052
+ ]
16053
+ }, {
16054
+ "type": "object",
16055
+ "properties": { "kind": {
16056
+ "type": "string",
16057
+ "const": "organization",
16058
+ "description": "Held by no member: an organization key, or one whose holder has left."
16059
+ } },
16060
+ "required": ["kind"]
16061
+ }] },
16062
+ "count": {
16063
+ "type": "integer",
16064
+ "exclusiveMinimum": 0
16065
+ }
16066
+ },
16067
+ "required": ["owner", "count"]
16068
+ },
16069
+ "description": "API keys that work now (not revoked, expired or suspended) and hold mail:read, whose access lists the rule or its live share. Owner: who holds each, or the organization."
16070
+ },
16071
+ "webhooks": {
16072
+ "type": "array",
16073
+ "items": {
16074
+ "type": "object",
16075
+ "properties": {
16076
+ "owner": { "anyOf": [{
16077
+ "type": "object",
16078
+ "properties": {
16079
+ "kind": {
16080
+ "type": "string",
16081
+ "const": "member"
16082
+ },
16083
+ "user_id": {
16084
+ "type": "string",
16085
+ "description": "The member's user id.",
16086
+ "format": "uuid"
16087
+ },
16088
+ "name": {
16089
+ "description": "Their name; null when they have none set.",
16090
+ "type": ["string", "null"]
16091
+ }
16092
+ },
16093
+ "required": [
16094
+ "kind",
16095
+ "user_id",
16096
+ "name"
16097
+ ]
16098
+ }, {
16099
+ "type": "object",
16100
+ "properties": { "kind": {
16101
+ "type": "string",
16102
+ "const": "organization",
16103
+ "description": "Held by no member: an organization key, or one whose holder has left."
16104
+ } },
16105
+ "required": ["kind"]
16106
+ }] },
16107
+ "count": {
16108
+ "type": "integer",
16109
+ "exclusiveMinimum": 0
16110
+ }
16111
+ },
16112
+ "required": ["owner", "count"]
16113
+ },
16114
+ "description": "Webhooks taking received mail, bounces or reports that are sent what it matches: those of the key delivery acts as, when it lists the rule or its live share (owner: its holder, or the organization), and those of the member it is shared with (owner: that member)."
16115
+ },
16116
+ "shares": {
16117
+ "type": "array",
16118
+ "items": {
16119
+ "type": "object",
16120
+ "properties": {
16121
+ "beneficiary": {
16122
+ "type": "object",
16123
+ "properties": {
16124
+ "kind": {
16125
+ "type": "string",
16126
+ "const": "member"
16127
+ },
16128
+ "user_id": {
16129
+ "type": "string",
16130
+ "description": "The member's user id.",
16131
+ "format": "uuid"
16132
+ },
16133
+ "name": {
16134
+ "description": "Their name; null when they have none set.",
16135
+ "type": ["string", "null"]
16136
+ }
16137
+ },
16138
+ "required": [
16139
+ "kind",
16140
+ "user_id",
16141
+ "name"
16142
+ ]
16143
+ },
16144
+ "count": {
16145
+ "type": "integer",
16146
+ "exclusiveMinimum": 0
16147
+ }
16148
+ },
16149
+ "required": ["beneficiary", "count"]
16150
+ },
16151
+ "description": "The rule's live share (at most one), by its member, if they can read it and it is among their newest 20 shares."
16152
+ }
16153
+ },
16154
+ "required": [
16155
+ "keys",
16156
+ "webhooks",
16157
+ "shares"
16158
+ ],
16159
+ "description": "Who receives what the rule shares, by person and count. Empty unless it is an active grant rule."
16160
+ }, { "type": "null" }]
16161
+ },
16013
16162
  "created_at": {
16014
16163
  "type": "string",
16015
16164
  "format": "date-time"
@@ -16052,7 +16201,7 @@ const operationManifest = [
16052
16201
  "questions": {
16053
16202
  "type": "array",
16054
16203
  "items": { "type": "string" },
16055
- "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."
16204
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
16056
16205
  }
16057
16206
  },
16058
16207
  "required": [
@@ -16163,15 +16312,21 @@ const operationManifest = [
16163
16312
  "type": ["boolean", "null"]
16164
16313
  },
16165
16314
  "activity": {
16166
- "description": "For the member it is shared with, on the dashboard or the Primitive CLI, while it is live and their access reads content: whether it is working, so a quiet mailbox can be told from a stopped share. Null otherwise, and when it could not be read.",
16315
+ "description": "For the member it is shared with, on the dashboard or the Primitive CLI, while it is live and their access reads content: whether it is working, so a quiet mailbox can be told from a stopped share (checked false when that could not be read just now). Null otherwise.",
16167
16316
  "anyOf": [{
16168
16317
  "type": "object",
16169
- "properties": { "last_decided_at": {
16170
- "type": ["string", "null"],
16171
- "format": "date-time",
16172
- "description": "The start of the hour in which the rule last decided on any email in the sharing member's mailboxes since the share began, counting only hours that have ended and the hour of the newest email shared; null if none."
16173
- } },
16174
- "required": ["last_decided_at"]
16318
+ "properties": {
16319
+ "last_decided_at": {
16320
+ "type": ["string", "null"],
16321
+ "format": "date-time",
16322
+ "description": "The start of the hour in which the rule last decided on any email in the sharing member's mailboxes since the share began, counting only hours that have ended and the hour of the newest email shared; null if none, or if it could not be checked."
16323
+ },
16324
+ "checked": {
16325
+ "type": "boolean",
16326
+ "description": "False when whether the share is working could not be read just now (last_decided_at is then null): read it again."
16327
+ }
16328
+ },
16329
+ "required": ["last_decided_at", "checked"]
16175
16330
  }, { "type": "null" }]
16176
16331
  },
16177
16332
  "is_granter": {
@@ -16377,7 +16532,7 @@ const operationManifest = [
16377
16532
  "binaryResponse": false,
16378
16533
  "bodyRequired": true,
16379
16534
  "command": "compile-email-rule",
16380
- "description": "Turns a plain-English description of which received emails to match into a rule over the column contract: rule, exactly the body create (with a name), update and the tests take, with an explanation of what it matches, the assumptions made, and warnings for what the columns cannot express. Where the columns fall short it adds up to five yes/no questions, asked only after the conditions match; they read the subject, the new text and attachment file names, never attachment contents. Nothing is read or saved: a scope given is carried into rule, and a test says how much mail the rule matches. include_sql returns the SQL it renders to. kind do_not_share compiles for recall. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
16535
+ "description": "Turns a plain-English description of which received emails to match into a rule over the column contract: rule, exactly the body create (with a name), update and the tests take, with an explanation of what it matches, the assumptions made, and warnings for what the columns cannot express. Where the columns fall short it adds up to five yes/no questions, asked only after the conditions match; they read the subject, the new text and attachment file names, and text read from PDF and image attachments where attachment reading is active for the organization. Nothing is read or saved: a scope given is carried into rule, and a test says how much mail the rule matches. include_sql returns the SQL it renders to. kind do_not_share compiles for recall. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
16381
16536
  "hasJsonBody": true,
16382
16537
  "method": "POST",
16383
16538
  "operationId": "compileEmailRule",
@@ -16487,7 +16642,7 @@ const operationManifest = [
16487
16642
  "questions": {
16488
16643
  "type": "array",
16489
16644
  "items": { "type": "string" },
16490
- "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."
16645
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
16491
16646
  }
16492
16647
  },
16493
16648
  "required": [
@@ -16823,7 +16978,7 @@ const operationManifest = [
16823
16978
  "description": "A condition {column, op, value?, min_confidence?} (see GET /email-rules/vocabulary) or {all: [...]}, {any: [...]}, {not: ...}."
16824
16979
  },
16825
16980
  "questions": {
16826
- "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. Left out, none.",
16981
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes. Left out, none.",
16827
16982
  "type": "array",
16828
16983
  "items": { "type": "string" }
16829
16984
  }
@@ -16935,6 +17090,147 @@ const operationManifest = [
16935
17090
  "type": "integer",
16936
17091
  "minimum": 0
16937
17092
  },
17093
+ "receivers": {
17094
+ "description": "On the list with all=true only: who receives what it matches now. Null when it could not be read in time.",
17095
+ "anyOf": [{
17096
+ "type": "object",
17097
+ "properties": {
17098
+ "keys": {
17099
+ "type": "array",
17100
+ "items": {
17101
+ "type": "object",
17102
+ "properties": {
17103
+ "owner": { "anyOf": [{
17104
+ "type": "object",
17105
+ "properties": {
17106
+ "kind": {
17107
+ "type": "string",
17108
+ "const": "member"
17109
+ },
17110
+ "user_id": {
17111
+ "type": "string",
17112
+ "description": "The member's user id.",
17113
+ "format": "uuid"
17114
+ },
17115
+ "name": {
17116
+ "description": "Their name; null when they have none set.",
17117
+ "type": ["string", "null"]
17118
+ }
17119
+ },
17120
+ "required": [
17121
+ "kind",
17122
+ "user_id",
17123
+ "name"
17124
+ ]
17125
+ }, {
17126
+ "type": "object",
17127
+ "properties": { "kind": {
17128
+ "type": "string",
17129
+ "const": "organization",
17130
+ "description": "Held by no member: an organization key, or one whose holder has left."
17131
+ } },
17132
+ "required": ["kind"]
17133
+ }] },
17134
+ "count": {
17135
+ "type": "integer",
17136
+ "exclusiveMinimum": 0
17137
+ }
17138
+ },
17139
+ "required": ["owner", "count"]
17140
+ },
17141
+ "description": "API keys that work now (not revoked, expired or suspended) and hold mail:read, whose access lists the rule or its live share. Owner: who holds each, or the organization."
17142
+ },
17143
+ "webhooks": {
17144
+ "type": "array",
17145
+ "items": {
17146
+ "type": "object",
17147
+ "properties": {
17148
+ "owner": { "anyOf": [{
17149
+ "type": "object",
17150
+ "properties": {
17151
+ "kind": {
17152
+ "type": "string",
17153
+ "const": "member"
17154
+ },
17155
+ "user_id": {
17156
+ "type": "string",
17157
+ "description": "The member's user id.",
17158
+ "format": "uuid"
17159
+ },
17160
+ "name": {
17161
+ "description": "Their name; null when they have none set.",
17162
+ "type": ["string", "null"]
17163
+ }
17164
+ },
17165
+ "required": [
17166
+ "kind",
17167
+ "user_id",
17168
+ "name"
17169
+ ]
17170
+ }, {
17171
+ "type": "object",
17172
+ "properties": { "kind": {
17173
+ "type": "string",
17174
+ "const": "organization",
17175
+ "description": "Held by no member: an organization key, or one whose holder has left."
17176
+ } },
17177
+ "required": ["kind"]
17178
+ }] },
17179
+ "count": {
17180
+ "type": "integer",
17181
+ "exclusiveMinimum": 0
17182
+ }
17183
+ },
17184
+ "required": ["owner", "count"]
17185
+ },
17186
+ "description": "Webhooks taking received mail, bounces or reports that are sent what it matches: those of the key delivery acts as, when it lists the rule or its live share (owner: its holder, or the organization), and those of the member it is shared with (owner: that member)."
17187
+ },
17188
+ "shares": {
17189
+ "type": "array",
17190
+ "items": {
17191
+ "type": "object",
17192
+ "properties": {
17193
+ "beneficiary": {
17194
+ "type": "object",
17195
+ "properties": {
17196
+ "kind": {
17197
+ "type": "string",
17198
+ "const": "member"
17199
+ },
17200
+ "user_id": {
17201
+ "type": "string",
17202
+ "description": "The member's user id.",
17203
+ "format": "uuid"
17204
+ },
17205
+ "name": {
17206
+ "description": "Their name; null when they have none set.",
17207
+ "type": ["string", "null"]
17208
+ }
17209
+ },
17210
+ "required": [
17211
+ "kind",
17212
+ "user_id",
17213
+ "name"
17214
+ ]
17215
+ },
17216
+ "count": {
17217
+ "type": "integer",
17218
+ "exclusiveMinimum": 0
17219
+ }
17220
+ },
17221
+ "required": ["beneficiary", "count"]
17222
+ },
17223
+ "description": "The rule's live share (at most one), by its member, if they can read it and it is among their newest 20 shares."
17224
+ }
17225
+ },
17226
+ "required": [
17227
+ "keys",
17228
+ "webhooks",
17229
+ "shares"
17230
+ ],
17231
+ "description": "Who receives what the rule shares, by person and count. Empty unless it is an active grant rule."
17232
+ }, { "type": "null" }]
17233
+ },
16938
17234
  "created_at": {
16939
17235
  "type": "string",
16940
17236
  "format": "date-time"
@@ -16977,7 +17273,7 @@ const operationManifest = [
16977
17273
  "questions": {
16978
17274
  "type": "array",
16979
17275
  "items": { "type": "string" },
16980
- "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."
17276
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
16981
17277
  }
16982
17278
  },
16983
17279
  "required": [
@@ -17256,6 +17552,29 @@ const operationManifest = [
17256
17552
  "required": ["index", "label"]
17257
17553
  },
17258
17554
  "description": "Made-up emails not decided."
17555
+ },
17556
+ "close_calls": {
17557
+ "type": "array",
17558
+ "items": {
17559
+ "type": "string",
17560
+ "format": "uuid"
17561
+ },
17562
+ "description": "Emails by id, passed or failed, decided by an answer below 0.75 confidence: judged again they may come out the other way."
17563
+ },
17564
+ "close_call_samples": {
17565
+ "type": "array",
17566
+ "items": {
17567
+ "type": "object",
17568
+ "properties": {
17569
+ "index": {
17570
+ "type": "integer",
17571
+ "minimum": 0
17572
+ },
17573
+ "label": { "type": ["string", "null"] }
17574
+ },
17575
+ "required": ["index", "label"]
17576
+ },
17577
+ "description": "Made-up emails that were close calls."
17259
17578
  }
17260
17579
  },
17261
17580
  "required": [
@@ -17264,7 +17583,9 @@ const operationManifest = [
17264
17583
  "failed",
17265
17584
  "undecided",
17266
17585
  "failed_samples",
17267
- "undecided_samples"
17586
+ "undecided_samples",
17587
+ "close_calls",
17588
+ "close_call_samples"
17268
17589
  ]
17269
17590
  },
17270
17591
  "affects": {
@@ -17382,7 +17703,7 @@ const operationManifest = [
17382
17703
  "description": "A condition {column, op, value?, min_confidence?} (see GET /email-rules/vocabulary) or {all: [...]}, {any: [...]}, {not: ...}."
17383
17704
  },
17384
17705
  "questions": {
17385
- "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. Left out, none.",
17706
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes. Left out, none.",
17386
17707
  "type": "array",
17387
17708
  "items": { "type": "string" }
17388
17709
  }
@@ -17445,7 +17766,7 @@ const operationManifest = [
17445
17766
  "questions": {
17446
17767
  "type": "array",
17447
17768
  "items": { "type": "string" },
17448
- "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."
17769
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
17449
17770
  }
17450
17771
  },
17451
17772
  "required": [
@@ -17655,7 +17976,7 @@ const operationManifest = [
17655
17976
  "questions": {
17656
17977
  "type": "array",
17657
17978
  "items": { "type": "string" },
17658
- "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."
17979
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
17659
17980
  }
17660
17981
  },
17661
17982
  "required": [
@@ -17958,7 +18279,7 @@ const operationManifest = [
17958
18279
  "description": "A condition {column, op, value?, min_confidence?} (see GET /email-rules/vocabulary) or {all: [...]}, {any: [...]}, {not: ...}."
17959
18280
  },
17960
18281
  "questions": {
17961
- "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. Left out, none.",
18282
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes. Left out, none.",
17962
18283
  "type": "array",
17963
18284
  "items": { "type": "string" }
17964
18285
  }
@@ -18035,7 +18356,7 @@ const operationManifest = [
18035
18356
  "kinds": {
18036
18357
  "description": "Which kinds, taken in turn, all expected no_match; other is a business near miss. Left out, a default mix.",
18037
18358
  "minItems": 1,
18038
- "maxItems": 5,
18359
+ "maxItems": 7,
18039
18360
  "type": "array",
18040
18361
  "items": {
18041
18362
  "type": "string",
@@ -18044,6 +18365,8 @@ const operationManifest = [
18044
18365
  "payroll",
18045
18366
  "personal_purchase",
18046
18367
  "bank_tax",
18368
+ "legal",
18369
+ "personal_correspondence",
18047
18370
  "other"
18048
18371
  ]
18049
18372
  }
@@ -18104,6 +18427,8 @@ const operationManifest = [
18104
18427
  "payroll",
18105
18428
  "personal_purchase",
18106
18429
  "bank_tax",
18430
+ "legal",
18431
+ "personal_correspondence",
18107
18432
  "other"
18108
18433
  ]
18109
18434
  },
@@ -18112,6 +18437,14 @@ const operationManifest = [
18112
18437
  "enum": ["match", "no_match"],
18113
18438
  "description": "match: a near case the rule should match; no_match: one it should not."
18114
18439
  },
18440
+ "group": {
18441
+ "type": "string",
18442
+ "enum": [
18443
+ "private",
18444
+ "near_miss",
18445
+ "must_match"
18446
+ ]
18447
+ },
18115
18448
  "why": {
18116
18449
  "type": "string",
18117
18450
  "description": "Why the rule should, or should not, match it."
@@ -18179,6 +18512,10 @@ const operationManifest = [
18179
18512
  ],
18180
18513
  "description": "failed: the rule decided it against expected (shared one it should not, or missed one it should match). undecided: the rule reads a spam score, which it cannot carry, whatever it decided; or not matched on something it could not decide (not classified, a fact or answer missing, or not reached in time)."
18181
18514
  },
18515
+ "close_call": {
18516
+ "type": "boolean",
18517
+ "description": "Passed or failed on an answer below 0.75 confidence, so asking again (a new version, or any judgment of a made-up email) may decide it the other way. Never for one its conditions alone decided."
18518
+ },
18182
18519
  "question_answers": {
18183
18520
  "type": "array",
18184
18521
  "items": {
@@ -18203,10 +18540,12 @@ const operationManifest = [
18203
18540
  "required": [
18204
18541
  "kind",
18205
18542
  "expected",
18543
+ "group",
18206
18544
  "why",
18207
18545
  "email",
18208
18546
  "outcome",
18209
18547
  "status",
18548
+ "close_call",
18210
18549
  "question_answers"
18211
18550
  ]
18212
18551
  }
@@ -18226,17 +18565,99 @@ const operationManifest = [
18226
18565
  "type": "integer",
18227
18566
  "minimum": 0
18228
18567
  },
18568
+ "close_calls": {
18569
+ "type": "integer",
18570
+ "minimum": 0
18571
+ },
18229
18572
  "dropped": {
18230
18573
  "type": "integer",
18231
18574
  "minimum": 0,
18232
18575
  "description": "Asked for but not returned: not written, outside the sample bounds, or of a kind and expected not asked for."
18576
+ },
18577
+ "by_group": {
18578
+ "type": "object",
18579
+ "properties": {
18580
+ "private": {
18581
+ "type": "object",
18582
+ "properties": {
18583
+ "passed": {
18584
+ "type": "integer",
18585
+ "minimum": 0
18586
+ },
18587
+ "failed": {
18588
+ "type": "integer",
18589
+ "minimum": 0
18590
+ },
18591
+ "undecided": {
18592
+ "type": "integer",
18593
+ "minimum": 0
18594
+ }
18595
+ },
18596
+ "required": [
18597
+ "passed",
18598
+ "failed",
18599
+ "undecided"
18600
+ ]
18601
+ },
18602
+ "near_miss": {
18603
+ "type": "object",
18604
+ "properties": {
18605
+ "passed": {
18606
+ "type": "integer",
18607
+ "minimum": 0
18608
+ },
18609
+ "failed": {
18610
+ "type": "integer",
18611
+ "minimum": 0
18612
+ },
18613
+ "undecided": {
18614
+ "type": "integer",
18615
+ "minimum": 0
18616
+ }
18617
+ },
18618
+ "required": [
18619
+ "passed",
18620
+ "failed",
18621
+ "undecided"
18622
+ ]
18623
+ },
18624
+ "must_match": {
18625
+ "type": "object",
18626
+ "properties": {
18627
+ "passed": {
18628
+ "type": "integer",
18629
+ "minimum": 0
18630
+ },
18631
+ "failed": {
18632
+ "type": "integer",
18633
+ "minimum": 0
18634
+ },
18635
+ "undecided": {
18636
+ "type": "integer",
18637
+ "minimum": 0
18638
+ }
18639
+ },
18640
+ "required": [
18641
+ "passed",
18642
+ "failed",
18643
+ "undecided"
18644
+ ]
18645
+ }
18646
+ },
18647
+ "required": [
18648
+ "private",
18649
+ "near_miss",
18650
+ "must_match"
18651
+ ]
18233
18652
  }
18234
18653
  },
18235
18654
  "required": [
18236
18655
  "passed",
18237
18656
  "failed",
18238
18657
  "undecided",
18239
- "dropped"
18658
+ "close_calls",
18659
+ "dropped",
18660
+ "by_group"
18240
18661
  ]
18241
18662
  }
18242
18663
  },
@@ -18369,6 +18790,147 @@ const operationManifest = [
18369
18790
  "type": "integer",
18370
18791
  "minimum": 0
18371
18792
  },
18793
+ "receivers": {
18794
+ "description": "On the list with all=true only: who receives what it matches now. Null when it could not be read in time.",
18795
+ "anyOf": [{
18796
+ "type": "object",
18797
+ "properties": {
18798
+ "keys": {
18799
+ "type": "array",
18800
+ "items": {
18801
+ "type": "object",
18802
+ "properties": {
18803
+ "owner": { "anyOf": [{
18804
+ "type": "object",
18805
+ "properties": {
18806
+ "kind": {
18807
+ "type": "string",
18808
+ "const": "member"
18809
+ },
18810
+ "user_id": {
18811
+ "type": "string",
18812
+ "description": "The member's user id.",
18813
+ "format": "uuid"
18814
+ },
18815
+ "name": {
18816
+ "description": "Their name; null when they have none set.",
18817
+ "type": ["string", "null"]
18818
+ }
18819
+ },
18820
+ "required": [
18821
+ "kind",
18822
+ "user_id",
18823
+ "name"
18824
+ ]
18825
+ }, {
18826
+ "type": "object",
18827
+ "properties": { "kind": {
18828
+ "type": "string",
18829
+ "const": "organization",
18830
+ "description": "Held by no member: an organization key, or one whose holder has left."
18831
+ } },
18832
+ "required": ["kind"]
18833
+ }] },
18834
+ "count": {
18835
+ "type": "integer",
18836
+ "exclusiveMinimum": 0
18837
+ }
18838
+ },
18839
+ "required": ["owner", "count"]
18840
+ },
18841
+ "description": "API keys that work now (not revoked, expired or suspended) and hold mail:read, whose access lists the rule or its live share. Owner: who holds each, or the organization."
18842
+ },
18843
+ "webhooks": {
18844
+ "type": "array",
18845
+ "items": {
18846
+ "type": "object",
18847
+ "properties": {
18848
+ "owner": { "anyOf": [{
18849
+ "type": "object",
18850
+ "properties": {
18851
+ "kind": {
18852
+ "type": "string",
18853
+ "const": "member"
18854
+ },
18855
+ "user_id": {
18856
+ "type": "string",
18857
+ "description": "The member's user id.",
18858
+ "format": "uuid"
18859
+ },
18860
+ "name": {
18861
+ "description": "Their name; null when they have none set.",
18862
+ "type": ["string", "null"]
18863
+ }
18864
+ },
18865
+ "required": [
18866
+ "kind",
18867
+ "user_id",
18868
+ "name"
18869
+ ]
18870
+ }, {
18871
+ "type": "object",
18872
+ "properties": { "kind": {
18873
+ "type": "string",
18874
+ "const": "organization",
18875
+ "description": "Held by no member: an organization key, or one whose holder has left."
18876
+ } },
18877
+ "required": ["kind"]
18878
+ }] },
18879
+ "count": {
18880
+ "type": "integer",
18881
+ "exclusiveMinimum": 0
18882
+ }
18883
+ },
18884
+ "required": ["owner", "count"]
18885
+ },
18886
+ "description": "Webhooks taking received mail, bounces or reports that are sent what it matches: those of the key delivery acts as, when it lists the rule or its live share (owner: its holder, or the organization), and those of the member it is shared with (owner: that member)."
18887
+ },
18888
+ "shares": {
18889
+ "type": "array",
18890
+ "items": {
18891
+ "type": "object",
18892
+ "properties": {
18893
+ "beneficiary": {
18894
+ "type": "object",
18895
+ "properties": {
18896
+ "kind": {
18897
+ "type": "string",
18898
+ "const": "member"
18899
+ },
18900
+ "user_id": {
18901
+ "type": "string",
18902
+ "description": "The member's user id.",
18903
+ "format": "uuid"
18904
+ },
18905
+ "name": {
18906
+ "description": "Their name; null when they have none set.",
18907
+ "type": ["string", "null"]
18908
+ }
18909
+ },
18910
+ "required": [
18911
+ "kind",
18912
+ "user_id",
18913
+ "name"
18914
+ ]
18915
+ },
18916
+ "count": {
18917
+ "type": "integer",
18918
+ "exclusiveMinimum": 0
18919
+ }
18920
+ },
18921
+ "required": ["beneficiary", "count"]
18922
+ },
18923
+ "description": "The rule's live share (at most one), by its member, if they can read it and it is among their newest 20 shares."
18924
+ }
18925
+ },
18926
+ "required": [
18927
+ "keys",
18928
+ "webhooks",
18929
+ "shares"
18930
+ ],
18931
+ "description": "Who receives what the rule shares, by person and count. Empty unless it is an active grant rule."
18932
+ }, { "type": "null" }]
18933
+ },
18372
18934
  "created_at": {
18373
18935
  "type": "string",
18374
18936
  "format": "date-time"
@@ -18411,7 +18973,7 @@ const operationManifest = [
18411
18973
  "questions": {
18412
18974
  "type": "array",
18413
18975
  "items": { "type": "string" },
18414
- "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."
18976
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
18415
18977
  }
18416
18978
  },
18417
18979
  "required": [
@@ -18678,7 +19240,7 @@ const operationManifest = [
18678
19240
  "questions": {
18679
19241
  "type": "array",
18680
19242
  "items": { "type": "string" },
18681
- "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."
19243
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
18682
19244
  }
18683
19245
  },
18684
19246
  "required": [
@@ -19017,15 +19579,21 @@ const operationManifest = [
19017
19579
  "type": ["boolean", "null"]
19018
19580
  },
19019
19581
  "activity": {
19020
- "description": "For the member it is shared with, on the dashboard or the Primitive CLI, while it is live and their access reads content: whether it is working, so a quiet mailbox can be told from a stopped share. Null otherwise, and when it could not be read.",
19582
+ "description": "For the member it is shared with, on the dashboard or the Primitive CLI, while it is live and their access reads content: whether it is working, so a quiet mailbox can be told from a stopped share (checked false when that could not be read just now). Null otherwise.",
19021
19583
  "anyOf": [{
19022
19584
  "type": "object",
19023
- "properties": { "last_decided_at": {
19024
- "type": ["string", "null"],
19025
- "format": "date-time",
19026
- "description": "The start of the hour in which the rule last decided on any email in the sharing member's mailboxes since the share began, counting only hours that have ended and the hour of the newest email shared; null if none."
19027
- } },
19028
- "required": ["last_decided_at"]
19585
+ "properties": {
19586
+ "last_decided_at": {
19587
+ "type": ["string", "null"],
19588
+ "format": "date-time",
19589
+ "description": "The start of the hour in which the rule last decided on any email in the sharing member's mailboxes since the share began, counting only hours that have ended and the hour of the newest email shared; null if none, or if it could not be checked."
19590
+ },
19591
+ "checked": {
19592
+ "type": "boolean",
19593
+ "description": "False when whether the share is working could not be read just now (last_decided_at is then null): read it again."
19594
+ }
19595
+ },
19596
+ "required": ["last_decided_at", "checked"]
19029
19597
  }, { "type": "null" }]
19030
19598
  },
19031
19599
  "is_granter": {
@@ -19436,9 +20004,10 @@ const operationManifest = [
19436
20004
  "minimum": 0,
19437
20005
  "description": "With withheld_by: how many more kept it back that you cannot see, or that were deleted since. Those rules are not shown; an admin can see them."
19438
20006
  },
19439
- "created_at": {
20007
+ "decided_at": {
19440
20008
  "type": "string",
19441
- "format": "date-time"
20009
+ "format": "date-time",
20010
+ "description": "When the rule made this decision."
19442
20011
  },
19443
20012
  "from_address": {
19444
20013
  "description": "The decided email's sender address, as GET /v1/emails/{id} shows it.",
@@ -19448,10 +20017,14 @@ const operationManifest = [
19448
20017
  "description": "The decided email's subject, as GET /v1/emails/{id} shows it.",
19449
20018
  "type": ["string", "null"]
19450
20019
  },
20020
+ "recipient": {
20021
+ "description": "The mailbox the decided email was received in, as GET /v1/emails/{id} shows it (to_email).",
20022
+ "type": ["string", "null"]
20023
+ },
19451
20024
  "received_at": {
19452
20025
  "type": ["string", "null"],
19453
20026
  "format": "date-time",
19454
- "description": "When the decided email arrived. Null, with the other two, when you are not shown the email (it awaits sender authentication)."
20027
+ "description": "When the decided email arrived. Null, with from_address, subject and recipient, when you are not shown the email (it awaits sender authentication)."
19455
20028
  }
19456
20029
  },
19457
20030
  "required": [
@@ -19463,9 +20036,10 @@ const operationManifest = [
19463
20036
  "near_miss",
19464
20037
  "parts",
19465
20038
  "question_answers",
19466
- "created_at",
20039
+ "decided_at",
19467
20040
  "from_address",
19468
20041
  "subject",
20042
+ "recipient",
19469
20043
  "received_at"
19470
20044
  ]
19471
20045
  }
@@ -19572,7 +20146,7 @@ const operationManifest = [
19572
20146
  "questions": {
19573
20147
  "type": "array",
19574
20148
  "items": { "type": "string" },
19575
- "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."
20149
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
19576
20150
  }
19577
20151
  },
19578
20152
  "required": [
@@ -19830,7 +20404,7 @@ const operationManifest = [
19830
20404
  "questions": {
19831
20405
  "type": "array",
19832
20406
  "items": { "type": "string" },
19833
- "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."
20407
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
19834
20408
  }
19835
20409
  },
19836
20410
  "required": [
@@ -20646,15 +21220,21 @@ const operationManifest = [
20646
21220
  "type": ["boolean", "null"]
20647
21221
  },
20648
21222
  "activity": {
20649
- "description": "For the member it is shared with, on the dashboard or the Primitive CLI, while it is live and their access reads content: whether it is working, so a quiet mailbox can be told from a stopped share. Null otherwise, and when it could not be read.",
21223
+ "description": "For the member it is shared with, on the dashboard or the Primitive CLI, while it is live and their access reads content: whether it is working, so a quiet mailbox can be told from a stopped share (checked false when that could not be read just now). Null otherwise.",
20650
21224
  "anyOf": [{
20651
21225
  "type": "object",
20652
- "properties": { "last_decided_at": {
20653
- "type": ["string", "null"],
20654
- "format": "date-time",
20655
- "description": "The start of the hour in which the rule last decided on any email in the sharing member's mailboxes since the share began, counting only hours that have ended and the hour of the newest email shared; null if none."
20656
- } },
20657
- "required": ["last_decided_at"]
21226
+ "properties": {
21227
+ "last_decided_at": {
21228
+ "type": ["string", "null"],
21229
+ "format": "date-time",
21230
+ "description": "The start of the hour in which the rule last decided on any email in the sharing member's mailboxes since the share began, counting only hours that have ended and the hour of the newest email shared; null if none, or if it could not be checked."
21231
+ },
21232
+ "checked": {
21233
+ "type": "boolean",
21234
+ "description": "False when whether the share is working could not be read just now (last_decided_at is then null): read it again."
21235
+ }
21236
+ },
21237
+ "required": ["last_decided_at", "checked"]
20658
21238
  }, { "type": "null" }]
20659
21239
  },
20660
21240
  "is_granter": {
@@ -20851,7 +21431,7 @@ const operationManifest = [
20851
21431
  "questions": {
20852
21432
  "type": "array",
20853
21433
  "items": { "type": "string" },
20854
- "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."
21434
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
20855
21435
  }
20856
21436
  },
20857
21437
  "required": [
@@ -20908,7 +21488,7 @@ const operationManifest = [
20908
21488
  "binaryResponse": false,
20909
21489
  "bodyRequired": false,
20910
21490
  "command": "list-email-rules",
20911
- "description": "The rules the caller can see, newest first: their own, or every member's rules for a caller who reads the whole organization's mail. Each carries its scope (evaluation_scope, and scope_selection for a selected rule) and current_version, but not the version's text: read that under current from GET /email-rules/{id}. With matched_email_id, only the rules that matched that email. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
21491
+ "description": "The rules the caller can see, most recently changed first: their own, or every member's rules for a caller who reads the whole organization's mail. With all=true, every rule in the organization whoever wrote it, each with receivers, for owners and admins signed in themselves. Each carries its scope and current_version, not the version's text (GET /email-rules/{id}). author, mailbox, kind and state filter either list; a page filtered by mailbox may hold fewer rules than limit while meta.cursor continues. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
20912
21492
  "hasJsonBody": false,
20913
21493
  "method": "GET",
20914
21494
  "operationId": "listEmailRules",
@@ -20933,11 +21513,50 @@ const operationManifest = [
20933
21513
  "type": "string"
20934
21514
  },
20935
21515
  {
20936
- "description": "Only rules that matched this email.",
21516
+ "description": "Only rules that matched this email. Not with all.",
20937
21517
  "enum": null,
20938
21518
  "name": "matched_email_id",
20939
21519
  "required": false,
20940
21520
  "type": "string"
21521
+ },
21522
+ {
21523
+ "description": "true: every rule in the organization, any author (owners and admins).",
21524
+ "enum": ["true", "false"],
21525
+ "name": "all",
21526
+ "required": false,
21527
+ "type": "string"
21528
+ },
21529
+ {
21530
+ "description": "Only rules written by this member: their user id, or their member address (members:read, your own address, or with all).",
21531
+ "enum": null,
21532
+ "name": "author",
21533
+ "required": false,
21534
+ "type": "string"
21535
+ },
21536
+ {
21537
+ "description": "Only rules whose scope reaches this mailbox now (another member's: members:read, or with all).",
21538
+ "enum": null,
21539
+ "name": "mailbox",
21540
+ "required": false,
21541
+ "type": "string"
21542
+ },
21543
+ {
21544
+ "description": "Only rules of this kind.",
21545
+ "enum": ["grant", "do_not_share"],
21546
+ "name": "kind",
21547
+ "required": false,
21548
+ "type": "string"
21549
+ },
21550
+ {
21551
+ "description": "Only rules in this state.",
21552
+ "enum": [
21553
+ "draft",
21554
+ "observe",
21555
+ "active"
21556
+ ],
21557
+ "name": "state",
21558
+ "required": false,
21559
+ "type": "string"
20941
21560
  }
20942
21561
  ],
20943
21562
  "headerParams": [],
@@ -21037,6 +21656,147 @@ const operationManifest = [
21037
21656
  "type": "integer",
21038
21657
  "minimum": 0
21039
21658
  },
21659
+ "receivers": {
21660
+ "description": "On the list with all=true only: who receives what it matches now. Null when it could not be read in time.",
21661
+ "anyOf": [{
21662
+ "type": "object",
21663
+ "properties": {
21664
+ "keys": {
21665
+ "type": "array",
21666
+ "items": {
21667
+ "type": "object",
21668
+ "properties": {
21669
+ "owner": { "anyOf": [{
21670
+ "type": "object",
21671
+ "properties": {
21672
+ "kind": {
21673
+ "type": "string",
21674
+ "const": "member"
21675
+ },
21676
+ "user_id": {
21677
+ "type": "string",
21678
+ "description": "The member's user id.",
21679
+ "format": "uuid"
21680
+ },
21681
+ "name": {
21682
+ "description": "Their name; null when they have none set.",
21683
+ "type": ["string", "null"]
21684
+ }
21685
+ },
21686
+ "required": [
21687
+ "kind",
21688
+ "user_id",
21689
+ "name"
21690
+ ]
21691
+ }, {
21692
+ "type": "object",
21693
+ "properties": { "kind": {
21694
+ "type": "string",
21695
+ "const": "organization",
21696
+ "description": "Held by no member: an organization key, or one whose holder has left."
21697
+ } },
21698
+ "required": ["kind"]
21699
+ }] },
21700
+ "count": {
21701
+ "type": "integer",
21702
+ "exclusiveMinimum": 0
21703
+ }
21704
+ },
21705
+ "required": ["owner", "count"]
21706
+ },
21707
+ "description": "API keys that work now (not revoked, expired or suspended) and hold mail:read, whose access lists the rule or its live share. Owner: who holds each, or the organization."
21708
+ },
21709
+ "webhooks": {
21710
+ "type": "array",
21711
+ "items": {
21712
+ "type": "object",
21713
+ "properties": {
21714
+ "owner": { "anyOf": [{
21715
+ "type": "object",
21716
+ "properties": {
21717
+ "kind": {
21718
+ "type": "string",
21719
+ "const": "member"
21720
+ },
21721
+ "user_id": {
21722
+ "type": "string",
21723
+ "description": "The member's user id.",
21724
+ "format": "uuid"
21725
+ },
21726
+ "name": {
21727
+ "description": "Their name; null when they have none set.",
21728
+ "type": ["string", "null"]
21729
+ }
21730
+ },
21731
+ "required": [
21732
+ "kind",
21733
+ "user_id",
21734
+ "name"
21735
+ ]
21736
+ }, {
21737
+ "type": "object",
21738
+ "properties": { "kind": {
21739
+ "type": "string",
21740
+ "const": "organization",
21741
+ "description": "Held by no member: an organization key, or one whose holder has left."
21742
+ } },
21743
+ "required": ["kind"]
21744
+ }] },
21745
+ "count": {
21746
+ "type": "integer",
21747
+ "exclusiveMinimum": 0
21748
+ }
21749
+ },
21750
+ "required": ["owner", "count"]
21751
+ },
21752
+ "description": "Webhooks taking received mail, bounces or reports that are sent what it matches: those of the key delivery acts as, when it lists the rule or its live share (owner: its holder, or the organization), and those of the member it is shared with (owner: that member)."
21753
+ },
21754
+ "shares": {
21755
+ "type": "array",
21756
+ "items": {
21757
+ "type": "object",
21758
+ "properties": {
21759
+ "beneficiary": {
21760
+ "type": "object",
21761
+ "properties": {
21762
+ "kind": {
21763
+ "type": "string",
21764
+ "const": "member"
21765
+ },
21766
+ "user_id": {
21767
+ "type": "string",
21768
+ "description": "The member's user id.",
21769
+ "format": "uuid"
21770
+ },
21771
+ "name": {
21772
+ "description": "Their name; null when they have none set.",
21773
+ "type": ["string", "null"]
21774
+ }
21775
+ },
21776
+ "required": [
21777
+ "kind",
21778
+ "user_id",
21779
+ "name"
21780
+ ]
21781
+ },
21782
+ "count": {
21783
+ "type": "integer",
21784
+ "exclusiveMinimum": 0
21785
+ }
21786
+ },
21787
+ "required": ["beneficiary", "count"]
21788
+ },
21789
+ "description": "The rule's live share (at most one), by its member, if they can read it and it is among their newest 20 shares."
21790
+ }
21791
+ },
21792
+ "required": [
21793
+ "keys",
21794
+ "webhooks",
21795
+ "shares"
21796
+ ],
21797
+ "description": "Who receives what the rule shares, by person and count. Empty unless it is an active grant rule."
21798
+ }, { "type": "null" }]
21799
+ },
21040
21800
  "created_at": {
21041
21801
  "type": "string",
21042
21802
  "format": "date-time"
@@ -21160,15 +21920,21 @@ const operationManifest = [
21160
21920
  "type": ["boolean", "null"]
21161
21921
  },
21162
21922
  "activity": {
21163
- "description": "For the member it is shared with, on the dashboard or the Primitive CLI, while it is live and their access reads content: whether it is working, so a quiet mailbox can be told from a stopped share. Null otherwise, and when it could not be read.",
21923
+ "description": "For the member it is shared with, on the dashboard or the Primitive CLI, while it is live and their access reads content: whether it is working, so a quiet mailbox can be told from a stopped share (checked false when that could not be read just now). Null otherwise.",
21164
21924
  "anyOf": [{
21165
21925
  "type": "object",
21166
- "properties": { "last_decided_at": {
21167
- "type": ["string", "null"],
21168
- "format": "date-time",
21169
- "description": "The start of the hour in which the rule last decided on any email in the sharing member's mailboxes since the share began, counting only hours that have ended and the hour of the newest email shared; null if none."
21170
- } },
21171
- "required": ["last_decided_at"]
21926
+ "properties": {
21927
+ "last_decided_at": {
21928
+ "type": ["string", "null"],
21929
+ "format": "date-time",
21930
+ "description": "The start of the hour in which the rule last decided on any email in the sharing member's mailboxes since the share began, counting only hours that have ended and the hour of the newest email shared; null if none, or if it could not be checked."
21931
+ },
21932
+ "checked": {
21933
+ "type": "boolean",
21934
+ "description": "False when whether the share is working could not be read just now (last_decided_at is then null): read it again."
21935
+ }
21936
+ },
21937
+ "required": ["last_decided_at", "checked"]
21172
21938
  }, { "type": "null" }]
21173
21939
  },
21174
21940
  "is_granter": {
@@ -21290,7 +22056,7 @@ const operationManifest = [
21290
22056
  "binaryResponse": false,
21291
22057
  "bodyRequired": true,
21292
22058
  "command": "test-email-rule",
21293
- "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 with its kind, a saved rule by rule_id (its current version, as its author), rule_id with tree (that tree as the rule's next version, as its author, against its saved expectations; its author only), 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. Without email_ids it tests the newest emails on the mail relay domains, 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).",
22059
+ "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 with its kind, a saved rule by rule_id (its current version, as its author), rule_id with tree (that tree as the rule's next version, as its author, against its saved expectations; its author only), or a pending rule request by request_id (its rule as asked, as you, over your own mailboxes; with tree, that tree as your edit of it, and changes against the rule as asked). 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. Without email_ids it tests the newest emails on the mail relay domains, 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).",
21294
22060
  "hasJsonBody": true,
21295
22061
  "method": "POST",
21296
22062
  "operationId": "testEmailRule",
@@ -21327,7 +22093,7 @@ const operationManifest = [
21327
22093
  "description": "A condition {column, op, value?, min_confidence?} (see GET /email-rules/vocabulary) or {all: [...]}, {any: [...]}, {not: ...}."
21328
22094
  },
21329
22095
  "questions": {
21330
- "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. Left out, none.",
22096
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes. Left out, none.",
21331
22097
  "type": "array",
21332
22098
  "items": { "type": "string" }
21333
22099
  }
@@ -21391,7 +22157,7 @@ const operationManifest = [
21391
22157
  "format": "uuid"
21392
22158
  },
21393
22159
  "kind": {
21394
- "description": "Required with tree alone: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. With rule_id and tree, must be the rule's own.",
22160
+ "description": "Required with tree alone: do_not_share tests it as a rule that blocks sharing, so an email it cannot decide counts as matched. With rule_id and tree, must be the rule's own; with request_id and tree, grant.",
21395
22161
  "type": "string",
21396
22162
  "enum": ["grant", "do_not_share"]
21397
22163
  },
@@ -21536,7 +22302,16 @@ const operationManifest = [
21536
22302
  "type": "string",
21537
22303
  "format": "uuid"
21538
22304
  },
21539
- "created_at": { "type": "string" }
22305
+ "created_at": { "type": "string" },
22306
+ "group": {
22307
+ "description": "Its look-alike group: counted by group in the answer.",
22308
+ "type": "string",
22309
+ "enum": [
22310
+ "private",
22311
+ "near_miss",
22312
+ "must_match"
22313
+ ]
22314
+ }
21540
22315
  },
21541
22316
  "required": ["expected", "email"],
21542
22317
  "additionalProperties": false
@@ -21767,10 +22542,15 @@ const operationManifest = [
21767
22542
  },
21768
22543
  "subject": { "type": ["string", "null"] },
21769
22544
  "attachment_names": {
21770
- "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.",
22545
+ "description": "On matched and near_miss: the file names the email lists, in order, at most 10 (the names its questions are given). Parts with no name are left out; absent when there are none. attachment_descriptions says what each file is, where one was read.",
21771
22546
  "type": "array",
21772
22547
  "items": { "type": "string" }
21773
22548
  },
22549
+ "attachment_descriptions": {
22550
+ "description": "Given exactly when attachment_names is, aligned with it by position: the one-line description read from each file where the organization has attachment reading on, else null (not read, could not be read, reading off, or an email you cannot open yourself).",
22551
+ "type": "array",
22552
+ "items": { "type": ["string", "null"] }
22553
+ },
21774
22554
  "parts": {
21775
22555
  "description": "How each top-level part of the rule decided. Present for matched, near_miss and no_match.",
21776
22556
  "type": "array",
@@ -22031,12 +22811,94 @@ const operationManifest = [
22031
22811
  "undecided": {
22032
22812
  "type": "integer",
22033
22813
  "minimum": 0
22814
+ },
22815
+ "close_calls": {
22816
+ "type": "integer",
22817
+ "minimum": 0,
22818
+ "description": "Of passed and failed, how many were close calls."
22819
+ },
22820
+ "by_group": {
22821
+ "type": "object",
22822
+ "properties": {
22823
+ "private": {
22824
+ "type": "object",
22825
+ "properties": {
22826
+ "passed": {
22827
+ "type": "integer",
22828
+ "minimum": 0
22829
+ },
22830
+ "failed": {
22831
+ "type": "integer",
22832
+ "minimum": 0
22833
+ },
22834
+ "undecided": {
22835
+ "type": "integer",
22836
+ "minimum": 0
22837
+ }
22838
+ },
22839
+ "required": [
22840
+ "passed",
22841
+ "failed",
22842
+ "undecided"
22843
+ ]
22844
+ },
22845
+ "near_miss": {
22846
+ "type": "object",
22847
+ "properties": {
22848
+ "passed": {
22849
+ "type": "integer",
22850
+ "minimum": 0
22851
+ },
22852
+ "failed": {
22853
+ "type": "integer",
22854
+ "minimum": 0
22855
+ },
22856
+ "undecided": {
22857
+ "type": "integer",
22858
+ "minimum": 0
22859
+ }
22860
+ },
22861
+ "required": [
22862
+ "passed",
22863
+ "failed",
22864
+ "undecided"
22865
+ ]
22866
+ },
22867
+ "must_match": {
22868
+ "type": "object",
22869
+ "properties": {
22870
+ "passed": {
22871
+ "type": "integer",
22872
+ "minimum": 0
22873
+ },
22874
+ "failed": {
22875
+ "type": "integer",
22876
+ "minimum": 0
22877
+ },
22878
+ "undecided": {
22879
+ "type": "integer",
22880
+ "minimum": 0
22881
+ }
22882
+ },
22883
+ "required": [
22884
+ "passed",
22885
+ "failed",
22886
+ "undecided"
22887
+ ]
22888
+ }
22889
+ },
22890
+ "required": [
22891
+ "private",
22892
+ "near_miss",
22893
+ "must_match"
22894
+ ]
22034
22895
  }
22035
22896
  },
22036
22897
  "required": [
22037
22898
  "passed",
22038
22899
  "failed",
22039
- "undecided"
22900
+ "undecided",
22901
+ "close_calls"
22040
22902
  ]
22041
22903
  },
22042
22904
  "results": {
@@ -22071,6 +22933,10 @@ const operationManifest = [
22071
22933
  "undecided"
22072
22934
  ]
22073
22935
  },
22936
+ "close_call": {
22937
+ "type": "boolean",
22938
+ "description": "Passed or failed on an answer below 0.75 confidence, so asking again (a new version, or any judgment of a made-up email) may decide it the other way. Never for one its conditions alone decided."
22939
+ },
22074
22940
  "reason": {
22075
22941
  "description": "On an undecided one only: why.",
22076
22942
  "type": "string",
@@ -22090,7 +22956,8 @@ const operationManifest = [
22090
22956
  "email_id",
22091
22957
  "expected",
22092
22958
  "outcome",
22093
- "status"
22959
+ "status",
22960
+ "close_call"
22094
22961
  ]
22095
22962
  },
22096
22963
  "description": "match first, then no_match, each in the order given (saved expectations by email id)."
@@ -22114,6 +22981,15 @@ const operationManifest = [
22114
22981
  "type": "string",
22115
22982
  "enum": ["match", "no_match"]
22116
22983
  },
22984
+ "group": {
22985
+ "description": "Its group, when sent with one.",
22986
+ "type": "string",
22987
+ "enum": [
22988
+ "private",
22989
+ "near_miss",
22990
+ "must_match"
22991
+ ]
22992
+ },
22117
22993
  "outcome": {
22118
22994
  "type": "string",
22119
22995
  "enum": [
@@ -22131,6 +23007,10 @@ const operationManifest = [
22131
23007
  "undecided"
22132
23008
  ]
22133
23009
  },
23010
+ "close_call": {
23011
+ "type": "boolean",
23012
+ "description": "Passed or failed on an answer below 0.75 confidence, so asking again (a new version, or any judgment of a made-up email) may decide it the other way. Never for one its conditions alone decided."
23013
+ },
22134
23014
  "reason": {
22135
23015
  "description": "On an undecided one only: why.",
22136
23016
  "type": "string",
@@ -22174,6 +23054,7 @@ const operationManifest = [
22174
23054
  "expected",
22175
23055
  "outcome",
22176
23056
  "status",
23057
+ "close_call",
22177
23058
  "question_answers"
22178
23059
  ]
22179
23060
  }
@@ -22184,6 +23065,102 @@ const operationManifest = [
22184
23065
  "counts",
22185
23066
  "results"
22186
23067
  ]
23068
+ },
23069
+ "changes": {
23070
+ "type": "object",
23071
+ "properties": {
23072
+ "compared_to": {
23073
+ "type": "string",
23074
+ "enum": ["version", "requested"],
23075
+ "description": "version: the rule's current version (rule_id). requested: the request's rule as asked (request_id)."
23076
+ },
23077
+ "compared_to_version": {
23078
+ "description": "Present exactly when compared_to is version: its number.",
23079
+ "type": "integer",
23080
+ "exclusiveMinimum": 0
23081
+ },
23082
+ "newly_matched": {
23083
+ "type": "object",
23084
+ "properties": {
23085
+ "count": {
23086
+ "type": "integer",
23087
+ "minimum": 0
23088
+ },
23089
+ "emails": {
23090
+ "type": "array",
23091
+ "items": {
23092
+ "type": "object",
23093
+ "properties": {
23094
+ "email_id": {
23095
+ "type": "string",
23096
+ "format": "uuid"
23097
+ },
23098
+ "subject": { "type": ["string", "null"] },
23099
+ "from": { "type": ["string", "null"] },
23100
+ "received_at": {
23101
+ "type": ["string", "null"],
23102
+ "format": "date-time"
23103
+ }
23104
+ },
23105
+ "required": [
23106
+ "email_id",
23107
+ "subject",
23108
+ "from",
23109
+ "received_at"
23110
+ ]
23111
+ },
23112
+ "description": "Newest first, at most 50; count is the full number."
23113
+ }
23114
+ },
23115
+ "required": ["count", "emails"]
23116
+ },
23117
+ "stops_matching": {
23118
+ "type": "object",
23119
+ "properties": {
23120
+ "count": {
23121
+ "type": "integer",
23122
+ "minimum": 0
23123
+ },
23124
+ "emails": {
23125
+ "type": "array",
23126
+ "items": {
23127
+ "type": "object",
23128
+ "properties": {
23129
+ "email_id": {
23130
+ "type": "string",
23131
+ "format": "uuid"
23132
+ },
23133
+ "subject": { "type": ["string", "null"] },
23134
+ "from": { "type": ["string", "null"] },
23135
+ "received_at": {
23136
+ "type": ["string", "null"],
23137
+ "format": "date-time"
23138
+ }
23139
+ },
23140
+ "required": [
23141
+ "email_id",
23142
+ "subject",
23143
+ "from",
23144
+ "received_at"
23145
+ ]
23146
+ },
23147
+ "description": "Newest first, at most 50; count is the full number."
23148
+ }
23149
+ },
23150
+ "required": ["count", "emails"]
23151
+ },
23152
+ "undecided": {
23153
+ "type": "integer",
23154
+ "minimum": 0,
23155
+ "description": "Emails listed in results that either could not decide (unclassified, skipped and not found included), in neither list."
23156
+ }
23157
+ },
23158
+ "required": [
23159
+ "compared_to",
23160
+ "newly_matched",
23161
+ "stops_matching",
23162
+ "undecided"
23163
+ ]
22187
23164
  }
22188
23165
  },
22189
23166
  "required": [
@@ -22241,7 +23218,7 @@ const operationManifest = [
22241
23218
  "description": "A condition {column, op, value?, min_confidence?} (see GET /email-rules/vocabulary) or {all: [...]}, {any: [...]}, {not: ...}."
22242
23219
  },
22243
23220
  "questions": {
22244
- "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. Left out, none.",
23221
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes. Left out, none.",
22245
23222
  "type": "array",
22246
23223
  "items": { "type": "string" }
22247
23224
  }
@@ -22645,7 +23622,7 @@ const operationManifest = [
22645
23622
  "description": "A condition {column, op, value?, min_confidence?} (see GET /email-rules/vocabulary) or {all: [...]}, {any: [...]}, {not: ...}."
22646
23623
  },
22647
23624
  "questions": {
22648
- "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. Left out, none.",
23625
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes. Left out, none.",
22649
23626
  "type": "array",
22650
23627
  "items": { "type": "string" }
22651
23628
  }
@@ -23057,6 +24034,147 @@ const operationManifest = [
23057
24034
  "type": "integer",
23058
24035
  "minimum": 0
23059
24036
  },
24037
+ "receivers": {
24038
+ "description": "On the list with all=true only: who receives what it matches now. Null when it could not be read in time.",
24039
+ "anyOf": [{
24040
+ "type": "object",
24041
+ "properties": {
24042
+ "keys": {
24043
+ "type": "array",
24044
+ "items": {
24045
+ "type": "object",
24046
+ "properties": {
24047
+ "owner": { "anyOf": [{
24048
+ "type": "object",
24049
+ "properties": {
24050
+ "kind": {
24051
+ "type": "string",
24052
+ "const": "member"
24053
+ },
24054
+ "user_id": {
24055
+ "type": "string",
24056
+ "description": "The member's user id.",
24057
+ "format": "uuid"
24058
+ },
24059
+ "name": {
24060
+ "description": "Their name; null when they have none set.",
24061
+ "type": ["string", "null"]
24062
+ }
24063
+ },
24064
+ "required": [
24065
+ "kind",
24066
+ "user_id",
24067
+ "name"
24068
+ ]
24069
+ }, {
24070
+ "type": "object",
24071
+ "properties": { "kind": {
24072
+ "type": "string",
24073
+ "const": "organization",
24074
+ "description": "Held by no member: an organization key, or one whose holder has left."
24075
+ } },
24076
+ "required": ["kind"]
24077
+ }] },
24078
+ "count": {
24079
+ "type": "integer",
24080
+ "exclusiveMinimum": 0
24081
+ }
24082
+ },
24083
+ "required": ["owner", "count"]
24084
+ },
24085
+ "description": "API keys that work now (not revoked, expired or suspended) and hold mail:read, whose access lists the rule or its live share. Owner: who holds each, or the organization."
24086
+ },
24087
+ "webhooks": {
24088
+ "type": "array",
24089
+ "items": {
24090
+ "type": "object",
24091
+ "properties": {
24092
+ "owner": { "anyOf": [{
24093
+ "type": "object",
24094
+ "properties": {
24095
+ "kind": {
24096
+ "type": "string",
24097
+ "const": "member"
24098
+ },
24099
+ "user_id": {
24100
+ "type": "string",
24101
+ "description": "The member's user id.",
24102
+ "format": "uuid"
24103
+ },
24104
+ "name": {
24105
+ "description": "Their name; null when they have none set.",
24106
+ "type": ["string", "null"]
24107
+ }
24108
+ },
24109
+ "required": [
24110
+ "kind",
24111
+ "user_id",
24112
+ "name"
24113
+ ]
24114
+ }, {
24115
+ "type": "object",
24116
+ "properties": { "kind": {
24117
+ "type": "string",
24118
+ "const": "organization",
24119
+ "description": "Held by no member: an organization key, or one whose holder has left."
24120
+ } },
24121
+ "required": ["kind"]
24122
+ }] },
24123
+ "count": {
24124
+ "type": "integer",
24125
+ "exclusiveMinimum": 0
24126
+ }
24127
+ },
24128
+ "required": ["owner", "count"]
24129
+ },
24130
+ "description": "Webhooks taking received mail, bounces or reports that are sent what it matches: those of the key delivery acts as, when it lists the rule or its live share (owner: its holder, or the organization), and those of the member it is shared with (owner: that member)."
24131
+ },
24132
+ "shares": {
24133
+ "type": "array",
24134
+ "items": {
24135
+ "type": "object",
24136
+ "properties": {
24137
+ "beneficiary": {
24138
+ "type": "object",
24139
+ "properties": {
24140
+ "kind": {
24141
+ "type": "string",
24142
+ "const": "member"
24143
+ },
24144
+ "user_id": {
24145
+ "type": "string",
24146
+ "description": "The member's user id.",
24147
+ "format": "uuid"
24148
+ },
24149
+ "name": {
24150
+ "description": "Their name; null when they have none set.",
24151
+ "type": ["string", "null"]
24152
+ }
24153
+ },
24154
+ "required": [
24155
+ "kind",
24156
+ "user_id",
24157
+ "name"
24158
+ ]
24159
+ },
24160
+ "count": {
24161
+ "type": "integer",
24162
+ "exclusiveMinimum": 0
24163
+ }
24164
+ },
24165
+ "required": ["beneficiary", "count"]
24166
+ },
24167
+ "description": "The rule's live share (at most one), by its member, if they can read it and it is among their newest 20 shares."
24168
+ }
24169
+ },
24170
+ "required": [
24171
+ "keys",
24172
+ "webhooks",
24173
+ "shares"
24174
+ ],
24175
+ "description": "Who receives what the rule shares, by person and count. Empty unless it is an active grant rule."
24176
+ }, { "type": "null" }]
24177
+ },
23060
24178
  "created_at": {
23061
24179
  "type": "string",
23062
24180
  "format": "date-time"
@@ -23099,7 +24217,7 @@ const operationManifest = [
23099
24217
  "questions": {
23100
24218
  "type": "array",
23101
24219
  "items": { "type": "string" },
23102
- "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."
24220
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
23103
24221
  }
23104
24222
  },
23105
24223
  "required": [
@@ -23378,6 +24496,29 @@ const operationManifest = [
23378
24496
  "required": ["index", "label"]
23379
24497
  },
23380
24498
  "description": "Made-up emails not decided."
24499
+ },
24500
+ "close_calls": {
24501
+ "type": "array",
24502
+ "items": {
24503
+ "type": "string",
24504
+ "format": "uuid"
24505
+ },
24506
+ "description": "Emails by id, passed or failed, decided by an answer below 0.75 confidence: judged again they may come out the other way."
24507
+ },
24508
+ "close_call_samples": {
24509
+ "type": "array",
24510
+ "items": {
24511
+ "type": "object",
24512
+ "properties": {
24513
+ "index": {
24514
+ "type": "integer",
24515
+ "minimum": 0
24516
+ },
24517
+ "label": { "type": ["string", "null"] }
24518
+ },
24519
+ "required": ["index", "label"]
24520
+ },
24521
+ "description": "Made-up emails that were close calls."
23381
24522
  }
23382
24523
  },
23383
24524
  "required": [
@@ -23386,7 +24527,9 @@ const operationManifest = [
23386
24527
  "failed",
23387
24528
  "undecided",
23388
24529
  "failed_samples",
23389
- "undecided_samples"
24530
+ "undecided_samples",
24531
+ "close_calls",
24532
+ "close_call_samples"
23390
24533
  ]
23391
24534
  },
23392
24535
  "affects": {
@@ -23498,7 +24641,7 @@ const operationManifest = [
23498
24641
  "questions": {
23499
24642
  "type": "array",
23500
24643
  "items": { "type": "string" },
23501
- "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."
24644
+ "description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, and text read from PDF and image attachments where attachment reading is active for the organization. A grant rule needs every one yes; a do_not_share rule matches on any yes."
23502
24645
  }
23503
24646
  },
23504
24647
  "required": [
@@ -25056,25 +26199,35 @@ const operationManifest = [
25056
26199
  "attachments": {
25057
26200
  "type": "array",
25058
26201
  "items": {
25059
- "type": "object",
25060
- "description": "Metadata for one attachment. The bytes are not inline; download\nall attachments for a message as a gzipped tarball via\n`/emails/{id}/attachments.tar.gz`. `sha256` lets you verify a\nspecific part after extraction.\n",
25061
- "properties": {
25062
- "filename": { "type": ["string", "null"] },
25063
- "content_type": { "type": ["string", "null"] },
25064
- "size_bytes": { "type": "integer" },
25065
- "sha256": { "type": ["string", "null"] },
25066
- "part_index": {
25067
- "type": "integer",
25068
- "description": "Zero-based index of this part within the message."
26202
+ "description": "Metadata for one attachment of a received email, as the top-level `attachments` of GET /emails/{id} list it: EmailAttachment with the part's `description` (`parsed.attachments` has none).",
26203
+ "allOf": [{
26204
+ "type": "object",
26205
+ "description": "Metadata for one attachment. The bytes are not inline; download\nall attachments for a message as a gzipped tarball via\n`/emails/{id}/attachments.tar.gz`. `sha256` lets you verify a\nspecific part after extraction.\n",
26206
+ "properties": {
26207
+ "filename": { "type": ["string", "null"] },
26208
+ "content_type": { "type": ["string", "null"] },
26209
+ "size_bytes": { "type": "integer" },
26210
+ "sha256": { "type": ["string", "null"] },
26211
+ "part_index": {
26212
+ "type": "integer",
26213
+ "description": "Zero-based index of this part within the message."
26214
+ },
26215
+ "tar_path": {
26216
+ "type": "string",
26217
+ "description": "This part's file name inside the message's attachments archive. Absent on attachments stored before it was recorded."
26218
+ }
25069
26219
  },
25070
- "tar_path": {
25071
- "type": "string",
25072
- "description": "This part's file name inside the message's attachments archive. Absent on attachments stored before it was recorded."
25073
- }
25074
- },
25075
- "required": ["size_bytes"]
26220
+ "required": ["size_bytes"]
26221
+ }, {
26222
+ "type": "object",
26223
+ "properties": { "description": {
26224
+ "type": ["string", "null"],
26225
+ "description": "A one-line description of what the attachment is, read from the file when the organization has attachment reading on. Null when the part was not read, could not be read, or attachment reading is off."
26226
+ } },
26227
+ "required": ["description"]
26228
+ }]
25076
26229
  },
25077
- "description": "Attachment metadata (file name, type, size), the same items in the same order as `parsed.attachments`. Kept for a credential that reads headers only, where `parsed` is null. Empty when the email has none, its content is withheld (read `status` and `rejection_reason`), or it is not parsed yet or its parse failed (read `parse_status`). No bytes; download a part with `/emails/{id}/attachments/{part_index}`."
26230
+ "description": "Attachment metadata (file name, type, size, and a description where one was read), the same parts in the same order as `parsed.attachments`. Only these items carry `description`; `parsed.attachments` keeps the shape the webhook payload has. Kept for a credential that reads headers only, where `parsed` is null. Empty when the email has none, its content is withheld (read `status` and `rejection_reason`), or it is not parsed yet or its parse failed (read `parse_status`). No bytes; download a part with `/emails/{id}/attachments/{part_index}`."
25078
26231
  },
25079
26232
  "imported": {
25080
26233
  "type": ["object", "null"],
@@ -25825,7 +26978,7 @@ const operationManifest = [
25825
26978
  "type": "string"
25826
26979
  },
25827
26980
  {
25828
- "description": "With `false`, a history page runs no total count: `meta.total` and `meta.total_capped` are absent, and `meta.has_more` still says whether another page follows. Unset or `true`, a history page reports its total as before. The forward tail (`since`) and `search` report the page itself as the total and run no count either way.",
26981
+ "description": "With `false`, a history page runs no total count: `meta.total` and `meta.total_capped` are absent, and `meta.has_more` still says whether another page follows. Unset or `true`, a history page reports its total as before. The forward tail (`since`) and `search` run no count either way: `total` is the rows the page read, with `total_capped` `true` when a match lies past its last row.",
25829
26982
  "enum": ["true", "false"],
25830
26983
  "name": "count",
25831
26984
  "required": false,
@@ -27557,6 +28710,27 @@ const operationManifest = [
27557
28710
  "type": "string",
27558
28711
  "format": "uuid",
27559
28712
  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
28713
+ },
28714
+ "headers": {
28715
+ "description": "Custom request headers sent on every delivery to this webhook, for a receiver that needs a credential of its own (for example Authorization). At most 5 per webhook unless the organization's limit was raised. Values are secrets: stored encrypted and never returned. Names Primitive sets itself or reserves are refused (among them Content-Type, Content-Length, User-Agent, Host, Accept-Encoding, the signature headers, and names starting X-Primitive-, X-Webhook-, Primitive-, Proxy- or X-Forwarded-), as is a name given twice. Only for http webhooks.",
28716
+ "type": "array",
28717
+ "items": {
28718
+ "type": "object",
28719
+ "properties": {
28720
+ "name": {
28721
+ "type": "string",
28722
+ "minLength": 1,
28723
+ "maxLength": 100
28724
+ },
28725
+ "value": {
28726
+ "type": "string",
28727
+ "minLength": 1,
28728
+ "maxLength": 4096
28729
+ }
28730
+ },
28731
+ "required": ["name", "value"],
28732
+ "additionalProperties": false
28733
+ }
27560
28734
  }
27561
28735
  }
27562
28736
  },
@@ -27809,6 +28983,22 @@ const operationManifest = [
27809
28983
  "type": "string",
27810
28984
  "enum": ["own_secret", "organization_secret"]
27811
28985
  },
28986
+ "headers": {
28987
+ "description": "For a webhook: the custom request headers it sends on every delivery, by name, with each value redacted. Empty when it has none. Absent for an endpoint that is not a webhook.",
28988
+ "type": "array",
28989
+ "items": {
28990
+ "type": "object",
28991
+ "properties": {
28992
+ "name": { "type": "string" },
28993
+ "value": {
28994
+ "type": "string",
28995
+ "description": "Always [redacted]: a value is never returned."
28996
+ }
28997
+ },
28998
+ "required": ["name", "value"],
28999
+ "additionalProperties": {}
29000
+ }
29001
+ },
27812
29002
  "signing_secret": {
27813
29003
  "description": "Only in the response that creates a webhook made with a signing secret of its own (one made as a person's own, or by an API key limited to some mailboxes, a third-party app or an agent delegate for itself): that secret, shown this once. Read it again from GET /endpoints/{id}/signing-secret.",
27814
29004
  "type": "string"
@@ -27829,13 +29019,19 @@ const operationManifest = [
27829
29019
  }, {
27830
29020
  "type": "object",
27831
29021
  "properties": { "warnings": {
27832
- "description": "For a webhook (kind http). same_path_as_another_endpoint: another webhook you can see, on and not deleted, sends to the same scheme, host and path with any query string, so each email both receive is delivered twice; endpoint_id names it (at most 5, newest first). The URL is never echoed. Empty when none; absent when it could not be checked (a caller who may not read endpoints, or a failed read). Other codes may be added.",
29022
+ "description": "For a webhook (kind http). same_path_as_another_endpoint: another webhook you can see, on and not deleted, sends to the same scheme, host and path with any query string, so each email both receive is delivered twice; endpoint_id names it (at most 5, newest first). The URL is never echoed. A created webhook is also sent the test request POST /endpoints/{id}/test sends (within a budget of its own, separate from the test budget); the webhook is saved whatever it answers: url_requires_login: it answered 302, 401 or 403 (status names which), so the host appears to require a login. url_redirects: another redirect, which deliveries do not follow. url_unreachable: no answer within 5 seconds, or a connection error (deliveries wait longer, so a slow receiver may still receive them). url_not_checked: the probe was not made or could not finish (the organization made many such checks just now, the signing secret could not be read, the URL changed again since this write, or the check failed). A caller who may not send the webhook a test request gets no probe and none of these. Absent only when the same-path check could not be made and the probe found nothing to warn about; when the same-path check could not be made, the list has no same_path_as_another_endpoint entries whatever else it holds. Other codes may be added.",
27833
29023
  "type": "array",
27834
29024
  "items": {
27835
29025
  "type": "object",
27836
29026
  "properties": {
27837
29027
  "code": { "type": "string" },
27838
29028
  "message": { "type": "string" },
29029
+ "status": {
29030
+ "description": "The HTTP status the URL answered, on url_requires_login and url_redirects.",
29031
+ "type": "integer",
29032
+ "minimum": -9007199254740991,
29033
+ "maximum": 9007199254740991
29034
+ },
27839
29035
  "endpoint_id": {
27840
29036
  "description": "The other webhook a same_path_as_another_endpoint warning names.",
27841
29037
  "type": "string",
@@ -28157,6 +29353,22 @@ const operationManifest = [
28157
29353
  "type": "string",
28158
29354
  "enum": ["own_secret", "organization_secret"]
28159
29355
  },
29356
+ "headers": {
29357
+ "description": "For a webhook: the custom request headers it sends on every delivery, by name, with each value redacted. Empty when it has none. Absent for an endpoint that is not a webhook.",
29358
+ "type": "array",
29359
+ "items": {
29360
+ "type": "object",
29361
+ "properties": {
29362
+ "name": { "type": "string" },
29363
+ "value": {
29364
+ "type": "string",
29365
+ "description": "Always [redacted]: a value is never returned."
29366
+ }
29367
+ },
29368
+ "required": ["name", "value"],
29369
+ "additionalProperties": {}
29370
+ }
29371
+ },
28160
29372
  "signing_secret": {
28161
29373
  "description": "Only in the response that creates a webhook made with a signing secret of its own (one made as a person's own, or by an API key limited to some mailboxes, a third-party app or an agent delegate for itself): that secret, shown this once. Read it again from GET /endpoints/{id}/signing-secret.",
28162
29374
  "type": "string"
@@ -28477,6 +29689,22 @@ const operationManifest = [
28477
29689
  "type": "string",
28478
29690
  "enum": ["own_secret", "organization_secret"]
28479
29691
  },
29692
+ "headers": {
29693
+ "description": "For a webhook: the custom request headers it sends on every delivery, by name, with each value redacted. Empty when it has none. Absent for an endpoint that is not a webhook.",
29694
+ "type": "array",
29695
+ "items": {
29696
+ "type": "object",
29697
+ "properties": {
29698
+ "name": { "type": "string" },
29699
+ "value": {
29700
+ "type": "string",
29701
+ "description": "Always [redacted]: a value is never returned."
29702
+ }
29703
+ },
29704
+ "required": ["name", "value"],
29705
+ "additionalProperties": {}
29706
+ }
29707
+ },
28480
29708
  "signing_secret": {
28481
29709
  "description": "Only in the response that creates a webhook made with a signing secret of its own (one made as a person's own, or by an API key limited to some mailboxes, a third-party app or an agent delegate for itself): that secret, shown this once. Read it again from GET /endpoints/{id}/signing-secret.",
28482
29710
  "type": "string"
@@ -29024,6 +30252,27 @@ const operationManifest = [
29024
30252
  "description": "A webhook's label, up to 200 characters, shown with it in lists; null removes it. Only for http webhooks: a pull destination keeps the name it was created with.",
29025
30253
  "type": ["string", "null"],
29026
30254
  "minLength": 1
30255
+ },
30256
+ "headers": {
30257
+ "description": "Custom request headers sent on every delivery to this webhook, for a receiver that needs a credential of its own (for example Authorization). At most 5 per webhook unless the organization's limit was raised. Values are secrets: stored encrypted and never returned. Names Primitive sets itself or reserves are refused (among them Content-Type, Content-Length, User-Agent, Host, Accept-Encoding, the signature headers, and names starting X-Primitive-, X-Webhook-, Primitive-, Proxy- or X-Forwarded-), as is a name given twice. Only for http webhooks. The list given replaces the whole stored list, so send every header the webhook should keep, with its value; [] removes them all. A webhook that has headers changes its URL only with headers in the same request: the values were set for the receiver at the old URL. A non-empty list needs url in the same request, so the values go to the receiver named (refused otherwise, details.reason headers_need_url); [] needs no url.",
30258
+ "type": "array",
30259
+ "items": {
30260
+ "type": "object",
30261
+ "properties": {
30262
+ "name": {
30263
+ "type": "string",
30264
+ "minLength": 1,
30265
+ "maxLength": 100
30266
+ },
30267
+ "value": {
30268
+ "type": "string",
30269
+ "minLength": 1,
30270
+ "maxLength": 4096
30271
+ }
30272
+ },
30273
+ "required": ["name", "value"],
30274
+ "additionalProperties": false
30275
+ }
29027
30276
  }
29028
30277
  },
29029
30278
  "minProperties": 1
@@ -29277,6 +30526,22 @@ const operationManifest = [
29277
30526
  "type": "string",
29278
30527
  "enum": ["own_secret", "organization_secret"]
29279
30528
  },
30529
+ "headers": {
30530
+ "description": "For a webhook: the custom request headers it sends on every delivery, by name, with each value redacted. Empty when it has none. Absent for an endpoint that is not a webhook.",
30531
+ "type": "array",
30532
+ "items": {
30533
+ "type": "object",
30534
+ "properties": {
30535
+ "name": { "type": "string" },
30536
+ "value": {
30537
+ "type": "string",
30538
+ "description": "Always [redacted]: a value is never returned."
30539
+ }
30540
+ },
30541
+ "required": ["name", "value"],
30542
+ "additionalProperties": {}
30543
+ }
30544
+ },
29280
30545
  "signing_secret": {
29281
30546
  "description": "Only in the response that creates a webhook made with a signing secret of its own (one made as a person's own, or by an API key limited to some mailboxes, a third-party app or an agent delegate for itself): that secret, shown this once. Read it again from GET /endpoints/{id}/signing-secret.",
29282
30547
  "type": "string"
@@ -29299,13 +30564,19 @@ const operationManifest = [
29299
30564
  "required": ["warnings"],
29300
30565
  "properties": { "warnings": {
29301
30566
  "default": [],
29302
- "description": "When this update turned the webhook off or on without the request setting enabled. turned_off_owner_changed: the webhook was given to a new owner, so it is now off (disabled_reason owner_changed) until it is turned on or given a new URL. turned_on_new_url: it was off because its owner changed, and the new URL turned it back on. Empty when the update did neither. Other codes may be added.",
30567
+ "description": "When this update turned the webhook off or on without the request setting enabled. turned_off_owner_changed: the webhook was given to a new owner, so it is now off (disabled_reason owner_changed) until it is turned on or given a new URL. turned_on_new_url: it was off because its owner changed, and the new URL turned it back on. Empty when the update did neither. When the update gives a webhook a new URL, it is sent the test request POST /endpoints/{id}/test sends (within a budget of its own, separate from the test budget), and a warning says when its answer means deliveries will fail: url_requires_login: it answered 302, 401 or 403 (status names which), so the host appears to require a login. url_redirects: another redirect, which deliveries do not follow. url_unreachable: no answer within 5 seconds, or a connection error (deliveries wait longer, so a slow receiver may still receive them). url_not_checked: the probe was not made or could not finish (the organization made many such checks just now, the signing secret could not be read, the URL changed again since this write, or the check failed). A caller who may not send the webhook a test request gets no probe and none of these. Other codes may be added.",
29303
30568
  "type": "array",
29304
30569
  "items": {
29305
30570
  "type": "object",
29306
30571
  "properties": {
29307
30572
  "code": { "type": "string" },
29308
- "message": { "type": "string" }
30573
+ "message": { "type": "string" },
30574
+ "status": {
30575
+ "description": "The HTTP status the URL answered, on url_requires_login and url_redirects.",
30576
+ "type": "integer",
30577
+ "minimum": -9007199254740991,
30578
+ "maximum": 9007199254740991
30579
+ }
29309
30580
  },
29310
30581
  "required": ["code", "message"],
29311
30582
  "additionalProperties": {}
@@ -36650,6 +37921,42 @@ const operationManifest = [
36650
37921
  "tag": "Memories",
36651
37922
  "tagCommand": "memories"
36652
37923
  },
37924
+ {
37925
+ "binaryResponse": false,
37926
+ "bodyRequired": false,
37927
+ "command": "get-email-rule-settings",
37928
+ "description": "Whether the organization lets email rules read PDF and image attachments, and whether that is active: it also needs email rules to be enabled for the organization (available) and HIPAA mode off. A missing setting reads as off.\n\nPerson only: a dashboard session or the person's own OAuth token (the CLI or an app they connected). API keys, agent connection keys and agents are refused.",
37929
+ "hasJsonBody": false,
37930
+ "method": "GET",
37931
+ "operationId": "getEmailRuleSettings",
37932
+ "path": "/email-rule-settings",
37933
+ "pathParams": [],
37934
+ "queryParams": [],
37935
+ "headerParams": [],
37936
+ "permissions": ["org:read"],
37937
+ "access": "person",
37938
+ "requestSchema": null,
37939
+ "responseSchema": {
37940
+ "type": "object",
37941
+ "properties": {
37942
+ "rules_read_attachments": { "type": "boolean" },
37943
+ "available": { "type": "boolean" },
37944
+ "hipaa_mode": { "type": "boolean" },
37945
+ "active": { "type": "boolean" }
37946
+ },
37947
+ "required": [
37948
+ "rules_read_attachments",
37949
+ "available",
37950
+ "hipaa_mode",
37951
+ "active"
37952
+ ],
37953
+ "additionalProperties": {}
37954
+ },
37955
+ "sdkName": "getEmailRuleSettings",
37956
+ "summary": "Get the email rule attachment setting",
37957
+ "tag": "Organization settings",
37958
+ "tagCommand": "organization-settings"
37959
+ },
36653
37960
  {
36654
37961
  "binaryResponse": false,
36655
37962
  "bodyRequired": false,
@@ -36911,7 +38218,7 @@ const operationManifest = [
36911
38218
  "pathParams": [],
36912
38219
  "queryParams": [],
36913
38220
  "headerParams": [{
36914
- "description": "A single-use step-up token of purpose `org_settings.write` (Change the organization name, logo, semantic search setting or email notification settings), valid 5 minutes. When this operation answers 403 `step_up_required`, the person confirms at the link in `details.step_up_url` and the request is retried with the token that page shows, in this header. Accepted only with the person's own OAuth token of the client it was confirmed for; refused with a token issued for MCP, with any API key or agent connection key, and with a dashboard session.",
38221
+ "description": "A single-use step-up token of purpose `org_settings.write` (Change the organization name, logo, semantic search setting, email notification settings or whether email rules read attachments), valid 5 minutes. When this operation answers 403 `step_up_required`, the person confirms at the link in `details.step_up_url` and the request is retried with the token that page shows, in this header. Accepted only with the person's own OAuth token of the client it was confirmed for; refused with a token issued for MCP, with any API key or agent connection key, and with a dashboard session.",
36915
38222
  "enum": null,
36916
38223
  "name": "Primitive-Step-Up",
36917
38224
  "required": false,
@@ -37045,6 +38352,53 @@ const operationManifest = [
37045
38352
  "tag": "Organization settings",
37046
38353
  "tagCommand": "organization-settings"
37047
38354
  },
38355
+ {
38356
+ "binaryResponse": false,
38357
+ "bodyRequired": true,
38358
+ "command": "update-email-rule-settings",
38359
+ "description": "Turn on or off whether email rules read PDF and image attachments. When on, each such attachment is read once by a hosted model and its text is given to the email classifier and to the questions of the organization's email rules, so it is a person's decision. Turning it on is refused with 409 under HIPAA mode (hipaa_mode) or while email rules are not enabled for the organization (not_available). Turning it off is always allowed.\n\nPerson only: a dashboard session, or the person's own OAuth token with a step-up token for purpose `org_settings.write` in the Primitive-Step-Up header. Without one an 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 could not do it anyway). The person's role must hold email_rule_settings: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.",
38360
+ "hasJsonBody": true,
38361
+ "method": "PUT",
38362
+ "operationId": "updateEmailRuleSettings",
38363
+ "path": "/email-rule-settings",
38364
+ "pathParams": [],
38365
+ "queryParams": [],
38366
+ "headerParams": [{
38367
+ "description": "A single-use step-up token of purpose `org_settings.write` (Change the organization name, logo, semantic search setting, email notification settings or whether email rules read attachments), valid 5 minutes. When this operation answers 403 `step_up_required`, the person confirms at the link in `details.step_up_url` and the request is retried with the token that page shows, in this header. Accepted only with the person's own OAuth token of the client it was confirmed for; refused with a token issued for MCP, with any API key or agent connection key, and with a dashboard session.",
38368
+ "enum": null,
38369
+ "name": "Primitive-Step-Up",
38370
+ "required": false,
38371
+ "type": "string"
38372
+ }],
38373
+ "permissions": ["email_rule_settings:manage"],
38374
+ "access": "step_up",
38375
+ "requestSchema": {
38376
+ "type": "object",
38377
+ "properties": { "rules_read_attachments": { "type": "boolean" } },
38378
+ "required": ["rules_read_attachments"],
38379
+ "additionalProperties": false
38380
+ },
38381
+ "responseSchema": {
38382
+ "type": "object",
38383
+ "properties": {
38384
+ "rules_read_attachments": { "type": "boolean" },
38385
+ "available": { "type": "boolean" },
38386
+ "hipaa_mode": { "type": "boolean" },
38387
+ "active": { "type": "boolean" }
38388
+ },
38389
+ "required": [
38390
+ "rules_read_attachments",
38391
+ "available",
38392
+ "hipaa_mode",
38393
+ "active"
38394
+ ],
38395
+ "additionalProperties": {}
38396
+ },
38397
+ "sdkName": "updateEmailRuleSettings",
38398
+ "summary": "Change the email rule attachment setting",
38399
+ "tag": "Organization settings",
38400
+ "tagCommand": "organization-settings"
38401
+ },
37048
38402
  {
37049
38403
  "binaryResponse": false,
37050
38404
  "bodyRequired": true,
@@ -37057,7 +38411,7 @@ const operationManifest = [
37057
38411
  "pathParams": [],
37058
38412
  "queryParams": [],
37059
38413
  "headerParams": [{
37060
- "description": "A single-use step-up token of purpose `org_settings.write` (Change the organization name, logo, semantic search setting or email notification settings), valid 5 minutes. When this operation answers 403 `step_up_required`, the person confirms at the link in `details.step_up_url` and the request is retried with the token that page shows, in this header. Accepted only with the person's own OAuth token of the client it was confirmed for; refused with a token issued for MCP, with any API key or agent connection key, and with a dashboard session.",
38414
+ "description": "A single-use step-up token of purpose `org_settings.write` (Change the organization name, logo, semantic search setting, email notification settings or whether email rules read attachments), valid 5 minutes. When this operation answers 403 `step_up_required`, the person confirms at the link in `details.step_up_url` and the request is retried with the token that page shows, in this header. Accepted only with the person's own OAuth token of the client it was confirmed for; refused with a token issued for MCP, with any API key or agent connection key, and with a dashboard session.",
37061
38415
  "enum": null,
37062
38416
  "name": "Primitive-Step-Up",
37063
38417
  "required": false,
@@ -37106,7 +38460,7 @@ const operationManifest = [
37106
38460
  "pathParams": [],
37107
38461
  "queryParams": [],
37108
38462
  "headerParams": [{
37109
- "description": "A single-use step-up token of purpose `org_settings.write` (Change the organization name, logo, semantic search setting or email notification settings), valid 5 minutes. When this operation answers 403 `step_up_required`, the person confirms at the link in `details.step_up_url` and the request is retried with the token that page shows, in this header. Accepted only with the person's own OAuth token of the client it was confirmed for; refused with a token issued for MCP, with any API key or agent connection key, and with a dashboard session.",
38463
+ "description": "A single-use step-up token of purpose `org_settings.write` (Change the organization name, logo, semantic search setting, email notification settings or whether email rules read attachments), valid 5 minutes. When this operation answers 403 `step_up_required`, the person confirms at the link in `details.step_up_url` and the request is retried with the token that page shows, in this header. Accepted only with the person's own OAuth token of the client it was confirmed for; refused with a token issued for MCP, with any API key or agent connection key, and with a dashboard session.",
37110
38464
  "enum": null,
37111
38465
  "name": "Primitive-Step-Up",
37112
38466
  "required": false,
@@ -37166,7 +38520,7 @@ const operationManifest = [
37166
38520
  "pathParams": [],
37167
38521
  "queryParams": [],
37168
38522
  "headerParams": [{
37169
- "description": "A single-use step-up token of purpose `org_settings.write` (Change the organization name, logo, semantic search setting or email notification settings), valid 5 minutes. When this operation answers 403 `step_up_required`, the person confirms at the link in `details.step_up_url` and the request is retried with the token that page shows, in this header. Accepted only with the person's own OAuth token of the client it was confirmed for; refused with a token issued for MCP, with any API key or agent connection key, and with a dashboard session.",
38523
+ "description": "A single-use step-up token of purpose `org_settings.write` (Change the organization name, logo, semantic search setting, email notification settings or whether email rules read attachments), valid 5 minutes. When this operation answers 403 `step_up_required`, the person confirms at the link in `details.step_up_url` and the request is retried with the token that page shows, in this header. Accepted only with the person's own OAuth token of the client it was confirmed for; refused with a token issued for MCP, with any API key or agent connection key, and with a dashboard session.",
37170
38524
  "enum": null,
37171
38525
  "name": "Primitive-Step-Up",
37172
38526
  "required": false,
@@ -37235,13 +38589,16 @@ const operationManifest = [
37235
38589
  "request_id": {
37236
38590
  "type": "string",
37237
38591
  "format": "uuid",
37238
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
38592
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
38593
+ "x-primitive-retry-id": true,
38594
+ "description": "Client-generated UUID for this operation. Reuse it with the same choices after an uncertain response; use a new UUID for a new operation."
37239
38595
  },
37240
38596
  "email": {
37241
38597
  "type": "string",
37242
38598
  "maxLength": 254,
37243
38599
  "format": "email",
37244
- "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
38600
+ "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
38601
+ "description": "Email address of the person to invite."
37245
38602
  },
37246
38603
  "role": {
37247
38604
  "description": "The role the person joins with: member (the default), none for no access, admin, a role template key or a custom role id. Anything above member, and member where every member reads all of the organization's mail, needs a signed-in dashboard session holding roles:assign. owner and restricted are refused.",
@@ -37395,7 +38752,7 @@ const operationManifest = [
37395
38752
  ]
37396
38753
  },
37397
38754
  "sdkName": "inviteOrganizationMember",
37398
- "summary": null,
38755
+ "summary": "Invite a person to the organization",
37399
38756
  "tag": "Organizations",
37400
38757
  "tagCommand": "organizations"
37401
38758
  },
@@ -37410,14 +38767,14 @@ const operationManifest = [
37410
38767
  "path": "/organization/invitations",
37411
38768
  "pathParams": [],
37412
38769
  "queryParams": [{
37413
- "description": "cursor for project collaboration.",
38770
+ "description": "Continuation cursor from the previous page; omit for the first page.",
37414
38771
  "enum": null,
37415
38772
  "name": "cursor",
37416
38773
  "required": false,
37417
38774
  "type": "string"
37418
38775
  }, {
37419
38776
  "default": 50,
37420
- "description": "limit for project collaboration.",
38777
+ "description": "Maximum number of results to return; defaults to 50.",
37421
38778
  "enum": null,
37422
38779
  "maximum": 100,
37423
38780
  "minimum": 1,
@@ -37585,7 +38942,7 @@ const operationManifest = [
37585
38942
  "required": ["items", "cursor"]
37586
38943
  },
37587
38944
  "sdkName": "listOrganizationInvitations",
37588
- "summary": null,
38945
+ "summary": "List organization invitations",
37589
38946
  "tag": "Organizations",
37590
38947
  "tagCommand": "organizations"
37591
38948
  },
@@ -37599,7 +38956,7 @@ const operationManifest = [
37599
38956
  "operationId": "revokeOrganizationInvitation",
37600
38957
  "path": "/organization/invitations/{invitation_id}",
37601
38958
  "pathParams": [{
37602
- "description": "invitation_id for project collaboration.",
38959
+ "description": "Invitation ID returned by an invitation list or creation.",
37603
38960
  "enum": null,
37604
38961
  "name": "invitation_id",
37605
38962
  "required": true,
@@ -37752,7 +39109,7 @@ const operationManifest = [
37752
39109
  ]
37753
39110
  },
37754
39111
  "sdkName": "revokeOrganizationInvitation",
37755
- "summary": null,
39112
+ "summary": "Revoke an organization invitation",
37756
39113
  "tag": "Organizations",
37757
39114
  "tagCommand": "organizations"
37758
39115
  },
@@ -37782,26 +39139,32 @@ const operationManifest = [
37782
39139
  "request_id": {
37783
39140
  "type": "string",
37784
39141
  "format": "uuid",
37785
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
39142
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
39143
+ "x-primitive-retry-id": true,
39144
+ "description": "Client-generated UUID for this operation. Reuse it with the same choices after an uncertain response; use a new UUID for a new operation."
37786
39145
  },
37787
39146
  "name": {
37788
39147
  "type": "string",
37789
39148
  "minLength": 1,
37790
- "maxLength": 60
39149
+ "maxLength": 60,
39150
+ "description": "Shared project name."
37791
39151
  },
37792
39152
  "description": {
37793
39153
  "default": "",
39154
+ "description": "Shared project description; defaults to an empty string.",
37794
39155
  "type": "string",
37795
39156
  "maxLength": 4096
37796
39157
  },
37797
39158
  "repository": {
37798
39159
  "type": ["string", "null"],
37799
39160
  "maxLength": 2048,
37800
- "default": null
39161
+ "default": null,
39162
+ "description": "Repository identity as owner/repo or an HTTPS URL without credentials, query parameters or fragments. Omit or use null for none; local checkout paths are not shared."
37801
39163
  },
37802
39164
  "color": {
37803
39165
  "type": "string",
37804
- "pattern": "^#[0-9a-fA-F]{6}$"
39166
+ "pattern": "^#[0-9a-fA-F]{6}$",
39167
+ "description": "Project display color as a six-digit hexadecimal value, including #."
37805
39168
  },
37806
39169
  "members": {
37807
39170
  "maxItems": 100,
@@ -37812,49 +39175,54 @@ const operationManifest = [
37812
39175
  "user_id": {
37813
39176
  "type": "string",
37814
39177
  "format": "uuid",
37815
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
39178
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
39179
+ "description": "Organization member to include in the project."
37816
39180
  },
37817
- "recipient": { "oneOf": [
37818
- {
37819
- "type": "object",
37820
- "properties": { "kind": {
37821
- "type": "string",
37822
- "const": "work_email"
37823
- } },
37824
- "required": ["kind"],
37825
- "additionalProperties": false
37826
- },
37827
- {
37828
- "type": "object",
37829
- "properties": {
37830
- "kind": {
39181
+ "recipient": {
39182
+ "oneOf": [
39183
+ {
39184
+ "type": "object",
39185
+ "properties": { "kind": {
37831
39186
  "type": "string",
37832
- "const": "agent"
39187
+ "const": "work_email"
39188
+ } },
39189
+ "required": ["kind"],
39190
+ "additionalProperties": false
39191
+ },
39192
+ {
39193
+ "type": "object",
39194
+ "properties": {
39195
+ "kind": {
39196
+ "type": "string",
39197
+ "const": "agent"
39198
+ },
39199
+ "address": {
39200
+ "type": "string",
39201
+ "maxLength": 254,
39202
+ "format": "email",
39203
+ "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
39204
+ }
37833
39205
  },
37834
- "address": {
37835
- "type": "string",
37836
- "maxLength": 254,
37837
- "format": "email",
37838
- "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
37839
- }
39206
+ "required": ["kind", "address"],
39207
+ "additionalProperties": false
37840
39208
  },
37841
- "required": ["kind", "address"],
37842
- "additionalProperties": false
37843
- },
37844
- {
37845
- "type": "object",
37846
- "properties": { "kind": {
37847
- "type": "string",
37848
- "const": "private_agent"
37849
- } },
37850
- "required": ["kind"],
37851
- "additionalProperties": false
37852
- }
37853
- ] }
39209
+ {
39210
+ "type": "object",
39211
+ "properties": { "kind": {
39212
+ "type": "string",
39213
+ "const": "private_agent"
39214
+ } },
39215
+ "required": ["kind"],
39216
+ "additionalProperties": false
39217
+ }
39218
+ ],
39219
+ "description": "Where this teammate receives project mail: work_email, or agent with one of their own addresses. Preserve private_agent to keep an existing private choice without exposing its address."
39220
+ }
37854
39221
  },
37855
39222
  "required": ["user_id", "recipient"],
37856
39223
  "additionalProperties": false
37857
- }
39224
+ },
39225
+ "description": "Complete list of organization teammates and their project email destinations. Use [] for none."
37858
39226
  },
37859
39227
  "agent_addresses": {
37860
39228
  "maxItems": 100,
@@ -37864,7 +39232,8 @@ const operationManifest = [
37864
39232
  "maxLength": 254,
37865
39233
  "format": "email",
37866
39234
  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
37867
- }
39235
+ },
39236
+ "description": "Available agent addresses to link to the project. On update, replaces only links the caller can see; unseen live links are preserved. Use [] for no visible links."
37868
39237
  }
37869
39238
  },
37870
39239
  "required": [
@@ -38054,7 +39423,7 @@ const operationManifest = [
38054
39423
  ]
38055
39424
  },
38056
39425
  "sdkName": "createProject",
38057
- "summary": null,
39426
+ "summary": "Create a shared project",
38058
39427
  "tag": "Projects",
38059
39428
  "tagCommand": "projects"
38060
39429
  },
@@ -38068,14 +39437,14 @@ const operationManifest = [
38068
39437
  "operationId": "deleteProject",
38069
39438
  "path": "/projects/{project_id}",
38070
39439
  "pathParams": [{
38071
- "description": "project_id for project collaboration.",
39440
+ "description": "Project ID returned by listProjects or createProject.",
38072
39441
  "enum": null,
38073
39442
  "name": "project_id",
38074
39443
  "required": true,
38075
39444
  "type": "string"
38076
39445
  }],
38077
39446
  "queryParams": [{
38078
- "description": "version for project collaboration.",
39447
+ "description": "Current project version. Refresh the project before retrying a version conflict.",
38079
39448
  "enum": null,
38080
39449
  "maximum": 9007199254740991,
38081
39450
  "name": "version",
@@ -38095,7 +39464,7 @@ const operationManifest = [
38095
39464
  "required": ["deleted"]
38096
39465
  },
38097
39466
  "sdkName": "deleteProject",
38098
- "summary": null,
39467
+ "summary": "Delete a shared project",
38099
39468
  "tag": "Projects",
38100
39469
  "tagCommand": "projects"
38101
39470
  },
@@ -38109,7 +39478,7 @@ const operationManifest = [
38109
39478
  "operationId": "getProject",
38110
39479
  "path": "/projects/{project_id}",
38111
39480
  "pathParams": [{
38112
- "description": "project_id for project collaboration.",
39481
+ "description": "Project ID returned by listProjects or createProject.",
38113
39482
  "enum": null,
38114
39483
  "name": "project_id",
38115
39484
  "required": true,
@@ -38298,7 +39667,7 @@ const operationManifest = [
38298
39667
  ]
38299
39668
  },
38300
39669
  "sdkName": "getProject",
38301
- "summary": null,
39670
+ "summary": "Get a shared project",
38302
39671
  "tag": "Projects",
38303
39672
  "tagCommand": "projects"
38304
39673
  },
@@ -38312,7 +39681,7 @@ const operationManifest = [
38312
39681
  "operationId": "inviteProjectMember",
38313
39682
  "path": "/projects/{project_id}/invitations",
38314
39683
  "pathParams": [{
38315
- "description": "project_id for project collaboration.",
39684
+ "description": "Project ID returned by listProjects or createProject.",
38316
39685
  "enum": null,
38317
39686
  "name": "project_id",
38318
39687
  "required": true,
@@ -38340,13 +39709,16 @@ const operationManifest = [
38340
39709
  "request_id": {
38341
39710
  "type": "string",
38342
39711
  "format": "uuid",
38343
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
39712
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
39713
+ "x-primitive-retry-id": true,
39714
+ "description": "Client-generated UUID for this operation. Reuse it with the same choices after an uncertain response; use a new UUID for a new operation."
38344
39715
  },
38345
39716
  "email": {
38346
39717
  "type": "string",
38347
39718
  "maxLength": 254,
38348
39719
  "format": "email",
38349
- "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
39720
+ "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
39721
+ "description": "Email address of the person to invite."
38350
39722
  }
38351
39723
  },
38352
39724
  "required": ["request_id", "email"],
@@ -38423,7 +39795,7 @@ const operationManifest = [
38423
39795
  ]
38424
39796
  },
38425
39797
  "sdkName": "inviteProjectMember",
38426
- "summary": null,
39798
+ "summary": "Invite a person to a project",
38427
39799
  "tag": "Projects",
38428
39800
  "tagCommand": "projects"
38429
39801
  },
@@ -38439,7 +39811,7 @@ const operationManifest = [
38439
39811
  "pathParams": [],
38440
39812
  "queryParams": [
38441
39813
  {
38442
- "description": "cursor for project collaboration.",
39814
+ "description": "Continuation cursor from the previous page; omit for the first page.",
38443
39815
  "enum": null,
38444
39816
  "name": "cursor",
38445
39817
  "required": false,
@@ -38447,7 +39819,7 @@ const operationManifest = [
38447
39819
  },
38448
39820
  {
38449
39821
  "default": 50,
38450
- "description": "limit for project collaboration.",
39822
+ "description": "Maximum number of results to return; defaults to 50.",
38451
39823
  "enum": null,
38452
39824
  "maximum": 100,
38453
39825
  "minimum": 1,
@@ -38456,7 +39828,7 @@ const operationManifest = [
38456
39828
  "type": "integer"
38457
39829
  },
38458
39830
  {
38459
- "description": "query for project collaboration.",
39831
+ "description": "Filter members by name or a work email the caller may see.",
38460
39832
  "enum": null,
38461
39833
  "name": "query",
38462
39834
  "required": false,
@@ -38569,7 +39941,7 @@ const operationManifest = [
38569
39941
  ]
38570
39942
  },
38571
39943
  "sdkName": "listOrganizationPeople",
38572
- "summary": null,
39944
+ "summary": "List organization members",
38573
39945
  "tag": "Projects",
38574
39946
  "tagCommand": "projects"
38575
39947
  },
@@ -38583,7 +39955,7 @@ const operationManifest = [
38583
39955
  "operationId": "listProjectInvitations",
38584
39956
  "path": "/projects/{project_id}/invitations",
38585
39957
  "pathParams": [{
38586
- "description": "project_id for project collaboration.",
39958
+ "description": "Project ID returned by listProjects or createProject.",
38587
39959
  "enum": null,
38588
39960
  "name": "project_id",
38589
39961
  "required": true,
@@ -38672,7 +40044,7 @@ const operationManifest = [
38672
40044
  "required": ["items"]
38673
40045
  },
38674
40046
  "sdkName": "listProjectInvitations",
38675
- "summary": null,
40047
+ "summary": "List project invitations",
38676
40048
  "tag": "Projects",
38677
40049
  "tagCommand": "projects"
38678
40050
  },
@@ -38687,14 +40059,14 @@ const operationManifest = [
38687
40059
  "path": "/projects",
38688
40060
  "pathParams": [],
38689
40061
  "queryParams": [{
38690
- "description": "cursor for project collaboration.",
40062
+ "description": "Continuation cursor from the previous page; omit for the first page.",
38691
40063
  "enum": null,
38692
40064
  "name": "cursor",
38693
40065
  "required": false,
38694
40066
  "type": "string"
38695
40067
  }, {
38696
40068
  "default": 50,
38697
- "description": "limit for project collaboration.",
40069
+ "description": "Maximum number of results to return; defaults to 50.",
38698
40070
  "enum": null,
38699
40071
  "maximum": 100,
38700
40072
  "minimum": 1,
@@ -38898,7 +40270,7 @@ const operationManifest = [
38898
40270
  "required": ["items", "cursor"]
38899
40271
  },
38900
40272
  "sdkName": "listProjects",
38901
- "summary": null,
40273
+ "summary": "List accessible projects",
38902
40274
  "tag": "Projects",
38903
40275
  "tagCommand": "projects"
38904
40276
  },
@@ -38912,13 +40284,13 @@ const operationManifest = [
38912
40284
  "operationId": "revokeProjectInvitation",
38913
40285
  "path": "/projects/{project_id}/invitations/{invitation_id}",
38914
40286
  "pathParams": [{
38915
- "description": "project_id for project collaboration.",
40287
+ "description": "Project ID returned by listProjects or createProject.",
38916
40288
  "enum": null,
38917
40289
  "name": "project_id",
38918
40290
  "required": true,
38919
40291
  "type": "string"
38920
40292
  }, {
38921
- "description": "invitation_id for project collaboration.",
40293
+ "description": "Invitation ID returned by an invitation list or creation.",
38922
40294
  "enum": null,
38923
40295
  "name": "invitation_id",
38924
40296
  "required": true,
@@ -39000,7 +40372,7 @@ const operationManifest = [
39000
40372
  ]
39001
40373
  },
39002
40374
  "sdkName": "revokeProjectInvitation",
39003
- "summary": null,
40375
+ "summary": "Revoke a project invitation",
39004
40376
  "tag": "Projects",
39005
40377
  "tagCommand": "projects"
39006
40378
  },
@@ -39014,7 +40386,7 @@ const operationManifest = [
39014
40386
  "operationId": "updateProject",
39015
40387
  "path": "/projects/{project_id}",
39016
40388
  "pathParams": [{
39017
- "description": "project_id for project collaboration.",
40389
+ "description": "Project ID returned by listProjects or createProject.",
39018
40390
  "enum": null,
39019
40391
  "name": "project_id",
39020
40392
  "required": true,
@@ -39030,26 +40402,31 @@ const operationManifest = [
39030
40402
  "version": {
39031
40403
  "type": "integer",
39032
40404
  "exclusiveMinimum": 0,
39033
- "maximum": 9007199254740991
40405
+ "maximum": 9007199254740991,
40406
+ "description": "Current project version. Refresh the project before retrying a version conflict."
39034
40407
  },
39035
40408
  "name": {
39036
40409
  "type": "string",
39037
40410
  "minLength": 1,
39038
- "maxLength": 60
40411
+ "maxLength": 60,
40412
+ "description": "Shared project name."
39039
40413
  },
39040
40414
  "description": {
39041
40415
  "default": "",
40416
+ "description": "Shared project description; defaults to an empty string.",
39042
40417
  "type": "string",
39043
40418
  "maxLength": 4096
39044
40419
  },
39045
40420
  "repository": {
39046
40421
  "type": ["string", "null"],
39047
40422
  "maxLength": 2048,
39048
- "default": null
40423
+ "default": null,
40424
+ "description": "Repository identity as owner/repo or an HTTPS URL without credentials, query parameters or fragments. Omit or use null for none; local checkout paths are not shared."
39049
40425
  },
39050
40426
  "color": {
39051
40427
  "type": "string",
39052
- "pattern": "^#[0-9a-fA-F]{6}$"
40428
+ "pattern": "^#[0-9a-fA-F]{6}$",
40429
+ "description": "Project display color as a six-digit hexadecimal value, including #."
39053
40430
  },
39054
40431
  "members": {
39055
40432
  "maxItems": 100,
@@ -39060,49 +40437,54 @@ const operationManifest = [
39060
40437
  "user_id": {
39061
40438
  "type": "string",
39062
40439
  "format": "uuid",
39063
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
40440
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
40441
+ "description": "Organization member to include in the project."
39064
40442
  },
39065
- "recipient": { "oneOf": [
39066
- {
39067
- "type": "object",
39068
- "properties": { "kind": {
39069
- "type": "string",
39070
- "const": "work_email"
39071
- } },
39072
- "required": ["kind"],
39073
- "additionalProperties": false
39074
- },
39075
- {
39076
- "type": "object",
39077
- "properties": {
39078
- "kind": {
40443
+ "recipient": {
40444
+ "oneOf": [
40445
+ {
40446
+ "type": "object",
40447
+ "properties": { "kind": {
39079
40448
  "type": "string",
39080
- "const": "agent"
40449
+ "const": "work_email"
40450
+ } },
40451
+ "required": ["kind"],
40452
+ "additionalProperties": false
40453
+ },
40454
+ {
40455
+ "type": "object",
40456
+ "properties": {
40457
+ "kind": {
40458
+ "type": "string",
40459
+ "const": "agent"
40460
+ },
40461
+ "address": {
40462
+ "type": "string",
40463
+ "maxLength": 254,
40464
+ "format": "email",
40465
+ "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
40466
+ }
39081
40467
  },
39082
- "address": {
39083
- "type": "string",
39084
- "maxLength": 254,
39085
- "format": "email",
39086
- "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
39087
- }
40468
+ "required": ["kind", "address"],
40469
+ "additionalProperties": false
39088
40470
  },
39089
- "required": ["kind", "address"],
39090
- "additionalProperties": false
39091
- },
39092
- {
39093
- "type": "object",
39094
- "properties": { "kind": {
39095
- "type": "string",
39096
- "const": "private_agent"
39097
- } },
39098
- "required": ["kind"],
39099
- "additionalProperties": false
39100
- }
39101
- ] }
40471
+ {
40472
+ "type": "object",
40473
+ "properties": { "kind": {
40474
+ "type": "string",
40475
+ "const": "private_agent"
40476
+ } },
40477
+ "required": ["kind"],
40478
+ "additionalProperties": false
40479
+ }
40480
+ ],
40481
+ "description": "Where this teammate receives project mail: work_email, or agent with one of their own addresses. Preserve private_agent to keep an existing private choice without exposing its address."
40482
+ }
39102
40483
  },
39103
40484
  "required": ["user_id", "recipient"],
39104
40485
  "additionalProperties": false
39105
- }
40486
+ },
40487
+ "description": "Complete list of organization teammates and their project email destinations. Use [] for none."
39106
40488
  },
39107
40489
  "agent_addresses": {
39108
40490
  "maxItems": 100,
@@ -39112,7 +40494,8 @@ const operationManifest = [
39112
40494
  "maxLength": 254,
39113
40495
  "format": "email",
39114
40496
  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
39115
- }
40497
+ },
40498
+ "description": "Available agent addresses to link to the project. On update, replaces only links the caller can see; unseen live links are preserved. Use [] for no visible links."
39116
40499
  }
39117
40500
  },
39118
40501
  "required": [
@@ -39302,7 +40685,7 @@ const operationManifest = [
39302
40685
  ]
39303
40686
  },
39304
40687
  "sdkName": "updateProject",
39305
- "summary": null,
40688
+ "summary": "Update a shared project",
39306
40689
  "tag": "Projects",
39307
40690
  "tagCommand": "projects"
39308
40691
  },
@@ -52458,6 +53841,18 @@ const operationManifest = [
52458
53841
  "description": "The first 2 KB of the body the endpoint answered this attempt with, so a handler that answers 200 and ignores a delivery can be seen doing so. It is whatever came back, which may echo what was sent. Null when no answer came back, and cleared when the message's content is discarded or the sent email is deleted. Withheld from a caller who cannot read message content, since an answer can echo what was sent. Null for a redirect (3xx), whose body repeats its Location; otherwise, in answers recorded since November 2026, the webhook URL's query string, its parameters, values long enough to be a credential and any userinfo are hidden wherever it repeats them, and the rest is as the endpoint wrote it. Null for a caller who cannot read the webhook (GET /endpoints/{id}; a deleted webhook only for a caller who reads every webhook), since a receiver's answer can restate its URL's credential.",
52459
53842
  "type": ["string", "null"]
52460
53843
  },
53844
+ "rules": {
53845
+ "type": ["array", "null"],
53846
+ "items": {
53847
+ "type": "object",
53848
+ "properties": {
53849
+ "id": { "type": "string" },
53850
+ "name": { "type": "string" }
53851
+ },
53852
+ "required": ["id", "name"]
53853
+ },
53854
+ "description": "The rules this attempt's payload named in email.analysis.understanding.rules, by id and name as sent, listing only rules you can read now; empty when it named none of those. Recorded for deliveries Primitive's API sends and for replays. Null where it was not recorded (other deliveries, records of no attempt, attempts before this field), for a caller that cannot read email rules or whose organization does not have them, below content depth, and once the message's content is discarded."
53855
+ },
52461
53856
  "created_at": { "type": "string" },
52462
53857
  "updated_at": { "type": "string" },
52463
53858
  "email": {
@@ -52549,6 +53944,7 @@ const operationManifest = [
52549
53944
  "last_error_code",
52550
53945
  "response_status",
52551
53946
  "response_body",
53947
+ "rules",
52552
53948
  "created_at",
52553
53949
  "updated_at",
52554
53950
  "email",
@@ -52736,6 +54132,18 @@ const operationManifest = [
52736
54132
  "type": ["string", "null"],
52737
54133
  "description": "The first 2 KB of the body the endpoint answered this attempt with, so a handler that answers 200 and ignores a delivery can be seen doing so. It is whatever came back, which may echo what was sent. Null when no answer came back, and cleared when the message's content is discarded or the sent email is deleted. Withheld from a caller who cannot read message content, since an answer can echo what was sent. Null for a redirect (3xx), whose body repeats its Location; otherwise, in answers recorded since November 2026, the webhook URL's query string, its parameters, values long enough to be a credential and any userinfo are hidden wherever it repeats them, and the rest is as the endpoint wrote it. Null for a caller who cannot read the webhook (GET /endpoints/{id}; a deleted webhook only for a caller who reads every webhook), since a receiver's answer can restate its URL's credential."
52738
54134
  },
54135
+ "rules": {
54136
+ "type": ["array", "null"],
54137
+ "description": "The rules this attempt's payload named in email.analysis.understanding.rules, by id and name as sent, listing only rules you can read now; empty when it named none of those. Recorded for deliveries Primitive's API sends and for replays. Null where it was not recorded (other deliveries, records of no attempt, attempts before this field), for a caller that cannot read email rules or whose organization does not have them, below content depth, and once the message's content is discarded.",
54138
+ "items": {
54139
+ "type": "object",
54140
+ "required": ["id", "name"],
54141
+ "properties": {
54142
+ "id": { "type": "string" },
54143
+ "name": { "type": "string" }
54144
+ }
54145
+ }
54146
+ },
52739
54147
  "latest_attempt": {
52740
54148
  "type": "boolean",
52741
54149
  "description": "Whether this is the latest attempt of its delivery: the one recorded last, where a record of no attempt (a rule skip or a held send, attempt_count 0) is latest only when no attempt was made. A retry is recorded as a new attempt with its own id and attempt_count (not always higher than the one before), so an earlier attempt never changes: follow the latest one, or read attempts on any of them."
@@ -52765,6 +54173,7 @@ const operationManifest = [
52765
54173
  "last_error_code",
52766
54174
  "response_status",
52767
54175
  "response_body",
54176
+ "rules",
52768
54177
  "latest_attempt",
52769
54178
  "retry_scheduled",
52770
54179
  "next_attempt_at"
@@ -52984,7 +54393,7 @@ function terminalLine(line) {
52984
54393
  return sanitizeForTerminal(line).replace(BIDI_CONTROLS, "").replaceAll(/[\r\n\t]+/g, " ");
52985
54394
  }
52986
54395
  // src/oclif/answer-reports.ts
52987
- function isRecord$6(value) {
54396
+ function isRecord$8(value) {
52988
54397
  return value !== null && typeof value === "object" && !Array.isArray(value);
52989
54398
  }
52990
54399
  /** Text from an answer, made safe and one line for a report: no terminal controls. */
@@ -52993,10 +54402,10 @@ function oneLine(text) {
52993
54402
  }
52994
54403
  /** One line per warning a route write answers with (createRoute, updateRoute). */
52995
54404
  function routeWarningLines(data) {
52996
- const warnings = isRecord$6(data) ? data.warnings : void 0;
54405
+ const warnings = isRecord$8(data) ? data.warnings : void 0;
52997
54406
  if (!Array.isArray(warnings)) return [];
52998
54407
  return warnings.flatMap((warning) => {
52999
- if (!isRecord$6(warning)) return [];
54408
+ if (!isRecord$8(warning)) return [];
53000
54409
  const message = typeof warning.message === "string" ? oneLine(warning.message) : "";
53001
54410
  if (message) return [`Route warning: ${withCliCommands(message)}`];
53002
54411
  const code = typeof warning.code === "string" ? oneLine(warning.code) : "";
@@ -53024,11 +54433,11 @@ const DELIVERED_STATUSES = /* @__PURE__ */ new Set(["delivered", "header_confirm
53024
54433
  * and has no recorded answer says so.
53025
54434
  */
53026
54435
  function deliveryAttemptLines(data) {
53027
- const attempts = isRecord$6(data) ? data.attempts : void 0;
54436
+ const attempts = isRecord$8(data) ? data.attempts : void 0;
53028
54437
  if (!Array.isArray(attempts)) return [];
53029
54438
  const lines = [];
53030
54439
  for (const attempt of attempts) {
53031
- if (!isRecord$6(attempt)) continue;
54440
+ if (!isRecord$8(attempt)) continue;
53032
54441
  const text = (value) => typeof value === "string" && value ? oneLine(value) : "";
53033
54442
  const status = text(attempt.status);
53034
54443
  const parts = [
@@ -53054,9 +54463,9 @@ function deliveryAttemptLines(data) {
53054
54463
  */
53055
54464
  function deliveringCell(endpoint) {
53056
54465
  const delivery = endpoint.delivery;
53057
- if (isRecord$6(delivery) && typeof delivery.delivering === "boolean") {
54466
+ if (isRecord$8(delivery) && typeof delivery.delivering === "boolean") {
53058
54467
  if (delivery.delivering) return "yes";
53059
- const codes = Array.isArray(delivery.reasons) ? delivery.reasons.flatMap((reason) => isRecord$6(reason) && typeof reason.code === "string" && reason.code ? [oneLine(reason.code)] : []) : [];
54468
+ const codes = Array.isArray(delivery.reasons) ? delivery.reasons.flatMap((reason) => isRecord$8(reason) && typeof reason.code === "string" && reason.code ? [oneLine(reason.code)] : []) : [];
53060
54469
  return codes.length > 0 ? `no (${codes.join(", ")})` : "no";
53061
54470
  }
53062
54471
  return endpoint.kind === void 0 || endpoint.kind === "http" ? "unknown" : "-";
@@ -53067,7 +54476,7 @@ function deliveringCell(endpoint) {
53067
54476
  * (DELIVERING, from `delivery`), and its name. Nothing for an empty list.
53068
54477
  */
53069
54478
  function endpointDeliveryLines(data) {
53070
- const rows = Array.isArray(data) ? data.filter(isRecord$6) : [];
54479
+ const rows = Array.isArray(data) ? data.filter(isRecord$8) : [];
53071
54480
  if (rows.length === 0) return [];
53072
54481
  const text = (value) => typeof value === "string" && value ? oneLine(value) : "";
53073
54482
  const table = [[
@@ -53168,7 +54577,7 @@ var CliOrgRefusedError = class extends Errors.CLIError {
53168
54577
  this.orgId = params.orgId;
53169
54578
  }
53170
54579
  };
53171
- function isRecord$5(value) {
54580
+ function isRecord$7(value) {
53172
54581
  return value !== null && typeof value === "object" && !Array.isArray(value);
53173
54582
  }
53174
54583
  function apiOrigin(apiBaseUrl) {
@@ -53195,7 +54604,7 @@ function isUuid(value) {
53195
54604
  return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
53196
54605
  }
53197
54606
  function isOrgAccessToken(value) {
53198
- return isRecord$5(value) && typeof value.access_token === "string" && value.access_token.length > 0 && value.token_type === "Bearer" && typeof value.expires_in === "number" && value.expires_in > 0 && typeof value.org_id === "string" && (value.org_name === null || typeof value.org_name === "string") && typeof value.oauth_grant_id === "string";
54607
+ return isRecord$7(value) && typeof value.access_token === "string" && value.access_token.length > 0 && value.token_type === "Bearer" && typeof value.expires_in === "number" && value.expires_in > 0 && typeof value.org_id === "string" && (value.org_name === null || typeof value.org_name === "string") && typeof value.oauth_grant_id === "string";
53199
54608
  }
53200
54609
  function orgTokenFromResponse(token, now = Date.now) {
53201
54610
  return {
@@ -53242,7 +54651,7 @@ async function postTokenEndpoint(params) {
53242
54651
  throw new Errors.CLIError(`Could not reach the Primitive OAuth token endpoint: ${detail}`, { exit: 1 });
53243
54652
  }
53244
54653
  const payload = await response.json().catch(() => null);
53245
- if (response.ok && isRecord$5(payload)) return {
54654
+ if (response.ok && isRecord$7(payload)) return {
53246
54655
  ok: true,
53247
54656
  payload
53248
54657
  };
@@ -53250,7 +54659,7 @@ async function postTokenEndpoint(params) {
53250
54659
  ok: true,
53251
54660
  payload: {}
53252
54661
  };
53253
- const record = isRecord$5(payload) ? payload : {};
54662
+ const record = isRecord$7(payload) ? payload : {};
53254
54663
  return {
53255
54664
  ok: false,
53256
54665
  status: response.status,
@@ -53453,12 +54862,12 @@ async function fetchCliOrgs(params) {
53453
54862
  }
53454
54863
  const payload = await response.json().catch(() => null);
53455
54864
  if (!response.ok) {
53456
- const error = isRecord$5(payload) && isRecord$5(payload.error) ? payload.error : {};
54865
+ const error = isRecord$7(payload) && isRecord$7(payload.error) ? payload.error : {};
53457
54866
  if (response.status === 404 && error.code === "feature_disabled") throw new Errors.CLIError("This Primitive server does not support switching organizations for CLI logins.", { exit: 1 });
53458
54867
  throw new Errors.CLIError(`Could not list organizations${typeof error.message === "string" ? `: ${error.message}` : ` (HTTP ${response.status}).`}`, { exit: 1 });
53459
54868
  }
53460
- const data = isRecord$5(payload) ? payload.data : null;
53461
- if (!isRecord$5(data) || !Array.isArray(data.orgs)) throw new Errors.CLIError("Primitive API returned an unexpected organization list.", { exit: 1 });
54869
+ const data = isRecord$7(payload) ? payload.data : null;
54870
+ if (!isRecord$7(data) || !Array.isArray(data.orgs)) throw new Errors.CLIError("Primitive API returned an unexpected organization list.", { exit: 1 });
53462
54871
  return data;
53463
54872
  }
53464
54873
  /** How long a command waits for another CLI process to finish with the saved login. */
@@ -54123,7 +55532,7 @@ function withBooleanFlagValues(argv, flags) {
54123
55532
  // src/oclif/rule-notes.ts
54124
55533
  /** The tags whose single-object answers get the notes printer. */
54125
55534
  const RULE_NOTES_TAGS = /* @__PURE__ */ new Set(["Email Rules", "Email Rule Oversight"]);
54126
- function isRecord$4(value) {
55535
+ function isRecord$6(value) {
54127
55536
  return value !== null && typeof value === "object" && !Array.isArray(value);
54128
55537
  }
54129
55538
  /** Server text as a report line shows it, or "" when there is none. */
@@ -54152,12 +55561,12 @@ function list(value) {
54152
55561
  * rule's, each once.
54153
55562
  */
54154
55563
  function ruleNotesLines(answer) {
54155
- if (!isRecord$4(answer)) return [];
54156
- const summary = isRecord$4(answer.summary) ? answer.summary : {};
54157
- const rule = isRecord$4(answer.rule) ? answer.rule : {};
55564
+ if (!isRecord$6(answer)) return [];
55565
+ const summary = isRecord$6(answer.summary) ? answer.summary : {};
55566
+ const rule = isRecord$6(answer.rule) ? answer.rule : {};
54158
55567
  const notes = (from) => NOTE_KEYS.map((key) => from[key]);
54159
55568
  const lines = [
54160
- ...list(answer.scope_warnings).filter(isRecord$4).map(scopeWarningLine),
55569
+ ...list(answer.scope_warnings).filter(isRecord$6).map(scopeWarningLine),
54161
55570
  ...[
54162
55571
  ...list(answer.warnings),
54163
55572
  answer.warning,
@@ -54176,10 +55585,10 @@ function ruleNotesReport(data) {
54176
55585
  function errorDetail(error) {
54177
55586
  return error instanceof Error ? error.message : String(error);
54178
55587
  }
54179
- function usageError$2(message) {
55588
+ function usageError$3(message) {
54180
55589
  return new Errors.CLIError(message, { exit: 2 });
54181
55590
  }
54182
- function isRecord$3(value) {
55591
+ function isRecord$5(value) {
54183
55592
  return value !== null && typeof value === "object" && !Array.isArray(value);
54184
55593
  }
54185
55594
  /** A JSON file a flag names, parsed, or a usage error (exit 2) saying why not. */
@@ -54198,6 +55607,23 @@ function readJsonFileFlag(path, flag) {
54198
55607
  }
54199
55608
  /** The longest label the API keeps on a sample. */
54200
55609
  const SAMPLE_LABEL_MAX = 200;
55610
+ const SAMPLE_GROUPS = /* @__PURE__ */ new Set([
55611
+ "private",
55612
+ "near_miss",
55613
+ "must_match"
55614
+ ]);
55615
+ /**
55616
+ * A sample as a rule keeps it (expectation_samples and
55617
+ * add_expectation_samples): only expected, label and email. The API refuses
55618
+ * anything else there, a look-alike's group among them.
55619
+ */
55620
+ function savedSample(sample) {
55621
+ return {
55622
+ expected: sample.expected,
55623
+ ...sample.label !== void 0 ? { label: sample.label } : {},
55624
+ email: sample.email
55625
+ };
55626
+ }
54201
55627
  /**
54202
55628
  * `text` cut to `max` UTF-16 units, as the API counts a label's length,
54203
55629
  * never inside a character.
@@ -54215,20 +55641,23 @@ function lookAlikeExpected(lookAlike) {
54215
55641
  }
54216
55642
  /**
54217
55643
  * A look-alike as a sample, keeping its `expected` (most must not match; a
54218
- * near case the rule should take must match): the email as written,
54219
- * labelled with its kind and why ("medical: ..."), or the why alone when
54220
- * both do not fit a label.
55644
+ * near case the rule should take must match) and its group: the email as
55645
+ * written, labelled with its kind and why ("medical: ..."), or the why alone
55646
+ * when both do not fit a label. The group goes to a test only; savedSample
55647
+ * leaves it out of what a rule keeps.
54221
55648
  */
54222
55649
  function lookAlikeSample(lookAlike) {
54223
- if (!isRecord$3(lookAlike) || !isRecord$3(lookAlike.email)) return null;
55650
+ if (!isRecord$5(lookAlike) || !isRecord$5(lookAlike.email)) return null;
54224
55651
  const kind = typeof lookAlike.kind === "string" ? lookAlike.kind : "";
54225
55652
  const why = typeof lookAlike.why === "string" ? lookAlike.why.trim() : "";
54226
55653
  const both = kind && why ? `${kind}: ${why}` : kind || why;
54227
55654
  const label = both.length <= SAMPLE_LABEL_MAX ? both : why.length <= SAMPLE_LABEL_MAX ? why : `${cutLabel(why, 197)}...`;
55655
+ const group = typeof lookAlike.group === "string" && SAMPLE_GROUPS.has(lookAlike.group) ? lookAlike.group : void 0;
54228
55656
  return {
54229
55657
  expected: lookAlikeExpected(lookAlike),
54230
55658
  ...label ? { label } : {},
54231
- email: lookAlike.email
55659
+ email: lookAlike.email,
55660
+ ...group ? { group } : {}
54232
55661
  };
54233
55662
  }
54234
55663
  /**
@@ -54237,11 +55666,11 @@ function lookAlikeSample(lookAlike) {
54237
55666
  * samples file holds these, so a number means the same email in both.
54238
55667
  */
54239
55668
  function lookAlikeEntries(answer) {
54240
- const list = isRecord$3(answer) && Array.isArray(answer.look_alikes) ? answer.look_alikes : [];
55669
+ const list = isRecord$5(answer) && Array.isArray(answer.look_alikes) ? answer.look_alikes : [];
54241
55670
  const entries = [];
54242
55671
  for (const item of list) {
54243
55672
  const sample = lookAlikeSample(item);
54244
- if (sample && isRecord$3(item)) entries.push({
55673
+ if (sample && isRecord$5(item)) entries.push({
54245
55674
  lookAlike: item,
54246
55675
  sample
54247
55676
  });
@@ -54261,15 +55690,15 @@ function lookAlikeSamples(answer) {
54261
55690
  * refused, so it never empties a rule's.
54262
55691
  */
54263
55692
  function samplesFromJson(value, source) {
54264
- const data = isRecord$3(value) && isRecord$3(value.data) ? value.data : value;
54265
- if (isRecord$3(data) && Array.isArray(data.look_alikes)) {
55693
+ const data = isRecord$5(value) && isRecord$5(value.data) ? value.data : value;
55694
+ if (isRecord$5(data) && Array.isArray(data.look_alikes)) {
54266
55695
  const samples = lookAlikeSamples(data);
54267
- if (samples.length === 0) throw usageError$2(`${source} is a generate-look-alikes answer with no look-alikes in it.`);
55696
+ if (samples.length === 0) throw usageError$3(`${source} is a generate-look-alikes answer with no look-alikes in it.`);
54268
55697
  return samples;
54269
55698
  }
54270
- 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.`);
55699
+ if (!Array.isArray(data)) throw usageError$3(`${source} must hold a JSON array of samples, such as [{"expected": "no_match", "label": "a personal bill", "email": {...}}], or a generate-look-alikes answer.`);
54271
55700
  return data.map((item, index) => {
54272
- if (!isRecord$3(item)) throw usageError$2(`${source}, sample ${index + 1} (index ${index}) is not an object.`);
55701
+ if (!isRecord$5(item)) throw usageError$3(`${source}, sample ${index + 1} (index ${index}) is not an object.`);
54273
55702
  const { id: _id, created_at: _createdAt, ...sample } = item;
54274
55703
  return sample;
54275
55704
  });
@@ -54281,12 +55710,12 @@ function samplesFromJson(value, source) {
54281
55710
  */
54282
55711
  function pickNumbers(pick, count, source) {
54283
55712
  const parts = pick.split(/[\s,]+/).map((part) => part.trim()).filter((part) => part !== "");
54284
- if (parts.length === 0) throw usageError$2("--pick needs the numbers of the samples to take, such as --pick 2,4.");
55713
+ if (parts.length === 0) throw usageError$3("--pick needs the numbers of the samples to take, such as --pick 2,4.");
54285
55714
  const chosen = [];
54286
55715
  for (const part of parts) {
54287
- if (!/^\d+$/.test(part)) throw usageError$2(`--pick ${pick}: "${part}" is not a sample number.`);
55716
+ if (!/^\d+$/.test(part)) throw usageError$3(`--pick ${pick}: "${part}" is not a sample number.`);
54288
55717
  const n = Number(part);
54289
- if (n < 1 || n > count) throw usageError$2(count === 0 ? `--pick ${pick}: ${source} holds no samples.` : `--pick ${pick}: ${n} is not a sample number; ${source} holds ${count === 1 ? "sample 1" : `samples 1 to ${count}`}.`);
55718
+ if (n < 1 || n > count) throw usageError$3(count === 0 ? `--pick ${pick}: ${source} holds no samples.` : `--pick ${pick}: ${n} is not a sample number; ${source} holds ${count === 1 ? "sample 1" : `samples 1 to ${count}`}.`);
54290
55719
  if (!chosen.includes(n)) chosen.push(n);
54291
55720
  }
54292
55721
  return chosen;
@@ -54309,13 +55738,14 @@ function readSamplesFile(path, flag, pick) {
54309
55738
  /** The one of `names` given as a file path, or null; --pick without one is refused. */
54310
55739
  function givenSamplesFlag(flags, names) {
54311
55740
  const given = names.find((name) => typeof flags[name] === "string") ?? null;
54312
- if (given === null && typeof flags["pick"] === "string") throw usageError$2(`--pick chooses from a samples file: pass it with ${names.map((name) => `--${name}`).join(" or ")}.`);
55741
+ if (given === null && typeof flags["pick"] === "string") throw usageError$3(`--pick chooses from a samples file: pass it with ${names.map((name) => `--${name}`).join(" or ")}.`);
54313
55742
  return given;
54314
55743
  }
54315
55744
  /**
54316
55745
  * The body fields a samples file sets on create-email-rule and
54317
55746
  * update-email-rule: expectation_samples (on update it replaces them) or, on
54318
55747
  * update, add_expectation_samples. With --pick, only the samples it names.
55748
+ * Each is sent as savedSample gives it, without a look-alike's group.
54319
55749
  */
54320
55750
  function samplesBodyFields(canAdd) {
54321
55751
  const names = canAdd ? [SAMPLES_FILE_FLAG, ADD_SAMPLES_FILE_FLAG] : [SAMPLES_FILE_FLAG];
@@ -54324,25 +55754,26 @@ function samplesBodyFields(canAdd) {
54324
55754
  if (flag === null) return [];
54325
55755
  const path = flags[flag];
54326
55756
  const samples = readSamplesFile(path, flag, flags[PICK_FLAG]);
54327
- if (samples.length === 0 && !(canAdd && flag === "expectation-samples-file")) throw usageError$2(`--${flag} ${path} holds no samples.`);
55757
+ if (samples.length === 0 && !(canAdd && flag === "expectation-samples-file")) throw usageError$3(`--${flag} ${path} holds no samples.`);
54328
55758
  return [{
54329
55759
  flag: `--${flag}`,
54330
55760
  property: flag === "add-expectation-samples-file" ? "add_expectation_samples" : "expectation_samples",
54331
- value: samples
55761
+ value: samples.map(savedSample)
54332
55762
  }];
54333
55763
  };
54334
55764
  }
54335
55765
  /**
54336
55766
  * The samples test-email-rule expects, from --expect-samples-file (only
54337
55767
  * those --pick chooses if given), or null without the flag. They go in
54338
- * expect.samples.
55768
+ * expect.samples, each look-alike keeping its group, which the answer counts
55769
+ * samples by.
54339
55770
  */
54340
55771
  function expectSamples(flags) {
54341
55772
  const flag = givenSamplesFlag(flags, [EXPECT_SAMPLES_FILE_FLAG]);
54342
55773
  if (flag === null) return null;
54343
55774
  const path = flags[flag];
54344
55775
  const samples = readSamplesFile(path, flag, flags[PICK_FLAG]);
54345
- if (samples.length === 0) throw usageError$2(`--${flag} ${path} holds no samples.`);
55776
+ if (samples.length === 0) throw usageError$3(`--${flag} ${path} holds no samples.`);
54346
55777
  return samples;
54347
55778
  }
54348
55779
  /** --pick's help, naming the flags it chooses from. */
@@ -54350,31 +55781,58 @@ function pickFlagHelp(flags) {
54350
55781
  return `Take only these samples from ${flags.map((flag) => `--${flag}`).join(" or ")}, by their numbers from 1 as generate-look-alikes printed them: --pick 2,4. A number the file does not hold is refused.`;
54351
55782
  }
54352
55783
  /**
55784
+ * What a close call means, beside a passed or failed one: it was decided by an
55785
+ * answer below 0.75 confidence, so judging it again may decide it the other
55786
+ * way.
55787
+ */
55788
+ const CLOSE_CALL_NOTE = "a close call: decided by an answer below 0.75 confidence, so it may come out the other way when judged again";
55789
+ /**
55790
+ * Counts by look-alike group (by_group), one line, groups with nothing in
55791
+ * them left out: "By group: private 3 passed; near_miss 1 passed, 1 failed."
55792
+ */
55793
+ function groupCountsLines(byGroup) {
55794
+ if (!isRecord$5(byGroup)) return [];
55795
+ const parts = [];
55796
+ for (const group of SAMPLE_GROUPS) {
55797
+ const tally = byGroup[group];
55798
+ if (!isRecord$5(tally)) continue;
55799
+ const counted = [
55800
+ "passed",
55801
+ "failed",
55802
+ "undecided"
55803
+ ].filter((key) => typeof tally[key] === "number" && Number(tally[key]) > 0).map((key) => `${tally[key]} ${key}`);
55804
+ if (counted.length > 0) parts.push(`${group} ${counted.join(", ")}`);
55805
+ }
55806
+ return parts.length > 0 ? [`By group: ${parts.join("; ")}.`] : [];
55807
+ }
55808
+ /**
54353
55809
  * The stderr report of generate-look-alikes: each look-alike numbered as
54354
55810
  * --pick takes it (the answer saved with --json is a samples file), with its
54355
55811
  * status, kind, subject and sender, why the rule should (or should not)
54356
55812
  * match it, and what the rule decided; the counts; then the server's notes.
54357
55813
  */
54358
55814
  function lookAlikesReport(data) {
54359
- if (!isRecord$3(data)) return { lines: [] };
55815
+ if (!isRecord$5(data)) return { lines: [] };
54360
55816
  const lines = [];
54361
55817
  lookAlikeEntries(data).forEach(({ lookAlike }, index) => {
54362
55818
  const email = lookAlike.email;
54363
- const from = isRecord$3(email.from) ? shownText(email.from.address) : "";
55819
+ const from = isRecord$5(email.from) ? shownText(email.from.address) : "";
54364
55820
  const subject = shownText(email.subject);
54365
55821
  const status = shownLine(lookAlike.status) || "undecided";
54366
55822
  const kind = shownLine(lookAlike.kind) || "other";
54367
55823
  const outcome = shownLine(lookAlike.outcome) || "not_decided";
54368
55824
  const expected = lookAlikeExpected(lookAlike);
54369
- lines.push(`${index + 1}. ${status} ${kind} ${subject ? `"${subject}"` : "(no subject)"} from ${from || "an unknown sender"}`);
55825
+ const group = shownLine(lookAlike.group);
55826
+ lines.push(`${index + 1}. ${status} ${kind}${group ? ` (${group})` : ""} ${subject ? `"${subject}"` : "(no subject)"} from ${from || "an unknown sender"}`);
54370
55827
  const why = shownLine(lookAlike.why);
54371
55828
  if (why) lines.push(` Why it should ${expected === "match" ? "" : "not "}match: ${why}`);
54372
- lines.push(` ${outcome} (expected ${expected})`);
55829
+ lines.push(` ${outcome} (expected ${expected})${lookAlike.close_call === true ? `; ${CLOSE_CALL_NOTE}` : ""}`);
54373
55830
  });
54374
- const counts = isRecord$3(data.counts) ? data.counts : {};
55831
+ const counts = isRecord$5(data.counts) ? data.counts : {};
54375
55832
  const count = (key) => typeof counts[key] === "number" ? counts[key] : 0;
54376
55833
  const dropped = count("dropped");
54377
- lines.push(`Counts: ${count("passed")} passed, ${count("failed")} failed, ${count("undecided")} undecided${dropped > 0 ? `; ${dropped} asked for did not come back` : ""}.`, ...ruleNotesLines(data));
55834
+ const closeCalls = count("close_calls");
55835
+ lines.push(`Counts: ${count("passed")} passed, ${count("failed")} failed, ${count("undecided")} undecided${closeCalls > 0 ? `; ${closeCalls} close ${closeCalls === 1 ? "call" : "calls"}` : ""}${dropped > 0 ? `; ${dropped} asked for did not come back` : ""}.`, ...groupCountsLines(counts.by_group), ...ruleNotesLines(data));
54378
55836
  return { lines: lines.map(terminalLine) };
54379
55837
  }
54380
55838
  // src/oclif/email-rule-scope-flags.ts
@@ -54400,7 +55858,7 @@ function scopeSelectionFlags() {
54400
55858
  })
54401
55859
  };
54402
55860
  }
54403
- function usageError$1(message) {
55861
+ function usageError$2(message) {
54404
55862
  return new Errors.CLIError(message, { exit: 2 });
54405
55863
  }
54406
55864
  /**
@@ -54419,7 +55877,7 @@ function scopeList(values, flag) {
54419
55877
  seen.add(item.toLowerCase());
54420
55878
  list.push(item);
54421
55879
  }
54422
- if (list.length === 0) throw usageError$1(`--${flag} needs a value.`);
55880
+ if (list.length === 0) throw usageError$2(`--${flag} needs a value.`);
54423
55881
  return list;
54424
55882
  }
54425
55883
  /**
@@ -54455,10 +55913,10 @@ const EMAIL_ID = /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i;
54455
55913
  function isEmailId(id) {
54456
55914
  return EMAIL_ID.test(id);
54457
55915
  }
54458
- function usageError(message) {
55916
+ function usageError$1(message) {
54459
55917
  return new Errors.CLIError(message, { exit: 2 });
54460
55918
  }
54461
- function isRecord$2(value) {
55919
+ function isRecord$4(value) {
54462
55920
  return value !== null && typeof value === "object" && !Array.isArray(value);
54463
55921
  }
54464
55922
  /** `count` and the word for it: "1 expectation", "2 expectations". */
@@ -54479,7 +55937,7 @@ function parseEmailIdList(values, flag) {
54479
55937
  seen.add(id.toLowerCase());
54480
55938
  ids.push(id);
54481
55939
  }
54482
- if (ids.length === 0) throw usageError(`${flag} needs at least one email id.`);
55940
+ if (ids.length === 0) throw usageError$1(`${flag} needs at least one email id.`);
54483
55941
  return ids;
54484
55942
  }
54485
55943
  /**
@@ -54488,8 +55946,8 @@ function parseEmailIdList(values, flag) {
54488
55946
  * their own flag.
54489
55947
  */
54490
55948
  function checkExpectations(value, label) {
54491
- if (!isRecord$2(value)) throw usageError(`${label} must hold a JSON object such as {"match": ["<email-id>"], "no_match": ["<email-id>"]}.`);
54492
- if ("samples" in value) throw usageError(`${label} takes emails by id only; give made-up emails with ${label.startsWith("--expectations-file") ? "--expectation-samples-file" : "--expect-samples-file"}.`);
55949
+ if (!isRecord$4(value)) throw usageError$1(`${label} must hold a JSON object such as {"match": ["<email-id>"], "no_match": ["<email-id>"]}.`);
55950
+ if ("samples" in value) throw usageError$1(`${label} takes emails by id only; give made-up emails with ${label.startsWith("--expectations-file") ? "--expectation-samples-file" : "--expect-samples-file"}.`);
54493
55951
  return value;
54494
55952
  }
54495
55953
  /**
@@ -54538,11 +55996,11 @@ function sameEmailsBodyFields(flags) {
54538
55996
  const file = flags[SAME_EMAILS_FLAG];
54539
55997
  if (typeof file !== "string") return [];
54540
55998
  const saved = readJsonFileFlag(file, `--${SAME_EMAILS_FLAG}`);
54541
- const answer = isRecord$2(saved) && isRecord$2(saved.data) ? saved.data : saved;
54542
- const results = isRecord$2(answer) && Array.isArray(answer.results) ? answer.results : null;
54543
- 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.`);
54544
- const ids = [...new Set(results.flatMap((result) => isRecord$2(result) && typeof result.email_id === "string" && isEmailId(result.email_id) ? [result.email_id.toLowerCase()] : []))];
54545
- if (ids.length === 0) throw usageError(`--${SAME_EMAILS_FLAG} ${file} names no emails.`);
55999
+ const answer = isRecord$4(saved) && isRecord$4(saved.data) ? saved.data : saved;
56000
+ const results = isRecord$4(answer) && Array.isArray(answer.results) ? answer.results : null;
56001
+ if (!results) throw usageError$1(`--${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.`);
56002
+ const ids = [...new Set(results.flatMap((result) => isRecord$4(result) && typeof result.email_id === "string" && isEmailId(result.email_id) ? [result.email_id.toLowerCase()] : []))];
56003
+ if (ids.length === 0) throw usageError$1(`--${SAME_EMAILS_FLAG} ${file} names no emails.`);
54546
56004
  return [{
54547
56005
  flag: `--${SAME_EMAILS_FLAG}`,
54548
56006
  property: "email_ids",
@@ -54576,7 +56034,7 @@ function formatFactValue(fact) {
54576
56034
  const value = fact?.value;
54577
56035
  let text;
54578
56036
  if (Array.isArray(value)) {
54579
- const per = isRecord$2(fact?.value_confidences) ? fact.value_confidences : void 0;
56037
+ const per = isRecord$4(fact?.value_confidences) ? fact.value_confidences : void 0;
54580
56038
  text = `[${value.map((item) => {
54581
56039
  const name = String(item);
54582
56040
  const score = per?.[name];
@@ -54606,7 +56064,7 @@ function answerConfidence(answer) {
54606
56064
  * decide it. An entry that does not say it can is taken as one that cannot.
54607
56065
  */
54608
56066
  function undecidedOf(entry) {
54609
- const given = isRecord$2(entry) ? entry : {};
56067
+ const given = isRecord$4(entry) ? entry : {};
54610
56068
  return {
54611
56069
  reason: typeof given.reason === "string" ? given.reason : "undecided",
54612
56070
  retryable: given.retryable === true
@@ -54637,19 +56095,23 @@ function questionLines(summary, results) {
54637
56095
  return ` ${question.index}. ${text ? `"${text}": ` : ""}yes ${question.yes}, no ${question.no}, unanswered ${question.unanswered}`;
54638
56096
  })];
54639
56097
  }
56098
+ /** Whether an expectation entry is marked a close call. */
56099
+ function isCloseCall(entry) {
56100
+ return isRecord$4(entry) && entry.close_call === true;
56101
+ }
54640
56102
  function expectationLine(result) {
54641
- const note = result.status === "undecided" ? undecidedNote(undecidedOf(result)) : void 0;
56103
+ const note = result.status === "undecided" ? undecidedNote(undecidedOf(result)) : isCloseCall(result) ? CLOSE_CALL_NOTE : void 0;
54642
56104
  return ` ${result.status}: ${result.email_id} expected ${result.expected}, got ${result.outcome}${note ? ` (${note})` : ""}`;
54643
56105
  }
54644
56106
  /** The made-up emails a test's expectations judged, in order. */
54645
56107
  function sampleJudgments(expectations) {
54646
- return (isRecord$2(expectations) && Array.isArray(expectations.samples) ? expectations.samples : []).filter(isRecord$2).map((item, position) => ({
56108
+ return (isRecord$4(expectations) && Array.isArray(expectations.samples) ? expectations.samples : []).filter(isRecord$4).map((item, position) => ({
54647
56109
  index: typeof item.index === "number" ? item.index : position,
54648
56110
  label: typeof item.label === "string" ? item.label : null,
54649
56111
  expected: String(item.expected ?? ""),
54650
56112
  outcome: String(item.outcome ?? "not_decided"),
54651
56113
  status: String(item.status ?? "undecided"),
54652
- question_answers: Array.isArray(item.question_answers) ? item.question_answers.filter(isRecord$2) : [],
56114
+ question_answers: Array.isArray(item.question_answers) ? item.question_answers.filter(isRecord$4) : [],
54653
56115
  entry: item
54654
56116
  }));
54655
56117
  }
@@ -54660,7 +56122,7 @@ function sampleName(index, label) {
54660
56122
  }
54661
56123
  const sampleNamer = () => ({ index, label }) => sampleName(index, label);
54662
56124
  function sampleLines(sample, name) {
54663
- const note = sample.status === "undecided" ? ` (${undecidedNote(undecidedOf(sample.entry))})` : "";
56125
+ const note = sample.status === "undecided" ? ` (${undecidedNote(undecidedOf(sample.entry))})` : isCloseCall(sample.entry) ? ` (${CLOSE_CALL_NOTE})` : "";
54664
56126
  const lines = [` ${sample.status}: ${name(sample)} expected ${sample.expected}, got ${sample.outcome}${note}`];
54665
56127
  if (sample.question_answers.length > 0) lines.push(` questions: ${sample.question_answers.map(answerText).join("; ")}`);
54666
56128
  return lines;
@@ -54671,17 +56133,62 @@ function expectationsLines(expectations, name = sampleNamer()) {
54671
56133
  const passed = expectations.counts?.passed ?? 0;
54672
56134
  const failed = expectations.counts?.failed ?? 0;
54673
56135
  const undecided = expectations.counts?.undecided ?? 0;
54674
- if (expectations.passed && failed === 0 && undecided === 0) return [`Expectations: all ${passed} passed.`];
56136
+ const closeCalls = expectations.counts?.close_calls ?? 0;
56137
+ const closeCallsPart = closeCalls > 0 ? `; ${plural$1(closeCalls, "was a close call", "were close calls")}` : "";
56138
+ const byGroup = groupCountsLines(expectations.counts?.by_group);
56139
+ const listed = (entry) => entry.status !== "passed" || isCloseCall(entry.entry ?? entry);
56140
+ const rows = [...results.filter((result) => listed(result)).map(expectationLine), ...sampleJudgments(expectations).filter((sample) => listed(sample)).flatMap((sample) => sampleLines(sample, name))];
56141
+ if (expectations.passed && failed === 0 && undecided === 0) return [
56142
+ `Expectations: all ${passed} passed${closeCallsPart}.`,
56143
+ ...byGroup,
56144
+ ...rows
56145
+ ];
54675
56146
  return [
54676
56147
  `Expectations: ${[
54677
56148
  failed > 0 ? `${failed} failed` : "",
54678
56149
  undecided > 0 ? `${undecided} undecided` : "",
54679
56150
  `${passed} passed`
54680
- ].filter((part) => part !== "").join(", ")}.`,
54681
- ...results.filter((result) => result.status !== "passed").map(expectationLine),
54682
- ...sampleJudgments(expectations).filter((sample) => sample.status !== "passed").flatMap((sample) => sampleLines(sample, name))
56151
+ ].filter((part) => part !== "").join(", ")}${closeCallsPart}.`,
56152
+ ...byGroup,
56153
+ ...rows
54683
56154
  ];
54684
56155
  }
56156
+ /**
56157
+ * What the tested tree would change (changes) against the rule's current
56158
+ * version, or with request_id against the request's rule as asked: the
56159
+ * counts, then a few of the emails each way, newest first.
56160
+ * For a do_not_share rule they are the emails newly withheld and no longer
56161
+ * withheld.
56162
+ */
56163
+ function changesLines(changes, kind) {
56164
+ if (!isRecord$4(changes)) return [];
56165
+ const list = (value) => {
56166
+ const given = isRecord$4(value) ? value : {};
56167
+ const emails = Array.isArray(given.emails) ? given.emails.filter(isRecord$4) : [];
56168
+ return {
56169
+ count: typeof given.count === "number" ? given.count : emails.length,
56170
+ emails
56171
+ };
56172
+ };
56173
+ const newly = list(changes.newly_matched);
56174
+ const stops = list(changes.stops_matching);
56175
+ const undecided = typeof changes.undecided === "number" ? changes.undecided : 0;
56176
+ const version = changes.compared_to === "requested" ? "the rule as asked" : changes.compared_to !== void 0 && changes.compared_to !== "version" ? "the rule compared against" : typeof changes.compared_to_version === "number" ? `version ${changes.compared_to_version}` : "the current version";
56177
+ const withheld = kind === "do_not_share";
56178
+ const words = withheld ? ["newly withheld", "no longer withheld"] : ["newly matched", "stops matching"];
56179
+ const lines = [`Against ${version}: ${newly.count} ${words[0]}, ${stops.count} ${withheld ? words[1] : stops.count === 1 ? "stops matching" : "stop matching"}${undecided > 0 ? `, ${undecided} undecided by either` : ""}.`];
56180
+ const emailLine = (email) => {
56181
+ const subject = shownText(email.subject);
56182
+ const from = shownText(email.from);
56183
+ return ` ${subject ? `"${subject}"` : "(no subject)"}${from ? ` from ${from}` : ""} (${shownLine(email.email_id)})`;
56184
+ };
56185
+ for (const [label, entry] of [[words[0], newly], [words[1], stops]]) {
56186
+ if (entry.emails.length === 0) continue;
56187
+ const shown = entry.emails.slice(0, 3);
56188
+ lines.push(` ${label[0]?.toUpperCase()}${label.slice(1)}${entry.count > shown.length ? ` (${shown.length} of ${entry.count} shown; the JSON lists up to 50)` : ""}:`, ...shown.map(emailLine));
56189
+ }
56190
+ return lines;
56191
+ }
54685
56192
  const NOT_MATCHED_ORDER = {
54686
56193
  near_miss: 1,
54687
56194
  no_match: 2,
@@ -54807,32 +56314,33 @@ function expectationsOutcome(expectations, name = sampleNamer()) {
54807
56314
  };
54808
56315
  }
54809
56316
  /** A time an answer gives, to the minute, in UTC. */
54810
- function minuteUtc(value) {
56317
+ function minuteUtc$1(value) {
54811
56318
  const at = new Date(value);
54812
56319
  return Number.isNaN(at.getTime()) ? shownLine(value) : `${at.toISOString().slice(0, 16).replace("T", " ")} UTC`;
54813
56320
  }
54814
56321
  /** The first line of a test report: which mail was tested. */
54815
56322
  function windowLine(data, tested) {
54816
- const window = isRecord$2(data.window) ? data.window : void 0;
56323
+ const window = isRecord$4(data.window) ? data.window : void 0;
54817
56324
  const oldest = typeof window?.oldest_at === "string" ? window.oldest_at : void 0;
54818
56325
  const newest = typeof window?.newest_at === "string" ? window.newest_at : void 0;
54819
56326
  if (!window || !oldest || !newest) return [];
54820
- return [`Tested ${plural$1(tested, "email", "emails")} received ${minuteUtc(oldest)} to ${minuteUtc(newest)}.`];
56327
+ return [`Tested ${plural$1(tested, "email", "emails")} received ${minuteUtc$1(oldest)} to ${minuteUtc$1(newest)}.`];
54821
56328
  }
54822
56329
  /** The stderr report and exit code of a test-email-rule answer. */
54823
56330
  function testEmailRuleReport(data) {
54824
- if (!isRecord$2(data)) return { lines: [] };
56331
+ if (!isRecord$4(data)) return { lines: [] };
54825
56332
  const name = sampleNamer();
54826
56333
  const result = data;
54827
56334
  const results = Array.isArray(result.results) ? result.results : [];
54828
- const summary = isRecord$2(result.summary) ? result.summary : void 0;
54829
- const counts = isRecord$2(data.counts) ? data.counts : void 0;
56335
+ const summary = isRecord$4(result.summary) ? result.summary : void 0;
56336
+ const counts = isRecord$4(data.counts) ? data.counts : void 0;
54830
56337
  return {
54831
56338
  lines: [
54832
56339
  ...windowLine(data, (typeof counts?.emails === "number" ? counts.emails : results.length) - (typeof counts?.not_found === "number" ? counts.not_found : 0)),
54833
56340
  ...ruleNotesLines(data),
54834
56341
  ...conditionLines(summary),
54835
56342
  ...questionLines(summary, results),
56343
+ ...changesLines(data.changes, isRecord$4(data.rule) ? data.rule.kind : void 0),
54836
56344
  ...expectationsLines(result.expectations, name),
54837
56345
  ...matchedLines(results, result.expectations),
54838
56346
  ...notMatchedLines(results, result.expectations)
@@ -54955,6 +56463,163 @@ const EMAIL_RULE_OPERATION_EXTENSIONS = {
54955
56463
  report: ruleNotesReport
54956
56464
  }
54957
56465
  };
56466
+ // src/oclif/email-rule-listings.ts
56467
+ function isRecord$3(value) {
56468
+ return value !== null && typeof value === "object" && !Array.isArray(value);
56469
+ }
56470
+ /** Rows as a table: every column padded to its widest cell but the last. */
56471
+ function tableLines(rows) {
56472
+ const widths = (rows[0] ?? []).map((_, column) => Math.max(...rows.map((cells) => (cells[column] ?? "").length)));
56473
+ return rows.map((cells) => terminalLine(cells.map((cell, column) => column === cells.length - 1 ? cell : cell.padEnd(widths[column] ?? 0)).join(" ").trimEnd()));
56474
+ }
56475
+ /** A time an answer gives, to the minute, in UTC; the value as given when it is not a time. */
56476
+ function minuteUtc(value) {
56477
+ if (typeof value !== "string" || value === "") return "-";
56478
+ const at = new Date(value);
56479
+ return Number.isNaN(at.getTime()) ? shownLine(value) : `${at.toISOString().slice(0, 16).replace("T", " ")} UTC`;
56480
+ }
56481
+ /** What a decision decided: matched, near miss or no match. */
56482
+ function decisionOutcome(decision) {
56483
+ if (decision.matched === true) return "matched";
56484
+ if (decision.near_miss === true) return "near miss";
56485
+ return decision.matched === false ? "no match" : "-";
56486
+ }
56487
+ /**
56488
+ * A table of a rule's decisions (listEmailRuleDecisions and
56489
+ * listEmailRuleDecisionsOnMyMail): when each was decided, what it decided,
56490
+ * the email, the mailbox it was received in, its sender and subject. An email
56491
+ * you are not shown shows `-` for those. Nothing for an empty list.
56492
+ */
56493
+ function decisionLines(data) {
56494
+ const rows = Array.isArray(data) ? data.filter(isRecord$3) : [];
56495
+ if (rows.length === 0) return [];
56496
+ const cell = (value) => shownText(value) || "-";
56497
+ return tableLines([[
56498
+ "DECIDED",
56499
+ "OUTCOME",
56500
+ "EMAIL",
56501
+ "RECIPIENT",
56502
+ "FROM",
56503
+ "SUBJECT"
56504
+ ], ...rows.map((row) => [
56505
+ minuteUtc(row.decided_at),
56506
+ decisionOutcome(row),
56507
+ cell(row.email_id),
56508
+ cell(row.recipient),
56509
+ cell(row.from_address),
56510
+ cell(row.subject)
56511
+ ])]);
56512
+ }
56513
+ /** At most this many scope addresses and domains are named in COVERS. */
56514
+ const COVERS_NAMED = 3;
56515
+ function ruleAuthor(rule) {
56516
+ const author = isRecord$3(rule.author) ? rule.author : {};
56517
+ const name = shownText(author.name) || shownText(author.email) || shownLine(author.user_id).slice(0, 8) || "-";
56518
+ return rule.is_author === true ? `${name} (you)` : name;
56519
+ }
56520
+ /** Whose mail a rule covers, from its evaluation_scope and scope_selection. */
56521
+ function ruleCovers(rule) {
56522
+ switch (rule.evaluation_scope) {
56523
+ case "own_mailboxes": return "author's own mailboxes";
56524
+ case "author": return "all mail the author reads";
56525
+ case "selected": {
56526
+ const selection = isRecord$3(rule.scope_selection) ? rule.scope_selection : {};
56527
+ const names = [...(Array.isArray(selection.addresses) ? selection.addresses : []).map((address) => shownLine(address)), ...(Array.isArray(selection.domains) ? selection.domains : []).map((domain) => `@${shownLine(domain)}`)].filter((name) => name !== "" && name !== "@");
56528
+ if (names.length === 0) return "selected";
56529
+ const named = names.slice(0, COVERS_NAMED).join(", ");
56530
+ return names.length > COVERS_NAMED ? `${named} +${names.length - COVERS_NAMED} more` : named;
56531
+ }
56532
+ default: return shownLine(rule.evaluation_scope) || "-";
56533
+ }
56534
+ }
56535
+ function countSum(list) {
56536
+ return Array.isArray(list) ? list.reduce((sum, entry) => sum + (isRecord$3(entry) && typeof entry.count === "number" ? entry.count : 0), 0) : 0;
56537
+ }
56538
+ /**
56539
+ * Who receives what a rule matches now, from receivers (the --all list
56540
+ * only): keys, webhooks and shares summed; `-` when there are none, and
56541
+ * `unknown` when it could not be read in time.
56542
+ */
56543
+ function ruleReceivers(rule) {
56544
+ if (!isRecord$3(rule.receivers)) return "unknown";
56545
+ const keys = countSum(rule.receivers.keys);
56546
+ const webhooks = countSum(rule.receivers.webhooks);
56547
+ const shares = countSum(rule.receivers.shares);
56548
+ if (keys + webhooks + shares === 0) return "-";
56549
+ return `${keys} ${keys === 1 ? "key" : "keys"}, ${webhooks} ${webhooks === 1 ? "webhook" : "webhooks"}, ${shares} ${shares === 1 ? "share" : "shares"}`;
56550
+ }
56551
+ /**
56552
+ * A table of an email rules list (listEmailRules), one line per rule: its
56553
+ * name, author, kind, state, current version and whose mail it covers, and
56554
+ * with --all who receives what it matches. Nothing for an empty list.
56555
+ */
56556
+ function ruleListLines(data, all) {
56557
+ const rows = Array.isArray(data) ? data.filter(isRecord$3) : [];
56558
+ if (rows.length === 0) return [];
56559
+ return tableLines([[
56560
+ "NAME",
56561
+ "AUTHOR",
56562
+ "KIND",
56563
+ "STATE",
56564
+ "VERSION",
56565
+ "COVERS",
56566
+ ...all ? ["RECEIVERS"] : []
56567
+ ], ...rows.map((rule) => [
56568
+ shownText(rule.name) || "-",
56569
+ ruleAuthor(rule),
56570
+ rule.kind === "do_not_share" ? "do not share" : shownLine(rule.kind) || "grant",
56571
+ shownLine(rule.state) || "-",
56572
+ typeof rule.current_version === "number" ? `v${rule.current_version}` : "-",
56573
+ ruleCovers(rule),
56574
+ ...all ? [ruleReceivers(rule)] : []
56575
+ ])]);
56576
+ }
56577
+ /**
56578
+ * Why a list-email-rules request was refused, in the words a person can act
56579
+ * on, or undefined to keep the generic hint for the error code.
56580
+ */
56581
+ function listEmailRulesErrorHint(code, payload, flags = {}) {
56582
+ if (code !== "grant_forbidden") return void 0;
56583
+ const error = isRecord$3(payload) && isRecord$3(payload.error) ? payload.error : payload;
56584
+ const details = isRecord$3(error) && isRecord$3(error.details) ? error.details : {};
56585
+ switch (details.reason) {
56586
+ case "owner_or_admin_only": return "Only owners and admins can list every rule. Run without --all to list the rules you can see.";
56587
+ case "person_credential": return "Listing every rule needs your own CLI login, not an API key or agent sign-in.";
56588
+ case "permission_missing":
56589
+ if (details.param === "author" || details.param === void 0 && typeof flags.author === "string") return "Filtering by address needs permission to list members. Use the author's user id instead.";
56590
+ if (details.param === "mailbox") return "Filtering by another member's mailbox needs permission to list members, or --all.";
56591
+ return;
56592
+ default: return;
56593
+ }
56594
+ }
56595
+ /** The empty-list note of list-email-rules, by whether --all was given. */
56596
+ function emptyRuleListHint(all) {
56597
+ return all ? "(no results) No rules in the organization match these filters." : "(no results) No rules you can see match. Owners and admins can list every rule in the organization with --all.";
56598
+ }
56599
+ /** The API's page cap and default page size on list-email-rules. */
56600
+ const RULE_LIST_PAGE_MAX = 100;
56601
+ const RULE_LIST_DEFAULT_LIMIT = 50;
56602
+ const EMAIL_RULE_LISTING_EXTENSIONS = {
56603
+ listEmailRules: {
56604
+ flags: {},
56605
+ report: (data, { flags, meta }) => {
56606
+ const rows = Array.isArray(data) ? data : [];
56607
+ const lines = ruleListLines(data, flags.all === true);
56608
+ const limit = typeof flags.limit === "number" && flags.limit <= RULE_LIST_PAGE_MAX ? flags.limit : typeof flags.limit === "number" ? void 0 : RULE_LIST_DEFAULT_LIMIT;
56609
+ const cursor = isRecord$3(meta) ? meta.cursor : void 0;
56610
+ if (typeof flags.mailbox === "string" && typeof cursor === "string" && cursor !== "" && limit !== void 0 && rows.length < limit) lines.push("Scanned part of the rules; run again with --cursor to continue.");
56611
+ return { lines };
56612
+ }
56613
+ },
56614
+ listEmailRuleDecisions: {
56615
+ flags: {},
56616
+ report: (data) => ({ lines: decisionLines(data) })
56617
+ },
56618
+ listEmailRuleDecisionsOnMyMail: {
56619
+ flags: {},
56620
+ report: (data) => ({ lines: decisionLines(data) })
56621
+ }
56622
+ };
54958
56623
  // src/oclif/empty-mail-hint.ts
54959
56624
  /**
54960
56625
  * Query parameters that page, shape or modify a list without narrowing which
@@ -55217,6 +56882,106 @@ function withDefaultEventTypes(body) {
55217
56882
  if (isPlainObject(rules) && rules.event_types !== void 0) return body;
55218
56883
  return withEventTypes(body, DEFAULT_EVENT_TYPES, {});
55219
56884
  }
56885
+ // src/oclif/endpoint-headers.ts
56886
+ const HEADER_FLAG = "header";
56887
+ const CLEAR_HEADERS_FLAG = "clear-headers";
56888
+ function usageError(message) {
56889
+ return new Errors.CLIError(message, { exit: 2 });
56890
+ }
56891
+ function isRecord$2(value) {
56892
+ return value !== null && typeof value === "object" && !Array.isArray(value);
56893
+ }
56894
+ /** True when `text` holds an ASCII control character, which a header cannot carry. */
56895
+ function hasControlCharacter$1(text) {
56896
+ for (let index = 0; index < text.length; index += 1) {
56897
+ const code = text.charCodeAt(index);
56898
+ if (code < 32 || code === 127) return true;
56899
+ }
56900
+ return false;
56901
+ }
56902
+ /**
56903
+ * The headers `--header 'Name: value'` gives, in order: split at the first
56904
+ * colon, the name trimmed and the value without the spaces around it. A
56905
+ * malformed entry is refused by its place in the list, never by its text,
56906
+ * since the value is a secret. A name given twice (in any case) is refused.
56907
+ */
56908
+ function parseHeaderFlags(values) {
56909
+ const headers = [];
56910
+ const seen = /* @__PURE__ */ new Set();
56911
+ values.forEach((given, index) => {
56912
+ const which = `--header ${index + 1}`;
56913
+ const colon = given.indexOf(":");
56914
+ if (colon === -1) throw usageError(`${which} has no colon: give each header as 'Name: value', such as --header 'Authorization: Bearer <token>'.`);
56915
+ const name = given.slice(0, colon).trim();
56916
+ const value = given.slice(colon + 1).trim();
56917
+ if (name === "") throw usageError(`${which} has no name before its colon.`);
56918
+ if (hasControlCharacter$1(name) || /\s/.test(name)) throw usageError(`${which}: a header name cannot hold spaces or control characters.`);
56919
+ if (value === "") throw usageError(`${which} (${name}) has no value.`);
56920
+ if (hasControlCharacter$1(value)) throw usageError(`${which} (${name}): the value cannot hold control characters such as line breaks.`);
56921
+ const key = name.toLowerCase();
56922
+ if (seen.has(key)) throw usageError(`${which}: ${name} is given more than once.`);
56923
+ seen.add(key);
56924
+ headers.push({
56925
+ name,
56926
+ value
56927
+ });
56928
+ });
56929
+ return headers;
56930
+ }
56931
+ /** The headers body field the flags set: the list given, [] to remove them all, or none. */
56932
+ function headersBodyFields(flags) {
56933
+ const given = flags[HEADER_FLAG];
56934
+ const headersGiven = Array.isArray(given) && given.length > 0;
56935
+ if (flags["clear-headers"] === true && headersGiven) throw usageError(`--${CLEAR_HEADERS_FLAG} removes every header, so it cannot go with --${HEADER_FLAG}: give one of the two.`);
56936
+ if (flags["clear-headers"] === true) return [{
56937
+ flag: `--${CLEAR_HEADERS_FLAG}`,
56938
+ property: "headers",
56939
+ value: []
56940
+ }];
56941
+ if (!headersGiven) return [];
56942
+ return [{
56943
+ flag: `--${HEADER_FLAG}`,
56944
+ property: "headers",
56945
+ value: parseHeaderFlags(given)
56946
+ }];
56947
+ }
56948
+ /**
56949
+ * Whether an update body sets request headers without a URL, which the API
56950
+ * refuses (headers_need_url): the CLI then sends the webhook's current URL.
56951
+ */
56952
+ function headersNeedUrl(body) {
56953
+ return isRecord$2(body) && Array.isArray(body.headers) && body.headers.length > 0 && (body.url === void 0 || body.url === null);
56954
+ }
56955
+ /** One line per warning an endpoint create or update answers with. */
56956
+ function endpointWarningLines(data) {
56957
+ const warnings = isRecord$2(data) ? data.warnings : void 0;
56958
+ if (!Array.isArray(warnings)) return [];
56959
+ return warnings.flatMap((warning) => {
56960
+ if (!isRecord$2(warning)) return [];
56961
+ const text = typeof warning.message === "string" && warning.message.trim() !== "" ? warning.message : typeof warning.code === "string" ? warning.code : "";
56962
+ return text ? [terminalLine(`Warning: ${text.replace(/\s+/g, " ").trim()}`)] : [];
56963
+ });
56964
+ }
56965
+ const HEADER_FLAG_DESCRIPTION = "A custom request header sent on every delivery to this webhook, as 'Name: value', for a receiver that needs a credential of its own: --header 'Authorization: Bearer <token>'. Repeat it for each header. Values are stored encrypted and never shown again. Only for webhooks.";
56966
+ const UPDATE_HEADER_NOTE = " The headers given replace every header the webhook has, so give each one it should keep. Sent with the webhook's URL, as the API asks: --url when given, else its current URL, read first.";
56967
+ function headerExtension(update) {
56968
+ return {
56969
+ flags: {
56970
+ [HEADER_FLAG]: Flags.string({
56971
+ description: `${HEADER_FLAG_DESCRIPTION}${update ? UPDATE_HEADER_NOTE : ""}`,
56972
+ multiple: true
56973
+ }),
56974
+ ...update ? { [CLEAR_HEADERS_FLAG]: Flags.boolean({ description: "Remove every custom request header from this webhook. Needs no --url. Not with --header." }) } : {}
56975
+ },
56976
+ bodyFields: headersBodyFields,
56977
+ bodyProperties: ["headers"],
56978
+ report: (data) => ({ lines: endpointWarningLines(data) })
56979
+ };
56980
+ }
56981
+ const ENDPOINT_HEADER_EXTENSIONS = {
56982
+ createEndpoint: headerExtension(false),
56983
+ updateEndpoint: headerExtension(true)
56984
+ };
55220
56985
  // src/oclif/endpoints-test-redirect.ts
55221
56986
  async function detectFunctionEndpoint(endpointId, listEndpoints) {
55222
56987
  let response;
@@ -57556,7 +59321,7 @@ function savedConnectedProfiles(configDir, exclude) {
57556
59321
  */
57557
59322
  async function otherProfiles(configDir, session, current) {
57558
59323
  if (session) try {
57559
- const { connectedProfilesForSession } = await import("./machine-session-ADcw9uJm.js").then((n) => n.s);
59324
+ const { connectedProfilesForSession } = await import("./machine-session-Cvo9BqYB.js").then((n) => n.s);
57560
59325
  return {
57561
59326
  inSession: true,
57562
59327
  profiles: connectedProfilesForSession(configDir, session, current)
@@ -58031,6 +59796,10 @@ const OPERATION_PATH_FLAGS = {
58031
59796
  stopRepeatFromEmail: { id: {
58032
59797
  flag: "email-id",
58033
59798
  description: EMAIL_ID_NOT_SENT
59799
+ } },
59800
+ listEmailRules: { all: {
59801
+ boolean: true,
59802
+ description: "List every rule in the organization, whoever wrote it, each with who receives what it matches (RECEIVERS). For owners and admins signed in themselves. Not with --matched-email-id."
58034
59803
  } }
58035
59804
  };
58036
59805
  /** End a description with a full stop when it has no closing punctuation. */
@@ -58202,7 +59971,7 @@ function flagForParameter(parameter, override) {
58202
59971
  required: parameter.required,
58203
59972
  ...override?.flag ? { aliases: [flagName(parameter.name)] } : {}
58204
59973
  };
58205
- if (parameter.type === "boolean") return Flags.boolean(common);
59974
+ if (parameter.type === "boolean" || override?.boolean) return Flags.boolean(common);
58206
59975
  if (parameter.type === "integer") return Flags.integer({
58207
59976
  ...common,
58208
59977
  ...numericFlagOptions(parameter)
@@ -58436,9 +60205,9 @@ const RESERVED_FLAG_NAMES = /* @__PURE__ */ new Set([
58436
60205
  "body-file",
58437
60206
  "output"
58438
60207
  ]);
58439
- function bodyFieldFlag(field, aliases) {
60208
+ function bodyFieldFlag(field, aliases, generatedRetryId = false) {
58440
60209
  const common = {
58441
- description: field.description || field.name,
60210
+ description: generatedRetryId ? `Retry ID, generated when omitted. ${field.description || field.name}` : field.description || field.name,
58442
60211
  ...aliases && aliases.length > 0 ? { aliases } : {}
58443
60212
  };
58444
60213
  if (field.kind === "boolean") return Flags.boolean({
@@ -58460,7 +60229,7 @@ function bodyFieldFlag(field, aliases) {
58460
60229
  });
58461
60230
  return Flags.string({
58462
60231
  ...common,
58463
- description: withLengthLimit(field.description, field.maxLength) || field.name
60232
+ description: withLengthLimit(generatedRetryId ? common.description : field.description, field.maxLength) || field.name
58464
60233
  });
58465
60234
  }
58466
60235
  /**
@@ -58507,13 +60276,14 @@ function buildFlags(operation) {
58507
60276
  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." });
58508
60277
  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]}` : ""}` });
58509
60278
  const bodyFields = extractBodyFields(operation.requestSchema);
60279
+ const generatedRetryIds = new Set(retryIdFields(operation.requestSchema));
58510
60280
  const aliasesForOperation = OPERATION_FLAG_ALIASES[operation.sdkName];
58511
60281
  for (const field of bodyFields) {
58512
60282
  if (field.kind === "complex") continue;
58513
60283
  const name = flagName(field.name);
58514
60284
  if (RESERVED_FLAG_NAMES.has(name)) continue;
58515
60285
  if (flags[name] !== void 0) continue;
58516
- flags[name] = bodyFieldFlag(field, aliasesForOperation?.[field.name]);
60286
+ flags[name] = bodyFieldFlag(field, aliasesForOperation?.[field.name], generatedRetryIds.has(field.name));
58517
60287
  bodyFieldFlagToProperty.set(name, field.name);
58518
60288
  }
58519
60289
  const extraFlags = OPERATION_EXTRA_BODY_FLAGS[operation.sdkName] ?? {};
@@ -58591,10 +60361,36 @@ async function applyEventTypesFlag(params) {
58591
60361
  const baseRules = params.endpointId !== void 0 && !bodyHasRules(params.body) ? await currentEndpointRules(params.endpointId, params.listEndpoints) : {};
58592
60362
  return withEventTypes(params.body, eventTypes, baseRules);
58593
60363
  } catch (error) {
58594
- if (error instanceof EventTypesFlagError) throw new Errors.CLIError(error.message);
60364
+ if (error instanceof EventTypesFlagError) throw cliError(error.message);
58595
60365
  throw error;
58596
60366
  }
58597
60367
  }
60368
+ /**
60369
+ * A webhook's stored URL and whether it is on, read so an update that sets
60370
+ * request headers can send the URL unchanged. Refused when it cannot be read,
60371
+ * or the endpoint is not a webhook, so headers are never sent without the
60372
+ * URL they are for.
60373
+ */
60374
+ async function currentWebhook(client, id) {
60375
+ const refused = (why) => cliError(`${why} Setting request headers needs the webhook's URL in the same request: pass it with --url.`);
60376
+ if (!id) throw refused("No endpoint id was given.");
60377
+ const read = await getEndpoint({
60378
+ client,
60379
+ path: { id },
60380
+ responseStyle: "fields"
60381
+ });
60382
+ if (read.error) {
60383
+ if (extractErrorCode(extractErrorPayload(read.error)) === "not_found" || read.response?.status === 404) throw new Errors.CLIError(`No endpoint ${id} was found, so nothing was changed. List endpoints with \`primitive endpoints list\`.`, { exit: 1 });
60384
+ throw refused("Could not read the endpoint's current URL.");
60385
+ }
60386
+ const endpoint = read.data?.data;
60387
+ if (endpoint?.kind !== void 0 && endpoint.kind !== "http") throw cliError("Request headers are only for webhooks; this endpoint is not one.");
60388
+ if (typeof endpoint?.url !== "string" || endpoint.url === "") throw refused("The endpoint has no URL to send.");
60389
+ return {
60390
+ url: endpoint.url,
60391
+ enabled: endpoint.enabled
60392
+ };
60393
+ }
58598
60394
  function collectValues(parameters, flags, sdkName) {
58599
60395
  const values = {};
58600
60396
  for (const parameter of parameters) {
@@ -58690,12 +60486,15 @@ const OPERATION_EXTRA_BODY_FLAGS = { addDomain: { "mail-relay": {
58690
60486
  } } };
58691
60487
  const OPERATION_EXTENSIONS = {
58692
60488
  ...EMAIL_RULE_OPERATION_EXTENSIONS,
60489
+ ...EMAIL_RULE_LISTING_EXTENSIONS,
60490
+ ...ENDPOINT_HEADER_EXTENSIONS,
58693
60491
  ...ANSWER_REPORT_EXTENSIONS
58694
60492
  };
58695
60493
  const MAIL_RELAY_NOT_ENABLED_MESSAGE = "Mail relay is not enabled for this account, so the domain was not added. Retry without --mail-relay to point the domain's MX at Primitive directly, or ask Primitive to enable mail relay for your account.";
58696
60494
  const MAIL_RELAY_UNAVAILABLE_MESSAGE = "No mail relay is available on this API server right now, so the domain was not added. Retry later, or retry without --mail-relay to point the domain's MX at Primitive directly.";
58697
60495
  const OPERATION_ERROR_HINTS = {
58698
60496
  inviteOrganizationMember: (code, body, payload) => inviteRefusalHint(code, body, payload),
60497
+ listEmailRules: (code, _body, payload, _path, flags) => listEmailRulesErrorHint(code, payload, flags),
58699
60498
  verifyDomain: (code, _body, payload) => code === "dns_verification_failed" ? domainVerificationFailedHint(payload) : void 0,
58700
60499
  addDomain: (code, body) => {
58701
60500
  if (code === "mail_relay_unavailable") return MAIL_RELAY_UNAVAILABLE_MESSAGE;
@@ -58703,7 +60502,7 @@ const OPERATION_ERROR_HINTS = {
58703
60502
  if (code === "feature_disabled" && mailRelay) return MAIL_RELAY_NOT_ENABLED_MESSAGE;
58704
60503
  }
58705
60504
  };
58706
- const OPERATION_ERROR_HINTS_REPLACING_CODE_HINT = /* @__PURE__ */ new Set(["inviteOrganizationMember"]);
60505
+ const OPERATION_ERROR_HINTS_REPLACING_CODE_HINT = /* @__PURE__ */ new Set(["inviteOrganizationMember", "listEmailRules"]);
58707
60506
  const OPERATION_SUCCESS_HOOKS = { verifyAgentSignup: ({ envelope, configDir, apiBaseUrl, writeStderr }) => {
58708
60507
  const data = envelope?.data;
58709
60508
  if (!data?.access_token || !data?.refresh_token) return;
@@ -58766,6 +60565,7 @@ function createOperationCommand(operation) {
58766
60565
  const positionalFlag = positional ? parameterFlagName(operation.sdkName, positional.name) : void 0;
58767
60566
  class OperationCommand extends Command {
58768
60567
  static description = fullDescription;
60568
+ static helpInputs = operationHelpInputs(operation, bodyFieldFlagToProperty, positionalFlag);
58769
60569
  static flags = flags;
58770
60570
  static args = positional && positionalFlag ? { [positionalFlag]: Args.string({
58771
60571
  description: `${sentence(OPERATION_PATH_FLAGS[operation.sdkName]?.[positional.name]?.description ?? positional.description ?? positional.name)} The same as --${positionalFlag}; give one of the two.`,
@@ -58792,47 +60592,65 @@ function createOperationCommand(operation) {
58792
60592
  "verifyAgentSignup",
58793
60593
  "resendAgentSignupVerification"
58794
60594
  ].includes(operation.operationId)) requireDefaultLoginProfile();
60595
+ let body;
60596
+ if (operation.hasJsonBody) {
60597
+ const explicit = readJsonBody(parsedFlags);
60598
+ const overrides = collectBodyFieldFlags(parsedFlags, bodyFieldFlagToProperty);
60599
+ const extensionFlagFor = /* @__PURE__ */ new Map();
60600
+ for (const field of extension?.bodyFields?.(parsedFlags, explicit) ?? []) {
60601
+ overrides[field.property] = field.value;
60602
+ extensionFlagFor.set(field.property, field.flag);
60603
+ }
60604
+ if (Object.keys(overrides).length > 0) {
60605
+ if (explicit === void 0) body = overrides;
60606
+ else if (explicit !== null && typeof explicit === "object" && !Array.isArray(explicit)) body = {
60607
+ ...explicit,
60608
+ ...overrides
60609
+ };
60610
+ else throw cliError(`--raw-body must be a JSON object when also passing per-field flags (got ${explicit === null ? "null" : Array.isArray(explicit) ? "array" : typeof explicit}); supplied per-field flags: ${Object.keys(overrides).map((p) => extensionFlagFor.get(p) ?? `--${flagName(p)}`).join(", ")}. Either drop --raw-body and rely on the per-field flags, or move every field into the JSON --raw-body and drop the flags.`);
60611
+ } else body = explicit;
60612
+ }
60613
+ const bodyBeforeEventTypes = body;
60614
+ const eventTypes = EVENT_TYPES_FLAG_OPERATIONS.has(operation.sdkName) && Array.isArray(parsedFlags["event-types"]) ? parsedFlags["event-types"] : void 0;
60615
+ if (eventTypes) try {
60616
+ body = withEventTypes(body, parseEventTypesFlag(eventTypes));
60617
+ } catch (error) {
60618
+ if (error instanceof EventTypesFlagError) throw cliError(error.message);
60619
+ throw error;
60620
+ }
60621
+ else if (operation.sdkName === "createEndpoint") body = withDefaultEventTypes(body);
60622
+ const bodyPropertyFlags = new Map([...bodyFieldFlagToProperty].map(([flag, property]) => [property, `--${flag}`]));
60623
+ const retry = prepareRetryIds(operation.requestSchema, body, bodyFieldFlagToProperty);
60624
+ body = retry.body;
60625
+ assertRequiredBodyFields(operation.requestSchema, body, bodyPropertyFlags, operation.bodyRequired);
60626
+ const tooLong = overLongBodyField(operation.requestSchema, body);
60627
+ if (tooLong) throw cliError(tooLong);
60628
+ if (parsedFlags.json === true) rememberRetryIds(this, retry.ids);
60629
+ else writeRetryIdNotice(retry.ids);
58795
60630
  await runWithTiming(parsedFlags.time === true, async () => {
58796
60631
  const { apiClient, auth, baseUrlOverridden } = await createAuthenticatedCliApiClient({
58797
60632
  apiKey: typeof parsedFlags["api-key"] === "string" ? parsedFlags["api-key"] : void 0,
58798
60633
  apiBaseUrl: typeof parsedFlags["api-base-url"] === "string" ? parsedFlags["api-base-url"] : void 0,
58799
60634
  configDir: this.config.configDir
58800
60635
  });
58801
- let body;
58802
- if (operation.hasJsonBody) {
58803
- const explicit = readJsonBody(parsedFlags);
58804
- const overrides = collectBodyFieldFlags(parsedFlags, bodyFieldFlagToProperty);
58805
- const extensionFlagFor = /* @__PURE__ */ new Map();
58806
- for (const field of extension?.bodyFields?.(parsedFlags, explicit) ?? []) {
58807
- overrides[field.property] = field.value;
58808
- extensionFlagFor.set(field.property, field.flag);
58809
- }
58810
- if (Object.keys(overrides).length > 0) {
58811
- if (explicit === void 0) body = overrides;
58812
- else if (explicit !== null && typeof explicit === "object" && !Array.isArray(explicit)) body = {
58813
- ...explicit,
58814
- ...overrides
58815
- };
58816
- else {
58817
- const explicitKind = explicit === null ? "null" : Array.isArray(explicit) ? "array" : typeof explicit;
58818
- const overrideFlags = Object.keys(overrides).map((p) => extensionFlagFor.get(p) ?? `--${flagName(p)}`).join(", ");
58819
- throw new Errors.CLIError(`--raw-body must be a JSON object when also passing per-field flags (got ${explicitKind}); supplied per-field flags: ${overrideFlags}. Either drop --raw-body and rely on the per-field flags, or move every field into the JSON --raw-body and drop the flags.`);
58820
- }
58821
- } else body = explicit;
58822
- }
58823
- if (EVENT_TYPES_FLAG_OPERATIONS.has(operation.sdkName) && Array.isArray(parsedFlags["event-types"])) body = await applyEventTypesFlag({
58824
- body,
58825
- values: parsedFlags["event-types"],
58826
- endpointId: operation.sdkName === "updateEndpoint" && typeof parsedFlags.id === "string" ? parsedFlags.id : void 0,
60636
+ if (eventTypes && operation.sdkName === "updateEndpoint" && !bodyHasRules(bodyBeforeEventTypes)) body = await applyEventTypesFlag({
60637
+ body: bodyBeforeEventTypes,
60638
+ values: eventTypes,
60639
+ endpointId: typeof parsedFlags.id === "string" ? parsedFlags.id : void 0,
58827
60640
  listEndpoints: () => listEndpoints({
58828
60641
  client: apiClient.client,
58829
60642
  responseStyle: "fields"
58830
60643
  })
58831
60644
  });
58832
- else if (operation.sdkName === "createEndpoint") body = withDefaultEventTypes(body);
58833
- 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.`);
58834
- const tooLong = overLongBodyField(operation.requestSchema, body);
58835
- if (tooLong) throw new Errors.CLIError(tooLong, { exit: 2 });
60645
+ if (operation.sdkName === "updateEndpoint" && headersNeedUrl(body)) {
60646
+ const current = await currentWebhook(apiClient.client, typeof parsedFlags.id === "string" ? parsedFlags.id : void 0);
60647
+ const given = body;
60648
+ body = {
60649
+ ...given,
60650
+ url: current.url,
60651
+ ...current.enabled === false && given.enabled === void 0 ? { enabled: false } : {}
60652
+ };
60653
+ }
58836
60654
  const operationFn = sdk_gen_exports[operation.sdkName];
58837
60655
  const given = collectValues(operation.queryParams, parsedFlags, operation.sdkName);
58838
60656
  const unfocused = operation.sdkName === "listSentEmails" ? withMineDefault(given, parsedFlags) : given;
@@ -59030,7 +60848,7 @@ function createOperationCommand(operation) {
59030
60848
  ...tail ? { pastFlag: "--since" } : query.cursor !== void 0 ? { pastFlag: "--cursor" } : {},
59031
60849
  nextCursor: tail ? null : more,
59032
60850
  caller: tail || more ? null : await readCallerMailFor(auth, apiClient.client)
59033
- }) : emptyDeliveriesHint(operation.sdkName, query) ?? EMPTY_RESULT_HINTS[operation.sdkName];
60851
+ }) : operation.sdkName === "listEmailRules" ? more ? void 0 : emptyRuleListHint(query.all === true) : emptyDeliveriesHint(operation.sdkName, query) ?? EMPTY_RESULT_HINTS[operation.sdkName];
59034
60852
  if (hint && jsonOutput) summary.push(hint);
59035
60853
  else if (hint) process.stderr.write(`${hint}\n`);
59036
60854
  }
@@ -59072,7 +60890,8 @@ function createOperationCommand(operation) {
59072
60890
  report = (extension?.report ?? (RULE_NOTES_TAGS.has(operation.tag) && envelope?.data !== null && typeof envelope?.data === "object" && !Array.isArray(envelope?.data) ? ruleNotesReport : void 0))?.(envelope?.data, {
59073
60891
  body,
59074
60892
  path: collectValues(operation.pathParams, parsedFlags, operation.sdkName),
59075
- flags: parsedFlags
60893
+ flags: parsedFlags,
60894
+ meta: envelope?.meta
59076
60895
  });
59077
60896
  } catch (error) {
59078
60897
  reportError = error instanceof Error ? error.message : String(error);