primcli 1.24.0 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -156,6 +156,7 @@ primitive chat reply "See attached" --attachment ./report.pdf
156
156
  primitive emails list
157
157
  primitive emails get --id <inbound-email-id>
158
158
  primitive sent list
159
+ primitive sent delete --id <sent-email-id>
159
160
  primitive domains list
160
161
  primitive functions templates
161
162
  primitive functions init my-fn --template email-reply
@@ -167,6 +168,24 @@ primitive deliveries replay --id <delivery-id>
167
168
 
168
169
  Generated API commands remain available for compatibility and full schema parity, for example `primitive emails:list-emails` and `primitive sending:reply-to-email`.
169
170
 
171
+ ## Remove mailbox history
172
+
173
+ `primitive sent delete --id <sent-email-id>` removes sender history and owned
174
+ attachments. It does not recall delivery or delete recipient copies. Cancel
175
+ scheduled sends before deleting them. A 409 means the record is not currently
176
+ eligible; a 500 or 503 may mean some files were removed already, so retry the same
177
+ DELETE. Repeating a completed deletion succeeds.
178
+
179
+ After disconnecting an agent, an owner or admin logged in with OAuth can run
180
+ `primitive agent-connections remove-agent-connection --address agent@example.com`.
181
+ This removes the revoked connection record while preserving mail, notes and the
182
+ external runtime. Active connections return 409; missing records return 404.
183
+ Organization API keys cannot remove connections.
184
+
185
+ Send and reply can return HTTP 410 `sent_email_deleted` when a prior send was
186
+ deleted. Its occupied idempotency key or automatic reply suppression stays reserved.
187
+ Do not generate a new key or send again to bypass this refusal.
188
+
170
189
  ## Primitive Memories
171
190
 
172
191
  Memories are durable JSON key-value records scoped to your org by default. Use
@@ -62,6 +62,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
62
62
  deleteOrgSecret: () => deleteOrgSecret,
63
63
  deleteRegistry: () => deleteRegistry,
64
64
  deleteRoute: () => deleteRoute,
65
+ deleteSentEmail: () => deleteSentEmail,
65
66
  deleteWakeAuthorization: () => deleteWakeAuthorization,
66
67
  deleteWakeSchedule: () => deleteWakeSchedule,
67
68
  discardEmailContent: () => discardEmailContent,
@@ -118,6 +119,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
118
119
  publishAgent: () => publishAgent,
119
120
  pullWebhookEvent: () => pullWebhookEvent,
120
121
  registerPayoutAddress: () => registerPayoutAddress,
122
+ removeAgentConnection: () => removeAgentConnection,
121
123
  reorderRoutes: () => reorderRoutes,
122
124
  replayDelivery: () => replayDelivery,
123
125
  replayEmailWebhooks: () => replayEmailWebhooks,
@@ -1627,6 +1629,29 @@ const listSentEmails = (options) => (options?.client ?? client).get({
1627
1629
  ...options
1628
1630
  });
