@signaliz/sdk 1.0.14 → 1.0.16
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 +30 -0
- package/dist/{chunk-EVFQETTN.mjs → chunk-5JNKSMNW.mjs} +441 -0
- package/dist/cli.js +550 -2
- package/dist/cli.mjs +115 -4
- package/dist/index.d.mts +103 -1
- package/dist/index.d.ts +103 -1
- package/dist/index.js +443 -0
- package/dist/index.mjs +5 -1
- package/dist/mcp-config.js +541 -0
- package/dist/mcp-config.mjs +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1711,6 +1711,12 @@ var CampaignBuilderAgent = class {
|
|
|
1711
1711
|
});
|
|
1712
1712
|
return createCampaignBuilderProofReceipt(plan, result);
|
|
1713
1713
|
}
|
|
1714
|
+
buildKit(options = {}) {
|
|
1715
|
+
return createCampaignBuilderBuildKit(options);
|
|
1716
|
+
}
|
|
1717
|
+
memoryKit(options = {}) {
|
|
1718
|
+
return createCampaignBuilderMemoryKit(options);
|
|
1719
|
+
}
|
|
1714
1720
|
async commitPlan(plan, options = {}) {
|
|
1715
1721
|
const writeMode = options.confirm === true && options.dryRun === false;
|
|
1716
1722
|
if (writeMode && !options.approvedBy) {
|
|
@@ -2375,6 +2381,303 @@ function createCampaignBuilderAgentRequestTemplate(input = {}) {
|
|
|
2375
2381
|
}
|
|
2376
2382
|
});
|
|
2377
2383
|
}
|
|
2384
|
+
function createCampaignBuilderBuildKit(input = {}) {
|
|
2385
|
+
const requestFile = input.requestFile || "campaign-request.json";
|
|
2386
|
+
const cliPackage = input.cliPackage || "@signaliz/cli";
|
|
2387
|
+
const sdkPackage = input.sdkPackage || "@signaliz/sdk";
|
|
2388
|
+
const request = createCampaignBuilderAgentRequestTemplate(input);
|
|
2389
|
+
const strategyTemplate = stringValue(request.strategyTemplate) ?? null;
|
|
2390
|
+
const builtIns = request.builtIns ?? DEFAULT_CAMPAIGN_BUILDER_BUILT_INS;
|
|
2391
|
+
const useLocalLeads = builtIns.includes("local_leads");
|
|
2392
|
+
const customRoutes = [
|
|
2393
|
+
...request.integrations ?? [],
|
|
2394
|
+
...routesFromCustomerTools(request.customerTools ?? [])
|
|
2395
|
+
].filter((route) => route.provider !== "signaliz");
|
|
2396
|
+
const strategyFlag = strategyTemplate ? ` --strategy-template ${shellArg(strategyTemplate)}` : "";
|
|
2397
|
+
const targetFlag = request.targetCount ? ` --target-count ${request.targetCount}` : "";
|
|
2398
|
+
const localLeadsFlag = useLocalLeads ? " --use-local-leads" : "";
|
|
2399
|
+
const cliBase = `npx ${cliPackage}`;
|
|
2400
|
+
const sdkCliBase = `npx ${sdkPackage}`;
|
|
2401
|
+
const brief = request.goal || "Build a strategy-template campaign for the target ICP.";
|
|
2402
|
+
const mcpArgs = campaignBuilderBuildKitMcpArgs(request);
|
|
2403
|
+
return {
|
|
2404
|
+
kit_version: "campaign-builder-kit.v1",
|
|
2405
|
+
source: "signaliz.campaignBuilderAgent.buildKit",
|
|
2406
|
+
request_file: requestFile,
|
|
2407
|
+
request,
|
|
2408
|
+
strategy_template: strategyTemplate,
|
|
2409
|
+
built_in_lanes: builtIns,
|
|
2410
|
+
operating_playbooks: getCampaignBuilderOperatingPlaybooksForRequest(request).map((playbook) => playbook.slug),
|
|
2411
|
+
custom_routes: customRoutes.map((route) => ({
|
|
2412
|
+
provider: String(route.provider),
|
|
2413
|
+
layer: String(route.layer),
|
|
2414
|
+
tool: firstNonEmptyString(route.toolName),
|
|
2415
|
+
mcp_server: firstNonEmptyString(route.mcpServerName),
|
|
2416
|
+
mode: route.mode ?? "if_available",
|
|
2417
|
+
approval_required: route.approvalRequired === true || route.mode === "required"
|
|
2418
|
+
})),
|
|
2419
|
+
approval_boundaries: request.approvalPolicy?.requireApprovalFor ?? DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES,
|
|
2420
|
+
byo_tool_pattern: {
|
|
2421
|
+
cli_flag: "--custom-tool provider:layer:tool[:mcp]",
|
|
2422
|
+
request_fragment: createCampaignBuilderToolRoute({
|
|
2423
|
+
provider: "workspace_mcp",
|
|
2424
|
+
layer: "enrichment",
|
|
2425
|
+
gtmLayers: ["company_enrichment"],
|
|
2426
|
+
toolName: "workspace_account_enrich",
|
|
2427
|
+
mcpServerName: "workspace-mcp",
|
|
2428
|
+
label: "Workspace account enrichment",
|
|
2429
|
+
mode: "required",
|
|
2430
|
+
approvalRequired: true
|
|
2431
|
+
})
|
|
2432
|
+
},
|
|
2433
|
+
cli_commands: [
|
|
2434
|
+
{
|
|
2435
|
+
id: "write_request",
|
|
2436
|
+
label: "Write reusable request JSON",
|
|
2437
|
+
command: `${cliBase} campaign-agent init${strategyFlag}${targetFlag}${localLeadsFlag} --output-file ${shellArg(requestFile)}`,
|
|
2438
|
+
safety: "local file only; no MCP calls, credits, provider writes, sender loads, exports, or sends"
|
|
2439
|
+
},
|
|
2440
|
+
{
|
|
2441
|
+
id: "memory_kit",
|
|
2442
|
+
label: "Inspect memory readiness and seed runner",
|
|
2443
|
+
command: `${sdkCliBase} campaign-agent memory-kit${strategyFlag}${targetFlag}${localLeadsFlag} --request-file ${shellArg(requestFile)} --json`,
|
|
2444
|
+
safety: "read-only memory readiness packet plus local seed dry-run commands"
|
|
2445
|
+
},
|
|
2446
|
+
{
|
|
2447
|
+
id: "proof_shortcut",
|
|
2448
|
+
label: "Run no-spend campaign-builder proof",
|
|
2449
|
+
command: `${cliBase} build ${shellArg(brief)}${strategyFlag}${targetFlag}${localLeadsFlag} --json`,
|
|
2450
|
+
safety: "strategy memory, Kernel plan, approvals, and forced build_campaign dry-run only"
|
|
2451
|
+
},
|
|
2452
|
+
{
|
|
2453
|
+
id: "plan",
|
|
2454
|
+
label: "Inspect the full campaign-agent plan",
|
|
2455
|
+
command: `${sdkCliBase} campaign-agent plan --request-file ${shellArg(requestFile)} --json`,
|
|
2456
|
+
safety: "read-only MCP planning and provider-route dry-runs"
|
|
2457
|
+
},
|
|
2458
|
+
{
|
|
2459
|
+
id: "doctor",
|
|
2460
|
+
label: "Check readiness gates",
|
|
2461
|
+
command: `${sdkCliBase} campaign-agent doctor --request-file ${shellArg(requestFile)} --json`,
|
|
2462
|
+
safety: "read-only readiness checks for Memory, Brain, built-ins, BYO routes, and approvals"
|
|
2463
|
+
},
|
|
2464
|
+
{
|
|
2465
|
+
id: "commit_preview",
|
|
2466
|
+
label: "Preview GTM campaign object commit",
|
|
2467
|
+
command: `${sdkCliBase} campaign-agent commit-plan --request-file ${shellArg(requestFile)} --json`,
|
|
2468
|
+
safety: "dry-run commit; writes only with --confirm-write and --approved-by"
|
|
2469
|
+
},
|
|
2470
|
+
{
|
|
2471
|
+
id: "approved_launch",
|
|
2472
|
+
label: "Launch after explicit approval",
|
|
2473
|
+
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`,
|
|
2474
|
+
safety: "spendful path; requires human approval identity, approval types, and spend limit"
|
|
2475
|
+
}
|
|
2476
|
+
],
|
|
2477
|
+
mcp_calls: [
|
|
2478
|
+
{
|
|
2479
|
+
id: "request_template",
|
|
2480
|
+
tool: "gtm_campaign_agent_request_template",
|
|
2481
|
+
arguments: mcpArgs,
|
|
2482
|
+
safety: "read-only reusable request generation"
|
|
2483
|
+
},
|
|
2484
|
+
{
|
|
2485
|
+
id: "readiness",
|
|
2486
|
+
tool: "gtm_campaign_agent_readiness",
|
|
2487
|
+
arguments: mcpArgs,
|
|
2488
|
+
safety: "read-only preflight across strategy memory, Kernel plan, lanes, routes, and approvals"
|
|
2489
|
+
},
|
|
2490
|
+
{
|
|
2491
|
+
id: "proof",
|
|
2492
|
+
tool: "gtm_campaign_agent_proof",
|
|
2493
|
+
arguments: { ...mcpArgs, idempotency_key: "campaign-agent-proof-001" },
|
|
2494
|
+
safety: "forces build_campaign dry_run=true and confirm_spend=false"
|
|
2495
|
+
},
|
|
2496
|
+
{
|
|
2497
|
+
id: "plan",
|
|
2498
|
+
tool: "gtm_campaign_agent_plan",
|
|
2499
|
+
arguments: mcpArgs,
|
|
2500
|
+
safety: "read-only one-call campaign-agent runbook"
|
|
2501
|
+
},
|
|
2502
|
+
{
|
|
2503
|
+
id: "commit_preview",
|
|
2504
|
+
tool: "gtm_campaign_build_plan_commit",
|
|
2505
|
+
arguments: {
|
|
2506
|
+
name: request.campaignName,
|
|
2507
|
+
campaign_brief: request.goal,
|
|
2508
|
+
lead_count: request.targetCount,
|
|
2509
|
+
dry_run: true,
|
|
2510
|
+
confirm: false
|
|
2511
|
+
},
|
|
2512
|
+
safety: "dry-run commit preview only"
|
|
2513
|
+
}
|
|
2514
|
+
],
|
|
2515
|
+
sdk_example: {
|
|
2516
|
+
language: "typescript",
|
|
2517
|
+
code: campaignBuilderBuildKitSdkExample(request, requestFile)
|
|
2518
|
+
},
|
|
2519
|
+
verification: [
|
|
2520
|
+
`${cliBase} campaign-agent proof --request-file ${shellArg(requestFile)} --json`,
|
|
2521
|
+
`${cliBase} campaign-agent doctor --request-file ${shellArg(requestFile)} --json`,
|
|
2522
|
+
"Confirm proof.success is true and dry_run_result.status is dry_run before any approved launch.",
|
|
2523
|
+
"Confirm no campaign_build_id exists in a proof receipt before moving to approved launch."
|
|
2524
|
+
],
|
|
2525
|
+
privacy: {
|
|
2526
|
+
client_names_allowed: false,
|
|
2527
|
+
notes: [
|
|
2528
|
+
"Use strategy templates, operating playbooks, and anonymized workflow patterns instead of client names.",
|
|
2529
|
+
"Do not include raw leads, private replies, domains, secrets, or customer account labels in public kit output."
|
|
2530
|
+
]
|
|
2531
|
+
},
|
|
2532
|
+
next_actions: [
|
|
2533
|
+
`Write or review ${requestFile}.`,
|
|
2534
|
+
"Run the proof command before spending credits or activating provider writes.",
|
|
2535
|
+
"Add BYO integrations with --custom-tool provider:layer:tool[:mcp] or the request_fragment shape.",
|
|
2536
|
+
"Use build-approved only after human approval, spend limit, and delivery review policy are set."
|
|
2537
|
+
]
|
|
2538
|
+
};
|
|
2539
|
+
}
|
|
2540
|
+
function createCampaignBuilderMemoryKit(input = {}) {
|
|
2541
|
+
const requestFile = input.requestFile || "campaign-request.json";
|
|
2542
|
+
const seedManifestFile = input.seedManifestFile || ".gtm-kernel-import-state/campaign-memory-dry-run.json";
|
|
2543
|
+
const cliPackage = input.cliPackage || "@signaliz/cli";
|
|
2544
|
+
const sdkPackage = input.sdkPackage || "@signaliz/sdk";
|
|
2545
|
+
const request = createCampaignBuilderAgentRequestTemplate(input);
|
|
2546
|
+
const strategyTemplate = stringValue(request.strategyTemplate) ?? null;
|
|
2547
|
+
const strategyFlag = strategyTemplate ? ` --strategy-template ${shellArg(strategyTemplate)}` : "";
|
|
2548
|
+
const targetFlag = request.targetCount ? ` --target-count ${request.targetCount}` : "";
|
|
2549
|
+
const localLeadsFlag = request.builtIns?.includes("local_leads") ? " --use-local-leads" : "";
|
|
2550
|
+
const cliBase = `npx ${cliPackage}`;
|
|
2551
|
+
const sdkCliBase = `npx ${sdkPackage}`;
|
|
2552
|
+
const source = campaignBuilderMemoryKitSource(input.source);
|
|
2553
|
+
const workspaceId = input.workspaceId || "your-workspace-id";
|
|
2554
|
+
const brief = request.goal || "Build a strategy-template campaign for the target ICP.";
|
|
2555
|
+
const statusArgs = compact({
|
|
2556
|
+
strategy_template: strategyTemplate,
|
|
2557
|
+
campaign_brief: brief,
|
|
2558
|
+
target_icp: request.icp,
|
|
2559
|
+
include_sources: true,
|
|
2560
|
+
include_samples: false,
|
|
2561
|
+
days: 90,
|
|
2562
|
+
limit: 25
|
|
2563
|
+
});
|
|
2564
|
+
const searchArgs = compact({
|
|
2565
|
+
query: request.memory?.queries?.[0]?.query || brief,
|
|
2566
|
+
layers: ["lead_generation", "email_finding", "email_verification", "company_enrichment", "copy_enrichment"],
|
|
2567
|
+
limit: 10
|
|
2568
|
+
});
|
|
2569
|
+
return {
|
|
2570
|
+
kit_version: "campaign-memory-kit.v1",
|
|
2571
|
+
source: "signaliz.campaignBuilderAgent.memoryKit",
|
|
2572
|
+
read_only: true,
|
|
2573
|
+
no_spend: true,
|
|
2574
|
+
no_provider_writes: true,
|
|
2575
|
+
client_names_allowed: false,
|
|
2576
|
+
request_file: requestFile,
|
|
2577
|
+
seed_manifest_file: seedManifestFile,
|
|
2578
|
+
request,
|
|
2579
|
+
strategy_template: strategyTemplate,
|
|
2580
|
+
operating_playbooks: getCampaignBuilderOperatingPlaybooksForRequest(request).map((playbook) => playbook.slug),
|
|
2581
|
+
memory_sources: source.memorySources,
|
|
2582
|
+
seed_runner: {
|
|
2583
|
+
local_script: "scripts/gtm-kernel/seed-import-runner.mjs",
|
|
2584
|
+
dry_run_command: [
|
|
2585
|
+
"node scripts/gtm-kernel/seed-import-runner.mjs",
|
|
2586
|
+
`--source ${source.seedSource}`,
|
|
2587
|
+
"--dry-run",
|
|
2588
|
+
`--workspace-id ${shellArg(input.workspaceId || "00000000-0000-4000-8000-000000000000")}`,
|
|
2589
|
+
`--manifest ${shellArg(seedManifestFile)}`,
|
|
2590
|
+
"--reset"
|
|
2591
|
+
].join(" "),
|
|
2592
|
+
verify_manifest_command: source.verifyScript ? `node ${source.verifyScript} ${shellArg(seedManifestFile)}` : null,
|
|
2593
|
+
write_command: `GTM_KERNEL_WORKSPACE_ID=${shellArg(workspaceId)} node scripts/gtm-kernel/seed-import-runner.mjs --source ${source.seedSource} --write`,
|
|
2594
|
+
write_requires: ["SUPABASE_URL", "SUPABASE_SERVICE_ROLE_KEY", "GTM_KERNEL_WORKSPACE_ID", "explicit operator approval"]
|
|
2595
|
+
},
|
|
2596
|
+
cli_commands: [
|
|
2597
|
+
{
|
|
2598
|
+
id: "memory_status",
|
|
2599
|
+
label: "Check strategy memory readiness",
|
|
2600
|
+
command: `${sdkCliBase} gtm strategy-memory${strategyFlag} --brief ${shellArg(brief)} --json`,
|
|
2601
|
+
safety: "read-only MCP memory readiness; no credits, provider writes, sender loads, exports, or sends"
|
|
2602
|
+
},
|
|
2603
|
+
{
|
|
2604
|
+
id: "memory_search",
|
|
2605
|
+
label: "Search ranked campaign memory",
|
|
2606
|
+
command: `${sdkCliBase} gtm memory search --query ${shellArg(String(searchArgs.query || brief))} --limit 10 --json`,
|
|
2607
|
+
safety: "read-only ranked memory lookup"
|
|
2608
|
+
},
|
|
2609
|
+
{
|
|
2610
|
+
id: "seed_dry_run",
|
|
2611
|
+
label: "Dry-run private memory seed import",
|
|
2612
|
+
command: [
|
|
2613
|
+
"node scripts/gtm-kernel/seed-import-runner.mjs",
|
|
2614
|
+
`--source ${source.seedSource}`,
|
|
2615
|
+
"--dry-run",
|
|
2616
|
+
`--workspace-id ${shellArg(input.workspaceId || "00000000-0000-4000-8000-000000000000")}`,
|
|
2617
|
+
`--manifest ${shellArg(seedManifestFile)}`,
|
|
2618
|
+
"--reset"
|
|
2619
|
+
].join(" "),
|
|
2620
|
+
safety: "local extraction and manifest only; no database writes"
|
|
2621
|
+
},
|
|
2622
|
+
{
|
|
2623
|
+
id: "write_request",
|
|
2624
|
+
label: "Write reusable campaign request JSON",
|
|
2625
|
+
command: `${cliBase} campaign-agent init${strategyFlag}${targetFlag}${localLeadsFlag} --output-file ${shellArg(requestFile)}`,
|
|
2626
|
+
safety: "local file only; no MCP calls, credits, provider writes, sender loads, exports, or sends"
|
|
2627
|
+
},
|
|
2628
|
+
{
|
|
2629
|
+
id: "proof",
|
|
2630
|
+
label: "Run campaign proof after memory check",
|
|
2631
|
+
command: `${cliBase} campaign-agent proof --request-file ${shellArg(requestFile)} --json`,
|
|
2632
|
+
safety: "read-only planning plus forced build_campaign dry-run with confirm_spend=false"
|
|
2633
|
+
}
|
|
2634
|
+
],
|
|
2635
|
+
mcp_calls: [
|
|
2636
|
+
{
|
|
2637
|
+
id: "strategy_memory_status",
|
|
2638
|
+
tool: "gtm_campaign_strategy_memory_status",
|
|
2639
|
+
arguments: statusArgs,
|
|
2640
|
+
safety: "read-only strategy/workflow memory readiness with sources and no raw samples"
|
|
2641
|
+
},
|
|
2642
|
+
{
|
|
2643
|
+
id: "memory_search",
|
|
2644
|
+
tool: "gtm_memory_search",
|
|
2645
|
+
arguments: searchArgs,
|
|
2646
|
+
safety: "read-only ranked memory lookup"
|
|
2647
|
+
},
|
|
2648
|
+
{
|
|
2649
|
+
id: "campaign_agent_plan",
|
|
2650
|
+
tool: "gtm_campaign_agent_plan",
|
|
2651
|
+
arguments: campaignBuilderBuildKitMcpArgs(request),
|
|
2652
|
+
safety: "read-only campaign-agent plan using built-in Signaliz lanes, memory, Brain, Nango, and BYO routes"
|
|
2653
|
+
},
|
|
2654
|
+
{
|
|
2655
|
+
id: "campaign_agent_proof",
|
|
2656
|
+
tool: "gtm_campaign_agent_proof",
|
|
2657
|
+
arguments: { ...campaignBuilderBuildKitMcpArgs(request), idempotency_key: "campaign-agent-memory-proof-001" },
|
|
2658
|
+
safety: "forces build_campaign dry_run=true and confirm_spend=false after readiness"
|
|
2659
|
+
}
|
|
2660
|
+
],
|
|
2661
|
+
sdk_example: {
|
|
2662
|
+
language: "typescript",
|
|
2663
|
+
code: campaignBuilderMemoryKitSdkExample(request, seedManifestFile)
|
|
2664
|
+
},
|
|
2665
|
+
privacy: {
|
|
2666
|
+
client_names_allowed: false,
|
|
2667
|
+
notes: [
|
|
2668
|
+
"Use strategy templates, operating playbooks, memory dimensions, and anonymized campaign patterns instead of client names.",
|
|
2669
|
+
"Do not expose raw leads, private replies, domains, secrets, provider payloads, or customer account labels in kit output.",
|
|
2670
|
+
"Seed writes are workspace-private and require explicit operator approval plus Supabase service credentials."
|
|
2671
|
+
]
|
|
2672
|
+
},
|
|
2673
|
+
next_actions: [
|
|
2674
|
+
"Run memory_status before plan/proof so missing strategy coverage is visible.",
|
|
2675
|
+
`Run seed_dry_run and inspect ${seedManifestFile} before any memory write.`,
|
|
2676
|
+
"Use write_request to save the reusable campaign request, then run proof with no spend.",
|
|
2677
|
+
"Add BYO tools through campaign-agent --custom-tool only after route setup is reviewed."
|
|
2678
|
+
]
|
|
2679
|
+
};
|
|
2680
|
+
}
|
|
2378
2681
|
function createCampaignBuilderToolRoute(input) {
|
|
2379
2682
|
return {
|
|
2380
2683
|
provider: input.provider ?? "custom_mcp",
|
|
@@ -2390,6 +2693,142 @@ function createCampaignBuilderToolRoute(input) {
|
|
|
2390
2693
|
rationale: `${input.label ?? input.provider ?? "Custom tool"} is a user-provided campaign-builder route for ${input.layer}.`
|
|
2391
2694
|
};
|
|
2392
2695
|
}
|
|
2696
|
+
function campaignBuilderBuildKitMcpArgs(request) {
|
|
2697
|
+
return compact({
|
|
2698
|
+
goal: request.goal,
|
|
2699
|
+
campaign_brief: request.goal,
|
|
2700
|
+
campaign_name: request.campaignName,
|
|
2701
|
+
account_label: request.accountLabel,
|
|
2702
|
+
account_context: request.accountContext,
|
|
2703
|
+
strategy_template: request.strategyTemplate,
|
|
2704
|
+
operating_playbooks: request.operatingPlaybooks,
|
|
2705
|
+
target_icp: request.icp,
|
|
2706
|
+
target_count: request.targetCount,
|
|
2707
|
+
builtins: request.builtIns,
|
|
2708
|
+
include_local_leads: request.builtIns?.includes("local_leads") || void 0,
|
|
2709
|
+
preferred_providers: request.preferredProviders,
|
|
2710
|
+
custom_tools: request.integrations?.map((route) => compact({
|
|
2711
|
+
provider: route.provider,
|
|
2712
|
+
layer: route.layer,
|
|
2713
|
+
gtm_layers: route.gtmLayers ?? (route.gtmLayer ? [route.gtmLayer] : void 0),
|
|
2714
|
+
tool: route.toolName,
|
|
2715
|
+
mcp: route.mcpServerName,
|
|
2716
|
+
mode: route.mode,
|
|
2717
|
+
approval_required: route.approvalRequired
|
|
2718
|
+
})),
|
|
2719
|
+
include_nango_catalog: request.agencyContext?.includeNangoCatalog,
|
|
2720
|
+
include_memory: request.memory?.enabled,
|
|
2721
|
+
include_brain: true,
|
|
2722
|
+
include_provider_routes: true,
|
|
2723
|
+
include_delivery_risk: true
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2726
|
+
function campaignBuilderBuildKitSdkExample(request, requestFile) {
|
|
2727
|
+
const proofRequest = {
|
|
2728
|
+
goal: request.goal,
|
|
2729
|
+
strategyTemplate: request.strategyTemplate,
|
|
2730
|
+
targetCount: request.targetCount,
|
|
2731
|
+
builtIns: request.builtIns,
|
|
2732
|
+
integrations: request.integrations
|
|
2733
|
+
};
|
|
2734
|
+
return [
|
|
2735
|
+
"import { Signaliz, createCampaignBuilderBuildKit } from '@signaliz/sdk';",
|
|
2736
|
+
"",
|
|
2737
|
+
`const kit = createCampaignBuilderBuildKit({ requestFile: ${JSON.stringify(requestFile)}, ...${JSON.stringify(proofRequest, null, 2)} });`,
|
|
2738
|
+
"console.log(kit.cli_commands.find((command) => command.id === 'proof_shortcut')?.command);",
|
|
2739
|
+
"",
|
|
2740
|
+
"const signaliz = new Signaliz({ apiKey: process.env.SIGNALIZ_API_KEY! });",
|
|
2741
|
+
"const proof = await signaliz.campaignBuilderAgent.proof(kit.request, {",
|
|
2742
|
+
" idempotencyKey: `campaign-agent-proof-${Date.now()}`,",
|
|
2743
|
+
"});",
|
|
2744
|
+
"",
|
|
2745
|
+
'if (!proof.success || proof.dry_run_result?.status !== "dry_run") {',
|
|
2746
|
+
" throw new Error('Campaign proof failed or launched work unexpectedly');",
|
|
2747
|
+
"}"
|
|
2748
|
+
].join("\n");
|
|
2749
|
+
}
|
|
2750
|
+
function campaignBuilderMemoryKitSdkExample(request, seedManifestFile) {
|
|
2751
|
+
const input = {
|
|
2752
|
+
goal: request.goal,
|
|
2753
|
+
strategyTemplate: request.strategyTemplate,
|
|
2754
|
+
targetCount: request.targetCount,
|
|
2755
|
+
builtIns: request.builtIns
|
|
2756
|
+
};
|
|
2757
|
+
return [
|
|
2758
|
+
"import { Signaliz, createCampaignBuilderMemoryKit } from '@signaliz/sdk';",
|
|
2759
|
+
"",
|
|
2760
|
+
`const kit = createCampaignBuilderMemoryKit({ seedManifestFile: ${JSON.stringify(seedManifestFile)}, ...${JSON.stringify(input, null, 2)} });`,
|
|
2761
|
+
"console.log(kit.cli_commands.find((command) => command.id === 'memory_status')?.command);",
|
|
2762
|
+
"",
|
|
2763
|
+
"const signaliz = new Signaliz({ apiKey: process.env.SIGNALIZ_API_KEY! });",
|
|
2764
|
+
"const status = await signaliz.gtm.campaignStrategyMemoryStatus({",
|
|
2765
|
+
" strategyTemplate: kit.request.strategyTemplate,",
|
|
2766
|
+
" campaignBrief: kit.request.goal,",
|
|
2767
|
+
" includeSources: true,",
|
|
2768
|
+
" includeSamples: false,",
|
|
2769
|
+
"});",
|
|
2770
|
+
"",
|
|
2771
|
+
"if (status?.ready === false) {",
|
|
2772
|
+
" throw new Error('Strategy memory is not ready for this campaign request');",
|
|
2773
|
+
"}"
|
|
2774
|
+
].join("\n");
|
|
2775
|
+
}
|
|
2776
|
+
function campaignBuilderMemoryKitSource(source) {
|
|
2777
|
+
const normalized = normalizeTemplateKey(source || "agency");
|
|
2778
|
+
const catalog = {
|
|
2779
|
+
agency: {
|
|
2780
|
+
id: "agency_campaign_builder",
|
|
2781
|
+
label: "Agency campaign-builder strategy patterns",
|
|
2782
|
+
seed_source: "agency",
|
|
2783
|
+
scope: "private_strategy_docs",
|
|
2784
|
+
privacy: "workspace-private sanitized docs and abstracted campaign summaries"
|
|
2785
|
+
},
|
|
2786
|
+
workflow: {
|
|
2787
|
+
id: "workflow_pattern_corpus",
|
|
2788
|
+
label: "Workflow and table-build pattern corpus",
|
|
2789
|
+
seed_source: "building-clay",
|
|
2790
|
+
scope: "read_only_workflow_docs",
|
|
2791
|
+
privacy: "sanitized operating model and workflow patterns"
|
|
2792
|
+
},
|
|
2793
|
+
feedback: {
|
|
2794
|
+
id: "campaign_feedback",
|
|
2795
|
+
label: "Campaign feedback and reply patterns",
|
|
2796
|
+
seed_source: "instantly",
|
|
2797
|
+
scope: "workspace_private_feedback",
|
|
2798
|
+
privacy: "aggregate feedback, reply, and sequence performance memory"
|
|
2799
|
+
}
|
|
2800
|
+
};
|
|
2801
|
+
const sourceMap = {
|
|
2802
|
+
agency: "agency",
|
|
2803
|
+
"campaign-builder": "agency",
|
|
2804
|
+
"strategy-memory": "agency",
|
|
2805
|
+
"workflow-patterns": "workflow",
|
|
2806
|
+
workflow: "workflow",
|
|
2807
|
+
"building-clay": "workflow",
|
|
2808
|
+
clay: "workflow",
|
|
2809
|
+
"instantly-feedback": "feedback",
|
|
2810
|
+
instantly: "feedback",
|
|
2811
|
+
feedback: "feedback",
|
|
2812
|
+
all: "all"
|
|
2813
|
+
};
|
|
2814
|
+
const selected = sourceMap[normalized] || "agency";
|
|
2815
|
+
if (selected === "all") {
|
|
2816
|
+
return {
|
|
2817
|
+
seedSource: "all",
|
|
2818
|
+
verifyScript: null,
|
|
2819
|
+
memorySources: [catalog.agency, catalog.workflow, catalog.feedback]
|
|
2820
|
+
};
|
|
2821
|
+
}
|
|
2822
|
+
const item = catalog[selected];
|
|
2823
|
+
return {
|
|
2824
|
+
seedSource: item.seed_source,
|
|
2825
|
+
verifyScript: item.seed_source === "agency" ? "scripts/gtm-kernel/verify-agency-import-manifest.mjs" : item.seed_source === "building-clay" ? "scripts/gtm-kernel/verify-building-clay-import-manifest.mjs" : null,
|
|
2826
|
+
memorySources: [item]
|
|
2827
|
+
};
|
|
2828
|
+
}
|
|
2829
|
+
function shellArg(value) {
|
|
2830
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
2831
|
+
}
|
|
2393
2832
|
function normalizeTemplateKey(value) {
|
|
2394
2833
|
return String(value || "").trim().toLowerCase().replace(/[_\s]+/g, "-");
|
|
2395
2834
|
}
|
|
@@ -6739,7 +7178,7 @@ async function main() {
|
|
|
6739
7178
|
printHelp();
|
|
6740
7179
|
return;
|
|
6741
7180
|
}
|
|
6742
|
-
const offlineCampaignAgentTemplate = (command === "campaign-agent" || command === "campaign-builder") && ["init", "template", "request-template", "new"].includes(String(process.argv[3] || ""));
|
|
7181
|
+
const offlineCampaignAgentTemplate = (command === "campaign-agent" || command === "campaign-builder") && ["init", "template", "request-template", "new", "kit", "build-kit", "blueprint", "memory-kit", "seed-kit", "memory"].includes(String(process.argv[3] || ""));
|
|
6743
7182
|
if (!apiKey && !offlineCampaignAgentTemplate) {
|
|
6744
7183
|
console.error("\u274C SIGNALIZ_API_KEY environment variable is required.");
|
|
6745
7184
|
console.error(" Set it with: export SIGNALIZ_API_KEY=sk_...");
|
|
@@ -7103,6 +7542,73 @@ async function handleCampaignAgentCommand(signaliz, argv) {
|
|
|
7103
7542
|
}
|
|
7104
7543
|
return;
|
|
7105
7544
|
}
|
|
7545
|
+
if (["kit", "build-kit", "blueprint"].includes(subcommand)) {
|
|
7546
|
+
const flags2 = parseFlags(argv.slice(1));
|
|
7547
|
+
const requestFromFile2 = campaignAgentRequestFileFromFlags(flags2);
|
|
7548
|
+
const fallbackGoal = stringFlag(flags2, "goal", "brief") || stringOrUndefined(requestFromFile2?.goal) || "Build a strategy-template campaign for mature operators in the target ICP.";
|
|
7549
|
+
const request2 = requestFromFile2 ? mergeCampaignAgentRequests(
|
|
7550
|
+
requestFromFile2,
|
|
7551
|
+
campaignAgentRequestFromFlags(fallbackGoal, flags2, { includeDefaults: false })
|
|
7552
|
+
) : campaignAgentRequestTemplateFromFlags(flags2);
|
|
7553
|
+
const kit = createCampaignBuilderBuildKit({
|
|
7554
|
+
...request2,
|
|
7555
|
+
includeLocalLeads: booleanFlag(flags2, "use-local-leads"),
|
|
7556
|
+
includeCustomToolPlaceholder: booleanFlag(flags2, "with-byo-placeholder") || booleanFlag(flags2, "include-custom-tool-placeholder") || booleanFlag(flags2, "include-byo-placeholder"),
|
|
7557
|
+
includeNango: !booleanFlag(flags2, "no-nango-catalog"),
|
|
7558
|
+
requestFile: stringFlag(flags2, "request-output-file", "request-file-name") || stringFlag(flags2, "request-file") || "campaign-request.json",
|
|
7559
|
+
cliPackage: stringFlag(flags2, "cli-package"),
|
|
7560
|
+
sdkPackage: stringFlag(flags2, "sdk-package")
|
|
7561
|
+
});
|
|
7562
|
+
const outputFile = stringFlag(flags2, "output-file", "kit-file", "out");
|
|
7563
|
+
if (outputFile) {
|
|
7564
|
+
(0, import_node_fs.writeFileSync)(outputFile, `${JSON.stringify(kit, null, 2)}
|
|
7565
|
+
`, "utf8");
|
|
7566
|
+
}
|
|
7567
|
+
if (booleanFlag(flags2, "json")) {
|
|
7568
|
+
printJson(kit);
|
|
7569
|
+
} else if (!outputFile) {
|
|
7570
|
+
printCampaignAgentBuildKit(kit);
|
|
7571
|
+
} else {
|
|
7572
|
+
console.log(`Campaign build kit written: ${outputFile}`);
|
|
7573
|
+
console.log(`Next: ${kit.cli_commands.find((command) => command.id === "proof_shortcut")?.command}`);
|
|
7574
|
+
}
|
|
7575
|
+
return;
|
|
7576
|
+
}
|
|
7577
|
+
if (["memory-kit", "seed-kit", "memory"].includes(subcommand)) {
|
|
7578
|
+
const flags2 = parseFlags(argv.slice(1));
|
|
7579
|
+
const requestFromFile2 = campaignAgentRequestFileFromFlags(flags2);
|
|
7580
|
+
const fallbackGoal = stringFlag(flags2, "goal", "brief") || stringOrUndefined(requestFromFile2?.goal) || "Build a strategy-template campaign for mature operators in the target ICP.";
|
|
7581
|
+
const request2 = requestFromFile2 ? mergeCampaignAgentRequests(
|
|
7582
|
+
requestFromFile2,
|
|
7583
|
+
campaignAgentRequestFromFlags(fallbackGoal, flags2, { includeDefaults: false })
|
|
7584
|
+
) : campaignAgentRequestTemplateFromFlags(flags2);
|
|
7585
|
+
const kit = createCampaignBuilderMemoryKit({
|
|
7586
|
+
...request2,
|
|
7587
|
+
includeLocalLeads: booleanFlag(flags2, "use-local-leads"),
|
|
7588
|
+
includeCustomToolPlaceholder: booleanFlag(flags2, "with-byo-placeholder") || booleanFlag(flags2, "include-custom-tool-placeholder") || booleanFlag(flags2, "include-byo-placeholder"),
|
|
7589
|
+
includeNango: !booleanFlag(flags2, "no-nango-catalog"),
|
|
7590
|
+
requestFile: stringFlag(flags2, "request-output-file", "request-file-name") || stringFlag(flags2, "request-file") || "campaign-request.json",
|
|
7591
|
+
seedManifestFile: stringFlag(flags2, "seed-manifest-file", "manifest") || ".gtm-kernel-import-state/campaign-memory-dry-run.json",
|
|
7592
|
+
source: stringFlag(flags2, "source", "memory-source", "seed-source"),
|
|
7593
|
+
workspaceId: stringFlag(flags2, "workspace-id"),
|
|
7594
|
+
cliPackage: stringFlag(flags2, "cli-package"),
|
|
7595
|
+
sdkPackage: stringFlag(flags2, "sdk-package")
|
|
7596
|
+
});
|
|
7597
|
+
const outputFile = stringFlag(flags2, "output-file", "kit-file", "out");
|
|
7598
|
+
if (outputFile) {
|
|
7599
|
+
(0, import_node_fs.writeFileSync)(outputFile, `${JSON.stringify(kit, null, 2)}
|
|
7600
|
+
`, "utf8");
|
|
7601
|
+
}
|
|
7602
|
+
if (booleanFlag(flags2, "json")) {
|
|
7603
|
+
printJson(kit);
|
|
7604
|
+
} else if (!outputFile) {
|
|
7605
|
+
printCampaignAgentMemoryKit(kit);
|
|
7606
|
+
} else {
|
|
7607
|
+
console.log(`Campaign memory kit written: ${outputFile}`);
|
|
7608
|
+
console.log(`Next: ${kit.cli_commands.find((command) => command.id === "memory_status")?.command}`);
|
|
7609
|
+
}
|
|
7610
|
+
return;
|
|
7611
|
+
}
|
|
7106
7612
|
if (["review", "status", "rows", "artifacts", "approve", "approve-delivery"].includes(subcommand)) {
|
|
7107
7613
|
await handleCampaignAgentReviewCommand(signaliz, subcommand, argv.slice(1));
|
|
7108
7614
|
return;
|
|
@@ -7629,6 +8135,45 @@ function printCampaignAgentPlan(plan) {
|
|
|
7629
8135
|
console.log(`- ${step.id}: ${step.tool}${step.approvalRequired ? " (approval required)" : ""}`);
|
|
7630
8136
|
}
|
|
7631
8137
|
}
|
|
8138
|
+
function printCampaignAgentBuildKit(kit) {
|
|
8139
|
+
console.log(`Campaign build kit: ${kit.strategy_template || "custom strategy"}`);
|
|
8140
|
+
console.log(`Request file: ${kit.request_file}`);
|
|
8141
|
+
console.log(`Built-ins: ${kit.built_in_lanes.join(", ") || "none"}`);
|
|
8142
|
+
console.log(`Playbooks: ${kit.operating_playbooks.join(", ") || "none"}`);
|
|
8143
|
+
console.log(`BYO routes: ${kit.custom_routes.length}`);
|
|
8144
|
+
console.log("\nCLI:");
|
|
8145
|
+
for (const command of kit.cli_commands.slice(0, 4)) {
|
|
8146
|
+
console.log(`- ${command.label}: ${command.command}`);
|
|
8147
|
+
}
|
|
8148
|
+
console.log("\nMCP:");
|
|
8149
|
+
for (const call of kit.mcp_calls.slice(0, 3)) {
|
|
8150
|
+
console.log(`- ${call.tool}: ${call.safety}`);
|
|
8151
|
+
}
|
|
8152
|
+
console.log("\nBYO tool pattern:");
|
|
8153
|
+
console.log(`- ${kit.byo_tool_pattern.cli_flag}`);
|
|
8154
|
+
console.log("\nNext:");
|
|
8155
|
+
for (const action of kit.next_actions.slice(0, 4)) console.log(`- ${action}`);
|
|
8156
|
+
}
|
|
8157
|
+
function printCampaignAgentMemoryKit(kit) {
|
|
8158
|
+
console.log(`Campaign memory kit: ${kit.strategy_template || "custom strategy"}`);
|
|
8159
|
+
console.log(`Request file: ${kit.request_file}`);
|
|
8160
|
+
console.log(`Seed manifest: ${kit.seed_manifest_file}`);
|
|
8161
|
+
console.log(`Sources: ${kit.memory_sources.map((source) => source.id).join(", ") || "none"}`);
|
|
8162
|
+
console.log(`Playbooks: ${kit.operating_playbooks.join(", ") || "none"}`);
|
|
8163
|
+
console.log("\nCLI:");
|
|
8164
|
+
for (const command of kit.cli_commands.slice(0, 4)) {
|
|
8165
|
+
console.log(`- ${command.label}: ${command.command}`);
|
|
8166
|
+
}
|
|
8167
|
+
console.log("\nMCP:");
|
|
8168
|
+
for (const call of kit.mcp_calls.slice(0, 3)) {
|
|
8169
|
+
console.log(`- ${call.tool}: ${call.safety}`);
|
|
8170
|
+
}
|
|
8171
|
+
console.log("\nSeed runner:");
|
|
8172
|
+
console.log(`- Dry run: ${kit.seed_runner.dry_run_command}`);
|
|
8173
|
+
if (kit.seed_runner.verify_manifest_command) console.log(`- Verify: ${kit.seed_runner.verify_manifest_command}`);
|
|
8174
|
+
console.log("\nNext:");
|
|
8175
|
+
for (const action of kit.next_actions.slice(0, 4)) console.log(`- ${action}`);
|
|
8176
|
+
}
|
|
7632
8177
|
function printCampaignAgentExecution(payload, flags) {
|
|
7633
8178
|
if (booleanFlag(flags, "json")) {
|
|
7634
8179
|
printJson(payload);
|
|
@@ -7789,6 +8334,7 @@ Usage:
|
|
|
7789
8334
|
signaliz gtm memory search --query "proof-first vertical gate" --json
|
|
7790
8335
|
signaliz gtm plan --brief "Build 500 verified leads for..." --strategy-template non-medical-home-care --lead-count 500 --json
|
|
7791
8336
|
signaliz campaign-agent init --strategy-template non-medical-home-care --target-count 250 --use-local-leads --json > campaign-request.json
|
|
8337
|
+
signaliz campaign-agent memory-kit --strategy-template non-medical-home-care --target-count 250 --use-local-leads --json
|
|
7792
8338
|
signaliz campaign-agent doctor --request-file campaign-request.json --json
|
|
7793
8339
|
signaliz campaign-agent plan --goal "Build a strategy-template campaign..." --strategy-template industrial-ot-resilience --target-count 500 --builtins lead_generation,email_finding,email_verification,signals
|
|
7794
8340
|
signaliz campaign-agent proof --goal "Build a strategy-template campaign..." --strategy-template non-medical-home-care --target-count 100 --json
|
|
@@ -7826,6 +8372,8 @@ function printCampaignAgentHelp() {
|
|
|
7826
8372
|
Signaliz campaign-agent commands:
|
|
7827
8373
|
|
|
7828
8374
|
signaliz campaign-agent init [--goal TEXT] [--strategy-template ID] [--target-count N] [--use-local-leads] [--with-byo-placeholder] [--output-file FILE] [--json]
|
|
8375
|
+
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]
|
|
8376
|
+
signaliz campaign-agent memory-kit [--goal TEXT | --request-file FILE] [--strategy-template ID] [--source agency|workflow-patterns|instantly-feedback|all] [--seed-manifest-file FILE] [--json]
|
|
7829
8377
|
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
8378
|
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
8379
|
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 +8386,7 @@ Signaliz campaign-agent commands:
|
|
|
7838
8386
|
signaliz campaign-agent artifacts <campaign_build_id> [--json]
|
|
7839
8387
|
signaliz campaign-agent approve <campaign_build_id> --destination-type json|csv|webhook [--destination-config JSON] [--json]
|
|
7840
8388
|
|
|
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.
|
|
8389
|
+
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
8390
|
`);
|
|
7843
8391
|
}
|
|
7844
8392
|
main().catch((e) => {
|