@signaliz/sdk 1.0.8 → 1.0.10
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/dist/{chunk-KL6KNOP6.mjs → chunk-2EXN3RAX.mjs} +119 -0
- package/dist/cli.js +137 -3
- package/dist/cli.mjs +19 -4
- package/dist/index.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +119 -0
- package/dist/index.mjs +1 -1
- package/dist/mcp-config.js +119 -0
- package/dist/mcp-config.mjs +1 -1
- package/package.json +1 -1
|
@@ -1815,6 +1815,76 @@ var CampaignBuilderAgent = class {
|
|
|
1815
1815
|
const data = await this.callMcp("build_campaign", args);
|
|
1816
1816
|
return mapBuildResult(data, false);
|
|
1817
1817
|
}
|
|
1818
|
+
async runApprovedPlan(plan, approval, options = {}) {
|
|
1819
|
+
const build = await this.buildApprovedPlan(plan, approval, options);
|
|
1820
|
+
const campaignBuildId = build.campaignBuildId;
|
|
1821
|
+
if (!campaignBuildId) {
|
|
1822
|
+
if (options.wait || options.approveDelivery) {
|
|
1823
|
+
throw new Error("Campaign builder approved run did not return a campaignBuildId to poll");
|
|
1824
|
+
}
|
|
1825
|
+
return { build };
|
|
1826
|
+
}
|
|
1827
|
+
const shouldWait = options.wait === true || options.approveDelivery === true;
|
|
1828
|
+
if (!shouldWait) return { build };
|
|
1829
|
+
let finalStatus = await this.waitForCampaignBuildStatus(
|
|
1830
|
+
campaignBuildId,
|
|
1831
|
+
options,
|
|
1832
|
+
["completed", "failed", "canceled", "pending_approval"]
|
|
1833
|
+
);
|
|
1834
|
+
const result = { build, finalStatus };
|
|
1835
|
+
if (options.approveDelivery === true && finalStatus.status === "pending_approval") {
|
|
1836
|
+
const destinationType = options.deliveryDestinationType ?? plan.buildRequest.delivery?.destinationType ?? "json";
|
|
1837
|
+
result.deliveryApproval = await this.approveCampaignDelivery(campaignBuildId, destinationType, {
|
|
1838
|
+
destinationId: options.deliveryDestinationId,
|
|
1839
|
+
destinationConfig: options.deliveryDestinationConfig ?? plan.buildRequest.delivery?.destinationConfig
|
|
1840
|
+
});
|
|
1841
|
+
finalStatus = await this.waitForCampaignBuildStatus(
|
|
1842
|
+
campaignBuildId,
|
|
1843
|
+
options,
|
|
1844
|
+
["completed", "failed", "canceled"]
|
|
1845
|
+
);
|
|
1846
|
+
result.finalStatus = finalStatus;
|
|
1847
|
+
}
|
|
1848
|
+
return result;
|
|
1849
|
+
}
|
|
1850
|
+
async getCampaignBuildStatus(campaignBuildId) {
|
|
1851
|
+
const data = await this.callMcp("get_campaign_build_status", {
|
|
1852
|
+
campaign_build_id: campaignBuildId
|
|
1853
|
+
});
|
|
1854
|
+
return mapAgentCampaignBuildStatus(data);
|
|
1855
|
+
}
|
|
1856
|
+
async waitForCampaignBuildStatus(campaignBuildId, options, stopStatuses) {
|
|
1857
|
+
const interval = options.waitIntervalMs ?? 5e3;
|
|
1858
|
+
const timeout = options.waitTimeoutMs ?? 6e5;
|
|
1859
|
+
const startedAt = Date.now();
|
|
1860
|
+
while (true) {
|
|
1861
|
+
const status = await this.getCampaignBuildStatus(campaignBuildId);
|
|
1862
|
+
options.onStatus?.(status);
|
|
1863
|
+
if (stopStatuses.includes(status.status)) return status;
|
|
1864
|
+
if (Date.now() - startedAt > timeout) {
|
|
1865
|
+
throw new Error(`Campaign build ${campaignBuildId} timed out after ${timeout}ms (status: ${status.status})`);
|
|
1866
|
+
}
|
|
1867
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
async approveCampaignDelivery(campaignBuildId, destinationType, options) {
|
|
1871
|
+
const args = compact({
|
|
1872
|
+
campaign_build_id: campaignBuildId,
|
|
1873
|
+
destination_type: destinationType,
|
|
1874
|
+
destination_id: options?.destinationId,
|
|
1875
|
+
destination_config: options?.destinationConfig
|
|
1876
|
+
});
|
|
1877
|
+
const data = await this.callMcp("approve_campaign_delivery", args);
|
|
1878
|
+
return {
|
|
1879
|
+
campaignBuildId: data.campaign_build_id,
|
|
1880
|
+
destinationType: data.destination_type ?? destinationType,
|
|
1881
|
+
status: data.status ?? "approved",
|
|
1882
|
+
message: data.message ?? "",
|
|
1883
|
+
deliveryId: data.delivery_id,
|
|
1884
|
+
deliveryIds: data.delivery_ids,
|
|
1885
|
+
approvedCount: data.approved_count
|
|
1886
|
+
};
|
|
1887
|
+
}
|
|
1818
1888
|
async getWorkspaceContext(warnings) {
|
|
1819
1889
|
try {
|
|
1820
1890
|
const workspace = await this.callMcp("get_workspace", {});
|
|
@@ -3142,6 +3212,55 @@ function mapBuildResult(data, dryRun) {
|
|
|
3142
3212
|
providerRoute: mapProviderRoute2(data)
|
|
3143
3213
|
};
|
|
3144
3214
|
}
|
|
3215
|
+
function mapAgentCampaignBuildStatus(data) {
|
|
3216
|
+
return {
|
|
3217
|
+
campaignBuildId: stringValue(data.campaign_build_id) ?? "",
|
|
3218
|
+
campaignId: stringValue(data.campaign_id) ?? null,
|
|
3219
|
+
campaignObject: nullableRecord(data.campaign_object),
|
|
3220
|
+
name: stringValue(data.name) ?? "",
|
|
3221
|
+
status: stringValue(data.status) ?? "unknown",
|
|
3222
|
+
currentPhase: stringValue(data.current_phase) ?? null,
|
|
3223
|
+
currentPhaseStatus: stringValue(data.current_phase_status) ?? null,
|
|
3224
|
+
phases: Array.isArray(data.phases) ? data.phases : [],
|
|
3225
|
+
recordsTotal: numberOrUndefined2(data.records_total) ?? 0,
|
|
3226
|
+
recordsProcessed: numberOrUndefined2(data.records_processed) ?? 0,
|
|
3227
|
+
recordsSucceeded: numberOrUndefined2(data.records_succeeded) ?? 0,
|
|
3228
|
+
recordsFailed: numberOrUndefined2(data.records_failed) ?? 0,
|
|
3229
|
+
warnings: diagnosticMessages2(data.warnings),
|
|
3230
|
+
errors: diagnosticMessages2(data.errors),
|
|
3231
|
+
artifactCount: numberOrUndefined2(data.artifact_count) ?? 0,
|
|
3232
|
+
providerRoute: mapProviderRoute2(data),
|
|
3233
|
+
triggerRunId: stringValue(data.trigger_run_id) ?? null,
|
|
3234
|
+
staleRunningPhase: data.stale_running_phase === true,
|
|
3235
|
+
phaseAgeSeconds: numberOrNull2(data.phase_age_seconds),
|
|
3236
|
+
diagnostics: nullableRecord(data.diagnostics) ?? {},
|
|
3237
|
+
nextAction: formatAgentNextAction(data.next_action),
|
|
3238
|
+
createdAt: stringValue(data.created_at) ?? "",
|
|
3239
|
+
updatedAt: stringValue(data.updated_at) ?? "",
|
|
3240
|
+
completedAt: stringValue(data.completed_at) ?? null
|
|
3241
|
+
};
|
|
3242
|
+
}
|
|
3243
|
+
function diagnosticMessages2(value) {
|
|
3244
|
+
if (!Array.isArray(value)) return [];
|
|
3245
|
+
return value.map((item) => {
|
|
3246
|
+
if (typeof item === "string") return item;
|
|
3247
|
+
const record = nullableRecord(item);
|
|
3248
|
+
return stringValue(record?.message);
|
|
3249
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
3250
|
+
}
|
|
3251
|
+
function formatAgentNextAction(value) {
|
|
3252
|
+
if (!value) return "";
|
|
3253
|
+
if (typeof value === "string") return value;
|
|
3254
|
+
const record = nullableRecord(value);
|
|
3255
|
+
if (!record) return "";
|
|
3256
|
+
const tool = stringValue(record.tool);
|
|
3257
|
+
const type = stringValue(record.type);
|
|
3258
|
+
const reason = stringValue(record.reason);
|
|
3259
|
+
const args = nullableRecord(record.arguments);
|
|
3260
|
+
const argText = args && Object.keys(args).length > 0 ? ` ${JSON.stringify(args)}` : "";
|
|
3261
|
+
const action = tool ? `${tool}${argText}` : type ?? "";
|
|
3262
|
+
return [action, reason].filter(Boolean).join(" - ");
|
|
3263
|
+
}
|
|
3145
3264
|
function mapProviderRoute2(data) {
|
|
3146
3265
|
const brainContext = asRecord(data?.brain_context);
|
|
3147
3266
|
const plan = nullableRecord(data?.provider_route_plan) ?? nullableRecord(brainContext.provider_route_plan);
|
package/dist/cli.js
CHANGED
|
@@ -1821,6 +1821,76 @@ var CampaignBuilderAgent = class {
|
|
|
1821
1821
|
const data = await this.callMcp("build_campaign", args);
|
|
1822
1822
|
return mapBuildResult(data, false);
|
|
1823
1823
|
}
|
|
1824
|
+
async runApprovedPlan(plan, approval, options = {}) {
|
|
1825
|
+
const build = await this.buildApprovedPlan(plan, approval, options);
|
|
1826
|
+
const campaignBuildId = build.campaignBuildId;
|
|
1827
|
+
if (!campaignBuildId) {
|
|
1828
|
+
if (options.wait || options.approveDelivery) {
|
|
1829
|
+
throw new Error("Campaign builder approved run did not return a campaignBuildId to poll");
|
|
1830
|
+
}
|
|
1831
|
+
return { build };
|
|
1832
|
+
}
|
|
1833
|
+
const shouldWait = options.wait === true || options.approveDelivery === true;
|
|
1834
|
+
if (!shouldWait) return { build };
|
|
1835
|
+
let finalStatus = await this.waitForCampaignBuildStatus(
|
|
1836
|
+
campaignBuildId,
|
|
1837
|
+
options,
|
|
1838
|
+
["completed", "failed", "canceled", "pending_approval"]
|
|
1839
|
+
);
|
|
1840
|
+
const result = { build, finalStatus };
|
|
1841
|
+
if (options.approveDelivery === true && finalStatus.status === "pending_approval") {
|
|
1842
|
+
const destinationType = options.deliveryDestinationType ?? plan.buildRequest.delivery?.destinationType ?? "json";
|
|
1843
|
+
result.deliveryApproval = await this.approveCampaignDelivery(campaignBuildId, destinationType, {
|
|
1844
|
+
destinationId: options.deliveryDestinationId,
|
|
1845
|
+
destinationConfig: options.deliveryDestinationConfig ?? plan.buildRequest.delivery?.destinationConfig
|
|
1846
|
+
});
|
|
1847
|
+
finalStatus = await this.waitForCampaignBuildStatus(
|
|
1848
|
+
campaignBuildId,
|
|
1849
|
+
options,
|
|
1850
|
+
["completed", "failed", "canceled"]
|
|
1851
|
+
);
|
|
1852
|
+
result.finalStatus = finalStatus;
|
|
1853
|
+
}
|
|
1854
|
+
return result;
|
|
1855
|
+
}
|
|
1856
|
+
async getCampaignBuildStatus(campaignBuildId) {
|
|
1857
|
+
const data = await this.callMcp("get_campaign_build_status", {
|
|
1858
|
+
campaign_build_id: campaignBuildId
|
|
1859
|
+
});
|
|
1860
|
+
return mapAgentCampaignBuildStatus(data);
|
|
1861
|
+
}
|
|
1862
|
+
async waitForCampaignBuildStatus(campaignBuildId, options, stopStatuses) {
|
|
1863
|
+
const interval = options.waitIntervalMs ?? 5e3;
|
|
1864
|
+
const timeout = options.waitTimeoutMs ?? 6e5;
|
|
1865
|
+
const startedAt = Date.now();
|
|
1866
|
+
while (true) {
|
|
1867
|
+
const status = await this.getCampaignBuildStatus(campaignBuildId);
|
|
1868
|
+
options.onStatus?.(status);
|
|
1869
|
+
if (stopStatuses.includes(status.status)) return status;
|
|
1870
|
+
if (Date.now() - startedAt > timeout) {
|
|
1871
|
+
throw new Error(`Campaign build ${campaignBuildId} timed out after ${timeout}ms (status: ${status.status})`);
|
|
1872
|
+
}
|
|
1873
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
async approveCampaignDelivery(campaignBuildId, destinationType, options) {
|
|
1877
|
+
const args = compact({
|
|
1878
|
+
campaign_build_id: campaignBuildId,
|
|
1879
|
+
destination_type: destinationType,
|
|
1880
|
+
destination_id: options?.destinationId,
|
|
1881
|
+
destination_config: options?.destinationConfig
|
|
1882
|
+
});
|
|
1883
|
+
const data = await this.callMcp("approve_campaign_delivery", args);
|
|
1884
|
+
return {
|
|
1885
|
+
campaignBuildId: data.campaign_build_id,
|
|
1886
|
+
destinationType: data.destination_type ?? destinationType,
|
|
1887
|
+
status: data.status ?? "approved",
|
|
1888
|
+
message: data.message ?? "",
|
|
1889
|
+
deliveryId: data.delivery_id,
|
|
1890
|
+
deliveryIds: data.delivery_ids,
|
|
1891
|
+
approvedCount: data.approved_count
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1824
1894
|
async getWorkspaceContext(warnings) {
|
|
1825
1895
|
try {
|
|
1826
1896
|
const workspace = await this.callMcp("get_workspace", {});
|
|
@@ -3148,6 +3218,55 @@ function mapBuildResult(data, dryRun) {
|
|
|
3148
3218
|
providerRoute: mapProviderRoute2(data)
|
|
3149
3219
|
};
|
|
3150
3220
|
}
|
|
3221
|
+
function mapAgentCampaignBuildStatus(data) {
|
|
3222
|
+
return {
|
|
3223
|
+
campaignBuildId: stringValue(data.campaign_build_id) ?? "",
|
|
3224
|
+
campaignId: stringValue(data.campaign_id) ?? null,
|
|
3225
|
+
campaignObject: nullableRecord(data.campaign_object),
|
|
3226
|
+
name: stringValue(data.name) ?? "",
|
|
3227
|
+
status: stringValue(data.status) ?? "unknown",
|
|
3228
|
+
currentPhase: stringValue(data.current_phase) ?? null,
|
|
3229
|
+
currentPhaseStatus: stringValue(data.current_phase_status) ?? null,
|
|
3230
|
+
phases: Array.isArray(data.phases) ? data.phases : [],
|
|
3231
|
+
recordsTotal: numberOrUndefined2(data.records_total) ?? 0,
|
|
3232
|
+
recordsProcessed: numberOrUndefined2(data.records_processed) ?? 0,
|
|
3233
|
+
recordsSucceeded: numberOrUndefined2(data.records_succeeded) ?? 0,
|
|
3234
|
+
recordsFailed: numberOrUndefined2(data.records_failed) ?? 0,
|
|
3235
|
+
warnings: diagnosticMessages2(data.warnings),
|
|
3236
|
+
errors: diagnosticMessages2(data.errors),
|
|
3237
|
+
artifactCount: numberOrUndefined2(data.artifact_count) ?? 0,
|
|
3238
|
+
providerRoute: mapProviderRoute2(data),
|
|
3239
|
+
triggerRunId: stringValue(data.trigger_run_id) ?? null,
|
|
3240
|
+
staleRunningPhase: data.stale_running_phase === true,
|
|
3241
|
+
phaseAgeSeconds: numberOrNull2(data.phase_age_seconds),
|
|
3242
|
+
diagnostics: nullableRecord(data.diagnostics) ?? {},
|
|
3243
|
+
nextAction: formatAgentNextAction(data.next_action),
|
|
3244
|
+
createdAt: stringValue(data.created_at) ?? "",
|
|
3245
|
+
updatedAt: stringValue(data.updated_at) ?? "",
|
|
3246
|
+
completedAt: stringValue(data.completed_at) ?? null
|
|
3247
|
+
};
|
|
3248
|
+
}
|
|
3249
|
+
function diagnosticMessages2(value) {
|
|
3250
|
+
if (!Array.isArray(value)) return [];
|
|
3251
|
+
return value.map((item) => {
|
|
3252
|
+
if (typeof item === "string") return item;
|
|
3253
|
+
const record = nullableRecord(item);
|
|
3254
|
+
return stringValue(record?.message);
|
|
3255
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
3256
|
+
}
|
|
3257
|
+
function formatAgentNextAction(value) {
|
|
3258
|
+
if (!value) return "";
|
|
3259
|
+
if (typeof value === "string") return value;
|
|
3260
|
+
const record = nullableRecord(value);
|
|
3261
|
+
if (!record) return "";
|
|
3262
|
+
const tool = stringValue(record.tool);
|
|
3263
|
+
const type = stringValue(record.type);
|
|
3264
|
+
const reason = stringValue(record.reason);
|
|
3265
|
+
const args = nullableRecord(record.arguments);
|
|
3266
|
+
const argText = args && Object.keys(args).length > 0 ? ` ${JSON.stringify(args)}` : "";
|
|
3267
|
+
const action = tool ? `${tool}${argText}` : type ?? "";
|
|
3268
|
+
return [action, reason].filter(Boolean).join(" - ");
|
|
3269
|
+
}
|
|
3151
3270
|
function mapProviderRoute2(data) {
|
|
3152
3271
|
const brainContext = asRecord(data?.brain_context);
|
|
3153
3272
|
const plan = nullableRecord(data?.provider_route_plan) ?? nullableRecord(brainContext.provider_route_plan);
|
|
@@ -6572,7 +6691,21 @@ async function handleCampaignAgentCommand(signaliz, argv) {
|
|
|
6572
6691
|
approvedRouteIds: approvedRouteIdsFromFlags(plan, flags),
|
|
6573
6692
|
notes: stringFlag(flags, "approval-notes", "notes")
|
|
6574
6693
|
});
|
|
6575
|
-
const
|
|
6694
|
+
const runApproved = booleanFlag(flags, "wait") || booleanFlag(flags, "approve-delivery");
|
|
6695
|
+
const result = runApproved ? await signaliz.campaignBuilderAgent.runApprovedPlan(plan, approval, {
|
|
6696
|
+
idempotencyKey: stringFlag(flags, "idempotency-key"),
|
|
6697
|
+
commitBeforeLaunch: booleanFlag(flags, "commit-before-launch"),
|
|
6698
|
+
wait: booleanFlag(flags, "wait"),
|
|
6699
|
+
approveDelivery: booleanFlag(flags, "approve-delivery"),
|
|
6700
|
+
deliveryDestinationType: stringFlag(flags, "delivery-destination-type", "destination-type"),
|
|
6701
|
+
deliveryDestinationId: stringFlag(flags, "delivery-destination-id", "destination-id"),
|
|
6702
|
+
deliveryDestinationConfig: jsonObjectFlag(flags, "delivery-config", "destination-config"),
|
|
6703
|
+
waitIntervalMs: numberFlag(flags, "wait-interval-ms"),
|
|
6704
|
+
waitTimeoutMs: numberFlag(flags, "wait-timeout-ms"),
|
|
6705
|
+
onStatus: booleanFlag(flags, "json") ? void 0 : (status) => {
|
|
6706
|
+
console.error(`campaign-agent build-approved: ${status.status} phase=${status.currentPhase ?? "N/A"} rows=${status.recordsSucceeded}/${status.recordsTotal} artifacts=${status.artifactCount}`);
|
|
6707
|
+
}
|
|
6708
|
+
}) : await signaliz.campaignBuilderAgent.buildApprovedPlan(plan, approval, {
|
|
6576
6709
|
idempotencyKey: stringFlag(flags, "idempotency-key"),
|
|
6577
6710
|
commitBeforeLaunch: booleanFlag(flags, "commit-before-launch")
|
|
6578
6711
|
});
|
|
@@ -7096,6 +7229,7 @@ Usage:
|
|
|
7096
7229
|
signaliz campaign-agent commit-plan --goal "Build a strategy-template campaign..." --json
|
|
7097
7230
|
signaliz campaign-agent dry-run --goal "Build a strategy-template campaign..." --target-count 500 --use-local-leads --json
|
|
7098
7231
|
signaliz campaign-agent build-approved --goal "Build a strategy-template campaign..." --confirm-launch --approve-all --approved-by you@example.com --spend-limit 500
|
|
7232
|
+
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
|
|
7099
7233
|
|
|
7100
7234
|
Environment:
|
|
7101
7235
|
SIGNALIZ_API_KEY Your API key (not required for campaign-agent init)
|
|
@@ -7126,9 +7260,9 @@ Signaliz campaign-agent commands:
|
|
|
7126
7260
|
signaliz campaign-agent proof (--goal TEXT | --request-file FILE) [--strategy-template ID] [--target-count N] [--use-local-leads] [--custom-tool provider:layer:tool[:mcp]] [--idempotency-key KEY] [--json]
|
|
7127
7261
|
signaliz campaign-agent commit-plan (--goal TEXT | --request-file FILE) [--confirm-write --approved-by EMAIL] [--idempotency-key KEY] [--json]
|
|
7128
7262
|
signaliz campaign-agent dry-run (--goal TEXT | --request-file FILE) [--gtm-campaign-id ID] [--delivery-risk JSON] [--idempotency-key KEY] [--json]
|
|
7129
|
-
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] [--idempotency-key KEY] [--json]
|
|
7263
|
+
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]
|
|
7130
7264
|
|
|
7131
|
-
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.
|
|
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.
|
|
7132
7266
|
`);
|
|
7133
7267
|
}
|
|
7134
7268
|
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-2EXN3RAX.mjs";
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
9
|
import { readFileSync, writeFileSync } from "fs";
|
|
@@ -451,7 +451,21 @@ async function handleCampaignAgentCommand(signaliz, argv) {
|
|
|
451
451
|
approvedRouteIds: approvedRouteIdsFromFlags(plan, flags),
|
|
452
452
|
notes: stringFlag(flags, "approval-notes", "notes")
|
|
453
453
|
});
|
|
454
|
-
const
|
|
454
|
+
const runApproved = booleanFlag(flags, "wait") || booleanFlag(flags, "approve-delivery");
|
|
455
|
+
const result = runApproved ? await signaliz.campaignBuilderAgent.runApprovedPlan(plan, approval, {
|
|
456
|
+
idempotencyKey: stringFlag(flags, "idempotency-key"),
|
|
457
|
+
commitBeforeLaunch: booleanFlag(flags, "commit-before-launch"),
|
|
458
|
+
wait: booleanFlag(flags, "wait"),
|
|
459
|
+
approveDelivery: booleanFlag(flags, "approve-delivery"),
|
|
460
|
+
deliveryDestinationType: stringFlag(flags, "delivery-destination-type", "destination-type"),
|
|
461
|
+
deliveryDestinationId: stringFlag(flags, "delivery-destination-id", "destination-id"),
|
|
462
|
+
deliveryDestinationConfig: jsonObjectFlag(flags, "delivery-config", "destination-config"),
|
|
463
|
+
waitIntervalMs: numberFlag(flags, "wait-interval-ms"),
|
|
464
|
+
waitTimeoutMs: numberFlag(flags, "wait-timeout-ms"),
|
|
465
|
+
onStatus: booleanFlag(flags, "json") ? void 0 : (status) => {
|
|
466
|
+
console.error(`campaign-agent build-approved: ${status.status} phase=${status.currentPhase ?? "N/A"} rows=${status.recordsSucceeded}/${status.recordsTotal} artifacts=${status.artifactCount}`);
|
|
467
|
+
}
|
|
468
|
+
}) : await signaliz.campaignBuilderAgent.buildApprovedPlan(plan, approval, {
|
|
455
469
|
idempotencyKey: stringFlag(flags, "idempotency-key"),
|
|
456
470
|
commitBeforeLaunch: booleanFlag(flags, "commit-before-launch")
|
|
457
471
|
});
|
|
@@ -975,6 +989,7 @@ Usage:
|
|
|
975
989
|
signaliz campaign-agent commit-plan --goal "Build a strategy-template campaign..." --json
|
|
976
990
|
signaliz campaign-agent dry-run --goal "Build a strategy-template campaign..." --target-count 500 --use-local-leads --json
|
|
977
991
|
signaliz campaign-agent build-approved --goal "Build a strategy-template campaign..." --confirm-launch --approve-all --approved-by you@example.com --spend-limit 500
|
|
992
|
+
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
|
|
978
993
|
|
|
979
994
|
Environment:
|
|
980
995
|
SIGNALIZ_API_KEY Your API key (not required for campaign-agent init)
|
|
@@ -1005,9 +1020,9 @@ Signaliz campaign-agent commands:
|
|
|
1005
1020
|
signaliz campaign-agent proof (--goal TEXT | --request-file FILE) [--strategy-template ID] [--target-count N] [--use-local-leads] [--custom-tool provider:layer:tool[:mcp]] [--idempotency-key KEY] [--json]
|
|
1006
1021
|
signaliz campaign-agent commit-plan (--goal TEXT | --request-file FILE) [--confirm-write --approved-by EMAIL] [--idempotency-key KEY] [--json]
|
|
1007
1022
|
signaliz campaign-agent dry-run (--goal TEXT | --request-file FILE) [--gtm-campaign-id ID] [--delivery-risk JSON] [--idempotency-key KEY] [--json]
|
|
1008
|
-
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] [--idempotency-key KEY] [--json]
|
|
1023
|
+
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]
|
|
1009
1024
|
|
|
1010
|
-
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.
|
|
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.
|
|
1011
1026
|
`);
|
|
1012
1027
|
}
|
|
1013
1028
|
main().catch((e) => {
|
package/dist/index.d.mts
CHANGED
|
@@ -1079,6 +1079,21 @@ interface CampaignBuilderPlanCommitResult {
|
|
|
1079
1079
|
type CampaignBuilderBuildOptions = BuildOptions & {
|
|
1080
1080
|
commitBeforeLaunch?: boolean;
|
|
1081
1081
|
};
|
|
1082
|
+
type CampaignBuilderApprovedRunOptions = CampaignBuilderBuildOptions & {
|
|
1083
|
+
wait?: boolean;
|
|
1084
|
+
approveDelivery?: boolean;
|
|
1085
|
+
deliveryDestinationType?: CampaignDeliveryMode;
|
|
1086
|
+
deliveryDestinationId?: string;
|
|
1087
|
+
deliveryDestinationConfig?: UnknownRecord$1;
|
|
1088
|
+
waitIntervalMs?: number;
|
|
1089
|
+
waitTimeoutMs?: number;
|
|
1090
|
+
onStatus?: (status: CampaignBuildStatus) => void;
|
|
1091
|
+
};
|
|
1092
|
+
interface CampaignBuilderApprovedRunResult {
|
|
1093
|
+
build: CampaignBuildResult;
|
|
1094
|
+
finalStatus?: CampaignBuildStatus;
|
|
1095
|
+
deliveryApproval?: ApproveDeliveryResult;
|
|
1096
|
+
}
|
|
1082
1097
|
declare const DEFAULT_SIGNALIZ_CAMPAIGN_BUILDER_DEFAULTS: Required<Pick<SignalizCampaignBuilderDefaults, 'requireVerifiedEmail' | 'dedupKeys' | 'allowDownscale'>> & SignalizCampaignBuilderDefaults;
|
|
1083
1098
|
declare const DEFAULT_CAMPAIGN_BUILDER_BUILT_INS: CampaignBuilderBuiltInTool[];
|
|
1084
1099
|
declare const DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES: CampaignBuilderApprovalType[];
|
|
@@ -1091,6 +1106,10 @@ declare class CampaignBuilderAgent {
|
|
|
1091
1106
|
commitPlan(plan: CampaignBuilderAgentPlan, options?: CampaignBuilderPlanCommitOptions): Promise<CampaignBuilderPlanCommitResult>;
|
|
1092
1107
|
dryRunPlan(plan: CampaignBuilderAgentPlan, options?: BuildOptions): Promise<CampaignBuildResult>;
|
|
1093
1108
|
buildApprovedPlan(plan: CampaignBuilderAgentPlan, approval: CampaignBuilderApproval, options?: CampaignBuilderBuildOptions): Promise<CampaignBuildResult>;
|
|
1109
|
+
runApprovedPlan(plan: CampaignBuilderAgentPlan, approval: CampaignBuilderApproval, options?: CampaignBuilderApprovedRunOptions): Promise<CampaignBuilderApprovedRunResult>;
|
|
1110
|
+
private getCampaignBuildStatus;
|
|
1111
|
+
private waitForCampaignBuildStatus;
|
|
1112
|
+
private approveCampaignDelivery;
|
|
1094
1113
|
private getWorkspaceContext;
|
|
1095
1114
|
private scopeCampaign;
|
|
1096
1115
|
private discoverPlannedRoutes;
|
|
@@ -3365,4 +3384,4 @@ declare class Signaliz {
|
|
|
3365
3384
|
discover(query: string, category?: string): Promise<MCPToolInfo[]>;
|
|
3366
3385
|
}
|
|
3367
3386
|
|
|
3368
|
-
export { Ai, type ApproveDeliveryResult, type BuildOptions, CAMPAIGN_BUILDER_OPERATING_PLAYBOOKS, CAMPAIGN_BUILDER_STRATEGY_TEMPLATES, type CampaignArtifact, type CampaignBuildRequest$1 as CampaignBuildRequest, type CampaignBuildResult$1 as CampaignBuildResult, type CampaignBuildRow, type CampaignBuildStatus, CampaignBuilderAgent, type CampaignBuilderAgentPlan, type CampaignBuilderAgentProvider, type CampaignBuilderAgentRequest, type CampaignBuilderAgentRequestTemplateOptions, type CampaignBuilderApproval, type CampaignBuilderApprovalPolicy, type CampaignBuilderApprovalType, type CampaignBuilderBuildOptions, type CampaignBuilderBuiltInTool, type CampaignBuilderCustomerTool, type CampaignBuilderGtmLayer, type CampaignBuilderIntegrationRoute, type CampaignBuilderLayer, type CampaignBuilderMcpStep, type CampaignBuilderMemoryPlan, type CampaignBuilderMemoryQuery, type CampaignBuilderMemoryScope, type CampaignBuilderOperatingPlaybook, type CampaignBuilderOperatingPlaybookSlug, type CampaignBuilderPlanCommitOptions, type CampaignBuilderPlanCommitResult, type CampaignBuilderPlanOptions, type CampaignBuilderProvider, type CampaignBuilderRequiredApproval, type CampaignBuilderRouteMode, type CampaignBuilderStrategyTemplate, type CampaignBuilderStrategyTemplateSlug, type CampaignBuilderWorkspaceContext, type CampaignDeliveryMode, type CampaignProviderRouteReadback, type CampaignRowsOptions, type CampaignRowsResult, Campaigns, type CancelBuildResult, type CompanyIntelligenceParams, type CompanyIntelligenceResult, type CreateOutputSinkRequest, type CreateRoutineRequest, type CreateSystemParams, type CustomAiAttachment, type CustomAiFusionConfig, type CustomAiMultiModelParams, type CustomAiMultiModelResult, type CustomAiOutputField, DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES, DEFAULT_CAMPAIGN_BUILDER_BUILT_INS, DEFAULT_SIGNALIZ_CAMPAIGN_BUILDER_DEFAULTS, type EmailBatchJobResult, type EnrichSignalsParams, type EnrichSignalsResult, type ErrorType, type ExecutionReference, type ExecutionReferenceInput, type ExecutionReferenceKind, type FindAndVerifyEmailContact, type FindEmailParams, type FindEmailResult, type GenerateLeadsParams, type GenerateLocalLeadsParams, type GtmActorType, type GtmAuthStrategy, type GtmBrainAggregateCalibrationsInput, type GtmBrainAggregatePatternsInput, type GtmBrainCalibrateDeliverabilityInput, type GtmBrainDeliveryRiskInput, type GtmBrainDistillRunInput, type GtmBrainExtractPatternsInput, type GtmBrainFailurePatternsOptions, type GtmBrainLearningAction, type GtmBrainLearningCyclePhase, type GtmBrainLearningCyclePlanInput, type GtmBrainLearningCyclePlanResult, type GtmBrainLearningCycleRunInput, type GtmBrainLearningEvidenceCounts, type GtmBrainLearningLane, type GtmBrainLearningLaneId, type GtmBrainLearningLaneState, type GtmBrainLearningLaneSummary, type GtmBrainLearningPhaseReadiness, type GtmBrainLearningPhaseStatus, type GtmBrainLearningRecommendedToolCall, type GtmBrainPatternsOptions, type GtmBrainSeedDefaultsInput, type GtmCalibrationDimensionType, type GtmCampaignAgentPlanInput, type GtmCampaignAgentRequestTemplateInput, type GtmCampaignBuildPlanInput, type GtmCampaignCreateInput, type GtmCampaignGetOptions, type GtmCampaignHistoryCampaignInput, type GtmCampaignHistoryImportBatchInput, type GtmCampaignHistoryImportInput, type GtmCampaignHistoryImportRunInput, type GtmCampaignHistoryMemoryInput, type GtmCampaignLearningStatusResult, type GtmCampaignListOptions, type GtmCampaignLogInput, type GtmCampaignSource, type GtmCampaignStartContextInput, type GtmCampaignStatus, type GtmCampaignStrategyMemoryStatusInput, type GtmCampaignStrategyTemplateSlug, type GtmCampaignStrategyTemplatesOptions, type GtmCampaignUpdateInput, type GtmConnectionRegisterInput, type GtmConnectionsListOptions, type GtmExistingCampaignAuditBoundary, type GtmExistingCampaignAuditBySearchOptions, type GtmExistingCampaignAuditOptions, type GtmExistingCampaignAuditRecommendation, type GtmExistingCampaignAuditResult, type GtmExistingCampaignCompletenessStep, type GtmExistingCampaignDiscoverOptions, type GtmExistingCampaignDiscoveryResult, type GtmExistingCampaignMcpRequest, type GtmExistingCampaignOption, type GtmFeedbackIngestInput, type GtmIntegrationRecipeCreateInput, type GtmInvocationType, GtmKernel, type GtmKernelImportPreviewInput, type GtmKernelImportRunInput, type GtmLayer, type GtmLayerRouteSetInput, type GtmLayerRoutesGetOptions, type GtmMemorySearchOptions, type GtmMemoryType, type GtmPatternType, type GtmProviderLinkInput, type GtmProviderRecipePrepareInput, type GtmProviderRouteActivateInput, type GtmWebhookDeliverInput, type GtmWorkspaceBootstrapStatusOptions, type GtmWorkspaceContextOptions, type HttpRequestParams, type HttpRequestResult, type IcpDetail, type IcpSummary, Icps, type ImportOctaveResult, type LeadGenJobResult, type ListOutputSinksOptions, type MCPToolInfo, type NativeGtmCapabilityInfo, Ops, type OpsApproveRequest, type OpsApproveResult, type OpsBlueprint, type OpsCadence, type OpsCreateRequest, type OpsCreateResult, type OpsDashboardOptions, type OpsDashboardResult, type OpsDebugDiagnosticError, type OpsDebugOptions, type OpsDebugResult, type OpsPlanRequest, type OpsPlanResult, type OpsPrimitive, type OpsPrimitiveConcurrencyPolicy, type OpsPrimitiveDeadLetterPolicy, type OpsPrimitiveObservabilityPolicy, type OpsPrimitivePermissionLevel, type OpsPrimitiveRetryPolicy, type OpsPrimitiveWorkspaceScope, type OpsQueueStatus, type OpsQueueStatusOptions, type OpsQuickstartStep, type OpsQuickstartWorkflow, type OpsReadinessCheck, type OpsReadinessOptions, type OpsReadinessResult, type OpsReplayResult, type OpsResultsOptions, type OpsResultsResult, type OpsRoutine, type OpsRoutineDeleteResult, type OpsRoutineRunResult, type OpsRoutineSinkResult, type OpsRoutineStatus, type OpsRoutineTick, type OpsRoutineTickItem, type OpsRoutineTickItemsResult, type OpsRoutineTicksResult, type OpsRoutinesResult, type OpsRunOptions, type OpsRunResult, type OpsSink, type OpsSinkType, type OpsStatusOptions, type OpsStatusResult, type OpsTriggerBatchRunStatus, type OpsTriggerRunStatus, type OpsTriggerRunStatusOptions, type PlatformHealth, type RunNativeGtmCapabilityParams, type RunProgressEvent, type RunResult, type RunRoutineRequest, type RunSystemParams, type Signal, Signaliz, type SignalizCampaignBuilderDefaults, type SignalizConfig, SignalizError, type SignalizErrorData, type SimpleOpStatus, type SystemResult, type UpdateRoutineRequest, type VerifyEmailResult, type WaitOptions, type WorkspaceInfo, applyCampaignBuilderStrategyTemplate, collectExecutionReferences, createCampaignBuilderAgentPlan, createCampaignBuilderAgentRequestTemplate, createCampaignBuilderApproval, createCampaignBuilderToolRoute, getCampaignBuilderOperatingPlaybook, getCampaignBuilderOperatingPlaybooksForRequest, getCampaignBuilderStrategyTemplate, getMissingCampaignBuilderApprovals, normalizeExecutionReference };
|
|
3387
|
+
export { Ai, type ApproveDeliveryResult, type BuildOptions, CAMPAIGN_BUILDER_OPERATING_PLAYBOOKS, CAMPAIGN_BUILDER_STRATEGY_TEMPLATES, type CampaignArtifact, type CampaignBuildRequest$1 as CampaignBuildRequest, type CampaignBuildResult$1 as CampaignBuildResult, type CampaignBuildRow, type CampaignBuildStatus, CampaignBuilderAgent, type CampaignBuilderAgentPlan, type CampaignBuilderAgentProvider, type CampaignBuilderAgentRequest, type CampaignBuilderAgentRequestTemplateOptions, type CampaignBuilderApproval, type CampaignBuilderApprovalPolicy, type CampaignBuilderApprovalType, type CampaignBuilderApprovedRunOptions, type CampaignBuilderApprovedRunResult, type CampaignBuilderBuildOptions, type CampaignBuilderBuiltInTool, type CampaignBuilderCustomerTool, type CampaignBuilderGtmLayer, type CampaignBuilderIntegrationRoute, type CampaignBuilderLayer, type CampaignBuilderMcpStep, type CampaignBuilderMemoryPlan, type CampaignBuilderMemoryQuery, type CampaignBuilderMemoryScope, type CampaignBuilderOperatingPlaybook, type CampaignBuilderOperatingPlaybookSlug, type CampaignBuilderPlanCommitOptions, type CampaignBuilderPlanCommitResult, type CampaignBuilderPlanOptions, type CampaignBuilderProvider, type CampaignBuilderRequiredApproval, type CampaignBuilderRouteMode, type CampaignBuilderStrategyTemplate, type CampaignBuilderStrategyTemplateSlug, type CampaignBuilderWorkspaceContext, type CampaignDeliveryMode, type CampaignProviderRouteReadback, type CampaignRowsOptions, type CampaignRowsResult, Campaigns, type CancelBuildResult, type CompanyIntelligenceParams, type CompanyIntelligenceResult, type CreateOutputSinkRequest, type CreateRoutineRequest, type CreateSystemParams, type CustomAiAttachment, type CustomAiFusionConfig, type CustomAiMultiModelParams, type CustomAiMultiModelResult, type CustomAiOutputField, DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES, DEFAULT_CAMPAIGN_BUILDER_BUILT_INS, DEFAULT_SIGNALIZ_CAMPAIGN_BUILDER_DEFAULTS, type EmailBatchJobResult, type EnrichSignalsParams, type EnrichSignalsResult, type ErrorType, type ExecutionReference, type ExecutionReferenceInput, type ExecutionReferenceKind, type FindAndVerifyEmailContact, type FindEmailParams, type FindEmailResult, type GenerateLeadsParams, type GenerateLocalLeadsParams, type GtmActorType, type GtmAuthStrategy, type GtmBrainAggregateCalibrationsInput, type GtmBrainAggregatePatternsInput, type GtmBrainCalibrateDeliverabilityInput, type GtmBrainDeliveryRiskInput, type GtmBrainDistillRunInput, type GtmBrainExtractPatternsInput, type GtmBrainFailurePatternsOptions, type GtmBrainLearningAction, type GtmBrainLearningCyclePhase, type GtmBrainLearningCyclePlanInput, type GtmBrainLearningCyclePlanResult, type GtmBrainLearningCycleRunInput, type GtmBrainLearningEvidenceCounts, type GtmBrainLearningLane, type GtmBrainLearningLaneId, type GtmBrainLearningLaneState, type GtmBrainLearningLaneSummary, type GtmBrainLearningPhaseReadiness, type GtmBrainLearningPhaseStatus, type GtmBrainLearningRecommendedToolCall, type GtmBrainPatternsOptions, type GtmBrainSeedDefaultsInput, type GtmCalibrationDimensionType, type GtmCampaignAgentPlanInput, type GtmCampaignAgentRequestTemplateInput, type GtmCampaignBuildPlanInput, type GtmCampaignCreateInput, type GtmCampaignGetOptions, type GtmCampaignHistoryCampaignInput, type GtmCampaignHistoryImportBatchInput, type GtmCampaignHistoryImportInput, type GtmCampaignHistoryImportRunInput, type GtmCampaignHistoryMemoryInput, type GtmCampaignLearningStatusResult, type GtmCampaignListOptions, type GtmCampaignLogInput, type GtmCampaignSource, type GtmCampaignStartContextInput, type GtmCampaignStatus, type GtmCampaignStrategyMemoryStatusInput, type GtmCampaignStrategyTemplateSlug, type GtmCampaignStrategyTemplatesOptions, type GtmCampaignUpdateInput, type GtmConnectionRegisterInput, type GtmConnectionsListOptions, type GtmExistingCampaignAuditBoundary, type GtmExistingCampaignAuditBySearchOptions, type GtmExistingCampaignAuditOptions, type GtmExistingCampaignAuditRecommendation, type GtmExistingCampaignAuditResult, type GtmExistingCampaignCompletenessStep, type GtmExistingCampaignDiscoverOptions, type GtmExistingCampaignDiscoveryResult, type GtmExistingCampaignMcpRequest, type GtmExistingCampaignOption, type GtmFeedbackIngestInput, type GtmIntegrationRecipeCreateInput, type GtmInvocationType, GtmKernel, type GtmKernelImportPreviewInput, type GtmKernelImportRunInput, type GtmLayer, type GtmLayerRouteSetInput, type GtmLayerRoutesGetOptions, type GtmMemorySearchOptions, type GtmMemoryType, type GtmPatternType, type GtmProviderLinkInput, type GtmProviderRecipePrepareInput, type GtmProviderRouteActivateInput, type GtmWebhookDeliverInput, type GtmWorkspaceBootstrapStatusOptions, type GtmWorkspaceContextOptions, type HttpRequestParams, type HttpRequestResult, type IcpDetail, type IcpSummary, Icps, type ImportOctaveResult, type LeadGenJobResult, type ListOutputSinksOptions, type MCPToolInfo, type NativeGtmCapabilityInfo, Ops, type OpsApproveRequest, type OpsApproveResult, type OpsBlueprint, type OpsCadence, type OpsCreateRequest, type OpsCreateResult, type OpsDashboardOptions, type OpsDashboardResult, type OpsDebugDiagnosticError, type OpsDebugOptions, type OpsDebugResult, type OpsPlanRequest, type OpsPlanResult, type OpsPrimitive, type OpsPrimitiveConcurrencyPolicy, type OpsPrimitiveDeadLetterPolicy, type OpsPrimitiveObservabilityPolicy, type OpsPrimitivePermissionLevel, type OpsPrimitiveRetryPolicy, type OpsPrimitiveWorkspaceScope, type OpsQueueStatus, type OpsQueueStatusOptions, type OpsQuickstartStep, type OpsQuickstartWorkflow, type OpsReadinessCheck, type OpsReadinessOptions, type OpsReadinessResult, type OpsReplayResult, type OpsResultsOptions, type OpsResultsResult, type OpsRoutine, type OpsRoutineDeleteResult, type OpsRoutineRunResult, type OpsRoutineSinkResult, type OpsRoutineStatus, type OpsRoutineTick, type OpsRoutineTickItem, type OpsRoutineTickItemsResult, type OpsRoutineTicksResult, type OpsRoutinesResult, type OpsRunOptions, type OpsRunResult, type OpsSink, type OpsSinkType, type OpsStatusOptions, type OpsStatusResult, type OpsTriggerBatchRunStatus, type OpsTriggerRunStatus, type OpsTriggerRunStatusOptions, type PlatformHealth, type RunNativeGtmCapabilityParams, type RunProgressEvent, type RunResult, type RunRoutineRequest, type RunSystemParams, type Signal, Signaliz, type SignalizCampaignBuilderDefaults, type SignalizConfig, SignalizError, type SignalizErrorData, type SimpleOpStatus, type SystemResult, type UpdateRoutineRequest, type VerifyEmailResult, type WaitOptions, type WorkspaceInfo, applyCampaignBuilderStrategyTemplate, collectExecutionReferences, createCampaignBuilderAgentPlan, createCampaignBuilderAgentRequestTemplate, createCampaignBuilderApproval, createCampaignBuilderToolRoute, getCampaignBuilderOperatingPlaybook, getCampaignBuilderOperatingPlaybooksForRequest, getCampaignBuilderStrategyTemplate, getMissingCampaignBuilderApprovals, normalizeExecutionReference };
|
package/dist/index.d.ts
CHANGED
|
@@ -1079,6 +1079,21 @@ interface CampaignBuilderPlanCommitResult {
|
|
|
1079
1079
|
type CampaignBuilderBuildOptions = BuildOptions & {
|
|
1080
1080
|
commitBeforeLaunch?: boolean;
|
|
1081
1081
|
};
|
|
1082
|
+
type CampaignBuilderApprovedRunOptions = CampaignBuilderBuildOptions & {
|
|
1083
|
+
wait?: boolean;
|
|
1084
|
+
approveDelivery?: boolean;
|
|
1085
|
+
deliveryDestinationType?: CampaignDeliveryMode;
|
|
1086
|
+
deliveryDestinationId?: string;
|
|
1087
|
+
deliveryDestinationConfig?: UnknownRecord$1;
|
|
1088
|
+
waitIntervalMs?: number;
|
|
1089
|
+
waitTimeoutMs?: number;
|
|
1090
|
+
onStatus?: (status: CampaignBuildStatus) => void;
|
|
1091
|
+
};
|
|
1092
|
+
interface CampaignBuilderApprovedRunResult {
|
|
1093
|
+
build: CampaignBuildResult;
|
|
1094
|
+
finalStatus?: CampaignBuildStatus;
|
|
1095
|
+
deliveryApproval?: ApproveDeliveryResult;
|
|
1096
|
+
}
|
|
1082
1097
|
declare const DEFAULT_SIGNALIZ_CAMPAIGN_BUILDER_DEFAULTS: Required<Pick<SignalizCampaignBuilderDefaults, 'requireVerifiedEmail' | 'dedupKeys' | 'allowDownscale'>> & SignalizCampaignBuilderDefaults;
|
|
1083
1098
|
declare const DEFAULT_CAMPAIGN_BUILDER_BUILT_INS: CampaignBuilderBuiltInTool[];
|
|
1084
1099
|
declare const DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES: CampaignBuilderApprovalType[];
|
|
@@ -1091,6 +1106,10 @@ declare class CampaignBuilderAgent {
|
|
|
1091
1106
|
commitPlan(plan: CampaignBuilderAgentPlan, options?: CampaignBuilderPlanCommitOptions): Promise<CampaignBuilderPlanCommitResult>;
|
|
1092
1107
|
dryRunPlan(plan: CampaignBuilderAgentPlan, options?: BuildOptions): Promise<CampaignBuildResult>;
|
|
1093
1108
|
buildApprovedPlan(plan: CampaignBuilderAgentPlan, approval: CampaignBuilderApproval, options?: CampaignBuilderBuildOptions): Promise<CampaignBuildResult>;
|
|
1109
|
+
runApprovedPlan(plan: CampaignBuilderAgentPlan, approval: CampaignBuilderApproval, options?: CampaignBuilderApprovedRunOptions): Promise<CampaignBuilderApprovedRunResult>;
|
|
1110
|
+
private getCampaignBuildStatus;
|
|
1111
|
+
private waitForCampaignBuildStatus;
|
|
1112
|
+
private approveCampaignDelivery;
|
|
1094
1113
|
private getWorkspaceContext;
|
|
1095
1114
|
private scopeCampaign;
|
|
1096
1115
|
private discoverPlannedRoutes;
|
|
@@ -3365,4 +3384,4 @@ declare class Signaliz {
|
|
|
3365
3384
|
discover(query: string, category?: string): Promise<MCPToolInfo[]>;
|
|
3366
3385
|
}
|
|
3367
3386
|
|
|
3368
|
-
export { Ai, type ApproveDeliveryResult, type BuildOptions, CAMPAIGN_BUILDER_OPERATING_PLAYBOOKS, CAMPAIGN_BUILDER_STRATEGY_TEMPLATES, type CampaignArtifact, type CampaignBuildRequest$1 as CampaignBuildRequest, type CampaignBuildResult$1 as CampaignBuildResult, type CampaignBuildRow, type CampaignBuildStatus, CampaignBuilderAgent, type CampaignBuilderAgentPlan, type CampaignBuilderAgentProvider, type CampaignBuilderAgentRequest, type CampaignBuilderAgentRequestTemplateOptions, type CampaignBuilderApproval, type CampaignBuilderApprovalPolicy, type CampaignBuilderApprovalType, type CampaignBuilderBuildOptions, type CampaignBuilderBuiltInTool, type CampaignBuilderCustomerTool, type CampaignBuilderGtmLayer, type CampaignBuilderIntegrationRoute, type CampaignBuilderLayer, type CampaignBuilderMcpStep, type CampaignBuilderMemoryPlan, type CampaignBuilderMemoryQuery, type CampaignBuilderMemoryScope, type CampaignBuilderOperatingPlaybook, type CampaignBuilderOperatingPlaybookSlug, type CampaignBuilderPlanCommitOptions, type CampaignBuilderPlanCommitResult, type CampaignBuilderPlanOptions, type CampaignBuilderProvider, type CampaignBuilderRequiredApproval, type CampaignBuilderRouteMode, type CampaignBuilderStrategyTemplate, type CampaignBuilderStrategyTemplateSlug, type CampaignBuilderWorkspaceContext, type CampaignDeliveryMode, type CampaignProviderRouteReadback, type CampaignRowsOptions, type CampaignRowsResult, Campaigns, type CancelBuildResult, type CompanyIntelligenceParams, type CompanyIntelligenceResult, type CreateOutputSinkRequest, type CreateRoutineRequest, type CreateSystemParams, type CustomAiAttachment, type CustomAiFusionConfig, type CustomAiMultiModelParams, type CustomAiMultiModelResult, type CustomAiOutputField, DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES, DEFAULT_CAMPAIGN_BUILDER_BUILT_INS, DEFAULT_SIGNALIZ_CAMPAIGN_BUILDER_DEFAULTS, type EmailBatchJobResult, type EnrichSignalsParams, type EnrichSignalsResult, type ErrorType, type ExecutionReference, type ExecutionReferenceInput, type ExecutionReferenceKind, type FindAndVerifyEmailContact, type FindEmailParams, type FindEmailResult, type GenerateLeadsParams, type GenerateLocalLeadsParams, type GtmActorType, type GtmAuthStrategy, type GtmBrainAggregateCalibrationsInput, type GtmBrainAggregatePatternsInput, type GtmBrainCalibrateDeliverabilityInput, type GtmBrainDeliveryRiskInput, type GtmBrainDistillRunInput, type GtmBrainExtractPatternsInput, type GtmBrainFailurePatternsOptions, type GtmBrainLearningAction, type GtmBrainLearningCyclePhase, type GtmBrainLearningCyclePlanInput, type GtmBrainLearningCyclePlanResult, type GtmBrainLearningCycleRunInput, type GtmBrainLearningEvidenceCounts, type GtmBrainLearningLane, type GtmBrainLearningLaneId, type GtmBrainLearningLaneState, type GtmBrainLearningLaneSummary, type GtmBrainLearningPhaseReadiness, type GtmBrainLearningPhaseStatus, type GtmBrainLearningRecommendedToolCall, type GtmBrainPatternsOptions, type GtmBrainSeedDefaultsInput, type GtmCalibrationDimensionType, type GtmCampaignAgentPlanInput, type GtmCampaignAgentRequestTemplateInput, type GtmCampaignBuildPlanInput, type GtmCampaignCreateInput, type GtmCampaignGetOptions, type GtmCampaignHistoryCampaignInput, type GtmCampaignHistoryImportBatchInput, type GtmCampaignHistoryImportInput, type GtmCampaignHistoryImportRunInput, type GtmCampaignHistoryMemoryInput, type GtmCampaignLearningStatusResult, type GtmCampaignListOptions, type GtmCampaignLogInput, type GtmCampaignSource, type GtmCampaignStartContextInput, type GtmCampaignStatus, type GtmCampaignStrategyMemoryStatusInput, type GtmCampaignStrategyTemplateSlug, type GtmCampaignStrategyTemplatesOptions, type GtmCampaignUpdateInput, type GtmConnectionRegisterInput, type GtmConnectionsListOptions, type GtmExistingCampaignAuditBoundary, type GtmExistingCampaignAuditBySearchOptions, type GtmExistingCampaignAuditOptions, type GtmExistingCampaignAuditRecommendation, type GtmExistingCampaignAuditResult, type GtmExistingCampaignCompletenessStep, type GtmExistingCampaignDiscoverOptions, type GtmExistingCampaignDiscoveryResult, type GtmExistingCampaignMcpRequest, type GtmExistingCampaignOption, type GtmFeedbackIngestInput, type GtmIntegrationRecipeCreateInput, type GtmInvocationType, GtmKernel, type GtmKernelImportPreviewInput, type GtmKernelImportRunInput, type GtmLayer, type GtmLayerRouteSetInput, type GtmLayerRoutesGetOptions, type GtmMemorySearchOptions, type GtmMemoryType, type GtmPatternType, type GtmProviderLinkInput, type GtmProviderRecipePrepareInput, type GtmProviderRouteActivateInput, type GtmWebhookDeliverInput, type GtmWorkspaceBootstrapStatusOptions, type GtmWorkspaceContextOptions, type HttpRequestParams, type HttpRequestResult, type IcpDetail, type IcpSummary, Icps, type ImportOctaveResult, type LeadGenJobResult, type ListOutputSinksOptions, type MCPToolInfo, type NativeGtmCapabilityInfo, Ops, type OpsApproveRequest, type OpsApproveResult, type OpsBlueprint, type OpsCadence, type OpsCreateRequest, type OpsCreateResult, type OpsDashboardOptions, type OpsDashboardResult, type OpsDebugDiagnosticError, type OpsDebugOptions, type OpsDebugResult, type OpsPlanRequest, type OpsPlanResult, type OpsPrimitive, type OpsPrimitiveConcurrencyPolicy, type OpsPrimitiveDeadLetterPolicy, type OpsPrimitiveObservabilityPolicy, type OpsPrimitivePermissionLevel, type OpsPrimitiveRetryPolicy, type OpsPrimitiveWorkspaceScope, type OpsQueueStatus, type OpsQueueStatusOptions, type OpsQuickstartStep, type OpsQuickstartWorkflow, type OpsReadinessCheck, type OpsReadinessOptions, type OpsReadinessResult, type OpsReplayResult, type OpsResultsOptions, type OpsResultsResult, type OpsRoutine, type OpsRoutineDeleteResult, type OpsRoutineRunResult, type OpsRoutineSinkResult, type OpsRoutineStatus, type OpsRoutineTick, type OpsRoutineTickItem, type OpsRoutineTickItemsResult, type OpsRoutineTicksResult, type OpsRoutinesResult, type OpsRunOptions, type OpsRunResult, type OpsSink, type OpsSinkType, type OpsStatusOptions, type OpsStatusResult, type OpsTriggerBatchRunStatus, type OpsTriggerRunStatus, type OpsTriggerRunStatusOptions, type PlatformHealth, type RunNativeGtmCapabilityParams, type RunProgressEvent, type RunResult, type RunRoutineRequest, type RunSystemParams, type Signal, Signaliz, type SignalizCampaignBuilderDefaults, type SignalizConfig, SignalizError, type SignalizErrorData, type SimpleOpStatus, type SystemResult, type UpdateRoutineRequest, type VerifyEmailResult, type WaitOptions, type WorkspaceInfo, applyCampaignBuilderStrategyTemplate, collectExecutionReferences, createCampaignBuilderAgentPlan, createCampaignBuilderAgentRequestTemplate, createCampaignBuilderApproval, createCampaignBuilderToolRoute, getCampaignBuilderOperatingPlaybook, getCampaignBuilderOperatingPlaybooksForRequest, getCampaignBuilderStrategyTemplate, getMissingCampaignBuilderApprovals, normalizeExecutionReference };
|
|
3387
|
+
export { Ai, type ApproveDeliveryResult, type BuildOptions, CAMPAIGN_BUILDER_OPERATING_PLAYBOOKS, CAMPAIGN_BUILDER_STRATEGY_TEMPLATES, type CampaignArtifact, type CampaignBuildRequest$1 as CampaignBuildRequest, type CampaignBuildResult$1 as CampaignBuildResult, type CampaignBuildRow, type CampaignBuildStatus, CampaignBuilderAgent, type CampaignBuilderAgentPlan, type CampaignBuilderAgentProvider, type CampaignBuilderAgentRequest, type CampaignBuilderAgentRequestTemplateOptions, type CampaignBuilderApproval, type CampaignBuilderApprovalPolicy, type CampaignBuilderApprovalType, type CampaignBuilderApprovedRunOptions, type CampaignBuilderApprovedRunResult, type CampaignBuilderBuildOptions, type CampaignBuilderBuiltInTool, type CampaignBuilderCustomerTool, type CampaignBuilderGtmLayer, type CampaignBuilderIntegrationRoute, type CampaignBuilderLayer, type CampaignBuilderMcpStep, type CampaignBuilderMemoryPlan, type CampaignBuilderMemoryQuery, type CampaignBuilderMemoryScope, type CampaignBuilderOperatingPlaybook, type CampaignBuilderOperatingPlaybookSlug, type CampaignBuilderPlanCommitOptions, type CampaignBuilderPlanCommitResult, type CampaignBuilderPlanOptions, type CampaignBuilderProvider, type CampaignBuilderRequiredApproval, type CampaignBuilderRouteMode, type CampaignBuilderStrategyTemplate, type CampaignBuilderStrategyTemplateSlug, type CampaignBuilderWorkspaceContext, type CampaignDeliveryMode, type CampaignProviderRouteReadback, type CampaignRowsOptions, type CampaignRowsResult, Campaigns, type CancelBuildResult, type CompanyIntelligenceParams, type CompanyIntelligenceResult, type CreateOutputSinkRequest, type CreateRoutineRequest, type CreateSystemParams, type CustomAiAttachment, type CustomAiFusionConfig, type CustomAiMultiModelParams, type CustomAiMultiModelResult, type CustomAiOutputField, DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES, DEFAULT_CAMPAIGN_BUILDER_BUILT_INS, DEFAULT_SIGNALIZ_CAMPAIGN_BUILDER_DEFAULTS, type EmailBatchJobResult, type EnrichSignalsParams, type EnrichSignalsResult, type ErrorType, type ExecutionReference, type ExecutionReferenceInput, type ExecutionReferenceKind, type FindAndVerifyEmailContact, type FindEmailParams, type FindEmailResult, type GenerateLeadsParams, type GenerateLocalLeadsParams, type GtmActorType, type GtmAuthStrategy, type GtmBrainAggregateCalibrationsInput, type GtmBrainAggregatePatternsInput, type GtmBrainCalibrateDeliverabilityInput, type GtmBrainDeliveryRiskInput, type GtmBrainDistillRunInput, type GtmBrainExtractPatternsInput, type GtmBrainFailurePatternsOptions, type GtmBrainLearningAction, type GtmBrainLearningCyclePhase, type GtmBrainLearningCyclePlanInput, type GtmBrainLearningCyclePlanResult, type GtmBrainLearningCycleRunInput, type GtmBrainLearningEvidenceCounts, type GtmBrainLearningLane, type GtmBrainLearningLaneId, type GtmBrainLearningLaneState, type GtmBrainLearningLaneSummary, type GtmBrainLearningPhaseReadiness, type GtmBrainLearningPhaseStatus, type GtmBrainLearningRecommendedToolCall, type GtmBrainPatternsOptions, type GtmBrainSeedDefaultsInput, type GtmCalibrationDimensionType, type GtmCampaignAgentPlanInput, type GtmCampaignAgentRequestTemplateInput, type GtmCampaignBuildPlanInput, type GtmCampaignCreateInput, type GtmCampaignGetOptions, type GtmCampaignHistoryCampaignInput, type GtmCampaignHistoryImportBatchInput, type GtmCampaignHistoryImportInput, type GtmCampaignHistoryImportRunInput, type GtmCampaignHistoryMemoryInput, type GtmCampaignLearningStatusResult, type GtmCampaignListOptions, type GtmCampaignLogInput, type GtmCampaignSource, type GtmCampaignStartContextInput, type GtmCampaignStatus, type GtmCampaignStrategyMemoryStatusInput, type GtmCampaignStrategyTemplateSlug, type GtmCampaignStrategyTemplatesOptions, type GtmCampaignUpdateInput, type GtmConnectionRegisterInput, type GtmConnectionsListOptions, type GtmExistingCampaignAuditBoundary, type GtmExistingCampaignAuditBySearchOptions, type GtmExistingCampaignAuditOptions, type GtmExistingCampaignAuditRecommendation, type GtmExistingCampaignAuditResult, type GtmExistingCampaignCompletenessStep, type GtmExistingCampaignDiscoverOptions, type GtmExistingCampaignDiscoveryResult, type GtmExistingCampaignMcpRequest, type GtmExistingCampaignOption, type GtmFeedbackIngestInput, type GtmIntegrationRecipeCreateInput, type GtmInvocationType, GtmKernel, type GtmKernelImportPreviewInput, type GtmKernelImportRunInput, type GtmLayer, type GtmLayerRouteSetInput, type GtmLayerRoutesGetOptions, type GtmMemorySearchOptions, type GtmMemoryType, type GtmPatternType, type GtmProviderLinkInput, type GtmProviderRecipePrepareInput, type GtmProviderRouteActivateInput, type GtmWebhookDeliverInput, type GtmWorkspaceBootstrapStatusOptions, type GtmWorkspaceContextOptions, type HttpRequestParams, type HttpRequestResult, type IcpDetail, type IcpSummary, Icps, type ImportOctaveResult, type LeadGenJobResult, type ListOutputSinksOptions, type MCPToolInfo, type NativeGtmCapabilityInfo, Ops, type OpsApproveRequest, type OpsApproveResult, type OpsBlueprint, type OpsCadence, type OpsCreateRequest, type OpsCreateResult, type OpsDashboardOptions, type OpsDashboardResult, type OpsDebugDiagnosticError, type OpsDebugOptions, type OpsDebugResult, type OpsPlanRequest, type OpsPlanResult, type OpsPrimitive, type OpsPrimitiveConcurrencyPolicy, type OpsPrimitiveDeadLetterPolicy, type OpsPrimitiveObservabilityPolicy, type OpsPrimitivePermissionLevel, type OpsPrimitiveRetryPolicy, type OpsPrimitiveWorkspaceScope, type OpsQueueStatus, type OpsQueueStatusOptions, type OpsQuickstartStep, type OpsQuickstartWorkflow, type OpsReadinessCheck, type OpsReadinessOptions, type OpsReadinessResult, type OpsReplayResult, type OpsResultsOptions, type OpsResultsResult, type OpsRoutine, type OpsRoutineDeleteResult, type OpsRoutineRunResult, type OpsRoutineSinkResult, type OpsRoutineStatus, type OpsRoutineTick, type OpsRoutineTickItem, type OpsRoutineTickItemsResult, type OpsRoutineTicksResult, type OpsRoutinesResult, type OpsRunOptions, type OpsRunResult, type OpsSink, type OpsSinkType, type OpsStatusOptions, type OpsStatusResult, type OpsTriggerBatchRunStatus, type OpsTriggerRunStatus, type OpsTriggerRunStatusOptions, type PlatformHealth, type RunNativeGtmCapabilityParams, type RunProgressEvent, type RunResult, type RunRoutineRequest, type RunSystemParams, type Signal, Signaliz, type SignalizCampaignBuilderDefaults, type SignalizConfig, SignalizError, type SignalizErrorData, type SimpleOpStatus, type SystemResult, type UpdateRoutineRequest, type VerifyEmailResult, type WaitOptions, type WorkspaceInfo, applyCampaignBuilderStrategyTemplate, collectExecutionReferences, createCampaignBuilderAgentPlan, createCampaignBuilderAgentRequestTemplate, createCampaignBuilderApproval, createCampaignBuilderToolRoute, getCampaignBuilderOperatingPlaybook, getCampaignBuilderOperatingPlaybooksForRequest, getCampaignBuilderStrategyTemplate, getMissingCampaignBuilderApprovals, normalizeExecutionReference };
|
package/dist/index.js
CHANGED
|
@@ -1864,6 +1864,76 @@ var CampaignBuilderAgent = class {
|
|
|
1864
1864
|
const data = await this.callMcp("build_campaign", args);
|
|
1865
1865
|
return mapBuildResult(data, false);
|
|
1866
1866
|
}
|
|
1867
|
+
async runApprovedPlan(plan, approval, options = {}) {
|
|
1868
|
+
const build = await this.buildApprovedPlan(plan, approval, options);
|
|
1869
|
+
const campaignBuildId = build.campaignBuildId;
|
|
1870
|
+
if (!campaignBuildId) {
|
|
1871
|
+
if (options.wait || options.approveDelivery) {
|
|
1872
|
+
throw new Error("Campaign builder approved run did not return a campaignBuildId to poll");
|
|
1873
|
+
}
|
|
1874
|
+
return { build };
|
|
1875
|
+
}
|
|
1876
|
+
const shouldWait = options.wait === true || options.approveDelivery === true;
|
|
1877
|
+
if (!shouldWait) return { build };
|
|
1878
|
+
let finalStatus = await this.waitForCampaignBuildStatus(
|
|
1879
|
+
campaignBuildId,
|
|
1880
|
+
options,
|
|
1881
|
+
["completed", "failed", "canceled", "pending_approval"]
|
|
1882
|
+
);
|
|
1883
|
+
const result = { build, finalStatus };
|
|
1884
|
+
if (options.approveDelivery === true && finalStatus.status === "pending_approval") {
|
|
1885
|
+
const destinationType = options.deliveryDestinationType ?? plan.buildRequest.delivery?.destinationType ?? "json";
|
|
1886
|
+
result.deliveryApproval = await this.approveCampaignDelivery(campaignBuildId, destinationType, {
|
|
1887
|
+
destinationId: options.deliveryDestinationId,
|
|
1888
|
+
destinationConfig: options.deliveryDestinationConfig ?? plan.buildRequest.delivery?.destinationConfig
|
|
1889
|
+
});
|
|
1890
|
+
finalStatus = await this.waitForCampaignBuildStatus(
|
|
1891
|
+
campaignBuildId,
|
|
1892
|
+
options,
|
|
1893
|
+
["completed", "failed", "canceled"]
|
|
1894
|
+
);
|
|
1895
|
+
result.finalStatus = finalStatus;
|
|
1896
|
+
}
|
|
1897
|
+
return result;
|
|
1898
|
+
}
|
|
1899
|
+
async getCampaignBuildStatus(campaignBuildId) {
|
|
1900
|
+
const data = await this.callMcp("get_campaign_build_status", {
|
|
1901
|
+
campaign_build_id: campaignBuildId
|
|
1902
|
+
});
|
|
1903
|
+
return mapAgentCampaignBuildStatus(data);
|
|
1904
|
+
}
|
|
1905
|
+
async waitForCampaignBuildStatus(campaignBuildId, options, stopStatuses) {
|
|
1906
|
+
const interval = options.waitIntervalMs ?? 5e3;
|
|
1907
|
+
const timeout = options.waitTimeoutMs ?? 6e5;
|
|
1908
|
+
const startedAt = Date.now();
|
|
1909
|
+
while (true) {
|
|
1910
|
+
const status = await this.getCampaignBuildStatus(campaignBuildId);
|
|
1911
|
+
options.onStatus?.(status);
|
|
1912
|
+
if (stopStatuses.includes(status.status)) return status;
|
|
1913
|
+
if (Date.now() - startedAt > timeout) {
|
|
1914
|
+
throw new Error(`Campaign build ${campaignBuildId} timed out after ${timeout}ms (status: ${status.status})`);
|
|
1915
|
+
}
|
|
1916
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
async approveCampaignDelivery(campaignBuildId, destinationType, options) {
|
|
1920
|
+
const args = compact({
|
|
1921
|
+
campaign_build_id: campaignBuildId,
|
|
1922
|
+
destination_type: destinationType,
|
|
1923
|
+
destination_id: options?.destinationId,
|
|
1924
|
+
destination_config: options?.destinationConfig
|
|
1925
|
+
});
|
|
1926
|
+
const data = await this.callMcp("approve_campaign_delivery", args);
|
|
1927
|
+
return {
|
|
1928
|
+
campaignBuildId: data.campaign_build_id,
|
|
1929
|
+
destinationType: data.destination_type ?? destinationType,
|
|
1930
|
+
status: data.status ?? "approved",
|
|
1931
|
+
message: data.message ?? "",
|
|
1932
|
+
deliveryId: data.delivery_id,
|
|
1933
|
+
deliveryIds: data.delivery_ids,
|
|
1934
|
+
approvedCount: data.approved_count
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1867
1937
|
async getWorkspaceContext(warnings) {
|
|
1868
1938
|
try {
|
|
1869
1939
|
const workspace = await this.callMcp("get_workspace", {});
|
|
@@ -3191,6 +3261,55 @@ function mapBuildResult(data, dryRun) {
|
|
|
3191
3261
|
providerRoute: mapProviderRoute2(data)
|
|
3192
3262
|
};
|
|
3193
3263
|
}
|
|
3264
|
+
function mapAgentCampaignBuildStatus(data) {
|
|
3265
|
+
return {
|
|
3266
|
+
campaignBuildId: stringValue(data.campaign_build_id) ?? "",
|
|
3267
|
+
campaignId: stringValue(data.campaign_id) ?? null,
|
|
3268
|
+
campaignObject: nullableRecord(data.campaign_object),
|
|
3269
|
+
name: stringValue(data.name) ?? "",
|
|
3270
|
+
status: stringValue(data.status) ?? "unknown",
|
|
3271
|
+
currentPhase: stringValue(data.current_phase) ?? null,
|
|
3272
|
+
currentPhaseStatus: stringValue(data.current_phase_status) ?? null,
|
|
3273
|
+
phases: Array.isArray(data.phases) ? data.phases : [],
|
|
3274
|
+
recordsTotal: numberOrUndefined2(data.records_total) ?? 0,
|
|
3275
|
+
recordsProcessed: numberOrUndefined2(data.records_processed) ?? 0,
|
|
3276
|
+
recordsSucceeded: numberOrUndefined2(data.records_succeeded) ?? 0,
|
|
3277
|
+
recordsFailed: numberOrUndefined2(data.records_failed) ?? 0,
|
|
3278
|
+
warnings: diagnosticMessages2(data.warnings),
|
|
3279
|
+
errors: diagnosticMessages2(data.errors),
|
|
3280
|
+
artifactCount: numberOrUndefined2(data.artifact_count) ?? 0,
|
|
3281
|
+
providerRoute: mapProviderRoute2(data),
|
|
3282
|
+
triggerRunId: stringValue(data.trigger_run_id) ?? null,
|
|
3283
|
+
staleRunningPhase: data.stale_running_phase === true,
|
|
3284
|
+
phaseAgeSeconds: numberOrNull2(data.phase_age_seconds),
|
|
3285
|
+
diagnostics: nullableRecord(data.diagnostics) ?? {},
|
|
3286
|
+
nextAction: formatAgentNextAction(data.next_action),
|
|
3287
|
+
createdAt: stringValue(data.created_at) ?? "",
|
|
3288
|
+
updatedAt: stringValue(data.updated_at) ?? "",
|
|
3289
|
+
completedAt: stringValue(data.completed_at) ?? null
|
|
3290
|
+
};
|
|
3291
|
+
}
|
|
3292
|
+
function diagnosticMessages2(value) {
|
|
3293
|
+
if (!Array.isArray(value)) return [];
|
|
3294
|
+
return value.map((item) => {
|
|
3295
|
+
if (typeof item === "string") return item;
|
|
3296
|
+
const record = nullableRecord(item);
|
|
3297
|
+
return stringValue(record?.message);
|
|
3298
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
3299
|
+
}
|
|
3300
|
+
function formatAgentNextAction(value) {
|
|
3301
|
+
if (!value) return "";
|
|
3302
|
+
if (typeof value === "string") return value;
|
|
3303
|
+
const record = nullableRecord(value);
|
|
3304
|
+
if (!record) return "";
|
|
3305
|
+
const tool = stringValue(record.tool);
|
|
3306
|
+
const type = stringValue(record.type);
|
|
3307
|
+
const reason = stringValue(record.reason);
|
|
3308
|
+
const args = nullableRecord(record.arguments);
|
|
3309
|
+
const argText = args && Object.keys(args).length > 0 ? ` ${JSON.stringify(args)}` : "";
|
|
3310
|
+
const action = tool ? `${tool}${argText}` : type ?? "";
|
|
3311
|
+
return [action, reason].filter(Boolean).join(" - ");
|
|
3312
|
+
}
|
|
3194
3313
|
function mapProviderRoute2(data) {
|
|
3195
3314
|
const brainContext = asRecord(data?.brain_context);
|
|
3196
3315
|
const plan = nullableRecord(data?.provider_route_plan) ?? nullableRecord(brainContext.provider_route_plan);
|
package/dist/index.mjs
CHANGED
package/dist/mcp-config.js
CHANGED
|
@@ -1838,6 +1838,76 @@ var CampaignBuilderAgent = class {
|
|
|
1838
1838
|
const data = await this.callMcp("build_campaign", args);
|
|
1839
1839
|
return mapBuildResult(data, false);
|
|
1840
1840
|
}
|
|
1841
|
+
async runApprovedPlan(plan, approval, options = {}) {
|
|
1842
|
+
const build = await this.buildApprovedPlan(plan, approval, options);
|
|
1843
|
+
const campaignBuildId = build.campaignBuildId;
|
|
1844
|
+
if (!campaignBuildId) {
|
|
1845
|
+
if (options.wait || options.approveDelivery) {
|
|
1846
|
+
throw new Error("Campaign builder approved run did not return a campaignBuildId to poll");
|
|
1847
|
+
}
|
|
1848
|
+
return { build };
|
|
1849
|
+
}
|
|
1850
|
+
const shouldWait = options.wait === true || options.approveDelivery === true;
|
|
1851
|
+
if (!shouldWait) return { build };
|
|
1852
|
+
let finalStatus = await this.waitForCampaignBuildStatus(
|
|
1853
|
+
campaignBuildId,
|
|
1854
|
+
options,
|
|
1855
|
+
["completed", "failed", "canceled", "pending_approval"]
|
|
1856
|
+
);
|
|
1857
|
+
const result = { build, finalStatus };
|
|
1858
|
+
if (options.approveDelivery === true && finalStatus.status === "pending_approval") {
|
|
1859
|
+
const destinationType = options.deliveryDestinationType ?? plan.buildRequest.delivery?.destinationType ?? "json";
|
|
1860
|
+
result.deliveryApproval = await this.approveCampaignDelivery(campaignBuildId, destinationType, {
|
|
1861
|
+
destinationId: options.deliveryDestinationId,
|
|
1862
|
+
destinationConfig: options.deliveryDestinationConfig ?? plan.buildRequest.delivery?.destinationConfig
|
|
1863
|
+
});
|
|
1864
|
+
finalStatus = await this.waitForCampaignBuildStatus(
|
|
1865
|
+
campaignBuildId,
|
|
1866
|
+
options,
|
|
1867
|
+
["completed", "failed", "canceled"]
|
|
1868
|
+
);
|
|
1869
|
+
result.finalStatus = finalStatus;
|
|
1870
|
+
}
|
|
1871
|
+
return result;
|
|
1872
|
+
}
|
|
1873
|
+
async getCampaignBuildStatus(campaignBuildId) {
|
|
1874
|
+
const data = await this.callMcp("get_campaign_build_status", {
|
|
1875
|
+
campaign_build_id: campaignBuildId
|
|
1876
|
+
});
|
|
1877
|
+
return mapAgentCampaignBuildStatus(data);
|
|
1878
|
+
}
|
|
1879
|
+
async waitForCampaignBuildStatus(campaignBuildId, options, stopStatuses) {
|
|
1880
|
+
const interval = options.waitIntervalMs ?? 5e3;
|
|
1881
|
+
const timeout = options.waitTimeoutMs ?? 6e5;
|
|
1882
|
+
const startedAt = Date.now();
|
|
1883
|
+
while (true) {
|
|
1884
|
+
const status = await this.getCampaignBuildStatus(campaignBuildId);
|
|
1885
|
+
options.onStatus?.(status);
|
|
1886
|
+
if (stopStatuses.includes(status.status)) return status;
|
|
1887
|
+
if (Date.now() - startedAt > timeout) {
|
|
1888
|
+
throw new Error(`Campaign build ${campaignBuildId} timed out after ${timeout}ms (status: ${status.status})`);
|
|
1889
|
+
}
|
|
1890
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
async approveCampaignDelivery(campaignBuildId, destinationType, options) {
|
|
1894
|
+
const args = compact({
|
|
1895
|
+
campaign_build_id: campaignBuildId,
|
|
1896
|
+
destination_type: destinationType,
|
|
1897
|
+
destination_id: options?.destinationId,
|
|
1898
|
+
destination_config: options?.destinationConfig
|
|
1899
|
+
});
|
|
1900
|
+
const data = await this.callMcp("approve_campaign_delivery", args);
|
|
1901
|
+
return {
|
|
1902
|
+
campaignBuildId: data.campaign_build_id,
|
|
1903
|
+
destinationType: data.destination_type ?? destinationType,
|
|
1904
|
+
status: data.status ?? "approved",
|
|
1905
|
+
message: data.message ?? "",
|
|
1906
|
+
deliveryId: data.delivery_id,
|
|
1907
|
+
deliveryIds: data.delivery_ids,
|
|
1908
|
+
approvedCount: data.approved_count
|
|
1909
|
+
};
|
|
1910
|
+
}
|
|
1841
1911
|
async getWorkspaceContext(warnings) {
|
|
1842
1912
|
try {
|
|
1843
1913
|
const workspace = await this.callMcp("get_workspace", {});
|
|
@@ -3064,6 +3134,55 @@ function mapBuildResult(data, dryRun) {
|
|
|
3064
3134
|
providerRoute: mapProviderRoute2(data)
|
|
3065
3135
|
};
|
|
3066
3136
|
}
|
|
3137
|
+
function mapAgentCampaignBuildStatus(data) {
|
|
3138
|
+
return {
|
|
3139
|
+
campaignBuildId: stringValue(data.campaign_build_id) ?? "",
|
|
3140
|
+
campaignId: stringValue(data.campaign_id) ?? null,
|
|
3141
|
+
campaignObject: nullableRecord(data.campaign_object),
|
|
3142
|
+
name: stringValue(data.name) ?? "",
|
|
3143
|
+
status: stringValue(data.status) ?? "unknown",
|
|
3144
|
+
currentPhase: stringValue(data.current_phase) ?? null,
|
|
3145
|
+
currentPhaseStatus: stringValue(data.current_phase_status) ?? null,
|
|
3146
|
+
phases: Array.isArray(data.phases) ? data.phases : [],
|
|
3147
|
+
recordsTotal: numberOrUndefined2(data.records_total) ?? 0,
|
|
3148
|
+
recordsProcessed: numberOrUndefined2(data.records_processed) ?? 0,
|
|
3149
|
+
recordsSucceeded: numberOrUndefined2(data.records_succeeded) ?? 0,
|
|
3150
|
+
recordsFailed: numberOrUndefined2(data.records_failed) ?? 0,
|
|
3151
|
+
warnings: diagnosticMessages2(data.warnings),
|
|
3152
|
+
errors: diagnosticMessages2(data.errors),
|
|
3153
|
+
artifactCount: numberOrUndefined2(data.artifact_count) ?? 0,
|
|
3154
|
+
providerRoute: mapProviderRoute2(data),
|
|
3155
|
+
triggerRunId: stringValue(data.trigger_run_id) ?? null,
|
|
3156
|
+
staleRunningPhase: data.stale_running_phase === true,
|
|
3157
|
+
phaseAgeSeconds: numberOrNull2(data.phase_age_seconds),
|
|
3158
|
+
diagnostics: nullableRecord(data.diagnostics) ?? {},
|
|
3159
|
+
nextAction: formatAgentNextAction(data.next_action),
|
|
3160
|
+
createdAt: stringValue(data.created_at) ?? "",
|
|
3161
|
+
updatedAt: stringValue(data.updated_at) ?? "",
|
|
3162
|
+
completedAt: stringValue(data.completed_at) ?? null
|
|
3163
|
+
};
|
|
3164
|
+
}
|
|
3165
|
+
function diagnosticMessages2(value) {
|
|
3166
|
+
if (!Array.isArray(value)) return [];
|
|
3167
|
+
return value.map((item) => {
|
|
3168
|
+
if (typeof item === "string") return item;
|
|
3169
|
+
const record = nullableRecord(item);
|
|
3170
|
+
return stringValue(record?.message);
|
|
3171
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
3172
|
+
}
|
|
3173
|
+
function formatAgentNextAction(value) {
|
|
3174
|
+
if (!value) return "";
|
|
3175
|
+
if (typeof value === "string") return value;
|
|
3176
|
+
const record = nullableRecord(value);
|
|
3177
|
+
if (!record) return "";
|
|
3178
|
+
const tool = stringValue(record.tool);
|
|
3179
|
+
const type = stringValue(record.type);
|
|
3180
|
+
const reason = stringValue(record.reason);
|
|
3181
|
+
const args = nullableRecord(record.arguments);
|
|
3182
|
+
const argText = args && Object.keys(args).length > 0 ? ` ${JSON.stringify(args)}` : "";
|
|
3183
|
+
const action = tool ? `${tool}${argText}` : type ?? "";
|
|
3184
|
+
return [action, reason].filter(Boolean).join(" - ");
|
|
3185
|
+
}
|
|
3067
3186
|
function mapProviderRoute2(data) {
|
|
3068
3187
|
const brainContext = asRecord(data?.brain_context);
|
|
3069
3188
|
const plan = nullableRecord(data?.provider_route_plan) ?? nullableRecord(brainContext.provider_route_plan);
|
package/dist/mcp-config.mjs
CHANGED