1629
1631
  /**
1632
+ * Delete a sent email
1633
+ *
1634
+ * Permanently deletes sender mailbox history and its owned attachment archive
1635
+ * and transient payload. Allows delivered, bounced, agent_failed, gate_denied,
1636
+ * canceled, deferred and wait_timeout; other states return 409. Cancel scheduled
1637
+ * sends first. This does not recall or cancel delivery already admitted.
1638
+ * Recipient copies, received replies and independent audit records are preserved.
1639
+ * Occupied idempotency keys and delivered-reply deduplication remain reserved.
1640
+ * Keys already released by cancellation, gate denial or a never-attempted failure
1641
+ * remain reusable. Repeating a completed deletion succeeds; unknown or foreign
1642
+ * IDs return 404. Organization API keys, sessions and OAuth are supported;
1643
+ * Function and connected-agent credentials are denied.
1644
+ *
1645
+ */
1646
+ const deleteSentEmail = (options) => (options.client ?? client).delete({
1647
+ security: [{
1648
+ scheme: "bearer",
1649
+ type: "http"
1650
+ }],
1651
+ url: "/sent-emails/{id}",
1652
+ ...options
1653
+ });
1654
+ /**
1630
1655
  * Get a sent email by id
1631
1656
  *
1632
1657
  * Returns the full sent-email record by id, including
@@ -1676,6 +1701,26 @@ const rescheduleSentEmail = (options) => (options.client ?? client).patch({
1676
1701
  }
1677
1702
  });
1678
1703
  /**
1704
+ * Remove a revoked agent connection
1705
+ *
1706
+ * Permanently removes a revoked connection record. Requires an organization
1707
+ * owner or admin session or OAuth token; organization API keys are denied.
1708
+ * Disconnect first using DELETE /agent-connections/{address}. An active
1709
+ * connection returns 409 connection_not_revoked. Missing or already removed
1710
+ * records return 404. Mail, address notes, domains and external runtimes are
1711
+ * preserved. The same address can be paired again with a new invitation;
1712
+ * old credentials and invitations remain invalid.
1713
+ *
1714
+ */
1715
+ const removeAgentConnection = (options) => (options.client ?? client).post({
1716
+ security: [{
1717
+ scheme: "bearer",
1718
+ type: "http"
1719
+ }],
1720
+ url: "/agent-connections/{address}/remove",
1721
+ ...options
1722
+ });
1723
+ /**
1679
1724
  * Cancel a scheduled send
1680
1725
  *
1681
1726
  * Cancels a STILL-SCHEDULED send (status `scheduled`), moving it
@@ -2722,6 +2767,10 @@ const openapiDocument = {
2722
2767
  }],
2723
2768
  "security": [{ "BearerAuth": [] }],
2724
2769
  "tags": [
2770
+ {
2771
+ "name": "Agent Connections",
2772
+ "description": "Manage address-bound connections to external agent runtimes."
2773
+ },
2725
2774
  {
2726
2775
  "name": "CLI",
2727
2776
  "description": "Browser-assisted CLI authentication"
@@ -4057,6 +4106,10 @@ const openapiDocument = {
4057
4106
  "401": { "$ref": "#/components/responses/Unauthorized" },
4058
4107
  "403": { "$ref": "#/components/responses/Forbidden" },
4059
4108
  "404": { "$ref": "#/components/responses/NotFound" },
4109
+ "410": {
4110
+ "description": "The prior send was deleted. Its idempotency key or automatic reply suppression remains reserved, so this request will not send another message. Do not retry with a new key to bypass this refusal.",
4111
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
4112
+ },
4060
4113
  "422": {
4061
4114
  "description": "Inbound is not repliable: the row exists but lacks a\n`message_id` (no thread anchor) or a `recipient` (cannot\nderive the From address).\n",
4062
4115
  "content": { "application/json": {
@@ -4949,6 +5002,10 @@ const openapiDocument = {
4949
5002
  "400": { "$ref": "#/components/responses/ValidationError" },
4950
5003
  "401": { "$ref": "#/components/responses/Unauthorized" },
4951
5004
  "403": { "$ref": "#/components/responses/Forbidden" },
5005
+ "410": {
5006
+ "description": "The prior send was deleted. Its idempotency key or automatic reply suppression remains reserved, so this request will not send another message. Do not retry with a new key to bypass this refusal.",
5007
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
5008
+ },
4952
5009
  "429": { "$ref": "#/components/responses/RateLimited" },
4953
5010
  "500": { "$ref": "#/components/responses/InternalError" },
4954
5011
  "502": { "$ref": "#/components/responses/BadGateway" },
@@ -5071,6 +5128,50 @@ const openapiDocument = {
5071
5128
  }
5072
5129
  } },
5073
5130
  "/sent-emails/{id}": {
5131
+ "delete": {
5132
+ "operationId": "deleteSentEmail",
5133
+ "summary": "Delete a sent email",
5134
+ "description": "Permanently deletes sender mailbox history and its owned attachment archive\nand transient payload. Allows delivered, bounced, agent_failed, gate_denied,\ncanceled, deferred and wait_timeout; other states return 409. Cancel scheduled\nsends first. This does not recall or cancel delivery already admitted.\nRecipient copies, received replies and independent audit records are preserved.\nOccupied idempotency keys and delivered-reply deduplication remain reserved.\nKeys already released by cancellation, gate denial or a never-attempted failure\nremain reusable. Repeating a completed deletion succeeds; unknown or foreign\nIDs return 404. Organization API keys, sessions and OAuth are supported;\nFunction and connected-agent credentials are denied.\n",
5135
+ "tags": ["Sending"],
5136
+ "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
5137
+ "responses": {
5138
+ "200": {
5139
+ "description": "Deletion completed",
5140
+ "content": { "application/json": { "schema": {
5141
+ "type": "object",
5142
+ "required": ["success", "data"],
5143
+ "properties": {
5144
+ "success": {
5145
+ "type": "boolean",
5146
+ "const": true
5147
+ },
5148
+ "data": {
5149
+ "type": "object",
5150
+ "required": ["deleted"],
5151
+ "properties": { "deleted": {
5152
+ "type": "boolean",
5153
+ "const": true
5154
+ } }
5155
+ }
5156
+ }
5157
+ } } }
5158
+ },
5159
+ "400": { "$ref": "#/components/responses/ValidationError" },
5160
+ "401": { "$ref": "#/components/responses/Unauthorized" },
5161
+ "403": { "$ref": "#/components/responses/Forbidden" },
5162
+ "404": { "$ref": "#/components/responses/NotFound" },
5163
+ "409": { "$ref": "#/components/responses/Conflict" },
5164
+ "429": { "$ref": "#/components/responses/RateLimited" },
5165
+ "500": {
5166
+ "description": "Database failure. Files may already be removed while the message record and cleanup references remain. Retry the same DELETE; failure does not restore files.",
5167
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
5168
+ },
5169
+ "503": {
5170
+ "description": "Storage cleanup failed. Some files may already be removed; the message record and cleanup references remain for an idempotent retry. Failure does not restore files.",
5171
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
5172
+ }
5173
+ }
5174
+ },
5074
5175
  "get": {
5075
5176
  "operationId": "getSentEmail",
5076
5177
  "summary": "Get a sent email by id",
@@ -5131,6 +5232,52 @@ const openapiDocument = {
5131
5232
  }
5132
5233
  }
5133
5234
  },
5235
+ "/agent-connections/{address}/remove": { "post": {
5236
+ "operationId": "removeAgentConnection",
5237
+ "summary": "Remove a revoked agent connection",
5238
+ "description": "Permanently removes a revoked connection record. Requires an organization\nowner or admin session or OAuth token; organization API keys are denied.\nDisconnect first using DELETE /agent-connections/{address}. An active\nconnection returns 409 connection_not_revoked. Missing or already removed\nrecords return 404. Mail, address notes, domains and external runtimes are\npreserved. The same address can be paired again with a new invitation;\nold credentials and invitations remain invalid.\n",
5239
+ "tags": ["Agent Connections"],
5240
+ "parameters": [{
5241
+ "name": "address",
5242
+ "in": "path",
5243
+ "required": true,
5244
+ "description": "The email address identifying the revoked connection.",
5245
+ "schema": {
5246
+ "type": "string",
5247
+ "format": "email",
5248
+ "maxLength": 254
5249
+ }
5250
+ }],
5251
+ "responses": {
5252
+ "200": {
5253
+ "description": "Deletion completed",
5254
+ "content": { "application/json": { "schema": {
5255
+ "type": "object",
5256
+ "required": ["success", "data"],
5257
+ "properties": {
5258
+ "success": {
5259
+ "type": "boolean",
5260
+ "const": true
5261
+ },
5262
+ "data": {
5263
+ "type": "object",
5264
+ "required": ["deleted"],
5265
+ "properties": { "deleted": {
5266
+ "type": "boolean",
5267
+ "const": true
5268
+ } }
5269
+ }
5270
+ }
5271
+ } } }
5272
+ },
5273
+ "400": { "$ref": "#/components/responses/ValidationError" },
5274
+ "401": { "$ref": "#/components/responses/Unauthorized" },
5275
+ "403": { "$ref": "#/components/responses/Forbidden" },
5276
+ "404": { "$ref": "#/components/responses/NotFound" },
5277
+ "409": { "$ref": "#/components/responses/Conflict" },
5278
+ "429": { "$ref": "#/components/responses/RateLimited" }
5279
+ }
5280
+ } },
5134
5281
  "/sent-emails/{id}/cancel": {
5135
5282
  "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
5136
5283
  "post": {
@@ -7837,6 +7984,11 @@ const openapiDocument = {
7837
7984
  "conflict",
7838
7985
  "mx_conflict",
7839
7986
  "not_scheduled",
7987
+ "sent_email_deleted",
7988
+ "sent_email_not_settled",
7989
+ "sent_email_changed",
7990
+ "sent_email_cleanup_failed",
7991
+ "connection_not_revoked",
7840
7992
  "attachment_changed",
7841
7993
  "content_discarded",
7842
7994
  "attachment_limit_exceeded",
@@ -14751,6 +14903,47 @@ const operationManifest = [
14751
14903
  "tag": "Agent",
14752
14904
  "tagCommand": "agent"
14753
14905
  },
14906
+ {
14907
+ "binaryResponse": false,
14908
+ "bodyRequired": false,
14909
+ "command": "remove-agent-connection",
14910
+ "description": "Permanently removes a revoked connection record. Requires an organization\nowner or admin session or OAuth token; organization API keys are denied.\nDisconnect first using DELETE /agent-connections/{address}. An active\nconnection returns 409 connection_not_revoked. Missing or already removed\nrecords return 404. Mail, address notes, domains and external runtimes are\npreserved. The same address can be paired again with a new invitation;\nold credentials and invitations remain invalid.\n",
14911
+ "hasJsonBody": false,
14912
+ "method": "POST",
14913
+ "operationId": "removeAgentConnection",
14914
+ "path": "/agent-connections/{address}/remove",
14915
+ "pathParams": [{
14916
+ "description": "The email address identifying the revoked connection.",
14917
+ "enum": null,
14918
+ "name": "address",
14919
+ "required": true,
14920
+ "type": "string"
14921
+ }],
14922
+ "queryParams": [],
14923
+ "requestSchema": null,
14924
+ "responseSchema": {
14925
+ "type": "object",
14926
+ "required": ["success", "data"],
14927
+ "properties": {
14928
+ "success": {
14929
+ "type": "boolean",
14930
+ "const": true
14931
+ },
14932
+ "data": {
14933
+ "type": "object",
14934
+ "required": ["deleted"],
14935
+ "properties": { "deleted": {
14936
+ "type": "boolean",
14937
+ "const": true
14938
+ } }
14939
+ }
14940
+ }
14941
+ },
14942
+ "sdkName": "removeAgentConnection",
14943
+ "summary": "Remove a revoked agent connection",
14944
+ "tag": "Agent Connections",
14945
+ "tagCommand": "agent-connections"
14946
+ },
14754
14947
  {
14755
14948
  "binaryResponse": false,
14756
14949
  "bodyRequired": false,
@@ -24062,6 +24255,47 @@ const operationManifest = [
24062
24255
  "tag": "Sending",
24063
24256
  "tagCommand": "sending"
24064
24257
  },
24258
+ {
24259
+ "binaryResponse": false,
24260
+ "bodyRequired": false,
24261
+ "command": "delete-sent-email",
24262
+ "description": "Permanently deletes sender mailbox history and its owned attachment archive\nand transient payload. Allows delivered, bounced, agent_failed, gate_denied,\ncanceled, deferred and wait_timeout; other states return 409. Cancel scheduled\nsends first. This does not recall or cancel delivery already admitted.\nRecipient copies, received replies and independent audit records are preserved.\nOccupied idempotency keys and delivered-reply deduplication remain reserved.\nKeys already released by cancellation, gate denial or a never-attempted failure\nremain reusable. Repeating a completed deletion succeeds; unknown or foreign\nIDs return 404. Organization API keys, sessions and OAuth are supported;\nFunction and connected-agent credentials are denied.\n",
24263
+ "hasJsonBody": false,
24264
+ "method": "DELETE",
24265
+ "operationId": "deleteSentEmail",
24266
+ "path": "/sent-emails/{id}",
24267
+ "pathParams": [{
24268
+ "description": "Resource UUID",
24269
+ "enum": null,
24270
+ "name": "id",
24271
+ "required": true,
24272
+ "type": "string"
24273
+ }],
24274
+ "queryParams": [],
24275
+ "requestSchema": null,
24276
+ "responseSchema": {
24277
+ "type": "object",
24278
+ "required": ["success", "data"],
24279
+ "properties": {
24280
+ "success": {
24281
+ "type": "boolean",
24282
+ "const": true
24283
+ },
24284
+ "data": {
24285
+ "type": "object",
24286
+ "required": ["deleted"],
24287
+ "properties": { "deleted": {
24288
+ "type": "boolean",
24289
+ "const": true
24290
+ } }
24291
+ }
24292
+ }
24293
+ },
24294
+ "sdkName": "deleteSentEmail",
24295
+ "summary": "Delete a sent email",
24296
+ "tag": "Sending",
24297
+ "tagCommand": "sending"
24298
+ },
24065
24299
  {
24066
24300
  "binaryResponse": true,
24067
24301
  "bodyRequired": false,
@@ -31837,8 +32071,8 @@ const PRIMITIVE_TEAM_AUTHOR = {
31837
32071
  name: "Primitive Team",
31838
32072
  url: "https://primitive.dev"
31839
32073
  };
31840
- const SDK_VERSION_RANGE = "^1.24.0";
31841
- const CLI_VERSION_RANGE = "^1.24.0";
32074
+ const SDK_VERSION_RANGE = "^1.25.0";
32075
+ const CLI_VERSION_RANGE = "^1.25.0";
31842
32076
  const ESBUILD_VERSION_RANGE = "^0.27.0";
31843
32077
  function renderHandler() {
31844
32078
  return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
@@ -41496,6 +41730,7 @@ const CANONICAL_OPERATION_ALIASES = {
41496
41730
  "sending:permissions": "sending:get-send-permissions",
41497
41731
  "sending:reply": "sending:reply-to-email",
41498
41732
  "sending:send": "sending:send-email",
41733
+ "sent:delete": "sending:delete-sent-email",
41499
41734
  "sent:get": "sending:get-sent-email",
41500
41735
  "sent:list": "sending:list-sent-emails",
41501
41736
  "threads:get": "threads:get-thread",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primcli",
3
- "version": "1.24.0",
3
+ "version": "1.25.0",
4
4
  "description": "Official Primitive CLI: deploy Primitive Functions, send and inspect mail, manage endpoints, all from the terminal. Wraps the @primitivedotdev/sdk runtime client with one-shot commands.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -49,6 +49,9 @@
49
49
  "account": {
50
50
  "description": "Manage your account settings, storage, and webhook secret"
51
51
  },
52
+ "agent-connections": {
53
+ "description": "Remove revoked agent connections with an organization owner or admin login. This preserves mail and does not stop the external runtime."
54
+ },
52
55
  "agent": {
53
56
  "description": "Agent signup and authentication API operations"
54
57
  },
@@ -81,7 +84,7 @@
81
84
  "description": "Authenticate with an emailed one-time code"
82
85
  },
83
86
  "sent": {
84
- "description": "Short aliases for outbound sent-email history: `primitive sent list` and `primitive sent get`."
87
+ "description": "Short aliases for outbound sent-email history: `primitive sent list`, `primitive sent get`, and `primitive sent delete --id <id>`. Deleting sender history does not recall delivery."
85
88
  },
86
89
  "threads": {
87
90
  "description": "Inspect conversation threads spanning received and sent emails. Prefer `primitive threads get --id <thread-id>`; generated API name `primitive threads get-thread --id <thread-id>` remains available."