@audienti/cli 0.1.50 → 0.1.52

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/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ All notable changes to the Audienti CLI are documented here.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.1.52] - 2026-09-03
8
+
9
+ ### Added
10
+
11
+ - Add direct, server-normalized `inbox-ops rule set` and `inbox-ops rule remove` commands for sender and domain rules while retaining authorized row-derived updates.
12
+
13
+ ## [0.1.51] - 2026-09-03
14
+
15
+ ### Added
16
+
17
+ - Add first-class `audienti inbox-ops queue`, `filters`, and `rule` commands backed by owner-scoped account APIs, authoritative row-derived sender/domain identities, all four allow/filter rule combinations, and unchanged JSON output.
18
+
7
19
  ## [0.1.50] - 2026-09-02
8
20
 
9
21
  ### Added
package/README.md CHANGED
@@ -214,6 +214,23 @@ audienti operator next --plan
214
214
  audienti operator next --done --note "Connection request sent."
215
215
  ```
216
216
 
217
+ Inbox Ops has its own owner-scoped CLI surface. Queue rows expose the stable row
218
+ id used by the row-based rule command. Rules can also be set or removed directly
219
+ by sender or domain; the server normalizes and validates every supplied key:
220
+
221
+ ```bash
222
+ audienti inbox-ops queue [--page <n>]
223
+ audienti inbox-ops filters
224
+ audienti inbox-ops rule <row_id> --scope sender --disposition filter
225
+ audienti inbox-ops rule <row_id> --scope domain --disposition allow
226
+ audienti inbox-ops rule set --scope sender --key news@example.com --disposition filter
227
+ audienti inbox-ops rule remove --scope domain --key example.com
228
+ ```
229
+
230
+ The rule commands mirror the Operator card actions. They update only
231
+ the authenticated owner's personal/global Inbox Ops preferences and do not
232
+ archive mail, call the provider, or add a DNC entry.
233
+
217
234
  To manage simple reminders for yourself:
218
235
 
219
236
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audienti/cli",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "description": "Agent-first command-line client for Audienti.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -132,6 +132,9 @@ audienti motions activate <motn_id> --json
132
132
  audienti motions delete <motn_id> --confirm yes --json
133
133
  audienti operator next --json
134
134
  audienti operator next --plan
135
+ audienti inbox-ops queue --json
136
+ audienti inbox-ops filters --json
137
+ audienti inbox-ops rule <row_id> --scope <sender|domain> --disposition <allow|filter> --json
135
138
  audienti analytics motions --json
136
139
  audienti analytics icps --json
137
140
  audienti analytics prospects --window 24h --json
package/src/api-client.js CHANGED
@@ -657,6 +657,31 @@ export class AudientiClient {
657
657
  return this.requestJson(accountPath(accountId, ["operator"], query));
658
658
  }
659
659
 
660
+ inboxOpsFilters(accountId) {
661
+ return this.requestJson(accountPath(accountId, ["inbox_ops", "filters"]));
662
+ }
663
+
664
+ updateInboxOpsRule(accountId, rowId, body) {
665
+ return this.requestJson(accountPath(accountId, ["inbox_ops", rowId, "rule"]), {
666
+ method: "PATCH",
667
+ body
668
+ });
669
+ }
670
+
671
+ setInboxOpsRule(accountId, body) {
672
+ return this.requestJson(accountPath(accountId, ["inbox_ops", "rules"]), {
673
+ method: "PATCH",
674
+ body
675
+ });
676
+ }
677
+
678
+ removeInboxOpsRule(accountId, body) {
679
+ return this.requestJson(accountPath(accountId, ["inbox_ops", "rules"]), {
680
+ method: "DELETE",
681
+ body
682
+ });
683
+ }
684
+
660
685
  operatorNext(accountId, query = {}) {
661
686
  return this.requestJson(accountPath(accountId, ["operator", "next"], query));
662
687
  }
@@ -812,7 +837,7 @@ function errorMessage(status, body) {
812
837
 
813
838
  if (status === 422) {
814
839
  const reasons = [body?.errors, body?.details].find(Array.isArray);
815
- const details = reasons?.length > 0 ? reasons.join(", ") : body?.error;
840
+ const details = reasons?.length > 0 ? reasons.join(", ") : body?.message || body?.error;
816
841
  return details ? `Audienti rejected the request: ${details}` : "Audienti rejected the request.";
817
842
  }
818
843
 
package/src/cli.js CHANGED
@@ -65,6 +65,12 @@ const PROSPECTS_CHECK_USAGE = "Usage: audienti prospects check [--json|--csv] [f
65
65
  const PROSPECTS_IMPORT_BATCH_USAGE = "Usage: audienti prospects import-batch --file <csv|jsonl|json> [--list <list_id>] [--motion <motn_id>] [--assigned-user <id|me>] [--json] [--account <acct_id>]";
66
66
  const OPERATOR_FAILED_DRAFTS_USAGE = "Usage: audienti operator failed-drafts [--json] [filters] [--account <acct_id>]";
67
67
  const OPERATOR_FAILED_DRAFTS_REQUEUE_USAGE = "Usage: audienti operator failed-drafts requeue (--all | <row_id> [row_id...]) [--limit <n>] [--json] [filters] [--account <acct_id>]";
68
+ const INBOX_OPS_QUEUE_USAGE = "Usage: audienti inbox-ops queue [--page <n>] [--json] [--account <acct_id>]";
69
+ const INBOX_OPS_FILTERS_USAGE = "Usage: audienti inbox-ops filters [--json] [--account <acct_id>]";
70
+ const INBOX_OPS_RULE_USAGE = "Usage: audienti inbox-ops rule <row_id> --scope <sender|domain> --disposition <allow|filter> [--json] [--account <acct_id>]";
71
+ const INBOX_OPS_RULE_SET_USAGE = "Usage: audienti inbox-ops rule set --scope <sender|domain> --key <email|domain> --disposition <allow|filter> [--json] [--account <acct_id>]";
72
+ const INBOX_OPS_RULE_REMOVE_USAGE = "Usage: audienti inbox-ops rule remove --scope <sender|domain> --key <email|domain> [--json] [--account <acct_id>]";
73
+ const INBOX_OPS_ROW_ID_PATTERN = /^inbox_ops_message_[1-9]\d*$/;
68
74
  const DNC_ADD_USAGE = "Usage: audienti dnc add <email|citation_id|profile_url> [--json] [--account <acct_id>]";
69
75
  const DNC_IMPORT_USAGE = "Usage: audienti dnc import --file <txt|csv> [--json] [--account <acct_id>]";
70
76
  const DNC_REMOVE_USAGE = "Usage: audienti dnc remove <dnc_entry_id> [--json] [--account <acct_id>]";
@@ -330,6 +336,9 @@ async function dispatch(argv, context) {
330
336
  if (normalizedResource === "operator" && action === "queue") return operatorQueue(rest, context, { accountOverride });
331
337
  if (normalizedResource === "operator" && action === "next") return operatorNext(rest, context, { accountOverride });
332
338
  if (normalizedResource === "operator" && action === "outcome") return operatorOutcome(rest, context, { accountOverride });
339
+ if (normalizedResource === "inbox-ops" && action === "queue") return inboxOpsQueue(rest, context, { accountOverride });
340
+ if (normalizedResource === "inbox-ops" && action === "filters") return inboxOpsFilters(rest, context, { accountOverride });
341
+ if (normalizedResource === "inbox-ops" && action === "rule") return inboxOpsRule(rest, context, { accountOverride });
333
342
  if (normalizedResource === "analytics" && ["prospects", "prospect"].includes(action)) return analyticsProspects(rest, context, { accountOverride });
334
343
  if (normalizedResource === "analytics" && ["users", "user"].includes(action)) return analyticsUsers(rest, context, { accountOverride });
335
344
  if (normalizedResource === "analytics" && ["visibility", "visops"].includes(action)) return analyticsVisibility(rest, context, { accountOverride });
@@ -3214,6 +3223,96 @@ async function operatorQueue(args, context, { accountOverride } = {}) {
3214
3223
  renderOperatorQueue(payload, context);
3215
3224
  }
3216
3225
 
3226
+ async function inboxOpsQueue(args, context, { accountOverride } = {}) {
3227
+ const { values, positionals } = parseCommandArgs(args, {
3228
+ ...jsonOptions(),
3229
+ page: { type: "string" }
3230
+ });
3231
+ if (positionals.length > 0) throw new CommandError(INBOX_OPS_QUEUE_USAGE);
3232
+
3233
+ const page = normalizeOptionalPositiveInteger(values.page, "--page");
3234
+ const { client, accountId } = await requireAccountContext(context, { accountOverride });
3235
+ const payload = await client.operatorQueue(accountId, compactObject({
3236
+ opportunity_kind: "inbox",
3237
+ operator_page: page
3238
+ }));
3239
+ if (values.json) return writeJson(context.stdout, payload);
3240
+
3241
+ renderInboxOpsQueue(payload, context);
3242
+ }
3243
+
3244
+ async function inboxOpsFilters(args, context, { accountOverride } = {}) {
3245
+ const { values, positionals } = parseCommandArgs(args, jsonOptions());
3246
+ if (positionals.length > 0) throw new CommandError(INBOX_OPS_FILTERS_USAGE);
3247
+
3248
+ const { client, accountId } = await requireAccountContext(context, { accountOverride });
3249
+ const payload = await client.inboxOpsFilters(accountId);
3250
+ if (values.json) return writeJson(context.stdout, payload);
3251
+
3252
+ renderInboxOpsFilters(payload, context);
3253
+ }
3254
+
3255
+ async function inboxOpsRule(args, context, { accountOverride } = {}) {
3256
+ if (args[0] === "set" || args[0] === "remove") {
3257
+ return inboxOpsRuleKeyMutation(args[0], args.slice(1), context, { accountOverride });
3258
+ }
3259
+
3260
+ const { values, positionals } = parseCommandArgs(args, {
3261
+ ...jsonOptions(),
3262
+ scope: { type: "string" },
3263
+ disposition: { type: "string" }
3264
+ });
3265
+ if (positionals.length !== 1) throw new CommandError(INBOX_OPS_RULE_USAGE);
3266
+ if (!["sender", "domain"].includes(values.scope)) throw new CommandError("--scope must be sender or domain.");
3267
+ if (!["allow", "filter"].includes(values.disposition)) throw new CommandError("--disposition must be allow or filter.");
3268
+
3269
+ const rowId = positionals[0];
3270
+ if (!INBOX_OPS_ROW_ID_PATTERN.test(rowId)) {
3271
+ throw new CommandError("<row_id> must match inbox_ops_message_<positive integer>.");
3272
+ }
3273
+
3274
+ const { client, accountId } = await requireAccountContext(context, { accountOverride });
3275
+ const payload = await client.updateInboxOpsRule(accountId, rowId, {
3276
+ scope: values.scope,
3277
+ disposition: values.disposition
3278
+ });
3279
+ if (values.json) return writeJson(context.stdout, payload);
3280
+
3281
+ renderInboxOpsRule(payload, context);
3282
+ }
3283
+
3284
+ async function inboxOpsRuleKeyMutation(action, args, context, { accountOverride } = {}) {
3285
+ const usage = action === "set" ? INBOX_OPS_RULE_SET_USAGE : INBOX_OPS_RULE_REMOVE_USAGE;
3286
+ const { values, positionals } = parseCommandArgs(args, {
3287
+ ...jsonOptions(),
3288
+ scope: { type: "string" },
3289
+ key: { type: "string" },
3290
+ disposition: { type: "string" }
3291
+ });
3292
+ if (positionals.length > 0) throw new CommandError(usage);
3293
+ if (!["sender", "domain"].includes(values.scope)) throw new CommandError("--scope must be sender or domain.");
3294
+ if (!String(values.key || "").trim()) throw new CommandError("--key is required.");
3295
+ if (action === "set" && !["allow", "filter"].includes(values.disposition)) {
3296
+ throw new CommandError("--disposition must be allow or filter.");
3297
+ }
3298
+ if (action === "remove" && values.disposition) {
3299
+ throw new CommandError("inbox-ops rule remove does not accept --disposition.");
3300
+ }
3301
+
3302
+ const { client, accountId } = await requireAccountContext(context, { accountOverride });
3303
+ const body = compactObject({
3304
+ scope: values.scope,
3305
+ key: values.key,
3306
+ disposition: action === "set" ? values.disposition : undefined
3307
+ });
3308
+ const payload = action === "set"
3309
+ ? await client.setInboxOpsRule(accountId, body)
3310
+ : await client.removeInboxOpsRule(accountId, body);
3311
+ if (values.json) return writeJson(context.stdout, payload);
3312
+
3313
+ renderInboxOpsRule(payload, context);
3314
+ }
3315
+
3217
3316
  async function operatorFailedDrafts(args, context, { accountOverride } = {}) {
3218
3317
  if (args[0] === "requeue") {
3219
3318
  return operatorFailedDraftsRequeue(args.slice(1), context, { accountOverride });
@@ -6151,6 +6250,56 @@ function renderOperatorQueue(payload, context) {
6151
6250
  writeOperatorRows(context, queue);
6152
6251
  }
6153
6252
 
6253
+ function renderInboxOpsQueue(payload, context) {
6254
+ const decisionQueue = Array.isArray(payload?.decision_queue) ? payload.decision_queue : [];
6255
+ const rows = decisionQueue.length > 0 ? decisionQueue : [payload?.next_move].filter(Boolean);
6256
+ if (rows.length === 0) return writeLine(context.stdout, "No Inbox Ops rows found.");
6257
+
6258
+ writeAlignedTable(context, ["ROW ID", "SENDER", "DOMAIN", "SUBJECT", "CONNECTED INBOX"], rows.map((row) => [
6259
+ display(row?.id),
6260
+ display(row?.inbox_ops?.sender),
6261
+ display(row?.inbox_ops?.domain),
6262
+ display(row?.inbox_ops?.subject),
6263
+ display(row?.inbox_ops?.connected_account)
6264
+ ]));
6265
+ if (payload?.has_more === true && payload?.next_page) {
6266
+ writeLine(context.stdout, "");
6267
+ writeLine(context.stdout, `More rows: audienti inbox-ops queue --page ${payload.next_page}`);
6268
+ }
6269
+ }
6270
+
6271
+ function renderInboxOpsFilters(payload, context) {
6272
+ const owner = payload?.owner || {};
6273
+ const filters = payload?.email_filters || {};
6274
+ writeLine(context.stdout, `Inbox Ops filters for ${display(owner.email || owner.name || owner.id)}`);
6275
+ writeLine(context.stdout, `Subscriptions: ${filters.subscriptions === false ? "Show" : "Filter"}`);
6276
+ writeLine(context.stdout, `Automated/no-reply: ${filters.automated_no_reply === false ? "Show" : "Filter"}`);
6277
+ writeLine(context.stdout, `Provider promotions: ${filters.provider_promotions === false ? "Show" : "Filter"}`);
6278
+ writeInboxOpsRules(context, "Sender rules", filters.sender_rules);
6279
+ writeInboxOpsRules(context, "Domain rules", filters.domain_rules);
6280
+ }
6281
+
6282
+ function writeInboxOpsRules(context, heading, rules) {
6283
+ const rows = Object.entries(rules || {}).sort(([left], [right]) => left.localeCompare(right));
6284
+ writeLine(context.stdout, "");
6285
+ writeLine(context.stdout, heading);
6286
+ if (rows.length === 0) return writeLine(context.stdout, "None");
6287
+
6288
+ writeAlignedTable(context, ["KEY", "DISPOSITION"], rows.map(([key, disposition]) => [key, humanize(disposition)]));
6289
+ }
6290
+
6291
+ function renderInboxOpsRule(payload, context) {
6292
+ const rule = payload?.rule || {};
6293
+ if (rule.action === "remove") {
6294
+ writeLine(context.stdout, `Removed ${display(rule.scope)} rule ${display(rule.normalized_key)}.`);
6295
+ return writeLine(context.stdout, "Re-run `audienti inbox-ops queue` to inspect the current queue.");
6296
+ }
6297
+
6298
+ const action = rule.disposition === "allow" ? "Always showing" : "Always filtering";
6299
+ writeLine(context.stdout, `${action} ${display(rule.scope)} ${display(rule.normalized_key)}.`);
6300
+ writeLine(context.stdout, "Re-run `audienti inbox-ops queue` to inspect the current queue.");
6301
+ }
6302
+
6154
6303
  function renderOperatorNext(row, context) {
6155
6304
  if (!row) return writeLine(context.stdout, "No operator moves found.");
6156
6305
 
@@ -7520,6 +7669,11 @@ const HELP_TOPICS = new Map([
7520
7669
  " audienti operator queue",
7521
7670
  " audienti operator failed-drafts",
7522
7671
  " audienti operator failed-drafts requeue <row_id>",
7672
+ "",
7673
+ " Inbox Ops",
7674
+ " audienti inbox-ops queue",
7675
+ " audienti inbox-ops filters",
7676
+ " audienti inbox-ops rule <row_id> --scope <sender|domain> --disposition <allow|filter>",
7523
7677
  "",
7524
7678
  " Analytics",
7525
7679
  " audienti analytics motions",
@@ -10327,6 +10481,83 @@ const HELP_TOPICS = new Map([
10327
10481
  " GET /api/v1/accounts/:account_id/tools/linkedin-review/reports/:id.json"
10328
10482
  ].join("\n")],
10329
10483
 
10484
+ ["inbox-ops", [
10485
+ "Usage:",
10486
+ ` ${INBOX_OPS_QUEUE_USAGE.slice("Usage: ".length)}`,
10487
+ ` ${INBOX_OPS_FILTERS_USAGE.slice("Usage: ".length)}`,
10488
+ ` ${INBOX_OPS_RULE_USAGE.slice("Usage: ".length)}`,
10489
+ ` ${INBOX_OPS_RULE_SET_USAGE.slice("Usage: ".length)}`,
10490
+ ` ${INBOX_OPS_RULE_REMOVE_USAGE.slice("Usage: ".length)}`,
10491
+ "",
10492
+ "Status: implemented",
10493
+ "",
10494
+ "Purpose:",
10495
+ " Inspect the authenticated owner's private Inbox Ops queue and personal/global email rules, then set or remove sender and domain rules.",
10496
+ "",
10497
+ "Safety:",
10498
+ " Rules always apply to the token owner. Row-based updates derive identity from an authorized current Inbox Ops row.",
10499
+ " Key-based set/remove commands normalize and validate the supplied sender or domain on the server.",
10500
+ "",
10501
+ "Rule values:",
10502
+ " --scope sender|domain",
10503
+ " --disposition allow|filter",
10504
+ "",
10505
+ "API:",
10506
+ " queue: GET /api/v1/accounts/:account_id/operator.json?opportunity_kind=inbox",
10507
+ " filters: GET /api/v1/accounts/:account_id/inbox_ops/filters.json",
10508
+ " rule: PATCH /api/v1/accounts/:account_id/inbox_ops/:row_id/rule.json",
10509
+ " keyed rules: PATCH|DELETE /api/v1/accounts/:account_id/inbox_ops/rules.json"
10510
+ ].join("\n")],
10511
+
10512
+ ["inbox-ops queue", [
10513
+ INBOX_OPS_QUEUE_USAGE,
10514
+ "",
10515
+ "Status: implemented",
10516
+ "",
10517
+ "Purpose:",
10518
+ " List one page of the authenticated owner's current private Inbox Ops rows with the authoritative sender/domain rule identity, subject, and connected inbox.",
10519
+ " When more rows exist, the plain output prints the next --page command.",
10520
+ "",
10521
+ "API:",
10522
+ " GET /api/v1/accounts/:account_id/operator.json?opportunity_kind=inbox"
10523
+ ].join("\n")],
10524
+
10525
+ ["inbox-ops filters", [
10526
+ INBOX_OPS_FILTERS_USAGE,
10527
+ "",
10528
+ "Status: implemented",
10529
+ "",
10530
+ "Purpose:",
10531
+ " Read the authenticated owner's normalized personal/global Inbox Ops filters and sender/domain rules.",
10532
+ "",
10533
+ "API:",
10534
+ " GET /api/v1/accounts/:account_id/inbox_ops/filters.json"
10535
+ ].join("\n")],
10536
+
10537
+ ["inbox-ops rule", [
10538
+ "Usage:",
10539
+ ` ${INBOX_OPS_RULE_USAGE.slice("Usage: ".length)}`,
10540
+ ` ${INBOX_OPS_RULE_SET_USAGE.slice("Usage: ".length)}`,
10541
+ ` ${INBOX_OPS_RULE_REMOVE_USAGE.slice("Usage: ".length)}`,
10542
+ "",
10543
+ "Status: implemented",
10544
+ "",
10545
+ "Purpose:",
10546
+ " Set one allow or filter rule from an authorized current Inbox Ops row, or set/remove a normalized rule by key.",
10547
+ "",
10548
+ "Safety:",
10549
+ " The server derives row-based identities and normalizes and validates direct sender/domain keys.",
10550
+ " Every mutation applies only to the authenticated token owner's personal/global preferences.",
10551
+ "",
10552
+ "Rule values:",
10553
+ " --scope sender|domain",
10554
+ " --disposition allow|filter",
10555
+ "",
10556
+ "API:",
10557
+ " row: PATCH /api/v1/accounts/:account_id/inbox_ops/:row_id/rule.json",
10558
+ " key: PATCH|DELETE /api/v1/accounts/:account_id/inbox_ops/rules.json"
10559
+ ].join("\n")],
10560
+
10330
10561
  ["operator", [
10331
10562
  "Usage:",
10332
10563
  " audienti operator next [--json|--plan|--done|--skip|--fail|--return]",
@@ -10342,7 +10573,7 @@ const HELP_TOPICS = new Map([
10342
10573
  " --motion <motn_id>",
10343
10574
  " --list <list_id>",
10344
10575
  " --stage <stage>",
10345
- " --opportunity-kind prospect|visibility",
10576
+ " --opportunity-kind prospect|visibility|inbox",
10346
10577
  " --writing-status ready|drafting|draft_failed"
10347
10578
  ].join("\n")],
10348
10579
 
@@ -10854,6 +11085,11 @@ const HELP_TOPICS = new Map([
10854
11085
  " audienti operator failed-drafts",
10855
11086
  " audienti operator failed-drafts requeue <row_id>",
10856
11087
  " audienti operator outcome <row_id> --payload <file.json>",
11088
+ " audienti inbox-ops queue",
11089
+ " audienti inbox-ops filters",
11090
+ " audienti inbox-ops rule <row_id> --scope sender --disposition filter",
11091
+ " audienti inbox-ops rule set --scope sender --key news@example.com --disposition filter",
11092
+ " audienti inbox-ops rule remove --scope domain --key example.com",
10857
11093
  "",
10858
11094
  "7. Inspect account analytics",
10859
11095
  " audienti users activity me --window 7d",