@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.
@@ -1229,6 +1229,14 @@ var CAMPAIGN_BUILDER_BUILT_IN_ROUTE_IDS = {
1229
1229
  email_verification: "signaliz-email-verification",
1230
1230
  signals: "signaliz-signals"
1231
1231
  };
1232
+ var DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES = [
1233
+ "memory_retrieval",
1234
+ "spend",
1235
+ "customer_tool",
1236
+ "external_write",
1237
+ "delivery",
1238
+ "launch"
1239
+ ];
1232
1240
  var CAMPAIGN_BUILDER_OPERATING_PLAYBOOKS = [
1233
1241
  {
1234
1242
  slug: "cache-first-large-list",
@@ -1728,6 +1736,12 @@ var CampaignBuilderAgent = class {
1728
1736
  });
1729
1737
  return createCampaignBuilderProofReceipt(plan, result);
1730
1738
  }
1739
+ buildKit(options = {}) {
1740
+ return createCampaignBuilderBuildKit(options);
1741
+ }
1742
+ memoryKit(options = {}) {
1743
+ return createCampaignBuilderMemoryKit(options);
1744
+ }
1731
1745
  async commitPlan(plan, options = {}) {
1732
1746
  const writeMode = options.confirm === true && options.dryRun === false;
1733
1747
  if (writeMode && !options.approvedBy) {
@@ -2306,6 +2320,533 @@ function applyCampaignBuilderStrategyTemplate(request) {
2306
2320
  agencyContext: mergeAgencyContext(template.agencyContext, request.agencyContext)
2307
2321
  };
2308
2322
  }
2323
+ function createCampaignBuilderAgentRequestTemplate(input = {}) {
2324
+ const builtIns = new Set(input.builtIns ?? DEFAULT_CAMPAIGN_BUILDER_BUILT_INS);
2325
+ if (input.includeLocalLeads) builtIns.add("local_leads");
2326
+ const integrations = input.integrations ?? (input.includeCustomToolPlaceholder ? [createCampaignBuilderToolRoute({
2327
+ provider: "custom_mcp",
2328
+ layer: "enrichment",
2329
+ gtmLayers: ["company_enrichment"],
2330
+ toolName: "workspace_enrich",
2331
+ mcpServerName: "workspace-mcp",
2332
+ label: "Workspace enrichment MCP",
2333
+ mode: "if_available",
2334
+ approvalRequired: true
2335
+ })] : void 0);
2336
+ const preferredProviders = uniqueStrings([
2337
+ ...input.preferredProviders ?? [],
2338
+ ...input.includeNango === false ? [] : ["nango"]
2339
+ ]);
2340
+ const templated = applyCampaignBuilderStrategyTemplate({
2341
+ goal: input.goal || "Build a strategy-template campaign for mature operators in the target ICP.",
2342
+ strategyTemplate: input.strategyTemplate || "non-medical-home-care",
2343
+ campaignName: input.campaignName,
2344
+ accountLabel: input.accountLabel || "Workspace Campaign",
2345
+ accountContext: input.accountContext || "Use private workspace memory, current suppression rules, verified-email quality gates, and approval-gated provider routes.",
2346
+ targetCount: input.targetCount,
2347
+ icp: input.icp ?? {
2348
+ personas: ["Operations leader", "Founder", "Revenue leader"],
2349
+ industries: ["B2B services", "Vertical software", "Local operators"],
2350
+ geographies: ["United States"],
2351
+ keywords: ["growth", "operations", "customer acquisition"],
2352
+ requireVerifiedEmail: true
2353
+ },
2354
+ builtIns: [...builtIns],
2355
+ integrations,
2356
+ customerTools: input.customerTools,
2357
+ preferredProviders,
2358
+ constraints: input.constraints,
2359
+ workspaceContext: input.workspaceContext,
2360
+ brainDefaults: input.brainDefaults,
2361
+ deliveryRisk: input.deliveryRisk,
2362
+ gtmCampaignId: input.gtmCampaignId
2363
+ });
2364
+ return compact({
2365
+ ...templated,
2366
+ memory: mergeMemoryPlan({
2367
+ enabled: true,
2368
+ useWorkspaceHistory: true,
2369
+ useNetworkPatterns: false,
2370
+ privacyMode: "anonymized_patterns",
2371
+ queries: [{
2372
+ query: `${templated.strategyTemplate || "strategy-template"} campaign reply patterns, objections, qualification gates, and verified-email QA`,
2373
+ scopes: ["workspace", "operator_notes"],
2374
+ topK: 10,
2375
+ required: true,
2376
+ rationale: "Load approved private strategy and workflow patterns before campaign planning."
2377
+ }]
2378
+ }, input.memory),
2379
+ agencyContext: mergeAgencyContext({
2380
+ strategyModel: "strategy_template",
2381
+ includeStrategyPatterns: true,
2382
+ includeWorkflowPatterns: true,
2383
+ includeNangoCatalog: true,
2384
+ partnerEcosystem: input.includeNango === false ? ["signaliz"] : ["signaliz", "nango"]
2385
+ }, input.agencyContext),
2386
+ signalizDefaults: mergeSignalizDefaultOverrides({
2387
+ maxCredits: input.signalizDefaults?.maxCredits,
2388
+ delivery: {
2389
+ enabled: true,
2390
+ destinationType: input.signalizDefaults?.delivery?.destinationType ?? "json",
2391
+ approvalRequired: true
2392
+ }
2393
+ }, input.signalizDefaults),
2394
+ approvalPolicy: {
2395
+ requireHumanApproval: true,
2396
+ maxCreditsWithoutApproval: 0,
2397
+ requireApprovalFor: DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES,
2398
+ ...input.approvalPolicy
2399
+ }
2400
+ });
2401
+ }
2402
+ function createCampaignBuilderBuildKit(input = {}) {
2403
+ const requestFile = input.requestFile || "campaign-request.json";
2404
+ const cliPackage = input.cliPackage || "@signaliz/cli";
2405
+ const sdkPackage = input.sdkPackage || "@signaliz/sdk";
2406
+ const request = createCampaignBuilderAgentRequestTemplate(input);
2407
+ const strategyTemplate = stringValue(request.strategyTemplate) ?? null;
2408
+ const builtIns = request.builtIns ?? DEFAULT_CAMPAIGN_BUILDER_BUILT_INS;
2409
+ const useLocalLeads = builtIns.includes("local_leads");
2410
+ const customRoutes = [
2411
+ ...request.integrations ?? [],
2412
+ ...routesFromCustomerTools(request.customerTools ?? [])
2413
+ ].filter((route) => route.provider !== "signaliz");
2414
+ const strategyFlag = strategyTemplate ? ` --strategy-template ${shellArg(strategyTemplate)}` : "";
2415
+ const targetFlag = request.targetCount ? ` --target-count ${request.targetCount}` : "";
2416
+ const localLeadsFlag = useLocalLeads ? " --use-local-leads" : "";
2417
+ const cliBase = `npx ${cliPackage}`;
2418
+ const sdkCliBase = `npx ${sdkPackage}`;
2419
+ const brief = request.goal || "Build a strategy-template campaign for the target ICP.";
2420
+ const mcpArgs = campaignBuilderBuildKitMcpArgs(request);
2421
+ return {
2422
+ kit_version: "campaign-builder-kit.v1",
2423
+ source: "signaliz.campaignBuilderAgent.buildKit",
2424
+ request_file: requestFile,
2425
+ request,
2426
+ strategy_template: strategyTemplate,
2427
+ built_in_lanes: builtIns,
2428
+ operating_playbooks: getCampaignBuilderOperatingPlaybooksForRequest(request).map((playbook) => playbook.slug),
2429
+ custom_routes: customRoutes.map((route) => ({
2430
+ provider: String(route.provider),
2431
+ layer: String(route.layer),
2432
+ tool: firstNonEmptyString(route.toolName),
2433
+ mcp_server: firstNonEmptyString(route.mcpServerName),
2434
+ mode: route.mode ?? "if_available",
2435
+ approval_required: route.approvalRequired === true || route.mode === "required"
2436
+ })),
2437
+ approval_boundaries: request.approvalPolicy?.requireApprovalFor ?? DEFAULT_CAMPAIGN_BUILDER_APPROVAL_TYPES,
2438
+ byo_tool_pattern: {
2439
+ cli_flag: "--custom-tool provider:layer:tool[:mcp]",
2440
+ request_fragment: createCampaignBuilderToolRoute({
2441
+ provider: "workspace_mcp",
2442
+ layer: "enrichment",
2443
+ gtmLayers: ["company_enrichment"],
2444
+ toolName: "workspace_account_enrich",
2445
+ mcpServerName: "workspace-mcp",
2446
+ label: "Workspace account enrichment",
2447
+ mode: "required",
2448
+ approvalRequired: true
2449
+ })
2450
+ },
2451
+ cli_commands: [
2452
+ {
2453
+ id: "write_request",
2454
+ label: "Write reusable request JSON",
2455
+ command: `${cliBase} campaign-agent init${strategyFlag}${targetFlag}${localLeadsFlag} --output-file ${shellArg(requestFile)}`,
2456
+ safety: "local file only; no MCP calls, credits, provider writes, sender loads, exports, or sends"
2457
+ },
2458
+ {
2459
+ id: "memory_kit",
2460
+ label: "Inspect memory readiness and seed runner",
2461
+ command: `${sdkCliBase} campaign-agent memory-kit${strategyFlag}${targetFlag}${localLeadsFlag} --request-file ${shellArg(requestFile)} --json`,
2462
+ safety: "read-only memory readiness packet plus local seed dry-run commands"
2463
+ },
2464
+ {
2465
+ id: "proof_shortcut",
2466
+ label: "Run no-spend campaign-builder proof",
2467
+ command: `${cliBase} build ${shellArg(brief)}${strategyFlag}${targetFlag}${localLeadsFlag} --json`,
2468
+ safety: "strategy memory, Kernel plan, approvals, and forced build_campaign dry-run only"
2469
+ },
2470
+ {
2471
+ id: "plan",
2472
+ label: "Inspect the full campaign-agent plan",
2473
+ command: `${sdkCliBase} campaign-agent plan --request-file ${shellArg(requestFile)} --json`,
2474
+ safety: "read-only MCP planning and provider-route dry-runs"
2475
+ },
2476
+ {
2477
+ id: "doctor",
2478
+ label: "Check readiness gates",
2479
+ command: `${sdkCliBase} campaign-agent doctor --request-file ${shellArg(requestFile)} --json`,
2480
+ safety: "read-only readiness checks for Memory, Brain, built-ins, BYO routes, and approvals"
2481
+ },
2482
+ {
2483
+ id: "commit_preview",
2484
+ label: "Preview GTM campaign object commit",
2485
+ command: `${sdkCliBase} campaign-agent commit-plan --request-file ${shellArg(requestFile)} --json`,
2486
+ safety: "dry-run commit; writes only with --confirm-write and --approved-by"
2487
+ },
2488
+ {
2489
+ id: "approved_launch",
2490
+ label: "Launch after explicit approval",
2491
+ 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`,
2492
+ safety: "spendful path; requires human approval identity, approval types, and spend limit"
2493
+ }
2494
+ ],
2495
+ mcp_calls: [
2496
+ {
2497
+ id: "request_template",
2498
+ tool: "gtm_campaign_agent_request_template",
2499
+ arguments: mcpArgs,
2500
+ safety: "read-only reusable request generation"
2501
+ },
2502
+ {
2503
+ id: "readiness",
2504
+ tool: "gtm_campaign_agent_readiness",
2505
+ arguments: mcpArgs,
2506
+ safety: "read-only preflight across strategy memory, Kernel plan, lanes, routes, and approvals"
2507
+ },
2508
+ {
2509
+ id: "proof",
2510
+ tool: "gtm_campaign_agent_proof",
2511
+ arguments: { ...mcpArgs, idempotency_key: "campaign-agent-proof-001" },
2512
+ safety: "forces build_campaign dry_run=true and confirm_spend=false"
2513
+ },
2514
+ {
2515
+ id: "plan",
2516
+ tool: "gtm_campaign_agent_plan",
2517
+ arguments: mcpArgs,
2518
+ safety: "read-only one-call campaign-agent runbook"
2519
+ },
2520
+ {
2521
+ id: "commit_preview",
2522
+ tool: "gtm_campaign_build_plan_commit",
2523
+ arguments: {
2524
+ name: request.campaignName,
2525
+ campaign_brief: request.goal,
2526
+ lead_count: request.targetCount,
2527
+ dry_run: true,
2528
+ confirm: false
2529
+ },
2530
+ safety: "dry-run commit preview only"
2531
+ }
2532
+ ],
2533
+ sdk_example: {
2534
+ language: "typescript",
2535
+ code: campaignBuilderBuildKitSdkExample(request, requestFile)
2536
+ },
2537
+ verification: [
2538
+ `${cliBase} campaign-agent proof --request-file ${shellArg(requestFile)} --json`,
2539
+ `${cliBase} campaign-agent doctor --request-file ${shellArg(requestFile)} --json`,
2540
+ "Confirm proof.success is true and dry_run_result.status is dry_run before any approved launch.",
2541
+ "Confirm no campaign_build_id exists in a proof receipt before moving to approved launch."
2542
+ ],
2543
+ privacy: {
2544
+ client_names_allowed: false,
2545
+ notes: [
2546
+ "Use strategy templates, operating playbooks, and anonymized workflow patterns instead of client names.",
2547
+ "Do not include raw leads, private replies, domains, secrets, or customer account labels in public kit output."
2548
+ ]
2549
+ },
2550
+ next_actions: [
2551
+ `Write or review ${requestFile}.`,
2552
+ "Run the proof command before spending credits or activating provider writes.",
2553
+ "Add BYO integrations with --custom-tool provider:layer:tool[:mcp] or the request_fragment shape.",
2554
+ "Use build-approved only after human approval, spend limit, and delivery review policy are set."
2555
+ ]
2556
+ };
2557
+ }
2558
+ function createCampaignBuilderMemoryKit(input = {}) {
2559
+ const requestFile = input.requestFile || "campaign-request.json";
2560
+ const seedManifestFile = input.seedManifestFile || ".gtm-kernel-import-state/campaign-memory-dry-run.json";
2561
+ const cliPackage = input.cliPackage || "@signaliz/cli";
2562
+ const sdkPackage = input.sdkPackage || "@signaliz/sdk";
2563
+ const request = createCampaignBuilderAgentRequestTemplate(input);
2564
+ const strategyTemplate = stringValue(request.strategyTemplate) ?? null;
2565
+ const strategyFlag = strategyTemplate ? ` --strategy-template ${shellArg(strategyTemplate)}` : "";
2566
+ const targetFlag = request.targetCount ? ` --target-count ${request.targetCount}` : "";
2567
+ const localLeadsFlag = request.builtIns?.includes("local_leads") ? " --use-local-leads" : "";
2568
+ const cliBase = `npx ${cliPackage}`;
2569
+ const sdkCliBase = `npx ${sdkPackage}`;
2570
+ const source = campaignBuilderMemoryKitSource(input.source);
2571
+ const workspaceId = input.workspaceId || "your-workspace-id";
2572
+ const brief = request.goal || "Build a strategy-template campaign for the target ICP.";
2573
+ const statusArgs = compact({
2574
+ strategy_template: strategyTemplate,
2575
+ campaign_brief: brief,
2576
+ target_icp: request.icp,
2577
+ include_sources: true,
2578
+ include_samples: false,
2579
+ days: 90,
2580
+ limit: 25
2581
+ });
2582
+ const searchArgs = compact({
2583
+ query: request.memory?.queries?.[0]?.query || brief,
2584
+ layers: ["lead_generation", "email_finding", "email_verification", "company_enrichment", "copy_enrichment"],
2585
+ limit: 10
2586
+ });
2587
+ return {
2588
+ kit_version: "campaign-memory-kit.v1",
2589
+ source: "signaliz.campaignBuilderAgent.memoryKit",
2590
+ read_only: true,
2591
+ no_spend: true,
2592
+ no_provider_writes: true,
2593
+ client_names_allowed: false,
2594
+ request_file: requestFile,
2595
+ seed_manifest_file: seedManifestFile,
2596
+ request,
2597
+ strategy_template: strategyTemplate,
2598
+ operating_playbooks: getCampaignBuilderOperatingPlaybooksForRequest(request).map((playbook) => playbook.slug),
2599
+ memory_sources: source.memorySources,
2600
+ seed_runner: {
2601
+ local_script: "scripts/gtm-kernel/seed-import-runner.mjs",
2602
+ dry_run_command: [
2603
+ "node scripts/gtm-kernel/seed-import-runner.mjs",
2604
+ `--source ${source.seedSource}`,
2605
+ "--dry-run",
2606
+ `--workspace-id ${shellArg(input.workspaceId || "00000000-0000-4000-8000-000000000000")}`,
2607
+ `--manifest ${shellArg(seedManifestFile)}`,
2608
+ "--reset"
2609
+ ].join(" "),
2610
+ verify_manifest_command: source.verifyScript ? `node ${source.verifyScript} ${shellArg(seedManifestFile)}` : null,
2611
+ write_command: `GTM_KERNEL_WORKSPACE_ID=${shellArg(workspaceId)} node scripts/gtm-kernel/seed-import-runner.mjs --source ${source.seedSource} --write`,
2612
+ write_requires: ["SUPABASE_URL", "SUPABASE_SERVICE_ROLE_KEY", "GTM_KERNEL_WORKSPACE_ID", "explicit operator approval"]
2613
+ },
2614
+ cli_commands: [
2615
+ {
2616
+ id: "memory_status",
2617
+ label: "Check strategy memory readiness",
2618
+ command: `${sdkCliBase} gtm strategy-memory${strategyFlag} --brief ${shellArg(brief)} --json`,
2619
+ safety: "read-only MCP memory readiness; no credits, provider writes, sender loads, exports, or sends"
2620
+ },
2621
+ {
2622
+ id: "memory_search",
2623
+ label: "Search ranked campaign memory",
2624
+ command: `${sdkCliBase} gtm memory search --query ${shellArg(String(searchArgs.query || brief))} --limit 10 --json`,
2625
+ safety: "read-only ranked memory lookup"
2626
+ },
2627
+ {
2628
+ id: "seed_dry_run",
2629
+ label: "Dry-run private memory seed import",
2630
+ command: [
2631
+ "node scripts/gtm-kernel/seed-import-runner.mjs",
2632
+ `--source ${source.seedSource}`,
2633
+ "--dry-run",
2634
+ `--workspace-id ${shellArg(input.workspaceId || "00000000-0000-4000-8000-000000000000")}`,
2635
+ `--manifest ${shellArg(seedManifestFile)}`,
2636
+ "--reset"
2637
+ ].join(" "),
2638
+ safety: "local extraction and manifest only; no database writes"
2639
+ },
2640
+ {
2641
+ id: "write_request",
2642
+ label: "Write reusable campaign request JSON",
2643
+ command: `${cliBase} campaign-agent init${strategyFlag}${targetFlag}${localLeadsFlag} --output-file ${shellArg(requestFile)}`,
2644
+ safety: "local file only; no MCP calls, credits, provider writes, sender loads, exports, or sends"
2645
+ },
2646
+ {
2647
+ id: "proof",
2648
+ label: "Run campaign proof after memory check",
2649
+ command: `${cliBase} campaign-agent proof --request-file ${shellArg(requestFile)} --json`,
2650
+ safety: "read-only planning plus forced build_campaign dry-run with confirm_spend=false"
2651
+ }
2652
+ ],
2653
+ mcp_calls: [
2654
+ {
2655
+ id: "strategy_memory_status",
2656
+ tool: "gtm_campaign_strategy_memory_status",
2657
+ arguments: statusArgs,
2658
+ safety: "read-only strategy/workflow memory readiness with sources and no raw samples"
2659
+ },
2660
+ {
2661
+ id: "memory_search",
2662
+ tool: "gtm_memory_search",
2663
+ arguments: searchArgs,
2664
+ safety: "read-only ranked memory lookup"
2665
+ },
2666
+ {
2667
+ id: "campaign_agent_plan",
2668
+ tool: "gtm_campaign_agent_plan",
2669
+ arguments: campaignBuilderBuildKitMcpArgs(request),
2670
+ safety: "read-only campaign-agent plan using built-in Signaliz lanes, memory, Brain, Nango, and BYO routes"
2671
+ },
2672
+ {
2673
+ id: "campaign_agent_proof",
2674
+ tool: "gtm_campaign_agent_proof",
2675
+ arguments: { ...campaignBuilderBuildKitMcpArgs(request), idempotency_key: "campaign-agent-memory-proof-001" },
2676
+ safety: "forces build_campaign dry_run=true and confirm_spend=false after readiness"
2677
+ }
2678
+ ],
2679
+ sdk_example: {
2680
+ language: "typescript",
2681
+ code: campaignBuilderMemoryKitSdkExample(request, seedManifestFile)
2682
+ },
2683
+ privacy: {
2684
+ client_names_allowed: false,
2685
+ notes: [
2686
+ "Use strategy templates, operating playbooks, memory dimensions, and anonymized campaign patterns instead of client names.",
2687
+ "Do not expose raw leads, private replies, domains, secrets, provider payloads, or customer account labels in kit output.",
2688
+ "Seed writes are workspace-private and require explicit operator approval plus Supabase service credentials."
2689
+ ]
2690
+ },
2691
+ next_actions: [
2692
+ "Run memory_status before plan/proof so missing strategy coverage is visible.",
2693
+ `Run seed_dry_run and inspect ${seedManifestFile} before any memory write.`,
2694
+ "Use write_request to save the reusable campaign request, then run proof with no spend.",
2695
+ "Add BYO tools through campaign-agent --custom-tool only after route setup is reviewed."
2696
+ ]
2697
+ };
2698
+ }
2699
+ function createCampaignBuilderToolRoute(input) {
2700
+ return {
2701
+ provider: input.provider ?? "custom_mcp",
2702
+ layer: input.layer,
2703
+ toolName: input.toolName,
2704
+ mcpServerName: input.mcpServerName,
2705
+ label: input.label,
2706
+ mode: input.mode ?? "if_available",
2707
+ gtmLayer: input.gtmLayer,
2708
+ gtmLayers: input.gtmLayers,
2709
+ approvalRequired: input.approvalRequired ?? input.mode === "required",
2710
+ config: input.config,
2711
+ rationale: `${input.label ?? input.provider ?? "Custom tool"} is a user-provided campaign-builder route for ${input.layer}.`
2712
+ };
2713
+ }
2714
+ function campaignBuilderBuildKitMcpArgs(request) {
2715
+ return compact({
2716
+ goal: request.goal,
2717
+ campaign_brief: request.goal,
2718
+ campaign_name: request.campaignName,
2719
+ account_label: request.accountLabel,
2720
+ account_context: request.accountContext,
2721
+ strategy_template: request.strategyTemplate,
2722
+ operating_playbooks: request.operatingPlaybooks,
2723
+ target_icp: request.icp,
2724
+ target_count: request.targetCount,
2725
+ builtins: request.builtIns,
2726
+ include_local_leads: request.builtIns?.includes("local_leads") || void 0,
2727
+ preferred_providers: request.preferredProviders,
2728
+ custom_tools: request.integrations?.map((route) => compact({
2729
+ provider: route.provider,
2730
+ layer: route.layer,
2731
+ gtm_layers: route.gtmLayers ?? (route.gtmLayer ? [route.gtmLayer] : void 0),
2732
+ tool: route.toolName,
2733
+ mcp: route.mcpServerName,
2734
+ mode: route.mode,
2735
+ approval_required: route.approvalRequired
2736
+ })),
2737
+ include_nango_catalog: request.agencyContext?.includeNangoCatalog,
2738
+ include_memory: request.memory?.enabled,
2739
+ include_brain: true,
2740
+ include_provider_routes: true,
2741
+ include_delivery_risk: true
2742
+ });
2743
+ }
2744
+ function campaignBuilderBuildKitSdkExample(request, requestFile) {
2745
+ const proofRequest = {
2746
+ goal: request.goal,
2747
+ strategyTemplate: request.strategyTemplate,
2748
+ targetCount: request.targetCount,
2749
+ builtIns: request.builtIns,
2750
+ integrations: request.integrations
2751
+ };
2752
+ return [
2753
+ "import { Signaliz, createCampaignBuilderBuildKit } from '@signaliz/sdk';",
2754
+ "",
2755
+ `const kit = createCampaignBuilderBuildKit({ requestFile: ${JSON.stringify(requestFile)}, ...${JSON.stringify(proofRequest, null, 2)} });`,
2756
+ "console.log(kit.cli_commands.find((command) => command.id === 'proof_shortcut')?.command);",
2757
+ "",
2758
+ "const signaliz = new Signaliz({ apiKey: process.env.SIGNALIZ_API_KEY! });",
2759
+ "const proof = await signaliz.campaignBuilderAgent.proof(kit.request, {",
2760
+ " idempotencyKey: `campaign-agent-proof-${Date.now()}`,",
2761
+ "});",
2762
+ "",
2763
+ 'if (!proof.success || proof.dry_run_result?.status !== "dry_run") {',
2764
+ " throw new Error('Campaign proof failed or launched work unexpectedly');",
2765
+ "}"
2766
+ ].join("\n");
2767
+ }
2768
+ function campaignBuilderMemoryKitSdkExample(request, seedManifestFile) {
2769
+ const input = {
2770
+ goal: request.goal,
2771
+ strategyTemplate: request.strategyTemplate,
2772
+ targetCount: request.targetCount,
2773
+ builtIns: request.builtIns
2774
+ };
2775
+ return [
2776
+ "import { Signaliz, createCampaignBuilderMemoryKit } from '@signaliz/sdk';",
2777
+ "",
2778
+ `const kit = createCampaignBuilderMemoryKit({ seedManifestFile: ${JSON.stringify(seedManifestFile)}, ...${JSON.stringify(input, null, 2)} });`,
2779
+ "console.log(kit.cli_commands.find((command) => command.id === 'memory_status')?.command);",
2780
+ "",
2781
+ "const signaliz = new Signaliz({ apiKey: process.env.SIGNALIZ_API_KEY! });",
2782
+ "const status = await signaliz.gtm.campaignStrategyMemoryStatus({",
2783
+ " strategyTemplate: kit.request.strategyTemplate,",
2784
+ " campaignBrief: kit.request.goal,",
2785
+ " includeSources: true,",
2786
+ " includeSamples: false,",
2787
+ "});",
2788
+ "",
2789
+ "if (status?.ready === false) {",
2790
+ " throw new Error('Strategy memory is not ready for this campaign request');",
2791
+ "}"
2792
+ ].join("\n");
2793
+ }
2794
+ function campaignBuilderMemoryKitSource(source) {
2795
+ const normalized = normalizeTemplateKey(source || "agency");
2796
+ const catalog = {
2797
+ agency: {
2798
+ id: "agency_campaign_builder",
2799
+ label: "Agency campaign-builder strategy patterns",
2800
+ seed_source: "agency",
2801
+ scope: "private_strategy_docs",
2802
+ privacy: "workspace-private sanitized docs and abstracted campaign summaries"
2803
+ },
2804
+ workflow: {
2805
+ id: "workflow_pattern_corpus",
2806
+ label: "Workflow and table-build pattern corpus",
2807
+ seed_source: "building-clay",
2808
+ scope: "read_only_workflow_docs",
2809
+ privacy: "sanitized operating model and workflow patterns"
2810
+ },
2811
+ feedback: {
2812
+ id: "campaign_feedback",
2813
+ label: "Campaign feedback and reply patterns",
2814
+ seed_source: "instantly",
2815
+ scope: "workspace_private_feedback",
2816
+ privacy: "aggregate feedback, reply, and sequence performance memory"
2817
+ }
2818
+ };
2819
+ const sourceMap = {
2820
+ agency: "agency",
2821
+ "campaign-builder": "agency",
2822
+ "strategy-memory": "agency",
2823
+ "workflow-patterns": "workflow",
2824
+ workflow: "workflow",
2825
+ "building-clay": "workflow",
2826
+ clay: "workflow",
2827
+ "instantly-feedback": "feedback",
2828
+ instantly: "feedback",
2829
+ feedback: "feedback",
2830
+ all: "all"
2831
+ };
2832
+ const selected = sourceMap[normalized] || "agency";
2833
+ if (selected === "all") {
2834
+ return {
2835
+ seedSource: "all",
2836
+ verifyScript: null,
2837
+ memorySources: [catalog.agency, catalog.workflow, catalog.feedback]
2838
+ };
2839
+ }
2840
+ const item = catalog[selected];
2841
+ return {
2842
+ seedSource: item.seed_source,
2843
+ 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,
2844
+ memorySources: [item]
2845
+ };
2846
+ }
2847
+ function shellArg(value) {
2848
+ return `'${value.replace(/'/g, "'\\''")}'`;
2849
+ }
2309
2850
  function normalizeTemplateKey(value) {
2310
2851
  return String(value || "").trim().toLowerCase().replace(/[_\s]+/g, "-");
2311
2852
  }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Signaliz
4
- } from "./chunk-EVFQETTN.mjs";
4
+ } from "./chunk-5JNKSMNW.mjs";
5
5
 
6
6
  // src/mcp-config.ts
7
7
  import * as fs from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signaliz/sdk",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "Signaliz SDK — GTM Kernel, Nango routes, MCP, and enrichment for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",