@signaliz/sdk 1.0.16 → 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:
@@ -378,6 +419,54 @@ if (preview.ready_for_confirmation) {
378
419
  }
379
420
  ```
380
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
+
381
470
  ### GTM Kernel Smoke Test
382
471
 
383
472
  After strategy imports or Campaign Builder backfills, run the read-only/dry-run
@@ -407,15 +496,34 @@ const health = await signaliz.getPlatformHealth();
407
496
  const tools = await signaliz.listTools();
408
497
  const opsMatches = await signaliz.discover('campaign build with webhook delivery', 'ops');
409
498
 
410
- // 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
+
411
504
  const plan = await signaliz.ops.plan(
412
505
  'Monitor stripe.com and plaid.com every day and Slack me new hiring signals',
413
506
  );
414
- 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({
415
521
  prompt: plan.goal,
416
522
  blueprint: plan.blueprint,
417
523
  target_count: plan.target_count,
418
- cadence: plan.cadence,
524
+ cadence: plan.cadence === 'manual' ? 'daily' : plan.cadence,
525
+ timezone: 'America/Phoenix',
526
+ wakeOnEvents: ['company_funded', 'crm.updated'],
419
527
  confirm_spend: true,
420
528
  });
421
529
  await signaliz.ops.run(op.op_id);
@@ -442,24 +550,19 @@ const leadStatus = await signaliz.leads.checkStatus(leadJob.jobId);
442
550
 
443
551
  ## Custom AI Enrichment - Multi Model
444
552
 
445
- 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.
446
554
 
447
555
  ```typescript
448
556
  const result = await signaliz.ai.multiModel({
449
- model: 'google/gemini-2.5-flash',
450
557
  prompt: 'Research {{company_name}} and score whether they match our ICP.',
451
558
  records: [{ company_name: 'Stripe', company_domain: 'stripe.com' }],
452
559
  outputFields: [
453
560
  { name: 'fit_score', type: 'number', description: 'ICP fit from 1-10' },
454
561
  { name: 'reasoning', type: 'text', description: 'Short evidence-backed rationale' },
455
562
  ],
456
- fusion: {
457
- analysis_models: ['~google/gemini-flash-latest', '~openai/gpt-latest'],
458
- judge_model: '~anthropic/claude-opus-latest',
459
- },
460
563
  });
461
564
 
462
- console.log(result.results);
565
+ console.log(result.model, result.results);
463
566
  ```
464
567
 
465
568
  ## Campaigns API