@signaliz/sdk 1.0.10 → 1.0.11

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
@@ -98,6 +98,14 @@ console.log(plan.strategyMemoryStatus?.ready);
98
98
  console.log(plan.mcpFlow.filter((step) =>
99
99
  ['gtm_provider_recipe_prepare', 'gtm_provider_route_activate'].includes(step.tool)
100
100
  ));
101
+
102
+ // After an approved launch, keep review and delivery in the agent surface.
103
+ const finalStatus = await signaliz.campaignBuilderAgent.getBuildStatus('campaign_build_id');
104
+ const reviewRows = await signaliz.campaignBuilderAgent.getBuildRows('campaign_build_id', {
105
+ limit: 100,
106
+ qualified: true,
107
+ });
108
+ const artifacts = await signaliz.campaignBuilderAgent.listBuildArtifacts('campaign_build_id');
101
109
  ```
102
110
 
103
111
  The CLI can run the same request shape from a reusable JSON file, with flags
@@ -115,6 +123,9 @@ npx @signaliz/sdk campaign-agent plan \
115
123
  --request-file campaign-request.json \
116
124
  --target-count 250 \
117
125
  --json
126
+
127
+ npx @signaliz/sdk campaign-agent status campaign_build_id --json
128
+ npx @signaliz/sdk campaign-agent rows campaign_build_id --limit 100 --json
118
129
  ```
119
130
 
120
131
  Use the hosted MCP campaign-agent planner when you want Signaliz to return the
@@ -1847,6 +1847,33 @@ var CampaignBuilderAgent = class {
1847
1847
  }
1848
1848
  return result;
1849
1849
  }
