@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/README.md
CHANGED
|
@@ -105,10 +105,26 @@ 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
|
+
});
|
|
115
|
+
const memoryKit = signaliz.campaignBuilderAgent.memoryKit({
|
|
116
|
+
goal: 'Build a strategy-template campaign for mature local operators',
|
|
117
|
+
strategyTemplate: 'non-medical-home-care',
|
|
118
|
+
targetCount: 250,
|
|
119
|
+
includeLocalLeads: true,
|
|
120
|
+
source: 'agency',
|
|
121
|
+
});
|
|
108
122
|
|
|
109
123
|
console.log(plan.strategyMemoryStatus?.ready);
|
|
110
124
|
console.log(readiness.summary.ready);
|
|
111
125
|
console.log(proof.success);
|
|
126
|
+
console.log(kit.mcp_calls.find((call) => call.tool === 'gtm_campaign_agent_proof'));
|
|
127
|
+
console.log(memoryKit.mcp_calls.find((call) => call.tool === 'gtm_campaign_strategy_memory_status'));
|
|
112
128
|
console.log(plan.mcpFlow.filter((step) =>
|
|
113
129
|
['gtm_provider_recipe_prepare', 'gtm_provider_route_activate'].includes(step.tool)
|
|
114
130
|
));
|
|
@@ -137,6 +153,20 @@ npx @signaliz/sdk campaign-agent init \
|
|
|
137
153
|
--with-byo-placeholder \
|
|
138
154
|
--output-file campaign-request.json
|
|
139
155
|
|
|
156
|
+
npx @signaliz/sdk campaign-agent kit \
|
|
157
|
+
--strategy-template non-medical-home-care \
|
|
158
|
+
--target-count 250 \
|
|
159
|
+
--use-local-leads \
|
|
160
|
+
--with-byo-placeholder \
|
|
161
|
+
--json
|
|
162
|
+
|
|
163
|
+
npx @signaliz/sdk campaign-agent memory-kit \
|
|
164
|
+
--strategy-template non-medical-home-care \
|
|
165
|
+
--target-count 250 \
|
|
166
|
+
--use-local-leads \
|
|
167
|
+
--source agency \
|
|
168
|
+
--json
|
|
169
|
+
|
|
140
170
|
npx @signaliz/sdk campaign-agent plan \
|
|
141
171
|
--request-file campaign-request.json \
|
|
142
172
|
--target-count 250 \
|
|
@@ -1705,6 +1705,12 @@ var CampaignBuilderAgent = class {
|
|
|
1705
1705
|
});
|
|
1706
1706
|
return createCampaignBuilderProofReceipt(plan, result);
|
|
1707
1707
|
}
|
|
1708
|
+
buildKit(options = {}) {
|
|
1709
|
+
return createCampaignBuilderBuildKit(options);
|
|
1710
|
+
}
|
|
1711
|
+
memoryKit(options = {}) {
|
|
1712
|
+
return createCampaignBuilderMemoryKit(options);
|
|
1713
|
+
}
|
|
1708
1714
|
async commitPlan(plan, options = {}) {
|
|
1709
1715
|
const writeMode = options.confirm === true && options.dryRun === false;
|
|
1710
1716
|
if (writeMode && !options.approvedBy) {
|
|
@@ -2369,6 +2375,303 @@ function createCampaignBuilderAgentRequestTemplate(input = {}) {
|
|
|
2369
2375
|
}
|
|
2370
2376
|
});
|
|
2371
2377
|
}
|
|
2378
|
+
function createCampaignBuilderBuildKit(input = {}) {
|
|
2379
|
+
const requestFile = input.requestFile || "campaign-request.json";
|
|
2380
|
+
const cliPackage = input.cliPackage || "@signaliz/cli";
|
|
2381
|
+
const sdkPackage = input.sdkPackage || "@signaliz/sdk";
|
|
2382
|
+
const request = createCampaignBuilderAgentRequestTemplate(input);
|
|
2383
|
+
const strategyTemplate = stringValue(request.strategyTemplate) ?? null;
|
|
2384
|
+
const builtIns = request.builtIns ?? DEFAULT_CAMPAIGN_BUILDER_BUILT_INS;
|
|
2385
|
+
const useLocalLeads = builtIns.includes("local_leads");
|
|
2386
|
+
const customRoutes = [
|
|
2387
|
+
...request.integrations ?? [],
|
|
2388
|
+
...routesFromCustomerTools(request.customerTools ?? [])
|
|
2389
|
+
].filter((route) => route.provider !== "signaliz");
|
|
2390
|
+
const strategyFlag = strategyTemplate ? ` --strategy-template ${shellArg(strategyTemplate)}` : "";
|
|
2391
|
+
const targetFlag = request.targetCount ? ` --target-count ${request.targetCount}` : "";
|
|
2392
|
+
const localLeadsFlag = useLocalLeads ? " --use-local-leads" : "";
|
|
2393
|
+
const cliBase = `npx ${cliPackage}`;
|
|
2394
|
+
const sdkCliBase = `npx ${sdkPackage}`;
|
|
2395
|
+
const brief = request.goal || "Build a strategy-template campaign for the target ICP.";
|
|
2396
|
+
const mcpArgs = campaignBuilderBuildKitMcpArgs(request);
|
|
2397
|
+
return {
|
|
2398
|
+
kit_version: "campaign-builder-kit.v1",
|
|
2399
|
+
source: "signaliz.campaignBuilderAgent.buildKit",
|
|
2400
|
+
request_file: requestFile,
|
|
2401
|
+
request,
|
|
2402
|
+
strategy_template: strategyTemplate,
|
|
2403
|
+
built_in_lanes: builtIns,
|
|
2404
|
+
operating_playbooks: getCampaignBuilderOperatingPlaybooksForRequest(request).map((playbook) => playbook.slug),
|
|
2405
|
+
custom_routes: customRoutes.map((route) => ({
|
|
2406
|
+
provider: String(route.provider),
|
|
2407
|
+
layer: String(route.layer),
|
|
2408
|
+
tool: firstNonEmptyString(route.toolName),
|
|
2409
|
+
mcp_server: firstNonEmptyString(route.mcpServerName),
|
|
2410
|
+
mode: route.mode ?? "if_available",
|
|
2411
|
+
approval_required: route.approvalRequired === true || route.mode === "required"
|
|
2412
|
+
})),
|
|
2413
|
+
approval_boundaries: request.approvalPolicy?.requireApprovalFor ?? DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES,
|
|
2414
|
+
byo_tool_pattern: {
|
|
2415
|
+
cli_flag: "--custom-tool provider:layer:tool[:mcp]",
|
|
2416
|
+
request_fragment: createCampaignBuilderToolRoute({
|
|
2417
|
+
provider: "workspace_mcp",
|
|
2418
|
+
layer: "enrichment",
|
|
2419
|
+
gtmLayers: ["company_enrichment"],
|
|
2420
|
+
toolName: "workspace_account_enrich",
|
|
2421
|
+
mcpServerName: "workspace-mcp",
|
|
2422
|
+
label: "Workspace account enrichment",
|
|
2423
|
+
mode: "required",
|
|
2424
|
+
approvalRequired: true
|
|
2425
|
+
})
|
|
2426
|
+
},
|
|
2427
|
+
cli_commands: [
|
|
2428
|
+
{
|
|
2429
|
+
id: "write_request",
|
|
2430
|
+
label: "Write reusable request JSON",
|
|
2431
|
+
command: `${cliBase} campaign-agent init${strategyFlag}${targetFlag}${localLeadsFlag} --output-file ${shellArg(requestFile)}`,
|
|
2432
|
+
safety: "local file only; no MCP calls, credits, provider writes, sender loads, exports, or sends"
|
|
2433
|
+
},
|
|
2434
|
+
{
|
|
2435
|
+
id: "memory_kit",
|
|
2436
|
+
label: "Inspect memory readiness and seed runner",
|
|
2437
|
+
command: `${sdkCliBase} campaign-agent memory-kit${strategyFlag}${targetFlag}${localLeadsFlag} --request-file ${shellArg(requestFile)} --json`,
|
|
2438
|
+
safety: "read-only memory readiness packet plus local seed dry-run commands"
|
|
2439
|
+
},
|
|
2440
|
+
{
|
|
2441
|
+
id: "proof_shortcut",
|
|
2442
|
+
label: "Run no-spend campaign-builder proof",
|
|
2443
|
+
command: `${cliBase} build ${shellArg(brief)}${strategyFlag}${targetFlag}${localLeadsFlag} --json`,
|
|
2444
|
+
safety: "strategy memory, Kernel plan, approvals, and forced build_campaign dry-run only"
|
|
2445
|
+
},
|
|
2446
|
+
{
|
|
2447
|
+
id: "plan",
|
|
2448
|
+
label: "Inspect the full campaign-agent plan",
|
|
2449
|
+
command: `${sdkCliBase} campaign-agent plan --request-file ${shellArg(requestFile)} --json`,
|
|
2450
|
+
safety: "read-only MCP planning and provider-route dry-runs"
|
|
2451
|
+
},
|
|
2452
|
+
{
|
|
2453
|
+
id: "doctor",
|
|
2454
|
+
label: "Check readiness gates",
|
|
2455
|
+
command: `${sdkCliBase} campaign-agent doctor --request-file ${shellArg(requestFile)} --json`,
|
|
2456
|
+
safety: "read-only readiness checks for Memory, Brain, built-ins, BYO routes, and approvals"
|
|
2457
|
+
},
|
|
2458
|
+
{
|
|
2459
|
+
id: "commit_preview",
|
|
2460
|
+
label: "Preview GTM campaign object commit",
|
|
2461
|
+
command: `${sdkCliBase} campaign-agent commit-plan --request-file ${shellArg(requestFile)} --json`,
|
|
2462
|
+
safety: "dry-run commit; writes only with --confirm-write and --approved-by"
|
|
2463
|
+
},
|
|
2464
|
+
{
|
|
2465
|
+
id: "approved_launch",
|
|
2466
|
+
label: "Launch after explicit approval",
|
|
2467
|
+
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`,
|
|
2468
|
+
safety: "spendful path; requires human approval identity, approval types, and spend limit"
|
|
2469
|
+
}
|
|
2470
|
+
],
|
|
2471
|
+
mcp_calls: [
|
|
2472
|
+
{
|
|
2473
|
+
id: "request_template",
|
|
2474
|
+
tool: "gtm_campaign_agent_request_template",
|
|
2475
|
+
arguments: mcpArgs,
|
|
2476
|
+
safety: "read-only reusable request generation"
|
|
2477
|
+
},
|
|
2478
|
+
{
|
|
2479
|
+
id: "readiness",
|
|
2480
|
+
tool: "gtm_campaign_agent_readiness",
|
|
2481
|
+
arguments: mcpArgs,
|
|
2482
|
+
safety: "read-only preflight across strategy memory, Kernel plan, lanes, routes, and approvals"
|
|
2483
|
+
},
|
|
2484
|
+
{
|
|
2485
|
+
id: "proof",
|
|
2486
|
+
tool: "gtm_campaign_agent_proof",
|
|
2487
|
+
arguments: { ...mcpArgs, idempotency_key: "campaign-agent-proof-001" },
|
|
2488
|
+
safety: "forces build_campaign dry_run=true and confirm_spend=false"
|
|
2489
|
+
},
|
|
2490
|
+
{
|
|
2491
|
+
id: "plan",
|
|
2492
|
+
tool: "gtm_campaign_agent_plan",
|
|
2493
|
+
arguments: mcpArgs,
|
|
2494
|
+
safety: "read-only one-call campaign-agent runbook"
|
|
2495
|
+
},
|
|
2496
|
+
{
|
|
2497
|
+
id: "commit_preview",
|
|
2498
|
+
tool: "gtm_campaign_build_plan_commit",
|
|
2499
|
+
arguments: {
|
|
2500
|
+
name: request.campaignName,
|
|
2501
|
+
campaign_brief: request.goal,
|
|
2502
|
+
lead_count: request.targetCount,
|
|
2503
|
+
dry_run: true,
|
|
2504
|
+
confirm: false
|
|
2505
|
+
},
|
|
2506
|
+
safety: "dry-run commit preview only"
|
|
2507
|
+
}
|
|
2508
|
+
],
|
|
2509
|
+
sdk_example: {
|
|
2510
|
+
language: "typescript",
|
|
2511
|
+
code: campaignBuilderBuildKitSdkExample(request, requestFile)
|
|
2512
|
+
},
|
|
2513
|
+
verification: [
|
|
2514
|
+
`${cliBase} campaign-agent proof --request-file ${shellArg(requestFile)} --json`,
|
|
2515
|
+
`${cliBase} campaign-agent doctor --request-file ${shellArg(requestFile)} --json`,
|
|
2516
|
+
"Confirm proof.success is true and dry_run_result.status is dry_run before any approved launch.",
|
|
2517
|
+
"Confirm no campaign_build_id exists in a proof receipt before moving to approved launch."
|
|
2518
|
+
],
|
|
2519
|
+
privacy: {
|
|
2520
|
+
client_names_allowed: false,
|
|
2521
|
+
notes: [
|
|
2522
|
+
"Use strategy templates, operating playbooks, and anonymized workflow patterns instead of client names.",
|
|
2523
|
+
"Do not include raw leads, private replies, domains, secrets, or customer account labels in public kit output."
|
|
2524
|
+
]
|
|
2525
|
+
},
|
|
2526
|
+
next_actions: [
|
|
2527
|
+
`Write or review ${requestFile}.`,
|
|
2528
|
+
"Run the proof command before spending credits or activating provider writes.",
|
|
2529
|
+
"Add BYO integrations with --custom-tool provider:layer:tool[:mcp] or the request_fragment shape.",
|
|
2530
|
+
"Use build-approved only after human approval, spend limit, and delivery review policy are set."
|
|
2531
|
+
]
|
|
2532
|
+
};
|
|
2533
|
+
}
|
|
2534
|
+
function createCampaignBuilderMemoryKit(input = {}) {
|
|
2535
|
+
const requestFile = input.requestFile || "campaign-request.json";
|
|
2536
|
+
const seedManifestFile = input.seedManifestFile || ".gtm-kernel-import-state/campaign-memory-dry-run.json";
|
|
2537
|
+
const cliPackage = input.cliPackage || "@signaliz/cli";
|
|
2538
|
+
const sdkPackage = input.sdkPackage || "@signaliz/sdk";
|
|
2539
|
+
const request = createCampaignBuilderAgentRequestTemplate(input);
|
|
2540
|
+
const strategyTemplate = stringValue(request.strategyTemplate) ?? null;
|
|
2541
|
+
const strategyFlag = strategyTemplate ? ` --strategy-template ${shellArg(strategyTemplate)}` : "";
|
|
2542
|
+
const targetFlag = request.targetCount ? ` --target-count ${request.targetCount}` : "";
|
|
2543
|
+
const localLeadsFlag = request.builtIns?.includes("local_leads") ? " --use-local-leads" : "";
|
|
2544
|
+
const cliBase = `npx ${cliPackage}`;
|
|
2545
|
+
const sdkCliBase = `npx ${sdkPackage}`;
|
|
2546
|
+
const source = campaignBuilderMemoryKitSource(input.source);
|
|
2547
|
+
const workspaceId = input.workspaceId || "your-workspace-id";
|
|
2548
|
+
const brief = request.goal || "Build a strategy-template campaign for the target ICP.";
|
|
2549
|
+
const statusArgs = compact({
|
|
2550
|
+
strategy_template: strategyTemplate,
|
|
2551
|
+
campaign_brief: brief,
|
|
2552
|
+
target_icp: request.icp,
|
|
2553
|
+
include_sources: true,
|
|
2554
|
+
include_samples: false,
|
|
2555
|
+
days: 90,
|
|
2556
|
+
limit: 25
|
|
2557
|
+
});
|
|
2558
|
+
const searchArgs = compact({
|
|
2559
|
+
query: request.memory?.queries?.[0]?.query || brief,
|
|
2560
|
+
layers: ["lead_generation", "email_finding", "email_verification", "company_enrichment", "copy_enrichment"],
|
|
2561
|
+
limit: 10
|
|
2562
|
+
});
|
|
2563
|
+
return {
|
|
2564
|
+
kit_version: "campaign-memory-kit.v1",
|
|
2565
|
+
source: "signaliz.campaignBuilderAgent.memoryKit",
|
|
2566
|
+
read_only: true,
|
|
2567
|
+
no_spend: true,
|
|
2568
|
+
no_provider_writes: true,
|
|
2569
|
+
client_names_allowed: false,
|
|
2570
|
+
request_file: requestFile,
|
|
2571
|
+
seed_manifest_file: seedManifestFile,
|
|
2572
|
+
request,
|
|
2573
|
+
strategy_template: strategyTemplate,
|
|
2574
|
+
operating_playbooks: getCampaignBuilderOperatingPlaybooksForRequest(request).map((playbook) => playbook.slug),
|
|
2575
|
+
memory_sources: source.memorySources,
|
|
2576
|
+
seed_runner: {
|
|
2577
|
+
local_script: "scripts/gtm-kernel/seed-import-runner.mjs",
|
|
2578
|
+
dry_run_command: [
|
|
2579
|
+
"node scripts/gtm-kernel/seed-import-runner.mjs",
|
|
2580
|
+
`--source ${source.seedSource}`,
|
|
2581
|
+
"--dry-run",
|
|
2582
|
+
`--workspace-id ${shellArg(input.workspaceId || "00000000-0000-4000-8000-000000000000")}`,
|
|
2583
|
+
`--manifest ${shellArg(seedManifestFile)}`,
|
|
2584
|
+
"--reset"
|
|
2585
|
+
].join(" "),
|
|
2586
|
+
verify_manifest_command: source.verifyScript ? `node ${source.verifyScript} ${shellArg(seedManifestFile)}` : null,
|
|
2587
|
+
write_command: `GTM_KERNEL_WORKSPACE_ID=${shellArg(workspaceId)} node scripts/gtm-kernel/seed-import-runner.mjs --source ${source.seedSource} --write`,
|
|
2588
|
+
write_requires: ["SUPABASE_URL", "SUPABASE_SERVICE_ROLE_KEY", "GTM_KERNEL_WORKSPACE_ID", "explicit operator approval"]
|
|
2589
|
+
},
|
|
2590
|
+
cli_commands: [
|
|
2591
|
+
{
|
|
2592
|
+
id: "memory_status",
|
|
2593
|
+
label: "Check strategy memory readiness",
|
|
2594
|
+
command: `${sdkCliBase} gtm strategy-memory${strategyFlag} --brief ${shellArg(brief)} --json`,
|
|
2595
|
+
safety: "read-only MCP memory readiness; no credits, provider writes, sender loads, exports, or sends"
|
|
2596
|
+
},
|
|
2597
|
+
{
|
|
2598
|
+
id: "memory_search",
|
|
2599
|
+
label: "Search ranked campaign memory",
|
|
2600
|
+
command: `${sdkCliBase} gtm memory search --query ${shellArg(String(searchArgs.query || brief))} --limit 10 --json`,
|
|
2601
|
+
safety: "read-only ranked memory lookup"
|
|
2602
|
+
},
|
|
2603
|
+
{
|
|
2604
|
+
id: "seed_dry_run",
|
|
2605
|
+
label: "Dry-run private memory seed import",
|
|
2606
|
+
command: [
|
|
2607
|
+
"node scripts/gtm-kernel/seed-import-runner.mjs",
|
|
2608
|
+
`--source ${source.seedSource}`,
|
|
2609
|
+
"--dry-run",
|
|
2610
|
+
`--workspace-id ${shellArg(input.workspaceId || "00000000-0000-4000-8000-000000000000")}`,
|
|
2611
|
+
`--manifest ${shellArg(seedManifestFile)}`,
|
|
2612
|
+
"--reset"
|
|
2613
|
+
].join(" "),
|
|
2614
|
+
safety: "local extraction and manifest only; no database writes"
|
|
2615
|
+
},
|
|
2616
|
+
{
|
|
2617
|
+
id: "write_request",
|
|
2618
|
+
label: "Write reusable campaign request JSON",
|
|
2619
|
+
command: `${cliBase} campaign-agent init${strategyFlag}${targetFlag}${localLeadsFlag} --output-file ${shellArg(requestFile)}`,
|
|
2620
|
+
safety: "local file only; no MCP calls, credits, provider writes, sender loads, exports, or sends"
|
|
2621
|
+
},
|
|
2622
|
+
{
|
|
2623
|
+
id: "proof",
|
|
2624
|
+
label: "Run campaign proof after memory check",
|
|
2625
|
+
command: `${cliBase} campaign-agent proof --request-file ${shellArg(requestFile)} --json`,
|
|
2626
|
+
safety: "read-only planning plus forced build_campaign dry-run with confirm_spend=false"
|
|
2627
|
+
}
|
|
2628
|
+
],
|
|
2629
|
+
mcp_calls: [
|
|
2630
|
+
{
|
|
2631
|
+
id: "strategy_memory_status",
|
|
2632
|
+
tool: "gtm_campaign_strategy_memory_status",
|
|
2633
|
+
arguments: statusArgs,
|
|
2634
|
+
safety: "read-only strategy/workflow memory readiness with sources and no raw samples"
|
|
2635
|
+
},
|
|
2636
|
+
{
|
|
2637
|
+
id: "memory_search",
|
|
2638
|
+
tool: "gtm_memory_search",
|
|
2639
|
+
arguments: searchArgs,
|
|
2640
|
+
safety: "read-only ranked memory lookup"
|
|
2641
|
+
},
|
|
2642
|
+
{
|
|
2643
|
+
id: "campaign_agent_plan",
|
|
2644
|
+
tool: "gtm_campaign_agent_plan",
|
|
2645
|
+
arguments: campaignBuilderBuildKitMcpArgs(request),
|
|
2646
|
+
safety: "read-only campaign-agent plan using built-in Signaliz lanes, memory, Brain, Nango, and BYO routes"
|
|
2647
|
+
},
|
|
2648
|
+
{
|
|
2649
|
+
id: "campaign_agent_proof",
|
|
2650
|
+
tool: "gtm_campaign_agent_proof",
|
|
2651
|
+
arguments: { ...campaignBuilderBuildKitMcpArgs(request), idempotency_key: "campaign-agent-memory-proof-001" },
|
|
2652
|
+
safety: "forces build_campaign dry_run=true and confirm_spend=false after readiness"
|
|
2653
|
+
}
|
|
2654
|
+
],
|
|
2655
|
+
sdk_example: {
|
|
2656
|
+
language: "typescript",
|
|
2657
|
+
code: campaignBuilderMemoryKitSdkExample(request, seedManifestFile)
|
|
2658
|
+
},
|
|
2659
|
+
privacy: {
|
|
2660
|
+
client_names_allowed: false,
|
|
2661
|
+
notes: [
|
|
2662
|
+
"Use strategy templates, operating playbooks, memory dimensions, and anonymized campaign patterns instead of client names.",
|
|
2663
|
+
"Do not expose raw leads, private replies, domains, secrets, provider payloads, or customer account labels in kit output.",
|
|
2664
|
+
"Seed writes are workspace-private and require explicit operator approval plus Supabase service credentials."
|
|
2665
|
+
]
|
|
2666
|
+
},
|
|
2667
|
+
next_actions: [
|
|
2668
|
+
"Run memory_status before plan/proof so missing strategy coverage is visible.",
|
|
2669
|
+
`Run seed_dry_run and inspect ${seedManifestFile} before any memory write.`,
|
|
2670
|
+
"Use write_request to save the reusable campaign request, then run proof with no spend.",
|
|
2671
|
+
"Add BYO tools through campaign-agent --custom-tool only after route setup is reviewed."
|
|
2672
|
+
]
|
|
2673
|
+
};
|
|
2674
|
+
}
|
|
2372
2675
|
function createCampaignBuilderToolRoute(input) {
|
|
2373
2676
|
return {
|
|
2374
2677
|
provider: input.provider ?? "custom_mcp",
|
|
@@ -2384,6 +2687,142 @@ function createCampaignBuilderToolRoute(input) {
|
|
|
2384
2687
|
rationale: `${input.label ?? input.provider ?? "Custom tool"} is a user-provided campaign-builder route for ${input.layer}.`
|
|
2385
2688
|
};
|
|
2386
2689
|
}
|
|
2690
|
+
function campaignBuilderBuildKitMcpArgs(request) {
|
|
2691
|
+
return compact({
|
|
2692
|
+
goal: request.goal,
|
|
2693
|
+
campaign_brief: request.goal,
|
|
2694
|
+
campaign_name: request.campaignName,
|
|
2695
|
+
account_label: request.accountLabel,
|
|
2696
|
+
account_context: request.accountContext,
|
|
2697
|
+
strategy_template: request.strategyTemplate,
|
|
2698
|
+
operating_playbooks: request.operatingPlaybooks,
|
|
2699
|
+
target_icp: request.icp,
|
|
2700
|
+
target_count: request.targetCount,
|
|
2701
|
+
builtins: request.builtIns,
|
|
2702
|
+
include_local_leads: request.builtIns?.includes("local_leads") || void 0,
|
|
2703
|
+
preferred_providers: request.preferredProviders,
|
|
2704
|
+
custom_tools: request.integrations?.map((route) => compact({
|
|
2705
|
+
provider: route.provider,
|
|
2706
|
+
layer: route.layer,
|
|
2707
|
+
gtm_layers: route.gtmLayers ?? (route.gtmLayer ? [route.gtmLayer] : void 0),
|
|
2708
|
+
tool: route.toolName,
|
|
2709
|
+
mcp: route.mcpServerName,
|
|
2710
|
+
mode: route.mode,
|
|
2711
|
+
approval_required: route.approvalRequired
|
|
2712
|
+
})),
|
|
2713
|
+
include_nango_catalog: request.agencyContext?.includeNangoCatalog,
|
|
2714
|
+
include_memory: request.memory?.enabled,
|
|
2715
|
+
include_brain: true,
|
|
2716
|
+
include_provider_routes: true,
|
|
2717
|
+
include_delivery_risk: true
|
|
2718
|
+
});
|
|
2719
|
+
}
|
|
2720
|
+
function campaignBuilderBuildKitSdkExample(request, requestFile) {
|
|
2721
|
+
const proofRequest = {
|
|
2722
|
+
goal: request.goal,
|
|
2723
|
+
strategyTemplate: request.strategyTemplate,
|
|
2724
|
+
targetCount: request.targetCount,
|
|
2725
|
+
builtIns: request.builtIns,
|
|
2726
|
+
integrations: request.integrations
|
|
2727
|
+
};
|
|
2728
|
+
return [
|
|
2729
|
+
"import { Signaliz, createCampaignBuilderBuildKit } from '@signaliz/sdk';",
|
|
2730
|
+
"",
|
|
2731
|
+
`const kit = createCampaignBuilderBuildKit({ requestFile: ${JSON.stringify(requestFile)}, ...${JSON.stringify(proofRequest, null, 2)} });`,
|
|
2732
|
+
"console.log(kit.cli_commands.find((command) => command.id === 'proof_shortcut')?.command);",
|
|
2733
|
+
"",
|
|
2734
|
+
"const signaliz = new Signaliz({ apiKey: process.env.SIGNALIZ_API_KEY! });",
|
|
2735
|
+
"const proof = await signaliz.campaignBuilderAgent.proof(kit.request, {",
|
|
2736
|
+
" idempotencyKey: `campaign-agent-proof-${Date.now()}`,",
|
|
2737
|
+
"});",
|
|
2738
|
+
"",
|
|
2739
|
+
'if (!proof.success || proof.dry_run_result?.status !== "dry_run") {',
|
|
2740
|
+
" throw new Error('Campaign proof failed or launched work unexpectedly');",
|
|
2741
|
+
"}"
|
|
2742
|
+
].join("\n");
|
|
2743
|
+
}
|
|
2744
|
+
function campaignBuilderMemoryKitSdkExample(request, seedManifestFile) {
|
|
2745
|
+
const input = {
|
|
2746
|
+
goal: request.goal,
|
|
2747
|
+
strategyTemplate: request.strategyTemplate,
|
|
2748
|
+
targetCount: request.targetCount,
|
|
2749
|
+
builtIns: request.builtIns
|
|
2750
|
+
};
|
|
2751
|
+
return [
|
|
2752
|
+
"import { Signaliz, createCampaignBuilderMemoryKit } from '@signaliz/sdk';",
|
|
2753
|
+
"",
|
|
2754
|
+
`const kit = createCampaignBuilderMemoryKit({ seedManifestFile: ${JSON.stringify(seedManifestFile)}, ...${JSON.stringify(input, null, 2)} });`,
|
|
2755
|
+
"console.log(kit.cli_commands.find((command) => command.id === 'memory_status')?.command);",
|
|
2756
|
+
"",
|
|
2757
|
+
"const signaliz = new Signaliz({ apiKey: process.env.SIGNALIZ_API_KEY! });",
|
|
2758
|
+
"const status = await signaliz.gtm.campaignStrategyMemoryStatus({",
|
|
2759
|
+
" strategyTemplate: kit.request.strategyTemplate,",
|
|
2760
|
+
" campaignBrief: kit.request.goal,",
|
|
2761
|
+
" includeSources: true,",
|
|
2762
|
+
" includeSamples: false,",
|
|
2763
|
+
"});",
|
|
2764
|
+
"",
|
|
2765
|
+
"if (status?.ready === false) {",
|
|
2766
|
+
" throw new Error('Strategy memory is not ready for this campaign request');",
|
|
2767
|
+
"}"
|
|
2768
|
+
].join("\n");
|
|
2769
|
+
}
|
|
2770
|
+
function campaignBuilderMemoryKitSource(source) {
|
|
2771
|
+
const normalized = normalizeTemplateKey(source || "agency");
|
|
2772
|
+
const catalog = {
|
|
2773
|
+
agency: {
|
|
2774
|
+
id: "agency_campaign_builder",
|
|
2775
|
+
label: "Agency campaign-builder strategy patterns",
|
|
2776
|
+
seed_source: "agency",
|
|
2777
|
+
scope: "private_strategy_docs",
|
|
2778
|
+
privacy: "workspace-private sanitized docs and abstracted campaign summaries"
|
|
2779
|
+
},
|
|
2780
|
+
workflow: {
|
|
2781
|
+
id: "workflow_pattern_corpus",
|
|
2782
|
+
label: "Workflow and table-build pattern corpus",
|
|
2783
|
+
seed_source: "building-clay",
|
|
2784
|
+
scope: "read_only_workflow_docs",
|
|
2785
|
+
privacy: "sanitized operating model and workflow patterns"
|
|
2786
|
+
},
|
|
2787
|
+
feedback: {
|
|
2788
|
+
id: "campaign_feedback",
|
|
2789
|
+
label: "Campaign feedback and reply patterns",
|
|
2790
|
+
seed_source: "instantly",
|
|
2791
|
+
scope: "workspace_private_feedback",
|
|
2792
|
+
privacy: "aggregate feedback, reply, and sequence performance memory"
|
|
2793
|
+
}
|
|
2794
|
+
};
|
|
2795
|
+
const sourceMap = {
|
|
2796
|
+
agency: "agency",
|
|
2797
|
+
"campaign-builder": "agency",
|
|
2798
|
+
"strategy-memory": "agency",
|
|
2799
|
+
"workflow-patterns": "workflow",
|
|
2800
|
+
workflow: "workflow",
|
|
2801
|
+
"building-clay": "workflow",
|
|
2802
|
+
clay: "workflow",
|
|
2803
|
+
"instantly-feedback": "feedback",
|
|
2804
|
+
instantly: "feedback",
|
|
2805
|
+
feedback: "feedback",
|
|
2806
|
+
all: "all"
|
|
2807
|
+
};
|
|
2808
|
+
const selected = sourceMap[normalized] || "agency";
|
|
2809
|
+
if (selected === "all") {
|
|
2810
|
+
return {
|
|
2811
|
+
seedSource: "all",
|
|
2812
|
+
verifyScript: null,
|
|
2813
|
+
memorySources: [catalog.agency, catalog.workflow, catalog.feedback]
|
|
2814
|
+
};
|
|
2815
|
+
}
|
|
2816
|
+
const item = catalog[selected];
|
|
2817
|
+
return {
|
|
2818
|
+
seedSource: item.seed_source,
|
|
2819
|
+
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,
|
|
2820
|
+
memorySources: [item]
|
|
2821
|
+
};
|
|
2822
|
+
}
|
|
2823
|
+
function shellArg(value) {
|
|
2824
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
2825
|
+
}
|
|
2387
2826
|
function normalizeTemplateKey(value) {
|
|
2388
2827
|
return String(value || "").trim().toLowerCase().replace(/[_\s]+/g, "-");
|
|
2389
2828
|
}
|
|
@@ -6743,6 +7182,8 @@ export {
|
|
|
6743
7182
|
getCampaignBuilderOperatingPlaybooksForRequest,
|
|
6744
7183
|
applyCampaignBuilderStrategyTemplate,
|
|
6745
7184
|
createCampaignBuilderAgentRequestTemplate,
|
|
7185
|
+
createCampaignBuilderBuildKit,
|
|
7186
|
+
createCampaignBuilderMemoryKit,
|
|
6746
7187
|
createCampaignBuilderToolRoute,
|
|
6747
7188
|
Icps,
|
|
6748
7189
|
normalizeExecutionReference,
|