@signaliz/sdk 1.0.46 → 1.0.48
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 +24 -33
- package/dist/{chunk-4LXMT3S5.mjs → chunk-NOOQDYOJ.mjs} +129 -228
- package/dist/index.d.mts +67 -4
- package/dist/index.d.ts +67 -4
- package/dist/index.js +129 -228
- package/dist/index.mjs +1 -1
- package/dist/mcp-config.js +129 -228
- package/dist/mcp-config.mjs +1 -1
- package/package.json +1 -1
package/dist/mcp-config.js
CHANGED
|
@@ -409,10 +409,17 @@ var Signaliz = class {
|
|
|
409
409
|
}
|
|
410
410
|
async findEmail(params) {
|
|
411
411
|
const data = await this.client.post("api/v1/find-email", findEmailRequestBody(params));
|
|
412
|
-
return normalizeFindEmailResult(data);
|
|
412
|
+
return isCoreProductDryRun(data) ? normalizeCoreProductDryRunResult(data) : normalizeFindEmailResult(data);
|
|
413
413
|
}
|
|
414
414
|
async findEmails(params, options) {
|
|
415
415
|
validateBatchSize(params);
|
|
416
|
+
if (options?.dryRun === true) {
|
|
417
|
+
return this.runCoreProductDryRun(
|
|
418
|
+
"api/v1/find-email",
|
|
419
|
+
params.map(findEmailRequestBody),
|
|
420
|
+
options.idempotencyKey
|
|
421
|
+
);
|
|
422
|
+
}
|
|
416
423
|
const startedAt = Date.now();
|
|
417
424
|
const round = await this.runCoreBatchRound(
|
|
418
425
|
"api/v1/find-email",
|
|
@@ -431,9 +438,12 @@ var Signaliz = class {
|
|
|
431
438
|
const request = compact({
|
|
432
439
|
email: email || void 0,
|
|
433
440
|
verification_run_id: options?.verificationRunId,
|
|
434
|
-
skip_cache: options?.skipCache
|
|
441
|
+
skip_cache: options?.skipCache,
|
|
442
|
+
dry_run: options?.dryRun,
|
|
443
|
+
idempotency_key: options?.idempotencyKey
|
|
435
444
|
});
|
|
436
445
|
let data = await this.client.post("api/v1/verify-email", request);
|
|
446
|
+
if (isCoreProductDryRun(data)) return normalizeCoreProductDryRunResult(data);
|
|
437
447
|
if (options?.waitForResult !== false && isPendingSignalResponse(data) && data.verification_run_id) {
|
|
438
448
|
const maxWaitMs = Math.max(1e3, options?.maxWaitMs ?? 10 * 6e4);
|
|
439
449
|
const startedAt = Date.now();
|
|
@@ -453,6 +463,13 @@ var Signaliz = class {
|
|
|
453
463
|
}
|
|
454
464
|
async verifyEmails(emails, options) {
|
|
455
465
|
validateBatchSize(emails);
|
|
466
|
+
if (options?.dryRun === true) {
|
|
467
|
+
return this.runCoreProductDryRun(
|
|
468
|
+
"api/v1/verify-email",
|
|
469
|
+
emails.map((email) => ({ email, skip_cache: options.skipCache })),
|
|
470
|
+
options.idempotencyKey
|
|
471
|
+
);
|
|
472
|
+
}
|
|
456
473
|
const startedAt = Date.now();
|
|
457
474
|
const round = await this.runCoreBatchRound(
|
|
458
475
|
"api/v1/verify-email",
|
|
@@ -472,100 +489,37 @@ var Signaliz = class {
|
|
|
472
489
|
}
|
|
473
490
|
async enrichCompanySignals(params) {
|
|
474
491
|
const request = companySignalRequestBody(params);
|
|
475
|
-
|
|
476
|
-
if (
|
|
477
|
-
|
|
478
|
-
const startedAt = Date.now();
|
|
479
|
-
while (Date.now() - startedAt < maxWaitMs) {
|
|
480
|
-
if (!await waitForNextSignalPoll(data, params.pollIntervalMs, startedAt, maxWaitMs)) break;
|
|
481
|
-
const status = await this.client.post("api/v1/company-signals", {
|
|
482
|
-
...request,
|
|
483
|
-
signal_run_id: data.run_id
|
|
484
|
-
});
|
|
485
|
-
if (isCompletedSignalRun(status)) {
|
|
486
|
-
data = status.output ?? status.result ?? status.data ?? status;
|
|
487
|
-
break;
|
|
488
|
-
}
|
|
489
|
-
if (isFailedSignalRun(status)) {
|
|
490
|
-
throw new Error(`Company signal enrichment ${data.run_id} failed with status ${status.status || "unknown"}`);
|
|
491
|
-
}
|
|
492
|
-
if (!isPendingSignalResponse(status)) {
|
|
493
|
-
data = status.output ?? status.result ?? status.data ?? status;
|
|
494
|
-
break;
|
|
495
|
-
}
|
|
496
|
-
data = status;
|
|
497
|
-
}
|
|
498
|
-
if (isPendingSignalResponse(data)) {
|
|
499
|
-
throw new Error(`Company signal enrichment ${data.run_id} did not complete within ${maxWaitMs}ms`);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
492
|
+
const data = await this.client.post("api/v1/company-signals", request);
|
|
493
|
+
if (isCoreProductDryRun(data)) return normalizeCoreProductDryRunResult(data);
|
|
494
|
+
assertTerminalSignalResponse(data, "Company Signals");
|
|
502
495
|
return normalizeCompanySignalResult(params, data);
|
|
503
496
|
}
|
|
504
497
|
async enrichCompanies(companies, options) {
|
|
505
498
|
validateBatchSize(companies);
|
|
499
|
+
if (options?.dryRun === true) {
|
|
500
|
+
return this.runCoreProductDryRun(
|
|
501
|
+
"api/v1/company-signals",
|
|
502
|
+
companies.map(companySignalRequestBody),
|
|
503
|
+
options.idempotencyKey
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
506
|
const startedAt = Date.now();
|
|
507
|
-
const results = new Array(companies.length);
|
|
508
507
|
const initialTasks = companies.map((params, index) => ({
|
|
509
508
|
index,
|
|
510
509
|
request: companySignalRequestBody(params)
|
|
511
510
|
}));
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
const round = await this.runCoreBatchRound(
|
|
517
|
-
"api/v1/company-signals",
|
|
518
|
-
pending,
|
|
519
|
-
options,
|
|
520
|
-
firstRound ? recoverableBatch : void 0
|
|
521
|
-
);
|
|
522
|
-
firstRound = false;
|
|
523
|
-
const taskByIndex = new Map(pending.map((task) => [task.index, task]));
|
|
524
|
-
const nextPending = [];
|
|
525
|
-
let nextDelayMs = 6e4;
|
|
526
|
-
for (const item of round) {
|
|
527
|
-
const params = companies[item.index];
|
|
528
|
-
const task = taskByIndex.get(item.index);
|
|
529
|
-
if (!item.success || !item.raw) {
|
|
530
|
-
results[item.index] = batchItemFailure(
|
|
531
|
-
item.index,
|
|
532
|
-
item.error || "Company Signal batch request failed",
|
|
533
|
-
item.raw ?? item
|
|
534
|
-
);
|
|
535
|
-
continue;
|
|
536
|
-
}
|
|
537
|
-
if (!isPendingSignalResponse(item.raw) || params.waitForResult === false) {
|
|
538
|
-
results[item.index] = { index: item.index, success: true, data: normalizeCompanySignalResult(params, item.raw) };
|
|
539
|
-
continue;
|
|
540
|
-
}
|
|
541
|
-
const maxWaitMs = Math.max(1e3, params.maxWaitMs ?? 20 * 6e4);
|
|
542
|
-
if (Date.now() - startedAt >= maxWaitMs) {
|
|
543
|
-
results[item.index] = {
|
|
544
|
-
index: item.index,
|
|
545
|
-
success: false,
|
|
546
|
-
error: `Company signal enrichment ${item.raw.signal_run_id || item.raw.run_id || ""} did not complete within ${maxWaitMs}ms`
|
|
547
|
-
};
|
|
548
|
-
continue;
|
|
549
|
-
}
|
|
550
|
-
const signalRunId = item.raw.signal_run_id || item.raw.run_id;
|
|
551
|
-
if (!signalRunId) {
|
|
552
|
-
results[item.index] = { index: item.index, success: false, error: "Company signal enrichment is processing without a signal_run_id" };
|
|
553
|
-
continue;
|
|
554
|
-
}
|
|
555
|
-
nextDelayMs = Math.min(
|
|
556
|
-
nextDelayMs,
|
|
557
|
-
signalPollDelayMs(item.raw, params.pollIntervalMs),
|
|
558
|
-
maxWaitMs - (Date.now() - startedAt)
|
|
559
|
-
);
|
|
560
|
-
nextPending.push({
|
|
561
|
-
...task,
|
|
562
|
-
request: { ...task.request, signal_run_id: signalRunId }
|
|
563
|
-
});
|
|
511
|
+
const round = await this.runCoreBatchRound("api/v1/company-signals", initialTasks, options);
|
|
512
|
+
const results = round.map((item) => {
|
|
513
|
+
if (!item.success || !item.raw) {
|
|
514
|
+
return batchItemFailure(item.index, item.error || "Company Signal batch request failed", item.raw ?? item);
|
|
564
515
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
516
|
+
try {
|
|
517
|
+
assertTerminalSignalResponse(item.raw, "Company Signals");
|
|
518
|
+
return { index: item.index, success: true, data: normalizeCompanySignalResult(companies[item.index], item.raw) };
|
|
519
|
+
} catch (error) {
|
|
520
|
+
return batchItemFailure(item.index, error instanceof Error ? error.message : String(error), item.raw);
|
|
521
|
+
}
|
|
522
|
+
});
|
|
569
523
|
const compactedResults = compactExactDuplicateResults(results, options?.compactDuplicates === true);
|
|
570
524
|
const succeeded = compactedResults.filter((item) => item.success).length;
|
|
571
525
|
return {
|
|
@@ -579,37 +533,27 @@ var Signaliz = class {
|
|
|
579
533
|
async signalToCopy(params) {
|
|
580
534
|
validateSignalToCopyParams(params);
|
|
581
535
|
const request = signalToCopyRequestBody(params);
|
|
582
|
-
|
|
583
|
-
if (
|
|
584
|
-
|
|
585
|
-
const startedAt = Date.now();
|
|
586
|
-
while (Date.now() - startedAt < maxWaitMs) {
|
|
587
|
-
if (!await waitForNextSignalPoll(data, params.pollIntervalMs, startedAt, maxWaitMs)) break;
|
|
588
|
-
const signalRunId = data.signal_run_id || data.run_id;
|
|
589
|
-
data = await this.client.post("api/v1/signal-to-copy", data.resume_context_persisted === true ? { signal_run_id: signalRunId } : { ...request, signal_run_id: signalRunId });
|
|
590
|
-
if (!isPendingSignalResponse(data)) break;
|
|
591
|
-
}
|
|
592
|
-
if (isPendingSignalResponse(data)) {
|
|
593
|
-
throw new Error(`Signal Copy ${data.run_id} did not complete within ${maxWaitMs}ms`);
|
|
594
|
-
}
|
|
595
|
-
}
|
|
536
|
+
const data = await this.client.post("api/v1/signal-to-copy", request);
|
|
537
|
+
if (isCoreProductDryRun(data)) return normalizeCoreProductDryRunResult(data);
|
|
538
|
+
assertTerminalSignalResponse(data, "Signal to Copy");
|
|
596
539
|
return normalizeSignalToCopyResult(data);
|
|
597
540
|
}
|
|
598
541
|
async createSignalCopyBatch(requests, options) {
|
|
599
542
|
validateBatchSize(requests);
|
|
600
543
|
requests.forEach(validateSignalToCopyParams);
|
|
544
|
+
if (options?.dryRun === true) {
|
|
545
|
+
return this.runCoreProductDryRun(
|
|
546
|
+
"api/v1/signal-to-copy",
|
|
547
|
+
requests.map(signalToCopyRequestBody),
|
|
548
|
+
options.idempotencyKey
|
|
549
|
+
);
|
|
550
|
+
}
|
|
601
551
|
const startedAt = Date.now();
|
|
602
552
|
const deduplicated = dedupeExactBatchItems(requests, (params) => JSON.stringify({
|
|
603
|
-
request: signalToCopyRequestBody(params)
|
|
604
|
-
wait_for_result: params.waitForResult,
|
|
605
|
-
max_wait_ms: params.maxWaitMs,
|
|
606
|
-
poll_interval_ms: params.pollIntervalMs
|
|
553
|
+
request: signalToCopyRequestBody(params)
|
|
607
554
|
}));
|
|
608
555
|
const uniqueRequests = deduplicated.uniqueItems;
|
|
609
|
-
const
|
|
610
|
-
(params) => (!params.signalRunId || !params.signalRunId.startsWith("copy_") && [params.companyDomain, params.personName, params.title, params.campaignOffer].every((value) => typeof value === "string" && Boolean(value.trim()))) && params.waitForResult !== false && params.skipCache !== true && params.enableDeepSearch !== true && params.maxWaitMs === void 0 && params.pollIntervalMs === void 0
|
|
611
|
-
);
|
|
612
|
-
const uniqueResults = canUseRecoverableAvailableDataJob ? await this.runAvailableSignalCopyBatchJob(uniqueRequests, options) : await this.runSignalCopyBatchChunks(uniqueRequests, options);
|
|
556
|
+
const uniqueResults = await this.runSignalCopyBatchChunks(uniqueRequests, options);
|
|
613
557
|
const results = requests.map((_, index) => ({
|
|
614
558
|
...uniqueResults[deduplicated.sourceIndexByInput[index]],
|
|
615
559
|
index
|
|
@@ -624,6 +568,17 @@ var Signaliz = class {
|
|
|
624
568
|
results: compactedResults
|
|
625
569
|
};
|
|
626
570
|
}
|
|
571
|
+
async runCoreProductDryRun(path2, requests, idempotencyKey) {
|
|
572
|
+
const data = await this.client.post(path2, compact({
|
|
573
|
+
requests,
|
|
574
|
+
dry_run: true,
|
|
575
|
+
idempotency_key: idempotencyKey
|
|
576
|
+
}));
|
|
577
|
+
if (!isCoreProductDryRun(data)) {
|
|
578
|
+
throw new Error(`${path2} dry run returned a live-result contract`);
|
|
579
|
+
}
|
|
580
|
+
return normalizeCoreProductDryRunResult(data);
|
|
581
|
+
}
|
|
627
582
|
async runSignalCopyBatchChunks(uniqueRequests, options) {
|
|
628
583
|
const chunks = [];
|
|
629
584
|
for (let offset = 0; offset < uniqueRequests.length; offset += 25) {
|
|
@@ -654,22 +609,6 @@ var Signaliz = class {
|
|
|
654
609
|
}
|
|
655
610
|
return uniqueResults;
|
|
656
611
|
}
|
|
657
|
-
async runAvailableSignalCopyBatchJob(requests, options) {
|
|
658
|
-
const rows = await this.runRecoverableCoreBatchJob(
|
|
659
|
-
"api/v1/signal-to-copy",
|
|
660
|
-
requests.map(signalToCopyRequestBody),
|
|
661
|
-
"Signal to Copy",
|
|
662
|
-
500,
|
|
663
|
-
20 * 6e4,
|
|
664
|
-
options?.idempotencyKey
|
|
665
|
-
);
|
|
666
|
-
const results = new Array(requests.length);
|
|
667
|
-
for (const row of rows) {
|
|
668
|
-
const index = Number(row.index);
|
|
669
|
-
results[index] = recoverableJobRowFailed(row) ? batchItemFailure(index, row.error || row.message || "Signal to Copy failed", row) : { index, success: true, data: normalizeSignalToCopyResult(row) };
|
|
670
|
-
}
|
|
671
|
-
return results;
|
|
672
|
-
}
|
|
673
612
|
async runRecoverableCoreBatchJob(path2, requests, label, pageSize = 500, maxWaitMs = 20 * 6e4, idempotencyKey) {
|
|
674
613
|
const startedAt = Date.now();
|
|
675
614
|
const submissionIdempotencyKey = idempotencyKey?.trim() || newBatchIdempotencyKey(label);
|
|
@@ -741,77 +680,35 @@ var Signaliz = class {
|
|
|
741
680
|
return rows;
|
|
742
681
|
}
|
|
743
682
|
async runSignalCopyBatchChunk(requests, concurrency, rowRateLimitAttempt = 0) {
|
|
744
|
-
const startedAt = Date.now();
|
|
745
683
|
const results = new Array(requests.length);
|
|
746
684
|
const rateLimited = [];
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
const task = pending[index];
|
|
764
|
-
const item = data.results[index];
|
|
765
|
-
if (item.success === false) {
|
|
766
|
-
if (rowRateLimitAttempt < MAX_ROW_RATE_LIMIT_RETRIES && isRetryableRowRateLimit({
|
|
767
|
-
index: task.index,
|
|
768
|
-
success: false,
|
|
769
|
-
raw: item
|
|
770
|
-
})) {
|
|
771
|
-
rateLimited.push({ index: task.index, params: task.params, raw: item });
|
|
772
|
-
continue;
|
|
773
|
-
}
|
|
774
|
-
results[task.index] = batchItemFailure(
|
|
775
|
-
task.index,
|
|
776
|
-
item.error || item.message || "Signal to Copy failed",
|
|
777
|
-
item
|
|
778
|
-
);
|
|
779
|
-
continue;
|
|
780
|
-
}
|
|
781
|
-
if (!isPendingSignalResponse(item)) {
|
|
782
|
-
results[task.index] = { index: task.index, success: true, data: normalizeSignalToCopyResult(item) };
|
|
783
|
-
continue;
|
|
784
|
-
}
|
|
785
|
-
if (task.params.waitForResult === false) {
|
|
786
|
-
results[task.index] = { index: task.index, success: true, data: normalizeSignalToCopyResult(item) };
|
|
787
|
-
continue;
|
|
788
|
-
}
|
|
789
|
-
const maxWaitMs = Math.max(1e3, task.params.maxWaitMs ?? 20 * 6e4);
|
|
790
|
-
if (Date.now() - startedAt >= maxWaitMs) {
|
|
791
|
-
results[task.index] = {
|
|
792
|
-
index: task.index,
|
|
793
|
-
success: false,
|
|
794
|
-
error: `Signal Copy ${item.signal_run_id || item.run_id || ""} did not complete within ${maxWaitMs}ms`
|
|
795
|
-
};
|
|
796
|
-
continue;
|
|
797
|
-
}
|
|
798
|
-
const signalRunId = item.signal_run_id || item.run_id;
|
|
799
|
-
if (!signalRunId) {
|
|
800
|
-
results[task.index] = { index: task.index, success: false, error: "Signal Copy is processing without a signal_run_id" };
|
|
685
|
+
const data = await this.client.post("api/v1/signal-to-copy", {
|
|
686
|
+
requests: requests.map(signalToCopyRequestBody),
|
|
687
|
+
concurrency
|
|
688
|
+
});
|
|
689
|
+
if (!Array.isArray(data.results) || data.results.length !== requests.length) {
|
|
690
|
+
throw new Error("Signal to Copy batch returned an invalid result count");
|
|
691
|
+
}
|
|
692
|
+
for (let index = 0; index < requests.length; index += 1) {
|
|
693
|
+
const item = data.results[index];
|
|
694
|
+
if (item.success === false) {
|
|
695
|
+
if (rowRateLimitAttempt < MAX_ROW_RATE_LIMIT_RETRIES && isRetryableRowRateLimit({
|
|
696
|
+
index,
|
|
697
|
+
success: false,
|
|
698
|
+
raw: item
|
|
699
|
+
})) {
|
|
700
|
+
rateLimited.push({ index, params: requests[index], raw: item });
|
|
801
701
|
continue;
|
|
802
702
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
);
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
});
|
|
703
|
+
results[index] = batchItemFailure(index, item.error || item.message || "Signal to Copy failed", item);
|
|
704
|
+
continue;
|
|
705
|
+
}
|
|
706
|
+
try {
|
|
707
|
+
assertTerminalSignalResponse(item, "Signal to Copy");
|
|
708
|
+
results[index] = { index, success: true, data: normalizeSignalToCopyResult(item) };
|
|
709
|
+
} catch (error) {
|
|
710
|
+
results[index] = batchItemFailure(index, error instanceof Error ? error.message : String(error), item);
|
|
812
711
|
}
|
|
813
|
-
pending = nextPending;
|
|
814
|
-
if (pending.length > 0) await sleep2(nextDelayMs);
|
|
815
712
|
}
|
|
816
713
|
if (rateLimited.length > 0) {
|
|
817
714
|
await sleep2(rowRateLimitDelayMs(rateLimited.map((item) => ({
|
|
@@ -830,12 +727,12 @@ var Signaliz = class {
|
|
|
830
727
|
}
|
|
831
728
|
return results;
|
|
832
729
|
}
|
|
833
|
-
async runCoreBatchRound(path2, tasks, options,
|
|
730
|
+
async runCoreBatchRound(path2, tasks, options, rowRateLimitAttempt = 0) {
|
|
834
731
|
const { serverConcurrency, chunkConcurrency } = batchConcurrencyPlan(options);
|
|
835
732
|
const deduplicated = dedupeExactBatchItems(tasks, (task) => JSON.stringify(task.request));
|
|
836
733
|
const uniqueTasks = deduplicated.uniqueItems;
|
|
837
|
-
const recoverableBatch = path2 === "api/v1/find-email" ? { label: "Find Email", pageSize: 500, maxWaitMs: 20 * 6e4 } : path2 === "api/v1/verify-email" ? { label: "Verify Email", pageSize: 500, maxWaitMs: 20 * 6e4 } :
|
|
838
|
-
if (recoverableBatch && uniqueTasks.length > 25) {
|
|
734
|
+
const recoverableBatch = path2 === "api/v1/find-email" ? { label: "Find Email", pageSize: 500, maxWaitMs: 20 * 6e4 } : path2 === "api/v1/verify-email" ? { label: "Verify Email", pageSize: 500, maxWaitMs: 20 * 6e4 } : void 0;
|
|
735
|
+
if (path2 !== "api/v1/company-signals" && recoverableBatch && uniqueTasks.length > 25) {
|
|
839
736
|
const rows = await this.runRecoverableCoreBatchJob(
|
|
840
737
|
path2,
|
|
841
738
|
uniqueTasks.map((task) => task.request),
|
|
@@ -907,7 +804,6 @@ var Signaliz = class {
|
|
|
907
804
|
path2,
|
|
908
805
|
retryTasks,
|
|
909
806
|
options,
|
|
910
|
-
void 0,
|
|
911
807
|
rowRateLimitAttempt + 1
|
|
912
808
|
);
|
|
913
809
|
const retriedByIndex = new Map(retried.map((item) => [item.index, item]));
|
|
@@ -982,9 +878,34 @@ function findEmailRequestBody(params) {
|
|
|
982
878
|
last_name: params.lastName,
|
|
983
879
|
linkedin_url: params.linkedinUrl,
|
|
984
880
|
company_name: params.companyName,
|
|
985
|
-
skip_cache: params.skipCache
|
|
881
|
+
skip_cache: params.skipCache,
|
|
882
|
+
dry_run: params.dryRun,
|
|
883
|
+
idempotency_key: params.idempotencyKey
|
|
986
884
|
});
|
|
987
885
|
}
|
|
886
|
+
function isCoreProductDryRun(data) {
|
|
887
|
+
return data.dry_run === true && data.status === "planned";
|
|
888
|
+
}
|
|
889
|
+
function normalizeCoreProductDryRunResult(data) {
|
|
890
|
+
const estimatedCredits = data.estimated_credits && typeof data.estimated_credits === "object" ? data.estimated_credits : { min: 0, max: 0 };
|
|
891
|
+
return {
|
|
892
|
+
success: true,
|
|
893
|
+
dryRun: true,
|
|
894
|
+
status: "planned",
|
|
895
|
+
capability: String(data.capability || ""),
|
|
896
|
+
inputCount: Number(data.input_count || 0),
|
|
897
|
+
recoveryReadCount: Number(data.recovery_read_count || 0),
|
|
898
|
+
plan: data.plan && typeof data.plan === "object" ? data.plan : {},
|
|
899
|
+
estimate: data.estimate && typeof data.estimate === "object" ? data.estimate : {},
|
|
900
|
+
estimatedCredits: {
|
|
901
|
+
min: Number(estimatedCredits.min || 0),
|
|
902
|
+
max: Number(estimatedCredits.max || 0)
|
|
903
|
+
},
|
|
904
|
+
creditsCharged: 0,
|
|
905
|
+
sideEffects: Array.isArray(data.side_effects) ? data.side_effects : [],
|
|
906
|
+
raw: data
|
|
907
|
+
};
|
|
908
|
+
}
|
|
988
909
|
function normalizeFindEmailResult(data) {
|
|
989
910
|
const email = typeof data.email === "string" && data.email.trim() ? data.email.trim() : null;
|
|
990
911
|
const found = Boolean(email) && data.found !== false;
|
|
@@ -1046,39 +967,17 @@ function companySignalRequestBody(params) {
|
|
|
1046
967
|
lookback_days: params.lookbackDays,
|
|
1047
968
|
online,
|
|
1048
969
|
enable_deep_search: params.enableDeepSearch ?? online,
|
|
970
|
+
search_mode: params.searchMode ?? "balanced",
|
|
1049
971
|
include_summary: params.includeSummary,
|
|
1050
972
|
enable_outreach_intelligence: params.enableOutreachIntelligence,
|
|
1051
973
|
enable_predictive_intelligence: params.enablePredictiveIntelligence,
|
|
1052
974
|
skip_cache: params.skipCache,
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
975
|
+
wait_for_result: true,
|
|
976
|
+
max_wait_ms: params.maxWaitMs,
|
|
977
|
+
dry_run: params.dryRun,
|
|
978
|
+
idempotency_key: params.idempotencyKey
|
|
1057
979
|
});
|
|
1058
980
|
}
|
|
1059
|
-
function companySignalRecoverableBatchOptions(companies, tasks) {
|
|
1060
|
-
if (companies.length <= 25 || companies.some((params) => params.waitForResult === false || Boolean(params.signalRunId))) {
|
|
1061
|
-
return void 0;
|
|
1062
|
-
}
|
|
1063
|
-
const maxWaitMs = Math.max(1e3, companies[0].maxWaitMs ?? 20 * 6e4);
|
|
1064
|
-
if (companies.some((params) => Math.max(1e3, params.maxWaitMs ?? 20 * 6e4) !== maxWaitMs)) {
|
|
1065
|
-
return void 0;
|
|
1066
|
-
}
|
|
1067
|
-
const configKey = (request) => {
|
|
1068
|
-
const {
|
|
1069
|
-
company_domain: _companyDomain,
|
|
1070
|
-
company_name: _companyName,
|
|
1071
|
-
signal_run_id: _signalRunId,
|
|
1072
|
-
wait_for_result: _waitForResult,
|
|
1073
|
-
max_wait_ms: _maxWaitMs,
|
|
1074
|
-
...config
|
|
1075
|
-
} = request;
|
|
1076
|
-
return JSON.stringify(config);
|
|
1077
|
-
};
|
|
1078
|
-
const sharedConfig = configKey(tasks[0].request);
|
|
1079
|
-
if (tasks.some((task) => configKey(task.request) !== sharedConfig)) return void 0;
|
|
1080
|
-
return { label: "Company Signals", pageSize: 25, maxWaitMs };
|
|
1081
|
-
}
|
|
1082
981
|
function normalizeCompanySignalResult(params, data) {
|
|
1083
982
|
const rawSignals = data.signals ?? data.signal_feed ?? [];
|
|
1084
983
|
return {
|
|
@@ -1225,7 +1124,10 @@ function signalToCopyRequestBody(params) {
|
|
|
1225
1124
|
research_prompt: params.researchPrompt,
|
|
1226
1125
|
signal_run_id: params.signalRunId,
|
|
1227
1126
|
skip_cache: params.skipCache,
|
|
1228
|
-
enable_deep_search: params.enableDeepSearch
|
|
1127
|
+
enable_deep_search: params.enableDeepSearch,
|
|
1128
|
+
max_wait_ms: params.maxWaitMs,
|
|
1129
|
+
dry_run: params.dryRun,
|
|
1130
|
+
idempotency_key: params.idempotencyKey
|
|
1229
1131
|
});
|
|
1230
1132
|
}
|
|
1231
1133
|
function validateSignalToCopyParams(params) {
|
|
@@ -1270,11 +1172,10 @@ function normalizeSignalToCopyResult(data) {
|
|
|
1270
1172
|
function isPendingSignalResponse(data) {
|
|
1271
1173
|
return ["triggered", "queued", "processing", "pending", "pending_version", "waiting_for_deploy"].includes(String(data.status || "").toLowerCase());
|
|
1272
1174
|
}
|
|
1273
|
-
function
|
|
1274
|
-
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
return ["failed", "error", "cancelled", "canceled", "crashed", "timed_out"].includes(String(data.status || "").toLowerCase());
|
|
1175
|
+
function assertTerminalSignalResponse(data, capability) {
|
|
1176
|
+
if (isPendingSignalResponse(data) || data.job_id) {
|
|
1177
|
+
throw new Error(`${capability} violated the synchronous response contract.`);
|
|
1178
|
+
}
|
|
1278
1179
|
}
|
|
1279
1180
|
function signalPollDelayMs(data, override) {
|
|
1280
1181
|
if (override !== void 0) return Math.max(250, override);
|
package/dist/mcp-config.mjs
CHANGED
package/package.json
CHANGED