@samva/cli 0.11.0 → 0.12.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.
Files changed (3) hide show
  1. package/AGENTS.md +4 -2
  2. package/dist/bin.mjs +178 -76
  3. package/package.json +7 -7
package/AGENTS.md CHANGED
@@ -109,8 +109,10 @@ calls to you, rather than to an installation. Read what exists with `list`, `ver
109
109
  `--cursor`, and `--all --jsonl`.
110
110
 
111
111
  `samva mailboxes` reads and sends as a mailbox: `list` pages with `--limit`, `--cursor`, `--after`,
112
- and `--before`. `get <id>` inspects a mailbox; `update <id> --data <JSON-or-@file>` changes
113
- `displayName`, `defaultFrom`, or `metadata` (merges by key, `null` deletes a key). `pause <id>`
112
+ and `--before`. `create --address <address> --name <name>` makes a mailbox with one address; the
113
+ slug defaults to the address's local part, and a collision asks for `--slug` rather than suffixing.
114
+ `get <id>` inspects a mailbox; `update <id> --data <JSON-or-@file>` changes
115
+ `name`, `defaultFrom`, or `metadata` (merges by key, `null` deletes a key). `pause <id>`
114
116
  stops sending and receiving, and `resume <id>` resumes without backfilling mail received while
115
117
  paused. These mutations support `--dry-run`. `remove <id>` deletes a mailbox (`--yes` outside a terminal, `--dry-run` to
116
118
  preview), `threads` searches, `read` prints a message (human output marks the body as
package/dist/bin.mjs CHANGED
@@ -13987,7 +13987,7 @@ var layer12 = /* @__PURE__ */ layer.pipe(/* @__PURE__ */ provideMerge(/* @__PURE
13987
13987
  // package.json
13988
13988
  var package_default = {
13989
13989
  name: "@samva/cli",
13990
- version: "0.11.0",
13990
+ version: "0.12.0",
13991
13991
  description: "Samva CLI \u2014 email and platform operations from your terminal",
13992
13992
  keywords: [
13993
13993
  "cli",
@@ -14042,16 +14042,16 @@ var package_default = {
14042
14042
  "@types/node": "catalog:",
14043
14043
  "better-auth": "catalog:",
14044
14044
  effect: "catalog:effect",
14045
- samva: "workspace:0.14.0",
14045
+ samva: "workspace:0.15.0",
14046
14046
  typescript: "catalog:",
14047
14047
  vite: "~8.3.0",
14048
14048
  vitest: "catalog:"
14049
14049
  },
14050
14050
  optionalDependencies: {
14051
- "@samva/cli-darwin-arm64": "workspace:0.11.0",
14052
- "@samva/cli-darwin-x64": "workspace:0.11.0",
14053
- "@samva/cli-linux-arm64": "workspace:0.11.0",
14054
- "@samva/cli-linux-x64": "workspace:0.11.0"
14051
+ "@samva/cli-darwin-arm64": "workspace:0.12.0",
14052
+ "@samva/cli-darwin-x64": "workspace:0.12.0",
14053
+ "@samva/cli-linux-arm64": "workspace:0.12.0",
14054
+ "@samva/cli-linux-x64": "workspace:0.12.0"
14055
14055
  },
14056
14056
  engines: {
14057
14057
  node: ">=18"
@@ -43626,8 +43626,8 @@ var DIAGNOSTIC_CODES = codes2({
43626
43626
  channelOnly: true
43627
43627
  }
43628
43628
  });
43629
- // ../sdk/dist/inline-attachments-BrNnSMF2.js
43630
- var SDK_VERSION = "0.14.0";
43629
+ // ../sdk/dist/inline-attachments-UxLeyytJ.js
43630
+ var SDK_VERSION = "0.15.0";
43631
43631
  var CLIENT_ATTRIBUTION_HEADER = "x-samva-client";
43632
43632
  var clientAttribution = (surface) => `${surface}/${SDK_VERSION}`;
43633
43633
  var MediaUploadError = class extends Error {
@@ -46170,7 +46170,7 @@ var fetch2 = /* @__PURE__ */ make34((request, url, signal, fiber) => {
46170
46170
  });
46171
46171
  var layer15 = /* @__PURE__ */ layerMergedContext(/* @__PURE__ */ succeed6(fetch2));
46172
46172
 
46173
- // ../sdk/dist/client-CZjhOKPM.js
46173
+ // ../sdk/dist/client-CDg7zJs0.js
46174
46174
  var Sensitive = (schema) => RedactedFromValue(schema);
46175
46175
  var SensitiveString = Sensitive(String4);
46176
46176
  var ABSOLUTE_ISO_INSTANT_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|([+-])(\d{2}):(\d{2}))$/;
@@ -46766,11 +46766,6 @@ var FeedbackId = String4.check(isPattern2(/* @__PURE__ */ new RegExp("^fdbk_[0-9
46766
46766
  identifier: "FeedbackId"
46767
46767
  })).pipe(brand("FeedbackId"));
46768
46768
  var MailboxStatus = Union2([Literal2("active"), Literal2("paused")]).annotate({ identifier: "MailboxStatus" });
46769
- var CreateMailboxAddressPayload = Struct({
46770
- address: String4,
46771
- displayName: optionalKey2(Union2([String4, Null2])),
46772
- domainId: optionalKey2(Union2([String4, Null2]))
46773
- }).annotate({ identifier: "CreateMailboxAddressPayload" });
46774
46769
  var MailboxMetadata = Record(String4, String4.check(isMaxCodePoints(512).annotate({ expected: "a string with at most 512 code points" })).check(isMaxLength(512).annotate({ expected: "a value with a length of at most 512" }))).check(isPropertyNames(String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxCodePoints(64).annotate({ expected: "a string with at most 64 code points" }))).annotate({
46775
46770
  expected: "an object with property names matching the schema",
46776
46771
  identifier: "MailboxMetadata"
@@ -46943,6 +46938,7 @@ var MailboxAgentActivity = Struct({
46943
46938
  type: Union2([
46944
46939
  Literal2("mailbox.created"),
46945
46940
  Literal2("address.attached"),
46941
+ Literal2("address.detached"),
46946
46942
  Literal2("email.received"),
46947
46943
  Literal2("email.released"),
46948
46944
  Literal2("email.sent"),
@@ -47285,6 +47281,10 @@ Struct({
47285
47281
  dailyGrowthPercent: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })).check(isLessThanOrEqualTo3(1e4).annotate({ expected: "a value less than or equal to 10000" })),
47286
47282
  targetDailyRecipients: Finite.check(isInt().annotate({ expected: "an integer" })).check(isLessThanOrEqualTo3(1e6).annotate({ expected: "a value less than or equal to 1000000" })).check(isGreaterThan2(0).annotate({ expected: "a value greater than 0" }))
47287
47283
  }).annotate({ identifier: "CreateDomainWarmingPlanPayload" });
47284
+ Struct({
47285
+ address: String4,
47286
+ displayName: optionalKey2(Union2([String4, Null2]))
47287
+ }).annotate({ identifier: "CreateMailboxAddressPayload" });
47288
47288
  Struct({
47289
47289
  slug: String4,
47290
47290
  displayName: String4,
@@ -48479,20 +48479,16 @@ var MailboxSummary = Struct({
48479
48479
  id: MailboxId,
48480
48480
  namespaceId: Union2([NamespaceId, Null2]),
48481
48481
  slug: String4,
48482
- displayName: String4,
48482
+ name: String4,
48483
48483
  status: MailboxStatus,
48484
48484
  primaryAddress: Union2([String4, Null2]),
48485
48485
  createdAt: String4
48486
48486
  }).annotate({ identifier: "MailboxSummary" });
48487
48487
  Struct({
48488
48488
  namespaceId: optionalKey2(Union2([NamespaceId, Null2])),
48489
- displayName: String4,
48490
- slug: String4,
48491
- addresses: TupleWithRest(Tuple2([CreateMailboxAddressPayload]), [CreateMailboxAddressPayload]),
48492
- defaultFrom: optionalKey2(Union2([Struct({
48493
- address: String4,
48494
- displayName: optionalKey2(Union2([String4, Null2]))
48495
- }), Null2])),
48489
+ address: String4,
48490
+ name: String4,
48491
+ slug: optionalKey2(Union2([String4, Null2])),
48496
48492
  metadata: optionalKey2(Union2([MailboxMetadata, Null2]))
48497
48493
  }).annotate({ identifier: "CreateMailboxPayload" });
48498
48494
  var MailboxAddress = Struct({
@@ -48503,7 +48499,7 @@ var MailboxAddress = Struct({
48503
48499
  displayName: Union2([String4, Null2])
48504
48500
  }).annotate({ identifier: "MailboxAddress" });
48505
48501
  Struct({
48506
- displayName: optionalKey2(Union2([String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })), Null2])),
48502
+ name: optionalKey2(Union2([String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })), Null2])),
48507
48503
  metadata: optionalKey2(Union2([MailboxMetadataPatch, Null2])),
48508
48504
  defaultFrom: optionalKey2(Union2([Struct({
48509
48505
  address: String4,
@@ -48570,6 +48566,7 @@ var MailboxEvent = Struct({
48570
48566
  type: Union2([
48571
48567
  Literal2("mailbox.created"),
48572
48568
  Literal2("address.attached"),
48569
+ Literal2("address.detached"),
48573
48570
  Literal2("email.received"),
48574
48571
  Literal2("email.released"),
48575
48572
  Literal2("email.sent"),
@@ -49730,7 +49727,7 @@ var Mailbox = Struct({
49730
49727
  id: MailboxId,
49731
49728
  namespaceId: Union2([NamespaceId, Null2]),
49732
49729
  slug: String4,
49733
- displayName: String4,
49730
+ name: String4,
49734
49731
  status: MailboxStatus,
49735
49732
  primaryAddress: Union2([String4, Null2]),
49736
49733
  createdAt: String4,
@@ -52674,13 +52671,9 @@ var MailboxesList500 = InternalError;
52674
52671
  var MailboxesList504 = GatewayTimeoutError;
52675
52672
  var MailboxesCreateRequestJson = Struct({
52676
52673
  namespaceId: optionalKey2(Union2([NamespaceId, Null2])),
52677
- displayName: String4,
52678
- slug: String4,
52679
- addresses: TupleWithRest(Tuple2([CreateMailboxAddressPayload]), [CreateMailboxAddressPayload]),
52680
- defaultFrom: optionalKey2(Union2([Struct({
52681
- address: String4,
52682
- displayName: optionalKey2(Union2([String4, Null2]))
52683
- }), Null2])),
52674
+ address: String4,
52675
+ name: String4,
52676
+ slug: optionalKey2(Union2([String4, Null2])),
52684
52677
  metadata: optionalKey2(Union2([MailboxMetadata, Null2]))
52685
52678
  });
52686
52679
  var MailboxesCreate201 = Mailbox;
@@ -52712,7 +52705,7 @@ var MailboxesRemove502 = BillingProviderError;
52712
52705
  var MailboxesRemove504 = GatewayTimeoutError;
52713
52706
  var MailboxesUpdatePathParams = Struct({ id: MailboxId });
52714
52707
  var MailboxesUpdateRequestJson = Struct({
52715
- displayName: optionalKey2(Union2([String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })), Null2])),
52708
+ name: optionalKey2(Union2([String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })), Null2])),
52716
52709
  metadata: optionalKey2(Union2([MailboxMetadataPatch, Null2])),
52717
52710
  defaultFrom: optionalKey2(Union2([Struct({
52718
52711
  address: String4,
@@ -52844,6 +52837,30 @@ var MailboxesRetryAction500 = InternalError;
52844
52837
  var MailboxesRetryAction502 = BillingProviderError;
52845
52838
  var MailboxesRetryAction503 = SenderNotReadyError;
52846
52839
  var MailboxesRetryAction504 = GatewayTimeoutError;
52840
+ var MailboxesCreateAddressPathParams = Struct({ id: MailboxId });
52841
+ var MailboxesCreateAddressRequestJson = Struct({
52842
+ address: String4,
52843
+ displayName: optionalKey2(Union2([String4, Null2]))
52844
+ });
52845
+ var MailboxesCreateAddress201 = Mailbox;
52846
+ var MailboxesCreateAddress401 = UnauthorizedError;
52847
+ var MailboxesCreateAddress403 = ForbiddenError;
52848
+ var MailboxesCreateAddress404 = ResourceNotFoundError;
52849
+ var MailboxesCreateAddress409 = ConflictError;
52850
+ var MailboxesCreateAddress422 = ValidationError;
52851
+ var MailboxesCreateAddress500 = InternalError;
52852
+ var MailboxesCreateAddress504 = GatewayTimeoutError;
52853
+ var MailboxesRemoveAddressPathParams = Struct({
52854
+ id: MailboxId,
52855
+ addressId: MailboxAddressId
52856
+ });
52857
+ var MailboxesRemoveAddress200 = Mailbox;
52858
+ var MailboxesRemoveAddress401 = UnauthorizedError;
52859
+ var MailboxesRemoveAddress403 = ForbiddenError;
52860
+ var MailboxesRemoveAddress404 = ResourceNotFoundError;
52861
+ var MailboxesRemoveAddress422 = ValidationError;
52862
+ var MailboxesRemoveAddress500 = InternalError;
52863
+ var MailboxesRemoveAddress504 = GatewayTimeoutError;
52847
52864
  var MailboxesGetAgentActivityPathParams = Struct({ id: MailboxId });
52848
52865
  var MailboxesGetAgentActivityQuery = Struct({
52849
52866
  after: optionalKey2(Union2([String4, Null2])),
@@ -53823,7 +53840,7 @@ var MessagesGetEmail200 = Struct({
53823
53840
  expiresAt: String4
53824
53841
  }), Null2]),
53825
53842
  createdAt: String4,
53826
- receivedAt: Union2([String4, Null2]),
53843
+ receivedAt: Union2([String4, Null2]).annotate({ description: "When Samva's receiving server accepted the email; null for outbound email. The sender's `Date` header plays no part and stays in the raw MIME." }),
53827
53844
  processedAt: Union2([String4, Null2])
53828
53845
  });
53829
53846
  var MessagesGetEmail401 = UnauthorizedError;
@@ -58090,7 +58107,7 @@ var MailboxesGroup = class extends make38("Mailboxes").add(get5("mailboxesList",
58090
58107
  MailboxesCreate502.pipe(status(502)),
58091
58108
  MailboxesCreate504.pipe(status(504))
58092
58109
  ]
58093
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "mailboxes.create").annotate(Summary, "Create a mailbox").annotate(Description, "Creates a mailbox with its addresses and returns it with status 201; the caller gets an admin grant on it. Each address must be under the organization's Samva-hosted mail domain or a verified domain with receiving enabled. The mailbox receives mail from now on; mail that arrived earlier is not added to it. Conflicts if an address or slug is already in use. Returns 402 when the organization is at its plan's mailbox allowance or at its mailbox storage allowance; incoming mail is still received past the storage allowance."), get5("mailboxesGet", "/v1/mailboxes/:id", {
58110
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "mailboxes.create").annotate(Summary, "Create a mailbox").annotate(Description, "Creates a mailbox with one address and returns it with status 201; the caller gets an admin grant on it. The address must be under the organization's Samva-hosted mail domain or a verified domain with receiving enabled, and the mailbox sends from it. The slug defaults to the address's local part. Pass `slug` when that is taken or not a valid slug. The mailbox receives mail from now on; mail that arrived earlier is not added to it. Conflicts if the address or slug is already in use. Returns 402 when the organization is at its plan's mailbox allowance or at its mailbox storage allowance; incoming mail is still received past the storage allowance."), get5("mailboxesGet", "/v1/mailboxes/:id", {
58094
58111
  params: MailboxesGetPathParams,
58095
58112
  success: MailboxesGet200,
58096
58113
  error: [
@@ -58209,7 +58226,31 @@ var MailboxesGroup = class extends make38("Mailboxes").add(get5("mailboxesList",
58209
58226
  MailboxesRetryAction503.pipe(status(503)),
58210
58227
  MailboxesRetryAction504.pipe(status(504))
58211
58228
  ]
58212
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "mailboxes.retryAction").annotate(Summary, "Resume a mailbox send").annotate(Description, "Resumes the same action only after its previous execution is confirmed ended and safe continuation is possible. Only an authorized person who proposed the send or can approve actions may retry. Automatic waits need no manual Retry. This does not grant new approval, reset the original deadline, replace the message identity, or resubmit an accepted or uncertain send."), get5("mailboxesGetAgentActivity", "/v1/mailboxes/:id/agent-activity", {
58229
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "mailboxes.retryAction").annotate(Summary, "Resume a mailbox send").annotate(Description, "Resumes the same action only after its previous execution is confirmed ended and safe continuation is possible. Only an authorized person who proposed the send or can approve actions may retry. Automatic waits need no manual Retry. This does not grant new approval, reset the original deadline, replace the message identity, or resubmit an accepted or uncertain send."), post("mailboxesCreateAddress", "/v1/mailboxes/:id/addresses", {
58230
+ params: MailboxesCreateAddressPathParams,
58231
+ payload: MailboxesCreateAddressRequestJson,
58232
+ success: MailboxesCreateAddress201.pipe(status(201)),
58233
+ error: [
58234
+ MailboxesCreateAddress401.pipe(status(401)),
58235
+ MailboxesCreateAddress403.pipe(status(403)),
58236
+ MailboxesCreateAddress404.pipe(status(404)),
58237
+ MailboxesCreateAddress409.pipe(status(409)),
58238
+ MailboxesCreateAddress422.pipe(status(422)),
58239
+ MailboxesCreateAddress500,
58240
+ MailboxesCreateAddress504.pipe(status(504))
58241
+ ]
58242
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "mailboxes.createAddress").annotate(Summary, "Add an address to a mailbox").annotate(Description, "Adds an address to a mailbox and returns the mailbox with status 201. The address follows the same rules as the address of a new mailbox: it must be under the organization's Samva-hosted mail domain or a verified domain with receiving enabled, and no mailbox may already hold it (409). Mail sent to it reaches the mailbox from now on; the mailbox keeps sending from its current default address until you change `defaultFrom`."), del("mailboxesRemoveAddress", "/v1/mailboxes/:id/addresses/:addressId", {
58243
+ params: MailboxesRemoveAddressPathParams,
58244
+ success: MailboxesRemoveAddress200,
58245
+ error: [
58246
+ MailboxesRemoveAddress401.pipe(status(401)),
58247
+ MailboxesRemoveAddress403.pipe(status(403)),
58248
+ MailboxesRemoveAddress404.pipe(status(404)),
58249
+ MailboxesRemoveAddress422.pipe(status(422)),
58250
+ MailboxesRemoveAddress500,
58251
+ MailboxesRemoveAddress504.pipe(status(504))
58252
+ ]
58253
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "mailboxes.removeAddress").annotate(Summary, "Remove an address from a mailbox").annotate(Description, "Removes an address from a mailbox and returns the mailbox. Mail sent to the address stops reaching the mailbox; its existing threads and messages stay. A mailbox keeps at least one address, so removing the last one is refused (422). When the removed address was the default `From`, the mailbox sends from its oldest remaining address, without a sender name of its own."), get5("mailboxesGetAgentActivity", "/v1/mailboxes/:id/agent-activity", {
58213
58254
  params: MailboxesGetAgentActivityPathParams,
58214
58255
  query: MailboxesGetAgentActivityQuery,
58215
58256
  success: MailboxesGetAgentActivity200,
@@ -58309,7 +58350,7 @@ var MailboxesGroup = class extends make38("Mailboxes").add(get5("mailboxesList",
58309
58350
  MailboxesListEvents500,
58310
58351
  MailboxesListEvents504.pipe(status(504))
58311
58352
  ]
58312
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "mailboxes.listEvents").annotate(Summary, "List mailbox events").annotate(Description, "Returns mailbox audit records, newest first, filterable by when they happened (`after`, `before`). Audit event types: `mailbox.created`, `address.attached`, `email.received`, `email.released`, `email.sent`, `thread.created`, `action.proposed`, `action.policy_decided`, `action.approval_requested`, `action.approval_resolved`, `action.accepted`, `action.executed`, `action.failed`. Thread and draft changes have no dedicated audit event types. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page."), get5("mailboxesListFolders", "/v1/mailboxes/:id/folders", {
58353
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "mailboxes.listEvents").annotate(Summary, "List mailbox events").annotate(Description, "Returns mailbox audit records, newest first, filterable by when they happened (`after`, `before`). Audit event types: `mailbox.created`, `address.attached`, `address.detached`, `email.received`, `email.released`, `email.sent`, `thread.created`, `action.proposed`, `action.policy_decided`, `action.approval_requested`, `action.approval_resolved`, `action.accepted`, `action.executed`, `action.failed`. Thread and draft changes have no dedicated audit event types. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page."), get5("mailboxesListFolders", "/v1/mailboxes/:id/folders", {
58313
58354
  params: MailboxesListFoldersPathParams,
58314
58355
  success: MailboxesListFolders200,
58315
58356
  error: [
@@ -60070,7 +60111,7 @@ var generateIdempotencyKey = gen2(function* () {
60070
60111
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
60071
60112
  });
60072
60113
 
60073
- // ../sdk/dist/operation-g8nAzmIM.js
60114
+ // ../sdk/dist/operation-BZ5Xov-x.js
60074
60115
  var SDK_OPERATION_CALLS = {
60075
60116
  brandsList: { kind: "none" },
60076
60117
  brandsCreate: { kind: "payload" },
@@ -60772,6 +60813,14 @@ var SDK_OPERATION_CALLS = {
60772
60813
  kind: "path",
60773
60814
  paths: ["id"]
60774
60815
  },
60816
+ mailboxesCreateAddress: {
60817
+ kind: "pathPayload",
60818
+ paths: ["id"]
60819
+ },
60820
+ mailboxesRemoveAddress: {
60821
+ kind: "path",
60822
+ paths: ["id", "addressId"]
60823
+ },
60775
60824
  mailboxesPause: {
60776
60825
  kind: "path",
60777
60826
  paths: ["id"]
@@ -62583,6 +62632,7 @@ class UnknownStatusError extends TaggedError3()("UnknownStatusError", {
62583
62632
  var mailboxEventTypes = [
62584
62633
  "mailbox.created",
62585
62634
  "address.attached",
62635
+ "address.detached",
62586
62636
  "email.received",
62587
62637
  "email.released",
62588
62638
  "email.sent",
@@ -62737,7 +62787,7 @@ var summaryFields = {
62737
62787
  id: MailboxId2,
62738
62788
  namespaceId: NullOr(NamespaceId2),
62739
62789
  slug: String4,
62740
- displayName: String4,
62790
+ name: String4,
62741
62791
  status: MailboxStatus2,
62742
62792
  primaryAddress: NullOr(String4),
62743
62793
  createdAt: DateFromString
@@ -62760,24 +62810,19 @@ var MailboxAccessEntry = Struct({
62760
62810
  description: "Whether the caller holds `quarantine.read` here, and so receives `mailbox.message.quarantined` and `mailbox.message.discarded` for it."
62761
62811
  })
62762
62812
  });
62763
- var CreateMailboxAddressPayload2 = Struct({
62764
- address: String4,
62765
- displayName: optional2(String4),
62766
- domainId: optional2(String4)
62767
- }).annotate({ identifier: "CreateMailboxAddressPayload" });
62768
62813
  var CreateMailboxPayload = Struct({
62769
62814
  namespaceId: optional2(NamespaceId2),
62770
- displayName: String4,
62771
- slug: String4,
62772
- addresses: NonEmptyArray(CreateMailboxAddressPayload2),
62773
- defaultFrom: optional2(Struct({
62774
- address: String4,
62775
- displayName: optional2(String4)
62776
- })),
62815
+ address: String4,
62816
+ name: String4,
62817
+ slug: optional2(String4),
62777
62818
  metadata: optional2(MailboxMetadata2)
62778
62819
  }).annotate({ identifier: "CreateMailboxPayload" });
62820
+ var CreateMailboxAddressPayload = Struct({
62821
+ address: String4,
62822
+ displayName: optional2(String4)
62823
+ }).annotate({ identifier: "CreateMailboxAddressPayload" });
62779
62824
  var UpdateMailboxPayload = Struct({
62780
- displayName: optional2(String4.check(isMinLength(1))),
62825
+ name: optional2(String4.check(isMinLength(1))),
62781
62826
  metadata: optional2(MailboxMetadataPatch2),
62782
62827
  defaultFrom: optional2(Struct({
62783
62828
  address: String4,
@@ -63730,7 +63775,7 @@ var readRefusalBody = async (response) => {
63730
63775
  }
63731
63776
  };
63732
63777
 
63733
- // ../sdk/dist/mailboxes-DT02zP7q.js
63778
+ // ../sdk/dist/mailboxes-BH_JPmOE.js
63734
63779
  var toStreamError = (cause) => cause instanceof MailboxEventStreamError ? cause : new MailboxEventStreamError({
63735
63780
  _tag: "StreamDisconnectedError",
63736
63781
  message: String(cause)
@@ -63755,6 +63800,8 @@ var create8 = make40("mailboxesCreate");
63755
63800
  var get13 = make40("mailboxesGet");
63756
63801
  var update9 = make40("mailboxesUpdate");
63757
63802
  var remove9 = make40("mailboxesRemove");
63803
+ var createAddress = make40("mailboxesCreateAddress");
63804
+ var removeAddress = make40("mailboxesRemoveAddress");
63758
63805
  var pause = make40("mailboxesPause");
63759
63806
  var resume = make40("mailboxesResume");
63760
63807
  var getAgentActivity = make40("mailboxesGetAgentActivity");
@@ -64233,12 +64280,13 @@ var commandTree = {
64233
64280
  update: {},
64234
64281
  pause: {},
64235
64282
  resume: {},
64283
+ addresses: { add: {}, remove: {} },
64236
64284
  remove: {},
64237
64285
  threads: {},
64238
64286
  read: {},
64239
64287
  send: {},
64240
64288
  reply: {},
64241
- actions: { list: {}, approve: {}, deny: {} },
64289
+ actions: { list: {}, get: {}, approve: {}, deny: {}, cancel: {}, retry: {} },
64242
64290
  quarantine: { list: {}, release: {}, discard: {} }
64243
64291
  },
64244
64292
  extensions: {
@@ -68350,6 +68398,7 @@ __export(exports_mailboxes, {
68350
68398
  cancelAction: () => cancelAction,
68351
68399
  copyMessageAttachment: () => copyMessageAttachment,
68352
68400
  create: () => create8,
68401
+ createAddress: () => createAddress,
68353
68402
  createDraft: () => createDraft,
68354
68403
  createGrant: () => createGrant,
68355
68404
  createLabel: () => createLabel,
@@ -68388,6 +68437,7 @@ __export(exports_mailboxes, {
68388
68437
  pause: () => pause,
68389
68438
  releaseMessage: () => releaseMessage,
68390
68439
  remove: () => remove9,
68440
+ removeAddress: () => removeAddress,
68391
68441
  removeThreadLabels: () => removeThreadLabels,
68392
68442
  reply: () => reply,
68393
68443
  replyAll: () => replyAll,
@@ -71643,7 +71693,7 @@ var present = (value) => value === null ? "none" : value === "" ? '""' : value;
71643
71693
  var actor = (value) => `${value.displayName == null ? "" : `${value.displayName} \u2014 `}${value.kind} ${value.id}`;
71644
71694
  var identity2 = (address, name, attributed) => `${name === undefined || name === null ? "" : `${name} <`}${address}${name === undefined || name === null ? "" : ">"}${attributed === undefined ? "" : attributed === null ? "; actor: none" : `; actor: ${actor(attributed)}`}`;
71645
71695
  var printMailboxSummary = (data) => gen2(function* () {
71646
- yield* log(`${data.displayName} (${data.slug}) \u2014 ${data.status}`);
71696
+ yield* log(`${data.name} (${data.slug}) \u2014 ${data.status}`);
71647
71697
  yield* printFields([
71648
71698
  ["ID", data.id],
71649
71699
  ["Primary address", present(data.primaryAddress)],
@@ -71875,30 +71925,21 @@ var list26 = make29("list", {
71875
71925
  });
71876
71926
  })));
71877
71927
  var create17 = make29("create", {
71878
- slug: String9("slug"),
71928
+ address: String9("address").pipe(withDescription2("The mailbox's address, such as support@acme.samva.email")),
71879
71929
  name: String9("name"),
71880
- address: String9("address").pipe(atLeast2(1)),
71930
+ slug: String9("slug").pipe(withDescription2("Defaults to the address's local part"), optional4),
71881
71931
  namespace: String9("namespace").pipe(withSchema2(NamespaceId2), optional4),
71882
71932
  json: jsonFlag
71883
- }).pipe(withDescription3("Provision a mailbox and its addresses"), withExamples([
71933
+ }).pipe(withDescription3("Create a mailbox with one address"), withExamples([
71884
71934
  {
71885
- command: "samva mailboxes create --slug support --name Support --address support@example.com"
71935
+ command: "samva mailboxes create --address support@acme.samva.email --name Support"
71886
71936
  }
71887
- ]), withHandler(({ slug, name, address, namespace, json }) => gen2(function* () {
71937
+ ]), withHandler(({ address, name, slug, namespace, json }) => gen2(function* () {
71888
71938
  const client = yield* getClientProvider;
71889
- const [first, ...rest] = address;
71890
- if (first === undefined)
71891
- return yield* new CliUsageError({
71892
- code: "mailbox_address_required",
71893
- message: "Provide --address."
71894
- });
71895
71939
  const data = yield* create8({
71896
- slug,
71897
- displayName: name,
71898
- addresses: [
71899
- { address: first },
71900
- ...rest.map((remainingAddress) => ({ address: remainingAddress }))
71901
- ],
71940
+ address,
71941
+ name,
71942
+ slug: getOrUndefined(slug),
71902
71943
  namespaceId: getOrUndefined(namespace)
71903
71944
  }).pipe(client.provide, mapError2((e) => mailboxApiError("Could not create mailbox", e)));
71904
71945
  if (json)
@@ -71913,12 +71954,12 @@ var get24 = make29("get", { id: mailboxIdArgument, json: jsonFlag }).pipe(withDe
71913
71954
  })));
71914
71955
  var update16 = make29("update", {
71915
71956
  id: mailboxIdArgument,
71916
- data: String9("data").pipe(withDescription2("JSON patch or @file: displayName, defaultFrom, metadata (null deletes a metadata key)")),
71957
+ data: String9("data").pipe(withDescription2("JSON patch or @file: name, defaultFrom, metadata (null deletes a metadata key)")),
71917
71958
  dryRun: Boolean6("dry-run").pipe(withDefault5(false)),
71918
71959
  json: jsonFlag
71919
71960
  }).pipe(withDescription3("Update mailbox settings from JSON"), withExamples([
71920
71961
  {
71921
- command: `samva mailboxes update mbx_1234567890123456 --data '{"displayName":"Support","defaultFrom":{"address":"support@example.com"}}'`
71962
+ command: `samva mailboxes update mbx_1234567890123456 --data '{"name":"Support","defaultFrom":{"address":"support@example.com"}}'`
71922
71963
  }
71923
71964
  ]), withHandler(({ id, data, dryRun, json }) => gen2(function* () {
71924
71965
  let source = data;
@@ -71951,7 +71992,7 @@ var update16 = make29("update", {
71951
71992
  if (!Object.keys(payload).length)
71952
71993
  return yield* new CliUsageError({
71953
71994
  code: "mailbox_update_empty",
71954
- message: "--data must name at least one of displayName, defaultFrom, or metadata."
71995
+ message: "--data must name at least one of name, defaultFrom, or metadata."
71955
71996
  });
71956
71997
  if (dryRun)
71957
71998
  return yield* json ? printJson({ dryRun: true, action: "mailboxes.update", id, request: payload }) : printFields([
@@ -71963,6 +72004,57 @@ var update16 = make29("update", {
71963
72004
  const result = yield* update9({ id, ...payload }).pipe(client.provide, mapError2((e) => mailboxApiError("Could not update mailbox", e)));
71964
72005
  yield* json ? printJson(result) : printMailbox(result);
71965
72006
  })));
72007
+ var addressAdd = make29("add", {
72008
+ mailbox: mailboxFlag,
72009
+ address: String9("address").pipe(withDescription2("The address to add, such as billing@acme.samva.email")),
72010
+ displayName: String9("display-name").pipe(withDescription2("The sender name used when this is the mailbox's default From address"), optional4),
72011
+ dryRun: Boolean6("dry-run").pipe(withDefault5(false)),
72012
+ json: jsonFlag
72013
+ }).pipe(withDescription3("Add an address to a mailbox"), withExamples([
72014
+ {
72015
+ command: "samva mailboxes addresses add --mailbox mbx_1234567890123456 --address billing@acme.samva.email"
72016
+ }
72017
+ ]), withHandler(({ mailbox, address, displayName, dryRun, json }) => gen2(function* () {
72018
+ const payload = { address, displayName: getOrUndefined(displayName) };
72019
+ if (dryRun)
72020
+ return yield* json ? printJson({
72021
+ dryRun: true,
72022
+ action: "mailboxes.createAddress",
72023
+ id: mailbox,
72024
+ request: payload
72025
+ }) : log(`[dry-run] Would add ${address} to mailbox ${mailbox}.`);
72026
+ const client = yield* getClientProvider;
72027
+ const result = yield* createAddress({ id: mailbox, ...payload }).pipe(client.provide, mapError2((e) => mailboxApiError("Could not add the address", e)));
72028
+ yield* json ? printJson(result) : printMailbox(result);
72029
+ })));
72030
+ var addressRemove = make29("remove", {
72031
+ addressId: String10("address-id").pipe(withSchema3(MailboxAddressId2)),
72032
+ mailbox: mailboxFlag,
72033
+ dryRun: Boolean6("dry-run").pipe(withDefault5(false)),
72034
+ yes: Boolean6("yes").pipe(withDefault5(false)),
72035
+ json: jsonFlag
72036
+ }).pipe(withDescription3("Remove an address from a mailbox; mail sent to it stops reaching the mailbox"), withExamples([
72037
+ {
72038
+ command: "samva mailboxes addresses remove mbxaddr_1234567890123456 --mailbox mbx_1234567890123456 --yes"
72039
+ }
72040
+ ]), withHandler(({ addressId, mailbox, dryRun, yes, json }) => gen2(function* () {
72041
+ if (dryRun)
72042
+ return yield* json ? printJson({
72043
+ dryRun: true,
72044
+ action: "mailboxes.removeAddress",
72045
+ id: mailbox,
72046
+ addressId
72047
+ }) : log(`[dry-run] Would remove address ${addressId} from mailbox ${mailbox}.`);
72048
+ yield* confirmDestructive({
72049
+ yes,
72050
+ json,
72051
+ message: `Remove address ${addressId} from mailbox ${mailbox}? Mail sent to it will stop reaching the mailbox.`,
72052
+ nonInteractiveMessage: "Removing an address requires --yes in non-interactive mode. Preview with --dry-run."
72053
+ });
72054
+ const client = yield* getClientProvider;
72055
+ const result = yield* removeAddress({ id: mailbox, addressId }).pipe(client.provide, mapError2((e) => mailboxApiError("Could not remove the address", e)));
72056
+ yield* json ? printJson(result) : printMailbox(result);
72057
+ }).pipe(json ? provideService2(MinimumLogLevel2, "None") : identity)));
71966
72058
  var lifecycle = (verb) => make29(verb, {
71967
72059
  id: mailboxIdArgument,
71968
72060
  dryRun: Boolean6("dry-run").pipe(withDefault5(false)),
@@ -72291,6 +72383,7 @@ var mailboxesCommand = make29("mailboxes").pipe(withDescription3("Mailbox readin
72291
72383
  update16,
72292
72384
  lifecycle("pause"),
72293
72385
  lifecycle("resume"),
72386
+ make29("addresses").pipe(withSubcommands([addressAdd, addressRemove])),
72294
72387
  make29("actions").pipe(withSubcommands([
72295
72388
  actionsList,
72296
72389
  actionDecision("approve"),
@@ -76067,9 +76160,18 @@ var create20 = make29("create", {
76067
76160
  return yield* json ? printJson({ dryRun: true, action: "webhooks.create", request: payload }) : printJson(payload);
76068
76161
  const client = yield* getClientProvider;
76069
76162
  const result = yield* create15(payload).pipe(client.provide, mapError2((error) => toCliApiError("Could not create webhook", error)));
76163
+ const warning = "This signing secret is shown once. Store it now; `samva webhooks rotate-secret` issues a new one.";
76164
+ const secret = value2(result.secret);
76070
76165
  if (json)
76071
- return yield* printJson(result);
76072
- yield* printJson(result);
76166
+ return yield* printJson({ endpoint: result.endpoint, secret, displayOnce: true, warning });
76167
+ yield* error(`WARNING: ${warning}`);
76168
+ yield* printFields([
76169
+ ["ID", result.endpoint.id],
76170
+ ["Name", result.endpoint.name],
76171
+ ["Status", result.endpoint.status],
76172
+ ["URL", result.endpoint.url],
76173
+ ["Signing secret", secret]
76174
+ ]);
76073
76175
  }).pipe(json ? provideService2(MinimumLogLevel2, "None") : identity)));
76074
76176
  var update17 = make29("update", {
76075
76177
  id: idArgument,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samva/cli",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Samva CLI — email and platform operations from your terminal",
5
5
  "keywords": [
6
6
  "cli",
@@ -49,22 +49,22 @@
49
49
  "@effect/platform-bun": "4.0.0",
50
50
  "@effect/vitest": "4.0.0",
51
51
  "@samva/core": "0.0.0",
52
- "@samva/mailbox": "0.2.0",
52
+ "@samva/mailbox": "0.2.1",
53
53
  "@samva/markup": "^0.12.0",
54
54
  "@samva/vite": "^0.12.0",
55
55
  "@types/node": "^26.6.2",
56
56
  "better-auth": "1.7.5",
57
57
  "effect": "4.0.0",
58
- "samva": "0.14.0",
58
+ "samva": "0.15.0",
59
59
  "typescript": "^7.0.2",
60
60
  "vite": "~8.3.0",
61
61
  "vitest": "^5.0.3"
62
62
  },
63
63
  "optionalDependencies": {
64
- "@samva/cli-darwin-arm64": "0.11.0",
65
- "@samva/cli-darwin-x64": "0.11.0",
66
- "@samva/cli-linux-arm64": "0.11.0",
67
- "@samva/cli-linux-x64": "0.11.0"
64
+ "@samva/cli-darwin-arm64": "0.12.0",
65
+ "@samva/cli-darwin-x64": "0.12.0",
66
+ "@samva/cli-linux-arm64": "0.12.0",
67
+ "@samva/cli-linux-x64": "0.12.0"
68
68
  },
69
69
  "engines": {
70
70
  "node": ">=18"