@signaliz/sdk 1.0.23 → 1.0.25

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,19 +27,34 @@ const found = await signaliz.findEmail({
27
27
  skipCache: true,
28
28
  });
29
29
 
30
- const verified = await signaliz.verifyEmail(found.email!);
30
+ const verified = await signaliz.verifyEmail(found.email!, {
31
+ // Optional: bypass cached verification proof for a fresh-provider check.
32
+ skipCache: true,
33
+ });
31
34
 
32
35
  const signals = await signaliz.enrichCompanySignals({
33
36
  companyDomain: 'example.com',
34
37
  researchPrompt: 'expansion priorities',
35
38
  });
36
39
 
40
+ // Persist a no-wait run ID and resume it later without duplicate spend.
41
+ const queuedSignals = await signaliz.enrichCompanySignals({
42
+ companyDomain: 'example.com',
43
+ waitForResult: false,
44
+ });
45
+ const resumedSignals = await signaliz.enrichCompanySignals({
46
+ signalRunId: queuedSignals.signalRunId,
47
+ });
48
+
37
49
  const copy = await signaliz.signalToCopy({
38
50
  companyDomain: 'example.com',
39
51
  personName: 'Jane Doe',
40
52
  title: 'VP Sales',
41
53
  campaignOffer: 'pipeline intelligence',
42
54
  researchPrompt: 'expansion priorities',
55
+ // Cache-first and shallow by default; opt into either behavior explicitly.
56
+ skipCache: false,
57
+ enableDeepSearch: false,
43
58
  });
