@sendmux/cli 1.0.1 → 1.1.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
@@ -9,17 +9,18 @@ Agent-drivable command line interface for Sendmux.
9
9
 
10
10
  ## Documentation
11
11
 
12
- - Sendmux docs: [docs.sendmux.ai](https://docs.sendmux.ai)
13
- - Management API reference: [docs.sendmux.ai/api/introduction](https://docs.sendmux.ai/api/introduction)
14
- - Mailbox API reference: [docs.sendmux.ai/mailbox-api/introduction](https://docs.sendmux.ai/mailbox-api/introduction)
15
- - Sending API reference: [docs.sendmux.ai/sending-api/introduction](https://docs.sendmux.ai/sending-api/introduction)
12
+ - Sendmux docs: [sendmux.ai/docs](https://sendmux.ai/docs)
13
+ - Management API reference: [sendmux.ai/docs/api/introduction](https://sendmux.ai/docs/api/introduction)
14
+ - Mailbox API reference: [sendmux.ai/docs/mailbox-api/introduction](https://sendmux.ai/docs/mailbox-api/introduction)
15
+ - Sending API reference: [sendmux.ai/docs/sending-api/introduction](https://sendmux.ai/docs/sending-api/introduction)
16
16
  - Source repository: [Sendmux/sendmux-sdk](https://github.com/Sendmux/sendmux-sdk)
17
17
 
18
18
  ## Requirements
19
19
 
20
20
  - npm global installs, `npx`, or a downloaded release tarball.
21
21
  - A root `smx_root_*` key for Management commands.
22
- - A mailbox-scoped `smx_mbx_*` key for Mailbox and Sending commands.
22
+ - A send-capable `smx_mbx_*` key or owner-approved Sending-resource `smx_agent_*` token for Sending commands.
23
+ - A mailbox-scoped `smx_mbx_*` key or scoped `smx_agent_*` token for Mailbox commands. Agent tokens remain limited by server-side scopes; pre-claim self-registered agent tokens do not include `email.send`.
23
24
 
24
25
  ## Installation
25
26
 
@@ -1,5 +1,5 @@
1
1
  import { Command } from "@oclif/core";
2
- import { type ApiKeyKind } from "./key-kind.js";
2
+ import { type ApiKeyKind, type RequiredApiKeyKind } from "./key-kind.js";
3
3
  export interface AuthFlags {
4
4
  "api-key"?: string;
5
5
  "base-url"?: string;
@@ -18,7 +18,7 @@ export declare const authFlags: {
18
18
  };
19
19
  export declare abstract class SendmuxCommand extends Command {
20
20
  static enableJsonFlag: boolean;
21
- resolveAuth(flags: AuthFlags, expectedKind: ApiKeyKind): Promise<ResolvedAuth>;
21
+ resolveAuth(flags: AuthFlags, expectedKind: RequiredApiKeyKind): Promise<ResolvedAuth>;
22
22
  renderResult(value: unknown): unknown;
23
23
  renderTextResult(value: string): unknown;
24
24
  renderBinaryResult(value: ArrayBuffer | ArrayBufferView | string): unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../src/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAE7C,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,SAAS;;;;CAcrB,CAAC;AAEF,8BAAsB,cAAe,SAAQ,OAAO;IAClD,MAAM,CAAC,cAAc,UAAQ;IAEvB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAmDpF,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IASrC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IASxC,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,eAAe,GAAG,MAAM,GAAG,OAAO;IAa1E,OAAO,CAAC,aAAa;CA4BtB"}
1
+ {"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../src/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAE7C,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,SAAS;;;;CAcrB,CAAC;AAEF,8BAAsB,cAAe,SAAQ,OAAO;IAClD,MAAM,CAAC,cAAc,UAAQ;IAEvB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAmD5F,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IASrC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IASxC,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,eAAe,GAAG,MAAM,GAAG,OAAO;IAa1E,OAAO,CAAC,aAAa;CA4BtB"}
@@ -1,5 +1,5 @@
1
1
  import { Command, Flags } from "@oclif/core";
2
- import { inferApiKeyKind, } from "./key-kind.js";
2
+ import { apiKeyKindLabel, inferApiKeyKind, isApiKeyCompatibleWithKind, } from "./key-kind.js";
3
3
  import { readCliConfig } from "./profiles.js";
4
4
  export const authFlags = {
5
5
  "api-key": Flags.string({
@@ -94,9 +94,9 @@ export class SendmuxCommand extends Command {
94
94
  catch (error) {
95
95
  this.error(error instanceof Error ? error.message : "Invalid Sendmux API key", { exit: 2 });
96
96
  }
97
- if (apiKeyKind !== expectedKind) {
98
- const expectedLabel = expectedKind === "root" ? "root" : "mailbox";
99
- const actualLabel = apiKeyKind === "root" ? "root" : "mailbox";
97
+ if (!isApiKeyCompatibleWithKind(apiKey, expectedKind)) {
98
+ const expectedLabel = apiKeyKindLabel(expectedKind);
99
+ const actualLabel = apiKeyKindLabel(apiKeyKind);
100
100
  this.error(`Command requires a ${expectedLabel} API key, but ${source} contains a ${actualLabel} API key.`, {
101
101
  exit: 2,
102
102
  });
@@ -0,0 +1,26 @@
1
+ import { OperationCommand } from "../../operation-command.js";
2
+ export default class ManagementCheckMailboxAvailabilityCommand extends OperationCommand {
3
+ static description: "Check mailbox address availability";
4
+ static operation: {
5
+ readonly bodyKind: "none";
6
+ readonly command: "management:check-mailbox-availability";
7
+ readonly description: "Check mailbox address availability";
8
+ readonly headerParams: readonly [];
9
+ readonly method: "get";
10
+ readonly operationId: "managementCheckMailboxAvailability";
11
+ readonly path: "/mailboxes/availability";
12
+ readonly pathParams: readonly [];
13
+ readonly queryParams: readonly [{
14
+ readonly name: "email";
15
+ readonly required: true;
16
+ readonly schema: {
17
+ readonly type: "string";
18
+ };
19
+ }];
20
+ readonly responseKind: "json";
21
+ readonly requestBodyRequired: false;
22
+ readonly requiredKeyKind: "root";
23
+ readonly surface: "management";
24
+ };
25
+ }
26
+ //# sourceMappingURL=check-mailbox-availability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-mailbox-availability.d.ts","sourceRoot":"","sources":["../../../src/commands/management/check-mailbox-availability.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,CAAC,OAAO,OAAO,yCAA0C,SAAQ,gBAAgB;IACrF,MAAM,CAAC,WAAW,uCAA6D;IAC/E,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;MAAiD;CAClE"}
@@ -0,0 +1,7 @@
1
+ // This file is generated by scripts/generate-cli.mjs
2
+ import { operations } from "../../generated/operations.js";
3
+ import { OperationCommand } from "../../operation-command.js";
4
+ export default class ManagementCheckMailboxAvailabilityCommand extends OperationCommand {
5
+ static description = operations.managementCheckMailboxAvailability.description;
6
+ static operation = operations.managementCheckMailboxAvailability;
7
+ }
@@ -19,7 +19,7 @@ export default class SendingGetOpenApiSpecCommand extends OperationCommand {
19
19
  readonly queryParams: readonly [];
20
20
  readonly responseKind: "json";
21
21
  readonly requestBodyRequired: false;
22
- readonly requiredKeyKind: "mailbox";
22
+ readonly requiredKeyKind: "sending";
23
23
  readonly surface: "sending";
24
24
  };
25
25
  }
@@ -20,7 +20,7 @@ export default class SendingSendEmailBatchCommand extends OperationCommand {
20
20
  readonly queryParams: readonly [];
21
21
  readonly responseKind: "json";
22
22
  readonly requestBodyRequired: true;
23
- readonly requiredKeyKind: "mailbox";
23
+ readonly requiredKeyKind: "sending";
24
24
  readonly surface: "sending";
25
25
  };
26
26
  }
@@ -20,7 +20,7 @@ export default class SendingSendEmailCommand extends OperationCommand {
20
20
  readonly queryParams: readonly [];
21
21
  readonly responseKind: "json";
22
22
  readonly requestBodyRequired: true;
23
- readonly requiredKeyKind: "mailbox";
23
+ readonly requiredKeyKind: "sending";
24
24
  readonly surface: "sending";
25
25
  };
26
26
  }
@@ -2148,6 +2148,27 @@ export declare const operations: {
2148
2148
  readonly requiredKeyKind: "root";
2149
2149
  readonly surface: "management";
2150
2150
  };
2151
+ readonly managementCheckMailboxAvailability: {
2152
+ readonly bodyKind: "none";
2153
+ readonly command: "management:check-mailbox-availability";
2154
+ readonly description: "Check mailbox address availability";
2155
+ readonly headerParams: readonly [];
2156
+ readonly method: "get";
2157
+ readonly operationId: "managementCheckMailboxAvailability";
2158
+ readonly path: "/mailboxes/availability";
2159
+ readonly pathParams: readonly [];
2160
+ readonly queryParams: readonly [{
2161
+ readonly name: "email";
2162
+ readonly required: true;
2163
+ readonly schema: {
2164
+ readonly type: "string";
2165
+ };
2166
+ }];
2167
+ readonly responseKind: "json";
2168
+ readonly requestBodyRequired: false;
2169
+ readonly requiredKeyKind: "root";
2170
+ readonly surface: "management";
2171
+ };
2151
2172
  readonly managementCreateDomain: {
2152
2173
  readonly bodyKind: "json";
2153
2174
  readonly command: "management:create-domain";
@@ -3532,7 +3553,7 @@ export declare const operations: {
3532
3553
  readonly queryParams: readonly [];
3533
3554
  readonly responseKind: "json";
3534
3555
  readonly requestBodyRequired: false;
3535
- readonly requiredKeyKind: "mailbox";
3556
+ readonly requiredKeyKind: "sending";
3536
3557
  readonly surface: "sending";
3537
3558
  };
3538
3559
  readonly sendingSendEmail: {
@@ -3554,7 +3575,7 @@ export declare const operations: {
3554
3575
  readonly queryParams: readonly [];
3555
3576
  readonly responseKind: "json";
3556
3577
  readonly requestBodyRequired: true;
3557
- readonly requiredKeyKind: "mailbox";
3578
+ readonly requiredKeyKind: "sending";
3558
3579
  readonly surface: "sending";
3559
3580
  };
3560
3581
  readonly sendingSendEmailBatch: {
@@ -3576,7 +3597,7 @@ export declare const operations: {
3576
3597
  readonly queryParams: readonly [];
3577
3598
  readonly responseKind: "json";
3578
3599
  readonly requestBodyRequired: true;
3579
- readonly requiredKeyKind: "mailbox";
3600
+ readonly requiredKeyKind: "sending";
3580
3601
  readonly surface: "sending";
3581
3602
  };
3582
3603
  };
@@ -3995,7 +4016,7 @@ export declare const curatedOperations: {
3995
4016
  readonly queryParams: readonly [];
3996
4017
  readonly responseKind: "json";
3997
4018
  readonly requestBodyRequired: true;
3998
- readonly requiredKeyKind: "mailbox";
4019
+ readonly requiredKeyKind: "sending";
3999
4020
  readonly surface: "sending";
4000
4021
  };
4001
4022
  readonly sendingSendEmailBatch: {
@@ -4017,7 +4038,7 @@ export declare const curatedOperations: {
4017
4038
  readonly queryParams: readonly [];
4018
4039
  readonly responseKind: "json";
4019
4040
  readonly requestBodyRequired: true;
4020
- readonly requiredKeyKind: "mailbox";
4041
+ readonly requiredKeyKind: "sending";
4021
4042
  readonly surface: "sending";
4022
4043
  };
4023
4044
  };
@@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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWpB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,UAAU,CAAC"}
@@ -2542,6 +2542,29 @@ export const operations = {
2542
2542
  "requiredKeyKind": "root",
2543
2543
  "surface": "management"
2544
2544
  },
2545
+ managementCheckMailboxAvailability: {
2546
+ "bodyKind": "none",
2547
+ "command": "management:check-mailbox-availability",
2548
+ "description": "Check mailbox address availability",
2549
+ "headerParams": [],
2550
+ "method": "get",
2551
+ "operationId": "managementCheckMailboxAvailability",
2552
+ "path": "/mailboxes/availability",
2553
+ "pathParams": [],
2554
+ "queryParams": [
2555
+ {
2556
+ "name": "email",
2557
+ "required": true,
2558
+ "schema": {
2559
+ "type": "string"
2560
+ }
2561
+ }
2562
+ ],
2563
+ "responseKind": "json",
2564
+ "requestBodyRequired": false,
2565
+ "requiredKeyKind": "root",
2566
+ "surface": "management"
2567
+ },
2545
2568
  managementCreateDomain: {
2546
2569
  "bodyKind": "json",
2547
2570
  "command": "management:create-domain",
@@ -4141,7 +4164,7 @@ export const operations = {
4141
4164
  "queryParams": [],
4142
4165
  "responseKind": "json",
4143
4166
  "requestBodyRequired": false,
4144
- "requiredKeyKind": "mailbox",
4167
+ "requiredKeyKind": "sending",
4145
4168
  "surface": "sending"
4146
4169
  },
4147
4170
  sendingSendEmail: {
@@ -4165,7 +4188,7 @@ export const operations = {
4165
4188
  "queryParams": [],
4166
4189
  "responseKind": "json",
4167
4190
  "requestBodyRequired": true,
4168
- "requiredKeyKind": "mailbox",
4191
+ "requiredKeyKind": "sending",
4169
4192
  "surface": "sending"
4170
4193
  },
4171
4194
  sendingSendEmailBatch: {
@@ -4189,7 +4212,7 @@ export const operations = {
4189
4212
  "queryParams": [],
4190
4213
  "responseKind": "json",
4191
4214
  "requestBodyRequired": true,
4192
- "requiredKeyKind": "mailbox",
4215
+ "requiredKeyKind": "sending",
4193
4216
  "surface": "sending"
4194
4217
  },
4195
4218
  };
@@ -1,4 +1,7 @@
1
1
  export type ApiKeyKind = "mailbox" | "root";
2
+ export type RequiredApiKeyKind = ApiKeyKind | "sending";
2
3
  export declare function inferApiKeyKind(apiKey: string): ApiKeyKind;
4
+ export declare function isApiKeyCompatibleWithKind(apiKey: string, expectedKind: RequiredApiKeyKind): boolean;
5
+ export declare function apiKeyKindLabel(kind: RequiredApiKeyKind): string;
3
6
  export declare function maskApiKey(apiKey: string): string;
4
7
  //# sourceMappingURL=key-kind.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"key-kind.d.ts","sourceRoot":"","sources":["../src/key-kind.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAE5C,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAU1D;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjD"}
1
+ {"version":3,"file":"key-kind.d.ts","sourceRoot":"","sources":["../src/key-kind.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAC5C,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,CAAC;AAExD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAc1D;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,kBAAkB,GAAG,OAAO,CAMpG;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAEhE;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjD"}
package/dist/key-kind.js CHANGED
@@ -5,7 +5,19 @@ export function inferApiKeyKind(apiKey) {
5
5
  if (apiKey.startsWith("smx_mbx_")) {
6
6
  return "mailbox";
7
7
  }
8
- throw new Error("Sendmux API keys must start with smx_root_ or smx_mbx_");
8
+ if (apiKey.startsWith("smx_agent_")) {
9
+ return "mailbox";
10
+ }
11
+ throw new Error("Sendmux API keys must start with smx_root_, smx_mbx_, or smx_agent_");
12
+ }
13
+ export function isApiKeyCompatibleWithKind(apiKey, expectedKind) {
14
+ if (expectedKind === "sending") {
15
+ return apiKey.startsWith("smx_mbx_") || apiKey.startsWith("smx_agent_");
16
+ }
17
+ return inferApiKeyKind(apiKey) === expectedKind;
18
+ }
19
+ export function apiKeyKindLabel(kind) {
20
+ return kind === "sending" ? "sending" : kind;
9
21
  }
10
22
  export function maskApiKey(apiKey) {
11
23
  if (apiKey.length <= 16) {
@@ -1,4 +1,4 @@
1
- import type { ApiKeyKind } from "./key-kind.js";
1
+ import type { RequiredApiKeyKind } from "./key-kind.js";
2
2
  export interface OperationParameter {
3
3
  name: string;
4
4
  required: boolean;
@@ -32,7 +32,7 @@ export interface OperationDefinition {
32
32
  queryParams: readonly OperationParameter[];
33
33
  responseKind: "binary" | "json" | "text";
34
34
  requestBodyRequired: boolean;
35
- requiredKeyKind: ApiKeyKind;
35
+ requiredKeyKind: RequiredApiKeyKind;
36
36
  surface: "mailbox" | "management" | "sending";
37
37
  }
38
38
  //# sourceMappingURL=operation-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation-types.d.ts","sourceRoot":"","sources":["../src/operation-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,wBAAwB,CAAC;CAClC;AAED,MAAM,MAAM,wBAAwB,GAAG,6BAA6B,GAAG,8BAA8B,CAAC;AAEtG,MAAM,W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