@signaliz/sdk 1.0.15 → 1.0.17

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 CHANGED
@@ -27,6 +27,47 @@ integration, and approval primitives exposed through MCP and CLI.
27
27
  npm install @signaliz/sdk
28
28
  ```
29
29
 
30
+ ## Quick Start - Ops
31
+
32
+ Use Ops when a script or agent needs to turn a plain-English GTM outcome into
33
+ durable work, wait for completion, and retrieve rows in one flow.
34
+
35
+ ```typescript
36
+ import { Signaliz } from '@signaliz/sdk';
37
+
38
+ const signaliz = new Signaliz({ apiKey: process.env.SIGNALIZ_API_KEY });
39
+
40
+ const result = await signaliz.ops.executeAndWait({
41
+ prompt: 'Build 50 approved ICP leads and return reviewed rows',
42
+ targetCount: 50,
43
+ confirmSpend: true,
44
+ limit: 50,
45
+ });
46
+
47
+ console.log(result.status.status);
48
+ console.log(result.results?.results);
49
+ ```
50
+
51
+ If the Op already exists, queue it and wait for results with `runAndWait()`:
52
+
53
+ ```typescript
54
+ const run = await signaliz.ops.runAndWait({
55
+ opId: 'op_123',
56
+ limit: 100,
57
+ });
58
+ ```
59
+
60
+ For manual polling or partial-output recovery, use `waitForResults()` directly:
61
+
62
+ ```typescript
63
+ const waited = await signaliz.ops.waitForResults({
64
+ opId: 'op_123',
65
+ maxPolls: 60,
66
+ intervalMs: 5000,
67
+ includeFailedRuns: true,
68
+ });
69
+ ```
70
+
30
71
  ## Quick Start — Campaign Builder
31
72
 
32
73
  Build a targeted lead list, wait for completion, then retrieve rows and CSV:
@@ -112,11 +153,19 @@ const kit = signaliz.campaignBuilderAgent.buildKit({
112
153
  includeLocalLeads: true,
113
154
  includeCustomToolPlaceholder: true,
114
155
  });
156
+ const memoryKit = signaliz.campaignBuilderAgent.memoryKit({
157
+ goal: 'Build a strategy-template campaign for mature local operators',
158
+ strategyTemplate: 'non-medical-home-care',
159
+ targetCount: 250,
160
+ includeLocalLeads: true,
161
+ source: 'agency',
162
+ });
115
163
 
116
164
  console.log(plan.strategyMemoryStatus?.ready);
117
165
  console.log(readiness.summary.ready);
118
166
  console.log(proof.success);
119
167
  console.log(kit.mcp_calls.find((call) => call.tool === 'gtm_campaign_agent_proof'));
168
+ console.log(memoryKit.mcp_calls.find((call) => call.tool === 'gtm_campaign_strategy_memory_status'));
120
169
  console.log(plan.mcpFlow.filter((step) =>
121
170
  ['gtm_provider_recipe_prepare', 'gtm_provider_route_activate'].includes(step.tool)
122
171
  ));
@@ -152,6 +201,13 @@ npx @signaliz/sdk campaign-agent kit \
152
201
  --with-byo-placeholder \
153
202
  --json
154
203
 
204
+ npx @signaliz/sdk campaign-agent memory-kit \
205
+ --strategy-template non-medical-home-care \
206
+ --target-count 250 \
207
+ --use-local-leads \
208
+ --source agency \
209
+ --json
210
+
155
211
  npx @signaliz/sdk campaign-agent plan \
156
212
  --request-file campaign-request.json \
157
213
  --target-count 250 \
@@ -363,6 +419,54 @@ if (preview.ready_for_confirmation) {
363
419
  }
364
420
  ```
365
421
 
