@signaliz/sdk 1.0.9 → 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 +11 -0
- package/dist/{chunk-EQZJFFS7.mjs → chunk-QQW6DZQ4.mjs} +62 -4
- package/dist/cli.js +188 -5
- package/dist/cli.mjs +127 -2
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +62 -4
- package/dist/index.mjs +1 -1
- package/dist/mcp-config.js +62 -4
- package/dist/mcp-config.mjs +1 -1
- package/package.json +1 -1
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
|
|
@@ -1832,10 +1832,7 @@ var CampaignBuilderAgent = class {
|
|
|
1832
1832
|
["completed", "failed", "canceled", "pending_approval"]
|
|
1833
1833
|
);
|
|
1834
1834
|
const result = { build, finalStatus };
|
|
1835
|
-
if (options.approveDelivery === true) {
|
|
1836
|
-
if (finalStatus.status !== "pending_approval") {
|
|
1837
|
-
throw new Error(`Campaign build ${campaignBuildId} reached ${finalStatus.status}; delivery approval was not available`);
|
|
1838
|
-
}
|
|
1835
|
+
if (options.approveDelivery === true && finalStatus.status === "pending_approval") {
|
|
1839
1836
|
const destinationType = options.deliveryDestinationType ?? plan.buildRequest.delivery?.destinationType ?? "json";
|
|
1840
1837
|
result.deliveryApproval = await this.approveCampaignDelivery(campaignBuildId, destinationType, {
|
|
1841
1838
|
destinationId: options.deliveryDestinationId,
|
|
@@ -1850,6 +1847,33 @@ var CampaignBuilderAgent = class {
|
|
|
1850
1847
|
}
|
|
1851
1848
|
return result;
|
|
1852
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
|
+
}
|
|
1853
1877
|
async getCampaignBuildStatus(campaignBuildId) {
|
|
1854
1878
|
const data = await this.callMcp("get_campaign_build_status", {
|
|
1855
1879
|
campaign_build_id: campaignBuildId
|
|
@@ -3243,6 +3267,40 @@ function mapAgentCampaignBuildStatus(data) {
|
|
|
3243
3267
|
completedAt: stringValue(data.completed_at) ?? null
|
|
3244
3268
|
};
|
|
3245
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
|
+
}
|
|
3246
3304
|
function diagnosticMessages2(value) {
|
|
3247
3305
|
if (!Array.isArray(value)) return [];
|
|
3248
3306
|
return value.map((item) => {
|
package/dist/cli.js
CHANGED
|
@@ -1838,10 +1838,7 @@ var CampaignBuilderAgent = class {
|
|
|
1838
1838
|
["completed", "failed", "canceled", "pending_approval"]
|
|
1839
1839
|
);
|
|
1840
1840
|
const result = { build, finalStatus };
|
|
1841
|
-
if (options.approveDelivery === true) {
|
|
1842
|
-
if (finalStatus.status !== "pending_approval") {
|
|
1843
|
-
throw new Error(`Campaign build ${campaignBuildId} reached ${finalStatus.status}; delivery approval was not available`);
|
|
1844
|
-
}
|
|
1841
|
+
if (options.approveDelivery === true && finalStatus.status === "pending_approval") {
|
|
1845
1842
|
const destinationType = options.deliveryDestinationType ?? plan.buildRequest.delivery?.destinationType ?? "json";
|
|
1846
1843
|
result.deliveryApproval = await this.approveCampaignDelivery(campaignBuildId, destinationType, {
|
|
1847
1844
|
destinationId: options.deliveryDestinationId,
|
|
@@ -1856,6 +1853,33 @@ var CampaignBuilderAgent = class {
|
|
|
1856
1853
|
}
|
|
1857
1854
|
return result;
|
|
1858
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
|
+
}
|
|
1859
1883
|
async getCampaignBuildStatus(campaignBuildId) {
|
|
1860
1884
|
const data = await this.callMcp("get_campaign_build_status", {
|
|
1861
1885
|
campaign_build_id: campaignBuildId
|
|
@@ -3249,6 +3273,40 @@ function mapAgentCampaignBuildStatus(data) {
|
|
|
3249
3273
|
completedAt: stringValue(data.completed_at) ?? null
|
|
3250
3274
|
};
|
|
3251
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
|
+
}
|
|
3252
3310
|
function diagnosticMessages2(value) {
|
|
3253
3311
|
if (!Array.isArray(value)) return [];
|
|
3254
3312
|
return value.map((item) => {
|
|
@@ -6622,6 +6680,10 @@ async function handleCampaignAgentCommand(signaliz, argv) {
|
|
|
6622
6680
|
}
|
|
6623
6681
|
return;
|
|
6624
6682
|
}
|
|
6683
|
+
if (["status", "rows", "artifacts", "approve", "approve-delivery"].includes(subcommand)) {
|
|
6684
|
+
await handleCampaignAgentReviewCommand(signaliz, subcommand, argv.slice(1));
|
|
6685
|
+
return;
|
|
6686
|
+
}
|
|
6625
6687
|
if (!["plan", "proof", "smoke", "commit-plan", "dry-run", "build-approved", "launch-approved"].includes(subcommand)) {
|
|
6626
6688
|
printCampaignAgentHelp();
|
|
6627
6689
|
return;
|
|
@@ -6721,6 +6783,68 @@ async function handleCampaignAgentCommand(signaliz, argv) {
|
|
|
6721
6783
|
printCampaignAgentPlan(plan);
|
|
6722
6784
|
}
|
|
6723
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
|
+
}
|
|
6724
6848
|
function campaignAgentRequestTemplateFromFlags(flags) {
|
|
6725
6849
|
const goal = stringFlag(flags, "goal", "brief") || "Build a strategy-template campaign for mature operators in the target ICP.";
|
|
6726
6850
|
const request = campaignAgentRequestFromFlags(goal, flags, { includeDefaults: true });
|
|
@@ -7057,6 +7181,59 @@ function printCampaignAgentExecution(payload, flags) {
|
|
|
7057
7181
|
console.log("\nResult:");
|
|
7058
7182
|
printJson(payload.result);
|
|
7059
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
|
+
}
|
|
7060
7237
|
function asRecord4(value) {
|
|
7061
7238
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
7062
7239
|
}
|
|
@@ -7233,6 +7410,8 @@ Usage:
|
|
|
7233
7410
|
signaliz campaign-agent dry-run --goal "Build a strategy-template campaign..." --target-count 500 --use-local-leads --json
|
|
7234
7411
|
signaliz campaign-agent build-approved --goal "Build a strategy-template campaign..." --confirm-launch --approve-all --approved-by you@example.com --spend-limit 500
|
|
7235
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
|
|
7236
7415
|
|
|
7237
7416
|
Environment:
|
|
7238
7417
|
SIGNALIZ_API_KEY Your API key (not required for campaign-agent init)
|
|
@@ -7264,8 +7443,12 @@ Signaliz campaign-agent commands:
|
|
|
7264
7443
|
signaliz campaign-agent commit-plan (--goal TEXT | --request-file FILE) [--confirm-write --approved-by EMAIL] [--idempotency-key KEY] [--json]
|
|
7265
7444
|
signaliz campaign-agent dry-run (--goal TEXT | --request-file FILE) [--gtm-campaign-id ID] [--delivery-risk JSON] [--idempotency-key KEY] [--json]
|
|
7266
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]
|
|
7267
7450
|
|
|
7268
|
-
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
|
|
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.
|
|
7269
7452
|
`);
|
|
7270
7453
|
}
|
|
7271
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-
|
|
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
|
|
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
|
@@ -1881,10 +1881,7 @@ var CampaignBuilderAgent = class {
|
|
|
1881
1881
|
["completed", "failed", "canceled", "pending_approval"]
|
|
1882
1882
|
);
|
|
1883
1883
|
const result = { build, finalStatus };
|
|
1884
|
-
if (options.approveDelivery === true) {
|
|
1885
|
-
if (finalStatus.status !== "pending_approval") {
|
|
1886
|
-
throw new Error(`Campaign build ${campaignBuildId} reached ${finalStatus.status}; delivery approval was not available`);
|
|
1887
|
-
}
|
|
1884
|
+
if (options.approveDelivery === true && finalStatus.status === "pending_approval") {
|
|
1888
1885
|
const destinationType = options.deliveryDestinationType ?? plan.buildRequest.delivery?.destinationType ?? "json";
|
|
1889
1886
|
result.deliveryApproval = await this.approveCampaignDelivery(campaignBuildId, destinationType, {
|
|
1890
1887
|
destinationId: options.deliveryDestinationId,
|
|
@@ -1899,6 +1896,33 @@ var CampaignBuilderAgent = class {
|
|
|
1899
1896
|
}
|
|
1900
1897
|
return result;
|
|
1901
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
|
+
}
|
|
1902
1926
|
async getCampaignBuildStatus(campaignBuildId) {
|
|
1903
1927
|
const data = await this.callMcp("get_campaign_build_status", {
|
|
1904
1928
|
campaign_build_id: campaignBuildId
|
|
@@ -3292,6 +3316,40 @@ function mapAgentCampaignBuildStatus(data) {
|
|
|
3292
3316
|
completedAt: stringValue(data.completed_at) ?? null
|
|
3293
3317
|
};
|
|
3294
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
|
+
}
|
|
3295
3353
|
function diagnosticMessages2(value) {
|
|
3296
3354
|
if (!Array.isArray(value)) return [];
|
|
3297
3355
|
return value.map((item) => {
|
package/dist/index.mjs
CHANGED
package/dist/mcp-config.js
CHANGED
|
@@ -1855,10 +1855,7 @@ var CampaignBuilderAgent = class {
|
|
|
1855
1855
|
["completed", "failed", "canceled", "pending_approval"]
|
|
1856
1856
|
);
|
|
1857
1857
|
const result = { build, finalStatus };
|
|
1858
|
-
if (options.approveDelivery === true) {
|
|
1859
|
-
if (finalStatus.status !== "pending_approval") {
|
|
1860
|
-
throw new Error(`Campaign build ${campaignBuildId} reached ${finalStatus.status}; delivery approval was not available`);
|
|
1861
|
-
}
|
|
1858
|
+
if (options.approveDelivery === true && finalStatus.status === "pending_approval") {
|
|
1862
1859
|
const destinationType = options.deliveryDestinationType ?? plan.buildRequest.delivery?.destinationType ?? "json";
|
|
1863
1860
|
result.deliveryApproval = await this.approveCampaignDelivery(campaignBuildId, destinationType, {
|
|
1864
1861
|
destinationId: options.deliveryDestinationId,
|
|
@@ -1873,6 +1870,33 @@ var CampaignBuilderAgent = class {
|
|
|
1873
1870
|
}
|
|
1874
1871
|
return result;
|
|
1875
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
|
+
}
|
|
1876
1900
|
async getCampaignBuildStatus(campaignBuildId) {
|
|
1877
1901
|
const data = await this.callMcp("get_campaign_build_status", {
|
|
1878
1902
|
campaign_build_id: campaignBuildId
|
|
@@ -3165,6 +3189,40 @@ function mapAgentCampaignBuildStatus(data) {
|
|
|
3165
3189
|
completedAt: stringValue(data.completed_at) ?? null
|
|
3166
3190
|
};
|
|
3167
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
|
+
}
|
|
3168
3226
|
function diagnosticMessages2(value) {
|
|
3169
3227
|
if (!Array.isArray(value)) return [];
|
|
3170
3228
|
return value.map((item) => {
|
package/dist/mcp-config.mjs
CHANGED