@signaliz/sdk 1.0.14 → 1.0.15
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 +15 -0
- package/dist/{chunk-EVFQETTN.mjs → chunk-6OZWMAV3.mjs} +211 -0
- package/dist/cli.js +264 -2
- package/dist/cli.mjs +57 -4
- package/dist/index.d.mts +54 -1
- package/dist/index.d.ts +54 -1
- package/dist/index.js +212 -0
- package/dist/index.mjs +3 -1
- package/dist/mcp-config.js +312 -0
- package/dist/mcp-config.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,10 +105,18 @@ const proof = await signaliz.campaignBuilderAgent.proof({
|
|
|
105
105
|
targetCount: 25,
|
|
106
106
|
builtIns: ['lead_generation', 'local_leads', 'email_finding', 'email_verification', 'signals'],
|
|
107
107
|
});
|
|
108
|
+
const kit = signaliz.campaignBuilderAgent.buildKit({
|
|
109
|
+
goal: 'Build a strategy-template campaign for mature local operators',
|
|
110
|
+
strategyTemplate: 'non-medical-home-care',
|
|
111
|
+
targetCount: 250,
|
|
112
|
+
includeLocalLeads: true,
|
|
113
|
+
includeCustomToolPlaceholder: true,
|
|
114
|
+
});
|
|
108
115
|
|
|
109
116
|
console.log(plan.strategyMemoryStatus?.ready);
|
|
110
117
|
console.log(readiness.summary.ready);
|
|
111
118
|
console.log(proof.success);
|
|
119
|
+
console.log(kit.mcp_calls.find((call) => call.tool === 'gtm_campaign_agent_proof'));
|
|
112
120
|
console.log(plan.mcpFlow.filter((step) =>
|
|
113
121
|
['gtm_provider_recipe_prepare', 'gtm_provider_route_activate'].includes(step.tool)
|
|
114
122
|
));
|
|
@@ -137,6 +145,13 @@ npx @signaliz/sdk campaign-agent init \
|
|
|
137
145
|
--with-byo-placeholder \
|
|
138
146
|
--output-file campaign-request.json
|
|
139
147
|
|
|
148
|
+
npx @signaliz/sdk campaign-agent kit \
|
|
149
|
+
--strategy-template non-medical-home-care \
|
|
150
|
+
--target-count 250 \
|
|
151
|
+
--use-local-leads \
|
|
152
|
+
--with-byo-placeholder \
|
|
153
|
+
--json
|
|
154
|
+
|
|
140
155
|
npx @signaliz/sdk campaign-agent plan \
|
|
141
156
|
--request-file campaign-request.json \
|
|
142
157
|
--target-count 250 \
|
|
@@ -1705,6 +1705,9 @@ var CampaignBuilderAgent = class {
|
|
|
1705
1705
|
});
|
|
1706
1706
|
return createCampaignBuilderProofReceipt(plan, result);
|
|
1707
1707
|
}
|
|
1708
|
+
buildKit(options = {}) {
|
|
1709
|
+
return createCampaignBuilderBuildKit(options);
|
|
1710
|
+
}
|
|
1708
1711
|
async commitPlan(plan, options = {}) {
|
|
1709
1712
|
const writeMode = options.confirm === true && options.dryRun === false;
|
|
1710
1713
|
if (writeMode && !options.approvedBy) {
|
|
@@ -2369,6 +2372,156 @@ function createCampaignBuilderAgentRequestTemplate(input = {}) {
|
|
|
2369
2372
|
}
|
|
2370
2373
|
});
|
|
2371
2374
|
}
|
|
2375
|
+
function createCampaignBuilderBuildKit(input = {}) {
|
|
2376
|
+
const requestFile = input.requestFile || "campaign-request.json";
|
|
2377
|
+
const cliPackage = input.cliPackage || "@signaliz/cli";
|
|
2378
|
+
const sdkPackage = input.sdkPackage || "@signaliz/sdk";
|
|
2379
|
+
const request = createCampaignBuilderAgentRequestTemplate(input);
|
|
2380
|
+
const strategyTemplate = stringValue(request.strategyTemplate) ?? null;
|
|
2381
|
+
const builtIns = request.builtIns ?? DEFAULT_CAMPAIGN_BUILDER_BUILT_INS;
|
|
2382
|
+
const useLocalLeads = builtIns.includes("local_leads");
|
|
2383
|
+
const customRoutes = [
|
|
2384
|
+
...request.integrations ?? [],
|
|
2385
|
+
...routesFromCustomerTools(request.customerTools ?? [])
|
|
2386
|
+
].filter((route) => route.provider !== "signaliz");
|
|
2387
|
+
const strategyFlag = strategyTemplate ? ` --strategy-template ${shellArg(strategyTemplate)}` : "";
|
|
2388
|
+
const targetFlag = request.targetCount ? ` --target-count ${request.targetCount}` : "";
|
|
2389
|
+
const localLeadsFlag = useLocalLeads ? " --use-local-leads" : "";
|
|
2390
|
+
const cliBase = `npx ${cliPackage}`;
|
|
2391
|
+
const sdkCliBase = `npx ${sdkPackage}`;
|
|
2392
|
+
const brief = request.goal || "Build a strategy-template campaign for the target ICP.";
|
|
2393
|
+
const mcpArgs = campaignBuilderBuildKitMcpArgs(request);
|
|
2394
|
+
return {
|
|
2395
|
+
kit_version: "campaign-builder-kit.v1",
|
|
2396
|
+
source: "signaliz.campaignBuilderAgent.buildKit",
|
|
2397
|
+
request_file: requestFile,
|
|
2398
|
+
request,
|
|
2399
|
+
strategy_template: strategyTemplate,
|
|
2400
|
+
built_in_lanes: builtIns,
|
|
2401
|
+
operating_playbooks: getCampaignBuilderOperatingPlaybooksForRequest(request).map((playbook) => playbook.slug),
|
|
2402
|
+
custom_routes: customRoutes.map((route) => ({
|
|
2403
|
+
provider: String(route.provider),
|
|
2404
|
+
layer: String(route.layer),
|
|
2405
|
+
tool: firstNonEmptyString(route.toolName),
|
|
2406
|
+
mcp_server: firstNonEmptyString(route.mcpServerName),
|
|
2407
|
+
mode: route.mode ?? "if_available",
|
|
2408
|
+
approval_required: route.approvalRequired === true || route.mode === "required"
|
|
2409
|
+
})),
|
|
2410
|
+
approval_boundaries: request.approvalPolicy?.requireApprovalFor ?? DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES,
|
|
2411
|
+
byo_tool_pattern: {
|
|
2412
|
+
cli_flag: "--custom-tool provider:layer:tool[:mcp]",
|
|
2413
|
+
request_fragment: createCampaignBuilderToolRoute({
|
|
2414
|
+
provider: "workspace_mcp",
|
|
2415
|
+
layer: "enrichment",
|
|
2416
|
+
gtmLayers: ["company_enrichment"],
|
|
2417
|
+
toolName: "workspace_account_enrich",
|
|
2418
|
+
mcpServerName: "workspace-mcp",
|
|
2419
|
+
label: "Workspace account enrichment",
|
|
2420
|
+
mode: "required",
|
|
2421
|
+
approvalRequired: true
|
|
2422
|
+
})
|
|
2423
|
+
},
|
|
2424
|
+
cli_commands: [
|
|
2425
|
+
{
|
|
2426
|
+
id: "write_request",
|
|
2427
|
+
label: "Write reusable request JSON",
|
|
2428
|
+
command: `${cliBase} campaign-agent init${strategyFlag}${targetFlag}${localLeadsFlag} --output-file ${shellArg(requestFile)}`,
|
|
2429
|
+
safety: "local file only; no MCP calls, credits, provider writes, sender loads, exports, or sends"
|
|
2430
|
+
},
|
|
2431
|
+
{
|
|
2432
|
+
id: "proof_shortcut",
|
|
2433
|
+
label: "Run no-spend campaign-builder proof",
|
|
2434
|
+
command: `${cliBase} build ${shellArg(brief)}${strategyFlag}${targetFlag}${localLeadsFlag} --json`,
|
|
2435
|
+
safety: "strategy memory, Kernel plan, approvals, and forced build_campaign dry-run only"
|
|
2436
|
+
},
|
|
2437
|
+
{
|
|
2438
|
+
id: "plan",
|
|
2439
|
+
label: "Inspect the full campaign-agent plan",
|
|
2440
|
+
command: `${sdkCliBase} campaign-agent plan --request-file ${shellArg(requestFile)} --json`,
|
|
2441
|
+
safety: "read-only MCP planning and provider-route dry-runs"
|
|
2442
|
+
},
|
|
2443
|
+
{
|
|
2444
|
+
id: "doctor",
|
|
2445
|
+
label: "Check readiness gates",
|
|
2446
|
+
command: `${sdkCliBase} campaign-agent doctor --request-file ${shellArg(requestFile)} --json`,
|
|
2447
|
+
safety: "read-only readiness checks for Memory, Brain, built-ins, BYO routes, and approvals"
|
|
2448
|
+
},
|
|
2449
|
+
{
|
|
2450
|
+
id: "commit_preview",
|
|
2451
|
+
label: "Preview GTM campaign object commit",
|
|
2452
|
+
command: `${sdkCliBase} campaign-agent commit-plan --request-file ${shellArg(requestFile)} --json`,
|
|
2453
|
+
safety: "dry-run commit; writes only with --confirm-write and --approved-by"
|
|
2454
|
+
},
|
|
2455
|
+
{
|
|
2456
|
+
id: "approved_launch",
|
|
2457
|
+
label: "Launch after explicit approval",
|
|
2458
|
+
command: `${sdkCliBase} campaign-agent build-approved --request-file ${shellArg(requestFile)} --confirm-launch --approve-all --approved-by operator@example.com --spend-limit ${request.signalizDefaults?.maxCredits ?? 0} --json`,
|
|
2459
|
+
safety: "spendful path; requires human approval identity, approval types, and spend limit"
|
|
2460
|
+
}
|
|
2461
|
+
],
|
|
2462
|
+
mcp_calls: [
|
|
2463
|
+
{
|
|
2464
|
+
id: "request_template",
|
|
2465
|
+
tool: "gtm_campaign_agent_request_template",
|
|
2466
|
+
arguments: mcpArgs,
|
|
2467
|
+
safety: "read-only reusable request generation"
|
|
2468
|
+
},
|
|
2469
|
+
{
|
|
2470
|
+
id: "readiness",
|
|
2471
|
+
tool: "gtm_campaign_agent_readiness",
|
|
2472
|
+
arguments: mcpArgs,
|
|
2473
|
+
safety: "read-only preflight across strategy memory, Kernel plan, lanes, routes, and approvals"
|
|
2474
|
+
},
|
|
2475
|
+
{
|
|
2476
|
+
id: "proof",
|
|
2477
|
+
tool: "gtm_campaign_agent_proof",
|
|
2478
|
+
arguments: { ...mcpArgs, idempotency_key: "campaign-agent-proof-001" },
|
|
2479
|
+
safety: "forces build_campaign dry_run=true and confirm_spend=false"
|
|
2480
|
+
},
|
|
2481
|
+
{
|
|
2482
|
+
id: "plan",
|
|
2483
|
+
tool: "gtm_campaign_agent_plan",
|
|
2484
|
+
arguments: mcpArgs,
|
|
2485
|
+
safety: "read-only one-call campaign-agent runbook"
|
|
2486
|
+
},
|
|
2487
|
+
{
|
|
2488
|
+
id: "commit_preview",
|
|
2489
|
+
tool: "gtm_campaign_build_plan_commit",
|
|
2490
|
+
arguments: {
|
|
2491
|
+
name: request.campaignName,
|
|
2492
|
+
campaign_brief: request.goal,
|
|
2493
|
+
lead_count: request.targetCount,
|
|
2494
|
+
dry_run: true,
|
|
2495
|
+
confirm: false
|
|
2496
|
+
},
|
|
2497
|
+
safety: "dry-run commit preview only"
|
|
2498
|
+
}
|
|
2499
|
+
],
|
|
2500
|
+
sdk_example: {
|
|
2501
|
+
language: "typescript",
|
|
2502
|
+
code: campaignBuilderBuildKitSdkExample(request, requestFile)
|
|
2503
|
+
},
|
|
2504
|
+
verification: [
|
|
2505
|
+
`${cliBase} campaign-agent proof --request-file ${shellArg(requestFile)} --json`,
|
|
2506
|
+
`${cliBase} campaign-agent doctor --request-file ${shellArg(requestFile)} --json`,
|
|
2507
|
+
"Confirm proof.success is true and dry_run_result.status is dry_run before any approved launch.",
|
|
2508
|
+
"Confirm no campaign_build_id exists in a proof receipt before moving to approved launch."
|
|
2509
|
+
],
|
|
2510
|
+
privacy: {
|
|
2511
|
+
client_names_allowed: false,
|
|
2512
|
+
notes: [
|
|
2513
|
+
"Use strategy templates, operating playbooks, and anonymized workflow patterns instead of client names.",
|
|
2514
|
+
"Do not include raw leads, private replies, domains, secrets, or customer account labels in public kit output."
|
|
2515
|
+
]
|
|
2516
|
+
},
|
|
2517
|
+
next_actions: [
|
|
2518
|
+
`Write or review ${requestFile}.`,
|
|
2519
|
+
"Run the proof command before spending credits or activating provider writes.",
|
|
2520
|
+
"Add BYO integrations with --custom-tool provider:layer:tool[:mcp] or the request_fragment shape.",
|
|
2521
|
+
"Use build-approved only after human approval, spend limit, and delivery review policy are set."
|
|
2522
|
+
]
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2372
2525
|
function createCampaignBuilderToolRoute(input) {
|
|
2373
2526
|
return {
|
|
2374
2527
|
provider: input.provider ?? "custom_mcp",
|
|
@@ -2384,6 +2537,63 @@ function createCampaignBuilderToolRoute(input) {
|
|
|
2384
2537
|
rationale: `${input.label ?? input.provider ?? "Custom tool"} is a user-provided campaign-builder route for ${input.layer}.`
|
|
2385
2538
|
};
|
|
2386
2539
|
}
|
|
2540
|
+
function campaignBuilderBuildKitMcpArgs(request) {
|
|
2541
|
+
return compact({
|
|
2542
|
+
goal: request.goal,
|
|
2543
|
+
campaign_brief: request.goal,
|
|
2544
|
+
campaign_name: request.campaignName,
|
|
2545
|
+
account_label: request.accountLabel,
|
|
2546
|
+
account_context: request.accountContext,
|
|
2547
|
+
strategy_template: request.strategyTemplate,
|
|
2548
|
+
operating_playbooks: request.operatingPlaybooks,
|
|
2549
|
+
target_icp: request.icp,
|
|
2550
|
+
target_count: request.targetCount,
|
|
2551
|
+
builtins: request.builtIns,
|
|
2552
|
+
include_local_leads: request.builtIns?.includes("local_leads") || void 0,
|
|
2553
|
+
preferred_providers: request.preferredProviders,
|
|
2554
|
+
custom_tools: request.integrations?.map((route) => compact({
|
|
2555
|
+
provider: route.provider,
|
|
2556
|
+
layer: route.layer,
|
|
2557
|
+
gtm_layers: route.gtmLayers ?? (route.gtmLayer ? [route.gtmLayer] : void 0),
|
|
2558
|
+
tool: route.toolName,
|
|
2559
|
+
mcp: route.mcpServerName,
|
|
2560
|
+
mode: route.mode,
|
|
2561
|
+
approval_required: route.approvalRequired
|
|
2562
|
+
})),
|
|
2563
|
+
include_nango_catalog: request.agencyContext?.includeNangoCatalog,
|
|
2564
|
+
include_memory: request.memory?.enabled,
|
|
2565
|
+
include_brain: true,
|
|
2566
|
+
include_provider_routes: true,
|
|
2567
|
+
include_delivery_risk: true
|
|
2568
|
+
});
|
|
2569
|
+
}
|
|
2570
|
+
function campaignBuilderBuildKitSdkExample(request, requestFile) {
|
|
2571
|
+
const proofRequest = {
|
|
2572
|
+
goal: request.goal,
|
|
2573
|
+
strategyTemplate: request.strategyTemplate,
|
|
2574
|
+
targetCount: request.targetCount,
|
|
2575
|
+
builtIns: request.builtIns,
|
|
2576
|
+
integrations: request.integrations
|
|
2577
|
+
};
|
|
2578
|
+
return [
|
|
2579
|
+
"import { Signaliz, createCampaignBuilderBuildKit } from '@signaliz/sdk';",
|
|
2580
|
+
"",
|
|
2581
|
+
`const kit = createCampaignBuilderBuildKit({ requestFile: ${JSON.stringify(requestFile)}, ...${JSON.stringify(proofRequest, null, 2)} });`,
|
|
2582
|
+
"console.log(kit.cli_commands.find((command) => command.id === 'proof_shortcut')?.command);",
|
|
2583
|
+
"",
|
|
2584
|
+
"const signaliz = new Signaliz({ apiKey: process.env.SIGNALIZ_API_KEY! });",
|
|
2585
|
+
"const proof = await signaliz.campaignBuilderAgent.proof(kit.request, {",
|
|
2586
|
+
" idempotencyKey: `campaign-agent-proof-${Date.now()}`,",
|
|
2587
|
+
"});",
|
|
2588
|
+
"",
|
|
2589
|
+
'if (!proof.success || proof.dry_run_result?.status !== "dry_run") {',
|
|
2590
|
+
" throw new Error('Campaign proof failed or launched work unexpectedly');",
|
|
2591
|
+
"}"
|
|
2592
|
+
].join("\n");
|
|
2593
|
+
}
|
|
2594
|
+
function shellArg(value) {
|
|
2595
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
2596
|
+
}
|
|
2387
2597
|
function normalizeTemplateKey(value) {
|
|
2388
2598
|
return String(value || "").trim().toLowerCase().replace(/[_\s]+/g, "-");
|
|
2389
2599
|
}
|
|
@@ -6743,6 +6953,7 @@ export {
|
|
|
6743
6953
|
getCampaignBuilderOperatingPlaybooksForRequest,
|
|
6744
6954
|
applyCampaignBuilderStrategyTemplate,
|
|
6745
6955
|
createCampaignBuilderAgentRequestTemplate,
|
|
6956
|
+
createCampaignBuilderBuildKit,
|
|
6746
6957
|
createCampaignBuilderToolRoute,
|
|
6747
6958
|
Icps,
|
|
6748
6959
|
normalizeExecutionReference,
|
package/dist/cli.js
CHANGED
|
@@ -1711,6 +1711,9 @@ var CampaignBuilderAgent = class {
|
|
|
1711
1711
|
});
|
|
1712
1712
|
return createCampaignBuilderProofReceipt(plan, result);
|
|
1713
1713
|
}
|
|
1714
|
+
buildKit(options = {}) {
|
|
1715
|
+
return createCampaignBuilderBuildKit(options);
|
|
1716
|
+
}
|
|
1714
1717
|
async commitPlan(plan, options = {}) {
|
|
1715
1718
|
const writeMode = options.confirm === true && options.dryRun === false;
|
|
1716
1719
|
if (writeMode && !options.approvedBy) {
|
|
@@ -2375,6 +2378,156 @@ function createCampaignBuilderAgentRequestTemplate(input = {}) {
|
|
|
2375
2378
|
}
|
|
2376
2379
|
});
|
|
2377
2380
|
}
|
|
2381
|
+
function createCampaignBuilderBuildKit(input = {}) {
|
|
2382
|
+
const requestFile = input.requestFile || "campaign-request.json";
|
|
2383
|
+
const cliPackage = input.cliPackage || "@signaliz/cli";
|
|
2384
|
+
const sdkPackage = input.sdkPackage || "@signaliz/sdk";
|
|
2385
|
+
const request = createCampaignBuilderAgentRequestTemplate(input);
|
|
2386
|
+
const strategyTemplate = stringValue(request.strategyTemplate) ?? null;
|
|
2387
|
+
const builtIns = request.builtIns ?? DEFAULT_CAMPAIGN_BUILDER_BUILT_INS;
|
|
2388
|
+
const useLocalLeads = builtIns.includes("local_leads");
|
|
2389
|
+
const customRoutes = [
|
|
2390
|
+
...request.integrations ?? [],
|
|
2391
|
+
...routesFromCustomerTools(request.customerTools ?? [])
|
|
2392
|
+
].filter((route) => route.provider !== "signaliz");
|
|
2393
|
+
const strategyFlag = strategyTemplate ? ` --strategy-template ${shellArg(strategyTemplate)}` : "";
|
|
2394
|
+
const targetFlag = request.targetCount ? ` --target-count ${request.targetCount}` : "";
|
|
2395
|
+
const localLeadsFlag = useLocalLeads ? " --use-local-leads" : "";
|
|
2396
|
+
const cliBase = `npx ${cliPackage}`;
|
|
2397
|
+
const sdkCliBase = `npx ${sdkPackage}`;
|
|
2398
|
+
const brief = request.goal || "Build a strategy-template campaign for the target ICP.";
|
|
2399
|
+
const mcpArgs = campaignBuilderBuildKitMcpArgs(request);
|
|
2400
|
+
return {
|
|
2401
|
+
kit_version: "campaign-builder-kit.v1",
|
|
2402
|
+
source: "signaliz.campaignBuilderAgent.buildKit",
|
|
2403
|
+
request_file: requestFile,
|
|
2404
|
+
request,
|
|
2405
|
+
strategy_template: strategyTemplate,
|
|
2406
|
+
built_in_lanes: builtIns,
|
|
2407
|
+
operating_playbooks: getCampaignBuilderOperatingPlaybooksForRequest(request).map((playbook) => playbook.slug),
|
|
2408
|
+
custom_routes: customRoutes.map((route) => ({
|
|
2409
|
+
provider: String(route.provider),
|
|
2410
|
+
layer: String(route.layer),
|
|
2411
|
+
tool: firstNonEmptyString(route.toolName),
|
|
2412
|
+
mcp_server: firstNonEmptyString(route.mcpServerName),
|
|
2413
|
+
mode: route.mode ?? "if_available",
|
|
2414
|
+
approval_required: route.approvalRequired === true || route.mode === "required"
|
|
2415
|
+
})),
|
|
2416
|
+
approval_boundaries: request.approvalPolicy?.requireApprovalFor ?? DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES,
|
|
2417
|
+
byo_tool_pattern: {
|
|
2418
|
+
cli_flag: "--custom-tool provider:layer:tool[:mcp]",
|
|
2419
|
+
request_fragment: createCampaignBuilderToolRoute({
|
|
2420
|
+
provider: "workspace_mcp",
|
|
2421
|
+
layer: "enrichment",
|
|
2422
|
+
gtmLayers: ["company_enrichment"],
|
|
2423
|
+
toolName: "workspace_account_enrich",
|
|
2424
|
+
mcpServerName: "workspace-mcp",
|
|
2425
|
+
label: "Workspace account enrichment",
|
|
2426
|
+
mode: "required",
|
|
2427
|
+
approvalRequired: true
|
|
2428
|
+
})
|
|
2429
|
+
},
|
|
2430
|
+
cli_commands: [
|
|
2431
|
+
{
|
|
2432
|
+
id: "write_request",
|
|
2433
|
+
label: "Write reusable request JSON",
|
|
2434
|
+
command: `${cliBase} campaign-agent init${strategyFlag}${targetFlag}${localLeadsFlag} --output-file ${shellArg(requestFile)}`,
|
|
2435
|
+
safety: "local file only; no MCP calls, credits, provider writes, sender loads, exports, or sends"
|
|
2436
|
+
},
|
|
2437
|
+
{
|
|
2438
|
+
id: "proof_shortcut",
|
|
2439
|
+
label: "Run no-spend campaign-builder proof",
|
|
2440
|
+
command: `${cliBase} build ${shellArg(brief)}${strategyFlag}${targetFlag}${localLeadsFlag} --json`,
|
|
2441
|
+
safety: "strategy memory, Kernel plan, approvals, and forced build_campaign dry-run only"
|
|
2442
|
+
},
|
|
2443
|
+
{
|
|
2444
|
+
id: "plan",
|
|
2445
|
+
label: "Inspect the full campaign-agent plan",
|
|
2446
|
+
command: `${sdkCliBase} campaign-agent plan --request-file ${shellArg(requestFile)} --json`,
|
|
2447
|
+
safety: "read-only MCP planning and provider-route dry-runs"
|
|
2448
|
+
},
|
|
2449
|
+
{
|
|
2450
|
+
id: "doctor",
|
|
2451
|
+
label: "Check readiness gates",
|
|
2452
|
+
command: `${sdkCliBase} campaign-agent doctor --request-file ${shellArg(requestFile)} --json`,
|
|
2453
|
+
safety: "read-only readiness checks for Memory, Brain, built-ins, BYO routes, and approvals"
|
|
2454
|
+
},
|
|
2455
|
+
{
|
|
2456
|
+
id: "commit_preview",
|
|
2457
|
+
label: "Preview GTM campaign object commit",
|
|
2458
|
+
command: `${sdkCliBase} campaign-agent commit-plan --request-file ${shellArg(requestFile)} --json`,
|
|
2459
|
+
safety: "dry-run commit; writes only with --confirm-write and --approved-by"
|
|
2460
|
+
},
|
|
2461
|
+
{
|
|
2462
|
+
id: "approved_launch",
|
|
2463
|
+
label: "Launch after explicit approval",
|
|
2464
|
+
command: `${sdkCliBase} campaign-agent build-approved --request-file ${shellArg(requestFile)} --confirm-launch --approve-all --approved-by operator@example.com --spend-limit ${request.signalizDefaults?.maxCredits ?? 0} --json`,
|
|
2465
|
+
safety: "spendful path; requires human approval identity, approval types, and spend limit"
|
|
2466
|
+
}
|
|
2467
|
+
],
|
|
2468
|
+
mcp_calls: [
|
|
2469
|
+
{
|
|
2470
|
+
id: "request_template",
|
|
2471
|
+
tool: "gtm_campaign_agent_request_template",
|
|
2472
|
+
arguments: mcpArgs,
|
|
2473
|
+
safety: "read-only reusable request generation"
|
|
2474
|
+
},
|
|
2475
|
+
{
|
|
2476
|
+
id: "readiness",
|
|
2477
|
+
tool: "gtm_campaign_agent_readiness",
|
|
2478
|
+
arguments: mcpArgs,
|
|
2479
|
+
safety: "read-only preflight across strategy memory, Kernel plan, lanes, routes, and approvals"
|
|
2480
|
+
},
|
|
2481
|
+
{
|
|
2482
|
+
id: "proof",
|
|
2483
|
+
tool: "gtm_campaign_agent_proof",
|
|
2484
|
+
arguments: { ...mcpArgs, idempotency_key: "campaign-agent-proof-001" },
|
|
2485
|
+
safety: "forces build_campaign dry_run=true and confirm_spend=false"
|
|
2486
|
+
},
|
|
2487
|
+
{
|
|
2488
|
+
id: "plan",
|
|
2489
|
+
tool: "gtm_campaign_agent_plan",
|
|
2490
|
+
arguments: mcpArgs,
|
|
2491
|
+
safety: "read-only one-call campaign-agent runbook"
|
|
2492
|
+
},
|
|
2493
|
+
{
|
|
2494
|
+
id: "commit_preview",
|
|
2495
|
+
tool: "gtm_campaign_build_plan_commit",
|
|
2496
|
+
arguments: {
|
|
2497
|
+
name: request.campaignName,
|
|
2498
|
+
campaign_brief: request.goal,
|
|
2499
|
+
lead_count: request.targetCount,
|
|
2500
|
+
dry_run: true,
|
|
2501
|
+
confirm: false
|
|
2502
|
+
},
|
|
2503
|
+
safety: "dry-run commit preview only"
|
|
2504
|
+
}
|
|
2505
|
+
],
|
|
2506
|
+
sdk_example: {
|
|
2507
|
+
language: "typescript",
|
|
2508
|
+
code: campaignBuilderBuildKitSdkExample(request, requestFile)
|
|
2509
|
+
},
|
|
2510
|
+
verification: [
|
|
2511
|
+
`${cliBase} campaign-agent proof --request-file ${shellArg(requestFile)} --json`,
|
|
2512
|
+
`${cliBase} campaign-agent doctor --request-file ${shellArg(requestFile)} --json`,
|
|
2513
|
+
"Confirm proof.success is true and dry_run_result.status is dry_run before any approved launch.",
|
|
2514
|
+
"Confirm no campaign_build_id exists in a proof receipt before moving to approved launch."
|
|
2515
|
+
],
|
|
2516
|
+
privacy: {
|
|
2517
|
+
client_names_allowed: false,
|
|
2518
|
+
notes: [
|
|
2519
|
+
"Use strategy templates, operating playbooks, and anonymized workflow patterns instead of client names.",
|
|
2520
|
+
"Do not include raw leads, private replies, domains, secrets, or customer account labels in public kit output."
|
|
2521
|
+
]
|
|
2522
|
+
},
|
|
2523
|
+
next_actions: [
|
|
2524
|
+
`Write or review ${requestFile}.`,
|
|
2525
|
+
"Run the proof command before spending credits or activating provider writes.",
|
|
2526
|
+
"Add BYO integrations with --custom-tool provider:layer:tool[:mcp] or the request_fragment shape.",
|
|
2527
|
+
"Use build-approved only after human approval, spend limit, and delivery review policy are set."
|
|
2528
|
+
]
|
|
2529
|
+
};
|
|
2530
|
+
}
|
|
2378
2531
|
function createCampaignBuilderToolRoute(input) {
|
|
2379
2532
|
return {
|
|
2380
2533
|
provider: input.provider ?? "custom_mcp",
|
|
@@ -2390,6 +2543,63 @@ function createCampaignBuilderToolRoute(input) {
|
|
|
2390
2543
|
rationale: `${input.label ?? input.provider ?? "Custom tool"} is a user-provided campaign-builder route for ${input.layer}.`
|
|
2391
2544
|
};
|
|
2392
2545
|
}
|
|
2546
|
+
function campaignBuilderBuildKitMcpArgs(request) {
|
|
2547
|
+
return compact({
|
|
2548
|
+
goal: request.goal,
|
|
2549
|
+
campaign_brief: request.goal,
|
|
2550
|
+
campaign_name: request.campaignName,
|
|
2551
|
+
account_label: request.accountLabel,
|
|
2552
|
+
account_context: request.accountContext,
|
|
2553
|
+
strategy_template: request.strategyTemplate,
|
|
2554
|
+
operating_playbooks: request.operatingPlaybooks,
|
|
2555
|
+
target_icp: request.icp,
|
|
2556
|
+
target_count: request.targetCount,
|
|
2557
|
+
builtins: request.builtIns,
|
|
2558
|
+
include_local_leads: request.builtIns?.includes("local_leads") || void 0,
|
|
2559
|
+
preferred_providers: request.preferredProviders,
|
|
2560
|
+
custom_tools: request.integrations?.map((route) => compact({
|
|
2561
|
+
provider: route.provider,
|
|
2562
|
+
layer: route.layer,
|
|
2563
|
+
gtm_layers: route.gtmLayers ?? (route.gtmLayer ? [route.gtmLayer] : void 0),
|
|
2564
|
+
tool: route.toolName,
|
|
2565
|
+
mcp: route.mcpServerName,
|
|
2566
|
+
mode: route.mode,
|
|
2567
|
+
approval_required: route.approvalRequired
|
|
2568
|
+
})),
|
|
2569
|
+
include_nango_catalog: request.agencyContext?.includeNangoCatalog,
|
|
2570
|
+
include_memory: request.memory?.enabled,
|
|
2571
|
+
include_brain: true,
|
|
2572
|
+
include_provider_routes: true,
|
|
2573
|
+
include_delivery_risk: true
|
|
2574
|
+
});
|
|
2575
|
+
}
|
|
2576
|
+
function campaignBuilderBuildKitSdkExample(request, requestFile) {
|
|
2577
|
+
const proofRequest = {
|
|
2578
|
+
goal: request.goal,
|
|
2579
|
+
strategyTemplate: request.strategyTemplate,
|
|
2580
|
+
targetCount: request.targetCount,
|
|
2581
|
+
builtIns: request.builtIns,
|
|
2582
|
+
integrations: request.integrations
|
|
2583
|
+
};
|
|
2584
|
+
return [
|
|
2585
|
+
"import { Signaliz, createCampaignBuilderBuildKit } from '@signaliz/sdk';",
|
|
2586
|
+
"",
|
|
2587
|
+
`const kit = createCampaignBuilderBuildKit({ requestFile: ${JSON.stringify(requestFile)}, ...${JSON.stringify(proofRequest, null, 2)} });`,
|
|
2588
|
+
"console.log(kit.cli_commands.find((command) => command.id === 'proof_shortcut')?.command);",
|
|
2589
|
+
"",
|
|
2590
|
+
"const signaliz = new Signaliz({ apiKey: process.env.SIGNALIZ_API_KEY! });",
|
|
2591
|
+
"const proof = await signaliz.campaignBuilderAgent.proof(kit.request, {",
|
|
2592
|
+
" idempotencyKey: `campaign-agent-proof-${Date.now()}`,",
|
|
2593
|
+
"});",
|
|
2594
|
+
"",
|
|
2595
|
+
'if (!proof.success || proof.dry_run_result?.status !== "dry_run") {',
|
|
2596
|
+
" throw new Error('Campaign proof failed or launched work unexpectedly');",
|
|
2597
|
+
"}"
|
|
2598
|
+
].join("\n");
|
|
2599
|
+
}
|
|
2600
|
+
function shellArg(value) {
|
|
2601
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
2602
|
+
}
|
|
2393
2603
|
function normalizeTemplateKey(value) {
|
|
2394
2604
|
return String(value || "").trim().toLowerCase().replace(/[_\s]+/g, "-");
|
|
2395
2605
|
}
|
|
@@ -6739,7 +6949,7 @@ async function main() {
|
|
|
6739
6949
|
printHelp();
|
|
6740
6950
|
return;
|
|
6741
6951
|
}
|
|
6742
|
-
const offlineCampaignAgentTemplate = (command === "campaign-agent" || command === "campaign-builder") && ["init", "template", "request-template", "new"].includes(String(process.argv[3] || ""));
|
|
6952
|
+
const offlineCampaignAgentTemplate = (command === "campaign-agent" || command === "campaign-builder") && ["init", "template", "request-template", "new", "kit", "build-kit", "blueprint"].includes(String(process.argv[3] || ""));
|
|
6743
6953
|
if (!apiKey && !offlineCampaignAgentTemplate) {
|
|
6744
6954
|
console.error("\u274C SIGNALIZ_API_KEY environment variable is required.");
|
|
6745
6955
|
console.error(" Set it with: export SIGNALIZ_API_KEY=sk_...");
|
|
@@ -7103,6 +7313,38 @@ async function handleCampaignAgentCommand(signaliz, argv) {
|
|
|
7103
7313
|
}
|
|
7104
7314
|
return;
|
|
7105
7315
|
}
|
|
7316
|
+
if (["kit", "build-kit", "blueprint"].includes(subcommand)) {
|
|
7317
|
+
const flags2 = parseFlags(argv.slice(1));
|
|
7318
|
+
const requestFromFile2 = campaignAgentRequestFileFromFlags(flags2);
|
|
7319
|
+
const fallbackGoal = stringFlag(flags2, "goal", "brief") || stringOrUndefined(requestFromFile2?.goal) || "Build a strategy-template campaign for mature operators in the target ICP.";
|
|
7320
|
+
const request2 = requestFromFile2 ? mergeCampaignAgentRequests(
|
|
7321
|
+
requestFromFile2,
|
|
7322
|
+
campaignAgentRequestFromFlags(fallbackGoal, flags2, { includeDefaults: false })
|
|
7323
|
+
) : campaignAgentRequestTemplateFromFlags(flags2);
|
|
7324
|
+
const kit = createCampaignBuilderBuildKit({
|
|
7325
|
+
...request2,
|
|
7326
|
+
includeLocalLeads: booleanFlag(flags2, "use-local-leads"),
|
|
7327
|
+
includeCustomToolPlaceholder: booleanFlag(flags2, "with-byo-placeholder") || booleanFlag(flags2, "include-custom-tool-placeholder") || booleanFlag(flags2, "include-byo-placeholder"),
|
|
7328
|
+
includeNango: !booleanFlag(flags2, "no-nango-catalog"),
|
|
7329
|
+
requestFile: stringFlag(flags2, "request-output-file", "request-file-name") || stringFlag(flags2, "request-file") || "campaign-request.json",
|
|
7330
|
+
cliPackage: stringFlag(flags2, "cli-package"),
|
|
7331
|
+
sdkPackage: stringFlag(flags2, "sdk-package")
|
|
7332
|
+
});
|
|
7333
|
+
const outputFile = stringFlag(flags2, "output-file", "kit-file", "out");
|
|
7334
|
+
if (outputFile) {
|
|
7335
|
+
(0, import_node_fs.writeFileSync)(outputFile, `${JSON.stringify(kit, null, 2)}
|
|
7336
|
+
`, "utf8");
|
|
7337
|
+
}
|
|
7338
|
+
if (booleanFlag(flags2, "json")) {
|
|
7339
|
+
printJson(kit);
|
|
7340
|
+
} else if (!outputFile) {
|
|
7341
|
+
printCampaignAgentBuildKit(kit);
|
|
7342
|
+
} else {
|
|
7343
|
+
console.log(`Campaign build kit written: ${outputFile}`);
|
|
7344
|
+
console.log(`Next: ${kit.cli_commands.find((command) => command.id === "proof_shortcut")?.command}`);
|
|
7345
|
+
}
|
|
7346
|
+
return;
|
|
7347
|
+
}
|
|
7106
7348
|
if (["review", "status", "rows", "artifacts", "approve", "approve-delivery"].includes(subcommand)) {
|
|
7107
7349
|
await handleCampaignAgentReviewCommand(signaliz, subcommand, argv.slice(1));
|
|
7108
7350
|
return;
|
|
@@ -7629,6 +7871,25 @@ function printCampaignAgentPlan(plan) {
|
|
|
7629
7871
|
console.log(`- ${step.id}: ${step.tool}${step.approvalRequired ? " (approval required)" : ""}`);
|
|
7630
7872
|
}
|
|
7631
7873
|
}
|
|
7874
|
+
function printCampaignAgentBuildKit(kit) {
|
|
7875
|
+
console.log(`Campaign build kit: ${kit.strategy_template || "custom strategy"}`);
|
|
7876
|
+
console.log(`Request file: ${kit.request_file}`);
|
|
7877
|
+
console.log(`Built-ins: ${kit.built_in_lanes.join(", ") || "none"}`);
|
|
7878
|
+
console.log(`Playbooks: ${kit.operating_playbooks.join(", ") || "none"}`);
|
|
7879
|
+
console.log(`BYO routes: ${kit.custom_routes.length}`);
|
|
7880
|
+
console.log("\nCLI:");
|
|
7881
|
+
for (const command of kit.cli_commands.slice(0, 4)) {
|
|
7882
|
+
console.log(`- ${command.label}: ${command.command}`);
|
|
7883
|
+
}
|
|
7884
|
+
console.log("\nMCP:");
|
|
7885
|
+
for (const call of kit.mcp_calls.slice(0, 3)) {
|
|
7886
|
+
console.log(`- ${call.tool}: ${call.safety}`);
|
|
7887
|
+
}
|
|
7888
|
+
console.log("\nBYO tool pattern:");
|
|
7889
|
+
console.log(`- ${kit.byo_tool_pattern.cli_flag}`);
|
|
7890
|
+
console.log("\nNext:");
|
|
7891
|
+
for (const action of kit.next_actions.slice(0, 4)) console.log(`- ${action}`);
|
|
7892
|
+
}
|
|
7632
7893
|
function printCampaignAgentExecution(payload, flags) {
|
|
7633
7894
|
if (booleanFlag(flags, "json")) {
|
|
7634
7895
|
printJson(payload);
|
|
@@ -7826,6 +8087,7 @@ function printCampaignAgentHelp() {
|
|
|
7826
8087
|
Signaliz campaign-agent commands:
|
|
7827
8088
|
|
|
7828
8089
|
signaliz campaign-agent init [--goal TEXT] [--strategy-template ID] [--target-count N] [--use-local-leads] [--with-byo-placeholder] [--output-file FILE] [--json]
|
|
8090
|
+
signaliz campaign-agent kit [--goal TEXT | --request-file FILE] [--strategy-template ID] [--target-count N] [--use-local-leads] [--custom-tool provider:layer:tool[:mcp]] [--output-file FILE] [--json]
|
|
7829
8091
|
signaliz campaign-agent doctor [--goal TEXT | --request-file FILE] [--strategy-template ID] [--target-count N] [--builtins lead_generation,email_finding,email_verification,signals,local_leads] [--custom-tool provider:layer:tool[:mcp]] [--json]
|
|
7830
8092
|
signaliz campaign-agent plan (--goal TEXT | --request-file FILE) [--campaign-name NAME] [--workspace-label NAME] [--strategy-template industrial-ot-resilience|non-medical-home-care|agency-founder-led|cloud-infrastructure-displacement] [--operating-playbooks proof-first-vertical-gate,signal-led-copy-approval] [--target-count N] [--icp JSON] [--builtins lead_generation,email_finding,email_verification,signals,local_leads] [--use-local-leads] [--custom-tool provider:layer:tool[:mcp]] [--preferred-providers signaliz_native,octave] [--partners clay,instantly,nango] [--no-strategy-memory] [--no-kernel-plan] [--no-delivery-risk] [--json]
|
|
7831
8093
|
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]
|
|
@@ -7838,7 +8100,7 @@ Signaliz campaign-agent commands:
|
|
|
7838
8100
|
signaliz campaign-agent artifacts <campaign_build_id> [--json]
|
|
7839
8101
|
signaliz campaign-agent approve <campaign_build_id> --destination-type json|csv|webhook [--destination-config JSON] [--json]
|
|
7840
8102
|
|
|
7841
|
-
The init command emits a reusable JSON CampaignBuilderAgentRequest. Doctor returns a readiness packet for built-in lanes, BYO routes, Memory, Brain, Kernel planning, and approval gates. 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 review to inspect status, sampled rows, artifacts, and delivery-readiness gates before approving delivery or routing rows to external tools.
|
|
8103
|
+
The init command emits a reusable JSON CampaignBuilderAgentRequest. Kit emits the full build packet: request JSON, exact CLI commands, MCP calls, SDK example, approval boundaries, and BYO integration pattern. Doctor returns a readiness packet for built-in lanes, BYO routes, Memory, Brain, Kernel planning, and approval gates. 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 review to inspect status, sampled rows, artifacts, and delivery-readiness gates before approving delivery or routing rows to external tools.
|
|
7842
8104
|
`);
|
|
7843
8105
|
}
|
|
7844
8106
|
main().catch((e) => {
|