44
59
  ```
45
60
 
@@ -56,11 +71,16 @@ const copyBatch = await signaliz.createSignalCopyBatch(copyRequests, { concurren
56
71
 
57
72
  Each batch accepts up to 5,000 items. Company Signal Enrichment transparently
58
73
  resumes long-running research through the same `/company-signals` endpoint;
59
- callers never need an internal Trigger.dev status URL.
74
+ callers never need an internal Trigger.dev status URL. The SDK follows the
75
+ server's adaptive polling hints by default and still honors `pollIntervalMs`
76
+ when a caller explicitly overrides the cadence.
60
77
 
61
78
  Company Signal Enrichment defaults `online` and `enableDeepSearch` to `true`
62
79
  unless the caller explicitly disables them. Signal to Copy AI returns three
63
80
  complete, evidence-backed email variations when supported signals are available.
81
+ Signal to Copy is cache-first and defaults `enableDeepSearch` to `false` so it
82
+ normally finishes within an agent turn; set `skipCache` or `enableDeepSearch`
83
+ only when fresh or deeper research is required.
64
84
  Unclassified evidence is returned by signal enrichment but is not used to
65
85
  generate outreach copy.
66
86
 
@@ -381,8 +381,11 @@ var Signaliz = class {
381
381
  async findEmails(params, options) {
382
382
  return runBatch(params, (item) => this.findEmail(item), options);
383
383
  }
384
- async verifyEmail(email) {
385
- const data = await this.client.post("api/v1/verify-email", { email });
384
+ async verifyEmail(email, options) {
385
+ const data = await this.client.post("api/v1/verify-email", {
386
+ email,
387
+ skip_cache: options?.skipCache
388
+ });
386
389
  const verificationStatus = String(data.verification_status ?? "").toLowerCase();
387
390
  const verified = data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus);
388
391
  return {
@@ -397,11 +400,12 @@ var Signaliz = class {
397
400
  };
398
401
  }
399
402
  async verifyEmails(emails, options) {
400
- return runBatch(emails, (email) => this.verifyEmail(email), options);
403
+ return runBatch(emails, (email) => this.verifyEmail(email, { skipCache: options?.skipCache }), options);
401
404
  }
402
405
  async enrichCompanySignals(params) {
403
406
  const online = params.online ?? true;
404
407
  const request = compact({
408
+ signal_run_id: params.signalRunId,
405
409
  company_domain: params.companyDomain,
406
410
  company_name: params.companyName,
407
411
  research_prompt: params.researchPrompt,
@@ -413,15 +417,17 @@ var Signaliz = class {
413
417
  enable_outreach_intelligence: params.enableOutreachIntelligence,
414
418
  enable_predictive_intelligence: params.enablePredictiveIntelligence,
415
419
  skip_cache: params.skipCache,
416
- wait_for_result: params.waitForResult !== false,
420
+ // REST always returns a resumable run instead of holding the connection;
421
+ // waitForResult controls this SDK's polling loop below.
422
+ wait_for_result: false,
417
423
  max_wait_ms: params.maxWaitMs
418
424
  });
419
425
  let data = await this.client.post("api/v1/company-signals", request);
420
426
  if (params.waitForResult !== false && data.run_id && isPendingSignalResponse(data)) {
421
427
  const maxWaitMs = Math.max(1e3, params.maxWaitMs ?? 20 * 6e4);
422
- const pollIntervalMs = Math.max(250, params.pollIntervalMs ?? 2e3);
423
428
  const startedAt = Date.now();
424
429
  while (Date.now() - startedAt < maxWaitMs) {
430
+ if (!await waitForNextSignalPoll(data, params.pollIntervalMs, startedAt, maxWaitMs)) break;
425
431
  const status = await this.client.post("api/v1/company-signals", {
426
432
  ...request,
427
433
  signal_run_id: data.run_id
@@ -437,7 +443,7 @@ var Signaliz = class {
437
443
  data = status.output ?? status.result ?? status.data ?? status;
438
444
  break;
439
445
  }
440
- await sleep2(pollIntervalMs);
446
+ data = status;
441
447
  }
442
448
  if (isPendingSignalResponse(data)) {
443
449
  throw new Error(`Company signal enrichment ${data.run_id} did not complete within ${maxWaitMs}ms`);
@@ -445,6 +451,8 @@ var Signaliz = class {
445
451
  }
446
452
  return {
447
453
  success: data.success ?? true,
454
+ status: data.status,
455
+ signalRunId: data.signal_run_id ?? data.run_id,
448
456
  company: {
449
457
  name: data.company?.name ?? params.companyName ?? null,
450
458
  domain: data.company?.domain ?? params.companyDomain ?? null
@@ -476,15 +484,16 @@ var Signaliz = class {
476
484
  title: params.title,
477
485
  campaign_offer: params.campaignOffer,
478
486
  research_prompt: params.researchPrompt,
479
- signal_run_id: params.signalRunId
487
+ signal_run_id: params.signalRunId,
488
+ skip_cache: params.skipCache,
489
+ enable_deep_search: params.enableDeepSearch
480
490
  });
481
491
  let data = await this.client.post("api/v1/signal-to-copy", request);
482
492
  if (params.waitForResult !== false && data.run_id && isPendingSignalResponse(data)) {
483
493
  const maxWaitMs = Math.max(1e3, params.maxWaitMs ?? 20 * 6e4);
484
- const pollIntervalMs = Math.max(250, params.pollIntervalMs ?? 2e3);
485
494
  const startedAt = Date.now();
486
495
  while (Date.now() - startedAt < maxWaitMs) {
487
- await sleep2(pollIntervalMs);
496
+ if (!await waitForNextSignalPoll(data, params.pollIntervalMs, startedAt, maxWaitMs)) break;
488
497
  data = await this.client.post("api/v1/signal-to-copy", {
489
498
  ...request,
490
499
  signal_run_id: data.run_id
@@ -544,6 +553,19 @@ function isCompletedSignalRun(data) {
544
553
  function isFailedSignalRun(data) {
545
554
  return ["failed", "error", "cancelled", "canceled", "crashed", "timed_out"].includes(String(data.status || "").toLowerCase());
546
555
  }
556
+ function signalPollDelayMs(data, override) {
557
+ if (override !== void 0) return Math.max(250, override);
558
+ const retryAfterMs = Number(data.retry_after_ms);
559
+ const nextPollSeconds = Number(data.next_poll_after_seconds);
560
+ const hinted = Number.isFinite(retryAfterMs) && retryAfterMs > 0 ? retryAfterMs : Number.isFinite(nextPollSeconds) && nextPollSeconds > 0 ? nextPollSeconds * 1e3 : 2e3;
561
+ return Math.min(6e4, Math.max(250, hinted));
562
+ }
563
+ async function waitForNextSignalPoll(data, override, startedAt, maxWaitMs) {
564
+ const remainingMs = maxWaitMs - (Date.now() - startedAt);
565
+ if (remainingMs <= 0) return false;
566
+ await sleep2(Math.min(signalPollDelayMs(data, override), remainingMs));
567
+ return Date.now() - startedAt < maxWaitMs;
568
+ }
547
569
  function sleep2(ms) {
548
570
  return new Promise((resolve) => setTimeout(resolve, ms));
549
571
  }
package/dist/index.d.mts CHANGED
@@ -64,7 +64,15 @@ interface VerifyEmailResult {
64
64
  verificationSource?: string;
65
65
  raw: Record<string, unknown>;
66
66
  }
67
+ interface VerifyEmailOptions {
68
+ /** Bypass cached verification data for a fresh-provider quality check. */
69
+ skipCache?: boolean;
70
+ }
71
+ interface VerifyEmailBatchOptions extends BatchOptions, VerifyEmailOptions {
72
+ }
67
73
  interface CompanySignalEnrichmentParams {
74
+ /** Resume an existing enrichment without creating another provider run. */
75
+ signalRunId?: string;
68
76
  companyDomain?: string;
69
77
  companyName?: string;
70
78
  researchPrompt?: string;
@@ -95,6 +103,8 @@ interface CompanySignal {
95
103
  }
96
104
  interface CompanySignalEnrichmentResult {
97
105
  success: boolean;
106
+ status?: string;
107
+ signalRunId?: string;
98
108
  company: {
99
109
  name: string | null;
100
110
  domain: string | null;
@@ -113,6 +123,10 @@ interface SignalToCopyParams {
113
123
  campaignOffer: string;
114
124
  researchPrompt?: string;
115
125
  signalRunId?: string;
126
+ /** Bypass cached company signals and start fresh research. */
127
+ skipCache?: boolean;
128
+ /** Opt into slower deep research. Defaults to false. */
129
+ enableDeepSearch?: boolean;
116
130
  waitForResult?: boolean;
117
131
  maxWaitMs?: number;
118
132
  pollIntervalMs?: number;
@@ -165,8 +179,8 @@ declare class Signaliz {
165
179
  constructor(config: SignalizConfig);
166
180
  findEmail(params: FindEmailParams): Promise<FindEmailResult>;
167
181
  findEmails(params: FindEmailParams[], options?: BatchOptions): Promise<BatchResult<FindEmailResult>>;
168
- verifyEmail(email: string): Promise<VerifyEmailResult>;
169
- verifyEmails(emails: string[], options?: BatchOptions): Promise<BatchResult<VerifyEmailResult>>;
182
+ verifyEmail(email: string, options?: VerifyEmailOptions): Promise<VerifyEmailResult>;
183
+ verifyEmails(emails: string[], options?: VerifyEmailBatchOptions): Promise<BatchResult<VerifyEmailResult>>;
170
184
  enrichCompanySignals(params: CompanySignalEnrichmentParams): Promise<CompanySignalEnrichmentResult>;
171
185
  enrichCompanies(companies: CompanySignalEnrichmentParams[], options?: BatchOptions): Promise<BatchResult<CompanySignalEnrichmentResult>>;
172
186
  signalToCopy(params: SignalToCopyParams): Promise<SignalToCopyResult>;
@@ -175,4 +189,4 @@ declare class Signaliz {
175
189
  health(): Promise<PlatformHealth>;
176
190
  }
177
191
 
178
- export { type BatchItemResult, type BatchOptions, type BatchResult, type CompanySignal, type CompanySignalEnrichmentParams, type CompanySignalEnrichmentResult, type ErrorType, type FindEmailParams, type FindEmailResult, type MCPToolInfo, type PlatformHealth, type SignalToCopyParams, type SignalToCopyResult, type SignalToCopyVariation, Signaliz, type SignalizConfig, SignalizError, type SignalizErrorData, type VerifyEmailResult };
192
+ export { type BatchItemResult, type BatchOptions, type BatchResult, type CompanySignal, type CompanySignalEnrichmentParams, type CompanySignalEnrichmentResult, type ErrorType, type FindEmailParams, type FindEmailResult, type MCPToolInfo, type PlatformHealth, type SignalToCopyParams, type SignalToCopyResult, type SignalToCopyVariation, Signaliz, type SignalizConfig, SignalizError, type SignalizErrorData, type VerifyEmailBatchOptions, type VerifyEmailOptions, type VerifyEmailResult };
package/dist/index.d.ts CHANGED
@@ -64,7 +64,15 @@ interface VerifyEmailResult {
64
64
  verificationSource?: string;
65
65
  raw: Record<string, unknown>;
66
66
  }
67
+ interface VerifyEmailOptions {
68
+ /** Bypass cached verification data for a fresh-provider quality check. */
69
+ skipCache?: boolean;
70
+ }
71
+ interface VerifyEmailBatchOptions extends BatchOptions, VerifyEmailOptions {
72
+ }
67
73
  interface CompanySignalEnrichmentParams {
74
+ /** Resume an existing enrichment without creating another provider run. */
75
+ signalRunId?: string;
68
76
  companyDomain?: string;
69
77
  companyName?: string;
70
78
  researchPrompt?: string;
@@ -95,6 +103,8 @@ interface CompanySignal {
95
103
  }
96
104
  interface CompanySignalEnrichmentResult {
97
105
  success: boolean;
106
+ status?: string;
107
+ signalRunId?: string;
98
108
  company: {
99
109
  name: string | null;
100
110
  domain: string | null;
@@ -113,6 +123,10 @@ interface SignalToCopyParams {
113
123
  campaignOffer: string;
114
124
  researchPrompt?: string;
115
125
  signalRunId?: string;
126
+ /** Bypass cached company signals and start fresh research. */
127
+ skipCache?: boolean;
128
+ /** Opt into slower deep research. Defaults to false. */
129
+ enableDeepSearch?: boolean;
116
130
  waitForResult?: boolean;
117
131
  maxWaitMs?: number;
118
132
  pollIntervalMs?: number;
@@ -165,8 +179,8 @@ declare class Signaliz {
165
179
  constructor(config: SignalizConfig);
166
180
  findEmail(params: FindEmailParams): Promise<FindEmailResult>;
167
181
  findEmails(params: FindEmailParams[], options?: BatchOptions): Promise<BatchResult<FindEmailResult>>;
168
- verifyEmail(email: string): Promise<VerifyEmailResult>;
169
- verifyEmails(emails: string[], options?: BatchOptions): Promise<BatchResult<VerifyEmailResult>>;
182
+ verifyEmail(email: string, options?: VerifyEmailOptions): Promise<VerifyEmailResult>;
183
+ verifyEmails(emails: string[], options?: VerifyEmailBatchOptions): Promise<BatchResult<VerifyEmailResult>>;
170
184
  enrichCompanySignals(params: CompanySignalEnrichmentParams): Promise<CompanySignalEnrichmentResult>;
171
185
  enrichCompanies(companies: CompanySignalEnrichmentParams[], options?: BatchOptions): Promise<BatchResult<CompanySignalEnrichmentResult>>;
172
186
  signalToCopy(params: SignalToCopyParams): Promise<SignalToCopyResult>;
@@ -175,4 +189,4 @@ declare class Signaliz {
175
189
  health(): Promise<PlatformHealth>;
176
190
  }
177
191
 
178
- export { type BatchItemResult, type BatchOptions, type BatchResult, type CompanySignal, type CompanySignalEnrichmentParams, type CompanySignalEnrichmentResult, type ErrorType, type FindEmailParams, type FindEmailResult, type MCPToolInfo, type PlatformHealth, type SignalToCopyParams, type SignalToCopyResult, type SignalToCopyVariation, Signaliz, type SignalizConfig, SignalizError, type SignalizErrorData, type VerifyEmailResult };
192
+ export { type BatchItemResult, type BatchOptions, type BatchResult, type CompanySignal, type CompanySignalEnrichmentParams, type CompanySignalEnrichmentResult, type ErrorType, type FindEmailParams, type FindEmailResult, type MCPToolInfo, type PlatformHealth, type SignalToCopyParams, type SignalToCopyResult, type SignalToCopyVariation, Signaliz, type SignalizConfig, SignalizError, type SignalizErrorData, type VerifyEmailBatchOptions, type VerifyEmailOptions, type VerifyEmailResult };
package/dist/index.js CHANGED
@@ -408,8 +408,11 @@ var Signaliz = class {
408
408
  async findEmails(params, options) {
409
409
  return runBatch(params, (item) => this.findEmail(item), options);
410
410
  }
411
- async verifyEmail(email) {
412
- const data = await this.client.post("api/v1/verify-email", { email });
411
+ async verifyEmail(email, options) {
412
+ const data = await this.client.post("api/v1/verify-email", {
413
+ email,
414
+ skip_cache: options?.skipCache
415
+ });
413
416
  const verificationStatus = String(data.verification_status ?? "").toLowerCase();
414
417
  const verified = data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus);
415
418
  return {
@@ -424,11 +427,12 @@ var Signaliz = class {
424
427
  };
425
428
  }
426
429
  async verifyEmails(emails, options) {
427
- return runBatch(emails, (email) => this.verifyEmail(email), options);
430
+ return runBatch(emails, (email) => this.verifyEmail(email, { skipCache: options?.skipCache }), options);
428
431
  }
429
432
  async enrichCompanySignals(params) {
430
433
  const online = params.online ?? true;
431
434
  const request = compact({
435
+ signal_run_id: params.signalRunId,
432
436
  company_domain: params.companyDomain,
433
437
  company_name: params.companyName,
434
438
  research_prompt: params.researchPrompt,
@@ -440,15 +444,17 @@ var Signaliz = class {
440
444
  enable_outreach_intelligence: params.enableOutreachIntelligence,
441
445
  enable_predictive_intelligence: params.enablePredictiveIntelligence,
442
446
  skip_cache: params.skipCache,
443
- wait_for_result: params.waitForResult !== false,
447
+ // REST always returns a resumable run instead of holding the connection;
448
+ // waitForResult controls this SDK's polling loop below.
449
+ wait_for_result: false,
444
450
  max_wait_ms: params.maxWaitMs
445
451
  });
446
452
  let data = await this.client.post("api/v1/company-signals", request);
447
453
  if (params.waitForResult !== false && data.run_id && isPendingSignalResponse(data)) {
448
454
  const maxWaitMs = Math.max(1e3, params.maxWaitMs ?? 20 * 6e4);
449
- const pollIntervalMs = Math.max(250, params.pollIntervalMs ?? 2e3);
450
455
  const startedAt = Date.now();
451
456
  while (Date.now() - startedAt < maxWaitMs) {
457
+ if (!await waitForNextSignalPoll(data, params.pollIntervalMs, startedAt, maxWaitMs)) break;
452
458
  const status = await this.client.post("api/v1/company-signals", {
453
459
  ...request,
454
460
  signal_run_id: data.run_id
@@ -464,7 +470,7 @@ var Signaliz = class {
464
470
  data = status.output ?? status.result ?? status.data ?? status;
465
471
  break;
466
472
  }
467
- await sleep2(pollIntervalMs);
473
+ data = status;
468
474
  }
469
475
  if (isPendingSignalResponse(data)) {
470
476
  throw new Error(`Company signal enrichment ${data.run_id} did not complete within ${maxWaitMs}ms`);
@@ -472,6 +478,8 @@ var Signaliz = class {
472
478
  }
473
479
  return {
474
480
  success: data.success ?? true,
481
+ status: data.status,
482
+ signalRunId: data.signal_run_id ?? data.run_id,
475
483
  company: {
476
484
  name: data.company?.name ?? params.companyName ?? null,
477
485
  domain: data.company?.domain ?? params.companyDomain ?? null
@@ -503,15 +511,16 @@ var Signaliz = class {
503
511
  title: params.title,
504
512
  campaign_offer: params.campaignOffer,
505
513
  research_prompt: params.researchPrompt,
506
- signal_run_id: params.signalRunId
514
+ signal_run_id: params.signalRunId,
515
+ skip_cache: params.skipCache,
516
+ enable_deep_search: params.enableDeepSearch
507
517
  });
508
518
  let data = await this.client.post("api/v1/signal-to-copy", request);
509
519
  if (params.waitForResult !== false && data.run_id && isPendingSignalResponse(data)) {
510
520
  const maxWaitMs = Math.max(1e3, params.maxWaitMs ?? 20 * 6e4);
511
- const pollIntervalMs = Math.max(250, params.pollIntervalMs ?? 2e3);
512
521
  const startedAt = Date.now();
513
522
  while (Date.now() - startedAt < maxWaitMs) {
514
- await sleep2(pollIntervalMs);
523
+ if (!await waitForNextSignalPoll(data, params.pollIntervalMs, startedAt, maxWaitMs)) break;
515
524
  data = await this.client.post("api/v1/signal-to-copy", {
516
525
  ...request,
517
526
  signal_run_id: data.run_id
@@ -571,6 +580,19 @@ function isCompletedSignalRun(data) {
571
580
  function isFailedSignalRun(data) {
572
581
  return ["failed", "error", "cancelled", "canceled", "crashed", "timed_out"].includes(String(data.status || "").toLowerCase());
573
582
  }
583
+ function signalPollDelayMs(data, override) {
584
+ if (override !== void 0) return Math.max(250, override);
585
+ const retryAfterMs = Number(data.retry_after_ms);
586
+ const nextPollSeconds = Number(data.next_poll_after_seconds);
587
+ const hinted = Number.isFinite(retryAfterMs) && retryAfterMs > 0 ? retryAfterMs : Number.isFinite(nextPollSeconds) && nextPollSeconds > 0 ? nextPollSeconds * 1e3 : 2e3;
588
+ return Math.min(6e4, Math.max(250, hinted));
589
+ }
590
+ async function waitForNextSignalPoll(data, override, startedAt, maxWaitMs) {
591
+ const remainingMs = maxWaitMs - (Date.now() - startedAt);
592
+ if (remainingMs <= 0) return false;
593
+ await sleep2(Math.min(signalPollDelayMs(data, override), remainingMs));
594
+ return Date.now() - startedAt < maxWaitMs;
595
+ }
574
596
  function sleep2(ms) {
575
597
  return new Promise((resolve) => setTimeout(resolve, ms));
576
598
  }
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Signaliz,
3
3
  SignalizError
4
- } from "./chunk-EQ3WI2UU.mjs";
4
+ } from "./chunk-EHNGI3N2.mjs";
5
5
  export {
6
6
  Signaliz,
7
7
  SignalizError
@@ -412,8 +412,11 @@ var Signaliz = class {
412
412
  async findEmails(params, options) {
413
413
  return runBatch(params, (item) => this.findEmail(item), options);
414
414
  }
415
- async verifyEmail(email) {
416
- const data = await this.client.post("api/v1/verify-email", { email });
415
+ async verifyEmail(email, options) {
416
+ const data = await this.client.post("api/v1/verify-email", {
417
+ email,
418
+ skip_cache: options?.skipCache
419
+ });
417
420
  const verificationStatus = String(data.verification_status ?? "").toLowerCase();
418
421
  const verified = data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus);
419
422
  return {
@@ -428,11 +431,12 @@ var Signaliz = class {
428
431
  };
429
432
  }
430
433
  async verifyEmails(emails, options) {
431
- return runBatch(emails, (email) => this.verifyEmail(email), options);
434
+ return runBatch(emails, (email) => this.verifyEmail(email, { skipCache: options?.skipCache }), options);
432
435
  }
433
436
  async enrichCompanySignals(params) {
434
437
  const online = params.online ?? true;
435
438
  const request = compact({
439
+ signal_run_id: params.signalRunId,
436
440
  company_domain: params.companyDomain,
437
441
  company_name: params.companyName,
438
442
  research_prompt: params.researchPrompt,
@@ -444,15 +448,17 @@ var Signaliz = class {
444
448
  enable_outreach_intelligence: params.enableOutreachIntelligence,
445
449
  enable_predictive_intelligence: params.enablePredictiveIntelligence,
446
450
  skip_cache: params.skipCache,
447
- wait_for_result: params.waitForResult !== false,
451
+ // REST always returns a resumable run instead of holding the connection;
452
+ // waitForResult controls this SDK's polling loop below.
453
+ wait_for_result: false,
448
454
  max_wait_ms: params.maxWaitMs
449
455
  });
450
456
  let data = await this.client.post("api/v1/company-signals", request);
451
457
  if (params.waitForResult !== false && data.run_id && isPendingSignalResponse(data)) {
452
458
  const maxWaitMs = Math.max(1e3, params.maxWaitMs ?? 20 * 6e4);
453
- const pollIntervalMs = Math.max(250, params.pollIntervalMs ?? 2e3);
454
459
  const startedAt = Date.now();
455
460
  while (Date.now() - startedAt < maxWaitMs) {
461
+ if (!await waitForNextSignalPoll(data, params.pollIntervalMs, startedAt, maxWaitMs)) break;
456
462
  const status = await this.client.post("api/v1/company-signals", {
457
463
  ...request,
458
464
  signal_run_id: data.run_id
@@ -468,7 +474,7 @@ var Signaliz = class {
468
474
  data = status.output ?? status.result ?? status.data ?? status;
469
475
  break;
470
476
  }
471
- await sleep2(pollIntervalMs);
477
+ data = status;
472
478
  }
473
479
  if (isPendingSignalResponse(data)) {
474
480
  throw new Error(`Company signal enrichment ${data.run_id} did not complete within ${maxWaitMs}ms`);
@@ -476,6 +482,8 @@ var Signaliz = class {
476
482
  }
477
483
  return {
478
484
  success: data.success ?? true,
485
+ status: data.status,
486
+ signalRunId: data.signal_run_id ?? data.run_id,
479
487
  company: {
480
488
  name: data.company?.name ?? params.companyName ?? null,
481
489
  domain: data.company?.domain ?? params.companyDomain ?? null
@@ -507,15 +515,16 @@ var Signaliz = class {
507
515
  title: params.title,
508
516
  campaign_offer: params.campaignOffer,
509
517
  research_prompt: params.researchPrompt,
510
- signal_run_id: params.signalRunId
518
+ signal_run_id: params.signalRunId,
519
+ skip_cache: params.skipCache,
520
+ enable_deep_search: params.enableDeepSearch
511
521
  });
512
522
  let data = await this.client.post("api/v1/signal-to-copy", request);
513
523
  if (params.waitForResult !== false && data.run_id && isPendingSignalResponse(data)) {
514
524
  const maxWaitMs = Math.max(1e3, params.maxWaitMs ?? 20 * 6e4);
515
- const pollIntervalMs = Math.max(250, params.pollIntervalMs ?? 2e3);
516
525
  const startedAt = Date.now();
517
526
  while (Date.now() - startedAt < maxWaitMs) {
518
- await sleep2(pollIntervalMs);
527
+ if (!await waitForNextSignalPoll(data, params.pollIntervalMs, startedAt, maxWaitMs)) break;
519
528
  data = await this.client.post("api/v1/signal-to-copy", {
520
529
  ...request,
521
530
  signal_run_id: data.run_id
@@ -575,6 +584,19 @@ function isCompletedSignalRun(data) {
575
584
  function isFailedSignalRun(data) {
576
585
  return ["failed", "error", "cancelled", "canceled", "crashed", "timed_out"].includes(String(data.status || "").toLowerCase());
577
586
  }
587
+ function signalPollDelayMs(data, override) {
588
+ if (override !== void 0) return Math.max(250, override);
589
+ const retryAfterMs = Number(data.retry_after_ms);
590
+ const nextPollSeconds = Number(data.next_poll_after_seconds);
591
+ const hinted = Number.isFinite(retryAfterMs) && retryAfterMs > 0 ? retryAfterMs : Number.isFinite(nextPollSeconds) && nextPollSeconds > 0 ? nextPollSeconds * 1e3 : 2e3;
592
+ return Math.min(6e4, Math.max(250, hinted));
593
+ }
594
+ async function waitForNextSignalPoll(data, override, startedAt, maxWaitMs) {
595
+ const remainingMs = maxWaitMs - (Date.now() - startedAt);
596
+ if (remainingMs <= 0) return false;
597
+ await sleep2(Math.min(signalPollDelayMs(data, override), remainingMs));
598
+ return Date.now() - startedAt < maxWaitMs;
599
+ }
578
600
  function sleep2(ms) {
579
601
  return new Promise((resolve) => setTimeout(resolve, ms));
580
602
  }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Signaliz
4
- } from "./chunk-EQ3WI2UU.mjs";
4
+ } from "./chunk-EHNGI3N2.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.23",
3
+ "version": "1.0.25",
4
4
  "description": "Signaliz SDK for Find Email, Verify Email, Company Signal Enrichment, and Signal to Copy AI.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",