@audienti/cli 0.1.53 → 0.1.55

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.55] - 2026-09-05
8
+
9
+ ### Changed
10
+
11
+ - Preserve the actual viewer's private-owner authorization through Operator API reads, failed-draft retries, and outcome refreshes, including guarded default, Inbox, and Network projection reads.
12
+
13
+ ## [0.1.54] - 2026-09-04
14
+
15
+ ### Changed
16
+
17
+ - Make `audienti motions run-discovery` expose the durable discovery-run receipt, exact rejection reason, retry time, scope outcome, and distinct submitted and promoted counts; rejected launches now exit nonzero while preserving structured `--json` output.
18
+
7
19
  ## [0.1.53] - 2026-09-04
8
20
 
9
21
  ### Changed
package/README.md CHANGED
@@ -470,6 +470,15 @@ used by the operator surface:
470
470
  audienti motions run-discovery <motn_id>
471
471
  ```
472
472
 
473
+ Outbound, inbound, and LOPA motions are accepted only when their current
474
+ configuration and discovery producer are executable. An accepted response
475
+ includes a durable `run` receipt that starts in `pending` before the discovery
476
+ job is queued. Rejected launches exit nonzero and report the authoritative
477
+ `reason`, optional `next_eligible_at`, and `suggested_action`; `--json` preserves
478
+ that structured response on stdout for automation. Completed receipts keep
479
+ candidate `submitted_count` separate from the current persisted
480
+ `promoted_count`, and expose completed, failed, and blocked scope counts.
481
+
473
482
  To check whether a motion has executable configuration before preparing,
474
483
  activating, or running discovery:
475
484
 
@@ -480,7 +489,8 @@ audienti motions status <motn_id> --json
480
489
 
481
490
  The JSON response includes `executable_configuration.valid` plus a reason when
482
491
  the config is incomplete, such as missing outbound signals or missing LOPA
483
- tracked profile URLs.
492
+ tracked profile URLs. Its latest discovery receipt uses the same submitted,
493
+ promoted, and scope outcome fields as `run-discovery`.
484
494
 
485
495
  To create and launch a quick-start motion from a company URL:
486
496
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audienti/cli",
3
- "version": "0.1.53",
3
+ "version": "0.1.55",
4
4
  "description": "Agent-first command-line client for Audienti.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -1752,12 +1752,27 @@ async function motionsRunDiscovery(args, context, { accountOverride } = {}) {
1752
1752
  if (positionals.length !== 1) throw new CommandError(MOTIONS_RUN_DISCOVERY_USAGE);
1753
1753
 
1754
1754
  const { client, accountId } = await requireAccountContext(context, { accountOverride });
1755
- const payload = await client.runMotionDiscovery(accountId, positionals[0], compactObject({
1756
- target_count: normalizeOptionalPositiveInteger(values["target-count"], "--target-count")
1757
- }));
1758
- if (values.json) return writeJson(context.stdout, payload);
1755
+ let payload;
1756
+ try {
1757
+ payload = await client.runMotionDiscovery(accountId, positionals[0], compactObject({
1758
+ target_count: normalizeOptionalPositiveInteger(values["target-count"], "--target-count")
1759
+ }));
1760
+ } catch (error) {
1761
+ if (!(error instanceof ApiError) || !error.body || typeof error.body !== "object") throw error;
1762
+
1763
+ payload = error.body;
1764
+ if (values.json) writeJson(context.stdout, payload);
1765
+ else renderMotionDiscoveryRun(payload, context);
1766
+ return 1;
1767
+ }
1768
+
1769
+ if (values.json) {
1770
+ writeJson(context.stdout, payload);
1771
+ return payload?.enqueued ? 0 : 1;
1772
+ }
1759
1773
 
1760
1774
  renderMotionDiscoveryRun(payload, context);
1775
+ return payload?.enqueued ? 0 : 1;
1761
1776
  }
1762
1777
 
1763
1778
  async function motionsQuickStart(args, context, { accountOverride } = {}) {
@@ -5436,6 +5451,8 @@ function renderMotionStatus(status, context) {
5436
5451
  renderExecutableConfiguration(status?.executable_configuration, context);
5437
5452
  if (status?.description) writeLine(context.stdout, status.description);
5438
5453
  if (status?.action?.label) writeLine(context.stdout, `Action: ${status.action.label}`);
5454
+ renderDiscoveryRunReceipt(status?.discovery_run, context);
5455
+ if (status?.next_eligible_at) writeLine(context.stdout, `Retry at: ${status.next_eligible_at}`);
5439
5456
  }
5440
5457
 
5441
5458
  function renderExecutableConfiguration(config, context) {
@@ -6478,11 +6495,31 @@ function renderMotionAnalytics(payload, context) {
6478
6495
 
6479
6496
  function renderMotionDiscoveryRun(payload, context) {
6480
6497
  const motion = payload?.motion || {};
6498
+ const run = payload?.run;
6481
6499
  const label = entityLabel(motion) || payload?.motion_id;
6482
6500
  const prefix = payload?.enqueued ? "Discovery queued" : "Discovery not queued";
6483
6501
  writeLine(context.stdout, `${prefix} for ${display(label)}.`);
6484
6502
  writeLine(context.stdout, `Reason: ${display(payload?.reason)}`);
6485
6503
  writeLine(context.stdout, `Target count: ${display(payload?.target_count)}`);
6504
+ renderDiscoveryRunReceipt(run, context);
6505
+ if (payload?.next_eligible_at) writeLine(context.stdout, `Retry at: ${payload.next_eligible_at}`);
6506
+ if (payload?.suggested_action) writeLine(context.stdout, `Next action: ${payload.suggested_action}`);
6507
+ }
6508
+
6509
+ function renderDiscoveryRunReceipt(run, context) {
6510
+ if (run) {
6511
+ writeLine(context.stdout, `Run: ${display(run.id)} (${display(run.status)})`);
6512
+ if (run.queued_at) writeLine(context.stdout, `Queued: ${run.queued_at}`);
6513
+ if (run.started_at) writeLine(context.stdout, `Started: ${run.started_at}`);
6514
+ if (run.finished_at) writeLine(context.stdout, `Finished: ${run.finished_at}`);
6515
+ if ([run.seen_count, run.submitted_count, run.accepted_count, run.promoted_count, run.rejected_count].some((value) => value != null)) {
6516
+ const submittedCount = run.submitted_count ?? run.accepted_count;
6517
+ writeLine(context.stdout, `Counts: ${display(run.seen_count)} seen, ${display(submittedCount)} submitted, ${display(run.promoted_count)} promoted, ${display(run.rejected_count)} rejected`);
6518
+ }
6519
+ if (run.outcome) writeLine(context.stdout, `Outcome: ${run.outcome}`);
6520
+ if (run.scope_counts) writeLine(context.stdout, `Scopes: ${display(run.scope_counts.planned)} planned, ${display(run.scope_counts.successful)} successful, ${display(run.scope_counts.failed)} failed, ${display(run.scope_counts.blocked)} blocked`);
6521
+ if (run.error_message) writeLine(context.stdout, `Error: ${run.error_message}`);
6522
+ }
6486
6523
  }
6487
6524
 
6488
6525
  function renderQuickStartDraft(draft, context) {
@@ -9165,6 +9202,8 @@ const HELP_TOPICS = new Map([
9165
9202
  " executable_configuration: { valid: boolean, reason_key: string | null, reason_label: string | null, description: string | null }",
9166
9203
  " description: string",
9167
9204
  " action: { key: string, label: string } | null",
9205
+ " next_eligible_at: persisted retry time when the server can calculate one",
9206
+ " discovery_run: latest run id, status, trigger, seen/submitted/promoted/rejected counts, scope counts, outcome, timestamps, and error_message",
9168
9207
  " stats: { target_count, deficit, projected_connectable, capacity, daily_target }",
9169
9208
  "",
9170
9209
  "API:",
@@ -9199,15 +9238,28 @@ const HELP_TOPICS = new Map([
9199
9238
  "Status: implemented",
9200
9239
  "",
9201
9240
  "Purpose:",
9202
- " Queue an immediate discovery run for one discovery-capable motion or play.",
9241
+ " Queue an immediate discovery run for one executable outbound, inbound, or LOPA motion or play.",
9242
+ " An accepted response means the server persisted a pending run receipt before queuing work.",
9203
9243
  "",
9204
9244
  "Options:",
9205
9245
  " --target-count <n> Override the manual replenishment target count for this launch.",
9206
9246
  "",
9207
9247
  "Output shape:",
9208
- " enqueued: true when Motions::DiscoverJob was queued",
9209
- " reason: launched | run_in_progress | lock_contention | target_met | enqueue_failed",
9248
+ " enqueued: true only when a durable run receipt exists and Motions::DiscoverJob was queued",
9249
+ " reason: launched or the authoritative rejection/failure reason",
9210
9250
  " target_count: requested target count",
9251
+ " next_eligible_at: retry time when the server can calculate one",
9252
+ " suggested_action: concrete operator guidance when blocked",
9253
+ " run: id, status, trigger, target, seen/submitted/promoted/rejected counts, scope counts, outcome, timestamps, and error_message",
9254
+ "",
9255
+ "Exit status:",
9256
+ " 0 when discovery was accepted and queued; 1 when rejected or enqueueing failed.",
9257
+ " With --json, rejected responses remain machine-readable on stdout.",
9258
+ "",
9259
+ "Common reasons:",
9260
+ " run_in_progress | recent_manual_launch | lock_contention | target_met",
9261
+ " strategy_inventory_exhausted | producer_cooling | enqueue_failed | launch_stalled",
9262
+ " completed_empty | discovery_failed | job_failed",
9211
9263
  "",
9212
9264
  "API:",
9213
9265
  " POST /api/v1/accounts/:account_id/motions/:id/run_discovery.json"