@agent-nexus/cli 0.1.13 → 0.1.14

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 (2) hide show
  1. package/dist/index.js +149 -44
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -166,7 +166,7 @@ var require_package = __commonJS({
166
166
  "package.json"(exports2, module2) {
167
167
  module2.exports = {
168
168
  name: "@agent-nexus/cli",
169
- version: "0.1.13",
169
+ version: "0.1.14",
170
170
  description: "Official CLI for the Nexus AI agent platform.",
171
171
  license: "MIT",
172
172
  keywords: [
@@ -798,6 +798,23 @@ var ChannelsResource = class extends BaseResource {
798
798
  { body }
799
799
  );
800
800
  }
801
+ // ===========================================================================
802
+ // WhatsApp Template Test-Send
803
+ // ===========================================================================
804
+ async testSendWhatsAppTemplate(templateId, body) {
805
+ return this.http.request(
806
+ "POST",
807
+ `/channels/whatsapp-templates/${templateId}/test-send`,
808
+ { body }
809
+ );
810
+ }
811
+ async getTestSendStatus(templateId, messageSid, params) {
812
+ return this.http.request(
813
+ "GET",
814
+ `/channels/whatsapp-templates/${templateId}/test-send/${messageSid}/status`,
815
+ { query: params }
816
+ );
817
+ }
801
818
  };
802
819
  var CloudImportsResource = class extends BaseResource {
803
820
  // Google Drive
@@ -4197,6 +4214,83 @@ Next: Attach to deployment: ${color.dim("nexus deployment template attach <depId
4197
4214
  process.exitCode = handleError(err);
4198
4215
  }
4199
4216
  });
4217
+ waTemplate.command("test-send").description(
4218
+ "Test-send a WhatsApp template to a phone number via the real Twilio/Meta pipeline"
4219
+ ).requiredOption("--connection-id <id>", "Messaging connection ID").requiredOption("--template-id <id>", "Template ID (Twilio content SID)").requiredOption("--to <phone>", "Recipient phone number in E.164 format (e.g., +1234567890)").option("--variables <json>", `Template variables as JSON (e.g., '{"1": "Hello"}')`).option("--wait", "Poll delivery status until resolved (up to 2 minutes)").addHelpText(
4220
+ "after",
4221
+ `
4222
+ Examples:
4223
+ $ nexus channel whatsapp-template test-send --connection-id abc --template-id HX123 --to +1234567890
4224
+ $ nexus channel whatsapp-template test-send --connection-id abc --template-id HX123 --to +1234567890 --variables '{"1": "Sneakers"}' --wait`
4225
+ ).action(async (opts) => {
4226
+ try {
4227
+ const client = createClient(program2.optsWithGlobals());
4228
+ let variables;
4229
+ if (opts.variables) {
4230
+ try {
4231
+ variables = JSON.parse(opts.variables);
4232
+ } catch {
4233
+ console.error(`Invalid JSON for --variables. Example: '{"1": "Hello"}'`);
4234
+ process.exitCode = 1;
4235
+ return;
4236
+ }
4237
+ }
4238
+ const result = await client.channels.testSendWhatsAppTemplate(opts.templateId, {
4239
+ connectionId: opts.connectionId,
4240
+ to: opts.to,
4241
+ variables
4242
+ });
4243
+ const data = result?.data ?? result;
4244
+ printRecord(data, [
4245
+ { key: "messageSid", label: "Message SID" },
4246
+ { key: "status", label: "Status" },
4247
+ { key: "to", label: "To" },
4248
+ { key: "from", label: "From" },
4249
+ { key: "sentAt", label: "Sent At" }
4250
+ ]);
4251
+ printSuccess("Template test-send initiated.");
4252
+ if (opts.wait) {
4253
+ const maxWaitMs = 12e4;
4254
+ const intervalMs = 5e3;
4255
+ const startTime = Date.now();
4256
+ let lastStatus = data.status;
4257
+ console.log("Polling delivery status...");
4258
+ while (Date.now() - startTime < maxWaitMs) {
4259
+ await new Promise((r) => setTimeout(r, intervalMs));
4260
+ try {
4261
+ const statusResult = await client.channels.getTestSendStatus(
4262
+ opts.templateId,
4263
+ data.messageSid,
4264
+ { connectionId: opts.connectionId }
4265
+ );
4266
+ const statusData = statusResult?.data ?? statusResult;
4267
+ lastStatus = statusData.status;
4268
+ if (["delivered", "read"].includes(lastStatus)) {
4269
+ console.log(color.green(`\u2713 Message ${lastStatus}.`));
4270
+ break;
4271
+ } else if (["failed", "undelivered"].includes(lastStatus)) {
4272
+ console.log(color.red(`\u2717 Message ${lastStatus}.`));
4273
+ if (statusData.errorCode) {
4274
+ console.log(
4275
+ ` Error ${statusData.errorCode}: ${statusData.errorMessage ?? "Unknown error"}`
4276
+ );
4277
+ }
4278
+ process.exitCode = 1;
4279
+ break;
4280
+ }
4281
+ } catch {
4282
+ }
4283
+ }
4284
+ if (!["delivered", "read", "failed", "undelivered"].includes(lastStatus)) {
4285
+ console.log(
4286
+ `Status still '${lastStatus}' after 2m. The message may still be in transit.`
4287
+ );
4288
+ }
4289
+ }
4290
+ } catch (err) {
4291
+ process.exitCode = handleError(err);
4292
+ }
4293
+ });
4200
4294
  }
4201
4295
 
4202
4296
  // src/commands/collection.ts
@@ -5026,8 +5120,7 @@ Examples:
5026
5120
  if (opts.description !== void 0) body.description = opts.description;
5027
5121
  if (opts.enableMultiLanguage !== void 0)
5028
5122
  body.enableMultiLanguage = opts.enableMultiLanguage;
5029
- if (opts.enableDynamicSize !== void 0)
5030
- body.enableDynamicSize = opts.enableDynamicSize;
5123
+ if (opts.enableDynamicSize !== void 0) body.enableDynamicSize = opts.enableDynamicSize;
5031
5124
  if (opts.singleItemCardTemplateId !== void 0)
5032
5125
  body.singleItemCardTemplateId = opts.singleItemCardTemplateId;
5033
5126
  if (opts.variables) {
@@ -12742,7 +12835,7 @@ init_output();
12742
12835
  function registerTracingCommands(program2) {
12743
12836
  const tracing = program2.command("tracing").description("View LLM traces and analytics");
12744
12837
  addPaginationOptions(
12745
- tracing.command("traces").description("List LLM traces").option("--status <status>", "Filter by status (IN_PROGRESS, COMPLETED, FAILED)").option("--agent-id <id>", "Filter by agent ID").option("--workflow-id <id>", "Filter by workflow ID").option("--model <name>", "Filter by model name").option("--start-date <iso>", "Filter from date (ISO 8601)").option("--end-date <iso>", "Filter to date (ISO 8601)").option(
12838
+ tracing.command("traces").description("List LLM traces").option("--status <status>", "Filter by status (IN_PROGRESS, COMPLETED, FAILED)").option("--agent-id <id>", "Filter by agent ID").option("--workflow-id <id>", "Filter by workflow ID").option("--model <name>", "Filter by model name (max 255 chars)").option("--start-date <iso>", "Filter from date (ISO 8601, e.g. 2026-03-01)").option("--end-date <iso>", "Filter to date (ISO 8601, e.g. 2026-03-01)").option(
12746
12839
  "--sort-by <field>",
12747
12840
  "Sort by field (startedAt, totalCostUsd, totalDurationMs)",
12748
12841
  "startedAt"
@@ -12768,26 +12861,30 @@ Examples:
12768
12861
  sortBy: opts.sortBy,
12769
12862
  order: opts.order
12770
12863
  });
12771
- printList(data, meta, [
12772
- { key: "id", label: "ID", width: 36 },
12773
- { key: "status", label: "STATUS", width: 12, format: formatStatus },
12774
- { key: "agentName", label: "AGENT", width: 20 },
12775
- { key: "workflowName", label: "WORKFLOW", width: 20 },
12776
- {
12777
- key: "totalCostUsd",
12778
- label: "COST ($)",
12779
- width: 10,
12780
- format: (v) => v != null ? `$${Number(v).toFixed(4)}` : "-"
12781
- },
12782
- {
12783
- key: "totalDurationMs",
12784
- label: "DURATION",
12785
- width: 10,
12786
- format: (v) => v != null ? `${Number(v)}ms` : "-"
12787
- },
12788
- { key: "generationCount", label: "GENS", width: 5 },
12789
- { key: "startedAt", label: "STARTED", width: 20 }
12790
- ]);
12864
+ printList(
12865
+ data,
12866
+ meta,
12867
+ [
12868
+ { key: "id", label: "ID", width: 36 },
12869
+ { key: "status", label: "STATUS", width: 12, format: formatStatus },
12870
+ { key: "agentName", label: "AGENT", width: 20 },
12871
+ { key: "workflowName", label: "WORKFLOW", width: 20 },
12872
+ {
12873
+ key: "totalCostUsd",
12874
+ label: "COST ($)",
12875
+ width: 10,
12876
+ format: (v) => v != null ? `$${Number(v).toFixed(4)}` : "-"
12877
+ },
12878
+ {
12879
+ key: "totalDurationMs",
12880
+ label: "DURATION",
12881
+ width: 10,
12882
+ format: (v) => v != null ? `${Number(v)}ms` : "-"
12883
+ },
12884
+ { key: "generationCount", label: "GENS", width: 5 },
12885
+ { key: "startedAt", label: "STARTED", width: 20 }
12886
+ ]
12887
+ );
12791
12888
  } catch (err) {
12792
12889
  process.exitCode = handleError(err);
12793
12890
  }
@@ -12807,7 +12904,11 @@ Examples:
12807
12904
  { key: "status", label: "Status" },
12808
12905
  { key: "agentName", label: "Agent" },
12809
12906
  { key: "workflowName", label: "Workflow" },
12810
- { key: "totalCostUsd", label: "Cost ($)", format: (v) => v != null ? `$${Number(v).toFixed(4)}` : "-" },
12907
+ {
12908
+ key: "totalCostUsd",
12909
+ label: "Cost ($)",
12910
+ format: (v) => v != null ? `$${Number(v).toFixed(4)}` : "-"
12911
+ },
12811
12912
  { key: "totalInputTokens", label: "Input Tokens" },
12812
12913
  { key: "totalOutputTokens", label: "Output Tokens" },
12813
12914
  { key: "totalDurationMs", label: "Duration (ms)" },
@@ -12856,7 +12957,7 @@ Examples:
12856
12957
  }
12857
12958
  });
12858
12959
  addPaginationOptions(
12859
- tracing.command("generations").description("List LLM generations across traces").option("--trace-id <id>", "Filter by trace ID").option("--provider <provider>", "Filter by provider (OPEN_AI, ANTHROPIC, GOOGLE_AI)").option("--model <name>", "Filter by model name").option("--status <status>", "Filter by status (PENDING, RUNNING, COMPLETED, FAILED)").option("--agent-id <id>", "Filter by agent ID").option("--task-id <id>", "Filter by task ID").option("--start-date <iso>", "Filter from date").option("--end-date <iso>", "Filter to date").option("--min-cost <usd>", "Minimum cost in USD").option("--max-cost <usd>", "Maximum cost in USD").addHelpText(
12960
+ tracing.command("generations").description("List LLM generations across traces").option("--trace-id <id>", "Filter by trace ID").option("--provider <provider>", "Filter by provider (OPEN_AI, ANTHROPIC, GOOGLE_AI)").option("--model <name>", "Filter by model name (max 255 chars)").option("--status <status>", "Filter by status (PENDING, RUNNING, COMPLETED, FAILED)").option("--agent-id <id>", "Filter by agent ID").option("--task-id <id>", "Filter by task ID").option("--start-date <iso>", "Filter from date (ISO 8601, e.g. 2026-03-01)").option("--end-date <iso>", "Filter to date (ISO 8601, e.g. 2026-03-01)").option("--min-cost <usd>", "Minimum cost in USD").option("--max-cost <usd>", "Maximum cost in USD").addHelpText(
12860
12961
  "after",
12861
12962
  `
12862
12963
  Examples:
@@ -12880,24 +12981,28 @@ Examples:
12880
12981
  minCostUsd: opts.minCost ? parseFloat(opts.minCost) : void 0,
12881
12982
  maxCostUsd: opts.maxCost ? parseFloat(opts.maxCost) : void 0
12882
12983
  });
12883
- printList(data, meta, [
12884
- { key: "id", label: "ID", width: 36 },
12885
- { key: "traceId", label: "TRACE", width: 36 },
12886
- { key: "modelName", label: "MODEL", width: 25 },
12887
- { key: "status", label: "STATUS", width: 12, format: formatStatus },
12888
- {
12889
- key: "costUsd",
12890
- label: "COST ($)",
12891
- width: 10,
12892
- format: (v) => v != null ? `$${Number(v).toFixed(6)}` : "-"
12893
- },
12894
- {
12895
- key: "durationMs",
12896
- label: "DURATION",
12897
- width: 10,
12898
- format: (v) => v != null ? `${v}ms` : "-"
12899
- }
12900
- ]);
12984
+ printList(
12985
+ data,
12986
+ meta,
12987
+ [
12988
+ { key: "id", label: "ID", width: 36 },
12989
+ { key: "traceId", label: "TRACE", width: 36 },
12990
+ { key: "modelName", label: "MODEL", width: 25 },
12991
+ { key: "status", label: "STATUS", width: 12, format: formatStatus },
12992
+ {
12993
+ key: "costUsd",
12994
+ label: "COST ($)",
12995
+ width: 10,
12996
+ format: (v) => v != null ? `$${Number(v).toFixed(6)}` : "-"
12997
+ },
12998
+ {
12999
+ key: "durationMs",
13000
+ label: "DURATION",
13001
+ width: 10,
13002
+ format: (v) => v != null ? `${v}ms` : "-"
13003
+ }
13004
+ ]
13005
+ );
12901
13006
  } catch (err) {
12902
13007
  process.exitCode = handleError(err);
12903
13008
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-nexus/cli",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Official CLI for the Nexus AI agent platform.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -35,7 +35,7 @@
35
35
  "@types/node": "24.6.2",
36
36
  "tsup": "^8.5.0",
37
37
  "typescript": "^5.8.3",
38
- "@agent-nexus/sdk": "0.1.15"
38
+ "@agent-nexus/sdk": "0.1.16"
39
39
  },
40
40
  "scripts": {
41
41
  "gen:docs": "tsx scripts/bundle-docs.ts",