@signaliz/sdk 1.0.15 → 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 +15 -0
- package/dist/{chunk-6OZWMAV3.mjs → chunk-5JNKSMNW.mjs} +230 -0
- package/dist/cli.js +287 -1
- package/dist/cli.mjs +61 -3
- package/dist/index.d.mts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +231 -0
- package/dist/index.mjs +3 -1
- package/dist/mcp-config.js +229 -0
- package/dist/mcp-config.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -112,11 +112,19 @@ const kit = signaliz.campaignBuilderAgent.buildKit({
|
|
|
112
112
|
includeLocalLeads: true,
|
|
113
113
|
includeCustomToolPlaceholder: true,
|
|
114
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
|
+
});
|
|
115
122
|
|
|
116
123
|
console.log(plan.strategyMemoryStatus?.ready);
|
|
117
124
|
console.log(readiness.summary.ready);
|
|
118
125
|
console.log(proof.success);
|
|
119
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'));
|
|
120
128
|
console.log(plan.mcpFlow.filter((step) =>
|
|
121
129
|
['gtm_provider_recipe_prepare', 'gtm_provider_route_activate'].includes(step.tool)
|
|
122
130
|
));
|
|
@@ -152,6 +160,13 @@ npx @signaliz/sdk campaign-agent kit \
|
|
|
152
160
|
--with-byo-placeholder \
|
|
153
161
|
--json
|
|
154
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
|
+
|
|
155
170
|
npx @signaliz/sdk campaign-agent plan \
|
|
156
171
|
--request-file campaign-request.json \
|
|
157
172
|
--target-count 250 \
|
|
@@ -1708,6 +1708,9 @@ var CampaignBuilderAgent = class {
|
|
|
1708
1708
|
buildKit(options = {}) {
|
|
1709
1709
|
return createCampaignBuilderBuildKit(options);
|
|
1710
1710
|
}
|
|
1711
|
+
memoryKit(options = {}) {
|
|
1712
|
+
return createCampaignBuilderMemoryKit(options);
|
|
1713
|
+
}
|
|
1711
1714
|
async commitPlan(plan, options = {}) {
|
|
1712
1715
|
const writeMode = options.confirm === true && options.dryRun === false;
|
|
1713
1716
|
if (writeMode && !options.approvedBy) {
|
|
@@ -2428,6 +2431,12 @@ function createCampaignBuilderBuildKit(input = {}) {
|
|
|
2428
2431
|
command: `${cliBase} campaign-agent init${strategyFlag}${targetFlag}${localLeadsFlag} --output-file ${shellArg(requestFile)}`,
|
|
2429
2432
|
safety: "local file only; no MCP calls, credits, provider writes, sender loads, exports, or sends"
|
|
2430
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
|
+
},
|
|
2431
2440
|
{
|
|
2432
2441
|
id: "proof_shortcut",
|
|
2433
2442
|
label: "Run no-spend campaign-builder proof",
|
|
@@ -2522,6 +2531,147 @@ function createCampaignBuilderBuildKit(input = {}) {
|
|
|
2522
2531
|
]
|
|
2523
2532
|
};
|
|
2524
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
|
+
}
|
|
2525
2675
|
function createCampaignBuilderToolRoute(input) {
|
|
2526
2676
|
return {
|
|
2527
2677
|
provider: input.provider ?? "custom_mcp",
|
|
@@ -2591,6 +2741,85 @@ function campaignBuilderBuildKitSdkExample(request, requestFile) {
|
|
|
2591
2741
|
"}"
|
|
2592
2742
|
].join("\n");
|
|
2593
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
|
+
}
|
|
2594
2823
|
function shellArg(value) {
|
|
2595
2824
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
2596
2825
|
}
|
|
@@ -6954,6 +7183,7 @@ export {
|
|
|
6954
7183
|
applyCampaignBuilderStrategyTemplate,
|
|
6955
7184
|
createCampaignBuilderAgentRequestTemplate,
|
|
6956
7185
|
createCampaignBuilderBuildKit,
|
|
7186
|
+
createCampaignBuilderMemoryKit,
|
|
6957
7187
|
createCampaignBuilderToolRoute,
|
|
6958
7188
|
Icps,
|
|
6959
7189
|
normalizeExecutionReference,
|
package/dist/cli.js
CHANGED
|
@@ -1714,6 +1714,9 @@ var CampaignBuilderAgent = class {
|
|
|
1714
1714
|
buildKit(options = {}) {
|
|
1715
1715
|
return createCampaignBuilderBuildKit(options);
|
|
1716
1716
|
}
|
|
1717
|
+
memoryKit(options = {}) {
|
|
1718
|
+
return createCampaignBuilderMemoryKit(options);
|
|
1719
|
+
}
|
|
1717
1720
|
async commitPlan(plan, options = {}) {
|
|
1718
1721
|
const writeMode = options.confirm === true && options.dryRun === false;
|
|
1719
1722
|
if (writeMode && !options.approvedBy) {
|
|
@@ -2434,6 +2437,12 @@ function createCampaignBuilderBuildKit(input = {}) {
|
|
|
2434
2437
|
command: `${cliBase} campaign-agent init${strategyFlag}${targetFlag}${localLeadsFlag} --output-file ${shellArg(requestFile)}`,
|
|
2435
2438
|
safety: "local file only; no MCP calls, credits, provider writes, sender loads, exports, or sends"
|
|
2436
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
|
+
},
|
|
2437
2446
|
{
|
|
2438
2447
|
id: "proof_shortcut",
|
|
2439
2448
|
label: "Run no-spend campaign-builder proof",
|
|
@@ -2528,6 +2537,147 @@ function createCampaignBuilderBuildKit(input = {}) {
|
|
|
2528
2537
|
]
|
|
2529
2538
|
};
|
|
2530
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
|
+
}
|
|
2531
2681
|
function createCampaignBuilderToolRoute(input) {
|
|
2532
2682
|
return {
|
|
2533
2683
|
provider: input.provider ?? "custom_mcp",
|
|
@@ -2597,6 +2747,85 @@ function campaignBuilderBuildKitSdkExample(request, requestFile) {
|
|
|
2597
2747
|
"}"
|
|
2598
2748
|
].join("\n");
|
|
2599
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
|
+
}
|
|
2600
2829
|
function shellArg(value) {
|
|
2601
2830
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
2602
2831
|
}
|
|
@@ -6949,7 +7178,7 @@ async function main() {
|
|
|
6949
7178
|
printHelp();
|
|
6950
7179
|
return;
|
|
6951
7180
|
}
|
|
6952
|
-
const offlineCampaignAgentTemplate = (command === "campaign-agent" || command === "campaign-builder") && ["init", "template", "request-template", "new", "kit", "build-kit", "blueprint"].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] || ""));
|
|
6953
7182
|
if (!apiKey && !offlineCampaignAgentTemplate) {
|
|
6954
7183
|
console.error("\u274C SIGNALIZ_API_KEY environment variable is required.");
|
|
6955
7184
|
console.error(" Set it with: export SIGNALIZ_API_KEY=sk_...");
|
|
@@ -7345,6 +7574,41 @@ async function handleCampaignAgentCommand(signaliz, argv) {
|
|
|
7345
7574
|
}
|
|
7346
7575
|
return;
|
|
7347
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
|
+
}
|
|
7348
7612
|
if (["review", "status", "rows", "artifacts", "approve", "approve-delivery"].includes(subcommand)) {
|
|
7349
7613
|
await handleCampaignAgentReviewCommand(signaliz, subcommand, argv.slice(1));
|
|
7350
7614
|
return;
|
|
@@ -7890,6 +8154,26 @@ function printCampaignAgentBuildKit(kit) {
|
|
|
7890
8154
|
console.log("\nNext:");
|
|
7891
8155
|
for (const action of kit.next_actions.slice(0, 4)) console.log(`- ${action}`);
|
|
7892
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
|
+
}
|
|
7893
8177
|
function printCampaignAgentExecution(payload, flags) {
|
|
7894
8178
|
if (booleanFlag(flags, "json")) {
|
|
7895
8179
|
printJson(payload);
|
|
@@ -8050,6 +8334,7 @@ Usage:
|
|
|
8050
8334
|
signaliz gtm memory search --query "proof-first vertical gate" --json
|
|
8051
8335
|
signaliz gtm plan --brief "Build 500 verified leads for..." --strategy-template non-medical-home-care --lead-count 500 --json
|
|
8052
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
|
|
8053
8338
|
signaliz campaign-agent doctor --request-file campaign-request.json --json
|
|
8054
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
|
|
8055
8340
|
signaliz campaign-agent proof --goal "Build a strategy-template campaign..." --strategy-template non-medical-home-care --target-count 100 --json
|
|
@@ -8088,6 +8373,7 @@ Signaliz campaign-agent commands:
|
|
|
8088
8373
|
|
|
8089
8374
|
signaliz campaign-agent init [--goal TEXT] [--strategy-template ID] [--target-count N] [--use-local-leads] [--with-byo-placeholder] [--output-file FILE] [--json]
|
|
8090
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]
|
|
8091
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]
|
|
8092
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]
|
|
8093
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]
|