422
+ The Ops namespace exposes the same Nango bridge, plus a one-call helper backed
423
+ by `nango_mcp_tool_call_and_wait` when an agent needs the result packet
424
+ immediately:
425
+
426
+ ```typescript
427
+ const nangoResult = await signaliz.ops.callNangoToolAndWait({
428
+ workspaceConnectionId: 'workspace_conn_nango_hubspot',
429
+ actionName: 'upsert-contact',
430
+ input: { email: 'buyer@example.com', company: 'Acme' },
431
+ dryRun: false,
432
+ confirm: true,
433
+ maxPolls: 6,
434
+ });
435
+ console.log(nangoResult.result);
436
+ ```
437
+
438
+ For recurring Ops, use the schedule-and-wait helper to activate the Op and
439
+ retrieve the first result packet in one call. This maps to native MCP
440
+ `ops_schedule_and_wait`:
441
+
442
+ ```typescript
443
+ const recurring = await signaliz.ops.scheduleAndWait({
444
+ prompt: 'Monitor strategic accounts daily and send new funding signals to Slack',
445
+ destinations: [{ type: 'slack' }],
446
+ wakeOnEvents: ['company_funded'],
447
+ confirmSpend: true,
448
+ limit: 100,
449
+ });
450
+ console.log(recurring.results?.results);
451
+ ```
452
+
453
+ For Nango-backed recurrence, the Ops SDK sends the natural Nango fields through
454
+ native `ops_nango_schedule` / `ops_nango_schedule_and_wait`:
455
+
456
+ ```typescript
457
+ const hubspotOp = await signaliz.ops.scheduleNangoActionAndWait({
458
+ prompt: 'Monitor strategic accounts daily and upsert approved rows to HubSpot',
459
+ workspaceConnectionId: 'workspace_conn_nango_hubspot',
460
+ providerConfigKey: 'hubspot',
461
+ actionName: 'upsert-contact',
462
+ writeConfirmed: true,
463
+ confirmSpend: true,
464
+ maxPolls: 6,
465
+ limit: 100,
466
+ });
467
+ console.log(hubspotOp.results?.results);
468
+ ```
469
+
366
470
  ### GTM Kernel Smoke Test
367
471
 
368
472
  After strategy imports or Campaign Builder backfills, run the read-only/dry-run
@@ -392,15 +496,34 @@ const health = await signaliz.getPlatformHealth();
392
496
  const tools = await signaliz.listTools();
393
497
  const opsMatches = await signaliz.discover('campaign build with webhook delivery', 'ops');
394
498
 
395
- // Prompt-first Ops loop
499
+ // North-star Ops loop: recommend, dry-run, schedule/run, poll, retrieve
500
+ const autopilot = await signaliz.ops.autopilot();
501
+ console.log(autopilot.primaryMotion?.operatingPacket?.northStar);
502
+ console.log(autopilot.primaryMotion?.operatingPacket?.nangoRoute?.dryRunArguments);
503
+
396
504
  const plan = await signaliz.ops.plan(
397
505
  'Monitor stripe.com and plaid.com every day and Slack me new hiring signals',
398
506
  );
399
- const op = await signaliz.ops.create({
507
+ console.log(plan.executionContract?.sequence.map((step) => step.tool).join(' -> '));
508
+ console.log(plan.executionContract?.nangoRoute?.writeGate);
509
+ const nangoPreview = await signaliz.ops.execute({
510
+ prompt: 'Build 50 approved ICP leads and upsert them to HubSpot',
511
+ destinations: [{
512
+ type: 'nango',
513
+ connectionId: 'workspace_conn_nango_hubspot',
514
+ providerConfigKey: 'hubspot',
515
+ nangoConnectionId: 'connection_123',
516
+ actionName: 'upsert-contact',
517
+ }],
518
+ dry_run: true,
519
+ });
520
+ const op = await signaliz.ops.schedule({
400
521
  prompt: plan.goal,
401
522
  blueprint: plan.blueprint,
402
523
  target_count: plan.target_count,
403
- cadence: plan.cadence,
524
+ cadence: plan.cadence === 'manual' ? 'daily' : plan.cadence,
525
+ timezone: 'America/Phoenix',
526
+ wakeOnEvents: ['company_funded', 'crm.updated'],
404
527
  confirm_spend: true,
405
528
  });
406
529
  await signaliz.ops.run(op.op_id);
@@ -427,24 +550,19 @@ const leadStatus = await signaliz.leads.checkStatus(leadJob.jobId);
427
550
 
428
551
  ## Custom AI Enrichment - Multi Model
429
552
 
430
- Use OpenRouter model IDs directly and attach images, PDFs, audio, or video when the selected model supports them. OpenRouter Fusion handles web search/fetch inside the deliberation step, so there is no separate search toggle.
553
+ Use the Signaliz-hosted default model and attach images, PDFs, audio, or video when needed. The response includes model readback metadata for auditing.
431
554
 
432
555
  ```typescript
433
556
  const result = await signaliz.ai.multiModel({
434
- model: 'google/gemini-2.5-flash',
435
557
  prompt: 'Research {{company_name}} and score whether they match our ICP.',
436
558
  records: [{ company_name: 'Stripe', company_domain: 'stripe.com' }],
437
559
  outputFields: [
438
560
  { name: 'fit_score', type: 'number', description: 'ICP fit from 1-10' },
439
561
  { name: 'reasoning', type: 'text', description: 'Short evidence-backed rationale' },
440
562
  ],
441
- fusion: {
442
- analysis_models: ['~google/gemini-flash-latest', '~openai/gpt-latest'],
443
- judge_model: '~anthropic/claude-opus-latest',
444
- },
445
563
  });
446
564
 
447
- console.log(result.results);
565
+ console.log(result.model, result.results);
448
566
  ```
449
567
 
450
568
  ## Campaigns API