1850
+ async getBuildStatus(campaignBuildId) {
1851
+ return this.getCampaignBuildStatus(campaignBuildId);
1852
+ }
1853
+ async getBuildRows(campaignBuildId, options = {}) {
1854
+ const filters = compact({
1855
+ segment: options.segment,
1856
+ qualified: options.qualified,
1857
+ row_status: options.rowStatus
1858
+ });
1859
+ const args = compact({
1860
+ campaign_build_id: campaignBuildId,
1861
+ page_size: options.limit,
1862
+ cursor: options.cursor
1863
+ });
1864
+ if (Object.keys(filters).length > 0) args.filters = filters;
1865
+ const data = await this.callMcp("get_campaign_build_rows", args);
1866
+ return mapAgentCampaignRowsResult(data);
1867
+ }
1868
+ async listBuildArtifacts(campaignBuildId) {
1869
+ const data = await this.callMcp("list_campaign_build_artifacts", {
1870
+ campaign_build_id: campaignBuildId
1871
+ });
1872
+ return Array.isArray(data.artifacts) ? data.artifacts.map(mapAgentCampaignArtifact) : [];
1873
+ }
1874
+ async approveDelivery(campaignBuildId, destinationType, options) {
1875
+ return this.approveCampaignDelivery(campaignBuildId, destinationType, options);
1876
+ }
1850
1877
  async getCampaignBuildStatus(campaignBuildId) {
1851
1878
  const data = await this.callMcp("get_campaign_build_status", {
1852
1879
  campaign_build_id: campaignBuildId
@@ -3240,6 +3267,40 @@ function mapAgentCampaignBuildStatus(data) {
3240
3267
  completedAt: stringValue(data.completed_at) ?? null
3241
3268
  };
3242
3269
  }
3270
+ function mapAgentCampaignRowsResult(data) {
3271
+ const rows = Array.isArray(data.rows) ? data.rows : [];
3272
+ return {
3273
+ campaignBuildId: stringValue(data.campaign_build_id) ?? "",
3274
+ rows: rows.map((row, index) => {
3275
+ const record = asRecord(row);
3276
+ return {
3277
+ index: numberOrUndefined2(record.index) ?? index,
3278
+ status: stringValue(record.status) ?? stringValue(record.row_status) ?? "unknown",
3279
+ qualified: record.qualified !== false,
3280
+ segment: stringValue(record.segment) ?? null,
3281
+ data: nullableRecord(record.data) ?? record
3282
+ };
3283
+ }),
3284
+ count: numberOrUndefined2(data.count) ?? rows.length,
3285
+ pageSize: numberOrUndefined2(data.page_size) ?? rows.length,
3286
+ nextCursor: stringValue(data.next_cursor) ?? null,
3287
+ hasMore: data.has_more === true
3288
+ };
3289
+ }
3290
+ function mapAgentCampaignArtifact(data) {
3291
+ return {
3292
+ id: stringValue(data.id) ?? "",
3293
+ campaignBuildId: stringValue(data.campaign_build_id) ?? "",
3294
+ artifactType: stringValue(data.artifact_type) ?? "",
3295
+ destination: stringValue(data.destination) ?? "",
3296
+ storagePath: stringValue(data.storage_path) ?? "",
3297
+ signedUrl: stringValue(data.signed_url) ?? null,
3298
+ rowCount: numberOrUndefined2(data.row_count) ?? 0,
3299
+ checksum: stringValue(data.checksum) ?? null,
3300
+ metadata: nullableRecord(data.metadata) ?? {},
3301
+ createdAt: stringValue(data.created_at) ?? ""
3302
+ };
3303
+ }
3243
3304
  function diagnosticMessages2(value) {
3244
3305
  if (!Array.isArray(value)) return [];
3245
3306
  return value.map((item) => {
package/dist/cli.js CHANGED
@@ -1853,6 +1853,33 @@ var CampaignBuilderAgent = class {
1853
1853
  }
1854
1854
  return result;
1855
1855
  }
1856
+ async getBuildStatus(campaignBuildId) {
1857
+ return this.getCampaignBuildStatus(campaignBuildId);
1858
+ }
1859
+ async getBuildRows(campaignBuildId, options = {}) {
1860
+ const filters = compact({
1861
+ segment: options.segment,
1862
+ qualified: options.qualified,
1863
+ row_status: options.rowStatus
1864
+ });
1865
+ const args = compact({
1866
+ campaign_build_id: campaignBuildId,
1867
+ page_size: options.limit,
1868
+ cursor: options.cursor
1869
+ });
1870
+ if (Object.keys(filters).length > 0) args.filters = filters;
1871
+ const data = await this.callMcp("get_campaign_build_rows", args);
1872
+ return mapAgentCampaignRowsResult(data);
1873
+ }
1874
+ async listBuildArtifacts(campaignBuildId) {
1875
+ const data = await this.callMcp("list_campaign_build_artifacts", {
1876
+ campaign_build_id: campaignBuildId
1877
+ });
1878
+ return Array.isArray(data.artifacts) ? data.artifacts.map(mapAgentCampaignArtifact) : [];
1879
+ }
1880
+ async approveDelivery(campaignBuildId, destinationType, options) {
1881
+ return this.approveCampaignDelivery(campaignBuildId, destinationType, options);
1882
+ }
1856
1883
  async getCampaignBuildStatus(campaignBuildId) {
1857
1884
  const data = await this.callMcp("get_campaign_build_status", {
1858
1885
  campaign_build_id: campaignBuildId
@@ -3246,6 +3273,40 @@ function mapAgentCampaignBuildStatus(data) {
3246
3273
  completedAt: stringValue(data.completed_at) ?? null
3247
3274
  };
3248
3275
  }
3276
+ function mapAgentCampaignRowsResult(data) {
3277
+ const rows = Array.isArray(data.rows) ? data.rows : [];
3278
+ return {
3279
+ campaignBuildId: stringValue(data.campaign_build_id) ?? "",
3280
+ rows: rows.map((row, index) => {
3281
+ const record = asRecord(row);
3282
+ return {
3283
+ index: numberOrUndefined2(record.index) ?? index,
3284
+ status: stringValue(record.status) ?? stringValue(record.row_status) ?? "unknown",
3285
+ qualified: record.qualified !== false,
3286
+ segment: stringValue(record.segment) ?? null,
3287
+ data: nullableRecord(record.data) ?? record
3288
+ };
3289
+ }),
3290
+ count: numberOrUndefined2(data.count) ?? rows.length,
3291
+ pageSize: numberOrUndefined2(data.page_size) ?? rows.length,
3292
+ nextCursor: stringValue(data.next_cursor) ?? null,
3293
+ hasMore: data.has_more === true
3294
+ };
3295
+ }
3296
+ function mapAgentCampaignArtifact(data) {
3297
+ return {
3298
+ id: stringValue(data.id) ?? "",
3299
+ campaignBuildId: stringValue(data.campaign_build_id) ?? "",
3300
+ artifactType: stringValue(data.artifact_type) ?? "",
3301
+ destination: stringValue(data.destination) ?? "",
3302
+ storagePath: stringValue(data.storage_path) ?? "",
3303
+ signedUrl: stringValue(data.signed_url) ?? null,
3304
+ rowCount: numberOrUndefined2(data.row_count) ?? 0,
3305
+ checksum: stringValue(data.checksum) ?? null,
3306
+ metadata: nullableRecord(data.metadata) ?? {},
3307
+ createdAt: stringValue(data.created_at) ?? ""
3308
+ };
3309
+ }
3249
3310
  function diagnosticMessages2(value) {
3250
3311
  if (!Array.isArray(value)) return [];
3251
3312
  return value.map((item) => {
@@ -6619,6 +6680,10 @@ async function handleCampaignAgentCommand(signaliz, argv) {
6619
6680
  }
6620
6681
  return;
6621
6682
  }
6683
+ if (["status", "rows", "artifacts", "approve", "approve-delivery"].includes(subcommand)) {
6684
+ await handleCampaignAgentReviewCommand(signaliz, subcommand, argv.slice(1));
6685
+ return;
6686
+ }
6622
6687
  if (!["plan", "proof", "smoke", "commit-plan", "dry-run", "build-approved", "launch-approved"].includes(subcommand)) {
6623
6688
  printCampaignAgentHelp();
6624
6689
  return;
@@ -6718,6 +6783,68 @@ async function handleCampaignAgentCommand(signaliz, argv) {
6718
6783
  printCampaignAgentPlan(plan);
6719
6784
  }
6720
6785
  }
6786
+ async function handleCampaignAgentReviewCommand(signaliz, subcommand, argv) {
6787
+ const flags = parseFlags(argv);
6788
+ const buildId = argv[0] && !argv[0].startsWith("--") ? argv[0] : stringFlag(flags, "campaign-build-id", "build-id");
6789
+ if (!buildId) throw new Error(`campaign-agent ${subcommand} requires <campaign_build_id> or --campaign-build-id`);
6790
+ if (subcommand === "status") {
6791
+ const status = await signaliz.campaignBuilderAgent.getBuildStatus(buildId);
6792
+ if (booleanFlag(flags, "json")) {
6793
+ printJson(status);
6794
+ } else {
6795
+ printCampaignAgentBuildStatus(status);
6796
+ }
6797
+ return;
6798
+ }
6799
+ if (subcommand === "rows") {
6800
+ const result2 = await signaliz.campaignBuilderAgent.getBuildRows(buildId, {
6801
+ limit: numberFlag(flags, "limit"),
6802
+ cursor: stringFlag(flags, "cursor"),
6803
+ segment: stringFlag(flags, "segment"),
6804
+ rowStatus: stringFlag(flags, "row-status"),
6805
+ qualified: booleanFlag(flags, "qualified") ? true : booleanFlag(flags, "disqualified") ? false : void 0
6806
+ });
6807
+ const operatorResult = {
6808
+ ...result2,
6809
+ rows: formatCampaignAgentRows(result2.rows)
6810
+ };
6811
+ if (booleanFlag(flags, "json")) {
6812
+ printJson(operatorResult);
6813
+ } else {
6814
+ printCampaignAgentRows(operatorResult);
6815
+ }
6816
+ return;
6817
+ }
6818
+ if (subcommand === "artifacts") {
6819
+ const artifacts = await signaliz.campaignBuilderAgent.listBuildArtifacts(buildId);
6820
+ if (booleanFlag(flags, "json")) {
6821
+ printJson(artifacts);
6822
+ } else if (artifacts.length === 0) {
6823
+ console.log("No artifacts yet.");
6824
+ console.log(`Next: signaliz campaign-agent status ${buildId}`);
6825
+ } else {
6826
+ for (const artifact of artifacts) {
6827
+ console.log(`${artifact.artifactType || "artifact"}: ${artifact.rowCount} rows${artifact.signedUrl ? `
6828
+ ${artifact.signedUrl}` : ""}`);
6829
+ }
6830
+ }
6831
+ return;
6832
+ }
6833
+ const destinationType = stringFlag(flags, "destination-type", "delivery-destination-type", "type");
6834
+ if (!destinationType || !["json", "csv", "webhook"].includes(destinationType)) {
6835
+ throw new Error("campaign-agent approve requires --destination-type json|csv|webhook");
6836
+ }
6837
+ const result = await signaliz.campaignBuilderAgent.approveDelivery(buildId, destinationType, {
6838
+ destinationId: stringFlag(flags, "destination-id", "delivery-destination-id"),
6839
+ destinationConfig: jsonObjectFlag(flags, "destination-config", "delivery-config")
6840
+ });
6841
+ if (booleanFlag(flags, "json")) {
6842
+ printJson(result);
6843
+ } else {
6844
+ console.log(`Delivery ${result.status}: ${result.destinationType}`);
6845
+ if (result.message) console.log(result.message);
6846
+ }
6847
+ }
6721
6848
  function campaignAgentRequestTemplateFromFlags(flags) {
6722
6849
  const goal = stringFlag(flags, "goal", "brief") || "Build a strategy-template campaign for mature operators in the target ICP.";
6723
6850
  const request = campaignAgentRequestFromFlags(goal, flags, { includeDefaults: true });
@@ -7054,6 +7181,59 @@ function printCampaignAgentExecution(payload, flags) {
7054
7181
  console.log("\nResult:");
7055
7182
  printJson(payload.result);
7056
7183
  }
7184
+ function printCampaignAgentBuildStatus(status) {
7185
+ console.log(`Campaign: ${status.name || status.campaignBuildId}`);
7186
+ if (status.campaignId) console.log(`Campaign ID: ${status.campaignId}`);
7187
+ console.log(`Status: ${status.status}`);
7188
+ console.log(`Phase: ${status.currentPhase || "N/A"}`);
7189
+ console.log(`Rows: ${status.recordsSucceeded}/${status.recordsTotal} succeeded, ${status.recordsFailed} failed`);
7190
+ console.log(`Artifacts: ${status.artifactCount}`);
7191
+ if (status.triggerRunId) console.log(`Trigger: ${status.triggerRunId}`);
7192
+ if (Array.isArray(status.warnings) && status.warnings.length > 0) {
7193
+ console.log(`Warnings: ${status.warnings.slice(0, 3).join("; ")}`);
7194
+ }
7195
+ if (Array.isArray(status.errors) && status.errors.length > 0) {
7196
+ console.log(`Errors: ${status.errors.slice(0, 3).join("; ")}`);
7197
+ }
7198
+ if (status.status === "completed") {
7199
+ console.log(`Next: signaliz campaign-agent rows ${status.campaignBuildId} --limit 100`);
7200
+ } else if (status.status === "pending_approval") {
7201
+ console.log(`Next: signaliz campaign-agent approve ${status.campaignBuildId} --destination-type webhook`);
7202
+ }
7203
+ }
7204
+ function formatCampaignAgentRows(rows) {
7205
+ return rows.map((row) => {
7206
+ const data = asRecord4(row.data);
7207
+ const fallbackName = `${data.first_name || ""} ${data.last_name || ""}`.trim() || null;
7208
+ return {
7209
+ ...row,
7210
+ email: data.email ?? null,
7211
+ name: data.full_name ?? fallbackName,
7212
+ title: data.title ?? null,
7213
+ company: data.company_name ?? null,
7214
+ domain: data.company_domain ?? null,
7215
+ score: data.overall_score ?? null,
7216
+ has_copy: Boolean(data.subject || data.opener || data.body || data.cta || asRecord4(data.raw_copy).subject)
7217
+ };
7218
+ });
7219
+ }
7220
+ function printCampaignAgentRows(result) {
7221
+ if (!Array.isArray(result.rows) || result.rows.length === 0) {
7222
+ console.log("No rows found.");
7223
+ return;
7224
+ }
7225
+ console.table(result.rows.map((row) => ({
7226
+ email: row.email || "",
7227
+ name: row.name || "",
7228
+ title: row.title || "",
7229
+ company: row.company || row.domain || "",
7230
+ status: row.status || "",
7231
+ segment: row.segment || "",
7232
+ score: row.score ?? ""
7233
+ })));
7234
+ console.log(`Showing ${result.rows.length} row(s)${result.hasMore ? " (more available)" : ""}`);
7235
+ if (result.nextCursor) console.log(`Next: signaliz campaign-agent rows ${result.campaignBuildId} --cursor ${result.nextCursor}`);
7236
+ }
7057
7237
  function asRecord4(value) {
7058
7238
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
7059
7239
  }
@@ -7230,6 +7410,8 @@ Usage:
7230
7410
  signaliz campaign-agent dry-run --goal "Build a strategy-template campaign..." --target-count 500 --use-local-leads --json
7231
7411
  signaliz campaign-agent build-approved --goal "Build a strategy-template campaign..." --confirm-launch --approve-all --approved-by you@example.com --spend-limit 500
7232
7412
  signaliz campaign-agent build-approved --request-file campaign-request.json --confirm-launch --approve-all --approved-by you@example.com --spend-limit 500 --wait --approve-delivery --delivery-destination-type json
7413
+ signaliz campaign-agent status <campaign_build_id> --json
7414
+ signaliz campaign-agent rows <campaign_build_id> --limit 100 --json
7233
7415
 
7234
7416
  Environment:
7235
7417
  SIGNALIZ_API_KEY Your API key (not required for campaign-agent init)
@@ -7261,8 +7443,12 @@ Signaliz campaign-agent commands:
7261
7443
  signaliz campaign-agent commit-plan (--goal TEXT | --request-file FILE) [--confirm-write --approved-by EMAIL] [--idempotency-key KEY] [--json]
7262
7444
  signaliz campaign-agent dry-run (--goal TEXT | --request-file FILE) [--gtm-campaign-id ID] [--delivery-risk JSON] [--idempotency-key KEY] [--json]
7263
7445
  signaliz campaign-agent build-approved (--goal TEXT | --request-file FILE) --confirm-launch --approved-by EMAIL (--approve-all | --approved-types a,b) [--commit-before-launch] [--spend-limit N] [--approved-route-ids a,b] [--wait] [--approve-delivery] [--delivery-destination-type json|csv|webhook] [--idempotency-key KEY] [--json]
7446
+ signaliz campaign-agent status <campaign_build_id> [--json]
7447
+ signaliz campaign-agent rows <campaign_build_id> [--limit N] [--cursor CURSOR] [--qualified|--disqualified] [--json]
7448
+ signaliz campaign-agent artifacts <campaign_build_id> [--json]
7449
+ signaliz campaign-agent approve <campaign_build_id> --destination-type json|csv|webhook [--destination-config JSON] [--json]
7264
7450
 
7265
- The init command emits a reusable JSON CampaignBuilderAgentRequest. The plan command composes an approval-gated strategy-template MCP flow. Proof runs the same plan path plus build_campaign dry_run=true and returns a no-spend receipt. Use --request-file to load a reusable request, then override fields such as --target-count or --strategy-template from the command line. Use --strategy-template to merge a private-safe strategy pattern into the plan without exposing private account labels, and --operating-playbooks to add reusable build-loop gates such as proof-first vertical qualification, net-new suppression, cache-first inventory, and signal-led copy approval. Built-ins map to Signaliz-native tools: lead_generation -> generate_leads, local_leads -> generate_local_leads, email_finding -> find_and_verify_emails, email_verification -> verify_emails, signals -> enrich_company_signals. Add BYO tools with --custom-tool provider:layer:tool[:mcp] or key=value pairs such as provider=apollo,layer=source,tool=apollo_search,mcp=apollo. Use --no-strategy-patterns or --no-workflow-patterns to disable default private strategy memory hints. Commit-plan dry-runs by default and writes only with --confirm-write plus approval identity. Dry-run executes build_campaign with dry_run=true. Approved build requires explicit launch confirmation and approval metadata; add --commit-before-launch to persist the reviewed plan as a GTM campaign before launch, --wait to poll until completion or pending approval, and --approve-delivery to approve reviewed JSON/CSV/webhook delivery after pending_approval.
7451
+ The init command emits a reusable JSON CampaignBuilderAgentRequest. The plan command composes an approval-gated strategy-template MCP flow. Proof runs the same plan path plus build_campaign dry_run=true and returns a no-spend receipt. Use --request-file to load a reusable request, then override fields such as --target-count or --strategy-template from the command line. Use --strategy-template to merge a private-safe strategy pattern into the plan without exposing private account labels, and --operating-playbooks to add reusable build-loop gates such as proof-first vertical qualification, net-new suppression, cache-first inventory, and signal-led copy approval. Built-ins map to Signaliz-native tools: lead_generation -> generate_leads, local_leads -> generate_local_leads, email_finding -> find_and_verify_emails, email_verification -> verify_emails, signals -> enrich_company_signals. Add BYO tools with --custom-tool provider:layer:tool[:mcp] or key=value pairs such as provider=apollo,layer=source,tool=apollo_search,mcp=apollo. Use --no-strategy-patterns or --no-workflow-patterns to disable default private strategy memory hints. Commit-plan dry-runs by default and writes only with --confirm-write plus approval identity. Dry-run executes build_campaign with dry_run=true. Approved build requires explicit launch confirmation and approval metadata; add --commit-before-launch to persist the reviewed plan as a GTM campaign before launch, --wait to poll until completion or pending approval, and --approve-delivery to approve reviewed webhook delivery after pending_approval. Use status, rows, and artifacts to inspect the finished campaign-agent build before routing rows to external tools.
7266
7452
  `);
7267
7453
  }
7268
7454
  main().catch((e) => {
package/dist/cli.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Signaliz,
4
4
  createCampaignBuilderAgentRequestTemplate,
5
5
  createCampaignBuilderApproval
6
- } from "./chunk-2EXN3RAX.mjs";
6
+ } from "./chunk-QQW6DZQ4.mjs";
7
7
 
8
8
  // src/cli.ts
9
9
  import { readFileSync, writeFileSync } from "fs";
@@ -379,6 +379,10 @@ async function handleCampaignAgentCommand(signaliz, argv) {
379
379
  }
380
380
  return;
381
381
  }
382
+ if (["status", "rows", "artifacts", "approve", "approve-delivery"].includes(subcommand)) {
383
+ await handleCampaignAgentReviewCommand(signaliz, subcommand, argv.slice(1));
384
+ return;
385
+ }
382
386
  if (!["plan", "proof", "smoke", "commit-plan", "dry-run", "build-approved", "launch-approved"].includes(subcommand)) {
383
387
  printCampaignAgentHelp();
384
388
  return;
@@ -478,6 +482,68 @@ async function handleCampaignAgentCommand(signaliz, argv) {
478
482
  printCampaignAgentPlan(plan);
479
483
  }
480
484
  }
485
+ async function handleCampaignAgentReviewCommand(signaliz, subcommand, argv) {
486
+ const flags = parseFlags(argv);
487
+ const buildId = argv[0] && !argv[0].startsWith("--") ? argv[0] : stringFlag(flags, "campaign-build-id", "build-id");
488
+ if (!buildId) throw new Error(`campaign-agent ${subcommand} requires <campaign_build_id> or --campaign-build-id`);
489
+ if (subcommand === "status") {
490
+ const status = await signaliz.campaignBuilderAgent.getBuildStatus(buildId);
491
+ if (booleanFlag(flags, "json")) {
492
+ printJson(status);
493
+ } else {
494
+ printCampaignAgentBuildStatus(status);
495
+ }
496
+ return;
497
+ }
498
+ if (subcommand === "rows") {
499
+ const result2 = await signaliz.campaignBuilderAgent.getBuildRows(buildId, {
500
+ limit: numberFlag(flags, "limit"),
501
+ cursor: stringFlag(flags, "cursor"),
502
+ segment: stringFlag(flags, "segment"),
503
+ rowStatus: stringFlag(flags, "row-status"),
504
+ qualified: booleanFlag(flags, "qualified") ? true : booleanFlag(flags, "disqualified") ? false : void 0
505
+ });
506
+ const operatorResult = {
507
+ ...result2,
508
+ rows: formatCampaignAgentRows(result2.rows)
509
+ };
510
+ if (booleanFlag(flags, "json")) {
511
+ printJson(operatorResult);
512
+ } else {
513
+ printCampaignAgentRows(operatorResult);
514
+ }
515
+ return;
516
+ }
517
+ if (subcommand === "artifacts") {
518
+ const artifacts = await signaliz.campaignBuilderAgent.listBuildArtifacts(buildId);
519
+ if (booleanFlag(flags, "json")) {
520
+ printJson(artifacts);
521
+ } else if (artifacts.length === 0) {
522
+ console.log("No artifacts yet.");
523
+ console.log(`Next: signaliz campaign-agent status ${buildId}`);
524
+ } else {
525
+ for (const artifact of artifacts) {
526
+ console.log(`${artifact.artifactType || "artifact"}: ${artifact.rowCount} rows${artifact.signedUrl ? `
527
+ ${artifact.signedUrl}` : ""}`);
528
+ }
529
+ }
530
+ return;
531
+ }
532
+ const destinationType = stringFlag(flags, "destination-type", "delivery-destination-type", "type");
533
+ if (!destinationType || !["json", "csv", "webhook"].includes(destinationType)) {
534
+ throw new Error("campaign-agent approve requires --destination-type json|csv|webhook");
535
+ }
536
+ const result = await signaliz.campaignBuilderAgent.approveDelivery(buildId, destinationType, {
537
+ destinationId: stringFlag(flags, "destination-id", "delivery-destination-id"),
538
+ destinationConfig: jsonObjectFlag(flags, "destination-config", "delivery-config")
539
+ });
540
+ if (booleanFlag(flags, "json")) {
541
+ printJson(result);
542
+ } else {
543
+ console.log(`Delivery ${result.status}: ${result.destinationType}`);
544
+ if (result.message) console.log(result.message);
545
+ }
546
+ }
481
547
  function campaignAgentRequestTemplateFromFlags(flags) {
482
548
  const goal = stringFlag(flags, "goal", "brief") || "Build a strategy-template campaign for mature operators in the target ICP.";
483
549
  const request = campaignAgentRequestFromFlags(goal, flags, { includeDefaults: true });
@@ -814,6 +880,59 @@ function printCampaignAgentExecution(payload, flags) {
814
880
  console.log("\nResult:");
815
881
  printJson(payload.result);
816
882
  }
883
+ function printCampaignAgentBuildStatus(status) {
884
+ console.log(`Campaign: ${status.name || status.campaignBuildId}`);
885
+ if (status.campaignId) console.log(`Campaign ID: ${status.campaignId}`);
886
+ console.log(`Status: ${status.status}`);
887
+ console.log(`Phase: ${status.currentPhase || "N/A"}`);
888
+ console.log(`Rows: ${status.recordsSucceeded}/${status.recordsTotal} succeeded, ${status.recordsFailed} failed`);
889
+ console.log(`Artifacts: ${status.artifactCount}`);
890
+ if (status.triggerRunId) console.log(`Trigger: ${status.triggerRunId}`);
891
+ if (Array.isArray(status.warnings) && status.warnings.length > 0) {
892
+ console.log(`Warnings: ${status.warnings.slice(0, 3).join("; ")}`);
893
+ }
894
+ if (Array.isArray(status.errors) && status.errors.length > 0) {
895
+ console.log(`Errors: ${status.errors.slice(0, 3).join("; ")}`);
896
+ }
897
+ if (status.status === "completed") {
898
+ console.log(`Next: signaliz campaign-agent rows ${status.campaignBuildId} --limit 100`);
899
+ } else if (status.status === "pending_approval") {
900
+ console.log(`Next: signaliz campaign-agent approve ${status.campaignBuildId} --destination-type webhook`);
901
+ }
902
+ }
903
+ function formatCampaignAgentRows(rows) {
904
+ return rows.map((row) => {
905
+ const data = asRecord(row.data);
906
+ const fallbackName = `${data.first_name || ""} ${data.last_name || ""}`.trim() || null;
907
+ return {
908
+ ...row,
909
+ email: data.email ?? null,
910
+ name: data.full_name ?? fallbackName,
911
+ title: data.title ?? null,
912
+ company: data.company_name ?? null,
913
+ domain: data.company_domain ?? null,
914
+ score: data.overall_score ?? null,
915
+ has_copy: Boolean(data.subject || data.opener || data.body || data.cta || asRecord(data.raw_copy).subject)
916
+ };
917
+ });
918
+ }
919
+ function printCampaignAgentRows(result) {
920
+ if (!Array.isArray(result.rows) || result.rows.length === 0) {
921
+ console.log("No rows found.");
922
+ return;
923
+ }
924
+ console.table(result.rows.map((row) => ({
925
+ email: row.email || "",
926
+ name: row.name || "",
927
+ title: row.title || "",
928
+ company: row.company || row.domain || "",
929
+ status: row.status || "",
930
+ segment: row.segment || "",
931
+ score: row.score ?? ""
932
+ })));
933
+ console.log(`Showing ${result.rows.length} row(s)${result.hasMore ? " (more available)" : ""}`);
934
+ if (result.nextCursor) console.log(`Next: signaliz campaign-agent rows ${result.campaignBuildId} --cursor ${result.nextCursor}`);
935
+ }
817
936
  function asRecord(value) {
818
937
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
819
938
  }
@@ -990,6 +1109,8 @@ Usage:
990
1109
  signaliz campaign-agent dry-run --goal "Build a strategy-template campaign..." --target-count 500 --use-local-leads --json
991
1110
  signaliz campaign-agent build-approved --goal "Build a strategy-template campaign..." --confirm-launch --approve-all --approved-by you@example.com --spend-limit 500
992
1111
  signaliz campaign-agent build-approved --request-file campaign-request.json --confirm-launch --approve-all --approved-by you@example.com --spend-limit 500 --wait --approve-delivery --delivery-destination-type json
1112
+ signaliz campaign-agent status <campaign_build_id> --json
1113
+ signaliz campaign-agent rows <campaign_build_id> --limit 100 --json
993
1114
 
994
1115
  Environment:
995
1116
  SIGNALIZ_API_KEY Your API key (not required for campaign-agent init)
@@ -1021,8 +1142,12 @@ Signaliz campaign-agent commands:
1021
1142
  signaliz campaign-agent commit-plan (--goal TEXT | --request-file FILE) [--confirm-write --approved-by EMAIL] [--idempotency-key KEY] [--json]
1022
1143
  signaliz campaign-agent dry-run (--goal TEXT | --request-file FILE) [--gtm-campaign-id ID] [--delivery-risk JSON] [--idempotency-key KEY] [--json]
1023
1144
  signaliz campaign-agent build-approved (--goal TEXT | --request-file FILE) --confirm-launch --approved-by EMAIL (--approve-all | --approved-types a,b) [--commit-before-launch] [--spend-limit N] [--approved-route-ids a,b] [--wait] [--approve-delivery] [--delivery-destination-type json|csv|webhook] [--idempotency-key KEY] [--json]
1145
+ signaliz campaign-agent status <campaign_build_id> [--json]
1146
+ signaliz campaign-agent rows <campaign_build_id> [--limit N] [--cursor CURSOR] [--qualified|--disqualified] [--json]
1147
+ signaliz campaign-agent artifacts <campaign_build_id> [--json]
1148
+ signaliz campaign-agent approve <campaign_build_id> --destination-type json|csv|webhook [--destination-config JSON] [--json]
1024
1149
 
1025
- The init command emits a reusable JSON CampaignBuilderAgentRequest. The plan command composes an approval-gated strategy-template MCP flow. Proof runs the same plan path plus build_campaign dry_run=true and returns a no-spend receipt. Use --request-file to load a reusable request, then override fields such as --target-count or --strategy-template from the command line. Use --strategy-template to merge a private-safe strategy pattern into the plan without exposing private account labels, and --operating-playbooks to add reusable build-loop gates such as proof-first vertical qualification, net-new suppression, cache-first inventory, and signal-led copy approval. Built-ins map to Signaliz-native tools: lead_generation -> generate_leads, local_leads -> generate_local_leads, email_finding -> find_and_verify_emails, email_verification -> verify_emails, signals -> enrich_company_signals. Add BYO tools with --custom-tool provider:layer:tool[:mcp] or key=value pairs such as provider=apollo,layer=source,tool=apollo_search,mcp=apollo. Use --no-strategy-patterns or --no-workflow-patterns to disable default private strategy memory hints. Commit-plan dry-runs by default and writes only with --confirm-write plus approval identity. Dry-run executes build_campaign with dry_run=true. Approved build requires explicit launch confirmation and approval metadata; add --commit-before-launch to persist the reviewed plan as a GTM campaign before launch, --wait to poll until completion or pending approval, and --approve-delivery to approve reviewed JSON/CSV/webhook delivery after pending_approval.
1150
+ The init command emits a reusable JSON CampaignBuilderAgentRequest. The plan command composes an approval-gated strategy-template MCP flow. Proof runs the same plan path plus build_campaign dry_run=true and returns a no-spend receipt. Use --request-file to load a reusable request, then override fields such as --target-count or --strategy-template from the command line. Use --strategy-template to merge a private-safe strategy pattern into the plan without exposing private account labels, and --operating-playbooks to add reusable build-loop gates such as proof-first vertical qualification, net-new suppression, cache-first inventory, and signal-led copy approval. Built-ins map to Signaliz-native tools: lead_generation -> generate_leads, local_leads -> generate_local_leads, email_finding -> find_and_verify_emails, email_verification -> verify_emails, signals -> enrich_company_signals. Add BYO tools with --custom-tool provider:layer:tool[:mcp] or key=value pairs such as provider=apollo,layer=source,tool=apollo_search,mcp=apollo. Use --no-strategy-patterns or --no-workflow-patterns to disable default private strategy memory hints. Commit-plan dry-runs by default and writes only with --confirm-write plus approval identity. Dry-run executes build_campaign with dry_run=true. Approved build requires explicit launch confirmation and approval metadata; add --commit-before-launch to persist the reviewed plan as a GTM campaign before launch, --wait to poll until completion or pending approval, and --approve-delivery to approve reviewed webhook delivery after pending_approval. Use status, rows, and artifacts to inspect the finished campaign-agent build before routing rows to external tools.
1026
1151
  `);
1027
1152
  }
1028
1153
  main().catch((e) => {
package/dist/index.d.mts CHANGED
@@ -1107,6 +1107,13 @@ declare class CampaignBuilderAgent {
1107
1107
  dryRunPlan(plan: CampaignBuilderAgentPlan, options?: BuildOptions): Promise<CampaignBuildResult>;
1108
1108
  buildApprovedPlan(plan: CampaignBuilderAgentPlan, approval: CampaignBuilderApproval, options?: CampaignBuilderBuildOptions): Promise<CampaignBuildResult>;
1109
1109
  runApprovedPlan(plan: CampaignBuilderAgentPlan, approval: CampaignBuilderApproval, options?: CampaignBuilderApprovedRunOptions): Promise<CampaignBuilderApprovedRunResult>;
1110
+ getBuildStatus(campaignBuildId: string): Promise<CampaignBuildStatus>;
1111
+ getBuildRows(campaignBuildId: string, options?: CampaignRowsOptions): Promise<CampaignRowsResult>;
1112
+ listBuildArtifacts(campaignBuildId: string): Promise<CampaignArtifact[]>;
1113
+ approveDelivery(campaignBuildId: string, destinationType: CampaignDeliveryMode, options?: {
1114
+ destinationId?: string;
1115
+ destinationConfig?: UnknownRecord$1;
1116
+ }): Promise<ApproveDeliveryResult>;
1110
1117
  private getCampaignBuildStatus;
1111
1118
  private waitForCampaignBuildStatus;
1112
1119
  private approveCampaignDelivery;
package/dist/index.d.ts CHANGED
@@ -1107,6 +1107,13 @@ declare class CampaignBuilderAgent {
1107
1107
  dryRunPlan(plan: CampaignBuilderAgentPlan, options?: BuildOptions): Promise<CampaignBuildResult>;
1108
1108
  buildApprovedPlan(plan: CampaignBuilderAgentPlan, approval: CampaignBuilderApproval, options?: CampaignBuilderBuildOptions): Promise<CampaignBuildResult>;
1109
1109
  runApprovedPlan(plan: CampaignBuilderAgentPlan, approval: CampaignBuilderApproval, options?: CampaignBuilderApprovedRunOptions): Promise<CampaignBuilderApprovedRunResult>;
1110
+ getBuildStatus(campaignBuildId: string): Promise<CampaignBuildStatus>;
1111
+ getBuildRows(campaignBuildId: string, options?: CampaignRowsOptions): Promise<CampaignRowsResult>;
1112
+ listBuildArtifacts(campaignBuildId: string): Promise<CampaignArtifact[]>;
1113
+ approveDelivery(campaignBuildId: string, destinationType: CampaignDeliveryMode, options?: {
1114
+ destinationId?: string;
1115
+ destinationConfig?: UnknownRecord$1;
1116
+ }): Promise<ApproveDeliveryResult>;
1110
1117
  private getCampaignBuildStatus;
1111
1118
  private waitForCampaignBuildStatus;
1112
1119
  private approveCampaignDelivery;
package/dist/index.js CHANGED
@@ -1896,6 +1896,33 @@ var CampaignBuilderAgent = class {
1896
1896
  }
1897
1897
  return result;
1898
1898
  }
1899
+ async getBuildStatus(campaignBuildId) {
1900
+ return this.getCampaignBuildStatus(campaignBuildId);
1901
+ }
1902
+ async getBuildRows(campaignBuildId, options = {}) {
1903
+ const filters = compact({
1904
+ segment: options.segment,
1905
+ qualified: options.qualified,
1906
+ row_status: options.rowStatus
1907
+ });
1908
+ const args = compact({
1909
+ campaign_build_id: campaignBuildId,
1910
+ page_size: options.limit,
1911
+ cursor: options.cursor
1912
+ });
1913
+ if (Object.keys(filters).length > 0) args.filters = filters;
1914
+ const data = await this.callMcp("get_campaign_build_rows", args);
1915
+ return mapAgentCampaignRowsResult(data);
1916
+ }
1917
+ async listBuildArtifacts(campaignBuildId) {
1918
+ const data = await this.callMcp("list_campaign_build_artifacts", {
1919
+ campaign_build_id: campaignBuildId
1920
+ });
1921
+ return Array.isArray(data.artifacts) ? data.artifacts.map(mapAgentCampaignArtifact) : [];
1922
+ }
1923
+ async approveDelivery(campaignBuildId, destinationType, options) {
1924
+ return this.approveCampaignDelivery(campaignBuildId, destinationType, options);
1925
+ }
1899
1926
  async getCampaignBuildStatus(campaignBuildId) {
1900
1927
  const data = await this.callMcp("get_campaign_build_status", {
1901
1928
  campaign_build_id: campaignBuildId
@@ -3289,6 +3316,40 @@ function mapAgentCampaignBuildStatus(data) {
3289
3316
  completedAt: stringValue(data.completed_at) ?? null
3290
3317
  };
3291
3318
  }
3319
+ function mapAgentCampaignRowsResult(data) {
3320
+ const rows = Array.isArray(data.rows) ? data.rows : [];
3321
+ return {
3322
+ campaignBuildId: stringValue(data.campaign_build_id) ?? "",
3323
+ rows: rows.map((row, index) => {
3324
+ const record = asRecord(row);
3325
+ return {
3326
+ index: numberOrUndefined2(record.index) ?? index,
3327
+ status: stringValue(record.status) ?? stringValue(record.row_status) ?? "unknown",
3328
+ qualified: record.qualified !== false,
3329
+ segment: stringValue(record.segment) ?? null,
3330
+ data: nullableRecord(record.data) ?? record
3331
+ };
3332
+ }),
3333
+ count: numberOrUndefined2(data.count) ?? rows.length,
3334
+ pageSize: numberOrUndefined2(data.page_size) ?? rows.length,
3335
+ nextCursor: stringValue(data.next_cursor) ?? null,
3336
+ hasMore: data.has_more === true
3337
+ };
3338
+ }
3339
+ function mapAgentCampaignArtifact(data) {
3340
+ return {
3341
+ id: stringValue(data.id) ?? "",
3342
+ campaignBuildId: stringValue(data.campaign_build_id) ?? "",
3343
+ artifactType: stringValue(data.artifact_type) ?? "",
3344
+ destination: stringValue(data.destination) ?? "",
3345
+ storagePath: stringValue(data.storage_path) ?? "",
3346
+ signedUrl: stringValue(data.signed_url) ?? null,
3347
+ rowCount: numberOrUndefined2(data.row_count) ?? 0,
3348
+ checksum: stringValue(data.checksum) ?? null,
3349
+ metadata: nullableRecord(data.metadata) ?? {},
3350
+ createdAt: stringValue(data.created_at) ?? ""
3351
+ };
3352
+ }
3292
3353
  function diagnosticMessages2(value) {
3293
3354
  if (!Array.isArray(value)) return [];
3294
3355
  return value.map((item) => {
package/dist/index.mjs CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  getCampaignBuilderStrategyTemplate,
24
24
  getMissingCampaignBuilderApprovals,
25
25
  normalizeExecutionReference
26
- } from "./chunk-2EXN3RAX.mjs";
26
+ } from "./chunk-QQW6DZQ4.mjs";
27
27
  export {
28
28
  Ai,
29
29
  CAMPAIGN_BUILDER_OPERATING_PLAYBOOKS,
@@ -1870,6 +1870,33 @@ var CampaignBuilderAgent = class {
1870
1870
  }
1871
1871
  return result;
1872
1872
  }
1873
+ async getBuildStatus(campaignBuildId) {
1874
+ return this.getCampaignBuildStatus(campaignBuildId);
1875
+ }
1876
+ async getBuildRows(campaignBuildId, options = {}) {
1877
+ const filters = compact({
1878
+ segment: options.segment,
1879
+ qualified: options.qualified,
1880
+ row_status: options.rowStatus
1881
+ });
1882
+ const args = compact({
1883
+ campaign_build_id: campaignBuildId,
1884
+ page_size: options.limit,
1885
+ cursor: options.cursor
1886
+ });
1887
+ if (Object.keys(filters).length > 0) args.filters = filters;
1888
+ const data = await this.callMcp("get_campaign_build_rows", args);
1889
+ return mapAgentCampaignRowsResult(data);
1890
+ }
1891
+ async listBuildArtifacts(campaignBuildId) {
1892
+ const data = await this.callMcp("list_campaign_build_artifacts", {
1893
+ campaign_build_id: campaignBuildId
1894
+ });
1895
+ return Array.isArray(data.artifacts) ? data.artifacts.map(mapAgentCampaignArtifact) : [];
1896
+ }
1897
+ async approveDelivery(campaignBuildId, destinationType, options) {
1898
+ return this.approveCampaignDelivery(campaignBuildId, destinationType, options);
1899
+ }
1873
1900
  async getCampaignBuildStatus(campaignBuildId) {
1874
1901
  const data = await this.callMcp("get_campaign_build_status", {
1875
1902
  campaign_build_id: campaignBuildId
@@ -3162,6 +3189,40 @@ function mapAgentCampaignBuildStatus(data) {
3162
3189
  completedAt: stringValue(data.completed_at) ?? null
3163
3190
  };
3164
3191
  }
3192
+ function mapAgentCampaignRowsResult(data) {
3193
+ const rows = Array.isArray(data.rows) ? data.rows : [];
3194
+ return {
3195
+ campaignBuildId: stringValue(data.campaign_build_id) ?? "",
3196
+ rows: rows.map((row, index) => {
3197
+ const record = asRecord(row);
3198
+ return {
3199
+ index: numberOrUndefined2(record.index) ?? index,
3200
+ status: stringValue(record.status) ?? stringValue(record.row_status) ?? "unknown",
3201
+ qualified: record.qualified !== false,
3202
+ segment: stringValue(record.segment) ?? null,
3203
+ data: nullableRecord(record.data) ?? record
3204
+ };
3205
+ }),
3206
+ count: numberOrUndefined2(data.count) ?? rows.length,
3207
+ pageSize: numberOrUndefined2(data.page_size) ?? rows.length,
3208
+ nextCursor: stringValue(data.next_cursor) ?? null,
3209
+ hasMore: data.has_more === true
3210
+ };
3211
+ }
3212
+ function mapAgentCampaignArtifact(data) {
3213
+ return {
3214
+ id: stringValue(data.id) ?? "",
3215
+ campaignBuildId: stringValue(data.campaign_build_id) ?? "",
3216
+ artifactType: stringValue(data.artifact_type) ?? "",
3217
+ destination: stringValue(data.destination) ?? "",
3218
+ storagePath: stringValue(data.storage_path) ?? "",
3219
+ signedUrl: stringValue(data.signed_url) ?? null,
3220
+ rowCount: numberOrUndefined2(data.row_count) ?? 0,
3221
+ checksum: stringValue(data.checksum) ?? null,
3222
+ metadata: nullableRecord(data.metadata) ?? {},
3223
+ createdAt: stringValue(data.created_at) ?? ""
3224
+ };
3225
+ }
3165
3226
  function diagnosticMessages2(value) {
3166
3227
  if (!Array.isArray(value)) return [];
3167
3228
  return value.map((item) => {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Signaliz
4
- } from "./chunk-2EXN3RAX.mjs";
4
+ } from "./chunk-QQW6DZQ4.mjs";
5
5
 
6
6
  // src/mcp-config.ts
7
7
  import * as fs from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signaliz/sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Signaliz SDK — GTM Kernel, Nango routes, MCP, and enrichment for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",